blob: 7dbfafae6e5a4b5eb7206d39d73c888cfb19b0de [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
Jeff Johnson295189b2012-06-20 16:38:30 -0700664 // Extract bssPersona
665 pStartBssReq->bssPersona = *pBuf++;
666 len--;
667 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
668 return eSIR_FAILURE;
669
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -0800670
671 // Extract txLdpcIniFeatureEnabled
672 pStartBssReq->txLdpcIniFeatureEnabled = *pBuf++;
673 len--;
674 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
675 return eSIR_FAILURE;
676
Jeff Johnson295189b2012-06-20 16:38:30 -0700677 // Extract rsnIe
678 pStartBssReq->rsnIE.length = limGetU16(pBuf);
679 pBuf += sizeof(tANI_U16);
680
681 // Check for RSN IE length (that includes length of type & length
682 if (pStartBssReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2)
683 {
684 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700685 FL("Invalid RSN IE length %d in SME_START_BSS_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700686 pStartBssReq->rsnIE.length);
687 return eSIR_FAILURE;
688 }
689
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530690 vos_mem_copy( pStartBssReq->rsnIE.rsnIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -0700691 pBuf, pStartBssReq->rsnIE.length);
692
693 len -= (sizeof(tANI_U16) + pStartBssReq->rsnIE.length);
694 pBuf += pStartBssReq->rsnIE.length;
695 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
696 return eSIR_FAILURE;
697
698 // Extract nwType
699 pStartBssReq->nwType = (tSirNwType) limGetU32(pBuf);
700 pBuf += sizeof(tSirNwType);
701 len -= sizeof(tSirNwType);
702 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
703 return eSIR_FAILURE;
704
705 // Extract operationalRateSet
706 pStartBssReq->operationalRateSet.numRates = *pBuf++;
707
708 // Check for number of rates
709 if (pStartBssReq->operationalRateSet.numRates >
710 SIR_MAC_MAX_NUMBER_OF_RATES)
711 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700712 limLog(pMac, LOGW, FL("Invalid numRates %d in SME_START_BSS_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700713 pStartBssReq->operationalRateSet.numRates);
714 return eSIR_FAILURE;
715 }
716
717 len--;
718 if (len < pStartBssReq->operationalRateSet.numRates)
719 return eSIR_FAILURE;
720
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530721 vos_mem_copy( (tANI_U8 *) pStartBssReq->operationalRateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -0700722 pBuf,
723 pStartBssReq->operationalRateSet.numRates);
724 pBuf += pStartBssReq->operationalRateSet.numRates;
725 len -= pStartBssReq->operationalRateSet.numRates;
726
727 // Extract extendedRateSet
728 if ((pStartBssReq->nwType == eSIR_11G_NW_TYPE) ||
729 (pStartBssReq->nwType == eSIR_11N_NW_TYPE ))
730 {
731 pStartBssReq->extendedRateSet.numRates = *pBuf++;
732 len--;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530733 vos_mem_copy( pStartBssReq->extendedRateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -0700734 pBuf, pStartBssReq->extendedRateSet.numRates);
735 pBuf += pStartBssReq->extendedRateSet.numRates;
736 len -= pStartBssReq->extendedRateSet.numRates;
737 }
738
Jeff Johnson295189b2012-06-20 16:38:30 -0700739
740 if (len)
741 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700742 limLog(pMac, LOGW, FL("Extra bytes left in SME_START_BSS_REQ, len=%d"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700743 }
744
745 return eSIR_SUCCESS;
746} /*** end limStartBssReqSerDes() ***/
747
748
749
750/**
751 * limStopBssReqSerDes()
752 *
753 *FUNCTION:
754 * This function is called by limProcessSmeMessages() upon receiving
755 * SME_STOP_BSS_REQ from host
756 *
757 *PARAMS:
758 *
759 *LOGIC:
760 *
761 *ASSUMPTIONS:
762 * NA
763 *
764 *NOTE:
765 * NA
766 *
767 * @param pStopBssReq Pointer to tSirSmeStopBssReq being extracted
768 * @param pBuf Pointer to serialized buffer
769 * @return retCode Indicates whether message is successfully
770 * de-serialized (eSIR_SUCCESS) or
771 * not (eSIR_FAILURE)
772 */
773
774tSirRetStatus
775limStopBssReqSerDes(tpAniSirGlobal pMac, tpSirSmeStopBssReq pStopBssReq, tANI_U8 *pBuf)
776{
777 tANI_S16 len = 0;
778
779#ifdef PE_DEBUG_LOG1
780 tANI_U8 *pTemp = pBuf;
781#endif
782
783 pStopBssReq->messageType = limGetU16(pBuf);
784 pBuf += sizeof(tANI_U16);
785
786 len = pStopBssReq->length = limGetU16(pBuf);
787 pBuf += sizeof(tANI_U16);
788
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700789 PELOG1(limLog(pMac, LOG1, FL("SME_STOP_BSS_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700790 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
791
792 if (len < (tANI_S16) sizeof(tANI_U32))
793 return eSIR_FAILURE;
794
795 len -= sizeof(tANI_U32); // skip message header
796 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
797 return eSIR_FAILURE;
798
799 // Extract sessionId
800 pStopBssReq->sessionId = *pBuf++;
801 len--;
802 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
803 return eSIR_FAILURE;
804
805 // Extract transactionId
806 pStopBssReq->transactionId = limGetU16(pBuf);
807 pBuf += sizeof(tANI_U16);
808 len -= sizeof(tANI_U16);
809
810 // Extract reasonCode
811 pStopBssReq->reasonCode = (tSirResultCodes) limGetU32(pBuf);
812 pBuf += sizeof(tSirResultCodes);
813 len -= sizeof(tSirResultCodes);
814
815 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530816 vos_mem_copy( (tANI_U8 *) pStopBssReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 len -= sizeof(tSirMacAddr);
818
819 if (len)
820 return eSIR_FAILURE;
821 else
822 return eSIR_SUCCESS;
823
824} /*** end limStopBssReqSerDes() ***/
825
826
827
828/**
829 * limJoinReqSerDes()
830 *
831 *FUNCTION:
832 * This function is called by limProcessSmeMessages() upon receiving
833 * SME_JOIN_REQ from host
834 *
835 *PARAMS:
836 *
837 *LOGIC:
838 *
839 *ASSUMPTIONS:
840 * NA
841 *
842 *NOTE:
843 * NA
844 *
845 * @param pJoinReq Pointer to tSirSmeJoinReq being extracted
846 * @param pBuf Pointer to serialized buffer
847 * @return retCode Indicates whether message is successfully
848 * de-serialized (eSIR_SUCCESS) or
849 * not (eSIR_FAILURE)
850 */
851
852tSirRetStatus
853limJoinReqSerDes(tpAniSirGlobal pMac, tpSirSmeJoinReq pJoinReq, tANI_U8 *pBuf)
854{
855 tANI_S16 len = 0;
856 tANI_S16 lenUsed = 0;
857
858#ifdef PE_DEBUG_LOG1
859 tANI_U8 *pTemp = pBuf;
860#endif
861
862 if (!pJoinReq || !pBuf)
863 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700864 PELOGE(limLog(pMac, LOGE, FL("NULL ptr received"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700865 return eSIR_FAILURE;
866 }
867
868 // Extract messageType
869 pJoinReq->messageType = limGetU16(pBuf);
870 pBuf += sizeof(tANI_U16);
871
872 // Extract length
873 len = pJoinReq->length = limGetU16(pBuf);
874 pBuf += sizeof(tANI_U16);
875
876 if (pJoinReq->messageType == eWNI_SME_JOIN_REQ)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700877 PELOG1(limLog(pMac, LOG3, FL("SME_JOIN_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700878 else
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700879 PELOG1(limLog(pMac, LOG3, FL("SME_REASSOC_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700880
881 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
882
883 if (len < (tANI_S16) sizeof(tANI_U32))
884 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700885 PELOGE(limLog(pMac, LOGE, FL("len too short %d"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700886 return eSIR_FAILURE;
887 }
888
889 len -= sizeof(tANI_U32); // skip message header
890 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
891 return eSIR_FAILURE;
892
893 // Extract sessionId
894 pJoinReq->sessionId = *pBuf++;
895 len--;
896 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
897 return eSIR_FAILURE;
898
899 // Extract transactionId
900 pJoinReq->transactionId = limGetU16(pBuf);
901 pBuf += sizeof(tANI_U16);
902 len -= sizeof(tANI_U16);
903 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
904 return eSIR_FAILURE;
905
906 // Extract ssId
907 pJoinReq->ssId.length = *pBuf++;
908 len--;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530909 vos_mem_copy( (tANI_U8 *) pJoinReq->ssId.ssId, pBuf, pJoinReq->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -0700910 pBuf += pJoinReq->ssId.length;
911 len -= pJoinReq->ssId.length;
912 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
913 return eSIR_FAILURE;
914
915 // Extract selfMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530916 vos_mem_copy( pJoinReq->selfMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700917 pBuf += sizeof(tSirMacAddr);
918 len -= sizeof(tSirMacAddr);
919 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
920 return eSIR_FAILURE;
921
922 // Extract bsstype
923 pJoinReq->bsstype = (tSirBssType) limGetU32(pBuf);
924 pBuf += sizeof(tANI_U32);
925 len -= sizeof(tANI_U32);
926 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
927 return eSIR_FAILURE;
928
929 // Extract dot11mode
930 pJoinReq->dot11mode= *pBuf++;
931 len--;
932 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
933 return eSIR_FAILURE;
934
935 // Extract bssPersona
936 pJoinReq->staPersona = *pBuf++;
937 len--;
938 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
939 return eSIR_FAILURE;
940
Jeff Johnsone7245742012-09-05 17:12:55 -0700941 // Extract cbMode
942 pJoinReq->cbMode = *pBuf++;
943 len--;
944 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
945 return eSIR_FAILURE;
946
Jeff Johnson295189b2012-06-20 16:38:30 -0700947 // Extract uapsdPerAcBitmask
948 pJoinReq->uapsdPerAcBitmask = *pBuf++;
949 len--;
950 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
951 return eSIR_FAILURE;
952
Jeff Johnson295189b2012-06-20 16:38:30 -0700953
954 // Extract operationalRateSet
955 pJoinReq->operationalRateSet.numRates= *pBuf++;
956 len--;
957 if (pJoinReq->operationalRateSet.numRates)
958 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530959 vos_mem_copy( (tANI_U8 *) pJoinReq->operationalRateSet.rate, pBuf,
960 pJoinReq->operationalRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700961 pBuf += pJoinReq->operationalRateSet.numRates;
962 len -= pJoinReq->operationalRateSet.numRates;
963 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
964 return eSIR_FAILURE;
965 }
966
967 // Extract extendedRateSet
968 pJoinReq->extendedRateSet.numRates = *pBuf++;
969 len--;
970 if (pJoinReq->extendedRateSet.numRates)
971 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530972 vos_mem_copy( pJoinReq->extendedRateSet.rate, pBuf, pJoinReq->extendedRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700973 pBuf += pJoinReq->extendedRateSet.numRates;
974 len -= pJoinReq->extendedRateSet.numRates;
975 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
976 return eSIR_FAILURE;
977 }
978
979 // Extract RSN IE
980 pJoinReq->rsnIE.length = limGetU16(pBuf);
981 pBuf += sizeof(tANI_U16);
982 len -= sizeof(tANI_U16);
983
984 if (pJoinReq->rsnIE.length)
985 {
986 // Check for RSN IE length (that includes length of type & length)
987 if ((pJoinReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2) ||
988 (pJoinReq->rsnIE.length != 2 + *(pBuf + 1)))
989 {
990 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700991 FL("Invalid RSN IE length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700992 pJoinReq->rsnIE.length);
993 return eSIR_FAILURE;
994 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530995 vos_mem_copy( (tANI_U8 *) pJoinReq->rsnIE.rsnIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -0700996 pBuf, pJoinReq->rsnIE.length);
997 pBuf += pJoinReq->rsnIE.length;
998 len -= pJoinReq->rsnIE.length; // skip RSN IE
999 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1000 return eSIR_FAILURE;
1001 }
1002
1003#ifdef FEATURE_WLAN_CCX
1004 // Extract CCKM IE
1005 pJoinReq->cckmIE.length = limGetU16(pBuf);
1006 pBuf += sizeof(tANI_U16);
1007 len -= sizeof(tANI_U16);
1008 if (pJoinReq->cckmIE.length)
1009 {
1010 // Check for CCKM IE length (that includes length of type & length)
1011 if ((pJoinReq->cckmIE.length > SIR_MAC_MAX_IE_LENGTH) ||
1012 (pJoinReq->cckmIE.length != (2 + *(pBuf + 1))))
1013 {
1014 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001015 FL("Invalid CCKM IE length %d/%d in SME_JOIN/REASSOC_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001016 pJoinReq->cckmIE.length, 2 + *(pBuf + 1));
1017 return eSIR_FAILURE;
1018 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301019 vos_mem_copy((tANI_U8 *) pJoinReq->cckmIE.cckmIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001020 pBuf, pJoinReq->cckmIE.length);
1021 pBuf += pJoinReq->cckmIE.length;
1022 len -= pJoinReq->cckmIE.length; // skip CCKM IE
1023 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1024 return eSIR_FAILURE;
1025 }
1026#endif
1027
1028 // Extract Add IE for scan
1029 pJoinReq->addIEScan.length = limGetU16(pBuf);
1030 pBuf += sizeof(tANI_U16);
1031 len -= sizeof(tANI_U16);
1032
1033 if (pJoinReq->addIEScan.length)
1034 {
1035 // Check for IE length (that includes length of type & length)
1036 if (pJoinReq->addIEScan.length > SIR_MAC_MAX_IE_LENGTH + 2)
1037 {
1038 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001039 FL("Invalid addIE Scan length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001040 pJoinReq->addIEScan.length);
1041 return eSIR_FAILURE;
1042 }
1043 // Check for P2P IE length (that includes length of type & length)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301044 vos_mem_copy( (tANI_U8 *) pJoinReq->addIEScan.addIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001045 pBuf, pJoinReq->addIEScan.length);
1046 pBuf += pJoinReq->addIEScan.length;
1047 len -= pJoinReq->addIEScan.length; // skip add IE
1048 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1049 return eSIR_FAILURE;
1050 }
1051
1052 pJoinReq->addIEAssoc.length = limGetU16(pBuf);
1053 pBuf += sizeof(tANI_U16);
1054 len -= sizeof(tANI_U16);
1055
1056 // Extract Add IE for assoc
1057 if (pJoinReq->addIEAssoc.length)
1058 {
1059 // Check for IE length (that includes length of type & length)
1060 if (pJoinReq->addIEAssoc.length > SIR_MAC_MAX_IE_LENGTH + 2)
1061 {
1062 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001063 FL("Invalid addIE Assoc length %d in SME_JOIN_REQ"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001064 pJoinReq->addIEAssoc.length);
1065 return eSIR_FAILURE;
1066 }
1067 // Check for P2P IE length (that includes length of type & length)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301068 vos_mem_copy( (tANI_U8 *) pJoinReq->addIEAssoc.addIEdata,
Jeff Johnson295189b2012-06-20 16:38:30 -07001069 pBuf, pJoinReq->addIEAssoc.length);
1070 pBuf += pJoinReq->addIEAssoc.length;
1071 len -= pJoinReq->addIEAssoc.length; // skip add IE
1072 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1073 return eSIR_FAILURE;
1074 }
1075
Venkata Prathyusha Kuntupallie8dc41d2013-04-15 14:31:36 -07001076 pJoinReq->UCEncryptionType = limGetU32(pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001077 pBuf += sizeof(tANI_U32);
1078 len -= sizeof(tANI_U32);
1079 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1080 return eSIR_FAILURE;
1081
Venkata Prathyusha Kuntupallie8dc41d2013-04-15 14:31:36 -07001082 pJoinReq->MCEncryptionType = limGetU32(pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001083 pBuf += sizeof(tANI_U32);
1084 len -= sizeof(tANI_U32);
1085 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1086 return eSIR_FAILURE;
1087
Chet Lanctot186b5732013-03-18 10:26:30 -07001088#ifdef WLAN_FEATURE_11W
1089 pJoinReq->MgmtEncryptionType = limGetU32(pBuf);
1090 pBuf += sizeof(tANI_U32);
1091 len -= sizeof(tANI_U32);
1092 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1093 return eSIR_FAILURE;
1094#endif
1095
Jeff Johnson295189b2012-06-20 16:38:30 -07001096#ifdef WLAN_FEATURE_VOWIFI_11R
1097 //is11Rconnection;
1098 pJoinReq->is11Rconnection = (tAniBool)limGetU32(pBuf);
1099 pBuf += sizeof(tAniBool);
1100 len -= sizeof(tAniBool);
1101 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1102 return eSIR_FAILURE;
1103#endif
1104
1105#ifdef FEATURE_WLAN_CCX
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05301106 //CCX version IE
1107 pJoinReq->isCCXFeatureIniEnabled = (tAniBool)limGetU32(pBuf);
1108 pBuf += sizeof(tAniBool);
1109 len -= sizeof(tAniBool);
1110 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1111 return eSIR_FAILURE;
1112
Jeff Johnson295189b2012-06-20 16:38:30 -07001113 //isCCXconnection;
1114 pJoinReq->isCCXconnection = (tAniBool)limGetU32(pBuf);
1115 pBuf += sizeof(tAniBool);
1116 len -= sizeof(tAniBool);
1117 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1118 return eSIR_FAILURE;
1119
1120 // TSPEC information
1121 pJoinReq->ccxTspecInfo.numTspecs = *pBuf++;
1122 len -= sizeof(tANI_U8);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301123 vos_mem_copy((void*)&pJoinReq->ccxTspecInfo.tspec[0], pBuf,
1124 (sizeof(tTspecInfo)* pJoinReq->ccxTspecInfo.numTspecs));
Jeff Johnson295189b2012-06-20 16:38:30 -07001125 pBuf += sizeof(tTspecInfo)*SIR_CCX_MAX_TSPEC_IES;
1126 len -= sizeof(tTspecInfo)*SIR_CCX_MAX_TSPEC_IES;
1127 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1128 return eSIR_FAILURE;
1129#endif
1130
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001131#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07001132 //isFastTransitionEnabled;
1133 pJoinReq->isFastTransitionEnabled = (tAniBool)limGetU32(pBuf);
1134 pBuf += sizeof(tAniBool);
1135 len -= sizeof(tAniBool);
1136 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1137 return eSIR_FAILURE;
1138#endif
1139
Jeff Johnson43971f52012-07-17 12:26:56 -07001140#ifdef FEATURE_WLAN_LFR
1141 //isFastRoamIniFeatureEnabled;
1142 pJoinReq->isFastRoamIniFeatureEnabled = (tAniBool)limGetU32(pBuf);
1143 pBuf += sizeof(tAniBool);
1144 len -= sizeof(tAniBool);
1145 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1146 return eSIR_FAILURE;
1147#endif
1148
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001149 //txLdpcIniFeatureEnabled
1150 pJoinReq->txLdpcIniFeatureEnabled= *pBuf++;
1151 len--;
1152 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1153 return eSIR_FAILURE;
1154
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001155 //txBFIniFeatureEnabled
1156 pJoinReq->txBFIniFeatureEnabled= *pBuf++;
1157 len--;
1158 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1159 return eSIR_FAILURE;
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001160
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001161 //txBFCsnValue
1162 pJoinReq->txBFCsnValue= *pBuf++;
1163 len--;
1164 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1165 return eSIR_FAILURE;
1166
krunal soni5afa96c2013-09-06 22:19:02 -07001167 pJoinReq->isAmsduSupportInAMPDU= *pBuf++;
1168 len--;
1169 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1170 return eSIR_FAILURE;
1171
Jeff Johnson295189b2012-06-20 16:38:30 -07001172 // Extract Titan CB Neighbor BSS info
1173 pJoinReq->cbNeighbors.cbBssFoundPri = *pBuf;
1174 pBuf++;
1175 pJoinReq->cbNeighbors.cbBssFoundSecUp = *pBuf;
1176 pBuf++;
1177 pJoinReq->cbNeighbors.cbBssFoundSecDown = *pBuf;
1178 pBuf++;
1179 len -= 3;
1180
1181 // Extract Spectrum Mgt Indicator
1182 pJoinReq->spectrumMgtIndicator = (tAniBool) limGetU32(pBuf);
1183 pBuf += sizeof(tAniBool);
1184 len -= sizeof(tAniBool);
1185
1186 pJoinReq->powerCap.minTxPower = *pBuf++;
1187 pJoinReq->powerCap.maxTxPower = *pBuf++;
1188 len -=2;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001189 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 -07001190
1191 pJoinReq->supportedChannels.numChnl = *pBuf++;
1192 len--;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301193 vos_mem_copy( (tANI_U8 *) pJoinReq->supportedChannels.channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001194 pBuf, pJoinReq->supportedChannels.numChnl);
1195 pBuf += pJoinReq->supportedChannels.numChnl;
1196 len-= pJoinReq->supportedChannels.numChnl;
1197
1198 PELOG2(limLog(pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001199 FL("spectrumInd ON: minPower %d, maxPower %d , numChnls %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001200 pJoinReq->powerCap.minTxPower,
1201 pJoinReq->powerCap.maxTxPower,
1202 pJoinReq->supportedChannels.numChnl);)
1203
1204 // Extract uapsdPerAcBitmask
1205 pJoinReq->uapsdPerAcBitmask = *pBuf++;
1206 len--;
1207 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1208 return eSIR_FAILURE;
1209
Jeff Johnson295189b2012-06-20 16:38:30 -07001210 //
1211 // NOTE - tSirBssDescription is now moved to the end
1212 // of tSirSmeJoinReq structure. This is to accomodate
1213 // the variable length data member ieFields[1]
1214 //
1215 if (limGetBssDescription( pMac, &pJoinReq->bssDescription,
1216 len, &lenUsed, pBuf) == eSIR_FAILURE)
1217 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001218 PELOGE(limLog(pMac, LOGE, FL("get bss description failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001219 return eSIR_FAILURE;
1220 }
1221 PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, (tANI_U8 *) &(pJoinReq->bssDescription), pJoinReq->bssDescription.length + 2);)
1222 pBuf += lenUsed;
1223 len -= lenUsed;
Jeff Johnson295189b2012-06-20 16:38:30 -07001224
1225 return eSIR_SUCCESS;
1226} /*** end limJoinReqSerDes() ***/
1227
1228
1229/**---------------------------------------------------------------
1230\fn limAssocIndSerDes
1231\brief This function is called by limProcessMlmAssocInd() to
1232\ populate the SME_ASSOC_IND message based on the received
1233\ MLM_ASSOC_IND.
1234\
1235\param pMac
1236\param pAssocInd - Pointer to the received tLimMlmAssocInd
1237\param pBuf - Pointer to serialized buffer
1238\param psessionEntry - pointer to PE session entry
1239\
1240\return None
1241------------------------------------------------------------------*/
1242void
1243limAssocIndSerDes(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
1244{
1245 tANI_U8 *pLen = pBuf;
1246 tANI_U16 mLen = 0;
1247
1248#ifdef PE_DEBUG_LOG1
1249 tANI_U8 *pTemp = pBuf;
1250#endif
1251
Jeff Johnson295189b2012-06-20 16:38:30 -07001252
1253 mLen = sizeof(tANI_U32);
1254 mLen += sizeof(tANI_U8);
1255 pBuf += sizeof(tANI_U16);
1256 *pBuf = psessionEntry->smeSessionId;
1257 pBuf += sizeof(tANI_U8);
1258
1259 // Fill in peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301260 vos_mem_copy( pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001261 pBuf += sizeof(tSirMacAddr);
1262 mLen += sizeof(tSirMacAddr);
1263
1264 // Fill in aid
1265 limCopyU16(pBuf, pAssocInd->aid);
1266 pBuf += sizeof(tANI_U16);
1267 mLen += sizeof(tANI_U16);
1268
1269 // Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301270 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001271 pBuf += sizeof(tSirMacAddr);
1272 mLen += sizeof(tSirMacAddr);
1273
1274 // Fill in staId
1275 limCopyU16(pBuf, psessionEntry->staId);
1276 pBuf += sizeof(tANI_U16);
1277 mLen += sizeof(tANI_U16);
1278
1279 // Fill in authType
1280 limCopyU32(pBuf, pAssocInd->authType);
1281 pBuf += sizeof(tANI_U32);
1282 mLen += sizeof(tANI_U32);
1283
1284 // Fill in ssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301285 vos_mem_copy( pBuf, (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001286 pBuf += (1 + pAssocInd->ssId.length);
1287 mLen += (1 + pAssocInd->ssId.length);
1288
1289 // Fill in rsnIE
1290 limCopyU16(pBuf, pAssocInd->rsnIE.length);
1291 pBuf += sizeof(tANI_U16);
1292 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301293 vos_mem_copy( pBuf, (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001294 pAssocInd->rsnIE.length);
1295 pBuf += pAssocInd->rsnIE.length;
1296 mLen += pAssocInd->rsnIE.length;
1297
Jeff Johnson295189b2012-06-20 16:38:30 -07001298
Jeff Johnson295189b2012-06-20 16:38:30 -07001299 limCopyU32(pBuf, pAssocInd->spectrumMgtIndicator);
1300 pBuf += sizeof(tAniBool);
1301 mLen += sizeof(tAniBool);
1302
1303 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1304 {
1305 *pBuf = pAssocInd->powerCap.minTxPower;
1306 pBuf++;
1307 *pBuf = pAssocInd->powerCap.maxTxPower;
1308 pBuf++;
1309 mLen += sizeof(tSirMacPowerCapInfo);
1310
1311 *pBuf = pAssocInd->supportedChannels.numChnl;
1312 pBuf++;
1313 mLen++;
1314
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301315 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -07001316 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
1317 pAssocInd->supportedChannels.numChnl);
1318
1319
1320 pBuf += pAssocInd->supportedChannels.numChnl;
1321 mLen += pAssocInd->supportedChannels.numChnl;
1322 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001323 limCopyU32(pBuf, pAssocInd->WmmStaInfoPresent);
1324 pBuf += sizeof(tANI_U32);
1325 mLen += sizeof(tANI_U32);
Jeff Johnson295189b2012-06-20 16:38:30 -07001326 // Fill in length of SME_ASSOC_IND message
1327 limCopyU16(pLen, mLen);
1328
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001329 PELOG1(limLog(pMac, LOG1, FL("Sending SME_ASSOC_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001330 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1331} /*** end limAssocIndSerDes() ***/
1332
1333
1334
1335/**
1336 * limAssocCnfSerDes()
1337 *
1338 *FUNCTION:
1339 * This function is called by limProcessLmmMessages() when
1340 * SME_ASSOC_CNF or SME_REASSOC_CNF message is received from
1341 * upper layer software.
1342 *
1343 *PARAMS:
1344 *
1345 *LOGIC:
1346 *
1347 *ASSUMPTIONS:
1348 * NA
1349 *
1350 *NOTE:
1351 * NA
1352 *
1353 * @param pAssocCnf Pointer to tSirSmeAssocCnf being extracted into
1354 * @param pBuf Pointer to serialized buffer
1355 * @return retCode Indicates whether message is successfully
1356 * de-serialized (eSIR_SUCCESS) or
1357 * not (eSIR_FAILURE)
1358 */
1359
1360tSirRetStatus
1361limAssocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeAssocCnf pAssocCnf, tANI_U8 *pBuf)
1362{
1363#ifdef PE_DEBUG_LOG1
1364 tANI_U8 *pTemp = pBuf;
1365#endif
1366
1367 if (!pAssocCnf || !pBuf)
1368 return eSIR_FAILURE;
1369
1370 pAssocCnf->messageType = limGetU16(pBuf);
1371 pBuf += sizeof(tANI_U16);
1372
1373 pAssocCnf->length = limGetU16(pBuf);
1374 pBuf += sizeof(tANI_U16);
1375
1376 if (pAssocCnf->messageType == eWNI_SME_ASSOC_CNF)
1377 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001378 PELOG1(limLog(pMac, LOG1, FL("SME_ASSOC_CNF length %d bytes is:"), pAssocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001379 }
1380 else
1381 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001382 PELOG1(limLog(pMac, LOG1, FL("SME_REASSOC_CNF length %d bytes is:"), pAssocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001383 }
1384 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pAssocCnf->length);)
1385
1386 // status code
1387 pAssocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
1388 pBuf += sizeof(tSirResultCodes);
1389
1390 // bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301391 vos_mem_copy( pAssocCnf->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001392 pBuf += sizeof(tSirMacAddr);
1393
1394 // peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301395 vos_mem_copy( pAssocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001396 pBuf += sizeof(tSirMacAddr);
1397
1398
1399 pAssocCnf->aid = limGetU16(pBuf);
1400 pBuf += sizeof(tANI_U16);
1401 // alternateBssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301402 vos_mem_copy( pAssocCnf->alternateBssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001403 pBuf += sizeof(tSirMacAddr);
1404
1405 // alternateChannelId
1406 pAssocCnf->alternateChannelId = *pBuf;
1407 pBuf++;
1408
1409 return eSIR_SUCCESS;
1410} /*** end limAssocCnfSerDes() ***/
1411
1412
1413
1414/**
1415 * limDisassocCnfSerDes()
1416 *
1417 *FUNCTION:
1418 * This function is called by limProcessSmeMessages() when
1419 * SME_DISASSOC_CNF message is received from upper layer software.
1420 *
1421 *PARAMS:
1422 *
1423 *LOGIC:
1424 *
1425 *ASSUMPTIONS:
1426 * NA
1427 *
1428 *NOTE:
1429 * NA
1430 *
1431 * @param pDisassocCnf Pointer to tSirSmeDisassocCnf being
1432 * extracted into
1433 * @param pBuf Pointer to serialized buffer
1434 * @return retCode Indicates whether message is successfully
1435 * de-serialized (eSIR_SUCCESS) or
1436 * not (eSIR_FAILURE)
1437 */
1438
1439tSirRetStatus
1440limDisassocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeDisassocCnf pDisassocCnf, tANI_U8 *pBuf)
1441{
1442#ifdef PE_DEBUG_LOG1
1443 tANI_U8 *pTemp = pBuf;
1444#endif
1445
1446 if (!pDisassocCnf || !pBuf)
1447 return eSIR_FAILURE;
1448
1449 pDisassocCnf->messageType = limGetU16(pBuf);
1450 pBuf += sizeof(tANI_U16);
1451
1452 pDisassocCnf->length = limGetU16(pBuf);
1453 pBuf += sizeof(tANI_U16);
1454
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001455 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_CNF length %d bytes is:"), pDisassocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001456 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pDisassocCnf->length);)
1457
1458 pDisassocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
1459 pBuf += sizeof(tSirResultCodes);
1460
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301461 vos_mem_copy( pDisassocCnf->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001462 pBuf += sizeof(tSirMacAddr);
Jeff Johnson62c27982013-02-27 17:53:55 -08001463
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301464 vos_mem_copy( pDisassocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001465
Jeff Johnson62c27982013-02-27 17:53:55 -08001466
Jeff Johnson295189b2012-06-20 16:38:30 -07001467 return eSIR_SUCCESS;
1468} /*** end limDisassocCnfSerDes() ***/
1469
1470
1471
Jeff Johnson295189b2012-06-20 16:38:30 -07001472
1473
1474/**---------------------------------------------------------------
1475\fn limReassocIndSerDes
1476\brief This function is called by limProcessMlmReassocInd() to
1477\ populate the SME_REASSOC_IND message based on the received
1478\ MLM_REASSOC_IND.
1479\
1480\param pMac
1481\param pReassocInd - Pointer to the received tLimMlmReassocInd
1482\param pBuf - Pointer to serialized buffer
1483\param psessionEntry - pointer to PE session entry
1484\
1485\return None
1486------------------------------------------------------------------*/
1487void
1488limReassocIndSerDes(tpAniSirGlobal pMac, tpLimMlmReassocInd pReassocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
1489{
1490 tANI_U8 *pLen = pBuf;
1491 tANI_U16 mLen = 0;
1492
1493#ifdef PE_DEBUG_LOG1
1494 tANI_U8 *pTemp = pBuf;
1495#endif
1496
Jeff Johnson295189b2012-06-20 16:38:30 -07001497
1498 mLen = sizeof(tANI_U32);
1499 pBuf += sizeof(tANI_U16);
1500 *pBuf++ = psessionEntry->smeSessionId;
1501 mLen += sizeof(tANI_U8);
1502
1503 // Fill in peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301504 vos_mem_copy( pBuf, pReassocInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001505 pBuf += sizeof(tSirMacAddr);
1506 mLen += sizeof(tSirMacAddr);
1507
1508 // Fill in oldMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301509 vos_mem_copy( pBuf, pReassocInd->currentApAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001510 pBuf += sizeof(tSirMacAddr);
1511 mLen += sizeof(tSirMacAddr);
1512
1513 // Fill in aid
1514 limCopyU16(pBuf, pReassocInd->aid);
1515 pBuf += sizeof(tANI_U16);
1516 mLen += sizeof(tANI_U16);
1517
1518 // Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301519 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001520 pBuf += sizeof(tSirMacAddr);
1521 mLen += sizeof(tSirMacAddr);
1522
1523 // Fill in staId
1524 limCopyU16(pBuf, psessionEntry->staId);
1525 pBuf += sizeof(tANI_U16);
1526 mLen += sizeof(tANI_U16);
1527
1528 // Fill in authType
1529 limCopyU32(pBuf, pReassocInd->authType);
1530 pBuf += sizeof(tAniAuthType);
1531 mLen += sizeof(tAniAuthType);
1532
1533 // Fill in ssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301534 vos_mem_copy( pBuf, (tANI_U8 *) &(pReassocInd->ssId),
Jeff Johnson295189b2012-06-20 16:38:30 -07001535 pReassocInd->ssId.length + 1);
1536 pBuf += 1 + pReassocInd->ssId.length;
1537 mLen += pReassocInd->ssId.length + 1;
1538
1539 // Fill in rsnIE
1540 limCopyU16(pBuf, pReassocInd->rsnIE.length);
1541 pBuf += sizeof(tANI_U16);
1542 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301543 vos_mem_copy( pBuf, (tANI_U8 *) &(pReassocInd->rsnIE.rsnIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001544 pReassocInd->rsnIE.length);
1545 pBuf += pReassocInd->rsnIE.length;
1546 mLen += pReassocInd->rsnIE.length;
1547
1548 // Fill in addIE
1549 limCopyU16(pBuf, pReassocInd->addIE.length);
1550 pBuf += sizeof(tANI_U16);
1551 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301552 vos_mem_copy( pBuf, (tANI_U8*) &(pReassocInd->addIE.addIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001553 pReassocInd->addIE.length);
1554 pBuf += pReassocInd->addIE.length;
1555 mLen += pReassocInd->addIE.length;
1556
Jeff Johnson295189b2012-06-20 16:38:30 -07001557
Jeff Johnson295189b2012-06-20 16:38:30 -07001558 limCopyU32(pBuf, pReassocInd->spectrumMgtIndicator);
1559 pBuf += sizeof(tAniBool);
1560 mLen += sizeof(tAniBool);
1561
1562 if (pReassocInd->spectrumMgtIndicator == eSIR_TRUE)
1563 {
1564 *pBuf = pReassocInd->powerCap.minTxPower;
1565 pBuf++;
1566 *pBuf = pReassocInd->powerCap.maxTxPower;
1567 pBuf++;
1568 mLen += sizeof(tSirMacPowerCapInfo);
1569
1570 *pBuf = pReassocInd->supportedChannels.numChnl;
1571 pBuf++;
1572 mLen++;
1573
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301574 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -07001575 (tANI_U8 *) &(pReassocInd->supportedChannels.channelList),
1576 pReassocInd->supportedChannels.numChnl);
1577
1578 pBuf += pReassocInd->supportedChannels.numChnl;
1579 mLen += pReassocInd->supportedChannels.numChnl;
1580 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001581 limCopyU32(pBuf, pReassocInd->WmmStaInfoPresent);
1582 pBuf += sizeof(tANI_U32);
1583 mLen += sizeof(tANI_U32);
Jeff Johnson295189b2012-06-20 16:38:30 -07001584
1585 // Fill in length of SME_REASSOC_IND message
1586 limCopyU16(pLen, mLen);
1587
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001588 PELOG1(limLog(pMac, LOG1, FL("Sending SME_REASSOC_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001589 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1590} /*** end limReassocIndSerDes() ***/
1591
1592
1593/**
1594 * limAuthIndSerDes()
1595 *
1596 *FUNCTION:
1597 * This function is called by limProcessMlmAuthInd() while sending
1598 * SME_AUTH_IND to host
1599 *
1600 *PARAMS:
1601 *
1602 *LOGIC:
1603 *
1604 *ASSUMPTIONS:
1605 * NA
1606 *
1607 *NOTE:
1608 * NA
1609 *
1610 * @param pAuthInd Pointer to tSirSmeAuthInd being sent
1611 * @param pBuf Pointer to serialized buffer
1612 *
1613 * @return None
1614 */
1615
1616void
1617limAuthIndSerDes(tpAniSirGlobal pMac, tpLimMlmAuthInd pAuthInd, tANI_U8 *pBuf)
1618{
1619 tANI_U8 *pLen = pBuf;
1620 tANI_U16 mLen = 0;
1621
1622#ifdef PE_DEBUG_LOG1
1623 tANI_U8 *pTemp = pBuf;
1624#endif
1625
1626 mLen = sizeof(tANI_U32);
1627 pBuf += sizeof(tANI_U16);
1628 *pBuf++ = pAuthInd->sessionId;
1629 mLen += sizeof(tANI_U8);
1630
1631 // BTAMP TODO: Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301632 vos_mem_set(pBuf, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001633 pBuf += sizeof(tSirMacAddr);
1634 mLen += sizeof(tSirMacAddr);
1635
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301636 vos_mem_copy( pBuf, pAuthInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001637 pBuf += sizeof(tSirMacAddr);
1638 mLen += sizeof(tSirMacAddr);
1639
1640 limCopyU32(pBuf, pAuthInd->authType);
1641 pBuf += sizeof(tAniAuthType);
1642 mLen += sizeof(tAniAuthType);
1643
1644 limCopyU16(pLen, mLen);
1645
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001646 PELOG1(limLog(pMac, LOG1, FL("Sending SME_AUTH_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001647 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1648} /*** end limAuthIndSerDes() ***/
1649
1650
1651
1652/**
1653 * limSetContextReqSerDes()
1654 *
1655 *FUNCTION:
1656 * This function is called by limProcessSmeMessages() upon receiving
1657 * SME_SETCONTEXT_REQ from host
1658 *
1659 *PARAMS:
1660 *
1661 *LOGIC:
1662 *
1663 *ASSUMPTIONS:
1664 * NA
1665 *
1666 *NOTE:
1667 * NA
1668 *
1669 * @param pSetContextReq Pointer to tSirSmeSetContextReq being
1670 * extracted
1671 * @param pBuf Pointer to serialized buffer
1672 *
1673 * @return retCode Indicates whether message is successfully
1674 * de-serialized (eSIR_SUCCESS) or
1675 * not (eSIR_FAILURE)
1676 */
1677
1678tSirRetStatus
1679limSetContextReqSerDes(tpAniSirGlobal pMac, tpSirSmeSetContextReq pSetContextReq, tANI_U8 *pBuf)
1680{
1681 tANI_S16 len = 0;
1682 tANI_U16 totalKeySize = sizeof(tANI_U8); // initialized to sizeof numKeys
1683 tANI_U8 numKeys;
1684 tANI_U8 *pKeys;
1685
1686#ifdef PE_DEBUG_LOG1
1687 tANI_U8 *pTemp = pBuf;
1688#endif
1689 if (!pSetContextReq || !pBuf)
1690 return eSIR_FAILURE;
1691
1692 pSetContextReq->messageType = limGetU16(pBuf);
1693 pBuf += sizeof(tANI_U16);
1694
1695 len = pSetContextReq->length = limGetU16(pBuf);
1696 pBuf += sizeof(tANI_U16);
1697
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001698 PELOG1(limLog(pMac, LOG1, FL("SME_SETCONTEXT_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001699 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
1700
1701 if (len < (tANI_S16) sizeof(tANI_U32))
1702 return eSIR_FAILURE;
1703
1704 len -= sizeof(tANI_U32); // skip message header
1705 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1706 return eSIR_FAILURE;
1707
1708 // Extract sessionId
1709 pSetContextReq->sessionId = *pBuf++;
1710 len--;
1711 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1712 return eSIR_FAILURE;
1713
1714 // Extract transactionId
1715 pSetContextReq->transactionId = sirReadU16N(pBuf);
1716 pBuf += sizeof(tANI_U16);
1717 len -= sizeof(tANI_U16);
1718 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1719 return eSIR_FAILURE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301720 vos_mem_copy( (tANI_U8 *) pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001721 pBuf, sizeof(tSirMacAddr));
1722 pBuf += sizeof(tSirMacAddr);
1723 len -= sizeof(tSirMacAddr);
1724 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1725 return eSIR_FAILURE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301726 vos_mem_copy( pSetContextReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001727 pBuf += sizeof(tSirMacAddr);
1728 len -= sizeof(tSirMacAddr);
1729 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1730 return eSIR_FAILURE;
1731
Jeff Johnson295189b2012-06-20 16:38:30 -07001732
1733// pSetContextReq->qosInfoPresent = limGetU32(pBuf);
1734// pBuf += sizeof(tAniBool);
1735
1736// if (pSetContextReq->qosInfoPresent)
1737// {
1738// len = limGetQosInfo(&pSetContextReq->qos, pBuf);
1739// pBuf += len;
1740// }
1741
1742 pSetContextReq->keyMaterial.length = limGetU16(pBuf);
1743 pBuf += sizeof(tANI_U16);
1744 len -= sizeof(tANI_U16);
1745 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1746 return eSIR_FAILURE;
1747
1748 pSetContextReq->keyMaterial.edType = (tAniEdType) limGetU32(pBuf);
1749 pBuf += sizeof(tAniEdType);
1750 len -= sizeof(tAniEdType);
1751 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1752 return eSIR_FAILURE;
1753
1754 numKeys = pSetContextReq->keyMaterial.numKeys = *pBuf++;
1755 len -= sizeof(numKeys);
1756
1757 if (numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
1758 return eSIR_FAILURE;
1759
1760 /** Initialize the Default Keys if no Keys are being sent from the upper layer*/
1761 if( limCheckRemainingLength(pMac, len) == eSIR_FAILURE) {
1762 tpSirKeys pKeyinfo = pSetContextReq->keyMaterial.key;
1763
1764 pKeyinfo->keyId = 0;
1765 pKeyinfo->keyDirection = eSIR_TX_RX;
1766 pKeyinfo->keyLength = 0;
1767
1768 if (!limIsAddrBC(pSetContextReq->peerMacAddr))
1769 pKeyinfo->unicast = 1;
1770 else
1771 pKeyinfo->unicast = 0;
1772 }else {
1773 pKeys = (tANI_U8 *) pSetContextReq->keyMaterial.key;
1774 do {
1775 tANI_U32 keySize = limGetKeysInfo(pMac, (tpSirKeys) pKeys,
1776 pBuf);
1777 pBuf += keySize;
1778 pKeys += sizeof(tSirKeys);
1779 totalKeySize += (tANI_U16) keySize;
1780 if (numKeys == 0)
1781 break;
1782 numKeys--;
1783 }while (numKeys);
1784 }
1785 return eSIR_SUCCESS;
1786} /*** end limSetContextReqSerDes() ***/
1787
1788/**
1789 * limRemoveKeyReqSerDes()
1790 *
1791 *FUNCTION:
1792 * This function is called by limProcessSmeMessages() upon receiving
1793 * SME_REMOVEKEY_REQ from host
1794 *
1795 *PARAMS:
1796 *
1797 *LOGIC:
1798 *
1799 *ASSUMPTIONS:
1800 * NA
1801 *
1802 *NOTE:
1803 * NA
1804 *
1805 * @param pRemoveKeyReq Pointer to tSirSmeRemoveKeyReq being
1806 * extracted
1807 * @param pBuf Pointer to serialized buffer
1808 *
1809 * @return retCode Indicates whether message is successfully
1810 * de-serialized (eSIR_SUCCESS) or
1811 * not (eSIR_FAILURE)
1812 */
1813
1814tSirRetStatus
1815limRemoveKeyReqSerDes(tpAniSirGlobal pMac, tpSirSmeRemoveKeyReq pRemoveKeyReq, tANI_U8 *pBuf)
1816{
1817 tANI_S16 len = 0;
1818
1819#ifdef PE_DEBUG_LOG1
1820 tANI_U8 *pTemp = pBuf;
1821#endif
1822 if (!pRemoveKeyReq || !pBuf)
1823 return eSIR_FAILURE;
1824
1825 pRemoveKeyReq->messageType = limGetU16(pBuf);
1826 pBuf += sizeof(tANI_U16);
1827
1828 len = pRemoveKeyReq->length = limGetU16(pBuf);
1829 pBuf += sizeof(tANI_U16);
1830
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001831 PELOG1(limLog(pMac, LOG1, FL("SME_REMOVEKEY_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001832 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
1833
1834 if (len < (tANI_S16) sizeof(tANI_U32))
1835 return eSIR_FAILURE;
1836
1837 len -= sizeof(tANI_U32); // skip message header
1838 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1839 return eSIR_FAILURE;
1840
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301841 vos_mem_copy( (tANI_U8 *) pRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001842 pBuf, sizeof(tSirMacAddr));
1843 pBuf += sizeof(tSirMacAddr);
1844 len -= sizeof(tSirMacAddr);
1845 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1846 return eSIR_FAILURE;
1847
Jeff Johnson295189b2012-06-20 16:38:30 -07001848
1849 pRemoveKeyReq->edType = *pBuf;
1850 pBuf += sizeof(tANI_U8);
1851 len -= sizeof(tANI_U8);
1852 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1853 return eSIR_FAILURE;
1854
1855 pRemoveKeyReq->wepType = *pBuf;
1856
1857 pBuf += sizeof(tANI_U8);
1858 len -= sizeof(tANI_U8);
1859 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1860 return eSIR_FAILURE;
1861
1862 pRemoveKeyReq->keyId = *pBuf;
1863
1864 pBuf += sizeof(tANI_U8);
1865 len -= sizeof(tANI_U8);
1866 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1867 return eSIR_FAILURE;
1868
1869 pRemoveKeyReq->unicast = *pBuf;
1870 len--;
1871 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1872 return eSIR_FAILURE;
1873
1874 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301875 vos_mem_copy( pRemoveKeyReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001876 pBuf += sizeof(tSirMacAddr);
1877 len -= sizeof(tSirMacAddr);
1878 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1879 return eSIR_FAILURE;
1880
1881 // Extract sessionId
1882 pRemoveKeyReq->sessionId = *pBuf++;
1883 len--;
1884 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1885 return eSIR_FAILURE;
1886
1887 // Extract transactionId
1888 pRemoveKeyReq->transactionId = sirReadU16N(pBuf);
1889 pBuf += sizeof(tANI_U16);
1890 len -= sizeof(tANI_U16);
1891 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1892 return eSIR_FAILURE;
1893
1894 return eSIR_SUCCESS;
1895} /*** end limRemoveKeyReqSerDes() ***/
1896
1897
1898
1899/**
1900 * limDisassocReqSerDes()
1901 *
1902 *FUNCTION:
1903 * This function is called by limProcessSmeMessages() upon receiving
1904 * SME_DISASSOC_REQ from host
1905 *
1906 *PARAMS:
1907 *
1908 *LOGIC:
1909 *
1910 *ASSUMPTIONS:
1911 * NA
1912 *
1913 *NOTE:
1914 * NA
1915 *
1916 * @param pDisassocReq Pointer to tSirSmeDisassocReq being extracted
1917 * @param pBuf Pointer to serialized buffer
1918 *
1919 * @return retCode Indicates whether message is successfully
1920 * de-serialized (eSIR_SUCCESS) or
1921 * not (eSIR_FAILURE)
1922 */
1923
1924tSirRetStatus
1925limDisassocReqSerDes(tpAniSirGlobal pMac, tSirSmeDisassocReq *pDisassocReq, tANI_U8 *pBuf)
1926{
1927 tANI_S16 len = 0;
1928#ifdef PE_DEBUG_LOG1
1929 tANI_U8 *pTemp = pBuf;
1930#endif
1931
1932 if (!pDisassocReq || !pBuf)
1933 return eSIR_FAILURE;
1934
1935 pDisassocReq->messageType = limGetU16(pBuf);
1936 pBuf += sizeof(tANI_U16);
1937
1938 len = pDisassocReq->length = limGetU16(pBuf);
1939 pBuf += sizeof(tANI_U16);
1940
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001941 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001942 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
1943
1944 if (len < (tANI_S16) sizeof(tANI_U32))
1945 return eSIR_FAILURE;
1946
1947 len -= sizeof(tANI_U32); // skip message header
1948 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1949 return eSIR_FAILURE;
1950
1951 // Extract sessionID
1952 pDisassocReq->sessionId = *pBuf;
1953 pBuf += sizeof(tANI_U8);
1954 len -= sizeof(tANI_U8);
1955 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1956 return eSIR_FAILURE;
1957
1958 // Extract transactionid
1959 pDisassocReq->transactionId = limGetU16(pBuf);
1960 pBuf += sizeof(tANI_U16);
1961 len -= sizeof(tANI_U16);
1962 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1963 return eSIR_FAILURE;
1964
1965 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301966 vos_mem_copy( (tANI_U8 *) pDisassocReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001967 pBuf += sizeof(tSirMacAddr);
1968 len -= sizeof(tSirMacAddr);
1969 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1970 return eSIR_FAILURE;
1971
1972 // Extract peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301973 vos_mem_copy( pDisassocReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001974 pBuf += sizeof(tSirMacAddr);
1975 len -= sizeof(tSirMacAddr);
1976 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1977 return eSIR_FAILURE;
1978
1979 // Extract reasonCode
1980 pDisassocReq->reasonCode = limGetU16(pBuf);
1981 pBuf += sizeof(tANI_U16);
1982 len -= sizeof(tANI_U16);
1983 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1984 return eSIR_FAILURE;
1985
1986 pDisassocReq->doNotSendOverTheAir = *pBuf;
1987 pBuf += sizeof(tANI_U8);
1988 len -= sizeof(tANI_U8);
1989
Jeff Johnson295189b2012-06-20 16:38:30 -07001990
1991 return eSIR_SUCCESS;
1992} /*** end limDisassocReqSerDes() ***/
1993
1994
1995
1996/**
1997 * limDeauthReqSerDes()
1998 *
1999 *FUNCTION:
2000 * This function is called by limProcessSmeMessages() upon receiving
2001 * SME_DEAUTH_REQ from host
2002 *
2003 *PARAMS:
2004 *
2005 *LOGIC:
2006 *
2007 *ASSUMPTIONS:
2008 * NA
2009 *
2010 *NOTE:
2011 * NA
2012 *
2013 * @param pDeauthReq Pointer to tSirSmeDeauthReq being extracted
2014 * @param pBuf Pointer to serialized buffer
2015 *
2016 * @return retCode Indicates whether message is successfully
2017 * de-serialized (eSIR_SUCCESS) or
2018 * not (eSIR_FAILURE)
2019 */
2020tSirRetStatus
2021limDeauthReqSerDes(tpAniSirGlobal pMac, tSirSmeDeauthReq *pDeauthReq, tANI_U8 *pBuf)
2022{
2023 tANI_S16 len = 0;
2024
2025#ifdef PE_DEBUG_LOG1
2026 tANI_U8 *pTemp = pBuf;
2027#endif
2028
2029 if (!pDeauthReq || !pBuf)
2030 return eSIR_FAILURE;
2031
2032 pDeauthReq->messageType = limGetU16(pBuf);
2033 pBuf += sizeof(tANI_U16);
2034
2035 len = pDeauthReq->length = limGetU16(pBuf);
2036 pBuf += sizeof(tANI_U16);
2037
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002038 PELOG1(limLog(pMac, LOG1, FL("SME_DEAUTH_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002039 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2040
2041 if (len < (tANI_S16) sizeof(tANI_U32))
2042 return eSIR_FAILURE;
2043
2044 len -= sizeof(tANI_U32); // skip message header
2045 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2046 return eSIR_FAILURE;
2047
2048 // Extract sessionId
2049 pDeauthReq->sessionId = *pBuf++;
2050 len--;
2051 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2052 return eSIR_FAILURE;
2053
2054 // Extract transactionId
2055 pDeauthReq->transactionId = limGetU16(pBuf);
2056 pBuf += sizeof(tANI_U16);
2057 len -= sizeof(tANI_U16);
2058 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2059 return eSIR_FAILURE;
2060
2061 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302062 vos_mem_copy( pDeauthReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002063 pBuf += sizeof(tSirMacAddr);
2064 len -= sizeof(tSirMacAddr);
2065 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2066 return eSIR_FAILURE;
2067
2068 // Extract peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302069 vos_mem_copy( pDeauthReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002070 pBuf += sizeof(tSirMacAddr);
2071 len -= sizeof(tSirMacAddr);
2072 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2073 return eSIR_FAILURE;
2074
2075 // Extract reasonCode
2076 pDeauthReq->reasonCode = limGetU16(pBuf);
2077 pBuf += sizeof(tANI_U16);
2078 len -= sizeof(tANI_U16);
2079
Jeff Johnson295189b2012-06-20 16:38:30 -07002080
2081 return eSIR_SUCCESS;
2082} /*** end limDisassocReqSerDes() ***/
2083
2084
2085
2086
Jeff Johnson295189b2012-06-20 16:38:30 -07002087
2088
2089/**
2090 * limStatSerDes()
2091 *
2092 *FUNCTION:
2093 * This function is called by limSendSmeDisassocNtf() while sending
2094 * SME_DISASSOC_IND/eWNI_SME_DISASSOC_RSP to host
2095 *
2096 *PARAMS:
2097 *
2098 *LOGIC:
2099 *
2100 *ASSUMPTIONS:
2101 * NA
2102 *
2103 *NOTE:
2104 * NA
2105 *
2106 * @param pAssocInd Pointer to tpAniStaStatStruct being sent
2107 * @param pBuf Pointer to serialized buffer
2108 *
2109 * @return None
2110 */
2111
2112void
2113limStatSerDes(tpAniSirGlobal pMac, tpAniStaStatStruct pStat, tANI_U8 *pBuf)
2114{
2115#ifdef PE_DEBUG_LOG1
2116 tANI_U8 *pTemp = pBuf;
2117#endif
2118
2119 limCopyU32(pBuf, pStat->sentAesBlksUcastHi);
2120 pBuf += sizeof(tANI_U32);
2121
2122 limCopyU32(pBuf, pStat->sentAesBlksUcastLo);
2123 pBuf += sizeof(tANI_U32);
2124
2125 limCopyU32(pBuf, pStat->recvAesBlksUcastHi);
2126 pBuf += sizeof(tANI_U32);
2127
2128 limCopyU32(pBuf, pStat->recvAesBlksUcastLo);
2129 pBuf += sizeof(tANI_U32);
2130
2131 limCopyU32(pBuf, pStat->aesFormatErrorUcastCnts);
2132 pBuf += sizeof(tANI_U32);
2133
2134 limCopyU32(pBuf, pStat->aesReplaysUcast);
2135 pBuf += sizeof(tANI_U32);
2136
2137 limCopyU32(pBuf, pStat->aesDecryptErrUcast);
2138 pBuf += sizeof(tANI_U32);
2139
2140 limCopyU32(pBuf, pStat->singleRetryPkts);
2141 pBuf += sizeof(tANI_U32);
2142
2143 limCopyU32(pBuf, pStat->failedTxPkts);
2144 pBuf += sizeof(tANI_U32);
2145
2146 limCopyU32(pBuf, pStat->ackTimeouts);
2147 pBuf += sizeof(tANI_U32);
2148
2149 limCopyU32(pBuf, pStat->multiRetryPkts);
2150 pBuf += sizeof(tANI_U32);
2151
2152 limCopyU32(pBuf, pStat->fragTxCntsHi);
2153 pBuf += sizeof(tANI_U32);
2154
2155 limCopyU32(pBuf, pStat->fragTxCntsLo);
2156 pBuf += sizeof(tANI_U32);
2157
2158 limCopyU32(pBuf, pStat->transmittedPktsHi);
2159 pBuf += sizeof(tANI_U32);
2160
2161 limCopyU32(pBuf, pStat->transmittedPktsLo);
2162 pBuf += sizeof(tANI_U32);
2163
2164 limCopyU32(pBuf, pStat->phyStatHi);
2165 pBuf += sizeof(tANI_U32);
2166
2167 limCopyU32(pBuf, pStat->phyStatLo);
2168 pBuf += sizeof(tANI_U32);
2169
2170 limCopyU32(pBuf, pStat->uplinkRssi);
2171 pBuf += sizeof(tANI_U32);
2172
2173 limCopyU32(pBuf, pStat->uplinkSinr);
2174 pBuf += sizeof(tANI_U32);
2175
2176 limCopyU32(pBuf, pStat->uplinkRate);
2177 pBuf += sizeof(tANI_U32);
2178
2179 limCopyU32(pBuf, pStat->downlinkRssi);
2180 pBuf += sizeof(tANI_U32);
2181
2182 limCopyU32(pBuf, pStat->downlinkSinr);
2183 pBuf += sizeof(tANI_U32);
2184
2185 limCopyU32(pBuf, pStat->downlinkRate);
2186 pBuf += sizeof(tANI_U32);
2187
2188 limCopyU32(pBuf, pStat->nRcvBytes);
2189 pBuf += sizeof(tANI_U32);
2190
2191 limCopyU32(pBuf, pStat->nXmitBytes);
2192 pBuf += sizeof(tANI_U32);
2193
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002194 PELOG1(limLog(pMac, LOG1, FL("STAT: length %d bytes is:"), sizeof(tAniStaStatStruct));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002195 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, sizeof(tAniStaStatStruct));)
2196
2197} /*** end limStatSerDes() ***/
2198
2199
Jeff Johnson295189b2012-06-20 16:38:30 -07002200
2201
2202/**
2203 * limPackBkgndScanFailNotify()
2204 *
2205 *FUNCTION:
2206 * This function is called by limSendSmeWmStatusChangeNtf()
2207 * to pack the tSirBackgroundScanInfo message
2208 *
2209 */
2210void
2211limPackBkgndScanFailNotify(tpAniSirGlobal pMac,
2212 tSirSmeStatusChangeCode statusChangeCode,
2213 tpSirBackgroundScanInfo pScanInfo,
2214 tSirSmeWmStatusChangeNtf *pSmeNtf,
2215 tANI_U8 sessionId)
2216{
2217
2218 tANI_U16 length = (sizeof(tANI_U16) * 2) + sizeof(tANI_U8) +
2219 sizeof(tSirSmeStatusChangeCode) +
2220 sizeof(tSirBackgroundScanInfo);
2221
Jeff Johnson295189b2012-06-20 16:38:30 -07002222 pSmeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
2223 pSmeNtf->statusChangeCode = statusChangeCode;
2224 pSmeNtf->length = length;
2225 pSmeNtf->sessionId = sessionId;
2226 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanSuccess = pScanInfo->numOfScanSuccess;
2227 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanFailure = pScanInfo->numOfScanFailure;
2228 pSmeNtf->statusChangeInfo.bkgndScanInfo.reserved = pScanInfo->reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07002229}
2230
Jeff Johnson295189b2012-06-20 16:38:30 -07002231
Jeff Johnson295189b2012-06-20 16:38:30 -07002232/**
2233 * limIsSmeGetAssocSTAsReqValid()
2234 *
2235 *FUNCTION:
2236 * This function is called by limProcessSmeReqMessages() upon
2237 * receiving SME_GET_ASSOC_STAS_REQ message from application.
2238 *
2239 *LOGIC:
2240 * Message validity checks are performed in this function
2241 *
2242 *ASSUMPTIONS:
2243 *
2244 *NOTE:
2245 *
2246 * @param pBuf - Pointer to a serialized SME_GET_ASSOC_STAS_REQ message
2247 * @param pSmeMsg - Pointer to a tSirSmeGetAssocSTAsReq structure
2248 * @return true if SME_GET_ASSOC_STAS_REQ message is formatted correctly
2249 * false otherwise
2250 */
2251tANI_BOOLEAN
2252limIsSmeGetAssocSTAsReqValid(tpAniSirGlobal pMac, tpSirSmeGetAssocSTAsReq pGetAssocSTAsReq, tANI_U8 *pBuf)
2253{
2254 tANI_S16 len = 0;
2255
2256 pGetAssocSTAsReq->messageType = limGetU16(pBuf);
2257 pBuf += sizeof(tANI_U16);
2258
2259 len = pGetAssocSTAsReq->length = limGetU16(pBuf);
2260 pBuf += sizeof(tANI_U16);
2261
2262 if (len < (tANI_S16) sizeof(tANI_U32))
2263 return eSIR_FAILURE;
2264
2265 len -= sizeof(tANI_U32); // skip message header
2266 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2267 return eSIR_FAILURE;
2268
2269 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302270 vos_mem_copy( (tANI_U8 *) pGetAssocSTAsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002271 pBuf += sizeof(tSirMacAddr);
2272 len -= sizeof(tSirMacAddr);
2273 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2274 return eSIR_FAILURE;
2275
2276 // Extract modId
2277 pGetAssocSTAsReq->modId = limGetU16(pBuf);
2278 pBuf += sizeof(tANI_U16);
2279 len -= sizeof(tANI_U16);
2280 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2281 return eSIR_FAILURE;
2282
2283 // Extract pUsrContext
2284 pGetAssocSTAsReq->pUsrContext = (void *)limGetU32(pBuf);
2285 pBuf += sizeof(tANI_U32);
2286 len -= sizeof(tANI_U32);
2287 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2288 return eSIR_FAILURE;
2289
2290 // Extract pSapEventCallback
2291 pGetAssocSTAsReq->pSapEventCallback = (void *)limGetU32(pBuf);
2292 pBuf += sizeof(tANI_U32);
2293 len -= sizeof(tANI_U32);
2294 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2295 return eSIR_FAILURE;
2296
2297 // Extract pAssocStasArray
2298 pGetAssocSTAsReq->pAssocStasArray = (void *)limGetU32(pBuf);
2299 pBuf += sizeof(tANI_U32);
2300 len -= sizeof(tANI_U32);
2301
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002302 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002303
2304 if (len < 0)
2305 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002306 PELOGE(limLog(pMac, LOGE, FL("SME_GET_ASSOC_STAS_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002307 return eANI_BOOLEAN_FALSE;
2308 }
2309
2310 return eANI_BOOLEAN_TRUE;
2311}
2312
2313/**
2314 * limTkipCntrMeasReqSerDes()
2315 *
2316 *FUNCTION:
2317 * This function is called by limProcessSmeMessages() upon receiving
2318 * eWNI_SME_TKIP_CNTR_MEAS_REQ from host HDD
2319 *
2320 *PARAMS:
2321 *
2322 *LOGIC:
2323 *
2324 *ASSUMPTIONS:
2325 * NA
2326 *
2327 *NOTE:
2328 * NA
2329 *
2330 * @param tpSirSmeTkipCntrMeasReq Pointer to tSirSmeTkipCntrMeasReq being extracted
2331 * @param pBuf Pointer to serialized buffer
2332 * @return retCode Indicates whether message is successfully
2333 * de-serialized (eSIR_SUCCESS) or
2334 * not (eSIR_FAILURE)
2335 */
2336tSirRetStatus
2337limTkipCntrMeasReqSerDes(tpAniSirGlobal pMac, tpSirSmeTkipCntrMeasReq pTkipCntrMeasReq, tANI_U8 *pBuf)
2338{
2339 tANI_S16 len = 0;
2340
2341#ifdef PE_DEBUG_LOG1
2342 tANI_U8 *pTemp = pBuf;
2343#endif
2344
2345 pTkipCntrMeasReq->messageType = limGetU16(pBuf);
2346 pBuf += sizeof(tANI_U16);
2347
2348 len = pTkipCntrMeasReq->length = limGetU16(pBuf);
2349 pBuf += sizeof(tANI_U16);
2350
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002351 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002352 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2353
2354 if (len < (tANI_S16) sizeof(tANI_U32))
2355 return eSIR_FAILURE;
2356
2357 len -= sizeof(tANI_U32); // skip message header
2358 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2359 return eSIR_FAILURE;
2360
2361 // Extract sessionId
2362 pTkipCntrMeasReq->sessionId = *pBuf++;
2363 len--;
2364 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2365 return eSIR_FAILURE;
2366
2367 // Extract transactionId
2368 pTkipCntrMeasReq->transactionId = limGetU16(pBuf);
2369 pBuf += sizeof(tANI_U16);
2370 len -= sizeof(tANI_U16);
2371 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2372 return eSIR_FAILURE;
2373
2374 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302375 vos_mem_copy( (tANI_U8 *) pTkipCntrMeasReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002376 pBuf += sizeof(tSirMacAddr);
2377 len -= sizeof(tSirMacAddr);
2378 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2379 return eSIR_FAILURE;
2380
2381 // Extract bEnable
2382 pTkipCntrMeasReq->bEnable = *pBuf++;
2383 len --;
2384
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002385 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002386
2387 if (len)
2388 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002389 PELOGE(limLog(pMac, LOGE, FL("SME_TKIP_CNTR_MEAS_REQ invalid "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002390 return eSIR_FAILURE;
2391 }
2392 else
2393 return eSIR_SUCCESS;
2394}
2395
2396/**
2397 * limIsSmeGetWPSPBCSessionsReqValid()
2398 *
2399 *FUNCTION:
2400 * This function is called by limProcessSmeGetWPSPBCSessions() upon
2401 * receiving query WPS PBC overlap information message from application.
2402 *
2403 *LOGIC:
2404 * Message validity checks are performed in this function
2405 *
2406 *ASSUMPTIONS:
2407 *
2408 *NOTE:
2409 *
2410 * @param pBuf - Pointer to a serialized SME_GET_WPSPBC_SESSION_REQ message
2411 * @param pGetWPSPBCSessionsReq - Pointer to a tSirSmeGetWPSPBCSessionsReq structure
2412 * @return true if SME_GET_WPSPBC_SESSION_REQ message is formatted correctly
2413 * false otherwise
2414 */
2415
2416tSirRetStatus
2417limIsSmeGetWPSPBCSessionsReqValid(tpAniSirGlobal pMac, tSirSmeGetWPSPBCSessionsReq *pGetWPSPBCSessionsReq, tANI_U8 *pBuf)
2418{
2419 tANI_S16 len = 0;
2420
2421 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirSmeGetWPSPBCSessionsReq));)
2422
2423 pGetWPSPBCSessionsReq->messageType = limGetU16(pBuf);
2424 pBuf += sizeof(tANI_U16);
2425
2426 len = pGetWPSPBCSessionsReq->length = limGetU16(pBuf);
2427 pBuf += sizeof(tANI_U16);
2428
2429 if (len < (tANI_S16) sizeof(tANI_U32))
2430 return eSIR_FAILURE;
2431
2432 len -= sizeof(tANI_U32); // skip message header
2433 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2434 return eSIR_FAILURE;
2435
2436 // Extract pUsrContext
2437 pGetWPSPBCSessionsReq->pUsrContext = (void *)limGetU32(pBuf);
2438 pBuf += sizeof(tANI_U32);
2439 len -= sizeof(tANI_U32);
2440 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2441 return eSIR_FAILURE;
2442
2443 // Extract pSapEventCallback
2444 pGetWPSPBCSessionsReq->pSapEventCallback = (void *)limGetU32(pBuf);
2445 pBuf += sizeof(tANI_U32);
2446 len -= sizeof(tANI_U32);
2447 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2448 return eSIR_FAILURE;
2449
2450 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302451 vos_mem_copy( (tANI_U8 *) pGetWPSPBCSessionsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002452 pBuf += sizeof(tSirMacAddr);
2453 len -= sizeof(tSirMacAddr);
2454
2455 // Extract MAC address of Station to be removed
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302456 vos_mem_copy( (tANI_U8 *) pGetWPSPBCSessionsReq->pRemoveMac, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002457 pBuf += sizeof(tSirMacAddr);
2458 len -= sizeof(tSirMacAddr);
2459
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002460 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002461
2462 if (len < 0)
2463 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002464 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002465 return eSIR_FAILURE;
2466 }
2467
2468 return eSIR_SUCCESS;
2469}
2470
Jeff Johnson295189b2012-06-20 16:38:30 -07002471
2472/**---------------------------------------------------------------
2473\fn limGetSessionInfo
2474\brief This function returns the sessionId and transactionId
2475\ of a message. This assumes that the message structure
2476\ is of format:
2477\ tANI_U16 messageType
2478\ tANI_U16 messageLength
2479\ tANI_U8 sessionId
2480\ tANI_U16 transactionId
2481\param pMac - pMac global structure
2482\param *pBuf - pointer to the message buffer
2483\param sessionId - returned session id value
2484\param transactionId - returned transaction ID value
2485\return None
2486------------------------------------------------------------------*/
2487void
2488limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U8 *sessionId, tANI_U16 *transactionId)
2489{
2490 if (!pBuf)
2491 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002492 limLog(pMac, LOGE, FL("NULL ptr received. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002493 return;
2494 }
2495
2496 pBuf += sizeof(tANI_U16); // skip message type
2497 pBuf += sizeof(tANI_U16); // skip message length
2498
2499 *sessionId = *pBuf; // get sessionId
2500 pBuf++;
2501 *transactionId = limGetU16(pBuf); // get transactionId
2502
2503 return;
2504}
2505
Jeff Johnson295189b2012-06-20 16:38:30 -07002506
2507/**
2508 * limUpdateAPWPSIEsReqSerDes()
2509 *
2510 *FUNCTION:
2511 * This function is to deserialize UpdateAPWPSIEs message
2512 *
2513 *PARAMS:
2514 *
2515 *LOGIC:
2516 *
2517 *ASSUMPTIONS:
2518 * NA
2519 *
2520 *NOTE:
2521 * NA
2522 *
2523 * @param pUpdateAPWPSIEsReq Pointer to tSirUpdateAPWPSIEsReq being
2524 * extracted
2525 * @param pBuf Pointer to serialized buffer
2526 *
2527 * @return retCode Indicates whether message is successfully
2528 * de-serialized (eSIR_SUCCESS) or
2529 * not (eSIR_FAILURE)
2530 */
2531
2532tSirRetStatus
2533limUpdateAPWPSIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq, tANI_U8 *pBuf)
2534{
2535 tANI_S16 len = 0;
2536
2537 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPSIEsReq));)
2538
2539 if (!pUpdateAPWPSIEsReq || !pBuf)
2540 return eSIR_FAILURE;
2541
2542 pUpdateAPWPSIEsReq->messageType = limGetU16(pBuf);
2543 pBuf += sizeof(tANI_U16);
2544
2545 len = pUpdateAPWPSIEsReq->length = limGetU16(pBuf);
2546 pBuf += sizeof(tANI_U16);
2547
2548 if (len < (tANI_S16) sizeof(tANI_U32))
2549 return eSIR_FAILURE;
2550
2551 len -= sizeof(tANI_U32); // skip message header
2552 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2553 return eSIR_FAILURE;
2554
2555 // Extract transactionId
2556 pUpdateAPWPSIEsReq->transactionId = limGetU16( pBuf );
2557 pBuf += sizeof( tANI_U16 );
2558 len -= sizeof( tANI_U16 );
2559 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2560 return eSIR_FAILURE;
2561
2562 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302563 vos_mem_copy( (tANI_U8 *) pUpdateAPWPSIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002564 pBuf += sizeof(tSirMacAddr);
2565 len -= sizeof(tSirMacAddr);
2566 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2567 return eSIR_FAILURE;
2568
2569 // Extract sessionId
2570 pUpdateAPWPSIEsReq->sessionId = *pBuf++;
2571 len--;
2572 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2573 return eSIR_FAILURE;
2574
2575 // Extract APWPSIEs
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302576 vos_mem_copy( (tSirAPWPSIEs *) &pUpdateAPWPSIEsReq->APWPSIEs, pBuf, sizeof(tSirAPWPSIEs));
Jeff Johnson295189b2012-06-20 16:38:30 -07002577 pBuf += sizeof(tSirAPWPSIEs);
2578 len -= sizeof(tSirAPWPSIEs);
2579
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002580 PELOG1(limLog(pMac, LOG1, FL("SME_UPDATE_APWPSIE_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002581
2582 if (len < 0)
2583 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002584 PELOGE(limLog(pMac, LOGE, FL("SME_UPDATE_APWPSIE_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002585 return eSIR_FAILURE;
2586 }
2587
2588 return eSIR_SUCCESS;
2589} /*** end limSetContextReqSerDes() ***/
2590
2591/**
2592 * limUpdateAPWPARSNIEsReqSerDes ()
2593 *
2594 *FUNCTION:
2595 * This function is to deserialize UpdateAPWPSIEs message
2596 *
2597 *PARAMS:
2598 *
2599 *LOGIC:
2600 *
2601 *ASSUMPTIONS:
2602 * NA
2603 *
2604 *NOTE:
2605 * NA
2606 *
2607 * @param pUpdateAPWPARSNIEsReq Pointer to tpSirUpdateAPWPARSNIEsReq being
2608 * extracted
2609 * @param pBuf Pointer to serialized buffer
2610 *
2611 * @return retCode Indicates whether message is successfully
2612 * de-serialized (eSIR_SUCCESS) or
2613 * not (eSIR_FAILURE)
2614 */
2615
2616tSirRetStatus
2617limUpdateAPWPARSNIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq, tANI_U8 *pBuf)
2618{
2619 tANI_S16 len = 0;
2620
2621 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPARSNIEsReq));)
2622
2623 if (!pUpdateAPWPARSNIEsReq || !pBuf)
2624 return eSIR_FAILURE;
2625
2626 pUpdateAPWPARSNIEsReq->messageType = limGetU16(pBuf);
2627 pBuf += sizeof(tANI_U16);
2628
2629 len = pUpdateAPWPARSNIEsReq->length = limGetU16(pBuf);
2630 pBuf += sizeof(tANI_U16);
2631
2632 if (len < (tANI_S16) sizeof(tANI_U32))
2633 return eSIR_FAILURE;
2634
2635 len -= sizeof(tANI_U32); // skip message header
2636 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2637 return eSIR_FAILURE;
2638
2639 // Extract transactionId
2640 pUpdateAPWPARSNIEsReq->transactionId = limGetU16( pBuf );
2641 pBuf += sizeof(tANI_U16);
2642 len -= sizeof( tANI_U16 );
2643 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2644 return eSIR_FAILURE;
2645
2646 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302647 vos_mem_copy( (tANI_U8 *) pUpdateAPWPARSNIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002648 pBuf += sizeof(tSirMacAddr);
2649 len -= sizeof(tSirMacAddr);
2650 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2651 return eSIR_FAILURE;
2652
2653 // Extract sessionId
2654 pUpdateAPWPARSNIEsReq->sessionId = *pBuf++;
2655 len--;
2656 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2657 return eSIR_FAILURE;
2658
2659 // Extract APWPARSNIEs
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302660 vos_mem_copy( (tSirRSNie *) &pUpdateAPWPARSNIEsReq->APWPARSNIEs, pBuf, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07002661 pBuf += sizeof(tSirRSNie);
2662 len -= sizeof(tSirRSNie);
2663
2664 if (len < 0)
2665 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002666 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002667 return eSIR_FAILURE;
2668 }
2669
2670 return eSIR_SUCCESS;
2671} /*** end limUpdateAPWPARSNIEsReqSerDes() ***/
2672