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