blob: 5a6d313c715914e95c79ae092cc72e51b1ef5b09 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42/*
43 * Airgo Networks, Inc proprietary. All rights reserved.
44 *
45 * This file limSerDesUtils.cc contains the serializer/deserializer
46 * utility functions LIM uses while communicating with upper layer
47 * software entities
48 * Author: Chandra Modumudi
49 * Date: 10/20/02
50 * History:-
51 * Date Modified by Modification Information
52 * --------------------------------------------------------------------
53 */
54
55#include "aniSystemDefs.h"
56#include "utilsApi.h"
57#include "limTypes.h"
58#include "limUtils.h"
59#include "limSerDesUtils.h"
60
61
62
63/**
64 * limCheckRemainingLength()
65 *
66 *FUNCTION:
67 * This function is called while de-serializing received SME_REQ
68 * message.
69 *
70 *LOGIC:
71 * Remaining message length is checked for > 0.
72 *
73 *ASSUMPTIONS:
74 * NA
75 *
76 *NOTE:
77 * NA
78 *
79 * @param len - Remaining message length
80 * @return retCode - eSIR_SUCCESS if len > 0, else eSIR_FAILURE
81 */
82
83static inline tSirRetStatus
84limCheckRemainingLength(tpAniSirGlobal pMac, tANI_S16 len)
85{
86 if (len > 0)
87 return eSIR_SUCCESS;
88 else
89 {
90 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -070091 FL("Received SME message with invalid rem length=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -070092 len);
93 return eSIR_FAILURE;
94 }
95} /*** end limCheckRemainingLength(pMac, ) ***/
96
Jeff Johnson295189b2012-06-20 16:38:30 -070097/**
98 * limGetBssDescription()
99 *
100 *FUNCTION:
101 * This function is called by various LIM functions to copy
102 * BSS description from a tANI_U8* buffer pointer to tSirBssDescription
103 *
104 *LOGIC:
105 *
106 *ASSUMPTIONS:
107 * NA
108 *
109 *NOTE:
110 * NA
111 *
112 * @param pBssDescription Pointer to the BssDescription to be copied
113 * @param *pBuf Pointer to the source buffer
114 * @param rLen Remaining message length being extracted
115 * @return retCode Indicates whether message is successfully
116 * de-serialized (eSIR_SUCCESS) or
117 * failure (eSIR_FAILURE).
118 */
119
120static tSirRetStatus
121limGetBssDescription( tpAniSirGlobal pMac, tSirBssDescription *pBssDescription,
122 tANI_S16 rLen, tANI_S16 *lenUsed, tANI_U8 *pBuf)
123{
Madan Mohan Koyyalamudic62057b2012-10-30 18:31:54 -0700124 tANI_S16 len = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700125
126 pBssDescription->length = limGetU16(pBuf);
127 pBuf += sizeof(tANI_U16);
128 len = pBssDescription->length;
129
130 if (rLen < (tANI_S16) (len + sizeof(tANI_U16)))
131 return eSIR_FAILURE;
132
133 *lenUsed = len + sizeof(tANI_U16);
134
135 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530136 vos_mem_copy( (tANI_U8 *) pBssDescription->bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700137 pBuf, sizeof(tSirMacAddr));
138 pBuf += sizeof(tSirMacAddr);
139 len -= sizeof(tSirMacAddr);
140 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
141 return eSIR_FAILURE;
142
143 // Extract timer
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530144 vos_mem_copy( (tANI_U8 *) (&pBssDescription->scanSysTimeMsec),
Jeff Johnson295189b2012-06-20 16:38:30 -0700145 pBuf, sizeof(v_TIME_t));
146 pBuf += sizeof(v_TIME_t);
147 len -= sizeof(v_TIME_t);
148 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
149 return eSIR_FAILURE;
150
151 // Extract timeStamp
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530152 vos_mem_copy( (tANI_U8 *) pBssDescription->timeStamp,
Jeff Johnson295189b2012-06-20 16:38:30 -0700153 pBuf, sizeof(tSirMacTimeStamp));
154 pBuf += sizeof(tSirMacTimeStamp);
155 len -= sizeof(tSirMacTimeStamp);
156 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
157 return eSIR_FAILURE;
158
159 // Extract beaconInterval
160 pBssDescription->beaconInterval = limGetU16(pBuf);
161 pBuf += sizeof(tANI_U16);
162 len -= sizeof(tANI_U16);
163 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
164 return eSIR_FAILURE;
165
166 // Extract capabilityInfo
167 pBssDescription->capabilityInfo = limGetU16(pBuf);
168 pBuf += sizeof(tANI_U16);
169 len -= sizeof(tANI_U16);
170 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
171 return eSIR_FAILURE;
172
173 // Extract nwType
174 pBssDescription->nwType = (tSirNwType) limGetU32(pBuf);
175 pBuf += sizeof(tSirNwType);
176 len -= sizeof(tSirNwType);
177 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
178 return eSIR_FAILURE;
179
180 // Extract aniIndicator
181 pBssDescription->aniIndicator = *pBuf++;
182 len --;
183
184 // Extract rssi
185 pBssDescription->rssi = (tANI_S8) *pBuf++;
186 len --;
187
188 // Extract sinr
189 pBssDescription->sinr = (tANI_S8) *pBuf++;
190 len --;
191
192 // Extract channelId
193 pBssDescription->channelId = *pBuf++;
194 len --;
195
196 // Extract channelIdSelf
197 pBssDescription->channelIdSelf = *pBuf++;
198 len --;
199 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
200 return eSIR_FAILURE;
201
202 // Extract reserved bssDescription
203 pBuf += sizeof(pBssDescription->sSirBssDescriptionRsvd);
204 len -= sizeof(pBssDescription->sSirBssDescriptionRsvd);
205 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
206 return eSIR_FAILURE;
207
Jeff Johnson295189b2012-06-20 16:38:30 -0700208 //pass the timestamp
209 pBssDescription->nReceivedTime = limGetU32( pBuf );
210 pBuf += sizeof(tANI_TIMESTAMP);
211 len -= sizeof(tANI_TIMESTAMP);
212
213#if defined WLAN_FEATURE_VOWIFI
214 //TSF when the beacon received (parent TSF)
215 pBssDescription->parentTSF = limGetU32( pBuf );
216 pBuf += sizeof(tANI_U32);
217 len -= sizeof(tANI_U32);
218
219 //start TSF of scan during which this BSS desc was updated.
220 pBssDescription->startTSF[0] = limGetU32( pBuf );
221 pBuf += sizeof(tANI_U32);
222 len -= sizeof(tANI_U32);
223
224 //start TSF of scan during which this BSS desc was updated.
225 pBssDescription->startTSF[1] = limGetU32( pBuf );
226 pBuf += sizeof(tANI_U32);
227 len -= sizeof(tANI_U32);
228#endif
229#ifdef WLAN_FEATURE_VOWIFI_11R
230 // MobilityDomain
231 pBssDescription->mdiePresent = *pBuf++;
232 len --;
233 pBssDescription->mdie[0] = *pBuf++;
234 len --;
235 pBssDescription->mdie[1] = *pBuf++;
236 len --;
237 pBssDescription->mdie[2] = *pBuf++;
238 len --;
239#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700240 PELOGE(limLog(pMac, LOG1, FL("mdie=%02x %02x %02x"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700241 pBssDescription->mdie[0],
242 pBssDescription->mdie[1],
243 pBssDescription->mdie[2]);)
244#endif
245#endif
246
247#ifdef FEATURE_WLAN_CCX
248 pBssDescription->QBSSLoad_present = limGetU16(pBuf);
249 pBuf += sizeof(tANI_U16);
250 len -= sizeof(tANI_U16);
251 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
252 return eSIR_FAILURE;
253
254 // Extract QBSSLoad_avail
255 pBssDescription->QBSSLoad_avail = limGetU16(pBuf);
256 pBuf += sizeof(tANI_U16);
257 len -= sizeof(tANI_U16);
258 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
259 return eSIR_FAILURE;
260#endif
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -0700261 pBssDescription->fProbeRsp = *pBuf++;
262 len -= sizeof(tANI_U8);
263 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
264 return eSIR_FAILURE;
265
Madan Mohan Koyyalamudi2a6ba242012-10-31 17:06:19 -0700266 /* 3 reserved bytes for padding */
267 pBuf += (3 * sizeof(tANI_U8));
268 len -= 3;
269
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -0700270 pBssDescription->WscIeLen = limGetU32( pBuf );
271 pBuf += sizeof(tANI_U32);
272 len -= sizeof(tANI_U32);
273 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
274 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700275
Madan Mohan Koyyalamudi2a6ba242012-10-31 17:06:19 -0700276 if (WSCIE_PROBE_RSP_LEN < len)
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 {
Madan Mohan Koyyalamudi2a6ba242012-10-31 17:06:19 -0700278 /* Do not copy with WscIeLen
279 * if WscIeLen is not set properly, memory overwrite happen
280 * Ended up with memory corruption and crash
281 * Copy with Fixed size */
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530282 vos_mem_copy( (tANI_U8 *) pBssDescription->WscIeProbeRsp,
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 pBuf,
Madan Mohan Koyyalamudi2a6ba242012-10-31 17:06:19 -0700284 WSCIE_PROBE_RSP_LEN);
285
Jeff Johnson295189b2012-06-20 16:38:30 -0700286 }
Madan Mohan Koyyalamudi2a6ba242012-10-31 17:06:19 -0700287 else
288 {
289 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700290 FL("remaining bytes len %d is less than WSCIE_PROBE_RSP_LEN"),
Madan Mohan Koyyalamudi2a6ba242012-10-31 17:06:19 -0700291 pBssDescription->WscIeLen);
292 return eSIR_FAILURE;
293 }
294
295 /* 1 reserved byte padding */
296 pBuf += (WSCIE_PROBE_RSP_LEN + 1);
297 len -= (WSCIE_PROBE_RSP_LEN + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700298
Madan Mohan Koyyalamudic62057b2012-10-30 18:31:54 -0700299 if (len > 0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700300 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530301 vos_mem_copy( (tANI_U8 *) pBssDescription->ieFields,
Jeff Johnson295189b2012-06-20 16:38:30 -0700302 pBuf,
303 len);
304 }
Madan Mohan Koyyalamudic62057b2012-10-30 18:31:54 -0700305 else if (len < 0)
306 {
307 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700308 FL("remaining length is negative. len = %d, actual length = %d"),
Madan Mohan Koyyalamudic62057b2012-10-30 18:31:54 -0700309 len, pBssDescription->length);
310 return eSIR_FAILURE;
311 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700312
313 return eSIR_SUCCESS;
314} /*** end limGetBssDescription() ***/
Jeff Johnson295189b2012-06-20 16:38:30 -0700315
316
317
318/**
319 * limCopyBssDescription()
320 *
321 *FUNCTION:
322 * This function is called by various LIM functions to copy
323 * BSS description to a tANI_U8 buffer
324 *
325 *LOGIC:
326 *
327 *ASSUMPTIONS:
328 * NA
329 *
330 *NOTE:
331 * NA
332 *
333 * @param *pBuf Pointer to the destination buffer
334 * @param pBssDescription Pointer to the BssDescription being copied
335 * @return Length of BSSdescription written
336 */
337
338tANI_U16
339limCopyBssDescription(tpAniSirGlobal pMac, tANI_U8 *pBuf, tSirBssDescription *pBssDescription)
340{
341 tANI_U16 len = 0;
342
343 limCopyU16(pBuf, pBssDescription->length);
344 pBuf += sizeof(tANI_U16);
345 len += sizeof(tANI_U16);
346
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530347 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -0700348 (tANI_U8 *) pBssDescription->bssId,
349 sizeof(tSirMacAddr));
350 pBuf += sizeof(tSirMacAddr);
351 len += sizeof(tSirMacAddr);
352
353 PELOG3(limLog(pMac, LOG3,
354 FL("Copying BSSdescr:channel is %d, aniInd is %d, bssId is "),
355 pBssDescription->channelId, pBssDescription->aniIndicator);
356 limPrintMacAddr(pMac, pBssDescription->bssId, LOG3);)
357
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530358 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -0700359 (tANI_U8 *) (&pBssDescription->scanSysTimeMsec),
360 sizeof(v_TIME_t));
361 pBuf += sizeof(v_TIME_t);
362 len += sizeof(v_TIME_t);
363
364 limCopyU32(pBuf, pBssDescription->timeStamp[0]);
365 pBuf += sizeof(tANI_U32);
366 len += sizeof(tANI_U32);
367
368 limCopyU32(pBuf, pBssDescription->timeStamp[1]);
369 pBuf += sizeof(tANI_U32);
370 len += sizeof(tANI_U32);
371
372 limCopyU16(pBuf, pBssDescription->beaconInterval);
373 pBuf += sizeof(tANI_U16);
374 len += sizeof(tANI_U16);
375
376 limCopyU16(pBuf, pBssDescription->capabilityInfo);
377 pBuf += sizeof(tANI_U16);
378 len += sizeof(tANI_U16);
379
380 limCopyU32(pBuf, pBssDescription->nwType);
381 pBuf += sizeof(tANI_U32);
382 len += sizeof(tANI_U32);
383
384 *pBuf++ = pBssDescription->aniIndicator;
385 len++;
386
387 *pBuf++ = pBssDescription->rssi;
388 len++;
389
390 *pBuf++ = pBssDescription->sinr;
391 len++;
392
393 *pBuf++ = pBssDescription->channelId;
394 len++;
395
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530396 vos_mem_copy( pBuf, (tANI_U8 *) &(pBssDescription->ieFields),
Jeff Johnson295189b2012-06-20 16:38:30 -0700397 limGetIElenFromBssDescription(pBssDescription));
398
399 return (len + sizeof(tANI_U16));
400} /*** end limCopyBssDescription() ***/
401
402
403
Jeff Johnson295189b2012-06-20 16:38:30 -0700404
405
406/**
407 * limGetKeysInfo()
408 *
409 *FUNCTION:
410 * This function is called by various LIM functions to copy
411 * key information from a tANI_U8* buffer pointer to tSirKeys
412 *
413 *LOGIC:
414 *
415 *ASSUMPTIONS:
416 * NA
417 *
418 *NOTE:
419 * NA
420 *
421 * @param *pKeyInfo Pointer to the keyInfo to be copied
422 * @param *pBuf Pointer to the source buffer
423 *
424 * @return Length of key info extracted
425 */
426
427static tANI_U32
428limGetKeysInfo(tpAniSirGlobal pMac, tpSirKeys pKeyInfo, tANI_U8 *pBuf)
429{
430 tANI_U32 len = 0;
431
432 pKeyInfo->keyId = *pBuf++;
433 len++;
434 pKeyInfo->unicast = *pBuf++;
435 len++;
436 pKeyInfo->keyDirection = (tAniKeyDirection) limGetU32(pBuf);
437 len += sizeof(tAniKeyDirection);
438 pBuf += sizeof(tAniKeyDirection);
439
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530440 vos_mem_copy( pKeyInfo->keyRsc, pBuf, WLAN_MAX_KEY_RSC_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -0700441 pBuf += WLAN_MAX_KEY_RSC_LEN;
442 len += WLAN_MAX_KEY_RSC_LEN;
443
444 pKeyInfo->paeRole = *pBuf++;
445 len++;
446
447 pKeyInfo->keyLength = limGetU16(pBuf);
448 pBuf += sizeof(tANI_U16);
449 len += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530450 vos_mem_copy( pKeyInfo->key, pBuf, pKeyInfo->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -0700451 pBuf += pKeyInfo->keyLength;
452 len += pKeyInfo->keyLength;
453
454 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700455 FL("Extracted keyId=%d, keyLength=%d, Key is :"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700456 pKeyInfo->keyId, pKeyInfo->keyLength);
457 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3,
458 pKeyInfo->key, pKeyInfo->keyLength);)
459
460 return len;
461} /*** end limGetKeysInfo() ***/
462
463
464
465/**
466 * limStartBssReqSerDes()
467 *
468 *FUNCTION:
469 * This function is called by limProcessSmeMessages() upon receiving
470 * SME_START_BSS_REQ from host
471 *
472 *PARAMS:
473 *
474 *LOGIC:
475 *
476 *ASSUMPTIONS:
477 * NA
478 *
479 *NOTE:
480 * NA
481 *
482 * @param pStartBssReq Pointer to tSirSmeStartBssReq being extracted
483 * @param pBuf Pointer to serialized buffer
484 * @return retCode Indicates whether message is successfully
485 * de-serialized (eSIR_SUCCESS) or
486 * not (eSIR_FAILURE)
487 */
488
489tSirRetStatus
490limStartBssReqSerDes(tpAniSirGlobal pMac, tpSirSmeStartBssReq pStartBssReq, tANI_U8 *pBuf)
491{
492 tANI_S16 len = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700493
494#ifdef PE_DEBUG_LOG1
495 tANI_U8 *pTemp = pBuf;
496#endif
497
498 if (!pStartBssReq || !pBuf)
499 return eSIR_FAILURE;
500
501 pStartBssReq->messageType = limGetU16(pBuf);
502 pBuf += sizeof(tANI_U16);
503
504 len = pStartBssReq->length = limGetU16(pBuf);
505 pBuf += sizeof(tANI_U16);
506
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700507 PELOG1(limLog(pMac, LOG1, FL("SME_START_BSS_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700508 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
509
510 if (len < (tANI_S16) sizeof(tANI_U32))
511 return eSIR_FAILURE;
512
513 len -= sizeof(tANI_U32); // skip message header
514 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
515 return eSIR_FAILURE;
516
517 // Extract sessionId
518 pStartBssReq->sessionId = *pBuf++;
519 len--;
520 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
521 return eSIR_FAILURE;
522
523 // Extract transactionId
524 pStartBssReq->transactionId = limGetU16( pBuf );
525 pBuf += sizeof( tANI_U16 );
526 len -= sizeof( tANI_U16 );
527 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
528 return eSIR_FAILURE;
529
530 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530531 vos_mem_copy( (tANI_U8 *) pStartBssReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700532 pBuf += sizeof(tSirMacAddr);
533 len -= sizeof(tSirMacAddr);
534 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
535 return eSIR_FAILURE;
536
537 // Extract selfMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530538 vos_mem_copy( (tANI_U8 *) pStartBssReq->selfMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700539 pBuf += sizeof(tSirMacAddr);
540 len -= sizeof(tSirMacAddr);
541 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
542 return eSIR_FAILURE;
543
544 // Extract beaconInterval
545 pStartBssReq->beaconInterval = limGetU16( pBuf );
546 pBuf += sizeof( tANI_U16 );
547 len -= sizeof( tANI_U16 );
548 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
549 return eSIR_FAILURE;
550
551 // Extract dot11Mode
552 pStartBssReq->dot11mode = *pBuf++;
553 len --;
554 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
555 return eSIR_FAILURE;
556
557 // Extract bssType
558 pStartBssReq->bssType = (tSirBssType) limGetU32(pBuf);
559 pBuf += sizeof(tANI_U32);
560 len -= sizeof(tANI_U32);
561 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
562 return eSIR_FAILURE;
563
564 // Extract ssId
565 if (*pBuf > SIR_MAC_MAX_SSID_LENGTH)
566 {
567 // SSID length is more than max allowed 32 bytes
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700568 PELOGW(limLog(pMac, LOGW, FL("Invalid SSID length, len=%d"), *pBuf);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 return eSIR_FAILURE;
570 }
571
572 pStartBssReq->ssId.length = *pBuf++;
573 len--;
574 if (len < pStartBssReq->ssId.length)
575 {
576 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700577 FL("SSID length is longer that the remaining length. SSID len=%d, remaining len=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700578 pStartBssReq->ssId.length, len);
579 return eSIR_FAILURE;
580 }
581
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530582 vos_mem_copy( (tANI_U8 *) pStartBssReq->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 pBuf,
584 pStartBssReq->ssId.length);
585 pBuf += pStartBssReq->ssId.length;
586 len -= pStartBssReq->ssId.length;
587 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
588 return eSIR_FAILURE;
589
590 // Extract channelId
591 pStartBssReq->channelId = *pBuf++;
592 len--;
593
594 // Extract CB secondary channel info
Jeff Johnsone7245742012-09-05 17:12:55 -0700595 pStartBssReq->cbMode = (ePhyChanBondState)limGetU32( pBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -0700596 pBuf += sizeof( tANI_U32 );
597 len -= sizeof( tANI_U32 );
598
599 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
600 return eSIR_FAILURE;
601
Jeff Johnson295189b2012-06-20 16:38:30 -0700602
Jeff Johnson295189b2012-06-20 16:38:30 -0700603 // Extract privacy setting
604 pStartBssReq->privacy = *pBuf++;
605 len--;
606 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
607 return eSIR_FAILURE;
608
609 //Extract Uapsd Enable
610 pStartBssReq->apUapsdEnable = *pBuf++;
611 len--;
612 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
613 return eSIR_FAILURE;
614
615 //Extract SSID hidden
616 pStartBssReq->ssidHidden = *pBuf++;
617 len--;
618 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
619 return eSIR_FAILURE;
620
621 pStartBssReq->fwdWPSPBCProbeReq = *pBuf++;
622 len--;
623 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
624 return eSIR_FAILURE;
625
626 //Extract HT Protection Enable
627 pStartBssReq->protEnabled = *pBuf++;
628 len--;
629 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
630 return eSIR_FAILURE;
631
632 //Extract OBSS Protection Enable
633 pStartBssReq->obssProtEnabled = *pBuf++;
634 len--;
635 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
636 return eSIR_FAILURE;
637
638 pStartBssReq->ht_capab = limGetU16(pBuf);
639 pBuf += sizeof(tANI_U16);
640 len -= sizeof(tANI_U16);
641 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
642 return eSIR_FAILURE;
643
644 // Extract AuthType
645 pStartBssReq->authType = (tSirBssType) limGetU32(pBuf);
646 pBuf += sizeof(tANI_U32);
647 len -= sizeof(tANI_U32);
648 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
649 return eSIR_FAILURE;
650
651 // Extract dtimPeriod
652 pStartBssReq->dtimPeriod = limGetU32(pBuf);
653 pBuf += sizeof(tANI_U32);
654 len -= sizeof(tANI_U32);
655 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
656 return eSIR_FAILURE;
657
658 // Extract wps state
659 pStartBssReq->wps_state = *pBuf++;
660 len--;
661 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
662 return eSIR_FAILURE;
663
krunal sonie9002db2013-11-25 14:24:17 -0800664 // Extract isCoalesingInIBSSAllowed
665 pStartBssReq->isCoalesingInIBSSAllowed = *pBuf++;
666 len--;
667 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
668 return eSIR_FAILURE;
669
Jeff Johnson295189b2012-06-20 16:38:30 -0700670 // Extract bssPersona
671 pStartBssReq->bssPersona = *pBuf++;
672 len--;
673 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
674 return eSIR_FAILURE;
675
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -0800676
677 // Extract txLdpcIniFeatureEnabled
678 pStartBssReq->txLdpcIniFeatureEnabled = *pBuf++;
679 len--;
680 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
681 return eSIR_FAILURE;
682
Jeff Johnson295189b2012-06-20 16:38:30 -0700683 // Extract rsnIe
684 pStartBssReq->rsnIE.length = limGetU16(pBuf);
685 pBuf += sizeof(tANI_U16);
686
687 // Check for RSN IE length (that includes length of type & length
688 if (pStartBssReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2)
689 {
690 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700691 FL("Invalid RSN IE length %d in SME_START_BSS_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700692 pStartBssReq->rsnIE.length);
693 return eSIR_FAILURE;
694 }
695
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530696 vos_mem_copy( pStartBssReq->rsnIE.rsnIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -0700697 pBuf, pStartBssReq->rsnIE.length);
698
699 len -= (sizeof(tANI_U16) + pStartBssReq->rsnIE.length);
700 pBuf += pStartBssReq->rsnIE.length;
701 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
702 return eSIR_FAILURE;
703
704 // Extract nwType
705 pStartBssReq->nwType = (tSirNwType) limGetU32(pBuf);
706 pBuf += sizeof(tSirNwType);
707 len -= sizeof(tSirNwType);
708 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
709 return eSIR_FAILURE;
710
711 // Extract operationalRateSet
712 pStartBssReq->operationalRateSet.numRates = *pBuf++;
713
714 // Check for number of rates
715 if (pStartBssReq->operationalRateSet.numRates >
716 SIR_MAC_MAX_NUMBER_OF_RATES)
717 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700718 limLog(pMac, LOGW, FL("Invalid numRates %d in SME_START_BSS_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700719 pStartBssReq->operationalRateSet.numRates);
720 return eSIR_FAILURE;
721 }
722
723 len--;
724 if (len < pStartBssReq->operationalRateSet.numRates)
725 return eSIR_FAILURE;
726
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530727 vos_mem_copy( (tANI_U8 *) pStartBssReq->operationalRateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -0700728 pBuf,
729 pStartBssReq->operationalRateSet.numRates);
730 pBuf += pStartBssReq->operationalRateSet.numRates;
731 len -= pStartBssReq->operationalRateSet.numRates;
732
733 // Extract extendedRateSet
734 if ((pStartBssReq->nwType == eSIR_11G_NW_TYPE) ||
735 (pStartBssReq->nwType == eSIR_11N_NW_TYPE ))
736 {
737 pStartBssReq->extendedRateSet.numRates = *pBuf++;
738 len--;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530739 vos_mem_copy( pStartBssReq->extendedRateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -0700740 pBuf, pStartBssReq->extendedRateSet.numRates);
741 pBuf += pStartBssReq->extendedRateSet.numRates;
742 len -= pStartBssReq->extendedRateSet.numRates;
743 }
744
Jeff Johnson295189b2012-06-20 16:38:30 -0700745 if (len)
746 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700747 limLog(pMac, LOGW, FL("Extra bytes left in SME_START_BSS_REQ, len=%d"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700748 }
749
750 return eSIR_SUCCESS;
751} /*** end limStartBssReqSerDes() ***/
752
753
754
755/**
756 * limStopBssReqSerDes()
757 *
758 *FUNCTION:
759 * This function is called by limProcessSmeMessages() upon receiving
760 * SME_STOP_BSS_REQ from host
761 *
762 *PARAMS:
763 *
764 *LOGIC:
765 *
766 *ASSUMPTIONS:
767 * NA
768 *
769 *NOTE:
770 * NA
771 *
772 * @param pStopBssReq Pointer to tSirSmeStopBssReq being extracted
773 * @param pBuf Pointer to serialized buffer
774 * @return retCode Indicates whether message is successfully
775 * de-serialized (eSIR_SUCCESS) or
776 * not (eSIR_FAILURE)
777 */
778
779tSirRetStatus
780limStopBssReqSerDes(tpAniSirGlobal pMac, tpSirSmeStopBssReq pStopBssReq, tANI_U8 *pBuf)
781{
782 tANI_S16 len = 0;
783
784#ifdef PE_DEBUG_LOG1
785 tANI_U8 *pTemp = pBuf;
786#endif
787
788 pStopBssReq->messageType = limGetU16(pBuf);
789 pBuf += sizeof(tANI_U16);
790
791 len = pStopBssReq->length = limGetU16(pBuf);
792 pBuf += sizeof(tANI_U16);
793
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700794 PELOG1(limLog(pMac, LOG1, FL("SME_STOP_BSS_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700795 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
796
797 if (len < (tANI_S16) sizeof(tANI_U32))
798 return eSIR_FAILURE;
799
800 len -= sizeof(tANI_U32); // skip message header
801 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
802 return eSIR_FAILURE;
803
804 // Extract sessionId
805 pStopBssReq->sessionId = *pBuf++;
806 len--;
807 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
808 return eSIR_FAILURE;
809
810 // Extract transactionId
811 pStopBssReq->transactionId = limGetU16(pBuf);
812 pBuf += sizeof(tANI_U16);
813 len -= sizeof(tANI_U16);
814
815 // Extract reasonCode
816 pStopBssReq->reasonCode = (tSirResultCodes) limGetU32(pBuf);
817 pBuf += sizeof(tSirResultCodes);
818 len -= sizeof(tSirResultCodes);
819
820 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530821 vos_mem_copy( (tANI_U8 *) pStopBssReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700822 len -= sizeof(tSirMacAddr);
823
824 if (len)
825 return eSIR_FAILURE;
826 else
827 return eSIR_SUCCESS;
828
829} /*** end limStopBssReqSerDes() ***/
830
831
832
833/**
834 * limJoinReqSerDes()
835 *
836 *FUNCTION:
837 * This function is called by limProcessSmeMessages() upon receiving
838 * SME_JOIN_REQ from host
839 *
840 *PARAMS:
841 *
842 *LOGIC:
843 *
844 *ASSUMPTIONS:
845 * NA
846 *
847 *NOTE:
848 * NA
849 *
850 * @param pJoinReq Pointer to tSirSmeJoinReq being extracted
851 * @param pBuf Pointer to serialized buffer
852 * @return retCode Indicates whether message is successfully
853 * de-serialized (eSIR_SUCCESS) or
854 * not (eSIR_FAILURE)
855 */
856
857tSirRetStatus
858limJoinReqSerDes(tpAniSirGlobal pMac, tpSirSmeJoinReq pJoinReq, tANI_U8 *pBuf)
859{
860 tANI_S16 len = 0;
861 tANI_S16 lenUsed = 0;
862
863#ifdef PE_DEBUG_LOG1
864 tANI_U8 *pTemp = pBuf;
865#endif
866
867 if (!pJoinReq || !pBuf)
868 {
Abhishek Singh57aebef2014-02-03 18:47:44 +0530869 PELOGE(limLog(pMac, LOGE, FL("pJoinReq or pBuf is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700870 return eSIR_FAILURE;
871 }
872
873 // Extract messageType
874 pJoinReq->messageType = limGetU16(pBuf);
875 pBuf += sizeof(tANI_U16);
876
877 // Extract length
878 len = pJoinReq->length = limGetU16(pBuf);
879 pBuf += sizeof(tANI_U16);
880
881 if (pJoinReq->messageType == eWNI_SME_JOIN_REQ)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700882 PELOG1(limLog(pMac, LOG3, FL("SME_JOIN_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700883 else
Abhishek Singh57aebef2014-02-03 18:47:44 +0530884 PELOG1(limLog(pMac, LOG3, FL("SME_REASSOC_REQ length %d bytes is:"),
885 len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700886
887 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
888
889 if (len < (tANI_S16) sizeof(tANI_U32))
890 {
Abhishek Singh57aebef2014-02-03 18:47:44 +0530891 PELOGE(limLog(pMac, LOGE, FL("len %d is too short"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700892 return eSIR_FAILURE;
893 }
894
895 len -= sizeof(tANI_U32); // skip message header
896 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530897 {
898 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700899 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530900 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700901 // Extract sessionId
902 pJoinReq->sessionId = *pBuf++;
903 len--;
904 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530905 {
906 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700907 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530908 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700909 // Extract transactionId
910 pJoinReq->transactionId = limGetU16(pBuf);
911 pBuf += sizeof(tANI_U16);
912 len -= sizeof(tANI_U16);
913 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530914 {
915 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700916 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530917 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700918
919 // Extract ssId
920 pJoinReq->ssId.length = *pBuf++;
921 len--;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530922 vos_mem_copy( (tANI_U8 *) pJoinReq->ssId.ssId, pBuf, pJoinReq->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -0700923 pBuf += pJoinReq->ssId.length;
924 len -= pJoinReq->ssId.length;
925 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530926 {
927 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700928 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530929 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700930
931 // Extract selfMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530932 vos_mem_copy( pJoinReq->selfMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700933 pBuf += sizeof(tSirMacAddr);
934 len -= sizeof(tSirMacAddr);
935 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530936 {
937 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700938 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530939 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700940
941 // Extract bsstype
942 pJoinReq->bsstype = (tSirBssType) limGetU32(pBuf);
943 pBuf += sizeof(tANI_U32);
944 len -= sizeof(tANI_U32);
945 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530946 {
947 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700948 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530949 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700950
951 // Extract dot11mode
952 pJoinReq->dot11mode= *pBuf++;
953 len--;
954 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530955 {
956 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700957 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530958 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700959
960 // Extract bssPersona
961 pJoinReq->staPersona = *pBuf++;
962 len--;
963 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530964 {
965 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700966 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530967 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700968
Jeff Johnsone7245742012-09-05 17:12:55 -0700969 // Extract cbMode
970 pJoinReq->cbMode = *pBuf++;
971 len--;
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 Johnsone7245742012-09-05 17:12:55 -0700975 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +0530976 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700977
Jeff Johnson295189b2012-06-20 16:38:30 -0700978 // Extract uapsdPerAcBitmask
979 pJoinReq->uapsdPerAcBitmask = *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
Jeff Johnson295189b2012-06-20 16:38:30 -0700987
988 // Extract operationalRateSet
989 pJoinReq->operationalRateSet.numRates= *pBuf++;
990 len--;
991 if (pJoinReq->operationalRateSet.numRates)
992 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530993 vos_mem_copy( (tANI_U8 *) pJoinReq->operationalRateSet.rate, pBuf,
994 pJoinReq->operationalRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700995 pBuf += pJoinReq->operationalRateSet.numRates;
996 len -= pJoinReq->operationalRateSet.numRates;
997 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +0530998 {
999 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001000 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301001 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001002 }
1003
1004 // Extract extendedRateSet
1005 pJoinReq->extendedRateSet.numRates = *pBuf++;
1006 len--;
1007 if (pJoinReq->extendedRateSet.numRates)
1008 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301009 vos_mem_copy( pJoinReq->extendedRateSet.rate, pBuf, pJoinReq->extendedRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -07001010 pBuf += pJoinReq->extendedRateSet.numRates;
1011 len -= pJoinReq->extendedRateSet.numRates;
1012 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301013 {
1014 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001015 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301016 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001017 }
1018
1019 // Extract RSN IE
1020 pJoinReq->rsnIE.length = limGetU16(pBuf);
1021 pBuf += sizeof(tANI_U16);
1022 len -= sizeof(tANI_U16);
1023
1024 if (pJoinReq->rsnIE.length)
1025 {
1026 // Check for RSN IE length (that includes length of type & length)
1027 if ((pJoinReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2) ||
1028 (pJoinReq->rsnIE.length != 2 + *(pBuf + 1)))
1029 {
1030 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001031 FL("Invalid RSN IE length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001032 pJoinReq->rsnIE.length);
1033 return eSIR_FAILURE;
1034 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301035 vos_mem_copy( (tANI_U8 *) pJoinReq->rsnIE.rsnIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001036 pBuf, pJoinReq->rsnIE.length);
1037 pBuf += pJoinReq->rsnIE.length;
1038 len -= pJoinReq->rsnIE.length; // skip RSN IE
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 }
1045
1046#ifdef FEATURE_WLAN_CCX
1047 // Extract CCKM IE
1048 pJoinReq->cckmIE.length = limGetU16(pBuf);
1049 pBuf += sizeof(tANI_U16);
1050 len -= sizeof(tANI_U16);
1051 if (pJoinReq->cckmIE.length)
1052 {
1053 // Check for CCKM IE length (that includes length of type & length)
1054 if ((pJoinReq->cckmIE.length > SIR_MAC_MAX_IE_LENGTH) ||
1055 (pJoinReq->cckmIE.length != (2 + *(pBuf + 1))))
1056 {
1057 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001058 FL("Invalid CCKM IE length %d/%d in SME_JOIN/REASSOC_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001059 pJoinReq->cckmIE.length, 2 + *(pBuf + 1));
1060 return eSIR_FAILURE;
1061 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301062 vos_mem_copy((tANI_U8 *) pJoinReq->cckmIE.cckmIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001063 pBuf, pJoinReq->cckmIE.length);
1064 pBuf += pJoinReq->cckmIE.length;
1065 len -= pJoinReq->cckmIE.length; // skip CCKM IE
1066 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301067 {
1068 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001069 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301070 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001071 }
1072#endif
1073
1074 // Extract Add IE for scan
1075 pJoinReq->addIEScan.length = limGetU16(pBuf);
1076 pBuf += sizeof(tANI_U16);
1077 len -= sizeof(tANI_U16);
1078
1079 if (pJoinReq->addIEScan.length)
1080 {
1081 // Check for IE length (that includes length of type & length)
1082 if (pJoinReq->addIEScan.length > SIR_MAC_MAX_IE_LENGTH + 2)
1083 {
1084 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001085 FL("Invalid addIE Scan length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001086 pJoinReq->addIEScan.length);
1087 return eSIR_FAILURE;
1088 }
1089 // Check for P2P IE length (that includes length of type & length)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301090 vos_mem_copy( (tANI_U8 *) pJoinReq->addIEScan.addIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001091 pBuf, pJoinReq->addIEScan.length);
1092 pBuf += pJoinReq->addIEScan.length;
1093 len -= pJoinReq->addIEScan.length; // skip add IE
1094 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301095 {
1096 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001097 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301098 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001099 }
1100
1101 pJoinReq->addIEAssoc.length = limGetU16(pBuf);
1102 pBuf += sizeof(tANI_U16);
1103 len -= sizeof(tANI_U16);
1104
1105 // Extract Add IE for assoc
1106 if (pJoinReq->addIEAssoc.length)
1107 {
1108 // Check for IE length (that includes length of type & length)
1109 if (pJoinReq->addIEAssoc.length > SIR_MAC_MAX_IE_LENGTH + 2)
1110 {
1111 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001112 FL("Invalid addIE Assoc length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001113 pJoinReq->addIEAssoc.length);
1114 return eSIR_FAILURE;
1115 }
1116 // Check for P2P IE length (that includes length of type & length)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301117 vos_mem_copy( (tANI_U8 *) pJoinReq->addIEAssoc.addIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001118 pBuf, pJoinReq->addIEAssoc.length);
1119 pBuf += pJoinReq->addIEAssoc.length;
1120 len -= pJoinReq->addIEAssoc.length; // skip add IE
1121 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301122 {
1123 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001124 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301125 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001126 }
1127
Venkata Prathyusha Kuntupallie8dc41d2013-04-15 14:31:36 -07001128 pJoinReq->UCEncryptionType = limGetU32(pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001129 pBuf += sizeof(tANI_U32);
1130 len -= sizeof(tANI_U32);
1131 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301132 {
1133 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1134 return eSIR_FAILURE;
1135 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001136
Venkata Prathyusha Kuntupallie8dc41d2013-04-15 14:31:36 -07001137 pJoinReq->MCEncryptionType = limGetU32(pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001138 pBuf += sizeof(tANI_U32);
1139 len -= sizeof(tANI_U32);
1140 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301141 {
1142 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1143 return eSIR_FAILURE;
1144 }
Chet Lanctot186b5732013-03-18 10:26:30 -07001145#ifdef WLAN_FEATURE_11W
1146 pJoinReq->MgmtEncryptionType = limGetU32(pBuf);
1147 pBuf += sizeof(tANI_U32);
1148 len -= sizeof(tANI_U32);
1149 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301150 {
1151 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Chet Lanctot186b5732013-03-18 10:26:30 -07001152 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301153 }
Chet Lanctot186b5732013-03-18 10:26:30 -07001154#endif
1155
Jeff Johnson295189b2012-06-20 16:38:30 -07001156#ifdef WLAN_FEATURE_VOWIFI_11R
1157 //is11Rconnection;
1158 pJoinReq->is11Rconnection = (tAniBool)limGetU32(pBuf);
1159 pBuf += sizeof(tAniBool);
1160 len -= sizeof(tAniBool);
1161 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301162 {
1163 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1164 return eSIR_FAILURE;
1165 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001166#endif
1167
1168#ifdef FEATURE_WLAN_CCX
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05301169 //CCX version IE
1170 pJoinReq->isCCXFeatureIniEnabled = (tAniBool)limGetU32(pBuf);
1171 pBuf += sizeof(tAniBool);
1172 len -= sizeof(tAniBool);
1173 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301174 {
1175 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05301176 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301177 }
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05301178
Jeff Johnson295189b2012-06-20 16:38:30 -07001179 //isCCXconnection;
1180 pJoinReq->isCCXconnection = (tAniBool)limGetU32(pBuf);
1181 pBuf += sizeof(tAniBool);
1182 len -= sizeof(tAniBool);
1183 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301184 {
1185 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1186 return eSIR_FAILURE;
1187 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001188
1189 // TSPEC information
1190 pJoinReq->ccxTspecInfo.numTspecs = *pBuf++;
1191 len -= sizeof(tANI_U8);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301192 vos_mem_copy((void*)&pJoinReq->ccxTspecInfo.tspec[0], pBuf,
1193 (sizeof(tTspecInfo)* pJoinReq->ccxTspecInfo.numTspecs));
Jeff Johnson295189b2012-06-20 16:38:30 -07001194 pBuf += sizeof(tTspecInfo)*SIR_CCX_MAX_TSPEC_IES;
1195 len -= sizeof(tTspecInfo)*SIR_CCX_MAX_TSPEC_IES;
1196 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301197 {
1198 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001199 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301200 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001201#endif
1202
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001203#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07001204 //isFastTransitionEnabled;
1205 pJoinReq->isFastTransitionEnabled = (tAniBool)limGetU32(pBuf);
1206 pBuf += sizeof(tAniBool);
1207 len -= sizeof(tAniBool);
1208 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301209 {
1210 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1211 return eSIR_FAILURE;
1212 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001213#endif
1214
Jeff Johnson43971f52012-07-17 12:26:56 -07001215#ifdef FEATURE_WLAN_LFR
1216 //isFastRoamIniFeatureEnabled;
1217 pJoinReq->isFastRoamIniFeatureEnabled = (tAniBool)limGetU32(pBuf);
1218 pBuf += sizeof(tAniBool);
1219 len -= sizeof(tAniBool);
1220 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301221 {
1222 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
1223 return eSIR_FAILURE;
1224 }
Jeff Johnson43971f52012-07-17 12:26:56 -07001225#endif
1226
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001227 //txLdpcIniFeatureEnabled
1228 pJoinReq->txLdpcIniFeatureEnabled= *pBuf++;
1229 len--;
1230 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301231 {
1232 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001233 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301234 }
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001235
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001236 //txBFIniFeatureEnabled
1237 pJoinReq->txBFIniFeatureEnabled= *pBuf++;
1238 len--;
1239 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301240 {
1241 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001242 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301243 }
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001244
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001245 //txBFCsnValue
1246 pJoinReq->txBFCsnValue= *pBuf++;
1247 len--;
1248 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301249 {
1250 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001251 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301252 }
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001253
krunal soni5afa96c2013-09-06 22:19:02 -07001254 pJoinReq->isAmsduSupportInAMPDU= *pBuf++;
1255 len--;
1256 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301257 {
1258 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
krunal soni5afa96c2013-09-06 22:19:02 -07001259 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301260 }
krunal soni5afa96c2013-09-06 22:19:02 -07001261
Sandeep Puligillaaea98a22013-12-04 13:36:32 +05301262 pJoinReq->isWMEenabled = (tAniBool)limGetU32(pBuf);
1263 pBuf += sizeof(tAniBool);
1264 len -= sizeof(tAniBool);
1265 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1266 return eSIR_FAILURE;
1267
1268 pJoinReq->isQosEnabled = (tAniBool)limGetU32(pBuf);
1269 pBuf += sizeof(tAniBool);
1270 len -= sizeof(tAniBool);
1271 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1272 return eSIR_FAILURE;
1273
Jeff Johnson295189b2012-06-20 16:38:30 -07001274 // Extract Titan CB Neighbor BSS info
1275 pJoinReq->cbNeighbors.cbBssFoundPri = *pBuf;
1276 pBuf++;
1277 pJoinReq->cbNeighbors.cbBssFoundSecUp = *pBuf;
1278 pBuf++;
1279 pJoinReq->cbNeighbors.cbBssFoundSecDown = *pBuf;
1280 pBuf++;
1281 len -= 3;
1282
1283 // Extract Spectrum Mgt Indicator
1284 pJoinReq->spectrumMgtIndicator = (tAniBool) limGetU32(pBuf);
1285 pBuf += sizeof(tAniBool);
1286 len -= sizeof(tAniBool);
1287
1288 pJoinReq->powerCap.minTxPower = *pBuf++;
1289 pJoinReq->powerCap.maxTxPower = *pBuf++;
1290 len -=2;
Jeff Johnson295189b2012-06-20 16:38:30 -07001291
1292 pJoinReq->supportedChannels.numChnl = *pBuf++;
1293 len--;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301294 vos_mem_copy( (tANI_U8 *) pJoinReq->supportedChannels.channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001295 pBuf, pJoinReq->supportedChannels.numChnl);
1296 pBuf += pJoinReq->supportedChannels.numChnl;
1297 len-= pJoinReq->supportedChannels.numChnl;
1298
1299 PELOG2(limLog(pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001300 FL("spectrumInd ON: minPower %d, maxPower %d , numChnls %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001301 pJoinReq->powerCap.minTxPower,
1302 pJoinReq->powerCap.maxTxPower,
1303 pJoinReq->supportedChannels.numChnl);)
1304
1305 // Extract uapsdPerAcBitmask
1306 pJoinReq->uapsdPerAcBitmask = *pBuf++;
1307 len--;
1308 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
Abhishek Singh57aebef2014-02-03 18:47:44 +05301309 {
1310 limLog(pMac, LOGE, FL("remaining len %d is too short"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001311 return eSIR_FAILURE;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301312 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001313
Jeff Johnson295189b2012-06-20 16:38:30 -07001314 //
1315 // NOTE - tSirBssDescription is now moved to the end
1316 // of tSirSmeJoinReq structure. This is to accomodate
1317 // the variable length data member ieFields[1]
1318 //
1319 if (limGetBssDescription( pMac, &pJoinReq->bssDescription,
1320 len, &lenUsed, pBuf) == eSIR_FAILURE)
1321 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001322 PELOGE(limLog(pMac, LOGE, FL("get bss description failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001323 return eSIR_FAILURE;
1324 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05301325 PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3,
1326 (tANI_U8 *) &(pJoinReq->bssDescription),
1327 pJoinReq->bssDescription.length + 2);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001328 pBuf += lenUsed;
1329 len -= lenUsed;
Jeff Johnson295189b2012-06-20 16:38:30 -07001330
1331 return eSIR_SUCCESS;
1332} /*** end limJoinReqSerDes() ***/
1333
1334
1335/**---------------------------------------------------------------
1336\fn limAssocIndSerDes
1337\brief This function is called by limProcessMlmAssocInd() to
1338\ populate the SME_ASSOC_IND message based on the received
1339\ MLM_ASSOC_IND.
1340\
1341\param pMac
1342\param pAssocInd - Pointer to the received tLimMlmAssocInd
1343\param pBuf - Pointer to serialized buffer
1344\param psessionEntry - pointer to PE session entry
1345\
1346\return None
1347------------------------------------------------------------------*/
1348void
1349limAssocIndSerDes(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
1350{
1351 tANI_U8 *pLen = pBuf;
1352 tANI_U16 mLen = 0;
1353
1354#ifdef PE_DEBUG_LOG1
1355 tANI_U8 *pTemp = pBuf;
1356#endif
1357
Jeff Johnson295189b2012-06-20 16:38:30 -07001358
1359 mLen = sizeof(tANI_U32);
1360 mLen += sizeof(tANI_U8);
1361 pBuf += sizeof(tANI_U16);
1362 *pBuf = psessionEntry->smeSessionId;
1363 pBuf += sizeof(tANI_U8);
1364
1365 // Fill in peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301366 vos_mem_copy( pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001367 pBuf += sizeof(tSirMacAddr);
1368 mLen += sizeof(tSirMacAddr);
1369
1370 // Fill in aid
1371 limCopyU16(pBuf, pAssocInd->aid);
1372 pBuf += sizeof(tANI_U16);
1373 mLen += sizeof(tANI_U16);
1374
1375 // Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301376 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001377 pBuf += sizeof(tSirMacAddr);
1378 mLen += sizeof(tSirMacAddr);
1379
1380 // Fill in staId
1381 limCopyU16(pBuf, psessionEntry->staId);
1382 pBuf += sizeof(tANI_U16);
1383 mLen += sizeof(tANI_U16);
1384
1385 // Fill in authType
1386 limCopyU32(pBuf, pAssocInd->authType);
1387 pBuf += sizeof(tANI_U32);
1388 mLen += sizeof(tANI_U32);
1389
1390 // Fill in ssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301391 vos_mem_copy( pBuf, (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001392 pBuf += (1 + pAssocInd->ssId.length);
1393 mLen += (1 + pAssocInd->ssId.length);
1394
1395 // Fill in rsnIE
1396 limCopyU16(pBuf, pAssocInd->rsnIE.length);
1397 pBuf += sizeof(tANI_U16);
1398 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301399 vos_mem_copy( pBuf, (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001400 pAssocInd->rsnIE.length);
1401 pBuf += pAssocInd->rsnIE.length;
1402 mLen += pAssocInd->rsnIE.length;
1403
Jeff Johnson295189b2012-06-20 16:38:30 -07001404
Jeff Johnson295189b2012-06-20 16:38:30 -07001405 limCopyU32(pBuf, pAssocInd->spectrumMgtIndicator);
1406 pBuf += sizeof(tAniBool);
1407 mLen += sizeof(tAniBool);
1408
1409 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1410 {
1411 *pBuf = pAssocInd->powerCap.minTxPower;
1412 pBuf++;
1413 *pBuf = pAssocInd->powerCap.maxTxPower;
1414 pBuf++;
1415 mLen += sizeof(tSirMacPowerCapInfo);
1416
1417 *pBuf = pAssocInd->supportedChannels.numChnl;
1418 pBuf++;
1419 mLen++;
1420
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301421 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -07001422 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
1423 pAssocInd->supportedChannels.numChnl);
1424
1425
1426 pBuf += pAssocInd->supportedChannels.numChnl;
1427 mLen += pAssocInd->supportedChannels.numChnl;
1428 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001429 limCopyU32(pBuf, pAssocInd->WmmStaInfoPresent);
1430 pBuf += sizeof(tANI_U32);
1431 mLen += sizeof(tANI_U32);
Jeff Johnson295189b2012-06-20 16:38:30 -07001432 // Fill in length of SME_ASSOC_IND message
1433 limCopyU16(pLen, mLen);
1434
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001435 PELOG1(limLog(pMac, LOG1, FL("Sending SME_ASSOC_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001436 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1437} /*** end limAssocIndSerDes() ***/
1438
1439
1440
1441/**
1442 * limAssocCnfSerDes()
1443 *
1444 *FUNCTION:
1445 * This function is called by limProcessLmmMessages() when
1446 * SME_ASSOC_CNF or SME_REASSOC_CNF message is received from
1447 * upper layer software.
1448 *
1449 *PARAMS:
1450 *
1451 *LOGIC:
1452 *
1453 *ASSUMPTIONS:
1454 * NA
1455 *
1456 *NOTE:
1457 * NA
1458 *
1459 * @param pAssocCnf Pointer to tSirSmeAssocCnf being extracted into
1460 * @param pBuf Pointer to serialized buffer
1461 * @return retCode Indicates whether message is successfully
1462 * de-serialized (eSIR_SUCCESS) or
1463 * not (eSIR_FAILURE)
1464 */
1465
1466tSirRetStatus
1467limAssocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeAssocCnf pAssocCnf, tANI_U8 *pBuf)
1468{
1469#ifdef PE_DEBUG_LOG1
1470 tANI_U8 *pTemp = pBuf;
1471#endif
1472
1473 if (!pAssocCnf || !pBuf)
1474 return eSIR_FAILURE;
1475
1476 pAssocCnf->messageType = limGetU16(pBuf);
1477 pBuf += sizeof(tANI_U16);
1478
1479 pAssocCnf->length = limGetU16(pBuf);
1480 pBuf += sizeof(tANI_U16);
1481
1482 if (pAssocCnf->messageType == eWNI_SME_ASSOC_CNF)
1483 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001484 PELOG1(limLog(pMac, LOG1, FL("SME_ASSOC_CNF length %d bytes is:"), pAssocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001485 }
1486 else
1487 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001488 PELOG1(limLog(pMac, LOG1, FL("SME_REASSOC_CNF length %d bytes is:"), pAssocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001489 }
1490 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pAssocCnf->length);)
1491
1492 // status code
1493 pAssocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
1494 pBuf += sizeof(tSirResultCodes);
1495
1496 // bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301497 vos_mem_copy( pAssocCnf->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001498 pBuf += sizeof(tSirMacAddr);
1499
1500 // peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301501 vos_mem_copy( pAssocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001502 pBuf += sizeof(tSirMacAddr);
1503
1504
1505 pAssocCnf->aid = limGetU16(pBuf);
1506 pBuf += sizeof(tANI_U16);
1507 // alternateBssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301508 vos_mem_copy( pAssocCnf->alternateBssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001509 pBuf += sizeof(tSirMacAddr);
1510
1511 // alternateChannelId
1512 pAssocCnf->alternateChannelId = *pBuf;
1513 pBuf++;
1514
1515 return eSIR_SUCCESS;
1516} /*** end limAssocCnfSerDes() ***/
1517
1518
1519
1520/**
1521 * limDisassocCnfSerDes()
1522 *
1523 *FUNCTION:
1524 * This function is called by limProcessSmeMessages() when
1525 * SME_DISASSOC_CNF message is received from upper layer software.
1526 *
1527 *PARAMS:
1528 *
1529 *LOGIC:
1530 *
1531 *ASSUMPTIONS:
1532 * NA
1533 *
1534 *NOTE:
1535 * NA
1536 *
1537 * @param pDisassocCnf Pointer to tSirSmeDisassocCnf being
1538 * extracted into
1539 * @param pBuf Pointer to serialized buffer
1540 * @return retCode Indicates whether message is successfully
1541 * de-serialized (eSIR_SUCCESS) or
1542 * not (eSIR_FAILURE)
1543 */
1544
1545tSirRetStatus
1546limDisassocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeDisassocCnf pDisassocCnf, tANI_U8 *pBuf)
1547{
1548#ifdef PE_DEBUG_LOG1
1549 tANI_U8 *pTemp = pBuf;
1550#endif
1551
1552 if (!pDisassocCnf || !pBuf)
1553 return eSIR_FAILURE;
1554
1555 pDisassocCnf->messageType = limGetU16(pBuf);
1556 pBuf += sizeof(tANI_U16);
1557
1558 pDisassocCnf->length = limGetU16(pBuf);
1559 pBuf += sizeof(tANI_U16);
1560
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001561 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_CNF length %d bytes is:"), pDisassocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001562 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pDisassocCnf->length);)
1563
1564 pDisassocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
1565 pBuf += sizeof(tSirResultCodes);
1566
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301567 vos_mem_copy( pDisassocCnf->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001568 pBuf += sizeof(tSirMacAddr);
Jeff Johnson62c27982013-02-27 17:53:55 -08001569
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301570 vos_mem_copy( pDisassocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001571
Jeff Johnson62c27982013-02-27 17:53:55 -08001572
Jeff Johnson295189b2012-06-20 16:38:30 -07001573 return eSIR_SUCCESS;
1574} /*** end limDisassocCnfSerDes() ***/
1575
1576
1577
Jeff Johnson295189b2012-06-20 16:38:30 -07001578
1579
1580/**---------------------------------------------------------------
1581\fn limReassocIndSerDes
1582\brief This function is called by limProcessMlmReassocInd() to
1583\ populate the SME_REASSOC_IND message based on the received
1584\ MLM_REASSOC_IND.
1585\
1586\param pMac
1587\param pReassocInd - Pointer to the received tLimMlmReassocInd
1588\param pBuf - Pointer to serialized buffer
1589\param psessionEntry - pointer to PE session entry
1590\
1591\return None
1592------------------------------------------------------------------*/
1593void
1594limReassocIndSerDes(tpAniSirGlobal pMac, tpLimMlmReassocInd pReassocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
1595{
1596 tANI_U8 *pLen = pBuf;
1597 tANI_U16 mLen = 0;
1598
1599#ifdef PE_DEBUG_LOG1
1600 tANI_U8 *pTemp = pBuf;
1601#endif
1602
Jeff Johnson295189b2012-06-20 16:38:30 -07001603
1604 mLen = sizeof(tANI_U32);
1605 pBuf += sizeof(tANI_U16);
1606 *pBuf++ = psessionEntry->smeSessionId;
1607 mLen += sizeof(tANI_U8);
1608
1609 // Fill in peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301610 vos_mem_copy( pBuf, pReassocInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001611 pBuf += sizeof(tSirMacAddr);
1612 mLen += sizeof(tSirMacAddr);
1613
1614 // Fill in oldMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301615 vos_mem_copy( pBuf, pReassocInd->currentApAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001616 pBuf += sizeof(tSirMacAddr);
1617 mLen += sizeof(tSirMacAddr);
1618
1619 // Fill in aid
1620 limCopyU16(pBuf, pReassocInd->aid);
1621 pBuf += sizeof(tANI_U16);
1622 mLen += sizeof(tANI_U16);
1623
1624 // Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301625 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001626 pBuf += sizeof(tSirMacAddr);
1627 mLen += sizeof(tSirMacAddr);
1628
1629 // Fill in staId
1630 limCopyU16(pBuf, psessionEntry->staId);
1631 pBuf += sizeof(tANI_U16);
1632 mLen += sizeof(tANI_U16);
1633
1634 // Fill in authType
1635 limCopyU32(pBuf, pReassocInd->authType);
1636 pBuf += sizeof(tAniAuthType);
1637 mLen += sizeof(tAniAuthType);
1638
1639 // Fill in ssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301640 vos_mem_copy( pBuf, (tANI_U8 *) &(pReassocInd->ssId),
Jeff Johnson295189b2012-06-20 16:38:30 -07001641 pReassocInd->ssId.length + 1);
1642 pBuf += 1 + pReassocInd->ssId.length;
1643 mLen += pReassocInd->ssId.length + 1;
1644
1645 // Fill in rsnIE
1646 limCopyU16(pBuf, pReassocInd->rsnIE.length);
1647 pBuf += sizeof(tANI_U16);
1648 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301649 vos_mem_copy( pBuf, (tANI_U8 *) &(pReassocInd->rsnIE.rsnIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001650 pReassocInd->rsnIE.length);
1651 pBuf += pReassocInd->rsnIE.length;
1652 mLen += pReassocInd->rsnIE.length;
1653
1654 // Fill in addIE
1655 limCopyU16(pBuf, pReassocInd->addIE.length);
1656 pBuf += sizeof(tANI_U16);
1657 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301658 vos_mem_copy( pBuf, (tANI_U8*) &(pReassocInd->addIE.addIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001659 pReassocInd->addIE.length);
1660 pBuf += pReassocInd->addIE.length;
1661 mLen += pReassocInd->addIE.length;
1662
Jeff Johnson295189b2012-06-20 16:38:30 -07001663
Jeff Johnson295189b2012-06-20 16:38:30 -07001664 limCopyU32(pBuf, pReassocInd->spectrumMgtIndicator);
1665 pBuf += sizeof(tAniBool);
1666 mLen += sizeof(tAniBool);
1667
1668 if (pReassocInd->spectrumMgtIndicator == eSIR_TRUE)
1669 {
1670 *pBuf = pReassocInd->powerCap.minTxPower;
1671 pBuf++;
1672 *pBuf = pReassocInd->powerCap.maxTxPower;
1673 pBuf++;
1674 mLen += sizeof(tSirMacPowerCapInfo);
1675
1676 *pBuf = pReassocInd->supportedChannels.numChnl;
1677 pBuf++;
1678 mLen++;
1679
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301680 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -07001681 (tANI_U8 *) &(pReassocInd->supportedChannels.channelList),
1682 pReassocInd->supportedChannels.numChnl);
1683
1684 pBuf += pReassocInd->supportedChannels.numChnl;
1685 mLen += pReassocInd->supportedChannels.numChnl;
1686 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001687 limCopyU32(pBuf, pReassocInd->WmmStaInfoPresent);
1688 pBuf += sizeof(tANI_U32);
1689 mLen += sizeof(tANI_U32);
Jeff Johnson295189b2012-06-20 16:38:30 -07001690
1691 // Fill in length of SME_REASSOC_IND message
1692 limCopyU16(pLen, mLen);
1693
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001694 PELOG1(limLog(pMac, LOG1, FL("Sending SME_REASSOC_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001695 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1696} /*** end limReassocIndSerDes() ***/
1697
1698
1699/**
1700 * limAuthIndSerDes()
1701 *
1702 *FUNCTION:
1703 * This function is called by limProcessMlmAuthInd() while sending
1704 * SME_AUTH_IND to host
1705 *
1706 *PARAMS:
1707 *
1708 *LOGIC:
1709 *
1710 *ASSUMPTIONS:
1711 * NA
1712 *
1713 *NOTE:
1714 * NA
1715 *
1716 * @param pAuthInd Pointer to tSirSmeAuthInd being sent
1717 * @param pBuf Pointer to serialized buffer
1718 *
1719 * @return None
1720 */
1721
1722void
1723limAuthIndSerDes(tpAniSirGlobal pMac, tpLimMlmAuthInd pAuthInd, tANI_U8 *pBuf)
1724{
1725 tANI_U8 *pLen = pBuf;
1726 tANI_U16 mLen = 0;
1727
1728#ifdef PE_DEBUG_LOG1
1729 tANI_U8 *pTemp = pBuf;
1730#endif
1731
1732 mLen = sizeof(tANI_U32);
1733 pBuf += sizeof(tANI_U16);
1734 *pBuf++ = pAuthInd->sessionId;
1735 mLen += sizeof(tANI_U8);
1736
1737 // BTAMP TODO: Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301738 vos_mem_set(pBuf, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001739 pBuf += sizeof(tSirMacAddr);
1740 mLen += sizeof(tSirMacAddr);
1741
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301742 vos_mem_copy( pBuf, pAuthInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001743 pBuf += sizeof(tSirMacAddr);
1744 mLen += sizeof(tSirMacAddr);
1745
1746 limCopyU32(pBuf, pAuthInd->authType);
1747 pBuf += sizeof(tAniAuthType);
1748 mLen += sizeof(tAniAuthType);
1749
1750 limCopyU16(pLen, mLen);
1751
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001752 PELOG1(limLog(pMac, LOG1, FL("Sending SME_AUTH_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001753 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1754} /*** end limAuthIndSerDes() ***/
1755
1756
1757
1758/**
1759 * limSetContextReqSerDes()
1760 *
1761 *FUNCTION:
1762 * This function is called by limProcessSmeMessages() upon receiving
1763 * SME_SETCONTEXT_REQ from host
1764 *
1765 *PARAMS:
1766 *
1767 *LOGIC:
1768 *
1769 *ASSUMPTIONS:
1770 * NA
1771 *
1772 *NOTE:
1773 * NA
1774 *
1775 * @param pSetContextReq Pointer to tSirSmeSetContextReq being
1776 * extracted
1777 * @param pBuf Pointer to serialized buffer
1778 *
1779 * @return retCode Indicates whether message is successfully
1780 * de-serialized (eSIR_SUCCESS) or
1781 * not (eSIR_FAILURE)
1782 */
1783
1784tSirRetStatus
1785limSetContextReqSerDes(tpAniSirGlobal pMac, tpSirSmeSetContextReq pSetContextReq, tANI_U8 *pBuf)
1786{
1787 tANI_S16 len = 0;
1788 tANI_U16 totalKeySize = sizeof(tANI_U8); // initialized to sizeof numKeys
1789 tANI_U8 numKeys;
1790 tANI_U8 *pKeys;
1791
1792#ifdef PE_DEBUG_LOG1
1793 tANI_U8 *pTemp = pBuf;
1794#endif
1795 if (!pSetContextReq || !pBuf)
1796 return eSIR_FAILURE;
1797
1798 pSetContextReq->messageType = limGetU16(pBuf);
1799 pBuf += sizeof(tANI_U16);
1800
1801 len = pSetContextReq->length = limGetU16(pBuf);
1802 pBuf += sizeof(tANI_U16);
1803
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001804 PELOG1(limLog(pMac, LOG1, FL("SME_SETCONTEXT_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001805 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
1806
1807 if (len < (tANI_S16) sizeof(tANI_U32))
1808 return eSIR_FAILURE;
1809
1810 len -= sizeof(tANI_U32); // skip message header
1811 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1812 return eSIR_FAILURE;
1813
1814 // Extract sessionId
1815 pSetContextReq->sessionId = *pBuf++;
1816 len--;
1817 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1818 return eSIR_FAILURE;
1819
1820 // Extract transactionId
1821 pSetContextReq->transactionId = sirReadU16N(pBuf);
1822 pBuf += sizeof(tANI_U16);
1823 len -= sizeof(tANI_U16);
1824 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1825 return eSIR_FAILURE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301826 vos_mem_copy( (tANI_U8 *) pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001827 pBuf, sizeof(tSirMacAddr));
1828 pBuf += sizeof(tSirMacAddr);
1829 len -= sizeof(tSirMacAddr);
1830 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1831 return eSIR_FAILURE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301832 vos_mem_copy( pSetContextReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001833 pBuf += sizeof(tSirMacAddr);
1834 len -= sizeof(tSirMacAddr);
1835 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1836 return eSIR_FAILURE;
1837
Jeff Johnson295189b2012-06-20 16:38:30 -07001838
1839// pSetContextReq->qosInfoPresent = limGetU32(pBuf);
1840// pBuf += sizeof(tAniBool);
1841
1842// if (pSetContextReq->qosInfoPresent)
1843// {
1844// len = limGetQosInfo(&pSetContextReq->qos, pBuf);
1845// pBuf += len;
1846// }
1847
1848 pSetContextReq->keyMaterial.length = limGetU16(pBuf);
1849 pBuf += sizeof(tANI_U16);
1850 len -= sizeof(tANI_U16);
1851 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1852 return eSIR_FAILURE;
1853
1854 pSetContextReq->keyMaterial.edType = (tAniEdType) limGetU32(pBuf);
1855 pBuf += sizeof(tAniEdType);
1856 len -= sizeof(tAniEdType);
1857 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1858 return eSIR_FAILURE;
1859
1860 numKeys = pSetContextReq->keyMaterial.numKeys = *pBuf++;
1861 len -= sizeof(numKeys);
1862
1863 if (numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
1864 return eSIR_FAILURE;
1865
1866 /** Initialize the Default Keys if no Keys are being sent from the upper layer*/
1867 if( limCheckRemainingLength(pMac, len) == eSIR_FAILURE) {
1868 tpSirKeys pKeyinfo = pSetContextReq->keyMaterial.key;
1869
1870 pKeyinfo->keyId = 0;
1871 pKeyinfo->keyDirection = eSIR_TX_RX;
1872 pKeyinfo->keyLength = 0;
1873
1874 if (!limIsAddrBC(pSetContextReq->peerMacAddr))
1875 pKeyinfo->unicast = 1;
1876 else
1877 pKeyinfo->unicast = 0;
1878 }else {
1879 pKeys = (tANI_U8 *) pSetContextReq->keyMaterial.key;
1880 do {
1881 tANI_U32 keySize = limGetKeysInfo(pMac, (tpSirKeys) pKeys,
1882 pBuf);
1883 pBuf += keySize;
1884 pKeys += sizeof(tSirKeys);
1885 totalKeySize += (tANI_U16) keySize;
1886 if (numKeys == 0)
1887 break;
1888 numKeys--;
1889 }while (numKeys);
1890 }
1891 return eSIR_SUCCESS;
1892} /*** end limSetContextReqSerDes() ***/
1893
1894/**
1895 * limRemoveKeyReqSerDes()
1896 *
1897 *FUNCTION:
1898 * This function is called by limProcessSmeMessages() upon receiving
1899 * SME_REMOVEKEY_REQ from host
1900 *
1901 *PARAMS:
1902 *
1903 *LOGIC:
1904 *
1905 *ASSUMPTIONS:
1906 * NA
1907 *
1908 *NOTE:
1909 * NA
1910 *
1911 * @param pRemoveKeyReq Pointer to tSirSmeRemoveKeyReq being
1912 * extracted
1913 * @param pBuf Pointer to serialized buffer
1914 *
1915 * @return retCode Indicates whether message is successfully
1916 * de-serialized (eSIR_SUCCESS) or
1917 * not (eSIR_FAILURE)
1918 */
1919
1920tSirRetStatus
1921limRemoveKeyReqSerDes(tpAniSirGlobal pMac, tpSirSmeRemoveKeyReq pRemoveKeyReq, tANI_U8 *pBuf)
1922{
1923 tANI_S16 len = 0;
1924
1925#ifdef PE_DEBUG_LOG1
1926 tANI_U8 *pTemp = pBuf;
1927#endif
1928 if (!pRemoveKeyReq || !pBuf)
1929 return eSIR_FAILURE;
1930
1931 pRemoveKeyReq->messageType = limGetU16(pBuf);
1932 pBuf += sizeof(tANI_U16);
1933
1934 len = pRemoveKeyReq->length = limGetU16(pBuf);
1935 pBuf += sizeof(tANI_U16);
1936
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001937 PELOG1(limLog(pMac, LOG1, FL("SME_REMOVEKEY_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001938 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
1939
1940 if (len < (tANI_S16) sizeof(tANI_U32))
1941 return eSIR_FAILURE;
1942
1943 len -= sizeof(tANI_U32); // skip message header
1944 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1945 return eSIR_FAILURE;
1946
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301947 vos_mem_copy( (tANI_U8 *) pRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001948 pBuf, sizeof(tSirMacAddr));
1949 pBuf += sizeof(tSirMacAddr);
1950 len -= sizeof(tSirMacAddr);
1951 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1952 return eSIR_FAILURE;
1953
Jeff Johnson295189b2012-06-20 16:38:30 -07001954
1955 pRemoveKeyReq->edType = *pBuf;
1956 pBuf += sizeof(tANI_U8);
1957 len -= sizeof(tANI_U8);
1958 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1959 return eSIR_FAILURE;
1960
1961 pRemoveKeyReq->wepType = *pBuf;
1962
1963 pBuf += sizeof(tANI_U8);
1964 len -= sizeof(tANI_U8);
1965 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1966 return eSIR_FAILURE;
1967
1968 pRemoveKeyReq->keyId = *pBuf;
1969
1970 pBuf += sizeof(tANI_U8);
1971 len -= sizeof(tANI_U8);
1972 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1973 return eSIR_FAILURE;
1974
1975 pRemoveKeyReq->unicast = *pBuf;
1976 len--;
1977 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1978 return eSIR_FAILURE;
1979
1980 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301981 vos_mem_copy( pRemoveKeyReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001982 pBuf += sizeof(tSirMacAddr);
1983 len -= sizeof(tSirMacAddr);
1984 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1985 return eSIR_FAILURE;
1986
1987 // Extract sessionId
1988 pRemoveKeyReq->sessionId = *pBuf++;
1989 len--;
1990 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1991 return eSIR_FAILURE;
1992
1993 // Extract transactionId
1994 pRemoveKeyReq->transactionId = sirReadU16N(pBuf);
1995 pBuf += sizeof(tANI_U16);
1996 len -= sizeof(tANI_U16);
1997 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1998 return eSIR_FAILURE;
1999
2000 return eSIR_SUCCESS;
2001} /*** end limRemoveKeyReqSerDes() ***/
2002
2003
2004
2005/**
2006 * limDisassocReqSerDes()
2007 *
2008 *FUNCTION:
2009 * This function is called by limProcessSmeMessages() upon receiving
2010 * SME_DISASSOC_REQ from host
2011 *
2012 *PARAMS:
2013 *
2014 *LOGIC:
2015 *
2016 *ASSUMPTIONS:
2017 * NA
2018 *
2019 *NOTE:
2020 * NA
2021 *
2022 * @param pDisassocReq Pointer to tSirSmeDisassocReq being extracted
2023 * @param pBuf Pointer to serialized buffer
2024 *
2025 * @return retCode Indicates whether message is successfully
2026 * de-serialized (eSIR_SUCCESS) or
2027 * not (eSIR_FAILURE)
2028 */
2029
2030tSirRetStatus
2031limDisassocReqSerDes(tpAniSirGlobal pMac, tSirSmeDisassocReq *pDisassocReq, tANI_U8 *pBuf)
2032{
2033 tANI_S16 len = 0;
2034#ifdef PE_DEBUG_LOG1
2035 tANI_U8 *pTemp = pBuf;
2036#endif
2037
2038 if (!pDisassocReq || !pBuf)
2039 return eSIR_FAILURE;
2040
2041 pDisassocReq->messageType = limGetU16(pBuf);
2042 pBuf += sizeof(tANI_U16);
2043
2044 len = pDisassocReq->length = limGetU16(pBuf);
2045 pBuf += sizeof(tANI_U16);
2046
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002047 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002048 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2049
2050 if (len < (tANI_S16) sizeof(tANI_U32))
2051 return eSIR_FAILURE;
2052
2053 len -= sizeof(tANI_U32); // skip message header
2054 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2055 return eSIR_FAILURE;
2056
2057 // Extract sessionID
2058 pDisassocReq->sessionId = *pBuf;
2059 pBuf += sizeof(tANI_U8);
2060 len -= sizeof(tANI_U8);
2061 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2062 return eSIR_FAILURE;
2063
2064 // Extract transactionid
2065 pDisassocReq->transactionId = limGetU16(pBuf);
2066 pBuf += sizeof(tANI_U16);
2067 len -= sizeof(tANI_U16);
2068 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2069 return eSIR_FAILURE;
2070
2071 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302072 vos_mem_copy( (tANI_U8 *) pDisassocReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002073 pBuf += sizeof(tSirMacAddr);
2074 len -= sizeof(tSirMacAddr);
2075 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2076 return eSIR_FAILURE;
2077
2078 // Extract peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302079 vos_mem_copy( pDisassocReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002080 pBuf += sizeof(tSirMacAddr);
2081 len -= sizeof(tSirMacAddr);
2082 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2083 return eSIR_FAILURE;
2084
2085 // Extract reasonCode
2086 pDisassocReq->reasonCode = limGetU16(pBuf);
2087 pBuf += sizeof(tANI_U16);
2088 len -= sizeof(tANI_U16);
2089 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2090 return eSIR_FAILURE;
2091
2092 pDisassocReq->doNotSendOverTheAir = *pBuf;
2093 pBuf += sizeof(tANI_U8);
2094 len -= sizeof(tANI_U8);
2095
Jeff Johnson295189b2012-06-20 16:38:30 -07002096
2097 return eSIR_SUCCESS;
2098} /*** end limDisassocReqSerDes() ***/
2099
2100
2101
2102/**
2103 * limDeauthReqSerDes()
2104 *
2105 *FUNCTION:
2106 * This function is called by limProcessSmeMessages() upon receiving
2107 * SME_DEAUTH_REQ from host
2108 *
2109 *PARAMS:
2110 *
2111 *LOGIC:
2112 *
2113 *ASSUMPTIONS:
2114 * NA
2115 *
2116 *NOTE:
2117 * NA
2118 *
2119 * @param pDeauthReq Pointer to tSirSmeDeauthReq being extracted
2120 * @param pBuf Pointer to serialized buffer
2121 *
2122 * @return retCode Indicates whether message is successfully
2123 * de-serialized (eSIR_SUCCESS) or
2124 * not (eSIR_FAILURE)
2125 */
2126tSirRetStatus
2127limDeauthReqSerDes(tpAniSirGlobal pMac, tSirSmeDeauthReq *pDeauthReq, tANI_U8 *pBuf)
2128{
2129 tANI_S16 len = 0;
2130
2131#ifdef PE_DEBUG_LOG1
2132 tANI_U8 *pTemp = pBuf;
2133#endif
2134
2135 if (!pDeauthReq || !pBuf)
2136 return eSIR_FAILURE;
2137
2138 pDeauthReq->messageType = limGetU16(pBuf);
2139 pBuf += sizeof(tANI_U16);
2140
2141 len = pDeauthReq->length = limGetU16(pBuf);
2142 pBuf += sizeof(tANI_U16);
2143
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002144 PELOG1(limLog(pMac, LOG1, FL("SME_DEAUTH_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002145 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2146
2147 if (len < (tANI_S16) sizeof(tANI_U32))
2148 return eSIR_FAILURE;
2149
2150 len -= sizeof(tANI_U32); // skip message header
2151 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2152 return eSIR_FAILURE;
2153
2154 // Extract sessionId
2155 pDeauthReq->sessionId = *pBuf++;
2156 len--;
2157 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2158 return eSIR_FAILURE;
2159
2160 // Extract transactionId
2161 pDeauthReq->transactionId = limGetU16(pBuf);
2162 pBuf += sizeof(tANI_U16);
2163 len -= sizeof(tANI_U16);
2164 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2165 return eSIR_FAILURE;
2166
2167 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302168 vos_mem_copy( pDeauthReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002169 pBuf += sizeof(tSirMacAddr);
2170 len -= sizeof(tSirMacAddr);
2171 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2172 return eSIR_FAILURE;
2173
2174 // Extract peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302175 vos_mem_copy( pDeauthReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002176 pBuf += sizeof(tSirMacAddr);
2177 len -= sizeof(tSirMacAddr);
2178 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2179 return eSIR_FAILURE;
2180
2181 // Extract reasonCode
2182 pDeauthReq->reasonCode = limGetU16(pBuf);
2183 pBuf += sizeof(tANI_U16);
2184 len -= sizeof(tANI_U16);
2185
Jeff Johnson295189b2012-06-20 16:38:30 -07002186
2187 return eSIR_SUCCESS;
2188} /*** end limDisassocReqSerDes() ***/
2189
2190
2191
2192
Jeff Johnson295189b2012-06-20 16:38:30 -07002193
2194
2195/**
2196 * limStatSerDes()
2197 *
2198 *FUNCTION:
2199 * This function is called by limSendSmeDisassocNtf() while sending
2200 * SME_DISASSOC_IND/eWNI_SME_DISASSOC_RSP to host
2201 *
2202 *PARAMS:
2203 *
2204 *LOGIC:
2205 *
2206 *ASSUMPTIONS:
2207 * NA
2208 *
2209 *NOTE:
2210 * NA
2211 *
2212 * @param pAssocInd Pointer to tpAniStaStatStruct being sent
2213 * @param pBuf Pointer to serialized buffer
2214 *
2215 * @return None
2216 */
2217
2218void
2219limStatSerDes(tpAniSirGlobal pMac, tpAniStaStatStruct pStat, tANI_U8 *pBuf)
2220{
2221#ifdef PE_DEBUG_LOG1
2222 tANI_U8 *pTemp = pBuf;
2223#endif
2224
2225 limCopyU32(pBuf, pStat->sentAesBlksUcastHi);
2226 pBuf += sizeof(tANI_U32);
2227
2228 limCopyU32(pBuf, pStat->sentAesBlksUcastLo);
2229 pBuf += sizeof(tANI_U32);
2230
2231 limCopyU32(pBuf, pStat->recvAesBlksUcastHi);
2232 pBuf += sizeof(tANI_U32);
2233
2234 limCopyU32(pBuf, pStat->recvAesBlksUcastLo);
2235 pBuf += sizeof(tANI_U32);
2236
2237 limCopyU32(pBuf, pStat->aesFormatErrorUcastCnts);
2238 pBuf += sizeof(tANI_U32);
2239
2240 limCopyU32(pBuf, pStat->aesReplaysUcast);
2241 pBuf += sizeof(tANI_U32);
2242
2243 limCopyU32(pBuf, pStat->aesDecryptErrUcast);
2244 pBuf += sizeof(tANI_U32);
2245
2246 limCopyU32(pBuf, pStat->singleRetryPkts);
2247 pBuf += sizeof(tANI_U32);
2248
2249 limCopyU32(pBuf, pStat->failedTxPkts);
2250 pBuf += sizeof(tANI_U32);
2251
2252 limCopyU32(pBuf, pStat->ackTimeouts);
2253 pBuf += sizeof(tANI_U32);
2254
2255 limCopyU32(pBuf, pStat->multiRetryPkts);
2256 pBuf += sizeof(tANI_U32);
2257
2258 limCopyU32(pBuf, pStat->fragTxCntsHi);
2259 pBuf += sizeof(tANI_U32);
2260
2261 limCopyU32(pBuf, pStat->fragTxCntsLo);
2262 pBuf += sizeof(tANI_U32);
2263
2264 limCopyU32(pBuf, pStat->transmittedPktsHi);
2265 pBuf += sizeof(tANI_U32);
2266
2267 limCopyU32(pBuf, pStat->transmittedPktsLo);
2268 pBuf += sizeof(tANI_U32);
2269
2270 limCopyU32(pBuf, pStat->phyStatHi);
2271 pBuf += sizeof(tANI_U32);
2272
2273 limCopyU32(pBuf, pStat->phyStatLo);
2274 pBuf += sizeof(tANI_U32);
2275
2276 limCopyU32(pBuf, pStat->uplinkRssi);
2277 pBuf += sizeof(tANI_U32);
2278
2279 limCopyU32(pBuf, pStat->uplinkSinr);
2280 pBuf += sizeof(tANI_U32);
2281
2282 limCopyU32(pBuf, pStat->uplinkRate);
2283 pBuf += sizeof(tANI_U32);
2284
2285 limCopyU32(pBuf, pStat->downlinkRssi);
2286 pBuf += sizeof(tANI_U32);
2287
2288 limCopyU32(pBuf, pStat->downlinkSinr);
2289 pBuf += sizeof(tANI_U32);
2290
2291 limCopyU32(pBuf, pStat->downlinkRate);
2292 pBuf += sizeof(tANI_U32);
2293
2294 limCopyU32(pBuf, pStat->nRcvBytes);
2295 pBuf += sizeof(tANI_U32);
2296
2297 limCopyU32(pBuf, pStat->nXmitBytes);
2298 pBuf += sizeof(tANI_U32);
2299
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002300 PELOG1(limLog(pMac, LOG1, FL("STAT: length %d bytes is:"), sizeof(tAniStaStatStruct));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002301 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, sizeof(tAniStaStatStruct));)
2302
2303} /*** end limStatSerDes() ***/
2304
2305
Jeff Johnson295189b2012-06-20 16:38:30 -07002306
2307
2308/**
2309 * limPackBkgndScanFailNotify()
2310 *
2311 *FUNCTION:
2312 * This function is called by limSendSmeWmStatusChangeNtf()
2313 * to pack the tSirBackgroundScanInfo message
2314 *
2315 */
2316void
2317limPackBkgndScanFailNotify(tpAniSirGlobal pMac,
2318 tSirSmeStatusChangeCode statusChangeCode,
2319 tpSirBackgroundScanInfo pScanInfo,
2320 tSirSmeWmStatusChangeNtf *pSmeNtf,
2321 tANI_U8 sessionId)
2322{
2323
2324 tANI_U16 length = (sizeof(tANI_U16) * 2) + sizeof(tANI_U8) +
2325 sizeof(tSirSmeStatusChangeCode) +
2326 sizeof(tSirBackgroundScanInfo);
2327
Jeff Johnson295189b2012-06-20 16:38:30 -07002328 pSmeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
2329 pSmeNtf->statusChangeCode = statusChangeCode;
2330 pSmeNtf->length = length;
2331 pSmeNtf->sessionId = sessionId;
2332 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanSuccess = pScanInfo->numOfScanSuccess;
2333 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanFailure = pScanInfo->numOfScanFailure;
2334 pSmeNtf->statusChangeInfo.bkgndScanInfo.reserved = pScanInfo->reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07002335}
2336
Jeff Johnson295189b2012-06-20 16:38:30 -07002337
Jeff Johnson295189b2012-06-20 16:38:30 -07002338/**
2339 * limIsSmeGetAssocSTAsReqValid()
2340 *
2341 *FUNCTION:
2342 * This function is called by limProcessSmeReqMessages() upon
2343 * receiving SME_GET_ASSOC_STAS_REQ message from application.
2344 *
2345 *LOGIC:
2346 * Message validity checks are performed in this function
2347 *
2348 *ASSUMPTIONS:
2349 *
2350 *NOTE:
2351 *
2352 * @param pBuf - Pointer to a serialized SME_GET_ASSOC_STAS_REQ message
2353 * @param pSmeMsg - Pointer to a tSirSmeGetAssocSTAsReq structure
2354 * @return true if SME_GET_ASSOC_STAS_REQ message is formatted correctly
2355 * false otherwise
2356 */
2357tANI_BOOLEAN
2358limIsSmeGetAssocSTAsReqValid(tpAniSirGlobal pMac, tpSirSmeGetAssocSTAsReq pGetAssocSTAsReq, tANI_U8 *pBuf)
2359{
2360 tANI_S16 len = 0;
2361
2362 pGetAssocSTAsReq->messageType = limGetU16(pBuf);
2363 pBuf += sizeof(tANI_U16);
2364
2365 len = pGetAssocSTAsReq->length = limGetU16(pBuf);
2366 pBuf += sizeof(tANI_U16);
2367
2368 if (len < (tANI_S16) sizeof(tANI_U32))
2369 return eSIR_FAILURE;
2370
2371 len -= sizeof(tANI_U32); // skip message header
2372 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2373 return eSIR_FAILURE;
2374
2375 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302376 vos_mem_copy( (tANI_U8 *) pGetAssocSTAsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002377 pBuf += sizeof(tSirMacAddr);
2378 len -= sizeof(tSirMacAddr);
2379 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2380 return eSIR_FAILURE;
2381
2382 // Extract modId
2383 pGetAssocSTAsReq->modId = limGetU16(pBuf);
2384 pBuf += sizeof(tANI_U16);
2385 len -= sizeof(tANI_U16);
2386 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2387 return eSIR_FAILURE;
2388
2389 // Extract pUsrContext
2390 pGetAssocSTAsReq->pUsrContext = (void *)limGetU32(pBuf);
2391 pBuf += sizeof(tANI_U32);
2392 len -= sizeof(tANI_U32);
2393 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2394 return eSIR_FAILURE;
2395
2396 // Extract pSapEventCallback
2397 pGetAssocSTAsReq->pSapEventCallback = (void *)limGetU32(pBuf);
2398 pBuf += sizeof(tANI_U32);
2399 len -= sizeof(tANI_U32);
2400 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2401 return eSIR_FAILURE;
2402
2403 // Extract pAssocStasArray
2404 pGetAssocSTAsReq->pAssocStasArray = (void *)limGetU32(pBuf);
2405 pBuf += sizeof(tANI_U32);
2406 len -= sizeof(tANI_U32);
2407
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002408 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002409
2410 if (len < 0)
2411 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002412 PELOGE(limLog(pMac, LOGE, FL("SME_GET_ASSOC_STAS_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002413 return eANI_BOOLEAN_FALSE;
2414 }
2415
2416 return eANI_BOOLEAN_TRUE;
2417}
2418
2419/**
2420 * limTkipCntrMeasReqSerDes()
2421 *
2422 *FUNCTION:
2423 * This function is called by limProcessSmeMessages() upon receiving
2424 * eWNI_SME_TKIP_CNTR_MEAS_REQ from host HDD
2425 *
2426 *PARAMS:
2427 *
2428 *LOGIC:
2429 *
2430 *ASSUMPTIONS:
2431 * NA
2432 *
2433 *NOTE:
2434 * NA
2435 *
2436 * @param tpSirSmeTkipCntrMeasReq Pointer to tSirSmeTkipCntrMeasReq being extracted
2437 * @param pBuf Pointer to serialized buffer
2438 * @return retCode Indicates whether message is successfully
2439 * de-serialized (eSIR_SUCCESS) or
2440 * not (eSIR_FAILURE)
2441 */
2442tSirRetStatus
2443limTkipCntrMeasReqSerDes(tpAniSirGlobal pMac, tpSirSmeTkipCntrMeasReq pTkipCntrMeasReq, tANI_U8 *pBuf)
2444{
2445 tANI_S16 len = 0;
2446
2447#ifdef PE_DEBUG_LOG1
2448 tANI_U8 *pTemp = pBuf;
2449#endif
2450
2451 pTkipCntrMeasReq->messageType = limGetU16(pBuf);
2452 pBuf += sizeof(tANI_U16);
2453
2454 len = pTkipCntrMeasReq->length = limGetU16(pBuf);
2455 pBuf += sizeof(tANI_U16);
2456
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002457 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002458 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2459
2460 if (len < (tANI_S16) sizeof(tANI_U32))
2461 return eSIR_FAILURE;
2462
2463 len -= sizeof(tANI_U32); // skip message header
2464 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2465 return eSIR_FAILURE;
2466
2467 // Extract sessionId
2468 pTkipCntrMeasReq->sessionId = *pBuf++;
2469 len--;
2470 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2471 return eSIR_FAILURE;
2472
2473 // Extract transactionId
2474 pTkipCntrMeasReq->transactionId = limGetU16(pBuf);
2475 pBuf += sizeof(tANI_U16);
2476 len -= sizeof(tANI_U16);
2477 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2478 return eSIR_FAILURE;
2479
2480 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302481 vos_mem_copy( (tANI_U8 *) pTkipCntrMeasReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002482 pBuf += sizeof(tSirMacAddr);
2483 len -= sizeof(tSirMacAddr);
2484 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2485 return eSIR_FAILURE;
2486
2487 // Extract bEnable
2488 pTkipCntrMeasReq->bEnable = *pBuf++;
2489 len --;
2490
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002491 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002492
2493 if (len)
2494 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002495 PELOGE(limLog(pMac, LOGE, FL("SME_TKIP_CNTR_MEAS_REQ invalid "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002496 return eSIR_FAILURE;
2497 }
2498 else
2499 return eSIR_SUCCESS;
2500}
2501
2502/**
2503 * limIsSmeGetWPSPBCSessionsReqValid()
2504 *
2505 *FUNCTION:
2506 * This function is called by limProcessSmeGetWPSPBCSessions() upon
2507 * receiving query WPS PBC overlap information message from application.
2508 *
2509 *LOGIC:
2510 * Message validity checks are performed in this function
2511 *
2512 *ASSUMPTIONS:
2513 *
2514 *NOTE:
2515 *
2516 * @param pBuf - Pointer to a serialized SME_GET_WPSPBC_SESSION_REQ message
2517 * @param pGetWPSPBCSessionsReq - Pointer to a tSirSmeGetWPSPBCSessionsReq structure
2518 * @return true if SME_GET_WPSPBC_SESSION_REQ message is formatted correctly
2519 * false otherwise
2520 */
2521
2522tSirRetStatus
2523limIsSmeGetWPSPBCSessionsReqValid(tpAniSirGlobal pMac, tSirSmeGetWPSPBCSessionsReq *pGetWPSPBCSessionsReq, tANI_U8 *pBuf)
2524{
2525 tANI_S16 len = 0;
2526
2527 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirSmeGetWPSPBCSessionsReq));)
2528
2529 pGetWPSPBCSessionsReq->messageType = limGetU16(pBuf);
2530 pBuf += sizeof(tANI_U16);
2531
2532 len = pGetWPSPBCSessionsReq->length = limGetU16(pBuf);
2533 pBuf += sizeof(tANI_U16);
2534
2535 if (len < (tANI_S16) sizeof(tANI_U32))
2536 return eSIR_FAILURE;
2537
2538 len -= sizeof(tANI_U32); // skip message header
2539 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2540 return eSIR_FAILURE;
2541
2542 // Extract pUsrContext
2543 pGetWPSPBCSessionsReq->pUsrContext = (void *)limGetU32(pBuf);
2544 pBuf += sizeof(tANI_U32);
2545 len -= sizeof(tANI_U32);
2546 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2547 return eSIR_FAILURE;
2548
2549 // Extract pSapEventCallback
2550 pGetWPSPBCSessionsReq->pSapEventCallback = (void *)limGetU32(pBuf);
2551 pBuf += sizeof(tANI_U32);
2552 len -= sizeof(tANI_U32);
2553 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2554 return eSIR_FAILURE;
2555
2556 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302557 vos_mem_copy( (tANI_U8 *) pGetWPSPBCSessionsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002558 pBuf += sizeof(tSirMacAddr);
2559 len -= sizeof(tSirMacAddr);
2560
2561 // Extract MAC address of Station to be removed
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302562 vos_mem_copy( (tANI_U8 *) pGetWPSPBCSessionsReq->pRemoveMac, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002563 pBuf += sizeof(tSirMacAddr);
2564 len -= sizeof(tSirMacAddr);
2565
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002566 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002567
2568 if (len < 0)
2569 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002570 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002571 return eSIR_FAILURE;
2572 }
2573
2574 return eSIR_SUCCESS;
2575}
2576
Jeff Johnson295189b2012-06-20 16:38:30 -07002577
2578/**---------------------------------------------------------------
2579\fn limGetSessionInfo
2580\brief This function returns the sessionId and transactionId
2581\ of a message. This assumes that the message structure
2582\ is of format:
2583\ tANI_U16 messageType
2584\ tANI_U16 messageLength
2585\ tANI_U8 sessionId
2586\ tANI_U16 transactionId
2587\param pMac - pMac global structure
2588\param *pBuf - pointer to the message buffer
2589\param sessionId - returned session id value
2590\param transactionId - returned transaction ID value
2591\return None
2592------------------------------------------------------------------*/
2593void
2594limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U8 *sessionId, tANI_U16 *transactionId)
2595{
2596 if (!pBuf)
2597 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002598 limLog(pMac, LOGE, FL("NULL ptr received. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002599 return;
2600 }
2601
2602 pBuf += sizeof(tANI_U16); // skip message type
2603 pBuf += sizeof(tANI_U16); // skip message length
2604
2605 *sessionId = *pBuf; // get sessionId
2606 pBuf++;
2607 *transactionId = limGetU16(pBuf); // get transactionId
2608
2609 return;
2610}
2611
Jeff Johnson295189b2012-06-20 16:38:30 -07002612
2613/**
2614 * limUpdateAPWPSIEsReqSerDes()
2615 *
2616 *FUNCTION:
2617 * This function is to deserialize UpdateAPWPSIEs message
2618 *
2619 *PARAMS:
2620 *
2621 *LOGIC:
2622 *
2623 *ASSUMPTIONS:
2624 * NA
2625 *
2626 *NOTE:
2627 * NA
2628 *
2629 * @param pUpdateAPWPSIEsReq Pointer to tSirUpdateAPWPSIEsReq being
2630 * extracted
2631 * @param pBuf Pointer to serialized buffer
2632 *
2633 * @return retCode Indicates whether message is successfully
2634 * de-serialized (eSIR_SUCCESS) or
2635 * not (eSIR_FAILURE)
2636 */
2637
2638tSirRetStatus
2639limUpdateAPWPSIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq, tANI_U8 *pBuf)
2640{
2641 tANI_S16 len = 0;
2642
2643 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPSIEsReq));)
2644
2645 if (!pUpdateAPWPSIEsReq || !pBuf)
2646 return eSIR_FAILURE;
2647
2648 pUpdateAPWPSIEsReq->messageType = limGetU16(pBuf);
2649 pBuf += sizeof(tANI_U16);
2650
2651 len = pUpdateAPWPSIEsReq->length = limGetU16(pBuf);
2652 pBuf += sizeof(tANI_U16);
2653
2654 if (len < (tANI_S16) sizeof(tANI_U32))
2655 return eSIR_FAILURE;
2656
2657 len -= sizeof(tANI_U32); // skip message header
2658 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2659 return eSIR_FAILURE;
2660
2661 // Extract transactionId
2662 pUpdateAPWPSIEsReq->transactionId = limGetU16( pBuf );
2663 pBuf += sizeof( tANI_U16 );
2664 len -= sizeof( tANI_U16 );
2665 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2666 return eSIR_FAILURE;
2667
2668 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302669 vos_mem_copy( (tANI_U8 *) pUpdateAPWPSIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002670 pBuf += sizeof(tSirMacAddr);
2671 len -= sizeof(tSirMacAddr);
2672 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2673 return eSIR_FAILURE;
2674
2675 // Extract sessionId
2676 pUpdateAPWPSIEsReq->sessionId = *pBuf++;
2677 len--;
2678 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2679 return eSIR_FAILURE;
2680
2681 // Extract APWPSIEs
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302682 vos_mem_copy( (tSirAPWPSIEs *) &pUpdateAPWPSIEsReq->APWPSIEs, pBuf, sizeof(tSirAPWPSIEs));
Jeff Johnson295189b2012-06-20 16:38:30 -07002683 pBuf += sizeof(tSirAPWPSIEs);
2684 len -= sizeof(tSirAPWPSIEs);
2685
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002686 PELOG1(limLog(pMac, LOG1, FL("SME_UPDATE_APWPSIE_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002687
2688 if (len < 0)
2689 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002690 PELOGE(limLog(pMac, LOGE, FL("SME_UPDATE_APWPSIE_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002691 return eSIR_FAILURE;
2692 }
2693
2694 return eSIR_SUCCESS;
2695} /*** end limSetContextReqSerDes() ***/
2696
2697/**
2698 * limUpdateAPWPARSNIEsReqSerDes ()
2699 *
2700 *FUNCTION:
2701 * This function is to deserialize UpdateAPWPSIEs message
2702 *
2703 *PARAMS:
2704 *
2705 *LOGIC:
2706 *
2707 *ASSUMPTIONS:
2708 * NA
2709 *
2710 *NOTE:
2711 * NA
2712 *
2713 * @param pUpdateAPWPARSNIEsReq Pointer to tpSirUpdateAPWPARSNIEsReq being
2714 * extracted
2715 * @param pBuf Pointer to serialized buffer
2716 *
2717 * @return retCode Indicates whether message is successfully
2718 * de-serialized (eSIR_SUCCESS) or
2719 * not (eSIR_FAILURE)
2720 */
2721
2722tSirRetStatus
2723limUpdateAPWPARSNIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq, tANI_U8 *pBuf)
2724{
2725 tANI_S16 len = 0;
2726
2727 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPARSNIEsReq));)
2728
2729 if (!pUpdateAPWPARSNIEsReq || !pBuf)
2730 return eSIR_FAILURE;
2731
2732 pUpdateAPWPARSNIEsReq->messageType = limGetU16(pBuf);
2733 pBuf += sizeof(tANI_U16);
2734
2735 len = pUpdateAPWPARSNIEsReq->length = limGetU16(pBuf);
2736 pBuf += sizeof(tANI_U16);
2737
2738 if (len < (tANI_S16) sizeof(tANI_U32))
2739 return eSIR_FAILURE;
2740
2741 len -= sizeof(tANI_U32); // skip message header
2742 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2743 return eSIR_FAILURE;
2744
2745 // Extract transactionId
2746 pUpdateAPWPARSNIEsReq->transactionId = limGetU16( pBuf );
2747 pBuf += sizeof(tANI_U16);
2748 len -= sizeof( tANI_U16 );
2749 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2750 return eSIR_FAILURE;
2751
2752 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302753 vos_mem_copy( (tANI_U8 *) pUpdateAPWPARSNIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002754 pBuf += sizeof(tSirMacAddr);
2755 len -= sizeof(tSirMacAddr);
2756 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2757 return eSIR_FAILURE;
2758
2759 // Extract sessionId
2760 pUpdateAPWPARSNIEsReq->sessionId = *pBuf++;
2761 len--;
2762 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2763 return eSIR_FAILURE;
2764
2765 // Extract APWPARSNIEs
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302766 vos_mem_copy( (tSirRSNie *) &pUpdateAPWPARSNIEsReq->APWPARSNIEs, pBuf, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07002767 pBuf += sizeof(tSirRSNie);
2768 len -= sizeof(tSirRSNie);
2769
2770 if (len < 0)
2771 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002772 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002773 return eSIR_FAILURE;
2774 }
2775
2776 return eSIR_SUCCESS;
2777} /*** end limUpdateAPWPARSNIEsReqSerDes() ***/
2778