batman_adv.h 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. /* SPDX-License-Identifier: MIT */
  2. /* Copyright (C) 2016-2017 B.A.T.M.A.N. contributors:
  3. *
  4. * Matthias Schiffer
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a
  7. * copy of this software and associated documentation files (the "Software"),
  8. * to deal in the Software without restriction, including without limitation
  9. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10. * and/or sell copies of the Software, and to permit persons to whom the
  11. * Software is furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in
  14. * all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  21. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  22. * DEALINGS IN THE SOFTWARE.
  23. */
  24. #ifndef _UAPI_LINUX_BATMAN_ADV_H_
  25. #define _UAPI_LINUX_BATMAN_ADV_H_
  26. #define BATADV_NL_NAME "batadv"
  27. #define BATADV_NL_MCAST_GROUP_TPMETER "tpmeter"
  28. /**
  29. * enum batadv_tt_client_flags - TT client specific flags
  30. *
  31. * Bits from 0 to 7 are called _remote flags_ because they are sent on the wire.
  32. * Bits from 8 to 15 are called _local flags_ because they are used for local
  33. * computations only.
  34. *
  35. * Bits from 4 to 7 - a subset of remote flags - are ensured to be in sync with
  36. * the other nodes in the network. To achieve this goal these flags are included
  37. * in the TT CRC computation.
  38. */
  39. enum batadv_tt_client_flags {
  40. /**
  41. * @BATADV_TT_CLIENT_DEL: the client has to be deleted from the table
  42. */
  43. BATADV_TT_CLIENT_DEL = (1 << 0),
  44. /**
  45. * @BATADV_TT_CLIENT_ROAM: the client roamed to/from another node and
  46. * the new update telling its new real location has not been
  47. * received/sent yet
  48. */
  49. BATADV_TT_CLIENT_ROAM = (1 << 1),
  50. /**
  51. * @BATADV_TT_CLIENT_WIFI: this client is connected through a wifi
  52. * interface. This information is used by the "AP Isolation" feature
  53. */
  54. BATADV_TT_CLIENT_WIFI = (1 << 4),
  55. /**
  56. * @BATADV_TT_CLIENT_ISOLA: this client is considered "isolated". This
  57. * information is used by the Extended Isolation feature
  58. */
  59. BATADV_TT_CLIENT_ISOLA = (1 << 5),
  60. /**
  61. * @BATADV_TT_CLIENT_NOPURGE: this client should never be removed from
  62. * the table
  63. */
  64. BATADV_TT_CLIENT_NOPURGE = (1 << 8),
  65. /**
  66. * @BATADV_TT_CLIENT_NEW: this client has been added to the local table
  67. * but has not been announced yet
  68. */
  69. BATADV_TT_CLIENT_NEW = (1 << 9),
  70. /**
  71. * @BATADV_TT_CLIENT_PENDING: this client is marked for removal but it
  72. * is kept in the table for one more originator interval for consistency
  73. * purposes
  74. */
  75. BATADV_TT_CLIENT_PENDING = (1 << 10),
  76. /**
  77. * @BATADV_TT_CLIENT_TEMP: this global client has been detected to be
  78. * part of the network but no nnode has already announced it
  79. */
  80. BATADV_TT_CLIENT_TEMP = (1 << 11),
  81. };
  82. /**
  83. * enum batadv_nl_attrs - batman-adv netlink attributes
  84. */
  85. enum batadv_nl_attrs {
  86. /**
  87. * @BATADV_ATTR_UNSPEC: unspecified attribute to catch errors
  88. */
  89. BATADV_ATTR_UNSPEC,
  90. /**
  91. * @BATADV_ATTR_VERSION: batman-adv version string
  92. */
  93. BATADV_ATTR_VERSION,
  94. /**
  95. * @BATADV_ATTR_ALGO_NAME: name of routing algorithm
  96. */
  97. BATADV_ATTR_ALGO_NAME,
  98. /**
  99. * @BATADV_ATTR_MESH_IFINDEX: index of the batman-adv interface
  100. */
  101. BATADV_ATTR_MESH_IFINDEX,
  102. /**
  103. * @BATADV_ATTR_MESH_IFNAME: name of the batman-adv interface
  104. */
  105. BATADV_ATTR_MESH_IFNAME,
  106. /**
  107. * @BATADV_ATTR_MESH_ADDRESS: mac address of the batman-adv interface
  108. */
  109. BATADV_ATTR_MESH_ADDRESS,
  110. /**
  111. * @BATADV_ATTR_HARD_IFINDEX: index of the non-batman-adv interface
  112. */
  113. BATADV_ATTR_HARD_IFINDEX,
  114. /**
  115. * @BATADV_ATTR_HARD_IFNAME: name of the non-batman-adv interface
  116. */
  117. BATADV_ATTR_HARD_IFNAME,
  118. /**
  119. * @BATADV_ATTR_HARD_ADDRESS: mac address of the non-batman-adv
  120. * interface
  121. */
  122. BATADV_ATTR_HARD_ADDRESS,
  123. /**
  124. * @BATADV_ATTR_ORIG_ADDRESS: originator mac address
  125. */
  126. BATADV_ATTR_ORIG_ADDRESS,
  127. /**
  128. * @BATADV_ATTR_TPMETER_RESULT: result of run (see
  129. * batadv_tp_meter_status)
  130. */
  131. BATADV_ATTR_TPMETER_RESULT,
  132. /**
  133. * @BATADV_ATTR_TPMETER_TEST_TIME: time (msec) the run took
  134. */
  135. BATADV_ATTR_TPMETER_TEST_TIME,
  136. /**
  137. * @BATADV_ATTR_TPMETER_BYTES: amount of acked bytes during run
  138. */
  139. BATADV_ATTR_TPMETER_BYTES,
  140. /**
  141. * @BATADV_ATTR_TPMETER_COOKIE: session cookie to match tp_meter session
  142. */
  143. BATADV_ATTR_TPMETER_COOKIE,
  144. /**
  145. * @BATADV_ATTR_PAD: attribute used for padding for 64-bit alignment
  146. */
  147. BATADV_ATTR_PAD,
  148. /**
  149. * @BATADV_ATTR_ACTIVE: Flag indicating if the hard interface is active
  150. */
  151. BATADV_ATTR_ACTIVE,
  152. /**
  153. * @BATADV_ATTR_TT_ADDRESS: Client MAC address
  154. */
  155. BATADV_ATTR_TT_ADDRESS,
  156. /**
  157. * @BATADV_ATTR_TT_TTVN: Translation table version
  158. */
  159. BATADV_ATTR_TT_TTVN,
  160. /**
  161. * @BATADV_ATTR_TT_LAST_TTVN: Previous translation table version
  162. */
  163. BATADV_ATTR_TT_LAST_TTVN,
  164. /**
  165. * @BATADV_ATTR_TT_CRC32: CRC32 over translation table
  166. */
  167. BATADV_ATTR_TT_CRC32,
  168. /**
  169. * @BATADV_ATTR_TT_VID: VLAN ID
  170. */
  171. BATADV_ATTR_TT_VID,
  172. /**
  173. * @BATADV_ATTR_TT_FLAGS: Translation table client flags
  174. */
  175. BATADV_ATTR_TT_FLAGS,
  176. /**
  177. * @BATADV_ATTR_FLAG_BEST: Flags indicating entry is the best
  178. */
  179. BATADV_ATTR_FLAG_BEST,
  180. /**
  181. * @BATADV_ATTR_LAST_SEEN_MSECS: Time in milliseconds since last seen
  182. */
  183. BATADV_ATTR_LAST_SEEN_MSECS,
  184. /**
  185. * @BATADV_ATTR_NEIGH_ADDRESS: Neighbour MAC address
  186. */
  187. BATADV_ATTR_NEIGH_ADDRESS,
  188. /**
  189. * @BATADV_ATTR_TQ: TQ to neighbour
  190. */
  191. BATADV_ATTR_TQ,
  192. /**
  193. * @BATADV_ATTR_THROUGHPUT: Estimated throughput to Neighbour
  194. */
  195. BATADV_ATTR_THROUGHPUT,
  196. /**
  197. * @BATADV_ATTR_BANDWIDTH_UP: Reported uplink bandwidth
  198. */
  199. BATADV_ATTR_BANDWIDTH_UP,
  200. /**
  201. * @BATADV_ATTR_BANDWIDTH_DOWN: Reported downlink bandwidth
  202. */
  203. BATADV_ATTR_BANDWIDTH_DOWN,
  204. /**
  205. * @BATADV_ATTR_ROUTER: Gateway router MAC address
  206. */
  207. BATADV_ATTR_ROUTER,
  208. /**
  209. * @BATADV_ATTR_BLA_OWN: Flag indicating own originator
  210. */
  211. BATADV_ATTR_BLA_OWN,
  212. /**
  213. * @BATADV_ATTR_BLA_ADDRESS: Bridge loop avoidance claim MAC address
  214. */
  215. BATADV_ATTR_BLA_ADDRESS,
  216. /**
  217. * @BATADV_ATTR_BLA_VID: BLA VLAN ID
  218. */
  219. BATADV_ATTR_BLA_VID,
  220. /**
  221. * @BATADV_ATTR_BLA_BACKBONE: BLA gateway originator MAC address
  222. */
  223. BATADV_ATTR_BLA_BACKBONE,
  224. /**
  225. * @BATADV_ATTR_BLA_CRC: BLA CRC
  226. */
  227. BATADV_ATTR_BLA_CRC,
  228. /* add attributes above here, update the policy in netlink.c */
  229. /**
  230. * @__BATADV_ATTR_AFTER_LAST: internal use
  231. */
  232. __BATADV_ATTR_AFTER_LAST,
  233. /**
  234. * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available
  235. */
  236. NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST,
  237. /**
  238. * @BATADV_ATTR_MAX: highest attribute number currently defined
  239. */
  240. BATADV_ATTR_MAX = __BATADV_ATTR_AFTER_LAST - 1
  241. };
  242. /**
  243. * enum batadv_nl_commands - supported batman-adv netlink commands
  244. */
  245. enum batadv_nl_commands {
  246. /**
  247. * @BATADV_CMD_UNSPEC: unspecified command to catch errors
  248. */
  249. BATADV_CMD_UNSPEC,
  250. /**
  251. * @BATADV_CMD_GET_MESH_INFO: Query basic information about batman-adv
  252. * device
  253. */
  254. BATADV_CMD_GET_MESH_INFO,
  255. /**
  256. * @BATADV_CMD_TP_METER: Start a tp meter session
  257. */
  258. BATADV_CMD_TP_METER,
  259. /**
  260. * @BATADV_CMD_TP_METER_CANCEL: Cancel a tp meter session
  261. */
  262. BATADV_CMD_TP_METER_CANCEL,
  263. /**
  264. * @BATADV_CMD_GET_ROUTING_ALGOS: Query the list of routing algorithms.
  265. */
  266. BATADV_CMD_GET_ROUTING_ALGOS,
  267. /**
  268. * @BATADV_CMD_GET_HARDIFS: Query list of hard interfaces
  269. */
  270. BATADV_CMD_GET_HARDIFS,
  271. /**
  272. * @BATADV_CMD_GET_TRANSTABLE_LOCAL: Query list of local translations
  273. */
  274. BATADV_CMD_GET_TRANSTABLE_LOCAL,
  275. /**
  276. * @BATADV_CMD_GET_TRANSTABLE_GLOBAL: Query list of global translations
  277. */
  278. BATADV_CMD_GET_TRANSTABLE_GLOBAL,
  279. /**
  280. * @BATADV_CMD_GET_ORIGINATORS: Query list of originators
  281. */
  282. BATADV_CMD_GET_ORIGINATORS,
  283. /**
  284. * @BATADV_CMD_GET_NEIGHBORS: Query list of neighbours
  285. */
  286. BATADV_CMD_GET_NEIGHBORS,
  287. /**
  288. * @BATADV_CMD_GET_GATEWAYS: Query list of gateways
  289. */
  290. BATADV_CMD_GET_GATEWAYS,
  291. /**
  292. * @BATADV_CMD_GET_BLA_CLAIM: Query list of bridge loop avoidance claims
  293. */
  294. BATADV_CMD_GET_BLA_CLAIM,
  295. /**
  296. * @BATADV_CMD_GET_BLA_BACKBONE: Query list of bridge loop avoidance
  297. * backbones
  298. */
  299. BATADV_CMD_GET_BLA_BACKBONE,
  300. /* add new commands above here */
  301. /**
  302. * @__BATADV_CMD_AFTER_LAST: internal use
  303. */
  304. __BATADV_CMD_AFTER_LAST,
  305. /**
  306. * @BATADV_CMD_MAX: highest used command number
  307. */
  308. BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST - 1
  309. };
  310. /**
  311. * enum batadv_tp_meter_reason - reason of a tp meter test run stop
  312. */
  313. enum batadv_tp_meter_reason {
  314. /**
  315. * @BATADV_TP_REASON_COMPLETE: sender finished tp run
  316. */
  317. BATADV_TP_REASON_COMPLETE = 3,
  318. /**
  319. * @BATADV_TP_REASON_CANCEL: sender was stopped during run
  320. */
  321. BATADV_TP_REASON_CANCEL = 4,
  322. /* error status >= 128 */
  323. /**
  324. * @BATADV_TP_REASON_DST_UNREACHABLE: receiver could not be reached or
  325. * didn't answer
  326. */
  327. BATADV_TP_REASON_DST_UNREACHABLE = 128,
  328. /**
  329. * @BATADV_TP_REASON_RESEND_LIMIT: (unused) sender retry reached limit
  330. */
  331. BATADV_TP_REASON_RESEND_LIMIT = 129,
  332. /**
  333. * @BATADV_TP_REASON_ALREADY_ONGOING: test to or from the same node
  334. * already ongoing
  335. */
  336. BATADV_TP_REASON_ALREADY_ONGOING = 130,
  337. /**
  338. * @BATADV_TP_REASON_MEMORY_ERROR: test was stopped due to low memory
  339. */
  340. BATADV_TP_REASON_MEMORY_ERROR = 131,
  341. /**
  342. * @BATADV_TP_REASON_CANT_SEND: failed to send via outgoing interface
  343. */
  344. BATADV_TP_REASON_CANT_SEND = 132,
  345. /**
  346. * @BATADV_TP_REASON_TOO_MANY: too many ongoing sessions
  347. */
  348. BATADV_TP_REASON_TOO_MANY = 133,
  349. };
  350. #endif /* _UAPI_LINUX_BATMAN_ADV_H_ */