37#ifndef LWIP_HDR_NETIF_H
38#define LWIP_HDR_NETIF_H
42#define ENABLE_LOOPBACK (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF)
62#ifndef NETIF_MAX_HWADDR_LEN
63#define NETIF_MAX_HWADDR_LEN 6U
70#define NETIF_NAMESIZE 6
84#define NETIF_FLAG_UP 0x01U
87#define NETIF_FLAG_BROADCAST 0x02U
93#define NETIF_FLAG_LINK_UP 0x04U
97#define NETIF_FLAG_ETHARP 0x08U
101#define NETIF_FLAG_ETHERNET 0x10U
104#define NETIF_FLAG_IGMP 0x20U
107#define NETIF_FLAG_MLD6 0x40U
117 LWIP_NETIF_CLIENT_DATA_INDEX_DHCP,
120 LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP,
123 LWIP_NETIF_CLIENT_DATA_INDEX_ACD,
126 LWIP_NETIF_CLIENT_DATA_INDEX_IGMP,
131 LWIP_NETIF_CLIENT_DATA_INDEX_DHCP6,
134 LWIP_NETIF_CLIENT_DATA_INDEX_MLD6,
140#if LWIP_CHECKSUM_CTRL_PER_NETIF
141#define NETIF_CHECKSUM_GEN_IP 0x0001
142#define NETIF_CHECKSUM_GEN_UDP 0x0002
143#define NETIF_CHECKSUM_GEN_TCP 0x0004
144#define NETIF_CHECKSUM_GEN_ICMP 0x0008
145#define NETIF_CHECKSUM_GEN_ICMP6 0x0010
146#define NETIF_CHECKSUM_CHECK_IP 0x0100
147#define NETIF_CHECKSUM_CHECK_UDP 0x0200
148#define NETIF_CHECKSUM_CHECK_TCP 0x0400
149#define NETIF_CHECKSUM_CHECK_ICMP 0x0800
150#define NETIF_CHECKSUM_CHECK_ICMP6 0x1000
151#define NETIF_CHECKSUM_ENABLE_ALL 0xFFFF
152#define NETIF_CHECKSUM_DISABLE_ALL 0x0000
193 const ip4_addr_t *ipaddr);
206 const ip6_addr_t *ipaddr);
218#if LWIP_IPV4 && LWIP_IGMP
223#if LWIP_IPV6 && LWIP_IPV6_MLD
229#if LWIP_DHCP || LWIP_AUTOIP || LWIP_IGMP || LWIP_IPV6_MLD || LWIP_IPV6_DHCP6 || (LWIP_NUM_NETIF_CLIENT_DATA > 0)
230#if LWIP_NUM_NETIF_CLIENT_DATA > 0
231u8_t netif_alloc_client_data_id(
void);
236#define netif_set_client_data(netif, id, data) netif_get_client_data(netif, id) = (data)
240#define netif_get_client_data(netif, id) (netif)->client_data[(id)]
243#if (LWIP_IPV4 && LWIP_ARP && (ARP_TABLE_SIZE > 0x7f)) || (LWIP_IPV6 && (LWIP_ND6_NUM_DESTINATIONS > 0x7f))
245#define NETIF_ADDR_IDX_MAX 0x7FFF
248#define NETIF_ADDR_IDX_MAX 0x7F
251#if LWIP_NETIF_HWADDRHINT || LWIP_VLAN_PCP
252 #define LWIP_NETIF_USE_HINTS 1
254#if LWIP_NETIF_HWADDRHINT
263 #define LWIP_NETIF_USE_HINTS 0
270#if !LWIP_SINGLE_NETIF
287#if LWIP_IPV6_ADDRESS_LIFETIMES
303 netif_output_fn output;
314 netif_output_ip6_fn output_ip6;
316#if LWIP_NETIF_STATUS_CALLBACK
321#if LWIP_NETIF_LINK_CALLBACK
326#if LWIP_NETIF_REMOVE_CALLBACK
333#ifdef netif_get_client_data
336#if LWIP_NETIF_HOSTNAME
340#if LWIP_CHECKSUM_CTRL_PER_NETIF
345#if LWIP_IPV6 && LWIP_ND6_ALLOW_RA_UPDATES
360#if LWIP_IPV6_AUTOCONFIG
362 u8_t ip6_autoconfig_enabled;
364#if LWIP_IPV6_SEND_ROUTER_SOLICIT
376 struct stats_mib2_netif_ctrs mib2_counters;
378#if LWIP_IPV4 && LWIP_IGMP
381 netif_igmp_mac_filter_fn igmp_mac_filter;
383#if LWIP_IPV6 && LWIP_IPV6_MLD
386 netif_mld_mac_filter_fn mld_mac_filter;
389 struct acd *acd_list;
391#if LWIP_NETIF_USE_HINTS
392 struct netif_hint *
hints;
396 struct pbuf *loop_first;
397 struct pbuf *loop_last;
398#if LWIP_LOOPBACK_MAX_PBUFS
399 u16_t loop_cnt_current;
401#if LWIP_NETIF_LOOPBACK_MULTITHREADING
403 u8_t reschedule_poll;
408#if LWIP_CHECKSUM_CTRL_PER_NETIF
409#define NETIF_SET_CHECKSUM_CTRL(netif, chksumflags) do { \
410 (netif)->chksum_flags = chksumflags; } while(0)
411#define NETIF_CHECKSUM_ENABLED(netif, chksumflag) (((netif) == NULL) || (((netif)->chksum_flags & (chksumflag)) != 0))
412#define IF__NETIF_CHECKSUM_ENABLED(netif, chksumflag) if NETIF_CHECKSUM_ENABLED(netif, chksumflag)
414#define NETIF_CHECKSUM_ENABLED(netif, chksumflag) 0
415#define NETIF_SET_CHECKSUM_CTRL(netif, chksumflags)
416#define IF__NETIF_CHECKSUM_ENABLED(netif, chksumflag)
420#define NETIF_FOREACH(netif) if (((netif) = netif_default) != NULL)
424#define NETIF_FOREACH(netif) for ((netif) = netif_list; (netif) != NULL; (netif) = (netif)->next)
435 const ip4_addr_t *ipaddr,
const ip4_addr_t *netmask,
const ip4_addr_t *gw,
437void netif_set_addr(
struct netif *
netif,
const ip4_addr_t *ipaddr,
const ip4_addr_t *netmask,
438 const ip4_addr_t *gw);
453void netif_set_ipaddr(
struct netif *
netif,
const ip4_addr_t *ipaddr);
454void netif_set_netmask(
struct netif *
netif,
const ip4_addr_t *netmask);
455void netif_set_gw(
struct netif *
netif,
const ip4_addr_t *gw);
457#define netif_ip4_addr(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->ip_addr)))
459#define netif_ip4_netmask(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->netmask)))
461#define netif_ip4_gw(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->gw)))
463#define netif_ip_addr4(netif) ((const ip_addr_t*)&((netif)->ip_addr))
465#define netif_ip_netmask4(netif) ((const ip_addr_t*)&((netif)->netmask))
467#define netif_ip_gw4(netif) ((const ip_addr_t*)&((netif)->gw))
470#define netif_set_flags(netif, set_flags) do { (netif)->flags = (u8_t)((netif)->flags | (set_flags)); } while(0)
471#define netif_clear_flags(netif, clr_flags) do { (netif)->flags = (u8_t)((netif)->flags & (u8_t)(~(clr_flags) & 0xff)); } while(0)
472#define netif_is_flag_set(netif, flag) (((netif)->flags & (flag)) != 0)
479#define netif_is_up(netif) (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0)
481#if LWIP_NETIF_STATUS_CALLBACK
484#if LWIP_NETIF_REMOVE_CALLBACK
491#define netif_is_link_up(netif) (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0)
493#if LWIP_NETIF_LINK_CALLBACK
497#if LWIP_NETIF_HOSTNAME
499#define netif_set_hostname(netif, name) do { if((netif) != NULL) { (netif)->hostname = name; }}while(0)
501#define netif_get_hostname(netif) (((netif) != NULL) ? ((netif)->hostname) : NULL)
507#define netif_set_igmp_mac_filter(netif, function) do { if((netif) != NULL) { (netif)->igmp_mac_filter = function; }}while(0)
509#define netif_get_igmp_mac_filter(netif) (((netif) != NULL) ? ((netif)->igmp_mac_filter) : NULL)
512#if LWIP_IPV6 && LWIP_IPV6_MLD
515#define netif_set_mld_mac_filter(netif, function) do { if((netif) != NULL) { (netif)->mld_mac_filter = function; }}while(0)
517#define netif_get_mld_mac_filter(netif) (((netif) != NULL) ? ((netif)->mld_mac_filter) : NULL)
518#define netif_mld_mac_filter(netif, addr, action) do { if((netif) && (netif)->mld_mac_filter) { (netif)->mld_mac_filter((netif), (addr), (action)); }}while(0)
524#if !LWIP_NETIF_LOOPBACK_MULTITHREADING
525void netif_poll_all(
void);
533#define netif_ip_addr6(netif, i) ((const ip_addr_t*)(&((netif)->ip6_addr[i])))
535#define netif_ip6_addr(netif, i) ((const ip6_addr_t*)ip_2_ip6(&((netif)->ip6_addr[i])))
536void netif_ip6_addr_set(
struct netif *
netif,
s8_t addr_idx,
const ip6_addr_t *addr6);
538#define netif_ip6_addr_state(netif, i) ((netif)->ip6_addr_state[i])
540s8_t netif_get_ip6_addr_match(
struct netif *
netif,
const ip6_addr_t *ip6addr);
541void netif_create_ip6_linklocal_address(
struct netif *
netif,
u8_t from_mac_48bit);
542err_t netif_add_ip6_address(
struct netif *
netif,
const ip6_addr_t *ip6addr,
s8_t *chosen_idx);
543#define netif_set_ip6_autoconfig_enabled(netif, action) do { if(netif) { (netif)->ip6_autoconfig_enabled = (action); }}while(0)
544#if LWIP_IPV6_ADDRESS_LIFETIMES
545#define netif_ip6_addr_valid_life(netif, i) \
546 (((netif) != NULL) ? ((netif)->ip6_addr_valid_life[i]) : IP6_ADDR_LIFE_STATIC)
547#define netif_ip6_addr_set_valid_life(netif, i, secs) \
548 do { if (netif != NULL) { (netif)->ip6_addr_valid_life[i] = (secs); }} while (0)
549#define netif_ip6_addr_pref_life(netif, i) \
550 (((netif) != NULL) ? ((netif)->ip6_addr_pref_life[i]) : IP6_ADDR_LIFE_STATIC)
551#define netif_ip6_addr_set_pref_life(netif, i, secs) \
552 do { if (netif != NULL) { (netif)->ip6_addr_pref_life[i] = (secs); }} while (0)
553#define netif_ip6_addr_isstatic(netif, i) \
554 (netif_ip6_addr_valid_life((netif), (i)) == IP6_ADDR_LIFE_STATIC)
556#define netif_ip6_addr_isstatic(netif, i) (1)
558#if LWIP_ND6_ALLOW_RA_UPDATES
559#define netif_mtu6(netif) ((netif)->mtu6)
561#define netif_mtu6(netif) ((netif)->mtu)
565#if LWIP_NETIF_USE_HINTS
566#define NETIF_SET_HINTS(netif, netifhint) (netif)->hints = (netifhint)
567#define NETIF_RESET_HINTS(netif) (netif)->hints = NULL
569#define NETIF_SET_HINTS(netif, netifhint)
570#define NETIF_RESET_HINTS(netif)
578#define netif_get_index(netif) ((u8_t)((netif)->num + 1))
579#define NETIF_NO_INDEX (0)
589#define LWIP_NSC_NONE 0x0000
591#define LWIP_NSC_NETIF_ADDED 0x0001
593#define LWIP_NSC_NETIF_REMOVED 0x0002
595#define LWIP_NSC_LINK_CHANGED 0x0004
599#define LWIP_NSC_STATUS_CHANGED 0x0008
601#define LWIP_NSC_IPV4_ADDRESS_CHANGED 0x0010
603#define LWIP_NSC_IPV4_GATEWAY_CHANGED 0x0020
605#define LWIP_NSC_IPV4_NETMASK_CHANGED 0x0040
607#define LWIP_NSC_IPV4_SETTINGS_CHANGED 0x0080
609#define LWIP_NSC_IPV6_SET 0x0100
611#define LWIP_NSC_IPV6_ADDR_STATE_CHANGED 0x0200
613#define LWIP_NSC_IPV4_ADDR_VALID 0x0400
657 } ipv6_addr_state_changed;
670#if LWIP_NETIF_EXT_STATUS_CALLBACK
671struct netif_ext_callback;
672typedef struct netif_ext_callback
675 struct netif_ext_callback*
next;
676} netif_ext_callback_t;
678#define NETIF_DECLARE_EXT_CALLBACK(name) static netif_ext_callback_t name;
683#define NETIF_DECLARE_EXT_CALLBACK(name)
684#define netif_add_ext_callback(callback, fn)
685#define netif_remove_ext_callback(callback)
686#define netif_invoke_ext_callback(netif, reason, args)
689#if LWIP_TESTMODE && LWIP_HAVE_LOOPIF
690struct netif* netif_get_loopif(
void);
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
GLenum GLenum GLenum input
err_t netif_input(struct pbuf *p, struct netif *inp)
#define LWIP_IPV6_NUM_ADDRESSES
#define LWIP_NUM_NETIF_CLIENT_DATA
char * netif_index_to_name(u8_t idx, char *name)
void netif_set_link_down(struct netif *netif)
struct netif * netif_find(const char *name)
void(* netif_ext_callback_fn)(struct netif *netif, netif_nsc_reason_t reason, const netif_ext_callback_args_t *args)
void netif_set_down(struct netif *netif)
void netif_remove(struct netif *netif)
struct netif * netif_get_by_index(u8_t idx)
struct netif * netif_add(struct netif *netif, void *state, netif_init_fn init, netif_input_fn input)
u8_t netif_name_to_index(const char *name)
void netif_set_default(struct netif *netif)
void netif_set_link_up(struct netif *netif)
void netif_set_up(struct netif *netif)
struct netif * netif_add_noaddr(struct netif *netif, void *state, netif_init_fn init, netif_input_fn input)
static IPrintDialogCallback callback
static void WINAPI status_callback(HINTERNET handle, DWORD_PTR ctx, DWORD status, LPVOID info, DWORD info_len)
struct netif * netif_list
err_t(* netif_init_fn)(struct netif *netif)
struct netif * netif_default
void(* netif_status_callback_fn)(struct netif *netif)
lwip_internal_netif_client_data_index
@ LWIP_NETIF_CLIENT_DATA_INDEX_MAX
#define netif_invoke_ext_callback(netif, reason, args)
#define netif_add_ext_callback(callback, fn)
err_t(* netif_input_fn)(struct pbuf *p, struct netif *inp)
err_t(* netif_linkoutput_fn)(struct netif *netif, struct pbuf *p)
#define NETIF_MAX_HWADDR_LEN
#define netif_remove_ext_callback(callback)
static unsigned __int64 next
namespace GUID const ADDRINFOEXW * hints
const ip_addr_t * old_address
const ip_addr_t * old_netmask
const ip_addr_t * address
const ip_addr_t * old_address
u8_t hwaddr[NETIF_MAX_HWADDR_LEN]
netif_linkoutput_fn linkoutput
static GLenum _GLUfuncptr fn