The Pedigree Project  0.1
Modules | Macros | Functions
Network interface (NETIF)
+ Collaboration diagram for Network interface (NETIF):

Modules

 IPv4 address handling
 
 IPv6 address handling
 
 Client data handling
 
 Flags
 
 MIB2 statistics
 

Macros

#define netif_is_up(netif)   (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0)
 

Functions

struct netifnetif_add (struct netif *netif, void *state, netif_init_fn init, netif_input_fn input)
 
void netif_remove (struct netif *netif)
 
struct netifnetif_find (const char *name)
 
void netif_set_default (struct netif *netif)
 
void netif_set_up (struct netif *netif)
 
void netif_set_down (struct netif *netif)
 
void netif_set_link_up (struct netif *netif)
 
void netif_set_link_down (struct netif *netif)
 

Detailed Description

Macro Definition Documentation

#define netif_is_up (   netif)    (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0)

Ask if an interface is up

Definition at line 420 of file netif.h.

Referenced by netif_remove().

Function Documentation

struct netif* netif_add ( struct netif netif,
void *  state,
netif_init_fn  init,
netif_input_fn  input 
)

Add a network interface to the list of lwIP netifs.

Parameters
netifa pre-allocated netif structure
ipaddrIP address for the new netif
netmasknetwork mask for the new netif
gwdefault gateway IP address for the new netif
stateopaque data passed to the new netif
initcallback function that initializes the interface
inputcallback function that is called to pass ingress packets up in the protocol layer stack.
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).
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!
Most members of struct netif should be be initialized by the netif init function = netif driver (init parameter of this function).
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).
Returns
netif, or NULL if failed.

Definition at line 260 of file netif.c.

References ERR_OK, flags, input, LWIP_DEBUGF, LWIP_IPV6_NUM_ADDRESSES, LWIP_ND6_MAX_MULTICAST_SOLICIT, name, NETIF_DEBUG, NETIF_FLAG_IGMP, netif_list, next, num, and state.

Referenced by NetworkStack::registerDevice().

+ Here is the caller graph for this function:

struct netif* netif_find ( const char *  name)

Find a network interface by searching for its name

Parameters
namethe name of the netif (like netif->name) plus concatenated number in ascii representation (e.g. 'en0')

Definition at line 491 of file netif.c.

References IPADDR_TYPE_V4, LWIP_DBG_STATE, LWIP_DBG_TRACE, LWIP_DEBUGF, name, NETIF_DEBUG, next, and num.

void netif_remove ( struct netif netif)

Remove a network interface from the list of lwIP netifs.

Parameters
netifthe network interface to remove

Definition at line 396 of file netif.c.

References flags, LWIP_DEBUGF, LWIP_IPV6_NUM_ADDRESSES, NETIF_DEBUG, NETIF_FLAG_IGMP, netif_is_up, netif_set_default(), netif_set_down(), and next.

Referenced by NetworkStack::deRegisterDevice().

+ Here is the caller graph for this function:

void netif_set_default ( struct netif netif)

Set a network interface as the default network interface (used to output all packets for which no specific route is found)

Parameters
netifthe default network interface

Definition at line 623 of file netif.c.

References LWIP_DEBUGF, name, and NETIF_DEBUG.

Referenced by netif_remove().

+ Here is the caller graph for this function:

void netif_set_down ( struct netif netif)

Bring an interface down, disabling any traffic processing.

Definition at line 701 of file netif.c.

References flags, NETIF_FLAG_ETHARP, and NETIF_FLAG_UP.

Referenced by netif_remove().

+ Here is the caller graph for this function:

void netif_set_link_down ( struct netif netif)
void netif_set_link_up ( struct netif netif)

Called by a driver when its link goes up

Definition at line 754 of file netif.c.

References flags, NETIF_FLAG_LINK_UP, and NETIF_FLAG_UP.

void netif_set_up ( struct netif netif)

Bring an interface up, available for processing traffic.

Definition at line 643 of file netif.c.

References flags, LWIP_ND6_MAX_MULTICAST_SOLICIT, NETIF_FLAG_ETHARP, NETIF_FLAG_IGMP, NETIF_FLAG_LINK_UP, and NETIF_FLAG_UP.