blob: 879070395b53afae3c9db510d4cece3b4902a5b5 [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
Masti, Narayanraddi67ea5912015-01-08 12:34:05 +05301021 //Extract rateBitMap
1022 pJoinReq->rateBitMap = limGetU16(pBuf);
1023 pBuf += sizeof(tANI_U16);
1024 len -= sizeof(tANI_U16);
1025
Jeff Johnson295189b2012-06-20 16:38:30 -07001026 // Extract RSN IE
1027 pJoinReq->rsnIE.length = limGetU16(pBuf);
1028 pBuf += sizeof(tANI_U16);
1029 len -= sizeof(tANI_U16);
1030
1031 if (pJoinReq->rsnIE.length)
1032 {
1033 // Check for RSN IE length (that includes length of type & length)
1034 if ((pJoinReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2) ||
1035 (pJoinReq->rsnIE.length != 2 + *(pBuf + 1)))
1036 {
1037 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001038 FL("Invalid RSN IE length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001039 pJoinReq->rsnIE.length);
1040 return eSIR_FAILURE;
1041 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301042 vos_mem_copy( (tANI_U8 *) pJoinReq->rsnIE.rsnIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001043 pBuf, pJoinReq->rsnIE.length);
1044 pBuf += pJoinReq->rsnIE.length;
1045 len -= pJoinReq->rsnIE.length; // skip RSN IE
1046 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301047 {
1048 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001049 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301050 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001051 }
1052
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001053#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001054 // Extract CCKM IE
1055 pJoinReq->cckmIE.length = limGetU16(pBuf);
1056 pBuf += sizeof(tANI_U16);
1057 len -= sizeof(tANI_U16);
1058 if (pJoinReq->cckmIE.length)
1059 {
1060 // Check for CCKM IE length (that includes length of type & length)
1061 if ((pJoinReq->cckmIE.length > SIR_MAC_MAX_IE_LENGTH) ||
1062 (pJoinReq->cckmIE.length != (2 + *(pBuf + 1))))
1063 {
1064 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001065 FL("Invalid CCKM IE length %d/%d in SME_JOIN/REASSOC_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001066 pJoinReq->cckmIE.length, 2 + *(pBuf + 1));
1067 return eSIR_FAILURE;
1068 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301069 vos_mem_copy((tANI_U8 *) pJoinReq->cckmIE.cckmIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001070 pBuf, pJoinReq->cckmIE.length);
1071 pBuf += pJoinReq->cckmIE.length;
1072 len -= pJoinReq->cckmIE.length; // skip CCKM IE
1073 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301074 {
1075 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001076 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301077 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001078 }
1079#endif
1080
1081 // Extract Add IE for scan
1082 pJoinReq->addIEScan.length = limGetU16(pBuf);
1083 pBuf += sizeof(tANI_U16);
1084 len -= sizeof(tANI_U16);
1085
1086 if (pJoinReq->addIEScan.length)
1087 {
1088 // Check for IE length (that includes length of type & length)
1089 if (pJoinReq->addIEScan.length > SIR_MAC_MAX_IE_LENGTH + 2)
1090 {
1091 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001092 FL("Invalid addIE Scan length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001093 pJoinReq->addIEScan.length);
1094 return eSIR_FAILURE;
1095 }
1096 // Check for P2P IE length (that includes length of type & length)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301097 vos_mem_copy( (tANI_U8 *) pJoinReq->addIEScan.addIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001098 pBuf, pJoinReq->addIEScan.length);
1099 pBuf += pJoinReq->addIEScan.length;
1100 len -= pJoinReq->addIEScan.length; // skip add IE
1101 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301102 {
1103 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001104 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301105 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001106 }
1107
1108 pJoinReq->addIEAssoc.length = limGetU16(pBuf);
1109 pBuf += sizeof(tANI_U16);
1110 len -= sizeof(tANI_U16);
1111
1112 // Extract Add IE for assoc
1113 if (pJoinReq->addIEAssoc.length)
1114 {
1115 // Check for IE length (that includes length of type & length)
1116 if (pJoinReq->addIEAssoc.length > SIR_MAC_MAX_IE_LENGTH + 2)
1117 {
1118 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001119 FL("Invalid addIE Assoc length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001120 pJoinReq->addIEAssoc.length);
1121 return eSIR_FAILURE;
1122 }
1123 // Check for P2P IE length (that includes length of type & length)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301124 vos_mem_copy( (tANI_U8 *) pJoinReq->addIEAssoc.addIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001125 pBuf, pJoinReq->addIEAssoc.length);
1126 pBuf += pJoinReq->addIEAssoc.length;
1127 len -= pJoinReq->addIEAssoc.length; // skip add IE
1128 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301129 {
1130 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001131 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301132 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001133 }
1134
Venkata Prathyusha Kuntupallie8dc41d2013-04-15 14:31:36 -07001135 pJoinReq->UCEncryptionType = limGetU32(pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001136 pBuf += sizeof(tANI_U32);
1137 len -= sizeof(tANI_U32);
1138 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301139 {
1140 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1141 return eSIR_FAILURE;
1142 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001143
Venkata Prathyusha Kuntupallie8dc41d2013-04-15 14:31:36 -07001144 pJoinReq->MCEncryptionType = limGetU32(pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001145 pBuf += sizeof(tANI_U32);
1146 len -= sizeof(tANI_U32);
1147 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301148 {
1149 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1150 return eSIR_FAILURE;
1151 }
Chet Lanctot186b5732013-03-18 10:26:30 -07001152#ifdef WLAN_FEATURE_11W
1153 pJoinReq->MgmtEncryptionType = limGetU32(pBuf);
1154 pBuf += sizeof(tANI_U32);
1155 len -= sizeof(tANI_U32);
1156 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301157 {
1158 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Chet Lanctot186b5732013-03-18 10:26:30 -07001159 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301160 }
Chet Lanctot186b5732013-03-18 10:26:30 -07001161#endif
1162
Jeff Johnson295189b2012-06-20 16:38:30 -07001163#ifdef WLAN_FEATURE_VOWIFI_11R
1164 //is11Rconnection;
1165 pJoinReq->is11Rconnection = (tAniBool)limGetU32(pBuf);
1166 pBuf += sizeof(tAniBool);
1167 len -= sizeof(tAniBool);
1168 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301169 {
1170 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1171 return eSIR_FAILURE;
1172 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001173#endif
1174
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001175#ifdef FEATURE_WLAN_ESE
1176 //ESE version IE
1177 pJoinReq->isESEFeatureIniEnabled = (tAniBool)limGetU32(pBuf);
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05301178 pBuf += sizeof(tAniBool);
1179 len -= sizeof(tAniBool);
1180 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301181 {
1182 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05301183 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301184 }
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05301185
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001186 //isESEconnection;
1187 pJoinReq->isESEconnection = (tAniBool)limGetU32(pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001188 pBuf += sizeof(tAniBool);
1189 len -= sizeof(tAniBool);
1190 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301191 {
1192 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1193 return eSIR_FAILURE;
1194 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001195
1196 // TSPEC information
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001197 pJoinReq->eseTspecInfo.numTspecs = *pBuf++;
Jeff Johnson295189b2012-06-20 16:38:30 -07001198 len -= sizeof(tANI_U8);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001199 vos_mem_copy((void*)&pJoinReq->eseTspecInfo.tspec[0], pBuf,
1200 (sizeof(tTspecInfo)* pJoinReq->eseTspecInfo.numTspecs));
1201 pBuf += sizeof(tTspecInfo)*SIR_ESE_MAX_TSPEC_IES;
1202 len -= sizeof(tTspecInfo)*SIR_ESE_MAX_TSPEC_IES;
Jeff Johnson295189b2012-06-20 16:38:30 -07001203 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301204 {
1205 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001206 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301207 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001208#endif
1209
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001210#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07001211 //isFastTransitionEnabled;
1212 pJoinReq->isFastTransitionEnabled = (tAniBool)limGetU32(pBuf);
1213 pBuf += sizeof(tAniBool);
1214 len -= sizeof(tAniBool);
1215 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301216 {
1217 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1218 return eSIR_FAILURE;
1219 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001220#endif
1221
Jeff Johnson43971f52012-07-17 12:26:56 -07001222#ifdef FEATURE_WLAN_LFR
1223 //isFastRoamIniFeatureEnabled;
1224 pJoinReq->isFastRoamIniFeatureEnabled = (tAniBool)limGetU32(pBuf);
1225 pBuf += sizeof(tAniBool);
1226 len -= sizeof(tAniBool);
1227 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301228 {
1229 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1230 return eSIR_FAILURE;
1231 }
Jeff Johnson43971f52012-07-17 12:26:56 -07001232#endif
1233
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001234 //txLdpcIniFeatureEnabled
1235 pJoinReq->txLdpcIniFeatureEnabled= *pBuf++;
1236 len--;
1237 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301238 {
1239 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001240 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301241 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301242#ifdef WLAN_FEATURE_11AC
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001243 //txBFIniFeatureEnabled
1244 pJoinReq->txBFIniFeatureEnabled= *pBuf++;
1245 len--;
1246 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301247 {
1248 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001249 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301250 }
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001251
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001252 //txBFCsnValue
1253 pJoinReq->txBFCsnValue= *pBuf++;
1254 len--;
1255 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301256 {
1257 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001258 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301259 }
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001260
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301261 //MuBformee
1262 pJoinReq->txMuBformee= *pBuf++;
1263 len--;
1264 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1265 {
1266 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1267 return eSIR_FAILURE;
1268 }
1269#endif
1270
krunal soni5afa96c2013-09-06 22:19:02 -07001271 pJoinReq->isAmsduSupportInAMPDU= *pBuf++;
1272 len--;
1273 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301274 {
1275 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
krunal soni5afa96c2013-09-06 22:19:02 -07001276 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301277 }
krunal soni5afa96c2013-09-06 22:19:02 -07001278
Sandeep Puligillaaea98a22013-12-04 13:36:32 +05301279 pJoinReq->isWMEenabled = (tAniBool)limGetU32(pBuf);
1280 pBuf += sizeof(tAniBool);
1281 len -= sizeof(tAniBool);
1282 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1283 return eSIR_FAILURE;
1284
1285 pJoinReq->isQosEnabled = (tAniBool)limGetU32(pBuf);
1286 pBuf += sizeof(tAniBool);
1287 len -= sizeof(tAniBool);
1288 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1289 return eSIR_FAILURE;
1290
Jeff Johnson295189b2012-06-20 16:38:30 -07001291 // Extract Titan CB Neighbor BSS info
1292 pJoinReq->cbNeighbors.cbBssFoundPri = *pBuf;
1293 pBuf++;
1294 pJoinReq->cbNeighbors.cbBssFoundSecUp = *pBuf;
1295 pBuf++;
1296 pJoinReq->cbNeighbors.cbBssFoundSecDown = *pBuf;
1297 pBuf++;
1298 len -= 3;
1299
1300 // Extract Spectrum Mgt Indicator
1301 pJoinReq->spectrumMgtIndicator = (tAniBool) limGetU32(pBuf);
1302 pBuf += sizeof(tAniBool);
1303 len -= sizeof(tAniBool);
1304
1305 pJoinReq->powerCap.minTxPower = *pBuf++;
1306 pJoinReq->powerCap.maxTxPower = *pBuf++;
1307 len -=2;
Jeff Johnson295189b2012-06-20 16:38:30 -07001308
1309 pJoinReq->supportedChannels.numChnl = *pBuf++;
1310 len--;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301311 vos_mem_copy( (tANI_U8 *) pJoinReq->supportedChannels.channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001312 pBuf, pJoinReq->supportedChannels.numChnl);
1313 pBuf += pJoinReq->supportedChannels.numChnl;
1314 len-= pJoinReq->supportedChannels.numChnl;
1315
Abhishek Singh525045c2014-12-15 17:18:45 +05301316 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001317 FL("spectrumInd ON: minPower %d, maxPower %d , numChnls %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001318 pJoinReq->powerCap.minTxPower,
1319 pJoinReq->powerCap.maxTxPower,
Abhishek Singh525045c2014-12-15 17:18:45 +05301320 pJoinReq->supportedChannels.numChnl);
Jeff Johnson295189b2012-06-20 16:38:30 -07001321
1322 // Extract uapsdPerAcBitmask
1323 pJoinReq->uapsdPerAcBitmask = *pBuf++;
1324 len--;
1325 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301326 {
1327 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001328 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301329 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001330
Jeff Johnson295189b2012-06-20 16:38:30 -07001331 //
1332 // NOTE - tSirBssDescription is now moved to the end
1333 // of tSirSmeJoinReq structure. This is to accomodate
1334 // the variable length data member ieFields[1]
1335 //
1336 if (limGetBssDescription( pMac, &pJoinReq->bssDescription,
1337 len, &lenUsed, pBuf) == eSIR_FAILURE)
1338 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001339 PELOGE(limLog(pMac, LOGE, FL("get bss description failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001340 return eSIR_FAILURE;
1341 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05301342 PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3,
1343 (tANI_U8 *) &(pJoinReq->bssDescription),
1344 pJoinReq->bssDescription.length + 2);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001345 pBuf += lenUsed;
1346 len -= lenUsed;
Jeff Johnson295189b2012-06-20 16:38:30 -07001347
1348 return eSIR_SUCCESS;
1349} /*** end limJoinReqSerDes() ***/
1350
1351
1352/**---------------------------------------------------------------
1353\fn limAssocIndSerDes
1354\brief This function is called by limProcessMlmAssocInd() to
1355\ populate the SME_ASSOC_IND message based on the received
1356\ MLM_ASSOC_IND.
1357\
1358\param pMac
1359\param pAssocInd - Pointer to the received tLimMlmAssocInd
1360\param pBuf - Pointer to serialized buffer
1361\param psessionEntry - pointer to PE session entry
1362\
1363\return None
1364------------------------------------------------------------------*/
1365void
1366limAssocIndSerDes(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
1367{
1368 tANI_U8 *pLen = pBuf;
1369 tANI_U16 mLen = 0;
1370
1371#ifdef PE_DEBUG_LOG1
1372 tANI_U8 *pTemp = pBuf;
1373#endif
1374
Jeff Johnson295189b2012-06-20 16:38:30 -07001375
1376 mLen = sizeof(tANI_U32);
1377 mLen += sizeof(tANI_U8);
1378 pBuf += sizeof(tANI_U16);
1379 *pBuf = psessionEntry->smeSessionId;
1380 pBuf += sizeof(tANI_U8);
1381
1382 // Fill in peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301383 vos_mem_copy( pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001384 pBuf += sizeof(tSirMacAddr);
1385 mLen += sizeof(tSirMacAddr);
1386
1387 // Fill in aid
1388 limCopyU16(pBuf, pAssocInd->aid);
1389 pBuf += sizeof(tANI_U16);
1390 mLen += sizeof(tANI_U16);
1391
1392 // Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301393 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001394 pBuf += sizeof(tSirMacAddr);
1395 mLen += sizeof(tSirMacAddr);
1396
1397 // Fill in staId
1398 limCopyU16(pBuf, psessionEntry->staId);
1399 pBuf += sizeof(tANI_U16);
1400 mLen += sizeof(tANI_U16);
1401
1402 // Fill in authType
1403 limCopyU32(pBuf, pAssocInd->authType);
1404 pBuf += sizeof(tANI_U32);
1405 mLen += sizeof(tANI_U32);
1406
1407 // Fill in ssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301408 vos_mem_copy( pBuf, (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001409 pBuf += (1 + pAssocInd->ssId.length);
1410 mLen += (1 + pAssocInd->ssId.length);
1411
1412 // Fill in rsnIE
1413 limCopyU16(pBuf, pAssocInd->rsnIE.length);
1414 pBuf += sizeof(tANI_U16);
1415 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301416 vos_mem_copy( pBuf, (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001417 pAssocInd->rsnIE.length);
1418 pBuf += pAssocInd->rsnIE.length;
1419 mLen += pAssocInd->rsnIE.length;
1420
Jeff Johnson295189b2012-06-20 16:38:30 -07001421
Jeff Johnson295189b2012-06-20 16:38:30 -07001422 limCopyU32(pBuf, pAssocInd->spectrumMgtIndicator);
1423 pBuf += sizeof(tAniBool);
1424 mLen += sizeof(tAniBool);
1425
1426 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1427 {
1428 *pBuf = pAssocInd->powerCap.minTxPower;
1429 pBuf++;
1430 *pBuf = pAssocInd->powerCap.maxTxPower;
1431 pBuf++;
1432 mLen += sizeof(tSirMacPowerCapInfo);
1433
1434 *pBuf = pAssocInd->supportedChannels.numChnl;
1435 pBuf++;
1436 mLen++;
1437
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301438 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -07001439 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
1440 pAssocInd->supportedChannels.numChnl);
1441
1442
1443 pBuf += pAssocInd->supportedChannels.numChnl;
1444 mLen += pAssocInd->supportedChannels.numChnl;
1445 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001446 limCopyU32(pBuf, pAssocInd->WmmStaInfoPresent);
1447 pBuf += sizeof(tANI_U32);
1448 mLen += sizeof(tANI_U32);
Hardik Kantilal Patel1ba630f2014-11-21 04:32:05 +05301449
1450#ifdef WLAN_FEATURE_AP_HT40_24G
1451 limCopyU32(pBuf, pAssocInd->HT40MHzIntoPresent);
1452 pBuf += sizeof(tANI_U32);
1453 mLen += sizeof(tANI_U32);
1454#endif
1455
Jeff Johnson295189b2012-06-20 16:38:30 -07001456 // Fill in length of SME_ASSOC_IND message
1457 limCopyU16(pLen, mLen);
1458
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001459 PELOG1(limLog(pMac, LOG1, FL("Sending SME_ASSOC_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001460 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1461} /*** end limAssocIndSerDes() ***/
1462
1463
1464
1465/**
1466 * limAssocCnfSerDes()
1467 *
1468 *FUNCTION:
1469 * This function is called by limProcessLmmMessages() when
1470 * SME_ASSOC_CNF or SME_REASSOC_CNF message is received from
1471 * upper layer software.
1472 *
1473 *PARAMS:
1474 *
1475 *LOGIC:
1476 *
1477 *ASSUMPTIONS:
1478 * NA
1479 *
1480 *NOTE:
1481 * NA
1482 *
1483 * @param pAssocCnf Pointer to tSirSmeAssocCnf being extracted into
1484 * @param pBuf Pointer to serialized buffer
1485 * @return retCode Indicates whether message is successfully
1486 * de-serialized (eSIR_SUCCESS) or
1487 * not (eSIR_FAILURE)
1488 */
1489
1490tSirRetStatus
1491limAssocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeAssocCnf pAssocCnf, tANI_U8 *pBuf)
1492{
1493#ifdef PE_DEBUG_LOG1
1494 tANI_U8 *pTemp = pBuf;
1495#endif
1496
1497 if (!pAssocCnf || !pBuf)
1498 return eSIR_FAILURE;
1499
1500 pAssocCnf->messageType = limGetU16(pBuf);
1501 pBuf += sizeof(tANI_U16);
1502
1503 pAssocCnf->length = limGetU16(pBuf);
1504 pBuf += sizeof(tANI_U16);
1505
1506 if (pAssocCnf->messageType == eWNI_SME_ASSOC_CNF)
1507 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001508 PELOG1(limLog(pMac, LOG1, FL("SME_ASSOC_CNF length %d bytes is:"), pAssocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001509 }
1510 else
1511 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001512 PELOG1(limLog(pMac, LOG1, FL("SME_REASSOC_CNF length %d bytes is:"), pAssocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001513 }
1514 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pAssocCnf->length);)
1515
1516 // status code
1517 pAssocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
1518 pBuf += sizeof(tSirResultCodes);
1519
1520 // bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301521 vos_mem_copy( pAssocCnf->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001522 pBuf += sizeof(tSirMacAddr);
1523
1524 // peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301525 vos_mem_copy( pAssocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001526 pBuf += sizeof(tSirMacAddr);
1527
1528
1529 pAssocCnf->aid = limGetU16(pBuf);
1530 pBuf += sizeof(tANI_U16);
1531 // alternateBssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301532 vos_mem_copy( pAssocCnf->alternateBssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001533 pBuf += sizeof(tSirMacAddr);
1534
1535 // alternateChannelId
1536 pAssocCnf->alternateChannelId = *pBuf;
1537 pBuf++;
1538
1539 return eSIR_SUCCESS;
1540} /*** end limAssocCnfSerDes() ***/
1541
1542
1543
1544/**
1545 * limDisassocCnfSerDes()
1546 *
1547 *FUNCTION:
1548 * This function is called by limProcessSmeMessages() when
1549 * SME_DISASSOC_CNF message is received from upper layer software.
1550 *
1551 *PARAMS:
1552 *
1553 *LOGIC:
1554 *
1555 *ASSUMPTIONS:
1556 * NA
1557 *
1558 *NOTE:
1559 * NA
1560 *
1561 * @param pDisassocCnf Pointer to tSirSmeDisassocCnf being
1562 * extracted into
1563 * @param pBuf Pointer to serialized buffer
1564 * @return retCode Indicates whether message is successfully
1565 * de-serialized (eSIR_SUCCESS) or
1566 * not (eSIR_FAILURE)
1567 */
1568
1569tSirRetStatus
1570limDisassocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeDisassocCnf pDisassocCnf, tANI_U8 *pBuf)
1571{
1572#ifdef PE_DEBUG_LOG1
1573 tANI_U8 *pTemp = pBuf;
1574#endif
1575
1576 if (!pDisassocCnf || !pBuf)
1577 return eSIR_FAILURE;
1578
1579 pDisassocCnf->messageType = limGetU16(pBuf);
1580 pBuf += sizeof(tANI_U16);
1581
1582 pDisassocCnf->length = limGetU16(pBuf);
1583 pBuf += sizeof(tANI_U16);
1584
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001585 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_CNF length %d bytes is:"), pDisassocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001586 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pDisassocCnf->length);)
1587
1588 pDisassocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
1589 pBuf += sizeof(tSirResultCodes);
1590
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301591 vos_mem_copy( pDisassocCnf->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001592 pBuf += sizeof(tSirMacAddr);
Jeff Johnson62c27982013-02-27 17:53:55 -08001593
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301594 vos_mem_copy( pDisassocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001595
Jeff Johnson62c27982013-02-27 17:53:55 -08001596
Jeff Johnson295189b2012-06-20 16:38:30 -07001597 return eSIR_SUCCESS;
1598} /*** end limDisassocCnfSerDes() ***/
1599
1600
1601
Jeff Johnson295189b2012-06-20 16:38:30 -07001602
1603
1604/**---------------------------------------------------------------
1605\fn limReassocIndSerDes
1606\brief This function is called by limProcessMlmReassocInd() to
1607\ populate the SME_REASSOC_IND message based on the received
1608\ MLM_REASSOC_IND.
1609\
1610\param pMac
1611\param pReassocInd - Pointer to the received tLimMlmReassocInd
1612\param pBuf - Pointer to serialized buffer
1613\param psessionEntry - pointer to PE session entry
1614\
1615\return None
1616------------------------------------------------------------------*/
1617void
1618limReassocIndSerDes(tpAniSirGlobal pMac, tpLimMlmReassocInd pReassocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
1619{
1620 tANI_U8 *pLen = pBuf;
1621 tANI_U16 mLen = 0;
1622
1623#ifdef PE_DEBUG_LOG1
1624 tANI_U8 *pTemp = pBuf;
1625#endif
1626
Jeff Johnson295189b2012-06-20 16:38:30 -07001627
1628 mLen = sizeof(tANI_U32);
1629 pBuf += sizeof(tANI_U16);
1630 *pBuf++ = psessionEntry->smeSessionId;
1631 mLen += sizeof(tANI_U8);
1632
1633 // Fill in peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301634 vos_mem_copy( pBuf, pReassocInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001635 pBuf += sizeof(tSirMacAddr);
1636 mLen += sizeof(tSirMacAddr);
1637
1638 // Fill in oldMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301639 vos_mem_copy( pBuf, pReassocInd->currentApAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001640 pBuf += sizeof(tSirMacAddr);
1641 mLen += sizeof(tSirMacAddr);
1642
1643 // Fill in aid
1644 limCopyU16(pBuf, pReassocInd->aid);
1645 pBuf += sizeof(tANI_U16);
1646 mLen += sizeof(tANI_U16);
1647
1648 // Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301649 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001650 pBuf += sizeof(tSirMacAddr);
1651 mLen += sizeof(tSirMacAddr);
1652
1653 // Fill in staId
1654 limCopyU16(pBuf, psessionEntry->staId);
1655 pBuf += sizeof(tANI_U16);
1656 mLen += sizeof(tANI_U16);
1657
1658 // Fill in authType
1659 limCopyU32(pBuf, pReassocInd->authType);
1660 pBuf += sizeof(tAniAuthType);
1661 mLen += sizeof(tAniAuthType);
1662
1663 // Fill in ssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301664 vos_mem_copy( pBuf, (tANI_U8 *) &(pReassocInd->ssId),
Jeff Johnson295189b2012-06-20 16:38:30 -07001665 pReassocInd->ssId.length + 1);
1666 pBuf += 1 + pReassocInd->ssId.length;
1667 mLen += pReassocInd->ssId.length + 1;
1668
1669 // Fill in rsnIE
1670 limCopyU16(pBuf, pReassocInd->rsnIE.length);
1671 pBuf += sizeof(tANI_U16);
1672 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301673 vos_mem_copy( pBuf, (tANI_U8 *) &(pReassocInd->rsnIE.rsnIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001674 pReassocInd->rsnIE.length);
1675 pBuf += pReassocInd->rsnIE.length;
1676 mLen += pReassocInd->rsnIE.length;
1677
1678 // Fill in addIE
1679 limCopyU16(pBuf, pReassocInd->addIE.length);
1680 pBuf += sizeof(tANI_U16);
1681 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301682 vos_mem_copy( pBuf, (tANI_U8*) &(pReassocInd->addIE.addIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001683 pReassocInd->addIE.length);
1684 pBuf += pReassocInd->addIE.length;
1685 mLen += pReassocInd->addIE.length;
1686
Jeff Johnson295189b2012-06-20 16:38:30 -07001687
Jeff Johnson295189b2012-06-20 16:38:30 -07001688 limCopyU32(pBuf, pReassocInd->spectrumMgtIndicator);
1689 pBuf += sizeof(tAniBool);
1690 mLen += sizeof(tAniBool);
1691
1692 if (pReassocInd->spectrumMgtIndicator == eSIR_TRUE)
1693 {
1694 *pBuf = pReassocInd->powerCap.minTxPower;
1695 pBuf++;
1696 *pBuf = pReassocInd->powerCap.maxTxPower;
1697 pBuf++;
1698 mLen += sizeof(tSirMacPowerCapInfo);
1699
1700 *pBuf = pReassocInd->supportedChannels.numChnl;
1701 pBuf++;
1702 mLen++;
1703
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301704 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -07001705 (tANI_U8 *) &(pReassocInd->supportedChannels.channelList),
1706 pReassocInd->supportedChannels.numChnl);
1707
1708 pBuf += pReassocInd->supportedChannels.numChnl;
1709 mLen += pReassocInd->supportedChannels.numChnl;
1710 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001711 limCopyU32(pBuf, pReassocInd->WmmStaInfoPresent);
1712 pBuf += sizeof(tANI_U32);
1713 mLen += sizeof(tANI_U32);
Jeff Johnson295189b2012-06-20 16:38:30 -07001714
1715 // Fill in length of SME_REASSOC_IND message
1716 limCopyU16(pLen, mLen);
1717
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001718 PELOG1(limLog(pMac, LOG1, FL("Sending SME_REASSOC_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001719 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1720} /*** end limReassocIndSerDes() ***/
1721
1722
1723/**
1724 * limAuthIndSerDes()
1725 *
1726 *FUNCTION:
1727 * This function is called by limProcessMlmAuthInd() while sending
1728 * SME_AUTH_IND to host
1729 *
1730 *PARAMS:
1731 *
1732 *LOGIC:
1733 *
1734 *ASSUMPTIONS:
1735 * NA
1736 *
1737 *NOTE:
1738 * NA
1739 *
1740 * @param pAuthInd Pointer to tSirSmeAuthInd being sent
1741 * @param pBuf Pointer to serialized buffer
1742 *
1743 * @return None
1744 */
1745
1746void
1747limAuthIndSerDes(tpAniSirGlobal pMac, tpLimMlmAuthInd pAuthInd, tANI_U8 *pBuf)
1748{
1749 tANI_U8 *pLen = pBuf;
1750 tANI_U16 mLen = 0;
1751
1752#ifdef PE_DEBUG_LOG1
1753 tANI_U8 *pTemp = pBuf;
1754#endif
1755
1756 mLen = sizeof(tANI_U32);
1757 pBuf += sizeof(tANI_U16);
1758 *pBuf++ = pAuthInd->sessionId;
1759 mLen += sizeof(tANI_U8);
1760
1761 // BTAMP TODO: Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301762 vos_mem_set(pBuf, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001763 pBuf += sizeof(tSirMacAddr);
1764 mLen += sizeof(tSirMacAddr);
1765
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301766 vos_mem_copy( pBuf, pAuthInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001767 pBuf += sizeof(tSirMacAddr);
1768 mLen += sizeof(tSirMacAddr);
1769
1770 limCopyU32(pBuf, pAuthInd->authType);
1771 pBuf += sizeof(tAniAuthType);
1772 mLen += sizeof(tAniAuthType);
1773
1774 limCopyU16(pLen, mLen);
1775
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001776 PELOG1(limLog(pMac, LOG1, FL("Sending SME_AUTH_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001777 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1778} /*** end limAuthIndSerDes() ***/
1779
1780
1781
1782/**
1783 * limSetContextReqSerDes()
1784 *
1785 *FUNCTION:
1786 * This function is called by limProcessSmeMessages() upon receiving
1787 * SME_SETCONTEXT_REQ from host
1788 *
1789 *PARAMS:
1790 *
1791 *LOGIC:
1792 *
1793 *ASSUMPTIONS:
1794 * NA
1795 *
1796 *NOTE:
1797 * NA
1798 *
1799 * @param pSetContextReq Pointer to tSirSmeSetContextReq being
1800 * extracted
1801 * @param pBuf Pointer to serialized buffer
1802 *
1803 * @return retCode Indicates whether message is successfully
1804 * de-serialized (eSIR_SUCCESS) or
1805 * not (eSIR_FAILURE)
1806 */
1807
1808tSirRetStatus
1809limSetContextReqSerDes(tpAniSirGlobal pMac, tpSirSmeSetContextReq pSetContextReq, tANI_U8 *pBuf)
1810{
1811 tANI_S16 len = 0;
1812 tANI_U16 totalKeySize = sizeof(tANI_U8); // initialized to sizeof numKeys
1813 tANI_U8 numKeys;
1814 tANI_U8 *pKeys;
1815
1816#ifdef PE_DEBUG_LOG1
1817 tANI_U8 *pTemp = pBuf;
1818#endif
1819 if (!pSetContextReq || !pBuf)
1820 return eSIR_FAILURE;
1821
1822 pSetContextReq->messageType = limGetU16(pBuf);
1823 pBuf += sizeof(tANI_U16);
1824
1825 len = pSetContextReq->length = limGetU16(pBuf);
1826 pBuf += sizeof(tANI_U16);
1827
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001828 PELOG1(limLog(pMac, LOG1, FL("SME_SETCONTEXT_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001829 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
1830
1831 if (len < (tANI_S16) sizeof(tANI_U32))
1832 return eSIR_FAILURE;
1833
1834 len -= sizeof(tANI_U32); // skip message header
1835 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1836 return eSIR_FAILURE;
1837
1838 // Extract sessionId
1839 pSetContextReq->sessionId = *pBuf++;
1840 len--;
1841 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1842 return eSIR_FAILURE;
1843
1844 // Extract transactionId
1845 pSetContextReq->transactionId = sirReadU16N(pBuf);
1846 pBuf += sizeof(tANI_U16);
1847 len -= sizeof(tANI_U16);
1848 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1849 return eSIR_FAILURE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301850 vos_mem_copy( (tANI_U8 *) pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001851 pBuf, sizeof(tSirMacAddr));
1852 pBuf += sizeof(tSirMacAddr);
1853 len -= sizeof(tSirMacAddr);
1854 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1855 return eSIR_FAILURE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301856 vos_mem_copy( pSetContextReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001857 pBuf += sizeof(tSirMacAddr);
1858 len -= sizeof(tSirMacAddr);
1859 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1860 return eSIR_FAILURE;
1861
Jeff Johnson295189b2012-06-20 16:38:30 -07001862
1863// pSetContextReq->qosInfoPresent = limGetU32(pBuf);
1864// pBuf += sizeof(tAniBool);
1865
1866// if (pSetContextReq->qosInfoPresent)
1867// {
1868// len = limGetQosInfo(&pSetContextReq->qos, pBuf);
1869// pBuf += len;
1870// }
1871
1872 pSetContextReq->keyMaterial.length = limGetU16(pBuf);
1873 pBuf += sizeof(tANI_U16);
1874 len -= sizeof(tANI_U16);
1875 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1876 return eSIR_FAILURE;
1877
1878 pSetContextReq->keyMaterial.edType = (tAniEdType) limGetU32(pBuf);
1879 pBuf += sizeof(tAniEdType);
1880 len -= sizeof(tAniEdType);
1881 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1882 return eSIR_FAILURE;
1883
1884 numKeys = pSetContextReq->keyMaterial.numKeys = *pBuf++;
1885 len -= sizeof(numKeys);
1886
1887 if (numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
1888 return eSIR_FAILURE;
1889
1890 /** Initialize the Default Keys if no Keys are being sent from the upper layer*/
1891 if( limCheckRemainingLength(pMac, len) == eSIR_FAILURE) {
1892 tpSirKeys pKeyinfo = pSetContextReq->keyMaterial.key;
1893
1894 pKeyinfo->keyId = 0;
1895 pKeyinfo->keyDirection = eSIR_TX_RX;
1896 pKeyinfo->keyLength = 0;
1897
1898 if (!limIsAddrBC(pSetContextReq->peerMacAddr))
1899 pKeyinfo->unicast = 1;
1900 else
1901 pKeyinfo->unicast = 0;
1902 }else {
1903 pKeys = (tANI_U8 *) pSetContextReq->keyMaterial.key;
1904 do {
1905 tANI_U32 keySize = limGetKeysInfo(pMac, (tpSirKeys) pKeys,
1906 pBuf);
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05301907 vos_mem_zero(pBuf, keySize);
Jeff Johnson295189b2012-06-20 16:38:30 -07001908 pBuf += keySize;
1909 pKeys += sizeof(tSirKeys);
1910 totalKeySize += (tANI_U16) keySize;
1911 if (numKeys == 0)
1912 break;
1913 numKeys--;
1914 }while (numKeys);
1915 }
1916 return eSIR_SUCCESS;
1917} /*** end limSetContextReqSerDes() ***/
1918
1919/**
1920 * limRemoveKeyReqSerDes()
1921 *
1922 *FUNCTION:
1923 * This function is called by limProcessSmeMessages() upon receiving
1924 * SME_REMOVEKEY_REQ from host
1925 *
1926 *PARAMS:
1927 *
1928 *LOGIC:
1929 *
1930 *ASSUMPTIONS:
1931 * NA
1932 *
1933 *NOTE:
1934 * NA
1935 *
1936 * @param pRemoveKeyReq Pointer to tSirSmeRemoveKeyReq being
1937 * extracted
1938 * @param pBuf Pointer to serialized buffer
1939 *
1940 * @return retCode Indicates whether message is successfully
1941 * de-serialized (eSIR_SUCCESS) or
1942 * not (eSIR_FAILURE)
1943 */
1944
1945tSirRetStatus
1946limRemoveKeyReqSerDes(tpAniSirGlobal pMac, tpSirSmeRemoveKeyReq pRemoveKeyReq, tANI_U8 *pBuf)
1947{
1948 tANI_S16 len = 0;
1949
1950#ifdef PE_DEBUG_LOG1
1951 tANI_U8 *pTemp = pBuf;
1952#endif
1953 if (!pRemoveKeyReq || !pBuf)
1954 return eSIR_FAILURE;
1955
1956 pRemoveKeyReq->messageType = limGetU16(pBuf);
1957 pBuf += sizeof(tANI_U16);
1958
1959 len = pRemoveKeyReq->length = limGetU16(pBuf);
1960 pBuf += sizeof(tANI_U16);
1961
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001962 PELOG1(limLog(pMac, LOG1, FL("SME_REMOVEKEY_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001963 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
1964
1965 if (len < (tANI_S16) sizeof(tANI_U32))
1966 return eSIR_FAILURE;
1967
1968 len -= sizeof(tANI_U32); // skip message header
1969 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1970 return eSIR_FAILURE;
1971
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301972 vos_mem_copy( (tANI_U8 *) pRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001973 pBuf, sizeof(tSirMacAddr));
1974 pBuf += sizeof(tSirMacAddr);
1975 len -= sizeof(tSirMacAddr);
1976 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1977 return eSIR_FAILURE;
1978
Jeff Johnson295189b2012-06-20 16:38:30 -07001979
1980 pRemoveKeyReq->edType = *pBuf;
1981 pBuf += sizeof(tANI_U8);
1982 len -= sizeof(tANI_U8);
1983 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1984 return eSIR_FAILURE;
1985
1986 pRemoveKeyReq->wepType = *pBuf;
1987
1988 pBuf += sizeof(tANI_U8);
1989 len -= sizeof(tANI_U8);
1990 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1991 return eSIR_FAILURE;
1992
1993 pRemoveKeyReq->keyId = *pBuf;
1994
1995 pBuf += sizeof(tANI_U8);
1996 len -= sizeof(tANI_U8);
1997 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1998 return eSIR_FAILURE;
1999
2000 pRemoveKeyReq->unicast = *pBuf;
2001 len--;
2002 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2003 return eSIR_FAILURE;
2004
2005 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302006 vos_mem_copy( pRemoveKeyReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002007 pBuf += sizeof(tSirMacAddr);
2008 len -= sizeof(tSirMacAddr);
2009 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2010 return eSIR_FAILURE;
2011
2012 // Extract sessionId
2013 pRemoveKeyReq->sessionId = *pBuf++;
2014 len--;
2015 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2016 return eSIR_FAILURE;
2017
2018 // Extract transactionId
2019 pRemoveKeyReq->transactionId = sirReadU16N(pBuf);
2020 pBuf += sizeof(tANI_U16);
2021 len -= sizeof(tANI_U16);
2022 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2023 return eSIR_FAILURE;
2024
2025 return eSIR_SUCCESS;
2026} /*** end limRemoveKeyReqSerDes() ***/
2027
2028
2029
2030/**
2031 * limDisassocReqSerDes()
2032 *
2033 *FUNCTION:
2034 * This function is called by limProcessSmeMessages() upon receiving
2035 * SME_DISASSOC_REQ from host
2036 *
2037 *PARAMS:
2038 *
2039 *LOGIC:
2040 *
2041 *ASSUMPTIONS:
2042 * NA
2043 *
2044 *NOTE:
2045 * NA
2046 *
2047 * @param pDisassocReq Pointer to tSirSmeDisassocReq being extracted
2048 * @param pBuf Pointer to serialized buffer
2049 *
2050 * @return retCode Indicates whether message is successfully
2051 * de-serialized (eSIR_SUCCESS) or
2052 * not (eSIR_FAILURE)
2053 */
2054
2055tSirRetStatus
2056limDisassocReqSerDes(tpAniSirGlobal pMac, tSirSmeDisassocReq *pDisassocReq, tANI_U8 *pBuf)
2057{
2058 tANI_S16 len = 0;
2059#ifdef PE_DEBUG_LOG1
2060 tANI_U8 *pTemp = pBuf;
2061#endif
2062
2063 if (!pDisassocReq || !pBuf)
2064 return eSIR_FAILURE;
2065
2066 pDisassocReq->messageType = limGetU16(pBuf);
2067 pBuf += sizeof(tANI_U16);
2068
2069 len = pDisassocReq->length = limGetU16(pBuf);
2070 pBuf += sizeof(tANI_U16);
2071
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002072 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002073 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2074
2075 if (len < (tANI_S16) sizeof(tANI_U32))
2076 return eSIR_FAILURE;
2077
2078 len -= sizeof(tANI_U32); // skip message header
2079 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2080 return eSIR_FAILURE;
2081
2082 // Extract sessionID
2083 pDisassocReq->sessionId = *pBuf;
2084 pBuf += sizeof(tANI_U8);
2085 len -= sizeof(tANI_U8);
2086 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2087 return eSIR_FAILURE;
2088
2089 // Extract transactionid
2090 pDisassocReq->transactionId = limGetU16(pBuf);
2091 pBuf += sizeof(tANI_U16);
2092 len -= sizeof(tANI_U16);
2093 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2094 return eSIR_FAILURE;
2095
2096 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302097 vos_mem_copy( (tANI_U8 *) pDisassocReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002098 pBuf += sizeof(tSirMacAddr);
2099 len -= sizeof(tSirMacAddr);
2100 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2101 return eSIR_FAILURE;
2102
2103 // Extract peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302104 vos_mem_copy( pDisassocReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002105 pBuf += sizeof(tSirMacAddr);
2106 len -= sizeof(tSirMacAddr);
2107 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2108 return eSIR_FAILURE;
2109
2110 // Extract reasonCode
2111 pDisassocReq->reasonCode = limGetU16(pBuf);
2112 pBuf += sizeof(tANI_U16);
2113 len -= sizeof(tANI_U16);
2114 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2115 return eSIR_FAILURE;
2116
2117 pDisassocReq->doNotSendOverTheAir = *pBuf;
2118 pBuf += sizeof(tANI_U8);
2119 len -= sizeof(tANI_U8);
2120
Jeff Johnson295189b2012-06-20 16:38:30 -07002121
2122 return eSIR_SUCCESS;
2123} /*** end limDisassocReqSerDes() ***/
2124
2125
2126
2127/**
2128 * limDeauthReqSerDes()
2129 *
2130 *FUNCTION:
2131 * This function is called by limProcessSmeMessages() upon receiving
2132 * SME_DEAUTH_REQ from host
2133 *
2134 *PARAMS:
2135 *
2136 *LOGIC:
2137 *
2138 *ASSUMPTIONS:
2139 * NA
2140 *
2141 *NOTE:
2142 * NA
2143 *
2144 * @param pDeauthReq Pointer to tSirSmeDeauthReq being extracted
2145 * @param pBuf Pointer to serialized buffer
2146 *
2147 * @return retCode Indicates whether message is successfully
2148 * de-serialized (eSIR_SUCCESS) or
2149 * not (eSIR_FAILURE)
2150 */
2151tSirRetStatus
2152limDeauthReqSerDes(tpAniSirGlobal pMac, tSirSmeDeauthReq *pDeauthReq, tANI_U8 *pBuf)
2153{
2154 tANI_S16 len = 0;
2155
2156#ifdef PE_DEBUG_LOG1
2157 tANI_U8 *pTemp = pBuf;
2158#endif
2159
2160 if (!pDeauthReq || !pBuf)
2161 return eSIR_FAILURE;
2162
2163 pDeauthReq->messageType = limGetU16(pBuf);
2164 pBuf += sizeof(tANI_U16);
2165
2166 len = pDeauthReq->length = limGetU16(pBuf);
2167 pBuf += sizeof(tANI_U16);
2168
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002169 PELOG1(limLog(pMac, LOG1, FL("SME_DEAUTH_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002170 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2171
2172 if (len < (tANI_S16) sizeof(tANI_U32))
2173 return eSIR_FAILURE;
2174
2175 len -= sizeof(tANI_U32); // skip message header
2176 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2177 return eSIR_FAILURE;
2178
2179 // Extract sessionId
2180 pDeauthReq->sessionId = *pBuf++;
2181 len--;
2182 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2183 return eSIR_FAILURE;
2184
2185 // Extract transactionId
2186 pDeauthReq->transactionId = limGetU16(pBuf);
2187 pBuf += sizeof(tANI_U16);
2188 len -= sizeof(tANI_U16);
2189 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2190 return eSIR_FAILURE;
2191
2192 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302193 vos_mem_copy( pDeauthReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002194 pBuf += sizeof(tSirMacAddr);
2195 len -= sizeof(tSirMacAddr);
2196 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2197 return eSIR_FAILURE;
2198
2199 // Extract peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302200 vos_mem_copy( pDeauthReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002201 pBuf += sizeof(tSirMacAddr);
2202 len -= sizeof(tSirMacAddr);
2203 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2204 return eSIR_FAILURE;
2205
2206 // Extract reasonCode
2207 pDeauthReq->reasonCode = limGetU16(pBuf);
2208 pBuf += sizeof(tANI_U16);
2209 len -= sizeof(tANI_U16);
2210
Jeff Johnson295189b2012-06-20 16:38:30 -07002211
2212 return eSIR_SUCCESS;
2213} /*** end limDisassocReqSerDes() ***/
2214
2215
2216
2217
Jeff Johnson295189b2012-06-20 16:38:30 -07002218
2219
2220/**
2221 * limStatSerDes()
2222 *
2223 *FUNCTION:
2224 * This function is called by limSendSmeDisassocNtf() while sending
2225 * SME_DISASSOC_IND/eWNI_SME_DISASSOC_RSP to host
2226 *
2227 *PARAMS:
2228 *
2229 *LOGIC:
2230 *
2231 *ASSUMPTIONS:
2232 * NA
2233 *
2234 *NOTE:
2235 * NA
2236 *
2237 * @param pAssocInd Pointer to tpAniStaStatStruct being sent
2238 * @param pBuf Pointer to serialized buffer
2239 *
2240 * @return None
2241 */
2242
2243void
2244limStatSerDes(tpAniSirGlobal pMac, tpAniStaStatStruct pStat, tANI_U8 *pBuf)
2245{
2246#ifdef PE_DEBUG_LOG1
2247 tANI_U8 *pTemp = pBuf;
2248#endif
2249
2250 limCopyU32(pBuf, pStat->sentAesBlksUcastHi);
2251 pBuf += sizeof(tANI_U32);
2252
2253 limCopyU32(pBuf, pStat->sentAesBlksUcastLo);
2254 pBuf += sizeof(tANI_U32);
2255
2256 limCopyU32(pBuf, pStat->recvAesBlksUcastHi);
2257 pBuf += sizeof(tANI_U32);
2258
2259 limCopyU32(pBuf, pStat->recvAesBlksUcastLo);
2260 pBuf += sizeof(tANI_U32);
2261
2262 limCopyU32(pBuf, pStat->aesFormatErrorUcastCnts);
2263 pBuf += sizeof(tANI_U32);
2264
2265 limCopyU32(pBuf, pStat->aesReplaysUcast);
2266 pBuf += sizeof(tANI_U32);
2267
2268 limCopyU32(pBuf, pStat->aesDecryptErrUcast);
2269 pBuf += sizeof(tANI_U32);
2270
2271 limCopyU32(pBuf, pStat->singleRetryPkts);
2272 pBuf += sizeof(tANI_U32);
2273
2274 limCopyU32(pBuf, pStat->failedTxPkts);
2275 pBuf += sizeof(tANI_U32);
2276
2277 limCopyU32(pBuf, pStat->ackTimeouts);
2278 pBuf += sizeof(tANI_U32);
2279
2280 limCopyU32(pBuf, pStat->multiRetryPkts);
2281 pBuf += sizeof(tANI_U32);
2282
2283 limCopyU32(pBuf, pStat->fragTxCntsHi);
2284 pBuf += sizeof(tANI_U32);
2285
2286 limCopyU32(pBuf, pStat->fragTxCntsLo);
2287 pBuf += sizeof(tANI_U32);
2288
2289 limCopyU32(pBuf, pStat->transmittedPktsHi);
2290 pBuf += sizeof(tANI_U32);
2291
2292 limCopyU32(pBuf, pStat->transmittedPktsLo);
2293 pBuf += sizeof(tANI_U32);
2294
2295 limCopyU32(pBuf, pStat->phyStatHi);
2296 pBuf += sizeof(tANI_U32);
2297
2298 limCopyU32(pBuf, pStat->phyStatLo);
2299 pBuf += sizeof(tANI_U32);
2300
2301 limCopyU32(pBuf, pStat->uplinkRssi);
2302 pBuf += sizeof(tANI_U32);
2303
2304 limCopyU32(pBuf, pStat->uplinkSinr);
2305 pBuf += sizeof(tANI_U32);
2306
2307 limCopyU32(pBuf, pStat->uplinkRate);
2308 pBuf += sizeof(tANI_U32);
2309
2310 limCopyU32(pBuf, pStat->downlinkRssi);
2311 pBuf += sizeof(tANI_U32);
2312
2313 limCopyU32(pBuf, pStat->downlinkSinr);
2314 pBuf += sizeof(tANI_U32);
2315
2316 limCopyU32(pBuf, pStat->downlinkRate);
2317 pBuf += sizeof(tANI_U32);
2318
2319 limCopyU32(pBuf, pStat->nRcvBytes);
2320 pBuf += sizeof(tANI_U32);
2321
2322 limCopyU32(pBuf, pStat->nXmitBytes);
2323 pBuf += sizeof(tANI_U32);
2324
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002325 PELOG1(limLog(pMac, LOG1, FL("STAT: length %d bytes is:"), sizeof(tAniStaStatStruct));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002326 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, sizeof(tAniStaStatStruct));)
2327
2328} /*** end limStatSerDes() ***/
2329
2330
Jeff Johnson295189b2012-06-20 16:38:30 -07002331
2332
2333/**
2334 * limPackBkgndScanFailNotify()
2335 *
2336 *FUNCTION:
2337 * This function is called by limSendSmeWmStatusChangeNtf()
2338 * to pack the tSirBackgroundScanInfo message
2339 *
2340 */
2341void
2342limPackBkgndScanFailNotify(tpAniSirGlobal pMac,
2343 tSirSmeStatusChangeCode statusChangeCode,
2344 tpSirBackgroundScanInfo pScanInfo,
2345 tSirSmeWmStatusChangeNtf *pSmeNtf,
2346 tANI_U8 sessionId)
2347{
2348
2349 tANI_U16 length = (sizeof(tANI_U16) * 2) + sizeof(tANI_U8) +
2350 sizeof(tSirSmeStatusChangeCode) +
2351 sizeof(tSirBackgroundScanInfo);
2352
Jeff Johnson295189b2012-06-20 16:38:30 -07002353 pSmeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
2354 pSmeNtf->statusChangeCode = statusChangeCode;
2355 pSmeNtf->length = length;
2356 pSmeNtf->sessionId = sessionId;
2357 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanSuccess = pScanInfo->numOfScanSuccess;
2358 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanFailure = pScanInfo->numOfScanFailure;
2359 pSmeNtf->statusChangeInfo.bkgndScanInfo.reserved = pScanInfo->reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07002360}
2361
Jeff Johnson295189b2012-06-20 16:38:30 -07002362
Jeff Johnson295189b2012-06-20 16:38:30 -07002363/**
2364 * limIsSmeGetAssocSTAsReqValid()
2365 *
2366 *FUNCTION:
2367 * This function is called by limProcessSmeReqMessages() upon
2368 * receiving SME_GET_ASSOC_STAS_REQ message from application.
2369 *
2370 *LOGIC:
2371 * Message validity checks are performed in this function
2372 *
2373 *ASSUMPTIONS:
2374 *
2375 *NOTE:
2376 *
2377 * @param pBuf - Pointer to a serialized SME_GET_ASSOC_STAS_REQ message
2378 * @param pSmeMsg - Pointer to a tSirSmeGetAssocSTAsReq structure
2379 * @return true if SME_GET_ASSOC_STAS_REQ message is formatted correctly
2380 * false otherwise
2381 */
2382tANI_BOOLEAN
2383limIsSmeGetAssocSTAsReqValid(tpAniSirGlobal pMac, tpSirSmeGetAssocSTAsReq pGetAssocSTAsReq, tANI_U8 *pBuf)
2384{
2385 tANI_S16 len = 0;
2386
2387 pGetAssocSTAsReq->messageType = limGetU16(pBuf);
2388 pBuf += sizeof(tANI_U16);
2389
2390 len = pGetAssocSTAsReq->length = limGetU16(pBuf);
2391 pBuf += sizeof(tANI_U16);
2392
2393 if (len < (tANI_S16) sizeof(tANI_U32))
Girish Gowliafd42312014-07-24 13:13:59 +05302394 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002395
2396 len -= sizeof(tANI_U32); // skip message header
2397 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Girish Gowliafd42312014-07-24 13:13:59 +05302398 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002399
2400 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302401 vos_mem_copy( (tANI_U8 *) pGetAssocSTAsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002402 pBuf += sizeof(tSirMacAddr);
2403 len -= sizeof(tSirMacAddr);
2404 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Girish Gowliafd42312014-07-24 13:13:59 +05302405 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002406
2407 // Extract modId
2408 pGetAssocSTAsReq->modId = limGetU16(pBuf);
2409 pBuf += sizeof(tANI_U16);
2410 len -= sizeof(tANI_U16);
2411 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Girish Gowliafd42312014-07-24 13:13:59 +05302412 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002413
2414 // Extract pUsrContext
krunal soni4f802b22014-02-11 17:01:13 -08002415 vos_mem_copy((tANI_U8 *)pGetAssocSTAsReq->pUsrContext, pBuf, sizeof(void*));
2416 pBuf += sizeof(void*);
2417 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002418 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Girish Gowliafd42312014-07-24 13:13:59 +05302419 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002420
2421 // Extract pSapEventCallback
krunal soni4f802b22014-02-11 17:01:13 -08002422 vos_mem_copy((tANI_U8 *)pGetAssocSTAsReq->pSapEventCallback, pBuf, sizeof(void*));
2423 pBuf += sizeof(void*);
2424 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002425 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Girish Gowliafd42312014-07-24 13:13:59 +05302426 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002427
2428 // Extract pAssocStasArray
krunal soni4f802b22014-02-11 17:01:13 -08002429 vos_mem_copy((tANI_U8 *)pGetAssocSTAsReq->pAssocStasArray, pBuf, sizeof(void*));
2430 pBuf += sizeof(void*);
2431 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002432
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002433 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002434
2435 if (len < 0)
2436 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002437 PELOGE(limLog(pMac, LOGE, FL("SME_GET_ASSOC_STAS_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002438 return eANI_BOOLEAN_FALSE;
2439 }
2440
2441 return eANI_BOOLEAN_TRUE;
2442}
2443
2444/**
2445 * limTkipCntrMeasReqSerDes()
2446 *
2447 *FUNCTION:
2448 * This function is called by limProcessSmeMessages() upon receiving
2449 * eWNI_SME_TKIP_CNTR_MEAS_REQ from host HDD
2450 *
2451 *PARAMS:
2452 *
2453 *LOGIC:
2454 *
2455 *ASSUMPTIONS:
2456 * NA
2457 *
2458 *NOTE:
2459 * NA
2460 *
2461 * @param tpSirSmeTkipCntrMeasReq Pointer to tSirSmeTkipCntrMeasReq being extracted
2462 * @param pBuf Pointer to serialized buffer
2463 * @return retCode Indicates whether message is successfully
2464 * de-serialized (eSIR_SUCCESS) or
2465 * not (eSIR_FAILURE)
2466 */
2467tSirRetStatus
2468limTkipCntrMeasReqSerDes(tpAniSirGlobal pMac, tpSirSmeTkipCntrMeasReq pTkipCntrMeasReq, tANI_U8 *pBuf)
2469{
2470 tANI_S16 len = 0;
2471
2472#ifdef PE_DEBUG_LOG1
2473 tANI_U8 *pTemp = pBuf;
2474#endif
2475
2476 pTkipCntrMeasReq->messageType = limGetU16(pBuf);
2477 pBuf += sizeof(tANI_U16);
2478
2479 len = pTkipCntrMeasReq->length = limGetU16(pBuf);
2480 pBuf += sizeof(tANI_U16);
2481
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002482 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002483 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2484
2485 if (len < (tANI_S16) sizeof(tANI_U32))
2486 return eSIR_FAILURE;
2487
2488 len -= sizeof(tANI_U32); // skip message header
2489 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2490 return eSIR_FAILURE;
2491
2492 // Extract sessionId
2493 pTkipCntrMeasReq->sessionId = *pBuf++;
2494 len--;
2495 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2496 return eSIR_FAILURE;
2497
2498 // Extract transactionId
2499 pTkipCntrMeasReq->transactionId = limGetU16(pBuf);
2500 pBuf += sizeof(tANI_U16);
2501 len -= sizeof(tANI_U16);
2502 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2503 return eSIR_FAILURE;
2504
2505 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302506 vos_mem_copy( (tANI_U8 *) pTkipCntrMeasReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002507 pBuf += sizeof(tSirMacAddr);
2508 len -= sizeof(tSirMacAddr);
2509 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2510 return eSIR_FAILURE;
2511
2512 // Extract bEnable
2513 pTkipCntrMeasReq->bEnable = *pBuf++;
2514 len --;
2515
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002516 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002517
2518 if (len)
2519 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002520 PELOGE(limLog(pMac, LOGE, FL("SME_TKIP_CNTR_MEAS_REQ invalid "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002521 return eSIR_FAILURE;
2522 }
2523 else
2524 return eSIR_SUCCESS;
2525}
2526
2527/**
2528 * limIsSmeGetWPSPBCSessionsReqValid()
2529 *
2530 *FUNCTION:
2531 * This function is called by limProcessSmeGetWPSPBCSessions() upon
2532 * receiving query WPS PBC overlap information message from application.
2533 *
2534 *LOGIC:
2535 * Message validity checks are performed in this function
2536 *
2537 *ASSUMPTIONS:
2538 *
2539 *NOTE:
2540 *
2541 * @param pBuf - Pointer to a serialized SME_GET_WPSPBC_SESSION_REQ message
2542 * @param pGetWPSPBCSessionsReq - Pointer to a tSirSmeGetWPSPBCSessionsReq structure
2543 * @return true if SME_GET_WPSPBC_SESSION_REQ message is formatted correctly
2544 * false otherwise
2545 */
2546
2547tSirRetStatus
2548limIsSmeGetWPSPBCSessionsReqValid(tpAniSirGlobal pMac, tSirSmeGetWPSPBCSessionsReq *pGetWPSPBCSessionsReq, tANI_U8 *pBuf)
2549{
2550 tANI_S16 len = 0;
2551
2552 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirSmeGetWPSPBCSessionsReq));)
2553
2554 pGetWPSPBCSessionsReq->messageType = limGetU16(pBuf);
2555 pBuf += sizeof(tANI_U16);
2556
2557 len = pGetWPSPBCSessionsReq->length = limGetU16(pBuf);
2558 pBuf += sizeof(tANI_U16);
2559
2560 if (len < (tANI_S16) sizeof(tANI_U32))
2561 return eSIR_FAILURE;
2562
2563 len -= sizeof(tANI_U32); // skip message header
2564 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2565 return eSIR_FAILURE;
2566
2567 // Extract pUsrContext
krunal soni4f802b22014-02-11 17:01:13 -08002568 vos_mem_copy((tANI_U8 *)pGetWPSPBCSessionsReq->pUsrContext, pBuf, sizeof(void*));
2569 pBuf += sizeof(void*);
2570 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002571 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2572 return eSIR_FAILURE;
2573
2574 // Extract pSapEventCallback
krunal soni4f802b22014-02-11 17:01:13 -08002575 vos_mem_copy((tANI_U8 *)pGetWPSPBCSessionsReq->pSapEventCallback, pBuf, sizeof(void*));
2576 pBuf += sizeof(void*);
2577 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002578 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2579 return eSIR_FAILURE;
2580
2581 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302582 vos_mem_copy( (tANI_U8 *) pGetWPSPBCSessionsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002583 pBuf += sizeof(tSirMacAddr);
2584 len -= sizeof(tSirMacAddr);
2585
2586 // Extract MAC address of Station to be removed
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302587 vos_mem_copy( (tANI_U8 *) pGetWPSPBCSessionsReq->pRemoveMac, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002588 pBuf += sizeof(tSirMacAddr);
2589 len -= sizeof(tSirMacAddr);
2590
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002591 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002592
2593 if (len < 0)
2594 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002595 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002596 return eSIR_FAILURE;
2597 }
2598
2599 return eSIR_SUCCESS;
2600}
2601
Jeff Johnson295189b2012-06-20 16:38:30 -07002602
2603/**---------------------------------------------------------------
2604\fn limGetSessionInfo
2605\brief This function returns the sessionId and transactionId
2606\ of a message. This assumes that the message structure
2607\ is of format:
2608\ tANI_U16 messageType
2609\ tANI_U16 messageLength
2610\ tANI_U8 sessionId
2611\ tANI_U16 transactionId
2612\param pMac - pMac global structure
2613\param *pBuf - pointer to the message buffer
2614\param sessionId - returned session id value
2615\param transactionId - returned transaction ID value
2616\return None
2617------------------------------------------------------------------*/
2618void
2619limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U8 *sessionId, tANI_U16 *transactionId)
2620{
2621 if (!pBuf)
2622 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002623 limLog(pMac, LOGE, FL("NULL ptr received. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002624 return;
2625 }
2626
2627 pBuf += sizeof(tANI_U16); // skip message type
2628 pBuf += sizeof(tANI_U16); // skip message length
2629
2630 *sessionId = *pBuf; // get sessionId
2631 pBuf++;
2632 *transactionId = limGetU16(pBuf); // get transactionId
2633
2634 return;
2635}
2636
Jeff Johnson295189b2012-06-20 16:38:30 -07002637
2638/**
2639 * limUpdateAPWPSIEsReqSerDes()
2640 *
2641 *FUNCTION:
2642 * This function is to deserialize UpdateAPWPSIEs message
2643 *
2644 *PARAMS:
2645 *
2646 *LOGIC:
2647 *
2648 *ASSUMPTIONS:
2649 * NA
2650 *
2651 *NOTE:
2652 * NA
2653 *
2654 * @param pUpdateAPWPSIEsReq Pointer to tSirUpdateAPWPSIEsReq being
2655 * extracted
2656 * @param pBuf Pointer to serialized buffer
2657 *
2658 * @return retCode Indicates whether message is successfully
2659 * de-serialized (eSIR_SUCCESS) or
2660 * not (eSIR_FAILURE)
2661 */
2662
2663tSirRetStatus
2664limUpdateAPWPSIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq, tANI_U8 *pBuf)
2665{
2666 tANI_S16 len = 0;
2667
2668 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPSIEsReq));)
2669
2670 if (!pUpdateAPWPSIEsReq || !pBuf)
2671 return eSIR_FAILURE;
2672
2673 pUpdateAPWPSIEsReq->messageType = limGetU16(pBuf);
2674 pBuf += sizeof(tANI_U16);
2675
2676 len = pUpdateAPWPSIEsReq->length = limGetU16(pBuf);
2677 pBuf += sizeof(tANI_U16);
2678
2679 if (len < (tANI_S16) sizeof(tANI_U32))
2680 return eSIR_FAILURE;
2681
2682 len -= sizeof(tANI_U32); // skip message header
2683 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2684 return eSIR_FAILURE;
2685
2686 // Extract transactionId
2687 pUpdateAPWPSIEsReq->transactionId = limGetU16( pBuf );
2688 pBuf += sizeof( tANI_U16 );
2689 len -= sizeof( tANI_U16 );
2690 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2691 return eSIR_FAILURE;
2692
2693 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302694 vos_mem_copy( (tANI_U8 *) pUpdateAPWPSIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002695 pBuf += sizeof(tSirMacAddr);
2696 len -= sizeof(tSirMacAddr);
2697 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2698 return eSIR_FAILURE;
2699
2700 // Extract sessionId
2701 pUpdateAPWPSIEsReq->sessionId = *pBuf++;
2702 len--;
2703 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2704 return eSIR_FAILURE;
2705
2706 // Extract APWPSIEs
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302707 vos_mem_copy( (tSirAPWPSIEs *) &pUpdateAPWPSIEsReq->APWPSIEs, pBuf, sizeof(tSirAPWPSIEs));
Jeff Johnson295189b2012-06-20 16:38:30 -07002708 pBuf += sizeof(tSirAPWPSIEs);
2709 len -= sizeof(tSirAPWPSIEs);
2710
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002711 PELOG1(limLog(pMac, LOG1, FL("SME_UPDATE_APWPSIE_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002712
2713 if (len < 0)
2714 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002715 PELOGE(limLog(pMac, LOGE, FL("SME_UPDATE_APWPSIE_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002716 return eSIR_FAILURE;
2717 }
2718
2719 return eSIR_SUCCESS;
2720} /*** end limSetContextReqSerDes() ***/
2721
2722/**
2723 * limUpdateAPWPARSNIEsReqSerDes ()
2724 *
2725 *FUNCTION:
2726 * This function is to deserialize UpdateAPWPSIEs message
2727 *
2728 *PARAMS:
2729 *
2730 *LOGIC:
2731 *
2732 *ASSUMPTIONS:
2733 * NA
2734 *
2735 *NOTE:
2736 * NA
2737 *
2738 * @param pUpdateAPWPARSNIEsReq Pointer to tpSirUpdateAPWPARSNIEsReq being
2739 * extracted
2740 * @param pBuf Pointer to serialized buffer
2741 *
2742 * @return retCode Indicates whether message is successfully
2743 * de-serialized (eSIR_SUCCESS) or
2744 * not (eSIR_FAILURE)
2745 */
2746
2747tSirRetStatus
2748limUpdateAPWPARSNIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq, tANI_U8 *pBuf)
2749{
2750 tANI_S16 len = 0;
2751
2752 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPARSNIEsReq));)
2753
2754 if (!pUpdateAPWPARSNIEsReq || !pBuf)
2755 return eSIR_FAILURE;
2756
2757 pUpdateAPWPARSNIEsReq->messageType = limGetU16(pBuf);
2758 pBuf += sizeof(tANI_U16);
2759
2760 len = pUpdateAPWPARSNIEsReq->length = limGetU16(pBuf);
2761 pBuf += sizeof(tANI_U16);
2762
2763 if (len < (tANI_S16) sizeof(tANI_U32))
2764 return eSIR_FAILURE;
2765
2766 len -= sizeof(tANI_U32); // skip message header
2767 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2768 return eSIR_FAILURE;
2769
2770 // Extract transactionId
2771 pUpdateAPWPARSNIEsReq->transactionId = limGetU16( pBuf );
2772 pBuf += sizeof(tANI_U16);
2773 len -= sizeof( tANI_U16 );
2774 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2775 return eSIR_FAILURE;
2776
2777 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302778 vos_mem_copy( (tANI_U8 *) pUpdateAPWPARSNIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002779 pBuf += sizeof(tSirMacAddr);
2780 len -= sizeof(tSirMacAddr);
2781 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2782 return eSIR_FAILURE;
2783
2784 // Extract sessionId
2785 pUpdateAPWPARSNIEsReq->sessionId = *pBuf++;
2786 len--;
2787 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2788 return eSIR_FAILURE;
2789
2790 // Extract APWPARSNIEs
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302791 vos_mem_copy( (tSirRSNie *) &pUpdateAPWPARSNIEsReq->APWPARSNIEs, pBuf, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07002792 pBuf += sizeof(tSirRSNie);
2793 len -= sizeof(tSirRSNie);
2794
2795 if (len < 0)
2796 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002797 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002798 return eSIR_FAILURE;
2799 }
2800
2801 return eSIR_SUCCESS;
2802} /*** end limUpdateAPWPARSNIEsReqSerDes() ***/
2803