ieee80211.h revision 1.23
1/* $OpenBSD: ieee80211.h,v 1.23 2007/07/02 19:36:47 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 */ 45struct 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 */ 61struct 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 /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ 69 /* see below */ 70} __packed; 71 72struct ieee80211_qosframe { 73 u_int8_t i_fc[2]; 74 u_int8_t i_dur[2]; 75 u_int8_t i_addr1[IEEE80211_ADDR_LEN]; 76 u_int8_t i_addr2[IEEE80211_ADDR_LEN]; 77 u_int8_t i_addr3[IEEE80211_ADDR_LEN]; 78 u_int8_t i_seq[2]; 79 u_int8_t i_qos[2]; 80 /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ 81 /* see below */ 82} __packed; 83 84struct ieee80211_frame_addr4 { 85 u_int8_t i_fc[2]; 86 u_int8_t i_dur[2]; 87 u_int8_t i_addr1[IEEE80211_ADDR_LEN]; 88 u_int8_t i_addr2[IEEE80211_ADDR_LEN]; 89 u_int8_t i_addr3[IEEE80211_ADDR_LEN]; 90 u_int8_t i_seq[2]; 91 u_int8_t i_addr4[IEEE80211_ADDR_LEN]; 92} __packed; 93 94 95struct ieee80211_qosframe_addr4 { 96 u_int8_t i_fc[2]; 97 u_int8_t i_dur[2]; 98 u_int8_t i_addr1[IEEE80211_ADDR_LEN]; 99 u_int8_t i_addr2[IEEE80211_ADDR_LEN]; 100 u_int8_t i_addr3[IEEE80211_ADDR_LEN]; 101 u_int8_t i_seq[2]; 102 u_int8_t i_addr4[IEEE80211_ADDR_LEN]; 103 u_int8_t i_qos[2]; 104} __packed; 105 106/* 107 * Management Notification Frame 108 */ 109struct ieee80211_mnf { 110 u_int8_t mnf_category; 111 u_int8_t mnf_action; 112 u_int8_t mnf_dialog; 113 u_int8_t mnf_status; 114} __packed; 115#define MNF_SETUP_REQ 0 116#define MNF_SETUP_RESP 1 117#define MNF_TEARDOWN 2 118 119 120#define IEEE80211_FC0_VERSION_MASK 0x03 121#define IEEE80211_FC0_VERSION_SHIFT 0 122#define IEEE80211_FC0_VERSION_0 0x00 123#define IEEE80211_FC0_TYPE_MASK 0x0c 124#define IEEE80211_FC0_TYPE_SHIFT 2 125#define IEEE80211_FC0_TYPE_MGT 0x00 126#define IEEE80211_FC0_TYPE_CTL 0x04 127#define IEEE80211_FC0_TYPE_DATA 0x08 128 129#define IEEE80211_FC0_SUBTYPE_MASK 0xf0 130#define IEEE80211_FC0_SUBTYPE_SHIFT 4 131/* for TYPE_MGT */ 132#define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00 133#define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10 134#define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20 135#define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30 136#define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40 137#define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50 138#define IEEE80211_FC0_SUBTYPE_BEACON 0x80 139#define IEEE80211_FC0_SUBTYPE_ATIM 0x90 140#define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0 141#define IEEE80211_FC0_SUBTYPE_AUTH 0xb0 142#define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0 143/* for TYPE_CTL */ 144#define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0 145#define IEEE80211_FC0_SUBTYPE_RTS 0xb0 146#define IEEE80211_FC0_SUBTYPE_CTS 0xc0 147#define IEEE80211_FC0_SUBTYPE_ACK 0xd0 148#define IEEE80211_FC0_SUBTYPE_CF_END 0xe0 149#define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0 150/* for TYPE_DATA (bit combination) */ 151#define IEEE80211_FC0_SUBTYPE_DATA 0x00 152#define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10 153#define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20 154#define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30 155#define IEEE80211_FC0_SUBTYPE_NODATA 0x40 156#define IEEE80211_FC0_SUBTYPE_CFACK 0x50 157#define IEEE80211_FC0_SUBTYPE_CFPOLL 0x60 158#define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK 0x70 159#define IEEE80211_FC0_SUBTYPE_QOS 0x80 160 161#define IEEE80211_FC1_DIR_MASK 0x03 162#define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */ 163#define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */ 164#define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */ 165#define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */ 166 167#define IEEE80211_FC1_MORE_FRAG 0x04 168#define IEEE80211_FC1_RETRY 0x08 169#define IEEE80211_FC1_PWR_MGT 0x10 170#define IEEE80211_FC1_MORE_DATA 0x20 171#define IEEE80211_FC1_PROTECTED 0x40 172#define IEEE80211_FC1_WEP 0x40 /* pre-RSNA compat */ 173#define IEEE80211_FC1_ORDER 0x80 174 175#define IEEE80211_SEQ_FRAG_MASK 0x000f 176#define IEEE80211_SEQ_FRAG_SHIFT 0 177#define IEEE80211_SEQ_SEQ_MASK 0xfff0 178#define IEEE80211_SEQ_SEQ_SHIFT 4 179 180#define IEEE80211_NWID_LEN 32 181 182#define IEEE80211_QOS_TXOP 0x00ff 183/* bit 8 is reserved */ 184#define IEEE80211_QOS_ACKPOLICY 0x0600 185#define IEEE80211_QOS_ESOP 0x0800 186#define IEEE80211_QOS_TID 0xf000 187 188/* 189 * Control frames. 190 */ 191struct ieee80211_frame_min { 192 u_int8_t i_fc[2]; 193 u_int8_t i_dur[2]; 194 u_int8_t i_addr1[IEEE80211_ADDR_LEN]; 195 u_int8_t i_addr2[IEEE80211_ADDR_LEN]; 196 /* FCS */ 197} __packed; 198 199struct ieee80211_frame_rts { 200 u_int8_t i_fc[2]; 201 u_int8_t i_dur[2]; 202 u_int8_t i_ra[IEEE80211_ADDR_LEN]; 203 u_int8_t i_ta[IEEE80211_ADDR_LEN]; 204 /* FCS */ 205} __packed; 206 207struct ieee80211_frame_cts { 208 u_int8_t i_fc[2]; 209 u_int8_t i_dur[2]; 210 u_int8_t i_ra[IEEE80211_ADDR_LEN]; 211 /* FCS */ 212} __packed; 213 214struct ieee80211_frame_ack { 215 u_int8_t i_fc[2]; 216 u_int8_t i_dur[2]; 217 u_int8_t i_ra[IEEE80211_ADDR_LEN]; 218 /* FCS */ 219} __packed; 220 221struct ieee80211_frame_pspoll { 222 u_int8_t i_fc[2]; 223 u_int8_t i_aid[2]; 224 u_int8_t i_bssid[IEEE80211_ADDR_LEN]; 225 u_int8_t i_ta[IEEE80211_ADDR_LEN]; 226 /* FCS */ 227} __packed; 228 229struct ieee80211_frame_cfend { /* NB: also CF-End+CF-Ack */ 230 u_int8_t i_fc[2]; 231 u_int8_t i_dur[2]; /* should be zero */ 232 u_int8_t i_ra[IEEE80211_ADDR_LEN]; 233 u_int8_t i_bssid[IEEE80211_ADDR_LEN]; 234 /* FCS */ 235} __packed; 236 237/* 238 * BEACON management packets 239 * 240 * octet timestamp[8] 241 * octet beacon interval[2] 242 * octet capability information[2] 243 * information element 244 * octet elemid 245 * octet length 246 * octet information[length] 247 */ 248 249typedef u_int8_t *ieee80211_mgt_beacon_t; 250 251#define IEEE80211_BEACON_INTERVAL(beacon) \ 252 ((beacon)[8] | ((beacon)[9] << 8)) 253#define IEEE80211_BEACON_CAPABILITY(beacon) \ 254 ((beacon)[10] | ((beacon)[11] << 8)) 255 256#define IEEE80211_CAPINFO_ESS 0x0001 257#define IEEE80211_CAPINFO_IBSS 0x0002 258#define IEEE80211_CAPINFO_CF_POLLABLE 0x0004 259#define IEEE80211_CAPINFO_CF_POLLREQ 0x0008 260#define IEEE80211_CAPINFO_PRIVACY 0x0010 261#define IEEE80211_CAPINFO_SHORT_PREAMBLE 0x0020 262#define IEEE80211_CAPINFO_PBCC 0x0040 263#define IEEE80211_CAPINFO_CHNL_AGILITY 0x0080 264#define IEEE80211_CAPINFO_SPECTRUM_MGMT 0x0100 265#define IEEE80211_CAPINFO_QOS 0x0200 266#define IEEE80211_CAPINFO_SHORT_SLOTTIME 0x0400 267#define IEEE80211_CAPINFO_APSD 0x0800 268/* bit 12 is reserved */ 269#define IEEE80211_CAPINFO_DSSSOFDM 0x2000 270#define IEEE80211_CAPINFO_DELAYED_B_ACK 0x4000 271#define IEEE80211_CAPINFO_IMMEDIATE_B_ACK 0x8000 272#define IEEE80211_CAPINFO_BITS \ 273 "\10\01ESS\02IBSS\03CF_POLLABLE\04CF_POLLREQ" \ 274 "\05PRIVACY\06SHORT_PREAMBLE\07PBCC\10CHNL_AGILITY" \ 275 "\11SPECTRUM_MGMT\12QOS\13SHORT_SLOTTIME\14APSD" \ 276 "\16DSSSOFDM\17DELAYED_B_ACK\20IMMEDIATE_B_ACK" 277 278/* 279 * Channel attributes 280 */ 281#define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */ 282#define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */ 283#define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */ 284#define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */ 285#define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */ 286#define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */ 287#define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ 288#define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */ 289#define IEEE80211_CHAN_XR 0x1000 /* Extended range OFDM channel */ 290 291/* 292 * Useful combinations of channel characteristics. 293 */ 294#define IEEE80211_CHAN_FHSS \ 295 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK) 296#define IEEE80211_CHAN_A \ 297 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM) 298#define IEEE80211_CHAN_B \ 299 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK) 300#define IEEE80211_CHAN_PUREG \ 301 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM) 302#define IEEE80211_CHAN_G \ 303 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN) 304#define IEEE80211_CHAN_T \ 305 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO) 306#define IEEE80211_CHAN_TG \ 307 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO) 308 309/* 310 * 802.11i/WPA information element (maximally sized). 311 */ 312struct ieee80211_ie_wpa { 313 u_int8_t wpa_id; /* IEEE80211_ELEMID_VENDOR */ 314 u_int8_t wpa_len; /* length in bytes */ 315 u_int8_t wpa_oui[3]; /* 0x00, 0x50, 0xf2 */ 316 u_int8_t wpa_type; /* OUI type */ 317 u_int16_t wpa_version; /* spec revision */ 318 u_int32_t wpa_mcipher[1]; /* multicast/group key cipher */ 319 u_int16_t wpa_uciphercnt; /* # pairwise key ciphers */ 320 u_int32_t wpa_uciphers[8];/* ciphers */ 321 u_int16_t wpa_authselcnt; /* authentication selector cnt*/ 322 u_int32_t wpa_authsels[8];/* selectors */ 323 u_int16_t wpa_caps; /* 802.11i capabilities */ 324 u_int16_t wpa_pmkidcnt; /* 802.11i pmkid count */ 325 u_int16_t wpa_pmkids[8]; /* 802.11i pmkids */ 326} __packed; 327 328/* 329 * Management information element payloads 330 */ 331union ieee80211_information { 332 char ssid[IEEE80211_NWID_LEN+1]; 333 struct rates { 334 u_int8_t *p; 335 } rates; 336 struct fh { 337 u_int16_t dwell; 338 u_int8_t set; 339 u_int8_t pattern; 340 u_int8_t index; 341 } fh; 342 struct ds { 343 u_int8_t channel; 344 } ds; 345 struct cf { 346 u_int8_t count; 347 u_int8_t period; 348 u_int8_t maxdur[2]; 349 u_int8_t dur[2]; 350 } cf; 351 struct tim { 352 u_int8_t count; 353 u_int8_t period; 354 u_int8_t bitctl; 355 /* u_int8_t pvt[251]; The driver needs to use this. */ 356 } tim; 357 struct ibss { 358 u_int16_t atim; 359 } ibss; 360 struct challenge { 361 u_int8_t *p; 362 u_int8_t len; 363 } challenge; 364 struct erp { 365 u_int8_t flags; 366 } erp; 367 struct country { 368 u_int8_t cc[3]; /* ISO CC+(I)ndoor/(O)utdoor */ 369 struct { 370 u_int8_t schan; /* starting channel */ 371 u_int8_t nchan; /* number channels */ 372 u_int8_t maxtxpwr; 373 } band[4]; /* up to 4 sub bands */ 374 } country; 375 struct ath { 376 u_int8_t flags; 377 } ath; 378}; 379 380enum { 381 IEEE80211_ELEMID_SSID = 0, 382 IEEE80211_ELEMID_RATES = 1, 383 IEEE80211_ELEMID_FHPARMS = 2, 384 IEEE80211_ELEMID_DSPARMS = 3, 385 IEEE80211_ELEMID_CFPARMS = 4, 386 IEEE80211_ELEMID_TIM = 5, 387 IEEE80211_ELEMID_IBSSPARMS = 6, 388 IEEE80211_ELEMID_COUNTRY = 7, 389 IEEE80211_ELEMID_QBSS_LOAD = 11, 390 IEEE80211_ELEMID_EDCAPARMS = 12, 391 IEEE80211_ELEMID_CHALLENGE = 16, 392 /* 17-31 reserved for challenge text extension */ 393 IEEE80211_ELEMID_ERP = 42, 394 IEEE80211_ELEMID_QOS_CAP = 46, 395 IEEE80211_ELEMID_RSN = 48, 396 IEEE80211_ELEMID_XRATES = 50, 397 IEEE80211_ELEMID_TPC = 150, 398 IEEE80211_ELEMID_CCKM = 156, 399 IEEE80211_ELEMID_VENDOR = 221 /* vendor private */ 400}; 401 402#define IEEE80211_CHALLENGE_LEN 128 403 404#define IEEE80211_RATE_BASIC 0x80 405#define IEEE80211_RATE_VAL 0x7f 406#define IEEE80211_RATE_SIZE 8 /* 802.11 standard */ 407#define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */ 408 409/* ERP information element flags */ 410#define IEEE80211_ERP_NON_ERP_PRESENT 0x01 411#define IEEE80211_ERP_USE_PROTECTION 0x02 412#define IEEE80211_ERP_BARKER_MODE 0x04 413 414/* 415 * 802.11e EDCA Access Categories. 416 */ 417enum ieee80211_edca_ac { 418 EDCA_AC_BK = 1, /* Background */ 419 EDCA_AC_BE = 0, /* Best Effort */ 420 EDCA_AC_VI = 2, /* Video */ 421 EDCA_AC_VO = 3 /* Voice */ 422}; 423#define EDCA_NUM_AC 4 424 425/* number of TID values (traffic identifier) */ 426#define IEEE80211_NUM_TID 16 427 428/* Atheros private advanced capabilities info */ 429#define ATHEROS_CAP_TURBO_PRIME 0x01 430#define ATHEROS_CAP_COMPRESSION 0x02 431#define ATHEROS_CAP_FAST_FRAME 0x04 432/* bits 3-6 reserved */ 433#define ATHEROS_CAP_BOOST 0x80 434 435/* Organizationally Unique Identifiers */ 436/* See http://standards.ieee.org/regauth/oui/oui.txt for a list */ 437#define ATHEROS_OUI ((const u_int8_t[]){ 0x00, 0x03, 0x7f }) 438#define BROADCOM_OUI ((const u_int8_t[]){ 0c00, 0x90, 0x4c }) 439#define IEEE80211_OUI ((const u_int8_t[]){ 0x00, 0x0f, 0xac }) 440#define MICROSOFT_OUI ((const u_int8_t[]){ 0x00, 0x50, 0xf2 }) 441 442#define IEEE80211_AUTH_ALG_OPEN 0x0000 443#define IEEE80211_AUTH_ALG_SHARED 0x0001 444#define IEEE80211_AUTH_ALG_LEAP 0x0080 445 446enum { 447 IEEE80211_AUTH_OPEN_REQUEST = 1, 448 IEEE80211_AUTH_OPEN_RESPONSE = 2 449}; 450 451enum { 452 IEEE80211_AUTH_SHARED_REQUEST = 1, 453 IEEE80211_AUTH_SHARED_CHALLENGE = 2, 454 IEEE80211_AUTH_SHARED_RESPONSE = 3, 455 IEEE80211_AUTH_SHARED_PASS = 4 456}; 457 458/* 459 * Reason codes (see Table 22). 460 */ 461enum { 462 IEEE80211_REASON_UNSPECIFIED = 1, 463 IEEE80211_REASON_AUTH_EXPIRE = 2, 464 IEEE80211_REASON_AUTH_LEAVE = 3, 465 IEEE80211_REASON_ASSOC_EXPIRE = 4, 466 IEEE80211_REASON_ASSOC_TOOMANY = 5, 467 IEEE80211_REASON_NOT_AUTHED = 6, 468 IEEE80211_REASON_NOT_ASSOCED = 7, 469 IEEE80211_REASON_ASSOC_LEAVE = 8, 470 IEEE80211_REASON_ASSOC_NOT_AUTHED = 9, 471 472 IEEE80211_REASON_IE_INVALID = 13, 473 IEEE80211_REASON_MIC_FAILURE = 14, 474 475 IEEE80211_REASON_BAD_GROUP_CIPHER = 18, 476 IEEE80211_REASON_BAD_PAIRWISE_CIPHER = 19, 477 IEEE80211_REASON_BAD_AKMP = 20, 478 IEEE80211_REASON_RSN_IE_VER_UNSUP = 21, 479 IEEE80211_REASON_RSN_IE_BAD_CAP = 22, 480 481 IEEE80211_REASON_CIPHER_REJ = 24 482}; 483 484/* 485 * Status codes (see Table 23). 486 */ 487enum { 488 IEEE80211_STATUS_SUCCESS = 0, 489 IEEE80211_STATUS_UNSPECIFIED = 1, 490 IEEE80211_STATUS_CAPINFO = 10, 491 IEEE80211_STATUS_NOT_ASSOCED = 11, 492 IEEE80211_STATUS_OTHER = 12, 493 IEEE80211_STATUS_ALG = 13, 494 IEEE80211_STATUS_SEQUENCE = 14, 495 IEEE80211_STATUS_CHALLENGE = 15, 496 IEEE80211_STATUS_TIMEOUT = 16, 497 IEEE80211_STATUS_TOOMANY = 17, 498 IEEE80211_STATUS_BASIC_RATE = 18, 499 IEEE80211_STATUS_SP_REQUIRED = 19, 500 IEEE80211_STATUS_PBCC_REQUIRED = 20, 501 IEEE80211_STATUS_CA_REQUIRED = 21, 502 IEEE80211_STATUS_TOO_MANY_STATIONS = 22, 503 IEEE80211_STATUS_RATES = 23, 504 IEEE80211_STATUS_SHORTSLOT_REQUIRED = 25, 505 IEEE80211_STATUS_DSSSOFDM_REQUIRED = 26 506}; 507 508#define IEEE80211_WEP_KEYLEN 5 /* 40bit */ 509#define IEEE80211_WEP_NKID 4 /* number of key ids */ 510 511/* WEP header constants */ 512#define IEEE80211_WEP_IVLEN 3 /* 24bit */ 513#define IEEE80211_WEP_KIDLEN 1 /* 1 octet */ 514#define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */ 515#define IEEE80211_CRC_LEN 4 516#define IEEE80211_WEP_TOTLEN (IEEE80211_WEP_IVLEN + \ 517 IEEE80211_WEP_KIDLEN + \ 518 IEEE80211_WEP_CRCLEN) 519 520/* 521 * 802.11i defines an extended IV for use with non-WEP ciphers. 522 * When the EXTIV bit is set in the key id byte an additional 523 * 4 bytes immediately follow the IV for TKIP. For CCMP the 524 * EXTIV bit is likewise set but the 8 bytes represent the 525 * CCMP header rather than IV+extended-IV. 526 */ 527#define IEEE80211_WEP_EXTIV 0x20 528#define IEEE80211_WEP_EXTIVLEN 4 /* extended IV length */ 529#define IEEE80211_WEP_MICLEN 8 /* trailing MIC */ 530 531/* 532 * Maximum acceptable MTU is: 533 * IEEE80211_MAX_LEN - WEP overhead - CRC - 534 * QoS overhead - RSN/WPA overhead 535 * Min is arbitrarily chosen > IEEE80211_MIN_LEN. The default 536 * mtu is Ethernet-compatible; it's set by ether_ifattach. 537 */ 538#define IEEE80211_MTU_MAX 2290 539#define IEEE80211_MTU_MIN 32 540 541#define IEEE80211_MAX_LEN (2300 + IEEE80211_CRC_LEN + \ 542 (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN)) 543#define IEEE80211_ACK_LEN \ 544 (sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN) 545#define IEEE80211_MIN_LEN \ 546 (sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN) 547 548/* 549 * The 802.11 spec says at most 2007 stations may be 550 * associated at once. For most AP's this is way more 551 * than is feasible so we use a default of 1800. This 552 * number may be overridden by the driver and/or by 553 * user configuration. 554 */ 555#define IEEE80211_AID_MAX 2007 556#define IEEE80211_AID_DEF 1800 557 558#define IEEE80211_AID(b) ((b) &~ 0xc000) 559#define IEEE80211_AID_SET(b, w) \ 560 ((w)[IEEE80211_AID(b) / 32] |= (1 << (IEEE80211_AID(b) % 32))) 561#define IEEE80211_AID_CLR(b, w) \ 562 ((w)[IEEE80211_AID(b) / 32] &= ~(1 << (IEEE80211_AID(b) % 32))) 563#define IEEE80211_AID_ISSET(b, w) \ 564 ((w)[IEEE80211_AID(b) / 32] & (1 << (IEEE80211_AID(b) % 32))) 565 566/* 567 * RTS frame length parameters. The default is specified in 568 * the 802.11 spec. The max may be wrong for jumbo frames. 569 */ 570#define IEEE80211_RTS_DEFAULT 512 571#define IEEE80211_RTS_MIN 1 572#define IEEE80211_RTS_MAX IEEE80211_MAX_LEN 573 574/* One Time Unit (TU) is 1Kus = 1024 microseconds. */ 575#define IEEE80211_DUR_TU 1024 576 577/* IEEE 802.11b durations for DSSS PHY in microseconds */ 578#define IEEE80211_DUR_DS_LONG_PREAMBLE 144 579#define IEEE80211_DUR_DS_SHORT_PREAMBLE 72 580#define IEEE80211_DUR_DS_PREAMBLE_DIFFERENCE \ 581 (IEEE80211_DUR_DS_LONG_PREAMBLE - IEEE80211_DUR_DS_SHORT_PREAMBLE) 582#define IEEE80211_DUR_DS_FAST_PLCPHDR 24 583#define IEEE80211_DUR_DS_SLOW_PLCPHDR 48 584#define IEEE80211_DUR_DS_PLCPHDR_DIFFERENCE \ 585 (IEEE80211_DUR_DS_SLOW_PLCPHDR - IEEE80211_DUR_DS_FAST_PLCPHDR) 586#define IEEE80211_DUR_DS_SLOW_ACK 112 587#define IEEE80211_DUR_DS_FAST_ACK 56 588#define IEEE80211_DUR_DS_SLOW_CTS 112 589#define IEEE80211_DUR_DS_FAST_CTS 56 590#define IEEE80211_DUR_DS_SLOT 20 591#define IEEE80211_DUR_DS_SIFS 10 592#define IEEE80211_DUR_DS_PIFS (IEEE80211_DUR_DS_SIFS + IEEE80211_DUR_DS_SLOT) 593#define IEEE80211_DUR_DS_DIFS (IEEE80211_DUR_DS_SIFS + \ 594 2 * IEEE80211_DUR_DS_SLOT) 595#define IEEE80211_DUR_DS_EIFS (IEEE80211_DUR_DS_SIFS + \ 596 IEEE80211_DUR_DS_SLOW_ACK + \ 597 IEEE80211_DUR_DS_LONG_PREAMBLE + \ 598 IEEE80211_DUR_DS_SLOW_PLCPHDR + \ 599 IEEE80211_DUR_DIFS) 600 601enum { 602 IEEE80211_AUTH_NONE = 0, 603 IEEE80211_AUTH_OPEN = 1, /* open */ 604 IEEE80211_AUTH_SHARED = 2, /* shared-key */ 605 IEEE80211_AUTH_8021X = 3, /* 802.1x */ 606 IEEE80211_AUTH_AUTO = 4, /* auto-select/accept */ 607 IEEE80211_AUTH_WPA = 5, /* WPA w/ 802.1x */ 608 IEEE80211_AUTH_WPA_PSK = 6, /* WPA w/ preshared key */ 609 IEEE80211_AUTH_WPA2 = 7, /* WPA2 w/ 802.1x */ 610 IEEE80211_AUTH_WPA2_PSK = 8 /* WPA2 w/ preshared key */ 611}; 612 613#endif /* _NET80211_IEEE80211_H_ */ 614