Implement task #14367: Hooks need a better place to be defined

We now have a #define for a header file name that is #included in every .c file that provides hooks.
This commit is contained in:
Dirk Ziegelmeier 2017-02-10 13:25:04 +01:00 committed by goldsimon
parent b3293d903e
commit 76efa271e6
9 changed files with 41 additions and 1 deletions

View File

@ -56,6 +56,10 @@
#include <string.h> #include <string.h>
#ifdef LWIP_HOOK_FILENAME
#include LWIP_HOOK_FILENAME
#endif
#if LWIP_IPV4 && LWIP_ARP /* don't build if not configured for use in lwipopts.h */ #if LWIP_IPV4 && LWIP_ARP /* don't build if not configured for use in lwipopts.h */
/** Re-request a used ARP entry 1 minute before it would expire to prevent /** Re-request a used ARP entry 1 minute before it would expire to prevent

View File

@ -51,6 +51,10 @@
#include <string.h> #include <string.h>
#ifdef LWIP_HOOK_FILENAME
#include LWIP_HOOK_FILENAME
#endif
/** Small optimization: set to 0 if incoming PBUF_POOL pbuf always can be /** Small optimization: set to 0 if incoming PBUF_POOL pbuf always can be
* used to modify and send a response packet (and to 1 if this is not the case, * used to modify and send a response packet (and to 1 if this is not the case,
* e.g. when link header is stripped of when receiving) */ * e.g. when link header is stripped of when receiving) */

View File

@ -59,6 +59,10 @@
#include <string.h> #include <string.h>
#ifdef LWIP_HOOK_FILENAME
#include LWIP_HOOK_FILENAME
#endif
/** Set this to 0 in the rare case of wanting to call an extra function to /** Set this to 0 in the rare case of wanting to call an extra function to
* generate the IP checksum (in contrast to calculating it on-the-fly). */ * generate the IP checksum (in contrast to calculating it on-the-fly). */
#ifndef LWIP_INLINE_IP_CHKSUM #ifndef LWIP_INLINE_IP_CHKSUM

View File

@ -60,6 +60,10 @@
#include "lwip/debug.h" #include "lwip/debug.h"
#include "lwip/stats.h" #include "lwip/stats.h"
#ifdef LWIP_HOOK_FILENAME
#include LWIP_HOOK_FILENAME
#endif
/** /**
* Finds the appropriate network interface for a given IPv6 address. It tries to select * Finds the appropriate network interface for a given IPv6 address. It tries to select
* a netif following a sequence of heuristics: * a netif following a sequence of heuristics:

View File

@ -64,6 +64,10 @@
#include <string.h> #include <string.h>
#ifdef LWIP_HOOK_FILENAME
#include LWIP_HOOK_FILENAME
#endif
#if LWIP_IPV6_DUP_DETECT_ATTEMPTS > IP6_ADDR_TENTATIVE_COUNT_MASK #if LWIP_IPV6_DUP_DETECT_ATTEMPTS > IP6_ADDR_TENTATIVE_COUNT_MASK
#error LWIP_IPV6_DUP_DETECT_ATTEMPTS > IP6_ADDR_TENTATIVE_COUNT_MASK #error LWIP_IPV6_DUP_DETECT_ATTEMPTS > IP6_ADDR_TENTATIVE_COUNT_MASK
#endif #endif

View File

@ -75,7 +75,6 @@
#include "lwip/ip6_frag.h" #include "lwip/ip6_frag.h"
#include "lwip/mld6.h" #include "lwip/mld6.h"
#define LWIP_MEMPOOL(name,num,size,desc) LWIP_MEMPOOL_DECLARE(name,num,size,desc) #define LWIP_MEMPOOL(name,num,size,desc) LWIP_MEMPOOL_DECLARE(name,num,size,desc)
#include "lwip/priv/memp_std.h" #include "lwip/priv/memp_std.h"
@ -84,6 +83,10 @@ const struct memp_desc* const memp_pools[MEMP_MAX] = {
#include "lwip/priv/memp_std.h" #include "lwip/priv/memp_std.h"
}; };
#ifdef LWIP_HOOK_FILENAME
#include LWIP_HOOK_FILENAME
#endif
#if MEMP_MEM_MALLOC && MEMP_OVERFLOW_CHECK >= 2 #if MEMP_MEM_MALLOC && MEMP_OVERFLOW_CHECK >= 2
#undef MEMP_OVERFLOW_CHECK #undef MEMP_OVERFLOW_CHECK
/* MEMP_OVERFLOW_CHECK >= 2 does not work with MEMP_MEM_MALLOC, use 1 instead */ /* MEMP_OVERFLOW_CHECK >= 2 does not work with MEMP_MEM_MALLOC, use 1 instead */

View File

@ -62,6 +62,10 @@
#include <string.h> #include <string.h>
#ifdef LWIP_HOOK_FILENAME
#include LWIP_HOOK_FILENAME
#endif
#ifndef TCP_LOCAL_PORT_RANGE_START #ifndef TCP_LOCAL_PORT_RANGE_START
/* From http://www.iana.org/assignments/port-numbers: /* From http://www.iana.org/assignments/port-numbers:
"The Dynamic and/or Private Ports are those from 49152 through 65535" */ "The Dynamic and/or Private Ports are those from 49152 through 65535" */

View File

@ -2415,6 +2415,15 @@
* @{ * @{
*/ */
/**
* LWIP_HOOK_FILENAME: Custom filename to #include in files that provide hooks.
* Declare your hook function prototypes in there, you may also #include all headers
* providing data types that are need in this file.
*/
#ifdef __DOXYGEN__
#define LWIP_HOOK_FILENAME "path/to/my/lwip_hooks.h"
#endif
/** /**
* LWIP_HOOK_TCP_ISN: * LWIP_HOOK_TCP_ISN:
* Hook for generation of the Initial Sequence Number (ISN) for a new TCP * Hook for generation of the Initial Sequence Number (ISN) for a new TCP

View File

@ -56,6 +56,10 @@
#include "netif/ppp/pppoe.h" #include "netif/ppp/pppoe.h"
#endif /* PPPOE_SUPPORT */ #endif /* PPPOE_SUPPORT */
#ifdef LWIP_HOOK_FILENAME
#include LWIP_HOOK_FILENAME
#endif
const struct eth_addr ethbroadcast = {{0xff,0xff,0xff,0xff,0xff,0xff}}; const struct eth_addr ethbroadcast = {{0xff,0xff,0xff,0xff,0xff,0xff}};
const struct eth_addr ethzero = {{0,0,0,0,0,0}}; const struct eth_addr ethzero = {{0,0,0,0,0,0}};