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