blob: a7ec961c81f640a623abfa0a7d7985b7e0185a46 [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
Jeff Johnson295189b2012-06-20 16:38:30 -07001167 // Extract Titan CB Neighbor BSS info
1168 pJoinReq->cbNeighbors.cbBssFoundPri = *pBuf;
1169 pBuf++;
1170 pJoinReq->cbNeighbors.cbBssFoundSecUp = *pBuf;
1171 pBuf++;
1172 pJoinReq->cbNeighbors.cbBssFoundSecDown = *pBuf;
1173 pBuf++;
1174 len -= 3;
1175
1176 // Extract Spectrum Mgt Indicator
1177 pJoinReq->spectrumMgtIndicator = (tAniBool) limGetU32(pBuf);
1178 pBuf += sizeof(tAniBool);
1179 len -= sizeof(tAniBool);
1180
1181 pJoinReq->powerCap.minTxPower = *pBuf++;
1182 pJoinReq->powerCap.maxTxPower = *pBuf++;
1183 len -=2;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001184 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 -07001185
1186 pJoinReq->supportedChannels.numChnl = *pBuf++;
1187 len--;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301188 vos_mem_copy( (tANI_U8 *) pJoinReq->supportedChannels.channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001189 pBuf, pJoinReq->supportedChannels.numChnl);
1190 pBuf += pJoinReq->supportedChannels.numChnl;
1191 len-= pJoinReq->supportedChannels.numChnl;
1192
1193 PELOG2(limLog(pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001194 FL("spectrumInd ON: minPower %d, maxPower %d , numChnls %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001195 pJoinReq->powerCap.minTxPower,
1196 pJoinReq->powerCap.maxTxPower,
1197 pJoinReq->supportedChannels.numChnl);)
1198
1199 // Extract uapsdPerAcBitmask
1200 pJoinReq->uapsdPerAcBitmask = *pBuf++;
1201 len--;
1202 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1203 return eSIR_FAILURE;
1204
Jeff Johnson295189b2012-06-20 16:38:30 -07001205 //
1206 // NOTE - tSirBssDescription is now moved to the end
1207 // of tSirSmeJoinReq structure. This is to accomodate
1208 // the variable length data member ieFields[1]
1209 //
1210 if (limGetBssDescription( pMac, &pJoinReq->bssDescription,
1211 len, &lenUsed, pBuf) == eSIR_FAILURE)
1212 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001213 PELOGE(limLog(pMac, LOGE, FL("get bss description failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001214 return eSIR_FAILURE;
1215 }
1216 PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, (tANI_U8 *) &(pJoinReq->bssDescription), pJoinReq->bssDescription.length + 2);)
1217 pBuf += lenUsed;
1218 len -= lenUsed;
Jeff Johnson295189b2012-06-20 16:38:30 -07001219
1220 return eSIR_SUCCESS;
1221} /*** end limJoinReqSerDes() ***/
1222
1223
1224/**---------------------------------------------------------------
1225\fn limAssocIndSerDes
1226\brief This function is called by limProcessMlmAssocInd() to
1227\ populate the SME_ASSOC_IND message based on the received
1228\ MLM_ASSOC_IND.
1229\
1230\param pMac
1231\param pAssocInd - Pointer to the received tLimMlmAssocInd
1232\param pBuf - Pointer to serialized buffer
1233\param psessionEntry - pointer to PE session entry
1234\
1235\return None
1236------------------------------------------------------------------*/
1237void
1238limAssocIndSerDes(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
1239{
1240 tANI_U8 *pLen = pBuf;
1241 tANI_U16 mLen = 0;
1242
1243#ifdef PE_DEBUG_LOG1
1244 tANI_U8 *pTemp = pBuf;
1245#endif
1246
Jeff Johnson295189b2012-06-20 16:38:30 -07001247
1248 mLen = sizeof(tANI_U32);
1249 mLen += sizeof(tANI_U8);
1250 pBuf += sizeof(tANI_U16);
1251 *pBuf = psessionEntry->smeSessionId;
1252 pBuf += sizeof(tANI_U8);
1253
1254 // Fill in peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301255 vos_mem_copy( pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001256 pBuf += sizeof(tSirMacAddr);
1257 mLen += sizeof(tSirMacAddr);
1258
1259 // Fill in aid
1260 limCopyU16(pBuf, pAssocInd->aid);
1261 pBuf += sizeof(tANI_U16);
1262 mLen += sizeof(tANI_U16);
1263
1264 // Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301265 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001266 pBuf += sizeof(tSirMacAddr);
1267 mLen += sizeof(tSirMacAddr);
1268
1269 // Fill in staId
1270 limCopyU16(pBuf, psessionEntry->staId);
1271 pBuf += sizeof(tANI_U16);
1272 mLen += sizeof(tANI_U16);
1273
1274 // Fill in authType
1275 limCopyU32(pBuf, pAssocInd->authType);
1276 pBuf += sizeof(tANI_U32);
1277 mLen += sizeof(tANI_U32);
1278
1279 // Fill in ssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301280 vos_mem_copy( pBuf, (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001281 pBuf += (1 + pAssocInd->ssId.length);
1282 mLen += (1 + pAssocInd->ssId.length);
1283
1284 // Fill in rsnIE
1285 limCopyU16(pBuf, pAssocInd->rsnIE.length);
1286 pBuf += sizeof(tANI_U16);
1287 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301288 vos_mem_copy( pBuf, (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001289 pAssocInd->rsnIE.length);
1290 pBuf += pAssocInd->rsnIE.length;
1291 mLen += pAssocInd->rsnIE.length;
1292
Jeff Johnson295189b2012-06-20 16:38:30 -07001293
Jeff Johnson295189b2012-06-20 16:38:30 -07001294 limCopyU32(pBuf, pAssocInd->spectrumMgtIndicator);
1295 pBuf += sizeof(tAniBool);
1296 mLen += sizeof(tAniBool);
1297
1298 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1299 {
1300 *pBuf = pAssocInd->powerCap.minTxPower;
1301 pBuf++;
1302 *pBuf = pAssocInd->powerCap.maxTxPower;
1303 pBuf++;
1304 mLen += sizeof(tSirMacPowerCapInfo);
1305
1306 *pBuf = pAssocInd->supportedChannels.numChnl;
1307 pBuf++;
1308 mLen++;
1309
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301310 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -07001311 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
1312 pAssocInd->supportedChannels.numChnl);
1313
1314
1315 pBuf += pAssocInd->supportedChannels.numChnl;
1316 mLen += pAssocInd->supportedChannels.numChnl;
1317 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001318 limCopyU32(pBuf, pAssocInd->WmmStaInfoPresent);
1319 pBuf += sizeof(tANI_U32);
1320 mLen += sizeof(tANI_U32);
Jeff Johnson295189b2012-06-20 16:38:30 -07001321 // Fill in length of SME_ASSOC_IND message
1322 limCopyU16(pLen, mLen);
1323
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001324 PELOG1(limLog(pMac, LOG1, FL("Sending SME_ASSOC_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001325 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1326} /*** end limAssocIndSerDes() ***/
1327
1328
1329
1330/**
1331 * limAssocCnfSerDes()
1332 *
1333 *FUNCTION:
1334 * This function is called by limProcessLmmMessages() when
1335 * SME_ASSOC_CNF or SME_REASSOC_CNF message is received from
1336 * upper layer software.
1337 *
1338 *PARAMS:
1339 *
1340 *LOGIC:
1341 *
1342 *ASSUMPTIONS:
1343 * NA
1344 *
1345 *NOTE:
1346 * NA
1347 *
1348 * @param pAssocCnf Pointer to tSirSmeAssocCnf being extracted into
1349 * @param pBuf Pointer to serialized buffer
1350 * @return retCode Indicates whether message is successfully
1351 * de-serialized (eSIR_SUCCESS) or
1352 * not (eSIR_FAILURE)
1353 */
1354
1355tSirRetStatus
1356limAssocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeAssocCnf pAssocCnf, tANI_U8 *pBuf)
1357{
1358#ifdef PE_DEBUG_LOG1
1359 tANI_U8 *pTemp = pBuf;
1360#endif
1361
1362 if (!pAssocCnf || !pBuf)
1363 return eSIR_FAILURE;
1364
1365 pAssocCnf->messageType = limGetU16(pBuf);
1366 pBuf += sizeof(tANI_U16);
1367
1368 pAssocCnf->length = limGetU16(pBuf);
1369 pBuf += sizeof(tANI_U16);
1370
1371 if (pAssocCnf->messageType == eWNI_SME_ASSOC_CNF)
1372 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001373 PELOG1(limLog(pMac, LOG1, FL("SME_ASSOC_CNF length %d bytes is:"), pAssocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001374 }
1375 else
1376 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001377 PELOG1(limLog(pMac, LOG1, FL("SME_REASSOC_CNF length %d bytes is:"), pAssocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001378 }
1379 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pAssocCnf->length);)
1380
1381 // status code
1382 pAssocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
1383 pBuf += sizeof(tSirResultCodes);
1384
1385 // bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301386 vos_mem_copy( pAssocCnf->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001387 pBuf += sizeof(tSirMacAddr);
1388
1389 // peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301390 vos_mem_copy( pAssocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001391 pBuf += sizeof(tSirMacAddr);
1392
1393
1394 pAssocCnf->aid = limGetU16(pBuf);
1395 pBuf += sizeof(tANI_U16);
1396 // alternateBssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301397 vos_mem_copy( pAssocCnf->alternateBssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001398 pBuf += sizeof(tSirMacAddr);
1399
1400 // alternateChannelId
1401 pAssocCnf->alternateChannelId = *pBuf;
1402 pBuf++;
1403
1404 return eSIR_SUCCESS;
1405} /*** end limAssocCnfSerDes() ***/
1406
1407
1408
1409/**
1410 * limDisassocCnfSerDes()
1411 *
1412 *FUNCTION:
1413 * This function is called by limProcessSmeMessages() when
1414 * SME_DISASSOC_CNF message is received from upper layer software.
1415 *
1416 *PARAMS:
1417 *
1418 *LOGIC:
1419 *
1420 *ASSUMPTIONS:
1421 * NA
1422 *
1423 *NOTE:
1424 * NA
1425 *
1426 * @param pDisassocCnf Pointer to tSirSmeDisassocCnf being
1427 * extracted into
1428 * @param pBuf Pointer to serialized buffer
1429 * @return retCode Indicates whether message is successfully
1430 * de-serialized (eSIR_SUCCESS) or
1431 * not (eSIR_FAILURE)
1432 */
1433
1434tSirRetStatus
1435limDisassocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeDisassocCnf pDisassocCnf, tANI_U8 *pBuf)
1436{
1437#ifdef PE_DEBUG_LOG1
1438 tANI_U8 *pTemp = pBuf;
1439#endif
1440
1441 if (!pDisassocCnf || !pBuf)
1442 return eSIR_FAILURE;
1443
1444 pDisassocCnf->messageType = limGetU16(pBuf);
1445 pBuf += sizeof(tANI_U16);
1446
1447 pDisassocCnf->length = limGetU16(pBuf);
1448 pBuf += sizeof(tANI_U16);
1449
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001450 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_CNF length %d bytes is:"), pDisassocCnf->length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001451 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pDisassocCnf->length);)
1452
1453 pDisassocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf);
1454 pBuf += sizeof(tSirResultCodes);
1455
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301456 vos_mem_copy( pDisassocCnf->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001457 pBuf += sizeof(tSirMacAddr);
Jeff Johnson62c27982013-02-27 17:53:55 -08001458
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301459 vos_mem_copy( pDisassocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001460
Jeff Johnson62c27982013-02-27 17:53:55 -08001461
Jeff Johnson295189b2012-06-20 16:38:30 -07001462 return eSIR_SUCCESS;
1463} /*** end limDisassocCnfSerDes() ***/
1464
1465
1466
Jeff Johnson295189b2012-06-20 16:38:30 -07001467
1468
1469/**---------------------------------------------------------------
1470\fn limReassocIndSerDes
1471\brief This function is called by limProcessMlmReassocInd() to
1472\ populate the SME_REASSOC_IND message based on the received
1473\ MLM_REASSOC_IND.
1474\
1475\param pMac
1476\param pReassocInd - Pointer to the received tLimMlmReassocInd
1477\param pBuf - Pointer to serialized buffer
1478\param psessionEntry - pointer to PE session entry
1479\
1480\return None
1481------------------------------------------------------------------*/
1482void
1483limReassocIndSerDes(tpAniSirGlobal pMac, tpLimMlmReassocInd pReassocInd, tANI_U8 *pBuf, tpPESession psessionEntry)
1484{
1485 tANI_U8 *pLen = pBuf;
1486 tANI_U16 mLen = 0;
1487
1488#ifdef PE_DEBUG_LOG1
1489 tANI_U8 *pTemp = pBuf;
1490#endif
1491
Jeff Johnson295189b2012-06-20 16:38:30 -07001492
1493 mLen = sizeof(tANI_U32);
1494 pBuf += sizeof(tANI_U16);
1495 *pBuf++ = psessionEntry->smeSessionId;
1496 mLen += sizeof(tANI_U8);
1497
1498 // Fill in peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301499 vos_mem_copy( pBuf, pReassocInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001500 pBuf += sizeof(tSirMacAddr);
1501 mLen += sizeof(tSirMacAddr);
1502
1503 // Fill in oldMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301504 vos_mem_copy( pBuf, pReassocInd->currentApAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001505 pBuf += sizeof(tSirMacAddr);
1506 mLen += sizeof(tSirMacAddr);
1507
1508 // Fill in aid
1509 limCopyU16(pBuf, pReassocInd->aid);
1510 pBuf += sizeof(tANI_U16);
1511 mLen += sizeof(tANI_U16);
1512
1513 // Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301514 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001515 pBuf += sizeof(tSirMacAddr);
1516 mLen += sizeof(tSirMacAddr);
1517
1518 // Fill in staId
1519 limCopyU16(pBuf, psessionEntry->staId);
1520 pBuf += sizeof(tANI_U16);
1521 mLen += sizeof(tANI_U16);
1522
1523 // Fill in authType
1524 limCopyU32(pBuf, pReassocInd->authType);
1525 pBuf += sizeof(tAniAuthType);
1526 mLen += sizeof(tAniAuthType);
1527
1528 // Fill in ssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301529 vos_mem_copy( pBuf, (tANI_U8 *) &(pReassocInd->ssId),
Jeff Johnson295189b2012-06-20 16:38:30 -07001530 pReassocInd->ssId.length + 1);
1531 pBuf += 1 + pReassocInd->ssId.length;
1532 mLen += pReassocInd->ssId.length + 1;
1533
1534 // Fill in rsnIE
1535 limCopyU16(pBuf, pReassocInd->rsnIE.length);
1536 pBuf += sizeof(tANI_U16);
1537 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301538 vos_mem_copy( pBuf, (tANI_U8 *) &(pReassocInd->rsnIE.rsnIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001539 pReassocInd->rsnIE.length);
1540 pBuf += pReassocInd->rsnIE.length;
1541 mLen += pReassocInd->rsnIE.length;
1542
1543 // Fill in addIE
1544 limCopyU16(pBuf, pReassocInd->addIE.length);
1545 pBuf += sizeof(tANI_U16);
1546 mLen += sizeof(tANI_U16);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301547 vos_mem_copy( pBuf, (tANI_U8*) &(pReassocInd->addIE.addIEdata),
Jeff Johnson295189b2012-06-20 16:38:30 -07001548 pReassocInd->addIE.length);
1549 pBuf += pReassocInd->addIE.length;
1550 mLen += pReassocInd->addIE.length;
1551
Jeff Johnson295189b2012-06-20 16:38:30 -07001552
Jeff Johnson295189b2012-06-20 16:38:30 -07001553 limCopyU32(pBuf, pReassocInd->spectrumMgtIndicator);
1554 pBuf += sizeof(tAniBool);
1555 mLen += sizeof(tAniBool);
1556
1557 if (pReassocInd->spectrumMgtIndicator == eSIR_TRUE)
1558 {
1559 *pBuf = pReassocInd->powerCap.minTxPower;
1560 pBuf++;
1561 *pBuf = pReassocInd->powerCap.maxTxPower;
1562 pBuf++;
1563 mLen += sizeof(tSirMacPowerCapInfo);
1564
1565 *pBuf = pReassocInd->supportedChannels.numChnl;
1566 pBuf++;
1567 mLen++;
1568
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301569 vos_mem_copy( pBuf,
Jeff Johnson295189b2012-06-20 16:38:30 -07001570 (tANI_U8 *) &(pReassocInd->supportedChannels.channelList),
1571 pReassocInd->supportedChannels.numChnl);
1572
1573 pBuf += pReassocInd->supportedChannels.numChnl;
1574 mLen += pReassocInd->supportedChannels.numChnl;
1575 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001576 limCopyU32(pBuf, pReassocInd->WmmStaInfoPresent);
1577 pBuf += sizeof(tANI_U32);
1578 mLen += sizeof(tANI_U32);
Jeff Johnson295189b2012-06-20 16:38:30 -07001579
1580 // Fill in length of SME_REASSOC_IND message
1581 limCopyU16(pLen, mLen);
1582
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001583 PELOG1(limLog(pMac, LOG1, FL("Sending SME_REASSOC_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001584 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1585} /*** end limReassocIndSerDes() ***/
1586
1587
1588/**
1589 * limAuthIndSerDes()
1590 *
1591 *FUNCTION:
1592 * This function is called by limProcessMlmAuthInd() while sending
1593 * SME_AUTH_IND to host
1594 *
1595 *PARAMS:
1596 *
1597 *LOGIC:
1598 *
1599 *ASSUMPTIONS:
1600 * NA
1601 *
1602 *NOTE:
1603 * NA
1604 *
1605 * @param pAuthInd Pointer to tSirSmeAuthInd being sent
1606 * @param pBuf Pointer to serialized buffer
1607 *
1608 * @return None
1609 */
1610
1611void
1612limAuthIndSerDes(tpAniSirGlobal pMac, tpLimMlmAuthInd pAuthInd, tANI_U8 *pBuf)
1613{
1614 tANI_U8 *pLen = pBuf;
1615 tANI_U16 mLen = 0;
1616
1617#ifdef PE_DEBUG_LOG1
1618 tANI_U8 *pTemp = pBuf;
1619#endif
1620
1621 mLen = sizeof(tANI_U32);
1622 pBuf += sizeof(tANI_U16);
1623 *pBuf++ = pAuthInd->sessionId;
1624 mLen += sizeof(tANI_U8);
1625
1626 // BTAMP TODO: Fill in bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301627 vos_mem_set(pBuf, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001628 pBuf += sizeof(tSirMacAddr);
1629 mLen += sizeof(tSirMacAddr);
1630
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301631 vos_mem_copy( pBuf, pAuthInd->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001632 pBuf += sizeof(tSirMacAddr);
1633 mLen += sizeof(tSirMacAddr);
1634
1635 limCopyU32(pBuf, pAuthInd->authType);
1636 pBuf += sizeof(tAniAuthType);
1637 mLen += sizeof(tAniAuthType);
1638
1639 limCopyU16(pLen, mLen);
1640
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001641 PELOG1(limLog(pMac, LOG1, FL("Sending SME_AUTH_IND length %d bytes:"), mLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001642 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);)
1643} /*** end limAuthIndSerDes() ***/
1644
1645
1646
1647/**
1648 * limSetContextReqSerDes()
1649 *
1650 *FUNCTION:
1651 * This function is called by limProcessSmeMessages() upon receiving
1652 * SME_SETCONTEXT_REQ from host
1653 *
1654 *PARAMS:
1655 *
1656 *LOGIC:
1657 *
1658 *ASSUMPTIONS:
1659 * NA
1660 *
1661 *NOTE:
1662 * NA
1663 *
1664 * @param pSetContextReq Pointer to tSirSmeSetContextReq being
1665 * extracted
1666 * @param pBuf Pointer to serialized buffer
1667 *
1668 * @return retCode Indicates whether message is successfully
1669 * de-serialized (eSIR_SUCCESS) or
1670 * not (eSIR_FAILURE)
1671 */
1672
1673tSirRetStatus
1674limSetContextReqSerDes(tpAniSirGlobal pMac, tpSirSmeSetContextReq pSetContextReq, tANI_U8 *pBuf)
1675{
1676 tANI_S16 len = 0;
1677 tANI_U16 totalKeySize = sizeof(tANI_U8); // initialized to sizeof numKeys
1678 tANI_U8 numKeys;
1679 tANI_U8 *pKeys;
1680
1681#ifdef PE_DEBUG_LOG1
1682 tANI_U8 *pTemp = pBuf;
1683#endif
1684 if (!pSetContextReq || !pBuf)
1685 return eSIR_FAILURE;
1686
1687 pSetContextReq->messageType = limGetU16(pBuf);
1688 pBuf += sizeof(tANI_U16);
1689
1690 len = pSetContextReq->length = limGetU16(pBuf);
1691 pBuf += sizeof(tANI_U16);
1692
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001693 PELOG1(limLog(pMac, LOG1, FL("SME_SETCONTEXT_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001694 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);)
1695
1696 if (len < (tANI_S16) sizeof(tANI_U32))
1697 return eSIR_FAILURE;
1698
1699 len -= sizeof(tANI_U32); // skip message header
1700 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1701 return eSIR_FAILURE;
1702
1703 // Extract sessionId
1704 pSetContextReq->sessionId = *pBuf++;
1705 len--;
1706 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1707 return eSIR_FAILURE;
1708
1709 // Extract transactionId
1710 pSetContextReq->transactionId = sirReadU16N(pBuf);
1711 pBuf += sizeof(tANI_U16);
1712 len -= sizeof(tANI_U16);
1713 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1714 return eSIR_FAILURE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301715 vos_mem_copy( (tANI_U8 *) pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001716 pBuf, sizeof(tSirMacAddr));
1717 pBuf += sizeof(tSirMacAddr);
1718 len -= sizeof(tSirMacAddr);
1719 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1720 return eSIR_FAILURE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301721 vos_mem_copy( pSetContextReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001722 pBuf += sizeof(tSirMacAddr);
1723 len -= sizeof(tSirMacAddr);
1724 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1725 return eSIR_FAILURE;
1726
Jeff Johnson295189b2012-06-20 16:38:30 -07001727
1728// pSetContextReq->qosInfoPresent = limGetU32(pBuf);
1729// pBuf += sizeof(tAniBool);
1730
1731// if (pSetContextReq->qosInfoPresent)
1732// {
1733// len = limGetQosInfo(&pSetContextReq->qos, pBuf);
1734// pBuf += len;
1735// }
1736
1737 pSetContextReq->keyMaterial.length = limGetU16(pBuf);
1738 pBuf += sizeof(tANI_U16);
1739 len -= sizeof(tANI_U16);
1740 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1741 return eSIR_FAILURE;
1742
1743 pSetContextReq->keyMaterial.edType = (tAniEdType) limGetU32(pBuf);
1744 pBuf += sizeof(tAniEdType);
1745 len -= sizeof(tAniEdType);
1746 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1747 return eSIR_FAILURE;
1748
1749 numKeys = pSetContextReq->keyMaterial.numKeys = *pBuf++;
1750 len -= sizeof(numKeys);
1751
1752 if (numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
1753 return eSIR_FAILURE;
1754
1755 /** Initialize the Default Keys if no Keys are being sent from the upper layer*/
1756 if( limCheckRemainingLength(pMac, len) == eSIR_FAILURE) {
1757 tpSirKeys pKeyinfo = pSetContextReq->keyMaterial.key;
1758
1759 pKeyinfo->keyId = 0;
1760 pKeyinfo->keyDirection = eSIR_TX_RX;
1761 pKeyinfo->keyLength = 0;
1762
1763 if (!limIsAddrBC(pSetContextReq->peerMacAddr))
1764 pKeyinfo->unicast = 1;
1765 else
1766 pKeyinfo->unicast = 0;
1767 }else {
1768 pKeys = (tANI_U8 *) pSetContextReq->keyMaterial.key;
1769 do {
1770 tANI_U32 keySize = limGetKeysInfo(pMac, (tpSirKeys) pKeys,
1771 pBuf);
1772 pBuf += keySize;
1773 pKeys += sizeof(tSirKeys);
1774 totalKeySize += (tANI_U16) keySize;
1775 if (numKeys == 0)
1776 break;
1777 numKeys--;
1778 }while (numKeys);
1779 }
1780 return eSIR_SUCCESS;
1781} /*** end limSetContextReqSerDes() ***/
1782
1783/**
1784 * limRemoveKeyReqSerDes()
1785 *
1786 *FUNCTION:
1787 * This function is called by limProcessSmeMessages() upon receiving
1788 * SME_REMOVEKEY_REQ from host
1789 *
1790 *PARAMS:
1791 *
1792 *LOGIC:
1793 *
1794 *ASSUMPTIONS:
1795 * NA
1796 *
1797 *NOTE:
1798 * NA
1799 *
1800 * @param pRemoveKeyReq Pointer to tSirSmeRemoveKeyReq being
1801 * extracted
1802 * @param pBuf Pointer to serialized buffer
1803 *
1804 * @return retCode Indicates whether message is successfully
1805 * de-serialized (eSIR_SUCCESS) or
1806 * not (eSIR_FAILURE)
1807 */
1808
1809tSirRetStatus
1810limRemoveKeyReqSerDes(tpAniSirGlobal pMac, tpSirSmeRemoveKeyReq pRemoveKeyReq, tANI_U8 *pBuf)
1811{
1812 tANI_S16 len = 0;
1813
1814#ifdef PE_DEBUG_LOG1
1815 tANI_U8 *pTemp = pBuf;
1816#endif
1817 if (!pRemoveKeyReq || !pBuf)
1818 return eSIR_FAILURE;
1819
1820 pRemoveKeyReq->messageType = limGetU16(pBuf);
1821 pBuf += sizeof(tANI_U16);
1822
1823 len = pRemoveKeyReq->length = limGetU16(pBuf);
1824 pBuf += sizeof(tANI_U16);
1825
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001826 PELOG1(limLog(pMac, LOG1, FL("SME_REMOVEKEY_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001827 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
1828
1829 if (len < (tANI_S16) sizeof(tANI_U32))
1830 return eSIR_FAILURE;
1831
1832 len -= sizeof(tANI_U32); // skip message header
1833 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1834 return eSIR_FAILURE;
1835
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301836 vos_mem_copy( (tANI_U8 *) pRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001837 pBuf, sizeof(tSirMacAddr));
1838 pBuf += sizeof(tSirMacAddr);
1839 len -= sizeof(tSirMacAddr);
1840 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1841 return eSIR_FAILURE;
1842
Jeff Johnson295189b2012-06-20 16:38:30 -07001843
1844 pRemoveKeyReq->edType = *pBuf;
1845 pBuf += sizeof(tANI_U8);
1846 len -= sizeof(tANI_U8);
1847 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1848 return eSIR_FAILURE;
1849
1850 pRemoveKeyReq->wepType = *pBuf;
1851
1852 pBuf += sizeof(tANI_U8);
1853 len -= sizeof(tANI_U8);
1854 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1855 return eSIR_FAILURE;
1856
1857 pRemoveKeyReq->keyId = *pBuf;
1858
1859 pBuf += sizeof(tANI_U8);
1860 len -= sizeof(tANI_U8);
1861 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1862 return eSIR_FAILURE;
1863
1864 pRemoveKeyReq->unicast = *pBuf;
1865 len--;
1866 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1867 return eSIR_FAILURE;
1868
1869 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301870 vos_mem_copy( pRemoveKeyReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001871 pBuf += sizeof(tSirMacAddr);
1872 len -= sizeof(tSirMacAddr);
1873 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1874 return eSIR_FAILURE;
1875
1876 // Extract sessionId
1877 pRemoveKeyReq->sessionId = *pBuf++;
1878 len--;
1879 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1880 return eSIR_FAILURE;
1881
1882 // Extract transactionId
1883 pRemoveKeyReq->transactionId = sirReadU16N(pBuf);
1884 pBuf += sizeof(tANI_U16);
1885 len -= sizeof(tANI_U16);
1886 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1887 return eSIR_FAILURE;
1888
1889 return eSIR_SUCCESS;
1890} /*** end limRemoveKeyReqSerDes() ***/
1891
1892
1893
1894/**
1895 * limDisassocReqSerDes()
1896 *
1897 *FUNCTION:
1898 * This function is called by limProcessSmeMessages() upon receiving
1899 * SME_DISASSOC_REQ from host
1900 *
1901 *PARAMS:
1902 *
1903 *LOGIC:
1904 *
1905 *ASSUMPTIONS:
1906 * NA
1907 *
1908 *NOTE:
1909 * NA
1910 *
1911 * @param pDisassocReq Pointer to tSirSmeDisassocReq being extracted
1912 * @param pBuf Pointer to serialized buffer
1913 *
1914 * @return retCode Indicates whether message is successfully
1915 * de-serialized (eSIR_SUCCESS) or
1916 * not (eSIR_FAILURE)
1917 */
1918
1919tSirRetStatus
1920limDisassocReqSerDes(tpAniSirGlobal pMac, tSirSmeDisassocReq *pDisassocReq, tANI_U8 *pBuf)
1921{
1922 tANI_S16 len = 0;
1923#ifdef PE_DEBUG_LOG1
1924 tANI_U8 *pTemp = pBuf;
1925#endif
1926
1927 if (!pDisassocReq || !pBuf)
1928 return eSIR_FAILURE;
1929
1930 pDisassocReq->messageType = limGetU16(pBuf);
1931 pBuf += sizeof(tANI_U16);
1932
1933 len = pDisassocReq->length = limGetU16(pBuf);
1934 pBuf += sizeof(tANI_U16);
1935
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001936 PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001937 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
1938
1939 if (len < (tANI_S16) sizeof(tANI_U32))
1940 return eSIR_FAILURE;
1941
1942 len -= sizeof(tANI_U32); // skip message header
1943 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1944 return eSIR_FAILURE;
1945
1946 // Extract sessionID
1947 pDisassocReq->sessionId = *pBuf;
1948 pBuf += sizeof(tANI_U8);
1949 len -= sizeof(tANI_U8);
1950 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1951 return eSIR_FAILURE;
1952
1953 // Extract transactionid
1954 pDisassocReq->transactionId = limGetU16(pBuf);
1955 pBuf += sizeof(tANI_U16);
1956 len -= sizeof(tANI_U16);
1957 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1958 return eSIR_FAILURE;
1959
1960 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301961 vos_mem_copy( (tANI_U8 *) pDisassocReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001962 pBuf += sizeof(tSirMacAddr);
1963 len -= sizeof(tSirMacAddr);
1964 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1965 return eSIR_FAILURE;
1966
1967 // Extract peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301968 vos_mem_copy( pDisassocReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001969 pBuf += sizeof(tSirMacAddr);
1970 len -= sizeof(tSirMacAddr);
1971 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1972 return eSIR_FAILURE;
1973
1974 // Extract reasonCode
1975 pDisassocReq->reasonCode = limGetU16(pBuf);
1976 pBuf += sizeof(tANI_U16);
1977 len -= sizeof(tANI_U16);
1978 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
1979 return eSIR_FAILURE;
1980
1981 pDisassocReq->doNotSendOverTheAir = *pBuf;
1982 pBuf += sizeof(tANI_U8);
1983 len -= sizeof(tANI_U8);
1984
Jeff Johnson295189b2012-06-20 16:38:30 -07001985
1986 return eSIR_SUCCESS;
1987} /*** end limDisassocReqSerDes() ***/
1988
1989
1990
1991/**
1992 * limDeauthReqSerDes()
1993 *
1994 *FUNCTION:
1995 * This function is called by limProcessSmeMessages() upon receiving
1996 * SME_DEAUTH_REQ from host
1997 *
1998 *PARAMS:
1999 *
2000 *LOGIC:
2001 *
2002 *ASSUMPTIONS:
2003 * NA
2004 *
2005 *NOTE:
2006 * NA
2007 *
2008 * @param pDeauthReq Pointer to tSirSmeDeauthReq being extracted
2009 * @param pBuf Pointer to serialized buffer
2010 *
2011 * @return retCode Indicates whether message is successfully
2012 * de-serialized (eSIR_SUCCESS) or
2013 * not (eSIR_FAILURE)
2014 */
2015tSirRetStatus
2016limDeauthReqSerDes(tpAniSirGlobal pMac, tSirSmeDeauthReq *pDeauthReq, tANI_U8 *pBuf)
2017{
2018 tANI_S16 len = 0;
2019
2020#ifdef PE_DEBUG_LOG1
2021 tANI_U8 *pTemp = pBuf;
2022#endif
2023
2024 if (!pDeauthReq || !pBuf)
2025 return eSIR_FAILURE;
2026
2027 pDeauthReq->messageType = limGetU16(pBuf);
2028 pBuf += sizeof(tANI_U16);
2029
2030 len = pDeauthReq->length = limGetU16(pBuf);
2031 pBuf += sizeof(tANI_U16);
2032
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002033 PELOG1(limLog(pMac, LOG1, FL("SME_DEAUTH_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002034 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2035
2036 if (len < (tANI_S16) sizeof(tANI_U32))
2037 return eSIR_FAILURE;
2038
2039 len -= sizeof(tANI_U32); // skip message header
2040 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2041 return eSIR_FAILURE;
2042
2043 // Extract sessionId
2044 pDeauthReq->sessionId = *pBuf++;
2045 len--;
2046 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2047 return eSIR_FAILURE;
2048
2049 // Extract transactionId
2050 pDeauthReq->transactionId = limGetU16(pBuf);
2051 pBuf += sizeof(tANI_U16);
2052 len -= sizeof(tANI_U16);
2053 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2054 return eSIR_FAILURE;
2055
2056 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302057 vos_mem_copy( pDeauthReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002058 pBuf += sizeof(tSirMacAddr);
2059 len -= sizeof(tSirMacAddr);
2060 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2061 return eSIR_FAILURE;
2062
2063 // Extract peerMacAddr
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302064 vos_mem_copy( pDeauthReq->peerMacAddr, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002065 pBuf += sizeof(tSirMacAddr);
2066 len -= sizeof(tSirMacAddr);
2067 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2068 return eSIR_FAILURE;
2069
2070 // Extract reasonCode
2071 pDeauthReq->reasonCode = limGetU16(pBuf);
2072 pBuf += sizeof(tANI_U16);
2073 len -= sizeof(tANI_U16);
2074
Jeff Johnson295189b2012-06-20 16:38:30 -07002075
2076 return eSIR_SUCCESS;
2077} /*** end limDisassocReqSerDes() ***/
2078
2079
2080
2081
Jeff Johnson295189b2012-06-20 16:38:30 -07002082
2083
2084/**
2085 * limStatSerDes()
2086 *
2087 *FUNCTION:
2088 * This function is called by limSendSmeDisassocNtf() while sending
2089 * SME_DISASSOC_IND/eWNI_SME_DISASSOC_RSP to host
2090 *
2091 *PARAMS:
2092 *
2093 *LOGIC:
2094 *
2095 *ASSUMPTIONS:
2096 * NA
2097 *
2098 *NOTE:
2099 * NA
2100 *
2101 * @param pAssocInd Pointer to tpAniStaStatStruct being sent
2102 * @param pBuf Pointer to serialized buffer
2103 *
2104 * @return None
2105 */
2106
2107void
2108limStatSerDes(tpAniSirGlobal pMac, tpAniStaStatStruct pStat, tANI_U8 *pBuf)
2109{
2110#ifdef PE_DEBUG_LOG1
2111 tANI_U8 *pTemp = pBuf;
2112#endif
2113
2114 limCopyU32(pBuf, pStat->sentAesBlksUcastHi);
2115 pBuf += sizeof(tANI_U32);
2116
2117 limCopyU32(pBuf, pStat->sentAesBlksUcastLo);
2118 pBuf += sizeof(tANI_U32);
2119
2120 limCopyU32(pBuf, pStat->recvAesBlksUcastHi);
2121 pBuf += sizeof(tANI_U32);
2122
2123 limCopyU32(pBuf, pStat->recvAesBlksUcastLo);
2124 pBuf += sizeof(tANI_U32);
2125
2126 limCopyU32(pBuf, pStat->aesFormatErrorUcastCnts);
2127 pBuf += sizeof(tANI_U32);
2128
2129 limCopyU32(pBuf, pStat->aesReplaysUcast);
2130 pBuf += sizeof(tANI_U32);
2131
2132 limCopyU32(pBuf, pStat->aesDecryptErrUcast);
2133 pBuf += sizeof(tANI_U32);
2134
2135 limCopyU32(pBuf, pStat->singleRetryPkts);
2136 pBuf += sizeof(tANI_U32);
2137
2138 limCopyU32(pBuf, pStat->failedTxPkts);
2139 pBuf += sizeof(tANI_U32);
2140
2141 limCopyU32(pBuf, pStat->ackTimeouts);
2142 pBuf += sizeof(tANI_U32);
2143
2144 limCopyU32(pBuf, pStat->multiRetryPkts);
2145 pBuf += sizeof(tANI_U32);
2146
2147 limCopyU32(pBuf, pStat->fragTxCntsHi);
2148 pBuf += sizeof(tANI_U32);
2149
2150 limCopyU32(pBuf, pStat->fragTxCntsLo);
2151 pBuf += sizeof(tANI_U32);
2152
2153 limCopyU32(pBuf, pStat->transmittedPktsHi);
2154 pBuf += sizeof(tANI_U32);
2155
2156 limCopyU32(pBuf, pStat->transmittedPktsLo);
2157 pBuf += sizeof(tANI_U32);
2158
2159 limCopyU32(pBuf, pStat->phyStatHi);
2160 pBuf += sizeof(tANI_U32);
2161
2162 limCopyU32(pBuf, pStat->phyStatLo);
2163 pBuf += sizeof(tANI_U32);
2164
2165 limCopyU32(pBuf, pStat->uplinkRssi);
2166 pBuf += sizeof(tANI_U32);
2167
2168 limCopyU32(pBuf, pStat->uplinkSinr);
2169 pBuf += sizeof(tANI_U32);
2170
2171 limCopyU32(pBuf, pStat->uplinkRate);
2172 pBuf += sizeof(tANI_U32);
2173
2174 limCopyU32(pBuf, pStat->downlinkRssi);
2175 pBuf += sizeof(tANI_U32);
2176
2177 limCopyU32(pBuf, pStat->downlinkSinr);
2178 pBuf += sizeof(tANI_U32);
2179
2180 limCopyU32(pBuf, pStat->downlinkRate);
2181 pBuf += sizeof(tANI_U32);
2182
2183 limCopyU32(pBuf, pStat->nRcvBytes);
2184 pBuf += sizeof(tANI_U32);
2185
2186 limCopyU32(pBuf, pStat->nXmitBytes);
2187 pBuf += sizeof(tANI_U32);
2188
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002189 PELOG1(limLog(pMac, LOG1, FL("STAT: length %d bytes is:"), sizeof(tAniStaStatStruct));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002190 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, sizeof(tAniStaStatStruct));)
2191
2192} /*** end limStatSerDes() ***/
2193
2194
Jeff Johnson295189b2012-06-20 16:38:30 -07002195
2196
2197/**
2198 * limPackBkgndScanFailNotify()
2199 *
2200 *FUNCTION:
2201 * This function is called by limSendSmeWmStatusChangeNtf()
2202 * to pack the tSirBackgroundScanInfo message
2203 *
2204 */
2205void
2206limPackBkgndScanFailNotify(tpAniSirGlobal pMac,
2207 tSirSmeStatusChangeCode statusChangeCode,
2208 tpSirBackgroundScanInfo pScanInfo,
2209 tSirSmeWmStatusChangeNtf *pSmeNtf,
2210 tANI_U8 sessionId)
2211{
2212
2213 tANI_U16 length = (sizeof(tANI_U16) * 2) + sizeof(tANI_U8) +
2214 sizeof(tSirSmeStatusChangeCode) +
2215 sizeof(tSirBackgroundScanInfo);
2216
Jeff Johnson295189b2012-06-20 16:38:30 -07002217 pSmeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
2218 pSmeNtf->statusChangeCode = statusChangeCode;
2219 pSmeNtf->length = length;
2220 pSmeNtf->sessionId = sessionId;
2221 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanSuccess = pScanInfo->numOfScanSuccess;
2222 pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanFailure = pScanInfo->numOfScanFailure;
2223 pSmeNtf->statusChangeInfo.bkgndScanInfo.reserved = pScanInfo->reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07002224}
2225
Jeff Johnson295189b2012-06-20 16:38:30 -07002226
Jeff Johnson295189b2012-06-20 16:38:30 -07002227/**
2228 * limIsSmeGetAssocSTAsReqValid()
2229 *
2230 *FUNCTION:
2231 * This function is called by limProcessSmeReqMessages() upon
2232 * receiving SME_GET_ASSOC_STAS_REQ message from application.
2233 *
2234 *LOGIC:
2235 * Message validity checks are performed in this function
2236 *
2237 *ASSUMPTIONS:
2238 *
2239 *NOTE:
2240 *
2241 * @param pBuf - Pointer to a serialized SME_GET_ASSOC_STAS_REQ message
2242 * @param pSmeMsg - Pointer to a tSirSmeGetAssocSTAsReq structure
2243 * @return true if SME_GET_ASSOC_STAS_REQ message is formatted correctly
2244 * false otherwise
2245 */
2246tANI_BOOLEAN
2247limIsSmeGetAssocSTAsReqValid(tpAniSirGlobal pMac, tpSirSmeGetAssocSTAsReq pGetAssocSTAsReq, tANI_U8 *pBuf)
2248{
2249 tANI_S16 len = 0;
2250
2251 pGetAssocSTAsReq->messageType = limGetU16(pBuf);
2252 pBuf += sizeof(tANI_U16);
2253
2254 len = pGetAssocSTAsReq->length = limGetU16(pBuf);
2255 pBuf += sizeof(tANI_U16);
2256
2257 if (len < (tANI_S16) sizeof(tANI_U32))
2258 return eSIR_FAILURE;
2259
2260 len -= sizeof(tANI_U32); // skip message header
2261 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2262 return eSIR_FAILURE;
2263
2264 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302265 vos_mem_copy( (tANI_U8 *) pGetAssocSTAsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002266 pBuf += sizeof(tSirMacAddr);
2267 len -= sizeof(tSirMacAddr);
2268 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2269 return eSIR_FAILURE;
2270
2271 // Extract modId
2272 pGetAssocSTAsReq->modId = limGetU16(pBuf);
2273 pBuf += sizeof(tANI_U16);
2274 len -= sizeof(tANI_U16);
2275 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2276 return eSIR_FAILURE;
2277
2278 // Extract pUsrContext
2279 pGetAssocSTAsReq->pUsrContext = (void *)limGetU32(pBuf);
2280 pBuf += sizeof(tANI_U32);
2281 len -= sizeof(tANI_U32);
2282 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2283 return eSIR_FAILURE;
2284
2285 // Extract pSapEventCallback
2286 pGetAssocSTAsReq->pSapEventCallback = (void *)limGetU32(pBuf);
2287 pBuf += sizeof(tANI_U32);
2288 len -= sizeof(tANI_U32);
2289 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2290 return eSIR_FAILURE;
2291
2292 // Extract pAssocStasArray
2293 pGetAssocSTAsReq->pAssocStasArray = (void *)limGetU32(pBuf);
2294 pBuf += sizeof(tANI_U32);
2295 len -= sizeof(tANI_U32);
2296
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002297 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002298
2299 if (len < 0)
2300 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002301 PELOGE(limLog(pMac, LOGE, FL("SME_GET_ASSOC_STAS_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002302 return eANI_BOOLEAN_FALSE;
2303 }
2304
2305 return eANI_BOOLEAN_TRUE;
2306}
2307
2308/**
2309 * limTkipCntrMeasReqSerDes()
2310 *
2311 *FUNCTION:
2312 * This function is called by limProcessSmeMessages() upon receiving
2313 * eWNI_SME_TKIP_CNTR_MEAS_REQ from host HDD
2314 *
2315 *PARAMS:
2316 *
2317 *LOGIC:
2318 *
2319 *ASSUMPTIONS:
2320 * NA
2321 *
2322 *NOTE:
2323 * NA
2324 *
2325 * @param tpSirSmeTkipCntrMeasReq Pointer to tSirSmeTkipCntrMeasReq being extracted
2326 * @param pBuf Pointer to serialized buffer
2327 * @return retCode Indicates whether message is successfully
2328 * de-serialized (eSIR_SUCCESS) or
2329 * not (eSIR_FAILURE)
2330 */
2331tSirRetStatus
2332limTkipCntrMeasReqSerDes(tpAniSirGlobal pMac, tpSirSmeTkipCntrMeasReq pTkipCntrMeasReq, tANI_U8 *pBuf)
2333{
2334 tANI_S16 len = 0;
2335
2336#ifdef PE_DEBUG_LOG1
2337 tANI_U8 *pTemp = pBuf;
2338#endif
2339
2340 pTkipCntrMeasReq->messageType = limGetU16(pBuf);
2341 pBuf += sizeof(tANI_U16);
2342
2343 len = pTkipCntrMeasReq->length = limGetU16(pBuf);
2344 pBuf += sizeof(tANI_U16);
2345
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002346 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length %d bytes is:"), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002347 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);)
2348
2349 if (len < (tANI_S16) sizeof(tANI_U32))
2350 return eSIR_FAILURE;
2351
2352 len -= sizeof(tANI_U32); // skip message header
2353 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2354 return eSIR_FAILURE;
2355
2356 // Extract sessionId
2357 pTkipCntrMeasReq->sessionId = *pBuf++;
2358 len--;
2359 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2360 return eSIR_FAILURE;
2361
2362 // Extract transactionId
2363 pTkipCntrMeasReq->transactionId = limGetU16(pBuf);
2364 pBuf += sizeof(tANI_U16);
2365 len -= sizeof(tANI_U16);
2366 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2367 return eSIR_FAILURE;
2368
2369 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302370 vos_mem_copy( (tANI_U8 *) pTkipCntrMeasReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002371 pBuf += sizeof(tSirMacAddr);
2372 len -= sizeof(tSirMacAddr);
2373 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2374 return eSIR_FAILURE;
2375
2376 // Extract bEnable
2377 pTkipCntrMeasReq->bEnable = *pBuf++;
2378 len --;
2379
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002380 PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002381
2382 if (len)
2383 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002384 PELOGE(limLog(pMac, LOGE, FL("SME_TKIP_CNTR_MEAS_REQ invalid "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002385 return eSIR_FAILURE;
2386 }
2387 else
2388 return eSIR_SUCCESS;
2389}
2390
2391/**
2392 * limIsSmeGetWPSPBCSessionsReqValid()
2393 *
2394 *FUNCTION:
2395 * This function is called by limProcessSmeGetWPSPBCSessions() upon
2396 * receiving query WPS PBC overlap information message from application.
2397 *
2398 *LOGIC:
2399 * Message validity checks are performed in this function
2400 *
2401 *ASSUMPTIONS:
2402 *
2403 *NOTE:
2404 *
2405 * @param pBuf - Pointer to a serialized SME_GET_WPSPBC_SESSION_REQ message
2406 * @param pGetWPSPBCSessionsReq - Pointer to a tSirSmeGetWPSPBCSessionsReq structure
2407 * @return true if SME_GET_WPSPBC_SESSION_REQ message is formatted correctly
2408 * false otherwise
2409 */
2410
2411tSirRetStatus
2412limIsSmeGetWPSPBCSessionsReqValid(tpAniSirGlobal pMac, tSirSmeGetWPSPBCSessionsReq *pGetWPSPBCSessionsReq, tANI_U8 *pBuf)
2413{
2414 tANI_S16 len = 0;
2415
2416 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirSmeGetWPSPBCSessionsReq));)
2417
2418 pGetWPSPBCSessionsReq->messageType = limGetU16(pBuf);
2419 pBuf += sizeof(tANI_U16);
2420
2421 len = pGetWPSPBCSessionsReq->length = limGetU16(pBuf);
2422 pBuf += sizeof(tANI_U16);
2423
2424 if (len < (tANI_S16) sizeof(tANI_U32))
2425 return eSIR_FAILURE;
2426
2427 len -= sizeof(tANI_U32); // skip message header
2428 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2429 return eSIR_FAILURE;
2430
2431 // Extract pUsrContext
2432 pGetWPSPBCSessionsReq->pUsrContext = (void *)limGetU32(pBuf);
2433 pBuf += sizeof(tANI_U32);
2434 len -= sizeof(tANI_U32);
2435 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2436 return eSIR_FAILURE;
2437
2438 // Extract pSapEventCallback
2439 pGetWPSPBCSessionsReq->pSapEventCallback = (void *)limGetU32(pBuf);
2440 pBuf += sizeof(tANI_U32);
2441 len -= sizeof(tANI_U32);
2442 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2443 return eSIR_FAILURE;
2444
2445 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302446 vos_mem_copy( (tANI_U8 *) pGetWPSPBCSessionsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002447 pBuf += sizeof(tSirMacAddr);
2448 len -= sizeof(tSirMacAddr);
2449
2450 // Extract MAC address of Station to be removed
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302451 vos_mem_copy( (tANI_U8 *) pGetWPSPBCSessionsReq->pRemoveMac, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002452 pBuf += sizeof(tSirMacAddr);
2453 len -= sizeof(tSirMacAddr);
2454
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002455 PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002456
2457 if (len < 0)
2458 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002459 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002460 return eSIR_FAILURE;
2461 }
2462
2463 return eSIR_SUCCESS;
2464}
2465
Jeff Johnson295189b2012-06-20 16:38:30 -07002466
2467/**---------------------------------------------------------------
2468\fn limGetSessionInfo
2469\brief This function returns the sessionId and transactionId
2470\ of a message. This assumes that the message structure
2471\ is of format:
2472\ tANI_U16 messageType
2473\ tANI_U16 messageLength
2474\ tANI_U8 sessionId
2475\ tANI_U16 transactionId
2476\param pMac - pMac global structure
2477\param *pBuf - pointer to the message buffer
2478\param sessionId - returned session id value
2479\param transactionId - returned transaction ID value
2480\return None
2481------------------------------------------------------------------*/
2482void
2483limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U8 *sessionId, tANI_U16 *transactionId)
2484{
2485 if (!pBuf)
2486 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002487 limLog(pMac, LOGE, FL("NULL ptr received. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002488 return;
2489 }
2490
2491 pBuf += sizeof(tANI_U16); // skip message type
2492 pBuf += sizeof(tANI_U16); // skip message length
2493
2494 *sessionId = *pBuf; // get sessionId
2495 pBuf++;
2496 *transactionId = limGetU16(pBuf); // get transactionId
2497
2498 return;
2499}
2500
Jeff Johnson295189b2012-06-20 16:38:30 -07002501
2502/**
2503 * limUpdateAPWPSIEsReqSerDes()
2504 *
2505 *FUNCTION:
2506 * This function is to deserialize UpdateAPWPSIEs message
2507 *
2508 *PARAMS:
2509 *
2510 *LOGIC:
2511 *
2512 *ASSUMPTIONS:
2513 * NA
2514 *
2515 *NOTE:
2516 * NA
2517 *
2518 * @param pUpdateAPWPSIEsReq Pointer to tSirUpdateAPWPSIEsReq being
2519 * extracted
2520 * @param pBuf Pointer to serialized buffer
2521 *
2522 * @return retCode Indicates whether message is successfully
2523 * de-serialized (eSIR_SUCCESS) or
2524 * not (eSIR_FAILURE)
2525 */
2526
2527tSirRetStatus
2528limUpdateAPWPSIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq, tANI_U8 *pBuf)
2529{
2530 tANI_S16 len = 0;
2531
2532 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPSIEsReq));)
2533
2534 if (!pUpdateAPWPSIEsReq || !pBuf)
2535 return eSIR_FAILURE;
2536
2537 pUpdateAPWPSIEsReq->messageType = limGetU16(pBuf);
2538 pBuf += sizeof(tANI_U16);
2539
2540 len = pUpdateAPWPSIEsReq->length = limGetU16(pBuf);
2541 pBuf += sizeof(tANI_U16);
2542
2543 if (len < (tANI_S16) sizeof(tANI_U32))
2544 return eSIR_FAILURE;
2545
2546 len -= sizeof(tANI_U32); // skip message header
2547 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2548 return eSIR_FAILURE;
2549
2550 // Extract transactionId
2551 pUpdateAPWPSIEsReq->transactionId = limGetU16( pBuf );
2552 pBuf += sizeof( tANI_U16 );
2553 len -= sizeof( tANI_U16 );
2554 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2555 return eSIR_FAILURE;
2556
2557 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302558 vos_mem_copy( (tANI_U8 *) pUpdateAPWPSIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002559 pBuf += sizeof(tSirMacAddr);
2560 len -= sizeof(tSirMacAddr);
2561 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2562 return eSIR_FAILURE;
2563
2564 // Extract sessionId
2565 pUpdateAPWPSIEsReq->sessionId = *pBuf++;
2566 len--;
2567 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2568 return eSIR_FAILURE;
2569
2570 // Extract APWPSIEs
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302571 vos_mem_copy( (tSirAPWPSIEs *) &pUpdateAPWPSIEsReq->APWPSIEs, pBuf, sizeof(tSirAPWPSIEs));
Jeff Johnson295189b2012-06-20 16:38:30 -07002572 pBuf += sizeof(tSirAPWPSIEs);
2573 len -= sizeof(tSirAPWPSIEs);
2574
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002575 PELOG1(limLog(pMac, LOG1, FL("SME_UPDATE_APWPSIE_REQ length consumed %d bytes "), len);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002576
2577 if (len < 0)
2578 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002579 PELOGE(limLog(pMac, LOGE, FL("SME_UPDATE_APWPSIE_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002580 return eSIR_FAILURE;
2581 }
2582
2583 return eSIR_SUCCESS;
2584} /*** end limSetContextReqSerDes() ***/
2585
2586/**
2587 * limUpdateAPWPARSNIEsReqSerDes ()
2588 *
2589 *FUNCTION:
2590 * This function is to deserialize UpdateAPWPSIEs message
2591 *
2592 *PARAMS:
2593 *
2594 *LOGIC:
2595 *
2596 *ASSUMPTIONS:
2597 * NA
2598 *
2599 *NOTE:
2600 * NA
2601 *
2602 * @param pUpdateAPWPARSNIEsReq Pointer to tpSirUpdateAPWPARSNIEsReq being
2603 * extracted
2604 * @param pBuf Pointer to serialized buffer
2605 *
2606 * @return retCode Indicates whether message is successfully
2607 * de-serialized (eSIR_SUCCESS) or
2608 * not (eSIR_FAILURE)
2609 */
2610
2611tSirRetStatus
2612limUpdateAPWPARSNIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq, tANI_U8 *pBuf)
2613{
2614 tANI_S16 len = 0;
2615
2616 PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPARSNIEsReq));)
2617
2618 if (!pUpdateAPWPARSNIEsReq || !pBuf)
2619 return eSIR_FAILURE;
2620
2621 pUpdateAPWPARSNIEsReq->messageType = limGetU16(pBuf);
2622 pBuf += sizeof(tANI_U16);
2623
2624 len = pUpdateAPWPARSNIEsReq->length = limGetU16(pBuf);
2625 pBuf += sizeof(tANI_U16);
2626
2627 if (len < (tANI_S16) sizeof(tANI_U32))
2628 return eSIR_FAILURE;
2629
2630 len -= sizeof(tANI_U32); // skip message header
2631 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2632 return eSIR_FAILURE;
2633
2634 // Extract transactionId
2635 pUpdateAPWPARSNIEsReq->transactionId = limGetU16( pBuf );
2636 pBuf += sizeof(tANI_U16);
2637 len -= sizeof( tANI_U16 );
2638 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2639 return eSIR_FAILURE;
2640
2641 // Extract bssId
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302642 vos_mem_copy( (tANI_U8 *) pUpdateAPWPARSNIEsReq->bssId, pBuf, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002643 pBuf += sizeof(tSirMacAddr);
2644 len -= sizeof(tSirMacAddr);
2645 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2646 return eSIR_FAILURE;
2647
2648 // Extract sessionId
2649 pUpdateAPWPARSNIEsReq->sessionId = *pBuf++;
2650 len--;
2651 if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
2652 return eSIR_FAILURE;
2653
2654 // Extract APWPARSNIEs
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302655 vos_mem_copy( (tSirRSNie *) &pUpdateAPWPARSNIEsReq->APWPARSNIEs, pBuf, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07002656 pBuf += sizeof(tSirRSNie);
2657 len -= sizeof(tSirRSNie);
2658
2659 if (len < 0)
2660 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002661 PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002662 return eSIR_FAILURE;
2663 }
2664
2665 return eSIR_SUCCESS;
2666} /*** end limUpdateAPWPARSNIEsReqSerDes() ***/
2667