lwIP
2.0.2
Lightweight IP stack
|
#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"
Data Structures | |
struct | netif |
Macros | |
#define | NETIF_MAX_HWADDR_LEN 6U |
#define | NETIF_FLAG_UP 0x01U |
#define | NETIF_FLAG_BROADCAST 0x02U |
#define | NETIF_FLAG_LINK_UP 0x04U |
#define | NETIF_FLAG_ETHARP 0x08U |
#define | NETIF_FLAG_ETHERNET 0x10U |
#define | NETIF_FLAG_IGMP 0x20U |
#define | NETIF_FLAG_MLD6 0x40U |
#define | netif_set_client_data(netif, id, data) netif_get_client_data(netif, id) = (data) |
#define | netif_get_client_data(netif, id) (netif)->client_data[(id)] |
#define | netif_ip4_addr(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->ip_addr))) |
#define | netif_ip4_netmask(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->netmask))) |
#define | netif_ip4_gw(netif) ((const ip4_addr_t*)ip_2_ip4(&((netif)->gw))) |
#define | netif_ip_addr4(netif) ((const ip_addr_t*)&((netif)->ip_addr)) |
#define | netif_ip_netmask4(netif) ((const ip_addr_t*)&((netif)->netmask)) |
#define | netif_ip_gw4(netif) ((const ip_addr_t*)&((netif)->gw)) |
#define | netif_is_up(netif) (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0) |
#define | netif_is_link_up(netif) (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0) |
#define | netif_set_hostname(netif, name) do { if((netif) != NULL) { (netif)->hostname = name; }}while(0) |
#define | netif_get_hostname(netif) (((netif) != NULL) ? ((netif)->hostname) : NULL) |
#define | netif_set_igmp_mac_filter(netif, function) do { if((netif) != NULL) { (netif)->igmp_mac_filter = function; }}while(0) |
#define | netif_set_mld_mac_filter(netif, function) do { if((netif) != NULL) { (netif)->mld_mac_filter = function; }}while(0) |
#define | netif_ip_addr6(netif, i) ((const ip_addr_t*)(&((netif)->ip6_addr[i]))) |
#define | netif_ip6_addr(netif, i) ((const ip6_addr_t*)ip_2_ip6(&((netif)->ip6_addr[i]))) |
Typedefs | |
typedef err_t(* | netif_init_fn) (struct netif *netif) |
typedef err_t(* | netif_input_fn) (struct pbuf *p, struct netif *inp) |
typedef err_t(* | netif_output_fn) (struct netif *netif, struct pbuf *p, const ip4_addr_t *ipaddr) |
typedef err_t(* | netif_output_ip6_fn) (struct netif *netif, struct pbuf *p, const ip6_addr_t *ipaddr) |
typedef err_t(* | netif_linkoutput_fn) (struct netif *netif, struct pbuf *p) |
typedef void(* | netif_status_callback_fn) (struct netif *netif) |
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_mld_mac_filter_fn) (struct netif *netif, const ip6_addr_t *group, enum netif_mac_filter_action action) |
Enumerations | |
enum | netif_mac_filter_action { NETIF_DEL_MAC_FILTER = 0, NETIF_ADD_MAC_FILTER = 1 } |
Variables | |
struct netif * | netif_list |
struct netif * | netif_default |
netif API (to be used from TCPIP thread)
#define netif_is_link_up | ( | netif | ) | (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0) |
Ask if a link is up
#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.
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
Function prototype for netif init functions. Set up flags and output/linkoutput callback functions in this function.
netif | The netif to initialize |
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.
p | The received packet, copied into a pbuf |
inp | The netif which received the packet |
Function prototype for netif->linkoutput functions. Only used for ethernet netifs. This function is called by ARP when a packet shall be sent.
netif | The netif which shall send a packet |
p | The packet to send (raw ethernet packet) |
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 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'.
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'.
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 |
Function prototype for netif status- or link-callback functions.
s8_t netif_get_ip6_addr_match | ( | struct netif * | netif, |
const ip6_addr_t * | ip6addr | ||
) |
Checks if a specific address is assigned to the netif and returns its index.
netif | the netif to check |
ip6addr | the IPv6 address to find |
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().
struct netif* netif_default |
The default network interface.
struct netif* netif_list |
The list of network interfaces.