From a68b4c40c457d7124d8c4e5422ed6c8c1a01c2a6 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Sat, 6 Feb 2010 07:48:52 +0000 Subject: [PATCH] Added a function to clear only the header part of the packetbuf --- core/net/rime/packetbuf.c | 8 +++++++- core/net/rime/packetbuf.h | 15 ++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/core/net/rime/packetbuf.c b/core/net/rime/packetbuf.c index 2bcf78c37..429212a15 100644 --- a/core/net/rime/packetbuf.c +++ b/core/net/rime/packetbuf.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: packetbuf.c,v 1.4 2009/10/20 08:06:43 adamdunkels Exp $ + * $Id: packetbuf.c,v 1.5 2010/02/06 07:48:52 adamdunkels Exp $ */ /** @@ -120,6 +120,12 @@ packetbuf_clear(void) packetbuf_attr_clear(); } /*---------------------------------------------------------------------------*/ +void +packetbuf_clear_hdr(void) +{ + hdrptr = PACKETBUF_HDR_SIZE; +} +/*---------------------------------------------------------------------------*/ int packetbuf_copyfrom(const void *from, uint16_t len) { diff --git a/core/net/rime/packetbuf.h b/core/net/rime/packetbuf.h index f50cd07ab..a57bcef96 100644 --- a/core/net/rime/packetbuf.h +++ b/core/net/rime/packetbuf.h @@ -40,7 +40,7 @@ * * This file is part of the Contiki operating system. * - * $Id: packetbuf.h,v 1.4 2009/11/02 11:58:56 adamdunkels Exp $ + * $Id: packetbuf.h,v 1.5 2010/02/06 07:48:52 adamdunkels Exp $ */ /** @@ -85,6 +85,19 @@ */ void packetbuf_clear(void); +/** + * \brief Clear and reset the header of the packetbuf + * + * This function clears the header of the packetbuf and + * resets all the internal state pointers pertaining to + * the header (header size, header pointer, but not + * external data pointer). It is used before after sending + * a packet in the packetbuf, to be able to reuse the + * packet buffer for a later retransmission. + * + */ +void packetbuf_clear_hdr(void); + /** * \brief Get a pointer to the data in the packetbuf * \return Pointer to the packetbuf data