MeterLogger
|
#include "lwip/opt.h"
#include "lwip/err.h"
#include "lwip/ip_addr.h"
#include "lwip/def.h"
#include "lwip/pbuf.h"
Go to the source code of this file.
Data Structures | |
struct | netif |
Macros | |
#define | ENABLE_LOOPBACK (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF) |
#define | NETIF_MAX_HWADDR_LEN 6U |
#define | NETIF_FLAG_UP 0x01U |
#define | NETIF_FLAG_BROADCAST 0x02U |
#define | NETIF_FLAG_POINTTOPOINT 0x04U |
#define | NETIF_FLAG_DHCP 0x08U |
#define | NETIF_FLAG_LINK_UP 0x10U |
#define | NETIF_FLAG_ETHARP 0x20U |
#define | NETIF_FLAG_ETHERNET 0x40U |
#define | NETIF_FLAG_IGMP 0x80U |
#define | NETIF_INIT_SNMP(netif, type, speed) |
#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) |
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, ip_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, ip_addr_t *group, u8_t action) |
typedef void(* | dhcp_event_fn) (void) |
Functions | |
void | netif_init (void) ICACHE_FLASH_ATTR |
struct netif * | netif_add (struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask, ip_addr_t *gw, void *state, netif_init_fn init, netif_input_fn input) ICACHE_FLASH_ATTR |
void | netif_set_addr (struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask, ip_addr_t *gw) ICACHE_FLASH_ATTR |
void | netif_remove (struct netif *netif) ICACHE_FLASH_ATTR |
struct netif * | netif_find (char *name) ICACHE_FLASH_ATTR |
void | netif_set_default (struct netif *netif) ICACHE_FLASH_ATTR |
void | netif_set_ipaddr (struct netif *netif, ip_addr_t *ipaddr) ICACHE_FLASH_ATTR |
void | netif_set_netmask (struct netif *netif, ip_addr_t *netmask) ICACHE_FLASH_ATTR |
void | netif_set_gw (struct netif *netif, ip_addr_t *gw) ICACHE_FLASH_ATTR |
void | netif_set_up (struct netif *netif) ICACHE_FLASH_ATTR |
void | netif_set_down (struct netif *netif) ICACHE_FLASH_ATTR |
void | netif_set_link_up (struct netif *netif) ICACHE_FLASH_ATTR |
void | netif_set_link_down (struct netif *netif) ICACHE_FLASH_ATTR |
Variables | |
struct netif * | netif_list |
struct netif * | netif_default |
#define ENABLE_LOOPBACK (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF) |
#define NETIF_FLAG_BROADCAST 0x02U |
If set, the netif has broadcast capability. Set by the netif driver in its init function.
Definition at line 72 of file netif.h.
Referenced by ip4_addr_isbroadcast().
#define NETIF_FLAG_DHCP 0x08U |
#define NETIF_FLAG_ETHARP 0x20U |
If set, the netif is an ethernet device using ARP. Set by the netif driver in its init function. Used to check input packet types and use of DHCP.
Definition at line 88 of file netif.h.
Referenced by netif_set_down(), netif_set_link_up(), netif_set_up(), tcpip_input(), and tcpip_thread().
#define NETIF_FLAG_ETHERNET 0x40U |
If set, the netif is an ethernet device. It might not use ARP or TCP/IP if it is used for PPPoE only.
Definition at line 92 of file netif.h.
Referenced by tcpip_input(), and tcpip_thread().
#define NETIF_FLAG_IGMP 0x80U |
If set, the netif has IGMP capability. Set by the netif driver in its init function.
Definition at line 95 of file netif.h.
Referenced by ip_input(), netif_add(), netif_remove(), netif_set_link_up(), and netif_set_up().
#define NETIF_FLAG_LINK_UP 0x10U |
If set, the interface has an active link (set by the network interface driver). Either set by the netif driver in its init function (if the link is up at that time) or at a later point once the link comes up (if link detection is supported by the hardware).
Definition at line 84 of file netif.h.
Referenced by netif_set_link_down(), netif_set_link_up(), and netif_set_up().
#define NETIF_FLAG_POINTTOPOINT 0x04U |
#define NETIF_FLAG_UP 0x01U |
Whether the network interface is 'up'. This is a software flag used to control whether this network interface is enabled and processes traffic. It is set by the startup code (for static IP configuration) or by dhcp/autoip when an address has been assigned.
Definition at line 69 of file netif.h.
Referenced by netif_set_down(), netif_set_link_up(), and netif_set_up().
#define netif_is_link_up | ( | netif | ) | (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0) |
#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 286 of file netif.h.
Referenced by espconn_udp_sendto(), espconn_udp_sent(), ip_input(), ip_route(), ip_router(), and netif_remove().
#define NETIF_MAX_HWADDR_LEN 6U |
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 |
struct netif* netif_add | ( | struct netif * | netif, |
ip_addr_t * | ipaddr, | ||
ip_addr_t * | netmask, | ||
ip_addr_t * | gw, | ||
void * | state, | ||
netif_init_fn | init, | ||
netif_input_fn | 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. |
Definition at line 137 of file netif.c.
References ERR_OK, netif::flags, netif::gw, netif::input, netif::ip_addr, ip_addr_debug_print, ip_addr_set_zero, LWIP_ASSERT, 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.
Referenced by netif_init().
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') |
Definition at line 291 of file netif.c.
References LWIP_DEBUGF, netif::name, NETIF_DEBUG, netif::next, NULL, and netif::num.
void netif_init | ( | void | ) |
Definition at line 104 of file netif.c.
References IP4_ADDR, ip_input(), netif_add(), netif_set_up(), NULL, and tcpip_input().
Referenced by lwip_init().
void netif_remove | ( | struct netif * | netif | ) |
Remove a network interface from the list of lwIP netifs.
netif | the network interface to remove |
Definition at line 241 of file netif.c.
References netif::flags, LWIP_DEBUGF, NETIF_DEBUG, NETIF_FLAG_IGMP, netif_is_up, netif_set_default(), netif_set_down(), netif::next, NULL, snmp_dec_iflist, and snmp_delete_ipaddridx_tree.
void netif_set_addr | ( | struct netif * | netif, |
ip_addr_t * | ipaddr, | ||
ip_addr_t * | netmask, | ||
ip_addr_t * | 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 |
Definition at line 227 of file netif.c.
References netif_set_gw(), netif_set_ipaddr(), and netif_set_netmask().
Referenced by netif_add().
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 |
Definition at line 431 of file netif.c.
References LWIP_DEBUGF, netif::name, NETIF_DEBUG, NULL, snmp_delete_iprteidx_tree, and snmp_insert_iprteidx_tree.
Referenced by espconn_udp_sendto(), espconn_udp_sent(), and netif_remove().
void netif_set_down | ( | struct netif * | netif | ) |
Bring an interface down, disabling any traffic processing.
Definition at line 491 of file netif.c.
References netif::flags, NETIF_FLAG_ETHARP, NETIF_FLAG_UP, NETIF_STATUS_CALLBACK, and snmp_get_sysuptime.
Referenced by netif_remove().
Change the default gateway for a network interface
netif | the network interface to change |
gw | the new default gateway |
Definition at line 389 of file netif.c.
References netif::gw, ip4_addr1_16, ip4_addr2_16, ip4_addr3_16, ip4_addr4_16, ip_addr_set, LWIP_DBG_STATE, LWIP_DBG_TRACE, LWIP_DEBUGF, netif::name, NETIF_DEBUG, and U16_F.
Referenced by netif_set_addr().
Change the IP address of a network interface
netif | the network interface to change |
ipaddr | the new IP address |
Definition at line 324 of file netif.c.
References ip4_addr1_16, ip4_addr2_16, ip4_addr3_16, ip4_addr4_16, netif::ip_addr, ip_addr_cmp, ip_addr_isany, ip_addr_islinklocal, ip_addr_set, LWIP_AUTOIP, LWIP_DBG_STATE, LWIP_DBG_TRACE, LWIP_DEBUGF, netif::name, NETIF_DEBUG, NULL, snmp_delete_ipaddridx_tree, snmp_delete_iprteidx_tree, snmp_insert_ipaddridx_tree, snmp_insert_iprteidx_tree, and U16_F.
Referenced by netif_set_addr().
void netif_set_link_down | ( | struct netif * | netif | ) |
Called by a driver when its link goes down
Definition at line 562 of file netif.c.
References ERR_MEM, ERR_OK, netif::flags, ip_input(), pbuf::len, LINK_STATS_INC, LWIP_ASSERT, LWIP_LOOPBACK_MAX_PBUFS, LWIP_UNUSED_ARG, NETIF_FLAG_LINK_UP, NETIF_LINK_CALLBACK, netif_list, pbuf::next, netif::next, NULL, pbuf_alloc(), pbuf_clen(), pbuf_copy(), pbuf_free(), PBUF_LINK, PBUF_RAM, snmp_add_ifinoctets, snmp_add_ifoutoctets, snmp_inc_ifinucastpkts, snmp_inc_ifoutdiscards, snmp_inc_ifoutucastpkts, SYS_ARCH_DECL_PROTECT, SYS_ARCH_PROTECT, SYS_ARCH_UNPROTECT, tcpip_callback, and pbuf::tot_len.
void netif_set_link_up | ( | struct netif * | netif | ) |
Called by a driver when its link goes up
Definition at line 523 of file netif.c.
References netif::flags, NETIF_FLAG_ETHARP, NETIF_FLAG_IGMP, NETIF_FLAG_LINK_UP, NETIF_FLAG_UP, and NETIF_LINK_CALLBACK.
Change the netmask of a network interface
netif | the network interface to change |
netmask | the new netmask |
Definition at line 410 of file netif.c.
References ip4_addr1_16, ip4_addr2_16, ip4_addr3_16, ip4_addr4_16, ip_addr_set, 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.
Referenced by netif_set_addr().
void netif_set_up | ( | struct netif * | netif | ) |
Bring an interface up, available for processing traffic.
Definition at line 454 of file netif.c.
References netif::flags, NETIF_FLAG_ETHARP, NETIF_FLAG_IGMP, NETIF_FLAG_LINK_UP, NETIF_FLAG_UP, NETIF_STATUS_CALLBACK, and snmp_get_sysuptime.
Referenced by netif_init().
struct netif* netif_default |
The default network interface.
Definition at line 76 of file netif.c.
Referenced by ip_route(), and ip_router().
struct netif* netif_list |
The list of network interfaces.
Definition at line 75 of file netif.c.
Referenced by ip_input(), ip_route(), ip_router(), netif_add(), netif_set_link_down(), patch_netif_ap(), and wifi_softap_ip_config().