ieee80211.h revision 1.19
1/* $OpenBSD: ieee80211.h,v 1.19 2007/06/21 19:45:45 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_WEP 0x40 172#define IEEE80211_FC1_ORDER 0x80 173 174#define IEEE80211_SEQ_FRAG_MASK 0x000f 175#define IEEE80211_SEQ_FRAG_SHIFT 0 176#define IEEE80211_SEQ_SEQ_MASK 0xfff0 177#define IEEE80211_SEQ_SEQ_SHIFT 4 178 179#define IEEE80211_NWID_LEN 32 180 181#define IEEE80211_QOS_TXOP 0x00ff 182/* bit 8 is reserved */ 183#define IEEE80211_QOS_ACKPOLICY 0x0600 184#define IEEE80211_QOS_ESOP 0x0800 185#define IEEE80211_QOS_TID 0xf000 186 187/* 188 * Control frames. 189 */ 190struct ieee80211_frame_min { 191 u_int8_t i_fc[2]; 192 u_int8_t i_dur[2]; 193 u_int8_t i_addr1[IEEE80211_ADDR_LEN]; 194 u_int8_t i_addr2[IEEE80211_ADDR_LEN]; 195 /* FCS */ 196} __packed; 197 198struct ieee80211_frame_rts { 199 u_int8_t i_fc[2]; 200 u_int8_t i_dur[2]; 201 u_int8_t i_ra[IEEE80211_ADDR_LEN]; 202 u_int8_t i_ta[IEEE80211_ADDR_LEN]; 203 /* FCS */ 204} __packed; 205 206struct ieee80211_frame_cts { 207 u_int8_t i_fc[2]; 208 u_int8_t i_dur[2]; 209 u_int8_t i_ra[IEEE80211_ADDR_LEN]; 210 /* FCS */ 211} __packed; 212 213struct ieee80211_frame_ack { 214 u_int8_t i_fc[2]; 215 u_int8_t i_dur[2]; 216 u_int8_t i_ra[IEEE80211_ADDR_LEN]; 217 /* FCS */ 218} __packed; 219 220struct ieee80211_frame_pspoll { 221 u_int8_t i_fc[2]; 222 u_int8_t i_aid[2]; 223 u_int8_t i_bssid[IEEE80211_ADDR_LEN]; 224 u_int8_t i_ta[IEEE80211_ADDR_LEN]; 225 /* FCS */ 226} __packed; 227 228struct ieee80211_frame_cfend { /* NB: also CF-End+CF-Ack */ 229 u_int8_t i_fc[2]; 230 u_int8_t i_dur[2]; /* should be zero */ 231 u_int8_t i_ra[IEEE80211_ADDR_LEN]; 232 u_int8_t i_bssid[IEEE80211_ADDR_LEN]; 233 /* FCS */ 234} __packed; 235 236/* 237 * BEACON management packets 238 * 239 * octet timestamp[8] 240 * octet beacon interval[2] 241 * octet capability information[2] 242 * information element 243 * octet elemid 244 * octet length 245 * octet information[length] 246 */ 247 248typedef u_int8_t *ieee80211_mgt_beacon_t; 249 250#define IEEE80211_BEACON_INTERVAL(beacon) \ 251 ((beacon)[8] | ((beacon)[9] << 8)) 252#define IEEE80211_BEACON_CAPABILITY(beacon) \ 253 ((beacon)[10] | ((beacon)[11] << 8)) 254 255#define IEEE80211_CAPINFO_ESS 0x0001 256#define IEEE80211_CAPINFO_IBSS 0x0002 257#define IEEE80211_CAPINFO_CF_POLLABLE 0x0004 258#define IEEE80211_CAPINFO_CF_POLLREQ 0x0008 259#define IEEE80211_CAPINFO_PRIVACY 0x0010 260#define IEEE80211_CAPINFO_SHORT_PREAMBLE 0x0020 261#define IEEE80211_CAPINFO_PBCC 0x0040 262#define IEEE80211_CAPINFO_CHNL_AGILITY 0x0080 263/* bits 8-9 are reserved */ 264#define IEEE80211_CAPINFO_SHORT_SLOTTIME 0x0400 265#define IEEE80211_CAPINFO_RSN 0x0800 266/* bit 12 is reserved */ 267#define IEEE80211_CAPINFO_DSSSOFDM 0x2000 268/* bits 14-15 are reserved */ 269#define IEEE80211_CAPINFO_BITS \ 270 "\20\01ESS\02IBSS\03POLLABLE\04POLLREQ\05PRIVACY" \ 271 "\06SHORT_PREAMBLE\07PBCC\10CHNL_AGILITY" \ 272 "\13SHORT_SLOTTIME\14RSN\16DSSSOFDM" 273 274/* 275 * Channel attributes 276 */ 277#define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */ 278#define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */ 279#define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */ 280#define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */ 281#define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */ 282#define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */ 283#define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ 284#define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */ 285#define IEEE80211_CHAN_XR 0x1000 /* Extended range OFDM channel */ 286 287/* 288 * Useful combinations of channel characteristics. 289 */ 290#define IEEE80211_CHAN_FHSS \ 291 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK) 292#define IEEE80211_CHAN_A \ 293 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM) 294#define IEEE80211_CHAN_B \ 295 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK) 296#define IEEE80211_CHAN_PUREG \ 297 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM) 298#define IEEE80211_CHAN_G \ 299 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN) 300#define IEEE80211_CHAN_T \ 301 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO) 302#define IEEE80211_CHAN_TG \ 303 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO) 304 305/* 306 * 802.11i/WPA information element (maximally sized). 307 */ 308struct ieee80211_ie_wpa { 309 u_int8_t wpa_id; /* IEEE80211_ELEMID_VENDOR */ 310 u_int8_t wpa_len; /* length in bytes */ 311 u_int8_t wpa_oui[3]; /* 0x00, 0x50, 0xf2 */ 312 u_int8_t wpa_type; /* OUI type */ 313 u_int16_t wpa_version; /* spec revision */ 314 u_int32_t wpa_mcipher[1]; /* multicast/group key cipher */ 315 u_int16_t wpa_uciphercnt; /* # pairwise key ciphers */ 316 u_int32_t wpa_uciphers[8];/* ciphers */ 317 u_int16_t wpa_authselcnt; /* authentication selector cnt*/ 318 u_int32_t wpa_authsels[8];/* selectors */ 319 u_int16_t wpa_caps; /* 802.11i capabilities */ 320 u_int16_t wpa_pmkidcnt; /* 802.11i pmkid count */ 321 u_int16_t wpa_pmkids[8]; /* 802.11i pmkids */ 322} __packed; 323 324/* 325 * Management information element payloads 326 */ 327union ieee80211_information { 328 char ssid[IEEE80211_NWID_LEN+1]; 329 struct rates { 330 u_int8_t *p; 331 } rates; 332 struct fh { 333 u_int16_t dwell; 334 u_int8_t set; 335 u_int8_t pattern; 336 u_int8_t index; 337 } fh; 338 struct ds { 339 u_int8_t channel; 340 } ds; 341 struct cf { 342 u_int8_t count; 343 u_int8_t period; 344 u_int8_t maxdur[2]; 345 u_int8_t dur[2]; 346 } cf; 347 struct tim { 348 u_int8_t count; 349 u_int8_t period; 350 u_int8_t bitctl; 351 /* u_int8_t pvt[251]; The driver needs to use this. */ 352 } tim; 353 struct ibss { 354 u_int16_t atim; 355 } ibss; 356 struct challenge { 357 u_int8_t *p; 358 u_int8_t len; 359 } challenge; 360 struct erp { 361 u_int8_t flags; 362 } erp; 363 struct country { 364 u_int8_t cc[3]; /* ISO CC+(I)ndoor/(O)utdoor */ 365 struct { 366 u_int8_t schan; /* starting channel */ 367 u_int8_t nchan; /* number channels */ 368 u_int8_t maxtxpwr; 369 } band[4]; /* up to 4 sub bands */ 370 } country; 371 struct ath { 372 u_int8_t flags; 373 } ath; 374}; 375 376enum { 377 IEEE80211_ELEMID_SSID = 0, 378 IEEE80211_ELEMID_RATES = 1, 379 IEEE80211_ELEMID_FHPARMS = 2, 380 IEEE80211_ELEMID_DSPARMS = 3, 381 IEEE80211_ELEMID_CFPARMS = 4, 382 IEEE80211_ELEMID_TIM = 5, 383 IEEE80211_ELEMID_IBSSPARMS = 6, 384 IEEE80211_ELEMID_COUNTRY = 7, 385 IEEE80211_ELEMID_QBSS_LOAD = 11, 386 IEEE80211_ELEMID_EDCAPARMS = 12, 387 IEEE80211_ELEMID_CHALLENGE = 16, 388 /* 17-31 reserved for challenge text extension */ 389 IEEE80211_ELEMID_ERP = 42, 390 IEEE80211_ELEMID_QOS_CAP = 46, 391 IEEE80211_ELEMID_RSN = 48, 392 IEEE80211_ELEMID_XRATES = 50, 393 IEEE80211_ELEMID_TPC = 150, 394 IEEE80211_ELEMID_CCKM = 156, 395 IEEE80211_ELEMID_VENDOR = 221 /* vendor private */ 396}; 397 398#define IEEE80211_CHALLENGE_LEN 128 399 400#define IEEE80211_RATE_BASIC 0x80 401#define IEEE80211_RATE_VAL 0x7f 402#define IEEE80211_RATE_SIZE 8 /* 802.11 standard */ 403#define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */ 404 405/* ERP information element flags */ 406#define IEEE80211_ERP_NON_ERP_PRESENT 0x01 407#define IEEE80211_ERP_USE_PROTECTION 0x02 408#define IEEE80211_ERP_BARKER_MODE 0x04 409 410/* 411 * 802.11e EDCA Access Categories. 412 */ 413enum ieee80211_edca_ac { 414 EDCA_AC_BK = 1, /* Background */ 415 EDCA_AC_BE = 0, /* Best Effort */ 416 EDCA_AC_VI = 2, /* Video */ 417 EDCA_AC_VO = 3 /* Voice */ 418}; 419#define EDCA_NUM_AC 4 420 421/* number of TID values (traffic identifier) */ 422#define IEEE80211_NUM_TID 16 423 424/* Atheros private advanced capabilities info */ 425#define ATHEROS_CAP_TURBO_PRIME 0x01 426#define ATHEROS_CAP_COMPRESSION 0x02 427#define ATHEROS_CAP_FAST_FRAME 0x04 428/* bits 3-6 reserved */ 429#define ATHEROS_CAP_BOOST 0x80 430 431#define WPA_CSE_NULL 0x00 432#define WPA_CSE_WEP40 0x01 433#define WPA_CSE_TKIP 0x02 434#define WPA_CSE_WRAP 0x03 /* WPA2/802.11i */ 435#define WPA_CSE_CCMP 0x04 436#define WPA_CSE_WEP104 0x05 437 438#define WPA_ASE_NONE 0x00 439#define WPA_ASE_8021X_UNSPEC 0x01 440#define WPA_ASE_8021X_PSK 0x02 441 442#define RSN_CSE_NULL 0x00 443#define RSN_CSE_WEP40 0x01 444#define RSN_CSE_TKIP 0x02 445#define RSN_CSE_WRAP 0x03 446#define RSN_CSE_CCMP 0x04 447#define RSN_CSE_WEP104 0x05 448 449#define RSN_ASE_NONE 0x00 450#define RSN_ASE_8021X_UNSPEC 0x01 451#define RSN_ASE_8021X_PSK 0x02 452 453/* Organizationally Unique Identifiers */ 454/* See http://standards.ieee.org/regauth/oui/oui.txt for a list */ 455#define ATHEROS_OUI ((const u_int8_t[]){ 0x00, 0x03, 0x7f }) 456#define BROADCOM_OUI ((const u_int8_t[]){ 0c00, 0x90, 0x4c }) 457#define IEEE80211_OUI ((const u_int8_t[]){ 0x00, 0x0f, 0xac }) 458#define MICROSOFT_OUI ((const u_int8_t[]){ 0x00, 0x50, 0xf2 }) 459 460/* 461 * AUTH management packets 462 * 463 * octet algo[2] 464 * octet seq[2] 465 * octet status[2] 466 * octet chal.id 467 * octet chal.length 468 * octet chal.text[253] 469 */ 470 471typedef u_int8_t *ieee80211_mgt_auth_t; 472 473#define IEEE80211_AUTH_ALGORITHM(auth) \ 474 ((auth)[0] | ((auth)[1] << 8)) 475#define IEEE80211_AUTH_TRANSACTION(auth) \ 476 ((auth)[2] | ((auth)[3] << 8)) 477#define IEEE80211_AUTH_STATUS(auth) \ 478 ((auth)[4] | ((auth)[5] << 8)) 479 480#define IEEE80211_AUTH_ALG_OPEN 0x0000 481#define IEEE80211_AUTH_ALG_SHARED 0x0001 482#define IEEE80211_AUTH_ALG_LEAP 0x0080 483 484enum { 485 IEEE80211_AUTH_OPEN_REQUEST = 1, 486 IEEE80211_AUTH_OPEN_RESPONSE = 2 487}; 488 489enum { 490 IEEE80211_AUTH_SHARED_REQUEST = 1, 491 IEEE80211_AUTH_SHARED_CHALLENGE = 2, 492 IEEE80211_AUTH_SHARED_RESPONSE = 3, 493 IEEE80211_AUTH_SHARED_PASS = 4 494}; 495 496/* 497 * Reason codes 498 * 499 * Unlisted codes are reserved 500 */ 501 502enum { 503 IEEE80211_REASON_UNSPECIFIED = 1, 504 IEEE80211_REASON_AUTH_EXPIRE = 2, 505 IEEE80211_REASON_AUTH_LEAVE = 3, 506 IEEE80211_REASON_ASSOC_EXPIRE = 4, 507 IEEE80211_REASON_ASSOC_TOOMANY = 5, 508 IEEE80211_REASON_NOT_AUTHED = 6, 509 IEEE80211_REASON_NOT_ASSOCED = 7, 510 IEEE80211_REASON_ASSOC_LEAVE = 8, 511 IEEE80211_REASON_ASSOC_NOT_AUTHED = 9, 512 513 IEEE80211_REASON_RSN_REQUIRED = 11, 514 IEEE80211_REASON_RSN_INCONSISTENT = 12, 515 IEEE80211_REASON_IE_INVALID = 13, 516 IEEE80211_REASON_MIC_FAILURE = 14, 517 518 IEEE80211_STATUS_SUCCESS = 0, 519 IEEE80211_STATUS_UNSPECIFIED = 1, 520 IEEE80211_STATUS_CAPINFO = 10, 521 IEEE80211_STATUS_NOT_ASSOCED = 11, 522 IEEE80211_STATUS_OTHER = 12, 523 IEEE80211_STATUS_ALG = 13, 524 IEEE80211_STATUS_SEQUENCE = 14, 525 IEEE80211_STATUS_CHALLENGE = 15, 526 IEEE80211_STATUS_TIMEOUT = 16, 527 IEEE80211_STATUS_TOOMANY = 17, 528 IEEE80211_STATUS_BASIC_RATE = 18, 529 IEEE80211_STATUS_SP_REQUIRED = 19, 530 IEEE80211_STATUS_PBCC_REQUIRED = 20, 531 IEEE80211_STATUS_CA_REQUIRED = 21, 532 IEEE80211_STATUS_TOO_MANY_STATIONS = 22, 533 IEEE80211_STATUS_RATES = 23, 534 IEEE80211_STATUS_SHORTSLOT_REQUIRED = 25, 535 IEEE80211_STATUS_DSSSOFDM_REQUIRED = 26 536}; 537 538#define IEEE80211_WEP_KEYLEN 5 /* 40bit */ 539#define IEEE80211_WEP_NKID 4 /* number of key ids */ 540 541/* WEP header constants */ 542#define IEEE80211_WEP_IVLEN 3 /* 24bit */ 543#define IEEE80211_WEP_KIDLEN 1 /* 1 octet */ 544#define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */ 545#define IEEE80211_CRC_LEN 4 546#define IEEE80211_WEP_TOTLEN (IEEE80211_WEP_IVLEN + \ 547 IEEE80211_WEP_KIDLEN + \ 548 IEEE80211_WEP_CRCLEN) 549 550/* 551 * 802.11i defines an extended IV for use with non-WEP ciphers. 552 * When the EXTIV bit is set in the key id byte an additional 553 * 4 bytes immediately follow the IV for TKIP. For CCMP the 554 * EXTIV bit is likewise set but the 8 bytes represent the 555 * CCMP header rather than IV+extended-IV. 556 */ 557#define IEEE80211_WEP_EXTIV 0x20 558#define IEEE80211_WEP_EXTIVLEN 4 /* extended IV length */ 559#define IEEE80211_WEP_MICLEN 8 /* trailing MIC */ 560 561/* 562 * Maximum acceptable MTU is: 563 * IEEE80211_MAX_LEN - WEP overhead - CRC - 564 * QoS overhead - RSN/WPA overhead 565 * Min is arbitrarily chosen > IEEE80211_MIN_LEN. The default 566 * mtu is Ethernet-compatible; it's set by ether_ifattach. 567 */ 568#define IEEE80211_MTU_MAX 2290 569#define IEEE80211_MTU_MIN 32 570 571#define IEEE80211_MAX_LEN (2300 + IEEE80211_CRC_LEN + \ 572 (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN)) 573#define IEEE80211_ACK_LEN \ 574 (sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN) 575#define IEEE80211_MIN_LEN \ 576 (sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN) 577 578/* 579 * The 802.11 spec says at most 2007 stations may be 580 * associated at once. For most AP's this is way more 581 * than is feasible so we use a default of 1800. This 582 * number may be overridden by the driver and/or by 583 * user configuration. 584 */ 585#define IEEE80211_AID_MAX 2007 586#define IEEE80211_AID_DEF 1800 587 588#define IEEE80211_AID(b) ((b) &~ 0xc000) 589#define IEEE80211_AID_SET(b, w) \ 590 ((w)[IEEE80211_AID(b) / 32] |= (1 << (IEEE80211_AID(b) % 32))) 591#define IEEE80211_AID_CLR(b, w) \ 592 ((w)[IEEE80211_AID(b) / 32] &= ~(1 << (IEEE80211_AID(b) % 32))) 593#define IEEE80211_AID_ISSET(b, w) \ 594 ((w)[IEEE80211_AID(b) / 32] & (1 << (IEEE80211_AID(b) % 32))) 595 596/* 597 * RTS frame length parameters. The default is specified in 598 * the 802.11 spec. The max may be wrong for jumbo frames. 599 */ 600#define IEEE80211_RTS_DEFAULT 512 601#define IEEE80211_RTS_MIN 1 602#define IEEE80211_RTS_MAX IEEE80211_MAX_LEN 603 604/* One Time Unit (TU) is 1Kus = 1024 microseconds. */ 605#define IEEE80211_DUR_TU 1024 606 607/* IEEE 802.11b durations for DSSS PHY in microseconds */ 608#define IEEE80211_DUR_DS_LONG_PREAMBLE 144 609#define IEEE80211_DUR_DS_SHORT_PREAMBLE 72 610#define IEEE80211_DUR_DS_PREAMBLE_DIFFERENCE \ 611 (IEEE80211_DUR_DS_LONG_PREAMBLE - IEEE80211_DUR_DS_SHORT_PREAMBLE) 612#define IEEE80211_DUR_DS_FAST_PLCPHDR 24 613#define IEEE80211_DUR_DS_SLOW_PLCPHDR 48 614#define IEEE80211_DUR_DS_PLCPHDR_DIFFERENCE \ 615 (IEEE80211_DUR_DS_SLOW_PLCPHDR - IEEE80211_DUR_DS_FAST_PLCPHDR) 616#define IEEE80211_DUR_DS_SLOW_ACK 112 617#define IEEE80211_DUR_DS_FAST_ACK 56 618#define IEEE80211_DUR_DS_SLOW_CTS 112 619#define IEEE80211_DUR_DS_FAST_CTS 56 620#define IEEE80211_DUR_DS_SLOT 20 621#define IEEE80211_DUR_DS_SIFS 10 622#define IEEE80211_DUR_DS_PIFS (IEEE80211_DUR_DS_SIFS + IEEE80211_DUR_DS_SLOT) 623#define IEEE80211_DUR_DS_DIFS (IEEE80211_DUR_DS_SIFS + \ 624 2 * IEEE80211_DUR_DS_SLOT) 625#define IEEE80211_DUR_DS_EIFS (IEEE80211_DUR_DS_SIFS + \ 626 IEEE80211_DUR_DS_SLOW_ACK + \ 627 IEEE80211_DUR_DS_LONG_PREAMBLE + \ 628 IEEE80211_DUR_DS_SLOW_PLCPHDR + \ 629 IEEE80211_DUR_DIFS) 630 631enum { 632 IEEE80211_AUTH_NONE = 0, 633 IEEE80211_AUTH_OPEN = 1, /* open */ 634 IEEE80211_AUTH_SHARED = 2, /* shared-key */ 635 IEEE80211_AUTH_8021X = 3, /* 802.1x */ 636 IEEE80211_AUTH_AUTO = 4, /* auto-select/accept */ 637 IEEE80211_AUTH_WPA = 5, /* WPA w/ 802.1x */ 638 IEEE80211_AUTH_WPA_PSK = 6, /* WPA w/ preshared key */ 639 IEEE80211_AUTH_WPA2 = 7, /* WPA2 w/ 802.1x */ 640 IEEE80211_AUTH_WPA2_PSK = 8 /* WPA2 w/ preshared key */ 641}; 642 643#endif /* _NET80211_IEEE80211_H_ */ 644