Home | History | Annotate | Download | only in Connection_Managment
      1 /*
      2  * rsnApi.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 utilsReplvl.h
     35  *  \brief Report level API
     36  *
     37  *  \see utilsReplvl.c
     38  */
     39 
     40 /***************************************************************************/
     41 /*                                                                                                  */
     42 /*    MODULE:   utilsReplvl.h                                                               */
     43 /*    PURPOSE:  Report level API                                            */
     44 /*                                                                                                  */
     45 /***************************************************************************/
     46 #ifndef __RSN_API_H__
     47 #define __RSN_API_H__
     48 
     49 #include "tidef.h"
     50 #include "TWDriver.h"
     51 #include "802_11Defs.h"
     52 #include "DrvMainModules.h"
     53 
     54 /* Constants */
     55 
     56 #define RSN_MAC_ADDR_LEN            6
     57 #define MAX_KEY_RSC_LEN             8
     58 #define MAX_SSN_KEY_DATA_LENGTH     32
     59 #define RSN_AUTH_FAILURE_TIMEOUT    30000
     60 #define MAX_NUM_OF_PRE_AUTH_BSSIDS  16
     61 #define MAX_KEYS_NUM                4
     62 
     63 
     64 /* Enumerations */
     65 
     66 
     67 
     68 /** RSN supported authentication suites */
     69 typedef enum
     70 {
     71     RSN_AUTH_OPEN           = 0,        /*< Legacy Open authentication suite */
     72     RSN_AUTH_SHARED_KEY     = 1,        /*< Legacy Shared Key authentication suite */
     73     RSN_AUTH_AUTO_SWITCH    = 2,        /*< Automatic authentication suite */
     74     RSN_AUTH_NONE           = 255       /*< no authentication suite */
     75 
     76 } EAuthSuite;
     77 
     78 
     79 /* Available External authentication modes for admission control */
     80 typedef enum
     81 {
     82     RSN_EXT_AUTH_MODE_OPEN           =   RSN_AUTH_OPEN,
     83     RSN_EXT_AUTH_MODE_SHARED_KEY     =   RSN_AUTH_SHARED_KEY,
     84     RSN_EXT_AUTH_MODE_AUTO_SWITCH    =   RSN_AUTH_AUTO_SWITCH,
     85     RSN_EXT_AUTH_MODE_WPA,
     86     RSN_EXT_AUTH_MODE_WPAPSK,
     87     RSN_EXT_AUTH_MODE_WPANONE,
     88     RSN_EXT_AUTH_MODE_WPA2,
     89     RSN_EXT_AUTH_MODE_WPA2PSK,
     90     /* Not a real mode, defined as upper bound */
     91     RSN_EXT_AUTH_MODEMAX
     92 
     93 } EExternalAuthMode;
     94 
     95 
     96 typedef enum
     97 {
     98     RSN_AUTH_STATUS_INVALID_TYPE                = 0x0001,
     99     RSN_AUTH_STATUS_TIMEOUT                     = 0x0002,
    100     RSN_AUTH_STATUS_CHALLENGE_FROM_AP_FAILED    = 0x0003,
    101     RSN_AUTH_STATUS_CHALLENGE_TO_AP_FAILED      = 0x0004
    102 
    103 } EAuthStatus;
    104 
    105 
    106 /** RSN key management suites */
    107 typedef enum
    108 {
    109     RSN_KEY_MNG_NONE                = 0,        /**< no key management available */
    110     RSN_KEY_MNG_802_1X              = 1,        /**< "802.1X" key management */
    111     RSN_KEY_MNG_WPA                 = 2,        /**< "WPA 4 way handshake" key management */
    112     RSN_KEY_MNG_XCC                 = 3,        /**< "XCC" key management */
    113     RSN_KEY_MNG_UNKNOWN             = 255       /**< UNKNOWN key management available */
    114 
    115 } ERsnKeyMngSuite;
    116 
    117 
    118 /** Available cipher suites for admission control */
    119 typedef enum
    120 {
    121     RSN_IBSS                = 0,        /**< IBSS mode */
    122     RSN_INFRASTRUCTURE      = 1         /**< Infrastructure mode */
    123 
    124 } ERsnNetworkMode;
    125 
    126 
    127 /** Port Access Entity role type */
    128 typedef enum
    129 {
    130     RSN_PAE_AP      = 0,
    131     RSN_PAE_SUPP    = 1
    132 
    133 } ERsnPaeRole;
    134 
    135 
    136 /** RSN Events */
    137 typedef enum
    138 {
    139     RSN_EVENT_EAPOL_RECV            = 0x0,      /**< EAPOL frame received in the RX */
    140     RSN_EVENT_SEC_ATTACK_DETECT     = 0x1,      /**< Security Attack detection */
    141     RSN_EVENT_RAW_KEY_RECV          = 0x2,      /**< Raw key recive */
    142     RSN_EVENT_KEY_REMOVE            = 0x3       /**< Key remove event */
    143 
    144 } ERsnEvent;
    145 
    146 
    147 /** Site ben levels */
    148 typedef enum
    149 {
    150     RSN_SITE_BAN_LEVEL_HALF = 1,
    151     RSN_SITE_BAN_LEVEL_FULL = 2
    152 
    153 } ERsnSiteBanLevel;
    154 
    155 
    156 /* Typedefs */
    157 
    158 /** Port Access Entity structure */
    159 typedef struct
    160 {
    161     EExternalAuthMode   authProtocol;
    162     ERsnKeyMngSuite     keyExchangeProtocol;
    163     ECipherSuite        unicastSuite;
    164     ECipherSuite        broadcastSuite;
    165 
    166 } TRsnPaeConfig;
    167 
    168 
    169 typedef struct
    170 {
    171     TI_BOOL             privacy;
    172     TI_UINT8            *pIe;
    173     TI_UINT8            ieLen;
    174 
    175 } TRsnData;
    176 
    177 
    178 typedef struct
    179 {
    180    TMacAddr             bssId;
    181    dot11_RSN_t          *pRsnIEs;
    182    TI_UINT8             rsnIeLen;
    183 
    184 } TBssidRsnInfo;
    185 
    186 
    187 typedef struct
    188 {
    189    TI_UINT8             NumOfItems;
    190    TBssidRsnInfo        bssidList[MAX_NUM_OF_PRE_AUTH_BSSIDS];
    191 
    192 } TBssidList4PreAuth;
    193 
    194 
    195 typedef struct
    196 {
    197     EAuthSuite          authSuite;
    198     TI_BOOL             privacyOn;
    199     TSecurityKeys       keys[MAX_KEYS_NUM];
    200     TI_UINT8            defaultKeyId;
    201     EExternalAuthMode   externalAuthMode;
    202     TI_BOOL             mixedMode;
    203     TI_BOOL             WPAMixedModeEnable;
    204     TI_BOOL             preAuthSupport;
    205     TI_UINT32           preAuthTimeout;
    206     TI_BOOL             bRsnExternalMode;
    207     TI_BOOL             bPairwiseMicFailureFilter;
    208 
    209 } TRsnInitParams;
    210 
    211 typedef struct
    212 {
    213 	ScanBssType_e 				bssType;
    214 	TMacAddr 	  				bssid;
    215 	Tdot11HtInformationUnparse  *pHTInfo;
    216 	Tdot11HtCapabilitiesUnparse *pHTCapabilities;
    217 } TRsnSiteParams;
    218 
    219 
    220 /* Prototypes */
    221 
    222 TI_HANDLE rsn_create(TI_HANDLE hOs);
    223 
    224 TI_STATUS rsn_unload(TI_HANDLE hRsn);
    225 
    226 void      rsn_init (TStadHandlesList *pStadHandles);
    227 
    228 TI_STATUS rsn_SetDefaults (TI_HANDLE hRsn, TRsnInitParams *pInitParam);
    229 
    230 TI_STATUS rsn_reconfig(TI_HANDLE hRsn);
    231 
    232 TI_STATUS rsn_start(TI_HANDLE hRsn);
    233 
    234 TI_STATUS rsn_stop(TI_HANDLE hRsn, TI_BOOL removeKeys);
    235 
    236 TI_STATUS rsn_eventRecv(TI_HANDLE hRsn, ERsnEvent event, void* pData);
    237 
    238 TI_STATUS rsn_setParam(TI_HANDLE hCtrlData, void *pParam);
    239 
    240 TI_STATUS rsn_getParamEncryptionStatus(TI_HANDLE hRsn, ECipherSuite *rsnStatus);
    241 TI_STATUS rsn_getParam(TI_HANDLE hCtrlData, void *pParam);
    242 
    243 TI_STATUS rsn_evalSite(TI_HANDLE hRsn, TRsnData *pRsnData, TRsnSiteParams *pRsnSiteParams, TI_UINT32 *pMetric);
    244 
    245 TI_STATUS rsn_setSite(TI_HANDLE hRsn, TRsnData *pRsnData, TI_UINT8 *pAssocIe, TI_UINT8 *pAssocIeLen);
    246 
    247 TI_STATUS rsn_getInfoElement(TI_HANDLE hRsn, TI_UINT8 *pRsnIe, TI_UINT32 *pRsnIeLen);
    248 
    249 #ifdef XCC_MODULE_INCLUDED
    250 TI_STATUS rsn_getXCCExtendedInfoElement(TI_HANDLE hRsn, TI_UINT8 *pRsnIe, TI_UINT8 *pRsnIeLen);
    251 #endif
    252 
    253 TI_STATUS rsn_reportAuthFailure(TI_HANDLE hRsn, EAuthStatus authStatus);
    254 
    255 TI_STATUS rsn_reportMicFailure(TI_HANDLE hRsn, TI_UINT8 *pType, TI_UINT32 Length);
    256 
    257 TI_STATUS rsn_resetPMKIDList(TI_HANDLE hRsn);
    258 
    259 TI_STATUS rsn_removedDefKeys(TI_HANDLE hRsn);
    260 
    261 TI_STATUS rsn_startPreAuth(TI_HANDLE hRsn, TBssidList4PreAuth *pBssidList);
    262 
    263 ERsnSiteBanLevel rsn_banSite(TI_HANDLE hRsn, TMacAddr siteBssid, ERsnSiteBanLevel banLevel, TI_UINT32 durationMs);
    264 
    265 TI_BOOL rsn_isSiteBanned(TI_HANDLE hRsn, TMacAddr siteBssid);
    266 
    267 void rsn_MboxFlushFinishCb(TI_HANDLE handle, TI_UINT16 MboxStatus, char *InterrogateParamsBuf);
    268 
    269 TI_STATUS rsn_setPortStatus(TI_HANDLE hRsn, TI_BOOL state);
    270 
    271 void rsn_reAuth(TI_HANDLE hRsn);
    272 
    273 #endif /* __RSN_API_H__*/
    274