diff --git a/CHANGELOG b/CHANGELOG index ea72631d..28a4f309 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,10 @@ HISTORY ++ New features: + 2015-10-09: Simon Goldschmidt + * started to move "private" header files containing implementation details to + "lwip/priv/" include directory to seperate the API from the implementation. + 2015-10-07: Simon Goldschmidt * added sntp client as first "supported" application layer protocol implementation added 'apps' folder diff --git a/src/api/api_lib.c b/src/api/api_lib.c index 3ad26f8e..68a2e129 100644 --- a/src/api/api_lib.c +++ b/src/api/api_lib.c @@ -44,14 +44,13 @@ #if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */ #include "lwip/api.h" -#include "lwip/tcpip.h" #include "lwip/memp.h" #include "lwip/ip.h" #include "lwip/raw.h" #include "lwip/udp.h" -#include "lwip/tcp.h" -#include "lwip/tcp_impl.h" +#include "lwip/priv/tcp_priv.h" +#include "lwip/priv/tcpip_priv.h" #include diff --git a/src/api/api_msg.c b/src/api/api_msg.c index 466e4888..96dcde42 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -40,7 +40,7 @@ #if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */ -#include "lwip/api_msg.h" +#include "lwip/priv/api_msg.h" #include "lwip/ip.h" #include "lwip/udp.h" @@ -48,10 +48,10 @@ #include "lwip/raw.h" #include "lwip/memp.h" -#include "lwip/tcpip.h" #include "lwip/igmp.h" #include "lwip/dns.h" #include "lwip/mld6.h" +#include "lwip/priv/tcpip_priv.h" #include diff --git a/src/api/netifapi.c b/src/api/netifapi.c index 4985f80c..7fd92591 100644 --- a/src/api/netifapi.c +++ b/src/api/netifapi.c @@ -36,8 +36,8 @@ #if LWIP_NETIF_API /* don't build if not configured for use in lwipopts.h */ #include "lwip/netifapi.h" -#include "lwip/tcpip.h" #include "lwip/memp.h" +#include "lwip/priv/tcpip_priv.h" #define NETIFAPI_VAR_REF(name) API_VAR_REF(name) #define NETIFAPI_VAR_DECLARE(name) API_VAR_DECLARE(struct netifapi_msg, name) diff --git a/src/api/sockets.c b/src/api/sockets.c index 6dab6e05..4f34bd04 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -50,9 +50,9 @@ #include "lwip/tcp.h" #include "lwip/raw.h" #include "lwip/udp.h" -#include "lwip/tcpip.h" #include "lwip/memp.h" #include "lwip/pbuf.h" +#include "lwip/priv/tcpip_priv.h" #if LWIP_CHECKSUM_ON_COPY #include "lwip/inet_chksum.h" #endif diff --git a/src/api/tcpip.c b/src/api/tcpip.c index 7c53e144..74b8fd44 100644 --- a/src/api/tcpip.c +++ b/src/api/tcpip.c @@ -40,11 +40,12 @@ #if !NO_SYS /* don't build if not configured for use in lwipopts.h */ +#include "lwip/tcpip.h" +#include "lwip/priv/tcpip_priv.h" #include "lwip/sys.h" #include "lwip/memp.h" #include "lwip/mem.h" #include "lwip/pbuf.h" -#include "lwip/tcpip.h" #include "lwip/init.h" #include "lwip/ip.h" #include "netif/etharp.h" @@ -506,7 +507,8 @@ tcpip_pppapi_lock(struct pppapi_msg* pppapimsg) * @param ctx parameter passed to function * @return a struct pointer to pass to tcpip_trycallback(). */ -struct tcpip_callback_msg* tcpip_callbackmsg_new(tcpip_callback_fn function, void *ctx) +struct tcpip_callback_msg* +tcpip_callbackmsg_new(tcpip_callback_fn function, void *ctx) { struct tcpip_msg *msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); if (msg == NULL) { @@ -523,7 +525,8 @@ struct tcpip_callback_msg* tcpip_callbackmsg_new(tcpip_callback_fn function, voi * * @param msg the message to free */ -void tcpip_callbackmsg_delete(struct tcpip_callback_msg* msg) +void +tcpip_callbackmsg_delete(struct tcpip_callback_msg* msg) { memp_free(MEMP_TCPIP_MSG_API, msg); } diff --git a/src/core/init.c b/src/core/init.c index 4fdc581f..009baf8d 100644 --- a/src/core/init.c +++ b/src/core/init.c @@ -49,7 +49,7 @@ #include "lwip/ip.h" #include "lwip/raw.h" #include "lwip/udp.h" -#include "lwip/tcp_impl.h" +#include "lwip/priv/tcp_priv.h" #include "lwip/snmp.h" #include "lwip/autoip.h" #include "lwip/igmp.h" diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c index cbe003ee..e968436a 100644 --- a/src/core/ipv4/ip4.c +++ b/src/core/ipv4/ip4.c @@ -52,7 +52,7 @@ #include "lwip/igmp.h" #include "lwip/raw.h" #include "lwip/udp.h" -#include "lwip/tcp_impl.h" +#include "lwip/priv/tcp_priv.h" #include "lwip/dhcp.h" #include "lwip/autoip.h" #include "lwip/stats.h" diff --git a/src/core/ipv6/ip6.c b/src/core/ipv6/ip6.c index 1be9944e..aa2f5969 100644 --- a/src/core/ipv6/ip6.c +++ b/src/core/ipv6/ip6.c @@ -52,7 +52,7 @@ #include "lwip/icmp6.h" #include "lwip/raw.h" #include "lwip/udp.h" -#include "lwip/tcp_impl.h" +#include "lwip/priv/tcp_priv.h" #include "lwip/dhcp6.h" #include "lwip/nd6.h" #include "lwip/mld6.h" diff --git a/src/core/memp.c b/src/core/memp.c index 6ecfc49f..8ebde2d8 100644 --- a/src/core/memp.c +++ b/src/core/memp.c @@ -44,12 +44,10 @@ #include "lwip/pbuf.h" #include "lwip/udp.h" #include "lwip/raw.h" -#include "lwip/tcp_impl.h" #include "lwip/igmp.h" #include "lwip/api.h" -#include "lwip/api_msg.h" +#include "lwip/priv/api_msg.h" #include "lwip/sockets.h" -#include "lwip/tcpip.h" #include "lwip/sys.h" #include "lwip/timers.h" #include "lwip/stats.h" @@ -66,6 +64,8 @@ #include "lwip/nd6.h" #include "lwip/ip6_frag.h" #include "lwip/mld6.h" +#include "lwip/priv/tcp_priv.h" +#include "lwip/priv/tcpip_priv.h" #include @@ -136,7 +136,7 @@ static #endif const u16_t memp_sizes[MEMP_MAX] = { #define LWIP_MEMPOOL(name,num,size,desc) LWIP_MEM_ALIGN_SIZE(size), -#include "lwip/memp_std.h" +#include "lwip/priv/memp_std.h" }; #if !MEMP_MEM_MALLOC /* don't build if not configured for use in lwipopts.h */ @@ -144,14 +144,14 @@ const u16_t memp_sizes[MEMP_MAX] = { /** This array holds the number of elements in each pool. */ static const u16_t memp_num[MEMP_MAX] = { #define LWIP_MEMPOOL(name,num,size,desc) (num), -#include "lwip/memp_std.h" +#include "lwip/priv/memp_std.h" }; /** This array holds a textual description of each pool. */ #ifdef LWIP_DEBUG static const char *memp_desc[MEMP_MAX] = { #define LWIP_MEMPOOL(name,num,size,desc) (desc), -#include "lwip/memp_std.h" +#include "lwip/priv/memp_std.h" }; #endif /* LWIP_DEBUG */ @@ -164,12 +164,12 @@ static const char *memp_desc[MEMP_MAX] = { */ #define LWIP_MEMPOOL(name,num,size,desc) u8_t memp_memory_ ## name ## _base \ [((num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size)))]; -#include "lwip/memp_std.h" +#include "lwip/priv/memp_std.h" /** This array holds the base of each memory pool. */ static u8_t *const memp_bases[] = { #define LWIP_MEMPOOL(name,num,size,desc) memp_memory_ ## name ## _base, -#include "lwip/memp_std.h" +#include "lwip/priv/memp_std.h" }; #else /* MEMP_SEPARATE_POOLS */ @@ -177,7 +177,7 @@ static u8_t *const memp_bases[] = { /** This is the actual memory used by the pools (all pools in one big block). */ static u8_t memp_memory[MEM_ALIGNMENT - 1 #define LWIP_MEMPOOL(name,num,size,desc) + ( (num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size) ) ) -#include "lwip/memp_std.h" +#include "lwip/priv/memp_std.h" ]; #endif /* MEMP_SEPARATE_POOLS */ @@ -210,7 +210,7 @@ memp_sanity(void) #if defined(LWIP_DEBUG) && MEMP_STATS static const char * memp_overflow_names[] = { #define LWIP_MEMPOOL(name,num,size,desc) "/"desc, -#include "lwip/memp_std.h" +#include "lwip/priv/memp_std.h" }; #endif diff --git a/src/core/netif.c b/src/core/netif.c index 4e28fb29..66b212b2 100644 --- a/src/core/netif.c +++ b/src/core/netif.c @@ -42,7 +42,7 @@ #include "lwip/ip_addr.h" #include "lwip/ip6_addr.h" #include "lwip/netif.h" -#include "lwip/tcp_impl.h" +#include "lwip/priv/tcp_priv.h" #include "lwip/udp.h" #include "lwip/snmp_mib2.h" #include "lwip/igmp.h" diff --git a/src/core/pbuf.c b/src/core/pbuf.c index ba747c76..a6d08382 100644 --- a/src/core/pbuf.c +++ b/src/core/pbuf.c @@ -70,7 +70,7 @@ #include "lwip/pbuf.h" #include "lwip/sys.h" #if LWIP_TCP && TCP_QUEUE_OOSEQ -#include "lwip/tcp_impl.h" +#include "lwip/priv/tcp_priv.h" #endif #if LWIP_CHECKSUM_ON_COPY #include "lwip/inet_chksum.h" diff --git a/src/core/snmp/mib2.c b/src/core/snmp/mib2.c index 515517ca..0d0bb0ca 100644 --- a/src/core/snmp/mib2.c +++ b/src/core/snmp/mib2.c @@ -56,7 +56,7 @@ #include "lwip/ip.h" #include "lwip/ip_frag.h" #include "lwip/mem.h" -#include "lwip/tcp_impl.h" +#include "lwip/priv/tcp_priv.h" #include "lwip/udp.h" #include "lwip/snmp_asn1.h" #include "lwip/snmp_structs.h" diff --git a/src/core/stats.c b/src/core/stats.c index 7452f4e3..43734cee 100644 --- a/src/core/stats.c +++ b/src/core/stats.c @@ -56,7 +56,7 @@ stats_init(void) #if MEMP_STATS const char * memp_names[] = { #define LWIP_MEMPOOL(name,num,size,desc) desc, -#include "lwip/memp_std.h" +#include "lwip/priv/memp_std.h" }; int i; for (i = 0; i < MEMP_MAX; i++) { @@ -127,7 +127,7 @@ stats_display_memp(struct stats_mem *mem, int index) { const char * memp_names[] = { #define LWIP_MEMPOOL(name,num,size,desc) desc, -#include "lwip/memp_std.h" +#include "lwip/priv/memp_std.h" }; if (index < MEMP_MAX) { stats_display_mem(mem, memp_names[index]); diff --git a/src/core/tcp.c b/src/core/tcp.c index eee80fdd..a477ef7d 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -48,7 +48,7 @@ #include "lwip/mem.h" #include "lwip/memp.h" #include "lwip/tcp.h" -#include "lwip/tcp_impl.h" +#include "lwip/priv/tcp_priv.h" #include "lwip/debug.h" #include "lwip/stats.h" #include "lwip/ip6.h" diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index aedb2462..14a59b2f 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -45,7 +45,7 @@ #if LWIP_TCP /* don't build if not configured for use in lwipopts.h */ -#include "lwip/tcp_impl.h" +#include "lwip/priv/tcp_priv.h" #include "lwip/def.h" #include "lwip/ip_addr.h" #include "lwip/netif.h" diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index a205e8a1..11380f33 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -42,7 +42,7 @@ #if LWIP_TCP /* don't build if not configured for use in lwipopts.h */ -#include "lwip/tcp_impl.h" +#include "lwip/priv/tcp_priv.h" #include "lwip/def.h" #include "lwip/mem.h" #include "lwip/memp.h" diff --git a/src/core/timers.c b/src/core/timers.c index ebaae508..c361f4f8 100644 --- a/src/core/timers.c +++ b/src/core/timers.c @@ -42,13 +42,13 @@ #include "lwip/opt.h" #include "lwip/timers.h" -#include "lwip/tcp_impl.h" +#include "lwip/priv/tcp_priv.h" #if LWIP_TIMERS #include "lwip/def.h" #include "lwip/memp.h" -#include "lwip/tcpip.h" +#include "lwip/priv/tcpip_priv.h" #include "lwip/ip_frag.h" #include "netif/etharp.h" diff --git a/src/include/lwip/memp.h b/src/include/lwip/memp.h index 8b5228b5..9e3808e8 100644 --- a/src/include/lwip/memp.h +++ b/src/include/lwip/memp.h @@ -41,12 +41,12 @@ extern "C" { /* run once with empty definition to handle all custom includes in lwippools.h */ #define LWIP_MEMPOOL(name,num,size,desc) -#include "lwip/memp_std.h" +#include "lwip/priv/memp_std.h" /* Create the list of all memory pools managed by memp. MEMP_MAX represents a NULL pool at the end */ typedef enum { #define LWIP_MEMPOOL(name,num,size,desc) MEMP_##name, -#include "lwip/memp_std.h" +#include "lwip/priv/memp_std.h" MEMP_MAX } memp_t; @@ -60,7 +60,7 @@ typedef enum { #define LWIP_MALLOC_MEMPOOL_START 1 #define LWIP_MALLOC_MEMPOOL(num, size) * MEMP_POOL_##size + 0 #define LWIP_MALLOC_MEMPOOL_END -#include "lwip/memp_std.h" +#include "lwip/priv/memp_std.h" ) , /* Get the last (via: MEMP_POOL_HELPER_END = ((u8_t) 0 + MEMP_POOL_A*0 + MEMP_POOL_B*0 + MEMP_POOL_C*1) */ @@ -69,7 +69,7 @@ typedef enum { #define LWIP_MALLOC_MEMPOOL_START #define LWIP_MALLOC_MEMPOOL(num, size) 0 + MEMP_POOL_##size * #define LWIP_MALLOC_MEMPOOL_END 1 -#include "lwip/memp_std.h" +#include "lwip/priv/memp_std.h" ) } memp_pool_helper_t; diff --git a/src/include/lwip/api_msg.h b/src/include/lwip/priv/api_msg.h similarity index 100% rename from src/include/lwip/api_msg.h rename to src/include/lwip/priv/api_msg.h diff --git a/src/include/lwip/memp_std.h b/src/include/lwip/priv/memp_std.h similarity index 100% rename from src/include/lwip/memp_std.h rename to src/include/lwip/priv/memp_std.h diff --git a/src/include/lwip/tcp_impl.h b/src/include/lwip/priv/tcp_priv.h similarity index 100% rename from src/include/lwip/tcp_impl.h rename to src/include/lwip/priv/tcp_priv.h diff --git a/src/include/lwip/tcpip.h b/src/include/lwip/priv/tcpip_priv.h similarity index 85% rename from src/include/lwip/tcpip.h rename to src/include/lwip/priv/tcpip_priv.h index ec5480c6..91cdc2ca 100644 --- a/src/include/lwip/tcpip.h +++ b/src/include/lwip/priv/tcpip_priv.h @@ -29,14 +29,15 @@ * Author: Adam Dunkels * */ -#ifndef LWIP_HDR_TCPIP_H -#define LWIP_HDR_TCPIP_H +#ifndef LWIP_HDR_TCPIP_PRIV_H +#define LWIP_HDR_TCPIP_PRIV_H #include "lwip/opt.h" #if !NO_SYS /* don't build if not configured for use in lwipopts.h */ -#include "lwip/api_msg.h" +#include "lwip/tcpip.h" +#include "lwip/priv/api_msg.h" #include "lwip/netifapi.h" #include "lwip/pppapi.h" #include "lwip/pbuf.h" @@ -132,23 +133,10 @@ extern sys_mutex_t lock_tcpip_core; #endif /* LWIP_MPU_COMPATIBLE */ - -/** Function prototype for the init_done function passed to tcpip_init */ -typedef void (*tcpip_init_done_fn)(void *arg); -/** Function prototype for functions passed to tcpip_callback() */ -typedef void (*tcpip_callback_fn)(void *ctx); - -/* Forward declarations */ -struct tcpip_callback_msg; - -void tcpip_init(tcpip_init_done_fn tcpip_init_done, void *arg); - #if LWIP_NETCONN || LWIP_SOCKET err_t tcpip_apimsg(struct api_msg *apimsg); #endif /* LWIP_NETCONN || LWIP_SOCKET */ -err_t tcpip_input(struct pbuf *p, struct netif *inp); - #if PPPOS_SUPPORT && !PPP_INPROC_IRQ_SAFE err_t tcpip_pppos_input(struct pbuf *p, struct netif *inp); #endif /* PPPOS_SUPPORT && !PPP_INPROC_IRQ_SAFE */ @@ -167,21 +155,6 @@ err_t tcpip_pppapi_lock(struct pppapi_msg *pppapimsg); #endif /* LWIP_TCPIP_CORE_LOCKING */ #endif /* LWIP_PPP_API */ -err_t tcpip_callback_with_block(tcpip_callback_fn function, void *ctx, u8_t block); -#define tcpip_callback(f, ctx) tcpip_callback_with_block(f, ctx, 1) - -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); - -/* free pbufs or heap memory from another context without blocking */ -err_t pbuf_free_callback(struct pbuf *p); -err_t mem_free_callback(void *m); - -#if LWIP_TCPIP_TIMEOUT -err_t tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg); -err_t tcpip_untimeout(sys_timeout_handler h, void *arg); -#endif /* LWIP_TCPIP_TIMEOUT */ enum tcpip_msg_type { #if LWIP_NETCONN || LWIP_SOCKET @@ -242,4 +215,4 @@ struct tcpip_msg { #endif /* !NO_SYS */ -#endif /* LWIP_HDR_TCPIP_H */ +#endif /* LWIP_HDR_TCPIP_PRIV_H */ diff --git a/src/include/netif/ppp/vj.h b/src/include/netif/ppp/vj.h index 3780667b..b8e46697 100644 --- a/src/include/netif/ppp/vj.h +++ b/src/include/netif/ppp/vj.h @@ -29,7 +29,7 @@ #define VJ_H #include "lwip/ip.h" -#include "lwip/tcp_impl.h" +#include "lwip/priv/tcp_priv.h" #define MAX_SLOTS 16 /* must be > 2 and < 256 */ #define MAX_HDR 128