started to move "private" header files containing implementation details to "lwip/priv/" include directory to seperate the API from the implementation.

This commit is contained in:
sg 2015-10-09 21:58:58 +02:00
parent b32751a693
commit c12fa7b4c4
24 changed files with 49 additions and 70 deletions

View File

@ -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

View File

@ -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 <string.h>

View File

@ -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 <string.h>

View File

@ -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)

View File

@ -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

View File

@ -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);
}

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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 <string.h>
@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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]);

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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;

View File

@ -29,14 +29,15 @@
* Author: Adam Dunkels <adam@sics.se>
*
*/
#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 */

View File

@ -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