1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101 #ifndef _P80211MGMT_H
102 #define _P80211MGMT_H
103
104 #ifndef _P80211HDR_H
105 #include "p80211hdr.h"
106 #endif
107
108
109 #define WLAN_EID_SSID 0
110 #define WLAN_EID_SUPP_RATES 1
111 #define WLAN_EID_FH_PARMS 2
112 #define WLAN_EID_DS_PARMS 3
113 #define WLAN_EID_CF_PARMS 4
114 #define WLAN_EID_TIM 5
115 #define WLAN_EID_IBSS_PARMS 6
116
117 #define WLAN_EID_CHALLENGE 16
118
119
120
121
122 #define WLAN_MGMT_REASON_RSVD 0
123 #define WLAN_MGMT_REASON_UNSPEC 1
124 #define WLAN_MGMT_REASON_PRIOR_AUTH_INVALID 2
125 #define WLAN_MGMT_REASON_DEAUTH_LEAVING 3
126 #define WLAN_MGMT_REASON_DISASSOC_INACTIVE 4
127 #define WLAN_MGMT_REASON_DISASSOC_AP_BUSY 5
128 #define WLAN_MGMT_REASON_CLASS2_NONAUTH 6
129 #define WLAN_MGMT_REASON_CLASS3_NONASSOC 7
130 #define WLAN_MGMT_REASON_DISASSOC_STA_HASLEFT 8
131 #define WLAN_MGMT_REASON_CANT_ASSOC_NONAUTH 9
132
133
134 #define WLAN_MGMT_STATUS_SUCCESS 0
135 #define WLAN_MGMT_STATUS_UNSPEC_FAILURE 1
136 #define WLAN_MGMT_STATUS_CAPS_UNSUPPORTED 10
137 #define WLAN_MGMT_STATUS_REASSOC_NO_ASSOC 11
138 #define WLAN_MGMT_STATUS_ASSOC_DENIED_UNSPEC 12
139 #define WLAN_MGMT_STATUS_UNSUPPORTED_AUTHALG 13
140 #define WLAN_MGMT_STATUS_RX_AUTH_NOSEQ 14
141 #define WLAN_MGMT_STATUS_CHALLENGE_FAIL 15
142 #define WLAN_MGMT_STATUS_AUTH_TIMEOUT 16
143 #define WLAN_MGMT_STATUS_ASSOC_DENIED_BUSY 17
144 #define WLAN_MGMT_STATUS_ASSOC_DENIED_RATES 18
145
146 #define WLAN_MGMT_STATUS_ASSOC_DENIED_NOSHORT 19
147 #define WLAN_MGMT_STATUS_ASSOC_DENIED_NOPBCC 20
148 #define WLAN_MGMT_STATUS_ASSOC_DENIED_NOAGILITY 21
149
150
151 #define WLAN_AUTH_ALG_OPENSYSTEM 0
152 #define WLAN_AUTH_ALG_SHAREDKEY 1
153
154
155
156
157
158
159 #define WLAN_BEACON_OFF_TS 0
160 #define WLAN_BEACON_OFF_BCN_int 8
161 #define WLAN_BEACON_OFF_CAPINFO 10
162 #define WLAN_BEACON_OFF_SSID 12
163
164 #define WLAN_DISASSOC_OFF_REASON 0
165
166 #define WLAN_ASSOCREQ_OFF_CAP_INFO 0
167 #define WLAN_ASSOCREQ_OFF_LISTEN_int 2
168 #define WLAN_ASSOCREQ_OFF_SSID 4
169
170 #define WLAN_ASSOCRESP_OFF_CAP_INFO 0
171 #define WLAN_ASSOCRESP_OFF_STATUS 2
172 #define WLAN_ASSOCRESP_OFF_AID 4
173 #define WLAN_ASSOCRESP_OFF_SUPP_RATES 6
174
175 #define WLAN_REASSOCREQ_OFF_CAP_INFO 0
176 #define WLAN_REASSOCREQ_OFF_LISTEN_int 2
177 #define WLAN_REASSOCREQ_OFF_CURR_AP 4
178 #define WLAN_REASSOCREQ_OFF_SSID 10
179
180 #define WLAN_REASSOCRESP_OFF_CAP_INFO 0
181 #define WLAN_REASSOCRESP_OFF_STATUS 2
182 #define WLAN_REASSOCRESP_OFF_AID 4
183 #define WLAN_REASSOCRESP_OFF_SUPP_RATES 6
184
185 #define WLAN_PROBEREQ_OFF_SSID 0
186
187 #define WLAN_PROBERESP_OFF_TS 0
188 #define WLAN_PROBERESP_OFF_BCN_int 8
189 #define WLAN_PROBERESP_OFF_CAP_INFO 10
190 #define WLAN_PROBERESP_OFF_SSID 12
191
192 #define WLAN_AUTHEN_OFF_AUTH_ALG 0
193 #define WLAN_AUTHEN_OFF_AUTH_SEQ 2
194 #define WLAN_AUTHEN_OFF_STATUS 4
195 #define WLAN_AUTHEN_OFF_CHALLENGE 6
196
197 #define WLAN_DEAUTHEN_OFF_REASON 0
198
199
200 #define WLAN_GET_MGMT_CAP_INFO_ESS(n) ((n) & BIT(0))
201 #define WLAN_GET_MGMT_CAP_INFO_IBSS(n) (((n) & BIT(1)) >> 1)
202 #define WLAN_GET_MGMT_CAP_INFO_CFPOLLABLE(n) (((n) & BIT(2)) >> 2)
203 #define WLAN_GET_MGMT_CAP_INFO_CFPOLLREQ(n) (((n) & BIT(3)) >> 3)
204 #define WLAN_GET_MGMT_CAP_INFO_PRIVACY(n) (((n) & BIT(4)) >> 4)
205
206 #define WLAN_GET_MGMT_CAP_INFO_SHORT(n) (((n) & BIT(5)) >> 5)
207 #define WLAN_GET_MGMT_CAP_INFO_PBCC(n) (((n) & BIT(6)) >> 6)
208 #define WLAN_GET_MGMT_CAP_INFO_AGILITY(n) (((n) & BIT(7)) >> 7)
209
210 #define WLAN_SET_MGMT_CAP_INFO_ESS(n) (n)
211 #define WLAN_SET_MGMT_CAP_INFO_IBSS(n) ((n) << 1)
212 #define WLAN_SET_MGMT_CAP_INFO_CFPOLLABLE(n) ((n) << 2)
213 #define WLAN_SET_MGMT_CAP_INFO_CFPOLLREQ(n) ((n) << 3)
214 #define WLAN_SET_MGMT_CAP_INFO_PRIVACY(n) ((n) << 4)
215
216 #define WLAN_SET_MGMT_CAP_INFO_SHORT(n) ((n) << 5)
217 #define WLAN_SET_MGMT_CAP_INFO_PBCC(n) ((n) << 6)
218 #define WLAN_SET_MGMT_CAP_INFO_AGILITY(n) ((n) << 7)
219
220
221
222
223 struct wlan_ie {
224 u8 eid;
225 u8 len;
226 } __packed;
227
228
229 struct wlan_ie_ssid {
230 u8 eid;
231 u8 len;
232 u8 ssid[1];
233 } __packed;
234
235
236 struct wlan_ie_supp_rates {
237 u8 eid;
238 u8 len;
239 u8 rates[1];
240 } __packed;
241
242
243 struct wlan_ie_fh_parms {
244 u8 eid;
245 u8 len;
246 u16 dwell;
247 u8 hopset;
248 u8 hoppattern;
249 u8 hopindex;
250 } __packed;
251
252
253 struct wlan_ie_ds_parms {
254 u8 eid;
255 u8 len;
256 u8 curr_ch;
257 } __packed;
258
259
260
261 struct wlan_ie_cf_parms {
262 u8 eid;
263 u8 len;
264 u8 cfp_cnt;
265 u8 cfp_period;
266 u16 cfp_maxdur;
267 u16 cfp_durremaining;
268 } __packed;
269
270
271 struct wlan_ie_tim {
272 u8 eid;
273 u8 len;
274 u8 dtim_cnt;
275 u8 dtim_period;
276 u8 bitmap_ctl;
277 u8 virt_bm[1];
278 } __packed;
279
280
281 struct wlan_ie_ibss_parms {
282 u8 eid;
283 u8 len;
284 u16 atim_win;
285 } __packed;
286
287
288 struct wlan_ie_challenge {
289 u8 eid;
290 u8 len;
291 u8 challenge[1];
292 } __packed;
293
294
295
296
297
298 struct wlan_fr_mgmt {
299 u16 type;
300 u16 len;
301 u8 *buf;
302 union p80211_hdr *hdr;
303
304 void *priv;
305
306
307 };
308
309
310 struct wlan_fr_beacon {
311 u16 type;
312 u16 len;
313 u8 *buf;
314 union p80211_hdr *hdr;
315
316 void *priv;
317
318 u64 *ts;
319 u16 *bcn_int;
320 u16 *cap_info;
321
322 struct wlan_ie_ssid *ssid;
323 struct wlan_ie_supp_rates *supp_rates;
324 struct wlan_ie_fh_parms *fh_parms;
325 struct wlan_ie_ds_parms *ds_parms;
326 struct wlan_ie_cf_parms *cf_parms;
327 struct wlan_ie_ibss_parms *ibss_parms;
328 struct wlan_ie_tim *tim;
329
330 };
331
332
333 struct wlan_fr_ibssatim {
334 u16 type;
335 u16 len;
336 u8 *buf;
337 union p80211_hdr *hdr;
338
339 void *priv;
340
341
342
343
344
345
346 };
347
348
349 struct wlan_fr_disassoc {
350 u16 type;
351 u16 len;
352 u8 *buf;
353 union p80211_hdr *hdr;
354
355 void *priv;
356
357 u16 *reason;
358
359
360
361 };
362
363
364 struct wlan_fr_assocreq {
365 u16 type;
366 u16 len;
367 u8 *buf;
368 union p80211_hdr *hdr;
369
370 void *priv;
371
372 u16 *cap_info;
373 u16 *listen_int;
374
375 struct wlan_ie_ssid *ssid;
376 struct wlan_ie_supp_rates *supp_rates;
377
378 };
379
380
381 struct wlan_fr_assocresp {
382 u16 type;
383 u16 len;
384 u8 *buf;
385 union p80211_hdr *hdr;
386
387 void *priv;
388
389 u16 *cap_info;
390 u16 *status;
391 u16 *aid;
392
393 struct wlan_ie_supp_rates *supp_rates;
394
395 };
396
397
398 struct wlan_fr_reassocreq {
399 u16 type;
400 u16 len;
401 u8 *buf;
402 union p80211_hdr *hdr;
403
404 void *priv;
405
406 u16 *cap_info;
407 u16 *listen_int;
408 u8 *curr_ap;
409
410 struct wlan_ie_ssid *ssid;
411 struct wlan_ie_supp_rates *supp_rates;
412
413 };
414
415
416 struct wlan_fr_reassocresp {
417 u16 type;
418 u16 len;
419 u8 *buf;
420 union p80211_hdr *hdr;
421
422 void *priv;
423
424 u16 *cap_info;
425 u16 *status;
426 u16 *aid;
427
428 struct wlan_ie_supp_rates *supp_rates;
429
430 };
431
432
433 struct wlan_fr_probereq {
434 u16 type;
435 u16 len;
436 u8 *buf;
437 union p80211_hdr *hdr;
438
439 void *priv;
440
441
442 struct wlan_ie_ssid *ssid;
443 struct wlan_ie_supp_rates *supp_rates;
444
445 };
446
447
448 struct wlan_fr_proberesp {
449 u16 type;
450 u16 len;
451 u8 *buf;
452 union p80211_hdr *hdr;
453
454 void *priv;
455
456 u64 *ts;
457 u16 *bcn_int;
458 u16 *cap_info;
459
460 struct wlan_ie_ssid *ssid;
461 struct wlan_ie_supp_rates *supp_rates;
462 struct wlan_ie_fh_parms *fh_parms;
463 struct wlan_ie_ds_parms *ds_parms;
464 struct wlan_ie_cf_parms *cf_parms;
465 struct wlan_ie_ibss_parms *ibss_parms;
466 };
467
468
469 struct wlan_fr_authen {
470 u16 type;
471 u16 len;
472 u8 *buf;
473 union p80211_hdr *hdr;
474
475 void *priv;
476
477 u16 *auth_alg;
478 u16 *auth_seq;
479 u16 *status;
480
481 struct wlan_ie_challenge *challenge;
482
483 };
484
485
486 struct wlan_fr_deauthen {
487 u16 type;
488 u16 len;
489 u8 *buf;
490 union p80211_hdr *hdr;
491
492 void *priv;
493
494 u16 *reason;
495
496
497
498 };
499
500 void wlan_mgmt_encode_beacon(struct wlan_fr_beacon *f);
501 void wlan_mgmt_decode_beacon(struct wlan_fr_beacon *f);
502 void wlan_mgmt_encode_disassoc(struct wlan_fr_disassoc *f);
503 void wlan_mgmt_decode_disassoc(struct wlan_fr_disassoc *f);
504 void wlan_mgmt_encode_assocreq(struct wlan_fr_assocreq *f);
505 void wlan_mgmt_decode_assocreq(struct wlan_fr_assocreq *f);
506 void wlan_mgmt_encode_assocresp(struct wlan_fr_assocresp *f);
507 void wlan_mgmt_decode_assocresp(struct wlan_fr_assocresp *f);
508 void wlan_mgmt_encode_reassocreq(struct wlan_fr_reassocreq *f);
509 void wlan_mgmt_decode_reassocreq(struct wlan_fr_reassocreq *f);
510 void wlan_mgmt_encode_reassocresp(struct wlan_fr_reassocresp *f);
511 void wlan_mgmt_decode_reassocresp(struct wlan_fr_reassocresp *f);
512 void wlan_mgmt_encode_probereq(struct wlan_fr_probereq *f);
513 void wlan_mgmt_decode_probereq(struct wlan_fr_probereq *f);
514 void wlan_mgmt_encode_proberesp(struct wlan_fr_proberesp *f);
515 void wlan_mgmt_decode_proberesp(struct wlan_fr_proberesp *f);
516 void wlan_mgmt_encode_authen(struct wlan_fr_authen *f);
517 void wlan_mgmt_decode_authen(struct wlan_fr_authen *f);
518 void wlan_mgmt_encode_deauthen(struct wlan_fr_deauthen *f);
519 void wlan_mgmt_decode_deauthen(struct wlan_fr_deauthen *f);
520
521 #endif