ieee80211.h revision 173863
1116742Ssam/*- 2116904Ssam * Copyright (c) 2001 Atsushi Onoe 3170360Ssam * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting 4116742Ssam * All rights reserved. 5116742Ssam * 6116742Ssam * Redistribution and use in source and binary forms, with or without 7116742Ssam * modification, are permitted provided that the following conditions 8116742Ssam * are met: 9116742Ssam * 1. Redistributions of source code must retain the above copyright 10116742Ssam * notice, this list of conditions and the following disclaimer. 11116742Ssam * 2. Redistributions in binary form must reproduce the above copyright 12116742Ssam * notice, this list of conditions and the following disclaimer in the 13116742Ssam * documentation and/or other materials provided with the distribution. 14116742Ssam * 15116904Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16116904Ssam * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17116904Ssam * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18116904Ssam * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19116904Ssam * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20116904Ssam * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21116904Ssam * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22116904Ssam * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23116904Ssam * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24116904Ssam * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25116904Ssam * 26116742Ssam * $FreeBSD: head/sys/net80211/ieee80211.h 173863 2007-11-23 06:12:46Z sam $ 27116742Ssam */ 28116742Ssam#ifndef _NET80211_IEEE80211_H_ 29116742Ssam#define _NET80211_IEEE80211_H_ 30116742Ssam 31116742Ssam/* 32116742Ssam * 802.11 protocol definitions. 33116742Ssam */ 34116742Ssam 35116742Ssam#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */ 36116742Ssam/* is 802.11 address multicast/broadcast? */ 37116742Ssam#define IEEE80211_IS_MULTICAST(_a) (*(_a) & 0x01) 38116742Ssam 39116742Ssam/* IEEE 802.11 PLCP header */ 40116742Ssamstruct ieee80211_plcp_hdr { 41170530Ssam uint16_t i_sfd; 42170530Ssam uint8_t i_signal; 43170530Ssam uint8_t i_service; 44170530Ssam uint16_t i_length; 45170530Ssam uint16_t i_crc; 46138568Ssam} __packed; 47116742Ssam 48127903Ssam#define IEEE80211_PLCP_SFD 0xF3A0 49127903Ssam#define IEEE80211_PLCP_SERVICE 0x00 50127903Ssam 51116742Ssam/* 52116742Ssam * generic definitions for IEEE 802.11 frames 53116742Ssam */ 54116742Ssamstruct ieee80211_frame { 55170530Ssam uint8_t i_fc[2]; 56170530Ssam uint8_t i_dur[2]; 57170530Ssam uint8_t i_addr1[IEEE80211_ADDR_LEN]; 58170530Ssam uint8_t i_addr2[IEEE80211_ADDR_LEN]; 59170530Ssam uint8_t i_addr3[IEEE80211_ADDR_LEN]; 60170530Ssam uint8_t i_seq[2]; 61116742Ssam /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ 62116742Ssam /* see below */ 63138568Ssam} __packed; 64116742Ssam 65127903Ssamstruct ieee80211_qosframe { 66170530Ssam uint8_t i_fc[2]; 67170530Ssam uint8_t i_dur[2]; 68170530Ssam uint8_t i_addr1[IEEE80211_ADDR_LEN]; 69170530Ssam uint8_t i_addr2[IEEE80211_ADDR_LEN]; 70170530Ssam uint8_t i_addr3[IEEE80211_ADDR_LEN]; 71170530Ssam uint8_t i_seq[2]; 72170530Ssam uint8_t i_qos[2]; 73127903Ssam /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ 74127903Ssam /* see below */ 75138568Ssam} __packed; 76127903Ssam 77127903Ssamstruct ieee80211_qoscntl { 78170530Ssam uint8_t i_qos[2]; 79127903Ssam}; 80127903Ssam 81116742Ssamstruct ieee80211_frame_addr4 { 82170530Ssam uint8_t i_fc[2]; 83170530Ssam uint8_t i_dur[2]; 84170530Ssam uint8_t i_addr1[IEEE80211_ADDR_LEN]; 85170530Ssam uint8_t i_addr2[IEEE80211_ADDR_LEN]; 86170530Ssam uint8_t i_addr3[IEEE80211_ADDR_LEN]; 87170530Ssam uint8_t i_seq[2]; 88170530Ssam uint8_t i_addr4[IEEE80211_ADDR_LEN]; 89138568Ssam} __packed; 90116742Ssam 91127903Ssam 92127903Ssamstruct ieee80211_qosframe_addr4 { 93170530Ssam uint8_t i_fc[2]; 94170530Ssam uint8_t i_dur[2]; 95170530Ssam uint8_t i_addr1[IEEE80211_ADDR_LEN]; 96170530Ssam uint8_t i_addr2[IEEE80211_ADDR_LEN]; 97170530Ssam uint8_t i_addr3[IEEE80211_ADDR_LEN]; 98170530Ssam uint8_t i_seq[2]; 99170530Ssam uint8_t i_addr4[IEEE80211_ADDR_LEN]; 100170530Ssam uint8_t i_qos[2]; 101138568Ssam} __packed; 102127903Ssam 103116742Ssam#define IEEE80211_FC0_VERSION_MASK 0x03 104116742Ssam#define IEEE80211_FC0_VERSION_SHIFT 0 105116742Ssam#define IEEE80211_FC0_VERSION_0 0x00 106116742Ssam#define IEEE80211_FC0_TYPE_MASK 0x0c 107116742Ssam#define IEEE80211_FC0_TYPE_SHIFT 2 108116742Ssam#define IEEE80211_FC0_TYPE_MGT 0x00 109116742Ssam#define IEEE80211_FC0_TYPE_CTL 0x04 110116742Ssam#define IEEE80211_FC0_TYPE_DATA 0x08 111116742Ssam 112116742Ssam#define IEEE80211_FC0_SUBTYPE_MASK 0xf0 113116742Ssam#define IEEE80211_FC0_SUBTYPE_SHIFT 4 114116742Ssam/* for TYPE_MGT */ 115116742Ssam#define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00 116116742Ssam#define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10 117116742Ssam#define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20 118116742Ssam#define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30 119116742Ssam#define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40 120116742Ssam#define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50 121116742Ssam#define IEEE80211_FC0_SUBTYPE_BEACON 0x80 122116742Ssam#define IEEE80211_FC0_SUBTYPE_ATIM 0x90 123116742Ssam#define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0 124116742Ssam#define IEEE80211_FC0_SUBTYPE_AUTH 0xb0 125116742Ssam#define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0 126170530Ssam#define IEEE80211_FC0_SUBTYPE_ACTION 0xd0 127116742Ssam/* for TYPE_CTL */ 128170530Ssam#define IEEE80211_FC0_SUBTYPE_BAR 0x80 129116742Ssam#define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0 130116742Ssam#define IEEE80211_FC0_SUBTYPE_RTS 0xb0 131116742Ssam#define IEEE80211_FC0_SUBTYPE_CTS 0xc0 132116742Ssam#define IEEE80211_FC0_SUBTYPE_ACK 0xd0 133116742Ssam#define IEEE80211_FC0_SUBTYPE_CF_END 0xe0 134116742Ssam#define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0 135116742Ssam/* for TYPE_DATA (bit combination) */ 136116742Ssam#define IEEE80211_FC0_SUBTYPE_DATA 0x00 137116742Ssam#define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10 138116742Ssam#define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20 139116742Ssam#define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30 140116742Ssam#define IEEE80211_FC0_SUBTYPE_NODATA 0x40 141116742Ssam#define IEEE80211_FC0_SUBTYPE_CFACK 0x50 142116742Ssam#define IEEE80211_FC0_SUBTYPE_CFPOLL 0x60 143116742Ssam#define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK 0x70 144127903Ssam#define IEEE80211_FC0_SUBTYPE_QOS 0x80 145138568Ssam#define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0 146116742Ssam 147116742Ssam#define IEEE80211_FC1_DIR_MASK 0x03 148116742Ssam#define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */ 149116742Ssam#define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */ 150116742Ssam#define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */ 151116742Ssam#define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */ 152116742Ssam 153116742Ssam#define IEEE80211_FC1_MORE_FRAG 0x04 154116742Ssam#define IEEE80211_FC1_RETRY 0x08 155116742Ssam#define IEEE80211_FC1_PWR_MGT 0x10 156116742Ssam#define IEEE80211_FC1_MORE_DATA 0x20 157116742Ssam#define IEEE80211_FC1_WEP 0x40 158116742Ssam#define IEEE80211_FC1_ORDER 0x80 159116742Ssam 160116742Ssam#define IEEE80211_SEQ_FRAG_MASK 0x000f 161116742Ssam#define IEEE80211_SEQ_FRAG_SHIFT 0 162116742Ssam#define IEEE80211_SEQ_SEQ_MASK 0xfff0 163116742Ssam#define IEEE80211_SEQ_SEQ_SHIFT 4 164170530Ssam#define IEEE80211_SEQ_RANGE 4096 165116742Ssam 166170530Ssam#define IEEE80211_SEQ_ADD(seq, incr) \ 167170530Ssam (((seq) + (incr)) & (IEEE80211_SEQ_RANGE-1)) 168170530Ssam#define IEEE80211_SEQ_INC(seq) IEEE80211_SEQ_ADD(seq,1) 169170530Ssam#define IEEE80211_SEQ_SUB(a, b) \ 170170530Ssam (((a) + IEEE80211_SEQ_RANGE - (b)) & (IEEE80211_SEQ_RANGE-1)) 171170530Ssam 172173273Ssam#define IEEE80211_SEQ_BA_RANGE 2048 /* 2^11 */ 173173273Ssam#define IEEE80211_SEQ_BA_BEFORE(a, b) \ 174173273Ssam (IEEE80211_SEQ_SUB(b, a+1) < IEEE80211_SEQ_BA_RANGE-1) 175173273Ssam 176116742Ssam#define IEEE80211_NWID_LEN 32 177116742Ssam 178127903Ssam#define IEEE80211_QOS_TXOP 0x00ff 179127903Ssam/* bit 8 is reserved */ 180170530Ssam#define IEEE80211_QOS_AMSDU 0x80 181170530Ssam#define IEEE80211_QOS_AMSDU_S 7 182138568Ssam#define IEEE80211_QOS_ACKPOLICY 0x60 183138568Ssam#define IEEE80211_QOS_ACKPOLICY_S 5 184170530Ssam#define IEEE80211_QOS_ACKPOLICY_NOACK 0x20 /* No ACK required */ 185170530Ssam#define IEEE80211_QOS_ACKPOLICY_BA 0x60 /* Block ACK */ 186138568Ssam#define IEEE80211_QOS_ESOP 0x10 187138568Ssam#define IEEE80211_QOS_ESOP_S 4 188138568Ssam#define IEEE80211_QOS_TID 0x0f 189127903Ssam 190138568Ssam/* does frame have QoS sequence control data */ 191138568Ssam#define IEEE80211_QOS_HAS_SEQ(wh) \ 192138568Ssam (((wh)->i_fc[0] & \ 193138568Ssam (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == \ 194138568Ssam (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS)) 195138568Ssam 196116742Ssam/* 197138568Ssam * WME/802.11e information element. 198138568Ssam */ 199138568Ssamstruct ieee80211_wme_info { 200170530Ssam uint8_t wme_id; /* IEEE80211_ELEMID_VENDOR */ 201170530Ssam uint8_t wme_len; /* length in bytes */ 202170530Ssam uint8_t wme_oui[3]; /* 0x00, 0x50, 0xf2 */ 203170530Ssam uint8_t wme_type; /* OUI type */ 204170530Ssam uint8_t wme_subtype; /* OUI subtype */ 205170530Ssam uint8_t wme_version; /* spec revision */ 206170530Ssam uint8_t wme_info; /* QoS info */ 207138568Ssam} __packed; 208138568Ssam 209138568Ssam/* 210138568Ssam * WME/802.11e Tspec Element 211138568Ssam */ 212138568Ssamstruct ieee80211_wme_tspec { 213170530Ssam uint8_t ts_id; 214170530Ssam uint8_t ts_len; 215170530Ssam uint8_t ts_oui[3]; 216170530Ssam uint8_t ts_oui_type; 217170530Ssam uint8_t ts_oui_subtype; 218170530Ssam uint8_t ts_version; 219170530Ssam uint8_t ts_tsinfo[3]; 220170530Ssam uint8_t ts_nom_msdu[2]; 221170530Ssam uint8_t ts_max_msdu[2]; 222170530Ssam uint8_t ts_min_svc[4]; 223170530Ssam uint8_t ts_max_svc[4]; 224170530Ssam uint8_t ts_inactv_intv[4]; 225170530Ssam uint8_t ts_susp_intv[4]; 226170530Ssam uint8_t ts_start_svc[4]; 227170530Ssam uint8_t ts_min_rate[4]; 228170530Ssam uint8_t ts_mean_rate[4]; 229170530Ssam uint8_t ts_max_burst[4]; 230170530Ssam uint8_t ts_min_phy[4]; 231170530Ssam uint8_t ts_peak_rate[4]; 232170530Ssam uint8_t ts_delay[4]; 233170530Ssam uint8_t ts_surplus[2]; 234170530Ssam uint8_t ts_medium_time[2]; 235138568Ssam} __packed; 236138568Ssam 237138568Ssam/* 238138568Ssam * WME AC parameter field 239138568Ssam */ 240138568Ssamstruct ieee80211_wme_acparams { 241170530Ssam uint8_t acp_aci_aifsn; 242170530Ssam uint8_t acp_logcwminmax; 243170530Ssam uint16_t acp_txop; 244138568Ssam} __packed; 245138568Ssam 246138568Ssam#define WME_NUM_AC 4 /* 4 AC categories */ 247170530Ssam#define WME_NUM_TID 16 /* 16 tids */ 248138568Ssam 249138568Ssam#define WME_PARAM_ACI 0x60 /* Mask for ACI field */ 250138568Ssam#define WME_PARAM_ACI_S 5 /* Shift for ACI field */ 251138568Ssam#define WME_PARAM_ACM 0x10 /* Mask for ACM bit */ 252138568Ssam#define WME_PARAM_ACM_S 4 /* Shift for ACM bit */ 253138568Ssam#define WME_PARAM_AIFSN 0x0f /* Mask for aifsn field */ 254138568Ssam#define WME_PARAM_AIFSN_S 0 /* Shift for aifsn field */ 255138568Ssam#define WME_PARAM_LOGCWMIN 0x0f /* Mask for CwMin field (in log) */ 256138568Ssam#define WME_PARAM_LOGCWMIN_S 0 /* Shift for CwMin field */ 257138568Ssam#define WME_PARAM_LOGCWMAX 0xf0 /* Mask for CwMax field (in log) */ 258138568Ssam#define WME_PARAM_LOGCWMAX_S 4 /* Shift for CwMax field */ 259138568Ssam 260138568Ssam#define WME_AC_TO_TID(_ac) ( \ 261138568Ssam ((_ac) == WME_AC_VO) ? 6 : \ 262138568Ssam ((_ac) == WME_AC_VI) ? 5 : \ 263138568Ssam ((_ac) == WME_AC_BK) ? 1 : \ 264138568Ssam 0) 265138568Ssam 266138568Ssam#define TID_TO_WME_AC(_tid) ( \ 267173863Ssam ((_tid) == 0 || (_tid) == 3) ? WME_AC_BE : \ 268138568Ssam ((_tid) < 3) ? WME_AC_BK : \ 269138568Ssam ((_tid) < 6) ? WME_AC_VI : \ 270138568Ssam WME_AC_VO) 271138568Ssam 272138568Ssam/* 273138568Ssam * WME Parameter Element 274138568Ssam */ 275138568Ssamstruct ieee80211_wme_param { 276170530Ssam uint8_t param_id; 277170530Ssam uint8_t param_len; 278170530Ssam uint8_t param_oui[3]; 279170530Ssam uint8_t param_oui_type; 280172055Ssam uint8_t param_oui_subtype; 281170530Ssam uint8_t param_version; 282170530Ssam uint8_t param_qosInfo; 283138568Ssam#define WME_QOSINFO_COUNT 0x0f /* Mask for param count field */ 284170530Ssam uint8_t param_reserved; 285138568Ssam struct ieee80211_wme_acparams params_acParams[WME_NUM_AC]; 286138568Ssam} __packed; 287138568Ssam 288138568Ssam/* 289138568Ssam * Management Notification Frame 290138568Ssam */ 291138568Ssamstruct ieee80211_mnf { 292170530Ssam uint8_t mnf_category; 293170530Ssam uint8_t mnf_action; 294170530Ssam uint8_t mnf_dialog; 295170530Ssam uint8_t mnf_status; 296138568Ssam} __packed; 297138568Ssam#define MNF_SETUP_REQ 0 298138568Ssam#define MNF_SETUP_RESP 1 299138568Ssam#define MNF_TEARDOWN 2 300138568Ssam 301170530Ssam/* 302170530Ssam * 802.11n Management Action Frames 303170530Ssam */ 304170530Ssam/* generic frame format */ 305170530Ssamstruct ieee80211_action { 306170530Ssam uint8_t ia_category; 307170530Ssam uint8_t ia_action; 308170530Ssam} __packed; 309170530Ssam 310170530Ssam#define IEEE80211_ACTION_CAT_QOS 0 /* QoS */ 311170530Ssam#define IEEE80211_ACTION_CAT_BA 3 /* BA */ 312172055Ssam#define IEEE80211_ACTION_CAT_HT 7 /* HT */ 313170530Ssam 314170530Ssam#define IEEE80211_ACTION_HT_TXCHWIDTH 0 /* recommended xmit chan width*/ 315170530Ssam#define IEEE80211_ACTION_HT_MIMOPWRSAVE 1 /* MIMO power save */ 316170530Ssam 317170530Ssam/* HT - recommended transmission channel width */ 318170530Ssamstruct ieee80211_action_ht_txchwidth { 319170530Ssam struct ieee80211_action at_header; 320170530Ssam uint8_t at_chwidth; 321170530Ssam} __packed; 322170530Ssam 323170530Ssam#define IEEE80211_A_HT_TXCHWIDTH_20 0 324170530Ssam#define IEEE80211_A_HT_TXCHWIDTH_2040 1 325170530Ssam 326172055Ssam/* HT - MIMO Power Save (NB: D2.04) */ 327170530Ssamstruct ieee80211_action_ht_mimopowersave { 328170530Ssam struct ieee80211_action am_header; 329173618Ssam uint8_t am_control; 330170530Ssam} __packed; 331170530Ssam 332173618Ssam#define IEEE80211_A_HT_MIMOPWRSAVE_ENA 0x01 /* PS enabled */ 333173618Ssam#define IEEE80211_A_HT_MIMOPWRSAVE_MODE 0x02 334173618Ssam#define IEEE80211_A_HT_MIMOPWRSAVE_MODE_S 1 335173618Ssam#define IEEE80211_A_HT_MIMOPWRSAVE_DYNAMIC 0x02 /* Dynamic Mode */ 336173618Ssam#define IEEE80211_A_HT_MIMOPWRSAVE_STATIC 0x00 /* no SM packets */ 337173618Ssam/* bits 2-7 reserved */ 338173618Ssam 339170530Ssam/* Block Ack actions */ 340170530Ssam#define IEEE80211_ACTION_BA_ADDBA_REQUEST 0 /* ADDBA request */ 341170530Ssam#define IEEE80211_ACTION_BA_ADDBA_RESPONSE 1 /* ADDBA response */ 342170530Ssam#define IEEE80211_ACTION_BA_DELBA 2 /* DELBA */ 343170530Ssam 344170530Ssam/* Block Ack Parameter Set */ 345170530Ssam#define IEEE80211_BAPS_BUFSIZ 0xffc0 /* buffer size */ 346170530Ssam#define IEEE80211_BAPS_BUFSIZ_S 6 347170530Ssam#define IEEE80211_BAPS_TID 0x003c /* TID */ 348170530Ssam#define IEEE80211_BAPS_TID_S 2 349170530Ssam#define IEEE80211_BAPS_POLICY 0x0002 /* block ack policy */ 350170530Ssam#define IEEE80211_BAPS_POLICY_S 1 351170530Ssam 352170530Ssam#define IEEE80211_BAPS_POLICY_DELAYED (0<<IEEE80211_BAPS_POLICY_S) 353170530Ssam#define IEEE80211_BAPS_POLICY_IMMEDIATE (1<<IEEE80211_BAPS_POLICY_S) 354170530Ssam 355170530Ssam/* Block Ack Sequence Control */ 356170530Ssam#define IEEE80211_BASEQ_START 0xfff0 /* starting seqnum */ 357170530Ssam#define IEEE80211_BASEQ_START_S 4 358170530Ssam#define IEEE80211_BASEQ_FRAG 0x000f /* fragment number */ 359170530Ssam#define IEEE80211_BASEQ_FRAG_S 0 360170530Ssam 361170530Ssam/* Delayed Block Ack Parameter Set */ 362170530Ssam#define IEEE80211_DELBAPS_TID 0xf000 /* TID */ 363170530Ssam#define IEEE80211_DELBAPS_TID_S 12 364170530Ssam#define IEEE80211_DELBAPS_INIT 0x0800 /* initiator */ 365170530Ssam#define IEEE80211_DELBAPS_INIT_S 11 366170530Ssam 367170530Ssam/* BA - ADDBA request */ 368170530Ssamstruct ieee80211_action_ba_addbarequest { 369170530Ssam struct ieee80211_action rq_header; 370170530Ssam uint8_t rq_dialogtoken; 371170530Ssam uint16_t rq_baparamset; 372170530Ssam uint16_t rq_batimeout; /* in TUs */ 373170530Ssam uint16_t rq_baseqctl; 374170530Ssam} __packed; 375170530Ssam 376170530Ssam/* BA - ADDBA response */ 377170530Ssamstruct ieee80211_action_ba_addbaresponse { 378170530Ssam struct ieee80211_action rs_header; 379170530Ssam uint8_t rs_dialogtoken; 380170530Ssam uint16_t rs_statuscode; 381170530Ssam uint16_t rs_baparamset; 382170530Ssam uint16_t rs_batimeout; /* in TUs */ 383170530Ssam} __packed; 384170530Ssam 385170530Ssam/* BA - DELBA */ 386170530Ssamstruct ieee80211_action_ba_delba { 387170530Ssam struct ieee80211_action dl_header; 388170530Ssam uint16_t dl_baparamset; 389170530Ssam uint16_t dl_reasoncode; 390170530Ssam} __packed; 391170530Ssam 392170530Ssam/* BAR Control */ 393170530Ssam#define IEEE80211_BAR_TID 0xf000 /* TID */ 394170530Ssam#define IEEE80211_BAR_TID_S 12 395170530Ssam#define IEEE80211_BAR_COMP 0x0004 /* compressed */ 396170530Ssam#define IEEE80211_BAR_MTID 0x0002 397170530Ssam#define IEEE80211_BAR_NOACK 0x0001 /* no-ack policy */ 398170530Ssam 399170530Ssamstruct ieee80211_ba_request { 400170530Ssam uint16_t rq_barctl; 401170530Ssam uint16_t rq_barseqctl; 402170530Ssam} __packed; 403170530Ssam 404138568Ssam/* 405120098Ssam * Control frames. 406120098Ssam */ 407120098Ssamstruct ieee80211_frame_min { 408170530Ssam uint8_t i_fc[2]; 409170530Ssam uint8_t i_dur[2]; 410170530Ssam uint8_t i_addr1[IEEE80211_ADDR_LEN]; 411170530Ssam uint8_t i_addr2[IEEE80211_ADDR_LEN]; 412120098Ssam /* FCS */ 413138568Ssam} __packed; 414120098Ssam 415120098Ssamstruct ieee80211_frame_rts { 416170530Ssam uint8_t i_fc[2]; 417170530Ssam uint8_t i_dur[2]; 418170530Ssam uint8_t i_ra[IEEE80211_ADDR_LEN]; 419170530Ssam uint8_t i_ta[IEEE80211_ADDR_LEN]; 420120098Ssam /* FCS */ 421138568Ssam} __packed; 422120098Ssam 423120098Ssamstruct ieee80211_frame_cts { 424170530Ssam uint8_t i_fc[2]; 425170530Ssam uint8_t i_dur[2]; 426170530Ssam uint8_t i_ra[IEEE80211_ADDR_LEN]; 427120098Ssam /* FCS */ 428138568Ssam} __packed; 429120098Ssam 430120098Ssamstruct ieee80211_frame_ack { 431170530Ssam uint8_t i_fc[2]; 432170530Ssam uint8_t i_dur[2]; 433170530Ssam uint8_t i_ra[IEEE80211_ADDR_LEN]; 434120098Ssam /* FCS */ 435138568Ssam} __packed; 436120098Ssam 437120098Ssamstruct ieee80211_frame_pspoll { 438170530Ssam uint8_t i_fc[2]; 439170530Ssam uint8_t i_aid[2]; 440170530Ssam uint8_t i_bssid[IEEE80211_ADDR_LEN]; 441170530Ssam uint8_t i_ta[IEEE80211_ADDR_LEN]; 442120098Ssam /* FCS */ 443138568Ssam} __packed; 444120098Ssam 445120098Ssamstruct ieee80211_frame_cfend { /* NB: also CF-End+CF-Ack */ 446170530Ssam uint8_t i_fc[2]; 447170530Ssam uint8_t i_dur[2]; /* should be zero */ 448170530Ssam uint8_t i_ra[IEEE80211_ADDR_LEN]; 449170530Ssam uint8_t i_bssid[IEEE80211_ADDR_LEN]; 450120098Ssam /* FCS */ 451138568Ssam} __packed; 452120098Ssam 453170530Ssamstruct ieee80211_frame_bar { 454170530Ssam uint8_t i_fc[2]; 455170530Ssam uint8_t i_dur[2]; 456170530Ssam uint8_t i_ra[IEEE80211_ADDR_LEN]; 457170530Ssam uint8_t i_ta[IEEE80211_ADDR_LEN]; 458170530Ssam uint16_t i_ctl; 459170530Ssam uint16_t i_seq; 460170530Ssam /* FCS */ 461170530Ssam} __packed; 462170530Ssam 463120098Ssam/* 464116742Ssam * BEACON management packets 465116742Ssam * 466116742Ssam * octet timestamp[8] 467116742Ssam * octet beacon interval[2] 468116742Ssam * octet capability information[2] 469116742Ssam * information element 470116742Ssam * octet elemid 471116742Ssam * octet length 472116742Ssam * octet information[length] 473116742Ssam */ 474116742Ssam 475116742Ssam#define IEEE80211_BEACON_INTERVAL(beacon) \ 476116742Ssam ((beacon)[8] | ((beacon)[9] << 8)) 477116742Ssam#define IEEE80211_BEACON_CAPABILITY(beacon) \ 478116742Ssam ((beacon)[10] | ((beacon)[11] << 8)) 479116742Ssam 480116742Ssam#define IEEE80211_CAPINFO_ESS 0x0001 481116742Ssam#define IEEE80211_CAPINFO_IBSS 0x0002 482116742Ssam#define IEEE80211_CAPINFO_CF_POLLABLE 0x0004 483116742Ssam#define IEEE80211_CAPINFO_CF_POLLREQ 0x0008 484116742Ssam#define IEEE80211_CAPINFO_PRIVACY 0x0010 485116742Ssam#define IEEE80211_CAPINFO_SHORT_PREAMBLE 0x0020 486116742Ssam#define IEEE80211_CAPINFO_PBCC 0x0040 487116742Ssam#define IEEE80211_CAPINFO_CHNL_AGILITY 0x0080 488172055Ssam#define IEEE80211_CAPINFO_SPECTRUM_MGMT 0x0100 489172055Ssam/* bit 9 is reserved */ 490116742Ssam#define IEEE80211_CAPINFO_SHORT_SLOTTIME 0x0400 491127903Ssam#define IEEE80211_CAPINFO_RSN 0x0800 492127903Ssam/* bit 12 is reserved */ 493116742Ssam#define IEEE80211_CAPINFO_DSSSOFDM 0x2000 494116742Ssam/* bits 14-15 are reserved */ 495116742Ssam 496116742Ssam/* 497127903Ssam * 802.11i/WPA information element (maximally sized). 498127903Ssam */ 499127903Ssamstruct ieee80211_ie_wpa { 500170530Ssam uint8_t wpa_id; /* IEEE80211_ELEMID_VENDOR */ 501170530Ssam uint8_t wpa_len; /* length in bytes */ 502170530Ssam uint8_t wpa_oui[3]; /* 0x00, 0x50, 0xf2 */ 503170530Ssam uint8_t wpa_type; /* OUI type */ 504170530Ssam uint16_t wpa_version; /* spec revision */ 505170530Ssam uint32_t wpa_mcipher[1]; /* multicast/group key cipher */ 506170530Ssam uint16_t wpa_uciphercnt; /* # pairwise key ciphers */ 507170530Ssam uint32_t wpa_uciphers[8];/* ciphers */ 508170530Ssam uint16_t wpa_authselcnt; /* authentication selector cnt*/ 509170530Ssam uint32_t wpa_authsels[8];/* selectors */ 510170530Ssam uint16_t wpa_caps; /* 802.11i capabilities */ 511170530Ssam uint16_t wpa_pmkidcnt; /* 802.11i pmkid count */ 512170530Ssam uint16_t wpa_pmkids[8]; /* 802.11i pmkids */ 513138568Ssam} __packed; 514127903Ssam 515127903Ssam/* 516170530Ssam * 802.11n HT Capability IE 517170530Ssam * NB: these reflect D1.10 518170530Ssam */ 519170530Ssamstruct ieee80211_ie_htcap { 520170530Ssam uint8_t hc_id; /* element ID */ 521170530Ssam uint8_t hc_len; /* length in bytes */ 522170530Ssam uint16_t hc_cap; /* HT caps (see below) */ 523170530Ssam uint8_t hc_param; /* HT params (see below) */ 524170530Ssam uint8_t hc_mcsset[16]; /* supported MCS set */ 525170530Ssam uint16_t hc_extcap; /* extended HT capabilities */ 526170530Ssam uint32_t hc_txbf; /* txbf capabilities */ 527170530Ssam uint8_t hc_antenna; /* antenna capabilities */ 528170530Ssam} __packed; 529170530Ssam 530170530Ssam/* HT capability flags (ht_cap) */ 531170530Ssam#define IEEE80211_HTCAP_LDPC 0x0001 /* LDPC supported */ 532170530Ssam#define IEEE80211_HTCAP_CHWIDTH40 0x0002 /* 20/40 supported */ 533170530Ssam#define IEEE80211_HTCAP_SMPS 0x000c /* SM Power Save mode */ 534170530Ssam#define IEEE80211_HTCAP_SMPS_OFF 0x0000 /* none (static mode) */ 535170530Ssam#define IEEE80211_HTCAP_SMPS_DYNAMIC 0x0004 /* send RTS first */ 536170530Ssam/* NB: SMPS value 2 is reserved */ 537170530Ssam#define IEEE80211_HTCAP_SMPS_ENA 0x000c /* enabled */ 538170530Ssam#define IEEE80211_HTCAP_GREENFIELD 0x0010 /* Greenfield supported */ 539170530Ssam#define IEEE80211_HTCAP_SHORTGI20 0x0020 /* Short GI in 20MHz */ 540170530Ssam#define IEEE80211_HTCAP_SHORTGI40 0x0040 /* Short GI in 40MHz */ 541170530Ssam#define IEEE80211_HTCAP_TXSTBC 0x0080 /* STBC tx ok */ 542170530Ssam#define IEEE80211_HTCAP_RXSTBC 0x0300 /* STBC rx support */ 543170530Ssam#define IEEE80211_HTCAP_RXSTBC_S 8 544170530Ssam#define IEEE80211_HTCAP_RXSTBC_1STREAM 0x0100 /* 1 spatial stream */ 545170530Ssam#define IEEE80211_HTCAP_RXSTBC_2STREAM 0x0200 /* 1-2 spatial streams*/ 546170530Ssam#define IEEE80211_HTCAP_RXSTBC_3STREAM 0x0300 /* 1-3 spatial streams*/ 547170530Ssam#define IEEE80211_HTCAP_DELBA 0x0400 /* HT DELBA supported */ 548170530Ssam#define IEEE80211_HTCAP_MAXAMSDU 0x0800 /* max A-MSDU length */ 549170530Ssam#define IEEE80211_HTCAP_MAXAMSDU_7935 0x0800 /* 7935 octets */ 550170530Ssam#define IEEE80211_HTCAP_MAXAMSDU_3839 0x0000 /* 3839 octets */ 551170530Ssam#define IEEE80211_HTCAP_DSSSCCK40 0x1000 /* DSSS/CCK in 40MHz */ 552170530Ssam#define IEEE80211_HTCAP_PSMP 0x2000 /* PSMP supported */ 553170530Ssam#define IEEE80211_HTCAP_40INTOLERANT 0x4000 /* 40MHz intolerant */ 554170530Ssam#define IEEE80211_HTCAP_LSIGTXOPPROT 0x8000 /* L-SIG TXOP prot */ 555170530Ssam 556170530Ssam/* HT parameters (hc_param) */ 557170530Ssam#define IEEE80211_HTCAP_MAXRXAMPDU 0x03 /* max rx A-MPDU factor */ 558170530Ssam#define IEEE80211_HTCAP_MAXRXAMPDU_S 0 559173273Ssam#define IEEE80211_HTCAP_MAXRXAMPDU_8K 0 560173273Ssam#define IEEE80211_HTCAP_MAXRXAMPDU_16K 1 561173273Ssam#define IEEE80211_HTCAP_MAXRXAMPDU_32K 2 562173273Ssam#define IEEE80211_HTCAP_MAXRXAMPDU_64K 3 563170530Ssam#define IEEE80211_HTCAP_MPDUDENSITY 0x1c /* min MPDU start spacing */ 564170530Ssam#define IEEE80211_HTCAP_MPDUDENSITY_S 2 565173273Ssam#define IEEE80211_HTCAP_MPDUDENSITY_NA 0 /* no time restriction */ 566173273Ssam#define IEEE80211_HTCAP_MPDUDENSITY_025 1 /* 1/4 us */ 567173273Ssam#define IEEE80211_HTCAP_MPDUDENSITY_05 2 /* 1/2 us */ 568173273Ssam#define IEEE80211_HTCAP_MPDUDENSITY_1 3 /* 1 us */ 569173273Ssam#define IEEE80211_HTCAP_MPDUDENSITY_2 4 /* 2 us */ 570173273Ssam#define IEEE80211_HTCAP_MPDUDENSITY_4 5 /* 4 us */ 571173273Ssam#define IEEE80211_HTCAP_MPDUDENSITY_8 6 /* 8 us */ 572173273Ssam#define IEEE80211_HTCAP_MPDUDENSITY_16 7 /* 16 us */ 573170530Ssam 574170530Ssam/* HT extended capabilities (hc_extcap) */ 575170530Ssam#define IEEE80211_HTCAP_PCO 0x0001 /* PCO capable */ 576170530Ssam#define IEEE80211_HTCAP_PCOTRANS 0x0006 /* PCO transition time */ 577170530Ssam#define IEEE80211_HTCAP_PCOTRANS_S 1 578170530Ssam#define IEEE80211_HTCAP_PCOTRANS_04 0x0002 /* 400 us */ 579170530Ssam#define IEEE80211_HTCAP_PCOTRANS_15 0x0004 /* 1.5 ms */ 580170530Ssam#define IEEE80211_HTCAP_PCOTRANS_5 0x0006 /* 5 ms */ 581170530Ssam/* bits 3-7 reserved */ 582170530Ssam#define IEEE80211_HTCAP_MCSFBACK 0x0300 /* MCS feedback */ 583170530Ssam#define IEEE80211_HTCAP_MCSFBACK_S 8 584170530Ssam#define IEEE80211_HTCAP_MCSFBACK_NONE 0x0000 /* nothing provided */ 585170530Ssam#define IEEE80211_HTCAP_MCSFBACK_UNSOL 0x0200 /* unsolicited feedback */ 586170530Ssam#define IEEE80211_HTCAP_MCSFBACK_MRQ 0x0300 /* " "+respond to MRQ */ 587170530Ssam#define IEEE80211_HTCAP_HTC 0x0400 /* +HTC support */ 588170530Ssam#define IEEE80211_HTCAP_RDR 0x0800 /* reverse direction responder*/ 589170530Ssam/* bits 12-15 reserved */ 590170530Ssam 591170530Ssam/* 592170530Ssam * 802.11n HT Information IE 593170530Ssam */ 594170530Ssamstruct ieee80211_ie_htinfo { 595170530Ssam uint8_t hi_id; /* element ID */ 596170530Ssam uint8_t hi_len; /* length in bytes */ 597170530Ssam uint8_t hi_ctrlchannel; /* primary channel */ 598170530Ssam uint8_t hi_byte1; /* ht ie byte 1 */ 599172055Ssam uint8_t hi_byte2; /* ht ie byte 2 */ 600172055Ssam uint8_t hi_byte3; /* ht ie byte 3 */ 601170530Ssam uint16_t hi_byte45; /* ht ie bytes 4+5 */ 602172055Ssam uint8_t hi_basicmcsset[16]; /* basic MCS set */ 603170530Ssam} __packed; 604170530Ssam 605170530Ssam/* byte1 */ 606170530Ssam#define IEEE80211_HTINFO_2NDCHAN 0x03 /* secondary/ext chan offset */ 607170530Ssam#define IEEE80211_HTINFO_2NDCHAN_S 0 608170530Ssam#define IEEE80211_HTINFO_2NDCHAN_NONE 0x00 /* no secondary/ext channel */ 609170530Ssam#define IEEE80211_HTINFO_2NDCHAN_ABOVE 0x01 /* above private channel */ 610170530Ssam/* NB: 2 is reserved */ 611170530Ssam#define IEEE80211_HTINFO_2NDCHAN_BELOW 0x03 /* below primary channel */ 612170530Ssam#define IEEE80211_HTINFO_TXWIDTH 0x04 /* tx channel width */ 613170530Ssam#define IEEE80211_HTINFO_TXWIDTH_20 0x00 /* 20MHz width */ 614170530Ssam#define IEEE80211_HTINFO_TXWIDTH_2040 0x04 /* any supported width */ 615170530Ssam#define IEEE80211_HTINFO_RIFSMODE 0x08 /* Reduced IFS (RIFS) use */ 616170530Ssam#define IEEE80211_HTINFO_RIFSMODE_PROH 0x00 /* RIFS use prohibited */ 617170530Ssam#define IEEE80211_HTINFO_RIFSMODE_PERM 0x08 /* RIFS use permitted */ 618170530Ssam#define IEEE80211_HTINFO_PMSPONLY 0x10 /* PSMP required to associate */ 619170530Ssam#define IEEE80211_HTINFO_SIGRAN 0xe0 /* shortest Service Interval */ 620170530Ssam#define IEEE80211_HTINFO_SIGRAN_S 5 621170530Ssam#define IEEE80211_HTINFO_SIGRAN_5 0x00 /* 5 ms */ 622170530Ssam/* XXX add rest */ 623170530Ssam 624170530Ssam/* bytes 2+3 */ 625170530Ssam#define IEEE80211_HTINFO_OPMODE 0x03 /* operating mode */ 626170530Ssam#define IEEE80211_HTINFO_OPMODE_S 0 627170530Ssam#define IEEE80211_HTINFO_OPMODE_PURE 0x00 /* no protection */ 628172055Ssam#define IEEE80211_HTINFO_OPMODE_PROTOPT 0x01 /* protection optional */ 629172055Ssam#define IEEE80211_HTINFO_OPMODE_HT20PR 0x02 /* protection for HT20 sta's */ 630172055Ssam#define IEEE80211_HTINFO_OPMODE_MIXED 0x03 /* protection for legacy sta's*/ 631170530Ssam#define IEEE80211_HTINFO_NONGF_PRESENT 0x04 /* non-GF sta's present */ 632170530Ssam#define IEEE80211_HTINFO_TXBL 0x08 /* transmit burst limit */ 633170530Ssam#define IEEE80211_HTINFO_NONHT_PRESENT 0x10 /* non-HT sta's present */ 634170530Ssam/* bits 5-15 reserved */ 635170530Ssam 636170530Ssam/* bytes 4+5 */ 637170530Ssam#define IEEE80211_HTINFO_2NDARYBEACON 0x01 638170530Ssam#define IEEE80211_HTINFO_LSIGTXOPPROT 0x02 639170530Ssam#define IEEE80211_HTINFO_PCO_ACTIVE 0x04 640170530Ssam#define IEEE80211_HTINFO_40MHZPHASE 0x08 641170530Ssam 642170530Ssam/* byte5 */ 643170530Ssam#define IEEE80211_HTINFO_BASIC_STBCMCS 0x7f 644170530Ssam#define IEEE80211_HTINFO_BASIC_STBCMCS_S 0 645170530Ssam#define IEEE80211_HTINFO_DUALPROTECTED 0x80 646170530Ssam 647170530Ssam/* 648138568Ssam * Management information element payloads. 649116742Ssam */ 650116742Ssam 651116742Ssamenum { 652138568Ssam IEEE80211_ELEMID_SSID = 0, 653138568Ssam IEEE80211_ELEMID_RATES = 1, 654138568Ssam IEEE80211_ELEMID_FHPARMS = 2, 655138568Ssam IEEE80211_ELEMID_DSPARMS = 3, 656138568Ssam IEEE80211_ELEMID_CFPARMS = 4, 657138568Ssam IEEE80211_ELEMID_TIM = 5, 658138568Ssam IEEE80211_ELEMID_IBSSPARMS = 6, 659138568Ssam IEEE80211_ELEMID_COUNTRY = 7, 660138568Ssam IEEE80211_ELEMID_CHALLENGE = 16, 661127903Ssam /* 17-31 reserved for challenge text extension */ 662170530Ssam IEEE80211_ELEMID_PWRCNSTR = 32, 663170530Ssam IEEE80211_ELEMID_PWRCAP = 33, 664170530Ssam IEEE80211_ELEMID_TPCREQ = 34, 665170530Ssam IEEE80211_ELEMID_TPCREP = 35, 666170530Ssam IEEE80211_ELEMID_SUPPCHAN = 36, 667170530Ssam IEEE80211_ELEMID_CHANSWITCHANN = 37, 668170530Ssam IEEE80211_ELEMID_MEASREQ = 38, 669170530Ssam IEEE80211_ELEMID_MEASREP = 39, 670170530Ssam IEEE80211_ELEMID_QUIET = 40, 671170530Ssam IEEE80211_ELEMID_IBSSDFS = 41, 672138568Ssam IEEE80211_ELEMID_ERP = 42, 673170530Ssam IEEE80211_ELEMID_HTCAP = 45, 674138568Ssam IEEE80211_ELEMID_RSN = 48, 675138568Ssam IEEE80211_ELEMID_XRATES = 50, 676170530Ssam IEEE80211_ELEMID_HTINFO = 61, 677138568Ssam IEEE80211_ELEMID_TPC = 150, 678138568Ssam IEEE80211_ELEMID_CCKM = 156, 679138568Ssam IEEE80211_ELEMID_VENDOR = 221, /* vendor private */ 680116742Ssam}; 681116742Ssam 682138568Ssamstruct ieee80211_tim_ie { 683170530Ssam uint8_t tim_ie; /* IEEE80211_ELEMID_TIM */ 684170530Ssam uint8_t tim_len; 685170530Ssam uint8_t tim_count; /* DTIM count */ 686170530Ssam uint8_t tim_period; /* DTIM period */ 687170530Ssam uint8_t tim_bitctl; /* bitmap control */ 688170530Ssam uint8_t tim_bitmap[1]; /* variable-length bitmap */ 689138568Ssam} __packed; 690127903Ssam 691138568Ssamstruct ieee80211_country_ie { 692170530Ssam uint8_t ie; /* IEEE80211_ELEMID_COUNTRY */ 693170530Ssam uint8_t len; 694170530Ssam uint8_t cc[3]; /* ISO CC+(I)ndoor/(O)utdoor */ 695138568Ssam struct { 696170530Ssam uint8_t schan; /* starting channel */ 697170530Ssam uint8_t nchan; /* number channels */ 698170530Ssam uint8_t maxtxpwr; /* tx power cap */ 699173273Ssam } __packed band[10]; /* sub bands */ 700138568Ssam} __packed; 701116742Ssam 702170530Ssam/* 703172055Ssam * 802.11h Channel Switch Announcement (CSA). 704172055Ssam */ 705172055Ssamstruct ieee80211_csa_ie { 706172055Ssam uint8_t csa_ie; /* IEEE80211_ELEMID_CHANSWITCHANN */ 707172055Ssam uint8_t csa_len; 708172055Ssam uint8_t csa_mode; /* Channel Switch Mode */ 709172055Ssam uint8_t csa_newchan; /* New Channel Number */ 710172055Ssam uint8_t csa_count; /* Channel Switch Count */ 711172055Ssam} __packed; 712172055Ssam 713172055Ssam/* 714170530Ssam * Atheros advanced capability information element. 715170530Ssam */ 716170530Ssamstruct ieee80211_ath_ie { 717170530Ssam uint8_t ath_id; /* IEEE80211_ELEMID_VENDOR */ 718170530Ssam uint8_t ath_len; /* length in bytes */ 719170530Ssam uint8_t ath_oui[3]; /* 0x00, 0x03, 0x7f */ 720170530Ssam uint8_t ath_oui_type; /* OUI type */ 721170530Ssam uint8_t ath_oui_subtype; /* OUI subtype */ 722170530Ssam uint8_t ath_version; /* spec revision */ 723170530Ssam uint8_t ath_capability; /* capability info */ 724170530Ssam#define ATHEROS_CAP_TURBO_PRIME 0x01 /* dynamic turbo--aka Turbo' */ 725170530Ssam#define ATHEROS_CAP_COMPRESSION 0x02 /* data compression */ 726170530Ssam#define ATHEROS_CAP_FAST_FRAME 0x04 /* fast (jumbo) frames */ 727170530Ssam#define ATHEROS_CAP_XR 0x08 /* Xtended Range support */ 728170530Ssam#define ATHEROS_CAP_AR 0x10 /* Advanded Radar support */ 729170530Ssam#define ATHEROS_CAP_BURST 0x20 /* Bursting - not negotiated */ 730170530Ssam#define ATHEROS_CAP_WME 0x40 /* CWMin tuning */ 731170530Ssam#define ATHEROS_CAP_BOOST 0x80 /* use turbo/!turbo mode */ 732170530Ssam uint8_t ath_defkeyix[2]; 733170530Ssam} __packed; 734170530Ssam 735172055Ssam/* rate set entries are in .5 Mb/s units, and potentially marked as basic */ 736138568Ssam#define IEEE80211_RATE_BASIC 0x80 737138568Ssam#define IEEE80211_RATE_VAL 0x7f 738138568Ssam 739116742Ssam/* EPR information element flags */ 740138568Ssam#define IEEE80211_ERP_NON_ERP_PRESENT 0x01 741138568Ssam#define IEEE80211_ERP_USE_PROTECTION 0x02 742138568Ssam#define IEEE80211_ERP_LONG_PREAMBLE 0x04 743116742Ssam 744170530Ssam#define ATH_OUI 0x7f0300 /* Atheros OUI */ 745127903Ssam#define ATH_OUI_TYPE 0x01 746170530Ssam#define ATH_OUI_SUBTYPE 0x01 747170530Ssam#define ATH_OUI_VERSION 0x00 748127903Ssam 749170530Ssam#define BCM_OUI 0x4c9000 /* Broadcom OUI */ 750170530Ssam#define BCM_OUI_HTCAP 51 /* pre-draft HTCAP ie */ 751170530Ssam#define BCM_OUI_HTINFO 52 /* pre-draft HTINFO ie */ 752170530Ssam 753127903Ssam#define WPA_OUI 0xf25000 754127903Ssam#define WPA_OUI_TYPE 0x01 755138568Ssam#define WPA_VERSION 1 /* current supported version */ 756127903Ssam 757127903Ssam#define WPA_CSE_NULL 0x00 758127903Ssam#define WPA_CSE_WEP40 0x01 759127903Ssam#define WPA_CSE_TKIP 0x02 760127903Ssam#define WPA_CSE_CCMP 0x04 761127903Ssam#define WPA_CSE_WEP104 0x05 762127903Ssam 763127903Ssam#define WPA_ASE_NONE 0x00 764127903Ssam#define WPA_ASE_8021X_UNSPEC 0x01 765127903Ssam#define WPA_ASE_8021X_PSK 0x02 766127903Ssam 767138568Ssam#define RSN_OUI 0xac0f00 768138568Ssam#define RSN_VERSION 1 /* current supported version */ 769138568Ssam 770138568Ssam#define RSN_CSE_NULL 0x00 771138568Ssam#define RSN_CSE_WEP40 0x01 772138568Ssam#define RSN_CSE_TKIP 0x02 773138568Ssam#define RSN_CSE_WRAP 0x03 774138568Ssam#define RSN_CSE_CCMP 0x04 775138568Ssam#define RSN_CSE_WEP104 0x05 776138568Ssam 777138568Ssam#define RSN_ASE_NONE 0x00 778138568Ssam#define RSN_ASE_8021X_UNSPEC 0x01 779138568Ssam#define RSN_ASE_8021X_PSK 0x02 780138568Ssam 781138568Ssam#define RSN_CAP_PREAUTH 0x01 782138568Ssam 783138568Ssam#define WME_OUI 0xf25000 784138568Ssam#define WME_OUI_TYPE 0x02 785138568Ssam#define WME_INFO_OUI_SUBTYPE 0x00 786138568Ssam#define WME_PARAM_OUI_SUBTYPE 0x01 787138568Ssam#define WME_VERSION 1 788138568Ssam 789138568Ssam/* WME stream classes */ 790138568Ssam#define WME_AC_BE 0 /* best effort */ 791138568Ssam#define WME_AC_BK 1 /* background */ 792138568Ssam#define WME_AC_VI 2 /* video */ 793138568Ssam#define WME_AC_VO 3 /* voice */ 794138568Ssam 795116742Ssam/* 796116742Ssam * AUTH management packets 797116742Ssam * 798116742Ssam * octet algo[2] 799116742Ssam * octet seq[2] 800116742Ssam * octet status[2] 801116742Ssam * octet chal.id 802116742Ssam * octet chal.length 803172055Ssam * octet chal.text[253] NB: 1-253 bytes 804116742Ssam */ 805116742Ssam 806172055Ssam/* challenge length for shared key auth */ 807172055Ssam#define IEEE80211_CHALLENGE_LEN 128 808116742Ssam 809138568Ssam#define IEEE80211_AUTH_ALG_OPEN 0x0000 810138568Ssam#define IEEE80211_AUTH_ALG_SHARED 0x0001 811138568Ssam#define IEEE80211_AUTH_ALG_LEAP 0x0080 812116742Ssam 813116742Ssamenum { 814116742Ssam IEEE80211_AUTH_OPEN_REQUEST = 1, 815116742Ssam IEEE80211_AUTH_OPEN_RESPONSE = 2, 816116742Ssam}; 817116742Ssam 818116742Ssamenum { 819116742Ssam IEEE80211_AUTH_SHARED_REQUEST = 1, 820116742Ssam IEEE80211_AUTH_SHARED_CHALLENGE = 2, 821116742Ssam IEEE80211_AUTH_SHARED_RESPONSE = 3, 822116742Ssam IEEE80211_AUTH_SHARED_PASS = 4, 823116742Ssam}; 824116742Ssam 825116742Ssam/* 826172055Ssam * Reason and status codes. 827116742Ssam * 828172055Ssam * Reason codes are used in management frames to indicate why an 829172055Ssam * action took place (e.g. on disassociation). Status codes are 830172055Ssam * used in management frames to indicate the result of an operation. 831172055Ssam * 832116742Ssam * Unlisted codes are reserved 833116742Ssam */ 834116742Ssam 835116742Ssamenum { 836116742Ssam IEEE80211_REASON_UNSPECIFIED = 1, 837116742Ssam IEEE80211_REASON_AUTH_EXPIRE = 2, 838116742Ssam IEEE80211_REASON_AUTH_LEAVE = 3, 839116742Ssam IEEE80211_REASON_ASSOC_EXPIRE = 4, 840116742Ssam IEEE80211_REASON_ASSOC_TOOMANY = 5, 841116742Ssam IEEE80211_REASON_NOT_AUTHED = 6, 842116742Ssam IEEE80211_REASON_NOT_ASSOCED = 7, 843116742Ssam IEEE80211_REASON_ASSOC_LEAVE = 8, 844116742Ssam IEEE80211_REASON_ASSOC_NOT_AUTHED = 9, 845172055Ssam IEEE80211_REASON_DISASSOC_PWRCAP_BAD = 10, /* 11h */ 846172055Ssam IEEE80211_REASON_DISASSOC_SUPCHAN_BAD = 11, /* 11h */ 847172055Ssam IEEE80211_REASON_IE_INVALID = 13, /* 11i */ 848172055Ssam IEEE80211_REASON_MIC_FAILURE = 14, /* 11i */ 849172055Ssam IEEE80211_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, /* 11i */ 850172055Ssam IEEE80211_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16, /* 11i */ 851172055Ssam IEEE80211_REASON_IE_IN_4WAY_DIFFERS = 17, /* 11i */ 852172055Ssam IEEE80211_REASON_GROUP_CIPHER_INVALID = 18, /* 11i */ 853172055Ssam IEEE80211_REASON_PAIRWISE_CIPHER_INVALID= 19, /* 11i */ 854172055Ssam IEEE80211_REASON_AKMP_INVALID = 20, /* 11i */ 855172055Ssam IEEE80211_REASON_UNSUPP_RSN_IE_VERSION = 21, /* 11i */ 856172055Ssam IEEE80211_REASON_INVALID_RSN_IE_CAP = 22, /* 11i */ 857172055Ssam IEEE80211_REASON_802_1X_AUTH_FAILED = 23, /* 11i */ 858172055Ssam IEEE80211_REASON_CIPHER_SUITE_REJECTED = 24, /* 11i */ 859116742Ssam 860116742Ssam IEEE80211_STATUS_SUCCESS = 0, 861116742Ssam IEEE80211_STATUS_UNSPECIFIED = 1, 862116742Ssam IEEE80211_STATUS_CAPINFO = 10, 863116742Ssam IEEE80211_STATUS_NOT_ASSOCED = 11, 864116742Ssam IEEE80211_STATUS_OTHER = 12, 865116742Ssam IEEE80211_STATUS_ALG = 13, 866116742Ssam IEEE80211_STATUS_SEQUENCE = 14, 867116742Ssam IEEE80211_STATUS_CHALLENGE = 15, 868116742Ssam IEEE80211_STATUS_TIMEOUT = 16, 869116742Ssam IEEE80211_STATUS_TOOMANY = 17, 870116742Ssam IEEE80211_STATUS_BASIC_RATE = 18, 871172055Ssam IEEE80211_STATUS_SP_REQUIRED = 19, /* 11b */ 872172055Ssam IEEE80211_STATUS_PBCC_REQUIRED = 20, /* 11b */ 873172055Ssam IEEE80211_STATUS_CA_REQUIRED = 21, /* 11b */ 874172055Ssam IEEE80211_STATUS_SPECMGMT_REQUIRED = 22, /* 11h */ 875172055Ssam IEEE80211_STATUS_PWRCAP_REQUIRED = 23, /* 11h */ 876172055Ssam IEEE80211_STATUS_SUPCHAN_REQUIRED = 24, /* 11h */ 877172055Ssam IEEE80211_STATUS_SHORTSLOT_REQUIRED = 25, /* 11g */ 878172055Ssam IEEE80211_STATUS_DSSSOFDM_REQUIRED = 26, /* 11g */ 879172055Ssam IEEE80211_STATUS_INVALID_IE = 40, /* 11i */ 880172055Ssam IEEE80211_STATUS_GROUP_CIPHER_INVALID = 41, /* 11i */ 881172055Ssam IEEE80211_STATUS_PAIRWISE_CIPHER_INVALID = 42, /* 11i */ 882172055Ssam IEEE80211_STATUS_AKMP_INVALID = 43, /* 11i */ 883172055Ssam IEEE80211_STATUS_UNSUPP_RSN_IE_VERSION = 44, /* 11i */ 884172055Ssam IEEE80211_STATUS_INVALID_RSN_IE_CAP = 45, /* 11i */ 885172055Ssam IEEE80211_STATUS_CIPHER_SUITE_REJECTED = 46, /* 11i */ 886116742Ssam}; 887116742Ssam 888138568Ssam#define IEEE80211_WEP_KEYLEN 5 /* 40bit */ 889138568Ssam#define IEEE80211_WEP_IVLEN 3 /* 24bit */ 890138568Ssam#define IEEE80211_WEP_KIDLEN 1 /* 1 octet */ 891138568Ssam#define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */ 892138568Ssam#define IEEE80211_WEP_NKID 4 /* number of key ids */ 893116742Ssam 894138568Ssam/* 895138568Ssam * 802.11i defines an extended IV for use with non-WEP ciphers. 896138568Ssam * When the EXTIV bit is set in the key id byte an additional 897138568Ssam * 4 bytes immediately follow the IV for TKIP. For CCMP the 898138568Ssam * EXTIV bit is likewise set but the 8 bytes represent the 899138568Ssam * CCMP header rather than IV+extended-IV. 900138568Ssam */ 901138568Ssam#define IEEE80211_WEP_EXTIV 0x20 902138568Ssam#define IEEE80211_WEP_EXTIVLEN 4 /* extended IV length */ 903138568Ssam#define IEEE80211_WEP_MICLEN 8 /* trailing MIC */ 904116742Ssam 905138568Ssam#define IEEE80211_CRC_LEN 4 906138568Ssam 907124457Ssam/* 908124457Ssam * Maximum acceptable MTU is: 909124457Ssam * IEEE80211_MAX_LEN - WEP overhead - CRC - 910124457Ssam * QoS overhead - RSN/WPA overhead 911124457Ssam * Min is arbitrarily chosen > IEEE80211_MIN_LEN. The default 912124457Ssam * mtu is Ethernet-compatible; it's set by ether_ifattach. 913124457Ssam */ 914138568Ssam#define IEEE80211_MTU_MAX 2290 915138568Ssam#define IEEE80211_MTU_MIN 32 916124457Ssam 917138568Ssam#define IEEE80211_MAX_LEN (2300 + IEEE80211_CRC_LEN + \ 918116742Ssam (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN)) 919138568Ssam#define IEEE80211_ACK_LEN \ 920138568Ssam (sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN) 921120098Ssam#define IEEE80211_MIN_LEN \ 922120098Ssam (sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN) 923116742Ssam 924138568Ssam/* 925138568Ssam * The 802.11 spec says at most 2007 stations may be 926138568Ssam * associated at once. For most AP's this is way more 927138568Ssam * than is feasible so we use a default of 128. This 928138568Ssam * number may be overridden by the driver and/or by 929138568Ssam * user configuration. 930138568Ssam */ 931138568Ssam#define IEEE80211_AID_MAX 2007 932138568Ssam#define IEEE80211_AID_DEF 128 933138568Ssam 934138568Ssam#define IEEE80211_AID(b) ((b) &~ 0xc000) 935138568Ssam 936116742Ssam/* 937116742Ssam * RTS frame length parameters. The default is specified in 938148291Ssam * the 802.11 spec as 512; we treat it as implementation-dependent 939148291Ssam * so it's defined in ieee80211_var.h. The max may be wrong 940148291Ssam * for jumbo frames. 941116742Ssam */ 942138568Ssam#define IEEE80211_RTS_MIN 1 943148291Ssam#define IEEE80211_RTS_MAX 2346 944116742Ssam 945148291Ssam/* 946148291Ssam * TX fragmentation parameters. As above for RTS, we treat 947148291Ssam * default as implementation-dependent so define it elsewhere. 948148291Ssam */ 949148291Ssam#define IEEE80211_FRAG_MIN 256 950148291Ssam#define IEEE80211_FRAG_MAX 2346 951148291Ssam 952160685Ssam/* 953160685Ssam * Beacon interval (TU's). Min+max come from WiFi requirements. 954160685Ssam * As above, we treat default as implementation-dependent so 955160685Ssam * define it elsewhere. 956160685Ssam */ 957160685Ssam#define IEEE80211_BINTVAL_MAX 1000 /* max beacon interval (TU's) */ 958160685Ssam#define IEEE80211_BINTVAL_MIN 25 /* min beacon interval (TU's) */ 959160685Ssam 960160685Ssam/* 961160685Ssam * DTIM period (beacons). Min+max are not really defined 962160685Ssam * by the protocol but we want them publicly visible so 963160685Ssam * define them here. 964160685Ssam */ 965160685Ssam#define IEEE80211_DTIM_MAX 15 /* max DTIM period */ 966160685Ssam#define IEEE80211_DTIM_MIN 1 /* min DTIM period */ 967160685Ssam 968160685Ssam/* 969160685Ssam * Beacon miss threshold (beacons). As for DTIM, we define 970160685Ssam * them here to be publicly visible. Note the max may be 971160685Ssam * clamped depending on device capabilities. 972160685Ssam */ 973160685Ssam#define IEEE80211_HWBMISS_MIN 1 974160685Ssam#define IEEE80211_HWBMISS_MAX 255 975160685Ssam 976170530Ssam/* 977170530Ssam * 802.11 frame duration definitions. 978170530Ssam */ 979170530Ssam 980170530Ssamstruct ieee80211_duration { 981170530Ssam uint16_t d_rts_dur; 982170530Ssam uint16_t d_data_dur; 983170530Ssam uint16_t d_plcp_len; 984170530Ssam uint8_t d_residue; /* unused octets in time slot */ 985170530Ssam}; 986170530Ssam 987170530Ssam/* One Time Unit (TU) is 1Kus = 1024 microseconds. */ 988170530Ssam#define IEEE80211_DUR_TU 1024 989170530Ssam 990170530Ssam/* IEEE 802.11b durations for DSSS PHY in microseconds */ 991170530Ssam#define IEEE80211_DUR_DS_LONG_PREAMBLE 144 992170530Ssam#define IEEE80211_DUR_DS_SHORT_PREAMBLE 72 993170530Ssam 994170530Ssam#define IEEE80211_DUR_DS_SLOW_PLCPHDR 48 995170530Ssam#define IEEE80211_DUR_DS_FAST_PLCPHDR 24 996170530Ssam#define IEEE80211_DUR_DS_SLOW_ACK 112 997170530Ssam#define IEEE80211_DUR_DS_FAST_ACK 56 998170530Ssam#define IEEE80211_DUR_DS_SLOW_CTS 112 999170530Ssam#define IEEE80211_DUR_DS_FAST_CTS 56 1000170530Ssam 1001170530Ssam#define IEEE80211_DUR_DS_SLOT 20 1002170530Ssam#define IEEE80211_DUR_DS_SIFS 10 1003170530Ssam#define IEEE80211_DUR_DS_PIFS (IEEE80211_DUR_DS_SIFS + IEEE80211_DUR_DS_SLOT) 1004170530Ssam#define IEEE80211_DUR_DS_DIFS (IEEE80211_DUR_DS_SIFS + \ 1005170530Ssam 2 * IEEE80211_DUR_DS_SLOT) 1006170530Ssam#define IEEE80211_DUR_DS_EIFS (IEEE80211_DUR_DS_SIFS + \ 1007170530Ssam IEEE80211_DUR_DS_SLOW_ACK + \ 1008170530Ssam IEEE80211_DUR_DS_LONG_PREAMBLE + \ 1009170530Ssam IEEE80211_DUR_DS_SLOW_PLCPHDR + \ 1010170530Ssam IEEE80211_DUR_DIFS) 1011170530Ssam 1012170530Ssam/* 1013170530Ssam * Atheros fast-frame encapsulation format. 1014170530Ssam * FF max payload: 1015170530Ssam * 802.2 + FFHDR + HPAD + 802.3 + 802.2 + 1500 + SPAD + 802.3 + 802.2 + 1500: 1016170530Ssam * 8 + 4 + 4 + 14 + 8 + 1500 + 6 + 14 + 8 + 1500 1017170530Ssam * = 3066 1018170530Ssam */ 1019170530Ssam/* fast frame header is 32-bits */ 1020170530Ssam#define ATH_FF_PROTO 0x0000003f /* protocol */ 1021170530Ssam#define ATH_FF_PROTO_S 0 1022170530Ssam#define ATH_FF_FTYPE 0x000000c0 /* frame type */ 1023170530Ssam#define ATH_FF_FTYPE_S 6 1024170530Ssam#define ATH_FF_HLEN32 0x00000300 /* optional hdr length */ 1025170530Ssam#define ATH_FF_HLEN32_S 8 1026170530Ssam#define ATH_FF_SEQNUM 0x001ffc00 /* sequence number */ 1027170530Ssam#define ATH_FF_SEQNUM_S 10 1028170530Ssam#define ATH_FF_OFFSET 0xffe00000 /* offset to 2nd payload */ 1029170530Ssam#define ATH_FF_OFFSET_S 21 1030170530Ssam 1031170530Ssam#define ATH_FF_MAX_HDR_PAD 4 1032170530Ssam#define ATH_FF_MAX_SEP_PAD 6 1033170530Ssam#define ATH_FF_MAX_HDR 30 1034170530Ssam 1035170530Ssam#define ATH_FF_PROTO_L2TUNNEL 0 /* L2 tunnel protocol */ 1036170530Ssam#define ATH_FF_ETH_TYPE 0x88bd /* Ether type for encapsulated frames */ 1037170530Ssam#define ATH_FF_SNAP_ORGCODE_0 0x00 1038170530Ssam#define ATH_FF_SNAP_ORGCODE_1 0x03 1039170530Ssam#define ATH_FF_SNAP_ORGCODE_2 0x7f 1040170530Ssam 1041116742Ssam#endif /* _NET80211_IEEE80211_H_ */ 1042