1/*
2 * admCtrl.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 admCtrl.h
35 *  \brief Admission control API
36 *
37 *  \see admCtrl.c
38 */
39
40/****************************************************************************
41 *                                                                          *
42 *   MODULE:  Admission Control                                             *
43 *   PURPOSE: Admission Control Module API                                  *
44 *                                                                          *
45 ****************************************************************************/
46
47#ifndef _ADM_CTRL_H_
48#define _ADM_CTRL_H_
49
50#include "rsnApi.h"
51#include "TWDriver.h"
52
53/* Constants */
54
55/* Enumerations */
56
57/* Typedefs */
58
59typedef struct _admCtrl_t   admCtrl_t;
60
61/* RSN admission control prototypes */
62
63typedef TI_STATUS (*admCtrl_setAuthSuite_t)(admCtrl_t *pAdmCtrl, EAuthSuite authSuite);
64
65typedef TI_STATUS (*admCtrl_getAuthSuite_t)(admCtrl_t *pAdmCtrl, EAuthSuite *pSuite);
66
67typedef TI_STATUS (*admCtrl_setNetworkMode_t)(admCtrl_t *pAdmCtrl, ERsnNetworkMode mode);
68
69typedef TI_STATUS (*admCtrl_setUcastCipherSuite_t)(admCtrl_t *pAdmCtrl, ECipherSuite suite);
70
71typedef TI_STATUS (*admCtrl_setBcastCipherSuite_t)(admCtrl_t *pAdmCtrl, ECipherSuite suite);
72
73typedef TI_STATUS (*admCtrl_getCipherSuite_t)(admCtrl_t *pAdmCtrl, ECipherSuite *pSuite);
74
75typedef TI_STATUS (*admCtrl_setKeyMngSuite_t)(admCtrl_t *pAdmCtrl, ERsnKeyMngSuite suite);
76
77typedef TI_STATUS (*admCtrl_setExtAuthMode_t)(admCtrl_t *pAdmCtrl, EExternalAuthMode extAuthMode);
78
79typedef TI_STATUS (*admCtrl_getExtAuthMode_t)(admCtrl_t *pAdmCtrl, EExternalAuthMode *pExtAuthMode);
80
81typedef TI_STATUS (*admCtrl_getInfoElement_t)(admCtrl_t *pAdmCtrl, TI_UINT8 *pIe, TI_UINT32 *pLength);
82
83typedef TI_STATUS (*admCtrl_setSite_t)(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 *pAssocIe, TI_UINT8 *pAssocIeLen);
84
85typedef TI_STATUS (*admCtrl_evalSite_t)(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TRsnSiteParams *pRsnSiteParams, TI_UINT32 *pEvaluation);
86
87typedef TI_STATUS (*admCtrl_setMixedMode_t)(admCtrl_t *pAdmCtrl, TI_BOOL mixedMode);
88
89typedef TI_STATUS (*admCtrl_getMixedMode_t)(admCtrl_t *pAdmCtrl, TI_BOOL *mixedMode);
90
91typedef TI_STATUS (*admCtrl_getAuthEncrCapability_t)(admCtrl_t *pAdmCtrl,
92                                        rsnAuthEncrCapability_t   *authEncrCapability);
93
94typedef TI_STATUS (*admCtrl_setPMKIDlist_t)(admCtrl_t *pAdmCtrl, OS_802_11_PMKID  *pmkIdList);
95
96typedef TI_STATUS (*admCtrl_getPMKIDlist_t)(admCtrl_t *pAdmCtrl, OS_802_11_PMKID  *pmkIdList);
97
98typedef TI_STATUS (*admCtrl_resetPMKIDlist_t)(admCtrl_t *pAdmCtrl);
99
100typedef TI_STATUS (*admCtrl_sendPMKIDCandListAfterDelay_t)(admCtrl_t *pAdmCtrl, TI_UINT32 delay);
101
102typedef TI_STATUS (*admCtrl_setPromoteFlags_t)(admCtrl_t *pAdmCtrl, TI_UINT32 flags);
103
104typedef TI_STATUS (*admCtrl_getPromoteFlags_t)(admCtrl_t *pAdmCtrl, TI_UINT32 *flags);
105
106typedef TI_STATUS (*admCtrl_getWPAMixedModeSupport_t)(admCtrl_t *pAdmCtrl, TI_UINT32 *support);
107
108#ifdef XCC_MODULE_INCLUDED
109typedef TI_STATUS (*admCtrl_getNetworkEap_t)(admCtrl_t *pAdmCtrl, OS_XCC_NETWORK_EAP *networkEap);
110
111typedef TI_STATUS (*admCtrl_setNetworkEap_t)(admCtrl_t *pAdmCtrl, OS_XCC_NETWORK_EAP networkEap);
112#endif
113
114
115typedef TI_BOOL (*admCtrl_getPreAuthStatus_t)(admCtrl_t *pAdmCtrl, TMacAddr *givenAP, TI_UINT8 *cacheIndex);
116
117typedef TI_STATUS (*admCtrl_startPreAuth_t)(admCtrl_t *pAdmCtrl, TBssidList4PreAuth *pBssidList);
118
119typedef TI_STATUS (*admCtrl_get802_1x_AkmExists_t)(admCtrl_t *pAdmCtrl, TI_BOOL *wpa_802_1x_AkmExists);
120/* Constants */
121
122/* Flags for Any-WPA (WPA Mixed) mode) - set by the Supplicant  */
123#define ADMCTRL_WPA_OPTION_NONE  							0x00000000
124#define ADMCTRL_WPA_OPTION_ENABLE_PROMOTE_AUTH_MODE  	0x00000001
125#define ADMCTRL_WPA_OPTION_ENABLE_PROMOTE_CIPHER     	0x00000002
126
127#define ADMCTRL_WPA_OPTION_MAXVALUE                  	0x00000003
128
129
130/* Structures */
131
132/* PMKID cache structures                        */
133/* (PMKID cache used for WPA2 pre-authentication */
134
135#define PMKID_VALUE_SIZE  16
136typedef TI_UINT8 pmkidValue_t[PMKID_VALUE_SIZE];
137
138#define PMKID_MAX_NUMBER 16
139
140typedef struct
141{
142   TMacAddr         bssId;
143   pmkidValue_t     pmkId;
144   TI_BOOL          preAuthenticate;
145
146} pmkidEntry_t;
147
148#define ADMCTRL_PMKID_CACHE_SIZE 32
149
150typedef struct
151{
152   TSsid               ssid;
153   TI_UINT8            entriesNumber;
154   TI_UINT8            nextFreeEntry;
155   pmkidEntry_t        pmkidTbl[ADMCTRL_PMKID_CACHE_SIZE];
156} pmkid_cache_t;
157
158
159
160/* Admission control object */
161struct _admCtrl_t
162{
163    ERsnPaeRole             role;
164    EAuthSuite              authSuite;
165    ERsnNetworkMode         networkMode;
166    EExternalAuthMode       externalAuthMode;
167    ECipherSuite            unicastSuite;
168    ECipherSuite            broadcastSuite;
169    ERsnKeyMngSuite         keyMngSuite;
170    TI_BOOL                 wpaAkmExists;
171    TI_BOOL                 mixedMode;
172    TI_UINT8                AP_IP_Address[4];
173    TI_UINT16               replayCnt;
174    TI_UINT8                aironetIeReserved[8];
175    TI_BOOL                 encrInSw;
176    TI_BOOL                 micInSw;
177    TI_BOOL                 setSiteFirst;
178#ifdef XCC_MODULE_INCLUDED
179    OS_XCC_NETWORK_EAP      networkEapMode;
180#endif
181    TI_BOOL                 XCCSupport;
182    TI_BOOL                 proxyArpEnabled;
183
184    TI_BOOL                 WPAMixedModeEnable;
185    TI_UINT32               WPAPromoteFlags;
186
187    TI_BOOL                 preAuthSupport;
188    TI_UINT32               preAuthTimeout;
189    TI_UINT8                MaxNumOfPMKIDs;
190    pmkid_cache_t           pmkid_cache;
191
192    struct _rsn_t           *pRsn;
193    TI_HANDLE               hMlme;
194    TI_HANDLE               hRx;
195    TI_HANDLE               hReport;
196    TI_HANDLE               hOs;
197    TI_HANDLE               hXCCMngr;
198    TI_HANDLE               hPowerMgr;
199    TI_HANDLE               hEvHandler;
200    TI_HANDLE               hTimer;
201    TI_HANDLE               hCurrBss;
202    TI_HANDLE               hSme;
203
204
205    admCtrl_setAuthSuite_t              setAuthSuite;
206    admCtrl_getAuthSuite_t              getAuthSuite;
207    admCtrl_setNetworkMode_t            setNetworkMode;
208    admCtrl_setUcastCipherSuite_t       setUcastSuite;
209    admCtrl_setBcastCipherSuite_t       setBcastSuite;
210    admCtrl_setExtAuthMode_t            setExtAuthMode;
211    admCtrl_getExtAuthMode_t            getExtAuthMode;
212    admCtrl_getCipherSuite_t            getCipherSuite;
213    admCtrl_setKeyMngSuite_t            setKeyMngSuite;
214    admCtrl_setMixedMode_t              setMixedMode;
215    admCtrl_getMixedMode_t              getMixedMode;
216    admCtrl_getInfoElement_t            getInfoElement;
217    admCtrl_setSite_t                   setSite;
218    admCtrl_evalSite_t                  evalSite;
219    admCtrl_getAuthEncrCapability_t     getAuthEncrCap;
220    admCtrl_setPMKIDlist_t              setPmkidList;
221    admCtrl_getPMKIDlist_t              getPmkidList;
222    admCtrl_resetPMKIDlist_t            resetPmkidList;
223    admCtrl_setPromoteFlags_t           setPromoteFlags;
224    admCtrl_getPromoteFlags_t           getPromoteFlags;
225    admCtrl_getWPAMixedModeSupport_t    getWPAMixedModeSupport;
226    admCtrl_get802_1x_AkmExists_t       get802_1x_AkmExists;
227
228
229#ifdef XCC_MODULE_INCLUDED
230    admCtrl_getNetworkEap_t         getNetworkEap;
231    admCtrl_setNetworkEap_t         setNetworkEap;
232#endif
233
234    admCtrl_getPreAuthStatus_t      getPreAuthStatus;
235    admCtrl_startPreAuth_t          startPreAuth;
236
237    void                            *hPreAuthTimerWpa2;
238    TI_UINT8                           numberOfPreAuthCandidates;
239};
240
241/* External data definitions */
242
243/* External functions definitions */
244
245/* Function prototypes */
246
247admCtrl_t* admCtrl_create(TI_HANDLE hOs);
248
249TI_STATUS admCtrl_config (TI_HANDLE hAdmCtrl,
250                          TI_HANDLE hMlme,
251                          TI_HANDLE hRx,
252                          TI_HANDLE hReport,
253                          TI_HANDLE hOs,
254                          struct _rsn_t *pRsn,
255                          TI_HANDLE hXCCMngr,
256                          TI_HANDLE hPowerMgr,
257                          TI_HANDLE hEvHandler,
258                          TI_HANDLE hTimer,
259                          TI_HANDLE hCurrBss,
260                          TRsnInitParams *pInitParam);
261
262TI_STATUS admCtrl_unload(admCtrl_t *pAdmCtrl);
263
264TI_STATUS admCtrlNone_config(admCtrl_t *pAdmCtrl);
265
266TI_STATUS admCtrlWpa_config(admCtrl_t *pAdmCtrl);
267
268TI_STATUS admCtrl_parseIe(admCtrl_t *pAdmCtrl, TRsnData *pRsnData, TI_UINT8 **pIe, TI_UINT8 IeId);
269
270TI_STATUS admCtrl_subConfig(TI_HANDLE hAdmCtrl);
271
272TI_STATUS admCtrl_nullSetPMKIDlist(admCtrl_t *pAdmCtrl, OS_802_11_PMKID  *pmkIdList);
273
274TI_STATUS admCtrl_nullGetPMKIDlist(admCtrl_t *pAdmCtrl, OS_802_11_PMKID  *pmkIdList);
275
276TI_STATUS admCtrl_resetPMKIDlist(admCtrl_t *pAdmCtrl);
277
278TI_BOOL admCtrl_nullGetPreAuthStatus(admCtrl_t *pAdmCtrl, TMacAddr *givenAP, TI_UINT8 *cacheIndex);
279
280TI_STATUS admCtrl_nullStartPreAuth(admCtrl_t *pAdmCtrl, TBssidList4PreAuth *pBssidList);
281
282TI_STATUS admCtrl_nullGet802_1x_AkmExists(admCtrl_t *pAdmCtrl, TI_BOOL *wpa_802_1x_AkmExists);
283
284void admCtrl_notifyPreAuthStatus (admCtrl_t *pAdmCtrl, preAuthStatusEvent_e newStatus);
285
286#endif /*  _ADM_H_*/
287
288