#include "lwip/opt.h"
#include "lwip/err.h"
#include "lwip/ip_addr.h"
#include "lwip/inet.h"
#include "lwip/pbuf.h"
Data Structures | |
struct | netif |
Generic data structure used for all lwIP network interfaces. More... | |
Macros | |
#define | ENABLE_LOOPBACK (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF) |
#define | NETIF_FLAG_BROADCAST 0x02U |
if set, the netif has broadcast capability More... | |
#define | NETIF_FLAG_DHCP 0x08U |
if set, the interface is configured using DHCP More... | |
#define | NETIF_FLAG_ETHARP 0x20U |
if set, the netif is an device using ARP More... | |
#define | NETIF_FLAG_IGMP 0x40U |
if set, the netif has IGMP capability More... | |
#define | NETIF_FLAG_LINK_UP 0x10U |
if set, the interface has an active link (set by the network interface driver) More... | |
#define | NETIF_FLAG_POINTTOPOINT 0x04U |
if set, the netif is one end of a point-to-point connection More... | |
#define | NETIF_FLAG_UP 0x01U |
TODO: define the use (where, when, whom) of netif flags. More... | |
#define | netif_init() /* Compatibility define, not init needed. */ |
#define | NETIF_INIT_SNMP(netif, type, speed) |
#define | NETIF_MAX_HWADDR_LEN 6U |
must be the maximum of all used hardware address lengths across all types of interfaces in use More... | |
Functions | |
struct netif * | netif_add (struct netif *netif, struct ip_addr *ipaddr, struct ip_addr *netmask, struct ip_addr *gw, void *state, err_t(*init)(struct netif *netif), err_t(*input)(struct pbuf *p, struct netif *netif)) |
Add a network interface to the list of lwIP netifs. More... | |
struct netif * | netif_find (char *name) |
Find a network interface by searching for its name. More... | |
u8_t | netif_is_up (struct netif *netif) |
Ask if an interface is up. More... | |
void | netif_remove (struct netif *netif) |
Remove a network interface from the list of lwIP netifs. More... | |
void | netif_set_addr (struct netif *netif, struct ip_addr *ipaddr, struct ip_addr *netmask, struct ip_addr *gw) |
Change IP address configuration for a network interface (including netmask and default gateway). More... | |
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) More... | |
void | netif_set_down (struct netif *netif) |
Bring an interface down, disabling any traffic processing. More... | |
void | netif_set_gw (struct netif *netif, struct ip_addr *gw) |
Change the default gateway for a network interface. More... | |
void | netif_set_ipaddr (struct netif *netif, struct ip_addr *ipaddr) |
Change the IP address of a network interface. More... | |
void | netif_set_netmask (struct netif *netif, struct ip_addr *netmask) |
Change the netmask of a network interface. More... | |
void | netif_set_up (struct netif *netif) |
Bring an interface up, available for processing traffic. More... | |
Variables | |
struct netif * | netif_default |
The default network interface. More... | |
struct netif * | netif_list |
The list of network interfaces. More... | |
#define ENABLE_LOOPBACK (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF) |
#define NETIF_FLAG_BROADCAST 0x02U |
if set, the netif has broadcast capability
#define NETIF_FLAG_DHCP 0x08U |
if set, the interface is configured using DHCP
#define NETIF_FLAG_ETHARP 0x20U |
if set, the netif is an device using ARP
#define NETIF_FLAG_IGMP 0x40U |
if set, the netif has IGMP capability
#define NETIF_FLAG_LINK_UP 0x10U |
if set, the interface has an active link (set by the network interface driver)
#define NETIF_FLAG_POINTTOPOINT 0x04U |
if set, the netif is one end of a point-to-point connection
#define NETIF_FLAG_UP 0x01U |
TODO: define the use (where, when, whom) of netif flags.
whether the network interface is 'up'. this is a software flag used to control whether this network interface is enabled and processes traffic.
#define netif_init | ( | void | ) | /* Compatibility define, not init needed. */ |
Referenced by lwip_init().
#define NETIF_INIT_SNMP | ( | netif, | |
type, | |||
speed | |||
) |
#define NETIF_MAX_HWADDR_LEN 6U |
must be the maximum of all used hardware address lengths across all types of interfaces in use
struct netif* netif_add | ( | struct netif * | netif, |
struct ip_addr * | ipaddr, | ||
struct ip_addr * | netmask, | ||
struct ip_addr * | gw, | ||
void * | state, | ||
err_t(*)(struct netif *netif) | init, | ||
err_t(*)(struct pbuf *p, struct netif *netif) | input | ||
) |
Add a network interface to the list of lwIP netifs.
netif | a pre-allocated netif structure |
ipaddr | IP address for the new netif |
netmask | network mask for the new netif |
gw | default gateway IP address for the new netif |
state | opaque data passed to the new netif |
init | callback function that initializes the interface |
input | callback function that is called to pass ingress packets up in the protocol layer stack. |
References ERR_OK, netif::flags, netif::gw, init, input, netif::input, netif::ip_addr, LWIP_DEBUGF, netif::name, NETIF_DEBUG, NETIF_FLAG_IGMP, netif_list, netif_set_addr(), netif::netmask, netif::next, NULL, netif::num, snmp_inc_iflist, state, and netif::state.
struct netif* netif_find | ( | char * | name | ) |
Find a network interface by searching for its name.
name | the name of the netif (like netif->name) plus concatenated number in ascii representation (e.g. 'en0') |
Ask if an interface is up.
References netif::flags, and NETIF_FLAG_UP.
void netif_remove | ( | struct netif * | netif | ) |
Remove a network interface from the list of lwIP netifs.
netif | the network interface to remove |
void netif_set_addr | ( | struct netif * | netif, |
struct ip_addr * | ipaddr, | ||
struct ip_addr * | netmask, | ||
struct ip_addr * | gw | ||
) |
Change IP address configuration for a network interface (including netmask and default gateway).
netif | the network interface to change |
ipaddr | the new IP address |
netmask | the new netmask |
gw | the new default gateway |
References netif_set_gw(), netif_set_ipaddr(), and netif_set_netmask().
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)
netif | the default network interface |
void netif_set_down | ( | struct netif * | netif | ) |
Bring an interface down, disabling any traffic processing.
void netif_set_gw | ( | struct netif * | netif, |
struct ip_addr * | gw | ||
) |
Change the default gateway for a network interface.
netif | the network interface to change |
gw | the new default gateway |
References netif::gw, LWIP_DBG_STATE, LWIP_DBG_TRACE, LWIP_DEBUGF, netif::name, NETIF_DEBUG, and U16_F.
void netif_set_ipaddr | ( | struct netif * | netif, |
struct ip_addr * | ipaddr | ||
) |
Change the IP address of a network interface.
netif | the network interface to change |
ipaddr | the new IP address |
References netif::ip_addr, LWIP_DBG_STATE, LWIP_DBG_TRACE, LWIP_DEBUGF, netif::name, NETIF_DEBUG, NULL, pcb, snmp_delete_ipaddridx_tree, snmp_delete_iprteidx_tree, snmp_insert_ipaddridx_tree, snmp_insert_iprteidx_tree, and U16_F.
void netif_set_netmask | ( | struct netif * | netif, |
struct ip_addr * | netmask | ||
) |
Change the netmask of a network interface.
netif | the network interface to change |
netmask | the new netmask |
References LWIP_DBG_STATE, LWIP_DBG_TRACE, LWIP_DEBUGF, netif::name, NETIF_DEBUG, netif::netmask, snmp_delete_iprteidx_tree, snmp_insert_iprteidx_tree, and U16_F.
void netif_set_up | ( | struct netif * | netif | ) |
Bring an interface up, available for processing traffic.
struct netif* netif_default |
The default network interface.
struct netif* netif_list |
The list of network interfaces.