ConOpSys V2970  P004.07
ANVILEX control operating system
Modules | Classes | Macros | Typedefs | Functions
Network interface (NETIF)
Collaboration diagram for Network interface (NETIF):

Modules

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

Classes

union  netif_ext_callback_args_t
 

Macros

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

Typedefs

typedef u16_t netif_nsc_reason_t
 
typedef void(* netif_ext_callback_fn) (struct netif *netif, netif_nsc_reason_t reason, const netif_ext_callback_args_t *args)
 

Functions

struct netifnetif_add_noaddr (struct netif *netif, void *state, netif_init_fn init, netif_input_fn input)
 
struct netifnetif_add (struct netif *netif, void *state, netif_init_fn init, netif_input_fn input)
 
void netif_remove (struct netif *netif)
 
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)
 
u8_t netif_name_to_index (const char *name)
 
char * netif_index_to_name (u8_t idx, char *name)
 
struct netifnetif_get_by_index (u8_t idx)
 
struct netifnetif_find (const char *name)
 

Detailed Description

Macro Definition Documentation

◆ netif_is_up

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

Ask if an interface is up

Typedef Documentation

◆ netif_ext_callback_fn

typedef void(* netif_ext_callback_fn) (struct netif *netif, netif_nsc_reason_t reason, const netif_ext_callback_args_t *args)

Function used for extended netif status callbacks Note: When parsing reason argument, keep in mind that more reasons may be added in the future!

Parameters
netifnetif that is affected by change
reasonchange reason
argsdepends on reason, see reason description

◆ netif_nsc_reason_t

Extended netif status callback (NSC) reasons flags. May be extended in the future!

Function Documentation

◆ netif_add()

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 initialises 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 initialised 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.

References ERR_OK, flags, input, ip_addr_set_zero_ip6, LWIP_ASSERT, LWIP_ASSERT_CORE_LOCKED, LWIP_DEBUGF, LWIP_ERROR, LWIP_IPV6_NUM_ADDRESSES, LWIP_NSC_NETIF_ADDED, mib2_netif_added, mtu, name, NETIF_DEBUG, netif_default, NETIF_FLAG_IGMP, netif_invoke_ext_callback, netif_list, netif_num, NETIF_RESET_HINTS, NETIF_SET_CHECKSUM_CTRL, next, NULL, num, and state.

Referenced by TProtocol_IP_Over_ETHERNET::Init(), netif_add_noaddr(), and netif_init().

Here is the caller graph for this function:

◆ netif_add_noaddr()

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

Add a network interface to the list of lwIP netifs.

Same as netif_add but without IPv4 addresses

References input, LWIP_IPV4, netif_add(), NULL, and state.

Here is the call graph for this function:

◆ netif_find()

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')

References LWIP_ASSERT_CORE_LOCKED, LWIP_DEBUGF, name, NETIF_DEBUG, NETIF_FOREACH, NULL, and num.

Referenced by netif_name_to_index().

Here is the caller graph for this function:

◆ netif_get_by_index()

struct netif* netif_get_by_index ( u8_t  idx)

Return the interface for the netif index

Parameters
idxindex of netif to find

References LWIP_ASSERT_CORE_LOCKED, NETIF_FOREACH, netif_get_index, NETIF_NO_INDEX, and NULL.

Referenced by netif_index_to_name().

Here is the caller graph for this function:

◆ netif_index_to_name()

char* netif_index_to_name ( u8_t  idx,
char *  name 
)

Return the interface name for the netif matching index or NULL if not found/on error

Parameters
idxthe interface index of the netif
namechar buffer of at least NETIF_NAMESIZE bytes

References lwip_itoa(), name, netif_get_by_index(), netif_index_to_num, NETIF_NAMESIZE, and NULL.

Here is the call graph for this function:

◆ netif_name_to_index()

u8_t netif_name_to_index ( const char *  name)

Return the interface index for the netif with name or NETIF_NO_INDEX if not found/on error

Parameters
namethe name of the netif

References name, netif_find(), netif_get_index, NETIF_NO_INDEX, and NULL.

Here is the call graph for this function:

◆ netif_remove()

void netif_remove ( struct netif netif)

Remove a network interface from the list of lwIP netifs.

Parameters
netifthe network interface to remove

References flags, LWIP_ASSERT_CORE_LOCKED, LWIP_DEBUGF, LWIP_IPV6_NUM_ADDRESSES, LWIP_NSC_NETIF_REMOVED, mib2_netif_removed, mib2_remove_ip4, NETIF_DEBUG, netif_default, netif_do_ip_addr_changed(), NETIF_FLAG_IGMP, NETIF_FOREACH, netif_invoke_ext_callback, netif_is_up, netif_list, netif_set_default(), netif_set_down(), next, and NULL.

Here is the call graph for this function:

◆ netif_set_default()

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

References LWIP_ASSERT_CORE_LOCKED, LWIP_DEBUGF, mib2_add_route_ip4, mib2_remove_route_ip4, name, NETIF_DEBUG, netif_default, and NULL.

Referenced by TProtocol_IP_Over_ETHERNET::Init(), and netif_remove().

Here is the caller graph for this function:

◆ netif_set_down()

void netif_set_down ( struct netif netif)

◆ netif_set_link_down()

void netif_set_link_down ( struct netif netif)

◆ netif_set_link_up()

void netif_set_link_up ( struct netif netif)

◆ netif_set_up()

void netif_set_up ( struct netif netif)