The Pedigree Project
0.1
|
#include "lwip/opt.h"
#include "lwip/priv/tcpip_priv.h"
#include "lwip/sys.h"
#include "lwip/memp.h"
#include "lwip/mem.h"
#include "lwip/init.h"
#include "lwip/ip.h"
#include "lwip/pbuf.h"
#include "lwip/etharp.h"
#include "netif/ethernet.h"
Go to the source code of this file.
Macros | |
#define | TCPIP_MSG_VAR_REF(name) API_VAR_REF(name) |
#define | TCPIP_MSG_VAR_DECLARE(name) API_VAR_DECLARE(struct tcpip_msg, name) |
#define | TCPIP_MSG_VAR_ALLOC(name) API_VAR_ALLOC(struct tcpip_msg, MEMP_TCPIP_MSG_API, name, ERR_MEM) |
#define | TCPIP_MSG_VAR_FREE(name) API_VAR_FREE(MEMP_TCPIP_MSG_API, name) |
#define | TCPIP_MBOX_FETCH(mbox, msg) sys_mbox_fetch(mbox, msg) |
Functions | |
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_callback_with_block (tcpip_callback_fn function, void *ctx, u8_t block) |
err_t | tcpip_send_msg_wait_sem (tcpip_callback_fn fn, void *apimsg, sys_sem_t *sem) |
err_t | tcpip_api_call (tcpip_api_call_fn fn, struct tcpip_api_call_data *call) |
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_trycallback (struct tcpip_callback_msg *msg) |
void | tcpip_init (tcpip_init_done_fn initfunc, void *arg) |
err_t | pbuf_free_callback (struct pbuf *p) |
err_t | mem_free_callback (void *m) |
Sequential API Main thread module
Definition in file tcpip.c.
err_t mem_free_callback | ( | void * | m | ) |
A simple wrapper function that allows you to free heap memory from interrupt context.
m | the heap memory to free |
Definition at line 532 of file tcpip.c.
References mem_free(), and tcpip_callback_with_block().
A simple wrapper function that allows you to free a pbuf from interrupt context.
p | The pbuf (chain) to be dereferenced. |
Definition at line 519 of file tcpip.c.
References tcpip_callback_with_block().
err_t tcpip_api_call | ( | tcpip_api_call_fn | fn, |
struct tcpip_api_call_data * | call | ||
) |
Synchronously calls function in TCPIP thread and waits for its completion. 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.
fn | Function to call |
call | Call parameters |
Definition at line 384 of file tcpip.c.
References ERR_OK, sys_arch_sem_wait(), sys_mbox_post(), sys_mbox_valid_val, sys_sem_free(), and sys_sem_new().
err_t tcpip_callback_with_block | ( | tcpip_callback_fn | function, |
void * | ctx, | ||
u8_t | block | ||
) |
Call a specific function in the thread context of tcpip_thread for easy access synchronization. A function called in that way may access lwIP core code without fearing concurrent access.
function | the function to call |
ctx | parameter passed to f |
block | 1 to block until the request is posted, 0 to non-blocking mode |
Definition at line 253 of file tcpip.c.
References ERR_MEM, ERR_OK, memp_free(), memp_malloc(), sys_mbox_post(), sys_mbox_trypost(), and sys_mbox_valid_val.
Referenced by mem_free_callback(), netif_set_link_down(), and pbuf_free_callback().
void tcpip_callbackmsg_delete | ( | struct tcpip_callback_msg * | msg | ) |
Free a callback message allocated by tcpip_callbackmsg_new().
msg | the message to free |
Definition at line 452 of file tcpip.c.
References memp_free().
struct tcpip_callback_msg* tcpip_callbackmsg_new | ( | tcpip_callback_fn | function, |
void * | ctx | ||
) |
Allocate a structure for a static callback message and initialize it. This is intended to be used to send "static" messages from interrupt context.
function | the function to call |
ctx | parameter passed to function |
Definition at line 434 of file tcpip.c.
References memp_malloc().
void tcpip_init | ( | tcpip_init_done_fn | initfunc, |
void * | arg | ||
) |
Initialize this module:
initfunc | a function to call when tcpip_thread is running and finished initializing |
arg | argument to pass to initfunc |
Definition at line 481 of file tcpip.c.
References ERR_OK, lwip_init(), pbuf_free(), sys_mbox_new(), sys_mutex_new(), sys_thread_new(), TCPIP_MBOX_SIZE, TCPIP_THREAD_NAME, TCPIP_THREAD_PRIO, and TCPIP_THREAD_STACKSIZE.
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
p | the received packet |
inp | the network interface on which the packet was received |
input_fn | input function to call |
Definition at line 188 of file tcpip.c.
References ERR_MEM, ERR_OK, LWIP_DEBUGF, memp_free(), memp_malloc(), sys_mbox_trypost(), sys_mbox_valid_val, and TCPIP_DEBUG.
Referenced by tcpip_input().
Pass a received packet to tcpip_thread for input processing with ethernet_input or ip_input. Don't call directly, pass to netif_add() and call netif->input().
p | the received packet, p->payload pointing to the Ethernet header or to an IP header (if inp doesn't have NETIF_FLAG_ETHARP or NETIF_FLAG_ETHERNET flags) |
inp | the network interface on which the packet was received |
Definition at line 231 of file tcpip.c.
References netif::flags, NETIF_FLAG_ETHARP, NETIF_FLAG_ETHERNET, and tcpip_inpkt().
Referenced by NetworkStack::registerDevice().
err_t tcpip_send_msg_wait_sem | ( | tcpip_callback_fn | fn, |
void * | apimsg, | ||
sys_sem_t * | sem | ||
) |
Sends a message to TCPIP thread to call a function. Caller thread blocks on on a provided semaphore, which ist NOT automatically signalled by TCPIP thread, this has to be done by the user. It is recommended to use LWIP_TCPIP_CORE_LOCKING since this is the way with least runtime overhead.
fn | function to be called from TCPIP thread |
apimsg | argument to API function |
sem | semaphore to wait on |
Definition at line 348 of file tcpip.c.
References ERR_OK, LWIP_UNUSED_ARG, sys_arch_sem_wait(), sys_mbox_post(), sys_mbox_valid_val, and sys_sem_valid().
err_t tcpip_trycallback | ( | struct tcpip_callback_msg * | msg | ) |
Try to post a callback-message to the tcpip_thread mbox This is intended to be used to send "static" messages from interrupt context.
msg | pointer to the message to post |
Definition at line 465 of file tcpip.c.
References sys_mbox_trypost(), and sys_mbox_valid_val.