staging: wilc1000: wilc_init(): fixes inconsistent returns
[linux/fpc-iii.git] / include / net / nl802154.h
blob32cb3e591e07b6a936a14788952c737c9bb277bd
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 /* add new commands above here */
59 #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
60 NL802154_CMD_SET_SEC_PARAMS,
61 NL802154_CMD_GET_SEC_KEY, /* can dump */
62 NL802154_CMD_NEW_SEC_KEY,
63 NL802154_CMD_DEL_SEC_KEY,
64 NL802154_CMD_GET_SEC_DEV, /* can dump */
65 NL802154_CMD_NEW_SEC_DEV,
66 NL802154_CMD_DEL_SEC_DEV,
67 NL802154_CMD_GET_SEC_DEVKEY, /* can dump */
68 NL802154_CMD_NEW_SEC_DEVKEY,
69 NL802154_CMD_DEL_SEC_DEVKEY,
70 NL802154_CMD_GET_SEC_LEVEL, /* can dump */
71 NL802154_CMD_NEW_SEC_LEVEL,
72 NL802154_CMD_DEL_SEC_LEVEL,
73 #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */
75 /* used to define NL802154_CMD_MAX below */
76 __NL802154_CMD_AFTER_LAST,
77 NL802154_CMD_MAX = __NL802154_CMD_AFTER_LAST - 1
80 enum nl802154_attrs {
81 /* don't change the order or add anything between, this is ABI! */
82 /* currently we don't shipping this file via uapi, ignore the above one */
83 NL802154_ATTR_UNSPEC,
85 NL802154_ATTR_WPAN_PHY,
86 NL802154_ATTR_WPAN_PHY_NAME,
88 NL802154_ATTR_IFINDEX,
89 NL802154_ATTR_IFNAME,
90 NL802154_ATTR_IFTYPE,
92 NL802154_ATTR_WPAN_DEV,
94 NL802154_ATTR_PAGE,
95 NL802154_ATTR_CHANNEL,
97 NL802154_ATTR_PAN_ID,
98 NL802154_ATTR_SHORT_ADDR,
100 NL802154_ATTR_TX_POWER,
102 NL802154_ATTR_CCA_MODE,
103 NL802154_ATTR_CCA_OPT,
104 NL802154_ATTR_CCA_ED_LEVEL,
106 NL802154_ATTR_MAX_FRAME_RETRIES,
108 NL802154_ATTR_MAX_BE,
109 NL802154_ATTR_MIN_BE,
110 NL802154_ATTR_MAX_CSMA_BACKOFFS,
112 NL802154_ATTR_LBT_MODE,
114 NL802154_ATTR_GENERATION,
116 NL802154_ATTR_CHANNELS_SUPPORTED,
117 NL802154_ATTR_SUPPORTED_CHANNEL,
119 NL802154_ATTR_EXTENDED_ADDR,
121 NL802154_ATTR_WPAN_PHY_CAPS,
123 NL802154_ATTR_SUPPORTED_COMMANDS,
125 NL802154_ATTR_ACKREQ_DEFAULT,
127 /* add attributes here, update the policy in nl802154.c */
129 #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
130 NL802154_ATTR_SEC_ENABLED,
131 NL802154_ATTR_SEC_OUT_LEVEL,
132 NL802154_ATTR_SEC_OUT_KEY_ID,
133 NL802154_ATTR_SEC_FRAME_COUNTER,
135 NL802154_ATTR_SEC_LEVEL,
136 NL802154_ATTR_SEC_DEVICE,
137 NL802154_ATTR_SEC_DEVKEY,
138 NL802154_ATTR_SEC_KEY,
139 #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */
141 __NL802154_ATTR_AFTER_LAST,
142 NL802154_ATTR_MAX = __NL802154_ATTR_AFTER_LAST - 1
145 enum nl802154_iftype {
146 /* for backwards compatibility TODO */
147 NL802154_IFTYPE_UNSPEC = -1,
149 NL802154_IFTYPE_NODE,
150 NL802154_IFTYPE_MONITOR,
151 NL802154_IFTYPE_COORD,
153 /* keep last */
154 NUM_NL802154_IFTYPES,
155 NL802154_IFTYPE_MAX = NUM_NL802154_IFTYPES - 1
159 * enum nl802154_wpan_phy_capability_attr - wpan phy capability attributes
161 * @__NL802154_CAP_ATTR_INVALID: attribute number 0 is reserved
162 * @NL802154_CAP_ATTR_CHANNELS: a nested attribute for nl802154_channel_attr
163 * @NL802154_CAP_ATTR_TX_POWERS: a nested attribute for
164 * nl802154_wpan_phy_tx_power
165 * @NL802154_CAP_ATTR_MIN_CCA_ED_LEVEL: minimum value for cca_ed_level
166 * @NL802154_CAP_ATTR_MAX_CCA_ED_LEVEL: maxmimum value for cca_ed_level
167 * @NL802154_CAP_ATTR_CCA_MODES: nl802154_cca_modes flags
168 * @NL802154_CAP_ATTR_CCA_OPTS: nl802154_cca_opts flags
169 * @NL802154_CAP_ATTR_MIN_MINBE: minimum of minbe value
170 * @NL802154_CAP_ATTR_MAX_MINBE: maximum of minbe value
171 * @NL802154_CAP_ATTR_MIN_MAXBE: minimum of maxbe value
172 * @NL802154_CAP_ATTR_MAX_MINBE: maximum of maxbe value
173 * @NL802154_CAP_ATTR_MIN_CSMA_BACKOFFS: minimum of csma backoff value
174 * @NL802154_CAP_ATTR_MAX_CSMA_BACKOFFS: maximum of csma backoffs value
175 * @NL802154_CAP_ATTR_MIN_FRAME_RETRIES: minimum of frame retries value
176 * @NL802154_CAP_ATTR_MAX_FRAME_RETRIES: maximum of frame retries value
177 * @NL802154_CAP_ATTR_IFTYPES: nl802154_iftype flags
178 * @NL802154_CAP_ATTR_LBT: nl802154_supported_bool_states flags
179 * @NL802154_CAP_ATTR_MAX: highest cap attribute currently defined
180 * @__NL802154_CAP_ATTR_AFTER_LAST: internal use
182 enum nl802154_wpan_phy_capability_attr {
183 __NL802154_CAP_ATTR_INVALID,
185 NL802154_CAP_ATTR_IFTYPES,
187 NL802154_CAP_ATTR_CHANNELS,
188 NL802154_CAP_ATTR_TX_POWERS,
190 NL802154_CAP_ATTR_CCA_ED_LEVELS,
191 NL802154_CAP_ATTR_CCA_MODES,
192 NL802154_CAP_ATTR_CCA_OPTS,
194 NL802154_CAP_ATTR_MIN_MINBE,
195 NL802154_CAP_ATTR_MAX_MINBE,
197 NL802154_CAP_ATTR_MIN_MAXBE,
198 NL802154_CAP_ATTR_MAX_MAXBE,
200 NL802154_CAP_ATTR_MIN_CSMA_BACKOFFS,
201 NL802154_CAP_ATTR_MAX_CSMA_BACKOFFS,
203 NL802154_CAP_ATTR_MIN_FRAME_RETRIES,
204 NL802154_CAP_ATTR_MAX_FRAME_RETRIES,
206 NL802154_CAP_ATTR_LBT,
208 /* keep last */
209 __NL802154_CAP_ATTR_AFTER_LAST,
210 NL802154_CAP_ATTR_MAX = __NL802154_CAP_ATTR_AFTER_LAST - 1
214 * enum nl802154_cca_modes - cca modes
216 * @__NL802154_CCA_INVALID: cca mode number 0 is reserved
217 * @NL802154_CCA_ENERGY: Energy above threshold
218 * @NL802154_CCA_CARRIER: Carrier sense only
219 * @NL802154_CCA_ENERGY_CARRIER: Carrier sense with energy above threshold
220 * @NL802154_CCA_ALOHA: CCA shall always report an idle medium
221 * @NL802154_CCA_UWB_SHR: UWB preamble sense based on the SHR of a frame
222 * @NL802154_CCA_UWB_MULTIPLEXED: UWB preamble sense based on the packet with
223 * the multiplexed preamble
224 * @__NL802154_CCA_ATTR_AFTER_LAST: Internal
225 * @NL802154_CCA_ATTR_MAX: Maximum CCA attribute number
227 enum nl802154_cca_modes {
228 __NL802154_CCA_INVALID,
229 NL802154_CCA_ENERGY,
230 NL802154_CCA_CARRIER,
231 NL802154_CCA_ENERGY_CARRIER,
232 NL802154_CCA_ALOHA,
233 NL802154_CCA_UWB_SHR,
234 NL802154_CCA_UWB_MULTIPLEXED,
236 /* keep last */
237 __NL802154_CCA_ATTR_AFTER_LAST,
238 NL802154_CCA_ATTR_MAX = __NL802154_CCA_ATTR_AFTER_LAST - 1
242 * enum nl802154_cca_opts - additional options for cca modes
244 * @NL802154_CCA_OPT_ENERGY_CARRIER_OR: NL802154_CCA_ENERGY_CARRIER with OR
245 * @NL802154_CCA_OPT_ENERGY_CARRIER_AND: NL802154_CCA_ENERGY_CARRIER with AND
247 enum nl802154_cca_opts {
248 NL802154_CCA_OPT_ENERGY_CARRIER_AND,
249 NL802154_CCA_OPT_ENERGY_CARRIER_OR,
251 /* keep last */
252 __NL802154_CCA_OPT_ATTR_AFTER_LAST,
253 NL802154_CCA_OPT_ATTR_MAX = __NL802154_CCA_OPT_ATTR_AFTER_LAST - 1
257 * enum nl802154_supported_bool_states - bool states for bool capability entry
259 * @NL802154_SUPPORTED_BOOL_FALSE: indicates to set false
260 * @NL802154_SUPPORTED_BOOL_TRUE: indicates to set true
261 * @__NL802154_SUPPORTED_BOOL_INVALD: reserved
262 * @NL802154_SUPPORTED_BOOL_BOTH: indicates to set true and false
263 * @__NL802154_SUPPORTED_BOOL_AFTER_LAST: Internal
264 * @NL802154_SUPPORTED_BOOL_MAX: highest value for bool states
266 enum nl802154_supported_bool_states {
267 NL802154_SUPPORTED_BOOL_FALSE,
268 NL802154_SUPPORTED_BOOL_TRUE,
269 /* to handle them in a mask */
270 __NL802154_SUPPORTED_BOOL_INVALD,
271 NL802154_SUPPORTED_BOOL_BOTH,
273 /* keep last */
274 __NL802154_SUPPORTED_BOOL_AFTER_LAST,
275 NL802154_SUPPORTED_BOOL_MAX = __NL802154_SUPPORTED_BOOL_AFTER_LAST - 1
278 #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
280 enum nl802154_dev_addr_modes {
281 NL802154_DEV_ADDR_NONE,
282 __NL802154_DEV_ADDR_INVALID,
283 NL802154_DEV_ADDR_SHORT,
284 NL802154_DEV_ADDR_EXTENDED,
286 /* keep last */
287 __NL802154_DEV_ADDR_AFTER_LAST,
288 NL802154_DEV_ADDR_MAX = __NL802154_DEV_ADDR_AFTER_LAST - 1
291 enum nl802154_dev_addr_attrs {
292 NL802154_DEV_ADDR_ATTR_UNSPEC,
294 NL802154_DEV_ADDR_ATTR_PAN_ID,
295 NL802154_DEV_ADDR_ATTR_MODE,
296 NL802154_DEV_ADDR_ATTR_SHORT,
297 NL802154_DEV_ADDR_ATTR_EXTENDED,
299 /* keep last */
300 __NL802154_DEV_ADDR_ATTR_AFTER_LAST,
301 NL802154_DEV_ADDR_ATTR_MAX = __NL802154_DEV_ADDR_ATTR_AFTER_LAST - 1
304 enum nl802154_key_id_modes {
305 NL802154_KEY_ID_MODE_IMPLICIT,
306 NL802154_KEY_ID_MODE_INDEX,
307 NL802154_KEY_ID_MODE_INDEX_SHORT,
308 NL802154_KEY_ID_MODE_INDEX_EXTENDED,
310 /* keep last */
311 __NL802154_KEY_ID_MODE_AFTER_LAST,
312 NL802154_KEY_ID_MODE_MAX = __NL802154_KEY_ID_MODE_AFTER_LAST - 1
315 enum nl802154_key_id_attrs {
316 NL802154_KEY_ID_ATTR_UNSPEC,
318 NL802154_KEY_ID_ATTR_MODE,
319 NL802154_KEY_ID_ATTR_INDEX,
320 NL802154_KEY_ID_ATTR_IMPLICIT,
321 NL802154_KEY_ID_ATTR_SOURCE_SHORT,
322 NL802154_KEY_ID_ATTR_SOURCE_EXTENDED,
324 /* keep last */
325 __NL802154_KEY_ID_ATTR_AFTER_LAST,
326 NL802154_KEY_ID_ATTR_MAX = __NL802154_KEY_ID_ATTR_AFTER_LAST - 1
329 enum nl802154_seclevels {
330 NL802154_SECLEVEL_NONE,
331 NL802154_SECLEVEL_MIC32,
332 NL802154_SECLEVEL_MIC64,
333 NL802154_SECLEVEL_MIC128,
334 NL802154_SECLEVEL_ENC,
335 NL802154_SECLEVEL_ENC_MIC32,
336 NL802154_SECLEVEL_ENC_MIC64,
337 NL802154_SECLEVEL_ENC_MIC128,
339 /* keep last */
340 __NL802154_SECLEVEL_AFTER_LAST,
341 NL802154_SECLEVEL_MAX = __NL802154_SECLEVEL_AFTER_LAST - 1
344 enum nl802154_frames {
345 NL802154_FRAME_BEACON,
346 NL802154_FRAME_DATA,
347 NL802154_FRAME_ACK,
348 NL802154_FRAME_CMD,
350 /* keep last */
351 __NL802154_FRAME_AFTER_LAST,
352 NL802154_FRAME_MAX = __NL802154_FRAME_AFTER_LAST - 1
355 enum nl802154_cmd_frames {
356 __NL802154_CMD_FRAME_INVALID,
357 NL802154_CMD_FRAME_ASSOC_REQUEST,
358 NL802154_CMD_FRAME_ASSOC_RESPONSE,
359 NL802154_CMD_FRAME_DISASSOC_NOTIFY,
360 NL802154_CMD_FRAME_DATA_REQUEST,
361 NL802154_CMD_FRAME_PAN_ID_CONFLICT_NOTIFY,
362 NL802154_CMD_FRAME_ORPHAN_NOTIFY,
363 NL802154_CMD_FRAME_BEACON_REQUEST,
364 NL802154_CMD_FRAME_COORD_REALIGNMENT,
365 NL802154_CMD_FRAME_GTS_REQUEST,
367 /* keep last */
368 __NL802154_CMD_FRAME_AFTER_LAST,
369 NL802154_CMD_FRAME_MAX = __NL802154_CMD_FRAME_AFTER_LAST - 1
372 enum nl802154_seclevel_attrs {
373 NL802154_SECLEVEL_ATTR_UNSPEC,
375 NL802154_SECLEVEL_ATTR_LEVELS,
376 NL802154_SECLEVEL_ATTR_FRAME,
377 NL802154_SECLEVEL_ATTR_CMD_FRAME,
378 NL802154_SECLEVEL_ATTR_DEV_OVERRIDE,
380 /* keep last */
381 __NL802154_SECLEVEL_ATTR_AFTER_LAST,
382 NL802154_SECLEVEL_ATTR_MAX = __NL802154_SECLEVEL_ATTR_AFTER_LAST - 1
385 /* TODO what is this? couldn't find in mib */
386 enum {
387 NL802154_DEVKEY_IGNORE,
388 NL802154_DEVKEY_RESTRICT,
389 NL802154_DEVKEY_RECORD,
391 /* keep last */
392 __NL802154_DEVKEY_AFTER_LAST,
393 NL802154_DEVKEY_MAX = __NL802154_DEVKEY_AFTER_LAST - 1
396 enum nl802154_dev {
397 NL802154_DEV_ATTR_UNSPEC,
399 NL802154_DEV_ATTR_FRAME_COUNTER,
400 NL802154_DEV_ATTR_PAN_ID,
401 NL802154_DEV_ATTR_SHORT_ADDR,
402 NL802154_DEV_ATTR_EXTENDED_ADDR,
403 NL802154_DEV_ATTR_SECLEVEL_EXEMPT,
404 NL802154_DEV_ATTR_KEY_MODE,
406 /* keep last */
407 __NL802154_DEV_ATTR_AFTER_LAST,
408 NL802154_DEV_ATTR_MAX = __NL802154_DEV_ATTR_AFTER_LAST - 1
411 enum nl802154_devkey {
412 NL802154_DEVKEY_ATTR_UNSPEC,
414 NL802154_DEVKEY_ATTR_FRAME_COUNTER,
415 NL802154_DEVKEY_ATTR_EXTENDED_ADDR,
416 NL802154_DEVKEY_ATTR_ID,
418 /* keep last */
419 __NL802154_DEVKEY_ATTR_AFTER_LAST,
420 NL802154_DEVKEY_ATTR_MAX = __NL802154_DEVKEY_ATTR_AFTER_LAST - 1
423 enum nl802154_key {
424 NL802154_KEY_ATTR_UNSPEC,
426 NL802154_KEY_ATTR_ID,
427 NL802154_KEY_ATTR_USAGE_FRAMES,
428 NL802154_KEY_ATTR_USAGE_CMDS,
429 NL802154_KEY_ATTR_BYTES,
431 /* keep last */
432 __NL802154_KEY_ATTR_AFTER_LAST,
433 NL802154_KEY_ATTR_MAX = __NL802154_KEY_ATTR_AFTER_LAST - 1
436 #define NL802154_KEY_SIZE 16
437 #define NL802154_CMD_FRAME_NR_IDS 256
439 #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */
441 #endif /* __NL802154_H */