Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 22 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 23 | * |
| 24 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 25 | * |
| 26 | * |
| 27 | * Permission to use, copy, modify, and/or distribute this software for |
| 28 | * any purpose with or without fee is hereby granted, provided that the |
| 29 | * above copyright notice and this permission notice appear in all |
| 30 | * copies. |
| 31 | * |
| 32 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 33 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 35 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 36 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 37 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 38 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 39 | * PERFORMANCE OF THIS SOFTWARE. |
| 40 | */ |
| 41 | |
| 42 | /* |
| 43 | * Airgo Networks, Inc proprietary. All rights reserved. |
| 44 | * |
| 45 | * This file limSerDesUtils.cc contains the serializer/deserializer |
| 46 | * utility functions LIM uses while communicating with upper layer |
| 47 | * software entities |
| 48 | * Author: Chandra Modumudi |
| 49 | * Date: 10/20/02 |
| 50 | * History:- |
| 51 | * Date Modified by Modification Information |
| 52 | * -------------------------------------------------------------------- |
| 53 | */ |
| 54 | |
| 55 | #include "aniSystemDefs.h" |
| 56 | #include "utilsApi.h" |
| 57 | #include "limTypes.h" |
| 58 | #include "limUtils.h" |
| 59 | #include "limSerDesUtils.h" |
| 60 | |
| 61 | |
| 62 | |
| 63 | /** |
| 64 | * limCheckRemainingLength() |
| 65 | * |
| 66 | *FUNCTION: |
| 67 | * This function is called while de-serializing received SME_REQ |
| 68 | * message. |
| 69 | * |
| 70 | *LOGIC: |
| 71 | * Remaining message length is checked for > 0. |
| 72 | * |
| 73 | *ASSUMPTIONS: |
| 74 | * NA |
| 75 | * |
| 76 | *NOTE: |
| 77 | * NA |
| 78 | * |
| 79 | * @param len - Remaining message length |
| 80 | * @return retCode - eSIR_SUCCESS if len > 0, else eSIR_FAILURE |
| 81 | */ |
| 82 | |
| 83 | static inline tSirRetStatus |
| 84 | limCheckRemainingLength(tpAniSirGlobal pMac, tANI_S16 len) |
| 85 | { |
| 86 | if (len > 0) |
| 87 | return eSIR_SUCCESS; |
| 88 | else |
| 89 | { |
| 90 | limLog(pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 91 | FL("Received SME message with invalid rem length=%d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 92 | len); |
| 93 | return eSIR_FAILURE; |
| 94 | } |
| 95 | } /*** end limCheckRemainingLength(pMac, ) ***/ |
| 96 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 97 | /** |
| 98 | * limGetBssDescription() |
| 99 | * |
| 100 | *FUNCTION: |
| 101 | * This function is called by various LIM functions to copy |
| 102 | * BSS description from a tANI_U8* buffer pointer to tSirBssDescription |
| 103 | * |
| 104 | *LOGIC: |
| 105 | * |
| 106 | *ASSUMPTIONS: |
| 107 | * NA |
| 108 | * |
| 109 | *NOTE: |
| 110 | * NA |
| 111 | * |
| 112 | * @param pBssDescription Pointer to the BssDescription to be copied |
| 113 | * @param *pBuf Pointer to the source buffer |
| 114 | * @param rLen Remaining message length being extracted |
| 115 | * @return retCode Indicates whether message is successfully |
| 116 | * de-serialized (eSIR_SUCCESS) or |
| 117 | * failure (eSIR_FAILURE). |
| 118 | */ |
| 119 | |
| 120 | static tSirRetStatus |
| 121 | limGetBssDescription( tpAniSirGlobal pMac, tSirBssDescription *pBssDescription, |
| 122 | tANI_S16 rLen, tANI_S16 *lenUsed, tANI_U8 *pBuf) |
| 123 | { |
Madan Mohan Koyyalamudi | c62057b | 2012-10-30 18:31:54 -0700 | [diff] [blame] | 124 | tANI_S16 len = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 125 | |
| 126 | pBssDescription->length = limGetU16(pBuf); |
| 127 | pBuf += sizeof(tANI_U16); |
| 128 | len = pBssDescription->length; |
| 129 | |
| 130 | if (rLen < (tANI_S16) (len + sizeof(tANI_U16))) |
| 131 | return eSIR_FAILURE; |
| 132 | |
| 133 | *lenUsed = len + sizeof(tANI_U16); |
| 134 | |
| 135 | // Extract bssId |
| 136 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssDescription->bssId, |
| 137 | pBuf, sizeof(tSirMacAddr)); |
| 138 | pBuf += sizeof(tSirMacAddr); |
| 139 | len -= sizeof(tSirMacAddr); |
| 140 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 141 | return eSIR_FAILURE; |
| 142 | |
| 143 | // Extract timer |
| 144 | palCopyMemory( pMac->hHdd, (tANI_U8 *) (&pBssDescription->scanSysTimeMsec), |
| 145 | pBuf, sizeof(v_TIME_t)); |
| 146 | pBuf += sizeof(v_TIME_t); |
| 147 | len -= sizeof(v_TIME_t); |
| 148 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 149 | return eSIR_FAILURE; |
| 150 | |
| 151 | // Extract timeStamp |
| 152 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssDescription->timeStamp, |
| 153 | pBuf, sizeof(tSirMacTimeStamp)); |
| 154 | pBuf += sizeof(tSirMacTimeStamp); |
| 155 | len -= sizeof(tSirMacTimeStamp); |
| 156 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 157 | return eSIR_FAILURE; |
| 158 | |
| 159 | // Extract beaconInterval |
| 160 | pBssDescription->beaconInterval = limGetU16(pBuf); |
| 161 | pBuf += sizeof(tANI_U16); |
| 162 | len -= sizeof(tANI_U16); |
| 163 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 164 | return eSIR_FAILURE; |
| 165 | |
| 166 | // Extract capabilityInfo |
| 167 | pBssDescription->capabilityInfo = limGetU16(pBuf); |
| 168 | pBuf += sizeof(tANI_U16); |
| 169 | len -= sizeof(tANI_U16); |
| 170 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 171 | return eSIR_FAILURE; |
| 172 | |
| 173 | // Extract nwType |
| 174 | pBssDescription->nwType = (tSirNwType) limGetU32(pBuf); |
| 175 | pBuf += sizeof(tSirNwType); |
| 176 | len -= sizeof(tSirNwType); |
| 177 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 178 | return eSIR_FAILURE; |
| 179 | |
| 180 | // Extract aniIndicator |
| 181 | pBssDescription->aniIndicator = *pBuf++; |
| 182 | len --; |
| 183 | |
| 184 | // Extract rssi |
| 185 | pBssDescription->rssi = (tANI_S8) *pBuf++; |
| 186 | len --; |
| 187 | |
| 188 | // Extract sinr |
| 189 | pBssDescription->sinr = (tANI_S8) *pBuf++; |
| 190 | len --; |
| 191 | |
| 192 | // Extract channelId |
| 193 | pBssDescription->channelId = *pBuf++; |
| 194 | len --; |
| 195 | |
| 196 | // Extract channelIdSelf |
| 197 | pBssDescription->channelIdSelf = *pBuf++; |
| 198 | len --; |
| 199 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 200 | return eSIR_FAILURE; |
| 201 | |
| 202 | // Extract reserved bssDescription |
| 203 | pBuf += sizeof(pBssDescription->sSirBssDescriptionRsvd); |
| 204 | len -= sizeof(pBssDescription->sSirBssDescriptionRsvd); |
| 205 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 206 | return eSIR_FAILURE; |
| 207 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 208 | //pass the timestamp |
| 209 | pBssDescription->nReceivedTime = limGetU32( pBuf ); |
| 210 | pBuf += sizeof(tANI_TIMESTAMP); |
| 211 | len -= sizeof(tANI_TIMESTAMP); |
| 212 | |
| 213 | #if defined WLAN_FEATURE_VOWIFI |
| 214 | //TSF when the beacon received (parent TSF) |
| 215 | pBssDescription->parentTSF = limGetU32( pBuf ); |
| 216 | pBuf += sizeof(tANI_U32); |
| 217 | len -= sizeof(tANI_U32); |
| 218 | |
| 219 | //start TSF of scan during which this BSS desc was updated. |
| 220 | pBssDescription->startTSF[0] = limGetU32( pBuf ); |
| 221 | pBuf += sizeof(tANI_U32); |
| 222 | len -= sizeof(tANI_U32); |
| 223 | |
| 224 | //start TSF of scan during which this BSS desc was updated. |
| 225 | pBssDescription->startTSF[1] = limGetU32( pBuf ); |
| 226 | pBuf += sizeof(tANI_U32); |
| 227 | len -= sizeof(tANI_U32); |
| 228 | #endif |
| 229 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 230 | // MobilityDomain |
| 231 | pBssDescription->mdiePresent = *pBuf++; |
| 232 | len --; |
| 233 | pBssDescription->mdie[0] = *pBuf++; |
| 234 | len --; |
| 235 | pBssDescription->mdie[1] = *pBuf++; |
| 236 | len --; |
| 237 | pBssDescription->mdie[2] = *pBuf++; |
| 238 | len --; |
| 239 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 240 | PELOGE(limLog(pMac, LOG1, FL("mdie=%02x %02x %02x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 241 | pBssDescription->mdie[0], |
| 242 | pBssDescription->mdie[1], |
| 243 | pBssDescription->mdie[2]);) |
| 244 | #endif |
| 245 | #endif |
| 246 | |
| 247 | #ifdef FEATURE_WLAN_CCX |
| 248 | pBssDescription->QBSSLoad_present = limGetU16(pBuf); |
| 249 | pBuf += sizeof(tANI_U16); |
| 250 | len -= sizeof(tANI_U16); |
| 251 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 252 | return eSIR_FAILURE; |
| 253 | |
| 254 | // Extract QBSSLoad_avail |
| 255 | pBssDescription->QBSSLoad_avail = limGetU16(pBuf); |
| 256 | pBuf += sizeof(tANI_U16); |
| 257 | len -= sizeof(tANI_U16); |
| 258 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 259 | return eSIR_FAILURE; |
| 260 | #endif |
Madan Mohan Koyyalamudi | 7df624d | 2012-10-31 16:32:50 -0700 | [diff] [blame] | 261 | pBssDescription->fProbeRsp = *pBuf++; |
| 262 | len -= sizeof(tANI_U8); |
| 263 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 264 | return eSIR_FAILURE; |
| 265 | |
Madan Mohan Koyyalamudi | 2a6ba24 | 2012-10-31 17:06:19 -0700 | [diff] [blame] | 266 | /* 3 reserved bytes for padding */ |
| 267 | pBuf += (3 * sizeof(tANI_U8)); |
| 268 | len -= 3; |
| 269 | |
Madan Mohan Koyyalamudi | 7df624d | 2012-10-31 16:32:50 -0700 | [diff] [blame] | 270 | pBssDescription->WscIeLen = limGetU32( pBuf ); |
| 271 | pBuf += sizeof(tANI_U32); |
| 272 | len -= sizeof(tANI_U32); |
| 273 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 274 | return eSIR_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 275 | |
Madan Mohan Koyyalamudi | 2a6ba24 | 2012-10-31 17:06:19 -0700 | [diff] [blame] | 276 | if (WSCIE_PROBE_RSP_LEN < len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 277 | { |
Madan Mohan Koyyalamudi | 2a6ba24 | 2012-10-31 17:06:19 -0700 | [diff] [blame] | 278 | /* Do not copy with WscIeLen |
| 279 | * if WscIeLen is not set properly, memory overwrite happen |
| 280 | * Ended up with memory corruption and crash |
| 281 | * Copy with Fixed size */ |
| 282 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssDescription->WscIeProbeRsp, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 283 | pBuf, |
Madan Mohan Koyyalamudi | 2a6ba24 | 2012-10-31 17:06:19 -0700 | [diff] [blame] | 284 | WSCIE_PROBE_RSP_LEN); |
| 285 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 286 | } |
Madan Mohan Koyyalamudi | 2a6ba24 | 2012-10-31 17:06:19 -0700 | [diff] [blame] | 287 | else |
| 288 | { |
| 289 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 290 | FL("remaining bytes len %d is less than WSCIE_PROBE_RSP_LEN"), |
Madan Mohan Koyyalamudi | 2a6ba24 | 2012-10-31 17:06:19 -0700 | [diff] [blame] | 291 | pBssDescription->WscIeLen); |
| 292 | return eSIR_FAILURE; |
| 293 | } |
| 294 | |
| 295 | /* 1 reserved byte padding */ |
| 296 | pBuf += (WSCIE_PROBE_RSP_LEN + 1); |
| 297 | len -= (WSCIE_PROBE_RSP_LEN + 1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 298 | |
Madan Mohan Koyyalamudi | c62057b | 2012-10-30 18:31:54 -0700 | [diff] [blame] | 299 | if (len > 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 300 | { |
| 301 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssDescription->ieFields, |
| 302 | pBuf, |
| 303 | len); |
| 304 | } |
Madan Mohan Koyyalamudi | c62057b | 2012-10-30 18:31:54 -0700 | [diff] [blame] | 305 | else if (len < 0) |
| 306 | { |
| 307 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 308 | FL("remaining length is negative. len = %d, actual length = %d"), |
Madan Mohan Koyyalamudi | c62057b | 2012-10-30 18:31:54 -0700 | [diff] [blame] | 309 | len, pBssDescription->length); |
| 310 | return eSIR_FAILURE; |
| 311 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 312 | |
| 313 | return eSIR_SUCCESS; |
| 314 | } /*** end limGetBssDescription() ***/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 315 | |
| 316 | |
| 317 | |
| 318 | /** |
| 319 | * limCopyBssDescription() |
| 320 | * |
| 321 | *FUNCTION: |
| 322 | * This function is called by various LIM functions to copy |
| 323 | * BSS description to a tANI_U8 buffer |
| 324 | * |
| 325 | *LOGIC: |
| 326 | * |
| 327 | *ASSUMPTIONS: |
| 328 | * NA |
| 329 | * |
| 330 | *NOTE: |
| 331 | * NA |
| 332 | * |
| 333 | * @param *pBuf Pointer to the destination buffer |
| 334 | * @param pBssDescription Pointer to the BssDescription being copied |
| 335 | * @return Length of BSSdescription written |
| 336 | */ |
| 337 | |
| 338 | tANI_U16 |
| 339 | limCopyBssDescription(tpAniSirGlobal pMac, tANI_U8 *pBuf, tSirBssDescription *pBssDescription) |
| 340 | { |
| 341 | tANI_U16 len = 0; |
| 342 | |
| 343 | limCopyU16(pBuf, pBssDescription->length); |
| 344 | pBuf += sizeof(tANI_U16); |
| 345 | len += sizeof(tANI_U16); |
| 346 | |
| 347 | palCopyMemory( pMac->hHdd, pBuf, |
| 348 | (tANI_U8 *) pBssDescription->bssId, |
| 349 | sizeof(tSirMacAddr)); |
| 350 | pBuf += sizeof(tSirMacAddr); |
| 351 | len += sizeof(tSirMacAddr); |
| 352 | |
| 353 | PELOG3(limLog(pMac, LOG3, |
| 354 | FL("Copying BSSdescr:channel is %d, aniInd is %d, bssId is "), |
| 355 | pBssDescription->channelId, pBssDescription->aniIndicator); |
| 356 | limPrintMacAddr(pMac, pBssDescription->bssId, LOG3);) |
| 357 | |
| 358 | palCopyMemory( pMac->hHdd, pBuf, |
| 359 | (tANI_U8 *) (&pBssDescription->scanSysTimeMsec), |
| 360 | sizeof(v_TIME_t)); |
| 361 | pBuf += sizeof(v_TIME_t); |
| 362 | len += sizeof(v_TIME_t); |
| 363 | |
| 364 | limCopyU32(pBuf, pBssDescription->timeStamp[0]); |
| 365 | pBuf += sizeof(tANI_U32); |
| 366 | len += sizeof(tANI_U32); |
| 367 | |
| 368 | limCopyU32(pBuf, pBssDescription->timeStamp[1]); |
| 369 | pBuf += sizeof(tANI_U32); |
| 370 | len += sizeof(tANI_U32); |
| 371 | |
| 372 | limCopyU16(pBuf, pBssDescription->beaconInterval); |
| 373 | pBuf += sizeof(tANI_U16); |
| 374 | len += sizeof(tANI_U16); |
| 375 | |
| 376 | limCopyU16(pBuf, pBssDescription->capabilityInfo); |
| 377 | pBuf += sizeof(tANI_U16); |
| 378 | len += sizeof(tANI_U16); |
| 379 | |
| 380 | limCopyU32(pBuf, pBssDescription->nwType); |
| 381 | pBuf += sizeof(tANI_U32); |
| 382 | len += sizeof(tANI_U32); |
| 383 | |
| 384 | *pBuf++ = pBssDescription->aniIndicator; |
| 385 | len++; |
| 386 | |
| 387 | *pBuf++ = pBssDescription->rssi; |
| 388 | len++; |
| 389 | |
| 390 | *pBuf++ = pBssDescription->sinr; |
| 391 | len++; |
| 392 | |
| 393 | *pBuf++ = pBssDescription->channelId; |
| 394 | len++; |
| 395 | |
| 396 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pBssDescription->ieFields), |
| 397 | limGetIElenFromBssDescription(pBssDescription)); |
| 398 | |
| 399 | return (len + sizeof(tANI_U16)); |
| 400 | } /*** end limCopyBssDescription() ***/ |
| 401 | |
| 402 | |
| 403 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 404 | |
| 405 | |
| 406 | /** |
| 407 | * limGetKeysInfo() |
| 408 | * |
| 409 | *FUNCTION: |
| 410 | * This function is called by various LIM functions to copy |
| 411 | * key information from a tANI_U8* buffer pointer to tSirKeys |
| 412 | * |
| 413 | *LOGIC: |
| 414 | * |
| 415 | *ASSUMPTIONS: |
| 416 | * NA |
| 417 | * |
| 418 | *NOTE: |
| 419 | * NA |
| 420 | * |
| 421 | * @param *pKeyInfo Pointer to the keyInfo to be copied |
| 422 | * @param *pBuf Pointer to the source buffer |
| 423 | * |
| 424 | * @return Length of key info extracted |
| 425 | */ |
| 426 | |
| 427 | static tANI_U32 |
| 428 | limGetKeysInfo(tpAniSirGlobal pMac, tpSirKeys pKeyInfo, tANI_U8 *pBuf) |
| 429 | { |
| 430 | tANI_U32 len = 0; |
| 431 | |
| 432 | pKeyInfo->keyId = *pBuf++; |
| 433 | len++; |
| 434 | pKeyInfo->unicast = *pBuf++; |
| 435 | len++; |
| 436 | pKeyInfo->keyDirection = (tAniKeyDirection) limGetU32(pBuf); |
| 437 | len += sizeof(tAniKeyDirection); |
| 438 | pBuf += sizeof(tAniKeyDirection); |
| 439 | |
| 440 | palCopyMemory( pMac->hHdd, pKeyInfo->keyRsc, pBuf, WLAN_MAX_KEY_RSC_LEN); |
| 441 | pBuf += WLAN_MAX_KEY_RSC_LEN; |
| 442 | len += WLAN_MAX_KEY_RSC_LEN; |
| 443 | |
| 444 | pKeyInfo->paeRole = *pBuf++; |
| 445 | len++; |
| 446 | |
| 447 | pKeyInfo->keyLength = limGetU16(pBuf); |
| 448 | pBuf += sizeof(tANI_U16); |
| 449 | len += sizeof(tANI_U16); |
| 450 | palCopyMemory( pMac->hHdd, pKeyInfo->key, pBuf, pKeyInfo->keyLength); |
| 451 | pBuf += pKeyInfo->keyLength; |
| 452 | len += pKeyInfo->keyLength; |
| 453 | |
| 454 | PELOG3(limLog(pMac, LOG3, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 455 | FL("Extracted keyId=%d, keyLength=%d, Key is :"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 456 | pKeyInfo->keyId, pKeyInfo->keyLength); |
| 457 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, |
| 458 | pKeyInfo->key, pKeyInfo->keyLength);) |
| 459 | |
| 460 | return len; |
| 461 | } /*** end limGetKeysInfo() ***/ |
| 462 | |
| 463 | |
| 464 | |
| 465 | /** |
| 466 | * limStartBssReqSerDes() |
| 467 | * |
| 468 | *FUNCTION: |
| 469 | * This function is called by limProcessSmeMessages() upon receiving |
| 470 | * SME_START_BSS_REQ from host |
| 471 | * |
| 472 | *PARAMS: |
| 473 | * |
| 474 | *LOGIC: |
| 475 | * |
| 476 | *ASSUMPTIONS: |
| 477 | * NA |
| 478 | * |
| 479 | *NOTE: |
| 480 | * NA |
| 481 | * |
| 482 | * @param pStartBssReq Pointer to tSirSmeStartBssReq being extracted |
| 483 | * @param pBuf Pointer to serialized buffer |
| 484 | * @return retCode Indicates whether message is successfully |
| 485 | * de-serialized (eSIR_SUCCESS) or |
| 486 | * not (eSIR_FAILURE) |
| 487 | */ |
| 488 | |
| 489 | tSirRetStatus |
| 490 | limStartBssReqSerDes(tpAniSirGlobal pMac, tpSirSmeStartBssReq pStartBssReq, tANI_U8 *pBuf) |
| 491 | { |
| 492 | tANI_S16 len = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 493 | |
| 494 | #ifdef PE_DEBUG_LOG1 |
| 495 | tANI_U8 *pTemp = pBuf; |
| 496 | #endif |
| 497 | |
| 498 | if (!pStartBssReq || !pBuf) |
| 499 | return eSIR_FAILURE; |
| 500 | |
| 501 | pStartBssReq->messageType = limGetU16(pBuf); |
| 502 | pBuf += sizeof(tANI_U16); |
| 503 | |
| 504 | len = pStartBssReq->length = limGetU16(pBuf); |
| 505 | pBuf += sizeof(tANI_U16); |
| 506 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 507 | PELOG1(limLog(pMac, LOG1, FL("SME_START_BSS_REQ length %d bytes is:"), len);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 508 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);) |
| 509 | |
| 510 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 511 | return eSIR_FAILURE; |
| 512 | |
| 513 | len -= sizeof(tANI_U32); // skip message header |
| 514 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 515 | return eSIR_FAILURE; |
| 516 | |
| 517 | // Extract sessionId |
| 518 | pStartBssReq->sessionId = *pBuf++; |
| 519 | len--; |
| 520 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 521 | return eSIR_FAILURE; |
| 522 | |
| 523 | // Extract transactionId |
| 524 | pStartBssReq->transactionId = limGetU16( pBuf ); |
| 525 | pBuf += sizeof( tANI_U16 ); |
| 526 | len -= sizeof( tANI_U16 ); |
| 527 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 528 | return eSIR_FAILURE; |
| 529 | |
| 530 | // Extract bssId |
| 531 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 532 | pBuf += sizeof(tSirMacAddr); |
| 533 | len -= sizeof(tSirMacAddr); |
| 534 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 535 | return eSIR_FAILURE; |
| 536 | |
| 537 | // Extract selfMacAddr |
| 538 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->selfMacAddr, pBuf, sizeof(tSirMacAddr)); |
| 539 | pBuf += sizeof(tSirMacAddr); |
| 540 | len -= sizeof(tSirMacAddr); |
| 541 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 542 | return eSIR_FAILURE; |
| 543 | |
| 544 | // Extract beaconInterval |
| 545 | pStartBssReq->beaconInterval = limGetU16( pBuf ); |
| 546 | pBuf += sizeof( tANI_U16 ); |
| 547 | len -= sizeof( tANI_U16 ); |
| 548 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 549 | return eSIR_FAILURE; |
| 550 | |
| 551 | // Extract dot11Mode |
| 552 | pStartBssReq->dot11mode = *pBuf++; |
| 553 | len --; |
| 554 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 555 | return eSIR_FAILURE; |
| 556 | |
| 557 | // Extract bssType |
| 558 | pStartBssReq->bssType = (tSirBssType) limGetU32(pBuf); |
| 559 | pBuf += sizeof(tANI_U32); |
| 560 | len -= sizeof(tANI_U32); |
| 561 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 562 | return eSIR_FAILURE; |
| 563 | |
| 564 | // Extract ssId |
| 565 | if (*pBuf > SIR_MAC_MAX_SSID_LENGTH) |
| 566 | { |
| 567 | // SSID length is more than max allowed 32 bytes |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 568 | PELOGW(limLog(pMac, LOGW, FL("Invalid SSID length, len=%d"), *pBuf);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 569 | return eSIR_FAILURE; |
| 570 | } |
| 571 | |
| 572 | pStartBssReq->ssId.length = *pBuf++; |
| 573 | len--; |
| 574 | if (len < pStartBssReq->ssId.length) |
| 575 | { |
| 576 | limLog(pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 577 | FL("SSID length is longer that the remaining length. SSID len=%d, remaining len=%d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 578 | pStartBssReq->ssId.length, len); |
| 579 | return eSIR_FAILURE; |
| 580 | } |
| 581 | |
| 582 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->ssId.ssId, |
| 583 | pBuf, |
| 584 | pStartBssReq->ssId.length); |
| 585 | pBuf += pStartBssReq->ssId.length; |
| 586 | len -= pStartBssReq->ssId.length; |
| 587 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 588 | return eSIR_FAILURE; |
| 589 | |
| 590 | // Extract channelId |
| 591 | pStartBssReq->channelId = *pBuf++; |
| 592 | len--; |
| 593 | |
| 594 | // Extract CB secondary channel info |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 595 | pStartBssReq->cbMode = (ePhyChanBondState)limGetU32( pBuf ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 596 | pBuf += sizeof( tANI_U32 ); |
| 597 | len -= sizeof( tANI_U32 ); |
| 598 | |
| 599 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 600 | return eSIR_FAILURE; |
| 601 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 602 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 603 | // Extract privacy setting |
| 604 | pStartBssReq->privacy = *pBuf++; |
| 605 | len--; |
| 606 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 607 | return eSIR_FAILURE; |
| 608 | |
| 609 | //Extract Uapsd Enable |
| 610 | pStartBssReq->apUapsdEnable = *pBuf++; |
| 611 | len--; |
| 612 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 613 | return eSIR_FAILURE; |
| 614 | |
| 615 | //Extract SSID hidden |
| 616 | pStartBssReq->ssidHidden = *pBuf++; |
| 617 | len--; |
| 618 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 619 | return eSIR_FAILURE; |
| 620 | |
| 621 | pStartBssReq->fwdWPSPBCProbeReq = *pBuf++; |
| 622 | len--; |
| 623 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 624 | return eSIR_FAILURE; |
| 625 | |
| 626 | //Extract HT Protection Enable |
| 627 | pStartBssReq->protEnabled = *pBuf++; |
| 628 | len--; |
| 629 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 630 | return eSIR_FAILURE; |
| 631 | |
| 632 | //Extract OBSS Protection Enable |
| 633 | pStartBssReq->obssProtEnabled = *pBuf++; |
| 634 | len--; |
| 635 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 636 | return eSIR_FAILURE; |
| 637 | |
| 638 | pStartBssReq->ht_capab = limGetU16(pBuf); |
| 639 | pBuf += sizeof(tANI_U16); |
| 640 | len -= sizeof(tANI_U16); |
| 641 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 642 | return eSIR_FAILURE; |
| 643 | |
| 644 | // Extract AuthType |
| 645 | pStartBssReq->authType = (tSirBssType) limGetU32(pBuf); |
| 646 | pBuf += sizeof(tANI_U32); |
| 647 | len -= sizeof(tANI_U32); |
| 648 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 649 | return eSIR_FAILURE; |
| 650 | |
| 651 | // Extract dtimPeriod |
| 652 | pStartBssReq->dtimPeriod = limGetU32(pBuf); |
| 653 | pBuf += sizeof(tANI_U32); |
| 654 | len -= sizeof(tANI_U32); |
| 655 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 656 | return eSIR_FAILURE; |
| 657 | |
| 658 | // Extract wps state |
| 659 | pStartBssReq->wps_state = *pBuf++; |
| 660 | len--; |
| 661 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 662 | return eSIR_FAILURE; |
| 663 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 664 | // Extract bssPersona |
| 665 | pStartBssReq->bssPersona = *pBuf++; |
| 666 | len--; |
| 667 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 668 | return eSIR_FAILURE; |
| 669 | |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 670 | |
| 671 | // Extract txLdpcIniFeatureEnabled |
| 672 | pStartBssReq->txLdpcIniFeatureEnabled = *pBuf++; |
| 673 | len--; |
| 674 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 675 | return eSIR_FAILURE; |
| 676 | |
| 677 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 678 | // Extract rsnIe |
| 679 | pStartBssReq->rsnIE.length = limGetU16(pBuf); |
| 680 | pBuf += sizeof(tANI_U16); |
| 681 | |
| 682 | // Check for RSN IE length (that includes length of type & length |
| 683 | if (pStartBssReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2) |
| 684 | { |
| 685 | limLog(pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 686 | FL("Invalid RSN IE length %d in SME_START_BSS_REQ"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 687 | pStartBssReq->rsnIE.length); |
| 688 | return eSIR_FAILURE; |
| 689 | } |
| 690 | |
| 691 | palCopyMemory( pMac->hHdd, pStartBssReq->rsnIE.rsnIEdata, |
| 692 | pBuf, pStartBssReq->rsnIE.length); |
| 693 | |
| 694 | len -= (sizeof(tANI_U16) + pStartBssReq->rsnIE.length); |
| 695 | pBuf += pStartBssReq->rsnIE.length; |
| 696 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 697 | return eSIR_FAILURE; |
| 698 | |
| 699 | // Extract nwType |
| 700 | pStartBssReq->nwType = (tSirNwType) limGetU32(pBuf); |
| 701 | pBuf += sizeof(tSirNwType); |
| 702 | len -= sizeof(tSirNwType); |
| 703 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 704 | return eSIR_FAILURE; |
| 705 | |
| 706 | // Extract operationalRateSet |
| 707 | pStartBssReq->operationalRateSet.numRates = *pBuf++; |
| 708 | |
| 709 | // Check for number of rates |
| 710 | if (pStartBssReq->operationalRateSet.numRates > |
| 711 | SIR_MAC_MAX_NUMBER_OF_RATES) |
| 712 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 713 | limLog(pMac, LOGW, FL("Invalid numRates %d in SME_START_BSS_REQ"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 714 | pStartBssReq->operationalRateSet.numRates); |
| 715 | return eSIR_FAILURE; |
| 716 | } |
| 717 | |
| 718 | len--; |
| 719 | if (len < pStartBssReq->operationalRateSet.numRates) |
| 720 | return eSIR_FAILURE; |
| 721 | |
| 722 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pStartBssReq->operationalRateSet.rate, |
| 723 | pBuf, |
| 724 | pStartBssReq->operationalRateSet.numRates); |
| 725 | pBuf += pStartBssReq->operationalRateSet.numRates; |
| 726 | len -= pStartBssReq->operationalRateSet.numRates; |
| 727 | |
| 728 | // Extract extendedRateSet |
| 729 | if ((pStartBssReq->nwType == eSIR_11G_NW_TYPE) || |
| 730 | (pStartBssReq->nwType == eSIR_11N_NW_TYPE )) |
| 731 | { |
| 732 | pStartBssReq->extendedRateSet.numRates = *pBuf++; |
| 733 | len--; |
| 734 | palCopyMemory( pMac->hHdd, pStartBssReq->extendedRateSet.rate, |
| 735 | pBuf, pStartBssReq->extendedRateSet.numRates); |
| 736 | pBuf += pStartBssReq->extendedRateSet.numRates; |
| 737 | len -= pStartBssReq->extendedRateSet.numRates; |
| 738 | } |
| 739 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 740 | |
| 741 | if (len) |
| 742 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 743 | limLog(pMac, LOGW, FL("Extra bytes left in SME_START_BSS_REQ, len=%d"), len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 744 | } |
| 745 | |
| 746 | return eSIR_SUCCESS; |
| 747 | } /*** end limStartBssReqSerDes() ***/ |
| 748 | |
| 749 | |
| 750 | |
| 751 | /** |
| 752 | * limStopBssReqSerDes() |
| 753 | * |
| 754 | *FUNCTION: |
| 755 | * This function is called by limProcessSmeMessages() upon receiving |
| 756 | * SME_STOP_BSS_REQ from host |
| 757 | * |
| 758 | *PARAMS: |
| 759 | * |
| 760 | *LOGIC: |
| 761 | * |
| 762 | *ASSUMPTIONS: |
| 763 | * NA |
| 764 | * |
| 765 | *NOTE: |
| 766 | * NA |
| 767 | * |
| 768 | * @param pStopBssReq Pointer to tSirSmeStopBssReq being extracted |
| 769 | * @param pBuf Pointer to serialized buffer |
| 770 | * @return retCode Indicates whether message is successfully |
| 771 | * de-serialized (eSIR_SUCCESS) or |
| 772 | * not (eSIR_FAILURE) |
| 773 | */ |
| 774 | |
| 775 | tSirRetStatus |
| 776 | limStopBssReqSerDes(tpAniSirGlobal pMac, tpSirSmeStopBssReq pStopBssReq, tANI_U8 *pBuf) |
| 777 | { |
| 778 | tANI_S16 len = 0; |
| 779 | |
| 780 | #ifdef PE_DEBUG_LOG1 |
| 781 | tANI_U8 *pTemp = pBuf; |
| 782 | #endif |
| 783 | |
| 784 | pStopBssReq->messageType = limGetU16(pBuf); |
| 785 | pBuf += sizeof(tANI_U16); |
| 786 | |
| 787 | len = pStopBssReq->length = limGetU16(pBuf); |
| 788 | pBuf += sizeof(tANI_U16); |
| 789 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 790 | PELOG1(limLog(pMac, LOG1, FL("SME_STOP_BSS_REQ length %d bytes is:"), len);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 791 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);) |
| 792 | |
| 793 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 794 | return eSIR_FAILURE; |
| 795 | |
| 796 | len -= sizeof(tANI_U32); // skip message header |
| 797 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 798 | return eSIR_FAILURE; |
| 799 | |
| 800 | // Extract sessionId |
| 801 | pStopBssReq->sessionId = *pBuf++; |
| 802 | len--; |
| 803 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 804 | return eSIR_FAILURE; |
| 805 | |
| 806 | // Extract transactionId |
| 807 | pStopBssReq->transactionId = limGetU16(pBuf); |
| 808 | pBuf += sizeof(tANI_U16); |
| 809 | len -= sizeof(tANI_U16); |
| 810 | |
| 811 | // Extract reasonCode |
| 812 | pStopBssReq->reasonCode = (tSirResultCodes) limGetU32(pBuf); |
| 813 | pBuf += sizeof(tSirResultCodes); |
| 814 | len -= sizeof(tSirResultCodes); |
| 815 | |
| 816 | // Extract bssId |
| 817 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pStopBssReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 818 | len -= sizeof(tSirMacAddr); |
| 819 | |
| 820 | if (len) |
| 821 | return eSIR_FAILURE; |
| 822 | else |
| 823 | return eSIR_SUCCESS; |
| 824 | |
| 825 | } /*** end limStopBssReqSerDes() ***/ |
| 826 | |
| 827 | |
| 828 | |
| 829 | /** |
| 830 | * limJoinReqSerDes() |
| 831 | * |
| 832 | *FUNCTION: |
| 833 | * This function is called by limProcessSmeMessages() upon receiving |
| 834 | * SME_JOIN_REQ from host |
| 835 | * |
| 836 | *PARAMS: |
| 837 | * |
| 838 | *LOGIC: |
| 839 | * |
| 840 | *ASSUMPTIONS: |
| 841 | * NA |
| 842 | * |
| 843 | *NOTE: |
| 844 | * NA |
| 845 | * |
| 846 | * @param pJoinReq Pointer to tSirSmeJoinReq being extracted |
| 847 | * @param pBuf Pointer to serialized buffer |
| 848 | * @return retCode Indicates whether message is successfully |
| 849 | * de-serialized (eSIR_SUCCESS) or |
| 850 | * not (eSIR_FAILURE) |
| 851 | */ |
| 852 | |
| 853 | tSirRetStatus |
| 854 | limJoinReqSerDes(tpAniSirGlobal pMac, tpSirSmeJoinReq pJoinReq, tANI_U8 *pBuf) |
| 855 | { |
| 856 | tANI_S16 len = 0; |
| 857 | tANI_S16 lenUsed = 0; |
| 858 | |
| 859 | #ifdef PE_DEBUG_LOG1 |
| 860 | tANI_U8 *pTemp = pBuf; |
| 861 | #endif |
| 862 | |
| 863 | if (!pJoinReq || !pBuf) |
| 864 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 865 | PELOGE(limLog(pMac, LOGE, FL("NULL ptr received"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 866 | return eSIR_FAILURE; |
| 867 | } |
| 868 | |
| 869 | // Extract messageType |
| 870 | pJoinReq->messageType = limGetU16(pBuf); |
| 871 | pBuf += sizeof(tANI_U16); |
| 872 | |
| 873 | // Extract length |
| 874 | len = pJoinReq->length = limGetU16(pBuf); |
| 875 | pBuf += sizeof(tANI_U16); |
| 876 | |
| 877 | if (pJoinReq->messageType == eWNI_SME_JOIN_REQ) |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 878 | PELOG1(limLog(pMac, LOG3, FL("SME_JOIN_REQ length %d bytes is:"), len);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 879 | else |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 880 | PELOG1(limLog(pMac, LOG3, FL("SME_REASSOC_REQ length %d bytes is:"), len);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 881 | |
| 882 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);) |
| 883 | |
| 884 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 885 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 886 | PELOGE(limLog(pMac, LOGE, FL("len too short %d"), len);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 887 | return eSIR_FAILURE; |
| 888 | } |
| 889 | |
| 890 | len -= sizeof(tANI_U32); // skip message header |
| 891 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 892 | return eSIR_FAILURE; |
| 893 | |
| 894 | // Extract sessionId |
| 895 | pJoinReq->sessionId = *pBuf++; |
| 896 | len--; |
| 897 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 898 | return eSIR_FAILURE; |
| 899 | |
| 900 | // Extract transactionId |
| 901 | pJoinReq->transactionId = limGetU16(pBuf); |
| 902 | pBuf += sizeof(tANI_U16); |
| 903 | len -= sizeof(tANI_U16); |
| 904 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 905 | return eSIR_FAILURE; |
| 906 | |
| 907 | // Extract ssId |
| 908 | pJoinReq->ssId.length = *pBuf++; |
| 909 | len--; |
| 910 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->ssId.ssId, pBuf, pJoinReq->ssId.length); |
| 911 | pBuf += pJoinReq->ssId.length; |
| 912 | len -= pJoinReq->ssId.length; |
| 913 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 914 | return eSIR_FAILURE; |
| 915 | |
| 916 | // Extract selfMacAddr |
| 917 | palCopyMemory( pMac->hHdd, pJoinReq->selfMacAddr, pBuf, sizeof(tSirMacAddr)); |
| 918 | pBuf += sizeof(tSirMacAddr); |
| 919 | len -= sizeof(tSirMacAddr); |
| 920 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 921 | return eSIR_FAILURE; |
| 922 | |
| 923 | // Extract bsstype |
| 924 | pJoinReq->bsstype = (tSirBssType) limGetU32(pBuf); |
| 925 | pBuf += sizeof(tANI_U32); |
| 926 | len -= sizeof(tANI_U32); |
| 927 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 928 | return eSIR_FAILURE; |
| 929 | |
| 930 | // Extract dot11mode |
| 931 | pJoinReq->dot11mode= *pBuf++; |
| 932 | len--; |
| 933 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 934 | return eSIR_FAILURE; |
| 935 | |
| 936 | // Extract bssPersona |
| 937 | pJoinReq->staPersona = *pBuf++; |
| 938 | len--; |
| 939 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 940 | return eSIR_FAILURE; |
| 941 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 942 | // Extract cbMode |
| 943 | pJoinReq->cbMode = *pBuf++; |
| 944 | len--; |
| 945 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 946 | return eSIR_FAILURE; |
| 947 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 948 | // Extract uapsdPerAcBitmask |
| 949 | pJoinReq->uapsdPerAcBitmask = *pBuf++; |
| 950 | len--; |
| 951 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 952 | return eSIR_FAILURE; |
| 953 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 954 | |
| 955 | // Extract operationalRateSet |
| 956 | pJoinReq->operationalRateSet.numRates= *pBuf++; |
| 957 | len--; |
| 958 | if (pJoinReq->operationalRateSet.numRates) |
| 959 | { |
| 960 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->operationalRateSet.rate, pBuf, pJoinReq->operationalRateSet.numRates); |
| 961 | pBuf += pJoinReq->operationalRateSet.numRates; |
| 962 | len -= pJoinReq->operationalRateSet.numRates; |
| 963 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 964 | return eSIR_FAILURE; |
| 965 | } |
| 966 | |
| 967 | // Extract extendedRateSet |
| 968 | pJoinReq->extendedRateSet.numRates = *pBuf++; |
| 969 | len--; |
| 970 | if (pJoinReq->extendedRateSet.numRates) |
| 971 | { |
| 972 | palCopyMemory( pMac->hHdd, pJoinReq->extendedRateSet.rate, pBuf, pJoinReq->extendedRateSet.numRates); |
| 973 | pBuf += pJoinReq->extendedRateSet.numRates; |
| 974 | len -= pJoinReq->extendedRateSet.numRates; |
| 975 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 976 | return eSIR_FAILURE; |
| 977 | } |
| 978 | |
| 979 | // Extract RSN IE |
| 980 | pJoinReq->rsnIE.length = limGetU16(pBuf); |
| 981 | pBuf += sizeof(tANI_U16); |
| 982 | len -= sizeof(tANI_U16); |
| 983 | |
| 984 | if (pJoinReq->rsnIE.length) |
| 985 | { |
| 986 | // Check for RSN IE length (that includes length of type & length) |
| 987 | if ((pJoinReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2) || |
| 988 | (pJoinReq->rsnIE.length != 2 + *(pBuf + 1))) |
| 989 | { |
| 990 | limLog(pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 991 | FL("Invalid RSN IE length %d in SME_JOIN_REQ"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 992 | pJoinReq->rsnIE.length); |
| 993 | return eSIR_FAILURE; |
| 994 | } |
| 995 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->rsnIE.rsnIEdata, |
| 996 | pBuf, pJoinReq->rsnIE.length); |
| 997 | pBuf += pJoinReq->rsnIE.length; |
| 998 | len -= pJoinReq->rsnIE.length; // skip RSN IE |
| 999 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1000 | return eSIR_FAILURE; |
| 1001 | } |
| 1002 | |
| 1003 | #ifdef FEATURE_WLAN_CCX |
| 1004 | // Extract CCKM IE |
| 1005 | pJoinReq->cckmIE.length = limGetU16(pBuf); |
| 1006 | pBuf += sizeof(tANI_U16); |
| 1007 | len -= sizeof(tANI_U16); |
| 1008 | if (pJoinReq->cckmIE.length) |
| 1009 | { |
| 1010 | // Check for CCKM IE length (that includes length of type & length) |
| 1011 | if ((pJoinReq->cckmIE.length > SIR_MAC_MAX_IE_LENGTH) || |
| 1012 | (pJoinReq->cckmIE.length != (2 + *(pBuf + 1)))) |
| 1013 | { |
| 1014 | limLog(pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 1015 | FL("Invalid CCKM IE length %d/%d in SME_JOIN/REASSOC_REQ"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1016 | pJoinReq->cckmIE.length, 2 + *(pBuf + 1)); |
| 1017 | return eSIR_FAILURE; |
| 1018 | } |
| 1019 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->cckmIE.cckmIEdata, |
| 1020 | pBuf, pJoinReq->cckmIE.length); |
| 1021 | pBuf += pJoinReq->cckmIE.length; |
| 1022 | len -= pJoinReq->cckmIE.length; // skip CCKM IE |
| 1023 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1024 | return eSIR_FAILURE; |
| 1025 | } |
| 1026 | #endif |
| 1027 | |
| 1028 | // Extract Add IE for scan |
| 1029 | pJoinReq->addIEScan.length = limGetU16(pBuf); |
| 1030 | pBuf += sizeof(tANI_U16); |
| 1031 | len -= sizeof(tANI_U16); |
| 1032 | |
| 1033 | if (pJoinReq->addIEScan.length) |
| 1034 | { |
| 1035 | // Check for IE length (that includes length of type & length) |
| 1036 | if (pJoinReq->addIEScan.length > SIR_MAC_MAX_IE_LENGTH + 2) |
| 1037 | { |
| 1038 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 1039 | FL("Invalid addIE Scan length %d in SME_JOIN_REQ"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1040 | pJoinReq->addIEScan.length); |
| 1041 | return eSIR_FAILURE; |
| 1042 | } |
| 1043 | // Check for P2P IE length (that includes length of type & length) |
| 1044 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->addIEScan.addIEdata, |
| 1045 | pBuf, pJoinReq->addIEScan.length); |
| 1046 | pBuf += pJoinReq->addIEScan.length; |
| 1047 | len -= pJoinReq->addIEScan.length; // skip add IE |
| 1048 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1049 | return eSIR_FAILURE; |
| 1050 | } |
| 1051 | |
| 1052 | pJoinReq->addIEAssoc.length = limGetU16(pBuf); |
| 1053 | pBuf += sizeof(tANI_U16); |
| 1054 | len -= sizeof(tANI_U16); |
| 1055 | |
| 1056 | // Extract Add IE for assoc |
| 1057 | if (pJoinReq->addIEAssoc.length) |
| 1058 | { |
| 1059 | // Check for IE length (that includes length of type & length) |
| 1060 | if (pJoinReq->addIEAssoc.length > SIR_MAC_MAX_IE_LENGTH + 2) |
| 1061 | { |
| 1062 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 1063 | FL("Invalid addIE Assoc length %d in SME_JOIN_REQ"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1064 | pJoinReq->addIEAssoc.length); |
| 1065 | return eSIR_FAILURE; |
| 1066 | } |
| 1067 | // Check for P2P IE length (that includes length of type & length) |
| 1068 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->addIEAssoc.addIEdata, |
| 1069 | pBuf, pJoinReq->addIEAssoc.length); |
| 1070 | pBuf += pJoinReq->addIEAssoc.length; |
| 1071 | len -= pJoinReq->addIEAssoc.length; // skip add IE |
| 1072 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1073 | return eSIR_FAILURE; |
| 1074 | } |
| 1075 | |
| 1076 | pJoinReq->MCEncryptionType = limGetU32(pBuf); |
| 1077 | pBuf += sizeof(tANI_U32); |
| 1078 | len -= sizeof(tANI_U32); |
| 1079 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1080 | return eSIR_FAILURE; |
| 1081 | |
| 1082 | pJoinReq->UCEncryptionType = limGetU32(pBuf); |
| 1083 | pBuf += sizeof(tANI_U32); |
| 1084 | len -= sizeof(tANI_U32); |
| 1085 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1086 | return eSIR_FAILURE; |
| 1087 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1088 | #ifdef WLAN_FEATURE_11W |
| 1089 | pJoinReq->MgmtEncryptionType = limGetU32(pBuf); |
| 1090 | pBuf += sizeof(tANI_U32); |
| 1091 | len -= sizeof(tANI_U32); |
| 1092 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1093 | return eSIR_FAILURE; |
| 1094 | #endif |
| 1095 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1096 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1097 | //is11Rconnection; |
| 1098 | pJoinReq->is11Rconnection = (tAniBool)limGetU32(pBuf); |
| 1099 | pBuf += sizeof(tAniBool); |
| 1100 | len -= sizeof(tAniBool); |
| 1101 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1102 | return eSIR_FAILURE; |
| 1103 | #endif |
| 1104 | |
| 1105 | #ifdef FEATURE_WLAN_CCX |
| 1106 | //isCCXconnection; |
| 1107 | pJoinReq->isCCXconnection = (tAniBool)limGetU32(pBuf); |
| 1108 | pBuf += sizeof(tAniBool); |
| 1109 | len -= sizeof(tAniBool); |
| 1110 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1111 | return eSIR_FAILURE; |
| 1112 | |
| 1113 | // TSPEC information |
| 1114 | pJoinReq->ccxTspecInfo.numTspecs = *pBuf++; |
| 1115 | len -= sizeof(tANI_U8); |
| 1116 | palCopyMemory(pMac->hHdd, (void*)&pJoinReq->ccxTspecInfo.tspec[0], pBuf, (sizeof(tTspecInfo)* pJoinReq->ccxTspecInfo.numTspecs)); |
| 1117 | pBuf += sizeof(tTspecInfo)*SIR_CCX_MAX_TSPEC_IES; |
| 1118 | len -= sizeof(tTspecInfo)*SIR_CCX_MAX_TSPEC_IES; |
| 1119 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1120 | return eSIR_FAILURE; |
| 1121 | #endif |
| 1122 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1123 | #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] | 1124 | //isFastTransitionEnabled; |
| 1125 | pJoinReq->isFastTransitionEnabled = (tAniBool)limGetU32(pBuf); |
| 1126 | pBuf += sizeof(tAniBool); |
| 1127 | len -= sizeof(tAniBool); |
| 1128 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1129 | return eSIR_FAILURE; |
| 1130 | #endif |
| 1131 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1132 | #ifdef FEATURE_WLAN_LFR |
| 1133 | //isFastRoamIniFeatureEnabled; |
| 1134 | pJoinReq->isFastRoamIniFeatureEnabled = (tAniBool)limGetU32(pBuf); |
| 1135 | pBuf += sizeof(tAniBool); |
| 1136 | len -= sizeof(tAniBool); |
| 1137 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1138 | return eSIR_FAILURE; |
| 1139 | #endif |
| 1140 | |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 1141 | //txLdpcIniFeatureEnabled |
| 1142 | pJoinReq->txLdpcIniFeatureEnabled= *pBuf++; |
| 1143 | len--; |
| 1144 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1145 | return eSIR_FAILURE; |
| 1146 | |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1147 | //txBFIniFeatureEnabled |
| 1148 | pJoinReq->txBFIniFeatureEnabled= *pBuf++; |
| 1149 | len--; |
| 1150 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1151 | return eSIR_FAILURE; |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 1152 | |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 1153 | //txBFCsnValue |
| 1154 | pJoinReq->txBFCsnValue= *pBuf++; |
| 1155 | len--; |
| 1156 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1157 | return eSIR_FAILURE; |
| 1158 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1159 | |
| 1160 | // Extract Titan CB Neighbor BSS info |
| 1161 | pJoinReq->cbNeighbors.cbBssFoundPri = *pBuf; |
| 1162 | pBuf++; |
| 1163 | pJoinReq->cbNeighbors.cbBssFoundSecUp = *pBuf; |
| 1164 | pBuf++; |
| 1165 | pJoinReq->cbNeighbors.cbBssFoundSecDown = *pBuf; |
| 1166 | pBuf++; |
| 1167 | len -= 3; |
| 1168 | |
| 1169 | // Extract Spectrum Mgt Indicator |
| 1170 | pJoinReq->spectrumMgtIndicator = (tAniBool) limGetU32(pBuf); |
| 1171 | pBuf += sizeof(tAniBool); |
| 1172 | len -= sizeof(tAniBool); |
| 1173 | |
| 1174 | pJoinReq->powerCap.minTxPower = *pBuf++; |
| 1175 | pJoinReq->powerCap.maxTxPower = *pBuf++; |
| 1176 | len -=2; |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 1177 | limLog(pMac, LOG1, FL("Power Caps: Min power = %d, Max power = %d"), pJoinReq->powerCap.minTxPower, pJoinReq->powerCap.maxTxPower); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1178 | |
| 1179 | pJoinReq->supportedChannels.numChnl = *pBuf++; |
| 1180 | len--; |
| 1181 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pJoinReq->supportedChannels.channelList, |
| 1182 | pBuf, pJoinReq->supportedChannels.numChnl); |
| 1183 | pBuf += pJoinReq->supportedChannels.numChnl; |
| 1184 | len-= pJoinReq->supportedChannels.numChnl; |
| 1185 | |
| 1186 | PELOG2(limLog(pMac, LOG2, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 1187 | FL("spectrumInd ON: minPower %d, maxPower %d , numChnls %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1188 | pJoinReq->powerCap.minTxPower, |
| 1189 | pJoinReq->powerCap.maxTxPower, |
| 1190 | pJoinReq->supportedChannels.numChnl);) |
| 1191 | |
| 1192 | // Extract uapsdPerAcBitmask |
| 1193 | pJoinReq->uapsdPerAcBitmask = *pBuf++; |
| 1194 | len--; |
| 1195 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1196 | return eSIR_FAILURE; |
| 1197 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1198 | // |
| 1199 | // NOTE - tSirBssDescription is now moved to the end |
| 1200 | // of tSirSmeJoinReq structure. This is to accomodate |
| 1201 | // the variable length data member ieFields[1] |
| 1202 | // |
| 1203 | if (limGetBssDescription( pMac, &pJoinReq->bssDescription, |
| 1204 | len, &lenUsed, pBuf) == eSIR_FAILURE) |
| 1205 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 1206 | PELOGE(limLog(pMac, LOGE, FL("get bss description failed"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1207 | return eSIR_FAILURE; |
| 1208 | } |
| 1209 | PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, (tANI_U8 *) &(pJoinReq->bssDescription), pJoinReq->bssDescription.length + 2);) |
| 1210 | pBuf += lenUsed; |
| 1211 | len -= lenUsed; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1212 | |
| 1213 | return eSIR_SUCCESS; |
| 1214 | } /*** end limJoinReqSerDes() ***/ |
| 1215 | |
| 1216 | |
| 1217 | /**--------------------------------------------------------------- |
| 1218 | \fn limAssocIndSerDes |
| 1219 | \brief This function is called by limProcessMlmAssocInd() to |
| 1220 | \ populate the SME_ASSOC_IND message based on the received |
| 1221 | \ MLM_ASSOC_IND. |
| 1222 | \ |
| 1223 | \param pMac |
| 1224 | \param pAssocInd - Pointer to the received tLimMlmAssocInd |
| 1225 | \param pBuf - Pointer to serialized buffer |
| 1226 | \param psessionEntry - pointer to PE session entry |
| 1227 | \ |
| 1228 | \return None |
| 1229 | ------------------------------------------------------------------*/ |
| 1230 | void |
| 1231 | limAssocIndSerDes(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd, tANI_U8 *pBuf, tpPESession psessionEntry) |
| 1232 | { |
| 1233 | tANI_U8 *pLen = pBuf; |
| 1234 | tANI_U16 mLen = 0; |
| 1235 | |
| 1236 | #ifdef PE_DEBUG_LOG1 |
| 1237 | tANI_U8 *pTemp = pBuf; |
| 1238 | #endif |
| 1239 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1240 | |
| 1241 | mLen = sizeof(tANI_U32); |
| 1242 | mLen += sizeof(tANI_U8); |
| 1243 | pBuf += sizeof(tANI_U16); |
| 1244 | *pBuf = psessionEntry->smeSessionId; |
| 1245 | pBuf += sizeof(tANI_U8); |
| 1246 | |
| 1247 | // Fill in peerMacAddr |
| 1248 | palCopyMemory( pMac->hHdd, pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 1249 | pBuf += sizeof(tSirMacAddr); |
| 1250 | mLen += sizeof(tSirMacAddr); |
| 1251 | |
| 1252 | // Fill in aid |
| 1253 | limCopyU16(pBuf, pAssocInd->aid); |
| 1254 | pBuf += sizeof(tANI_U16); |
| 1255 | mLen += sizeof(tANI_U16); |
| 1256 | |
| 1257 | // Fill in bssId |
| 1258 | palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr)); |
| 1259 | pBuf += sizeof(tSirMacAddr); |
| 1260 | mLen += sizeof(tSirMacAddr); |
| 1261 | |
| 1262 | // Fill in staId |
| 1263 | limCopyU16(pBuf, psessionEntry->staId); |
| 1264 | pBuf += sizeof(tANI_U16); |
| 1265 | mLen += sizeof(tANI_U16); |
| 1266 | |
| 1267 | // Fill in authType |
| 1268 | limCopyU32(pBuf, pAssocInd->authType); |
| 1269 | pBuf += sizeof(tANI_U32); |
| 1270 | mLen += sizeof(tANI_U32); |
| 1271 | |
| 1272 | // Fill in ssId |
| 1273 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1); |
| 1274 | pBuf += (1 + pAssocInd->ssId.length); |
| 1275 | mLen += (1 + pAssocInd->ssId.length); |
| 1276 | |
| 1277 | // Fill in rsnIE |
| 1278 | limCopyU16(pBuf, pAssocInd->rsnIE.length); |
| 1279 | pBuf += sizeof(tANI_U16); |
| 1280 | mLen += sizeof(tANI_U16); |
| 1281 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata), |
| 1282 | pAssocInd->rsnIE.length); |
| 1283 | pBuf += pAssocInd->rsnIE.length; |
| 1284 | mLen += pAssocInd->rsnIE.length; |
| 1285 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1286 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1287 | limCopyU32(pBuf, pAssocInd->spectrumMgtIndicator); |
| 1288 | pBuf += sizeof(tAniBool); |
| 1289 | mLen += sizeof(tAniBool); |
| 1290 | |
| 1291 | if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE) |
| 1292 | { |
| 1293 | *pBuf = pAssocInd->powerCap.minTxPower; |
| 1294 | pBuf++; |
| 1295 | *pBuf = pAssocInd->powerCap.maxTxPower; |
| 1296 | pBuf++; |
| 1297 | mLen += sizeof(tSirMacPowerCapInfo); |
| 1298 | |
| 1299 | *pBuf = pAssocInd->supportedChannels.numChnl; |
| 1300 | pBuf++; |
| 1301 | mLen++; |
| 1302 | |
| 1303 | palCopyMemory( pMac->hHdd, pBuf, |
| 1304 | (tANI_U8 *) &(pAssocInd->supportedChannels.channelList), |
| 1305 | pAssocInd->supportedChannels.numChnl); |
| 1306 | |
| 1307 | |
| 1308 | pBuf += pAssocInd->supportedChannels.numChnl; |
| 1309 | mLen += pAssocInd->supportedChannels.numChnl; |
| 1310 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1311 | limCopyU32(pBuf, pAssocInd->WmmStaInfoPresent); |
| 1312 | pBuf += sizeof(tANI_U32); |
| 1313 | mLen += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1314 | // Fill in length of SME_ASSOC_IND message |
| 1315 | limCopyU16(pLen, mLen); |
| 1316 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 1317 | PELOG1(limLog(pMac, LOG1, FL("Sending SME_ASSOC_IND length %d bytes:"), mLen);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1318 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);) |
| 1319 | } /*** end limAssocIndSerDes() ***/ |
| 1320 | |
| 1321 | |
| 1322 | |
| 1323 | /** |
| 1324 | * limAssocCnfSerDes() |
| 1325 | * |
| 1326 | *FUNCTION: |
| 1327 | * This function is called by limProcessLmmMessages() when |
| 1328 | * SME_ASSOC_CNF or SME_REASSOC_CNF message is received from |
| 1329 | * upper layer software. |
| 1330 | * |
| 1331 | *PARAMS: |
| 1332 | * |
| 1333 | *LOGIC: |
| 1334 | * |
| 1335 | *ASSUMPTIONS: |
| 1336 | * NA |
| 1337 | * |
| 1338 | *NOTE: |
| 1339 | * NA |
| 1340 | * |
| 1341 | * @param pAssocCnf Pointer to tSirSmeAssocCnf being extracted into |
| 1342 | * @param pBuf Pointer to serialized buffer |
| 1343 | * @return retCode Indicates whether message is successfully |
| 1344 | * de-serialized (eSIR_SUCCESS) or |
| 1345 | * not (eSIR_FAILURE) |
| 1346 | */ |
| 1347 | |
| 1348 | tSirRetStatus |
| 1349 | limAssocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeAssocCnf pAssocCnf, tANI_U8 *pBuf) |
| 1350 | { |
| 1351 | #ifdef PE_DEBUG_LOG1 |
| 1352 | tANI_U8 *pTemp = pBuf; |
| 1353 | #endif |
| 1354 | |
| 1355 | if (!pAssocCnf || !pBuf) |
| 1356 | return eSIR_FAILURE; |
| 1357 | |
| 1358 | pAssocCnf->messageType = limGetU16(pBuf); |
| 1359 | pBuf += sizeof(tANI_U16); |
| 1360 | |
| 1361 | pAssocCnf->length = limGetU16(pBuf); |
| 1362 | pBuf += sizeof(tANI_U16); |
| 1363 | |
| 1364 | if (pAssocCnf->messageType == eWNI_SME_ASSOC_CNF) |
| 1365 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 1366 | PELOG1(limLog(pMac, LOG1, FL("SME_ASSOC_CNF length %d bytes is:"), pAssocCnf->length);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1367 | } |
| 1368 | else |
| 1369 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 1370 | PELOG1(limLog(pMac, LOG1, FL("SME_REASSOC_CNF length %d bytes is:"), pAssocCnf->length);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1371 | } |
| 1372 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pAssocCnf->length);) |
| 1373 | |
| 1374 | // status code |
| 1375 | pAssocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf); |
| 1376 | pBuf += sizeof(tSirResultCodes); |
| 1377 | |
| 1378 | // bssId |
| 1379 | palCopyMemory( pMac->hHdd, pAssocCnf->bssId, pBuf, sizeof(tSirMacAddr)); |
| 1380 | pBuf += sizeof(tSirMacAddr); |
| 1381 | |
| 1382 | // peerMacAddr |
| 1383 | palCopyMemory( pMac->hHdd, pAssocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr)); |
| 1384 | pBuf += sizeof(tSirMacAddr); |
| 1385 | |
| 1386 | |
| 1387 | pAssocCnf->aid = limGetU16(pBuf); |
| 1388 | pBuf += sizeof(tANI_U16); |
| 1389 | // alternateBssId |
| 1390 | palCopyMemory( pMac->hHdd, pAssocCnf->alternateBssId, pBuf, sizeof(tSirMacAddr)); |
| 1391 | pBuf += sizeof(tSirMacAddr); |
| 1392 | |
| 1393 | // alternateChannelId |
| 1394 | pAssocCnf->alternateChannelId = *pBuf; |
| 1395 | pBuf++; |
| 1396 | |
| 1397 | return eSIR_SUCCESS; |
| 1398 | } /*** end limAssocCnfSerDes() ***/ |
| 1399 | |
| 1400 | |
| 1401 | |
| 1402 | /** |
| 1403 | * limDisassocCnfSerDes() |
| 1404 | * |
| 1405 | *FUNCTION: |
| 1406 | * This function is called by limProcessSmeMessages() when |
| 1407 | * SME_DISASSOC_CNF message is received from upper layer software. |
| 1408 | * |
| 1409 | *PARAMS: |
| 1410 | * |
| 1411 | *LOGIC: |
| 1412 | * |
| 1413 | *ASSUMPTIONS: |
| 1414 | * NA |
| 1415 | * |
| 1416 | *NOTE: |
| 1417 | * NA |
| 1418 | * |
| 1419 | * @param pDisassocCnf Pointer to tSirSmeDisassocCnf being |
| 1420 | * extracted into |
| 1421 | * @param pBuf Pointer to serialized buffer |
| 1422 | * @return retCode Indicates whether message is successfully |
| 1423 | * de-serialized (eSIR_SUCCESS) or |
| 1424 | * not (eSIR_FAILURE) |
| 1425 | */ |
| 1426 | |
| 1427 | tSirRetStatus |
| 1428 | limDisassocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeDisassocCnf pDisassocCnf, tANI_U8 *pBuf) |
| 1429 | { |
| 1430 | #ifdef PE_DEBUG_LOG1 |
| 1431 | tANI_U8 *pTemp = pBuf; |
| 1432 | #endif |
| 1433 | |
| 1434 | if (!pDisassocCnf || !pBuf) |
| 1435 | return eSIR_FAILURE; |
| 1436 | |
| 1437 | pDisassocCnf->messageType = limGetU16(pBuf); |
| 1438 | pBuf += sizeof(tANI_U16); |
| 1439 | |
| 1440 | pDisassocCnf->length = limGetU16(pBuf); |
| 1441 | pBuf += sizeof(tANI_U16); |
| 1442 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 1443 | PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_CNF length %d bytes is:"), pDisassocCnf->length);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1444 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pDisassocCnf->length);) |
| 1445 | |
| 1446 | pDisassocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf); |
| 1447 | pBuf += sizeof(tSirResultCodes); |
| 1448 | |
| 1449 | palCopyMemory( pMac->hHdd, pDisassocCnf->bssId, pBuf, sizeof(tSirMacAddr)); |
| 1450 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 62c2798 | 2013-02-27 17:53:55 -0800 | [diff] [blame] | 1451 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1452 | palCopyMemory( pMac->hHdd, pDisassocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr)); |
| 1453 | |
Jeff Johnson | 62c2798 | 2013-02-27 17:53:55 -0800 | [diff] [blame] | 1454 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1455 | return eSIR_SUCCESS; |
| 1456 | } /*** end limDisassocCnfSerDes() ***/ |
| 1457 | |
| 1458 | |
| 1459 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1460 | |
| 1461 | |
| 1462 | /**--------------------------------------------------------------- |
| 1463 | \fn limReassocIndSerDes |
| 1464 | \brief This function is called by limProcessMlmReassocInd() to |
| 1465 | \ populate the SME_REASSOC_IND message based on the received |
| 1466 | \ MLM_REASSOC_IND. |
| 1467 | \ |
| 1468 | \param pMac |
| 1469 | \param pReassocInd - Pointer to the received tLimMlmReassocInd |
| 1470 | \param pBuf - Pointer to serialized buffer |
| 1471 | \param psessionEntry - pointer to PE session entry |
| 1472 | \ |
| 1473 | \return None |
| 1474 | ------------------------------------------------------------------*/ |
| 1475 | void |
| 1476 | limReassocIndSerDes(tpAniSirGlobal pMac, tpLimMlmReassocInd pReassocInd, tANI_U8 *pBuf, tpPESession psessionEntry) |
| 1477 | { |
| 1478 | tANI_U8 *pLen = pBuf; |
| 1479 | tANI_U16 mLen = 0; |
| 1480 | |
| 1481 | #ifdef PE_DEBUG_LOG1 |
| 1482 | tANI_U8 *pTemp = pBuf; |
| 1483 | #endif |
| 1484 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1485 | |
| 1486 | mLen = sizeof(tANI_U32); |
| 1487 | pBuf += sizeof(tANI_U16); |
| 1488 | *pBuf++ = psessionEntry->smeSessionId; |
| 1489 | mLen += sizeof(tANI_U8); |
| 1490 | |
| 1491 | // Fill in peerMacAddr |
| 1492 | palCopyMemory( pMac->hHdd, pBuf, pReassocInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 1493 | pBuf += sizeof(tSirMacAddr); |
| 1494 | mLen += sizeof(tSirMacAddr); |
| 1495 | |
| 1496 | // Fill in oldMacAddr |
| 1497 | palCopyMemory( pMac->hHdd, pBuf, pReassocInd->currentApAddr, sizeof(tSirMacAddr)); |
| 1498 | pBuf += sizeof(tSirMacAddr); |
| 1499 | mLen += sizeof(tSirMacAddr); |
| 1500 | |
| 1501 | // Fill in aid |
| 1502 | limCopyU16(pBuf, pReassocInd->aid); |
| 1503 | pBuf += sizeof(tANI_U16); |
| 1504 | mLen += sizeof(tANI_U16); |
| 1505 | |
| 1506 | // Fill in bssId |
| 1507 | palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr)); |
| 1508 | pBuf += sizeof(tSirMacAddr); |
| 1509 | mLen += sizeof(tSirMacAddr); |
| 1510 | |
| 1511 | // Fill in staId |
| 1512 | limCopyU16(pBuf, psessionEntry->staId); |
| 1513 | pBuf += sizeof(tANI_U16); |
| 1514 | mLen += sizeof(tANI_U16); |
| 1515 | |
| 1516 | // Fill in authType |
| 1517 | limCopyU32(pBuf, pReassocInd->authType); |
| 1518 | pBuf += sizeof(tAniAuthType); |
| 1519 | mLen += sizeof(tAniAuthType); |
| 1520 | |
| 1521 | // Fill in ssId |
| 1522 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pReassocInd->ssId), |
| 1523 | pReassocInd->ssId.length + 1); |
| 1524 | pBuf += 1 + pReassocInd->ssId.length; |
| 1525 | mLen += pReassocInd->ssId.length + 1; |
| 1526 | |
| 1527 | // Fill in rsnIE |
| 1528 | limCopyU16(pBuf, pReassocInd->rsnIE.length); |
| 1529 | pBuf += sizeof(tANI_U16); |
| 1530 | mLen += sizeof(tANI_U16); |
| 1531 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) &(pReassocInd->rsnIE.rsnIEdata), |
| 1532 | pReassocInd->rsnIE.length); |
| 1533 | pBuf += pReassocInd->rsnIE.length; |
| 1534 | mLen += pReassocInd->rsnIE.length; |
| 1535 | |
| 1536 | // Fill in addIE |
| 1537 | limCopyU16(pBuf, pReassocInd->addIE.length); |
| 1538 | pBuf += sizeof(tANI_U16); |
| 1539 | mLen += sizeof(tANI_U16); |
| 1540 | palCopyMemory( pMac->hHdd, pBuf, (tANI_U8*) &(pReassocInd->addIE.addIEdata), |
| 1541 | pReassocInd->addIE.length); |
| 1542 | pBuf += pReassocInd->addIE.length; |
| 1543 | mLen += pReassocInd->addIE.length; |
| 1544 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1545 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1546 | limCopyU32(pBuf, pReassocInd->spectrumMgtIndicator); |
| 1547 | pBuf += sizeof(tAniBool); |
| 1548 | mLen += sizeof(tAniBool); |
| 1549 | |
| 1550 | if (pReassocInd->spectrumMgtIndicator == eSIR_TRUE) |
| 1551 | { |
| 1552 | *pBuf = pReassocInd->powerCap.minTxPower; |
| 1553 | pBuf++; |
| 1554 | *pBuf = pReassocInd->powerCap.maxTxPower; |
| 1555 | pBuf++; |
| 1556 | mLen += sizeof(tSirMacPowerCapInfo); |
| 1557 | |
| 1558 | *pBuf = pReassocInd->supportedChannels.numChnl; |
| 1559 | pBuf++; |
| 1560 | mLen++; |
| 1561 | |
| 1562 | palCopyMemory( pMac->hHdd, pBuf, |
| 1563 | (tANI_U8 *) &(pReassocInd->supportedChannels.channelList), |
| 1564 | pReassocInd->supportedChannels.numChnl); |
| 1565 | |
| 1566 | pBuf += pReassocInd->supportedChannels.numChnl; |
| 1567 | mLen += pReassocInd->supportedChannels.numChnl; |
| 1568 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1569 | limCopyU32(pBuf, pReassocInd->WmmStaInfoPresent); |
| 1570 | pBuf += sizeof(tANI_U32); |
| 1571 | mLen += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1572 | |
| 1573 | // Fill in length of SME_REASSOC_IND message |
| 1574 | limCopyU16(pLen, mLen); |
| 1575 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 1576 | PELOG1(limLog(pMac, LOG1, FL("Sending SME_REASSOC_IND length %d bytes:"), mLen);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1577 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);) |
| 1578 | } /*** end limReassocIndSerDes() ***/ |
| 1579 | |
| 1580 | |
| 1581 | /** |
| 1582 | * limAuthIndSerDes() |
| 1583 | * |
| 1584 | *FUNCTION: |
| 1585 | * This function is called by limProcessMlmAuthInd() while sending |
| 1586 | * SME_AUTH_IND to host |
| 1587 | * |
| 1588 | *PARAMS: |
| 1589 | * |
| 1590 | *LOGIC: |
| 1591 | * |
| 1592 | *ASSUMPTIONS: |
| 1593 | * NA |
| 1594 | * |
| 1595 | *NOTE: |
| 1596 | * NA |
| 1597 | * |
| 1598 | * @param pAuthInd Pointer to tSirSmeAuthInd being sent |
| 1599 | * @param pBuf Pointer to serialized buffer |
| 1600 | * |
| 1601 | * @return None |
| 1602 | */ |
| 1603 | |
| 1604 | void |
| 1605 | limAuthIndSerDes(tpAniSirGlobal pMac, tpLimMlmAuthInd pAuthInd, tANI_U8 *pBuf) |
| 1606 | { |
| 1607 | tANI_U8 *pLen = pBuf; |
| 1608 | tANI_U16 mLen = 0; |
| 1609 | |
| 1610 | #ifdef PE_DEBUG_LOG1 |
| 1611 | tANI_U8 *pTemp = pBuf; |
| 1612 | #endif |
| 1613 | |
| 1614 | mLen = sizeof(tANI_U32); |
| 1615 | pBuf += sizeof(tANI_U16); |
| 1616 | *pBuf++ = pAuthInd->sessionId; |
| 1617 | mLen += sizeof(tANI_U8); |
| 1618 | |
| 1619 | // BTAMP TODO: Fill in bssId |
| 1620 | palZeroMemory(pMac->hHdd, pBuf, sizeof(tSirMacAddr)); |
| 1621 | pBuf += sizeof(tSirMacAddr); |
| 1622 | mLen += sizeof(tSirMacAddr); |
| 1623 | |
| 1624 | palCopyMemory( pMac->hHdd, pBuf, pAuthInd->peerMacAddr, sizeof(tSirMacAddr)); |
| 1625 | pBuf += sizeof(tSirMacAddr); |
| 1626 | mLen += sizeof(tSirMacAddr); |
| 1627 | |
| 1628 | limCopyU32(pBuf, pAuthInd->authType); |
| 1629 | pBuf += sizeof(tAniAuthType); |
| 1630 | mLen += sizeof(tAniAuthType); |
| 1631 | |
| 1632 | limCopyU16(pLen, mLen); |
| 1633 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 1634 | PELOG1(limLog(pMac, LOG1, FL("Sending SME_AUTH_IND length %d bytes:"), mLen);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1635 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);) |
| 1636 | } /*** end limAuthIndSerDes() ***/ |
| 1637 | |
| 1638 | |
| 1639 | |
| 1640 | /** |
| 1641 | * limSetContextReqSerDes() |
| 1642 | * |
| 1643 | *FUNCTION: |
| 1644 | * This function is called by limProcessSmeMessages() upon receiving |
| 1645 | * SME_SETCONTEXT_REQ from host |
| 1646 | * |
| 1647 | *PARAMS: |
| 1648 | * |
| 1649 | *LOGIC: |
| 1650 | * |
| 1651 | *ASSUMPTIONS: |
| 1652 | * NA |
| 1653 | * |
| 1654 | *NOTE: |
| 1655 | * NA |
| 1656 | * |
| 1657 | * @param pSetContextReq Pointer to tSirSmeSetContextReq being |
| 1658 | * extracted |
| 1659 | * @param pBuf Pointer to serialized buffer |
| 1660 | * |
| 1661 | * @return retCode Indicates whether message is successfully |
| 1662 | * de-serialized (eSIR_SUCCESS) or |
| 1663 | * not (eSIR_FAILURE) |
| 1664 | */ |
| 1665 | |
| 1666 | tSirRetStatus |
| 1667 | limSetContextReqSerDes(tpAniSirGlobal pMac, tpSirSmeSetContextReq pSetContextReq, tANI_U8 *pBuf) |
| 1668 | { |
| 1669 | tANI_S16 len = 0; |
| 1670 | tANI_U16 totalKeySize = sizeof(tANI_U8); // initialized to sizeof numKeys |
| 1671 | tANI_U8 numKeys; |
| 1672 | tANI_U8 *pKeys; |
| 1673 | |
| 1674 | #ifdef PE_DEBUG_LOG1 |
| 1675 | tANI_U8 *pTemp = pBuf; |
| 1676 | #endif |
| 1677 | if (!pSetContextReq || !pBuf) |
| 1678 | return eSIR_FAILURE; |
| 1679 | |
| 1680 | pSetContextReq->messageType = limGetU16(pBuf); |
| 1681 | pBuf += sizeof(tANI_U16); |
| 1682 | |
| 1683 | len = pSetContextReq->length = limGetU16(pBuf); |
| 1684 | pBuf += sizeof(tANI_U16); |
| 1685 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 1686 | PELOG1(limLog(pMac, LOG1, FL("SME_SETCONTEXT_REQ length %d bytes is:"), len);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1687 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);) |
| 1688 | |
| 1689 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 1690 | return eSIR_FAILURE; |
| 1691 | |
| 1692 | len -= sizeof(tANI_U32); // skip message header |
| 1693 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1694 | return eSIR_FAILURE; |
| 1695 | |
| 1696 | // Extract sessionId |
| 1697 | pSetContextReq->sessionId = *pBuf++; |
| 1698 | len--; |
| 1699 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1700 | return eSIR_FAILURE; |
| 1701 | |
| 1702 | // Extract transactionId |
| 1703 | pSetContextReq->transactionId = sirReadU16N(pBuf); |
| 1704 | pBuf += sizeof(tANI_U16); |
| 1705 | len -= sizeof(tANI_U16); |
| 1706 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1707 | return eSIR_FAILURE; |
| 1708 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pSetContextReq->peerMacAddr, |
| 1709 | pBuf, sizeof(tSirMacAddr)); |
| 1710 | pBuf += sizeof(tSirMacAddr); |
| 1711 | len -= sizeof(tSirMacAddr); |
| 1712 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1713 | return eSIR_FAILURE; |
| 1714 | palCopyMemory( pMac->hHdd, pSetContextReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 1715 | pBuf += sizeof(tSirMacAddr); |
| 1716 | len -= sizeof(tSirMacAddr); |
| 1717 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1718 | return eSIR_FAILURE; |
| 1719 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1720 | |
| 1721 | // pSetContextReq->qosInfoPresent = limGetU32(pBuf); |
| 1722 | // pBuf += sizeof(tAniBool); |
| 1723 | |
| 1724 | // if (pSetContextReq->qosInfoPresent) |
| 1725 | // { |
| 1726 | // len = limGetQosInfo(&pSetContextReq->qos, pBuf); |
| 1727 | // pBuf += len; |
| 1728 | // } |
| 1729 | |
| 1730 | pSetContextReq->keyMaterial.length = limGetU16(pBuf); |
| 1731 | pBuf += sizeof(tANI_U16); |
| 1732 | len -= sizeof(tANI_U16); |
| 1733 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1734 | return eSIR_FAILURE; |
| 1735 | |
| 1736 | pSetContextReq->keyMaterial.edType = (tAniEdType) limGetU32(pBuf); |
| 1737 | pBuf += sizeof(tAniEdType); |
| 1738 | len -= sizeof(tAniEdType); |
| 1739 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1740 | return eSIR_FAILURE; |
| 1741 | |
| 1742 | numKeys = pSetContextReq->keyMaterial.numKeys = *pBuf++; |
| 1743 | len -= sizeof(numKeys); |
| 1744 | |
| 1745 | if (numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS) |
| 1746 | return eSIR_FAILURE; |
| 1747 | |
| 1748 | /** Initialize the Default Keys if no Keys are being sent from the upper layer*/ |
| 1749 | if( limCheckRemainingLength(pMac, len) == eSIR_FAILURE) { |
| 1750 | tpSirKeys pKeyinfo = pSetContextReq->keyMaterial.key; |
| 1751 | |
| 1752 | pKeyinfo->keyId = 0; |
| 1753 | pKeyinfo->keyDirection = eSIR_TX_RX; |
| 1754 | pKeyinfo->keyLength = 0; |
| 1755 | |
| 1756 | if (!limIsAddrBC(pSetContextReq->peerMacAddr)) |
| 1757 | pKeyinfo->unicast = 1; |
| 1758 | else |
| 1759 | pKeyinfo->unicast = 0; |
| 1760 | }else { |
| 1761 | pKeys = (tANI_U8 *) pSetContextReq->keyMaterial.key; |
| 1762 | do { |
| 1763 | tANI_U32 keySize = limGetKeysInfo(pMac, (tpSirKeys) pKeys, |
| 1764 | pBuf); |
| 1765 | pBuf += keySize; |
| 1766 | pKeys += sizeof(tSirKeys); |
| 1767 | totalKeySize += (tANI_U16) keySize; |
| 1768 | if (numKeys == 0) |
| 1769 | break; |
| 1770 | numKeys--; |
| 1771 | }while (numKeys); |
| 1772 | } |
| 1773 | return eSIR_SUCCESS; |
| 1774 | } /*** end limSetContextReqSerDes() ***/ |
| 1775 | |
| 1776 | /** |
| 1777 | * limRemoveKeyReqSerDes() |
| 1778 | * |
| 1779 | *FUNCTION: |
| 1780 | * This function is called by limProcessSmeMessages() upon receiving |
| 1781 | * SME_REMOVEKEY_REQ from host |
| 1782 | * |
| 1783 | *PARAMS: |
| 1784 | * |
| 1785 | *LOGIC: |
| 1786 | * |
| 1787 | *ASSUMPTIONS: |
| 1788 | * NA |
| 1789 | * |
| 1790 | *NOTE: |
| 1791 | * NA |
| 1792 | * |
| 1793 | * @param pRemoveKeyReq Pointer to tSirSmeRemoveKeyReq being |
| 1794 | * extracted |
| 1795 | * @param pBuf Pointer to serialized buffer |
| 1796 | * |
| 1797 | * @return retCode Indicates whether message is successfully |
| 1798 | * de-serialized (eSIR_SUCCESS) or |
| 1799 | * not (eSIR_FAILURE) |
| 1800 | */ |
| 1801 | |
| 1802 | tSirRetStatus |
| 1803 | limRemoveKeyReqSerDes(tpAniSirGlobal pMac, tpSirSmeRemoveKeyReq pRemoveKeyReq, tANI_U8 *pBuf) |
| 1804 | { |
| 1805 | tANI_S16 len = 0; |
| 1806 | |
| 1807 | #ifdef PE_DEBUG_LOG1 |
| 1808 | tANI_U8 *pTemp = pBuf; |
| 1809 | #endif |
| 1810 | if (!pRemoveKeyReq || !pBuf) |
| 1811 | return eSIR_FAILURE; |
| 1812 | |
| 1813 | pRemoveKeyReq->messageType = limGetU16(pBuf); |
| 1814 | pBuf += sizeof(tANI_U16); |
| 1815 | |
| 1816 | len = pRemoveKeyReq->length = limGetU16(pBuf); |
| 1817 | pBuf += sizeof(tANI_U16); |
| 1818 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 1819 | PELOG1(limLog(pMac, LOG1, FL("SME_REMOVEKEY_REQ length %d bytes is:"), len);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1820 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);) |
| 1821 | |
| 1822 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 1823 | return eSIR_FAILURE; |
| 1824 | |
| 1825 | len -= sizeof(tANI_U32); // skip message header |
| 1826 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1827 | return eSIR_FAILURE; |
| 1828 | |
| 1829 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pRemoveKeyReq->peerMacAddr, |
| 1830 | pBuf, sizeof(tSirMacAddr)); |
| 1831 | pBuf += sizeof(tSirMacAddr); |
| 1832 | len -= sizeof(tSirMacAddr); |
| 1833 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1834 | return eSIR_FAILURE; |
| 1835 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1836 | |
| 1837 | pRemoveKeyReq->edType = *pBuf; |
| 1838 | pBuf += sizeof(tANI_U8); |
| 1839 | len -= sizeof(tANI_U8); |
| 1840 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1841 | return eSIR_FAILURE; |
| 1842 | |
| 1843 | pRemoveKeyReq->wepType = *pBuf; |
| 1844 | |
| 1845 | pBuf += sizeof(tANI_U8); |
| 1846 | len -= sizeof(tANI_U8); |
| 1847 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1848 | return eSIR_FAILURE; |
| 1849 | |
| 1850 | pRemoveKeyReq->keyId = *pBuf; |
| 1851 | |
| 1852 | pBuf += sizeof(tANI_U8); |
| 1853 | len -= sizeof(tANI_U8); |
| 1854 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1855 | return eSIR_FAILURE; |
| 1856 | |
| 1857 | pRemoveKeyReq->unicast = *pBuf; |
| 1858 | len--; |
| 1859 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1860 | return eSIR_FAILURE; |
| 1861 | |
| 1862 | // Extract bssId |
| 1863 | palCopyMemory( pMac->hHdd, pRemoveKeyReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 1864 | pBuf += sizeof(tSirMacAddr); |
| 1865 | len -= sizeof(tSirMacAddr); |
| 1866 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1867 | return eSIR_FAILURE; |
| 1868 | |
| 1869 | // Extract sessionId |
| 1870 | pRemoveKeyReq->sessionId = *pBuf++; |
| 1871 | len--; |
| 1872 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1873 | return eSIR_FAILURE; |
| 1874 | |
| 1875 | // Extract transactionId |
| 1876 | pRemoveKeyReq->transactionId = sirReadU16N(pBuf); |
| 1877 | pBuf += sizeof(tANI_U16); |
| 1878 | len -= sizeof(tANI_U16); |
| 1879 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1880 | return eSIR_FAILURE; |
| 1881 | |
| 1882 | return eSIR_SUCCESS; |
| 1883 | } /*** end limRemoveKeyReqSerDes() ***/ |
| 1884 | |
| 1885 | |
| 1886 | |
| 1887 | /** |
| 1888 | * limDisassocReqSerDes() |
| 1889 | * |
| 1890 | *FUNCTION: |
| 1891 | * This function is called by limProcessSmeMessages() upon receiving |
| 1892 | * SME_DISASSOC_REQ from host |
| 1893 | * |
| 1894 | *PARAMS: |
| 1895 | * |
| 1896 | *LOGIC: |
| 1897 | * |
| 1898 | *ASSUMPTIONS: |
| 1899 | * NA |
| 1900 | * |
| 1901 | *NOTE: |
| 1902 | * NA |
| 1903 | * |
| 1904 | * @param pDisassocReq Pointer to tSirSmeDisassocReq being extracted |
| 1905 | * @param pBuf Pointer to serialized buffer |
| 1906 | * |
| 1907 | * @return retCode Indicates whether message is successfully |
| 1908 | * de-serialized (eSIR_SUCCESS) or |
| 1909 | * not (eSIR_FAILURE) |
| 1910 | */ |
| 1911 | |
| 1912 | tSirRetStatus |
| 1913 | limDisassocReqSerDes(tpAniSirGlobal pMac, tSirSmeDisassocReq *pDisassocReq, tANI_U8 *pBuf) |
| 1914 | { |
| 1915 | tANI_S16 len = 0; |
| 1916 | #ifdef PE_DEBUG_LOG1 |
| 1917 | tANI_U8 *pTemp = pBuf; |
| 1918 | #endif |
| 1919 | |
| 1920 | if (!pDisassocReq || !pBuf) |
| 1921 | return eSIR_FAILURE; |
| 1922 | |
| 1923 | pDisassocReq->messageType = limGetU16(pBuf); |
| 1924 | pBuf += sizeof(tANI_U16); |
| 1925 | |
| 1926 | len = pDisassocReq->length = limGetU16(pBuf); |
| 1927 | pBuf += sizeof(tANI_U16); |
| 1928 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 1929 | PELOG1(limLog(pMac, LOG1, FL("SME_DISASSOC_REQ length %d bytes is:"), len);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1930 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);) |
| 1931 | |
| 1932 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 1933 | return eSIR_FAILURE; |
| 1934 | |
| 1935 | len -= sizeof(tANI_U32); // skip message header |
| 1936 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1937 | return eSIR_FAILURE; |
| 1938 | |
| 1939 | // Extract sessionID |
| 1940 | pDisassocReq->sessionId = *pBuf; |
| 1941 | pBuf += sizeof(tANI_U8); |
| 1942 | len -= sizeof(tANI_U8); |
| 1943 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1944 | return eSIR_FAILURE; |
| 1945 | |
| 1946 | // Extract transactionid |
| 1947 | pDisassocReq->transactionId = limGetU16(pBuf); |
| 1948 | pBuf += sizeof(tANI_U16); |
| 1949 | len -= sizeof(tANI_U16); |
| 1950 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1951 | return eSIR_FAILURE; |
| 1952 | |
| 1953 | // Extract bssId |
| 1954 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pDisassocReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 1955 | pBuf += sizeof(tSirMacAddr); |
| 1956 | len -= sizeof(tSirMacAddr); |
| 1957 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1958 | return eSIR_FAILURE; |
| 1959 | |
| 1960 | // Extract peerMacAddr |
| 1961 | palCopyMemory( pMac->hHdd, pDisassocReq->peerMacAddr, pBuf, sizeof(tSirMacAddr)); |
| 1962 | pBuf += sizeof(tSirMacAddr); |
| 1963 | len -= sizeof(tSirMacAddr); |
| 1964 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1965 | return eSIR_FAILURE; |
| 1966 | |
| 1967 | // Extract reasonCode |
| 1968 | pDisassocReq->reasonCode = limGetU16(pBuf); |
| 1969 | pBuf += sizeof(tANI_U16); |
| 1970 | len -= sizeof(tANI_U16); |
| 1971 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1972 | return eSIR_FAILURE; |
| 1973 | |
| 1974 | pDisassocReq->doNotSendOverTheAir = *pBuf; |
| 1975 | pBuf += sizeof(tANI_U8); |
| 1976 | len -= sizeof(tANI_U8); |
| 1977 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1978 | |
| 1979 | return eSIR_SUCCESS; |
| 1980 | } /*** end limDisassocReqSerDes() ***/ |
| 1981 | |
| 1982 | |
| 1983 | |
| 1984 | /** |
| 1985 | * limDeauthReqSerDes() |
| 1986 | * |
| 1987 | *FUNCTION: |
| 1988 | * This function is called by limProcessSmeMessages() upon receiving |
| 1989 | * SME_DEAUTH_REQ from host |
| 1990 | * |
| 1991 | *PARAMS: |
| 1992 | * |
| 1993 | *LOGIC: |
| 1994 | * |
| 1995 | *ASSUMPTIONS: |
| 1996 | * NA |
| 1997 | * |
| 1998 | *NOTE: |
| 1999 | * NA |
| 2000 | * |
| 2001 | * @param pDeauthReq Pointer to tSirSmeDeauthReq being extracted |
| 2002 | * @param pBuf Pointer to serialized buffer |
| 2003 | * |
| 2004 | * @return retCode Indicates whether message is successfully |
| 2005 | * de-serialized (eSIR_SUCCESS) or |
| 2006 | * not (eSIR_FAILURE) |
| 2007 | */ |
| 2008 | tSirRetStatus |
| 2009 | limDeauthReqSerDes(tpAniSirGlobal pMac, tSirSmeDeauthReq *pDeauthReq, tANI_U8 *pBuf) |
| 2010 | { |
| 2011 | tANI_S16 len = 0; |
| 2012 | |
| 2013 | #ifdef PE_DEBUG_LOG1 |
| 2014 | tANI_U8 *pTemp = pBuf; |
| 2015 | #endif |
| 2016 | |
| 2017 | if (!pDeauthReq || !pBuf) |
| 2018 | return eSIR_FAILURE; |
| 2019 | |
| 2020 | pDeauthReq->messageType = limGetU16(pBuf); |
| 2021 | pBuf += sizeof(tANI_U16); |
| 2022 | |
| 2023 | len = pDeauthReq->length = limGetU16(pBuf); |
| 2024 | pBuf += sizeof(tANI_U16); |
| 2025 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 2026 | PELOG1(limLog(pMac, LOG1, FL("SME_DEAUTH_REQ length %d bytes is:"), len);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2027 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);) |
| 2028 | |
| 2029 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 2030 | return eSIR_FAILURE; |
| 2031 | |
| 2032 | len -= sizeof(tANI_U32); // skip message header |
| 2033 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2034 | return eSIR_FAILURE; |
| 2035 | |
| 2036 | // Extract sessionId |
| 2037 | pDeauthReq->sessionId = *pBuf++; |
| 2038 | len--; |
| 2039 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2040 | return eSIR_FAILURE; |
| 2041 | |
| 2042 | // Extract transactionId |
| 2043 | pDeauthReq->transactionId = limGetU16(pBuf); |
| 2044 | pBuf += sizeof(tANI_U16); |
| 2045 | len -= sizeof(tANI_U16); |
| 2046 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2047 | return eSIR_FAILURE; |
| 2048 | |
| 2049 | // Extract bssId |
| 2050 | palCopyMemory( pMac->hHdd, pDeauthReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 2051 | pBuf += sizeof(tSirMacAddr); |
| 2052 | len -= sizeof(tSirMacAddr); |
| 2053 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2054 | return eSIR_FAILURE; |
| 2055 | |
| 2056 | // Extract peerMacAddr |
| 2057 | palCopyMemory( pMac->hHdd, pDeauthReq->peerMacAddr, pBuf, sizeof(tSirMacAddr)); |
| 2058 | pBuf += sizeof(tSirMacAddr); |
| 2059 | len -= sizeof(tSirMacAddr); |
| 2060 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2061 | return eSIR_FAILURE; |
| 2062 | |
| 2063 | // Extract reasonCode |
| 2064 | pDeauthReq->reasonCode = limGetU16(pBuf); |
| 2065 | pBuf += sizeof(tANI_U16); |
| 2066 | len -= sizeof(tANI_U16); |
| 2067 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2068 | |
| 2069 | return eSIR_SUCCESS; |
| 2070 | } /*** end limDisassocReqSerDes() ***/ |
| 2071 | |
| 2072 | |
| 2073 | |
| 2074 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2075 | |
| 2076 | |
| 2077 | /** |
| 2078 | * limStatSerDes() |
| 2079 | * |
| 2080 | *FUNCTION: |
| 2081 | * This function is called by limSendSmeDisassocNtf() while sending |
| 2082 | * SME_DISASSOC_IND/eWNI_SME_DISASSOC_RSP to host |
| 2083 | * |
| 2084 | *PARAMS: |
| 2085 | * |
| 2086 | *LOGIC: |
| 2087 | * |
| 2088 | *ASSUMPTIONS: |
| 2089 | * NA |
| 2090 | * |
| 2091 | *NOTE: |
| 2092 | * NA |
| 2093 | * |
| 2094 | * @param pAssocInd Pointer to tpAniStaStatStruct being sent |
| 2095 | * @param pBuf Pointer to serialized buffer |
| 2096 | * |
| 2097 | * @return None |
| 2098 | */ |
| 2099 | |
| 2100 | void |
| 2101 | limStatSerDes(tpAniSirGlobal pMac, tpAniStaStatStruct pStat, tANI_U8 *pBuf) |
| 2102 | { |
| 2103 | #ifdef PE_DEBUG_LOG1 |
| 2104 | tANI_U8 *pTemp = pBuf; |
| 2105 | #endif |
| 2106 | |
| 2107 | limCopyU32(pBuf, pStat->sentAesBlksUcastHi); |
| 2108 | pBuf += sizeof(tANI_U32); |
| 2109 | |
| 2110 | limCopyU32(pBuf, pStat->sentAesBlksUcastLo); |
| 2111 | pBuf += sizeof(tANI_U32); |
| 2112 | |
| 2113 | limCopyU32(pBuf, pStat->recvAesBlksUcastHi); |
| 2114 | pBuf += sizeof(tANI_U32); |
| 2115 | |
| 2116 | limCopyU32(pBuf, pStat->recvAesBlksUcastLo); |
| 2117 | pBuf += sizeof(tANI_U32); |
| 2118 | |
| 2119 | limCopyU32(pBuf, pStat->aesFormatErrorUcastCnts); |
| 2120 | pBuf += sizeof(tANI_U32); |
| 2121 | |
| 2122 | limCopyU32(pBuf, pStat->aesReplaysUcast); |
| 2123 | pBuf += sizeof(tANI_U32); |
| 2124 | |
| 2125 | limCopyU32(pBuf, pStat->aesDecryptErrUcast); |
| 2126 | pBuf += sizeof(tANI_U32); |
| 2127 | |
| 2128 | limCopyU32(pBuf, pStat->singleRetryPkts); |
| 2129 | pBuf += sizeof(tANI_U32); |
| 2130 | |
| 2131 | limCopyU32(pBuf, pStat->failedTxPkts); |
| 2132 | pBuf += sizeof(tANI_U32); |
| 2133 | |
| 2134 | limCopyU32(pBuf, pStat->ackTimeouts); |
| 2135 | pBuf += sizeof(tANI_U32); |
| 2136 | |
| 2137 | limCopyU32(pBuf, pStat->multiRetryPkts); |
| 2138 | pBuf += sizeof(tANI_U32); |
| 2139 | |
| 2140 | limCopyU32(pBuf, pStat->fragTxCntsHi); |
| 2141 | pBuf += sizeof(tANI_U32); |
| 2142 | |
| 2143 | limCopyU32(pBuf, pStat->fragTxCntsLo); |
| 2144 | pBuf += sizeof(tANI_U32); |
| 2145 | |
| 2146 | limCopyU32(pBuf, pStat->transmittedPktsHi); |
| 2147 | pBuf += sizeof(tANI_U32); |
| 2148 | |
| 2149 | limCopyU32(pBuf, pStat->transmittedPktsLo); |
| 2150 | pBuf += sizeof(tANI_U32); |
| 2151 | |
| 2152 | limCopyU32(pBuf, pStat->phyStatHi); |
| 2153 | pBuf += sizeof(tANI_U32); |
| 2154 | |
| 2155 | limCopyU32(pBuf, pStat->phyStatLo); |
| 2156 | pBuf += sizeof(tANI_U32); |
| 2157 | |
| 2158 | limCopyU32(pBuf, pStat->uplinkRssi); |
| 2159 | pBuf += sizeof(tANI_U32); |
| 2160 | |
| 2161 | limCopyU32(pBuf, pStat->uplinkSinr); |
| 2162 | pBuf += sizeof(tANI_U32); |
| 2163 | |
| 2164 | limCopyU32(pBuf, pStat->uplinkRate); |
| 2165 | pBuf += sizeof(tANI_U32); |
| 2166 | |
| 2167 | limCopyU32(pBuf, pStat->downlinkRssi); |
| 2168 | pBuf += sizeof(tANI_U32); |
| 2169 | |
| 2170 | limCopyU32(pBuf, pStat->downlinkSinr); |
| 2171 | pBuf += sizeof(tANI_U32); |
| 2172 | |
| 2173 | limCopyU32(pBuf, pStat->downlinkRate); |
| 2174 | pBuf += sizeof(tANI_U32); |
| 2175 | |
| 2176 | limCopyU32(pBuf, pStat->nRcvBytes); |
| 2177 | pBuf += sizeof(tANI_U32); |
| 2178 | |
| 2179 | limCopyU32(pBuf, pStat->nXmitBytes); |
| 2180 | pBuf += sizeof(tANI_U32); |
| 2181 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 2182 | PELOG1(limLog(pMac, LOG1, FL("STAT: length %d bytes is:"), sizeof(tAniStaStatStruct));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2183 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, sizeof(tAniStaStatStruct));) |
| 2184 | |
| 2185 | } /*** end limStatSerDes() ***/ |
| 2186 | |
| 2187 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2188 | |
| 2189 | |
| 2190 | /** |
| 2191 | * limPackBkgndScanFailNotify() |
| 2192 | * |
| 2193 | *FUNCTION: |
| 2194 | * This function is called by limSendSmeWmStatusChangeNtf() |
| 2195 | * to pack the tSirBackgroundScanInfo message |
| 2196 | * |
| 2197 | */ |
| 2198 | void |
| 2199 | limPackBkgndScanFailNotify(tpAniSirGlobal pMac, |
| 2200 | tSirSmeStatusChangeCode statusChangeCode, |
| 2201 | tpSirBackgroundScanInfo pScanInfo, |
| 2202 | tSirSmeWmStatusChangeNtf *pSmeNtf, |
| 2203 | tANI_U8 sessionId) |
| 2204 | { |
| 2205 | |
| 2206 | tANI_U16 length = (sizeof(tANI_U16) * 2) + sizeof(tANI_U8) + |
| 2207 | sizeof(tSirSmeStatusChangeCode) + |
| 2208 | sizeof(tSirBackgroundScanInfo); |
| 2209 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2210 | pSmeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF; |
| 2211 | pSmeNtf->statusChangeCode = statusChangeCode; |
| 2212 | pSmeNtf->length = length; |
| 2213 | pSmeNtf->sessionId = sessionId; |
| 2214 | pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanSuccess = pScanInfo->numOfScanSuccess; |
| 2215 | pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanFailure = pScanInfo->numOfScanFailure; |
| 2216 | pSmeNtf->statusChangeInfo.bkgndScanInfo.reserved = pScanInfo->reserved; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2217 | } |
| 2218 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2219 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2220 | /** |
| 2221 | * limIsSmeGetAssocSTAsReqValid() |
| 2222 | * |
| 2223 | *FUNCTION: |
| 2224 | * This function is called by limProcessSmeReqMessages() upon |
| 2225 | * receiving SME_GET_ASSOC_STAS_REQ message from application. |
| 2226 | * |
| 2227 | *LOGIC: |
| 2228 | * Message validity checks are performed in this function |
| 2229 | * |
| 2230 | *ASSUMPTIONS: |
| 2231 | * |
| 2232 | *NOTE: |
| 2233 | * |
| 2234 | * @param pBuf - Pointer to a serialized SME_GET_ASSOC_STAS_REQ message |
| 2235 | * @param pSmeMsg - Pointer to a tSirSmeGetAssocSTAsReq structure |
| 2236 | * @return true if SME_GET_ASSOC_STAS_REQ message is formatted correctly |
| 2237 | * false otherwise |
| 2238 | */ |
| 2239 | tANI_BOOLEAN |
| 2240 | limIsSmeGetAssocSTAsReqValid(tpAniSirGlobal pMac, tpSirSmeGetAssocSTAsReq pGetAssocSTAsReq, tANI_U8 *pBuf) |
| 2241 | { |
| 2242 | tANI_S16 len = 0; |
| 2243 | |
| 2244 | pGetAssocSTAsReq->messageType = limGetU16(pBuf); |
| 2245 | pBuf += sizeof(tANI_U16); |
| 2246 | |
| 2247 | len = pGetAssocSTAsReq->length = limGetU16(pBuf); |
| 2248 | pBuf += sizeof(tANI_U16); |
| 2249 | |
| 2250 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 2251 | return eSIR_FAILURE; |
| 2252 | |
| 2253 | len -= sizeof(tANI_U32); // skip message header |
| 2254 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2255 | return eSIR_FAILURE; |
| 2256 | |
| 2257 | // Extract bssId |
| 2258 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pGetAssocSTAsReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 2259 | pBuf += sizeof(tSirMacAddr); |
| 2260 | len -= sizeof(tSirMacAddr); |
| 2261 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2262 | return eSIR_FAILURE; |
| 2263 | |
| 2264 | // Extract modId |
| 2265 | pGetAssocSTAsReq->modId = limGetU16(pBuf); |
| 2266 | pBuf += sizeof(tANI_U16); |
| 2267 | len -= sizeof(tANI_U16); |
| 2268 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2269 | return eSIR_FAILURE; |
| 2270 | |
| 2271 | // Extract pUsrContext |
| 2272 | pGetAssocSTAsReq->pUsrContext = (void *)limGetU32(pBuf); |
| 2273 | pBuf += sizeof(tANI_U32); |
| 2274 | len -= sizeof(tANI_U32); |
| 2275 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2276 | return eSIR_FAILURE; |
| 2277 | |
| 2278 | // Extract pSapEventCallback |
| 2279 | pGetAssocSTAsReq->pSapEventCallback = (void *)limGetU32(pBuf); |
| 2280 | pBuf += sizeof(tANI_U32); |
| 2281 | len -= sizeof(tANI_U32); |
| 2282 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2283 | return eSIR_FAILURE; |
| 2284 | |
| 2285 | // Extract pAssocStasArray |
| 2286 | pGetAssocSTAsReq->pAssocStasArray = (void *)limGetU32(pBuf); |
| 2287 | pBuf += sizeof(tANI_U32); |
| 2288 | len -= sizeof(tANI_U32); |
| 2289 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 2290 | PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes "), len);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2291 | |
| 2292 | if (len < 0) |
| 2293 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 2294 | PELOGE(limLog(pMac, LOGE, FL("SME_GET_ASSOC_STAS_REQ invalid length"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2295 | return eANI_BOOLEAN_FALSE; |
| 2296 | } |
| 2297 | |
| 2298 | return eANI_BOOLEAN_TRUE; |
| 2299 | } |
| 2300 | |
| 2301 | /** |
| 2302 | * limTkipCntrMeasReqSerDes() |
| 2303 | * |
| 2304 | *FUNCTION: |
| 2305 | * This function is called by limProcessSmeMessages() upon receiving |
| 2306 | * eWNI_SME_TKIP_CNTR_MEAS_REQ from host HDD |
| 2307 | * |
| 2308 | *PARAMS: |
| 2309 | * |
| 2310 | *LOGIC: |
| 2311 | * |
| 2312 | *ASSUMPTIONS: |
| 2313 | * NA |
| 2314 | * |
| 2315 | *NOTE: |
| 2316 | * NA |
| 2317 | * |
| 2318 | * @param tpSirSmeTkipCntrMeasReq Pointer to tSirSmeTkipCntrMeasReq being extracted |
| 2319 | * @param pBuf Pointer to serialized buffer |
| 2320 | * @return retCode Indicates whether message is successfully |
| 2321 | * de-serialized (eSIR_SUCCESS) or |
| 2322 | * not (eSIR_FAILURE) |
| 2323 | */ |
| 2324 | tSirRetStatus |
| 2325 | limTkipCntrMeasReqSerDes(tpAniSirGlobal pMac, tpSirSmeTkipCntrMeasReq pTkipCntrMeasReq, tANI_U8 *pBuf) |
| 2326 | { |
| 2327 | tANI_S16 len = 0; |
| 2328 | |
| 2329 | #ifdef PE_DEBUG_LOG1 |
| 2330 | tANI_U8 *pTemp = pBuf; |
| 2331 | #endif |
| 2332 | |
| 2333 | pTkipCntrMeasReq->messageType = limGetU16(pBuf); |
| 2334 | pBuf += sizeof(tANI_U16); |
| 2335 | |
| 2336 | len = pTkipCntrMeasReq->length = limGetU16(pBuf); |
| 2337 | pBuf += sizeof(tANI_U16); |
| 2338 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 2339 | PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length %d bytes is:"), len);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2340 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);) |
| 2341 | |
| 2342 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 2343 | return eSIR_FAILURE; |
| 2344 | |
| 2345 | len -= sizeof(tANI_U32); // skip message header |
| 2346 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2347 | return eSIR_FAILURE; |
| 2348 | |
| 2349 | // Extract sessionId |
| 2350 | pTkipCntrMeasReq->sessionId = *pBuf++; |
| 2351 | len--; |
| 2352 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2353 | return eSIR_FAILURE; |
| 2354 | |
| 2355 | // Extract transactionId |
| 2356 | pTkipCntrMeasReq->transactionId = limGetU16(pBuf); |
| 2357 | pBuf += sizeof(tANI_U16); |
| 2358 | len -= sizeof(tANI_U16); |
| 2359 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2360 | return eSIR_FAILURE; |
| 2361 | |
| 2362 | // Extract bssId |
| 2363 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pTkipCntrMeasReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 2364 | pBuf += sizeof(tSirMacAddr); |
| 2365 | len -= sizeof(tSirMacAddr); |
| 2366 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2367 | return eSIR_FAILURE; |
| 2368 | |
| 2369 | // Extract bEnable |
| 2370 | pTkipCntrMeasReq->bEnable = *pBuf++; |
| 2371 | len --; |
| 2372 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 2373 | PELOG1(limLog(pMac, LOG1, FL("SME_TKIP_CNTR_MEAS_REQ length consumed %d bytes "), len);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2374 | |
| 2375 | if (len) |
| 2376 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 2377 | PELOGE(limLog(pMac, LOGE, FL("SME_TKIP_CNTR_MEAS_REQ invalid "));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2378 | return eSIR_FAILURE; |
| 2379 | } |
| 2380 | else |
| 2381 | return eSIR_SUCCESS; |
| 2382 | } |
| 2383 | |
| 2384 | /** |
| 2385 | * limIsSmeGetWPSPBCSessionsReqValid() |
| 2386 | * |
| 2387 | *FUNCTION: |
| 2388 | * This function is called by limProcessSmeGetWPSPBCSessions() upon |
| 2389 | * receiving query WPS PBC overlap information message from application. |
| 2390 | * |
| 2391 | *LOGIC: |
| 2392 | * Message validity checks are performed in this function |
| 2393 | * |
| 2394 | *ASSUMPTIONS: |
| 2395 | * |
| 2396 | *NOTE: |
| 2397 | * |
| 2398 | * @param pBuf - Pointer to a serialized SME_GET_WPSPBC_SESSION_REQ message |
| 2399 | * @param pGetWPSPBCSessionsReq - Pointer to a tSirSmeGetWPSPBCSessionsReq structure |
| 2400 | * @return true if SME_GET_WPSPBC_SESSION_REQ message is formatted correctly |
| 2401 | * false otherwise |
| 2402 | */ |
| 2403 | |
| 2404 | tSirRetStatus |
| 2405 | limIsSmeGetWPSPBCSessionsReqValid(tpAniSirGlobal pMac, tSirSmeGetWPSPBCSessionsReq *pGetWPSPBCSessionsReq, tANI_U8 *pBuf) |
| 2406 | { |
| 2407 | tANI_S16 len = 0; |
| 2408 | |
| 2409 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirSmeGetWPSPBCSessionsReq));) |
| 2410 | |
| 2411 | pGetWPSPBCSessionsReq->messageType = limGetU16(pBuf); |
| 2412 | pBuf += sizeof(tANI_U16); |
| 2413 | |
| 2414 | len = pGetWPSPBCSessionsReq->length = limGetU16(pBuf); |
| 2415 | pBuf += sizeof(tANI_U16); |
| 2416 | |
| 2417 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 2418 | return eSIR_FAILURE; |
| 2419 | |
| 2420 | len -= sizeof(tANI_U32); // skip message header |
| 2421 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2422 | return eSIR_FAILURE; |
| 2423 | |
| 2424 | // Extract pUsrContext |
| 2425 | pGetWPSPBCSessionsReq->pUsrContext = (void *)limGetU32(pBuf); |
| 2426 | pBuf += sizeof(tANI_U32); |
| 2427 | len -= sizeof(tANI_U32); |
| 2428 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2429 | return eSIR_FAILURE; |
| 2430 | |
| 2431 | // Extract pSapEventCallback |
| 2432 | pGetWPSPBCSessionsReq->pSapEventCallback = (void *)limGetU32(pBuf); |
| 2433 | pBuf += sizeof(tANI_U32); |
| 2434 | len -= sizeof(tANI_U32); |
| 2435 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2436 | return eSIR_FAILURE; |
| 2437 | |
| 2438 | // Extract bssId |
| 2439 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pGetWPSPBCSessionsReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 2440 | pBuf += sizeof(tSirMacAddr); |
| 2441 | len -= sizeof(tSirMacAddr); |
| 2442 | |
| 2443 | // Extract MAC address of Station to be removed |
| 2444 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pGetWPSPBCSessionsReq->pRemoveMac, pBuf, sizeof(tSirMacAddr)); |
| 2445 | pBuf += sizeof(tSirMacAddr); |
| 2446 | len -= sizeof(tSirMacAddr); |
| 2447 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 2448 | PELOG1(limLog(pMac, LOG1, FL("SME_GET_ASSOC_STAS_REQ length consumed %d bytes "), len);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2449 | |
| 2450 | if (len < 0) |
| 2451 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 2452 | PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2453 | return eSIR_FAILURE; |
| 2454 | } |
| 2455 | |
| 2456 | return eSIR_SUCCESS; |
| 2457 | } |
| 2458 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2459 | |
| 2460 | /**--------------------------------------------------------------- |
| 2461 | \fn limGetSessionInfo |
| 2462 | \brief This function returns the sessionId and transactionId |
| 2463 | \ of a message. This assumes that the message structure |
| 2464 | \ is of format: |
| 2465 | \ tANI_U16 messageType |
| 2466 | \ tANI_U16 messageLength |
| 2467 | \ tANI_U8 sessionId |
| 2468 | \ tANI_U16 transactionId |
| 2469 | \param pMac - pMac global structure |
| 2470 | \param *pBuf - pointer to the message buffer |
| 2471 | \param sessionId - returned session id value |
| 2472 | \param transactionId - returned transaction ID value |
| 2473 | \return None |
| 2474 | ------------------------------------------------------------------*/ |
| 2475 | void |
| 2476 | limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U8 *sessionId, tANI_U16 *transactionId) |
| 2477 | { |
| 2478 | if (!pBuf) |
| 2479 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 2480 | limLog(pMac, LOGE, FL("NULL ptr received. ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2481 | return; |
| 2482 | } |
| 2483 | |
| 2484 | pBuf += sizeof(tANI_U16); // skip message type |
| 2485 | pBuf += sizeof(tANI_U16); // skip message length |
| 2486 | |
| 2487 | *sessionId = *pBuf; // get sessionId |
| 2488 | pBuf++; |
| 2489 | *transactionId = limGetU16(pBuf); // get transactionId |
| 2490 | |
| 2491 | return; |
| 2492 | } |
| 2493 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2494 | |
| 2495 | /** |
| 2496 | * limUpdateAPWPSIEsReqSerDes() |
| 2497 | * |
| 2498 | *FUNCTION: |
| 2499 | * This function is to deserialize UpdateAPWPSIEs message |
| 2500 | * |
| 2501 | *PARAMS: |
| 2502 | * |
| 2503 | *LOGIC: |
| 2504 | * |
| 2505 | *ASSUMPTIONS: |
| 2506 | * NA |
| 2507 | * |
| 2508 | *NOTE: |
| 2509 | * NA |
| 2510 | * |
| 2511 | * @param pUpdateAPWPSIEsReq Pointer to tSirUpdateAPWPSIEsReq being |
| 2512 | * extracted |
| 2513 | * @param pBuf Pointer to serialized buffer |
| 2514 | * |
| 2515 | * @return retCode Indicates whether message is successfully |
| 2516 | * de-serialized (eSIR_SUCCESS) or |
| 2517 | * not (eSIR_FAILURE) |
| 2518 | */ |
| 2519 | |
| 2520 | tSirRetStatus |
| 2521 | limUpdateAPWPSIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq, tANI_U8 *pBuf) |
| 2522 | { |
| 2523 | tANI_S16 len = 0; |
| 2524 | |
| 2525 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPSIEsReq));) |
| 2526 | |
| 2527 | if (!pUpdateAPWPSIEsReq || !pBuf) |
| 2528 | return eSIR_FAILURE; |
| 2529 | |
| 2530 | pUpdateAPWPSIEsReq->messageType = limGetU16(pBuf); |
| 2531 | pBuf += sizeof(tANI_U16); |
| 2532 | |
| 2533 | len = pUpdateAPWPSIEsReq->length = limGetU16(pBuf); |
| 2534 | pBuf += sizeof(tANI_U16); |
| 2535 | |
| 2536 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 2537 | return eSIR_FAILURE; |
| 2538 | |
| 2539 | len -= sizeof(tANI_U32); // skip message header |
| 2540 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2541 | return eSIR_FAILURE; |
| 2542 | |
| 2543 | // Extract transactionId |
| 2544 | pUpdateAPWPSIEsReq->transactionId = limGetU16( pBuf ); |
| 2545 | pBuf += sizeof( tANI_U16 ); |
| 2546 | len -= sizeof( tANI_U16 ); |
| 2547 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2548 | return eSIR_FAILURE; |
| 2549 | |
| 2550 | // Extract bssId |
| 2551 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pUpdateAPWPSIEsReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 2552 | pBuf += sizeof(tSirMacAddr); |
| 2553 | len -= sizeof(tSirMacAddr); |
| 2554 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2555 | return eSIR_FAILURE; |
| 2556 | |
| 2557 | // Extract sessionId |
| 2558 | pUpdateAPWPSIEsReq->sessionId = *pBuf++; |
| 2559 | len--; |
| 2560 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2561 | return eSIR_FAILURE; |
| 2562 | |
| 2563 | // Extract APWPSIEs |
| 2564 | palCopyMemory( pMac->hHdd, (tSirAPWPSIEs *) &pUpdateAPWPSIEsReq->APWPSIEs, pBuf, sizeof(tSirAPWPSIEs)); |
| 2565 | pBuf += sizeof(tSirAPWPSIEs); |
| 2566 | len -= sizeof(tSirAPWPSIEs); |
| 2567 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 2568 | PELOG1(limLog(pMac, LOG1, FL("SME_UPDATE_APWPSIE_REQ length consumed %d bytes "), len);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2569 | |
| 2570 | if (len < 0) |
| 2571 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 2572 | PELOGE(limLog(pMac, LOGE, FL("SME_UPDATE_APWPSIE_REQ invalid length"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2573 | return eSIR_FAILURE; |
| 2574 | } |
| 2575 | |
| 2576 | return eSIR_SUCCESS; |
| 2577 | } /*** end limSetContextReqSerDes() ***/ |
| 2578 | |
| 2579 | /** |
| 2580 | * limUpdateAPWPARSNIEsReqSerDes () |
| 2581 | * |
| 2582 | *FUNCTION: |
| 2583 | * This function is to deserialize UpdateAPWPSIEs message |
| 2584 | * |
| 2585 | *PARAMS: |
| 2586 | * |
| 2587 | *LOGIC: |
| 2588 | * |
| 2589 | *ASSUMPTIONS: |
| 2590 | * NA |
| 2591 | * |
| 2592 | *NOTE: |
| 2593 | * NA |
| 2594 | * |
| 2595 | * @param pUpdateAPWPARSNIEsReq Pointer to tpSirUpdateAPWPARSNIEsReq being |
| 2596 | * extracted |
| 2597 | * @param pBuf Pointer to serialized buffer |
| 2598 | * |
| 2599 | * @return retCode Indicates whether message is successfully |
| 2600 | * de-serialized (eSIR_SUCCESS) or |
| 2601 | * not (eSIR_FAILURE) |
| 2602 | */ |
| 2603 | |
| 2604 | tSirRetStatus |
| 2605 | limUpdateAPWPARSNIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq, tANI_U8 *pBuf) |
| 2606 | { |
| 2607 | tANI_S16 len = 0; |
| 2608 | |
| 2609 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPARSNIEsReq));) |
| 2610 | |
| 2611 | if (!pUpdateAPWPARSNIEsReq || !pBuf) |
| 2612 | return eSIR_FAILURE; |
| 2613 | |
| 2614 | pUpdateAPWPARSNIEsReq->messageType = limGetU16(pBuf); |
| 2615 | pBuf += sizeof(tANI_U16); |
| 2616 | |
| 2617 | len = pUpdateAPWPARSNIEsReq->length = limGetU16(pBuf); |
| 2618 | pBuf += sizeof(tANI_U16); |
| 2619 | |
| 2620 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 2621 | return eSIR_FAILURE; |
| 2622 | |
| 2623 | len -= sizeof(tANI_U32); // skip message header |
| 2624 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2625 | return eSIR_FAILURE; |
| 2626 | |
| 2627 | // Extract transactionId |
| 2628 | pUpdateAPWPARSNIEsReq->transactionId = limGetU16( pBuf ); |
| 2629 | pBuf += sizeof(tANI_U16); |
| 2630 | len -= sizeof( tANI_U16 ); |
| 2631 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2632 | return eSIR_FAILURE; |
| 2633 | |
| 2634 | // Extract bssId |
| 2635 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pUpdateAPWPARSNIEsReq->bssId, pBuf, sizeof(tSirMacAddr)); |
| 2636 | pBuf += sizeof(tSirMacAddr); |
| 2637 | len -= sizeof(tSirMacAddr); |
| 2638 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2639 | return eSIR_FAILURE; |
| 2640 | |
| 2641 | // Extract sessionId |
| 2642 | pUpdateAPWPARSNIEsReq->sessionId = *pBuf++; |
| 2643 | len--; |
| 2644 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2645 | return eSIR_FAILURE; |
| 2646 | |
| 2647 | // Extract APWPARSNIEs |
| 2648 | palCopyMemory( pMac->hHdd, (tSirRSNie *) &pUpdateAPWPARSNIEsReq->APWPARSNIEs, pBuf, sizeof(tSirRSNie)); |
| 2649 | pBuf += sizeof(tSirRSNie); |
| 2650 | len -= sizeof(tSirRSNie); |
| 2651 | |
| 2652 | if (len < 0) |
| 2653 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame^] | 2654 | PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2655 | return eSIR_FAILURE; |
| 2656 | } |
| 2657 | |
| 2658 | return eSIR_SUCCESS; |
| 2659 | } /*** end limUpdateAPWPARSNIEsReqSerDes() ***/ |
| 2660 | |