netif.h
netif API (to be used from TCPIP thread)
Defines
-
ENABLE_LOOPBACK
-
NETIF_MAX_HWADDR_LEN
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.
-
NETIF_NAMESIZE
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
-
NETIF_ADDR_IDX_MAX
-
LWIP_NETIF_USE_HINTS
-
NETIF_CHECKSUM_ENABLED(netif, chksumflag)
-
NETIF_SET_CHECKSUM_CTRL(netif, chksumflags)
-
IF__NETIF_CHECKSUM_ENABLED(netif, chksumflag)
-
NETIF_FOREACH(netif)
-
netif_set_flags(netif, set_flags)
-
netif_clear_flags(netif, clr_flags)
-
netif_is_flag_set(netif, flag)
-
netif_is_up(netif)
Ask if an interface is up.
-
netif_is_link_up(netif)
Ask if a link is up.
-
NETIF_SET_HINTS(netif, netifhint)
-
NETIF_RESET_HINTS(netif)
-
netif_get_index(netif)
-
NETIF_NO_INDEX
-
LWIP_NSC_NONE
-
LWIP_NSC_NETIF_ADDED
netif was added.
arg: NULL. Called AFTER netif was added.
-
LWIP_NSC_NETIF_REMOVED
netif was removed.
arg: NULL. Called BEFORE netif is removed.
-
LWIP_NSC_LINK_CHANGED
link changed
-
LWIP_NSC_STATUS_CHANGED
netif administrative status changed.
up is called AFTER netif is set up.
down is called BEFORE the netif is actually set down.
-
LWIP_NSC_IPV4_ADDRESS_CHANGED
IPv4 address has changed.
-
LWIP_NSC_IPV4_GATEWAY_CHANGED
IPv4 gateway has changed.
-
LWIP_NSC_IPV4_NETMASK_CHANGED
IPv4 netmask has changed.
-
LWIP_NSC_IPV4_SETTINGS_CHANGED
called AFTER IPv4 address/gateway/netmask changes have been applied
-
LWIP_NSC_IPV6_SET
IPv6 address was added.
-
LWIP_NSC_IPV6_ADDR_STATE_CHANGED
IPv6 address state has changed.
-
LWIP_NSC_IPV4_ADDR_VALID
IPv4 settings: valid address set, application may start to communicate.
-
NETIF_DECLARE_EXT_CALLBACK(name)
-
netif_add_ext_callback(callback, fn)
-
netif_remove_ext_callback(callback)
-
netif_invoke_ext_callback(netif, reason, args)
Typedefs
-
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.
- Param netif:
The netif to initialize
-
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.
- Param p:
The received packet, copied into a pbuf
- Param inp:
The netif which received the packet
- Return:
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)
Function prototype for netif->linkoutput functions.
Only used for ethernet netifs. This function is called by ARP when a packet shall be sent.
- Param netif:
The netif which shall send a packet
- Param p:
The packet to send (raw ethernet packet)
-
typedef void (*netif_status_callback_fn)(struct netif *netif)
Function prototype for netif status- or link-callback functions.
-
typedef u8_t netif_addr_idx_t
-
typedef u16_t netif_nsc_reason_t
Extended netif status callback (NSC) reasons flags.
May be extended in the future!
-
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!
- Param netif:
netif that is affected by change
- Param reason:
change reason
- Param args:
depends on reason, see reason description
Enums
Functions
-
struct netif *netif_add_noaddr(struct netif *netif, void *state, netif_init_fn init, netif_input_fn input)
-
struct netif *netif_add(struct netif *netif, void *state, netif_init_fn init, netif_input_fn input)
-
u8_t netif_name_to_index(const char *name)
-
char *netif_index_to_name(u8_t idx, char *name)
Variables
-
struct netif
- #include <netif.h>
Generic data structure used for all lwIP network interfaces.
The following fields should be filled in by the initialization function for the device driver: hwaddr_len, hwaddr[], mtu, flags
Public Members
-
netif_input_fn input
This function is called by the network device driver to pass a packet up the TCP/IP stack.
-
netif_linkoutput_fn linkoutput
This function is called by ethernet_output() when it wants to send a packet on the interface.
This function outputs the pbuf as-is on the link medium.
-
void *state
This field can be set by the device driver and could point to state information for the device.
-
u16_t mtu
maximum transfer unit (in bytes)
-
u8_t hwaddr[NETIF_MAX_HWADDR_LEN]
link level hardware address of this interface
-
u8_t hwaddr_len
number of bytes used in hwaddr
-
u8_t flags
flags (
See also
Flags)
-
char name[2]
descriptive abbreviation
-
u8_t num
number of this interface.
Used for if_api and netifapi_netif, as well as for IPv6 zones
-
netif_input_fn input
-
union netif_ext_callback_args_t
- #include <netif.h>
Argument supplied to netif_ext_callback_fn.
Public Members
-
struct netif_ext_callback_args_t.link_changed_s link_changed
-
struct netif_ext_callback_args_t.status_changed_s status_changed
-
struct netif_ext_callback_args_t.ipv4_changed_s ipv4_changed
-
struct netif_ext_callback_args_t.ipv6_set_s ipv6_set
-
struct netif_ext_callback_args_t.ipv6_addr_state_changed_s ipv6_addr_state_changed
-
struct ipv4_changed_s
- #include <netif.h>
Args to LWIP_NSC_IPV4_ADDRESS_CHANGED|LWIP_NSC_IPV4_GATEWAY_CHANGED|LWIP_NSC_IPV4_NETMASK_CHANGED|LWIP_NSC_IPV4_SETTINGS_CHANGED callback.
-
struct ipv6_addr_state_changed_s
- #include <netif.h>
Args to LWIP_NSC_IPV6_ADDR_STATE_CHANGED callback.
-
struct ipv6_set_s
- #include <netif.h>
Args to LWIP_NSC_IPV6_SET callback.
-
struct netif_ext_callback_args_t.link_changed_s link_changed