61 #ifndef __LWIP_NETIF_H__ 62 #define __LWIP_NETIF_H__ 63 #include <tinyara/config.h> 64 #include <net/ethernet.h> 65 #include <net/lwip/opt.h> 66 #ifdef CONFIG_NET_ETH_MTU 67 #define MAX_NET_DEV_MTU CONFIG_NET_ETH_MTU 69 #define MAX_NET_DEV_MTU 1500 72 #define ENABLE_LOOPBACK (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF) 74 #include <net/lwip/err.h> 76 #include <net/lwip/ipv4/ip_addr.h> 78 #include <net/lwip/def.h> 79 #include <net/lwip/pbuf.h> 96 #define NETMASK_ADDR0 255 97 #define NETMASK_ADDR1 255 98 #define NETMASK_ADDR2 255 99 #define NETMASK_ADDR3 0 108 #define EXTERN extern "C" 111 #define EXTERN extern 119 #define NETIF_MAX_HWADDR_LEN 6U 127 #define NETIF_FLAG_UP 0x01U 130 #define NETIF_FLAG_BROADCAST 0x02U 133 #define NETIF_FLAG_POINTTOPOINT 0x04U 136 #define NETIF_FLAG_DHCP 0x08U 142 #define NETIF_FLAG_LINK_UP 0x10U 146 #define NETIF_FLAG_ETHARP 0x20U 150 #define NETIF_FLAG_ETHERNET 0x40U 153 #define NETIF_FLAG_IGMP 0x80U 189 #if defined(CONFIG_NET_ETHERNET) 190 #define MAC_ADDRLEN 6 191 #define MAC_HDRLEN 14 192 #elif defined(CONFIG_WIRELESS) 193 #define MAC_ADDRLEN 6 194 #define MAC_HDRLEN 14 196 #define MAC_ADDRLEN 0 223 #if LWIP_NETIF_STATUS_CALLBACK 228 #if LWIP_NETIF_LINK_CALLBACK 233 #if LWIP_NETIF_REMOVE_CALLBACK 245 struct udp_pcb *dhcps_pcb;
250 struct autoip *autoip;
252 #if LWIP_NETIF_HOSTNAME 278 u32_t ifinnucastpkts;
281 u32_t ifoutucastpkts;
282 u32_t ifoutnucastpkts;
290 #if LWIP_NETIF_HWADDRHINT 295 struct pbuf *loop_first;
296 struct pbuf *loop_last;
297 #if LWIP_LOOPBACK_MAX_PBUFS 298 u16_t loop_cnt_current;
303 #if CONFIG_NSOCKET_DESCRIPTORS > 0 321 #ifdef CONFIG_NET_MULTIBUFFER 329 #define NETIF_INIT_SNMP(netif, type, speed) \ 331 (netif)->link_type = (type); \ 333 (netif)->link_speed = (speed); \ 335 (netif)->ifinoctets = 0; \ 336 (netif)->ifinucastpkts = 0; \ 337 (netif)->ifinnucastpkts = 0; \ 338 (netif)->ifindiscards = 0; \ 339 (netif)->ifoutoctets = 0; \ 340 (netif)->ifoutucastpkts = 0; \ 341 (netif)->ifoutnucastpkts = 0; \ 342 (netif)->ifoutdiscards = 0 344 #define NETIF_INIT_SNMP(netif, type, speed) 349 #if CONFIG_NSOCKET_DESCRIPTORS > 0 350 #ifdef CONFIG_NET_LWIP 363 void netif_init(
void);
427 void netif_set_ipaddr(
struct netif *
netif, ip_addr_t *ipaddr);
474 #define netif_is_up(netif) (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0) 476 #if LWIP_NETIF_STATUS_CALLBACK 479 #if LWIP_NETIF_REMOVE_CALLBACK 484 void netif_set_link_down(
struct netif *
netif);
486 #define netif_is_link_up(netif) (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0) 488 #if LWIP_NETIF_LINK_CALLBACK 492 #if LWIP_NETIF_HOSTNAME 493 #define netif_set_hostname(netif, name) \ 495 if ((netif) != NULL) { \ 496 (netif)->hostname = name; \ 499 #define netif_get_hostname(netif) (((netif) != NULL) ? ((netif)->hostname) : NULL) 503 #define netif_set_igmp_mac_filter(netif, function) \ 505 if ((netif) != NULL) { \ 506 (netif)->igmp_mac_filter = function; \ 509 #define netif_get_igmp_mac_filter(netif) (((netif) != NULL) ? ((netif)->igmp_mac_filter) : NULL) 513 err_t netif_loop_output(
struct netif *
netif,
struct pbuf *p, ip_addr_t *dest_ip);
515 #if !LWIP_NETIF_LOOPBACK_MULTITHREADING 516 void netif_poll_all(
void);
520 #if LWIP_NETIF_HWADDRHINT 521 #define NETIF_SET_HWADDRHINT(netif, hint) ((netif)->addr_hint = (hint)) 523 #define NETIF_SET_HWADDRHINT(netif, hint) err_t(* netif_igmp_mac_filter_fn)(struct netif *netif, ip_addr_t *group, u8_t action)
u8_t hwaddr[NETIF_MAX_HWADDR_LEN]
void netif_set_addr(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask, ip_addr_t *gw)
Change IP address configuration for a network interface (including netmask and default gateway)...
netif_linkoutput_fn linkoutput
err_t(* netif_input_fn)(struct pbuf *p, struct netif *inp)
int(* d_ifstate)(FAR struct netif *dev)
void netif_set_down(struct netif *netif)
Bring an interface down, disabling any traffic processing.
void netif_set_up(struct netif *netif)
Bring an interface up, available for processing traffic.
struct netif * netif_list
void(* netif_status_callback_fn)(struct netif *netif)
int(* d_txavail)(FAR struct netif *dev)
int(* d_ifup)(FAR struct netif *dev)
err_t(* netif_output_fn)(struct netif *netif, struct pbuf *p, ip_addr_t *ipaddr)
int(* d_txpoll)(FAR struct netif *dev)
err_t(* netif_init_fn)(struct netif *netif)
struct netif * netif_default
#define NETIF_MAX_HWADDR_LEN
err_t(* netif_linkoutput_fn)(struct netif *netif, struct pbuf *p)
u8_t d_buf[MAX_NET_DEV_MTU+CONFIG_NET_GUARDSIZE]
int(* d_ifdown)(FAR struct netif *dev)
struct netif * netif_find(const char *name)
Find a network interface by searching for its name.