Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 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 | |
| 22 | /* |
| 23 | * Airgo Networks, Inc proprietary. All rights reserved. |
| 24 | * |
| 25 | * This file limSerDesUtils.cc contains the serializer/deserializer |
| 26 | * utility functions LIM uses while communicating with upper layer |
| 27 | * software entities |
| 28 | * Author: Chandra Modumudi |
| 29 | * Date: 10/20/02 |
| 30 | * History:- |
| 31 | * Date Modified by Modification Information |
| 32 | * -------------------------------------------------------------------- |
| 33 | */ |
| 34 | |
| 35 | #include "aniSystemDefs.h" |
| 36 | #include "utilsApi.h" |
| 37 | #include "limTypes.h" |
| 38 | #include "limUtils.h" |
| 39 | #include "limSerDesUtils.h" |
| 40 | |
| 41 | |
| 42 | |
| 43 | /** |
| 44 | * limCheckRemainingLength() |
| 45 | * |
| 46 | *FUNCTION: |
| 47 | * This function is called while de-serializing received SME_REQ |
| 48 | * message. |
| 49 | * |
| 50 | *LOGIC: |
| 51 | * Remaining message length is checked for > 0. |
| 52 | * |
| 53 | *ASSUMPTIONS: |
| 54 | * NA |
| 55 | * |
| 56 | *NOTE: |
| 57 | * NA |
| 58 | * |
| 59 | * @param len - Remaining message length |
| 60 | * @return retCode - eSIR_SUCCESS if len > 0, else eSIR_FAILURE |
| 61 | */ |
| 62 | |
| 63 | static inline tSirRetStatus |
| 64 | limCheckRemainingLength(tpAniSirGlobal pMac, tANI_S16 len) |
| 65 | { |
| 66 | if (len > 0) |
| 67 | return eSIR_SUCCESS; |
| 68 | else |
| 69 | { |
| 70 | limLog(pMac, LOGW, |
| 71 | FL("Received SME message with invalid rem length=%d\n"), |
| 72 | len); |
| 73 | return eSIR_FAILURE; |
| 74 | } |
| 75 | } /*** end limCheckRemainingLength(pMac, ) ***/ |
| 76 | |
| 77 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP) |
| 78 | #else |
| 79 | /** |
| 80 | * limGetBssDescription() |
| 81 | * |
| 82 | *FUNCTION: |
| 83 | * This function is called by various LIM functions to copy |
| 84 | * BSS description from a tANI_U8* buffer pointer to tSirBssDescription |
| 85 | * |
| 86 | *LOGIC: |
| 87 | * |
| 88 | *ASSUMPTIONS: |
| 89 | * NA |
| 90 | * |
| 91 | *NOTE: |
| 92 | * NA |
| 93 | * |
| 94 | * @param pBssDescription Pointer to the BssDescription to be copied |
| 95 | * @param *pBuf Pointer to the source buffer |
| 96 | * @param rLen Remaining message length being extracted |
| 97 | * @return retCode Indicates whether message is successfully |
| 98 | * de-serialized (eSIR_SUCCESS) or |
| 99 | * failure (eSIR_FAILURE). |
| 100 | */ |
| 101 | |
| 102 | static tSirRetStatus |
| 103 | limGetBssDescription( tpAniSirGlobal pMac, tSirBssDescription *pBssDescription, |
| 104 | tANI_S16 rLen, tANI_S16 *lenUsed, tANI_U8 *pBuf) |
| 105 | { |
Madan Mohan Koyyalamudi | c62057b | 2012-10-30 18:31:54 -0700 | [diff] [blame] | 106 | tANI_S16 len = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 107 | |
| 108 | pBssDescription->length = limGetU16(pBuf); |
| 109 | pBuf += sizeof(tANI_U16); |
| 110 | len = pBssDescription->length; |
| 111 | |
| 112 | if (rLen < (tANI_S16) (len + sizeof(tANI_U16))) |
| 113 | return eSIR_FAILURE; |
| 114 | |
| 115 | *lenUsed = len + sizeof(tANI_U16); |
| 116 | |
| 117 | // Extract bssId |
| 118 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssDescription->bssId, |
| 119 | pBuf, sizeof(tSirMacAddr)); |
| 120 | pBuf += sizeof(tSirMacAddr); |
| 121 | len -= sizeof(tSirMacAddr); |
| 122 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 123 | return eSIR_FAILURE; |
| 124 | |
| 125 | // Extract timer |
| 126 | palCopyMemory( pMac->hHdd, (tANI_U8 *) (&pBssDescription->scanSysTimeMsec), |
| 127 | pBuf, sizeof(v_TIME_t)); |
| 128 | pBuf += sizeof(v_TIME_t); |
| 129 | len -= sizeof(v_TIME_t); |
| 130 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 131 | return eSIR_FAILURE; |
| 132 | |
| 133 | // Extract timeStamp |
| 134 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssDescription->timeStamp, |
| 135 | pBuf, sizeof(tSirMacTimeStamp)); |
| 136 | pBuf += sizeof(tSirMacTimeStamp); |
| 137 | len -= sizeof(tSirMacTimeStamp); |
| 138 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 139 | return eSIR_FAILURE; |
| 140 | |
| 141 | // Extract beaconInterval |
| 142 | pBssDescription->beaconInterval = limGetU16(pBuf); |
| 143 | pBuf += sizeof(tANI_U16); |
| 144 | len -= sizeof(tANI_U16); |
| 145 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 146 | return eSIR_FAILURE; |
| 147 | |
| 148 | // Extract capabilityInfo |
| 149 | pBssDescription->capabilityInfo = limGetU16(pBuf); |
| 150 | pBuf += sizeof(tANI_U16); |
| 151 | len -= sizeof(tANI_U16); |
| 152 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 153 | return eSIR_FAILURE; |
| 154 | |
| 155 | // Extract nwType |
| 156 | pBssDescription->nwType = (tSirNwType) limGetU32(pBuf); |
| 157 | pBuf += sizeof(tSirNwType); |
| 158 | len -= sizeof(tSirNwType); |
| 159 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 160 | return eSIR_FAILURE; |
| 161 | |
| 162 | // Extract aniIndicator |
| 163 | pBssDescription->aniIndicator = *pBuf++; |
| 164 | len --; |
| 165 | |
| 166 | // Extract rssi |
| 167 | pBssDescription->rssi = (tANI_S8) *pBuf++; |
| 168 | len --; |
| 169 | |
| 170 | // Extract sinr |
| 171 | pBssDescription->sinr = (tANI_S8) *pBuf++; |
| 172 | len --; |
| 173 | |
| 174 | // Extract channelId |
| 175 | pBssDescription->channelId = *pBuf++; |
| 176 | len --; |
| 177 | |
| 178 | // Extract channelIdSelf |
| 179 | pBssDescription->channelIdSelf = *pBuf++; |
| 180 | len --; |
| 181 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 182 | return eSIR_FAILURE; |
| 183 | |
| 184 | // Extract reserved bssDescription |
| 185 | pBuf += sizeof(pBssDescription->sSirBssDescriptionRsvd); |
| 186 | len -= sizeof(pBssDescription->sSirBssDescriptionRsvd); |
| 187 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 188 | return eSIR_FAILURE; |
| 189 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 190 | //pass the timestamp |
| 191 | pBssDescription->nReceivedTime = limGetU32( pBuf ); |
| 192 | pBuf += sizeof(tANI_TIMESTAMP); |
| 193 | len -= sizeof(tANI_TIMESTAMP); |
| 194 | |
| 195 | #if defined WLAN_FEATURE_VOWIFI |
| 196 | //TSF when the beacon received (parent TSF) |
| 197 | pBssDescription->parentTSF = limGetU32( pBuf ); |
| 198 | pBuf += sizeof(tANI_U32); |
| 199 | len -= sizeof(tANI_U32); |
| 200 | |
| 201 | //start TSF of scan during which this BSS desc was updated. |
| 202 | pBssDescription->startTSF[0] = limGetU32( pBuf ); |
| 203 | pBuf += sizeof(tANI_U32); |
| 204 | len -= sizeof(tANI_U32); |
| 205 | |
| 206 | //start TSF of scan during which this BSS desc was updated. |
| 207 | pBssDescription->startTSF[1] = limGetU32( pBuf ); |
| 208 | pBuf += sizeof(tANI_U32); |
| 209 | len -= sizeof(tANI_U32); |
| 210 | #endif |
| 211 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 212 | // MobilityDomain |
| 213 | pBssDescription->mdiePresent = *pBuf++; |
| 214 | len --; |
| 215 | pBssDescription->mdie[0] = *pBuf++; |
| 216 | len --; |
| 217 | pBssDescription->mdie[1] = *pBuf++; |
| 218 | len --; |
| 219 | pBssDescription->mdie[2] = *pBuf++; |
| 220 | len --; |
| 221 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 222 | PELOGE(limLog(pMac, LOG1, FL("mdie=%02x %02x %02x\n"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 223 | pBssDescription->mdie[0], |
| 224 | pBssDescription->mdie[1], |
| 225 | pBssDescription->mdie[2]);) |
| 226 | #endif |
| 227 | #endif |
| 228 | |
| 229 | #ifdef FEATURE_WLAN_CCX |
| 230 | pBssDescription->QBSSLoad_present = limGetU16(pBuf); |
| 231 | pBuf += sizeof(tANI_U16); |
| 232 | len -= sizeof(tANI_U16); |
| 233 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 234 | return eSIR_FAILURE; |
| 235 | |
| 236 | // Extract QBSSLoad_avail |
| 237 | pBssDescription->QBSSLoad_avail = limGetU16(pBuf); |
| 238 | pBuf += sizeof(tANI_U16); |
| 239 | len -= sizeof(tANI_U16); |
| 240 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 241 | return eSIR_FAILURE; |
| 242 | #endif |
Madan Mohan Koyyalamudi | 7df624d | 2012-10-31 16:32:50 -0700 | [diff] [blame] | 243 | pBssDescription->fProbeRsp = *pBuf++; |
| 244 | len -= sizeof(tANI_U8); |
| 245 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 246 | return eSIR_FAILURE; |
| 247 | |
Madan Mohan Koyyalamudi | 2a6ba24 | 2012-10-31 17:06:19 -0700 | [diff] [blame^] | 248 | /* 3 reserved bytes for padding */ |
| 249 | pBuf += (3 * sizeof(tANI_U8)); |
| 250 | len -= 3; |
| 251 | |
Madan Mohan Koyyalamudi | 7df624d | 2012-10-31 16:32:50 -0700 | [diff] [blame] | 252 | pBssDescription->WscIeLen = limGetU32( pBuf ); |
| 253 | pBuf += sizeof(tANI_U32); |
| 254 | len -= sizeof(tANI_U32); |
| 255 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 256 | return eSIR_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 257 | |
Madan Mohan Koyyalamudi | 2a6ba24 | 2012-10-31 17:06:19 -0700 | [diff] [blame^] | 258 | if (WSCIE_PROBE_RSP_LEN < len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 259 | { |
Madan Mohan Koyyalamudi | 2a6ba24 | 2012-10-31 17:06:19 -0700 | [diff] [blame^] | 260 | /* Do not copy with WscIeLen |
| 261 | * if WscIeLen is not set properly, memory overwrite happen |
| 262 | * Ended up with memory corruption and crash |
| 263 | * Copy with Fixed size */ |
| 264 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssDescription->WscIeProbeRsp, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 265 | pBuf, |
Madan Mohan Koyyalamudi | 2a6ba24 | 2012-10-31 17:06:19 -0700 | [diff] [blame^] | 266 | WSCIE_PROBE_RSP_LEN); |
| 267 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 268 | } |
Madan Mohan Koyyalamudi | 2a6ba24 | 2012-10-31 17:06:19 -0700 | [diff] [blame^] | 269 | else |
| 270 | { |
| 271 | limLog(pMac, LOGE, |
| 272 | FL("remaining bytes len %d is less than WSCIE_PROBE_RSP_LEN\n"), |
| 273 | pBssDescription->WscIeLen); |
| 274 | return eSIR_FAILURE; |
| 275 | } |
| 276 | |
| 277 | /* 1 reserved byte padding */ |
| 278 | pBuf += (WSCIE_PROBE_RSP_LEN + 1); |
| 279 | len -= (WSCIE_PROBE_RSP_LEN + 1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 280 | |
Madan Mohan Koyyalamudi | c62057b | 2012-10-30 18:31:54 -0700 | [diff] [blame] | 281 | if (len > 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 282 | { |
| 283 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssDescription->ieFields, |
| 284 | pBuf, |
| 285 | len); |
| 286 | } |
Madan Mohan Koyyalamudi | c62057b | 2012-10-30 18:31:54 -0700 | [diff] [blame] | 287 | else if (len < 0) |
| 288 | { |
| 289 | limLog(pMac, LOGE, |
| 290 | FL("remaining length is negative. len = %d, actual length = %d\n"), |
| 291 | len, pBssDescription->length); |
| 292 | return eSIR_FAILURE; |
| 293 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 294 | |
| 295 | return eSIR_SUCCESS; |
| 296 | } /*** end limGetBssDescription() ***/ |
| 297 | #endif |
| 298 | |
| 299 | |
| 300 | |
| 301 | /** |
| 302 | * limCopyBssDescription() |
| 303 | * |
| 304 | *FUNCTION: |
| 305 | * This function is called by various LIM functions to copy |
| 306 | * BSS description to a tANI_U8 buffer |
| 307 | * |
| 308 | *LOGIC: |
| 309 | * |
| 310 | *ASSUMPTIONS: |
| 311 | * NA |
| 312 | * |
| 313 | *NOTE: |
| 314 | * NA |
| 315 | * |
| 316 | * @param *pBuf Pointer to the destination buffer |
| 317 | * @param pBssDescription Pointer to the BssDescription being copied |
| 318 | * @return Length of BSSdescription written |
| 319 | */ |
| 320 | |
| 321 | tANI_U16 |
| 322 | limCopyBssDescription(tpAniSirGlobal pMac, tANI_U8 *pBuf, tSirBssDescription *pBssDescription) |
| 323 | { |
| 324 | tANI_U16 len = 0; |
| 325 | |
| 326 | limCopyU16(pBuf, pBssDescription->length); |
| 327 | pBuf += sizeof(tANI_U16); |
| 328 | len += sizeof(tANI_U16); |
| 329 | |
| 330 | palCopyMemory( pMac->hHdd, pBuf, |
| 331 | (tANI_U8 *) pBssDescription->bssId, |
| 332 | sizeof(tSirMacAddr)); |
| 333 | pBuf += sizeof(tSirMacAddr); |
| 334 | len += sizeof(tSirMacAddr); |
| 335 | |
| 336 | PELOG3(limLog(pMac, LOG3, |
| 337 | FL("Copying BSSdescr:channel is %d, aniInd is %d, bssId is "), |
| 338 | pBssDescription->channelId, pBssDescription->aniIndicator); |
| 339 | limPrintMacAddr(pMac, pBssDescription->bssId, LOG3);) |
| 340 | |
| 341 | palCopyMemory( pMac->hHdd, pBuf, |
| 342 | (tANI_U8 *) (&pBssDescription->scanSysTimeMsec), |
| 343 | sizeof(v_TIME_t)); |
| 344 | pBuf += sizeof(v_TIME_t); |
| 345 | len += sizeof(v_TIME_t); |
| 346 | |
| 347 | limCopyU32(pBuf, pBssDescription->timeStamp[0]); |
| 348 | pBuf += sizeof(tANI_U32); |
| 349 | len += sizeof(tANI_U32); |
| 350 | |
| 351 | limCopyU32(pBuf, pBssDescription->timeStamp[1]); |
| 352 | pBuf += sizeof(tANI_U32); |
| 353 | len += sizeof(tANI_U32); |
| 354 | |
| 355 | limCopyU16(pBuf, pBssDescription->beaconInterval); |
| 356 | pBuf += sizeof(tANI_U16); |
| 357 | len += sizeof(tANI_U16); |
| 358 | |
| 359 | limCopyU16(pBuf, pBssDescription->capabilityInfo); |
| 360 | pBuf += sizeof(tANI_U16); |
| 361 | len += sizeof(tANI_U16); |
| 362 | |
| 363 | limCopyU32(pBuf, pBssDescription->nwType); |
| 364 | pBuf += sizeof(tANI_U32); |
| 365 | len += sizeof(tANI_U32); |
| 366 | |
| 367 | *pBuf++ = pBssDescription->aniIndicator; |
| 368 | len++; |
| 369 | |
| 370 | *pBuf++ = pBssDescription->rssi; |
| 371 | len++; |
| 372 | |
| 373 | *pBuf++ = pBssDescription->sinr; |
| 374 | len++; |
| 375 | |
| 376 | *pBuf++ = pBssDescription->channelId; |
| 377 | len++; |
| 378 | |
| 379 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pBssDescription->ieFields), |
| 380 | limGetIElenFromBssDescription(pBssDescription)); |
| 381 | |
| 382 | return (len + sizeof(tANI_U16)); |
| 383 | } /*** end limCopyBssDescription() ***/ |
| 384 | |
| 385 | |
| 386 | |
| 387 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) |
| 388 | /** |
| 389 | * limCopyLoad() |
| 390 | * |
| 391 | *fUNCTION: |
| 392 | * This function is called by various LIM functions to copy |
| 393 | * load information into a tANI_U8* buffer pointer |
| 394 | * |
| 395 | *LOGIC: |
| 396 | * |
| 397 | *ASSUMPTIONS: |
| 398 | * NA |
| 399 | * |
| 400 | *NOTE: |
| 401 | * NA |
| 402 | * |
| 403 | * @param *pBuf Pointer to the destination buffer |
| 404 | * @param load load to be copied to destination buffer |
| 405 | * |
| 406 | * @return None |
| 407 | */ |
| 408 | |
| 409 | static void |
| 410 | limCopyLoad(tANI_U8 *pBuf, tSirLoad load) |
| 411 | { |
| 412 | limCopyU16(pBuf, load.numStas); |
| 413 | pBuf += sizeof(tANI_U16); |
| 414 | |
| 415 | limCopyU16(pBuf, load.channelUtilization); |
| 416 | pBuf += sizeof(tANI_U16); |
| 417 | } /*** end limCopyLoad() ***/ |
| 418 | |
| 419 | |
| 420 | |
| 421 | /** |
| 422 | * limGetLoad() |
| 423 | * |
| 424 | *FUNCTION: |
| 425 | * This function is called by various LIM functions to copy |
| 426 | * load information into a tANI_U8* buffer pointer |
| 427 | * |
| 428 | *LOGIC: |
| 429 | * |
| 430 | *ASSUMPTIONS: |
| 431 | * NA |
| 432 | * |
| 433 | *NOTE: |
| 434 | * NA |
| 435 | * |
| 436 | * @param *pLoad Pointer to load being copied to |
| 437 | * @param *pBuf Pointer to the source buffer |
| 438 | * |
| 439 | * @return None |
| 440 | */ |
| 441 | |
| 442 | static void |
| 443 | limGetLoad(tSirLoad *pLoad, tANI_U8 *pBuf) |
| 444 | { |
| 445 | pLoad->numStas = limGetU16(pBuf); |
| 446 | pBuf += sizeof(tANI_U16); |
| 447 | |
| 448 | pLoad->channelUtilization = limGetU16(pBuf); |
| 449 | pBuf += sizeof(tANI_U16); |
| 450 | } /*** end limGetLoad() ***/ |
| 451 | |
| 452 | |
| 453 | |
| 454 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP) |
| 455 | /** |
| 456 | * limCopyWdsInfo() |
| 457 | * |
| 458 | *FUNCTION: |
| 459 | * This function is called by various LIM functions to copy |
| 460 | * WdsInfo information into a tANI_U8* buffer pointer |
| 461 | * |
| 462 | *LOGIC: |
| 463 | * |
| 464 | *ASSUMPTIONS: |
| 465 | * NA |
| 466 | * |
| 467 | *NOTE: |
| 468 | * NA |
| 469 | * |
| 470 | * @param *pBuf Pointer to the destination buffer |
| 471 | * @param wdsInfo WdsInfo to be copied to destination buffer |
| 472 | * |
| 473 | * @return Length of WDS info copied |
| 474 | */ |
| 475 | |
| 476 | static tANI_U16 |
| 477 | limCopyWdsInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tpSirWdsInfo pWdsInfo) |
| 478 | { |
| 479 | limCopyU16(pBuf, pWdsInfo->wdsLength); |
| 480 | pBuf += sizeof(tANI_U16); |
| 481 | |
| 482 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) pWdsInfo->wdsBytes, pWdsInfo->wdsLength); |
| 483 | pBuf += pWdsInfo->wdsLength; |
| 484 | |
| 485 | return ((tANI_U16) (sizeof(tANI_U16) + pWdsInfo->wdsLength)); |
| 486 | } /*** end limCopyWdsInfo() ***/ |
| 487 | |
| 488 | |
| 489 | |
| 490 | /** |
| 491 | * limGetWdsInfo() |
| 492 | * |
| 493 | *FUNCTION: |
| 494 | * This function is called by various LIM functions to copy |
| 495 | * WdsInfo information from a tANI_U8* buffer pointer to tSirWdsInfo |
| 496 | * |
| 497 | *LOGIC: |
| 498 | * |
| 499 | *ASSUMPTIONS: |
| 500 | * NA |
| 501 | * |
| 502 | *NOTE: |
| 503 | * NA |
| 504 | * |
| 505 | * @param wdsInfo Pointer to the WdsInfo to be copied |
| 506 | * @param *pBuf Pointer to the source buffer |
| 507 | * |
| 508 | * @return true when WDS info extracted successfully else false |
| 509 | */ |
| 510 | |
| 511 | static tANI_U8 |
| 512 | limGetWdsInfo(tpAniSirGlobal pMac, tpSirWdsInfo pWdsInfo, tANI_U8 *pBuf) |
| 513 | { |
| 514 | pWdsInfo->wdsLength = limGetU16(pBuf); |
| 515 | pBuf += sizeof(tANI_U16); |
| 516 | |
| 517 | if (pWdsInfo->wdsLength > ANI_WDS_INFO_MAX_LENGTH) |
| 518 | return false; |
| 519 | |
| 520 | palCopyMemory( pMac->hHdd, pWdsInfo->wdsBytes, pBuf, pWdsInfo->wdsLength); |
| 521 | |
| 522 | return true; |
| 523 | } /*** end limGetWdsInfo() ***/ |
| 524 | |
| 525 | |
| 526 | |
| 527 | /** |
| 528 | * limGetAlternateRadioList() |
| 529 | * |
| 530 | *FUNCTION: |
| 531 | * This function is called by various LIM functions to copy |
| 532 | * alternateRadio information from a tANI_U8* buffer pointer to |
| 533 | * tSirAlternateRadioList |
| 534 | * |
| 535 | *LOGIC: |
| 536 | * |
| 537 | *ASSUMPTIONS: |
| 538 | * NA |
| 539 | * |
| 540 | *NOTE: |
| 541 | * NA |
| 542 | * |
| 543 | * @param pRadioList Pointer to the radioList to be copied |
| 544 | * @param *pBuf Pointer to the source buffer |
| 545 | * |
| 546 | * @return len Length of copied alternateRadioList |
| 547 | */ |
| 548 | |
| 549 | static tANI_U16 |
| 550 | limGetAlternateRadioList(tpAniSirGlobal pMac, tpSirMultipleAlternateRadioInfo pRadioList, |
| 551 | tANI_U8 *pBuf) |
| 552 | { |
| 553 | tANI_U8 i; |
| 554 | tANI_U16 len = sizeof(tANI_U8); |
| 555 | tpSirAlternateRadioInfo pRadioInfo; |
| 556 | |
| 557 | pRadioList->numBss = *pBuf++; |
| 558 | |
| 559 | if (pRadioList->numBss > SIR_MAX_NUM_ALTERNATE_RADIOS) |
| 560 | pRadioList->numBss = SIR_MAX_NUM_ALTERNATE_RADIOS; |
| 561 | |
| 562 | pRadioInfo = pRadioList->alternateRadio; |
| 563 | for (i = 0; i < pRadioList->numBss; i++) |
| 564 | { |
| 565 | palCopyMemory( pMac->hHdd, pRadioInfo->bssId, pBuf, sizeof(tSirMacAddr)); |
| 566 | pBuf += sizeof(tSirMacAddr); |
| 567 | pRadioInfo->channelId = *pBuf++; |
| 568 | PELOG3(limLog(pMac, LOG3, FL("Alternate radio[%d] channelId=%d, BssId is \n"), |
| 569 | i, pRadioInfo->channelId); |
| 570 | limPrintMacAddr(pMac, pRadioInfo->bssId, LOG3);) |
| 571 | |
| 572 | pRadioInfo++; |
| 573 | len += sizeof(tSirMacAddr) + sizeof(tANI_U8); |
| 574 | } |
| 575 | |
| 576 | return len; |
| 577 | } /*** end limGetAlternateRadioList() ***/ |
| 578 | #endif |
| 579 | |
| 580 | |
| 581 | |
| 582 | /** |
| 583 | * limCopyNeighborBssInfo() |
| 584 | * |
| 585 | *FUNCTION: |
| 586 | * This function is called by various LIM functions to copy |
| 587 | * Neighbor BSS info into a tANI_U8* buffer pointer |
| 588 | * |
| 589 | *LOGIC: |
| 590 | * |
| 591 | *ASSUMPTIONS: |
| 592 | * NA |
| 593 | * |
| 594 | *NOTE: |
| 595 | * NA |
| 596 | * |
| 597 | * @param *pBuf Pointer to the destination buffer |
| 598 | * @param pBssInfo Pointer to neighbor BSS info be copied |
| 599 | * to destination buffer |
| 600 | * |
| 601 | * @return bssInfoLen Length of bssInfo copied |
| 602 | */ |
| 603 | |
| 604 | tANI_U32 |
| 605 | limCopyNeighborBssInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tpSirNeighborBssInfo pBssInfo) |
| 606 | { |
| 607 | tANI_U32 bssInfoLen = 0; |
| 608 | |
| 609 | palCopyMemory( pMac->hHdd, pBuf, |
| 610 | (tANI_U8 *) pBssInfo->bssId, |
| 611 | sizeof(tSirMacAddr)); |
| 612 | pBuf += sizeof(tSirMacAddr); |
| 613 | bssInfoLen += sizeof(tSirMacAddr); |
| 614 | PELOG3(limLog(pMac, LOG3, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 615 | FL("Copying new NeighborWds node:channel is %d, wniIndicator is %d, bssType is %d, bssId is "), |
| 616 | pBssInfo->channelId, pBssInfo->wniIndicator, pBssInfo->bssType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 617 | limPrintMacAddr(pMac, pBssInfo->bssId, LOG3);) |
| 618 | |
| 619 | *pBuf++ = pBssInfo->channelId; |
| 620 | bssInfoLen++; |
| 621 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 622 | limCopyU32(pBuf, pBssInfo->wniIndicator); |
| 623 | pBuf += sizeof(tANI_U32); |
| 624 | bssInfoLen += sizeof(tANI_U32); |
| 625 | |
| 626 | limCopyU32(pBuf, pBssInfo->bssType); |
| 627 | pBuf += sizeof(tANI_U32); |
| 628 | bssInfoLen += sizeof(tANI_U32); |
| 629 | |
| 630 | *pBuf++ = pBssInfo->sinr; |
| 631 | bssInfoLen++; |
| 632 | *pBuf++ = pBssInfo->rssi; |
| 633 | bssInfoLen++; |
| 634 | |
| 635 | limCopyLoad(pBuf, pBssInfo->load); |
| 636 | pBuf += sizeof(tSirLoad); |
| 637 | bssInfoLen += sizeof(tSirLoad); |
| 638 | |
| 639 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pBssInfo->ssId), |
| 640 | pBssInfo->ssId.length + 1); |
| 641 | |
| 642 | bssInfoLen += pBssInfo->ssId.length + 1; |
| 643 | pBuf += pBssInfo->ssId.length + 1; |
| 644 | |
| 645 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pBssInfo->apName), |
| 646 | pBssInfo->apName.length + 1); |
| 647 | |
| 648 | bssInfoLen += pBssInfo->apName.length + 1; |
| 649 | pBuf += pBssInfo->apName.length + 1; |
| 650 | |
| 651 | limCopyU16(pBuf, pBssInfo->rsnIE.length); |
| 652 | pBuf += sizeof(tANI_U16); |
| 653 | bssInfoLen += sizeof(tANI_U16); |
| 654 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pBssInfo->rsnIE.rsnIEdata), |
| 655 | pBssInfo->rsnIE.length); |
| 656 | |
| 657 | bssInfoLen += pBssInfo->rsnIE.length; |
| 658 | pBuf += pBssInfo->rsnIE.length; |
| 659 | |
| 660 | limCopyU32(pBuf, pBssInfo->nwType); |
| 661 | pBuf += sizeof(tANI_U32); |
| 662 | bssInfoLen += sizeof(tANI_U32); |
| 663 | |
| 664 | // not sure we need to do a sirSwapU16ifNeeded ??? |
| 665 | limCopyU16(pBuf, pBssInfo->capabilityInfo); |
| 666 | pBuf += sizeof(tANI_U16); |
| 667 | bssInfoLen += sizeof(tANI_U16); |
| 668 | |
| 669 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pBssInfo->operationalRateSet), |
| 670 | pBssInfo->operationalRateSet.numRates + 1); |
| 671 | bssInfoLen += pBssInfo->operationalRateSet.numRates + 1; |
| 672 | pBuf += pBssInfo->operationalRateSet.numRates + 1; |
| 673 | |
| 674 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pBssInfo->extendedRateSet), |
| 675 | pBssInfo->extendedRateSet.numRates + 1); |
| 676 | bssInfoLen += pBssInfo->extendedRateSet.numRates + 1; |
| 677 | pBuf += pBssInfo->extendedRateSet.numRates + 1; |
| 678 | |
| 679 | limCopyU16(pBuf, pBssInfo->beaconInterval); |
| 680 | pBuf += sizeof(tANI_U16); |
| 681 | bssInfoLen += sizeof(tANI_U16); |
| 682 | |
| 683 | *pBuf++ = pBssInfo->dtimPeriod; |
| 684 | bssInfoLen++; |
| 685 | *pBuf++ = pBssInfo->HTCapsPresent; |
| 686 | bssInfoLen++; |
| 687 | *pBuf++ = pBssInfo->HTInfoPresent; |
| 688 | bssInfoLen++; |
| 689 | *pBuf++ = pBssInfo->wmeInfoPresent; |
| 690 | bssInfoLen++; |
| 691 | *pBuf++ = pBssInfo->wmeEdcaPresent; |
| 692 | bssInfoLen++; |
| 693 | *pBuf++ = pBssInfo->wsmCapablePresent; |
| 694 | bssInfoLen++; |
| 695 | *pBuf++ = pBssInfo->hcfEnabled; |
| 696 | bssInfoLen++; |
| 697 | |
| 698 | limCopyU16(pBuf, pBssInfo->propIECapability); |
| 699 | pBuf += sizeof(tANI_U16); |
| 700 | bssInfoLen += sizeof(tANI_U16); |
| 701 | |
| 702 | limCopyU32(pBuf, pBssInfo->localPowerConstraints); |
| 703 | pBuf += sizeof(tANI_S32); |
| 704 | bssInfoLen += sizeof(tANI_S32); |
| 705 | |
| 706 | limCopyU32(pBuf, pBssInfo->aggrRssi); |
| 707 | pBuf += sizeof(tANI_S32); |
| 708 | bssInfoLen += sizeof(tANI_S32); |
| 709 | |
| 710 | limCopyU32(pBuf, pBssInfo->dataCount); |
| 711 | pBuf += sizeof(tANI_U32); |
| 712 | bssInfoLen += sizeof(tANI_U32); |
| 713 | |
| 714 | limCopyU32(pBuf, pBssInfo->totalPackets); |
| 715 | pBuf += sizeof(tANI_U32); |
| 716 | bssInfoLen += sizeof(tANI_U32); |
| 717 | |
| 718 | return bssInfoLen; |
| 719 | } /*** end limCopyNeighborBssInfo() ***/ |
| 720 | |
| 721 | |
| 722 | /** |
| 723 | * limCopyNeighborList() |
| 724 | * |
| 725 | *FUNCTION: |
| 726 | * This function is called by various LIM functions to copy |
| 727 | * Neighbor BSS list into a tANI_U8* buffer pointer |
| 728 | * |
| 729 | *LOGIC: |
| 730 | * |
| 731 | *ASSUMPTIONS: |
| 732 | * NA |
| 733 | * |
| 734 | *NOTE: |
| 735 | * NA |
| 736 | * |
| 737 | * @param *pBuf Pointer to the destination buffer |
| 738 | * @param neighborList Neighbor BSS list be copied to |
| 739 | * destination buffer |
| 740 | * @param numBss Number of Neighbor BSS list be copied |
| 741 | * |
| 742 | * @return listLen Length of Neighbor BSS list |
| 743 | */ |
| 744 | |
| 745 | static tANI_U32 |
| 746 | limCopyNeighborList(tpAniSirGlobal pMac, tANI_U8 *pBuf, tpSirNeighborBssInfo pBssInfo, tANI_U32 numBss) |
| 747 | { |
| 748 | tANI_U32 bssInfoLen = 0, listLen = 0; |
| 749 | tANI_U8 i; |
| 750 | tANI_U8 *pTemp = (tANI_U8 *) pBssInfo; |
| 751 | |
| 752 | PELOG3(limLog(pMac, LOG3, FL("Going to copy BssInfoList:\n"));) |
| 753 | PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, |
| 754 | pTemp, numBss*sizeof(tSirNeighborBssInfo));) |
| 755 | |
| 756 | for (i = 0; i < numBss; i++, bssInfoLen = 0) |
| 757 | { |
| 758 | bssInfoLen = limCopyNeighborBssInfo(pMac, |
| 759 | pBuf, |
| 760 | (tpSirNeighborBssInfo) &pBssInfo[i]); |
| 761 | |
| 762 | pBuf += bssInfoLen; |
| 763 | listLen += bssInfoLen; |
| 764 | } |
| 765 | |
| 766 | return listLen; |
| 767 | } /*** end limCopyNeighborList(pMac, ) ***/ |
| 768 | |
| 769 | |
| 770 | /** |
| 771 | * limGetNeighborBssInfo() |
| 772 | * |
| 773 | *FUNCTION: |
| 774 | * This function is called by various LIM functions to get |
| 775 | * Neighbor BSS info from a tANI_U8* buffer pointer |
| 776 | * |
| 777 | *LOGIC: |
| 778 | * |
| 779 | *ASSUMPTIONS: |
| 780 | * NA |
| 781 | * |
| 782 | *NOTE: |
| 783 | * NA |
| 784 | * |
| 785 | * @param pBssInfo Pointer to neighbor BSS info being copied |
| 786 | * @param *pBuf Pointer to the source buffer |
| 787 | * |
| 788 | * @return Size of NeighborBssInfo that is extracted |
| 789 | */ |
| 790 | |
| 791 | tANI_U32 |
| 792 | limGetNeighborBssInfo(tpAniSirGlobal pMac, tpSirNeighborBssInfo pBssInfo, tANI_U8 *pBuf) |
| 793 | { |
| 794 | tANI_U32 len = 0; |
| 795 | |
| 796 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssInfo->bssId, |
| 797 | pBuf, sizeof(tSirMacAddr)); |
| 798 | pBuf += sizeof(tSirMacAddr); |
| 799 | len += sizeof(tSirMacAddr); |
| 800 | |
| 801 | pBssInfo->channelId = *pBuf++; |
| 802 | len++; |
| 803 | |
| 804 | pBssInfo->wniIndicator = (tAniBool) limGetU32(pBuf); |
| 805 | pBuf += sizeof(tAniBool); |
| 806 | len += sizeof(tAniBool); |
| 807 | |
| 808 | pBssInfo->bssType = (tSirBssType) limGetU32(pBuf); |
| 809 | pBuf += sizeof(tSirBssType); |
| 810 | len += sizeof(tSirBssType); |
| 811 | |
| 812 | pBssInfo->sinr = *pBuf++; |
| 813 | len++; |
| 814 | pBssInfo->rssi = *pBuf++; |
| 815 | len++; |
| 816 | |
| 817 | limGetLoad(&pBssInfo->load, pBuf); |
| 818 | pBuf += sizeof(tSirLoad); |
| 819 | len += sizeof(tSirLoad); |
| 820 | |
| 821 | pBssInfo->ssId.length = *pBuf++; |
| 822 | palCopyMemory( pMac->hHdd, pBssInfo->ssId.ssId, pBuf, pBssInfo->ssId.length); |
| 823 | pBuf += pBssInfo->ssId.length; |
| 824 | len += pBssInfo->ssId.length + 1; |
| 825 | |
| 826 | pBssInfo->apName.length = *pBuf++; |
| 827 | palCopyMemory( pMac->hHdd, pBssInfo->apName.name, pBuf, pBssInfo->apName.length); |
| 828 | pBuf += pBssInfo->apName.length; |
| 829 | len += pBssInfo->apName.length + 1; |
| 830 | |
| 831 | pBssInfo->rsnIE.length = limGetU16(pBuf); |
| 832 | pBuf += sizeof(tANI_U16); |
| 833 | palCopyMemory( pMac->hHdd, pBssInfo->rsnIE.rsnIEdata, pBuf, |
| 834 | pBssInfo->rsnIE.length); |
| 835 | pBuf += pBssInfo->rsnIE.length; |
| 836 | len += pBssInfo->rsnIE.length + 2; |
| 837 | |
| 838 | PELOG2(limLog(pMac, LOG2, FL("BSS type %d channel %d wniInd %d RSN len %d\n"), |
| 839 | pBssInfo->bssType, pBssInfo->channelId, pBssInfo->wniIndicator, |
| 840 | pBssInfo->rsnIE.length); |
| 841 | limPrintMacAddr(pMac, pBssInfo->bssId, LOG2);) |
| 842 | |
| 843 | |
| 844 | pBssInfo->nwType = (tSirNwType) limGetU32(pBuf); |
| 845 | pBuf += sizeof(tSirNwType); |
| 846 | len += sizeof(tSirNwType); |
| 847 | |
| 848 | pBssInfo->capabilityInfo = limGetU16(pBuf); |
| 849 | pBuf += sizeof(tANI_U16); |
| 850 | len += sizeof(tANI_U16); |
| 851 | |
| 852 | pBssInfo->operationalRateSet.numRates = *pBuf++; |
| 853 | palCopyMemory( pMac->hHdd, pBssInfo->operationalRateSet.rate, pBuf, |
| 854 | pBssInfo->operationalRateSet.numRates); |
| 855 | pBuf += pBssInfo->operationalRateSet.numRates; |
| 856 | len += pBssInfo->operationalRateSet.numRates + 1; |
| 857 | |
| 858 | pBssInfo->extendedRateSet.numRates = *pBuf++; |
| 859 | palCopyMemory( pMac->hHdd, pBssInfo->extendedRateSet.rate, pBuf, |
| 860 | pBssInfo->extendedRateSet.numRates); |
| 861 | pBuf += pBssInfo->extendedRateSet.numRates; |
| 862 | len += pBssInfo->extendedRateSet.numRates + 1; |
| 863 | |
| 864 | pBssInfo->beaconInterval = limGetU16(pBuf); |
| 865 | pBuf += sizeof(tANI_U16); |
| 866 | len += sizeof(tANI_U16); |
| 867 | |
| 868 | pBssInfo->dtimPeriod = *pBuf++; |
| 869 | pBssInfo->HTCapsPresent = *pBuf++; |
| 870 | pBssInfo->HTInfoPresent = *pBuf++; |
| 871 | pBssInfo->wmeInfoPresent = *pBuf++; |
| 872 | pBssInfo->wmeEdcaPresent = *pBuf++; |
| 873 | pBssInfo->wsmCapablePresent = *pBuf++; |
| 874 | pBssInfo->hcfEnabled = *pBuf++; |
| 875 | pBssInfo->propIECapability = limGetU16(pBuf); |
| 876 | pBuf += sizeof(tANI_U16); |
| 877 | pBssInfo->localPowerConstraints = limGetU32(pBuf); |
| 878 | pBuf += sizeof(tANI_U32); |
| 879 | len += 13; |
| 880 | |
| 881 | PELOG2(limLog(pMac, LOG2, FL("rsnIELen %d operRateLen %d extendRateLen %d total %d\n"), |
| 882 | pBssInfo->rsnIE.length, pBssInfo->operationalRateSet.numRates, |
| 883 | pBssInfo->extendedRateSet.numRates, len);) |
| 884 | |
| 885 | |
| 886 | return len; |
| 887 | } /*** end limGetNeighborBssInfo() ***/ |
| 888 | |
| 889 | |
| 890 | |
| 891 | #if defined(ANI_PRODUCT_TYPE_AP) |
| 892 | /** |
| 893 | * limGetNeighborBssList() |
| 894 | * |
| 895 | *FUNCTION: |
| 896 | * This function is called by various LIM functions to get |
| 897 | * Neighbor BSS list from a tANI_U8* buffer pointer |
| 898 | * |
| 899 | *LOGIC: |
| 900 | * |
| 901 | *ASSUMPTIONS: |
| 902 | * NA |
| 903 | * |
| 904 | *NOTE: |
| 905 | * NA |
| 906 | * |
| 907 | * @param *pNeighborList Pointer to neighbor BSS list being copied to |
| 908 | * @param *pBuf Pointer to the source buffer |
| 909 | * @param rLen Remaining message length being extracted |
| 910 | * @return retCode Indicates whether message is successfully |
| 911 | * de-serialized (eSIR_SUCCESS) or |
| 912 | * failure (eSIR_FAILURE). |
| 913 | */ |
| 914 | |
| 915 | static tSirRetStatus |
| 916 | limGetNeighborBssList(tpAniSirGlobal pMac, |
| 917 | tSirNeighborBssList *pNeighborList, |
| 918 | tANI_S16 rLen, tANI_S16 *lenUsed, tANI_U8 *pBuf) |
| 919 | { |
| 920 | tANI_U8 *pBssInfo = (tANI_U8 *) pNeighborList->bssList; |
| 921 | tANI_U32 i, bssInfoLen = 0, len = 0, numBss, numBssList; |
| 922 | |
| 923 | numBssList = numBss = limGetU32(pBuf); |
| 924 | |
| 925 | if (!numBss) |
| 926 | { |
| 927 | PELOG1(limLog(pMac, LOG1, FL("No Neighbor BSS present in Neighbor list\n"));) |
| 928 | |
| 929 | return eSIR_FAILURE; |
| 930 | } |
| 931 | PELOG2(limLog(pMac, LOG2, |
| 932 | FL("Num of Neighbor BSS present in Neighbor list is %d\n"), |
| 933 | numBss);) |
| 934 | |
| 935 | pBuf += sizeof(tANI_U32); |
| 936 | len += sizeof(tANI_U32); |
| 937 | rLen -= sizeof(tANI_U32); |
| 938 | if (limCheckRemainingLength(pMac, rLen) == eSIR_FAILURE) |
| 939 | return eSIR_FAILURE; |
| 940 | |
| 941 | // First neighborInfo is the one we're attempting to join/reassoc |
| 942 | bssInfoLen = limGetNeighborBssInfo(pMac, (tSirNeighborBssInfo *) pBssInfo, |
| 943 | pBuf); |
| 944 | PELOG1(limLog(pMac, LOG1, |
| 945 | FL("BSSinfo len to be joined is %d rem %d, numBss = %d\n"), |
| 946 | bssInfoLen, rLen, numBss - 1);) |
| 947 | pBuf += bssInfoLen; |
| 948 | len += bssInfoLen; |
| 949 | rLen -= (tANI_S16) bssInfoLen; |
| 950 | numBss--; |
| 951 | numBssList--; |
| 952 | |
| 953 | if (numBss > 0) |
| 954 | { |
| 955 | // Store remaining neighbor BSS info |
| 956 | if (numBss > SIR_MAX_NUM_NEIGHBOR_BSS) |
| 957 | { |
| 958 | // Store only MAX number of Neighbor BSS |
| 959 | PELOG2(limLog(pMac, LOG2, |
| 960 | FL("Pruning number of neighbors to %d from %d\n"), |
| 961 | SIR_MAX_NUM_NEIGHBOR_BSS, numBss);) |
| 962 | numBss = SIR_MAX_NUM_NEIGHBOR_BSS; |
| 963 | } |
| 964 | |
| 965 | pBssInfo = (tANI_U8 *) pMac->lim.gLimNeighborBssList.bssList; |
| 966 | for (i = numBss; i > 0; i--) |
| 967 | { |
| 968 | PELOG3(limLog(pMac, LOG3, FL("pMac = %p, pBssInfo = %p, pBuf = %p\n"), pMac, pBssInfo, pBuf);) |
| 969 | bssInfoLen = limGetNeighborBssInfo(pMac, |
| 970 | (tSirNeighborBssInfo *) pBssInfo, |
| 971 | pBuf); |
| 972 | |
| 973 | pBssInfo += sizeof(tSirNeighborBssInfo); |
| 974 | pBuf += bssInfoLen; |
| 975 | len += bssInfoLen; |
| 976 | rLen -= (tANI_S16) bssInfoLen; |
| 977 | numBssList--; |
| 978 | |
| 979 | PELOG1(limLog(pMac, LOG1, FL("BSS info[%d] len %d rem %d\n"), |
| 980 | i, bssInfoLen, rLen);) |
| 981 | } |
| 982 | |
| 983 | while (numBssList > 0) |
| 984 | { |
| 985 | tSirNeighborBssInfo pTemp; |
| 986 | bssInfoLen = limGetNeighborBssInfo(pMac, &pTemp, pBuf); |
| 987 | pBuf += bssInfoLen; |
| 988 | len += bssInfoLen; |
| 989 | rLen -= (tANI_S16) bssInfoLen; |
| 990 | numBssList--; |
| 991 | PELOG1(limLog(pMac, LOG1, FL("BSS info[%d] len %d rem %d\n"), |
| 992 | numBssList, bssInfoLen, rLen);) |
| 993 | } |
| 994 | } |
| 995 | *lenUsed = len; |
| 996 | |
| 997 | pMac->lim.gLimNeighborBssList.numBss = pNeighborList->numBss |
| 998 | = numBss; |
| 999 | |
| 1000 | return eSIR_SUCCESS; |
| 1001 | } /*** end limGetNeighborBssList(pMac, ) ***/ |
| 1002 | |
| 1003 | |
| 1004 | |
| 1005 | /** |
| 1006 | * limCopyNeighborWdsInfo() |
| 1007 | * |
| 1008 | *FUNCTION: |
| 1009 | * This function is called by various LIM functions to copy |
| 1010 | * detected neighborBssWds info to a tANI_U8 buffer |
| 1011 | * |
| 1012 | *LOGIC: |
| 1013 | * |
| 1014 | *ASSUMPTIONS: |
| 1015 | * NA |
| 1016 | * |
| 1017 | *NOTE: |
| 1018 | * NA |
| 1019 | * |
| 1020 | * @param *pBuf Pointer to the destination buffer |
| 1021 | * @param *pInfo Pointer to the NeighborWdsInfo being copied |
| 1022 | * @return Length of Matrix information copied |
| 1023 | */ |
| 1024 | |
| 1025 | static tANI_U16 |
| 1026 | limCopyNeighborWdsInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tpSirNeighborBssWdsInfo pInfo) |
| 1027 | { |
| 1028 | tANI_U16 len = 0; |
| 1029 | |
| 1030 | len = (tANI_U16) limCopyNeighborBssInfo(pMac, pBuf, &pInfo->neighborBssInfo); |
| 1031 | pBuf += len; |
| 1032 | len += limCopyWdsInfo(pMac, pBuf, &pInfo->wdsInfo); |
| 1033 | |
| 1034 | return len; |
| 1035 | } /*** end limCopyNeighborWdsInfo() ***/ |
| 1036 | |
| 1037 | |
| 1038 | |
| 1039 | /** |
| 1040 | * limCopyMeasMatrixInfo() |
| 1041 | * |
| 1042 | *FUNCTION: |
| 1043 | * This function is called by various LIM functions to copy |
| 1044 | * collected Measurement matrix info to a tANI_U8 buffer |
| 1045 | * |
| 1046 | *LOGIC: |
| 1047 | * |
| 1048 | *ASSUMPTIONS: |
| 1049 | * NA |
| 1050 | * |
| 1051 | *NOTE: |
| 1052 | * NA |
| 1053 | * |
| 1054 | * @param *pBuf Pointer to the destination buffer |
| 1055 | * @param *pInfo Pointer to the matrix info being copied |
| 1056 | * @return Length of Matrix information copied |
| 1057 | */ |
| 1058 | |
| 1059 | static tANI_U16 |
| 1060 | limCopyMeasMatrixInfo(tANI_U8 *pBuf, tpLimMeasMatrixNode pInfo) |
| 1061 | { |
| 1062 | tANI_U16 len = 0; |
| 1063 | |
| 1064 | *pBuf++ = pInfo->matrix.channelNumber; |
| 1065 | len++; |
| 1066 | *pBuf++ = pInfo->matrix.compositeRssi; |
| 1067 | len++; |
| 1068 | limCopyU32(pBuf, pInfo->matrix.aggrRssi); |
| 1069 | pBuf += sizeof(tANI_S32); |
| 1070 | len += sizeof(tANI_S32); |
| 1071 | limCopyU32(pBuf, pInfo->matrix.totalPackets); |
| 1072 | len += sizeof(tANI_U32); |
| 1073 | |
| 1074 | return len; |
| 1075 | } /*** end limCopyMeasMatrixInfo() ***/ |
| 1076 | |
| 1077 | |
| 1078 | |
| 1079 | /** |
| 1080 | * limCopyMeasMatrixList() |
| 1081 | * |
| 1082 | *FUNCTION: |
| 1083 | * This function is called by various LIM functions to copy |
| 1084 | * collected Measurement matrix List to a tANI_U8 buffer |
| 1085 | * |
| 1086 | *LOGIC: |
| 1087 | * |
| 1088 | *ASSUMPTIONS: |
| 1089 | * NA |
| 1090 | * |
| 1091 | *NOTE: |
| 1092 | * NA |
| 1093 | * |
| 1094 | * @param pMac - Pointer to Global MAC structure |
| 1095 | * @param *pBuf - Pointer to the destination buffer |
| 1096 | * @return Length of matrix list copied |
| 1097 | */ |
| 1098 | |
| 1099 | static tANI_U16 |
| 1100 | limCopyMeasMatrixList(tpAniSirGlobal pMac, tANI_U8 *pBuf) |
| 1101 | { |
| 1102 | tANI_U16 len = 0, nodeLen = 0; |
| 1103 | tANI_U8 numNodes = pMac->lim.gpLimMeasData->numMatrixNodes; |
| 1104 | |
| 1105 | *pBuf++ = numNodes; |
| 1106 | len++; |
| 1107 | |
| 1108 | if (numNodes) |
| 1109 | { |
| 1110 | tpLimMeasMatrixNode pInfo = |
| 1111 | pMac->lim.gpLimMeasData->pMeasMatrixInfo; |
| 1112 | while (numNodes-- && pInfo) //Safety measure, checking both |
| 1113 | { |
| 1114 | nodeLen = limCopyMeasMatrixInfo(pBuf, pInfo); |
| 1115 | pBuf += nodeLen; |
| 1116 | len += nodeLen; |
| 1117 | |
| 1118 | if (pInfo->next) |
| 1119 | pInfo = pInfo->next; |
| 1120 | else |
| 1121 | break; |
| 1122 | } |
| 1123 | |
| 1124 | return len; |
| 1125 | } |
| 1126 | else |
| 1127 | { |
| 1128 | *pBuf = 0; |
| 1129 | return 1; |
| 1130 | } |
| 1131 | } /*** end limCopyMeasMatrixList() ***/ |
| 1132 | |
| 1133 | |
| 1134 | |
| 1135 | /** |
| 1136 | * limCopyNeighborWdsList() |
| 1137 | * |
| 1138 | *FUNCTION: |
| 1139 | * This function is called by various LIM functions to copy |
| 1140 | * detected neighborBssWds List to a tANI_U8 buffer |
| 1141 | * |
| 1142 | *LOGIC: |
| 1143 | * |
| 1144 | *ASSUMPTIONS: |
| 1145 | * NA |
| 1146 | * |
| 1147 | *NOTE: |
| 1148 | * NA |
| 1149 | * |
| 1150 | * @param pMac Pointer to Global MAC structure |
| 1151 | * @param *pBuf Pointer to the destination buffer |
| 1152 | * @return Length of matrix list copied |
| 1153 | */ |
| 1154 | |
| 1155 | static tANI_U16 |
| 1156 | limCopyNeighborWdsList(tpAniSirGlobal pMac, tANI_U8 *pBuf) |
| 1157 | { |
| 1158 | tANI_U16 len = 0, nodeLen = 0; |
| 1159 | |
| 1160 | if (pMac->lim.gpLimMeasData->numBssWds) |
| 1161 | { |
| 1162 | limCopyU32(pBuf, pMac->lim.gpLimMeasData->numBssWds); |
| 1163 | pBuf += sizeof(tANI_U32); |
| 1164 | len += sizeof(tANI_U32); |
| 1165 | |
| 1166 | tpLimNeighborBssWdsNode pInfo = |
| 1167 | pMac->lim.gpLimMeasData->pNeighborWdsInfo; |
| 1168 | while (pInfo) |
| 1169 | { |
| 1170 | nodeLen = limCopyNeighborWdsInfo(pMac, pBuf, &pInfo->info); |
| 1171 | pBuf += nodeLen; |
| 1172 | len += nodeLen; |
| 1173 | |
| 1174 | if (pInfo->next) |
| 1175 | pInfo = pInfo->next; |
| 1176 | else |
| 1177 | break; |
| 1178 | } |
| 1179 | |
| 1180 | return len; |
| 1181 | } |
| 1182 | else |
| 1183 | { |
| 1184 | limCopyU32(pBuf, 0); |
| 1185 | return (sizeof(tANI_U32)); |
| 1186 | } |
| 1187 | } /*** end limCopyNeighborWdsList() ***/ |
| 1188 | #endif |
| 1189 | #endif |
| 1190 | |
| 1191 | |
| 1192 | /** |
| 1193 | * limGetKeysInfo() |
| 1194 | * |
| 1195 | *FUNCTION: |
| 1196 | * This function is called by various LIM functions to copy |
| 1197 | * key information from a tANI_U8* buffer pointer to tSirKeys |
| 1198 | * |
| 1199 | *LOGIC: |
| 1200 | * |
| 1201 | *ASSUMPTIONS: |
| 1202 | * NA |
| 1203 | * |
| 1204 | *NOTE: |
| 1205 | * NA |
| 1206 | * |
| 1207 | * @param *pKeyInfo Pointer to the keyInfo to be copied |
| 1208 | * @param *pBuf Pointer to the source buffer |
| 1209 | * |
| 1210 | * @return Length of key info extracted |
| 1211 | */ |
| 1212 | |
| 1213 | static tANI_U32 |
| 1214 | limGetKeysInfo(tpAniSirGlobal pMac, tpSirKeys pKeyInfo, tANI_U8 *pBuf) |
| 1215 | { |
| 1216 | tANI_U32 len = 0; |
| 1217 | |
| 1218 | pKeyInfo->keyId = *pBuf++; |
| 1219 | len++; |
| 1220 | pKeyInfo->unicast = *pBuf++; |
| 1221 | len++; |
| 1222 | pKeyInfo->keyDirection = (tAniKeyDirection) limGetU32(pBuf); |
| 1223 | len += sizeof(tAniKeyDirection); |
| 1224 | pBuf += sizeof(tAniKeyDirection); |
| 1225 | |
| 1226 | palCopyMemory( pMac->hHdd, pKeyInfo->keyRsc, pBuf, WLAN_MAX_KEY_RSC_LEN); |
| 1227 | pBuf += WLAN_MAX_KEY_RSC_LEN; |
| 1228 | len += WLAN_MAX_KEY_RSC_LEN; |
| 1229 | |
| 1230 | pKeyInfo->paeRole = *pBuf++; |
| 1231 | len++; |
| 1232 | |
| 1233 | pKeyInfo->keyLength = limGetU16(pBuf); |
| 1234 | pBuf += sizeof(tANI_U16); |
| 1235 | len += sizeof(tANI_U16); |
| 1236 | palCopyMemory( pMac->hHdd, pKeyInfo->key, pBuf, pKeyInfo->keyLength); |
| 1237 | pBuf += pKeyInfo->keyLength; |
| 1238 | len += pKeyInfo->keyLength; |
| 1239 | |
| 1240 | PELOG3(limLog(pMac, LOG3, |
| 1241 | FL("Extracted keyId=%d, keyLength=%d, Key is :\n"), |
| 1242 | pKeyInfo->keyId, pKeyInfo->keyLength); |
| 1243 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, |
| 1244 | pKeyInfo->key, pKeyInfo->keyLength);) |
| 1245 | |
| 1246 | return len; |
| 1247 | } /*** end limGetKeysInfo() ***/ |
| 1248 | |
| 1249 | |
| 1250 | |
| 1251 | /** |
| 1252 | * limStartBssReqSerDes() |
| 1253 | * |
| 1254 | *FUNCTION: |
| 1255 | * This function is called by limProcessSmeMessages() upon receiving |
| 1256 | * SME_START_BSS_REQ from host |
| 1257 | * |
| 1258 | *PARAMS: |
| 1259 | * |
| 1260 | *LOGIC: |
| 1261 | * |
| 1262 | *ASSUMPTIONS: |
| 1263 | * NA |
| 1264 | * |
| 1265 | *NOTE: |
| 1266 | * NA |
| 1267 | * |
| 1268 | * @param pStartBssReq Pointer to tSirSmeStartBssReq being extracted |
| 1269 | * @param pBuf Pointer to serialized buffer |
| 1270 | * @return retCode Indicates whether message is successfully |
| 1271 | * de-serialized (eSIR_SUCCESS) or |
| 1272 | * not (eSIR_FAILURE) |
| 1273 | */ |
| 1274 | |
| 1275 | tSirRetStatus |
| 1276 | limStartBssReqSerDes(tpAniSirGlobal pMac, tpSirSmeStartBssReq pStartBssReq, tANI_U8 *pBuf) |
| 1277 | { |
| 1278 | tANI_S16 len = 0; |
| 1279 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP) |
| 1280 | tANI_U8 i; |
| 1281 | #endif |
| 1282 | |
| 1283 | #ifdef PE_DEBUG_LOG1 |
| 1284 | tANI_U8 *pTemp = pBuf; |
| 1285 | #endif |
| 1286 | |
| 1287 | if (!pStartBssReq || !pBuf) |
| 1288 | return eSIR_FAILURE; |
| 1289 | |
| 1290 | pStartBssReq->messageType = limGetU16(pBuf); |
| 1291 | pBuf += sizeof(tANI_U16); |
| 1292 | |
| 1293 | len = pStartBssReq->length = limGetU16(pBuf); |
| 1294 | pBuf += sizeof(tANI_U16); |
| 1295 | |
| 1296 | PELOG1(limLog(pMac, LOG1, FL("SME_START_BSS_REQ length %d bytes is:\n"), len);) |
| 1297 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);) |
| 1298 | |
| 1299 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 1300 | return eSIR_FAILURE; |
| 1301 | |
| 1302 | len -= sizeof(tANI_U32); // skip message header |
| 1303 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1304 | return eSIR_FAILURE; |
| 1305 | |
| 1306 | // Extract sessionId |
| 1307 | pStartBssReq->sessionId = *pBuf++; |
| 1308 | len--; |
| 1309 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1310 | return eSIR_FAILURE; |
| 1311 | |
| 1312 | // Extract transactionId |
| 1313 | pStartBssReq->transactionId = limGetU16( pBuf ); |
| 1314 | pBuf += sizeof( tANI_U16 ); |
| 1315 | len -= sizeof( tANI_U16 ); |
| 1316 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1317 | return eSIR_FAILURE; |
| 1318 | |
| 1319 | // Extract bssId |
| 1320 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 1321 | pBuf += sizeof(tSirMacAddr); |
| 1322 | len -= sizeof(tSirMacAddr); |
| 1323 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1324 | return eSIR_FAILURE; |
| 1325 | |
| 1326 | // Extract selfMacAddr |
| 1327 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->selfMacAddr, pBuf, sizeof(tSirMacAddr)); |
| 1328 | pBuf += sizeof(tSirMacAddr); |
| 1329 | len -= sizeof(tSirMacAddr); |
| 1330 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1331 | return eSIR_FAILURE; |
| 1332 | |
| 1333 | // Extract beaconInterval |
| 1334 | pStartBssReq->beaconInterval = limGetU16( pBuf ); |
| 1335 | pBuf += sizeof( tANI_U16 ); |
| 1336 | len -= sizeof( tANI_U16 ); |
| 1337 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1338 | return eSIR_FAILURE; |
| 1339 | |
| 1340 | // Extract dot11Mode |
| 1341 | pStartBssReq->dot11mode = *pBuf++; |
| 1342 | len --; |
| 1343 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1344 | return eSIR_FAILURE; |
| 1345 | |
| 1346 | // Extract bssType |
| 1347 | pStartBssReq->bssType = (tSirBssType) limGetU32(pBuf); |
| 1348 | pBuf += sizeof(tANI_U32); |
| 1349 | len -= sizeof(tANI_U32); |
| 1350 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1351 | return eSIR_FAILURE; |
| 1352 | |
| 1353 | // Extract ssId |
| 1354 | if (*pBuf > SIR_MAC_MAX_SSID_LENGTH) |
| 1355 | { |
| 1356 | // SSID length is more than max allowed 32 bytes |
| 1357 | PELOGW(limLog(pMac, LOGW, FL("Invalid SSID length, len=%d\n"), *pBuf);) |
| 1358 | return eSIR_FAILURE; |
| 1359 | } |
| 1360 | |
| 1361 | pStartBssReq->ssId.length = *pBuf++; |
| 1362 | len--; |
| 1363 | if (len < pStartBssReq->ssId.length) |
| 1364 | { |
| 1365 | limLog(pMac, LOGW, |
| 1366 | FL("SSID length is longer that the remaining length. SSID len=%d, remaining len=%d\n"), |
| 1367 | pStartBssReq->ssId.length, len); |
| 1368 | return eSIR_FAILURE; |
| 1369 | } |
| 1370 | |
| 1371 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->ssId.ssId, |
| 1372 | pBuf, |
| 1373 | pStartBssReq->ssId.length); |
| 1374 | pBuf += pStartBssReq->ssId.length; |
| 1375 | len -= pStartBssReq->ssId.length; |
| 1376 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1377 | return eSIR_FAILURE; |
| 1378 | |
| 1379 | // Extract channelId |
| 1380 | pStartBssReq->channelId = *pBuf++; |
| 1381 | len--; |
| 1382 | |
| 1383 | // Extract CB secondary channel info |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1384 | pStartBssReq->cbMode = (ePhyChanBondState)limGetU32( pBuf ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1385 | pBuf += sizeof( tANI_U32 ); |
| 1386 | len -= sizeof( tANI_U32 ); |
| 1387 | |
| 1388 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1389 | return eSIR_FAILURE; |
| 1390 | |
| 1391 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP) |
| 1392 | tANI_U16 paramLen = 0; |
| 1393 | |
| 1394 | // Extract alternateRadioList |
| 1395 | pStartBssReq->alternateRadioList.numBss = *pBuf; |
| 1396 | paramLen = limGetAlternateRadioList(pMac, |
| 1397 | &pMac->lim.gLimAlternateRadioList, |
| 1398 | pBuf); |
| 1399 | pBuf += paramLen; |
| 1400 | len -= paramLen; |
| 1401 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1402 | return eSIR_FAILURE; |
| 1403 | |
| 1404 | // Extract powerLevel |
| 1405 | pStartBssReq->powerLevel = *pBuf++; |
| 1406 | len--; |
| 1407 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1408 | return eSIR_FAILURE; |
| 1409 | |
| 1410 | // Extract wdsInfo |
| 1411 | if (limGetWdsInfo(pMac, &pStartBssReq->wdsInfo, pBuf) == false) |
| 1412 | { |
| 1413 | limLog(pMac, LOGW, FL("Invalid WDS length %d in SME_START_BSS_REQ\n"), |
| 1414 | pStartBssReq->wdsInfo.wdsLength); |
| 1415 | return eSIR_FAILURE; |
| 1416 | } |
| 1417 | |
| 1418 | pBuf += sizeof(tANI_U16) + pStartBssReq->wdsInfo.wdsLength; |
| 1419 | len -= (sizeof(tANI_U16) + pStartBssReq->wdsInfo.wdsLength); |
| 1420 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1421 | return eSIR_FAILURE; |
| 1422 | #endif |
| 1423 | |
| 1424 | #ifdef WLAN_SOFTAP_FEATURE |
| 1425 | // Extract privacy setting |
| 1426 | pStartBssReq->privacy = *pBuf++; |
| 1427 | len--; |
| 1428 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1429 | return eSIR_FAILURE; |
| 1430 | |
| 1431 | //Extract Uapsd Enable |
| 1432 | pStartBssReq->apUapsdEnable = *pBuf++; |
| 1433 | len--; |
| 1434 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1435 | return eSIR_FAILURE; |
| 1436 | |
| 1437 | //Extract SSID hidden |
| 1438 | pStartBssReq->ssidHidden = *pBuf++; |
| 1439 | len--; |
| 1440 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1441 | return eSIR_FAILURE; |
| 1442 | |
| 1443 | pStartBssReq->fwdWPSPBCProbeReq = *pBuf++; |
| 1444 | len--; |
| 1445 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1446 | return eSIR_FAILURE; |
| 1447 | |
| 1448 | //Extract HT Protection Enable |
| 1449 | pStartBssReq->protEnabled = *pBuf++; |
| 1450 | len--; |
| 1451 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1452 | return eSIR_FAILURE; |
| 1453 | |
| 1454 | //Extract OBSS Protection Enable |
| 1455 | pStartBssReq->obssProtEnabled = *pBuf++; |
| 1456 | len--; |
| 1457 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1458 | return eSIR_FAILURE; |
| 1459 | |
| 1460 | pStartBssReq->ht_capab = limGetU16(pBuf); |
| 1461 | pBuf += sizeof(tANI_U16); |
| 1462 | len -= sizeof(tANI_U16); |
| 1463 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1464 | return eSIR_FAILURE; |
| 1465 | |
| 1466 | // Extract AuthType |
| 1467 | pStartBssReq->authType = (tSirBssType) limGetU32(pBuf); |
| 1468 | pBuf += sizeof(tANI_U32); |
| 1469 | len -= sizeof(tANI_U32); |
| 1470 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1471 | return eSIR_FAILURE; |
| 1472 | |
| 1473 | // Extract dtimPeriod |
| 1474 | pStartBssReq->dtimPeriod = limGetU32(pBuf); |
| 1475 | pBuf += sizeof(tANI_U32); |
| 1476 | len -= sizeof(tANI_U32); |
| 1477 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1478 | return eSIR_FAILURE; |
| 1479 | |
| 1480 | // Extract wps state |
| 1481 | pStartBssReq->wps_state = *pBuf++; |
| 1482 | len--; |
| 1483 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1484 | return eSIR_FAILURE; |
| 1485 | |
| 1486 | #endif |
| 1487 | // Extract bssPersona |
| 1488 | pStartBssReq->bssPersona = *pBuf++; |
| 1489 | len--; |
| 1490 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1491 | return eSIR_FAILURE; |
| 1492 | |
| 1493 | // Extract rsnIe |
| 1494 | pStartBssReq->rsnIE.length = limGetU16(pBuf); |
| 1495 | pBuf += sizeof(tANI_U16); |
| 1496 | |
| 1497 | // Check for RSN IE length (that includes length of type & length |
| 1498 | if (pStartBssReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2) |
| 1499 | { |
| 1500 | limLog(pMac, LOGW, |
| 1501 | FL("Invalid RSN IE length %d in SME_START_BSS_REQ\n"), |
| 1502 | pStartBssReq->rsnIE.length); |
| 1503 | return eSIR_FAILURE; |
| 1504 | } |
| 1505 | |
| 1506 | palCopyMemory( pMac->hHdd, pStartBssReq->rsnIE.rsnIEdata, |
| 1507 | pBuf, pStartBssReq->rsnIE.length); |
| 1508 | |
| 1509 | len -= (sizeof(tANI_U16) + pStartBssReq->rsnIE.length); |
| 1510 | pBuf += pStartBssReq->rsnIE.length; |
| 1511 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1512 | return eSIR_FAILURE; |
| 1513 | |
| 1514 | // Extract nwType |
| 1515 | pStartBssReq->nwType = (tSirNwType) limGetU32(pBuf); |
| 1516 | pBuf += sizeof(tSirNwType); |
| 1517 | len -= sizeof(tSirNwType); |
| 1518 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1519 | return eSIR_FAILURE; |
| 1520 | |
| 1521 | // Extract operationalRateSet |
| 1522 | pStartBssReq->operationalRateSet.numRates = *pBuf++; |
| 1523 | |
| 1524 | // Check for number of rates |
| 1525 | if (pStartBssReq->operationalRateSet.numRates > |
| 1526 | SIR_MAC_MAX_NUMBER_OF_RATES) |
| 1527 | { |
| 1528 | limLog(pMac, LOGW, FL("Invalid numRates %d in SME_START_BSS_REQ\n"), |
| 1529 | pStartBssReq->operationalRateSet.numRates); |
| 1530 | return eSIR_FAILURE; |
| 1531 | } |
| 1532 | |
| 1533 | len--; |
| 1534 | if (len < pStartBssReq->operationalRateSet.numRates) |
| 1535 | return eSIR_FAILURE; |
| 1536 | |
| 1537 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->operationalRateSet.rate, |
| 1538 | pBuf, |
| 1539 | pStartBssReq->operationalRateSet.numRates); |
| 1540 | pBuf += pStartBssReq->operationalRateSet.numRates; |
| 1541 | len -= pStartBssReq->operationalRateSet.numRates; |
| 1542 | |
| 1543 | // Extract extendedRateSet |
| 1544 | if ((pStartBssReq->nwType == eSIR_11G_NW_TYPE) || |
| 1545 | (pStartBssReq->nwType == eSIR_11N_NW_TYPE )) |
| 1546 | { |
| 1547 | pStartBssReq->extendedRateSet.numRates = *pBuf++; |
| 1548 | len--; |
| 1549 | palCopyMemory( pMac->hHdd, pStartBssReq->extendedRateSet.rate, |
| 1550 | pBuf, pStartBssReq->extendedRateSet.numRates); |
| 1551 | pBuf += pStartBssReq->extendedRateSet.numRates; |
| 1552 | len -= pStartBssReq->extendedRateSet.numRates; |
| 1553 | } |
| 1554 | |
| 1555 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP) |
| 1556 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1557 | return eSIR_FAILURE; |
| 1558 | |
| 1559 | limLog(pMac, |
| 1560 | LOGW, |
| 1561 | FL("Going to parse numSSID in the START_BSS_REQ, len=%d\n"), len); |
| 1562 | if (len < 2) |
| 1563 | { |
| 1564 | // No numSSID parameter in the START_BSS_REQ |
| 1565 | limLog(pMac, |
| 1566 | LOGW, |
| 1567 | FL("No numSSID in the START_BSS_REQ, len=%d\n"), len); |
| 1568 | return eSIR_FAILURE; |
| 1569 | } |
| 1570 | |
| 1571 | // Extract numSSID |
| 1572 | pStartBssReq->numSSID = *pBuf++; |
| 1573 | len--; |
| 1574 | |
| 1575 | // Extract ssIdList[] |
| 1576 | for (i = 0; (i < pStartBssReq->numSSID) && len; i++) |
| 1577 | { |
| 1578 | pStartBssReq->ssIdList[i].length = *pBuf++; |
| 1579 | len--; |
| 1580 | if (len < pStartBssReq->ssIdList[i].length) |
| 1581 | { |
| 1582 | limLog(pMac, LOGW, |
| 1583 | FL("SSID length[%d] is more than the rem length[%d]\n"), |
| 1584 | pStartBssReq->ssIdList[i].length, len); |
| 1585 | return eSIR_FAILURE; |
| 1586 | } |
| 1587 | |
| 1588 | if (pStartBssReq->ssIdList[i].length > SIR_MAC_MAX_SSID_LENGTH) |
| 1589 | { |
| 1590 | // SSID length is more than max allowed 32 bytes |
| 1591 | limLog(pMac, |
| 1592 | LOGW, |
| 1593 | FL("Invalid SSID length in the list, len=%d\n"), |
| 1594 | pStartBssReq->ssIdList[i].length); |
| 1595 | return eSIR_FAILURE; |
| 1596 | } |
| 1597 | |
| 1598 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->ssIdList[i].ssId, |
| 1599 | pBuf, |
| 1600 | pStartBssReq->ssIdList[i].length); |
| 1601 | pBuf += pStartBssReq->ssIdList[i].length; |
| 1602 | len -= pStartBssReq->ssIdList[i].length; |
| 1603 | } |
| 1604 | #endif |
| 1605 | |
| 1606 | if (len) |
| 1607 | { |
| 1608 | limLog(pMac, LOGW, FL("Extra bytes left in SME_START_BSS_REQ, len=%d\n"), len); |
| 1609 | } |
| 1610 | |
| 1611 | return eSIR_SUCCESS; |
| 1612 | } /*** end limStartBssReqSerDes() ***/ |
| 1613 | |
| 1614 | |
| 1615 | |
| 1616 | /** |
| 1617 | * limStopBssReqSerDes() |
| 1618 | * |
| 1619 | *FUNCTION: |
| 1620 | * This function is called by limProcessSmeMessages() upon receiving |
| 1621 | * SME_STOP_BSS_REQ from host |
| 1622 | * |
| 1623 | *PARAMS: |
| 1624 | * |
| 1625 | *LOGIC: |
| 1626 | * |
| 1627 | *ASSUMPTIONS: |
| 1628 | * NA |
| 1629 | * |
| 1630 | *NOTE: |
| 1631 | * NA |
| 1632 | * |
| 1633 | * @param pStopBssReq Pointer to tSirSmeStopBssReq being extracted |
| 1634 | * @param pBuf Pointer to serialized buffer |
| 1635 | * @return retCode Indicates whether message is successfully |
| 1636 | * de-serialized (eSIR_SUCCESS) or |
| 1637 | * not (eSIR_FAILURE) |
| 1638 | */ |
| 1639 | |
| 1640 | tSirRetStatus |
| 1641 | limStopBssReqSerDes(tpAniSirGlobal pMac, tpSirSmeStopBssReq pStopBssReq, tANI_U8 *pBuf) |
| 1642 | { |
| 1643 | tANI_S16 len = 0; |
| 1644 | |
| 1645 | #ifdef PE_DEBUG_LOG1 |
| 1646 | tANI_U8 *pTemp = pBuf; |
| 1647 | #endif |
| 1648 | |
| 1649 | pStopBssReq->messageType = limGetU16(pBuf); |
| 1650 | pBuf += sizeof(tANI_U16); |
| 1651 | |
| 1652 | len = pStopBssReq->length = limGetU16(pBuf); |
| 1653 | pBuf += sizeof(tANI_U16); |
| 1654 | |
| 1655 | PELOG1(limLog(pMac, LOG1, FL("SME_STOP_BSS_REQ length %d bytes is:\n"), len);) |
| 1656 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);) |
| 1657 | |
| 1658 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 1659 | return eSIR_FAILURE; |
| 1660 | |
| 1661 | len -= sizeof(tANI_U32); // skip message header |
| 1662 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1663 | return eSIR_FAILURE; |
| 1664 | |
| 1665 | // Extract sessionId |
| 1666 | pStopBssReq->sessionId = *pBuf++; |
| 1667 | len--; |
| 1668 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1669 | return eSIR_FAILURE; |
| 1670 | |
| 1671 | // Extract transactionId |
| 1672 | pStopBssReq->transactionId = limGetU16(pBuf); |
| 1673 | pBuf += sizeof(tANI_U16); |
| 1674 | len -= sizeof(tANI_U16); |
| 1675 | |
| 1676 | // Extract reasonCode |
| 1677 | pStopBssReq->reasonCode = (tSirResultCodes) limGetU32(pBuf); |
| 1678 | pBuf += sizeof(tSirResultCodes); |
| 1679 | len -= sizeof(tSirResultCodes); |
| 1680 | |
| 1681 | // Extract bssId |
| 1682 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pStopBssReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 1683 | len -= sizeof(tSirMacAddr); |
| 1684 | |
| 1685 | if (len) |
| 1686 | return eSIR_FAILURE; |
| 1687 | else |
| 1688 | return eSIR_SUCCESS; |
| 1689 | |
| 1690 | } /*** end limStopBssReqSerDes() ***/ |
| 1691 | |
| 1692 | |
| 1693 | |
| 1694 | /** |
| 1695 | * limJoinReqSerDes() |
| 1696 | * |
| 1697 | *FUNCTION: |
| 1698 | * This function is called by limProcessSmeMessages() upon receiving |
| 1699 | * SME_JOIN_REQ from host |
| 1700 | * |
| 1701 | *PARAMS: |
| 1702 | * |
| 1703 | *LOGIC: |
| 1704 | * |
| 1705 | *ASSUMPTIONS: |
| 1706 | * NA |
| 1707 | * |
| 1708 | *NOTE: |
| 1709 | * NA |
| 1710 | * |
| 1711 | * @param pJoinReq Pointer to tSirSmeJoinReq being extracted |
| 1712 | * @param pBuf Pointer to serialized buffer |
| 1713 | * @return retCode Indicates whether message is successfully |
| 1714 | * de-serialized (eSIR_SUCCESS) or |
| 1715 | * not (eSIR_FAILURE) |
| 1716 | */ |
| 1717 | |
| 1718 | tSirRetStatus |
| 1719 | limJoinReqSerDes(tpAniSirGlobal pMac, tpSirSmeJoinReq pJoinReq, tANI_U8 *pBuf) |
| 1720 | { |
| 1721 | tANI_S16 len = 0; |
| 1722 | tANI_S16 lenUsed = 0; |
| 1723 | |
| 1724 | #ifdef PE_DEBUG_LOG1 |
| 1725 | tANI_U8 *pTemp = pBuf; |
| 1726 | #endif |
| 1727 | |
| 1728 | if (!pJoinReq || !pBuf) |
| 1729 | { |
| 1730 | PELOGE(limLog(pMac, LOGE, FL("NULL ptr received\n"));) |
| 1731 | return eSIR_FAILURE; |
| 1732 | } |
| 1733 | |
| 1734 | // Extract messageType |
| 1735 | pJoinReq->messageType = limGetU16(pBuf); |
| 1736 | pBuf += sizeof(tANI_U16); |
| 1737 | |
| 1738 | // Extract length |
| 1739 | len = pJoinReq->length = limGetU16(pBuf); |
| 1740 | pBuf += sizeof(tANI_U16); |
| 1741 | |
| 1742 | if (pJoinReq->messageType == eWNI_SME_JOIN_REQ) |
| 1743 | PELOG1(limLog(pMac, LOG3, FL("SME_JOIN_REQ length %d bytes is:\n"), len);) |
| 1744 | else |
| 1745 | PELOG1(limLog(pMac, LOG3, FL("SME_REASSOC_REQ length %d bytes is:\n"), len);) |
| 1746 | |
| 1747 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);) |
| 1748 | |
| 1749 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 1750 | { |
| 1751 | PELOGE(limLog(pMac, LOGE, FL("len too short %d\n"), len);) |
| 1752 | return eSIR_FAILURE; |
| 1753 | } |
| 1754 | |
| 1755 | len -= sizeof(tANI_U32); // skip message header |
| 1756 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1757 | return eSIR_FAILURE; |
| 1758 | |
| 1759 | // Extract sessionId |
| 1760 | pJoinReq->sessionId = *pBuf++; |
| 1761 | len--; |
| 1762 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1763 | return eSIR_FAILURE; |
| 1764 | |
| 1765 | // Extract transactionId |
| 1766 | pJoinReq->transactionId = limGetU16(pBuf); |
| 1767 | pBuf += sizeof(tANI_U16); |
| 1768 | len -= sizeof(tANI_U16); |
| 1769 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1770 | return eSIR_FAILURE; |
| 1771 | |
| 1772 | // Extract ssId |
| 1773 | pJoinReq->ssId.length = *pBuf++; |
| 1774 | len--; |
| 1775 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->ssId.ssId, pBuf, pJoinReq->ssId.length); |
| 1776 | pBuf += pJoinReq->ssId.length; |
| 1777 | len -= pJoinReq->ssId.length; |
| 1778 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1779 | return eSIR_FAILURE; |
| 1780 | |
| 1781 | // Extract selfMacAddr |
| 1782 | palCopyMemory( pMac->hHdd, pJoinReq->selfMacAddr, pBuf, sizeof(tSirMacAddr)); |
| 1783 | pBuf += sizeof(tSirMacAddr); |
| 1784 | len -= sizeof(tSirMacAddr); |
| 1785 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1786 | return eSIR_FAILURE; |
| 1787 | |
| 1788 | // Extract bsstype |
| 1789 | pJoinReq->bsstype = (tSirBssType) limGetU32(pBuf); |
| 1790 | pBuf += sizeof(tANI_U32); |
| 1791 | len -= sizeof(tANI_U32); |
| 1792 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1793 | return eSIR_FAILURE; |
| 1794 | |
| 1795 | // Extract dot11mode |
| 1796 | pJoinReq->dot11mode= *pBuf++; |
| 1797 | len--; |
| 1798 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1799 | return eSIR_FAILURE; |
| 1800 | |
| 1801 | // Extract bssPersona |
| 1802 | pJoinReq->staPersona = *pBuf++; |
| 1803 | len--; |
| 1804 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1805 | return eSIR_FAILURE; |
| 1806 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1807 | // Extract cbMode |
| 1808 | pJoinReq->cbMode = *pBuf++; |
| 1809 | len--; |
| 1810 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1811 | return eSIR_FAILURE; |
| 1812 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1813 | // Extract uapsdPerAcBitmask |
| 1814 | pJoinReq->uapsdPerAcBitmask = *pBuf++; |
| 1815 | len--; |
| 1816 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1817 | return eSIR_FAILURE; |
| 1818 | |
| 1819 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) |
| 1820 | // Extract assocType |
| 1821 | pJoinReq->assocType = (tSirAssocType) limGetU32(pBuf); |
| 1822 | pBuf += sizeof(tSirAssocType); |
| 1823 | len -= sizeof(tSirAssocType); |
| 1824 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1825 | return eSIR_FAILURE; |
| 1826 | #endif |
| 1827 | |
| 1828 | // Extract operationalRateSet |
| 1829 | pJoinReq->operationalRateSet.numRates= *pBuf++; |
| 1830 | len--; |
| 1831 | if (pJoinReq->operationalRateSet.numRates) |
| 1832 | { |
| 1833 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->operationalRateSet.rate, pBuf, pJoinReq->operationalRateSet.numRates); |
| 1834 | pBuf += pJoinReq->operationalRateSet.numRates; |
| 1835 | len -= pJoinReq->operationalRateSet.numRates; |
| 1836 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1837 | return eSIR_FAILURE; |
| 1838 | } |
| 1839 | |
| 1840 | // Extract extendedRateSet |
| 1841 | pJoinReq->extendedRateSet.numRates = *pBuf++; |
| 1842 | len--; |
| 1843 | if (pJoinReq->extendedRateSet.numRates) |
| 1844 | { |
| 1845 | palCopyMemory( pMac->hHdd, pJoinReq->extendedRateSet.rate, pBuf, pJoinReq->extendedRateSet.numRates); |
| 1846 | pBuf += pJoinReq->extendedRateSet.numRates; |
| 1847 | len -= pJoinReq->extendedRateSet.numRates; |
| 1848 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1849 | return eSIR_FAILURE; |
| 1850 | } |
| 1851 | |
| 1852 | // Extract RSN IE |
| 1853 | pJoinReq->rsnIE.length = limGetU16(pBuf); |
| 1854 | pBuf += sizeof(tANI_U16); |
| 1855 | len -= sizeof(tANI_U16); |
| 1856 | |
| 1857 | if (pJoinReq->rsnIE.length) |
| 1858 | { |
| 1859 | // Check for RSN IE length (that includes length of type & length) |
| 1860 | if ((pJoinReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2) || |
| 1861 | (pJoinReq->rsnIE.length != 2 + *(pBuf + 1))) |
| 1862 | { |
| 1863 | limLog(pMac, LOGW, |
| 1864 | FL("Invalid RSN IE length %d in SME_JOIN_REQ\n"), |
| 1865 | pJoinReq->rsnIE.length); |
| 1866 | return eSIR_FAILURE; |
| 1867 | } |
| 1868 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->rsnIE.rsnIEdata, |
| 1869 | pBuf, pJoinReq->rsnIE.length); |
| 1870 | pBuf += pJoinReq->rsnIE.length; |
| 1871 | len -= pJoinReq->rsnIE.length; // skip RSN IE |
| 1872 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1873 | return eSIR_FAILURE; |
| 1874 | } |
| 1875 | |
| 1876 | #ifdef FEATURE_WLAN_CCX |
| 1877 | // Extract CCKM IE |
| 1878 | pJoinReq->cckmIE.length = limGetU16(pBuf); |
| 1879 | pBuf += sizeof(tANI_U16); |
| 1880 | len -= sizeof(tANI_U16); |
| 1881 | if (pJoinReq->cckmIE.length) |
| 1882 | { |
| 1883 | // Check for CCKM IE length (that includes length of type & length) |
| 1884 | if ((pJoinReq->cckmIE.length > SIR_MAC_MAX_IE_LENGTH) || |
| 1885 | (pJoinReq->cckmIE.length != (2 + *(pBuf + 1)))) |
| 1886 | { |
| 1887 | limLog(pMac, LOGW, |
| 1888 | FL("Invalid CCKM IE length %d/%d in SME_JOIN/REASSOC_REQ\n"), |
| 1889 | pJoinReq->cckmIE.length, 2 + *(pBuf + 1)); |
| 1890 | return eSIR_FAILURE; |
| 1891 | } |
| 1892 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->cckmIE.cckmIEdata, |
| 1893 | pBuf, pJoinReq->cckmIE.length); |
| 1894 | pBuf += pJoinReq->cckmIE.length; |
| 1895 | len -= pJoinReq->cckmIE.length; // skip CCKM IE |
| 1896 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1897 | return eSIR_FAILURE; |
| 1898 | } |
| 1899 | #endif |
| 1900 | |
| 1901 | // Extract Add IE for scan |
| 1902 | pJoinReq->addIEScan.length = limGetU16(pBuf); |
| 1903 | pBuf += sizeof(tANI_U16); |
| 1904 | len -= sizeof(tANI_U16); |
| 1905 | |
| 1906 | if (pJoinReq->addIEScan.length) |
| 1907 | { |
| 1908 | // Check for IE length (that includes length of type & length) |
| 1909 | if (pJoinReq->addIEScan.length > SIR_MAC_MAX_IE_LENGTH + 2) |
| 1910 | { |
| 1911 | limLog(pMac, LOGE, |
| 1912 | FL("Invalid addIE Scan length %d in SME_JOIN_REQ\n"), |
| 1913 | pJoinReq->addIEScan.length); |
| 1914 | return eSIR_FAILURE; |
| 1915 | } |
| 1916 | // Check for P2P IE length (that includes length of type & length) |
| 1917 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->addIEScan.addIEdata, |
| 1918 | pBuf, pJoinReq->addIEScan.length); |
| 1919 | pBuf += pJoinReq->addIEScan.length; |
| 1920 | len -= pJoinReq->addIEScan.length; // skip add IE |
| 1921 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1922 | return eSIR_FAILURE; |
| 1923 | } |
| 1924 | |
| 1925 | pJoinReq->addIEAssoc.length = limGetU16(pBuf); |
| 1926 | pBuf += sizeof(tANI_U16); |
| 1927 | len -= sizeof(tANI_U16); |
| 1928 | |
| 1929 | // Extract Add IE for assoc |
| 1930 | if (pJoinReq->addIEAssoc.length) |
| 1931 | { |
| 1932 | // Check for IE length (that includes length of type & length) |
| 1933 | if (pJoinReq->addIEAssoc.length > SIR_MAC_MAX_IE_LENGTH + 2) |
| 1934 | { |
| 1935 | limLog(pMac, LOGE, |
| 1936 | FL("Invalid addIE Assoc length %d in SME_JOIN_REQ\n"), |
| 1937 | pJoinReq->addIEAssoc.length); |
| 1938 | return eSIR_FAILURE; |
| 1939 | } |
| 1940 | // Check for P2P IE length (that includes length of type & length) |
| 1941 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->addIEAssoc.addIEdata, |
| 1942 | pBuf, pJoinReq->addIEAssoc.length); |
| 1943 | pBuf += pJoinReq->addIEAssoc.length; |
| 1944 | len -= pJoinReq->addIEAssoc.length; // skip add IE |
| 1945 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1946 | return eSIR_FAILURE; |
| 1947 | } |
| 1948 | |
| 1949 | pJoinReq->MCEncryptionType = limGetU32(pBuf); |
| 1950 | pBuf += sizeof(tANI_U32); |
| 1951 | len -= sizeof(tANI_U32); |
| 1952 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1953 | return eSIR_FAILURE; |
| 1954 | |
| 1955 | pJoinReq->UCEncryptionType = limGetU32(pBuf); |
| 1956 | pBuf += sizeof(tANI_U32); |
| 1957 | len -= sizeof(tANI_U32); |
| 1958 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1959 | return eSIR_FAILURE; |
| 1960 | |
| 1961 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1962 | //is11Rconnection; |
| 1963 | pJoinReq->is11Rconnection = (tAniBool)limGetU32(pBuf); |
| 1964 | pBuf += sizeof(tAniBool); |
| 1965 | len -= sizeof(tAniBool); |
| 1966 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1967 | return eSIR_FAILURE; |
| 1968 | #endif |
| 1969 | |
| 1970 | #ifdef FEATURE_WLAN_CCX |
| 1971 | //isCCXconnection; |
| 1972 | pJoinReq->isCCXconnection = (tAniBool)limGetU32(pBuf); |
| 1973 | pBuf += sizeof(tAniBool); |
| 1974 | len -= sizeof(tAniBool); |
| 1975 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1976 | return eSIR_FAILURE; |
| 1977 | |
| 1978 | // TSPEC information |
| 1979 | pJoinReq->ccxTspecInfo.numTspecs = *pBuf++; |
| 1980 | len -= sizeof(tANI_U8); |
| 1981 | palCopyMemory(pMac->hHdd, (void*)&pJoinReq->ccxTspecInfo.tspec[0], pBuf, (sizeof(tTspecInfo)* pJoinReq->ccxTspecInfo.numTspecs)); |
| 1982 | pBuf += sizeof(tTspecInfo)*SIR_CCX_MAX_TSPEC_IES; |
| 1983 | len -= sizeof(tTspecInfo)*SIR_CCX_MAX_TSPEC_IES; |
| 1984 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1985 | return eSIR_FAILURE; |
| 1986 | #endif |
| 1987 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1988 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1989 | //isFastTransitionEnabled; |
| 1990 | pJoinReq->isFastTransitionEnabled = (tAniBool)limGetU32(pBuf); |
| 1991 | pBuf += sizeof(tAniBool); |
| 1992 | len -= sizeof(tAniBool); |
| 1993 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1994 | return eSIR_FAILURE; |
| 1995 | #endif |
| 1996 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1997 | #ifdef FEATURE_WLAN_LFR |
| 1998 | //isFastRoamIniFeatureEnabled; |
| 1999 | pJoinReq->isFastRoamIniFeatureEnabled = (tAniBool)limGetU32(pBuf); |
| 2000 | pBuf += sizeof(tAniBool); |
| 2001 | len -= sizeof(tAniBool); |
| 2002 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2003 | return eSIR_FAILURE; |
| 2004 | #endif |
| 2005 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2006 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP) |
| 2007 | // Extract BP Indicator |
| 2008 | pJoinReq->bpIndicator = (tAniBool) limGetU32(pBuf); |
| 2009 | pBuf += sizeof(tAniBool); |
| 2010 | len -= sizeof(tAniBool); |
| 2011 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2012 | return eSIR_FAILURE; |
| 2013 | |
| 2014 | // Extract BP Type |
| 2015 | pJoinReq->bpType = (tSirBpIndicatorType) limGetU32(pBuf); |
| 2016 | pBuf += sizeof(tSirBpIndicatorType); |
| 2017 | len -= sizeof(tSirBpIndicatorType); |
| 2018 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2019 | return eSIR_FAILURE; |
| 2020 | |
| 2021 | // Extract Neighbor BSS List |
| 2022 | if (limGetNeighborBssList(pMac, &pJoinReq->neighborBssList, |
| 2023 | len, &lenUsed, pBuf) == eSIR_FAILURE) |
| 2024 | { |
| 2025 | PELOGE(limLog(pMac, LOGE, FL("get neighbor bss list failed\n"));) |
| 2026 | return eSIR_FAILURE; |
| 2027 | } |
| 2028 | pBuf += lenUsed; |
| 2029 | len -= lenUsed; |
| 2030 | PELOG1(limLog(pMac, LOG1, FL("Assoc Type %d RSN len %d bp %d type %d bss RSN len %d\n"), |
| 2031 | pJoinReq->assocType, pJoinReq->rsnIE.length, pJoinReq->bpIndicator, |
| 2032 | pJoinReq->bpType, pJoinReq->neighborBssList.bssList->rsnIE.length);) |
| 2033 | #endif |
| 2034 | |
| 2035 | // Extract Titan CB Neighbor BSS info |
| 2036 | pJoinReq->cbNeighbors.cbBssFoundPri = *pBuf; |
| 2037 | pBuf++; |
| 2038 | pJoinReq->cbNeighbors.cbBssFoundSecUp = *pBuf; |
| 2039 | pBuf++; |
| 2040 | pJoinReq->cbNeighbors.cbBssFoundSecDown = *pBuf; |
| 2041 | pBuf++; |
| 2042 | len -= 3; |
| 2043 | |
| 2044 | // Extract Spectrum Mgt Indicator |
| 2045 | pJoinReq->spectrumMgtIndicator = (tAniBool) limGetU32(pBuf); |
| 2046 | pBuf += sizeof(tAniBool); |
| 2047 | len -= sizeof(tAniBool); |
| 2048 | |
| 2049 | pJoinReq->powerCap.minTxPower = *pBuf++; |
| 2050 | pJoinReq->powerCap.maxTxPower = *pBuf++; |
| 2051 | len -=2; |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 2052 | limLog(pMac, LOG1, FL("Power Caps: Min power = %d, Max power = %d\n"), pJoinReq->powerCap.minTxPower, pJoinReq->powerCap.maxTxPower); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2053 | |
| 2054 | pJoinReq->supportedChannels.numChnl = *pBuf++; |
| 2055 | len--; |
| 2056 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->supportedChannels.channelList, |
| 2057 | pBuf, pJoinReq->supportedChannels.numChnl); |
| 2058 | pBuf += pJoinReq->supportedChannels.numChnl; |
| 2059 | len-= pJoinReq->supportedChannels.numChnl; |
| 2060 | |
| 2061 | PELOG2(limLog(pMac, LOG2, |
| 2062 | FL("spectrumInd ON: minPower %d, maxPower %d , numChnls %d\n"), |
| 2063 | pJoinReq->powerCap.minTxPower, |
| 2064 | pJoinReq->powerCap.maxTxPower, |
| 2065 | pJoinReq->supportedChannels.numChnl);) |
| 2066 | |
| 2067 | // Extract uapsdPerAcBitmask |
| 2068 | pJoinReq->uapsdPerAcBitmask = *pBuf++; |
| 2069 | len--; |
| 2070 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2071 | return eSIR_FAILURE; |
| 2072 | |
| 2073 | #if (WNI_POLARIS_FW_PRODUCT == WLAN_STA) |
| 2074 | // |
| 2075 | // NOTE - tSirBssDescription is now moved to the end |
| 2076 | // of tSirSmeJoinReq structure. This is to accomodate |
| 2077 | // the variable length data member ieFields[1] |
| 2078 | // |
| 2079 | if (limGetBssDescription( pMac, &pJoinReq->bssDescription, |
| 2080 | len, &lenUsed, pBuf) == eSIR_FAILURE) |
| 2081 | { |
| 2082 | PELOGE(limLog(pMac, LOGE, FL("get bss description failed\n"));) |
| 2083 | return eSIR_FAILURE; |
| 2084 | } |
| 2085 | PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, (tANI_U8 *) &(pJoinReq->bssDescription), pJoinReq->bssDescription.length + 2);) |
| 2086 | pBuf += lenUsed; |
| 2087 | len -= lenUsed; |
| 2088 | #endif |
| 2089 | |
| 2090 | return eSIR_SUCCESS; |
| 2091 | } /*** end limJoinReqSerDes() ***/ |
| 2092 | |
| 2093 | |
| 2094 | /**--------------------------------------------------------------- |
| 2095 | \fn limAssocIndSerDes |
| 2096 | \brief This function is called by limProcessMlmAssocInd() to |
| 2097 | \ populate the SME_ASSOC_IND message based on the received |
| 2098 | \ MLM_ASSOC_IND. |
| 2099 | \ |
| 2100 | \param pMac |
| 2101 | \param pAssocInd - Pointer to the received tLimMlmAssocInd |
| 2102 | \param pBuf - Pointer to serialized buffer |
| 2103 | \param psessionEntry - pointer to PE session entry |
| 2104 | \ |
| 2105 | \return None |
| 2106 | ------------------------------------------------------------------*/ |
| 2107 | void |
| 2108 | limAssocIndSerDes(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd, tANI_U8 *pBuf, tpPESession psessionEntry) |
| 2109 | { |
| 2110 | tANI_U8 *pLen = pBuf; |
| 2111 | tANI_U16 mLen = 0; |
| 2112 | |
| 2113 | #ifdef PE_DEBUG_LOG1 |
| 2114 | tANI_U8 *pTemp = pBuf; |
| 2115 | #endif |
| 2116 | |
| 2117 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) |
| 2118 | tANI_U32 len = 0; |
| 2119 | #endif |
| 2120 | |
| 2121 | mLen = sizeof(tANI_U32); |
| 2122 | mLen += sizeof(tANI_U8); |
| 2123 | pBuf += sizeof(tANI_U16); |
| 2124 | *pBuf = psessionEntry->smeSessionId; |
| 2125 | pBuf += sizeof(tANI_U8); |
| 2126 | |
| 2127 | // Fill in peerMacAddr |
| 2128 | palCopyMemory( pMac->hHdd, pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 2129 | pBuf += sizeof(tSirMacAddr); |
| 2130 | mLen += sizeof(tSirMacAddr); |
| 2131 | |
| 2132 | // Fill in aid |
| 2133 | limCopyU16(pBuf, pAssocInd->aid); |
| 2134 | pBuf += sizeof(tANI_U16); |
| 2135 | mLen += sizeof(tANI_U16); |
| 2136 | |
| 2137 | // Fill in bssId |
| 2138 | palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr)); |
| 2139 | pBuf += sizeof(tSirMacAddr); |
| 2140 | mLen += sizeof(tSirMacAddr); |
| 2141 | |
| 2142 | // Fill in staId |
| 2143 | limCopyU16(pBuf, psessionEntry->staId); |
| 2144 | pBuf += sizeof(tANI_U16); |
| 2145 | mLen += sizeof(tANI_U16); |
| 2146 | |
| 2147 | // Fill in authType |
| 2148 | limCopyU32(pBuf, pAssocInd->authType); |
| 2149 | pBuf += sizeof(tANI_U32); |
| 2150 | mLen += sizeof(tANI_U32); |
| 2151 | |
| 2152 | // Fill in ssId |
| 2153 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1); |
| 2154 | pBuf += (1 + pAssocInd->ssId.length); |
| 2155 | mLen += (1 + pAssocInd->ssId.length); |
| 2156 | |
| 2157 | // Fill in rsnIE |
| 2158 | limCopyU16(pBuf, pAssocInd->rsnIE.length); |
| 2159 | pBuf += sizeof(tANI_U16); |
| 2160 | mLen += sizeof(tANI_U16); |
| 2161 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata), |
| 2162 | pAssocInd->rsnIE.length); |
| 2163 | pBuf += pAssocInd->rsnIE.length; |
| 2164 | mLen += pAssocInd->rsnIE.length; |
| 2165 | |
| 2166 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) |
| 2167 | |
| 2168 | limCopyU16(pBuf, pAssocInd->seqNum); |
| 2169 | pBuf += sizeof(tANI_U16); |
| 2170 | mLen += sizeof(tANI_U16); |
| 2171 | |
| 2172 | limCopyU32(pBuf, pAssocInd->wniIndicator); |
| 2173 | pBuf += sizeof(tAniBool); |
| 2174 | mLen += sizeof(tAniBool); |
| 2175 | |
| 2176 | limCopyU32(pBuf, pAssocInd->bpIndicator); |
| 2177 | pBuf += sizeof(tAniBool); |
| 2178 | mLen += sizeof(tAniBool); |
| 2179 | |
| 2180 | limCopyU32(pBuf, pAssocInd->bpType); |
| 2181 | pBuf += sizeof(tSirBpIndicatorType); |
| 2182 | mLen += sizeof(tSirBpIndicatorType); |
| 2183 | |
| 2184 | limCopyU32(pBuf, pAssocInd->assocType); |
| 2185 | pBuf += sizeof(tANI_U32); |
| 2186 | mLen += sizeof(tANI_U32); |
| 2187 | |
| 2188 | limCopyLoad(pBuf, pAssocInd->load); |
| 2189 | pBuf += sizeof(tSirLoad); |
| 2190 | mLen += sizeof(tSirLoad); |
| 2191 | |
| 2192 | limCopyU32(pBuf, pAssocInd->numBss); |
| 2193 | pBuf += sizeof(tANI_U32); |
| 2194 | mLen += sizeof(tANI_U32); |
| 2195 | |
| 2196 | if (pAssocInd->numBss) |
| 2197 | { |
| 2198 | len = limCopyNeighborList(pMac, |
| 2199 | pBuf, |
| 2200 | pAssocInd->neighborList, pAssocInd->numBss); |
| 2201 | pBuf += len; |
| 2202 | mLen += (tANI_U16) len; |
| 2203 | } |
| 2204 | |
| 2205 | // place holder to capability and nwType |
| 2206 | |
| 2207 | limCopyU16(pBuf, *(tANI_U16 *)&pAssocInd->capabilityInfo); |
| 2208 | pBuf += sizeof(tANI_U16); // capabilityInfo |
| 2209 | mLen += sizeof(tANI_U16); |
| 2210 | |
| 2211 | limCopyU32(pBuf, *(tANI_U32 *)&pAssocInd->nwType); |
| 2212 | pBuf += sizeof(tANI_U32); // nwType |
| 2213 | mLen += sizeof(tANI_U32); |
| 2214 | |
| 2215 | #endif |
| 2216 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2217 | limCopyU32(pBuf, pAssocInd->spectrumMgtIndicator); |
| 2218 | pBuf += sizeof(tAniBool); |
| 2219 | mLen += sizeof(tAniBool); |
| 2220 | |
| 2221 | if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE) |
| 2222 | { |
| 2223 | *pBuf = pAssocInd->powerCap.minTxPower; |
| 2224 | pBuf++; |
| 2225 | *pBuf = pAssocInd->powerCap.maxTxPower; |
| 2226 | pBuf++; |
| 2227 | mLen += sizeof(tSirMacPowerCapInfo); |
| 2228 | |
| 2229 | *pBuf = pAssocInd->supportedChannels.numChnl; |
| 2230 | pBuf++; |
| 2231 | mLen++; |
| 2232 | |
| 2233 | palCopyMemory( pMac->hHdd, pBuf, |
| 2234 | (tANI_U8 *) &(pAssocInd->supportedChannels.channelList), |
| 2235 | pAssocInd->supportedChannels.numChnl); |
| 2236 | |
| 2237 | |
| 2238 | pBuf += pAssocInd->supportedChannels.numChnl; |
| 2239 | mLen += pAssocInd->supportedChannels.numChnl; |
| 2240 | } |
| 2241 | #ifdef WLAN_SOFTAP_FEATURE |
| 2242 | limCopyU32(pBuf, pAssocInd->WmmStaInfoPresent); |
| 2243 | pBuf += sizeof(tANI_U32); |
| 2244 | mLen += sizeof(tANI_U32); |
| 2245 | #endif |
| 2246 | // Fill in length of SME_ASSOC_IND message |
| 2247 | limCopyU16(pLen, mLen); |
| 2248 | |
| 2249 | PELOG1(limLog(pMac, LOG1, FL("Sending SME_ASSOC_IND length %d bytes:\n"), mLen);) |
| 2250 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);) |
| 2251 | } /*** end limAssocIndSerDes() ***/ |
| 2252 | |
| 2253 | |
| 2254 | |
| 2255 | /** |
| 2256 | * limAssocCnfSerDes() |
| 2257 | * |
| 2258 | *FUNCTION: |
| 2259 | * This function is called by limProcessLmmMessages() when |
| 2260 | * SME_ASSOC_CNF or SME_REASSOC_CNF message is received from |
| 2261 | * upper layer software. |
| 2262 | * |
| 2263 | *PARAMS: |
| 2264 | * |
| 2265 | *LOGIC: |
| 2266 | * |
| 2267 | *ASSUMPTIONS: |
| 2268 | * NA |
| 2269 | * |
| 2270 | *NOTE: |
| 2271 | * NA |
| 2272 | * |
| 2273 | * @param pAssocCnf Pointer to tSirSmeAssocCnf being extracted into |
| 2274 | * @param pBuf Pointer to serialized buffer |
| 2275 | * @return retCode Indicates whether message is successfully |
| 2276 | * de-serialized (eSIR_SUCCESS) or |
| 2277 | * not (eSIR_FAILURE) |
| 2278 | */ |
| 2279 | |
| 2280 | tSirRetStatus |
| 2281 | limAssocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeAssocCnf pAssocCnf, tANI_U8 *pBuf) |
| 2282 | { |
| 2283 | #ifdef PE_DEBUG_LOG1 |
| 2284 | tANI_U8 *pTemp = pBuf; |
| 2285 | #endif |
| 2286 | |
| 2287 | if (!pAssocCnf || !pBuf) |
| 2288 | return eSIR_FAILURE; |
| 2289 | |
| 2290 | pAssocCnf->messageType = limGetU16(pBuf); |
| 2291 | pBuf += sizeof(tANI_U16); |
| 2292 | |
| 2293 | pAssocCnf->length = limGetU16(pBuf); |
| 2294 | pBuf += sizeof(tANI_U16); |
| 2295 | |
| 2296 | if (pAssocCnf->messageType == eWNI_SME_ASSOC_CNF) |
| 2297 | { |
| 2298 | PELOG1(limLog(pMac, LOG1, FL("SME_ASSOC_CNF length %d bytes is:\n"), pAssocCnf->length);) |
| 2299 | } |
| 2300 | else |
| 2301 | { |
| 2302 | PELOG1(limLog(pMac, LOG1, FL("SME_REASSOC_CNF length %d bytes is:\n"), pAssocCnf->length);) |
| 2303 | } |
| 2304 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pAssocCnf->length);) |
| 2305 | |
| 2306 | // status code |
| 2307 | pAssocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf); |
| 2308 | pBuf += sizeof(tSirResultCodes); |
| 2309 | |
| 2310 | // bssId |
| 2311 | palCopyMemory( pMac->hHdd, pAssocCnf->bssId, pBuf, sizeof(tSirMacAddr)); |
| 2312 | pBuf += sizeof(tSirMacAddr); |
| 2313 | |
| 2314 | // peerMacAddr |
| 2315 | palCopyMemory( pMac->hHdd, pAssocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr)); |
| 2316 | pBuf += sizeof(tSirMacAddr); |
| 2317 | |
| 2318 | |
| 2319 | pAssocCnf->aid = limGetU16(pBuf); |
| 2320 | pBuf += sizeof(tANI_U16); |
| 2321 | // alternateBssId |
| 2322 | palCopyMemory( pMac->hHdd, pAssocCnf->alternateBssId, pBuf, sizeof(tSirMacAddr)); |
| 2323 | pBuf += sizeof(tSirMacAddr); |
| 2324 | |
| 2325 | // alternateChannelId |
| 2326 | pAssocCnf->alternateChannelId = *pBuf; |
| 2327 | pBuf++; |
| 2328 | |
| 2329 | return eSIR_SUCCESS; |
| 2330 | } /*** end limAssocCnfSerDes() ***/ |
| 2331 | |
| 2332 | |
| 2333 | |
| 2334 | /** |
| 2335 | * limDisassocCnfSerDes() |
| 2336 | * |
| 2337 | *FUNCTION: |
| 2338 | * This function is called by limProcessSmeMessages() when |
| 2339 | * SME_DISASSOC_CNF message is received from upper layer software. |
| 2340 | * |
| 2341 | *PARAMS: |
| 2342 | * |
| 2343 | *LOGIC: |
| 2344 | * |
| 2345 | *ASSUMPTIONS: |
| 2346 | * NA |
| 2347 | * |
| 2348 | *NOTE: |
| 2349 | * NA |
| 2350 | * |
| 2351 | * @param pDisassocCnf Pointer to tSirSmeDisassocCnf being |
| 2352 | * extracted into |
| 2353 | * @param pBuf Pointer to serialized buffer |
| 2354 | * @return retCode Indicates whether message is successfully |
| 2355 | * de-serialized (eSIR_SUCCESS) or |
| 2356 | * not (eSIR_FAILURE) |
| 2357 | */ |
| 2358 | |
| 2359 | tSirRetStatus |
| 2360 | limDisassocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeDisassocCnf pDisassocCnf, tANI_U8 *pBuf) |
| 2361 | { |
| 2362 | #ifdef PE_DEBUG_LOG1 |
| 2363 | tANI_U8 *pTemp = pBuf; |
| 2364 | #endif |
| 2365 | |
| 2366 | if (!pDisassocCnf || !pBuf) |
| 2367 | return eSIR_FAILURE; |
| 2368 | |
| 2369 | pDisassocCnf->messageType = limGetU16(pBuf); |
| 2370 | pBuf += sizeof(tANI_U16); |
| 2371 | |
| 2372 | pDisassocCnf->length = limGetU16(pBuf); |
| 2373 | pBuf += sizeof(tANI_U16); |
| 2374 | |
| 2375 | PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_CNF length %d bytes is:\n"), pDisassocCnf->length);) |
| 2376 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pDisassocCnf->length);) |
| 2377 | |
| 2378 | pDisassocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf); |
| 2379 | pBuf += sizeof(tSirResultCodes); |
| 2380 | |
| 2381 | palCopyMemory( pMac->hHdd, pDisassocCnf->bssId, pBuf, sizeof(tSirMacAddr)); |
| 2382 | pBuf += sizeof(tSirMacAddr); |
| 2383 | |
| 2384 | palCopyMemory( pMac->hHdd, pDisassocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr)); |
| 2385 | |
| 2386 | #if defined(ANI_PRODUCT_TYPE_AP) |
| 2387 | pBuf += sizeof(tSirMacAddr); |
| 2388 | pDisassocCnf->aid = limGetU16(pBuf); |
| 2389 | #endif |
| 2390 | |
| 2391 | return eSIR_SUCCESS; |
| 2392 | } /*** end limDisassocCnfSerDes() ***/ |
| 2393 | |
| 2394 | |
| 2395 | |
| 2396 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP) |
| 2397 | /** |
| 2398 | * limMeasurementReqSerDes() |
| 2399 | * |
| 2400 | *FUNCTION: |
| 2401 | * This function is called by limProcessLmmMessages() when |
| 2402 | * SME_MEASUREMENT_REQ message is received from upper layer software. |
| 2403 | * |
| 2404 | *PARAMS: |
| 2405 | * |
| 2406 | *LOGIC: |
| 2407 | * |
| 2408 | *ASSUMPTIONS: |
| 2409 | * NA |
| 2410 | * |
| 2411 | *NOTE: |
| 2412 | * NA |
| 2413 | * |
| 2414 | * @param pMeasReq Pointer to tSirSmeMeasurement being |
| 2415 | * extracted into |
| 2416 | * @param pBuf Pointer to serialized buffer |
| 2417 | * @return retCode Indicates whether message is successfully |
| 2418 | * de-serialized (eSIR_SUCCESS) or |
| 2419 | * not (eSIR_FAILURE) |
| 2420 | */ |
| 2421 | |
| 2422 | tSirRetStatus |
| 2423 | limMeasurementReqSerDes(tpAniSirGlobal pMac, tpSirSmeMeasurementReq pMeasReq, tANI_U8 *pBuf) |
| 2424 | { |
| 2425 | tANI_S16 len = 0; |
| 2426 | PELOG3(tANI_U8 *pTemp = pBuf;) |
| 2427 | |
| 2428 | if (!pMeasReq || !pBuf) |
| 2429 | return eSIR_FAILURE; |
| 2430 | |
| 2431 | pMeasReq->messageType = limGetU16(pBuf); |
| 2432 | pBuf += sizeof(tANI_U16); |
| 2433 | |
| 2434 | len = pMeasReq->length = limGetU16(pBuf); |
| 2435 | pBuf += sizeof(tANI_U16); |
| 2436 | |
| 2437 | PELOG3(limLog(pMac, LOG3, FL("SME_MEASUREMENT_REQ length %d bytes is:\n"), len); |
| 2438 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);) |
| 2439 | |
| 2440 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 2441 | return eSIR_FAILURE; |
| 2442 | |
| 2443 | len -= sizeof(tANI_U32); // skip message header |
| 2444 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2445 | return eSIR_FAILURE; |
| 2446 | |
| 2447 | pMeasReq->measControl.periodicMeasEnabled = (tAniBool) |
| 2448 | limGetU32(pBuf); |
| 2449 | |
| 2450 | pBuf += sizeof(tAniBool); |
| 2451 | len -= sizeof(tAniBool); |
| 2452 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2453 | return eSIR_FAILURE; |
| 2454 | |
| 2455 | pMeasReq->measControl.involveSTAs = (tAniBool) |
| 2456 | limGetU32(pBuf); |
| 2457 | pBuf += sizeof(tAniBool); |
| 2458 | len -= sizeof(tAniBool); |
| 2459 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2460 | return eSIR_FAILURE; |
| 2461 | |
| 2462 | pMeasReq->measControl.metricsType = *pBuf++; |
| 2463 | len--; |
| 2464 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2465 | return eSIR_FAILURE; |
| 2466 | |
| 2467 | pMeasReq->measControl.scanType = (tSirScanType) |
| 2468 | limGetU32(pBuf); |
| 2469 | pBuf += sizeof(tSirScanType); |
| 2470 | len -= sizeof(tSirScanType); |
| 2471 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2472 | return eSIR_FAILURE; |
| 2473 | |
| 2474 | pMeasReq->measControl.longChannelScanPeriodicity = *pBuf++; |
| 2475 | len--; |
| 2476 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2477 | return eSIR_FAILURE; |
| 2478 | |
| 2479 | pMeasReq->measControl.cb11hEnabled = (tAniBool)limGetU32(pBuf); |
| 2480 | pBuf += sizeof(tAniBool); |
| 2481 | len -= sizeof(tAniBool); |
| 2482 | |
| 2483 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2484 | return eSIR_FAILURE; |
| 2485 | |
| 2486 | pMeasReq->measDuration.shortTermPeriod = limGetU32(pBuf); |
| 2487 | pBuf += sizeof(tANI_U32); |
| 2488 | |
| 2489 | pMeasReq->measDuration.averagingPeriod = limGetU32(pBuf); |
| 2490 | pBuf += sizeof(tANI_U32); |
| 2491 | |
| 2492 | pMeasReq->measDuration.shortChannelScanDuration = limGetU32(pBuf); |
| 2493 | pBuf += sizeof(tANI_U32); |
| 2494 | |
| 2495 | pMeasReq->measDuration.longChannelScanDuration = limGetU32(pBuf); |
| 2496 | pBuf += sizeof(tANI_U32); |
| 2497 | |
| 2498 | len -= sizeof(tSirMeasDuration); |
| 2499 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2500 | return eSIR_FAILURE; |
| 2501 | |
| 2502 | pMeasReq->measIndPeriod = limGetU32(pBuf); |
| 2503 | |
| 2504 | pBuf += sizeof(tANI_U32); |
| 2505 | len -= sizeof(tANI_U32); |
| 2506 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2507 | return eSIR_FAILURE; |
| 2508 | |
| 2509 | pMeasReq->channelList.numChannels = *pBuf++; |
| 2510 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pMeasReq->channelList.channelNumber, |
| 2511 | pBuf, pMeasReq->channelList.numChannels); |
| 2512 | |
| 2513 | return eSIR_SUCCESS; |
| 2514 | } /*** end limMeasurementReqSerDes() ***/ |
| 2515 | |
| 2516 | |
| 2517 | /** |
| 2518 | * limWdsReqSerDes() |
| 2519 | * |
| 2520 | *FUNCTION: |
| 2521 | * This function is called by limProcessLmmMessages() when |
| 2522 | * SME_SET_WDS_INFO_REQ message is received from upper layer software. |
| 2523 | * |
| 2524 | *PARAMS: |
| 2525 | * |
| 2526 | *LOGIC: |
| 2527 | * |
| 2528 | *ASSUMPTIONS: |
| 2529 | * NA |
| 2530 | * |
| 2531 | *NOTE: |
| 2532 | * NA |
| 2533 | * |
| 2534 | * @param pWdsInfo Pointer to tSirWdsInfo being extracted into |
| 2535 | * @param pBuf Pointer to serialized buffer |
| 2536 | * @return retCode Indicates whether message is successfully |
| 2537 | * de-serialized (eSIR_SUCCESS) or |
| 2538 | * not (eSIR_FAILURE) |
| 2539 | */ |
| 2540 | |
| 2541 | tSirRetStatus |
| 2542 | limWdsReqSerDes(tpAniSirGlobal pMac, tpSirSmeSetWdsInfoReq pWdsInfoReq, tANI_U8 *pBuf) |
| 2543 | { |
| 2544 | tANI_S16 len = 0; |
| 2545 | PELOG1(tANI_U8 *pTemp = pBuf;) |
| 2546 | |
| 2547 | if (!pWdsInfoReq || !pBuf) |
| 2548 | return eSIR_FAILURE; |
| 2549 | |
| 2550 | // Extract messageType |
| 2551 | pWdsInfoReq->messageType = limGetU16(pBuf); |
| 2552 | pBuf += sizeof(tANI_U16); |
| 2553 | |
| 2554 | // Extract length |
| 2555 | len = pWdsInfoReq->length = limGetU16(pBuf); |
| 2556 | pBuf += sizeof(tANI_U16); |
| 2557 | |
| 2558 | PELOG1(limLog(pMac, LOG1, FL("SME_SET_WDS_INFO_REQ length %d bytes is:\n"), len);) |
| 2559 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);) |
| 2560 | |
| 2561 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 2562 | return eSIR_FAILURE; |
| 2563 | |
| 2564 | len -= sizeof(tANI_U32); // skip message header |
| 2565 | |
| 2566 | // Extract transactionId |
| 2567 | pWdsInfoReq->transactionId = limGetU16(pBuf); |
| 2568 | pBuf += sizeof(tANI_U16); |
| 2569 | len -= sizeof(tANI_U16); |
| 2570 | |
| 2571 | // Extract wdsInfo |
| 2572 | pWdsInfoReq->wdsInfo.wdsLength = limGetU16(pBuf); |
| 2573 | len -= sizeof(tANI_U16); |
| 2574 | pBuf += sizeof(tANI_U16); |
| 2575 | |
| 2576 | if (pWdsInfoReq->wdsInfo.wdsLength > ANI_WDS_INFO_MAX_LENGTH) |
| 2577 | return eSIR_FAILURE; |
| 2578 | |
| 2579 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2580 | return eSIR_FAILURE; |
| 2581 | |
| 2582 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pWdsInfoReq->wdsInfo.wdsBytes, |
| 2583 | pBuf, |
| 2584 | pWdsInfoReq->wdsInfo.wdsLength); |
| 2585 | |
| 2586 | return eSIR_SUCCESS; |
| 2587 | |
| 2588 | } /*** end limWdsReqSerDes() ***/ |
| 2589 | |
| 2590 | |
| 2591 | /** |
| 2592 | * limMeasurementIndSerDes() |
| 2593 | * |
| 2594 | *FUNCTION: |
| 2595 | * This function is called by limSendMeasurementInd() while |
| 2596 | * sending SME_MEASUREMENT_IND message to WSM. |
| 2597 | * |
| 2598 | *LOGIC: |
| 2599 | * |
| 2600 | *ASSUMPTIONS: |
| 2601 | * |
| 2602 | *NOTE: |
| 2603 | * |
| 2604 | * @param pMac - Pointer to Global MAC structure |
| 2605 | * @param pMeasInd - Pointer to prepared MEASUREMENT_IND message |
| 2606 | * @return None |
| 2607 | */ |
| 2608 | |
| 2609 | void |
| 2610 | limMeasurementIndSerDes(tpAniSirGlobal pMac, tANI_U8 *pBuf) |
| 2611 | { |
| 2612 | tANI_U8 *pLen; |
| 2613 | tANI_U16 len = 0, infoLen = 0; |
| 2614 | tSirLoad load; |
| 2615 | PELOG3(tANI_U8 *pTemp = pBuf;) |
| 2616 | |
| 2617 | limCopyU16(pBuf, eWNI_SME_MEASUREMENT_IND); |
| 2618 | pBuf += sizeof(tANI_U16); |
| 2619 | |
| 2620 | pLen = pBuf; |
| 2621 | pBuf += sizeof(tANI_U16); |
| 2622 | |
| 2623 | limCopyU32(pBuf, pMac->lim.gpLimMeasData->duration); |
| 2624 | pBuf += sizeof(tANI_U32); |
| 2625 | len += sizeof(tANI_U32); |
| 2626 | |
| 2627 | load.numStas = pMac->lim.gLimNumOfCurrentSTAs; |
| 2628 | load.channelUtilization = |
| 2629 | pMac->lim.gpLimMeasData->avgChannelUtilization; |
| 2630 | limCopyLoad(pBuf, load); |
| 2631 | pBuf += sizeof(tSirLoad); |
| 2632 | len += sizeof(tSirLoad); |
| 2633 | |
| 2634 | infoLen = limCopyMeasMatrixList(pMac, pBuf); |
| 2635 | pBuf += infoLen; |
| 2636 | len += infoLen; |
| 2637 | |
| 2638 | infoLen = limCopyNeighborWdsList(pMac, pBuf); |
| 2639 | pBuf += infoLen; |
| 2640 | len += infoLen; |
| 2641 | |
| 2642 | limCopyU16(pLen, len+4); |
| 2643 | |
| 2644 | PELOG3(limLog(pMac, LOG3, FL("Sending MEAS_IND length %d bytes:\n"), len); |
| 2645 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);) |
| 2646 | } /*** end limMeasurementIndSerDes() ***/ |
| 2647 | #endif |
| 2648 | |
| 2649 | |
| 2650 | /**--------------------------------------------------------------- |
| 2651 | \fn limReassocIndSerDes |
| 2652 | \brief This function is called by limProcessMlmReassocInd() to |
| 2653 | \ populate the SME_REASSOC_IND message based on the received |
| 2654 | \ MLM_REASSOC_IND. |
| 2655 | \ |
| 2656 | \param pMac |
| 2657 | \param pReassocInd - Pointer to the received tLimMlmReassocInd |
| 2658 | \param pBuf - Pointer to serialized buffer |
| 2659 | \param psessionEntry - pointer to PE session entry |
| 2660 | \ |
| 2661 | \return None |
| 2662 | ------------------------------------------------------------------*/ |
| 2663 | void |
| 2664 | limReassocIndSerDes(tpAniSirGlobal pMac, tpLimMlmReassocInd pReassocInd, tANI_U8 *pBuf, tpPESession psessionEntry) |
| 2665 | { |
| 2666 | tANI_U8 *pLen = pBuf; |
| 2667 | tANI_U16 mLen = 0; |
| 2668 | |
| 2669 | #ifdef PE_DEBUG_LOG1 |
| 2670 | tANI_U8 *pTemp = pBuf; |
| 2671 | #endif |
| 2672 | |
| 2673 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) |
| 2674 | tANI_U32 len = 0; |
| 2675 | #endif |
| 2676 | |
| 2677 | mLen = sizeof(tANI_U32); |
| 2678 | pBuf += sizeof(tANI_U16); |
| 2679 | *pBuf++ = psessionEntry->smeSessionId; |
| 2680 | mLen += sizeof(tANI_U8); |
| 2681 | |
| 2682 | // Fill in peerMacAddr |
| 2683 | palCopyMemory( pMac->hHdd, pBuf, pReassocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 2684 | pBuf += sizeof(tSirMacAddr); |
| 2685 | mLen += sizeof(tSirMacAddr); |
| 2686 | |
| 2687 | // Fill in oldMacAddr |
| 2688 | palCopyMemory( pMac->hHdd, pBuf, pReassocInd->currentApAddr, sizeof(tSirMacAddr)); |
| 2689 | pBuf += sizeof(tSirMacAddr); |
| 2690 | mLen += sizeof(tSirMacAddr); |
| 2691 | |
| 2692 | // Fill in aid |
| 2693 | limCopyU16(pBuf, pReassocInd->aid); |
| 2694 | pBuf += sizeof(tANI_U16); |
| 2695 | mLen += sizeof(tANI_U16); |
| 2696 | |
| 2697 | // Fill in bssId |
| 2698 | palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr)); |
| 2699 | pBuf += sizeof(tSirMacAddr); |
| 2700 | mLen += sizeof(tSirMacAddr); |
| 2701 | |
| 2702 | // Fill in staId |
| 2703 | limCopyU16(pBuf, psessionEntry->staId); |
| 2704 | pBuf += sizeof(tANI_U16); |
| 2705 | mLen += sizeof(tANI_U16); |
| 2706 | |
| 2707 | // Fill in authType |
| 2708 | limCopyU32(pBuf, pReassocInd->authType); |
| 2709 | pBuf += sizeof(tAniAuthType); |
| 2710 | mLen += sizeof(tAniAuthType); |
| 2711 | |
| 2712 | // Fill in ssId |
| 2713 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pReassocInd->ssId), |
| 2714 | pReassocInd->ssId.length + 1); |
| 2715 | pBuf += 1 + pReassocInd->ssId.length; |
| 2716 | mLen += pReassocInd->ssId.length + 1; |
| 2717 | |
| 2718 | // Fill in rsnIE |
| 2719 | limCopyU16(pBuf, pReassocInd->rsnIE.length); |
| 2720 | pBuf += sizeof(tANI_U16); |
| 2721 | mLen += sizeof(tANI_U16); |
| 2722 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pReassocInd->rsnIE.rsnIEdata), |
| 2723 | pReassocInd->rsnIE.length); |
| 2724 | pBuf += pReassocInd->rsnIE.length; |
| 2725 | mLen += pReassocInd->rsnIE.length; |
| 2726 | |
| 2727 | // Fill in addIE |
| 2728 | limCopyU16(pBuf, pReassocInd->addIE.length); |
| 2729 | pBuf += sizeof(tANI_U16); |
| 2730 | mLen += sizeof(tANI_U16); |
| 2731 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8*) &(pReassocInd->addIE.addIEdata), |
| 2732 | pReassocInd->addIE.length); |
| 2733 | pBuf += pReassocInd->addIE.length; |
| 2734 | mLen += pReassocInd->addIE.length; |
| 2735 | |
| 2736 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) |
| 2737 | |
| 2738 | limCopyU16(pBuf, pReassocInd->seqNum); |
| 2739 | pBuf += sizeof(tANI_U16); |
| 2740 | mLen += sizeof(tANI_U16); |
| 2741 | |
| 2742 | limCopyU32(pBuf, pReassocInd->wniIndicator); |
| 2743 | pBuf += sizeof(tAniBool); |
| 2744 | mLen += sizeof(tAniBool); |
| 2745 | |
| 2746 | limCopyU32(pBuf, pReassocInd->bpIndicator); |
| 2747 | pBuf += sizeof(tAniBool); |
| 2748 | mLen += sizeof(tAniBool); |
| 2749 | |
| 2750 | limCopyU32(pBuf, pReassocInd->bpType); |
| 2751 | pBuf += sizeof(tSirBpIndicatorType); |
| 2752 | mLen += sizeof(tSirBpIndicatorType); |
| 2753 | |
| 2754 | limCopyU32(pBuf, pReassocInd->reassocType); |
| 2755 | pBuf += sizeof(tSirAssocType); |
| 2756 | mLen += sizeof(tSirAssocType); |
| 2757 | |
| 2758 | limCopyLoad(pBuf, pReassocInd->load); |
| 2759 | pBuf += sizeof(tSirLoad); |
| 2760 | mLen += sizeof(tSirLoad); |
| 2761 | |
| 2762 | limCopyU32(pBuf, pReassocInd->numBss); |
| 2763 | pBuf += sizeof(tANI_U32); |
| 2764 | mLen += sizeof(tANI_U32); |
| 2765 | |
| 2766 | if (pReassocInd->numBss) |
| 2767 | { |
| 2768 | len = limCopyNeighborList(pMac, |
| 2769 | pBuf, |
| 2770 | pReassocInd->neighborList, pReassocInd->numBss); |
| 2771 | pBuf += len; |
| 2772 | mLen += (tANI_U16) len; |
| 2773 | } |
| 2774 | |
| 2775 | // place holder to capability and nwType |
| 2776 | limCopyU16(pBuf, *(tANI_U16 *)&pReassocInd->capabilityInfo); |
| 2777 | pBuf += sizeof(tANI_U16); // capabilityInfo |
| 2778 | mLen += sizeof(tANI_U16); |
| 2779 | |
| 2780 | limCopyU32(pBuf, *(tANI_U32 *)&pReassocInd->nwType); |
| 2781 | pBuf += sizeof(tANI_U32); // nwType |
| 2782 | mLen += sizeof(tANI_U32); |
| 2783 | #endif |
| 2784 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2785 | limCopyU32(pBuf, pReassocInd->spectrumMgtIndicator); |
| 2786 | pBuf += sizeof(tAniBool); |
| 2787 | mLen += sizeof(tAniBool); |
| 2788 | |
| 2789 | if (pReassocInd->spectrumMgtIndicator == eSIR_TRUE) |
| 2790 | { |
| 2791 | *pBuf = pReassocInd->powerCap.minTxPower; |
| 2792 | pBuf++; |
| 2793 | *pBuf = pReassocInd->powerCap.maxTxPower; |
| 2794 | pBuf++; |
| 2795 | mLen += sizeof(tSirMacPowerCapInfo); |
| 2796 | |
| 2797 | *pBuf = pReassocInd->supportedChannels.numChnl; |
| 2798 | pBuf++; |
| 2799 | mLen++; |
| 2800 | |
| 2801 | palCopyMemory( pMac->hHdd, pBuf, |
| 2802 | (tANI_U8 *) &(pReassocInd->supportedChannels.channelList), |
| 2803 | pReassocInd->supportedChannels.numChnl); |
| 2804 | |
| 2805 | pBuf += pReassocInd->supportedChannels.numChnl; |
| 2806 | mLen += pReassocInd->supportedChannels.numChnl; |
| 2807 | } |
| 2808 | #ifdef WLAN_SOFTAP_FEATURE |
| 2809 | limCopyU32(pBuf, pReassocInd->WmmStaInfoPresent); |
| 2810 | pBuf += sizeof(tANI_U32); |
| 2811 | mLen += sizeof(tANI_U32); |
| 2812 | #endif |
| 2813 | |
| 2814 | // Fill in length of SME_REASSOC_IND message |
| 2815 | limCopyU16(pLen, mLen); |
| 2816 | |
| 2817 | PELOG1(limLog(pMac, LOG1, FL("Sending SME_REASSOC_IND length %d bytes:\n"), mLen);) |
| 2818 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);) |
| 2819 | } /*** end limReassocIndSerDes() ***/ |
| 2820 | |
| 2821 | |
| 2822 | /** |
| 2823 | * limAuthIndSerDes() |
| 2824 | * |
| 2825 | *FUNCTION: |
| 2826 | * This function is called by limProcessMlmAuthInd() while sending |
| 2827 | * SME_AUTH_IND to host |
| 2828 | * |
| 2829 | *PARAMS: |
| 2830 | * |
| 2831 | *LOGIC: |
| 2832 | * |
| 2833 | *ASSUMPTIONS: |
| 2834 | * NA |
| 2835 | * |
| 2836 | *NOTE: |
| 2837 | * NA |
| 2838 | * |
| 2839 | * @param pAuthInd Pointer to tSirSmeAuthInd being sent |
| 2840 | * @param pBuf Pointer to serialized buffer |
| 2841 | * |
| 2842 | * @return None |
| 2843 | */ |
| 2844 | |
| 2845 | void |
| 2846 | limAuthIndSerDes(tpAniSirGlobal pMac, tpLimMlmAuthInd pAuthInd, tANI_U8 *pBuf) |
| 2847 | { |
| 2848 | tANI_U8 *pLen = pBuf; |
| 2849 | tANI_U16 mLen = 0; |
| 2850 | |
| 2851 | #ifdef PE_DEBUG_LOG1 |
| 2852 | tANI_U8 *pTemp = pBuf; |
| 2853 | #endif |
| 2854 | |
| 2855 | mLen = sizeof(tANI_U32); |
| 2856 | pBuf += sizeof(tANI_U16); |
| 2857 | *pBuf++ = pAuthInd->sessionId; |
| 2858 | mLen += sizeof(tANI_U8); |
| 2859 | |
| 2860 | // BTAMP TODO: Fill in bssId |
| 2861 | palZeroMemory(pMac->hHdd, pBuf, sizeof(tSirMacAddr)); |
| 2862 | pBuf += sizeof(tSirMacAddr); |
| 2863 | mLen += sizeof(tSirMacAddr); |
| 2864 | |
| 2865 | palCopyMemory( pMac->hHdd, pBuf, pAuthInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 2866 | pBuf += sizeof(tSirMacAddr); |
| 2867 | mLen += sizeof(tSirMacAddr); |
| 2868 | |
| 2869 | limCopyU32(pBuf, pAuthInd->authType); |
| 2870 | pBuf += sizeof(tAniAuthType); |
| 2871 | mLen += sizeof(tAniAuthType); |
| 2872 | |
| 2873 | limCopyU16(pLen, mLen); |
| 2874 | |
| 2875 | PELOG1(limLog(pMac, LOG1, FL("Sending SME_AUTH_IND length %d bytes:\n"), mLen);) |
| 2876 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);) |
| 2877 | } /*** end limAuthIndSerDes() ***/ |
| 2878 | |
| 2879 | |
| 2880 | |
| 2881 | /** |
| 2882 | * limSetContextReqSerDes() |
| 2883 | * |
| 2884 | *FUNCTION: |
| 2885 | * This function is called by limProcessSmeMessages() upon receiving |
| 2886 | * SME_SETCONTEXT_REQ from host |
| 2887 | * |
| 2888 | *PARAMS: |
| 2889 | * |
| 2890 | *LOGIC: |
| 2891 | * |
| 2892 | *ASSUMPTIONS: |
| 2893 | * NA |
| 2894 | * |
| 2895 | *NOTE: |
| 2896 | * NA |
| 2897 | * |
| 2898 | * @param pSetContextReq Pointer to tSirSmeSetContextReq being |
| 2899 | * extracted |
| 2900 | * @param pBuf Pointer to serialized buffer |
| 2901 | * |
| 2902 | * @return retCode Indicates whether message is successfully |
| 2903 | * de-serialized (eSIR_SUCCESS) or |
| 2904 | * not (eSIR_FAILURE) |
| 2905 | */ |
| 2906 | |
| 2907 | tSirRetStatus |
| 2908 | limSetContextReqSerDes(tpAniSirGlobal pMac, tpSirSmeSetContextReq pSetContextReq, tANI_U8 *pBuf) |
| 2909 | { |
| 2910 | tANI_S16 len = 0; |
| 2911 | tANI_U16 totalKeySize = sizeof(tANI_U8); // initialized to sizeof numKeys |
| 2912 | tANI_U8 numKeys; |
| 2913 | tANI_U8 *pKeys; |
| 2914 | |
| 2915 | #ifdef PE_DEBUG_LOG1 |
| 2916 | tANI_U8 *pTemp = pBuf; |
| 2917 | #endif |
| 2918 | if (!pSetContextReq || !pBuf) |
| 2919 | return eSIR_FAILURE; |
| 2920 | |
| 2921 | pSetContextReq->messageType = limGetU16(pBuf); |
| 2922 | pBuf += sizeof(tANI_U16); |
| 2923 | |
| 2924 | len = pSetContextReq->length = limGetU16(pBuf); |
| 2925 | pBuf += sizeof(tANI_U16); |
| 2926 | |
| 2927 | PELOG1(limLog(pMac, LOG1, FL("SME_SETCONTEXT_REQ length %d bytes is:\n"), len);) |
| 2928 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);) |
| 2929 | |
| 2930 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 2931 | return eSIR_FAILURE; |
| 2932 | |
| 2933 | len -= sizeof(tANI_U32); // skip message header |
| 2934 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2935 | return eSIR_FAILURE; |
| 2936 | |
| 2937 | // Extract sessionId |
| 2938 | pSetContextReq->sessionId = *pBuf++; |
| 2939 | len--; |
| 2940 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2941 | return eSIR_FAILURE; |
| 2942 | |
| 2943 | // Extract transactionId |
| 2944 | pSetContextReq->transactionId = sirReadU16N(pBuf); |
| 2945 | pBuf += sizeof(tANI_U16); |
| 2946 | len -= sizeof(tANI_U16); |
| 2947 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2948 | return eSIR_FAILURE; |
| 2949 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pSetContextReq->peerMacAddr, |
| 2950 | pBuf, sizeof(tSirMacAddr)); |
| 2951 | pBuf += sizeof(tSirMacAddr); |
| 2952 | len -= sizeof(tSirMacAddr); |
| 2953 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2954 | return eSIR_FAILURE; |
| 2955 | palCopyMemory( pMac->hHdd, pSetContextReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 2956 | pBuf += sizeof(tSirMacAddr); |
| 2957 | len -= sizeof(tSirMacAddr); |
| 2958 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2959 | return eSIR_FAILURE; |
| 2960 | |
| 2961 | #if defined(ANI_PRODUCT_TYPE_AP) |
| 2962 | pSetContextReq->aid = limGetU16(pBuf); |
| 2963 | pBuf += sizeof(tANI_U16); |
| 2964 | len -= sizeof(tANI_U16); |
| 2965 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2966 | return eSIR_FAILURE; |
| 2967 | #endif |
| 2968 | |
| 2969 | // pSetContextReq->qosInfoPresent = limGetU32(pBuf); |
| 2970 | // pBuf += sizeof(tAniBool); |
| 2971 | |
| 2972 | // if (pSetContextReq->qosInfoPresent) |
| 2973 | // { |
| 2974 | // len = limGetQosInfo(&pSetContextReq->qos, pBuf); |
| 2975 | // pBuf += len; |
| 2976 | // } |
| 2977 | |
| 2978 | pSetContextReq->keyMaterial.length = limGetU16(pBuf); |
| 2979 | pBuf += sizeof(tANI_U16); |
| 2980 | len -= sizeof(tANI_U16); |
| 2981 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2982 | return eSIR_FAILURE; |
| 2983 | |
| 2984 | pSetContextReq->keyMaterial.edType = (tAniEdType) limGetU32(pBuf); |
| 2985 | pBuf += sizeof(tAniEdType); |
| 2986 | len -= sizeof(tAniEdType); |
| 2987 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2988 | return eSIR_FAILURE; |
| 2989 | |
| 2990 | numKeys = pSetContextReq->keyMaterial.numKeys = *pBuf++; |
| 2991 | len -= sizeof(numKeys); |
| 2992 | |
| 2993 | if (numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS) |
| 2994 | return eSIR_FAILURE; |
| 2995 | |
| 2996 | /** Initialize the Default Keys if no Keys are being sent from the upper layer*/ |
| 2997 | if( limCheckRemainingLength(pMac, len) == eSIR_FAILURE) { |
| 2998 | tpSirKeys pKeyinfo = pSetContextReq->keyMaterial.key; |
| 2999 | |
| 3000 | pKeyinfo->keyId = 0; |
| 3001 | pKeyinfo->keyDirection = eSIR_TX_RX; |
| 3002 | pKeyinfo->keyLength = 0; |
| 3003 | |
| 3004 | if (!limIsAddrBC(pSetContextReq->peerMacAddr)) |
| 3005 | pKeyinfo->unicast = 1; |
| 3006 | else |
| 3007 | pKeyinfo->unicast = 0; |
| 3008 | }else { |
| 3009 | pKeys = (tANI_U8 *) pSetContextReq->keyMaterial.key; |
| 3010 | do { |
| 3011 | tANI_U32 keySize = limGetKeysInfo(pMac, (tpSirKeys) pKeys, |
| 3012 | pBuf); |
| 3013 | pBuf += keySize; |
| 3014 | pKeys += sizeof(tSirKeys); |
| 3015 | totalKeySize += (tANI_U16) keySize; |
| 3016 | if (numKeys == 0) |
| 3017 | break; |
| 3018 | numKeys--; |
| 3019 | }while (numKeys); |
| 3020 | } |
| 3021 | return eSIR_SUCCESS; |
| 3022 | } /*** end limSetContextReqSerDes() ***/ |
| 3023 | |
| 3024 | /** |
| 3025 | * limRemoveKeyReqSerDes() |
| 3026 | * |
| 3027 | *FUNCTION: |
| 3028 | * This function is called by limProcessSmeMessages() upon receiving |
| 3029 | * SME_REMOVEKEY_REQ from host |
| 3030 | * |
| 3031 | *PARAMS: |
| 3032 | * |
| 3033 | *LOGIC: |
| 3034 | * |
| 3035 | *ASSUMPTIONS: |
| 3036 | * NA |
| 3037 | * |
| 3038 | *NOTE: |
| 3039 | * NA |
| 3040 | * |
| 3041 | * @param pRemoveKeyReq Pointer to tSirSmeRemoveKeyReq being |
| 3042 | * extracted |
| 3043 | * @param pBuf Pointer to serialized buffer |
| 3044 | * |
| 3045 | * @return retCode Indicates whether message is successfully |
| 3046 | * de-serialized (eSIR_SUCCESS) or |
| 3047 | * not (eSIR_FAILURE) |
| 3048 | */ |
| 3049 | |
| 3050 | tSirRetStatus |
| 3051 | limRemoveKeyReqSerDes(tpAniSirGlobal pMac, tpSirSmeRemoveKeyReq pRemoveKeyReq, tANI_U8 *pBuf) |
| 3052 | { |
| 3053 | tANI_S16 len = 0; |
| 3054 | |
| 3055 | #ifdef PE_DEBUG_LOG1 |
| 3056 | tANI_U8 *pTemp = pBuf; |
| 3057 | #endif |
| 3058 | if (!pRemoveKeyReq || !pBuf) |
| 3059 | return eSIR_FAILURE; |
| 3060 | |
| 3061 | pRemoveKeyReq->messageType = limGetU16(pBuf); |
| 3062 | pBuf += sizeof(tANI_U16); |
| 3063 | |
| 3064 | len = pRemoveKeyReq->length = limGetU16(pBuf); |
| 3065 | pBuf += sizeof(tANI_U16); |
| 3066 | |
| 3067 | PELOG1(limLog(pMac, LOG1, FL("SME_REMOVEKEY_REQ length %d bytes is:\n"), len);) |
| 3068 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);) |
| 3069 | |
| 3070 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 3071 | return eSIR_FAILURE; |
| 3072 | |
| 3073 | len -= sizeof(tANI_U32); // skip message header |
| 3074 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3075 | return eSIR_FAILURE; |
| 3076 | |
| 3077 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pRemoveKeyReq->peerMacAddr, |
| 3078 | pBuf, sizeof(tSirMacAddr)); |
| 3079 | pBuf += sizeof(tSirMacAddr); |
| 3080 | len -= sizeof(tSirMacAddr); |
| 3081 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3082 | return eSIR_FAILURE; |
| 3083 | |
| 3084 | #if defined(ANI_PRODUCT_TYPE_AP) |
| 3085 | pRemoveKeyReq->aid = limGetU16(pBuf); |
| 3086 | pBuf += sizeof(tANI_U16); |
| 3087 | len -= sizeof(tANI_U16); |
| 3088 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3089 | return eSIR_FAILURE; |
| 3090 | #endif |
| 3091 | |
| 3092 | pRemoveKeyReq->edType = *pBuf; |
| 3093 | pBuf += sizeof(tANI_U8); |
| 3094 | len -= sizeof(tANI_U8); |
| 3095 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3096 | return eSIR_FAILURE; |
| 3097 | |
| 3098 | pRemoveKeyReq->wepType = *pBuf; |
| 3099 | |
| 3100 | pBuf += sizeof(tANI_U8); |
| 3101 | len -= sizeof(tANI_U8); |
| 3102 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3103 | return eSIR_FAILURE; |
| 3104 | |
| 3105 | pRemoveKeyReq->keyId = *pBuf; |
| 3106 | |
| 3107 | pBuf += sizeof(tANI_U8); |
| 3108 | len -= sizeof(tANI_U8); |
| 3109 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3110 | return eSIR_FAILURE; |
| 3111 | |
| 3112 | pRemoveKeyReq->unicast = *pBuf; |
| 3113 | len--; |
| 3114 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3115 | return eSIR_FAILURE; |
| 3116 | |
| 3117 | // Extract bssId |
| 3118 | palCopyMemory( pMac->hHdd, pRemoveKeyReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 3119 | pBuf += sizeof(tSirMacAddr); |
| 3120 | len -= sizeof(tSirMacAddr); |
| 3121 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3122 | return eSIR_FAILURE; |
| 3123 | |
| 3124 | // Extract sessionId |
| 3125 | pRemoveKeyReq->sessionId = *pBuf++; |
| 3126 | len--; |
| 3127 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3128 | return eSIR_FAILURE; |
| 3129 | |
| 3130 | // Extract transactionId |
| 3131 | pRemoveKeyReq->transactionId = sirReadU16N(pBuf); |
| 3132 | pBuf += sizeof(tANI_U16); |
| 3133 | len -= sizeof(tANI_U16); |
| 3134 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3135 | return eSIR_FAILURE; |
| 3136 | |
| 3137 | return eSIR_SUCCESS; |
| 3138 | } /*** end limRemoveKeyReqSerDes() ***/ |
| 3139 | |
| 3140 | |
| 3141 | |
| 3142 | /** |
| 3143 | * limDisassocReqSerDes() |
| 3144 | * |
| 3145 | *FUNCTION: |
| 3146 | * This function is called by limProcessSmeMessages() upon receiving |
| 3147 | * SME_DISASSOC_REQ from host |
| 3148 | * |
| 3149 | *PARAMS: |
| 3150 | * |
| 3151 | *LOGIC: |
| 3152 | * |
| 3153 | *ASSUMPTIONS: |
| 3154 | * NA |
| 3155 | * |
| 3156 | *NOTE: |
| 3157 | * NA |
| 3158 | * |
| 3159 | * @param pDisassocReq Pointer to tSirSmeDisassocReq being extracted |
| 3160 | * @param pBuf Pointer to serialized buffer |
| 3161 | * |
| 3162 | * @return retCode Indicates whether message is successfully |
| 3163 | * de-serialized (eSIR_SUCCESS) or |
| 3164 | * not (eSIR_FAILURE) |
| 3165 | */ |
| 3166 | |
| 3167 | tSirRetStatus |
| 3168 | limDisassocReqSerDes(tpAniSirGlobal pMac, tSirSmeDisassocReq *pDisassocReq, tANI_U8 *pBuf) |
| 3169 | { |
| 3170 | tANI_S16 len = 0; |
| 3171 | #ifdef PE_DEBUG_LOG1 |
| 3172 | tANI_U8 *pTemp = pBuf; |
| 3173 | #endif |
| 3174 | |
| 3175 | if (!pDisassocReq || !pBuf) |
| 3176 | return eSIR_FAILURE; |
| 3177 | |
| 3178 | pDisassocReq->messageType = limGetU16(pBuf); |
| 3179 | pBuf += sizeof(tANI_U16); |
| 3180 | |
| 3181 | len = pDisassocReq->length = limGetU16(pBuf); |
| 3182 | pBuf += sizeof(tANI_U16); |
| 3183 | |
| 3184 | PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_REQ length %d bytes is:\n"), len);) |
| 3185 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);) |
| 3186 | |
| 3187 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 3188 | return eSIR_FAILURE; |
| 3189 | |
| 3190 | len -= sizeof(tANI_U32); // skip message header |
| 3191 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3192 | return eSIR_FAILURE; |
| 3193 | |
| 3194 | // Extract sessionID |
| 3195 | pDisassocReq->sessionId = *pBuf; |
| 3196 | pBuf += sizeof(tANI_U8); |
| 3197 | len -= sizeof(tANI_U8); |
| 3198 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3199 | return eSIR_FAILURE; |
| 3200 | |
| 3201 | // Extract transactionid |
| 3202 | pDisassocReq->transactionId = limGetU16(pBuf); |
| 3203 | pBuf += sizeof(tANI_U16); |
| 3204 | len -= sizeof(tANI_U16); |
| 3205 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3206 | return eSIR_FAILURE; |
| 3207 | |
| 3208 | // Extract bssId |
| 3209 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pDisassocReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 3210 | pBuf += sizeof(tSirMacAddr); |
| 3211 | len -= sizeof(tSirMacAddr); |
| 3212 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3213 | return eSIR_FAILURE; |
| 3214 | |
| 3215 | // Extract peerMacAddr |
| 3216 | palCopyMemory( pMac->hHdd, pDisassocReq->peerMacAddr, pBuf, sizeof(tSirMacAddr)); |
| 3217 | pBuf += sizeof(tSirMacAddr); |
| 3218 | len -= sizeof(tSirMacAddr); |
| 3219 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3220 | return eSIR_FAILURE; |
| 3221 | |
| 3222 | // Extract reasonCode |
| 3223 | pDisassocReq->reasonCode = limGetU16(pBuf); |
| 3224 | pBuf += sizeof(tANI_U16); |
| 3225 | len -= sizeof(tANI_U16); |
| 3226 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3227 | return eSIR_FAILURE; |
| 3228 | |
| 3229 | pDisassocReq->doNotSendOverTheAir = *pBuf; |
| 3230 | pBuf += sizeof(tANI_U8); |
| 3231 | len -= sizeof(tANI_U8); |
| 3232 | |
| 3233 | #if defined(ANI_PRODUCT_TYPE_AP) |
| 3234 | pDisassocReq->aid = limGetU16(pBuf); |
| 3235 | pBuf += sizeof(tANI_U16); |
| 3236 | len -= sizeof(tANI_U16); |
| 3237 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3238 | return eSIR_FAILURE; |
| 3239 | |
| 3240 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) |
| 3241 | pDisassocReq->seqNum = limGetU16(pBuf); |
| 3242 | #endif |
| 3243 | #endif |
| 3244 | |
| 3245 | return eSIR_SUCCESS; |
| 3246 | } /*** end limDisassocReqSerDes() ***/ |
| 3247 | |
| 3248 | |
| 3249 | |
| 3250 | /** |
| 3251 | * limDeauthReqSerDes() |
| 3252 | * |
| 3253 | *FUNCTION: |
| 3254 | * This function is called by limProcessSmeMessages() upon receiving |
| 3255 | * SME_DEAUTH_REQ from host |
| 3256 | * |
| 3257 | *PARAMS: |
| 3258 | * |
| 3259 | *LOGIC: |
| 3260 | * |
| 3261 | *ASSUMPTIONS: |
| 3262 | * NA |
| 3263 | * |
| 3264 | *NOTE: |
| 3265 | * NA |
| 3266 | * |
| 3267 | * @param pDeauthReq Pointer to tSirSmeDeauthReq being extracted |
| 3268 | * @param pBuf Pointer to serialized buffer |
| 3269 | * |
| 3270 | * @return retCode Indicates whether message is successfully |
| 3271 | * de-serialized (eSIR_SUCCESS) or |
| 3272 | * not (eSIR_FAILURE) |
| 3273 | */ |
| 3274 | tSirRetStatus |
| 3275 | limDeauthReqSerDes(tpAniSirGlobal pMac, tSirSmeDeauthReq *pDeauthReq, tANI_U8 *pBuf) |
| 3276 | { |
| 3277 | tANI_S16 len = 0; |
| 3278 | |
| 3279 | #ifdef PE_DEBUG_LOG1 |
| 3280 | tANI_U8 *pTemp = pBuf; |
| 3281 | #endif |
| 3282 | |
| 3283 | if (!pDeauthReq || !pBuf) |
| 3284 | return eSIR_FAILURE; |
| 3285 | |
| 3286 | pDeauthReq->messageType = limGetU16(pBuf); |
| 3287 | pBuf += sizeof(tANI_U16); |
| 3288 | |
| 3289 | len = pDeauthReq->length = limGetU16(pBuf); |
| 3290 | pBuf += sizeof(tANI_U16); |
| 3291 | |
| 3292 | PELOG1(limLog(pMac, LOG1, FL("SME_DEAUTH_REQ length %d bytes is:\n"), len);) |
| 3293 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);) |
| 3294 | |
| 3295 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 3296 | return eSIR_FAILURE; |
| 3297 | |
| 3298 | len -= sizeof(tANI_U32); // skip message header |
| 3299 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3300 | return eSIR_FAILURE; |
| 3301 | |
| 3302 | // Extract sessionId |
| 3303 | pDeauthReq->sessionId = *pBuf++; |
| 3304 | len--; |
| 3305 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3306 | return eSIR_FAILURE; |
| 3307 | |
| 3308 | // Extract transactionId |
| 3309 | pDeauthReq->transactionId = limGetU16(pBuf); |
| 3310 | pBuf += sizeof(tANI_U16); |
| 3311 | len -= sizeof(tANI_U16); |
| 3312 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3313 | return eSIR_FAILURE; |
| 3314 | |
| 3315 | // Extract bssId |
| 3316 | palCopyMemory( pMac->hHdd, pDeauthReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 3317 | pBuf += sizeof(tSirMacAddr); |
| 3318 | len -= sizeof(tSirMacAddr); |
| 3319 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3320 | return eSIR_FAILURE; |
| 3321 | |
| 3322 | // Extract peerMacAddr |
| 3323 | palCopyMemory( pMac->hHdd, pDeauthReq->peerMacAddr, pBuf, sizeof(tSirMacAddr)); |
| 3324 | pBuf += sizeof(tSirMacAddr); |
| 3325 | len -= sizeof(tSirMacAddr); |
| 3326 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3327 | return eSIR_FAILURE; |
| 3328 | |
| 3329 | // Extract reasonCode |
| 3330 | pDeauthReq->reasonCode = limGetU16(pBuf); |
| 3331 | pBuf += sizeof(tANI_U16); |
| 3332 | len -= sizeof(tANI_U16); |
| 3333 | |
| 3334 | #if defined(ANI_PRODUCT_TYPE_AP) |
| 3335 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3336 | return eSIR_FAILURE; |
| 3337 | pDeauthReq->aid = limGetU16(pBuf); |
| 3338 | #endif |
| 3339 | |
| 3340 | return eSIR_SUCCESS; |
| 3341 | } /*** end limDisassocReqSerDes() ***/ |
| 3342 | |
| 3343 | |
| 3344 | |
| 3345 | |
| 3346 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP) |
| 3347 | /** |
| 3348 | * limCopyNeighborInfoToCfg() |
| 3349 | * |
| 3350 | *FUNCTION: |
| 3351 | * This function is called by limProcessSmeMessages() upon receiving |
| 3352 | * SME_JOIN_REQ/SME_REASSOC_REQ from WSM to convert neighborBssInfo |
| 3353 | * that is being joined to bssDescription used by MLM |
| 3354 | * |
| 3355 | *PARAMS: |
| 3356 | * |
| 3357 | *LOGIC: |
| 3358 | * |
| 3359 | *ASSUMPTIONS: |
| 3360 | * NA |
| 3361 | * |
| 3362 | *NOTE: |
| 3363 | * NA |
| 3364 | * |
| 3365 | * @param neighborBssInfo Neighbor BSS info to be converted |
| 3366 | * |
| 3367 | * @return None |
| 3368 | */ |
| 3369 | |
| 3370 | void |
| 3371 | limCopyNeighborInfoToCfg(tpAniSirGlobal pMac, tSirNeighborBssInfo neighborBssInfo, tpPESession psessionEntry) |
| 3372 | { |
| 3373 | tANI_U32 localPowerConstraints = 0; |
| 3374 | tANI_U16 caps; |
| 3375 | tANI_U8 qosCap = 0; |
| 3376 | |
| 3377 | if(psessionEntry) |
| 3378 | { |
| 3379 | psessionEntry->gLimPhyMode = neighborBssInfo.nwType; |
| 3380 | } |
| 3381 | else |
| 3382 | { |
| 3383 | pMac->lim.gLimPhyMode = neighborBssInfo.nwType; |
| 3384 | } |
| 3385 | |
| 3386 | cfgSetCapabilityInfo(pMac, neighborBssInfo.capabilityInfo); |
| 3387 | |
| 3388 | if (cfgSetStr(pMac, WNI_CFG_SSID, (tANI_U8 *) &neighborBssInfo.ssId.ssId, |
| 3389 | neighborBssInfo.ssId.length) != eSIR_SUCCESS) |
| 3390 | { |
| 3391 | /// Could not update SSID at CFG. Log error. |
| 3392 | limLog(pMac, LOGP, FL("could not update SSID at CFG\n")); |
| 3393 | } |
| 3394 | |
| 3395 | #if 0 |
| 3396 | if (cfgSetStr( |
| 3397 | pMac, WNI_CFG_OPERATIONAL_RATE_SET, |
| 3398 | (tANI_U8 *) &neighborBssInfo.operationalRateSet.rate, |
| 3399 | neighborBssInfo.operationalRateSet.numRates) != eSIR_SUCCESS) |
| 3400 | { |
| 3401 | /// Could not update Operational Rateset at CFG. Log error. |
| 3402 | limLog(pMac, LOGP, |
| 3403 | FL("could not update Operational Rateset at CFG\n")); |
| 3404 | } |
| 3405 | #endif // TO SUPPORT BT-AMP |
| 3406 | |
| 3407 | if (neighborBssInfo.nwType == WNI_CFG_PHY_MODE_11G) |
| 3408 | { |
| 3409 | if (cfgSetStr( |
| 3410 | pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 3411 | (tANI_U8 *) &neighborBssInfo.extendedRateSet.rate, |
| 3412 | neighborBssInfo.extendedRateSet.numRates) != eSIR_SUCCESS) |
| 3413 | { |
| 3414 | /// Could not update Extended Rateset at CFG. Log error. |
| 3415 | limLog(pMac, LOGP, |
| 3416 | FL("could not update Extended Rateset at CFG\n")); |
| 3417 | } |
| 3418 | } |
| 3419 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) |
| 3420 | if (neighborBssInfo.hcfEnabled) |
| 3421 | LIM_BSS_CAPS_SET(HCF, qosCap); |
| 3422 | #endif |
| 3423 | if (neighborBssInfo.wmeInfoPresent || neighborBssInfo.wmeEdcaPresent) |
| 3424 | LIM_BSS_CAPS_SET(WME, qosCap); |
| 3425 | if (LIM_BSS_CAPS_GET(WME, qosCap) && neighborBssInfo.wsmCapablePresent) |
| 3426 | LIM_BSS_CAPS_SET(WSM, qosCap); |
| 3427 | |
| 3428 | pMac->lim.gLimCurrentBssQosCaps = qosCap; |
| 3429 | |
| 3430 | if (neighborBssInfo.wniIndicator) |
| 3431 | pMac->lim.gLimCurrentBssPropCap = neighborBssInfo.propIECapability; |
| 3432 | else |
| 3433 | pMac->lim.gLimCurrentBssPropCap = 0; |
| 3434 | |
| 3435 | if (neighborBssInfo.HTCapsPresent) |
| 3436 | pMac->lim.htCapabilityPresentInBeacon = 1; |
| 3437 | else |
| 3438 | pMac->lim.htCapabilityPresentInBeacon = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3439 | if (neighborBssInfo.localPowerConstraints && pSessionEntry->lim11hEnable) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3440 | { |
| 3441 | localPowerConstraints = neighborBssInfo.localPowerConstraints; |
| 3442 | } |
| 3443 | if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, localPowerConstraints) != eSIR_SUCCESS) |
| 3444 | { |
| 3445 | limLog(pMac, LOGP, FL("Could not update local power constraint to cfg.\n")); |
| 3446 | } |
| 3447 | } /*** end limCopyNeighborInfoToCfg() ***/ |
| 3448 | #endif |
| 3449 | |
| 3450 | |
| 3451 | /** |
| 3452 | * limStatSerDes() |
| 3453 | * |
| 3454 | *FUNCTION: |
| 3455 | * This function is called by limSendSmeDisassocNtf() while sending |
| 3456 | * SME_DISASSOC_IND/eWNI_SME_DISASSOC_RSP to host |
| 3457 | * |
| 3458 | *PARAMS: |
| 3459 | * |
| 3460 | *LOGIC: |
| 3461 | * |
| 3462 | *ASSUMPTIONS: |
| 3463 | * NA |
| 3464 | * |
| 3465 | *NOTE: |
| 3466 | * NA |
| 3467 | * |
| 3468 | * @param pAssocInd Pointer to tpAniStaStatStruct being sent |
| 3469 | * @param pBuf Pointer to serialized buffer |
| 3470 | * |
| 3471 | * @return None |
| 3472 | */ |
| 3473 | |
| 3474 | void |
| 3475 | limStatSerDes(tpAniSirGlobal pMac, tpAniStaStatStruct pStat, tANI_U8 *pBuf) |
| 3476 | { |
| 3477 | #ifdef PE_DEBUG_LOG1 |
| 3478 | tANI_U8 *pTemp = pBuf; |
| 3479 | #endif |
| 3480 | |
| 3481 | limCopyU32(pBuf, pStat->sentAesBlksUcastHi); |
| 3482 | pBuf += sizeof(tANI_U32); |
| 3483 | |
| 3484 | limCopyU32(pBuf, pStat->sentAesBlksUcastLo); |
| 3485 | pBuf += sizeof(tANI_U32); |
| 3486 | |
| 3487 | limCopyU32(pBuf, pStat->recvAesBlksUcastHi); |
| 3488 | pBuf += sizeof(tANI_U32); |
| 3489 | |
| 3490 | limCopyU32(pBuf, pStat->recvAesBlksUcastLo); |
| 3491 | pBuf += sizeof(tANI_U32); |
| 3492 | |
| 3493 | limCopyU32(pBuf, pStat->aesFormatErrorUcastCnts); |
| 3494 | pBuf += sizeof(tANI_U32); |
| 3495 | |
| 3496 | limCopyU32(pBuf, pStat->aesReplaysUcast); |
| 3497 | pBuf += sizeof(tANI_U32); |
| 3498 | |
| 3499 | limCopyU32(pBuf, pStat->aesDecryptErrUcast); |
| 3500 | pBuf += sizeof(tANI_U32); |
| 3501 | |
| 3502 | limCopyU32(pBuf, pStat->singleRetryPkts); |
| 3503 | pBuf += sizeof(tANI_U32); |
| 3504 | |
| 3505 | limCopyU32(pBuf, pStat->failedTxPkts); |
| 3506 | pBuf += sizeof(tANI_U32); |
| 3507 | |
| 3508 | limCopyU32(pBuf, pStat->ackTimeouts); |
| 3509 | pBuf += sizeof(tANI_U32); |
| 3510 | |
| 3511 | limCopyU32(pBuf, pStat->multiRetryPkts); |
| 3512 | pBuf += sizeof(tANI_U32); |
| 3513 | |
| 3514 | limCopyU32(pBuf, pStat->fragTxCntsHi); |
| 3515 | pBuf += sizeof(tANI_U32); |
| 3516 | |
| 3517 | limCopyU32(pBuf, pStat->fragTxCntsLo); |
| 3518 | pBuf += sizeof(tANI_U32); |
| 3519 | |
| 3520 | limCopyU32(pBuf, pStat->transmittedPktsHi); |
| 3521 | pBuf += sizeof(tANI_U32); |
| 3522 | |
| 3523 | limCopyU32(pBuf, pStat->transmittedPktsLo); |
| 3524 | pBuf += sizeof(tANI_U32); |
| 3525 | |
| 3526 | limCopyU32(pBuf, pStat->phyStatHi); |
| 3527 | pBuf += sizeof(tANI_U32); |
| 3528 | |
| 3529 | limCopyU32(pBuf, pStat->phyStatLo); |
| 3530 | pBuf += sizeof(tANI_U32); |
| 3531 | |
| 3532 | limCopyU32(pBuf, pStat->uplinkRssi); |
| 3533 | pBuf += sizeof(tANI_U32); |
| 3534 | |
| 3535 | limCopyU32(pBuf, pStat->uplinkSinr); |
| 3536 | pBuf += sizeof(tANI_U32); |
| 3537 | |
| 3538 | limCopyU32(pBuf, pStat->uplinkRate); |
| 3539 | pBuf += sizeof(tANI_U32); |
| 3540 | |
| 3541 | limCopyU32(pBuf, pStat->downlinkRssi); |
| 3542 | pBuf += sizeof(tANI_U32); |
| 3543 | |
| 3544 | limCopyU32(pBuf, pStat->downlinkSinr); |
| 3545 | pBuf += sizeof(tANI_U32); |
| 3546 | |
| 3547 | limCopyU32(pBuf, pStat->downlinkRate); |
| 3548 | pBuf += sizeof(tANI_U32); |
| 3549 | |
| 3550 | limCopyU32(pBuf, pStat->nRcvBytes); |
| 3551 | pBuf += sizeof(tANI_U32); |
| 3552 | |
| 3553 | limCopyU32(pBuf, pStat->nXmitBytes); |
| 3554 | pBuf += sizeof(tANI_U32); |
| 3555 | |
| 3556 | PELOG1(limLog(pMac, LOG1, FL("STAT: length %d bytes is:\n"), sizeof(tAniStaStatStruct));) |
| 3557 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, sizeof(tAniStaStatStruct));) |
| 3558 | |
| 3559 | } /*** end limStatSerDes() ***/ |
| 3560 | |
| 3561 | |
| 3562 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP) |
| 3563 | /** |
| 3564 | * limSmeWmStatusChangeNtfSerDes() |
| 3565 | * |
| 3566 | *FUNCTION: |
| 3567 | * This function is called by limSendSmeWmStatusChangeNtf() |
| 3568 | * to serialize the header fields of SME WM Status Change |
| 3569 | * Notification |
| 3570 | * |
| 3571 | *LOGIC: |
| 3572 | * |
| 3573 | *ASSUMPTIONS: |
| 3574 | * NA |
| 3575 | * |
| 3576 | *NOTE: |
| 3577 | * NA |
| 3578 | * |
| 3579 | * @param statusChangeCode Status Change code |
| 3580 | * @param pBuf Pointer to serialized buffer |
| 3581 | * @param len Pointer to length actually used |
| 3582 | * @param buflen Buffer length remaining |
| 3583 | * @return retCode Indicates whether message is successfully |
| 3584 | * serialized (eSIR_SUCCESS) or not (eSIR_FAILURE) |
| 3585 | */ |
| 3586 | |
| 3587 | tSirRetStatus |
| 3588 | limSmeWmStatusChangeHeaderSerDes(tpAniSirGlobal pMac, |
| 3589 | tSirSmeStatusChangeCode statusChangeCode, |
| 3590 | tANI_U8 *pBuf, |
| 3591 | tANI_U16 *len, |
| 3592 | tANI_U32 buflen, |
| 3593 | tANI_U8 sessionId) |
| 3594 | { |
| 3595 | if (buflen < ((sizeof(tANI_U16) * 2) + sizeof(tANI_U32))) |
| 3596 | { |
| 3597 | limLog(pMac, LOGE, |
| 3598 | FL("limSmeWmStatusChangeHeaderSerDes: no enough space (buf %d) \n"), buflen); |
| 3599 | return eSIR_FAILURE; |
| 3600 | } |
| 3601 | |
| 3602 | *len = 0; |
| 3603 | |
| 3604 | limCopyU16(pBuf, eWNI_SME_WM_STATUS_CHANGE_NTF); |
| 3605 | pBuf += sizeof(tANI_U16); |
| 3606 | *len += sizeof(tANI_U16); |
| 3607 | |
| 3608 | // Actual length value shall be filled later |
| 3609 | pBuf += sizeof(tANI_U16); |
| 3610 | *len += sizeof(tANI_U16); |
| 3611 | |
| 3612 | *pBuf++ = sessionId; |
| 3613 | *len += sizeof(tANI_U8); |
| 3614 | |
| 3615 | limCopyU32(pBuf, statusChangeCode); |
| 3616 | pBuf += sizeof(tANI_U32); |
| 3617 | *len += sizeof(tANI_U32); |
| 3618 | |
| 3619 | return eSIR_SUCCESS; |
| 3620 | } /*** end limSmeWmStatusChangeHeaderSerDes() ***/ |
| 3621 | |
| 3622 | |
| 3623 | |
| 3624 | /** |
| 3625 | * limRadioInfoSerDes() |
| 3626 | * |
| 3627 | *FUNCTION: |
| 3628 | * This function is called by limSendSmeWmStatusChangeNtf() |
| 3629 | * to serialize the radarInfo message |
| 3630 | * |
| 3631 | *LOGIC: |
| 3632 | * |
| 3633 | *ASSUMPTIONS: |
| 3634 | * NA |
| 3635 | * |
| 3636 | *NOTE: |
| 3637 | * NA |
| 3638 | * |
| 3639 | * @param pRadarInfo Pointer to tSirRadarInfo |
| 3640 | * @param pBuf Pointer to serialized buffer |
| 3641 | * @param len Pointer to length actually used by tSirRadarInfo |
| 3642 | * @param buflen Length remaining |
| 3643 | * |
| 3644 | * @return retCode Indicates whether message is successfully |
| 3645 | * serialized (eSIR_SUCCESS) or not (eSIR_FAILURE) |
| 3646 | */ |
| 3647 | |
| 3648 | tSirRetStatus |
| 3649 | limRadioInfoSerDes(tpAniSirGlobal pMac, tpSirRadarInfo pRadarInfo, |
| 3650 | tANI_U8 *pBuf, tANI_U16 *len, tANI_U32 buflen) |
| 3651 | { |
| 3652 | |
| 3653 | if (buflen < sizeof(tSirRadarInfo)) |
| 3654 | { |
| 3655 | limLog(pMac, LOGE, |
| 3656 | FL("no enough space (buf %d) \n"), buflen); |
| 3657 | return eSIR_FAILURE; |
| 3658 | } |
| 3659 | |
| 3660 | *pBuf = pRadarInfo->channelNumber; |
| 3661 | pBuf += sizeof(tANI_U8); |
| 3662 | *len += sizeof(tANI_U8); |
| 3663 | |
| 3664 | limCopyU16(pBuf, pRadarInfo->radarPulseWidth); |
| 3665 | pBuf += sizeof(tANI_U16); |
| 3666 | *len += sizeof(tANI_U16); |
| 3667 | |
| 3668 | limCopyU16(pBuf, pRadarInfo->numRadarPulse); |
| 3669 | pBuf += sizeof(tANI_U16); |
| 3670 | *len += sizeof(tANI_U16); |
| 3671 | |
| 3672 | return eSIR_SUCCESS; |
| 3673 | } /*** end limRadioInfoSerDes() ***/ |
| 3674 | #endif |
| 3675 | |
| 3676 | |
| 3677 | /** |
| 3678 | * limPackBkgndScanFailNotify() |
| 3679 | * |
| 3680 | *FUNCTION: |
| 3681 | * This function is called by limSendSmeWmStatusChangeNtf() |
| 3682 | * to pack the tSirBackgroundScanInfo message |
| 3683 | * |
| 3684 | */ |
| 3685 | void |
| 3686 | limPackBkgndScanFailNotify(tpAniSirGlobal pMac, |
| 3687 | tSirSmeStatusChangeCode statusChangeCode, |
| 3688 | tpSirBackgroundScanInfo pScanInfo, |
| 3689 | tSirSmeWmStatusChangeNtf *pSmeNtf, |
| 3690 | tANI_U8 sessionId) |
| 3691 | { |
| 3692 | |
| 3693 | tANI_U16 length = (sizeof(tANI_U16) * 2) + sizeof(tANI_U8) + |
| 3694 | sizeof(tSirSmeStatusChangeCode) + |
| 3695 | sizeof(tSirBackgroundScanInfo); |
| 3696 | |
| 3697 | #if defined (ANI_PRODUCT_TYPE_AP) && defined(ANI_LITTLE_BYTE_ENDIAN) |
| 3698 | sirStoreU16N((tANI_U8*)&pSmeNtf->messageType, eWNI_SME_WM_STATUS_CHANGE_NTF ); |
| 3699 | sirStoreU16N((tANI_U8*)&pSmeNtf->length, length); |
| 3700 | pSmeNtf->sessionId = sessionId; |
| 3701 | sirStoreU32N((tANI_U8*)&pSmeNtf->statusChangeCode, statusChangeCode); |
| 3702 | |
| 3703 | sirStoreU32N((tANI_U8*)&pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanSuccess, |
| 3704 | pScanInfo->numOfScanSuccess); |
| 3705 | sirStoreU32N((tANI_U8*)&pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanFailure, |
| 3706 | pScanInfo->numOfScanFailure); |
| 3707 | sirStoreU32N((tANI_U8*)&pSmeNtf->statusChangeInfo.bkgndScanInfo.reserved, |
| 3708 | pScanInfo->reserved); |
| 3709 | #else |
| 3710 | pSmeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF; |
| 3711 | pSmeNtf->statusChangeCode = statusChangeCode; |
| 3712 | pSmeNtf->length = length; |
| 3713 | pSmeNtf->sessionId = sessionId; |
| 3714 | pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanSuccess = pScanInfo->numOfScanSuccess; |
| 3715 | pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanFailure = pScanInfo->numOfScanFailure; |
| 3716 | pSmeNtf->statusChangeInfo.bkgndScanInfo.reserved = pScanInfo->reserved; |
| 3717 | #endif |
| 3718 | } |
| 3719 | |
| 3720 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP) |
| 3721 | |
| 3722 | /** |
| 3723 | * nonTitanBssFoundSerDes() |
| 3724 | * |
| 3725 | *FUNCTION: |
| 3726 | * This function is called by limSendSmeWmStatusChangeNtf() |
| 3727 | * to serialize the following message |
| 3728 | * Mesg = eWNI_SME_WM_STATUS_CHANGE_NTF |
| 3729 | * Change code = eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP |
| 3730 | * |
| 3731 | *LOGIC: |
| 3732 | * |
| 3733 | *ASSUMPTIONS: |
| 3734 | * NA |
| 3735 | * |
| 3736 | *NOTE: |
| 3737 | * NA |
| 3738 | * |
| 3739 | * @param pMac Pointer to the global pMAC structure |
| 3740 | * @param pNewBssInfo Pointer to tpSirNeighborBssWdsInfo |
| 3741 | * @param pBuf Send data buffer |
| 3742 | * @param len Length of message |
| 3743 | * @param buflen Length remaining |
| 3744 | * |
| 3745 | * @return retCode Indicates whether message is successfully |
| 3746 | * serialized (eSIR_SUCCESS) or not (eSIR_FAILURE) |
| 3747 | */ |
| 3748 | |
| 3749 | tSirRetStatus nonTitanBssFoundSerDes( tpAniSirGlobal pMac, |
| 3750 | tpSirNeighborBssWdsInfo pNewBssInfo, |
| 3751 | tANI_U8 *pBuf, |
| 3752 | tANI_U16 *len, |
| 3753 | tANI_U8 sessionId ) |
| 3754 | { |
| 3755 | tANI_U8 *pTemp = pBuf; |
| 3756 | tANI_U16 length = 0; |
| 3757 | tANI_U32 bufLen = sizeof( tSirSmeWmStatusChangeNtf ); |
| 3758 | |
| 3759 | // Serialize the header (length to be filled later) |
| 3760 | if( eSIR_SUCCESS != limSmeWmStatusChangeHeaderSerDes( |
| 3761 | pMac, |
| 3762 | eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP, |
| 3763 | pBuf, |
| 3764 | &length, |
| 3765 | bufLen, |
| 3766 | sessionId)) |
| 3767 | { |
| 3768 | limLog( pMac, LOGE, |
| 3769 | FL("Header SerDes failed \n")); |
| 3770 | return eSIR_FAILURE; |
| 3771 | } |
| 3772 | pBuf += length; |
| 3773 | bufLen -= length; |
| 3774 | |
| 3775 | // Serialize tSirNeighborBssWdsInfo |
| 3776 | length = limCopyNeighborWdsInfo( pMac, |
| 3777 | pBuf, |
| 3778 | pNewBssInfo ); |
| 3779 | pBuf += length; |
| 3780 | bufLen -= length; |
| 3781 | |
| 3782 | // Update tSirSmeWmStatusChangeNtf.length |
| 3783 | pBuf = pTemp; |
| 3784 | pBuf += sizeof(tANI_U16); |
| 3785 | limCopyU16(pBuf, length); |
| 3786 | |
| 3787 | // Update the total length to be returned |
| 3788 | *len = length; |
| 3789 | |
| 3790 | return eSIR_SUCCESS; |
| 3791 | } /*** end nonTitanBssFoundSerDes() ***/ |
| 3792 | |
| 3793 | /** |
| 3794 | * limIsSmeSwitchChannelReqValid() |
| 3795 | * |
| 3796 | *FUNCTION: |
| 3797 | * This function is called by limProcessSmeReqMessages() upon |
| 3798 | * receiving SME_SWITCH_CHL_REQ message from application. |
| 3799 | * |
| 3800 | *LOGIC: |
| 3801 | * Message validity checks are performed in this function |
| 3802 | * |
| 3803 | *ASSUMPTIONS: |
| 3804 | * |
| 3805 | *NOTE: |
| 3806 | * |
| 3807 | * @param pBuf - Pointer to a serialized SME_SWITCH_CHL_REQ message |
| 3808 | * @param pSmeMsg - Pointer to a tSirsmeSwitchChannelReq structure |
| 3809 | * @return true if SME_SWITCH_CHL_REQ message is formatted correctly |
| 3810 | * false otherwise |
| 3811 | */ |
| 3812 | |
| 3813 | tANI_BOOLEAN |
| 3814 | limIsSmeSwitchChannelReqValid(tpAniSirGlobal pMac, |
| 3815 | tANI_U8 *pBuf, |
| 3816 | tpSirSmeSwitchChannelReq pSmeMsg) |
| 3817 | { |
| 3818 | pSmeMsg->messageType = limGetU16(pBuf); |
| 3819 | pBuf += sizeof(tANI_U16); |
| 3820 | |
| 3821 | pSmeMsg->length = limGetU16(pBuf); |
| 3822 | pBuf += sizeof(tANI_U16); |
| 3823 | |
| 3824 | pSmeMsg->transactionId = limGetU16(pBuf); |
| 3825 | pBuf += sizeof(tANI_U16); |
| 3826 | |
| 3827 | pSmeMsg->channelId = *pBuf; |
| 3828 | pBuf++; |
| 3829 | |
| 3830 | pSmeMsg->cbMode = limGetU32(pBuf); |
| 3831 | pBuf += sizeof(tANI_U32); |
| 3832 | |
| 3833 | pSmeMsg->dtimFactor = limGetU32(pBuf); |
| 3834 | pBuf += sizeof(tANI_U32); |
| 3835 | |
| 3836 | if (pSmeMsg->length != SIR_SME_CHANNEL_SWITCH_SIZE) |
| 3837 | { |
| 3838 | PELOGE(limLog(pMac, LOGE, FL("Invalid length %d \n"), pSmeMsg->length);) |
| 3839 | return eANI_BOOLEAN_FALSE; |
| 3840 | } |
| 3841 | |
| 3842 | // dtimFactor should not be too large |
| 3843 | if (pSmeMsg->dtimFactor > SIR_MAX_DTIM_FACTOR) |
| 3844 | { |
| 3845 | PELOGE(limLog(pMac, LOGE, FL("Invalid dtimFactor %d \n"), pSmeMsg->dtimFactor);) |
| 3846 | return eANI_BOOLEAN_FALSE; |
| 3847 | } |
| 3848 | |
| 3849 | return eANI_BOOLEAN_TRUE; |
| 3850 | } |
| 3851 | |
| 3852 | #endif |
| 3853 | |
| 3854 | #ifdef WLAN_SOFTAP_FEATURE |
| 3855 | /** |
| 3856 | * limIsSmeGetAssocSTAsReqValid() |
| 3857 | * |
| 3858 | *FUNCTION: |
| 3859 | * This function is called by limProcessSmeReqMessages() upon |
| 3860 | * receiving SME_GET_ASSOC_STAS_REQ message from application. |
| 3861 | * |
| 3862 | *LOGIC: |
| 3863 | * Message validity checks are performed in this function |
| 3864 | * |
| 3865 | *ASSUMPTIONS: |
| 3866 | * |
| 3867 | *NOTE: |
| 3868 | * |
| 3869 | * @param pBuf - Pointer to a serialized SME_GET_ASSOC_STAS_REQ message |
| 3870 | * @param pSmeMsg - Pointer to a tSirSmeGetAssocSTAsReq structure |
| 3871 | * @return true if SME_GET_ASSOC_STAS_REQ message is formatted correctly |
| 3872 | * false otherwise |
| 3873 | */ |
| 3874 | tANI_BOOLEAN |
| 3875 | limIsSmeGetAssocSTAsReqValid(tpAniSirGlobal pMac, tpSirSmeGetAssocSTAsReq pGetAssocSTAsReq, tANI_U8 *pBuf) |
| 3876 | { |
| 3877 | tANI_S16 len = 0; |
| 3878 | |
| 3879 | pGetAssocSTAsReq->messageType = limGetU16(pBuf); |
| 3880 | pBuf += sizeof(tANI_U16); |
| 3881 | |
| 3882 | len = pGetAssocSTAsReq->length = limGetU16(pBuf); |
| 3883 | pBuf += sizeof(tANI_U16); |
| 3884 | |
| 3885 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 3886 | return eSIR_FAILURE; |
| 3887 | |
| 3888 | len -= sizeof(tANI_U32); // skip message header |
| 3889 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3890 | return eSIR_FAILURE; |
| 3891 | |
| 3892 | // Extract bssId |
| 3893 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pGetAssocSTAsReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 3894 | pBuf += sizeof(tSirMacAddr); |
| 3895 | len -= sizeof(tSirMacAddr); |
| 3896 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3897 | return eSIR_FAILURE; |
| 3898 | |
| 3899 | // Extract modId |
| 3900 | pGetAssocSTAsReq->modId = limGetU16(pBuf); |
| 3901 | pBuf += sizeof(tANI_U16); |
| 3902 | len -= sizeof(tANI_U16); |
| 3903 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3904 | return eSIR_FAILURE; |
| 3905 | |
| 3906 | // Extract pUsrContext |
| 3907 | pGetAssocSTAsReq->pUsrContext = (void *)limGetU32(pBuf); |
| 3908 | pBuf += sizeof(tANI_U32); |
| 3909 | len -= sizeof(tANI_U32); |
| 3910 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3911 | return eSIR_FAILURE; |
| 3912 | |
| 3913 | // Extract pSapEventCallback |
| 3914 | pGetAssocSTAsReq->pSapEventCallback = (void *)limGetU32(pBuf); |
| 3915 | pBuf += sizeof(tANI_U32); |
| 3916 | len -= sizeof(tANI_U32); |
| 3917 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3918 | return eSIR_FAILURE; |
| 3919 | |
| 3920 | // Extract pAssocStasArray |
| 3921 | pGetAssocSTAsReq->pAssocStasArray = (void *)limGetU32(pBuf); |
| 3922 | pBuf += sizeof(tANI_U32); |
| 3923 | len -= sizeof(tANI_U32); |
| 3924 | |
| 3925 | PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes \n"), len);) |
| 3926 | |
| 3927 | if (len < 0) |
| 3928 | { |
| 3929 | PELOGE(limLog(pMac, LOGE, FL("SME_GET_ASSOC_STAS_REQ invalid length\n"));) |
| 3930 | return eANI_BOOLEAN_FALSE; |
| 3931 | } |
| 3932 | |
| 3933 | return eANI_BOOLEAN_TRUE; |
| 3934 | } |
| 3935 | |
| 3936 | /** |
| 3937 | * limTkipCntrMeasReqSerDes() |
| 3938 | * |
| 3939 | *FUNCTION: |
| 3940 | * This function is called by limProcessSmeMessages() upon receiving |
| 3941 | * eWNI_SME_TKIP_CNTR_MEAS_REQ from host HDD |
| 3942 | * |
| 3943 | *PARAMS: |
| 3944 | * |
| 3945 | *LOGIC: |
| 3946 | * |
| 3947 | *ASSUMPTIONS: |
| 3948 | * NA |
| 3949 | * |
| 3950 | *NOTE: |
| 3951 | * NA |
| 3952 | * |
| 3953 | * @param tpSirSmeTkipCntrMeasReq Pointer to tSirSmeTkipCntrMeasReq being extracted |
| 3954 | * @param pBuf Pointer to serialized buffer |
| 3955 | * @return retCode Indicates whether message is successfully |
| 3956 | * de-serialized (eSIR_SUCCESS) or |
| 3957 | * not (eSIR_FAILURE) |
| 3958 | */ |
| 3959 | tSirRetStatus |
| 3960 | limTkipCntrMeasReqSerDes(tpAniSirGlobal pMac, tpSirSmeTkipCntrMeasReq pTkipCntrMeasReq, tANI_U8 *pBuf) |
| 3961 | { |
| 3962 | tANI_S16 len = 0; |
| 3963 | |
| 3964 | #ifdef PE_DEBUG_LOG1 |
| 3965 | tANI_U8 *pTemp = pBuf; |
| 3966 | #endif |
| 3967 | |
| 3968 | pTkipCntrMeasReq->messageType = limGetU16(pBuf); |
| 3969 | pBuf += sizeof(tANI_U16); |
| 3970 | |
| 3971 | len = pTkipCntrMeasReq->length = limGetU16(pBuf); |
| 3972 | pBuf += sizeof(tANI_U16); |
| 3973 | |
| 3974 | PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length %d bytes is:\n"), len);) |
| 3975 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);) |
| 3976 | |
| 3977 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 3978 | return eSIR_FAILURE; |
| 3979 | |
| 3980 | len -= sizeof(tANI_U32); // skip message header |
| 3981 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3982 | return eSIR_FAILURE; |
| 3983 | |
| 3984 | // Extract sessionId |
| 3985 | pTkipCntrMeasReq->sessionId = *pBuf++; |
| 3986 | len--; |
| 3987 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3988 | return eSIR_FAILURE; |
| 3989 | |
| 3990 | // Extract transactionId |
| 3991 | pTkipCntrMeasReq->transactionId = limGetU16(pBuf); |
| 3992 | pBuf += sizeof(tANI_U16); |
| 3993 | len -= sizeof(tANI_U16); |
| 3994 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 3995 | return eSIR_FAILURE; |
| 3996 | |
| 3997 | // Extract bssId |
| 3998 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pTkipCntrMeasReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 3999 | pBuf += sizeof(tSirMacAddr); |
| 4000 | len -= sizeof(tSirMacAddr); |
| 4001 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 4002 | return eSIR_FAILURE; |
| 4003 | |
| 4004 | // Extract bEnable |
| 4005 | pTkipCntrMeasReq->bEnable = *pBuf++; |
| 4006 | len --; |
| 4007 | |
| 4008 | PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length consumed %d bytes \n"), len);) |
| 4009 | |
| 4010 | if (len) |
| 4011 | { |
| 4012 | PELOGE(limLog(pMac, LOGE, FL("SME_TKIP_CNTR_MEAS_REQ invalid \n"));) |
| 4013 | return eSIR_FAILURE; |
| 4014 | } |
| 4015 | else |
| 4016 | return eSIR_SUCCESS; |
| 4017 | } |
| 4018 | |
| 4019 | /** |
| 4020 | * limIsSmeGetWPSPBCSessionsReqValid() |
| 4021 | * |
| 4022 | *FUNCTION: |
| 4023 | * This function is called by limProcessSmeGetWPSPBCSessions() upon |
| 4024 | * receiving query WPS PBC overlap information message from application. |
| 4025 | * |
| 4026 | *LOGIC: |
| 4027 | * Message validity checks are performed in this function |
| 4028 | * |
| 4029 | *ASSUMPTIONS: |
| 4030 | * |
| 4031 | *NOTE: |
| 4032 | * |
| 4033 | * @param pBuf - Pointer to a serialized SME_GET_WPSPBC_SESSION_REQ message |
| 4034 | * @param pGetWPSPBCSessionsReq - Pointer to a tSirSmeGetWPSPBCSessionsReq structure |
| 4035 | * @return true if SME_GET_WPSPBC_SESSION_REQ message is formatted correctly |
| 4036 | * false otherwise |
| 4037 | */ |
| 4038 | |
| 4039 | tSirRetStatus |
| 4040 | limIsSmeGetWPSPBCSessionsReqValid(tpAniSirGlobal pMac, tSirSmeGetWPSPBCSessionsReq *pGetWPSPBCSessionsReq, tANI_U8 *pBuf) |
| 4041 | { |
| 4042 | tANI_S16 len = 0; |
| 4043 | |
| 4044 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirSmeGetWPSPBCSessionsReq));) |
| 4045 | |
| 4046 | pGetWPSPBCSessionsReq->messageType = limGetU16(pBuf); |
| 4047 | pBuf += sizeof(tANI_U16); |
| 4048 | |
| 4049 | len = pGetWPSPBCSessionsReq->length = limGetU16(pBuf); |
| 4050 | pBuf += sizeof(tANI_U16); |
| 4051 | |
| 4052 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 4053 | return eSIR_FAILURE; |
| 4054 | |
| 4055 | len -= sizeof(tANI_U32); // skip message header |
| 4056 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 4057 | return eSIR_FAILURE; |
| 4058 | |
| 4059 | // Extract pUsrContext |
| 4060 | pGetWPSPBCSessionsReq->pUsrContext = (void *)limGetU32(pBuf); |
| 4061 | pBuf += sizeof(tANI_U32); |
| 4062 | len -= sizeof(tANI_U32); |
| 4063 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 4064 | return eSIR_FAILURE; |
| 4065 | |
| 4066 | // Extract pSapEventCallback |
| 4067 | pGetWPSPBCSessionsReq->pSapEventCallback = (void *)limGetU32(pBuf); |
| 4068 | pBuf += sizeof(tANI_U32); |
| 4069 | len -= sizeof(tANI_U32); |
| 4070 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 4071 | return eSIR_FAILURE; |
| 4072 | |
| 4073 | // Extract bssId |
| 4074 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pGetWPSPBCSessionsReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 4075 | pBuf += sizeof(tSirMacAddr); |
| 4076 | len -= sizeof(tSirMacAddr); |
| 4077 | |
| 4078 | // Extract MAC address of Station to be removed |
| 4079 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pGetWPSPBCSessionsReq->pRemoveMac, pBuf, sizeof(tSirMacAddr)); |
| 4080 | pBuf += sizeof(tSirMacAddr); |
| 4081 | len -= sizeof(tSirMacAddr); |
| 4082 | |
| 4083 | PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes \n"), len);) |
| 4084 | |
| 4085 | if (len < 0) |
| 4086 | { |
| 4087 | PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length\n"));) |
| 4088 | return eSIR_FAILURE; |
| 4089 | } |
| 4090 | |
| 4091 | return eSIR_SUCCESS; |
| 4092 | } |
| 4093 | |
| 4094 | #endif |
| 4095 | |
| 4096 | /**--------------------------------------------------------------- |
| 4097 | \fn limGetSessionInfo |
| 4098 | \brief This function returns the sessionId and transactionId |
| 4099 | \ of a message. This assumes that the message structure |
| 4100 | \ is of format: |
| 4101 | \ tANI_U16 messageType |
| 4102 | \ tANI_U16 messageLength |
| 4103 | \ tANI_U8 sessionId |
| 4104 | \ tANI_U16 transactionId |
| 4105 | \param pMac - pMac global structure |
| 4106 | \param *pBuf - pointer to the message buffer |
| 4107 | \param sessionId - returned session id value |
| 4108 | \param transactionId - returned transaction ID value |
| 4109 | \return None |
| 4110 | ------------------------------------------------------------------*/ |
| 4111 | void |
| 4112 | limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U8 *sessionId, tANI_U16 *transactionId) |
| 4113 | { |
| 4114 | if (!pBuf) |
| 4115 | { |
| 4116 | limLog(pMac, LOGE, FL("NULL ptr received. \n")); |
| 4117 | return; |
| 4118 | } |
| 4119 | |
| 4120 | pBuf += sizeof(tANI_U16); // skip message type |
| 4121 | pBuf += sizeof(tANI_U16); // skip message length |
| 4122 | |
| 4123 | *sessionId = *pBuf; // get sessionId |
| 4124 | pBuf++; |
| 4125 | *transactionId = limGetU16(pBuf); // get transactionId |
| 4126 | |
| 4127 | return; |
| 4128 | } |
| 4129 | |
| 4130 | #ifdef WLAN_SOFTAP_FEATURE |
| 4131 | |
| 4132 | /** |
| 4133 | * limUpdateAPWPSIEsReqSerDes() |
| 4134 | * |
| 4135 | *FUNCTION: |
| 4136 | * This function is to deserialize UpdateAPWPSIEs message |
| 4137 | * |
| 4138 | *PARAMS: |
| 4139 | * |
| 4140 | *LOGIC: |
| 4141 | * |
| 4142 | *ASSUMPTIONS: |
| 4143 | * NA |
| 4144 | * |
| 4145 | *NOTE: |
| 4146 | * NA |
| 4147 | * |
| 4148 | * @param pUpdateAPWPSIEsReq Pointer to tSirUpdateAPWPSIEsReq being |
| 4149 | * extracted |
| 4150 | * @param pBuf Pointer to serialized buffer |
| 4151 | * |
| 4152 | * @return retCode Indicates whether message is successfully |
| 4153 | * de-serialized (eSIR_SUCCESS) or |
| 4154 | * not (eSIR_FAILURE) |
| 4155 | */ |
| 4156 | |
| 4157 | tSirRetStatus |
| 4158 | limUpdateAPWPSIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq, tANI_U8 *pBuf) |
| 4159 | { |
| 4160 | tANI_S16 len = 0; |
| 4161 | |
| 4162 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPSIEsReq));) |
| 4163 | |
| 4164 | if (!pUpdateAPWPSIEsReq || !pBuf) |
| 4165 | return eSIR_FAILURE; |
| 4166 | |
| 4167 | pUpdateAPWPSIEsReq->messageType = limGetU16(pBuf); |
| 4168 | pBuf += sizeof(tANI_U16); |
| 4169 | |
| 4170 | len = pUpdateAPWPSIEsReq->length = limGetU16(pBuf); |
| 4171 | pBuf += sizeof(tANI_U16); |
| 4172 | |
| 4173 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 4174 | return eSIR_FAILURE; |
| 4175 | |
| 4176 | len -= sizeof(tANI_U32); // skip message header |
| 4177 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 4178 | return eSIR_FAILURE; |
| 4179 | |
| 4180 | // Extract transactionId |
| 4181 | pUpdateAPWPSIEsReq->transactionId = limGetU16( pBuf ); |
| 4182 | pBuf += sizeof( tANI_U16 ); |
| 4183 | len -= sizeof( tANI_U16 ); |
| 4184 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 4185 | return eSIR_FAILURE; |
| 4186 | |
| 4187 | // Extract bssId |
| 4188 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pUpdateAPWPSIEsReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 4189 | pBuf += sizeof(tSirMacAddr); |
| 4190 | len -= sizeof(tSirMacAddr); |
| 4191 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 4192 | return eSIR_FAILURE; |
| 4193 | |
| 4194 | // Extract sessionId |
| 4195 | pUpdateAPWPSIEsReq->sessionId = *pBuf++; |
| 4196 | len--; |
| 4197 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 4198 | return eSIR_FAILURE; |
| 4199 | |
| 4200 | // Extract APWPSIEs |
| 4201 | palCopyMemory( pMac->hHdd, (tSirAPWPSIEs *) &pUpdateAPWPSIEsReq->APWPSIEs, pBuf, sizeof(tSirAPWPSIEs)); |
| 4202 | pBuf += sizeof(tSirAPWPSIEs); |
| 4203 | len -= sizeof(tSirAPWPSIEs); |
| 4204 | |
| 4205 | PELOG1(limLog(pMac, LOG1, FL("SME_UPDATE_APWPSIE_REQ length consumed %d bytes \n"), len);) |
| 4206 | |
| 4207 | if (len < 0) |
| 4208 | { |
| 4209 | PELOGE(limLog(pMac, LOGE, FL("SME_UPDATE_APWPSIE_REQ invalid length\n"));) |
| 4210 | return eSIR_FAILURE; |
| 4211 | } |
| 4212 | |
| 4213 | return eSIR_SUCCESS; |
| 4214 | } /*** end limSetContextReqSerDes() ***/ |
| 4215 | |
| 4216 | /** |
| 4217 | * limUpdateAPWPARSNIEsReqSerDes () |
| 4218 | * |
| 4219 | *FUNCTION: |
| 4220 | * This function is to deserialize UpdateAPWPSIEs message |
| 4221 | * |
| 4222 | *PARAMS: |
| 4223 | * |
| 4224 | *LOGIC: |
| 4225 | * |
| 4226 | *ASSUMPTIONS: |
| 4227 | * NA |
| 4228 | * |
| 4229 | *NOTE: |
| 4230 | * NA |
| 4231 | * |
| 4232 | * @param pUpdateAPWPARSNIEsReq Pointer to tpSirUpdateAPWPARSNIEsReq being |
| 4233 | * extracted |
| 4234 | * @param pBuf Pointer to serialized buffer |
| 4235 | * |
| 4236 | * @return retCode Indicates whether message is successfully |
| 4237 | * de-serialized (eSIR_SUCCESS) or |
| 4238 | * not (eSIR_FAILURE) |
| 4239 | */ |
| 4240 | |
| 4241 | tSirRetStatus |
| 4242 | limUpdateAPWPARSNIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq, tANI_U8 *pBuf) |
| 4243 | { |
| 4244 | tANI_S16 len = 0; |
| 4245 | |
| 4246 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPARSNIEsReq));) |
| 4247 | |
| 4248 | if (!pUpdateAPWPARSNIEsReq || !pBuf) |
| 4249 | return eSIR_FAILURE; |
| 4250 | |
| 4251 | pUpdateAPWPARSNIEsReq->messageType = limGetU16(pBuf); |
| 4252 | pBuf += sizeof(tANI_U16); |
| 4253 | |
| 4254 | len = pUpdateAPWPARSNIEsReq->length = limGetU16(pBuf); |
| 4255 | pBuf += sizeof(tANI_U16); |
| 4256 | |
| 4257 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 4258 | return eSIR_FAILURE; |
| 4259 | |
| 4260 | len -= sizeof(tANI_U32); // skip message header |
| 4261 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 4262 | return eSIR_FAILURE; |
| 4263 | |
| 4264 | // Extract transactionId |
| 4265 | pUpdateAPWPARSNIEsReq->transactionId = limGetU16( pBuf ); |
| 4266 | pBuf += sizeof(tANI_U16); |
| 4267 | len -= sizeof( tANI_U16 ); |
| 4268 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 4269 | return eSIR_FAILURE; |
| 4270 | |
| 4271 | // Extract bssId |
| 4272 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pUpdateAPWPARSNIEsReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 4273 | pBuf += sizeof(tSirMacAddr); |
| 4274 | len -= sizeof(tSirMacAddr); |
| 4275 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 4276 | return eSIR_FAILURE; |
| 4277 | |
| 4278 | // Extract sessionId |
| 4279 | pUpdateAPWPARSNIEsReq->sessionId = *pBuf++; |
| 4280 | len--; |
| 4281 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 4282 | return eSIR_FAILURE; |
| 4283 | |
| 4284 | // Extract APWPARSNIEs |
| 4285 | palCopyMemory( pMac->hHdd, (tSirRSNie *) &pUpdateAPWPARSNIEsReq->APWPARSNIEs, pBuf, sizeof(tSirRSNie)); |
| 4286 | pBuf += sizeof(tSirRSNie); |
| 4287 | len -= sizeof(tSirRSNie); |
| 4288 | |
| 4289 | if (len < 0) |
| 4290 | { |
| 4291 | PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length\n"));) |
| 4292 | return eSIR_FAILURE; |
| 4293 | } |
| 4294 | |
| 4295 | return eSIR_SUCCESS; |
| 4296 | } /*** end limUpdateAPWPARSNIEsReqSerDes() ***/ |
| 4297 | |
| 4298 | #endif |