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