TuyaOS
结构体 | 宏定义 | 类型定义 | 枚举 | 函数 | 常量
netif.h 文件参考
#include "lwip/opt.h"
#include "lwip/err.h"
#include "lwip/ip_addr.h"
#include "lwip/def.h"
#include "lwip/pbuf.h"
#include "lwip/stats.h"
netif.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

结构体

struct  netif_ext_callback_args_t::ipv6_addr_state_changed_s
 

宏定义

#define ENABLE_LOOPBACK   (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF)
 
#define IF__NETIF_CHECKSUM_ENABLED(netif, chksumflag)
 
#define LWIP_NETIF_USE_HINTS   0
 
#define LWIP_NSC_IPV4_ADDRESS_CHANGED   0x0010
 
#define LWIP_NSC_IPV4_GATEWAY_CHANGED   0x0020
 
#define LWIP_NSC_IPV4_NETMASK_CHANGED   0x0040
 
#define LWIP_NSC_IPV4_SETTINGS_CHANGED   0x0080
 
#define LWIP_NSC_IPV6_ADDR_STATE_CHANGED   0x0200
 
#define LWIP_NSC_IPV6_SET   0x0100
 
#define LWIP_NSC_LINK_CHANGED   0x0004
 
#define LWIP_NSC_NETIF_ADDED   0x0001
 
#define LWIP_NSC_NETIF_REMOVED   0x0002
 
#define LWIP_NSC_NONE   0x0000
 
#define LWIP_NSC_STATUS_CHANGED   0x0008
 
#define netif_add_ext_callback(callback, fn)
 
#define NETIF_ADDR_IDX_MAX   0x7F
 
#define netif_clear_flags(netif, clr_flags)   do { (netif)->flags = (u8_t)((netif)->flags & (u8_t)(~(clr_flags) & 0xff)); } while(0)
 
#define NETIF_DECLARE_EXT_CALLBACK(name)
 
#define NETIF_FLAG_BROADCAST   0x02U
 
#define NETIF_FLAG_ETHARP   0x08U
 
#define NETIF_FLAG_ETHERNET   0x10U
 
#define NETIF_FLAG_IGMP   0x20U
 
#define NETIF_FLAG_LINK_UP   0x04U
 
#define NETIF_FLAG_MLD6   0x40U
 
#define NETIF_FLAG_UP   0x01U
 
#define NETIF_FOREACH(netif)   for ((netif) = netif_list; (netif) != NULL; (netif) = (netif)->next)
 
#define netif_get_index(netif)   ((u8_t)((netif)->num + 1))
 
#define netif_invoke_ext_callback(netif, reason, args)
 
#define netif_is_flag_set(nefif, flag)   (((netif)->flags & (flag)) != 0)
 
#define netif_is_link_up(netif)   (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0)
 
#define netif_is_up(netif)   (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0)
 
#define NETIF_MAX_HWADDR_LEN   6U
 
#define NETIF_NAMESIZE   6
 
#define NETIF_NO_INDEX   (0)
 
#define netif_remove_ext_callback(callback)
 
#define NETIF_RESET_HINTS(netif)
 
#define NETIF_SET_CHECKSUM_CTRL(netif, chksumflags)
 
#define netif_set_flags(netif, set_flags)   do { (netif)->flags = (u8_t)((netif)->flags | (set_flags)); } while(0)
 
#define NETIF_SET_HINTS(netif, netifhint)
 

类型定义

typedef u8_t netif_addr_idx_t
 
typedef void(* netif_ext_callback_fn) (struct netif *netif, netif_nsc_reason_t reason, const netif_ext_callback_args_t *args)
 
typedef err_t(* netif_init_fn) (struct netif *netif)
 
typedef err_t(* netif_input_fn) (struct pbuf *p, struct netif *inp)
 
typedef err_t(* netif_linkoutput_fn) (struct netif *netif, struct pbuf *p)
 
typedef u16_t netif_nsc_reason_t
 
typedef void(* netif_status_callback_fn) (struct netif *netif)
 

枚举

enum  lwip_internal_netif_client_data_index { LWIP_NETIF_CLIENT_DATA_INDEX_MAX }
 
enum  netif_mac_filter_action { NETIF_DEL_MAC_FILTER = 0 , NETIF_ADD_MAC_FILTER = 1 }
 

函数

struct netifnetif_add (struct netif *netif, void *state, netif_init_fn init, netif_input_fn input)
 
struct netifnetif_add_noaddr (struct netif *netif, void *state, netif_init_fn init, netif_input_fn input)
 
struct netifnetif_find (const char *name)
 
struct netifnetif_get_by_index (u8_t idx)
 
char * netif_index_to_name (u8_t idx, char *name)
 
void netif_init (void)
 
err_t netif_input (struct pbuf *p, struct netif *inp)
 
u8_t netif_name_to_index (const char *name)
 
void netif_remove (struct netif *netif)
 
void netif_set_default (struct netif *netif)
 
void netif_set_dhcp_cb (struct netif *netif, void(*cb)(struct netif *, u8_t event, u8_t isup))
 
void netif_set_down (struct netif *netif)
 
void netif_set_link_down (struct netif *netif)
 
