blob: fcab4de49951e91515ee097401815e93ae612755 [file] [log] [blame]
Alexander Aring3ae75e02014-11-09 08:36:52 +01001#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
22#define NL802154_GENL_NAME "nl802154"
23
24enum 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,
28
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,
33
34 NL802154_CMD_GET_INTERFACE, /* can dump */
35 NL802154_CMD_SET_INTERFACE,
36 NL802154_CMD_NEW_INTERFACE,
37 NL802154_CMD_DEL_INTERFACE,
38
39 NL802154_CMD_SET_CHANNEL,
40
41 NL802154_CMD_SET_PAN_ID,
42 NL802154_CMD_SET_SHORT_ADDR,
43
44 NL802154_CMD_SET_TX_POWER,
45 NL802154_CMD_SET_CCA_MODE,
46 NL802154_CMD_SET_CCA_ED_LEVEL,
47
48 NL802154_CMD_SET_MAX_FRAME_RETRIES,
49
50 NL802154_CMD_SET_BACKOFF_EXPONENT,
51 NL802154_CMD_SET_MAX_CSMA_BACKOFFS,
52
53 NL802154_CMD_SET_LBT_MODE,
54
Alexander Aringc91208d2015-08-10 21:15:58 +020055 NL802154_CMD_SET_ACKREQ_DEFAULT,
56
Alexander Aring3ae75e02014-11-09 08:36:52 +010057 /* add new commands above here */
58
Alexander Aringa26c5fd2015-09-28 09:00:25 +020059#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 */
74
Alexander Aring3ae75e02014-11-09 08:36:52 +010075 /* used to define NL802154_CMD_MAX below */
76 __NL802154_CMD_AFTER_LAST,
77 NL802154_CMD_MAX = __NL802154_CMD_AFTER_LAST - 1
78};
79
80enum 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,
84
85 NL802154_ATTR_WPAN_PHY,
86 NL802154_ATTR_WPAN_PHY_NAME,
87
88 NL802154_ATTR_IFINDEX,
89 NL802154_ATTR_IFNAME,
90 NL802154_ATTR_IFTYPE,
91
92 NL802154_ATTR_WPAN_DEV,
93
94 NL802154_ATTR_PAGE,
95 NL802154_ATTR_CHANNEL,
96
97 NL802154_ATTR_PAN_ID,
98 NL802154_ATTR_SHORT_ADDR,
99
100 NL802154_ATTR_TX_POWER,
101
102 NL802154_ATTR_CCA_MODE,
Alexander Aringba2a9502014-12-10 15:33:13 +0100103 NL802154_ATTR_CCA_OPT,
Alexander Aring3ae75e02014-11-09 08:36:52 +0100104 NL802154_ATTR_CCA_ED_LEVEL,
105
106 NL802154_ATTR_MAX_FRAME_RETRIES,
107
108 NL802154_ATTR_MAX_BE,
109 NL802154_ATTR_MIN_BE,
110 NL802154_ATTR_MAX_CSMA_BACKOFFS,
111
112 NL802154_ATTR_LBT_MODE,
113
114 NL802154_ATTR_GENERATION,
115
116 NL802154_ATTR_CHANNELS_SUPPORTED,
117 NL802154_ATTR_SUPPORTED_CHANNEL,
118
119 NL802154_ATTR_EXTENDED_ADDR,
120
Alexander Aring0e665452015-05-17 21:44:53 +0200121 NL802154_ATTR_WPAN_PHY_CAPS,
122
Varka Bhadram133be022015-06-04 13:07:36 +0530123 NL802154_ATTR_SUPPORTED_COMMANDS,
124
Alexander Aringc91208d2015-08-10 21:15:58 +0200125 NL802154_ATTR_ACKREQ_DEFAULT,
126
Alexander Aring3ae75e02014-11-09 08:36:52 +0100127 /* add attributes here, update the policy in nl802154.c */
128
Alexander Aringa26c5fd2015-09-28 09:00:25 +0200129#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,
134
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 */
140
Nicolas Dichtele74791222016-04-22 17:31:17 +0200141 NL802154_ATTR_PAD,
142
Alexander Aring3ae75e02014-11-09 08:36:52 +0100143 __NL802154_ATTR_AFTER_LAST,
144 NL802154_ATTR_MAX = __NL802154_ATTR_AFTER_LAST - 1
145};
146
147enum nl802154_iftype {
148 /* for backwards compatibility TODO */
149 NL802154_IFTYPE_UNSPEC = -1,
150
151 NL802154_IFTYPE_NODE,
152 NL802154_IFTYPE_MONITOR,
153 NL802154_IFTYPE_COORD,
154
155 /* keep last */
156 NUM_NL802154_IFTYPES,
157 NL802154_IFTYPE_MAX = NUM_NL802154_IFTYPES - 1
158};
159
Alexander Aringb40d6372014-12-10 15:33:11 +0100160/**
Alexander Aring0e665452015-05-17 21:44:53 +0200161 * enum nl802154_wpan_phy_capability_attr - wpan phy capability attributes
162 *
163 * @__NL802154_CAP_ATTR_INVALID: attribute number 0 is reserved
164 * @NL802154_CAP_ATTR_CHANNELS: a nested attribute for nl802154_channel_attr
165 * @NL802154_CAP_ATTR_TX_POWERS: a nested attribute for
166 * nl802154_wpan_phy_tx_power
167 * @NL802154_CAP_ATTR_MIN_CCA_ED_LEVEL: minimum value for cca_ed_level
168 * @NL802154_CAP_ATTR_MAX_CCA_ED_LEVEL: maxmimum value for cca_ed_level
169 * @NL802154_CAP_ATTR_CCA_MODES: nl802154_cca_modes flags
170 * @NL802154_CAP_ATTR_CCA_OPTS: nl802154_cca_opts flags
171 * @NL802154_CAP_ATTR_MIN_MINBE: minimum of minbe value
172 * @NL802154_CAP_ATTR_MAX_MINBE: maximum of minbe value
173 * @NL802154_CAP_ATTR_MIN_MAXBE: minimum of maxbe value
174 * @NL802154_CAP_ATTR_MAX_MINBE: maximum of maxbe value
175 * @NL802154_CAP_ATTR_MIN_CSMA_BACKOFFS: minimum of csma backoff value
176 * @NL802154_CAP_ATTR_MAX_CSMA_BACKOFFS: maximum of csma backoffs value
177 * @NL802154_CAP_ATTR_MIN_FRAME_RETRIES: minimum of frame retries value
178 * @NL802154_CAP_ATTR_MAX_FRAME_RETRIES: maximum of frame retries value
179 * @NL802154_CAP_ATTR_IFTYPES: nl802154_iftype flags
180 * @NL802154_CAP_ATTR_LBT: nl802154_supported_bool_states flags
181 * @NL802154_CAP_ATTR_MAX: highest cap attribute currently defined
182 * @__NL802154_CAP_ATTR_AFTER_LAST: internal use
183 */
184enum nl802154_wpan_phy_capability_attr {
185 __NL802154_CAP_ATTR_INVALID,
186
187 NL802154_CAP_ATTR_IFTYPES,
188
189 NL802154_CAP_ATTR_CHANNELS,
190 NL802154_CAP_ATTR_TX_POWERS,
191
192 NL802154_CAP_ATTR_CCA_ED_LEVELS,
193 NL802154_CAP_ATTR_CCA_MODES,
194 NL802154_CAP_ATTR_CCA_OPTS,
195
196 NL802154_CAP_ATTR_MIN_MINBE,
197 NL802154_CAP_ATTR_MAX_MINBE,
198
199 NL802154_CAP_ATTR_MIN_MAXBE,
200 NL802154_CAP_ATTR_MAX_MAXBE,
201
202 NL802154_CAP_ATTR_MIN_CSMA_BACKOFFS,
203 NL802154_CAP_ATTR_MAX_CSMA_BACKOFFS,
204
205 NL802154_CAP_ATTR_MIN_FRAME_RETRIES,
206 NL802154_CAP_ATTR_MAX_FRAME_RETRIES,
207
208 NL802154_CAP_ATTR_LBT,
209
210 /* keep last */
211 __NL802154_CAP_ATTR_AFTER_LAST,
212 NL802154_CAP_ATTR_MAX = __NL802154_CAP_ATTR_AFTER_LAST - 1
213};
214
215/**
Alexander Aringb40d6372014-12-10 15:33:11 +0100216 * enum nl802154_cca_modes - cca modes
217 *
218 * @__NL802154_CCA_INVALID: cca mode number 0 is reserved
219 * @NL802154_CCA_ENERGY: Energy above threshold
220 * @NL802154_CCA_CARRIER: Carrier sense only
221 * @NL802154_CCA_ENERGY_CARRIER: Carrier sense with energy above threshold
222 * @NL802154_CCA_ALOHA: CCA shall always report an idle medium
223 * @NL802154_CCA_UWB_SHR: UWB preamble sense based on the SHR of a frame
Christoffer Holmstedtd4462782015-06-10 11:03:59 +0200224 * @NL802154_CCA_UWB_MULTIPLEXED: UWB preamble sense based on the packet with
Alexander Aringb40d6372014-12-10 15:33:11 +0100225 * the multiplexed preamble
226 * @__NL802154_CCA_ATTR_AFTER_LAST: Internal
227 * @NL802154_CCA_ATTR_MAX: Maximum CCA attribute number
228 */
229enum nl802154_cca_modes {
230 __NL802154_CCA_INVALID,
231 NL802154_CCA_ENERGY,
232 NL802154_CCA_CARRIER,
233 NL802154_CCA_ENERGY_CARRIER,
234 NL802154_CCA_ALOHA,
235 NL802154_CCA_UWB_SHR,
Christoffer Holmstedtd4462782015-06-10 11:03:59 +0200236 NL802154_CCA_UWB_MULTIPLEXED,
Alexander Aringb40d6372014-12-10 15:33:11 +0100237
238 /* keep last */
239 __NL802154_CCA_ATTR_AFTER_LAST,
240 NL802154_CCA_ATTR_MAX = __NL802154_CCA_ATTR_AFTER_LAST - 1
241};
242
243/**
244 * enum nl802154_cca_opts - additional options for cca modes
245 *
246 * @NL802154_CCA_OPT_ENERGY_CARRIER_OR: NL802154_CCA_ENERGY_CARRIER with OR
247 * @NL802154_CCA_OPT_ENERGY_CARRIER_AND: NL802154_CCA_ENERGY_CARRIER with AND
248 */
249enum nl802154_cca_opts {
250 NL802154_CCA_OPT_ENERGY_CARRIER_AND,
251 NL802154_CCA_OPT_ENERGY_CARRIER_OR,
252
253 /* keep last */
254 __NL802154_CCA_OPT_ATTR_AFTER_LAST,
255 NL802154_CCA_OPT_ATTR_MAX = __NL802154_CCA_OPT_ATTR_AFTER_LAST - 1
256};
257
Alexander Aringfea33182015-05-17 21:44:43 +0200258/**
259 * enum nl802154_supported_bool_states - bool states for bool capability entry
260 *
261 * @NL802154_SUPPORTED_BOOL_FALSE: indicates to set false
262 * @NL802154_SUPPORTED_BOOL_TRUE: indicates to set true
263 * @__NL802154_SUPPORTED_BOOL_INVALD: reserved
264 * @NL802154_SUPPORTED_BOOL_BOTH: indicates to set true and false
265 * @__NL802154_SUPPORTED_BOOL_AFTER_LAST: Internal
266 * @NL802154_SUPPORTED_BOOL_MAX: highest value for bool states
267 */
268enum nl802154_supported_bool_states {
269 NL802154_SUPPORTED_BOOL_FALSE,
270 NL802154_SUPPORTED_BOOL_TRUE,
271 /* to handle them in a mask */
272 __NL802154_SUPPORTED_BOOL_INVALD,
273 NL802154_SUPPORTED_BOOL_BOTH,
274
275 /* keep last */
276 __NL802154_SUPPORTED_BOOL_AFTER_LAST,
277 NL802154_SUPPORTED_BOOL_MAX = __NL802154_SUPPORTED_BOOL_AFTER_LAST - 1
278};
279
Alexander Aringa26c5fd2015-09-28 09:00:25 +0200280#ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
281
282enum nl802154_dev_addr_modes {
283 NL802154_DEV_ADDR_NONE,
284 __NL802154_DEV_ADDR_INVALID,
285 NL802154_DEV_ADDR_SHORT,
286 NL802154_DEV_ADDR_EXTENDED,
287
288 /* keep last */
289 __NL802154_DEV_ADDR_AFTER_LAST,
290 NL802154_DEV_ADDR_MAX = __NL802154_DEV_ADDR_AFTER_LAST - 1
291};
292
293enum nl802154_dev_addr_attrs {
294 NL802154_DEV_ADDR_ATTR_UNSPEC,
295
296 NL802154_DEV_ADDR_ATTR_PAN_ID,
297 NL802154_DEV_ADDR_ATTR_MODE,
298 NL802154_DEV_ADDR_ATTR_SHORT,
299 NL802154_DEV_ADDR_ATTR_EXTENDED,
Nicolas Dichtele74791222016-04-22 17:31:17 +0200300 NL802154_DEV_ADDR_ATTR_PAD,
Alexander Aringa26c5fd2015-09-28 09:00:25 +0200301
302 /* keep last */
303 __NL802154_DEV_ADDR_ATTR_AFTER_LAST,
304 NL802154_DEV_ADDR_ATTR_MAX = __NL802154_DEV_ADDR_ATTR_AFTER_LAST - 1
305};
306
307enum nl802154_key_id_modes {
308 NL802154_KEY_ID_MODE_IMPLICIT,
309 NL802154_KEY_ID_MODE_INDEX,
310 NL802154_KEY_ID_MODE_INDEX_SHORT,
311 NL802154_KEY_ID_MODE_INDEX_EXTENDED,
312
313 /* keep last */
314 __NL802154_KEY_ID_MODE_AFTER_LAST,
315 NL802154_KEY_ID_MODE_MAX = __NL802154_KEY_ID_MODE_AFTER_LAST - 1
316};
317
318enum nl802154_key_id_attrs {
319 NL802154_KEY_ID_ATTR_UNSPEC,
320
321 NL802154_KEY_ID_ATTR_MODE,
322 NL802154_KEY_ID_ATTR_INDEX,
323 NL802154_KEY_ID_ATTR_IMPLICIT,
324 NL802154_KEY_ID_ATTR_SOURCE_SHORT,
325 NL802154_KEY_ID_ATTR_SOURCE_EXTENDED,
Nicolas Dichtele74791222016-04-22 17:31:17 +0200326 NL802154_KEY_ID_ATTR_PAD,
Alexander Aringa26c5fd2015-09-28 09:00:25 +0200327
328 /* keep last */
329 __NL802154_KEY_ID_ATTR_AFTER_LAST,
330 NL802154_KEY_ID_ATTR_MAX = __NL802154_KEY_ID_ATTR_AFTER_LAST - 1
331};
332
333enum nl802154_seclevels {
334 NL802154_SECLEVEL_NONE,
335 NL802154_SECLEVEL_MIC32,
336 NL802154_SECLEVEL_MIC64,
337 NL802154_SECLEVEL_MIC128,
338 NL802154_SECLEVEL_ENC,
339 NL802154_SECLEVEL_ENC_MIC32,
340 NL802154_SECLEVEL_ENC_MIC64,
341 NL802154_SECLEVEL_ENC_MIC128,
342
343 /* keep last */
344 __NL802154_SECLEVEL_AFTER_LAST,
345 NL802154_SECLEVEL_MAX = __NL802154_SECLEVEL_AFTER_LAST - 1
346};
347
348enum nl802154_frames {
349 NL802154_FRAME_BEACON,
350 NL802154_FRAME_DATA,
351 NL802154_FRAME_ACK,
352 NL802154_FRAME_CMD,
353
354 /* keep last */
355 __NL802154_FRAME_AFTER_LAST,
356 NL802154_FRAME_MAX = __NL802154_FRAME_AFTER_LAST - 1
357};
358
359enum nl802154_cmd_frames {
360 __NL802154_CMD_FRAME_INVALID,
361 NL802154_CMD_FRAME_ASSOC_REQUEST,
362 NL802154_CMD_FRAME_ASSOC_RESPONSE,
363 NL802154_CMD_FRAME_DISASSOC_NOTIFY,
364 NL802154_CMD_FRAME_DATA_REQUEST,
365 NL802154_CMD_FRAME_PAN_ID_CONFLICT_NOTIFY,
366 NL802154_CMD_FRAME_ORPHAN_NOTIFY,
367 NL802154_CMD_FRAME_BEACON_REQUEST,
368 NL802154_CMD_FRAME_COORD_REALIGNMENT,
369 NL802154_CMD_FRAME_GTS_REQUEST,
370
371 /* keep last */
372 __NL802154_CMD_FRAME_AFTER_LAST,
373 NL802154_CMD_FRAME_MAX = __NL802154_CMD_FRAME_AFTER_LAST - 1
374};
375
376enum nl802154_seclevel_attrs {
377 NL802154_SECLEVEL_ATTR_UNSPEC,
378
379 NL802154_SECLEVEL_ATTR_LEVELS,
380 NL802154_SECLEVEL_ATTR_FRAME,
381 NL802154_SECLEVEL_ATTR_CMD_FRAME,
382 NL802154_SECLEVEL_ATTR_DEV_OVERRIDE,
383
384 /* keep last */
385 __NL802154_SECLEVEL_ATTR_AFTER_LAST,
386 NL802154_SECLEVEL_ATTR_MAX = __NL802154_SECLEVEL_ATTR_AFTER_LAST - 1
387};
388
389/* TODO what is this? couldn't find in mib */
390enum {
391 NL802154_DEVKEY_IGNORE,
392 NL802154_DEVKEY_RESTRICT,
393 NL802154_DEVKEY_RECORD,
394
395 /* keep last */
396 __NL802154_DEVKEY_AFTER_LAST,
397 NL802154_DEVKEY_MAX = __NL802154_DEVKEY_AFTER_LAST - 1
398};
399
400enum nl802154_dev {
401 NL802154_DEV_ATTR_UNSPEC,
402
403 NL802154_DEV_ATTR_FRAME_COUNTER,
404 NL802154_DEV_ATTR_PAN_ID,
405 NL802154_DEV_ATTR_SHORT_ADDR,
406 NL802154_DEV_ATTR_EXTENDED_ADDR,
407 NL802154_DEV_ATTR_SECLEVEL_EXEMPT,
408 NL802154_DEV_ATTR_KEY_MODE,
Nicolas Dichtele74791222016-04-22 17:31:17 +0200409 NL802154_DEV_ATTR_PAD,
Alexander Aringa26c5fd2015-09-28 09:00:25 +0200410
411 /* keep last */
412 __NL802154_DEV_ATTR_AFTER_LAST,
413 NL802154_DEV_ATTR_MAX = __NL802154_DEV_ATTR_AFTER_LAST - 1
414};
415
416enum nl802154_devkey {
417 NL802154_DEVKEY_ATTR_UNSPEC,
418
419 NL802154_DEVKEY_ATTR_FRAME_COUNTER,
420 NL802154_DEVKEY_ATTR_EXTENDED_ADDR,
421 NL802154_DEVKEY_ATTR_ID,
Nicolas Dichtele74791222016-04-22 17:31:17 +0200422 NL802154_DEVKEY_ATTR_PAD,
Alexander Aringa26c5fd2015-09-28 09:00:25 +0200423
424 /* keep last */
425 __NL802154_DEVKEY_ATTR_AFTER_LAST,
426 NL802154_DEVKEY_ATTR_MAX = __NL802154_DEVKEY_ATTR_AFTER_LAST - 1
427};
428
429enum nl802154_key {
430 NL802154_KEY_ATTR_UNSPEC,
431
432 NL802154_KEY_ATTR_ID,
433 NL802154_KEY_ATTR_USAGE_FRAMES,
434 NL802154_KEY_ATTR_USAGE_CMDS,
435 NL802154_KEY_ATTR_BYTES,
436
437 /* keep last */
438 __NL802154_KEY_ATTR_AFTER_LAST,
439 NL802154_KEY_ATTR_MAX = __NL802154_KEY_ATTR_AFTER_LAST - 1
440};
441
442#define NL802154_KEY_SIZE 16
443#define NL802154_CMD_FRAME_NR_IDS 256
444
445#endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */
446
Alexander Aring3ae75e02014-11-09 08:36:52 +0100447#endif /* __NL802154_H */