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 #ifndef _NET80211_IEEE80211_H_
34 #define _NET80211_IEEE80211_H_
35
36
37
38
39
40 #define IEEE80211_ADDR_LEN 6
41
42 #define IEEE80211_IS_MULTICAST(_a) (*(_a) & 0x01)
43
44
45 struct ieee80211_plcp_hdr {
46 u_int16_t i_sfd;
47 u_int8_t i_signal;
48 u_int8_t i_service;
49 u_int16_t i_length;
50 u_int16_t i_crc;
51 } __packed;
52
53 #define IEEE80211_PLCP_SFD 0xF3A0
54 #define IEEE80211_PLCP_SERVICE 0x00
55 #define IEEE80211_PLCP_SERVICE_PBCC 0x08
56 #define IEEE80211_PLCP_SERVICE_LENEXT 0x80
57
58
59
60
61 struct ieee80211_frame {
62 u_int8_t i_fc[2];
63 u_int8_t i_dur[2];
64 u_int8_t i_addr1[IEEE80211_ADDR_LEN];
65 u_int8_t i_addr2[IEEE80211_ADDR_LEN];
66 u_int8_t i_addr3[IEEE80211_ADDR_LEN];
67 u_int8_t i_seq[2];
68 } __packed;
69
70 struct ieee80211_qosframe {
71 u_int8_t i_fc[2];
72 u_int8_t i_dur[2];
73 u_int8_t i_addr1[IEEE80211_ADDR_LEN];
74 u_int8_t i_addr2[IEEE80211_ADDR_LEN];
75 u_int8_t i_addr3[IEEE80211_ADDR_LEN];
76 u_int8_t i_seq[2];
77 u_int8_t i_qos[2];
78 } __packed;
79
80
81 struct ieee80211_htframe {
82 u_int8_t i_fc[2];
83 u_int8_t i_dur[2];
84 u_int8_t i_addr1[IEEE80211_ADDR_LEN];
85 u_int8_t i_addr2[IEEE80211_ADDR_LEN];
86 u_int8_t i_addr3[IEEE80211_ADDR_LEN];
87 u_int8_t i_seq[2];
88 u_int8_t i_qos[2];
89 u_int8_t i_ht[4];
90 } __packed;
91
92 struct ieee80211_frame_addr4 {
93 u_int8_t i_fc[2];
94 u_int8_t i_dur[2];
95 u_int8_t i_addr1[IEEE80211_ADDR_LEN];
96 u_int8_t i_addr2[IEEE80211_ADDR_LEN];
97 u_int8_t i_addr3[IEEE80211_ADDR_LEN];
98 u_int8_t i_seq[2];
99 u_int8_t i_addr4[IEEE80211_ADDR_LEN];
100 } __packed;
101
102 struct ieee80211_qosframe_addr4 {
103 u_int8_t i_fc[2];
104 u_int8_t i_dur[2];
105 u_int8_t i_addr1[IEEE80211_ADDR_LEN];
106 u_int8_t i_addr2[IEEE80211_ADDR_LEN];
107 u_int8_t i_addr3[IEEE80211_ADDR_LEN];
108 u_int8_t i_seq[2];
109 u_int8_t i_addr4[IEEE80211_ADDR_LEN];
110 u_int8_t i_qos[2];
111 } __packed;
112
113
114 struct ieee80211_htframe_addr4 {
115 u_int8_t i_fc[2];
116 u_int8_t i_dur[2];
117 u_int8_t i_addr1[IEEE80211_ADDR_LEN];
118 u_int8_t i_addr2[IEEE80211_ADDR_LEN];
119 u_int8_t i_addr3[IEEE80211_ADDR_LEN];
120 u_int8_t i_seq[2];
121 u_int8_t i_addr4[IEEE80211_ADDR_LEN];
122 u_int8_t i_qos[2];
123 u_int8_t i_ht[4];
124 } __packed;
125
126
127
128
129 struct ieee80211_mnf {
130 u_int8_t mnf_category;
131 u_int8_t mnf_action;
132 u_int8_t mnf_dialog;
133 u_int8_t mnf_status;
134 } __packed;
135 #define MNF_SETUP_REQ 0
136 #define MNF_SETUP_RESP 1
137 #define MNF_TEARDOWN 2
138
139
140 #define IEEE80211_FC0_VERSION_MASK 0x03
141 #define IEEE80211_FC0_VERSION_SHIFT 0
142 #define IEEE80211_FC0_VERSION_0 0x00
143 #define IEEE80211_FC0_TYPE_MASK 0x0c
144 #define IEEE80211_FC0_TYPE_SHIFT 2
145 #define IEEE80211_FC0_TYPE_MGT 0x00
146 #define IEEE80211_FC0_TYPE_CTL 0x04
147 #define IEEE80211_FC0_TYPE_DATA 0x08
148
149 #define IEEE80211_FC0_SUBTYPE_MASK 0xf0
150 #define IEEE80211_FC0_SUBTYPE_SHIFT 4
151
152 #define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00
153 #define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10
154 #define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20
155 #define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30
156 #define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40
157 #define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50
158 #define IEEE80211_FC0_SUBTYPE_BEACON 0x80
159 #define IEEE80211_FC0_SUBTYPE_ATIM 0x90
160 #define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0
161 #define IEEE80211_FC0_SUBTYPE_AUTH 0xb0
162 #define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0
163 #define IEEE80211_FC0_SUBTYPE_ACTION 0xd0
164 #define IEEE80211_FC0_SUBTYPE_ACTION_NOACK 0xe0
165
166 #define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0
167 #define IEEE80211_FC0_SUBTYPE_RTS 0xb0
168 #define IEEE80211_FC0_SUBTYPE_CTS 0xc0
169 #define IEEE80211_FC0_SUBTYPE_ACK 0xd0
170 #define IEEE80211_FC0_SUBTYPE_CF_END 0xe0
171 #define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0
172
173 #define IEEE80211_FC0_SUBTYPE_DATA 0x00
174 #define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10
175 #define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20
176 #define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30
177 #define IEEE80211_FC0_SUBTYPE_NODATA 0x40
178 #define IEEE80211_FC0_SUBTYPE_CFACK 0x50
179 #define IEEE80211_FC0_SUBTYPE_CFPOLL 0x60
180 #define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK 0x70
181 #define IEEE80211_FC0_SUBTYPE_QOS 0x80
182
183 #define IEEE80211_FC1_DIR_MASK 0x03
184 #define IEEE80211_FC1_DIR_NODS 0x00
185 #define IEEE80211_FC1_DIR_TODS 0x01
186 #define IEEE80211_FC1_DIR_FROMDS 0x02
187 #define IEEE80211_FC1_DIR_DSTODS 0x03
188
189 #define IEEE80211_FC1_MORE_FRAG 0x04
190 #define IEEE80211_FC1_RETRY 0x08
191 #define IEEE80211_FC1_PWR_MGT 0x10
192 #define IEEE80211_FC1_MORE_DATA 0x20
193 #define IEEE80211_FC1_PROTECTED 0x40
194 #define IEEE80211_FC1_WEP 0x40
195 #define IEEE80211_FC1_ORDER 0x80
196
197 #define IEEE80211_SEQ_FRAG_MASK 0x000f
198 #define IEEE80211_SEQ_FRAG_SHIFT 0
199 #define IEEE80211_SEQ_SEQ_MASK 0xfff0
200 #define IEEE80211_SEQ_SEQ_SHIFT 4
201
202 #define IEEE80211_NWID_LEN 32
203
204 #define IEEE80211_QOS_TXOP 0x00ff
205
206 #define IEEE80211_QOS_ACKPOLICY 0x0600
207 #define IEEE80211_QOS_ESOP 0x0800
208 #define IEEE80211_QOS_TID 0xf000
209
210
211
212
213 struct ieee80211_frame_min {
214 u_int8_t i_fc[2];
215 u_int8_t i_dur[2];
216 u_int8_t i_addr1[IEEE80211_ADDR_LEN];
217 u_int8_t i_addr2[IEEE80211_ADDR_LEN];
218
219 } __packed;
220
221 struct ieee80211_frame_rts {
222 u_int8_t i_fc[2];
223 u_int8_t i_dur[2];
224 u_int8_t i_ra[IEEE80211_ADDR_LEN];
225 u_int8_t i_ta[IEEE80211_ADDR_LEN];
226
227 } __packed;
228
229 struct ieee80211_frame_cts {
230 u_int8_t i_fc[2];
231 u_int8_t i_dur[2];
232 u_int8_t i_ra[IEEE80211_ADDR_LEN];
233
234 } __packed;
235
236 struct ieee80211_frame_ack {
237 u_int8_t i_fc[2];
238 u_int8_t i_dur[2];
239 u_int8_t i_ra[IEEE80211_ADDR_LEN];
240
241 } __packed;
242
243 struct ieee80211_frame_pspoll {
244 u_int8_t i_fc[2];
245 u_int8_t i_aid[2];
246 u_int8_t i_bssid[IEEE80211_ADDR_LEN];
247 u_int8_t i_ta[IEEE80211_ADDR_LEN];
248
249 } __packed;
250
251 struct ieee80211_frame_cfend {
252 u_int8_t i_fc[2];
253 u_int8_t i_dur[2];
254 u_int8_t i_ra[IEEE80211_ADDR_LEN];
255 u_int8_t i_bssid[IEEE80211_ADDR_LEN];
256
257 } __packed;
258
259 #define IEEE80211_CAPINFO_ESS 0x0001
260 #define IEEE80211_CAPINFO_IBSS 0x0002
261 #define IEEE80211_CAPINFO_CF_POLLABLE 0x0004
262 #define IEEE80211_CAPINFO_CF_POLLREQ 0x0008
263 #define IEEE80211_CAPINFO_PRIVACY 0x0010
264 #define IEEE80211_CAPINFO_SHORT_PREAMBLE 0x0020
265 #define IEEE80211_CAPINFO_PBCC 0x0040
266 #define IEEE80211_CAPINFO_CHNL_AGILITY 0x0080
267 #define IEEE80211_CAPINFO_SPECTRUM_MGMT 0x0100
268 #define IEEE80211_CAPINFO_QOS 0x0200
269 #define IEEE80211_CAPINFO_SHORT_SLOTTIME 0x0400
270 #define IEEE80211_CAPINFO_APSD 0x0800
271
272 #define IEEE80211_CAPINFO_DSSSOFDM 0x2000
273 #define IEEE80211_CAPINFO_DELAYED_B_ACK 0x4000
274 #define IEEE80211_CAPINFO_IMMEDIATE_B_ACK 0x8000
275 #define IEEE80211_CAPINFO_BITS \
276 "\10\01ESS\02IBSS\03CF_POLLABLE\04CF_POLLREQ" \
277 "\05PRIVACY\06SHORT_PREAMBLE\07PBCC\10CHNL_AGILITY" \
278 "\11SPECTRUM_MGMT\12QOS\13SHORT_SLOTTIME\14APSD" \
279 "\16DSSSOFDM\17DELAYED_B_ACK\20IMMEDIATE_B_ACK"
280
281
282
283
284 #define IEEE80211_CHAN_TURBO 0x0010
285 #define IEEE80211_CHAN_CCK 0x0020
286 #define IEEE80211_CHAN_OFDM 0x0040
287 #define IEEE80211_CHAN_2GHZ 0x0080
288 #define IEEE80211_CHAN_5GHZ 0x0100
289 #define IEEE80211_CHAN_PASSIVE 0x0200
290 #define IEEE80211_CHAN_DYN 0x0400
291 #define IEEE80211_CHAN_GFSK 0x0800
292 #define IEEE80211_CHAN_XR 0x1000
293
294
295
296
297 #define IEEE80211_CHAN_FHSS \
298 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK)
299 #define IEEE80211_CHAN_A \
300 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
301 #define IEEE80211_CHAN_B \
302 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK)
303 #define IEEE80211_CHAN_PUREG \
304 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM)
305 #define IEEE80211_CHAN_G \
306 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN)
307 #define IEEE80211_CHAN_T \
308 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
309 #define IEEE80211_CHAN_TG \
310 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
311
312
313
314
315 union ieee80211_information {
316 char ssid[IEEE80211_NWID_LEN+1];
317 struct rates {
318 u_int8_t *p;
319 } rates;
320 struct fh {
321 u_int16_t dwell;
322 u_int8_t set;
323 u_int8_t pattern;
324 u_int8_t index;
325 } fh;
326 struct ds {
327 u_int8_t channel;
328 } ds;
329 struct cf {
330 u_int8_t count;
331 u_int8_t period;
332 u_int8_t maxdur[2];
333 u_int8_t dur[2];
334 } cf;
335 struct tim {
336 u_int8_t count;
337 u_int8_t period;
338 u_int8_t bitctl;
339
340 } tim;
341 struct ibss {
342 u_int16_t atim;
343 } ibss;
344 struct challenge {
345 u_int8_t *p;
346 u_int8_t len;
347 } challenge;
348 struct erp {
349 u_int8_t flags;
350 } erp;
351 struct country {
352 u_int8_t cc[3];
353 struct {
354 u_int8_t schan;
355 u_int8_t nchan;
356 u_int8_t maxtxpwr;
357 } band[4];
358 } country;
359 struct ath {
360 u_int8_t flags;
361 } ath;
362 };
363
364 enum {
365 IEEE80211_ELEMID_SSID = 0,
366 IEEE80211_ELEMID_RATES = 1,
367 IEEE80211_ELEMID_FHPARMS = 2,
368 IEEE80211_ELEMID_DSPARMS = 3,
369 IEEE80211_ELEMID_CFPARMS = 4,
370 IEEE80211_ELEMID_TIM = 5,
371 IEEE80211_ELEMID_IBSSPARMS = 6,
372 IEEE80211_ELEMID_COUNTRY = 7,
373 IEEE80211_ELEMID_QBSS_LOAD = 11,
374 IEEE80211_ELEMID_EDCAPARMS = 12,
375 IEEE80211_ELEMID_CHALLENGE = 16,
376
377 IEEE80211_ELEMID_ERP = 42,
378 IEEE80211_ELEMID_QOS_CAP = 46,
379 IEEE80211_ELEMID_RSN = 48,
380 IEEE80211_ELEMID_XRATES = 50,
381 IEEE80211_ELEMID_TPC = 150,
382 IEEE80211_ELEMID_CCKM = 156,
383 IEEE80211_ELEMID_VENDOR = 221
384 };
385
386 #define IEEE80211_CHALLENGE_LEN 128
387
388 #define IEEE80211_RATE_BASIC 0x80
389 #define IEEE80211_RATE_VAL 0x7f
390 #define IEEE80211_RATE_SIZE 8
391 #define IEEE80211_RATE_MAXSIZE 15
392
393
394 #define IEEE80211_ERP_NON_ERP_PRESENT 0x01
395 #define IEEE80211_ERP_USE_PROTECTION 0x02
396 #define IEEE80211_ERP_BARKER_MODE 0x04
397
398
399
400
401 enum ieee80211_edca_ac {
402 EDCA_AC_BK = 1,
403 EDCA_AC_BE = 0,
404 EDCA_AC_VI = 2,
405 EDCA_AC_VO = 3
406 };
407 #define EDCA_NUM_AC 4
408
409
410 #define IEEE80211_NUM_TID 16
411
412
413 #define ATHEROS_CAP_TURBO_PRIME 0x01
414 #define ATHEROS_CAP_COMPRESSION 0x02
415 #define ATHEROS_CAP_FAST_FRAME 0x04
416
417 #define ATHEROS_CAP_BOOST 0x80
418
419
420
421 #define ATHEROS_OUI ((const u_int8_t[]){ 0x00, 0x03, 0x7f })
422 #define BROADCOM_OUI ((const u_int8_t[]){ 0c00, 0x90, 0x4c })
423 #define IEEE80211_OUI ((const u_int8_t[]){ 0x00, 0x0f, 0xac })
424 #define MICROSOFT_OUI ((const u_int8_t[]){ 0x00, 0x50, 0xf2 })
425
426 #define IEEE80211_AUTH_ALGORITHM(auth) \
427 ((auth)[0] | ((auth)[1] << 8))
428 #define IEEE80211_AUTH_TRANSACTION(auth) \
429 ((auth)[2] | ((auth)[3] << 8))
430 #define IEEE80211_AUTH_STATUS(auth) \
431 ((auth)[4] | ((auth)[5] << 8))
432
433 #define IEEE80211_AUTH_ALG_OPEN 0x0000
434 #define IEEE80211_AUTH_ALG_SHARED 0x0001
435 #define IEEE80211_AUTH_ALG_LEAP 0x0080
436
437 enum {
438 IEEE80211_AUTH_OPEN_REQUEST = 1,
439 IEEE80211_AUTH_OPEN_RESPONSE = 2
440 };
441
442 enum {
443 IEEE80211_AUTH_SHARED_REQUEST = 1,
444 IEEE80211_AUTH_SHARED_CHALLENGE = 2,
445 IEEE80211_AUTH_SHARED_RESPONSE = 3,
446 IEEE80211_AUTH_SHARED_PASS = 4
447 };
448
449
450
451
452 enum {
453 IEEE80211_REASON_UNSPECIFIED = 1,
454 IEEE80211_REASON_AUTH_EXPIRE = 2,
455 IEEE80211_REASON_AUTH_LEAVE = 3,
456 IEEE80211_REASON_ASSOC_EXPIRE = 4,
457 IEEE80211_REASON_ASSOC_TOOMANY = 5,
458 IEEE80211_REASON_NOT_AUTHED = 6,
459 IEEE80211_REASON_NOT_ASSOCED = 7,
460 IEEE80211_REASON_ASSOC_LEAVE = 8,
461 IEEE80211_REASON_ASSOC_NOT_AUTHED = 9,
462
463
464 IEEE80211_REASON_RSN_REQUIRED = 11,
465 IEEE80211_REASON_RSN_INCONSISTENT = 12,
466
467 IEEE80211_REASON_IE_INVALID = 13,
468 IEEE80211_REASON_MIC_FAILURE = 14,
469
470 IEEE80211_REASON_BAD_GROUP_CIPHER = 18,
471 IEEE80211_REASON_BAD_PAIRWISE_CIPHER = 19,
472 IEEE80211_REASON_BAD_AKMP = 20,
473 IEEE80211_REASON_RSN_IE_VER_UNSUP = 21,
474 IEEE80211_REASON_RSN_IE_BAD_CAP = 22,
475
476 IEEE80211_REASON_CIPHER_REJ = 24
477 };
478
479
480
481
482 enum {
483 IEEE80211_STATUS_SUCCESS = 0,
484 IEEE80211_STATUS_UNSPECIFIED = 1,
485 IEEE80211_STATUS_CAPINFO = 10,
486 IEEE80211_STATUS_NOT_ASSOCED = 11,
487 IEEE80211_STATUS_OTHER = 12,
488 IEEE80211_STATUS_ALG = 13,
489 IEEE80211_STATUS_SEQUENCE = 14,
490 IEEE80211_STATUS_CHALLENGE = 15,
491 IEEE80211_STATUS_TIMEOUT = 16,
492 IEEE80211_STATUS_TOOMANY = 17,
493 IEEE80211_STATUS_BASIC_RATE = 18,
494 IEEE80211_STATUS_SP_REQUIRED = 19,
495 IEEE80211_STATUS_PBCC_REQUIRED = 20,
496 IEEE80211_STATUS_CA_REQUIRED = 21,
497 IEEE80211_STATUS_TOO_MANY_STATIONS = 22,
498 IEEE80211_STATUS_RATES = 23,
499 IEEE80211_STATUS_SHORTSLOT_REQUIRED = 25,
500 IEEE80211_STATUS_DSSSOFDM_REQUIRED = 26
501 };
502
503 #define IEEE80211_WEP_KEYLEN 5
504 #define IEEE80211_WEP_NKID 4
505
506
507 #define IEEE80211_WEP_IVLEN 3
508 #define IEEE80211_WEP_KIDLEN 1
509 #define IEEE80211_WEP_CRCLEN 4
510 #define IEEE80211_CRC_LEN 4
511 #define IEEE80211_WEP_TOTLEN (IEEE80211_WEP_IVLEN + \
512 IEEE80211_WEP_KIDLEN + \
513 IEEE80211_WEP_CRCLEN)
514
515
516
517
518
519
520
521
522 #define IEEE80211_WEP_EXTIV 0x20
523 #define IEEE80211_WEP_EXTIVLEN 4
524 #define IEEE80211_WEP_MICLEN 8
525
526
527
528
529
530
531
532
533 #define IEEE80211_MTU_MAX 2290
534 #define IEEE80211_MTU_MIN 32
535
536 #define IEEE80211_MAX_LEN (2300 + IEEE80211_CRC_LEN + \
537 (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN))
538 #define IEEE80211_ACK_LEN \
539 (sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN)
540 #define IEEE80211_MIN_LEN \
541 (sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN)
542
543
544
545
546
547
548
549
550 #define IEEE80211_AID_MAX 2007
551 #define IEEE80211_AID_DEF 1800
552
553 #define IEEE80211_AID(b) ((b) &~ 0xc000)
554 #define IEEE80211_AID_SET(b, w) \
555 ((w)[IEEE80211_AID(b) / 32] |= (1 << (IEEE80211_AID(b) % 32)))
556 #define IEEE80211_AID_CLR(b, w) \
557 ((w)[IEEE80211_AID(b) / 32] &= ~(1 << (IEEE80211_AID(b) % 32)))
558 #define IEEE80211_AID_ISSET(b, w) \
559 ((w)[IEEE80211_AID(b) / 32] & (1 << (IEEE80211_AID(b) % 32)))
560
561
562
563
564
565 #define IEEE80211_RTS_DEFAULT 512
566 #define IEEE80211_RTS_MIN 1
567 #define IEEE80211_RTS_MAX IEEE80211_MAX_LEN
568
569
570 #define IEEE80211_DUR_TU 1024
571
572
573 #define IEEE80211_DUR_DS_LONG_PREAMBLE 144
574 #define IEEE80211_DUR_DS_SHORT_PREAMBLE 72
575 #define IEEE80211_DUR_DS_PREAMBLE_DIFFERENCE \
576 (IEEE80211_DUR_DS_LONG_PREAMBLE - IEEE80211_DUR_DS_SHORT_PREAMBLE)
577 #define IEEE80211_DUR_DS_FAST_PLCPHDR 24
578 #define IEEE80211_DUR_DS_SLOW_PLCPHDR 48
579 #define IEEE80211_DUR_DS_PLCPHDR_DIFFERENCE \
580 (IEEE80211_DUR_DS_SLOW_PLCPHDR - IEEE80211_DUR_DS_FAST_PLCPHDR)
581 #define IEEE80211_DUR_DS_SLOW_ACK 112
582 #define IEEE80211_DUR_DS_FAST_ACK 56
583 #define IEEE80211_DUR_DS_SLOW_CTS 112
584 #define IEEE80211_DUR_DS_FAST_CTS 56
585 #define IEEE80211_DUR_DS_SLOT 20
586 #define IEEE80211_DUR_DS_SIFS 10
587 #define IEEE80211_DUR_DS_PIFS (IEEE80211_DUR_DS_SIFS + IEEE80211_DUR_DS_SLOT)
588 #define IEEE80211_DUR_DS_DIFS (IEEE80211_DUR_DS_SIFS + \
589 2 * IEEE80211_DUR_DS_SLOT)
590 #define IEEE80211_DUR_DS_EIFS (IEEE80211_DUR_DS_SIFS + \
591 IEEE80211_DUR_DS_SLOW_ACK + \
592 IEEE80211_DUR_DS_LONG_PREAMBLE + \
593 IEEE80211_DUR_DS_SLOW_PLCPHDR + \
594 IEEE80211_DUR_DIFS)
595
596 enum {
597 IEEE80211_AUTH_NONE = 0,
598 IEEE80211_AUTH_OPEN = 1,
599 IEEE80211_AUTH_SHARED = 2,
600 IEEE80211_AUTH_8021X = 3,
601 IEEE80211_AUTH_AUTO = 4,
602 IEEE80211_AUTH_WPA = 5,
603 IEEE80211_AUTH_WPA_PSK = 6,
604 IEEE80211_AUTH_WPA2 = 7,
605 IEEE80211_AUTH_WPA2_PSK = 8
606 };
607
608
609
610
611
612 #define EAPOL_VERSION 1
613
614 #define EAPOL_KEY_NONCE_LEN 32
615 #define EAPOL_KEY_IV_LEN 16
616 #define EAPOL_KEY_MIC_LEN 16
617
618 struct ieee80211_eapol_key {
619 u_int8_t version;
620 u_int8_t type;
621
622 #define EAP_PACKET 0
623 #define EAPOL_START 1
624 #define EAPOL_LOGOFF 2
625 #define EAPOL_KEY 3
626 #define EAPOL_ASF_ALERT 4
627
628 u_int8_t len[2];
629 u_int8_t desc;
630
631 #define EAPOL_KEY_DESC_RC4 1
632 #define EAPOL_KEY_DESC_IEEE80211 2
633 #define EAPOL_KEY_DESC_WPA1 254
634
635 u_int8_t info[2];
636 #define EAPOL_KEY_VERSION_MASK 0x7
637 #define EAPOL_KEY_DESC_V1 1
638 #define EAPOL_KEY_DESC_V2 2
639 #define EAPOL_KEY_PAIRWISE (1 << 3)
640 #define EAPOL_KEY_INSTALL (1 << 6)
641 #define EAPOL_KEY_KEYACK (1 << 7)
642 #define EAPOL_KEY_KEYMIC (1 << 8)
643 #define EAPOL_KEY_SECURE (1 << 9)
644 #define EAPOL_KEY_ERROR (1 << 10)
645 #define EAPOL_KEY_REQUEST (1 << 11)
646 #define EAPOL_KEY_ENCRYPTED (1 << 12)
647 #define EAPOL_KEY_SMK (1 << 13)
648
649 #define EAPOL_KEY_WPA_KID_MASK 0x3
650 #define EAPOL_KEY_WPA_KID_SHIFT 4
651 #define EAPOL_KEY_WPA_TX EAPOL_KEY_INSTALL
652
653 u_int8_t keylen[2];
654 u_int8_t replaycnt[8];
655 u_int8_t nonce[EAPOL_KEY_NONCE_LEN];
656 u_int8_t iv[EAPOL_KEY_IV_LEN];
657 u_int8_t rsc[8];
658 u_int8_t reserved[8];
659 u_int8_t mic[EAPOL_KEY_MIC_LEN];
660 u_int8_t paylen[2];
661 } __packed;
662
663
664 struct ieee80211_ptk {
665 u_int8_t kck[16];
666 u_int8_t kek[16];
667 u_int8_t tk[32];
668 } __packed;
669
670 #define IEEE80211_PMKID_LEN 16
671 #define IEEE80211_SMKID_LEN 16
672
673
674
675
676 enum {
677 IEEE80211_KDE_GTK = 1,
678 IEEE80211_KDE_MACADDR = 3,
679 IEEE80211_KDE_PMKID = 4,
680 IEEE80211_KDE_SMK = 5,
681 IEEE80211_KDE_NONCE = 6,
682 IEEE80211_KDE_LIFETIME = 7,
683 IEEE80211_KDE_ERROR = 8
684 };
685
686 #endif