diff --git a/src/core/ipv4/etharp.c b/src/core/ipv4/etharp.c index adbd8bc2..3f48a997 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 e119b006..901bff3d 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 7d7a9570..0b367181 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 31624492..58fab1a2 100644 --- a/src/core/memp.c +++ b/src/core/memp.c @@ -75,7 +75,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" @@ -84,6 +83,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 ae35e69c..d88da01a 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 5abac30c..9ed3de61 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -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: * 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 9b76e85f..52ea4236 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}};