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 |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 136 | vos_mem_copy( (tANI_U8 *) pBssDescription->bssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 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 |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 144 | vos_mem_copy( (tANI_U8 *) (&pBssDescription->scanSysTimeMsec), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 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 |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 152 | vos_mem_copy( (tANI_U8 *) pBssDescription->timeStamp, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 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 */ |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 282 | vos_mem_copy( (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 | { |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 301 | vos_mem_copy( (tANI_U8 *) pBssDescription->ieFields, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 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 | |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 347 | vos_mem_copy( pBuf, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 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 | |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 358 | vos_mem_copy( pBuf, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 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 | |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 396 | vos_mem_copy( pBuf, (tANI_U8 *) &(pBssDescription->ieFields), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 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 | |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 440 | vos_mem_copy( pKeyInfo->keyRsc, pBuf, WLAN_MAX_KEY_RSC_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 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); |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 450 | vos_mem_copy( pKeyInfo->key, pBuf, pKeyInfo->keyLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 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 |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 531 | vos_mem_copy( (tANI_U8 *) pStartBssReq->bssId, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 532 | pBuf += sizeof(tSirMacAddr); |
| 533 | len -= sizeof(tSirMacAddr); |
| 534 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 535 | return eSIR_FAILURE; |
| 536 | |
| 537 | // Extract selfMacAddr |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 538 | vos_mem_copy( (tANI_U8 *) pStartBssReq->selfMacAddr, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 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 | |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 582 | vos_mem_copy( (tANI_U8 *) pStartBssReq->ssId.ssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 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 | |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 664 | // Extract isCoalesingInIBSSAllowed |
| 665 | pStartBssReq->isCoalesingInIBSSAllowed = *pBuf++; |
| 666 | len--; |
| 667 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 668 | return eSIR_FAILURE; |
| 669 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 670 | // Extract bssPersona |
| 671 | pStartBssReq->bssPersona = *pBuf++; |
| 672 | len--; |
| 673 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 674 | return eSIR_FAILURE; |
| 675 | |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 676 | |
| 677 | // Extract txLdpcIniFeatureEnabled |
| 678 | pStartBssReq->txLdpcIniFeatureEnabled = *pBuf++; |
| 679 | len--; |
| 680 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 681 | return eSIR_FAILURE; |
| 682 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 683 | // Extract rsnIe |
| 684 | pStartBssReq->rsnIE.length = limGetU16(pBuf); |
| 685 | pBuf += sizeof(tANI_U16); |
| 686 | |
| 687 | // Check for RSN IE length (that includes length of type & length |
| 688 | if (pStartBssReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2) |
| 689 | { |
| 690 | limLog(pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 691 | FL("Invalid RSN IE length %d in SME_START_BSS_REQ"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 692 | pStartBssReq->rsnIE.length); |
| 693 | return eSIR_FAILURE; |
| 694 | } |
| 695 | |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 696 | vos_mem_copy( pStartBssReq->rsnIE.rsnIEdata, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 697 | pBuf, pStartBssReq->rsnIE.length); |
| 698 | |
| 699 | len -= (sizeof(tANI_U16) + pStartBssReq->rsnIE.length); |
| 700 | pBuf += pStartBssReq->rsnIE.length; |
| 701 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 702 | return eSIR_FAILURE; |
| 703 | |
| 704 | // Extract nwType |
| 705 | pStartBssReq->nwType = (tSirNwType) limGetU32(pBuf); |
| 706 | pBuf += sizeof(tSirNwType); |
| 707 | len -= sizeof(tSirNwType); |
| 708 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 709 | return eSIR_FAILURE; |
| 710 | |
| 711 | // Extract operationalRateSet |
| 712 | pStartBssReq->operationalRateSet.numRates = *pBuf++; |
| 713 | |
| 714 | // Check for number of rates |
| 715 | if (pStartBssReq->operationalRateSet.numRates > |
| 716 | SIR_MAC_MAX_NUMBER_OF_RATES) |
| 717 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 718 | limLog(pMac, LOGW, FL("Invalid numRates %d in SME_START_BSS_REQ"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 719 | pStartBssReq->operationalRateSet.numRates); |
| 720 | return eSIR_FAILURE; |
| 721 | } |
| 722 | |
| 723 | len--; |
| 724 | if (len < pStartBssReq->operationalRateSet.numRates) |
| 725 | return eSIR_FAILURE; |
| 726 | |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 727 | vos_mem_copy( (tANI_U8 *) pStartBssReq->operationalRateSet.rate, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 728 | pBuf, |
| 729 | pStartBssReq->operationalRateSet.numRates); |
| 730 | pBuf += pStartBssReq->operationalRateSet.numRates; |
| 731 | len -= pStartBssReq->operationalRateSet.numRates; |
| 732 | |
| 733 | // Extract extendedRateSet |
| 734 | if ((pStartBssReq->nwType == eSIR_11G_NW_TYPE) || |
| 735 | (pStartBssReq->nwType == eSIR_11N_NW_TYPE )) |
| 736 | { |
| 737 | pStartBssReq->extendedRateSet.numRates = *pBuf++; |
| 738 | len--; |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 739 | vos_mem_copy( pStartBssReq->extendedRateSet.rate, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 740 | pBuf, pStartBssReq->extendedRateSet.numRates); |
| 741 | pBuf += pStartBssReq->extendedRateSet.numRates; |
| 742 | len -= pStartBssReq->extendedRateSet.numRates; |
| 743 | } |
| 744 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 745 | if (len) |
| 746 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 747 | 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] | 748 | } |
| 749 | |
| 750 | return eSIR_SUCCESS; |
| 751 | } /*** end limStartBssReqSerDes() ***/ |
| 752 | |
| 753 | |
| 754 | |
| 755 | /** |
| 756 | * limStopBssReqSerDes() |
| 757 | * |
| 758 | *FUNCTION: |
| 759 | * This function is called by limProcessSmeMessages() upon receiving |
| 760 | * SME_STOP_BSS_REQ from host |
| 761 | * |
| 762 | *PARAMS: |
| 763 | * |
| 764 | *LOGIC: |
| 765 | * |
| 766 | *ASSUMPTIONS: |
| 767 | * NA |
| 768 | * |
| 769 | *NOTE: |
| 770 | * NA |
| 771 | * |
| 772 | * @param pStopBssReq Pointer to tSirSmeStopBssReq being extracted |
| 773 | * @param pBuf Pointer to serialized buffer |
| 774 | * @return retCode Indicates whether message is successfully |
| 775 | * de-serialized (eSIR_SUCCESS) or |
| 776 | * not (eSIR_FAILURE) |
| 777 | */ |
| 778 | |
| 779 | tSirRetStatus |
| 780 | limStopBssReqSerDes(tpAniSirGlobal pMac, tpSirSmeStopBssReq pStopBssReq, tANI_U8 *pBuf) |
| 781 | { |
| 782 | tANI_S16 len = 0; |
| 783 | |
| 784 | #ifdef PE_DEBUG_LOG1 |
| 785 | tANI_U8 *pTemp = pBuf; |
| 786 | #endif |
| 787 | |
| 788 | pStopBssReq->messageType = limGetU16(pBuf); |
| 789 | pBuf += sizeof(tANI_U16); |
| 790 | |
| 791 | len = pStopBssReq->length = limGetU16(pBuf); |
| 792 | pBuf += sizeof(tANI_U16); |
| 793 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 794 | 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] | 795 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);) |
| 796 | |
| 797 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 798 | return eSIR_FAILURE; |
| 799 | |
| 800 | len -= sizeof(tANI_U32); // skip message header |
| 801 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 802 | return eSIR_FAILURE; |
| 803 | |
| 804 | // Extract sessionId |
| 805 | pStopBssReq->sessionId = *pBuf++; |
| 806 | len--; |
| 807 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 808 | return eSIR_FAILURE; |
| 809 | |
| 810 | // Extract transactionId |
| 811 | pStopBssReq->transactionId = limGetU16(pBuf); |
| 812 | pBuf += sizeof(tANI_U16); |
| 813 | len -= sizeof(tANI_U16); |
| 814 | |
| 815 | // Extract reasonCode |
| 816 | pStopBssReq->reasonCode = (tSirResultCodes) limGetU32(pBuf); |
| 817 | pBuf += sizeof(tSirResultCodes); |
| 818 | len -= sizeof(tSirResultCodes); |
| 819 | |
| 820 | // Extract bssId |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 821 | vos_mem_copy( (tANI_U8 *) pStopBssReq->bssId, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 822 | len -= sizeof(tSirMacAddr); |
| 823 | |
| 824 | if (len) |
| 825 | return eSIR_FAILURE; |
| 826 | else |
| 827 | return eSIR_SUCCESS; |
| 828 | |
| 829 | } /*** end limStopBssReqSerDes() ***/ |
| 830 | |
| 831 | |
| 832 | |
| 833 | /** |
| 834 | * limJoinReqSerDes() |
| 835 | * |
| 836 | *FUNCTION: |
| 837 | * This function is called by limProcessSmeMessages() upon receiving |
| 838 | * SME_JOIN_REQ from host |
| 839 | * |
| 840 | *PARAMS: |
| 841 | * |
| 842 | *LOGIC: |
| 843 | * |
| 844 | *ASSUMPTIONS: |
| 845 | * NA |
| 846 | * |
| 847 | *NOTE: |
| 848 | * NA |
| 849 | * |
| 850 | * @param pJoinReq Pointer to tSirSmeJoinReq being extracted |
| 851 | * @param pBuf Pointer to serialized buffer |
| 852 | * @return retCode Indicates whether message is successfully |
| 853 | * de-serialized (eSIR_SUCCESS) or |
| 854 | * not (eSIR_FAILURE) |
| 855 | */ |
| 856 | |
| 857 | tSirRetStatus |
| 858 | limJoinReqSerDes(tpAniSirGlobal pMac, tpSirSmeJoinReq pJoinReq, tANI_U8 *pBuf) |
| 859 | { |
| 860 | tANI_S16 len = 0; |
| 861 | tANI_S16 lenUsed = 0; |
| 862 | |
| 863 | #ifdef PE_DEBUG_LOG1 |
| 864 | tANI_U8 *pTemp = pBuf; |
| 865 | #endif |
| 866 | |
| 867 | if (!pJoinReq || !pBuf) |
| 868 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 869 | PELOGE(limLog(pMac, LOGE, FL("pJoinReq or pBuf is NULL"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 870 | return eSIR_FAILURE; |
| 871 | } |
| 872 | |
| 873 | // Extract messageType |
| 874 | pJoinReq->messageType = limGetU16(pBuf); |
| 875 | pBuf += sizeof(tANI_U16); |
| 876 | |
| 877 | // Extract length |
| 878 | len = pJoinReq->length = limGetU16(pBuf); |
| 879 | pBuf += sizeof(tANI_U16); |
| 880 | |
| 881 | if (pJoinReq->messageType == eWNI_SME_JOIN_REQ) |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 882 | 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] | 883 | else |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 884 | PELOG1(limLog(pMac, LOG3, FL("SME_REASSOC_REQ length %d bytes is:"), |
| 885 | len);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 886 | |
| 887 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);) |
| 888 | |
| 889 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 890 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 891 | PELOGE(limLog(pMac, LOGE, FL("len %d is too short"), len);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 892 | return eSIR_FAILURE; |
| 893 | } |
| 894 | |
| 895 | len -= sizeof(tANI_U32); // skip message header |
| 896 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 897 | { |
| 898 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 899 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 900 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 901 | // Extract sessionId |
| 902 | pJoinReq->sessionId = *pBuf++; |
| 903 | len--; |
| 904 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 905 | { |
| 906 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 907 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 908 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 909 | // Extract transactionId |
| 910 | pJoinReq->transactionId = limGetU16(pBuf); |
| 911 | pBuf += sizeof(tANI_U16); |
| 912 | len -= sizeof(tANI_U16); |
| 913 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 914 | { |
| 915 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 916 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 917 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 918 | |
| 919 | // Extract ssId |
| 920 | pJoinReq->ssId.length = *pBuf++; |
| 921 | len--; |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 922 | vos_mem_copy( (tANI_U8 *) pJoinReq->ssId.ssId, pBuf, pJoinReq->ssId.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 923 | pBuf += pJoinReq->ssId.length; |
| 924 | len -= pJoinReq->ssId.length; |
| 925 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 926 | { |
| 927 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 928 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 929 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 930 | |
| 931 | // Extract selfMacAddr |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 932 | vos_mem_copy( pJoinReq->selfMacAddr, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 933 | pBuf += sizeof(tSirMacAddr); |
| 934 | len -= sizeof(tSirMacAddr); |
| 935 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 936 | { |
| 937 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 938 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 939 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 940 | |
| 941 | // Extract bsstype |
| 942 | pJoinReq->bsstype = (tSirBssType) limGetU32(pBuf); |
| 943 | pBuf += sizeof(tANI_U32); |
| 944 | len -= sizeof(tANI_U32); |
| 945 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 946 | { |
| 947 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 948 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 949 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 950 | |
| 951 | // Extract dot11mode |
| 952 | pJoinReq->dot11mode= *pBuf++; |
| 953 | len--; |
| 954 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 955 | { |
| 956 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 957 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 958 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 959 | |
| 960 | // Extract bssPersona |
| 961 | pJoinReq->staPersona = *pBuf++; |
| 962 | len--; |
| 963 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 964 | { |
| 965 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 966 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 967 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 968 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 969 | // Extract cbMode |
| 970 | pJoinReq->cbMode = *pBuf++; |
| 971 | len--; |
| 972 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 973 | { |
| 974 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 975 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 976 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 977 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 978 | // Extract uapsdPerAcBitmask |
| 979 | pJoinReq->uapsdPerAcBitmask = *pBuf++; |
| 980 | len--; |
| 981 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 982 | { |
| 983 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 984 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 985 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 986 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 987 | |
| 988 | // Extract operationalRateSet |
| 989 | pJoinReq->operationalRateSet.numRates= *pBuf++; |
| 990 | len--; |
| 991 | if (pJoinReq->operationalRateSet.numRates) |
| 992 | { |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 993 | vos_mem_copy( (tANI_U8 *) pJoinReq->operationalRateSet.rate, pBuf, |
| 994 | pJoinReq->operationalRateSet.numRates); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 995 | pBuf += pJoinReq->operationalRateSet.numRates; |
| 996 | len -= pJoinReq->operationalRateSet.numRates; |
| 997 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 998 | { |
| 999 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1000 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1001 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1002 | } |
| 1003 | |
| 1004 | // Extract extendedRateSet |
| 1005 | pJoinReq->extendedRateSet.numRates = *pBuf++; |
| 1006 | len--; |
| 1007 | if (pJoinReq->extendedRateSet.numRates) |
| 1008 | { |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1009 | vos_mem_copy( pJoinReq->extendedRateSet.rate, pBuf, pJoinReq->extendedRateSet.numRates); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1010 | pBuf += pJoinReq->extendedRateSet.numRates; |
| 1011 | len -= pJoinReq->extendedRateSet.numRates; |
| 1012 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1013 | { |
| 1014 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1015 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1016 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1017 | } |
| 1018 | |
| 1019 | // Extract RSN IE |
| 1020 | pJoinReq->rsnIE.length = limGetU16(pBuf); |
| 1021 | pBuf += sizeof(tANI_U16); |
| 1022 | len -= sizeof(tANI_U16); |
| 1023 | |
| 1024 | if (pJoinReq->rsnIE.length) |
| 1025 | { |
| 1026 | // Check for RSN IE length (that includes length of type & length) |
| 1027 | if ((pJoinReq->rsnIE.length > SIR_MAC_MAX_IE_LENGTH + 2) || |
| 1028 | (pJoinReq->rsnIE.length != 2 + *(pBuf + 1))) |
| 1029 | { |
| 1030 | limLog(pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1031 | FL("Invalid RSN IE length %d in SME_JOIN_REQ"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1032 | pJoinReq->rsnIE.length); |
| 1033 | return eSIR_FAILURE; |
| 1034 | } |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1035 | vos_mem_copy( (tANI_U8 *) pJoinReq->rsnIE.rsnIEdata, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1036 | pBuf, pJoinReq->rsnIE.length); |
| 1037 | pBuf += pJoinReq->rsnIE.length; |
| 1038 | len -= pJoinReq->rsnIE.length; // skip RSN IE |
| 1039 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1040 | { |
| 1041 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1042 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1043 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1044 | } |
| 1045 | |
| 1046 | #ifdef FEATURE_WLAN_CCX |
| 1047 | // Extract CCKM IE |
| 1048 | pJoinReq->cckmIE.length = limGetU16(pBuf); |
| 1049 | pBuf += sizeof(tANI_U16); |
| 1050 | len -= sizeof(tANI_U16); |
| 1051 | if (pJoinReq->cckmIE.length) |
| 1052 | { |
| 1053 | // Check for CCKM IE length (that includes length of type & length) |
| 1054 | if ((pJoinReq->cckmIE.length > SIR_MAC_MAX_IE_LENGTH) || |
| 1055 | (pJoinReq->cckmIE.length != (2 + *(pBuf + 1)))) |
| 1056 | { |
| 1057 | limLog(pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1058 | FL("Invalid CCKM IE length %d/%d in SME_JOIN/REASSOC_REQ"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1059 | pJoinReq->cckmIE.length, 2 + *(pBuf + 1)); |
| 1060 | return eSIR_FAILURE; |
| 1061 | } |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1062 | vos_mem_copy((tANI_U8 *) pJoinReq->cckmIE.cckmIEdata, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1063 | pBuf, pJoinReq->cckmIE.length); |
| 1064 | pBuf += pJoinReq->cckmIE.length; |
| 1065 | len -= pJoinReq->cckmIE.length; // skip CCKM IE |
| 1066 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1067 | { |
| 1068 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1069 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1070 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1071 | } |
| 1072 | #endif |
| 1073 | |
| 1074 | // Extract Add IE for scan |
| 1075 | pJoinReq->addIEScan.length = limGetU16(pBuf); |
| 1076 | pBuf += sizeof(tANI_U16); |
| 1077 | len -= sizeof(tANI_U16); |
| 1078 | |
| 1079 | if (pJoinReq->addIEScan.length) |
| 1080 | { |
| 1081 | // Check for IE length (that includes length of type & length) |
| 1082 | if (pJoinReq->addIEScan.length > SIR_MAC_MAX_IE_LENGTH + 2) |
| 1083 | { |
| 1084 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1085 | FL("Invalid addIE Scan length %d in SME_JOIN_REQ"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1086 | pJoinReq->addIEScan.length); |
| 1087 | return eSIR_FAILURE; |
| 1088 | } |
| 1089 | // Check for P2P IE length (that includes length of type & length) |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1090 | vos_mem_copy( (tANI_U8 *) pJoinReq->addIEScan.addIEdata, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1091 | pBuf, pJoinReq->addIEScan.length); |
| 1092 | pBuf += pJoinReq->addIEScan.length; |
| 1093 | len -= pJoinReq->addIEScan.length; // skip add IE |
| 1094 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1095 | { |
| 1096 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1097 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1098 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1099 | } |
| 1100 | |
| 1101 | pJoinReq->addIEAssoc.length = limGetU16(pBuf); |
| 1102 | pBuf += sizeof(tANI_U16); |
| 1103 | len -= sizeof(tANI_U16); |
| 1104 | |
| 1105 | // Extract Add IE for assoc |
| 1106 | if (pJoinReq->addIEAssoc.length) |
| 1107 | { |
| 1108 | // Check for IE length (that includes length of type & length) |
| 1109 | if (pJoinReq->addIEAssoc.length > SIR_MAC_MAX_IE_LENGTH + 2) |
| 1110 | { |
| 1111 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1112 | FL("Invalid addIE Assoc length %d in SME_JOIN_REQ"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1113 | pJoinReq->addIEAssoc.length); |
| 1114 | return eSIR_FAILURE; |
| 1115 | } |
| 1116 | // Check for P2P IE length (that includes length of type & length) |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1117 | vos_mem_copy( (tANI_U8 *) pJoinReq->addIEAssoc.addIEdata, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1118 | pBuf, pJoinReq->addIEAssoc.length); |
| 1119 | pBuf += pJoinReq->addIEAssoc.length; |
| 1120 | len -= pJoinReq->addIEAssoc.length; // skip add IE |
| 1121 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1122 | { |
| 1123 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1124 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1125 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1126 | } |
| 1127 | |
Venkata Prathyusha Kuntupalli | e8dc41d | 2013-04-15 14:31:36 -0700 | [diff] [blame] | 1128 | pJoinReq->UCEncryptionType = limGetU32(pBuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1129 | pBuf += sizeof(tANI_U32); |
| 1130 | len -= sizeof(tANI_U32); |
| 1131 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1132 | { |
| 1133 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
| 1134 | return eSIR_FAILURE; |
| 1135 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1136 | |
Venkata Prathyusha Kuntupalli | e8dc41d | 2013-04-15 14:31:36 -0700 | [diff] [blame] | 1137 | pJoinReq->MCEncryptionType = limGetU32(pBuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1138 | pBuf += sizeof(tANI_U32); |
| 1139 | len -= sizeof(tANI_U32); |
| 1140 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1141 | { |
| 1142 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
| 1143 | return eSIR_FAILURE; |
| 1144 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1145 | #ifdef WLAN_FEATURE_11W |
| 1146 | pJoinReq->MgmtEncryptionType = limGetU32(pBuf); |
| 1147 | pBuf += sizeof(tANI_U32); |
| 1148 | len -= sizeof(tANI_U32); |
| 1149 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1150 | { |
| 1151 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1152 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1153 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1154 | #endif |
| 1155 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1156 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1157 | //is11Rconnection; |
| 1158 | pJoinReq->is11Rconnection = (tAniBool)limGetU32(pBuf); |
| 1159 | pBuf += sizeof(tAniBool); |
| 1160 | len -= sizeof(tAniBool); |
| 1161 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1162 | { |
| 1163 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
| 1164 | return eSIR_FAILURE; |
| 1165 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1166 | #endif |
| 1167 | |
| 1168 | #ifdef FEATURE_WLAN_CCX |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 1169 | //CCX version IE |
| 1170 | pJoinReq->isCCXFeatureIniEnabled = (tAniBool)limGetU32(pBuf); |
| 1171 | pBuf += sizeof(tAniBool); |
| 1172 | len -= sizeof(tAniBool); |
| 1173 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1174 | { |
| 1175 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 1176 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1177 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 1178 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1179 | //isCCXconnection; |
| 1180 | pJoinReq->isCCXconnection = (tAniBool)limGetU32(pBuf); |
| 1181 | pBuf += sizeof(tAniBool); |
| 1182 | len -= sizeof(tAniBool); |
| 1183 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1184 | { |
| 1185 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
| 1186 | return eSIR_FAILURE; |
| 1187 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1188 | |
| 1189 | // TSPEC information |
| 1190 | pJoinReq->ccxTspecInfo.numTspecs = *pBuf++; |
| 1191 | len -= sizeof(tANI_U8); |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1192 | vos_mem_copy((void*)&pJoinReq->ccxTspecInfo.tspec[0], pBuf, |
| 1193 | (sizeof(tTspecInfo)* pJoinReq->ccxTspecInfo.numTspecs)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1194 | pBuf += sizeof(tTspecInfo)*SIR_CCX_MAX_TSPEC_IES; |
| 1195 | len -= sizeof(tTspecInfo)*SIR_CCX_MAX_TSPEC_IES; |
| 1196 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1197 | { |
| 1198 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1199 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1200 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1201 | #endif |
| 1202 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1203 | #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] | 1204 | //isFastTransitionEnabled; |
| 1205 | pJoinReq->isFastTransitionEnabled = (tAniBool)limGetU32(pBuf); |
| 1206 | pBuf += sizeof(tAniBool); |
| 1207 | len -= sizeof(tAniBool); |
| 1208 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1209 | { |
| 1210 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
| 1211 | return eSIR_FAILURE; |
| 1212 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1213 | #endif |
| 1214 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1215 | #ifdef FEATURE_WLAN_LFR |
| 1216 | //isFastRoamIniFeatureEnabled; |
| 1217 | pJoinReq->isFastRoamIniFeatureEnabled = (tAniBool)limGetU32(pBuf); |
| 1218 | pBuf += sizeof(tAniBool); |
| 1219 | len -= sizeof(tAniBool); |
| 1220 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1221 | { |
| 1222 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
| 1223 | return eSIR_FAILURE; |
| 1224 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1225 | #endif |
| 1226 | |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 1227 | //txLdpcIniFeatureEnabled |
| 1228 | pJoinReq->txLdpcIniFeatureEnabled= *pBuf++; |
| 1229 | len--; |
| 1230 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1231 | { |
| 1232 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 1233 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1234 | } |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 1235 | |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1236 | //txBFIniFeatureEnabled |
| 1237 | pJoinReq->txBFIniFeatureEnabled= *pBuf++; |
| 1238 | len--; |
| 1239 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1240 | { |
| 1241 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1242 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1243 | } |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 1244 | |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 1245 | //txBFCsnValue |
| 1246 | pJoinReq->txBFCsnValue= *pBuf++; |
| 1247 | len--; |
| 1248 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1249 | { |
| 1250 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 1251 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1252 | } |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 1253 | |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 1254 | pJoinReq->isAmsduSupportInAMPDU= *pBuf++; |
| 1255 | len--; |
| 1256 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1257 | { |
| 1258 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 1259 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1260 | } |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 1261 | |
Sandeep Puligilla | aea98a2 | 2013-12-04 13:36:32 +0530 | [diff] [blame] | 1262 | pJoinReq->isWMEenabled = (tAniBool)limGetU32(pBuf); |
| 1263 | pBuf += sizeof(tAniBool); |
| 1264 | len -= sizeof(tAniBool); |
| 1265 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1266 | return eSIR_FAILURE; |
| 1267 | |
| 1268 | pJoinReq->isQosEnabled = (tAniBool)limGetU32(pBuf); |
| 1269 | pBuf += sizeof(tAniBool); |
| 1270 | len -= sizeof(tAniBool); |
| 1271 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1272 | return eSIR_FAILURE; |
| 1273 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1274 | // Extract Titan CB Neighbor BSS info |
| 1275 | pJoinReq->cbNeighbors.cbBssFoundPri = *pBuf; |
| 1276 | pBuf++; |
| 1277 | pJoinReq->cbNeighbors.cbBssFoundSecUp = *pBuf; |
| 1278 | pBuf++; |
| 1279 | pJoinReq->cbNeighbors.cbBssFoundSecDown = *pBuf; |
| 1280 | pBuf++; |
| 1281 | len -= 3; |
| 1282 | |
| 1283 | // Extract Spectrum Mgt Indicator |
| 1284 | pJoinReq->spectrumMgtIndicator = (tAniBool) limGetU32(pBuf); |
| 1285 | pBuf += sizeof(tAniBool); |
| 1286 | len -= sizeof(tAniBool); |
| 1287 | |
| 1288 | pJoinReq->powerCap.minTxPower = *pBuf++; |
| 1289 | pJoinReq->powerCap.maxTxPower = *pBuf++; |
| 1290 | len -=2; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1291 | |
| 1292 | pJoinReq->supportedChannels.numChnl = *pBuf++; |
| 1293 | len--; |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1294 | vos_mem_copy( (tANI_U8 *) pJoinReq->supportedChannels.channelList, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1295 | pBuf, pJoinReq->supportedChannels.numChnl); |
| 1296 | pBuf += pJoinReq->supportedChannels.numChnl; |
| 1297 | len-= pJoinReq->supportedChannels.numChnl; |
| 1298 | |
| 1299 | PELOG2(limLog(pMac, LOG2, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1300 | FL("spectrumInd ON: minPower %d, maxPower %d , numChnls %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1301 | pJoinReq->powerCap.minTxPower, |
| 1302 | pJoinReq->powerCap.maxTxPower, |
| 1303 | pJoinReq->supportedChannels.numChnl);) |
| 1304 | |
| 1305 | // Extract uapsdPerAcBitmask |
| 1306 | pJoinReq->uapsdPerAcBitmask = *pBuf++; |
| 1307 | len--; |
| 1308 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1309 | { |
| 1310 | limLog(pMac, LOGE, FL("remaining len %d is too short"), len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1311 | return eSIR_FAILURE; |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1312 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1313 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1314 | // |
| 1315 | // NOTE - tSirBssDescription is now moved to the end |
| 1316 | // of tSirSmeJoinReq structure. This is to accomodate |
| 1317 | // the variable length data member ieFields[1] |
| 1318 | // |
| 1319 | if (limGetBssDescription( pMac, &pJoinReq->bssDescription, |
| 1320 | len, &lenUsed, pBuf) == eSIR_FAILURE) |
| 1321 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1322 | PELOGE(limLog(pMac, LOGE, FL("get bss description failed"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1323 | return eSIR_FAILURE; |
| 1324 | } |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame^] | 1325 | PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, |
| 1326 | (tANI_U8 *) &(pJoinReq->bssDescription), |
| 1327 | pJoinReq->bssDescription.length + 2);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1328 | pBuf += lenUsed; |
| 1329 | len -= lenUsed; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1330 | |
| 1331 | return eSIR_SUCCESS; |
| 1332 | } /*** end limJoinReqSerDes() ***/ |
| 1333 | |
| 1334 | |
| 1335 | /**--------------------------------------------------------------- |
| 1336 | \fn limAssocIndSerDes |
| 1337 | \brief This function is called by limProcessMlmAssocInd() to |
| 1338 | \ populate the SME_ASSOC_IND message based on the received |
| 1339 | \ MLM_ASSOC_IND. |
| 1340 | \ |
| 1341 | \param pMac |
| 1342 | \param pAssocInd - Pointer to the received tLimMlmAssocInd |
| 1343 | \param pBuf - Pointer to serialized buffer |
| 1344 | \param psessionEntry - pointer to PE session entry |
| 1345 | \ |
| 1346 | \return None |
| 1347 | ------------------------------------------------------------------*/ |
| 1348 | void |
| 1349 | limAssocIndSerDes(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd, tANI_U8 *pBuf, tpPESession psessionEntry) |
| 1350 | { |
| 1351 | tANI_U8 *pLen = pBuf; |
| 1352 | tANI_U16 mLen = 0; |
| 1353 | |
| 1354 | #ifdef PE_DEBUG_LOG1 |
| 1355 | tANI_U8 *pTemp = pBuf; |
| 1356 | #endif |
| 1357 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1358 | |
| 1359 | mLen = sizeof(tANI_U32); |
| 1360 | mLen += sizeof(tANI_U8); |
| 1361 | pBuf += sizeof(tANI_U16); |
| 1362 | *pBuf = psessionEntry->smeSessionId; |
| 1363 | pBuf += sizeof(tANI_U8); |
| 1364 | |
| 1365 | // Fill in peerMacAddr |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1366 | vos_mem_copy( pBuf, pAssocInd->peerMacAddr, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1367 | pBuf += sizeof(tSirMacAddr); |
| 1368 | mLen += sizeof(tSirMacAddr); |
| 1369 | |
| 1370 | // Fill in aid |
| 1371 | limCopyU16(pBuf, pAssocInd->aid); |
| 1372 | pBuf += sizeof(tANI_U16); |
| 1373 | mLen += sizeof(tANI_U16); |
| 1374 | |
| 1375 | // Fill in bssId |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1376 | vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1377 | pBuf += sizeof(tSirMacAddr); |
| 1378 | mLen += sizeof(tSirMacAddr); |
| 1379 | |
| 1380 | // Fill in staId |
| 1381 | limCopyU16(pBuf, psessionEntry->staId); |
| 1382 | pBuf += sizeof(tANI_U16); |
| 1383 | mLen += sizeof(tANI_U16); |
| 1384 | |
| 1385 | // Fill in authType |
| 1386 | limCopyU32(pBuf, pAssocInd->authType); |
| 1387 | pBuf += sizeof(tANI_U32); |
| 1388 | mLen += sizeof(tANI_U32); |
| 1389 | |
| 1390 | // Fill in ssId |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1391 | vos_mem_copy( pBuf, (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1392 | pBuf += (1 + pAssocInd->ssId.length); |
| 1393 | mLen += (1 + pAssocInd->ssId.length); |
| 1394 | |
| 1395 | // Fill in rsnIE |
| 1396 | limCopyU16(pBuf, pAssocInd->rsnIE.length); |
| 1397 | pBuf += sizeof(tANI_U16); |
| 1398 | mLen += sizeof(tANI_U16); |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1399 | vos_mem_copy( pBuf, (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1400 | pAssocInd->rsnIE.length); |
| 1401 | pBuf += pAssocInd->rsnIE.length; |
| 1402 | mLen += pAssocInd->rsnIE.length; |
| 1403 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1404 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1405 | limCopyU32(pBuf, pAssocInd->spectrumMgtIndicator); |
| 1406 | pBuf += sizeof(tAniBool); |
| 1407 | mLen += sizeof(tAniBool); |
| 1408 | |
| 1409 | if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE) |
| 1410 | { |
| 1411 | *pBuf = pAssocInd->powerCap.minTxPower; |
| 1412 | pBuf++; |
| 1413 | *pBuf = pAssocInd->powerCap.maxTxPower; |
| 1414 | pBuf++; |
| 1415 | mLen += sizeof(tSirMacPowerCapInfo); |
| 1416 | |
| 1417 | *pBuf = pAssocInd->supportedChannels.numChnl; |
| 1418 | pBuf++; |
| 1419 | mLen++; |
| 1420 | |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1421 | vos_mem_copy( pBuf, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1422 | (tANI_U8 *) &(pAssocInd->supportedChannels.channelList), |
| 1423 | pAssocInd->supportedChannels.numChnl); |
| 1424 | |
| 1425 | |
| 1426 | pBuf += pAssocInd->supportedChannels.numChnl; |
| 1427 | mLen += pAssocInd->supportedChannels.numChnl; |
| 1428 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1429 | limCopyU32(pBuf, pAssocInd->WmmStaInfoPresent); |
| 1430 | pBuf += sizeof(tANI_U32); |
| 1431 | mLen += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1432 | // Fill in length of SME_ASSOC_IND message |
| 1433 | limCopyU16(pLen, mLen); |
| 1434 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1435 | 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] | 1436 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);) |
| 1437 | } /*** end limAssocIndSerDes() ***/ |
| 1438 | |
| 1439 | |
| 1440 | |
| 1441 | /** |
| 1442 | * limAssocCnfSerDes() |
| 1443 | * |
| 1444 | *FUNCTION: |
| 1445 | * This function is called by limProcessLmmMessages() when |
| 1446 | * SME_ASSOC_CNF or SME_REASSOC_CNF message is received from |
| 1447 | * upper layer software. |
| 1448 | * |
| 1449 | *PARAMS: |
| 1450 | * |
| 1451 | *LOGIC: |
| 1452 | * |
| 1453 | *ASSUMPTIONS: |
| 1454 | * NA |
| 1455 | * |
| 1456 | *NOTE: |
| 1457 | * NA |
| 1458 | * |
| 1459 | * @param pAssocCnf Pointer to tSirSmeAssocCnf being extracted into |
| 1460 | * @param pBuf Pointer to serialized buffer |
| 1461 | * @return retCode Indicates whether message is successfully |
| 1462 | * de-serialized (eSIR_SUCCESS) or |
| 1463 | * not (eSIR_FAILURE) |
| 1464 | */ |
| 1465 | |
| 1466 | tSirRetStatus |
| 1467 | limAssocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeAssocCnf pAssocCnf, tANI_U8 *pBuf) |
| 1468 | { |
| 1469 | #ifdef PE_DEBUG_LOG1 |
| 1470 | tANI_U8 *pTemp = pBuf; |
| 1471 | #endif |
| 1472 | |
| 1473 | if (!pAssocCnf || !pBuf) |
| 1474 | return eSIR_FAILURE; |
| 1475 | |
| 1476 | pAssocCnf->messageType = limGetU16(pBuf); |
| 1477 | pBuf += sizeof(tANI_U16); |
| 1478 | |
| 1479 | pAssocCnf->length = limGetU16(pBuf); |
| 1480 | pBuf += sizeof(tANI_U16); |
| 1481 | |
| 1482 | if (pAssocCnf->messageType == eWNI_SME_ASSOC_CNF) |
| 1483 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1484 | 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] | 1485 | } |
| 1486 | else |
| 1487 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1488 | 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] | 1489 | } |
| 1490 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pAssocCnf->length);) |
| 1491 | |
| 1492 | // status code |
| 1493 | pAssocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf); |
| 1494 | pBuf += sizeof(tSirResultCodes); |
| 1495 | |
| 1496 | // bssId |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1497 | vos_mem_copy( pAssocCnf->bssId, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1498 | pBuf += sizeof(tSirMacAddr); |
| 1499 | |
| 1500 | // peerMacAddr |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1501 | vos_mem_copy( pAssocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1502 | pBuf += sizeof(tSirMacAddr); |
| 1503 | |
| 1504 | |
| 1505 | pAssocCnf->aid = limGetU16(pBuf); |
| 1506 | pBuf += sizeof(tANI_U16); |
| 1507 | // alternateBssId |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1508 | vos_mem_copy( pAssocCnf->alternateBssId, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1509 | pBuf += sizeof(tSirMacAddr); |
| 1510 | |
| 1511 | // alternateChannelId |
| 1512 | pAssocCnf->alternateChannelId = *pBuf; |
| 1513 | pBuf++; |
| 1514 | |
| 1515 | return eSIR_SUCCESS; |
| 1516 | } /*** end limAssocCnfSerDes() ***/ |
| 1517 | |
| 1518 | |
| 1519 | |
| 1520 | /** |
| 1521 | * limDisassocCnfSerDes() |
| 1522 | * |
| 1523 | *FUNCTION: |
| 1524 | * This function is called by limProcessSmeMessages() when |
| 1525 | * SME_DISASSOC_CNF message is received from upper layer software. |
| 1526 | * |
| 1527 | *PARAMS: |
| 1528 | * |
| 1529 | *LOGIC: |
| 1530 | * |
| 1531 | *ASSUMPTIONS: |
| 1532 | * NA |
| 1533 | * |
| 1534 | *NOTE: |
| 1535 | * NA |
| 1536 | * |
| 1537 | * @param pDisassocCnf Pointer to tSirSmeDisassocCnf being |
| 1538 | * extracted into |
| 1539 | * @param pBuf Pointer to serialized buffer |
| 1540 | * @return retCode Indicates whether message is successfully |
| 1541 | * de-serialized (eSIR_SUCCESS) or |
| 1542 | * not (eSIR_FAILURE) |
| 1543 | */ |
| 1544 | |
| 1545 | tSirRetStatus |
| 1546 | limDisassocCnfSerDes(tpAniSirGlobal pMac, tpSirSmeDisassocCnf pDisassocCnf, tANI_U8 *pBuf) |
| 1547 | { |
| 1548 | #ifdef PE_DEBUG_LOG1 |
| 1549 | tANI_U8 *pTemp = pBuf; |
| 1550 | #endif |
| 1551 | |
| 1552 | if (!pDisassocCnf || !pBuf) |
| 1553 | return eSIR_FAILURE; |
| 1554 | |
| 1555 | pDisassocCnf->messageType = limGetU16(pBuf); |
| 1556 | pBuf += sizeof(tANI_U16); |
| 1557 | |
| 1558 | pDisassocCnf->length = limGetU16(pBuf); |
| 1559 | pBuf += sizeof(tANI_U16); |
| 1560 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1561 | 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] | 1562 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, pDisassocCnf->length);) |
| 1563 | |
| 1564 | pDisassocCnf->statusCode = (tSirResultCodes) limGetU32(pBuf); |
| 1565 | pBuf += sizeof(tSirResultCodes); |
| 1566 | |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1567 | vos_mem_copy( pDisassocCnf->bssId, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1568 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 62c2798 | 2013-02-27 17:53:55 -0800 | [diff] [blame] | 1569 | |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1570 | vos_mem_copy( pDisassocCnf->peerMacAddr, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1571 | |
Jeff Johnson | 62c2798 | 2013-02-27 17:53:55 -0800 | [diff] [blame] | 1572 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1573 | return eSIR_SUCCESS; |
| 1574 | } /*** end limDisassocCnfSerDes() ***/ |
| 1575 | |
| 1576 | |
| 1577 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1578 | |
| 1579 | |
| 1580 | /**--------------------------------------------------------------- |
| 1581 | \fn limReassocIndSerDes |
| 1582 | \brief This function is called by limProcessMlmReassocInd() to |
| 1583 | \ populate the SME_REASSOC_IND message based on the received |
| 1584 | \ MLM_REASSOC_IND. |
| 1585 | \ |
| 1586 | \param pMac |
| 1587 | \param pReassocInd - Pointer to the received tLimMlmReassocInd |
| 1588 | \param pBuf - Pointer to serialized buffer |
| 1589 | \param psessionEntry - pointer to PE session entry |
| 1590 | \ |
| 1591 | \return None |
| 1592 | ------------------------------------------------------------------*/ |
| 1593 | void |
| 1594 | limReassocIndSerDes(tpAniSirGlobal pMac, tpLimMlmReassocInd pReassocInd, tANI_U8 *pBuf, tpPESession psessionEntry) |
| 1595 | { |
| 1596 | tANI_U8 *pLen = pBuf; |
| 1597 | tANI_U16 mLen = 0; |
| 1598 | |
| 1599 | #ifdef PE_DEBUG_LOG1 |
| 1600 | tANI_U8 *pTemp = pBuf; |
| 1601 | #endif |
| 1602 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1603 | |
| 1604 | mLen = sizeof(tANI_U32); |
| 1605 | pBuf += sizeof(tANI_U16); |
| 1606 | *pBuf++ = psessionEntry->smeSessionId; |
| 1607 | mLen += sizeof(tANI_U8); |
| 1608 | |
| 1609 | // Fill in peerMacAddr |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1610 | vos_mem_copy( pBuf, pReassocInd->peerMacAddr, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1611 | pBuf += sizeof(tSirMacAddr); |
| 1612 | mLen += sizeof(tSirMacAddr); |
| 1613 | |
| 1614 | // Fill in oldMacAddr |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1615 | vos_mem_copy( pBuf, pReassocInd->currentApAddr, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1616 | pBuf += sizeof(tSirMacAddr); |
| 1617 | mLen += sizeof(tSirMacAddr); |
| 1618 | |
| 1619 | // Fill in aid |
| 1620 | limCopyU16(pBuf, pReassocInd->aid); |
| 1621 | pBuf += sizeof(tANI_U16); |
| 1622 | mLen += sizeof(tANI_U16); |
| 1623 | |
| 1624 | // Fill in bssId |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1625 | vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1626 | pBuf += sizeof(tSirMacAddr); |
| 1627 | mLen += sizeof(tSirMacAddr); |
| 1628 | |
| 1629 | // Fill in staId |
| 1630 | limCopyU16(pBuf, psessionEntry->staId); |
| 1631 | pBuf += sizeof(tANI_U16); |
| 1632 | mLen += sizeof(tANI_U16); |
| 1633 | |
| 1634 | // Fill in authType |
| 1635 | limCopyU32(pBuf, pReassocInd->authType); |
| 1636 | pBuf += sizeof(tAniAuthType); |
| 1637 | mLen += sizeof(tAniAuthType); |
| 1638 | |
| 1639 | // Fill in ssId |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1640 | vos_mem_copy( pBuf, (tANI_U8 *) &(pReassocInd->ssId), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1641 | pReassocInd->ssId.length + 1); |
| 1642 | pBuf += 1 + pReassocInd->ssId.length; |
| 1643 | mLen += pReassocInd->ssId.length + 1; |
| 1644 | |
| 1645 | // Fill in rsnIE |
| 1646 | limCopyU16(pBuf, pReassocInd->rsnIE.length); |
| 1647 | pBuf += sizeof(tANI_U16); |
| 1648 | mLen += sizeof(tANI_U16); |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1649 | vos_mem_copy( pBuf, (tANI_U8 *) &(pReassocInd->rsnIE.rsnIEdata), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1650 | pReassocInd->rsnIE.length); |
| 1651 | pBuf += pReassocInd->rsnIE.length; |
| 1652 | mLen += pReassocInd->rsnIE.length; |
| 1653 | |
| 1654 | // Fill in addIE |
| 1655 | limCopyU16(pBuf, pReassocInd->addIE.length); |
| 1656 | pBuf += sizeof(tANI_U16); |
| 1657 | mLen += sizeof(tANI_U16); |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1658 | vos_mem_copy( pBuf, (tANI_U8*) &(pReassocInd->addIE.addIEdata), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1659 | pReassocInd->addIE.length); |
| 1660 | pBuf += pReassocInd->addIE.length; |
| 1661 | mLen += pReassocInd->addIE.length; |
| 1662 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1663 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1664 | limCopyU32(pBuf, pReassocInd->spectrumMgtIndicator); |
| 1665 | pBuf += sizeof(tAniBool); |
| 1666 | mLen += sizeof(tAniBool); |
| 1667 | |
| 1668 | if (pReassocInd->spectrumMgtIndicator == eSIR_TRUE) |
| 1669 | { |
| 1670 | *pBuf = pReassocInd->powerCap.minTxPower; |
| 1671 | pBuf++; |
| 1672 | *pBuf = pReassocInd->powerCap.maxTxPower; |
| 1673 | pBuf++; |
| 1674 | mLen += sizeof(tSirMacPowerCapInfo); |
| 1675 | |
| 1676 | *pBuf = pReassocInd->supportedChannels.numChnl; |
| 1677 | pBuf++; |
| 1678 | mLen++; |
| 1679 | |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1680 | vos_mem_copy( pBuf, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1681 | (tANI_U8 *) &(pReassocInd->supportedChannels.channelList), |
| 1682 | pReassocInd->supportedChannels.numChnl); |
| 1683 | |
| 1684 | pBuf += pReassocInd->supportedChannels.numChnl; |
| 1685 | mLen += pReassocInd->supportedChannels.numChnl; |
| 1686 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1687 | limCopyU32(pBuf, pReassocInd->WmmStaInfoPresent); |
| 1688 | pBuf += sizeof(tANI_U32); |
| 1689 | mLen += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1690 | |
| 1691 | // Fill in length of SME_REASSOC_IND message |
| 1692 | limCopyU16(pLen, mLen); |
| 1693 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1694 | 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] | 1695 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);) |
| 1696 | } /*** end limReassocIndSerDes() ***/ |
| 1697 | |
| 1698 | |
| 1699 | /** |
| 1700 | * limAuthIndSerDes() |
| 1701 | * |
| 1702 | *FUNCTION: |
| 1703 | * This function is called by limProcessMlmAuthInd() while sending |
| 1704 | * SME_AUTH_IND to host |
| 1705 | * |
| 1706 | *PARAMS: |
| 1707 | * |
| 1708 | *LOGIC: |
| 1709 | * |
| 1710 | *ASSUMPTIONS: |
| 1711 | * NA |
| 1712 | * |
| 1713 | *NOTE: |
| 1714 | * NA |
| 1715 | * |
| 1716 | * @param pAuthInd Pointer to tSirSmeAuthInd being sent |
| 1717 | * @param pBuf Pointer to serialized buffer |
| 1718 | * |
| 1719 | * @return None |
| 1720 | */ |
| 1721 | |
| 1722 | void |
| 1723 | limAuthIndSerDes(tpAniSirGlobal pMac, tpLimMlmAuthInd pAuthInd, tANI_U8 *pBuf) |
| 1724 | { |
| 1725 | tANI_U8 *pLen = pBuf; |
| 1726 | tANI_U16 mLen = 0; |
| 1727 | |
| 1728 | #ifdef PE_DEBUG_LOG1 |
| 1729 | tANI_U8 *pTemp = pBuf; |
| 1730 | #endif |
| 1731 | |
| 1732 | mLen = sizeof(tANI_U32); |
| 1733 | pBuf += sizeof(tANI_U16); |
| 1734 | *pBuf++ = pAuthInd->sessionId; |
| 1735 | mLen += sizeof(tANI_U8); |
| 1736 | |
| 1737 | // BTAMP TODO: Fill in bssId |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1738 | vos_mem_set(pBuf, sizeof(tSirMacAddr), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1739 | pBuf += sizeof(tSirMacAddr); |
| 1740 | mLen += sizeof(tSirMacAddr); |
| 1741 | |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1742 | vos_mem_copy( pBuf, pAuthInd->peerMacAddr, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1743 | pBuf += sizeof(tSirMacAddr); |
| 1744 | mLen += sizeof(tSirMacAddr); |
| 1745 | |
| 1746 | limCopyU32(pBuf, pAuthInd->authType); |
| 1747 | pBuf += sizeof(tAniAuthType); |
| 1748 | mLen += sizeof(tAniAuthType); |
| 1749 | |
| 1750 | limCopyU16(pLen, mLen); |
| 1751 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1752 | 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] | 1753 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, mLen);) |
| 1754 | } /*** end limAuthIndSerDes() ***/ |
| 1755 | |
| 1756 | |
| 1757 | |
| 1758 | /** |
| 1759 | * limSetContextReqSerDes() |
| 1760 | * |
| 1761 | *FUNCTION: |
| 1762 | * This function is called by limProcessSmeMessages() upon receiving |
| 1763 | * SME_SETCONTEXT_REQ from host |
| 1764 | * |
| 1765 | *PARAMS: |
| 1766 | * |
| 1767 | *LOGIC: |
| 1768 | * |
| 1769 | *ASSUMPTIONS: |
| 1770 | * NA |
| 1771 | * |
| 1772 | *NOTE: |
| 1773 | * NA |
| 1774 | * |
| 1775 | * @param pSetContextReq Pointer to tSirSmeSetContextReq being |
| 1776 | * extracted |
| 1777 | * @param pBuf Pointer to serialized buffer |
| 1778 | * |
| 1779 | * @return retCode Indicates whether message is successfully |
| 1780 | * de-serialized (eSIR_SUCCESS) or |
| 1781 | * not (eSIR_FAILURE) |
| 1782 | */ |
| 1783 | |
| 1784 | tSirRetStatus |
| 1785 | limSetContextReqSerDes(tpAniSirGlobal pMac, tpSirSmeSetContextReq pSetContextReq, tANI_U8 *pBuf) |
| 1786 | { |
| 1787 | tANI_S16 len = 0; |
| 1788 | tANI_U16 totalKeySize = sizeof(tANI_U8); // initialized to sizeof numKeys |
| 1789 | tANI_U8 numKeys; |
| 1790 | tANI_U8 *pKeys; |
| 1791 | |
| 1792 | #ifdef PE_DEBUG_LOG1 |
| 1793 | tANI_U8 *pTemp = pBuf; |
| 1794 | #endif |
| 1795 | if (!pSetContextReq || !pBuf) |
| 1796 | return eSIR_FAILURE; |
| 1797 | |
| 1798 | pSetContextReq->messageType = limGetU16(pBuf); |
| 1799 | pBuf += sizeof(tANI_U16); |
| 1800 | |
| 1801 | len = pSetContextReq->length = limGetU16(pBuf); |
| 1802 | pBuf += sizeof(tANI_U16); |
| 1803 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1804 | 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] | 1805 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, pTemp, len);) |
| 1806 | |
| 1807 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 1808 | return eSIR_FAILURE; |
| 1809 | |
| 1810 | len -= sizeof(tANI_U32); // skip message header |
| 1811 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1812 | return eSIR_FAILURE; |
| 1813 | |
| 1814 | // Extract sessionId |
| 1815 | pSetContextReq->sessionId = *pBuf++; |
| 1816 | len--; |
| 1817 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1818 | return eSIR_FAILURE; |
| 1819 | |
| 1820 | // Extract transactionId |
| 1821 | pSetContextReq->transactionId = sirReadU16N(pBuf); |
| 1822 | pBuf += sizeof(tANI_U16); |
| 1823 | len -= sizeof(tANI_U16); |
| 1824 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1825 | return eSIR_FAILURE; |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1826 | vos_mem_copy( (tANI_U8 *) pSetContextReq->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1827 | pBuf, sizeof(tSirMacAddr)); |
| 1828 | pBuf += sizeof(tSirMacAddr); |
| 1829 | len -= sizeof(tSirMacAddr); |
| 1830 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1831 | return eSIR_FAILURE; |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1832 | vos_mem_copy( pSetContextReq->bssId, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1833 | pBuf += sizeof(tSirMacAddr); |
| 1834 | len -= sizeof(tSirMacAddr); |
| 1835 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1836 | return eSIR_FAILURE; |
| 1837 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1838 | |
| 1839 | // pSetContextReq->qosInfoPresent = limGetU32(pBuf); |
| 1840 | // pBuf += sizeof(tAniBool); |
| 1841 | |
| 1842 | // if (pSetContextReq->qosInfoPresent) |
| 1843 | // { |
| 1844 | // len = limGetQosInfo(&pSetContextReq->qos, pBuf); |
| 1845 | // pBuf += len; |
| 1846 | // } |
| 1847 | |
| 1848 | pSetContextReq->keyMaterial.length = limGetU16(pBuf); |
| 1849 | pBuf += sizeof(tANI_U16); |
| 1850 | len -= sizeof(tANI_U16); |
| 1851 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1852 | return eSIR_FAILURE; |
| 1853 | |
| 1854 | pSetContextReq->keyMaterial.edType = (tAniEdType) limGetU32(pBuf); |
| 1855 | pBuf += sizeof(tAniEdType); |
| 1856 | len -= sizeof(tAniEdType); |
| 1857 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1858 | return eSIR_FAILURE; |
| 1859 | |
| 1860 | numKeys = pSetContextReq->keyMaterial.numKeys = *pBuf++; |
| 1861 | len -= sizeof(numKeys); |
| 1862 | |
| 1863 | if (numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS) |
| 1864 | return eSIR_FAILURE; |
| 1865 | |
| 1866 | /** Initialize the Default Keys if no Keys are being sent from the upper layer*/ |
| 1867 | if( limCheckRemainingLength(pMac, len) == eSIR_FAILURE) { |
| 1868 | tpSirKeys pKeyinfo = pSetContextReq->keyMaterial.key; |
| 1869 | |
| 1870 | pKeyinfo->keyId = 0; |
| 1871 | pKeyinfo->keyDirection = eSIR_TX_RX; |
| 1872 | pKeyinfo->keyLength = 0; |
| 1873 | |
| 1874 | if (!limIsAddrBC(pSetContextReq->peerMacAddr)) |
| 1875 | pKeyinfo->unicast = 1; |
| 1876 | else |
| 1877 | pKeyinfo->unicast = 0; |
| 1878 | }else { |
| 1879 | pKeys = (tANI_U8 *) pSetContextReq->keyMaterial.key; |
| 1880 | do { |
| 1881 | tANI_U32 keySize = limGetKeysInfo(pMac, (tpSirKeys) pKeys, |
| 1882 | pBuf); |
| 1883 | pBuf += keySize; |
| 1884 | pKeys += sizeof(tSirKeys); |
| 1885 | totalKeySize += (tANI_U16) keySize; |
| 1886 | if (numKeys == 0) |
| 1887 | break; |
| 1888 | numKeys--; |
| 1889 | }while (numKeys); |
| 1890 | } |
| 1891 | return eSIR_SUCCESS; |
| 1892 | } /*** end limSetContextReqSerDes() ***/ |
| 1893 | |
| 1894 | /** |
| 1895 | * limRemoveKeyReqSerDes() |
| 1896 | * |
| 1897 | *FUNCTION: |
| 1898 | * This function is called by limProcessSmeMessages() upon receiving |
| 1899 | * SME_REMOVEKEY_REQ from host |
| 1900 | * |
| 1901 | *PARAMS: |
| 1902 | * |
| 1903 | *LOGIC: |
| 1904 | * |
| 1905 | *ASSUMPTIONS: |
| 1906 | * NA |
| 1907 | * |
| 1908 | *NOTE: |
| 1909 | * NA |
| 1910 | * |
| 1911 | * @param pRemoveKeyReq Pointer to tSirSmeRemoveKeyReq being |
| 1912 | * extracted |
| 1913 | * @param pBuf Pointer to serialized buffer |
| 1914 | * |
| 1915 | * @return retCode Indicates whether message is successfully |
| 1916 | * de-serialized (eSIR_SUCCESS) or |
| 1917 | * not (eSIR_FAILURE) |
| 1918 | */ |
| 1919 | |
| 1920 | tSirRetStatus |
| 1921 | limRemoveKeyReqSerDes(tpAniSirGlobal pMac, tpSirSmeRemoveKeyReq pRemoveKeyReq, tANI_U8 *pBuf) |
| 1922 | { |
| 1923 | tANI_S16 len = 0; |
| 1924 | |
| 1925 | #ifdef PE_DEBUG_LOG1 |
| 1926 | tANI_U8 *pTemp = pBuf; |
| 1927 | #endif |
| 1928 | if (!pRemoveKeyReq || !pBuf) |
| 1929 | return eSIR_FAILURE; |
| 1930 | |
| 1931 | pRemoveKeyReq->messageType = limGetU16(pBuf); |
| 1932 | pBuf += sizeof(tANI_U16); |
| 1933 | |
| 1934 | len = pRemoveKeyReq->length = limGetU16(pBuf); |
| 1935 | pBuf += sizeof(tANI_U16); |
| 1936 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1937 | 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] | 1938 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);) |
| 1939 | |
| 1940 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 1941 | return eSIR_FAILURE; |
| 1942 | |
| 1943 | len -= sizeof(tANI_U32); // skip message header |
| 1944 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1945 | return eSIR_FAILURE; |
| 1946 | |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1947 | vos_mem_copy( (tANI_U8 *) pRemoveKeyReq->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1948 | pBuf, sizeof(tSirMacAddr)); |
| 1949 | pBuf += sizeof(tSirMacAddr); |
| 1950 | len -= sizeof(tSirMacAddr); |
| 1951 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1952 | return eSIR_FAILURE; |
| 1953 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1954 | |
| 1955 | pRemoveKeyReq->edType = *pBuf; |
| 1956 | pBuf += sizeof(tANI_U8); |
| 1957 | len -= sizeof(tANI_U8); |
| 1958 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1959 | return eSIR_FAILURE; |
| 1960 | |
| 1961 | pRemoveKeyReq->wepType = *pBuf; |
| 1962 | |
| 1963 | pBuf += sizeof(tANI_U8); |
| 1964 | len -= sizeof(tANI_U8); |
| 1965 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1966 | return eSIR_FAILURE; |
| 1967 | |
| 1968 | pRemoveKeyReq->keyId = *pBuf; |
| 1969 | |
| 1970 | pBuf += sizeof(tANI_U8); |
| 1971 | len -= sizeof(tANI_U8); |
| 1972 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1973 | return eSIR_FAILURE; |
| 1974 | |
| 1975 | pRemoveKeyReq->unicast = *pBuf; |
| 1976 | len--; |
| 1977 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1978 | return eSIR_FAILURE; |
| 1979 | |
| 1980 | // Extract bssId |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 1981 | vos_mem_copy( pRemoveKeyReq->bssId, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1982 | pBuf += sizeof(tSirMacAddr); |
| 1983 | len -= sizeof(tSirMacAddr); |
| 1984 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1985 | return eSIR_FAILURE; |
| 1986 | |
| 1987 | // Extract sessionId |
| 1988 | pRemoveKeyReq->sessionId = *pBuf++; |
| 1989 | len--; |
| 1990 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1991 | return eSIR_FAILURE; |
| 1992 | |
| 1993 | // Extract transactionId |
| 1994 | pRemoveKeyReq->transactionId = sirReadU16N(pBuf); |
| 1995 | pBuf += sizeof(tANI_U16); |
| 1996 | len -= sizeof(tANI_U16); |
| 1997 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 1998 | return eSIR_FAILURE; |
| 1999 | |
| 2000 | return eSIR_SUCCESS; |
| 2001 | } /*** end limRemoveKeyReqSerDes() ***/ |
| 2002 | |
| 2003 | |
| 2004 | |
| 2005 | /** |
| 2006 | * limDisassocReqSerDes() |
| 2007 | * |
| 2008 | *FUNCTION: |
| 2009 | * This function is called by limProcessSmeMessages() upon receiving |
| 2010 | * SME_DISASSOC_REQ from host |
| 2011 | * |
| 2012 | *PARAMS: |
| 2013 | * |
| 2014 | *LOGIC: |
| 2015 | * |
| 2016 | *ASSUMPTIONS: |
| 2017 | * NA |
| 2018 | * |
| 2019 | *NOTE: |
| 2020 | * NA |
| 2021 | * |
| 2022 | * @param pDisassocReq Pointer to tSirSmeDisassocReq being extracted |
| 2023 | * @param pBuf Pointer to serialized buffer |
| 2024 | * |
| 2025 | * @return retCode Indicates whether message is successfully |
| 2026 | * de-serialized (eSIR_SUCCESS) or |
| 2027 | * not (eSIR_FAILURE) |
| 2028 | */ |
| 2029 | |
| 2030 | tSirRetStatus |
| 2031 | limDisassocReqSerDes(tpAniSirGlobal pMac, tSirSmeDisassocReq *pDisassocReq, tANI_U8 *pBuf) |
| 2032 | { |
| 2033 | tANI_S16 len = 0; |
| 2034 | #ifdef PE_DEBUG_LOG1 |
| 2035 | tANI_U8 *pTemp = pBuf; |
| 2036 | #endif |
| 2037 | |
| 2038 | if (!pDisassocReq || !pBuf) |
| 2039 | return eSIR_FAILURE; |
| 2040 | |
| 2041 | pDisassocReq->messageType = limGetU16(pBuf); |
| 2042 | pBuf += sizeof(tANI_U16); |
| 2043 | |
| 2044 | len = pDisassocReq->length = limGetU16(pBuf); |
| 2045 | pBuf += sizeof(tANI_U16); |
| 2046 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2047 | 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] | 2048 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);) |
| 2049 | |
| 2050 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 2051 | return eSIR_FAILURE; |
| 2052 | |
| 2053 | len -= sizeof(tANI_U32); // skip message header |
| 2054 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2055 | return eSIR_FAILURE; |
| 2056 | |
| 2057 | // Extract sessionID |
| 2058 | pDisassocReq->sessionId = *pBuf; |
| 2059 | pBuf += sizeof(tANI_U8); |
| 2060 | len -= sizeof(tANI_U8); |
| 2061 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2062 | return eSIR_FAILURE; |
| 2063 | |
| 2064 | // Extract transactionid |
| 2065 | pDisassocReq->transactionId = limGetU16(pBuf); |
| 2066 | pBuf += sizeof(tANI_U16); |
| 2067 | len -= sizeof(tANI_U16); |
| 2068 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2069 | return eSIR_FAILURE; |
| 2070 | |
| 2071 | // Extract bssId |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 2072 | vos_mem_copy( (tANI_U8 *) pDisassocReq->bssId, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2073 | pBuf += sizeof(tSirMacAddr); |
| 2074 | len -= sizeof(tSirMacAddr); |
| 2075 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2076 | return eSIR_FAILURE; |
| 2077 | |
| 2078 | // Extract peerMacAddr |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 2079 | vos_mem_copy( pDisassocReq->peerMacAddr, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2080 | pBuf += sizeof(tSirMacAddr); |
| 2081 | len -= sizeof(tSirMacAddr); |
| 2082 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2083 | return eSIR_FAILURE; |
| 2084 | |
| 2085 | // Extract reasonCode |
| 2086 | pDisassocReq->reasonCode = limGetU16(pBuf); |
| 2087 | pBuf += sizeof(tANI_U16); |
| 2088 | len -= sizeof(tANI_U16); |
| 2089 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2090 | return eSIR_FAILURE; |
| 2091 | |
| 2092 | pDisassocReq->doNotSendOverTheAir = *pBuf; |
| 2093 | pBuf += sizeof(tANI_U8); |
| 2094 | len -= sizeof(tANI_U8); |
| 2095 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2096 | |
| 2097 | return eSIR_SUCCESS; |
| 2098 | } /*** end limDisassocReqSerDes() ***/ |
| 2099 | |
| 2100 | |
| 2101 | |
| 2102 | /** |
| 2103 | * limDeauthReqSerDes() |
| 2104 | * |
| 2105 | *FUNCTION: |
| 2106 | * This function is called by limProcessSmeMessages() upon receiving |
| 2107 | * SME_DEAUTH_REQ from host |
| 2108 | * |
| 2109 | *PARAMS: |
| 2110 | * |
| 2111 | *LOGIC: |
| 2112 | * |
| 2113 | *ASSUMPTIONS: |
| 2114 | * NA |
| 2115 | * |
| 2116 | *NOTE: |
| 2117 | * NA |
| 2118 | * |
| 2119 | * @param pDeauthReq Pointer to tSirSmeDeauthReq being extracted |
| 2120 | * @param pBuf Pointer to serialized buffer |
| 2121 | * |
| 2122 | * @return retCode Indicates whether message is successfully |
| 2123 | * de-serialized (eSIR_SUCCESS) or |
| 2124 | * not (eSIR_FAILURE) |
| 2125 | */ |
| 2126 | tSirRetStatus |
| 2127 | limDeauthReqSerDes(tpAniSirGlobal pMac, tSirSmeDeauthReq *pDeauthReq, tANI_U8 *pBuf) |
| 2128 | { |
| 2129 | tANI_S16 len = 0; |
| 2130 | |
| 2131 | #ifdef PE_DEBUG_LOG1 |
| 2132 | tANI_U8 *pTemp = pBuf; |
| 2133 | #endif |
| 2134 | |
| 2135 | if (!pDeauthReq || !pBuf) |
| 2136 | return eSIR_FAILURE; |
| 2137 | |
| 2138 | pDeauthReq->messageType = limGetU16(pBuf); |
| 2139 | pBuf += sizeof(tANI_U16); |
| 2140 | |
| 2141 | len = pDeauthReq->length = limGetU16(pBuf); |
| 2142 | pBuf += sizeof(tANI_U16); |
| 2143 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2144 | 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] | 2145 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);) |
| 2146 | |
| 2147 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 2148 | return eSIR_FAILURE; |
| 2149 | |
| 2150 | len -= sizeof(tANI_U32); // skip message header |
| 2151 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2152 | return eSIR_FAILURE; |
| 2153 | |
| 2154 | // Extract sessionId |
| 2155 | pDeauthReq->sessionId = *pBuf++; |
| 2156 | len--; |
| 2157 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2158 | return eSIR_FAILURE; |
| 2159 | |
| 2160 | // Extract transactionId |
| 2161 | pDeauthReq->transactionId = limGetU16(pBuf); |
| 2162 | pBuf += sizeof(tANI_U16); |
| 2163 | len -= sizeof(tANI_U16); |
| 2164 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2165 | return eSIR_FAILURE; |
| 2166 | |
| 2167 | // Extract bssId |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 2168 | vos_mem_copy( pDeauthReq->bssId, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2169 | pBuf += sizeof(tSirMacAddr); |
| 2170 | len -= sizeof(tSirMacAddr); |
| 2171 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2172 | return eSIR_FAILURE; |
| 2173 | |
| 2174 | // Extract peerMacAddr |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 2175 | vos_mem_copy( pDeauthReq->peerMacAddr, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2176 | pBuf += sizeof(tSirMacAddr); |
| 2177 | len -= sizeof(tSirMacAddr); |
| 2178 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2179 | return eSIR_FAILURE; |
| 2180 | |
| 2181 | // Extract reasonCode |
| 2182 | pDeauthReq->reasonCode = limGetU16(pBuf); |
| 2183 | pBuf += sizeof(tANI_U16); |
| 2184 | len -= sizeof(tANI_U16); |
| 2185 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2186 | |
| 2187 | return eSIR_SUCCESS; |
| 2188 | } /*** end limDisassocReqSerDes() ***/ |
| 2189 | |
| 2190 | |
| 2191 | |
| 2192 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2193 | |
| 2194 | |
| 2195 | /** |
| 2196 | * limStatSerDes() |
| 2197 | * |
| 2198 | *FUNCTION: |
| 2199 | * This function is called by limSendSmeDisassocNtf() while sending |
| 2200 | * SME_DISASSOC_IND/eWNI_SME_DISASSOC_RSP to host |
| 2201 | * |
| 2202 | *PARAMS: |
| 2203 | * |
| 2204 | *LOGIC: |
| 2205 | * |
| 2206 | *ASSUMPTIONS: |
| 2207 | * NA |
| 2208 | * |
| 2209 | *NOTE: |
| 2210 | * NA |
| 2211 | * |
| 2212 | * @param pAssocInd Pointer to tpAniStaStatStruct being sent |
| 2213 | * @param pBuf Pointer to serialized buffer |
| 2214 | * |
| 2215 | * @return None |
| 2216 | */ |
| 2217 | |
| 2218 | void |
| 2219 | limStatSerDes(tpAniSirGlobal pMac, tpAniStaStatStruct pStat, tANI_U8 *pBuf) |
| 2220 | { |
| 2221 | #ifdef PE_DEBUG_LOG1 |
| 2222 | tANI_U8 *pTemp = pBuf; |
| 2223 | #endif |
| 2224 | |
| 2225 | limCopyU32(pBuf, pStat->sentAesBlksUcastHi); |
| 2226 | pBuf += sizeof(tANI_U32); |
| 2227 | |
| 2228 | limCopyU32(pBuf, pStat->sentAesBlksUcastLo); |
| 2229 | pBuf += sizeof(tANI_U32); |
| 2230 | |
| 2231 | limCopyU32(pBuf, pStat->recvAesBlksUcastHi); |
| 2232 | pBuf += sizeof(tANI_U32); |
| 2233 | |
| 2234 | limCopyU32(pBuf, pStat->recvAesBlksUcastLo); |
| 2235 | pBuf += sizeof(tANI_U32); |
| 2236 | |
| 2237 | limCopyU32(pBuf, pStat->aesFormatErrorUcastCnts); |
| 2238 | pBuf += sizeof(tANI_U32); |
| 2239 | |
| 2240 | limCopyU32(pBuf, pStat->aesReplaysUcast); |
| 2241 | pBuf += sizeof(tANI_U32); |
| 2242 | |
| 2243 | limCopyU32(pBuf, pStat->aesDecryptErrUcast); |
| 2244 | pBuf += sizeof(tANI_U32); |
| 2245 | |
| 2246 | limCopyU32(pBuf, pStat->singleRetryPkts); |
| 2247 | pBuf += sizeof(tANI_U32); |
| 2248 | |
| 2249 | limCopyU32(pBuf, pStat->failedTxPkts); |
| 2250 | pBuf += sizeof(tANI_U32); |
| 2251 | |
| 2252 | limCopyU32(pBuf, pStat->ackTimeouts); |
| 2253 | pBuf += sizeof(tANI_U32); |
| 2254 | |
| 2255 | limCopyU32(pBuf, pStat->multiRetryPkts); |
| 2256 | pBuf += sizeof(tANI_U32); |
| 2257 | |
| 2258 | limCopyU32(pBuf, pStat->fragTxCntsHi); |
| 2259 | pBuf += sizeof(tANI_U32); |
| 2260 | |
| 2261 | limCopyU32(pBuf, pStat->fragTxCntsLo); |
| 2262 | pBuf += sizeof(tANI_U32); |
| 2263 | |
| 2264 | limCopyU32(pBuf, pStat->transmittedPktsHi); |
| 2265 | pBuf += sizeof(tANI_U32); |
| 2266 | |
| 2267 | limCopyU32(pBuf, pStat->transmittedPktsLo); |
| 2268 | pBuf += sizeof(tANI_U32); |
| 2269 | |
| 2270 | limCopyU32(pBuf, pStat->phyStatHi); |
| 2271 | pBuf += sizeof(tANI_U32); |
| 2272 | |
| 2273 | limCopyU32(pBuf, pStat->phyStatLo); |
| 2274 | pBuf += sizeof(tANI_U32); |
| 2275 | |
| 2276 | limCopyU32(pBuf, pStat->uplinkRssi); |
| 2277 | pBuf += sizeof(tANI_U32); |
| 2278 | |
| 2279 | limCopyU32(pBuf, pStat->uplinkSinr); |
| 2280 | pBuf += sizeof(tANI_U32); |
| 2281 | |
| 2282 | limCopyU32(pBuf, pStat->uplinkRate); |
| 2283 | pBuf += sizeof(tANI_U32); |
| 2284 | |
| 2285 | limCopyU32(pBuf, pStat->downlinkRssi); |
| 2286 | pBuf += sizeof(tANI_U32); |
| 2287 | |
| 2288 | limCopyU32(pBuf, pStat->downlinkSinr); |
| 2289 | pBuf += sizeof(tANI_U32); |
| 2290 | |
| 2291 | limCopyU32(pBuf, pStat->downlinkRate); |
| 2292 | pBuf += sizeof(tANI_U32); |
| 2293 | |
| 2294 | limCopyU32(pBuf, pStat->nRcvBytes); |
| 2295 | pBuf += sizeof(tANI_U32); |
| 2296 | |
| 2297 | limCopyU32(pBuf, pStat->nXmitBytes); |
| 2298 | pBuf += sizeof(tANI_U32); |
| 2299 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2300 | PELOG1(limLog(pMac, LOG1, FL("STAT: length %d bytes is:"), sizeof(tAniStaStatStruct));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2301 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, sizeof(tAniStaStatStruct));) |
| 2302 | |
| 2303 | } /*** end limStatSerDes() ***/ |
| 2304 | |
| 2305 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2306 | |
| 2307 | |
| 2308 | /** |
| 2309 | * limPackBkgndScanFailNotify() |
| 2310 | * |
| 2311 | *FUNCTION: |
| 2312 | * This function is called by limSendSmeWmStatusChangeNtf() |
| 2313 | * to pack the tSirBackgroundScanInfo message |
| 2314 | * |
| 2315 | */ |
| 2316 | void |
| 2317 | limPackBkgndScanFailNotify(tpAniSirGlobal pMac, |
| 2318 | tSirSmeStatusChangeCode statusChangeCode, |
| 2319 | tpSirBackgroundScanInfo pScanInfo, |
| 2320 | tSirSmeWmStatusChangeNtf *pSmeNtf, |
| 2321 | tANI_U8 sessionId) |
| 2322 | { |
| 2323 | |
| 2324 | tANI_U16 length = (sizeof(tANI_U16) * 2) + sizeof(tANI_U8) + |
| 2325 | sizeof(tSirSmeStatusChangeCode) + |
| 2326 | sizeof(tSirBackgroundScanInfo); |
| 2327 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2328 | pSmeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF; |
| 2329 | pSmeNtf->statusChangeCode = statusChangeCode; |
| 2330 | pSmeNtf->length = length; |
| 2331 | pSmeNtf->sessionId = sessionId; |
| 2332 | pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanSuccess = pScanInfo->numOfScanSuccess; |
| 2333 | pSmeNtf->statusChangeInfo.bkgndScanInfo.numOfScanFailure = pScanInfo->numOfScanFailure; |
| 2334 | pSmeNtf->statusChangeInfo.bkgndScanInfo.reserved = pScanInfo->reserved; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2335 | } |
| 2336 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2337 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2338 | /** |
| 2339 | * limIsSmeGetAssocSTAsReqValid() |
| 2340 | * |
| 2341 | *FUNCTION: |
| 2342 | * This function is called by limProcessSmeReqMessages() upon |
| 2343 | * receiving SME_GET_ASSOC_STAS_REQ message from application. |
| 2344 | * |
| 2345 | *LOGIC: |
| 2346 | * Message validity checks are performed in this function |
| 2347 | * |
| 2348 | *ASSUMPTIONS: |
| 2349 | * |
| 2350 | *NOTE: |
| 2351 | * |
| 2352 | * @param pBuf - Pointer to a serialized SME_GET_ASSOC_STAS_REQ message |
| 2353 | * @param pSmeMsg - Pointer to a tSirSmeGetAssocSTAsReq structure |
| 2354 | * @return true if SME_GET_ASSOC_STAS_REQ message is formatted correctly |
| 2355 | * false otherwise |
| 2356 | */ |
| 2357 | tANI_BOOLEAN |
| 2358 | limIsSmeGetAssocSTAsReqValid(tpAniSirGlobal pMac, tpSirSmeGetAssocSTAsReq pGetAssocSTAsReq, tANI_U8 *pBuf) |
| 2359 | { |
| 2360 | tANI_S16 len = 0; |
| 2361 | |
| 2362 | pGetAssocSTAsReq->messageType = limGetU16(pBuf); |
| 2363 | pBuf += sizeof(tANI_U16); |
| 2364 | |
| 2365 | len = pGetAssocSTAsReq->length = limGetU16(pBuf); |
| 2366 | pBuf += sizeof(tANI_U16); |
| 2367 | |
| 2368 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 2369 | return eSIR_FAILURE; |
| 2370 | |
| 2371 | len -= sizeof(tANI_U32); // skip message header |
| 2372 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2373 | return eSIR_FAILURE; |
| 2374 | |
| 2375 | // Extract bssId |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 2376 | vos_mem_copy( (tANI_U8 *) pGetAssocSTAsReq->bssId, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2377 | pBuf += sizeof(tSirMacAddr); |
| 2378 | len -= sizeof(tSirMacAddr); |
| 2379 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2380 | return eSIR_FAILURE; |
| 2381 | |
| 2382 | // Extract modId |
| 2383 | pGetAssocSTAsReq->modId = limGetU16(pBuf); |
| 2384 | pBuf += sizeof(tANI_U16); |
| 2385 | len -= sizeof(tANI_U16); |
| 2386 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2387 | return eSIR_FAILURE; |
| 2388 | |
| 2389 | // Extract pUsrContext |
| 2390 | pGetAssocSTAsReq->pUsrContext = (void *)limGetU32(pBuf); |
| 2391 | pBuf += sizeof(tANI_U32); |
| 2392 | len -= sizeof(tANI_U32); |
| 2393 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2394 | return eSIR_FAILURE; |
| 2395 | |
| 2396 | // Extract pSapEventCallback |
| 2397 | pGetAssocSTAsReq->pSapEventCallback = (void *)limGetU32(pBuf); |
| 2398 | pBuf += sizeof(tANI_U32); |
| 2399 | len -= sizeof(tANI_U32); |
| 2400 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2401 | return eSIR_FAILURE; |
| 2402 | |
| 2403 | // Extract pAssocStasArray |
| 2404 | pGetAssocSTAsReq->pAssocStasArray = (void *)limGetU32(pBuf); |
| 2405 | pBuf += sizeof(tANI_U32); |
| 2406 | len -= sizeof(tANI_U32); |
| 2407 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2408 | 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] | 2409 | |
| 2410 | if (len < 0) |
| 2411 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2412 | PELOGE(limLog(pMac, LOGE, FL("SME_GET_ASSOC_STAS_REQ invalid length"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2413 | return eANI_BOOLEAN_FALSE; |
| 2414 | } |
| 2415 | |
| 2416 | return eANI_BOOLEAN_TRUE; |
| 2417 | } |
| 2418 | |
| 2419 | /** |
| 2420 | * limTkipCntrMeasReqSerDes() |
| 2421 | * |
| 2422 | *FUNCTION: |
| 2423 | * This function is called by limProcessSmeMessages() upon receiving |
| 2424 | * eWNI_SME_TKIP_CNTR_MEAS_REQ from host HDD |
| 2425 | * |
| 2426 | *PARAMS: |
| 2427 | * |
| 2428 | *LOGIC: |
| 2429 | * |
| 2430 | *ASSUMPTIONS: |
| 2431 | * NA |
| 2432 | * |
| 2433 | *NOTE: |
| 2434 | * NA |
| 2435 | * |
| 2436 | * @param tpSirSmeTkipCntrMeasReq Pointer to tSirSmeTkipCntrMeasReq being extracted |
| 2437 | * @param pBuf Pointer to serialized buffer |
| 2438 | * @return retCode Indicates whether message is successfully |
| 2439 | * de-serialized (eSIR_SUCCESS) or |
| 2440 | * not (eSIR_FAILURE) |
| 2441 | */ |
| 2442 | tSirRetStatus |
| 2443 | limTkipCntrMeasReqSerDes(tpAniSirGlobal pMac, tpSirSmeTkipCntrMeasReq pTkipCntrMeasReq, tANI_U8 *pBuf) |
| 2444 | { |
| 2445 | tANI_S16 len = 0; |
| 2446 | |
| 2447 | #ifdef PE_DEBUG_LOG1 |
| 2448 | tANI_U8 *pTemp = pBuf; |
| 2449 | #endif |
| 2450 | |
| 2451 | pTkipCntrMeasReq->messageType = limGetU16(pBuf); |
| 2452 | pBuf += sizeof(tANI_U16); |
| 2453 | |
| 2454 | len = pTkipCntrMeasReq->length = limGetU16(pBuf); |
| 2455 | pBuf += sizeof(tANI_U16); |
| 2456 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2457 | 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] | 2458 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pTemp, len);) |
| 2459 | |
| 2460 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 2461 | return eSIR_FAILURE; |
| 2462 | |
| 2463 | len -= sizeof(tANI_U32); // skip message header |
| 2464 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2465 | return eSIR_FAILURE; |
| 2466 | |
| 2467 | // Extract sessionId |
| 2468 | pTkipCntrMeasReq->sessionId = *pBuf++; |
| 2469 | len--; |
| 2470 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2471 | return eSIR_FAILURE; |
| 2472 | |
| 2473 | // Extract transactionId |
| 2474 | pTkipCntrMeasReq->transactionId = limGetU16(pBuf); |
| 2475 | pBuf += sizeof(tANI_U16); |
| 2476 | len -= sizeof(tANI_U16); |
| 2477 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2478 | return eSIR_FAILURE; |
| 2479 | |
| 2480 | // Extract bssId |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 2481 | vos_mem_copy( (tANI_U8 *) pTkipCntrMeasReq->bssId, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2482 | pBuf += sizeof(tSirMacAddr); |
| 2483 | len -= sizeof(tSirMacAddr); |
| 2484 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2485 | return eSIR_FAILURE; |
| 2486 | |
| 2487 | // Extract bEnable |
| 2488 | pTkipCntrMeasReq->bEnable = *pBuf++; |
| 2489 | len --; |
| 2490 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2491 | 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] | 2492 | |
| 2493 | if (len) |
| 2494 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2495 | PELOGE(limLog(pMac, LOGE, FL("SME_TKIP_CNTR_MEAS_REQ invalid "));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2496 | return eSIR_FAILURE; |
| 2497 | } |
| 2498 | else |
| 2499 | return eSIR_SUCCESS; |
| 2500 | } |
| 2501 | |
| 2502 | /** |
| 2503 | * limIsSmeGetWPSPBCSessionsReqValid() |
| 2504 | * |
| 2505 | *FUNCTION: |
| 2506 | * This function is called by limProcessSmeGetWPSPBCSessions() upon |
| 2507 | * receiving query WPS PBC overlap information message from application. |
| 2508 | * |
| 2509 | *LOGIC: |
| 2510 | * Message validity checks are performed in this function |
| 2511 | * |
| 2512 | *ASSUMPTIONS: |
| 2513 | * |
| 2514 | *NOTE: |
| 2515 | * |
| 2516 | * @param pBuf - Pointer to a serialized SME_GET_WPSPBC_SESSION_REQ message |
| 2517 | * @param pGetWPSPBCSessionsReq - Pointer to a tSirSmeGetWPSPBCSessionsReq structure |
| 2518 | * @return true if SME_GET_WPSPBC_SESSION_REQ message is formatted correctly |
| 2519 | * false otherwise |
| 2520 | */ |
| 2521 | |
| 2522 | tSirRetStatus |
| 2523 | limIsSmeGetWPSPBCSessionsReqValid(tpAniSirGlobal pMac, tSirSmeGetWPSPBCSessionsReq *pGetWPSPBCSessionsReq, tANI_U8 *pBuf) |
| 2524 | { |
| 2525 | tANI_S16 len = 0; |
| 2526 | |
| 2527 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirSmeGetWPSPBCSessionsReq));) |
| 2528 | |
| 2529 | pGetWPSPBCSessionsReq->messageType = limGetU16(pBuf); |
| 2530 | pBuf += sizeof(tANI_U16); |
| 2531 | |
| 2532 | len = pGetWPSPBCSessionsReq->length = limGetU16(pBuf); |
| 2533 | pBuf += sizeof(tANI_U16); |
| 2534 | |
| 2535 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 2536 | return eSIR_FAILURE; |
| 2537 | |
| 2538 | len -= sizeof(tANI_U32); // skip message header |
| 2539 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2540 | return eSIR_FAILURE; |
| 2541 | |
| 2542 | // Extract pUsrContext |
| 2543 | pGetWPSPBCSessionsReq->pUsrContext = (void *)limGetU32(pBuf); |
| 2544 | pBuf += sizeof(tANI_U32); |
| 2545 | len -= sizeof(tANI_U32); |
| 2546 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2547 | return eSIR_FAILURE; |
| 2548 | |
| 2549 | // Extract pSapEventCallback |
| 2550 | pGetWPSPBCSessionsReq->pSapEventCallback = (void *)limGetU32(pBuf); |
| 2551 | pBuf += sizeof(tANI_U32); |
| 2552 | len -= sizeof(tANI_U32); |
| 2553 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2554 | return eSIR_FAILURE; |
| 2555 | |
| 2556 | // Extract bssId |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 2557 | vos_mem_copy( (tANI_U8 *) pGetWPSPBCSessionsReq->bssId, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2558 | pBuf += sizeof(tSirMacAddr); |
| 2559 | len -= sizeof(tSirMacAddr); |
| 2560 | |
| 2561 | // Extract MAC address of Station to be removed |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 2562 | vos_mem_copy( (tANI_U8 *) pGetWPSPBCSessionsReq->pRemoveMac, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2563 | pBuf += sizeof(tSirMacAddr); |
| 2564 | len -= sizeof(tSirMacAddr); |
| 2565 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2566 | 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] | 2567 | |
| 2568 | if (len < 0) |
| 2569 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2570 | PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2571 | return eSIR_FAILURE; |
| 2572 | } |
| 2573 | |
| 2574 | return eSIR_SUCCESS; |
| 2575 | } |
| 2576 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2577 | |
| 2578 | /**--------------------------------------------------------------- |
| 2579 | \fn limGetSessionInfo |
| 2580 | \brief This function returns the sessionId and transactionId |
| 2581 | \ of a message. This assumes that the message structure |
| 2582 | \ is of format: |
| 2583 | \ tANI_U16 messageType |
| 2584 | \ tANI_U16 messageLength |
| 2585 | \ tANI_U8 sessionId |
| 2586 | \ tANI_U16 transactionId |
| 2587 | \param pMac - pMac global structure |
| 2588 | \param *pBuf - pointer to the message buffer |
| 2589 | \param sessionId - returned session id value |
| 2590 | \param transactionId - returned transaction ID value |
| 2591 | \return None |
| 2592 | ------------------------------------------------------------------*/ |
| 2593 | void |
| 2594 | limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U8 *sessionId, tANI_U16 *transactionId) |
| 2595 | { |
| 2596 | if (!pBuf) |
| 2597 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2598 | limLog(pMac, LOGE, FL("NULL ptr received. ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2599 | return; |
| 2600 | } |
| 2601 | |
| 2602 | pBuf += sizeof(tANI_U16); // skip message type |
| 2603 | pBuf += sizeof(tANI_U16); // skip message length |
| 2604 | |
| 2605 | *sessionId = *pBuf; // get sessionId |
| 2606 | pBuf++; |
| 2607 | *transactionId = limGetU16(pBuf); // get transactionId |
| 2608 | |
| 2609 | return; |
| 2610 | } |
| 2611 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2612 | |
| 2613 | /** |
| 2614 | * limUpdateAPWPSIEsReqSerDes() |
| 2615 | * |
| 2616 | *FUNCTION: |
| 2617 | * This function is to deserialize UpdateAPWPSIEs message |
| 2618 | * |
| 2619 | *PARAMS: |
| 2620 | * |
| 2621 | *LOGIC: |
| 2622 | * |
| 2623 | *ASSUMPTIONS: |
| 2624 | * NA |
| 2625 | * |
| 2626 | *NOTE: |
| 2627 | * NA |
| 2628 | * |
| 2629 | * @param pUpdateAPWPSIEsReq Pointer to tSirUpdateAPWPSIEsReq being |
| 2630 | * extracted |
| 2631 | * @param pBuf Pointer to serialized buffer |
| 2632 | * |
| 2633 | * @return retCode Indicates whether message is successfully |
| 2634 | * de-serialized (eSIR_SUCCESS) or |
| 2635 | * not (eSIR_FAILURE) |
| 2636 | */ |
| 2637 | |
| 2638 | tSirRetStatus |
| 2639 | limUpdateAPWPSIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq, tANI_U8 *pBuf) |
| 2640 | { |
| 2641 | tANI_S16 len = 0; |
| 2642 | |
| 2643 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPSIEsReq));) |
| 2644 | |
| 2645 | if (!pUpdateAPWPSIEsReq || !pBuf) |
| 2646 | return eSIR_FAILURE; |
| 2647 | |
| 2648 | pUpdateAPWPSIEsReq->messageType = limGetU16(pBuf); |
| 2649 | pBuf += sizeof(tANI_U16); |
| 2650 | |
| 2651 | len = pUpdateAPWPSIEsReq->length = limGetU16(pBuf); |
| 2652 | pBuf += sizeof(tANI_U16); |
| 2653 | |
| 2654 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 2655 | return eSIR_FAILURE; |
| 2656 | |
| 2657 | len -= sizeof(tANI_U32); // skip message header |
| 2658 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2659 | return eSIR_FAILURE; |
| 2660 | |
| 2661 | // Extract transactionId |
| 2662 | pUpdateAPWPSIEsReq->transactionId = limGetU16( pBuf ); |
| 2663 | pBuf += sizeof( tANI_U16 ); |
| 2664 | len -= sizeof( tANI_U16 ); |
| 2665 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2666 | return eSIR_FAILURE; |
| 2667 | |
| 2668 | // Extract bssId |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 2669 | vos_mem_copy( (tANI_U8 *) pUpdateAPWPSIEsReq->bssId, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2670 | pBuf += sizeof(tSirMacAddr); |
| 2671 | len -= sizeof(tSirMacAddr); |
| 2672 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2673 | return eSIR_FAILURE; |
| 2674 | |
| 2675 | // Extract sessionId |
| 2676 | pUpdateAPWPSIEsReq->sessionId = *pBuf++; |
| 2677 | len--; |
| 2678 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2679 | return eSIR_FAILURE; |
| 2680 | |
| 2681 | // Extract APWPSIEs |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 2682 | vos_mem_copy( (tSirAPWPSIEs *) &pUpdateAPWPSIEsReq->APWPSIEs, pBuf, sizeof(tSirAPWPSIEs)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2683 | pBuf += sizeof(tSirAPWPSIEs); |
| 2684 | len -= sizeof(tSirAPWPSIEs); |
| 2685 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2686 | 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] | 2687 | |
| 2688 | if (len < 0) |
| 2689 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2690 | PELOGE(limLog(pMac, LOGE, FL("SME_UPDATE_APWPSIE_REQ invalid length"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2691 | return eSIR_FAILURE; |
| 2692 | } |
| 2693 | |
| 2694 | return eSIR_SUCCESS; |
| 2695 | } /*** end limSetContextReqSerDes() ***/ |
| 2696 | |
| 2697 | /** |
| 2698 | * limUpdateAPWPARSNIEsReqSerDes () |
| 2699 | * |
| 2700 | *FUNCTION: |
| 2701 | * This function is to deserialize UpdateAPWPSIEs message |
| 2702 | * |
| 2703 | *PARAMS: |
| 2704 | * |
| 2705 | *LOGIC: |
| 2706 | * |
| 2707 | *ASSUMPTIONS: |
| 2708 | * NA |
| 2709 | * |
| 2710 | *NOTE: |
| 2711 | * NA |
| 2712 | * |
| 2713 | * @param pUpdateAPWPARSNIEsReq Pointer to tpSirUpdateAPWPARSNIEsReq being |
| 2714 | * extracted |
| 2715 | * @param pBuf Pointer to serialized buffer |
| 2716 | * |
| 2717 | * @return retCode Indicates whether message is successfully |
| 2718 | * de-serialized (eSIR_SUCCESS) or |
| 2719 | * not (eSIR_FAILURE) |
| 2720 | */ |
| 2721 | |
| 2722 | tSirRetStatus |
| 2723 | limUpdateAPWPARSNIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq, tANI_U8 *pBuf) |
| 2724 | { |
| 2725 | tANI_S16 len = 0; |
| 2726 | |
| 2727 | PELOG1(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, pBuf, sizeof(tSirUpdateAPWPARSNIEsReq));) |
| 2728 | |
| 2729 | if (!pUpdateAPWPARSNIEsReq || !pBuf) |
| 2730 | return eSIR_FAILURE; |
| 2731 | |
| 2732 | pUpdateAPWPARSNIEsReq->messageType = limGetU16(pBuf); |
| 2733 | pBuf += sizeof(tANI_U16); |
| 2734 | |
| 2735 | len = pUpdateAPWPARSNIEsReq->length = limGetU16(pBuf); |
| 2736 | pBuf += sizeof(tANI_U16); |
| 2737 | |
| 2738 | if (len < (tANI_S16) sizeof(tANI_U32)) |
| 2739 | return eSIR_FAILURE; |
| 2740 | |
| 2741 | len -= sizeof(tANI_U32); // skip message header |
| 2742 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2743 | return eSIR_FAILURE; |
| 2744 | |
| 2745 | // Extract transactionId |
| 2746 | pUpdateAPWPARSNIEsReq->transactionId = limGetU16( pBuf ); |
| 2747 | pBuf += sizeof(tANI_U16); |
| 2748 | len -= sizeof( tANI_U16 ); |
| 2749 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2750 | return eSIR_FAILURE; |
| 2751 | |
| 2752 | // Extract bssId |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 2753 | vos_mem_copy( (tANI_U8 *) pUpdateAPWPARSNIEsReq->bssId, pBuf, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2754 | pBuf += sizeof(tSirMacAddr); |
| 2755 | len -= sizeof(tSirMacAddr); |
| 2756 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2757 | return eSIR_FAILURE; |
| 2758 | |
| 2759 | // Extract sessionId |
| 2760 | pUpdateAPWPARSNIEsReq->sessionId = *pBuf++; |
| 2761 | len--; |
| 2762 | if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE) |
| 2763 | return eSIR_FAILURE; |
| 2764 | |
| 2765 | // Extract APWPARSNIEs |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 2766 | vos_mem_copy( (tSirRSNie *) &pUpdateAPWPARSNIEsReq->APWPARSNIEs, pBuf, sizeof(tSirRSNie)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2767 | pBuf += sizeof(tSirRSNie); |
| 2768 | len -= sizeof(tSirRSNie); |
| 2769 | |
| 2770 | if (len < 0) |
| 2771 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2772 | PELOGE(limLog(pMac, LOGE, FL("SME_GET_WPSPBC_SESSION_REQ invalid length"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2773 | return eSIR_FAILURE; |
| 2774 | } |
| 2775 | |
| 2776 | return eSIR_SUCCESS; |
| 2777 | } /*** end limUpdateAPWPARSNIEsReqSerDes() ***/ |
| 2778 | |