batman_robin/model/transtable.rs
1use crate::ClientFlags;
2use macaddr::MacAddr6;
3
4/// A single entry in the batman-adv transglobal table (TT).
5///
6/// The transglobal table contains information about clients known across the entire
7/// mesh network, including the client's MAC address, the originator node, and the
8/// route state.
9#[derive(Debug, Clone)]
10pub struct TransglobalEntry {
11 /// MAC address of the client.
12 /// Corresponds to `BATADV_ATTR_TT_ADDRESS`.
13 pub client: MacAddr6,
14
15 /// MAC address of the originator announcing this client.
16 /// Corresponds to `BATADV_ATTR_ORIG_ADDRESS`.
17 pub orig: MacAddr6,
18
19 /// VLAN ID associated with this client.
20 /// Corresponds to `BATADV_ATTR_TT_VID`.
21 pub vid: u16,
22
23 /// Transglobal table version used for this client.
24 /// Corresponds to `BATADV_ATTR_TT_TTVN`.
25 pub ttvn: u8,
26
27 /// Last known transglobal table version.
28 /// Corresponds to `BATADV_ATTR_TT_LAST_TTVN`.
29 pub last_ttvn: u8,
30
31 /// Flags associated with the client, wrapped in `ClientFlags`.
32 /// Corresponds to `BATADV_ATTR_TT_FLAGS`.
33 pub flags: ClientFlags,
34
35 /// CRC32 checksum for this entry.
36 /// Corresponds to `BATADV_ATTR_TT_CRC32`.
37 pub crc32: u32,
38
39 /// Indicates if this route is considered the best route to this client.
40 /// Corresponds to `BATADV_ATTR_FLAG_BEST`.
41 pub is_best: bool,
42}
43
44/// A single entry in the batman-adv translocal table (TL).
45///
46/// The translocal table contains clients directly known by the local node,
47/// including last-seen timestamps and flags.
48pub struct TranslocalEntry {
49 /// MAC address of the client.
50 pub client: MacAddr6,
51
52 /// VLAN ID associated with this client.
53 pub vid: u16,
54
55 /// Flags associated with the client, wrapped in `ClientFlags`.
56 pub flags: ClientFlags,
57
58 /// CRC32 checksum for this entry.
59 pub crc32: u32,
60
61 /// Seconds since the last update for this entry.
62 pub last_seen_secs: u32,
63
64 /// Milliseconds since the last update for this entry.
65 pub last_seen_msecs: u32,
66}