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