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
;
171 case WLAN_EID_RSN_WPA
:
172 if (pFrame
->pRSNWPA
== NULL
) {
173 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == true)
174 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
179 if (pFrame
->pERP
== NULL
)
180 pFrame
->pERP
= (PWLAN_IE_ERP
)pItem
;
182 case WLAN_EID_EXTSUPP_RATES
:
183 if (pFrame
->pExtSuppRates
== NULL
)
184 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
187 case WLAN_EID_COUNTRY
: /* 7 */
188 if (pFrame
->pIE_Country
== NULL
)
189 pFrame
->pIE_Country
= (PWLAN_IE_COUNTRY
)pItem
;
192 case WLAN_EID_PWR_CONSTRAINT
: /* 32 */
193 if (pFrame
->pIE_PowerConstraint
== NULL
)
194 pFrame
->pIE_PowerConstraint
= (PWLAN_IE_PW_CONST
)pItem
;
197 case WLAN_EID_CH_SWITCH
: /* 37 */
198 if (pFrame
->pIE_CHSW
== NULL
)
199 pFrame
->pIE_CHSW
= (PWLAN_IE_CH_SW
)pItem
;
202 case WLAN_EID_QUIET
: /* 40 */
203 if (pFrame
->pIE_Quiet
== NULL
)
204 pFrame
->pIE_Quiet
= (PWLAN_IE_QUIET
)pItem
;
207 case WLAN_EID_IBSS_DFS
:
208 if (pFrame
->pIE_IBSSDFS
== NULL
)
209 pFrame
->pIE_IBSSDFS
= (PWLAN_IE_IBSS_DFS
)pItem
;
213 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Unrecognized EID=%dd in beacon decode.\n", pItem
->byElementID
);
217 pItem
= (PWLAN_IE
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
225 * Routine Description:
236 PWLAN_FR_IBSSATIM pFrame
239 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
240 pFrame
->len
= WLAN_HDR_ADDR3_LEN
;
247 * Routine Description:
258 PWLAN_FR_IBSSATIM pFrame
261 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
268 * Routine Description:
269 * Encode Disassociation
278 vMgrEncodeDisassociation(
279 PWLAN_FR_DISASSOC pFrame
282 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
285 pFrame
->pwReason
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
286 + WLAN_DISASSOC_OFF_REASON
);
287 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_DISASSOC_OFF_REASON
+ sizeof(*(pFrame
->pwReason
));
294 * Routine Description:
295 * Decode Disassociation
304 vMgrDecodeDisassociation(
305 PWLAN_FR_DISASSOC pFrame
308 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
311 pFrame
->pwReason
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
312 + WLAN_DISASSOC_OFF_REASON
);
319 * Routine Description:
320 * Encode Association Request
329 vMgrEncodeAssocRequest(
330 PWLAN_FR_ASSOCREQ pFrame
333 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
335 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
336 + WLAN_ASSOCREQ_OFF_CAP_INFO
);
337 pFrame
->pwListenInterval
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
338 + WLAN_ASSOCREQ_OFF_LISTEN_INT
);
339 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_ASSOCREQ_OFF_LISTEN_INT
+ sizeof(*(pFrame
->pwListenInterval
));
345 * Routine Description: (AP)
346 * Decode Association Request
355 vMgrDecodeAssocRequest(
356 PWLAN_FR_ASSOCREQ pFrame
361 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
363 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
364 + WLAN_ASSOCREQ_OFF_CAP_INFO
);
365 pFrame
->pwListenInterval
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
366 + WLAN_ASSOCREQ_OFF_LISTEN_INT
);
368 /* Information elements */
369 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
370 + WLAN_ASSOCREQ_OFF_SSID
);
372 while (((unsigned char *)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
373 switch (pItem
->byElementID
) {
375 if (pFrame
->pSSID
== NULL
)
376 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
378 case WLAN_EID_SUPP_RATES
:
379 if (pFrame
->pSuppRates
== NULL
)
380 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
384 if (pFrame
->pRSN
== NULL
)
385 pFrame
->pRSN
= (PWLAN_IE_RSN
)pItem
;
387 case WLAN_EID_RSN_WPA
:
388 if (pFrame
->pRSNWPA
== NULL
) {
389 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == true)
390 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
393 case WLAN_EID_EXTSUPP_RATES
:
394 if (pFrame
->pExtSuppRates
== NULL
)
395 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
399 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Unrecognized EID=%dd in assocreq decode.\n",
403 pItem
= (PWLAN_IE
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
410 * Routine Description: (AP)
411 * Encode Association Response
420 vMgrEncodeAssocResponse(
421 PWLAN_FR_ASSOCRESP pFrame
424 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
427 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
428 + WLAN_ASSOCRESP_OFF_CAP_INFO
);
429 pFrame
->pwStatus
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
430 + WLAN_ASSOCRESP_OFF_STATUS
);
431 pFrame
->pwAid
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
432 + WLAN_ASSOCRESP_OFF_AID
);
433 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_ASSOCRESP_OFF_AID
434 + sizeof(*(pFrame
->pwAid
));
441 * Routine Description:
442 * Decode Association Response
451 vMgrDecodeAssocResponse(
452 PWLAN_FR_ASSOCRESP pFrame
457 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
460 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
461 + WLAN_ASSOCRESP_OFF_CAP_INFO
);
462 pFrame
->pwStatus
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
463 + WLAN_ASSOCRESP_OFF_STATUS
);
464 pFrame
->pwAid
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
465 + WLAN_ASSOCRESP_OFF_AID
);
467 /* Information elements */
468 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
469 + WLAN_ASSOCRESP_OFF_SUPP_RATES
);
471 pItem
= (PWLAN_IE
)(pFrame
->pSuppRates
);
472 pItem
= (PWLAN_IE
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
474 if ((((unsigned char *)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) &&
475 (pItem
->byElementID
== WLAN_EID_EXTSUPP_RATES
)) {
476 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
477 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"pFrame->pExtSuppRates=[%p].\n", pItem
);
479 pFrame
->pExtSuppRates
= NULL
;
486 * Routine Description:
487 * Encode Reassociation Request
496 vMgrEncodeReassocRequest(
497 PWLAN_FR_REASSOCREQ pFrame
500 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
503 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
504 + WLAN_REASSOCREQ_OFF_CAP_INFO
);
505 pFrame
->pwListenInterval
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
506 + WLAN_REASSOCREQ_OFF_LISTEN_INT
);
507 pFrame
->pAddrCurrAP
= (PIEEE_ADDR
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
508 + WLAN_REASSOCREQ_OFF_CURR_AP
);
509 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_REASSOCREQ_OFF_CURR_AP
+ sizeof(*(pFrame
->pAddrCurrAP
));
516 * Routine Description: (AP)
517 * Decode Reassociation Request
526 vMgrDecodeReassocRequest(
527 PWLAN_FR_REASSOCREQ pFrame
531 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
534 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
535 + WLAN_REASSOCREQ_OFF_CAP_INFO
);
536 pFrame
->pwListenInterval
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
537 + WLAN_REASSOCREQ_OFF_LISTEN_INT
);
538 pFrame
->pAddrCurrAP
= (PIEEE_ADDR
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
539 + WLAN_REASSOCREQ_OFF_CURR_AP
);
541 /* Information elements */
542 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
543 + WLAN_REASSOCREQ_OFF_SSID
);
545 while (((unsigned char *)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
546 switch (pItem
->byElementID
) {
548 if (pFrame
->pSSID
== NULL
)
549 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
551 case WLAN_EID_SUPP_RATES
:
552 if (pFrame
->pSuppRates
== NULL
)
553 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
557 if (pFrame
->pRSN
== NULL
)
558 pFrame
->pRSN
= (PWLAN_IE_RSN
)pItem
;
560 case WLAN_EID_RSN_WPA
:
561 if (pFrame
->pRSNWPA
== NULL
) {
562 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == true)
563 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
567 case WLAN_EID_EXTSUPP_RATES
:
568 if (pFrame
->pExtSuppRates
== NULL
)
569 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
572 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Unrecognized EID=%dd in reassocreq decode.\n",
576 pItem
= (PWLAN_IE
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
583 * Routine Description:
584 * Encode Probe Request
593 vMgrEncodeProbeRequest(
594 PWLAN_FR_PROBEREQ pFrame
597 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
598 pFrame
->len
= WLAN_HDR_ADDR3_LEN
;
604 * Routine Description:
605 * Decode Probe Request
614 vMgrDecodeProbeRequest(
615 PWLAN_FR_PROBEREQ pFrame
620 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
622 /* Information elements */
623 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
)));
625 while (((unsigned char *)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
626 switch (pItem
->byElementID
) {
628 if (pFrame
->pSSID
== NULL
)
629 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
632 case WLAN_EID_SUPP_RATES
:
633 if (pFrame
->pSuppRates
== NULL
)
634 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
637 case WLAN_EID_EXTSUPP_RATES
:
638 if (pFrame
->pExtSuppRates
== NULL
)
639 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
643 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Bad EID=%dd in probereq\n", pItem
->byElementID
);
647 pItem
= (PWLAN_IE
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
654 * Routine Description:
655 * Encode Probe Response
664 vMgrEncodeProbeResponse(
665 PWLAN_FR_PROBERESP pFrame
668 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
671 pFrame
->pqwTimestamp
= (PQWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
672 + WLAN_PROBERESP_OFF_TS
);
673 pFrame
->pwBeaconInterval
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
674 + WLAN_PROBERESP_OFF_BCN_INT
);
675 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
676 + WLAN_PROBERESP_OFF_CAP_INFO
);
678 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_PROBERESP_OFF_CAP_INFO
+
679 sizeof(*(pFrame
->pwCapInfo
));
686 * Routine Description:
687 * Decode Probe Response
696 vMgrDecodeProbeResponse(
697 PWLAN_FR_PROBERESP pFrame
702 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
705 pFrame
->pqwTimestamp
= (PQWORD
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
706 + WLAN_PROBERESP_OFF_TS
);
707 pFrame
->pwBeaconInterval
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
708 + WLAN_PROBERESP_OFF_BCN_INT
);
709 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
710 + WLAN_PROBERESP_OFF_CAP_INFO
);
712 /* Information elements */
713 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
714 + WLAN_PROBERESP_OFF_SSID
);
716 while (((unsigned char *)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
717 switch (pItem
->byElementID
) {
719 if (pFrame
->pSSID
== NULL
)
720 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
722 case WLAN_EID_SUPP_RATES
:
723 if (pFrame
->pSuppRates
== NULL
)
724 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
726 case WLAN_EID_FH_PARMS
:
728 case WLAN_EID_DS_PARMS
:
729 if (pFrame
->pDSParms
== NULL
)
730 pFrame
->pDSParms
= (PWLAN_IE_DS_PARMS
)pItem
;
732 case WLAN_EID_CF_PARMS
:
733 if (pFrame
->pCFParms
== NULL
)
734 pFrame
->pCFParms
= (PWLAN_IE_CF_PARMS
)pItem
;
736 case WLAN_EID_IBSS_PARMS
:
737 if (pFrame
->pIBSSParms
== NULL
)
738 pFrame
->pIBSSParms
= (PWLAN_IE_IBSS_PARMS
)pItem
;
742 if (pFrame
->pRSN
== NULL
)
743 pFrame
->pRSN
= (PWLAN_IE_RSN
)pItem
;
745 case WLAN_EID_RSN_WPA
:
746 if (pFrame
->pRSNWPA
== NULL
) {
747 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == true)
748 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
752 if (pFrame
->pERP
== NULL
)
753 pFrame
->pERP
= (PWLAN_IE_ERP
)pItem
;
755 case WLAN_EID_EXTSUPP_RATES
:
756 if (pFrame
->pExtSuppRates
== NULL
)
757 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
760 case WLAN_EID_COUNTRY
: /* 7 */
761 if (pFrame
->pIE_Country
== NULL
)
762 pFrame
->pIE_Country
= (PWLAN_IE_COUNTRY
)pItem
;
765 case WLAN_EID_PWR_CONSTRAINT
: /* 32 */
766 if (pFrame
->pIE_PowerConstraint
== NULL
)
767 pFrame
->pIE_PowerConstraint
= (PWLAN_IE_PW_CONST
)pItem
;
770 case WLAN_EID_CH_SWITCH
: /* 37 */
771 if (pFrame
->pIE_CHSW
== NULL
)
772 pFrame
->pIE_CHSW
= (PWLAN_IE_CH_SW
)pItem
;
775 case WLAN_EID_QUIET
: /* 40 */
776 if (pFrame
->pIE_Quiet
== NULL
)
777 pFrame
->pIE_Quiet
= (PWLAN_IE_QUIET
)pItem
;
780 case WLAN_EID_IBSS_DFS
:
781 if (pFrame
->pIE_IBSSDFS
== NULL
)
782 pFrame
->pIE_IBSSDFS
= (PWLAN_IE_IBSS_DFS
)pItem
;
786 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Bad EID=%dd in proberesp\n", pItem
->byElementID
);
790 pItem
= (PWLAN_IE
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
797 * Routine Description:
798 * Encode Authentication frame
808 PWLAN_FR_AUTHEN pFrame
811 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
814 pFrame
->pwAuthAlgorithm
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
815 + WLAN_AUTHEN_OFF_AUTH_ALG
);
816 pFrame
->pwAuthSequence
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
817 + WLAN_AUTHEN_OFF_AUTH_SEQ
);
818 pFrame
->pwStatus
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
819 + WLAN_AUTHEN_OFF_STATUS
);
820 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_AUTHEN_OFF_STATUS
+ sizeof(*(pFrame
->pwStatus
));
827 * Routine Description:
828 * Decode Authentication
838 PWLAN_FR_AUTHEN pFrame
843 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
846 pFrame
->pwAuthAlgorithm
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
847 + WLAN_AUTHEN_OFF_AUTH_ALG
);
848 pFrame
->pwAuthSequence
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
849 + WLAN_AUTHEN_OFF_AUTH_SEQ
);
850 pFrame
->pwStatus
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
851 + WLAN_AUTHEN_OFF_STATUS
);
853 /* Information elements */
854 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
855 + WLAN_AUTHEN_OFF_CHALLENGE
);
857 if (((unsigned char *)pItem
) < (pFrame
->pBuf
+ pFrame
->len
) &&
858 pItem
->byElementID
== WLAN_EID_CHALLENGE
)
859 pFrame
->pChallenge
= (PWLAN_IE_CHALLENGE
)pItem
;
866 * Routine Description:
867 * Encode Authentication
877 PWLAN_FR_DEAUTHEN pFrame
880 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
883 pFrame
->pwReason
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
884 + WLAN_DEAUTHEN_OFF_REASON
);
885 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_DEAUTHEN_OFF_REASON
+ sizeof(*(pFrame
->pwReason
));
892 * Routine Description:
893 * Decode Deauthentication
903 PWLAN_FR_DEAUTHEN pFrame
906 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
909 pFrame
->pwReason
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
910 + 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
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
935 + WLAN_REASSOCRESP_OFF_CAP_INFO
);
936 pFrame
->pwStatus
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
937 + WLAN_REASSOCRESP_OFF_STATUS
);
938 pFrame
->pwAid
= (unsigned short *)(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
));
948 * Routine Description:
949 * Decode Reassociation Response
958 vMgrDecodeReassocResponse(
959 PWLAN_FR_REASSOCRESP pFrame
964 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
967 pFrame
->pwCapInfo
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
968 + WLAN_REASSOCRESP_OFF_CAP_INFO
);
969 pFrame
->pwStatus
= (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
970 + WLAN_REASSOCRESP_OFF_STATUS
);
971 pFrame
->pwAid
= (unsigned short *)(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
)(((unsigned char *)pItem
) + 2 + pItem
->len
);
981 if ((((unsigned char *)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) &&
982 (pItem
->byElementID
== WLAN_EID_EXTSUPP_RATES
)) {
983 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;