lwIP  2.1.0
Lightweight IP stack
timeouts.c File Reference
#include "lwip/opt.h"
#include "lwip/timeouts.h"
#include "lwip/priv/tcp_priv.h"
#include "lwip/def.h"
#include "lwip/memp.h"
#include "lwip/priv/tcpip_priv.h"
#include "lwip/ip4_frag.h"
#include "lwip/etharp.h"
#include "lwip/dhcp.h"
#include "lwip/autoip.h"
#include "lwip/igmp.h"
#include "lwip/dns.h"
#include "lwip/nd6.h"
#include "lwip/ip6_frag.h"
#include "lwip/mld6.h"
#include "lwip/dhcp6.h"
#include "lwip/sys.h"
#include "lwip/pbuf.h"

Functions

void tcp_timer_needed (void)
 
void sys_timeouts_init (void)
 
void sys_timeout (u32_t msecs, sys_timeout_handler handler, void *arg)
 
void sys_untimeout (sys_timeout_handler handler, void *arg)
 
void sys_check_timeouts (void)
 
void sys_restart_timeouts (void)
 
u32_t sys_timeouts_sleeptime (void)
 

Variables

const struct lwip_cyclic_timer lwip_cyclic_timers []
 
const int lwip_num_cyclic_timers = (sizeof( lwip_cyclic_timers )/sizeof(( lwip_cyclic_timers )[0]))
 

Detailed Description

Stack-internal timers implementation. This file includes timer callbacks for stack-internal timers as well as functions to set up or stop timers and check for expired timers.

Function Documentation

◆ sys_restart_timeouts()

void sys_restart_timeouts ( void  )

Rebase the timeout times to the current time. This is necessary if sys_check_timeouts() hasn't been called for a long time (e.g. while saving energy) to prevent all timer functions of that period being called.

◆ sys_timeout()

void sys_timeout ( u32_t  msecs,
sys_timeout_handler  handler,
void *  arg 
)

Create a one-shot timer (aka timeout). Timeouts are processed in the following cases:

  • while waiting for a message using sys_timeouts_mbox_fetch()
  • by calling sys_check_timeouts() (NO_SYS==1 only)
Parameters
msecstime in milliseconds after that the timer should expire
handlercallback function to call when msecs have elapsed
argargument to pass to the callback function

◆ sys_timeouts_init()

void sys_timeouts_init ( void  )

Initialize this module

◆ sys_timeouts_sleeptime()

u32_t sys_timeouts_sleeptime ( void  )

Return the time left before the next timeout is due. If no timeouts are enqueued, returns 0xffffffff

◆ sys_untimeout()

void sys_untimeout ( sys_timeout_handler  handler,
void *  arg 
)

Go through timeout list (for this task only) and remove the first matching entry (subsequent entries remain untouched), even though the timeout has not triggered yet.

Parameters
handlercallback function that would be called by the timeout
argcallback argument that would be passed to handler

◆ tcp_timer_needed()

void tcp_timer_needed ( void  )

Called from TCP_REG when registering a new PCB: the reason is to have the TCP timer only running when there are active (or time-wait) PCBs.

Variable Documentation

◆ lwip_cyclic_timers

const struct lwip_cyclic_timer lwip_cyclic_timers[]

This array contains all stack-internal cyclic timers. To get the number of timers, use LWIP_ARRAYSIZE()

◆ lwip_num_cyclic_timers

const int lwip_num_cyclic_timers = (sizeof( lwip_cyclic_timers )/sizeof(( lwip_cyclic_timers )[0]))

Array size of lwip_cyclic_timers[]