Home | History | Annotate | Download | only in Connection_Managment
      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 */
     67 typedef enum
     68 {
     69     MIC_FAILURE_FALSE,
     70     MIC_FAILURE_TRUE,
     71     MIC_FAILURE_BLOCK
     72 } rsn_micFailureStatus_e;
     73 
     74 typedef enum
     75 {
     76     GROUP_KEY_UPDATE_FALSE,
     77     GROUP_KEY_UPDATE_TRUE
     78 } rsn_groupKeyUpdate_e;
     79 
     80 typedef enum
     81 {
     82 	PAIRWISE_KEY_UPDATE_FALSE,
     83 	PAIRWISE_KEY_UPDATE_TRUE
     84 } rsn_pairwiseKeyUpdate_e;
     85 
     86 
     87 /* Typedefs */
     88 typedef struct _rsn_t   rsn_t;
     89 
     90 typedef TI_STATUS (*rsn_eventCallback_t)(void* pCtx, void *pData);
     91 typedef TI_STATUS (*rsn_setPaeConfig_t)(rsn_t *pRsn, TRsnPaeConfig *pPaeConfig);
     92 typedef TI_STATUS (*rsn_getNetworkMode_t)(rsn_t *pRsn, ERsnNetworkMode *pNetMode);
     93 
     94 typedef TI_STATUS (*rsn_setKey_t)(rsn_t *pMainSec, TSecurityKeys *pKey);
     95 typedef TI_STATUS (*rsn_removeKey_t)(rsn_t *pMainSec, TSecurityKeys *pKey);
     96 typedef TI_STATUS (*rsn_setDefaultKeyId_t)(rsn_t *pMainSec, TI_UINT8 keyId);
     97 typedef TI_STATUS (*rsn_reportStatus_t)(rsn_t *pRsn, TI_STATUS rsnStatus);
     98 typedef TI_STATUS (*rsn_sendEapol_t)(rsn_t *pRsn, TI_UINT8 *pPacket, TI_UINT32 length);
     99 typedef TI_STATUS (*rsn_getSiteEntry_t)(rsn_t *pRsn, TMacAddr *macAddress, siteEntry_t *curSiteEntry);
    100 typedef TI_BOOL (*rsn_getPortStatus_t)(rsn_t *pRsn);
    101 typedef TI_STATUS (*rsn_setPortStatus_t)(TI_HANDLE hRsn, TI_BOOL state);
    102 
    103 typedef struct
    104 {
    105     rsn_eventCallback_t     eventFunc;
    106     void                    *pCtx;
    107 } rsn_eventStruct_t;
    108 
    109 typedef struct
    110 {
    111     char                 id[RSN_MAX_IDENTITY_LEN];       /**< User identity string */
    112     TI_UINT8             idLength;                       /**< User identity string length */
    113     char                 password[RSN_MAX_PASSWD_LEN];   /**< User password string */
    114     TI_UINT8             pwdLength;                      /**< User password string length */
    115 } authIdentity_t;
    116 
    117 typedef struct
    118 {
    119     ERsnSiteBanLevel        banLevel;
    120     TI_UINT32               banStartedMs;
    121     TI_UINT32               banDurationMs;
    122     TMacAddr                siteBssid;
    123 } rsn_siteBanEntry_t;
    124 
    125 struct _rsn_t
    126 {
    127     rsn_eventStruct_t      events[RSN_MAX_NUMBER_OF_EVENTS];
    128     TRsnPaeConfig          paeConfig;
    129     TI_BOOL                PrivacyOptionImplemented;
    130 
    131     TSecurityKeys          keys[MAX_KEYS_NUM];
    132     TI_BOOL                keys_en [MAX_KEYS_NUM];
    133     TI_UINT8               defaultKeyId;
    134     TI_BOOL                defaultKeysOn;
    135     TI_BOOL                wepDefaultKeys[MAX_KEYS_NUM];
    136     TI_BOOL                wepStaticKey;
    137     rsn_groupKeyUpdate_e   eGroupKeyUpdate;
    138     rsn_pairwiseKeyUpdate_e	ePairwiseKeyUpdate;
    139     OS_802_11_EAP_TYPES    eapType;
    140 
    141 	rsnGenericIE_t         genericIE;
    142     rsn_siteBanEntry_t     bannedSites[RSN_MAX_NUMBER_OF_BANNED_SITES];
    143     TI_UINT8               numOfBannedSites;
    144 
    145     TI_HANDLE              hMicFailureReportWaitTimer;
    146 	TI_HANDLE			   hMicFailureGroupReKeyTimer;
    147 	TI_HANDLE              hMicFailurePairwiseReKeyTimer;
    148     TI_BOOL                bPairwiseMicFailureFilter;
    149 
    150     struct _admCtrl_t      *pAdmCtrl;
    151     struct _mainSec_t      *pMainSecSm;
    152 
    153     struct _keyParser_t    *pKeyParser;
    154 
    155     TI_HANDLE              hTxCtrl;
    156     TI_HANDLE              hRx;
    157     TI_HANDLE              hConn;
    158     TI_HANDLE              hCtrlData;
    159     TI_HANDLE              hTWD;
    160     TI_HANDLE              hSiteMgr;
    161     TI_HANDLE              hReport;
    162     TI_HANDLE              hOs;
    163     TI_HANDLE              hXCCMngr;
    164     TI_HANDLE              hEvHandler;
    165     TI_HANDLE              hSmeSm;
    166     TI_HANDLE              hAPConn;
    167     TI_HANDLE              hMlme;
    168     TI_HANDLE              hPowerMgr;
    169     TI_HANDLE              hTimer;
    170     TI_HANDLE              hCurrBss;
    171 
    172     rsn_setPaeConfig_t     setPaeConfig;
    173     rsn_getNetworkMode_t   getNetworkMode;
    174     rsn_setKey_t           setKey;
    175     rsn_removeKey_t        removeKey;
    176     rsn_setDefaultKeyId_t  setDefaultKeyId;
    177     rsn_reportStatus_t     reportStatus;
    178     rsn_setPortStatus_t    setPortStatus;
    179     rsn_getPortStatus_t    getPortStatus;
    180 
    181     TI_UINT32              rsnStartedTs;
    182     TI_UINT32              rsnCompletedTs;
    183     TI_BOOL                bRsnExternalMode;
    184 };
    185 
    186 /* Structures */
    187 
    188 /* External data definitions */
    189 
    190 /* External functions definitions */
    191 
    192 /* Function prototypes */
    193 
    194 TI_STATUS rsn_reportStatus(rsn_t *pRsn, TI_STATUS status);
    195 
    196 TI_STATUS rsn_setPaeConfig(rsn_t *pRsn, TRsnPaeConfig *pPaeConfig);
    197 
    198 TI_STATUS rsn_getNetworkMode(rsn_t *pRsn, ERsnNetworkMode *pNetMode);
    199 
    200 TI_STATUS rsn_setKey(rsn_t *pMainSec, TSecurityKeys *pKey);
    201 
    202 TI_STATUS rsn_removeKey(rsn_t *pMainSec, TSecurityKeys *pKey);
    203 
    204 TI_STATUS rsn_setDefaultKeyId(rsn_t *pMainSec, TI_UINT8 keyId);
    205 
    206 TI_STATUS rsn_setDefaultKeys(rsn_t *pHandle);
    207 
    208 TI_BOOL rsn_getPortStatus(rsn_t *pRsn);
    209 
    210 TI_STATUS rsn_setPortStatus(TI_HANDLE hRsn, TI_BOOL state);
    211 
    212 TI_STATUS rsn_getGenInfoElement(rsn_t *pRsn, TI_UINT8 *out_buff, TI_UINT32 *out_buf_length);
    213 
    214 void rsn_clearGenInfoElement(rsn_t *pRsn);
    215 
    216 #endif
    217 
    218