• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * mlmeApi.h
3  *
4  * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  *  * Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  *  * Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in
15  *    the documentation and/or other materials provided with the
16  *    distribution.
17  *  * Neither the name Texas Instruments nor the names of its
18  *    contributors may be used to endorse or promote products derived
19  *    from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 /** \file mlmeApi.h
35  *  \brief MLME API
36  *
37  *  \see mlmeSm.c
38  */
39 
40 /***************************************************************************/
41 /*                                                                          */
42 /*    MODULE:   mlmeApi.h                                                   */
43 /*    PURPOSE:  MLME API                                                    */
44 /*                                                                          */
45 /***************************************************************************/
46 #ifndef __MLME_API_H__
47 #define __MLME_API_H__
48 
49 #include "tidef.h"
50 #include "paramOut.h"
51 #include "802_11Defs.h"
52 #include "TWDriver.h"
53 #include "DrvMainModules.h"
54 
55 /* Constants */
56 
57 /* Enumerations */
58 
59 typedef enum
60 {
61     MLME_LEGACY_TYPE_PARAM   = 0x01,
62     MLME_RE_ASSOC_PARAM      = 0x02,
63     MLME_TNET_WAKE_ON_PARAM  = 0x03,
64     MLME_CAPABILITY_PARAM    = 0x04
65 
66 } EMlmeParam;
67 
68 
69 typedef enum
70 {
71     AUTH_LEGACY_TYPE_PARAM   = 0x01
72 
73 } EAuthLegacyParam;
74 
75 
76 typedef enum
77 {
78     MSG_BROADCAST,
79     MSG_MULTICAST,
80     MSG_UNICAST
81 } mlmeMsgDestType_t;
82 
83 /* Typedefs */
84 
85 /* Disassociation frame structure */
86 typedef struct
87 {
88     TI_UINT16                   reason;
89 }  disAssoc_t;
90 
91 
92 /* (Re)Association response frame structure */
93 #define ASSOC_RESP_FIXED_DATA_LEN 6
94 #define ASSOC_RESP_AID_MASK  0x3FFF  /* The AID is only in 14 LS bits. */
95 
96 typedef struct
97 {
98     TI_UINT16                   capabilities;
99     TI_UINT16                   status;
100     TI_UINT16                   aid;
101     dot11_RATES_t               *pRates;
102     dot11_RATES_t               *pExtRates;
103     TI_UINT8                    useProtection;
104     TI_BOOL                     ciscoIEPresent;
105     EPreamble                   barkerPreambleMode;
106     TI_UINT8                    NonErpPresent;
107     dot11_WME_PARAM_t           *WMEParams;
108     dot11_RSN_t                 *pRsnIe;
109     TI_UINT8                    rsnIeLen;
110     dot11_QOS_CAPABILITY_IE_t   *QoSCapParameters;
111 	Tdot11HtCapabilitiesUnparse *pHtCapabilities;
112 	Tdot11HtInformationUnparse	*pHtInformation;
113     TI_UINT8                    *tspecVoiceParameters;  /* dot11_WME_TSPEC_IE_t is unpacked so need to access as bytes. */
114     TI_UINT8                    *tspecSignalParameters; /* dot11_WME_TSPEC_IE_t is unpacked so need to access as bytes. */
115     XCCv4IEs_t                  XCCIEs[MAX_NUM_OF_AC];
116 }  assocRsp_t;
117 
118 
119 /* Probe response frame structure */
120 /* Please notice, the order of fields in the beacon must be identical to the order of
121     field in the probe response. This is because of the parsing that is done by the site manager. */
122 typedef struct
123 {
124     char                        timestamp[TIME_STAMP_LEN];
125     TI_UINT16                   beaconInerval;
126     TI_UINT16                   capabilities;
127     dot11_SSID_t                *pSsid;
128     dot11_RATES_t               *pRates;
129     dot11_COUNTRY_t             *country;
130     dot11_POWER_CONSTRAINT_t    *powerConstraint;
131     dot11_CHANNEL_SWITCH_t      *channelSwitch;
132     dot11_QUIET_t               *quiet;
133     dot11_TPC_REPORT_t          *TPCReport;
134 
135 #ifdef XCC_MODULE_INCLUDED
136     dot11_CELL_TP_t             *cellTP;
137 #endif
138 
139     dot11_WME_PARAM_t           *WMEParams;
140     dot11_WSC_t                 *WSCParams;
141     dot11_RATES_t               *pExtRates;
142     TI_UINT8                    useProtection;
143     EPreamble                   barkerPreambleMode;
144     TI_UINT8                    NonErpPresent;
145     dot11_FH_PARAMS_t           *pFHParamsSet;
146     dot11_DS_PARAMS_t           *pDSParamsSet;
147     dot11_CF_PARAMS_t           *pCFParamsSet;
148     dot11_IBSS_PARAMS_t         *pIBSSParamsSet;
149     dot11_RSN_t                 *pRsnIe;
150     TI_UINT8                    rsnIeLen;
151     dot11_QOS_CAPABILITY_IE_t   *QoSCapParameters;
152 	Tdot11HtCapabilitiesUnparse *pHtCapabilities;
153 	Tdot11HtInformationUnparse	*pHtInformation;
154     dot11_TIM_t                 *pTIM;                  /* for beacons only */
155     TI_UINT8                    *pUnknownIe;
156     TI_UINT16                   unknownIeLen;
157 } beacon_probeRsp_t;
158 
159 
160 /* Authentication message frame structure */
161 typedef struct
162 {
163     TI_UINT16                   authAlgo;
164     TI_UINT16                   seqNum;
165     TI_UINT16                   status;
166     dot11_CHALLENGE_t           *pChallenge;
167 }  authMsg_t;
168 
169 /* DeAuthentication message frame structure */
170 typedef struct
171 {
172     TI_UINT16                   reason;
173 }  deAuth_t;
174 
175 /* Action message frame structure */
176 typedef struct
177 {
178     TI_UINT8                    frameType;
179     TI_UINT8                    category;
180     TI_UINT8                    action;
181 } action_t;
182 
183 
184 typedef struct
185 {
186     dot11MgmtSubType_e subType;
187 
188     union
189     {
190         beacon_probeRsp_t iePacket;
191         disAssoc_t  disAssoc;
192         assocRsp_t  assocRsp;
193         authMsg_t   auth;
194         deAuth_t    deAuth;
195         action_t    action;
196     } content;
197 
198     union
199     {
200         mlmeMsgDestType_t   destType;
201     } extesion;
202 
203 } mlmeFrameInfo_t;
204 
205 typedef struct
206 {
207     dot11_SSID_t            ssid;
208     TMacAddr                bssid;
209     dot11_CHALLENGE_t       challenge;
210     dot11_RATES_t           rates;
211     dot11_RATES_t           extRates;
212     dot11_FH_PARAMS_t       fhParams;
213     dot11_CF_PARAMS_t       cfParams;
214     dot11_DS_PARAMS_t       dsParams;
215     dot11_IBSS_PARAMS_t     ibssParams;
216     dot11_COUNTRY_t         country;
217     dot11_WME_PARAM_t       WMEParams;
218     dot11_WSC_t             WSCParams;
219     dot11_POWER_CONSTRAINT_t powerConstraint;
220     dot11_CHANNEL_SWITCH_t  channelSwitch;
221     dot11_QUIET_t           quiet;
222     dot11_TPC_REPORT_t      TPCReport;
223 #ifdef XCC_MODULE_INCLUDED
224     dot11_CELL_TP_t         cellTP;
225 #endif
226     dot11_RSN_t             rsnIe[3];
227     dot11_TIM_t             tim;
228     dot11_QOS_CAPABILITY_IE_t   QosCapParams;
229 	Tdot11HtCapabilitiesUnparse tHtCapabilities;
230 	Tdot11HtInformationUnparse	tHtInformation;
231     TI_UINT8                rxChannel;
232     TI_UINT8                band;
233     TI_BOOL                 myBssid;
234     TI_BOOL                 myDst;
235     TI_BOOL                 mySa;
236 
237     TI_BOOL                 recvChannelSwitchAnnoncIE;
238 
239 	TI_UINT8                unknownIe[MAX_BEACON_BODY_LENGTH];
240 
241     mlmeFrameInfo_t         frame;
242 }mlmeIEParsingParams_t;
243 
244 typedef void (*mlme_resultCB_t)( TI_HANDLE hObj, TMacAddr* bssid, mlmeFrameInfo_t* pFrameInfo,
245                                  TRxAttr* pRxAttr, TI_UINT8* frame, TI_UINT16 frameLength );
246 
247 /* External data definitions */
248 
249 /* External functions definitions */
250 
251 /* Function prototypes */
252 
253 /* MLME SM API */
254 
255 TI_HANDLE mlme_create(TI_HANDLE hOs);
256 
257 TI_STATUS mlme_unload(TI_HANDLE hMlme);
258 
259 void      mlme_init (TStadHandlesList *pStadHandles);
260 
261 void      mlme_SetDefaults (TI_HANDLE hMlmeSm, TMlmeInitParams *pMlmeInitParams);
262 
263 TI_STATUS mlme_setParam(TI_HANDLE           hMlmeSm,
264                         paramInfo_t         *pParam);
265 
266 TI_STATUS mlme_getParam(TI_HANDLE           hMlmeSm,
267                         paramInfo_t         *pParam);
268 
269 TI_STATUS mlme_start(TI_HANDLE hMlme);
270 
271 TI_STATUS mlme_stop(TI_HANDLE hMlme, DisconnectType_e disConnType, mgmtStatus_e reason);
272 
273 TI_STATUS mlme_reportAuthStatus(TI_HANDLE hMlme, TI_UINT16 status);
274 
275 TI_STATUS mlme_reportAssocStatus(TI_HANDLE hMlme, TI_UINT16 status);
276 
277 /* MLME parser API */
278 
279 TI_STATUS mlmeParser_recv(TI_HANDLE hMlme, void *pBuffer, TRxAttr* pRxAttr);
280 
281 TI_STATUS mlmeParser_parseIEs(TI_HANDLE hMlme,
282                               TI_UINT8 *pData,
283                               TI_INT32 bodyDataLen,
284                               mlmeIEParsingParams_t *params);
285 TI_BOOL mlmeParser_ParseIeBuffer (TI_HANDLE hMlme, TI_UINT8 *pIeBuffer, TI_UINT32 length, TI_UINT8 desiredIeId, TI_UINT8 **pDesiredIe, TI_UINT8 *pMatchBuffer, TI_UINT32 matchBufferLen);
286 
287 #ifdef XCC_MODULE_INCLUDED
288 void mlmeParser_readXCCOui (TI_UINT8 *pData,
289                             TI_UINT32 dataLen,
290                             TI_UINT32 *pReadLen,
291                             XCCv4IEs_t *XCCIEs);
292 #endif
293 
294 mlmeIEParsingParams_t *mlmeParser_getParseIEsBuffer(TI_HANDLE *hMlme);
295 
296 /* Association SM API */
297 
298 TI_HANDLE assoc_create(TI_HANDLE pOs);
299 
300 TI_STATUS assoc_unload(TI_HANDLE pAssoc);
301 
302 void      assoc_init (TStadHandlesList *pStadHandles);
303 
304 TI_STATUS assoc_SetDefaults (TI_HANDLE hAssoc, assocInitParams_t *pAssocInitParams);
305 
306 TI_STATUS assoc_setParam(TI_HANDLE hCtrlData, paramInfo_t   *pParam);
307 
308 TI_STATUS assoc_getParam(TI_HANDLE hCtrlData, paramInfo_t   *pParam);
309 
310 /* Authentication SM API */
311 
312 TI_HANDLE auth_create(TI_HANDLE hOs);
313 
314 TI_STATUS auth_unload(TI_HANDLE hAuth);
315 
316 void      auth_init (TStadHandlesList *pStadHandles);
317 
318 TI_STATUS auth_SetDefaults (TI_HANDLE hAuth, authInitParams_t *pAuthInitParams);
319 
320 TI_STATUS auth_setParam(TI_HANDLE hCtrlData, paramInfo_t    *pParam);
321 
322 TI_STATUS auth_getParam(TI_HANDLE hCtrlData, paramInfo_t    *pParam);
323 
324 #endif /* __MLME_API_H__*/
325