batman_adv.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. /* Copyright (C) 2016 B.A.T.M.A.N. contributors:
  2. *
  3. * Matthias Schiffer
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. #ifndef _UAPI_LINUX_BATMAN_ADV_H_
  18. #define _UAPI_LINUX_BATMAN_ADV_H_
  19. #define BATADV_NL_NAME "batadv"
  20. #define BATADV_NL_MCAST_GROUP_TPMETER "tpmeter"
  21. /**
  22. * enum batadv_tt_client_flags - TT client specific flags
  23. * @BATADV_TT_CLIENT_DEL: the client has to be deleted from the table
  24. * @BATADV_TT_CLIENT_ROAM: the client roamed to/from another node and the new
  25. * update telling its new real location has not been received/sent yet
  26. * @BATADV_TT_CLIENT_WIFI: this client is connected through a wifi interface.
  27. * This information is used by the "AP Isolation" feature
  28. * @BATADV_TT_CLIENT_ISOLA: this client is considered "isolated". This
  29. * information is used by the Extended Isolation feature
  30. * @BATADV_TT_CLIENT_NOPURGE: this client should never be removed from the table
  31. * @BATADV_TT_CLIENT_NEW: this client has been added to the local table but has
  32. * not been announced yet
  33. * @BATADV_TT_CLIENT_PENDING: this client is marked for removal but it is kept
  34. * in the table for one more originator interval for consistency purposes
  35. * @BATADV_TT_CLIENT_TEMP: this global client has been detected to be part of
  36. * the network but no nnode has already announced it
  37. *
  38. * Bits from 0 to 7 are called _remote flags_ because they are sent on the wire.
  39. * Bits from 8 to 15 are called _local flags_ because they are used for local
  40. * computations only.
  41. *
  42. * Bits from 4 to 7 - a subset of remote flags - are ensured to be in sync with
  43. * the other nodes in the network. To achieve this goal these flags are included
  44. * in the TT CRC computation.
  45. */
  46. enum batadv_tt_client_flags {
  47. BATADV_TT_CLIENT_DEL = (1 << 0),
  48. BATADV_TT_CLIENT_ROAM = (1 << 1),
  49. BATADV_TT_CLIENT_WIFI = (1 << 4),
  50. BATADV_TT_CLIENT_ISOLA = (1 << 5),
  51. BATADV_TT_CLIENT_NOPURGE = (1 << 8),
  52. BATADV_TT_CLIENT_NEW = (1 << 9),
  53. BATADV_TT_CLIENT_PENDING = (1 << 10),
  54. BATADV_TT_CLIENT_TEMP = (1 << 11),
  55. };
  56. /**
  57. * enum batadv_nl_attrs - batman-adv netlink attributes
  58. *
  59. * @BATADV_ATTR_UNSPEC: unspecified attribute to catch errors
  60. * @BATADV_ATTR_VERSION: batman-adv version string
  61. * @BATADV_ATTR_ALGO_NAME: name of routing algorithm
  62. * @BATADV_ATTR_MESH_IFINDEX: index of the batman-adv interface
  63. * @BATADV_ATTR_MESH_IFNAME: name of the batman-adv interface
  64. * @BATADV_ATTR_MESH_ADDRESS: mac address of the batman-adv interface
  65. * @BATADV_ATTR_HARD_IFINDEX: index of the non-batman-adv interface
  66. * @BATADV_ATTR_HARD_IFNAME: name of the non-batman-adv interface
  67. * @BATADV_ATTR_HARD_ADDRESS: mac address of the non-batman-adv interface
  68. * @BATADV_ATTR_ORIG_ADDRESS: originator mac address
  69. * @BATADV_ATTR_TPMETER_RESULT: result of run (see batadv_tp_meter_status)
  70. * @BATADV_ATTR_TPMETER_TEST_TIME: time (msec) the run took
  71. * @BATADV_ATTR_TPMETER_BYTES: amount of acked bytes during run
  72. * @BATADV_ATTR_TPMETER_COOKIE: session cookie to match tp_meter session
  73. * @BATADV_ATTR_PAD: attribute used for padding for 64-bit alignment
  74. * @BATADV_ATTR_ACTIVE: Flag indicating if the hard interface is active
  75. * @BATADV_ATTR_TT_ADDRESS: Client MAC address
  76. * @BATADV_ATTR_TT_TTVN: Translation table version
  77. * @BATADV_ATTR_TT_LAST_TTVN: Previous translation table version
  78. * @BATADV_ATTR_TT_CRC32: CRC32 over translation table
  79. * @BATADV_ATTR_TT_VID: VLAN ID
  80. * @BATADV_ATTR_TT_FLAGS: Translation table client flags
  81. * @BATADV_ATTR_FLAG_BEST: Flags indicating entry is the best
  82. * @BATADV_ATTR_LAST_SEEN_MSECS: Time in milliseconds since last seen
  83. * @BATADV_ATTR_NEIGH_ADDRESS: Neighbour MAC address
  84. * @BATADV_ATTR_TQ: TQ to neighbour
  85. * @BATADV_ATTR_THROUGHPUT: Estimated throughput to Neighbour
  86. * @BATADV_ATTR_BANDWIDTH_UP: Reported uplink bandwidth
  87. * @BATADV_ATTR_BANDWIDTH_DOWN: Reported downlink bandwidth
  88. * @BATADV_ATTR_ROUTER: Gateway router MAC address
  89. * @BATADV_ATTR_BLA_OWN: Flag indicating own originator
  90. * @BATADV_ATTR_BLA_ADDRESS: Bridge loop avoidance claim MAC address
  91. * @BATADV_ATTR_BLA_VID: BLA VLAN ID
  92. * @BATADV_ATTR_BLA_BACKBONE: BLA gateway originator MAC address
  93. * @BATADV_ATTR_BLA_CRC: BLA CRC
  94. * @__BATADV_ATTR_AFTER_LAST: internal use
  95. * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available
  96. * @BATADV_ATTR_MAX: highest attribute number currently defined
  97. */
  98. enum batadv_nl_attrs {
  99. BATADV_ATTR_UNSPEC,
  100. BATADV_ATTR_VERSION,
  101. BATADV_ATTR_ALGO_NAME,
  102. BATADV_ATTR_MESH_IFINDEX,
  103. BATADV_ATTR_MESH_IFNAME,
  104. BATADV_ATTR_MESH_ADDRESS,
  105. BATADV_ATTR_HARD_IFINDEX,
  106. BATADV_ATTR_HARD_IFNAME,
  107. BATADV_ATTR_HARD_ADDRESS,
  108. BATADV_ATTR_ORIG_ADDRESS,
  109. BATADV_ATTR_TPMETER_RESULT,
  110. BATADV_ATTR_TPMETER_TEST_TIME,
  111. BATADV_ATTR_TPMETER_BYTES,
  112. BATADV_ATTR_TPMETER_COOKIE,
  113. BATADV_ATTR_PAD,
  114. BATADV_ATTR_ACTIVE,
  115. BATADV_ATTR_TT_ADDRESS,
  116. BATADV_ATTR_TT_TTVN,
  117. BATADV_ATTR_TT_LAST_TTVN,
  118. BATADV_ATTR_TT_CRC32,
  119. BATADV_ATTR_TT_VID,
  120. BATADV_ATTR_TT_FLAGS,
  121. BATADV_ATTR_FLAG_BEST,
  122. BATADV_ATTR_LAST_SEEN_MSECS,
  123. BATADV_ATTR_NEIGH_ADDRESS,
  124. BATADV_ATTR_TQ,
  125. BATADV_ATTR_THROUGHPUT,
  126. BATADV_ATTR_BANDWIDTH_UP,
  127. BATADV_ATTR_BANDWIDTH_DOWN,
  128. BATADV_ATTR_ROUTER,
  129. BATADV_ATTR_BLA_OWN,
  130. BATADV_ATTR_BLA_ADDRESS,
  131. BATADV_ATTR_BLA_VID,
  132. BATADV_ATTR_BLA_BACKBONE,
  133. BATADV_ATTR_BLA_CRC,
  134. /* add attributes above here, update the policy in netlink.c */
  135. __BATADV_ATTR_AFTER_LAST,
  136. NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST,
  137. BATADV_ATTR_MAX = __BATADV_ATTR_AFTER_LAST - 1
  138. };
  139. /**
  140. * enum batadv_nl_commands - supported batman-adv netlink commands
  141. *
  142. * @BATADV_CMD_UNSPEC: unspecified command to catch errors
  143. * @BATADV_CMD_GET_MESH_INFO: Query basic information about batman-adv device
  144. * @BATADV_CMD_TP_METER: Start a tp meter session
  145. * @BATADV_CMD_TP_METER_CANCEL: Cancel a tp meter session
  146. * @BATADV_CMD_GET_ROUTING_ALGOS: Query the list of routing algorithms.
  147. * @BATADV_CMD_GET_HARDIFS: Query list of hard interfaces
  148. * @BATADV_CMD_GET_TRANSTABLE_LOCAL: Query list of local translations
  149. * @BATADV_CMD_GET_TRANSTABLE_GLOBAL Query list of global translations
  150. * @BATADV_CMD_GET_ORIGINATORS: Query list of originators
  151. * @BATADV_CMD_GET_NEIGHBORS: Query list of neighbours
  152. * @BATADV_CMD_GET_GATEWAYS: Query list of gateways
  153. * @BATADV_CMD_GET_BLA_CLAIM: Query list of bridge loop avoidance claims
  154. * @BATADV_CMD_GET_BLA_BACKBONE: Query list of bridge loop avoidance backbones
  155. * @__BATADV_CMD_AFTER_LAST: internal use
  156. * @BATADV_CMD_MAX: highest used command number
  157. */
  158. enum batadv_nl_commands {
  159. BATADV_CMD_UNSPEC,
  160. BATADV_CMD_GET_MESH_INFO,
  161. BATADV_CMD_TP_METER,
  162. BATADV_CMD_TP_METER_CANCEL,
  163. BATADV_CMD_GET_ROUTING_ALGOS,
  164. BATADV_CMD_GET_HARDIFS,
  165. BATADV_CMD_GET_TRANSTABLE_LOCAL,
  166. BATADV_CMD_GET_TRANSTABLE_GLOBAL,
  167. BATADV_CMD_GET_ORIGINATORS,
  168. BATADV_CMD_GET_NEIGHBORS,
  169. BATADV_CMD_GET_GATEWAYS,
  170. BATADV_CMD_GET_BLA_CLAIM,
  171. BATADV_CMD_GET_BLA_BACKBONE,
  172. /* add new commands above here */
  173. __BATADV_CMD_AFTER_LAST,
  174. BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST - 1
  175. };
  176. /**
  177. * enum batadv_tp_meter_reason - reason of a tp meter test run stop
  178. * @BATADV_TP_REASON_COMPLETE: sender finished tp run
  179. * @BATADV_TP_REASON_CANCEL: sender was stopped during run
  180. * @BATADV_TP_REASON_DST_UNREACHABLE: receiver could not be reached or didn't
  181. * answer
  182. * @BATADV_TP_REASON_RESEND_LIMIT: (unused) sender retry reached limit
  183. * @BATADV_TP_REASON_ALREADY_ONGOING: test to or from the same node already
  184. * ongoing
  185. * @BATADV_TP_REASON_MEMORY_ERROR: test was stopped due to low memory
  186. * @BATADV_TP_REASON_CANT_SEND: failed to send via outgoing interface
  187. * @BATADV_TP_REASON_TOO_MANY: too many ongoing sessions
  188. */
  189. enum batadv_tp_meter_reason {
  190. BATADV_TP_REASON_COMPLETE = 3,
  191. BATADV_TP_REASON_CANCEL = 4,
  192. /* error status >= 128 */
  193. BATADV_TP_REASON_DST_UNREACHABLE = 128,
  194. BATADV_TP_REASON_RESEND_LIMIT = 129,
  195. BATADV_TP_REASON_ALREADY_ONGOING = 130,
  196. BATADV_TP_REASON_MEMORY_ERROR = 131,
  197. BATADV_TP_REASON_CANT_SEND = 132,
  198. BATADV_TP_REASON_TOO_MANY = 133,
  199. };
  200. #endif /* _UAPI_LINUX_BATMAN_ADV_H_ */