blob: dae0ba642870cf8ae28b0c91c98bf9848491559a [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
1513 // Extract rsnIe
1514 pStartBssReq->rsnIE.length = limGetU16(pBuf);
1515 pBuf += sizeof(tANI_U16);
1516
1517 // Check for RSN IE length (that includes length of type & length
1518 if (pStartBssReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2)
1519 {
1520 limLog(pMac, LOGW,
1521 FL("Invalid RSN IE length %d in SME_START_BSS_REQ\n"),
1522 pStartBssReq->rsnIE.length);
1523 return eSIR_FAILURE;
1524 }
1525
1526 palCopyMemory( pMac->hHdd, pStartBssReq->rsnIE.rsnIEdata,
1527 pBuf, pStartBssReq->rsnIE.length);
1528
1529 len -= (sizeof(tANI_U16) + pStartBssReq->rsnIE.length);
1530 pBuf += pStartBssReq->rsnIE.length;
1531 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1532 return eSIR_FAILURE;
1533
1534 // Extract nwType
1535 pStartBssReq->nwType = (tSirNwType) limGetU32(pBuf);
1536 pBuf += sizeof(tSirNwType);
1537 len -= sizeof(tSirNwType);
1538 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1539 return eSIR_FAILURE;
1540
1541 // Extract operationalRateSet
1542 pStartBssReq->operationalRateSet.numRates = *pBuf++;
1543
1544 // Check for number of rates
1545 if (pStartBssReq->operationalRateSet.numRates >
1546 SIR_MAC_MAX_NUMBER_OF_RATES)
1547 {
1548 limLog(pMac, LOGW, FL("Invalid numRates %d in SME_START_BSS_REQ\n"),
1549 pStartBssReq->operationalRateSet.numRates);
1550 return eSIR_FAILURE;
1551 }
1552
1553 len--;
1554 if (len < pStartBssReq->operationalRateSet.numRates)
1555 return eSIR_FAILURE;
1556
1557 palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->operationalRateSet.rate,
1558 pBuf,
1559 pStartBssReq->operationalRateSet.numRates);
1560 pBuf += pStartBssReq->operationalRateSet.numRates;
1561 len -= pStartBssReq->operationalRateSet.numRates;
1562
1563 // Extract extendedRateSet
1564 if ((pStartBssReq->nwType == eSIR_11G_NW_TYPE) ||
1565 (pStartBssReq->nwType == eSIR_11N_NW_TYPE ))
1566 {
1567 pStartBssReq->extendedRateSet.numRates = *pBuf++;
1568 len--;
1569 palCopyMemory( pMac->hHdd, pStartBssReq->extendedRateSet.rate,
1570 pBuf, pStartBssReq->extendedRateSet.numRates);
1571 pBuf += pStartBssReq->extendedRateSet.numRates;
1572 len -= pStartBssReq->extendedRateSet.numRates;
1573 }
1574
1575#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
1576 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1577 return eSIR_FAILURE;
1578
1579 limLog(pMac,
1580 LOGW,
1581 FL("Going to parse numSSID in the START_BSS_REQ, len=%d\n"), len);
1582 if (len < 2)
1583 {
1584 // No numSSID parameter in the START_BSS_REQ
1585 limLog(pMac,
1586 LOGW,
1587 FL("No numSSID in the START_BSS_REQ, len=%d\n"), len);
1588 return eSIR_FAILURE;
1589 }
1590
1591 // Extract numSSID
1592 pStartBssReq->numSSID = *pBuf++;
1593 len--;
1594
1595 // Extract ssIdList[]
1596 for (i = 0; (i < pStartBssReq->numSSID) && len; i++)
1597 {
1598 pStartBssReq->ssIdList[i].length = *pBuf++;
1599 len--;
1600 if (len < pStartBssReq->ssIdList[i].length)
1601 {
1602 limLog(pMac, LOGW,
1603 FL("SSID length[%d] is more than the rem length[%d]\n"),
1604 pStartBssReq->ssIdList[i].length, len);
1605 return eSIR_FAILURE;
1606 }
1607
1608 if (pStartBssReq->ssIdList[i].length > SIR_MAC_MAX_SSID_LENGTH)
1609 {
1610 // SSID length is more than max allowed 32 bytes
1611 limLog(pMac,
1612 LOGW,
1613 FL("Invalid SSID length in the list, len=%d\n"),
1614 pStartBssReq->ssIdList[i].length);
1615 return eSIR_FAILURE;
1616 }
1617
1618 palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->ssIdList[i].ssId,
1619 pBuf,
1620 pStartBssReq->ssIdList[i].length);
1621 pBuf += pStartBssReq->ssIdList[i].length;
1622 len -= pStartBssReq->ssIdList[i].length;
1623 }
1624#endif
1625
1626 if (len)
1627 {
1628 limLog(pMac, LOGW, FL("Extra bytes left in SME_START_BSS_REQ, len=%d\n"), len);
1629 }
1630
1631 return eSIR_SUCCESS;
1632} /*** end limStartBssReqSerDes() ***/
1633
1634
1635
1636/**
1637 * limStopBssReqSerDes()
1638 *
1639 *FUNCTION:
1640 * This function is called by limProcessSmeMessages() upon receiving
1641 * SME_STOP_BSS_REQ from host
1642 *
1643 *PARAMS:
1644 *
1645 *LOGIC:
1646 *
1647 *ASSUMPTIONS:
1648 * NA
1649 *
1650 *NOTE:
1651 * NA
1652 *
1653 * @param pStopBssReq Pointer to tSirSmeStopBssReq being extracted
1654 * @param pBuf Pointer to serialized buffer
1655 * @return retCode Indicates whether message is successfully
1656 * de-serialized (eSIR_SUCCESS) or
1657 * not (eSIR_FAILURE)
1658 */
1659
1660tSirRetStatus
1661limStopBssReqSerDes(tpAniSirGlobal pMac, tpSirSmeStopBssReq pStopBssReq, tANI_U8 *pBuf)
1662{
1663 tANI_S16 len = 0;
1664
1665#ifdef PE_DEBUG_LOG1
1666 tANI_U8 *pTemp = pBuf;
1667#endif
1668
1669 pStopBssReq->messageType = limGetU16(pBuf);
1670 pBuf += sizeof(tANI_U16);
1671
1672 len = pStopBssReq->length = limGetU16(pBuf);
1673 pBuf += sizeof(tANI_U16);
1674
1675 PELOG1(limLog(pMac, LOG1, FL("SME_STOP_BSS_REQ length %d bytes is:\n"), len);)
1676 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
1677
1678 if (len < (tANI_S16) sizeof(tANI_U32))
1679 return eSIR_FAILURE;
1680
1681 len -= sizeof(tANI_U32); // skip message header
1682 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1683 return eSIR_FAILURE;
1684
1685 // Extract sessionId
1686 pStopBssReq->sessionId = *pBuf++;
1687 len--;
1688 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1689 return eSIR_FAILURE;
1690
1691 // Extract transactionId
1692 pStopBssReq->transactionId = limGetU16(pBuf);
1693 pBuf += sizeof(tANI_U16);
1694 len -= sizeof(tANI_U16);
1695
1696 // Extract reasonCode
1697 pStopBssReq->reasonCode = (tSirResultCodes) limGetU32(pBuf);
1698 pBuf += sizeof(tSirResultCodes);
1699 len -= sizeof(tSirResultCodes);
1700
1701 // Extract bssId
1702 palCopyMemory( pMac->hHdd, (tANI_U8 *) pStopBssReq->bssId, pBuf, sizeof(tSirMacAddr));
1703 len -= sizeof(tSirMacAddr);
1704
1705 if (len)
1706 return eSIR_FAILURE;
1707 else
1708 return eSIR_SUCCESS;
1709
1710} /*** end limStopBssReqSerDes() ***/
1711
1712
1713
1714/**
1715 * limJoinReqSerDes()
1716 *
1717 *FUNCTION:
1718 * This function is called by limProcessSmeMessages() upon receiving
1719 * SME_JOIN_REQ from host
1720 *
1721 *PARAMS:
1722 *
1723 *LOGIC:
1724 *
1725 *ASSUMPTIONS:
1726 * NA
1727 *
1728 *NOTE:
1729 * NA
1730 *
1731 * @param pJoinReq Pointer to tSirSmeJoinReq being extracted
1732 * @param pBuf Pointer to serialized buffer
1733 * @return retCode Indicates whether message is successfully
1734 * de-serialized (eSIR_SUCCESS) or
1735 * not (eSIR_FAILURE)
1736 */
1737
1738tSirRetStatus
1739limJoinReqSerDes(tpAniSirGlobal pMac, tpSirSmeJoinReq pJoinReq, tANI_U8 *pBuf)
1740{
1741 tANI_S16 len = 0;
1742 tANI_S16 lenUsed = 0;
1743
1744#ifdef PE_DEBUG_LOG1
1745 tANI_U8 *pTemp = pBuf;
1746#endif
1747
1748 if (!pJoinReq || !pBuf)
1749 {
1750 PELOGE(limLog(pMac, LOGE, FL("NULL ptr received\n"));)
1751 return eSIR_FAILURE;
1752 }
1753
1754 // Extract messageType
1755 pJoinReq->messageType = limGetU16(pBuf);
1756 pBuf += sizeof(tANI_U16);
1757
1758 // Extract length
1759 len = pJoinReq->length = limGetU16(pBuf);
1760 pBuf += sizeof(tANI_U16);
1761
1762 if (pJoinReq->messageType == eWNI_SME_JOIN_REQ)
1763 PELOG1(limLog(pMac, LOG3, FL("SME_JOIN_REQ length %d bytes is:\n"), len);)
1764 else
1765 PELOG1(limLog(pMac, LOG3, FL("SME_REASSOC_REQ length %d bytes is:\n"), len);)
1766
1767 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
1768
1769 if (len < (tANI_S16) sizeof(tANI_U32))
1770 {
1771 PELOGE(limLog(pMac, LOGE, FL("len too short %d\n"), len);)
1772 return eSIR_FAILURE;
1773 }
1774
1775 len -= sizeof(tANI_U32); // skip message header
1776 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1777 return eSIR_FAILURE;
1778
1779 // Extract sessionId
1780 pJoinReq->sessionId = *pBuf++;
1781 len--;
1782 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1783 return eSIR_FAILURE;
1784
1785 // Extract transactionId
1786 pJoinReq->transactionId = limGetU16(pBuf);
1787 pBuf += sizeof(tANI_U16);
1788 len -= sizeof(tANI_U16);
1789 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1790 return eSIR_FAILURE;
1791
1792 // Extract ssId
1793 pJoinReq->ssId.length = *pBuf++;
1794 len--;
1795 palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->ssId.ssId, pBuf, pJoinReq->ssId.length);
1796 pBuf += pJoinReq->ssId.length;
1797 len -= pJoinReq->ssId.length;
1798 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1799 return eSIR_FAILURE;
1800
1801 // Extract selfMacAddr
1802 palCopyMemory( pMac->hHdd, pJoinReq->selfMacAddr, pBuf, sizeof(tSirMacAddr));
1803 pBuf += sizeof(tSirMacAddr);
1804 len -= sizeof(tSirMacAddr);
1805 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1806 return eSIR_FAILURE;
1807
1808 // Extract bsstype
1809 pJoinReq->bsstype = (tSirBssType) limGetU32(pBuf);
1810 pBuf += sizeof(tANI_U32);
1811 len -= sizeof(tANI_U32);
1812 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1813 return eSIR_FAILURE;
1814
1815 // Extract dot11mode
1816 pJoinReq->dot11mode= *pBuf++;
1817 len--;
1818 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1819 return eSIR_FAILURE;
1820
1821 // Extract bssPersona
1822 pJoinReq->staPersona = *pBuf++;
1823 len--;
1824 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1825 return eSIR_FAILURE;
1826
Jeff Johnsone7245742012-09-05 17:12:55 -07001827 // Extract cbMode
1828 pJoinReq->cbMode = *pBuf++;
1829 len--;
1830 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1831 return eSIR_FAILURE;
1832
Jeff Johnson295189b2012-06-20 16:38:30 -07001833 // Extract uapsdPerAcBitmask
1834 pJoinReq->uapsdPerAcBitmask = *pBuf++;
1835 len--;
1836 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1837 return eSIR_FAILURE;
1838
1839#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
1840 // Extract assocType
1841 pJoinReq->assocType = (tSirAssocType) limGetU32(pBuf);
1842 pBuf += sizeof(tSirAssocType);
1843 len -= sizeof(tSirAssocType);
1844 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1845 return eSIR_FAILURE;
1846#endif
1847
1848 // Extract operationalRateSet
1849 pJoinReq->operationalRateSet.numRates= *pBuf++;
1850 len--;
1851 if (pJoinReq->operationalRateSet.numRates)
1852 {
1853 palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->operationalRateSet.rate, pBuf, pJoinReq->operationalRateSet.numRates);
1854 pBuf += pJoinReq->operationalRateSet.numRates;
1855 len -= pJoinReq->operationalRateSet.numRates;
1856 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1857 return eSIR_FAILURE;
1858 }
1859
1860 // Extract extendedRateSet
1861 pJoinReq->extendedRateSet.numRates = *pBuf++;
1862 len--;
1863 if (pJoinReq->extendedRateSet.numRates)
1864 {
1865 palCopyMemory( pMac->hHdd, pJoinReq->extendedRateSet.rate, pBuf, pJoinReq->extendedRateSet.numRates);
1866 pBuf += pJoinReq->extendedRateSet.numRates;
1867 len -= pJoinReq->extendedRateSet.numRates;
1868 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1869 return eSIR_FAILURE;
1870 }
1871
1872 // Extract RSN IE
1873 pJoinReq->rsnIE.length = limGetU16(pBuf);
1874 pBuf += sizeof(tANI_U16);
1875 len -= sizeof(tANI_U16);
1876
1877 if (pJoinReq->rsnIE.length)
1878 {
1879 // Check for RSN IE length (that includes length of type & length)
1880 if ((pJoinReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2) ||
1881 (pJoinReq->rsnIE.length != 2 + *(pBuf + 1)))
1882 {
1883 limLog(pMac, LOGW,
1884 FL("Invalid RSN IE length %d in SME_JOIN_REQ\n"),
1885 pJoinReq->rsnIE.length);
1886 return eSIR_FAILURE;
1887 }
1888 palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->rsnIE.rsnIEdata,
1889 pBuf, pJoinReq->rsnIE.length);
1890 pBuf += pJoinReq->rsnIE.length;
1891 len -= pJoinReq->rsnIE.length; // skip RSN IE
1892 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1893 return eSIR_FAILURE;
1894 }
1895
1896#ifdef FEATURE_WLAN_CCX
1897 // Extract CCKM IE
1898 pJoinReq->cckmIE.length = limGetU16(pBuf);
1899 pBuf += sizeof(tANI_U16);
1900 len -= sizeof(tANI_U16);
1901 if (pJoinReq->cckmIE.length)
1902 {
1903 // Check for CCKM IE length (that includes length of type & length)
1904 if ((pJoinReq->cckmIE.length > SIR_MAC_MAX_IE_LENGTH) ||
1905 (pJoinReq->cckmIE.length != (2 + *(pBuf + 1))))
1906 {
1907 limLog(pMac, LOGW,
1908 FL("Invalid CCKM IE length %d/%d in SME_JOIN/REASSOC_REQ\n"),
1909 pJoinReq->cckmIE.length, 2 + *(pBuf + 1));
1910 return eSIR_FAILURE;
1911 }
1912 palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->cckmIE.cckmIEdata,
1913 pBuf, pJoinReq->cckmIE.length);
1914 pBuf += pJoinReq->cckmIE.length;
1915 len -= pJoinReq->cckmIE.length; // skip CCKM IE
1916 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1917 return eSIR_FAILURE;
1918 }
1919#endif
1920
1921 // Extract Add IE for scan
1922 pJoinReq->addIEScan.length = limGetU16(pBuf);
1923 pBuf += sizeof(tANI_U16);
1924 len -= sizeof(tANI_U16);
1925
1926 if (pJoinReq->addIEScan.length)
1927 {
1928 // Check for IE length (that includes length of type & length)
1929 if (pJoinReq->addIEScan.length > SIR_MAC_MAX_IE_LENGTH + 2)
1930 {
1931 limLog(pMac, LOGE,
1932 FL("Invalid addIE Scan length %d in SME_JOIN_REQ\n"),
1933 pJoinReq->addIEScan.length);
1934 return eSIR_FAILURE;
1935 }
1936 // Check for P2P IE length (that includes length of type & length)
1937 palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->addIEScan.addIEdata,
1938 pBuf, pJoinReq->addIEScan.length);
1939 pBuf += pJoinReq->addIEScan.length;
1940 len -= pJoinReq->addIEScan.length; // skip add IE
1941 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1942 return eSIR_FAILURE;
1943 }
1944
1945 pJoinReq->addIEAssoc.length = limGetU16(pBuf);
1946 pBuf += sizeof(tANI_U16);
1947 len -= sizeof(tANI_U16);
1948
1949 // Extract Add IE for assoc
1950 if (pJoinReq->addIEAssoc.length)
1951 {
1952 // Check for IE length (that includes length of type & length)
1953 if (pJoinReq->addIEAssoc.length > SIR_MAC_MAX_IE_LENGTH + 2)
1954 {
1955 limLog(pMac, LOGE,
1956 FL("Invalid addIE Assoc length %d in SME_JOIN_REQ\n"),
1957 pJoinReq->addIEAssoc.length);
1958 return eSIR_FAILURE;
1959 }
1960 // Check for P2P IE length (that includes length of type & length)
1961 palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->addIEAssoc.addIEdata,
1962 pBuf, pJoinReq->addIEAssoc.length);
1963 pBuf += pJoinReq->addIEAssoc.length;
1964 len -= pJoinReq->addIEAssoc.length; // skip add IE
1965 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1966 return eSIR_FAILURE;
1967 }
1968
1969 pJoinReq->MCEncryptionType = limGetU32(pBuf);
1970 pBuf += sizeof(tANI_U32);
1971 len -= sizeof(tANI_U32);
1972 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1973 return eSIR_FAILURE;
1974
1975 pJoinReq->UCEncryptionType = limGetU32(pBuf);
1976 pBuf += sizeof(tANI_U32);
1977 len -= sizeof(tANI_U32);
1978 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1979 return eSIR_FAILURE;
1980
1981#ifdef WLAN_FEATURE_VOWIFI_11R
1982 //is11Rconnection;
1983 pJoinReq->is11Rconnection = (tAniBool)limGetU32(pBuf);
1984 pBuf += sizeof(tAniBool);
1985 len -= sizeof(tAniBool);
1986 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1987 return eSIR_FAILURE;
1988#endif
1989
1990#ifdef FEATURE_WLAN_CCX
1991 //isCCXconnection;
1992 pJoinReq->isCCXconnection = (tAniBool)limGetU32(pBuf);
1993 pBuf += sizeof(tAniBool);
1994 len -= sizeof(tAniBool);
1995 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1996 return eSIR_FAILURE;
1997
1998 // TSPEC information
1999 pJoinReq->ccxTspecInfo.numTspecs = *pBuf++;
2000 len -= sizeof(tANI_U8);
2001 palCopyMemory(pMac->hHdd, (void*)&pJoinReq->ccxTspecInfo.tspec[0], pBuf, (sizeof(tTspecInfo)* pJoinReq->ccxTspecInfo.numTspecs));
2002 pBuf += sizeof(tTspecInfo)*SIR_CCX_MAX_TSPEC_IES;
2003 len -= sizeof(tTspecInfo)*SIR_CCX_MAX_TSPEC_IES;
2004 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2005 return eSIR_FAILURE;
2006#endif
2007
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002008#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002009 //isFastTransitionEnabled;
2010 pJoinReq->isFastTransitionEnabled = (tAniBool)limGetU32(pBuf);
2011 pBuf += sizeof(tAniBool);
2012 len -= sizeof(tAniBool);
2013 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2014 return eSIR_FAILURE;
2015#endif
2016
Jeff Johnson43971f52012-07-17 12:26:56 -07002017#ifdef FEATURE_WLAN_LFR
2018 //isFastRoamIniFeatureEnabled;
2019 pJoinReq->isFastRoamIniFeatureEnabled = (tAniBool)limGetU32(pBuf);
2020 pBuf += sizeof(tAniBool);
2021 len -= sizeof(tAniBool);
2022 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2023 return eSIR_FAILURE;
2024#endif
2025
Jeff Johnson295189b2012-06-20 16:38:30 -07002026#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
2027 // Extract BP Indicator
2028 pJoinReq->bpIndicator = (tAniBool) limGetU32(pBuf);
2029 pBuf += sizeof(tAniBool);
2030 len -= sizeof(tAniBool);
2031 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2032 return eSIR_FAILURE;
2033
2034 // Extract BP Type
2035 pJoinReq->bpType = (tSirBpIndicatorType) limGetU32(pBuf);
2036 pBuf += sizeof(tSirBpIndicatorType);
2037 len -= sizeof(tSirBpIndicatorType);
2038 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2039 return eSIR_FAILURE;
2040
2041 // Extract Neighbor BSS List
2042 if (limGetNeighborBssList(pMac, &pJoinReq->neighborBssList,
2043 len, &lenUsed, pBuf) == eSIR_FAILURE)
2044 {
2045 PELOGE(limLog(pMac, LOGE, FL("get neighbor bss list failed\n"));)
2046 return eSIR_FAILURE;
2047 }
2048 pBuf += lenUsed;
2049 len -= lenUsed;
2050 PELOG1(limLog(pMac, LOG1, FL("Assoc Type %d RSN len %d bp %d type %d bss RSN len %d\n"),
2051 pJoinReq->assocType, pJoinReq->rsnIE.length, pJoinReq->bpIndicator,
2052 pJoinReq->bpType, pJoinReq->neighborBssList.bssList->rsnIE.length);)
2053#endif
2054
2055 // Extract Titan CB Neighbor BSS info
2056 pJoinReq->cbNeighbors.cbBssFoundPri = *pBuf;
2057 pBuf++;
2058 pJoinReq->cbNeighbors.cbBssFoundSecUp = *pBuf;
2059 pBuf++;
2060 pJoinReq->cbNeighbors.cbBssFoundSecDown = *pBuf;
2061 pBuf++;
2062 len -= 3;
2063
2064 // Extract Spectrum Mgt Indicator
2065 pJoinReq->spectrumMgtIndicator = (tAniBool) limGetU32(pBuf);
2066 pBuf += sizeof(tAniBool);
2067 len -= sizeof(tAniBool);
2068
2069 pJoinReq->powerCap.minTxPower = *pBuf++;
2070 pJoinReq->powerCap.maxTxPower = *pBuf++;
2071 len -=2;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002072 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 -07002073
2074 pJoinReq->supportedChannels.numChnl = *pBuf++;
2075 len--;
2076 palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->supportedChannels.channelList,
2077 pBuf, pJoinReq->supportedChannels.numChnl);
2078 pBuf += pJoinReq->supportedChannels.numChnl;
2079 len-= pJoinReq->supportedChannels.numChnl;
2080
2081 PELOG2(limLog(pMac, LOG2,
2082 FL("spectrumInd ON: minPower %d, maxPower %d , numChnls %d\n"),
2083 pJoinReq->powerCap.minTxPower,
2084 pJoinReq->powerCap.maxTxPower,
2085 pJoinReq->supportedChannels.numChnl);)
2086
2087 // Extract uapsdPerAcBitmask
2088 pJoinReq->uapsdPerAcBitmask = *pBuf++;
2089 len--;
2090 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2091 return eSIR_FAILURE;
2092
2093#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA)
2094 //
2095 // NOTE - tSirBssDescription is now moved to the end
2096 // of tSirSmeJoinReq structure. This is to accomodate
2097 // the variable length data member ieFields[1]
2098 //
2099 if (limGetBssDescription( pMac, &pJoinReq->bssDescription,
2100 len, &lenUsed, pBuf) == eSIR_FAILURE)
2101 {
2102 PELOGE(limLog(pMac, LOGE, FL("get bss description failed\n"));)
2103 return eSIR_FAILURE;
2104 }
2105 PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, (tANI_U8 *) &(pJoinReq->bssDescription), pJoinReq->bssDescription.length + 2);)
2106 pBuf += lenUsed;
2107 len -= lenUsed;
2108#endif
2109
2110 return eSIR_SUCCESS;
2111} /*** end limJoinReqSerDes() ***/
2112
2113
2114/**---------------------------------------------------------------
2115\fn limAssocIndSerDes
2116\brief This function is called by limProcessMlmAssocInd() to
2117\ populate the SME_ASSOC_IND message based on the received
2118\ MLM_ASSOC_IND.
2119\
2120\param pMac
2121\param pAssocInd - Pointer to the received tLimMlmAssocInd
2122\param pBuf - Pointer to serialized buffer
2123\param psessionEntry - pointer to PE session entry
2124\
2125\return None
2126------------------------------------------------------------------*/
2127void
2128limAssocIndSerDes(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
2129{
2130 tANI_U8 *pLen = pBuf;
2131 tANI_U16 mLen = 0;
2132
2133#ifdef PE_DEBUG_LOG1
2134 tANI_U8 *pTemp = pBuf;
2135#endif
2136
2137#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
2138 tANI_U32 len = 0;
2139#endif
2140
2141 mLen = sizeof(tANI_U32);
2142 mLen += sizeof(tANI_U8);
2143 pBuf += sizeof(tANI_U16);
2144 *pBuf = psessionEntry->smeSessionId;
2145 pBuf += sizeof(tANI_U8);
2146
2147 // Fill in peerMacAddr
2148 palCopyMemory( pMac->hHdd, pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr));
2149 pBuf += sizeof(tSirMacAddr);
2150 mLen += sizeof(tSirMacAddr);
2151
2152 // Fill in aid
2153 limCopyU16(pBuf, pAssocInd->aid);
2154 pBuf += sizeof(tANI_U16);
2155 mLen += sizeof(tANI_U16);
2156
2157 // Fill in bssId
2158 palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
2159 pBuf += sizeof(tSirMacAddr);
2160 mLen += sizeof(tSirMacAddr);
2161
2162 // Fill in staId
2163 limCopyU16(pBuf, psessionEntry->staId);
2164 pBuf += sizeof(tANI_U16);
2165 mLen += sizeof(tANI_U16);
2166
2167 // Fill in authType
2168 limCopyU32(pBuf, pAssocInd->authType);
2169 pBuf += sizeof(tANI_U32);
2170 mLen += sizeof(tANI_U32);
2171
2172 // Fill in ssId
2173 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
2174 pBuf += (1 + pAssocInd->ssId.length);
2175 mLen += (1 + pAssocInd->ssId.length);
2176
2177 // Fill in rsnIE
2178 limCopyU16(pBuf, pAssocInd->rsnIE.length);
2179 pBuf += sizeof(tANI_U16);
2180 mLen += sizeof(tANI_U16);
2181 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
2182 pAssocInd->rsnIE.length);
2183 pBuf += pAssocInd->rsnIE.length;
2184 mLen += pAssocInd->rsnIE.length;
2185
2186#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
2187
2188 limCopyU16(pBuf, pAssocInd->seqNum);
2189 pBuf += sizeof(tANI_U16);
2190 mLen += sizeof(tANI_U16);
2191
2192 limCopyU32(pBuf, pAssocInd->wniIndicator);
2193 pBuf += sizeof(tAniBool);
2194 mLen += sizeof(tAniBool);
2195
2196 limCopyU32(pBuf, pAssocInd->bpIndicator);
2197 pBuf += sizeof(tAniBool);
2198 mLen += sizeof(tAniBool);
2199
2200 limCopyU32(pBuf, pAssocInd->bpType);
2201 pBuf += sizeof(tSirBpIndicatorType);
2202 mLen += sizeof(tSirBpIndicatorType);
2203
2204 limCopyU32(pBuf, pAssocInd->assocType);
2205 pBuf += sizeof(tANI_U32);
2206 mLen += sizeof(tANI_U32);
2207
2208 limCopyLoad(pBuf, pAssocInd->load);
2209 pBuf += sizeof(tSirLoad);
2210 mLen += sizeof(tSirLoad);
2211
2212 limCopyU32(pBuf, pAssocInd->numBss);
2213 pBuf += sizeof(tANI_U32);
2214 mLen += sizeof(tANI_U32);
2215
2216 if (pAssocInd->numBss)
2217 {
2218 len = limCopyNeighborList(pMac,
2219 pBuf,
2220 pAssocInd->neighborList, pAssocInd->numBss);
2221 pBuf += len;
2222 mLen += (tANI_U16) len;
2223 }
2224
2225 // place holder to capability and nwType
2226
2227 limCopyU16(pBuf, *(tANI_U16 *)&pAssocInd->capabilityInfo);
2228 pBuf += sizeof(tANI_U16); // capabilityInfo
2229 mLen += sizeof(tANI_U16);
2230
2231 limCopyU32(pBuf, *(tANI_U32 *)&pAssocInd->nwType);
2232 pBuf += sizeof(tANI_U32); // nwType
2233 mLen += sizeof(tANI_U32);
2234
2235#endif
2236
Jeff Johnson295189b2012-06-20 16:38:30 -07002237 limCopyU32(pBuf, pAssocInd->spectrumMgtIndicator);
2238 pBuf += sizeof(tAniBool);
2239 mLen += sizeof(tAniBool);
2240
2241 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
2242 {
2243 *pBuf = pAssocInd->powerCap.minTxPower;
2244 pBuf++;
2245 *pBuf = pAssocInd->powerCap.maxTxPower;
2246 pBuf++;
2247 mLen += sizeof(tSirMacPowerCapInfo);
2248
2249 *pBuf = pAssocInd->supportedChannels.numChnl;
2250 pBuf++;
2251 mLen++;
2252
2253 palCopyMemory( pMac->hHdd, pBuf,
2254 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
2255 pAssocInd->supportedChannels.numChnl);
2256
2257
2258 pBuf += pAssocInd->supportedChannels.numChnl;
2259 mLen += pAssocInd->supportedChannels.numChnl;
2260 }
2261#ifdef WLAN_SOFTAP_FEATURE
2262 limCopyU32(pBuf, pAssocInd->WmmStaInfoPresent);
2263 pBuf += sizeof(tANI_U32);
2264 mLen += sizeof(tANI_U32);
2265#endif
2266 // Fill in length of SME_ASSOC_IND message
2267 limCopyU16(pLen, mLen);
2268
2269 PELOG1(limLog(pMac, LOG1, FL("Sending SME_ASSOC_IND length %d bytes:\n"), mLen);)
2270 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
2271} /*** end limAssocIndSerDes() ***/
2272
2273
2274
2275/**
2276 * limAssocCnfSerDes()
2277 *
2278 *FUNCTION:
2279 * This function is called by limProcessLmmMessages() when
2280 * SME_ASSOC_CNF or SME_REASSOC_CNF message is received from
2281 * upper layer software.
2282 *
2283 *PARAMS:
2284 *
2285 *LOGIC:
2286 *
2287 *ASSUMPTIONS:
2288 * NA
2289 *
2290 *NOTE:
2291 * NA
2292 *
2293 * @param pAssocCnf Pointer to tSirSmeAssocCnf being extracted into
2294 * @param pBuf Pointer to serialized buffer
2295 * @return retCode Indicates whether message is successfully
2296 * de-serialized (eSIR_SUCCESS) or
2297 * not (eSIR_FAILURE)
2298 */
2299
2300tSirRetStatus
2301limAssocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeAssocCnf pAssocCnf, tANI_U8 *pBuf)
2302{
2303#ifdef PE_DEBUG_LOG1
2304 tANI_U8 *pTemp = pBuf;
2305#endif
2306
2307 if (!pAssocCnf || !pBuf)
2308 return eSIR_FAILURE;
2309
2310 pAssocCnf->messageType = limGetU16(pBuf);
2311 pBuf += sizeof(tANI_U16);
2312
2313 pAssocCnf->length = limGetU16(pBuf);
2314 pBuf += sizeof(tANI_U16);
2315
2316 if (pAssocCnf->messageType == eWNI_SME_ASSOC_CNF)
2317 {
2318 PELOG1(limLog(pMac, LOG1, FL("SME_ASSOC_CNF length %d bytes is:\n"), pAssocCnf->length);)
2319 }
2320 else
2321 {
2322 PELOG1(limLog(pMac, LOG1, FL("SME_REASSOC_CNF length %d bytes is:\n"), pAssocCnf->length);)
2323 }
2324 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pAssocCnf->length);)
2325
2326 // status code
2327 pAssocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
2328 pBuf += sizeof(tSirResultCodes);
2329
2330 // bssId
2331 palCopyMemory( pMac->hHdd, pAssocCnf->bssId, pBuf, sizeof(tSirMacAddr));
2332 pBuf += sizeof(tSirMacAddr);
2333
2334 // peerMacAddr
2335 palCopyMemory( pMac->hHdd, pAssocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
2336 pBuf += sizeof(tSirMacAddr);
2337
2338
2339 pAssocCnf->aid = limGetU16(pBuf);
2340 pBuf += sizeof(tANI_U16);
2341 // alternateBssId
2342 palCopyMemory( pMac->hHdd, pAssocCnf->alternateBssId, pBuf, sizeof(tSirMacAddr));
2343 pBuf += sizeof(tSirMacAddr);
2344
2345 // alternateChannelId
2346 pAssocCnf->alternateChannelId = *pBuf;
2347 pBuf++;
2348
2349 return eSIR_SUCCESS;
2350} /*** end limAssocCnfSerDes() ***/
2351
2352
2353
2354/**
2355 * limDisassocCnfSerDes()
2356 *
2357 *FUNCTION:
2358 * This function is called by limProcessSmeMessages() when
2359 * SME_DISASSOC_CNF message is received from upper layer software.
2360 *
2361 *PARAMS:
2362 *
2363 *LOGIC:
2364 *
2365 *ASSUMPTIONS:
2366 * NA
2367 *
2368 *NOTE:
2369 * NA
2370 *
2371 * @param pDisassocCnf Pointer to tSirSmeDisassocCnf being
2372 * extracted into
2373 * @param pBuf Pointer to serialized buffer
2374 * @return retCode Indicates whether message is successfully
2375 * de-serialized (eSIR_SUCCESS) or
2376 * not (eSIR_FAILURE)
2377 */
2378
2379tSirRetStatus
2380limDisassocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeDisassocCnf pDisassocCnf, tANI_U8 *pBuf)
2381{
2382#ifdef PE_DEBUG_LOG1
2383 tANI_U8 *pTemp = pBuf;
2384#endif
2385
2386 if (!pDisassocCnf || !pBuf)
2387 return eSIR_FAILURE;
2388
2389 pDisassocCnf->messageType = limGetU16(pBuf);
2390 pBuf += sizeof(tANI_U16);
2391
2392 pDisassocCnf->length = limGetU16(pBuf);
2393 pBuf += sizeof(tANI_U16);
2394
2395 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_CNF length %d bytes is:\n"), pDisassocCnf->length);)
2396 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pDisassocCnf->length);)
2397
2398 pDisassocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
2399 pBuf += sizeof(tSirResultCodes);
2400
2401 palCopyMemory( pMac->hHdd, pDisassocCnf->bssId, pBuf, sizeof(tSirMacAddr));
2402 pBuf += sizeof(tSirMacAddr);
2403
2404 palCopyMemory( pMac->hHdd, pDisassocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
2405
2406#if defined(ANI_PRODUCT_TYPE_AP)
2407 pBuf += sizeof(tSirMacAddr);
2408 pDisassocCnf->aid = limGetU16(pBuf);
2409#endif
2410
2411 return eSIR_SUCCESS;
2412} /*** end limDisassocCnfSerDes() ***/
2413
2414
2415
2416#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
2417/**
2418 * limMeasurementReqSerDes()
2419 *
2420 *FUNCTION:
2421 * This function is called by limProcessLmmMessages() when
2422 * SME_MEASUREMENT_REQ message is received from upper layer software.
2423 *
2424 *PARAMS:
2425 *
2426 *LOGIC:
2427 *
2428 *ASSUMPTIONS:
2429 * NA
2430 *
2431 *NOTE:
2432 * NA
2433 *
2434 * @param pMeasReq Pointer to tSirSmeMeasurement being
2435 * extracted into
2436 * @param pBuf Pointer to serialized buffer
2437 * @return retCode Indicates whether message is successfully
2438 * de-serialized (eSIR_SUCCESS) or
2439 * not (eSIR_FAILURE)
2440 */
2441
2442tSirRetStatus
2443limMeasurementReqSerDes(tpAniSirGlobal pMac, tpSirSmeMeasurementReq pMeasReq, tANI_U8 *pBuf)
2444{
2445 tANI_S16 len = 0;
2446 PELOG3(tANI_U8 *pTemp = pBuf;)
2447
2448 if (!pMeasReq || !pBuf)
2449 return eSIR_FAILURE;
2450
2451 pMeasReq->messageType = limGetU16(pBuf);
2452 pBuf += sizeof(tANI_U16);
2453
2454 len = pMeasReq->length = limGetU16(pBuf);
2455 pBuf += sizeof(tANI_U16);
2456
2457 PELOG3(limLog(pMac, LOG3, FL("SME_MEASUREMENT_REQ length %d bytes is:\n"), len);
2458 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
2459
2460 if (len < (tANI_S16) sizeof(tANI_U32))
2461 return eSIR_FAILURE;
2462
2463 len -= sizeof(tANI_U32); // skip message header
2464 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2465 return eSIR_FAILURE;
2466
2467 pMeasReq->measControl.periodicMeasEnabled = (tAniBool)
2468 limGetU32(pBuf);
2469
2470 pBuf += sizeof(tAniBool);
2471 len -= sizeof(tAniBool);
2472 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2473 return eSIR_FAILURE;
2474
2475 pMeasReq->measControl.involveSTAs = (tAniBool)
2476 limGetU32(pBuf);
2477 pBuf += sizeof(tAniBool);
2478 len -= sizeof(tAniBool);
2479 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2480 return eSIR_FAILURE;
2481
2482 pMeasReq->measControl.metricsType = *pBuf++;
2483 len--;
2484 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2485 return eSIR_FAILURE;
2486
2487 pMeasReq->measControl.scanType = (tSirScanType)
2488 limGetU32(pBuf);
2489 pBuf += sizeof(tSirScanType);
2490 len -= sizeof(tSirScanType);
2491 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2492 return eSIR_FAILURE;
2493
2494 pMeasReq->measControl.longChannelScanPeriodicity = *pBuf++;
2495 len--;
2496 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2497 return eSIR_FAILURE;
2498
2499 pMeasReq->measControl.cb11hEnabled = (tAniBool)limGetU32(pBuf);
2500 pBuf += sizeof(tAniBool);
2501 len -= sizeof(tAniBool);
2502
2503 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2504 return eSIR_FAILURE;
2505
2506 pMeasReq->measDuration.shortTermPeriod = limGetU32(pBuf);
2507 pBuf += sizeof(tANI_U32);
2508
2509 pMeasReq->measDuration.averagingPeriod = limGetU32(pBuf);
2510 pBuf += sizeof(tANI_U32);
2511
2512 pMeasReq->measDuration.shortChannelScanDuration = limGetU32(pBuf);
2513 pBuf += sizeof(tANI_U32);
2514
2515 pMeasReq->measDuration.longChannelScanDuration = limGetU32(pBuf);
2516 pBuf += sizeof(tANI_U32);
2517
2518 len -= sizeof(tSirMeasDuration);
2519 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2520 return eSIR_FAILURE;
2521
2522 pMeasReq->measIndPeriod = limGetU32(pBuf);
2523
2524 pBuf += sizeof(tANI_U32);
2525 len -= sizeof(tANI_U32);
2526 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2527 return eSIR_FAILURE;
2528
2529 pMeasReq->channelList.numChannels = *pBuf++;
2530 palCopyMemory( pMac->hHdd, (tANI_U8 *) pMeasReq->channelList.channelNumber,
2531 pBuf, pMeasReq->channelList.numChannels);
2532
2533 return eSIR_SUCCESS;
2534} /*** end limMeasurementReqSerDes() ***/
2535
2536
2537/**
2538 * limWdsReqSerDes()
2539 *
2540 *FUNCTION:
2541 * This function is called by limProcessLmmMessages() when
2542 * SME_SET_WDS_INFO_REQ message is received from upper layer software.
2543 *
2544 *PARAMS:
2545 *
2546 *LOGIC:
2547 *
2548 *ASSUMPTIONS:
2549 * NA
2550 *
2551 *NOTE:
2552 * NA
2553 *
2554 * @param pWdsInfo Pointer to tSirWdsInfo being extracted into
2555 * @param pBuf Pointer to serialized buffer
2556 * @return retCode Indicates whether message is successfully
2557 * de-serialized (eSIR_SUCCESS) or
2558 * not (eSIR_FAILURE)
2559 */
2560
2561tSirRetStatus
2562limWdsReqSerDes(tpAniSirGlobal pMac, tpSirSmeSetWdsInfoReq pWdsInfoReq, tANI_U8 *pBuf)
2563{
2564 tANI_S16 len = 0;
2565 PELOG1(tANI_U8 *pTemp = pBuf;)
2566
2567 if (!pWdsInfoReq || !pBuf)
2568 return eSIR_FAILURE;
2569
2570 // Extract messageType
2571 pWdsInfoReq->messageType = limGetU16(pBuf);
2572 pBuf += sizeof(tANI_U16);
2573
2574 // Extract length
2575 len = pWdsInfoReq->length = limGetU16(pBuf);
2576 pBuf += sizeof(tANI_U16);
2577
2578 PELOG1(limLog(pMac, LOG1, FL("SME_SET_WDS_INFO_REQ length %d bytes is:\n"), len);)
2579 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2580
2581 if (len < (tANI_S16) sizeof(tANI_U32))
2582 return eSIR_FAILURE;
2583
2584 len -= sizeof(tANI_U32); // skip message header
2585
2586 // Extract transactionId
2587 pWdsInfoReq->transactionId = limGetU16(pBuf);
2588 pBuf += sizeof(tANI_U16);
2589 len -= sizeof(tANI_U16);
2590
2591 // Extract wdsInfo
2592 pWdsInfoReq->wdsInfo.wdsLength = limGetU16(pBuf);
2593 len -= sizeof(tANI_U16);
2594 pBuf += sizeof(tANI_U16);
2595
2596 if (pWdsInfoReq->wdsInfo.wdsLength > ANI_WDS_INFO_MAX_LENGTH)
2597 return eSIR_FAILURE;
2598
2599 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2600 return eSIR_FAILURE;
2601
2602 palCopyMemory( pMac->hHdd, (tANI_U8 *) pWdsInfoReq->wdsInfo.wdsBytes,
2603 pBuf,
2604 pWdsInfoReq->wdsInfo.wdsLength);
2605
2606 return eSIR_SUCCESS;
2607
2608} /*** end limWdsReqSerDes() ***/
2609
2610
2611/**
2612 * limMeasurementIndSerDes()
2613 *
2614 *FUNCTION:
2615 * This function is called by limSendMeasurementInd() while
2616 * sending SME_MEASUREMENT_IND message to WSM.
2617 *
2618 *LOGIC:
2619 *
2620 *ASSUMPTIONS:
2621 *
2622 *NOTE:
2623 *
2624 * @param pMac - Pointer to Global MAC structure
2625 * @param pMeasInd - Pointer to prepared MEASUREMENT_IND message
2626 * @return None
2627 */
2628
2629void
2630limMeasurementIndSerDes(tpAniSirGlobal pMac, tANI_U8 *pBuf)
2631{
2632 tANI_U8 *pLen;
2633 tANI_U16 len = 0, infoLen = 0;
2634 tSirLoad load;
2635 PELOG3(tANI_U8 *pTemp = pBuf;)
2636
2637 limCopyU16(pBuf, eWNI_SME_MEASUREMENT_IND);
2638 pBuf += sizeof(tANI_U16);
2639
2640 pLen = pBuf;
2641 pBuf += sizeof(tANI_U16);
2642
2643 limCopyU32(pBuf, pMac->lim.gpLimMeasData->duration);
2644 pBuf += sizeof(tANI_U32);
2645 len += sizeof(tANI_U32);
2646
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002647 load.numStas = peGetCurrentSTAsCount(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002648 load.channelUtilization =
2649 pMac->lim.gpLimMeasData->avgChannelUtilization;
2650 limCopyLoad(pBuf, load);
2651 pBuf += sizeof(tSirLoad);
2652 len += sizeof(tSirLoad);
2653
2654 infoLen = limCopyMeasMatrixList(pMac, pBuf);
2655 pBuf += infoLen;
2656 len += infoLen;
2657
2658 infoLen = limCopyNeighborWdsList(pMac, pBuf);
2659 pBuf += infoLen;
2660 len += infoLen;
2661
2662 limCopyU16(pLen, len+4);
2663
2664 PELOG3(limLog(pMac, LOG3, FL("Sending MEAS_IND length %d bytes:\n"), len);
2665 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
2666} /*** end limMeasurementIndSerDes() ***/
2667#endif
2668
2669
2670/**---------------------------------------------------------------
2671\fn limReassocIndSerDes
2672\brief This function is called by limProcessMlmReassocInd() to
2673\ populate the SME_REASSOC_IND message based on the received
2674\ MLM_REASSOC_IND.
2675\
2676\param pMac
2677\param pReassocInd - Pointer to the received tLimMlmReassocInd
2678\param pBuf - Pointer to serialized buffer
2679\param psessionEntry - pointer to PE session entry
2680\
2681\return None
2682------------------------------------------------------------------*/
2683void
2684limReassocIndSerDes(tpAniSirGlobal pMac, tpLimMlmReassocInd pReassocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
2685{
2686 tANI_U8 *pLen = pBuf;
2687 tANI_U16 mLen = 0;
2688
2689#ifdef PE_DEBUG_LOG1
2690 tANI_U8 *pTemp = pBuf;
2691#endif
2692
2693#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
2694 tANI_U32 len = 0;
2695#endif
2696
2697 mLen = sizeof(tANI_U32);
2698 pBuf += sizeof(tANI_U16);
2699 *pBuf++ = psessionEntry->smeSessionId;
2700 mLen += sizeof(tANI_U8);
2701
2702 // Fill in peerMacAddr
2703 palCopyMemory( pMac->hHdd, pBuf, pReassocInd->peerMacAddr, sizeof(tSirMacAddr));
2704 pBuf += sizeof(tSirMacAddr);
2705 mLen += sizeof(tSirMacAddr);
2706
2707 // Fill in oldMacAddr
2708 palCopyMemory( pMac->hHdd, pBuf, pReassocInd->currentApAddr, sizeof(tSirMacAddr));
2709 pBuf += sizeof(tSirMacAddr);
2710 mLen += sizeof(tSirMacAddr);
2711
2712 // Fill in aid
2713 limCopyU16(pBuf, pReassocInd->aid);
2714 pBuf += sizeof(tANI_U16);
2715 mLen += sizeof(tANI_U16);
2716
2717 // Fill in bssId
2718 palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
2719 pBuf += sizeof(tSirMacAddr);
2720 mLen += sizeof(tSirMacAddr);
2721
2722 // Fill in staId
2723 limCopyU16(pBuf, psessionEntry->staId);
2724 pBuf += sizeof(tANI_U16);
2725 mLen += sizeof(tANI_U16);
2726
2727 // Fill in authType
2728 limCopyU32(pBuf, pReassocInd->authType);
2729 pBuf += sizeof(tAniAuthType);
2730 mLen += sizeof(tAniAuthType);
2731
2732 // Fill in ssId
2733 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pReassocInd->ssId),
2734 pReassocInd->ssId.length + 1);
2735 pBuf += 1 + pReassocInd->ssId.length;
2736 mLen += pReassocInd->ssId.length + 1;
2737
2738 // Fill in rsnIE
2739 limCopyU16(pBuf, pReassocInd->rsnIE.length);
2740 pBuf += sizeof(tANI_U16);
2741 mLen += sizeof(tANI_U16);
2742 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pReassocInd->rsnIE.rsnIEdata),
2743 pReassocInd->rsnIE.length);
2744 pBuf += pReassocInd->rsnIE.length;
2745 mLen += pReassocInd->rsnIE.length;
2746
2747 // Fill in addIE
2748 limCopyU16(pBuf, pReassocInd->addIE.length);
2749 pBuf += sizeof(tANI_U16);
2750 mLen += sizeof(tANI_U16);
2751 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8*) &(pReassocInd->addIE.addIEdata),
2752 pReassocInd->addIE.length);
2753 pBuf += pReassocInd->addIE.length;
2754 mLen += pReassocInd->addIE.length;
2755
2756#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
2757
2758 limCopyU16(pBuf, pReassocInd->seqNum);
2759 pBuf += sizeof(tANI_U16);
2760 mLen += sizeof(tANI_U16);
2761
2762 limCopyU32(pBuf, pReassocInd->wniIndicator);
2763 pBuf += sizeof(tAniBool);
2764 mLen += sizeof(tAniBool);
2765
2766 limCopyU32(pBuf, pReassocInd->bpIndicator);
2767 pBuf += sizeof(tAniBool);
2768 mLen += sizeof(tAniBool);
2769
2770 limCopyU32(pBuf, pReassocInd->bpType);
2771 pBuf += sizeof(tSirBpIndicatorType);
2772 mLen += sizeof(tSirBpIndicatorType);
2773
2774 limCopyU32(pBuf, pReassocInd->reassocType);
2775 pBuf += sizeof(tSirAssocType);
2776 mLen += sizeof(tSirAssocType);
2777
2778 limCopyLoad(pBuf, pReassocInd->load);
2779 pBuf += sizeof(tSirLoad);
2780 mLen += sizeof(tSirLoad);
2781
2782 limCopyU32(pBuf, pReassocInd->numBss);
2783 pBuf += sizeof(tANI_U32);
2784 mLen += sizeof(tANI_U32);
2785
2786 if (pReassocInd->numBss)
2787 {
2788 len = limCopyNeighborList(pMac,
2789 pBuf,
2790 pReassocInd->neighborList, pReassocInd->numBss);
2791 pBuf += len;
2792 mLen += (tANI_U16) len;
2793 }
2794
2795 // place holder to capability and nwType
2796 limCopyU16(pBuf, *(tANI_U16 *)&pReassocInd->capabilityInfo);
2797 pBuf += sizeof(tANI_U16); // capabilityInfo
2798 mLen += sizeof(tANI_U16);
2799
2800 limCopyU32(pBuf, *(tANI_U32 *)&pReassocInd->nwType);
2801 pBuf += sizeof(tANI_U32); // nwType
2802 mLen += sizeof(tANI_U32);
2803#endif
2804
Jeff Johnson295189b2012-06-20 16:38:30 -07002805 limCopyU32(pBuf, pReassocInd->spectrumMgtIndicator);
2806 pBuf += sizeof(tAniBool);
2807 mLen += sizeof(tAniBool);
2808
2809 if (pReassocInd->spectrumMgtIndicator == eSIR_TRUE)
2810 {
2811 *pBuf = pReassocInd->powerCap.minTxPower;
2812 pBuf++;
2813 *pBuf = pReassocInd->powerCap.maxTxPower;
2814 pBuf++;
2815 mLen += sizeof(tSirMacPowerCapInfo);
2816
2817 *pBuf = pReassocInd->supportedChannels.numChnl;
2818 pBuf++;
2819 mLen++;
2820
2821 palCopyMemory( pMac->hHdd, pBuf,
2822 (tANI_U8 *) &(pReassocInd->supportedChannels.channelList),
2823 pReassocInd->supportedChannels.numChnl);
2824
2825 pBuf += pReassocInd->supportedChannels.numChnl;
2826 mLen += pReassocInd->supportedChannels.numChnl;
2827 }
2828#ifdef WLAN_SOFTAP_FEATURE
2829 limCopyU32(pBuf, pReassocInd->WmmStaInfoPresent);
2830 pBuf += sizeof(tANI_U32);
2831 mLen += sizeof(tANI_U32);
2832#endif
2833
2834 // Fill in length of SME_REASSOC_IND message
2835 limCopyU16(pLen, mLen);
2836
2837 PELOG1(limLog(pMac, LOG1, FL("Sending SME_REASSOC_IND length %d bytes:\n"), mLen);)
2838 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
2839} /*** end limReassocIndSerDes() ***/
2840
2841
2842/**
2843 * limAuthIndSerDes()
2844 *
2845 *FUNCTION:
2846 * This function is called by limProcessMlmAuthInd() while sending
2847 * SME_AUTH_IND to host
2848 *
2849 *PARAMS:
2850 *
2851 *LOGIC:
2852 *
2853 *ASSUMPTIONS:
2854 * NA
2855 *
2856 *NOTE:
2857 * NA
2858 *
2859 * @param pAuthInd Pointer to tSirSmeAuthInd being sent
2860 * @param pBuf Pointer to serialized buffer
2861 *
2862 * @return None
2863 */
2864
2865void
2866limAuthIndSerDes(tpAniSirGlobal pMac, tpLimMlmAuthInd pAuthInd, tANI_U8 *pBuf)
2867{
2868 tANI_U8 *pLen = pBuf;
2869 tANI_U16 mLen = 0;
2870
2871#ifdef PE_DEBUG_LOG1
2872 tANI_U8 *pTemp = pBuf;
2873#endif
2874
2875 mLen = sizeof(tANI_U32);
2876 pBuf += sizeof(tANI_U16);
2877 *pBuf++ = pAuthInd->sessionId;
2878 mLen += sizeof(tANI_U8);
2879
2880 // BTAMP TODO: Fill in bssId
2881 palZeroMemory(pMac->hHdd, pBuf, sizeof(tSirMacAddr));
2882 pBuf += sizeof(tSirMacAddr);
2883 mLen += sizeof(tSirMacAddr);
2884
2885 palCopyMemory( pMac->hHdd, pBuf, pAuthInd->peerMacAddr, sizeof(tSirMacAddr));
2886 pBuf += sizeof(tSirMacAddr);
2887 mLen += sizeof(tSirMacAddr);
2888
2889 limCopyU32(pBuf, pAuthInd->authType);
2890 pBuf += sizeof(tAniAuthType);
2891 mLen += sizeof(tAniAuthType);
2892
2893 limCopyU16(pLen, mLen);
2894
2895 PELOG1(limLog(pMac, LOG1, FL("Sending SME_AUTH_IND length %d bytes:\n"), mLen);)
2896 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
2897} /*** end limAuthIndSerDes() ***/
2898
2899
2900
2901/**
2902 * limSetContextReqSerDes()
2903 *
2904 *FUNCTION:
2905 * This function is called by limProcessSmeMessages() upon receiving
2906 * SME_SETCONTEXT_REQ from host
2907 *
2908 *PARAMS:
2909 *
2910 *LOGIC:
2911 *
2912 *ASSUMPTIONS:
2913 * NA
2914 *
2915 *NOTE:
2916 * NA
2917 *
2918 * @param pSetContextReq Pointer to tSirSmeSetContextReq being
2919 * extracted
2920 * @param pBuf Pointer to serialized buffer
2921 *
2922 * @return retCode Indicates whether message is successfully
2923 * de-serialized (eSIR_SUCCESS) or
2924 * not (eSIR_FAILURE)
2925 */
2926
2927tSirRetStatus
2928limSetContextReqSerDes(tpAniSirGlobal pMac, tpSirSmeSetContextReq pSetContextReq, tANI_U8 *pBuf)
2929{
2930 tANI_S16 len = 0;
2931 tANI_U16 totalKeySize = sizeof(tANI_U8); // initialized to sizeof numKeys
2932 tANI_U8 numKeys;
2933 tANI_U8 *pKeys;
2934
2935#ifdef PE_DEBUG_LOG1
2936 tANI_U8 *pTemp = pBuf;
2937#endif
2938 if (!pSetContextReq || !pBuf)
2939 return eSIR_FAILURE;
2940
2941 pSetContextReq->messageType = limGetU16(pBuf);
2942 pBuf += sizeof(tANI_U16);
2943
2944 len = pSetContextReq->length = limGetU16(pBuf);
2945 pBuf += sizeof(tANI_U16);
2946
2947 PELOG1(limLog(pMac, LOG1, FL("SME_SETCONTEXT_REQ length %d bytes is:\n"), len);)
2948 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
2949
2950 if (len < (tANI_S16) sizeof(tANI_U32))
2951 return eSIR_FAILURE;
2952
2953 len -= sizeof(tANI_U32); // skip message header
2954 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2955 return eSIR_FAILURE;
2956
2957 // Extract sessionId
2958 pSetContextReq->sessionId = *pBuf++;
2959 len--;
2960 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2961 return eSIR_FAILURE;
2962
2963 // Extract transactionId
2964 pSetContextReq->transactionId = sirReadU16N(pBuf);
2965 pBuf += sizeof(tANI_U16);
2966 len -= sizeof(tANI_U16);
2967 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2968 return eSIR_FAILURE;
2969 palCopyMemory( pMac->hHdd, (tANI_U8 *) pSetContextReq->peerMacAddr,
2970 pBuf, sizeof(tSirMacAddr));
2971 pBuf += sizeof(tSirMacAddr);
2972 len -= sizeof(tSirMacAddr);
2973 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2974 return eSIR_FAILURE;
2975 palCopyMemory( pMac->hHdd, pSetContextReq->bssId, pBuf, sizeof(tSirMacAddr));
2976 pBuf += sizeof(tSirMacAddr);
2977 len -= sizeof(tSirMacAddr);
2978 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2979 return eSIR_FAILURE;
2980
2981#if defined(ANI_PRODUCT_TYPE_AP)
2982 pSetContextReq->aid = limGetU16(pBuf);
2983 pBuf += sizeof(tANI_U16);
2984 len -= sizeof(tANI_U16);
2985 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2986 return eSIR_FAILURE;
2987#endif
2988
2989// pSetContextReq->qosInfoPresent = limGetU32(pBuf);
2990// pBuf += sizeof(tAniBool);
2991
2992// if (pSetContextReq->qosInfoPresent)
2993// {
2994// len = limGetQosInfo(&pSetContextReq->qos, pBuf);
2995// pBuf += len;
2996// }
2997
2998 pSetContextReq->keyMaterial.length = limGetU16(pBuf);
2999 pBuf += sizeof(tANI_U16);
3000 len -= sizeof(tANI_U16);
3001 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3002 return eSIR_FAILURE;
3003
3004 pSetContextReq->keyMaterial.edType = (tAniEdType) limGetU32(pBuf);
3005 pBuf += sizeof(tAniEdType);
3006 len -= sizeof(tAniEdType);
3007 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3008 return eSIR_FAILURE;
3009
3010 numKeys = pSetContextReq->keyMaterial.numKeys = *pBuf++;
3011 len -= sizeof(numKeys);
3012
3013 if (numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3014 return eSIR_FAILURE;
3015
3016 /** Initialize the Default Keys if no Keys are being sent from the upper layer*/
3017 if( limCheckRemainingLength(pMac, len) == eSIR_FAILURE) {
3018 tpSirKeys pKeyinfo = pSetContextReq->keyMaterial.key;
3019
3020 pKeyinfo->keyId = 0;
3021 pKeyinfo->keyDirection = eSIR_TX_RX;
3022 pKeyinfo->keyLength = 0;
3023
3024 if (!limIsAddrBC(pSetContextReq->peerMacAddr))
3025 pKeyinfo->unicast = 1;
3026 else
3027 pKeyinfo->unicast = 0;
3028 }else {
3029 pKeys = (tANI_U8 *) pSetContextReq->keyMaterial.key;
3030 do {
3031 tANI_U32 keySize = limGetKeysInfo(pMac, (tpSirKeys) pKeys,
3032 pBuf);
3033 pBuf += keySize;
3034 pKeys += sizeof(tSirKeys);
3035 totalKeySize += (tANI_U16) keySize;
3036 if (numKeys == 0)
3037 break;
3038 numKeys--;
3039 }while (numKeys);
3040 }
3041 return eSIR_SUCCESS;
3042} /*** end limSetContextReqSerDes() ***/
3043
3044/**
3045 * limRemoveKeyReqSerDes()
3046 *
3047 *FUNCTION:
3048 * This function is called by limProcessSmeMessages() upon receiving
3049 * SME_REMOVEKEY_REQ from host
3050 *
3051 *PARAMS:
3052 *
3053 *LOGIC:
3054 *
3055 *ASSUMPTIONS:
3056 * NA
3057 *
3058 *NOTE:
3059 * NA
3060 *
3061 * @param pRemoveKeyReq Pointer to tSirSmeRemoveKeyReq being
3062 * extracted
3063 * @param pBuf Pointer to serialized buffer
3064 *
3065 * @return retCode Indicates whether message is successfully
3066 * de-serialized (eSIR_SUCCESS) or
3067 * not (eSIR_FAILURE)
3068 */
3069
3070tSirRetStatus
3071limRemoveKeyReqSerDes(tpAniSirGlobal pMac, tpSirSmeRemoveKeyReq pRemoveKeyReq, tANI_U8 *pBuf)
3072{
3073 tANI_S16 len = 0;
3074
3075#ifdef PE_DEBUG_LOG1
3076 tANI_U8 *pTemp = pBuf;
3077#endif
3078 if (!pRemoveKeyReq || !pBuf)
3079 return eSIR_FAILURE;
3080
3081 pRemoveKeyReq->messageType = limGetU16(pBuf);
3082 pBuf += sizeof(tANI_U16);
3083
3084 len = pRemoveKeyReq->length = limGetU16(pBuf);
3085 pBuf += sizeof(tANI_U16);
3086
3087 PELOG1(limLog(pMac, LOG1, FL("SME_REMOVEKEY_REQ length %d bytes is:\n"), len);)
3088 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
3089
3090 if (len < (tANI_S16) sizeof(tANI_U32))
3091 return eSIR_FAILURE;
3092
3093 len -= sizeof(tANI_U32); // skip message header
3094 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3095 return eSIR_FAILURE;
3096
3097 palCopyMemory( pMac->hHdd, (tANI_U8 *) pRemoveKeyReq->peerMacAddr,
3098 pBuf, sizeof(tSirMacAddr));
3099 pBuf += sizeof(tSirMacAddr);
3100 len -= sizeof(tSirMacAddr);
3101 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3102 return eSIR_FAILURE;
3103
3104#if defined(ANI_PRODUCT_TYPE_AP)
3105 pRemoveKeyReq->aid = limGetU16(pBuf);
3106 pBuf += sizeof(tANI_U16);
3107 len -= sizeof(tANI_U16);
3108 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3109 return eSIR_FAILURE;
3110#endif
3111
3112 pRemoveKeyReq->edType = *pBuf;
3113 pBuf += sizeof(tANI_U8);
3114 len -= sizeof(tANI_U8);
3115 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3116 return eSIR_FAILURE;
3117
3118 pRemoveKeyReq->wepType = *pBuf;
3119
3120 pBuf += sizeof(tANI_U8);
3121 len -= sizeof(tANI_U8);
3122 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3123 return eSIR_FAILURE;
3124
3125 pRemoveKeyReq->keyId = *pBuf;
3126
3127 pBuf += sizeof(tANI_U8);
3128 len -= sizeof(tANI_U8);
3129 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3130 return eSIR_FAILURE;
3131
3132 pRemoveKeyReq->unicast = *pBuf;
3133 len--;
3134 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3135 return eSIR_FAILURE;
3136
3137 // Extract bssId
3138 palCopyMemory( pMac->hHdd, pRemoveKeyReq->bssId, pBuf, sizeof(tSirMacAddr));
3139 pBuf += sizeof(tSirMacAddr);
3140 len -= sizeof(tSirMacAddr);
3141 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3142 return eSIR_FAILURE;
3143
3144 // Extract sessionId
3145 pRemoveKeyReq->sessionId = *pBuf++;
3146 len--;
3147 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3148 return eSIR_FAILURE;
3149
3150 // Extract transactionId
3151 pRemoveKeyReq->transactionId = sirReadU16N(pBuf);
3152 pBuf += sizeof(tANI_U16);
3153 len -= sizeof(tANI_U16);
3154 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3155 return eSIR_FAILURE;
3156
3157 return eSIR_SUCCESS;
3158} /*** end limRemoveKeyReqSerDes() ***/
3159
3160
3161
3162/**
3163 * limDisassocReqSerDes()
3164 *
3165 *FUNCTION:
3166 * This function is called by limProcessSmeMessages() upon receiving
3167 * SME_DISASSOC_REQ from host
3168 *
3169 *PARAMS:
3170 *
3171 *LOGIC:
3172 *
3173 *ASSUMPTIONS:
3174 * NA
3175 *
3176 *NOTE:
3177 * NA
3178 *
3179 * @param pDisassocReq Pointer to tSirSmeDisassocReq being extracted
3180 * @param pBuf Pointer to serialized buffer
3181 *
3182 * @return retCode Indicates whether message is successfully
3183 * de-serialized (eSIR_SUCCESS) or
3184 * not (eSIR_FAILURE)
3185 */
3186
3187tSirRetStatus
3188limDisassocReqSerDes(tpAniSirGlobal pMac, tSirSmeDisassocReq *pDisassocReq, tANI_U8 *pBuf)
3189{
3190 tANI_S16 len = 0;
3191#ifdef PE_DEBUG_LOG1
3192 tANI_U8 *pTemp = pBuf;
3193#endif
3194
3195 if (!pDisassocReq || !pBuf)
3196 return eSIR_FAILURE;
3197
3198 pDisassocReq->messageType = limGetU16(pBuf);
3199 pBuf += sizeof(tANI_U16);
3200
3201 len = pDisassocReq->length = limGetU16(pBuf);
3202 pBuf += sizeof(tANI_U16);
3203
3204 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_REQ length %d bytes is:\n"), len);)
3205 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
3206
3207 if (len < (tANI_S16) sizeof(tANI_U32))
3208 return eSIR_FAILURE;
3209
3210 len -= sizeof(tANI_U32); // skip message header
3211 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3212 return eSIR_FAILURE;
3213
3214 // Extract sessionID
3215 pDisassocReq->sessionId = *pBuf;
3216 pBuf += sizeof(tANI_U8);
3217 len -= sizeof(tANI_U8);
3218 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3219 return eSIR_FAILURE;
3220
3221 // Extract transactionid
3222 pDisassocReq->transactionId = limGetU16(pBuf);
3223 pBuf += sizeof(tANI_U16);
3224 len -= sizeof(tANI_U16);
3225 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3226 return eSIR_FAILURE;
3227
3228 // Extract bssId
3229 palCopyMemory( pMac->hHdd, (tANI_U8 *) pDisassocReq->bssId, pBuf, sizeof(tSirMacAddr));
3230 pBuf += sizeof(tSirMacAddr);
3231 len -= sizeof(tSirMacAddr);
3232 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3233 return eSIR_FAILURE;
3234
3235 // Extract peerMacAddr
3236 palCopyMemory( pMac->hHdd, pDisassocReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
3237 pBuf += sizeof(tSirMacAddr);
3238 len -= sizeof(tSirMacAddr);
3239 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3240 return eSIR_FAILURE;
3241
3242 // Extract reasonCode
3243 pDisassocReq->reasonCode = limGetU16(pBuf);
3244 pBuf += sizeof(tANI_U16);
3245 len -= sizeof(tANI_U16);
3246 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3247 return eSIR_FAILURE;
3248
3249 pDisassocReq->doNotSendOverTheAir = *pBuf;
3250 pBuf += sizeof(tANI_U8);
3251 len -= sizeof(tANI_U8);
3252
3253#if defined(ANI_PRODUCT_TYPE_AP)
3254 pDisassocReq->aid = limGetU16(pBuf);
3255 pBuf += sizeof(tANI_U16);
3256 len -= sizeof(tANI_U16);
3257 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3258 return eSIR_FAILURE;
3259
3260#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
3261 pDisassocReq->seqNum = limGetU16(pBuf);
3262#endif
3263#endif
3264
3265 return eSIR_SUCCESS;
3266} /*** end limDisassocReqSerDes() ***/
3267
3268
3269
3270/**
3271 * limDeauthReqSerDes()
3272 *
3273 *FUNCTION:
3274 * This function is called by limProcessSmeMessages() upon receiving
3275 * SME_DEAUTH_REQ from host
3276 *
3277 *PARAMS:
3278 *
3279 *LOGIC:
3280 *
3281 *ASSUMPTIONS:
3282 * NA
3283 *
3284 *NOTE:
3285 * NA
3286 *
3287 * @param pDeauthReq Pointer to tSirSmeDeauthReq being extracted
3288 * @param pBuf Pointer to serialized buffer
3289 *
3290 * @return retCode Indicates whether message is successfully
3291 * de-serialized (eSIR_SUCCESS) or
3292 * not (eSIR_FAILURE)
3293 */
3294tSirRetStatus
3295limDeauthReqSerDes(tpAniSirGlobal pMac, tSirSmeDeauthReq *pDeauthReq, tANI_U8 *pBuf)
3296{
3297 tANI_S16 len = 0;
3298
3299#ifdef PE_DEBUG_LOG1
3300 tANI_U8 *pTemp = pBuf;
3301#endif
3302
3303 if (!pDeauthReq || !pBuf)
3304 return eSIR_FAILURE;
3305
3306 pDeauthReq->messageType = limGetU16(pBuf);
3307 pBuf += sizeof(tANI_U16);
3308
3309 len = pDeauthReq->length = limGetU16(pBuf);
3310 pBuf += sizeof(tANI_U16);
3311
3312 PELOG1(limLog(pMac, LOG1, FL("SME_DEAUTH_REQ length %d bytes is:\n"), len);)
3313 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
3314
3315 if (len < (tANI_S16) sizeof(tANI_U32))
3316 return eSIR_FAILURE;
3317
3318 len -= sizeof(tANI_U32); // skip message header
3319 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3320 return eSIR_FAILURE;
3321
3322 // Extract sessionId
3323 pDeauthReq->sessionId = *pBuf++;
3324 len--;
3325 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3326 return eSIR_FAILURE;
3327
3328 // Extract transactionId
3329 pDeauthReq->transactionId = limGetU16(pBuf);
3330 pBuf += sizeof(tANI_U16);
3331 len -= sizeof(tANI_U16);
3332 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3333 return eSIR_FAILURE;
3334
3335 // Extract bssId
3336 palCopyMemory( pMac->hHdd, pDeauthReq->bssId, pBuf, sizeof(tSirMacAddr));
3337 pBuf += sizeof(tSirMacAddr);
3338 len -= sizeof(tSirMacAddr);
3339 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3340 return eSIR_FAILURE;
3341
3342 // Extract peerMacAddr
3343 palCopyMemory( pMac->hHdd, pDeauthReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
3344 pBuf += sizeof(tSirMacAddr);
3345 len -= sizeof(tSirMacAddr);
3346 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3347 return eSIR_FAILURE;
3348
3349 // Extract reasonCode
3350 pDeauthReq->reasonCode = limGetU16(pBuf);
3351 pBuf += sizeof(tANI_U16);
3352 len -= sizeof(tANI_U16);
3353
3354#if defined(ANI_PRODUCT_TYPE_AP)
3355 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3356 return eSIR_FAILURE;
3357 pDeauthReq->aid = limGetU16(pBuf);
3358#endif
3359
3360 return eSIR_SUCCESS;
3361} /*** end limDisassocReqSerDes() ***/
3362
3363
3364
3365
3366#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
3367/**
3368 * limCopyNeighborInfoToCfg()
3369 *
3370 *FUNCTION:
3371 * This function is called by limProcessSmeMessages() upon receiving
3372 * SME_JOIN_REQ/SME_REASSOC_REQ from WSM to convert neighborBssInfo
3373 * that is being joined to bssDescription used by MLM
3374 *
3375 *PARAMS:
3376 *
3377 *LOGIC:
3378 *
3379 *ASSUMPTIONS:
3380 * NA
3381 *
3382 *NOTE:
3383 * NA
3384 *
3385 * @param neighborBssInfo Neighbor BSS info to be converted
3386 *
3387 * @return None
3388 */
3389
3390void
3391limCopyNeighborInfoToCfg(tpAniSirGlobal pMac, tSirNeighborBssInfo neighborBssInfo, tpPESession psessionEntry)
3392{
3393 tANI_U32 localPowerConstraints = 0;
3394 tANI_U16 caps;
3395 tANI_U8 qosCap = 0;
3396
3397 if(psessionEntry)
3398 {
3399 psessionEntry->gLimPhyMode = neighborBssInfo.nwType;
3400 }
3401 else
3402 {
3403 pMac->lim.gLimPhyMode = neighborBssInfo.nwType;
3404 }
3405
3406 cfgSetCapabilityInfo(pMac, neighborBssInfo.capabilityInfo);
3407
3408 if (cfgSetStr(pMac, WNI_CFG_SSID, (tANI_U8 *) &neighborBssInfo.ssId.ssId,
3409 neighborBssInfo.ssId.length) != eSIR_SUCCESS)
3410 {
3411 /// Could not update SSID at CFG. Log error.
3412 limLog(pMac, LOGP, FL("could not update SSID at CFG\n"));
3413 }
3414
3415 #if 0
3416 if (cfgSetStr(
3417 pMac, WNI_CFG_OPERATIONAL_RATE_SET,
3418 (tANI_U8 *) &neighborBssInfo.operationalRateSet.rate,
3419 neighborBssInfo.operationalRateSet.numRates) != eSIR_SUCCESS)
3420 {
3421 /// Could not update Operational Rateset at CFG. Log error.
3422 limLog(pMac, LOGP,
3423 FL("could not update Operational Rateset at CFG\n"));
3424 }
3425 #endif // TO SUPPORT BT-AMP
3426
3427 if (neighborBssInfo.nwType == WNI_CFG_PHY_MODE_11G)
3428 {
3429 if (cfgSetStr(
3430 pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
3431 (tANI_U8 *) &neighborBssInfo.extendedRateSet.rate,
3432 neighborBssInfo.extendedRateSet.numRates) != eSIR_SUCCESS)
3433 {
3434 /// Could not update Extended Rateset at CFG. Log error.
3435 limLog(pMac, LOGP,
3436 FL("could not update Extended Rateset at CFG\n"));
3437 }
3438 }
3439#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
3440 if (neighborBssInfo.hcfEnabled)
3441 LIM_BSS_CAPS_SET(HCF, qosCap);
3442#endif
3443 if (neighborBssInfo.wmeInfoPresent || neighborBssInfo.wmeEdcaPresent)
3444 LIM_BSS_CAPS_SET(WME, qosCap);
3445 if (LIM_BSS_CAPS_GET(WME, qosCap) && neighborBssInfo.wsmCapablePresent)
3446 LIM_BSS_CAPS_SET(WSM, qosCap);
3447
3448 pMac->lim.gLimCurrentBssQosCaps = qosCap;
3449
3450 if (neighborBssInfo.wniIndicator)
3451 pMac->lim.gLimCurrentBssPropCap = neighborBssInfo.propIECapability;
3452 else
3453 pMac->lim.gLimCurrentBssPropCap = 0;
3454
3455 if (neighborBssInfo.HTCapsPresent)
3456 pMac->lim.htCapabilityPresentInBeacon = 1;
3457 else
3458 pMac->lim.htCapabilityPresentInBeacon = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07003459 if (neighborBssInfo.localPowerConstraints && pSessionEntry->lim11hEnable)
Jeff Johnson295189b2012-06-20 16:38:30 -07003460 {
3461 localPowerConstraints = neighborBssInfo.localPowerConstraints;
3462 }
3463 if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, localPowerConstraints) != eSIR_SUCCESS)
3464 {
3465 limLog(pMac, LOGP, FL("Could not update local power constraint to cfg.\n"));
3466 }
3467} /*** end limCopyNeighborInfoToCfg() ***/
3468#endif
3469
3470
3471/**
3472 * limStatSerDes()
3473 *
3474 *FUNCTION:
3475 * This function is called by limSendSmeDisassocNtf() while sending
3476 * SME_DISASSOC_IND/eWNI_SME_DISASSOC_RSP to host
3477 *
3478 *PARAMS:
3479 *
3480 *LOGIC:
3481 *
3482 *ASSUMPTIONS:
3483 * NA
3484 *
3485 *NOTE:
3486 * NA
3487 *
3488 * @param pAssocInd Pointer to tpAniStaStatStruct being sent
3489 * @param pBuf Pointer to serialized buffer
3490 *
3491 * @return None
3492 */
3493
3494void
3495limStatSerDes(tpAniSirGlobal pMac, tpAniStaStatStruct pStat, tANI_U8 *pBuf)
3496{
3497#ifdef PE_DEBUG_LOG1
3498 tANI_U8 *pTemp = pBuf;
3499#endif
3500
3501 limCopyU32(pBuf, pStat->sentAesBlksUcastHi);
3502 pBuf += sizeof(tANI_U32);
3503
3504 limCopyU32(pBuf, pStat->sentAesBlksUcastLo);
3505 pBuf += sizeof(tANI_U32);
3506
3507 limCopyU32(pBuf, pStat->recvAesBlksUcastHi);
3508 pBuf += sizeof(tANI_U32);
3509
3510 limCopyU32(pBuf, pStat->recvAesBlksUcastLo);
3511 pBuf += sizeof(tANI_U32);
3512
3513 limCopyU32(pBuf, pStat->aesFormatErrorUcastCnts);
3514 pBuf += sizeof(tANI_U32);
3515
3516 limCopyU32(pBuf, pStat->aesReplaysUcast);
3517 pBuf += sizeof(tANI_U32);
3518
3519 limCopyU32(pBuf, pStat->aesDecryptErrUcast);
3520 pBuf += sizeof(tANI_U32);
3521
3522 limCopyU32(pBuf, pStat->singleRetryPkts);
3523 pBuf += sizeof(tANI_U32);
3524
3525 limCopyU32(pBuf, pStat->failedTxPkts);
3526 pBuf += sizeof(tANI_U32);
3527
3528 limCopyU32(pBuf, pStat->ackTimeouts);
3529 pBuf += sizeof(tANI_U32);
3530
3531 limCopyU32(pBuf, pStat->multiRetryPkts);
3532 pBuf += sizeof(tANI_U32);
3533
3534 limCopyU32(pBuf, pStat->fragTxCntsHi);
3535 pBuf += sizeof(tANI_U32);
3536
3537 limCopyU32(pBuf, pStat->fragTxCntsLo);
3538 pBuf += sizeof(tANI_U32);
3539
3540 limCopyU32(pBuf, pStat->transmittedPktsHi);
3541 pBuf += sizeof(tANI_U32);
3542
3543 limCopyU32(pBuf, pStat->transmittedPktsLo);
3544 pBuf += sizeof(tANI_U32);
3545
3546 limCopyU32(pBuf, pStat->phyStatHi);
3547 pBuf += sizeof(tANI_U32);
3548
3549 limCopyU32(pBuf, pStat->phyStatLo);
3550 pBuf += sizeof(tANI_U32);
3551
3552 limCopyU32(pBuf, pStat->uplinkRssi);
3553 pBuf += sizeof(tANI_U32);
3554
3555 limCopyU32(pBuf, pStat->uplinkSinr);
3556 pBuf += sizeof(tANI_U32);
3557
3558 limCopyU32(pBuf, pStat->uplinkRate);
3559 pBuf += sizeof(tANI_U32);
3560
3561 limCopyU32(pBuf, pStat->downlinkRssi);
3562 pBuf += sizeof(tANI_U32);
3563
3564 limCopyU32(pBuf, pStat->downlinkSinr);
3565 pBuf += sizeof(tANI_U32);
3566
3567 limCopyU32(pBuf, pStat->downlinkRate);
3568 pBuf += sizeof(tANI_U32);
3569
3570 limCopyU32(pBuf, pStat->nRcvBytes);
3571 pBuf += sizeof(tANI_U32);
3572
3573 limCopyU32(pBuf, pStat->nXmitBytes);
3574 pBuf += sizeof(tANI_U32);
3575
3576 PELOG1(limLog(pMac, LOG1, FL("STAT: length %d bytes is:\n"), sizeof(tAniStaStatStruct));)
3577 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, sizeof(tAniStaStatStruct));)
3578
3579} /*** end limStatSerDes() ***/
3580
3581
3582#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
3583/**
3584 * limSmeWmStatusChangeNtfSerDes()
3585 *
3586 *FUNCTION:
3587 * This function is called by limSendSmeWmStatusChangeNtf()
3588 * to serialize the header fields of SME WM Status Change
3589 * Notification
3590 *
3591 *LOGIC:
3592 *
3593 *ASSUMPTIONS:
3594 * NA
3595 *
3596 *NOTE:
3597 * NA
3598 *
3599 * @param statusChangeCode Status Change code
3600 * @param pBuf Pointer to serialized buffer
3601 * @param len Pointer to length actually used
3602 * @param buflen Buffer length remaining
3603 * @return retCode Indicates whether message is successfully
3604 * serialized (eSIR_SUCCESS) or not (eSIR_FAILURE)
3605 */
3606
3607tSirRetStatus
3608limSmeWmStatusChangeHeaderSerDes(tpAniSirGlobal pMac,
3609 tSirSmeStatusChangeCode statusChangeCode,
3610 tANI_U8 *pBuf,
3611 tANI_U16 *len,
3612 tANI_U32 buflen,
3613 tANI_U8 sessionId)
3614{
3615 if (buflen < ((sizeof(tANI_U16) * 2) + sizeof(tANI_U32)))
3616 {
3617 limLog(pMac, LOGE,
3618 FL("limSmeWmStatusChangeHeaderSerDes: no enough space (buf %d) \n"), buflen);
3619 return eSIR_FAILURE;
3620 }
3621
3622 *len = 0;
3623
3624 limCopyU16(pBuf, eWNI_SME_WM_STATUS_CHANGE_NTF);
3625 pBuf += sizeof(tANI_U16);
3626 *len += sizeof(tANI_U16);
3627
3628 // Actual length value shall be filled later
3629 pBuf += sizeof(tANI_U16);
3630 *len += sizeof(tANI_U16);
3631
3632 *pBuf++ = sessionId;
3633 *len += sizeof(tANI_U8);
3634
3635 limCopyU32(pBuf, statusChangeCode);
3636 pBuf += sizeof(tANI_U32);
3637 *len += sizeof(tANI_U32);
3638
3639 return eSIR_SUCCESS;
3640} /*** end limSmeWmStatusChangeHeaderSerDes() ***/
3641
3642
3643
3644/**
3645 * limRadioInfoSerDes()
3646 *
3647 *FUNCTION:
3648 * This function is called by limSendSmeWmStatusChangeNtf()
3649 * to serialize the radarInfo message
3650 *
3651 *LOGIC:
3652 *
3653 *ASSUMPTIONS:
3654 * NA
3655 *
3656 *NOTE:
3657 * NA
3658 *
3659 * @param pRadarInfo Pointer to tSirRadarInfo
3660 * @param pBuf Pointer to serialized buffer
3661 * @param len Pointer to length actually used by tSirRadarInfo
3662 * @param buflen Length remaining
3663 *
3664 * @return retCode Indicates whether message is successfully
3665 * serialized (eSIR_SUCCESS) or not (eSIR_FAILURE)
3666 */
3667
3668tSirRetStatus
3669limRadioInfoSerDes(tpAniSirGlobal pMac, tpSirRadarInfo pRadarInfo,
3670 tANI_U8 *pBuf, tANI_U16 *len, tANI_U32 buflen)
3671{
3672
3673 if (buflen < sizeof(tSirRadarInfo))
3674 {
3675 limLog(pMac, LOGE,
3676 FL("no enough space (buf %d) \n"), buflen);
3677 return eSIR_FAILURE;
3678 }
3679
3680 *pBuf = pRadarInfo->channelNumber;
3681 pBuf += sizeof(tANI_U8);
3682 *len += sizeof(tANI_U8);
3683
3684 limCopyU16(pBuf, pRadarInfo->radarPulseWidth);
3685 pBuf += sizeof(tANI_U16);
3686 *len += sizeof(tANI_U16);
3687
3688 limCopyU16(pBuf, pRadarInfo->numRadarPulse);
3689 pBuf += sizeof(tANI_U16);
3690 *len += sizeof(tANI_U16);
3691
3692 return eSIR_SUCCESS;
3693} /*** end limRadioInfoSerDes() ***/
3694#endif
3695
3696
3697/**
3698 * limPackBkgndScanFailNotify()
3699 *
3700 *FUNCTION:
3701 * This function is called by limSendSmeWmStatusChangeNtf()
3702 * to pack the tSirBackgroundScanInfo message
3703 *
3704 */
3705void
3706limPackBkgndScanFailNotify(tpAniSirGlobal pMac,
3707 tSirSmeStatusChangeCode statusChangeCode,
3708 tpSirBackgroundScanInfo pScanInfo,
3709 tSirSmeWmStatusChangeNtf *pSmeNtf,
3710 tANI_U8 sessionId)
3711{
3712
3713 tANI_U16 length = (sizeof(tANI_U16) * 2) + sizeof(tANI_U8) +
3714 sizeof(tSirSmeStatusChangeCode) +
3715 sizeof(tSirBackgroundScanInfo);
3716
3717#if defined (ANI_PRODUCT_TYPE_AP) && defined(ANI_LITTLE_BYTE_ENDIAN)
3718 sirStoreU16N((tANI_U8*)&pSmeNtf->messageType, eWNI_SME_WM_STATUS_CHANGE_NTF );
3719 sirStoreU16N((tANI_U8*)&pSmeNtf->length, length);
3720 pSmeNtf->sessionId = sessionId;
3721 sirStoreU32N((tANI_U8*)&pSmeNtf->statusChangeCode, statusChangeCode);
3722
3723 sirStoreU32N((tANI_U8*)&pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanSuccess,
3724 pScanInfo->numOfScanSuccess);
3725 sirStoreU32N((tANI_U8*)&pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanFailure,
3726 pScanInfo->numOfScanFailure);
3727 sirStoreU32N((tANI_U8*)&pSmeNtf->statusChangeInfo.bkgndScanInfo.reserved,
3728 pScanInfo->reserved);
3729#else
3730 pSmeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
3731 pSmeNtf->statusChangeCode = statusChangeCode;
3732 pSmeNtf->length = length;
3733 pSmeNtf->sessionId = sessionId;
3734 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanSuccess = pScanInfo->numOfScanSuccess;
3735 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanFailure = pScanInfo->numOfScanFailure;
3736 pSmeNtf->statusChangeInfo.bkgndScanInfo.reserved = pScanInfo->reserved;
3737#endif
3738}
3739
3740#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
3741
3742/**
3743 * nonTitanBssFoundSerDes()
3744 *
3745 *FUNCTION:
3746 * This function is called by limSendSmeWmStatusChangeNtf()
3747 * to serialize the following message
3748 * Mesg = eWNI_SME_WM_STATUS_CHANGE_NTF
3749 * Change code = eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP
3750 *
3751 *LOGIC:
3752 *
3753 *ASSUMPTIONS:
3754 * NA
3755 *
3756 *NOTE:
3757 * NA
3758 *
3759 * @param pMac Pointer to the global pMAC structure
3760 * @param pNewBssInfo Pointer to tpSirNeighborBssWdsInfo
3761 * @param pBuf Send data buffer
3762 * @param len Length of message
3763 * @param buflen Length remaining
3764 *
3765 * @return retCode Indicates whether message is successfully
3766 * serialized (eSIR_SUCCESS) or not (eSIR_FAILURE)
3767 */
3768
3769tSirRetStatus nonTitanBssFoundSerDes( tpAniSirGlobal pMac,
3770 tpSirNeighborBssWdsInfo pNewBssInfo,
3771 tANI_U8 *pBuf,
3772 tANI_U16 *len,
3773 tANI_U8 sessionId )
3774{
3775tANI_U8 *pTemp = pBuf;
3776tANI_U16 length = 0;
3777tANI_U32 bufLen = sizeof( tSirSmeWmStatusChangeNtf );
3778
3779 // Serialize the header (length to be filled later)
3780 if( eSIR_SUCCESS != limSmeWmStatusChangeHeaderSerDes(
3781 pMac,
3782 eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP,
3783 pBuf,
3784 &length,
3785 bufLen,
3786 sessionId))
3787 {
3788 limLog( pMac, LOGE,
3789 FL("Header SerDes failed \n"));
3790 return eSIR_FAILURE;
3791 }
3792 pBuf += length;
3793 bufLen -= length;
3794
3795 // Serialize tSirNeighborBssWdsInfo
3796 length = limCopyNeighborWdsInfo( pMac,
3797 pBuf,
3798 pNewBssInfo );
3799 pBuf += length;
3800 bufLen -= length;
3801
3802 // Update tSirSmeWmStatusChangeNtf.length
3803 pBuf = pTemp;
3804 pBuf += sizeof(tANI_U16);
3805 limCopyU16(pBuf, length);
3806
3807 // Update the total length to be returned
3808 *len = length;
3809
3810 return eSIR_SUCCESS;
3811} /*** end nonTitanBssFoundSerDes() ***/
3812
3813/**
3814 * limIsSmeSwitchChannelReqValid()
3815 *
3816 *FUNCTION:
3817 * This function is called by limProcessSmeReqMessages() upon
3818 * receiving SME_SWITCH_CHL_REQ message from application.
3819 *
3820 *LOGIC:
3821 * Message validity checks are performed in this function
3822 *
3823 *ASSUMPTIONS:
3824 *
3825 *NOTE:
3826 *
3827 * @param pBuf - Pointer to a serialized SME_SWITCH_CHL_REQ message
3828 * @param pSmeMsg - Pointer to a tSirsmeSwitchChannelReq structure
3829 * @return true if SME_SWITCH_CHL_REQ message is formatted correctly
3830 * false otherwise
3831 */
3832
3833tANI_BOOLEAN
3834limIsSmeSwitchChannelReqValid(tpAniSirGlobal pMac,
3835 tANI_U8 *pBuf,
3836 tpSirSmeSwitchChannelReq pSmeMsg)
3837{
3838 pSmeMsg->messageType = limGetU16(pBuf);
3839 pBuf += sizeof(tANI_U16);
3840
3841 pSmeMsg->length = limGetU16(pBuf);
3842 pBuf += sizeof(tANI_U16);
3843
3844 pSmeMsg->transactionId = limGetU16(pBuf);
3845 pBuf += sizeof(tANI_U16);
3846
3847 pSmeMsg->channelId = *pBuf;
3848 pBuf++;
3849
3850 pSmeMsg->cbMode = limGetU32(pBuf);
3851 pBuf += sizeof(tANI_U32);
3852
3853 pSmeMsg->dtimFactor = limGetU32(pBuf);
3854 pBuf += sizeof(tANI_U32);
3855
3856 if (pSmeMsg->length != SIR_SME_CHANNEL_SWITCH_SIZE)
3857 {
3858 PELOGE(limLog(pMac, LOGE, FL("Invalid length %d \n"), pSmeMsg->length);)
3859 return eANI_BOOLEAN_FALSE;
3860 }
3861
3862 // dtimFactor should not be too large
3863 if (pSmeMsg->dtimFactor > SIR_MAX_DTIM_FACTOR)
3864 {
3865 PELOGE(limLog(pMac, LOGE, FL("Invalid dtimFactor %d \n"), pSmeMsg->dtimFactor);)
3866 return eANI_BOOLEAN_FALSE;
3867 }
3868
3869 return eANI_BOOLEAN_TRUE;
3870}
3871
3872#endif
3873
3874#ifdef WLAN_SOFTAP_FEATURE
3875/**
3876 * limIsSmeGetAssocSTAsReqValid()
3877 *
3878 *FUNCTION:
3879 * This function is called by limProcessSmeReqMessages() upon
3880 * receiving SME_GET_ASSOC_STAS_REQ message from application.
3881 *
3882 *LOGIC:
3883 * Message validity checks are performed in this function
3884 *
3885 *ASSUMPTIONS:
3886 *
3887 *NOTE:
3888 *
3889 * @param pBuf - Pointer to a serialized SME_GET_ASSOC_STAS_REQ message
3890 * @param pSmeMsg - Pointer to a tSirSmeGetAssocSTAsReq structure
3891 * @return true if SME_GET_ASSOC_STAS_REQ message is formatted correctly
3892 * false otherwise
3893 */
3894tANI_BOOLEAN
3895limIsSmeGetAssocSTAsReqValid(tpAniSirGlobal pMac, tpSirSmeGetAssocSTAsReq pGetAssocSTAsReq, tANI_U8 *pBuf)
3896{
3897 tANI_S16 len = 0;
3898
3899 pGetAssocSTAsReq->messageType = limGetU16(pBuf);
3900 pBuf += sizeof(tANI_U16);
3901
3902 len = pGetAssocSTAsReq->length = limGetU16(pBuf);
3903 pBuf += sizeof(tANI_U16);
3904
3905 if (len < (tANI_S16) sizeof(tANI_U32))
3906 return eSIR_FAILURE;
3907
3908 len -= sizeof(tANI_U32); // skip message header
3909 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3910 return eSIR_FAILURE;
3911
3912 // Extract bssId
3913 palCopyMemory( pMac->hHdd, (tANI_U8 *) pGetAssocSTAsReq->bssId, pBuf, sizeof(tSirMacAddr));
3914 pBuf += sizeof(tSirMacAddr);
3915 len -= sizeof(tSirMacAddr);
3916 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3917 return eSIR_FAILURE;
3918
3919 // Extract modId
3920 pGetAssocSTAsReq->modId = limGetU16(pBuf);
3921 pBuf += sizeof(tANI_U16);
3922 len -= sizeof(tANI_U16);
3923 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3924 return eSIR_FAILURE;
3925
3926 // Extract pUsrContext
3927 pGetAssocSTAsReq->pUsrContext = (void *)limGetU32(pBuf);
3928 pBuf += sizeof(tANI_U32);
3929 len -= sizeof(tANI_U32);
3930 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3931 return eSIR_FAILURE;
3932
3933 // Extract pSapEventCallback
3934 pGetAssocSTAsReq->pSapEventCallback = (void *)limGetU32(pBuf);
3935 pBuf += sizeof(tANI_U32);
3936 len -= sizeof(tANI_U32);
3937 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
3938 return eSIR_FAILURE;
3939
3940 // Extract pAssocStasArray
3941 pGetAssocSTAsReq->pAssocStasArray = (void *)limGetU32(pBuf);
3942 pBuf += sizeof(tANI_U32);
3943 len -= sizeof(tANI_U32);
3944
3945 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes \n"), len);)
3946
3947 if (len < 0)
3948 {
3949 PELOGE(limLog(pMac, LOGE, FL("SME_GET_ASSOC_STAS_REQ invalid length\n"));)
3950 return eANI_BOOLEAN_FALSE;
3951 }
3952
3953 return eANI_BOOLEAN_TRUE;
3954}
3955
3956/**
3957 * limTkipCntrMeasReqSerDes()
3958 *
3959 *FUNCTION:
3960 * This function is called by limProcessSmeMessages() upon receiving
3961 * eWNI_SME_TKIP_CNTR_MEAS_REQ from host HDD
3962 *
3963 *PARAMS:
3964 *
3965 *LOGIC:
3966 *
3967 *ASSUMPTIONS:
3968 * NA
3969 *
3970 *NOTE:
3971 * NA
3972 *
3973 * @param tpSirSmeTkipCntrMeasReq Pointer to tSirSmeTkipCntrMeasReq being extracted
3974 * @param pBuf Pointer to serialized buffer
3975 * @return retCode Indicates whether message is successfully
3976 * de-serialized (eSIR_SUCCESS) or
3977 * not (eSIR_FAILURE)
3978 */
3979tSirRetStatus
3980limTkipCntrMeasReqSerDes(tpAniSirGlobal pMac, tpSirSmeTkipCntrMeasReq pTkipCntrMeasReq, tANI_U8 *pBuf)
3981{
3982 tANI_S16 len = 0;
3983
3984#ifdef PE_DEBUG_LOG1
3985 tANI_U8 *pTemp = pBuf;
3986#endif
3987
3988 pTkipCntrMeasReq->messageType = limGetU16(pBuf);
3989 pBuf += sizeof(tANI_U16);
3990
3991 len = pTkipCntrMeasReq->length = limGetU16(pBuf);
3992 pBuf += sizeof(tANI_U16);
3993
3994 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length %d bytes is:\n"), len);)
3995 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
3996
3997 if (len < (tANI_S16) sizeof(tANI_U32))
3998 return eSIR_FAILURE;
3999
4000 len -= sizeof(tANI_U32); // skip message header
4001 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4002 return eSIR_FAILURE;
4003
4004 // Extract sessionId
4005 pTkipCntrMeasReq->sessionId = *pBuf++;
4006 len--;
4007 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4008 return eSIR_FAILURE;
4009
4010 // Extract transactionId
4011 pTkipCntrMeasReq->transactionId = limGetU16(pBuf);
4012 pBuf += sizeof(tANI_U16);
4013 len -= sizeof(tANI_U16);
4014 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4015 return eSIR_FAILURE;
4016
4017 // Extract bssId
4018 palCopyMemory( pMac->hHdd, (tANI_U8 *) pTkipCntrMeasReq->bssId, pBuf, sizeof(tSirMacAddr));
4019 pBuf += sizeof(tSirMacAddr);
4020 len -= sizeof(tSirMacAddr);
4021 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4022 return eSIR_FAILURE;
4023
4024 // Extract bEnable
4025 pTkipCntrMeasReq->bEnable = *pBuf++;
4026 len --;
4027
4028 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length consumed %d bytes \n"), len);)
4029
4030 if (len)
4031 {
4032 PELOGE(limLog(pMac, LOGE, FL("SME_TKIP_CNTR_MEAS_REQ invalid \n"));)
4033 return eSIR_FAILURE;
4034 }
4035 else
4036 return eSIR_SUCCESS;
4037}
4038
4039/**
4040 * limIsSmeGetWPSPBCSessionsReqValid()
4041 *
4042 *FUNCTION:
4043 * This function is called by limProcessSmeGetWPSPBCSessions() upon
4044 * receiving query WPS PBC overlap information message from application.
4045 *
4046 *LOGIC:
4047 * Message validity checks are performed in this function
4048 *
4049 *ASSUMPTIONS:
4050 *
4051 *NOTE:
4052 *
4053 * @param pBuf - Pointer to a serialized SME_GET_WPSPBC_SESSION_REQ message
4054 * @param pGetWPSPBCSessionsReq - Pointer to a tSirSmeGetWPSPBCSessionsReq structure
4055 * @return true if SME_GET_WPSPBC_SESSION_REQ message is formatted correctly
4056 * false otherwise
4057 */
4058
4059tSirRetStatus
4060limIsSmeGetWPSPBCSessionsReqValid(tpAniSirGlobal pMac, tSirSmeGetWPSPBCSessionsReq *pGetWPSPBCSessionsReq, tANI_U8 *pBuf)
4061{
4062 tANI_S16 len = 0;
4063
4064 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirSmeGetWPSPBCSessionsReq));)
4065
4066 pGetWPSPBCSessionsReq->messageType = limGetU16(pBuf);
4067 pBuf += sizeof(tANI_U16);
4068
4069 len = pGetWPSPBCSessionsReq->length = limGetU16(pBuf);
4070 pBuf += sizeof(tANI_U16);
4071
4072 if (len < (tANI_S16) sizeof(tANI_U32))
4073 return eSIR_FAILURE;
4074
4075 len -= sizeof(tANI_U32); // skip message header
4076 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4077 return eSIR_FAILURE;
4078
4079 // Extract pUsrContext
4080 pGetWPSPBCSessionsReq->pUsrContext = (void *)limGetU32(pBuf);
4081 pBuf += sizeof(tANI_U32);
4082 len -= sizeof(tANI_U32);
4083 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4084 return eSIR_FAILURE;
4085
4086 // Extract pSapEventCallback
4087 pGetWPSPBCSessionsReq->pSapEventCallback = (void *)limGetU32(pBuf);
4088 pBuf += sizeof(tANI_U32);
4089 len -= sizeof(tANI_U32);
4090 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4091 return eSIR_FAILURE;
4092
4093 // Extract bssId
4094 palCopyMemory( pMac->hHdd, (tANI_U8 *) pGetWPSPBCSessionsReq->bssId, pBuf, sizeof(tSirMacAddr));
4095 pBuf += sizeof(tSirMacAddr);
4096 len -= sizeof(tSirMacAddr);
4097
4098 // Extract MAC address of Station to be removed
4099 palCopyMemory( pMac->hHdd, (tANI_U8 *) pGetWPSPBCSessionsReq->pRemoveMac, pBuf, sizeof(tSirMacAddr));
4100 pBuf += sizeof(tSirMacAddr);
4101 len -= sizeof(tSirMacAddr);
4102
4103 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes \n"), len);)
4104
4105 if (len < 0)
4106 {
4107 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length\n"));)
4108 return eSIR_FAILURE;
4109 }
4110
4111 return eSIR_SUCCESS;
4112}
4113
4114#endif
4115
4116/**---------------------------------------------------------------
4117\fn limGetSessionInfo
4118\brief This function returns the sessionId and transactionId
4119\ of a message. This assumes that the message structure
4120\ is of format:
4121\ tANI_U16 messageType
4122\ tANI_U16 messageLength
4123\ tANI_U8 sessionId
4124\ tANI_U16 transactionId
4125\param pMac - pMac global structure
4126\param *pBuf - pointer to the message buffer
4127\param sessionId - returned session id value
4128\param transactionId - returned transaction ID value
4129\return None
4130------------------------------------------------------------------*/
4131void
4132limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U8 *sessionId, tANI_U16 *transactionId)
4133{
4134 if (!pBuf)
4135 {
4136 limLog(pMac, LOGE, FL("NULL ptr received. \n"));
4137 return;
4138 }
4139
4140 pBuf += sizeof(tANI_U16); // skip message type
4141 pBuf += sizeof(tANI_U16); // skip message length
4142
4143 *sessionId = *pBuf; // get sessionId
4144 pBuf++;
4145 *transactionId = limGetU16(pBuf); // get transactionId
4146
4147 return;
4148}
4149
4150#ifdef WLAN_SOFTAP_FEATURE
4151
4152/**
4153 * limUpdateAPWPSIEsReqSerDes()
4154 *
4155 *FUNCTION:
4156 * This function is to deserialize UpdateAPWPSIEs message
4157 *
4158 *PARAMS:
4159 *
4160 *LOGIC:
4161 *
4162 *ASSUMPTIONS:
4163 * NA
4164 *
4165 *NOTE:
4166 * NA
4167 *
4168 * @param pUpdateAPWPSIEsReq Pointer to tSirUpdateAPWPSIEsReq being
4169 * extracted
4170 * @param pBuf Pointer to serialized buffer
4171 *
4172 * @return retCode Indicates whether message is successfully
4173 * de-serialized (eSIR_SUCCESS) or
4174 * not (eSIR_FAILURE)
4175 */
4176
4177tSirRetStatus
4178limUpdateAPWPSIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq, tANI_U8 *pBuf)
4179{
4180 tANI_S16 len = 0;
4181
4182 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPSIEsReq));)
4183
4184 if (!pUpdateAPWPSIEsReq || !pBuf)
4185 return eSIR_FAILURE;
4186
4187 pUpdateAPWPSIEsReq->messageType = limGetU16(pBuf);
4188 pBuf += sizeof(tANI_U16);
4189
4190 len = pUpdateAPWPSIEsReq->length = limGetU16(pBuf);
4191 pBuf += sizeof(tANI_U16);
4192
4193 if (len < (tANI_S16) sizeof(tANI_U32))
4194 return eSIR_FAILURE;
4195
4196 len -= sizeof(tANI_U32); // skip message header
4197 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4198 return eSIR_FAILURE;
4199
4200 // Extract transactionId
4201 pUpdateAPWPSIEsReq->transactionId = limGetU16( pBuf );
4202 pBuf += sizeof( tANI_U16 );
4203 len -= sizeof( tANI_U16 );
4204 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4205 return eSIR_FAILURE;
4206
4207 // Extract bssId
4208 palCopyMemory( pMac->hHdd, (tANI_U8 *) pUpdateAPWPSIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
4209 pBuf += sizeof(tSirMacAddr);
4210 len -= sizeof(tSirMacAddr);
4211 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4212 return eSIR_FAILURE;
4213
4214 // Extract sessionId
4215 pUpdateAPWPSIEsReq->sessionId = *pBuf++;
4216 len--;
4217 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4218 return eSIR_FAILURE;
4219
4220 // Extract APWPSIEs
4221 palCopyMemory( pMac->hHdd, (tSirAPWPSIEs *) &pUpdateAPWPSIEsReq->APWPSIEs, pBuf, sizeof(tSirAPWPSIEs));
4222 pBuf += sizeof(tSirAPWPSIEs);
4223 len -= sizeof(tSirAPWPSIEs);
4224
4225 PELOG1(limLog(pMac, LOG1, FL("SME_UPDATE_APWPSIE_REQ length consumed %d bytes \n"), len);)
4226
4227 if (len < 0)
4228 {
4229 PELOGE(limLog(pMac, LOGE, FL("SME_UPDATE_APWPSIE_REQ invalid length\n"));)
4230 return eSIR_FAILURE;
4231 }
4232
4233 return eSIR_SUCCESS;
4234} /*** end limSetContextReqSerDes() ***/
4235
4236/**
4237 * limUpdateAPWPARSNIEsReqSerDes ()
4238 *
4239 *FUNCTION:
4240 * This function is to deserialize UpdateAPWPSIEs message
4241 *
4242 *PARAMS:
4243 *
4244 *LOGIC:
4245 *
4246 *ASSUMPTIONS:
4247 * NA
4248 *
4249 *NOTE:
4250 * NA
4251 *
4252 * @param pUpdateAPWPARSNIEsReq Pointer to tpSirUpdateAPWPARSNIEsReq being
4253 * extracted
4254 * @param pBuf Pointer to serialized buffer
4255 *
4256 * @return retCode Indicates whether message is successfully
4257 * de-serialized (eSIR_SUCCESS) or
4258 * not (eSIR_FAILURE)
4259 */
4260
4261tSirRetStatus
4262limUpdateAPWPARSNIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq, tANI_U8 *pBuf)
4263{
4264 tANI_S16 len = 0;
4265
4266 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPARSNIEsReq));)
4267
4268 if (!pUpdateAPWPARSNIEsReq || !pBuf)
4269 return eSIR_FAILURE;
4270
4271 pUpdateAPWPARSNIEsReq->messageType = limGetU16(pBuf);
4272 pBuf += sizeof(tANI_U16);
4273
4274 len = pUpdateAPWPARSNIEsReq->length = limGetU16(pBuf);
4275 pBuf += sizeof(tANI_U16);
4276
4277 if (len < (tANI_S16) sizeof(tANI_U32))
4278 return eSIR_FAILURE;
4279
4280 len -= sizeof(tANI_U32); // skip message header
4281 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4282 return eSIR_FAILURE;
4283
4284 // Extract transactionId
4285 pUpdateAPWPARSNIEsReq->transactionId = limGetU16( pBuf );
4286 pBuf += sizeof(tANI_U16);
4287 len -= sizeof( tANI_U16 );
4288 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4289 return eSIR_FAILURE;
4290
4291 // Extract bssId
4292 palCopyMemory( pMac->hHdd, (tANI_U8 *) pUpdateAPWPARSNIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
4293 pBuf += sizeof(tSirMacAddr);
4294 len -= sizeof(tSirMacAddr);
4295 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4296 return eSIR_FAILURE;
4297
4298 // Extract sessionId
4299 pUpdateAPWPARSNIEsReq->sessionId = *pBuf++;
4300 len--;
4301 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
4302 return eSIR_FAILURE;
4303
4304 // Extract APWPARSNIEs
4305 palCopyMemory( pMac->hHdd, (tSirRSNie *) &pUpdateAPWPARSNIEsReq->APWPARSNIEs, pBuf, sizeof(tSirRSNie));
4306 pBuf += sizeof(tSirRSNie);
4307 len -= sizeof(tSirRSNie);
4308
4309 if (len < 0)
4310 {
4311 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length\n"));)
4312 return eSIR_FAILURE;
4313 }
4314
4315 return eSIR_SUCCESS;
4316} /*** end limUpdateAPWPARSNIEsReqSerDes() ***/
4317
4318#endif