Linux 4.8.3
[linux/fpc-iii.git] / include / net / nl802154.h
blobddcee128f5d9ac59c35b8364dc4c5943a04c712f
1 #ifndef __NL802154_H
2 #define __NL802154_H
3 /*
4 * 802.15.4 netlink interface public header
6 * Copyright 2014 Alexander Aring <aar@pengutronix.de>
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.
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.
22 #define NL802154_GENL_NAME "nl802154"
24 enum nl802154_commands {
25 /* don't change the order or add anything between, this is ABI! */
26 /* currently we don't shipping this file via uapi, ignore the above one */
27 NL802154_CMD_UNSPEC,
29 NL802154_CMD_GET_WPAN_PHY, /* can dump */
30 NL802154_CMD_SET_WPAN_PHY,
31 NL802154_CMD_NEW_WPAN_PHY,
32 NL802154_CMD_DEL_WPAN_PHY,
34 NL802154_CMD_GET_INTERFACE, /* can dump */
35 NL802154_CMD_SET_INTERFACE,
36 NL802154_CMD_NEW_INTERFACE,
37 NL802154_CMD_DEL_INTERFACE,
39 NL802154_CMD_SET_CHANNEL,
41 NL802154_CMD_SET_PAN_ID,
42 NL802154_CMD_SET_SHORT_ADDR,
44 NL802154_CMD_SET_TX_POWER,
45 NL802154_CMD_SET_CCA_MODE,
46 NL802154_CMD_SET_CCA_ED_LEVEL,
48 NL802154_CMD_SET_MAX_FRAME_RETRIES,
50 NL802154_CMD_SET_BACKOFF_EXPONENT,
51 NL802154_CMD_SET_MAX_CSMA_BACKOFFS,
53 NL802154_CMD_SET_LBT_MODE,
55 NL802154_CMD_SET_ACKREQ_DEFAULT,
57 NL802154_CMD_SET_WPAN_PHY_NETNS,
59 /* add new commands above here */
61 #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
62 NL802154_CMD_SET_SEC_PARAMS,
63 NL802154_CMD_GET_SEC_KEY, /* can dump */
64 NL802154_CMD_NEW_SEC_KEY,
65 NL802154_CMD_DEL_SEC_KEY,
66 NL802154_CMD_GET_SEC_DEV, /* can dump */
67 NL802154_CMD_NEW_SEC_DEV,
68 NL802154_CMD_DEL_SEC_DEV,
69 NL802154_CMD_GET_SEC_DEVKEY, /* can dump */
70 NL802154_CMD_NEW_SEC_DEVKEY,
71 NL802154_CMD_DEL_SEC_DEVKEY,
72 NL802154_CMD_GET_SEC_LEVEL, /* can dump */
73 NL802154_CMD_NEW_SEC_LEVEL,
74 NL802154_CMD_DEL_SEC_LEVEL,
75 #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */
77 /* used to define NL802154_CMD_MAX below */
78 __NL802154_CMD_AFTER_LAST,
79 NL802154_CMD_MAX = __NL802154_CMD_AFTER_LAST - 1
82 enum nl802154_attrs {
83 /* don't change the order or add anything between, this is ABI! */
84 /* currently we don't shipping this file via uapi, ignore the above one */
85 NL802154_ATTR_UNSPEC,
87 NL802154_ATTR_WPAN_PHY,
88 NL802154_ATTR_WPAN_PHY_NAME,
90 NL802154_ATTR_IFINDEX,
91 NL802154_ATTR_IFNAME,
92 NL802154_ATTR_IFTYPE,
94 NL802154_ATTR_WPAN_DEV,
96 NL802154_ATTR_PAGE,
97 NL802154_ATTR_CHANNEL,
99 NL802154_ATTR_PAN_ID,
100 NL802154_ATTR_SHORT_ADDR,
102 NL802154_ATTR_TX_POWER,
104 NL802154_ATTR_CCA_MODE,
105 NL802154_ATTR_CCA_OPT,
106 NL802154_ATTR_CCA_ED_LEVEL,
108 NL802154_ATTR_MAX_FRAME_RETRIES,
110 NL802154_ATTR_MAX_BE,
111 NL802154_ATTR_MIN_BE,
112 NL802154_ATTR_MAX_CSMA_BACKOFFS,
114 NL802154_ATTR_LBT_MODE,
116 NL802154_ATTR_GENERATION,
118 NL802154_ATTR_CHANNELS_SUPPORTED,
119 NL802154_ATTR_SUPPORTED_CHANNEL,
121 NL802154_ATTR_EXTENDED_ADDR,
123 NL802154_ATTR_WPAN_PHY_CAPS,
125 NL802154_ATTR_SUPPORTED_COMMANDS,
127 NL802154_ATTR_ACKREQ_DEFAULT,
129 NL802154_ATTR_PAD,
131 NL802154_ATTR_PID,
132 NL802154_ATTR_NETNS_FD,
134 /* add attributes here, update the policy in nl802154.c */
136 #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
137 NL802154_ATTR_SEC_ENABLED,
138 NL802154_ATTR_SEC_OUT_LEVEL,
139 NL802154_ATTR_SEC_OUT_KEY_ID,
140 NL802154_ATTR_SEC_FRAME_COUNTER,
142 NL802154_ATTR_SEC_LEVEL,
143 NL802154_ATTR_SEC_DEVICE,
144 NL802154_ATTR_SEC_DEVKEY,
145 NL802154_ATTR_SEC_KEY,
146 #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */
148 __NL802154_ATTR_AFTER_LAST,
149 NL802154_ATTR_MAX = __NL802154_ATTR_AFTER_LAST - 1
152 enum nl802154_iftype {
153 /* for backwards compatibility TODO */
154 NL802154_IFTYPE_UNSPEC = -1,
156 NL802154_IFTYPE_NODE,
157 NL802154_IFTYPE_MONITOR,
158 NL802154_IFTYPE_COORD,
160 /* keep last */
161 NUM_NL802154_IFTYPES,
162 NL802154_IFTYPE_MAX = NUM_NL802154_IFTYPES - 1
166 * enum nl802154_wpan_phy_capability_attr - wpan phy capability attributes
168 * @__NL802154_CAP_ATTR_INVALID: attribute number 0 is reserved
169 * @NL802154_CAP_ATTR_CHANNELS: a nested attribute for nl802154_channel_attr
170 * @NL802154_CAP_ATTR_TX_POWERS: a nested attribute for
171 * nl802154_wpan_phy_tx_power
172 * @NL802154_CAP_ATTR_MIN_CCA_ED_LEVEL: minimum value for cca_ed_level
173 * @NL802154_CAP_ATTR_MAX_CCA_ED_LEVEL: maxmimum value for cca_ed_level
174 * @NL802154_CAP_ATTR_CCA_MODES: nl802154_cca_modes flags
175 * @NL802154_CAP_ATTR_CCA_OPTS: nl802154_cca_opts flags
176 * @NL802154_CAP_ATTR_MIN_MINBE: minimum of minbe value
177 * @NL802154_CAP_ATTR_MAX_MINBE: maximum of minbe value
178 * @NL802154_CAP_ATTR_MIN_MAXBE: minimum of maxbe value
179 * @NL802154_CAP_ATTR_MAX_MINBE: maximum of maxbe value
180 * @NL802154_CAP_ATTR_MIN_CSMA_BACKOFFS: minimum of csma backoff value
181 * @NL802154_CAP_ATTR_MAX_CSMA_BACKOFFS: maximum of csma backoffs value
182 * @NL802154_CAP_ATTR_MIN_FRAME_RETRIES: minimum of frame retries value
183 * @NL802154_CAP_ATTR_MAX_FRAME_RETRIES: maximum of frame retries value
184 * @NL802154_CAP_ATTR_IFTYPES: nl802154_iftype flags
185 * @NL802154_CAP_ATTR_LBT: nl802154_supported_bool_states flags
186 * @NL802154_CAP_ATTR_MAX: highest cap attribute currently defined
187 * @__NL802154_CAP_ATTR_AFTER_LAST: internal use
189 enum nl802154_wpan_phy_capability_attr {
190 __NL802154_CAP_ATTR_INVALID,
192 NL802154_CAP_ATTR_IFTYPES,
194 NL802154_CAP_ATTR_CHANNELS,
195 NL802154_CAP_ATTR_TX_POWERS,
197 NL802154_CAP_ATTR_CCA_ED_LEVELS,
198 NL802154_CAP_ATTR_CCA_MODES,
199 NL802154_CAP_ATTR_CCA_OPTS,
201 NL802154_CAP_ATTR_MIN_MINBE,
202 NL802154_CAP_ATTR_MAX_MINBE,
204 NL802154_CAP_ATTR_MIN_MAXBE,
205 NL802154_CAP_ATTR_MAX_MAXBE,
207 NL802154_CAP_ATTR_MIN_CSMA_BACKOFFS,
208 NL802154_CAP_ATTR_MAX_CSMA_BACKOFFS,
210 NL802154_CAP_ATTR_MIN_FRAME_RETRIES,
211 NL802154_CAP_ATTR_MAX_FRAME_RETRIES,
213 NL802154_CAP_ATTR_LBT,
215 /* keep last */
216 __NL802154_CAP_ATTR_AFTER_LAST,
217 NL802154_CAP_ATTR_MAX = __NL802154_CAP_ATTR_AFTER_LAST - 1
221 * enum nl802154_cca_modes - cca modes
223 * @__NL802154_CCA_INVALID: cca mode number 0 is reserved
224 * @NL802154_CCA_ENERGY: Energy above threshold
225 * @NL802154_CCA_CARRIER: Carrier sense only
226 * @NL802154_CCA_ENERGY_CARRIER: Carrier sense with energy above threshold
227 * @NL802154_CCA_ALOHA: CCA shall always report an idle medium
228 * @NL802154_CCA_UWB_SHR: UWB preamble sense based on the SHR of a frame
229 * @NL802154_CCA_UWB_MULTIPLEXED: UWB preamble sense based on the packet with
230 * the multiplexed preamble
231 * @__NL802154_CCA_ATTR_AFTER_LAST: Internal
232 * @NL802154_CCA_ATTR_MAX: Maximum CCA attribute number
234 enum nl802154_cca_modes {
235 __NL802154_CCA_INVALID,
236 NL802154_CCA_ENERGY,
237 NL802154_CCA_CARRIER,
238 NL802154_CCA_ENERGY_CARRIER,
239 NL802154_CCA_ALOHA,
240 NL802154_CCA_UWB_SHR,
241 NL802154_CCA_UWB_MULTIPLEXED,
243 /* keep last */
244 __NL802154_CCA_ATTR_AFTER_LAST,
245 NL802154_CCA_ATTR_MAX = __NL802154_CCA_ATTR_AFTER_LAST - 1
249 * enum nl802154_cca_opts - additional options for cca modes
251 * @NL802154_CCA_OPT_ENERGY_CARRIER_OR: NL802154_CCA_ENERGY_CARRIER with OR
252 * @NL802154_CCA_OPT_ENERGY_CARRIER_AND: NL802154_CCA_ENERGY_CARRIER with AND
254 enum nl802154_cca_opts {
255 NL802154_CCA_OPT_ENERGY_CARRIER_AND,
256 NL802154_CCA_OPT_ENERGY_CARRIER_OR,
258 /* keep last */
259 __NL802154_CCA_OPT_ATTR_AFTER_LAST,
260 NL802154_CCA_OPT_ATTR_MAX = __NL802154_CCA_OPT_ATTR_AFTER_LAST - 1
264 * enum nl802154_supported_bool_states - bool states for bool capability entry
266 * @NL802154_SUPPORTED_BOOL_FALSE: indicates to set false
267 * @NL802154_SUPPORTED_BOOL_TRUE: indicates to set true
268 * @__NL802154_SUPPORTED_BOOL_INVALD: reserved
269 * @NL802154_SUPPORTED_BOOL_BOTH: indicates to set true and false
270 * @__NL802154_SUPPORTED_BOOL_AFTER_LAST: Internal
271 * @NL802154_SUPPORTED_BOOL_MAX: highest value for bool states
273 enum nl802154_supported_bool_states {
274 NL802154_SUPPORTED_BOOL_FALSE,
275 NL802154_SUPPORTED_BOOL_TRUE,
276 /* to handle them in a mask */
277 __NL802154_SUPPORTED_BOOL_INVALD,
278 NL802154_SUPPORTED_BOOL_BOTH,
280 /* keep last */
281 __NL802154_SUPPORTED_BOOL_AFTER_LAST,
282 NL802154_SUPPORTED_BOOL_MAX = __NL802154_SUPPORTED_BOOL_AFTER_LAST - 1
285 #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
287 enum nl802154_dev_addr_modes {
288 NL802154_DEV_ADDR_NONE,
289 __NL802154_DEV_ADDR_INVALID,
290 NL802154_DEV_ADDR_SHORT,
291 NL802154_DEV_ADDR_EXTENDED,
293 /* keep last */
294 __NL802154_DEV_ADDR_AFTER_LAST,
295 NL802154_DEV_ADDR_MAX = __NL802154_DEV_ADDR_AFTER_LAST - 1
298 enum nl802154_dev_addr_attrs {
299 NL802154_DEV_ADDR_ATTR_UNSPEC,
301 NL802154_DEV_ADDR_ATTR_PAN_ID,
302 NL802154_DEV_ADDR_ATTR_MODE,
303 NL802154_DEV_ADDR_ATTR_SHORT,
304 NL802154_DEV_ADDR_ATTR_EXTENDED,
305 NL802154_DEV_ADDR_ATTR_PAD,
307 /* keep last */
308 __NL802154_DEV_ADDR_ATTR_AFTER_LAST,
309 NL802154_DEV_ADDR_ATTR_MAX = __NL802154_DEV_ADDR_ATTR_AFTER_LAST - 1
312 enum nl802154_key_id_modes {
313 NL802154_KEY_ID_MODE_IMPLICIT,
314 NL802154_KEY_ID_MODE_INDEX,
315 NL802154_KEY_ID_MODE_INDEX_SHORT,
316 NL802154_KEY_ID_MODE_INDEX_EXTENDED,
318 /* keep last */
319 __NL802154_KEY_ID_MODE_AFTER_LAST,
320 NL802154_KEY_ID_MODE_MAX = __NL802154_KEY_ID_MODE_AFTER_LAST - 1
323 enum nl802154_key_id_attrs {
324 NL802154_KEY_ID_ATTR_UNSPEC,
326 NL802154_KEY_ID_ATTR_MODE,
327 NL802154_KEY_ID_ATTR_INDEX,
328 NL802154_KEY_ID_ATTR_IMPLICIT,
329 NL802154_KEY_ID_ATTR_SOURCE_SHORT,
330 NL802154_KEY_ID_ATTR_SOURCE_EXTENDED,
331 NL802154_KEY_ID_ATTR_PAD,
333 /* keep last */
334 __NL802154_KEY_ID_ATTR_AFTER_LAST,
335 NL802154_KEY_ID_ATTR_MAX = __NL802154_KEY_ID_ATTR_AFTER_LAST - 1
338 enum nl802154_seclevels {
339 NL802154_SECLEVEL_NONE,
340 NL802154_SECLEVEL_MIC32,
341 NL802154_SECLEVEL_MIC64,
342 NL802154_SECLEVEL_MIC128,
343 NL802154_SECLEVEL_ENC,
344 NL802154_SECLEVEL_ENC_MIC32,
345 NL802154_SECLEVEL_ENC_MIC64,
346 NL802154_SECLEVEL_ENC_MIC128,
348 /* keep last */
349 __NL802154_SECLEVEL_AFTER_LAST,
350 NL802154_SECLEVEL_MAX = __NL802154_SECLEVEL_AFTER_LAST - 1
353 enum nl802154_frames {
354 NL802154_FRAME_BEACON,
355 NL802154_FRAME_DATA,
356 NL802154_FRAME_ACK,
357 NL802154_FRAME_CMD,
359 /* keep last */
360 __NL802154_FRAME_AFTER_LAST,
361 NL802154_FRAME_MAX = __NL802154_FRAME_AFTER_LAST - 1
364 enum nl802154_cmd_frames {
365 __NL802154_CMD_FRAME_INVALID,
366 NL802154_CMD_FRAME_ASSOC_REQUEST,
367 NL802154_CMD_FRAME_ASSOC_RESPONSE,
368 NL802154_CMD_FRAME_DISASSOC_NOTIFY,
369 NL802154_CMD_FRAME_DATA_REQUEST,
370 NL802154_CMD_FRAME_PAN_ID_CONFLICT_NOTIFY,
371 NL802154_CMD_FRAME_ORPHAN_NOTIFY,
372 NL802154_CMD_FRAME_BEACON_REQUEST,
373 NL802154_CMD_FRAME_COORD_REALIGNMENT,
374 NL802154_CMD_FRAME_GTS_REQUEST,
376 /* keep last */
377 __NL802154_CMD_FRAME_AFTER_LAST,
378 NL802154_CMD_FRAME_MAX = __NL802154_CMD_FRAME_AFTER_LAST - 1
381 enum nl802154_seclevel_attrs {
382 NL802154_SECLEVEL_ATTR_UNSPEC,
384 NL802154_SECLEVEL_ATTR_LEVELS,
385 NL802154_SECLEVEL_ATTR_FRAME,
386 NL802154_SECLEVEL_ATTR_CMD_FRAME,
387 NL802154_SECLEVEL_ATTR_DEV_OVERRIDE,
389 /* keep last */
390 __NL802154_SECLEVEL_ATTR_AFTER_LAST,
391 NL802154_SECLEVEL_ATTR_MAX = __NL802154_SECLEVEL_ATTR_AFTER_LAST - 1
394 /* TODO what is this? couldn't find in mib */
395 enum {
396 NL802154_DEVKEY_IGNORE,
397 NL802154_DEVKEY_RESTRICT,
398 NL802154_DEVKEY_RECORD,
400 /* keep last */
401 __NL802154_DEVKEY_AFTER_LAST,
402 NL802154_DEVKEY_MAX = __NL802154_DEVKEY_AFTER_LAST - 1
405 enum nl802154_dev {
406 NL802154_DEV_ATTR_UNSPEC,
408 NL802154_DEV_ATTR_FRAME_COUNTER,
409 NL802154_DEV_ATTR_PAN_ID,
410 NL802154_DEV_ATTR_SHORT_ADDR,
411 NL802154_DEV_ATTR_EXTENDED_ADDR,
412 NL802154_DEV_ATTR_SECLEVEL_EXEMPT,
413 NL802154_DEV_ATTR_KEY_MODE,
414 NL802154_DEV_ATTR_PAD,
416 /* keep last */
417 __NL802154_DEV_ATTR_AFTER_LAST,
418 NL802154_DEV_ATTR_MAX = __NL802154_DEV_ATTR_AFTER_LAST - 1
421 enum nl802154_devkey {
422 NL802154_DEVKEY_ATTR_UNSPEC,
424 NL802154_DEVKEY_ATTR_FRAME_COUNTER,
425 NL802154_DEVKEY_ATTR_EXTENDED_ADDR,
426 NL802154_DEVKEY_ATTR_ID,
427 NL802154_DEVKEY_ATTR_PAD,
429 /* keep last */
430 __NL802154_DEVKEY_ATTR_AFTER_LAST,
431 NL802154_DEVKEY_ATTR_MAX = __NL802154_DEVKEY_ATTR_AFTER_LAST - 1
434 enum nl802154_key {
435 NL802154_KEY_ATTR_UNSPEC,
437 NL802154_KEY_ATTR_ID,
438 NL802154_KEY_ATTR_USAGE_FRAMES,
439 NL802154_KEY_ATTR_USAGE_CMDS,
440 NL802154_KEY_ATTR_BYTES,
442 /* keep last */
443 __NL802154_KEY_ATTR_AFTER_LAST,
444 NL802154_KEY_ATTR_MAX = __NL802154_KEY_ATTR_AFTER_LAST - 1
447 #define NL802154_KEY_SIZE 16
448 #define NL802154_CMD_FRAME_NR_IDS 256
450 #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */
452 #endif /* __NL802154_H */