blob: 1e504381f8faf14f9f4b8e851244ee8be3831138 [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 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700869 PELOGE(limLog(pMac, LOGE, FL("NULL ptr received"));)
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
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700884 PELOG1(limLog(pMac, LOG3, FL("SME_REASSOC_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700885
886 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
887
888 if (len < (tANI_S16) sizeof(tANI_U32))
889 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700890 PELOGE(limLog(pMac, LOGE, FL("len too short %d"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700891 return eSIR_FAILURE;
892 }
893
894 len -= sizeof(tANI_U32); // skip message header
895 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
896 return eSIR_FAILURE;
897
898 // Extract sessionId
899 pJoinReq->sessionId = *pBuf++;
900 len--;
901 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
902 return eSIR_FAILURE;
903
904 // Extract transactionId
905 pJoinReq->transactionId = limGetU16(pBuf);
906 pBuf += sizeof(tANI_U16);
907 len -= sizeof(tANI_U16);
908 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
909 return eSIR_FAILURE;
910
911 // Extract ssId
912 pJoinReq->ssId.length = *pBuf++;
913 len--;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530914 vos_mem_copy( (tANI_U8 *) pJoinReq->ssId.ssId, pBuf, pJoinReq->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -0700915 pBuf += pJoinReq->ssId.length;
916 len -= pJoinReq->ssId.length;
917 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
918 return eSIR_FAILURE;
919
920 // Extract selfMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530921 vos_mem_copy( pJoinReq->selfMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700922 pBuf += sizeof(tSirMacAddr);
923 len -= sizeof(tSirMacAddr);
924 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
925 return eSIR_FAILURE;
926
927 // Extract bsstype
928 pJoinReq->bsstype = (tSirBssType) limGetU32(pBuf);
929 pBuf += sizeof(tANI_U32);
930 len -= sizeof(tANI_U32);
931 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
932 return eSIR_FAILURE;
933
934 // Extract dot11mode
935 pJoinReq->dot11mode= *pBuf++;
936 len--;
937 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
938 return eSIR_FAILURE;
939
940 // Extract bssPersona
941 pJoinReq->staPersona = *pBuf++;
942 len--;
943 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
944 return eSIR_FAILURE;
945
Jeff Johnsone7245742012-09-05 17:12:55 -0700946 // Extract cbMode
947 pJoinReq->cbMode = *pBuf++;
948 len--;
949 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
950 return eSIR_FAILURE;
951
Jeff Johnson295189b2012-06-20 16:38:30 -0700952 // Extract uapsdPerAcBitmask
953 pJoinReq->uapsdPerAcBitmask = *pBuf++;
954 len--;
955 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
956 return eSIR_FAILURE;
957
Jeff Johnson295189b2012-06-20 16:38:30 -0700958
959 // Extract operationalRateSet
960 pJoinReq->operationalRateSet.numRates= *pBuf++;
961 len--;
962 if (pJoinReq->operationalRateSet.numRates)
963 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530964 vos_mem_copy( (tANI_U8 *) pJoinReq->operationalRateSet.rate, pBuf,
965 pJoinReq->operationalRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700966 pBuf += pJoinReq->operationalRateSet.numRates;
967 len -= pJoinReq->operationalRateSet.numRates;
968 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
969 return eSIR_FAILURE;
970 }
971
972 // Extract extendedRateSet
973 pJoinReq->extendedRateSet.numRates = *pBuf++;
974 len--;
975 if (pJoinReq->extendedRateSet.numRates)
976 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530977 vos_mem_copy( pJoinReq->extendedRateSet.rate, pBuf, pJoinReq->extendedRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700978 pBuf += pJoinReq->extendedRateSet.numRates;
979 len -= pJoinReq->extendedRateSet.numRates;
980 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
981 return eSIR_FAILURE;
982 }
983
984 // Extract RSN IE
985 pJoinReq->rsnIE.length = limGetU16(pBuf);
986 pBuf += sizeof(tANI_U16);
987 len -= sizeof(tANI_U16);
988
989 if (pJoinReq->rsnIE.length)
990 {
991 // Check for RSN IE length (that includes length of type & length)
992 if ((pJoinReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2) ||
993 (pJoinReq->rsnIE.length != 2 + *(pBuf + 1)))
994 {
995 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700996 FL("Invalid RSN IE length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700997 pJoinReq->rsnIE.length);
998 return eSIR_FAILURE;
999 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301000 vos_mem_copy( (tANI_U8 *) pJoinReq->rsnIE.rsnIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001001 pBuf, pJoinReq->rsnIE.length);
1002 pBuf += pJoinReq->rsnIE.length;
1003 len -= pJoinReq->rsnIE.length; // skip RSN IE
1004 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1005 return eSIR_FAILURE;
1006 }
1007
1008#ifdef FEATURE_WLAN_CCX
1009 // Extract CCKM IE
1010 pJoinReq->cckmIE.length = limGetU16(pBuf);
1011 pBuf += sizeof(tANI_U16);
1012 len -= sizeof(tANI_U16);
1013 if (pJoinReq->cckmIE.length)
1014 {
1015 // Check for CCKM IE length (that includes length of type & length)
1016 if ((pJoinReq->cckmIE.length > SIR_MAC_MAX_IE_LENGTH) ||
1017 (pJoinReq->cckmIE.length != (2 + *(pBuf + 1))))
1018 {
1019 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001020 FL("Invalid CCKM IE length %d/%d in SME_JOIN/REASSOC_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001021 pJoinReq->cckmIE.length, 2 + *(pBuf + 1));
1022 return eSIR_FAILURE;
1023 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301024 vos_mem_copy((tANI_U8 *) pJoinReq->cckmIE.cckmIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001025 pBuf, pJoinReq->cckmIE.length);
1026 pBuf += pJoinReq->cckmIE.length;
1027 len -= pJoinReq->cckmIE.length; // skip CCKM IE
1028 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1029 return eSIR_FAILURE;
1030 }
1031#endif
1032
1033 // Extract Add IE for scan
1034 pJoinReq->addIEScan.length = limGetU16(pBuf);
1035 pBuf += sizeof(tANI_U16);
1036 len -= sizeof(tANI_U16);
1037
1038 if (pJoinReq->addIEScan.length)
1039 {
1040 // Check for IE length (that includes length of type & length)
1041 if (pJoinReq->addIEScan.length > SIR_MAC_MAX_IE_LENGTH + 2)
1042 {
1043 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001044 FL("Invalid addIE Scan length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001045 pJoinReq->addIEScan.length);
1046 return eSIR_FAILURE;
1047 }
1048 // Check for P2P IE length (that includes length of type & length)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301049 vos_mem_copy( (tANI_U8 *) pJoinReq->addIEScan.addIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001050 pBuf, pJoinReq->addIEScan.length);
1051 pBuf += pJoinReq->addIEScan.length;
1052 len -= pJoinReq->addIEScan.length; // skip add IE
1053 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1054 return eSIR_FAILURE;
1055 }
1056
1057 pJoinReq->addIEAssoc.length = limGetU16(pBuf);
1058 pBuf += sizeof(tANI_U16);
1059 len -= sizeof(tANI_U16);
1060
1061 // Extract Add IE for assoc
1062 if (pJoinReq->addIEAssoc.length)
1063 {
1064 // Check for IE length (that includes length of type & length)
1065 if (pJoinReq->addIEAssoc.length > SIR_MAC_MAX_IE_LENGTH + 2)
1066 {
1067 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001068 FL("Invalid addIE Assoc length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001069 pJoinReq->addIEAssoc.length);
1070 return eSIR_FAILURE;
1071 }
1072 // Check for P2P IE length (that includes length of type & length)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301073 vos_mem_copy( (tANI_U8 *) pJoinReq->addIEAssoc.addIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001074 pBuf, pJoinReq->addIEAssoc.length);
1075 pBuf += pJoinReq->addIEAssoc.length;
1076 len -= pJoinReq->addIEAssoc.length; // skip add IE
1077 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1078 return eSIR_FAILURE;
1079 }
1080
Venkata Prathyusha Kuntupallie8dc41d2013-04-15 14:31:36 -07001081 pJoinReq->UCEncryptionType = limGetU32(pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001082 pBuf += sizeof(tANI_U32);
1083 len -= sizeof(tANI_U32);
1084 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1085 return eSIR_FAILURE;
1086
Venkata Prathyusha Kuntupallie8dc41d2013-04-15 14:31:36 -07001087 pJoinReq->MCEncryptionType = limGetU32(pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001088 pBuf += sizeof(tANI_U32);
1089 len -= sizeof(tANI_U32);
1090 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1091 return eSIR_FAILURE;
1092
Chet Lanctot186b5732013-03-18 10:26:30 -07001093#ifdef WLAN_FEATURE_11W
1094 pJoinReq->MgmtEncryptionType = limGetU32(pBuf);
1095 pBuf += sizeof(tANI_U32);
1096 len -= sizeof(tANI_U32);
1097 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1098 return eSIR_FAILURE;
1099#endif
1100
Jeff Johnson295189b2012-06-20 16:38:30 -07001101#ifdef WLAN_FEATURE_VOWIFI_11R
1102 //is11Rconnection;
1103 pJoinReq->is11Rconnection = (tAniBool)limGetU32(pBuf);
1104 pBuf += sizeof(tAniBool);
1105 len -= sizeof(tAniBool);
1106 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1107 return eSIR_FAILURE;
1108#endif
1109
1110#ifdef FEATURE_WLAN_CCX
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05301111 //CCX version IE
1112 pJoinReq->isCCXFeatureIniEnabled = (tAniBool)limGetU32(pBuf);
1113 pBuf += sizeof(tAniBool);
1114 len -= sizeof(tAniBool);
1115 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1116 return eSIR_FAILURE;
1117
Jeff Johnson295189b2012-06-20 16:38:30 -07001118 //isCCXconnection;
1119 pJoinReq->isCCXconnection = (tAniBool)limGetU32(pBuf);
1120 pBuf += sizeof(tAniBool);
1121 len -= sizeof(tAniBool);
1122 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1123 return eSIR_FAILURE;
1124
1125 // TSPEC information
1126 pJoinReq->ccxTspecInfo.numTspecs = *pBuf++;
1127 len -= sizeof(tANI_U8);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301128 vos_mem_copy((void*)&pJoinReq->ccxTspecInfo.tspec[0], pBuf,
1129 (sizeof(tTspecInfo)* pJoinReq->ccxTspecInfo.numTspecs));
Jeff Johnson295189b2012-06-20 16:38:30 -07001130 pBuf += sizeof(tTspecInfo)*SIR_CCX_MAX_TSPEC_IES;
1131 len -= sizeof(tTspecInfo)*SIR_CCX_MAX_TSPEC_IES;
1132 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1133 return eSIR_FAILURE;
1134#endif
1135
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001136#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07001137 //isFastTransitionEnabled;
1138 pJoinReq->isFastTransitionEnabled = (tAniBool)limGetU32(pBuf);
1139 pBuf += sizeof(tAniBool);
1140 len -= sizeof(tAniBool);
1141 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1142 return eSIR_FAILURE;
1143#endif
1144
Jeff Johnson43971f52012-07-17 12:26:56 -07001145#ifdef FEATURE_WLAN_LFR
1146 //isFastRoamIniFeatureEnabled;
1147 pJoinReq->isFastRoamIniFeatureEnabled = (tAniBool)limGetU32(pBuf);
1148 pBuf += sizeof(tAniBool);
1149 len -= sizeof(tAniBool);
1150 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1151 return eSIR_FAILURE;
1152#endif
1153
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001154 //txLdpcIniFeatureEnabled
1155 pJoinReq->txLdpcIniFeatureEnabled= *pBuf++;
1156 len--;
1157 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1158 return eSIR_FAILURE;
1159
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001160 //txBFIniFeatureEnabled
1161 pJoinReq->txBFIniFeatureEnabled= *pBuf++;
1162 len--;
1163 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1164 return eSIR_FAILURE;
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001165
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001166 //txBFCsnValue
1167 pJoinReq->txBFCsnValue= *pBuf++;
1168 len--;
1169 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1170 return eSIR_FAILURE;
1171
krunal soni5afa96c2013-09-06 22:19:02 -07001172 pJoinReq->isAmsduSupportInAMPDU= *pBuf++;
1173 len--;
1174 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1175 return eSIR_FAILURE;
1176
Sandeep Puligillaaea98a22013-12-04 13:36:32 +05301177 pJoinReq->isWMEenabled = (tAniBool)limGetU32(pBuf);
1178 pBuf += sizeof(tAniBool);
1179 len -= sizeof(tAniBool);
1180 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1181 return eSIR_FAILURE;
1182
1183 pJoinReq->isQosEnabled = (tAniBool)limGetU32(pBuf);
1184 pBuf += sizeof(tAniBool);
1185 len -= sizeof(tAniBool);
1186 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1187 return eSIR_FAILURE;
1188
Jeff Johnson295189b2012-06-20 16:38:30 -07001189 // Extract Titan CB Neighbor BSS info
1190 pJoinReq->cbNeighbors.cbBssFoundPri = *pBuf;
1191 pBuf++;
1192 pJoinReq->cbNeighbors.cbBssFoundSecUp = *pBuf;
1193 pBuf++;
1194 pJoinReq->cbNeighbors.cbBssFoundSecDown = *pBuf;
1195 pBuf++;
1196 len -= 3;
1197
1198 // Extract Spectrum Mgt Indicator
1199 pJoinReq->spectrumMgtIndicator = (tAniBool) limGetU32(pBuf);
1200 pBuf += sizeof(tAniBool);
1201 len -= sizeof(tAniBool);
1202
1203 pJoinReq->powerCap.minTxPower = *pBuf++;
1204 pJoinReq->powerCap.maxTxPower = *pBuf++;
1205 len -=2;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001206 limLog(pMac, LOG1, FL("Power Caps: Min power = %d, Max power = %d"), pJoinReq->powerCap.minTxPower, pJoinReq->powerCap.maxTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07001207
1208 pJoinReq->supportedChannels.numChnl = *pBuf++;
1209 len--;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301210 vos_mem_copy( (tANI_U8 *) pJoinReq->supportedChannels.channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001211 pBuf, pJoinReq->supportedChannels.numChnl);
1212 pBuf += pJoinReq->supportedChannels.numChnl;
1213 len-= pJoinReq->supportedChannels.numChnl;
1214
1215 PELOG2(limLog(pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001216 FL("spectrumInd ON: minPower %d, maxPower %d , numChnls %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001217 pJoinReq->powerCap.minTxPower,
1218 pJoinReq->powerCap.maxTxPower,
1219 pJoinReq->supportedChannels.numChnl);)
1220
1221 // Extract uapsdPerAcBitmask
1222 pJoinReq->uapsdPerAcBitmask = *pBuf++;
1223 len--;
1224 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1225 return eSIR_FAILURE;
1226
Jeff Johnson295189b2012-06-20 16:38:30 -07001227 //
1228 // NOTE - tSirBssDescription is now moved to the end
1229 // of tSirSmeJoinReq structure. This is to accomodate
1230 // the variable length data member ieFields[1]
1231 //
1232 if (limGetBssDescription( pMac, &pJoinReq->bssDescription,
1233 len, &lenUsed, pBuf) == eSIR_FAILURE)
1234 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001235 PELOGE(limLog(pMac, LOGE, FL("get bss description failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001236 return eSIR_FAILURE;
1237 }
1238 PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, (tANI_U8 *) &(pJoinReq->bssDescription), pJoinReq->bssDescription.length + 2);)
1239 pBuf += lenUsed;
1240 len -= lenUsed;
Jeff Johnson295189b2012-06-20 16:38:30 -07001241
1242 return eSIR_SUCCESS;
1243} /*** end limJoinReqSerDes() ***/
1244
1245
1246/**---------------------------------------------------------------
1247\fn limAssocIndSerDes
1248\brief This function is called by limProcessMlmAssocInd() to
1249\ populate the SME_ASSOC_IND message based on the received
1250\ MLM_ASSOC_IND.
1251\
1252\param pMac
1253\param pAssocInd - Pointer to the received tLimMlmAssocInd
1254\param pBuf - Pointer to serialized buffer
1255\param psessionEntry - pointer to PE session entry
1256\
1257\return None
1258------------------------------------------------------------------*/
1259void
1260limAssocIndSerDes(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
1261{
1262 tANI_U8 *pLen = pBuf;
1263 tANI_U16 mLen = 0;
1264
1265#ifdef PE_DEBUG_LOG1
1266 tANI_U8 *pTemp = pBuf;
1267#endif
1268
Jeff Johnson295189b2012-06-20 16:38:30 -07001269
1270 mLen = sizeof(tANI_U32);
1271 mLen += sizeof(tANI_U8);
1272 pBuf += sizeof(tANI_U16);
1273 *pBuf = psessionEntry->smeSessionId;
1274 pBuf += sizeof(tANI_U8);
1275
1276 // Fill in peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301277 vos_mem_copy( pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001278 pBuf += sizeof(tSirMacAddr);
1279 mLen += sizeof(tSirMacAddr);
1280
1281 // Fill in aid
1282 limCopyU16(pBuf, pAssocInd->aid);
1283 pBuf += sizeof(tANI_U16);
1284 mLen += sizeof(tANI_U16);
1285
1286 // Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301287 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001288 pBuf += sizeof(tSirMacAddr);
1289 mLen += sizeof(tSirMacAddr);
1290
1291 // Fill in staId
1292 limCopyU16(pBuf, psessionEntry->staId);
1293 pBuf += sizeof(tANI_U16);
1294 mLen += sizeof(tANI_U16);
1295
1296 // Fill in authType
1297 limCopyU32(pBuf, pAssocInd->authType);
1298 pBuf += sizeof(tANI_U32);
1299 mLen += sizeof(tANI_U32);
1300
1301 // Fill in ssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301302 vos_mem_copy( pBuf, (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001303 pBuf += (1 + pAssocInd->ssId.length);
1304 mLen += (1 + pAssocInd->ssId.length);
1305
1306 // Fill in rsnIE
1307 limCopyU16(pBuf, pAssocInd->rsnIE.length);
1308 pBuf += sizeof(tANI_U16);
1309 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301310 vos_mem_copy( pBuf, (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001311 pAssocInd->rsnIE.length);
1312 pBuf += pAssocInd->rsnIE.length;
1313 mLen += pAssocInd->rsnIE.length;
1314
Jeff Johnson295189b2012-06-20 16:38:30 -07001315
Jeff Johnson295189b2012-06-20 16:38:30 -07001316 limCopyU32(pBuf, pAssocInd->spectrumMgtIndicator);
1317 pBuf += sizeof(tAniBool);
1318 mLen += sizeof(tAniBool);
1319
1320 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1321 {
1322 *pBuf = pAssocInd->powerCap.minTxPower;
1323 pBuf++;
1324 *pBuf = pAssocInd->powerCap.maxTxPower;
1325 pBuf++;
1326 mLen += sizeof(tSirMacPowerCapInfo);
1327
1328 *pBuf = pAssocInd->supportedChannels.numChnl;
1329 pBuf++;
1330 mLen++;
1331
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301332 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -07001333 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
1334 pAssocInd->supportedChannels.numChnl);
1335
1336
1337 pBuf += pAssocInd->supportedChannels.numChnl;
1338 mLen += pAssocInd->supportedChannels.numChnl;
1339 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001340 limCopyU32(pBuf, pAssocInd->WmmStaInfoPresent);
1341 pBuf += sizeof(tANI_U32);
1342 mLen += sizeof(tANI_U32);
Jeff Johnson295189b2012-06-20 16:38:30 -07001343 // Fill in length of SME_ASSOC_IND message
1344 limCopyU16(pLen, mLen);
1345
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001346 PELOG1(limLog(pMac, LOG1, FL("Sending SME_ASSOC_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001347 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1348} /*** end limAssocIndSerDes() ***/
1349
1350
1351
1352/**
1353 * limAssocCnfSerDes()
1354 *
1355 *FUNCTION:
1356 * This function is called by limProcessLmmMessages() when
1357 * SME_ASSOC_CNF or SME_REASSOC_CNF message is received from
1358 * upper layer software.
1359 *
1360 *PARAMS:
1361 *
1362 *LOGIC:
1363 *
1364 *ASSUMPTIONS:
1365 * NA
1366 *
1367 *NOTE:
1368 * NA
1369 *
1370 * @param pAssocCnf Pointer to tSirSmeAssocCnf being extracted into
1371 * @param pBuf Pointer to serialized buffer
1372 * @return retCode Indicates whether message is successfully
1373 * de-serialized (eSIR_SUCCESS) or
1374 * not (eSIR_FAILURE)
1375 */
1376
1377tSirRetStatus
1378limAssocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeAssocCnf pAssocCnf, tANI_U8 *pBuf)
1379{
1380#ifdef PE_DEBUG_LOG1
1381 tANI_U8 *pTemp = pBuf;
1382#endif
1383
1384 if (!pAssocCnf || !pBuf)
1385 return eSIR_FAILURE;
1386
1387 pAssocCnf->messageType = limGetU16(pBuf);
1388 pBuf += sizeof(tANI_U16);
1389
1390 pAssocCnf->length = limGetU16(pBuf);
1391 pBuf += sizeof(tANI_U16);
1392
1393 if (pAssocCnf->messageType == eWNI_SME_ASSOC_CNF)
1394 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001395 PELOG1(limLog(pMac, LOG1, FL("SME_ASSOC_CNF length %d bytes is:"), pAssocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001396 }
1397 else
1398 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001399 PELOG1(limLog(pMac, LOG1, FL("SME_REASSOC_CNF length %d bytes is:"), pAssocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001400 }
1401 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pAssocCnf->length);)
1402
1403 // status code
1404 pAssocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
1405 pBuf += sizeof(tSirResultCodes);
1406
1407 // bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301408 vos_mem_copy( pAssocCnf->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001409 pBuf += sizeof(tSirMacAddr);
1410
1411 // peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301412 vos_mem_copy( pAssocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001413 pBuf += sizeof(tSirMacAddr);
1414
1415
1416 pAssocCnf->aid = limGetU16(pBuf);
1417 pBuf += sizeof(tANI_U16);
1418 // alternateBssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301419 vos_mem_copy( pAssocCnf->alternateBssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001420 pBuf += sizeof(tSirMacAddr);
1421
1422 // alternateChannelId
1423 pAssocCnf->alternateChannelId = *pBuf;
1424 pBuf++;
1425
1426 return eSIR_SUCCESS;
1427} /*** end limAssocCnfSerDes() ***/
1428
1429
1430
1431/**
1432 * limDisassocCnfSerDes()
1433 *
1434 *FUNCTION:
1435 * This function is called by limProcessSmeMessages() when
1436 * SME_DISASSOC_CNF message is received from upper layer software.
1437 *
1438 *PARAMS:
1439 *
1440 *LOGIC:
1441 *
1442 *ASSUMPTIONS:
1443 * NA
1444 *
1445 *NOTE:
1446 * NA
1447 *
1448 * @param pDisassocCnf Pointer to tSirSmeDisassocCnf being
1449 * extracted into
1450 * @param pBuf Pointer to serialized buffer
1451 * @return retCode Indicates whether message is successfully
1452 * de-serialized (eSIR_SUCCESS) or
1453 * not (eSIR_FAILURE)
1454 */
1455
1456tSirRetStatus
1457limDisassocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeDisassocCnf pDisassocCnf, tANI_U8 *pBuf)
1458{
1459#ifdef PE_DEBUG_LOG1
1460 tANI_U8 *pTemp = pBuf;
1461#endif
1462
1463 if (!pDisassocCnf || !pBuf)
1464 return eSIR_FAILURE;
1465
1466 pDisassocCnf->messageType = limGetU16(pBuf);
1467 pBuf += sizeof(tANI_U16);
1468
1469 pDisassocCnf->length = limGetU16(pBuf);
1470 pBuf += sizeof(tANI_U16);
1471
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001472 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_CNF length %d bytes is:"), pDisassocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001473 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pDisassocCnf->length);)
1474
1475 pDisassocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
1476 pBuf += sizeof(tSirResultCodes);
1477
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301478 vos_mem_copy( pDisassocCnf->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001479 pBuf += sizeof(tSirMacAddr);
Jeff Johnson62c27982013-02-27 17:53:55 -08001480
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301481 vos_mem_copy( pDisassocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001482
Jeff Johnson62c27982013-02-27 17:53:55 -08001483
Jeff Johnson295189b2012-06-20 16:38:30 -07001484 return eSIR_SUCCESS;
1485} /*** end limDisassocCnfSerDes() ***/
1486
1487
1488
Jeff Johnson295189b2012-06-20 16:38:30 -07001489
1490
1491/**---------------------------------------------------------------
1492\fn limReassocIndSerDes
1493\brief This function is called by limProcessMlmReassocInd() to
1494\ populate the SME_REASSOC_IND message based on the received
1495\ MLM_REASSOC_IND.
1496\
1497\param pMac
1498\param pReassocInd - Pointer to the received tLimMlmReassocInd
1499\param pBuf - Pointer to serialized buffer
1500\param psessionEntry - pointer to PE session entry
1501\
1502\return None
1503------------------------------------------------------------------*/
1504void
1505limReassocIndSerDes(tpAniSirGlobal pMac, tpLimMlmReassocInd pReassocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
1506{
1507 tANI_U8 *pLen = pBuf;
1508 tANI_U16 mLen = 0;
1509
1510#ifdef PE_DEBUG_LOG1
1511 tANI_U8 *pTemp = pBuf;
1512#endif
1513
Jeff Johnson295189b2012-06-20 16:38:30 -07001514
1515 mLen = sizeof(tANI_U32);
1516 pBuf += sizeof(tANI_U16);
1517 *pBuf++ = psessionEntry->smeSessionId;
1518 mLen += sizeof(tANI_U8);
1519
1520 // Fill in peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301521 vos_mem_copy( pBuf, pReassocInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001522 pBuf += sizeof(tSirMacAddr);
1523 mLen += sizeof(tSirMacAddr);
1524
1525 // Fill in oldMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301526 vos_mem_copy( pBuf, pReassocInd->currentApAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001527 pBuf += sizeof(tSirMacAddr);
1528 mLen += sizeof(tSirMacAddr);
1529
1530 // Fill in aid
1531 limCopyU16(pBuf, pReassocInd->aid);
1532 pBuf += sizeof(tANI_U16);
1533 mLen += sizeof(tANI_U16);
1534
1535 // Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301536 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001537 pBuf += sizeof(tSirMacAddr);
1538 mLen += sizeof(tSirMacAddr);
1539
1540 // Fill in staId
1541 limCopyU16(pBuf, psessionEntry->staId);
1542 pBuf += sizeof(tANI_U16);
1543 mLen += sizeof(tANI_U16);
1544
1545 // Fill in authType
1546 limCopyU32(pBuf, pReassocInd->authType);
1547 pBuf += sizeof(tAniAuthType);
1548 mLen += sizeof(tAniAuthType);
1549
1550 // Fill in ssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301551 vos_mem_copy( pBuf, (tANI_U8 *) &(pReassocInd->ssId),
Jeff Johnson295189b2012-06-20 16:38:30 -07001552 pReassocInd->ssId.length + 1);
1553 pBuf += 1 + pReassocInd->ssId.length;
1554 mLen += pReassocInd->ssId.length + 1;
1555
1556 // Fill in rsnIE
1557 limCopyU16(pBuf, pReassocInd->rsnIE.length);
1558 pBuf += sizeof(tANI_U16);
1559 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301560 vos_mem_copy( pBuf, (tANI_U8 *) &(pReassocInd->rsnIE.rsnIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001561 pReassocInd->rsnIE.length);
1562 pBuf += pReassocInd->rsnIE.length;
1563 mLen += pReassocInd->rsnIE.length;
1564
1565 // Fill in addIE
1566 limCopyU16(pBuf, pReassocInd->addIE.length);
1567 pBuf += sizeof(tANI_U16);
1568 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301569 vos_mem_copy( pBuf, (tANI_U8*) &(pReassocInd->addIE.addIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001570 pReassocInd->addIE.length);
1571 pBuf += pReassocInd->addIE.length;
1572 mLen += pReassocInd->addIE.length;
1573
Jeff Johnson295189b2012-06-20 16:38:30 -07001574
Jeff Johnson295189b2012-06-20 16:38:30 -07001575 limCopyU32(pBuf, pReassocInd->spectrumMgtIndicator);
1576 pBuf += sizeof(tAniBool);
1577 mLen += sizeof(tAniBool);
1578
1579 if (pReassocInd->spectrumMgtIndicator == eSIR_TRUE)
1580 {
1581 *pBuf = pReassocInd->powerCap.minTxPower;
1582 pBuf++;
1583 *pBuf = pReassocInd->powerCap.maxTxPower;
1584 pBuf++;
1585 mLen += sizeof(tSirMacPowerCapInfo);
1586
1587 *pBuf = pReassocInd->supportedChannels.numChnl;
1588 pBuf++;
1589 mLen++;
1590
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301591 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -07001592 (tANI_U8 *) &(pReassocInd->supportedChannels.channelList),
1593 pReassocInd->supportedChannels.numChnl);
1594
1595 pBuf += pReassocInd->supportedChannels.numChnl;
1596 mLen += pReassocInd->supportedChannels.numChnl;
1597 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001598 limCopyU32(pBuf, pReassocInd->WmmStaInfoPresent);
1599 pBuf += sizeof(tANI_U32);
1600 mLen += sizeof(tANI_U32);
Jeff Johnson295189b2012-06-20 16:38:30 -07001601
1602 // Fill in length of SME_REASSOC_IND message
1603 limCopyU16(pLen, mLen);
1604
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001605 PELOG1(limLog(pMac, LOG1, FL("Sending SME_REASSOC_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001606 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1607} /*** end limReassocIndSerDes() ***/
1608
1609
1610/**
1611 * limAuthIndSerDes()
1612 *
1613 *FUNCTION:
1614 * This function is called by limProcessMlmAuthInd() while sending
1615 * SME_AUTH_IND to host
1616 *
1617 *PARAMS:
1618 *
1619 *LOGIC:
1620 *
1621 *ASSUMPTIONS:
1622 * NA
1623 *
1624 *NOTE:
1625 * NA
1626 *
1627 * @param pAuthInd Pointer to tSirSmeAuthInd being sent
1628 * @param pBuf Pointer to serialized buffer
1629 *
1630 * @return None
1631 */
1632
1633void
1634limAuthIndSerDes(tpAniSirGlobal pMac, tpLimMlmAuthInd pAuthInd, tANI_U8 *pBuf)
1635{
1636 tANI_U8 *pLen = pBuf;
1637 tANI_U16 mLen = 0;
1638
1639#ifdef PE_DEBUG_LOG1
1640 tANI_U8 *pTemp = pBuf;
1641#endif
1642
1643 mLen = sizeof(tANI_U32);
1644 pBuf += sizeof(tANI_U16);
1645 *pBuf++ = pAuthInd->sessionId;
1646 mLen += sizeof(tANI_U8);
1647
1648 // BTAMP TODO: Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301649 vos_mem_set(pBuf, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001650 pBuf += sizeof(tSirMacAddr);
1651 mLen += sizeof(tSirMacAddr);
1652
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301653 vos_mem_copy( pBuf, pAuthInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001654 pBuf += sizeof(tSirMacAddr);
1655 mLen += sizeof(tSirMacAddr);
1656
1657 limCopyU32(pBuf, pAuthInd->authType);
1658 pBuf += sizeof(tAniAuthType);
1659 mLen += sizeof(tAniAuthType);
1660
1661 limCopyU16(pLen, mLen);
1662
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001663 PELOG1(limLog(pMac, LOG1, FL("Sending SME_AUTH_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001664 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1665} /*** end limAuthIndSerDes() ***/
1666
1667
1668
1669/**
1670 * limSetContextReqSerDes()
1671 *
1672 *FUNCTION:
1673 * This function is called by limProcessSmeMessages() upon receiving
1674 * SME_SETCONTEXT_REQ from host
1675 *
1676 *PARAMS:
1677 *
1678 *LOGIC:
1679 *
1680 *ASSUMPTIONS:
1681 * NA
1682 *
1683 *NOTE:
1684 * NA
1685 *
1686 * @param pSetContextReq Pointer to tSirSmeSetContextReq being
1687 * extracted
1688 * @param pBuf Pointer to serialized buffer
1689 *
1690 * @return retCode Indicates whether message is successfully
1691 * de-serialized (eSIR_SUCCESS) or
1692 * not (eSIR_FAILURE)
1693 */
1694
1695tSirRetStatus
1696limSetContextReqSerDes(tpAniSirGlobal pMac, tpSirSmeSetContextReq pSetContextReq, tANI_U8 *pBuf)
1697{
1698 tANI_S16 len = 0;
1699 tANI_U16 totalKeySize = sizeof(tANI_U8); // initialized to sizeof numKeys
1700 tANI_U8 numKeys;
1701 tANI_U8 *pKeys;
1702
1703#ifdef PE_DEBUG_LOG1
1704 tANI_U8 *pTemp = pBuf;
1705#endif
1706 if (!pSetContextReq || !pBuf)
1707 return eSIR_FAILURE;
1708
1709 pSetContextReq->messageType = limGetU16(pBuf);
1710 pBuf += sizeof(tANI_U16);
1711
1712 len = pSetContextReq->length = limGetU16(pBuf);
1713 pBuf += sizeof(tANI_U16);
1714
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001715 PELOG1(limLog(pMac, LOG1, FL("SME_SETCONTEXT_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001716 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
1717
1718 if (len < (tANI_S16) sizeof(tANI_U32))
1719 return eSIR_FAILURE;
1720
1721 len -= sizeof(tANI_U32); // skip message header
1722 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1723 return eSIR_FAILURE;
1724
1725 // Extract sessionId
1726 pSetContextReq->sessionId = *pBuf++;
1727 len--;
1728 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1729 return eSIR_FAILURE;
1730
1731 // Extract transactionId
1732 pSetContextReq->transactionId = sirReadU16N(pBuf);
1733 pBuf += sizeof(tANI_U16);
1734 len -= sizeof(tANI_U16);
1735 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1736 return eSIR_FAILURE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301737 vos_mem_copy( (tANI_U8 *) pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001738 pBuf, sizeof(tSirMacAddr));
1739 pBuf += sizeof(tSirMacAddr);
1740 len -= sizeof(tSirMacAddr);
1741 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1742 return eSIR_FAILURE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301743 vos_mem_copy( pSetContextReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001744 pBuf += sizeof(tSirMacAddr);
1745 len -= sizeof(tSirMacAddr);
1746 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1747 return eSIR_FAILURE;
1748
Jeff Johnson295189b2012-06-20 16:38:30 -07001749
1750// pSetContextReq->qosInfoPresent = limGetU32(pBuf);
1751// pBuf += sizeof(tAniBool);
1752
1753// if (pSetContextReq->qosInfoPresent)
1754// {
1755// len = limGetQosInfo(&pSetContextReq->qos, pBuf);
1756// pBuf += len;
1757// }
1758
1759 pSetContextReq->keyMaterial.length = limGetU16(pBuf);
1760 pBuf += sizeof(tANI_U16);
1761 len -= sizeof(tANI_U16);
1762 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1763 return eSIR_FAILURE;
1764
1765 pSetContextReq->keyMaterial.edType = (tAniEdType) limGetU32(pBuf);
1766 pBuf += sizeof(tAniEdType);
1767 len -= sizeof(tAniEdType);
1768 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1769 return eSIR_FAILURE;
1770
1771 numKeys = pSetContextReq->keyMaterial.numKeys = *pBuf++;
1772 len -= sizeof(numKeys);
1773
1774 if (numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
1775 return eSIR_FAILURE;
1776
1777 /** Initialize the Default Keys if no Keys are being sent from the upper layer*/
1778 if( limCheckRemainingLength(pMac, len) == eSIR_FAILURE) {
1779 tpSirKeys pKeyinfo = pSetContextReq->keyMaterial.key;
1780
1781 pKeyinfo->keyId = 0;
1782 pKeyinfo->keyDirection = eSIR_TX_RX;
1783 pKeyinfo->keyLength = 0;
1784
1785 if (!limIsAddrBC(pSetContextReq->peerMacAddr))
1786 pKeyinfo->unicast = 1;
1787 else
1788 pKeyinfo->unicast = 0;
1789 }else {
1790 pKeys = (tANI_U8 *) pSetContextReq->keyMaterial.key;
1791 do {
1792 tANI_U32 keySize = limGetKeysInfo(pMac, (tpSirKeys) pKeys,
1793 pBuf);
1794 pBuf += keySize;
1795 pKeys += sizeof(tSirKeys);
1796 totalKeySize += (tANI_U16) keySize;
1797 if (numKeys == 0)
1798 break;
1799 numKeys--;
1800 }while (numKeys);
1801 }
1802 return eSIR_SUCCESS;
1803} /*** end limSetContextReqSerDes() ***/
1804
1805/**
1806 * limRemoveKeyReqSerDes()
1807 *
1808 *FUNCTION:
1809 * This function is called by limProcessSmeMessages() upon receiving
1810 * SME_REMOVEKEY_REQ from host
1811 *
1812 *PARAMS:
1813 *
1814 *LOGIC:
1815 *
1816 *ASSUMPTIONS:
1817 * NA
1818 *
1819 *NOTE:
1820 * NA
1821 *
1822 * @param pRemoveKeyReq Pointer to tSirSmeRemoveKeyReq being
1823 * extracted
1824 * @param pBuf Pointer to serialized buffer
1825 *
1826 * @return retCode Indicates whether message is successfully
1827 * de-serialized (eSIR_SUCCESS) or
1828 * not (eSIR_FAILURE)
1829 */
1830
1831tSirRetStatus
1832limRemoveKeyReqSerDes(tpAniSirGlobal pMac, tpSirSmeRemoveKeyReq pRemoveKeyReq, tANI_U8 *pBuf)
1833{
1834 tANI_S16 len = 0;
1835
1836#ifdef PE_DEBUG_LOG1
1837 tANI_U8 *pTemp = pBuf;
1838#endif
1839 if (!pRemoveKeyReq || !pBuf)
1840 return eSIR_FAILURE;
1841
1842 pRemoveKeyReq->messageType = limGetU16(pBuf);
1843 pBuf += sizeof(tANI_U16);
1844
1845 len = pRemoveKeyReq->length = limGetU16(pBuf);
1846 pBuf += sizeof(tANI_U16);
1847
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001848 PELOG1(limLog(pMac, LOG1, FL("SME_REMOVEKEY_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001849 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
1850
1851 if (len < (tANI_S16) sizeof(tANI_U32))
1852 return eSIR_FAILURE;
1853
1854 len -= sizeof(tANI_U32); // skip message header
1855 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1856 return eSIR_FAILURE;
1857
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301858 vos_mem_copy( (tANI_U8 *) pRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001859 pBuf, sizeof(tSirMacAddr));
1860 pBuf += sizeof(tSirMacAddr);
1861 len -= sizeof(tSirMacAddr);
1862 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1863 return eSIR_FAILURE;
1864
Jeff Johnson295189b2012-06-20 16:38:30 -07001865
1866 pRemoveKeyReq->edType = *pBuf;
1867 pBuf += sizeof(tANI_U8);
1868 len -= sizeof(tANI_U8);
1869 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1870 return eSIR_FAILURE;
1871
1872 pRemoveKeyReq->wepType = *pBuf;
1873
1874 pBuf += sizeof(tANI_U8);
1875 len -= sizeof(tANI_U8);
1876 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1877 return eSIR_FAILURE;
1878
1879 pRemoveKeyReq->keyId = *pBuf;
1880
1881 pBuf += sizeof(tANI_U8);
1882 len -= sizeof(tANI_U8);
1883 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1884 return eSIR_FAILURE;
1885
1886 pRemoveKeyReq->unicast = *pBuf;
1887 len--;
1888 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1889 return eSIR_FAILURE;
1890
1891 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301892 vos_mem_copy( pRemoveKeyReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001893 pBuf += sizeof(tSirMacAddr);
1894 len -= sizeof(tSirMacAddr);
1895 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1896 return eSIR_FAILURE;
1897
1898 // Extract sessionId
1899 pRemoveKeyReq->sessionId = *pBuf++;
1900 len--;
1901 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1902 return eSIR_FAILURE;
1903
1904 // Extract transactionId
1905 pRemoveKeyReq->transactionId = sirReadU16N(pBuf);
1906 pBuf += sizeof(tANI_U16);
1907 len -= sizeof(tANI_U16);
1908 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1909 return eSIR_FAILURE;
1910
1911 return eSIR_SUCCESS;
1912} /*** end limRemoveKeyReqSerDes() ***/
1913
1914
1915
1916/**
1917 * limDisassocReqSerDes()
1918 *
1919 *FUNCTION:
1920 * This function is called by limProcessSmeMessages() upon receiving
1921 * SME_DISASSOC_REQ from host
1922 *
1923 *PARAMS:
1924 *
1925 *LOGIC:
1926 *
1927 *ASSUMPTIONS:
1928 * NA
1929 *
1930 *NOTE:
1931 * NA
1932 *
1933 * @param pDisassocReq Pointer to tSirSmeDisassocReq being extracted
1934 * @param pBuf Pointer to serialized buffer
1935 *
1936 * @return retCode Indicates whether message is successfully
1937 * de-serialized (eSIR_SUCCESS) or
1938 * not (eSIR_FAILURE)
1939 */
1940
1941tSirRetStatus
1942limDisassocReqSerDes(tpAniSirGlobal pMac, tSirSmeDisassocReq *pDisassocReq, tANI_U8 *pBuf)
1943{
1944 tANI_S16 len = 0;
1945#ifdef PE_DEBUG_LOG1
1946 tANI_U8 *pTemp = pBuf;
1947#endif
1948
1949 if (!pDisassocReq || !pBuf)
1950 return eSIR_FAILURE;
1951
1952 pDisassocReq->messageType = limGetU16(pBuf);
1953 pBuf += sizeof(tANI_U16);
1954
1955 len = pDisassocReq->length = limGetU16(pBuf);
1956 pBuf += sizeof(tANI_U16);
1957
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001958 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001959 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
1960
1961 if (len < (tANI_S16) sizeof(tANI_U32))
1962 return eSIR_FAILURE;
1963
1964 len -= sizeof(tANI_U32); // skip message header
1965 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1966 return eSIR_FAILURE;
1967
1968 // Extract sessionID
1969 pDisassocReq->sessionId = *pBuf;
1970 pBuf += sizeof(tANI_U8);
1971 len -= sizeof(tANI_U8);
1972 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1973 return eSIR_FAILURE;
1974
1975 // Extract transactionid
1976 pDisassocReq->transactionId = limGetU16(pBuf);
1977 pBuf += sizeof(tANI_U16);
1978 len -= sizeof(tANI_U16);
1979 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1980 return eSIR_FAILURE;
1981
1982 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301983 vos_mem_copy( (tANI_U8 *) pDisassocReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001984 pBuf += sizeof(tSirMacAddr);
1985 len -= sizeof(tSirMacAddr);
1986 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1987 return eSIR_FAILURE;
1988
1989 // Extract peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301990 vos_mem_copy( pDisassocReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001991 pBuf += sizeof(tSirMacAddr);
1992 len -= sizeof(tSirMacAddr);
1993 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1994 return eSIR_FAILURE;
1995
1996 // Extract reasonCode
1997 pDisassocReq->reasonCode = limGetU16(pBuf);
1998 pBuf += sizeof(tANI_U16);
1999 len -= sizeof(tANI_U16);
2000 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2001 return eSIR_FAILURE;
2002
2003 pDisassocReq->doNotSendOverTheAir = *pBuf;
2004 pBuf += sizeof(tANI_U8);
2005 len -= sizeof(tANI_U8);
2006
Jeff Johnson295189b2012-06-20 16:38:30 -07002007
2008 return eSIR_SUCCESS;
2009} /*** end limDisassocReqSerDes() ***/
2010
2011
2012
2013/**
2014 * limDeauthReqSerDes()
2015 *
2016 *FUNCTION:
2017 * This function is called by limProcessSmeMessages() upon receiving
2018 * SME_DEAUTH_REQ from host
2019 *
2020 *PARAMS:
2021 *
2022 *LOGIC:
2023 *
2024 *ASSUMPTIONS:
2025 * NA
2026 *
2027 *NOTE:
2028 * NA
2029 *
2030 * @param pDeauthReq Pointer to tSirSmeDeauthReq being extracted
2031 * @param pBuf Pointer to serialized buffer
2032 *
2033 * @return retCode Indicates whether message is successfully
2034 * de-serialized (eSIR_SUCCESS) or
2035 * not (eSIR_FAILURE)
2036 */
2037tSirRetStatus
2038limDeauthReqSerDes(tpAniSirGlobal pMac, tSirSmeDeauthReq *pDeauthReq, tANI_U8 *pBuf)
2039{
2040 tANI_S16 len = 0;
2041
2042#ifdef PE_DEBUG_LOG1
2043 tANI_U8 *pTemp = pBuf;
2044#endif
2045
2046 if (!pDeauthReq || !pBuf)
2047 return eSIR_FAILURE;
2048
2049 pDeauthReq->messageType = limGetU16(pBuf);
2050 pBuf += sizeof(tANI_U16);
2051
2052 len = pDeauthReq->length = limGetU16(pBuf);
2053 pBuf += sizeof(tANI_U16);
2054
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002055 PELOG1(limLog(pMac, LOG1, FL("SME_DEAUTH_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002056 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2057
2058 if (len < (tANI_S16) sizeof(tANI_U32))
2059 return eSIR_FAILURE;
2060
2061 len -= sizeof(tANI_U32); // skip message header
2062 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2063 return eSIR_FAILURE;
2064
2065 // Extract sessionId
2066 pDeauthReq->sessionId = *pBuf++;
2067 len--;
2068 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2069 return eSIR_FAILURE;
2070
2071 // Extract transactionId
2072 pDeauthReq->transactionId = limGetU16(pBuf);
2073 pBuf += sizeof(tANI_U16);
2074 len -= sizeof(tANI_U16);
2075 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2076 return eSIR_FAILURE;
2077
2078 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302079 vos_mem_copy( pDeauthReq->bssId, 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 peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302086 vos_mem_copy( pDeauthReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002087 pBuf += sizeof(tSirMacAddr);
2088 len -= sizeof(tSirMacAddr);
2089 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2090 return eSIR_FAILURE;
2091
2092 // Extract reasonCode
2093 pDeauthReq->reasonCode = limGetU16(pBuf);
2094 pBuf += sizeof(tANI_U16);
2095 len -= sizeof(tANI_U16);
2096
Jeff Johnson295189b2012-06-20 16:38:30 -07002097
2098 return eSIR_SUCCESS;
2099} /*** end limDisassocReqSerDes() ***/
2100
2101
2102
2103
Jeff Johnson295189b2012-06-20 16:38:30 -07002104
2105
2106/**
2107 * limStatSerDes()
2108 *
2109 *FUNCTION:
2110 * This function is called by limSendSmeDisassocNtf() while sending
2111 * SME_DISASSOC_IND/eWNI_SME_DISASSOC_RSP to host
2112 *
2113 *PARAMS:
2114 *
2115 *LOGIC:
2116 *
2117 *ASSUMPTIONS:
2118 * NA
2119 *
2120 *NOTE:
2121 * NA
2122 *
2123 * @param pAssocInd Pointer to tpAniStaStatStruct being sent
2124 * @param pBuf Pointer to serialized buffer
2125 *
2126 * @return None
2127 */
2128
2129void
2130limStatSerDes(tpAniSirGlobal pMac, tpAniStaStatStruct pStat, tANI_U8 *pBuf)
2131{
2132#ifdef PE_DEBUG_LOG1
2133 tANI_U8 *pTemp = pBuf;
2134#endif
2135
2136 limCopyU32(pBuf, pStat->sentAesBlksUcastHi);
2137 pBuf += sizeof(tANI_U32);
2138
2139 limCopyU32(pBuf, pStat->sentAesBlksUcastLo);
2140 pBuf += sizeof(tANI_U32);
2141
2142 limCopyU32(pBuf, pStat->recvAesBlksUcastHi);
2143 pBuf += sizeof(tANI_U32);
2144
2145 limCopyU32(pBuf, pStat->recvAesBlksUcastLo);
2146 pBuf += sizeof(tANI_U32);
2147
2148 limCopyU32(pBuf, pStat->aesFormatErrorUcastCnts);
2149 pBuf += sizeof(tANI_U32);
2150
2151 limCopyU32(pBuf, pStat->aesReplaysUcast);
2152 pBuf += sizeof(tANI_U32);
2153
2154 limCopyU32(pBuf, pStat->aesDecryptErrUcast);
2155 pBuf += sizeof(tANI_U32);
2156
2157 limCopyU32(pBuf, pStat->singleRetryPkts);
2158 pBuf += sizeof(tANI_U32);
2159
2160 limCopyU32(pBuf, pStat->failedTxPkts);
2161 pBuf += sizeof(tANI_U32);
2162
2163 limCopyU32(pBuf, pStat->ackTimeouts);
2164 pBuf += sizeof(tANI_U32);
2165
2166 limCopyU32(pBuf, pStat->multiRetryPkts);
2167 pBuf += sizeof(tANI_U32);
2168
2169 limCopyU32(pBuf, pStat->fragTxCntsHi);
2170 pBuf += sizeof(tANI_U32);
2171
2172 limCopyU32(pBuf, pStat->fragTxCntsLo);
2173 pBuf += sizeof(tANI_U32);
2174
2175 limCopyU32(pBuf, pStat->transmittedPktsHi);
2176 pBuf += sizeof(tANI_U32);
2177
2178 limCopyU32(pBuf, pStat->transmittedPktsLo);
2179 pBuf += sizeof(tANI_U32);
2180
2181 limCopyU32(pBuf, pStat->phyStatHi);
2182 pBuf += sizeof(tANI_U32);
2183
2184 limCopyU32(pBuf, pStat->phyStatLo);
2185 pBuf += sizeof(tANI_U32);
2186
2187 limCopyU32(pBuf, pStat->uplinkRssi);
2188 pBuf += sizeof(tANI_U32);
2189
2190 limCopyU32(pBuf, pStat->uplinkSinr);
2191 pBuf += sizeof(tANI_U32);
2192
2193 limCopyU32(pBuf, pStat->uplinkRate);
2194 pBuf += sizeof(tANI_U32);
2195
2196 limCopyU32(pBuf, pStat->downlinkRssi);
2197 pBuf += sizeof(tANI_U32);
2198
2199 limCopyU32(pBuf, pStat->downlinkSinr);
2200 pBuf += sizeof(tANI_U32);
2201
2202 limCopyU32(pBuf, pStat->downlinkRate);
2203 pBuf += sizeof(tANI_U32);
2204
2205 limCopyU32(pBuf, pStat->nRcvBytes);
2206 pBuf += sizeof(tANI_U32);
2207
2208 limCopyU32(pBuf, pStat->nXmitBytes);
2209 pBuf += sizeof(tANI_U32);
2210
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002211 PELOG1(limLog(pMac, LOG1, FL("STAT: length %d bytes is:"), sizeof(tAniStaStatStruct));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, sizeof(tAniStaStatStruct));)
2213
2214} /*** end limStatSerDes() ***/
2215
2216
Jeff Johnson295189b2012-06-20 16:38:30 -07002217
2218
2219/**
2220 * limPackBkgndScanFailNotify()
2221 *
2222 *FUNCTION:
2223 * This function is called by limSendSmeWmStatusChangeNtf()
2224 * to pack the tSirBackgroundScanInfo message
2225 *
2226 */
2227void
2228limPackBkgndScanFailNotify(tpAniSirGlobal pMac,
2229 tSirSmeStatusChangeCode statusChangeCode,
2230 tpSirBackgroundScanInfo pScanInfo,
2231 tSirSmeWmStatusChangeNtf *pSmeNtf,
2232 tANI_U8 sessionId)
2233{
2234
2235 tANI_U16 length = (sizeof(tANI_U16) * 2) + sizeof(tANI_U8) +
2236 sizeof(tSirSmeStatusChangeCode) +
2237 sizeof(tSirBackgroundScanInfo);
2238
Jeff Johnson295189b2012-06-20 16:38:30 -07002239 pSmeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
2240 pSmeNtf->statusChangeCode = statusChangeCode;
2241 pSmeNtf->length = length;
2242 pSmeNtf->sessionId = sessionId;
2243 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanSuccess = pScanInfo->numOfScanSuccess;
2244 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanFailure = pScanInfo->numOfScanFailure;
2245 pSmeNtf->statusChangeInfo.bkgndScanInfo.reserved = pScanInfo->reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07002246}
2247
Jeff Johnson295189b2012-06-20 16:38:30 -07002248
Jeff Johnson295189b2012-06-20 16:38:30 -07002249/**
2250 * limIsSmeGetAssocSTAsReqValid()
2251 *
2252 *FUNCTION:
2253 * This function is called by limProcessSmeReqMessages() upon
2254 * receiving SME_GET_ASSOC_STAS_REQ message from application.
2255 *
2256 *LOGIC:
2257 * Message validity checks are performed in this function
2258 *
2259 *ASSUMPTIONS:
2260 *
2261 *NOTE:
2262 *
2263 * @param pBuf - Pointer to a serialized SME_GET_ASSOC_STAS_REQ message
2264 * @param pSmeMsg - Pointer to a tSirSmeGetAssocSTAsReq structure
2265 * @return true if SME_GET_ASSOC_STAS_REQ message is formatted correctly
2266 * false otherwise
2267 */
2268tANI_BOOLEAN
2269limIsSmeGetAssocSTAsReqValid(tpAniSirGlobal pMac, tpSirSmeGetAssocSTAsReq pGetAssocSTAsReq, tANI_U8 *pBuf)
2270{
2271 tANI_S16 len = 0;
2272
2273 pGetAssocSTAsReq->messageType = limGetU16(pBuf);
2274 pBuf += sizeof(tANI_U16);
2275
2276 len = pGetAssocSTAsReq->length = limGetU16(pBuf);
2277 pBuf += sizeof(tANI_U16);
2278
2279 if (len < (tANI_S16) sizeof(tANI_U32))
2280 return eSIR_FAILURE;
2281
2282 len -= sizeof(tANI_U32); // skip message header
2283 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2284 return eSIR_FAILURE;
2285
2286 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302287 vos_mem_copy( (tANI_U8 *) pGetAssocSTAsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002288 pBuf += sizeof(tSirMacAddr);
2289 len -= sizeof(tSirMacAddr);
2290 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2291 return eSIR_FAILURE;
2292
2293 // Extract modId
2294 pGetAssocSTAsReq->modId = limGetU16(pBuf);
2295 pBuf += sizeof(tANI_U16);
2296 len -= sizeof(tANI_U16);
2297 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2298 return eSIR_FAILURE;
2299
2300 // Extract pUsrContext
2301 pGetAssocSTAsReq->pUsrContext = (void *)limGetU32(pBuf);
2302 pBuf += sizeof(tANI_U32);
2303 len -= sizeof(tANI_U32);
2304 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2305 return eSIR_FAILURE;
2306
2307 // Extract pSapEventCallback
2308 pGetAssocSTAsReq->pSapEventCallback = (void *)limGetU32(pBuf);
2309 pBuf += sizeof(tANI_U32);
2310 len -= sizeof(tANI_U32);
2311 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2312 return eSIR_FAILURE;
2313
2314 // Extract pAssocStasArray
2315 pGetAssocSTAsReq->pAssocStasArray = (void *)limGetU32(pBuf);
2316 pBuf += sizeof(tANI_U32);
2317 len -= sizeof(tANI_U32);
2318
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002319 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002320
2321 if (len < 0)
2322 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002323 PELOGE(limLog(pMac, LOGE, FL("SME_GET_ASSOC_STAS_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002324 return eANI_BOOLEAN_FALSE;
2325 }
2326
2327 return eANI_BOOLEAN_TRUE;
2328}
2329
2330/**
2331 * limTkipCntrMeasReqSerDes()
2332 *
2333 *FUNCTION:
2334 * This function is called by limProcessSmeMessages() upon receiving
2335 * eWNI_SME_TKIP_CNTR_MEAS_REQ from host HDD
2336 *
2337 *PARAMS:
2338 *
2339 *LOGIC:
2340 *
2341 *ASSUMPTIONS:
2342 * NA
2343 *
2344 *NOTE:
2345 * NA
2346 *
2347 * @param tpSirSmeTkipCntrMeasReq Pointer to tSirSmeTkipCntrMeasReq being extracted
2348 * @param pBuf Pointer to serialized buffer
2349 * @return retCode Indicates whether message is successfully
2350 * de-serialized (eSIR_SUCCESS) or
2351 * not (eSIR_FAILURE)
2352 */
2353tSirRetStatus
2354limTkipCntrMeasReqSerDes(tpAniSirGlobal pMac, tpSirSmeTkipCntrMeasReq pTkipCntrMeasReq, tANI_U8 *pBuf)
2355{
2356 tANI_S16 len = 0;
2357
2358#ifdef PE_DEBUG_LOG1
2359 tANI_U8 *pTemp = pBuf;
2360#endif
2361
2362 pTkipCntrMeasReq->messageType = limGetU16(pBuf);
2363 pBuf += sizeof(tANI_U16);
2364
2365 len = pTkipCntrMeasReq->length = limGetU16(pBuf);
2366 pBuf += sizeof(tANI_U16);
2367
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002368 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002369 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2370
2371 if (len < (tANI_S16) sizeof(tANI_U32))
2372 return eSIR_FAILURE;
2373
2374 len -= sizeof(tANI_U32); // skip message header
2375 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2376 return eSIR_FAILURE;
2377
2378 // Extract sessionId
2379 pTkipCntrMeasReq->sessionId = *pBuf++;
2380 len--;
2381 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2382 return eSIR_FAILURE;
2383
2384 // Extract transactionId
2385 pTkipCntrMeasReq->transactionId = limGetU16(pBuf);
2386 pBuf += sizeof(tANI_U16);
2387 len -= sizeof(tANI_U16);
2388 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2389 return eSIR_FAILURE;
2390
2391 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302392 vos_mem_copy( (tANI_U8 *) pTkipCntrMeasReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002393 pBuf += sizeof(tSirMacAddr);
2394 len -= sizeof(tSirMacAddr);
2395 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2396 return eSIR_FAILURE;
2397
2398 // Extract bEnable
2399 pTkipCntrMeasReq->bEnable = *pBuf++;
2400 len --;
2401
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002402 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002403
2404 if (len)
2405 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002406 PELOGE(limLog(pMac, LOGE, FL("SME_TKIP_CNTR_MEAS_REQ invalid "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002407 return eSIR_FAILURE;
2408 }
2409 else
2410 return eSIR_SUCCESS;
2411}
2412
2413/**
2414 * limIsSmeGetWPSPBCSessionsReqValid()
2415 *
2416 *FUNCTION:
2417 * This function is called by limProcessSmeGetWPSPBCSessions() upon
2418 * receiving query WPS PBC overlap information message from application.
2419 *
2420 *LOGIC:
2421 * Message validity checks are performed in this function
2422 *
2423 *ASSUMPTIONS:
2424 *
2425 *NOTE:
2426 *
2427 * @param pBuf - Pointer to a serialized SME_GET_WPSPBC_SESSION_REQ message
2428 * @param pGetWPSPBCSessionsReq - Pointer to a tSirSmeGetWPSPBCSessionsReq structure
2429 * @return true if SME_GET_WPSPBC_SESSION_REQ message is formatted correctly
2430 * false otherwise
2431 */
2432
2433tSirRetStatus
2434limIsSmeGetWPSPBCSessionsReqValid(tpAniSirGlobal pMac, tSirSmeGetWPSPBCSessionsReq *pGetWPSPBCSessionsReq, tANI_U8 *pBuf)
2435{
2436 tANI_S16 len = 0;
2437
2438 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirSmeGetWPSPBCSessionsReq));)
2439
2440 pGetWPSPBCSessionsReq->messageType = limGetU16(pBuf);
2441 pBuf += sizeof(tANI_U16);
2442
2443 len = pGetWPSPBCSessionsReq->length = limGetU16(pBuf);
2444 pBuf += sizeof(tANI_U16);
2445
2446 if (len < (tANI_S16) sizeof(tANI_U32))
2447 return eSIR_FAILURE;
2448
2449 len -= sizeof(tANI_U32); // skip message header
2450 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2451 return eSIR_FAILURE;
2452
2453 // Extract pUsrContext
2454 pGetWPSPBCSessionsReq->pUsrContext = (void *)limGetU32(pBuf);
2455 pBuf += sizeof(tANI_U32);
2456 len -= sizeof(tANI_U32);
2457 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2458 return eSIR_FAILURE;
2459
2460 // Extract pSapEventCallback
2461 pGetWPSPBCSessionsReq->pSapEventCallback = (void *)limGetU32(pBuf);
2462 pBuf += sizeof(tANI_U32);
2463 len -= sizeof(tANI_U32);
2464 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2465 return eSIR_FAILURE;
2466
2467 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302468 vos_mem_copy( (tANI_U8 *) pGetWPSPBCSessionsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002469 pBuf += sizeof(tSirMacAddr);
2470 len -= sizeof(tSirMacAddr);
2471
2472 // Extract MAC address of Station to be removed
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302473 vos_mem_copy( (tANI_U8 *) pGetWPSPBCSessionsReq->pRemoveMac, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002474 pBuf += sizeof(tSirMacAddr);
2475 len -= sizeof(tSirMacAddr);
2476
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002477 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002478
2479 if (len < 0)
2480 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002481 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002482 return eSIR_FAILURE;
2483 }
2484
2485 return eSIR_SUCCESS;
2486}
2487
Jeff Johnson295189b2012-06-20 16:38:30 -07002488
2489/**---------------------------------------------------------------
2490\fn limGetSessionInfo
2491\brief This function returns the sessionId and transactionId
2492\ of a message. This assumes that the message structure
2493\ is of format:
2494\ tANI_U16 messageType
2495\ tANI_U16 messageLength
2496\ tANI_U8 sessionId
2497\ tANI_U16 transactionId
2498\param pMac - pMac global structure
2499\param *pBuf - pointer to the message buffer
2500\param sessionId - returned session id value
2501\param transactionId - returned transaction ID value
2502\return None
2503------------------------------------------------------------------*/
2504void
2505limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U8 *sessionId, tANI_U16 *transactionId)
2506{
2507 if (!pBuf)
2508 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002509 limLog(pMac, LOGE, FL("NULL ptr received. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002510 return;
2511 }
2512
2513 pBuf += sizeof(tANI_U16); // skip message type
2514 pBuf += sizeof(tANI_U16); // skip message length
2515
2516 *sessionId = *pBuf; // get sessionId
2517 pBuf++;
2518 *transactionId = limGetU16(pBuf); // get transactionId
2519
2520 return;
2521}
2522
Jeff Johnson295189b2012-06-20 16:38:30 -07002523
2524/**
2525 * limUpdateAPWPSIEsReqSerDes()
2526 *
2527 *FUNCTION:
2528 * This function is to deserialize UpdateAPWPSIEs message
2529 *
2530 *PARAMS:
2531 *
2532 *LOGIC:
2533 *
2534 *ASSUMPTIONS:
2535 * NA
2536 *
2537 *NOTE:
2538 * NA
2539 *
2540 * @param pUpdateAPWPSIEsReq Pointer to tSirUpdateAPWPSIEsReq being
2541 * extracted
2542 * @param pBuf Pointer to serialized buffer
2543 *
2544 * @return retCode Indicates whether message is successfully
2545 * de-serialized (eSIR_SUCCESS) or
2546 * not (eSIR_FAILURE)
2547 */
2548
2549tSirRetStatus
2550limUpdateAPWPSIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq, tANI_U8 *pBuf)
2551{
2552 tANI_S16 len = 0;
2553
2554 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPSIEsReq));)
2555
2556 if (!pUpdateAPWPSIEsReq || !pBuf)
2557 return eSIR_FAILURE;
2558
2559 pUpdateAPWPSIEsReq->messageType = limGetU16(pBuf);
2560 pBuf += sizeof(tANI_U16);
2561
2562 len = pUpdateAPWPSIEsReq->length = limGetU16(pBuf);
2563 pBuf += sizeof(tANI_U16);
2564
2565 if (len < (tANI_S16) sizeof(tANI_U32))
2566 return eSIR_FAILURE;
2567
2568 len -= sizeof(tANI_U32); // skip message header
2569 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2570 return eSIR_FAILURE;
2571
2572 // Extract transactionId
2573 pUpdateAPWPSIEsReq->transactionId = limGetU16( pBuf );
2574 pBuf += sizeof( tANI_U16 );
2575 len -= sizeof( tANI_U16 );
2576 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2577 return eSIR_FAILURE;
2578
2579 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302580 vos_mem_copy( (tANI_U8 *) pUpdateAPWPSIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002581 pBuf += sizeof(tSirMacAddr);
2582 len -= sizeof(tSirMacAddr);
2583 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2584 return eSIR_FAILURE;
2585
2586 // Extract sessionId
2587 pUpdateAPWPSIEsReq->sessionId = *pBuf++;
2588 len--;
2589 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2590 return eSIR_FAILURE;
2591
2592 // Extract APWPSIEs
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302593 vos_mem_copy( (tSirAPWPSIEs *) &pUpdateAPWPSIEsReq->APWPSIEs, pBuf, sizeof(tSirAPWPSIEs));
Jeff Johnson295189b2012-06-20 16:38:30 -07002594 pBuf += sizeof(tSirAPWPSIEs);
2595 len -= sizeof(tSirAPWPSIEs);
2596
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002597 PELOG1(limLog(pMac, LOG1, FL("SME_UPDATE_APWPSIE_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002598
2599 if (len < 0)
2600 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002601 PELOGE(limLog(pMac, LOGE, FL("SME_UPDATE_APWPSIE_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002602 return eSIR_FAILURE;
2603 }
2604
2605 return eSIR_SUCCESS;
2606} /*** end limSetContextReqSerDes() ***/
2607
2608/**
2609 * limUpdateAPWPARSNIEsReqSerDes ()
2610 *
2611 *FUNCTION:
2612 * This function is to deserialize UpdateAPWPSIEs message
2613 *
2614 *PARAMS:
2615 *
2616 *LOGIC:
2617 *
2618 *ASSUMPTIONS:
2619 * NA
2620 *
2621 *NOTE:
2622 * NA
2623 *
2624 * @param pUpdateAPWPARSNIEsReq Pointer to tpSirUpdateAPWPARSNIEsReq being
2625 * extracted
2626 * @param pBuf Pointer to serialized buffer
2627 *
2628 * @return retCode Indicates whether message is successfully
2629 * de-serialized (eSIR_SUCCESS) or
2630 * not (eSIR_FAILURE)
2631 */
2632
2633tSirRetStatus
2634limUpdateAPWPARSNIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq, tANI_U8 *pBuf)
2635{
2636 tANI_S16 len = 0;
2637
2638 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPARSNIEsReq));)
2639
2640 if (!pUpdateAPWPARSNIEsReq || !pBuf)
2641 return eSIR_FAILURE;
2642
2643 pUpdateAPWPARSNIEsReq->messageType = limGetU16(pBuf);
2644 pBuf += sizeof(tANI_U16);
2645
2646 len = pUpdateAPWPARSNIEsReq->length = limGetU16(pBuf);
2647 pBuf += sizeof(tANI_U16);
2648
2649 if (len < (tANI_S16) sizeof(tANI_U32))
2650 return eSIR_FAILURE;
2651
2652 len -= sizeof(tANI_U32); // skip message header
2653 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2654 return eSIR_FAILURE;
2655
2656 // Extract transactionId
2657 pUpdateAPWPARSNIEsReq->transactionId = limGetU16( pBuf );
2658 pBuf += sizeof(tANI_U16);
2659 len -= sizeof( tANI_U16 );
2660 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2661 return eSIR_FAILURE;
2662
2663 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302664 vos_mem_copy( (tANI_U8 *) pUpdateAPWPARSNIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002665 pBuf += sizeof(tSirMacAddr);
2666 len -= sizeof(tSirMacAddr);
2667 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2668 return eSIR_FAILURE;
2669
2670 // Extract sessionId
2671 pUpdateAPWPARSNIEsReq->sessionId = *pBuf++;
2672 len--;
2673 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2674 return eSIR_FAILURE;
2675
2676 // Extract APWPARSNIEs
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302677 vos_mem_copy( (tSirRSNie *) &pUpdateAPWPARSNIEsReq->APWPARSNIEs, pBuf, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07002678 pBuf += sizeof(tSirRSNie);
2679 len -= sizeof(tSirRSNie);
2680
2681 if (len < 0)
2682 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002683 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002684 return eSIR_FAILURE;
2685 }
2686
2687 return eSIR_SUCCESS;
2688} /*** end limUpdateAPWPARSNIEsReqSerDes() ***/
2689