From 91d2c947b473b3540be5474c7128a5fa4ce60934 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sun, 20 Aug 2023 23:22:32 +0200 Subject: src: add alternative API to set up packet buffer pktb_setup_raw() is a new function to initialise a new struct pkt_buff. It takes the memory area to be used to store pkt_buff structure and the data. Data is attached to the packet buffer (not copied), ie. the packet buffer data points to the provided data pointer. pktb_head_size() is a new function to return the amount of memory to reserve for a new struct pkt_buff. Extend documentation pon pktb_alloc(). Mostly original patch from Duncan Roe . Signed-off-by: Pablo Neira Ayuso --- include/libnetfilter_queue/pktbuff.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/libnetfilter_queue') diff --git a/include/libnetfilter_queue/pktbuff.h b/include/libnetfilter_queue/pktbuff.h index 42bc153..a4cc2a1 100644 --- a/include/libnetfilter_queue/pktbuff.h +++ b/include/libnetfilter_queue/pktbuff.h @@ -6,6 +6,9 @@ struct pkt_buff; struct pkt_buff *pktb_alloc(int family, void *data, size_t len, size_t extra); void pktb_free(struct pkt_buff *pktb); +struct pkt_buff *pktb_setup_raw(void *pktb, int family, void *data, size_t len, size_t extra); +size_t pktb_head_size(void); + uint8_t *pktb_data(struct pkt_buff *pktb); uint32_t pktb_len(struct pkt_buff *pktb); -- cgit v1.2.3