lwIP 2.2.1
Lightweight IP stack
Loading...
Searching...
No Matches
tcpip.h File Reference
#include "lwip/opt.h"
#include "lwip/err.h"
#include "lwip/timeouts.h"
#include "lwip/netif.h"

Macros

#define LOCK_TCPIP_CORE()
#define UNLOCK_TCPIP_CORE()
#define tcpip_callback_with_block(function, ctx, block)

Typedefs

typedef void(* tcpip_init_done_fn) (void *arg)
typedef void(* tcpip_callback_fn) (void *ctx)

Functions

void tcpip_init (tcpip_init_done_fn tcpip_init_done, void *arg)
err_t tcpip_inpkt (struct pbuf *p, struct netif *inp, netif_input_fn input_fn)
err_t tcpip_input (struct pbuf *p, struct netif *inp)
err_t tcpip_try_callback (tcpip_callback_fn function, void *ctx)
err_t tcpip_callback (tcpip_callback_fn function, void *ctx)
err_t tcpip_callback_wait (tcpip_callback_fn function, void *ctx)
struct tcpip_callback_msg * tcpip_callbackmsg_new (tcpip_callback_fn function, void *ctx)
void tcpip_callbackmsg_delete (struct tcpip_callback_msg *msg)
err_t tcpip_callbackmsg_trycallback (struct tcpip_callback_msg *msg)
err_t tcpip_callbackmsg_trycallback_fromisr (struct tcpip_callback_msg *msg)
err_t pbuf_free_callback (struct pbuf *p)
err_t mem_free_callback (void *m)

Variables

sys_mutex_t lock_tcpip_core

Detailed Description

Functions to sync with TCPIP thread

Macro Definition Documentation

◆ LOCK_TCPIP_CORE

#define LOCK_TCPIP_CORE ( )
Value:
void sys_mutex_lock(sys_mutex_t *mutex)
sys_mutex_t lock_tcpip_core
Definition tcpip.c:65

Lock lwIP core mutex (needs LWIP_TCPIP_CORE_LOCKING 1)

◆ UNLOCK_TCPIP_CORE

#define UNLOCK_TCPIP_CORE ( )
Value:
void sys_mutex_unlock(sys_mutex_t *mutex)

Unlock lwIP core mutex (needs LWIP_TCPIP_CORE_LOCKING 1)

Typedef Documentation

◆ tcpip_callback_fn

typedef void(* tcpip_callback_fn) (void *ctx)

Function prototype for functions passed to tcpip_callback()

◆ tcpip_init_done_fn

typedef void(* tcpip_init_done_fn) (void *arg)

Function prototype for the init_done function passed to tcpip_init

Function Documentation

◆ mem_free_callback()

err_t mem_free_callback ( void * m)

A simple wrapper function that allows you to free heap memory from interrupt context.

Parameters
mthe heap memory to free
Returns
ERR_OK if callback could be enqueued, an err_t if not

◆ pbuf_free_callback()

err_t pbuf_free_callback ( struct pbuf * p)

A simple wrapper function that allows you to free a pbuf from interrupt context.

Parameters
pThe pbuf (chain) to be dereferenced.
Returns
ERR_OK if callback could be enqueued, an err_t if not

◆ tcpip_callback_wait()

err_t tcpip_callback_wait ( tcpip_callback_fn function,
void * ctx )

Sends a message to TCPIP thread to call a function. Caller thread blocks until the function returns. It is recommended to use LWIP_TCPIP_CORE_LOCKING (preferred) or LWIP_NETCONN_SEM_PER_THREAD. If not, a semaphore is created and destroyed on every call which is usually an expensive/slow operation.

Parameters
functionthe function to call
ctxparameter passed to f
Returns
ERR_OK if the function was called, another err_t if not

◆ tcpip_inpkt()

err_t tcpip_inpkt ( struct pbuf * p,
struct netif * inp,
netif_input_fn input_fn )

Pass a received packet to tcpip_thread for input processing

Parameters
pthe received packet
inpthe network interface on which the packet was received
input_fninput function to call

Variable Documentation

◆ lock_tcpip_core

sys_mutex_t lock_tcpip_core
extern

The global semaphore to lock the stack.