Mistake on this page?
Report an issue in GitHub or email us
Data Structures | Macros | Typedefs | Enumerations | Variables
netif.h File Reference

netif API (to be used from TCPIP thread) More...

#include <stdbool.h>
#include "lwip/opt.h"
#include "lwip/err.h"
#include "lwip/ip_addr.h"
#include "lwip/def.h"
#include "lwip/pbuf.h"
#include "lwip/stats.h"

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

Macros

#define NETIF_MAX_HWADDR_LEN   6U
 Must be the maximum of all used hardware address lengths across all types of interfaces in use. More...
 
#define NETIF_NAMESIZE   6
 The size of a fully constructed netif name which the netif can be identified by in APIs. More...
 
#define NETIF_FLAG_UP   0x01U
 Whether the network interface is 'up'. More...
 
#define NETIF_FLAG_BROADCAST   0x02U
 If set, the netif has broadcast capability. More...
 
#define NETIF_FLAG_LINK_UP   0x04U
 If set, the interface has an active link (set by the network interface driver). More...
 
#define NETIF_FLAG_ETHARP   0x08U
 If set, the netif is an ethernet device using ARP. More...
 
#define NETIF_FLAG_ETHERNET   0x10U
 If set, the netif is an ethernet device. More...
 
#define NETIF_FLAG_IGMP   0x20U
 If set, the netif has IGMP capability. More...
 
#define NETIF_FLAG_MLD6   0x40U
 If set, the netif has MLD6 capability. More...
 
#define netif_is_up(netif)   (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0)
 Ask if an interface is up. More...
 
#define netif_is_link_up(netif)   (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0)
 Ask if a link is up. More...
 
#define LWIP_NSC_NETIF_ADDED   0x0001
 netif was added. More...
 
#define LWIP_NSC_NETIF_REMOVED   0x0002
 netif was removed. More...
 
#define LWIP_NSC_LINK_CHANGED   0x0004
 link changed More...
 
#define LWIP_NSC_STATUS_CHANGED   0x0008
 netif administrative status changed. More...
 
#define LWIP_NSC_IPV4_ADDRESS_CHANGED   0x0010
 IPv4 address has changed. More...
 
#define LWIP_NSC_IPV4_GATEWAY_CHANGED   0x0020
 IPv4 gateway has changed. More...
 
#define LWIP_NSC_IPV4_NETMASK_CHANGED   0x0040
 IPv4 netmask has changed. More...
 
#define LWIP_NSC_IPV4_SETTINGS_CHANGED   0x0080
 called AFTER IPv4 address/gateway/netmask changes have been applied More...
 
#define LWIP_NSC_IPV6_SET   0x0100
 IPv6 address was added. More...
 
#define LWIP_NSC_IPV6_ADDR_STATE_CHANGED   0x0200
 IPv6 address state has changed. More...
 

Typedefs

typedef err_t(* netif_init_fn) (struct netif *netif)
 Function prototype for netif init functions. More...
 
typedef err_t(* netif_input_fn) (struct pbuf *p, struct netif *inp)
 Function prototype for netif->input functions. More...
 
typedef err_t(* netif_linkoutput_fn) (struct netif *netif, struct pbuf *p)
 Function prototype for netif->linkoutput functions. More...
 
typedef void(* netif_status_callback_fn) (struct netif *netif)
 Function prototype for netif status- or link-callback functions. More...
 
typedef u16_t netif_nsc_reason_t
 Extended netif status callback (NSC) reasons flags. More...
 
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! More...
 

Enumerations

Variables

struct netifnetif_list
 The list of network interfaces. More...
 
struct netifnetif_default
 The default network interface. More...
 

Detailed Description

netif API (to be used from TCPIP thread)

Definition in file netif.h.

Macro Definition Documentation

#define LWIP_NSC_IPV4_ADDRESS_CHANGED   0x0010

IPv4 address has changed.

Definition at line 588 of file netif.h.

#define LWIP_NSC_IPV4_GATEWAY_CHANGED   0x0020

IPv4 gateway has changed.

Definition at line 590 of file netif.h.

#define LWIP_NSC_IPV4_NETMASK_CHANGED   0x0040

IPv4 netmask has changed.

Definition at line 592 of file netif.h.

#define LWIP_NSC_IPV4_SETTINGS_CHANGED   0x0080

called AFTER IPv4 address/gateway/netmask changes have been applied

Definition at line 594 of file netif.h.

#define LWIP_NSC_IPV6_ADDR_STATE_CHANGED   0x0200

IPv6 address state has changed.

Definition at line 598 of file netif.h.

#define LWIP_NSC_IPV6_SET   0x0100

IPv6 address was added.

Definition at line 596 of file netif.h.

#define LWIP_NSC_LINK_CHANGED   0x0004

link changed

Definition at line 582 of file netif.h.

#define LWIP_NSC_NETIF_ADDED   0x0001

netif was added.

arg: NULL. Called AFTER netif was added.

Definition at line 578 of file netif.h.

#define LWIP_NSC_NETIF_REMOVED   0x0002

netif was removed.

arg: NULL. Called BEFORE netif is removed.

Definition at line 580 of file netif.h.

#define LWIP_NSC_STATUS_CHANGED   0x0008

netif administrative status changed.


up is called AFTER netif is set up.
down is called BEFORE the netif is actually set down.

Definition at line 586 of file netif.h.

#define netif_is_link_up (   netif)    (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0)

Ask if a link is up.

Definition at line 482 of file netif.h.

#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 470 of file netif.h.

#define NETIF_MAX_HWADDR_LEN   6U

Must be the maximum of all used hardware address lengths across all types of interfaces in use.

This does not have to be changed, normally.

Definition at line 64 of file netif.h.

#define NETIF_NAMESIZE   6

The size of a fully constructed netif name which the netif can be identified by in APIs.

Composed of 2 chars, 3 (max) digits, and 1 \0

Definition at line 71 of file netif.h.

Typedef Documentation

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

Definition at line 653 of file netif.h.

typedef err_t(* netif_init_fn) (struct netif *netif)

Function prototype for netif init functions.

Set up flags and output/linkoutput callback functions in this function.

Parameters
netifThe netif to initialize

Definition at line 169 of file netif.h.

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
pThe received packet, copied into a pbuf
inpThe 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

Definition at line 179 of file netif.h.

typedef err_t(* netif_linkoutput_fn) (struct netif *netif, struct pbuf *p)

Function prototype for netif->linkoutput functions.

Only used for ethernet netifs. This function is called by ARP when a packet shall be sent.

Parameters
netifThe netif which shall send a packet
pThe packet to send (raw ethernet packet)

Definition at line 213 of file netif.h.

typedef u16_t netif_nsc_reason_t

Extended netif status callback (NSC) reasons flags.

May be extended in the future!

Definition at line 573 of file netif.h.

typedef void(* netif_status_callback_fn) (struct netif *netif)

Function prototype for netif status- or link-callback functions.

Definition at line 215 of file netif.h.

Enumeration Type Documentation

MAC Filter Actions, these are passed to a netif's igmp_mac_filter or mld_mac_filter callback function.

Enumerator
NETIF_DEL_MAC_FILTER 

Delete a filter entry.

NETIF_ADD_MAC_FILTER 

Add a filter entry.

Definition at line 157 of file netif.h.

Variable Documentation

struct netif* netif_default

The default network interface.

struct netif* netif_list

The list of network interfaces.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.