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