lwIP 2.0.0  lwIP 2.0.0
LightweightIPstack
Mainloop mode ("NO_SYS")

Functions

void lwip_init (void)
 
err_t ip_input (struct pbuf *p, struct netif *inp)
 
err_t netif_input (struct pbuf *p, struct netif *inp)
 
void sys_check_timeouts (void)
 
err_t ethernet_input (struct pbuf *p, struct netif *netif)
 

Detailed Description

Use this mode if you do not run an OS on your system. #define NO_SYS to 1. Feed incoming packets to netif->input(pbuf, netif) function from mainloop, not from interrupt context. You can allocate a Packet buffers (PBUF) in interrupt context and put them into a queue which is processed from mainloop.
Call sys_check_timeouts() periodically in the mainloop.
Porting: implement all functions in Time and Critical sections.
You can only use Callback-style APIs in this mode.

Function Documentation

err_t ethernet_input ( struct pbuf p,
struct netif netif 
)

Process received ethernet frames. Using this function instead of directly calling ip_input and passing ARP frames through etharp in ethernetif_input, the ARP cache is protected from concurrent access.
Don't call directly, pass to netif_add() and call netif->input().

Parameters
pthe received packet, p->payload pointing to the ethernet header
netifthe network interface on which the packet was received
err_t ip_input ( struct pbuf p,
struct netif inp 
)

If both IP versions are enabled, this function can dispatch packets to the correct one. Don't call directly, pass to netif_add() and call netif->input().

void lwip_init ( void  )

Initialize all modules. Use this in NO_SYS mode. Use tcpip_init() otherwise.

err_t netif_input ( struct pbuf p,
struct netif inp 
)

Forwards a received packet for input processing with ethernet_input() or ip_input() depending on netif flags. Don't call directly, pass to netif_add() and call netif->input(). Only works if the netif driver correctly sets NETIF_FLAG_ETHARP and/or NETIF_FLAG_ETHERNET flag!

void sys_check_timeouts ( void  )

Handle timeouts for NO_SYS==1 (i.e. without using tcpip_thread/sys_timeouts_mbox_fetch(). Uses sys_now() to call timeout handler functions when timeouts expire.

Must be called periodically from your main loop.