blob: 32cb3e591e07b6a936a14788952c737c9bb277bd [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
Alexander Aring3ae75e02014-11-09 08:36:52 +0100141 __NL802154_ATTR_AFTER_LAST,
142 NL802154_ATTR_MAX = __NL802154_ATTR_AFTER_LAST - 1
143};
144
145enum nl802154_iftype {
146 /* for backwards compatibility TODO */
147 NL802154_IFTYPE_UNSPEC = -1,
148
149 NL802154_IFTYPE_NODE,
150 NL802154_IFTYPE_MONITOR,
151 NL802154_IFTYPE_COORD,
152
153 /* keep last */
154 NUM_NL802154_IFTYPES,
155 NL802154_IFTYPE_MAX = NUM_NL802154_IFTYPES - 1
156};
157
Alexander Aringb40d6372014-12-10 15:33:11 +0100158/**
Alexander Aring0e665452015-05-17 21:44:53 +0200159 * enum nl802154_wpan_phy_capability_attr - wpan phy capability attributes
160 *
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
181 */
182enum nl802154_wpan_phy_capability_attr {
183 __NL802154_CAP_ATTR_INVALID,
184
185 NL802154_CAP_ATTR_IFTYPES,
186
187 NL802154_CAP_ATTR_CHANNELS,
188 NL802154_CAP_ATTR_TX_POWERS,
189
190 NL802154_CAP_ATTR_CCA_ED_LEVELS,
191 NL802154_CAP_ATTR_CCA_MODES,
192 NL802154_CAP_ATTR_CCA_OPTS,
193
194 NL802154_CAP_ATTR_MIN_MINBE,
195 NL802154_CAP_ATTR_MAX_MINBE,
196
197 NL802154_CAP_ATTR_MIN_MAXBE,
198 NL802154_CAP_ATTR_MAX_MAXBE,
199
200 NL802154_CAP_ATTR_MIN_CSMA_BACKOFFS,
201 NL802154_CAP_ATTR_MAX_CSMA_BACKOFFS,
202
203 NL802154_CAP_ATTR_MIN_FRAME_RETRIES,
204 NL802154_CAP_ATTR_MAX_FRAME_RETRIES,
205
206 NL802154_CAP_ATTR_LBT,
207
208 /* keep last */
209 __NL802154_CAP_ATTR_AFTER_LAST,
210 NL802154_CAP_ATTR_MAX = __NL802154_CAP_ATTR_AFTER_LAST - 1
211};
212
213/**
Alexander Aringb40d6372014-12-10 15:33:11 +0100214 * enum nl802154_cca_modes - cca modes
215 *
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
Christoffer Holmstedtd4462782015-06-10 11:03:59 +0200222 * @NL802154_CCA_UWB_MULTIPLEXED: UWB preamble sense based on the packet with
Alexander Aringb40d6372014-12-10 15:33:11 +0100223 * the multiplexed preamble
224 * @__NL802154_CCA_ATTR_AFTER_LAST: Internal
225 * @NL802154_CCA_ATTR_MAX: Maximum CCA attribute number
226 */
227enum 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,
Christoffer Holmstedtd4462782015-06-10 11:03:59 +0200234 NL802154_CCA_UWB_MULTIPLEXED,
Alexander Aringb40d6372014-12-10 15:33:11 +0100235
236 /* keep last */
237 __NL802154_CCA_ATTR_AFTER_LAST,
238 NL802154_CCA_ATTR_MAX = __NL802154_CCA_ATTR_AFTER_LAST - 1
239};
240
241/**
242 * enum nl802154_cca_opts - additional options for cca modes
243 *
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
246 */
247enum nl802154_cca_opts {
248 NL802154_CCA_OPT_ENERGY_CARRIER_AND,
249 NL802154_CCA_OPT_ENERGY_CARRIER_OR,
250
251 /* keep last */
252 __NL802154_CCA_OPT_ATTR_AFTER_LAST,
253 NL802154_CCA_OPT_ATTR_MAX = __NL802154_CCA_OPT_ATTR_AFTER_LAST - 1
254};
255
Alexander Aringfea33182015-05-17 21:44:43 +0200256/**
257 * enum nl802154_supported_bool_states - bool states for bool capability entry
258 *
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
265 */
266enum 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,
272
273 /* keep last */
274 __NL802154_SUPPORTED_BOOL_AFTER_LAST,
275 NL802154_SUPPORTED_BOOL_MAX = __NL802154_SUPPORTED_BOOL_AFTER_LAST - 1
276};
277
Alexander Aringa26c5fd2015-09-28 09:00:25 +0200278#ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
279
280enum nl802154_dev_addr_modes {
281 NL802154_DEV_ADDR_NONE,
282 __NL802154_DEV_ADDR_INVALID,
283 NL802154_DEV_ADDR_SHORT,
284 NL802154_DEV_ADDR_EXTENDED,
285
286 /* keep last */
287 __NL802154_DEV_ADDR_AFTER_LAST,
288 NL802154_DEV_ADDR_MAX = __NL802154_DEV_ADDR_AFTER_LAST - 1
289};
290
291enum nl802154_dev_addr_attrs {
292 NL802154_DEV_ADDR_ATTR_UNSPEC,
293
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,
298
299 /* keep last */
300 __NL802154_DEV_ADDR_ATTR_AFTER_LAST,
301 NL802154_DEV_ADDR_ATTR_MAX = __NL802154_DEV_ADDR_ATTR_AFTER_LAST - 1
302};
303
304enum 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,
309
310 /* keep last */
311 __NL802154_KEY_ID_MODE_AFTER_LAST,
312 NL802154_KEY_ID_MODE_MAX = __NL802154_KEY_ID_MODE_AFTER_LAST - 1
313};
314
315enum nl802154_key_id_attrs {
316 NL802154_KEY_ID_ATTR_UNSPEC,
317
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,
323
324 /* keep last */
325 __NL802154_KEY_ID_ATTR_AFTER_LAST,
326 NL802154_KEY_ID_ATTR_MAX = __NL802154_KEY_ID_ATTR_AFTER_LAST - 1
327};
328
329enum 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,
338
339 /* keep last */
340 __NL802154_SECLEVEL_AFTER_LAST,
341 NL802154_SECLEVEL_MAX = __NL802154_SECLEVEL_AFTER_LAST - 1
342};
343
344enum nl802154_frames {
345 NL802154_FRAME_BEACON,
346 NL802154_FRAME_DATA,
347 NL802154_FRAME_ACK,
348 NL802154_FRAME_CMD,
349
350 /* keep last */
351 __NL802154_FRAME_AFTER_LAST,
352 NL802154_FRAME_MAX = __NL802154_FRAME_AFTER_LAST - 1
353};
354
355enum 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,
366
367 /* keep last */
368 __NL802154_CMD_FRAME_AFTER_LAST,
369 NL802154_CMD_FRAME_MAX = __NL802154_CMD_FRAME_AFTER_LAST - 1
370};
371
372enum nl802154_seclevel_attrs {
373 NL802154_SECLEVEL_ATTR_UNSPEC,
374
375 NL802154_SECLEVEL_ATTR_LEVELS,
376 NL802154_SECLEVEL_ATTR_FRAME,
377 NL802154_SECLEVEL_ATTR_CMD_FRAME,
378 NL802154_SECLEVEL_ATTR_DEV_OVERRIDE,
379
380 /* keep last */
381 __NL802154_SECLEVEL_ATTR_AFTER_LAST,
382 NL802154_SECLEVEL_ATTR_MAX = __NL802154_SECLEVEL_ATTR_AFTER_LAST - 1
383};
384
385/* TODO what is this? couldn't find in mib */
386enum {
387 NL802154_DEVKEY_IGNORE,
388 NL802154_DEVKEY_RESTRICT,
389 NL802154_DEVKEY_RECORD,
390
391 /* keep last */
392 __NL802154_DEVKEY_AFTER_LAST,
393 NL802154_DEVKEY_MAX = __NL802154_DEVKEY_AFTER_LAST - 1
394};
395
396enum nl802154_dev {
397 NL802154_DEV_ATTR_UNSPEC,
398
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,
405
406 /* keep last */
407 __NL802154_DEV_ATTR_AFTER_LAST,
408 NL802154_DEV_ATTR_MAX = __NL802154_DEV_ATTR_AFTER_LAST - 1
409};
410
411enum nl802154_devkey {
412 NL802154_DEVKEY_ATTR_UNSPEC,
413
414 NL802154_DEVKEY_ATTR_FRAME_COUNTER,
415 NL802154_DEVKEY_ATTR_EXTENDED_ADDR,
416 NL802154_DEVKEY_ATTR_ID,
417
418 /* keep last */
419 __NL802154_DEVKEY_ATTR_AFTER_LAST,
420 NL802154_DEVKEY_ATTR_MAX = __NL802154_DEVKEY_ATTR_AFTER_LAST - 1
421};
422
423enum nl802154_key {
424 NL802154_KEY_ATTR_UNSPEC,
425
426 NL802154_KEY_ATTR_ID,
427 NL802154_KEY_ATTR_USAGE_FRAMES,
428 NL802154_KEY_ATTR_USAGE_CMDS,
429 NL802154_KEY_ATTR_BYTES,
430
431 /* keep last */
432 __NL802154_KEY_ATTR_AFTER_LAST,
433 NL802154_KEY_ATTR_MAX = __NL802154_KEY_ATTR_AFTER_LAST - 1
434};
435
436#define NL802154_KEY_SIZE 16
437#define NL802154_CMD_FRAME_NR_IDS 256
438
439#endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */
440
Alexander Aring3ae75e02014-11-09 08:36:52 +0100441#endif /* __NL802154_H */