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
);
232 * Routine Description:
244 PWLAN_FR_IBSSATIM pFrame
247 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
248 pFrame
->len
= WLAN_HDR_ADDR3_LEN
;
254 * Routine Description:
265 PWLAN_FR_IBSSATIM pFrame
268 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
274 * Routine Description:
275 * Encode Disassociation
284 vMgrEncodeDisassociation(
285 PWLAN_FR_DISASSOC pFrame
288 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
292 pFrame
->pwReason
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
293 + WLAN_DISASSOC_OFF_REASON
);
294 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_DISASSOC_OFF_REASON
+ sizeof(*(pFrame
->pwReason
));
300 * Routine Description:
301 * Decode Disassociation
310 vMgrDecodeDisassociation(
311 PWLAN_FR_DISASSOC pFrame
314 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
317 pFrame
->pwReason
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
318 + WLAN_DISASSOC_OFF_REASON
);
323 * Routine Description:
324 * Encode Association Request
334 vMgrEncodeAssocRequest(
335 PWLAN_FR_ASSOCREQ pFrame
338 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
340 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
341 + WLAN_ASSOCREQ_OFF_CAP_INFO
);
342 pFrame
->pwListenInterval
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
343 + WLAN_ASSOCREQ_OFF_LISTEN_INT
);
344 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_ASSOCREQ_OFF_LISTEN_INT
+ sizeof(*(pFrame
->pwListenInterval
));
350 * Routine Description: (AP)
351 * Decode Association Request
360 vMgrDecodeAssocRequest(
361 PWLAN_FR_ASSOCREQ pFrame
366 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
368 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
369 + WLAN_ASSOCREQ_OFF_CAP_INFO
);
370 pFrame
->pwListenInterval
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
371 + WLAN_ASSOCREQ_OFF_LISTEN_INT
);
373 /* Information elements */
374 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
375 + WLAN_ASSOCREQ_OFF_SSID
);
377 while (((PBYTE
)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
378 switch (pItem
->byElementID
) {
380 if (pFrame
->pSSID
== NULL
)
381 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
383 case WLAN_EID_SUPP_RATES
:
384 if (pFrame
->pSuppRates
== NULL
)
385 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
389 if (pFrame
->pRSN
== NULL
)
390 pFrame
->pRSN
= (PWLAN_IE_RSN
)pItem
;
392 case WLAN_EID_RSN_WPA
:
393 if (pFrame
->pRSNWPA
== NULL
) {
394 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == TRUE
)
395 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
398 case WLAN_EID_EXTSUPP_RATES
:
399 if (pFrame
->pExtSuppRates
== NULL
)
400 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
404 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Unrecognized EID=%dd in assocreq decode.\n",
408 pItem
= (PWLAN_IE
)(((PBYTE
)pItem
) + 2 + pItem
->len
);
414 * Routine Description: (AP)
415 * Encode Association Response
424 vMgrEncodeAssocResponse(
425 PWLAN_FR_ASSOCRESP pFrame
428 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
431 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
432 + WLAN_ASSOCRESP_OFF_CAP_INFO
);
433 pFrame
->pwStatus
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
434 + WLAN_ASSOCRESP_OFF_STATUS
);
435 pFrame
->pwAid
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
436 + WLAN_ASSOCRESP_OFF_AID
);
437 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_ASSOCRESP_OFF_AID
438 + sizeof(*(pFrame
->pwAid
));
444 * Routine Description:
445 * Decode Association Response
454 vMgrDecodeAssocResponse(
455 PWLAN_FR_ASSOCRESP pFrame
460 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
463 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
464 + WLAN_ASSOCRESP_OFF_CAP_INFO
);
465 pFrame
->pwStatus
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
466 + WLAN_ASSOCRESP_OFF_STATUS
);
467 pFrame
->pwAid
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
468 + WLAN_ASSOCRESP_OFF_AID
);
470 /* Information elements */
471 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
472 + WLAN_ASSOCRESP_OFF_SUPP_RATES
);
474 pItem
= (PWLAN_IE
)(pFrame
->pSuppRates
);
475 pItem
= (PWLAN_IE
)(((PBYTE
)pItem
) + 2 + pItem
->len
);
477 if ((((PBYTE
)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) && (pItem
->byElementID
== WLAN_EID_EXTSUPP_RATES
)) {
478 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
479 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"pFrame->pExtSuppRates=[%p].\n", pItem
);
481 pFrame
->pExtSuppRates
= NULL
;
487 * Routine Description:
488 * Encode Reassociation Request
497 vMgrEncodeReassocRequest(
498 PWLAN_FR_REASSOCREQ pFrame
501 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
504 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
505 + WLAN_REASSOCREQ_OFF_CAP_INFO
);
506 pFrame
->pwListenInterval
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
507 + WLAN_REASSOCREQ_OFF_LISTEN_INT
);
508 pFrame
->pAddrCurrAP
= (PIEEE_ADDR
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
509 + WLAN_REASSOCREQ_OFF_CURR_AP
);
510 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_REASSOCREQ_OFF_CURR_AP
+ sizeof(*(pFrame
->pAddrCurrAP
));
516 * Routine Description: (AP)
517 * Decode Reassociation Request
527 vMgrDecodeReassocRequest(
528 PWLAN_FR_REASSOCREQ pFrame
532 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
535 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
536 + WLAN_REASSOCREQ_OFF_CAP_INFO
);
537 pFrame
->pwListenInterval
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
538 + WLAN_REASSOCREQ_OFF_LISTEN_INT
);
539 pFrame
->pAddrCurrAP
= (PIEEE_ADDR
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
540 + WLAN_REASSOCREQ_OFF_CURR_AP
);
542 /* Information elements */
543 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
544 + WLAN_REASSOCREQ_OFF_SSID
);
546 while (((PBYTE
)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
548 switch (pItem
->byElementID
) {
550 if (pFrame
->pSSID
== NULL
)
551 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
553 case WLAN_EID_SUPP_RATES
:
554 if (pFrame
->pSuppRates
== NULL
)
555 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
559 if (pFrame
->pRSN
== NULL
)
560 pFrame
->pRSN
= (PWLAN_IE_RSN
)pItem
;
562 case WLAN_EID_RSN_WPA
:
563 if (pFrame
->pRSNWPA
== NULL
)
564 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == TRUE
)
565 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
568 case WLAN_EID_EXTSUPP_RATES
:
569 if (pFrame
->pExtSuppRates
== NULL
)
570 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
573 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Unrecognized EID=%dd in reassocreq decode.\n",
577 pItem
= (PWLAN_IE
)(((PBYTE
)pItem
) + 2 + pItem
->len
);
585 * Routine Description:
586 * Encode Probe Request
596 vMgrEncodeProbeRequest(
597 PWLAN_FR_PROBEREQ pFrame
600 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
601 pFrame
->len
= WLAN_HDR_ADDR3_LEN
;
606 * Routine Description:
607 * Decode Probe Request
616 vMgrDecodeProbeRequest(
617 PWLAN_FR_PROBEREQ pFrame
622 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
624 /* Information elements */
625 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
)));
627 while (((PBYTE
)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
629 switch (pItem
->byElementID
) {
631 if (pFrame
->pSSID
== NULL
)
632 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
635 case WLAN_EID_SUPP_RATES
:
636 if (pFrame
->pSuppRates
== NULL
)
637 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
640 case WLAN_EID_EXTSUPP_RATES
:
641 if (pFrame
->pExtSuppRates
== NULL
)
642 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
646 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Bad EID=%dd in probereq\n", pItem
->byElementID
);
650 pItem
= (PWLAN_IE
)(((PBYTE
)pItem
) + 2 + pItem
->len
);
657 * Routine Description:
658 * Encode Probe Response
668 vMgrEncodeProbeResponse(
669 PWLAN_FR_PROBERESP pFrame
672 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
675 pFrame
->pqwTimestamp
= (PQWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
676 + WLAN_PROBERESP_OFF_TS
);
677 pFrame
->pwBeaconInterval
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
678 + WLAN_PROBERESP_OFF_BCN_INT
);
679 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
680 + WLAN_PROBERESP_OFF_CAP_INFO
);
682 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_PROBERESP_OFF_CAP_INFO
+
683 sizeof(*(pFrame
->pwCapInfo
));
690 * Routine Description:
691 * Decode Probe Response
700 vMgrDecodeProbeResponse(
701 PWLAN_FR_PROBERESP pFrame
707 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
710 pFrame
->pqwTimestamp
= (PQWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
711 + WLAN_PROBERESP_OFF_TS
);
712 pFrame
->pwBeaconInterval
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
713 + WLAN_PROBERESP_OFF_BCN_INT
);
714 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
715 + WLAN_PROBERESP_OFF_CAP_INFO
);
717 /* Information elements */
718 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
719 + WLAN_PROBERESP_OFF_SSID
);
721 while (((PBYTE
)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
722 switch (pItem
->byElementID
) {
724 if (pFrame
->pSSID
== NULL
)
725 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
727 case WLAN_EID_SUPP_RATES
:
728 if (pFrame
->pSuppRates
== NULL
)
729 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
731 case WLAN_EID_FH_PARMS
:
733 case WLAN_EID_DS_PARMS
:
734 if (pFrame
->pDSParms
== NULL
)
735 pFrame
->pDSParms
= (PWLAN_IE_DS_PARMS
)pItem
;
737 case WLAN_EID_CF_PARMS
:
738 if (pFrame
->pCFParms
== NULL
)
739 pFrame
->pCFParms
= (PWLAN_IE_CF_PARMS
)pItem
;
741 case WLAN_EID_IBSS_PARMS
:
742 if (pFrame
->pIBSSParms
== NULL
)
743 pFrame
->pIBSSParms
= (PWLAN_IE_IBSS_PARMS
)pItem
;
747 if (pFrame
->pRSN
== NULL
)
748 pFrame
->pRSN
= (PWLAN_IE_RSN
)pItem
;
750 case WLAN_EID_RSN_WPA
:
751 if (pFrame
->pRSNWPA
== NULL
) {
752 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == TRUE
)
753 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
757 if (pFrame
->pERP
== NULL
)
758 pFrame
->pERP
= (PWLAN_IE_ERP
)pItem
;
760 case WLAN_EID_EXTSUPP_RATES
:
761 if (pFrame
->pExtSuppRates
== NULL
)
762 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
765 case WLAN_EID_COUNTRY
: /* 7 */
766 if (pFrame
->pIE_Country
== NULL
)
767 pFrame
->pIE_Country
= (PWLAN_IE_COUNTRY
)pItem
;
770 case WLAN_EID_PWR_CONSTRAINT
: /* 32 */
771 if (pFrame
->pIE_PowerConstraint
== NULL
)
772 pFrame
->pIE_PowerConstraint
= (PWLAN_IE_PW_CONST
)pItem
;
775 case WLAN_EID_CH_SWITCH
: /* 37 */
776 if (pFrame
->pIE_CHSW
== NULL
)
777 pFrame
->pIE_CHSW
= (PWLAN_IE_CH_SW
)pItem
;
780 case WLAN_EID_QUIET
: /* 40 */
781 if (pFrame
->pIE_Quiet
== NULL
)
782 pFrame
->pIE_Quiet
= (PWLAN_IE_QUIET
)pItem
;
785 case WLAN_EID_IBSS_DFS
:
786 if (pFrame
->pIE_IBSSDFS
== NULL
)
787 pFrame
->pIE_IBSSDFS
= (PWLAN_IE_IBSS_DFS
)pItem
;
791 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Bad EID=%dd in proberesp\n", pItem
->byElementID
);
795 pItem
= (PWLAN_IE
)(((PBYTE
)pItem
) + 2 + pItem
->len
);
802 * Routine Description:
803 * Encode Authentication frame
813 PWLAN_FR_AUTHEN pFrame
816 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
819 pFrame
->pwAuthAlgorithm
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
820 + WLAN_AUTHEN_OFF_AUTH_ALG
);
821 pFrame
->pwAuthSequence
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
822 + WLAN_AUTHEN_OFF_AUTH_SEQ
);
823 pFrame
->pwStatus
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
824 + WLAN_AUTHEN_OFF_STATUS
);
825 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_AUTHEN_OFF_STATUS
+ sizeof(*(pFrame
->pwStatus
));
831 * Routine Description:
832 * Decode Authentication
842 PWLAN_FR_AUTHEN pFrame
847 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
850 pFrame
->pwAuthAlgorithm
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
851 + WLAN_AUTHEN_OFF_AUTH_ALG
);
852 pFrame
->pwAuthSequence
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
853 + WLAN_AUTHEN_OFF_AUTH_SEQ
);
854 pFrame
->pwStatus
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
855 + WLAN_AUTHEN_OFF_STATUS
);
857 /* Information elements */
858 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
859 + WLAN_AUTHEN_OFF_CHALLENGE
);
861 if ((((PBYTE
)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) && (pItem
->byElementID
== WLAN_EID_CHALLENGE
))
862 pFrame
->pChallenge
= (PWLAN_IE_CHALLENGE
)pItem
;
868 * Routine Description:
869 * Encode Authentication
879 PWLAN_FR_DEAUTHEN pFrame
882 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
885 pFrame
->pwReason
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
886 + WLAN_DEAUTHEN_OFF_REASON
);
887 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_DEAUTHEN_OFF_REASON
+ sizeof(*(pFrame
->pwReason
));
893 * Routine Description:
894 * Decode Deauthentication
904 PWLAN_FR_DEAUTHEN pFrame
907 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
910 pFrame
->pwReason
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
911 + WLAN_DEAUTHEN_OFF_REASON
);
917 * Routine Description: (AP)
918 * Encode Reassociation Response
927 vMgrEncodeReassocResponse(
928 PWLAN_FR_REASSOCRESP pFrame
931 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
934 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
935 + WLAN_REASSOCRESP_OFF_CAP_INFO
);
936 pFrame
->pwStatus
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
937 + WLAN_REASSOCRESP_OFF_STATUS
);
938 pFrame
->pwAid
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
939 + WLAN_REASSOCRESP_OFF_AID
);
941 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_REASSOCRESP_OFF_AID
+ sizeof(*(pFrame
->pwAid
));
947 * Routine Description:
948 * Decode Reassociation Response
958 vMgrDecodeReassocResponse(
959 PWLAN_FR_REASSOCRESP pFrame
964 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
967 pFrame
->pwCapInfo
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
968 + WLAN_REASSOCRESP_OFF_CAP_INFO
);
969 pFrame
->pwStatus
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
970 + WLAN_REASSOCRESP_OFF_STATUS
);
971 pFrame
->pwAid
= (PWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
972 + WLAN_REASSOCRESP_OFF_AID
);
974 /* Information elements */
975 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
976 + WLAN_REASSOCRESP_OFF_SUPP_RATES
);
978 pItem
= (PWLAN_IE
)(pFrame
->pSuppRates
);
979 pItem
= (PWLAN_IE
)(((PBYTE
)pItem
) + 2 + pItem
->len
);
981 if ((((PBYTE
)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) && (pItem
->byElementID
== WLAN_EID_EXTSUPP_RATES
))
982 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;