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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
|
/* $OpenBSD: ieee80211.h,v 1.34 2007/08/29 19:57:17 damien Exp $ */
/* $NetBSD: ieee80211.h,v 1.6 2004/04/30 23:51:53 dyoung Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/net80211/ieee80211.h,v 1.5 2004/04/05 17:47:40 sam Exp $
*/
#ifndef _NET80211_IEEE80211_H_
#define _NET80211_IEEE80211_H_
/*
* 802.11 protocol definitions.
*/
#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */
/* is 802.11 address multicast/broadcast? */
#define IEEE80211_IS_MULTICAST(_a) (*(_a) & 0x01)
/* IEEE 802.11 PLCP header */
struct ieee80211_plcp_hdr {
u_int16_t i_sfd;
u_int8_t i_signal;
u_int8_t i_service;
u_int16_t i_length;
u_int16_t i_crc;
} __packed;
#define IEEE80211_PLCP_SFD 0xF3A0
#define IEEE80211_PLCP_SERVICE 0x00
#define IEEE80211_PLCP_SERVICE_PBCC 0x08 /* PBCC encoded */
#define IEEE80211_PLCP_SERVICE_LENEXT 0x80 /* length extension bit */
/*
* generic definitions for IEEE 802.11 frames
*/
struct ieee80211_frame {
u_int8_t i_fc[2];
u_int8_t i_dur[2];
u_int8_t i_addr1[IEEE80211_ADDR_LEN];
u_int8_t i_addr2[IEEE80211_ADDR_LEN];
u_int8_t i_addr3[IEEE80211_ADDR_LEN];
u_int8_t i_seq[2];
} __packed;
struct ieee80211_qosframe {
u_int8_t i_fc[2];
u_int8_t i_dur[2];
u_int8_t i_addr1[IEEE80211_ADDR_LEN];
u_int8_t i_addr2[IEEE80211_ADDR_LEN];
u_int8_t i_addr3[IEEE80211_ADDR_LEN];
u_int8_t i_seq[2];
u_int8_t i_qos[2];
} __packed;
/* 802.11n/D2.02 */
struct ieee80211_htframe {
u_int8_t i_fc[2];
u_int8_t i_dur[2];
u_int8_t i_addr1[IEEE80211_ADDR_LEN];
u_int8_t i_addr2[IEEE80211_ADDR_LEN];
u_int8_t i_addr3[IEEE80211_ADDR_LEN];
u_int8_t i_seq[2];
u_int8_t i_qos[2];
u_int8_t i_ht[4];
} __packed;
struct ieee80211_frame_addr4 {
u_int8_t i_fc[2];
u_int8_t i_dur[2];
u_int8_t i_addr1[IEEE80211_ADDR_LEN];
u_int8_t i_addr2[IEEE80211_ADDR_LEN];
u_int8_t i_addr3[IEEE80211_ADDR_LEN];
u_int8_t i_seq[2];
u_int8_t i_addr4[IEEE80211_ADDR_LEN];
} __packed;
struct ieee80211_qosframe_addr4 {
u_int8_t i_fc[2];
u_int8_t i_dur[2];
u_int8_t i_addr1[IEEE80211_ADDR_LEN];
u_int8_t i_addr2[IEEE80211_ADDR_LEN];
u_int8_t i_addr3[IEEE80211_ADDR_LEN];
u_int8_t i_seq[2];
u_int8_t i_addr4[IEEE80211_ADDR_LEN];
u_int8_t i_qos[2];
} __packed;
/* 802.11n/D2.02 */
struct ieee80211_htframe_addr4 {
u_int8_t i_fc[2];
u_int8_t i_dur[2];
u_int8_t i_addr1[IEEE80211_ADDR_LEN];
u_int8_t i_addr2[IEEE80211_ADDR_LEN];
u_int8_t i_addr3[IEEE80211_ADDR_LEN];
u_int8_t i_seq[2];
u_int8_t i_addr4[IEEE80211_ADDR_LEN];
u_int8_t i_qos[2];
u_int8_t i_ht[4];
} __packed;
/*
* Management Notification Frame
*/
struct ieee80211_mnf {
u_int8_t mnf_category;
u_int8_t mnf_action;
u_int8_t mnf_dialog;
u_int8_t mnf_status;
} __packed;
#define MNF_SETUP_REQ 0
#define MNF_SETUP_RESP 1
#define MNF_TEARDOWN 2
#define IEEE80211_FC0_VERSION_MASK 0x03
#define IEEE80211_FC0_VERSION_SHIFT 0
#define IEEE80211_FC0_VERSION_0 0x00
#define IEEE80211_FC0_TYPE_MASK 0x0c
#define IEEE80211_FC0_TYPE_SHIFT 2
#define IEEE80211_FC0_TYPE_MGT 0x00
#define IEEE80211_FC0_TYPE_CTL 0x04
#define IEEE80211_FC0_TYPE_DATA 0x08
#define IEEE80211_FC0_SUBTYPE_MASK 0xf0
#define IEEE80211_FC0_SUBTYPE_SHIFT 4
/* for TYPE_MGT */
#define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00
#define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10
#define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20
#define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30
#define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40
#define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50
#define IEEE80211_FC0_SUBTYPE_BEACON 0x80
#define IEEE80211_FC0_SUBTYPE_ATIM 0x90
#define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0
#define IEEE80211_FC0_SUBTYPE_AUTH 0xb0
#define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0
#define IEEE80211_FC0_SUBTYPE_ACTION 0xd0
#define IEEE80211_FC0_SUBTYPE_ACTION_NOACK 0xe0 /* 802.11n/D2.00 */
/* for TYPE_CTL */
#define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0
#define IEEE80211_FC0_SUBTYPE_RTS 0xb0
#define IEEE80211_FC0_SUBTYPE_CTS 0xc0
#define IEEE80211_FC0_SUBTYPE_ACK 0xd0
#define IEEE80211_FC0_SUBTYPE_CF_END 0xe0
#define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0
/* for TYPE_DATA (bit combination) */
#define IEEE80211_FC0_SUBTYPE_DATA 0x00
#define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10
#define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20
#define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30
#define IEEE80211_FC0_SUBTYPE_NODATA 0x40
#define IEEE80211_FC0_SUBTYPE_CFACK 0x50
#define IEEE80211_FC0_SUBTYPE_CFPOLL 0x60
#define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK 0x70
#define IEEE80211_FC0_SUBTYPE_QOS 0x80
#define IEEE80211_FC1_DIR_MASK 0x03
#define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */
#define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */
#define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */
#define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */
#define IEEE80211_FC1_MORE_FRAG 0x04
#define IEEE80211_FC1_RETRY 0x08
#define IEEE80211_FC1_PWR_MGT 0x10
#define IEEE80211_FC1_MORE_DATA 0x20
#define IEEE80211_FC1_PROTECTED 0x40
#define IEEE80211_FC1_WEP 0x40 /* pre-RSNA compat */
#define IEEE80211_FC1_ORDER 0x80
#define IEEE80211_SEQ_FRAG_MASK 0x000f
#define IEEE80211_SEQ_FRAG_SHIFT 0
#define IEEE80211_SEQ_SEQ_MASK 0xfff0
#define IEEE80211_SEQ_SEQ_SHIFT 4
#define IEEE80211_NWID_LEN 32
#define IEEE80211_QOS_TXOP 0x00ff
/* bit 8 is reserved */
#define IEEE80211_QOS_ACKPOLICY 0x0600
#define IEEE80211_QOS_ESOP 0x0800
#define IEEE80211_QOS_TID 0xf000
/*
* Control frames.
*/
struct ieee80211_frame_min {
u_int8_t i_fc[2];
u_int8_t i_dur[2];
u_int8_t i_addr1[IEEE80211_ADDR_LEN];
u_int8_t i_addr2[IEEE80211_ADDR_LEN];
/* FCS */
} __packed;
struct ieee80211_frame_rts {
u_int8_t i_fc[2];
u_int8_t i_dur[2];
u_int8_t i_ra[IEEE80211_ADDR_LEN];
u_int8_t i_ta[IEEE80211_ADDR_LEN];
/* FCS */
} __packed;
struct ieee80211_frame_cts {
u_int8_t i_fc[2];
u_int8_t i_dur[2];
u_int8_t i_ra[IEEE80211_ADDR_LEN];
/* FCS */
} __packed;
struct ieee80211_frame_ack {
u_int8_t i_fc[2];
u_int8_t i_dur[2];
u_int8_t i_ra[IEEE80211_ADDR_LEN];
/* FCS */
} __packed;
struct ieee80211_frame_pspoll {
u_int8_t i_fc[2];
u_int8_t i_aid[2];
u_int8_t i_bssid[IEEE80211_ADDR_LEN];
u_int8_t i_ta[IEEE80211_ADDR_LEN];
/* FCS */
} __packed;
struct ieee80211_frame_cfend { /* NB: also CF-End+CF-Ack */
u_int8_t i_fc[2];
u_int8_t i_dur[2]; /* should be zero */
u_int8_t i_ra[IEEE80211_ADDR_LEN];
u_int8_t i_bssid[IEEE80211_ADDR_LEN];
/* FCS */
} __packed;
#define IEEE80211_CAPINFO_ESS 0x0001
#define IEEE80211_CAPINFO_IBSS 0x0002
#define IEEE80211_CAPINFO_CF_POLLABLE 0x0004
#define IEEE80211_CAPINFO_CF_POLLREQ 0x0008
#define IEEE80211_CAPINFO_PRIVACY 0x0010
#define IEEE80211_CAPINFO_SHORT_PREAMBLE 0x0020
#define IEEE80211_CAPINFO_PBCC 0x0040
#define IEEE80211_CAPINFO_CHNL_AGILITY 0x0080
#define IEEE80211_CAPINFO_SPECTRUM_MGMT 0x0100
#define IEEE80211_CAPINFO_QOS 0x0200
#define IEEE80211_CAPINFO_SHORT_SLOTTIME 0x0400
#define IEEE80211_CAPINFO_APSD 0x0800
/* bit 12 is reserved */
#define IEEE80211_CAPINFO_DSSSOFDM 0x2000
#define IEEE80211_CAPINFO_DELAYED_B_ACK 0x4000
#define IEEE80211_CAPINFO_IMMEDIATE_B_ACK 0x8000
#define IEEE80211_CAPINFO_BITS \
"\10\01ESS\02IBSS\03CF_POLLABLE\04CF_POLLREQ" \
"\05PRIVACY\06SHORT_PREAMBLE\07PBCC\10CHNL_AGILITY" \
"\11SPECTRUM_MGMT\12QOS\13SHORT_SLOTTIME\14APSD" \
"\16DSSSOFDM\17DELAYED_B_ACK\20IMMEDIATE_B_ACK"
/*
* Channel attributes
*/
#define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */
#define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */
#define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */
#define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */
#define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */
#define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */
#define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */
#define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */
#define IEEE80211_CHAN_XR 0x1000 /* Extended range OFDM channel */
/*
* Useful combinations of channel characteristics.
*/
#define IEEE80211_CHAN_FHSS \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK)
#define IEEE80211_CHAN_A \
(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
#define IEEE80211_CHAN_B \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK)
#define IEEE80211_CHAN_PUREG \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM)
#define IEEE80211_CHAN_G \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN)
#define IEEE80211_CHAN_T \
(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
#define IEEE80211_CHAN_TG \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
/*
* Management information element payloads
*/
union ieee80211_information {
char ssid[IEEE80211_NWID_LEN+1];
struct rates {
u_int8_t *p;
} rates;
struct fh {
u_int16_t dwell;
u_int8_t set;
u_int8_t pattern;
u_int8_t index;
} fh;
struct ds {
u_int8_t channel;
} ds;
struct cf {
u_int8_t count;
u_int8_t period;
u_int8_t maxdur[2];
u_int8_t dur[2];
} cf;
struct tim {
u_int8_t count;
u_int8_t period;
u_int8_t bitctl;
/* u_int8_t pvt[251]; The driver needs to use this. */
} tim;
struct ibss {
u_int16_t atim;
} ibss;
struct challenge {
u_int8_t *p;
u_int8_t len;
} challenge;
struct erp {
u_int8_t flags;
} erp;
struct country {
u_int8_t cc[3]; /* ISO CC+(I)ndoor/(O)utdoor */
struct {
u_int8_t schan; /* starting channel */
u_int8_t nchan; /* number channels */
u_int8_t maxtxpwr;
} band[4]; /* up to 4 sub bands */
} country;
struct ath {
u_int8_t flags;
} ath;
};
enum {
IEEE80211_ELEMID_SSID = 0,
IEEE80211_ELEMID_RATES = 1,
IEEE80211_ELEMID_FHPARMS = 2,
IEEE80211_ELEMID_DSPARMS = 3,
IEEE80211_ELEMID_CFPARMS = 4,
IEEE80211_ELEMID_TIM = 5,
IEEE80211_ELEMID_IBSSPARMS = 6,
IEEE80211_ELEMID_COUNTRY = 7,
IEEE80211_ELEMID_QBSS_LOAD = 11,
IEEE80211_ELEMID_EDCAPARMS = 12,
IEEE80211_ELEMID_CHALLENGE = 16,
/* 17-31 reserved for challenge text extension */
IEEE80211_ELEMID_ERP = 42,
IEEE80211_ELEMID_QOS_CAP = 46,
IEEE80211_ELEMID_RSN = 48,
IEEE80211_ELEMID_XRATES = 50,
IEEE80211_ELEMID_TPC = 150,
IEEE80211_ELEMID_CCKM = 156,
IEEE80211_ELEMID_VENDOR = 221 /* vendor private */
};
#define IEEE80211_CHALLENGE_LEN 128
#define IEEE80211_RATE_BASIC 0x80
#define IEEE80211_RATE_VAL 0x7f
#define IEEE80211_RATE_SIZE 8 /* 802.11 standard */
#define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */
/* ERP information element flags */
#define IEEE80211_ERP_NON_ERP_PRESENT 0x01
#define IEEE80211_ERP_USE_PROTECTION 0x02
#define IEEE80211_ERP_BARKER_MODE 0x04
/*
* 802.11e EDCA Access Categories.
*/
enum ieee80211_edca_ac {
EDCA_AC_BK = 1, /* Background */
EDCA_AC_BE = 0, /* Best Effort */
EDCA_AC_VI = 2, /* Video */
EDCA_AC_VO = 3 /* Voice */
};
#define EDCA_NUM_AC 4
/* number of TID values (traffic identifier) */
#define IEEE80211_NUM_TID 16
/* Atheros private advanced capabilities info */
#define ATHEROS_CAP_TURBO_PRIME 0x01
#define ATHEROS_CAP_COMPRESSION 0x02
#define ATHEROS_CAP_FAST_FRAME 0x04
/* bits 3-6 reserved */
#define ATHEROS_CAP_BOOST 0x80
/* Organizationally Unique Identifiers */
/* See http://standards.ieee.org/regauth/oui/oui.txt for a list */
#define ATHEROS_OUI ((const u_int8_t[]){ 0x00, 0x03, 0x7f })
#define BROADCOM_OUI ((const u_int8_t[]){ 0x00, 0x90, 0x4c })
#define IEEE80211_OUI ((const u_int8_t[]){ 0x00, 0x0f, 0xac })
#define MICROSOFT_OUI ((const u_int8_t[]){ 0x00, 0x50, 0xf2 })
#define IEEE80211_AUTH_ALGORITHM(auth) \
((auth)[0] | ((auth)[1] << 8))
#define IEEE80211_AUTH_TRANSACTION(auth) \
((auth)[2] | ((auth)[3] << 8))
#define IEEE80211_AUTH_STATUS(auth) \
((auth)[4] | ((auth)[5] << 8))
#define IEEE80211_AUTH_ALG_OPEN 0x0000
#define IEEE80211_AUTH_ALG_SHARED 0x0001
#define IEEE80211_AUTH_ALG_LEAP 0x0080
enum {
IEEE80211_AUTH_OPEN_REQUEST = 1,
IEEE80211_AUTH_OPEN_RESPONSE = 2
};
enum {
IEEE80211_AUTH_SHARED_REQUEST = 1,
IEEE80211_AUTH_SHARED_CHALLENGE = 2,
IEEE80211_AUTH_SHARED_RESPONSE = 3,
IEEE80211_AUTH_SHARED_PASS = 4
};
/*
* Reason codes (see Table 22).
*/
enum {
IEEE80211_REASON_UNSPECIFIED = 1,
IEEE80211_REASON_AUTH_EXPIRE = 2,
IEEE80211_REASON_AUTH_LEAVE = 3,
IEEE80211_REASON_ASSOC_EXPIRE = 4,
IEEE80211_REASON_ASSOC_TOOMANY = 5,
IEEE80211_REASON_NOT_AUTHED = 6,
IEEE80211_REASON_NOT_ASSOCED = 7,
IEEE80211_REASON_ASSOC_LEAVE = 8,
IEEE80211_REASON_ASSOC_NOT_AUTHED = 9,
/* XXX the following two reason codes are not correct */
IEEE80211_REASON_RSN_REQUIRED = 11,
IEEE80211_REASON_RSN_INCONSISTENT = 12,
IEEE80211_REASON_IE_INVALID = 13,
IEEE80211_REASON_MIC_FAILURE = 14,
IEEE80211_REASON_BAD_GROUP_CIPHER = 18,
IEEE80211_REASON_BAD_PAIRWISE_CIPHER = 19,
IEEE80211_REASON_BAD_AKMP = 20,
IEEE80211_REASON_RSN_IE_VER_UNSUP = 21,
IEEE80211_REASON_RSN_IE_BAD_CAP = 22,
IEEE80211_REASON_CIPHER_REJ = 24
};
/*
* Status codes (see Table 23).
*/
enum {
IEEE80211_STATUS_SUCCESS = 0,
IEEE80211_STATUS_UNSPECIFIED = 1,
IEEE80211_STATUS_CAPINFO = 10,
IEEE80211_STATUS_NOT_ASSOCED = 11,
IEEE80211_STATUS_OTHER = 12,
IEEE80211_STATUS_ALG = 13,
IEEE80211_STATUS_SEQUENCE = 14,
IEEE80211_STATUS_CHALLENGE = 15,
IEEE80211_STATUS_TIMEOUT = 16,
IEEE80211_STATUS_TOOMANY = 17,
IEEE80211_STATUS_BASIC_RATE = 18,
IEEE80211_STATUS_SP_REQUIRED = 19,
IEEE80211_STATUS_PBCC_REQUIRED = 20,
IEEE80211_STATUS_CA_REQUIRED = 21,
IEEE80211_STATUS_TOO_MANY_STATIONS = 22,
IEEE80211_STATUS_RATES = 23,
IEEE80211_STATUS_SHORTSLOT_REQUIRED = 25,
IEEE80211_STATUS_DSSSOFDM_REQUIRED = 26
};
#define IEEE80211_WEP_KEYLEN 5 /* 40bit */
#define IEEE80211_WEP_NKID 4 /* number of key ids */
/* WEP header constants */
#define IEEE80211_WEP_IVLEN 3 /* 24bit */
#define IEEE80211_WEP_KIDLEN 1 /* 1 octet */
#define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */
#define IEEE80211_CRC_LEN 4
#define IEEE80211_WEP_TOTLEN (IEEE80211_WEP_IVLEN + \
IEEE80211_WEP_KIDLEN + \
IEEE80211_WEP_CRCLEN)
/*
* 802.11i defines an extended IV for use with non-WEP ciphers.
* When the EXTIV bit is set in the key id byte an additional
* 4 bytes immediately follow the IV for TKIP. For CCMP the
* EXTIV bit is likewise set but the 8 bytes represent the
* CCMP header rather than IV+extended-IV.
*/
#define IEEE80211_WEP_EXTIV 0x20
#define IEEE80211_WEP_EXTIVLEN 4 /* extended IV length */
#define IEEE80211_WEP_MICLEN 8 /* trailing MIC */
/*
* Maximum acceptable MTU is:
* IEEE80211_MAX_LEN - WEP overhead - CRC -
* QoS overhead - RSN/WPA overhead
* Min is arbitrarily chosen > IEEE80211_MIN_LEN. The default
* mtu is Ethernet-compatible; it's set by ether_ifattach.
*/
#define IEEE80211_MTU_MAX 2290
#define IEEE80211_MTU_MIN 32
#define IEEE80211_MAX_LEN (2300 + IEEE80211_CRC_LEN + \
(IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN))
#define IEEE80211_ACK_LEN \
(sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN)
#define IEEE80211_MIN_LEN \
(sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN)
/*
* The 802.11 spec says at most 2007 stations may be
* associated at once. For most AP's this is way more
* than is feasible so we use a default of 1800. This
* number may be overridden by the driver and/or by
* user configuration.
*/
#define IEEE80211_AID_MAX 2007
#define IEEE80211_AID_DEF 1800
#define IEEE80211_AID(b) ((b) &~ 0xc000)
#define IEEE80211_AID_SET(b, w) \
((w)[IEEE80211_AID(b) / 32] |= (1 << (IEEE80211_AID(b) % 32)))
#define IEEE80211_AID_CLR(b, w) \
((w)[IEEE80211_AID(b) / 32] &= ~(1 << (IEEE80211_AID(b) % 32)))
#define IEEE80211_AID_ISSET(b, w) \
((w)[IEEE80211_AID(b) / 32] & (1 << (IEEE80211_AID(b) % 32)))
/*
* RTS frame length parameters. The default is specified in
* the 802.11 spec. The max may be wrong for jumbo frames.
*/
#define IEEE80211_RTS_DEFAULT 512
#define IEEE80211_RTS_MIN 1
#define IEEE80211_RTS_MAX IEEE80211_MAX_LEN
/* One Time Unit (TU) is 1Kus = 1024 microseconds. */
#define IEEE80211_DUR_TU 1024
/* IEEE 802.11b durations for DSSS PHY in microseconds */
#define IEEE80211_DUR_DS_LONG_PREAMBLE 144
#define IEEE80211_DUR_DS_SHORT_PREAMBLE 72
#define IEEE80211_DUR_DS_PREAMBLE_DIFFERENCE \
(IEEE80211_DUR_DS_LONG_PREAMBLE - IEEE80211_DUR_DS_SHORT_PREAMBLE)
#define IEEE80211_DUR_DS_FAST_PLCPHDR 24
#define IEEE80211_DUR_DS_SLOW_PLCPHDR 48
#define IEEE80211_DUR_DS_PLCPHDR_DIFFERENCE \
(IEEE80211_DUR_DS_SLOW_PLCPHDR - IEEE80211_DUR_DS_FAST_PLCPHDR)
#define IEEE80211_DUR_DS_SLOW_ACK 112
#define IEEE80211_DUR_DS_FAST_ACK 56
#define IEEE80211_DUR_DS_SLOW_CTS 112
#define IEEE80211_DUR_DS_FAST_CTS 56
#define IEEE80211_DUR_DS_SLOT 20
#define IEEE80211_DUR_DS_SIFS 10
#define IEEE80211_DUR_DS_PIFS (IEEE80211_DUR_DS_SIFS + IEEE80211_DUR_DS_SLOT)
#define IEEE80211_DUR_DS_DIFS (IEEE80211_DUR_DS_SIFS + \
2 * IEEE80211_DUR_DS_SLOT)
#define IEEE80211_DUR_DS_EIFS (IEEE80211_DUR_DS_SIFS + \
IEEE80211_DUR_DS_SLOW_ACK + \
IEEE80211_DUR_DS_LONG_PREAMBLE + \
IEEE80211_DUR_DS_SLOW_PLCPHDR + \
IEEE80211_DUR_DIFS)
enum {
IEEE80211_AUTH_NONE = 0,
IEEE80211_AUTH_OPEN = 1, /* open */
IEEE80211_AUTH_SHARED = 2, /* shared-key */
IEEE80211_AUTH_8021X = 3, /* 802.1x */
IEEE80211_AUTH_AUTO = 4, /* auto-select/accept */
IEEE80211_AUTH_WPA = 5, /* WPA w/ 802.1x */
IEEE80211_AUTH_WPA_PSK = 6, /* WPA w/ preshared key */
IEEE80211_AUTH_WPA2 = 7, /* WPA2 w/ 802.1x */
IEEE80211_AUTH_WPA2_PSK = 8 /* WPA2 w/ preshared key */
};
/*
* The RSNA key descriptor used by IEEE 802.11 does not use the IEEE 802.1X
* key descriptor. Instead, it uses the key descriptor described in 8.5.2.
*/
#define EAPOL_VERSION 1
#define EAPOL_KEY_NONCE_LEN 32
#define EAPOL_KEY_IV_LEN 16
#define EAPOL_KEY_MIC_LEN 16
struct ieee80211_eapol_key {
u_int8_t version;
u_int8_t type;
/* IEEE Std 802.1X-2004, 7.5.4 (only type EAPOL-Key is used here) */
#define EAP_PACKET 0
#define EAPOL_START 1
#define EAPOL_LOGOFF 2
#define EAPOL_KEY 3
#define EAPOL_ASF_ALERT 4
u_int8_t len[2];
u_int8_t desc;
/* IEEE Std 802.1X-2004, 7.6.1 */
#define EAPOL_KEY_DESC_RC4 1 /* deprecated */
#define EAPOL_KEY_DESC_IEEE80211 2
#define EAPOL_KEY_DESC_WPA1 254 /* non-standard WPA1 */
u_int8_t info[2];
#define EAPOL_KEY_VERSION_MASK 0x7
#define EAPOL_KEY_DESC_V1 1
#define EAPOL_KEY_DESC_V2 2
#define EAPOL_KEY_PAIRWISE (1 << 3)
#define EAPOL_KEY_INSTALL (1 << 6) /* I */
#define EAPOL_KEY_KEYACK (1 << 7) /* A */
#define EAPOL_KEY_KEYMIC (1 << 8) /* M */
#define EAPOL_KEY_SECURE (1 << 9) /* S */
#define EAPOL_KEY_ERROR (1 << 10)
#define EAPOL_KEY_REQUEST (1 << 11)
#define EAPOL_KEY_ENCRYPTED (1 << 12)
#define EAPOL_KEY_SMK (1 << 13)
/* WPA1 compatibility */
#define EAPOL_KEY_WPA_KID_MASK 0x3
#define EAPOL_KEY_WPA_KID_SHIFT 4
#define EAPOL_KEY_WPA_TX EAPOL_KEY_INSTALL
u_int8_t keylen[2];
u_int8_t replaycnt[8];
u_int8_t nonce[EAPOL_KEY_NONCE_LEN];
u_int8_t iv[EAPOL_KEY_IV_LEN];
u_int8_t rsc[8];
u_int8_t reserved[8];
u_int8_t mic[EAPOL_KEY_MIC_LEN];
u_int8_t paylen[2];
} __packed;
/* Pairwise Transient Key (see 8.5.1.2) */
struct ieee80211_ptk {
u_int8_t kck[16]; /* Key Confirmation Key */
u_int8_t kek[16]; /* Key Encryption Key */
u_int8_t tk[32]; /* Temporal Key */
} __packed;
#define IEEE80211_PMKID_LEN 16
#define IEEE80211_SMKID_LEN 16
/*
* Key Data Encapsulation (see Table 62).
*/
enum {
IEEE80211_KDE_GTK = 1,
IEEE80211_KDE_MACADDR = 3,
IEEE80211_KDE_PMKID = 4,
IEEE80211_KDE_SMK = 5,
IEEE80211_KDE_NONCE = 6,
IEEE80211_KDE_LIFETIME = 7,
IEEE80211_KDE_ERROR = 8
};
#endif /* _NET80211_IEEE80211_H_ */
|