Deleted Added
full compact
_ieee80211.h (288245) _ieee80211.h (298818)
1/*-
2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/net80211/_ieee80211.h 288245 2015-09-26 00:53:37Z adrian $
26 * $FreeBSD: head/sys/net80211/_ieee80211.h 298818 2016-04-29 22:14:11Z avos $
27 */
28#ifndef _NET80211__IEEE80211_H_
29#define _NET80211__IEEE80211_H_
30
31/*
32 * 802.11 implementation definitions.
33 *
34 * NB: this file is used by applications.
35 */
36
37/*
38 * PHY type; mostly used to identify FH phys.
39 */
40enum ieee80211_phytype {
41 IEEE80211_T_DS, /* direct sequence spread spectrum */
42 IEEE80211_T_FH, /* frequency hopping */
43 IEEE80211_T_OFDM, /* frequency division multiplexing */
44 IEEE80211_T_TURBO, /* high rate OFDM, aka turbo mode */
45 IEEE80211_T_HT, /* high throughput */
46 IEEE80211_T_OFDM_HALF, /* 1/2 rate OFDM */
47 IEEE80211_T_OFDM_QUARTER, /* 1/4 rate OFDM */
48};
49#define IEEE80211_T_CCK IEEE80211_T_DS /* more common nomenclature */
50
51/*
52 * PHY mode; this is not really a mode as multi-mode devices
53 * have multiple PHY's. Mode is mostly used as a shorthand
54 * for constraining which channels to consider in setting up
55 * operation. Modes used to be used more extensively when
56 * channels were identified as IEEE channel numbers.
57 */
58enum ieee80211_phymode {
59 IEEE80211_MODE_AUTO = 0, /* autoselect */
60 IEEE80211_MODE_11A = 1, /* 5GHz, OFDM */
61 IEEE80211_MODE_11B = 2, /* 2GHz, CCK */
62 IEEE80211_MODE_11G = 3, /* 2GHz, OFDM */
63 IEEE80211_MODE_FH = 4, /* 2GHz, GFSK */
64 IEEE80211_MODE_TURBO_A = 5, /* 5GHz, OFDM, 2x clock */
65 IEEE80211_MODE_TURBO_G = 6, /* 2GHz, OFDM, 2x clock */
66 IEEE80211_MODE_STURBO_A = 7, /* 5GHz, OFDM, 2x clock, static */
67 IEEE80211_MODE_11NA = 8, /* 5GHz, w/ HT */
68 IEEE80211_MODE_11NG = 9, /* 2GHz, w/ HT */
69 IEEE80211_MODE_HALF = 10, /* OFDM, 1/2x clock */
70 IEEE80211_MODE_QUARTER = 11, /* OFDM, 1/4x clock */
71};
72#define IEEE80211_MODE_MAX (IEEE80211_MODE_QUARTER+1)
27 */
28#ifndef _NET80211__IEEE80211_H_
29#define _NET80211__IEEE80211_H_
30
31/*
32 * 802.11 implementation definitions.
33 *
34 * NB: this file is used by applications.
35 */
36
37/*
38 * PHY type; mostly used to identify FH phys.
39 */
40enum ieee80211_phytype {
41 IEEE80211_T_DS, /* direct sequence spread spectrum */
42 IEEE80211_T_FH, /* frequency hopping */
43 IEEE80211_T_OFDM, /* frequency division multiplexing */
44 IEEE80211_T_TURBO, /* high rate OFDM, aka turbo mode */
45 IEEE80211_T_HT, /* high throughput */
46 IEEE80211_T_OFDM_HALF, /* 1/2 rate OFDM */
47 IEEE80211_T_OFDM_QUARTER, /* 1/4 rate OFDM */
48};
49#define IEEE80211_T_CCK IEEE80211_T_DS /* more common nomenclature */
50
51/*
52 * PHY mode; this is not really a mode as multi-mode devices
53 * have multiple PHY's. Mode is mostly used as a shorthand
54 * for constraining which channels to consider in setting up
55 * operation. Modes used to be used more extensively when
56 * channels were identified as IEEE channel numbers.
57 */
58enum ieee80211_phymode {
59 IEEE80211_MODE_AUTO = 0, /* autoselect */
60 IEEE80211_MODE_11A = 1, /* 5GHz, OFDM */
61 IEEE80211_MODE_11B = 2, /* 2GHz, CCK */
62 IEEE80211_MODE_11G = 3, /* 2GHz, OFDM */
63 IEEE80211_MODE_FH = 4, /* 2GHz, GFSK */
64 IEEE80211_MODE_TURBO_A = 5, /* 5GHz, OFDM, 2x clock */
65 IEEE80211_MODE_TURBO_G = 6, /* 2GHz, OFDM, 2x clock */
66 IEEE80211_MODE_STURBO_A = 7, /* 5GHz, OFDM, 2x clock, static */
67 IEEE80211_MODE_11NA = 8, /* 5GHz, w/ HT */
68 IEEE80211_MODE_11NG = 9, /* 2GHz, w/ HT */
69 IEEE80211_MODE_HALF = 10, /* OFDM, 1/2x clock */
70 IEEE80211_MODE_QUARTER = 11, /* OFDM, 1/4x clock */
71};
72#define IEEE80211_MODE_MAX (IEEE80211_MODE_QUARTER+1)
73#define IEEE80211_MODE_BYTES 2 /* howmany(IEEE80211_MODE_MAX, NBBY) */
73
74/*
75 * Operating mode. Devices do not necessarily support
76 * all modes; they indicate which are supported in their
77 * capabilities.
78 */
79enum ieee80211_opmode {
80 IEEE80211_M_IBSS = 0, /* IBSS (adhoc) station */
81 IEEE80211_M_STA = 1, /* infrastructure station */
82 IEEE80211_M_WDS = 2, /* WDS link */
83 IEEE80211_M_AHDEMO = 3, /* Old lucent compatible adhoc demo */
84 IEEE80211_M_HOSTAP = 4, /* Software Access Point */
85 IEEE80211_M_MONITOR = 5, /* Monitor mode */
86 IEEE80211_M_MBSS = 6, /* MBSS (Mesh Point) link */
87};
88#define IEEE80211_OPMODE_MAX (IEEE80211_M_MBSS+1)
89
90/*
91 * 802.11g/802.11n protection mode.
92 */
93enum ieee80211_protmode {
94 IEEE80211_PROT_NONE = 0, /* no protection */
95 IEEE80211_PROT_CTSONLY = 1, /* CTS to self */
96 IEEE80211_PROT_RTSCTS = 2, /* RTS-CTS */
97};
98
99/*
100 * Authentication mode. The open and shared key authentication
101 * modes are implemented within the 802.11 layer. 802.1x and
102 * WPA/802.11i are implemented in user mode by setting the
103 * 802.11 layer into IEEE80211_AUTH_8021X and deferring
104 * authentication to user space programs.
105 */
106enum ieee80211_authmode {
107 IEEE80211_AUTH_NONE = 0,
108 IEEE80211_AUTH_OPEN = 1, /* open */
109 IEEE80211_AUTH_SHARED = 2, /* shared-key */
110 IEEE80211_AUTH_8021X = 3, /* 802.1x */
111 IEEE80211_AUTH_AUTO = 4, /* auto-select/accept */
112 /* NB: these are used only for ioctls */
113 IEEE80211_AUTH_WPA = 5, /* WPA/RSN w/ 802.1x/PSK */
114};
115
116/*
117 * Roaming mode is effectively who controls the operation
118 * of the 802.11 state machine when operating as a station.
119 * State transitions are controlled either by the driver
120 * (typically when management frames are processed by the
121 * hardware/firmware), the host (auto/normal operation of
122 * the 802.11 layer), or explicitly through ioctl requests
123 * when applications like wpa_supplicant want control.
124 */
125enum ieee80211_roamingmode {
126 IEEE80211_ROAMING_DEVICE= 0, /* driver/hardware control */
127 IEEE80211_ROAMING_AUTO = 1, /* 802.11 layer control */
128 IEEE80211_ROAMING_MANUAL= 2, /* application control */
129};
130
131/*
132 * Channels are specified by frequency and attributes.
133 */
134struct ieee80211_channel {
135 uint32_t ic_flags; /* see below */
136 uint16_t ic_freq; /* setting in MHz */
137 uint8_t ic_ieee; /* IEEE channel number */
138 int8_t ic_maxregpower; /* maximum regulatory tx power in dBm */
139 int8_t ic_maxpower; /* maximum tx power in .5 dBm */
140 int8_t ic_minpower; /* minimum tx power in .5 dBm */
141 uint8_t ic_state; /* dynamic state */
142 uint8_t ic_extieee; /* HT40 extension channel number */
143 int8_t ic_maxantgain; /* maximum antenna gain in .5 dBm */
144 uint8_t ic_pad;
145 uint16_t ic_devdata; /* opaque device/driver data */
146};
147
148#define IEEE80211_CHAN_MAX 256
149#define IEEE80211_CHAN_BYTES 32 /* howmany(IEEE80211_CHAN_MAX, NBBY) */
150#define IEEE80211_CHAN_ANY 0xffff /* token for ``any channel'' */
151#define IEEE80211_CHAN_ANYC \
152 ((struct ieee80211_channel *) IEEE80211_CHAN_ANY)
153
154/* channel attributes */
155#define IEEE80211_CHAN_PRIV0 0x00000001 /* driver private bit 0 */
156#define IEEE80211_CHAN_PRIV1 0x00000002 /* driver private bit 1 */
157#define IEEE80211_CHAN_PRIV2 0x00000004 /* driver private bit 2 */
158#define IEEE80211_CHAN_PRIV3 0x00000008 /* driver private bit 3 */
159#define IEEE80211_CHAN_TURBO 0x00000010 /* Turbo channel */
160#define IEEE80211_CHAN_CCK 0x00000020 /* CCK channel */
161#define IEEE80211_CHAN_OFDM 0x00000040 /* OFDM channel */
162#define IEEE80211_CHAN_2GHZ 0x00000080 /* 2 GHz spectrum channel. */
163#define IEEE80211_CHAN_5GHZ 0x00000100 /* 5 GHz spectrum channel */
164#define IEEE80211_CHAN_PASSIVE 0x00000200 /* Only passive scan allowed */
165#define IEEE80211_CHAN_DYN 0x00000400 /* Dynamic CCK-OFDM channel */
166#define IEEE80211_CHAN_GFSK 0x00000800 /* GFSK channel (FHSS PHY) */
167#define IEEE80211_CHAN_GSM 0x00001000 /* 900 MHz spectrum channel */
168#define IEEE80211_CHAN_STURBO 0x00002000 /* 11a static turbo channel only */
169#define IEEE80211_CHAN_HALF 0x00004000 /* Half rate channel */
170#define IEEE80211_CHAN_QUARTER 0x00008000 /* Quarter rate channel */
171#define IEEE80211_CHAN_HT20 0x00010000 /* HT 20 channel */
172#define IEEE80211_CHAN_HT40U 0x00020000 /* HT 40 channel w/ ext above */
173#define IEEE80211_CHAN_HT40D 0x00040000 /* HT 40 channel w/ ext below */
174#define IEEE80211_CHAN_DFS 0x00080000 /* DFS required */
175#define IEEE80211_CHAN_4MSXMIT 0x00100000 /* 4ms limit on frame length */
176#define IEEE80211_CHAN_NOADHOC 0x00200000 /* adhoc mode not allowed */
177#define IEEE80211_CHAN_NOHOSTAP 0x00400000 /* hostap mode not allowed */
178#define IEEE80211_CHAN_11D 0x00800000 /* 802.11d required */
179
180#define IEEE80211_CHAN_HT40 (IEEE80211_CHAN_HT40U | IEEE80211_CHAN_HT40D)
181#define IEEE80211_CHAN_HT (IEEE80211_CHAN_HT20 | IEEE80211_CHAN_HT40)
182
183#define IEEE80211_CHAN_BITS \
184 "\20\1PRIV0\2PRIV2\3PRIV3\4PRIV4\5TURBO\6CCK\7OFDM\0102GHZ\0115GHZ" \
185 "\12PASSIVE\13DYN\14GFSK\15GSM\16STURBO\17HALF\20QUARTER\21HT20" \
186 "\22HT40U\23HT40D\24DFS\0254MSXMIT\26NOADHOC\27NOHOSTAP\03011D"
187
188/*
189 * Useful combinations of channel characteristics.
190 */
191#define IEEE80211_CHAN_FHSS \
192 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK)
193#define IEEE80211_CHAN_A \
194 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
195#define IEEE80211_CHAN_B \
196 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK)
197#define IEEE80211_CHAN_PUREG \
198 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM)
199#define IEEE80211_CHAN_G \
200 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN)
201#define IEEE80211_CHAN_108A \
202 (IEEE80211_CHAN_A | IEEE80211_CHAN_TURBO)
203#define IEEE80211_CHAN_108G \
204 (IEEE80211_CHAN_PUREG | IEEE80211_CHAN_TURBO)
205#define IEEE80211_CHAN_ST \
206 (IEEE80211_CHAN_108A | IEEE80211_CHAN_STURBO)
207
208#define IEEE80211_CHAN_ALL \
209 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_GFSK | \
210 IEEE80211_CHAN_CCK | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN | \
211 IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER | \
212 IEEE80211_CHAN_HT)
213#define IEEE80211_CHAN_ALLTURBO \
214 (IEEE80211_CHAN_ALL | IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)
215
216#define IEEE80211_IS_CHAN_FHSS(_c) \
217 (((_c)->ic_flags & IEEE80211_CHAN_FHSS) == IEEE80211_CHAN_FHSS)
218#define IEEE80211_IS_CHAN_A(_c) \
219 (((_c)->ic_flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A)
220#define IEEE80211_IS_CHAN_B(_c) \
221 (((_c)->ic_flags & IEEE80211_CHAN_B) == IEEE80211_CHAN_B)
222#define IEEE80211_IS_CHAN_PUREG(_c) \
223 (((_c)->ic_flags & IEEE80211_CHAN_PUREG) == IEEE80211_CHAN_PUREG)
224#define IEEE80211_IS_CHAN_G(_c) \
225 (((_c)->ic_flags & IEEE80211_CHAN_G) == IEEE80211_CHAN_G)
226#define IEEE80211_IS_CHAN_ANYG(_c) \
227 (IEEE80211_IS_CHAN_PUREG(_c) || IEEE80211_IS_CHAN_G(_c))
228#define IEEE80211_IS_CHAN_ST(_c) \
229 (((_c)->ic_flags & IEEE80211_CHAN_ST) == IEEE80211_CHAN_ST)
230#define IEEE80211_IS_CHAN_108A(_c) \
231 (((_c)->ic_flags & IEEE80211_CHAN_108A) == IEEE80211_CHAN_108A)
232#define IEEE80211_IS_CHAN_108G(_c) \
233 (((_c)->ic_flags & IEEE80211_CHAN_108G) == IEEE80211_CHAN_108G)
234
235#define IEEE80211_IS_CHAN_2GHZ(_c) \
236 (((_c)->ic_flags & IEEE80211_CHAN_2GHZ) != 0)
237#define IEEE80211_IS_CHAN_5GHZ(_c) \
238 (((_c)->ic_flags & IEEE80211_CHAN_5GHZ) != 0)
239#define IEEE80211_IS_CHAN_PASSIVE(_c) \
240 (((_c)->ic_flags & IEEE80211_CHAN_PASSIVE) != 0)
241#define IEEE80211_IS_CHAN_OFDM(_c) \
242 (((_c)->ic_flags & (IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN)) != 0)
243#define IEEE80211_IS_CHAN_CCK(_c) \
244 (((_c)->ic_flags & (IEEE80211_CHAN_CCK | IEEE80211_CHAN_DYN)) != 0)
245#define IEEE80211_IS_CHAN_DYN(_c) \
246 (((_c)->ic_flags & IEEE80211_CHAN_DYN) == IEEE80211_CHAN_DYN)
247#define IEEE80211_IS_CHAN_GFSK(_c) \
248 (((_c)->ic_flags & IEEE80211_CHAN_GFSK) != 0)
249#define IEEE80211_IS_CHAN_TURBO(_c) \
250 (((_c)->ic_flags & IEEE80211_CHAN_TURBO) != 0)
251#define IEEE80211_IS_CHAN_STURBO(_c) \
252 (((_c)->ic_flags & IEEE80211_CHAN_STURBO) != 0)
253#define IEEE80211_IS_CHAN_DTURBO(_c) \
254 (((_c)->ic_flags & \
255 (IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)) == IEEE80211_CHAN_TURBO)
256#define IEEE80211_IS_CHAN_HALF(_c) \
257 (((_c)->ic_flags & IEEE80211_CHAN_HALF) != 0)
258#define IEEE80211_IS_CHAN_QUARTER(_c) \
259 (((_c)->ic_flags & IEEE80211_CHAN_QUARTER) != 0)
260#define IEEE80211_IS_CHAN_FULL(_c) \
261 (((_c)->ic_flags & (IEEE80211_CHAN_QUARTER | IEEE80211_CHAN_HALF)) == 0)
262#define IEEE80211_IS_CHAN_GSM(_c) \
263 (((_c)->ic_flags & IEEE80211_CHAN_GSM) != 0)
264#define IEEE80211_IS_CHAN_HT(_c) \
265 (((_c)->ic_flags & IEEE80211_CHAN_HT) != 0)
266#define IEEE80211_IS_CHAN_HT20(_c) \
267 (((_c)->ic_flags & IEEE80211_CHAN_HT20) != 0)
268#define IEEE80211_IS_CHAN_HT40(_c) \
269 (((_c)->ic_flags & IEEE80211_CHAN_HT40) != 0)
270#define IEEE80211_IS_CHAN_HT40U(_c) \
271 (((_c)->ic_flags & IEEE80211_CHAN_HT40U) != 0)
272#define IEEE80211_IS_CHAN_HT40D(_c) \
273 (((_c)->ic_flags & IEEE80211_CHAN_HT40D) != 0)
274#define IEEE80211_IS_CHAN_HTA(_c) \
275 (IEEE80211_IS_CHAN_5GHZ(_c) && \
276 ((_c)->ic_flags & IEEE80211_CHAN_HT) != 0)
277#define IEEE80211_IS_CHAN_HTG(_c) \
278 (IEEE80211_IS_CHAN_2GHZ(_c) && \
279 ((_c)->ic_flags & IEEE80211_CHAN_HT) != 0)
280#define IEEE80211_IS_CHAN_DFS(_c) \
281 (((_c)->ic_flags & IEEE80211_CHAN_DFS) != 0)
282#define IEEE80211_IS_CHAN_NOADHOC(_c) \
283 (((_c)->ic_flags & IEEE80211_CHAN_NOADHOC) != 0)
284#define IEEE80211_IS_CHAN_NOHOSTAP(_c) \
285 (((_c)->ic_flags & IEEE80211_CHAN_NOHOSTAP) != 0)
286#define IEEE80211_IS_CHAN_11D(_c) \
287 (((_c)->ic_flags & IEEE80211_CHAN_11D) != 0)
288
289#define IEEE80211_CHAN2IEEE(_c) (_c)->ic_ieee
290
291/* dynamic state */
292#define IEEE80211_CHANSTATE_RADAR 0x01 /* radar detected */
293#define IEEE80211_CHANSTATE_CACDONE 0x02 /* CAC completed */
294#define IEEE80211_CHANSTATE_CWINT 0x04 /* interference detected */
295#define IEEE80211_CHANSTATE_NORADAR 0x10 /* post notify on radar clear */
296
297#define IEEE80211_IS_CHAN_RADAR(_c) \
298 (((_c)->ic_state & IEEE80211_CHANSTATE_RADAR) != 0)
299#define IEEE80211_IS_CHAN_CACDONE(_c) \
300 (((_c)->ic_state & IEEE80211_CHANSTATE_CACDONE) != 0)
301#define IEEE80211_IS_CHAN_CWINT(_c) \
302 (((_c)->ic_state & IEEE80211_CHANSTATE_CWINT) != 0)
303
304/* ni_chan encoding for FH phy */
305#define IEEE80211_FH_CHANMOD 80
306#define IEEE80211_FH_CHAN(set,pat) (((set)-1)*IEEE80211_FH_CHANMOD+(pat))
307#define IEEE80211_FH_CHANSET(chan) ((chan)/IEEE80211_FH_CHANMOD+1)
308#define IEEE80211_FH_CHANPAT(chan) ((chan)%IEEE80211_FH_CHANMOD)
309
310#define IEEE80211_TID_SIZE (WME_NUM_TID+1) /* WME TID's +1 for non-QoS */
311#define IEEE80211_NONQOS_TID WME_NUM_TID /* index for non-QoS sta */
312
313/*
314 * The 802.11 spec says at most 2007 stations may be
315 * associated at once. For most AP's this is way more
316 * than is feasible so we use a default of 128. This
317 * number may be overridden by the driver and/or by
318 * user configuration but may not be less than IEEE80211_AID_MIN.
319 */
320#define IEEE80211_AID_DEF 128
321#define IEEE80211_AID_MIN 16
322
323/*
324 * 802.11 rate set.
325 */
326#define IEEE80211_RATE_SIZE 8 /* 802.11 standard */
327#define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */
328
329struct ieee80211_rateset {
330 uint8_t rs_nrates;
331 uint8_t rs_rates[IEEE80211_RATE_MAXSIZE];
332};
333
334/*
335 * 802.11n variant of ieee80211_rateset. Instead of
336 * legacy rates the entries are MCS rates. We define
337 * the structure such that it can be used interchangeably
338 * with an ieee80211_rateset (modulo structure size).
339 */
340#define IEEE80211_HTRATE_MAXSIZE 77
341
342struct ieee80211_htrateset {
343 uint8_t rs_nrates;
344 uint8_t rs_rates[IEEE80211_HTRATE_MAXSIZE];
345};
346
347#define IEEE80211_RATE_MCS 0x80
348
349/*
350 * Per-mode transmit parameters/controls visible to user space.
351 * These can be used to set fixed transmit rate for all operating
352 * modes or on a per-client basis according to the capabilities
353 * of the client (e.g. an 11b client associated to an 11g ap).
354 *
355 * MCS are distinguished from legacy rates by or'ing in 0x80.
356 */
357struct ieee80211_txparam {
358 uint8_t ucastrate; /* ucast data rate (legacy/MCS|0x80) */
359 uint8_t mgmtrate; /* mgmt frame rate (legacy/MCS|0x80) */
360 uint8_t mcastrate; /* multicast rate (legacy/MCS|0x80) */
361 uint8_t maxretry; /* max unicast data retry count */
362};
363
364/*
365 * Per-mode roaming state visible to user space. There are two
366 * thresholds that control whether roaming is considered; when
367 * either is exceeded the 802.11 layer will check the scan cache
368 * for another AP. If the cache is stale then a scan may be
369 * triggered.
370 */
371struct ieee80211_roamparam {
372 int8_t rssi; /* rssi thresh (.5 dBm) */
373 uint8_t rate; /* tx rate thresh (.5 Mb/s or MCS) */
374 uint16_t pad; /* reserve */
375};
376
377/*
378 * Regulatory Information.
379 */
380struct ieee80211_regdomain {
381 uint16_t regdomain; /* SKU */
382 uint16_t country; /* ISO country code */
383 uint8_t location; /* I (indoor), O (outdoor), other */
384 uint8_t ecm; /* Extended Channel Mode */
385 char isocc[2]; /* country code string */
386 short pad[2];
387};
388
389/*
390 * MIMO antenna/radio state.
391 */
392
393/*
394 * XXX This doesn't yet export both ctl/ext chain details
395 * XXX TODO: IEEE80211_MAX_CHAINS is defined in _freebsd.h, not here;
396 * figure out how to pull it in!
397 */
398struct ieee80211_mimo_info {
399 int8_t rssi[3]; /* per-antenna rssi */
400 int8_t noise[3]; /* per-antenna noise floor */
401 uint8_t pad[2];
402 uint32_t evm[3]; /* EVM data */
403};
404#endif /* _NET80211__IEEE80211_H_ */
74
75/*
76 * Operating mode. Devices do not necessarily support
77 * all modes; they indicate which are supported in their
78 * capabilities.
79 */
80enum ieee80211_opmode {
81 IEEE80211_M_IBSS = 0, /* IBSS (adhoc) station */
82 IEEE80211_M_STA = 1, /* infrastructure station */
83 IEEE80211_M_WDS = 2, /* WDS link */
84 IEEE80211_M_AHDEMO = 3, /* Old lucent compatible adhoc demo */
85 IEEE80211_M_HOSTAP = 4, /* Software Access Point */
86 IEEE80211_M_MONITOR = 5, /* Monitor mode */
87 IEEE80211_M_MBSS = 6, /* MBSS (Mesh Point) link */
88};
89#define IEEE80211_OPMODE_MAX (IEEE80211_M_MBSS+1)
90
91/*
92 * 802.11g/802.11n protection mode.
93 */
94enum ieee80211_protmode {
95 IEEE80211_PROT_NONE = 0, /* no protection */
96 IEEE80211_PROT_CTSONLY = 1, /* CTS to self */
97 IEEE80211_PROT_RTSCTS = 2, /* RTS-CTS */
98};
99
100/*
101 * Authentication mode. The open and shared key authentication
102 * modes are implemented within the 802.11 layer. 802.1x and
103 * WPA/802.11i are implemented in user mode by setting the
104 * 802.11 layer into IEEE80211_AUTH_8021X and deferring
105 * authentication to user space programs.
106 */
107enum ieee80211_authmode {
108 IEEE80211_AUTH_NONE = 0,
109 IEEE80211_AUTH_OPEN = 1, /* open */
110 IEEE80211_AUTH_SHARED = 2, /* shared-key */
111 IEEE80211_AUTH_8021X = 3, /* 802.1x */
112 IEEE80211_AUTH_AUTO = 4, /* auto-select/accept */
113 /* NB: these are used only for ioctls */
114 IEEE80211_AUTH_WPA = 5, /* WPA/RSN w/ 802.1x/PSK */
115};
116
117/*
118 * Roaming mode is effectively who controls the operation
119 * of the 802.11 state machine when operating as a station.
120 * State transitions are controlled either by the driver
121 * (typically when management frames are processed by the
122 * hardware/firmware), the host (auto/normal operation of
123 * the 802.11 layer), or explicitly through ioctl requests
124 * when applications like wpa_supplicant want control.
125 */
126enum ieee80211_roamingmode {
127 IEEE80211_ROAMING_DEVICE= 0, /* driver/hardware control */
128 IEEE80211_ROAMING_AUTO = 1, /* 802.11 layer control */
129 IEEE80211_ROAMING_MANUAL= 2, /* application control */
130};
131
132/*
133 * Channels are specified by frequency and attributes.
134 */
135struct ieee80211_channel {
136 uint32_t ic_flags; /* see below */
137 uint16_t ic_freq; /* setting in MHz */
138 uint8_t ic_ieee; /* IEEE channel number */
139 int8_t ic_maxregpower; /* maximum regulatory tx power in dBm */
140 int8_t ic_maxpower; /* maximum tx power in .5 dBm */
141 int8_t ic_minpower; /* minimum tx power in .5 dBm */
142 uint8_t ic_state; /* dynamic state */
143 uint8_t ic_extieee; /* HT40 extension channel number */
144 int8_t ic_maxantgain; /* maximum antenna gain in .5 dBm */
145 uint8_t ic_pad;
146 uint16_t ic_devdata; /* opaque device/driver data */
147};
148
149#define IEEE80211_CHAN_MAX 256
150#define IEEE80211_CHAN_BYTES 32 /* howmany(IEEE80211_CHAN_MAX, NBBY) */
151#define IEEE80211_CHAN_ANY 0xffff /* token for ``any channel'' */
152#define IEEE80211_CHAN_ANYC \
153 ((struct ieee80211_channel *) IEEE80211_CHAN_ANY)
154
155/* channel attributes */
156#define IEEE80211_CHAN_PRIV0 0x00000001 /* driver private bit 0 */
157#define IEEE80211_CHAN_PRIV1 0x00000002 /* driver private bit 1 */
158#define IEEE80211_CHAN_PRIV2 0x00000004 /* driver private bit 2 */
159#define IEEE80211_CHAN_PRIV3 0x00000008 /* driver private bit 3 */
160#define IEEE80211_CHAN_TURBO 0x00000010 /* Turbo channel */
161#define IEEE80211_CHAN_CCK 0x00000020 /* CCK channel */
162#define IEEE80211_CHAN_OFDM 0x00000040 /* OFDM channel */
163#define IEEE80211_CHAN_2GHZ 0x00000080 /* 2 GHz spectrum channel. */
164#define IEEE80211_CHAN_5GHZ 0x00000100 /* 5 GHz spectrum channel */
165#define IEEE80211_CHAN_PASSIVE 0x00000200 /* Only passive scan allowed */
166#define IEEE80211_CHAN_DYN 0x00000400 /* Dynamic CCK-OFDM channel */
167#define IEEE80211_CHAN_GFSK 0x00000800 /* GFSK channel (FHSS PHY) */
168#define IEEE80211_CHAN_GSM 0x00001000 /* 900 MHz spectrum channel */
169#define IEEE80211_CHAN_STURBO 0x00002000 /* 11a static turbo channel only */
170#define IEEE80211_CHAN_HALF 0x00004000 /* Half rate channel */
171#define IEEE80211_CHAN_QUARTER 0x00008000 /* Quarter rate channel */
172#define IEEE80211_CHAN_HT20 0x00010000 /* HT 20 channel */
173#define IEEE80211_CHAN_HT40U 0x00020000 /* HT 40 channel w/ ext above */
174#define IEEE80211_CHAN_HT40D 0x00040000 /* HT 40 channel w/ ext below */
175#define IEEE80211_CHAN_DFS 0x00080000 /* DFS required */
176#define IEEE80211_CHAN_4MSXMIT 0x00100000 /* 4ms limit on frame length */
177#define IEEE80211_CHAN_NOADHOC 0x00200000 /* adhoc mode not allowed */
178#define IEEE80211_CHAN_NOHOSTAP 0x00400000 /* hostap mode not allowed */
179#define IEEE80211_CHAN_11D 0x00800000 /* 802.11d required */
180
181#define IEEE80211_CHAN_HT40 (IEEE80211_CHAN_HT40U | IEEE80211_CHAN_HT40D)
182#define IEEE80211_CHAN_HT (IEEE80211_CHAN_HT20 | IEEE80211_CHAN_HT40)
183
184#define IEEE80211_CHAN_BITS \
185 "\20\1PRIV0\2PRIV2\3PRIV3\4PRIV4\5TURBO\6CCK\7OFDM\0102GHZ\0115GHZ" \
186 "\12PASSIVE\13DYN\14GFSK\15GSM\16STURBO\17HALF\20QUARTER\21HT20" \
187 "\22HT40U\23HT40D\24DFS\0254MSXMIT\26NOADHOC\27NOHOSTAP\03011D"
188
189/*
190 * Useful combinations of channel characteristics.
191 */
192#define IEEE80211_CHAN_FHSS \
193 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK)
194#define IEEE80211_CHAN_A \
195 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
196#define IEEE80211_CHAN_B \
197 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK)
198#define IEEE80211_CHAN_PUREG \
199 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM)
200#define IEEE80211_CHAN_G \
201 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN)
202#define IEEE80211_CHAN_108A \
203 (IEEE80211_CHAN_A | IEEE80211_CHAN_TURBO)
204#define IEEE80211_CHAN_108G \
205 (IEEE80211_CHAN_PUREG | IEEE80211_CHAN_TURBO)
206#define IEEE80211_CHAN_ST \
207 (IEEE80211_CHAN_108A | IEEE80211_CHAN_STURBO)
208
209#define IEEE80211_CHAN_ALL \
210 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_GFSK | \
211 IEEE80211_CHAN_CCK | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN | \
212 IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER | \
213 IEEE80211_CHAN_HT)
214#define IEEE80211_CHAN_ALLTURBO \
215 (IEEE80211_CHAN_ALL | IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)
216
217#define IEEE80211_IS_CHAN_FHSS(_c) \
218 (((_c)->ic_flags & IEEE80211_CHAN_FHSS) == IEEE80211_CHAN_FHSS)
219#define IEEE80211_IS_CHAN_A(_c) \
220 (((_c)->ic_flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A)
221#define IEEE80211_IS_CHAN_B(_c) \
222 (((_c)->ic_flags & IEEE80211_CHAN_B) == IEEE80211_CHAN_B)
223#define IEEE80211_IS_CHAN_PUREG(_c) \
224 (((_c)->ic_flags & IEEE80211_CHAN_PUREG) == IEEE80211_CHAN_PUREG)
225#define IEEE80211_IS_CHAN_G(_c) \
226 (((_c)->ic_flags & IEEE80211_CHAN_G) == IEEE80211_CHAN_G)
227#define IEEE80211_IS_CHAN_ANYG(_c) \
228 (IEEE80211_IS_CHAN_PUREG(_c) || IEEE80211_IS_CHAN_G(_c))
229#define IEEE80211_IS_CHAN_ST(_c) \
230 (((_c)->ic_flags & IEEE80211_CHAN_ST) == IEEE80211_CHAN_ST)
231#define IEEE80211_IS_CHAN_108A(_c) \
232 (((_c)->ic_flags & IEEE80211_CHAN_108A) == IEEE80211_CHAN_108A)
233#define IEEE80211_IS_CHAN_108G(_c) \
234 (((_c)->ic_flags & IEEE80211_CHAN_108G) == IEEE80211_CHAN_108G)
235
236#define IEEE80211_IS_CHAN_2GHZ(_c) \
237 (((_c)->ic_flags & IEEE80211_CHAN_2GHZ) != 0)
238#define IEEE80211_IS_CHAN_5GHZ(_c) \
239 (((_c)->ic_flags & IEEE80211_CHAN_5GHZ) != 0)
240#define IEEE80211_IS_CHAN_PASSIVE(_c) \
241 (((_c)->ic_flags & IEEE80211_CHAN_PASSIVE) != 0)
242#define IEEE80211_IS_CHAN_OFDM(_c) \
243 (((_c)->ic_flags & (IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN)) != 0)
244#define IEEE80211_IS_CHAN_CCK(_c) \
245 (((_c)->ic_flags & (IEEE80211_CHAN_CCK | IEEE80211_CHAN_DYN)) != 0)
246#define IEEE80211_IS_CHAN_DYN(_c) \
247 (((_c)->ic_flags & IEEE80211_CHAN_DYN) == IEEE80211_CHAN_DYN)
248#define IEEE80211_IS_CHAN_GFSK(_c) \
249 (((_c)->ic_flags & IEEE80211_CHAN_GFSK) != 0)
250#define IEEE80211_IS_CHAN_TURBO(_c) \
251 (((_c)->ic_flags & IEEE80211_CHAN_TURBO) != 0)
252#define IEEE80211_IS_CHAN_STURBO(_c) \
253 (((_c)->ic_flags & IEEE80211_CHAN_STURBO) != 0)
254#define IEEE80211_IS_CHAN_DTURBO(_c) \
255 (((_c)->ic_flags & \
256 (IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)) == IEEE80211_CHAN_TURBO)
257#define IEEE80211_IS_CHAN_HALF(_c) \
258 (((_c)->ic_flags & IEEE80211_CHAN_HALF) != 0)
259#define IEEE80211_IS_CHAN_QUARTER(_c) \
260 (((_c)->ic_flags & IEEE80211_CHAN_QUARTER) != 0)
261#define IEEE80211_IS_CHAN_FULL(_c) \
262 (((_c)->ic_flags & (IEEE80211_CHAN_QUARTER | IEEE80211_CHAN_HALF)) == 0)
263#define IEEE80211_IS_CHAN_GSM(_c) \
264 (((_c)->ic_flags & IEEE80211_CHAN_GSM) != 0)
265#define IEEE80211_IS_CHAN_HT(_c) \
266 (((_c)->ic_flags & IEEE80211_CHAN_HT) != 0)
267#define IEEE80211_IS_CHAN_HT20(_c) \
268 (((_c)->ic_flags & IEEE80211_CHAN_HT20) != 0)
269#define IEEE80211_IS_CHAN_HT40(_c) \
270 (((_c)->ic_flags & IEEE80211_CHAN_HT40) != 0)
271#define IEEE80211_IS_CHAN_HT40U(_c) \
272 (((_c)->ic_flags & IEEE80211_CHAN_HT40U) != 0)
273#define IEEE80211_IS_CHAN_HT40D(_c) \
274 (((_c)->ic_flags & IEEE80211_CHAN_HT40D) != 0)
275#define IEEE80211_IS_CHAN_HTA(_c) \
276 (IEEE80211_IS_CHAN_5GHZ(_c) && \
277 ((_c)->ic_flags & IEEE80211_CHAN_HT) != 0)
278#define IEEE80211_IS_CHAN_HTG(_c) \
279 (IEEE80211_IS_CHAN_2GHZ(_c) && \
280 ((_c)->ic_flags & IEEE80211_CHAN_HT) != 0)
281#define IEEE80211_IS_CHAN_DFS(_c) \
282 (((_c)->ic_flags & IEEE80211_CHAN_DFS) != 0)
283#define IEEE80211_IS_CHAN_NOADHOC(_c) \
284 (((_c)->ic_flags & IEEE80211_CHAN_NOADHOC) != 0)
285#define IEEE80211_IS_CHAN_NOHOSTAP(_c) \
286 (((_c)->ic_flags & IEEE80211_CHAN_NOHOSTAP) != 0)
287#define IEEE80211_IS_CHAN_11D(_c) \
288 (((_c)->ic_flags & IEEE80211_CHAN_11D) != 0)
289
290#define IEEE80211_CHAN2IEEE(_c) (_c)->ic_ieee
291
292/* dynamic state */
293#define IEEE80211_CHANSTATE_RADAR 0x01 /* radar detected */
294#define IEEE80211_CHANSTATE_CACDONE 0x02 /* CAC completed */
295#define IEEE80211_CHANSTATE_CWINT 0x04 /* interference detected */
296#define IEEE80211_CHANSTATE_NORADAR 0x10 /* post notify on radar clear */
297
298#define IEEE80211_IS_CHAN_RADAR(_c) \
299 (((_c)->ic_state & IEEE80211_CHANSTATE_RADAR) != 0)
300#define IEEE80211_IS_CHAN_CACDONE(_c) \
301 (((_c)->ic_state & IEEE80211_CHANSTATE_CACDONE) != 0)
302#define IEEE80211_IS_CHAN_CWINT(_c) \
303 (((_c)->ic_state & IEEE80211_CHANSTATE_CWINT) != 0)
304
305/* ni_chan encoding for FH phy */
306#define IEEE80211_FH_CHANMOD 80
307#define IEEE80211_FH_CHAN(set,pat) (((set)-1)*IEEE80211_FH_CHANMOD+(pat))
308#define IEEE80211_FH_CHANSET(chan) ((chan)/IEEE80211_FH_CHANMOD+1)
309#define IEEE80211_FH_CHANPAT(chan) ((chan)%IEEE80211_FH_CHANMOD)
310
311#define IEEE80211_TID_SIZE (WME_NUM_TID+1) /* WME TID's +1 for non-QoS */
312#define IEEE80211_NONQOS_TID WME_NUM_TID /* index for non-QoS sta */
313
314/*
315 * The 802.11 spec says at most 2007 stations may be
316 * associated at once. For most AP's this is way more
317 * than is feasible so we use a default of 128. This
318 * number may be overridden by the driver and/or by
319 * user configuration but may not be less than IEEE80211_AID_MIN.
320 */
321#define IEEE80211_AID_DEF 128
322#define IEEE80211_AID_MIN 16
323
324/*
325 * 802.11 rate set.
326 */
327#define IEEE80211_RATE_SIZE 8 /* 802.11 standard */
328#define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */
329
330struct ieee80211_rateset {
331 uint8_t rs_nrates;
332 uint8_t rs_rates[IEEE80211_RATE_MAXSIZE];
333};
334
335/*
336 * 802.11n variant of ieee80211_rateset. Instead of
337 * legacy rates the entries are MCS rates. We define
338 * the structure such that it can be used interchangeably
339 * with an ieee80211_rateset (modulo structure size).
340 */
341#define IEEE80211_HTRATE_MAXSIZE 77
342
343struct ieee80211_htrateset {
344 uint8_t rs_nrates;
345 uint8_t rs_rates[IEEE80211_HTRATE_MAXSIZE];
346};
347
348#define IEEE80211_RATE_MCS 0x80
349
350/*
351 * Per-mode transmit parameters/controls visible to user space.
352 * These can be used to set fixed transmit rate for all operating
353 * modes or on a per-client basis according to the capabilities
354 * of the client (e.g. an 11b client associated to an 11g ap).
355 *
356 * MCS are distinguished from legacy rates by or'ing in 0x80.
357 */
358struct ieee80211_txparam {
359 uint8_t ucastrate; /* ucast data rate (legacy/MCS|0x80) */
360 uint8_t mgmtrate; /* mgmt frame rate (legacy/MCS|0x80) */
361 uint8_t mcastrate; /* multicast rate (legacy/MCS|0x80) */
362 uint8_t maxretry; /* max unicast data retry count */
363};
364
365/*
366 * Per-mode roaming state visible to user space. There are two
367 * thresholds that control whether roaming is considered; when
368 * either is exceeded the 802.11 layer will check the scan cache
369 * for another AP. If the cache is stale then a scan may be
370 * triggered.
371 */
372struct ieee80211_roamparam {
373 int8_t rssi; /* rssi thresh (.5 dBm) */
374 uint8_t rate; /* tx rate thresh (.5 Mb/s or MCS) */
375 uint16_t pad; /* reserve */
376};
377
378/*
379 * Regulatory Information.
380 */
381struct ieee80211_regdomain {
382 uint16_t regdomain; /* SKU */
383 uint16_t country; /* ISO country code */
384 uint8_t location; /* I (indoor), O (outdoor), other */
385 uint8_t ecm; /* Extended Channel Mode */
386 char isocc[2]; /* country code string */
387 short pad[2];
388};
389
390/*
391 * MIMO antenna/radio state.
392 */
393
394/*
395 * XXX This doesn't yet export both ctl/ext chain details
396 * XXX TODO: IEEE80211_MAX_CHAINS is defined in _freebsd.h, not here;
397 * figure out how to pull it in!
398 */
399struct ieee80211_mimo_info {
400 int8_t rssi[3]; /* per-antenna rssi */
401 int8_t noise[3]; /* per-antenna noise floor */
402 uint8_t pad[2];
403 uint32_t evm[3]; /* EVM data */
404};
405#endif /* _NET80211__IEEE80211_H_ */