Annotation of sys/net80211/ieee80211.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: ieee80211.h,v 1.33 2007/08/01 12:23:26 damien Exp $ */
2: /* $NetBSD: ieee80211.h,v 1.6 2004/04/30 23:51:53 dyoung Exp $ */
3:
4: /*-
5: * Copyright (c) 2001 Atsushi Onoe
6: * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
7: * All rights reserved.
8: *
9: * Redistribution and use in source and binary forms, with or without
10: * modification, are permitted provided that the following conditions
11: * are met:
12: * 1. Redistributions of source code must retain the above copyright
13: * notice, this list of conditions and the following disclaimer.
14: * 2. Redistributions in binary form must reproduce the above copyright
15: * notice, this list of conditions and the following disclaimer in the
16: * documentation and/or other materials provided with the distribution.
17: * 3. The name of the author may not be used to endorse or promote products
18: * derived from this software without specific prior written permission.
19: *
20: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30: *
31: * $FreeBSD: src/sys/net80211/ieee80211.h,v 1.5 2004/04/05 17:47:40 sam Exp $
32: */
33: #ifndef _NET80211_IEEE80211_H_
34: #define _NET80211_IEEE80211_H_
35:
36: /*
37: * 802.11 protocol definitions.
38: */
39:
40: #define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */
41: /* is 802.11 address multicast/broadcast? */
42: #define IEEE80211_IS_MULTICAST(_a) (*(_a) & 0x01)
43:
44: /* IEEE 802.11 PLCP header */
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 /* PBCC encoded */
56: #define IEEE80211_PLCP_SERVICE_LENEXT 0x80 /* length extension bit */
57:
58: /*
59: * generic definitions for IEEE 802.11 frames
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: /* 802.11n/D2.02 */
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: /* 802.11n/D2.02 */
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: * Management Notification Frame
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: /* for TYPE_MGT */
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 /* 802.11n/D2.00 */
165: /* for TYPE_CTL */
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: /* for TYPE_DATA (bit combination) */
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 /* STA->STA */
185: #define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */
186: #define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */
187: #define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */
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 /* pre-RSNA compat */
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: /* bit 8 is reserved */
206: #define IEEE80211_QOS_ACKPOLICY 0x0600
207: #define IEEE80211_QOS_ESOP 0x0800
208: #define IEEE80211_QOS_TID 0xf000
209:
210: /*
211: * Control frames.
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: /* FCS */
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: /* FCS */
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: /* FCS */
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: /* FCS */
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: /* FCS */
249: } __packed;
250:
251: struct ieee80211_frame_cfend { /* NB: also CF-End+CF-Ack */
252: u_int8_t i_fc[2];
253: u_int8_t i_dur[2]; /* should be zero */
254: u_int8_t i_ra[IEEE80211_ADDR_LEN];
255: u_int8_t i_bssid[IEEE80211_ADDR_LEN];
256: /* FCS */
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: /* bit 12 is reserved */
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: * Channel attributes
283: */
284: #define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */
285: #define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */
286: #define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */
287: #define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */
288: #define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */
289: #define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */
290: #define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */
291: #define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */
292: #define IEEE80211_CHAN_XR 0x1000 /* Extended range OFDM channel */
293:
294: /*
295: * Useful combinations of channel characteristics.
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: * Management information element payloads
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: /* u_int8_t pvt[251]; The driver needs to use this. */
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]; /* ISO CC+(I)ndoor/(O)utdoor */
353: struct {
354: u_int8_t schan; /* starting channel */
355: u_int8_t nchan; /* number channels */
356: u_int8_t maxtxpwr;
357: } band[4]; /* up to 4 sub bands */
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: /* 17-31 reserved for challenge text extension */
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 /* vendor private */
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 /* 802.11 standard */
391: #define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */
392:
393: /* ERP information element flags */
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: * 802.11e EDCA Access Categories.
400: */
401: enum ieee80211_edca_ac {
402: EDCA_AC_BK = 1, /* Background */
403: EDCA_AC_BE = 0, /* Best Effort */
404: EDCA_AC_VI = 2, /* Video */
405: EDCA_AC_VO = 3 /* Voice */
406: };
407: #define EDCA_NUM_AC 4
408:
409: /* number of TID values (traffic identifier) */
410: #define IEEE80211_NUM_TID 16
411:
412: /* Atheros private advanced capabilities info */
413: #define ATHEROS_CAP_TURBO_PRIME 0x01
414: #define ATHEROS_CAP_COMPRESSION 0x02
415: #define ATHEROS_CAP_FAST_FRAME 0x04
416: /* bits 3-6 reserved */
417: #define ATHEROS_CAP_BOOST 0x80
418:
419: /* Organizationally Unique Identifiers */
420: /* See http://standards.ieee.org/regauth/oui/oui.txt for a list */
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: * Reason codes (see Table 22).
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: /* XXX the following two reason codes are not correct */
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: * Status codes (see Table 23).
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 /* 40bit */
504: #define IEEE80211_WEP_NKID 4 /* number of key ids */
505:
506: /* WEP header constants */
507: #define IEEE80211_WEP_IVLEN 3 /* 24bit */
508: #define IEEE80211_WEP_KIDLEN 1 /* 1 octet */
509: #define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */
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: * 802.11i defines an extended IV for use with non-WEP ciphers.
517: * When the EXTIV bit is set in the key id byte an additional
518: * 4 bytes immediately follow the IV for TKIP. For CCMP the
519: * EXTIV bit is likewise set but the 8 bytes represent the
520: * CCMP header rather than IV+extended-IV.
521: */
522: #define IEEE80211_WEP_EXTIV 0x20
523: #define IEEE80211_WEP_EXTIVLEN 4 /* extended IV length */
524: #define IEEE80211_WEP_MICLEN 8 /* trailing MIC */
525:
526: /*
527: * Maximum acceptable MTU is:
528: * IEEE80211_MAX_LEN - WEP overhead - CRC -
529: * QoS overhead - RSN/WPA overhead
530: * Min is arbitrarily chosen > IEEE80211_MIN_LEN. The default
531: * mtu is Ethernet-compatible; it's set by ether_ifattach.
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: * The 802.11 spec says at most 2007 stations may be
545: * associated at once. For most AP's this is way more
546: * than is feasible so we use a default of 1800. This
547: * number may be overridden by the driver and/or by
548: * user configuration.
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: * RTS frame length parameters. The default is specified in
563: * the 802.11 spec. The max may be wrong for jumbo frames.
564: */
565: #define IEEE80211_RTS_DEFAULT 512
566: #define IEEE80211_RTS_MIN 1
567: #define IEEE80211_RTS_MAX IEEE80211_MAX_LEN
568:
569: /* One Time Unit (TU) is 1Kus = 1024 microseconds. */
570: #define IEEE80211_DUR_TU 1024
571:
572: /* IEEE 802.11b durations for DSSS PHY in microseconds */
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, /* open */
599: IEEE80211_AUTH_SHARED = 2, /* shared-key */
600: IEEE80211_AUTH_8021X = 3, /* 802.1x */
601: IEEE80211_AUTH_AUTO = 4, /* auto-select/accept */
602: IEEE80211_AUTH_WPA = 5, /* WPA w/ 802.1x */
603: IEEE80211_AUTH_WPA_PSK = 6, /* WPA w/ preshared key */
604: IEEE80211_AUTH_WPA2 = 7, /* WPA2 w/ 802.1x */
605: IEEE80211_AUTH_WPA2_PSK = 8 /* WPA2 w/ preshared key */
606: };
607:
608: /*
609: * The RSNA key descriptor used by IEEE 802.11 does not use the IEEE 802.1X
610: * key descriptor. Instead, it uses the key descriptor described in 8.5.2.
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: /* IEEE Std 802.1X-2004, 7.5.4 (only type EAPOL-Key is used here) */
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: /* IEEE Std 802.1X-2004, 7.6.1 */
631: #define EAPOL_KEY_DESC_RC4 1 /* deprecated */
632: #define EAPOL_KEY_DESC_IEEE80211 2
633: #define EAPOL_KEY_DESC_WPA1 254 /* non-standard WPA1 */
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) /* I */
641: #define EAPOL_KEY_KEYACK (1 << 7) /* A */
642: #define EAPOL_KEY_KEYMIC (1 << 8) /* M */
643: #define EAPOL_KEY_SECURE (1 << 9) /* S */
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: /* WPA1 compatibility */
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: /* Pairwise Transient Key (see 8.5.1.2) */
664: struct ieee80211_ptk {
665: u_int8_t kck[16]; /* Key Confirmation Key */
666: u_int8_t kek[16]; /* Key Encryption Key */
667: u_int8_t tk[32]; /* Temporal Key */
668: } __packed;
669:
670: #define IEEE80211_PMKID_LEN 16
671: #define IEEE80211_SMKID_LEN 16
672:
673: /*
674: * Key Data Encapsulation (see Table 62).
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 /* _NET80211_IEEE80211_H_ */
CVSweb