From fe4395336a6fd04491c160f9af44e3b3301b8696 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Sun, 25 Nov 2018 14:01:23 +0100 Subject: [PATCH] Fix bug #55078: Add custom data to pbuf struct Add a #define that users can use to store custom data on a pbuf (cherry picked from commit 92a18bf6382077c88b11126b1e662dfb5386e637) --- src/include/lwip/opt.h | 8 ++++++++ src/include/lwip/pbuf.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 82c420c1..10625c72 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -1555,6 +1555,14 @@ #if !defined LWIP_PBUF_REF_T || defined __DOXYGEN__ #define LWIP_PBUF_REF_T u8_t #endif + +/** + * LWIP_PBUF_CUSTOM_DATA: Store private data on pbufs (e.g. timestamps) + * This extends struct pbuf so user can store custom data on every pbuf. + */ +#if !defined LWIP_PBUF_CUSTOM_DATA || defined __DOXYGEN__ +#define LWIP_PBUF_CUSTOM_DATA +#endif /** * @} */ diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h index 82902a4e..1f520f03 100644 --- a/src/include/lwip/pbuf.h +++ b/src/include/lwip/pbuf.h @@ -219,6 +219,9 @@ struct pbuf { /** For incoming packets, this contains the input netif's index */ u8_t if_idx; + + /** In case the user needs to store data custom data on a pbuf */ + LWIP_PBUF_CUSTOM_DATA };