Skip to main content

batman_robin/model/
attribute.rs

1/// BATMAN-adv Netlink attributes (from `linux/uapi/batman_adv.h`).
2///
3/// These attributes are used when communicating with the kernel via
4/// the BATMAN-adv generic netlink interface. They represent various
5/// settings, metrics, and state information for mesh interfaces,
6/// translation tables, neighbors, gateways, and protocol features.
7#[repr(u16)]
8#[derive(Debug, Clone, Copy, PartialEq, Eq)]
9pub enum Attribute {
10    /// Unspecified / placeholder attribute.
11    BatadvAttrUnspec = 0,
12
13    /// BATMAN-adv protocol version.
14    BatadvAttrVersion = 1,
15
16    /// Name of the routing algorithm in use.
17    BatadvAttrAlgoName = 2,
18
19    /// Mesh interface index.
20    BatadvAttrMeshIfindex = 3,
21
22    /// Mesh interface name.
23    BatadvAttrMeshIfname = 4,
24
25    /// MAC address of the mesh interface.
26    BatadvAttrMeshAddress = 5,
27
28    /// Hard interface index.
29    BatadvAttrHardIfindex = 6,
30
31    /// Hard interface name.
32    BatadvAttrHardIfname = 7,
33
34    /// MAC address of the hard interface.
35    BatadvAttrHardAddress = 8,
36
37    /// Originator (source) MAC address.
38    BatadvAttrOrigAddress = 9,
39
40    /// Throughput meter result.
41    BatadvAttrTpMeterResult = 10,
42
43    /// Throughput test duration in seconds.
44    BatadvAttrTpMeterTestTime = 11,
45
46    /// Number of bytes transferred in throughput test.
47    BatadvAttrTpMeterBytes = 12,
48
49    /// Throughput meter cookie.
50    BatadvAttrTpMeterCookie = 13,
51
52    /// Padding attribute (unused).
53    BatadvAttrPad = 14,
54
55    /// Interface active state.
56    BatadvAttrActive = 15,
57
58    /// Translation table client MAC address.
59    BatadvAttrTtAddress = 16,
60
61    /// Translation table TTVN.
62    BatadvAttrTtTtvn = 17,
63
64    /// Last TTVN in translation table.
65    BatadvAttrTtLastTtvn = 18,
66
67    /// CRC32 for translation table entry.
68    BatadvAttrTtCrc32 = 19,
69
70    /// VLAN ID for translation table entry.
71    BatadvAttrTtVid = 20,
72
73    /// Flags for translation table entry (see `ClientFlags`).
74    BatadvAttrTtFlags = 21,
75
76    /// Marks the "best" client in the translation table.
77    BatadvAttrFlagBest = 22,
78
79    /// Last seen timestamp in milliseconds.
80    BatadvAttrLastSeenMsecs = 23,
81
82    /// Neighbor MAC address.
83    BatadvAttrNeighAddress = 24,
84
85    /// Transmission quality (TQ) metric.
86    BatadvAttrTq = 25,
87
88    /// Throughput in bytes per second (optional, BATMAN_V).
89    BatadvAttrThroughput = 26,
90
91    /// Gateway bandwidth upstream (kbit/s).
92    BatadvAttrBandwidthUp = 27,
93
94    /// Gateway bandwidth downstream (kbit/s).
95    BatadvAttrBandwidthDown = 28,
96
97    /// Gateway MAC address for router.
98    BatadvAttrRouter = 29,
99
100    /// Backbone link advertisement (BLA) own attribute.
101    BatadvAttrBlaOwn = 30,
102
103    /// BLA MAC address.
104    BatadvAttrBlaAddress = 31,
105
106    /// BLA VLAN ID.
107    BatadvAttrBlaVid = 32,
108
109    /// BLA backbone flag.
110    BatadvAttrBlaBackbone = 33,
111
112    /// BLA CRC.
113    BatadvAttrBlaCrc = 34,
114
115    /// DAT IPv4 address.
116    BatadvAttrDatCacheIp4Address = 35,
117
118    /// DAT hardware (MAC) address.
119    BatadvAttrDatCacheHwAddress = 36,
120
121    /// DAT VLAN ID.
122    BatadvAttrDatCacheVid = 37,
123
124    /// Multicast flags.
125    BatadvAttrMcastFlags = 38,
126
127    /// Private multicast flags.
128    BatadvAttrMcastFlagsPriv = 39,
129
130    /// VLAN ID.
131    BatadvAttrVlanId = 40,
132
133    /// OGMs aggregation enabled.
134    BatadvAttrAggregatedOgmsEnabled = 41,
135
136    /// AP isolation enabled.
137    BatadvAttrApIsolationEnabled = 42,
138
139    /// Isolation mark.
140    BatadvAttrIsolationMark = 43,
141
142    /// Isolation mask.
143    BatadvAttrIsolationMask = 44,
144
145    /// Bonding enabled flag.
146    BatadvAttrBondingEnabled = 45,
147
148    /// Bridge loop avoidance enabled flag.
149    BatadvAttrBridgeLoopAvoidanceEnabled = 46,
150
151    /// Distributed ARP table enabled flag.
152    BatadvAttrDistributedArpTableEnabled = 47,
153
154    /// Fragmentation enabled flag.
155    BatadvAttrFragmentationEnabled = 48,
156
157    /// Gateway bandwidth downstream.
158    BatadvAttrGwBandwidthDown = 49,
159
160    /// Gateway bandwidth upstream.
161    BatadvAttrGwBandwidthUp = 50,
162
163    /// Gateway mode (off/client/server).
164    BatadvAttrGwMode = 51,
165
166    /// Gateway selection class.
167    BatadvAttrGwSelClass = 52,
168
169    /// Hop penalty.
170    BatadvAttrHopPenalty = 53,
171
172    /// Log level.
173    BatadvAttrLogLevel = 54,
174
175    /// Force multicast flooding enabled.
176    BatadvAttrMulticastForceFloodEnabled = 55,
177
178    /// Network coding enabled.
179    BatadvAttrNetworkCodingEnabled = 56,
180
181    /// Originator interval.
182    BatadvAttrOrigInterval = 57,
183
184    /// ELP interval.
185    BatadvAttrElpInterval = 58,
186
187    /// Throughput override.
188    BatadvAttrThroughputOverride = 59,
189
190    /// Multicast fanout.
191    BatadvAttrMulticastFanout = 60,
192}
193
194impl From<Attribute> for u16 {
195    fn from(a: Attribute) -> Self {
196        a as u16
197    }
198}