32 #ifndef LWIP_HDR_NETIF_H 33 #define LWIP_HDR_NETIF_H 37 #define ENABLE_LOOPBACK (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF) 67 #ifndef NETIF_MAX_HWADDR_LEN 68 #define NETIF_MAX_HWADDR_LEN 6U 77 #define NETIF_FLAG_UP 0x01U 80 #define NETIF_FLAG_BROADCAST 0x02U 86 #define NETIF_FLAG_LINK_UP 0x04U 90 #define NETIF_FLAG_ETHARP 0x08U 94 #define NETIF_FLAG_ETHERNET 0x10U 97 #define NETIF_FLAG_IGMP 0x20U 100 #define NETIF_FLAG_MLD6 0x40U 102 #if LWIP_CHECKSUM_CTRL_PER_NETIF 103 #define NETIF_CHECKSUM_GEN_IP 0x0001 104 #define NETIF_CHECKSUM_GEN_UDP 0x0002 105 #define NETIF_CHECKSUM_GEN_TCP 0x0004 106 #define NETIF_CHECKSUM_GEN_ICMP 0x0008 107 #define NETIF_CHECKSUM_GEN_ICMP6 0x0010 108 #define NETIF_CHECKSUM_CHECK_IP 0x0100 109 #define NETIF_CHECKSUM_CHECK_UDP 0x0200 110 #define NETIF_CHECKSUM_CHECK_TCP 0x0400 111 #define NETIF_CHECKSUM_CHECK_ICMP 0x0800 112 #define NETIF_CHECKSUM_CHECK_ICMP6 0x1000 113 #define NETIF_CHECKSUM_ENABLE_ALL 0xFFFF 114 #define NETIF_CHECKSUM_DISABLE_ALL 0x0000 143 const ip4_addr_t *ipaddr);
155 typedef err_t (*netif_output_ip6_fn)(
struct netif *netif,
struct pbuf *p,
156 const ip6_addr_t *ipaddr);
168 #if LWIP_IPV4 && LWIP_IGMP 170 typedef err_t (*netif_igmp_mac_filter_fn)(
struct netif *netif,
171 const ip4_addr_t *group,
u8_t action);
173 #if LWIP_IPV6 && LWIP_IPV6_MLD 175 typedef err_t (*netif_mld_mac_filter_fn)(
struct netif *netif,
176 const ip6_addr_t *group,
u8_t action);
206 netif_output_fn output;
216 netif_output_ip6_fn output_ip6;
218 #if LWIP_NETIF_STATUS_CALLBACK 223 #if LWIP_NETIF_LINK_CALLBACK 228 #if LWIP_NETIF_REMOVE_CALLBACK 241 struct autoip *autoip;
243 #if LWIP_IPV6_AUTOCONFIG 245 u8_t ip6_autoconfig_enabled;
247 #if LWIP_IPV6_SEND_ROUTER_SOLICIT 255 #if LWIP_NETIF_HOSTNAME 257 const char* hostname;
259 #if LWIP_CHECKSUM_CTRL_PER_NETIF 282 struct stats_mib2_netif_ctrs mib2_counters;
284 #if LWIP_IPV4 && LWIP_IGMP 287 netif_igmp_mac_filter_fn igmp_mac_filter;
289 #if LWIP_IPV6 && LWIP_IPV6_MLD 292 netif_mld_mac_filter_fn mld_mac_filter;
294 #if LWIP_NETIF_HWADDRHINT 299 struct pbuf *loop_first;
300 struct pbuf *loop_last;
301 #if LWIP_LOOPBACK_MAX_PBUFS 302 u16_t loop_cnt_current;
307 #if LWIP_CHECKSUM_CTRL_PER_NETIF 308 #define NETIF_SET_CHECKSUM_CTRL(netif, chksumflags) do { \ 309 (netif)->chksum_flags = chksumflags; } while(0) 310 #define IF__NETIF_CHECKSUM_ENABLED(netif, chksumflag) if (((netif) == NULL) || (((netif)->chksum_flags & (chksumflag)) != 0)) 312 #define NETIF_SET_CHECKSUM_CTRL(netif, chksumflags) 313 #define IF__NETIF_CHECKSUM_ENABLED(netif, chksumflag) 323 struct netif *
netif_add(
struct netif *netif,
325 const ip4_addr_t *ipaddr,
const ip4_addr_t *netmask,
const ip4_addr_t *gw,
329 void netif_set_addr(
struct netif *netif,
const ip4_addr_t *ipaddr,
const ip4_addr_t *netmask,
330 const ip4_addr_t *gw);
343 void netif_set_ipaddr(
struct netif *netif,
const ip4_addr_t *ipaddr);
344 void netif_set_netmask(
struct netif *netif,
const ip4_addr_t *netmask);
345 void netif_set_gw(
struct netif *netif,
const ip4_addr_t *gw);
346 #define netif_ip4_addr(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->ip_addr))) 347 #define netif_ip4_netmask(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->netmask))) 348 #define netif_ip4_gw(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->gw))) 349 #define netif_ip_addr4(netif) ((const ip_addr_t*)&((netif)->ip_addr)) 350 #define netif_ip_gw4(netif) ((const ip_addr_t*)&((netif)->gw)) 356 #define netif_is_up(netif) (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0) 358 #if LWIP_NETIF_STATUS_CALLBACK 361 #if LWIP_NETIF_REMOVE_CALLBACK 368 #define netif_is_link_up(netif) (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0) 370 #if LWIP_NETIF_LINK_CALLBACK 374 #if LWIP_NETIF_HOSTNAME 375 #define netif_set_hostname(netif, name) do { if((netif) != NULL) { (netif)->hostname = name; }}while(0) 376 #define netif_get_hostname(netif) (((netif) != NULL) ? ((netif)->hostname) : NULL) 380 #define netif_set_igmp_mac_filter(netif, function) do { if((netif) != NULL) { (netif)->igmp_mac_filter = function; }}while(0) 381 #define netif_get_igmp_mac_filter(netif) (((netif) != NULL) ? ((netif)->igmp_mac_filter) : NULL) 384 #if LWIP_IPV6 && LWIP_IPV6_MLD 385 #define netif_set_mld_mac_filter(netif, function) do { if((netif) != NULL) { (netif)->mld_mac_filter = function; }}while(0) 386 #define netif_get_mld_mac_filter(netif) (((netif) != NULL) ? ((netif)->mld_mac_filter) : NULL) 390 err_t netif_loop_output(
struct netif *netif,
struct pbuf *p);
391 void netif_poll(
struct netif *netif);
392 #if !LWIP_NETIF_LOOPBACK_MULTITHREADING 393 void netif_poll_all(
void);
398 #define netif_ip_addr6(netif, i) ((const ip_addr_t*)(&((netif)->ip6_addr[i]))) 399 #define netif_ip6_addr(netif, i) ((const ip6_addr_t*)ip_2_ip6(&((netif)->ip6_addr[i]))) 400 #define netif_ip6_addr_set(netif, i, addr6) do { ip6_addr_set(ip_2_ip6(&((netif)->ip6_addr[i])), addr6); IP_SET_TYPE_VAL((netif)->ip6_addr[i], IPADDR_TYPE_V6); } while(0) 401 #define netif_ip6_addr_state(netif, i) ((netif)->ip6_addr_state[i]) 402 #define netif_ip6_addr_set_state(netif, i, state) ((netif)->ip6_addr_state[i] = (state)) 403 s8_t netif_get_ip6_addr_match(
struct netif *netif,
const ip6_addr_t *ip6addr);
404 void netif_create_ip6_linklocal_address(
struct netif *netif,
u8_t from_mac_48bit);
405 err_t netif_add_ip6_address(
struct netif *netif,
const ip6_addr_t *ip6addr,
s8_t *chosen_idx);
408 #if LWIP_NETIF_HWADDRHINT 409 #define NETIF_SET_HWADDRHINT(netif, hint) ((netif)->addr_hint = (hint)) 411 #define NETIF_SET_HWADDRHINT(netif, hint) err_t(* netif_input_fn)(struct pbuf *p, struct netif *inp)
void(* netif_status_callback_fn)(struct netif *netif)
void netif_set_down(struct netif *netif)
u8_t hwaddr[NETIF_MAX_HWADDR_LEN]
struct netif * netif_list
void netif_set_default(struct netif *netif)
#define NETIF_MAX_HWADDR_LEN
netif_linkoutput_fn linkoutput
void netif_set_up(struct netif *netif)
void netif_set_link_up(struct netif *netif)
struct netif * netif_find(const char *name)
struct netif * netif_default
err_t(* netif_init_fn)(struct netif *netif)
#define LWIP_IPV6_NUM_ADDRESSES
void netif_remove(struct netif *netif)
void netif_set_link_down(struct netif *netif)
struct netif * netif_add(struct netif *netif, void *state, netif_init_fn init, netif_input_fn input)
err_t(* netif_linkoutput_fn)(struct netif *netif, struct pbuf *p)