diff --git a/sys/include/net/ng_pktbuf.h b/sys/include/net/ng_pktbuf.h index 8b965b8d2b2f74b19cdc59395c69bc133e5a7a0a..90fe1946c14cf06e652f2e001edd35de3ba55455 100644 --- a/sys/include/net/ng_pktbuf.h +++ b/sys/include/net/ng_pktbuf.h @@ -36,6 +36,7 @@ #include "cpu-conf.h" #include "net/ng_pkt.h" #include "net/ng_nettype.h" +#include "utlist.h" #ifdef __cplusplus extern "C" { @@ -166,6 +167,19 @@ void ng_pktbuf_release(ng_pktsnip_t *pkt); */ ng_pktsnip_t *ng_pktbuf_start_write(ng_pktsnip_t *pkt); +/** + * @brief Deletes a snip from a packet and the packet buffer. + * + * @param[in] pkt A packet. + * @param[in] snip A snip in the packet. + */ +static inline void ng_pktbuf_remove_snip(ng_pktsnip_t *pkt, ng_pktsnip_t *snip) +{ + LL_DELETE(pkt, snip); + snip->next = NULL; + ng_pktbuf_release(snip); +} + #ifdef DEVELHELP /** * @brief Prints some statistics about the packet buffer to stdout.