Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
netif.h File Reference
netif API (to be used from TCPIP thread) More...
Go to the source code of this file.
Data Structures | |
struct | netif |
Generic data structure used for all lwIP network interfaces. More... | |
union | netif_ext_callback_args_t |
Argument supplied to netif_ext_callback_fn. More... | |
struct | netif_ext_callback_args_t::link_changed_s |
Args to LWIP_NSC_LINK_CHANGED callback. More... | |
struct | netif_ext_callback_args_t::status_changed_s |
Args to LWIP_NSC_STATUS_CHANGED callback. More... | |
struct | netif_ext_callback_args_t::ipv4_changed_s |
Args to LWIP_NSC_IPV4_ADDRESS_CHANGED|LWIP_NSC_IPV4_GATEWAY_CHANGED|LWIP_NSC_IPV4_NETMASK_CHANGED|LWIP_NSC_IPV4_SETTINGS_CHANGED callback. More... | |
struct | netif_ext_callback_args_t::ipv6_set_s |
Args to LWIP_NSC_IPV6_SET callback. More... | |
struct | netif_ext_callback_args_t::ipv6_addr_state_changed_s |
Args to LWIP_NSC_IPV6_ADDR_STATE_CHANGED callback. More... | |
Typedefs | |
typedef err_t(* | netif_init_fn )(struct netif *netif) |
Function prototype for netif init functions. | |
typedef err_t(* | netif_input_fn )(struct pbuf *p, struct netif *inp) |
Function prototype for netif->input functions. | |
typedef err_t(* | netif_output_fn )(struct netif *netif, struct pbuf *p, const ip4_addr_t *ipaddr) |
Function prototype for netif->output functions. | |
typedef err_t(* | netif_output_ip6_fn )(struct netif *netif, struct pbuf *p, const ip6_addr_t *ipaddr) |
Function prototype for netif->output_ip6 functions. | |
typedef err_t(* | netif_linkoutput_fn )(struct netif *netif, struct pbuf *p) |
Function prototype for netif->linkoutput functions. | |
typedef void(* | netif_status_callback_fn )(struct netif *netif) |
Function prototype for netif status- or link-callback functions. | |
typedef err_t(* | netif_igmp_mac_filter_fn )(struct netif *netif, const ip4_addr_t *group, enum netif_mac_filter_action action) |
Function prototype for netif igmp_mac_filter functions. | |
typedef err_t(* | netif_mld_mac_filter_fn )(struct netif *netif, const ip6_addr_t *group, enum netif_mac_filter_action action) |
Function prototype for netif mld_mac_filter functions. | |
typedef u16_t | netif_nsc_reason_t |
Extended netif status callback (NSC) reasons flags. | |
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! | |
Enumerations | |
enum | netif_mac_filter_action { NETIF_DEL_MAC_FILTER = 0, NETIF_ADD_MAC_FILTER = 1 } |
MAC Filter Actions, these are passed to a netif's igmp_mac_filter or mld_mac_filter callback function. More... | |
Functions | |
u8_t | netif_alloc_client_data_id (void) |
Allocate an index to store data in client_data member of struct netif. | |
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. | |
void | netif_set_addr (struct netif *netif, const ip4_addr_t *ipaddr, const ip4_addr_t *netmask, const ip4_addr_t *gw) |
Change IP address configuration for a network interface (including netmask and default gateway). | |
void | netif_remove (struct netif *netif) |
Remove a network interface from the list of lwIP netifs. | |
struct netif * | netif_find (const char *name) |
Find a network interface by searching for its name. | |
const char * | netif_get_name (struct netif *netif) |
Get a network interface name. | |
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) | |
bool | netif_check_default (struct netif *netif) |
Checks if network interface is the default network interface. | |
void | netif_set_ipaddr (struct netif *netif, const ip4_addr_t *ipaddr) |
Change the IP address of a network interface. | |
void | netif_set_netmask (struct netif *netif, const ip4_addr_t *netmask) |
Change the netmask of a network interface. | |
void | netif_set_gw (struct netif *netif, const ip4_addr_t *gw) |
Change the default gateway for a network interface. | |
void | netif_set_up (struct netif *netif) |
Bring an interface up, available for processing traffic. | |
void | netif_set_down (struct netif *netif) |
Bring an interface down, disabling any traffic processing. | |
void | netif_set_status_callback (struct netif *netif, netif_status_callback_fn status_callback) |
Set callback to be called when interface is brought up/down or address is changed while up. | |
void | netif_set_remove_callback (struct netif *netif, netif_status_callback_fn remove_callback) |
Set callback to be called when the interface has been removed. | |
void | netif_set_link_up (struct netif *netif) |
Called by a driver when its link goes up. | |
void | netif_set_link_down (struct netif *netif) |
Called by a driver when its link goes down. | |
void | netif_set_link_callback (struct netif *netif, netif_status_callback_fn link_callback) |
Set callback to be called when link is brought up/down. | |
err_t | netif_loop_output (struct netif *netif, struct pbuf *p) |
Send an IP packet to be received on the same netif (loopif-like). | |
void | netif_poll (struct netif *netif) |
Call netif_poll() in the main loop of your application. | |
void | netif_poll_all (void) |
Calls netif_poll() for every netif on the netif_list. | |
err_t | netif_input (struct pbuf *p, struct netif *inp) |
Forwards a received packet for input processing with ethernet_input() or ip_input() depending on netif flags. | |
void | netif_ip6_addr_set (struct netif *netif, s8_t addr_idx, const ip6_addr_t *addr6) |
Change an IPv6 address of a network interface. | |
void | netif_ip6_addr_set_state (struct netif *netif, s8_t addr_idx, u8_t state) |
Change the state of an IPv6 address of a network interface (INVALID, TEMPTATIVE, PREFERRED, DEPRECATED, where TEMPTATIVE includes the number of checks done, see ip6_addr.h) | |
s8_t | netif_get_ip6_addr_match (struct netif *netif, const ip6_addr_t *ip6addr) |
Checks if a specific local address is present on the netif and returns its index. | |
void | netif_create_ip6_linklocal_address (struct netif *netif, u8_t from_mac_48bit) |
Create a link-local IPv6 address on a netif (stored in slot 0) | |
err_t | netif_add_ip6_address (struct netif *netif, const ip6_addr_t *ip6addr, s8_t *chosen_idx) |
This function allows for the easy addition of a new IPv6 address to an interface. | |
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. | |
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. | |
struct netif * | netif_get_by_index (u8_t idx) |
Return the interface for the netif index. | |
void | netif_add_ext_callback (netif_ext_callback_t *callback, netif_ext_callback_fn fn) |
Add extended netif events listener. | |
void | netif_remove_ext_callback (netif_ext_callback_t *callback) |
Remove extended netif events listener. | |
void | netif_invoke_ext_callback (struct netif *netif, netif_nsc_reason_t reason, const netif_ext_callback_args_t *args) |
Invoke extended netif status event. | |
Variables | |
struct netif * | netif_list |
The list of network interfaces. | |
struct netif * | netif_default |
The default network interface. |
Detailed Description
netif API (to be used from TCPIP thread)
Definition in file netif.h.
Typedef Documentation
typedef err_t(* netif_igmp_mac_filter_fn)(struct netif *netif, const ip4_addr_t *group, enum netif_mac_filter_action action) |
typedef err_t(* netif_init_fn)(struct netif *netif) |
typedef err_t(* netif_input_fn)(struct pbuf *p, struct netif *inp) |
Function prototype for netif->input functions.
This function is saved as 'input' callback function in the netif struct. Call it when a packet has been received.
- Parameters:
-
p The received packet, copied into a pbuf inp The netif which received the packet
- Returns:
- ERR_OK if the packet was handled != ERR_OK is the packet was NOT handled, in this case, the caller has to free the pbuf
typedef err_t(* netif_linkoutput_fn)(struct netif *netif, struct pbuf *p) |
typedef err_t(* netif_mld_mac_filter_fn)(struct netif *netif, const ip6_addr_t *group, enum netif_mac_filter_action action) |
typedef err_t(* netif_output_fn)(struct netif *netif, struct pbuf *p, const ip4_addr_t *ipaddr) |
Function prototype for netif->output functions.
Called by lwIP when a packet shall be sent. For ethernet netif, set this to 'etharp_output' and set 'linkoutput'.
- Parameters:
-
netif The netif which shall send a packet p The packet to send (p->payload points to IP header) ipaddr The IP address to which the packet shall be sent
typedef err_t(* netif_output_ip6_fn)(struct netif *netif, struct pbuf *p, const ip6_addr_t *ipaddr) |
Function prototype for netif->output_ip6 functions.
Called by lwIP when a packet shall be sent. For ethernet netif, set this to 'ethip6_output' and set 'linkoutput'.
- Parameters:
-
netif The netif which shall send a packet p The packet to send (p->payload points to IP header) ipaddr The IPv6 address to which the packet shall be sent
typedef void(* netif_status_callback_fn)(struct netif *netif) |
Enumeration Type Documentation
Function Documentation
s8_t netif_get_ip6_addr_match | ( | struct netif * | netif, |
const ip6_addr_t * | ip6addr | ||
) |
Checks if a specific local address is present on the netif and returns its index.
Depending on its state, it may or may not be assigned to the interface (as per RFC terminology).
The given address may or may not be zoned (i.e., have a zone index other than IP6_NO_ZONE). If the address is zoned, it must have the correct zone for the given netif, or no match will be found.
- Parameters:
-
netif the netif to check ip6addr the IPv6 address to find
- Returns:
- >= 0: address found, this is its index -1: address not found on this netif
Definition at line 1485 of file lwip_netif.c.
void netif_invoke_ext_callback | ( | struct netif * | netif, |
netif_nsc_reason_t | reason, | ||
const netif_ext_callback_args_t * | args | ||
) |
Invoke extended netif status event.
- Parameters:
-
netif netif that is affected by change reason change reason args depends on reason, see reason description
Definition at line 1822 of file lwip_netif.c.
void netif_poll | ( | struct netif * | netif ) |
Call netif_poll() in the main loop of your application.
This is to prevent reentering non-reentrant functions like tcp_input(). Packets passed to netif_loop_output() are put on a list that is passed to netif->input() by netif_poll().
Definition at line 1219 of file lwip_netif.c.
void netif_poll_all | ( | void | ) |
Calls netif_poll() for every netif on the netif_list.
Definition at line 1289 of file lwip_netif.c.
Variable Documentation
struct netif* netif_default |
The default network interface.
Definition at line 112 of file lwip_netif.c.
struct netif* netif_list |
The list of network interfaces.
Definition at line 110 of file lwip_netif.c.
Generated on Tue Jul 12 2022 13:55:16 by
