1 /* $NetBSD: if_ieee80211.h,v 1.5 2000/07/21 04:47:40 onoe Exp $ */
2 /* $FreeBSD: src/sys/net/if_ieee80211.h,v 1.3.2.5 2002/08/03 07:17:09 imp Exp $ */
3 /* $DragonFly: src/sys/net/Attic/if_ieee80211.h,v 1.2 2003/06/17 04:28:48 dillon Exp $ */
5 #ifndef _NET_IF_IEEE80211_H_
6 #define _NET_IF_IEEE80211_H_
9 * generic definitions for IEEE 802.11 frames
11 struct ieee80211_frame {
14 u_int8_t i_addr1[ETHER_ADDR_LEN];
15 u_int8_t i_addr2[ETHER_ADDR_LEN];
16 u_int8_t i_addr3[ETHER_ADDR_LEN];
18 /* possibly followed by addr4[ETHER_ADDR_LEN]; */
21 #define IEEE80211_FC0_VERSION_MASK 0x03
22 #define IEEE80211_FC0_VERSION_0 0x00
23 #define IEEE80211_FC0_TYPE_MASK 0x0c
24 #define IEEE80211_FC0_TYPE_MGT 0x00
25 #define IEEE80211_FC0_TYPE_CTL 0x04
26 #define IEEE80211_FC0_TYPE_DATA 0x08
28 #define IEEE80211_FC0_SUBTYPE_MASK 0xf0
30 #define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00
31 #define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10
32 #define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20
33 #define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30
34 #define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40
35 #define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50
36 #define IEEE80211_FC0_SUBTYPE_BEACON 0x80
37 #define IEEE80211_FC0_SUBTYPE_ATIM 0x90
38 #define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0
39 #define IEEE80211_FC0_SUBTYPE_AUTH 0xb0
40 #define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0
42 #define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0
43 #define IEEE80211_FC0_SUBTYPE_RTS 0xb0
44 #define IEEE80211_FC0_SUBTYPE_CTS 0xc0
45 #define IEEE80211_FC0_SUBTYPE_ACK 0xd0
46 #define IEEE80211_FC0_SUBTYPE_CF_END 0xe0
47 #define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0
48 /* for TYPE_DATA (bit combination) */
49 #define IEEE80211_FC0_SUBTYPE_DATA 0x00
50 #define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10
51 #define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20
52 #define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30
53 #define IEEE80211_FC0_SUBTYPE_NODATA 0x40
54 #define IEEE80211_FC0_SUBTYPE_CFACK 0x50
55 #define IEEE80211_FC0_SUBTYPE_CFPOLL 0x60
56 #define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK 0x70
58 #define IEEE80211_FC1_DIR_MASK 0x03
59 #define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */
60 #define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */
61 #define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */
62 #define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */
64 #define IEEE80211_FC1_MORE_FRAG 0x04
65 #define IEEE80211_FC1_RETRY 0x08
66 #define IEEE80211_FC1_PWR_MGT 0x10
67 #define IEEE80211_FC1_MORE_DATA 0x20
68 #define IEEE80211_FC1_WEP 0x40
69 #define IEEE80211_FC1_ORDER 0x80
71 #define IEEE80211_NWID_LEN 32
74 * BEACON management packets
77 * octect beacon interval[2]
78 * octect capability information[2]
82 * octect information[length[
84 typedef u_int8_t * ieee80211_mgt_beacon_t;
86 #define IEEE80211_BEACON_INTERVAL(beacon) \
87 (beacon[8] + (beacon[9] << 8))
88 #define IEEE80211_BEACON_CAPABILITY(beacon) \
89 (beacon[10] + (beacon[11] << 8))
91 #define IEEE80211_CAPINFO_ESS 0x01
92 #define IEEE80211_CAPINFO_IBSS 0x02
93 #define IEEE80211_CAPINFO_CF_POLLABLE 0x04
94 #define IEEE80211_CAPINFO_CF_POLLREQ 0x08
95 #define IEEE80211_CAPINFO_PRIVACY 0x10
96 #define IEEE80211_CAPINFO_BITS "\20\01ESS\02IBSS\03POLLABLE\04POLLREQ\5PRIVACY"
99 * Management information elements
101 struct ieee80211_information {
102 char ssid[IEEE80211_NWID_LEN+1];
125 /* u_int8_t pvt[251]; The driver never needs to use this */
136 #define IEEE80211_ELEMID_SSID 0
137 #define IEEE80211_ELEMID_RATES 1
138 #define IEEE80211_ELEMID_FHPARMS 2
139 #define IEEE80211_ELEMID_DSPARMS 3
140 #define IEEE80211_ELEMID_CFPARMS 4
141 #define IEEE80211_ELEMID_TIM 5
142 #define IEEE80211_ELEMID_IBSSPARMS 6
143 #define IEEE80211_ELEMID_CHALLENGE 16
146 * AUTH management packets
153 * octect chal.text[253]
155 typedef u_int8_t * ieee80211_mgt_auth_t;
157 #define IEEE80211_AUTH_ALGORITHM(auth) \
158 (auth[0] + (auth[1] << 8))
159 #define IEEE80211_AUTH_TRANSACTION(auth) \
160 (auth[2] + (auth[3] << 8))
161 #define IEEE80211_AUTH_STATUS(auth) \
162 (auth[4] + (auth[5] << 8))
164 #define IEEE80211_AUTH_ALG_OPEN 0x0000
165 #define IEEE80211_AUTH_ALG_SHARED 0x0001
167 #define IEEE80211_AUTH_OPEN_REQUEST 1
168 #define IEEE80211_AUTH_OPEN_RESPONSE 2
170 #define IEEE80211_AUTH_SHARED_REQUEST 1
171 #define IEEE80211_AUTH_SHARED_CHALLENGE 2
172 #define IEEE80211_AUTH_SHARED_RESPONSE 3
173 #define IEEE80211_AUTH_SHARED_PASS 4
178 * Unlisted codes are reserved
180 #define IEEE80211_REASON_UNSPECIFIED 1
181 #define IEEE80211_REASON_AUTH_EXPIRE 2
182 #define IEEE80211_REASON_AUTH_LEAVE 3
183 #define IEEE80211_REASON_ASSOC_EXPIRE 4
184 #define IEEE80211_REASON_ASSOC_TOOMANY 5
185 #define IEEE80211_REASON_NOT_AUTHED 6
186 #define IEEE80211_REASON_NOT_ASSOCED 7
187 #define IEEE80211_REASON_ASSOC_LEAVE 8
188 #define IEEE80211_REASON_ASSOC_NOT_AUTHED 9
193 * Unlisted codes are reserved
195 #define IEEE80211_STATUS_SUCCESS 0x0000
196 #define IEEE80211_STATUS_UNSPECIFIED 1
197 #define IEEE80211_STATUS_CAPINFO 10
198 #define IEEE80211_STATUS_NOT_ASSOCED 11
199 #define IEEE80211_STATUS_OTHER 12
200 #define IEEE80211_STATUS_ALG 13
201 #define IEEE80211_STATUS_SEQUENCE 14
202 #define IEEE80211_STATUS_CHALLENGE 15
203 #define IEEE80211_STATUS_TIMEOUT 16
204 #define IEEE80211_STATUS_TOO_MANY_STATIONS 17
205 #define IEEE80211_STATUS_RATES 18
207 #define IEEE80211_WEP_KEYLEN 5 /* 40bit */
208 #define IEEE80211_WEP_IVLEN 3 /* 24bit */
209 #define IEEE80211_WEP_KIDLEN 1 /* 1 octet */
210 #define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */
211 #define IEEE80211_WEP_NKID 4 /* number of key ids */
213 /* nwid is pointed at by ifr.ifr_data */
214 struct ieee80211_nwid {
216 u_int8_t i_nwid[IEEE80211_NWID_LEN];
219 #define SIOCS80211NWID _IOWR('i', 230, struct ifreq)
220 #define SIOCG80211NWID _IOWR('i', 231, struct ifreq)
222 /* the first member must be matched with struct ifreq */
223 struct ieee80211_nwkey {
224 char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
225 int i_wepon; /* wep enabled flag */
226 int i_defkid; /* default encrypt key id */
230 } i_key[IEEE80211_WEP_NKID];
232 #define SIOCS80211NWKEY _IOW('i', 232, struct ieee80211_nwkey)
233 #define SIOCG80211NWKEY _IOWR('i', 233, struct ieee80211_nwkey)
235 #define IEEE80211_WEP_NOSUP -1
236 #define IEEE80211_WEP_OFF 0
237 #define IEEE80211_WEP_ON 1
238 #define IEEE80211_WEP_MIXED 2
240 #define IEEE80211_AUTH_NONE 0
241 #define IEEE80211_AUTH_OPEN 1
242 #define IEEE80211_AUTH_SHARED 2
244 #define IEEE80211_POWERSAVE_NOSUP -1
245 #define IEEE80211_POWERSAVE_OFF 0
246 #define IEEE80211_POWERSAVE_CAM 1
247 #define IEEE80211_POWERSAVE_PSP 2
248 #define IEEE80211_POWERSAVE_PSP_CAM 3
249 #define IEEE80211_POWERSAVE_ON IEEE80211_POWERSAVE_CAM
251 /* the first member must be matched with struct ifreq */
252 struct ieee80211req {
253 char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
254 u_int16_t i_type; /* req type */
255 int16_t i_val; /* Index or simple value */
256 int16_t i_len; /* Index or simple value */
257 void *i_data; /* Extra data */
259 #define SIOCS80211 _IOW('i', 234, struct ieee80211req)
260 #define SIOCG80211 _IOWR('i', 235, struct ieee80211req)
262 #define IEEE80211_IOC_SSID 1
263 #define IEEE80211_IOC_NUMSSIDS 2
264 #define IEEE80211_IOC_WEP 3
265 #define IEEE80211_IOC_WEPKEY 4
266 #define IEEE80211_IOC_NUMWEPKEYS 5
267 #define IEEE80211_IOC_WEPTXKEY 6
268 #define IEEE80211_IOC_AUTHMODE 7
269 #define IEEE80211_IOC_STATIONNAME 8
270 #define IEEE80211_IOC_CHANNEL 9
271 #define IEEE80211_IOC_POWERSAVE 10
272 #define IEEE80211_IOC_POWERSAVESLEEP 11
274 #endif /* !_NET_IF_IEEE80211_H_ */