Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 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 | * |
| 30 | * This file lim_ser_des_utils.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 "ani_system_defs.h" |
| 41 | #include "utils_api.h" |
| 42 | #include "lim_types.h" |
| 43 | #include "lim_utils.h" |
| 44 | #include "lim_ser_des_utils.h" |
| 45 | |
| 46 | /**--------------------------------------------------------------- |
| 47 | \fn lim_get_session_info |
| 48 | \brief This function returns the sessionId and transactionId |
| 49 | \ of a message. This assumes that the message structure |
| 50 | \ is of format: |
| 51 | \ uint16_t messageType |
| 52 | \ uint16_t messageLength |
| 53 | \ uint8_t sessionId |
| 54 | \ uint16_t transactionId |
| 55 | \param pMac - pMac global structure |
| 56 | \param *pBuf - pointer to the message buffer |
| 57 | \param sessionId - returned session id value |
| 58 | \param transactionId - returned transaction ID value |
| 59 | \return None |
| 60 | ------------------------------------------------------------------*/ |
| 61 | void |
| 62 | lim_get_session_info(tpAniSirGlobal pMac, uint8_t *pBuf, uint8_t *sessionId, |
| 63 | uint16_t *transactionId) |
| 64 | { |
| 65 | if (!pBuf) { |
| 66 | lim_log(pMac, LOGE, FL("NULL ptr received. ")); |
| 67 | return; |
| 68 | } |
| 69 | |
| 70 | pBuf += sizeof(uint16_t); /* skip message type */ |
| 71 | pBuf += sizeof(uint16_t); /* skip message length */ |
| 72 | |
| 73 | *sessionId = *pBuf; /* get sessionId */ |
| 74 | pBuf++; |
| 75 | *transactionId = lim_get_u16(pBuf); /* get transactionId */ |
| 76 | |
| 77 | return; |
| 78 | } |