1 /*-
2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002-2005 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 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * Alternatively, this software may be distributed under the terms of the
18 * GNU General Public License ("GPL") version 2 as published by the Free
19 * Software Foundation.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 * $FreeBSD: src/sys/net80211/_ieee80211.h,v 1.3 2005/08/10 17:42:13 sam Exp $
33 */
34 #ifndef _NET80211__IEEE80211_H_
35 #define _NET80211__IEEE80211_H_
36
37 enum ieee80211_phytype {
38 IEEE80211_T_DS, /* direct sequence spread spectrum */
39 IEEE80211_T_FH, /* frequency hopping */
40 IEEE80211_T_OFDM, /* frequency division multiplexing */
41 IEEE80211_T_TURBO /* high rate OFDM, aka turbo mode */
42 };
43 #define IEEE80211_T_CCK IEEE80211_T_DS /* more common nomenclature */
44
45 /* XXX not really a mode; there are really multiple PHY's */
46 enum ieee80211_phymode {
47 IEEE80211_MODE_AUTO = 0, /* autoselect */
48 IEEE80211_MODE_11A = 1, /* 5GHz, OFDM */
49 IEEE80211_MODE_11B = 2, /* 2GHz, CCK */
50 IEEE80211_MODE_11G = 3, /* 2GHz, OFDM */
51 IEEE80211_MODE_FH = 4, /* 2GHz, GFSK */
52 IEEE80211_MODE_TURBO_A = 5, /* 5GHz, OFDM, 2x clock */
53 IEEE80211_MODE_TURBO_G = 6 /* 2GHz, OFDM, 2x clock */
54 };
55 #define IEEE80211_MODE_MAX ((int)IEEE80211_MODE_TURBO_G + 1)
56
57 enum ieee80211_opmode {
58 IEEE80211_M_STA = 1, /* infrastructure station */
59 IEEE80211_M_IBSS = 0, /* IBSS (adhoc) station */
60 IEEE80211_M_AHDEMO = 3, /* Old lucent compatible adhoc demo */
61 IEEE80211_M_HOSTAP = 6, /* Software Access Point */
62 IEEE80211_M_MONITOR = 8 /* Monitor mode */
63 };
64
65 /*
66 * 802.11g protection mode.
67 */
68 enum ieee80211_protmode {
69 IEEE80211_PROT_NONE = 0, /* no protection */
70 IEEE80211_PROT_CTSONLY = 1, /* CTS to self */
71 IEEE80211_PROT_RTSCTS = 2 /* RTS-CTS */
72 };
73
74 /*
75 * Authentication mode.
76 */
77 enum ieee80211_authmode {
78 IEEE80211_AUTH_NONE = 0,
79 IEEE80211_AUTH_OPEN = 1, /* open */
80 IEEE80211_AUTH_SHARED = 2, /* shared-key */
81 IEEE80211_AUTH_8021X = 3, /* 802.1x */
82 IEEE80211_AUTH_AUTO = 4, /* auto-select/accept */
83 /* NB: these are used only for ioctls */
84 IEEE80211_AUTH_WPA = 5 /* WPA/RSN w/ 802.1x/PSK */
85 };
86
87 /*
88 * Roaming mode is effectively who controls the operation
89 * of the 802.11 state machine when operating as a station.
90 * State transitions are controlled either by the driver
91 * (typically when management frames are processed by the
92 * hardware/firmware), the host (auto/normal operation of
93 * the 802.11 layer), or explicitly through ioctl requests
94 * when applications like wpa_supplicant want control.
95 */
96 enum ieee80211_roamingmode {
97 IEEE80211_ROAMING_DEVICE= 0, /* driver/hardware control */
98 IEEE80211_ROAMING_AUTO = 1, /* 802.11 layer control */
99 IEEE80211_ROAMING_MANUAL= 2 /* application control */
100 };
101
102 /*
103 * Channels are specified by frequency and attributes.
104 */
105 struct ieee80211_channel {
106 u_int16_t ic_freq; /* setting in MHz */
107 u_int16_t ic_flags; /* see below */
108 };
109
110 extern const struct ieee80211_channel ieee80211_channel_anyc;
111
112 #define IEEE80211_CHAN_MAX 255
113 #define IEEE80211_CHAN_BYTES 32 /* howmany(IEEE80211_CHAN_MAX, NBBY) */
114 #define IEEE80211_CHAN_ANY 0xffff /* token for ``any channel'' */
115 #define IEEE80211_CHAN_ANYC (__UNCONST(&ieee80211_channel_anyc))
116
117 /* bits 0-3 are for private use by drivers */
118 /* channel attributes */
119 #define IEEE80211_CHAN_TURBO 0x00000010 /* Turbo channel */
120 #define IEEE80211_CHAN_CCK 0x00000020 /* CCK channel */
121 #define IEEE80211_CHAN_OFDM 0x00000040 /* OFDM channel */
122 #define IEEE80211_CHAN_2GHZ 0x00000080 /* 2 GHz spectrum channel. */
123 #define IEEE80211_CHAN_5GHZ 0x00000100 /* 5 GHz spectrum channel */
124 #define IEEE80211_CHAN_PASSIVE 0x00000200 /* Only passive scan allowed */
125 #define IEEE80211_CHAN_DYN 0x00000400 /* Dynamic CCK-OFDM channel */
126 #define IEEE80211_CHAN_GFSK 0x00000800 /* GFSK channel (FHSS PHY) */
127 #define IEEE80211_CHAN_GSM 0x00001000 /* 900 MHz spectrum channel */
128 #define IEEE80211_CHAN_HALF 0x00004000 /* Half rate channel */
129 #define IEEE80211_CHAN_QUARTER 0x00008000 /* Quarter rate channel */
130 #define IEEE80211_CHAN_HT20 0x00010000 /* HT 20 channel */
131 #define IEEE80211_CHAN_HT40U 0x00020000 /* HT 40 channel w/ ext above */
132 #define IEEE80211_CHAN_HT40D 0x00040000 /* HT 40 channel w/ ext below */
133 #define IEEE80211_CHAN_DFS 0x00080000 /* DFS required */
134 #define IEEE80211_CHAN_4MSXMIT 0x00100000 /* 4ms limit on frame length */
135 #define IEEE80211_CHAN_NOADHOC 0x00200000 /* adhoc mode not allowed */
136 #define IEEE80211_CHAN_NOHOSTAP 0x00400000 /* hostap mode not allowed */
137 #define IEEE80211_CHAN_11D 0x00800000 /* 802.11d required */
138 #define IEEE80211_CHAN_VHT20 0x01000000 /* VHT20 channel */
139 #define IEEE80211_CHAN_VHT40U 0x02000000 /* VHT40 channel, ext above */
140 #define IEEE80211_CHAN_VHT40D 0x04000000 /* VHT40 channel, ext below */
141 #define IEEE80211_CHAN_VHT80 0x08000000 /* VHT80 channel */
142 #define IEEE80211_CHAN_VHT80_80 0x10000000 /* VHT80+80 channel */
143 #define IEEE80211_CHAN_VHT160 0x20000000 /* VHT160 channel */
144 #define IEEE80211_CHAN_HT20 0x00010000 /* HT 20 channel */
145 #define IEEE80211_CHAN_HT40U 0x00020000 /* HT 40 channel w/ ext above */
146 #define IEEE80211_CHAN_HT40D 0x00040000 /* HT 40 channel w/ ext below */
147 #define IEEE80211_CHAN_DFS 0x00080000 /* DFS required */
148 #define IEEE80211_CHAN_4MSXMIT 0x00100000 /* 4ms limit on frame length */
149 #define IEEE80211_CHAN_NOADHOC 0x00200000 /* adhoc mode not allowed */
150 #define IEEE80211_CHAN_NOHOSTAP 0x00400000 /* hostap mode not allowed */
151 #define IEEE80211_CHAN_11D 0x00800000 /* 802.11d required */
152
153 #define IEEE80211_CHAN_HT40 (IEEE80211_CHAN_HT40U | IEEE80211_CHAN_HT40D)
154 #define IEEE80211_CHAN_HT (IEEE80211_CHAN_HT20 | IEEE80211_CHAN_HT40)
155
156 #define IEEE80211_CHAN_VHT40 (IEEE80211_CHAN_VHT40U | IEEE80211_CHAN_VHT40D)
157 #define IEEE80211_CHAN_VHT (IEEE80211_CHAN_VHT20 | IEEE80211_CHAN_VHT40 \
158 | IEEE80211_CHAN_VHT80 | IEEE80211_CHAN_VHT80_80 \
159 | IEEE80211_CHAN_VHT160)
160
161 /*
162 * Useful combinations of channel characteristics.
163 */
164 #define IEEE80211_CHAN_FHSS \
165 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK)
166 #define IEEE80211_CHAN_A \
167 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
168 #define IEEE80211_CHAN_B \
169 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK)
170 #define IEEE80211_CHAN_PUREG \
171 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM)
172 #define IEEE80211_CHAN_G \
173 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN)
174 #define IEEE80211_CHAN_T \
175 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
176 #define IEEE80211_CHAN_108G \
177 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
178
179 #define IEEE80211_CHAN_ALL \
180 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_GFSK | \
181 IEEE80211_CHAN_CCK | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN)
182 #define IEEE80211_CHAN_ALLTURBO \
183 (IEEE80211_CHAN_ALL | IEEE80211_CHAN_TURBO)
184
185 #define IEEE80211_IS_CHAN_ANYC(_c) \
186 ((_c) == IEEE80211_CHAN_ANYC)
187
188 #define _IEEE80211_IS_CHAN(_c, _ch) \
189 (((_c)->ic_flags & IEEE80211_CHAN_ ## _ch) == IEEE80211_CHAN_ ## _ch)
190
191 #define IEEE80211_IS_CHAN_FHSS(_c) _IEEE80211_IS_CHAN(_c, FHSS)
192 #define IEEE80211_IS_CHAN_A(_c) _IEEE80211_IS_CHAN(_c, A)
193 #define IEEE80211_IS_CHAN_B(_c) _IEEE80211_IS_CHAN(_c, B)
194 #define IEEE80211_IS_CHAN_PUREG(_c) _IEEE80211_IS_CHAN(_c, PUREG)
195 #define IEEE80211_IS_CHAN_G(_c) _IEEE80211_IS_CHAN(_c, G)
196 #define IEEE80211_IS_CHAN_ANYG(_c) _IEEE80211_IS_CHAN(_c, ANYG)
197 #define IEEE80211_IS_CHAN_T(_c) _IEEE80211_IS_CHAN(_c, T)
198 #define IEEE80211_IS_CHAN_108G(_c) _IEEE80211_IS_CHAN(_c, 108G)
199
200 #define IEEE80211_IS_CHAN_2GHZ(_c) _IEEE80211_IS_CHAN(_c, 2GHZ)
201 #define IEEE80211_IS_CHAN_5GHZ(_c) _IEEE80211_IS_CHAN(_c, 5GHZ)
202 #define IEEE80211_IS_CHAN_OFDM(_c) _IEEE80211_IS_CHAN(_c, OFDM)
203 #define IEEE80211_IS_CHAN_CCK(_c) _IEEE80211_IS_CHAN(_c, CCK)
204 #define IEEE80211_IS_CHAN_GFSK(_c) _IEEE80211_IS_CHAN(_c, GFSK)
205 #define IEEE80211_IS_CHAN_HALF(_c) _IEEE80211_IS_CHAN(_c, HALF)
206 #define IEEE80211_IS_CHAN_QUARTER(_c) _IEEE80211_IS_CHAN(_c, QUARTER)
207 #define IEEE80211_IS_CHAN_FULL(_c) \
208 (!IEEE80211_IS_CHAN_ANYC(_c) && \
209 ((_c)->ic_flags & (IEEE80211_CHAN_QUARTER | IEEE80211_CHAN_HALF)) == 0)
210
211 #define IEEE80211_IS_CHAN_GSM(_c) _IEEE80211_IS_CHAN(_c, GSM)
212 #define IEEE80211_IS_CHAN_PASSIVE(_c) _IEEE80211_IS_CHAN(_c, PASSIVE)
213
214
215 /* ni_chan encoding for FH phy */
216 #define IEEE80211_FH_CHANMOD 80
217 #define IEEE80211_FH_CHAN(set,pat) (((set)-1)*IEEE80211_FH_CHANMOD+(pat))
218 #define IEEE80211_FH_CHANSET(chan) ((chan)/IEEE80211_FH_CHANMOD+1)
219 #define IEEE80211_FH_CHANPAT(chan) ((chan)%IEEE80211_FH_CHANMOD)
220
221 /*
222 * 802.11 rate set.
223 */
224 #define IEEE80211_RATE_SIZE 8 /* 802.11 standard */
225 #define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */
226
227 struct ieee80211_rateset {
228 u_int8_t rs_nrates;
229 u_int8_t rs_rates[IEEE80211_RATE_MAXSIZE];
230 };
231
232 extern const struct ieee80211_rateset ieee80211_std_rateset_11a;
233 extern const struct ieee80211_rateset ieee80211_std_rateset_11b;
234 extern const struct ieee80211_rateset ieee80211_std_rateset_11g;
235
236 #endif /* !_NET80211__IEEE80211_H_ */
Cache object: 3306dc95b615da6450022bf908c1a4c1
|