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