| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437 |
- /**
- * @file wm_netif2.1.3.h
- *
- * @brief netif213 module
- *
- * @author WinnerMicro
- *
- * Copyright (c) 2014 Winner Microelectronics Co., Ltd.
- */
-
- #ifndef WM_NETIF2_0_3_H
- #define WM_NETIF2_0_3_H
- #include "wm_config.h"
- #include "wm_type_def.h"
- #include "wm_sockets.h"
- #include "wm_wifi.h"
- #include "wm_params.h"
- /** MACRO for callback EVENT to join AP or create soft-AP successfully */
- #define NETIF_WIFI_JOIN_SUCCESS 0x1
- /** MACRO for callback EVENT to fail to join AP */
- #define NETIF_WIFI_JOIN_FAILED 0x2
- /** MACRO for callback EVENT to disconnect from AP or destroy soft-AP */
- #define NETIF_WIFI_DISCONNECTED 0x3
- /** MACRO for callbck EVENT to get IP address */
- #define NETIF_IP_NET_UP 0x4
- /** MACRO for callback EVNET to create AP successfully */
- #define NETIF_WIFI_SOFTAP_SUCCESS 0x5
- /** MACRO for callback EVNET to create soft-AP failed */
- #define NETIF_WIFI_SOFTAP_FAILED 0x6
- /** MACRO for callback EVNET to close soft-AP */
- #define NETIF_WIFI_SOFTAP_CLOSED 0x7
- /** MACRO for callback EVNET to inform soft ap's net */
- #define NETIF_IP_NET2_UP 0x8
- #define NETIF_IPV6_NET_UP 0x9
- /** These are the values for ip_addr_t.type */
- #define IPADDR_TYPE_V4 0U
- #define IPADDR_TYPE_V6 6U
- #define IPADDR_TYPE_ANY 46U
- #define IPV6_ADDR_MAX_NUM 3
- #if 0
- struct ip_addr {
- u32_t addr;
- };
- typedef struct ip_addr ip_addr_t;
- #endif
- #if 0
- struct ip4_addr {
- u32_t addr;
- };
- typedef struct ip4_addr ip4_addr_t;
- struct ip6_addr {
- u32_t addr[4];
- };
- typedef struct ip6_addr ip6_addr_t;
- #if (TLS_CONFIG_IPV4 && TLS_CONFIG_IPV6)
- typedef struct _ip_addr {
- union {
- ip6_addr_t ip6;
- ip4_addr_t ip4;
- } u_addr;
- u8_t type;
- } ip_addr_t;
- #else
- #if TLS_CONFIG_IPV4
- typedef ip4_addr_t ip_addr_t;
- #else
- typedef ip6_addr_t ip_addr_t;
- #endif
- #endif
- #endif
- struct tls_ethif {
- ip_addr_t ip_addr;
- ip_addr_t netmask;
- ip_addr_t gw;
- #if TLS_CONFIG_IPV6
- ip_addr_t ip6_addr[IPV6_ADDR_MAX_NUM];
- #endif
- ip_addr_t dns1;
- ip_addr_t dns2;
- u8 status; //0:net down; 1:net up
- #if TLS_CONFIG_IPV6
- u8 ipv6_status[IPV6_ADDR_MAX_NUM]; //0:net down; 1:net up
- #endif
- };
- //type defination of netif status changed callback.
- typedef void (*tls_netif_status_event_fn)(u8 status);
- /**
- * @defgroup APP_APIs APP APIs
- * @brief APP APIs
- */
- /**
- * @addtogroup APP_APIs
- * @{
- */
- /**
- * @defgroup NETIF_APIs NETIF APIs
- * @brief network interface APIs
- */
- /**
- * @addtogroup NETIF_APIs
- * @{
- */
- /**
- * @brief This function is used to initialize TCP/IP Stack
- *
- * @param[in] None
- *
- * @retval 0 success
- * @retval other failed
- *
- * @note None
- */
- int tls_ethernet_init(void);
- /**
- * @brief This function is used to get IP information stored in
- tls_ethif struct
- *
- * @param[in] None
- *
- * @retval tls_ethif * Pointer to struct tls_ethif
- *
- * @note None
- */
- struct tls_ethif * tls_netif_get_ethif(void);
- /**
- * @brief This function is used to set tls_ethif status
- *
- * @param[in] status net status, 0-up, 1-down
- *
- * @return None
- *
- * @note None
- */
- void tls_netif_set_status(u8 status);
- /**
- * @brief This function is used to start DHCP Client
- *
- * @param[in] None
- *
- * @retval 0 success
- * @retval Minus failed
- *
- * @note None
- */
- err_t tls_dhcp_start(void);
- /**
- * @brief This function is used to stop DHCP client
- *
- * @param[in] None
- *
- * @retval 0 success
- * @retval Minus failed
- *
- * @note None
- */
- err_t tls_dhcp_stop(void);
- /**
- * @brief This function is used to change IP information
- *
- * @param[in] *ipaddr IP address
- * @param[in] *netmask netmask
- * @param[in] *gw default gateway
- *
- * @retval 0 success
- * @retval Minus failed
- *
- * @note None
- */
- err_t tls_netif_set_addr(ip_addr_t *ipaddr,
- ip_addr_t *netmask,
- ip_addr_t *gw);
- /**
- * @brief This function is used to set dns servers
- *
- * @param[in] numdns index of the DNS server to set
- must be < DNS_MAX_SERVERS
- * @param[in] *dnsserver IP address of the DNS server to set
- *
- * @return None
- *
- * @note None
- */
- void tls_netif_dns_setserver(u8 numdns, ip_addr_t *dnsserver);
- /**
- * @brief This function is used to bring up an interface,available
- for processing traffic
- *
- * @param[in] None
- *
- * @retval 0 success
- * @retval Minus failed
- *
- * @note None
- */
- err_t tls_netif_set_up(void);
- /**
- * @brief This function is used to bring down an interface,disabling
- any traffic processing
- *
- * @param[in] None
- *
- * @retval 0 success
- * @retval Minus failed
- *
- * @note None
- */
- err_t tls_netif_set_down(void);
- /**
- * @brief This function is used to add netif status changed callback
- to event list,if exists, do nothing
- *
- * @param[in] event_fn pointer to tls_netif_status_event_fn
- *
- * @retval 0 success
- * @retval Minus failed
- *
- * @note None
- */
- err_t tls_netif_add_status_event(tls_netif_status_event_fn event_fn);
- /**
- * @brief This function is used to remove netif status changed
- callback function from event list,if not exists, do nothing
- *
- * @param[in] event_fn pointer to tls_netif_status_event_fn
- *
- * @retval 0 success
- * @retval Minus failed
- *
- * @note None
- */
- err_t tls_netif_remove_status_event(tls_netif_status_event_fn event_fn);
- /**
- * @brief This function is used to get pointer of netif
- *
- * @param[in] None
- *
- * @retval pointer of netif
- *
- * @note None
- */
- struct netif *tls_get_netif(void);
- #if TLS_CONFIG_AP
- /**
- * @brief Start DHCP Server for a network interface
- * *
- * @retval DHCPS_ERR_SUCCESS - No error
- * @retval DHCPS_ERR_MEM - Out of memory
- * @retval DHCPS_ERR_LINKDOWN - The NI is inactive
- *
- * @note None
- */
- INT8S tls_dhcps_start(void);
- /**
- * @brief This function is used to stop DHCP Server
- *
- * @param[in] None
- *
- * @retval None
- *
- * @note None
- */
- void tls_dhcps_stop(void);
- /**
- * @brief Start the dns server's service
- * *
- * @retval DHCPS_ERR_SUCCESS - No error
- * @retval DHCPS_ERR_MEM - Out of memory
- * @retval DHCPS_ERR_LINKDOWN - The NI is inactive
- * @retval DNSS_ERR_PARAM - Input parameter error
- *
- * @note None
- */
- INT8S tls_dnss_start(INT8U * DnsName);
- /**
- * @brief Stop the dns server's service
- *
- * @param[in] None
- *
- * @retval None
- *
- * @note None
- */
- void tls_dnss_stop(void);
- /**
- * @brief Get station's ip address by mac address
- *
- * @param[in] mac station's mac address
- *
- * @retval ip_addr station's ip address
- *
- * @note None
- */
- ip_addr_t *tls_dhcps_getip(const u8_t *mac);
- /**
- * @brief Get station's mac address by ip address
- *
- * @param[in] ip station's ip address
- *
- * @retval u8* station's mac address
- *
- * @note None
- */
- u8 *tls_dhcps_getmac(const ip_addr_t *ip);
- #endif //TLS_CONFIG_AP
- #if TLS_CONFIG_RMMS
- /**
- * @brief Start remote manager server.
- * *
- * @retval DHCPS_ERR_SUCCESS - No error
- * @retval DHCPS_ERR_MEM - Out of memory
- * @retval DHCPS_ERR_LINKDOWN - The NIF is inactive
- *
- * @note None
- */
- INT8S tls_rmms_start(void);
- /**
- * @brief Disable remote manager server
- *
- * @param[in] None
- *
- * @retval None
- *
- * @note None
- */
- void tls_rmms_stop(void);
- #endif
- #if TLS_CONFIG_AP
- /**
- * @brief This is used to bring up an interface for APSTA,available
- for processing traffic
- *
- * @param[in] None
- *
- * @retval 0 success
- * @retval Minus failed
- *
- * @note Can only be used at APSTA mode
- */
- err_t tls_netif2_set_up(void);
- /**
- * @brief This function is used to bring down an interface for APSTA, disabling
- any traffic processing
- *
- * @param[in] None
- *
- * @retval 0 success
- * @retval Minus failed
- *
- * @note Can only be used at APSTA mode
- */
- err_t tls_netif2_set_down(void);
- /**
- * @brief This function is used to change IP information for
- a network interface for APSTA
- *
- * @param[in] *ipaddr IP address
- * @param[in] *netmask netmask
- * @param[in] *gw default gateway
- *
- * @retval 0 success
- * @retval Minus failed
- *
- * @note Can only be used at APSTA mode
- */
- err_t tls_netif2_set_addr(ip_addr_t *ipaddr,
- ip_addr_t *netmask,
- ip_addr_t *gw);
- /***************************************************************************
- * Function: tls_dhcps_setdns
- * Description: Set dhcp server's dns address.
- *
- * Input: numdns: the index of the DNS server to set must be less than DNS_MAX_SERVERS
- *
- * Output: None
- *
- * Return: None
- *
- * Date : 2015-3-10
- ****************************************************************************/
- /**
- * @brief Set dhcp server's dns address
- *
- * @param[in] numdns the index of the DNS server to set must be less than DNS_MAX_SERVERS
- *
- * @retval None
- *
- * @note Can only be used at APSTA mode
- */
- void tls_dhcps_setdns(u8_t numdns);
- #endif
- /**
- * @}
- */
- /**
- * @}
- */
- #endif //WM_NETIF_H
|