2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 * Purpose: 802.11 management frames pre-defines.
31 #ifndef __80211MGR_H__
32 #define __80211MGR_H__
36 #define WLAN_MIN_ARRAY 1
38 /* Information Element ID value */
39 #define WLAN_EID_SSID 0
40 #define WLAN_EID_SUPP_RATES 1
41 #define WLAN_EID_FH_PARMS 2
42 #define WLAN_EID_DS_PARMS 3
43 #define WLAN_EID_CF_PARMS 4
44 #define WLAN_EID_TIM 5
45 #define WLAN_EID_IBSS_PARMS 6
46 #define WLAN_EID_COUNTRY 7
47 #define WLAN_EID_CHALLENGE 16
48 #define WLAN_EID_PWR_CONSTRAINT 32
49 #define WLAN_EID_PWR_CAPABILITY 33
50 #define WLAN_EID_TPC_REQ 34
51 #define WLAN_EID_TPC_REP 35
52 #define WLAN_EID_SUPP_CH 36
53 #define WLAN_EID_CH_SWITCH 37
54 #define WLAN_EID_MEASURE_REQ 38
55 #define WLAN_EID_MEASURE_REP 39
56 #define WLAN_EID_QUIET 40
57 #define WLAN_EID_IBSS_DFS 41
58 #define WLAN_EID_ERP 42
59 /* reference 802.11i 7.3.2 table 20 */
60 #define WLAN_EID_RSN 48
61 #define WLAN_EID_EXTSUPP_RATES 50
62 /* reference WiFi WPA spec */
63 #define WLAN_EID_RSN_WPA 221
66 #define WLAN_EID_CCX 133
67 #define WLAN_EID_CCX_IP 149
68 #define WLAN_EID_CCX_Ver 221
71 #define WLAN_EID_ERP_NONERP_PRESENT 0x01
72 #define WLAN_EID_ERP_USE_PROTECTION 0x02
73 #define WLAN_EID_ERP_BARKER_MODE 0x04
76 #define WLAN_MGMT_REASON_RSVD 0
77 #define WLAN_MGMT_REASON_UNSPEC 1
78 #define WLAN_MGMT_REASON_PRIOR_AUTH_INVALID 2
79 #define WLAN_MGMT_REASON_DEAUTH_LEAVING 3
80 #define WLAN_MGMT_REASON_DISASSOC_INACTIVE 4
81 #define WLAN_MGMT_REASON_DISASSOC_AP_BUSY 5
82 #define WLAN_MGMT_REASON_CLASS2_NONAUTH 6
83 #define WLAN_MGMT_REASON_CLASS3_NONASSOC 7
84 #define WLAN_MGMT_REASON_DISASSOC_STA_HASLEFT 8
85 #define WLAN_MGMT_REASON_CANT_ASSOC_NONAUTH 9
86 #define WLAN_MGMT_REASON_DISASSOC_PWR_CAP_UNACCEPT 10
87 #define WLAN_MGMT_REASON_DISASSOC_SUPP_CH_UNACCEPT 11
88 #define WLAN_MGMT_REASON_INVALID_IE 13
89 #define WLAN_MGMT_REASON_MIC_FAILURE 14
90 #define WLAN_MGMT_REASON_4WAY_HANDSHAKE_TIMEOUT 15
91 #define WLAN_MGMT_REASON_GRPKEY_UPDATE_TIMEOUT 16
92 #define WLAN_MGMT_REASON_4WAY_INFO_DIFFERENT 17
93 #define WLAN_MGMT_REASON_MULTCAST_CIPHER_INVALID 18
94 #define WLAN_MGMT_REASON_UNCAST_CIPHER_INVALID 19
95 #define WLAN_MGMT_REASON_AKMP_INVALID 20
96 #define WLAN_MGMT_REASON_RSNE_UNSUPPORTED 21
97 #define WLAN_MGMT_REASON_RSNE_CAP_INVALID 22
98 #define WLAN_MGMT_REASON_80211X_AUTH_FAILED 23
101 #define WLAN_MGMT_STATUS_SUCCESS 0
102 #define WLAN_MGMT_STATUS_UNSPEC_FAILURE 1
103 #define WLAN_MGMT_STATUS_CAPS_UNSUPPORTED 10
104 #define WLAN_MGMT_STATUS_REASSOC_NO_ASSOC 11
105 #define WLAN_MGMT_STATUS_ASSOC_DENIED_UNSPEC 12
106 #define WLAN_MGMT_STATUS_UNSUPPORTED_AUTHALG 13
107 #define WLAN_MGMT_STATUS_RX_AUTH_NOSEQ 14
108 #define WLAN_MGMT_STATUS_CHALLENGE_FAIL 15
109 #define WLAN_MGMT_STATUS_AUTH_TIMEOUT 16
110 #define WLAN_MGMT_STATUS_ASSOC_DENIED_BUSY 17
111 #define WLAN_MGMT_STATUS_ASSOC_DENIED_RATES 18
112 #define WLAN_MGMT_STATUS_ASSOC_DENIED_SHORTPREAMBLE 19
113 #define WLAN_MGMT_STATUS_ASSOC_DENIED_PBCC 20
114 #define WLAN_MGMT_STATUS_ASSOC_DENIED_AGILITY 21
116 /* reference 802.11h 7.3.1.9 */
117 #define WLAN_MGMT_STATUS_ASSOC_REJECT_BCS_SPECTRUM_MNG 22
118 #define WLAN_MGMT_STATUS_ASSOC_REJECT_BCS_PWR_CAP 23
119 #define WLAN_MGMT_STATUS_ASSOC_REJECT_BCS_SUPP_CH 24
121 /* reference 802.11g 7.3.1.9 */
122 #define WLAN_MGMT_STATUS_SHORTSLOTTIME_UNSUPPORTED 25
123 #define WLAN_MGMT_STATUS_DSSSOFDM_UNSUPPORTED 26
125 /* reference 802.11i 7.3.1.9 table 19 */
126 #define WLAN_MGMT_STATUS_INVALID_IE 40
127 #define WLAN_MGMT_STATUS_GROUP_CIPHER_INVALID 41
128 #define WLAN_MGMT_STATUS_PAIRWISE_CIPHER_INVALID 42
129 #define WLAN_MGMT_STATUS_AKMP_INVALID 43
130 #define WLAN_MGMT_STATUS_UNSUPPORT_RSN_IE_VER 44
131 #define WLAN_MGMT_STATUS_INVALID_RSN_IE_CAP 45
132 #define WLAN_MGMT_STATUS_CIPHER_REJECT 46
135 #define WLAN_AUTH_ALG_OPENSYSTEM 0
136 #define WLAN_AUTH_ALG_SHAREDKEY 1
138 /* management frame field offsets */
141 * Note: Not all fields are listed because of variable lengths
142 * Note: These offsets are from the start of the frame data
145 #define WLAN_BEACON_OFF_TS 0
146 #define WLAN_BEACON_OFF_BCN_INT 8
147 #define WLAN_BEACON_OFF_CAPINFO 10
148 #define WLAN_BEACON_OFF_SSID 12
150 #define WLAN_DISASSOC_OFF_REASON 0
152 #define WLAN_ASSOCREQ_OFF_CAP_INFO 0
153 #define WLAN_ASSOCREQ_OFF_LISTEN_INT 2
154 #define WLAN_ASSOCREQ_OFF_SSID 4
156 #define WLAN_ASSOCRESP_OFF_CAP_INFO 0
157 #define WLAN_ASSOCRESP_OFF_STATUS 2
158 #define WLAN_ASSOCRESP_OFF_AID 4
159 #define WLAN_ASSOCRESP_OFF_SUPP_RATES 6
161 #define WLAN_REASSOCREQ_OFF_CAP_INFO 0
162 #define WLAN_REASSOCREQ_OFF_LISTEN_INT 2
163 #define WLAN_REASSOCREQ_OFF_CURR_AP 4
164 #define WLAN_REASSOCREQ_OFF_SSID 10
166 #define WLAN_REASSOCRESP_OFF_CAP_INFO 0
167 #define WLAN_REASSOCRESP_OFF_STATUS 2
168 #define WLAN_REASSOCRESP_OFF_AID 4
169 #define WLAN_REASSOCRESP_OFF_SUPP_RATES 6
171 #define WLAN_PROBEREQ_OFF_SSID 0
173 #define WLAN_PROBERESP_OFF_TS 0
174 #define WLAN_PROBERESP_OFF_BCN_INT 8
175 #define WLAN_PROBERESP_OFF_CAP_INFO 10
176 #define WLAN_PROBERESP_OFF_SSID 12
178 #define WLAN_AUTHEN_OFF_AUTH_ALG 0
179 #define WLAN_AUTHEN_OFF_AUTH_SEQ 2
180 #define WLAN_AUTHEN_OFF_STATUS 4
181 #define WLAN_AUTHEN_OFF_CHALLENGE 6
183 #define WLAN_DEAUTHEN_OFF_REASON 0
185 /* cipher suite selectors defined in 802.11i */
186 #define WLAN_11i_CSS_USE_GROUP 0
187 #define WLAN_11i_CSS_WEP40 1
188 #define WLAN_11i_CSS_TKIP 2
189 #define WLAN_11i_CSS_CCMP 4
190 #define WLAN_11i_CSS_WEP104 5
191 #define WLAN_11i_CSS_UNKNOWN 255
193 /* authentication and key management suite selectors defined in 802.11i */
194 #define WLAN_11i_AKMSS_802_1X 1
195 #define WLAN_11i_AKMSS_PSK 2
196 #define WLAN_11i_AKMSS_UNKNOWN 255
198 /* measurement type definitions reference IEEE 802.11h table 20b */
199 #define MEASURE_TYPE_BASIC 0
200 #define MEASURE_TYPE_CCA 1
201 #define MEASURE_TYPE_RPI 2
203 /* measurement request mode definitions reference IEEE 802.11h figure 46h */
204 #define MEASURE_MODE_ENABLE 0x02
205 #define MEASURE_MODE_REQ 0x04
206 #define MEASURE_MODE_REP 0x08
208 /* measurement report mode definitions reference IEEE 802.11h figure 46m */
209 #define MEASURE_MODE_LATE 0x01
210 #define MEASURE_MODE_INCAPABLE 0x02
211 #define MEASURE_MODE_REFUSED 0x04
213 /* Information Element types */
216 typedef struct tagWLAN_IE
{
219 } __attribute__ ((__packed__
))
222 /* Service Set IDentity (SSID) */
224 typedef struct tagWLAN_IE_SSID
{
228 } __attribute__ ((__packed__
))
229 WLAN_IE_SSID
, *PWLAN_IE_SSID
;
231 /* Supported Rates */
233 typedef struct tagWLAN_IE_SUPP_RATES
{
237 } __attribute__ ((__packed__
))
238 WLAN_IE_SUPP_RATES
, *PWLAN_IE_SUPP_RATES
;
240 /* FH Parameter Set */
242 typedef struct _WLAN_IE_FH_PARMS
{
249 } WLAN_IE_FH_PARMS
, *PWLAN_IE_FH_PARMS
;
251 /* DS Parameter Set */
253 typedef struct tagWLAN_IE_DS_PARMS
{
257 } __attribute__ ((__packed__
))
258 WLAN_IE_DS_PARMS
, *PWLAN_IE_DS_PARMS
;
260 /* CF Parameter Set */
262 typedef struct tagWLAN_IE_CF_PARMS
{
268 u16 wCFPDurRemaining
;
269 } __attribute__ ((__packed__
))
270 WLAN_IE_CF_PARMS
, *PWLAN_IE_CF_PARMS
;
274 typedef struct tagWLAN_IE_TIM
{
281 } __attribute__ ((__packed__
))
282 WLAN_IE_TIM
, *PWLAN_IE_TIM
;
284 /* IBSS Parameter Set */
286 typedef struct tagWLAN_IE_IBSS_PARMS
{
290 } __attribute__ ((__packed__
))
291 WLAN_IE_IBSS_PARMS
, *PWLAN_IE_IBSS_PARMS
;
295 typedef struct tagWLAN_IE_CHALLENGE
{
299 } __attribute__ ((__packed__
))
300 WLAN_IE_CHALLENGE
, *PWLAN_IE_CHALLENGE
;
303 typedef struct tagWLAN_IE_RSN_EXT
{
313 /* the rest is variable so need to overlay ieauth structure */
314 } WLAN_IE_RSN_EXT
, *PWLAN_IE_RSN_EXT
;
317 typedef struct tagWLAN_IE_RSN_AUTH
{
322 } WLAN_IE_RSN_AUTH
, *PWLAN_IE_RSN_AUTH
;
326 typedef struct tagWLAN_IE_RSN
{
330 u8 abyRSN
[WLAN_MIN_ARRAY
];
331 } WLAN_IE_RSN
, *PWLAN_IE_RSN
;
333 /* CCX Identity DavidWang */
335 typedef struct tagWLAN_IE_CCX
{
339 } WLAN_IE_CCX
, *PWLAN_IE_CCX
;
341 typedef struct tagWLAN_IE_CCX_IP
{
347 } WLAN_IE_CCX_IP
, *PWLAN_IE_CCX_IP
;
349 typedef struct tagWLAN_IE_CCX_Ver
{
353 } WLAN_IE_CCX_Ver
, *PWLAN_IE_CCX_Ver
;
357 typedef struct tagWLAN_IE_ERP
{
361 } __attribute__ ((__packed__
))
362 WLAN_IE_ERP
, *PWLAN_IE_ERP
;
365 typedef struct _MEASEURE_REQ
{
369 } MEASEURE_REQ
, *PMEASEURE_REQ
,
370 MEASEURE_REQ_BASIC
, *PMEASEURE_REQ_BASIC
,
371 MEASEURE_REQ_CCA
, *PMEASEURE_REQ_CCA
,
372 MEASEURE_REQ_RPI
, *PMEASEURE_REQ_RPI
;
374 typedef struct _MEASEURE_REP_BASIC
{
379 } MEASEURE_REP_BASIC
, *PMEASEURE_REP_BASIC
;
381 typedef struct _MEASEURE_REP_CCA
{
385 u8 byCCABusyFraction
;
386 } MEASEURE_REP_CCA
, *PMEASEURE_REP_CCA
;
388 typedef struct _MEASEURE_REP_RPI
{
393 } MEASEURE_REP_RPI
, *PMEASEURE_REP_RPI
;
395 typedef union _MEASEURE_REP
{
397 MEASEURE_REP_BASIC sBasic
;
398 MEASEURE_REP_CCA sCCA
;
399 MEASEURE_REP_RPI sRPI
;
401 } MEASEURE_REP
, *PMEASEURE_REP
;
403 typedef struct _WLAN_IE_MEASURE_REQ
{
410 } WLAN_IE_MEASURE_REQ
, *PWLAN_IE_MEASURE_REQ
;
412 typedef struct _WLAN_IE_MEASURE_REP
{
419 } WLAN_IE_MEASURE_REP
, *PWLAN_IE_MEASURE_REP
;
421 typedef struct _WLAN_IE_CH_SW
{
427 } WLAN_IE_CH_SW
, *PWLAN_IE_CH_SW
;
429 typedef struct _WLAN_IE_QUIET
{
434 u8 abyQuietDuration
[2];
435 u8 abyQuietOffset
[2];
436 } WLAN_IE_QUIET
, *PWLAN_IE_QUIET
;
438 typedef struct _WLAN_IE_COUNTRY
{
441 u8 abyCountryString
[3];
442 u8 abyCountryInfo
[3];
443 } WLAN_IE_COUNTRY
, *PWLAN_IE_COUNTRY
;
445 typedef struct _WLAN_IE_PW_CONST
{
449 } WLAN_IE_PW_CONST
, *PWLAN_IE_PW_CONST
;
451 typedef struct _WLAN_IE_PW_CAP
{
456 } WLAN_IE_PW_CAP
, *PWLAN_IE_PW_CAP
;
458 typedef struct _WLAN_IE_SUPP_CH
{
461 u8 abyChannelTuple
[2];
462 } WLAN_IE_SUPP_CH
, *PWLAN_IE_SUPP_CH
;
464 typedef struct _WLAN_IE_TPC_REQ
{
467 } WLAN_IE_TPC_REQ
, *PWLAN_IE_TPC_REQ
;
469 typedef struct _WLAN_IE_TPC_REP
{
474 } WLAN_IE_TPC_REP
, *PWLAN_IE_TPC_REP
;
476 typedef struct _WLAN_IE_IBSS_DFS
{
482 } WLAN_IE_IBSS_DFS
, *PWLAN_IE_IBSS_DFS
;
488 /* prototype structure, all mgmt frame types will start with these members */
489 typedef struct tagWLAN_FR_MGMT
{
494 PUWLAN_80211HDR pHdr
;
496 } WLAN_FR_MGMT
, *PWLAN_FR_MGMT
;
499 typedef struct tagWLAN_FR_BEACON
{
504 PUWLAN_80211HDR pHdr
;
507 u16
* pwBeaconInterval
;
511 PWLAN_IE_SUPP_RATES pSuppRates
;
512 /* PWLAN_IE_FH_PARMS pFHParms; */
513 PWLAN_IE_DS_PARMS pDSParms
;
514 PWLAN_IE_CF_PARMS pCFParms
;
516 PWLAN_IE_IBSS_PARMS pIBSSParms
;
518 PWLAN_IE_RSN_EXT pRSNWPA
;
520 PWLAN_IE_SUPP_RATES pExtSuppRates
;
521 PWLAN_IE_COUNTRY pIE_Country
;
522 PWLAN_IE_PW_CONST pIE_PowerConstraint
;
523 PWLAN_IE_CH_SW pIE_CHSW
;
524 PWLAN_IE_IBSS_DFS pIE_IBSSDFS
;
525 PWLAN_IE_QUIET pIE_Quiet
;
527 } WLAN_FR_BEACON
, *PWLAN_FR_BEACON
;
529 /* IBSS ATIM frame */
530 typedef struct tagWLAN_FR_IBSSATIM
{
535 PUWLAN_80211HDR pHdr
;
539 /* this frame type has a null body */
541 } WLAN_FR_IBSSATIM
, *PWLAN_FR_IBSSATIM
;
544 typedef struct tagWLAN_FR_DISASSOC
{
549 PUWLAN_80211HDR pHdr
;
554 } WLAN_FR_DISASSOC
, *PWLAN_FR_DISASSOC
;
556 /* association request */
557 typedef struct tagWLAN_FR_ASSOCREQ
{
562 PUWLAN_80211HDR pHdr
;
565 u16
* pwListenInterval
;
568 PWLAN_IE_SUPP_RATES pSuppRates
;
571 PWLAN_IE_CCX_IP pCCXIP
;
572 PWLAN_IE_CCX_Ver pCCXVER
;
573 PWLAN_IE_RSN_EXT pRSNWPA
;
574 PWLAN_IE_SUPP_RATES pExtSuppRates
;
575 PWLAN_IE_PW_CAP pCurrPowerCap
;
576 PWLAN_IE_SUPP_CH pCurrSuppCh
;
578 } WLAN_FR_ASSOCREQ
, *PWLAN_FR_ASSOCREQ
;
580 /* association response */
581 typedef struct tagWLAN_FR_ASSOCRESP
{
586 PUWLAN_80211HDR pHdr
;
592 PWLAN_IE_SUPP_RATES pSuppRates
;
593 PWLAN_IE_SUPP_RATES pExtSuppRates
;
595 } WLAN_FR_ASSOCRESP
, *PWLAN_FR_ASSOCRESP
;
597 /* reassociation request */
598 typedef struct tagWLAN_FR_REASSOCREQ
{
603 PUWLAN_80211HDR pHdr
;
607 u16
* pwListenInterval
;
608 PIEEE_ADDR pAddrCurrAP
;
612 PWLAN_IE_SUPP_RATES pSuppRates
;
615 PWLAN_IE_CCX_IP pCCXIP
;
616 PWLAN_IE_CCX_Ver pCCXVER
;
617 PWLAN_IE_RSN_EXT pRSNWPA
;
618 PWLAN_IE_SUPP_RATES pExtSuppRates
;
620 } WLAN_FR_REASSOCREQ
, *PWLAN_FR_REASSOCREQ
;
622 /* reassociation response */
623 typedef struct tagWLAN_FR_REASSOCRESP
{
628 PUWLAN_80211HDR pHdr
;
634 PWLAN_IE_SUPP_RATES pSuppRates
;
635 PWLAN_IE_SUPP_RATES pExtSuppRates
;
637 } WLAN_FR_REASSOCRESP
, *PWLAN_FR_REASSOCRESP
;
640 typedef struct tagWLAN_FR_PROBEREQ
{
645 PUWLAN_80211HDR pHdr
;
649 PWLAN_IE_SUPP_RATES pSuppRates
;
650 PWLAN_IE_SUPP_RATES pExtSuppRates
;
652 } WLAN_FR_PROBEREQ
, *PWLAN_FR_PROBEREQ
;
655 typedef struct tagWLAN_FR_PROBERESP
{
660 PUWLAN_80211HDR pHdr
;
663 u16
* pwBeaconInterval
;
667 PWLAN_IE_SUPP_RATES pSuppRates
;
668 PWLAN_IE_DS_PARMS pDSParms
;
669 PWLAN_IE_CF_PARMS pCFParms
;
670 PWLAN_IE_IBSS_PARMS pIBSSParms
;
672 PWLAN_IE_RSN_EXT pRSNWPA
;
674 PWLAN_IE_SUPP_RATES pExtSuppRates
;
675 PWLAN_IE_COUNTRY pIE_Country
;
676 PWLAN_IE_PW_CONST pIE_PowerConstraint
;
677 PWLAN_IE_CH_SW pIE_CHSW
;
678 PWLAN_IE_IBSS_DFS pIE_IBSSDFS
;
679 PWLAN_IE_QUIET pIE_Quiet
;
681 } WLAN_FR_PROBERESP
, *PWLAN_FR_PROBERESP
;
684 typedef struct tagWLAN_FR_AUTHEN
{
689 PUWLAN_80211HDR pHdr
;
691 u16
* pwAuthAlgorithm
;
692 u16
* pwAuthSequence
;
695 PWLAN_IE_CHALLENGE pChallenge
;
697 } WLAN_FR_AUTHEN
, *PWLAN_FR_AUTHEN
;
699 /* deauthentication */
700 typedef struct tagWLAN_FR_DEAUTHEN
{
705 PUWLAN_80211HDR pHdr
;
711 } WLAN_FR_DEAUTHEN
, *PWLAN_FR_DEAUTHEN
;
715 PWLAN_FR_BEACON pFrame
720 PWLAN_FR_BEACON pFrame
724 vMgrEncodeDisassociation(
725 PWLAN_FR_DISASSOC pFrame
729 vMgrDecodeDisassociation(
730 PWLAN_FR_DISASSOC pFrame
734 vMgrEncodeAssocRequest(
735 PWLAN_FR_ASSOCREQ pFrame
739 vMgrDecodeAssocRequest(
740 PWLAN_FR_ASSOCREQ pFrame
744 vMgrEncodeAssocResponse(
745 PWLAN_FR_ASSOCRESP pFrame
749 vMgrDecodeAssocResponse(
750 PWLAN_FR_ASSOCRESP pFrame
754 vMgrEncodeReassocRequest(
755 PWLAN_FR_REASSOCREQ pFrame
759 vMgrDecodeReassocRequest(
760 PWLAN_FR_REASSOCREQ pFrame
764 vMgrEncodeProbeRequest(
765 PWLAN_FR_PROBEREQ pFrame
769 vMgrDecodeProbeRequest(
770 PWLAN_FR_PROBEREQ pFrame
774 vMgrEncodeProbeResponse(
775 PWLAN_FR_PROBERESP pFrame
779 vMgrDecodeProbeResponse(
780 PWLAN_FR_PROBERESP pFrame
785 PWLAN_FR_AUTHEN pFrame
790 PWLAN_FR_AUTHEN pFrame
795 PWLAN_FR_DEAUTHEN pFrame
800 PWLAN_FR_DEAUTHEN pFrame
804 vMgrEncodeReassocResponse(
805 PWLAN_FR_REASSOCRESP pFrame
808 #endif /* __80211MGR_H__ */