blob: cb80e611eb2d058863982c8c16433365a87e874c [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
232#ifdef FEATURE_WLAN_CCX
233 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
Jeff Johnson295189b2012-06-20 16:38:30 -0700742 if (len)
743 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700744 limLog(pMac, LOGW, FL("Extra bytes left in SME_START_BSS_REQ, len=%d"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700745 }
746
747 return eSIR_SUCCESS;
748} /*** end limStartBssReqSerDes() ***/
749
750
751
752/**
753 * limStopBssReqSerDes()
754 *
755 *FUNCTION:
756 * This function is called by limProcessSmeMessages() upon receiving
757 * SME_STOP_BSS_REQ from host
758 *
759 *PARAMS:
760 *
761 *LOGIC:
762 *
763 *ASSUMPTIONS:
764 * NA
765 *
766 *NOTE:
767 * NA
768 *
769 * @param pStopBssReq Pointer to tSirSmeStopBssReq being extracted
770 * @param pBuf Pointer to serialized buffer
771 * @return retCode Indicates whether message is successfully
772 * de-serialized (eSIR_SUCCESS) or
773 * not (eSIR_FAILURE)
774 */
775
776tSirRetStatus
777limStopBssReqSerDes(tpAniSirGlobal pMac, tpSirSmeStopBssReq pStopBssReq, tANI_U8 *pBuf)
778{
779 tANI_S16 len = 0;
780
781#ifdef PE_DEBUG_LOG1
782 tANI_U8 *pTemp = pBuf;
783#endif
784
785 pStopBssReq->messageType = limGetU16(pBuf);
786 pBuf += sizeof(tANI_U16);
787
788 len = pStopBssReq->length = limGetU16(pBuf);
789 pBuf += sizeof(tANI_U16);
790
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700791 PELOG1(limLog(pMac, LOG1, FL("SME_STOP_BSS_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700792 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
793
794 if (len < (tANI_S16) sizeof(tANI_U32))
795 return eSIR_FAILURE;
796
797 len -= sizeof(tANI_U32); // skip message header
798 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
799 return eSIR_FAILURE;
800
801 // Extract sessionId
802 pStopBssReq->sessionId = *pBuf++;
803 len--;
804 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
805 return eSIR_FAILURE;
806
807 // Extract transactionId
808 pStopBssReq->transactionId = limGetU16(pBuf);
809 pBuf += sizeof(tANI_U16);
810 len -= sizeof(tANI_U16);
811
812 // Extract reasonCode
813 pStopBssReq->reasonCode = (tSirResultCodes) limGetU32(pBuf);
814 pBuf += sizeof(tSirResultCodes);
815 len -= sizeof(tSirResultCodes);
816
817 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530818 vos_mem_copy( (tANI_U8 *) pStopBssReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700819 len -= sizeof(tSirMacAddr);
820
821 if (len)
822 return eSIR_FAILURE;
823 else
824 return eSIR_SUCCESS;
825
826} /*** end limStopBssReqSerDes() ***/
827
828
829
830/**
831 * limJoinReqSerDes()
832 *
833 *FUNCTION:
834 * This function is called by limProcessSmeMessages() upon receiving
835 * SME_JOIN_REQ from host
836 *
837 *PARAMS:
838 *
839 *LOGIC:
840 *
841 *ASSUMPTIONS:
842 * NA
843 *
844 *NOTE:
845 * NA
846 *
847 * @param pJoinReq Pointer to tSirSmeJoinReq being extracted
848 * @param pBuf Pointer to serialized buffer
849 * @return retCode Indicates whether message is successfully
850 * de-serialized (eSIR_SUCCESS) or
851 * not (eSIR_FAILURE)
852 */
853
854tSirRetStatus
855limJoinReqSerDes(tpAniSirGlobal pMac, tpSirSmeJoinReq pJoinReq, tANI_U8 *pBuf)
856{
857 tANI_S16 len = 0;
858 tANI_S16 lenUsed = 0;
859
860#ifdef PE_DEBUG_LOG1
861 tANI_U8 *pTemp = pBuf;
862#endif
863
864 if (!pJoinReq || !pBuf)
865 {
Abhishek Singh57aebef2014-02-03 18:47:44 +0530866 PELOGE(limLog(pMac, LOGE, FL("pJoinReq or pBuf is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700867 return eSIR_FAILURE;
868 }
869
870 // Extract messageType
871 pJoinReq->messageType = limGetU16(pBuf);
872 pBuf += sizeof(tANI_U16);
873
874 // Extract length
875 len = pJoinReq->length = limGetU16(pBuf);
876 pBuf += sizeof(tANI_U16);
877
878 if (pJoinReq->messageType == eWNI_SME_JOIN_REQ)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700879 PELOG1(limLog(pMac, LOG3, FL("SME_JOIN_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700880 else
Abhishek Singh57aebef2014-02-03 18:47:44 +0530881 PELOG1(limLog(pMac, LOG3, FL("SME_REASSOC_REQ length %d bytes is:"),
882 len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700883
884 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
885
886 if (len < (tANI_S16) sizeof(tANI_U32))
887 {
Abhishek Singh57aebef2014-02-03 18:47:44 +0530888 PELOGE(limLog(pMac, LOGE, FL("len %d is too short"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700889 return eSIR_FAILURE;
890 }
891
892 len -= sizeof(tANI_U32); // skip message header
893 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530894 {
895 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700896 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530897 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700898 // Extract sessionId
899 pJoinReq->sessionId = *pBuf++;
900 len--;
901 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530902 {
903 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700904 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530905 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700906 // Extract transactionId
907 pJoinReq->transactionId = limGetU16(pBuf);
908 pBuf += sizeof(tANI_U16);
909 len -= sizeof(tANI_U16);
910 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530911 {
912 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700913 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530914 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700915
916 // Extract ssId
917 pJoinReq->ssId.length = *pBuf++;
918 len--;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530919 vos_mem_copy( (tANI_U8 *) pJoinReq->ssId.ssId, pBuf, pJoinReq->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -0700920 pBuf += pJoinReq->ssId.length;
921 len -= pJoinReq->ssId.length;
922 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530923 {
924 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700925 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530926 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700927
928 // Extract selfMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530929 vos_mem_copy( pJoinReq->selfMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700930 pBuf += sizeof(tSirMacAddr);
931 len -= sizeof(tSirMacAddr);
932 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530933 {
934 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700935 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530936 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700937
938 // Extract bsstype
939 pJoinReq->bsstype = (tSirBssType) limGetU32(pBuf);
940 pBuf += sizeof(tANI_U32);
941 len -= sizeof(tANI_U32);
942 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530943 {
944 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700945 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530946 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700947
948 // Extract dot11mode
949 pJoinReq->dot11mode= *pBuf++;
950 len--;
951 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530952 {
953 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700954 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530955 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700956
957 // Extract bssPersona
958 pJoinReq->staPersona = *pBuf++;
959 len--;
960 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530961 {
962 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700963 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530964 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700965
Jeff Johnsone7245742012-09-05 17:12:55 -0700966 // Extract cbMode
967 pJoinReq->cbMode = *pBuf++;
968 len--;
969 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530970 {
971 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnsone7245742012-09-05 17:12:55 -0700972 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530973 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700974
Jeff Johnson295189b2012-06-20 16:38:30 -0700975 // Extract uapsdPerAcBitmask
976 pJoinReq->uapsdPerAcBitmask = *pBuf++;
977 len--;
978 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530979 {
980 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700981 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530982 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700983
Jeff Johnson295189b2012-06-20 16:38:30 -0700984
985 // Extract operationalRateSet
986 pJoinReq->operationalRateSet.numRates= *pBuf++;
987 len--;
988 if (pJoinReq->operationalRateSet.numRates)
989 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530990 vos_mem_copy( (tANI_U8 *) pJoinReq->operationalRateSet.rate, pBuf,
991 pJoinReq->operationalRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700992 pBuf += pJoinReq->operationalRateSet.numRates;
993 len -= pJoinReq->operationalRateSet.numRates;
994 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530995 {
996 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700997 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530998 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700999 }
1000
1001 // Extract extendedRateSet
1002 pJoinReq->extendedRateSet.numRates = *pBuf++;
1003 len--;
1004 if (pJoinReq->extendedRateSet.numRates)
1005 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301006 vos_mem_copy( pJoinReq->extendedRateSet.rate, pBuf, pJoinReq->extendedRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07001007 pBuf += pJoinReq->extendedRateSet.numRates;
1008 len -= pJoinReq->extendedRateSet.numRates;
1009 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301010 {
1011 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001012 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301013 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001014 }
1015
1016 // Extract RSN IE
1017 pJoinReq->rsnIE.length = limGetU16(pBuf);
1018 pBuf += sizeof(tANI_U16);
1019 len -= sizeof(tANI_U16);
1020
1021 if (pJoinReq->rsnIE.length)
1022 {
1023 // Check for RSN IE length (that includes length of type & length)
1024 if ((pJoinReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2) ||
1025 (pJoinReq->rsnIE.length != 2 + *(pBuf + 1)))
1026 {
1027 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001028 FL("Invalid RSN IE length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001029 pJoinReq->rsnIE.length);
1030 return eSIR_FAILURE;
1031 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301032 vos_mem_copy( (tANI_U8 *) pJoinReq->rsnIE.rsnIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001033 pBuf, pJoinReq->rsnIE.length);
1034 pBuf += pJoinReq->rsnIE.length;
1035 len -= pJoinReq->rsnIE.length; // skip RSN IE
1036 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301037 {
1038 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001039 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301040 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001041 }
1042
1043#ifdef FEATURE_WLAN_CCX
1044 // Extract CCKM IE
1045 pJoinReq->cckmIE.length = limGetU16(pBuf);
1046 pBuf += sizeof(tANI_U16);
1047 len -= sizeof(tANI_U16);
1048 if (pJoinReq->cckmIE.length)
1049 {
1050 // Check for CCKM IE length (that includes length of type & length)
1051 if ((pJoinReq->cckmIE.length > SIR_MAC_MAX_IE_LENGTH) ||
1052 (pJoinReq->cckmIE.length != (2 + *(pBuf + 1))))
1053 {
1054 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001055 FL("Invalid CCKM IE length %d/%d in SME_JOIN/REASSOC_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001056 pJoinReq->cckmIE.length, 2 + *(pBuf + 1));
1057 return eSIR_FAILURE;
1058 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301059 vos_mem_copy((tANI_U8 *) pJoinReq->cckmIE.cckmIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001060 pBuf, pJoinReq->cckmIE.length);
1061 pBuf += pJoinReq->cckmIE.length;
1062 len -= pJoinReq->cckmIE.length; // skip CCKM IE
1063 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301064 {
1065 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001066 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301067 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001068 }
1069#endif
1070
1071 // Extract Add IE for scan
1072 pJoinReq->addIEScan.length = limGetU16(pBuf);
1073 pBuf += sizeof(tANI_U16);
1074 len -= sizeof(tANI_U16);
1075
1076 if (pJoinReq->addIEScan.length)
1077 {
1078 // Check for IE length (that includes length of type & length)
1079 if (pJoinReq->addIEScan.length > SIR_MAC_MAX_IE_LENGTH + 2)
1080 {
1081 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001082 FL("Invalid addIE Scan length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001083 pJoinReq->addIEScan.length);
1084 return eSIR_FAILURE;
1085 }
1086 // Check for P2P IE length (that includes length of type & length)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301087 vos_mem_copy( (tANI_U8 *) pJoinReq->addIEScan.addIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001088 pBuf, pJoinReq->addIEScan.length);
1089 pBuf += pJoinReq->addIEScan.length;
1090 len -= pJoinReq->addIEScan.length; // skip add IE
1091 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301092 {
1093 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001094 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301095 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001096 }
1097
1098 pJoinReq->addIEAssoc.length = limGetU16(pBuf);
1099 pBuf += sizeof(tANI_U16);
1100 len -= sizeof(tANI_U16);
1101
1102 // Extract Add IE for assoc
1103 if (pJoinReq->addIEAssoc.length)
1104 {
1105 // Check for IE length (that includes length of type & length)
1106 if (pJoinReq->addIEAssoc.length > SIR_MAC_MAX_IE_LENGTH + 2)
1107 {
1108 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001109 FL("Invalid addIE Assoc length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001110 pJoinReq->addIEAssoc.length);
1111 return eSIR_FAILURE;
1112 }
1113 // Check for P2P IE length (that includes length of type & length)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301114 vos_mem_copy( (tANI_U8 *) pJoinReq->addIEAssoc.addIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001115 pBuf, pJoinReq->addIEAssoc.length);
1116 pBuf += pJoinReq->addIEAssoc.length;
1117 len -= pJoinReq->addIEAssoc.length; // skip add IE
1118 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301119 {
1120 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001121 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301122 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001123 }
1124
Venkata Prathyusha Kuntupallie8dc41d2013-04-15 14:31:36 -07001125 pJoinReq->UCEncryptionType = limGetU32(pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001126 pBuf += sizeof(tANI_U32);
1127 len -= sizeof(tANI_U32);
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);
1131 return eSIR_FAILURE;
1132 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001133
Venkata Prathyusha Kuntupallie8dc41d2013-04-15 14:31:36 -07001134 pJoinReq->MCEncryptionType = limGetU32(pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001135 pBuf += sizeof(tANI_U32);
1136 len -= sizeof(tANI_U32);
1137 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301138 {
1139 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1140 return eSIR_FAILURE;
1141 }
Chet Lanctot186b5732013-03-18 10:26:30 -07001142#ifdef WLAN_FEATURE_11W
1143 pJoinReq->MgmtEncryptionType = limGetU32(pBuf);
1144 pBuf += sizeof(tANI_U32);
1145 len -= sizeof(tANI_U32);
1146 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301147 {
1148 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Chet Lanctot186b5732013-03-18 10:26:30 -07001149 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301150 }
Chet Lanctot186b5732013-03-18 10:26:30 -07001151#endif
1152
Jeff Johnson295189b2012-06-20 16:38:30 -07001153#ifdef WLAN_FEATURE_VOWIFI_11R
1154 //is11Rconnection;
1155 pJoinReq->is11Rconnection = (tAniBool)limGetU32(pBuf);
1156 pBuf += sizeof(tAniBool);
1157 len -= sizeof(tAniBool);
1158 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301159 {
1160 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1161 return eSIR_FAILURE;
1162 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001163#endif
1164
1165#ifdef FEATURE_WLAN_CCX
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05301166 //CCX version IE
1167 pJoinReq->isCCXFeatureIniEnabled = (tAniBool)limGetU32(pBuf);
1168 pBuf += sizeof(tAniBool);
1169 len -= sizeof(tAniBool);
1170 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301171 {
1172 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05301173 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301174 }
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05301175
Jeff Johnson295189b2012-06-20 16:38:30 -07001176 //isCCXconnection;
1177 pJoinReq->isCCXconnection = (tAniBool)limGetU32(pBuf);
1178 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);
1183 return eSIR_FAILURE;
1184 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001185
1186 // TSPEC information
1187 pJoinReq->ccxTspecInfo.numTspecs = *pBuf++;
1188 len -= sizeof(tANI_U8);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301189 vos_mem_copy((void*)&pJoinReq->ccxTspecInfo.tspec[0], pBuf,
1190 (sizeof(tTspecInfo)* pJoinReq->ccxTspecInfo.numTspecs));
Jeff Johnson295189b2012-06-20 16:38:30 -07001191 pBuf += sizeof(tTspecInfo)*SIR_CCX_MAX_TSPEC_IES;
1192 len -= sizeof(tTspecInfo)*SIR_CCX_MAX_TSPEC_IES;
1193 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301194 {
1195 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001196 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301197 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001198#endif
1199
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001200#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07001201 //isFastTransitionEnabled;
1202 pJoinReq->isFastTransitionEnabled = (tAniBool)limGetU32(pBuf);
1203 pBuf += sizeof(tAniBool);
1204 len -= sizeof(tAniBool);
1205 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301206 {
1207 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1208 return eSIR_FAILURE;
1209 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001210#endif
1211
Jeff Johnson43971f52012-07-17 12:26:56 -07001212#ifdef FEATURE_WLAN_LFR
1213 //isFastRoamIniFeatureEnabled;
1214 pJoinReq->isFastRoamIniFeatureEnabled = (tAniBool)limGetU32(pBuf);
1215 pBuf += sizeof(tAniBool);
1216 len -= sizeof(tAniBool);
1217 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301218 {
1219 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1220 return eSIR_FAILURE;
1221 }
Jeff Johnson43971f52012-07-17 12:26:56 -07001222#endif
1223
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001224 //txLdpcIniFeatureEnabled
1225 pJoinReq->txLdpcIniFeatureEnabled= *pBuf++;
1226 len--;
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);
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001230 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301231 }
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001232
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001233 //txBFIniFeatureEnabled
1234 pJoinReq->txBFIniFeatureEnabled= *pBuf++;
1235 len--;
1236 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301237 {
1238 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001239 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301240 }
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001241
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001242 //txBFCsnValue
1243 pJoinReq->txBFCsnValue= *pBuf++;
1244 len--;
1245 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301246 {
1247 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001248 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301249 }
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001250
krunal soni5afa96c2013-09-06 22:19:02 -07001251 pJoinReq->isAmsduSupportInAMPDU= *pBuf++;
1252 len--;
1253 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301254 {
1255 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
krunal soni5afa96c2013-09-06 22:19:02 -07001256 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301257 }
krunal soni5afa96c2013-09-06 22:19:02 -07001258
Sandeep Puligillaaea98a22013-12-04 13:36:32 +05301259 pJoinReq->isWMEenabled = (tAniBool)limGetU32(pBuf);
1260 pBuf += sizeof(tAniBool);
1261 len -= sizeof(tAniBool);
1262 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1263 return eSIR_FAILURE;
1264
1265 pJoinReq->isQosEnabled = (tAniBool)limGetU32(pBuf);
1266 pBuf += sizeof(tAniBool);
1267 len -= sizeof(tAniBool);
1268 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1269 return eSIR_FAILURE;
1270
Jeff Johnson295189b2012-06-20 16:38:30 -07001271 // Extract Titan CB Neighbor BSS info
1272 pJoinReq->cbNeighbors.cbBssFoundPri = *pBuf;
1273 pBuf++;
1274 pJoinReq->cbNeighbors.cbBssFoundSecUp = *pBuf;
1275 pBuf++;
1276 pJoinReq->cbNeighbors.cbBssFoundSecDown = *pBuf;
1277 pBuf++;
1278 len -= 3;
1279
1280 // Extract Spectrum Mgt Indicator
1281 pJoinReq->spectrumMgtIndicator = (tAniBool) limGetU32(pBuf);
1282 pBuf += sizeof(tAniBool);
1283 len -= sizeof(tAniBool);
1284
1285 pJoinReq->powerCap.minTxPower = *pBuf++;
1286 pJoinReq->powerCap.maxTxPower = *pBuf++;
1287 len -=2;
Jeff Johnson295189b2012-06-20 16:38:30 -07001288
1289 pJoinReq->supportedChannels.numChnl = *pBuf++;
1290 len--;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301291 vos_mem_copy( (tANI_U8 *) pJoinReq->supportedChannels.channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001292 pBuf, pJoinReq->supportedChannels.numChnl);
1293 pBuf += pJoinReq->supportedChannels.numChnl;
1294 len-= pJoinReq->supportedChannels.numChnl;
1295
1296 PELOG2(limLog(pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001297 FL("spectrumInd ON: minPower %d, maxPower %d , numChnls %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001298 pJoinReq->powerCap.minTxPower,
1299 pJoinReq->powerCap.maxTxPower,
1300 pJoinReq->supportedChannels.numChnl);)
1301
1302 // Extract uapsdPerAcBitmask
1303 pJoinReq->uapsdPerAcBitmask = *pBuf++;
1304 len--;
1305 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301306 {
1307 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001308 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301309 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001310
Jeff Johnson295189b2012-06-20 16:38:30 -07001311 //
1312 // NOTE - tSirBssDescription is now moved to the end
1313 // of tSirSmeJoinReq structure. This is to accomodate
1314 // the variable length data member ieFields[1]
1315 //
1316 if (limGetBssDescription( pMac, &pJoinReq->bssDescription,
1317 len, &lenUsed, pBuf) == eSIR_FAILURE)
1318 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001319 PELOGE(limLog(pMac, LOGE, FL("get bss description failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001320 return eSIR_FAILURE;
1321 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05301322 PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3,
1323 (tANI_U8 *) &(pJoinReq->bssDescription),
1324 pJoinReq->bssDescription.length + 2);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001325 pBuf += lenUsed;
1326 len -= lenUsed;
Jeff Johnson295189b2012-06-20 16:38:30 -07001327
1328 return eSIR_SUCCESS;
1329} /*** end limJoinReqSerDes() ***/
1330
1331
1332/**---------------------------------------------------------------
1333\fn limAssocIndSerDes
1334\brief This function is called by limProcessMlmAssocInd() to
1335\ populate the SME_ASSOC_IND message based on the received
1336\ MLM_ASSOC_IND.
1337\
1338\param pMac
1339\param pAssocInd - Pointer to the received tLimMlmAssocInd
1340\param pBuf - Pointer to serialized buffer
1341\param psessionEntry - pointer to PE session entry
1342\
1343\return None
1344------------------------------------------------------------------*/
1345void
1346limAssocIndSerDes(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
1347{
1348 tANI_U8 *pLen = pBuf;
1349 tANI_U16 mLen = 0;
1350
1351#ifdef PE_DEBUG_LOG1
1352 tANI_U8 *pTemp = pBuf;
1353#endif
1354
Jeff Johnson295189b2012-06-20 16:38:30 -07001355
1356 mLen = sizeof(tANI_U32);
1357 mLen += sizeof(tANI_U8);
1358 pBuf += sizeof(tANI_U16);
1359 *pBuf = psessionEntry->smeSessionId;
1360 pBuf += sizeof(tANI_U8);
1361
1362 // Fill in peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301363 vos_mem_copy( pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001364 pBuf += sizeof(tSirMacAddr);
1365 mLen += sizeof(tSirMacAddr);
1366
1367 // Fill in aid
1368 limCopyU16(pBuf, pAssocInd->aid);
1369 pBuf += sizeof(tANI_U16);
1370 mLen += sizeof(tANI_U16);
1371
1372 // Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301373 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001374 pBuf += sizeof(tSirMacAddr);
1375 mLen += sizeof(tSirMacAddr);
1376
1377 // Fill in staId
1378 limCopyU16(pBuf, psessionEntry->staId);
1379 pBuf += sizeof(tANI_U16);
1380 mLen += sizeof(tANI_U16);
1381
1382 // Fill in authType
1383 limCopyU32(pBuf, pAssocInd->authType);
1384 pBuf += sizeof(tANI_U32);
1385 mLen += sizeof(tANI_U32);
1386
1387 // Fill in ssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301388 vos_mem_copy( pBuf, (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001389 pBuf += (1 + pAssocInd->ssId.length);
1390 mLen += (1 + pAssocInd->ssId.length);
1391
1392 // Fill in rsnIE
1393 limCopyU16(pBuf, pAssocInd->rsnIE.length);
1394 pBuf += sizeof(tANI_U16);
1395 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301396 vos_mem_copy( pBuf, (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001397 pAssocInd->rsnIE.length);
1398 pBuf += pAssocInd->rsnIE.length;
1399 mLen += pAssocInd->rsnIE.length;
1400
Jeff Johnson295189b2012-06-20 16:38:30 -07001401
Jeff Johnson295189b2012-06-20 16:38:30 -07001402 limCopyU32(pBuf, pAssocInd->spectrumMgtIndicator);
1403 pBuf += sizeof(tAniBool);
1404 mLen += sizeof(tAniBool);
1405
1406 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1407 {
1408 *pBuf = pAssocInd->powerCap.minTxPower;
1409 pBuf++;
1410 *pBuf = pAssocInd->powerCap.maxTxPower;
1411 pBuf++;
1412 mLen += sizeof(tSirMacPowerCapInfo);
1413
1414 *pBuf = pAssocInd->supportedChannels.numChnl;
1415 pBuf++;
1416 mLen++;
1417
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301418 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -07001419 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
1420 pAssocInd->supportedChannels.numChnl);
1421
1422
1423 pBuf += pAssocInd->supportedChannels.numChnl;
1424 mLen += pAssocInd->supportedChannels.numChnl;
1425 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001426 limCopyU32(pBuf, pAssocInd->WmmStaInfoPresent);
1427 pBuf += sizeof(tANI_U32);
1428 mLen += sizeof(tANI_U32);
Jeff Johnson295189b2012-06-20 16:38:30 -07001429 // Fill in length of SME_ASSOC_IND message
1430 limCopyU16(pLen, mLen);
1431
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001432 PELOG1(limLog(pMac, LOG1, FL("Sending SME_ASSOC_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001433 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1434} /*** end limAssocIndSerDes() ***/
1435
1436
1437
1438/**
1439 * limAssocCnfSerDes()
1440 *
1441 *FUNCTION:
1442 * This function is called by limProcessLmmMessages() when
1443 * SME_ASSOC_CNF or SME_REASSOC_CNF message is received from
1444 * upper layer software.
1445 *
1446 *PARAMS:
1447 *
1448 *LOGIC:
1449 *
1450 *ASSUMPTIONS:
1451 * NA
1452 *
1453 *NOTE:
1454 * NA
1455 *
1456 * @param pAssocCnf Pointer to tSirSmeAssocCnf being extracted into
1457 * @param pBuf Pointer to serialized buffer
1458 * @return retCode Indicates whether message is successfully
1459 * de-serialized (eSIR_SUCCESS) or
1460 * not (eSIR_FAILURE)
1461 */
1462
1463tSirRetStatus
1464limAssocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeAssocCnf pAssocCnf, tANI_U8 *pBuf)
1465{
1466#ifdef PE_DEBUG_LOG1
1467 tANI_U8 *pTemp = pBuf;
1468#endif
1469
1470 if (!pAssocCnf || !pBuf)
1471 return eSIR_FAILURE;
1472
1473 pAssocCnf->messageType = limGetU16(pBuf);
1474 pBuf += sizeof(tANI_U16);
1475
1476 pAssocCnf->length = limGetU16(pBuf);
1477 pBuf += sizeof(tANI_U16);
1478
1479 if (pAssocCnf->messageType == eWNI_SME_ASSOC_CNF)
1480 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001481 PELOG1(limLog(pMac, LOG1, FL("SME_ASSOC_CNF length %d bytes is:"), pAssocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001482 }
1483 else
1484 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001485 PELOG1(limLog(pMac, LOG1, FL("SME_REASSOC_CNF length %d bytes is:"), pAssocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001486 }
1487 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pAssocCnf->length);)
1488
1489 // status code
1490 pAssocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
1491 pBuf += sizeof(tSirResultCodes);
1492
1493 // bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301494 vos_mem_copy( pAssocCnf->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001495 pBuf += sizeof(tSirMacAddr);
1496
1497 // peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301498 vos_mem_copy( pAssocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001499 pBuf += sizeof(tSirMacAddr);
1500
1501
1502 pAssocCnf->aid = limGetU16(pBuf);
1503 pBuf += sizeof(tANI_U16);
1504 // alternateBssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301505 vos_mem_copy( pAssocCnf->alternateBssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001506 pBuf += sizeof(tSirMacAddr);
1507
1508 // alternateChannelId
1509 pAssocCnf->alternateChannelId = *pBuf;
1510 pBuf++;
1511
1512 return eSIR_SUCCESS;
1513} /*** end limAssocCnfSerDes() ***/
1514
1515
1516
1517/**
1518 * limDisassocCnfSerDes()
1519 *
1520 *FUNCTION:
1521 * This function is called by limProcessSmeMessages() when
1522 * SME_DISASSOC_CNF message is received from upper layer software.
1523 *
1524 *PARAMS:
1525 *
1526 *LOGIC:
1527 *
1528 *ASSUMPTIONS:
1529 * NA
1530 *
1531 *NOTE:
1532 * NA
1533 *
1534 * @param pDisassocCnf Pointer to tSirSmeDisassocCnf being
1535 * extracted into
1536 * @param pBuf Pointer to serialized buffer
1537 * @return retCode Indicates whether message is successfully
1538 * de-serialized (eSIR_SUCCESS) or
1539 * not (eSIR_FAILURE)
1540 */
1541
1542tSirRetStatus
1543limDisassocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeDisassocCnf pDisassocCnf, tANI_U8 *pBuf)
1544{
1545#ifdef PE_DEBUG_LOG1
1546 tANI_U8 *pTemp = pBuf;
1547#endif
1548
1549 if (!pDisassocCnf || !pBuf)
1550 return eSIR_FAILURE;
1551
1552 pDisassocCnf->messageType = limGetU16(pBuf);
1553 pBuf += sizeof(tANI_U16);
1554
1555 pDisassocCnf->length = limGetU16(pBuf);
1556 pBuf += sizeof(tANI_U16);
1557
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001558 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_CNF length %d bytes is:"), pDisassocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001559 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pDisassocCnf->length);)
1560
1561 pDisassocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
1562 pBuf += sizeof(tSirResultCodes);
1563
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301564 vos_mem_copy( pDisassocCnf->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001565 pBuf += sizeof(tSirMacAddr);
Jeff Johnson62c27982013-02-27 17:53:55 -08001566
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301567 vos_mem_copy( pDisassocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001568
Jeff Johnson62c27982013-02-27 17:53:55 -08001569
Jeff Johnson295189b2012-06-20 16:38:30 -07001570 return eSIR_SUCCESS;
1571} /*** end limDisassocCnfSerDes() ***/
1572
1573
1574
Jeff Johnson295189b2012-06-20 16:38:30 -07001575
1576
1577/**---------------------------------------------------------------
1578\fn limReassocIndSerDes
1579\brief This function is called by limProcessMlmReassocInd() to
1580\ populate the SME_REASSOC_IND message based on the received
1581\ MLM_REASSOC_IND.
1582\
1583\param pMac
1584\param pReassocInd - Pointer to the received tLimMlmReassocInd
1585\param pBuf - Pointer to serialized buffer
1586\param psessionEntry - pointer to PE session entry
1587\
1588\return None
1589------------------------------------------------------------------*/
1590void
1591limReassocIndSerDes(tpAniSirGlobal pMac, tpLimMlmReassocInd pReassocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
1592{
1593 tANI_U8 *pLen = pBuf;
1594 tANI_U16 mLen = 0;
1595
1596#ifdef PE_DEBUG_LOG1
1597 tANI_U8 *pTemp = pBuf;
1598#endif
1599
Jeff Johnson295189b2012-06-20 16:38:30 -07001600
1601 mLen = sizeof(tANI_U32);
1602 pBuf += sizeof(tANI_U16);
1603 *pBuf++ = psessionEntry->smeSessionId;
1604 mLen += sizeof(tANI_U8);
1605
1606 // Fill in peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301607 vos_mem_copy( pBuf, pReassocInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001608 pBuf += sizeof(tSirMacAddr);
1609 mLen += sizeof(tSirMacAddr);
1610
1611 // Fill in oldMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301612 vos_mem_copy( pBuf, pReassocInd->currentApAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001613 pBuf += sizeof(tSirMacAddr);
1614 mLen += sizeof(tSirMacAddr);
1615
1616 // Fill in aid
1617 limCopyU16(pBuf, pReassocInd->aid);
1618 pBuf += sizeof(tANI_U16);
1619 mLen += sizeof(tANI_U16);
1620
1621 // Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301622 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001623 pBuf += sizeof(tSirMacAddr);
1624 mLen += sizeof(tSirMacAddr);
1625
1626 // Fill in staId
1627 limCopyU16(pBuf, psessionEntry->staId);
1628 pBuf += sizeof(tANI_U16);
1629 mLen += sizeof(tANI_U16);
1630
1631 // Fill in authType
1632 limCopyU32(pBuf, pReassocInd->authType);
1633 pBuf += sizeof(tAniAuthType);
1634 mLen += sizeof(tAniAuthType);
1635
1636 // Fill in ssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301637 vos_mem_copy( pBuf, (tANI_U8 *) &(pReassocInd->ssId),
Jeff Johnson295189b2012-06-20 16:38:30 -07001638 pReassocInd->ssId.length + 1);
1639 pBuf += 1 + pReassocInd->ssId.length;
1640 mLen += pReassocInd->ssId.length + 1;
1641
1642 // Fill in rsnIE
1643 limCopyU16(pBuf, pReassocInd->rsnIE.length);
1644 pBuf += sizeof(tANI_U16);
1645 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301646 vos_mem_copy( pBuf, (tANI_U8 *) &(pReassocInd->rsnIE.rsnIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001647 pReassocInd->rsnIE.length);
1648 pBuf += pReassocInd->rsnIE.length;
1649 mLen += pReassocInd->rsnIE.length;
1650
1651 // Fill in addIE
1652 limCopyU16(pBuf, pReassocInd->addIE.length);
1653 pBuf += sizeof(tANI_U16);
1654 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301655 vos_mem_copy( pBuf, (tANI_U8*) &(pReassocInd->addIE.addIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001656 pReassocInd->addIE.length);
1657 pBuf += pReassocInd->addIE.length;
1658 mLen += pReassocInd->addIE.length;
1659
Jeff Johnson295189b2012-06-20 16:38:30 -07001660
Jeff Johnson295189b2012-06-20 16:38:30 -07001661 limCopyU32(pBuf, pReassocInd->spectrumMgtIndicator);
1662 pBuf += sizeof(tAniBool);
1663 mLen += sizeof(tAniBool);
1664
1665 if (pReassocInd->spectrumMgtIndicator == eSIR_TRUE)
1666 {
1667 *pBuf = pReassocInd->powerCap.minTxPower;
1668 pBuf++;
1669 *pBuf = pReassocInd->powerCap.maxTxPower;
1670 pBuf++;
1671 mLen += sizeof(tSirMacPowerCapInfo);
1672
1673 *pBuf = pReassocInd->supportedChannels.numChnl;
1674 pBuf++;
1675 mLen++;
1676
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301677 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -07001678 (tANI_U8 *) &(pReassocInd->supportedChannels.channelList),
1679 pReassocInd->supportedChannels.numChnl);
1680
1681 pBuf += pReassocInd->supportedChannels.numChnl;
1682 mLen += pReassocInd->supportedChannels.numChnl;
1683 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001684 limCopyU32(pBuf, pReassocInd->WmmStaInfoPresent);
1685 pBuf += sizeof(tANI_U32);
1686 mLen += sizeof(tANI_U32);
Jeff Johnson295189b2012-06-20 16:38:30 -07001687
1688 // Fill in length of SME_REASSOC_IND message
1689 limCopyU16(pLen, mLen);
1690
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001691 PELOG1(limLog(pMac, LOG1, FL("Sending SME_REASSOC_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001692 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1693} /*** end limReassocIndSerDes() ***/
1694
1695
1696/**
1697 * limAuthIndSerDes()
1698 *
1699 *FUNCTION:
1700 * This function is called by limProcessMlmAuthInd() while sending
1701 * SME_AUTH_IND to host
1702 *
1703 *PARAMS:
1704 *
1705 *LOGIC:
1706 *
1707 *ASSUMPTIONS:
1708 * NA
1709 *
1710 *NOTE:
1711 * NA
1712 *
1713 * @param pAuthInd Pointer to tSirSmeAuthInd being sent
1714 * @param pBuf Pointer to serialized buffer
1715 *
1716 * @return None
1717 */
1718
1719void
1720limAuthIndSerDes(tpAniSirGlobal pMac, tpLimMlmAuthInd pAuthInd, tANI_U8 *pBuf)
1721{
1722 tANI_U8 *pLen = pBuf;
1723 tANI_U16 mLen = 0;
1724
1725#ifdef PE_DEBUG_LOG1
1726 tANI_U8 *pTemp = pBuf;
1727#endif
1728
1729 mLen = sizeof(tANI_U32);
1730 pBuf += sizeof(tANI_U16);
1731 *pBuf++ = pAuthInd->sessionId;
1732 mLen += sizeof(tANI_U8);
1733
1734 // BTAMP TODO: Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301735 vos_mem_set(pBuf, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001736 pBuf += sizeof(tSirMacAddr);
1737 mLen += sizeof(tSirMacAddr);
1738
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301739 vos_mem_copy( pBuf, pAuthInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001740 pBuf += sizeof(tSirMacAddr);
1741 mLen += sizeof(tSirMacAddr);
1742
1743 limCopyU32(pBuf, pAuthInd->authType);
1744 pBuf += sizeof(tAniAuthType);
1745 mLen += sizeof(tAniAuthType);
1746
1747 limCopyU16(pLen, mLen);
1748
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001749 PELOG1(limLog(pMac, LOG1, FL("Sending SME_AUTH_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001750 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1751} /*** end limAuthIndSerDes() ***/
1752
1753
1754
1755/**
1756 * limSetContextReqSerDes()
1757 *
1758 *FUNCTION:
1759 * This function is called by limProcessSmeMessages() upon receiving
1760 * SME_SETCONTEXT_REQ from host
1761 *
1762 *PARAMS:
1763 *
1764 *LOGIC:
1765 *
1766 *ASSUMPTIONS:
1767 * NA
1768 *
1769 *NOTE:
1770 * NA
1771 *
1772 * @param pSetContextReq Pointer to tSirSmeSetContextReq being
1773 * extracted
1774 * @param pBuf Pointer to serialized buffer
1775 *
1776 * @return retCode Indicates whether message is successfully
1777 * de-serialized (eSIR_SUCCESS) or
1778 * not (eSIR_FAILURE)
1779 */
1780
1781tSirRetStatus
1782limSetContextReqSerDes(tpAniSirGlobal pMac, tpSirSmeSetContextReq pSetContextReq, tANI_U8 *pBuf)
1783{
1784 tANI_S16 len = 0;
1785 tANI_U16 totalKeySize = sizeof(tANI_U8); // initialized to sizeof numKeys
1786 tANI_U8 numKeys;
1787 tANI_U8 *pKeys;
1788
1789#ifdef PE_DEBUG_LOG1
1790 tANI_U8 *pTemp = pBuf;
1791#endif
1792 if (!pSetContextReq || !pBuf)
1793 return eSIR_FAILURE;
1794
1795 pSetContextReq->messageType = limGetU16(pBuf);
1796 pBuf += sizeof(tANI_U16);
1797
1798 len = pSetContextReq->length = limGetU16(pBuf);
1799 pBuf += sizeof(tANI_U16);
1800
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001801 PELOG1(limLog(pMac, LOG1, FL("SME_SETCONTEXT_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001802 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
1803
1804 if (len < (tANI_S16) sizeof(tANI_U32))
1805 return eSIR_FAILURE;
1806
1807 len -= sizeof(tANI_U32); // skip message header
1808 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1809 return eSIR_FAILURE;
1810
1811 // Extract sessionId
1812 pSetContextReq->sessionId = *pBuf++;
1813 len--;
1814 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1815 return eSIR_FAILURE;
1816
1817 // Extract transactionId
1818 pSetContextReq->transactionId = sirReadU16N(pBuf);
1819 pBuf += sizeof(tANI_U16);
1820 len -= sizeof(tANI_U16);
1821 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1822 return eSIR_FAILURE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301823 vos_mem_copy( (tANI_U8 *) pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001824 pBuf, sizeof(tSirMacAddr));
1825 pBuf += sizeof(tSirMacAddr);
1826 len -= sizeof(tSirMacAddr);
1827 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1828 return eSIR_FAILURE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301829 vos_mem_copy( pSetContextReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001830 pBuf += sizeof(tSirMacAddr);
1831 len -= sizeof(tSirMacAddr);
1832 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1833 return eSIR_FAILURE;
1834
Jeff Johnson295189b2012-06-20 16:38:30 -07001835
1836// pSetContextReq->qosInfoPresent = limGetU32(pBuf);
1837// pBuf += sizeof(tAniBool);
1838
1839// if (pSetContextReq->qosInfoPresent)
1840// {
1841// len = limGetQosInfo(&pSetContextReq->qos, pBuf);
1842// pBuf += len;
1843// }
1844
1845 pSetContextReq->keyMaterial.length = limGetU16(pBuf);
1846 pBuf += sizeof(tANI_U16);
1847 len -= sizeof(tANI_U16);
1848 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1849 return eSIR_FAILURE;
1850
1851 pSetContextReq->keyMaterial.edType = (tAniEdType) limGetU32(pBuf);
1852 pBuf += sizeof(tAniEdType);
1853 len -= sizeof(tAniEdType);
1854 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1855 return eSIR_FAILURE;
1856
1857 numKeys = pSetContextReq->keyMaterial.numKeys = *pBuf++;
1858 len -= sizeof(numKeys);
1859
1860 if (numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
1861 return eSIR_FAILURE;
1862
1863 /** Initialize the Default Keys if no Keys are being sent from the upper layer*/
1864 if( limCheckRemainingLength(pMac, len) == eSIR_FAILURE) {
1865 tpSirKeys pKeyinfo = pSetContextReq->keyMaterial.key;
1866
1867 pKeyinfo->keyId = 0;
1868 pKeyinfo->keyDirection = eSIR_TX_RX;
1869 pKeyinfo->keyLength = 0;
1870
1871 if (!limIsAddrBC(pSetContextReq->peerMacAddr))
1872 pKeyinfo->unicast = 1;
1873 else
1874 pKeyinfo->unicast = 0;
1875 }else {
1876 pKeys = (tANI_U8 *) pSetContextReq->keyMaterial.key;
1877 do {
1878 tANI_U32 keySize = limGetKeysInfo(pMac, (tpSirKeys) pKeys,
1879 pBuf);
1880 pBuf += keySize;
1881 pKeys += sizeof(tSirKeys);
1882 totalKeySize += (tANI_U16) keySize;
1883 if (numKeys == 0)
1884 break;
1885 numKeys--;
1886 }while (numKeys);
1887 }
1888 return eSIR_SUCCESS;
1889} /*** end limSetContextReqSerDes() ***/
1890
1891/**
1892 * limRemoveKeyReqSerDes()
1893 *
1894 *FUNCTION:
1895 * This function is called by limProcessSmeMessages() upon receiving
1896 * SME_REMOVEKEY_REQ from host
1897 *
1898 *PARAMS:
1899 *
1900 *LOGIC:
1901 *
1902 *ASSUMPTIONS:
1903 * NA
1904 *
1905 *NOTE:
1906 * NA
1907 *
1908 * @param pRemoveKeyReq Pointer to tSirSmeRemoveKeyReq being
1909 * extracted
1910 * @param pBuf Pointer to serialized buffer
1911 *
1912 * @return retCode Indicates whether message is successfully
1913 * de-serialized (eSIR_SUCCESS) or
1914 * not (eSIR_FAILURE)
1915 */
1916
1917tSirRetStatus
1918limRemoveKeyReqSerDes(tpAniSirGlobal pMac, tpSirSmeRemoveKeyReq pRemoveKeyReq, tANI_U8 *pBuf)
1919{
1920 tANI_S16 len = 0;
1921
1922#ifdef PE_DEBUG_LOG1
1923 tANI_U8 *pTemp = pBuf;
1924#endif
1925 if (!pRemoveKeyReq || !pBuf)
1926 return eSIR_FAILURE;
1927
1928 pRemoveKeyReq->messageType = limGetU16(pBuf);
1929 pBuf += sizeof(tANI_U16);
1930
1931 len = pRemoveKeyReq->length = limGetU16(pBuf);
1932 pBuf += sizeof(tANI_U16);
1933
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001934 PELOG1(limLog(pMac, LOG1, FL("SME_REMOVEKEY_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001935 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
1936
1937 if (len < (tANI_S16) sizeof(tANI_U32))
1938 return eSIR_FAILURE;
1939
1940 len -= sizeof(tANI_U32); // skip message header
1941 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1942 return eSIR_FAILURE;
1943
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301944 vos_mem_copy( (tANI_U8 *) pRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001945 pBuf, sizeof(tSirMacAddr));
1946 pBuf += sizeof(tSirMacAddr);
1947 len -= sizeof(tSirMacAddr);
1948 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1949 return eSIR_FAILURE;
1950
Jeff Johnson295189b2012-06-20 16:38:30 -07001951
1952 pRemoveKeyReq->edType = *pBuf;
1953 pBuf += sizeof(tANI_U8);
1954 len -= sizeof(tANI_U8);
1955 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1956 return eSIR_FAILURE;
1957
1958 pRemoveKeyReq->wepType = *pBuf;
1959
1960 pBuf += sizeof(tANI_U8);
1961 len -= sizeof(tANI_U8);
1962 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1963 return eSIR_FAILURE;
1964
1965 pRemoveKeyReq->keyId = *pBuf;
1966
1967 pBuf += sizeof(tANI_U8);
1968 len -= sizeof(tANI_U8);
1969 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1970 return eSIR_FAILURE;
1971
1972 pRemoveKeyReq->unicast = *pBuf;
1973 len--;
1974 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1975 return eSIR_FAILURE;
1976
1977 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301978 vos_mem_copy( pRemoveKeyReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001979 pBuf += sizeof(tSirMacAddr);
1980 len -= sizeof(tSirMacAddr);
1981 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1982 return eSIR_FAILURE;
1983
1984 // Extract sessionId
1985 pRemoveKeyReq->sessionId = *pBuf++;
1986 len--;
1987 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1988 return eSIR_FAILURE;
1989
1990 // Extract transactionId
1991 pRemoveKeyReq->transactionId = sirReadU16N(pBuf);
1992 pBuf += sizeof(tANI_U16);
1993 len -= sizeof(tANI_U16);
1994 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1995 return eSIR_FAILURE;
1996
1997 return eSIR_SUCCESS;
1998} /*** end limRemoveKeyReqSerDes() ***/
1999
2000
2001
2002/**
2003 * limDisassocReqSerDes()
2004 *
2005 *FUNCTION:
2006 * This function is called by limProcessSmeMessages() upon receiving
2007 * SME_DISASSOC_REQ from host
2008 *
2009 *PARAMS:
2010 *
2011 *LOGIC:
2012 *
2013 *ASSUMPTIONS:
2014 * NA
2015 *
2016 *NOTE:
2017 * NA
2018 *
2019 * @param pDisassocReq Pointer to tSirSmeDisassocReq being extracted
2020 * @param pBuf Pointer to serialized buffer
2021 *
2022 * @return retCode Indicates whether message is successfully
2023 * de-serialized (eSIR_SUCCESS) or
2024 * not (eSIR_FAILURE)
2025 */
2026
2027tSirRetStatus
2028limDisassocReqSerDes(tpAniSirGlobal pMac, tSirSmeDisassocReq *pDisassocReq, tANI_U8 *pBuf)
2029{
2030 tANI_S16 len = 0;
2031#ifdef PE_DEBUG_LOG1
2032 tANI_U8 *pTemp = pBuf;
2033#endif
2034
2035 if (!pDisassocReq || !pBuf)
2036 return eSIR_FAILURE;
2037
2038 pDisassocReq->messageType = limGetU16(pBuf);
2039 pBuf += sizeof(tANI_U16);
2040
2041 len = pDisassocReq->length = limGetU16(pBuf);
2042 pBuf += sizeof(tANI_U16);
2043
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002044 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002045 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2046
2047 if (len < (tANI_S16) sizeof(tANI_U32))
2048 return eSIR_FAILURE;
2049
2050 len -= sizeof(tANI_U32); // skip message header
2051 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2052 return eSIR_FAILURE;
2053
2054 // Extract sessionID
2055 pDisassocReq->sessionId = *pBuf;
2056 pBuf += sizeof(tANI_U8);
2057 len -= sizeof(tANI_U8);
2058 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2059 return eSIR_FAILURE;
2060
2061 // Extract transactionid
2062 pDisassocReq->transactionId = limGetU16(pBuf);
2063 pBuf += sizeof(tANI_U16);
2064 len -= sizeof(tANI_U16);
2065 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2066 return eSIR_FAILURE;
2067
2068 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302069 vos_mem_copy( (tANI_U8 *) pDisassocReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002070 pBuf += sizeof(tSirMacAddr);
2071 len -= sizeof(tSirMacAddr);
2072 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2073 return eSIR_FAILURE;
2074
2075 // Extract peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302076 vos_mem_copy( pDisassocReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002077 pBuf += sizeof(tSirMacAddr);
2078 len -= sizeof(tSirMacAddr);
2079 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2080 return eSIR_FAILURE;
2081
2082 // Extract reasonCode
2083 pDisassocReq->reasonCode = limGetU16(pBuf);
2084 pBuf += sizeof(tANI_U16);
2085 len -= sizeof(tANI_U16);
2086 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2087 return eSIR_FAILURE;
2088
2089 pDisassocReq->doNotSendOverTheAir = *pBuf;
2090 pBuf += sizeof(tANI_U8);
2091 len -= sizeof(tANI_U8);
2092
Jeff Johnson295189b2012-06-20 16:38:30 -07002093
2094 return eSIR_SUCCESS;
2095} /*** end limDisassocReqSerDes() ***/
2096
2097
2098
2099/**
2100 * limDeauthReqSerDes()
2101 *
2102 *FUNCTION:
2103 * This function is called by limProcessSmeMessages() upon receiving
2104 * SME_DEAUTH_REQ from host
2105 *
2106 *PARAMS:
2107 *
2108 *LOGIC:
2109 *
2110 *ASSUMPTIONS:
2111 * NA
2112 *
2113 *NOTE:
2114 * NA
2115 *
2116 * @param pDeauthReq Pointer to tSirSmeDeauthReq being extracted
2117 * @param pBuf Pointer to serialized buffer
2118 *
2119 * @return retCode Indicates whether message is successfully
2120 * de-serialized (eSIR_SUCCESS) or
2121 * not (eSIR_FAILURE)
2122 */
2123tSirRetStatus
2124limDeauthReqSerDes(tpAniSirGlobal pMac, tSirSmeDeauthReq *pDeauthReq, tANI_U8 *pBuf)
2125{
2126 tANI_S16 len = 0;
2127
2128#ifdef PE_DEBUG_LOG1
2129 tANI_U8 *pTemp = pBuf;
2130#endif
2131
2132 if (!pDeauthReq || !pBuf)
2133 return eSIR_FAILURE;
2134
2135 pDeauthReq->messageType = limGetU16(pBuf);
2136 pBuf += sizeof(tANI_U16);
2137
2138 len = pDeauthReq->length = limGetU16(pBuf);
2139 pBuf += sizeof(tANI_U16);
2140
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002141 PELOG1(limLog(pMac, LOG1, FL("SME_DEAUTH_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002142 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2143
2144 if (len < (tANI_S16) sizeof(tANI_U32))
2145 return eSIR_FAILURE;
2146
2147 len -= sizeof(tANI_U32); // skip message header
2148 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2149 return eSIR_FAILURE;
2150
2151 // Extract sessionId
2152 pDeauthReq->sessionId = *pBuf++;
2153 len--;
2154 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2155 return eSIR_FAILURE;
2156
2157 // Extract transactionId
2158 pDeauthReq->transactionId = limGetU16(pBuf);
2159 pBuf += sizeof(tANI_U16);
2160 len -= sizeof(tANI_U16);
2161 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2162 return eSIR_FAILURE;
2163
2164 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302165 vos_mem_copy( pDeauthReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002166 pBuf += sizeof(tSirMacAddr);
2167 len -= sizeof(tSirMacAddr);
2168 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2169 return eSIR_FAILURE;
2170
2171 // Extract peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302172 vos_mem_copy( pDeauthReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002173 pBuf += sizeof(tSirMacAddr);
2174 len -= sizeof(tSirMacAddr);
2175 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2176 return eSIR_FAILURE;
2177
2178 // Extract reasonCode
2179 pDeauthReq->reasonCode = limGetU16(pBuf);
2180 pBuf += sizeof(tANI_U16);
2181 len -= sizeof(tANI_U16);
2182
Jeff Johnson295189b2012-06-20 16:38:30 -07002183
2184 return eSIR_SUCCESS;
2185} /*** end limDisassocReqSerDes() ***/
2186
2187
2188
2189
Jeff Johnson295189b2012-06-20 16:38:30 -07002190
2191
2192/**
2193 * limStatSerDes()
2194 *
2195 *FUNCTION:
2196 * This function is called by limSendSmeDisassocNtf() while sending
2197 * SME_DISASSOC_IND/eWNI_SME_DISASSOC_RSP to host
2198 *
2199 *PARAMS:
2200 *
2201 *LOGIC:
2202 *
2203 *ASSUMPTIONS:
2204 * NA
2205 *
2206 *NOTE:
2207 * NA
2208 *
2209 * @param pAssocInd Pointer to tpAniStaStatStruct being sent
2210 * @param pBuf Pointer to serialized buffer
2211 *
2212 * @return None
2213 */
2214
2215void
2216limStatSerDes(tpAniSirGlobal pMac, tpAniStaStatStruct pStat, tANI_U8 *pBuf)
2217{
2218#ifdef PE_DEBUG_LOG1
2219 tANI_U8 *pTemp = pBuf;
2220#endif
2221
2222 limCopyU32(pBuf, pStat->sentAesBlksUcastHi);
2223 pBuf += sizeof(tANI_U32);
2224
2225 limCopyU32(pBuf, pStat->sentAesBlksUcastLo);
2226 pBuf += sizeof(tANI_U32);
2227
2228 limCopyU32(pBuf, pStat->recvAesBlksUcastHi);
2229 pBuf += sizeof(tANI_U32);
2230
2231 limCopyU32(pBuf, pStat->recvAesBlksUcastLo);
2232 pBuf += sizeof(tANI_U32);
2233
2234 limCopyU32(pBuf, pStat->aesFormatErrorUcastCnts);
2235 pBuf += sizeof(tANI_U32);
2236
2237 limCopyU32(pBuf, pStat->aesReplaysUcast);
2238 pBuf += sizeof(tANI_U32);
2239
2240 limCopyU32(pBuf, pStat->aesDecryptErrUcast);
2241 pBuf += sizeof(tANI_U32);
2242
2243 limCopyU32(pBuf, pStat->singleRetryPkts);
2244 pBuf += sizeof(tANI_U32);
2245
2246 limCopyU32(pBuf, pStat->failedTxPkts);
2247 pBuf += sizeof(tANI_U32);
2248
2249 limCopyU32(pBuf, pStat->ackTimeouts);
2250 pBuf += sizeof(tANI_U32);
2251
2252 limCopyU32(pBuf, pStat->multiRetryPkts);
2253 pBuf += sizeof(tANI_U32);
2254
2255 limCopyU32(pBuf, pStat->fragTxCntsHi);
2256 pBuf += sizeof(tANI_U32);
2257
2258 limCopyU32(pBuf, pStat->fragTxCntsLo);
2259 pBuf += sizeof(tANI_U32);
2260
2261 limCopyU32(pBuf, pStat->transmittedPktsHi);
2262 pBuf += sizeof(tANI_U32);
2263
2264 limCopyU32(pBuf, pStat->transmittedPktsLo);
2265 pBuf += sizeof(tANI_U32);
2266
2267 limCopyU32(pBuf, pStat->phyStatHi);
2268 pBuf += sizeof(tANI_U32);
2269
2270 limCopyU32(pBuf, pStat->phyStatLo);
2271 pBuf += sizeof(tANI_U32);
2272
2273 limCopyU32(pBuf, pStat->uplinkRssi);
2274 pBuf += sizeof(tANI_U32);
2275
2276 limCopyU32(pBuf, pStat->uplinkSinr);
2277 pBuf += sizeof(tANI_U32);
2278
2279 limCopyU32(pBuf, pStat->uplinkRate);
2280 pBuf += sizeof(tANI_U32);
2281
2282 limCopyU32(pBuf, pStat->downlinkRssi);
2283 pBuf += sizeof(tANI_U32);
2284
2285 limCopyU32(pBuf, pStat->downlinkSinr);
2286 pBuf += sizeof(tANI_U32);
2287
2288 limCopyU32(pBuf, pStat->downlinkRate);
2289 pBuf += sizeof(tANI_U32);
2290
2291 limCopyU32(pBuf, pStat->nRcvBytes);
2292 pBuf += sizeof(tANI_U32);
2293
2294 limCopyU32(pBuf, pStat->nXmitBytes);
2295 pBuf += sizeof(tANI_U32);
2296
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002297 PELOG1(limLog(pMac, LOG1, FL("STAT: length %d bytes is:"), sizeof(tAniStaStatStruct));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002298 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, sizeof(tAniStaStatStruct));)
2299
2300} /*** end limStatSerDes() ***/
2301
2302
Jeff Johnson295189b2012-06-20 16:38:30 -07002303
2304
2305/**
2306 * limPackBkgndScanFailNotify()
2307 *
2308 *FUNCTION:
2309 * This function is called by limSendSmeWmStatusChangeNtf()
2310 * to pack the tSirBackgroundScanInfo message
2311 *
2312 */
2313void
2314limPackBkgndScanFailNotify(tpAniSirGlobal pMac,
2315 tSirSmeStatusChangeCode statusChangeCode,
2316 tpSirBackgroundScanInfo pScanInfo,
2317 tSirSmeWmStatusChangeNtf *pSmeNtf,
2318 tANI_U8 sessionId)
2319{
2320
2321 tANI_U16 length = (sizeof(tANI_U16) * 2) + sizeof(tANI_U8) +
2322 sizeof(tSirSmeStatusChangeCode) +
2323 sizeof(tSirBackgroundScanInfo);
2324
Jeff Johnson295189b2012-06-20 16:38:30 -07002325 pSmeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
2326 pSmeNtf->statusChangeCode = statusChangeCode;
2327 pSmeNtf->length = length;
2328 pSmeNtf->sessionId = sessionId;
2329 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanSuccess = pScanInfo->numOfScanSuccess;
2330 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanFailure = pScanInfo->numOfScanFailure;
2331 pSmeNtf->statusChangeInfo.bkgndScanInfo.reserved = pScanInfo->reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07002332}
2333
Jeff Johnson295189b2012-06-20 16:38:30 -07002334
Jeff Johnson295189b2012-06-20 16:38:30 -07002335/**
2336 * limIsSmeGetAssocSTAsReqValid()
2337 *
2338 *FUNCTION:
2339 * This function is called by limProcessSmeReqMessages() upon
2340 * receiving SME_GET_ASSOC_STAS_REQ message from application.
2341 *
2342 *LOGIC:
2343 * Message validity checks are performed in this function
2344 *
2345 *ASSUMPTIONS:
2346 *
2347 *NOTE:
2348 *
2349 * @param pBuf - Pointer to a serialized SME_GET_ASSOC_STAS_REQ message
2350 * @param pSmeMsg - Pointer to a tSirSmeGetAssocSTAsReq structure
2351 * @return true if SME_GET_ASSOC_STAS_REQ message is formatted correctly
2352 * false otherwise
2353 */
2354tANI_BOOLEAN
2355limIsSmeGetAssocSTAsReqValid(tpAniSirGlobal pMac, tpSirSmeGetAssocSTAsReq pGetAssocSTAsReq, tANI_U8 *pBuf)
2356{
2357 tANI_S16 len = 0;
2358
2359 pGetAssocSTAsReq->messageType = limGetU16(pBuf);
2360 pBuf += sizeof(tANI_U16);
2361
2362 len = pGetAssocSTAsReq->length = limGetU16(pBuf);
2363 pBuf += sizeof(tANI_U16);
2364
2365 if (len < (tANI_S16) sizeof(tANI_U32))
2366 return eSIR_FAILURE;
2367
2368 len -= sizeof(tANI_U32); // skip message header
2369 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2370 return eSIR_FAILURE;
2371
2372 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302373 vos_mem_copy( (tANI_U8 *) pGetAssocSTAsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002374 pBuf += sizeof(tSirMacAddr);
2375 len -= sizeof(tSirMacAddr);
2376 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2377 return eSIR_FAILURE;
2378
2379 // Extract modId
2380 pGetAssocSTAsReq->modId = limGetU16(pBuf);
2381 pBuf += sizeof(tANI_U16);
2382 len -= sizeof(tANI_U16);
2383 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2384 return eSIR_FAILURE;
2385
2386 // Extract pUsrContext
krunal soni4f802b22014-02-11 17:01:13 -08002387 vos_mem_copy((tANI_U8 *)pGetAssocSTAsReq->pUsrContext, pBuf, sizeof(void*));
2388 pBuf += sizeof(void*);
2389 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002390 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2391 return eSIR_FAILURE;
2392
2393 // Extract pSapEventCallback
krunal soni4f802b22014-02-11 17:01:13 -08002394 vos_mem_copy((tANI_U8 *)pGetAssocSTAsReq->pSapEventCallback, pBuf, sizeof(void*));
2395 pBuf += sizeof(void*);
2396 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002397 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2398 return eSIR_FAILURE;
2399
2400 // Extract pAssocStasArray
krunal soni4f802b22014-02-11 17:01:13 -08002401 vos_mem_copy((tANI_U8 *)pGetAssocSTAsReq->pAssocStasArray, pBuf, sizeof(void*));
2402 pBuf += sizeof(void*);
2403 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002404
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002405 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002406
2407 if (len < 0)
2408 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002409 PELOGE(limLog(pMac, LOGE, FL("SME_GET_ASSOC_STAS_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002410 return eANI_BOOLEAN_FALSE;
2411 }
2412
2413 return eANI_BOOLEAN_TRUE;
2414}
2415
2416/**
2417 * limTkipCntrMeasReqSerDes()
2418 *
2419 *FUNCTION:
2420 * This function is called by limProcessSmeMessages() upon receiving
2421 * eWNI_SME_TKIP_CNTR_MEAS_REQ from host HDD
2422 *
2423 *PARAMS:
2424 *
2425 *LOGIC:
2426 *
2427 *ASSUMPTIONS:
2428 * NA
2429 *
2430 *NOTE:
2431 * NA
2432 *
2433 * @param tpSirSmeTkipCntrMeasReq Pointer to tSirSmeTkipCntrMeasReq being extracted
2434 * @param pBuf Pointer to serialized buffer
2435 * @return retCode Indicates whether message is successfully
2436 * de-serialized (eSIR_SUCCESS) or
2437 * not (eSIR_FAILURE)
2438 */
2439tSirRetStatus
2440limTkipCntrMeasReqSerDes(tpAniSirGlobal pMac, tpSirSmeTkipCntrMeasReq pTkipCntrMeasReq, tANI_U8 *pBuf)
2441{
2442 tANI_S16 len = 0;
2443
2444#ifdef PE_DEBUG_LOG1
2445 tANI_U8 *pTemp = pBuf;
2446#endif
2447
2448 pTkipCntrMeasReq->messageType = limGetU16(pBuf);
2449 pBuf += sizeof(tANI_U16);
2450
2451 len = pTkipCntrMeasReq->length = limGetU16(pBuf);
2452 pBuf += sizeof(tANI_U16);
2453
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002454 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002455 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2456
2457 if (len < (tANI_S16) sizeof(tANI_U32))
2458 return eSIR_FAILURE;
2459
2460 len -= sizeof(tANI_U32); // skip message header
2461 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2462 return eSIR_FAILURE;
2463
2464 // Extract sessionId
2465 pTkipCntrMeasReq->sessionId = *pBuf++;
2466 len--;
2467 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2468 return eSIR_FAILURE;
2469
2470 // Extract transactionId
2471 pTkipCntrMeasReq->transactionId = limGetU16(pBuf);
2472 pBuf += sizeof(tANI_U16);
2473 len -= sizeof(tANI_U16);
2474 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2475 return eSIR_FAILURE;
2476
2477 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302478 vos_mem_copy( (tANI_U8 *) pTkipCntrMeasReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002479 pBuf += sizeof(tSirMacAddr);
2480 len -= sizeof(tSirMacAddr);
2481 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2482 return eSIR_FAILURE;
2483
2484 // Extract bEnable
2485 pTkipCntrMeasReq->bEnable = *pBuf++;
2486 len --;
2487
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002488 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002489
2490 if (len)
2491 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002492 PELOGE(limLog(pMac, LOGE, FL("SME_TKIP_CNTR_MEAS_REQ invalid "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002493 return eSIR_FAILURE;
2494 }
2495 else
2496 return eSIR_SUCCESS;
2497}
2498
2499/**
2500 * limIsSmeGetWPSPBCSessionsReqValid()
2501 *
2502 *FUNCTION:
2503 * This function is called by limProcessSmeGetWPSPBCSessions() upon
2504 * receiving query WPS PBC overlap information message from application.
2505 *
2506 *LOGIC:
2507 * Message validity checks are performed in this function
2508 *
2509 *ASSUMPTIONS:
2510 *
2511 *NOTE:
2512 *
2513 * @param pBuf - Pointer to a serialized SME_GET_WPSPBC_SESSION_REQ message
2514 * @param pGetWPSPBCSessionsReq - Pointer to a tSirSmeGetWPSPBCSessionsReq structure
2515 * @return true if SME_GET_WPSPBC_SESSION_REQ message is formatted correctly
2516 * false otherwise
2517 */
2518
2519tSirRetStatus
2520limIsSmeGetWPSPBCSessionsReqValid(tpAniSirGlobal pMac, tSirSmeGetWPSPBCSessionsReq *pGetWPSPBCSessionsReq, tANI_U8 *pBuf)
2521{
2522 tANI_S16 len = 0;
2523
2524 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirSmeGetWPSPBCSessionsReq));)
2525
2526 pGetWPSPBCSessionsReq->messageType = limGetU16(pBuf);
2527 pBuf += sizeof(tANI_U16);
2528
2529 len = pGetWPSPBCSessionsReq->length = limGetU16(pBuf);
2530 pBuf += sizeof(tANI_U16);
2531
2532 if (len < (tANI_S16) sizeof(tANI_U32))
2533 return eSIR_FAILURE;
2534
2535 len -= sizeof(tANI_U32); // skip message header
2536 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2537 return eSIR_FAILURE;
2538
2539 // Extract pUsrContext
krunal soni4f802b22014-02-11 17:01:13 -08002540 vos_mem_copy((tANI_U8 *)pGetWPSPBCSessionsReq->pUsrContext, pBuf, sizeof(void*));
2541 pBuf += sizeof(void*);
2542 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002543 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2544 return eSIR_FAILURE;
2545
2546 // Extract pSapEventCallback
krunal soni4f802b22014-02-11 17:01:13 -08002547 vos_mem_copy((tANI_U8 *)pGetWPSPBCSessionsReq->pSapEventCallback, pBuf, sizeof(void*));
2548 pBuf += sizeof(void*);
2549 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002550 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2551 return eSIR_FAILURE;
2552
2553 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302554 vos_mem_copy( (tANI_U8 *) pGetWPSPBCSessionsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002555 pBuf += sizeof(tSirMacAddr);
2556 len -= sizeof(tSirMacAddr);
2557
2558 // Extract MAC address of Station to be removed
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302559 vos_mem_copy( (tANI_U8 *) pGetWPSPBCSessionsReq->pRemoveMac, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002560 pBuf += sizeof(tSirMacAddr);
2561 len -= sizeof(tSirMacAddr);
2562
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002563 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002564
2565 if (len < 0)
2566 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002567 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002568 return eSIR_FAILURE;
2569 }
2570
2571 return eSIR_SUCCESS;
2572}
2573
Jeff Johnson295189b2012-06-20 16:38:30 -07002574
2575/**---------------------------------------------------------------
2576\fn limGetSessionInfo
2577\brief This function returns the sessionId and transactionId
2578\ of a message. This assumes that the message structure
2579\ is of format:
2580\ tANI_U16 messageType
2581\ tANI_U16 messageLength
2582\ tANI_U8 sessionId
2583\ tANI_U16 transactionId
2584\param pMac - pMac global structure
2585\param *pBuf - pointer to the message buffer
2586\param sessionId - returned session id value
2587\param transactionId - returned transaction ID value
2588\return None
2589------------------------------------------------------------------*/
2590void
2591limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U8 *sessionId, tANI_U16 *transactionId)
2592{
2593 if (!pBuf)
2594 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002595 limLog(pMac, LOGE, FL("NULL ptr received. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002596 return;
2597 }
2598
2599 pBuf += sizeof(tANI_U16); // skip message type
2600 pBuf += sizeof(tANI_U16); // skip message length
2601
2602 *sessionId = *pBuf; // get sessionId
2603 pBuf++;
2604 *transactionId = limGetU16(pBuf); // get transactionId
2605
2606 return;
2607}
2608
Jeff Johnson295189b2012-06-20 16:38:30 -07002609
2610/**
2611 * limUpdateAPWPSIEsReqSerDes()
2612 *
2613 *FUNCTION:
2614 * This function is to deserialize UpdateAPWPSIEs message
2615 *
2616 *PARAMS:
2617 *
2618 *LOGIC:
2619 *
2620 *ASSUMPTIONS:
2621 * NA
2622 *
2623 *NOTE:
2624 * NA
2625 *
2626 * @param pUpdateAPWPSIEsReq Pointer to tSirUpdateAPWPSIEsReq being
2627 * extracted
2628 * @param pBuf Pointer to serialized buffer
2629 *
2630 * @return retCode Indicates whether message is successfully
2631 * de-serialized (eSIR_SUCCESS) or
2632 * not (eSIR_FAILURE)
2633 */
2634
2635tSirRetStatus
2636limUpdateAPWPSIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq, tANI_U8 *pBuf)
2637{
2638 tANI_S16 len = 0;
2639
2640 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPSIEsReq));)
2641
2642 if (!pUpdateAPWPSIEsReq || !pBuf)
2643 return eSIR_FAILURE;
2644
2645 pUpdateAPWPSIEsReq->messageType = limGetU16(pBuf);
2646 pBuf += sizeof(tANI_U16);
2647
2648 len = pUpdateAPWPSIEsReq->length = limGetU16(pBuf);
2649 pBuf += sizeof(tANI_U16);
2650
2651 if (len < (tANI_S16) sizeof(tANI_U32))
2652 return eSIR_FAILURE;
2653
2654 len -= sizeof(tANI_U32); // skip message header
2655 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2656 return eSIR_FAILURE;
2657
2658 // Extract transactionId
2659 pUpdateAPWPSIEsReq->transactionId = limGetU16( pBuf );
2660 pBuf += sizeof( tANI_U16 );
2661 len -= sizeof( tANI_U16 );
2662 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2663 return eSIR_FAILURE;
2664
2665 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302666 vos_mem_copy( (tANI_U8 *) pUpdateAPWPSIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002667 pBuf += sizeof(tSirMacAddr);
2668 len -= sizeof(tSirMacAddr);
2669 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2670 return eSIR_FAILURE;
2671
2672 // Extract sessionId
2673 pUpdateAPWPSIEsReq->sessionId = *pBuf++;
2674 len--;
2675 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2676 return eSIR_FAILURE;
2677
2678 // Extract APWPSIEs
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302679 vos_mem_copy( (tSirAPWPSIEs *) &pUpdateAPWPSIEsReq->APWPSIEs, pBuf, sizeof(tSirAPWPSIEs));
Jeff Johnson295189b2012-06-20 16:38:30 -07002680 pBuf += sizeof(tSirAPWPSIEs);
2681 len -= sizeof(tSirAPWPSIEs);
2682
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002683 PELOG1(limLog(pMac, LOG1, FL("SME_UPDATE_APWPSIE_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002684
2685 if (len < 0)
2686 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002687 PELOGE(limLog(pMac, LOGE, FL("SME_UPDATE_APWPSIE_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002688 return eSIR_FAILURE;
2689 }
2690
2691 return eSIR_SUCCESS;
2692} /*** end limSetContextReqSerDes() ***/
2693
2694/**
2695 * limUpdateAPWPARSNIEsReqSerDes ()
2696 *
2697 *FUNCTION:
2698 * This function is to deserialize UpdateAPWPSIEs message
2699 *
2700 *PARAMS:
2701 *
2702 *LOGIC:
2703 *
2704 *ASSUMPTIONS:
2705 * NA
2706 *
2707 *NOTE:
2708 * NA
2709 *
2710 * @param pUpdateAPWPARSNIEsReq Pointer to tpSirUpdateAPWPARSNIEsReq being
2711 * extracted
2712 * @param pBuf Pointer to serialized buffer
2713 *
2714 * @return retCode Indicates whether message is successfully
2715 * de-serialized (eSIR_SUCCESS) or
2716 * not (eSIR_FAILURE)
2717 */
2718
2719tSirRetStatus
2720limUpdateAPWPARSNIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq, tANI_U8 *pBuf)
2721{
2722 tANI_S16 len = 0;
2723
2724 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPARSNIEsReq));)
2725
2726 if (!pUpdateAPWPARSNIEsReq || !pBuf)
2727 return eSIR_FAILURE;
2728
2729 pUpdateAPWPARSNIEsReq->messageType = limGetU16(pBuf);
2730 pBuf += sizeof(tANI_U16);
2731
2732 len = pUpdateAPWPARSNIEsReq->length = limGetU16(pBuf);
2733 pBuf += sizeof(tANI_U16);
2734
2735 if (len < (tANI_S16) sizeof(tANI_U32))
2736 return eSIR_FAILURE;
2737
2738 len -= sizeof(tANI_U32); // skip message header
2739 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2740 return eSIR_FAILURE;
2741
2742 // Extract transactionId
2743 pUpdateAPWPARSNIEsReq->transactionId = limGetU16( pBuf );
2744 pBuf += sizeof(tANI_U16);
2745 len -= sizeof( tANI_U16 );
2746 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2747 return eSIR_FAILURE;
2748
2749 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302750 vos_mem_copy( (tANI_U8 *) pUpdateAPWPARSNIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002751 pBuf += sizeof(tSirMacAddr);
2752 len -= sizeof(tSirMacAddr);
2753 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2754 return eSIR_FAILURE;
2755
2756 // Extract sessionId
2757 pUpdateAPWPARSNIEsReq->sessionId = *pBuf++;
2758 len--;
2759 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2760 return eSIR_FAILURE;
2761
2762 // Extract APWPARSNIEs
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302763 vos_mem_copy( (tSirRSNie *) &pUpdateAPWPARSNIEsReq->APWPARSNIEs, pBuf, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07002764 pBuf += sizeof(tSirRSNie);
2765 len -= sizeof(tSirRSNie);
2766
2767 if (len < 0)
2768 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002769 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002770 return eSIR_FAILURE;
2771 }
2772
2773 return eSIR_SUCCESS;
2774} /*** end limUpdateAPWPARSNIEsReqSerDes() ***/
2775