ieee80211.h revision 181347
1/*- 2 * Copyright (c) 2001 Atsushi Onoe 3 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * 26 * $FreeBSD: head/sys/net80211/ieee80211.h 181347 2008-08-06 15:54:59Z sam $ 27 */ 28#ifndef _NET80211_IEEE80211_H_ 29#define _NET80211_IEEE80211_H_ 30 31/* 32 * 802.11 protocol definitions. 33 */ 34 35#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */ 36/* is 802.11 address multicast/broadcast? */ 37#define IEEE80211_IS_MULTICAST(_a) (*(_a) & 0x01) 38 39/* IEEE 802.11 PLCP header */ 40struct ieee80211_plcp_hdr { 41 uint16_t i_sfd; 42 uint8_t i_signal; 43 uint8_t i_service; 44 uint16_t i_length; 45 uint16_t i_crc; 46} __packed; 47 48#define IEEE80211_PLCP_SFD 0xF3A0 49#define IEEE80211_PLCP_SERVICE 0x00 50#define IEEE80211_PLCP_SERVICE_LOCKED 0x04 51#define IEEE80211_PLCL_SERVICE_PBCC 0x08 52#define IEEE80211_PLCP_SERVICE_LENEXT5 0x20 53#define IEEE80211_PLCP_SERVICE_LENEXT6 0x40 54#define IEEE80211_PLCP_SERVICE_LENEXT7 0x80 55 56/* 57 * generic definitions for IEEE 802.11 frames 58 */ 59struct ieee80211_frame { 60 uint8_t i_fc[2]; 61 uint8_t i_dur[2]; 62 uint8_t i_addr1[IEEE80211_ADDR_LEN]; 63 uint8_t i_addr2[IEEE80211_ADDR_LEN]; 64 uint8_t i_addr3[IEEE80211_ADDR_LEN]; 65 uint8_t i_seq[2]; 66 /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ 67 /* see below */ 68} __packed; 69 70struct ieee80211_qosframe { 71 uint8_t i_fc[2]; 72 uint8_t i_dur[2]; 73 uint8_t i_addr1[IEEE80211_ADDR_LEN]; 74 uint8_t i_addr2[IEEE80211_ADDR_LEN]; 75 uint8_t i_addr3[IEEE80211_ADDR_LEN]; 76 uint8_t i_seq[2]; 77 uint8_t i_qos[2]; 78 /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ 79 /* see below */ 80} __packed; 81 82struct ieee80211_qoscntl { 83 uint8_t i_qos[2]; 84}; 85 86struct ieee80211_frame_addr4 { 87 uint8_t i_fc[2]; 88 uint8_t i_dur[2]; 89 uint8_t i_addr1[IEEE80211_ADDR_LEN]; 90 uint8_t i_addr2[IEEE80211_ADDR_LEN]; 91 uint8_t i_addr3[IEEE80211_ADDR_LEN]; 92 uint8_t i_seq[2]; 93 uint8_t i_addr4[IEEE80211_ADDR_LEN]; 94} __packed; 95 96 97struct ieee80211_qosframe_addr4 { 98 uint8_t i_fc[2]; 99 uint8_t i_dur[2]; 100 uint8_t i_addr1[IEEE80211_ADDR_LEN]; 101 uint8_t i_addr2[IEEE80211_ADDR_LEN]; 102 uint8_t i_addr3[IEEE80211_ADDR_LEN]; 103 uint8_t i_seq[2]; 104 uint8_t i_addr4[IEEE80211_ADDR_LEN]; 105 uint8_t i_qos[2]; 106} __packed; 107 108#define IEEE80211_FC0_VERSION_MASK 0x03 109#define IEEE80211_FC0_VERSION_SHIFT 0 110#define IEEE80211_FC0_VERSION_0 0x00 111#define IEEE80211_FC0_TYPE_MASK 0x0c 112#define IEEE80211_FC0_TYPE_SHIFT 2 113#define IEEE80211_FC0_TYPE_MGT 0x00 114#define IEEE80211_FC0_TYPE_CTL 0x04 115#define IEEE80211_FC0_TYPE_DATA 0x08 116 117#define IEEE80211_FC0_SUBTYPE_MASK 0xf0 118#define IEEE80211_FC0_SUBTYPE_SHIFT 4 119/* for TYPE_MGT */ 120#define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00 121#define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10 122#define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20 123#define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30 124#define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40 125#define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50 126#define IEEE80211_FC0_SUBTYPE_BEACON 0x80 127#define IEEE80211_FC0_SUBTYPE_ATIM 0x90 128#define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0 129#define IEEE80211_FC0_SUBTYPE_AUTH 0xb0 130#define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0 131#define IEEE80211_FC0_SUBTYPE_ACTION 0xd0 132/* for TYPE_CTL */ 133#define IEEE80211_FC0_SUBTYPE_BAR 0x80 134#define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0 135#define IEEE80211_FC0_SUBTYPE_RTS 0xb0 136#define IEEE80211_FC0_SUBTYPE_CTS 0xc0 137#define IEEE80211_FC0_SUBTYPE_ACK 0xd0 138#define IEEE80211_FC0_SUBTYPE_CF_END 0xe0 139#define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0 140/* for TYPE_DATA (bit combination) */ 141#define IEEE80211_FC0_SUBTYPE_DATA 0x00 142#define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10 143#define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20 144#define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30 145#define IEEE80211_FC0_SUBTYPE_NODATA 0x40 146#define IEEE80211_FC0_SUBTYPE_CFACK 0x50 147#define IEEE80211_FC0_SUBTYPE_CFPOLL 0x60 148#define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK 0x70 149#define IEEE80211_FC0_SUBTYPE_QOS 0x80 150#define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0 151 152#define IEEE80211_FC1_DIR_MASK 0x03 153#define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */ 154#define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */ 155#define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */ 156#define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */ 157 158#define IEEE80211_FC1_MORE_FRAG 0x04 159#define IEEE80211_FC1_RETRY 0x08 160#define IEEE80211_FC1_PWR_MGT 0x10 161#define IEEE80211_FC1_MORE_DATA 0x20 162#define IEEE80211_FC1_WEP 0x40 163#define IEEE80211_FC1_ORDER 0x80 164 165#define IEEE80211_SEQ_FRAG_MASK 0x000f 166#define IEEE80211_SEQ_FRAG_SHIFT 0 167#define IEEE80211_SEQ_SEQ_MASK 0xfff0 168#define IEEE80211_SEQ_SEQ_SHIFT 4 169#define IEEE80211_SEQ_RANGE 4096 170 171#define IEEE80211_SEQ_ADD(seq, incr) \ 172 (((seq) + (incr)) & (IEEE80211_SEQ_RANGE-1)) 173#define IEEE80211_SEQ_INC(seq) IEEE80211_SEQ_ADD(seq,1) 174#define IEEE80211_SEQ_SUB(a, b) \ 175 (((a) + IEEE80211_SEQ_RANGE - (b)) & (IEEE80211_SEQ_RANGE-1)) 176 177#define IEEE80211_SEQ_BA_RANGE 2048 /* 2^11 */ 178#define IEEE80211_SEQ_BA_BEFORE(a, b) \ 179 (IEEE80211_SEQ_SUB(b, a+1) < IEEE80211_SEQ_BA_RANGE-1) 180 181#define IEEE80211_NWID_LEN 32 182 183#define IEEE80211_QOS_TXOP 0x00ff 184/* bit 8 is reserved */ 185#define IEEE80211_QOS_AMSDU 0x80 186#define IEEE80211_QOS_AMSDU_S 7 187#define IEEE80211_QOS_ACKPOLICY 0x60 188#define IEEE80211_QOS_ACKPOLICY_S 5 189#define IEEE80211_QOS_ACKPOLICY_NOACK 0x20 /* No ACK required */ 190#define IEEE80211_QOS_ACKPOLICY_BA 0x60 /* Block ACK */ 191#define IEEE80211_QOS_ESOP 0x10 192#define IEEE80211_QOS_ESOP_S 4 193#define IEEE80211_QOS_TID 0x0f 194 195/* does frame have QoS sequence control data */ 196#define IEEE80211_QOS_HAS_SEQ(wh) \ 197 (((wh)->i_fc[0] & \ 198 (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == \ 199 (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS)) 200 201/* 202 * WME/802.11e information element. 203 */ 204struct ieee80211_wme_info { 205 uint8_t wme_id; /* IEEE80211_ELEMID_VENDOR */ 206 uint8_t wme_len; /* length in bytes */ 207 uint8_t wme_oui[3]; /* 0x00, 0x50, 0xf2 */ 208 uint8_t wme_type; /* OUI type */ 209 uint8_t wme_subtype; /* OUI subtype */ 210 uint8_t wme_version; /* spec revision */ 211 uint8_t wme_info; /* QoS info */ 212} __packed; 213 214/* 215 * WME/802.11e Tspec Element 216 */ 217struct ieee80211_wme_tspec { 218 uint8_t ts_id; 219 uint8_t ts_len; 220 uint8_t ts_oui[3]; 221 uint8_t ts_oui_type; 222 uint8_t ts_oui_subtype; 223 uint8_t ts_version; 224 uint8_t ts_tsinfo[3]; 225 uint8_t ts_nom_msdu[2]; 226 uint8_t ts_max_msdu[2]; 227 uint8_t ts_min_svc[4]; 228 uint8_t ts_max_svc[4]; 229 uint8_t ts_inactv_intv[4]; 230 uint8_t ts_susp_intv[4]; 231 uint8_t ts_start_svc[4]; 232 uint8_t ts_min_rate[4]; 233 uint8_t ts_mean_rate[4]; 234 uint8_t ts_max_burst[4]; 235 uint8_t ts_min_phy[4]; 236 uint8_t ts_peak_rate[4]; 237 uint8_t ts_delay[4]; 238 uint8_t ts_surplus[2]; 239 uint8_t ts_medium_time[2]; 240} __packed; 241 242/* 243 * WME AC parameter field 244 */ 245struct ieee80211_wme_acparams { 246 uint8_t acp_aci_aifsn; 247 uint8_t acp_logcwminmax; 248 uint16_t acp_txop; 249} __packed; 250 251#define WME_NUM_AC 4 /* 4 AC categories */ 252#define WME_NUM_TID 16 /* 16 tids */ 253 254#define WME_PARAM_ACI 0x60 /* Mask for ACI field */ 255#define WME_PARAM_ACI_S 5 /* Shift for ACI field */ 256#define WME_PARAM_ACM 0x10 /* Mask for ACM bit */ 257#define WME_PARAM_ACM_S 4 /* Shift for ACM bit */ 258#define WME_PARAM_AIFSN 0x0f /* Mask for aifsn field */ 259#define WME_PARAM_AIFSN_S 0 /* Shift for aifsn field */ 260#define WME_PARAM_LOGCWMIN 0x0f /* Mask for CwMin field (in log) */ 261#define WME_PARAM_LOGCWMIN_S 0 /* Shift for CwMin field */ 262#define WME_PARAM_LOGCWMAX 0xf0 /* Mask for CwMax field (in log) */ 263#define WME_PARAM_LOGCWMAX_S 4 /* Shift for CwMax field */ 264 265#define WME_AC_TO_TID(_ac) ( \ 266 ((_ac) == WME_AC_VO) ? 6 : \ 267 ((_ac) == WME_AC_VI) ? 5 : \ 268 ((_ac) == WME_AC_BK) ? 1 : \ 269 0) 270 271#define TID_TO_WME_AC(_tid) ( \ 272 ((_tid) == 0 || (_tid) == 3) ? WME_AC_BE : \ 273 ((_tid) < 3) ? WME_AC_BK : \ 274 ((_tid) < 6) ? WME_AC_VI : \ 275 WME_AC_VO) 276 277/* 278 * WME Parameter Element 279 */ 280struct ieee80211_wme_param { 281 uint8_t param_id; 282 uint8_t param_len; 283 uint8_t param_oui[3]; 284 uint8_t param_oui_type; 285 uint8_t param_oui_subtype; 286 uint8_t param_version; 287 uint8_t param_qosInfo; 288#define WME_QOSINFO_COUNT 0x0f /* Mask for param count field */ 289 uint8_t param_reserved; 290 struct ieee80211_wme_acparams params_acParams[WME_NUM_AC]; 291} __packed; 292 293/* 294 * Management Notification Frame 295 */ 296struct ieee80211_mnf { 297 uint8_t mnf_category; 298 uint8_t mnf_action; 299 uint8_t mnf_dialog; 300 uint8_t mnf_status; 301} __packed; 302#define MNF_SETUP_REQ 0 303#define MNF_SETUP_RESP 1 304#define MNF_TEARDOWN 2 305 306/* 307 * 802.11n Management Action Frames 308 */ 309/* generic frame format */ 310struct ieee80211_action { 311 uint8_t ia_category; 312 uint8_t ia_action; 313} __packed; 314 315#define IEEE80211_ACTION_CAT_QOS 0 /* QoS */ 316#define IEEE80211_ACTION_CAT_BA 3 /* BA */ 317#define IEEE80211_ACTION_CAT_HT 7 /* HT */ 318 319#define IEEE80211_ACTION_HT_TXCHWIDTH 0 /* recommended xmit chan width*/ 320#define IEEE80211_ACTION_HT_MIMOPWRSAVE 1 /* MIMO power save */ 321 322/* HT - recommended transmission channel width */ 323struct ieee80211_action_ht_txchwidth { 324 struct ieee80211_action at_header; 325 uint8_t at_chwidth; 326} __packed; 327 328#define IEEE80211_A_HT_TXCHWIDTH_20 0 329#define IEEE80211_A_HT_TXCHWIDTH_2040 1 330 331/* HT - MIMO Power Save (NB: D2.04) */ 332struct ieee80211_action_ht_mimopowersave { 333 struct ieee80211_action am_header; 334 uint8_t am_control; 335} __packed; 336 337#define IEEE80211_A_HT_MIMOPWRSAVE_ENA 0x01 /* PS enabled */ 338#define IEEE80211_A_HT_MIMOPWRSAVE_MODE 0x02 339#define IEEE80211_A_HT_MIMOPWRSAVE_MODE_S 1 340#define IEEE80211_A_HT_MIMOPWRSAVE_DYNAMIC 0x02 /* Dynamic Mode */ 341#define IEEE80211_A_HT_MIMOPWRSAVE_STATIC 0x00 /* no SM packets */ 342/* bits 2-7 reserved */ 343 344/* Block Ack actions */ 345#define IEEE80211_ACTION_BA_ADDBA_REQUEST 0 /* ADDBA request */ 346#define IEEE80211_ACTION_BA_ADDBA_RESPONSE 1 /* ADDBA response */ 347#define IEEE80211_ACTION_BA_DELBA 2 /* DELBA */ 348 349/* Block Ack Parameter Set */ 350#define IEEE80211_BAPS_BUFSIZ 0xffc0 /* buffer size */ 351#define IEEE80211_BAPS_BUFSIZ_S 6 352#define IEEE80211_BAPS_TID 0x003c /* TID */ 353#define IEEE80211_BAPS_TID_S 2 354#define IEEE80211_BAPS_POLICY 0x0002 /* block ack policy */ 355#define IEEE80211_BAPS_POLICY_S 1 356 357#define IEEE80211_BAPS_POLICY_DELAYED (0<<IEEE80211_BAPS_POLICY_S) 358#define IEEE80211_BAPS_POLICY_IMMEDIATE (1<<IEEE80211_BAPS_POLICY_S) 359 360/* Block Ack Sequence Control */ 361#define IEEE80211_BASEQ_START 0xfff0 /* starting seqnum */ 362#define IEEE80211_BASEQ_START_S 4 363#define IEEE80211_BASEQ_FRAG 0x000f /* fragment number */ 364#define IEEE80211_BASEQ_FRAG_S 0 365 366/* Delayed Block Ack Parameter Set */ 367#define IEEE80211_DELBAPS_TID 0xf000 /* TID */ 368#define IEEE80211_DELBAPS_TID_S 12 369#define IEEE80211_DELBAPS_INIT 0x0800 /* initiator */ 370#define IEEE80211_DELBAPS_INIT_S 11 371 372/* BA - ADDBA request */ 373struct ieee80211_action_ba_addbarequest { 374 struct ieee80211_action rq_header; 375 uint8_t rq_dialogtoken; 376 uint16_t rq_baparamset; 377 uint16_t rq_batimeout; /* in TUs */ 378 uint16_t rq_baseqctl; 379} __packed; 380 381/* BA - ADDBA response */ 382struct ieee80211_action_ba_addbaresponse { 383 struct ieee80211_action rs_header; 384 uint8_t rs_dialogtoken; 385 uint16_t rs_statuscode; 386 uint16_t rs_baparamset; 387 uint16_t rs_batimeout; /* in TUs */ 388} __packed; 389 390/* BA - DELBA */ 391struct ieee80211_action_ba_delba { 392 struct ieee80211_action dl_header; 393 uint16_t dl_baparamset; 394 uint16_t dl_reasoncode; 395} __packed; 396 397/* BAR Control */ 398#define IEEE80211_BAR_TID 0xf000 /* TID */ 399#define IEEE80211_BAR_TID_S 12 400#define IEEE80211_BAR_COMP 0x0004 /* compressed */ 401#define IEEE80211_BAR_MTID 0x0002 402#define IEEE80211_BAR_NOACK 0x0001 /* no-ack policy */ 403 404struct ieee80211_ba_request { 405 uint16_t rq_barctl; 406 uint16_t rq_barseqctl; 407} __packed; 408 409/* 410 * Control frames. 411 */ 412struct ieee80211_frame_min { 413 uint8_t i_fc[2]; 414 uint8_t i_dur[2]; 415 uint8_t i_addr1[IEEE80211_ADDR_LEN]; 416 uint8_t i_addr2[IEEE80211_ADDR_LEN]; 417 /* FCS */ 418} __packed; 419 420struct ieee80211_frame_rts { 421 uint8_t i_fc[2]; 422 uint8_t i_dur[2]; 423 uint8_t i_ra[IEEE80211_ADDR_LEN]; 424 uint8_t i_ta[IEEE80211_ADDR_LEN]; 425 /* FCS */ 426} __packed; 427 428struct ieee80211_frame_cts { 429 uint8_t i_fc[2]; 430 uint8_t i_dur[2]; 431 uint8_t i_ra[IEEE80211_ADDR_LEN]; 432 /* FCS */ 433} __packed; 434 435struct ieee80211_frame_ack { 436 uint8_t i_fc[2]; 437 uint8_t i_dur[2]; 438 uint8_t i_ra[IEEE80211_ADDR_LEN]; 439 /* FCS */ 440} __packed; 441 442struct ieee80211_frame_pspoll { 443 uint8_t i_fc[2]; 444 uint8_t i_aid[2]; 445 uint8_t i_bssid[IEEE80211_ADDR_LEN]; 446 uint8_t i_ta[IEEE80211_ADDR_LEN]; 447 /* FCS */ 448} __packed; 449 450struct ieee80211_frame_cfend { /* NB: also CF-End+CF-Ack */ 451 uint8_t i_fc[2]; 452 uint8_t i_dur[2]; /* should be zero */ 453 uint8_t i_ra[IEEE80211_ADDR_LEN]; 454 uint8_t i_bssid[IEEE80211_ADDR_LEN]; 455 /* FCS */ 456} __packed; 457 458struct ieee80211_frame_bar { 459 uint8_t i_fc[2]; 460 uint8_t i_dur[2]; 461 uint8_t i_ra[IEEE80211_ADDR_LEN]; 462 uint8_t i_ta[IEEE80211_ADDR_LEN]; 463 uint16_t i_ctl; 464 uint16_t i_seq; 465 /* FCS */ 466} __packed; 467 468/* 469 * BEACON management packets 470 * 471 * octet timestamp[8] 472 * octet beacon interval[2] 473 * octet capability information[2] 474 * information element 475 * octet elemid 476 * octet length 477 * octet information[length] 478 */ 479 480#define IEEE80211_BEACON_INTERVAL(beacon) \ 481 ((beacon)[8] | ((beacon)[9] << 8)) 482#define IEEE80211_BEACON_CAPABILITY(beacon) \ 483 ((beacon)[10] | ((beacon)[11] << 8)) 484 485#define IEEE80211_CAPINFO_ESS 0x0001 486#define IEEE80211_CAPINFO_IBSS 0x0002 487#define IEEE80211_CAPINFO_CF_POLLABLE 0x0004 488#define IEEE80211_CAPINFO_CF_POLLREQ 0x0008 489#define IEEE80211_CAPINFO_PRIVACY 0x0010 490#define IEEE80211_CAPINFO_SHORT_PREAMBLE 0x0020 491#define IEEE80211_CAPINFO_PBCC 0x0040 492#define IEEE80211_CAPINFO_CHNL_AGILITY 0x0080 493#define IEEE80211_CAPINFO_SPECTRUM_MGMT 0x0100 494/* bit 9 is reserved */ 495#define IEEE80211_CAPINFO_SHORT_SLOTTIME 0x0400 496#define IEEE80211_CAPINFO_RSN 0x0800 497/* bit 12 is reserved */ 498#define IEEE80211_CAPINFO_DSSSOFDM 0x2000 499/* bits 14-15 are reserved */ 500 501/* 502 * 802.11i/WPA information element (maximally sized). 503 */ 504struct ieee80211_ie_wpa { 505 uint8_t wpa_id; /* IEEE80211_ELEMID_VENDOR */ 506 uint8_t wpa_len; /* length in bytes */ 507 uint8_t wpa_oui[3]; /* 0x00, 0x50, 0xf2 */ 508 uint8_t wpa_type; /* OUI type */ 509 uint16_t wpa_version; /* spec revision */ 510 uint32_t wpa_mcipher[1]; /* multicast/group key cipher */ 511 uint16_t wpa_uciphercnt; /* # pairwise key ciphers */ 512 uint32_t wpa_uciphers[8];/* ciphers */ 513 uint16_t wpa_authselcnt; /* authentication selector cnt*/ 514 uint32_t wpa_authsels[8];/* selectors */ 515 uint16_t wpa_caps; /* 802.11i capabilities */ 516 uint16_t wpa_pmkidcnt; /* 802.11i pmkid count */ 517 uint16_t wpa_pmkids[8]; /* 802.11i pmkids */ 518} __packed; 519 520/* 521 * 802.11n HT Capability IE 522 * NB: these reflect D1.10 523 */ 524struct ieee80211_ie_htcap { 525 uint8_t hc_id; /* element ID */ 526 uint8_t hc_len; /* length in bytes */ 527 uint16_t hc_cap; /* HT caps (see below) */ 528 uint8_t hc_param; /* HT params (see below) */ 529 uint8_t hc_mcsset[16]; /* supported MCS set */ 530 uint16_t hc_extcap; /* extended HT capabilities */ 531 uint32_t hc_txbf; /* txbf capabilities */ 532 uint8_t hc_antenna; /* antenna capabilities */ 533} __packed; 534 535/* HT capability flags (ht_cap) */ 536#define IEEE80211_HTCAP_LDPC 0x0001 /* LDPC supported */ 537#define IEEE80211_HTCAP_CHWIDTH40 0x0002 /* 20/40 supported */ 538#define IEEE80211_HTCAP_SMPS 0x000c /* SM Power Save mode */ 539#define IEEE80211_HTCAP_SMPS_OFF 0x0000 /* none (static mode) */ 540#define IEEE80211_HTCAP_SMPS_DYNAMIC 0x0004 /* send RTS first */ 541/* NB: SMPS value 2 is reserved */ 542#define IEEE80211_HTCAP_SMPS_ENA 0x000c /* enabled */ 543#define IEEE80211_HTCAP_GREENFIELD 0x0010 /* Greenfield supported */ 544#define IEEE80211_HTCAP_SHORTGI20 0x0020 /* Short GI in 20MHz */ 545#define IEEE80211_HTCAP_SHORTGI40 0x0040 /* Short GI in 40MHz */ 546#define IEEE80211_HTCAP_TXSTBC 0x0080 /* STBC tx ok */ 547#define IEEE80211_HTCAP_RXSTBC 0x0300 /* STBC rx support */ 548#define IEEE80211_HTCAP_RXSTBC_S 8 549#define IEEE80211_HTCAP_RXSTBC_1STREAM 0x0100 /* 1 spatial stream */ 550#define IEEE80211_HTCAP_RXSTBC_2STREAM 0x0200 /* 1-2 spatial streams*/ 551#define IEEE80211_HTCAP_RXSTBC_3STREAM 0x0300 /* 1-3 spatial streams*/ 552#define IEEE80211_HTCAP_DELBA 0x0400 /* HT DELBA supported */ 553#define IEEE80211_HTCAP_MAXAMSDU 0x0800 /* max A-MSDU length */ 554#define IEEE80211_HTCAP_MAXAMSDU_7935 0x0800 /* 7935 octets */ 555#define IEEE80211_HTCAP_MAXAMSDU_3839 0x0000 /* 3839 octets */ 556#define IEEE80211_HTCAP_DSSSCCK40 0x1000 /* DSSS/CCK in 40MHz */ 557#define IEEE80211_HTCAP_PSMP 0x2000 /* PSMP supported */ 558#define IEEE80211_HTCAP_40INTOLERANT 0x4000 /* 40MHz intolerant */ 559#define IEEE80211_HTCAP_LSIGTXOPPROT 0x8000 /* L-SIG TXOP prot */ 560 561/* HT parameters (hc_param) */ 562#define IEEE80211_HTCAP_MAXRXAMPDU 0x03 /* max rx A-MPDU factor */ 563#define IEEE80211_HTCAP_MAXRXAMPDU_S 0 564#define IEEE80211_HTCAP_MAXRXAMPDU_8K 0 565#define IEEE80211_HTCAP_MAXRXAMPDU_16K 1 566#define IEEE80211_HTCAP_MAXRXAMPDU_32K 2 567#define IEEE80211_HTCAP_MAXRXAMPDU_64K 3 568#define IEEE80211_HTCAP_MPDUDENSITY 0x1c /* min MPDU start spacing */ 569#define IEEE80211_HTCAP_MPDUDENSITY_S 2 570#define IEEE80211_HTCAP_MPDUDENSITY_NA 0 /* no time restriction */ 571#define IEEE80211_HTCAP_MPDUDENSITY_025 1 /* 1/4 us */ 572#define IEEE80211_HTCAP_MPDUDENSITY_05 2 /* 1/2 us */ 573#define IEEE80211_HTCAP_MPDUDENSITY_1 3 /* 1 us */ 574#define IEEE80211_HTCAP_MPDUDENSITY_2 4 /* 2 us */ 575#define IEEE80211_HTCAP_MPDUDENSITY_4 5 /* 4 us */ 576#define IEEE80211_HTCAP_MPDUDENSITY_8 6 /* 8 us */ 577#define IEEE80211_HTCAP_MPDUDENSITY_16 7 /* 16 us */ 578 579/* HT extended capabilities (hc_extcap) */ 580#define IEEE80211_HTCAP_PCO 0x0001 /* PCO capable */ 581#define IEEE80211_HTCAP_PCOTRANS 0x0006 /* PCO transition time */ 582#define IEEE80211_HTCAP_PCOTRANS_S 1 583#define IEEE80211_HTCAP_PCOTRANS_04 0x0002 /* 400 us */ 584#define IEEE80211_HTCAP_PCOTRANS_15 0x0004 /* 1.5 ms */ 585#define IEEE80211_HTCAP_PCOTRANS_5 0x0006 /* 5 ms */ 586/* bits 3-7 reserved */ 587#define IEEE80211_HTCAP_MCSFBACK 0x0300 /* MCS feedback */ 588#define IEEE80211_HTCAP_MCSFBACK_S 8 589#define IEEE80211_HTCAP_MCSFBACK_NONE 0x0000 /* nothing provided */ 590#define IEEE80211_HTCAP_MCSFBACK_UNSOL 0x0200 /* unsolicited feedback */ 591#define IEEE80211_HTCAP_MCSFBACK_MRQ 0x0300 /* " "+respond to MRQ */ 592#define IEEE80211_HTCAP_HTC 0x0400 /* +HTC support */ 593#define IEEE80211_HTCAP_RDR 0x0800 /* reverse direction responder*/ 594/* bits 12-15 reserved */ 595 596/* 597 * 802.11n HT Information IE 598 */ 599struct ieee80211_ie_htinfo { 600 uint8_t hi_id; /* element ID */ 601 uint8_t hi_len; /* length in bytes */ 602 uint8_t hi_ctrlchannel; /* primary channel */ 603 uint8_t hi_byte1; /* ht ie byte 1 */ 604 uint8_t hi_byte2; /* ht ie byte 2 */ 605 uint8_t hi_byte3; /* ht ie byte 3 */ 606 uint16_t hi_byte45; /* ht ie bytes 4+5 */ 607 uint8_t hi_basicmcsset[16]; /* basic MCS set */ 608} __packed; 609 610/* byte1 */ 611#define IEEE80211_HTINFO_2NDCHAN 0x03 /* secondary/ext chan offset */ 612#define IEEE80211_HTINFO_2NDCHAN_S 0 613#define IEEE80211_HTINFO_2NDCHAN_NONE 0x00 /* no secondary/ext channel */ 614#define IEEE80211_HTINFO_2NDCHAN_ABOVE 0x01 /* above private channel */ 615/* NB: 2 is reserved */ 616#define IEEE80211_HTINFO_2NDCHAN_BELOW 0x03 /* below primary channel */ 617#define IEEE80211_HTINFO_TXWIDTH 0x04 /* tx channel width */ 618#define IEEE80211_HTINFO_TXWIDTH_20 0x00 /* 20MHz width */ 619#define IEEE80211_HTINFO_TXWIDTH_2040 0x04 /* any supported width */ 620#define IEEE80211_HTINFO_RIFSMODE 0x08 /* Reduced IFS (RIFS) use */ 621#define IEEE80211_HTINFO_RIFSMODE_PROH 0x00 /* RIFS use prohibited */ 622#define IEEE80211_HTINFO_RIFSMODE_PERM 0x08 /* RIFS use permitted */ 623#define IEEE80211_HTINFO_PMSPONLY 0x10 /* PSMP required to associate */ 624#define IEEE80211_HTINFO_SIGRAN 0xe0 /* shortest Service Interval */ 625#define IEEE80211_HTINFO_SIGRAN_S 5 626#define IEEE80211_HTINFO_SIGRAN_5 0x00 /* 5 ms */ 627/* XXX add rest */ 628 629/* bytes 2+3 */ 630#define IEEE80211_HTINFO_OPMODE 0x03 /* operating mode */ 631#define IEEE80211_HTINFO_OPMODE_S 0 632#define IEEE80211_HTINFO_OPMODE_PURE 0x00 /* no protection */ 633#define IEEE80211_HTINFO_OPMODE_PROTOPT 0x01 /* protection optional */ 634#define IEEE80211_HTINFO_OPMODE_HT20PR 0x02 /* protection for HT20 sta's */ 635#define IEEE80211_HTINFO_OPMODE_MIXED 0x03 /* protection for legacy sta's*/ 636#define IEEE80211_HTINFO_NONGF_PRESENT 0x04 /* non-GF sta's present */ 637#define IEEE80211_HTINFO_TXBL 0x08 /* transmit burst limit */ 638#define IEEE80211_HTINFO_NONHT_PRESENT 0x10 /* non-HT sta's present */ 639/* bits 5-15 reserved */ 640 641/* bytes 4+5 */ 642#define IEEE80211_HTINFO_2NDARYBEACON 0x01 643#define IEEE80211_HTINFO_LSIGTXOPPROT 0x02 644#define IEEE80211_HTINFO_PCO_ACTIVE 0x04 645#define IEEE80211_HTINFO_40MHZPHASE 0x08 646 647/* byte5 */ 648#define IEEE80211_HTINFO_BASIC_STBCMCS 0x7f 649#define IEEE80211_HTINFO_BASIC_STBCMCS_S 0 650#define IEEE80211_HTINFO_DUALPROTECTED 0x80 651 652/* 653 * Management information element payloads. 654 */ 655 656enum { 657 IEEE80211_ELEMID_SSID = 0, 658 IEEE80211_ELEMID_RATES = 1, 659 IEEE80211_ELEMID_FHPARMS = 2, 660 IEEE80211_ELEMID_DSPARMS = 3, 661 IEEE80211_ELEMID_CFPARMS = 4, 662 IEEE80211_ELEMID_TIM = 5, 663 IEEE80211_ELEMID_IBSSPARMS = 6, 664 IEEE80211_ELEMID_COUNTRY = 7, 665 IEEE80211_ELEMID_CHALLENGE = 16, 666 /* 17-31 reserved for challenge text extension */ 667 IEEE80211_ELEMID_PWRCNSTR = 32, 668 IEEE80211_ELEMID_PWRCAP = 33, 669 IEEE80211_ELEMID_TPCREQ = 34, 670 IEEE80211_ELEMID_TPCREP = 35, 671 IEEE80211_ELEMID_SUPPCHAN = 36, 672 IEEE80211_ELEMID_CHANSWITCHANN = 37, 673 IEEE80211_ELEMID_MEASREQ = 38, 674 IEEE80211_ELEMID_MEASREP = 39, 675 IEEE80211_ELEMID_QUIET = 40, 676 IEEE80211_ELEMID_IBSSDFS = 41, 677 IEEE80211_ELEMID_ERP = 42, 678 IEEE80211_ELEMID_HTCAP = 45, 679 IEEE80211_ELEMID_RSN = 48, 680 IEEE80211_ELEMID_XRATES = 50, 681 IEEE80211_ELEMID_HTINFO = 61, 682 IEEE80211_ELEMID_TPC = 150, 683 IEEE80211_ELEMID_CCKM = 156, 684 IEEE80211_ELEMID_VENDOR = 221, /* vendor private */ 685}; 686 687struct ieee80211_tim_ie { 688 uint8_t tim_ie; /* IEEE80211_ELEMID_TIM */ 689 uint8_t tim_len; 690 uint8_t tim_count; /* DTIM count */ 691 uint8_t tim_period; /* DTIM period */ 692 uint8_t tim_bitctl; /* bitmap control */ 693 uint8_t tim_bitmap[1]; /* variable-length bitmap */ 694} __packed; 695 696struct ieee80211_country_ie { 697 uint8_t ie; /* IEEE80211_ELEMID_COUNTRY */ 698 uint8_t len; 699 uint8_t cc[3]; /* ISO CC+(I)ndoor/(O)utdoor */ 700 struct { 701 uint8_t schan; /* starting channel */ 702 uint8_t nchan; /* number channels */ 703 uint8_t maxtxpwr; /* tx power cap */ 704 } __packed band[1]; /* sub bands (NB: var size) */ 705} __packed; 706 707#define IEEE80211_COUNTRY_MAX_BANDS 84 /* max possible bands */ 708#define IEEE80211_COUNTRY_MAX_SIZE \ 709 (sizeof(struct ieee80211_country_ie) + 3*(IEEE80211_COUNTRY_MAX_BANDS-1)) 710 711/* 712 * 802.11h Channel Switch Announcement (CSA). 713 */ 714struct ieee80211_csa_ie { 715 uint8_t csa_ie; /* IEEE80211_ELEMID_CHANSWITCHANN */ 716 uint8_t csa_len; 717 uint8_t csa_mode; /* Channel Switch Mode */ 718 uint8_t csa_newchan; /* New Channel Number */ 719 uint8_t csa_count; /* Channel Switch Count */ 720} __packed; 721 722/* 723 * Atheros advanced capability information element. 724 */ 725struct ieee80211_ath_ie { 726 uint8_t ath_id; /* IEEE80211_ELEMID_VENDOR */ 727 uint8_t ath_len; /* length in bytes */ 728 uint8_t ath_oui[3]; /* 0x00, 0x03, 0x7f */ 729 uint8_t ath_oui_type; /* OUI type */ 730 uint8_t ath_oui_subtype; /* OUI subtype */ 731 uint8_t ath_version; /* spec revision */ 732 uint8_t ath_capability; /* capability info */ 733#define ATHEROS_CAP_TURBO_PRIME 0x01 /* dynamic turbo--aka Turbo' */ 734#define ATHEROS_CAP_COMPRESSION 0x02 /* data compression */ 735#define ATHEROS_CAP_FAST_FRAME 0x04 /* fast (jumbo) frames */ 736#define ATHEROS_CAP_XR 0x08 /* Xtended Range support */ 737#define ATHEROS_CAP_AR 0x10 /* Advanded Radar support */ 738#define ATHEROS_CAP_BURST 0x20 /* Bursting - not negotiated */ 739#define ATHEROS_CAP_WME 0x40 /* CWMin tuning */ 740#define ATHEROS_CAP_BOOST 0x80 /* use turbo/!turbo mode */ 741 uint8_t ath_defkeyix[2]; 742} __packed; 743 744/* rate set entries are in .5 Mb/s units, and potentially marked as basic */ 745#define IEEE80211_RATE_BASIC 0x80 746#define IEEE80211_RATE_VAL 0x7f 747 748/* EPR information element flags */ 749#define IEEE80211_ERP_NON_ERP_PRESENT 0x01 750#define IEEE80211_ERP_USE_PROTECTION 0x02 751#define IEEE80211_ERP_LONG_PREAMBLE 0x04 752 753#define ATH_OUI 0x7f0300 /* Atheros OUI */ 754#define ATH_OUI_TYPE 0x01 755#define ATH_OUI_SUBTYPE 0x01 756#define ATH_OUI_VERSION 0x00 757 758#define BCM_OUI 0x4c9000 /* Broadcom OUI */ 759#define BCM_OUI_HTCAP 51 /* pre-draft HTCAP ie */ 760#define BCM_OUI_HTINFO 52 /* pre-draft HTINFO ie */ 761 762#define WPA_OUI 0xf25000 763#define WPA_OUI_TYPE 0x01 764#define WPA_VERSION 1 /* current supported version */ 765 766#define WPA_CSE_NULL 0x00 767#define WPA_CSE_WEP40 0x01 768#define WPA_CSE_TKIP 0x02 769#define WPA_CSE_CCMP 0x04 770#define WPA_CSE_WEP104 0x05 771 772#define WPA_ASE_NONE 0x00 773#define WPA_ASE_8021X_UNSPEC 0x01 774#define WPA_ASE_8021X_PSK 0x02 775 776#define WPS_OUI_TYPE 0x04 777 778#define RSN_OUI 0xac0f00 779#define RSN_VERSION 1 /* current supported version */ 780 781#define RSN_CSE_NULL 0x00 782#define RSN_CSE_WEP40 0x01 783#define RSN_CSE_TKIP 0x02 784#define RSN_CSE_WRAP 0x03 785#define RSN_CSE_CCMP 0x04 786#define RSN_CSE_WEP104 0x05 787 788#define RSN_ASE_NONE 0x00 789#define RSN_ASE_8021X_UNSPEC 0x01 790#define RSN_ASE_8021X_PSK 0x02 791 792#define RSN_CAP_PREAUTH 0x01 793 794#define WME_OUI 0xf25000 795#define WME_OUI_TYPE 0x02 796#define WME_INFO_OUI_SUBTYPE 0x00 797#define WME_PARAM_OUI_SUBTYPE 0x01 798#define WME_VERSION 1 799 800/* WME stream classes */ 801#define WME_AC_BE 0 /* best effort */ 802#define WME_AC_BK 1 /* background */ 803#define WME_AC_VI 2 /* video */ 804#define WME_AC_VO 3 /* voice */ 805 806/* 807 * AUTH management packets 808 * 809 * octet algo[2] 810 * octet seq[2] 811 * octet status[2] 812 * octet chal.id 813 * octet chal.length 814 * octet chal.text[253] NB: 1-253 bytes 815 */ 816 817/* challenge length for shared key auth */ 818#define IEEE80211_CHALLENGE_LEN 128 819 820#define IEEE80211_AUTH_ALG_OPEN 0x0000 821#define IEEE80211_AUTH_ALG_SHARED 0x0001 822#define IEEE80211_AUTH_ALG_LEAP 0x0080 823 824enum { 825 IEEE80211_AUTH_OPEN_REQUEST = 1, 826 IEEE80211_AUTH_OPEN_RESPONSE = 2, 827}; 828 829enum { 830 IEEE80211_AUTH_SHARED_REQUEST = 1, 831 IEEE80211_AUTH_SHARED_CHALLENGE = 2, 832 IEEE80211_AUTH_SHARED_RESPONSE = 3, 833 IEEE80211_AUTH_SHARED_PASS = 4, 834}; 835 836/* 837 * Reason and status codes. 838 * 839 * Reason codes are used in management frames to indicate why an 840 * action took place (e.g. on disassociation). Status codes are 841 * used in management frames to indicate the result of an operation. 842 * 843 * Unlisted codes are reserved 844 */ 845 846enum { 847 IEEE80211_REASON_UNSPECIFIED = 1, 848 IEEE80211_REASON_AUTH_EXPIRE = 2, 849 IEEE80211_REASON_AUTH_LEAVE = 3, 850 IEEE80211_REASON_ASSOC_EXPIRE = 4, 851 IEEE80211_REASON_ASSOC_TOOMANY = 5, 852 IEEE80211_REASON_NOT_AUTHED = 6, 853 IEEE80211_REASON_NOT_ASSOCED = 7, 854 IEEE80211_REASON_ASSOC_LEAVE = 8, 855 IEEE80211_REASON_ASSOC_NOT_AUTHED = 9, 856 IEEE80211_REASON_DISASSOC_PWRCAP_BAD = 10, /* 11h */ 857 IEEE80211_REASON_DISASSOC_SUPCHAN_BAD = 11, /* 11h */ 858 IEEE80211_REASON_IE_INVALID = 13, /* 11i */ 859 IEEE80211_REASON_MIC_FAILURE = 14, /* 11i */ 860 IEEE80211_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, /* 11i */ 861 IEEE80211_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16, /* 11i */ 862 IEEE80211_REASON_IE_IN_4WAY_DIFFERS = 17, /* 11i */ 863 IEEE80211_REASON_GROUP_CIPHER_INVALID = 18, /* 11i */ 864 IEEE80211_REASON_PAIRWISE_CIPHER_INVALID= 19, /* 11i */ 865 IEEE80211_REASON_AKMP_INVALID = 20, /* 11i */ 866 IEEE80211_REASON_UNSUPP_RSN_IE_VERSION = 21, /* 11i */ 867 IEEE80211_REASON_INVALID_RSN_IE_CAP = 22, /* 11i */ 868 IEEE80211_REASON_802_1X_AUTH_FAILED = 23, /* 11i */ 869 IEEE80211_REASON_CIPHER_SUITE_REJECTED = 24, /* 11i */ 870 871 IEEE80211_STATUS_SUCCESS = 0, 872 IEEE80211_STATUS_UNSPECIFIED = 1, 873 IEEE80211_STATUS_CAPINFO = 10, 874 IEEE80211_STATUS_NOT_ASSOCED = 11, 875 IEEE80211_STATUS_OTHER = 12, 876 IEEE80211_STATUS_ALG = 13, 877 IEEE80211_STATUS_SEQUENCE = 14, 878 IEEE80211_STATUS_CHALLENGE = 15, 879 IEEE80211_STATUS_TIMEOUT = 16, 880 IEEE80211_STATUS_TOOMANY = 17, 881 IEEE80211_STATUS_BASIC_RATE = 18, 882 IEEE80211_STATUS_SP_REQUIRED = 19, /* 11b */ 883 IEEE80211_STATUS_PBCC_REQUIRED = 20, /* 11b */ 884 IEEE80211_STATUS_CA_REQUIRED = 21, /* 11b */ 885 IEEE80211_STATUS_SPECMGMT_REQUIRED = 22, /* 11h */ 886 IEEE80211_STATUS_PWRCAP_REQUIRED = 23, /* 11h */ 887 IEEE80211_STATUS_SUPCHAN_REQUIRED = 24, /* 11h */ 888 IEEE80211_STATUS_SHORTSLOT_REQUIRED = 25, /* 11g */ 889 IEEE80211_STATUS_DSSSOFDM_REQUIRED = 26, /* 11g */ 890 IEEE80211_STATUS_INVALID_IE = 40, /* 11i */ 891 IEEE80211_STATUS_GROUP_CIPHER_INVALID = 41, /* 11i */ 892 IEEE80211_STATUS_PAIRWISE_CIPHER_INVALID = 42, /* 11i */ 893 IEEE80211_STATUS_AKMP_INVALID = 43, /* 11i */ 894 IEEE80211_STATUS_UNSUPP_RSN_IE_VERSION = 44, /* 11i */ 895 IEEE80211_STATUS_INVALID_RSN_IE_CAP = 45, /* 11i */ 896 IEEE80211_STATUS_CIPHER_SUITE_REJECTED = 46, /* 11i */ 897}; 898 899#define IEEE80211_WEP_KEYLEN 5 /* 40bit */ 900#define IEEE80211_WEP_IVLEN 3 /* 24bit */ 901#define IEEE80211_WEP_KIDLEN 1 /* 1 octet */ 902#define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */ 903#define IEEE80211_WEP_TOTLEN (IEEE80211_WEP_IVLEN + \ 904 IEEE80211_WEP_KIDLEN + \ 905 IEEE80211_WEP_CRCLEN) 906#define IEEE80211_WEP_NKID 4 /* number of key ids */ 907 908/* 909 * 802.11i defines an extended IV for use with non-WEP ciphers. 910 * When the EXTIV bit is set in the key id byte an additional 911 * 4 bytes immediately follow the IV for TKIP. For CCMP the 912 * EXTIV bit is likewise set but the 8 bytes represent the 913 * CCMP header rather than IV+extended-IV. 914 */ 915#define IEEE80211_WEP_EXTIV 0x20 916#define IEEE80211_WEP_EXTIVLEN 4 /* extended IV length */ 917#define IEEE80211_WEP_MICLEN 8 /* trailing MIC */ 918 919#define IEEE80211_CRC_LEN 4 920 921/* 922 * Maximum acceptable MTU is: 923 * IEEE80211_MAX_LEN - WEP overhead - CRC - 924 * QoS overhead - RSN/WPA overhead 925 * Min is arbitrarily chosen > IEEE80211_MIN_LEN. The default 926 * mtu is Ethernet-compatible; it's set by ether_ifattach. 927 */ 928#define IEEE80211_MTU_MAX 2290 929#define IEEE80211_MTU_MIN 32 930 931#define IEEE80211_MAX_LEN (2300 + IEEE80211_CRC_LEN + \ 932 (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN)) 933#define IEEE80211_ACK_LEN \ 934 (sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN) 935#define IEEE80211_MIN_LEN \ 936 (sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN) 937 938/* 939 * The 802.11 spec says at most 2007 stations may be 940 * associated at once. For most AP's this is way more 941 * than is feasible so we use a default of IEEE80211_AID_DEF. 942 * This number may be overridden by the driver and/or by 943 * user configuration but may not be less than IEEE80211_AID_MIN 944 * (see _ieee80211.h for implementation-specific settings). 945 */ 946#define IEEE80211_AID_MAX 2007 947 948#define IEEE80211_AID(b) ((b) &~ 0xc000) 949 950/* 951 * RTS frame length parameters. The default is specified in 952 * the 802.11 spec as 512; we treat it as implementation-dependent 953 * so it's defined in ieee80211_var.h. The max may be wrong 954 * for jumbo frames. 955 */ 956#define IEEE80211_RTS_MIN 1 957#define IEEE80211_RTS_MAX 2346 958 959/* 960 * TX fragmentation parameters. As above for RTS, we treat 961 * default as implementation-dependent so define it elsewhere. 962 */ 963#define IEEE80211_FRAG_MIN 256 964#define IEEE80211_FRAG_MAX 2346 965 966/* 967 * Beacon interval (TU's). Min+max come from WiFi requirements. 968 * As above, we treat default as implementation-dependent so 969 * define it elsewhere. 970 */ 971#define IEEE80211_BINTVAL_MAX 1000 /* max beacon interval (TU's) */ 972#define IEEE80211_BINTVAL_MIN 25 /* min beacon interval (TU's) */ 973 974/* 975 * DTIM period (beacons). Min+max are not really defined 976 * by the protocol but we want them publicly visible so 977 * define them here. 978 */ 979#define IEEE80211_DTIM_MAX 15 /* max DTIM period */ 980#define IEEE80211_DTIM_MIN 1 /* min DTIM period */ 981 982/* 983 * Beacon miss threshold (beacons). As for DTIM, we define 984 * them here to be publicly visible. Note the max may be 985 * clamped depending on device capabilities. 986 */ 987#define IEEE80211_HWBMISS_MIN 1 988#define IEEE80211_HWBMISS_MAX 255 989 990/* 991 * 802.11 frame duration definitions. 992 */ 993 994struct ieee80211_duration { 995 uint16_t d_rts_dur; 996 uint16_t d_data_dur; 997 uint16_t d_plcp_len; 998 uint8_t d_residue; /* unused octets in time slot */ 999}; 1000 1001/* One Time Unit (TU) is 1Kus = 1024 microseconds. */ 1002#define IEEE80211_DUR_TU 1024 1003 1004/* IEEE 802.11b durations for DSSS PHY in microseconds */ 1005#define IEEE80211_DUR_DS_LONG_PREAMBLE 144 1006#define IEEE80211_DUR_DS_SHORT_PREAMBLE 72 1007 1008#define IEEE80211_DUR_DS_SLOW_PLCPHDR 48 1009#define IEEE80211_DUR_DS_FAST_PLCPHDR 24 1010#define IEEE80211_DUR_DS_SLOW_ACK 112 1011#define IEEE80211_DUR_DS_FAST_ACK 56 1012#define IEEE80211_DUR_DS_SLOW_CTS 112 1013#define IEEE80211_DUR_DS_FAST_CTS 56 1014 1015#define IEEE80211_DUR_DS_SLOT 20 1016#define IEEE80211_DUR_DS_SIFS 10 1017#define IEEE80211_DUR_DS_PIFS (IEEE80211_DUR_DS_SIFS + IEEE80211_DUR_DS_SLOT) 1018#define IEEE80211_DUR_DS_DIFS (IEEE80211_DUR_DS_SIFS + \ 1019 2 * IEEE80211_DUR_DS_SLOT) 1020#define IEEE80211_DUR_DS_EIFS (IEEE80211_DUR_DS_SIFS + \ 1021 IEEE80211_DUR_DS_SLOW_ACK + \ 1022 IEEE80211_DUR_DS_LONG_PREAMBLE + \ 1023 IEEE80211_DUR_DS_SLOW_PLCPHDR + \ 1024 IEEE80211_DUR_DIFS) 1025 1026/* 1027 * Atheros fast-frame encapsulation format. 1028 * FF max payload: 1029 * 802.2 + FFHDR + HPAD + 802.3 + 802.2 + 1500 + SPAD + 802.3 + 802.2 + 1500: 1030 * 8 + 4 + 4 + 14 + 8 + 1500 + 6 + 14 + 8 + 1500 1031 * = 3066 1032 */ 1033/* fast frame header is 32-bits */ 1034#define ATH_FF_PROTO 0x0000003f /* protocol */ 1035#define ATH_FF_PROTO_S 0 1036#define ATH_FF_FTYPE 0x000000c0 /* frame type */ 1037#define ATH_FF_FTYPE_S 6 1038#define ATH_FF_HLEN32 0x00000300 /* optional hdr length */ 1039#define ATH_FF_HLEN32_S 8 1040#define ATH_FF_SEQNUM 0x001ffc00 /* sequence number */ 1041#define ATH_FF_SEQNUM_S 10 1042#define ATH_FF_OFFSET 0xffe00000 /* offset to 2nd payload */ 1043#define ATH_FF_OFFSET_S 21 1044 1045#define ATH_FF_MAX_HDR_PAD 4 1046#define ATH_FF_MAX_SEP_PAD 6 1047#define ATH_FF_MAX_HDR 30 1048 1049#define ATH_FF_PROTO_L2TUNNEL 0 /* L2 tunnel protocol */ 1050#define ATH_FF_ETH_TYPE 0x88bd /* Ether type for encapsulated frames */ 1051#define ATH_FF_SNAP_ORGCODE_0 0x00 1052#define ATH_FF_SNAP_ORGCODE_1 0x03 1053#define ATH_FF_SNAP_ORGCODE_2 0x7f 1054 1055#endif /* _NET80211_IEEE80211_H_ */ 1056