1/*
2 * rsn.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 assocSM.h
35 *  \brief 802.11 Association SM
36 *
37 *  \see assocSM.c
38 */
39
40
41/***************************************************************************/
42/*                                                                         */
43/*      MODULE: assocSM.h                                                  */
44/*    PURPOSE:  802.11 Association SM                                      */
45/*                                                                         */
46/***************************************************************************/
47
48#ifndef _RSN_H
49#define _RSN_H
50
51#include "rsnApi.h"
52#include "paramOut.h"
53#include "siteHash.h"
54
55/* Constants */
56#define RSN_MAX_IDENTITY_LEN            64
57#define RSN_MAX_PASSWD_LEN              128
58
59#define RSN_MAX_NUMBER_OF_EVENTS        6
60#define RSN_MAX_NUMBER_OF_BANNED_SITES  16
61#define RSN_MIC_FAILURE_REPORT_TIMEOUT     500
62#define RSN_MIC_FAILURE_TIMEOUT         (60000 + RSN_MIC_FAILURE_REPORT_TIMEOUT)
63#define RSN_MAIN_KEYS_SESSION_TIMEOUT   RSN_AUTH_FAILURE_TIMEOUT
64#define RSN_MIC_FAILURE_RE_KEY_TIMEOUT  3000
65
66/* Enumerations */
67typedef enum
68{
69    MIC_FAILURE_FALSE,
70    MIC_FAILURE_TRUE,
71    MIC_FAILURE_BLOCK
72} rsn_micFailureStatus_e;
73
74typedef enum
75{
76    GROUP_KEY_UPDATE_FALSE,
77    GROUP_KEY_UPDATE_TRUE
78} rsn_groupKeyUpdate_e;
79
80typedef enum
81{
82	PAIRWISE_KEY_UPDATE_FALSE,
83	PAIRWISE_KEY_UPDATE_TRUE
84} rsn_pairwiseKeyUpdate_e;
85
86
87/* Typedefs */
88typedef struct _rsn_t   rsn_t;
89
90typedef TI_STATUS (*rsn_eventCallback_t)(void* pCtx, void *pData);
91typedef TI_STATUS (*rsn_setPaeConfig_t)(rsn_t *pRsn, TRsnPaeConfig *pPaeConfig);
92typedef TI_STATUS (*rsn_getNetworkMode_t)(rsn_t *pRsn, ERsnNetworkMode *pNetMode);
93
94typedef TI_STATUS (*rsn_setKey_t)(rsn_t *pMainSec, TSecurityKeys *pKey);
95typedef TI_STATUS (*rsn_removeKey_t)(rsn_t *pMainSec, TSecurityKeys *pKey);
96typedef TI_STATUS (*rsn_setDefaultKeyId_t)(rsn_t *pMainSec, TI_UINT8 keyId);
97typedef TI_STATUS (*rsn_reportStatus_t)(rsn_t *pRsn, TI_STATUS rsnStatus);
98typedef TI_STATUS (*rsn_sendEapol_t)(rsn_t *pRsn, TI_UINT8 *pPacket, TI_UINT32 length);
99typedef TI_STATUS (*rsn_getSiteEntry_t)(rsn_t *pRsn, TMacAddr *macAddress, siteEntry_t *curSiteEntry);
100
101typedef struct
102{
103    rsn_eventCallback_t     eventFunc;
104    void                    *pCtx;
105} rsn_eventStruct_t;
106
107typedef struct
108{
109    char                 id[RSN_MAX_IDENTITY_LEN];       /**< User identity string */
110    TI_UINT8             idLength;                       /**< User identity string length */
111    char                 password[RSN_MAX_PASSWD_LEN];   /**< User password string */
112    TI_UINT8             pwdLength;                      /**< User password string length */
113} authIdentity_t;
114
115typedef struct
116{
117    ERsnSiteBanLevel        banLevel;
118    TI_UINT32               banStartedMs;
119    TI_UINT32               banDurationMs;
120    TMacAddr                siteBssid;
121} rsn_siteBanEntry_t;
122
123struct _rsn_t
124{
125    rsn_eventStruct_t      events[RSN_MAX_NUMBER_OF_EVENTS];
126    TRsnPaeConfig          paeConfig;
127    TI_BOOL                PrivacyOptionImplemented;
128
129    TSecurityKeys          keys[MAX_KEYS_NUM];
130    TI_BOOL                keys_en [MAX_KEYS_NUM];
131    TI_UINT8               defaultKeyId;
132    TI_BOOL                defaultKeysOn;
133    TI_BOOL                wepDefaultKeys[MAX_KEYS_NUM];
134    TI_BOOL                wepStaticKey;
135    rsn_groupKeyUpdate_e   eGroupKeyUpdate;
136    rsn_pairwiseKeyUpdate_e	ePairwiseKeyUpdate;
137    OS_802_11_EAP_TYPES    eapType;
138
139    rsn_siteBanEntry_t     bannedSites[RSN_MAX_NUMBER_OF_BANNED_SITES];
140    TI_UINT8               numOfBannedSites;
141
142    TI_HANDLE              hMicFailureReportWaitTimer;
143	TI_HANDLE			   hMicFailureGroupReKeyTimer;
144	TI_HANDLE              hMicFailurePairwiseReKeyTimer;
145    TI_BOOL                bPairwiseMicFailureFilter;
146
147    struct _admCtrl_t      *pAdmCtrl;
148    struct _mainSec_t      *pMainSecSm;
149
150    struct _keyParser_t    *pKeyParser;
151
152    TI_HANDLE              hTxCtrl;
153    TI_HANDLE              hRx;
154    TI_HANDLE              hConn;
155    TI_HANDLE              hCtrlData;
156    TI_HANDLE              hTWD;
157    TI_HANDLE              hSiteMgr;
158    TI_HANDLE              hReport;
159    TI_HANDLE              hOs;
160    TI_HANDLE              hXCCMngr;
161    TI_HANDLE              hEvHandler;
162    TI_HANDLE              hSmeSm;
163    TI_HANDLE              hAPConn;
164    TI_HANDLE              hMlme;
165    TI_HANDLE              hPowerMgr;
166    TI_HANDLE              hTimer;
167    TI_HANDLE              hCurrBss;
168
169    rsn_setPaeConfig_t     setPaeConfig;
170    rsn_getNetworkMode_t   getNetworkMode;
171    rsn_setKey_t           setKey;
172    rsn_removeKey_t        removeKey;
173    rsn_setDefaultKeyId_t  setDefaultKeyId;
174    rsn_reportStatus_t     reportStatus;
175
176    TI_UINT32              rsnStartedTs;
177    TI_UINT32              rsnCompletedTs;
178    TI_BOOL                bRsnExternalMode;
179};
180
181/* Structures */
182
183/* External data definitions */
184
185/* External functions definitions */
186
187/* Function prototypes */
188
189TI_STATUS rsn_reportStatus(rsn_t *pRsn, TI_STATUS status);
190
191TI_STATUS rsn_setPaeConfig(rsn_t *pRsn, TRsnPaeConfig *pPaeConfig);
192
193TI_STATUS rsn_getNetworkMode(rsn_t *pRsn, ERsnNetworkMode *pNetMode);
194
195TI_STATUS rsn_setKey(rsn_t *pMainSec, TSecurityKeys *pKey);
196
197TI_STATUS rsn_removeKey(rsn_t *pMainSec, TSecurityKeys *pKey);
198
199TI_STATUS rsn_setDefaultKeyId(rsn_t *pMainSec, TI_UINT8 keyId);
200
201TI_STATUS rsn_setDefaultKeys(rsn_t *pHandle);
202
203TI_BOOL rsn_getPortStatus(rsn_t *pRsn);
204
205#endif
206
207