1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55#include "tmacro.h"
56#include "tether.h"
57#include "80211mgr.h"
58#include "80211hdr.h"
59#include "device.h"
60#include "wpa.h"
61
62
63
64
65
66
67
68static int msglevel = MSG_LEVEL_INFO;
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86void
87vMgrEncodeBeacon(
88 PWLAN_FR_BEACON pFrame
89)
90{
91 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
92
93
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);
100
101 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_BEACON_OFF_SSID;
102
103 return;
104}
105
106
107
108
109
110
111
112
113
114
115
116
117void
118vMgrDecodeBeacon(
119 PWLAN_FR_BEACON pFrame
120)
121{
122 PWLAN_IE pItem;
123
124 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
125
126
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);
133
134
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) {
139 case WLAN_EID_SSID:
140 if (pFrame->pSSID == NULL)
141 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
142 break;
143 case WLAN_EID_SUPP_RATES:
144 if (pFrame->pSuppRates == NULL)
145 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
146 break;
147 case WLAN_EID_FH_PARMS:
148
149 break;
150 case WLAN_EID_DS_PARMS:
151 if (pFrame->pDSParms == NULL)
152 pFrame->pDSParms = (PWLAN_IE_DS_PARMS)pItem;
153 break;
154 case WLAN_EID_CF_PARMS:
155 if (pFrame->pCFParms == NULL)
156 pFrame->pCFParms = (PWLAN_IE_CF_PARMS)pItem;
157 break;
158 case WLAN_EID_IBSS_PARMS:
159 if (pFrame->pIBSSParms == NULL)
160 pFrame->pIBSSParms = (PWLAN_IE_IBSS_PARMS)pItem;
161 break;
162 case WLAN_EID_TIM:
163 if (pFrame->pTIM == NULL)
164 pFrame->pTIM = (PWLAN_IE_TIM)pItem;
165 break;
166
167 case WLAN_EID_RSN:
168 if (pFrame->pRSN == NULL) {
169 pFrame->pRSN = (PWLAN_IE_RSN)pItem;
170 }
171 break;
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;
176 }
177 break;
178
179 case WLAN_EID_ERP:
180 if (pFrame->pERP == NULL)
181 pFrame->pERP = (PWLAN_IE_ERP)pItem;
182 break;
183 case WLAN_EID_EXTSUPP_RATES:
184 if (pFrame->pExtSuppRates == NULL)
185 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
186 break;
187
188 case WLAN_EID_COUNTRY:
189 if (pFrame->pIE_Country == NULL)
190 pFrame->pIE_Country = (PWLAN_IE_COUNTRY)pItem;
191 break;
192
193 case WLAN_EID_PWR_CONSTRAINT:
194 if (pFrame->pIE_PowerConstraint == NULL)
195 pFrame->pIE_PowerConstraint = (PWLAN_IE_PW_CONST)pItem;
196 break;
197
198 case WLAN_EID_CH_SWITCH:
199 if (pFrame->pIE_CHSW == NULL)
200 pFrame->pIE_CHSW = (PWLAN_IE_CH_SW)pItem;
201 break;
202
203 case WLAN_EID_QUIET:
204 if (pFrame->pIE_Quiet == NULL)
205 pFrame->pIE_Quiet = (PWLAN_IE_QUIET)pItem;
206 break;
207
208 case WLAN_EID_IBSS_DFS:
209 if (pFrame->pIE_IBSSDFS == NULL)
210 pFrame->pIE_IBSSDFS = (PWLAN_IE_IBSS_DFS)pItem;
211 break;
212
213 default:
214 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in beacon decode.\n", pItem->byElementID);
215 break;
216
217 }
218 pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
219 }
220
221 return;
222}
223
224
225
226
227
228
229
230
231
232
233
234
235void
236vMgrEncodeIBSSATIM(
237 PWLAN_FR_IBSSATIM pFrame
238)
239{
240 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
241 pFrame->len = WLAN_HDR_ADDR3_LEN;
242
243 return;
244}
245
246
247
248
249
250
251
252
253
254
255
256
257void
258vMgrDecodeIBSSATIM(
259 PWLAN_FR_IBSSATIM pFrame
260)
261{
262 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
263
264 return;
265}
266
267
268
269
270
271
272
273
274
275
276
277
278void
279vMgrEncodeDisassociation(
280 PWLAN_FR_DISASSOC pFrame
281)
282{
283 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
284
285
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));
289
290 return;
291}
292
293
294
295
296
297
298
299
300
301
302
303
304void
305vMgrDecodeDisassociation(
306 PWLAN_FR_DISASSOC pFrame
307)
308{
309 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
310
311
312 pFrame->pwReason = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
313 + WLAN_DISASSOC_OFF_REASON);
314
315 return;
316}
317
318
319
320
321
322
323
324
325
326
327
328
329void
330vMgrEncodeAssocRequest(
331 PWLAN_FR_ASSOCREQ pFrame
332)
333{
334 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
335
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));
341 return;
342}
343
344
345
346
347
348
349
350
351
352
353
354
355void
356vMgrDecodeAssocRequest(
357 PWLAN_FR_ASSOCREQ pFrame
358)
359{
360 PWLAN_IE pItem;
361
362 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
363
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);
368
369
370 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
371 + WLAN_ASSOCREQ_OFF_SSID);
372
373 while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) {
374 switch (pItem->byElementID) {
375 case WLAN_EID_SSID:
376 if (pFrame->pSSID == NULL)
377 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
378 break;
379 case WLAN_EID_SUPP_RATES:
380 if (pFrame->pSuppRates == NULL)
381 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
382 break;
383
384 case WLAN_EID_RSN:
385 if (pFrame->pRSN == NULL) {
386 pFrame->pRSN = (PWLAN_IE_RSN)pItem;
387 }
388 break;
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;
393 }
394 break;
395 case WLAN_EID_EXTSUPP_RATES:
396 if (pFrame->pExtSuppRates == NULL)
397 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
398 break;
399
400 default:
401 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in assocreq decode.\n",
402 pItem->byElementID);
403 break;
404 }
405 pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
406 }
407 return;
408}
409
410
411
412
413
414
415
416
417
418
419
420
421void
422vMgrEncodeAssocResponse(
423 PWLAN_FR_ASSOCRESP pFrame
424)
425{
426 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
427
428
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));
437
438 return;
439}
440
441
442
443
444
445
446
447
448
449
450
451
452void
453vMgrDecodeAssocResponse(
454 PWLAN_FR_ASSOCRESP pFrame
455)
456{
457 PWLAN_IE pItem;
458
459 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
460
461
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);
468
469
470 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
471 + WLAN_ASSOCRESP_OFF_SUPP_RATES);
472
473 pItem = (PWLAN_IE)(pFrame->pSuppRates);
474 pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
475
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);
480 } else {
481 pFrame->pExtSuppRates = NULL;
482 }
483 return;
484}
485
486
487
488
489
490
491
492
493
494
495
496
497void
498vMgrEncodeReassocRequest(
499 PWLAN_FR_REASSOCREQ pFrame
500)
501{
502 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
503
504
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));
512
513 return;
514}
515
516
517
518
519
520
521
522
523
524
525
526
527void
528vMgrDecodeReassocRequest(
529 PWLAN_FR_REASSOCREQ pFrame
530)
531{
532 PWLAN_IE pItem;
533 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
534
535
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);
542
543
544 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
545 + WLAN_REASSOCREQ_OFF_SSID);
546
547 while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) {
548 switch (pItem->byElementID) {
549 case WLAN_EID_SSID:
550 if (pFrame->pSSID == NULL)
551 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
552 break;
553 case WLAN_EID_SUPP_RATES:
554 if (pFrame->pSuppRates == NULL)
555 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
556 break;
557
558 case WLAN_EID_RSN:
559 if (pFrame->pRSN == NULL) {
560 pFrame->pRSN = (PWLAN_IE_RSN)pItem;
561 }
562 break;
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;
567 }
568 break;
569
570 case WLAN_EID_EXTSUPP_RATES:
571 if (pFrame->pExtSuppRates == NULL)
572 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
573 break;
574 default:
575 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in reassocreq decode.\n",
576 pItem->byElementID);
577 break;
578 }
579 pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
580 }
581 return;
582}
583
584
585
586
587
588
589
590
591
592
593
594
595void
596vMgrEncodeProbeRequest(
597 PWLAN_FR_PROBEREQ pFrame
598)
599{
600 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
601 pFrame->len = WLAN_HDR_ADDR3_LEN;
602 return;
603}
604
605
606
607
608
609
610
611
612
613
614
615
616void
617vMgrDecodeProbeRequest(
618 PWLAN_FR_PROBEREQ pFrame
619)
620{
621 PWLAN_IE pItem;
622
623 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
624
625
626 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)));
627
628 while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) {
629 switch (pItem->byElementID) {
630 case WLAN_EID_SSID:
631 if (pFrame->pSSID == NULL)
632 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
633 break;
634
635 case WLAN_EID_SUPP_RATES:
636 if (pFrame->pSuppRates == NULL)
637 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
638 break;
639
640 case WLAN_EID_EXTSUPP_RATES:
641 if (pFrame->pExtSuppRates == NULL)
642 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
643 break;
644
645 default:
646 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Bad EID=%dd in probereq\n", pItem->byElementID);
647 break;
648 }
649
650 pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
651 }
652 return;
653}
654
655
656
657
658
659
660
661
662
663
664
665
666void
667vMgrEncodeProbeResponse(
668 PWLAN_FR_PROBERESP pFrame
669)
670{
671 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
672
673
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);
680
681 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_PROBERESP_OFF_CAP_INFO +
682 sizeof(*(pFrame->pwCapInfo));
683
684 return;
685}
686
687
688
689
690
691
692
693
694
695
696
697
698void
699vMgrDecodeProbeResponse(
700 PWLAN_FR_PROBERESP pFrame
701)
702{
703 PWLAN_IE pItem;
704
705 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
706
707
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);
714
715
716 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
717 + WLAN_PROBERESP_OFF_SSID);
718
719 while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) {
720 switch (pItem->byElementID) {
721 case WLAN_EID_SSID:
722 if (pFrame->pSSID == NULL)
723 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
724 break;
725 case WLAN_EID_SUPP_RATES:
726 if (pFrame->pSuppRates == NULL)
727 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
728 break;
729 case WLAN_EID_FH_PARMS:
730 break;
731 case WLAN_EID_DS_PARMS:
732 if (pFrame->pDSParms == NULL)
733 pFrame->pDSParms = (PWLAN_IE_DS_PARMS)pItem;
734 break;
735 case WLAN_EID_CF_PARMS:
736 if (pFrame->pCFParms == NULL)
737 pFrame->pCFParms = (PWLAN_IE_CF_PARMS)pItem;
738 break;
739 case WLAN_EID_IBSS_PARMS:
740 if (pFrame->pIBSSParms == NULL)
741 pFrame->pIBSSParms = (PWLAN_IE_IBSS_PARMS)pItem;
742 break;
743
744 case WLAN_EID_RSN:
745 if (pFrame->pRSN == NULL) {
746 pFrame->pRSN = (PWLAN_IE_RSN)pItem;
747 }
748 break;
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;
753 }
754 break;
755 case WLAN_EID_ERP:
756 if (pFrame->pERP == NULL)
757 pFrame->pERP = (PWLAN_IE_ERP)pItem;
758 break;
759 case WLAN_EID_EXTSUPP_RATES:
760 if (pFrame->pExtSuppRates == NULL)
761 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
762 break;
763
764 case WLAN_EID_COUNTRY:
765 if (pFrame->pIE_Country == NULL)
766 pFrame->pIE_Country = (PWLAN_IE_COUNTRY)pItem;
767 break;
768
769 case WLAN_EID_PWR_CONSTRAINT:
770 if (pFrame->pIE_PowerConstraint == NULL)
771 pFrame->pIE_PowerConstraint = (PWLAN_IE_PW_CONST)pItem;
772 break;
773
774 case WLAN_EID_CH_SWITCH:
775 if (pFrame->pIE_CHSW == NULL)
776 pFrame->pIE_CHSW = (PWLAN_IE_CH_SW)pItem;
777 break;
778
779 case WLAN_EID_QUIET:
780 if (pFrame->pIE_Quiet == NULL)
781 pFrame->pIE_Quiet = (PWLAN_IE_QUIET)pItem;
782 break;
783
784 case WLAN_EID_IBSS_DFS:
785 if (pFrame->pIE_IBSSDFS == NULL)
786 pFrame->pIE_IBSSDFS = (PWLAN_IE_IBSS_DFS)pItem;
787 break;
788
789 default:
790 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Bad EID=%dd in proberesp\n", pItem->byElementID);
791 break;
792 }
793
794 pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
795 }
796 return;
797}
798
799
800
801
802
803
804
805
806
807
808
809
810void
811vMgrEncodeAuthen(
812 PWLAN_FR_AUTHEN pFrame
813)
814{
815 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
816
817
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));
825
826 return;
827}
828
829
830
831
832
833
834
835
836
837
838
839
840void
841vMgrDecodeAuthen(
842 PWLAN_FR_AUTHEN pFrame
843)
844{
845 PWLAN_IE pItem;
846
847 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
848
849
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
857
858 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
859 + WLAN_AUTHEN_OFF_CHALLENGE);
860
861 if ((((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_CHALLENGE)) {
862 pFrame->pChallenge = (PWLAN_IE_CHALLENGE)pItem;
863 }
864
865 return;
866}
867
868
869
870
871
872
873
874
875
876
877
878
879void
880vMgrEncodeDeauthen(
881 PWLAN_FR_DEAUTHEN pFrame
882)
883{
884 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
885
886
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));
890
891 return;
892}
893
894
895
896
897
898
899
900
901
902
903
904
905void
906vMgrDecodeDeauthen(
907 PWLAN_FR_DEAUTHEN pFrame
908)
909{
910 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
911
912
913 pFrame->pwReason = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
914 + WLAN_DEAUTHEN_OFF_REASON);
915
916 return;
917}
918
919
920
921
922
923
924
925
926
927
928
929
930void
931vMgrEncodeReassocResponse(
932 PWLAN_FR_REASSOCRESP pFrame
933)
934{
935 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
936
937
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);
944
945 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCRESP_OFF_AID + sizeof(*(pFrame->pwAid));
946
947 return;
948}
949
950
951
952
953
954
955
956
957
958
959
960
961void
962vMgrDecodeReassocResponse(
963 PWLAN_FR_REASSOCRESP pFrame
964)
965{
966 PWLAN_IE pItem;
967
968 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
969
970
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);
977
978
979 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
980 + WLAN_REASSOCRESP_OFF_SUPP_RATES);
981
982 pItem = (PWLAN_IE)(pFrame->pSuppRates);
983 pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
984
985 if ((((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) &&
986 (pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) {
987 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
988 }
989 return;
990}
991