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.
21 * Purpose: Handles the 802.11 management support functions
28 * vMgrEncodeBeacon - Encode the Beacon frame
29 * vMgrDecodeBeacon - Decode the Beacon frame
30 * vMgrEncodeIBSSATIM - Encode the IBSS ATIM frame
31 * vMgrDecodeIBSSATIM - Decode the IBSS ATIM frame
32 * vMgrEncodeDisassociation - Encode the Disassociation frame
33 * vMgrDecodeDisassociation - Decode the Disassociation frame
34 * vMgrEncodeAssocRequest - Encode the Association request frame
35 * vMgrDecodeAssocRequest - Decode the Association request frame
36 * vMgrEncodeAssocResponse - Encode the Association response frame
37 * vMgrDecodeAssocResponse - Decode the Association response frame
38 * vMgrEncodeReAssocRequest - Encode the ReAssociation request frame
39 * vMgrDecodeReAssocRequest - Decode the ReAssociation request frame
40 * vMgrEncodeProbeRequest - Encode the Probe request frame
41 * vMgrDecodeProbeRequest - Decode the Probe request frame
42 * vMgrEncodeProbeResponse - Encode the Probe response frame
43 * vMgrDecodeProbeResponse - Decode the Probe response frame
44 * vMgrEncodeAuthen - Encode the Authentication frame
45 * vMgrDecodeAuthen - Decode the Authentication frame
46 * vMgrEncodeDeauthen - Encode the DeAuthentication frame
47 * vMgrDecodeDeauthen - Decode the DeAuthentication frame
48 * vMgrEncodeReassocResponse - Encode the Reassociation response frame
49 * vMgrDecodeReassocResponse - Decode the Reassociation response frame
62 /*--------------------- Static Definitions -------------------------*/
66 /*--------------------- Static Classes ----------------------------*/
68 /*--------------------- Static Variables --------------------------*/
70 static int msglevel
= MSG_LEVEL_INFO
;
71 /*static int msglevel =MSG_LEVEL_DEBUG;*/
72 /*--------------------- Static Functions --------------------------*/
76 /*--------------------- Export Variables --------------------------*/
79 /*--------------------- Export Functions --------------------------*/
84 * Routine Description:
85 * Encode Beacon frame body offset
94 PWLAN_FR_BEACON pFrame
97 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
100 pFrame
->pqwTimestamp
= (PQWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
101 + WLAN_BEACON_OFF_TS
);
102 pFrame
->pwBeaconInterval
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
103 + WLAN_BEACON_OFF_BCN_INT
);
104 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
105 + WLAN_BEACON_OFF_CAPINFO
);
107 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_BEACON_OFF_SSID
;
114 * Routine Description:
115 * Decode Beacon frame body offset
126 PWLAN_FR_BEACON pFrame
131 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
134 pFrame
->pqwTimestamp
= (PQWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
135 + WLAN_BEACON_OFF_TS
);
136 pFrame
->pwBeaconInterval
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
137 + WLAN_BEACON_OFF_BCN_INT
);
138 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
139 + WLAN_BEACON_OFF_CAPINFO
);
141 /* Information elements */
142 pItem
= (PWLAN_IE
)((PBYTE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
)))
143 + WLAN_BEACON_OFF_SSID
);
144 while (((PBYTE
)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
146 switch (pItem
->byElementID
) {
148 if (pFrame
->pSSID
== NULL
)
149 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
151 case WLAN_EID_SUPP_RATES
:
152 if (pFrame
->pSuppRates
== NULL
)
153 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
155 case WLAN_EID_FH_PARMS
:
156 /* pFrame->pFHParms = (PWLAN_IE_FH_PARMS)pItem; */
158 case WLAN_EID_DS_PARMS
:
159 if (pFrame
->pDSParms
== NULL
)
160 pFrame
->pDSParms
= (PWLAN_IE_DS_PARMS
)pItem
;
162 case WLAN_EID_CF_PARMS
:
163 if (pFrame
->pCFParms
== NULL
)
164 pFrame
->pCFParms
= (PWLAN_IE_CF_PARMS
)pItem
;
166 case WLAN_EID_IBSS_PARMS
:
167 if (pFrame
->pIBSSParms
== NULL
)
168 pFrame
->pIBSSParms
= (PWLAN_IE_IBSS_PARMS
)pItem
;
171 if (pFrame
->pTIM
== NULL
)
172 pFrame
->pTIM
= (PWLAN_IE_TIM
)pItem
;
176 if (pFrame
->pRSN
== NULL
)
177 pFrame
->pRSN
= (PWLAN_IE_RSN
)pItem
;
179 case WLAN_EID_RSN_WPA
:
180 if (pFrame
->pRSNWPA
== NULL
) {
181 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == TRUE
)
182 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
187 if (pFrame
->pERP
== NULL
)
188 pFrame
->pERP
= (PWLAN_IE_ERP
)pItem
;
190 case WLAN_EID_EXTSUPP_RATES
:
191 if (pFrame
->pExtSuppRates
== NULL
)
192 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
195 case WLAN_EID_COUNTRY
: /* 7 */
196 if (pFrame
->pIE_Country
== NULL
)
197 pFrame
->pIE_Country
= (PWLAN_IE_COUNTRY
)pItem
;
200 case WLAN_EID_PWR_CONSTRAINT
: /* 32 */
201 if (pFrame
->pIE_PowerConstraint
== NULL
)
202 pFrame
->pIE_PowerConstraint
= (PWLAN_IE_PW_CONST
)pItem
;
205 case WLAN_EID_CH_SWITCH
: /* 37 */
206 if (pFrame
->pIE_CHSW
== NULL
)
207 pFrame
->pIE_CHSW
= (PWLAN_IE_CH_SW
)pItem
;
210 case WLAN_EID_QUIET
: /* 40 */
211 if (pFrame
->pIE_Quiet
== NULL
)
212 pFrame
->pIE_Quiet
= (PWLAN_IE_QUIET
)pItem
;
215 case WLAN_EID_IBSS_DFS
:
216 if (pFrame
->pIE_IBSSDFS
== NULL
)
217 pFrame
->pIE_IBSSDFS
= (PWLAN_IE_IBSS_DFS
)pItem
;
221 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Unrecognized EID=%dd in beacon decode.\n", pItem
->byElementID
);
225 pItem
= (PWLAN_IE
)(((PBYTE
)pItem
) + 2 + pItem
->len
);
234 * Routine Description:
246 PWLAN_FR_IBSSATIM pFrame
249 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
250 pFrame
->len
= WLAN_HDR_ADDR3_LEN
;
258 * Routine Description:
269 PWLAN_FR_IBSSATIM pFrame
272 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
280 * Routine Description:
281 * Encode Disassociation
290 vMgrEncodeDisassociation(
291 PWLAN_FR_DISASSOC pFrame
294 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
298 pFrame
->pwReason
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
299 + WLAN_DISASSOC_OFF_REASON
);
300 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_DISASSOC_OFF_REASON
+ sizeof(*(pFrame
->pwReason
));
308 * Routine Description:
309 * Decode Disassociation
318 vMgrDecodeDisassociation(
319 PWLAN_FR_DISASSOC pFrame
322 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
325 pFrame
->pwReason
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
326 + WLAN_DISASSOC_OFF_REASON
);
333 * Routine Description:
334 * Encode Association Request
344 vMgrEncodeAssocRequest(
345 PWLAN_FR_ASSOCREQ pFrame
348 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
350 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
351 + WLAN_ASSOCREQ_OFF_CAP_INFO
);
352 pFrame
->pwListenInterval
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
353 + WLAN_ASSOCREQ_OFF_LISTEN_INT
);
354 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_ASSOCREQ_OFF_LISTEN_INT
+ sizeof(*(pFrame
->pwListenInterval
));
361 * Routine Description: (AP)
362 * Decode Association Request
371 vMgrDecodeAssocRequest(
372 PWLAN_FR_ASSOCREQ pFrame
377 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
379 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
380 + WLAN_ASSOCREQ_OFF_CAP_INFO
);
381 pFrame
->pwListenInterval
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
382 + WLAN_ASSOCREQ_OFF_LISTEN_INT
);
384 /* Information elements */
385 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
386 + WLAN_ASSOCREQ_OFF_SSID
);
388 while (((PBYTE
)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
389 switch (pItem
->byElementID
) {
391 if (pFrame
->pSSID
== NULL
)
392 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
394 case WLAN_EID_SUPP_RATES
:
395 if (pFrame
->pSuppRates
== NULL
)
396 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
400 if (pFrame
->pRSN
== NULL
)
401 pFrame
->pRSN
= (PWLAN_IE_RSN
)pItem
;
403 case WLAN_EID_RSN_WPA
:
404 if (pFrame
->pRSNWPA
== NULL
) {
405 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == TRUE
)
406 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
409 case WLAN_EID_EXTSUPP_RATES
:
410 if (pFrame
->pExtSuppRates
== NULL
)
411 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
415 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Unrecognized EID=%dd in assocreq decode.\n",
419 pItem
= (PWLAN_IE
)(((PBYTE
)pItem
) + 2 + pItem
->len
);
426 * Routine Description: (AP)
427 * Encode Association Response
436 vMgrEncodeAssocResponse(
437 PWLAN_FR_ASSOCRESP pFrame
440 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
443 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
444 + WLAN_ASSOCRESP_OFF_CAP_INFO
);
445 pFrame
->pwStatus
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
446 + WLAN_ASSOCRESP_OFF_STATUS
);
447 pFrame
->pwAid
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
448 + WLAN_ASSOCRESP_OFF_AID
);
449 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_ASSOCRESP_OFF_AID
450 + sizeof(*(pFrame
->pwAid
));
458 * Routine Description:
459 * Decode Association Response
468 vMgrDecodeAssocResponse(
469 PWLAN_FR_ASSOCRESP pFrame
474 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
477 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
478 + WLAN_ASSOCRESP_OFF_CAP_INFO
);
479 pFrame
->pwStatus
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
480 + WLAN_ASSOCRESP_OFF_STATUS
);
481 pFrame
->pwAid
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
482 + WLAN_ASSOCRESP_OFF_AID
);
484 /* Information elements */
485 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
486 + WLAN_ASSOCRESP_OFF_SUPP_RATES
);
488 pItem
= (PWLAN_IE
)(pFrame
->pSuppRates
);
489 pItem
= (PWLAN_IE
)(((PBYTE
)pItem
) + 2 + pItem
->len
);
491 if ((((PBYTE
)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) && (pItem
->byElementID
== WLAN_EID_EXTSUPP_RATES
)) {
492 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
493 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"pFrame->pExtSuppRates=[%p].\n", pItem
);
495 pFrame
->pExtSuppRates
= NULL
;
503 * Routine Description:
504 * Encode Reassociation Request
513 vMgrEncodeReassocRequest(
514 PWLAN_FR_REASSOCREQ pFrame
517 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
520 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
521 + WLAN_REASSOCREQ_OFF_CAP_INFO
);
522 pFrame
->pwListenInterval
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
523 + WLAN_REASSOCREQ_OFF_LISTEN_INT
);
524 pFrame
->pAddrCurrAP
= (PIEEE_ADDR
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
525 + WLAN_REASSOCREQ_OFF_CURR_AP
);
526 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_REASSOCREQ_OFF_CURR_AP
+ sizeof(*(pFrame
->pAddrCurrAP
));
534 * Routine Description: (AP)
535 * Decode Reassociation Request
545 vMgrDecodeReassocRequest(
546 PWLAN_FR_REASSOCREQ pFrame
550 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
553 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
554 + WLAN_REASSOCREQ_OFF_CAP_INFO
);
555 pFrame
->pwListenInterval
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
556 + WLAN_REASSOCREQ_OFF_LISTEN_INT
);
557 pFrame
->pAddrCurrAP
= (PIEEE_ADDR
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
558 + WLAN_REASSOCREQ_OFF_CURR_AP
);
560 /* Information elements */
561 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
562 + WLAN_REASSOCREQ_OFF_SSID
);
564 while (((PBYTE
)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
566 switch (pItem
->byElementID
) {
568 if (pFrame
->pSSID
== NULL
)
569 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
571 case WLAN_EID_SUPP_RATES
:
572 if (pFrame
->pSuppRates
== NULL
)
573 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
577 if (pFrame
->pRSN
== NULL
)
578 pFrame
->pRSN
= (PWLAN_IE_RSN
)pItem
;
580 case WLAN_EID_RSN_WPA
:
581 if (pFrame
->pRSNWPA
== NULL
) {
582 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == TRUE
)
583 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
587 case WLAN_EID_EXTSUPP_RATES
:
588 if (pFrame
->pExtSuppRates
== NULL
)
589 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
592 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Unrecognized EID=%dd in reassocreq decode.\n",
596 pItem
= (PWLAN_IE
)(((PBYTE
)pItem
) + 2 + pItem
->len
);
605 * Routine Description:
606 * Encode Probe Request
616 vMgrEncodeProbeRequest(
617 PWLAN_FR_PROBEREQ pFrame
620 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
621 pFrame
->len
= WLAN_HDR_ADDR3_LEN
;
627 * Routine Description:
628 * Decode Probe Request
637 vMgrDecodeProbeRequest(
638 PWLAN_FR_PROBEREQ pFrame
643 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
645 /* Information elements */
646 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
)));
648 while (((PBYTE
)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
650 switch (pItem
->byElementID
) {
652 if (pFrame
->pSSID
== NULL
)
653 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
656 case WLAN_EID_SUPP_RATES
:
657 if (pFrame
->pSuppRates
== NULL
)
658 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
661 case WLAN_EID_EXTSUPP_RATES
:
662 if (pFrame
->pExtSuppRates
== NULL
)
663 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
667 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Bad EID=%dd in probereq\n", pItem
->byElementID
);
671 pItem
= (PWLAN_IE
)(((PBYTE
)pItem
) + 2 + pItem
->len
);
679 * Routine Description:
680 * Encode Probe Response
690 vMgrEncodeProbeResponse(
691 PWLAN_FR_PROBERESP pFrame
694 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
697 pFrame
->pqwTimestamp
= (PQWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
698 + WLAN_PROBERESP_OFF_TS
);
699 pFrame
->pwBeaconInterval
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
700 + WLAN_PROBERESP_OFF_BCN_INT
);
701 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
702 + WLAN_PROBERESP_OFF_CAP_INFO
);
704 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_PROBERESP_OFF_CAP_INFO
+
705 sizeof(*(pFrame
->pwCapInfo
));
714 * Routine Description:
715 * Decode Probe Response
724 vMgrDecodeProbeResponse(
725 PWLAN_FR_PROBERESP pFrame
731 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
734 pFrame
->pqwTimestamp
= (PQWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
735 + WLAN_PROBERESP_OFF_TS
);
736 pFrame
->pwBeaconInterval
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
737 + WLAN_PROBERESP_OFF_BCN_INT
);
738 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
739 + WLAN_PROBERESP_OFF_CAP_INFO
);
741 /* Information elements */
742 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
743 + WLAN_PROBERESP_OFF_SSID
);
745 while (((PBYTE
)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
746 switch (pItem
->byElementID
) {
748 if (pFrame
->pSSID
== NULL
)
749 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
751 case WLAN_EID_SUPP_RATES
:
752 if (pFrame
->pSuppRates
== NULL
)
753 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
755 case WLAN_EID_FH_PARMS
:
757 case WLAN_EID_DS_PARMS
:
758 if (pFrame
->pDSParms
== NULL
)
759 pFrame
->pDSParms
= (PWLAN_IE_DS_PARMS
)pItem
;
761 case WLAN_EID_CF_PARMS
:
762 if (pFrame
->pCFParms
== NULL
)
763 pFrame
->pCFParms
= (PWLAN_IE_CF_PARMS
)pItem
;
765 case WLAN_EID_IBSS_PARMS
:
766 if (pFrame
->pIBSSParms
== NULL
)
767 pFrame
->pIBSSParms
= (PWLAN_IE_IBSS_PARMS
)pItem
;
771 if (pFrame
->pRSN
== NULL
)
772 pFrame
->pRSN
= (PWLAN_IE_RSN
)pItem
;
774 case WLAN_EID_RSN_WPA
:
775 if (pFrame
->pRSNWPA
== NULL
) {
776 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == TRUE
)
777 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
781 if (pFrame
->pERP
== NULL
)
782 pFrame
->pERP
= (PWLAN_IE_ERP
)pItem
;
784 case WLAN_EID_EXTSUPP_RATES
:
785 if (pFrame
->pExtSuppRates
== NULL
)
786 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
789 case WLAN_EID_COUNTRY
: /* 7 */
790 if (pFrame
->pIE_Country
== NULL
)
791 pFrame
->pIE_Country
= (PWLAN_IE_COUNTRY
)pItem
;
794 case WLAN_EID_PWR_CONSTRAINT
: /* 32 */
795 if (pFrame
->pIE_PowerConstraint
== NULL
)
796 pFrame
->pIE_PowerConstraint
= (PWLAN_IE_PW_CONST
)pItem
;
799 case WLAN_EID_CH_SWITCH
: /* 37 */
800 if (pFrame
->pIE_CHSW
== NULL
)
801 pFrame
->pIE_CHSW
= (PWLAN_IE_CH_SW
)pItem
;
804 case WLAN_EID_QUIET
: /* 40 */
805 if (pFrame
->pIE_Quiet
== NULL
)
806 pFrame
->pIE_Quiet
= (PWLAN_IE_QUIET
)pItem
;
809 case WLAN_EID_IBSS_DFS
:
810 if (pFrame
->pIE_IBSSDFS
== NULL
)
811 pFrame
->pIE_IBSSDFS
= (PWLAN_IE_IBSS_DFS
)pItem
;
815 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Bad EID=%dd in proberesp\n", pItem
->byElementID
);
819 pItem
= (PWLAN_IE
)(((PBYTE
)pItem
) + 2 + pItem
->len
);
827 * Routine Description:
828 * Encode Authentication frame
838 PWLAN_FR_AUTHEN pFrame
841 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
844 pFrame
->pwAuthAlgorithm
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
845 + WLAN_AUTHEN_OFF_AUTH_ALG
);
846 pFrame
->pwAuthSequence
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
847 + WLAN_AUTHEN_OFF_AUTH_SEQ
);
848 pFrame
->pwStatus
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
849 + WLAN_AUTHEN_OFF_STATUS
);
850 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_AUTHEN_OFF_STATUS
+ sizeof(*(pFrame
->pwStatus
));
857 * Routine Description:
858 * Decode Authentication
868 PWLAN_FR_AUTHEN pFrame
873 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
876 pFrame
->pwAuthAlgorithm
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
877 + WLAN_AUTHEN_OFF_AUTH_ALG
);
878 pFrame
->pwAuthSequence
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
879 + WLAN_AUTHEN_OFF_AUTH_SEQ
);
880 pFrame
->pwStatus
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
881 + WLAN_AUTHEN_OFF_STATUS
);
883 /* Information elements */
884 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
885 + WLAN_AUTHEN_OFF_CHALLENGE
);
887 if ((((PBYTE
)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) && (pItem
->byElementID
== WLAN_EID_CHALLENGE
))
888 pFrame
->pChallenge
= (PWLAN_IE_CHALLENGE
)pItem
;
895 * Routine Description:
896 * Encode Authentication
906 PWLAN_FR_DEAUTHEN pFrame
909 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
912 pFrame
->pwReason
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
913 + WLAN_DEAUTHEN_OFF_REASON
);
914 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_DEAUTHEN_OFF_REASON
+ sizeof(*(pFrame
->pwReason
));
921 * Routine Description:
922 * Decode Deauthentication
932 PWLAN_FR_DEAUTHEN pFrame
935 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
938 pFrame
->pwReason
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
939 + WLAN_DEAUTHEN_OFF_REASON
);
946 * Routine Description: (AP)
947 * Encode Reassociation Response
956 vMgrEncodeReassocResponse(
957 PWLAN_FR_REASSOCRESP pFrame
960 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
963 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
964 + WLAN_REASSOCRESP_OFF_CAP_INFO
);
965 pFrame
->pwStatus
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
966 + WLAN_REASSOCRESP_OFF_STATUS
);
967 pFrame
->pwAid
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
968 + WLAN_REASSOCRESP_OFF_AID
);
970 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_REASSOCRESP_OFF_AID
+ sizeof(*(pFrame
->pwAid
));
977 * Routine Description:
978 * Decode Reassociation Response
988 vMgrDecodeReassocResponse(
989 PWLAN_FR_REASSOCRESP pFrame
994 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
997 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
998 + WLAN_REASSOCRESP_OFF_CAP_INFO
);
999 pFrame
->pwStatus
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
1000 + WLAN_REASSOCRESP_OFF_STATUS
);
1001 pFrame
->pwAid
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
1002 + WLAN_REASSOCRESP_OFF_AID
);
1004 /* Information elements */
1005 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
1006 + WLAN_REASSOCRESP_OFF_SUPP_RATES
);
1008 pItem
= (PWLAN_IE
)(pFrame
->pSuppRates
);
1009 pItem
= (PWLAN_IE
)(((PBYTE
)pItem
) + 2 + pItem
->len
);
1011 if ((((PBYTE
)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) && (pItem
->byElementID
== WLAN_EID_EXTSUPP_RATES
))
1012 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;