123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- #ifndef __NET_WIFI_H__
- #define __NET_WIFI_H__
- #include <string.h>
- #include <types.h>
- #include <sys/socket.h>
- #include <sys/ioctl.h>
- //#include <net_app.h> //YC mark
- //#include "platform/status_reg.h" //YC mark
- //#include "platform/pl_nvm_if.h" //YC mark
- //#include "gsl.h" //YC mark
- /*--------------------------------------------------------------------------------------
- @ WIFI Version number definition (Major.Minor.Maintain)
- Major - 1 Bytes : Major version Update for new module is support
- Minor - 2 Bytes : Minor version Update for new feature is support
- Maintain - 1 Bytes : Maintenance Update for bug fixing.
- ChangeLogs:
- 2011.11.15 First released version glenn.tung
- ---------------------------------------------------------------------------------------*/
- #define WIFI_VERSION 0x01000000
- /* Output Message Control */
- #define WIFI_IF_ERROR_SUPPORT
- //#define WIFI_IF_DEBUG_SUPPORT
- //#define WIFI_IF_TRACE_SUPPORT
- /*-------------------------------------
- @WIFI Driver Debug Level Setting
- 0: OFF no debug message display
- 1: ERROR display error message
- 2: WARN display warning message
- 3: TRACE display trace message, usually used.
- 4: INFO display informatic message
- 5: LOUD display all message
- --------------------------------------*/
- #define WIFI_DRIVER_DBG_LEVEL 1
- /* Interface Name Defines */
- #define RALINK_IFNAME "ra0"
- #ifdef NET_WIFI_DIRECT_SUPPORT
- #define RALINK_P2P_IFNAME "p2p0"
- #endif
- #define ATHEROS_IFNAME "wlan0"
- #define REALTEK_IFNAME "rtk0"
- #define DEFAULT_IFNAME "empty"
- #define SP_MIRRORBOX_NAME "SP-MirrorBox-"
- /* Max AP Number */
- #define WIFI_MAX_AP_NUM 64
- /* Max SSID Length */
- #define WIFI_SSID_MAX_LEN 33
- /* Max BSSID Length */
- #define WIFI_BSSID_MAX_LEN 32
- /* Max IP Address Length */
- #define WIFI_IPADDRS_LEN 17
- /* Max WEP Key Length */
- #define WIFI_WEP_KEY_LEN 27
- /* Max WPA Key Length */
- #define WIFI_WPA_KEY_LEN 64
- /* Max WIFI Interface Name Length */
- #define WIFI_MAX_IFNAME_LEN 6
- /* Max HW Addr Length */
- #define WIFI_MAX_HWADDR_LEN 6
- typedef INT32(*WifiEventCallback)(void*);
- typedef enum
- {
- WIFI_ERROR_CONNECT_SAMEAP = -3,
- WIFI_UNKNOWN = -2,
- WIFI_FAILURE = -1,
- WIFI_SUCCESS = 0
- }WIFI_OpStatus_e;
- typedef enum
- {
- INTERFACE_TYPE_ETH,
- INTERFACE_TYPE_WIFI1,
- INTERFACE_TYPE_WIFI2,
- INTERFACE_TYPE_WIFI3,
- INTERFACE_TYPE_MAX,
- }Interface_Type;
- typedef enum
- {
- NO_SECRUITY = 0,
- WEP_64bit_ASCII,
- WEP_64bit_HEX,
- WEP_128bit_ASCII,
- WEP_128bit_HEX,
- WPA_PSK_TKIP,
- WPA_PSK_AES,
- WPA2_PSK_TKIP,
- WPA2_PSK_AES,
- WPA_NONE_TKIP,
- WPA_NONE_AES,
-
- ENCRYPT_MODE_MAX,
- MODE_ERRORTYPE = 0xff,
- }Encrypt_Mode;
- typedef enum
- {
- WIFI_ADDRS_IP,
- WIFI_ADDRS_NETMASK,
- WIFI_ADDRS_GATEWAY,
- WIFI_ADDRS_DNS_SERVER,
- WIFI_ADDRS_DHCP_SERVER,
-
- }WIFIAddrsType_e;
- typedef enum {
- WIFI_VA_NULL=-1, //-1
- WIFI_VA_INTERFACE_TYPE = 0,
- WIFI_VA_WIFI1_DHCP, // 1
- WIFI_VA_WIFI2_DHCP,
- WIFI_VA_WIFI3_DHCP,
- WIFI_VA_WIFI1_IPSET, // 4 + 17
- WIFI_VA_WIFI2_IPSET = 21,
- WIFI_VA_WIFI3_IPSET = 38,
- WIFI_VA_WIFI1_SSID = 55, // 55 + 33
- WIFI_VA_WIFI2_SSID = 88,
- WIFI_VA_WIFI3_SSID = 101,
- WIFI_VA_WIFI1_NETTYPE = 134,
- WIFI_VA_WIFI2_NETTYPE,
- WIFI_VA_WIFI3_NETTYPE,
- WIFI_VA_WIFI1_AUTHMODE,
- WIFI_VA_WIFI2_AUTHMODE,
- WIFI_VA_WIFI3_AUTHMODE,
- WIFI_VA_WIFI1_ENCRYPTTYPE,
- WIFI_VA_WIFI2_ENCRYPTTYPE,
- WIFI_VA_WIFI3_ENCRYPTTYPE,
- WIFI_VA_WIFI1_WEPKEY, // 143 + 27
- WIFI_VA_WIFI2_WEPKEY = 170,
- WIFI_VA_WIFI3_WEPKEY = 197,
- WIFI_VA_WIFI1_WPAKEY = 224, // 224 + 64
- WIFI_VA_WIFI2_WPAKEY = 288,
- WIFI_VA_WIFI3_WPAKEY = 352,
- WIFI_VA_DEFAULT_CONNECTION = 416,
- WIFI_VA_CheckSum // 417 , size = 4 bytes, this should be the last addr
- }wifi_section_addr_t;
- typedef struct _WIFI_AP_INFO
- {
- INT8 ssid[33];
-
- UINT8 NetworkType;
-
- UINT8 IsEncryption;
-
- UINT8 SignalStrength;
-
- UINT8 AuthMode;
-
- UINT8 EncrypType;
-
- UINT8 BSSID[6];
-
- UINT8 IsWPSSupport;
-
- }WIFI_AP_INFO; // structure for informations of Access Point
- #ifdef NET_WIFI_DIRECT_SUPPORT
- typedef enum
- {
- P2P_STOP_SCAN = 0,
- P2P_SCANNING =1,
- P2P_STOP_SCAN_AND_LISTEN = 2
- }P2P_ScanType_e;
- typedef enum _WIFI_P2P_ConnStatus
- {
- CONNECTING_OR_NO_LINK = 0,
- P2P_GO = 1,
- P2P_CLIENT = 2,
- P2P_DEVICE = 3,
- TDLS_LINKED = 4,
- #ifdef NET_WFD_SUPPORT
- WFD_SESSION_UNAVALIBLE = 5,
- WFD_PEER_PC_P2P = 6,
- WFD_PEER_TDLS_WEAK_SECURITY = 7,
- #endif
- }WIFI_P2P_ConnStatus;
- #ifdef NET_WFD_SUPPORT
- typedef struct _WIFI_WFD_Info_t
- {
- char pszDeviceName[32];
-
- char pszMAC[17];
-
- INT32 sdTcpPort;
-
- INT32 sdMaxThroughput;
-
- INT32 sdDeviceType;
-
- char *pszPeerAddr;
-
- }WIFI_WFD_Info_t;
- #endif
- typedef struct _WIFI_P2P_Info_t
- {
- #ifdef NET_WFD_SUPPORT
- WIFI_WFD_Info_t stWfdInfo;
- #endif
-
- char szPeerAddr[17];
- pid_t dhcpd_pid;
- P2P_ScanType_e currScanType;
-
- }WIFI_P2P_Info_t;
- #endif
- #ifdef NET_WIFI_SUPPORT
- INT32 WIFI_Get_SetupProfileID(UINT8* pbvalue);
- INT32 WIFI_Set_SetupProfileID(UINT8 bvalue);
- INT32 WIFI_Get_SetupProfileIDTemp(UINT8* pbvalue);
- INT32 WIFI_Set_SetupProfileIDTemp(UINT8* pbvalue);
- INT32 WIFI_IF_SetDHCP(Interface_Type eInterfaceType, UINT8 bDhcp);
- INT32 WIFI_IF_GetDHCP(Interface_Type eInterfaceType, UINT8 *pbDhcp);
- INT32 WIFI_IF_SetIPAddrs(Interface_Type eInterfaceType, INT8 *pszBuf);
- INT32 WIFI_IF_GetIPAddrs(Interface_Type eInterfaceType, INT8 *pszBuf);
- INT32 WIFI_IF_SetSSID(Interface_Type eInterfaceType, INT8 *pszbuf);
- INT32 WIFI_IF_GetSSID(Interface_Type eInterfaceType, INT8 *pszbuf);
- INT32 WIFI_IF_SetNetworkType(Interface_Type eInterfaceType, UINT8 sdNetType);
- INT32 WIFI_IF_GetNetworkType(Interface_Type eInterfaceType, UINT8 *psdNetType);
- INT32 WIFI_Set_AuthMode(Interface_Type eInterfaceType, INT8 sbvalue);
- INT32 WIFI_Get_AuthMode(Interface_Type eInterfaceType, INT8* psbvalue);
- INT32 WIFI_Set_EncrypType(Interface_Type eInterfaceType, INT8 sbvalue);
- INT32 WIFI_Get_EncrypType(Interface_Type eInterfaceType, INT8* psbvalue);
- INT32 WIFI_Set_EncryptionMode(Interface_Type eInterfaceType, UINT32 sdEncryptMode);
- INT32 WIFI_Get_EncryptionMode(Interface_Type eInterfaceType, UINT32 *sdEncryptMode);
- INT32 WIFI_Set_WEPKey(Interface_Type eInterfaceType, INT8* pszStrBuf);
- INT32 WIFI_Get_WEPKey(Interface_Type eInterfaceType, INT8* pszStrBuf);
- INT32 WIFI_Set_WPAPSKKey(Interface_Type eInterfaceType, INT8* pszStrBuf);
- INT32 WIFI_Get_WPAPSKKey(Interface_Type eInterfaceType, INT8* pszStrBuf);
- void WIFI_IF_LoadProfile(void);
- void WIFI_IF_AuthEncryConvert(UINT8 bAuthModeIn, UINT8 bEncrypTypeIn, INT8* psbKeyStr, UINT8 *pbAuthModeOut, UINT8 *pbEncrypTypeOut, UINT8* pbUISetting);
- INT32 WIFI_IF_EncryptionMode_Drv2UI(UINT8 bAuthMode, UINT8 bEncrypType, char* psbKeyStr, UINT8* pbUISetting);
- INT32 WIFI_IF_EncryptionMode_UI2Drv(UINT8 *pbAuthModeOut, UINT8 *pbEncrypTypeOut, UINT8* pbUISetting);
- INT32 WIFI_IF_Autodetect_Init(INT32);
- char* WIFI_IF_GetIfName(void);
- INT32 WIFI_IF_CheckConnectionStatus(void);
- INT32 WIFI_IF_Initialize(WifiEventCallback pfEventCallback);
- INT32 WIFI_IF_Finalize(void);
- INT32 WIFI_IF_RegisterDongle(char *pszDonlgeIfName);
- INT32 WIFI_IF_UnregisterDongle(char *pszDonlgeIfName);
- void WIFI_GetVersion(UINT32 *pdVersion);
- void WIFI_IF_HandleWextEvent(char *pData, INT32 sdLen);
- #ifdef NET_WIFI_DIRECT_SUPPORT
- INT32 WIFI_IF_SetP2PMode(P2P_ScanType_e operationMode);
- void WIFI_P2P_IF_SubscribeCBKFunc(WifiEventCallback pfEventCallBack);
- INT32 WIFI_IF_SignalHdrRoutine(void);
- #ifdef NET_WFD_SUPPORT
- INT32 WIFI_WFD_IF_GetPeerDeviceInfo(WIFI_WFD_Info_t *pstWfdInfo);
- #endif /* NET_WFD_SUPPORT */
- #endif /* NET_WIFI_DIRECT_SUPPORT */
- #endif /* NET_WIFI_SUPPORT */
- #endif /* __NET_WIFI_H__ */
|