blob: ec57df8cd70be29bb3fb4902b316919a55d89402 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam842dad02014-02-18 18:44:02 -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.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080022/*
Kiet Lam842dad02014-02-18 18:44:02 -080023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28/*
29 *
Jeff Johnson295189b2012-06-20 16:38:30 -070030 * This file limSerDesUtils.cc contains the serializer/deserializer
31 * utility functions LIM uses while communicating with upper layer
32 * software entities
33 * Author: Chandra Modumudi
34 * Date: 10/20/02
35 * History:-
36 * Date Modified by Modification Information
37 * --------------------------------------------------------------------
38 */
39
40#include "aniSystemDefs.h"
41#include "utilsApi.h"
42#include "limTypes.h"
43#include "limUtils.h"
44#include "limSerDesUtils.h"
45
46
47
48/**
49 * limCheckRemainingLength()
50 *
51 *FUNCTION:
52 * This function is called while de-serializing received SME_REQ
53 * message.
54 *
55 *LOGIC:
56 * Remaining message length is checked for > 0.
57 *
58 *ASSUMPTIONS:
59 * NA
60 *
61 *NOTE:
62 * NA
63 *
64 * @param len - Remaining message length
65 * @return retCode - eSIR_SUCCESS if len > 0, else eSIR_FAILURE
66 */
67
68static inline tSirRetStatus
69limCheckRemainingLength(tpAniSirGlobal pMac, tANI_S16 len)
70{
71 if (len > 0)
72 return eSIR_SUCCESS;
73 else
74 {
75 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -070076 FL("Received SME message with invalid rem length=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -070077 len);
78 return eSIR_FAILURE;
79 }
80} /*** end limCheckRemainingLength(pMac, ) ***/
81
Jeff Johnson295189b2012-06-20 16:38:30 -070082/**
83 * limGetBssDescription()
84 *
85 *FUNCTION:
86 * This function is called by various LIM functions to copy
87 * BSS description from a tANI_U8* buffer pointer to tSirBssDescription
88 *
89 *LOGIC:
90 *
91 *ASSUMPTIONS:
92 * NA
93 *
94 *NOTE:
95 * NA
96 *
97 * @param pBssDescription Pointer to the BssDescription to be copied
98 * @param *pBuf Pointer to the source buffer
99 * @param rLen Remaining message length being extracted
100 * @return retCode Indicates whether message is successfully
101 * de-serialized (eSIR_SUCCESS) or
102 * failure (eSIR_FAILURE).
103 */
104
105static tSirRetStatus
106limGetBssDescription( tpAniSirGlobal pMac, tSirBssDescription *pBssDescription,
107 tANI_S16 rLen, tANI_S16 *lenUsed, tANI_U8 *pBuf)
108{
Madan Mohan Koyyalamudic62057b2012-10-30 18:31:54 -0700109 tANI_S16 len = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700110
111 pBssDescription->length = limGetU16(pBuf);
112 pBuf += sizeof(tANI_U16);
113 len = pBssDescription->length;
114
115 if (rLen < (tANI_S16) (len + sizeof(tANI_U16)))
116 return eSIR_FAILURE;
117
118 *lenUsed = len + sizeof(tANI_U16);
119
120 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530121 vos_mem_copy( (tANI_U8 *) pBssDescription->bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700122 pBuf, sizeof(tSirMacAddr));
123 pBuf += sizeof(tSirMacAddr);
124 len -= sizeof(tSirMacAddr);
125 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
126 return eSIR_FAILURE;
127
128 // Extract timer
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530129 vos_mem_copy( (tANI_U8 *) (&pBssDescription->scanSysTimeMsec),
Jeff Johnson295189b2012-06-20 16:38:30 -0700130 pBuf, sizeof(v_TIME_t));
131 pBuf += sizeof(v_TIME_t);
132 len -= sizeof(v_TIME_t);
133 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
134 return eSIR_FAILURE;
135
136 // Extract timeStamp
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530137 vos_mem_copy( (tANI_U8 *) pBssDescription->timeStamp,
Jeff Johnson295189b2012-06-20 16:38:30 -0700138 pBuf, sizeof(tSirMacTimeStamp));
139 pBuf += sizeof(tSirMacTimeStamp);
140 len -= sizeof(tSirMacTimeStamp);
141 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
142 return eSIR_FAILURE;
143
144 // Extract beaconInterval
145 pBssDescription->beaconInterval = limGetU16(pBuf);
146 pBuf += sizeof(tANI_U16);
147 len -= sizeof(tANI_U16);
148 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
149 return eSIR_FAILURE;
150
151 // Extract capabilityInfo
152 pBssDescription->capabilityInfo = limGetU16(pBuf);
153 pBuf += sizeof(tANI_U16);
154 len -= sizeof(tANI_U16);
155 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
156 return eSIR_FAILURE;
157
158 // Extract nwType
159 pBssDescription->nwType = (tSirNwType) limGetU32(pBuf);
160 pBuf += sizeof(tSirNwType);
161 len -= sizeof(tSirNwType);
162 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
163 return eSIR_FAILURE;
164
165 // Extract aniIndicator
166 pBssDescription->aniIndicator = *pBuf++;
167 len --;
168
169 // Extract rssi
170 pBssDescription->rssi = (tANI_S8) *pBuf++;
171 len --;
172
173 // Extract sinr
174 pBssDescription->sinr = (tANI_S8) *pBuf++;
175 len --;
176
177 // Extract channelId
178 pBssDescription->channelId = *pBuf++;
179 len --;
180
181 // Extract channelIdSelf
182 pBssDescription->channelIdSelf = *pBuf++;
183 len --;
184 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
185 return eSIR_FAILURE;
186
187 // Extract reserved bssDescription
188 pBuf += sizeof(pBssDescription->sSirBssDescriptionRsvd);
189 len -= sizeof(pBssDescription->sSirBssDescriptionRsvd);
190 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
191 return eSIR_FAILURE;
192
Jeff Johnson295189b2012-06-20 16:38:30 -0700193 //pass the timestamp
194 pBssDescription->nReceivedTime = limGetU32( pBuf );
195 pBuf += sizeof(tANI_TIMESTAMP);
196 len -= sizeof(tANI_TIMESTAMP);
197
198#if defined WLAN_FEATURE_VOWIFI
199 //TSF when the beacon received (parent TSF)
200 pBssDescription->parentTSF = limGetU32( pBuf );
201 pBuf += sizeof(tANI_U32);
202 len -= sizeof(tANI_U32);
203
204 //start TSF of scan during which this BSS desc was updated.
205 pBssDescription->startTSF[0] = limGetU32( pBuf );
206 pBuf += sizeof(tANI_U32);
207 len -= sizeof(tANI_U32);
208
209 //start TSF of scan during which this BSS desc was updated.
210 pBssDescription->startTSF[1] = limGetU32( pBuf );
211 pBuf += sizeof(tANI_U32);
212 len -= sizeof(tANI_U32);
213#endif
214#ifdef WLAN_FEATURE_VOWIFI_11R
215 // MobilityDomain
216 pBssDescription->mdiePresent = *pBuf++;
217 len --;
218 pBssDescription->mdie[0] = *pBuf++;
219 len --;
220 pBssDescription->mdie[1] = *pBuf++;
221 len --;
222 pBssDescription->mdie[2] = *pBuf++;
223 len --;
224#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700225 PELOGE(limLog(pMac, LOG1, FL("mdie=%02x %02x %02x"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700226 pBssDescription->mdie[0],
227 pBssDescription->mdie[1],
228 pBssDescription->mdie[2]);)
229#endif
230#endif
231
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800232#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700233 pBssDescription->QBSSLoad_present = limGetU16(pBuf);
234 pBuf += sizeof(tANI_U16);
235 len -= sizeof(tANI_U16);
236 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
237 return eSIR_FAILURE;
238
239 // Extract QBSSLoad_avail
240 pBssDescription->QBSSLoad_avail = limGetU16(pBuf);
241 pBuf += sizeof(tANI_U16);
242 len -= sizeof(tANI_U16);
243 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
244 return eSIR_FAILURE;
245#endif
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -0700246 pBssDescription->fProbeRsp = *pBuf++;
247 len -= sizeof(tANI_U8);
248 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
249 return eSIR_FAILURE;
250
Madan Mohan Koyyalamudi2a6ba242012-10-31 17:06:19 -0700251 /* 3 reserved bytes for padding */
252 pBuf += (3 * sizeof(tANI_U8));
253 len -= 3;
254
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -0700255 pBssDescription->WscIeLen = limGetU32( pBuf );
256 pBuf += sizeof(tANI_U32);
257 len -= sizeof(tANI_U32);
258 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
259 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700260
Madan Mohan Koyyalamudi2a6ba242012-10-31 17:06:19 -0700261 if (WSCIE_PROBE_RSP_LEN < len)
Jeff Johnson295189b2012-06-20 16:38:30 -0700262 {
Madan Mohan Koyyalamudi2a6ba242012-10-31 17:06:19 -0700263 /* Do not copy with WscIeLen
264 * if WscIeLen is not set properly, memory overwrite happen
265 * Ended up with memory corruption and crash
266 * Copy with Fixed size */
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530267 vos_mem_copy( (tANI_U8 *) pBssDescription->WscIeProbeRsp,
Jeff Johnson295189b2012-06-20 16:38:30 -0700268 pBuf,
Madan Mohan Koyyalamudi2a6ba242012-10-31 17:06:19 -0700269 WSCIE_PROBE_RSP_LEN);
270
Jeff Johnson295189b2012-06-20 16:38:30 -0700271 }
Madan Mohan Koyyalamudi2a6ba242012-10-31 17:06:19 -0700272 else
273 {
274 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700275 FL("remaining bytes len %d is less than WSCIE_PROBE_RSP_LEN"),
Madan Mohan Koyyalamudi2a6ba242012-10-31 17:06:19 -0700276 pBssDescription->WscIeLen);
277 return eSIR_FAILURE;
278 }
279
280 /* 1 reserved byte padding */
281 pBuf += (WSCIE_PROBE_RSP_LEN + 1);
282 len -= (WSCIE_PROBE_RSP_LEN + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700283
Madan Mohan Koyyalamudic62057b2012-10-30 18:31:54 -0700284 if (len > 0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700285 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530286 vos_mem_copy( (tANI_U8 *) pBssDescription->ieFields,
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 pBuf,
288 len);
289 }
Madan Mohan Koyyalamudic62057b2012-10-30 18:31:54 -0700290 else if (len < 0)
291 {
292 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700293 FL("remaining length is negative. len = %d, actual length = %d"),
Madan Mohan Koyyalamudic62057b2012-10-30 18:31:54 -0700294 len, pBssDescription->length);
295 return eSIR_FAILURE;
296 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700297
298 return eSIR_SUCCESS;
299} /*** end limGetBssDescription() ***/
Jeff Johnson295189b2012-06-20 16:38:30 -0700300
301
302
303/**
304 * limCopyBssDescription()
305 *
306 *FUNCTION:
307 * This function is called by various LIM functions to copy
308 * BSS description to a tANI_U8 buffer
309 *
310 *LOGIC:
311 *
312 *ASSUMPTIONS:
313 * NA
314 *
315 *NOTE:
316 * NA
317 *
318 * @param *pBuf Pointer to the destination buffer
319 * @param pBssDescription Pointer to the BssDescription being copied
320 * @return Length of BSSdescription written
321 */
322
323tANI_U16
324limCopyBssDescription(tpAniSirGlobal pMac, tANI_U8 *pBuf, tSirBssDescription *pBssDescription)
325{
326 tANI_U16 len = 0;
327
328 limCopyU16(pBuf, pBssDescription->length);
329 pBuf += sizeof(tANI_U16);
330 len += sizeof(tANI_U16);
331
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530332 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -0700333 (tANI_U8 *) pBssDescription->bssId,
334 sizeof(tSirMacAddr));
335 pBuf += sizeof(tSirMacAddr);
336 len += sizeof(tSirMacAddr);
337
338 PELOG3(limLog(pMac, LOG3,
339 FL("Copying BSSdescr:channel is %d, aniInd is %d, bssId is "),
340 pBssDescription->channelId, pBssDescription->aniIndicator);
341 limPrintMacAddr(pMac, pBssDescription->bssId, LOG3);)
342
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530343 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -0700344 (tANI_U8 *) (&pBssDescription->scanSysTimeMsec),
345 sizeof(v_TIME_t));
346 pBuf += sizeof(v_TIME_t);
347 len += sizeof(v_TIME_t);
348
349 limCopyU32(pBuf, pBssDescription->timeStamp[0]);
350 pBuf += sizeof(tANI_U32);
351 len += sizeof(tANI_U32);
352
353 limCopyU32(pBuf, pBssDescription->timeStamp[1]);
354 pBuf += sizeof(tANI_U32);
355 len += sizeof(tANI_U32);
356
357 limCopyU16(pBuf, pBssDescription->beaconInterval);
358 pBuf += sizeof(tANI_U16);
359 len += sizeof(tANI_U16);
360
361 limCopyU16(pBuf, pBssDescription->capabilityInfo);
362 pBuf += sizeof(tANI_U16);
363 len += sizeof(tANI_U16);
364
365 limCopyU32(pBuf, pBssDescription->nwType);
366 pBuf += sizeof(tANI_U32);
367 len += sizeof(tANI_U32);
368
369 *pBuf++ = pBssDescription->aniIndicator;
370 len++;
371
372 *pBuf++ = pBssDescription->rssi;
373 len++;
374
375 *pBuf++ = pBssDescription->sinr;
376 len++;
377
378 *pBuf++ = pBssDescription->channelId;
379 len++;
380
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530381 vos_mem_copy( pBuf, (tANI_U8 *) &(pBssDescription->ieFields),
Jeff Johnson295189b2012-06-20 16:38:30 -0700382 limGetIElenFromBssDescription(pBssDescription));
383
384 return (len + sizeof(tANI_U16));
385} /*** end limCopyBssDescription() ***/
386
387
388
Jeff Johnson295189b2012-06-20 16:38:30 -0700389
390
391/**
392 * limGetKeysInfo()
393 *
394 *FUNCTION:
395 * This function is called by various LIM functions to copy
396 * key information from a tANI_U8* buffer pointer to tSirKeys
397 *
398 *LOGIC:
399 *
400 *ASSUMPTIONS:
401 * NA
402 *
403 *NOTE:
404 * NA
405 *
406 * @param *pKeyInfo Pointer to the keyInfo to be copied
407 * @param *pBuf Pointer to the source buffer
408 *
409 * @return Length of key info extracted
410 */
411
412static tANI_U32
413limGetKeysInfo(tpAniSirGlobal pMac, tpSirKeys pKeyInfo, tANI_U8 *pBuf)
414{
415 tANI_U32 len = 0;
416
417 pKeyInfo->keyId = *pBuf++;
418 len++;
419 pKeyInfo->unicast = *pBuf++;
420 len++;
421 pKeyInfo->keyDirection = (tAniKeyDirection) limGetU32(pBuf);
422 len += sizeof(tAniKeyDirection);
423 pBuf += sizeof(tAniKeyDirection);
424
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530425 vos_mem_copy( pKeyInfo->keyRsc, pBuf, WLAN_MAX_KEY_RSC_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -0700426 pBuf += WLAN_MAX_KEY_RSC_LEN;
427 len += WLAN_MAX_KEY_RSC_LEN;
428
429 pKeyInfo->paeRole = *pBuf++;
430 len++;
431
432 pKeyInfo->keyLength = limGetU16(pBuf);
433 pBuf += sizeof(tANI_U16);
434 len += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530435 vos_mem_copy( pKeyInfo->key, pBuf, pKeyInfo->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 pBuf += pKeyInfo->keyLength;
437 len += pKeyInfo->keyLength;
438
439 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700440 FL("Extracted keyId=%d, keyLength=%d, Key is :"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700441 pKeyInfo->keyId, pKeyInfo->keyLength);
442 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3,
443 pKeyInfo->key, pKeyInfo->keyLength);)
444
445 return len;
446} /*** end limGetKeysInfo() ***/
447
448
449
450/**
451 * limStartBssReqSerDes()
452 *
453 *FUNCTION:
454 * This function is called by limProcessSmeMessages() upon receiving
455 * SME_START_BSS_REQ from host
456 *
457 *PARAMS:
458 *
459 *LOGIC:
460 *
461 *ASSUMPTIONS:
462 * NA
463 *
464 *NOTE:
465 * NA
466 *
467 * @param pStartBssReq Pointer to tSirSmeStartBssReq being extracted
468 * @param pBuf Pointer to serialized buffer
469 * @return retCode Indicates whether message is successfully
470 * de-serialized (eSIR_SUCCESS) or
471 * not (eSIR_FAILURE)
472 */
473
474tSirRetStatus
475limStartBssReqSerDes(tpAniSirGlobal pMac, tpSirSmeStartBssReq pStartBssReq, tANI_U8 *pBuf)
476{
477 tANI_S16 len = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700478
479#ifdef PE_DEBUG_LOG1
480 tANI_U8 *pTemp = pBuf;
481#endif
482
483 if (!pStartBssReq || !pBuf)
484 return eSIR_FAILURE;
485
486 pStartBssReq->messageType = limGetU16(pBuf);
487 pBuf += sizeof(tANI_U16);
488
489 len = pStartBssReq->length = limGetU16(pBuf);
490 pBuf += sizeof(tANI_U16);
491
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700492 PELOG1(limLog(pMac, LOG1, FL("SME_START_BSS_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
494
495 if (len < (tANI_S16) sizeof(tANI_U32))
496 return eSIR_FAILURE;
497
498 len -= sizeof(tANI_U32); // skip message header
499 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
500 return eSIR_FAILURE;
501
502 // Extract sessionId
503 pStartBssReq->sessionId = *pBuf++;
504 len--;
505 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
506 return eSIR_FAILURE;
507
508 // Extract transactionId
509 pStartBssReq->transactionId = limGetU16( pBuf );
510 pBuf += sizeof( tANI_U16 );
511 len -= sizeof( tANI_U16 );
512 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
513 return eSIR_FAILURE;
514
515 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530516 vos_mem_copy( (tANI_U8 *) pStartBssReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 pBuf += sizeof(tSirMacAddr);
518 len -= sizeof(tSirMacAddr);
519 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
520 return eSIR_FAILURE;
521
522 // Extract selfMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530523 vos_mem_copy( (tANI_U8 *) pStartBssReq->selfMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700524 pBuf += sizeof(tSirMacAddr);
525 len -= sizeof(tSirMacAddr);
526 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
527 return eSIR_FAILURE;
528
529 // Extract beaconInterval
530 pStartBssReq->beaconInterval = limGetU16( pBuf );
531 pBuf += sizeof( tANI_U16 );
532 len -= sizeof( tANI_U16 );
533 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
534 return eSIR_FAILURE;
535
536 // Extract dot11Mode
537 pStartBssReq->dot11mode = *pBuf++;
538 len --;
539 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
540 return eSIR_FAILURE;
541
542 // Extract bssType
543 pStartBssReq->bssType = (tSirBssType) limGetU32(pBuf);
544 pBuf += sizeof(tANI_U32);
545 len -= sizeof(tANI_U32);
546 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
547 return eSIR_FAILURE;
548
549 // Extract ssId
550 if (*pBuf > SIR_MAC_MAX_SSID_LENGTH)
551 {
552 // SSID length is more than max allowed 32 bytes
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700553 PELOGW(limLog(pMac, LOGW, FL("Invalid SSID length, len=%d"), *pBuf);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700554 return eSIR_FAILURE;
555 }
556
557 pStartBssReq->ssId.length = *pBuf++;
558 len--;
559 if (len < pStartBssReq->ssId.length)
560 {
561 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700562 FL("SSID length is longer that the remaining length. SSID len=%d, remaining len=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 pStartBssReq->ssId.length, len);
564 return eSIR_FAILURE;
565 }
566
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530567 vos_mem_copy( (tANI_U8 *) pStartBssReq->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700568 pBuf,
569 pStartBssReq->ssId.length);
570 pBuf += pStartBssReq->ssId.length;
571 len -= pStartBssReq->ssId.length;
572 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
573 return eSIR_FAILURE;
574
575 // Extract channelId
576 pStartBssReq->channelId = *pBuf++;
577 len--;
578
579 // Extract CB secondary channel info
Jeff Johnsone7245742012-09-05 17:12:55 -0700580 pStartBssReq->cbMode = (ePhyChanBondState)limGetU32( pBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 pBuf += sizeof( tANI_U32 );
582 len -= sizeof( tANI_U32 );
583
584 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
585 return eSIR_FAILURE;
586
Jeff Johnson295189b2012-06-20 16:38:30 -0700587
Jeff Johnson295189b2012-06-20 16:38:30 -0700588 // Extract privacy setting
589 pStartBssReq->privacy = *pBuf++;
590 len--;
591 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
592 return eSIR_FAILURE;
593
594 //Extract Uapsd Enable
595 pStartBssReq->apUapsdEnable = *pBuf++;
596 len--;
597 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
598 return eSIR_FAILURE;
599
600 //Extract SSID hidden
601 pStartBssReq->ssidHidden = *pBuf++;
602 len--;
603 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
604 return eSIR_FAILURE;
605
606 pStartBssReq->fwdWPSPBCProbeReq = *pBuf++;
607 len--;
608 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
609 return eSIR_FAILURE;
610
611 //Extract HT Protection Enable
612 pStartBssReq->protEnabled = *pBuf++;
613 len--;
614 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
615 return eSIR_FAILURE;
616
617 //Extract OBSS Protection Enable
618 pStartBssReq->obssProtEnabled = *pBuf++;
619 len--;
620 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
621 return eSIR_FAILURE;
622
623 pStartBssReq->ht_capab = limGetU16(pBuf);
624 pBuf += sizeof(tANI_U16);
625 len -= sizeof(tANI_U16);
626 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
627 return eSIR_FAILURE;
628
629 // Extract AuthType
630 pStartBssReq->authType = (tSirBssType) limGetU32(pBuf);
631 pBuf += sizeof(tANI_U32);
632 len -= sizeof(tANI_U32);
633 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
634 return eSIR_FAILURE;
635
636 // Extract dtimPeriod
637 pStartBssReq->dtimPeriod = limGetU32(pBuf);
638 pBuf += sizeof(tANI_U32);
639 len -= sizeof(tANI_U32);
640 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
641 return eSIR_FAILURE;
642
643 // Extract wps state
644 pStartBssReq->wps_state = *pBuf++;
645 len--;
646 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
647 return eSIR_FAILURE;
648
krunal sonie9002db2013-11-25 14:24:17 -0800649 // Extract isCoalesingInIBSSAllowed
650 pStartBssReq->isCoalesingInIBSSAllowed = *pBuf++;
651 len--;
652 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
653 return eSIR_FAILURE;
654
Jeff Johnson295189b2012-06-20 16:38:30 -0700655 // Extract bssPersona
656 pStartBssReq->bssPersona = *pBuf++;
657 len--;
658 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
659 return eSIR_FAILURE;
660
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -0800661
662 // Extract txLdpcIniFeatureEnabled
663 pStartBssReq->txLdpcIniFeatureEnabled = *pBuf++;
664 len--;
665 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
666 return eSIR_FAILURE;
667
Chet Lanctot8cecea22014-02-11 19:09:36 -0800668#ifdef WLAN_FEATURE_11W
669 // Extract MFP capable/required
670 pStartBssReq->pmfCapable = *pBuf++;
671 len--;
672 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
673 return eSIR_FAILURE;
674 pStartBssReq->pmfRequired = *pBuf++;
675 len--;
676 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
677 return eSIR_FAILURE;
678#endif
679
Jeff Johnson295189b2012-06-20 16:38:30 -0700680 // Extract rsnIe
681 pStartBssReq->rsnIE.length = limGetU16(pBuf);
682 pBuf += sizeof(tANI_U16);
683
684 // Check for RSN IE length (that includes length of type & length
685 if (pStartBssReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2)
686 {
687 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700688 FL("Invalid RSN IE length %d in SME_START_BSS_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700689 pStartBssReq->rsnIE.length);
690 return eSIR_FAILURE;
691 }
692
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530693 vos_mem_copy( pStartBssReq->rsnIE.rsnIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -0700694 pBuf, pStartBssReq->rsnIE.length);
695
696 len -= (sizeof(tANI_U16) + pStartBssReq->rsnIE.length);
697 pBuf += pStartBssReq->rsnIE.length;
698 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
699 return eSIR_FAILURE;
700
701 // Extract nwType
702 pStartBssReq->nwType = (tSirNwType) limGetU32(pBuf);
703 pBuf += sizeof(tSirNwType);
704 len -= sizeof(tSirNwType);
705 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
706 return eSIR_FAILURE;
707
708 // Extract operationalRateSet
709 pStartBssReq->operationalRateSet.numRates = *pBuf++;
710
711 // Check for number of rates
712 if (pStartBssReq->operationalRateSet.numRates >
713 SIR_MAC_MAX_NUMBER_OF_RATES)
714 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700715 limLog(pMac, LOGW, FL("Invalid numRates %d in SME_START_BSS_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700716 pStartBssReq->operationalRateSet.numRates);
717 return eSIR_FAILURE;
718 }
719
720 len--;
721 if (len < pStartBssReq->operationalRateSet.numRates)
722 return eSIR_FAILURE;
723
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530724 vos_mem_copy( (tANI_U8 *) pStartBssReq->operationalRateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -0700725 pBuf,
726 pStartBssReq->operationalRateSet.numRates);
727 pBuf += pStartBssReq->operationalRateSet.numRates;
728 len -= pStartBssReq->operationalRateSet.numRates;
729
730 // Extract extendedRateSet
731 if ((pStartBssReq->nwType == eSIR_11G_NW_TYPE) ||
732 (pStartBssReq->nwType == eSIR_11N_NW_TYPE ))
733 {
734 pStartBssReq->extendedRateSet.numRates = *pBuf++;
735 len--;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530736 vos_mem_copy( pStartBssReq->extendedRateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -0700737 pBuf, pStartBssReq->extendedRateSet.numRates);
738 pBuf += pStartBssReq->extendedRateSet.numRates;
739 len -= pStartBssReq->extendedRateSet.numRates;
740 }
741
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +0530742#ifdef WLAN_FEATURE_AP_HT40_24G
743 /* extract apHT40_24GEnabled */
744 pStartBssReq->apHT40_24GEnabled = *pBuf++;
745 len--;
746#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700747 if (len)
748 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700749 limLog(pMac, LOGW, FL("Extra bytes left in SME_START_BSS_REQ, len=%d"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700750 }
751
752 return eSIR_SUCCESS;
753} /*** end limStartBssReqSerDes() ***/
754
755
756
757/**
758 * limStopBssReqSerDes()
759 *
760 *FUNCTION:
761 * This function is called by limProcessSmeMessages() upon receiving
762 * SME_STOP_BSS_REQ from host
763 *
764 *PARAMS:
765 *
766 *LOGIC:
767 *
768 *ASSUMPTIONS:
769 * NA
770 *
771 *NOTE:
772 * NA
773 *
774 * @param pStopBssReq Pointer to tSirSmeStopBssReq being extracted
775 * @param pBuf Pointer to serialized buffer
776 * @return retCode Indicates whether message is successfully
777 * de-serialized (eSIR_SUCCESS) or
778 * not (eSIR_FAILURE)
779 */
780
781tSirRetStatus
782limStopBssReqSerDes(tpAniSirGlobal pMac, tpSirSmeStopBssReq pStopBssReq, tANI_U8 *pBuf)
783{
784 tANI_S16 len = 0;
785
786#ifdef PE_DEBUG_LOG1
787 tANI_U8 *pTemp = pBuf;
788#endif
789
790 pStopBssReq->messageType = limGetU16(pBuf);
791 pBuf += sizeof(tANI_U16);
792
793 len = pStopBssReq->length = limGetU16(pBuf);
794 pBuf += sizeof(tANI_U16);
795
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700796 PELOG1(limLog(pMac, LOG1, FL("SME_STOP_BSS_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700797 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
798
799 if (len < (tANI_S16) sizeof(tANI_U32))
800 return eSIR_FAILURE;
801
802 len -= sizeof(tANI_U32); // skip message header
803 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
804 return eSIR_FAILURE;
805
806 // Extract sessionId
807 pStopBssReq->sessionId = *pBuf++;
808 len--;
809 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
810 return eSIR_FAILURE;
811
812 // Extract transactionId
813 pStopBssReq->transactionId = limGetU16(pBuf);
814 pBuf += sizeof(tANI_U16);
815 len -= sizeof(tANI_U16);
816
817 // Extract reasonCode
818 pStopBssReq->reasonCode = (tSirResultCodes) limGetU32(pBuf);
819 pBuf += sizeof(tSirResultCodes);
820 len -= sizeof(tSirResultCodes);
821
822 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530823 vos_mem_copy( (tANI_U8 *) pStopBssReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700824 len -= sizeof(tSirMacAddr);
825
826 if (len)
827 return eSIR_FAILURE;
828 else
829 return eSIR_SUCCESS;
830
831} /*** end limStopBssReqSerDes() ***/
832
833
834
835/**
836 * limJoinReqSerDes()
837 *
838 *FUNCTION:
839 * This function is called by limProcessSmeMessages() upon receiving
840 * SME_JOIN_REQ from host
841 *
842 *PARAMS:
843 *
844 *LOGIC:
845 *
846 *ASSUMPTIONS:
847 * NA
848 *
849 *NOTE:
850 * NA
851 *
852 * @param pJoinReq Pointer to tSirSmeJoinReq being extracted
853 * @param pBuf Pointer to serialized buffer
854 * @return retCode Indicates whether message is successfully
855 * de-serialized (eSIR_SUCCESS) or
856 * not (eSIR_FAILURE)
857 */
858
859tSirRetStatus
860limJoinReqSerDes(tpAniSirGlobal pMac, tpSirSmeJoinReq pJoinReq, tANI_U8 *pBuf)
861{
862 tANI_S16 len = 0;
863 tANI_S16 lenUsed = 0;
864
865#ifdef PE_DEBUG_LOG1
866 tANI_U8 *pTemp = pBuf;
867#endif
868
869 if (!pJoinReq || !pBuf)
870 {
Abhishek Singh57aebef2014-02-03 18:47:44 +0530871 PELOGE(limLog(pMac, LOGE, FL("pJoinReq or pBuf is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700872 return eSIR_FAILURE;
873 }
874
875 // Extract messageType
876 pJoinReq->messageType = limGetU16(pBuf);
877 pBuf += sizeof(tANI_U16);
878
879 // Extract length
880 len = pJoinReq->length = limGetU16(pBuf);
881 pBuf += sizeof(tANI_U16);
882
883 if (pJoinReq->messageType == eWNI_SME_JOIN_REQ)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700884 PELOG1(limLog(pMac, LOG3, FL("SME_JOIN_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700885 else
Abhishek Singh57aebef2014-02-03 18:47:44 +0530886 PELOG1(limLog(pMac, LOG3, FL("SME_REASSOC_REQ length %d bytes is:"),
887 len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700888
889 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
890
891 if (len < (tANI_S16) sizeof(tANI_U32))
892 {
Abhishek Singh57aebef2014-02-03 18:47:44 +0530893 PELOGE(limLog(pMac, LOGE, FL("len %d is too short"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700894 return eSIR_FAILURE;
895 }
896
897 len -= sizeof(tANI_U32); // skip message header
898 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530899 {
900 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700901 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530902 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700903 // Extract sessionId
904 pJoinReq->sessionId = *pBuf++;
905 len--;
906 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530907 {
908 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700909 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530910 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700911 // Extract transactionId
912 pJoinReq->transactionId = limGetU16(pBuf);
913 pBuf += sizeof(tANI_U16);
914 len -= sizeof(tANI_U16);
915 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530916 {
917 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700918 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530919 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700920
921 // Extract ssId
922 pJoinReq->ssId.length = *pBuf++;
923 len--;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530924 vos_mem_copy( (tANI_U8 *) pJoinReq->ssId.ssId, pBuf, pJoinReq->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -0700925 pBuf += pJoinReq->ssId.length;
926 len -= pJoinReq->ssId.length;
927 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530928 {
929 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700930 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530931 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700932
933 // Extract selfMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530934 vos_mem_copy( pJoinReq->selfMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700935 pBuf += sizeof(tSirMacAddr);
936 len -= sizeof(tSirMacAddr);
937 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530938 {
939 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700940 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530941 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700942
943 // Extract bsstype
944 pJoinReq->bsstype = (tSirBssType) limGetU32(pBuf);
945 pBuf += sizeof(tANI_U32);
946 len -= sizeof(tANI_U32);
947 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530948 {
949 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700950 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530951 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700952
953 // Extract dot11mode
954 pJoinReq->dot11mode= *pBuf++;
955 len--;
956 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530957 {
958 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700959 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530960 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700961
962 // Extract bssPersona
963 pJoinReq->staPersona = *pBuf++;
964 len--;
965 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530966 {
967 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700968 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530969 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700970
Jeff Johnsone7245742012-09-05 17:12:55 -0700971 // Extract cbMode
972 pJoinReq->cbMode = *pBuf++;
973 len--;
974 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530975 {
976 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnsone7245742012-09-05 17:12:55 -0700977 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530978 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700979
Jeff Johnson295189b2012-06-20 16:38:30 -0700980 // Extract uapsdPerAcBitmask
981 pJoinReq->uapsdPerAcBitmask = *pBuf++;
982 len--;
983 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530984 {
985 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700986 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530987 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700988
Jeff Johnson295189b2012-06-20 16:38:30 -0700989
990 // Extract operationalRateSet
991 pJoinReq->operationalRateSet.numRates= *pBuf++;
992 len--;
993 if (pJoinReq->operationalRateSet.numRates)
994 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530995 vos_mem_copy( (tANI_U8 *) pJoinReq->operationalRateSet.rate, pBuf,
996 pJoinReq->operationalRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700997 pBuf += pJoinReq->operationalRateSet.numRates;
998 len -= pJoinReq->operationalRateSet.numRates;
999 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301000 {
1001 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001002 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301003 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001004 }
1005
1006 // Extract extendedRateSet
1007 pJoinReq->extendedRateSet.numRates = *pBuf++;
1008 len--;
1009 if (pJoinReq->extendedRateSet.numRates)
1010 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301011 vos_mem_copy( pJoinReq->extendedRateSet.rate, pBuf, pJoinReq->extendedRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07001012 pBuf += pJoinReq->extendedRateSet.numRates;
1013 len -= pJoinReq->extendedRateSet.numRates;
1014 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301015 {
1016 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001017 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301018 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001019 }
1020
1021 // Extract RSN IE
1022 pJoinReq->rsnIE.length = limGetU16(pBuf);
1023 pBuf += sizeof(tANI_U16);
1024 len -= sizeof(tANI_U16);
1025
1026 if (pJoinReq->rsnIE.length)
1027 {
1028 // Check for RSN IE length (that includes length of type & length)
1029 if ((pJoinReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2) ||
1030 (pJoinReq->rsnIE.length != 2 + *(pBuf + 1)))
1031 {
1032 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001033 FL("Invalid RSN IE length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001034 pJoinReq->rsnIE.length);
1035 return eSIR_FAILURE;
1036 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301037 vos_mem_copy( (tANI_U8 *) pJoinReq->rsnIE.rsnIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001038 pBuf, pJoinReq->rsnIE.length);
1039 pBuf += pJoinReq->rsnIE.length;
1040 len -= pJoinReq->rsnIE.length; // skip RSN IE
1041 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301042 {
1043 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001044 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301045 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001046 }
1047
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001048#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001049 // Extract CCKM IE
1050 pJoinReq->cckmIE.length = limGetU16(pBuf);
1051 pBuf += sizeof(tANI_U16);
1052 len -= sizeof(tANI_U16);
1053 if (pJoinReq->cckmIE.length)
1054 {
1055 // Check for CCKM IE length (that includes length of type & length)
1056 if ((pJoinReq->cckmIE.length > SIR_MAC_MAX_IE_LENGTH) ||
1057 (pJoinReq->cckmIE.length != (2 + *(pBuf + 1))))
1058 {
1059 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001060 FL("Invalid CCKM IE length %d/%d in SME_JOIN/REASSOC_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001061 pJoinReq->cckmIE.length, 2 + *(pBuf + 1));
1062 return eSIR_FAILURE;
1063 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301064 vos_mem_copy((tANI_U8 *) pJoinReq->cckmIE.cckmIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001065 pBuf, pJoinReq->cckmIE.length);
1066 pBuf += pJoinReq->cckmIE.length;
1067 len -= pJoinReq->cckmIE.length; // skip CCKM IE
1068 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301069 {
1070 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001071 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301072 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001073 }
1074#endif
1075
1076 // Extract Add IE for scan
1077 pJoinReq->addIEScan.length = limGetU16(pBuf);
1078 pBuf += sizeof(tANI_U16);
1079 len -= sizeof(tANI_U16);
1080
1081 if (pJoinReq->addIEScan.length)
1082 {
1083 // Check for IE length (that includes length of type & length)
1084 if (pJoinReq->addIEScan.length > SIR_MAC_MAX_IE_LENGTH + 2)
1085 {
1086 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001087 FL("Invalid addIE Scan length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001088 pJoinReq->addIEScan.length);
1089 return eSIR_FAILURE;
1090 }
1091 // Check for P2P IE length (that includes length of type & length)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301092 vos_mem_copy( (tANI_U8 *) pJoinReq->addIEScan.addIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001093 pBuf, pJoinReq->addIEScan.length);
1094 pBuf += pJoinReq->addIEScan.length;
1095 len -= pJoinReq->addIEScan.length; // skip add IE
1096 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301097 {
1098 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001099 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301100 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001101 }
1102
1103 pJoinReq->addIEAssoc.length = limGetU16(pBuf);
1104 pBuf += sizeof(tANI_U16);
1105 len -= sizeof(tANI_U16);
1106
1107 // Extract Add IE for assoc
1108 if (pJoinReq->addIEAssoc.length)
1109 {
1110 // Check for IE length (that includes length of type & length)
1111 if (pJoinReq->addIEAssoc.length > SIR_MAC_MAX_IE_LENGTH + 2)
1112 {
1113 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001114 FL("Invalid addIE Assoc length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001115 pJoinReq->addIEAssoc.length);
1116 return eSIR_FAILURE;
1117 }
1118 // Check for P2P IE length (that includes length of type & length)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301119 vos_mem_copy( (tANI_U8 *) pJoinReq->addIEAssoc.addIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001120 pBuf, pJoinReq->addIEAssoc.length);
1121 pBuf += pJoinReq->addIEAssoc.length;
1122 len -= pJoinReq->addIEAssoc.length; // skip add IE
1123 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301124 {
1125 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001126 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301127 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001128 }
1129
Venkata Prathyusha Kuntupallie8dc41d2013-04-15 14:31:36 -07001130 pJoinReq->UCEncryptionType = limGetU32(pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001131 pBuf += sizeof(tANI_U32);
1132 len -= sizeof(tANI_U32);
1133 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301134 {
1135 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1136 return eSIR_FAILURE;
1137 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001138
Venkata Prathyusha Kuntupallie8dc41d2013-04-15 14:31:36 -07001139 pJoinReq->MCEncryptionType = limGetU32(pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001140 pBuf += sizeof(tANI_U32);
1141 len -= sizeof(tANI_U32);
1142 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301143 {
1144 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1145 return eSIR_FAILURE;
1146 }
Chet Lanctot186b5732013-03-18 10:26:30 -07001147#ifdef WLAN_FEATURE_11W
1148 pJoinReq->MgmtEncryptionType = limGetU32(pBuf);
1149 pBuf += sizeof(tANI_U32);
1150 len -= sizeof(tANI_U32);
1151 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301152 {
1153 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Chet Lanctot186b5732013-03-18 10:26:30 -07001154 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301155 }
Chet Lanctot186b5732013-03-18 10:26:30 -07001156#endif
1157
Jeff Johnson295189b2012-06-20 16:38:30 -07001158#ifdef WLAN_FEATURE_VOWIFI_11R
1159 //is11Rconnection;
1160 pJoinReq->is11Rconnection = (tAniBool)limGetU32(pBuf);
1161 pBuf += sizeof(tAniBool);
1162 len -= sizeof(tAniBool);
1163 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301164 {
1165 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1166 return eSIR_FAILURE;
1167 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001168#endif
1169
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001170#ifdef FEATURE_WLAN_ESE
1171 //ESE version IE
1172 pJoinReq->isESEFeatureIniEnabled = (tAniBool)limGetU32(pBuf);
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05301173 pBuf += sizeof(tAniBool);
1174 len -= sizeof(tAniBool);
1175 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301176 {
1177 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05301178 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301179 }
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05301180
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001181 //isESEconnection;
1182 pJoinReq->isESEconnection = (tAniBool)limGetU32(pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001183 pBuf += sizeof(tAniBool);
1184 len -= sizeof(tAniBool);
1185 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301186 {
1187 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1188 return eSIR_FAILURE;
1189 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001190
1191 // TSPEC information
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001192 pJoinReq->eseTspecInfo.numTspecs = *pBuf++;
Jeff Johnson295189b2012-06-20 16:38:30 -07001193 len -= sizeof(tANI_U8);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001194 vos_mem_copy((void*)&pJoinReq->eseTspecInfo.tspec[0], pBuf,
1195 (sizeof(tTspecInfo)* pJoinReq->eseTspecInfo.numTspecs));
1196 pBuf += sizeof(tTspecInfo)*SIR_ESE_MAX_TSPEC_IES;
1197 len -= sizeof(tTspecInfo)*SIR_ESE_MAX_TSPEC_IES;
Jeff Johnson295189b2012-06-20 16:38:30 -07001198 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301199 {
1200 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001201 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301202 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001203#endif
1204
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001205#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07001206 //isFastTransitionEnabled;
1207 pJoinReq->isFastTransitionEnabled = (tAniBool)limGetU32(pBuf);
1208 pBuf += sizeof(tAniBool);
1209 len -= sizeof(tAniBool);
1210 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301211 {
1212 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1213 return eSIR_FAILURE;
1214 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001215#endif
1216
Jeff Johnson43971f52012-07-17 12:26:56 -07001217#ifdef FEATURE_WLAN_LFR
1218 //isFastRoamIniFeatureEnabled;
1219 pJoinReq->isFastRoamIniFeatureEnabled = (tAniBool)limGetU32(pBuf);
1220 pBuf += sizeof(tAniBool);
1221 len -= sizeof(tAniBool);
1222 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301223 {
1224 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1225 return eSIR_FAILURE;
1226 }
Jeff Johnson43971f52012-07-17 12:26:56 -07001227#endif
1228
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001229 //txLdpcIniFeatureEnabled
1230 pJoinReq->txLdpcIniFeatureEnabled= *pBuf++;
1231 len--;
1232 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301233 {
1234 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001235 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301236 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301237#ifdef WLAN_FEATURE_11AC
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001238 //txBFIniFeatureEnabled
1239 pJoinReq->txBFIniFeatureEnabled= *pBuf++;
1240 len--;
1241 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301242 {
1243 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001244 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301245 }
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001246
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001247 //txBFCsnValue
1248 pJoinReq->txBFCsnValue= *pBuf++;
1249 len--;
1250 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301251 {
1252 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001253 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301254 }
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001255
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301256 //MuBformee
1257 pJoinReq->txMuBformee= *pBuf++;
1258 len--;
1259 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1260 {
1261 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1262 return eSIR_FAILURE;
1263 }
1264#endif
1265
krunal soni5afa96c2013-09-06 22:19:02 -07001266 pJoinReq->isAmsduSupportInAMPDU= *pBuf++;
1267 len--;
1268 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301269 {
1270 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
krunal soni5afa96c2013-09-06 22:19:02 -07001271 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301272 }
krunal soni5afa96c2013-09-06 22:19:02 -07001273
Sandeep Puligillaaea98a22013-12-04 13:36:32 +05301274 pJoinReq->isWMEenabled = (tAniBool)limGetU32(pBuf);
1275 pBuf += sizeof(tAniBool);
1276 len -= sizeof(tAniBool);
1277 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1278 return eSIR_FAILURE;
1279
1280 pJoinReq->isQosEnabled = (tAniBool)limGetU32(pBuf);
1281 pBuf += sizeof(tAniBool);
1282 len -= sizeof(tAniBool);
1283 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1284 return eSIR_FAILURE;
1285
Jeff Johnson295189b2012-06-20 16:38:30 -07001286 // Extract Titan CB Neighbor BSS info
1287 pJoinReq->cbNeighbors.cbBssFoundPri = *pBuf;
1288 pBuf++;
1289 pJoinReq->cbNeighbors.cbBssFoundSecUp = *pBuf;
1290 pBuf++;
1291 pJoinReq->cbNeighbors.cbBssFoundSecDown = *pBuf;
1292 pBuf++;
1293 len -= 3;
1294
1295 // Extract Spectrum Mgt Indicator
1296 pJoinReq->spectrumMgtIndicator = (tAniBool) limGetU32(pBuf);
1297 pBuf += sizeof(tAniBool);
1298 len -= sizeof(tAniBool);
1299
1300 pJoinReq->powerCap.minTxPower = *pBuf++;
1301 pJoinReq->powerCap.maxTxPower = *pBuf++;
1302 len -=2;
Jeff Johnson295189b2012-06-20 16:38:30 -07001303
1304 pJoinReq->supportedChannels.numChnl = *pBuf++;
1305 len--;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301306 vos_mem_copy( (tANI_U8 *) pJoinReq->supportedChannels.channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001307 pBuf, pJoinReq->supportedChannels.numChnl);
1308 pBuf += pJoinReq->supportedChannels.numChnl;
1309 len-= pJoinReq->supportedChannels.numChnl;
1310
Abhishek Singh525045c2014-12-15 17:18:45 +05301311 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001312 FL("spectrumInd ON: minPower %d, maxPower %d , numChnls %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001313 pJoinReq->powerCap.minTxPower,
1314 pJoinReq->powerCap.maxTxPower,
Abhishek Singh525045c2014-12-15 17:18:45 +05301315 pJoinReq->supportedChannels.numChnl);
Jeff Johnson295189b2012-06-20 16:38:30 -07001316
1317 // Extract uapsdPerAcBitmask
1318 pJoinReq->uapsdPerAcBitmask = *pBuf++;
1319 len--;
1320 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301321 {
1322 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001323 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301324 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001325
Jeff Johnson295189b2012-06-20 16:38:30 -07001326 //
1327 // NOTE - tSirBssDescription is now moved to the end
1328 // of tSirSmeJoinReq structure. This is to accomodate
1329 // the variable length data member ieFields[1]
1330 //
1331 if (limGetBssDescription( pMac, &pJoinReq->bssDescription,
1332 len, &lenUsed, pBuf) == eSIR_FAILURE)
1333 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001334 PELOGE(limLog(pMac, LOGE, FL("get bss description failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001335 return eSIR_FAILURE;
1336 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05301337 PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3,
1338 (tANI_U8 *) &(pJoinReq->bssDescription),
1339 pJoinReq->bssDescription.length + 2);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001340 pBuf += lenUsed;
1341 len -= lenUsed;
Jeff Johnson295189b2012-06-20 16:38:30 -07001342
1343 return eSIR_SUCCESS;
1344} /*** end limJoinReqSerDes() ***/
1345
1346
1347/**---------------------------------------------------------------
1348\fn limAssocIndSerDes
1349\brief This function is called by limProcessMlmAssocInd() to
1350\ populate the SME_ASSOC_IND message based on the received
1351\ MLM_ASSOC_IND.
1352\
1353\param pMac
1354\param pAssocInd - Pointer to the received tLimMlmAssocInd
1355\param pBuf - Pointer to serialized buffer
1356\param psessionEntry - pointer to PE session entry
1357\
1358\return None
1359------------------------------------------------------------------*/
1360void
1361limAssocIndSerDes(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
1362{
1363 tANI_U8 *pLen = pBuf;
1364 tANI_U16 mLen = 0;
1365
1366#ifdef PE_DEBUG_LOG1
1367 tANI_U8 *pTemp = pBuf;
1368#endif
1369
Jeff Johnson295189b2012-06-20 16:38:30 -07001370
1371 mLen = sizeof(tANI_U32);
1372 mLen += sizeof(tANI_U8);
1373 pBuf += sizeof(tANI_U16);
1374 *pBuf = psessionEntry->smeSessionId;
1375 pBuf += sizeof(tANI_U8);
1376
1377 // Fill in peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301378 vos_mem_copy( pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001379 pBuf += sizeof(tSirMacAddr);
1380 mLen += sizeof(tSirMacAddr);
1381
1382 // Fill in aid
1383 limCopyU16(pBuf, pAssocInd->aid);
1384 pBuf += sizeof(tANI_U16);
1385 mLen += sizeof(tANI_U16);
1386
1387 // Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301388 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001389 pBuf += sizeof(tSirMacAddr);
1390 mLen += sizeof(tSirMacAddr);
1391
1392 // Fill in staId
1393 limCopyU16(pBuf, psessionEntry->staId);
1394 pBuf += sizeof(tANI_U16);
1395 mLen += sizeof(tANI_U16);
1396
1397 // Fill in authType
1398 limCopyU32(pBuf, pAssocInd->authType);
1399 pBuf += sizeof(tANI_U32);
1400 mLen += sizeof(tANI_U32);
1401
1402 // Fill in ssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301403 vos_mem_copy( pBuf, (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001404 pBuf += (1 + pAssocInd->ssId.length);
1405 mLen += (1 + pAssocInd->ssId.length);
1406
1407 // Fill in rsnIE
1408 limCopyU16(pBuf, pAssocInd->rsnIE.length);
1409 pBuf += sizeof(tANI_U16);
1410 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301411 vos_mem_copy( pBuf, (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001412 pAssocInd->rsnIE.length);
1413 pBuf += pAssocInd->rsnIE.length;
1414 mLen += pAssocInd->rsnIE.length;
1415
Jeff Johnson295189b2012-06-20 16:38:30 -07001416
Jeff Johnson295189b2012-06-20 16:38:30 -07001417 limCopyU32(pBuf, pAssocInd->spectrumMgtIndicator);
1418 pBuf += sizeof(tAniBool);
1419 mLen += sizeof(tAniBool);
1420
1421 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1422 {
1423 *pBuf = pAssocInd->powerCap.minTxPower;
1424 pBuf++;
1425 *pBuf = pAssocInd->powerCap.maxTxPower;
1426 pBuf++;
1427 mLen += sizeof(tSirMacPowerCapInfo);
1428
1429 *pBuf = pAssocInd->supportedChannels.numChnl;
1430 pBuf++;
1431 mLen++;
1432
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301433 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -07001434 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
1435 pAssocInd->supportedChannels.numChnl);
1436
1437
1438 pBuf += pAssocInd->supportedChannels.numChnl;
1439 mLen += pAssocInd->supportedChannels.numChnl;
1440 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001441 limCopyU32(pBuf, pAssocInd->WmmStaInfoPresent);
1442 pBuf += sizeof(tANI_U32);
1443 mLen += sizeof(tANI_U32);
Hardik Kantilal Patel1ba630f2014-11-21 04:32:05 +05301444
1445#ifdef WLAN_FEATURE_AP_HT40_24G
1446 limCopyU32(pBuf, pAssocInd->HT40MHzIntoPresent);
1447 pBuf += sizeof(tANI_U32);
1448 mLen += sizeof(tANI_U32);
1449#endif
1450
Jeff Johnson295189b2012-06-20 16:38:30 -07001451 // Fill in length of SME_ASSOC_IND message
1452 limCopyU16(pLen, mLen);
1453
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001454 PELOG1(limLog(pMac, LOG1, FL("Sending SME_ASSOC_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001455 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1456} /*** end limAssocIndSerDes() ***/
1457
1458
1459
1460/**
1461 * limAssocCnfSerDes()
1462 *
1463 *FUNCTION:
1464 * This function is called by limProcessLmmMessages() when
1465 * SME_ASSOC_CNF or SME_REASSOC_CNF message is received from
1466 * upper layer software.
1467 *
1468 *PARAMS:
1469 *
1470 *LOGIC:
1471 *
1472 *ASSUMPTIONS:
1473 * NA
1474 *
1475 *NOTE:
1476 * NA
1477 *
1478 * @param pAssocCnf Pointer to tSirSmeAssocCnf being extracted into
1479 * @param pBuf Pointer to serialized buffer
1480 * @return retCode Indicates whether message is successfully
1481 * de-serialized (eSIR_SUCCESS) or
1482 * not (eSIR_FAILURE)
1483 */
1484
1485tSirRetStatus
1486limAssocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeAssocCnf pAssocCnf, tANI_U8 *pBuf)
1487{
1488#ifdef PE_DEBUG_LOG1
1489 tANI_U8 *pTemp = pBuf;
1490#endif
1491
1492 if (!pAssocCnf || !pBuf)
1493 return eSIR_FAILURE;
1494
1495 pAssocCnf->messageType = limGetU16(pBuf);
1496 pBuf += sizeof(tANI_U16);
1497
1498 pAssocCnf->length = limGetU16(pBuf);
1499 pBuf += sizeof(tANI_U16);
1500
1501 if (pAssocCnf->messageType == eWNI_SME_ASSOC_CNF)
1502 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001503 PELOG1(limLog(pMac, LOG1, FL("SME_ASSOC_CNF length %d bytes is:"), pAssocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001504 }
1505 else
1506 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001507 PELOG1(limLog(pMac, LOG1, FL("SME_REASSOC_CNF length %d bytes is:"), pAssocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001508 }
1509 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pAssocCnf->length);)
1510
1511 // status code
1512 pAssocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
1513 pBuf += sizeof(tSirResultCodes);
1514
1515 // bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301516 vos_mem_copy( pAssocCnf->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001517 pBuf += sizeof(tSirMacAddr);
1518
1519 // peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301520 vos_mem_copy( pAssocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001521 pBuf += sizeof(tSirMacAddr);
1522
1523
1524 pAssocCnf->aid = limGetU16(pBuf);
1525 pBuf += sizeof(tANI_U16);
1526 // alternateBssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301527 vos_mem_copy( pAssocCnf->alternateBssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001528 pBuf += sizeof(tSirMacAddr);
1529
1530 // alternateChannelId
1531 pAssocCnf->alternateChannelId = *pBuf;
1532 pBuf++;
1533
1534 return eSIR_SUCCESS;
1535} /*** end limAssocCnfSerDes() ***/
1536
1537
1538
1539/**
1540 * limDisassocCnfSerDes()
1541 *
1542 *FUNCTION:
1543 * This function is called by limProcessSmeMessages() when
1544 * SME_DISASSOC_CNF message is received from upper layer software.
1545 *
1546 *PARAMS:
1547 *
1548 *LOGIC:
1549 *
1550 *ASSUMPTIONS:
1551 * NA
1552 *
1553 *NOTE:
1554 * NA
1555 *
1556 * @param pDisassocCnf Pointer to tSirSmeDisassocCnf being
1557 * extracted into
1558 * @param pBuf Pointer to serialized buffer
1559 * @return retCode Indicates whether message is successfully
1560 * de-serialized (eSIR_SUCCESS) or
1561 * not (eSIR_FAILURE)
1562 */
1563
1564tSirRetStatus
1565limDisassocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeDisassocCnf pDisassocCnf, tANI_U8 *pBuf)
1566{
1567#ifdef PE_DEBUG_LOG1
1568 tANI_U8 *pTemp = pBuf;
1569#endif
1570
1571 if (!pDisassocCnf || !pBuf)
1572 return eSIR_FAILURE;
1573
1574 pDisassocCnf->messageType = limGetU16(pBuf);
1575 pBuf += sizeof(tANI_U16);
1576
1577 pDisassocCnf->length = limGetU16(pBuf);
1578 pBuf += sizeof(tANI_U16);
1579
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001580 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_CNF length %d bytes is:"), pDisassocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001581 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pDisassocCnf->length);)
1582
1583 pDisassocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
1584 pBuf += sizeof(tSirResultCodes);
1585
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301586 vos_mem_copy( pDisassocCnf->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001587 pBuf += sizeof(tSirMacAddr);
Jeff Johnson62c27982013-02-27 17:53:55 -08001588
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301589 vos_mem_copy( pDisassocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001590
Jeff Johnson62c27982013-02-27 17:53:55 -08001591
Jeff Johnson295189b2012-06-20 16:38:30 -07001592 return eSIR_SUCCESS;
1593} /*** end limDisassocCnfSerDes() ***/
1594
1595
1596
Jeff Johnson295189b2012-06-20 16:38:30 -07001597
1598
1599/**---------------------------------------------------------------
1600\fn limReassocIndSerDes
1601\brief This function is called by limProcessMlmReassocInd() to
1602\ populate the SME_REASSOC_IND message based on the received
1603\ MLM_REASSOC_IND.
1604\
1605\param pMac
1606\param pReassocInd - Pointer to the received tLimMlmReassocInd
1607\param pBuf - Pointer to serialized buffer
1608\param psessionEntry - pointer to PE session entry
1609\
1610\return None
1611------------------------------------------------------------------*/
1612void
1613limReassocIndSerDes(tpAniSirGlobal pMac, tpLimMlmReassocInd pReassocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
1614{
1615 tANI_U8 *pLen = pBuf;
1616 tANI_U16 mLen = 0;
1617
1618#ifdef PE_DEBUG_LOG1
1619 tANI_U8 *pTemp = pBuf;
1620#endif
1621
Jeff Johnson295189b2012-06-20 16:38:30 -07001622
1623 mLen = sizeof(tANI_U32);
1624 pBuf += sizeof(tANI_U16);
1625 *pBuf++ = psessionEntry->smeSessionId;
1626 mLen += sizeof(tANI_U8);
1627
1628 // Fill in peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301629 vos_mem_copy( pBuf, pReassocInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001630 pBuf += sizeof(tSirMacAddr);
1631 mLen += sizeof(tSirMacAddr);
1632
1633 // Fill in oldMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301634 vos_mem_copy( pBuf, pReassocInd->currentApAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001635 pBuf += sizeof(tSirMacAddr);
1636 mLen += sizeof(tSirMacAddr);
1637
1638 // Fill in aid
1639 limCopyU16(pBuf, pReassocInd->aid);
1640 pBuf += sizeof(tANI_U16);
1641 mLen += sizeof(tANI_U16);
1642
1643 // Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301644 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001645 pBuf += sizeof(tSirMacAddr);
1646 mLen += sizeof(tSirMacAddr);
1647
1648 // Fill in staId
1649 limCopyU16(pBuf, psessionEntry->staId);
1650 pBuf += sizeof(tANI_U16);
1651 mLen += sizeof(tANI_U16);
1652
1653 // Fill in authType
1654 limCopyU32(pBuf, pReassocInd->authType);
1655 pBuf += sizeof(tAniAuthType);
1656 mLen += sizeof(tAniAuthType);
1657
1658 // Fill in ssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301659 vos_mem_copy( pBuf, (tANI_U8 *) &(pReassocInd->ssId),
Jeff Johnson295189b2012-06-20 16:38:30 -07001660 pReassocInd->ssId.length + 1);
1661 pBuf += 1 + pReassocInd->ssId.length;
1662 mLen += pReassocInd->ssId.length + 1;
1663
1664 // Fill in rsnIE
1665 limCopyU16(pBuf, pReassocInd->rsnIE.length);
1666 pBuf += sizeof(tANI_U16);
1667 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301668 vos_mem_copy( pBuf, (tANI_U8 *) &(pReassocInd->rsnIE.rsnIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001669 pReassocInd->rsnIE.length);
1670 pBuf += pReassocInd->rsnIE.length;
1671 mLen += pReassocInd->rsnIE.length;
1672
1673 // Fill in addIE
1674 limCopyU16(pBuf, pReassocInd->addIE.length);
1675 pBuf += sizeof(tANI_U16);
1676 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301677 vos_mem_copy( pBuf, (tANI_U8*) &(pReassocInd->addIE.addIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001678 pReassocInd->addIE.length);
1679 pBuf += pReassocInd->addIE.length;
1680 mLen += pReassocInd->addIE.length;
1681
Jeff Johnson295189b2012-06-20 16:38:30 -07001682
Jeff Johnson295189b2012-06-20 16:38:30 -07001683 limCopyU32(pBuf, pReassocInd->spectrumMgtIndicator);
1684 pBuf += sizeof(tAniBool);
1685 mLen += sizeof(tAniBool);
1686
1687 if (pReassocInd->spectrumMgtIndicator == eSIR_TRUE)
1688 {
1689 *pBuf = pReassocInd->powerCap.minTxPower;
1690 pBuf++;
1691 *pBuf = pReassocInd->powerCap.maxTxPower;
1692 pBuf++;
1693 mLen += sizeof(tSirMacPowerCapInfo);
1694
1695 *pBuf = pReassocInd->supportedChannels.numChnl;
1696 pBuf++;
1697 mLen++;
1698
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301699 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -07001700 (tANI_U8 *) &(pReassocInd->supportedChannels.channelList),
1701 pReassocInd->supportedChannels.numChnl);
1702
1703 pBuf += pReassocInd->supportedChannels.numChnl;
1704 mLen += pReassocInd->supportedChannels.numChnl;
1705 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001706 limCopyU32(pBuf, pReassocInd->WmmStaInfoPresent);
1707 pBuf += sizeof(tANI_U32);
1708 mLen += sizeof(tANI_U32);
Jeff Johnson295189b2012-06-20 16:38:30 -07001709
1710 // Fill in length of SME_REASSOC_IND message
1711 limCopyU16(pLen, mLen);
1712
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001713 PELOG1(limLog(pMac, LOG1, FL("Sending SME_REASSOC_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001714 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1715} /*** end limReassocIndSerDes() ***/
1716
1717
1718/**
1719 * limAuthIndSerDes()
1720 *
1721 *FUNCTION:
1722 * This function is called by limProcessMlmAuthInd() while sending
1723 * SME_AUTH_IND to host
1724 *
1725 *PARAMS:
1726 *
1727 *LOGIC:
1728 *
1729 *ASSUMPTIONS:
1730 * NA
1731 *
1732 *NOTE:
1733 * NA
1734 *
1735 * @param pAuthInd Pointer to tSirSmeAuthInd being sent
1736 * @param pBuf Pointer to serialized buffer
1737 *
1738 * @return None
1739 */
1740
1741void
1742limAuthIndSerDes(tpAniSirGlobal pMac, tpLimMlmAuthInd pAuthInd, tANI_U8 *pBuf)
1743{
1744 tANI_U8 *pLen = pBuf;
1745 tANI_U16 mLen = 0;
1746
1747#ifdef PE_DEBUG_LOG1
1748 tANI_U8 *pTemp = pBuf;
1749#endif
1750
1751 mLen = sizeof(tANI_U32);
1752 pBuf += sizeof(tANI_U16);
1753 *pBuf++ = pAuthInd->sessionId;
1754 mLen += sizeof(tANI_U8);
1755
1756 // BTAMP TODO: Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301757 vos_mem_set(pBuf, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001758 pBuf += sizeof(tSirMacAddr);
1759 mLen += sizeof(tSirMacAddr);
1760
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301761 vos_mem_copy( pBuf, pAuthInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001762 pBuf += sizeof(tSirMacAddr);
1763 mLen += sizeof(tSirMacAddr);
1764
1765 limCopyU32(pBuf, pAuthInd->authType);
1766 pBuf += sizeof(tAniAuthType);
1767 mLen += sizeof(tAniAuthType);
1768
1769 limCopyU16(pLen, mLen);
1770
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001771 PELOG1(limLog(pMac, LOG1, FL("Sending SME_AUTH_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001772 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1773} /*** end limAuthIndSerDes() ***/
1774
1775
1776
1777/**
1778 * limSetContextReqSerDes()
1779 *
1780 *FUNCTION:
1781 * This function is called by limProcessSmeMessages() upon receiving
1782 * SME_SETCONTEXT_REQ from host
1783 *
1784 *PARAMS:
1785 *
1786 *LOGIC:
1787 *
1788 *ASSUMPTIONS:
1789 * NA
1790 *
1791 *NOTE:
1792 * NA
1793 *
1794 * @param pSetContextReq Pointer to tSirSmeSetContextReq being
1795 * extracted
1796 * @param pBuf Pointer to serialized buffer
1797 *
1798 * @return retCode Indicates whether message is successfully
1799 * de-serialized (eSIR_SUCCESS) or
1800 * not (eSIR_FAILURE)
1801 */
1802
1803tSirRetStatus
1804limSetContextReqSerDes(tpAniSirGlobal pMac, tpSirSmeSetContextReq pSetContextReq, tANI_U8 *pBuf)
1805{
1806 tANI_S16 len = 0;
1807 tANI_U16 totalKeySize = sizeof(tANI_U8); // initialized to sizeof numKeys
1808 tANI_U8 numKeys;
1809 tANI_U8 *pKeys;
1810
1811#ifdef PE_DEBUG_LOG1
1812 tANI_U8 *pTemp = pBuf;
1813#endif
1814 if (!pSetContextReq || !pBuf)
1815 return eSIR_FAILURE;
1816
1817 pSetContextReq->messageType = limGetU16(pBuf);
1818 pBuf += sizeof(tANI_U16);
1819
1820 len = pSetContextReq->length = limGetU16(pBuf);
1821 pBuf += sizeof(tANI_U16);
1822
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001823 PELOG1(limLog(pMac, LOG1, FL("SME_SETCONTEXT_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001824 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
1825
1826 if (len < (tANI_S16) sizeof(tANI_U32))
1827 return eSIR_FAILURE;
1828
1829 len -= sizeof(tANI_U32); // skip message header
1830 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1831 return eSIR_FAILURE;
1832
1833 // Extract sessionId
1834 pSetContextReq->sessionId = *pBuf++;
1835 len--;
1836 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1837 return eSIR_FAILURE;
1838
1839 // Extract transactionId
1840 pSetContextReq->transactionId = sirReadU16N(pBuf);
1841 pBuf += sizeof(tANI_U16);
1842 len -= sizeof(tANI_U16);
1843 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1844 return eSIR_FAILURE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301845 vos_mem_copy( (tANI_U8 *) pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001846 pBuf, sizeof(tSirMacAddr));
1847 pBuf += sizeof(tSirMacAddr);
1848 len -= sizeof(tSirMacAddr);
1849 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1850 return eSIR_FAILURE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301851 vos_mem_copy( pSetContextReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001852 pBuf += sizeof(tSirMacAddr);
1853 len -= sizeof(tSirMacAddr);
1854 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1855 return eSIR_FAILURE;
1856
Jeff Johnson295189b2012-06-20 16:38:30 -07001857
1858// pSetContextReq->qosInfoPresent = limGetU32(pBuf);
1859// pBuf += sizeof(tAniBool);
1860
1861// if (pSetContextReq->qosInfoPresent)
1862// {
1863// len = limGetQosInfo(&pSetContextReq->qos, pBuf);
1864// pBuf += len;
1865// }
1866
1867 pSetContextReq->keyMaterial.length = limGetU16(pBuf);
1868 pBuf += sizeof(tANI_U16);
1869 len -= sizeof(tANI_U16);
1870 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1871 return eSIR_FAILURE;
1872
1873 pSetContextReq->keyMaterial.edType = (tAniEdType) limGetU32(pBuf);
1874 pBuf += sizeof(tAniEdType);
1875 len -= sizeof(tAniEdType);
1876 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1877 return eSIR_FAILURE;
1878
1879 numKeys = pSetContextReq->keyMaterial.numKeys = *pBuf++;
1880 len -= sizeof(numKeys);
1881
1882 if (numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
1883 return eSIR_FAILURE;
1884
1885 /** Initialize the Default Keys if no Keys are being sent from the upper layer*/
1886 if( limCheckRemainingLength(pMac, len) == eSIR_FAILURE) {
1887 tpSirKeys pKeyinfo = pSetContextReq->keyMaterial.key;
1888
1889 pKeyinfo->keyId = 0;
1890 pKeyinfo->keyDirection = eSIR_TX_RX;
1891 pKeyinfo->keyLength = 0;
1892
1893 if (!limIsAddrBC(pSetContextReq->peerMacAddr))
1894 pKeyinfo->unicast = 1;
1895 else
1896 pKeyinfo->unicast = 0;
1897 }else {
1898 pKeys = (tANI_U8 *) pSetContextReq->keyMaterial.key;
1899 do {
1900 tANI_U32 keySize = limGetKeysInfo(pMac, (tpSirKeys) pKeys,
1901 pBuf);
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05301902 vos_mem_zero(pBuf, keySize);
Jeff Johnson295189b2012-06-20 16:38:30 -07001903 pBuf += keySize;
1904 pKeys += sizeof(tSirKeys);
1905 totalKeySize += (tANI_U16) keySize;
1906 if (numKeys == 0)
1907 break;
1908 numKeys--;
1909 }while (numKeys);
1910 }
1911 return eSIR_SUCCESS;
1912} /*** end limSetContextReqSerDes() ***/
1913
1914/**
1915 * limRemoveKeyReqSerDes()
1916 *
1917 *FUNCTION:
1918 * This function is called by limProcessSmeMessages() upon receiving
1919 * SME_REMOVEKEY_REQ from host
1920 *
1921 *PARAMS:
1922 *
1923 *LOGIC:
1924 *
1925 *ASSUMPTIONS:
1926 * NA
1927 *
1928 *NOTE:
1929 * NA
1930 *
1931 * @param pRemoveKeyReq Pointer to tSirSmeRemoveKeyReq being
1932 * extracted
1933 * @param pBuf Pointer to serialized buffer
1934 *
1935 * @return retCode Indicates whether message is successfully
1936 * de-serialized (eSIR_SUCCESS) or
1937 * not (eSIR_FAILURE)
1938 */
1939
1940tSirRetStatus
1941limRemoveKeyReqSerDes(tpAniSirGlobal pMac, tpSirSmeRemoveKeyReq pRemoveKeyReq, tANI_U8 *pBuf)
1942{
1943 tANI_S16 len = 0;
1944
1945#ifdef PE_DEBUG_LOG1
1946 tANI_U8 *pTemp = pBuf;
1947#endif
1948 if (!pRemoveKeyReq || !pBuf)
1949 return eSIR_FAILURE;
1950
1951 pRemoveKeyReq->messageType = limGetU16(pBuf);
1952 pBuf += sizeof(tANI_U16);
1953
1954 len = pRemoveKeyReq->length = limGetU16(pBuf);
1955 pBuf += sizeof(tANI_U16);
1956
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001957 PELOG1(limLog(pMac, LOG1, FL("SME_REMOVEKEY_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001958 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
1959
1960 if (len < (tANI_S16) sizeof(tANI_U32))
1961 return eSIR_FAILURE;
1962
1963 len -= sizeof(tANI_U32); // skip message header
1964 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1965 return eSIR_FAILURE;
1966
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301967 vos_mem_copy( (tANI_U8 *) pRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001968 pBuf, sizeof(tSirMacAddr));
1969 pBuf += sizeof(tSirMacAddr);
1970 len -= sizeof(tSirMacAddr);
1971 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1972 return eSIR_FAILURE;
1973
Jeff Johnson295189b2012-06-20 16:38:30 -07001974
1975 pRemoveKeyReq->edType = *pBuf;
1976 pBuf += sizeof(tANI_U8);
1977 len -= sizeof(tANI_U8);
1978 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1979 return eSIR_FAILURE;
1980
1981 pRemoveKeyReq->wepType = *pBuf;
1982
1983 pBuf += sizeof(tANI_U8);
1984 len -= sizeof(tANI_U8);
1985 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1986 return eSIR_FAILURE;
1987
1988 pRemoveKeyReq->keyId = *pBuf;
1989
1990 pBuf += sizeof(tANI_U8);
1991 len -= sizeof(tANI_U8);
1992 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1993 return eSIR_FAILURE;
1994
1995 pRemoveKeyReq->unicast = *pBuf;
1996 len--;
1997 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1998 return eSIR_FAILURE;
1999
2000 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302001 vos_mem_copy( pRemoveKeyReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002002 pBuf += sizeof(tSirMacAddr);
2003 len -= sizeof(tSirMacAddr);
2004 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2005 return eSIR_FAILURE;
2006
2007 // Extract sessionId
2008 pRemoveKeyReq->sessionId = *pBuf++;
2009 len--;
2010 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2011 return eSIR_FAILURE;
2012
2013 // Extract transactionId
2014 pRemoveKeyReq->transactionId = sirReadU16N(pBuf);
2015 pBuf += sizeof(tANI_U16);
2016 len -= sizeof(tANI_U16);
2017 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2018 return eSIR_FAILURE;
2019
2020 return eSIR_SUCCESS;
2021} /*** end limRemoveKeyReqSerDes() ***/
2022
2023
2024
2025/**
2026 * limDisassocReqSerDes()
2027 *
2028 *FUNCTION:
2029 * This function is called by limProcessSmeMessages() upon receiving
2030 * SME_DISASSOC_REQ from host
2031 *
2032 *PARAMS:
2033 *
2034 *LOGIC:
2035 *
2036 *ASSUMPTIONS:
2037 * NA
2038 *
2039 *NOTE:
2040 * NA
2041 *
2042 * @param pDisassocReq Pointer to tSirSmeDisassocReq being extracted
2043 * @param pBuf Pointer to serialized buffer
2044 *
2045 * @return retCode Indicates whether message is successfully
2046 * de-serialized (eSIR_SUCCESS) or
2047 * not (eSIR_FAILURE)
2048 */
2049
2050tSirRetStatus
2051limDisassocReqSerDes(tpAniSirGlobal pMac, tSirSmeDisassocReq *pDisassocReq, tANI_U8 *pBuf)
2052{
2053 tANI_S16 len = 0;
2054#ifdef PE_DEBUG_LOG1
2055 tANI_U8 *pTemp = pBuf;
2056#endif
2057
2058 if (!pDisassocReq || !pBuf)
2059 return eSIR_FAILURE;
2060
2061 pDisassocReq->messageType = limGetU16(pBuf);
2062 pBuf += sizeof(tANI_U16);
2063
2064 len = pDisassocReq->length = limGetU16(pBuf);
2065 pBuf += sizeof(tANI_U16);
2066
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002067 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002068 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2069
2070 if (len < (tANI_S16) sizeof(tANI_U32))
2071 return eSIR_FAILURE;
2072
2073 len -= sizeof(tANI_U32); // skip message header
2074 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2075 return eSIR_FAILURE;
2076
2077 // Extract sessionID
2078 pDisassocReq->sessionId = *pBuf;
2079 pBuf += sizeof(tANI_U8);
2080 len -= sizeof(tANI_U8);
2081 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2082 return eSIR_FAILURE;
2083
2084 // Extract transactionid
2085 pDisassocReq->transactionId = limGetU16(pBuf);
2086 pBuf += sizeof(tANI_U16);
2087 len -= sizeof(tANI_U16);
2088 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2089 return eSIR_FAILURE;
2090
2091 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302092 vos_mem_copy( (tANI_U8 *) pDisassocReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002093 pBuf += sizeof(tSirMacAddr);
2094 len -= sizeof(tSirMacAddr);
2095 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2096 return eSIR_FAILURE;
2097
2098 // Extract peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302099 vos_mem_copy( pDisassocReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002100 pBuf += sizeof(tSirMacAddr);
2101 len -= sizeof(tSirMacAddr);
2102 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2103 return eSIR_FAILURE;
2104
2105 // Extract reasonCode
2106 pDisassocReq->reasonCode = limGetU16(pBuf);
2107 pBuf += sizeof(tANI_U16);
2108 len -= sizeof(tANI_U16);
2109 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2110 return eSIR_FAILURE;
2111
2112 pDisassocReq->doNotSendOverTheAir = *pBuf;
2113 pBuf += sizeof(tANI_U8);
2114 len -= sizeof(tANI_U8);
2115
Jeff Johnson295189b2012-06-20 16:38:30 -07002116
2117 return eSIR_SUCCESS;
2118} /*** end limDisassocReqSerDes() ***/
2119
2120
2121
2122/**
2123 * limDeauthReqSerDes()
2124 *
2125 *FUNCTION:
2126 * This function is called by limProcessSmeMessages() upon receiving
2127 * SME_DEAUTH_REQ from host
2128 *
2129 *PARAMS:
2130 *
2131 *LOGIC:
2132 *
2133 *ASSUMPTIONS:
2134 * NA
2135 *
2136 *NOTE:
2137 * NA
2138 *
2139 * @param pDeauthReq Pointer to tSirSmeDeauthReq being extracted
2140 * @param pBuf Pointer to serialized buffer
2141 *
2142 * @return retCode Indicates whether message is successfully
2143 * de-serialized (eSIR_SUCCESS) or
2144 * not (eSIR_FAILURE)
2145 */
2146tSirRetStatus
2147limDeauthReqSerDes(tpAniSirGlobal pMac, tSirSmeDeauthReq *pDeauthReq, tANI_U8 *pBuf)
2148{
2149 tANI_S16 len = 0;
2150
2151#ifdef PE_DEBUG_LOG1
2152 tANI_U8 *pTemp = pBuf;
2153#endif
2154
2155 if (!pDeauthReq || !pBuf)
2156 return eSIR_FAILURE;
2157
2158 pDeauthReq->messageType = limGetU16(pBuf);
2159 pBuf += sizeof(tANI_U16);
2160
2161 len = pDeauthReq->length = limGetU16(pBuf);
2162 pBuf += sizeof(tANI_U16);
2163
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002164 PELOG1(limLog(pMac, LOG1, FL("SME_DEAUTH_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002165 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2166
2167 if (len < (tANI_S16) sizeof(tANI_U32))
2168 return eSIR_FAILURE;
2169
2170 len -= sizeof(tANI_U32); // skip message header
2171 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2172 return eSIR_FAILURE;
2173
2174 // Extract sessionId
2175 pDeauthReq->sessionId = *pBuf++;
2176 len--;
2177 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2178 return eSIR_FAILURE;
2179
2180 // Extract transactionId
2181 pDeauthReq->transactionId = limGetU16(pBuf);
2182 pBuf += sizeof(tANI_U16);
2183 len -= sizeof(tANI_U16);
2184 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2185 return eSIR_FAILURE;
2186
2187 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302188 vos_mem_copy( pDeauthReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002189 pBuf += sizeof(tSirMacAddr);
2190 len -= sizeof(tSirMacAddr);
2191 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2192 return eSIR_FAILURE;
2193
2194 // Extract peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302195 vos_mem_copy( pDeauthReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002196 pBuf += sizeof(tSirMacAddr);
2197 len -= sizeof(tSirMacAddr);
2198 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2199 return eSIR_FAILURE;
2200
2201 // Extract reasonCode
2202 pDeauthReq->reasonCode = limGetU16(pBuf);
2203 pBuf += sizeof(tANI_U16);
2204 len -= sizeof(tANI_U16);
2205
Jeff Johnson295189b2012-06-20 16:38:30 -07002206
2207 return eSIR_SUCCESS;
2208} /*** end limDisassocReqSerDes() ***/
2209
2210
2211
2212
Jeff Johnson295189b2012-06-20 16:38:30 -07002213
2214
2215/**
2216 * limStatSerDes()
2217 *
2218 *FUNCTION:
2219 * This function is called by limSendSmeDisassocNtf() while sending
2220 * SME_DISASSOC_IND/eWNI_SME_DISASSOC_RSP to host
2221 *
2222 *PARAMS:
2223 *
2224 *LOGIC:
2225 *
2226 *ASSUMPTIONS:
2227 * NA
2228 *
2229 *NOTE:
2230 * NA
2231 *
2232 * @param pAssocInd Pointer to tpAniStaStatStruct being sent
2233 * @param pBuf Pointer to serialized buffer
2234 *
2235 * @return None
2236 */
2237
2238void
2239limStatSerDes(tpAniSirGlobal pMac, tpAniStaStatStruct pStat, tANI_U8 *pBuf)
2240{
2241#ifdef PE_DEBUG_LOG1
2242 tANI_U8 *pTemp = pBuf;
2243#endif
2244
2245 limCopyU32(pBuf, pStat->sentAesBlksUcastHi);
2246 pBuf += sizeof(tANI_U32);
2247
2248 limCopyU32(pBuf, pStat->sentAesBlksUcastLo);
2249 pBuf += sizeof(tANI_U32);
2250
2251 limCopyU32(pBuf, pStat->recvAesBlksUcastHi);
2252 pBuf += sizeof(tANI_U32);
2253
2254 limCopyU32(pBuf, pStat->recvAesBlksUcastLo);
2255 pBuf += sizeof(tANI_U32);
2256
2257 limCopyU32(pBuf, pStat->aesFormatErrorUcastCnts);
2258 pBuf += sizeof(tANI_U32);
2259
2260 limCopyU32(pBuf, pStat->aesReplaysUcast);
2261 pBuf += sizeof(tANI_U32);
2262
2263 limCopyU32(pBuf, pStat->aesDecryptErrUcast);
2264 pBuf += sizeof(tANI_U32);
2265
2266 limCopyU32(pBuf, pStat->singleRetryPkts);
2267 pBuf += sizeof(tANI_U32);
2268
2269 limCopyU32(pBuf, pStat->failedTxPkts);
2270 pBuf += sizeof(tANI_U32);
2271
2272 limCopyU32(pBuf, pStat->ackTimeouts);
2273 pBuf += sizeof(tANI_U32);
2274
2275 limCopyU32(pBuf, pStat->multiRetryPkts);
2276 pBuf += sizeof(tANI_U32);
2277
2278 limCopyU32(pBuf, pStat->fragTxCntsHi);
2279 pBuf += sizeof(tANI_U32);
2280
2281 limCopyU32(pBuf, pStat->fragTxCntsLo);
2282 pBuf += sizeof(tANI_U32);
2283
2284 limCopyU32(pBuf, pStat->transmittedPktsHi);
2285 pBuf += sizeof(tANI_U32);
2286
2287 limCopyU32(pBuf, pStat->transmittedPktsLo);
2288 pBuf += sizeof(tANI_U32);
2289
2290 limCopyU32(pBuf, pStat->phyStatHi);
2291 pBuf += sizeof(tANI_U32);
2292
2293 limCopyU32(pBuf, pStat->phyStatLo);
2294 pBuf += sizeof(tANI_U32);
2295
2296 limCopyU32(pBuf, pStat->uplinkRssi);
2297 pBuf += sizeof(tANI_U32);
2298
2299 limCopyU32(pBuf, pStat->uplinkSinr);
2300 pBuf += sizeof(tANI_U32);
2301
2302 limCopyU32(pBuf, pStat->uplinkRate);
2303 pBuf += sizeof(tANI_U32);
2304
2305 limCopyU32(pBuf, pStat->downlinkRssi);
2306 pBuf += sizeof(tANI_U32);
2307
2308 limCopyU32(pBuf, pStat->downlinkSinr);
2309 pBuf += sizeof(tANI_U32);
2310
2311 limCopyU32(pBuf, pStat->downlinkRate);
2312 pBuf += sizeof(tANI_U32);
2313
2314 limCopyU32(pBuf, pStat->nRcvBytes);
2315 pBuf += sizeof(tANI_U32);
2316
2317 limCopyU32(pBuf, pStat->nXmitBytes);
2318 pBuf += sizeof(tANI_U32);
2319
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002320 PELOG1(limLog(pMac, LOG1, FL("STAT: length %d bytes is:"), sizeof(tAniStaStatStruct));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002321 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, sizeof(tAniStaStatStruct));)
2322
2323} /*** end limStatSerDes() ***/
2324
2325
Jeff Johnson295189b2012-06-20 16:38:30 -07002326
2327
2328/**
2329 * limPackBkgndScanFailNotify()
2330 *
2331 *FUNCTION:
2332 * This function is called by limSendSmeWmStatusChangeNtf()
2333 * to pack the tSirBackgroundScanInfo message
2334 *
2335 */
2336void
2337limPackBkgndScanFailNotify(tpAniSirGlobal pMac,
2338 tSirSmeStatusChangeCode statusChangeCode,
2339 tpSirBackgroundScanInfo pScanInfo,
2340 tSirSmeWmStatusChangeNtf *pSmeNtf,
2341 tANI_U8 sessionId)
2342{
2343
2344 tANI_U16 length = (sizeof(tANI_U16) * 2) + sizeof(tANI_U8) +
2345 sizeof(tSirSmeStatusChangeCode) +
2346 sizeof(tSirBackgroundScanInfo);
2347
Jeff Johnson295189b2012-06-20 16:38:30 -07002348 pSmeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
2349 pSmeNtf->statusChangeCode = statusChangeCode;
2350 pSmeNtf->length = length;
2351 pSmeNtf->sessionId = sessionId;
2352 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanSuccess = pScanInfo->numOfScanSuccess;
2353 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanFailure = pScanInfo->numOfScanFailure;
2354 pSmeNtf->statusChangeInfo.bkgndScanInfo.reserved = pScanInfo->reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07002355}
2356
Jeff Johnson295189b2012-06-20 16:38:30 -07002357
Jeff Johnson295189b2012-06-20 16:38:30 -07002358/**
2359 * limIsSmeGetAssocSTAsReqValid()
2360 *
2361 *FUNCTION:
2362 * This function is called by limProcessSmeReqMessages() upon
2363 * receiving SME_GET_ASSOC_STAS_REQ message from application.
2364 *
2365 *LOGIC:
2366 * Message validity checks are performed in this function
2367 *
2368 *ASSUMPTIONS:
2369 *
2370 *NOTE:
2371 *
2372 * @param pBuf - Pointer to a serialized SME_GET_ASSOC_STAS_REQ message
2373 * @param pSmeMsg - Pointer to a tSirSmeGetAssocSTAsReq structure
2374 * @return true if SME_GET_ASSOC_STAS_REQ message is formatted correctly
2375 * false otherwise
2376 */
2377tANI_BOOLEAN
2378limIsSmeGetAssocSTAsReqValid(tpAniSirGlobal pMac, tpSirSmeGetAssocSTAsReq pGetAssocSTAsReq, tANI_U8 *pBuf)
2379{
2380 tANI_S16 len = 0;
2381
2382 pGetAssocSTAsReq->messageType = limGetU16(pBuf);
2383 pBuf += sizeof(tANI_U16);
2384
2385 len = pGetAssocSTAsReq->length = limGetU16(pBuf);
2386 pBuf += sizeof(tANI_U16);
2387
2388 if (len < (tANI_S16) sizeof(tANI_U32))
Girish Gowliafd42312014-07-24 13:13:59 +05302389 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002390
2391 len -= sizeof(tANI_U32); // skip message header
2392 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Girish Gowliafd42312014-07-24 13:13:59 +05302393 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002394
2395 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302396 vos_mem_copy( (tANI_U8 *) pGetAssocSTAsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002397 pBuf += sizeof(tSirMacAddr);
2398 len -= sizeof(tSirMacAddr);
2399 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Girish Gowliafd42312014-07-24 13:13:59 +05302400 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002401
2402 // Extract modId
2403 pGetAssocSTAsReq->modId = limGetU16(pBuf);
2404 pBuf += sizeof(tANI_U16);
2405 len -= sizeof(tANI_U16);
2406 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Girish Gowliafd42312014-07-24 13:13:59 +05302407 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002408
2409 // Extract pUsrContext
krunal soni4f802b22014-02-11 17:01:13 -08002410 vos_mem_copy((tANI_U8 *)pGetAssocSTAsReq->pUsrContext, pBuf, sizeof(void*));
2411 pBuf += sizeof(void*);
2412 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002413 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Girish Gowliafd42312014-07-24 13:13:59 +05302414 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002415
2416 // Extract pSapEventCallback
krunal soni4f802b22014-02-11 17:01:13 -08002417 vos_mem_copy((tANI_U8 *)pGetAssocSTAsReq->pSapEventCallback, pBuf, sizeof(void*));
2418 pBuf += sizeof(void*);
2419 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002420 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Girish Gowliafd42312014-07-24 13:13:59 +05302421 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002422
2423 // Extract pAssocStasArray
krunal soni4f802b22014-02-11 17:01:13 -08002424 vos_mem_copy((tANI_U8 *)pGetAssocSTAsReq->pAssocStasArray, pBuf, sizeof(void*));
2425 pBuf += sizeof(void*);
2426 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002427
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002428 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002429
2430 if (len < 0)
2431 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002432 PELOGE(limLog(pMac, LOGE, FL("SME_GET_ASSOC_STAS_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002433 return eANI_BOOLEAN_FALSE;
2434 }
2435
2436 return eANI_BOOLEAN_TRUE;
2437}
2438
2439/**
2440 * limTkipCntrMeasReqSerDes()
2441 *
2442 *FUNCTION:
2443 * This function is called by limProcessSmeMessages() upon receiving
2444 * eWNI_SME_TKIP_CNTR_MEAS_REQ from host HDD
2445 *
2446 *PARAMS:
2447 *
2448 *LOGIC:
2449 *
2450 *ASSUMPTIONS:
2451 * NA
2452 *
2453 *NOTE:
2454 * NA
2455 *
2456 * @param tpSirSmeTkipCntrMeasReq Pointer to tSirSmeTkipCntrMeasReq being extracted
2457 * @param pBuf Pointer to serialized buffer
2458 * @return retCode Indicates whether message is successfully
2459 * de-serialized (eSIR_SUCCESS) or
2460 * not (eSIR_FAILURE)
2461 */
2462tSirRetStatus
2463limTkipCntrMeasReqSerDes(tpAniSirGlobal pMac, tpSirSmeTkipCntrMeasReq pTkipCntrMeasReq, tANI_U8 *pBuf)
2464{
2465 tANI_S16 len = 0;
2466
2467#ifdef PE_DEBUG_LOG1
2468 tANI_U8 *pTemp = pBuf;
2469#endif
2470
2471 pTkipCntrMeasReq->messageType = limGetU16(pBuf);
2472 pBuf += sizeof(tANI_U16);
2473
2474 len = pTkipCntrMeasReq->length = limGetU16(pBuf);
2475 pBuf += sizeof(tANI_U16);
2476
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002477 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002478 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2479
2480 if (len < (tANI_S16) sizeof(tANI_U32))
2481 return eSIR_FAILURE;
2482
2483 len -= sizeof(tANI_U32); // skip message header
2484 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2485 return eSIR_FAILURE;
2486
2487 // Extract sessionId
2488 pTkipCntrMeasReq->sessionId = *pBuf++;
2489 len--;
2490 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2491 return eSIR_FAILURE;
2492
2493 // Extract transactionId
2494 pTkipCntrMeasReq->transactionId = limGetU16(pBuf);
2495 pBuf += sizeof(tANI_U16);
2496 len -= sizeof(tANI_U16);
2497 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2498 return eSIR_FAILURE;
2499
2500 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302501 vos_mem_copy( (tANI_U8 *) pTkipCntrMeasReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002502 pBuf += sizeof(tSirMacAddr);
2503 len -= sizeof(tSirMacAddr);
2504 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2505 return eSIR_FAILURE;
2506
2507 // Extract bEnable
2508 pTkipCntrMeasReq->bEnable = *pBuf++;
2509 len --;
2510
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002511 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002512
2513 if (len)
2514 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002515 PELOGE(limLog(pMac, LOGE, FL("SME_TKIP_CNTR_MEAS_REQ invalid "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002516 return eSIR_FAILURE;
2517 }
2518 else
2519 return eSIR_SUCCESS;
2520}
2521
2522/**
2523 * limIsSmeGetWPSPBCSessionsReqValid()
2524 *
2525 *FUNCTION:
2526 * This function is called by limProcessSmeGetWPSPBCSessions() upon
2527 * receiving query WPS PBC overlap information message from application.
2528 *
2529 *LOGIC:
2530 * Message validity checks are performed in this function
2531 *
2532 *ASSUMPTIONS:
2533 *
2534 *NOTE:
2535 *
2536 * @param pBuf - Pointer to a serialized SME_GET_WPSPBC_SESSION_REQ message
2537 * @param pGetWPSPBCSessionsReq - Pointer to a tSirSmeGetWPSPBCSessionsReq structure
2538 * @return true if SME_GET_WPSPBC_SESSION_REQ message is formatted correctly
2539 * false otherwise
2540 */
2541
2542tSirRetStatus
2543limIsSmeGetWPSPBCSessionsReqValid(tpAniSirGlobal pMac, tSirSmeGetWPSPBCSessionsReq *pGetWPSPBCSessionsReq, tANI_U8 *pBuf)
2544{
2545 tANI_S16 len = 0;
2546
2547 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirSmeGetWPSPBCSessionsReq));)
2548
2549 pGetWPSPBCSessionsReq->messageType = limGetU16(pBuf);
2550 pBuf += sizeof(tANI_U16);
2551
2552 len = pGetWPSPBCSessionsReq->length = limGetU16(pBuf);
2553 pBuf += sizeof(tANI_U16);
2554
2555 if (len < (tANI_S16) sizeof(tANI_U32))
2556 return eSIR_FAILURE;
2557
2558 len -= sizeof(tANI_U32); // skip message header
2559 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2560 return eSIR_FAILURE;
2561
2562 // Extract pUsrContext
krunal soni4f802b22014-02-11 17:01:13 -08002563 vos_mem_copy((tANI_U8 *)pGetWPSPBCSessionsReq->pUsrContext, pBuf, sizeof(void*));
2564 pBuf += sizeof(void*);
2565 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002566 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2567 return eSIR_FAILURE;
2568
2569 // Extract pSapEventCallback
krunal soni4f802b22014-02-11 17:01:13 -08002570 vos_mem_copy((tANI_U8 *)pGetWPSPBCSessionsReq->pSapEventCallback, pBuf, sizeof(void*));
2571 pBuf += sizeof(void*);
2572 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002573 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2574 return eSIR_FAILURE;
2575
2576 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302577 vos_mem_copy( (tANI_U8 *) pGetWPSPBCSessionsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002578 pBuf += sizeof(tSirMacAddr);
2579 len -= sizeof(tSirMacAddr);
2580
2581 // Extract MAC address of Station to be removed
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302582 vos_mem_copy( (tANI_U8 *) pGetWPSPBCSessionsReq->pRemoveMac, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002583 pBuf += sizeof(tSirMacAddr);
2584 len -= sizeof(tSirMacAddr);
2585
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002586 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002587
2588 if (len < 0)
2589 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002590 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002591 return eSIR_FAILURE;
2592 }
2593
2594 return eSIR_SUCCESS;
2595}
2596
Jeff Johnson295189b2012-06-20 16:38:30 -07002597
2598/**---------------------------------------------------------------
2599\fn limGetSessionInfo
2600\brief This function returns the sessionId and transactionId
2601\ of a message. This assumes that the message structure
2602\ is of format:
2603\ tANI_U16 messageType
2604\ tANI_U16 messageLength
2605\ tANI_U8 sessionId
2606\ tANI_U16 transactionId
2607\param pMac - pMac global structure
2608\param *pBuf - pointer to the message buffer
2609\param sessionId - returned session id value
2610\param transactionId - returned transaction ID value
2611\return None
2612------------------------------------------------------------------*/
2613void
2614limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U8 *sessionId, tANI_U16 *transactionId)
2615{
2616 if (!pBuf)
2617 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002618 limLog(pMac, LOGE, FL("NULL ptr received. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002619 return;
2620 }
2621
2622 pBuf += sizeof(tANI_U16); // skip message type
2623 pBuf += sizeof(tANI_U16); // skip message length
2624
2625 *sessionId = *pBuf; // get sessionId
2626 pBuf++;
2627 *transactionId = limGetU16(pBuf); // get transactionId
2628
2629 return;
2630}
2631
Jeff Johnson295189b2012-06-20 16:38:30 -07002632
2633/**
2634 * limUpdateAPWPSIEsReqSerDes()
2635 *
2636 *FUNCTION:
2637 * This function is to deserialize UpdateAPWPSIEs message
2638 *
2639 *PARAMS:
2640 *
2641 *LOGIC:
2642 *
2643 *ASSUMPTIONS:
2644 * NA
2645 *
2646 *NOTE:
2647 * NA
2648 *
2649 * @param pUpdateAPWPSIEsReq Pointer to tSirUpdateAPWPSIEsReq being
2650 * extracted
2651 * @param pBuf Pointer to serialized buffer
2652 *
2653 * @return retCode Indicates whether message is successfully
2654 * de-serialized (eSIR_SUCCESS) or
2655 * not (eSIR_FAILURE)
2656 */
2657
2658tSirRetStatus
2659limUpdateAPWPSIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq, tANI_U8 *pBuf)
2660{
2661 tANI_S16 len = 0;
2662
2663 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPSIEsReq));)
2664
2665 if (!pUpdateAPWPSIEsReq || !pBuf)
2666 return eSIR_FAILURE;
2667
2668 pUpdateAPWPSIEsReq->messageType = limGetU16(pBuf);
2669 pBuf += sizeof(tANI_U16);
2670
2671 len = pUpdateAPWPSIEsReq->length = limGetU16(pBuf);
2672 pBuf += sizeof(tANI_U16);
2673
2674 if (len < (tANI_S16) sizeof(tANI_U32))
2675 return eSIR_FAILURE;
2676
2677 len -= sizeof(tANI_U32); // skip message header
2678 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2679 return eSIR_FAILURE;
2680
2681 // Extract transactionId
2682 pUpdateAPWPSIEsReq->transactionId = limGetU16( pBuf );
2683 pBuf += sizeof( tANI_U16 );
2684 len -= sizeof( tANI_U16 );
2685 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2686 return eSIR_FAILURE;
2687
2688 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302689 vos_mem_copy( (tANI_U8 *) pUpdateAPWPSIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002690 pBuf += sizeof(tSirMacAddr);
2691 len -= sizeof(tSirMacAddr);
2692 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2693 return eSIR_FAILURE;
2694
2695 // Extract sessionId
2696 pUpdateAPWPSIEsReq->sessionId = *pBuf++;
2697 len--;
2698 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2699 return eSIR_FAILURE;
2700
2701 // Extract APWPSIEs
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302702 vos_mem_copy( (tSirAPWPSIEs *) &pUpdateAPWPSIEsReq->APWPSIEs, pBuf, sizeof(tSirAPWPSIEs));
Jeff Johnson295189b2012-06-20 16:38:30 -07002703 pBuf += sizeof(tSirAPWPSIEs);
2704 len -= sizeof(tSirAPWPSIEs);
2705
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002706 PELOG1(limLog(pMac, LOG1, FL("SME_UPDATE_APWPSIE_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002707
2708 if (len < 0)
2709 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002710 PELOGE(limLog(pMac, LOGE, FL("SME_UPDATE_APWPSIE_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002711 return eSIR_FAILURE;
2712 }
2713
2714 return eSIR_SUCCESS;
2715} /*** end limSetContextReqSerDes() ***/
2716
2717/**
2718 * limUpdateAPWPARSNIEsReqSerDes ()
2719 *
2720 *FUNCTION:
2721 * This function is to deserialize UpdateAPWPSIEs message
2722 *
2723 *PARAMS:
2724 *
2725 *LOGIC:
2726 *
2727 *ASSUMPTIONS:
2728 * NA
2729 *
2730 *NOTE:
2731 * NA
2732 *
2733 * @param pUpdateAPWPARSNIEsReq Pointer to tpSirUpdateAPWPARSNIEsReq being
2734 * extracted
2735 * @param pBuf Pointer to serialized buffer
2736 *
2737 * @return retCode Indicates whether message is successfully
2738 * de-serialized (eSIR_SUCCESS) or
2739 * not (eSIR_FAILURE)
2740 */
2741
2742tSirRetStatus
2743limUpdateAPWPARSNIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq, tANI_U8 *pBuf)
2744{
2745 tANI_S16 len = 0;
2746
2747 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPARSNIEsReq));)
2748
2749 if (!pUpdateAPWPARSNIEsReq || !pBuf)
2750 return eSIR_FAILURE;
2751
2752 pUpdateAPWPARSNIEsReq->messageType = limGetU16(pBuf);
2753 pBuf += sizeof(tANI_U16);
2754
2755 len = pUpdateAPWPARSNIEsReq->length = limGetU16(pBuf);
2756 pBuf += sizeof(tANI_U16);
2757
2758 if (len < (tANI_S16) sizeof(tANI_U32))
2759 return eSIR_FAILURE;
2760
2761 len -= sizeof(tANI_U32); // skip message header
2762 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2763 return eSIR_FAILURE;
2764
2765 // Extract transactionId
2766 pUpdateAPWPARSNIEsReq->transactionId = limGetU16( pBuf );
2767 pBuf += sizeof(tANI_U16);
2768 len -= sizeof( tANI_U16 );
2769 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2770 return eSIR_FAILURE;
2771
2772 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302773 vos_mem_copy( (tANI_U8 *) pUpdateAPWPARSNIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002774 pBuf += sizeof(tSirMacAddr);
2775 len -= sizeof(tSirMacAddr);
2776 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2777 return eSIR_FAILURE;
2778
2779 // Extract sessionId
2780 pUpdateAPWPARSNIEsReq->sessionId = *pBuf++;
2781 len--;
2782 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2783 return eSIR_FAILURE;
2784
2785 // Extract APWPARSNIEs
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302786 vos_mem_copy( (tSirRSNie *) &pUpdateAPWPARSNIEsReq->APWPARSNIEs, pBuf, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07002787 pBuf += sizeof(tSirRSNie);
2788 len -= sizeof(tSirRSNie);
2789
2790 if (len < 0)
2791 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002792 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002793 return eSIR_FAILURE;
2794 }
2795
2796 return eSIR_SUCCESS;
2797} /*** end limUpdateAPWPARSNIEsReqSerDes() ***/
2798