blob: f9df7ec55b5e717db125b09c03f4ebe834ecd30d [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
2 * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * Airgo Networks, Inc proprietary. All rights reserved.
24 *
25 * This file limSerDesUtils.cc contains the serializer/deserializer
26 * utility functions LIM uses while communicating with upper layer
27 * software entities
28 * Author: Chandra Modumudi
29 * Date: 10/20/02
30 * History:-
31 * Date Modified by Modification Information
32 * --------------------------------------------------------------------
33 */
34
35#include "aniSystemDefs.h"
36#include "utilsApi.h"
37#include "limTypes.h"
38#include "limUtils.h"
39#include "limSerDesUtils.h"
40
41
42
43/**
44 * limCheckRemainingLength()
45 *
46 *FUNCTION:
47 * This function is called while de-serializing received SME_REQ
48 * message.
49 *
50 *LOGIC:
51 * Remaining message length is checked for > 0.
52 *
53 *ASSUMPTIONS:
54 * NA
55 *
56 *NOTE:
57 * NA
58 *
59 * @param len - Remaining message length
60 * @return retCode - eSIR_SUCCESS if len > 0, else eSIR_FAILURE
61 */
62
63static inline tSirRetStatus
64limCheckRemainingLength(tpAniSirGlobal pMac, tANI_S16 len)
65{
66 if (len > 0)
67 return eSIR_SUCCESS;
68 else
69 {
70 limLog(pMac, LOGW,
71 FL("Received SME message with invalid rem length=%d\n"),
72 len);
73 return eSIR_FAILURE;
74 }
75} /*** end limCheckRemainingLength(pMac, ) ***/
76
77#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
78#else
79/**
80 * limGetBssDescription()
81 *
82 *FUNCTION:
83 * This function is called by various LIM functions to copy
84 * BSS description from a tANI_U8* buffer pointer to tSirBssDescription
85 *
86 *LOGIC:
87 *
88 *ASSUMPTIONS:
89 * NA
90 *
91 *NOTE:
92 * NA
93 *
94 * @param pBssDescription Pointer to the BssDescription to be copied
95 * @param *pBuf Pointer to the source buffer
96 * @param rLen Remaining message length being extracted
97 * @return retCode Indicates whether message is successfully
98 * de-serialized (eSIR_SUCCESS) or
99 * failure (eSIR_FAILURE).
100 */
101
102static tSirRetStatus
103limGetBssDescription( tpAniSirGlobal pMac, tSirBssDescription *pBssDescription,
104 tANI_S16 rLen, tANI_S16 *lenUsed, tANI_U8 *pBuf)
105{
106 tANI_U16 len = 0;
107
108 pBssDescription->length = limGetU16(pBuf);
109 pBuf += sizeof(tANI_U16);
110 len = pBssDescription->length;
111
112 if (rLen < (tANI_S16) (len + sizeof(tANI_U16)))
113 return eSIR_FAILURE;
114
115 *lenUsed = len + sizeof(tANI_U16);
116
117 // Extract bssId
118 palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssDescription->bssId,
119 pBuf, sizeof(tSirMacAddr));
120 pBuf += sizeof(tSirMacAddr);
121 len -= sizeof(tSirMacAddr);
122 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
123 return eSIR_FAILURE;
124
125 // Extract timer
126 palCopyMemory( pMac->hHdd, (tANI_U8 *) (&pBssDescription->scanSysTimeMsec),
127 pBuf, sizeof(v_TIME_t));
128 pBuf += sizeof(v_TIME_t);
129 len -= sizeof(v_TIME_t);
130 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
131 return eSIR_FAILURE;
132
133 // Extract timeStamp
134 palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssDescription->timeStamp,
135 pBuf, sizeof(tSirMacTimeStamp));
136 pBuf += sizeof(tSirMacTimeStamp);
137 len -= sizeof(tSirMacTimeStamp);
138 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
139 return eSIR_FAILURE;
140
141 // Extract beaconInterval
142 pBssDescription->beaconInterval = limGetU16(pBuf);
143 pBuf += sizeof(tANI_U16);
144 len -= sizeof(tANI_U16);
145 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
146 return eSIR_FAILURE;
147
148 // Extract capabilityInfo
149 pBssDescription->capabilityInfo = limGetU16(pBuf);
150 pBuf += sizeof(tANI_U16);
151 len -= sizeof(tANI_U16);
152 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
153 return eSIR_FAILURE;
154
155 // Extract nwType
156 pBssDescription->nwType = (tSirNwType) limGetU32(pBuf);
157 pBuf += sizeof(tSirNwType);
158 len -= sizeof(tSirNwType);
159 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
160 return eSIR_FAILURE;
161
162 // Extract aniIndicator
163 pBssDescription->aniIndicator = *pBuf++;
164 len --;
165
166 // Extract rssi
167 pBssDescription->rssi = (tANI_S8) *pBuf++;
168 len --;
169
170 // Extract sinr
171 pBssDescription->sinr = (tANI_S8) *pBuf++;
172 len --;
173
174 // Extract channelId
175 pBssDescription->channelId = *pBuf++;
176 len --;
177
178 // Extract channelIdSelf
179 pBssDescription->channelIdSelf = *pBuf++;
180 len --;
181 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
182 return eSIR_FAILURE;
183
184 // Extract reserved bssDescription
185 pBuf += sizeof(pBssDescription->sSirBssDescriptionRsvd);
186 len -= sizeof(pBssDescription->sSirBssDescriptionRsvd);
187 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
188 return eSIR_FAILURE;
189
Jeff Johnson295189b2012-06-20 16:38:30 -0700190 //pass the timestamp
191 pBssDescription->nReceivedTime = limGetU32( pBuf );
192 pBuf += sizeof(tANI_TIMESTAMP);
193 len -= sizeof(tANI_TIMESTAMP);
194
195#if defined WLAN_FEATURE_VOWIFI
196 //TSF when the beacon received (parent TSF)
197 pBssDescription->parentTSF = limGetU32( pBuf );
198 pBuf += sizeof(tANI_U32);
199 len -= sizeof(tANI_U32);
200
201 //start TSF of scan during which this BSS desc was updated.
202 pBssDescription->startTSF[0] = limGetU32( pBuf );
203 pBuf += sizeof(tANI_U32);
204 len -= sizeof(tANI_U32);
205
206 //start TSF of scan during which this BSS desc was updated.
207 pBssDescription->startTSF[1] = limGetU32( pBuf );
208 pBuf += sizeof(tANI_U32);
209 len -= sizeof(tANI_U32);
210#endif
211#ifdef WLAN_FEATURE_VOWIFI_11R
212 // MobilityDomain
213 pBssDescription->mdiePresent = *pBuf++;
214 len --;
215 pBssDescription->mdie[0] = *pBuf++;
216 len --;
217 pBssDescription->mdie[1] = *pBuf++;
218 len --;
219 pBssDescription->mdie[2] = *pBuf++;
220 len --;
221#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
222 PELOGE(limLog(pMac, LOGE, FL("mdie=%02x %02x %02x\n"),
223 pBssDescription->mdie[0],
224 pBssDescription->mdie[1],
225 pBssDescription->mdie[2]);)
226#endif
227#endif
228
229#ifdef FEATURE_WLAN_CCX
230 pBssDescription->QBSSLoad_present = limGetU16(pBuf);
231 pBuf += sizeof(tANI_U16);
232 len -= sizeof(tANI_U16);
233 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
234 return eSIR_FAILURE;
235
236 // Extract QBSSLoad_avail
237 pBssDescription->QBSSLoad_avail = limGetU16(pBuf);
238 pBuf += sizeof(tANI_U16);
239 len -= sizeof(tANI_U16);
240 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
241 return eSIR_FAILURE;
242#endif
243
244 if (pBssDescription->WscIeLen)
245 {
246 palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssDescription->WscIeProbeRsp,
247 pBuf,
248 pBssDescription->WscIeLen);
249 }
250
251 pBuf += (sizeof(pBssDescription->WscIeProbeRsp) +
252 sizeof(pBssDescription->WscIeLen) +
253 sizeof(pBssDescription->fProbeRsp) +
254 sizeof(tANI_U32));
255
256 len -= (sizeof(pBssDescription->WscIeProbeRsp) +
257 sizeof(pBssDescription->WscIeLen) +
258 sizeof(pBssDescription->fProbeRsp) +
259 sizeof(tANI_U32));
260
261 if (len)
262 {
263 palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssDescription->ieFields,
264 pBuf,
265 len);
266 }
267
268 return eSIR_SUCCESS;
269} /*** end limGetBssDescription() ***/
270#endif
271
272
273
274/**
275 * limCopyBssDescription()
276 *
277 *FUNCTION:
278 * This function is called by various LIM functions to copy
279 * BSS description to a tANI_U8 buffer
280 *
281 *LOGIC:
282 *
283 *ASSUMPTIONS:
284 * NA
285 *
286 *NOTE:
287 * NA
288 *
289 * @param *pBuf Pointer to the destination buffer
290 * @param pBssDescription Pointer to the BssDescription being copied
291 * @return Length of BSSdescription written
292 */
293
294tANI_U16
295limCopyBssDescription(tpAniSirGlobal pMac, tANI_U8 *pBuf, tSirBssDescription *pBssDescription)
296{
297 tANI_U16 len = 0;
298
299 limCopyU16(pBuf, pBssDescription->length);
300 pBuf += sizeof(tANI_U16);
301 len += sizeof(tANI_U16);
302
303 palCopyMemory( pMac->hHdd, pBuf,
304 (tANI_U8 *) pBssDescription->bssId,
305 sizeof(tSirMacAddr));
306 pBuf += sizeof(tSirMacAddr);
307 len += sizeof(tSirMacAddr);
308
309 PELOG3(limLog(pMac, LOG3,
310 FL("Copying BSSdescr:channel is %d, aniInd is %d, bssId is "),
311 pBssDescription->channelId, pBssDescription->aniIndicator);
312 limPrintMacAddr(pMac, pBssDescription->bssId, LOG3);)
313
314 palCopyMemory( pMac->hHdd, pBuf,
315 (tANI_U8 *) (&pBssDescription->scanSysTimeMsec),
316 sizeof(v_TIME_t));
317 pBuf += sizeof(v_TIME_t);
318 len += sizeof(v_TIME_t);
319
320 limCopyU32(pBuf, pBssDescription->timeStamp[0]);
321 pBuf += sizeof(tANI_U32);
322 len += sizeof(tANI_U32);
323
324 limCopyU32(pBuf, pBssDescription->timeStamp[1]);
325 pBuf += sizeof(tANI_U32);
326 len += sizeof(tANI_U32);
327
328 limCopyU16(pBuf, pBssDescription->beaconInterval);
329 pBuf += sizeof(tANI_U16);
330 len += sizeof(tANI_U16);
331
332 limCopyU16(pBuf, pBssDescription->capabilityInfo);
333 pBuf += sizeof(tANI_U16);
334 len += sizeof(tANI_U16);
335
336 limCopyU32(pBuf, pBssDescription->nwType);
337 pBuf += sizeof(tANI_U32);
338 len += sizeof(tANI_U32);
339
340 *pBuf++ = pBssDescription->aniIndicator;
341 len++;
342
343 *pBuf++ = pBssDescription->rssi;
344 len++;
345
346 *pBuf++ = pBssDescription->sinr;
347 len++;
348
349 *pBuf++ = pBssDescription->channelId;
350 len++;
351
352 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pBssDescription->ieFields),
353 limGetIElenFromBssDescription(pBssDescription));
354
355 return (len + sizeof(tANI_U16));
356} /*** end limCopyBssDescription() ***/
357
358
359
360#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
361/**
362 * limCopyLoad()
363 *
364 *fUNCTION:
365 * This function is called by various LIM functions to copy
366 * load information into a tANI_U8* buffer pointer
367 *
368 *LOGIC:
369 *
370 *ASSUMPTIONS:
371 * NA
372 *
373 *NOTE:
374 * NA
375 *
376 * @param *pBuf Pointer to the destination buffer
377 * @param load load to be copied to destination buffer
378 *
379 * @return None
380 */
381
382static void
383limCopyLoad(tANI_U8 *pBuf, tSirLoad load)
384{
385 limCopyU16(pBuf, load.numStas);
386 pBuf += sizeof(tANI_U16);
387
388 limCopyU16(pBuf, load.channelUtilization);
389 pBuf += sizeof(tANI_U16);
390} /*** end limCopyLoad() ***/
391
392
393
394/**
395 * limGetLoad()
396 *
397 *FUNCTION:
398 * This function is called by various LIM functions to copy
399 * load information into a tANI_U8* buffer pointer
400 *
401 *LOGIC:
402 *
403 *ASSUMPTIONS:
404 * NA
405 *
406 *NOTE:
407 * NA
408 *
409 * @param *pLoad Pointer to load being copied to
410 * @param *pBuf Pointer to the source buffer
411 *
412 * @return None
413 */
414
415static void
416limGetLoad(tSirLoad *pLoad, tANI_U8 *pBuf)
417{
418 pLoad->numStas = limGetU16(pBuf);
419 pBuf += sizeof(tANI_U16);
420
421 pLoad->channelUtilization = limGetU16(pBuf);
422 pBuf += sizeof(tANI_U16);
423} /*** end limGetLoad() ***/
424
425
426
427#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
428/**
429 * limCopyWdsInfo()
430 *
431 *FUNCTION:
432 * This function is called by various LIM functions to copy
433 * WdsInfo information into a tANI_U8* buffer pointer
434 *
435 *LOGIC:
436 *
437 *ASSUMPTIONS:
438 * NA
439 *
440 *NOTE:
441 * NA
442 *
443 * @param *pBuf Pointer to the destination buffer
444 * @param wdsInfo WdsInfo to be copied to destination buffer
445 *
446 * @return Length of WDS info copied
447 */
448
449static tANI_U16
450limCopyWdsInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tpSirWdsInfo pWdsInfo)
451{
452 limCopyU16(pBuf, pWdsInfo->wdsLength);
453 pBuf += sizeof(tANI_U16);
454
455 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) pWdsInfo->wdsBytes, pWdsInfo->wdsLength);
456 pBuf += pWdsInfo->wdsLength;
457
458 return ((tANI_U16) (sizeof(tANI_U16) + pWdsInfo->wdsLength));
459} /*** end limCopyWdsInfo() ***/
460
461
462
463/**
464 * limGetWdsInfo()
465 *
466 *FUNCTION:
467 * This function is called by various LIM functions to copy
468 * WdsInfo information from a tANI_U8* buffer pointer to tSirWdsInfo
469 *
470 *LOGIC:
471 *
472 *ASSUMPTIONS:
473 * NA
474 *
475 *NOTE:
476 * NA
477 *
478 * @param wdsInfo Pointer to the WdsInfo to be copied
479 * @param *pBuf Pointer to the source buffer
480 *
481 * @return true when WDS info extracted successfully else false
482 */
483
484static tANI_U8
485limGetWdsInfo(tpAniSirGlobal pMac, tpSirWdsInfo pWdsInfo, tANI_U8 *pBuf)
486{
487 pWdsInfo->wdsLength = limGetU16(pBuf);
488 pBuf += sizeof(tANI_U16);
489
490 if (pWdsInfo->wdsLength > ANI_WDS_INFO_MAX_LENGTH)
491 return false;
492
493 palCopyMemory( pMac->hHdd, pWdsInfo->wdsBytes, pBuf, pWdsInfo->wdsLength);
494
495 return true;
496} /*** end limGetWdsInfo() ***/
497
498
499
500/**
501 * limGetAlternateRadioList()
502 *
503 *FUNCTION:
504 * This function is called by various LIM functions to copy
505 * alternateRadio information from a tANI_U8* buffer pointer to
506 * tSirAlternateRadioList
507 *
508 *LOGIC:
509 *
510 *ASSUMPTIONS:
511 * NA
512 *
513 *NOTE:
514 * NA
515 *
516 * @param pRadioList Pointer to the radioList to be copied
517 * @param *pBuf Pointer to the source buffer
518 *
519 * @return len Length of copied alternateRadioList
520 */
521
522static tANI_U16
523limGetAlternateRadioList(tpAniSirGlobal pMac, tpSirMultipleAlternateRadioInfo pRadioList,
524 tANI_U8 *pBuf)
525{
526 tANI_U8 i;
527 tANI_U16 len = sizeof(tANI_U8);
528 tpSirAlternateRadioInfo pRadioInfo;
529
530 pRadioList->numBss = *pBuf++;
531
532 if (pRadioList->numBss > SIR_MAX_NUM_ALTERNATE_RADIOS)
533 pRadioList->numBss = SIR_MAX_NUM_ALTERNATE_RADIOS;
534
535 pRadioInfo = pRadioList->alternateRadio;
536 for (i = 0; i < pRadioList->numBss; i++)
537 {
538 palCopyMemory( pMac->hHdd, pRadioInfo->bssId, pBuf, sizeof(tSirMacAddr));
539 pBuf += sizeof(tSirMacAddr);
540 pRadioInfo->channelId = *pBuf++;
541 PELOG3(limLog(pMac, LOG3, FL("Alternate radio[%d] channelId=%d, BssId is \n"),
542 i, pRadioInfo->channelId);
543 limPrintMacAddr(pMac, pRadioInfo->bssId, LOG3);)
544
545 pRadioInfo++;
546 len += sizeof(tSirMacAddr) + sizeof(tANI_U8);
547 }
548
549 return len;
550} /*** end limGetAlternateRadioList() ***/
551#endif
552
553
554
555/**
556 * limCopyNeighborBssInfo()
557 *
558 *FUNCTION:
559 * This function is called by various LIM functions to copy
560 * Neighbor BSS info into a tANI_U8* buffer pointer
561 *
562 *LOGIC:
563 *
564 *ASSUMPTIONS:
565 * NA
566 *
567 *NOTE:
568 * NA
569 *
570 * @param *pBuf Pointer to the destination buffer
571 * @param pBssInfo Pointer to neighbor BSS info be copied
572 * to destination buffer
573 *
574 * @return bssInfoLen Length of bssInfo copied
575 */
576
577tANI_U32
578limCopyNeighborBssInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tpSirNeighborBssInfo pBssInfo)
579{
580 tANI_U32 bssInfoLen = 0;
581
582 palCopyMemory( pMac->hHdd, pBuf,
583 (tANI_U8 *) pBssInfo->bssId,
584 sizeof(tSirMacAddr));
585 pBuf += sizeof(tSirMacAddr);
586 bssInfoLen += sizeof(tSirMacAddr);
587 PELOG3(limLog(pMac, LOG3,
Jeff Johnsone7245742012-09-05 17:12:55 -0700588 FL("Copying new NeighborWds node:channel is %d, wniIndicator is %d, bssType is %d, bssId is "),
589 pBssInfo->channelId, pBssInfo->wniIndicator, pBssInfo->bssType);
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 limPrintMacAddr(pMac, pBssInfo->bssId, LOG3);)
591
592 *pBuf++ = pBssInfo->channelId;
593 bssInfoLen++;
594
Jeff Johnson295189b2012-06-20 16:38:30 -0700595 limCopyU32(pBuf, pBssInfo->wniIndicator);
596 pBuf += sizeof(tANI_U32);
597 bssInfoLen += sizeof(tANI_U32);
598
599 limCopyU32(pBuf, pBssInfo->bssType);
600 pBuf += sizeof(tANI_U32);
601 bssInfoLen += sizeof(tANI_U32);
602
603 *pBuf++ = pBssInfo->sinr;
604 bssInfoLen++;
605 *pBuf++ = pBssInfo->rssi;
606 bssInfoLen++;
607
608 limCopyLoad(pBuf, pBssInfo->load);
609 pBuf += sizeof(tSirLoad);
610 bssInfoLen += sizeof(tSirLoad);
611
612 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pBssInfo->ssId),
613 pBssInfo->ssId.length + 1);
614
615 bssInfoLen += pBssInfo->ssId.length + 1;
616 pBuf += pBssInfo->ssId.length + 1;
617
618 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pBssInfo->apName),
619 pBssInfo->apName.length + 1);
620
621 bssInfoLen += pBssInfo->apName.length + 1;
622 pBuf += pBssInfo->apName.length + 1;
623
624 limCopyU16(pBuf, pBssInfo->rsnIE.length);
625 pBuf += sizeof(tANI_U16);
626 bssInfoLen += sizeof(tANI_U16);
627 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pBssInfo->rsnIE.rsnIEdata),
628 pBssInfo->rsnIE.length);
629
630 bssInfoLen += pBssInfo->rsnIE.length;
631 pBuf += pBssInfo->rsnIE.length;
632
633 limCopyU32(pBuf, pBssInfo->nwType);
634 pBuf += sizeof(tANI_U32);
635 bssInfoLen += sizeof(tANI_U32);
636
637 // not sure we need to do a sirSwapU16ifNeeded ???
638 limCopyU16(pBuf, pBssInfo->capabilityInfo);
639 pBuf += sizeof(tANI_U16);
640 bssInfoLen += sizeof(tANI_U16);
641
642 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pBssInfo->operationalRateSet),
643 pBssInfo->operationalRateSet.numRates + 1);
644 bssInfoLen += pBssInfo->operationalRateSet.numRates + 1;
645 pBuf += pBssInfo->operationalRateSet.numRates + 1;
646
647 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pBssInfo->extendedRateSet),
648 pBssInfo->extendedRateSet.numRates + 1);
649 bssInfoLen += pBssInfo->extendedRateSet.numRates + 1;
650 pBuf += pBssInfo->extendedRateSet.numRates + 1;
651
652 limCopyU16(pBuf, pBssInfo->beaconInterval);
653 pBuf += sizeof(tANI_U16);
654 bssInfoLen += sizeof(tANI_U16);
655
656 *pBuf++ = pBssInfo->dtimPeriod;
657 bssInfoLen++;
658 *pBuf++ = pBssInfo->HTCapsPresent;
659 bssInfoLen++;
660 *pBuf++ = pBssInfo->HTInfoPresent;
661 bssInfoLen++;
662 *pBuf++ = pBssInfo->wmeInfoPresent;
663 bssInfoLen++;
664 *pBuf++ = pBssInfo->wmeEdcaPresent;
665 bssInfoLen++;
666 *pBuf++ = pBssInfo->wsmCapablePresent;
667 bssInfoLen++;
668 *pBuf++ = pBssInfo->hcfEnabled;
669 bssInfoLen++;
670
671 limCopyU16(pBuf, pBssInfo->propIECapability);
672 pBuf += sizeof(tANI_U16);
673 bssInfoLen += sizeof(tANI_U16);
674
675 limCopyU32(pBuf, pBssInfo->localPowerConstraints);
676 pBuf += sizeof(tANI_S32);
677 bssInfoLen += sizeof(tANI_S32);
678
679 limCopyU32(pBuf, pBssInfo->aggrRssi);
680 pBuf += sizeof(tANI_S32);
681 bssInfoLen += sizeof(tANI_S32);
682
683 limCopyU32(pBuf, pBssInfo->dataCount);
684 pBuf += sizeof(tANI_U32);
685 bssInfoLen += sizeof(tANI_U32);
686
687 limCopyU32(pBuf, pBssInfo->totalPackets);
688 pBuf += sizeof(tANI_U32);
689 bssInfoLen += sizeof(tANI_U32);
690
691 return bssInfoLen;
692} /*** end limCopyNeighborBssInfo() ***/
693
694
695/**
696 * limCopyNeighborList()
697 *
698 *FUNCTION:
699 * This function is called by various LIM functions to copy
700 * Neighbor BSS list into a tANI_U8* buffer pointer
701 *
702 *LOGIC:
703 *
704 *ASSUMPTIONS:
705 * NA
706 *
707 *NOTE:
708 * NA
709 *
710 * @param *pBuf Pointer to the destination buffer
711 * @param neighborList Neighbor BSS list be copied to
712 * destination buffer
713 * @param numBss Number of Neighbor BSS list be copied
714 *
715 * @return listLen Length of Neighbor BSS list
716 */
717
718static tANI_U32
719limCopyNeighborList(tpAniSirGlobal pMac, tANI_U8 *pBuf, tpSirNeighborBssInfo pBssInfo, tANI_U32 numBss)
720{
721 tANI_U32 bssInfoLen = 0, listLen = 0;
722 tANI_U8 i;
723 tANI_U8 *pTemp = (tANI_U8 *) pBssInfo;
724
725 PELOG3(limLog(pMac, LOG3, FL("Going to copy BssInfoList:\n"));)
726 PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3,
727 pTemp, numBss*sizeof(tSirNeighborBssInfo));)
728
729 for (i = 0; i < numBss; i++, bssInfoLen = 0)
730 {
731 bssInfoLen = limCopyNeighborBssInfo(pMac,
732 pBuf,
733 (tpSirNeighborBssInfo) &pBssInfo[i]);
734
735 pBuf += bssInfoLen;
736 listLen += bssInfoLen;
737 }
738
739 return listLen;
740} /*** end limCopyNeighborList(pMac, ) ***/
741
742
743/**
744 * limGetNeighborBssInfo()
745 *
746 *FUNCTION:
747 * This function is called by various LIM functions to get
748 * Neighbor BSS info from a tANI_U8* buffer pointer
749 *
750 *LOGIC:
751 *
752 *ASSUMPTIONS:
753 * NA
754 *
755 *NOTE:
756 * NA
757 *
758 * @param pBssInfo Pointer to neighbor BSS info being copied
759 * @param *pBuf Pointer to the source buffer
760 *
761 * @return Size of NeighborBssInfo that is extracted
762 */
763
764tANI_U32
765limGetNeighborBssInfo(tpAniSirGlobal pMac, tpSirNeighborBssInfo pBssInfo, tANI_U8 *pBuf)
766{
767 tANI_U32 len = 0;
768
769 palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssInfo->bssId,
770 pBuf, sizeof(tSirMacAddr));
771 pBuf += sizeof(tSirMacAddr);
772 len += sizeof(tSirMacAddr);
773
774 pBssInfo->channelId = *pBuf++;
775 len++;
776
777 pBssInfo->wniIndicator = (tAniBool) limGetU32(pBuf);
778 pBuf += sizeof(tAniBool);
779 len += sizeof(tAniBool);
780
781 pBssInfo->bssType = (tSirBssType) limGetU32(pBuf);
782 pBuf += sizeof(tSirBssType);
783 len += sizeof(tSirBssType);
784
785 pBssInfo->sinr = *pBuf++;
786 len++;
787 pBssInfo->rssi = *pBuf++;
788 len++;
789
790 limGetLoad(&pBssInfo->load, pBuf);
791 pBuf += sizeof(tSirLoad);
792 len += sizeof(tSirLoad);
793
794 pBssInfo->ssId.length = *pBuf++;
795 palCopyMemory( pMac->hHdd, pBssInfo->ssId.ssId, pBuf, pBssInfo->ssId.length);
796 pBuf += pBssInfo->ssId.length;
797 len += pBssInfo->ssId.length + 1;
798
799 pBssInfo->apName.length = *pBuf++;
800 palCopyMemory( pMac->hHdd, pBssInfo->apName.name, pBuf, pBssInfo->apName.length);
801 pBuf += pBssInfo->apName.length;
802 len += pBssInfo->apName.length + 1;
803
804 pBssInfo->rsnIE.length = limGetU16(pBuf);
805 pBuf += sizeof(tANI_U16);
806 palCopyMemory( pMac->hHdd, pBssInfo->rsnIE.rsnIEdata, pBuf,
807 pBssInfo->rsnIE.length);
808 pBuf += pBssInfo->rsnIE.length;
809 len += pBssInfo->rsnIE.length + 2;
810
811 PELOG2(limLog(pMac, LOG2, FL("BSS type %d channel %d wniInd %d RSN len %d\n"),
812 pBssInfo->bssType, pBssInfo->channelId, pBssInfo->wniIndicator,
813 pBssInfo->rsnIE.length);
814 limPrintMacAddr(pMac, pBssInfo->bssId, LOG2);)
815
816
817 pBssInfo->nwType = (tSirNwType) limGetU32(pBuf);
818 pBuf += sizeof(tSirNwType);
819 len += sizeof(tSirNwType);
820
821 pBssInfo->capabilityInfo = limGetU16(pBuf);
822 pBuf += sizeof(tANI_U16);
823 len += sizeof(tANI_U16);
824
825 pBssInfo->operationalRateSet.numRates = *pBuf++;
826 palCopyMemory( pMac->hHdd, pBssInfo->operationalRateSet.rate, pBuf,
827 pBssInfo->operationalRateSet.numRates);
828 pBuf += pBssInfo->operationalRateSet.numRates;
829 len += pBssInfo->operationalRateSet.numRates + 1;
830
831 pBssInfo->extendedRateSet.numRates = *pBuf++;
832 palCopyMemory( pMac->hHdd, pBssInfo->extendedRateSet.rate, pBuf,
833 pBssInfo->extendedRateSet.numRates);
834 pBuf += pBssInfo->extendedRateSet.numRates;
835 len += pBssInfo->extendedRateSet.numRates + 1;
836
837 pBssInfo->beaconInterval = limGetU16(pBuf);
838 pBuf += sizeof(tANI_U16);
839 len += sizeof(tANI_U16);
840
841 pBssInfo->dtimPeriod = *pBuf++;
842 pBssInfo->HTCapsPresent = *pBuf++;
843 pBssInfo->HTInfoPresent = *pBuf++;
844 pBssInfo->wmeInfoPresent = *pBuf++;
845 pBssInfo->wmeEdcaPresent = *pBuf++;
846 pBssInfo->wsmCapablePresent = *pBuf++;
847 pBssInfo->hcfEnabled = *pBuf++;
848 pBssInfo->propIECapability = limGetU16(pBuf);
849 pBuf += sizeof(tANI_U16);
850 pBssInfo->localPowerConstraints = limGetU32(pBuf);
851 pBuf += sizeof(tANI_U32);
852 len += 13;
853
854 PELOG2(limLog(pMac, LOG2, FL("rsnIELen %d operRateLen %d extendRateLen %d total %d\n"),
855 pBssInfo->rsnIE.length, pBssInfo->operationalRateSet.numRates,
856 pBssInfo->extendedRateSet.numRates, len);)
857
858
859 return len;
860} /*** end limGetNeighborBssInfo() ***/
861
862
863
864#if defined(ANI_PRODUCT_TYPE_AP)
865/**
866 * limGetNeighborBssList()
867 *
868 *FUNCTION:
869 * This function is called by various LIM functions to get
870 * Neighbor BSS list from a tANI_U8* buffer pointer
871 *
872 *LOGIC:
873 *
874 *ASSUMPTIONS:
875 * NA
876 *
877 *NOTE:
878 * NA
879 *
880 * @param *pNeighborList Pointer to neighbor BSS list being copied to
881 * @param *pBuf Pointer to the source buffer
882 * @param rLen Remaining message length being extracted
883 * @return retCode Indicates whether message is successfully
884 * de-serialized (eSIR_SUCCESS) or
885 * failure (eSIR_FAILURE).
886 */
887
888static tSirRetStatus
889limGetNeighborBssList(tpAniSirGlobal pMac,
890 tSirNeighborBssList *pNeighborList,
891 tANI_S16 rLen, tANI_S16 *lenUsed, tANI_U8 *pBuf)
892{
893 tANI_U8 *pBssInfo = (tANI_U8 *) pNeighborList->bssList;
894 tANI_U32 i, bssInfoLen = 0, len = 0, numBss, numBssList;
895
896 numBssList = numBss = limGetU32(pBuf);
897
898 if (!numBss)
899 {
900 PELOG1(limLog(pMac, LOG1, FL("No Neighbor BSS present in Neighbor list\n"));)
901
902 return eSIR_FAILURE;
903 }
904 PELOG2(limLog(pMac, LOG2,
905 FL("Num of Neighbor BSS present in Neighbor list is %d\n"),
906 numBss);)
907
908 pBuf += sizeof(tANI_U32);
909 len += sizeof(tANI_U32);
910 rLen -= sizeof(tANI_U32);
911 if (limCheckRemainingLength(pMac, rLen) == eSIR_FAILURE)
912 return eSIR_FAILURE;
913
914 // First neighborInfo is the one we're attempting to join/reassoc
915 bssInfoLen = limGetNeighborBssInfo(pMac, (tSirNeighborBssInfo *) pBssInfo,
916 pBuf);
917 PELOG1(limLog(pMac, LOG1,
918 FL("BSSinfo len to be joined is %d rem %d, numBss = %d\n"),
919 bssInfoLen, rLen, numBss - 1);)
920 pBuf += bssInfoLen;
921 len += bssInfoLen;
922 rLen -= (tANI_S16) bssInfoLen;
923 numBss--;
924 numBssList--;
925
926 if (numBss > 0)
927 {
928 // Store remaining neighbor BSS info
929 if (numBss > SIR_MAX_NUM_NEIGHBOR_BSS)
930 {
931 // Store only MAX number of Neighbor BSS
932 PELOG2(limLog(pMac, LOG2,
933 FL("Pruning number of neighbors to %d from %d\n"),
934 SIR_MAX_NUM_NEIGHBOR_BSS, numBss);)
935 numBss = SIR_MAX_NUM_NEIGHBOR_BSS;
936 }
937
938 pBssInfo = (tANI_U8 *) pMac->lim.gLimNeighborBssList.bssList;
939 for (i = numBss; i > 0; i--)
940 {
941 PELOG3(limLog(pMac, LOG3, FL("pMac = %p, pBssInfo = %p, pBuf = %p\n"), pMac, pBssInfo, pBuf);)
942 bssInfoLen = limGetNeighborBssInfo(pMac,
943 (tSirNeighborBssInfo *) pBssInfo,
944 pBuf);
945
946 pBssInfo += sizeof(tSirNeighborBssInfo);
947 pBuf += bssInfoLen;
948 len += bssInfoLen;
949 rLen -= (tANI_S16) bssInfoLen;
950 numBssList--;
951
952 PELOG1(limLog(pMac, LOG1, FL("BSS info[%d] len %d rem %d\n"),
953 i, bssInfoLen, rLen);)
954 }
955
956 while (numBssList > 0)
957 {
958 tSirNeighborBssInfo pTemp;
959 bssInfoLen = limGetNeighborBssInfo(pMac, &pTemp, pBuf);
960 pBuf += bssInfoLen;
961 len += bssInfoLen;
962 rLen -= (tANI_S16) bssInfoLen;
963 numBssList--;
964 PELOG1(limLog(pMac, LOG1, FL("BSS info[%d] len %d rem %d\n"),
965 numBssList, bssInfoLen, rLen);)
966 }
967 }
968 *lenUsed = len;
969
970 pMac->lim.gLimNeighborBssList.numBss = pNeighborList->numBss
971 = numBss;
972
973 return eSIR_SUCCESS;
974} /*** end limGetNeighborBssList(pMac, ) ***/
975
976
977
978/**
979 * limCopyNeighborWdsInfo()
980 *
981 *FUNCTION:
982 * This function is called by various LIM functions to copy
983 * detected neighborBssWds info to a tANI_U8 buffer
984 *
985 *LOGIC:
986 *
987 *ASSUMPTIONS:
988 * NA
989 *
990 *NOTE:
991 * NA
992 *
993 * @param *pBuf Pointer to the destination buffer
994 * @param *pInfo Pointer to the NeighborWdsInfo being copied
995 * @return Length of Matrix information copied
996 */
997
998static tANI_U16
999limCopyNeighborWdsInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tpSirNeighborBssWdsInfo pInfo)
1000{
1001 tANI_U16 len = 0;
1002
1003 len = (tANI_U16) limCopyNeighborBssInfo(pMac, pBuf, &pInfo->neighborBssInfo);
1004 pBuf += len;
1005 len += limCopyWdsInfo(pMac, pBuf, &pInfo->wdsInfo);
1006
1007 return len;
1008} /*** end limCopyNeighborWdsInfo() ***/
1009
1010
1011
1012/**
1013 * limCopyMeasMatrixInfo()
1014 *
1015 *FUNCTION:
1016 * This function is called by various LIM functions to copy
1017 * collected Measurement matrix info to a tANI_U8 buffer
1018 *
1019 *LOGIC:
1020 *
1021 *ASSUMPTIONS:
1022 * NA
1023 *
1024 *NOTE:
1025 * NA
1026 *
1027 * @param *pBuf Pointer to the destination buffer
1028 * @param *pInfo Pointer to the matrix info being copied
1029 * @return Length of Matrix information copied
1030 */
1031
1032static tANI_U16
1033limCopyMeasMatrixInfo(tANI_U8 *pBuf, tpLimMeasMatrixNode pInfo)
1034{
1035 tANI_U16 len = 0;
1036
1037 *pBuf++ = pInfo->matrix.channelNumber;
1038 len++;
1039 *pBuf++ = pInfo->matrix.compositeRssi;
1040 len++;
1041 limCopyU32(pBuf, pInfo->matrix.aggrRssi);
1042 pBuf += sizeof(tANI_S32);
1043 len += sizeof(tANI_S32);
1044 limCopyU32(pBuf, pInfo->matrix.totalPackets);
1045 len += sizeof(tANI_U32);
1046
1047 return len;
1048} /*** end limCopyMeasMatrixInfo() ***/
1049
1050
1051
1052/**
1053 * limCopyMeasMatrixList()
1054 *
1055 *FUNCTION:
1056 * This function is called by various LIM functions to copy
1057 * collected Measurement matrix List to a tANI_U8 buffer
1058 *
1059 *LOGIC:
1060 *
1061 *ASSUMPTIONS:
1062 * NA
1063 *
1064 *NOTE:
1065 * NA
1066 *
1067 * @param pMac - Pointer to Global MAC structure
1068 * @param *pBuf - Pointer to the destination buffer
1069 * @return Length of matrix list copied
1070 */
1071
1072static tANI_U16
1073limCopyMeasMatrixList(tpAniSirGlobal pMac, tANI_U8 *pBuf)
1074{
1075 tANI_U16 len = 0, nodeLen = 0;
1076 tANI_U8 numNodes = pMac->lim.gpLimMeasData->numMatrixNodes;
1077
1078 *pBuf++ = numNodes;
1079 len++;
1080
1081 if (numNodes)
1082 {
1083 tpLimMeasMatrixNode pInfo =
1084 pMac->lim.gpLimMeasData->pMeasMatrixInfo;
1085 while (numNodes-- && pInfo) //Safety measure, checking both
1086 {
1087 nodeLen = limCopyMeasMatrixInfo(pBuf, pInfo);
1088 pBuf += nodeLen;
1089 len += nodeLen;
1090
1091 if (pInfo->next)
1092 pInfo = pInfo->next;
1093 else
1094 break;
1095 }
1096
1097 return len;
1098 }
1099 else
1100 {
1101 *pBuf = 0;
1102 return 1;
1103 }
1104} /*** end limCopyMeasMatrixList() ***/
1105
1106
1107
1108/**
1109 * limCopyNeighborWdsList()
1110 *
1111 *FUNCTION:
1112 * This function is called by various LIM functions to copy
1113 * detected neighborBssWds List to a tANI_U8 buffer
1114 *
1115 *LOGIC:
1116 *
1117 *ASSUMPTIONS:
1118 * NA
1119 *
1120 *NOTE:
1121 * NA
1122 *
1123 * @param pMac Pointer to Global MAC structure
1124 * @param *pBuf Pointer to the destination buffer
1125 * @return Length of matrix list copied
1126 */
1127
1128static tANI_U16
1129limCopyNeighborWdsList(tpAniSirGlobal pMac, tANI_U8 *pBuf)
1130{
1131 tANI_U16 len = 0, nodeLen = 0;
1132
1133 if (pMac->lim.gpLimMeasData->numBssWds)
1134 {
1135 limCopyU32(pBuf, pMac->lim.gpLimMeasData->numBssWds);
1136 pBuf += sizeof(tANI_U32);
1137 len += sizeof(tANI_U32);
1138
1139 tpLimNeighborBssWdsNode pInfo =
1140 pMac->lim.gpLimMeasData->pNeighborWdsInfo;
1141 while (pInfo)
1142 {
1143 nodeLen = limCopyNeighborWdsInfo(pMac, pBuf, &pInfo->info);
1144 pBuf += nodeLen;
1145 len += nodeLen;
1146
1147 if (pInfo->next)
1148 pInfo = pInfo->next;
1149 else
1150 break;
1151 }
1152
1153 return len;
1154 }
1155 else
1156 {
1157 limCopyU32(pBuf, 0);
1158 return (sizeof(tANI_U32));
1159 }
1160} /*** end limCopyNeighborWdsList() ***/
1161#endif
1162#endif
1163
1164
1165/**
1166 * limGetKeysInfo()
1167 *
1168 *FUNCTION:
1169 * This function is called by various LIM functions to copy
1170 * key information from a tANI_U8* buffer pointer to tSirKeys
1171 *
1172 *LOGIC:
1173 *
1174 *ASSUMPTIONS:
1175 * NA
1176 *
1177 *NOTE:
1178 * NA
1179 *
1180 * @param *pKeyInfo Pointer to the keyInfo to be copied
1181 * @param *pBuf Pointer to the source buffer
1182 *
1183 * @return Length of key info extracted
1184 */
1185
1186static tANI_U32
1187limGetKeysInfo(tpAniSirGlobal pMac, tpSirKeys pKeyInfo, tANI_U8 *pBuf)
1188{
1189 tANI_U32 len = 0;
1190
1191 pKeyInfo->keyId = *pBuf++;
1192 len++;
1193 pKeyInfo->unicast = *pBuf++;
1194 len++;
1195 pKeyInfo->keyDirection = (tAniKeyDirection) limGetU32(pBuf);
1196 len += sizeof(tAniKeyDirection);
1197 pBuf += sizeof(tAniKeyDirection);
1198
1199 palCopyMemory( pMac->hHdd, pKeyInfo->keyRsc, pBuf, WLAN_MAX_KEY_RSC_LEN);
1200 pBuf += WLAN_MAX_KEY_RSC_LEN;
1201 len += WLAN_MAX_KEY_RSC_LEN;
1202
1203 pKeyInfo->paeRole = *pBuf++;
1204 len++;
1205
1206 pKeyInfo->keyLength = limGetU16(pBuf);
1207 pBuf += sizeof(tANI_U16);
1208 len += sizeof(tANI_U16);
1209 palCopyMemory( pMac->hHdd, pKeyInfo->key, pBuf, pKeyInfo->keyLength);
1210 pBuf += pKeyInfo->keyLength;
1211 len += pKeyInfo->keyLength;
1212
1213 PELOG3(limLog(pMac, LOG3,
1214 FL("Extracted keyId=%d, keyLength=%d, Key is :\n"),
1215 pKeyInfo->keyId, pKeyInfo->keyLength);
1216 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3,
1217 pKeyInfo->key, pKeyInfo->keyLength);)
1218
1219 return len;
1220} /*** end limGetKeysInfo() ***/
1221
1222
1223
1224/**
1225 * limStartBssReqSerDes()
1226 *
1227 *FUNCTION:
1228 * This function is called by limProcessSmeMessages() upon receiving
1229 * SME_START_BSS_REQ from host
1230 *
1231 *PARAMS:
1232 *
1233 *LOGIC:
1234 *
1235 *ASSUMPTIONS:
1236 * NA
1237 *
1238 *NOTE:
1239 * NA
1240 *
1241 * @param pStartBssReq Pointer to tSirSmeStartBssReq being extracted
1242 * @param pBuf Pointer to serialized buffer
1243 * @return retCode Indicates whether message is successfully
1244 * de-serialized (eSIR_SUCCESS) or
1245 * not (eSIR_FAILURE)
1246 */
1247
1248tSirRetStatus
1249limStartBssReqSerDes(tpAniSirGlobal pMac, tpSirSmeStartBssReq pStartBssReq, tANI_U8 *pBuf)
1250{
1251 tANI_S16 len = 0;
1252#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
1253 tANI_U8 i;
1254#endif
1255
1256#ifdef PE_DEBUG_LOG1
1257 tANI_U8 *pTemp = pBuf;
1258#endif
1259
1260 if (!pStartBssReq || !pBuf)
1261 return eSIR_FAILURE;
1262
1263 pStartBssReq->messageType = limGetU16(pBuf);
1264 pBuf += sizeof(tANI_U16);
1265
1266 len = pStartBssReq->length = limGetU16(pBuf);
1267 pBuf += sizeof(tANI_U16);
1268
1269 PELOG1(limLog(pMac, LOG1, FL("SME_START_BSS_REQ length %d bytes is:\n"), len);)
1270 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
1271
1272 if (len < (tANI_S16) sizeof(tANI_U32))
1273 return eSIR_FAILURE;
1274
1275 len -= sizeof(tANI_U32); // skip message header
1276 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1277 return eSIR_FAILURE;
1278
1279 // Extract sessionId
1280 pStartBssReq->sessionId = *pBuf++;
1281 len--;
1282 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1283 return eSIR_FAILURE;
1284
1285 // Extract transactionId
1286 pStartBssReq->transactionId = limGetU16( pBuf );
1287 pBuf += sizeof( tANI_U16 );
1288 len -= sizeof( tANI_U16 );
1289 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1290 return eSIR_FAILURE;
1291
1292 // Extract bssId
1293 palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->bssId, pBuf, sizeof(tSirMacAddr));
1294 pBuf += sizeof(tSirMacAddr);
1295 len -= sizeof(tSirMacAddr);
1296 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1297 return eSIR_FAILURE;
1298
1299 // Extract selfMacAddr
1300 palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->selfMacAddr, pBuf, sizeof(tSirMacAddr));
1301 pBuf += sizeof(tSirMacAddr);
1302 len -= sizeof(tSirMacAddr);
1303 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1304 return eSIR_FAILURE;
1305
1306 // Extract beaconInterval
1307 pStartBssReq->beaconInterval = limGetU16( pBuf );
1308 pBuf += sizeof( tANI_U16 );
1309 len -= sizeof( tANI_U16 );
1310 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1311 return eSIR_FAILURE;
1312
1313 // Extract dot11Mode
1314 pStartBssReq->dot11mode = *pBuf++;
1315 len --;
1316 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1317 return eSIR_FAILURE;
1318
1319 // Extract bssType
1320 pStartBssReq->bssType = (tSirBssType) limGetU32(pBuf);
1321 pBuf += sizeof(tANI_U32);
1322 len -= sizeof(tANI_U32);
1323 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1324 return eSIR_FAILURE;
1325
1326 // Extract ssId
1327 if (*pBuf > SIR_MAC_MAX_SSID_LENGTH)
1328 {
1329 // SSID length is more than max allowed 32 bytes
1330 PELOGW(limLog(pMac, LOGW, FL("Invalid SSID length, len=%d\n"), *pBuf);)
1331 return eSIR_FAILURE;
1332 }
1333
1334 pStartBssReq->ssId.length = *pBuf++;
1335 len--;
1336 if (len < pStartBssReq->ssId.length)
1337 {
1338 limLog(pMac, LOGW,
1339 FL("SSID length is longer that the remaining length. SSID len=%d, remaining len=%d\n"),
1340 pStartBssReq->ssId.length, len);
1341 return eSIR_FAILURE;
1342 }
1343
1344 palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->ssId.ssId,
1345 pBuf,
1346 pStartBssReq->ssId.length);
1347 pBuf += pStartBssReq->ssId.length;
1348 len -= pStartBssReq->ssId.length;
1349 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1350 return eSIR_FAILURE;
1351
1352 // Extract channelId
1353 pStartBssReq->channelId = *pBuf++;
1354 len--;
1355
1356 // Extract CB secondary channel info
Jeff Johnsone7245742012-09-05 17:12:55 -07001357 pStartBssReq->cbMode = (ePhyChanBondState)limGetU32( pBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07001358 pBuf += sizeof( tANI_U32 );
1359 len -= sizeof( tANI_U32 );
1360
1361 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1362 return eSIR_FAILURE;
1363
1364#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
1365 tANI_U16 paramLen = 0;
1366
1367 // Extract alternateRadioList
1368 pStartBssReq->alternateRadioList.numBss = *pBuf;
1369 paramLen = limGetAlternateRadioList(pMac,
1370 &pMac->lim.gLimAlternateRadioList,
1371 pBuf);
1372 pBuf += paramLen;
1373 len -= paramLen;
1374 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1375 return eSIR_FAILURE;
1376
1377 // Extract powerLevel
1378 pStartBssReq->powerLevel = *pBuf++;
1379 len--;
1380 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1381 return eSIR_FAILURE;
1382
1383 // Extract wdsInfo
1384 if (limGetWdsInfo(pMac, &pStartBssReq->wdsInfo, pBuf) == false)
1385 {
1386 limLog(pMac, LOGW, FL("Invalid WDS length %d in SME_START_BSS_REQ\n"),
1387 pStartBssReq->wdsInfo.wdsLength);
1388 return eSIR_FAILURE;
1389 }
1390
1391 pBuf += sizeof(tANI_U16) + pStartBssReq->wdsInfo.wdsLength;
1392 len -= (sizeof(tANI_U16) + pStartBssReq->wdsInfo.wdsLength);
1393 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1394 return eSIR_FAILURE;
1395#endif
1396
1397#ifdef WLAN_SOFTAP_FEATURE
1398 // Extract privacy setting
1399 pStartBssReq->privacy = *pBuf++;
1400 len--;
1401 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1402 return eSIR_FAILURE;
1403
1404 //Extract Uapsd Enable
1405 pStartBssReq->apUapsdEnable = *pBuf++;
1406 len--;
1407 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1408 return eSIR_FAILURE;
1409
1410 //Extract SSID hidden
1411 pStartBssReq->ssidHidden = *pBuf++;
1412 len--;
1413 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1414 return eSIR_FAILURE;
1415
1416 pStartBssReq->fwdWPSPBCProbeReq = *pBuf++;
1417 len--;
1418 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1419 return eSIR_FAILURE;
1420
1421 //Extract HT Protection Enable
1422 pStartBssReq->protEnabled = *pBuf++;
1423 len--;
1424 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1425 return eSIR_FAILURE;
1426
1427 //Extract OBSS Protection Enable
1428 pStartBssReq->obssProtEnabled = *pBuf++;
1429 len--;
1430 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1431 return eSIR_FAILURE;
1432
1433 pStartBssReq->ht_capab = limGetU16(pBuf);
1434 pBuf += sizeof(tANI_U16);
1435 len -= sizeof(tANI_U16);
1436 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1437 return eSIR_FAILURE;
1438
1439 // Extract AuthType
1440 pStartBssReq->authType = (tSirBssType) limGetU32(pBuf);
1441 pBuf += sizeof(tANI_U32);
1442 len -= sizeof(tANI_U32);
1443 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1444 return eSIR_FAILURE;
1445
1446 // Extract dtimPeriod
1447 pStartBssReq->dtimPeriod = limGetU32(pBuf);
1448 pBuf += sizeof(tANI_U32);
1449 len -= sizeof(tANI_U32);
1450 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1451 return eSIR_FAILURE;
1452
1453 // Extract wps state
1454 pStartBssReq->wps_state = *pBuf++;
1455 len--;
1456 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1457 return eSIR_FAILURE;
1458
1459#endif
1460 // Extract bssPersona
1461 pStartBssReq->bssPersona = *pBuf++;
1462 len--;
1463 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1464 return eSIR_FAILURE;
1465
1466 // Extract rsnIe
1467 pStartBssReq->rsnIE.length = limGetU16(pBuf);
1468 pBuf += sizeof(tANI_U16);
1469
1470 // Check for RSN IE length (that includes length of type & length
1471 if (pStartBssReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2)
1472 {
1473 limLog(pMac, LOGW,
1474 FL("Invalid RSN IE length %d in SME_START_BSS_REQ\n"),
1475 pStartBssReq->rsnIE.length);
1476 return eSIR_FAILURE;
1477 }
1478
1479 palCopyMemory( pMac->hHdd, pStartBssReq->rsnIE.rsnIEdata,
1480 pBuf, pStartBssReq->rsnIE.length);
1481
1482 len -= (sizeof(tANI_U16) + pStartBssReq->rsnIE.length);
1483 pBuf += pStartBssReq->rsnIE.length;
1484 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1485 return eSIR_FAILURE;
1486
1487 // Extract nwType
1488 pStartBssReq->nwType = (tSirNwType) limGetU32(pBuf);
1489 pBuf += sizeof(tSirNwType);
1490 len -= sizeof(tSirNwType);
1491 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1492 return eSIR_FAILURE;
1493
1494 // Extract operationalRateSet
1495 pStartBssReq->operationalRateSet.numRates = *pBuf++;
1496
1497 // Check for number of rates
1498 if (pStartBssReq->operationalRateSet.numRates >
1499 SIR_MAC_MAX_NUMBER_OF_RATES)
1500 {
1501 limLog(pMac, LOGW, FL("Invalid numRates %d in SME_START_BSS_REQ\n"),
1502 pStartBssReq->operationalRateSet.numRates);
1503 return eSIR_FAILURE;
1504 }
1505
1506 len--;
1507 if (len < pStartBssReq->operationalRateSet.numRates)
1508 return eSIR_FAILURE;
1509
1510 palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->operationalRateSet.rate,
1511 pBuf,
1512 pStartBssReq->operationalRateSet.numRates);
1513 pBuf += pStartBssReq->operationalRateSet.numRates;
1514 len -= pStartBssReq->operationalRateSet.numRates;
1515
1516 // Extract extendedRateSet
1517 if ((pStartBssReq->nwType == eSIR_11G_NW_TYPE) ||
1518 (pStartBssReq->nwType == eSIR_11N_NW_TYPE ))
1519 {
1520 pStartBssReq->extendedRateSet.numRates = *pBuf++;
1521 len--;
1522 palCopyMemory( pMac->hHdd, pStartBssReq->extendedRateSet.rate,
1523 pBuf, pStartBssReq->extendedRateSet.numRates);
1524 pBuf += pStartBssReq->extendedRateSet.numRates;
1525 len -= pStartBssReq->extendedRateSet.numRates;
1526 }
1527
1528#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
1529 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1530 return eSIR_FAILURE;
1531
1532 limLog(pMac,
1533 LOGW,
1534 FL("Going to parse numSSID in the START_BSS_REQ, len=%d\n"), len);
1535 if (len < 2)
1536 {
1537 // No numSSID parameter in the START_BSS_REQ
1538 limLog(pMac,
1539 LOGW,
1540 FL("No numSSID in the START_BSS_REQ, len=%d\n"), len);
1541 return eSIR_FAILURE;
1542 }
1543
1544 // Extract numSSID
1545 pStartBssReq->numSSID = *pBuf++;
1546 len--;
1547
1548 // Extract ssIdList[]
1549 for (i = 0; (i < pStartBssReq->numSSID) && len; i++)
1550 {
1551 pStartBssReq->ssIdList[i].length = *pBuf++;
1552 len--;
1553 if (len < pStartBssReq->ssIdList[i].length)
1554 {
1555 limLog(pMac, LOGW,
1556 FL("SSID length[%d] is more than the rem length[%d]\n"),
1557 pStartBssReq->ssIdList[i].length, len);
1558 return eSIR_FAILURE;
1559 }
1560
1561 if (pStartBssReq->ssIdList[i].length > SIR_MAC_MAX_SSID_LENGTH)
1562 {
1563 // SSID length is more than max allowed 32 bytes
1564 limLog(pMac,
1565 LOGW,
1566 FL("Invalid SSID length in the list, len=%d\n"),
1567 pStartBssReq->ssIdList[i].length);
1568 return eSIR_FAILURE;
1569 }
1570
1571 palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->ssIdList[i].ssId,
1572 pBuf,
1573 pStartBssReq->ssIdList[i].length);
1574 pBuf += pStartBssReq->ssIdList[i].length;
1575 len -= pStartBssReq->ssIdList[i].length;
1576 }
1577#endif
1578
1579 if (len)
1580 {
1581 limLog(pMac, LOGW, FL("Extra bytes left in SME_START_BSS_REQ, len=%d\n"), len);
1582 }
1583
1584 return eSIR_SUCCESS;
1585} /*** end limStartBssReqSerDes() ***/
1586
1587
1588
1589/**
1590 * limStopBssReqSerDes()
1591 *
1592 *FUNCTION:
1593 * This function is called by limProcessSmeMessages() upon receiving
1594 * SME_STOP_BSS_REQ from host
1595 *
1596 *PARAMS:
1597 *
1598 *LOGIC:
1599 *
1600 *ASSUMPTIONS:
1601 * NA
1602 *
1603 *NOTE:
1604 * NA
1605 *
1606 * @param pStopBssReq Pointer to tSirSmeStopBssReq being extracted
1607 * @param pBuf Pointer to serialized buffer
1608 * @return retCode Indicates whether message is successfully
1609 * de-serialized (eSIR_SUCCESS) or
1610 * not (eSIR_FAILURE)
1611 */
1612
1613tSirRetStatus
1614limStopBssReqSerDes(tpAniSirGlobal pMac, tpSirSmeStopBssReq pStopBssReq, tANI_U8 *pBuf)
1615{
1616 tANI_S16 len = 0;
1617
1618#ifdef PE_DEBUG_LOG1
1619 tANI_U8 *pTemp = pBuf;
1620#endif
1621
1622 pStopBssReq->messageType = limGetU16(pBuf);
1623 pBuf += sizeof(tANI_U16);
1624
1625 len = pStopBssReq->length = limGetU16(pBuf);
1626 pBuf += sizeof(tANI_U16);
1627
1628 PELOG1(limLog(pMac, LOG1, FL("SME_STOP_BSS_REQ length %d bytes is:\n"), len);)
1629 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
1630
1631 if (len < (tANI_S16) sizeof(tANI_U32))
1632 return eSIR_FAILURE;
1633
1634 len -= sizeof(tANI_U32); // skip message header
1635 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1636 return eSIR_FAILURE;
1637
1638 // Extract sessionId
1639 pStopBssReq->sessionId = *pBuf++;
1640 len--;
1641 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1642 return eSIR_FAILURE;
1643
1644 // Extract transactionId
1645 pStopBssReq->transactionId = limGetU16(pBuf);
1646 pBuf += sizeof(tANI_U16);
1647 len -= sizeof(tANI_U16);
1648
1649 // Extract reasonCode
1650 pStopBssReq->reasonCode = (tSirResultCodes) limGetU32(pBuf);
1651 pBuf += sizeof(tSirResultCodes);
1652 len -= sizeof(tSirResultCodes);
1653
1654 // Extract bssId
1655 palCopyMemory( pMac->hHdd, (tANI_U8 *) pStopBssReq->bssId, pBuf, sizeof(tSirMacAddr));
1656 len -= sizeof(tSirMacAddr);
1657
1658 if (len)
1659 return eSIR_FAILURE;
1660 else
1661 return eSIR_SUCCESS;
1662
1663} /*** end limStopBssReqSerDes() ***/
1664
1665
1666
1667/**
1668 * limJoinReqSerDes()
1669 *
1670 *FUNCTION:
1671 * This function is called by limProcessSmeMessages() upon receiving
1672 * SME_JOIN_REQ from host
1673 *
1674 *PARAMS:
1675 *
1676 *LOGIC:
1677 *
1678 *ASSUMPTIONS:
1679 * NA
1680 *
1681 *NOTE:
1682 * NA
1683 *
1684 * @param pJoinReq Pointer to tSirSmeJoinReq being extracted
1685 * @param pBuf Pointer to serialized buffer
1686 * @return retCode Indicates whether message is successfully
1687 * de-serialized (eSIR_SUCCESS) or
1688 * not (eSIR_FAILURE)
1689 */
1690
1691tSirRetStatus
1692limJoinReqSerDes(tpAniSirGlobal pMac, tpSirSmeJoinReq pJoinReq, tANI_U8 *pBuf)
1693{
1694 tANI_S16 len = 0;
1695 tANI_S16 lenUsed = 0;
1696
1697#ifdef PE_DEBUG_LOG1
1698 tANI_U8 *pTemp = pBuf;
1699#endif
1700
1701 if (!pJoinReq || !pBuf)
1702 {
1703 PELOGE(limLog(pMac, LOGE, FL("NULL ptr received\n"));)
1704 return eSIR_FAILURE;
1705 }
1706
1707 // Extract messageType
1708 pJoinReq->messageType = limGetU16(pBuf);
1709 pBuf += sizeof(tANI_U16);
1710
1711 // Extract length
1712 len = pJoinReq->length = limGetU16(pBuf);
1713 pBuf += sizeof(tANI_U16);
1714
1715 if (pJoinReq->messageType == eWNI_SME_JOIN_REQ)
1716 PELOG1(limLog(pMac, LOG3, FL("SME_JOIN_REQ length %d bytes is:\n"), len);)
1717 else
1718 PELOG1(limLog(pMac, LOG3, FL("SME_REASSOC_REQ length %d bytes is:\n"), len);)
1719
1720 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
1721
1722 if (len < (tANI_S16) sizeof(tANI_U32))
1723 {
1724 PELOGE(limLog(pMac, LOGE, FL("len too short %d\n"), len);)
1725 return eSIR_FAILURE;
1726 }
1727
1728 len -= sizeof(tANI_U32); // skip message header
1729 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1730 return eSIR_FAILURE;
1731
1732 // Extract sessionId
1733 pJoinReq->sessionId = *pBuf++;
1734 len--;
1735 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1736 return eSIR_FAILURE;
1737
1738 // Extract transactionId
1739 pJoinReq->transactionId = limGetU16(pBuf);
1740 pBuf += sizeof(tANI_U16);
1741 len -= sizeof(tANI_U16);
1742 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1743 return eSIR_FAILURE;
1744
1745 // Extract ssId
1746 pJoinReq->ssId.length = *pBuf++;
1747 len--;
1748 palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->ssId.ssId, pBuf, pJoinReq->ssId.length);
1749 pBuf += pJoinReq->ssId.length;
1750 len -= pJoinReq->ssId.length;
1751 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1752 return eSIR_FAILURE;
1753
1754 // Extract selfMacAddr
1755 palCopyMemory( pMac->hHdd, pJoinReq->selfMacAddr, pBuf, sizeof(tSirMacAddr));
1756 pBuf += sizeof(tSirMacAddr);
1757 len -= sizeof(tSirMacAddr);
1758 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1759 return eSIR_FAILURE;
1760
1761 // Extract bsstype
1762 pJoinReq->bsstype = (tSirBssType) limGetU32(pBuf);
1763 pBuf += sizeof(tANI_U32);
1764 len -= sizeof(tANI_U32);
1765 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1766 return eSIR_FAILURE;
1767
1768 // Extract dot11mode
1769 pJoinReq->dot11mode= *pBuf++;
1770 len--;
1771 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1772 return eSIR_FAILURE;
1773
1774 // Extract bssPersona
1775 pJoinReq->staPersona = *pBuf++;
1776 len--;
1777 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1778 return eSIR_FAILURE;
1779
Jeff Johnsone7245742012-09-05 17:12:55 -07001780 // Extract cbMode
1781 pJoinReq->cbMode = *pBuf++;
1782 len--;
1783 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1784 return eSIR_FAILURE;
1785
Jeff Johnson295189b2012-06-20 16:38:30 -07001786 // Extract uapsdPerAcBitmask
1787 pJoinReq->uapsdPerAcBitmask = *pBuf++;
1788 len--;
1789 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1790 return eSIR_FAILURE;
1791
1792#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
1793 // Extract assocType
1794 pJoinReq->assocType = (tSirAssocType) limGetU32(pBuf);
1795 pBuf += sizeof(tSirAssocType);
1796 len -= sizeof(tSirAssocType);
1797 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1798 return eSIR_FAILURE;
1799#endif
1800
1801 // Extract operationalRateSet
1802 pJoinReq->operationalRateSet.numRates= *pBuf++;
1803 len--;
1804 if (pJoinReq->operationalRateSet.numRates)
1805 {
1806 palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->operationalRateSet.rate, pBuf, pJoinReq->operationalRateSet.numRates);
1807 pBuf += pJoinReq->operationalRateSet.numRates;
1808 len -= pJoinReq->operationalRateSet.numRates;
1809 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1810 return eSIR_FAILURE;
1811 }
1812
1813 // Extract extendedRateSet
1814 pJoinReq->extendedRateSet.numRates = *pBuf++;
1815 len--;
1816 if (pJoinReq->extendedRateSet.numRates)
1817 {
1818 palCopyMemory( pMac->hHdd, pJoinReq->extendedRateSet.rate, pBuf, pJoinReq->extendedRateSet.numRates);
1819 pBuf += pJoinReq->extendedRateSet.numRates;
1820 len -= pJoinReq->extendedRateSet.numRates;
1821 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1822 return eSIR_FAILURE;
1823 }
1824
1825 // Extract RSN IE
1826 pJoinReq->rsnIE.length = limGetU16(pBuf);
1827 pBuf += sizeof(tANI_U16);
1828 len -= sizeof(tANI_U16);
1829
1830 if (pJoinReq->rsnIE.length)
1831 {
1832 // Check for RSN IE length (that includes length of type & length)
1833 if ((pJoinReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2) ||
1834 (pJoinReq->rsnIE.length != 2 + *(pBuf + 1)))
1835 {
1836 limLog(pMac, LOGW,
1837 FL("Invalid RSN IE length %d in SME_JOIN_REQ\n"),
1838 pJoinReq->rsnIE.length);
1839 return eSIR_FAILURE;
1840 }
1841 palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->rsnIE.rsnIEdata,
1842 pBuf, pJoinReq->rsnIE.length);
1843 pBuf += pJoinReq->rsnIE.length;
1844 len -= pJoinReq->rsnIE.length; // skip RSN IE
1845 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1846 return eSIR_FAILURE;
1847 }
1848
1849#ifdef FEATURE_WLAN_CCX
1850 // Extract CCKM IE
1851 pJoinReq->cckmIE.length = limGetU16(pBuf);
1852 pBuf += sizeof(tANI_U16);
1853 len -= sizeof(tANI_U16);
1854 if (pJoinReq->cckmIE.length)
1855 {
1856 // Check for CCKM IE length (that includes length of type & length)
1857 if ((pJoinReq->cckmIE.length > SIR_MAC_MAX_IE_LENGTH) ||
1858 (pJoinReq->cckmIE.length != (2 + *(pBuf + 1))))
1859 {
1860 limLog(pMac, LOGW,
1861 FL("Invalid CCKM IE length %d/%d in SME_JOIN/REASSOC_REQ\n"),
1862 pJoinReq->cckmIE.length, 2 + *(pBuf + 1));
1863 return eSIR_FAILURE;
1864 }
1865 palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->cckmIE.cckmIEdata,
1866 pBuf, pJoinReq->cckmIE.length);
1867 pBuf += pJoinReq->cckmIE.length;
1868 len -= pJoinReq->cckmIE.length; // skip CCKM IE
1869 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1870 return eSIR_FAILURE;
1871 }
1872#endif
1873
1874 // Extract Add IE for scan
1875 pJoinReq->addIEScan.length = limGetU16(pBuf);
1876 pBuf += sizeof(tANI_U16);
1877 len -= sizeof(tANI_U16);
1878
1879 if (pJoinReq->addIEScan.length)
1880 {
1881 // Check for IE length (that includes length of type & length)
1882 if (pJoinReq->addIEScan.length > SIR_MAC_MAX_IE_LENGTH + 2)
1883 {
1884 limLog(pMac, LOGE,
1885 FL("Invalid addIE Scan length %d in SME_JOIN_REQ\n"),
1886 pJoinReq->addIEScan.length);
1887 return eSIR_FAILURE;
1888 }
1889 // Check for P2P IE length (that includes length of type & length)
1890 palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->addIEScan.addIEdata,
1891 pBuf, pJoinReq->addIEScan.length);
1892 pBuf += pJoinReq->addIEScan.length;
1893 len -= pJoinReq->addIEScan.length; // skip add IE
1894 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1895 return eSIR_FAILURE;
1896 }
1897
1898 pJoinReq->addIEAssoc.length = limGetU16(pBuf);
1899 pBuf += sizeof(tANI_U16);
1900 len -= sizeof(tANI_U16);
1901
1902 // Extract Add IE for assoc
1903 if (pJoinReq->addIEAssoc.length)
1904 {
1905 // Check for IE length (that includes length of type & length)
1906 if (pJoinReq->addIEAssoc.length > SIR_MAC_MAX_IE_LENGTH + 2)
1907 {
1908 limLog(pMac, LOGE,
1909 FL("Invalid addIE Assoc length %d in SME_JOIN_REQ\n"),
1910 pJoinReq->addIEAssoc.length);
1911 return eSIR_FAILURE;
1912 }
1913 // Check for P2P IE length (that includes length of type & length)
1914 palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->addIEAssoc.addIEdata,
1915 pBuf, pJoinReq->addIEAssoc.length);
1916 pBuf += pJoinReq->addIEAssoc.length;
1917 len -= pJoinReq->addIEAssoc.length; // skip add IE
1918 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1919 return eSIR_FAILURE;
1920 }
1921
1922 pJoinReq->MCEncryptionType = limGetU32(pBuf);
1923 pBuf += sizeof(tANI_U32);
1924 len -= sizeof(tANI_U32);
1925 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1926 return eSIR_FAILURE;
1927
1928 pJoinReq->UCEncryptionType = limGetU32(pBuf);
1929 pBuf += sizeof(tANI_U32);
1930 len -= sizeof(tANI_U32);
1931 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1932 return eSIR_FAILURE;
1933
1934#ifdef WLAN_FEATURE_VOWIFI_11R
1935 //is11Rconnection;
1936 pJoinReq->is11Rconnection = (tAniBool)limGetU32(pBuf);
1937 pBuf += sizeof(tAniBool);
1938 len -= sizeof(tAniBool);
1939 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1940 return eSIR_FAILURE;
1941#endif
1942
1943#ifdef FEATURE_WLAN_CCX
1944 //isCCXconnection;
1945 pJoinReq->isCCXconnection = (tAniBool)limGetU32(pBuf);
1946 pBuf += sizeof(tAniBool);
1947 len -= sizeof(tAniBool);
1948 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1949 return eSIR_FAILURE;
1950
1951 // TSPEC information
1952 pJoinReq->ccxTspecInfo.numTspecs = *pBuf++;
1953 len -= sizeof(tANI_U8);
1954 palCopyMemory(pMac->hHdd, (void*)&pJoinReq->ccxTspecInfo.tspec[0], pBuf, (sizeof(tTspecInfo)* pJoinReq->ccxTspecInfo.numTspecs));
1955 pBuf += sizeof(tTspecInfo)*SIR_CCX_MAX_TSPEC_IES;
1956 len -= sizeof(tTspecInfo)*SIR_CCX_MAX_TSPEC_IES;
1957 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1958 return eSIR_FAILURE;
1959#endif
1960
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001961#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07001962 //isFastTransitionEnabled;
1963 pJoinReq->isFastTransitionEnabled = (tAniBool)limGetU32(pBuf);
1964 pBuf += sizeof(tAniBool);
1965 len -= sizeof(tAniBool);
1966 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1967 return eSIR_FAILURE;
1968#endif
1969
Jeff Johnson43971f52012-07-17 12:26:56 -07001970#ifdef FEATURE_WLAN_LFR
1971 //isFastRoamIniFeatureEnabled;
1972 pJoinReq->isFastRoamIniFeatureEnabled = (tAniBool)limGetU32(pBuf);
1973 pBuf += sizeof(tAniBool);
1974 len -= sizeof(tAniBool);
1975 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1976 return eSIR_FAILURE;
1977#endif
1978
Jeff Johnson295189b2012-06-20 16:38:30 -07001979#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
1980 // Extract BP Indicator
1981 pJoinReq->bpIndicator = (tAniBool) limGetU32(pBuf);
1982 pBuf += sizeof(tAniBool);
1983 len -= sizeof(tAniBool);
1984 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1985 return eSIR_FAILURE;
1986
1987 // Extract BP Type
1988 pJoinReq->bpType = (tSirBpIndicatorType) limGetU32(pBuf);
1989 pBuf += sizeof(tSirBpIndicatorType);
1990 len -= sizeof(tSirBpIndicatorType);
1991 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1992 return eSIR_FAILURE;
1993
1994 // Extract Neighbor BSS List
1995 if (limGetNeighborBssList(pMac, &pJoinReq->neighborBssList,
1996 len, &lenUsed, pBuf) == eSIR_FAILURE)
1997 {
1998 PELOGE(limLog(pMac, LOGE, FL("get neighbor bss list failed\n"));)
1999 return eSIR_FAILURE;
2000 }
2001 pBuf += lenUsed;
2002 len -= lenUsed;
2003 PELOG1(limLog(pMac, LOG1, FL("Assoc Type %d RSN len %d bp %d type %d bss RSN len %d\n"),
2004 pJoinReq->assocType, pJoinReq->rsnIE.length, pJoinReq->bpIndicator,
2005 pJoinReq->bpType, pJoinReq->neighborBssList.bssList->rsnIE.length);)
2006#endif
2007
2008 // Extract Titan CB Neighbor BSS info
2009 pJoinReq->cbNeighbors.cbBssFoundPri = *pBuf;
2010 pBuf++;
2011 pJoinReq->cbNeighbors.cbBssFoundSecUp = *pBuf;
2012 pBuf++;
2013 pJoinReq->cbNeighbors.cbBssFoundSecDown = *pBuf;
2014 pBuf++;
2015 len -= 3;
2016
2017 // Extract Spectrum Mgt Indicator
2018 pJoinReq->spectrumMgtIndicator = (tAniBool) limGetU32(pBuf);
2019 pBuf += sizeof(tAniBool);
2020 len -= sizeof(tAniBool);
2021
2022 pJoinReq->powerCap.minTxPower = *pBuf++;
2023 pJoinReq->powerCap.maxTxPower = *pBuf++;
2024 len -=2;
2025 limLog(pMac, LOGE, FL("Power Caps: Min power = %d, Max power = %d\n"), pJoinReq->powerCap.minTxPower, pJoinReq->powerCap.maxTxPower);
2026
2027 pJoinReq->supportedChannels.numChnl = *pBuf++;
2028 len--;
2029 palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->supportedChannels.channelList,
2030 pBuf, pJoinReq->supportedChannels.numChnl);
2031 pBuf += pJoinReq->supportedChannels.numChnl;
2032 len-= pJoinReq->supportedChannels.numChnl;
2033
2034 PELOG2(limLog(pMac, LOG2,
2035 FL("spectrumInd ON: minPower %d, maxPower %d , numChnls %d\n"),
2036 pJoinReq->powerCap.minTxPower,
2037 pJoinReq->powerCap.maxTxPower,
2038 pJoinReq->supportedChannels.numChnl);)
2039
2040 // Extract uapsdPerAcBitmask
2041 pJoinReq->uapsdPerAcBitmask = *pBuf++;
2042 len--;
2043 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2044 return eSIR_FAILURE;
2045
2046#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA)
2047 //
2048 // NOTE - tSirBssDescription is now moved to the end
2049 // of tSirSmeJoinReq structure. This is to accomodate
2050 // the variable length data member ieFields[1]
2051 //
2052 if (limGetBssDescription( pMac, &pJoinReq->bssDescription,
2053 len, &lenUsed, pBuf) == eSIR_FAILURE)
2054 {
2055 PELOGE(limLog(pMac, LOGE, FL("get bss description failed\n"));)
2056 return eSIR_FAILURE;
2057 }
2058 PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, (tANI_U8 *) &(pJoinReq->bssDescription), pJoinReq->bssDescription.length + 2);)
2059 pBuf += lenUsed;
2060 len -= lenUsed;
2061#endif
2062
2063 return eSIR_SUCCESS;
2064} /*** end limJoinReqSerDes() ***/
2065
2066
2067/**---------------------------------------------------------------
2068\fn limAssocIndSerDes
2069\brief This function is called by limProcessMlmAssocInd() to
2070\ populate the SME_ASSOC_IND message based on the received
2071\ MLM_ASSOC_IND.
2072\
2073\param pMac
2074\param pAssocInd - Pointer to the received tLimMlmAssocInd
2075\param pBuf - Pointer to serialized buffer
2076\param psessionEntry - pointer to PE session entry
2077\
2078\return None
2079------------------------------------------------------------------*/
2080void
2081limAssocIndSerDes(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
2082{
2083 tANI_U8 *pLen = pBuf;
2084 tANI_U16 mLen = 0;
2085
2086#ifdef PE_DEBUG_LOG1
2087 tANI_U8 *pTemp = pBuf;
2088#endif
2089
2090#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
2091 tANI_U32 len = 0;
2092#endif
2093
2094 mLen = sizeof(tANI_U32);
2095 mLen += sizeof(tANI_U8);
2096 pBuf += sizeof(tANI_U16);
2097 *pBuf = psessionEntry->smeSessionId;
2098 pBuf += sizeof(tANI_U8);
2099
2100 // Fill in peerMacAddr
2101 palCopyMemory( pMac->hHdd, pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr));
2102 pBuf += sizeof(tSirMacAddr);
2103 mLen += sizeof(tSirMacAddr);
2104
2105 // Fill in aid
2106 limCopyU16(pBuf, pAssocInd->aid);
2107 pBuf += sizeof(tANI_U16);
2108 mLen += sizeof(tANI_U16);
2109
2110 // Fill in bssId
2111 palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
2112 pBuf += sizeof(tSirMacAddr);
2113 mLen += sizeof(tSirMacAddr);
2114
2115 // Fill in staId
2116 limCopyU16(pBuf, psessionEntry->staId);
2117 pBuf += sizeof(tANI_U16);
2118 mLen += sizeof(tANI_U16);
2119
2120 // Fill in authType
2121 limCopyU32(pBuf, pAssocInd->authType);
2122 pBuf += sizeof(tANI_U32);
2123 mLen += sizeof(tANI_U32);
2124
2125 // Fill in ssId
2126 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
2127 pBuf += (1 + pAssocInd->ssId.length);
2128 mLen += (1 + pAssocInd->ssId.length);
2129
2130 // Fill in rsnIE
2131 limCopyU16(pBuf, pAssocInd->rsnIE.length);
2132 pBuf += sizeof(tANI_U16);
2133 mLen += sizeof(tANI_U16);
2134 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
2135 pAssocInd->rsnIE.length);
2136 pBuf += pAssocInd->rsnIE.length;
2137 mLen += pAssocInd->rsnIE.length;
2138
2139#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
2140
2141 limCopyU16(pBuf, pAssocInd->seqNum);
2142 pBuf += sizeof(tANI_U16);
2143 mLen += sizeof(tANI_U16);
2144
2145 limCopyU32(pBuf, pAssocInd->wniIndicator);
2146 pBuf += sizeof(tAniBool);
2147 mLen += sizeof(tAniBool);
2148
2149 limCopyU32(pBuf, pAssocInd->bpIndicator);
2150 pBuf += sizeof(tAniBool);
2151 mLen += sizeof(tAniBool);
2152
2153 limCopyU32(pBuf, pAssocInd->bpType);
2154 pBuf += sizeof(tSirBpIndicatorType);
2155 mLen += sizeof(tSirBpIndicatorType);
2156
2157 limCopyU32(pBuf, pAssocInd->assocType);
2158 pBuf += sizeof(tANI_U32);
2159 mLen += sizeof(tANI_U32);
2160
2161 limCopyLoad(pBuf, pAssocInd->load);
2162 pBuf += sizeof(tSirLoad);
2163 mLen += sizeof(tSirLoad);
2164
2165 limCopyU32(pBuf, pAssocInd->numBss);
2166 pBuf += sizeof(tANI_U32);
2167 mLen += sizeof(tANI_U32);
2168
2169 if (pAssocInd->numBss)
2170 {
2171 len = limCopyNeighborList(pMac,
2172 pBuf,
2173 pAssocInd->neighborList, pAssocInd->numBss);
2174 pBuf += len;
2175 mLen += (tANI_U16) len;
2176 }
2177
2178 // place holder to capability and nwType
2179
2180 limCopyU16(pBuf, *(tANI_U16 *)&pAssocInd->capabilityInfo);
2181 pBuf += sizeof(tANI_U16); // capabilityInfo
2182 mLen += sizeof(tANI_U16);
2183
2184 limCopyU32(pBuf, *(tANI_U32 *)&pAssocInd->nwType);
2185 pBuf += sizeof(tANI_U32); // nwType
2186 mLen += sizeof(tANI_U32);
2187
2188#endif
2189
Jeff Johnson295189b2012-06-20 16:38:30 -07002190 limCopyU32(pBuf, pAssocInd->spectrumMgtIndicator);
2191 pBuf += sizeof(tAniBool);
2192 mLen += sizeof(tAniBool);
2193
2194 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
2195 {
2196 *pBuf = pAssocInd->powerCap.minTxPower;
2197 pBuf++;
2198 *pBuf = pAssocInd->powerCap.maxTxPower;
2199 pBuf++;
2200 mLen += sizeof(tSirMacPowerCapInfo);
2201
2202 *pBuf = pAssocInd->supportedChannels.numChnl;
2203 pBuf++;
2204 mLen++;
2205
2206 palCopyMemory( pMac->hHdd, pBuf,
2207 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
2208 pAssocInd->supportedChannels.numChnl);
2209
2210
2211 pBuf += pAssocInd->supportedChannels.numChnl;
2212 mLen += pAssocInd->supportedChannels.numChnl;
2213 }
2214#ifdef WLAN_SOFTAP_FEATURE
2215 limCopyU32(pBuf, pAssocInd->WmmStaInfoPresent);
2216 pBuf += sizeof(tANI_U32);
2217 mLen += sizeof(tANI_U32);
2218#endif
2219 // Fill in length of SME_ASSOC_IND message
2220 limCopyU16(pLen, mLen);
2221
2222 PELOG1(limLog(pMac, LOG1, FL("Sending SME_ASSOC_IND length %d bytes:\n"), mLen);)
2223 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
2224} /*** end limAssocIndSerDes() ***/
2225
2226
2227
2228/**
2229 * limAssocCnfSerDes()
2230 *
2231 *FUNCTION:
2232 * This function is called by limProcessLmmMessages() when
2233 * SME_ASSOC_CNF or SME_REASSOC_CNF message is received from
2234 * upper layer software.
2235 *
2236 *PARAMS:
2237 *
2238 *LOGIC:
2239 *
2240 *ASSUMPTIONS:
2241 * NA
2242 *
2243 *NOTE:
2244 * NA
2245 *
2246 * @param pAssocCnf Pointer to tSirSmeAssocCnf being extracted into
2247 * @param pBuf Pointer to serialized buffer
2248 * @return retCode Indicates whether message is successfully
2249 * de-serialized (eSIR_SUCCESS) or
2250 * not (eSIR_FAILURE)
2251 */
2252
2253tSirRetStatus
2254limAssocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeAssocCnf pAssocCnf, tANI_U8 *pBuf)
2255{
2256#ifdef PE_DEBUG_LOG1
2257 tANI_U8 *pTemp = pBuf;
2258#endif
2259
2260 if (!pAssocCnf || !pBuf)
2261 return eSIR_FAILURE;
2262
2263 pAssocCnf->messageType = limGetU16(pBuf);
2264 pBuf += sizeof(tANI_U16);
2265
2266 pAssocCnf->length = limGetU16(pBuf);
2267 pBuf += sizeof(tANI_U16);
2268
2269 if (pAssocCnf->messageType == eWNI_SME_ASSOC_CNF)
2270 {
2271 PELOG1(limLog(pMac, LOG1, FL("SME_ASSOC_CNF length %d bytes is:\n"), pAssocCnf->length);)
2272 }
2273 else
2274 {
2275 PELOG1(limLog(pMac, LOG1, FL("SME_REASSOC_CNF length %d bytes is:\n"), pAssocCnf->length);)
2276 }
2277 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pAssocCnf->length);)
2278
2279 // status code
2280 pAssocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
2281 pBuf += sizeof(tSirResultCodes);
2282
2283 // bssId
2284 palCopyMemory( pMac->hHdd, pAssocCnf->bssId, pBuf, sizeof(tSirMacAddr));
2285 pBuf += sizeof(tSirMacAddr);
2286
2287 // peerMacAddr
2288 palCopyMemory( pMac->hHdd, pAssocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
2289 pBuf += sizeof(tSirMacAddr);
2290
2291
2292 pAssocCnf->aid = limGetU16(pBuf);
2293 pBuf += sizeof(tANI_U16);
2294 // alternateBssId
2295 palCopyMemory( pMac->hHdd, pAssocCnf->alternateBssId, pBuf, sizeof(tSirMacAddr));
2296 pBuf += sizeof(tSirMacAddr);
2297
2298 // alternateChannelId
2299 pAssocCnf->alternateChannelId = *pBuf;
2300 pBuf++;
2301
2302 return eSIR_SUCCESS;
2303} /*** end limAssocCnfSerDes() ***/
2304
2305
2306
2307/**
2308 * limDisassocCnfSerDes()
2309 *
2310 *FUNCTION:
2311 * This function is called by limProcessSmeMessages() when
2312 * SME_DISASSOC_CNF message is received from upper layer software.
2313 *
2314 *PARAMS:
2315 *
2316 *LOGIC:
2317 *
2318 *ASSUMPTIONS:
2319 * NA
2320 *
2321 *NOTE:
2322 * NA
2323 *
2324 * @param pDisassocCnf Pointer to tSirSmeDisassocCnf being
2325 * extracted into
2326 * @param pBuf Pointer to serialized buffer
2327 * @return retCode Indicates whether message is successfully
2328 * de-serialized (eSIR_SUCCESS) or
2329 * not (eSIR_FAILURE)
2330 */
2331
2332tSirRetStatus
2333limDisassocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeDisassocCnf pDisassocCnf, tANI_U8 *pBuf)
2334{
2335#ifdef PE_DEBUG_LOG1
2336 tANI_U8 *pTemp = pBuf;
2337#endif
2338
2339 if (!pDisassocCnf || !pBuf)
2340 return eSIR_FAILURE;
2341
2342 pDisassocCnf->messageType = limGetU16(pBuf);
2343 pBuf += sizeof(tANI_U16);
2344
2345 pDisassocCnf->length = limGetU16(pBuf);
2346 pBuf += sizeof(tANI_U16);
2347
2348 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_CNF length %d bytes is:\n"), pDisassocCnf->length);)
2349 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pDisassocCnf->length);)
2350
2351 pDisassocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
2352 pBuf += sizeof(tSirResultCodes);
2353
2354 palCopyMemory( pMac->hHdd, pDisassocCnf->bssId, pBuf, sizeof(tSirMacAddr));
2355 pBuf += sizeof(tSirMacAddr);
2356
2357 palCopyMemory( pMac->hHdd, pDisassocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
2358
2359#if defined(ANI_PRODUCT_TYPE_AP)
2360 pBuf += sizeof(tSirMacAddr);
2361 pDisassocCnf->aid = limGetU16(pBuf);
2362#endif
2363
2364 return eSIR_SUCCESS;
2365} /*** end limDisassocCnfSerDes() ***/
2366
2367
2368
2369#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
2370/**
2371 * limMeasurementReqSerDes()
2372 *
2373 *FUNCTION:
2374 * This function is called by limProcessLmmMessages() when
2375 * SME_MEASUREMENT_REQ message is received from upper layer software.
2376 *
2377 *PARAMS:
2378 *
2379 *LOGIC:
2380 *
2381 *ASSUMPTIONS:
2382 * NA
2383 *
2384 *NOTE:
2385 * NA
2386 *
2387 * @param pMeasReq Pointer to tSirSmeMeasurement being
2388 * extracted into
2389 * @param pBuf Pointer to serialized buffer
2390 * @return retCode Indicates whether message is successfully
2391 * de-serialized (eSIR_SUCCESS) or
2392 * not (eSIR_FAILURE)
2393 */
2394
2395tSirRetStatus
2396limMeasurementReqSerDes(tpAniSirGlobal pMac, tpSirSmeMeasurementReq pMeasReq, tANI_U8 *pBuf)
2397{
2398 tANI_S16 len = 0;
2399 PELOG3(tANI_U8 *pTemp = pBuf;)
2400
2401 if (!pMeasReq || !pBuf)
2402 return eSIR_FAILURE;
2403
2404 pMeasReq->messageType = limGetU16(pBuf);
2405 pBuf += sizeof(tANI_U16);
2406
2407 len = pMeasReq->length = limGetU16(pBuf);
2408 pBuf += sizeof(tANI_U16);
2409
2410 PELOG3(limLog(pMac, LOG3, FL("SME_MEASUREMENT_REQ length %d bytes is:\n"), len);
2411 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
2412
2413 if (len < (tANI_S16) sizeof(tANI_U32))
2414 return eSIR_FAILURE;
2415
2416 len -= sizeof(tANI_U32); // skip message header
2417 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2418 return eSIR_FAILURE;
2419
2420 pMeasReq->measControl.periodicMeasEnabled = (tAniBool)
2421 limGetU32(pBuf);
2422
2423 pBuf += sizeof(tAniBool);
2424 len -= sizeof(tAniBool);
2425 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2426 return eSIR_FAILURE;
2427
2428 pMeasReq->measControl.involveSTAs = (tAniBool)
2429 limGetU32(pBuf);
2430 pBuf += sizeof(tAniBool);
2431 len -= sizeof(tAniBool);
2432 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2433 return eSIR_FAILURE;
2434
2435 pMeasReq->measControl.metricsType = *pBuf++;
2436 len--;
2437 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2438 return eSIR_FAILURE;
2439
2440 pMeasReq->measControl.scanType = (tSirScanType)
2441 limGetU32(pBuf);
2442 pBuf += sizeof(tSirScanType);
2443 len -= sizeof(tSirScanType);
2444 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2445 return eSIR_FAILURE;
2446
2447 pMeasReq->measControl.longChannelScanPeriodicity = *pBuf++;
2448 len--;
2449 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2450 return eSIR_FAILURE;
2451
2452 pMeasReq->measControl.cb11hEnabled = (tAniBool)limGetU32(pBuf);
2453 pBuf += sizeof(tAniBool);
2454 len -= sizeof(tAniBool);
2455
2456 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2457 return eSIR_FAILURE;
2458
2459 pMeasReq->measDuration.shortTermPeriod = limGetU32(pBuf);
2460 pBuf += sizeof(tANI_U32);
2461
2462 pMeasReq->measDuration.averagingPeriod = limGetU32(pBuf);
2463 pBuf += sizeof(tANI_U32);
2464
2465 pMeasReq->measDuration.shortChannelScanDuration = limGetU32(pBuf);
2466 pBuf += sizeof(tANI_U32);
2467
2468 pMeasReq->measDuration.longChannelScanDuration = limGetU32(pBuf);
2469 pBuf += sizeof(tANI_U32);
2470
2471 len -= sizeof(tSirMeasDuration);
2472 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2473 return eSIR_FAILURE;
2474
2475 pMeasReq->measIndPeriod = limGetU32(pBuf);
2476
2477 pBuf += sizeof(tANI_U32);
2478 len -= sizeof(tANI_U32);
2479 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2480 return eSIR_FAILURE;
2481
2482 pMeasReq->channelList.numChannels = *pBuf++;
2483 palCopyMemory( pMac->hHdd, (tANI_U8 *) pMeasReq->channelList.channelNumber,
2484 pBuf, pMeasReq->channelList.numChannels);
2485
2486 return eSIR_SUCCESS;
2487} /*** end limMeasurementReqSerDes() ***/
2488
2489
2490/**
2491 * limWdsReqSerDes()
2492 *
2493 *FUNCTION:
2494 * This function is called by limProcessLmmMessages() when
2495 * SME_SET_WDS_INFO_REQ message is received from upper layer software.
2496 *
2497 *PARAMS:
2498 *
2499 *LOGIC:
2500 *
2501 *ASSUMPTIONS:
2502 * NA
2503 *
2504 *NOTE:
2505 * NA
2506 *
2507 * @param pWdsInfo Pointer to tSirWdsInfo being extracted into
2508 * @param pBuf Pointer to serialized buffer
2509 * @return retCode Indicates whether message is successfully
2510 * de-serialized (eSIR_SUCCESS) or
2511 * not (eSIR_FAILURE)
2512 */
2513
2514tSirRetStatus
2515limWdsReqSerDes(tpAniSirGlobal pMac, tpSirSmeSetWdsInfoReq pWdsInfoReq, tANI_U8 *pBuf)
2516{
2517 tANI_S16 len = 0;
2518 PELOG1(tANI_U8 *pTemp = pBuf;)
2519
2520 if (!pWdsInfoReq || !pBuf)
2521 return eSIR_FAILURE;
2522
2523 // Extract messageType
2524 pWdsInfoReq->messageType = limGetU16(pBuf);
2525 pBuf += sizeof(tANI_U16);
2526
2527 // Extract length
2528 len = pWdsInfoReq->length = limGetU16(pBuf);
2529 pBuf += sizeof(tANI_U16);
2530
2531 PELOG1(limLog(pMac, LOG1, FL("SME_SET_WDS_INFO_REQ length %d bytes is:\n"), len);)
2532 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2533
2534 if (len < (tANI_S16) sizeof(tANI_U32))
2535 return eSIR_FAILURE;
2536
2537 len -= sizeof(tANI_U32); // skip message header
2538
2539 // Extract transactionId
2540 pWdsInfoReq->transactionId = limGetU16(pBuf);
2541 pBuf += sizeof(tANI_U16);
2542 len -= sizeof(tANI_U16);
2543
2544 // Extract wdsInfo
2545 pWdsInfoReq->wdsInfo.wdsLength = limGetU16(pBuf);
2546 len -= sizeof(tANI_U16);
2547 pBuf += sizeof(tANI_U16);
2548
2549 if (pWdsInfoReq->wdsInfo.wdsLength > ANI_WDS_INFO_MAX_LENGTH)
2550 return eSIR_FAILURE;
2551
2552 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2553 return eSIR_FAILURE;
2554
2555 palCopyMemory( pMac->hHdd, (tANI_U8 *) pWdsInfoReq->wdsInfo.wdsBytes,
2556 pBuf,
2557 pWdsInfoReq->wdsInfo.wdsLength);
2558
2559 return eSIR_SUCCESS;
2560
2561} /*** end limWdsReqSerDes() ***/
2562
2563
2564/**
2565 * limMeasurementIndSerDes()
2566 *
2567 *FUNCTION:
2568 * This function is called by limSendMeasurementInd() while
2569 * sending SME_MEASUREMENT_IND message to WSM.
2570 *
2571 *LOGIC:
2572 *
2573 *ASSUMPTIONS:
2574 *
2575 *NOTE:
2576 *
2577 * @param pMac - Pointer to Global MAC structure
2578 * @param pMeasInd - Pointer to prepared MEASUREMENT_IND message
2579 * @return None
2580 */
2581
2582void
2583limMeasurementIndSerDes(tpAniSirGlobal pMac, tANI_U8 *pBuf)
2584{
2585 tANI_U8 *pLen;
2586 tANI_U16 len = 0, infoLen = 0;
2587 tSirLoad load;
2588 PELOG3(tANI_U8 *pTemp = pBuf;)
2589
2590 limCopyU16(pBuf, eWNI_SME_MEASUREMENT_IND);
2591 pBuf += sizeof(tANI_U16);
2592
2593 pLen = pBuf;
2594 pBuf += sizeof(tANI_U16);
2595
2596 limCopyU32(pBuf, pMac->lim.gpLimMeasData->duration);
2597 pBuf += sizeof(tANI_U32);
2598 len += sizeof(tANI_U32);
2599
2600 load.numStas = pMac->lim.gLimNumOfCurrentSTAs;
2601 load.channelUtilization =
2602 pMac->lim.gpLimMeasData->avgChannelUtilization;
2603 limCopyLoad(pBuf, load);
2604 pBuf += sizeof(tSirLoad);
2605 len += sizeof(tSirLoad);
2606
2607 infoLen = limCopyMeasMatrixList(pMac, pBuf);
2608 pBuf += infoLen;
2609 len += infoLen;
2610
2611 infoLen = limCopyNeighborWdsList(pMac, pBuf);
2612 pBuf += infoLen;
2613 len += infoLen;
2614
2615 limCopyU16(pLen, len+4);
2616
2617 PELOG3(limLog(pMac, LOG3, FL("Sending MEAS_IND length %d bytes:\n"), len);
2618 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
2619} /*** end limMeasurementIndSerDes() ***/
2620#endif
2621
2622
2623/**---------------------------------------------------------------
2624\fn limReassocIndSerDes
2625\brief This function is called by limProcessMlmReassocInd() to
2626\ populate the SME_REASSOC_IND message based on the received
2627\ MLM_REASSOC_IND.
2628\
2629\param pMac
2630\param pReassocInd - Pointer to the received tLimMlmReassocInd
2631\param pBuf - Pointer to serialized buffer
2632\param psessionEntry - pointer to PE session entry
2633\
2634\return None
2635------------------------------------------------------------------*/
2636void
2637limReassocIndSerDes(tpAniSirGlobal pMac, tpLimMlmReassocInd pReassocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
2638{
2639 tANI_U8 *pLen = pBuf;
2640 tANI_U16 mLen = 0;
2641
2642#ifdef PE_DEBUG_LOG1
2643 tANI_U8 *pTemp = pBuf;
2644#endif
2645
2646#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
2647 tANI_U32 len = 0;
2648#endif
2649
2650 mLen = sizeof(tANI_U32);
2651 pBuf += sizeof(tANI_U16);
2652 *pBuf++ = psessionEntry->smeSessionId;
2653 mLen += sizeof(tANI_U8);
2654
2655 // Fill in peerMacAddr
2656 palCopyMemory( pMac->hHdd, pBuf, pReassocInd->peerMacAddr, sizeof(tSirMacAddr));
2657 pBuf += sizeof(tSirMacAddr);
2658 mLen += sizeof(tSirMacAddr);
2659
2660 // Fill in oldMacAddr
2661 palCopyMemory( pMac->hHdd, pBuf, pReassocInd->currentApAddr, sizeof(tSirMacAddr));
2662 pBuf += sizeof(tSirMacAddr);
2663 mLen += sizeof(tSirMacAddr);
2664
2665 // Fill in aid
2666 limCopyU16(pBuf, pReassocInd->aid);
2667 pBuf += sizeof(tANI_U16);
2668 mLen += sizeof(tANI_U16);
2669
2670 // Fill in bssId
2671 palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
2672 pBuf += sizeof(tSirMacAddr);
2673 mLen += sizeof(tSirMacAddr);
2674
2675 // Fill in staId
2676 limCopyU16(pBuf, psessionEntry->staId);
2677 pBuf += sizeof(tANI_U16);
2678 mLen += sizeof(tANI_U16);
2679
2680 // Fill in authType
2681 limCopyU32(pBuf, pReassocInd->authType);
2682 pBuf += sizeof(tAniAuthType);
2683 mLen += sizeof(tAniAuthType);
2684
2685 // Fill in ssId
2686 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pReassocInd->ssId),
2687 pReassocInd->ssId.length + 1);
2688 pBuf += 1 + pReassocInd->ssId.length;
2689 mLen += pReassocInd->ssId.length + 1;
2690
2691 // Fill in rsnIE
2692 limCopyU16(pBuf, pReassocInd->rsnIE.length);
2693 pBuf += sizeof(tANI_U16);
2694 mLen += sizeof(tANI_U16);
2695 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pReassocInd->rsnIE.rsnIEdata),
2696 pReassocInd->rsnIE.length);
2697 pBuf += pReassocInd->rsnIE.length;
2698 mLen += pReassocInd->rsnIE.length;
2699
2700 // Fill in addIE
2701 limCopyU16(pBuf, pReassocInd->addIE.length);
2702 pBuf += sizeof(tANI_U16);
2703 mLen += sizeof(tANI_U16);
2704 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8*) &(pReassocInd->addIE.addIEdata),
2705 pReassocInd->addIE.length);
2706 pBuf += pReassocInd->addIE.length;
2707 mLen += pReassocInd->addIE.length;
2708
2709#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
2710
2711 limCopyU16(pBuf, pReassocInd->seqNum);
2712 pBuf += sizeof(tANI_U16);
2713 mLen += sizeof(tANI_U16);
2714
2715 limCopyU32(pBuf, pReassocInd->wniIndicator);
2716 pBuf += sizeof(tAniBool);
2717 mLen += sizeof(tAniBool);
2718
2719 limCopyU32(pBuf, pReassocInd->bpIndicator);
2720 pBuf += sizeof(tAniBool);
2721 mLen += sizeof(tAniBool);
2722
2723 limCopyU32(pBuf, pReassocInd->bpType);
2724 pBuf += sizeof(tSirBpIndicatorType);
2725 mLen += sizeof(tSirBpIndicatorType);
2726
2727 limCopyU32(pBuf, pReassocInd->reassocType);
2728 pBuf += sizeof(tSirAssocType);
2729 mLen += sizeof(tSirAssocType);
2730
2731 limCopyLoad(pBuf, pReassocInd->load);
2732 pBuf += sizeof(tSirLoad);
2733 mLen += sizeof(tSirLoad);
2734
2735 limCopyU32(pBuf, pReassocInd->numBss);
2736 pBuf += sizeof(tANI_U32);
2737 mLen += sizeof(tANI_U32);
2738
2739 if (pReassocInd->numBss)
2740 {
2741 len = limCopyNeighborList(pMac,
2742 pBuf,
2743 pReassocInd->neighborList, pReassocInd->numBss);
2744 pBuf += len;
2745 mLen += (tANI_U16) len;
2746 }
2747
2748 // place holder to capability and nwType
2749 limCopyU16(pBuf, *(tANI_U16 *)&pReassocInd->capabilityInfo);
2750 pBuf += sizeof(tANI_U16); // capabilityInfo
2751 mLen += sizeof(tANI_U16);
2752
2753 limCopyU32(pBuf, *(tANI_U32 *)&pReassocInd->nwType);
2754 pBuf += sizeof(tANI_U32); // nwType
2755 mLen += sizeof(tANI_U32);
2756#endif
2757
Jeff Johnson295189b2012-06-20 16:38:30 -07002758 limCopyU32(pBuf, pReassocInd->spectrumMgtIndicator);
2759 pBuf += sizeof(tAniBool);
2760 mLen += sizeof(tAniBool);
2761
2762 if (pReassocInd->spectrumMgtIndicator == eSIR_TRUE)
2763 {
2764 *pBuf = pReassocInd->powerCap.minTxPower;
2765 pBuf++;
2766 *pBuf = pReassocInd->powerCap.maxTxPower;
2767 pBuf++;
2768 mLen += sizeof(tSirMacPowerCapInfo);
2769
2770 *pBuf = pReassocInd->supportedChannels.numChnl;
2771 pBuf++;
2772 mLen++;
2773
2774 palCopyMemory( pMac->hHdd, pBuf,
2775 (tANI_U8 *) &(pReassocInd->supportedChannels.channelList),
2776 pReassocInd->supportedChannels.numChnl);
2777
2778 pBuf += pReassocInd->supportedChannels.numChnl;
2779 mLen += pReassocInd->supportedChannels.numChnl;
2780 }
2781#ifdef WLAN_SOFTAP_FEATURE
2782 limCopyU32(pBuf, pReassocInd->WmmStaInfoPresent);
2783 pBuf += sizeof(tANI_U32);
2784 mLen += sizeof(tANI_U32);
2785#endif
2786
2787 // Fill in length of SME_REASSOC_IND message
2788 limCopyU16(pLen, mLen);
2789
2790 PELOG1(limLog(pMac, LOG1, FL("Sending SME_REASSOC_IND length %d bytes:\n"), mLen);)
2791 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
2792} /*** end limReassocIndSerDes() ***/
2793
2794
2795/**
2796 * limAuthIndSerDes()
2797 *
2798 *FUNCTION:
2799 * This function is called by limProcessMlmAuthInd() while sending
2800 * SME_AUTH_IND to host
2801 *
2802 *PARAMS:
2803 *
2804 *LOGIC:
2805 *
2806 *ASSUMPTIONS:
2807 * NA
2808 *
2809 *NOTE:
2810 * NA
2811 *
2812 * @param pAuthInd Pointer to tSirSmeAuthInd being sent
2813 * @param pBuf Pointer to serialized buffer
2814 *
2815 * @return None
2816 */
2817
2818void
2819limAuthIndSerDes(tpAniSirGlobal pMac, tpLimMlmAuthInd pAuthInd, tANI_U8 *pBuf)
2820{
2821 tANI_U8 *pLen = pBuf;
2822 tANI_U16 mLen = 0;
2823
2824#ifdef PE_DEBUG_LOG1
2825 tANI_U8 *pTemp = pBuf;
2826#endif
2827
2828 mLen = sizeof(tANI_U32);
2829 pBuf += sizeof(tANI_U16);
2830 *pBuf++ = pAuthInd->sessionId;
2831 mLen += sizeof(tANI_U8);
2832
2833 // BTAMP TODO: Fill in bssId
2834 palZeroMemory(pMac->hHdd, pBuf, sizeof(tSirMacAddr));
2835 pBuf += sizeof(tSirMacAddr);
2836 mLen += sizeof(tSirMacAddr);
2837
2838 palCopyMemory( pMac->hHdd, pBuf, pAuthInd->peerMacAddr, sizeof(tSirMacAddr));
2839 pBuf += sizeof(tSirMacAddr);
2840 mLen += sizeof(tSirMacAddr);
2841
2842 limCopyU32(pBuf, pAuthInd->authType);
2843 pBuf += sizeof(tAniAuthType);
2844 mLen += sizeof(tAniAuthType);
2845
2846 limCopyU16(pLen, mLen);
2847
2848 PELOG1(limLog(pMac, LOG1, FL("Sending SME_AUTH_IND length %d bytes:\n"), mLen);)
2849 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
2850} /*** end limAuthIndSerDes() ***/
2851
2852
2853
2854/**
2855 * limSetContextReqSerDes()
2856 *
2857 *FUNCTION:
2858 * This function is called by limProcessSmeMessages() upon receiving
2859 * SME_SETCONTEXT_REQ from host
2860 *
2861 *PARAMS:
2862 *
2863 *LOGIC:
2864 *
2865 *ASSUMPTIONS:
2866 * NA
2867 *
2868 *NOTE:
2869 * NA
2870 *
2871 * @param pSetContextReq Pointer to tSirSmeSetContextReq being
2872 * extracted
2873 * @param pBuf Pointer to serialized buffer
2874 *
2875 * @return retCode Indicates whether message is successfully
2876 * de-serialized (eSIR_SUCCESS) or
2877 * not (eSIR_FAILURE)
2878 */
2879
2880tSirRetStatus
2881limSetContextReqSerDes(tpAniSirGlobal pMac, tpSirSmeSetContextReq pSetContextReq, tANI_U8 *pBuf)
2882{
2883 tANI_S16 len = 0;
2884 tANI_U16 totalKeySize = sizeof(tANI_U8); // initialized to sizeof numKeys
2885 tANI_U8 numKeys;
2886 tANI_U8 *pKeys;
2887
2888#ifdef PE_DEBUG_LOG1
2889 tANI_U8 *pTemp = pBuf;
2890#endif
2891 if (!pSetContextReq || !pBuf)
2892 return eSIR_FAILURE;
2893
2894 pSetContextReq->messageType = limGetU16(pBuf);
2895 pBuf += sizeof(tANI_U16);
2896
2897 len = pSetContextReq->length = limGetU16(pBuf);
2898 pBuf += sizeof(tANI_U16);
2899
2900 PELOG1(limLog(pMac, LOG1, FL("SME_SETCONTEXT_REQ length %d bytes is:\n"), len);)
2901 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
2902
2903 if (len < (tANI_S16) sizeof(tANI_U32))
2904 return eSIR_FAILURE;
2905
2906 len -= sizeof(tANI_U32); // skip message header
2907 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2908 return eSIR_FAILURE;
2909
2910 // Extract sessionId
2911 pSetContextReq->sessionId = *pBuf++;
2912 len--;
2913 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2914 return eSIR_FAILURE;
2915
2916 // Extract transactionId
2917 pSetContextReq->transactionId = sirReadU16N(pBuf);
2918 pBuf += sizeof(tANI_U16);
2919 len -= sizeof(tANI_U16);
2920 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2921 return eSIR_FAILURE;
2922 palCopyMemory( pMac->hHdd, (tANI_U8 *) pSetContextReq->peerMacAddr,
2923 pBuf, sizeof(tSirMacAddr));
2924 pBuf += sizeof(tSirMacAddr);
2925 len -= sizeof(tSirMacAddr);
2926 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2927 return eSIR_FAILURE;
2928 palCopyMemory( pMac->hHdd, pSetContextReq->bssId, pBuf, sizeof(tSirMacAddr));
2929 pBuf += sizeof(tSirMacAddr);
2930 len -= sizeof(tSirMacAddr);
2931 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2932 return eSIR_FAILURE;
2933
2934#if defined(ANI_PRODUCT_TYPE_AP)
2935 pSetContextReq->aid = limGetU16(pBuf);
2936 pBuf += sizeof(tANI_U16);
2937 len -= sizeof(tANI_U16);
2938 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2939 return eSIR_FAILURE;
2940#endif
2941
2942// pSetContextReq->qosInfoPresent = limGetU32(pBuf);
2943// pBuf += sizeof(tAniBool);
2944
2945// if (pSetContextReq->qosInfoPresent)
2946// {
2947// len = limGetQosInfo(&pSetContextReq->qos, pBuf);
2948// pBuf += len;
2949// }
2950
2951 pSetContextReq->keyMaterial.length = limGetU16(pBuf);
2952 pBuf += sizeof(tANI_U16);
2953 len -= sizeof(tANI_U16);
2954 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2955 return eSIR_FAILURE;
2956
2957 pSetContextReq->keyMaterial.edType = (tAniEdType) limGetU32(pBuf);
2958 pBuf += sizeof(tAniEdType);
2959 len -= sizeof(tAniEdType);
2960 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2961 return eSIR_FAILURE;
2962
2963 numKeys = pSetContextReq->keyMaterial.numKeys = *pBuf++;
2964 len -= sizeof(numKeys);
2965
2966 if (numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
2967 return eSIR_FAILURE;
2968
2969 /** Initialize the Default Keys if no Keys are being sent from the upper layer*/
2970 if( limCheckRemainingLength(pMac, len) == eSIR_FAILURE) {
2971 tpSirKeys pKeyinfo = pSetContextReq->keyMaterial.key;
2972
2973 pKeyinfo->keyId = 0;
2974 pKeyinfo->keyDirection = eSIR_TX_RX;
2975 pKeyinfo->keyLength = 0;
2976
2977 if (!limIsAddrBC(pSetContextReq->peerMacAddr))
2978 pKeyinfo->unicast = 1;
2979 else
2980 pKeyinfo->unicast = 0;
2981 }else {
2982 pKeys = (tANI_U8 *) pSetContextReq->keyMaterial.key;
2983 do {
2984 tANI_U32 keySize = limGetKeysInfo(pMac, (tpSirKeys) pKeys,
2985 pBuf);
2986 pBuf += keySize;
2987 pKeys += sizeof(tSirKeys);
2988 totalKeySize += (tANI_U16) keySize;
2989 if (numKeys == 0)
2990 break;
2991 numKeys--;
2992 }while (numKeys);
2993 }
2994 return eSIR_SUCCESS;
2995} /*** end limSetContextReqSerDes() ***/
2996
2997/**
2998 * limRemoveKeyReqSerDes()
2999 *
3000 *FUNCTION:
3001 * This function is called by limProcessSmeMessages() upon receiving
3002 * SME_REMOVEKEY_REQ from host
3003 *
3004 *PARAMS:
3005 *
3006 *LOGIC:
3007 *
3008 *ASSUMPTIONS:
3009 * NA
3010 *
3011 *NOTE:
3012 * NA
3013 *
3014 * @param pRemoveKeyReq Pointer to tSirSmeRemoveKeyReq being
3015 * extracted
3016 * @param pBuf Pointer to serialized buffer
3017 *
3018 * @return retCode Indicates whether message is successfully
3019 * de-serialized (eSIR_SUCCESS) or
3020 * not (eSIR_FAILURE)
3021 */
3022
3023tSirRetStatus
3024limRemoveKeyReqSerDes(tpAniSirGlobal pMac, tpSirSmeRemoveKeyReq pRemoveKeyReq, tANI_U8 *pBuf)
3025{
3026 tANI_S16 len = 0;
3027
3028#ifdef PE_DEBUG_LOG1
3029 tANI_U8 *pTemp = pBuf;
3030#endif
3031 if (!pRemoveKeyReq || !pBuf)
3032 return eSIR_FAILURE;
3033
3034 pRemoveKeyReq->messageType = limGetU16(pBuf);
3035 pBuf += sizeof(tANI_U16);
3036
3037 len = pRemoveKeyReq->length = limGetU16(pBuf);
3038 pBuf += sizeof(tANI_U16);
3039
3040 PELOG1(limLog(pMac, LOG1, FL("SME_REMOVEKEY_REQ length %d bytes is:\n"), len);)
3041 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
3042
3043 if (len < (tANI_S16) sizeof(tANI_U32))
3044 return eSIR_FAILURE;
3045
3046 len -= sizeof(tANI_U32); // skip message header
3047 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3048 return eSIR_FAILURE;
3049
3050 palCopyMemory( pMac->hHdd, (tANI_U8 *) pRemoveKeyReq->peerMacAddr,
3051 pBuf, sizeof(tSirMacAddr));
3052 pBuf += sizeof(tSirMacAddr);
3053 len -= sizeof(tSirMacAddr);
3054 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3055 return eSIR_FAILURE;
3056
3057#if defined(ANI_PRODUCT_TYPE_AP)
3058 pRemoveKeyReq->aid = limGetU16(pBuf);
3059 pBuf += sizeof(tANI_U16);
3060 len -= sizeof(tANI_U16);
3061 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3062 return eSIR_FAILURE;
3063#endif
3064
3065 pRemoveKeyReq->edType = *pBuf;
3066 pBuf += sizeof(tANI_U8);
3067 len -= sizeof(tANI_U8);
3068 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3069 return eSIR_FAILURE;
3070
3071 pRemoveKeyReq->wepType = *pBuf;
3072
3073 pBuf += sizeof(tANI_U8);
3074 len -= sizeof(tANI_U8);
3075 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3076 return eSIR_FAILURE;
3077
3078 pRemoveKeyReq->keyId = *pBuf;
3079
3080 pBuf += sizeof(tANI_U8);
3081 len -= sizeof(tANI_U8);
3082 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3083 return eSIR_FAILURE;
3084
3085 pRemoveKeyReq->unicast = *pBuf;
3086 len--;
3087 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3088 return eSIR_FAILURE;
3089
3090 // Extract bssId
3091 palCopyMemory( pMac->hHdd, pRemoveKeyReq->bssId, pBuf, sizeof(tSirMacAddr));
3092 pBuf += sizeof(tSirMacAddr);
3093 len -= sizeof(tSirMacAddr);
3094 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3095 return eSIR_FAILURE;
3096
3097 // Extract sessionId
3098 pRemoveKeyReq->sessionId = *pBuf++;
3099 len--;
3100 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3101 return eSIR_FAILURE;
3102
3103 // Extract transactionId
3104 pRemoveKeyReq->transactionId = sirReadU16N(pBuf);
3105 pBuf += sizeof(tANI_U16);
3106 len -= sizeof(tANI_U16);
3107 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3108 return eSIR_FAILURE;
3109
3110 return eSIR_SUCCESS;
3111} /*** end limRemoveKeyReqSerDes() ***/
3112
3113
3114
3115/**
3116 * limDisassocReqSerDes()
3117 *
3118 *FUNCTION:
3119 * This function is called by limProcessSmeMessages() upon receiving
3120 * SME_DISASSOC_REQ from host
3121 *
3122 *PARAMS:
3123 *
3124 *LOGIC:
3125 *
3126 *ASSUMPTIONS:
3127 * NA
3128 *
3129 *NOTE:
3130 * NA
3131 *
3132 * @param pDisassocReq Pointer to tSirSmeDisassocReq being extracted
3133 * @param pBuf Pointer to serialized buffer
3134 *
3135 * @return retCode Indicates whether message is successfully
3136 * de-serialized (eSIR_SUCCESS) or
3137 * not (eSIR_FAILURE)
3138 */
3139
3140tSirRetStatus
3141limDisassocReqSerDes(tpAniSirGlobal pMac, tSirSmeDisassocReq *pDisassocReq, tANI_U8 *pBuf)
3142{
3143 tANI_S16 len = 0;
3144#ifdef PE_DEBUG_LOG1
3145 tANI_U8 *pTemp = pBuf;
3146#endif
3147
3148 if (!pDisassocReq || !pBuf)
3149 return eSIR_FAILURE;
3150
3151 pDisassocReq->messageType = limGetU16(pBuf);
3152 pBuf += sizeof(tANI_U16);
3153
3154 len = pDisassocReq->length = limGetU16(pBuf);
3155 pBuf += sizeof(tANI_U16);
3156
3157 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_REQ length %d bytes is:\n"), len);)
3158 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
3159
3160 if (len < (tANI_S16) sizeof(tANI_U32))
3161 return eSIR_FAILURE;
3162
3163 len -= sizeof(tANI_U32); // skip message header
3164 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3165 return eSIR_FAILURE;
3166
3167 // Extract sessionID
3168 pDisassocReq->sessionId = *pBuf;
3169 pBuf += sizeof(tANI_U8);
3170 len -= sizeof(tANI_U8);
3171 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3172 return eSIR_FAILURE;
3173
3174 // Extract transactionid
3175 pDisassocReq->transactionId = limGetU16(pBuf);
3176 pBuf += sizeof(tANI_U16);
3177 len -= sizeof(tANI_U16);
3178 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3179 return eSIR_FAILURE;
3180
3181 // Extract bssId
3182 palCopyMemory( pMac->hHdd, (tANI_U8 *) pDisassocReq->bssId, pBuf, sizeof(tSirMacAddr));
3183 pBuf += sizeof(tSirMacAddr);
3184 len -= sizeof(tSirMacAddr);
3185 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3186 return eSIR_FAILURE;
3187
3188 // Extract peerMacAddr
3189 palCopyMemory( pMac->hHdd, pDisassocReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
3190 pBuf += sizeof(tSirMacAddr);
3191 len -= sizeof(tSirMacAddr);
3192 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3193 return eSIR_FAILURE;
3194
3195 // Extract reasonCode
3196 pDisassocReq->reasonCode = limGetU16(pBuf);
3197 pBuf += sizeof(tANI_U16);
3198 len -= sizeof(tANI_U16);
3199 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3200 return eSIR_FAILURE;
3201
3202 pDisassocReq->doNotSendOverTheAir = *pBuf;
3203 pBuf += sizeof(tANI_U8);
3204 len -= sizeof(tANI_U8);
3205
3206#if defined(ANI_PRODUCT_TYPE_AP)
3207 pDisassocReq->aid = limGetU16(pBuf);
3208 pBuf += sizeof(tANI_U16);
3209 len -= sizeof(tANI_U16);
3210 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3211 return eSIR_FAILURE;
3212
3213#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
3214 pDisassocReq->seqNum = limGetU16(pBuf);
3215#endif
3216#endif
3217
3218 return eSIR_SUCCESS;
3219} /*** end limDisassocReqSerDes() ***/
3220
3221
3222
3223/**
3224 * limDeauthReqSerDes()
3225 *
3226 *FUNCTION:
3227 * This function is called by limProcessSmeMessages() upon receiving
3228 * SME_DEAUTH_REQ from host
3229 *
3230 *PARAMS:
3231 *
3232 *LOGIC:
3233 *
3234 *ASSUMPTIONS:
3235 * NA
3236 *
3237 *NOTE:
3238 * NA
3239 *
3240 * @param pDeauthReq Pointer to tSirSmeDeauthReq being extracted
3241 * @param pBuf Pointer to serialized buffer
3242 *
3243 * @return retCode Indicates whether message is successfully
3244 * de-serialized (eSIR_SUCCESS) or
3245 * not (eSIR_FAILURE)
3246 */
3247tSirRetStatus
3248limDeauthReqSerDes(tpAniSirGlobal pMac, tSirSmeDeauthReq *pDeauthReq, tANI_U8 *pBuf)
3249{
3250 tANI_S16 len = 0;
3251
3252#ifdef PE_DEBUG_LOG1
3253 tANI_U8 *pTemp = pBuf;
3254#endif
3255
3256 if (!pDeauthReq || !pBuf)
3257 return eSIR_FAILURE;
3258
3259 pDeauthReq->messageType = limGetU16(pBuf);
3260 pBuf += sizeof(tANI_U16);
3261
3262 len = pDeauthReq->length = limGetU16(pBuf);
3263 pBuf += sizeof(tANI_U16);
3264
3265 PELOG1(limLog(pMac, LOG1, FL("SME_DEAUTH_REQ length %d bytes is:\n"), len);)
3266 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
3267
3268 if (len < (tANI_S16) sizeof(tANI_U32))
3269 return eSIR_FAILURE;
3270
3271 len -= sizeof(tANI_U32); // skip message header
3272 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3273 return eSIR_FAILURE;
3274
3275 // Extract sessionId
3276 pDeauthReq->sessionId = *pBuf++;
3277 len--;
3278 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3279 return eSIR_FAILURE;
3280
3281 // Extract transactionId
3282 pDeauthReq->transactionId = limGetU16(pBuf);
3283 pBuf += sizeof(tANI_U16);
3284 len -= sizeof(tANI_U16);
3285 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3286 return eSIR_FAILURE;
3287
3288 // Extract bssId
3289 palCopyMemory( pMac->hHdd, pDeauthReq->bssId, pBuf, sizeof(tSirMacAddr));
3290 pBuf += sizeof(tSirMacAddr);
3291 len -= sizeof(tSirMacAddr);
3292 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3293 return eSIR_FAILURE;
3294
3295 // Extract peerMacAddr
3296 palCopyMemory( pMac->hHdd, pDeauthReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
3297 pBuf += sizeof(tSirMacAddr);
3298 len -= sizeof(tSirMacAddr);
3299 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3300 return eSIR_FAILURE;
3301
3302 // Extract reasonCode
3303 pDeauthReq->reasonCode = limGetU16(pBuf);
3304 pBuf += sizeof(tANI_U16);
3305 len -= sizeof(tANI_U16);
3306
3307#if defined(ANI_PRODUCT_TYPE_AP)
3308 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3309 return eSIR_FAILURE;
3310 pDeauthReq->aid = limGetU16(pBuf);
3311#endif
3312
3313 return eSIR_SUCCESS;
3314} /*** end limDisassocReqSerDes() ***/
3315
3316
3317
3318
3319#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
3320/**
3321 * limCopyNeighborInfoToCfg()
3322 *
3323 *FUNCTION:
3324 * This function is called by limProcessSmeMessages() upon receiving
3325 * SME_JOIN_REQ/SME_REASSOC_REQ from WSM to convert neighborBssInfo
3326 * that is being joined to bssDescription used by MLM
3327 *
3328 *PARAMS:
3329 *
3330 *LOGIC:
3331 *
3332 *ASSUMPTIONS:
3333 * NA
3334 *
3335 *NOTE:
3336 * NA
3337 *
3338 * @param neighborBssInfo Neighbor BSS info to be converted
3339 *
3340 * @return None
3341 */
3342
3343void
3344limCopyNeighborInfoToCfg(tpAniSirGlobal pMac, tSirNeighborBssInfo neighborBssInfo, tpPESession psessionEntry)
3345{
3346 tANI_U32 localPowerConstraints = 0;
3347 tANI_U16 caps;
3348 tANI_U8 qosCap = 0;
3349
3350 if(psessionEntry)
3351 {
3352 psessionEntry->gLimPhyMode = neighborBssInfo.nwType;
3353 }
3354 else
3355 {
3356 pMac->lim.gLimPhyMode = neighborBssInfo.nwType;
3357 }
3358
3359 cfgSetCapabilityInfo(pMac, neighborBssInfo.capabilityInfo);
3360
3361 if (cfgSetStr(pMac, WNI_CFG_SSID, (tANI_U8 *) &neighborBssInfo.ssId.ssId,
3362 neighborBssInfo.ssId.length) != eSIR_SUCCESS)
3363 {
3364 /// Could not update SSID at CFG. Log error.
3365 limLog(pMac, LOGP, FL("could not update SSID at CFG\n"));
3366 }
3367
3368 #if 0
3369 if (cfgSetStr(
3370 pMac, WNI_CFG_OPERATIONAL_RATE_SET,
3371 (tANI_U8 *) &neighborBssInfo.operationalRateSet.rate,
3372 neighborBssInfo.operationalRateSet.numRates) != eSIR_SUCCESS)
3373 {
3374 /// Could not update Operational Rateset at CFG. Log error.
3375 limLog(pMac, LOGP,
3376 FL("could not update Operational Rateset at CFG\n"));
3377 }
3378 #endif // TO SUPPORT BT-AMP
3379
3380 if (neighborBssInfo.nwType == WNI_CFG_PHY_MODE_11G)
3381 {
3382 if (cfgSetStr(
3383 pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
3384 (tANI_U8 *) &neighborBssInfo.extendedRateSet.rate,
3385 neighborBssInfo.extendedRateSet.numRates) != eSIR_SUCCESS)
3386 {
3387 /// Could not update Extended Rateset at CFG. Log error.
3388 limLog(pMac, LOGP,
3389 FL("could not update Extended Rateset at CFG\n"));
3390 }
3391 }
3392#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
3393 if (neighborBssInfo.hcfEnabled)
3394 LIM_BSS_CAPS_SET(HCF, qosCap);
3395#endif
3396 if (neighborBssInfo.wmeInfoPresent || neighborBssInfo.wmeEdcaPresent)
3397 LIM_BSS_CAPS_SET(WME, qosCap);
3398 if (LIM_BSS_CAPS_GET(WME, qosCap) && neighborBssInfo.wsmCapablePresent)
3399 LIM_BSS_CAPS_SET(WSM, qosCap);
3400
3401 pMac->lim.gLimCurrentBssQosCaps = qosCap;
3402
3403 if (neighborBssInfo.wniIndicator)
3404 pMac->lim.gLimCurrentBssPropCap = neighborBssInfo.propIECapability;
3405 else
3406 pMac->lim.gLimCurrentBssPropCap = 0;
3407
3408 if (neighborBssInfo.HTCapsPresent)
3409 pMac->lim.htCapabilityPresentInBeacon = 1;
3410 else
3411 pMac->lim.htCapabilityPresentInBeacon = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07003412 if (neighborBssInfo.localPowerConstraints && pSessionEntry->lim11hEnable)
Jeff Johnson295189b2012-06-20 16:38:30 -07003413 {
3414 localPowerConstraints = neighborBssInfo.localPowerConstraints;
3415 }
3416 if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, localPowerConstraints) != eSIR_SUCCESS)
3417 {
3418 limLog(pMac, LOGP, FL("Could not update local power constraint to cfg.\n"));
3419 }
3420} /*** end limCopyNeighborInfoToCfg() ***/
3421#endif
3422
3423
3424/**
3425 * limStatSerDes()
3426 *
3427 *FUNCTION:
3428 * This function is called by limSendSmeDisassocNtf() while sending
3429 * SME_DISASSOC_IND/eWNI_SME_DISASSOC_RSP to host
3430 *
3431 *PARAMS:
3432 *
3433 *LOGIC:
3434 *
3435 *ASSUMPTIONS:
3436 * NA
3437 *
3438 *NOTE:
3439 * NA
3440 *
3441 * @param pAssocInd Pointer to tpAniStaStatStruct being sent
3442 * @param pBuf Pointer to serialized buffer
3443 *
3444 * @return None
3445 */
3446
3447void
3448limStatSerDes(tpAniSirGlobal pMac, tpAniStaStatStruct pStat, tANI_U8 *pBuf)
3449{
3450#ifdef PE_DEBUG_LOG1
3451 tANI_U8 *pTemp = pBuf;
3452#endif
3453
3454 limCopyU32(pBuf, pStat->sentAesBlksUcastHi);
3455 pBuf += sizeof(tANI_U32);
3456
3457 limCopyU32(pBuf, pStat->sentAesBlksUcastLo);
3458 pBuf += sizeof(tANI_U32);
3459
3460 limCopyU32(pBuf, pStat->recvAesBlksUcastHi);
3461 pBuf += sizeof(tANI_U32);
3462
3463 limCopyU32(pBuf, pStat->recvAesBlksUcastLo);
3464 pBuf += sizeof(tANI_U32);
3465
3466 limCopyU32(pBuf, pStat->aesFormatErrorUcastCnts);
3467 pBuf += sizeof(tANI_U32);
3468
3469 limCopyU32(pBuf, pStat->aesReplaysUcast);
3470 pBuf += sizeof(tANI_U32);
3471
3472 limCopyU32(pBuf, pStat->aesDecryptErrUcast);
3473 pBuf += sizeof(tANI_U32);
3474
3475 limCopyU32(pBuf, pStat->singleRetryPkts);
3476 pBuf += sizeof(tANI_U32);
3477
3478 limCopyU32(pBuf, pStat->failedTxPkts);
3479 pBuf += sizeof(tANI_U32);
3480
3481 limCopyU32(pBuf, pStat->ackTimeouts);
3482 pBuf += sizeof(tANI_U32);
3483
3484 limCopyU32(pBuf, pStat->multiRetryPkts);
3485 pBuf += sizeof(tANI_U32);
3486
3487 limCopyU32(pBuf, pStat->fragTxCntsHi);
3488 pBuf += sizeof(tANI_U32);
3489
3490 limCopyU32(pBuf, pStat->fragTxCntsLo);
3491 pBuf += sizeof(tANI_U32);
3492
3493 limCopyU32(pBuf, pStat->transmittedPktsHi);
3494 pBuf += sizeof(tANI_U32);
3495
3496 limCopyU32(pBuf, pStat->transmittedPktsLo);
3497 pBuf += sizeof(tANI_U32);
3498
3499 limCopyU32(pBuf, pStat->phyStatHi);
3500 pBuf += sizeof(tANI_U32);
3501
3502 limCopyU32(pBuf, pStat->phyStatLo);
3503 pBuf += sizeof(tANI_U32);
3504
3505 limCopyU32(pBuf, pStat->uplinkRssi);
3506 pBuf += sizeof(tANI_U32);
3507
3508 limCopyU32(pBuf, pStat->uplinkSinr);
3509 pBuf += sizeof(tANI_U32);
3510
3511 limCopyU32(pBuf, pStat->uplinkRate);
3512 pBuf += sizeof(tANI_U32);
3513
3514 limCopyU32(pBuf, pStat->downlinkRssi);
3515 pBuf += sizeof(tANI_U32);
3516
3517 limCopyU32(pBuf, pStat->downlinkSinr);
3518 pBuf += sizeof(tANI_U32);
3519
3520 limCopyU32(pBuf, pStat->downlinkRate);
3521 pBuf += sizeof(tANI_U32);
3522
3523 limCopyU32(pBuf, pStat->nRcvBytes);
3524 pBuf += sizeof(tANI_U32);
3525
3526 limCopyU32(pBuf, pStat->nXmitBytes);
3527 pBuf += sizeof(tANI_U32);
3528
3529 PELOG1(limLog(pMac, LOG1, FL("STAT: length %d bytes is:\n"), sizeof(tAniStaStatStruct));)
3530 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, sizeof(tAniStaStatStruct));)
3531
3532} /*** end limStatSerDes() ***/
3533
3534
3535#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
3536/**
3537 * limSmeWmStatusChangeNtfSerDes()
3538 *
3539 *FUNCTION:
3540 * This function is called by limSendSmeWmStatusChangeNtf()
3541 * to serialize the header fields of SME WM Status Change
3542 * Notification
3543 *
3544 *LOGIC:
3545 *
3546 *ASSUMPTIONS:
3547 * NA
3548 *
3549 *NOTE:
3550 * NA
3551 *
3552 * @param statusChangeCode Status Change code
3553 * @param pBuf Pointer to serialized buffer
3554 * @param len Pointer to length actually used
3555 * @param buflen Buffer length remaining
3556 * @return retCode Indicates whether message is successfully
3557 * serialized (eSIR_SUCCESS) or not (eSIR_FAILURE)
3558 */
3559
3560tSirRetStatus
3561limSmeWmStatusChangeHeaderSerDes(tpAniSirGlobal pMac,
3562 tSirSmeStatusChangeCode statusChangeCode,
3563 tANI_U8 *pBuf,
3564 tANI_U16 *len,
3565 tANI_U32 buflen,
3566 tANI_U8 sessionId)
3567{
3568 if (buflen < ((sizeof(tANI_U16) * 2) + sizeof(tANI_U32)))
3569 {
3570 limLog(pMac, LOGE,
3571 FL("limSmeWmStatusChangeHeaderSerDes: no enough space (buf %d) \n"), buflen);
3572 return eSIR_FAILURE;
3573 }
3574
3575 *len = 0;
3576
3577 limCopyU16(pBuf, eWNI_SME_WM_STATUS_CHANGE_NTF);
3578 pBuf += sizeof(tANI_U16);
3579 *len += sizeof(tANI_U16);
3580
3581 // Actual length value shall be filled later
3582 pBuf += sizeof(tANI_U16);
3583 *len += sizeof(tANI_U16);
3584
3585 *pBuf++ = sessionId;
3586 *len += sizeof(tANI_U8);
3587
3588 limCopyU32(pBuf, statusChangeCode);
3589 pBuf += sizeof(tANI_U32);
3590 *len += sizeof(tANI_U32);
3591
3592 return eSIR_SUCCESS;
3593} /*** end limSmeWmStatusChangeHeaderSerDes() ***/
3594
3595
3596
3597/**
3598 * limRadioInfoSerDes()
3599 *
3600 *FUNCTION:
3601 * This function is called by limSendSmeWmStatusChangeNtf()
3602 * to serialize the radarInfo message
3603 *
3604 *LOGIC:
3605 *
3606 *ASSUMPTIONS:
3607 * NA
3608 *
3609 *NOTE:
3610 * NA
3611 *
3612 * @param pRadarInfo Pointer to tSirRadarInfo
3613 * @param pBuf Pointer to serialized buffer
3614 * @param len Pointer to length actually used by tSirRadarInfo
3615 * @param buflen Length remaining
3616 *
3617 * @return retCode Indicates whether message is successfully
3618 * serialized (eSIR_SUCCESS) or not (eSIR_FAILURE)
3619 */
3620
3621tSirRetStatus
3622limRadioInfoSerDes(tpAniSirGlobal pMac, tpSirRadarInfo pRadarInfo,
3623 tANI_U8 *pBuf, tANI_U16 *len, tANI_U32 buflen)
3624{
3625
3626 if (buflen < sizeof(tSirRadarInfo))
3627 {
3628 limLog(pMac, LOGE,
3629 FL("no enough space (buf %d) \n"), buflen);
3630 return eSIR_FAILURE;
3631 }
3632
3633 *pBuf = pRadarInfo->channelNumber;
3634 pBuf += sizeof(tANI_U8);
3635 *len += sizeof(tANI_U8);
3636
3637 limCopyU16(pBuf, pRadarInfo->radarPulseWidth);
3638 pBuf += sizeof(tANI_U16);
3639 *len += sizeof(tANI_U16);
3640
3641 limCopyU16(pBuf, pRadarInfo->numRadarPulse);
3642 pBuf += sizeof(tANI_U16);
3643 *len += sizeof(tANI_U16);
3644
3645 return eSIR_SUCCESS;
3646} /*** end limRadioInfoSerDes() ***/
3647#endif
3648
3649
3650/**
3651 * limPackBkgndScanFailNotify()
3652 *
3653 *FUNCTION:
3654 * This function is called by limSendSmeWmStatusChangeNtf()
3655 * to pack the tSirBackgroundScanInfo message
3656 *
3657 */
3658void
3659limPackBkgndScanFailNotify(tpAniSirGlobal pMac,
3660 tSirSmeStatusChangeCode statusChangeCode,
3661 tpSirBackgroundScanInfo pScanInfo,
3662 tSirSmeWmStatusChangeNtf *pSmeNtf,
3663 tANI_U8 sessionId)
3664{
3665
3666 tANI_U16 length = (sizeof(tANI_U16) * 2) + sizeof(tANI_U8) +
3667 sizeof(tSirSmeStatusChangeCode) +
3668 sizeof(tSirBackgroundScanInfo);
3669
3670#if defined (ANI_PRODUCT_TYPE_AP) && defined(ANI_LITTLE_BYTE_ENDIAN)
3671 sirStoreU16N((tANI_U8*)&pSmeNtf->messageType, eWNI_SME_WM_STATUS_CHANGE_NTF );
3672 sirStoreU16N((tANI_U8*)&pSmeNtf->length, length);
3673 pSmeNtf->sessionId = sessionId;
3674 sirStoreU32N((tANI_U8*)&pSmeNtf->statusChangeCode, statusChangeCode);
3675
3676 sirStoreU32N((tANI_U8*)&pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanSuccess,
3677 pScanInfo->numOfScanSuccess);
3678 sirStoreU32N((tANI_U8*)&pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanFailure,
3679 pScanInfo->numOfScanFailure);
3680 sirStoreU32N((tANI_U8*)&pSmeNtf->statusChangeInfo.bkgndScanInfo.reserved,
3681 pScanInfo->reserved);
3682#else
3683 pSmeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
3684 pSmeNtf->statusChangeCode = statusChangeCode;
3685 pSmeNtf->length = length;
3686 pSmeNtf->sessionId = sessionId;
3687 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanSuccess = pScanInfo->numOfScanSuccess;
3688 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanFailure = pScanInfo->numOfScanFailure;
3689 pSmeNtf->statusChangeInfo.bkgndScanInfo.reserved = pScanInfo->reserved;
3690#endif
3691}
3692
3693#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
3694
3695/**
3696 * nonTitanBssFoundSerDes()
3697 *
3698 *FUNCTION:
3699 * This function is called by limSendSmeWmStatusChangeNtf()
3700 * to serialize the following message
3701 * Mesg = eWNI_SME_WM_STATUS_CHANGE_NTF
3702 * Change code = eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP
3703 *
3704 *LOGIC:
3705 *
3706 *ASSUMPTIONS:
3707 * NA
3708 *
3709 *NOTE:
3710 * NA
3711 *
3712 * @param pMac Pointer to the global pMAC structure
3713 * @param pNewBssInfo Pointer to tpSirNeighborBssWdsInfo
3714 * @param pBuf Send data buffer
3715 * @param len Length of message
3716 * @param buflen Length remaining
3717 *
3718 * @return retCode Indicates whether message is successfully
3719 * serialized (eSIR_SUCCESS) or not (eSIR_FAILURE)
3720 */
3721
3722tSirRetStatus nonTitanBssFoundSerDes( tpAniSirGlobal pMac,
3723 tpSirNeighborBssWdsInfo pNewBssInfo,
3724 tANI_U8 *pBuf,
3725 tANI_U16 *len,
3726 tANI_U8 sessionId )
3727{
3728tANI_U8 *pTemp = pBuf;
3729tANI_U16 length = 0;
3730tANI_U32 bufLen = sizeof( tSirSmeWmStatusChangeNtf );
3731
3732 // Serialize the header (length to be filled later)
3733 if( eSIR_SUCCESS != limSmeWmStatusChangeHeaderSerDes(
3734 pMac,
3735 eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP,
3736 pBuf,
3737 &length,
3738 bufLen,
3739 sessionId))
3740 {
3741 limLog( pMac, LOGE,
3742 FL("Header SerDes failed \n"));
3743 return eSIR_FAILURE;
3744 }
3745 pBuf += length;
3746 bufLen -= length;
3747
3748 // Serialize tSirNeighborBssWdsInfo
3749 length = limCopyNeighborWdsInfo( pMac,
3750 pBuf,
3751 pNewBssInfo );
3752 pBuf += length;
3753 bufLen -= length;
3754
3755 // Update tSirSmeWmStatusChangeNtf.length
3756 pBuf = pTemp;
3757 pBuf += sizeof(tANI_U16);
3758 limCopyU16(pBuf, length);
3759
3760 // Update the total length to be returned
3761 *len = length;
3762
3763 return eSIR_SUCCESS;
3764} /*** end nonTitanBssFoundSerDes() ***/
3765
3766/**
3767 * limIsSmeSwitchChannelReqValid()
3768 *
3769 *FUNCTION:
3770 * This function is called by limProcessSmeReqMessages() upon
3771 * receiving SME_SWITCH_CHL_REQ message from application.
3772 *
3773 *LOGIC:
3774 * Message validity checks are performed in this function
3775 *
3776 *ASSUMPTIONS:
3777 *
3778 *NOTE:
3779 *
3780 * @param pBuf - Pointer to a serialized SME_SWITCH_CHL_REQ message
3781 * @param pSmeMsg - Pointer to a tSirsmeSwitchChannelReq structure
3782 * @return true if SME_SWITCH_CHL_REQ message is formatted correctly
3783 * false otherwise
3784 */
3785
3786tANI_BOOLEAN
3787limIsSmeSwitchChannelReqValid(tpAniSirGlobal pMac,
3788 tANI_U8 *pBuf,
3789 tpSirSmeSwitchChannelReq pSmeMsg)
3790{
3791 pSmeMsg->messageType = limGetU16(pBuf);
3792 pBuf += sizeof(tANI_U16);
3793
3794 pSmeMsg->length = limGetU16(pBuf);
3795 pBuf += sizeof(tANI_U16);
3796
3797 pSmeMsg->transactionId = limGetU16(pBuf);
3798 pBuf += sizeof(tANI_U16);
3799
3800 pSmeMsg->channelId = *pBuf;
3801 pBuf++;
3802
3803 pSmeMsg->cbMode = limGetU32(pBuf);
3804 pBuf += sizeof(tANI_U32);
3805
3806 pSmeMsg->dtimFactor = limGetU32(pBuf);
3807 pBuf += sizeof(tANI_U32);
3808
3809 if (pSmeMsg->length != SIR_SME_CHANNEL_SWITCH_SIZE)
3810 {
3811 PELOGE(limLog(pMac, LOGE, FL("Invalid length %d \n"), pSmeMsg->length);)
3812 return eANI_BOOLEAN_FALSE;
3813 }
3814
3815 // dtimFactor should not be too large
3816 if (pSmeMsg->dtimFactor > SIR_MAX_DTIM_FACTOR)
3817 {
3818 PELOGE(limLog(pMac, LOGE, FL("Invalid dtimFactor %d \n"), pSmeMsg->dtimFactor);)
3819 return eANI_BOOLEAN_FALSE;
3820 }
3821
3822 return eANI_BOOLEAN_TRUE;
3823}
3824
3825#endif
3826
3827#ifdef WLAN_SOFTAP_FEATURE
3828/**
3829 * limIsSmeGetAssocSTAsReqValid()
3830 *
3831 *FUNCTION:
3832 * This function is called by limProcessSmeReqMessages() upon
3833 * receiving SME_GET_ASSOC_STAS_REQ message from application.
3834 *
3835 *LOGIC:
3836 * Message validity checks are performed in this function
3837 *
3838 *ASSUMPTIONS:
3839 *
3840 *NOTE:
3841 *
3842 * @param pBuf - Pointer to a serialized SME_GET_ASSOC_STAS_REQ message
3843 * @param pSmeMsg - Pointer to a tSirSmeGetAssocSTAsReq structure
3844 * @return true if SME_GET_ASSOC_STAS_REQ message is formatted correctly
3845 * false otherwise
3846 */
3847tANI_BOOLEAN
3848limIsSmeGetAssocSTAsReqValid(tpAniSirGlobal pMac, tpSirSmeGetAssocSTAsReq pGetAssocSTAsReq, tANI_U8 *pBuf)
3849{
3850 tANI_S16 len = 0;
3851
3852 pGetAssocSTAsReq->messageType = limGetU16(pBuf);
3853 pBuf += sizeof(tANI_U16);
3854
3855 len = pGetAssocSTAsReq->length = limGetU16(pBuf);
3856 pBuf += sizeof(tANI_U16);
3857
3858 if (len < (tANI_S16) sizeof(tANI_U32))
3859 return eSIR_FAILURE;
3860
3861 len -= sizeof(tANI_U32); // skip message header
3862 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3863 return eSIR_FAILURE;
3864
3865 // Extract bssId
3866 palCopyMemory( pMac->hHdd, (tANI_U8 *) pGetAssocSTAsReq->bssId, pBuf, sizeof(tSirMacAddr));
3867 pBuf += sizeof(tSirMacAddr);
3868 len -= sizeof(tSirMacAddr);
3869 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3870 return eSIR_FAILURE;
3871
3872 // Extract modId
3873 pGetAssocSTAsReq->modId = limGetU16(pBuf);
3874 pBuf += sizeof(tANI_U16);
3875 len -= sizeof(tANI_U16);
3876 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3877 return eSIR_FAILURE;
3878
3879 // Extract pUsrContext
3880 pGetAssocSTAsReq->pUsrContext = (void *)limGetU32(pBuf);
3881 pBuf += sizeof(tANI_U32);
3882 len -= sizeof(tANI_U32);
3883 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3884 return eSIR_FAILURE;
3885
3886 // Extract pSapEventCallback
3887 pGetAssocSTAsReq->pSapEventCallback = (void *)limGetU32(pBuf);
3888 pBuf += sizeof(tANI_U32);
3889 len -= sizeof(tANI_U32);
3890 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3891 return eSIR_FAILURE;
3892
3893 // Extract pAssocStasArray
3894 pGetAssocSTAsReq->pAssocStasArray = (void *)limGetU32(pBuf);
3895 pBuf += sizeof(tANI_U32);
3896 len -= sizeof(tANI_U32);
3897
3898 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes \n"), len);)
3899
3900 if (len < 0)
3901 {
3902 PELOGE(limLog(pMac, LOGE, FL("SME_GET_ASSOC_STAS_REQ invalid length\n"));)
3903 return eANI_BOOLEAN_FALSE;
3904 }
3905
3906 return eANI_BOOLEAN_TRUE;
3907}
3908
3909/**
3910 * limTkipCntrMeasReqSerDes()
3911 *
3912 *FUNCTION:
3913 * This function is called by limProcessSmeMessages() upon receiving
3914 * eWNI_SME_TKIP_CNTR_MEAS_REQ from host HDD
3915 *
3916 *PARAMS:
3917 *
3918 *LOGIC:
3919 *
3920 *ASSUMPTIONS:
3921 * NA
3922 *
3923 *NOTE:
3924 * NA
3925 *
3926 * @param tpSirSmeTkipCntrMeasReq Pointer to tSirSmeTkipCntrMeasReq being extracted
3927 * @param pBuf Pointer to serialized buffer
3928 * @return retCode Indicates whether message is successfully
3929 * de-serialized (eSIR_SUCCESS) or
3930 * not (eSIR_FAILURE)
3931 */
3932tSirRetStatus
3933limTkipCntrMeasReqSerDes(tpAniSirGlobal pMac, tpSirSmeTkipCntrMeasReq pTkipCntrMeasReq, tANI_U8 *pBuf)
3934{
3935 tANI_S16 len = 0;
3936
3937#ifdef PE_DEBUG_LOG1
3938 tANI_U8 *pTemp = pBuf;
3939#endif
3940
3941 pTkipCntrMeasReq->messageType = limGetU16(pBuf);
3942 pBuf += sizeof(tANI_U16);
3943
3944 len = pTkipCntrMeasReq->length = limGetU16(pBuf);
3945 pBuf += sizeof(tANI_U16);
3946
3947 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length %d bytes is:\n"), len);)
3948 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
3949
3950 if (len < (tANI_S16) sizeof(tANI_U32))
3951 return eSIR_FAILURE;
3952
3953 len -= sizeof(tANI_U32); // skip message header
3954 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3955 return eSIR_FAILURE;
3956
3957 // Extract sessionId
3958 pTkipCntrMeasReq->sessionId = *pBuf++;
3959 len--;
3960 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3961 return eSIR_FAILURE;
3962
3963 // Extract transactionId
3964 pTkipCntrMeasReq->transactionId = limGetU16(pBuf);
3965 pBuf += sizeof(tANI_U16);
3966 len -= sizeof(tANI_U16);
3967 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3968 return eSIR_FAILURE;
3969
3970 // Extract bssId
3971 palCopyMemory( pMac->hHdd, (tANI_U8 *) pTkipCntrMeasReq->bssId, pBuf, sizeof(tSirMacAddr));
3972 pBuf += sizeof(tSirMacAddr);
3973 len -= sizeof(tSirMacAddr);
3974 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3975 return eSIR_FAILURE;
3976
3977 // Extract bEnable
3978 pTkipCntrMeasReq->bEnable = *pBuf++;
3979 len --;
3980
3981 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length consumed %d bytes \n"), len);)
3982
3983 if (len)
3984 {
3985 PELOGE(limLog(pMac, LOGE, FL("SME_TKIP_CNTR_MEAS_REQ invalid \n"));)
3986 return eSIR_FAILURE;
3987 }
3988 else
3989 return eSIR_SUCCESS;
3990}
3991
3992/**
3993 * limIsSmeGetWPSPBCSessionsReqValid()
3994 *
3995 *FUNCTION:
3996 * This function is called by limProcessSmeGetWPSPBCSessions() upon
3997 * receiving query WPS PBC overlap information message from application.
3998 *
3999 *LOGIC:
4000 * Message validity checks are performed in this function
4001 *
4002 *ASSUMPTIONS:
4003 *
4004 *NOTE:
4005 *
4006 * @param pBuf - Pointer to a serialized SME_GET_WPSPBC_SESSION_REQ message
4007 * @param pGetWPSPBCSessionsReq - Pointer to a tSirSmeGetWPSPBCSessionsReq structure
4008 * @return true if SME_GET_WPSPBC_SESSION_REQ message is formatted correctly
4009 * false otherwise
4010 */
4011
4012tSirRetStatus
4013limIsSmeGetWPSPBCSessionsReqValid(tpAniSirGlobal pMac, tSirSmeGetWPSPBCSessionsReq *pGetWPSPBCSessionsReq, tANI_U8 *pBuf)
4014{
4015 tANI_S16 len = 0;
4016
4017 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirSmeGetWPSPBCSessionsReq));)
4018
4019 pGetWPSPBCSessionsReq->messageType = limGetU16(pBuf);
4020 pBuf += sizeof(tANI_U16);
4021
4022 len = pGetWPSPBCSessionsReq->length = limGetU16(pBuf);
4023 pBuf += sizeof(tANI_U16);
4024
4025 if (len < (tANI_S16) sizeof(tANI_U32))
4026 return eSIR_FAILURE;
4027
4028 len -= sizeof(tANI_U32); // skip message header
4029 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4030 return eSIR_FAILURE;
4031
4032 // Extract pUsrContext
4033 pGetWPSPBCSessionsReq->pUsrContext = (void *)limGetU32(pBuf);
4034 pBuf += sizeof(tANI_U32);
4035 len -= sizeof(tANI_U32);
4036 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4037 return eSIR_FAILURE;
4038
4039 // Extract pSapEventCallback
4040 pGetWPSPBCSessionsReq->pSapEventCallback = (void *)limGetU32(pBuf);
4041 pBuf += sizeof(tANI_U32);
4042 len -= sizeof(tANI_U32);
4043 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4044 return eSIR_FAILURE;
4045
4046 // Extract bssId
4047 palCopyMemory( pMac->hHdd, (tANI_U8 *) pGetWPSPBCSessionsReq->bssId, pBuf, sizeof(tSirMacAddr));
4048 pBuf += sizeof(tSirMacAddr);
4049 len -= sizeof(tSirMacAddr);
4050
4051 // Extract MAC address of Station to be removed
4052 palCopyMemory( pMac->hHdd, (tANI_U8 *) pGetWPSPBCSessionsReq->pRemoveMac, pBuf, sizeof(tSirMacAddr));
4053 pBuf += sizeof(tSirMacAddr);
4054 len -= sizeof(tSirMacAddr);
4055
4056 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes \n"), len);)
4057
4058 if (len < 0)
4059 {
4060 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length\n"));)
4061 return eSIR_FAILURE;
4062 }
4063
4064 return eSIR_SUCCESS;
4065}
4066
4067#endif
4068
4069/**---------------------------------------------------------------
4070\fn limGetSessionInfo
4071\brief This function returns the sessionId and transactionId
4072\ of a message. This assumes that the message structure
4073\ is of format:
4074\ tANI_U16 messageType
4075\ tANI_U16 messageLength
4076\ tANI_U8 sessionId
4077\ tANI_U16 transactionId
4078\param pMac - pMac global structure
4079\param *pBuf - pointer to the message buffer
4080\param sessionId - returned session id value
4081\param transactionId - returned transaction ID value
4082\return None
4083------------------------------------------------------------------*/
4084void
4085limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U8 *sessionId, tANI_U16 *transactionId)
4086{
4087 if (!pBuf)
4088 {
4089 limLog(pMac, LOGE, FL("NULL ptr received. \n"));
4090 return;
4091 }
4092
4093 pBuf += sizeof(tANI_U16); // skip message type
4094 pBuf += sizeof(tANI_U16); // skip message length
4095
4096 *sessionId = *pBuf; // get sessionId
4097 pBuf++;
4098 *transactionId = limGetU16(pBuf); // get transactionId
4099
4100 return;
4101}
4102
4103#ifdef WLAN_SOFTAP_FEATURE
4104
4105/**
4106 * limUpdateAPWPSIEsReqSerDes()
4107 *
4108 *FUNCTION:
4109 * This function is to deserialize UpdateAPWPSIEs message
4110 *
4111 *PARAMS:
4112 *
4113 *LOGIC:
4114 *
4115 *ASSUMPTIONS:
4116 * NA
4117 *
4118 *NOTE:
4119 * NA
4120 *
4121 * @param pUpdateAPWPSIEsReq Pointer to tSirUpdateAPWPSIEsReq being
4122 * extracted
4123 * @param pBuf Pointer to serialized buffer
4124 *
4125 * @return retCode Indicates whether message is successfully
4126 * de-serialized (eSIR_SUCCESS) or
4127 * not (eSIR_FAILURE)
4128 */
4129
4130tSirRetStatus
4131limUpdateAPWPSIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq, tANI_U8 *pBuf)
4132{
4133 tANI_S16 len = 0;
4134
4135 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPSIEsReq));)
4136
4137 if (!pUpdateAPWPSIEsReq || !pBuf)
4138 return eSIR_FAILURE;
4139
4140 pUpdateAPWPSIEsReq->messageType = limGetU16(pBuf);
4141 pBuf += sizeof(tANI_U16);
4142
4143 len = pUpdateAPWPSIEsReq->length = limGetU16(pBuf);
4144 pBuf += sizeof(tANI_U16);
4145
4146 if (len < (tANI_S16) sizeof(tANI_U32))
4147 return eSIR_FAILURE;
4148
4149 len -= sizeof(tANI_U32); // skip message header
4150 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4151 return eSIR_FAILURE;
4152
4153 // Extract transactionId
4154 pUpdateAPWPSIEsReq->transactionId = limGetU16( pBuf );
4155 pBuf += sizeof( tANI_U16 );
4156 len -= sizeof( tANI_U16 );
4157 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4158 return eSIR_FAILURE;
4159
4160 // Extract bssId
4161 palCopyMemory( pMac->hHdd, (tANI_U8 *) pUpdateAPWPSIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
4162 pBuf += sizeof(tSirMacAddr);
4163 len -= sizeof(tSirMacAddr);
4164 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4165 return eSIR_FAILURE;
4166
4167 // Extract sessionId
4168 pUpdateAPWPSIEsReq->sessionId = *pBuf++;
4169 len--;
4170 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4171 return eSIR_FAILURE;
4172
4173 // Extract APWPSIEs
4174 palCopyMemory( pMac->hHdd, (tSirAPWPSIEs *) &pUpdateAPWPSIEsReq->APWPSIEs, pBuf, sizeof(tSirAPWPSIEs));
4175 pBuf += sizeof(tSirAPWPSIEs);
4176 len -= sizeof(tSirAPWPSIEs);
4177
4178 PELOG1(limLog(pMac, LOG1, FL("SME_UPDATE_APWPSIE_REQ length consumed %d bytes \n"), len);)
4179
4180 if (len < 0)
4181 {
4182 PELOGE(limLog(pMac, LOGE, FL("SME_UPDATE_APWPSIE_REQ invalid length\n"));)
4183 return eSIR_FAILURE;
4184 }
4185
4186 return eSIR_SUCCESS;
4187} /*** end limSetContextReqSerDes() ***/
4188
4189/**
4190 * limUpdateAPWPARSNIEsReqSerDes ()
4191 *
4192 *FUNCTION:
4193 * This function is to deserialize UpdateAPWPSIEs message
4194 *
4195 *PARAMS:
4196 *
4197 *LOGIC:
4198 *
4199 *ASSUMPTIONS:
4200 * NA
4201 *
4202 *NOTE:
4203 * NA
4204 *
4205 * @param pUpdateAPWPARSNIEsReq Pointer to tpSirUpdateAPWPARSNIEsReq being
4206 * extracted
4207 * @param pBuf Pointer to serialized buffer
4208 *
4209 * @return retCode Indicates whether message is successfully
4210 * de-serialized (eSIR_SUCCESS) or
4211 * not (eSIR_FAILURE)
4212 */
4213
4214tSirRetStatus
4215limUpdateAPWPARSNIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq, tANI_U8 *pBuf)
4216{
4217 tANI_S16 len = 0;
4218
4219 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPARSNIEsReq));)
4220
4221 if (!pUpdateAPWPARSNIEsReq || !pBuf)
4222 return eSIR_FAILURE;
4223
4224 pUpdateAPWPARSNIEsReq->messageType = limGetU16(pBuf);
4225 pBuf += sizeof(tANI_U16);
4226
4227 len = pUpdateAPWPARSNIEsReq->length = limGetU16(pBuf);
4228 pBuf += sizeof(tANI_U16);
4229
4230 if (len < (tANI_S16) sizeof(tANI_U32))
4231 return eSIR_FAILURE;
4232
4233 len -= sizeof(tANI_U32); // skip message header
4234 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4235 return eSIR_FAILURE;
4236
4237 // Extract transactionId
4238 pUpdateAPWPARSNIEsReq->transactionId = limGetU16( pBuf );
4239 pBuf += sizeof(tANI_U16);
4240 len -= sizeof( tANI_U16 );
4241 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4242 return eSIR_FAILURE;
4243
4244 // Extract bssId
4245 palCopyMemory( pMac->hHdd, (tANI_U8 *) pUpdateAPWPARSNIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
4246 pBuf += sizeof(tSirMacAddr);
4247 len -= sizeof(tSirMacAddr);
4248 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4249 return eSIR_FAILURE;
4250
4251 // Extract sessionId
4252 pUpdateAPWPARSNIEsReq->sessionId = *pBuf++;
4253 len--;
4254 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4255 return eSIR_FAILURE;
4256
4257 // Extract APWPARSNIEs
4258 palCopyMemory( pMac->hHdd, (tSirRSNie *) &pUpdateAPWPARSNIEsReq->APWPARSNIEs, pBuf, sizeof(tSirRSNie));
4259 pBuf += sizeof(tSirRSNie);
4260 len -= sizeof(tSirRSNie);
4261
4262 if (len < 0)
4263 {
4264 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length\n"));)
4265 return eSIR_FAILURE;
4266 }
4267
4268 return eSIR_SUCCESS;
4269} /*** end limUpdateAPWPARSNIEsReqSerDes() ***/
4270
4271#endif