1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2001 Atsushi Onoe 5 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * $FreeBSD$ 29 */ 30 #ifndef _NET80211_IEEE80211_H_ 31 #define _NET80211_IEEE80211_H_ 32 33 /* 34 * 802.11 protocol definitions. 35 */ 36 37 #define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */ 38 /* is 802.11 address multicast/broadcast? */ 39 #define IEEE80211_IS_MULTICAST(_a) (*(_a) & 0x01) 40 41 #ifdef _KERNEL 42 extern const uint8_t ieee80211broadcastaddr[]; 43 #endif 44 45 typedef uint16_t ieee80211_seq; 46 47 /* IEEE 802.11 PLCP header */ 48 struct ieee80211_plcp_hdr { 49 uint16_t i_sfd; 50 uint8_t i_signal; 51 uint8_t i_service; 52 uint16_t i_length; 53 uint16_t i_crc; 54 } __packed; 55 56 #define IEEE80211_PLCP_SFD 0xF3A0 57 #define IEEE80211_PLCP_SERVICE 0x00 58 #define IEEE80211_PLCP_SERVICE_LOCKED 0x04 59 #define IEEE80211_PLCL_SERVICE_PBCC 0x08 60 #define IEEE80211_PLCP_SERVICE_LENEXT5 0x20 61 #define IEEE80211_PLCP_SERVICE_LENEXT6 0x40 62 #define IEEE80211_PLCP_SERVICE_LENEXT7 0x80 63 64 /* 65 * generic definitions for IEEE 802.11 frames 66 */ 67 struct ieee80211_frame { 68 uint8_t i_fc[2]; 69 uint8_t i_dur[2]; 70 uint8_t i_addr1[IEEE80211_ADDR_LEN]; 71 uint8_t i_addr2[IEEE80211_ADDR_LEN]; 72 uint8_t i_addr3[IEEE80211_ADDR_LEN]; 73 uint8_t i_seq[2]; 74 /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ 75 /* see below */ 76 } __packed; 77 78 struct ieee80211_qosframe { 79 uint8_t i_fc[2]; 80 uint8_t i_dur[2]; 81 uint8_t i_addr1[IEEE80211_ADDR_LEN]; 82 uint8_t i_addr2[IEEE80211_ADDR_LEN]; 83 uint8_t i_addr3[IEEE80211_ADDR_LEN]; 84 uint8_t i_seq[2]; 85 uint8_t i_qos[2]; 86 /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ 87 /* see below */ 88 } __packed; 89 90 struct ieee80211_qoscntl { 91 uint8_t i_qos[2]; 92 }; 93 94 struct ieee80211_frame_addr4 { 95 uint8_t i_fc[2]; 96 uint8_t i_dur[2]; 97 uint8_t i_addr1[IEEE80211_ADDR_LEN]; 98 uint8_t i_addr2[IEEE80211_ADDR_LEN]; 99 uint8_t i_addr3[IEEE80211_ADDR_LEN]; 100 uint8_t i_seq[2]; 101 uint8_t i_addr4[IEEE80211_ADDR_LEN]; 102 } __packed; 103 104 struct ieee80211_qosframe_addr4 { 105 uint8_t i_fc[2]; 106 uint8_t i_dur[2]; 107 uint8_t i_addr1[IEEE80211_ADDR_LEN]; 108 uint8_t i_addr2[IEEE80211_ADDR_LEN]; 109 uint8_t i_addr3[IEEE80211_ADDR_LEN]; 110 uint8_t i_seq[2]; 111 uint8_t i_addr4[IEEE80211_ADDR_LEN]; 112 uint8_t i_qos[2]; 113 } __packed; 114 115 #define IEEE80211_FC0_VERSION_MASK 0x03 116 #define IEEE80211_FC0_VERSION_SHIFT 0 117 #define IEEE80211_FC0_VERSION_0 0x00 118 #define IEEE80211_FC0_TYPE_MASK 0x0c 119 #define IEEE80211_FC0_TYPE_SHIFT 2 120 #define IEEE80211_FC0_TYPE_MGT 0x00 121 #define IEEE80211_FC0_TYPE_CTL 0x04 122 #define IEEE80211_FC0_TYPE_DATA 0x08 123 124 #define IEEE80211_FC0_SUBTYPE_MASK 0xf0 125 #define IEEE80211_FC0_SUBTYPE_SHIFT 4 126 /* for TYPE_MGT */ 127 #define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00 128 #define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10 129 #define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20 130 #define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30 131 #define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40 132 #define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50 133 #define IEEE80211_FC0_SUBTYPE_TIMING_ADV 0x60 134 #define IEEE80211_FC0_SUBTYPE_BEACON 0x80 135 #define IEEE80211_FC0_SUBTYPE_ATIM 0x90 136 #define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0 137 #define IEEE80211_FC0_SUBTYPE_AUTH 0xb0 138 #define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0 139 #define IEEE80211_FC0_SUBTYPE_ACTION 0xd0 140 #define IEEE80211_FC0_SUBTYPE_ACTION_NOACK 0xe0 141 /* for TYPE_CTL */ 142 #define IEEE80211_FC0_SUBTYPE_TRIGGER 0x20 143 #define IEEE80211_FC0_SUBTYPE_CONTROL_WRAP 0x70 144 #define IEEE80211_FC0_SUBTYPE_BAR 0x80 145 #define IEEE80211_FC0_SUBTYPE_BA 0x90 146 #define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0 147 #define IEEE80211_FC0_SUBTYPE_RTS 0xb0 148 #define IEEE80211_FC0_SUBTYPE_CTS 0xc0 149 #define IEEE80211_FC0_SUBTYPE_ACK 0xd0 150 #define IEEE80211_FC0_SUBTYPE_CF_END 0xe0 151 #define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0 152 /* for TYPE_DATA (bit combination) */ 153 #define IEEE80211_FC0_SUBTYPE_DATA 0x00 154 #define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10 155 #define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20 156 #define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30 157 #define IEEE80211_FC0_SUBTYPE_NODATA 0x40 158 #define IEEE80211_FC0_SUBTYPE_CFACK 0x50 159 #define IEEE80211_FC0_SUBTYPE_CFPOLL 0x60 160 #define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK 0x70 161 #define IEEE80211_FC0_SUBTYPE_QOS 0x80 162 #define IEEE80211_FC0_SUBTYPE_QOS_CFACK 0x90 163 #define IEEE80211_FC0_SUBTYPE_QOS_CFPOLL 0xa0 164 #define IEEE80211_FC0_SUBTYPE_QOS_CFACKPOLL 0xb0 165 #define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0 166 167 #define IEEE80211_IS_MGMT(wh) \ 168 (!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK) \ 169 == IEEE80211_FC0_TYPE_MGT)) 170 #define IEEE80211_IS_CTL(wh) \ 171 (!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK) \ 172 == IEEE80211_FC0_TYPE_CTL)) 173 #define IEEE80211_IS_DATA(wh) \ 174 (!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK) \ 175 == IEEE80211_FC0_TYPE_DATA)) 176 177 #define IEEE80211_FC0_QOSDATA \ 178 (IEEE80211_FC0_TYPE_DATA|IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_VERSION_0) 179 180 #define IEEE80211_IS_QOSDATA(wh) \ 181 ((wh)->i_fc[0] == IEEE80211_FC0_QOSDATA) 182 183 #define IEEE80211_FC1_DIR_MASK 0x03 184 #define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */ 185 #define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */ 186 #define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */ 187 #define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */ 188 189 #define IEEE80211_IS_DSTODS(wh) \ 190 (((wh)->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS) 191 192 #define IEEE80211_FC1_MORE_FRAG 0x04 193 #define IEEE80211_FC1_RETRY 0x08 194 #define IEEE80211_FC1_PWR_MGT 0x10 195 #define IEEE80211_FC1_MORE_DATA 0x20 196 #define IEEE80211_FC1_PROTECTED 0x40 197 #define IEEE80211_FC1_ORDER 0x80 198 199 #define IEEE80211_IS_PROTECTED(wh) \ 200 ((wh)->i_fc[1] & IEEE80211_FC1_PROTECTED) 201 202 #define IEEE80211_HAS_SEQ(type, subtype) \ 203 ((type) != IEEE80211_FC0_TYPE_CTL && \ 204 !((type) == IEEE80211_FC0_TYPE_DATA && \ 205 ((subtype) & IEEE80211_FC0_SUBTYPE_QOS_NULL) == \ 206 IEEE80211_FC0_SUBTYPE_QOS_NULL)) 207 #define IEEE80211_SEQ_FRAG_MASK 0x000f 208 #define IEEE80211_SEQ_FRAG_SHIFT 0 209 #define IEEE80211_SEQ_SEQ_MASK 0xfff0 210 #define IEEE80211_SEQ_SEQ_SHIFT 4 211 #define IEEE80211_SEQ_RANGE 4096 212 213 #define IEEE80211_SEQ_ADD(seq, incr) \ 214 (((seq) + (incr)) & (IEEE80211_SEQ_RANGE-1)) 215 #define IEEE80211_SEQ_INC(seq) IEEE80211_SEQ_ADD(seq,1) 216 #define IEEE80211_SEQ_SUB(a, b) \ 217 (((a) + IEEE80211_SEQ_RANGE - (b)) & (IEEE80211_SEQ_RANGE-1)) 218 219 #define IEEE80211_SEQ_BA_RANGE 2048 /* 2^11 */ 220 #define IEEE80211_SEQ_BA_BEFORE(a, b) \ 221 (IEEE80211_SEQ_SUB(b, a+1) < IEEE80211_SEQ_BA_RANGE-1) 222 223 #define IEEE80211_NWID_LEN 32 224 #define IEEE80211_MESHID_LEN 32 225 226 #define IEEE80211_QOS_CTL_LEN 2 227 228 #define IEEE80211_QOS_TXOP 0x00ff 229 /* bit 8 is reserved */ 230 #define IEEE80211_QOS_AMSDU 0x80 231 #define IEEE80211_QOS_AMSDU_S 7 232 #define IEEE80211_QOS_ACKPOLICY 0x60 233 #define IEEE80211_QOS_ACKPOLICY_S 5 234 #define IEEE80211_QOS_ACKPOLICY_NOACK 0x20 /* No ACK required */ 235 #define IEEE80211_QOS_ACKPOLICY_BA 0x60 /* Block ACK */ 236 #define IEEE80211_QOS_EOSP 0x10 /* EndOfService Period*/ 237 #define IEEE80211_QOS_EOSP_S 4 238 #define IEEE80211_QOS_TID 0x0f 239 /* qos[1] byte used for all frames sent by mesh STAs in a mesh BSS */ 240 #define IEEE80211_QOS_MC 0x01 /* Mesh control */ 241 /* Mesh power save level*/ 242 #define IEEE80211_QOS_MESH_PSL 0x02 243 /* Mesh Receiver Service Period Initiated */ 244 #define IEEE80211_QOS_RSPI 0x04 245 /* bits 11 to 15 reserved */ 246 247 /* does frame have QoS sequence control data */ 248 #define IEEE80211_QOS_HAS_SEQ(wh) \ 249 (((wh)->i_fc[0] & \ 250 (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == \ 251 (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS)) 252 253 /* 254 * WME/802.11e information element. 255 */ 256 struct ieee80211_wme_info { 257 uint8_t wme_id; /* IEEE80211_ELEMID_VENDOR */ 258 uint8_t wme_len; /* length in bytes */ 259 uint8_t wme_oui[3]; /* 0x00, 0x50, 0xf2 */ 260 uint8_t wme_type; /* OUI type */ 261 uint8_t wme_subtype; /* OUI subtype */ 262 uint8_t wme_version; /* spec revision */ 263 uint8_t wme_info; /* QoS info */ 264 } __packed; 265 266 /* 267 * WME/802.11e Tspec Element 268 */ 269 struct ieee80211_wme_tspec { 270 uint8_t ts_id; 271 uint8_t ts_len; 272 uint8_t ts_oui[3]; 273 uint8_t ts_oui_type; 274 uint8_t ts_oui_subtype; 275 uint8_t ts_version; 276 uint8_t ts_tsinfo[3]; 277 uint8_t ts_nom_msdu[2]; 278 uint8_t ts_max_msdu[2]; 279 uint8_t ts_min_svc[4]; 280 uint8_t ts_max_svc[4]; 281 uint8_t ts_inactv_intv[4]; 282 uint8_t ts_susp_intv[4]; 283 uint8_t ts_start_svc[4]; 284 uint8_t ts_min_rate[4]; 285 uint8_t ts_mean_rate[4]; 286 uint8_t ts_max_burst[4]; 287 uint8_t ts_min_phy[4]; 288 uint8_t ts_peak_rate[4]; 289 uint8_t ts_delay[4]; 290 uint8_t ts_surplus[2]; 291 uint8_t ts_medium_time[2]; 292 } __packed; 293 294 /* 295 * WME AC parameter field 296 */ 297 struct ieee80211_wme_acparams { 298 uint8_t acp_aci_aifsn; 299 uint8_t acp_logcwminmax; 300 uint16_t acp_txop; 301 } __packed; 302 303 #define WME_NUM_AC 4 /* 4 AC categories */ 304 #define WME_NUM_TID 16 /* 16 tids */ 305 306 #define WME_PARAM_ACI 0x60 /* Mask for ACI field */ 307 #define WME_PARAM_ACI_S 5 /* Shift for ACI field */ 308 #define WME_PARAM_ACM 0x10 /* Mask for ACM bit */ 309 #define WME_PARAM_ACM_S 4 /* Shift for ACM bit */ 310 #define WME_PARAM_AIFSN 0x0f /* Mask for aifsn field */ 311 #define WME_PARAM_AIFSN_S 0 /* Shift for aifsn field */ 312 #define WME_PARAM_LOGCWMIN 0x0f /* Mask for CwMin field (in log) */ 313 #define WME_PARAM_LOGCWMIN_S 0 /* Shift for CwMin field */ 314 #define WME_PARAM_LOGCWMAX 0xf0 /* Mask for CwMax field (in log) */ 315 #define WME_PARAM_LOGCWMAX_S 4 /* Shift for CwMax field */ 316 317 #define WME_AC_TO_TID(_ac) ( \ 318 ((_ac) == WME_AC_VO) ? 6 : \ 319 ((_ac) == WME_AC_VI) ? 5 : \ 320 ((_ac) == WME_AC_BK) ? 1 : \ 321 0) 322 323 #define TID_TO_WME_AC(_tid) ( \ 324 ((_tid) == 0 || (_tid) == 3) ? WME_AC_BE : \ 325 ((_tid) < 3) ? WME_AC_BK : \ 326 ((_tid) < 6) ? WME_AC_VI : \ 327 WME_AC_VO) 328 329 /* 330 * WME Parameter Element 331 */ 332 struct ieee80211_wme_param { 333 uint8_t param_id; 334 uint8_t param_len; 335 uint8_t param_oui[3]; 336 uint8_t param_oui_type; 337 uint8_t param_oui_subtype; 338 uint8_t param_version; 339 uint8_t param_qosInfo; 340 #define WME_QOSINFO_COUNT 0x0f /* Mask for param count field */ 341 uint8_t param_reserved; 342 struct ieee80211_wme_acparams params_acParams[WME_NUM_AC]; 343 } __packed; 344 345 /* 346 * WME U-APSD qos info field defines 347 */ 348 #define WME_CAPINFO_UAPSD_EN 0x00000080 349 #define WME_CAPINFO_UAPSD_VO 0x00000001 350 #define WME_CAPINFO_UAPSD_VI 0x00000002 351 #define WME_CAPINFO_UAPSD_BK 0x00000004 352 #define WME_CAPINFO_UAPSD_BE 0x00000008 353 #define WME_CAPINFO_UAPSD_ACFLAGS_SHIFT 0 354 #define WME_CAPINFO_UAPSD_ACFLAGS_MASK 0xF 355 #define WME_CAPINFO_UAPSD_MAXSP_SHIFT 5 356 #define WME_CAPINFO_UAPSD_MAXSP_MASK 0x3 357 #define WME_CAPINFO_IE_OFFSET 8 358 #define WME_UAPSD_MAXSP(_qosinfo) \ 359 (((_qosinfo) >> WME_CAPINFO_UAPSD_MAXSP_SHIFT) & \ 360 WME_CAPINFO_UAPSD_MAXSP_MASK) 361 #define WME_UAPSD_AC_ENABLED(_ac, _qosinfo) \ 362 ((1 << (3 - (_ac))) & ( \ 363 ((_qosinfo) >> WME_CAPINFO_UAPSD_ACFLAGS_SHIFT) & \ 364 WME_CAPINFO_UAPSD_ACFLAGS_MASK)) 365 366 /* 367 * Management Notification Frame 368 */ 369 struct ieee80211_mnf { 370 uint8_t mnf_category; 371 uint8_t mnf_action; 372 uint8_t mnf_dialog; 373 uint8_t mnf_status; 374 } __packed; 375 #define MNF_SETUP_REQ 0 376 #define MNF_SETUP_RESP 1 377 #define MNF_TEARDOWN 2 378 379 /* 380 * 802.11n Management Action Frames 381 */ 382 /* generic frame format */ 383 struct ieee80211_action { 384 uint8_t ia_category; 385 uint8_t ia_action; 386 } __packed; 387 388 #define IEEE80211_ACTION_CAT_SM 0 /* Spectrum Management */ 389 #define IEEE80211_ACTION_CAT_QOS 1 /* QoS */ 390 #define IEEE80211_ACTION_CAT_DLS 2 /* DLS */ 391 #define IEEE80211_ACTION_CAT_BA 3 /* BA */ 392 #define IEEE80211_ACTION_CAT_HT 7 /* HT */ 393 #define IEEE80211_ACTION_CAT_MESH 13 /* Mesh */ 394 #define IEEE80211_ACTION_CAT_SELF_PROT 15 /* Self-protected */ 395 /* 16 - 125 reserved */ 396 #define IEEE80211_ACTION_CAT_VHT 21 397 #define IEEE80211_ACTION_CAT_VENDOR 127 /* Vendor Specific */ 398 399 #define IEEE80211_ACTION_HT_TXCHWIDTH 0 /* recommended xmit chan width*/ 400 #define IEEE80211_ACTION_HT_MIMOPWRSAVE 1 /* MIMO power save */ 401 402 /* HT - recommended transmission channel width */ 403 struct ieee80211_action_ht_txchwidth { 404 struct ieee80211_action at_header; 405 uint8_t at_chwidth; 406 } __packed; 407 408 #define IEEE80211_A_HT_TXCHWIDTH_20 0 409 #define IEEE80211_A_HT_TXCHWIDTH_2040 1 410 411 /* HT - MIMO Power Save (NB: D2.04) */ 412 struct ieee80211_action_ht_mimopowersave { 413 struct ieee80211_action am_header; 414 uint8_t am_control; 415 } __packed; 416 417 #define IEEE80211_A_HT_MIMOPWRSAVE_ENA 0x01 /* PS enabled */ 418 #define IEEE80211_A_HT_MIMOPWRSAVE_MODE 0x02 419 #define IEEE80211_A_HT_MIMOPWRSAVE_MODE_S 1 420 #define IEEE80211_A_HT_MIMOPWRSAVE_DYNAMIC 0x02 /* Dynamic Mode */ 421 #define IEEE80211_A_HT_MIMOPWRSAVE_STATIC 0x00 /* no SM packets */ 422 /* bits 2-7 reserved */ 423 424 /* Block Ack actions */ 425 #define IEEE80211_ACTION_BA_ADDBA_REQUEST 0 /* ADDBA request */ 426 #define IEEE80211_ACTION_BA_ADDBA_RESPONSE 1 /* ADDBA response */ 427 #define IEEE80211_ACTION_BA_DELBA 2 /* DELBA */ 428 429 /* Block Ack Parameter Set */ 430 #define IEEE80211_BAPS_BUFSIZ 0xffc0 /* buffer size */ 431 #define IEEE80211_BAPS_BUFSIZ_S 6 432 #define IEEE80211_BAPS_TID 0x003c /* TID */ 433 #define IEEE80211_BAPS_TID_S 2 434 #define IEEE80211_BAPS_POLICY 0x0002 /* block ack policy */ 435 #define IEEE80211_BAPS_POLICY_S 1 436 #define IEEE80211_BAPS_AMSDU 0x0001 /* A-MSDU permitted */ 437 #define IEEE80211_BAPS_AMSDU_S 0 438 439 #define IEEE80211_BAPS_POLICY_DELAYED (0<<IEEE80211_BAPS_POLICY_S) 440 #define IEEE80211_BAPS_POLICY_IMMEDIATE (1<<IEEE80211_BAPS_POLICY_S) 441 442 /* Block Ack Sequence Control */ 443 #define IEEE80211_BASEQ_START 0xfff0 /* starting seqnum */ 444 #define IEEE80211_BASEQ_START_S 4 445 #define IEEE80211_BASEQ_FRAG 0x000f /* fragment number */ 446 #define IEEE80211_BASEQ_FRAG_S 0 447 448 /* Delayed Block Ack Parameter Set */ 449 #define IEEE80211_DELBAPS_TID 0xf000 /* TID */ 450 #define IEEE80211_DELBAPS_TID_S 12 451 #define IEEE80211_DELBAPS_INIT 0x0800 /* initiator */ 452 #define IEEE80211_DELBAPS_INIT_S 11 453 454 /* BA - ADDBA request */ 455 struct ieee80211_action_ba_addbarequest { 456 struct ieee80211_action rq_header; 457 uint8_t rq_dialogtoken; 458 uint16_t rq_baparamset; 459 uint16_t rq_batimeout; /* in TUs */ 460 uint16_t rq_baseqctl; 461 } __packed; 462 463 /* BA - ADDBA response */ 464 struct ieee80211_action_ba_addbaresponse { 465 struct ieee80211_action rs_header; 466 uint8_t rs_dialogtoken; 467 uint16_t rs_statuscode; 468 uint16_t rs_baparamset; 469 uint16_t rs_batimeout; /* in TUs */ 470 } __packed; 471 472 /* BA - DELBA */ 473 struct ieee80211_action_ba_delba { 474 struct ieee80211_action dl_header; 475 uint16_t dl_baparamset; 476 uint16_t dl_reasoncode; 477 } __packed; 478 479 /* BAR Control */ 480 #define IEEE80211_BAR_TID 0xf000 /* TID */ 481 #define IEEE80211_BAR_TID_S 12 482 #define IEEE80211_BAR_COMP 0x0004 /* Compressed Bitmap */ 483 #define IEEE80211_BAR_MTID 0x0002 /* Multi-TID */ 484 #define IEEE80211_BAR_NOACK 0x0001 /* No-Ack policy */ 485 486 /* BAR Starting Sequence Control */ 487 #define IEEE80211_BAR_SEQ_START 0xfff0 /* starting seqnum */ 488 #define IEEE80211_BAR_SEQ_START_S 4 489 490 struct ieee80211_ba_request { 491 uint16_t rq_barctl; 492 uint16_t rq_barseqctl; 493 } __packed; 494 495 /* 496 * Control frames. 497 */ 498 struct ieee80211_frame_min { 499 uint8_t i_fc[2]; 500 uint8_t i_dur[2]; 501 uint8_t i_addr1[IEEE80211_ADDR_LEN]; 502 uint8_t i_addr2[IEEE80211_ADDR_LEN]; 503 /* FCS */ 504 } __packed; 505 506 struct ieee80211_frame_rts { 507 uint8_t i_fc[2]; 508 uint8_t i_dur[2]; 509 uint8_t i_ra[IEEE80211_ADDR_LEN]; 510 uint8_t i_ta[IEEE80211_ADDR_LEN]; 511 /* FCS */ 512 } __packed; 513 514 struct ieee80211_frame_cts { 515 uint8_t i_fc[2]; 516 uint8_t i_dur[2]; 517 uint8_t i_ra[IEEE80211_ADDR_LEN]; 518 /* FCS */ 519 } __packed; 520 521 struct ieee80211_frame_ack { 522 uint8_t i_fc[2]; 523 uint8_t i_dur[2]; 524 uint8_t i_ra[IEEE80211_ADDR_LEN]; 525 /* FCS */ 526 } __packed; 527 528 struct ieee80211_frame_pspoll { 529 uint8_t i_fc[2]; 530 uint8_t i_aid[2]; 531 uint8_t i_bssid[IEEE80211_ADDR_LEN]; 532 uint8_t i_ta[IEEE80211_ADDR_LEN]; 533 /* FCS */ 534 } __packed; 535 536 struct ieee80211_frame_cfend { /* NB: also CF-End+CF-Ack */ 537 uint8_t i_fc[2]; 538 uint8_t i_dur[2]; /* should be zero */ 539 uint8_t i_ra[IEEE80211_ADDR_LEN]; 540 uint8_t i_bssid[IEEE80211_ADDR_LEN]; 541 /* FCS */ 542 } __packed; 543 544 struct ieee80211_frame_bar { 545 uint8_t i_fc[2]; 546 uint8_t i_dur[2]; 547 uint8_t i_ra[IEEE80211_ADDR_LEN]; 548 uint8_t i_ta[IEEE80211_ADDR_LEN]; 549 uint16_t i_ctl; 550 uint16_t i_seq; 551 /* FCS */ 552 } __packed; 553 554 /* 555 * BEACON management packets 556 * 557 * octet timestamp[8] 558 * octet beacon interval[2] 559 * octet capability information[2] 560 * information element 561 * octet elemid 562 * octet length 563 * octet information[length] 564 */ 565 566 #define IEEE80211_BEACON_INTERVAL(beacon) \ 567 ((beacon)[8] | ((beacon)[9] << 8)) 568 #define IEEE80211_BEACON_CAPABILITY(beacon) \ 569 ((beacon)[10] | ((beacon)[11] << 8)) 570 571 #define IEEE80211_CAPINFO_ESS 0x0001 572 #define IEEE80211_CAPINFO_IBSS 0x0002 573 #define IEEE80211_CAPINFO_CF_POLLABLE 0x0004 574 #define IEEE80211_CAPINFO_CF_POLLREQ 0x0008 575 #define IEEE80211_CAPINFO_PRIVACY 0x0010 576 #define IEEE80211_CAPINFO_SHORT_PREAMBLE 0x0020 577 #define IEEE80211_CAPINFO_PBCC 0x0040 578 #define IEEE80211_CAPINFO_CHNL_AGILITY 0x0080 579 #define IEEE80211_CAPINFO_SPECTRUM_MGMT 0x0100 580 /* bit 9 is reserved */ 581 #define IEEE80211_CAPINFO_SHORT_SLOTTIME 0x0400 582 #define IEEE80211_CAPINFO_RSN 0x0800 583 /* bit 12 is reserved */ 584 #define IEEE80211_CAPINFO_DSSSOFDM 0x2000 585 /* bits 14-15 are reserved */ 586 587 #define IEEE80211_CAPINFO_BITS \ 588 "\20\1ESS\2IBSS\3CF_POLLABLE\4CF_POLLREQ\5PRIVACY\6SHORT_PREAMBLE" \ 589 "\7PBCC\10CHNL_AGILITY\11SPECTRUM_MGMT\13SHORT_SLOTTIME\14RSN" \ 590 "\16DSSOFDM" 591 592 /* 593 * 802.11i/WPA information element (maximally sized). 594 */ 595 struct ieee80211_ie_wpa { 596 uint8_t wpa_id; /* IEEE80211_ELEMID_VENDOR */ 597 uint8_t wpa_len; /* length in bytes */ 598 uint8_t wpa_oui[3]; /* 0x00, 0x50, 0xf2 */ 599 uint8_t wpa_type; /* OUI type */ 600 uint16_t wpa_version; /* spec revision */ 601 uint32_t wpa_mcipher[1]; /* multicast/group key cipher */ 602 uint16_t wpa_uciphercnt; /* # pairwise key ciphers */ 603 uint32_t wpa_uciphers[8];/* ciphers */ 604 uint16_t wpa_authselcnt; /* authentication selector cnt*/ 605 uint32_t wpa_authsels[8];/* selectors */ 606 uint16_t wpa_caps; /* 802.11i capabilities */ 607 uint16_t wpa_pmkidcnt; /* 802.11i pmkid count */ 608 uint16_t wpa_pmkids[8]; /* 802.11i pmkids */ 609 } __packed; 610 611 /* 612 * 802.11n HT Capability IE 613 * NB: these reflect D1.10 614 */ 615 struct ieee80211_ie_htcap { 616 uint8_t hc_id; /* element ID */ 617 uint8_t hc_len; /* length in bytes */ 618 uint16_t hc_cap; /* HT caps (see below) */ 619 uint8_t hc_param; /* HT params (see below) */ 620 uint8_t hc_mcsset[16]; /* supported MCS set */ 621 uint16_t hc_extcap; /* extended HT capabilities */ 622 uint32_t hc_txbf; /* txbf capabilities */ 623 uint8_t hc_antenna; /* antenna capabilities */ 624 } __packed; 625 626 /* HT capability flags (ht_cap) */ 627 #define IEEE80211_HTCAP_LDPC 0x0001 /* LDPC rx supported */ 628 #define IEEE80211_HTCAP_CHWIDTH40 0x0002 /* 20/40 supported */ 629 #define IEEE80211_HTCAP_SMPS 0x000c /* SM Power Save mode */ 630 #define IEEE80211_HTCAP_SMPS_OFF 0x000c /* disabled */ 631 #define IEEE80211_HTCAP_SMPS_DYNAMIC 0x0004 /* send RTS first */ 632 /* NB: SMPS value 2 is reserved */ 633 #define IEEE80211_HTCAP_SMPS_ENA 0x0000 /* enabled (static mode) */ 634 #define IEEE80211_HTCAP_GREENFIELD 0x0010 /* Greenfield supported */ 635 #define IEEE80211_HTCAP_SHORTGI20 0x0020 /* Short GI in 20MHz */ 636 #define IEEE80211_HTCAP_SHORTGI40 0x0040 /* Short GI in 40MHz */ 637 #define IEEE80211_HTCAP_TXSTBC 0x0080 /* STBC tx ok */ 638 #define IEEE80211_HTCAP_RXSTBC 0x0300 /* STBC rx support */ 639 #define IEEE80211_HTCAP_RXSTBC_S 8 640 #define IEEE80211_HTCAP_RXSTBC_1STREAM 0x0100 /* 1 spatial stream */ 641 #define IEEE80211_HTCAP_RXSTBC_2STREAM 0x0200 /* 1-2 spatial streams*/ 642 #define IEEE80211_HTCAP_RXSTBC_3STREAM 0x0300 /* 1-3 spatial streams*/ 643 #define IEEE80211_HTCAP_DELBA 0x0400 /* HT DELBA supported */ 644 #define IEEE80211_HTCAP_MAXAMSDU 0x0800 /* max A-MSDU length */ 645 #define IEEE80211_HTCAP_MAXAMSDU_7935 0x0800 /* 7935 octets */ 646 #define IEEE80211_HTCAP_MAXAMSDU_3839 0x0000 /* 3839 octets */ 647 #define IEEE80211_HTCAP_DSSSCCK40 0x1000 /* DSSS/CCK in 40MHz */ 648 #define IEEE80211_HTCAP_PSMP 0x2000 /* PSMP supported */ 649 #define IEEE80211_HTCAP_40INTOLERANT 0x4000 /* 40MHz intolerant */ 650 #define IEEE80211_HTCAP_LSIGTXOPPROT 0x8000 /* L-SIG TXOP prot */ 651 652 #define IEEE80211_HTCAP_BITS \ 653 "\20\1LDPC\2CHWIDTH40\5GREENFIELD\6SHORTGI20\7SHORTGI40\10TXSTBC" \ 654 "\13DELBA\14AMSDU(7935)\15DSSSCCK40\16PSMP\1740INTOLERANT" \ 655 "\20LSIGTXOPPROT" 656 657 /* HT parameters (hc_param) */ 658 #define IEEE80211_HTCAP_MAXRXAMPDU 0x03 /* max rx A-MPDU factor */ 659 #define IEEE80211_HTCAP_MAXRXAMPDU_S 0 660 #define IEEE80211_HTCAP_MAXRXAMPDU_8K 0 661 #define IEEE80211_HTCAP_MAXRXAMPDU_16K 1 662 #define IEEE80211_HTCAP_MAXRXAMPDU_32K 2 663 #define IEEE80211_HTCAP_MAXRXAMPDU_64K 3 664 #define IEEE80211_HTCAP_MPDUDENSITY 0x1c /* min MPDU start spacing */ 665 #define IEEE80211_HTCAP_MPDUDENSITY_S 2 666 #define IEEE80211_HTCAP_MPDUDENSITY_NA 0 /* no time restriction */ 667 #define IEEE80211_HTCAP_MPDUDENSITY_025 1 /* 1/4 us */ 668 #define IEEE80211_HTCAP_MPDUDENSITY_05 2 /* 1/2 us */ 669 #define IEEE80211_HTCAP_MPDUDENSITY_1 3 /* 1 us */ 670 #define IEEE80211_HTCAP_MPDUDENSITY_2 4 /* 2 us */ 671 #define IEEE80211_HTCAP_MPDUDENSITY_4 5 /* 4 us */ 672 #define IEEE80211_HTCAP_MPDUDENSITY_8 6 /* 8 us */ 673 #define IEEE80211_HTCAP_MPDUDENSITY_16 7 /* 16 us */ 674 675 /* HT extended capabilities (hc_extcap) */ 676 #define IEEE80211_HTCAP_PCO 0x0001 /* PCO capable */ 677 #define IEEE80211_HTCAP_PCOTRANS 0x0006 /* PCO transition time */ 678 #define IEEE80211_HTCAP_PCOTRANS_S 1 679 #define IEEE80211_HTCAP_PCOTRANS_04 0x0002 /* 400 us */ 680 #define IEEE80211_HTCAP_PCOTRANS_15 0x0004 /* 1.5 ms */ 681 #define IEEE80211_HTCAP_PCOTRANS_5 0x0006 /* 5 ms */ 682 /* bits 3-7 reserved */ 683 #define IEEE80211_HTCAP_MCSFBACK 0x0300 /* MCS feedback */ 684 #define IEEE80211_HTCAP_MCSFBACK_S 8 685 #define IEEE80211_HTCAP_MCSFBACK_NONE 0x0000 /* nothing provided */ 686 #define IEEE80211_HTCAP_MCSFBACK_UNSOL 0x0200 /* unsolicited feedback */ 687 #define IEEE80211_HTCAP_MCSFBACK_MRQ 0x0300 /* " "+respond to MRQ */ 688 #define IEEE80211_HTCAP_HTC 0x0400 /* +HTC support */ 689 #define IEEE80211_HTCAP_RDR 0x0800 /* reverse direction responder*/ 690 /* bits 12-15 reserved */ 691 692 /* 693 * 802.11n HT Information IE 694 */ 695 struct ieee80211_ie_htinfo { 696 uint8_t hi_id; /* element ID */ 697 uint8_t hi_len; /* length in bytes */ 698 uint8_t hi_ctrlchannel; /* primary channel */ 699 uint8_t hi_byte1; /* ht ie byte 1 */ 700 uint8_t hi_byte2; /* ht ie byte 2 */ 701 uint8_t hi_byte3; /* ht ie byte 3 */ 702 uint16_t hi_byte45; /* ht ie bytes 4+5 */ 703 uint8_t hi_basicmcsset[16]; /* basic MCS set */ 704 } __packed; 705 706 /* byte1 */ 707 #define IEEE80211_HTINFO_2NDCHAN 0x03 /* secondary/ext chan offset */ 708 #define IEEE80211_HTINFO_2NDCHAN_S 0 709 #define IEEE80211_HTINFO_2NDCHAN_NONE 0x00 /* no secondary/ext channel */ 710 #define IEEE80211_HTINFO_2NDCHAN_ABOVE 0x01 /* above private channel */ 711 /* NB: 2 is reserved */ 712 #define IEEE80211_HTINFO_2NDCHAN_BELOW 0x03 /* below primary channel */ 713 #define IEEE80211_HTINFO_TXWIDTH 0x04 /* tx channel width */ 714 #define IEEE80211_HTINFO_TXWIDTH_20 0x00 /* 20MHz width */ 715 #define IEEE80211_HTINFO_TXWIDTH_2040 0x04 /* any supported width */ 716 #define IEEE80211_HTINFO_RIFSMODE 0x08 /* Reduced IFS (RIFS) use */ 717 #define IEEE80211_HTINFO_RIFSMODE_PROH 0x00 /* RIFS use prohibited */ 718 #define IEEE80211_HTINFO_RIFSMODE_PERM 0x08 /* RIFS use permitted */ 719 #define IEEE80211_HTINFO_PMSPONLY 0x10 /* PSMP required to associate */ 720 #define IEEE80211_HTINFO_SIGRAN 0xe0 /* shortest Service Interval */ 721 #define IEEE80211_HTINFO_SIGRAN_S 5 722 #define IEEE80211_HTINFO_SIGRAN_5 0x00 /* 5 ms */ 723 /* XXX add rest */ 724 725 /* bytes 2+3 */ 726 #define IEEE80211_HTINFO_OPMODE 0x03 /* operating mode */ 727 #define IEEE80211_HTINFO_OPMODE_S 0 728 #define IEEE80211_HTINFO_OPMODE_PURE 0x00 /* no protection */ 729 #define IEEE80211_HTINFO_OPMODE_PROTOPT 0x01 /* protection optional */ 730 #define IEEE80211_HTINFO_OPMODE_HT20PR 0x02 /* protection for HT20 sta's */ 731 #define IEEE80211_HTINFO_OPMODE_MIXED 0x03 /* protection for legacy sta's*/ 732 #define IEEE80211_HTINFO_NONGF_PRESENT 0x04 /* non-GF sta's present */ 733 #define IEEE80211_HTINFO_TXBL 0x08 /* transmit burst limit */ 734 #define IEEE80211_HTINFO_NONHT_PRESENT 0x10 /* non-HT sta's present */ 735 /* bits 5-15 reserved */ 736 737 /* bytes 4+5 */ 738 #define IEEE80211_HTINFO_2NDARYBEACON 0x01 739 #define IEEE80211_HTINFO_LSIGTXOPPROT 0x02 740 #define IEEE80211_HTINFO_PCO_ACTIVE 0x04 741 #define IEEE80211_HTINFO_40MHZPHASE 0x08 742 743 /* byte5 */ 744 #define IEEE80211_HTINFO_BASIC_STBCMCS 0x7f 745 #define IEEE80211_HTINFO_BASIC_STBCMCS_S 0 746 #define IEEE80211_HTINFO_DUALPROTECTED 0x80 747 748 /* 749 * 802.11ac definitions - 802.11ac-2013 . 750 */ 751 752 /* 753 * Maximum length of A-MPDU that the STA can RX in VHT. 754 * Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets) 755 */ 756 #define IEEE80211_VHTCAP_MAX_AMPDU_8K 0 757 #define IEEE80211_VHTCAP_MAX_AMPDU_16K 1 758 #define IEEE80211_VHTCAP_MAX_AMPDU_32K 2 759 #define IEEE80211_VHTCAP_MAX_AMPDU_64K 3 760 #define IEEE80211_VHTCAP_MAX_AMPDU_128K 4 761 #define IEEE80211_VHTCAP_MAX_AMPDU_256K 5 762 #define IEEE80211_VHTCAP_MAX_AMPDU_512K 6 763 #define IEEE80211_VHTCAP_MAX_AMPDU_1024K 7 764 765 /* 766 * VHT MCS information. 767 * + rx_highest/tx_highest: optional; maximum long GI VHT PPDU 768 * data rate. 1Mbit/sec units. 769 * + rx_mcs_map/tx_mcs_map: bitmap of per-stream supported MCS; 770 * 2 bits each. 771 */ 772 773 /* 802.11ac-2013, 8.4.2.160.3 Supported VHT-MCS and NSS Set field */ 774 enum ieee80211_vht_mcs_support { 775 IEEE80211_VHT_MCS_SUPPORT_0_7 = 0, /* MCS0-7 */ 776 IEEE80211_VHT_MCS_SUPPORT_0_8 = 1, /* MCS0-8 */ 777 IEEE80211_VHT_MCS_SUPPORT_0_9 = 2, /* MCS0-9 */ 778 IEEE80211_VHT_MCS_NOT_SUPPORTED = 3 /* not supported */ 779 }; 780 781 struct ieee80211_vht_mcs_info { 782 uint16_t rx_mcs_map; 783 uint16_t rx_highest; 784 uint16_t tx_mcs_map; 785 uint16_t tx_highest; 786 } __packed; 787 788 /* VHT capabilities element: 802.11ac-2013 8.4.2.160 */ 789 struct ieee80211_ie_vhtcap { 790 uint8_t ie; 791 uint8_t len; 792 uint32_t vht_cap_info; 793 struct ieee80211_vht_mcs_info supp_mcs; 794 } __packed; 795 796 /* VHT operation mode subfields - 802.11ac-2013 Table 8.183x */ 797 #define IEEE80211_VHT_CHANWIDTH_USE_HT 0 /* Use HT IE for chw */ 798 #define IEEE80211_VHT_CHANWIDTH_80MHZ 1 /* 80MHz */ 799 #define IEEE80211_VHT_CHANWIDTH_160MHZ 2 /* 160MHz */ 800 #define IEEE80211_VHT_CHANWIDTH_80P80MHZ 3 /* 80+80MHz */ 801 802 /* VHT operation IE - 802.11ac-2013 8.4.2.161 */ 803 struct ieee80211_ie_vht_operation { 804 uint8_t ie; 805 uint8_t len; 806 uint8_t chan_width; 807 uint8_t center_freq_seg1_idx; 808 uint8_t center_freq_seg2_idx; 809 uint16_t basic_mcs_set; 810 } __packed; 811 812 /* 802.11ac VHT Capabilities */ 813 #define IEEE80211_VHTCAP_MAX_MPDU_LENGTH_3895 0x00000000 814 #define IEEE80211_VHTCAP_MAX_MPDU_LENGTH_7991 0x00000001 815 #define IEEE80211_VHTCAP_MAX_MPDU_LENGTH_11454 0x00000002 816 #define IEEE80211_VHTCAP_MAX_MPDU_MASK 0x00000003 817 #define IEEE80211_VHTCAP_MAX_MPDU_MASK_S 0 818 819 #define IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK 0x0000000C 820 #define IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK_S 2 821 #define IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_NONE 0 822 #define IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160MHZ 1 823 #define IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160_80P80MHZ 2 824 #define IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_RESERVED 3 825 826 #define IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160MHZ(_vhtcaps) \ 827 (_IEEE80211_MASKSHIFT(_vhtcaps, IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK) >= \ 828 IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160MHZ) 829 #define IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160_80P80MHZ(_vhtcaps) \ 830 (_IEEE80211_MASKSHIFT(_vhtcaps, IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK) == \ 831 IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160_80P80MHZ) 832 833 #define IEEE80211_VHTCAP_RXLDPC 0x00000010 834 #define IEEE80211_VHTCAP_RXLDPC_S 4 835 836 #define IEEE80211_VHTCAP_SHORT_GI_80 0x00000020 837 #define IEEE80211_VHTCAP_SHORT_GI_80_S 5 838 839 #define IEEE80211_VHTCAP_SHORT_GI_160 0x00000040 840 #define IEEE80211_VHTCAP_SHORT_GI_160_S 6 841 842 #define IEEE80211_VHTCAP_TXSTBC 0x00000080 843 #define IEEE80211_VHTCAP_TXSTBC_S 7 844 845 #define IEEE80211_VHTCAP_RXSTBC_1 0x00000100 846 #define IEEE80211_VHTCAP_RXSTBC_2 0x00000200 847 #define IEEE80211_VHTCAP_RXSTBC_3 0x00000300 848 #define IEEE80211_VHTCAP_RXSTBC_4 0x00000400 849 #define IEEE80211_VHTCAP_RXSTBC_MASK 0x00000700 850 #define IEEE80211_VHTCAP_RXSTBC_MASK_S 8 851 852 #define IEEE80211_VHTCAP_SU_BEAMFORMER_CAPABLE 0x00000800 853 #define IEEE80211_VHTCAP_SU_BEAMFORMER_CAPABLE_S 11 854 855 #define IEEE80211_VHTCAP_SU_BEAMFORMEE_CAPABLE 0x00001000 856 #define IEEE80211_VHTCAP_SU_BEAMFORMEE_CAPABLE_S 12 857 858 #define IEEE80211_VHTCAP_BEAMFORMEE_STS_SHIFT 13 859 #define IEEE80211_VHTCAP_BEAMFORMEE_STS_MASK \ 860 (7 << IEEE80211_VHTCAP_BEAMFORMEE_STS_SHIFT) 861 #define IEEE80211_VHTCAP_BEAMFORMEE_STS_MASK_S 13 862 863 #define IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT 16 864 #define IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_MASK \ 865 (7 << IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT) 866 #define IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_MASK_S 16 867 868 #define IEEE80211_VHTCAP_MU_BEAMFORMER_CAPABLE 0x00080000 869 #define IEEE80211_VHTCAP_MU_BEAMFORMER_CAPABLE_S 19 870 #define IEEE80211_VHTCAP_MU_BEAMFORMEE_CAPABLE 0x00100000 871 #define IEEE80211_VHTCAP_MU_BEAMFORMEE_CAPABLE_S 20 872 #define IEEE80211_VHTCAP_VHT_TXOP_PS 0x00200000 873 #define IEEE80211_VHTCAP_VHT_TXOP_PS_S 21 874 #define IEEE80211_VHTCAP_HTC_VHT 0x00400000 875 #define IEEE80211_VHTCAP_HTC_VHT_S 22 876 877 #define IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT 23 878 #define IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \ 879 (7 << IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT) 880 #define IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_S 23 881 882 #define IEEE80211_VHTCAP_VHT_LINK_ADAPTATION_VHT_MASK 0x0c000000 883 #define IEEE80211_VHTCAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB 0x08000000 884 #define IEEE80211_VHTCAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB 0x0c000000 885 #define IEEE80211_VHTCAP_VHT_LINK_ADAPTATION_VHT_MASK_S 26 886 887 #define IEEE80211_VHTCAP_RX_ANTENNA_PATTERN 0x10000000 888 #define IEEE80211_VHTCAP_RX_ANTENNA_PATTERN_S 28 889 #define IEEE80211_VHTCAP_TX_ANTENNA_PATTERN 0x20000000 890 #define IEEE80211_VHTCAP_TX_ANTENNA_PATTERN_S 29 891 892 /* 893 * XXX TODO: add the rest of the bits 894 */ 895 #define IEEE80211_VHTCAP_BITS \ 896 "\20\1MPDU7991\2MPDU11454\3CHAN160\4CHAN8080\5RXLDPC\6SHORTGI80" \ 897 "\7SHORTGI160\10RXSTBC1\11RXSTBC2\12RXSTBC3\13RXSTBC4\14BFERCAP" \ 898 "\15BFEECAP\27VHT\37RXANTPTN\40TXANTPTN" 899 900 /* 901 * VHT Transmit Power Envelope element - 802.11ac-2013 8.4.2.164 902 * 903 * This defines the maximum transmit power for various bandwidths. 904 */ 905 /* 906 * Count is how many elements follow and what they're for: 907 * 908 * 0 - 20 MHz 909 * 1 - 20+40 MHz 910 * 2 - 20+40+80 MHz 911 * 3 - 20+40+80+(160, 80+80) MHz 912 */ 913 #define IEEE80211_VHT_TXPWRENV_INFO_COUNT_SHIFT 0 914 #define IEEE80211_VHT_TXPWRENV_INFO_COUNT_MASK 0x07 915 916 /* 917 * Unit is the tx power representation. It should be EIRP for now; 918 * other values are reserved. 919 */ 920 #define IEEE80211_VHT_TXPWRENV_UNIT_MASK 0x38 921 #define IEEE80211_VHT_TXPWRENV_UNIT_SHIFT 3 922 923 /* This value is within the unit mask/shift above */ 924 #define IEEE80211_VHT_TXPWRENV_UNIT_EIRP 0 925 926 struct ieee80211_ie_vht_txpwrenv { 927 uint8_t ie; 928 uint8_t len; 929 uint8_t tx_info; 930 int8_t tx_elem[0]; /* TX power elements, 1/2 dB, signed */ 931 }; 932 933 /* VHT action codes */ 934 #define WLAN_ACTION_VHT_COMPRESSED_BF 0 935 #define WLAN_ACTION_VHT_GROUPID_MGMT 1 936 #define WLAN_ACTION_VHT_OPMODE_NOTIF 2 937 938 /* 939 * Management information element payloads. 940 */ 941 942 enum { 943 IEEE80211_ELEMID_SSID = 0, 944 IEEE80211_ELEMID_RATES = 1, 945 IEEE80211_ELEMID_FHPARMS = 2, 946 IEEE80211_ELEMID_DSPARMS = 3, 947 IEEE80211_ELEMID_CFPARMS = 4, 948 IEEE80211_ELEMID_TIM = 5, 949 IEEE80211_ELEMID_IBSSPARMS = 6, 950 IEEE80211_ELEMID_COUNTRY = 7, 951 IEEE80211_ELEMID_BSSLOAD = 11, 952 IEEE80211_ELEMID_TSPEC = 13, 953 IEEE80211_ELEMID_TCLAS = 14, 954 IEEE80211_ELEMID_CHALLENGE = 16, 955 /* 17-31 reserved for challenge text extension */ 956 IEEE80211_ELEMID_PWRCNSTR = 32, 957 IEEE80211_ELEMID_PWRCAP = 33, 958 IEEE80211_ELEMID_TPCREQ = 34, 959 IEEE80211_ELEMID_TPCREP = 35, 960 IEEE80211_ELEMID_SUPPCHAN = 36, 961 IEEE80211_ELEMID_CSA = 37, 962 IEEE80211_ELEMID_MEASREQ = 38, 963 IEEE80211_ELEMID_MEASREP = 39, 964 IEEE80211_ELEMID_QUIET = 40, 965 IEEE80211_ELEMID_IBSSDFS = 41, 966 IEEE80211_ELEMID_ERP = 42, 967 IEEE80211_ELEMID_HTCAP = 45, 968 IEEE80211_ELEMID_QOS = 46, 969 IEEE80211_ELEMID_RESERVED_47 = 47, 970 IEEE80211_ELEMID_RSN = 48, 971 IEEE80211_ELEMID_XRATES = 50, 972 IEEE80211_ELEMID_APCHANREP = 51, 973 IEEE80211_ELEMID_MOBILITY_DOMAIN = 54, 974 IEEE80211_ELEMID_HTINFO = 61, 975 IEEE80211_ELEMID_SECCHAN_OFFSET = 62, 976 IEEE80211_ELEMID_RRM_ENACAPS = 70, 977 IEEE80211_ELEMID_MULTIBSSID = 71, 978 IEEE80211_ELEMID_COEX_2040 = 72, 979 IEEE80211_ELEMID_INTOL_CHN_REPORT = 73, 980 IEEE80211_ELEMID_OVERLAP_BSS_SCAN_PARAM = 74, 981 IEEE80211_ELEMID_TSF_REQ = 91, 982 IEEE80211_ELEMID_TSF_RESP = 92, 983 IEEE80211_ELEMID_WNM_SLEEP_MODE = 93, 984 IEEE80211_ELEMID_TIM_BCAST_REQ = 94, 985 IEEE80211_ELEMID_TIM_BCAST_RESP = 95, 986 IEEE80211_ELEMID_TPC = 150, 987 IEEE80211_ELEMID_CCKM = 156, 988 IEEE80211_ELEMID_VENDOR = 221, /* vendor private */ 989 990 /* 991 * 802.11s IEs 992 * NB: On vanilla Linux still IEEE80211_ELEMID_MESHPEER = 55, 993 * but they defined a new with id 117 called PEER_MGMT. 994 * NB: complies with open80211 995 */ 996 IEEE80211_ELEMID_MESHCONF = 113, 997 IEEE80211_ELEMID_MESHID = 114, 998 IEEE80211_ELEMID_MESHLINK = 115, 999 IEEE80211_ELEMID_MESHCNGST = 116, 1000 IEEE80211_ELEMID_MESHPEER = 117, 1001 IEEE80211_ELEMID_MESHCSA = 118, 1002 IEEE80211_ELEMID_MESHTIM = 39, /* XXX: remove */ 1003 IEEE80211_ELEMID_MESHAWAKEW = 119, 1004 IEEE80211_ELEMID_MESHBEACONT = 120, 1005 /* 121-124 MMCAOP not implemented yet */ 1006 IEEE80211_ELEMID_MESHGANN = 125, 1007 IEEE80211_ELEMID_MESHRANN = 126, 1008 /* 127 Extended Capabilities */ 1009 IEEE80211_ELEMID_EXTCAP = 127, 1010 /* 128-129 reserved */ 1011 IEEE80211_ELEMID_MESHPREQ = 130, 1012 IEEE80211_ELEMID_MESHPREP = 131, 1013 IEEE80211_ELEMID_MESHPERR = 132, 1014 /* 133-136 reserved */ 1015 IEEE80211_ELEMID_MESHPXU = 137, 1016 IEEE80211_ELEMID_MESHPXUC = 138, 1017 IEEE80211_ELEMID_MESHAH = 60, /* XXX: remove */ 1018 1019 /* 802.11ac-2013, Table 8-54-Element IDs */ 1020 IEEE80211_ELEMID_VHT_CAP = 191, 1021 IEEE80211_ELEMID_VHT_OPMODE = 192, 1022 IEEE80211_ELEMID_EXTENDED_BSS_LOAD = 193, 1023 IEEE80211_ELEMID_WIDE_BW_CHANNEL_SWITCH = 194, 1024 IEEE80211_ELEMID_VHT_PWR_ENV = 195, 1025 IEEE80211_ELEMID_CHANNEL_SWITCH_WRAPPER = 196, 1026 IEEE80211_ELEMID_AID = 197, 1027 IEEE80211_ELEMID_QUIET_CHANNEL = 198, 1028 IEEE80211_ELEMID_OPMODE_NOTIF = 199, 1029 }; 1030 1031 struct ieee80211_tim_ie { 1032 uint8_t tim_ie; /* IEEE80211_ELEMID_TIM */ 1033 uint8_t tim_len; 1034 uint8_t tim_count; /* DTIM count */ 1035 uint8_t tim_period; /* DTIM period */ 1036 uint8_t tim_bitctl; /* bitmap control */ 1037 uint8_t tim_bitmap[1]; /* variable-length bitmap */ 1038 } __packed; 1039 1040 struct ieee80211_country_ie { 1041 uint8_t ie; /* IEEE80211_ELEMID_COUNTRY */ 1042 uint8_t len; 1043 uint8_t cc[3]; /* ISO CC+(I)ndoor/(O)utdoor */ 1044 struct { 1045 uint8_t schan; /* starting channel */ 1046 uint8_t nchan; /* number channels */ 1047 uint8_t maxtxpwr; /* tx power cap */ 1048 } __packed band[1]; /* sub bands (NB: var size) */ 1049 } __packed; 1050 1051 #define IEEE80211_COUNTRY_MAX_BANDS 84 /* max possible bands */ 1052 #define IEEE80211_COUNTRY_MAX_SIZE \ 1053 (sizeof(struct ieee80211_country_ie) + 3*(IEEE80211_COUNTRY_MAX_BANDS-1)) 1054 1055 struct ieee80211_bss_load_ie { 1056 uint8_t ie; 1057 uint8_t len; 1058 uint16_t sta_count; /* station count */ 1059 uint8_t chan_load; /* channel utilization */ 1060 uint8_t aac; /* available admission capacity */ 1061 } __packed; 1062 1063 struct ieee80211_ap_chan_report_ie { 1064 uint8_t ie; 1065 uint8_t len; 1066 uint8_t i_class; /* operating class */ 1067 /* Annex E, E.1 Country information and operating classes */ 1068 uint8_t chan_list[0]; 1069 } __packed; 1070 1071 #define IEEE80211_EXTCAP_CMS (1ULL << 0) /* 20/40 BSS coexistence management support */ 1072 #define IEEE80211_EXTCAP_RSVD_1 (1ULL << 1) 1073 #define IEEE80211_EXTCAP_ECS (1ULL << 2) /* extended channel switching */ 1074 #define IEEE80211_EXTCAP_RSVD_3 (1ULL << 3) 1075 #define IEEE80211_EXTCAP_PSMP_CAP (1ULL << 4) /* PSMP capability */ 1076 #define IEEE80211_EXTCAP_RSVD_5 (1ULL << 5) 1077 #define IEEE80211_EXTCAP_S_PSMP_SUPP (1ULL << 6) 1078 #define IEEE80211_EXTCAP_EVENT (1ULL << 7) 1079 #define IEEE80211_EXTCAP_DIAGNOSTICS (1ULL << 8) 1080 #define IEEE80211_EXTCAP_MCAST_DIAG (1ULL << 9) 1081 #define IEEE80211_EXTCAP_LOC_TRACKING (1ULL << 10) 1082 #define IEEE80211_EXTCAP_FMS (1ULL << 11) 1083 #define IEEE80211_EXTCAP_PROXY_ARP (1ULL << 12) 1084 #define IEEE80211_EXTCAP_CIR (1ULL << 13) /* collocated interference reporting */ 1085 #define IEEE80211_EXTCAP_CIVIC_LOC (1ULL << 14) 1086 #define IEEE80211_EXTCAP_GEOSPATIAL_LOC (1ULL << 15) 1087 #define IEEE80211_EXTCAP_TFS (1ULL << 16) 1088 #define IEEE80211_EXTCAP_WNM_SLEEPMODE (1ULL << 17) 1089 #define IEEE80211_EXTCAP_TIM_BROADCAST (1ULL << 18) 1090 #define IEEE80211_EXTCAP_BSS_TRANSITION (1ULL << 19) 1091 #define IEEE80211_EXTCAP_QOS_TRAF_CAP (1ULL << 20) 1092 #define IEEE80211_EXTCAP_AC_STA_COUNT (1ULL << 21) 1093 #define IEEE80211_EXTCAP_M_BSSID (1ULL << 22) /* multiple BSSID field */ 1094 #define IEEE80211_EXTCAP_TIMING_MEAS (1ULL << 23) 1095 #define IEEE80211_EXTCAP_CHAN_USAGE (1ULL << 24) 1096 #define IEEE80211_EXTCAP_SSID_LIST (1ULL << 25) 1097 #define IEEE80211_EXTCAP_DMS (1ULL << 26) 1098 #define IEEE80211_EXTCAP_UTC_TSF_OFFSET (1ULL << 27) 1099 #define IEEE80211_EXTCAP_TLDS_BUF_STA_SUPP (1ULL << 28) /* TDLS peer U-APSP buffer STA support */ 1100 #define IEEE80211_EXTCAP_TLDS_PPSM_SUPP (1ULL << 29) /* TDLS peer PSM support */ 1101 #define IEEE80211_EXTCAP_TLDS_CH_SW (1ULL << 30) /* TDLS channel switching */ 1102 #define IEEE80211_EXTCAP_INTERWORKING (1ULL << 31) 1103 #define IEEE80211_EXTCAP_QOSMAP (1ULL << 32) 1104 #define IEEE80211_EXTCAP_EBR (1ULL << 33) 1105 #define IEEE80211_EXTCAP_SSPN_IF (1ULL << 34) 1106 #define IEEE80211_EXTCAP_RSVD_35 (1ULL << 35) 1107 #define IEEE80211_EXTCAP_MSGCF_CAP (1ULL << 36) 1108 #define IEEE80211_EXTCAP_TLDS_SUPP (1ULL << 37) 1109 #define IEEE80211_EXTCAP_TLDS_PROHIB (1ULL << 38) 1110 #define IEEE80211_EXTCAP_TLDS_CH_SW_PROHIB (1ULL << 39) /* TDLS channel switching prohibited */ 1111 #define IEEE80211_EXTCAP_RUF (1ULL << 40) /* reject unadmitted frame */ 1112 /* service interval granularity */ 1113 #define IEEE80211_EXTCAP_SIG \ 1114 ((1ULL << 41) | (1ULL << 42) | (1ULL << 43)) 1115 #define IEEE80211_EXTCAP_ID_LOC (1ULL << 44) 1116 #define IEEE80211_EXTCAP_U_APSD_COEX (1ULL << 45) 1117 #define IEEE80211_EXTCAP_WNM_NOTIFICATION (1ULL << 46) 1118 #define IEEE80211_EXTCAP_RSVD_47 (1ULL << 47) 1119 #define IEEE80211_EXTCAP_SSID (1ULL << 48) /* UTF-8 SSID */ 1120 /* bits 49-n are reserved */ 1121 1122 struct ieee80211_extcap_ie { 1123 uint8_t ie; 1124 uint8_t len; 1125 } __packed; 1126 1127 /* 1128 * 802.11h Quiet Time Element. 1129 */ 1130 struct ieee80211_quiet_ie { 1131 uint8_t quiet_ie; /* IEEE80211_ELEMID_QUIET */ 1132 uint8_t len; 1133 uint8_t tbttcount; /* quiet start */ 1134 uint8_t period; /* beacon intervals between quiets */ 1135 uint16_t duration; /* TUs of each quiet*/ 1136 uint16_t offset; /* TUs of from TBTT of quiet start */ 1137 } __packed; 1138 1139 /* 1140 * 802.11h Channel Switch Announcement (CSA). 1141 */ 1142 struct ieee80211_csa_ie { 1143 uint8_t csa_ie; /* IEEE80211_ELEMID_CHANSWITCHANN */ 1144 uint8_t csa_len; 1145 uint8_t csa_mode; /* Channel Switch Mode */ 1146 uint8_t csa_newchan; /* New Channel Number */ 1147 uint8_t csa_count; /* Channel Switch Count */ 1148 } __packed; 1149 1150 /* 1151 * Note the min acceptable CSA count is used to guard against 1152 * malicious CSA injection in station mode. Defining this value 1153 * as other than 0 violates the 11h spec. 1154 */ 1155 #define IEEE80211_CSA_COUNT_MIN 2 1156 #define IEEE80211_CSA_COUNT_MAX 255 1157 1158 /* rate set entries are in .5 Mb/s units, and potentially marked as basic */ 1159 #define IEEE80211_RATE_BASIC 0x80 1160 #define IEEE80211_RATE_VAL 0x7f 1161 #define IEEE80211_RV(v) ((v) & IEEE80211_RATE_VAL) 1162 1163 /* ERP information element flags */ 1164 #define IEEE80211_ERP_NON_ERP_PRESENT 0x01 1165 #define IEEE80211_ERP_USE_PROTECTION 0x02 1166 #define IEEE80211_ERP_LONG_PREAMBLE 0x04 1167 1168 #define IEEE80211_ERP_BITS \ 1169 "\20\1NON_ERP_PRESENT\2USE_PROTECTION\3LONG_PREAMBLE" 1170 1171 #define ATH_OUI 0x7f0300 /* Atheros OUI */ 1172 #define ATH_OUI_TYPE 0x01 /* Atheros protocol ie */ 1173 1174 /* NB: Atheros allocated the OUI for this purpose ~2005 but beware ... */ 1175 #define TDMA_OUI ATH_OUI 1176 #define TDMA_OUI_TYPE 0x02 /* TDMA protocol ie */ 1177 1178 #define BCM_OUI 0x4c9000 /* Broadcom OUI */ 1179 #define BCM_OUI_HTCAP 51 /* pre-draft HTCAP ie */ 1180 #define BCM_OUI_HTINFO 52 /* pre-draft HTINFO ie */ 1181 1182 #define WPA_OUI 0xf25000 1183 #define WPA_OUI_TYPE 0x01 1184 #define WPA_VERSION 1 /* current supported version */ 1185 1186 #define WPA_CSE_NULL 0x00 1187 #define WPA_CSE_WEP40 0x01 1188 #define WPA_CSE_TKIP 0x02 1189 #define WPA_CSE_CCMP 0x04 1190 #define WPA_CSE_WEP104 0x05 1191 1192 #define WPA_ASE_NONE 0x00 1193 #define WPA_ASE_8021X_UNSPEC 0x01 1194 #define WPA_ASE_8021X_PSK 0x02 1195 1196 #define WPS_OUI_TYPE 0x04 1197 1198 #define RSN_OUI 0xac0f00 1199 #define RSN_VERSION 1 /* current supported version */ 1200 1201 #define RSN_CSE_NULL 0x00 1202 #define RSN_CSE_WEP40 0x01 1203 #define RSN_CSE_TKIP 0x02 1204 #define RSN_CSE_WRAP 0x03 1205 #define RSN_CSE_CCMP 0x04 1206 #define RSN_CSE_WEP104 0x05 1207 1208 #define RSN_ASE_NONE 0x00 1209 #define RSN_ASE_8021X_UNSPEC 0x01 1210 #define RSN_ASE_8021X_PSK 0x02 1211 1212 #define RSN_CAP_PREAUTH 0x01 1213 1214 #define WME_OUI 0xf25000 1215 #define WME_OUI_TYPE 0x02 1216 #define WME_INFO_OUI_SUBTYPE 0x00 1217 #define WME_PARAM_OUI_SUBTYPE 0x01 1218 #define WME_VERSION 1 1219 1220 /* WME stream classes */ 1221 #define WME_AC_BE 0 /* best effort */ 1222 #define WME_AC_BK 1 /* background */ 1223 #define WME_AC_VI 2 /* video */ 1224 #define WME_AC_VO 3 /* voice */ 1225 1226 /* 1227 * AUTH management packets 1228 * 1229 * octet algo[2] 1230 * octet seq[2] 1231 * octet status[2] 1232 * octet chal.id 1233 * octet chal.length 1234 * octet chal.text[253] NB: 1-253 bytes 1235 */ 1236 1237 /* challenge length for shared key auth */ 1238 #define IEEE80211_CHALLENGE_LEN 128 1239 1240 #define IEEE80211_AUTH_ALG_OPEN 0x0000 1241 #define IEEE80211_AUTH_ALG_SHARED 0x0001 1242 #define IEEE80211_AUTH_ALG_LEAP 0x0080 1243 1244 enum { 1245 IEEE80211_AUTH_OPEN_REQUEST = 1, 1246 IEEE80211_AUTH_OPEN_RESPONSE = 2, 1247 }; 1248 1249 enum { 1250 IEEE80211_AUTH_SHARED_REQUEST = 1, 1251 IEEE80211_AUTH_SHARED_CHALLENGE = 2, 1252 IEEE80211_AUTH_SHARED_RESPONSE = 3, 1253 IEEE80211_AUTH_SHARED_PASS = 4, 1254 }; 1255 1256 /* 1257 * Reason and status codes. 1258 * 1259 * Reason codes are used in management frames to indicate why an 1260 * action took place (e.g. on disassociation). Status codes are 1261 * used in management frames to indicate the result of an operation. 1262 * 1263 * Unlisted codes are reserved 1264 */ 1265 1266 enum { 1267 IEEE80211_REASON_UNSPECIFIED = 1, 1268 IEEE80211_REASON_AUTH_EXPIRE = 2, 1269 IEEE80211_REASON_AUTH_LEAVE = 3, 1270 IEEE80211_REASON_ASSOC_EXPIRE = 4, 1271 IEEE80211_REASON_ASSOC_TOOMANY = 5, 1272 IEEE80211_REASON_NOT_AUTHED = 6, 1273 IEEE80211_REASON_NOT_ASSOCED = 7, 1274 IEEE80211_REASON_ASSOC_LEAVE = 8, 1275 IEEE80211_REASON_ASSOC_NOT_AUTHED = 9, 1276 IEEE80211_REASON_DISASSOC_PWRCAP_BAD = 10, /* 11h */ 1277 IEEE80211_REASON_DISASSOC_SUPCHAN_BAD = 11, /* 11h */ 1278 IEEE80211_REASON_IE_INVALID = 13, /* 11i */ 1279 IEEE80211_REASON_MIC_FAILURE = 14, /* 11i */ 1280 IEEE80211_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, /* 11i */ 1281 IEEE80211_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16, /* 11i */ 1282 IEEE80211_REASON_IE_IN_4WAY_DIFFERS = 17, /* 11i */ 1283 IEEE80211_REASON_GROUP_CIPHER_INVALID = 18, /* 11i */ 1284 IEEE80211_REASON_PAIRWISE_CIPHER_INVALID= 19, /* 11i */ 1285 IEEE80211_REASON_AKMP_INVALID = 20, /* 11i */ 1286 IEEE80211_REASON_UNSUPP_RSN_IE_VERSION = 21, /* 11i */ 1287 IEEE80211_REASON_INVALID_RSN_IE_CAP = 22, /* 11i */ 1288 IEEE80211_REASON_802_1X_AUTH_FAILED = 23, /* 11i */ 1289 IEEE80211_REASON_CIPHER_SUITE_REJECTED = 24, /* 11i */ 1290 IEEE80211_REASON_UNSPECIFIED_QOS = 32, /* 11e */ 1291 IEEE80211_REASON_INSUFFICIENT_BW = 33, /* 11e */ 1292 IEEE80211_REASON_TOOMANY_FRAMES = 34, /* 11e */ 1293 IEEE80211_REASON_OUTSIDE_TXOP = 35, /* 11e */ 1294 IEEE80211_REASON_LEAVING_QBSS = 36, /* 11e */ 1295 IEEE80211_REASON_BAD_MECHANISM = 37, /* 11e */ 1296 IEEE80211_REASON_SETUP_NEEDED = 38, /* 11e */ 1297 IEEE80211_REASON_TIMEOUT = 39, /* 11e */ 1298 1299 IEEE80211_REASON_PEER_LINK_CANCELED = 52, /* 11s */ 1300 IEEE80211_REASON_MESH_MAX_PEERS = 53, /* 11s */ 1301 IEEE80211_REASON_MESH_CPVIOLATION = 54, /* 11s */ 1302 IEEE80211_REASON_MESH_CLOSE_RCVD = 55, /* 11s */ 1303 IEEE80211_REASON_MESH_MAX_RETRIES = 56, /* 11s */ 1304 IEEE80211_REASON_MESH_CONFIRM_TIMEOUT = 57, /* 11s */ 1305 IEEE80211_REASON_MESH_INVALID_GTK = 58, /* 11s */ 1306 IEEE80211_REASON_MESH_INCONS_PARAMS = 59, /* 11s */ 1307 IEEE80211_REASON_MESH_INVALID_SECURITY = 60, /* 11s */ 1308 IEEE80211_REASON_MESH_PERR_NO_PROXY = 61, /* 11s */ 1309 IEEE80211_REASON_MESH_PERR_NO_FI = 62, /* 11s */ 1310 IEEE80211_REASON_MESH_PERR_DEST_UNREACH = 63, /* 11s */ 1311 IEEE80211_REASON_MESH_MAC_ALRDY_EXISTS_MBSS = 64, /* 11s */ 1312 IEEE80211_REASON_MESH_CHAN_SWITCH_REG = 65, /* 11s */ 1313 IEEE80211_REASON_MESH_CHAN_SWITCH_UNSPEC = 66, /* 11s */ 1314 1315 IEEE80211_STATUS_SUCCESS = 0, 1316 IEEE80211_STATUS_UNSPECIFIED = 1, 1317 IEEE80211_STATUS_CAPINFO = 10, 1318 IEEE80211_STATUS_NOT_ASSOCED = 11, 1319 IEEE80211_STATUS_OTHER = 12, 1320 IEEE80211_STATUS_ALG = 13, 1321 IEEE80211_STATUS_SEQUENCE = 14, 1322 IEEE80211_STATUS_CHALLENGE = 15, 1323 IEEE80211_STATUS_TIMEOUT = 16, 1324 IEEE80211_STATUS_TOOMANY = 17, 1325 IEEE80211_STATUS_BASIC_RATE = 18, 1326 IEEE80211_STATUS_SP_REQUIRED = 19, /* 11b */ 1327 IEEE80211_STATUS_PBCC_REQUIRED = 20, /* 11b */ 1328 IEEE80211_STATUS_CA_REQUIRED = 21, /* 11b */ 1329 IEEE80211_STATUS_SPECMGMT_REQUIRED = 22, /* 11h */ 1330 IEEE80211_STATUS_PWRCAP_REQUIRED = 23, /* 11h */ 1331 IEEE80211_STATUS_SUPCHAN_REQUIRED = 24, /* 11h */ 1332 IEEE80211_STATUS_SHORTSLOT_REQUIRED = 25, /* 11g */ 1333 IEEE80211_STATUS_DSSSOFDM_REQUIRED = 26, /* 11g */ 1334 IEEE80211_STATUS_MISSING_HT_CAPS = 27, /* 11n D3.0 */ 1335 IEEE80211_STATUS_INVALID_IE = 40, /* 11i */ 1336 IEEE80211_STATUS_GROUP_CIPHER_INVALID = 41, /* 11i */ 1337 IEEE80211_STATUS_PAIRWISE_CIPHER_INVALID = 42, /* 11i */ 1338 IEEE80211_STATUS_AKMP_INVALID = 43, /* 11i */ 1339 IEEE80211_STATUS_UNSUPP_RSN_IE_VERSION = 44, /* 11i */ 1340 IEEE80211_STATUS_INVALID_RSN_IE_CAP = 45, /* 11i */ 1341 IEEE80211_STATUS_CIPHER_SUITE_REJECTED = 46, /* 11i */ 1342 }; 1343 1344 #define IEEE80211_WEP_KEYLEN 5 /* 40bit */ 1345 #define IEEE80211_WEP_IVLEN 3 /* 24bit */ 1346 #define IEEE80211_WEP_KIDLEN 1 /* 1 octet */ 1347 #define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */ 1348 #define IEEE80211_WEP_TOTLEN (IEEE80211_WEP_IVLEN + \ 1349 IEEE80211_WEP_KIDLEN + \ 1350 IEEE80211_WEP_CRCLEN) 1351 #define IEEE80211_WEP_NKID 4 /* number of key ids */ 1352 1353 /* 1354 * 802.11i defines an extended IV for use with non-WEP ciphers. 1355 * When the EXTIV bit is set in the key id byte an additional 1356 * 4 bytes immediately follow the IV for TKIP. For CCMP the 1357 * EXTIV bit is likewise set but the 8 bytes represent the 1358 * CCMP header rather than IV+extended-IV. 1359 */ 1360 #define IEEE80211_WEP_EXTIV 0x20 1361 #define IEEE80211_WEP_EXTIVLEN 4 /* extended IV length */ 1362 #define IEEE80211_WEP_MICLEN 8 /* trailing MIC */ 1363 1364 #define IEEE80211_CRC_LEN 4 1365 1366 /* 1367 * Maximum acceptable MTU is: 1368 * IEEE80211_MAX_LEN - WEP overhead - CRC - 1369 * QoS overhead - RSN/WPA overhead 1370 * Min is arbitrarily chosen > IEEE80211_MIN_LEN. The default 1371 * mtu is Ethernet-compatible; it's set by ether_ifattach. 1372 */ 1373 #define IEEE80211_MTU_MAX 2290 1374 #define IEEE80211_MTU_MIN 32 1375 1376 #define IEEE80211_MAX_LEN (2300 + IEEE80211_CRC_LEN + \ 1377 (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN)) 1378 #define IEEE80211_ACK_LEN \ 1379 (sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN) 1380 #define IEEE80211_MIN_LEN \ 1381 (sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN) 1382 1383 /* 1384 * The 802.11 spec says at most 2007 stations may be 1385 * associated at once. For most AP's this is way more 1386 * than is feasible so we use a default of IEEE80211_AID_DEF. 1387 * This number may be overridden by the driver and/or by 1388 * user configuration but may not be less than IEEE80211_AID_MIN 1389 * (see _ieee80211.h for implementation-specific settings). 1390 */ 1391 #define IEEE80211_AID_MAX 2007 1392 1393 #define IEEE80211_AID(b) ((b) &~ 0xc000) 1394 1395 /* 1396 * RTS frame length parameters. The default is specified in 1397 * the 802.11 spec as 512; we treat it as implementation-dependent 1398 * so it's defined in ieee80211_var.h. The max may be wrong 1399 * for jumbo frames. 1400 */ 1401 #define IEEE80211_RTS_MIN 1 1402 #define IEEE80211_RTS_MAX 2346 1403 1404 /* 1405 * TX fragmentation parameters. As above for RTS, we treat 1406 * default as implementation-dependent so define it elsewhere. 1407 */ 1408 #define IEEE80211_FRAG_MIN 256 1409 #define IEEE80211_FRAG_MAX 2346 1410 1411 /* 1412 * Beacon interval (TU's). Min+max come from WiFi requirements. 1413 * As above, we treat default as implementation-dependent so 1414 * define it elsewhere. 1415 */ 1416 #define IEEE80211_BINTVAL_MAX 1000 /* max beacon interval (TU's) */ 1417 #define IEEE80211_BINTVAL_MIN 25 /* min beacon interval (TU's) */ 1418 1419 /* 1420 * DTIM period (beacons). Min+max are not really defined 1421 * by the protocol but we want them publicly visible so 1422 * define them here. 1423 */ 1424 #define IEEE80211_DTIM_MAX 15 /* max DTIM period */ 1425 #define IEEE80211_DTIM_MIN 1 /* min DTIM period */ 1426 1427 /* 1428 * Beacon miss threshold (beacons). As for DTIM, we define 1429 * them here to be publicly visible. Note the max may be 1430 * clamped depending on device capabilities. 1431 */ 1432 #define IEEE80211_HWBMISS_MIN 1 1433 #define IEEE80211_HWBMISS_MAX 255 1434 1435 /* 1436 * 802.11 frame duration definitions. 1437 */ 1438 1439 struct ieee80211_duration { 1440 uint16_t d_rts_dur; 1441 uint16_t d_data_dur; 1442 uint16_t d_plcp_len; 1443 uint8_t d_residue; /* unused octets in time slot */ 1444 }; 1445 1446 /* One Time Unit (TU) is 1Kus = 1024 microseconds. */ 1447 #define IEEE80211_DUR_TU 1024 1448 1449 /* IEEE 802.11b durations for DSSS PHY in microseconds */ 1450 #define IEEE80211_DUR_DS_LONG_PREAMBLE 144 1451 #define IEEE80211_DUR_DS_SHORT_PREAMBLE 72 1452 1453 #define IEEE80211_DUR_DS_SLOW_PLCPHDR 48 1454 #define IEEE80211_DUR_DS_FAST_PLCPHDR 24 1455 #define IEEE80211_DUR_DS_SLOW_ACK 112 1456 #define IEEE80211_DUR_DS_FAST_ACK 56 1457 #define IEEE80211_DUR_DS_SLOW_CTS 112 1458 #define IEEE80211_DUR_DS_FAST_CTS 56 1459 1460 #define IEEE80211_DUR_DS_SLOT 20 1461 #define IEEE80211_DUR_DS_SIFS 10 1462 #define IEEE80211_DUR_DS_PIFS (IEEE80211_DUR_DS_SIFS + IEEE80211_DUR_DS_SLOT) 1463 #define IEEE80211_DUR_DS_DIFS (IEEE80211_DUR_DS_SIFS + \ 1464 2 * IEEE80211_DUR_DS_SLOT) 1465 #define IEEE80211_DUR_DS_EIFS (IEEE80211_DUR_DS_SIFS + \ 1466 IEEE80211_DUR_DS_SLOW_ACK + \ 1467 IEEE80211_DUR_DS_LONG_PREAMBLE + \ 1468 IEEE80211_DUR_DS_SLOW_PLCPHDR + \ 1469 IEEE80211_DUR_DIFS) 1470 1471 #endif /* _NET80211_IEEE80211_H_ */ 1472