1 |
207 |
jeremybenn |
/* $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.6 2002/04/11 05:43:10 imp Exp $ */
|
3 |
|
|
|
4 |
|
|
#ifndef _NET_IF_IEEE80211_H_
|
5 |
|
|
#define _NET_IF_IEEE80211_H_
|
6 |
|
|
|
7 |
|
|
/*
|
8 |
|
|
* generic definitions for IEEE 802.11 frames
|
9 |
|
|
*/
|
10 |
|
|
struct ieee80211_frame {
|
11 |
|
|
u_int8_t i_fc[2];
|
12 |
|
|
u_int8_t i_dur[2];
|
13 |
|
|
u_int8_t i_addr1[ETHER_ADDR_LEN];
|
14 |
|
|
u_int8_t i_addr2[ETHER_ADDR_LEN];
|
15 |
|
|
u_int8_t i_addr3[ETHER_ADDR_LEN];
|
16 |
|
|
u_int8_t i_seq[2];
|
17 |
|
|
/* possibly followed by addr4[ETHER_ADDR_LEN]; */
|
18 |
|
|
};
|
19 |
|
|
|
20 |
|
|
#define IEEE80211_FC0_VERSION_MASK 0x03
|
21 |
|
|
#define IEEE80211_FC0_VERSION_0 0x00
|
22 |
|
|
#define IEEE80211_FC0_TYPE_MASK 0x0c
|
23 |
|
|
#define IEEE80211_FC0_TYPE_MGT 0x00
|
24 |
|
|
#define IEEE80211_FC0_TYPE_CTL 0x04
|
25 |
|
|
#define IEEE80211_FC0_TYPE_DATA 0x08
|
26 |
|
|
|
27 |
|
|
#define IEEE80211_FC0_SUBTYPE_MASK 0xf0
|
28 |
|
|
/* for TYPE_MGT */
|
29 |
|
|
#define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00
|
30 |
|
|
#define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10
|
31 |
|
|
#define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20
|
32 |
|
|
#define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30
|
33 |
|
|
#define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40
|
34 |
|
|
#define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50
|
35 |
|
|
#define IEEE80211_FC0_SUBTYPE_BEACON 0x80
|
36 |
|
|
#define IEEE80211_FC0_SUBTYPE_ATIM 0x90
|
37 |
|
|
#define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0
|
38 |
|
|
#define IEEE80211_FC0_SUBTYPE_AUTH 0xb0
|
39 |
|
|
#define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0
|
40 |
|
|
/* for TYPE_CTL */
|
41 |
|
|
#define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0
|
42 |
|
|
#define IEEE80211_FC0_SUBTYPE_RTS 0xb0
|
43 |
|
|
#define IEEE80211_FC0_SUBTYPE_CTS 0xc0
|
44 |
|
|
#define IEEE80211_FC0_SUBTYPE_ACK 0xd0
|
45 |
|
|
#define IEEE80211_FC0_SUBTYPE_CF_END 0xe0
|
46 |
|
|
#define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0
|
47 |
|
|
/* for TYPE_DATA (bit combination) */
|
48 |
|
|
#define IEEE80211_FC0_SUBTYPE_DATA 0x00
|
49 |
|
|
#define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10
|
50 |
|
|
#define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20
|
51 |
|
|
#define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30
|
52 |
|
|
#define IEEE80211_FC0_SUBTYPE_NODATA 0x40
|
53 |
|
|
#define IEEE80211_FC0_SUBTYPE_CFACK 0x50
|
54 |
|
|
#define IEEE80211_FC0_SUBTYPE_CFPOLL 0x60
|
55 |
|
|
#define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK 0x70
|
56 |
|
|
|
57 |
|
|
#define IEEE80211_FC1_DIR_MASK 0x03
|
58 |
|
|
#define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */
|
59 |
|
|
#define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */
|
60 |
|
|
#define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */
|
61 |
|
|
#define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */
|
62 |
|
|
|
63 |
|
|
#define IEEE80211_FC1_MORE_FRAG 0x04
|
64 |
|
|
#define IEEE80211_FC1_RETRY 0x08
|
65 |
|
|
#define IEEE80211_FC1_PWR_MGT 0x10
|
66 |
|
|
#define IEEE80211_FC1_MORE_DATA 0x20
|
67 |
|
|
#define IEEE80211_FC1_WEP 0x40
|
68 |
|
|
#define IEEE80211_FC1_ORDER 0x80
|
69 |
|
|
|
70 |
|
|
#define IEEE80211_NWID_LEN 32
|
71 |
|
|
|
72 |
|
|
/*
|
73 |
|
|
* BEACON management packets
|
74 |
|
|
*
|
75 |
|
|
* octect timestamp[8]
|
76 |
|
|
* octect beacon interval[2]
|
77 |
|
|
* octect capability information[2]
|
78 |
|
|
* information element
|
79 |
|
|
* octect elemid
|
80 |
|
|
* octect length
|
81 |
|
|
* octect information[length[
|
82 |
|
|
*/
|
83 |
|
|
typedef u_int8_t * ieee80211_mgt_beacon_t;
|
84 |
|
|
|
85 |
|
|
#define IEEE80211_BEACON_INTERVAL(beacon) \
|
86 |
|
|
(beacon[8] + (beacon[9] << 8))
|
87 |
|
|
#define IEEE80211_BEACON_CAPABILITY(beacon) \
|
88 |
|
|
(beacon[10] + (beacon[11] << 8))
|
89 |
|
|
|
90 |
|
|
#define IEEE80211_CAPINFO_ESS 0x01
|
91 |
|
|
#define IEEE80211_CAPINFO_IBSS 0x02
|
92 |
|
|
#define IEEE80211_CAPINFO_CF_POLLABLE 0x04
|
93 |
|
|
#define IEEE80211_CAPINFO_CF_POLLREQ 0x08
|
94 |
|
|
#define IEEE80211_CAPINFO_PRIVACY 0x10
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
/*
|
98 |
|
|
* Management information elements
|
99 |
|
|
*/
|
100 |
|
|
struct ieee80211_information {
|
101 |
|
|
char ssid[IEEE80211_NWID_LEN+1];
|
102 |
|
|
struct rates {
|
103 |
|
|
u_int8_t *p;
|
104 |
|
|
} rates;
|
105 |
|
|
struct fh {
|
106 |
|
|
u_int16_t dwell;
|
107 |
|
|
u_int8_t set;
|
108 |
|
|
u_int8_t pattern;
|
109 |
|
|
u_int8_t index;
|
110 |
|
|
} fh;
|
111 |
|
|
struct ds {
|
112 |
|
|
u_int8_t channel;
|
113 |
|
|
} ds;
|
114 |
|
|
struct cf {
|
115 |
|
|
u_int8_t count;
|
116 |
|
|
u_int8_t period;
|
117 |
|
|
u_int8_t maxdur[2];
|
118 |
|
|
u_int8_t dur[2];
|
119 |
|
|
} cf;
|
120 |
|
|
struct tim {
|
121 |
|
|
u_int8_t count;
|
122 |
|
|
u_int8_t period;
|
123 |
|
|
u_int8_t bitctl;
|
124 |
|
|
/* u_int8_t pvt[251]; The driver never needs to use this */
|
125 |
|
|
} tim;
|
126 |
|
|
struct ibss {
|
127 |
|
|
u_int16_t atim;
|
128 |
|
|
} ibss;
|
129 |
|
|
struct challenge {
|
130 |
|
|
u_int8_t *p;
|
131 |
|
|
u_int8_t len;
|
132 |
|
|
} challenge;
|
133 |
|
|
};
|
134 |
|
|
|
135 |
|
|
#define IEEE80211_ELEMID_SSID 0
|
136 |
|
|
#define IEEE80211_ELEMID_RATES 1
|
137 |
|
|
#define IEEE80211_ELEMID_FHPARMS 2
|
138 |
|
|
#define IEEE80211_ELEMID_DSPARMS 3
|
139 |
|
|
#define IEEE80211_ELEMID_CFPARMS 4
|
140 |
|
|
#define IEEE80211_ELEMID_TIM 5
|
141 |
|
|
#define IEEE80211_ELEMID_IBSSPARMS 6
|
142 |
|
|
#define IEEE80211_ELEMID_CHALLENGE 16
|
143 |
|
|
|
144 |
|
|
/*
|
145 |
|
|
* AUTH management packets
|
146 |
|
|
*
|
147 |
|
|
* octect algo[2]
|
148 |
|
|
* octect seq[2]
|
149 |
|
|
* octect status[2]
|
150 |
|
|
* octect chal.id
|
151 |
|
|
* octect chal.length
|
152 |
|
|
* octect chal.text[253]
|
153 |
|
|
*/
|
154 |
|
|
typedef u_int8_t * ieee80211_mgt_auth_t;
|
155 |
|
|
|
156 |
|
|
#define IEEE80211_AUTH_ALGORITHM(auth) \
|
157 |
|
|
(auth[0] + (auth[1] << 8))
|
158 |
|
|
#define IEEE80211_AUTH_TRANSACTION(auth) \
|
159 |
|
|
(auth[2] + (auth[3] << 8))
|
160 |
|
|
#define IEEE80211_AUTH_STATUS(auth) \
|
161 |
|
|
(auth[4] + (auth[5] << 8))
|
162 |
|
|
|
163 |
|
|
#define IEEE80211_AUTH_ALG_OPEN 0x0000
|
164 |
|
|
#define IEEE80211_AUTH_ALG_SHARED 0x0001
|
165 |
|
|
|
166 |
|
|
#define IEEE80211_AUTH_OPEN_REQUEST 1
|
167 |
|
|
#define IEEE80211_AUTH_OPEN_RESPONSE 2
|
168 |
|
|
|
169 |
|
|
#define IEEE80211_AUTH_SHARED_REQUEST 1
|
170 |
|
|
#define IEEE80211_AUTH_SHARED_CHALLENGE 2
|
171 |
|
|
#define IEEE80211_AUTH_SHARED_RESPONSE 3
|
172 |
|
|
#define IEEE80211_AUTH_SHARED_PASS 4
|
173 |
|
|
|
174 |
|
|
/*
|
175 |
|
|
* Reason codes
|
176 |
|
|
*
|
177 |
|
|
* Unlisted codes are reserved
|
178 |
|
|
*/
|
179 |
|
|
#define IEEE80211_REASON_UNSPECIFIED 1
|
180 |
|
|
#define IEEE80211_REASON_AUTH_EXPIRE 2
|
181 |
|
|
#define IEEE80211_REASON_AUTH_LEAVE 3
|
182 |
|
|
#define IEEE80211_REASON_ASSOC_EXPIRE 4
|
183 |
|
|
#define IEEE80211_REASON_ASSOC_TOOMANY 5
|
184 |
|
|
#define IEEE80211_REASON_NOT_AUTHED 6
|
185 |
|
|
#define IEEE80211_REASON_NOT_ASSOCED 7
|
186 |
|
|
#define IEEE80211_REASON_ASSOC_LEAVE 8
|
187 |
|
|
#define IEEE80211_REASON_ASSOC_NOT_AUTHED 9
|
188 |
|
|
|
189 |
|
|
/*
|
190 |
|
|
* Status code
|
191 |
|
|
*
|
192 |
|
|
* Unlisted codes are reserved
|
193 |
|
|
*/
|
194 |
|
|
#define IEEE80211_STATUS_SUCCESS 0x0000
|
195 |
|
|
#define IEEE80211_STATUS_UNSPECIFIED 1
|
196 |
|
|
#define IEEE80211_STATUS_CAPINFO 10
|
197 |
|
|
#define IEEE80211_STATUS_NOT_ASSOCED 11
|
198 |
|
|
#define IEEE80211_STATUS_OTHER 12
|
199 |
|
|
#define IEEE80211_STATUS_ALG 13
|
200 |
|
|
#define IEEE80211_STATUS_SEQUENCE 14
|
201 |
|
|
#define IEEE80211_STATUS_CHALLENGE 15
|
202 |
|
|
#define IEEE80211_STATUS_TIMEOUT 16
|
203 |
|
|
#define IEEE80211_STATUS_TOO_MANY_STATIONS 17
|
204 |
|
|
#define IEEE80211_STATUS_RATES 18
|
205 |
|
|
|
206 |
|
|
#define IEEE80211_WEP_KEYLEN 5 /* 40bit */
|
207 |
|
|
#define IEEE80211_WEP_IVLEN 3 /* 24bit */
|
208 |
|
|
#define IEEE80211_WEP_KIDLEN 1 /* 1 octet */
|
209 |
|
|
#define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */
|
210 |
|
|
#define IEEE80211_WEP_NKID 4 /* number of key ids */
|
211 |
|
|
|
212 |
|
|
/* nwid is pointed at by ifr.ifr_data */
|
213 |
|
|
struct ieee80211_nwid {
|
214 |
|
|
u_int8_t i_len;
|
215 |
|
|
u_int8_t i_nwid[IEEE80211_NWID_LEN];
|
216 |
|
|
};
|
217 |
|
|
|
218 |
|
|
#define SIOCS80211NWID _IOWR('i', 230, struct ifreq)
|
219 |
|
|
#define SIOCG80211NWID _IOWR('i', 231, struct ifreq)
|
220 |
|
|
|
221 |
|
|
/* the first member must be matched with struct ifreq */
|
222 |
|
|
struct ieee80211_nwkey {
|
223 |
|
|
char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
|
224 |
|
|
int i_wepon; /* wep enabled flag */
|
225 |
|
|
int i_defkid; /* default encrypt key id */
|
226 |
|
|
struct {
|
227 |
|
|
int i_keylen;
|
228 |
|
|
u_int8_t *i_keydat;
|
229 |
|
|
} i_key[IEEE80211_WEP_NKID];
|
230 |
|
|
};
|
231 |
|
|
#define SIOCS80211NWKEY _IOW('i', 232, struct ieee80211_nwkey)
|
232 |
|
|
#define SIOCG80211NWKEY _IOWR('i', 233, struct ieee80211_nwkey)
|
233 |
|
|
|
234 |
|
|
#define IEEE80211_WEP_NOSUP -1
|
235 |
|
|
#define IEEE80211_WEP_OFF 0
|
236 |
|
|
#define IEEE80211_WEP_ON 1
|
237 |
|
|
#define IEEE80211_WEP_MIXED 2
|
238 |
|
|
|
239 |
|
|
#define IEEE80211_AUTH_NONE 0
|
240 |
|
|
#define IEEE80211_AUTH_OPEN 1
|
241 |
|
|
#define IEEE80211_AUTH_SHARED 2
|
242 |
|
|
|
243 |
|
|
#define IEEE80211_POWERSAVE_NOSUP -1
|
244 |
|
|
#define IEEE80211_POWERSAVE_OFF 0
|
245 |
|
|
#define IEEE80211_POWERSAVE_CAM 1
|
246 |
|
|
#define IEEE80211_POWERSAVE_PSP 2
|
247 |
|
|
#define IEEE80211_POWERSAVE_PSP_CAM 3
|
248 |
|
|
#define IEEE80211_POWERSAVE_ON IEEE80211_POWERSAVE_CAM
|
249 |
|
|
|
250 |
|
|
/* the first member must be matched with struct ifreq */
|
251 |
|
|
struct ieee80211req {
|
252 |
|
|
char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
|
253 |
|
|
u_int16_t i_type; /* req type */
|
254 |
|
|
int16_t i_val; /* Index or simple value */
|
255 |
|
|
int16_t i_len; /* Index or simple value */
|
256 |
|
|
void *i_data; /* Extra data */
|
257 |
|
|
};
|
258 |
|
|
#define SIOCS80211 _IOW('i', 234, struct ieee80211req)
|
259 |
|
|
#define SIOCG80211 _IOWR('i', 235, struct ieee80211req)
|
260 |
|
|
|
261 |
|
|
#define IEEE80211_IOC_SSID 1
|
262 |
|
|
#define IEEE80211_IOC_NUMSSIDS 2
|
263 |
|
|
#define IEEE80211_IOC_WEP 3
|
264 |
|
|
#define IEEE80211_IOC_WEPKEY 4
|
265 |
|
|
#define IEEE80211_IOC_NUMWEPKEYS 5
|
266 |
|
|
#define IEEE80211_IOC_WEPTXKEY 6
|
267 |
|
|
#define IEEE80211_IOC_AUTHMODE 7
|
268 |
|
|
#define IEEE80211_IOC_STATIONNAME 8
|
269 |
|
|
#define IEEE80211_IOC_CHANNEL 9
|
270 |
|
|
#define IEEE80211_IOC_POWERSAVE 10
|
271 |
|
|
#define IEEE80211_IOC_POWERSAVESLEEP 11
|
272 |
|
|
|
273 |
|
|
#endif /* !_NET_IF_IEEE80211_H_ */
|