Symbols
loading...
Files
loading...

netif_add() function

Add a network interface to the list of lwIP netifs.

Syntax

struct netif *netif_add(struct netif *netif,     const ip4_addr_t *ipaddr,     const ip4_addr_t *netmask,     const ip4_addr_t *gw,     void *state,     netif_init_fn init,     netif_input_fn input);
Implemented in netif.c:275

Arguments

netif

a pre-allocated netif structure

ipaddr

IP address for the new netif

netmask

network mask for the new netif

gw

default gateway IP address for the new netif

state

opaque data passed to the new netif

init

callback function that initializes the interface

input

callback function that is called to pass ingress packets up in the protocol layer stack.\n It is recommended to use a function that passes the input directly to the stack (netif_input(), NO_SYS=1 mode) or via sending a message to TCPIP thread (tcpip_input(), NO_SYS=0 mode).\n These functions use netif flags NETIF_FLAG_ETHARP and NETIF_FLAG_ETHERNET to decide whether to forward to ethernet_input() or ip_input(). In other words, the functions only work when the netif driver is implemented correctly!\n Most members of struct netif should be be initialized by the netif init function = netif driver (init parameter of this function).\n IPv6: Don't forget to call netif_create_ip6_linklocal_address() after setting the MAC address in struct netif.hwaddr (IPv6 requires a link-local address).

Return value

netif, or NULL if failed.

Examples

netif_add() is referenced by 35 libraries and example projects.

References

LocationReferrerText
netif.c:276
netif_add(struct netif *netif,
netif.h:416
struct netif *netif_add(struct netif *netif,
netif.c:241netif_add_noaddr()
return netif_add(netif,

Call Tree

Functions calling netif_add()
Functions called by netif_add()
all items filtered out
netif_add()
printf()
memset()
all items filtered out
Type of netif_add()
netif_add()
all items filtered out