56 #ifndef LWIP_HDR_NETIF_H 57 #define LWIP_HDR_NETIF_H 61 #define ENABLE_LOOPBACK (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF) 81 #ifndef NETIF_MAX_HWADDR_LEN 82 #define NETIF_MAX_HWADDR_LEN 6U 97 #define NETIF_FLAG_UP 0x01U 100 #define NETIF_FLAG_BROADCAST 0x02U 106 #define NETIF_FLAG_LINK_UP 0x04U 110 #define NETIF_FLAG_ETHARP 0x08U 114 #define NETIF_FLAG_ETHERNET 0x10U 117 #define NETIF_FLAG_IGMP 0x20U 120 #define NETIF_FLAG_MLD6 0x40U 126 enum lwip_internal_netif_client_data_index
129 LWIP_NETIF_CLIENT_DATA_INDEX_DHCP,
132 LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP,
135 LWIP_NETIF_CLIENT_DATA_INDEX_IGMP,
138 LWIP_NETIF_CLIENT_DATA_INDEX_MLD6,
140 LWIP_NETIF_CLIENT_DATA_INDEX_MAX
143 #if LWIP_CHECKSUM_CTRL_PER_NETIF 144 #define NETIF_CHECKSUM_GEN_IP 0x0001 145 #define NETIF_CHECKSUM_GEN_UDP 0x0002 146 #define NETIF_CHECKSUM_GEN_TCP 0x0004 147 #define NETIF_CHECKSUM_GEN_ICMP 0x0008 148 #define NETIF_CHECKSUM_GEN_ICMP6 0x0010 149 #define NETIF_CHECKSUM_CHECK_IP 0x0100 150 #define NETIF_CHECKSUM_CHECK_UDP 0x0200 151 #define NETIF_CHECKSUM_CHECK_TCP 0x0400 152 #define NETIF_CHECKSUM_CHECK_ICMP 0x0800 153 #define NETIF_CHECKSUM_CHECK_ICMP6 0x1000 154 #define NETIF_CHECKSUM_ENABLE_ALL 0xFFFF 155 #define NETIF_CHECKSUM_DISABLE_ALL 0x0000 193 const ip4_addr_t *ipaddr);
205 typedef err_t (*netif_output_ip6_fn)(
struct netif *netif,
struct pbuf *p,
206 const ip6_addr_t *ipaddr);
218 #if LWIP_IPV4 && LWIP_IGMP 220 typedef err_t (*netif_igmp_mac_filter_fn)(
struct netif *netif,
223 #if LWIP_IPV6 && LWIP_IPV6_MLD 225 typedef err_t (*netif_mld_mac_filter_fn)(
struct netif *netif,
229 #if LWIP_DHCP || LWIP_AUTOIP || LWIP_IGMP || LWIP_IPV6_MLD || (LWIP_NUM_NETIF_CLIENT_DATA > 0) 230 u8_t netif_alloc_client_data_id(
void);
234 #define netif_set_client_data(netif, id, data) netif_get_client_data(netif, id) = (data) 238 #define netif_get_client_data(netif, id) (netif)->client_data[(id)] 269 netif_output_fn output;
280 netif_output_ip6_fn output_ip6;
282 #if LWIP_NETIF_STATUS_CALLBACK 287 #if LWIP_NETIF_LINK_CALLBACK 292 #if LWIP_NETIF_REMOVE_CALLBACK 299 #ifdef netif_get_client_data 302 #if LWIP_IPV6_AUTOCONFIG 304 u8_t ip6_autoconfig_enabled;
306 #if LWIP_IPV6_SEND_ROUTER_SOLICIT 310 #if LWIP_NETIF_HOSTNAME 312 const char* hostname;
314 #if LWIP_CHECKSUM_CTRL_PER_NETIF 337 struct stats_mib2_netif_ctrs mib2_counters;
339 #if LWIP_IPV4 && LWIP_IGMP 342 netif_igmp_mac_filter_fn igmp_mac_filter;
344 #if LWIP_IPV6 && LWIP_IPV6_MLD 347 netif_mld_mac_filter_fn mld_mac_filter;
349 #if LWIP_NETIF_HWADDRHINT 354 struct pbuf *loop_first;
355 struct pbuf *loop_last;
356 #if LWIP_LOOPBACK_MAX_PBUFS 357 u16_t loop_cnt_current;
362 #if LWIP_CHECKSUM_CTRL_PER_NETIF 363 #define NETIF_SET_CHECKSUM_CTRL(netif, chksumflags) do { \ 364 (netif)->chksum_flags = chksumflags; } while(0) 365 #define IF__NETIF_CHECKSUM_ENABLED(netif, chksumflag) if (((netif) == NULL) || (((netif)->chksum_flags & (chksumflag)) != 0)) 367 #define NETIF_SET_CHECKSUM_CTRL(netif, chksumflags) 368 #define IF__NETIF_CHECKSUM_ENABLED(netif, chksumflag) 376 void netif_init(
void);
378 struct netif *
netif_add(
struct netif *netif,
380 const ip4_addr_t *ipaddr,
const ip4_addr_t *netmask,
const ip4_addr_t *gw,
384 void netif_set_addr(
struct netif *netif,
const ip4_addr_t *ipaddr,
const ip4_addr_t *netmask,
385 const ip4_addr_t *gw);
398 void netif_set_ipaddr(
struct netif *netif,
const ip4_addr_t *ipaddr);
399 void netif_set_netmask(
struct netif *netif,
const ip4_addr_t *netmask);
400 void netif_set_gw(
struct netif *netif,
const ip4_addr_t *gw);
402 #define netif_ip4_addr(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->ip_addr))) 404 #define netif_ip4_netmask(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->netmask))) 406 #define netif_ip4_gw(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->gw))) 408 #define netif_ip_addr4(netif) ((const ip_addr_t*)&((netif)->ip_addr)) 410 #define netif_ip_netmask4(netif) ((const ip_addr_t*)&((netif)->netmask)) 412 #define netif_ip_gw4(netif) ((const ip_addr_t*)&((netif)->gw)) 420 #define netif_is_up(netif) (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0) 422 #if LWIP_NETIF_STATUS_CALLBACK 425 #if LWIP_NETIF_REMOVE_CALLBACK 432 #define netif_is_link_up(netif) (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0) 434 #if LWIP_NETIF_LINK_CALLBACK 438 #if LWIP_NETIF_HOSTNAME 440 #define netif_set_hostname(netif, name) do { if((netif) != NULL) { (netif)->hostname = name; }}while(0) 442 #define netif_get_hostname(netif) (((netif) != NULL) ? ((netif)->hostname) : NULL) 447 #define netif_set_igmp_mac_filter(netif, function) do { if((netif) != NULL) { (netif)->igmp_mac_filter = function; }}while(0) 448 #define netif_get_igmp_mac_filter(netif) (((netif) != NULL) ? ((netif)->igmp_mac_filter) : NULL) 451 #if LWIP_IPV6 && LWIP_IPV6_MLD 453 #define netif_set_mld_mac_filter(netif, function) do { if((netif) != NULL) { (netif)->mld_mac_filter = function; }}while(0) 454 #define netif_get_mld_mac_filter(netif) (((netif) != NULL) ? ((netif)->mld_mac_filter) : NULL) 455 #define netif_mld_mac_filter(netif, addr, action) do { if((netif) && (netif)->mld_mac_filter) { (netif)->mld_mac_filter((netif), (addr), (action)); }}while(0) 459 err_t netif_loop_output(
struct netif *netif,
struct pbuf *p);
460 void netif_poll(
struct netif *netif);
461 #if !LWIP_NETIF_LOOPBACK_MULTITHREADING 462 void netif_poll_all(
void);
470 #define netif_ip_addr6(netif, i) ((const ip_addr_t*)(&((netif)->ip6_addr[i]))) 472 #define netif_ip6_addr(netif, i) ((const ip6_addr_t*)ip_2_ip6(&((netif)->ip6_addr[i]))) 473 void netif_ip6_addr_set(
struct netif *netif, s8_t addr_idx,
const ip6_addr_t *addr6);
474 void netif_ip6_addr_set_parts(
struct netif *netif, s8_t addr_idx, u32_t i0, u32_t i1, u32_t i2, u32_t i3);
475 #define netif_ip6_addr_state(netif, i) ((netif)->ip6_addr_state[i]) 476 void netif_ip6_addr_set_state(
struct netif* netif, s8_t addr_idx, u8_t
state);
477 s8_t netif_get_ip6_addr_match(
struct netif *netif,
const ip6_addr_t *ip6addr);
478 void netif_create_ip6_linklocal_address(
struct netif *netif, u8_t from_mac_48bit);
479 err_t netif_add_ip6_address(
struct netif *netif,
const ip6_addr_t *ip6addr, s8_t *chosen_idx);
480 #define netif_set_ip6_autoconfig_enabled(netif, action) do { if(netif) { (netif)->ip6_autoconfig_enabled = (action); }}while(0) 483 #if LWIP_NETIF_HWADDRHINT 484 #define NETIF_SET_HWADDRHINT(netif, hint) ((netif)->addr_hint = (hint)) 486 #define NETIF_SET_HWADDRHINT(netif, hint) err_t(* netif_input_fn)(struct pbuf *p, struct netif *inp)
u8_t hwaddr[NETIF_MAX_HWADDR_LEN]
void(* netif_status_callback_fn)(struct netif *netif)
struct netif * netif_add(struct netif *netif, void *state, netif_init_fn init, netif_input_fn input)
struct netif * netif_list
#define NETIF_MAX_HWADDR_LEN
void netif_set_link_down(struct netif *netif)
struct netif * netif_default
err_t(* netif_init_fn)(struct netif *netif)
void netif_set_up(struct netif *netif)
void netif_remove(struct netif *netif)
void netif_set_default(struct netif *netif)
struct netif * netif_find(const char *name)
#define LWIP_NUM_NETIF_CLIENT_DATA
err_t netif_input(struct pbuf *p, struct netif *inp)
#define LWIP_IPV6_NUM_ADDRESSES
void netif_set_down(struct netif *netif)
netif_linkoutput_fn linkoutput
err_t(* netif_linkoutput_fn)(struct netif *netif, struct pbuf *p)
void netif_set_link_up(struct netif *netif)