blob: b4294514049723771ae806d8ca9d37287ce10a75 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05302 * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
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
Kapil Gupta04ab1992016-06-26 13:36:51 +0530232#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_ROAM_SCAN_OFFLOAD)
233 /* Extract QBSSLoad_present */
234 pBssDescription->QBSSLoad_present = *pBuf++;
235 len -= sizeof(tANI_U8);
236 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
237 return eSIR_FAILURE;
238
239 /* Extract QBSS_ChanLoad */
240 pBssDescription->QBSS_ChanLoad = *pBuf++;
241 len -= sizeof(tANI_U8);
Jeff Johnson295189b2012-06-20 16:38:30 -0700242 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
243 return eSIR_FAILURE;
244
245 // Extract QBSSLoad_avail
246 pBssDescription->QBSSLoad_avail = limGetU16(pBuf);
247 pBuf += sizeof(tANI_U16);
248 len -= sizeof(tANI_U16);
249 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
250 return eSIR_FAILURE;
251#endif
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -0700252 pBssDescription->fProbeRsp = *pBuf++;
253 len -= sizeof(tANI_U8);
254 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
255 return eSIR_FAILURE;
256
Madan Mohan Koyyalamudi2a6ba242012-10-31 17:06:19 -0700257 /* 3 reserved bytes for padding */
258 pBuf += (3 * sizeof(tANI_U8));
259 len -= 3;
260
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -0700261 pBssDescription->WscIeLen = limGetU32( pBuf );
262 pBuf += sizeof(tANI_U32);
263 len -= sizeof(tANI_U32);
264 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
265 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700266
Madan Mohan Koyyalamudi2a6ba242012-10-31 17:06:19 -0700267 if (WSCIE_PROBE_RSP_LEN < len)
Jeff Johnson295189b2012-06-20 16:38:30 -0700268 {
Madan Mohan Koyyalamudi2a6ba242012-10-31 17:06:19 -0700269 /* Do not copy with WscIeLen
270 * if WscIeLen is not set properly, memory overwrite happen
271 * Ended up with memory corruption and crash
272 * Copy with Fixed size */
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530273 vos_mem_copy( (tANI_U8 *) pBssDescription->WscIeProbeRsp,
Jeff Johnson295189b2012-06-20 16:38:30 -0700274 pBuf,
Madan Mohan Koyyalamudi2a6ba242012-10-31 17:06:19 -0700275 WSCIE_PROBE_RSP_LEN);
276
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 }
Madan Mohan Koyyalamudi2a6ba242012-10-31 17:06:19 -0700278 else
279 {
280 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700281 FL("remaining bytes len %d is less than WSCIE_PROBE_RSP_LEN"),
Madan Mohan Koyyalamudi2a6ba242012-10-31 17:06:19 -0700282 pBssDescription->WscIeLen);
283 return eSIR_FAILURE;
284 }
285
Kapil Gupta38ef58c2016-07-12 22:24:15 +0530286 pBuf += (WSCIE_PROBE_RSP_LEN);
287 len -= (WSCIE_PROBE_RSP_LEN);
288
Kapil Gupta04ab1992016-06-26 13:36:51 +0530289 /* Extract HTCapsPresent */
290 pBssDescription->HTCapsPresent = *pBuf++;
291 len --;
292
293 /* Extract vhtCapsPresent */
294 pBssDescription->vhtCapsPresent = *pBuf++;
295 len --;
296
297 /* Extract wmeInfoPresent */
298 pBssDescription->wmeInfoPresent = *pBuf++;
299 len --;
300
301 /* Extract beacomformingCapable */
302 pBssDescription->beacomformingCapable = *pBuf++;
303 len --;
304
305 /* Extract chanWidth */
306 pBssDescription->chanWidth = *pBuf++;
307 len --;
Jeff Johnson295189b2012-06-20 16:38:30 -0700308
Madan Mohan Koyyalamudic62057b2012-10-30 18:31:54 -0700309 if (len > 0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700310 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530311 vos_mem_copy( (tANI_U8 *) pBssDescription->ieFields,
Jeff Johnson295189b2012-06-20 16:38:30 -0700312 pBuf,
313 len);
314 }
Madan Mohan Koyyalamudic62057b2012-10-30 18:31:54 -0700315 else if (len < 0)
316 {
317 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700318 FL("remaining length is negative. len = %d, actual length = %d"),
Madan Mohan Koyyalamudic62057b2012-10-30 18:31:54 -0700319 len, pBssDescription->length);
320 return eSIR_FAILURE;
321 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700322
323 return eSIR_SUCCESS;
324} /*** end limGetBssDescription() ***/
Jeff Johnson295189b2012-06-20 16:38:30 -0700325
326
327
328/**
329 * limCopyBssDescription()
330 *
331 *FUNCTION:
332 * This function is called by various LIM functions to copy
333 * BSS description to a tANI_U8 buffer
334 *
335 *LOGIC:
336 *
337 *ASSUMPTIONS:
338 * NA
339 *
340 *NOTE:
341 * NA
342 *
343 * @param *pBuf Pointer to the destination buffer
344 * @param pBssDescription Pointer to the BssDescription being copied
345 * @return Length of BSSdescription written
346 */
347
348tANI_U16
349limCopyBssDescription(tpAniSirGlobal pMac, tANI_U8 *pBuf, tSirBssDescription *pBssDescription)
350{
351 tANI_U16 len = 0;
352
353 limCopyU16(pBuf, pBssDescription->length);
354 pBuf += sizeof(tANI_U16);
355 len += sizeof(tANI_U16);
356
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530357 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -0700358 (tANI_U8 *) pBssDescription->bssId,
359 sizeof(tSirMacAddr));
360 pBuf += sizeof(tSirMacAddr);
361 len += sizeof(tSirMacAddr);
362
363 PELOG3(limLog(pMac, LOG3,
364 FL("Copying BSSdescr:channel is %d, aniInd is %d, bssId is "),
365 pBssDescription->channelId, pBssDescription->aniIndicator);
366 limPrintMacAddr(pMac, pBssDescription->bssId, LOG3);)
367
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530368 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -0700369 (tANI_U8 *) (&pBssDescription->scanSysTimeMsec),
370 sizeof(v_TIME_t));
371 pBuf += sizeof(v_TIME_t);
372 len += sizeof(v_TIME_t);
373
374 limCopyU32(pBuf, pBssDescription->timeStamp[0]);
375 pBuf += sizeof(tANI_U32);
376 len += sizeof(tANI_U32);
377
378 limCopyU32(pBuf, pBssDescription->timeStamp[1]);
379 pBuf += sizeof(tANI_U32);
380 len += sizeof(tANI_U32);
381
382 limCopyU16(pBuf, pBssDescription->beaconInterval);
383 pBuf += sizeof(tANI_U16);
384 len += sizeof(tANI_U16);
385
386 limCopyU16(pBuf, pBssDescription->capabilityInfo);
387 pBuf += sizeof(tANI_U16);
388 len += sizeof(tANI_U16);
389
390 limCopyU32(pBuf, pBssDescription->nwType);
391 pBuf += sizeof(tANI_U32);
392 len += sizeof(tANI_U32);
393
394 *pBuf++ = pBssDescription->aniIndicator;
395 len++;
396
397 *pBuf++ = pBssDescription->rssi;
398 len++;
399
400 *pBuf++ = pBssDescription->sinr;
401 len++;
402
403 *pBuf++ = pBssDescription->channelId;
404 len++;
405
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530406 vos_mem_copy( pBuf, (tANI_U8 *) &(pBssDescription->ieFields),
Abhishek Singhbad2b322016-10-21 11:22:33 +0530407 GET_IE_LEN_IN_BSS(pBssDescription->length));
Jeff Johnson295189b2012-06-20 16:38:30 -0700408
409 return (len + sizeof(tANI_U16));
410} /*** end limCopyBssDescription() ***/
411
412
413
Jeff Johnson295189b2012-06-20 16:38:30 -0700414
415
416/**
417 * limGetKeysInfo()
418 *
419 *FUNCTION:
420 * This function is called by various LIM functions to copy
421 * key information from a tANI_U8* buffer pointer to tSirKeys
422 *
423 *LOGIC:
424 *
425 *ASSUMPTIONS:
426 * NA
427 *
428 *NOTE:
429 * NA
430 *
431 * @param *pKeyInfo Pointer to the keyInfo to be copied
432 * @param *pBuf Pointer to the source buffer
433 *
434 * @return Length of key info extracted
435 */
436
437static tANI_U32
438limGetKeysInfo(tpAniSirGlobal pMac, tpSirKeys pKeyInfo, tANI_U8 *pBuf)
439{
440 tANI_U32 len = 0;
441
442 pKeyInfo->keyId = *pBuf++;
443 len++;
444 pKeyInfo->unicast = *pBuf++;
445 len++;
446 pKeyInfo->keyDirection = (tAniKeyDirection) limGetU32(pBuf);
447 len += sizeof(tAniKeyDirection);
448 pBuf += sizeof(tAniKeyDirection);
449
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530450 vos_mem_copy( pKeyInfo->keyRsc, pBuf, WLAN_MAX_KEY_RSC_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -0700451 pBuf += WLAN_MAX_KEY_RSC_LEN;
452 len += WLAN_MAX_KEY_RSC_LEN;
453
454 pKeyInfo->paeRole = *pBuf++;
455 len++;
456
457 pKeyInfo->keyLength = limGetU16(pBuf);
458 pBuf += sizeof(tANI_U16);
459 len += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530460 vos_mem_copy( pKeyInfo->key, pBuf, pKeyInfo->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -0700461 pBuf += pKeyInfo->keyLength;
462 len += pKeyInfo->keyLength;
463
464 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700465 FL("Extracted keyId=%d, keyLength=%d, Key is :"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700466 pKeyInfo->keyId, pKeyInfo->keyLength);
467 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3,
468 pKeyInfo->key, pKeyInfo->keyLength);)
469
470 return len;
471} /*** end limGetKeysInfo() ***/
472
473
474
475/**
476 * limStartBssReqSerDes()
477 *
478 *FUNCTION:
479 * This function is called by limProcessSmeMessages() upon receiving
480 * SME_START_BSS_REQ from host
481 *
482 *PARAMS:
483 *
484 *LOGIC:
485 *
486 *ASSUMPTIONS:
487 * NA
488 *
489 *NOTE:
490 * NA
491 *
492 * @param pStartBssReq Pointer to tSirSmeStartBssReq being extracted
493 * @param pBuf Pointer to serialized buffer
494 * @return retCode Indicates whether message is successfully
495 * de-serialized (eSIR_SUCCESS) or
496 * not (eSIR_FAILURE)
497 */
498
499tSirRetStatus
500limStartBssReqSerDes(tpAniSirGlobal pMac, tpSirSmeStartBssReq pStartBssReq, tANI_U8 *pBuf)
501{
502 tANI_S16 len = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700503
504#ifdef PE_DEBUG_LOG1
505 tANI_U8 *pTemp = pBuf;
506#endif
507
508 if (!pStartBssReq || !pBuf)
509 return eSIR_FAILURE;
510
511 pStartBssReq->messageType = limGetU16(pBuf);
512 pBuf += sizeof(tANI_U16);
513
514 len = pStartBssReq->length = limGetU16(pBuf);
515 pBuf += sizeof(tANI_U16);
516
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700517 PELOG1(limLog(pMac, LOG1, FL("SME_START_BSS_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700518 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
519
520 if (len < (tANI_S16) sizeof(tANI_U32))
521 return eSIR_FAILURE;
522
523 len -= sizeof(tANI_U32); // skip message header
524 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
525 return eSIR_FAILURE;
526
527 // Extract sessionId
528 pStartBssReq->sessionId = *pBuf++;
529 len--;
530 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
531 return eSIR_FAILURE;
532
533 // Extract transactionId
534 pStartBssReq->transactionId = limGetU16( pBuf );
535 pBuf += sizeof( tANI_U16 );
536 len -= sizeof( tANI_U16 );
537 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
538 return eSIR_FAILURE;
539
540 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530541 vos_mem_copy( (tANI_U8 *) pStartBssReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700542 pBuf += sizeof(tSirMacAddr);
543 len -= sizeof(tSirMacAddr);
544 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
545 return eSIR_FAILURE;
546
547 // Extract selfMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530548 vos_mem_copy( (tANI_U8 *) pStartBssReq->selfMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 pBuf += sizeof(tSirMacAddr);
550 len -= sizeof(tSirMacAddr);
551 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
552 return eSIR_FAILURE;
553
554 // Extract beaconInterval
555 pStartBssReq->beaconInterval = limGetU16( pBuf );
556 pBuf += sizeof( tANI_U16 );
557 len -= sizeof( tANI_U16 );
558 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
559 return eSIR_FAILURE;
560
561 // Extract dot11Mode
562 pStartBssReq->dot11mode = *pBuf++;
563 len --;
564 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
565 return eSIR_FAILURE;
566
567 // Extract bssType
568 pStartBssReq->bssType = (tSirBssType) limGetU32(pBuf);
569 pBuf += sizeof(tANI_U32);
570 len -= sizeof(tANI_U32);
571 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
572 return eSIR_FAILURE;
573
574 // Extract ssId
575 if (*pBuf > SIR_MAC_MAX_SSID_LENGTH)
576 {
577 // SSID length is more than max allowed 32 bytes
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700578 PELOGW(limLog(pMac, LOGW, FL("Invalid SSID length, len=%d"), *pBuf);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700579 return eSIR_FAILURE;
580 }
581
582 pStartBssReq->ssId.length = *pBuf++;
583 len--;
584 if (len < pStartBssReq->ssId.length)
585 {
586 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700587 FL("SSID length is longer that the remaining length. SSID len=%d, remaining len=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700588 pStartBssReq->ssId.length, len);
589 return eSIR_FAILURE;
590 }
591
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530592 vos_mem_copy( (tANI_U8 *) pStartBssReq->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700593 pBuf,
594 pStartBssReq->ssId.length);
595 pBuf += pStartBssReq->ssId.length;
596 len -= pStartBssReq->ssId.length;
597 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
598 return eSIR_FAILURE;
599
600 // Extract channelId
601 pStartBssReq->channelId = *pBuf++;
602 len--;
603
604 // Extract CB secondary channel info
Jeff Johnsone7245742012-09-05 17:12:55 -0700605 pStartBssReq->cbMode = (ePhyChanBondState)limGetU32( pBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -0700606 pBuf += sizeof( tANI_U32 );
607 len -= sizeof( tANI_U32 );
608
609 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
610 return eSIR_FAILURE;
611
Jeff Johnson295189b2012-06-20 16:38:30 -0700612
Jeff Johnson295189b2012-06-20 16:38:30 -0700613 // Extract privacy setting
614 pStartBssReq->privacy = *pBuf++;
615 len--;
616 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
617 return eSIR_FAILURE;
618
619 //Extract Uapsd Enable
620 pStartBssReq->apUapsdEnable = *pBuf++;
621 len--;
622 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
623 return eSIR_FAILURE;
624
625 //Extract SSID hidden
626 pStartBssReq->ssidHidden = *pBuf++;
627 len--;
628 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
629 return eSIR_FAILURE;
630
631 pStartBssReq->fwdWPSPBCProbeReq = *pBuf++;
632 len--;
633 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
634 return eSIR_FAILURE;
635
636 //Extract HT Protection Enable
637 pStartBssReq->protEnabled = *pBuf++;
638 len--;
639 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
640 return eSIR_FAILURE;
641
642 //Extract OBSS Protection Enable
643 pStartBssReq->obssProtEnabled = *pBuf++;
644 len--;
645 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
646 return eSIR_FAILURE;
647
648 pStartBssReq->ht_capab = limGetU16(pBuf);
649 pBuf += sizeof(tANI_U16);
650 len -= sizeof(tANI_U16);
651 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
652 return eSIR_FAILURE;
653
654 // Extract AuthType
655 pStartBssReq->authType = (tSirBssType) limGetU32(pBuf);
656 pBuf += sizeof(tANI_U32);
657 len -= sizeof(tANI_U32);
658 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
659 return eSIR_FAILURE;
660
661 // Extract dtimPeriod
662 pStartBssReq->dtimPeriod = limGetU32(pBuf);
663 pBuf += sizeof(tANI_U32);
664 len -= sizeof(tANI_U32);
665 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
666 return eSIR_FAILURE;
667
668 // Extract wps state
669 pStartBssReq->wps_state = *pBuf++;
670 len--;
671 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
672 return eSIR_FAILURE;
673
krunal sonie9002db2013-11-25 14:24:17 -0800674 // Extract isCoalesingInIBSSAllowed
675 pStartBssReq->isCoalesingInIBSSAllowed = *pBuf++;
676 len--;
677 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
678 return eSIR_FAILURE;
679
Jeff Johnson295189b2012-06-20 16:38:30 -0700680 // Extract bssPersona
681 pStartBssReq->bssPersona = *pBuf++;
682 len--;
683 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
684 return eSIR_FAILURE;
685
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -0800686
687 // Extract txLdpcIniFeatureEnabled
688 pStartBssReq->txLdpcIniFeatureEnabled = *pBuf++;
689 len--;
690 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
691 return eSIR_FAILURE;
692
Chet Lanctot8cecea22014-02-11 19:09:36 -0800693#ifdef WLAN_FEATURE_11W
694 // Extract MFP capable/required
695 pStartBssReq->pmfCapable = *pBuf++;
696 len--;
697 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
698 return eSIR_FAILURE;
699 pStartBssReq->pmfRequired = *pBuf++;
700 len--;
701 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
702 return eSIR_FAILURE;
703#endif
704
Jeff Johnson295189b2012-06-20 16:38:30 -0700705 // Extract rsnIe
706 pStartBssReq->rsnIE.length = limGetU16(pBuf);
707 pBuf += sizeof(tANI_U16);
708
709 // Check for RSN IE length (that includes length of type & length
710 if (pStartBssReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2)
711 {
712 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700713 FL("Invalid RSN IE length %d in SME_START_BSS_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700714 pStartBssReq->rsnIE.length);
715 return eSIR_FAILURE;
716 }
717
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530718 vos_mem_copy( pStartBssReq->rsnIE.rsnIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -0700719 pBuf, pStartBssReq->rsnIE.length);
720
721 len -= (sizeof(tANI_U16) + pStartBssReq->rsnIE.length);
722 pBuf += pStartBssReq->rsnIE.length;
723 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
724 return eSIR_FAILURE;
725
726 // Extract nwType
727 pStartBssReq->nwType = (tSirNwType) limGetU32(pBuf);
728 pBuf += sizeof(tSirNwType);
729 len -= sizeof(tSirNwType);
730 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
731 return eSIR_FAILURE;
732
733 // Extract operationalRateSet
734 pStartBssReq->operationalRateSet.numRates = *pBuf++;
735
736 // Check for number of rates
737 if (pStartBssReq->operationalRateSet.numRates >
738 SIR_MAC_MAX_NUMBER_OF_RATES)
739 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700740 limLog(pMac, LOGW, FL("Invalid numRates %d in SME_START_BSS_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700741 pStartBssReq->operationalRateSet.numRates);
742 return eSIR_FAILURE;
743 }
744
745 len--;
746 if (len < pStartBssReq->operationalRateSet.numRates)
747 return eSIR_FAILURE;
748
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530749 vos_mem_copy( (tANI_U8 *) pStartBssReq->operationalRateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -0700750 pBuf,
751 pStartBssReq->operationalRateSet.numRates);
752 pBuf += pStartBssReq->operationalRateSet.numRates;
753 len -= pStartBssReq->operationalRateSet.numRates;
754
755 // Extract extendedRateSet
756 if ((pStartBssReq->nwType == eSIR_11G_NW_TYPE) ||
757 (pStartBssReq->nwType == eSIR_11N_NW_TYPE ))
758 {
759 pStartBssReq->extendedRateSet.numRates = *pBuf++;
760 len--;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530761 vos_mem_copy( pStartBssReq->extendedRateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -0700762 pBuf, pStartBssReq->extendedRateSet.numRates);
763 pBuf += pStartBssReq->extendedRateSet.numRates;
764 len -= pStartBssReq->extendedRateSet.numRates;
765 }
766
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +0530767#ifdef WLAN_FEATURE_AP_HT40_24G
768 /* extract apHT40_24GEnabled */
769 pStartBssReq->apHT40_24GEnabled = *pBuf++;
770 len--;
771#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700772 if (len)
773 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700774 limLog(pMac, LOGW, FL("Extra bytes left in SME_START_BSS_REQ, len=%d"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700775 }
776
777 return eSIR_SUCCESS;
778} /*** end limStartBssReqSerDes() ***/
779
780
781
782/**
783 * limStopBssReqSerDes()
784 *
785 *FUNCTION:
786 * This function is called by limProcessSmeMessages() upon receiving
787 * SME_STOP_BSS_REQ from host
788 *
789 *PARAMS:
790 *
791 *LOGIC:
792 *
793 *ASSUMPTIONS:
794 * NA
795 *
796 *NOTE:
797 * NA
798 *
799 * @param pStopBssReq Pointer to tSirSmeStopBssReq being extracted
800 * @param pBuf Pointer to serialized buffer
801 * @return retCode Indicates whether message is successfully
802 * de-serialized (eSIR_SUCCESS) or
803 * not (eSIR_FAILURE)
804 */
805
806tSirRetStatus
807limStopBssReqSerDes(tpAniSirGlobal pMac, tpSirSmeStopBssReq pStopBssReq, tANI_U8 *pBuf)
808{
809 tANI_S16 len = 0;
810
811#ifdef PE_DEBUG_LOG1
812 tANI_U8 *pTemp = pBuf;
813#endif
814
815 pStopBssReq->messageType = limGetU16(pBuf);
816 pBuf += sizeof(tANI_U16);
817
818 len = pStopBssReq->length = limGetU16(pBuf);
819 pBuf += sizeof(tANI_U16);
820
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700821 PELOG1(limLog(pMac, LOG1, FL("SME_STOP_BSS_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700822 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
823
824 if (len < (tANI_S16) sizeof(tANI_U32))
825 return eSIR_FAILURE;
826
827 len -= sizeof(tANI_U32); // skip message header
828 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
829 return eSIR_FAILURE;
830
831 // Extract sessionId
832 pStopBssReq->sessionId = *pBuf++;
833 len--;
834 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
835 return eSIR_FAILURE;
836
837 // Extract transactionId
838 pStopBssReq->transactionId = limGetU16(pBuf);
839 pBuf += sizeof(tANI_U16);
840 len -= sizeof(tANI_U16);
841
842 // Extract reasonCode
843 pStopBssReq->reasonCode = (tSirResultCodes) limGetU32(pBuf);
844 pBuf += sizeof(tSirResultCodes);
845 len -= sizeof(tSirResultCodes);
846
847 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530848 vos_mem_copy( (tANI_U8 *) pStopBssReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700849 len -= sizeof(tSirMacAddr);
850
851 if (len)
852 return eSIR_FAILURE;
853 else
854 return eSIR_SUCCESS;
855
856} /*** end limStopBssReqSerDes() ***/
857
858
859
860/**
861 * limJoinReqSerDes()
862 *
863 *FUNCTION:
864 * This function is called by limProcessSmeMessages() upon receiving
865 * SME_JOIN_REQ from host
866 *
867 *PARAMS:
868 *
869 *LOGIC:
870 *
871 *ASSUMPTIONS:
872 * NA
873 *
874 *NOTE:
875 * NA
876 *
877 * @param pJoinReq Pointer to tSirSmeJoinReq being extracted
878 * @param pBuf Pointer to serialized buffer
879 * @return retCode Indicates whether message is successfully
880 * de-serialized (eSIR_SUCCESS) or
881 * not (eSIR_FAILURE)
882 */
883
884tSirRetStatus
885limJoinReqSerDes(tpAniSirGlobal pMac, tpSirSmeJoinReq pJoinReq, tANI_U8 *pBuf)
886{
887 tANI_S16 len = 0;
888 tANI_S16 lenUsed = 0;
889
890#ifdef PE_DEBUG_LOG1
891 tANI_U8 *pTemp = pBuf;
892#endif
893
894 if (!pJoinReq || !pBuf)
895 {
Abhishek Singh57aebef2014-02-03 18:47:44 +0530896 PELOGE(limLog(pMac, LOGE, FL("pJoinReq or pBuf is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700897 return eSIR_FAILURE;
898 }
899
900 // Extract messageType
901 pJoinReq->messageType = limGetU16(pBuf);
902 pBuf += sizeof(tANI_U16);
903
904 // Extract length
905 len = pJoinReq->length = limGetU16(pBuf);
906 pBuf += sizeof(tANI_U16);
907
908 if (pJoinReq->messageType == eWNI_SME_JOIN_REQ)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700909 PELOG1(limLog(pMac, LOG3, FL("SME_JOIN_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700910 else
Abhishek Singh57aebef2014-02-03 18:47:44 +0530911 PELOG1(limLog(pMac, LOG3, FL("SME_REASSOC_REQ length %d bytes is:"),
912 len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700913
914 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
915
916 if (len < (tANI_S16) sizeof(tANI_U32))
917 {
Abhishek Singh57aebef2014-02-03 18:47:44 +0530918 PELOGE(limLog(pMac, LOGE, FL("len %d is too short"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700919 return eSIR_FAILURE;
920 }
921
922 len -= sizeof(tANI_U32); // skip message header
923 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530924 {
925 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700926 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530927 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700928 // Extract sessionId
929 pJoinReq->sessionId = *pBuf++;
930 len--;
931 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530932 {
933 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700934 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530935 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700936 // Extract transactionId
937 pJoinReq->transactionId = limGetU16(pBuf);
938 pBuf += sizeof(tANI_U16);
939 len -= sizeof(tANI_U16);
940 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530941 {
942 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700943 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530944 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700945
946 // Extract ssId
947 pJoinReq->ssId.length = *pBuf++;
948 len--;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530949 vos_mem_copy( (tANI_U8 *) pJoinReq->ssId.ssId, pBuf, pJoinReq->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -0700950 pBuf += pJoinReq->ssId.length;
951 len -= pJoinReq->ssId.length;
952 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530953 {
954 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700955 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530956 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700957
958 // Extract selfMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530959 vos_mem_copy( pJoinReq->selfMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700960 pBuf += sizeof(tSirMacAddr);
961 len -= sizeof(tSirMacAddr);
962 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530963 {
964 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700965 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530966 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700967
968 // Extract bsstype
969 pJoinReq->bsstype = (tSirBssType) limGetU32(pBuf);
970 pBuf += sizeof(tANI_U32);
971 len -= sizeof(tANI_U32);
972 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530973 {
974 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700975 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530976 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700977
978 // Extract dot11mode
979 pJoinReq->dot11mode= *pBuf++;
980 len--;
981 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530982 {
983 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700984 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530985 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700986
987 // Extract bssPersona
988 pJoinReq->staPersona = *pBuf++;
989 len--;
990 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530991 {
992 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700993 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530994 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700995
Sushant Kaushik74df8db2015-03-11 18:09:05 +0530996 pJoinReq->bOSENAssociation = *pBuf++;
997 len--;
998 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
999 {
1000 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1001 return eSIR_FAILURE;
1002 }
1003
Abhishek Singheef5c992016-01-27 13:41:54 +05301004 pJoinReq->bWPSAssociation = *pBuf++;
1005 len--;
1006 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1007 {
1008 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1009 return eSIR_FAILURE;
1010 }
1011
Jeff Johnsone7245742012-09-05 17:12:55 -07001012 // Extract cbMode
1013 pJoinReq->cbMode = *pBuf++;
1014 len--;
1015 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301016 {
1017 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnsone7245742012-09-05 17:12:55 -07001018 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301019 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001020
Jeff Johnson295189b2012-06-20 16:38:30 -07001021 // Extract uapsdPerAcBitmask
1022 pJoinReq->uapsdPerAcBitmask = *pBuf++;
1023 len--;
1024 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301025 {
1026 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001027 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301028 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001029
Jeff Johnson295189b2012-06-20 16:38:30 -07001030
1031 // Extract operationalRateSet
1032 pJoinReq->operationalRateSet.numRates= *pBuf++;
1033 len--;
1034 if (pJoinReq->operationalRateSet.numRates)
1035 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301036 vos_mem_copy( (tANI_U8 *) pJoinReq->operationalRateSet.rate, pBuf,
1037 pJoinReq->operationalRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07001038 pBuf += pJoinReq->operationalRateSet.numRates;
1039 len -= pJoinReq->operationalRateSet.numRates;
1040 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301041 {
1042 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001043 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301044 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001045 }
1046
1047 // Extract extendedRateSet
1048 pJoinReq->extendedRateSet.numRates = *pBuf++;
1049 len--;
1050 if (pJoinReq->extendedRateSet.numRates)
1051 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301052 vos_mem_copy( pJoinReq->extendedRateSet.rate, pBuf, pJoinReq->extendedRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07001053 pBuf += pJoinReq->extendedRateSet.numRates;
1054 len -= pJoinReq->extendedRateSet.numRates;
1055 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301056 {
1057 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001058 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301059 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001060 }
1061
Masti, Narayanraddi67ea5912015-01-08 12:34:05 +05301062 //Extract rateBitMap
1063 pJoinReq->rateBitMap = limGetU16(pBuf);
1064 pBuf += sizeof(tANI_U16);
1065 len -= sizeof(tANI_U16);
1066
Jeff Johnson295189b2012-06-20 16:38:30 -07001067 // Extract RSN IE
1068 pJoinReq->rsnIE.length = limGetU16(pBuf);
1069 pBuf += sizeof(tANI_U16);
1070 len -= sizeof(tANI_U16);
1071
1072 if (pJoinReq->rsnIE.length)
1073 {
1074 // Check for RSN IE length (that includes length of type & length)
1075 if ((pJoinReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2) ||
1076 (pJoinReq->rsnIE.length != 2 + *(pBuf + 1)))
1077 {
1078 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001079 FL("Invalid RSN IE length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001080 pJoinReq->rsnIE.length);
1081 return eSIR_FAILURE;
1082 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301083 vos_mem_copy( (tANI_U8 *) pJoinReq->rsnIE.rsnIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001084 pBuf, pJoinReq->rsnIE.length);
1085 pBuf += pJoinReq->rsnIE.length;
1086 len -= pJoinReq->rsnIE.length; // skip RSN IE
1087 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301088 {
1089 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001090 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301091 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001092 }
1093
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001094#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001095 // Extract CCKM IE
1096 pJoinReq->cckmIE.length = limGetU16(pBuf);
1097 pBuf += sizeof(tANI_U16);
1098 len -= sizeof(tANI_U16);
1099 if (pJoinReq->cckmIE.length)
1100 {
1101 // Check for CCKM IE length (that includes length of type & length)
1102 if ((pJoinReq->cckmIE.length > SIR_MAC_MAX_IE_LENGTH) ||
1103 (pJoinReq->cckmIE.length != (2 + *(pBuf + 1))))
1104 {
1105 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001106 FL("Invalid CCKM IE length %d/%d in SME_JOIN/REASSOC_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001107 pJoinReq->cckmIE.length, 2 + *(pBuf + 1));
1108 return eSIR_FAILURE;
1109 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301110 vos_mem_copy((tANI_U8 *) pJoinReq->cckmIE.cckmIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001111 pBuf, pJoinReq->cckmIE.length);
1112 pBuf += pJoinReq->cckmIE.length;
1113 len -= pJoinReq->cckmIE.length; // skip CCKM IE
1114 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301115 {
1116 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001117 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301118 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001119 }
1120#endif
1121
1122 // Extract Add IE for scan
1123 pJoinReq->addIEScan.length = limGetU16(pBuf);
1124 pBuf += sizeof(tANI_U16);
1125 len -= sizeof(tANI_U16);
1126
1127 if (pJoinReq->addIEScan.length)
1128 {
1129 // Check for IE length (that includes length of type & length)
Ganesh Kondabattini7500fb32015-04-10 14:50:32 +05301130 if (pJoinReq->addIEScan.length > SIR_MAC_MAX_ADD_IE_LENGTH + 2)
Jeff Johnson295189b2012-06-20 16:38:30 -07001131 {
1132 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001133 FL("Invalid addIE Scan length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001134 pJoinReq->addIEScan.length);
1135 return eSIR_FAILURE;
1136 }
1137 // Check for P2P IE length (that includes length of type & length)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301138 vos_mem_copy( (tANI_U8 *) pJoinReq->addIEScan.addIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001139 pBuf, pJoinReq->addIEScan.length);
1140 pBuf += pJoinReq->addIEScan.length;
1141 len -= pJoinReq->addIEScan.length; // skip add IE
1142 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301143 {
1144 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001145 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301146 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001147 }
1148
1149 pJoinReq->addIEAssoc.length = limGetU16(pBuf);
1150 pBuf += sizeof(tANI_U16);
1151 len -= sizeof(tANI_U16);
1152
1153 // Extract Add IE for assoc
1154 if (pJoinReq->addIEAssoc.length)
1155 {
1156 // Check for IE length (that includes length of type & length)
1157 if (pJoinReq->addIEAssoc.length > SIR_MAC_MAX_IE_LENGTH + 2)
1158 {
1159 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001160 FL("Invalid addIE Assoc length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001161 pJoinReq->addIEAssoc.length);
1162 return eSIR_FAILURE;
1163 }
1164 // Check for P2P IE length (that includes length of type & length)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301165 vos_mem_copy( (tANI_U8 *) pJoinReq->addIEAssoc.addIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001166 pBuf, pJoinReq->addIEAssoc.length);
1167 pBuf += pJoinReq->addIEAssoc.length;
1168 len -= pJoinReq->addIEAssoc.length; // skip add IE
1169 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301170 {
1171 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001172 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301173 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001174 }
1175
Venkata Prathyusha Kuntupallie8dc41d2013-04-15 14:31:36 -07001176 pJoinReq->UCEncryptionType = limGetU32(pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001177 pBuf += sizeof(tANI_U32);
1178 len -= sizeof(tANI_U32);
1179 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301180 {
1181 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1182 return eSIR_FAILURE;
1183 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001184
Venkata Prathyusha Kuntupallie8dc41d2013-04-15 14:31:36 -07001185 pJoinReq->MCEncryptionType = limGetU32(pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001186 pBuf += sizeof(tANI_U32);
1187 len -= sizeof(tANI_U32);
1188 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301189 {
1190 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1191 return eSIR_FAILURE;
1192 }
Chet Lanctot186b5732013-03-18 10:26:30 -07001193#ifdef WLAN_FEATURE_11W
1194 pJoinReq->MgmtEncryptionType = limGetU32(pBuf);
1195 pBuf += sizeof(tANI_U32);
1196 len -= sizeof(tANI_U32);
1197 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301198 {
1199 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Chet Lanctot186b5732013-03-18 10:26:30 -07001200 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301201 }
Chet Lanctot186b5732013-03-18 10:26:30 -07001202#endif
1203
Jeff Johnson295189b2012-06-20 16:38:30 -07001204#ifdef WLAN_FEATURE_VOWIFI_11R
1205 //is11Rconnection;
1206 pJoinReq->is11Rconnection = (tAniBool)limGetU32(pBuf);
1207 pBuf += sizeof(tAniBool);
1208 len -= sizeof(tAniBool);
1209 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301210 {
1211 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1212 return eSIR_FAILURE;
1213 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001214#endif
1215
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001216#ifdef FEATURE_WLAN_ESE
1217 //ESE version IE
1218 pJoinReq->isESEFeatureIniEnabled = (tAniBool)limGetU32(pBuf);
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05301219 pBuf += sizeof(tAniBool);
1220 len -= sizeof(tAniBool);
1221 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301222 {
1223 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05301224 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301225 }
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05301226
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001227 //isESEconnection;
1228 pJoinReq->isESEconnection = (tAniBool)limGetU32(pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001229 pBuf += sizeof(tAniBool);
1230 len -= sizeof(tAniBool);
1231 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301232 {
1233 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1234 return eSIR_FAILURE;
1235 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001236
1237 // TSPEC information
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001238 pJoinReq->eseTspecInfo.numTspecs = *pBuf++;
Jeff Johnson295189b2012-06-20 16:38:30 -07001239 len -= sizeof(tANI_U8);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001240 vos_mem_copy((void*)&pJoinReq->eseTspecInfo.tspec[0], pBuf,
1241 (sizeof(tTspecInfo)* pJoinReq->eseTspecInfo.numTspecs));
1242 pBuf += sizeof(tTspecInfo)*SIR_ESE_MAX_TSPEC_IES;
1243 len -= sizeof(tTspecInfo)*SIR_ESE_MAX_TSPEC_IES;
Jeff Johnson295189b2012-06-20 16:38:30 -07001244 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301245 {
1246 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001247 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301248 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001249#endif
1250
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001251#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07001252 //isFastTransitionEnabled;
1253 pJoinReq->isFastTransitionEnabled = (tAniBool)limGetU32(pBuf);
1254 pBuf += sizeof(tAniBool);
1255 len -= sizeof(tAniBool);
1256 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301257 {
1258 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1259 return eSIR_FAILURE;
1260 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001261#endif
1262
Jeff Johnson43971f52012-07-17 12:26:56 -07001263#ifdef FEATURE_WLAN_LFR
1264 //isFastRoamIniFeatureEnabled;
1265 pJoinReq->isFastRoamIniFeatureEnabled = (tAniBool)limGetU32(pBuf);
1266 pBuf += sizeof(tAniBool);
1267 len -= sizeof(tAniBool);
1268 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301269 {
1270 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1271 return eSIR_FAILURE;
1272 }
Jeff Johnson43971f52012-07-17 12:26:56 -07001273#endif
1274
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001275 //txLdpcIniFeatureEnabled
1276 pJoinReq->txLdpcIniFeatureEnabled= *pBuf++;
1277 len--;
1278 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301279 {
1280 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001281 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301282 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301283#ifdef WLAN_FEATURE_11AC
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001284 //txBFIniFeatureEnabled
1285 pJoinReq->txBFIniFeatureEnabled= *pBuf++;
1286 len--;
1287 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301288 {
1289 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001290 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301291 }
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001292
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001293 //txBFCsnValue
1294 pJoinReq->txBFCsnValue= *pBuf++;
1295 len--;
1296 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301297 {
1298 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001299 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301300 }
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001301
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301302 //MuBformee
1303 pJoinReq->txMuBformee= *pBuf++;
1304 len--;
1305 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1306 {
1307 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1308 return eSIR_FAILURE;
1309 }
1310#endif
1311
krunal soni5afa96c2013-09-06 22:19:02 -07001312 pJoinReq->isAmsduSupportInAMPDU= *pBuf++;
1313 len--;
1314 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301315 {
1316 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
krunal soni5afa96c2013-09-06 22:19:02 -07001317 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301318 }
krunal soni5afa96c2013-09-06 22:19:02 -07001319
Sandeep Puligillaaea98a22013-12-04 13:36:32 +05301320 pJoinReq->isWMEenabled = (tAniBool)limGetU32(pBuf);
1321 pBuf += sizeof(tAniBool);
1322 len -= sizeof(tAniBool);
1323 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1324 return eSIR_FAILURE;
1325
1326 pJoinReq->isQosEnabled = (tAniBool)limGetU32(pBuf);
1327 pBuf += sizeof(tAniBool);
1328 len -= sizeof(tAniBool);
1329 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1330 return eSIR_FAILURE;
1331
Jeff Johnson295189b2012-06-20 16:38:30 -07001332 // Extract Titan CB Neighbor BSS info
1333 pJoinReq->cbNeighbors.cbBssFoundPri = *pBuf;
1334 pBuf++;
1335 pJoinReq->cbNeighbors.cbBssFoundSecUp = *pBuf;
1336 pBuf++;
1337 pJoinReq->cbNeighbors.cbBssFoundSecDown = *pBuf;
1338 pBuf++;
1339 len -= 3;
1340
1341 // Extract Spectrum Mgt Indicator
1342 pJoinReq->spectrumMgtIndicator = (tAniBool) limGetU32(pBuf);
1343 pBuf += sizeof(tAniBool);
1344 len -= sizeof(tAniBool);
1345
1346 pJoinReq->powerCap.minTxPower = *pBuf++;
1347 pJoinReq->powerCap.maxTxPower = *pBuf++;
1348 len -=2;
Jeff Johnson295189b2012-06-20 16:38:30 -07001349
1350 pJoinReq->supportedChannels.numChnl = *pBuf++;
1351 len--;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301352 vos_mem_copy( (tANI_U8 *) pJoinReq->supportedChannels.channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001353 pBuf, pJoinReq->supportedChannels.numChnl);
1354 pBuf += pJoinReq->supportedChannels.numChnl;
1355 len-= pJoinReq->supportedChannels.numChnl;
1356
Abhishek Singh525045c2014-12-15 17:18:45 +05301357 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001358 FL("spectrumInd ON: minPower %d, maxPower %d , numChnls %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001359 pJoinReq->powerCap.minTxPower,
1360 pJoinReq->powerCap.maxTxPower,
Abhishek Singh525045c2014-12-15 17:18:45 +05301361 pJoinReq->supportedChannels.numChnl);
Jeff Johnson295189b2012-06-20 16:38:30 -07001362
1363 // Extract uapsdPerAcBitmask
1364 pJoinReq->uapsdPerAcBitmask = *pBuf++;
1365 len--;
1366 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301367 {
1368 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001369 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301370 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001371
Jeff Johnson295189b2012-06-20 16:38:30 -07001372 //
1373 // NOTE - tSirBssDescription is now moved to the end
1374 // of tSirSmeJoinReq structure. This is to accomodate
1375 // the variable length data member ieFields[1]
1376 //
1377 if (limGetBssDescription( pMac, &pJoinReq->bssDescription,
1378 len, &lenUsed, pBuf) == eSIR_FAILURE)
1379 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001380 PELOGE(limLog(pMac, LOGE, FL("get bss description failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001381 return eSIR_FAILURE;
1382 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05301383 PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3,
1384 (tANI_U8 *) &(pJoinReq->bssDescription),
1385 pJoinReq->bssDescription.length + 2);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001386 pBuf += lenUsed;
1387 len -= lenUsed;
Jeff Johnson295189b2012-06-20 16:38:30 -07001388
1389 return eSIR_SUCCESS;
1390} /*** end limJoinReqSerDes() ***/
1391
1392
1393/**---------------------------------------------------------------
1394\fn limAssocIndSerDes
1395\brief This function is called by limProcessMlmAssocInd() to
1396\ populate the SME_ASSOC_IND message based on the received
1397\ MLM_ASSOC_IND.
1398\
1399\param pMac
1400\param pAssocInd - Pointer to the received tLimMlmAssocInd
1401\param pBuf - Pointer to serialized buffer
1402\param psessionEntry - pointer to PE session entry
1403\
1404\return None
1405------------------------------------------------------------------*/
1406void
1407limAssocIndSerDes(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
1408{
1409 tANI_U8 *pLen = pBuf;
1410 tANI_U16 mLen = 0;
1411
1412#ifdef PE_DEBUG_LOG1
1413 tANI_U8 *pTemp = pBuf;
1414#endif
1415
Jeff Johnson295189b2012-06-20 16:38:30 -07001416
1417 mLen = sizeof(tANI_U32);
1418 mLen += sizeof(tANI_U8);
1419 pBuf += sizeof(tANI_U16);
1420 *pBuf = psessionEntry->smeSessionId;
1421 pBuf += sizeof(tANI_U8);
1422
1423 // Fill in peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301424 vos_mem_copy( pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001425 pBuf += sizeof(tSirMacAddr);
1426 mLen += sizeof(tSirMacAddr);
1427
1428 // Fill in aid
1429 limCopyU16(pBuf, pAssocInd->aid);
1430 pBuf += sizeof(tANI_U16);
1431 mLen += sizeof(tANI_U16);
1432
1433 // Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301434 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001435 pBuf += sizeof(tSirMacAddr);
1436 mLen += sizeof(tSirMacAddr);
1437
1438 // Fill in staId
1439 limCopyU16(pBuf, psessionEntry->staId);
1440 pBuf += sizeof(tANI_U16);
1441 mLen += sizeof(tANI_U16);
1442
1443 // Fill in authType
1444 limCopyU32(pBuf, pAssocInd->authType);
1445 pBuf += sizeof(tANI_U32);
1446 mLen += sizeof(tANI_U32);
1447
1448 // Fill in ssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301449 vos_mem_copy( pBuf, (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001450 pBuf += (1 + pAssocInd->ssId.length);
1451 mLen += (1 + pAssocInd->ssId.length);
1452
1453 // Fill in rsnIE
1454 limCopyU16(pBuf, pAssocInd->rsnIE.length);
1455 pBuf += sizeof(tANI_U16);
1456 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301457 vos_mem_copy( pBuf, (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001458 pAssocInd->rsnIE.length);
1459 pBuf += pAssocInd->rsnIE.length;
1460 mLen += pAssocInd->rsnIE.length;
1461
Jeff Johnson295189b2012-06-20 16:38:30 -07001462
Jeff Johnson295189b2012-06-20 16:38:30 -07001463 limCopyU32(pBuf, pAssocInd->spectrumMgtIndicator);
1464 pBuf += sizeof(tAniBool);
1465 mLen += sizeof(tAniBool);
1466
1467 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1468 {
1469 *pBuf = pAssocInd->powerCap.minTxPower;
1470 pBuf++;
1471 *pBuf = pAssocInd->powerCap.maxTxPower;
1472 pBuf++;
1473 mLen += sizeof(tSirMacPowerCapInfo);
1474
1475 *pBuf = pAssocInd->supportedChannels.numChnl;
1476 pBuf++;
1477 mLen++;
1478
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301479 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -07001480 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
1481 pAssocInd->supportedChannels.numChnl);
1482
1483
1484 pBuf += pAssocInd->supportedChannels.numChnl;
1485 mLen += pAssocInd->supportedChannels.numChnl;
1486 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001487 limCopyU32(pBuf, pAssocInd->WmmStaInfoPresent);
1488 pBuf += sizeof(tANI_U32);
1489 mLen += sizeof(tANI_U32);
Hardik Kantilal Patel1ba630f2014-11-21 04:32:05 +05301490
1491#ifdef WLAN_FEATURE_AP_HT40_24G
1492 limCopyU32(pBuf, pAssocInd->HT40MHzIntoPresent);
1493 pBuf += sizeof(tANI_U32);
1494 mLen += sizeof(tANI_U32);
1495#endif
1496
Jeff Johnson295189b2012-06-20 16:38:30 -07001497 // Fill in length of SME_ASSOC_IND message
1498 limCopyU16(pLen, mLen);
1499
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001500 PELOG1(limLog(pMac, LOG1, FL("Sending SME_ASSOC_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001501 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1502} /*** end limAssocIndSerDes() ***/
1503
1504
1505
1506/**
1507 * limAssocCnfSerDes()
1508 *
1509 *FUNCTION:
1510 * This function is called by limProcessLmmMessages() when
1511 * SME_ASSOC_CNF or SME_REASSOC_CNF message is received from
1512 * upper layer software.
1513 *
1514 *PARAMS:
1515 *
1516 *LOGIC:
1517 *
1518 *ASSUMPTIONS:
1519 * NA
1520 *
1521 *NOTE:
1522 * NA
1523 *
1524 * @param pAssocCnf Pointer to tSirSmeAssocCnf being extracted into
1525 * @param pBuf Pointer to serialized buffer
1526 * @return retCode Indicates whether message is successfully
1527 * de-serialized (eSIR_SUCCESS) or
1528 * not (eSIR_FAILURE)
1529 */
1530
1531tSirRetStatus
1532limAssocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeAssocCnf pAssocCnf, tANI_U8 *pBuf)
1533{
1534#ifdef PE_DEBUG_LOG1
1535 tANI_U8 *pTemp = pBuf;
1536#endif
1537
1538 if (!pAssocCnf || !pBuf)
1539 return eSIR_FAILURE;
1540
1541 pAssocCnf->messageType = limGetU16(pBuf);
1542 pBuf += sizeof(tANI_U16);
1543
1544 pAssocCnf->length = limGetU16(pBuf);
1545 pBuf += sizeof(tANI_U16);
1546
1547 if (pAssocCnf->messageType == eWNI_SME_ASSOC_CNF)
1548 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001549 PELOG1(limLog(pMac, LOG1, FL("SME_ASSOC_CNF length %d bytes is:"), pAssocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001550 }
1551 else
1552 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001553 PELOG1(limLog(pMac, LOG1, FL("SME_REASSOC_CNF length %d bytes is:"), pAssocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001554 }
1555 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pAssocCnf->length);)
1556
1557 // status code
1558 pAssocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
1559 pBuf += sizeof(tSirResultCodes);
1560
1561 // bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301562 vos_mem_copy( pAssocCnf->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001563 pBuf += sizeof(tSirMacAddr);
1564
1565 // peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301566 vos_mem_copy( pAssocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001567 pBuf += sizeof(tSirMacAddr);
1568
1569
1570 pAssocCnf->aid = limGetU16(pBuf);
1571 pBuf += sizeof(tANI_U16);
1572 // alternateBssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301573 vos_mem_copy( pAssocCnf->alternateBssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001574 pBuf += sizeof(tSirMacAddr);
1575
1576 // alternateChannelId
1577 pAssocCnf->alternateChannelId = *pBuf;
1578 pBuf++;
1579
1580 return eSIR_SUCCESS;
1581} /*** end limAssocCnfSerDes() ***/
1582
1583
1584
1585/**
1586 * limDisassocCnfSerDes()
1587 *
1588 *FUNCTION:
1589 * This function is called by limProcessSmeMessages() when
1590 * SME_DISASSOC_CNF message is received from upper layer software.
1591 *
1592 *PARAMS:
1593 *
1594 *LOGIC:
1595 *
1596 *ASSUMPTIONS:
1597 * NA
1598 *
1599 *NOTE:
1600 * NA
1601 *
1602 * @param pDisassocCnf Pointer to tSirSmeDisassocCnf being
1603 * extracted into
1604 * @param pBuf Pointer to serialized buffer
1605 * @return retCode Indicates whether message is successfully
1606 * de-serialized (eSIR_SUCCESS) or
1607 * not (eSIR_FAILURE)
1608 */
1609
1610tSirRetStatus
1611limDisassocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeDisassocCnf pDisassocCnf, tANI_U8 *pBuf)
1612{
1613#ifdef PE_DEBUG_LOG1
1614 tANI_U8 *pTemp = pBuf;
1615#endif
1616
1617 if (!pDisassocCnf || !pBuf)
1618 return eSIR_FAILURE;
1619
1620 pDisassocCnf->messageType = limGetU16(pBuf);
1621 pBuf += sizeof(tANI_U16);
1622
1623 pDisassocCnf->length = limGetU16(pBuf);
1624 pBuf += sizeof(tANI_U16);
1625
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001626 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_CNF length %d bytes is:"), pDisassocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001627 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pDisassocCnf->length);)
1628
1629 pDisassocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
1630 pBuf += sizeof(tSirResultCodes);
1631
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301632 vos_mem_copy( pDisassocCnf->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001633 pBuf += sizeof(tSirMacAddr);
Jeff Johnson62c27982013-02-27 17:53:55 -08001634
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301635 vos_mem_copy( pDisassocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Wu Gao742b7352015-10-16 19:10:40 +08001636 pBuf += sizeof(tSirMacAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001637
Wu Gao742b7352015-10-16 19:10:40 +08001638 pDisassocCnf->assocId = limGetU16(pBuf);
Jeff Johnson62c27982013-02-27 17:53:55 -08001639
Jeff Johnson295189b2012-06-20 16:38:30 -07001640 return eSIR_SUCCESS;
1641} /*** end limDisassocCnfSerDes() ***/
1642
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301643static inline int CheckRemainingLength(tANI_U16 mLen, tANI_U16 len)
1644{
1645 if (mLen > (len - sizeof(tANI_U16)))
1646 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001647
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301648 return eSIR_SUCCESS;
1649}
Jeff Johnson295189b2012-06-20 16:38:30 -07001650
1651/**---------------------------------------------------------------
1652\fn limReassocIndSerDes
1653\brief This function is called by limProcessMlmReassocInd() to
1654\ populate the SME_REASSOC_IND message based on the received
1655\ MLM_REASSOC_IND.
1656\
1657\param pMac
1658\param pReassocInd - Pointer to the received tLimMlmReassocInd
1659\param pBuf - Pointer to serialized buffer
1660\param psessionEntry - pointer to PE session entry
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301661\param len - size of tSirSmeReassocInd structure
Jeff Johnson295189b2012-06-20 16:38:30 -07001662\
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301663\return tSirRietStatus Indicates whether message is successfully
1664\ de-serialized (eSIR_SUCCESS) or
1665\ not (eSIR_FAILURE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001666------------------------------------------------------------------*/
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301667tSirRetStatus
1668limReassocIndSerDes(tpAniSirGlobal pMac, tpLimMlmReassocInd pReassocInd,
1669 tANI_U8 *pBuf, tpPESession psessionEntry, tANI_U16 len)
Jeff Johnson295189b2012-06-20 16:38:30 -07001670{
1671 tANI_U8 *pLen = pBuf;
1672 tANI_U16 mLen = 0;
1673
1674#ifdef PE_DEBUG_LOG1
1675 tANI_U8 *pTemp = pBuf;
1676#endif
1677
Jeff Johnson295189b2012-06-20 16:38:30 -07001678
1679 mLen = sizeof(tANI_U32);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301680 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1681 return eSIR_FAILURE;
1682
Jeff Johnson295189b2012-06-20 16:38:30 -07001683 pBuf += sizeof(tANI_U16);
1684 *pBuf++ = psessionEntry->smeSessionId;
1685 mLen += sizeof(tANI_U8);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301686 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1687 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001688
1689 // Fill in peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301690 vos_mem_copy( pBuf, pReassocInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001691 pBuf += sizeof(tSirMacAddr);
1692 mLen += sizeof(tSirMacAddr);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301693 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1694 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001695
1696 // Fill in oldMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301697 vos_mem_copy( pBuf, pReassocInd->currentApAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001698 pBuf += sizeof(tSirMacAddr);
1699 mLen += sizeof(tSirMacAddr);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301700 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1701 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001702
1703 // Fill in aid
1704 limCopyU16(pBuf, pReassocInd->aid);
1705 pBuf += sizeof(tANI_U16);
1706 mLen += sizeof(tANI_U16);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301707 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1708 return eSIR_FAILURE;
1709
Jeff Johnson295189b2012-06-20 16:38:30 -07001710 // Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301711 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001712 pBuf += sizeof(tSirMacAddr);
1713 mLen += sizeof(tSirMacAddr);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301714 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1715 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001716
1717 // Fill in staId
1718 limCopyU16(pBuf, psessionEntry->staId);
1719 pBuf += sizeof(tANI_U16);
1720 mLen += sizeof(tANI_U16);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301721 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1722 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001723
1724 // Fill in authType
1725 limCopyU32(pBuf, pReassocInd->authType);
1726 pBuf += sizeof(tAniAuthType);
1727 mLen += sizeof(tAniAuthType);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301728 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1729 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001730
1731 // Fill in ssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301732 vos_mem_copy( pBuf, (tANI_U8 *) &(pReassocInd->ssId),
Jeff Johnson295189b2012-06-20 16:38:30 -07001733 pReassocInd->ssId.length + 1);
1734 pBuf += 1 + pReassocInd->ssId.length;
1735 mLen += pReassocInd->ssId.length + 1;
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301736 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1737 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001738
1739 // Fill in rsnIE
1740 limCopyU16(pBuf, pReassocInd->rsnIE.length);
1741 pBuf += sizeof(tANI_U16);
1742 mLen += sizeof(tANI_U16);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301743 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1744 return eSIR_FAILURE;
1745
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301746 vos_mem_copy( pBuf, (tANI_U8 *) &(pReassocInd->rsnIE.rsnIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001747 pReassocInd->rsnIE.length);
1748 pBuf += pReassocInd->rsnIE.length;
1749 mLen += pReassocInd->rsnIE.length;
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301750 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1751 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001752
1753 // Fill in addIE
1754 limCopyU16(pBuf, pReassocInd->addIE.length);
1755 pBuf += sizeof(tANI_U16);
1756 mLen += sizeof(tANI_U16);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301757 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1758 return eSIR_FAILURE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301759 vos_mem_copy( pBuf, (tANI_U8*) &(pReassocInd->addIE.addIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001760 pReassocInd->addIE.length);
1761 pBuf += pReassocInd->addIE.length;
1762 mLen += pReassocInd->addIE.length;
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301763 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1764 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001765
Jeff Johnson295189b2012-06-20 16:38:30 -07001766 limCopyU32(pBuf, pReassocInd->spectrumMgtIndicator);
1767 pBuf += sizeof(tAniBool);
1768 mLen += sizeof(tAniBool);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301769 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1770 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001771
1772 if (pReassocInd->spectrumMgtIndicator == eSIR_TRUE)
1773 {
1774 *pBuf = pReassocInd->powerCap.minTxPower;
1775 pBuf++;
1776 *pBuf = pReassocInd->powerCap.maxTxPower;
1777 pBuf++;
1778 mLen += sizeof(tSirMacPowerCapInfo);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301779 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1780 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001781
1782 *pBuf = pReassocInd->supportedChannels.numChnl;
1783 pBuf++;
1784 mLen++;
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301785 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1786 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001787
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301788 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -07001789 (tANI_U8 *) &(pReassocInd->supportedChannels.channelList),
1790 pReassocInd->supportedChannels.numChnl);
1791
1792 pBuf += pReassocInd->supportedChannels.numChnl;
1793 mLen += pReassocInd->supportedChannels.numChnl;
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301794 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1795 return eSIR_FAILURE;
1796
Jeff Johnson295189b2012-06-20 16:38:30 -07001797 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001798 limCopyU32(pBuf, pReassocInd->WmmStaInfoPresent);
1799 pBuf += sizeof(tANI_U32);
1800 mLen += sizeof(tANI_U32);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301801 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1802 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001803
1804 // Fill in length of SME_REASSOC_IND message
1805 limCopyU16(pLen, mLen);
1806
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001807 PELOG1(limLog(pMac, LOG1, FL("Sending SME_REASSOC_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001808 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301809
1810 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001811} /*** end limReassocIndSerDes() ***/
1812
1813
1814/**
1815 * limAuthIndSerDes()
1816 *
1817 *FUNCTION:
1818 * This function is called by limProcessMlmAuthInd() while sending
1819 * SME_AUTH_IND to host
1820 *
1821 *PARAMS:
1822 *
1823 *LOGIC:
1824 *
1825 *ASSUMPTIONS:
1826 * NA
1827 *
1828 *NOTE:
1829 * NA
1830 *
1831 * @param pAuthInd Pointer to tSirSmeAuthInd being sent
1832 * @param pBuf Pointer to serialized buffer
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301833 * @param len size of tSirSmeAuthInd structure
Jeff Johnson295189b2012-06-20 16:38:30 -07001834 *
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301835 * @return tSirRetStatus Indicates whether message is successfully
1836 * de-serialized (eSIR_SUCCESS) or
1837 * not (eSIR_FAILURE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001838 */
1839
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301840tSirRetStatus
1841limAuthIndSerDes(tpAniSirGlobal pMac, tpLimMlmAuthInd pAuthInd, tANI_U8 *pBuf, tANI_U16 len)
Jeff Johnson295189b2012-06-20 16:38:30 -07001842{
1843 tANI_U8 *pLen = pBuf;
1844 tANI_U16 mLen = 0;
1845
1846#ifdef PE_DEBUG_LOG1
1847 tANI_U8 *pTemp = pBuf;
1848#endif
1849
1850 mLen = sizeof(tANI_U32);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301851 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1852 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001853 pBuf += sizeof(tANI_U16);
1854 *pBuf++ = pAuthInd->sessionId;
1855 mLen += sizeof(tANI_U8);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301856 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1857 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001858
1859 // BTAMP TODO: Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301860 vos_mem_set(pBuf, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001861 pBuf += sizeof(tSirMacAddr);
1862 mLen += sizeof(tSirMacAddr);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301863 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1864 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001865
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301866 vos_mem_copy( pBuf, pAuthInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001867 pBuf += sizeof(tSirMacAddr);
1868 mLen += sizeof(tSirMacAddr);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301869 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1870 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001871
1872 limCopyU32(pBuf, pAuthInd->authType);
1873 pBuf += sizeof(tAniAuthType);
1874 mLen += sizeof(tAniAuthType);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301875 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1876 return eSIR_FAILURE;
1877
Jeff Johnson295189b2012-06-20 16:38:30 -07001878 limCopyU16(pLen, mLen);
1879
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001880 PELOG1(limLog(pMac, LOG1, FL("Sending SME_AUTH_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001881 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301882
1883 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001884} /*** end limAuthIndSerDes() ***/
1885
1886
1887
1888/**
1889 * limSetContextReqSerDes()
1890 *
1891 *FUNCTION:
1892 * This function is called by limProcessSmeMessages() upon receiving
1893 * SME_SETCONTEXT_REQ from host
1894 *
1895 *PARAMS:
1896 *
1897 *LOGIC:
1898 *
1899 *ASSUMPTIONS:
1900 * NA
1901 *
1902 *NOTE:
1903 * NA
1904 *
1905 * @param pSetContextReq Pointer to tSirSmeSetContextReq being
1906 * extracted
1907 * @param pBuf Pointer to serialized buffer
1908 *
1909 * @return retCode Indicates whether message is successfully
1910 * de-serialized (eSIR_SUCCESS) or
1911 * not (eSIR_FAILURE)
1912 */
1913
1914tSirRetStatus
1915limSetContextReqSerDes(tpAniSirGlobal pMac, tpSirSmeSetContextReq pSetContextReq, tANI_U8 *pBuf)
1916{
1917 tANI_S16 len = 0;
1918 tANI_U16 totalKeySize = sizeof(tANI_U8); // initialized to sizeof numKeys
1919 tANI_U8 numKeys;
1920 tANI_U8 *pKeys;
1921
1922#ifdef PE_DEBUG_LOG1
1923 tANI_U8 *pTemp = pBuf;
1924#endif
1925 if (!pSetContextReq || !pBuf)
1926 return eSIR_FAILURE;
1927
1928 pSetContextReq->messageType = limGetU16(pBuf);
1929 pBuf += sizeof(tANI_U16);
1930
1931 len = pSetContextReq->length = limGetU16(pBuf);
1932 pBuf += sizeof(tANI_U16);
1933
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001934 PELOG1(limLog(pMac, LOG1, FL("SME_SETCONTEXT_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001935 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, 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
1944 // Extract sessionId
1945 pSetContextReq->sessionId = *pBuf++;
1946 len--;
1947 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1948 return eSIR_FAILURE;
1949
1950 // Extract transactionId
1951 pSetContextReq->transactionId = sirReadU16N(pBuf);
1952 pBuf += sizeof(tANI_U16);
1953 len -= sizeof(tANI_U16);
1954 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1955 return eSIR_FAILURE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301956 vos_mem_copy( (tANI_U8 *) pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001957 pBuf, sizeof(tSirMacAddr));
1958 pBuf += sizeof(tSirMacAddr);
1959 len -= sizeof(tSirMacAddr);
1960 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1961 return eSIR_FAILURE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301962 vos_mem_copy( pSetContextReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001963 pBuf += sizeof(tSirMacAddr);
1964 len -= sizeof(tSirMacAddr);
1965 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1966 return eSIR_FAILURE;
1967
Jeff Johnson295189b2012-06-20 16:38:30 -07001968
1969// pSetContextReq->qosInfoPresent = limGetU32(pBuf);
1970// pBuf += sizeof(tAniBool);
1971
1972// if (pSetContextReq->qosInfoPresent)
1973// {
1974// len = limGetQosInfo(&pSetContextReq->qos, pBuf);
1975// pBuf += len;
1976// }
1977
1978 pSetContextReq->keyMaterial.length = limGetU16(pBuf);
1979 pBuf += sizeof(tANI_U16);
1980 len -= sizeof(tANI_U16);
1981 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1982 return eSIR_FAILURE;
1983
1984 pSetContextReq->keyMaterial.edType = (tAniEdType) limGetU32(pBuf);
1985 pBuf += sizeof(tAniEdType);
1986 len -= sizeof(tAniEdType);
1987 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1988 return eSIR_FAILURE;
1989
1990 numKeys = pSetContextReq->keyMaterial.numKeys = *pBuf++;
1991 len -= sizeof(numKeys);
1992
1993 if (numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
1994 return eSIR_FAILURE;
1995
1996 /** Initialize the Default Keys if no Keys are being sent from the upper layer*/
1997 if( limCheckRemainingLength(pMac, len) == eSIR_FAILURE) {
1998 tpSirKeys pKeyinfo = pSetContextReq->keyMaterial.key;
1999
2000 pKeyinfo->keyId = 0;
2001 pKeyinfo->keyDirection = eSIR_TX_RX;
2002 pKeyinfo->keyLength = 0;
2003
2004 if (!limIsAddrBC(pSetContextReq->peerMacAddr))
2005 pKeyinfo->unicast = 1;
2006 else
2007 pKeyinfo->unicast = 0;
2008 }else {
2009 pKeys = (tANI_U8 *) pSetContextReq->keyMaterial.key;
2010 do {
2011 tANI_U32 keySize = limGetKeysInfo(pMac, (tpSirKeys) pKeys,
2012 pBuf);
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302013 vos_mem_zero(pBuf, keySize);
Jeff Johnson295189b2012-06-20 16:38:30 -07002014 pBuf += keySize;
2015 pKeys += sizeof(tSirKeys);
2016 totalKeySize += (tANI_U16) keySize;
2017 if (numKeys == 0)
2018 break;
2019 numKeys--;
2020 }while (numKeys);
2021 }
2022 return eSIR_SUCCESS;
2023} /*** end limSetContextReqSerDes() ***/
2024
2025/**
2026 * limRemoveKeyReqSerDes()
2027 *
2028 *FUNCTION:
2029 * This function is called by limProcessSmeMessages() upon receiving
2030 * SME_REMOVEKEY_REQ from host
2031 *
2032 *PARAMS:
2033 *
2034 *LOGIC:
2035 *
2036 *ASSUMPTIONS:
2037 * NA
2038 *
2039 *NOTE:
2040 * NA
2041 *
2042 * @param pRemoveKeyReq Pointer to tSirSmeRemoveKeyReq being
2043 * extracted
2044 * @param pBuf Pointer to serialized buffer
2045 *
2046 * @return retCode Indicates whether message is successfully
2047 * de-serialized (eSIR_SUCCESS) or
2048 * not (eSIR_FAILURE)
2049 */
2050
2051tSirRetStatus
2052limRemoveKeyReqSerDes(tpAniSirGlobal pMac, tpSirSmeRemoveKeyReq pRemoveKeyReq, tANI_U8 *pBuf)
2053{
2054 tANI_S16 len = 0;
2055
2056#ifdef PE_DEBUG_LOG1
2057 tANI_U8 *pTemp = pBuf;
2058#endif
2059 if (!pRemoveKeyReq || !pBuf)
2060 return eSIR_FAILURE;
2061
2062 pRemoveKeyReq->messageType = limGetU16(pBuf);
2063 pBuf += sizeof(tANI_U16);
2064
2065 len = pRemoveKeyReq->length = limGetU16(pBuf);
2066 pBuf += sizeof(tANI_U16);
2067
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002068 PELOG1(limLog(pMac, LOG1, FL("SME_REMOVEKEY_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002069 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2070
2071 if (len < (tANI_S16) sizeof(tANI_U32))
2072 return eSIR_FAILURE;
2073
2074 len -= sizeof(tANI_U32); // skip message header
2075 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2076 return eSIR_FAILURE;
2077
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302078 vos_mem_copy( (tANI_U8 *) pRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002079 pBuf, sizeof(tSirMacAddr));
2080 pBuf += sizeof(tSirMacAddr);
2081 len -= sizeof(tSirMacAddr);
2082 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2083 return eSIR_FAILURE;
2084
Jeff Johnson295189b2012-06-20 16:38:30 -07002085
2086 pRemoveKeyReq->edType = *pBuf;
2087 pBuf += sizeof(tANI_U8);
2088 len -= sizeof(tANI_U8);
2089 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2090 return eSIR_FAILURE;
2091
2092 pRemoveKeyReq->wepType = *pBuf;
2093
2094 pBuf += sizeof(tANI_U8);
2095 len -= sizeof(tANI_U8);
2096 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2097 return eSIR_FAILURE;
2098
2099 pRemoveKeyReq->keyId = *pBuf;
2100
2101 pBuf += sizeof(tANI_U8);
2102 len -= sizeof(tANI_U8);
2103 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2104 return eSIR_FAILURE;
2105
2106 pRemoveKeyReq->unicast = *pBuf;
2107 len--;
2108 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2109 return eSIR_FAILURE;
2110
2111 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302112 vos_mem_copy( pRemoveKeyReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002113 pBuf += sizeof(tSirMacAddr);
2114 len -= sizeof(tSirMacAddr);
2115 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2116 return eSIR_FAILURE;
2117
2118 // Extract sessionId
2119 pRemoveKeyReq->sessionId = *pBuf++;
2120 len--;
2121 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2122 return eSIR_FAILURE;
2123
2124 // Extract transactionId
2125 pRemoveKeyReq->transactionId = sirReadU16N(pBuf);
2126 pBuf += sizeof(tANI_U16);
2127 len -= sizeof(tANI_U16);
2128 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2129 return eSIR_FAILURE;
2130
2131 return eSIR_SUCCESS;
2132} /*** end limRemoveKeyReqSerDes() ***/
2133
2134
2135
2136/**
2137 * limDisassocReqSerDes()
2138 *
2139 *FUNCTION:
2140 * This function is called by limProcessSmeMessages() upon receiving
2141 * SME_DISASSOC_REQ from host
2142 *
2143 *PARAMS:
2144 *
2145 *LOGIC:
2146 *
2147 *ASSUMPTIONS:
2148 * NA
2149 *
2150 *NOTE:
2151 * NA
2152 *
2153 * @param pDisassocReq Pointer to tSirSmeDisassocReq being extracted
2154 * @param pBuf Pointer to serialized buffer
2155 *
2156 * @return retCode Indicates whether message is successfully
2157 * de-serialized (eSIR_SUCCESS) or
2158 * not (eSIR_FAILURE)
2159 */
2160
2161tSirRetStatus
2162limDisassocReqSerDes(tpAniSirGlobal pMac, tSirSmeDisassocReq *pDisassocReq, tANI_U8 *pBuf)
2163{
2164 tANI_S16 len = 0;
2165#ifdef PE_DEBUG_LOG1
2166 tANI_U8 *pTemp = pBuf;
2167#endif
2168
2169 if (!pDisassocReq || !pBuf)
2170 return eSIR_FAILURE;
2171
2172 pDisassocReq->messageType = limGetU16(pBuf);
2173 pBuf += sizeof(tANI_U16);
2174
2175 len = pDisassocReq->length = limGetU16(pBuf);
2176 pBuf += sizeof(tANI_U16);
2177
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002178 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002179 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2180
2181 if (len < (tANI_S16) sizeof(tANI_U32))
2182 return eSIR_FAILURE;
2183
2184 len -= sizeof(tANI_U32); // skip message header
2185 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2186 return eSIR_FAILURE;
2187
2188 // Extract sessionID
2189 pDisassocReq->sessionId = *pBuf;
2190 pBuf += sizeof(tANI_U8);
2191 len -= sizeof(tANI_U8);
2192 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2193 return eSIR_FAILURE;
2194
2195 // Extract transactionid
2196 pDisassocReq->transactionId = limGetU16(pBuf);
2197 pBuf += sizeof(tANI_U16);
2198 len -= sizeof(tANI_U16);
2199 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2200 return eSIR_FAILURE;
2201
2202 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302203 vos_mem_copy( (tANI_U8 *) pDisassocReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002204 pBuf += sizeof(tSirMacAddr);
2205 len -= sizeof(tSirMacAddr);
2206 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2207 return eSIR_FAILURE;
2208
2209 // Extract peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302210 vos_mem_copy( pDisassocReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002211 pBuf += sizeof(tSirMacAddr);
2212 len -= sizeof(tSirMacAddr);
2213 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2214 return eSIR_FAILURE;
2215
2216 // Extract reasonCode
2217 pDisassocReq->reasonCode = limGetU16(pBuf);
2218 pBuf += sizeof(tANI_U16);
2219 len -= sizeof(tANI_U16);
2220 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2221 return eSIR_FAILURE;
2222
2223 pDisassocReq->doNotSendOverTheAir = *pBuf;
2224 pBuf += sizeof(tANI_U8);
2225 len -= sizeof(tANI_U8);
2226
Jeff Johnson295189b2012-06-20 16:38:30 -07002227
2228 return eSIR_SUCCESS;
2229} /*** end limDisassocReqSerDes() ***/
2230
2231
2232
2233/**
2234 * limDeauthReqSerDes()
2235 *
2236 *FUNCTION:
2237 * This function is called by limProcessSmeMessages() upon receiving
2238 * SME_DEAUTH_REQ from host
2239 *
2240 *PARAMS:
2241 *
2242 *LOGIC:
2243 *
2244 *ASSUMPTIONS:
2245 * NA
2246 *
2247 *NOTE:
2248 * NA
2249 *
2250 * @param pDeauthReq Pointer to tSirSmeDeauthReq being extracted
2251 * @param pBuf Pointer to serialized buffer
2252 *
2253 * @return retCode Indicates whether message is successfully
2254 * de-serialized (eSIR_SUCCESS) or
2255 * not (eSIR_FAILURE)
2256 */
2257tSirRetStatus
2258limDeauthReqSerDes(tpAniSirGlobal pMac, tSirSmeDeauthReq *pDeauthReq, tANI_U8 *pBuf)
2259{
2260 tANI_S16 len = 0;
2261
2262#ifdef PE_DEBUG_LOG1
2263 tANI_U8 *pTemp = pBuf;
2264#endif
2265
2266 if (!pDeauthReq || !pBuf)
2267 return eSIR_FAILURE;
2268
2269 pDeauthReq->messageType = limGetU16(pBuf);
2270 pBuf += sizeof(tANI_U16);
2271
2272 len = pDeauthReq->length = limGetU16(pBuf);
2273 pBuf += sizeof(tANI_U16);
2274
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002275 PELOG1(limLog(pMac, LOG1, FL("SME_DEAUTH_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002276 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2277
2278 if (len < (tANI_S16) sizeof(tANI_U32))
2279 return eSIR_FAILURE;
2280
2281 len -= sizeof(tANI_U32); // skip message header
2282 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2283 return eSIR_FAILURE;
2284
2285 // Extract sessionId
2286 pDeauthReq->sessionId = *pBuf++;
2287 len--;
2288 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2289 return eSIR_FAILURE;
2290
2291 // Extract transactionId
2292 pDeauthReq->transactionId = limGetU16(pBuf);
2293 pBuf += sizeof(tANI_U16);
2294 len -= sizeof(tANI_U16);
2295 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2296 return eSIR_FAILURE;
2297
2298 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302299 vos_mem_copy( pDeauthReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 pBuf += sizeof(tSirMacAddr);
2301 len -= sizeof(tSirMacAddr);
2302 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2303 return eSIR_FAILURE;
2304
2305 // Extract peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302306 vos_mem_copy( pDeauthReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002307 pBuf += sizeof(tSirMacAddr);
2308 len -= sizeof(tSirMacAddr);
2309 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2310 return eSIR_FAILURE;
2311
2312 // Extract reasonCode
2313 pDeauthReq->reasonCode = limGetU16(pBuf);
2314 pBuf += sizeof(tANI_U16);
2315 len -= sizeof(tANI_U16);
2316
Jeff Johnson295189b2012-06-20 16:38:30 -07002317
2318 return eSIR_SUCCESS;
2319} /*** end limDisassocReqSerDes() ***/
2320
2321
2322
2323
Jeff Johnson295189b2012-06-20 16:38:30 -07002324
2325
2326/**
2327 * limStatSerDes()
2328 *
2329 *FUNCTION:
2330 * This function is called by limSendSmeDisassocNtf() while sending
2331 * SME_DISASSOC_IND/eWNI_SME_DISASSOC_RSP to host
2332 *
2333 *PARAMS:
2334 *
2335 *LOGIC:
2336 *
2337 *ASSUMPTIONS:
2338 * NA
2339 *
2340 *NOTE:
2341 * NA
2342 *
2343 * @param pAssocInd Pointer to tpAniStaStatStruct being sent
2344 * @param pBuf Pointer to serialized buffer
2345 *
2346 * @return None
2347 */
2348
2349void
2350limStatSerDes(tpAniSirGlobal pMac, tpAniStaStatStruct pStat, tANI_U8 *pBuf)
2351{
2352#ifdef PE_DEBUG_LOG1
2353 tANI_U8 *pTemp = pBuf;
2354#endif
2355
2356 limCopyU32(pBuf, pStat->sentAesBlksUcastHi);
2357 pBuf += sizeof(tANI_U32);
2358
2359 limCopyU32(pBuf, pStat->sentAesBlksUcastLo);
2360 pBuf += sizeof(tANI_U32);
2361
2362 limCopyU32(pBuf, pStat->recvAesBlksUcastHi);
2363 pBuf += sizeof(tANI_U32);
2364
2365 limCopyU32(pBuf, pStat->recvAesBlksUcastLo);
2366 pBuf += sizeof(tANI_U32);
2367
2368 limCopyU32(pBuf, pStat->aesFormatErrorUcastCnts);
2369 pBuf += sizeof(tANI_U32);
2370
2371 limCopyU32(pBuf, pStat->aesReplaysUcast);
2372 pBuf += sizeof(tANI_U32);
2373
2374 limCopyU32(pBuf, pStat->aesDecryptErrUcast);
2375 pBuf += sizeof(tANI_U32);
2376
2377 limCopyU32(pBuf, pStat->singleRetryPkts);
2378 pBuf += sizeof(tANI_U32);
2379
2380 limCopyU32(pBuf, pStat->failedTxPkts);
2381 pBuf += sizeof(tANI_U32);
2382
2383 limCopyU32(pBuf, pStat->ackTimeouts);
2384 pBuf += sizeof(tANI_U32);
2385
2386 limCopyU32(pBuf, pStat->multiRetryPkts);
2387 pBuf += sizeof(tANI_U32);
2388
2389 limCopyU32(pBuf, pStat->fragTxCntsHi);
2390 pBuf += sizeof(tANI_U32);
2391
2392 limCopyU32(pBuf, pStat->fragTxCntsLo);
2393 pBuf += sizeof(tANI_U32);
2394
2395 limCopyU32(pBuf, pStat->transmittedPktsHi);
2396 pBuf += sizeof(tANI_U32);
2397
2398 limCopyU32(pBuf, pStat->transmittedPktsLo);
2399 pBuf += sizeof(tANI_U32);
2400
2401 limCopyU32(pBuf, pStat->phyStatHi);
2402 pBuf += sizeof(tANI_U32);
2403
2404 limCopyU32(pBuf, pStat->phyStatLo);
2405 pBuf += sizeof(tANI_U32);
2406
2407 limCopyU32(pBuf, pStat->uplinkRssi);
2408 pBuf += sizeof(tANI_U32);
2409
2410 limCopyU32(pBuf, pStat->uplinkSinr);
2411 pBuf += sizeof(tANI_U32);
2412
2413 limCopyU32(pBuf, pStat->uplinkRate);
2414 pBuf += sizeof(tANI_U32);
2415
2416 limCopyU32(pBuf, pStat->downlinkRssi);
2417 pBuf += sizeof(tANI_U32);
2418
2419 limCopyU32(pBuf, pStat->downlinkSinr);
2420 pBuf += sizeof(tANI_U32);
2421
2422 limCopyU32(pBuf, pStat->downlinkRate);
2423 pBuf += sizeof(tANI_U32);
2424
2425 limCopyU32(pBuf, pStat->nRcvBytes);
2426 pBuf += sizeof(tANI_U32);
2427
2428 limCopyU32(pBuf, pStat->nXmitBytes);
2429 pBuf += sizeof(tANI_U32);
2430
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002431 PELOG1(limLog(pMac, LOG1, FL("STAT: length %d bytes is:"), sizeof(tAniStaStatStruct));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002432 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, sizeof(tAniStaStatStruct));)
2433
2434} /*** end limStatSerDes() ***/
2435
2436
Jeff Johnson295189b2012-06-20 16:38:30 -07002437
2438
2439/**
2440 * limPackBkgndScanFailNotify()
2441 *
2442 *FUNCTION:
2443 * This function is called by limSendSmeWmStatusChangeNtf()
2444 * to pack the tSirBackgroundScanInfo message
2445 *
2446 */
2447void
2448limPackBkgndScanFailNotify(tpAniSirGlobal pMac,
2449 tSirSmeStatusChangeCode statusChangeCode,
2450 tpSirBackgroundScanInfo pScanInfo,
2451 tSirSmeWmStatusChangeNtf *pSmeNtf,
2452 tANI_U8 sessionId)
2453{
2454
2455 tANI_U16 length = (sizeof(tANI_U16) * 2) + sizeof(tANI_U8) +
2456 sizeof(tSirSmeStatusChangeCode) +
2457 sizeof(tSirBackgroundScanInfo);
2458
Jeff Johnson295189b2012-06-20 16:38:30 -07002459 pSmeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
2460 pSmeNtf->statusChangeCode = statusChangeCode;
2461 pSmeNtf->length = length;
2462 pSmeNtf->sessionId = sessionId;
2463 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanSuccess = pScanInfo->numOfScanSuccess;
2464 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanFailure = pScanInfo->numOfScanFailure;
2465 pSmeNtf->statusChangeInfo.bkgndScanInfo.reserved = pScanInfo->reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07002466}
2467
Jeff Johnson295189b2012-06-20 16:38:30 -07002468
Jeff Johnson295189b2012-06-20 16:38:30 -07002469/**
2470 * limIsSmeGetAssocSTAsReqValid()
2471 *
2472 *FUNCTION:
2473 * This function is called by limProcessSmeReqMessages() upon
2474 * receiving SME_GET_ASSOC_STAS_REQ message from application.
2475 *
2476 *LOGIC:
2477 * Message validity checks are performed in this function
2478 *
2479 *ASSUMPTIONS:
2480 *
2481 *NOTE:
2482 *
2483 * @param pBuf - Pointer to a serialized SME_GET_ASSOC_STAS_REQ message
2484 * @param pSmeMsg - Pointer to a tSirSmeGetAssocSTAsReq structure
2485 * @return true if SME_GET_ASSOC_STAS_REQ message is formatted correctly
2486 * false otherwise
2487 */
2488tANI_BOOLEAN
2489limIsSmeGetAssocSTAsReqValid(tpAniSirGlobal pMac, tpSirSmeGetAssocSTAsReq pGetAssocSTAsReq, tANI_U8 *pBuf)
2490{
2491 tANI_S16 len = 0;
2492
2493 pGetAssocSTAsReq->messageType = limGetU16(pBuf);
2494 pBuf += sizeof(tANI_U16);
2495
2496 len = pGetAssocSTAsReq->length = limGetU16(pBuf);
2497 pBuf += sizeof(tANI_U16);
2498
2499 if (len < (tANI_S16) sizeof(tANI_U32))
Girish Gowliafd42312014-07-24 13:13:59 +05302500 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002501
2502 len -= sizeof(tANI_U32); // skip message header
2503 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Girish Gowliafd42312014-07-24 13:13:59 +05302504 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002505
2506 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302507 vos_mem_copy( (tANI_U8 *) pGetAssocSTAsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002508 pBuf += sizeof(tSirMacAddr);
2509 len -= sizeof(tSirMacAddr);
2510 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Girish Gowliafd42312014-07-24 13:13:59 +05302511 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002512
2513 // Extract modId
2514 pGetAssocSTAsReq->modId = limGetU16(pBuf);
2515 pBuf += sizeof(tANI_U16);
2516 len -= sizeof(tANI_U16);
2517 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Girish Gowliafd42312014-07-24 13:13:59 +05302518 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002519
2520 // Extract pUsrContext
krunal soni4f802b22014-02-11 17:01:13 -08002521 vos_mem_copy((tANI_U8 *)pGetAssocSTAsReq->pUsrContext, pBuf, sizeof(void*));
2522 pBuf += sizeof(void*);
2523 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002524 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Girish Gowliafd42312014-07-24 13:13:59 +05302525 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002526
2527 // Extract pSapEventCallback
krunal soni4f802b22014-02-11 17:01:13 -08002528 vos_mem_copy((tANI_U8 *)pGetAssocSTAsReq->pSapEventCallback, pBuf, sizeof(void*));
2529 pBuf += sizeof(void*);
2530 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002531 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Girish Gowliafd42312014-07-24 13:13:59 +05302532 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002533
2534 // Extract pAssocStasArray
krunal soni4f802b22014-02-11 17:01:13 -08002535 vos_mem_copy((tANI_U8 *)pGetAssocSTAsReq->pAssocStasArray, pBuf, sizeof(void*));
2536 pBuf += sizeof(void*);
2537 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002538
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002539 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002540
2541 if (len < 0)
2542 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002543 PELOGE(limLog(pMac, LOGE, FL("SME_GET_ASSOC_STAS_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002544 return eANI_BOOLEAN_FALSE;
2545 }
2546
2547 return eANI_BOOLEAN_TRUE;
2548}
2549
2550/**
2551 * limTkipCntrMeasReqSerDes()
2552 *
2553 *FUNCTION:
2554 * This function is called by limProcessSmeMessages() upon receiving
2555 * eWNI_SME_TKIP_CNTR_MEAS_REQ from host HDD
2556 *
2557 *PARAMS:
2558 *
2559 *LOGIC:
2560 *
2561 *ASSUMPTIONS:
2562 * NA
2563 *
2564 *NOTE:
2565 * NA
2566 *
2567 * @param tpSirSmeTkipCntrMeasReq Pointer to tSirSmeTkipCntrMeasReq being extracted
2568 * @param pBuf Pointer to serialized buffer
2569 * @return retCode Indicates whether message is successfully
2570 * de-serialized (eSIR_SUCCESS) or
2571 * not (eSIR_FAILURE)
2572 */
2573tSirRetStatus
2574limTkipCntrMeasReqSerDes(tpAniSirGlobal pMac, tpSirSmeTkipCntrMeasReq pTkipCntrMeasReq, tANI_U8 *pBuf)
2575{
2576 tANI_S16 len = 0;
2577
2578#ifdef PE_DEBUG_LOG1
2579 tANI_U8 *pTemp = pBuf;
2580#endif
2581
2582 pTkipCntrMeasReq->messageType = limGetU16(pBuf);
2583 pBuf += sizeof(tANI_U16);
2584
2585 len = pTkipCntrMeasReq->length = limGetU16(pBuf);
2586 pBuf += sizeof(tANI_U16);
2587
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002588 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002589 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2590
2591 if (len < (tANI_S16) sizeof(tANI_U32))
2592 return eSIR_FAILURE;
2593
2594 len -= sizeof(tANI_U32); // skip message header
2595 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2596 return eSIR_FAILURE;
2597
2598 // Extract sessionId
2599 pTkipCntrMeasReq->sessionId = *pBuf++;
2600 len--;
2601 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2602 return eSIR_FAILURE;
2603
2604 // Extract transactionId
2605 pTkipCntrMeasReq->transactionId = limGetU16(pBuf);
2606 pBuf += sizeof(tANI_U16);
2607 len -= sizeof(tANI_U16);
2608 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2609 return eSIR_FAILURE;
2610
2611 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302612 vos_mem_copy( (tANI_U8 *) pTkipCntrMeasReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002613 pBuf += sizeof(tSirMacAddr);
2614 len -= sizeof(tSirMacAddr);
2615 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2616 return eSIR_FAILURE;
2617
2618 // Extract bEnable
2619 pTkipCntrMeasReq->bEnable = *pBuf++;
2620 len --;
2621
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002622 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002623
2624 if (len)
2625 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002626 PELOGE(limLog(pMac, LOGE, FL("SME_TKIP_CNTR_MEAS_REQ invalid "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002627 return eSIR_FAILURE;
2628 }
2629 else
2630 return eSIR_SUCCESS;
2631}
2632
2633/**
2634 * limIsSmeGetWPSPBCSessionsReqValid()
2635 *
2636 *FUNCTION:
2637 * This function is called by limProcessSmeGetWPSPBCSessions() upon
2638 * receiving query WPS PBC overlap information message from application.
2639 *
2640 *LOGIC:
2641 * Message validity checks are performed in this function
2642 *
2643 *ASSUMPTIONS:
2644 *
2645 *NOTE:
2646 *
2647 * @param pBuf - Pointer to a serialized SME_GET_WPSPBC_SESSION_REQ message
2648 * @param pGetWPSPBCSessionsReq - Pointer to a tSirSmeGetWPSPBCSessionsReq structure
2649 * @return true if SME_GET_WPSPBC_SESSION_REQ message is formatted correctly
2650 * false otherwise
2651 */
2652
2653tSirRetStatus
2654limIsSmeGetWPSPBCSessionsReqValid(tpAniSirGlobal pMac, tSirSmeGetWPSPBCSessionsReq *pGetWPSPBCSessionsReq, tANI_U8 *pBuf)
2655{
2656 tANI_S16 len = 0;
2657
2658 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirSmeGetWPSPBCSessionsReq));)
2659
2660 pGetWPSPBCSessionsReq->messageType = limGetU16(pBuf);
2661 pBuf += sizeof(tANI_U16);
2662
2663 len = pGetWPSPBCSessionsReq->length = limGetU16(pBuf);
2664 pBuf += sizeof(tANI_U16);
2665
2666 if (len < (tANI_S16) sizeof(tANI_U32))
2667 return eSIR_FAILURE;
2668
2669 len -= sizeof(tANI_U32); // skip message header
2670 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2671 return eSIR_FAILURE;
2672
2673 // Extract pUsrContext
krunal soni4f802b22014-02-11 17:01:13 -08002674 vos_mem_copy((tANI_U8 *)pGetWPSPBCSessionsReq->pUsrContext, pBuf, sizeof(void*));
2675 pBuf += sizeof(void*);
2676 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002677 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2678 return eSIR_FAILURE;
2679
2680 // Extract pSapEventCallback
krunal soni4f802b22014-02-11 17:01:13 -08002681 vos_mem_copy((tANI_U8 *)pGetWPSPBCSessionsReq->pSapEventCallback, pBuf, sizeof(void*));
2682 pBuf += sizeof(void*);
2683 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002684 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2685 return eSIR_FAILURE;
2686
2687 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302688 vos_mem_copy( (tANI_U8 *) pGetWPSPBCSessionsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002689 pBuf += sizeof(tSirMacAddr);
2690 len -= sizeof(tSirMacAddr);
2691
2692 // Extract MAC address of Station to be removed
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302693 vos_mem_copy( (tANI_U8 *) pGetWPSPBCSessionsReq->pRemoveMac, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002694 pBuf += sizeof(tSirMacAddr);
2695 len -= sizeof(tSirMacAddr);
2696
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002697 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002698
2699 if (len < 0)
2700 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002701 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002702 return eSIR_FAILURE;
2703 }
2704
2705 return eSIR_SUCCESS;
2706}
2707
Jeff Johnson295189b2012-06-20 16:38:30 -07002708
2709/**---------------------------------------------------------------
2710\fn limGetSessionInfo
2711\brief This function returns the sessionId and transactionId
2712\ of a message. This assumes that the message structure
2713\ is of format:
2714\ tANI_U16 messageType
2715\ tANI_U16 messageLength
2716\ tANI_U8 sessionId
2717\ tANI_U16 transactionId
2718\param pMac - pMac global structure
2719\param *pBuf - pointer to the message buffer
2720\param sessionId - returned session id value
2721\param transactionId - returned transaction ID value
2722\return None
2723------------------------------------------------------------------*/
2724void
2725limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U8 *sessionId, tANI_U16 *transactionId)
2726{
2727 if (!pBuf)
2728 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002729 limLog(pMac, LOGE, FL("NULL ptr received. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002730 return;
2731 }
2732
2733 pBuf += sizeof(tANI_U16); // skip message type
2734 pBuf += sizeof(tANI_U16); // skip message length
2735
2736 *sessionId = *pBuf; // get sessionId
2737 pBuf++;
2738 *transactionId = limGetU16(pBuf); // get transactionId
2739
2740 return;
2741}
2742
Jeff Johnson295189b2012-06-20 16:38:30 -07002743
2744/**
2745 * limUpdateAPWPSIEsReqSerDes()
2746 *
2747 *FUNCTION:
2748 * This function is to deserialize UpdateAPWPSIEs message
2749 *
2750 *PARAMS:
2751 *
2752 *LOGIC:
2753 *
2754 *ASSUMPTIONS:
2755 * NA
2756 *
2757 *NOTE:
2758 * NA
2759 *
2760 * @param pUpdateAPWPSIEsReq Pointer to tSirUpdateAPWPSIEsReq being
2761 * extracted
2762 * @param pBuf Pointer to serialized buffer
2763 *
2764 * @return retCode Indicates whether message is successfully
2765 * de-serialized (eSIR_SUCCESS) or
2766 * not (eSIR_FAILURE)
2767 */
2768
2769tSirRetStatus
2770limUpdateAPWPSIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq, tANI_U8 *pBuf)
2771{
2772 tANI_S16 len = 0;
2773
2774 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPSIEsReq));)
2775
2776 if (!pUpdateAPWPSIEsReq || !pBuf)
2777 return eSIR_FAILURE;
2778
2779 pUpdateAPWPSIEsReq->messageType = limGetU16(pBuf);
2780 pBuf += sizeof(tANI_U16);
2781
2782 len = pUpdateAPWPSIEsReq->length = limGetU16(pBuf);
2783 pBuf += sizeof(tANI_U16);
2784
2785 if (len < (tANI_S16) sizeof(tANI_U32))
2786 return eSIR_FAILURE;
2787
2788 len -= sizeof(tANI_U32); // skip message header
2789 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2790 return eSIR_FAILURE;
2791
2792 // Extract transactionId
2793 pUpdateAPWPSIEsReq->transactionId = limGetU16( pBuf );
2794 pBuf += sizeof( tANI_U16 );
2795 len -= sizeof( tANI_U16 );
2796 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2797 return eSIR_FAILURE;
2798
2799 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302800 vos_mem_copy( (tANI_U8 *) pUpdateAPWPSIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002801 pBuf += sizeof(tSirMacAddr);
2802 len -= sizeof(tSirMacAddr);
2803 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2804 return eSIR_FAILURE;
2805
2806 // Extract sessionId
2807 pUpdateAPWPSIEsReq->sessionId = *pBuf++;
2808 len--;
2809 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2810 return eSIR_FAILURE;
2811
2812 // Extract APWPSIEs
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302813 vos_mem_copy( (tSirAPWPSIEs *) &pUpdateAPWPSIEsReq->APWPSIEs, pBuf, sizeof(tSirAPWPSIEs));
Jeff Johnson295189b2012-06-20 16:38:30 -07002814 pBuf += sizeof(tSirAPWPSIEs);
2815 len -= sizeof(tSirAPWPSIEs);
2816
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002817 PELOG1(limLog(pMac, LOG1, FL("SME_UPDATE_APWPSIE_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002818
2819 if (len < 0)
2820 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002821 PELOGE(limLog(pMac, LOGE, FL("SME_UPDATE_APWPSIE_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002822 return eSIR_FAILURE;
2823 }
2824
2825 return eSIR_SUCCESS;
2826} /*** end limSetContextReqSerDes() ***/
2827
2828/**
2829 * limUpdateAPWPARSNIEsReqSerDes ()
2830 *
2831 *FUNCTION:
2832 * This function is to deserialize UpdateAPWPSIEs message
2833 *
2834 *PARAMS:
2835 *
2836 *LOGIC:
2837 *
2838 *ASSUMPTIONS:
2839 * NA
2840 *
2841 *NOTE:
2842 * NA
2843 *
2844 * @param pUpdateAPWPARSNIEsReq Pointer to tpSirUpdateAPWPARSNIEsReq being
2845 * extracted
2846 * @param pBuf Pointer to serialized buffer
2847 *
2848 * @return retCode Indicates whether message is successfully
2849 * de-serialized (eSIR_SUCCESS) or
2850 * not (eSIR_FAILURE)
2851 */
2852
2853tSirRetStatus
2854limUpdateAPWPARSNIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq, tANI_U8 *pBuf)
2855{
2856 tANI_S16 len = 0;
2857
2858 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPARSNIEsReq));)
2859
2860 if (!pUpdateAPWPARSNIEsReq || !pBuf)
2861 return eSIR_FAILURE;
2862
2863 pUpdateAPWPARSNIEsReq->messageType = limGetU16(pBuf);
2864 pBuf += sizeof(tANI_U16);
2865
2866 len = pUpdateAPWPARSNIEsReq->length = limGetU16(pBuf);
2867 pBuf += sizeof(tANI_U16);
2868
2869 if (len < (tANI_S16) sizeof(tANI_U32))
2870 return eSIR_FAILURE;
2871
2872 len -= sizeof(tANI_U32); // skip message header
2873 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2874 return eSIR_FAILURE;
2875
2876 // Extract transactionId
2877 pUpdateAPWPARSNIEsReq->transactionId = limGetU16( pBuf );
2878 pBuf += sizeof(tANI_U16);
2879 len -= sizeof( tANI_U16 );
2880 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2881 return eSIR_FAILURE;
2882
2883 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302884 vos_mem_copy( (tANI_U8 *) pUpdateAPWPARSNIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002885 pBuf += sizeof(tSirMacAddr);
2886 len -= sizeof(tSirMacAddr);
2887 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2888 return eSIR_FAILURE;
2889
2890 // Extract sessionId
2891 pUpdateAPWPARSNIEsReq->sessionId = *pBuf++;
2892 len--;
2893 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2894 return eSIR_FAILURE;
2895
2896 // Extract APWPARSNIEs
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302897 vos_mem_copy( (tSirRSNie *) &pUpdateAPWPARSNIEsReq->APWPARSNIEs, pBuf, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07002898 pBuf += sizeof(tSirRSNie);
2899 len -= sizeof(tSirRSNie);
2900
2901 if (len < 0)
2902 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002903 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002904 return eSIR_FAILURE;
2905 }
2906
2907 return eSIR_SUCCESS;
2908} /*** end limUpdateAPWPARSNIEsReqSerDes() ***/
2909