batman_robin/model/neighbor.rs
1use macaddr::MacAddr6;
2
3/// Represents a neighboring node in the batman-adv mesh network.
4///
5/// A neighbor is a directly reachable node within the mesh. This struct provides
6/// information about its MAC address, the interface used to reach it, and metrics such as
7/// last seen time and optional throughput.
8#[derive(Debug, Clone)]
9pub struct Neighbor {
10 /// MAC address of the neighbor.
11 /// Corresponds to `BATADV_ATTR_NEIGH_ADDRESS`.
12 pub neigh: MacAddr6,
13
14 /// Outgoing interface name used to reach the neighbor.
15 /// Falls back from `HARD_IFINDEX` if `HARD_IFNAME` is unavailable.
16 /// Corresponds to `BATADV_ATTR_HARD_IFNAME`.
17 pub outgoing_if: String,
18
19 /// Time since the neighbor was last seen, in milliseconds.
20 /// Corresponds to `BATADV_ATTR_LAST_SEEN_MSECS`.
21 pub last_seen_ms: u32,
22
23 /// Optional throughput towards this neighbor in kilobits per second.
24 /// Corresponds to `BATADV_ATTR_THROUGHPUT`.
25 /// Only available in BATMAN_V mode.
26 pub throughput_kbps: Option<u32>,
27}