void netif_set_link_up (struct netif *netif)
 
void netif_set_up (struct netif *netif)
 

常量

struct netifnetif_default
 
struct netifnetif_list
 

详细描述

netif API (to be used from TCPIP thread)

宏定义说明

◆ LWIP_NSC_IPV4_ADDRESS_CHANGED

#define LWIP_NSC_IPV4_ADDRESS_CHANGED   0x0010

IPv4 address has changed

◆ LWIP_NSC_IPV4_GATEWAY_CHANGED

#define LWIP_NSC_IPV4_GATEWAY_CHANGED   0x0020

IPv4 gateway has changed

◆ LWIP_NSC_IPV4_NETMASK_CHANGED

#define LWIP_NSC_IPV4_NETMASK_CHANGED   0x0040

IPv4 netmask has changed

◆ LWIP_NSC_IPV4_SETTINGS_CHANGED

#define LWIP_NSC_IPV4_SETTINGS_CHANGED   0x0080

called AFTER IPv4 address/gateway/netmask changes have been applied

◆ LWIP_NSC_IPV6_ADDR_STATE_CHANGED

#define LWIP_NSC_IPV6_ADDR_STATE_CHANGED   0x0200

IPv6 address state has changed

◆ LWIP_NSC_IPV6_SET

#define LWIP_NSC_IPV6_SET   0x0100

IPv6 address was added

◆ LWIP_NSC_LINK_CHANGED

#define LWIP_NSC_LINK_CHANGED   0x0004

link changed

◆ LWIP_NSC_NETIF_ADDED

#define LWIP_NSC_NETIF_ADDED   0x0001

netif was added. arg: NULL. Called AFTER netif was added.

◆ LWIP_NSC_NETIF_REMOVED

#define LWIP_NSC_NETIF_REMOVED   0x0002

netif was removed. arg: NULL. Called BEFORE netif is removed.

◆ LWIP_NSC_STATUS_CHANGED

#define LWIP_NSC_STATUS_CHANGED   0x0008

netif administrative status changed.
up is called AFTER netif is set up.
down is called BEFORE the netif is actually set down.

◆ netif_is_link_up

#define netif_is_link_up (   netif)    (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0)

Ask if a link is up

◆ netif_is_up

#define netif_is_up (   netif)    (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0)

Ask if an interface is up

◆ NETIF_MAX_HWADDR_LEN

#define NETIF_MAX_HWADDR_LEN   6U

Must be the maximum of all used hardware address lengths across all types of interfaces in use. This does not have to be changed, normally.

◆ NETIF_NAMESIZE

#define NETIF_NAMESIZE   6

The size of a fully constructed netif name which the netif can be identified by in APIs. Composed of 2 chars, 3 (max) digits, and 1 \0

类型定义说明

◆ netif_ext_callback_fn

typedef void(* netif_ext_callback_fn) (struct netif *netif, netif_nsc_reason_t reason, const netif_ext_callback_args_t *args)

Function used for extended netif status callbacks Note: When parsing reason argument, keep in mind that more reasons may be added in the future!

参数
netifnetif that is affected by change
reasonchange reason
argsdepends on reason, see reason description

◆ netif_init_fn

typedef err_t(* netif_init_fn) (struct netif *netif)

Function prototype for netif init functions. Set up flags and output/linkoutput callback functions in this function.

参数
netifThe netif to initialize

◆ netif_input_fn

typedef err_t(* netif_input_fn) (struct pbuf *p, struct netif *inp)

Function prototype for netif->input functions. This function is saved as 'input' callback function in the netif struct. Call it when a packet has been received.

参数
pThe received packet, copied into a pbuf
inpThe netif which received the packet
返回
ERR_OK if the packet was handled != ERR_OK is the packet was NOT handled, in this case, the caller has to free the pbuf

◆ netif_linkoutput_fn

typedef err_t(* netif_linkoutput_fn) (struct netif *netif, struct pbuf *p)

Function prototype for netif->linkoutput functions. Only used for ethernet netifs. This function is called by ARP when a packet shall be sent.

参数
netifThe netif which shall send a packet
pThe packet to send (raw ethernet packet)

◆ netif_nsc_reason_t

typedef u16_t netif_nsc_reason_t

Extended netif status callback (NSC) reasons flags. May be extended in the future!

◆ netif_status_callback_fn

typedef void(* netif_status_callback_fn) (struct netif *netif)

Function prototype for netif status- or link-callback functions.

枚举类型说明

◆ netif_mac_filter_action

MAC Filter Actions, these are passed to a netif's igmp_mac_filter or mld_mac_filter callback function.

枚举值
NETIF_DEL_MAC_FILTER 

Delete a filter entry

NETIF_ADD_MAC_FILTER 

Add a filter entry

函数说明

◆ netif_set_dhcp_cb()

void netif_set_dhcp_cb ( struct netif netif,
void(*)(struct netif *, u8_t event, u8_t isup)  cb 
)

Set callback for dhcp.

参数
netifthe netif from which to remove the struct dhcp
cbcallback for dhcp

变量说明

◆ netif_default

struct netif* netif_default
extern

The default network interface.

◆ netif_list

struct netif* netif_list
extern

The list of network interfaces.