/*! * @file host_interface.h * @brief File containg host interface APIs * @author zsalah * @sa host_interface.c * @date 8 March 2012 * @version 1.0 */ #ifndef HOST_INT_H #define HOST_INT_H #include "CoreConfigurator.h" #include "CoreConfigSimulator.h" /*****************************************************************************/ /* Macros */ /*****************************************************************************/ #if 0 #define WID_BSS_TYPE 0x0000 #define WID_CURRENT_TX_RATE 0x0001 #define WID_CURRENT_CHANNEL 0x0002 #define WID_PREAMBLE 0x0003 #define WID_STATUS 0x0005 #define WID_SCAN_TYPE 0x0007 #define WID_KEY_ID 0x0009 #define WID_DTIM_PERIOD 0x0010 #define WID_POWER_MANAGEMENT 0x000B #define WID_AUTH_TYPE 0x000D #define WID_SITE_SURVEY 0x000E #define WID_DTIM_PERIOD 0x0010 #define WID_DISCONNECT 0x0016 #define WID_SHORT_SLOT_ALLOWED 0x001A #define WID_START_SCAN_REQ 0x001E #define WID_RSSI 0x001F #define WID_JOIN_REQ 0x0020 #define WID_11N_TXOP_PROT_DISABLE 0x00B0 #define WID_RTS_THRESHOLD 0x1000 #define WID_FRAG_THRESHOLD 0x1001 #define WID_SHORT_RETRY_LIMIT 0x1002 #define WID_LONG_RETRY_LIMIT 0x1003 #define WID_BEACON_INTERVAL 0x1006 #define WID_ACTIVE_SCAN_TIME 0x100C #define WID_PASSIVE_SCAN_TIME 0x100D #define WID_SITE_SURVEY_SCAN_TIME 0x100E #define WID_AUTH_TIMEOUT 0x1010 #define WID_11I_PSK 0x3008 #define WID_SITE_SURVEY_RESULTS 0x3012 #define WID_ADD_PTK 0x301B #define WID_ADD_RX_GTK 0x301C #define WID_ADD_TX_GTK 0x301D #define WID_ADD_WEP_KEY 0x3019 #define WID_REMOVE_WEP_KEY 0x301A #define WID_REMOVE_KEY 0x301E #define WID_ASSOC_REQ_INFO 0x301F #define WID_ASSOC_RES_INFO 0x3020 #define WID_PMKID_INFO 0x3082 #define WID_SCAN_CHANNEL_LIST 0x4084 #define WID_11I_MODE 0x000C #endif #define FAIL 0x0000 #define SUCCESS 0x0001 #define BIT2 ((NMI_Uint32)(1 << 2)) #define BIT1 ((NMI_Uint32)(1 << 1)) #define BIT0 ((NMI_Uint32)(1 << 0)) #define AP_MODE 0x01 #define STATION_MODE 0x02 #define MAX_NUM_STA 8 #define ACTIVE_SCAN_TIME 10 #define PASSIVE_SCAN_TIME 1200 #define MIN_SCAN_TIME 10 #define MAX_SCAN_TIME 1200 #define DEFAULT_SCAN 0 #define USER_SCAN BIT0 #define OBSS_PERIODIC_SCAN BIT1 #define OBSS_ONETIME_SCAN BIT2 #define GTK_RX_KEY_BUFF_LEN 24 #define ADDKEY 0x1 #define REMOVEKEY 0x2 #define DEFAULTKEY 0x4 #define ADDKEY_AP 0x8 #define MAX_NUM_SCANNED_NETWORKS 100 //30 // rachel #define MAX_NUM_SCANNED_NETWORKS_SHADOW 130 #define MAX_NUM_PROBED_SSID 10 /*One more than the number of scanned ssids*/ #define CHANNEL_SCAN_TIME 250//250 #define TX_MIC_KEY_LEN 8 #define RX_MIC_KEY_LEN 8 #define PTK_KEY_LEN 16 #define TX_MIC_KEY_MSG_LEN 26 #define RX_MIC_KEY_MSG_LEN 48 #define PTK_KEY_MSG_LEN 39 #define PMKSA_KEY_LEN 22 #define ETH_ALEN 6 #define PMKID_LEN 16 #define NMI_MAX_NUM_PMKIDS 16 #define NMI_SUPP_MCS_SET_SIZE 16 #define NMI_ADD_STA_LENGTH 40 /* Not including the rates field cause it has variable length*/ #define SCAN_EVENT_DONE_ABORTED /*****************************************************************************/ /* Data Types */ /*****************************************************************************/ //typedef unsigned char uint8; //typedef signed char int8; //typedef unsigned short uint16; //typedef unsigned long uint32; //typedef uint32 Bool; #if 0 typedef enum {WID_CHAR = 0, WID_SHORT = 1, WID_INT = 2, WID_STR = 3, WID_ADR = 4, WID_BIN = 5, WID_IP = 6, WID_UNDEF = 7 } WID_TYPE_T; #endif typedef struct { NMI_Uint16 cfg_wid; WID_TYPE_T cfg_type; NMI_Sint8 *pu8Para; } cfg_param_t; typedef struct _tstrStatistics { NMI_Uint8 u8LinkSpeed; NMI_Sint8 s8RSSI; NMI_Uint32 u32TxCount; NMI_Uint32 u32RxCount; NMI_Uint32 u32TxFailureCount; }tstrStatistics; typedef enum { HOST_IF_IDLE = 0, HOST_IF_SCANNING = 1, HOST_IF_WAITING_CONN_REQ = 2, HOST_IF_WAITING_CONN_RESP = 3, HOST_IF_CONNECTED = 4, HOST_IF_P2P_LISTEN =5, HOST_IF_FORCE_32BIT = 0xFFFFFFFF }tenuHostIFstate; typedef struct _tstrHostIFpmkid { NMI_Uint8 bssid[ETH_ALEN]; NMI_Uint8 pmkid[PMKID_LEN]; }tstrHostIFpmkid; typedef struct _tstrHostIFpmkidAttr { NMI_Uint8 numpmkid; tstrHostIFpmkid pmkidlist[NMI_MAX_NUM_PMKIDS]; }tstrHostIFpmkidAttr; #if 0 /* Scan type parameter for scan request */ typedef enum { PASSIVE_SCAN = 0, ACTIVE_SCAN = 1, NUM_SCANTYPE } tenuScanType; typedef enum {SITE_SURVEY_1CH = 0, SITE_SURVEY_ALL_CH = 1, SITE_SURVEY_OFF = 2 } SITE_SURVEY_T; #endif typedef enum{AUTORATE = 0, MBPS_1 = 1, MBPS_2 = 2, MBPS_5_5 = 5, MBPS_11 = 11, MBPS_6 = 6, MBPS_9 = 9, MBPS_12 = 12, MBPS_18 = 18, MBPS_24 = 24, MBPS_36 = 36, MBPS_48 = 48, MBPS_54 = 54 }CURRENT_TX_RATE_T; typedef struct { NMI_Uint32 u32SetCfgFlag; NMI_Uint8 ht_enable; NMI_Uint8 bss_type; NMI_Uint8 auth_type; NMI_Uint16 auth_timeout; NMI_Uint8 power_mgmt_mode; NMI_Uint16 short_retry_limit; NMI_Uint16 long_retry_limit; NMI_Uint16 frag_threshold; NMI_Uint16 rts_threshold; NMI_Uint16 preamble_type; NMI_Uint8 short_slot_allowed; NMI_Uint8 txop_prot_disabled; NMI_Uint16 beacon_interval; NMI_Uint16 dtim_period; SITE_SURVEY_T site_survey_enabled; NMI_Uint16 site_survey_scan_time; NMI_Uint8 scan_source; NMI_Uint16 active_scan_time; NMI_Uint16 passive_scan_time; CURRENT_TX_RATE_T curr_tx_rate; }tstrCfgParamVal; typedef enum { RETRY_SHORT = 1 << 0, RETRY_LONG = 1 << 1, FRAG_THRESHOLD = 1 << 2, RTS_THRESHOLD = 1 << 3, BSS_TYPE = 1 << 4, AUTH_TYPE = 1 << 5, AUTHEN_TIMEOUT = 1 << 6, POWER_MANAGEMENT = 1 << 7, PREAMBLE = 1 << 8, SHORT_SLOT_ALLOWED = 1 << 9, TXOP_PROT_DISABLE = 1 << 10, BEACON_INTERVAL = 1 << 11, DTIM_PERIOD = 1 << 12, SITE_SURVEY = 1 << 13, SITE_SURVEY_SCAN_TIME = 1 << 14, ACTIVE_SCANTIME = 1 << 15, PASSIVE_SCANTIME = 1 << 16, CURRENT_TX_RATE = 1 << 17, HT_ENABLE = 1 <<18, }tenuCfgParam; typedef struct { NMI_Uint8 au8bssid[6]; NMI_Sint8 s8rssi; }tstrFoundNetworkInfo; typedef enum {SCAN_EVENT_NETWORK_FOUND = 0, SCAN_EVENT_DONE = 1, SCAN_EVENT_ABORTED = 2, SCAN_EVENT_FORCE_32BIT = 0xFFFFFFFF }tenuScanEvent; typedef enum { CONN_DISCONN_EVENT_CONN_RESP = 0, CONN_DISCONN_EVENT_DISCONN_NOTIF = 1, CONN_DISCONN_EVENT_FORCE_32BIT = 0xFFFFFFFF }tenuConnDisconnEvent; typedef enum { WEP, WPARxGtk, //WPATxGtk, WPAPtk, PMKSA, }tenuKeyType; /*Scan callBack function definition*/ typedef void(*tNMIpfScanResult)(tenuScanEvent, tstrNetworkInfo*, void*,void*); /*Connect callBack function definition*/ typedef void(*tNMIpfConnectResult)(tenuConnDisconnEvent, tstrConnectInfo*, NMI_Uint8, tstrDisconnectNotifInfo*, void*); #ifdef NMI_P2P typedef void(*tNMIpfRemainOnChanExpired)(void*); /*Remain on channel expiration callback function*/ typedef void(*tNMIpfRemainOnChanReady)(void*); /*Remain on channel callback function*/ #endif //typedef NMI_Uint32 NMI_WFIDrvHandle; typedef struct { NMI_Sint32 s32Dummy; } *NMI_WFIDrvHandle; /*! * @struct tstrRcvdNetworkInfo * @brief Structure to hold Received Asynchronous Network info * @details * @todo * @sa * @author Mostafa Abu Bakr * @date 25 March 2012 * @version 1.0 */ typedef struct _tstrRcvdNetworkInfo { NMI_Uint8* pu8Buffer; NMI_Uint32 u32Length; } tstrRcvdNetworkInfo; /*BugID_4156*/ typedef struct _tstrHiddenNetworkInfo { NMI_Uint8 *pu8ssid; NMI_Uint8 u8ssidlen; }tstrHiddenNetworkInfo; typedef struct _tstrHiddenNetwork { //MAX_SSID_LEN tstrHiddenNetworkInfo *pstrHiddenNetworkInfo; NMI_Uint8 u8ssidnum; } tstrHiddenNetwork; typedef struct { /* Scan user call back function */ tNMIpfScanResult pfUserScanResult; /* User specific parameter to be delivered through the Scan User Callback function */ void* u32UserScanPvoid; NMI_Uint32 u32RcvdChCount; tstrFoundNetworkInfo astrFoundNetworkInfo[MAX_NUM_SCANNED_NETWORKS]; }tstrNMI_UsrScanReq; typedef struct { NMI_Uint8* pu8bssid; NMI_Uint8* pu8ssid; NMI_Uint8 u8security; AUTHTYPE_T tenuAuth_type; size_t ssidLen; NMI_Uint8* pu8ConnReqIEs; size_t ConnReqIEsLen; /* Connect user call back function */ tNMIpfConnectResult pfUserConnectResult; NMI_Bool IsHTCapable; /* User specific parameter to be delivered through the Connect User Callback function */ void* u32UserConnectPvoid; }tstrNMI_UsrConnReq; #ifdef NMI_P2P typedef struct { NMI_Uint16 u16Channel; NMI_Uint32 u32duration; tNMIpfRemainOnChanExpired pRemainOnChanExpired; tNMIpfRemainOnChanReady pRemainOnChanReady; void * pVoid; }tstrHostIfRemainOnChan; typedef struct { NMI_Bool bReg; NMI_Uint16 u16FrameType; NMI_Uint8 u8Regid; }tstrHostIfRegisterFrame; #define ACTION 0xD0 #define PROBE_REQ 0x40 #define PROBE_RESP 0x50 #define ACTION_FRM_IDX 0 #define PROBE_REQ_IDX 1 enum p2p_listen_state { P2P_IDLE, P2P_LISTEN, P2P_GRP_FORMATION }; #endif typedef struct { /* Scan user structure */ tstrNMI_UsrScanReq strNMI_UsrScanReq; /* Connect User structure */ tstrNMI_UsrConnReq strNMI_UsrConnReq; #ifdef NMI_P2P /*Remain on channel struvture*/ tstrHostIfRemainOnChan strHostIfRemainOnChan; NMI_Uint8 u8RemainOnChan_pendingreq; NMI_Uint64 u64P2p_MgmtTimeout; NMI_Uint8 u8P2PConnect; #endif tenuHostIFstate enuHostIFstate; //NMI_Bool bPendingConnRequest; #ifndef CONNECT_DIRECT NMI_Uint32 u32SurveyResultsCount; wid_site_survey_reslts_s astrSurveyResults[MAX_NUM_SCANNED_NETWORKS]; #endif NMI_Uint8 au8AssociatedBSSID[ETH_ALEN]; tstrCfgParamVal strCfgValues; }tstrNMI_WFIDrv; /*! * @enum tenuNMI_StaFlag * @brief Used to decode the station flag set and mask in tstrNMI_AddStaParam * @details * @todo * @sa tstrNMI_AddStaParam, enum nl80211_sta_flags * @author Enumeraion's creator * @date 12 July 2012 * @version 1.0 Description */ typedef enum { NMI_STA_FLAG_INVALID = 0, NMI_STA_FLAG_AUTHORIZED, /*!< station is authorized (802.1X)*/ NMI_STA_FLAG_SHORT_PREAMBLE, /*!< station is capable of receiving frames with short barker preamble*/ NMI_STA_FLAG_WME, /*!< station is WME/QoS capable*/ NMI_STA_FLAG_MFP, /*!< station uses management frame protection*/ NMI_STA_FLAG_AUTHENTICATED /*!< station is authenticated*/ }tenuNMI_StaFlag; typedef struct { NMI_Uint8 au8BSSID[ETH_ALEN]; NMI_Uint16 u16AssocID; NMI_Uint8 u8NumRates; NMI_Uint8* pu8Rates; NMI_Bool bIsHTSupported; NMI_Uint16 u16HTCapInfo; NMI_Uint8 u8AmpduParams; NMI_Uint8 au8SuppMCsSet[16]; NMI_Uint16 u16HTExtParams; NMI_Uint32 u32TxBeamformingCap; NMI_Uint8 u8ASELCap; NMI_Uint16 u16FlagsMask; /**/ NMI_Uint16 u16FlagsSet; /*