diff --git a/src/core/ipv4/etharp.c b/src/core/ipv4/etharp.c index 57ce2e4d..7e70f1e6 100644 --- a/src/core/ipv4/etharp.c +++ b/src/core/ipv4/etharp.c @@ -56,6 +56,10 @@ #include +#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 */ /** Re-request a used ARP entry 1 minute before it would expire to prevent diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c index e030ecc9..5ee24eed 100644 --- a/src/core/ipv4/icmp.c +++ b/src/core/ipv4/icmp.c @@ -51,6 +51,10 @@ #include +#ifdef LWIP_HOOK_FILENAME +#include LWIP_HOOK_FILENAME +#endif + /** 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, * e.g. when link header is stripped of when receiving) */ diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c index 2e2ce4bd..4e4eb611 100644 --- a/src/core/ipv4/ip4.c +++ b/src/core/ipv4/ip4.c @@ -59,6 +59,10 @@ #include +#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 * generate the IP checksum (in contrast to calculating it on-the-fly). */ #ifndef LWIP_INLINE_IP_CHKSUM diff --git a/src/core/ipv6/ip6.c b/src/core/ipv6/ip6.c index bb26db16..55567073 100644 --- a/src/core/ipv6/ip6.c +++ b/src/core/ipv6/ip6.c @@ -60,6 +60,10 @@ #include "lwip/debug.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 * a netif following a sequence of heuristics: diff --git a/src/core/ipv6/nd6.c b/src/core/ipv6/nd6.c index 23a1208b..4eb6c115 100644 --- a/src/core/ipv6/nd6.c +++ b/src/core/ipv6/nd6.c @@ -64,6 +64,10 @@ #include +#ifdef LWIP_HOOK_FILENAME +#include LWIP_HOOK_FILENAME +#endif + #if LWIP_IPV6_DUP_DETECT_ATTEMPTS > IP6_ADDR_TENTATIVE_COUNT_MASK #error LWIP_IPV6_DUP_DETECT_ATTEMPTS > IP6_ADDR_TENTATIVE_COUNT_MASK #endif diff --git a/src/core/memp.c b/src/core/memp.c index b589d27f..c7152730 100644 --- a/src/core/memp.c +++ b/src/core/memp.c @@ -76,7 +76,6 @@ #include "lwip/ip6_frag.h" #include "lwip/mld6.h" - #define LWIP_MEMPOOL(name,num,size,desc) LWIP_MEMPOOL_DECLARE(name,num,size,desc) #include "lwip/priv/memp_std.h" @@ -85,6 +84,10 @@ const struct memp_desc* const memp_pools[MEMP_MAX] = { #include "lwip/priv/memp_std.h" }; +#ifdef LWIP_HOOK_FILENAME +#include LWIP_HOOK_FILENAME +#endif + #if MEMP_MEM_MALLOC && MEMP_OVERFLOW_CHECK >= 2 #undef MEMP_OVERFLOW_CHECK /* MEMP_OVERFLOW_CHECK >= 2 does not work with MEMP_MEM_MALLOC, use 1 instead */ diff --git a/src/core/tcp.c b/src/core/tcp.c index 4e141771..c0bc3982 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -62,6 +62,10 @@ #include +#ifdef LWIP_HOOK_FILENAME +#include LWIP_HOOK_FILENAME +#endif + #ifndef TCP_LOCAL_PORT_RANGE_START /* From http://www.iana.org/assignments/port-numbers: "The Dynamic and/or Private Ports are those from 49152 through 65535" */ diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 7f3ecedc..eb911e92 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -2454,6 +2454,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: * Hook for generation of the Initial Sequence Number (ISN) for a new TCP diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c index d2924fb1..4596b32c 100644 --- a/src/netif/ethernet.c +++ b/src/netif/ethernet.c @@ -56,6 +56,10 @@ #include "netif/ppp/pppoe.h" #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 ethzero = {{0,0,0,0,0,0}};