ieee80211.h revision 288084
1116742Ssam/*- 2116904Ssam * Copyright (c) 2001 Atsushi Onoe 3186904Ssam * Copyright (c) 2002-2009 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 288084 2015-09-22 02:24:13Z adrian $ 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 39283566Sglebius#ifdef _KERNEL 40283566Sglebiusextern const uint8_t ieee80211broadcastaddr[]; 41283566Sglebius#endif 42283566Sglebius 43191756Ssamtypedef uint16_t ieee80211_seq; 44191756Ssam 45116742Ssam/* IEEE 802.11 PLCP header */ 46116742Ssamstruct ieee80211_plcp_hdr { 47170530Ssam uint16_t i_sfd; 48170530Ssam uint8_t i_signal; 49170530Ssam uint8_t i_service; 50170530Ssam uint16_t i_length; 51170530Ssam uint16_t i_crc; 52138568Ssam} __packed; 53116742Ssam 54127903Ssam#define IEEE80211_PLCP_SFD 0xF3A0 55127903Ssam#define IEEE80211_PLCP_SERVICE 0x00 56178952Ssam#define IEEE80211_PLCP_SERVICE_LOCKED 0x04 57178952Ssam#define IEEE80211_PLCL_SERVICE_PBCC 0x08 58178952Ssam#define IEEE80211_PLCP_SERVICE_LENEXT5 0x20 59178952Ssam#define IEEE80211_PLCP_SERVICE_LENEXT6 0x40 60178952Ssam#define IEEE80211_PLCP_SERVICE_LENEXT7 0x80 61127903Ssam 62116742Ssam/* 63116742Ssam * generic definitions for IEEE 802.11 frames 64116742Ssam */ 65116742Ssamstruct ieee80211_frame { 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]; 72116742Ssam /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ 73116742Ssam /* see below */ 74138568Ssam} __packed; 75116742Ssam 76127903Ssamstruct ieee80211_qosframe { 77170530Ssam uint8_t i_fc[2]; 78170530Ssam uint8_t i_dur[2]; 79170530Ssam uint8_t i_addr1[IEEE80211_ADDR_LEN]; 80170530Ssam uint8_t i_addr2[IEEE80211_ADDR_LEN]; 81170530Ssam uint8_t i_addr3[IEEE80211_ADDR_LEN]; 82170530Ssam uint8_t i_seq[2]; 83170530Ssam uint8_t i_qos[2]; 84127903Ssam /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ 85127903Ssam /* see below */ 86138568Ssam} __packed; 87127903Ssam 88127903Ssamstruct ieee80211_qoscntl { 89170530Ssam uint8_t i_qos[2]; 90127903Ssam}; 91127903Ssam 92116742Ssamstruct ieee80211_frame_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]; 100138568Ssam} __packed; 101116742Ssam 102127903Ssam 103127903Ssamstruct ieee80211_qosframe_addr4 { 104170530Ssam uint8_t i_fc[2]; 105170530Ssam uint8_t i_dur[2]; 106170530Ssam uint8_t i_addr1[IEEE80211_ADDR_LEN]; 107170530Ssam uint8_t i_addr2[IEEE80211_ADDR_LEN]; 108170530Ssam uint8_t i_addr3[IEEE80211_ADDR_LEN]; 109170530Ssam uint8_t i_seq[2]; 110170530Ssam uint8_t i_addr4[IEEE80211_ADDR_LEN]; 111170530Ssam uint8_t i_qos[2]; 112138568Ssam} __packed; 113127903Ssam 114116742Ssam#define IEEE80211_FC0_VERSION_MASK 0x03 115116742Ssam#define IEEE80211_FC0_VERSION_SHIFT 0 116116742Ssam#define IEEE80211_FC0_VERSION_0 0x00 117116742Ssam#define IEEE80211_FC0_TYPE_MASK 0x0c 118116742Ssam#define IEEE80211_FC0_TYPE_SHIFT 2 119116742Ssam#define IEEE80211_FC0_TYPE_MGT 0x00 120116742Ssam#define IEEE80211_FC0_TYPE_CTL 0x04 121116742Ssam#define IEEE80211_FC0_TYPE_DATA 0x08 122116742Ssam 123116742Ssam#define IEEE80211_FC0_SUBTYPE_MASK 0xf0 124116742Ssam#define IEEE80211_FC0_SUBTYPE_SHIFT 4 125116742Ssam/* for TYPE_MGT */ 126116742Ssam#define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00 127116742Ssam#define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10 128116742Ssam#define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20 129116742Ssam#define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30 130116742Ssam#define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40 131116742Ssam#define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50 132116742Ssam#define IEEE80211_FC0_SUBTYPE_BEACON 0x80 133116742Ssam#define IEEE80211_FC0_SUBTYPE_ATIM 0x90 134116742Ssam#define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0 135116742Ssam#define IEEE80211_FC0_SUBTYPE_AUTH 0xb0 136116742Ssam#define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0 137170530Ssam#define IEEE80211_FC0_SUBTYPE_ACTION 0xd0 138218927Sbschmidt#define IEEE80211_FC0_SUBTYPE_ACTION_NOACK 0xe0 139116742Ssam/* for TYPE_CTL */ 140170530Ssam#define IEEE80211_FC0_SUBTYPE_BAR 0x80 141192328Ssam#define IEEE80211_FC0_SUBTYPE_BA 0x90 142116742Ssam#define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0 143116742Ssam#define IEEE80211_FC0_SUBTYPE_RTS 0xb0 144116742Ssam#define IEEE80211_FC0_SUBTYPE_CTS 0xc0 145116742Ssam#define IEEE80211_FC0_SUBTYPE_ACK 0xd0 146116742Ssam#define IEEE80211_FC0_SUBTYPE_CF_END 0xe0 147116742Ssam#define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0 148116742Ssam/* for TYPE_DATA (bit combination) */ 149116742Ssam#define IEEE80211_FC0_SUBTYPE_DATA 0x00 150116742Ssam#define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10 151116742Ssam#define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20 152116742Ssam#define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30 153116742Ssam#define IEEE80211_FC0_SUBTYPE_NODATA 0x40 154116742Ssam#define IEEE80211_FC0_SUBTYPE_CFACK 0x50 155116742Ssam#define IEEE80211_FC0_SUBTYPE_CFPOLL 0x60 156116742Ssam#define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK 0x70 157127903Ssam#define IEEE80211_FC0_SUBTYPE_QOS 0x80 158138568Ssam#define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0 159116742Ssam 160116742Ssam#define IEEE80211_FC1_DIR_MASK 0x03 161116742Ssam#define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */ 162116742Ssam#define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */ 163116742Ssam#define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */ 164116742Ssam#define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */ 165116742Ssam 166193840Ssam#define IEEE80211_IS_DSTODS(wh) \ 167193840Ssam (((wh)->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS) 168193840Ssam 169116742Ssam#define IEEE80211_FC1_MORE_FRAG 0x04 170116742Ssam#define IEEE80211_FC1_RETRY 0x08 171116742Ssam#define IEEE80211_FC1_PWR_MGT 0x10 172116742Ssam#define IEEE80211_FC1_MORE_DATA 0x20 173260444Skevlo#define IEEE80211_FC1_PROTECTED 0x40 174116742Ssam#define IEEE80211_FC1_ORDER 0x80 175116742Ssam 176282820Sadrian#define IEEE80211_HAS_SEQ(type, subtype) \ 177282820Sadrian ((type) != IEEE80211_FC0_TYPE_CTL && \ 178282820Sadrian !((type) == IEEE80211_FC0_TYPE_DATA && \ 179282820Sadrian ((subtype) & IEEE80211_FC0_SUBTYPE_QOS_NULL) == \ 180282820Sadrian IEEE80211_FC0_SUBTYPE_QOS_NULL)) 181116742Ssam#define IEEE80211_SEQ_FRAG_MASK 0x000f 182116742Ssam#define IEEE80211_SEQ_FRAG_SHIFT 0 183116742Ssam#define IEEE80211_SEQ_SEQ_MASK 0xfff0 184116742Ssam#define IEEE80211_SEQ_SEQ_SHIFT 4 185170530Ssam#define IEEE80211_SEQ_RANGE 4096 186116742Ssam 187170530Ssam#define IEEE80211_SEQ_ADD(seq, incr) \ 188170530Ssam (((seq) + (incr)) & (IEEE80211_SEQ_RANGE-1)) 189170530Ssam#define IEEE80211_SEQ_INC(seq) IEEE80211_SEQ_ADD(seq,1) 190170530Ssam#define IEEE80211_SEQ_SUB(a, b) \ 191170530Ssam (((a) + IEEE80211_SEQ_RANGE - (b)) & (IEEE80211_SEQ_RANGE-1)) 192170530Ssam 193173273Ssam#define IEEE80211_SEQ_BA_RANGE 2048 /* 2^11 */ 194173273Ssam#define IEEE80211_SEQ_BA_BEFORE(a, b) \ 195173273Ssam (IEEE80211_SEQ_SUB(b, a+1) < IEEE80211_SEQ_BA_RANGE-1) 196173273Ssam 197116742Ssam#define IEEE80211_NWID_LEN 32 198195618Srpaulo#define IEEE80211_MESHID_LEN 32 199116742Ssam 200127903Ssam#define IEEE80211_QOS_TXOP 0x00ff 201127903Ssam/* bit 8 is reserved */ 202170530Ssam#define IEEE80211_QOS_AMSDU 0x80 203170530Ssam#define IEEE80211_QOS_AMSDU_S 7 204138568Ssam#define IEEE80211_QOS_ACKPOLICY 0x60 205138568Ssam#define IEEE80211_QOS_ACKPOLICY_S 5 206170530Ssam#define IEEE80211_QOS_ACKPOLICY_NOACK 0x20 /* No ACK required */ 207170530Ssam#define IEEE80211_QOS_ACKPOLICY_BA 0x60 /* Block ACK */ 208183243Ssam#define IEEE80211_QOS_EOSP 0x10 /* EndOfService Period*/ 209183243Ssam#define IEEE80211_QOS_EOSP_S 4 210138568Ssam#define IEEE80211_QOS_TID 0x0f 211232480Sadrian/* qos[1] byte used for all frames sent by mesh STAs in a mesh BSS */ 212246807Smonthadar#define IEEE80211_QOS_MC 0x01 /* Mesh control */ 213232480Sadrian/* Mesh power save level*/ 214246807Smonthadar#define IEEE80211_QOS_MESH_PSL 0x02 215232480Sadrian/* Mesh Receiver Service Period Initiated */ 216246807Smonthadar#define IEEE80211_QOS_RSPI 0x04 217232480Sadrian/* bits 11 to 15 reserved */ 218127903Ssam 219138568Ssam/* does frame have QoS sequence control data */ 220138568Ssam#define IEEE80211_QOS_HAS_SEQ(wh) \ 221138568Ssam (((wh)->i_fc[0] & \ 222138568Ssam (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == \ 223138568Ssam (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS)) 224138568Ssam 225116742Ssam/* 226138568Ssam * WME/802.11e information element. 227138568Ssam */ 228138568Ssamstruct ieee80211_wme_info { 229170530Ssam uint8_t wme_id; /* IEEE80211_ELEMID_VENDOR */ 230170530Ssam uint8_t wme_len; /* length in bytes */ 231170530Ssam uint8_t wme_oui[3]; /* 0x00, 0x50, 0xf2 */ 232170530Ssam uint8_t wme_type; /* OUI type */ 233170530Ssam uint8_t wme_subtype; /* OUI subtype */ 234170530Ssam uint8_t wme_version; /* spec revision */ 235170530Ssam uint8_t wme_info; /* QoS info */ 236138568Ssam} __packed; 237138568Ssam 238138568Ssam/* 239138568Ssam * WME/802.11e Tspec Element 240138568Ssam */ 241138568Ssamstruct ieee80211_wme_tspec { 242170530Ssam uint8_t ts_id; 243170530Ssam uint8_t ts_len; 244170530Ssam uint8_t ts_oui[3]; 245170530Ssam uint8_t ts_oui_type; 246170530Ssam uint8_t ts_oui_subtype; 247170530Ssam uint8_t ts_version; 248170530Ssam uint8_t ts_tsinfo[3]; 249170530Ssam uint8_t ts_nom_msdu[2]; 250170530Ssam uint8_t ts_max_msdu[2]; 251170530Ssam uint8_t ts_min_svc[4]; 252170530Ssam uint8_t ts_max_svc[4]; 253170530Ssam uint8_t ts_inactv_intv[4]; 254170530Ssam uint8_t ts_susp_intv[4]; 255170530Ssam uint8_t ts_start_svc[4]; 256170530Ssam uint8_t ts_min_rate[4]; 257170530Ssam uint8_t ts_mean_rate[4]; 258170530Ssam uint8_t ts_max_burst[4]; 259170530Ssam uint8_t ts_min_phy[4]; 260170530Ssam uint8_t ts_peak_rate[4]; 261170530Ssam uint8_t ts_delay[4]; 262170530Ssam uint8_t ts_surplus[2]; 263170530Ssam uint8_t ts_medium_time[2]; 264138568Ssam} __packed; 265138568Ssam 266138568Ssam/* 267138568Ssam * WME AC parameter field 268138568Ssam */ 269138568Ssamstruct ieee80211_wme_acparams { 270170530Ssam uint8_t acp_aci_aifsn; 271170530Ssam uint8_t acp_logcwminmax; 272170530Ssam uint16_t acp_txop; 273138568Ssam} __packed; 274138568Ssam 275138568Ssam#define WME_NUM_AC 4 /* 4 AC categories */ 276170530Ssam#define WME_NUM_TID 16 /* 16 tids */ 277138568Ssam 278138568Ssam#define WME_PARAM_ACI 0x60 /* Mask for ACI field */ 279138568Ssam#define WME_PARAM_ACI_S 5 /* Shift for ACI field */ 280138568Ssam#define WME_PARAM_ACM 0x10 /* Mask for ACM bit */ 281138568Ssam#define WME_PARAM_ACM_S 4 /* Shift for ACM bit */ 282138568Ssam#define WME_PARAM_AIFSN 0x0f /* Mask for aifsn field */ 283138568Ssam#define WME_PARAM_AIFSN_S 0 /* Shift for aifsn field */ 284138568Ssam#define WME_PARAM_LOGCWMIN 0x0f /* Mask for CwMin field (in log) */ 285138568Ssam#define WME_PARAM_LOGCWMIN_S 0 /* Shift for CwMin field */ 286138568Ssam#define WME_PARAM_LOGCWMAX 0xf0 /* Mask for CwMax field (in log) */ 287138568Ssam#define WME_PARAM_LOGCWMAX_S 4 /* Shift for CwMax field */ 288138568Ssam 289138568Ssam#define WME_AC_TO_TID(_ac) ( \ 290138568Ssam ((_ac) == WME_AC_VO) ? 6 : \ 291138568Ssam ((_ac) == WME_AC_VI) ? 5 : \ 292138568Ssam ((_ac) == WME_AC_BK) ? 1 : \ 293138568Ssam 0) 294138568Ssam 295138568Ssam#define TID_TO_WME_AC(_tid) ( \ 296173863Ssam ((_tid) == 0 || (_tid) == 3) ? WME_AC_BE : \ 297138568Ssam ((_tid) < 3) ? WME_AC_BK : \ 298138568Ssam ((_tid) < 6) ? WME_AC_VI : \ 299138568Ssam WME_AC_VO) 300138568Ssam 301138568Ssam/* 302138568Ssam * WME Parameter Element 303138568Ssam */ 304138568Ssamstruct ieee80211_wme_param { 305170530Ssam uint8_t param_id; 306170530Ssam uint8_t param_len; 307170530Ssam uint8_t param_oui[3]; 308170530Ssam uint8_t param_oui_type; 309172055Ssam uint8_t param_oui_subtype; 310170530Ssam uint8_t param_version; 311170530Ssam uint8_t param_qosInfo; 312138568Ssam#define WME_QOSINFO_COUNT 0x0f /* Mask for param count field */ 313170530Ssam uint8_t param_reserved; 314138568Ssam struct ieee80211_wme_acparams params_acParams[WME_NUM_AC]; 315138568Ssam} __packed; 316138568Ssam 317138568Ssam/* 318138568Ssam * Management Notification Frame 319138568Ssam */ 320138568Ssamstruct ieee80211_mnf { 321170530Ssam uint8_t mnf_category; 322170530Ssam uint8_t mnf_action; 323170530Ssam uint8_t mnf_dialog; 324170530Ssam uint8_t mnf_status; 325138568Ssam} __packed; 326138568Ssam#define MNF_SETUP_REQ 0 327138568Ssam#define MNF_SETUP_RESP 1 328138568Ssam#define MNF_TEARDOWN 2 329138568Ssam 330170530Ssam/* 331170530Ssam * 802.11n Management Action Frames 332170530Ssam */ 333170530Ssam/* generic frame format */ 334170530Ssamstruct ieee80211_action { 335170530Ssam uint8_t ia_category; 336170530Ssam uint8_t ia_action; 337170530Ssam} __packed; 338170530Ssam 339193542Ssam#define IEEE80211_ACTION_CAT_SM 0 /* Spectrum Management */ 340193542Ssam#define IEEE80211_ACTION_CAT_QOS 1 /* QoS */ 341193542Ssam#define IEEE80211_ACTION_CAT_DLS 2 /* DLS */ 342170530Ssam#define IEEE80211_ACTION_CAT_BA 3 /* BA */ 343172055Ssam#define IEEE80211_ACTION_CAT_HT 7 /* HT */ 344232479Sadrian#define IEEE80211_ACTION_CAT_MESH 13 /* Mesh */ 345234874Smonthadar#define IEEE80211_ACTION_CAT_SELF_PROT 15 /* Self-protected */ 346234874Smonthadar/* 16 - 125 reserved */ 347193542Ssam#define IEEE80211_ACTION_CAT_VENDOR 127 /* Vendor Specific */ 348170530Ssam 349170530Ssam#define IEEE80211_ACTION_HT_TXCHWIDTH 0 /* recommended xmit chan width*/ 350170530Ssam#define IEEE80211_ACTION_HT_MIMOPWRSAVE 1 /* MIMO power save */ 351170530Ssam 352170530Ssam/* HT - recommended transmission channel width */ 353170530Ssamstruct ieee80211_action_ht_txchwidth { 354170530Ssam struct ieee80211_action at_header; 355170530Ssam uint8_t at_chwidth; 356170530Ssam} __packed; 357170530Ssam 358170530Ssam#define IEEE80211_A_HT_TXCHWIDTH_20 0 359170530Ssam#define IEEE80211_A_HT_TXCHWIDTH_2040 1 360170530Ssam 361172055Ssam/* HT - MIMO Power Save (NB: D2.04) */ 362170530Ssamstruct ieee80211_action_ht_mimopowersave { 363170530Ssam struct ieee80211_action am_header; 364173618Ssam uint8_t am_control; 365170530Ssam} __packed; 366170530Ssam 367173618Ssam#define IEEE80211_A_HT_MIMOPWRSAVE_ENA 0x01 /* PS enabled */ 368173618Ssam#define IEEE80211_A_HT_MIMOPWRSAVE_MODE 0x02 369173618Ssam#define IEEE80211_A_HT_MIMOPWRSAVE_MODE_S 1 370173618Ssam#define IEEE80211_A_HT_MIMOPWRSAVE_DYNAMIC 0x02 /* Dynamic Mode */ 371173618Ssam#define IEEE80211_A_HT_MIMOPWRSAVE_STATIC 0x00 /* no SM packets */ 372173618Ssam/* bits 2-7 reserved */ 373173618Ssam 374170530Ssam/* Block Ack actions */ 375170530Ssam#define IEEE80211_ACTION_BA_ADDBA_REQUEST 0 /* ADDBA request */ 376170530Ssam#define IEEE80211_ACTION_BA_ADDBA_RESPONSE 1 /* ADDBA response */ 377170530Ssam#define IEEE80211_ACTION_BA_DELBA 2 /* DELBA */ 378170530Ssam 379170530Ssam/* Block Ack Parameter Set */ 380170530Ssam#define IEEE80211_BAPS_BUFSIZ 0xffc0 /* buffer size */ 381170530Ssam#define IEEE80211_BAPS_BUFSIZ_S 6 382170530Ssam#define IEEE80211_BAPS_TID 0x003c /* TID */ 383170530Ssam#define IEEE80211_BAPS_TID_S 2 384170530Ssam#define IEEE80211_BAPS_POLICY 0x0002 /* block ack policy */ 385170530Ssam#define IEEE80211_BAPS_POLICY_S 1 386170530Ssam 387170530Ssam#define IEEE80211_BAPS_POLICY_DELAYED (0<<IEEE80211_BAPS_POLICY_S) 388170530Ssam#define IEEE80211_BAPS_POLICY_IMMEDIATE (1<<IEEE80211_BAPS_POLICY_S) 389170530Ssam 390170530Ssam/* Block Ack Sequence Control */ 391170530Ssam#define IEEE80211_BASEQ_START 0xfff0 /* starting seqnum */ 392170530Ssam#define IEEE80211_BASEQ_START_S 4 393170530Ssam#define IEEE80211_BASEQ_FRAG 0x000f /* fragment number */ 394170530Ssam#define IEEE80211_BASEQ_FRAG_S 0 395170530Ssam 396170530Ssam/* Delayed Block Ack Parameter Set */ 397170530Ssam#define IEEE80211_DELBAPS_TID 0xf000 /* TID */ 398170530Ssam#define IEEE80211_DELBAPS_TID_S 12 399170530Ssam#define IEEE80211_DELBAPS_INIT 0x0800 /* initiator */ 400170530Ssam#define IEEE80211_DELBAPS_INIT_S 11 401170530Ssam 402170530Ssam/* BA - ADDBA request */ 403170530Ssamstruct ieee80211_action_ba_addbarequest { 404170530Ssam struct ieee80211_action rq_header; 405170530Ssam uint8_t rq_dialogtoken; 406170530Ssam uint16_t rq_baparamset; 407170530Ssam uint16_t rq_batimeout; /* in TUs */ 408170530Ssam uint16_t rq_baseqctl; 409170530Ssam} __packed; 410170530Ssam 411170530Ssam/* BA - ADDBA response */ 412170530Ssamstruct ieee80211_action_ba_addbaresponse { 413170530Ssam struct ieee80211_action rs_header; 414170530Ssam uint8_t rs_dialogtoken; 415170530Ssam uint16_t rs_statuscode; 416170530Ssam uint16_t rs_baparamset; 417170530Ssam uint16_t rs_batimeout; /* in TUs */ 418170530Ssam} __packed; 419170530Ssam 420170530Ssam/* BA - DELBA */ 421170530Ssamstruct ieee80211_action_ba_delba { 422170530Ssam struct ieee80211_action dl_header; 423170530Ssam uint16_t dl_baparamset; 424170530Ssam uint16_t dl_reasoncode; 425170530Ssam} __packed; 426170530Ssam 427170530Ssam/* BAR Control */ 428170530Ssam#define IEEE80211_BAR_TID 0xf000 /* TID */ 429170530Ssam#define IEEE80211_BAR_TID_S 12 430182820Ssam#define IEEE80211_BAR_COMP 0x0004 /* Compressed Bitmap */ 431182820Ssam#define IEEE80211_BAR_MTID 0x0002 /* Multi-TID */ 432182820Ssam#define IEEE80211_BAR_NOACK 0x0001 /* No-Ack policy */ 433170530Ssam 434182820Ssam/* BAR Starting Sequence Control */ 435182820Ssam#define IEEE80211_BAR_SEQ_START 0xfff0 /* starting seqnum */ 436182820Ssam#define IEEE80211_BAR_SEQ_START_S 4 437182820Ssam 438170530Ssamstruct ieee80211_ba_request { 439170530Ssam uint16_t rq_barctl; 440170530Ssam uint16_t rq_barseqctl; 441170530Ssam} __packed; 442170530Ssam 443138568Ssam/* 444120098Ssam * Control frames. 445120098Ssam */ 446120098Ssamstruct ieee80211_frame_min { 447170530Ssam uint8_t i_fc[2]; 448170530Ssam uint8_t i_dur[2]; 449170530Ssam uint8_t i_addr1[IEEE80211_ADDR_LEN]; 450170530Ssam uint8_t i_addr2[IEEE80211_ADDR_LEN]; 451120098Ssam /* FCS */ 452138568Ssam} __packed; 453120098Ssam 454120098Ssamstruct ieee80211_frame_rts { 455170530Ssam uint8_t i_fc[2]; 456170530Ssam uint8_t i_dur[2]; 457170530Ssam uint8_t i_ra[IEEE80211_ADDR_LEN]; 458170530Ssam uint8_t i_ta[IEEE80211_ADDR_LEN]; 459120098Ssam /* FCS */ 460138568Ssam} __packed; 461120098Ssam 462120098Ssamstruct ieee80211_frame_cts { 463170530Ssam uint8_t i_fc[2]; 464170530Ssam uint8_t i_dur[2]; 465170530Ssam uint8_t i_ra[IEEE80211_ADDR_LEN]; 466120098Ssam /* FCS */ 467138568Ssam} __packed; 468120098Ssam 469120098Ssamstruct ieee80211_frame_ack { 470170530Ssam uint8_t i_fc[2]; 471170530Ssam uint8_t i_dur[2]; 472170530Ssam uint8_t i_ra[IEEE80211_ADDR_LEN]; 473120098Ssam /* FCS */ 474138568Ssam} __packed; 475120098Ssam 476120098Ssamstruct ieee80211_frame_pspoll { 477170530Ssam uint8_t i_fc[2]; 478170530Ssam uint8_t i_aid[2]; 479170530Ssam uint8_t i_bssid[IEEE80211_ADDR_LEN]; 480170530Ssam uint8_t i_ta[IEEE80211_ADDR_LEN]; 481120098Ssam /* FCS */ 482138568Ssam} __packed; 483120098Ssam 484120098Ssamstruct ieee80211_frame_cfend { /* NB: also CF-End+CF-Ack */ 485170530Ssam uint8_t i_fc[2]; 486170530Ssam uint8_t i_dur[2]; /* should be zero */ 487170530Ssam uint8_t i_ra[IEEE80211_ADDR_LEN]; 488170530Ssam uint8_t i_bssid[IEEE80211_ADDR_LEN]; 489120098Ssam /* FCS */ 490138568Ssam} __packed; 491120098Ssam 492170530Ssamstruct ieee80211_frame_bar { 493170530Ssam uint8_t i_fc[2]; 494170530Ssam uint8_t i_dur[2]; 495170530Ssam uint8_t i_ra[IEEE80211_ADDR_LEN]; 496170530Ssam uint8_t i_ta[IEEE80211_ADDR_LEN]; 497170530Ssam uint16_t i_ctl; 498170530Ssam uint16_t i_seq; 499170530Ssam /* FCS */ 500170530Ssam} __packed; 501170530Ssam 502120098Ssam/* 503116742Ssam * BEACON management packets 504116742Ssam * 505116742Ssam * octet timestamp[8] 506116742Ssam * octet beacon interval[2] 507116742Ssam * octet capability information[2] 508116742Ssam * information element 509116742Ssam * octet elemid 510116742Ssam * octet length 511116742Ssam * octet information[length] 512116742Ssam */ 513116742Ssam 514116742Ssam#define IEEE80211_BEACON_INTERVAL(beacon) \ 515116742Ssam ((beacon)[8] | ((beacon)[9] << 8)) 516116742Ssam#define IEEE80211_BEACON_CAPABILITY(beacon) \ 517116742Ssam ((beacon)[10] | ((beacon)[11] << 8)) 518116742Ssam 519116742Ssam#define IEEE80211_CAPINFO_ESS 0x0001 520116742Ssam#define IEEE80211_CAPINFO_IBSS 0x0002 521116742Ssam#define IEEE80211_CAPINFO_CF_POLLABLE 0x0004 522116742Ssam#define IEEE80211_CAPINFO_CF_POLLREQ 0x0008 523116742Ssam#define IEEE80211_CAPINFO_PRIVACY 0x0010 524116742Ssam#define IEEE80211_CAPINFO_SHORT_PREAMBLE 0x0020 525116742Ssam#define IEEE80211_CAPINFO_PBCC 0x0040 526116742Ssam#define IEEE80211_CAPINFO_CHNL_AGILITY 0x0080 527172055Ssam#define IEEE80211_CAPINFO_SPECTRUM_MGMT 0x0100 528172055Ssam/* bit 9 is reserved */ 529116742Ssam#define IEEE80211_CAPINFO_SHORT_SLOTTIME 0x0400 530127903Ssam#define IEEE80211_CAPINFO_RSN 0x0800 531127903Ssam/* bit 12 is reserved */ 532116742Ssam#define IEEE80211_CAPINFO_DSSSOFDM 0x2000 533116742Ssam/* bits 14-15 are reserved */ 534116742Ssam 535187797Ssam#define IEEE80211_CAPINFO_BITS \ 536187797Ssam "\20\1ESS\2IBSS\3CF_POLLABLE\4CF_POLLREQ\5PRIVACY\6SHORT_PREAMBLE" \ 537187797Ssam "\7PBCC\10CHNL_AGILITY\11SPECTRUM_MGMT\13SHORT_SLOTTIME\14RSN" \ 538187797Ssam "\16DSSOFDM" 539187797Ssam 540116742Ssam/* 541127903Ssam * 802.11i/WPA information element (maximally sized). 542127903Ssam */ 543127903Ssamstruct ieee80211_ie_wpa { 544170530Ssam uint8_t wpa_id; /* IEEE80211_ELEMID_VENDOR */ 545170530Ssam uint8_t wpa_len; /* length in bytes */ 546170530Ssam uint8_t wpa_oui[3]; /* 0x00, 0x50, 0xf2 */ 547170530Ssam uint8_t wpa_type; /* OUI type */ 548170530Ssam uint16_t wpa_version; /* spec revision */ 549170530Ssam uint32_t wpa_mcipher[1]; /* multicast/group key cipher */ 550170530Ssam uint16_t wpa_uciphercnt; /* # pairwise key ciphers */ 551170530Ssam uint32_t wpa_uciphers[8];/* ciphers */ 552170530Ssam uint16_t wpa_authselcnt; /* authentication selector cnt*/ 553170530Ssam uint32_t wpa_authsels[8];/* selectors */ 554170530Ssam uint16_t wpa_caps; /* 802.11i capabilities */ 555170530Ssam uint16_t wpa_pmkidcnt; /* 802.11i pmkid count */ 556170530Ssam uint16_t wpa_pmkids[8]; /* 802.11i pmkids */ 557138568Ssam} __packed; 558127903Ssam 559127903Ssam/* 560170530Ssam * 802.11n HT Capability IE 561170530Ssam * NB: these reflect D1.10 562170530Ssam */ 563170530Ssamstruct ieee80211_ie_htcap { 564170530Ssam uint8_t hc_id; /* element ID */ 565170530Ssam uint8_t hc_len; /* length in bytes */ 566170530Ssam uint16_t hc_cap; /* HT caps (see below) */ 567170530Ssam uint8_t hc_param; /* HT params (see below) */ 568170530Ssam uint8_t hc_mcsset[16]; /* supported MCS set */ 569170530Ssam uint16_t hc_extcap; /* extended HT capabilities */ 570170530Ssam uint32_t hc_txbf; /* txbf capabilities */ 571170530Ssam uint8_t hc_antenna; /* antenna capabilities */ 572170530Ssam} __packed; 573170530Ssam 574170530Ssam/* HT capability flags (ht_cap) */ 575170530Ssam#define IEEE80211_HTCAP_LDPC 0x0001 /* LDPC supported */ 576170530Ssam#define IEEE80211_HTCAP_CHWIDTH40 0x0002 /* 20/40 supported */ 577170530Ssam#define IEEE80211_HTCAP_SMPS 0x000c /* SM Power Save mode */ 578183243Ssam#define IEEE80211_HTCAP_SMPS_OFF 0x000c /* disabled */ 579170530Ssam#define IEEE80211_HTCAP_SMPS_DYNAMIC 0x0004 /* send RTS first */ 580170530Ssam/* NB: SMPS value 2 is reserved */ 581183243Ssam#define IEEE80211_HTCAP_SMPS_ENA 0x0000 /* enabled (static mode) */ 582170530Ssam#define IEEE80211_HTCAP_GREENFIELD 0x0010 /* Greenfield supported */ 583170530Ssam#define IEEE80211_HTCAP_SHORTGI20 0x0020 /* Short GI in 20MHz */ 584170530Ssam#define IEEE80211_HTCAP_SHORTGI40 0x0040 /* Short GI in 40MHz */ 585170530Ssam#define IEEE80211_HTCAP_TXSTBC 0x0080 /* STBC tx ok */ 586170530Ssam#define IEEE80211_HTCAP_RXSTBC 0x0300 /* STBC rx support */ 587170530Ssam#define IEEE80211_HTCAP_RXSTBC_S 8 588170530Ssam#define IEEE80211_HTCAP_RXSTBC_1STREAM 0x0100 /* 1 spatial stream */ 589170530Ssam#define IEEE80211_HTCAP_RXSTBC_2STREAM 0x0200 /* 1-2 spatial streams*/ 590170530Ssam#define IEEE80211_HTCAP_RXSTBC_3STREAM 0x0300 /* 1-3 spatial streams*/ 591170530Ssam#define IEEE80211_HTCAP_DELBA 0x0400 /* HT DELBA supported */ 592170530Ssam#define IEEE80211_HTCAP_MAXAMSDU 0x0800 /* max A-MSDU length */ 593170530Ssam#define IEEE80211_HTCAP_MAXAMSDU_7935 0x0800 /* 7935 octets */ 594170530Ssam#define IEEE80211_HTCAP_MAXAMSDU_3839 0x0000 /* 3839 octets */ 595170530Ssam#define IEEE80211_HTCAP_DSSSCCK40 0x1000 /* DSSS/CCK in 40MHz */ 596170530Ssam#define IEEE80211_HTCAP_PSMP 0x2000 /* PSMP supported */ 597170530Ssam#define IEEE80211_HTCAP_40INTOLERANT 0x4000 /* 40MHz intolerant */ 598170530Ssam#define IEEE80211_HTCAP_LSIGTXOPPROT 0x8000 /* L-SIG TXOP prot */ 599170530Ssam 600187797Ssam#define IEEE80211_HTCAP_BITS \ 601187797Ssam "\20\1LDPC\2CHWIDTH40\5GREENFIELD\6SHORTGI20\7SHORTGI40\10TXSTBC" \ 602187797Ssam "\13DELBA\14AMSDU(7935)\15DSSSCCK40\16PSMP\1740INTOLERANT" \ 603187797Ssam "\20LSIGTXOPPROT" 604187797Ssam 605170530Ssam/* HT parameters (hc_param) */ 606170530Ssam#define IEEE80211_HTCAP_MAXRXAMPDU 0x03 /* max rx A-MPDU factor */ 607170530Ssam#define IEEE80211_HTCAP_MAXRXAMPDU_S 0 608173273Ssam#define IEEE80211_HTCAP_MAXRXAMPDU_8K 0 609173273Ssam#define IEEE80211_HTCAP_MAXRXAMPDU_16K 1 610173273Ssam#define IEEE80211_HTCAP_MAXRXAMPDU_32K 2 611173273Ssam#define IEEE80211_HTCAP_MAXRXAMPDU_64K 3 612170530Ssam#define IEEE80211_HTCAP_MPDUDENSITY 0x1c /* min MPDU start spacing */ 613170530Ssam#define IEEE80211_HTCAP_MPDUDENSITY_S 2 614173273Ssam#define IEEE80211_HTCAP_MPDUDENSITY_NA 0 /* no time restriction */ 615173273Ssam#define IEEE80211_HTCAP_MPDUDENSITY_025 1 /* 1/4 us */ 616173273Ssam#define IEEE80211_HTCAP_MPDUDENSITY_05 2 /* 1/2 us */ 617173273Ssam#define IEEE80211_HTCAP_MPDUDENSITY_1 3 /* 1 us */ 618173273Ssam#define IEEE80211_HTCAP_MPDUDENSITY_2 4 /* 2 us */ 619173273Ssam#define IEEE80211_HTCAP_MPDUDENSITY_4 5 /* 4 us */ 620173273Ssam#define IEEE80211_HTCAP_MPDUDENSITY_8 6 /* 8 us */ 621173273Ssam#define IEEE80211_HTCAP_MPDUDENSITY_16 7 /* 16 us */ 622170530Ssam 623170530Ssam/* HT extended capabilities (hc_extcap) */ 624170530Ssam#define IEEE80211_HTCAP_PCO 0x0001 /* PCO capable */ 625170530Ssam#define IEEE80211_HTCAP_PCOTRANS 0x0006 /* PCO transition time */ 626170530Ssam#define IEEE80211_HTCAP_PCOTRANS_S 1 627170530Ssam#define IEEE80211_HTCAP_PCOTRANS_04 0x0002 /* 400 us */ 628170530Ssam#define IEEE80211_HTCAP_PCOTRANS_15 0x0004 /* 1.5 ms */ 629170530Ssam#define IEEE80211_HTCAP_PCOTRANS_5 0x0006 /* 5 ms */ 630170530Ssam/* bits 3-7 reserved */ 631170530Ssam#define IEEE80211_HTCAP_MCSFBACK 0x0300 /* MCS feedback */ 632170530Ssam#define IEEE80211_HTCAP_MCSFBACK_S 8 633170530Ssam#define IEEE80211_HTCAP_MCSFBACK_NONE 0x0000 /* nothing provided */ 634170530Ssam#define IEEE80211_HTCAP_MCSFBACK_UNSOL 0x0200 /* unsolicited feedback */ 635170530Ssam#define IEEE80211_HTCAP_MCSFBACK_MRQ 0x0300 /* " "+respond to MRQ */ 636170530Ssam#define IEEE80211_HTCAP_HTC 0x0400 /* +HTC support */ 637170530Ssam#define IEEE80211_HTCAP_RDR 0x0800 /* reverse direction responder*/ 638170530Ssam/* bits 12-15 reserved */ 639170530Ssam 640170530Ssam/* 641170530Ssam * 802.11n HT Information IE 642170530Ssam */ 643170530Ssamstruct ieee80211_ie_htinfo { 644170530Ssam uint8_t hi_id; /* element ID */ 645170530Ssam uint8_t hi_len; /* length in bytes */ 646170530Ssam uint8_t hi_ctrlchannel; /* primary channel */ 647170530Ssam uint8_t hi_byte1; /* ht ie byte 1 */ 648172055Ssam uint8_t hi_byte2; /* ht ie byte 2 */ 649172055Ssam uint8_t hi_byte3; /* ht ie byte 3 */ 650170530Ssam uint16_t hi_byte45; /* ht ie bytes 4+5 */ 651172055Ssam uint8_t hi_basicmcsset[16]; /* basic MCS set */ 652170530Ssam} __packed; 653170530Ssam 654170530Ssam/* byte1 */ 655170530Ssam#define IEEE80211_HTINFO_2NDCHAN 0x03 /* secondary/ext chan offset */ 656170530Ssam#define IEEE80211_HTINFO_2NDCHAN_S 0 657170530Ssam#define IEEE80211_HTINFO_2NDCHAN_NONE 0x00 /* no secondary/ext channel */ 658170530Ssam#define IEEE80211_HTINFO_2NDCHAN_ABOVE 0x01 /* above private channel */ 659170530Ssam/* NB: 2 is reserved */ 660170530Ssam#define IEEE80211_HTINFO_2NDCHAN_BELOW 0x03 /* below primary channel */ 661170530Ssam#define IEEE80211_HTINFO_TXWIDTH 0x04 /* tx channel width */ 662170530Ssam#define IEEE80211_HTINFO_TXWIDTH_20 0x00 /* 20MHz width */ 663170530Ssam#define IEEE80211_HTINFO_TXWIDTH_2040 0x04 /* any supported width */ 664170530Ssam#define IEEE80211_HTINFO_RIFSMODE 0x08 /* Reduced IFS (RIFS) use */ 665170530Ssam#define IEEE80211_HTINFO_RIFSMODE_PROH 0x00 /* RIFS use prohibited */ 666170530Ssam#define IEEE80211_HTINFO_RIFSMODE_PERM 0x08 /* RIFS use permitted */ 667170530Ssam#define IEEE80211_HTINFO_PMSPONLY 0x10 /* PSMP required to associate */ 668170530Ssam#define IEEE80211_HTINFO_SIGRAN 0xe0 /* shortest Service Interval */ 669170530Ssam#define IEEE80211_HTINFO_SIGRAN_S 5 670170530Ssam#define IEEE80211_HTINFO_SIGRAN_5 0x00 /* 5 ms */ 671170530Ssam/* XXX add rest */ 672170530Ssam 673170530Ssam/* bytes 2+3 */ 674170530Ssam#define IEEE80211_HTINFO_OPMODE 0x03 /* operating mode */ 675170530Ssam#define IEEE80211_HTINFO_OPMODE_S 0 676170530Ssam#define IEEE80211_HTINFO_OPMODE_PURE 0x00 /* no protection */ 677172055Ssam#define IEEE80211_HTINFO_OPMODE_PROTOPT 0x01 /* protection optional */ 678172055Ssam#define IEEE80211_HTINFO_OPMODE_HT20PR 0x02 /* protection for HT20 sta's */ 679172055Ssam#define IEEE80211_HTINFO_OPMODE_MIXED 0x03 /* protection for legacy sta's*/ 680170530Ssam#define IEEE80211_HTINFO_NONGF_PRESENT 0x04 /* non-GF sta's present */ 681170530Ssam#define IEEE80211_HTINFO_TXBL 0x08 /* transmit burst limit */ 682170530Ssam#define IEEE80211_HTINFO_NONHT_PRESENT 0x10 /* non-HT sta's present */ 683170530Ssam/* bits 5-15 reserved */ 684170530Ssam 685170530Ssam/* bytes 4+5 */ 686170530Ssam#define IEEE80211_HTINFO_2NDARYBEACON 0x01 687170530Ssam#define IEEE80211_HTINFO_LSIGTXOPPROT 0x02 688170530Ssam#define IEEE80211_HTINFO_PCO_ACTIVE 0x04 689170530Ssam#define IEEE80211_HTINFO_40MHZPHASE 0x08 690170530Ssam 691170530Ssam/* byte5 */ 692170530Ssam#define IEEE80211_HTINFO_BASIC_STBCMCS 0x7f 693170530Ssam#define IEEE80211_HTINFO_BASIC_STBCMCS_S 0 694170530Ssam#define IEEE80211_HTINFO_DUALPROTECTED 0x80 695170530Ssam 696170530Ssam/* 697138568Ssam * Management information element payloads. 698116742Ssam */ 699116742Ssam 700116742Ssamenum { 701138568Ssam IEEE80211_ELEMID_SSID = 0, 702138568Ssam IEEE80211_ELEMID_RATES = 1, 703138568Ssam IEEE80211_ELEMID_FHPARMS = 2, 704138568Ssam IEEE80211_ELEMID_DSPARMS = 3, 705138568Ssam IEEE80211_ELEMID_CFPARMS = 4, 706138568Ssam IEEE80211_ELEMID_TIM = 5, 707138568Ssam IEEE80211_ELEMID_IBSSPARMS = 6, 708138568Ssam IEEE80211_ELEMID_COUNTRY = 7, 709138568Ssam IEEE80211_ELEMID_CHALLENGE = 16, 710127903Ssam /* 17-31 reserved for challenge text extension */ 711170530Ssam IEEE80211_ELEMID_PWRCNSTR = 32, 712170530Ssam IEEE80211_ELEMID_PWRCAP = 33, 713170530Ssam IEEE80211_ELEMID_TPCREQ = 34, 714170530Ssam IEEE80211_ELEMID_TPCREP = 35, 715170530Ssam IEEE80211_ELEMID_SUPPCHAN = 36, 716193439Ssam IEEE80211_ELEMID_CSA = 37, 717170530Ssam IEEE80211_ELEMID_MEASREQ = 38, 718170530Ssam IEEE80211_ELEMID_MEASREP = 39, 719170530Ssam IEEE80211_ELEMID_QUIET = 40, 720170530Ssam IEEE80211_ELEMID_IBSSDFS = 41, 721138568Ssam IEEE80211_ELEMID_ERP = 42, 722170530Ssam IEEE80211_ELEMID_HTCAP = 45, 723253639Srpaulo IEEE80211_ELEMID_QOS = 46, 724138568Ssam IEEE80211_ELEMID_RSN = 48, 725138568Ssam IEEE80211_ELEMID_XRATES = 50, 726170530Ssam IEEE80211_ELEMID_HTINFO = 61, 727138568Ssam IEEE80211_ELEMID_TPC = 150, 728138568Ssam IEEE80211_ELEMID_CCKM = 156, 729138568Ssam IEEE80211_ELEMID_VENDOR = 221, /* vendor private */ 730195618Srpaulo 731195618Srpaulo /* 732231187Sadrian * 802.11s IEs 733231187Sadrian * NB: On vanilla Linux still IEEE80211_ELEMID_MESHPEER = 55, 734231187Sadrian * but they defined a new with id 117 called PEER_MGMT. 735231187Sadrian * NB: complies with open80211 736195618Srpaulo */ 737231187Sadrian IEEE80211_ELEMID_MESHCONF = 113, 738231187Sadrian IEEE80211_ELEMID_MESHID = 114, 739231187Sadrian IEEE80211_ELEMID_MESHLINK = 115, 740231187Sadrian IEEE80211_ELEMID_MESHCNGST = 116, 741231187Sadrian IEEE80211_ELEMID_MESHPEER = 117, 742231187Sadrian IEEE80211_ELEMID_MESHCSA = 118, 743231187Sadrian IEEE80211_ELEMID_MESHTIM = 39, /* XXX: remove */ 744231187Sadrian IEEE80211_ELEMID_MESHAWAKEW = 119, 745231187Sadrian IEEE80211_ELEMID_MESHBEACONT = 120, 746231187Sadrian /* 121-124 MMCAOP not implemented yet */ 747234892Smonthadar IEEE80211_ELEMID_MESHGANN = 125, 748231187Sadrian IEEE80211_ELEMID_MESHRANN = 126, 749231187Sadrian /* 127 Extended Capabilities */ 750231187Sadrian /* 128-129 reserved */ 751231187Sadrian IEEE80211_ELEMID_MESHPREQ = 130, 752231187Sadrian IEEE80211_ELEMID_MESHPREP = 131, 753231187Sadrian IEEE80211_ELEMID_MESHPERR = 132, 754231187Sadrian /* 133-136 reserved */ 755231187Sadrian IEEE80211_ELEMID_MESHPXU = 137, 756231187Sadrian IEEE80211_ELEMID_MESHPXUC = 138, 757231187Sadrian IEEE80211_ELEMID_MESHAH = 60, /* XXX: remove */ 758116742Ssam}; 759116742Ssam 760138568Ssamstruct ieee80211_tim_ie { 761170530Ssam uint8_t tim_ie; /* IEEE80211_ELEMID_TIM */ 762170530Ssam uint8_t tim_len; 763170530Ssam uint8_t tim_count; /* DTIM count */ 764170530Ssam uint8_t tim_period; /* DTIM period */ 765170530Ssam uint8_t tim_bitctl; /* bitmap control */ 766170530Ssam uint8_t tim_bitmap[1]; /* variable-length bitmap */ 767138568Ssam} __packed; 768127903Ssam 769138568Ssamstruct ieee80211_country_ie { 770170530Ssam uint8_t ie; /* IEEE80211_ELEMID_COUNTRY */ 771170530Ssam uint8_t len; 772170530Ssam uint8_t cc[3]; /* ISO CC+(I)ndoor/(O)utdoor */ 773138568Ssam struct { 774170530Ssam uint8_t schan; /* starting channel */ 775170530Ssam uint8_t nchan; /* number channels */ 776170530Ssam uint8_t maxtxpwr; /* tx power cap */ 777178354Ssam } __packed band[1]; /* sub bands (NB: var size) */ 778138568Ssam} __packed; 779116742Ssam 780178354Ssam#define IEEE80211_COUNTRY_MAX_BANDS 84 /* max possible bands */ 781178354Ssam#define IEEE80211_COUNTRY_MAX_SIZE \ 782178354Ssam (sizeof(struct ieee80211_country_ie) + 3*(IEEE80211_COUNTRY_MAX_BANDS-1)) 783178354Ssam 784170530Ssam/* 785239142Sadrian * 802.11h Quiet Time Element. 786172055Ssam */ 787227331Sadrianstruct ieee80211_quiet_ie { 788227331Sadrian uint8_t quiet_ie; /* IEEE80211_ELEMID_QUIET */ 789227331Sadrian uint8_t len; 790227331Sadrian uint8_t tbttcount; /* quiet start */ 791227331Sadrian uint8_t period; /* beacon intervals between quiets */ 792227331Sadrian uint16_t duration; /* TUs of each quiet*/ 793227331Sadrian uint16_t offset; /* TUs of from TBTT of quiet start */ 794227331Sadrian} __packed; 795227331Sadrian 796227331Sadrian/* 797227331Sadrian * 802.11h Channel Switch Announcement (CSA). 798227331Sadrian */ 799172055Ssamstruct ieee80211_csa_ie { 800172055Ssam uint8_t csa_ie; /* IEEE80211_ELEMID_CHANSWITCHANN */ 801172055Ssam uint8_t csa_len; 802172055Ssam uint8_t csa_mode; /* Channel Switch Mode */ 803172055Ssam uint8_t csa_newchan; /* New Channel Number */ 804172055Ssam uint8_t csa_count; /* Channel Switch Count */ 805172055Ssam} __packed; 806172055Ssam 807193439Ssam/* 808193439Ssam * Note the min acceptable CSA count is used to guard against 809193439Ssam * malicious CSA injection in station mode. Defining this value 810193439Ssam * as other than 0 violates the 11h spec. 811193439Ssam */ 812193439Ssam#define IEEE80211_CSA_COUNT_MIN 2 813193439Ssam#define IEEE80211_CSA_COUNT_MAX 255 814193439Ssam 815172055Ssam/* rate set entries are in .5 Mb/s units, and potentially marked as basic */ 816138568Ssam#define IEEE80211_RATE_BASIC 0x80 817138568Ssam#define IEEE80211_RATE_VAL 0x7f 818288084Sadrian#define IEEE80211_RV(v) ((v) & IEEE80211_RATE_VAL) 819138568Ssam 820283589Sgavin/* ERP information element flags */ 821138568Ssam#define IEEE80211_ERP_NON_ERP_PRESENT 0x01 822138568Ssam#define IEEE80211_ERP_USE_PROTECTION 0x02 823138568Ssam#define IEEE80211_ERP_LONG_PREAMBLE 0x04 824116742Ssam 825187797Ssam#define IEEE80211_ERP_BITS \ 826187797Ssam "\20\1NON_ERP_PRESENT\2USE_PROTECTION\3LONG_PREAMBLE" 827187797Ssam 828170530Ssam#define ATH_OUI 0x7f0300 /* Atheros OUI */ 829190455Ssam#define ATH_OUI_TYPE 0x01 /* Atheros protocol ie */ 830127903Ssam 831190455Ssam/* NB: Atheros allocated the OUI for this purpose ~2005 but beware ... */ 832190455Ssam#define TDMA_OUI ATH_OUI 833190455Ssam#define TDMA_OUI_TYPE 0x02 /* TDMA protocol ie */ 834190455Ssam 835170530Ssam#define BCM_OUI 0x4c9000 /* Broadcom OUI */ 836170530Ssam#define BCM_OUI_HTCAP 51 /* pre-draft HTCAP ie */ 837170530Ssam#define BCM_OUI_HTINFO 52 /* pre-draft HTINFO ie */ 838170530Ssam 839127903Ssam#define WPA_OUI 0xf25000 840127903Ssam#define WPA_OUI_TYPE 0x01 841138568Ssam#define WPA_VERSION 1 /* current supported version */ 842127903Ssam 843127903Ssam#define WPA_CSE_NULL 0x00 844127903Ssam#define WPA_CSE_WEP40 0x01 845127903Ssam#define WPA_CSE_TKIP 0x02 846127903Ssam#define WPA_CSE_CCMP 0x04 847127903Ssam#define WPA_CSE_WEP104 0x05 848127903Ssam 849127903Ssam#define WPA_ASE_NONE 0x00 850127903Ssam#define WPA_ASE_8021X_UNSPEC 0x01 851127903Ssam#define WPA_ASE_8021X_PSK 0x02 852127903Ssam 853181347Ssam#define WPS_OUI_TYPE 0x04 854181347Ssam 855138568Ssam#define RSN_OUI 0xac0f00 856138568Ssam#define RSN_VERSION 1 /* current supported version */ 857138568Ssam 858138568Ssam#define RSN_CSE_NULL 0x00 859138568Ssam#define RSN_CSE_WEP40 0x01 860138568Ssam#define RSN_CSE_TKIP 0x02 861138568Ssam#define RSN_CSE_WRAP 0x03 862138568Ssam#define RSN_CSE_CCMP 0x04 863138568Ssam#define RSN_CSE_WEP104 0x05 864138568Ssam 865138568Ssam#define RSN_ASE_NONE 0x00 866138568Ssam#define RSN_ASE_8021X_UNSPEC 0x01 867138568Ssam#define RSN_ASE_8021X_PSK 0x02 868138568Ssam 869138568Ssam#define RSN_CAP_PREAUTH 0x01 870138568Ssam 871138568Ssam#define WME_OUI 0xf25000 872138568Ssam#define WME_OUI_TYPE 0x02 873138568Ssam#define WME_INFO_OUI_SUBTYPE 0x00 874138568Ssam#define WME_PARAM_OUI_SUBTYPE 0x01 875138568Ssam#define WME_VERSION 1 876138568Ssam 877138568Ssam/* WME stream classes */ 878138568Ssam#define WME_AC_BE 0 /* best effort */ 879138568Ssam#define WME_AC_BK 1 /* background */ 880138568Ssam#define WME_AC_VI 2 /* video */ 881138568Ssam#define WME_AC_VO 3 /* voice */ 882138568Ssam 883116742Ssam/* 884116742Ssam * AUTH management packets 885116742Ssam * 886116742Ssam * octet algo[2] 887116742Ssam * octet seq[2] 888116742Ssam * octet status[2] 889116742Ssam * octet chal.id 890116742Ssam * octet chal.length 891172055Ssam * octet chal.text[253] NB: 1-253 bytes 892116742Ssam */ 893116742Ssam 894172055Ssam/* challenge length for shared key auth */ 895172055Ssam#define IEEE80211_CHALLENGE_LEN 128 896116742Ssam 897138568Ssam#define IEEE80211_AUTH_ALG_OPEN 0x0000 898138568Ssam#define IEEE80211_AUTH_ALG_SHARED 0x0001 899138568Ssam#define IEEE80211_AUTH_ALG_LEAP 0x0080 900116742Ssam 901116742Ssamenum { 902116742Ssam IEEE80211_AUTH_OPEN_REQUEST = 1, 903116742Ssam IEEE80211_AUTH_OPEN_RESPONSE = 2, 904116742Ssam}; 905116742Ssam 906116742Ssamenum { 907116742Ssam IEEE80211_AUTH_SHARED_REQUEST = 1, 908116742Ssam IEEE80211_AUTH_SHARED_CHALLENGE = 2, 909116742Ssam IEEE80211_AUTH_SHARED_RESPONSE = 3, 910116742Ssam IEEE80211_AUTH_SHARED_PASS = 4, 911116742Ssam}; 912116742Ssam 913116742Ssam/* 914172055Ssam * Reason and status codes. 915116742Ssam * 916172055Ssam * Reason codes are used in management frames to indicate why an 917172055Ssam * action took place (e.g. on disassociation). Status codes are 918172055Ssam * used in management frames to indicate the result of an operation. 919172055Ssam * 920116742Ssam * Unlisted codes are reserved 921116742Ssam */ 922116742Ssam 923116742Ssamenum { 924116742Ssam IEEE80211_REASON_UNSPECIFIED = 1, 925116742Ssam IEEE80211_REASON_AUTH_EXPIRE = 2, 926116742Ssam IEEE80211_REASON_AUTH_LEAVE = 3, 927116742Ssam IEEE80211_REASON_ASSOC_EXPIRE = 4, 928116742Ssam IEEE80211_REASON_ASSOC_TOOMANY = 5, 929116742Ssam IEEE80211_REASON_NOT_AUTHED = 6, 930116742Ssam IEEE80211_REASON_NOT_ASSOCED = 7, 931116742Ssam IEEE80211_REASON_ASSOC_LEAVE = 8, 932116742Ssam IEEE80211_REASON_ASSOC_NOT_AUTHED = 9, 933172055Ssam IEEE80211_REASON_DISASSOC_PWRCAP_BAD = 10, /* 11h */ 934172055Ssam IEEE80211_REASON_DISASSOC_SUPCHAN_BAD = 11, /* 11h */ 935172055Ssam IEEE80211_REASON_IE_INVALID = 13, /* 11i */ 936172055Ssam IEEE80211_REASON_MIC_FAILURE = 14, /* 11i */ 937172055Ssam IEEE80211_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, /* 11i */ 938172055Ssam IEEE80211_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16, /* 11i */ 939172055Ssam IEEE80211_REASON_IE_IN_4WAY_DIFFERS = 17, /* 11i */ 940172055Ssam IEEE80211_REASON_GROUP_CIPHER_INVALID = 18, /* 11i */ 941172055Ssam IEEE80211_REASON_PAIRWISE_CIPHER_INVALID= 19, /* 11i */ 942172055Ssam IEEE80211_REASON_AKMP_INVALID = 20, /* 11i */ 943172055Ssam IEEE80211_REASON_UNSUPP_RSN_IE_VERSION = 21, /* 11i */ 944172055Ssam IEEE80211_REASON_INVALID_RSN_IE_CAP = 22, /* 11i */ 945172055Ssam IEEE80211_REASON_802_1X_AUTH_FAILED = 23, /* 11i */ 946172055Ssam IEEE80211_REASON_CIPHER_SUITE_REJECTED = 24, /* 11i */ 947182820Ssam IEEE80211_REASON_UNSPECIFIED_QOS = 32, /* 11e */ 948182820Ssam IEEE80211_REASON_INSUFFICIENT_BW = 33, /* 11e */ 949182820Ssam IEEE80211_REASON_TOOMANY_FRAMES = 34, /* 11e */ 950182820Ssam IEEE80211_REASON_OUTSIDE_TXOP = 35, /* 11e */ 951182820Ssam IEEE80211_REASON_LEAVING_QBSS = 36, /* 11e */ 952182820Ssam IEEE80211_REASON_BAD_MECHANISM = 37, /* 11e */ 953182820Ssam IEEE80211_REASON_SETUP_NEEDED = 38, /* 11e */ 954182820Ssam IEEE80211_REASON_TIMEOUT = 39, /* 11e */ 955116742Ssam 956231058Sadrian IEEE80211_REASON_PEER_LINK_CANCELED = 52, /* 11s */ 957231058Sadrian IEEE80211_REASON_MESH_MAX_PEERS = 53, /* 11s */ 958231058Sadrian IEEE80211_REASON_MESH_CPVIOLATION = 54, /* 11s */ 959231058Sadrian IEEE80211_REASON_MESH_CLOSE_RCVD = 55, /* 11s */ 960231058Sadrian IEEE80211_REASON_MESH_MAX_RETRIES = 56, /* 11s */ 961231058Sadrian IEEE80211_REASON_MESH_CONFIRM_TIMEOUT = 57, /* 11s */ 962231058Sadrian IEEE80211_REASON_MESH_INVALID_GTK = 58, /* 11s */ 963231058Sadrian IEEE80211_REASON_MESH_INCONS_PARAMS = 59, /* 11s */ 964231058Sadrian IEEE80211_REASON_MESH_INVALID_SECURITY = 60, /* 11s */ 965231058Sadrian IEEE80211_REASON_MESH_PERR_NO_PROXY = 61, /* 11s */ 966231058Sadrian IEEE80211_REASON_MESH_PERR_NO_FI = 62, /* 11s */ 967231058Sadrian IEEE80211_REASON_MESH_PERR_DEST_UNREACH = 63, /* 11s */ 968231058Sadrian IEEE80211_REASON_MESH_MAC_ALRDY_EXISTS_MBSS = 64, /* 11s */ 969231058Sadrian IEEE80211_REASON_MESH_CHAN_SWITCH_REG = 65, /* 11s */ 970231058Sadrian IEEE80211_REASON_MESH_CHAN_SWITCH_UNSPEC = 66, /* 11s */ 971195618Srpaulo 972116742Ssam IEEE80211_STATUS_SUCCESS = 0, 973116742Ssam IEEE80211_STATUS_UNSPECIFIED = 1, 974116742Ssam IEEE80211_STATUS_CAPINFO = 10, 975116742Ssam IEEE80211_STATUS_NOT_ASSOCED = 11, 976116742Ssam IEEE80211_STATUS_OTHER = 12, 977116742Ssam IEEE80211_STATUS_ALG = 13, 978116742Ssam IEEE80211_STATUS_SEQUENCE = 14, 979116742Ssam IEEE80211_STATUS_CHALLENGE = 15, 980116742Ssam IEEE80211_STATUS_TIMEOUT = 16, 981116742Ssam IEEE80211_STATUS_TOOMANY = 17, 982116742Ssam IEEE80211_STATUS_BASIC_RATE = 18, 983172055Ssam IEEE80211_STATUS_SP_REQUIRED = 19, /* 11b */ 984172055Ssam IEEE80211_STATUS_PBCC_REQUIRED = 20, /* 11b */ 985172055Ssam IEEE80211_STATUS_CA_REQUIRED = 21, /* 11b */ 986172055Ssam IEEE80211_STATUS_SPECMGMT_REQUIRED = 22, /* 11h */ 987172055Ssam IEEE80211_STATUS_PWRCAP_REQUIRED = 23, /* 11h */ 988172055Ssam IEEE80211_STATUS_SUPCHAN_REQUIRED = 24, /* 11h */ 989172055Ssam IEEE80211_STATUS_SHORTSLOT_REQUIRED = 25, /* 11g */ 990172055Ssam IEEE80211_STATUS_DSSSOFDM_REQUIRED = 26, /* 11g */ 991193542Ssam IEEE80211_STATUS_MISSING_HT_CAPS = 27, /* 11n D3.0 */ 992172055Ssam IEEE80211_STATUS_INVALID_IE = 40, /* 11i */ 993172055Ssam IEEE80211_STATUS_GROUP_CIPHER_INVALID = 41, /* 11i */ 994172055Ssam IEEE80211_STATUS_PAIRWISE_CIPHER_INVALID = 42, /* 11i */ 995172055Ssam IEEE80211_STATUS_AKMP_INVALID = 43, /* 11i */ 996172055Ssam IEEE80211_STATUS_UNSUPP_RSN_IE_VERSION = 44, /* 11i */ 997172055Ssam IEEE80211_STATUS_INVALID_RSN_IE_CAP = 45, /* 11i */ 998172055Ssam IEEE80211_STATUS_CIPHER_SUITE_REJECTED = 46, /* 11i */ 999116742Ssam}; 1000116742Ssam 1001138568Ssam#define IEEE80211_WEP_KEYLEN 5 /* 40bit */ 1002138568Ssam#define IEEE80211_WEP_IVLEN 3 /* 24bit */ 1003138568Ssam#define IEEE80211_WEP_KIDLEN 1 /* 1 octet */ 1004138568Ssam#define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */ 1005178354Ssam#define IEEE80211_WEP_TOTLEN (IEEE80211_WEP_IVLEN + \ 1006178354Ssam IEEE80211_WEP_KIDLEN + \ 1007178354Ssam IEEE80211_WEP_CRCLEN) 1008138568Ssam#define IEEE80211_WEP_NKID 4 /* number of key ids */ 1009116742Ssam 1010138568Ssam/* 1011138568Ssam * 802.11i defines an extended IV for use with non-WEP ciphers. 1012138568Ssam * When the EXTIV bit is set in the key id byte an additional 1013138568Ssam * 4 bytes immediately follow the IV for TKIP. For CCMP the 1014138568Ssam * EXTIV bit is likewise set but the 8 bytes represent the 1015138568Ssam * CCMP header rather than IV+extended-IV. 1016138568Ssam */ 1017138568Ssam#define IEEE80211_WEP_EXTIV 0x20 1018138568Ssam#define IEEE80211_WEP_EXTIVLEN 4 /* extended IV length */ 1019138568Ssam#define IEEE80211_WEP_MICLEN 8 /* trailing MIC */ 1020116742Ssam 1021138568Ssam#define IEEE80211_CRC_LEN 4 1022138568Ssam 1023124457Ssam/* 1024124457Ssam * Maximum acceptable MTU is: 1025124457Ssam * IEEE80211_MAX_LEN - WEP overhead - CRC - 1026124457Ssam * QoS overhead - RSN/WPA overhead 1027124457Ssam * Min is arbitrarily chosen > IEEE80211_MIN_LEN. The default 1028124457Ssam * mtu is Ethernet-compatible; it's set by ether_ifattach. 1029124457Ssam */ 1030138568Ssam#define IEEE80211_MTU_MAX 2290 1031138568Ssam#define IEEE80211_MTU_MIN 32 1032124457Ssam 1033138568Ssam#define IEEE80211_MAX_LEN (2300 + IEEE80211_CRC_LEN + \ 1034116742Ssam (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN)) 1035138568Ssam#define IEEE80211_ACK_LEN \ 1036138568Ssam (sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN) 1037120098Ssam#define IEEE80211_MIN_LEN \ 1038120098Ssam (sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN) 1039116742Ssam 1040138568Ssam/* 1041138568Ssam * The 802.11 spec says at most 2007 stations may be 1042138568Ssam * associated at once. For most AP's this is way more 1043178354Ssam * than is feasible so we use a default of IEEE80211_AID_DEF. 1044178354Ssam * This number may be overridden by the driver and/or by 1045178354Ssam * user configuration but may not be less than IEEE80211_AID_MIN 1046178354Ssam * (see _ieee80211.h for implementation-specific settings). 1047138568Ssam */ 1048138568Ssam#define IEEE80211_AID_MAX 2007 1049138568Ssam 1050138568Ssam#define IEEE80211_AID(b) ((b) &~ 0xc000) 1051138568Ssam 1052116742Ssam/* 1053116742Ssam * RTS frame length parameters. The default is specified in 1054148291Ssam * the 802.11 spec as 512; we treat it as implementation-dependent 1055148291Ssam * so it's defined in ieee80211_var.h. The max may be wrong 1056148291Ssam * for jumbo frames. 1057116742Ssam */ 1058138568Ssam#define IEEE80211_RTS_MIN 1 1059148291Ssam#define IEEE80211_RTS_MAX 2346 1060116742Ssam 1061148291Ssam/* 1062148291Ssam * TX fragmentation parameters. As above for RTS, we treat 1063148291Ssam * default as implementation-dependent so define it elsewhere. 1064148291Ssam */ 1065148291Ssam#define IEEE80211_FRAG_MIN 256 1066148291Ssam#define IEEE80211_FRAG_MAX 2346 1067148291Ssam 1068160685Ssam/* 1069160685Ssam * Beacon interval (TU's). Min+max come from WiFi requirements. 1070160685Ssam * As above, we treat default as implementation-dependent so 1071160685Ssam * define it elsewhere. 1072160685Ssam */ 1073160685Ssam#define IEEE80211_BINTVAL_MAX 1000 /* max beacon interval (TU's) */ 1074160685Ssam#define IEEE80211_BINTVAL_MIN 25 /* min beacon interval (TU's) */ 1075160685Ssam 1076160685Ssam/* 1077160685Ssam * DTIM period (beacons). Min+max are not really defined 1078160685Ssam * by the protocol but we want them publicly visible so 1079160685Ssam * define them here. 1080160685Ssam */ 1081160685Ssam#define IEEE80211_DTIM_MAX 15 /* max DTIM period */ 1082160685Ssam#define IEEE80211_DTIM_MIN 1 /* min DTIM period */ 1083160685Ssam 1084160685Ssam/* 1085160685Ssam * Beacon miss threshold (beacons). As for DTIM, we define 1086160685Ssam * them here to be publicly visible. Note the max may be 1087160685Ssam * clamped depending on device capabilities. 1088160685Ssam */ 1089160685Ssam#define IEEE80211_HWBMISS_MIN 1 1090160685Ssam#define IEEE80211_HWBMISS_MAX 255 1091160685Ssam 1092170530Ssam/* 1093170530Ssam * 802.11 frame duration definitions. 1094170530Ssam */ 1095170530Ssam 1096170530Ssamstruct ieee80211_duration { 1097170530Ssam uint16_t d_rts_dur; 1098170530Ssam uint16_t d_data_dur; 1099170530Ssam uint16_t d_plcp_len; 1100170530Ssam uint8_t d_residue; /* unused octets in time slot */ 1101170530Ssam}; 1102170530Ssam 1103170530Ssam/* One Time Unit (TU) is 1Kus = 1024 microseconds. */ 1104170530Ssam#define IEEE80211_DUR_TU 1024 1105170530Ssam 1106170530Ssam/* IEEE 802.11b durations for DSSS PHY in microseconds */ 1107170530Ssam#define IEEE80211_DUR_DS_LONG_PREAMBLE 144 1108170530Ssam#define IEEE80211_DUR_DS_SHORT_PREAMBLE 72 1109170530Ssam 1110170530Ssam#define IEEE80211_DUR_DS_SLOW_PLCPHDR 48 1111170530Ssam#define IEEE80211_DUR_DS_FAST_PLCPHDR 24 1112170530Ssam#define IEEE80211_DUR_DS_SLOW_ACK 112 1113170530Ssam#define IEEE80211_DUR_DS_FAST_ACK 56 1114170530Ssam#define IEEE80211_DUR_DS_SLOW_CTS 112 1115170530Ssam#define IEEE80211_DUR_DS_FAST_CTS 56 1116170530Ssam 1117170530Ssam#define IEEE80211_DUR_DS_SLOT 20 1118170530Ssam#define IEEE80211_DUR_DS_SIFS 10 1119170530Ssam#define IEEE80211_DUR_DS_PIFS (IEEE80211_DUR_DS_SIFS + IEEE80211_DUR_DS_SLOT) 1120170530Ssam#define IEEE80211_DUR_DS_DIFS (IEEE80211_DUR_DS_SIFS + \ 1121170530Ssam 2 * IEEE80211_DUR_DS_SLOT) 1122170530Ssam#define IEEE80211_DUR_DS_EIFS (IEEE80211_DUR_DS_SIFS + \ 1123170530Ssam IEEE80211_DUR_DS_SLOW_ACK + \ 1124170530Ssam IEEE80211_DUR_DS_LONG_PREAMBLE + \ 1125170530Ssam IEEE80211_DUR_DS_SLOW_PLCPHDR + \ 1126170530Ssam IEEE80211_DUR_DIFS) 1127170530Ssam 1128116742Ssam#endif /* _NET80211_IEEE80211_H_ */ 1129