| 1 | /*	$OpenBSD: ieee80211.h,v 1.66 2026/03/29 21:16:21 kirill Exp $	*/ |
| 2 | /*	$NetBSD: ieee80211.h,v 1.6 2004/04/30 23:51:53 dyoung Exp $	*/ |
| 3 | |
| 4 | /*- |
| 5 | * Copyright (c) 2001 Atsushi Onoe |
| 6 | * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting |
| 7 | * All rights reserved. |
| 8 | * |
| 9 | * Redistribution and use in source and binary forms, with or without |
| 10 | * modification, are permitted provided that the following conditions |
| 11 | * are met: |
| 12 | * 1. Redistributions of source code must retain the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer. |
| 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| 15 | * notice, this list of conditions and the following disclaimer in the |
| 16 | * documentation and/or other materials provided with the distribution. |
| 17 | * |
| 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | */ |
| 29 | #ifndef _NET80211_IEEE80211_H_ |
| 30 | #define _NET80211_IEEE80211_H_ |
| 31 | |
| 32 | /* |
| 33 | * 802.11 protocol definitions. |
| 34 | */ |
| 35 | |
| 36 | #define IEEE80211_ADDR_LEN	6	/* size of 802.11 address */ |
| 37 | /* is 802.11 address multicast/broadcast? */ |
| 38 | #define IEEE80211_IS_MULTICAST(_a)	(*(_a) & 0x01) |
| 39 | |
| 40 | /* |
| 41 | * Generic definitions for IEEE 802.11 frames. |
| 42 | */ |
| 43 | struct ieee80211_frame { |
| 44 | 	u_int8_t	i_fc[2]; |
| 45 | 	u_int8_t	i_dur[2]; |
| 46 | 	u_int8_t	i_addr1[IEEE80211_ADDR_LEN]; |
| 47 | 	u_int8_t	i_addr2[IEEE80211_ADDR_LEN]; |
| 48 | 	u_int8_t	i_addr3[IEEE80211_ADDR_LEN]; |
| 49 | 	u_int8_t	i_seq[2]; |
| 50 | } __packed; |
| 51 | |
| 52 | struct ieee80211_qosframe { |
| 53 | 	u_int8_t	i_fc[2]; |
| 54 | 	u_int8_t	i_dur[2]; |
| 55 | 	u_int8_t	i_addr1[IEEE80211_ADDR_LEN]; |
| 56 | 	u_int8_t	i_addr2[IEEE80211_ADDR_LEN]; |
| 57 | 	u_int8_t	i_addr3[IEEE80211_ADDR_LEN]; |
| 58 | 	u_int8_t	i_seq[2]; |
| 59 | 	u_int8_t	i_qos[2]; |
| 60 | } __packed; |
| 61 | |
| 62 | struct ieee80211_htframe {		/* 11n */ |
| 63 | 	u_int8_t	i_fc[2]; |
| 64 | 	u_int8_t	i_dur[2]; |
| 65 | 	u_int8_t	i_addr1[IEEE80211_ADDR_LEN]; |
| 66 | 	u_int8_t	i_addr2[IEEE80211_ADDR_LEN]; |
| 67 | 	u_int8_t	i_addr3[IEEE80211_ADDR_LEN]; |
| 68 | 	u_int8_t	i_seq[2]; |
| 69 | 	u_int8_t	i_qos[2]; |
| 70 | 	u_int8_t	i_ht[4]; |
| 71 | } __packed; |
| 72 | |
| 73 | struct ieee80211_frame_addr4 { |
| 74 | 	u_int8_t	i_fc[2]; |
| 75 | 	u_int8_t	i_dur[2]; |
| 76 | 	u_int8_t	i_addr1[IEEE80211_ADDR_LEN]; |
| 77 | 	u_int8_t	i_addr2[IEEE80211_ADDR_LEN]; |
| 78 | 	u_int8_t	i_addr3[IEEE80211_ADDR_LEN]; |
| 79 | 	u_int8_t	i_seq[2]; |
| 80 | 	u_int8_t	i_addr4[IEEE80211_ADDR_LEN]; |
| 81 | } __packed; |
| 82 | |
| 83 | struct ieee80211_qosframe_addr4 { |
| 84 | 	u_int8_t	i_fc[2]; |
| 85 | 	u_int8_t	i_dur[2]; |
| 86 | 	u_int8_t	i_addr1[IEEE80211_ADDR_LEN]; |
| 87 | 	u_int8_t	i_addr2[IEEE80211_ADDR_LEN]; |
| 88 | 	u_int8_t	i_addr3[IEEE80211_ADDR_LEN]; |
| 89 | 	u_int8_t	i_seq[2]; |
| 90 | 	u_int8_t	i_addr4[IEEE80211_ADDR_LEN]; |
| 91 | 	u_int8_t	i_qos[2]; |
| 92 | } __packed; |
| 93 | |
| 94 | struct ieee80211_htframe_addr4 {	/* 11n */ |
| 95 | 	u_int8_t	i_fc[2]; |
| 96 | 	u_int8_t	i_dur[2]; |
| 97 | 	u_int8_t	i_addr1[IEEE80211_ADDR_LEN]; |
| 98 | 	u_int8_t	i_addr2[IEEE80211_ADDR_LEN]; |
| 99 | 	u_int8_t	i_addr3[IEEE80211_ADDR_LEN]; |
| 100 | 	u_int8_t	i_seq[2]; |
| 101 | 	u_int8_t	i_addr4[IEEE80211_ADDR_LEN]; |
| 102 | 	u_int8_t	i_qos[2]; |
| 103 | 	u_int8_t	i_ht[4]; |
| 104 | } __packed; |
| 105 | |
| 106 | #define IEEE80211_MAX_FRAME_HDR_LEN	(sizeof(struct ieee80211_htframe_addr4)) |
| 107 | |
| 108 | #define	IEEE80211_FC0_VERSION_MASK		0x03 |
| 109 | #define	IEEE80211_FC0_VERSION_SHIFT		0 |
| 110 | #define	IEEE80211_FC0_VERSION_0			0x00 |
| 111 | #define	IEEE80211_FC0_TYPE_MASK			0x0c |
| 112 | #define	IEEE80211_FC0_TYPE_SHIFT		2 |
| 113 | #define	IEEE80211_FC0_TYPE_MGT			0x00 |
| 114 | #define	IEEE80211_FC0_TYPE_CTL			0x04 |
| 115 | #define	IEEE80211_FC0_TYPE_DATA			0x08 |
| 116 | |
| 117 | #define	IEEE80211_FC0_SUBTYPE_MASK		0xf0 |
| 118 | #define	IEEE80211_FC0_SUBTYPE_SHIFT		4 |
| 119 | /* for TYPE_MGT */ |
| 120 | #define	IEEE80211_FC0_SUBTYPE_ASSOC_REQ		0x00 |
| 121 | #define	IEEE80211_FC0_SUBTYPE_ASSOC_RESP	0x10 |
| 122 | #define	IEEE80211_FC0_SUBTYPE_REASSOC_REQ	0x20 |
| 123 | #define	IEEE80211_FC0_SUBTYPE_REASSOC_RESP	0x30 |
| 124 | #define	IEEE80211_FC0_SUBTYPE_PROBE_REQ		0x40 |
| 125 | #define	IEEE80211_FC0_SUBTYPE_PROBE_RESP	0x50 |
| 126 | #define	IEEE80211_FC0_SUBTYPE_BEACON		0x80 |
| 127 | #define	IEEE80211_FC0_SUBTYPE_ATIM		0x90 |
| 128 | #define	IEEE80211_FC0_SUBTYPE_DISASSOC		0xa0 |
| 129 | #define	IEEE80211_FC0_SUBTYPE_AUTH		0xb0 |
| 130 | #define	IEEE80211_FC0_SUBTYPE_DEAUTH		0xc0 |
| 131 | #define IEEE80211_FC0_SUBTYPE_ACTION		0xd0 |
| 132 | #define IEEE80211_FC0_SUBTYPE_ACTION_NOACK	0xe0	/* 11n */ |
| 133 | /* for TYPE_CTL */ |
| 134 | #define IEEE80211_FC0_SUBTYPE_WRAPPER		0x70	/* 11n */ |
| 135 | #define IEEE80211_FC0_SUBTYPE_BAR		0x80 |
| 136 | #define IEEE80211_FC0_SUBTYPE_BA		0x90 |
| 137 | #define	IEEE80211_FC0_SUBTYPE_PS_POLL		0xa0 |
| 138 | #define	IEEE80211_FC0_SUBTYPE_RTS		0xb0 |
| 139 | #define	IEEE80211_FC0_SUBTYPE_CTS		0xc0 |
| 140 | #define	IEEE80211_FC0_SUBTYPE_ACK		0xd0 |
| 141 | #define	IEEE80211_FC0_SUBTYPE_CF_END		0xe0 |
| 142 | #define	IEEE80211_FC0_SUBTYPE_CF_END_ACK	0xf0 |
| 143 | /* for TYPE_DATA (bit combination) */ |
| 144 | #define	IEEE80211_FC0_SUBTYPE_DATA		0x00 |
| 145 | #define	IEEE80211_FC0_SUBTYPE_DATA_CF_ACK	0x10 |
| 146 | #define	IEEE80211_FC0_SUBTYPE_DATA_CF_POLL	0x20 |
| 147 | #define	IEEE80211_FC0_SUBTYPE_DATA_CF_ACKPOLL	0x30 |
| 148 | #define	IEEE80211_FC0_SUBTYPE_NODATA		0x40 |
| 149 | #define	IEEE80211_FC0_SUBTYPE_NODATA_CF_ACK	0x50 |
| 150 | #define	IEEE80211_FC0_SUBTYPE_NODATA_CF_POLL	0x60 |
| 151 | #define	IEEE80211_FC0_SUBTYPE_NODATA_CF_ACKPOLL	0x70 |
| 152 | #define	IEEE80211_FC0_SUBTYPE_QOS		0x80 |
| 153 | |
| 154 | #define	IEEE80211_FC1_DIR_MASK			0x03 |
| 155 | #define	IEEE80211_FC1_DIR_NODS			0x00	/* STA->STA */ |
| 156 | #define	IEEE80211_FC1_DIR_TODS			0x01	/* STA->AP */ |
| 157 | #define	IEEE80211_FC1_DIR_FROMDS		0x02	/* AP ->STA */ |
| 158 | #define	IEEE80211_FC1_DIR_DSTODS		0x03	/* AP ->AP */ |
| 159 | |
| 160 | #define	IEEE80211_FC1_MORE_FRAG			0x04 |
| 161 | #define	IEEE80211_FC1_RETRY			0x08 |
| 162 | #define	IEEE80211_FC1_PWR_MGT			0x10 |
| 163 | #define	IEEE80211_FC1_MORE_DATA			0x20 |
| 164 | #define	IEEE80211_FC1_PROTECTED			0x40 |
| 165 | #define	IEEE80211_FC1_WEP			0x40	/* pre-RSNA compat */ |
| 166 | #define	IEEE80211_FC1_ORDER			0x80 |
| 167 | #define IEEE80211_FC1_BITS					\ |
| 168 | 	"\20\03MORE_FRAG\04RETRY\05PWR_MGT\06MORE_DATA"		\ |
| 169 | 	"\07PROTECTED\08ORDER" |
| 170 | |
| 171 | /* |
| 172 | * Sequence Control field (see 802.11-2012 8.2.4.4). |
| 173 | */ |
| 174 | #define	IEEE80211_SEQ_FRAG_MASK			0x000f |
| 175 | #define	IEEE80211_SEQ_FRAG_SHIFT		0 |
| 176 | #define	IEEE80211_SEQ_SEQ_MASK			0xfff0 |
| 177 | #define	IEEE80211_SEQ_SEQ_SHIFT			4 |
| 178 | |
| 179 | #define	IEEE80211_NWID_LEN			32 |
| 180 | #define IEEE80211_MMIE_LEN			18	/* 11w */ |
| 181 | |
| 182 | /* |
| 183 | * QoS Control field (see 802.11-2012 8.2.4.5). |
| 184 | */ |
| 185 | #define IEEE80211_QOS_TXOP			0xff00 |
| 186 | #define IEEE80211_QOS_AMSDU			0x0080	/* 11n */ |
| 187 | #define IEEE80211_QOS_ACK_POLICY_NORMAL		0x0000 |
| 188 | #define IEEE80211_QOS_ACK_POLICY_NOACK		0x0020 |
| 189 | #define IEEE80211_QOS_ACK_POLICY_NOEXPLACK	0x0040 |
| 190 | #define IEEE80211_QOS_ACK_POLICY_BA		0x0060 |
| 191 | #define IEEE80211_QOS_ACK_POLICY_MASK		0x0060 |
| 192 | #define IEEE80211_QOS_ACK_POLICY_SHIFT		5 |
| 193 | #define IEEE80211_QOS_EOSP			0x0010 |
| 194 | #define IEEE80211_QOS_TID			0x000f |
| 195 | |
| 196 | /* |
| 197 | * Control frames. |
| 198 | */ |
| 199 | struct ieee80211_frame_min { |
| 200 | 	u_int8_t	i_fc[2]; |
| 201 | 	u_int8_t	i_dur[2]; |
| 202 | 	u_int8_t	i_addr1[IEEE80211_ADDR_LEN]; |
| 203 | 	u_int8_t	i_addr2[IEEE80211_ADDR_LEN]; |
| 204 | 	/* FCS */ |
| 205 | } __packed; |
| 206 | |
| 207 | struct ieee80211_frame_rts { |
| 208 | 	u_int8_t	i_fc[2]; |
| 209 | 	u_int8_t	i_dur[2]; |
| 210 | 	u_int8_t	i_ra[IEEE80211_ADDR_LEN]; |
| 211 | 	u_int8_t	i_ta[IEEE80211_ADDR_LEN]; |
| 212 | 	/* FCS */ |
| 213 | } __packed; |
| 214 | |
| 215 | struct ieee80211_frame_cts { |
| 216 | 	u_int8_t	i_fc[2]; |
| 217 | 	u_int8_t	i_dur[2]; |
| 218 | 	u_int8_t	i_ra[IEEE80211_ADDR_LEN]; |
| 219 | 	/* FCS */ |
| 220 | } __packed; |
| 221 | |
| 222 | struct ieee80211_frame_ack { |
| 223 | 	u_int8_t	i_fc[2]; |
| 224 | 	u_int8_t	i_dur[2]; |
| 225 | 	u_int8_t	i_ra[IEEE80211_ADDR_LEN]; |
| 226 | 	/* FCS */ |
| 227 | } __packed; |
| 228 | |
| 229 | struct ieee80211_frame_pspoll { |
| 230 | 	u_int8_t	i_fc[2]; |
| 231 | 	u_int8_t	i_aid[2]; |
| 232 | 	u_int8_t	i_bssid[IEEE80211_ADDR_LEN]; |
| 233 | 	u_int8_t	i_ta[IEEE80211_ADDR_LEN]; |
| 234 | 	/* FCS */ |
| 235 | } __packed; |
| 236 | |
| 237 | struct ieee80211_frame_cfend {		/* NB: also CF-End+CF-Ack */ |
| 238 | 	u_int8_t	i_fc[2]; |
| 239 | 	u_int8_t	i_dur[2];	/* should be zero */ |
| 240 | 	u_int8_t	i_ra[IEEE80211_ADDR_LEN]; |
| 241 | 	u_int8_t	i_bssid[IEEE80211_ADDR_LEN]; |
| 242 | 	/* FCS */ |
| 243 | } __packed; |
| 244 | |
| 245 | #ifdef _KERNEL |
| 246 | static __inline int |
| 247 | ieee80211_has_seq(const struct ieee80211_frame *wh) |
| 248 | { |
| 249 | 	return (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) != |
| 250 | 	 IEEE80211_FC0_TYPE_CTL; |
| 251 | } |
| 252 | |
| 253 | static __inline int |
| 254 | ieee80211_has_addr4(const struct ieee80211_frame *wh) |
| 255 | { |
| 256 | 	return (wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) == |
| 257 | 	 IEEE80211_FC1_DIR_DSTODS; |
| 258 | } |
| 259 | |
| 260 | static __inline int |
| 261 | ieee80211_has_qos(const struct ieee80211_frame *wh) |
| 262 | { |
| 263 | 	return (wh->i_fc[0] & |
| 264 | 	 (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == |
| 265 | 	 (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS); |
| 266 | } |
| 267 | |
| 268 | static __inline int |
| 269 | ieee80211_has_htc(const struct ieee80211_frame *wh) |
| 270 | { |
| 271 | 	return (wh->i_fc[1] & IEEE80211_FC1_ORDER) && |
| 272 | 	 (ieee80211_has_qos(wh) || |
| 273 | 	 (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == |
| 274 | 	 IEEE80211_FC0_TYPE_MGT); |
| 275 | } |
| 276 | |
| 277 | static __inline u_int16_t |
| 278 | ieee80211_get_qos(const struct ieee80211_frame *wh) |
| 279 | { |
| 280 | 	const u_int8_t *frm; |
| 281 | |
| 282 | 	if (ieee80211_has_addr4(wh)) |
| 283 | 		frm = ((const struct ieee80211_qosframe_addr4 *)wh)->i_qos; |
| 284 | 	else |
| 285 | 		frm = ((const struct ieee80211_qosframe *)wh)->i_qos; |
| 286 | |
| 287 | 	return letoh16(*(const u_int16_t *)frm); |
| 288 | } |
| 289 | #endif	/* _KERNEL */ |
| 290 | |
| 291 | /* |
| 292 | * Capability Information field (see 802.11-2012 8.4.1.4). |
| 293 | */ |
| 294 | #define	IEEE80211_CAPINFO_ESS			0x0001 |
| 295 | #define	IEEE80211_CAPINFO_IBSS			0x0002 |
| 296 | #define	IEEE80211_CAPINFO_CF_POLLABLE		0x0004 |
| 297 | #define	IEEE80211_CAPINFO_CF_POLLREQ		0x0008 |
| 298 | #define	IEEE80211_CAPINFO_PRIVACY		0x0010 |
| 299 | #define	IEEE80211_CAPINFO_SHORT_PREAMBLE	0x0020 |
| 300 | #define	IEEE80211_CAPINFO_PBCC			0x0040 |
| 301 | #define	IEEE80211_CAPINFO_CHNL_AGILITY		0x0080 |
| 302 | #define IEEE80211_CAPINFO_SPECTRUM_MGMT		0x0100 |
| 303 | #define IEEE80211_CAPINFO_QOS			0x0200 |
| 304 | #define	IEEE80211_CAPINFO_SHORT_SLOTTIME	0x0400 |
| 305 | #define	IEEE80211_CAPINFO_APSD			0x0800 |
| 306 | #define	IEEE80211_CAPINFO_RADIO_MEASUREMENT	0x1000 |
| 307 | #define	IEEE80211_CAPINFO_DSSSOFDM		0x2000 |
| 308 | #define IEEE80211_CAPINFO_DELAYED_B_ACK		0x4000 |
| 309 | #define IEEE80211_CAPINFO_IMMEDIATE_B_ACK	0x8000 |
| 310 | #define IEEE80211_CAPINFO_BITS					\ |
| 311 | 	"\10\01ESS\02IBSS\03CF_POLLABLE\04CF_POLLREQ"		\ |
| 312 | 	"\05PRIVACY\06SHORT_PREAMBLE\07PBCC\10CHNL_AGILITY"	\ |
| 313 | 	"\11SPECTRUM_MGMT\12QOS\13SHORT_SLOTTIME\14APSD"	\ |
| 314 | 	"\15RADIO_MEASUREMENT\16DSSSOFDM\17DELAYED_B_ACK\20IMMEDIATE_B_ACK" |
| 315 | |
| 316 | /* |
| 317 | * Information element IDs (see 802.11-2012 Table 8.4.2). |
| 318 | */ |
| 319 | enum { |
| 320 | 	IEEE80211_ELEMID_SSID			= 0, |
| 321 | 	IEEE80211_ELEMID_RATES			= 1, |
| 322 | 	IEEE80211_ELEMID_FHPARMS		= 2, |
| 323 | 	IEEE80211_ELEMID_DSPARMS		= 3, |
| 324 | 	IEEE80211_ELEMID_CFPARMS		= 4, |
| 325 | 	IEEE80211_ELEMID_TIM			= 5, |
| 326 | 	IEEE80211_ELEMID_IBSSPARMS		= 6, |
| 327 | 	IEEE80211_ELEMID_COUNTRY		= 7, |
| 328 | 	IEEE80211_ELEMID_HOPPING_PARMS		= 8, |
| 329 | 	IEEE80211_ELEMID_HOPPING_PATTERN	= 9, |
| 330 | 	IEEE80211_ELEMID_REQUEST		= 10, |
| 331 | 	IEEE80211_ELEMID_QBSS_LOAD		= 11, |
| 332 | 	IEEE80211_ELEMID_EDCAPARMS		= 12, |
| 333 | 	IEEE80211_ELEMID_TSPEC			= 13, |
| 334 | 	IEEE80211_ELEMID_TCLASS			= 14, |
| 335 | 	IEEE80211_ELEMID_SCHEDULE		= 15, |
| 336 | 	IEEE80211_ELEMID_CHALLENGE		= 16, |
| 337 | 	/* 17-31 reserved for challenge text extension */ |
| 338 | 	IEEE80211_ELEMID_POWER_CONSTRAINT	= 32, |
| 339 | 	IEEE80211_ELEMID_POWER_CAP		= 33, |
| 340 | 	IEEE80211_ELEMID_TPC_REQUEST		= 34, |
| 341 | 	IEEE80211_ELEMID_TPC_REPORT		= 35, |
| 342 | 	IEEE80211_ELEMID_SUPP_CHNLS		= 35, |
| 343 | 	IEEE80211_ELEMID_CSA			= 37,	/* 11h */ |
| 344 | 	IEEE80211_ELEMID_MEASUREMENT_REQUEST	= 38,	/* DFS */ |
| 345 | 	IEEE80211_ELEMID_MEASUREMENT_REPORT	= 39,	/* DFS */ |
| 346 | 	IEEE80211_ELEMID_QUIET			= 40, |
| 347 | 	IEEE80211_ELEMID_IBSS_DFS		= 41, |
| 348 | 	IEEE80211_ELEMID_ERP			= 42, |
| 349 | 	IEEE80211_ELEMID_TS_DELAY		= 43, |
| 350 | 	IEEE80211_ELEMID_TCLAS			= 44, |
| 351 | 	IEEE80211_ELEMID_HTCAPS			= 45,	/* 11n */ |
| 352 | 	IEEE80211_ELEMID_QOS_CAP		= 46, |
| 353 | 	/* 47 reserved */ |
| 354 | 	IEEE80211_ELEMID_RSN			= 48, |
| 355 | 	/* 49 reserved */ |
| 356 | 	IEEE80211_ELEMID_XRATES			= 50, |
| 357 | 	IEEE80211_ELEMID_AP_CHNL_REPORT		= 51, |
| 358 | 	IEEE80211_ELEMID_NBR_REPORT		= 52, |
| 359 | 	IEEE80211_ELEMID_RCPI			= 53, |
| 360 | 	IEEE80211_ELEMID_MDE			= 54, |
| 361 | 	IEEE80211_ELEMID_FTE			= 55, |
| 362 | 	IEEE80211_ELEMID_TIE			= 56,	/* 11r */ |
| 363 | 	IEEE80211_ELEMID_RDE			= 57, |
| 364 | 	IEEE80211_ELEMID_DSE			= 58, |
| 365 | 	IEEE80211_ELEMID_SUPP_OPCLASS		= 59, |
| 366 | 	IEEE80211_ELEMID_XCSA			= 60, |
| 367 | 	IEEE80211_ELEMID_HTOP			= 61,	/* 11n */ |
| 368 | 	IEEE80211_ELEMID_SECONDARY_CHANL_OFFSET	= 62,	/* 11n */ |
| 369 | 	IEEE80211_ELEMID_AVG_ACCESS_DELAY	= 63, |
| 370 | 	IEEE80211_ELEMID_ANTENNA		= 64, |
| 371 | 	IEEE80211_ELEMID_RSNI			= 65, |
| 372 | 	IEEE80211_ELEMID_MEASUREMENT_PILOT_TX	= 66, |
| 373 | 	IEEE80211_ELEMID_AVAIL_CAPACITY		= 67, |
| 374 | 	IEEE80211_ELEMID_AC_ACCESS_DELAY	= 68, |
| 375 | 	IEEE80211_ELEMID_TIME_ADVERT		= 69, |
| 376 | 	IEEE80211_ELEMID_RM			= 70, |
| 377 | 	IEEE80211_ELEMID_MULTI_BSSID		= 71, |
| 378 | 	IEEE80211_ELEMID_20_40_CBW_COEX		= 72,	/* 11n */ |
| 379 | 	IEEE80211_ELEMID_20_40_CBW_INTOLERANT	= 73,	/* 11n */ |
| 380 | 	IEEE80211_ELEMID_SCAN_PARAM_OVERLAP	= 74, |
| 381 | 	IEEE80211_ELEMID_RIC			= 75, |
| 382 | 	IEEE80211_ELEMID_MMIE			= 76,	/* 11w */ |
| 383 | 	IEEE80211_ELEMID_EVENT_REQUEST		= 78, |
| 384 | 	IEEE80211_ELEMID_EVENT_REPORT		= 79, |
| 385 | 	IEEE80211_ELEMID_DIAG_REQUEST		= 80, |
| 386 | 	IEEE80211_ELEMID_DIAG_REPORT		= 81, |
| 387 | 	IEEE80211_ELEMID_LOCATION_PARMS		= 82, |
| 388 | 	IEEE80211_ELEMID_NONTX_BSSID		= 83, |
| 389 | 	IEEE80211_ELEMID_SSID_LIST		= 84, |
| 390 | 	IEEE80211_ELEMID_MULTI_BSSID_IDX	= 85, |
| 391 | 	IEEE80211_ELEMID_FMS_DESC		= 86, |
| 392 | 	IEEE80211_ELEMID_FMS_REQUEST		= 87, |
| 393 | 	IEEE80211_ELEMID_FMS_RESPONSE		= 88, |
| 394 | 	IEEE80211_ELEMID_QOS_TRAFFIC_CAP	= 89, |
| 395 | 	IEEE80211_ELEMID_MAX_IDLE_PERIOD	= 90, |
| 396 | 	IEEE80211_ELEMID_TFS_REQUEST		= 91, |
| 397 | 	IEEE80211_ELEMID_TFS_RESPONSE		= 92, |
| 398 | 	IEEE80211_ELEMID_WNM_SLEEP		= 93, |
| 399 | 	IEEE80211_ELEMID_TIM_BCAST_REQUEST	= 94, |
| 400 | 	IEEE80211_ELEMID_TIM_BCAST_RESPONSE	= 95, |
| 401 | 	IEEE80211_ELEMID_INTERFERENCE_REPORT	= 96, |
| 402 | 	IEEE80211_ELEMID_CHNL_USAGE		= 97, |
| 403 | 	IEEE80211_ELEMID_TIME_ZONE		= 98, |
| 404 | 	IEEE80211_ELEMID_DMS_REQUEST		= 99, |
| 405 | 	IEEE80211_ELEMID_DMS_RESPONSE		= 100, |
| 406 | 	IEEE80211_ELEMID_LINK_ID		= 101, |
| 407 | 	IEEE80211_ELEMID_WAKE_SCHED		= 102, |
| 408 | 	/* 103 undefined */ |
| 409 | 	IEEE80211_ELEMID_CHNL_SWITCH_TIMING	= 104, |
| 410 | 	IEEE80211_ELEMID_PTI_CTRL		= 105, |
| 411 | 	IEEE80211_ELEMID_TPU_BUF_STATUS		= 106, |
| 412 | 	IEEE80211_ELEMID_INTERWORKING		= 107, |
| 413 | 	IEEE80211_ELEMID_ADVERT_PROTOCOL	= 108, |
| 414 | 	IEEE80211_ELEMID_EXPEDITED_BW_REQUEST	= 109, |
| 415 | 	IEEE80211_ELEMID_QOS_MAP_SET		= 110, |
| 416 | 	IEEE80211_ELEMID_ROAMING_CONSORTIUM	= 111, |
| 417 | 	IEEE80211_ELEMID_EMERGENCY_ALERT_ID	= 112, |
| 418 | 	IEEE80211_ELEMID_MESHCONF		= 113, |
| 419 | 	IEEE80211_ELEMID_MESHID			= 114, |
| 420 | 	IEEE80211_ELEMID_MESHLINK		= 115, |
| 421 | 	IEEE80211_ELEMID_MESHCNGST		= 116, |
| 422 | 	IEEE80211_ELEMID_MESHPEER		= 117, |
| 423 | 	IEEE80211_ELEMID_MESHCSA		= 118, |
| 424 | 	IEEE80211_ELEMID_MESHAWAKEW		= 119, |
| 425 | 	IEEE80211_ELEMID_MESHBEACONT		= 120, |
| 426 | 	IEEE80211_ELEMID_MCCAOP_SETUP_REQUEST	= 121, |
| 427 | 	IEEE80211_ELEMID_MCCAOP_SETUP_REPLY	= 122, |
| 428 | 	IEEE80211_ELEMID_MCCAOP_ADVERT		= 123, |
| 429 | 	IEEE80211_ELEMID_MCCAOP_TEARDOWN	= 124, |
| 430 | 	IEEE80211_ELEMID_MESHGANN		= 125, |
| 431 | 	IEEE80211_ELEMID_MESHRANN		= 126, |
| 432 | 	IEEE80211_ELEMID_XCAPS			= 127, |
| 433 | 	/* 128-129 reserved */ |
| 434 | 	IEEE80211_ELEMID_MESHPREQ		= 130, |
| 435 | 	IEEE80211_ELEMID_MESHPREP		= 131, |
| 436 | 	IEEE80211_ELEMID_MESHPERR		= 132, |
| 437 | 	/* 133-136 reserved */ |
| 438 | 	IEEE80211_ELEMID_MESHPXU		= 137, |
| 439 | 	IEEE80211_ELEMID_MESHPXUC		= 138, |
| 440 | 	IEEE80211_ELEMID_AUTH_MESH_PEERING_XCHG	= 139, |
| 441 | 	IEEE80211_ELEMID_MIC			= 140, |
| 442 | 	IEEE80211_ELEMID_DEST_URI		= 141, |
| 443 | 	IEEE80211_ELEMID_U_APSD_COEX		= 142, |
| 444 | 	/* 143-174 reserved */ |
| 445 | 	IEEE80211_ELEMID_MCCAOP_ADVERT_OVIEW	= 174, |
| 446 | 	/* 175-190 reserved */ |
| 447 | 	IEEE80211_ELEMID_VHTCAPS		= 191,	/* 11ac */ |
| 448 | 	IEEE80211_ELEMID_VHTOP			= 192,	/* 11ac */ |
| 449 | 	IEEE80211_ELEMID_EXT_BSS_LOAD		= 193,	/* 11ac */ |
| 450 | 	IEEE80211_ELEMID_WIDEBAND_CHNL_SWITCH	= 194,	/* 11ac */ |
| 451 | 	IEEE80211_ELEMID_VHT_TXPOWER		= 195,	/* 11ac */ |
| 452 | 	IEEE80211_ELEMID_CHNL_SWITCH_WRAPPER	= 196,	/* 11ac */ |
| 453 | 	IEEE80211_ELEMID_AID			= 197,	/* 11ac */ |
| 454 | 	IEEE80211_ELEMID_QUIET_CHNL		= 198,	/* 11ac */ |
| 455 | 	IEEE80211_ELEMID_OPMODE_NOTIF		= 199,	/* 11ac */ |
| 456 | 	/* 200-220 reserved */ |
| 457 | 	IEEE80211_ELEMID_VENDOR			= 221,	/* vendor private */ |
| 458 | 	/* 222-254 reserved */ |
| 459 | 	IEEE80211_ELEMID_EXTENSION		= 255	/* Extension */ |
| 460 | }; |
| 461 | /* |
| 462 | * Extension element IDs |
| 463 | * Used with IEEE80211_ELEMID_EXTENSION (255) |
| 464 | */ |
| 465 | #define IEEE80211_ELEMID_EXT_HECAPS		35	/* 11ax HE Capabilities */ |
| 466 | #define IEEE80211_ELEMID_EXT_HEOP		36	/* 11ax HE Operation */ |
| 467 | |
| 468 | /* |
| 469 | * Action field category values (see 802.11-2012 8.4.1.11 Table 8-38). |
| 470 | */ |
| 471 | enum { |
| 472 | 	IEEE80211_CATEG_SPECTRUM		= 0, |
| 473 | 	IEEE80211_CATEG_QOS			= 1, |
| 474 | 	IEEE80211_CATEG_DLS			= 2, |
| 475 | 	IEEE80211_CATEG_BA			= 3, |
| 476 | 	IEEE80211_CATEG_PUB			= 4, |
| 477 | 	IEEE80211_CATEG_RADIO_MSRMNT		= 5, |
| 478 | 	IEEE80211_CATEG_FAST_BSS_TRANS		= 6, |
| 479 | 	IEEE80211_CATEG_HT			= 7,	/* 11n */ |
| 480 | 	IEEE80211_CATEG_SA_QUERY		= 8,	/* 11w */ |
| 481 | 	IEEE80211_CATEG_PROT_DUAL_PUBLIC_ACTION	= 9, |
| 482 | 	IEEE80211_CATEG_WNM			= 10, |
| 483 | 	IEEE80211_CATEG_UNPROT_WNM		= 11, |
| 484 | 	IEEE80211_CATEG_TDLS			= 12, |
| 485 | 	IEEE80211_CATEG_MESH			= 13, |
| 486 | 	IEEE80211_CATEG_MULTIHOP		= 14, |
| 487 | 	IEEE80211_CATEG_SELF_PROT		= 15, |
| 488 | 	/* 16-125 reserved */ |
| 489 | 	IEEE80211_CATEG_PROT_VENDOR		= 126, |
| 490 | 	IEEE80211_CATEG_VENDOR			= 127 |
| 491 | 	/* 128-255 error */ |
| 492 | }; |
| 493 | |
| 494 | /* |
| 495 | * Block Ack Action field values (see 802.11-2012 8.5.5 Table 8-202). |
| 496 | */ |
| 497 | #define IEEE80211_ACTION_ADDBA_REQ	0 |
| 498 | #define IEEE80211_ACTION_ADDBA_RESP	1 |
| 499 | #define IEEE80211_ACTION_DELBA		2 |
| 500 | /* 3-255 reserved */ |
| 501 | |
| 502 | /* |
| 503 | * SA Query Action field values (see 802.11-2012 8.5.10 Table 8-227). |
| 504 | */ |
| 505 | #define IEEE80211_ACTION_SA_QUERY_REQ	0 |
| 506 | #define IEEE80211_ACTION_SA_QUERY_RESP	1 |
| 507 | |
| 508 | /* |
| 509 | * HT Action field values (see 802.11-2012 8.5.12 Table 8-229). |
| 510 | */ |
| 511 | #define IEEE80211_ACTION_NOTIFYCW		0 |
| 512 | #define IEEE80211_ACTION_SM_PWRSAVE		1 |
| 513 | #define IEEE80211_ACTION_PSMP			2 |
| 514 | #define IEEE80211_ACTION_SET_PCO_PHASE		3 |
| 515 | #define IEEE80211_ACTION_CSI			4 |
| 516 | #define IEEE80211_ACTION_NONCOMPRESSED_BF	5 |
| 517 | #define IEEE80211_ACTION_COMPRESSED_BF		6 |
| 518 | #define IEEE80211_ACTION_ASEL_IDX_FEEDBACK	7 |
| 519 | /* 8-255 reserved */ |
| 520 | |
| 521 | #define	IEEE80211_RATE_BASIC			0x80 |
| 522 | #define	IEEE80211_RATE_VAL			0x7f |
| 523 | #define	IEEE80211_RATE_SIZE			8	/* 802.11 standard */ |
| 524 | #define	IEEE80211_RATE_MAXSIZE			15	/* max rates we'll handle */ |
| 525 | |
| 526 | #define	IEEE80211_HT_NUM_MCS			77 |
| 527 | #define	IEEE80211_VHT_NUM_MCS			10 |
| 528 | #define	IEEE80211_HE_NUM_MCS			12 |
| 529 | |
| 530 | /* |
| 531 | * BlockAck/BlockAckReq Control field (see 802.11-2012 8.3.1.9 Figure 8-25). |
| 532 | */ |
| 533 | #define IEEE80211_BA_ACK_POLICY		0x0001 |
| 534 | #define IEEE80211_BA_MULTI_TID		0x0002 |
| 535 | #define IEEE80211_BA_COMPRESSED		0x0004 |
| 536 | #define IEEE80211_BA_TID_INFO_MASK	0xf000 |
| 537 | #define IEEE80211_BA_TID_INFO_SHIFT	12 |
| 538 | |
| 539 | /* |
| 540 | * ADDBA Parameter Set field (see 802.11-2012 8.4.1.14 Figure 8-48). |
| 541 | */ |
| 542 | #define IEEE80211_ADDBA_AMSDU		0x0001 /* A-MSDU in A-MPDU supported */ |
| 543 | #define IEEE80211_ADDBA_BA_POLICY	0x0002 /* 1=immediate BA 0=delayed BA */ |
| 544 | #define IEEE80211_ADDBA_TID_MASK	0x003c |
| 545 | #define IEEE80211_ADDBA_TID_SHIFT	2 |
| 546 | #define IEEE80211_ADDBA_BUFSZ_MASK	0xffc0 |
| 547 | #define IEEE80211_ADDBA_BUFSZ_SHIFT	6 |
| 548 | |
| 549 | /* |
| 550 | * DELBA Parameter Set field (see 802.11-2012 8.4.1.16 Figure 8-50). |
| 551 | */ |
| 552 | #define IEEE80211_DELBA_INITIATOR	0x0800 |
| 553 | #define IEEE80211_DELBA_TID_INFO_MASK	0xf000 |
| 554 | #define IEEE80211_DELBA_TID_INFO_SHIFT	12 |
| 555 | |
| 556 | /* |
| 557 | * ERP information element parameters (see 802.11-2012 8.4.2.14 Figure 8-95). |
| 558 | */ |
| 559 | #define	IEEE80211_ERP_NON_ERP_PRESENT		0x01 |
| 560 | #define	IEEE80211_ERP_USE_PROTECTION		0x02 |
| 561 | #define	IEEE80211_ERP_BARKER_MODE		0x04 |
| 562 | |
| 563 | /* |
| 564 | * RSN capabilities (see 802.11-2012 8.4.2.27.4). |
| 565 | */ |
| 566 | #define IEEE80211_RSNCAP_PREAUTH		0x0001 |
| 567 | #define IEEE80211_RSNCAP_NOPAIRWISE		0x0002 |
| 568 | #define IEEE80211_RSNCAP_PTKSA_RCNT_MASK	0x000c |
| 569 | #define IEEE80211_RSNCAP_PTKSA_RCNT_SHIFT	2 |
| 570 | #define IEEE80211_RSNCAP_GTKSA_RCNT_MASK	0x0030 |
| 571 | #define IEEE80211_RSNCAP_GTKSA_RCNT_SHIFT	4 |
| 572 | #define IEEE80211_RSNCAP_RCNT1			0 |
| 573 | #define IEEE80211_RSNCAP_RCNT2			1 |
| 574 | #define IEEE80211_RSNCAP_RCNT4			2 |
| 575 | #define IEEE80211_RSNCAP_RCNT16			3 |
| 576 | #define IEEE80211_RSNCAP_MFPR			0x0040	/* 11w */ |
| 577 | #define IEEE80211_RSNCAP_MFPC			0x0080	/* 11w */ |
| 578 | #define IEEE80211_RSNCAP_PEERKEYENA		0x0200 |
| 579 | #define IEEE80211_RSNCAP_SPPAMSDUC		0x0400	/* 11n */ |
| 580 | #define IEEE80211_RSNCAP_SPPAMSDUR		0x0800	/* 11n */ |
| 581 | #define IEEE80211_RSNCAP_PBAC			0x1000	/* 11n */ |
| 582 | #define IEEE80211_RSNCAP_EXTENDED_KEYID		0x2000 |
| 583 | |
| 584 | /* |
| 585 | * HT Capabilities Info (see 802.11-2012 8.4.2.58.2). |
| 586 | */ |
| 587 | #define IEEE80211_HTCAP_LDPC		0x00000001 |
| 588 | #define IEEE80211_HTCAP_CBW20_40	0x00000002 |
| 589 | #define IEEE80211_HTCAP_SMPS_MASK	0x0000000c |
| 590 | #define IEEE80211_HTCAP_SMPS_SHIFT	2 |
| 591 | #define IEEE80211_HTCAP_SMPS_STA	0 |
| 592 | #define IEEE80211_HTCAP_SMPS_DYN	1 |
| 593 | #define IEEE80211_HTCAP_SMPS_DIS	3 |
| 594 | #define IEEE80211_HTCAP_GF		0x00000010 |
| 595 | #define IEEE80211_HTCAP_SGI20		0x00000020 |
| 596 | #define IEEE80211_HTCAP_SGI40		0x00000040 |
| 597 | #define IEEE80211_HTCAP_TXSTBC		0x00000080 |
| 598 | #define IEEE80211_HTCAP_RXSTBC_MASK	0x00000300 |
| 599 | #define IEEE80211_HTCAP_RXSTBC_SHIFT	8 |
| 600 | #define IEEE80211_HTCAP_DELAYEDBA	0x00000400 |
| 601 | #define IEEE80211_HTCAP_AMSDU7935	0x00000800 |
| 602 | #define IEEE80211_HTCAP_DSSSCCK40	0x00001000 |
| 603 | #define IEEE80211_HTCAP_PSMP		0x00002000 |
| 604 | #define IEEE80211_HTCAP_40INTOLERANT	0x00004000 |
| 605 | #define IEEE80211_HTCAP_LSIGTXOPPROT	0x00008000 |
| 606 | |
| 607 | /* |
| 608 | * HT A-MPDU parameters (see 802.11-2012 8.4.2.58.3). |
| 609 | */ |
| 610 | #define IEEE80211_AMPDU_PARAM_LE	0x03 |
| 611 | #define IEEE80211_AMPDU_PARAM_SS	0x1c |
| 612 | #define IEEE80211_AMPDU_PARAM_SS_NONE	(0 << 2) |
| 613 | #define IEEE80211_AMPDU_PARAM_SS_0_25	(1 << 2) |
| 614 | #define IEEE80211_AMPDU_PARAM_SS_0_5	(2 << 2) |
| 615 | #define IEEE80211_AMPDU_PARAM_SS_1	(3 << 2) |
| 616 | #define IEEE80211_AMPDU_PARAM_SS_2	(4 << 2) |
| 617 | #define IEEE80211_AMPDU_PARAM_SS_4	(5 << 2) |
| 618 | #define IEEE80211_AMPDU_PARAM_SS_8	(6 << 2) |
| 619 | #define IEEE80211_AMPDU_PARAM_SS_16	(7 << 2) |
| 620 | /* bits 5-7 reserved */ |
| 621 | |
| 622 | /* |
| 623 | * HT Supported MCS Set (see 802.11-2012 8.4.2.58.4). |
| 624 | * This field is 16 bytes in size. Bitmasks given below |
| 625 | * operate on 8 or 16 bit integer subsets of this field |
| 626 | * for use with ieee80211com and ieee80211_node. |
| 627 | */ |
| 628 | /* Bits 0-76: Supported Rx MCS bitmask */ |
| 629 | /* Bits 77-79: Reserved */ |
| 630 | /* Bits 80-89: Highest Rx rate in units of 1MB/s */ |
| 631 | #define IEEE80211_MCS_RX_RATE_HIGH	0x03ff |
| 632 | /* Bits 90-95: Reserved */ |
| 633 | /* Bits 96-100: Tx MCS set */ |
| 634 | #define IEEE80211_TX_MCS_SET_DEFINED		0x01 |
| 635 | #define IEEE80211_TX_RX_MCS_NOT_EQUAL		0x02 |
| 636 | #define IEEE80211_TX_SPATIAL_STREAMS		0x0c |
| 637 | #define IEEE80211_TX_UNEQUAL_MODULATION		0x10 |
| 638 | /* Bits 101-127: Reserved */ |
| 639 | |
| 640 | /* |
| 641 | * HT Extended Capabilities (see 802.11-2012 8.4.2.58.5). |
| 642 | */ |
| 643 | #define IEEE80211_HTXCAP_PCO		0x0001 |
| 644 | #define IEEE80211_HTXCAP_PCOTT_MASK	0x0006 |
| 645 | #define IEEE80211_HTXCAP_PCOTT_SHIFT	1 |
| 646 | #define IEEE80211_HTXCAP_PCOTT_400	1 |
| 647 | #define IEEE80211_HTXCAP_PCOTT_1500	2 |
| 648 | #define IEEE80211_HTXCAP_PCOTT_5000	3 |
| 649 | /* Bits 3-7 are reserved. */ |
| 650 | #define IEEE80211_HTXCAP_MFB_MASK	0x0300 |
| 651 | #define IEEE80211_HTXCAP_MFB_SHIFT	8 |
| 652 | #define IEEE80211_HTXCAP_MFB_NONE	0 |
| 653 | #define IEEE80211_HTXCAP_MFB_UNSOL	2 |
| 654 | #define IEEE80211_HTXCAP_MFB_BOTH	3 |
| 655 | #define IEEE80211_HTXCAP_HTC		0x0400 |
| 656 | #define IEEE80211_HTXCAP_RDRESP		0x0800 |
| 657 | /* Bits 12-15 are reserved. */ |
| 658 | |
| 659 | /* |
| 660 | * Transmit Beamforming (TxBF) Capabilities (see 802.11-2012 8.4.2.58.6). |
| 661 | */ |
| 662 | #define IEEE80211_TXBFCAP_IMPLICIT_RX			0x00000001 |
| 663 | #define IEEE80211_TXBFCAP_RSSC				0x00000002 |
| 664 | #define IEEE80211_TXBFCAP_TSSC				0x00000004 |
| 665 | #define IEEE80211_TXBFCAP_RNDP				0x00000008 |
| 666 | #define IEEE80211_TXBFCAP_TNDP				0x00000010 |
| 667 | #define IEEE80211_TXBFCAP_IMPLICIT_TX			0x00000020 |
| 668 | #define IEEE80211_TXBFCAP_CALIB_MASK			0x000000c0 |
| 669 | #define IEEE80211_TXBFCAP_CALIB_SHIFT			6 |
| 670 | #define IEEE80211_TXBFCAP_TX_CSI			0x00000100 |
| 671 | #define IEEE80211_TXBFCAP_EXPLICIT_NSC			0x00000200 |
| 672 | #define IEEE80211_TXBFCAP_EXPLICIT_CSC			0x00000400 |
| 673 | #define IEEE80211_TXBFCAP_CSI_FB_DELAYED		0x00000800 |
| 674 | #define IEEE80211_TXBFCAP_CSI_FB_IMMEDIATE		0x00001000 |
| 675 | #define IEEE80211_TXBFCAP_EXPLICIT_NB_FB_DELAYED	0x00002000 |
| 676 | #define IEEE80211_TXBFCAP_EXPLICIT_NB_FB_IMMEDIATE	0x00004000 |
| 677 | #define IEEE80211_TXBFCAP_EXPLICIT_CB_FB_DELAYED	0x00008000 |
| 678 | #define IEEE80211_TXBFCAP_EXPLICIT_CB_FB_IMMEDIATE	0x00010000 |
| 679 | #define IEEE80211_TXBFCAP_MINIMAL_GROUPING_1_2		0x00020000 |
| 680 | #define IEEE80211_TXBFCAP_MINIMAL_GROUPING_1_4		0x00040000 |
| 681 | #define IEEE80211_TXBFCAP_CSI_NUM_ANT_MASK		0x00180000 |
| 682 | #define IEEE80211_TXBFCAP_CSI_NUM_ANT_SHIFT		19 |
| 683 | #define IEEE80211_TXBFCAP_NS_NUM_ANT_MASK		0x00600000 |
| 684 | #define IEEE80211_TXBFCAP_NS_NUM_ANT_SHIFT		21 |
| 685 | #define IEEE80211_TXBFCAP_CS_NUM_ANT_MASK		0x01800000 |
| 686 | #define IEEE80211_TXBFCAP_CS_NUM_ANT_SHIFT		23 |
| 687 | #define IEEE80211_TXBFCAP_CSI_NUM_ROWS_MASK		0x06000000 |
| 688 | #define IEEE80211_TXBFCAP_CSI_NUM_ROWS_SHIFT		25 |
| 689 | #define IEEE80211_TXBFCAP_CHANL_ESTIMATE_MASK		0x18000000 |
| 690 | #define IEEE80211_TXBFCAP_CHANL_ESTIMATE_SHIFT		27 |
| 691 | |
| 692 | /* |
| 693 | * Antenna Selection (ASEL) Capability (see 802.11-2012 8.4.2.58.7). |
| 694 | */ |
| 695 | #define IEEE80211_ASELCAP_ASEL		0x01 |
| 696 | #define IEEE80211_ASELCAP_CSIFB_TX	0x02 |
| 697 | #define IEEE80211_ASELCAP_ANT_IDX_FB_TX	0x04 |
| 698 | #define IEEE80211_ASELCAP_CSIFB		0x08 |
| 699 | #define IEEE80211_ASELCAP_ANT_IDX_FB	0x10 |
| 700 | #define IEEE80211_ASELCAP_ASEL_RX	0x20 |
| 701 | #define IEEE80211_ASELCAP_TX_SOUND_PPDU	0x20 |
| 702 | /* Bit 7 is reserved. */ |
| 703 | |
| 704 | /* |
| 705 | * HT Operation element (see 802.11-2012 8.4.2.59). |
| 706 | */ |
| 707 | /* Byte 0 contains primary channel number. */ |
| 708 | /* Byte 1. */ |
| 709 | #define IEEE80211_HTOP0_SCO_MASK	0x03 |
| 710 | #define IEEE80211_HTOP0_SCO_SHIFT	0 |
| 711 | #define IEEE80211_HTOP0_SCO_SCN		0 |
| 712 | #define IEEE80211_HTOP0_SCO_SCA		1 |
| 713 | #define IEEE80211_HTOP0_SCO_SCB		3 |
| 714 | #define IEEE80211_HTOP0_CHW		0x04 |
| 715 | #define IEEE80211_HTOP0_RIFS		0x08 |
| 716 | /* bits 4-7 reserved */ |
| 717 | /* Bytes 2-3. */ |
| 718 | #define IEEE80211_HTOP1_PROT_MASK	0x0003 |
| 719 | #define IEEE80211_HTOP1_PROT_SHIFT	0 |
| 720 | #define IEEE80211_HTOP1_NONGF_STA	0x0004 |
| 721 | /* Bit 3 is reserved. */ |
| 722 | #define IEEE80211_HTOP1_OBSS_NONHT_STA	0x0010 |
| 723 | #define IEEE80211_HTOP1_CCFS2_SHIFT	5 |
| 724 | #define IEEE80211_HTOP1_CCFS2_MASK	0x1fe0 |
| 725 | /* Bytes 4-5. */ |
| 726 | /* Bits 0-5 are reserved. */ |
| 727 | #define IEEE80211_HTOP2_DUALBEACON	0x0040 |
| 728 | #define IEEE80211_HTOP2_DUALCTSPROT	0x0080 |
| 729 | #define IEEE80211_HTOP2_STBCBEACON	0x0100 |
| 730 | #define IEEE80211_HTOP2_LSIGTXOP	0x0200 |
| 731 | #define IEEE80211_HTOP2_PCOACTIVE	0x0400 |
| 732 | #define IEEE80211_HTOP2_PCOPHASE40	0x0800 |
| 733 | /* Bits 12-15 are reserved. */ |
| 734 | |
| 735 | /* |
| 736 | * VHT Capabilities Info (see 802.11ac-2013 8.4.2.160.2). |
| 737 | */ |
| 738 | #define IEEE80211_VHTCAP_MAX_MPDU_LENGTH_MASK	0x00000003 |
| 739 | #define IEEE80211_VHTCAP_MAX_MPDU_LENGTH_SHIFT	0 |
| 740 | #define IEEE80211_VHTCAP_MAX_MPDU_LENGTH_3895	0 |
| 741 | #define IEEE80211_VHTCAP_MAX_MPDU_LENGTH_7991	1 |
| 742 | #define IEEE80211_VHTCAP_MAX_MPDU_LENGTH_11454	2 |
| 743 | #define IEEE80211_VHTCAP_CHAN_WIDTH_MASK	0x0c |
| 744 | #define IEEE80211_VHTCAP_CHAN_WIDTH_SHIFT	2 |
| 745 | #define IEEE80211_VHTCAP_CHAN_WIDTH_80		0 |
| 746 | #define IEEE80211_VHTCAP_CHAN_WIDTH_160		1 |
| 747 | #define IEEE80211_VHTCAP_CHAN_WIDTH_160_8080	2 |
| 748 | #define IEEE80211_VHTCAP_RX_LDPC		0x00000010 |
| 749 | #define IEEE80211_VHTCAP_SGI80			0x00000020 |
| 750 | #define IEEE80211_VHTCAP_SGI160			0x00000040 |
| 751 | #define IEEE80211_VHTCAP_TX_STBC		0x00000080 |
| 752 | #define IEEE80211_VHTCAP_RX_STBC_SS_MASK	0x00000700 |
| 753 | #define IEEE80211_VHTCAP_RX_STBC_SS_SHIFT	8 |
| 754 | #define IEEE80211_VHTCAP_SU_BEAMFORMER		0x00000800 |
| 755 | #define IEEE80211_VHTCAP_SU_BEAMFORMEE		0x00001000 |
| 756 | #define IEEE80211_VHTCAP_BEAMFORMEE_STS_MASK	0x0000e000 |
| 757 | #define IEEE80211_VHTCAP_BEAMFORMEE_STS_SHIFT	13 |
| 758 | #define IEEE80211_VHTCAP_NUM_STS_MASK		0x00070000 |
| 759 | #define IEEE80211_VHTCAP_NUM_STS_SHIFT		16 |
| 760 | #define IEEE80211_VHTCAP_MU_BEAMFORMER		0x00080000 |
| 761 | #define IEEE80211_VHTCAP_MU_BEAMFORMEE		0x00100000 |
| 762 | #define IEEE80211_VHTCAP_TXOP_PS		0x00200000 |
| 763 | #define IEEE80211_VHTCAP_HTC_VHT		0x00400000 |
| 764 | #define IEEE80211_VHTCAP_MAX_AMPDU_LEN_MASK	0x03800000 |
| 765 | #define IEEE80211_VHTCAP_MAX_AMPDU_LEN_SHIFT	23 |
| 766 | #define IEEE80211_VHTCAP_MAX_AMPDU_LEN_8K	0 |
| 767 | #define IEEE80211_VHTCAP_MAX_AMPDU_LEN_16K	1 |
| 768 | #define IEEE80211_VHTCAP_MAX_AMPDU_LEN_32K	2 |
| 769 | #define IEEE80211_VHTCAP_MAX_AMPDU_LEN_64K	3 |
| 770 | #define IEEE80211_VHTCAP_MAX_AMPDU_LEN_128K	4 |
| 771 | #define IEEE80211_VHTCAP_MAX_AMPDU_LEN_256K	5 |
| 772 | #define IEEE80211_VHTCAP_MAX_AMPDU_LEN_512K	6 |
| 773 | #define IEEE80211_VHTCAP_MAX_AMPDU_LEN_1024K	7 |
| 774 | #define IEEE80211_VHTCAP_LINK_ADAPT_MASK	0x0c000000 |
| 775 | #define IEEE80211_VHTCAP_LINK_ADAPT_SHIFT	26 |
| 776 | #define IEEE80211_VHTCAP_LINK_ADAPT_UNSOL_MFB	2 |
| 777 | #define IEEE80211_VHTCAP_LINK_ADAPT_MRQ_MFB	3 |
| 778 | #define IEEE80211_VHTCAP_RX_ANT_PATTERN		0x10000000 |
| 779 | #define IEEE80211_VHTCAP_TX_ANT_PATTERN		0x20000000 |
| 780 | #define IEEE80211_VHTCAP_EXT_NSS_BW_SHIFT	30 |
| 781 | #define IEEE80211_VHTCAP_EXT_NSS_BW_MASK	0xc0000000 |
| 782 | |
| 783 | /* |
| 784 | * VHT-MCS and NSS map (see 802.11ac-2013 8.4.2.160.3, Figure 8-401bs). |
| 785 | * Set of VHT MCS supported for a given number of spatial streams, `n'. |
| 786 | * Used by the VHT capabilities IE and by the basic VHT MSC set in |
| 787 | * the VHT operation IE. |
| 788 | */ |
| 789 | #define IEEE80211_VHT_MCS_FOR_SS_MASK(n)	(0x3 << (2*((n)-1))) |
| 790 | #define IEEE80211_VHT_MCS_FOR_SS_SHIFT(n)	(2*((n)-1)) |
| 791 | #define IEEE80211_VHT_MCS_0_7		0 |
| 792 | #define IEEE80211_VHT_MCS_0_8		1 |
| 793 | #define IEEE80211_VHT_MCS_0_9		2 |
| 794 | #define IEEE80211_VHT_MCS_SS_NOT_SUPP	3 |
| 795 | |
| 796 | #define IEEE80211_VHT_MAX_LGI_MBIT_S_MASK	0x1fff |
| 797 | #define IEEE80211_VHT_MAX_LGI_MBIT_S_SHIFT	0 |
| 798 | #define IEEE80211_VHT_EXT_NSS_BW_CAPABLE	(1 << 13) |
| 799 | |
| 800 | /* The highest number of spatial streams supported by VHT. */ |
| 801 | #define IEEE80211_VHT_NUM_SS	8 |
| 802 | |
| 803 | /* |
| 804 | * VHT Operation element (see 802.11ac-2013 8.4.2.161). |
| 805 | */ |
| 806 | /* Byte 0. */ |
| 807 | #define IEEE80211_VHTOP0_CHAN_WIDTH_MASK	0x03 |
| 808 | #define IEEE80211_VHTOP0_CHAN_WIDTH_SHIFT	0 |
| 809 | #define IEEE80211_VHTOP0_CHAN_WIDTH_HT		0 |
| 810 | #define IEEE80211_VHTOP0_CHAN_WIDTH_80		1 |
| 811 | #define IEEE80211_VHTOP0_CHAN_WIDTH_160		2 |
| 812 | #define IEEE80211_VHTOP0_CHAN_WIDTH_8080	3 |
| 813 | /* Byte 1 contains channel center frequency index 0 for 80, 80+80, 160 MHz. */ |
| 814 | /* Byte 2 contains channel center frequency index 1 for 80+80 MHz only. */ |
| 815 | |
| 816 | |
| 817 | /* |
| 818 | * 802.11ax (HE) definitions. |
| 819 | */ |
| 820 | |
| 821 | /* HE Capabilities element fixed fields */ |
| 822 | #define IEEE80211_HE_MAC_CAPS_LEN		6 |
| 823 | #define IEEE80211_HE_PHY_CAPS_LEN		11 |
| 824 | #define IEEE80211_HE_CAPS_FIXED_LEN		(IEEE80211_HE_MAC_CAPS_LEN + \ |
| 825 | 						 IEEE80211_HE_PHY_CAPS_LEN) |
| 826 | |
| 827 | /* HE Tx/Rx MCS NSS Support field size for 80 MHz */ |
| 828 | #define IEEE80211_HE_MCS_NSS_80_LEN		4 |
| 829 | |
| 830 | /* Minimum length of the HE Capabilities element body (includes Ext ID) */ |
| 831 | #define IEEE80211_HE_CAPS_MINLEN		(1 + IEEE80211_HE_CAPS_FIXED_LEN + \ |
| 832 | 						 IEEE80211_HE_MCS_NSS_80_LEN) |
| 833 | |
| 834 | /* |
| 835 | * Selected HE PHY capability bits (phy_cap_info[0]) |
| 836 | * These are used to determine the presence of additional MCS/NSS maps. |
| 837 | */ |
| 838 | #define IEEE80211_HE_PHYCAP0_CHAN_WIDTH_40_IN_2G		0x02 |
| 839 | #define IEEE80211_HE_PHYCAP0_CHAN_WIDTH_40_80_IN_5G		0x04 |
| 840 | #define IEEE80211_HE_PHYCAP0_CHAN_WIDTH_160_IN_5G		0x08 |
| 841 | #define IEEE80211_HE_PHYCAP0_CHAN_WIDTH_8080_IN_5G		0x10 |
| 842 | |
| 843 | /* |
| 844 | * Size of the HE Tx/Rx MCS NSS Support field, in bytes, for a given |
| 845 | * HE PHY capabilities byte 0. |
| 846 | */ |
| 847 | #define IEEE80211_HE_MCS_NSS_SIZE(_phycap0)	(IEEE80211_HE_MCS_NSS_80_LEN + \ |
| 848 | 	((((_phycap0) & IEEE80211_HE_PHYCAP0_CHAN_WIDTH_160_IN_5G) ? 4 : 0)) + \ |
| 849 | 	((((_phycap0) & IEEE80211_HE_PHYCAP0_CHAN_WIDTH_8080_IN_5G) ? 4 : 0))) |
| 850 | |
| 851 | /* |
| 852 | * HE MCS and NSS map (HE-MCS/NSS set) |
| 853 | * |
| 854 | * Set of HE MCS supported for a given number of spatial streams, `n'. |
| 855 | * Used by the HE capabilities IE and by the basic HE MCS set in |
| 856 | * the HE operation IE. |
| 857 | */ |
| 858 | #define IEEE80211_HE_MCS_FOR_SS_MASK(n)	(0x3 << (2 * ((n) - 1))) |
| 859 | #define IEEE80211_HE_MCS_FOR_SS_SHIFT(n)	(2 * ((n) - 1)) |
| 860 | #define IEEE80211_HE_MCS_0_7			0 |
| 861 | #define IEEE80211_HE_MCS_0_9			1 |
| 862 | #define IEEE80211_HE_MCS_0_11			2 |
| 863 | #define IEEE80211_HE_MCS_SS_NOT_SUPP		3 |
| 864 | |
| 865 | /* The highest number of spatial streams supported by HE */ |
| 866 | #define IEEE80211_HE_NUM_SS			8 |
| 867 | |
| 868 | /* |
| 869 | * HE Operation element fixed fields (not including the Ext ID byte) |
| 870 | */ |
| 871 | #define IEEE80211_HEOP_PARAMS_LEN		4 |
| 872 | #define IEEE80211_HEOP_BASIC_MCS_LEN		2 |
| 873 | #define IEEE80211_HEOP_FIXED_LEN		(IEEE80211_HEOP_PARAMS_LEN + \ |
| 874 | 					IEEE80211_HEOP_BASIC_MCS_LEN) |
| 875 | |
| 876 | /* |
| 877 | * EDCA Access Categories. |
| 878 | */ |
| 879 | enum ieee80211_edca_ac { |
| 880 | 	EDCA_AC_BK = 1,	/* Background */ |
| 881 | 	EDCA_AC_BE = 0,	/* Best Effort */ |
| 882 | 	EDCA_AC_VI = 2,	/* Video */ |
| 883 | 	EDCA_AC_VO = 3		/* Voice */ |
| 884 | }; |
| 885 | #define EDCA_NUM_AC	4 |
| 886 | |
| 887 | /* number of TID values (traffic identifier) */ |
| 888 | #define IEEE80211_NUM_TID	16 |
| 889 | |
| 890 | /* Atheros private advanced capabilities info */ |
| 891 | #define	ATHEROS_CAP_TURBO_PRIME			0x01 |
| 892 | #define	ATHEROS_CAP_COMPRESSION			0x02 |
| 893 | #define	ATHEROS_CAP_FAST_FRAME			0x04 |
| 894 | /* bits 3-6 reserved */ |
| 895 | #define	ATHEROS_CAP_BOOST			0x80 |
| 896 | |
| 897 | /*- |
| 898 | * Organizationally Unique Identifiers. |
| 899 | * See http://standards.ieee.org/regauth/oui/oui.txt for a list. |
| 900 | */ |
| 901 | #define ATHEROS_OUI	((const u_int8_t[]){ 0x00, 0x03, 0x7f }) |
| 902 | #define BROADCOM_OUI	((const u_int8_t[]){ 0x00, 0x90, 0x4c }) |
| 903 | #define IEEE80211_OUI	((const u_int8_t[]){ 0x00, 0x0f, 0xac }) |
| 904 | #define MICROSOFT_OUI	((const u_int8_t[]){ 0x00, 0x50, 0xf2 }) |
| 905 | |
| 906 | #define	IEEE80211_AUTH_ALGORITHM(auth) \ |
| 907 | 	((auth)[0] | ((auth)[1] << 8)) |
| 908 | #define	IEEE80211_AUTH_TRANSACTION(auth) \ |
| 909 | 	((auth)[2] | ((auth)[3] << 8)) |
| 910 | #define	IEEE80211_AUTH_STATUS(auth) \ |
| 911 | 	((auth)[4] | ((auth)[5] << 8)) |
| 912 | |
| 913 | /* |
| 914 | * Authentication Algorithm Number field (see 7.3.1.1). |
| 915 | */ |
| 916 | #define IEEE80211_AUTH_ALG_OPEN			0x0000 |
| 917 | #define IEEE80211_AUTH_ALG_SHARED		0x0001 |
| 918 | #define IEEE80211_AUTH_ALG_LEAP			0x0080 |
| 919 | |
| 920 | /* |
| 921 | * Authentication Transaction Sequence Number field (see 7.3.1.2). |
| 922 | */ |
| 923 | enum { |
| 924 | 	IEEE80211_AUTH_OPEN_REQUEST		= 1, |
| 925 | 	IEEE80211_AUTH_OPEN_RESPONSE		= 2 |
| 926 | }; |
| 927 | enum { |
| 928 | 	IEEE80211_AUTH_SHARED_REQUEST		= 1, |
| 929 | 	IEEE80211_AUTH_SHARED_CHALLENGE		= 2, |
| 930 | 	IEEE80211_AUTH_SHARED_RESPONSE		= 3, |
| 931 | 	IEEE80211_AUTH_SHARED_PASS		= 4 |
| 932 | }; |
| 933 | |
| 934 | /* |
| 935 | * Reason codes (see Table 22). |
| 936 | */ |
| 937 | enum { |
| 938 | 	IEEE80211_REASON_UNSPECIFIED		= 1, |
| 939 | 	IEEE80211_REASON_AUTH_EXPIRE		= 2, |
| 940 | 	IEEE80211_REASON_AUTH_LEAVE		= 3, |
| 941 | 	IEEE80211_REASON_ASSOC_EXPIRE		= 4, |
| 942 | 	IEEE80211_REASON_ASSOC_TOOMANY		= 5, |
| 943 | 	IEEE80211_REASON_NOT_AUTHED		= 6, |
| 944 | 	IEEE80211_REASON_NOT_ASSOCED		= 7, |
| 945 | 	IEEE80211_REASON_ASSOC_LEAVE		= 8, |
| 946 | 	IEEE80211_REASON_ASSOC_NOT_AUTHED	= 9, |
| 947 | |
| 948 | 	/* XXX the following two reason codes are not correct */ |
| 949 | 	IEEE80211_REASON_RSN_REQUIRED		= 11, |
| 950 | 	IEEE80211_REASON_RSN_INCONSISTENT	= 12, |
| 951 | |
| 952 | 	IEEE80211_REASON_IE_INVALID		= 13, |
| 953 | 	IEEE80211_REASON_MIC_FAILURE		= 14, |
| 954 | 	IEEE80211_REASON_4WAY_TIMEOUT		= 15, |
| 955 | 	IEEE80211_REASON_GROUP_TIMEOUT		= 16, |
| 956 | 	IEEE80211_REASON_RSN_DIFFERENT_IE	= 17, |
| 957 | 	IEEE80211_REASON_BAD_GROUP_CIPHER	= 18, |
| 958 | 	IEEE80211_REASON_BAD_PAIRWISE_CIPHER	= 19, |
| 959 | 	IEEE80211_REASON_BAD_AKMP		= 20, |
| 960 | 	IEEE80211_REASON_RSN_IE_VER_UNSUP	= 21, |
| 961 | 	IEEE80211_REASON_RSN_IE_BAD_CAP		= 22, |
| 962 | |
| 963 | 	IEEE80211_REASON_CIPHER_REJ_POLICY	= 24, |
| 964 | |
| 965 | 	IEEE80211_REASON_SETUP_REQUIRED		= 38, |
| 966 | 	IEEE80211_REASON_TIMEOUT		= 39 |
| 967 | }; |
| 968 | |
| 969 | /* |
| 970 | * Status codes (see Table 23). |
| 971 | */ |
| 972 | enum { |
| 973 | 	IEEE80211_STATUS_SUCCESS		= 0, |
| 974 | 	IEEE80211_STATUS_UNSPECIFIED		= 1, |
| 975 | 	IEEE80211_STATUS_CAPINFO		= 10, |
| 976 | 	IEEE80211_STATUS_NOT_ASSOCED		= 11, |
| 977 | 	IEEE80211_STATUS_OTHER			= 12, |
| 978 | 	IEEE80211_STATUS_ALG			= 13, |
| 979 | 	IEEE80211_STATUS_SEQUENCE		= 14, |
| 980 | 	IEEE80211_STATUS_CHALLENGE		= 15, |
| 981 | 	IEEE80211_STATUS_TIMEOUT		= 16, |
| 982 | 	IEEE80211_STATUS_TOOMANY		= 17, |
| 983 | 	IEEE80211_STATUS_BASIC_RATE		= 18, |
| 984 | 	IEEE80211_STATUS_SP_REQUIRED		= 19, |
| 985 | 	IEEE80211_STATUS_PBCC_REQUIRED		= 20, |
| 986 | 	IEEE80211_STATUS_CA_REQUIRED		= 21, |
| 987 | 	IEEE80211_STATUS_TOO_MANY_STATIONS	= 22, |
| 988 | 	IEEE80211_STATUS_RATES			= 23, |
| 989 | 	IEEE80211_STATUS_SHORTSLOT_REQUIRED	= 25, |
| 990 | 	IEEE80211_STATUS_DSSSOFDM_REQUIRED	= 26, |
| 991 | |
| 992 | 	IEEE80211_STATUS_TRY_AGAIN_LATER	= 30, |
| 993 | 	IEEE80211_STATUS_MFP_POLICY		= 31, |
| 994 | |
| 995 | 	IEEE80211_STATUS_REFUSED		= 37, |
| 996 | 	IEEE80211_STATUS_INVALID_PARAM		= 38, |
| 997 | |
| 998 | 	IEEE80211_STATUS_IE_INVALID		= 40, |
| 999 | 	IEEE80211_STATUS_BAD_GROUP_CIPHER	= 41, |
| 1000 | 	IEEE80211_STATUS_BAD_PAIRWISE_CIPHER	= 42, |
| 1001 | 	IEEE80211_STATUS_BAD_AKMP		= 43, |
| 1002 | 	IEEE80211_STATUS_RSN_IE_VER_UNSUP	= 44, |
| 1003 | |
| 1004 | 	IEEE80211_STATUS_CIPHER_REJ_POLICY	= 46 |
| 1005 | }; |
| 1006 | |
| 1007 | #define	IEEE80211_WEP_KEYLEN			5	/* 40bit */ |
| 1008 | #define	IEEE80211_WEP_NKID			4	/* number of key ids */ |
| 1009 | #define IEEE80211_CHALLENGE_LEN			128 |
| 1010 | |
| 1011 | /* WEP header constants */ |
| 1012 | #define	IEEE80211_WEP_IVLEN			3	/* 24bit */ |
| 1013 | #define	IEEE80211_WEP_KIDLEN			1	/* 1 octet */ |
| 1014 | #define	IEEE80211_WEP_CRCLEN			4	/* CRC-32 */ |
| 1015 | #define	IEEE80211_CRC_LEN			4 |
| 1016 | #define	IEEE80211_WEP_TOTLEN		(IEEE80211_WEP_IVLEN + \ |
| 1017 | 					 IEEE80211_WEP_KIDLEN + \ |
| 1018 | 					 IEEE80211_WEP_CRCLEN) |
| 1019 | |
| 1020 | /* |
| 1021 | * 802.11i defines an extended IV for use with non-WEP ciphers. |
| 1022 | * When the EXTIV bit is set in the key id byte an additional |
| 1023 | * 4 bytes immediately follow the IV for TKIP. For CCMP the |
| 1024 | * EXTIV bit is likewise set but the 8 bytes represent the |
| 1025 | * CCMP header rather than IV+extended-IV. |
| 1026 | */ |
| 1027 | #define	IEEE80211_WEP_EXTIV		0x20 |
| 1028 | #define	IEEE80211_WEP_EXTIVLEN		4	/* extended IV length */ |
| 1029 | #define	IEEE80211_WEP_MICLEN		8	/* trailing MIC */ |
| 1030 | |
| 1031 | /* |
| 1032 | * Maximum acceptable MTU is: |
| 1033 | *	IEEE80211_MAX_LEN - WEP overhead - CRC - |
| 1034 | *		QoS overhead - RSN/WPA overhead |
| 1035 | * Min is arbitrarily chosen > IEEE80211_MIN_LEN. The default |
| 1036 | * mtu is Ethernet-compatible; it's set by ether_ifattach. |
| 1037 | */ |
| 1038 | #define	IEEE80211_MTU_MAX			2290 |
| 1039 | #define	IEEE80211_MTU_MIN			32 |
| 1040 | |
| 1041 | #define	IEEE80211_MAX_LEN			(2300 + IEEE80211_CRC_LEN + \ |
| 1042 | (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN)) |
| 1043 | #define	IEEE80211_ACK_LEN \ |
| 1044 | 	(sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN) |
| 1045 | #define	IEEE80211_MIN_LEN \ |
| 1046 | 	(sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN) |
| 1047 | |
| 1048 | /* |
| 1049 | * The 802.11 spec says at most 2007 stations may be |
| 1050 | * associated at once. For most AP's this is way more |
| 1051 | * than is feasible so we use a default of 1800. This |
| 1052 | * number may be overridden by the driver and/or by |
| 1053 | * user configuration. |
| 1054 | */ |
| 1055 | #define	IEEE80211_AID_MAX	2007 |
| 1056 | #define	IEEE80211_AID_DEF	1800 |
| 1057 | #define IEEE80211_AID(b)	((b) &~ 0xc000) |
| 1058 | |
| 1059 | /* |
| 1060 | * RTS frame length parameters. The default is specified in |
| 1061 | * the 802.11 spec. The max may be wrong for jumbo frames. |
| 1062 | */ |
| 1063 | #define	IEEE80211_RTS_DEFAULT			512 |
| 1064 | #define	IEEE80211_RTS_MIN			1 |
| 1065 | #define	IEEE80211_RTS_MAX			IEEE80211_MAX_LEN |
| 1066 | |
| 1067 | #define IEEE80211_PLCP_SERVICE		0x00 |
| 1068 | #define IEEE80211_PLCP_SERVICE_PBCC	0x08	/* PBCC encoded */ |
| 1069 | #define IEEE80211_PLCP_SERVICE_LENEXT	0x80	/* length extension bit */ |
| 1070 | |
| 1071 | /* One Time Unit (TU) is 1Kus = 1024 microseconds. */ |
| 1072 | #define IEEE80211_DUR_TU		1024 |
| 1073 | |
| 1074 | /* IEEE 802.11b durations for DSSS PHY in microseconds */ |
| 1075 | #define IEEE80211_DUR_DS_LONG_PREAMBLE	144 |
| 1076 | #define IEEE80211_DUR_DS_SHORT_PREAMBLE	72 |
| 1077 | #define	IEEE80211_DUR_DS_PREAMBLE_DIFFERENCE	\ |
| 1078 | (IEEE80211_DUR_DS_LONG_PREAMBLE - IEEE80211_DUR_DS_SHORT_PREAMBLE) |
| 1079 | #define IEEE80211_DUR_DS_FAST_PLCPHDR	24 |
| 1080 | #define IEEE80211_DUR_DS_SLOW_PLCPHDR	48 |
| 1081 | #define	IEEE80211_DUR_DS_PLCPHDR_DIFFERENCE	\ |
| 1082 | (IEEE80211_DUR_DS_SLOW_PLCPHDR - IEEE80211_DUR_DS_FAST_PLCPHDR) |
| 1083 | #define IEEE80211_DUR_DS_SLOW_ACK	112 |
| 1084 | #define IEEE80211_DUR_DS_FAST_ACK	56 |
| 1085 | #define IEEE80211_DUR_DS_SLOW_CTS	112 |
| 1086 | #define IEEE80211_DUR_DS_FAST_CTS	56 |
| 1087 | #define IEEE80211_DUR_DS_SLOT		20 |
| 1088 | #define IEEE80211_DUR_DS_SHSLOT		9 |
| 1089 | #define IEEE80211_DUR_DS_SIFS		10 |
| 1090 | #define IEEE80211_DUR_DS_PIFS	(IEEE80211_DUR_DS_SIFS + IEEE80211_DUR_DS_SLOT) |
| 1091 | #define IEEE80211_DUR_DS_DIFS	(IEEE80211_DUR_DS_SIFS + \ |
| 1092 | 				 2 * IEEE80211_DUR_DS_SLOT) |
| 1093 | #define IEEE80211_DUR_DS_EIFS	(IEEE80211_DUR_DS_SIFS + \ |
| 1094 | 				 IEEE80211_DUR_DS_SLOW_ACK + \ |
| 1095 | 				 IEEE80211_DUR_DS_LONG_PREAMBLE + \ |
| 1096 | 				 IEEE80211_DUR_DS_SLOW_PLCPHDR + \ |
| 1097 | 				 IEEE80211_DUR_DIFS) |
| 1098 | |
| 1099 | /* |
| 1100 | * The RSNA key descriptor used by IEEE 802.11 does not use the IEEE 802.1X |
| 1101 | * key descriptor. Instead, it uses the key descriptor described in 8.5.2. |
| 1102 | */ |
| 1103 | #define EAPOL_KEY_NONCE_LEN	32 |
| 1104 | #define EAPOL_KEY_IV_LEN	16 |
| 1105 | #define EAPOL_KEY_MIC_LEN	16 |
| 1106 | |
| 1107 | struct ieee80211_eapol_key { |
| 1108 | 	u_int8_t	version; |
| 1109 | #define EAPOL_VERSION	1 |
| 1110 | |
| 1111 | 	u_int8_t	type; |
| 1112 | /* IEEE Std 802.1X-2004, 7.5.4 (only type EAPOL-Key is used here) */ |
| 1113 | #define EAP_PACKET	0 |
| 1114 | #define EAPOL_START	1 |
| 1115 | #define EAPOL_LOGOFF	2 |
| 1116 | #define EAPOL_KEY	3 |
| 1117 | #define EAPOL_ASF_ALERT	4 |
| 1118 | |
| 1119 | 	u_int8_t	len[2]; |
| 1120 | 	u_int8_t	desc; |
| 1121 | /* IEEE Std 802.1X-2004, 7.6.1 */ |
| 1122 | #define EAPOL_KEY_DESC_RC4		 1	/* deprecated */ |
| 1123 | #define EAPOL_KEY_DESC_IEEE80211	 2 |
| 1124 | #define EAPOL_KEY_DESC_WPA		254	/* non-standard WPA */ |
| 1125 | |
| 1126 | 	u_int8_t	info[2]; |
| 1127 | #define EAPOL_KEY_VERSION_MASK	0x7 |
| 1128 | #define EAPOL_KEY_DESC_V1	1 |
| 1129 | #define EAPOL_KEY_DESC_V2	2 |
| 1130 | #define EAPOL_KEY_DESC_V3	3		/* 11r */ |
| 1131 | #define EAPOL_KEY_PAIRWISE	(1 << 3) |
| 1132 | #define EAPOL_KEY_INSTALL	(1 << 6)	/* I */ |
| 1133 | #define EAPOL_KEY_KEYACK	(1 << 7)	/* A */ |
| 1134 | #define EAPOL_KEY_KEYMIC	(1 << 8)	/* M */ |
| 1135 | #define EAPOL_KEY_SECURE	(1 << 9)	/* S */ |
| 1136 | #define EAPOL_KEY_ERROR		(1 << 10) |
| 1137 | #define EAPOL_KEY_REQUEST	(1 << 11) |
| 1138 | #define EAPOL_KEY_ENCRYPTED	(1 << 12) |
| 1139 | #define EAPOL_KEY_SMK		(1 << 13) |
| 1140 | /* WPA compatibility */ |
| 1141 | #define EAPOL_KEY_WPA_KID_MASK	0x3 |
| 1142 | #define EAPOL_KEY_WPA_KID_SHIFT	4 |
| 1143 | #define EAPOL_KEY_WPA_TX	EAPOL_KEY_INSTALL |
| 1144 | |
| 1145 | 	u_int8_t	keylen[2]; |
| 1146 | 	u_int8_t	replaycnt[8]; |
| 1147 | 	u_int8_t	nonce[EAPOL_KEY_NONCE_LEN]; |
| 1148 | 	u_int8_t	iv[EAPOL_KEY_IV_LEN]; |
| 1149 | 	u_int8_t	rsc[8]; |
| 1150 | 	u_int8_t	reserved[8]; |
| 1151 | 	u_int8_t	mic[EAPOL_KEY_MIC_LEN]; |
| 1152 | 	u_int8_t	paylen[2]; |
| 1153 | } __packed; |
| 1154 | |
| 1155 | /* Pairwise Transient Key (see 8.5.1.2) */ |
| 1156 | struct ieee80211_ptk { |
| 1157 | 	u_int8_t	kck[16];	/* Key Confirmation Key */ |
| 1158 | 	u_int8_t	kek[16];	/* Key Encryption Key */ |
| 1159 | 	u_int8_t	tk[32];		/* Temporal Key */ |
| 1160 | } __packed; |
| 1161 | |
| 1162 | #define IEEE80211_PMKID_LEN	16 |
| 1163 | #define IEEE80211_SMKID_LEN	16 |
| 1164 | |
| 1165 | /* |
| 1166 | * Key Data Encapsulation (see Table 62). |
| 1167 | */ |
| 1168 | enum { |
| 1169 | 	IEEE80211_KDE_GTK	= 1, |
| 1170 | 	IEEE80211_KDE_MACADDR	= 3, |
| 1171 | 	IEEE80211_KDE_PMKID	= 4, |
| 1172 | 	IEEE80211_KDE_SMK	= 5, |
| 1173 | 	IEEE80211_KDE_NONCE	= 6, |
| 1174 | 	IEEE80211_KDE_LIFETIME	= 7, |
| 1175 | 	IEEE80211_KDE_ERROR	= 8, |
| 1176 | 	IEEE80211_KDE_IGTK	= 9	/* 11w */ |
| 1177 | }; |
| 1178 | |
| 1179 | /* |
| 1180 | * HT protection modes (see 802.11-2012 8.4.2.59) |
| 1181 | */ |
| 1182 | enum ieee80211_htprot { |
| 1183 | 	IEEE80211_HTPROT_NONE = 0,	/* only 20/40MHz HT STAs exist */ |
| 1184 | 	IEEE80211_HTPROT_NONMEMBER,	/* non-HT STA overlaps our channel */ |
| 1185 | 	IEEE80211_HTPROT_20MHZ,		/* 20MHz HT STA on a 40MHz channel */ |
| 1186 | 	IEEE80211_HTPROT_NONHT_MIXED	/* non-HT STA associated to our BSS */ |
| 1187 | }; |
| 1188 | |
| 1189 | #endif /* _NET80211_IEEE80211_H_ */ |