fidl_fuchsia_net_neighbor_ext/
lib.rs1#![deny(missing_docs)]
8
9use fidl_table_validation::*;
10use {
11 fidl_fuchsia_net as fnet, fidl_fuchsia_net_ext as fnet_ext,
12 fidl_fuchsia_net_neighbor as fnet_neighbor, zx_types as zx,
13};
14
15#[derive(Clone, Debug, Eq, PartialEq, ValidFidlTable)]
17#[fidl_table_src(fnet_neighbor::Entry)]
18#[fidl_table_strict]
19pub struct Entry {
20 pub interface: u64,
22 pub neighbor: fnet::IpAddress,
24 pub state: fnet_neighbor::EntryState,
27 #[fidl_field_type(optional)]
29 pub mac: Option<fnet::MacAddress>,
30 pub updated_at: zx::zx_time_t,
34}
35
36pub fn display_entry_state(state: &fnet_neighbor::EntryState) -> &'static str {
38 match state {
39 fnet_neighbor::EntryState::Incomplete => "INCOMPLETE",
40 fnet_neighbor::EntryState::Reachable => "REACHABLE",
41 fnet_neighbor::EntryState::Stale => "STALE",
42 fnet_neighbor::EntryState::Delay => "DELAY",
43 fnet_neighbor::EntryState::Probe => "PROBE",
44 fnet_neighbor::EntryState::Static => "STATIC",
45 fnet_neighbor::EntryState::Unreachable => "UNREACHABLE",
46 }
47}
48
49impl std::fmt::Display for Entry {
50 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
51 let Self { interface, neighbor, mac, state, updated_at: _ } = self;
52 write!(f, "Interface {} | IP {} | MAC ", interface, fnet_ext::IpAddress::from(*neighbor))?;
53 if let Some(mac) = mac {
54 write!(f, "{}", fnet_ext::MacAddress::from(*mac))?;
55 } else {
56 write!(f, "?")?;
57 }
58 write!(f, " | {}", display_entry_state(state))
59 }
60}
61
62#[derive(Clone, Debug, Eq, PartialEq, ValidFidlTable)]
64#[fidl_table_src(fnet_neighbor::EntryIteratorOptions)]
65#[fidl_table_strict]
66pub struct EntryIteratorOptions {}