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
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
103 + WLAN_BEACON_OFF_BCN_INT
);
104 pFrame
->pwCapInfo
= (unsigned short *)(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
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
137 + WLAN_BEACON_OFF_BCN_INT
);
138 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
139 + WLAN_BEACON_OFF_CAPINFO
);
141 // Information elements
142 pItem
= (PWLAN_IE
)((unsigned char *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
)))
143 + WLAN_BEACON_OFF_SSID
);
144 while( ((unsigned char *)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
;
180 case WLAN_EID_RSN_WPA
:
181 if (pFrame
->pRSNWPA
== NULL
) {
182 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == true)
183 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
188 if (pFrame
->pERP
== NULL
)
189 pFrame
->pERP
= (PWLAN_IE_ERP
)pItem
;
191 case WLAN_EID_EXTSUPP_RATES
:
192 if (pFrame
->pExtSuppRates
== NULL
)
193 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
196 case WLAN_EID_COUNTRY
: //7
197 if (pFrame
->pIE_Country
== NULL
)
198 pFrame
->pIE_Country
= (PWLAN_IE_COUNTRY
)pItem
;
201 case WLAN_EID_PWR_CONSTRAINT
: //32
202 if (pFrame
->pIE_PowerConstraint
== NULL
)
203 pFrame
->pIE_PowerConstraint
= (PWLAN_IE_PW_CONST
)pItem
;
206 case WLAN_EID_CH_SWITCH
: //37
207 if (pFrame
->pIE_CHSW
== NULL
)
208 pFrame
->pIE_CHSW
= (PWLAN_IE_CH_SW
)pItem
;
211 case WLAN_EID_QUIET
: //40
212 if (pFrame
->pIE_Quiet
== NULL
)
213 pFrame
->pIE_Quiet
= (PWLAN_IE_QUIET
)pItem
;
216 case WLAN_EID_IBSS_DFS
:
217 if (pFrame
->pIE_IBSSDFS
== NULL
)
218 pFrame
->pIE_IBSSDFS
= (PWLAN_IE_IBSS_DFS
)pItem
;
222 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Unrecognized EID=%dd in beacon decode.\n", pItem
->byElementID
);
226 pItem
= (PWLAN_IE
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
235 * Routine Description:
247 PWLAN_FR_IBSSATIM pFrame
250 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
251 pFrame
->len
= WLAN_HDR_ADDR3_LEN
;
259 * Routine Description:
270 PWLAN_FR_IBSSATIM pFrame
273 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
281 * Routine Description:
282 * Encode Disassociation
291 vMgrEncodeDisassociation(
292 PWLAN_FR_DISASSOC pFrame
295 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
299 pFrame
->pwReason
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
300 + WLAN_DISASSOC_OFF_REASON
);
301 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_DISASSOC_OFF_REASON
+ sizeof(*(pFrame
->pwReason
));
309 * Routine Description:
310 * Decode Disassociation
319 vMgrDecodeDisassociation(
320 PWLAN_FR_DISASSOC pFrame
323 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
326 pFrame
->pwReason
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
327 + WLAN_DISASSOC_OFF_REASON
);
334 * Routine Description:
335 * Encode Association Request
345 vMgrEncodeAssocRequest(
346 PWLAN_FR_ASSOCREQ pFrame
349 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
351 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
352 + WLAN_ASSOCREQ_OFF_CAP_INFO
);
353 pFrame
->pwListenInterval
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
354 + WLAN_ASSOCREQ_OFF_LISTEN_INT
);
355 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_ASSOCREQ_OFF_LISTEN_INT
+ sizeof(*(pFrame
->pwListenInterval
));
362 * Routine Description: (AP)
363 * Decode Association Request
372 vMgrDecodeAssocRequest(
373 PWLAN_FR_ASSOCREQ pFrame
378 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
380 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
381 + WLAN_ASSOCREQ_OFF_CAP_INFO
);
382 pFrame
->pwListenInterval
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
383 + WLAN_ASSOCREQ_OFF_LISTEN_INT
);
385 // Information elements
386 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
387 + WLAN_ASSOCREQ_OFF_SSID
);
389 while (((unsigned char *)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
390 switch (pItem
->byElementID
){
392 if (pFrame
->pSSID
== NULL
)
393 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
395 case WLAN_EID_SUPP_RATES
:
396 if (pFrame
->pSuppRates
== NULL
)
397 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
401 if (pFrame
->pRSN
== NULL
) {
402 pFrame
->pRSN
= (PWLAN_IE_RSN
)pItem
;
405 case WLAN_EID_RSN_WPA
:
406 if (pFrame
->pRSNWPA
== NULL
) {
407 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == true)
408 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
411 case WLAN_EID_EXTSUPP_RATES
:
412 if (pFrame
->pExtSuppRates
== NULL
)
413 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
417 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Unrecognized EID=%dd in assocreq decode.\n",
421 pItem
= (PWLAN_IE
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
428 * Routine Description: (AP)
429 * Encode Association Response
438 vMgrEncodeAssocResponse(
439 PWLAN_FR_ASSOCRESP pFrame
442 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
445 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
446 + WLAN_ASSOCRESP_OFF_CAP_INFO
);
447 pFrame
->pwStatus
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
448 + WLAN_ASSOCRESP_OFF_STATUS
);
449 pFrame
->pwAid
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
450 + WLAN_ASSOCRESP_OFF_AID
);
451 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_ASSOCRESP_OFF_AID
452 + sizeof(*(pFrame
->pwAid
));
460 * Routine Description:
461 * Decode Association Response
470 vMgrDecodeAssocResponse(
471 PWLAN_FR_ASSOCRESP pFrame
476 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
479 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
480 + WLAN_ASSOCRESP_OFF_CAP_INFO
);
481 pFrame
->pwStatus
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
482 + WLAN_ASSOCRESP_OFF_STATUS
);
483 pFrame
->pwAid
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
484 + WLAN_ASSOCRESP_OFF_AID
);
486 // Information elements
487 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
488 + WLAN_ASSOCRESP_OFF_SUPP_RATES
);
490 pItem
= (PWLAN_IE
)(pFrame
->pSuppRates
);
491 pItem
= (PWLAN_IE
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
493 if ((((unsigned char *)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) &&
494 (pItem
->byElementID
== WLAN_EID_EXTSUPP_RATES
)) {
495 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
496 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"pFrame->pExtSuppRates=[%p].\n", pItem
);
499 pFrame
->pExtSuppRates
= NULL
;
507 * Routine Description:
508 * Encode Reassociation Request
517 vMgrEncodeReassocRequest(
518 PWLAN_FR_REASSOCREQ pFrame
521 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
524 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
525 + WLAN_REASSOCREQ_OFF_CAP_INFO
);
526 pFrame
->pwListenInterval
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
527 + WLAN_REASSOCREQ_OFF_LISTEN_INT
);
528 pFrame
->pAddrCurrAP
= (PIEEE_ADDR
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
529 + WLAN_REASSOCREQ_OFF_CURR_AP
);
530 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_REASSOCREQ_OFF_CURR_AP
+ sizeof(*(pFrame
->pAddrCurrAP
));
538 * Routine Description: (AP)
539 * Decode Reassociation Request
549 vMgrDecodeReassocRequest(
550 PWLAN_FR_REASSOCREQ pFrame
554 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
557 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
558 + WLAN_REASSOCREQ_OFF_CAP_INFO
);
559 pFrame
->pwListenInterval
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
560 + WLAN_REASSOCREQ_OFF_LISTEN_INT
);
561 pFrame
->pAddrCurrAP
= (PIEEE_ADDR
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
562 + WLAN_REASSOCREQ_OFF_CURR_AP
);
564 // Information elements
565 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
566 + WLAN_REASSOCREQ_OFF_SSID
);
568 while(((unsigned char *)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
570 switch (pItem
->byElementID
){
572 if (pFrame
->pSSID
== NULL
)
573 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
575 case WLAN_EID_SUPP_RATES
:
576 if (pFrame
->pSuppRates
== NULL
)
577 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
581 if (pFrame
->pRSN
== NULL
) {
582 pFrame
->pRSN
= (PWLAN_IE_RSN
)pItem
;
585 case WLAN_EID_RSN_WPA
:
586 if (pFrame
->pRSNWPA
== NULL
) {
587 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == true)
588 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
592 case WLAN_EID_EXTSUPP_RATES
:
593 if (pFrame
->pExtSuppRates
== NULL
)
594 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
597 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Unrecognized EID=%dd in reassocreq decode.\n",
601 pItem
= (PWLAN_IE
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
610 * Routine Description:
611 * Encode Probe Request
621 vMgrEncodeProbeRequest(
622 PWLAN_FR_PROBEREQ pFrame
625 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
626 pFrame
->len
= WLAN_HDR_ADDR3_LEN
;
632 * Routine Description:
633 * Decode Probe Request
642 vMgrDecodeProbeRequest(
643 PWLAN_FR_PROBEREQ pFrame
648 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
650 // Information elements
651 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
)));
653 while( ((unsigned char *)pItem
) < (pFrame
->pBuf
+ pFrame
->len
) ) {
655 switch (pItem
->byElementID
) {
657 if (pFrame
->pSSID
== NULL
)
658 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
661 case WLAN_EID_SUPP_RATES
:
662 if (pFrame
->pSuppRates
== NULL
)
663 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
666 case WLAN_EID_EXTSUPP_RATES
:
667 if (pFrame
->pExtSuppRates
== NULL
)
668 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
672 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Bad EID=%dd in probereq\n", pItem
->byElementID
);
676 pItem
= (PWLAN_IE
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
684 * Routine Description:
685 * Encode Probe Response
695 vMgrEncodeProbeResponse(
696 PWLAN_FR_PROBERESP pFrame
699 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
702 pFrame
->pqwTimestamp
= (PQWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
703 + WLAN_PROBERESP_OFF_TS
);
704 pFrame
->pwBeaconInterval
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
705 + WLAN_PROBERESP_OFF_BCN_INT
);
706 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
707 + WLAN_PROBERESP_OFF_CAP_INFO
);
709 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_PROBERESP_OFF_CAP_INFO
+
710 sizeof(*(pFrame
->pwCapInfo
));
719 * Routine Description:
720 * Decode Probe Response
729 vMgrDecodeProbeResponse(
730 PWLAN_FR_PROBERESP pFrame
736 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
739 pFrame
->pqwTimestamp
= (PQWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
740 + WLAN_PROBERESP_OFF_TS
);
741 pFrame
->pwBeaconInterval
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
742 + WLAN_PROBERESP_OFF_BCN_INT
);
743 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
744 + WLAN_PROBERESP_OFF_CAP_INFO
);
746 // Information elements
747 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
748 + WLAN_PROBERESP_OFF_SSID
);
750 while( ((unsigned char *)pItem
) < (pFrame
->pBuf
+ pFrame
->len
) ) {
751 switch (pItem
->byElementID
) {
753 if (pFrame
->pSSID
== NULL
)
754 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
756 case WLAN_EID_SUPP_RATES
:
757 if (pFrame
->pSuppRates
== NULL
)
758 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
760 case WLAN_EID_FH_PARMS
:
762 case WLAN_EID_DS_PARMS
:
763 if (pFrame
->pDSParms
== NULL
)
764 pFrame
->pDSParms
= (PWLAN_IE_DS_PARMS
)pItem
;
766 case WLAN_EID_CF_PARMS
:
767 if (pFrame
->pCFParms
== NULL
)
768 pFrame
->pCFParms
= (PWLAN_IE_CF_PARMS
)pItem
;
770 case WLAN_EID_IBSS_PARMS
:
771 if (pFrame
->pIBSSParms
== NULL
)
772 pFrame
->pIBSSParms
= (PWLAN_IE_IBSS_PARMS
)pItem
;
776 if (pFrame
->pRSN
== NULL
) {
777 pFrame
->pRSN
= (PWLAN_IE_RSN
)pItem
;
780 case WLAN_EID_RSN_WPA
:
781 if (pFrame
->pRSNWPA
== NULL
) {
782 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == true)
783 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
787 if (pFrame
->pERP
== NULL
)
788 pFrame
->pERP
= (PWLAN_IE_ERP
)pItem
;
790 case WLAN_EID_EXTSUPP_RATES
:
791 if (pFrame
->pExtSuppRates
== NULL
)
792 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
795 case WLAN_EID_COUNTRY
: //7
796 if (pFrame
->pIE_Country
== NULL
)
797 pFrame
->pIE_Country
= (PWLAN_IE_COUNTRY
)pItem
;
800 case WLAN_EID_PWR_CONSTRAINT
: //32
801 if (pFrame
->pIE_PowerConstraint
== NULL
)
802 pFrame
->pIE_PowerConstraint
= (PWLAN_IE_PW_CONST
)pItem
;
805 case WLAN_EID_CH_SWITCH
: //37
806 if (pFrame
->pIE_CHSW
== NULL
)
807 pFrame
->pIE_CHSW
= (PWLAN_IE_CH_SW
)pItem
;
810 case WLAN_EID_QUIET
: //40
811 if (pFrame
->pIE_Quiet
== NULL
)
812 pFrame
->pIE_Quiet
= (PWLAN_IE_QUIET
)pItem
;
815 case WLAN_EID_IBSS_DFS
:
816 if (pFrame
->pIE_IBSSDFS
== NULL
)
817 pFrame
->pIE_IBSSDFS
= (PWLAN_IE_IBSS_DFS
)pItem
;
821 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Bad EID=%dd in proberesp\n", pItem
->byElementID
);
825 pItem
= (PWLAN_IE
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
833 * Routine Description:
834 * Encode Authentication frame
844 PWLAN_FR_AUTHEN pFrame
847 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
850 pFrame
->pwAuthAlgorithm
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
851 + WLAN_AUTHEN_OFF_AUTH_ALG
);
852 pFrame
->pwAuthSequence
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
853 + WLAN_AUTHEN_OFF_AUTH_SEQ
);
854 pFrame
->pwStatus
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
855 + WLAN_AUTHEN_OFF_STATUS
);
856 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_AUTHEN_OFF_STATUS
+ sizeof(*(pFrame
->pwStatus
));
864 * Routine Description:
865 * Decode Authentication
875 PWLAN_FR_AUTHEN pFrame
880 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
883 pFrame
->pwAuthAlgorithm
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
884 + WLAN_AUTHEN_OFF_AUTH_ALG
);
885 pFrame
->pwAuthSequence
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
886 + WLAN_AUTHEN_OFF_AUTH_SEQ
);
887 pFrame
->pwStatus
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
888 + WLAN_AUTHEN_OFF_STATUS
);
890 // Information elements
891 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
892 + WLAN_AUTHEN_OFF_CHALLENGE
);
894 if ((((unsigned char *)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) && (pItem
->byElementID
== WLAN_EID_CHALLENGE
)) {
895 pFrame
->pChallenge
= (PWLAN_IE_CHALLENGE
)pItem
;
904 * Routine Description:
905 * Encode Authentication
915 PWLAN_FR_DEAUTHEN pFrame
918 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
921 pFrame
->pwReason
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
922 + WLAN_DEAUTHEN_OFF_REASON
);
923 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_DEAUTHEN_OFF_REASON
+ sizeof(*(pFrame
->pwReason
));
931 * Routine Description:
932 * Decode Deauthentication
942 PWLAN_FR_DEAUTHEN pFrame
945 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
948 pFrame
->pwReason
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
949 + WLAN_DEAUTHEN_OFF_REASON
);
957 * Routine Description: (AP)
958 * Encode Reassociation Response
967 vMgrEncodeReassocResponse(
968 PWLAN_FR_REASSOCRESP pFrame
971 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
974 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
975 + WLAN_REASSOCRESP_OFF_CAP_INFO
);
976 pFrame
->pwStatus
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
977 + WLAN_REASSOCRESP_OFF_STATUS
);
978 pFrame
->pwAid
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
979 + WLAN_REASSOCRESP_OFF_AID
);
981 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_REASSOCRESP_OFF_AID
+ sizeof(*(pFrame
->pwAid
));
989 * Routine Description:
990 * Decode Reassociation Response
1000 vMgrDecodeReassocResponse(
1001 PWLAN_FR_REASSOCRESP pFrame
1006 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
1009 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
1010 + WLAN_REASSOCRESP_OFF_CAP_INFO
);
1011 pFrame
->pwStatus
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
1012 + WLAN_REASSOCRESP_OFF_STATUS
);
1013 pFrame
->pwAid
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
1014 + WLAN_REASSOCRESP_OFF_AID
);
1016 //Information elements
1017 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
1018 + WLAN_REASSOCRESP_OFF_SUPP_RATES
);
1020 pItem
= (PWLAN_IE
)(pFrame
->pSuppRates
);
1021 pItem
= (PWLAN_IE
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
1023 if ((((unsigned char *)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) &&
1024 (pItem
->byElementID
== WLAN_EID_EXTSUPP_RATES
)) {
1025 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;