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 -------------------------*/
64 /*--------------------- Static Classes ----------------------------*/
66 /*--------------------- Static Variables --------------------------*/
68 static int msglevel
= MSG_LEVEL_INFO
;
69 /* static int msglevel =MSG_LEVEL_DEBUG; */
70 /*--------------------- Static Functions --------------------------*/
72 /*--------------------- Export Variables --------------------------*/
74 /*--------------------- Export Functions --------------------------*/
78 * Routine Description:
79 * Encode Beacon frame body offset
88 PWLAN_FR_BEACON pFrame
91 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
94 pFrame
->pqwTimestamp
= (PQWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
95 + WLAN_BEACON_OFF_TS
);
96 pFrame
->pwBeaconInterval
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
97 + WLAN_BEACON_OFF_BCN_INT
);
98 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
99 + WLAN_BEACON_OFF_CAPINFO
);
101 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_BEACON_OFF_SSID
;
108 * Routine Description:
109 * Decode Beacon frame body offset
119 PWLAN_FR_BEACON pFrame
124 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
127 pFrame
->pqwTimestamp
= (PQWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
128 + WLAN_BEACON_OFF_TS
);
129 pFrame
->pwBeaconInterval
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
130 + WLAN_BEACON_OFF_BCN_INT
);
131 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
132 + WLAN_BEACON_OFF_CAPINFO
);
134 /* Information elements */
135 pItem
= (PWLAN_IE
)((unsigned char *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
)))
136 + WLAN_BEACON_OFF_SSID
);
137 while (((unsigned char *)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
138 switch (pItem
->byElementID
) {
140 if (pFrame
->pSSID
== NULL
)
141 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
143 case WLAN_EID_SUPP_RATES
:
144 if (pFrame
->pSuppRates
== NULL
)
145 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
147 case WLAN_EID_FH_PARMS
:
148 /* pFrame->pFHParms = (PWLAN_IE_FH_PARMS)pItem; */
150 case WLAN_EID_DS_PARMS
:
151 if (pFrame
->pDSParms
== NULL
)
152 pFrame
->pDSParms
= (PWLAN_IE_DS_PARMS
)pItem
;
154 case WLAN_EID_CF_PARMS
:
155 if (pFrame
->pCFParms
== NULL
)
156 pFrame
->pCFParms
= (PWLAN_IE_CF_PARMS
)pItem
;
158 case WLAN_EID_IBSS_PARMS
:
159 if (pFrame
->pIBSSParms
== NULL
)
160 pFrame
->pIBSSParms
= (PWLAN_IE_IBSS_PARMS
)pItem
;
163 if (pFrame
->pTIM
== NULL
)
164 pFrame
->pTIM
= (PWLAN_IE_TIM
)pItem
;
168 if (pFrame
->pRSN
== NULL
) {
169 pFrame
->pRSN
= (PWLAN_IE_RSN
)pItem
;
172 case WLAN_EID_RSN_WPA
:
173 if (pFrame
->pRSNWPA
== NULL
) {
174 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == true)
175 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
180 if (pFrame
->pERP
== NULL
)
181 pFrame
->pERP
= (PWLAN_IE_ERP
)pItem
;
183 case WLAN_EID_EXTSUPP_RATES
:
184 if (pFrame
->pExtSuppRates
== NULL
)
185 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
188 case WLAN_EID_COUNTRY
: /* 7 */
189 if (pFrame
->pIE_Country
== NULL
)
190 pFrame
->pIE_Country
= (PWLAN_IE_COUNTRY
)pItem
;
193 case WLAN_EID_PWR_CONSTRAINT
: /* 32 */
194 if (pFrame
->pIE_PowerConstraint
== NULL
)
195 pFrame
->pIE_PowerConstraint
= (PWLAN_IE_PW_CONST
)pItem
;
198 case WLAN_EID_CH_SWITCH
: /* 37 */
199 if (pFrame
->pIE_CHSW
== NULL
)
200 pFrame
->pIE_CHSW
= (PWLAN_IE_CH_SW
)pItem
;
203 case WLAN_EID_QUIET
: /* 40 */
204 if (pFrame
->pIE_Quiet
== NULL
)
205 pFrame
->pIE_Quiet
= (PWLAN_IE_QUIET
)pItem
;
208 case WLAN_EID_IBSS_DFS
:
209 if (pFrame
->pIE_IBSSDFS
== NULL
)
210 pFrame
->pIE_IBSSDFS
= (PWLAN_IE_IBSS_DFS
)pItem
;
214 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Unrecognized EID=%dd in beacon decode.\n", pItem
->byElementID
);
218 pItem
= (PWLAN_IE
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
226 * Routine Description:
237 PWLAN_FR_IBSSATIM pFrame
240 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
241 pFrame
->len
= WLAN_HDR_ADDR3_LEN
;
248 * Routine Description:
259 PWLAN_FR_IBSSATIM pFrame
262 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
269 * Routine Description:
270 * Encode Disassociation
279 vMgrEncodeDisassociation(
280 PWLAN_FR_DISASSOC pFrame
283 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
286 pFrame
->pwReason
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
287 + WLAN_DISASSOC_OFF_REASON
);
288 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_DISASSOC_OFF_REASON
+ sizeof(*(pFrame
->pwReason
));
295 * Routine Description:
296 * Decode Disassociation
305 vMgrDecodeDisassociation(
306 PWLAN_FR_DISASSOC pFrame
309 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
312 pFrame
->pwReason
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
313 + WLAN_DISASSOC_OFF_REASON
);
320 * Routine Description:
321 * Encode Association Request
330 vMgrEncodeAssocRequest(
331 PWLAN_FR_ASSOCREQ pFrame
334 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
336 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
337 + WLAN_ASSOCREQ_OFF_CAP_INFO
);
338 pFrame
->pwListenInterval
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
339 + WLAN_ASSOCREQ_OFF_LISTEN_INT
);
340 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_ASSOCREQ_OFF_LISTEN_INT
+ sizeof(*(pFrame
->pwListenInterval
));
346 * Routine Description: (AP)
347 * Decode Association Request
356 vMgrDecodeAssocRequest(
357 PWLAN_FR_ASSOCREQ pFrame
362 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
364 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
365 + WLAN_ASSOCREQ_OFF_CAP_INFO
);
366 pFrame
->pwListenInterval
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
367 + WLAN_ASSOCREQ_OFF_LISTEN_INT
);
369 /* Information elements */
370 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
371 + WLAN_ASSOCREQ_OFF_SSID
);
373 while (((unsigned char *)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
374 switch (pItem
->byElementID
) {
376 if (pFrame
->pSSID
== NULL
)
377 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
379 case WLAN_EID_SUPP_RATES
:
380 if (pFrame
->pSuppRates
== NULL
)
381 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
385 if (pFrame
->pRSN
== NULL
) {
386 pFrame
->pRSN
= (PWLAN_IE_RSN
)pItem
;
389 case WLAN_EID_RSN_WPA
:
390 if (pFrame
->pRSNWPA
== NULL
) {
391 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == true)
392 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
395 case WLAN_EID_EXTSUPP_RATES
:
396 if (pFrame
->pExtSuppRates
== NULL
)
397 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
401 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Unrecognized EID=%dd in assocreq decode.\n",
405 pItem
= (PWLAN_IE
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
412 * Routine Description: (AP)
413 * Encode Association Response
422 vMgrEncodeAssocResponse(
423 PWLAN_FR_ASSOCRESP pFrame
426 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
429 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
430 + WLAN_ASSOCRESP_OFF_CAP_INFO
);
431 pFrame
->pwStatus
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
432 + WLAN_ASSOCRESP_OFF_STATUS
);
433 pFrame
->pwAid
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
434 + WLAN_ASSOCRESP_OFF_AID
);
435 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_ASSOCRESP_OFF_AID
436 + sizeof(*(pFrame
->pwAid
));
443 * Routine Description:
444 * Decode Association Response
453 vMgrDecodeAssocResponse(
454 PWLAN_FR_ASSOCRESP pFrame
459 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
462 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
463 + WLAN_ASSOCRESP_OFF_CAP_INFO
);
464 pFrame
->pwStatus
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
465 + WLAN_ASSOCRESP_OFF_STATUS
);
466 pFrame
->pwAid
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
467 + WLAN_ASSOCRESP_OFF_AID
);
469 /* Information elements */
470 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
471 + WLAN_ASSOCRESP_OFF_SUPP_RATES
);
473 pItem
= (PWLAN_IE
)(pFrame
->pSuppRates
);
474 pItem
= (PWLAN_IE
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
476 if ((((unsigned char *)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) &&
477 (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
;
488 * Routine Description:
489 * Encode Reassociation Request
498 vMgrEncodeReassocRequest(
499 PWLAN_FR_REASSOCREQ pFrame
502 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
505 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
506 + WLAN_REASSOCREQ_OFF_CAP_INFO
);
507 pFrame
->pwListenInterval
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
508 + WLAN_REASSOCREQ_OFF_LISTEN_INT
);
509 pFrame
->pAddrCurrAP
= (PIEEE_ADDR
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
510 + WLAN_REASSOCREQ_OFF_CURR_AP
);
511 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_REASSOCREQ_OFF_CURR_AP
+ sizeof(*(pFrame
->pAddrCurrAP
));
518 * Routine Description: (AP)
519 * Decode Reassociation Request
528 vMgrDecodeReassocRequest(
529 PWLAN_FR_REASSOCREQ pFrame
533 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
536 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
537 + WLAN_REASSOCREQ_OFF_CAP_INFO
);
538 pFrame
->pwListenInterval
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
539 + WLAN_REASSOCREQ_OFF_LISTEN_INT
);
540 pFrame
->pAddrCurrAP
= (PIEEE_ADDR
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
541 + WLAN_REASSOCREQ_OFF_CURR_AP
);
543 /* Information elements */
544 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
545 + WLAN_REASSOCREQ_OFF_SSID
);
547 while (((unsigned char *)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
;
563 case WLAN_EID_RSN_WPA
:
564 if (pFrame
->pRSNWPA
== NULL
) {
565 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == true)
566 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
570 case WLAN_EID_EXTSUPP_RATES
:
571 if (pFrame
->pExtSuppRates
== NULL
)
572 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
575 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Unrecognized EID=%dd in reassocreq decode.\n",
579 pItem
= (PWLAN_IE
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
586 * Routine Description:
587 * Encode Probe Request
596 vMgrEncodeProbeRequest(
597 PWLAN_FR_PROBEREQ pFrame
600 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
601 pFrame
->len
= WLAN_HDR_ADDR3_LEN
;
607 * Routine Description:
608 * Decode Probe Request
617 vMgrDecodeProbeRequest(
618 PWLAN_FR_PROBEREQ pFrame
623 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
625 /* Information elements */
626 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
)));
628 while (((unsigned char *)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
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
657 * Routine Description:
658 * Encode Probe Response
667 vMgrEncodeProbeResponse(
668 PWLAN_FR_PROBERESP pFrame
671 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
674 pFrame
->pqwTimestamp
= (PQWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
675 + WLAN_PROBERESP_OFF_TS
);
676 pFrame
->pwBeaconInterval
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
677 + WLAN_PROBERESP_OFF_BCN_INT
);
678 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
679 + WLAN_PROBERESP_OFF_CAP_INFO
);
681 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_PROBERESP_OFF_CAP_INFO
+
682 sizeof(*(pFrame
->pwCapInfo
));
689 * Routine Description:
690 * Decode Probe Response
699 vMgrDecodeProbeResponse(
700 PWLAN_FR_PROBERESP pFrame
705 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
708 pFrame
->pqwTimestamp
= (PQWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
709 + WLAN_PROBERESP_OFF_TS
);
710 pFrame
->pwBeaconInterval
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
711 + WLAN_PROBERESP_OFF_BCN_INT
);
712 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
713 + WLAN_PROBERESP_OFF_CAP_INFO
);
715 /* Information elements */
716 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
717 + WLAN_PROBERESP_OFF_SSID
);
719 while (((unsigned char *)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
720 switch (pItem
->byElementID
) {
722 if (pFrame
->pSSID
== NULL
)
723 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
725 case WLAN_EID_SUPP_RATES
:
726 if (pFrame
->pSuppRates
== NULL
)
727 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
729 case WLAN_EID_FH_PARMS
:
731 case WLAN_EID_DS_PARMS
:
732 if (pFrame
->pDSParms
== NULL
)
733 pFrame
->pDSParms
= (PWLAN_IE_DS_PARMS
)pItem
;
735 case WLAN_EID_CF_PARMS
:
736 if (pFrame
->pCFParms
== NULL
)
737 pFrame
->pCFParms
= (PWLAN_IE_CF_PARMS
)pItem
;
739 case WLAN_EID_IBSS_PARMS
:
740 if (pFrame
->pIBSSParms
== NULL
)
741 pFrame
->pIBSSParms
= (PWLAN_IE_IBSS_PARMS
)pItem
;
745 if (pFrame
->pRSN
== NULL
) {
746 pFrame
->pRSN
= (PWLAN_IE_RSN
)pItem
;
749 case WLAN_EID_RSN_WPA
:
750 if (pFrame
->pRSNWPA
== NULL
) {
751 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == true)
752 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
756 if (pFrame
->pERP
== NULL
)
757 pFrame
->pERP
= (PWLAN_IE_ERP
)pItem
;
759 case WLAN_EID_EXTSUPP_RATES
:
760 if (pFrame
->pExtSuppRates
== NULL
)
761 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
764 case WLAN_EID_COUNTRY
: /* 7 */
765 if (pFrame
->pIE_Country
== NULL
)
766 pFrame
->pIE_Country
= (PWLAN_IE_COUNTRY
)pItem
;
769 case WLAN_EID_PWR_CONSTRAINT
: /* 32 */
770 if (pFrame
->pIE_PowerConstraint
== NULL
)
771 pFrame
->pIE_PowerConstraint
= (PWLAN_IE_PW_CONST
)pItem
;
774 case WLAN_EID_CH_SWITCH
: /* 37 */
775 if (pFrame
->pIE_CHSW
== NULL
)
776 pFrame
->pIE_CHSW
= (PWLAN_IE_CH_SW
)pItem
;
779 case WLAN_EID_QUIET
: /* 40 */
780 if (pFrame
->pIE_Quiet
== NULL
)
781 pFrame
->pIE_Quiet
= (PWLAN_IE_QUIET
)pItem
;
784 case WLAN_EID_IBSS_DFS
:
785 if (pFrame
->pIE_IBSSDFS
== NULL
)
786 pFrame
->pIE_IBSSDFS
= (PWLAN_IE_IBSS_DFS
)pItem
;
790 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Bad EID=%dd in proberesp\n", pItem
->byElementID
);
794 pItem
= (PWLAN_IE
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
801 * Routine Description:
802 * Encode Authentication frame
812 PWLAN_FR_AUTHEN pFrame
815 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
818 pFrame
->pwAuthAlgorithm
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
819 + WLAN_AUTHEN_OFF_AUTH_ALG
);
820 pFrame
->pwAuthSequence
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
821 + WLAN_AUTHEN_OFF_AUTH_SEQ
);
822 pFrame
->pwStatus
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
823 + WLAN_AUTHEN_OFF_STATUS
);
824 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
= (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
);
857 /* Information elements */
858 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
859 + WLAN_AUTHEN_OFF_CHALLENGE
);
861 if ((((unsigned char *)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) && (pItem
->byElementID
== WLAN_EID_CHALLENGE
)) {
862 pFrame
->pChallenge
= (PWLAN_IE_CHALLENGE
)pItem
;
870 * Routine Description:
871 * Encode Authentication
881 PWLAN_FR_DEAUTHEN pFrame
884 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
887 pFrame
->pwReason
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
888 + WLAN_DEAUTHEN_OFF_REASON
);
889 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_DEAUTHEN_OFF_REASON
+ sizeof(*(pFrame
->pwReason
));
896 * Routine Description:
897 * Decode Deauthentication
907 PWLAN_FR_DEAUTHEN pFrame
910 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
913 pFrame
->pwReason
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
914 + WLAN_DEAUTHEN_OFF_REASON
);
921 * Routine Description: (AP)
922 * Encode Reassociation Response
931 vMgrEncodeReassocResponse(
932 PWLAN_FR_REASSOCRESP pFrame
935 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
938 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
939 + WLAN_REASSOCRESP_OFF_CAP_INFO
);
940 pFrame
->pwStatus
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
941 + WLAN_REASSOCRESP_OFF_STATUS
);
942 pFrame
->pwAid
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
943 + WLAN_REASSOCRESP_OFF_AID
);
945 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_REASSOCRESP_OFF_AID
+ sizeof(*(pFrame
->pwAid
));
952 * Routine Description:
953 * Decode Reassociation Response
962 vMgrDecodeReassocResponse(
963 PWLAN_FR_REASSOCRESP pFrame
968 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
971 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
972 + WLAN_REASSOCRESP_OFF_CAP_INFO
);
973 pFrame
->pwStatus
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
974 + WLAN_REASSOCRESP_OFF_STATUS
);
975 pFrame
->pwAid
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
976 + WLAN_REASSOCRESP_OFF_AID
);
978 /* Information elements */
979 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
980 + WLAN_REASSOCRESP_OFF_SUPP_RATES
);
982 pItem
= (PWLAN_IE
)(pFrame
->pSuppRates
);
983 pItem
= (PWLAN_IE
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
985 if ((((unsigned char *)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) &&
986 (pItem
->byElementID
== WLAN_EID_EXTSUPP_RATES
)) {
987 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;