From 439ae629e0b567b97b152d5e3ceb0fc42c706f83 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Mon, 22 Feb 2016 17:39:01 +0100 Subject: [PATCH] Change TCPIP INPKT API message to take a function pointer. Allows integration of other protocols without extending lwIP core (e.g. 6LoWPAN) Remove unused sem member of struct tcpip_msg --- src/include/lwip/priv/tcpip_priv.h | 8 +++++++- src/include/lwip/tcpip.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/include/lwip/priv/tcpip_priv.h b/src/include/lwip/priv/tcpip_priv.h index 91cdc2ca..83716390 100644 --- a/src/include/lwip/priv/tcpip_priv.h +++ b/src/include/lwip/priv/tcpip_priv.h @@ -132,6 +132,12 @@ extern sys_mutex_t lock_tcpip_core; #define API_EXPR_DEREF(expr) *(expr) #endif /* LWIP_MPU_COMPATIBLE */ +/** Function prototype for input functions functions. + * + * @param p The received packet, copied into a pbuf + * @param inp The netif which received the packet + */ +typedef err_t (*tcpip_inpkt_fn)(struct pbuf *p, struct netif *inp); #if LWIP_NETCONN || LWIP_SOCKET err_t tcpip_apimsg(struct api_msg *apimsg); @@ -180,7 +186,6 @@ enum tcpip_msg_type { struct tcpip_msg { enum tcpip_msg_type type; - sys_sem_t *sem; union { #if LWIP_NETCONN || LWIP_SOCKET struct api_msg *apimsg; @@ -194,6 +199,7 @@ struct tcpip_msg { struct { struct pbuf *p; struct netif *netif; + tcpip_inpkt_fn input_fn; } inp; struct { tcpip_callback_fn function; diff --git a/src/include/lwip/tcpip.h b/src/include/lwip/tcpip.h index 097baf05..7bbf1327 100644 --- a/src/include/lwip/tcpip.h +++ b/src/include/lwip/tcpip.h @@ -37,6 +37,7 @@ #if !NO_SYS /* don't build if not configured for use in lwipopts.h */ #include "lwip/err.h" +#include "lwip/timers.h" #ifdef __cplusplus extern "C" {