blob: b0ab530d28cde08478beb19881965c9a24e030cc [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
55 /* add new commands above here */
56
57 /* used to define NL802154_CMD_MAX below */
58 __NL802154_CMD_AFTER_LAST,
59 NL802154_CMD_MAX = __NL802154_CMD_AFTER_LAST - 1
60};
61
62enum nl802154_attrs {
63/* don't change the order or add anything between, this is ABI! */
64/* currently we don't shipping this file via uapi, ignore the above one */
65 NL802154_ATTR_UNSPEC,
66
67 NL802154_ATTR_WPAN_PHY,
68 NL802154_ATTR_WPAN_PHY_NAME,
69
70 NL802154_ATTR_IFINDEX,
71 NL802154_ATTR_IFNAME,
72 NL802154_ATTR_IFTYPE,
73
74 NL802154_ATTR_WPAN_DEV,
75
76 NL802154_ATTR_PAGE,
77 NL802154_ATTR_CHANNEL,
78
79 NL802154_ATTR_PAN_ID,
80 NL802154_ATTR_SHORT_ADDR,
81
82 NL802154_ATTR_TX_POWER,
83
84 NL802154_ATTR_CCA_MODE,
Alexander Aringba2a9502014-12-10 15:33:13 +010085 NL802154_ATTR_CCA_OPT,
Alexander Aring3ae75e02014-11-09 08:36:52 +010086 NL802154_ATTR_CCA_ED_LEVEL,
87
88 NL802154_ATTR_MAX_FRAME_RETRIES,
89
90 NL802154_ATTR_MAX_BE,
91 NL802154_ATTR_MIN_BE,
92 NL802154_ATTR_MAX_CSMA_BACKOFFS,
93
94 NL802154_ATTR_LBT_MODE,
95
96 NL802154_ATTR_GENERATION,
97
98 NL802154_ATTR_CHANNELS_SUPPORTED,
99 NL802154_ATTR_SUPPORTED_CHANNEL,
100
101 NL802154_ATTR_EXTENDED_ADDR,
102
Alexander Aring0e665452015-05-17 21:44:53 +0200103 NL802154_ATTR_WPAN_PHY_CAPS,
104
Varka Bhadram133be022015-06-04 13:07:36 +0530105 NL802154_ATTR_SUPPORTED_COMMANDS,
106
Alexander Aring3ae75e02014-11-09 08:36:52 +0100107 /* add attributes here, update the policy in nl802154.c */
108
109 __NL802154_ATTR_AFTER_LAST,
110 NL802154_ATTR_MAX = __NL802154_ATTR_AFTER_LAST - 1
111};
112
113enum nl802154_iftype {
114 /* for backwards compatibility TODO */
115 NL802154_IFTYPE_UNSPEC = -1,
116
117 NL802154_IFTYPE_NODE,
118 NL802154_IFTYPE_MONITOR,
119 NL802154_IFTYPE_COORD,
120
121 /* keep last */
122 NUM_NL802154_IFTYPES,
123 NL802154_IFTYPE_MAX = NUM_NL802154_IFTYPES - 1
124};
125
Alexander Aringb40d6372014-12-10 15:33:11 +0100126/**
Alexander Aring0e665452015-05-17 21:44:53 +0200127 * enum nl802154_wpan_phy_capability_attr - wpan phy capability attributes
128 *
129 * @__NL802154_CAP_ATTR_INVALID: attribute number 0 is reserved
130 * @NL802154_CAP_ATTR_CHANNELS: a nested attribute for nl802154_channel_attr
131 * @NL802154_CAP_ATTR_TX_POWERS: a nested attribute for
132 * nl802154_wpan_phy_tx_power
133 * @NL802154_CAP_ATTR_MIN_CCA_ED_LEVEL: minimum value for cca_ed_level
134 * @NL802154_CAP_ATTR_MAX_CCA_ED_LEVEL: maxmimum value for cca_ed_level
135 * @NL802154_CAP_ATTR_CCA_MODES: nl802154_cca_modes flags
136 * @NL802154_CAP_ATTR_CCA_OPTS: nl802154_cca_opts flags
137 * @NL802154_CAP_ATTR_MIN_MINBE: minimum of minbe value
138 * @NL802154_CAP_ATTR_MAX_MINBE: maximum of minbe value
139 * @NL802154_CAP_ATTR_MIN_MAXBE: minimum of maxbe value
140 * @NL802154_CAP_ATTR_MAX_MINBE: maximum of maxbe value
141 * @NL802154_CAP_ATTR_MIN_CSMA_BACKOFFS: minimum of csma backoff value
142 * @NL802154_CAP_ATTR_MAX_CSMA_BACKOFFS: maximum of csma backoffs value
143 * @NL802154_CAP_ATTR_MIN_FRAME_RETRIES: minimum of frame retries value
144 * @NL802154_CAP_ATTR_MAX_FRAME_RETRIES: maximum of frame retries value
145 * @NL802154_CAP_ATTR_IFTYPES: nl802154_iftype flags
146 * @NL802154_CAP_ATTR_LBT: nl802154_supported_bool_states flags
147 * @NL802154_CAP_ATTR_MAX: highest cap attribute currently defined
148 * @__NL802154_CAP_ATTR_AFTER_LAST: internal use
149 */
150enum nl802154_wpan_phy_capability_attr {
151 __NL802154_CAP_ATTR_INVALID,
152
153 NL802154_CAP_ATTR_IFTYPES,
154
155 NL802154_CAP_ATTR_CHANNELS,
156 NL802154_CAP_ATTR_TX_POWERS,
157
158 NL802154_CAP_ATTR_CCA_ED_LEVELS,
159 NL802154_CAP_ATTR_CCA_MODES,
160 NL802154_CAP_ATTR_CCA_OPTS,
161
162 NL802154_CAP_ATTR_MIN_MINBE,
163 NL802154_CAP_ATTR_MAX_MINBE,
164
165 NL802154_CAP_ATTR_MIN_MAXBE,
166 NL802154_CAP_ATTR_MAX_MAXBE,
167
168 NL802154_CAP_ATTR_MIN_CSMA_BACKOFFS,
169 NL802154_CAP_ATTR_MAX_CSMA_BACKOFFS,
170
171 NL802154_CAP_ATTR_MIN_FRAME_RETRIES,
172 NL802154_CAP_ATTR_MAX_FRAME_RETRIES,
173
174 NL802154_CAP_ATTR_LBT,
175
176 /* keep last */
177 __NL802154_CAP_ATTR_AFTER_LAST,
178 NL802154_CAP_ATTR_MAX = __NL802154_CAP_ATTR_AFTER_LAST - 1
179};
180
181/**
Alexander Aringb40d6372014-12-10 15:33:11 +0100182 * enum nl802154_cca_modes - cca modes
183 *
184 * @__NL802154_CCA_INVALID: cca mode number 0 is reserved
185 * @NL802154_CCA_ENERGY: Energy above threshold
186 * @NL802154_CCA_CARRIER: Carrier sense only
187 * @NL802154_CCA_ENERGY_CARRIER: Carrier sense with energy above threshold
188 * @NL802154_CCA_ALOHA: CCA shall always report an idle medium
189 * @NL802154_CCA_UWB_SHR: UWB preamble sense based on the SHR of a frame
Christoffer Holmstedtd4462782015-06-10 11:03:59 +0200190 * @NL802154_CCA_UWB_MULTIPLEXED: UWB preamble sense based on the packet with
Alexander Aringb40d6372014-12-10 15:33:11 +0100191 * the multiplexed preamble
192 * @__NL802154_CCA_ATTR_AFTER_LAST: Internal
193 * @NL802154_CCA_ATTR_MAX: Maximum CCA attribute number
194 */
195enum nl802154_cca_modes {
196 __NL802154_CCA_INVALID,
197 NL802154_CCA_ENERGY,
198 NL802154_CCA_CARRIER,
199 NL802154_CCA_ENERGY_CARRIER,
200 NL802154_CCA_ALOHA,
201 NL802154_CCA_UWB_SHR,
Christoffer Holmstedtd4462782015-06-10 11:03:59 +0200202 NL802154_CCA_UWB_MULTIPLEXED,
Alexander Aringb40d6372014-12-10 15:33:11 +0100203
204 /* keep last */
205 __NL802154_CCA_ATTR_AFTER_LAST,
206 NL802154_CCA_ATTR_MAX = __NL802154_CCA_ATTR_AFTER_LAST - 1
207};
208
209/**
210 * enum nl802154_cca_opts - additional options for cca modes
211 *
212 * @NL802154_CCA_OPT_ENERGY_CARRIER_OR: NL802154_CCA_ENERGY_CARRIER with OR
213 * @NL802154_CCA_OPT_ENERGY_CARRIER_AND: NL802154_CCA_ENERGY_CARRIER with AND
214 */
215enum nl802154_cca_opts {
216 NL802154_CCA_OPT_ENERGY_CARRIER_AND,
217 NL802154_CCA_OPT_ENERGY_CARRIER_OR,
218
219 /* keep last */
220 __NL802154_CCA_OPT_ATTR_AFTER_LAST,
221 NL802154_CCA_OPT_ATTR_MAX = __NL802154_CCA_OPT_ATTR_AFTER_LAST - 1
222};
223
Alexander Aringfea33182015-05-17 21:44:43 +0200224/**
225 * enum nl802154_supported_bool_states - bool states for bool capability entry
226 *
227 * @NL802154_SUPPORTED_BOOL_FALSE: indicates to set false
228 * @NL802154_SUPPORTED_BOOL_TRUE: indicates to set true
229 * @__NL802154_SUPPORTED_BOOL_INVALD: reserved
230 * @NL802154_SUPPORTED_BOOL_BOTH: indicates to set true and false
231 * @__NL802154_SUPPORTED_BOOL_AFTER_LAST: Internal
232 * @NL802154_SUPPORTED_BOOL_MAX: highest value for bool states
233 */
234enum nl802154_supported_bool_states {
235 NL802154_SUPPORTED_BOOL_FALSE,
236 NL802154_SUPPORTED_BOOL_TRUE,
237 /* to handle them in a mask */
238 __NL802154_SUPPORTED_BOOL_INVALD,
239 NL802154_SUPPORTED_BOOL_BOTH,
240
241 /* keep last */
242 __NL802154_SUPPORTED_BOOL_AFTER_LAST,
243 NL802154_SUPPORTED_BOOL_MAX = __NL802154_SUPPORTED_BOOL_AFTER_LAST - 1
244};
245
Alexander Aring3ae75e02014-11-09 08:36:52 +0100246#endif /* __NL802154_H */