Go to the documentation of this file.
37 #ifndef LWIP_HDR_NETIF_H
38 #define LWIP_HDR_NETIF_H
42 #define ENABLE_LOOPBACK (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF)
70 #ifndef NETIF_MAX_HWADDR_LEN
71 #define NETIF_MAX_HWADDR_LEN 6U
86 #define NETIF_FLAG_UP 0x01U
89 #define NETIF_FLAG_BROADCAST 0x02U
95 #define NETIF_FLAG_LINK_UP 0x04U
99 #define NETIF_FLAG_ETHARP 0x08U
103 #define NETIF_FLAG_ETHERNET 0x10U
106 #define NETIF_FLAG_IGMP 0x20U
109 #define NETIF_FLAG_MLD6 0x40U
118 LWIP_NETIF_CLIENT_DATA_INDEX_DHCP,
121 LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP,
124 LWIP_NETIF_CLIENT_DATA_INDEX_IGMP,
127 LWIP_NETIF_CLIENT_DATA_INDEX_MLD6,
132 #if LWIP_CHECKSUM_CTRL_PER_NETIF
133 #define NETIF_CHECKSUM_GEN_IP 0x0001
134 #define NETIF_CHECKSUM_GEN_UDP 0x0002
135 #define NETIF_CHECKSUM_GEN_TCP 0x0004
136 #define NETIF_CHECKSUM_GEN_ICMP 0x0008
137 #define NETIF_CHECKSUM_GEN_ICMP6 0x0010
138 #define NETIF_CHECKSUM_CHECK_IP 0x0100
139 #define NETIF_CHECKSUM_CHECK_UDP 0x0200
140 #define NETIF_CHECKSUM_CHECK_TCP 0x0400
141 #define NETIF_CHECKSUM_CHECK_ICMP 0x0800
142 #define NETIF_CHECKSUM_CHECK_ICMP6 0x1000
143 #define NETIF_CHECKSUM_ENABLE_ALL 0xFFFF
144 #define NETIF_CHECKSUM_DISABLE_ALL 0x0000
182 const ip4_addr_t *ipaddr);
195 const ip6_addr_t *ipaddr);
207 #if LWIP_IPV4 && LWIP_IGMP
212 #if LWIP_IPV6 && LWIP_IPV6_MLD
218 #if LWIP_DHCP || LWIP_AUTOIP || LWIP_IGMP || LWIP_IPV6_MLD || (LWIP_NUM_NETIF_CLIENT_DATA > 0)
219 u8_t netif_alloc_client_data_id(
void);
223 #define netif_set_client_data(netif, id, data) netif_get_client_data(netif, id) = (data)
227 #define netif_get_client_data(netif, id) (netif)->client_data[(id)]
258 netif_output_fn output;
269 netif_output_ip6_fn output_ip6;
271 #if LWIP_NETIF_STATUS_CALLBACK
276 #if LWIP_NETIF_LINK_CALLBACK
281 #if LWIP_NETIF_REMOVE_CALLBACK
288 #ifdef netif_get_client_data
291 #if LWIP_IPV6_AUTOCONFIG
293 u8_t ip6_autoconfig_enabled;
295 #if LWIP_IPV6_SEND_ROUTER_SOLICIT
299 #if LWIP_NETIF_HOSTNAME
301 const char* hostname;
303 #if LWIP_CHECKSUM_CTRL_PER_NETIF
326 struct stats_mib2_netif_ctrs mib2_counters;
328 #if LWIP_IPV4 && LWIP_IGMP
331 netif_igmp_mac_filter_fn igmp_mac_filter;
333 #if LWIP_IPV6 && LWIP_IPV6_MLD
336 netif_mld_mac_filter_fn mld_mac_filter;
338 #if LWIP_NETIF_HWADDRHINT
343 struct pbuf *loop_first;
344 struct pbuf *loop_last;
345 #if LWIP_LOOPBACK_MAX_PBUFS
346 u16_t loop_cnt_current;
351 #if LWIP_CHECKSUM_CTRL_PER_NETIF
352 #define NETIF_SET_CHECKSUM_CTRL(netif, chksumflags) do { \
353 (netif)->chksum_flags = chksumflags; } while(0)
354 #define IF__NETIF_CHECKSUM_ENABLED(netif, chksumflag) if (((netif) == NULL) || (((netif)->chksum_flags & (chksumflag)) != 0))
356 #define NETIF_SET_CHECKSUM_CTRL(netif, chksumflags)
357 #define IF__NETIF_CHECKSUM_ENABLED(netif, chksumflag)
369 const ip4_addr_t *ipaddr,
const ip4_addr_t *netmask,
const ip4_addr_t *gw,
373 void netif_set_addr(
struct netif *
netif,
const ip4_addr_t *ipaddr,
const ip4_addr_t *netmask,
374 const ip4_addr_t *gw);
387 void netif_set_ipaddr(
struct netif *
netif,
const ip4_addr_t *ipaddr);
388 void netif_set_netmask(
struct netif *
netif,
const ip4_addr_t *netmask);
389 void netif_set_gw(
struct netif *
netif,
const ip4_addr_t *gw);
391 #define netif_ip4_addr(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->ip_addr)))
393 #define netif_ip4_netmask(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->netmask)))
395 #define netif_ip4_gw(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->gw)))
397 #define netif_ip_addr4(netif) ((const ip_addr_t*)&((netif)->ip_addr))
399 #define netif_ip_netmask4(netif) ((const ip_addr_t*)&((netif)->netmask))
401 #define netif_ip_gw4(netif) ((const ip_addr_t*)&((netif)->gw))
409 #define netif_is_up(netif) (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0)
411 #if LWIP_NETIF_STATUS_CALLBACK
414 #if LWIP_NETIF_REMOVE_CALLBACK
421 #define netif_is_link_up(netif) (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0)
423 #if LWIP_NETIF_LINK_CALLBACK
427 #if LWIP_NETIF_HOSTNAME
429 #define netif_set_hostname(netif, name) do { if((netif) != NULL) { (netif)->hostname = name; }}while(0)
431 #define netif_get_hostname(netif) (((netif) != NULL) ? ((netif)->hostname) : NULL)
436 #define netif_set_igmp_mac_filter(netif, function) do { if((netif) != NULL) { (netif)->igmp_mac_filter = function; }}while(0)
437 #define netif_get_igmp_mac_filter(netif) (((netif) != NULL) ? ((netif)->igmp_mac_filter) : NULL)
440 #if LWIP_IPV6 && LWIP_IPV6_MLD
442 #define netif_set_mld_mac_filter(netif, function) do { if((netif) != NULL) { (netif)->mld_mac_filter = function; }}while(0)
443 #define netif_get_mld_mac_filter(netif) (((netif) != NULL) ? ((netif)->mld_mac_filter) : NULL)
444 #define netif_mld_mac_filter(netif, addr, action) do { if((netif) && (netif)->mld_mac_filter) { (netif)->mld_mac_filter((netif), (addr), (action)); }}while(0)
450 #if !LWIP_NETIF_LOOPBACK_MULTITHREADING
451 void netif_poll_all(
void);
459 #define netif_ip_addr6(netif, i) ((const ip_addr_t*)(&((netif)->ip6_addr[i])))
461 #define netif_ip6_addr(netif, i) ((const ip6_addr_t*)ip_2_ip6(&((netif)->ip6_addr[i])))
462 void netif_ip6_addr_set(
struct netif *
netif,
s8_t addr_idx,
const ip6_addr_t *addr6);
464 #define netif_ip6_addr_state(netif, i) ((netif)->ip6_addr_state[i])
466 s8_t netif_get_ip6_addr_match(
struct netif *
netif,
const ip6_addr_t *ip6addr);
467 void netif_create_ip6_linklocal_address(
struct netif *
netif,
u8_t from_mac_48bit);
468 err_t netif_add_ip6_address(
struct netif *
netif,
const ip6_addr_t *ip6addr,
s8_t *chosen_idx);
469 #define netif_set_ip6_autoconfig_enabled(netif, action) do { if(netif) { (netif)->ip6_autoconfig_enabled = (action); }}while(0)
472 #if LWIP_NETIF_HWADDRHINT
473 #define NETIF_SET_HWADDRHINT(netif, hint) ((netif)->addr_hint = (hint))
475 #define NETIF_SET_HWADDRHINT(netif, hint)
#define NETIF_MAX_HWADDR_LEN
void netif_set_up(struct netif *netif)
void netif_set_down(struct netif *netif)
void ethernetif_input(struct netif *)
void netif_remove(struct netif *netif)
err_t(* netif_input_fn)(struct pbuf *p, struct netif *inp)
struct netif * netif_find(const char *name)
void(* netif_status_callback_fn)(struct netif *netif)
netif_linkoutput_fn linkoutput
lwip_internal_netif_client_data_index
err_t(* netif_linkoutput_fn)(struct netif *netif, struct pbuf *p)
void netif_set_default(struct netif *netif)
struct netif * netif_list
struct netif * netif_add(struct netif *netif, void *state, netif_init_fn init, netif_input_fn input)
err_t netif_input(struct pbuf *p, struct netif *inp)
void netif_set_link_down(struct netif *netif)
void netif_set_link_up(struct netif *netif)
err_t(* netif_init_fn)(struct netif *netif)
#define LWIP_NUM_NETIF_CLIENT_DATA
struct nicBuffer * tmpBuf
#define LWIP_IPV6_NUM_ADDRESSES
struct netif * netif_default