nl802154.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. #ifndef __NL802154_H
  2. #define __NL802154_H
  3. /*
  4. * 802.15.4 netlink interface public header
  5. *
  6. * Copyright 2014 Alexander Aring <aar@pengutronix.de>
  7. *
  8. * Permission to use, copy, modify, and/or distribute this software for any
  9. * purpose with or without fee is hereby granted, provided that the above
  10. * copyright notice and this permission notice appear in all copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  13. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  14. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  15. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  16. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  17. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  18. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  19. *
  20. */
  21. #define NL802154_GENL_NAME "nl802154"
  22. enum nl802154_commands {
  23. /* don't change the order or add anything between, this is ABI! */
  24. /* currently we don't shipping this file via uapi, ignore the above one */
  25. NL802154_CMD_UNSPEC,
  26. NL802154_CMD_GET_WPAN_PHY, /* can dump */
  27. NL802154_CMD_SET_WPAN_PHY,
  28. NL802154_CMD_NEW_WPAN_PHY,
  29. NL802154_CMD_DEL_WPAN_PHY,
  30. NL802154_CMD_GET_INTERFACE, /* can dump */
  31. NL802154_CMD_SET_INTERFACE,
  32. NL802154_CMD_NEW_INTERFACE,
  33. NL802154_CMD_DEL_INTERFACE,
  34. NL802154_CMD_SET_CHANNEL,
  35. NL802154_CMD_SET_PAN_ID,
  36. NL802154_CMD_SET_SHORT_ADDR,
  37. NL802154_CMD_SET_TX_POWER,
  38. NL802154_CMD_SET_CCA_MODE,
  39. NL802154_CMD_SET_CCA_ED_LEVEL,
  40. NL802154_CMD_SET_MAX_FRAME_RETRIES,
  41. NL802154_CMD_SET_BACKOFF_EXPONENT,
  42. NL802154_CMD_SET_MAX_CSMA_BACKOFFS,
  43. NL802154_CMD_SET_LBT_MODE,
  44. NL802154_CMD_SET_ACKREQ_DEFAULT,
  45. /* add new commands above here */
  46. /* used to define NL802154_CMD_MAX below */
  47. __NL802154_CMD_AFTER_LAST,
  48. NL802154_CMD_MAX = __NL802154_CMD_AFTER_LAST - 1
  49. };
  50. enum nl802154_attrs {
  51. /* don't change the order or add anything between, this is ABI! */
  52. /* currently we don't shipping this file via uapi, ignore the above one */
  53. NL802154_ATTR_UNSPEC,
  54. NL802154_ATTR_WPAN_PHY,
  55. NL802154_ATTR_WPAN_PHY_NAME,
  56. NL802154_ATTR_IFINDEX,
  57. NL802154_ATTR_IFNAME,
  58. NL802154_ATTR_IFTYPE,
  59. NL802154_ATTR_WPAN_DEV,
  60. NL802154_ATTR_PAGE,
  61. NL802154_ATTR_CHANNEL,
  62. NL802154_ATTR_PAN_ID,
  63. NL802154_ATTR_SHORT_ADDR,
  64. NL802154_ATTR_TX_POWER,
  65. NL802154_ATTR_CCA_MODE,
  66. NL802154_ATTR_CCA_OPT,
  67. NL802154_ATTR_CCA_ED_LEVEL,
  68. NL802154_ATTR_MAX_FRAME_RETRIES,
  69. NL802154_ATTR_MAX_BE,
  70. NL802154_ATTR_MIN_BE,
  71. NL802154_ATTR_MAX_CSMA_BACKOFFS,
  72. NL802154_ATTR_LBT_MODE,
  73. NL802154_ATTR_GENERATION,
  74. NL802154_ATTR_CHANNELS_SUPPORTED,
  75. NL802154_ATTR_SUPPORTED_CHANNEL,
  76. NL802154_ATTR_EXTENDED_ADDR,
  77. NL802154_ATTR_WPAN_PHY_CAPS,
  78. NL802154_ATTR_SUPPORTED_COMMANDS,
  79. NL802154_ATTR_ACKREQ_DEFAULT,
  80. /* add attributes here, update the policy in nl802154.c */
  81. __NL802154_ATTR_AFTER_LAST,
  82. NL802154_ATTR_MAX = __NL802154_ATTR_AFTER_LAST - 1
  83. };
  84. enum nl802154_iftype {
  85. /* for backwards compatibility TODO */
  86. NL802154_IFTYPE_UNSPEC = -1,
  87. NL802154_IFTYPE_NODE,
  88. NL802154_IFTYPE_MONITOR,
  89. NL802154_IFTYPE_COORD,
  90. /* keep last */
  91. NUM_NL802154_IFTYPES,
  92. NL802154_IFTYPE_MAX = NUM_NL802154_IFTYPES - 1
  93. };
  94. /**
  95. * enum nl802154_wpan_phy_capability_attr - wpan phy capability attributes
  96. *
  97. * @__NL802154_CAP_ATTR_INVALID: attribute number 0 is reserved
  98. * @NL802154_CAP_ATTR_CHANNELS: a nested attribute for nl802154_channel_attr
  99. * @NL802154_CAP_ATTR_TX_POWERS: a nested attribute for
  100. * nl802154_wpan_phy_tx_power
  101. * @NL802154_CAP_ATTR_MIN_CCA_ED_LEVEL: minimum value for cca_ed_level
  102. * @NL802154_CAP_ATTR_MAX_CCA_ED_LEVEL: maxmimum value for cca_ed_level
  103. * @NL802154_CAP_ATTR_CCA_MODES: nl802154_cca_modes flags
  104. * @NL802154_CAP_ATTR_CCA_OPTS: nl802154_cca_opts flags
  105. * @NL802154_CAP_ATTR_MIN_MINBE: minimum of minbe value
  106. * @NL802154_CAP_ATTR_MAX_MINBE: maximum of minbe value
  107. * @NL802154_CAP_ATTR_MIN_MAXBE: minimum of maxbe value
  108. * @NL802154_CAP_ATTR_MAX_MINBE: maximum of maxbe value
  109. * @NL802154_CAP_ATTR_MIN_CSMA_BACKOFFS: minimum of csma backoff value
  110. * @NL802154_CAP_ATTR_MAX_CSMA_BACKOFFS: maximum of csma backoffs value
  111. * @NL802154_CAP_ATTR_MIN_FRAME_RETRIES: minimum of frame retries value
  112. * @NL802154_CAP_ATTR_MAX_FRAME_RETRIES: maximum of frame retries value
  113. * @NL802154_CAP_ATTR_IFTYPES: nl802154_iftype flags
  114. * @NL802154_CAP_ATTR_LBT: nl802154_supported_bool_states flags
  115. * @NL802154_CAP_ATTR_MAX: highest cap attribute currently defined
  116. * @__NL802154_CAP_ATTR_AFTER_LAST: internal use
  117. */
  118. enum nl802154_wpan_phy_capability_attr {
  119. __NL802154_CAP_ATTR_INVALID,
  120. NL802154_CAP_ATTR_IFTYPES,
  121. NL802154_CAP_ATTR_CHANNELS,
  122. NL802154_CAP_ATTR_TX_POWERS,
  123. NL802154_CAP_ATTR_CCA_ED_LEVELS,
  124. NL802154_CAP_ATTR_CCA_MODES,
  125. NL802154_CAP_ATTR_CCA_OPTS,
  126. NL802154_CAP_ATTR_MIN_MINBE,
  127. NL802154_CAP_ATTR_MAX_MINBE,
  128. NL802154_CAP_ATTR_MIN_MAXBE,
  129. NL802154_CAP_ATTR_MAX_MAXBE,
  130. NL802154_CAP_ATTR_MIN_CSMA_BACKOFFS,
  131. NL802154_CAP_ATTR_MAX_CSMA_BACKOFFS,
  132. NL802154_CAP_ATTR_MIN_FRAME_RETRIES,
  133. NL802154_CAP_ATTR_MAX_FRAME_RETRIES,
  134. NL802154_CAP_ATTR_LBT,
  135. /* keep last */
  136. __NL802154_CAP_ATTR_AFTER_LAST,
  137. NL802154_CAP_ATTR_MAX = __NL802154_CAP_ATTR_AFTER_LAST - 1
  138. };
  139. /**
  140. * enum nl802154_cca_modes - cca modes
  141. *
  142. * @__NL802154_CCA_INVALID: cca mode number 0 is reserved
  143. * @NL802154_CCA_ENERGY: Energy above threshold
  144. * @NL802154_CCA_CARRIER: Carrier sense only
  145. * @NL802154_CCA_ENERGY_CARRIER: Carrier sense with energy above threshold
  146. * @NL802154_CCA_ALOHA: CCA shall always report an idle medium
  147. * @NL802154_CCA_UWB_SHR: UWB preamble sense based on the SHR of a frame
  148. * @NL802154_CCA_UWB_MULTIPLEXED: UWB preamble sense based on the packet with
  149. * the multiplexed preamble
  150. * @__NL802154_CCA_ATTR_AFTER_LAST: Internal
  151. * @NL802154_CCA_ATTR_MAX: Maximum CCA attribute number
  152. */
  153. enum nl802154_cca_modes {
  154. __NL802154_CCA_INVALID,
  155. NL802154_CCA_ENERGY,
  156. NL802154_CCA_CARRIER,
  157. NL802154_CCA_ENERGY_CARRIER,
  158. NL802154_CCA_ALOHA,
  159. NL802154_CCA_UWB_SHR,
  160. NL802154_CCA_UWB_MULTIPLEXED,
  161. /* keep last */
  162. __NL802154_CCA_ATTR_AFTER_LAST,
  163. NL802154_CCA_ATTR_MAX = __NL802154_CCA_ATTR_AFTER_LAST - 1
  164. };
  165. /**
  166. * enum nl802154_cca_opts - additional options for cca modes
  167. *
  168. * @NL802154_CCA_OPT_ENERGY_CARRIER_OR: NL802154_CCA_ENERGY_CARRIER with OR
  169. * @NL802154_CCA_OPT_ENERGY_CARRIER_AND: NL802154_CCA_ENERGY_CARRIER with AND
  170. */
  171. enum nl802154_cca_opts {
  172. NL802154_CCA_OPT_ENERGY_CARRIER_AND,
  173. NL802154_CCA_OPT_ENERGY_CARRIER_OR,
  174. /* keep last */
  175. __NL802154_CCA_OPT_ATTR_AFTER_LAST,
  176. NL802154_CCA_OPT_ATTR_MAX = __NL802154_CCA_OPT_ATTR_AFTER_LAST - 1
  177. };
  178. /**
  179. * enum nl802154_supported_bool_states - bool states for bool capability entry
  180. *
  181. * @NL802154_SUPPORTED_BOOL_FALSE: indicates to set false
  182. * @NL802154_SUPPORTED_BOOL_TRUE: indicates to set true
  183. * @__NL802154_SUPPORTED_BOOL_INVALD: reserved
  184. * @NL802154_SUPPORTED_BOOL_BOTH: indicates to set true and false
  185. * @__NL802154_SUPPORTED_BOOL_AFTER_LAST: Internal
  186. * @NL802154_SUPPORTED_BOOL_MAX: highest value for bool states
  187. */
  188. enum nl802154_supported_bool_states {
  189. NL802154_SUPPORTED_BOOL_FALSE,
  190. NL802154_SUPPORTED_BOOL_TRUE,
  191. /* to handle them in a mask */
  192. __NL802154_SUPPORTED_BOOL_INVALD,
  193. NL802154_SUPPORTED_BOOL_BOTH,
  194. /* keep last */
  195. __NL802154_SUPPORTED_BOOL_AFTER_LAST,
  196. NL802154_SUPPORTED_BOOL_MAX = __NL802154_SUPPORTED_BOOL_AFTER_LAST - 1
  197. };
  198. #endif /* __NL802154_H */