nl802154.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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. /* add new commands above here */
  45. /* used to define NL802154_CMD_MAX below */
  46. __NL802154_CMD_AFTER_LAST,
  47. NL802154_CMD_MAX = __NL802154_CMD_AFTER_LAST - 1
  48. };
  49. enum nl802154_attrs {
  50. /* don't change the order or add anything between, this is ABI! */
  51. /* currently we don't shipping this file via uapi, ignore the above one */
  52. NL802154_ATTR_UNSPEC,
  53. NL802154_ATTR_WPAN_PHY,
  54. NL802154_ATTR_WPAN_PHY_NAME,
  55. NL802154_ATTR_IFINDEX,
  56. NL802154_ATTR_IFNAME,
  57. NL802154_ATTR_IFTYPE,
  58. NL802154_ATTR_WPAN_DEV,
  59. NL802154_ATTR_PAGE,
  60. NL802154_ATTR_CHANNEL,
  61. NL802154_ATTR_PAN_ID,
  62. NL802154_ATTR_SHORT_ADDR,
  63. NL802154_ATTR_TX_POWER,
  64. NL802154_ATTR_CCA_MODE,
  65. NL802154_ATTR_CCA_OPT,
  66. NL802154_ATTR_CCA_ED_LEVEL,
  67. NL802154_ATTR_MAX_FRAME_RETRIES,
  68. NL802154_ATTR_MAX_BE,
  69. NL802154_ATTR_MIN_BE,
  70. NL802154_ATTR_MAX_CSMA_BACKOFFS,
  71. NL802154_ATTR_LBT_MODE,
  72. NL802154_ATTR_GENERATION,
  73. NL802154_ATTR_CHANNELS_SUPPORTED,
  74. NL802154_ATTR_SUPPORTED_CHANNEL,
  75. NL802154_ATTR_EXTENDED_ADDR,
  76. NL802154_ATTR_WPAN_PHY_CAPS,
  77. NL802154_ATTR_SUPPORTED_COMMANDS,
  78. /* add attributes here, update the policy in nl802154.c */
  79. __NL802154_ATTR_AFTER_LAST,
  80. NL802154_ATTR_MAX = __NL802154_ATTR_AFTER_LAST - 1
  81. };
  82. enum nl802154_iftype {
  83. /* for backwards compatibility TODO */
  84. NL802154_IFTYPE_UNSPEC = -1,
  85. NL802154_IFTYPE_NODE,
  86. NL802154_IFTYPE_MONITOR,
  87. NL802154_IFTYPE_COORD,
  88. /* keep last */
  89. NUM_NL802154_IFTYPES,
  90. NL802154_IFTYPE_MAX = NUM_NL802154_IFTYPES - 1
  91. };
  92. /**
  93. * enum nl802154_wpan_phy_capability_attr - wpan phy capability attributes
  94. *
  95. * @__NL802154_CAP_ATTR_INVALID: attribute number 0 is reserved
  96. * @NL802154_CAP_ATTR_CHANNELS: a nested attribute for nl802154_channel_attr
  97. * @NL802154_CAP_ATTR_TX_POWERS: a nested attribute for
  98. * nl802154_wpan_phy_tx_power
  99. * @NL802154_CAP_ATTR_MIN_CCA_ED_LEVEL: minimum value for cca_ed_level
  100. * @NL802154_CAP_ATTR_MAX_CCA_ED_LEVEL: maxmimum value for cca_ed_level
  101. * @NL802154_CAP_ATTR_CCA_MODES: nl802154_cca_modes flags
  102. * @NL802154_CAP_ATTR_CCA_OPTS: nl802154_cca_opts flags
  103. * @NL802154_CAP_ATTR_MIN_MINBE: minimum of minbe value
  104. * @NL802154_CAP_ATTR_MAX_MINBE: maximum of minbe value
  105. * @NL802154_CAP_ATTR_MIN_MAXBE: minimum of maxbe value
  106. * @NL802154_CAP_ATTR_MAX_MINBE: maximum of maxbe value
  107. * @NL802154_CAP_ATTR_MIN_CSMA_BACKOFFS: minimum of csma backoff value
  108. * @NL802154_CAP_ATTR_MAX_CSMA_BACKOFFS: maximum of csma backoffs value
  109. * @NL802154_CAP_ATTR_MIN_FRAME_RETRIES: minimum of frame retries value
  110. * @NL802154_CAP_ATTR_MAX_FRAME_RETRIES: maximum of frame retries value
  111. * @NL802154_CAP_ATTR_IFTYPES: nl802154_iftype flags
  112. * @NL802154_CAP_ATTR_LBT: nl802154_supported_bool_states flags
  113. * @NL802154_CAP_ATTR_MAX: highest cap attribute currently defined
  114. * @__NL802154_CAP_ATTR_AFTER_LAST: internal use
  115. */
  116. enum nl802154_wpan_phy_capability_attr {
  117. __NL802154_CAP_ATTR_INVALID,
  118. NL802154_CAP_ATTR_IFTYPES,
  119. NL802154_CAP_ATTR_CHANNELS,
  120. NL802154_CAP_ATTR_TX_POWERS,
  121. NL802154_CAP_ATTR_CCA_ED_LEVELS,
  122. NL802154_CAP_ATTR_CCA_MODES,
  123. NL802154_CAP_ATTR_CCA_OPTS,
  124. NL802154_CAP_ATTR_MIN_MINBE,
  125. NL802154_CAP_ATTR_MAX_MINBE,
  126. NL802154_CAP_ATTR_MIN_MAXBE,
  127. NL802154_CAP_ATTR_MAX_MAXBE,
  128. NL802154_CAP_ATTR_MIN_CSMA_BACKOFFS,
  129. NL802154_CAP_ATTR_MAX_CSMA_BACKOFFS,
  130. NL802154_CAP_ATTR_MIN_FRAME_RETRIES,
  131. NL802154_CAP_ATTR_MAX_FRAME_RETRIES,
  132. NL802154_CAP_ATTR_LBT,
  133. /* keep last */
  134. __NL802154_CAP_ATTR_AFTER_LAST,
  135. NL802154_CAP_ATTR_MAX = __NL802154_CAP_ATTR_AFTER_LAST - 1
  136. };
  137. /**
  138. * enum nl802154_cca_modes - cca modes
  139. *
  140. * @__NL802154_CCA_INVALID: cca mode number 0 is reserved
  141. * @NL802154_CCA_ENERGY: Energy above threshold
  142. * @NL802154_CCA_CARRIER: Carrier sense only
  143. * @NL802154_CCA_ENERGY_CARRIER: Carrier sense with energy above threshold
  144. * @NL802154_CCA_ALOHA: CCA shall always report an idle medium
  145. * @NL802154_CCA_UWB_SHR: UWB preamble sense based on the SHR of a frame
  146. * @NL802154_CCA_UWB_MULTIPLEXED: UWB preamble sense based on the packet with
  147. * the multiplexed preamble
  148. * @__NL802154_CCA_ATTR_AFTER_LAST: Internal
  149. * @NL802154_CCA_ATTR_MAX: Maximum CCA attribute number
  150. */
  151. enum nl802154_cca_modes {
  152. __NL802154_CCA_INVALID,
  153. NL802154_CCA_ENERGY,
  154. NL802154_CCA_CARRIER,
  155. NL802154_CCA_ENERGY_CARRIER,
  156. NL802154_CCA_ALOHA,
  157. NL802154_CCA_UWB_SHR,
  158. NL802154_CCA_UWB_MULTIPLEXED,
  159. /* keep last */
  160. __NL802154_CCA_ATTR_AFTER_LAST,
  161. NL802154_CCA_ATTR_MAX = __NL802154_CCA_ATTR_AFTER_LAST - 1
  162. };
  163. /**
  164. * enum nl802154_cca_opts - additional options for cca modes
  165. *
  166. * @NL802154_CCA_OPT_ENERGY_CARRIER_OR: NL802154_CCA_ENERGY_CARRIER with OR
  167. * @NL802154_CCA_OPT_ENERGY_CARRIER_AND: NL802154_CCA_ENERGY_CARRIER with AND
  168. */
  169. enum nl802154_cca_opts {
  170. NL802154_CCA_OPT_ENERGY_CARRIER_AND,
  171. NL802154_CCA_OPT_ENERGY_CARRIER_OR,
  172. /* keep last */
  173. __NL802154_CCA_OPT_ATTR_AFTER_LAST,
  174. NL802154_CCA_OPT_ATTR_MAX = __NL802154_CCA_OPT_ATTR_AFTER_LAST - 1
  175. };
  176. /**
  177. * enum nl802154_supported_bool_states - bool states for bool capability entry
  178. *
  179. * @NL802154_SUPPORTED_BOOL_FALSE: indicates to set false
  180. * @NL802154_SUPPORTED_BOOL_TRUE: indicates to set true
  181. * @__NL802154_SUPPORTED_BOOL_INVALD: reserved
  182. * @NL802154_SUPPORTED_BOOL_BOTH: indicates to set true and false
  183. * @__NL802154_SUPPORTED_BOOL_AFTER_LAST: Internal
  184. * @NL802154_SUPPORTED_BOOL_MAX: highest value for bool states
  185. */
  186. enum nl802154_supported_bool_states {
  187. NL802154_SUPPORTED_BOOL_FALSE,
  188. NL802154_SUPPORTED_BOOL_TRUE,
  189. /* to handle them in a mask */
  190. __NL802154_SUPPORTED_BOOL_INVALD,
  191. NL802154_SUPPORTED_BOOL_BOTH,
  192. /* keep last */
  193. __NL802154_SUPPORTED_BOOL_AFTER_LAST,
  194. NL802154_SUPPORTED_BOOL_MAX = __NL802154_SUPPORTED_BOOL_AFTER_LAST - 1
  195. };
  196. #endif /* __NL802154_H */