blob: ea0ebf49e1d5cfc59dbea629f86ec95bd21de514 [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 }
Abhinav Kumar0ee145b2019-09-12 20:13:58 +0530995 pJoinReq->sae_pmk_cached = *pBuf++;
996 len--;
997 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
998 {
999 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1000 return eSIR_FAILURE;
1001 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001002
Sushant Kaushik74df8db2015-03-11 18:09:05 +05301003 pJoinReq->bOSENAssociation = *pBuf++;
1004 len--;
1005 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1006 {
1007 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1008 return eSIR_FAILURE;
1009 }
1010
Abhishek Singheef5c992016-01-27 13:41:54 +05301011 pJoinReq->bWPSAssociation = *pBuf++;
1012 len--;
1013 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1014 {
1015 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1016 return eSIR_FAILURE;
1017 }
1018
Jeff Johnsone7245742012-09-05 17:12:55 -07001019 // Extract cbMode
1020 pJoinReq->cbMode = *pBuf++;
1021 len--;
1022 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301023 {
1024 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnsone7245742012-09-05 17:12:55 -07001025 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301026 }
Abhishek Singhe3beee22017-07-31 15:35:40 +05301027 // Extract cbMode
1028 pJoinReq->force_24ghz_in_ht20 = *pBuf++;
1029 len--;
1030 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1031 {
1032 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1033 return eSIR_FAILURE;
1034 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001035
Jeff Johnson295189b2012-06-20 16:38:30 -07001036 // Extract uapsdPerAcBitmask
1037 pJoinReq->uapsdPerAcBitmask = *pBuf++;
1038 len--;
1039 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301040 {
1041 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001042 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301043 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001044
Jeff Johnson295189b2012-06-20 16:38:30 -07001045
1046 // Extract operationalRateSet
1047 pJoinReq->operationalRateSet.numRates= *pBuf++;
1048 len--;
1049 if (pJoinReq->operationalRateSet.numRates)
1050 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301051 vos_mem_copy( (tANI_U8 *) pJoinReq->operationalRateSet.rate, pBuf,
1052 pJoinReq->operationalRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07001053 pBuf += pJoinReq->operationalRateSet.numRates;
1054 len -= pJoinReq->operationalRateSet.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
1062 // Extract extendedRateSet
1063 pJoinReq->extendedRateSet.numRates = *pBuf++;
1064 len--;
1065 if (pJoinReq->extendedRateSet.numRates)
1066 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301067 vos_mem_copy( pJoinReq->extendedRateSet.rate, pBuf, pJoinReq->extendedRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07001068 pBuf += pJoinReq->extendedRateSet.numRates;
1069 len -= pJoinReq->extendedRateSet.numRates;
1070 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301071 {
1072 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001073 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301074 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001075 }
1076
Masti, Narayanraddi67ea5912015-01-08 12:34:05 +05301077 //Extract rateBitMap
1078 pJoinReq->rateBitMap = limGetU16(pBuf);
1079 pBuf += sizeof(tANI_U16);
1080 len -= sizeof(tANI_U16);
1081
Jeff Johnson295189b2012-06-20 16:38:30 -07001082 // Extract RSN IE
1083 pJoinReq->rsnIE.length = limGetU16(pBuf);
1084 pBuf += sizeof(tANI_U16);
1085 len -= sizeof(tANI_U16);
1086
1087 if (pJoinReq->rsnIE.length)
1088 {
1089 // Check for RSN IE length (that includes length of type & length)
1090 if ((pJoinReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2) ||
1091 (pJoinReq->rsnIE.length != 2 + *(pBuf + 1)))
1092 {
1093 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001094 FL("Invalid RSN IE length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001095 pJoinReq->rsnIE.length);
1096 return eSIR_FAILURE;
1097 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301098 vos_mem_copy( (tANI_U8 *) pJoinReq->rsnIE.rsnIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001099 pBuf, pJoinReq->rsnIE.length);
1100 pBuf += pJoinReq->rsnIE.length;
1101 len -= pJoinReq->rsnIE.length; // skip RSN IE
1102 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301103 {
1104 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001105 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301106 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001107 }
1108
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001109#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001110 // Extract CCKM IE
1111 pJoinReq->cckmIE.length = limGetU16(pBuf);
1112 pBuf += sizeof(tANI_U16);
1113 len -= sizeof(tANI_U16);
1114 if (pJoinReq->cckmIE.length)
1115 {
1116 // Check for CCKM IE length (that includes length of type & length)
1117 if ((pJoinReq->cckmIE.length > SIR_MAC_MAX_IE_LENGTH) ||
1118 (pJoinReq->cckmIE.length != (2 + *(pBuf + 1))))
1119 {
1120 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001121 FL("Invalid CCKM IE length %d/%d in SME_JOIN/REASSOC_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001122 pJoinReq->cckmIE.length, 2 + *(pBuf + 1));
1123 return eSIR_FAILURE;
1124 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301125 vos_mem_copy((tANI_U8 *) pJoinReq->cckmIE.cckmIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001126 pBuf, pJoinReq->cckmIE.length);
1127 pBuf += pJoinReq->cckmIE.length;
1128 len -= pJoinReq->cckmIE.length; // skip CCKM IE
1129 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301130 {
1131 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001132 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301133 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001134 }
1135#endif
1136
1137 // Extract Add IE for scan
1138 pJoinReq->addIEScan.length = limGetU16(pBuf);
1139 pBuf += sizeof(tANI_U16);
1140 len -= sizeof(tANI_U16);
1141
1142 if (pJoinReq->addIEScan.length)
1143 {
1144 // Check for IE length (that includes length of type & length)
Ganesh Kondabattini7500fb32015-04-10 14:50:32 +05301145 if (pJoinReq->addIEScan.length > SIR_MAC_MAX_ADD_IE_LENGTH + 2)
Jeff Johnson295189b2012-06-20 16:38:30 -07001146 {
1147 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001148 FL("Invalid addIE Scan length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001149 pJoinReq->addIEScan.length);
1150 return eSIR_FAILURE;
1151 }
1152 // Check for P2P IE length (that includes length of type & length)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301153 vos_mem_copy( (tANI_U8 *) pJoinReq->addIEScan.addIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001154 pBuf, pJoinReq->addIEScan.length);
1155 pBuf += pJoinReq->addIEScan.length;
1156 len -= pJoinReq->addIEScan.length; // skip add IE
1157 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301158 {
1159 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001160 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301161 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001162 }
1163
1164 pJoinReq->addIEAssoc.length = limGetU16(pBuf);
1165 pBuf += sizeof(tANI_U16);
1166 len -= sizeof(tANI_U16);
1167
1168 // Extract Add IE for assoc
1169 if (pJoinReq->addIEAssoc.length)
1170 {
1171 // Check for IE length (that includes length of type & length)
1172 if (pJoinReq->addIEAssoc.length > SIR_MAC_MAX_IE_LENGTH + 2)
1173 {
1174 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001175 FL("Invalid addIE Assoc length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001176 pJoinReq->addIEAssoc.length);
1177 return eSIR_FAILURE;
1178 }
1179 // Check for P2P IE length (that includes length of type & length)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301180 vos_mem_copy( (tANI_U8 *) pJoinReq->addIEAssoc.addIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001181 pBuf, pJoinReq->addIEAssoc.length);
1182 pBuf += pJoinReq->addIEAssoc.length;
1183 len -= pJoinReq->addIEAssoc.length; // skip add IE
1184 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301185 {
1186 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001187 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301188 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001189 }
1190
Venkata Prathyusha Kuntupallie8dc41d2013-04-15 14:31:36 -07001191 pJoinReq->UCEncryptionType = limGetU32(pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001192 pBuf += sizeof(tANI_U32);
1193 len -= sizeof(tANI_U32);
1194 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301195 {
1196 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1197 return eSIR_FAILURE;
1198 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001199
Venkata Prathyusha Kuntupallie8dc41d2013-04-15 14:31:36 -07001200 pJoinReq->MCEncryptionType = limGetU32(pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001201 pBuf += sizeof(tANI_U32);
1202 len -= sizeof(tANI_U32);
1203 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301204 {
1205 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1206 return eSIR_FAILURE;
1207 }
Chet Lanctot186b5732013-03-18 10:26:30 -07001208#ifdef WLAN_FEATURE_11W
1209 pJoinReq->MgmtEncryptionType = limGetU32(pBuf);
1210 pBuf += sizeof(tANI_U32);
1211 len -= sizeof(tANI_U32);
1212 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301213 {
1214 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Chet Lanctot186b5732013-03-18 10:26:30 -07001215 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301216 }
Chet Lanctot186b5732013-03-18 10:26:30 -07001217#endif
1218
Jeff Johnson295189b2012-06-20 16:38:30 -07001219#ifdef WLAN_FEATURE_VOWIFI_11R
1220 //is11Rconnection;
1221 pJoinReq->is11Rconnection = (tAniBool)limGetU32(pBuf);
1222 pBuf += sizeof(tAniBool);
1223 len -= sizeof(tAniBool);
1224 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301225 {
1226 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1227 return eSIR_FAILURE;
1228 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001229#endif
1230
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001231#ifdef FEATURE_WLAN_ESE
1232 //ESE version IE
1233 pJoinReq->isESEFeatureIniEnabled = (tAniBool)limGetU32(pBuf);
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05301234 pBuf += sizeof(tAniBool);
1235 len -= sizeof(tAniBool);
1236 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301237 {
1238 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05301239 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301240 }
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05301241
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001242 //isESEconnection;
1243 pJoinReq->isESEconnection = (tAniBool)limGetU32(pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001244 pBuf += sizeof(tAniBool);
1245 len -= sizeof(tAniBool);
1246 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301247 {
1248 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1249 return eSIR_FAILURE;
1250 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001251
1252 // TSPEC information
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001253 pJoinReq->eseTspecInfo.numTspecs = *pBuf++;
Jeff Johnson295189b2012-06-20 16:38:30 -07001254 len -= sizeof(tANI_U8);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001255 vos_mem_copy((void*)&pJoinReq->eseTspecInfo.tspec[0], pBuf,
1256 (sizeof(tTspecInfo)* pJoinReq->eseTspecInfo.numTspecs));
1257 pBuf += sizeof(tTspecInfo)*SIR_ESE_MAX_TSPEC_IES;
1258 len -= sizeof(tTspecInfo)*SIR_ESE_MAX_TSPEC_IES;
Jeff Johnson295189b2012-06-20 16:38:30 -07001259 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301260 {
1261 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001262 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301263 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001264#endif
1265
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001266#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07001267 //isFastTransitionEnabled;
1268 pJoinReq->isFastTransitionEnabled = (tAniBool)limGetU32(pBuf);
1269 pBuf += sizeof(tAniBool);
1270 len -= sizeof(tAniBool);
1271 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301272 {
1273 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1274 return eSIR_FAILURE;
1275 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001276#endif
1277
Jeff Johnson43971f52012-07-17 12:26:56 -07001278#ifdef FEATURE_WLAN_LFR
1279 //isFastRoamIniFeatureEnabled;
1280 pJoinReq->isFastRoamIniFeatureEnabled = (tAniBool)limGetU32(pBuf);
1281 pBuf += sizeof(tAniBool);
1282 len -= sizeof(tAniBool);
1283 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301284 {
1285 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1286 return eSIR_FAILURE;
1287 }
Jeff Johnson43971f52012-07-17 12:26:56 -07001288#endif
1289
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001290 //txLdpcIniFeatureEnabled
1291 pJoinReq->txLdpcIniFeatureEnabled= *pBuf++;
1292 len--;
1293 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301294 {
1295 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001296 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301297 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301298#ifdef WLAN_FEATURE_11AC
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001299 //txBFIniFeatureEnabled
1300 pJoinReq->txBFIniFeatureEnabled= *pBuf++;
1301 len--;
1302 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301303 {
1304 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001305 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301306 }
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001307
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001308 //txBFCsnValue
1309 pJoinReq->txBFCsnValue= *pBuf++;
1310 len--;
1311 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301312 {
1313 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001314 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301315 }
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001316
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301317 //MuBformee
1318 pJoinReq->txMuBformee= *pBuf++;
1319 len--;
1320 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1321 {
1322 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1323 return eSIR_FAILURE;
1324 }
1325#endif
1326
krunal soni5afa96c2013-09-06 22:19:02 -07001327 pJoinReq->isAmsduSupportInAMPDU= *pBuf++;
1328 len--;
1329 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301330 {
1331 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
krunal soni5afa96c2013-09-06 22:19:02 -07001332 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301333 }
krunal soni5afa96c2013-09-06 22:19:02 -07001334
Sandeep Puligillaaea98a22013-12-04 13:36:32 +05301335 pJoinReq->isWMEenabled = (tAniBool)limGetU32(pBuf);
1336 pBuf += sizeof(tAniBool);
1337 len -= sizeof(tAniBool);
1338 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1339 return eSIR_FAILURE;
1340
1341 pJoinReq->isQosEnabled = (tAniBool)limGetU32(pBuf);
1342 pBuf += sizeof(tAniBool);
1343 len -= sizeof(tAniBool);
1344 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1345 return eSIR_FAILURE;
1346
Jeff Johnson295189b2012-06-20 16:38:30 -07001347 // Extract Titan CB Neighbor BSS info
1348 pJoinReq->cbNeighbors.cbBssFoundPri = *pBuf;
1349 pBuf++;
1350 pJoinReq->cbNeighbors.cbBssFoundSecUp = *pBuf;
1351 pBuf++;
1352 pJoinReq->cbNeighbors.cbBssFoundSecDown = *pBuf;
1353 pBuf++;
1354 len -= 3;
1355
1356 // Extract Spectrum Mgt Indicator
1357 pJoinReq->spectrumMgtIndicator = (tAniBool) limGetU32(pBuf);
1358 pBuf += sizeof(tAniBool);
1359 len -= sizeof(tAniBool);
1360
1361 pJoinReq->powerCap.minTxPower = *pBuf++;
1362 pJoinReq->powerCap.maxTxPower = *pBuf++;
1363 len -=2;
Jeff Johnson295189b2012-06-20 16:38:30 -07001364
1365 pJoinReq->supportedChannels.numChnl = *pBuf++;
1366 len--;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301367 vos_mem_copy( (tANI_U8 *) pJoinReq->supportedChannels.channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001368 pBuf, pJoinReq->supportedChannels.numChnl);
1369 pBuf += pJoinReq->supportedChannels.numChnl;
1370 len-= pJoinReq->supportedChannels.numChnl;
1371
Abhishek Singh525045c2014-12-15 17:18:45 +05301372 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001373 FL("spectrumInd ON: minPower %d, maxPower %d , numChnls %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001374 pJoinReq->powerCap.minTxPower,
1375 pJoinReq->powerCap.maxTxPower,
Abhishek Singh525045c2014-12-15 17:18:45 +05301376 pJoinReq->supportedChannels.numChnl);
Jeff Johnson295189b2012-06-20 16:38:30 -07001377
1378 // Extract uapsdPerAcBitmask
1379 pJoinReq->uapsdPerAcBitmask = *pBuf++;
1380 len--;
1381 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301382 {
1383 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001384 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301385 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001386
Jeff Johnson295189b2012-06-20 16:38:30 -07001387 //
1388 // NOTE - tSirBssDescription is now moved to the end
1389 // of tSirSmeJoinReq structure. This is to accomodate
1390 // the variable length data member ieFields[1]
1391 //
1392 if (limGetBssDescription( pMac, &pJoinReq->bssDescription,
1393 len, &lenUsed, pBuf) == eSIR_FAILURE)
1394 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001395 PELOGE(limLog(pMac, LOGE, FL("get bss description failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001396 return eSIR_FAILURE;
1397 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05301398 PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3,
1399 (tANI_U8 *) &(pJoinReq->bssDescription),
1400 pJoinReq->bssDescription.length + 2);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001401 pBuf += lenUsed;
1402 len -= lenUsed;
Jeff Johnson295189b2012-06-20 16:38:30 -07001403
1404 return eSIR_SUCCESS;
1405} /*** end limJoinReqSerDes() ***/
1406
1407
1408/**---------------------------------------------------------------
1409\fn limAssocIndSerDes
1410\brief This function is called by limProcessMlmAssocInd() to
1411\ populate the SME_ASSOC_IND message based on the received
1412\ MLM_ASSOC_IND.
1413\
1414\param pMac
1415\param pAssocInd - Pointer to the received tLimMlmAssocInd
1416\param pBuf - Pointer to serialized buffer
1417\param psessionEntry - pointer to PE session entry
1418\
1419\return None
1420------------------------------------------------------------------*/
1421void
1422limAssocIndSerDes(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
1423{
1424 tANI_U8 *pLen = pBuf;
1425 tANI_U16 mLen = 0;
1426
1427#ifdef PE_DEBUG_LOG1
1428 tANI_U8 *pTemp = pBuf;
1429#endif
1430
Jeff Johnson295189b2012-06-20 16:38:30 -07001431
1432 mLen = sizeof(tANI_U32);
1433 mLen += sizeof(tANI_U8);
1434 pBuf += sizeof(tANI_U16);
1435 *pBuf = psessionEntry->smeSessionId;
1436 pBuf += sizeof(tANI_U8);
1437
1438 // Fill in peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301439 vos_mem_copy( pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001440 pBuf += sizeof(tSirMacAddr);
1441 mLen += sizeof(tSirMacAddr);
1442
1443 // Fill in aid
1444 limCopyU16(pBuf, pAssocInd->aid);
1445 pBuf += sizeof(tANI_U16);
1446 mLen += sizeof(tANI_U16);
1447
1448 // Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301449 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001450 pBuf += sizeof(tSirMacAddr);
1451 mLen += sizeof(tSirMacAddr);
1452
1453 // Fill in staId
1454 limCopyU16(pBuf, psessionEntry->staId);
1455 pBuf += sizeof(tANI_U16);
1456 mLen += sizeof(tANI_U16);
1457
1458 // Fill in authType
1459 limCopyU32(pBuf, pAssocInd->authType);
1460 pBuf += sizeof(tANI_U32);
1461 mLen += sizeof(tANI_U32);
1462
1463 // Fill in ssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301464 vos_mem_copy( pBuf, (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001465 pBuf += (1 + pAssocInd->ssId.length);
1466 mLen += (1 + pAssocInd->ssId.length);
1467
1468 // Fill in rsnIE
1469 limCopyU16(pBuf, pAssocInd->rsnIE.length);
1470 pBuf += sizeof(tANI_U16);
1471 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301472 vos_mem_copy( pBuf, (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001473 pAssocInd->rsnIE.length);
1474 pBuf += pAssocInd->rsnIE.length;
1475 mLen += pAssocInd->rsnIE.length;
1476
Jeff Johnson295189b2012-06-20 16:38:30 -07001477
Jeff Johnson295189b2012-06-20 16:38:30 -07001478 limCopyU32(pBuf, pAssocInd->spectrumMgtIndicator);
1479 pBuf += sizeof(tAniBool);
1480 mLen += sizeof(tAniBool);
1481
1482 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1483 {
1484 *pBuf = pAssocInd->powerCap.minTxPower;
1485 pBuf++;
1486 *pBuf = pAssocInd->powerCap.maxTxPower;
1487 pBuf++;
1488 mLen += sizeof(tSirMacPowerCapInfo);
1489
1490 *pBuf = pAssocInd->supportedChannels.numChnl;
1491 pBuf++;
1492 mLen++;
1493
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301494 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -07001495 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
1496 pAssocInd->supportedChannels.numChnl);
1497
1498
1499 pBuf += pAssocInd->supportedChannels.numChnl;
1500 mLen += pAssocInd->supportedChannels.numChnl;
1501 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001502 limCopyU32(pBuf, pAssocInd->WmmStaInfoPresent);
1503 pBuf += sizeof(tANI_U32);
1504 mLen += sizeof(tANI_U32);
Hardik Kantilal Patel1ba630f2014-11-21 04:32:05 +05301505
1506#ifdef WLAN_FEATURE_AP_HT40_24G
1507 limCopyU32(pBuf, pAssocInd->HT40MHzIntoPresent);
1508 pBuf += sizeof(tANI_U32);
1509 mLen += sizeof(tANI_U32);
1510#endif
1511
Jeff Johnson295189b2012-06-20 16:38:30 -07001512 // Fill in length of SME_ASSOC_IND message
1513 limCopyU16(pLen, mLen);
1514
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001515 PELOG1(limLog(pMac, LOG1, FL("Sending SME_ASSOC_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001516 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1517} /*** end limAssocIndSerDes() ***/
1518
1519
1520
1521/**
1522 * limAssocCnfSerDes()
1523 *
1524 *FUNCTION:
1525 * This function is called by limProcessLmmMessages() when
1526 * SME_ASSOC_CNF or SME_REASSOC_CNF message is received from
1527 * upper layer software.
1528 *
1529 *PARAMS:
1530 *
1531 *LOGIC:
1532 *
1533 *ASSUMPTIONS:
1534 * NA
1535 *
1536 *NOTE:
1537 * NA
1538 *
1539 * @param pAssocCnf Pointer to tSirSmeAssocCnf being extracted into
1540 * @param pBuf Pointer to serialized buffer
1541 * @return retCode Indicates whether message is successfully
1542 * de-serialized (eSIR_SUCCESS) or
1543 * not (eSIR_FAILURE)
1544 */
1545
1546tSirRetStatus
1547limAssocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeAssocCnf pAssocCnf, tANI_U8 *pBuf)
1548{
1549#ifdef PE_DEBUG_LOG1
1550 tANI_U8 *pTemp = pBuf;
1551#endif
1552
1553 if (!pAssocCnf || !pBuf)
1554 return eSIR_FAILURE;
1555
1556 pAssocCnf->messageType = limGetU16(pBuf);
1557 pBuf += sizeof(tANI_U16);
1558
1559 pAssocCnf->length = limGetU16(pBuf);
1560 pBuf += sizeof(tANI_U16);
1561
1562 if (pAssocCnf->messageType == eWNI_SME_ASSOC_CNF)
1563 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001564 PELOG1(limLog(pMac, LOG1, FL("SME_ASSOC_CNF length %d bytes is:"), pAssocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001565 }
1566 else
1567 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001568 PELOG1(limLog(pMac, LOG1, FL("SME_REASSOC_CNF length %d bytes is:"), pAssocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001569 }
1570 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pAssocCnf->length);)
1571
1572 // status code
1573 pAssocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
1574 pBuf += sizeof(tSirResultCodes);
1575
1576 // bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301577 vos_mem_copy( pAssocCnf->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001578 pBuf += sizeof(tSirMacAddr);
1579
1580 // peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301581 vos_mem_copy( pAssocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001582 pBuf += sizeof(tSirMacAddr);
1583
1584
1585 pAssocCnf->aid = limGetU16(pBuf);
1586 pBuf += sizeof(tANI_U16);
1587 // alternateBssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301588 vos_mem_copy( pAssocCnf->alternateBssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001589 pBuf += sizeof(tSirMacAddr);
1590
1591 // alternateChannelId
1592 pAssocCnf->alternateChannelId = *pBuf;
1593 pBuf++;
1594
1595 return eSIR_SUCCESS;
1596} /*** end limAssocCnfSerDes() ***/
1597
1598
1599
1600/**
1601 * limDisassocCnfSerDes()
1602 *
1603 *FUNCTION:
1604 * This function is called by limProcessSmeMessages() when
1605 * SME_DISASSOC_CNF message is received from upper layer software.
1606 *
1607 *PARAMS:
1608 *
1609 *LOGIC:
1610 *
1611 *ASSUMPTIONS:
1612 * NA
1613 *
1614 *NOTE:
1615 * NA
1616 *
1617 * @param pDisassocCnf Pointer to tSirSmeDisassocCnf being
1618 * extracted into
1619 * @param pBuf Pointer to serialized buffer
1620 * @return retCode Indicates whether message is successfully
1621 * de-serialized (eSIR_SUCCESS) or
1622 * not (eSIR_FAILURE)
1623 */
1624
1625tSirRetStatus
1626limDisassocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeDisassocCnf pDisassocCnf, tANI_U8 *pBuf)
1627{
1628#ifdef PE_DEBUG_LOG1
1629 tANI_U8 *pTemp = pBuf;
1630#endif
1631
1632 if (!pDisassocCnf || !pBuf)
1633 return eSIR_FAILURE;
1634
1635 pDisassocCnf->messageType = limGetU16(pBuf);
1636 pBuf += sizeof(tANI_U16);
1637
1638 pDisassocCnf->length = limGetU16(pBuf);
1639 pBuf += sizeof(tANI_U16);
1640
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001641 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_CNF length %d bytes is:"), pDisassocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001642 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pDisassocCnf->length);)
1643
1644 pDisassocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
1645 pBuf += sizeof(tSirResultCodes);
1646
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301647 vos_mem_copy( pDisassocCnf->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001648 pBuf += sizeof(tSirMacAddr);
Jeff Johnson62c27982013-02-27 17:53:55 -08001649
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301650 vos_mem_copy( pDisassocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Wu Gao742b7352015-10-16 19:10:40 +08001651 pBuf += sizeof(tSirMacAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001652
Wu Gao742b7352015-10-16 19:10:40 +08001653 pDisassocCnf->assocId = limGetU16(pBuf);
Jeff Johnson62c27982013-02-27 17:53:55 -08001654
Jeff Johnson295189b2012-06-20 16:38:30 -07001655 return eSIR_SUCCESS;
1656} /*** end limDisassocCnfSerDes() ***/
1657
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301658static inline int CheckRemainingLength(tANI_U16 mLen, tANI_U16 len)
1659{
1660 if (mLen > (len - sizeof(tANI_U16)))
1661 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001662
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301663 return eSIR_SUCCESS;
1664}
Jeff Johnson295189b2012-06-20 16:38:30 -07001665
1666/**---------------------------------------------------------------
1667\fn limReassocIndSerDes
1668\brief This function is called by limProcessMlmReassocInd() to
1669\ populate the SME_REASSOC_IND message based on the received
1670\ MLM_REASSOC_IND.
1671\
1672\param pMac
1673\param pReassocInd - Pointer to the received tLimMlmReassocInd
1674\param pBuf - Pointer to serialized buffer
1675\param psessionEntry - pointer to PE session entry
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301676\param len - size of tSirSmeReassocInd structure
Jeff Johnson295189b2012-06-20 16:38:30 -07001677\
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301678\return tSirRietStatus Indicates whether message is successfully
1679\ de-serialized (eSIR_SUCCESS) or
1680\ not (eSIR_FAILURE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001681------------------------------------------------------------------*/
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301682tSirRetStatus
1683limReassocIndSerDes(tpAniSirGlobal pMac, tpLimMlmReassocInd pReassocInd,
1684 tANI_U8 *pBuf, tpPESession psessionEntry, tANI_U16 len)
Jeff Johnson295189b2012-06-20 16:38:30 -07001685{
1686 tANI_U8 *pLen = pBuf;
1687 tANI_U16 mLen = 0;
1688
1689#ifdef PE_DEBUG_LOG1
1690 tANI_U8 *pTemp = pBuf;
1691#endif
1692
Jeff Johnson295189b2012-06-20 16:38:30 -07001693
1694 mLen = sizeof(tANI_U32);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301695 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1696 return eSIR_FAILURE;
1697
Jeff Johnson295189b2012-06-20 16:38:30 -07001698 pBuf += sizeof(tANI_U16);
1699 *pBuf++ = psessionEntry->smeSessionId;
1700 mLen += sizeof(tANI_U8);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301701 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1702 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001703
1704 // Fill in peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301705 vos_mem_copy( pBuf, pReassocInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001706 pBuf += sizeof(tSirMacAddr);
1707 mLen += sizeof(tSirMacAddr);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301708 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1709 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001710
1711 // Fill in oldMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301712 vos_mem_copy( pBuf, pReassocInd->currentApAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001713 pBuf += sizeof(tSirMacAddr);
1714 mLen += sizeof(tSirMacAddr);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301715 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1716 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001717
1718 // Fill in aid
1719 limCopyU16(pBuf, pReassocInd->aid);
1720 pBuf += sizeof(tANI_U16);
1721 mLen += sizeof(tANI_U16);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301722 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1723 return eSIR_FAILURE;
1724
Jeff Johnson295189b2012-06-20 16:38:30 -07001725 // Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301726 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001727 pBuf += sizeof(tSirMacAddr);
1728 mLen += sizeof(tSirMacAddr);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301729 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1730 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001731
1732 // Fill in staId
1733 limCopyU16(pBuf, psessionEntry->staId);
1734 pBuf += sizeof(tANI_U16);
1735 mLen += sizeof(tANI_U16);
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 authType
1740 limCopyU32(pBuf, pReassocInd->authType);
1741 pBuf += sizeof(tAniAuthType);
1742 mLen += sizeof(tAniAuthType);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301743 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1744 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001745
1746 // Fill in ssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301747 vos_mem_copy( pBuf, (tANI_U8 *) &(pReassocInd->ssId),
Jeff Johnson295189b2012-06-20 16:38:30 -07001748 pReassocInd->ssId.length + 1);
1749 pBuf += 1 + pReassocInd->ssId.length;
1750 mLen += pReassocInd->ssId.length + 1;
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301751 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1752 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001753
1754 // Fill in rsnIE
1755 limCopyU16(pBuf, pReassocInd->rsnIE.length);
1756 pBuf += sizeof(tANI_U16);
1757 mLen += sizeof(tANI_U16);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301758 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1759 return eSIR_FAILURE;
1760
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301761 vos_mem_copy( pBuf, (tANI_U8 *) &(pReassocInd->rsnIE.rsnIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001762 pReassocInd->rsnIE.length);
1763 pBuf += pReassocInd->rsnIE.length;
1764 mLen += pReassocInd->rsnIE.length;
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301765 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1766 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001767
1768 // Fill in addIE
1769 limCopyU16(pBuf, pReassocInd->addIE.length);
1770 pBuf += sizeof(tANI_U16);
1771 mLen += sizeof(tANI_U16);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301772 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1773 return eSIR_FAILURE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301774 vos_mem_copy( pBuf, (tANI_U8*) &(pReassocInd->addIE.addIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001775 pReassocInd->addIE.length);
1776 pBuf += pReassocInd->addIE.length;
1777 mLen += pReassocInd->addIE.length;
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301778 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1779 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001780
Jeff Johnson295189b2012-06-20 16:38:30 -07001781 limCopyU32(pBuf, pReassocInd->spectrumMgtIndicator);
1782 pBuf += sizeof(tAniBool);
1783 mLen += sizeof(tAniBool);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301784 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1785 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001786
1787 if (pReassocInd->spectrumMgtIndicator == eSIR_TRUE)
1788 {
1789 *pBuf = pReassocInd->powerCap.minTxPower;
1790 pBuf++;
1791 *pBuf = pReassocInd->powerCap.maxTxPower;
1792 pBuf++;
1793 mLen += sizeof(tSirMacPowerCapInfo);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301794 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1795 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001796
1797 *pBuf = pReassocInd->supportedChannels.numChnl;
1798 pBuf++;
1799 mLen++;
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301800 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1801 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001802
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301803 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -07001804 (tANI_U8 *) &(pReassocInd->supportedChannels.channelList),
1805 pReassocInd->supportedChannels.numChnl);
1806
1807 pBuf += pReassocInd->supportedChannels.numChnl;
1808 mLen += pReassocInd->supportedChannels.numChnl;
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301809 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1810 return eSIR_FAILURE;
1811
Jeff Johnson295189b2012-06-20 16:38:30 -07001812 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001813 limCopyU32(pBuf, pReassocInd->WmmStaInfoPresent);
1814 pBuf += sizeof(tANI_U32);
1815 mLen += sizeof(tANI_U32);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301816 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1817 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001818
1819 // Fill in length of SME_REASSOC_IND message
1820 limCopyU16(pLen, mLen);
1821
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001822 PELOG1(limLog(pMac, LOG1, FL("Sending SME_REASSOC_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001823 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301824
1825 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001826} /*** end limReassocIndSerDes() ***/
1827
1828
1829/**
1830 * limAuthIndSerDes()
1831 *
1832 *FUNCTION:
1833 * This function is called by limProcessMlmAuthInd() while sending
1834 * SME_AUTH_IND to host
1835 *
1836 *PARAMS:
1837 *
1838 *LOGIC:
1839 *
1840 *ASSUMPTIONS:
1841 * NA
1842 *
1843 *NOTE:
1844 * NA
1845 *
1846 * @param pAuthInd Pointer to tSirSmeAuthInd being sent
1847 * @param pBuf Pointer to serialized buffer
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301848 * @param len size of tSirSmeAuthInd structure
Jeff Johnson295189b2012-06-20 16:38:30 -07001849 *
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301850 * @return tSirRetStatus Indicates whether message is successfully
1851 * de-serialized (eSIR_SUCCESS) or
1852 * not (eSIR_FAILURE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001853 */
1854
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301855tSirRetStatus
1856limAuthIndSerDes(tpAniSirGlobal pMac, tpLimMlmAuthInd pAuthInd, tANI_U8 *pBuf, tANI_U16 len)
Jeff Johnson295189b2012-06-20 16:38:30 -07001857{
1858 tANI_U8 *pLen = pBuf;
1859 tANI_U16 mLen = 0;
1860
1861#ifdef PE_DEBUG_LOG1
1862 tANI_U8 *pTemp = pBuf;
1863#endif
1864
1865 mLen = sizeof(tANI_U32);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301866 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1867 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001868 pBuf += sizeof(tANI_U16);
1869 *pBuf++ = pAuthInd->sessionId;
1870 mLen += sizeof(tANI_U8);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301871 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1872 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001873
1874 // BTAMP TODO: Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301875 vos_mem_set(pBuf, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001876 pBuf += sizeof(tSirMacAddr);
1877 mLen += sizeof(tSirMacAddr);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301878 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1879 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001880
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301881 vos_mem_copy( pBuf, pAuthInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001882 pBuf += sizeof(tSirMacAddr);
1883 mLen += sizeof(tSirMacAddr);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301884 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1885 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001886
1887 limCopyU32(pBuf, pAuthInd->authType);
1888 pBuf += sizeof(tAniAuthType);
1889 mLen += sizeof(tAniAuthType);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301890 if (CheckRemainingLength(mLen, len) == eSIR_FAILURE)
1891 return eSIR_FAILURE;
1892
Jeff Johnson295189b2012-06-20 16:38:30 -07001893 limCopyU16(pLen, mLen);
1894
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001895 PELOG1(limLog(pMac, LOG1, FL("Sending SME_AUTH_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001896 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301897
1898 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001899} /*** end limAuthIndSerDes() ***/
1900
1901
1902
1903/**
1904 * limSetContextReqSerDes()
1905 *
1906 *FUNCTION:
1907 * This function is called by limProcessSmeMessages() upon receiving
1908 * SME_SETCONTEXT_REQ from host
1909 *
1910 *PARAMS:
1911 *
1912 *LOGIC:
1913 *
1914 *ASSUMPTIONS:
1915 * NA
1916 *
1917 *NOTE:
1918 * NA
1919 *
1920 * @param pSetContextReq Pointer to tSirSmeSetContextReq being
1921 * extracted
1922 * @param pBuf Pointer to serialized buffer
1923 *
1924 * @return retCode Indicates whether message is successfully
1925 * de-serialized (eSIR_SUCCESS) or
1926 * not (eSIR_FAILURE)
1927 */
1928
1929tSirRetStatus
1930limSetContextReqSerDes(tpAniSirGlobal pMac, tpSirSmeSetContextReq pSetContextReq, tANI_U8 *pBuf)
1931{
1932 tANI_S16 len = 0;
1933 tANI_U16 totalKeySize = sizeof(tANI_U8); // initialized to sizeof numKeys
1934 tANI_U8 numKeys;
1935 tANI_U8 *pKeys;
1936
1937#ifdef PE_DEBUG_LOG1
1938 tANI_U8 *pTemp = pBuf;
1939#endif
1940 if (!pSetContextReq || !pBuf)
1941 return eSIR_FAILURE;
1942
1943 pSetContextReq->messageType = limGetU16(pBuf);
1944 pBuf += sizeof(tANI_U16);
1945
1946 len = pSetContextReq->length = limGetU16(pBuf);
1947 pBuf += sizeof(tANI_U16);
1948
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001949 PELOG1(limLog(pMac, LOG1, FL("SME_SETCONTEXT_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001950 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
1951
1952 if (len < (tANI_S16) sizeof(tANI_U32))
1953 return eSIR_FAILURE;
1954
1955 len -= sizeof(tANI_U32); // skip message header
1956 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1957 return eSIR_FAILURE;
1958
1959 // Extract sessionId
1960 pSetContextReq->sessionId = *pBuf++;
1961 len--;
1962 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1963 return eSIR_FAILURE;
1964
1965 // Extract transactionId
1966 pSetContextReq->transactionId = sirReadU16N(pBuf);
1967 pBuf += sizeof(tANI_U16);
1968 len -= sizeof(tANI_U16);
1969 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1970 return eSIR_FAILURE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301971 vos_mem_copy( (tANI_U8 *) pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001972 pBuf, sizeof(tSirMacAddr));
1973 pBuf += sizeof(tSirMacAddr);
1974 len -= sizeof(tSirMacAddr);
1975 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1976 return eSIR_FAILURE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301977 vos_mem_copy( pSetContextReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001978 pBuf += sizeof(tSirMacAddr);
1979 len -= sizeof(tSirMacAddr);
1980 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1981 return eSIR_FAILURE;
1982
Jeff Johnson295189b2012-06-20 16:38:30 -07001983
1984// pSetContextReq->qosInfoPresent = limGetU32(pBuf);
1985// pBuf += sizeof(tAniBool);
1986
1987// if (pSetContextReq->qosInfoPresent)
1988// {
1989// len = limGetQosInfo(&pSetContextReq->qos, pBuf);
1990// pBuf += len;
1991// }
1992
1993 pSetContextReq->keyMaterial.length = limGetU16(pBuf);
1994 pBuf += sizeof(tANI_U16);
1995 len -= sizeof(tANI_U16);
1996 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1997 return eSIR_FAILURE;
1998
1999 pSetContextReq->keyMaterial.edType = (tAniEdType) limGetU32(pBuf);
2000 pBuf += sizeof(tAniEdType);
2001 len -= sizeof(tAniEdType);
2002 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2003 return eSIR_FAILURE;
2004
2005 numKeys = pSetContextReq->keyMaterial.numKeys = *pBuf++;
2006 len -= sizeof(numKeys);
2007
2008 if (numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
2009 return eSIR_FAILURE;
2010
2011 /** Initialize the Default Keys if no Keys are being sent from the upper layer*/
2012 if( limCheckRemainingLength(pMac, len) == eSIR_FAILURE) {
2013 tpSirKeys pKeyinfo = pSetContextReq->keyMaterial.key;
2014
2015 pKeyinfo->keyId = 0;
2016 pKeyinfo->keyDirection = eSIR_TX_RX;
2017 pKeyinfo->keyLength = 0;
2018
2019 if (!limIsAddrBC(pSetContextReq->peerMacAddr))
2020 pKeyinfo->unicast = 1;
2021 else
2022 pKeyinfo->unicast = 0;
2023 }else {
2024 pKeys = (tANI_U8 *) pSetContextReq->keyMaterial.key;
2025 do {
2026 tANI_U32 keySize = limGetKeysInfo(pMac, (tpSirKeys) pKeys,
2027 pBuf);
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302028 vos_mem_zero(pBuf, keySize);
Jeff Johnson295189b2012-06-20 16:38:30 -07002029 pBuf += keySize;
2030 pKeys += sizeof(tSirKeys);
2031 totalKeySize += (tANI_U16) keySize;
2032 if (numKeys == 0)
2033 break;
2034 numKeys--;
2035 }while (numKeys);
2036 }
2037 return eSIR_SUCCESS;
2038} /*** end limSetContextReqSerDes() ***/
2039
2040/**
2041 * limRemoveKeyReqSerDes()
2042 *
2043 *FUNCTION:
2044 * This function is called by limProcessSmeMessages() upon receiving
2045 * SME_REMOVEKEY_REQ from host
2046 *
2047 *PARAMS:
2048 *
2049 *LOGIC:
2050 *
2051 *ASSUMPTIONS:
2052 * NA
2053 *
2054 *NOTE:
2055 * NA
2056 *
2057 * @param pRemoveKeyReq Pointer to tSirSmeRemoveKeyReq being
2058 * extracted
2059 * @param pBuf Pointer to serialized buffer
2060 *
2061 * @return retCode Indicates whether message is successfully
2062 * de-serialized (eSIR_SUCCESS) or
2063 * not (eSIR_FAILURE)
2064 */
2065
2066tSirRetStatus
2067limRemoveKeyReqSerDes(tpAniSirGlobal pMac, tpSirSmeRemoveKeyReq pRemoveKeyReq, tANI_U8 *pBuf)
2068{
2069 tANI_S16 len = 0;
2070
2071#ifdef PE_DEBUG_LOG1
2072 tANI_U8 *pTemp = pBuf;
2073#endif
2074 if (!pRemoveKeyReq || !pBuf)
2075 return eSIR_FAILURE;
2076
2077 pRemoveKeyReq->messageType = limGetU16(pBuf);
2078 pBuf += sizeof(tANI_U16);
2079
2080 len = pRemoveKeyReq->length = limGetU16(pBuf);
2081 pBuf += sizeof(tANI_U16);
2082
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002083 PELOG1(limLog(pMac, LOG1, FL("SME_REMOVEKEY_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002084 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2085
2086 if (len < (tANI_S16) sizeof(tANI_U32))
2087 return eSIR_FAILURE;
2088
2089 len -= sizeof(tANI_U32); // skip message header
2090 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2091 return eSIR_FAILURE;
2092
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302093 vos_mem_copy( (tANI_U8 *) pRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002094 pBuf, sizeof(tSirMacAddr));
2095 pBuf += sizeof(tSirMacAddr);
2096 len -= sizeof(tSirMacAddr);
2097 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2098 return eSIR_FAILURE;
2099
Jeff Johnson295189b2012-06-20 16:38:30 -07002100
2101 pRemoveKeyReq->edType = *pBuf;
2102 pBuf += sizeof(tANI_U8);
2103 len -= sizeof(tANI_U8);
2104 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2105 return eSIR_FAILURE;
2106
2107 pRemoveKeyReq->wepType = *pBuf;
2108
2109 pBuf += sizeof(tANI_U8);
2110 len -= sizeof(tANI_U8);
2111 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2112 return eSIR_FAILURE;
2113
2114 pRemoveKeyReq->keyId = *pBuf;
2115
2116 pBuf += sizeof(tANI_U8);
2117 len -= sizeof(tANI_U8);
2118 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2119 return eSIR_FAILURE;
2120
2121 pRemoveKeyReq->unicast = *pBuf;
2122 len--;
2123 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2124 return eSIR_FAILURE;
2125
2126 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302127 vos_mem_copy( pRemoveKeyReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002128 pBuf += sizeof(tSirMacAddr);
2129 len -= sizeof(tSirMacAddr);
2130 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2131 return eSIR_FAILURE;
2132
2133 // Extract sessionId
2134 pRemoveKeyReq->sessionId = *pBuf++;
2135 len--;
2136 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2137 return eSIR_FAILURE;
2138
2139 // Extract transactionId
2140 pRemoveKeyReq->transactionId = sirReadU16N(pBuf);
2141 pBuf += sizeof(tANI_U16);
2142 len -= sizeof(tANI_U16);
2143 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2144 return eSIR_FAILURE;
2145
2146 return eSIR_SUCCESS;
2147} /*** end limRemoveKeyReqSerDes() ***/
2148
2149
2150
2151/**
2152 * limDisassocReqSerDes()
2153 *
2154 *FUNCTION:
2155 * This function is called by limProcessSmeMessages() upon receiving
2156 * SME_DISASSOC_REQ from host
2157 *
2158 *PARAMS:
2159 *
2160 *LOGIC:
2161 *
2162 *ASSUMPTIONS:
2163 * NA
2164 *
2165 *NOTE:
2166 * NA
2167 *
2168 * @param pDisassocReq Pointer to tSirSmeDisassocReq being extracted
2169 * @param pBuf Pointer to serialized buffer
2170 *
2171 * @return retCode Indicates whether message is successfully
2172 * de-serialized (eSIR_SUCCESS) or
2173 * not (eSIR_FAILURE)
2174 */
2175
2176tSirRetStatus
2177limDisassocReqSerDes(tpAniSirGlobal pMac, tSirSmeDisassocReq *pDisassocReq, tANI_U8 *pBuf)
2178{
2179 tANI_S16 len = 0;
2180#ifdef PE_DEBUG_LOG1
2181 tANI_U8 *pTemp = pBuf;
2182#endif
2183
2184 if (!pDisassocReq || !pBuf)
2185 return eSIR_FAILURE;
2186
2187 pDisassocReq->messageType = limGetU16(pBuf);
2188 pBuf += sizeof(tANI_U16);
2189
2190 len = pDisassocReq->length = limGetU16(pBuf);
2191 pBuf += sizeof(tANI_U16);
2192
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002193 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002194 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2195
2196 if (len < (tANI_S16) sizeof(tANI_U32))
2197 return eSIR_FAILURE;
2198
2199 len -= sizeof(tANI_U32); // skip message header
2200 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2201 return eSIR_FAILURE;
2202
2203 // Extract sessionID
2204 pDisassocReq->sessionId = *pBuf;
2205 pBuf += sizeof(tANI_U8);
2206 len -= sizeof(tANI_U8);
2207 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2208 return eSIR_FAILURE;
2209
2210 // Extract transactionid
2211 pDisassocReq->transactionId = limGetU16(pBuf);
2212 pBuf += sizeof(tANI_U16);
2213 len -= sizeof(tANI_U16);
2214 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2215 return eSIR_FAILURE;
2216
2217 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302218 vos_mem_copy( (tANI_U8 *) pDisassocReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002219 pBuf += sizeof(tSirMacAddr);
2220 len -= sizeof(tSirMacAddr);
2221 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2222 return eSIR_FAILURE;
2223
2224 // Extract peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302225 vos_mem_copy( pDisassocReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002226 pBuf += sizeof(tSirMacAddr);
2227 len -= sizeof(tSirMacAddr);
2228 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2229 return eSIR_FAILURE;
2230
2231 // Extract reasonCode
2232 pDisassocReq->reasonCode = limGetU16(pBuf);
2233 pBuf += sizeof(tANI_U16);
2234 len -= sizeof(tANI_U16);
2235 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2236 return eSIR_FAILURE;
2237
2238 pDisassocReq->doNotSendOverTheAir = *pBuf;
2239 pBuf += sizeof(tANI_U8);
2240 len -= sizeof(tANI_U8);
2241
Jeff Johnson295189b2012-06-20 16:38:30 -07002242
2243 return eSIR_SUCCESS;
2244} /*** end limDisassocReqSerDes() ***/
2245
2246
2247
2248/**
2249 * limDeauthReqSerDes()
2250 *
2251 *FUNCTION:
2252 * This function is called by limProcessSmeMessages() upon receiving
2253 * SME_DEAUTH_REQ from host
2254 *
2255 *PARAMS:
2256 *
2257 *LOGIC:
2258 *
2259 *ASSUMPTIONS:
2260 * NA
2261 *
2262 *NOTE:
2263 * NA
2264 *
2265 * @param pDeauthReq Pointer to tSirSmeDeauthReq being extracted
2266 * @param pBuf Pointer to serialized buffer
2267 *
2268 * @return retCode Indicates whether message is successfully
2269 * de-serialized (eSIR_SUCCESS) or
2270 * not (eSIR_FAILURE)
2271 */
2272tSirRetStatus
2273limDeauthReqSerDes(tpAniSirGlobal pMac, tSirSmeDeauthReq *pDeauthReq, tANI_U8 *pBuf)
2274{
2275 tANI_S16 len = 0;
2276
2277#ifdef PE_DEBUG_LOG1
2278 tANI_U8 *pTemp = pBuf;
2279#endif
2280
2281 if (!pDeauthReq || !pBuf)
2282 return eSIR_FAILURE;
2283
2284 pDeauthReq->messageType = limGetU16(pBuf);
2285 pBuf += sizeof(tANI_U16);
2286
2287 len = pDeauthReq->length = limGetU16(pBuf);
2288 pBuf += sizeof(tANI_U16);
2289
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002290 PELOG1(limLog(pMac, LOG1, FL("SME_DEAUTH_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002291 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2292
2293 if (len < (tANI_S16) sizeof(tANI_U32))
2294 return eSIR_FAILURE;
2295
2296 len -= sizeof(tANI_U32); // skip message header
2297 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2298 return eSIR_FAILURE;
2299
2300 // Extract sessionId
2301 pDeauthReq->sessionId = *pBuf++;
2302 len--;
2303 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2304 return eSIR_FAILURE;
2305
2306 // Extract transactionId
2307 pDeauthReq->transactionId = limGetU16(pBuf);
2308 pBuf += sizeof(tANI_U16);
2309 len -= sizeof(tANI_U16);
2310 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2311 return eSIR_FAILURE;
2312
2313 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302314 vos_mem_copy( pDeauthReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002315 pBuf += sizeof(tSirMacAddr);
2316 len -= sizeof(tSirMacAddr);
2317 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2318 return eSIR_FAILURE;
2319
2320 // Extract peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302321 vos_mem_copy( pDeauthReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002322 pBuf += sizeof(tSirMacAddr);
2323 len -= sizeof(tSirMacAddr);
2324 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2325 return eSIR_FAILURE;
2326
2327 // Extract reasonCode
2328 pDeauthReq->reasonCode = limGetU16(pBuf);
2329 pBuf += sizeof(tANI_U16);
2330 len -= sizeof(tANI_U16);
2331
Jeff Johnson295189b2012-06-20 16:38:30 -07002332
2333 return eSIR_SUCCESS;
2334} /*** end limDisassocReqSerDes() ***/
2335
2336
2337
2338
Jeff Johnson295189b2012-06-20 16:38:30 -07002339
2340
2341/**
2342 * limStatSerDes()
2343 *
2344 *FUNCTION:
2345 * This function is called by limSendSmeDisassocNtf() while sending
2346 * SME_DISASSOC_IND/eWNI_SME_DISASSOC_RSP to host
2347 *
2348 *PARAMS:
2349 *
2350 *LOGIC:
2351 *
2352 *ASSUMPTIONS:
2353 * NA
2354 *
2355 *NOTE:
2356 * NA
2357 *
2358 * @param pAssocInd Pointer to tpAniStaStatStruct being sent
2359 * @param pBuf Pointer to serialized buffer
2360 *
2361 * @return None
2362 */
2363
2364void
2365limStatSerDes(tpAniSirGlobal pMac, tpAniStaStatStruct pStat, tANI_U8 *pBuf)
2366{
2367#ifdef PE_DEBUG_LOG1
2368 tANI_U8 *pTemp = pBuf;
2369#endif
2370
2371 limCopyU32(pBuf, pStat->sentAesBlksUcastHi);
2372 pBuf += sizeof(tANI_U32);
2373
2374 limCopyU32(pBuf, pStat->sentAesBlksUcastLo);
2375 pBuf += sizeof(tANI_U32);
2376
2377 limCopyU32(pBuf, pStat->recvAesBlksUcastHi);
2378 pBuf += sizeof(tANI_U32);
2379
2380 limCopyU32(pBuf, pStat->recvAesBlksUcastLo);
2381 pBuf += sizeof(tANI_U32);
2382
2383 limCopyU32(pBuf, pStat->aesFormatErrorUcastCnts);
2384 pBuf += sizeof(tANI_U32);
2385
2386 limCopyU32(pBuf, pStat->aesReplaysUcast);
2387 pBuf += sizeof(tANI_U32);
2388
2389 limCopyU32(pBuf, pStat->aesDecryptErrUcast);
2390 pBuf += sizeof(tANI_U32);
2391
2392 limCopyU32(pBuf, pStat->singleRetryPkts);
2393 pBuf += sizeof(tANI_U32);
2394
2395 limCopyU32(pBuf, pStat->failedTxPkts);
2396 pBuf += sizeof(tANI_U32);
2397
2398 limCopyU32(pBuf, pStat->ackTimeouts);
2399 pBuf += sizeof(tANI_U32);
2400
2401 limCopyU32(pBuf, pStat->multiRetryPkts);
2402 pBuf += sizeof(tANI_U32);
2403
2404 limCopyU32(pBuf, pStat->fragTxCntsHi);
2405 pBuf += sizeof(tANI_U32);
2406
2407 limCopyU32(pBuf, pStat->fragTxCntsLo);
2408 pBuf += sizeof(tANI_U32);
2409
2410 limCopyU32(pBuf, pStat->transmittedPktsHi);
2411 pBuf += sizeof(tANI_U32);
2412
2413 limCopyU32(pBuf, pStat->transmittedPktsLo);
2414 pBuf += sizeof(tANI_U32);
2415
2416 limCopyU32(pBuf, pStat->phyStatHi);
2417 pBuf += sizeof(tANI_U32);
2418
2419 limCopyU32(pBuf, pStat->phyStatLo);
2420 pBuf += sizeof(tANI_U32);
2421
2422 limCopyU32(pBuf, pStat->uplinkRssi);
2423 pBuf += sizeof(tANI_U32);
2424
2425 limCopyU32(pBuf, pStat->uplinkSinr);
2426 pBuf += sizeof(tANI_U32);
2427
2428 limCopyU32(pBuf, pStat->uplinkRate);
2429 pBuf += sizeof(tANI_U32);
2430
2431 limCopyU32(pBuf, pStat->downlinkRssi);
2432 pBuf += sizeof(tANI_U32);
2433
2434 limCopyU32(pBuf, pStat->downlinkSinr);
2435 pBuf += sizeof(tANI_U32);
2436
2437 limCopyU32(pBuf, pStat->downlinkRate);
2438 pBuf += sizeof(tANI_U32);
2439
2440 limCopyU32(pBuf, pStat->nRcvBytes);
2441 pBuf += sizeof(tANI_U32);
2442
2443 limCopyU32(pBuf, pStat->nXmitBytes);
2444 pBuf += sizeof(tANI_U32);
2445
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002446 PELOG1(limLog(pMac, LOG1, FL("STAT: length %d bytes is:"), sizeof(tAniStaStatStruct));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002447 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, sizeof(tAniStaStatStruct));)
2448
2449} /*** end limStatSerDes() ***/
2450
2451
Jeff Johnson295189b2012-06-20 16:38:30 -07002452
2453
2454/**
2455 * limPackBkgndScanFailNotify()
2456 *
2457 *FUNCTION:
2458 * This function is called by limSendSmeWmStatusChangeNtf()
2459 * to pack the tSirBackgroundScanInfo message
2460 *
2461 */
2462void
2463limPackBkgndScanFailNotify(tpAniSirGlobal pMac,
2464 tSirSmeStatusChangeCode statusChangeCode,
2465 tpSirBackgroundScanInfo pScanInfo,
2466 tSirSmeWmStatusChangeNtf *pSmeNtf,
2467 tANI_U8 sessionId)
2468{
2469
2470 tANI_U16 length = (sizeof(tANI_U16) * 2) + sizeof(tANI_U8) +
2471 sizeof(tSirSmeStatusChangeCode) +
2472 sizeof(tSirBackgroundScanInfo);
2473
Jeff Johnson295189b2012-06-20 16:38:30 -07002474 pSmeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
2475 pSmeNtf->statusChangeCode = statusChangeCode;
2476 pSmeNtf->length = length;
2477 pSmeNtf->sessionId = sessionId;
2478 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanSuccess = pScanInfo->numOfScanSuccess;
2479 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanFailure = pScanInfo->numOfScanFailure;
2480 pSmeNtf->statusChangeInfo.bkgndScanInfo.reserved = pScanInfo->reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07002481}
2482
Jeff Johnson295189b2012-06-20 16:38:30 -07002483
Jeff Johnson295189b2012-06-20 16:38:30 -07002484/**
2485 * limIsSmeGetAssocSTAsReqValid()
2486 *
2487 *FUNCTION:
2488 * This function is called by limProcessSmeReqMessages() upon
2489 * receiving SME_GET_ASSOC_STAS_REQ message from application.
2490 *
2491 *LOGIC:
2492 * Message validity checks are performed in this function
2493 *
2494 *ASSUMPTIONS:
2495 *
2496 *NOTE:
2497 *
2498 * @param pBuf - Pointer to a serialized SME_GET_ASSOC_STAS_REQ message
2499 * @param pSmeMsg - Pointer to a tSirSmeGetAssocSTAsReq structure
2500 * @return true if SME_GET_ASSOC_STAS_REQ message is formatted correctly
2501 * false otherwise
2502 */
2503tANI_BOOLEAN
2504limIsSmeGetAssocSTAsReqValid(tpAniSirGlobal pMac, tpSirSmeGetAssocSTAsReq pGetAssocSTAsReq, tANI_U8 *pBuf)
2505{
2506 tANI_S16 len = 0;
2507
2508 pGetAssocSTAsReq->messageType = limGetU16(pBuf);
2509 pBuf += sizeof(tANI_U16);
2510
2511 len = pGetAssocSTAsReq->length = limGetU16(pBuf);
2512 pBuf += sizeof(tANI_U16);
2513
2514 if (len < (tANI_S16) sizeof(tANI_U32))
Girish Gowliafd42312014-07-24 13:13:59 +05302515 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002516
2517 len -= sizeof(tANI_U32); // skip message header
2518 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Girish Gowliafd42312014-07-24 13:13:59 +05302519 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002520
2521 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302522 vos_mem_copy( (tANI_U8 *) pGetAssocSTAsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002523 pBuf += sizeof(tSirMacAddr);
2524 len -= sizeof(tSirMacAddr);
2525 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Girish Gowliafd42312014-07-24 13:13:59 +05302526 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002527
2528 // Extract modId
2529 pGetAssocSTAsReq->modId = limGetU16(pBuf);
2530 pBuf += sizeof(tANI_U16);
2531 len -= sizeof(tANI_U16);
2532 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Girish Gowliafd42312014-07-24 13:13:59 +05302533 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002534
2535 // Extract pUsrContext
krunal soni4f802b22014-02-11 17:01:13 -08002536 vos_mem_copy((tANI_U8 *)pGetAssocSTAsReq->pUsrContext, pBuf, sizeof(void*));
2537 pBuf += sizeof(void*);
2538 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002539 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Girish Gowliafd42312014-07-24 13:13:59 +05302540 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002541
2542 // Extract pSapEventCallback
krunal soni4f802b22014-02-11 17:01:13 -08002543 vos_mem_copy((tANI_U8 *)pGetAssocSTAsReq->pSapEventCallback, pBuf, sizeof(void*));
2544 pBuf += sizeof(void*);
2545 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002546 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Girish Gowliafd42312014-07-24 13:13:59 +05302547 return eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002548
2549 // Extract pAssocStasArray
krunal soni4f802b22014-02-11 17:01:13 -08002550 vos_mem_copy((tANI_U8 *)pGetAssocSTAsReq->pAssocStasArray, pBuf, sizeof(void*));
2551 pBuf += sizeof(void*);
2552 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002553
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002554 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002555
2556 if (len < 0)
2557 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002558 PELOGE(limLog(pMac, LOGE, FL("SME_GET_ASSOC_STAS_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002559 return eANI_BOOLEAN_FALSE;
2560 }
2561
2562 return eANI_BOOLEAN_TRUE;
2563}
2564
2565/**
2566 * limTkipCntrMeasReqSerDes()
2567 *
2568 *FUNCTION:
2569 * This function is called by limProcessSmeMessages() upon receiving
2570 * eWNI_SME_TKIP_CNTR_MEAS_REQ from host HDD
2571 *
2572 *PARAMS:
2573 *
2574 *LOGIC:
2575 *
2576 *ASSUMPTIONS:
2577 * NA
2578 *
2579 *NOTE:
2580 * NA
2581 *
2582 * @param tpSirSmeTkipCntrMeasReq Pointer to tSirSmeTkipCntrMeasReq being extracted
2583 * @param pBuf Pointer to serialized buffer
2584 * @return retCode Indicates whether message is successfully
2585 * de-serialized (eSIR_SUCCESS) or
2586 * not (eSIR_FAILURE)
2587 */
2588tSirRetStatus
2589limTkipCntrMeasReqSerDes(tpAniSirGlobal pMac, tpSirSmeTkipCntrMeasReq pTkipCntrMeasReq, tANI_U8 *pBuf)
2590{
2591 tANI_S16 len = 0;
2592
2593#ifdef PE_DEBUG_LOG1
2594 tANI_U8 *pTemp = pBuf;
2595#endif
2596
2597 pTkipCntrMeasReq->messageType = limGetU16(pBuf);
2598 pBuf += sizeof(tANI_U16);
2599
2600 len = pTkipCntrMeasReq->length = limGetU16(pBuf);
2601 pBuf += sizeof(tANI_U16);
2602
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002603 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002604 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2605
2606 if (len < (tANI_S16) sizeof(tANI_U32))
2607 return eSIR_FAILURE;
2608
2609 len -= sizeof(tANI_U32); // skip message header
2610 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2611 return eSIR_FAILURE;
2612
2613 // Extract sessionId
2614 pTkipCntrMeasReq->sessionId = *pBuf++;
2615 len--;
2616 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2617 return eSIR_FAILURE;
2618
2619 // Extract transactionId
2620 pTkipCntrMeasReq->transactionId = limGetU16(pBuf);
2621 pBuf += sizeof(tANI_U16);
2622 len -= sizeof(tANI_U16);
2623 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2624 return eSIR_FAILURE;
2625
2626 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302627 vos_mem_copy( (tANI_U8 *) pTkipCntrMeasReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002628 pBuf += sizeof(tSirMacAddr);
2629 len -= sizeof(tSirMacAddr);
2630 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2631 return eSIR_FAILURE;
2632
2633 // Extract bEnable
2634 pTkipCntrMeasReq->bEnable = *pBuf++;
2635 len --;
2636
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002637 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002638
2639 if (len)
2640 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002641 PELOGE(limLog(pMac, LOGE, FL("SME_TKIP_CNTR_MEAS_REQ invalid "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002642 return eSIR_FAILURE;
2643 }
2644 else
2645 return eSIR_SUCCESS;
2646}
2647
2648/**
2649 * limIsSmeGetWPSPBCSessionsReqValid()
2650 *
2651 *FUNCTION:
2652 * This function is called by limProcessSmeGetWPSPBCSessions() upon
2653 * receiving query WPS PBC overlap information message from application.
2654 *
2655 *LOGIC:
2656 * Message validity checks are performed in this function
2657 *
2658 *ASSUMPTIONS:
2659 *
2660 *NOTE:
2661 *
2662 * @param pBuf - Pointer to a serialized SME_GET_WPSPBC_SESSION_REQ message
2663 * @param pGetWPSPBCSessionsReq - Pointer to a tSirSmeGetWPSPBCSessionsReq structure
2664 * @return true if SME_GET_WPSPBC_SESSION_REQ message is formatted correctly
2665 * false otherwise
2666 */
2667
2668tSirRetStatus
2669limIsSmeGetWPSPBCSessionsReqValid(tpAniSirGlobal pMac, tSirSmeGetWPSPBCSessionsReq *pGetWPSPBCSessionsReq, tANI_U8 *pBuf)
2670{
2671 tANI_S16 len = 0;
2672
2673 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirSmeGetWPSPBCSessionsReq));)
2674
2675 pGetWPSPBCSessionsReq->messageType = limGetU16(pBuf);
2676 pBuf += sizeof(tANI_U16);
2677
2678 len = pGetWPSPBCSessionsReq->length = limGetU16(pBuf);
2679 pBuf += sizeof(tANI_U16);
2680
2681 if (len < (tANI_S16) sizeof(tANI_U32))
2682 return eSIR_FAILURE;
2683
2684 len -= sizeof(tANI_U32); // skip message header
2685 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2686 return eSIR_FAILURE;
2687
2688 // Extract pUsrContext
krunal soni4f802b22014-02-11 17:01:13 -08002689 vos_mem_copy((tANI_U8 *)pGetWPSPBCSessionsReq->pUsrContext, pBuf, sizeof(void*));
2690 pBuf += sizeof(void*);
2691 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002692 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2693 return eSIR_FAILURE;
2694
2695 // Extract pSapEventCallback
krunal soni4f802b22014-02-11 17:01:13 -08002696 vos_mem_copy((tANI_U8 *)pGetWPSPBCSessionsReq->pSapEventCallback, pBuf, sizeof(void*));
2697 pBuf += sizeof(void*);
2698 len -= sizeof(void*);
Jeff Johnson295189b2012-06-20 16:38:30 -07002699 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2700 return eSIR_FAILURE;
2701
2702 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302703 vos_mem_copy( (tANI_U8 *) pGetWPSPBCSessionsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002704 pBuf += sizeof(tSirMacAddr);
2705 len -= sizeof(tSirMacAddr);
2706
2707 // Extract MAC address of Station to be removed
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302708 vos_mem_copy( (tANI_U8 *) pGetWPSPBCSessionsReq->pRemoveMac, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002709 pBuf += sizeof(tSirMacAddr);
2710 len -= sizeof(tSirMacAddr);
2711
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002712 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002713
2714 if (len < 0)
2715 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002716 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002717 return eSIR_FAILURE;
2718 }
2719
2720 return eSIR_SUCCESS;
2721}
2722
Jeff Johnson295189b2012-06-20 16:38:30 -07002723
2724/**---------------------------------------------------------------
2725\fn limGetSessionInfo
2726\brief This function returns the sessionId and transactionId
2727\ of a message. This assumes that the message structure
2728\ is of format:
2729\ tANI_U16 messageType
2730\ tANI_U16 messageLength
2731\ tANI_U8 sessionId
2732\ tANI_U16 transactionId
2733\param pMac - pMac global structure
2734\param *pBuf - pointer to the message buffer
2735\param sessionId - returned session id value
2736\param transactionId - returned transaction ID value
2737\return None
2738------------------------------------------------------------------*/
2739void
2740limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U8 *sessionId, tANI_U16 *transactionId)
2741{
2742 if (!pBuf)
2743 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002744 limLog(pMac, LOGE, FL("NULL ptr received. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002745 return;
2746 }
2747
2748 pBuf += sizeof(tANI_U16); // skip message type
2749 pBuf += sizeof(tANI_U16); // skip message length
2750
2751 *sessionId = *pBuf; // get sessionId
2752 pBuf++;
2753 *transactionId = limGetU16(pBuf); // get transactionId
2754
2755 return;
2756}
2757
Jeff Johnson295189b2012-06-20 16:38:30 -07002758
2759/**
2760 * limUpdateAPWPSIEsReqSerDes()
2761 *
2762 *FUNCTION:
2763 * This function is to deserialize UpdateAPWPSIEs message
2764 *
2765 *PARAMS:
2766 *
2767 *LOGIC:
2768 *
2769 *ASSUMPTIONS:
2770 * NA
2771 *
2772 *NOTE:
2773 * NA
2774 *
2775 * @param pUpdateAPWPSIEsReq Pointer to tSirUpdateAPWPSIEsReq being
2776 * extracted
2777 * @param pBuf Pointer to serialized buffer
2778 *
2779 * @return retCode Indicates whether message is successfully
2780 * de-serialized (eSIR_SUCCESS) or
2781 * not (eSIR_FAILURE)
2782 */
2783
2784tSirRetStatus
2785limUpdateAPWPSIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq, tANI_U8 *pBuf)
2786{
2787 tANI_S16 len = 0;
2788
2789 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPSIEsReq));)
2790
2791 if (!pUpdateAPWPSIEsReq || !pBuf)
2792 return eSIR_FAILURE;
2793
2794 pUpdateAPWPSIEsReq->messageType = limGetU16(pBuf);
2795 pBuf += sizeof(tANI_U16);
2796
2797 len = pUpdateAPWPSIEsReq->length = limGetU16(pBuf);
2798 pBuf += sizeof(tANI_U16);
2799
2800 if (len < (tANI_S16) sizeof(tANI_U32))
2801 return eSIR_FAILURE;
2802
2803 len -= sizeof(tANI_U32); // skip message header
2804 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2805 return eSIR_FAILURE;
2806
2807 // Extract transactionId
2808 pUpdateAPWPSIEsReq->transactionId = limGetU16( pBuf );
2809 pBuf += sizeof( tANI_U16 );
2810 len -= sizeof( tANI_U16 );
2811 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2812 return eSIR_FAILURE;
2813
2814 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302815 vos_mem_copy( (tANI_U8 *) pUpdateAPWPSIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002816 pBuf += sizeof(tSirMacAddr);
2817 len -= sizeof(tSirMacAddr);
2818 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2819 return eSIR_FAILURE;
2820
2821 // Extract sessionId
2822 pUpdateAPWPSIEsReq->sessionId = *pBuf++;
2823 len--;
2824 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2825 return eSIR_FAILURE;
2826
2827 // Extract APWPSIEs
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302828 vos_mem_copy( (tSirAPWPSIEs *) &pUpdateAPWPSIEsReq->APWPSIEs, pBuf, sizeof(tSirAPWPSIEs));
Jeff Johnson295189b2012-06-20 16:38:30 -07002829 pBuf += sizeof(tSirAPWPSIEs);
2830 len -= sizeof(tSirAPWPSIEs);
2831
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002832 PELOG1(limLog(pMac, LOG1, FL("SME_UPDATE_APWPSIE_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002833
2834 if (len < 0)
2835 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002836 PELOGE(limLog(pMac, LOGE, FL("SME_UPDATE_APWPSIE_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002837 return eSIR_FAILURE;
2838 }
2839
2840 return eSIR_SUCCESS;
2841} /*** end limSetContextReqSerDes() ***/
2842
2843/**
2844 * limUpdateAPWPARSNIEsReqSerDes ()
2845 *
2846 *FUNCTION:
2847 * This function is to deserialize UpdateAPWPSIEs message
2848 *
2849 *PARAMS:
2850 *
2851 *LOGIC:
2852 *
2853 *ASSUMPTIONS:
2854 * NA
2855 *
2856 *NOTE:
2857 * NA
2858 *
2859 * @param pUpdateAPWPARSNIEsReq Pointer to tpSirUpdateAPWPARSNIEsReq being
2860 * extracted
2861 * @param pBuf Pointer to serialized buffer
2862 *
2863 * @return retCode Indicates whether message is successfully
2864 * de-serialized (eSIR_SUCCESS) or
2865 * not (eSIR_FAILURE)
2866 */
2867
2868tSirRetStatus
2869limUpdateAPWPARSNIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq, tANI_U8 *pBuf)
2870{
2871 tANI_S16 len = 0;
2872
2873 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPARSNIEsReq));)
2874
2875 if (!pUpdateAPWPARSNIEsReq || !pBuf)
2876 return eSIR_FAILURE;
2877
2878 pUpdateAPWPARSNIEsReq->messageType = limGetU16(pBuf);
2879 pBuf += sizeof(tANI_U16);
2880
2881 len = pUpdateAPWPARSNIEsReq->length = limGetU16(pBuf);
2882 pBuf += sizeof(tANI_U16);
2883
2884 if (len < (tANI_S16) sizeof(tANI_U32))
2885 return eSIR_FAILURE;
2886
2887 len -= sizeof(tANI_U32); // skip message header
2888 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2889 return eSIR_FAILURE;
2890
2891 // Extract transactionId
2892 pUpdateAPWPARSNIEsReq->transactionId = limGetU16( pBuf );
2893 pBuf += sizeof(tANI_U16);
2894 len -= sizeof( tANI_U16 );
2895 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2896 return eSIR_FAILURE;
2897
2898 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302899 vos_mem_copy( (tANI_U8 *) pUpdateAPWPARSNIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002900 pBuf += sizeof(tSirMacAddr);
2901 len -= sizeof(tSirMacAddr);
2902 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2903 return eSIR_FAILURE;
2904
2905 // Extract sessionId
2906 pUpdateAPWPARSNIEsReq->sessionId = *pBuf++;
2907 len--;
2908 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2909 return eSIR_FAILURE;
2910
2911 // Extract APWPARSNIEs
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302912 vos_mem_copy( (tSirRSNie *) &pUpdateAPWPARSNIEsReq->APWPARSNIEs, pBuf, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07002913 pBuf += sizeof(tSirRSNie);
2914 len -= sizeof(tSirRSNie);
2915
2916 if (len < 0)
2917 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002918 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002919 return eSIR_FAILURE;
2920 }
2921
2922 return eSIR_SUCCESS;
2923} /*** end limUpdateAPWPARSNIEsReqSerDes() ***/
2924