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