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 * vMgrEncodeDisassociation - Encode the Disassociation frame
31 * vMgrDecodeDisassociation - Decode the Disassociation frame
32 * vMgrEncodeAssocRequest - Encode the Association request frame
33 * vMgrDecodeAssocRequest - Decode the Association request frame
34 * vMgrEncodeAssocResponse - Encode the Association response frame
35 * vMgrDecodeAssocResponse - Decode the Association response frame
36 * vMgrEncodeReAssocRequest - Encode the ReAssociation request frame
37 * vMgrDecodeReAssocRequest - Decode the ReAssociation request frame
38 * vMgrEncodeProbeRequest - Encode the Probe request frame
39 * vMgrDecodeProbeRequest - Decode the Probe request frame
40 * vMgrEncodeProbeResponse - Encode the Probe response frame
41 * vMgrDecodeProbeResponse - Decode the Probe response frame
42 * vMgrEncodeAuthen - Encode the Authentication frame
43 * vMgrDecodeAuthen - Decode the Authentication frame
44 * vMgrEncodeDeauthen - Encode the DeAuthentication frame
45 * vMgrDecodeDeauthen - Decode the DeAuthentication frame
46 * vMgrEncodeReassocResponse - Encode the Reassociation response frame
59 static int msglevel
= MSG_LEVEL_INFO
;
60 /*static int msglevel =MSG_LEVEL_DEBUG;*/
64 * Routine Description:
65 * Encode Beacon frame body offset
74 PWLAN_FR_BEACON pFrame
77 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
80 pFrame
->pqwTimestamp
=
81 (u64
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
)) +
83 pFrame
->pwBeaconInterval
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
84 + WLAN_BEACON_OFF_BCN_INT
);
85 pFrame
->pwCapInfo
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
86 + WLAN_BEACON_OFF_CAPINFO
);
88 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_BEACON_OFF_SSID
;
95 * Routine Description:
96 * Decode Beacon frame body offset
106 PWLAN_FR_BEACON pFrame
111 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
114 pFrame
->pqwTimestamp
=
115 (u64
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
)) +
117 pFrame
->pwBeaconInterval
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
118 + WLAN_BEACON_OFF_BCN_INT
);
119 pFrame
->pwCapInfo
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
120 + WLAN_BEACON_OFF_CAPINFO
);
122 /* Information elements */
123 pItem
= (PWLAN_IE
)((u8
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
)))
124 + WLAN_BEACON_OFF_SSID
);
125 while (((u8
*)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
127 switch (pItem
->byElementID
) {
129 if (pFrame
->pSSID
== NULL
)
130 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
132 case WLAN_EID_SUPP_RATES
:
133 if (pFrame
->pSuppRates
== NULL
)
134 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
136 case WLAN_EID_FH_PARMS
:
137 /* pFrame->pFHParms = (PWLAN_IE_FH_PARMS)pItem; */
139 case WLAN_EID_DS_PARMS
:
140 if (pFrame
->pDSParms
== NULL
)
141 pFrame
->pDSParms
= (PWLAN_IE_DS_PARMS
)pItem
;
143 case WLAN_EID_CF_PARMS
:
144 if (pFrame
->pCFParms
== NULL
)
145 pFrame
->pCFParms
= (PWLAN_IE_CF_PARMS
)pItem
;
147 case WLAN_EID_IBSS_PARMS
:
148 if (pFrame
->pIBSSParms
== NULL
)
149 pFrame
->pIBSSParms
= (PWLAN_IE_IBSS_PARMS
)pItem
;
152 if (pFrame
->pTIM
== NULL
)
153 pFrame
->pTIM
= (PWLAN_IE_TIM
)pItem
;
157 if (pFrame
->pRSN
== NULL
)
158 pFrame
->pRSN
= (PWLAN_IE_RSN
)pItem
;
160 case WLAN_EID_RSN_WPA
:
161 if (pFrame
->pRSNWPA
== NULL
) {
162 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == true)
163 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
168 if (pFrame
->pERP
== NULL
)
169 pFrame
->pERP
= (PWLAN_IE_ERP
)pItem
;
171 case WLAN_EID_EXTSUPP_RATES
:
172 if (pFrame
->pExtSuppRates
== NULL
)
173 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
176 case WLAN_EID_COUNTRY
: /* 7 */
177 if (pFrame
->pIE_Country
== NULL
)
178 pFrame
->pIE_Country
= (PWLAN_IE_COUNTRY
)pItem
;
181 case WLAN_EID_PWR_CONSTRAINT
: /* 32 */
182 if (pFrame
->pIE_PowerConstraint
== NULL
)
183 pFrame
->pIE_PowerConstraint
= (PWLAN_IE_PW_CONST
)pItem
;
186 case WLAN_EID_CH_SWITCH
: /* 37 */
187 if (pFrame
->pIE_CHSW
== NULL
)
188 pFrame
->pIE_CHSW
= (PWLAN_IE_CH_SW
)pItem
;
191 case WLAN_EID_QUIET
: /* 40 */
192 if (pFrame
->pIE_Quiet
== NULL
)
193 pFrame
->pIE_Quiet
= (PWLAN_IE_QUIET
)pItem
;
196 case WLAN_EID_IBSS_DFS
:
197 if (pFrame
->pIE_IBSSDFS
== NULL
)
198 pFrame
->pIE_IBSSDFS
= (PWLAN_IE_IBSS_DFS
)pItem
;
202 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Unrecognized EID=%dd in beacon decode.\n", pItem
->byElementID
);
206 pItem
= (PWLAN_IE
)(((u8
*)pItem
) + 2 + pItem
->len
);
212 * Routine Description:
213 * Encode Disassociation
222 vMgrEncodeDisassociation(
223 PWLAN_FR_DISASSOC pFrame
226 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
229 pFrame
->pwReason
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
230 + WLAN_DISASSOC_OFF_REASON
);
231 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_DISASSOC_OFF_REASON
+ sizeof(*(pFrame
->pwReason
));
236 * Routine Description:
237 * Decode Disassociation
246 vMgrDecodeDisassociation(
247 PWLAN_FR_DISASSOC pFrame
250 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
253 pFrame
->pwReason
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
254 + WLAN_DISASSOC_OFF_REASON
);
259 * Routine Description:
260 * Encode Association Request
269 vMgrEncodeAssocRequest(
270 PWLAN_FR_ASSOCREQ pFrame
273 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
275 pFrame
->pwCapInfo
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
276 + WLAN_ASSOCREQ_OFF_CAP_INFO
);
277 pFrame
->pwListenInterval
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
278 + WLAN_ASSOCREQ_OFF_LISTEN_INT
);
279 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_ASSOCREQ_OFF_LISTEN_INT
+ sizeof(*(pFrame
->pwListenInterval
));
284 * Routine Description: (AP)
285 * Decode Association Request
294 vMgrDecodeAssocRequest(
295 PWLAN_FR_ASSOCREQ pFrame
300 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
302 pFrame
->pwCapInfo
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
303 + WLAN_ASSOCREQ_OFF_CAP_INFO
);
304 pFrame
->pwListenInterval
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
305 + WLAN_ASSOCREQ_OFF_LISTEN_INT
);
307 /* Information elements */
308 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
309 + WLAN_ASSOCREQ_OFF_SSID
);
311 while (((u8
*)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
312 switch (pItem
->byElementID
) {
314 if (pFrame
->pSSID
== NULL
)
315 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
317 case WLAN_EID_SUPP_RATES
:
318 if (pFrame
->pSuppRates
== NULL
)
319 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
323 if (pFrame
->pRSN
== NULL
)
324 pFrame
->pRSN
= (PWLAN_IE_RSN
)pItem
;
326 case WLAN_EID_RSN_WPA
:
327 if (pFrame
->pRSNWPA
== NULL
) {
328 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == true)
329 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
332 case WLAN_EID_EXTSUPP_RATES
:
333 if (pFrame
->pExtSuppRates
== NULL
)
334 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
338 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Unrecognized EID=%dd in assocreq decode.\n",
342 pItem
= (PWLAN_IE
)(((u8
*)pItem
) + 2 + pItem
->len
);
348 * Routine Description: (AP)
349 * Encode Association Response
358 vMgrEncodeAssocResponse(
359 PWLAN_FR_ASSOCRESP pFrame
362 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
365 pFrame
->pwCapInfo
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
366 + WLAN_ASSOCRESP_OFF_CAP_INFO
);
367 pFrame
->pwStatus
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
368 + WLAN_ASSOCRESP_OFF_STATUS
);
369 pFrame
->pwAid
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
370 + WLAN_ASSOCRESP_OFF_AID
);
371 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_ASSOCRESP_OFF_AID
372 + sizeof(*(pFrame
->pwAid
));
377 * Routine Description:
378 * Decode Association Response
387 vMgrDecodeAssocResponse(
388 PWLAN_FR_ASSOCRESP pFrame
393 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
396 pFrame
->pwCapInfo
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
397 + WLAN_ASSOCRESP_OFF_CAP_INFO
);
398 pFrame
->pwStatus
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
399 + WLAN_ASSOCRESP_OFF_STATUS
);
400 pFrame
->pwAid
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
401 + WLAN_ASSOCRESP_OFF_AID
);
403 /* Information elements */
404 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
405 + WLAN_ASSOCRESP_OFF_SUPP_RATES
);
407 pItem
= (PWLAN_IE
)(pFrame
->pSuppRates
);
408 pItem
= (PWLAN_IE
)(((u8
*)pItem
) + 2 + pItem
->len
);
410 if ((((u8
*)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) && (pItem
->byElementID
== WLAN_EID_EXTSUPP_RATES
)) {
411 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
412 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"pFrame->pExtSuppRates=[%p].\n", pItem
);
414 pFrame
->pExtSuppRates
= NULL
;
419 * Routine Description:
420 * Encode Reassociation Request
429 vMgrEncodeReassocRequest(
430 PWLAN_FR_REASSOCREQ pFrame
433 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
436 pFrame
->pwCapInfo
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
437 + WLAN_REASSOCREQ_OFF_CAP_INFO
);
438 pFrame
->pwListenInterval
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
439 + WLAN_REASSOCREQ_OFF_LISTEN_INT
);
440 pFrame
->pAddrCurrAP
= (PIEEE_ADDR
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
441 + WLAN_REASSOCREQ_OFF_CURR_AP
);
442 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_REASSOCREQ_OFF_CURR_AP
+ sizeof(*(pFrame
->pAddrCurrAP
));
447 * Routine Description: (AP)
448 * Decode Reassociation Request
457 vMgrDecodeReassocRequest(
458 PWLAN_FR_REASSOCREQ pFrame
462 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
465 pFrame
->pwCapInfo
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
466 + WLAN_REASSOCREQ_OFF_CAP_INFO
);
467 pFrame
->pwListenInterval
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
468 + WLAN_REASSOCREQ_OFF_LISTEN_INT
);
469 pFrame
->pAddrCurrAP
= (PIEEE_ADDR
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
470 + WLAN_REASSOCREQ_OFF_CURR_AP
);
472 /* Information elements */
473 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
474 + WLAN_REASSOCREQ_OFF_SSID
);
476 while (((u8
*)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
478 switch (pItem
->byElementID
) {
480 if (pFrame
->pSSID
== NULL
)
481 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
483 case WLAN_EID_SUPP_RATES
:
484 if (pFrame
->pSuppRates
== NULL
)
485 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
489 if (pFrame
->pRSN
== NULL
)
490 pFrame
->pRSN
= (PWLAN_IE_RSN
)pItem
;
492 case WLAN_EID_RSN_WPA
:
493 if (pFrame
->pRSNWPA
== NULL
)
494 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == true)
495 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
498 case WLAN_EID_EXTSUPP_RATES
:
499 if (pFrame
->pExtSuppRates
== NULL
)
500 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
503 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Unrecognized EID=%dd in reassocreq decode.\n",
507 pItem
= (PWLAN_IE
)(((u8
*)pItem
) + 2 + pItem
->len
);
513 * Routine Description:
514 * Encode Probe Request
523 vMgrEncodeProbeRequest(
524 PWLAN_FR_PROBEREQ pFrame
527 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
528 pFrame
->len
= WLAN_HDR_ADDR3_LEN
;
533 * Routine Description:
534 * Decode Probe Request
543 vMgrDecodeProbeRequest(
544 PWLAN_FR_PROBEREQ pFrame
549 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
551 /* Information elements */
552 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
)));
554 while (((u8
*)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
556 switch (pItem
->byElementID
) {
558 if (pFrame
->pSSID
== NULL
)
559 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
562 case WLAN_EID_SUPP_RATES
:
563 if (pFrame
->pSuppRates
== NULL
)
564 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
567 case WLAN_EID_EXTSUPP_RATES
:
568 if (pFrame
->pExtSuppRates
== NULL
)
569 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
573 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Bad EID=%dd in probereq\n", pItem
->byElementID
);
577 pItem
= (PWLAN_IE
)(((u8
*)pItem
) + 2 + pItem
->len
);
583 * Routine Description:
584 * Encode Probe Response
593 vMgrEncodeProbeResponse(
594 PWLAN_FR_PROBERESP pFrame
597 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
600 pFrame
->pqwTimestamp
=
601 (u64
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
)) +
602 WLAN_PROBERESP_OFF_TS
);
603 pFrame
->pwBeaconInterval
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
604 + WLAN_PROBERESP_OFF_BCN_INT
);
605 pFrame
->pwCapInfo
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
606 + WLAN_PROBERESP_OFF_CAP_INFO
);
608 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_PROBERESP_OFF_CAP_INFO
+
609 sizeof(*(pFrame
->pwCapInfo
));
614 * Routine Description:
615 * Decode Probe Response
624 vMgrDecodeProbeResponse(
625 PWLAN_FR_PROBERESP pFrame
630 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
633 pFrame
->pqwTimestamp
=
634 (u64
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
)) +
635 WLAN_PROBERESP_OFF_TS
);
636 pFrame
->pwBeaconInterval
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
637 + WLAN_PROBERESP_OFF_BCN_INT
);
638 pFrame
->pwCapInfo
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
639 + WLAN_PROBERESP_OFF_CAP_INFO
);
641 /* Information elements */
642 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
643 + WLAN_PROBERESP_OFF_SSID
);
645 while (((u8
*)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) {
646 switch (pItem
->byElementID
) {
648 if (pFrame
->pSSID
== NULL
)
649 pFrame
->pSSID
= (PWLAN_IE_SSID
)pItem
;
651 case WLAN_EID_SUPP_RATES
:
652 if (pFrame
->pSuppRates
== NULL
)
653 pFrame
->pSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
655 case WLAN_EID_FH_PARMS
:
657 case WLAN_EID_DS_PARMS
:
658 if (pFrame
->pDSParms
== NULL
)
659 pFrame
->pDSParms
= (PWLAN_IE_DS_PARMS
)pItem
;
661 case WLAN_EID_CF_PARMS
:
662 if (pFrame
->pCFParms
== NULL
)
663 pFrame
->pCFParms
= (PWLAN_IE_CF_PARMS
)pItem
;
665 case WLAN_EID_IBSS_PARMS
:
666 if (pFrame
->pIBSSParms
== NULL
)
667 pFrame
->pIBSSParms
= (PWLAN_IE_IBSS_PARMS
)pItem
;
671 if (pFrame
->pRSN
== NULL
)
672 pFrame
->pRSN
= (PWLAN_IE_RSN
)pItem
;
674 case WLAN_EID_RSN_WPA
:
675 if (pFrame
->pRSNWPA
== NULL
) {
676 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT
)pItem
) == true)
677 pFrame
->pRSNWPA
= (PWLAN_IE_RSN_EXT
)pItem
;
681 if (pFrame
->pERP
== NULL
)
682 pFrame
->pERP
= (PWLAN_IE_ERP
)pItem
;
684 case WLAN_EID_EXTSUPP_RATES
:
685 if (pFrame
->pExtSuppRates
== NULL
)
686 pFrame
->pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pItem
;
689 case WLAN_EID_COUNTRY
: /* 7 */
690 if (pFrame
->pIE_Country
== NULL
)
691 pFrame
->pIE_Country
= (PWLAN_IE_COUNTRY
)pItem
;
694 case WLAN_EID_PWR_CONSTRAINT
: /* 32 */
695 if (pFrame
->pIE_PowerConstraint
== NULL
)
696 pFrame
->pIE_PowerConstraint
= (PWLAN_IE_PW_CONST
)pItem
;
699 case WLAN_EID_CH_SWITCH
: /* 37 */
700 if (pFrame
->pIE_CHSW
== NULL
)
701 pFrame
->pIE_CHSW
= (PWLAN_IE_CH_SW
)pItem
;
704 case WLAN_EID_QUIET
: /* 40 */
705 if (pFrame
->pIE_Quiet
== NULL
)
706 pFrame
->pIE_Quiet
= (PWLAN_IE_QUIET
)pItem
;
709 case WLAN_EID_IBSS_DFS
:
710 if (pFrame
->pIE_IBSSDFS
== NULL
)
711 pFrame
->pIE_IBSSDFS
= (PWLAN_IE_IBSS_DFS
)pItem
;
715 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Bad EID=%dd in proberesp\n", pItem
->byElementID
);
719 pItem
= (PWLAN_IE
)(((u8
*)pItem
) + 2 + pItem
->len
);
725 * Routine Description:
726 * Encode Authentication frame
736 PWLAN_FR_AUTHEN pFrame
739 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
742 pFrame
->pwAuthAlgorithm
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
743 + WLAN_AUTHEN_OFF_AUTH_ALG
);
744 pFrame
->pwAuthSequence
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
745 + WLAN_AUTHEN_OFF_AUTH_SEQ
);
746 pFrame
->pwStatus
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
747 + WLAN_AUTHEN_OFF_STATUS
);
748 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_AUTHEN_OFF_STATUS
+ sizeof(*(pFrame
->pwStatus
));
753 * Routine Description:
754 * Decode Authentication
764 PWLAN_FR_AUTHEN pFrame
769 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
772 pFrame
->pwAuthAlgorithm
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
773 + WLAN_AUTHEN_OFF_AUTH_ALG
);
774 pFrame
->pwAuthSequence
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
775 + WLAN_AUTHEN_OFF_AUTH_SEQ
);
776 pFrame
->pwStatus
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
777 + WLAN_AUTHEN_OFF_STATUS
);
779 /* Information elements */
780 pItem
= (PWLAN_IE
)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
781 + WLAN_AUTHEN_OFF_CHALLENGE
);
783 if ((((u8
*)pItem
) < (pFrame
->pBuf
+ pFrame
->len
)) && (pItem
->byElementID
== WLAN_EID_CHALLENGE
))
784 pFrame
->pChallenge
= (PWLAN_IE_CHALLENGE
)pItem
;
789 * Routine Description:
790 * Encode Authentication
800 PWLAN_FR_DEAUTHEN pFrame
803 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
806 pFrame
->pwReason
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
807 + WLAN_DEAUTHEN_OFF_REASON
);
808 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_DEAUTHEN_OFF_REASON
+ sizeof(*(pFrame
->pwReason
));
813 * Routine Description:
814 * Decode Deauthentication
824 PWLAN_FR_DEAUTHEN pFrame
827 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
830 pFrame
->pwReason
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
831 + WLAN_DEAUTHEN_OFF_REASON
);
836 * Routine Description: (AP)
837 * Encode Reassociation Response
846 vMgrEncodeReassocResponse(
847 PWLAN_FR_REASSOCRESP pFrame
850 pFrame
->pHdr
= (PUWLAN_80211HDR
)pFrame
->pBuf
;
853 pFrame
->pwCapInfo
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
854 + WLAN_REASSOCRESP_OFF_CAP_INFO
);
855 pFrame
->pwStatus
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
856 + WLAN_REASSOCRESP_OFF_STATUS
);
857 pFrame
->pwAid
= (u16
*)(WLAN_HDR_A3_DATA_PTR(&(pFrame
->pHdr
->sA3
))
858 + WLAN_REASSOCRESP_OFF_AID
);
860 pFrame
->len
= WLAN_HDR_ADDR3_LEN
+ WLAN_REASSOCRESP_OFF_AID
+ sizeof(*(pFrame
->pwAid
));