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