blob: 29aff5a85198973fc421ef04b0cbc197e137f938 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05302 * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
AnjaneeDevi Kapparapu24b52ff2014-02-18 18:44:02 -08003 *
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 Nakkala9c070ad2013-01-08 21:16:34 -080020 */
AnjaneeDevi Kapparapu24b52ff2014-02-18 18:44:02 -080021
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
Gopichand Nakkala9c070ad2013-01-08 21:16:34 -080028/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 *
Jeff Johnson295189b2012-06-20 16:38:30 -070030 * This file limSerDesUtils.h contains the utility definitions
31 * LIM uses while processing messages from upper layer software
32 * modules
33 * Author: Chandra Modumudi
34 * Date: 10/20/02
35 * History:-
36 * Date Modified by Modification Information
37 * --------------------------------------------------------------------
38 */
39#ifndef __LIM_SERDES_UTILS_H
40#define __LIM_SERDES_UTILS_H
41
42#include "sirApi.h"
43#include "aniSystemDefs.h"
44#include "sirMacProtDef.h"
45#include "utilsApi.h"
46#include "limTypes.h"
47#include "limPropExtsUtils.h"
48
49tSirRetStatus limStartBssReqSerDes(tpAniSirGlobal, tpSirSmeStartBssReq, tANI_U8 *);
50tSirRetStatus limStopBssReqSerDes(tpAniSirGlobal, tpSirSmeStopBssReq, tANI_U8 *);
51tSirRetStatus limJoinReqSerDes(tpAniSirGlobal, tpSirSmeJoinReq, tANI_U8 *);
52void limAssocIndSerDes(tpAniSirGlobal, tpLimMlmAssocInd, tANI_U8 *, tpPESession);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +053053tSirRetStatus limReassocIndSerDes(tpAniSirGlobal, tpLimMlmReassocInd, tANI_U8 *,
54 tpPESession psessionEntry, tANI_U16 len);
Jeff Johnson295189b2012-06-20 16:38:30 -070055tSirRetStatus limAssocCnfSerDes(tpAniSirGlobal, tpSirSmeAssocCnf, tANI_U8 *);
56tSirRetStatus limDisassocCnfSerDes(tpAniSirGlobal, tpSirSmeDisassocCnf, tANI_U8 *);
57tSirRetStatus limSetContextReqSerDes(tpAniSirGlobal, tpSirSmeSetContextReq, tANI_U8 *);
58tSirRetStatus limDisassocReqSerDes(tpAniSirGlobal, tSirSmeDisassocReq *, tANI_U8 *);
59tSirRetStatus limDeauthReqSerDes(tpAniSirGlobal, tSirSmeDeauthReq *, tANI_U8 *);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +053060tSirRetStatus limAuthIndSerDes(tpAniSirGlobal, tpLimMlmAuthInd, tANI_U8 *,
61 tANI_U16 len);
Jeff Johnson295189b2012-06-20 16:38:30 -070062void limStatSerDes(tpAniSirGlobal, tpAniStaStatStruct, tANI_U8 *);
63void limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *, tANI_U8 *, tANI_U16 *);
64
Jeff Johnson295189b2012-06-20 16:38:30 -070065
66void limPackBkgndScanFailNotify(tpAniSirGlobal, tSirSmeStatusChangeCode,
67 tpSirBackgroundScanInfo, tSirSmeWmStatusChangeNtf *, tANI_U8);
68
Jeff Johnson295189b2012-06-20 16:38:30 -070069
70tSirRetStatus limRemoveKeyReqSerDes(tpAniSirGlobal pMac, tpSirSmeRemoveKeyReq pRemoveKeyReq, tANI_U8 * pBuf);
71
Jeff Johnson295189b2012-06-20 16:38:30 -070072tANI_BOOLEAN limIsSmeGetAssocSTAsReqValid(tpAniSirGlobal pMac, tpSirSmeGetAssocSTAsReq pGetAssocSTAsReq, tANI_U8 *pBuf);
73tSirRetStatus limTkipCntrMeasReqSerDes(tpAniSirGlobal pMac, tpSirSmeTkipCntrMeasReq ptkipCntrMeasReq, tANI_U8 *pBuf);
74
75tSirRetStatus limUpdateAPWPSIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq, tANI_U8 *pBuf);
76tSirRetStatus limUpdateAPWPARSNIEsReqSerDes(tpAniSirGlobal pMac, tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq, tANI_U8 *pBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -070077
Jeff Johnson295189b2012-06-20 16:38:30 -070078
79// Byte String <--> tANI_U16/tANI_U32 copy functions
80static inline void limCopyU16(tANI_U8 *ptr, tANI_U16 u16Val)
81{
Jeff Johnson8347b442013-03-07 08:15:44 -080082#if ((defined(ANI_OS_TYPE_QNX) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
83 (defined(ANI_OS_TYPE_ANDROID) && defined(ANI_LITTLE_BYTE_ENDIAN)))
Jeff Johnson295189b2012-06-20 16:38:30 -070084 *ptr++ = (tANI_U8) (u16Val & 0xff);
85 *ptr = (tANI_U8) ((u16Val >> 8) & 0xff);
86#else
87#error "Unknown combination of OS Type and endianess"
88#endif
89}
90
91static inline tANI_U16 limGetU16(tANI_U8 *ptr)
92{
Jeff Johnson8347b442013-03-07 08:15:44 -080093#if ((defined(ANI_OS_TYPE_QNX) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
94 (defined(ANI_OS_TYPE_ANDROID) && defined(ANI_LITTLE_BYTE_ENDIAN)))
Jeff Johnson295189b2012-06-20 16:38:30 -070095 return (((tANI_U16) (*(ptr+1) << 8)) |
96 ((tANI_U16) (*ptr)));
97#else
98#error "Unknown combination of OS Type and endianess"
99#endif
100}
101
102static inline void limCopyU32(tANI_U8 *ptr, tANI_U32 u32Val)
103{
Jeff Johnson8347b442013-03-07 08:15:44 -0800104#if ((defined(ANI_OS_TYPE_QNX) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
105 (defined(ANI_OS_TYPE_ANDROID) && defined(ANI_LITTLE_BYTE_ENDIAN)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700106 *ptr++ = (tANI_U8) (u32Val & 0xff);
107 *ptr++ = (tANI_U8) ((u32Val >> 8) & 0xff);
108 *ptr++ = (tANI_U8) ((u32Val >> 16) & 0xff);
109 *ptr = (tANI_U8) ((u32Val >> 24) & 0xff);
110#else
111#error "Unknown combination of OS Type and endianess"
112#endif
113}
114
115static inline tANI_U32 limGetU32(tANI_U8 *ptr)
116{
Jeff Johnson8347b442013-03-07 08:15:44 -0800117#if ((defined(ANI_OS_TYPE_QNX) && defined(ANI_LITTLE_BYTE_ENDIAN)) || \
118 (defined(ANI_OS_TYPE_ANDROID) && defined(ANI_LITTLE_BYTE_ENDIAN)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700119 return ((*(ptr+3) << 24) |
120 (*(ptr+2) << 16) |
121 (*(ptr+1) << 8) |
122 (*(ptr)));
123#else
124#error "Unknown combination of OS Type and endianess"
125#endif
126}
127
128#endif /* __LIM_SERDES_UTILS_H */
129