Added a function to clear only the header part of the packetbuf

This commit is contained in:
adamdunkels 2010-02-06 07:48:52 +00:00
parent e88d209214
commit a68b4c40c4
2 changed files with 21 additions and 2 deletions

View file

@ -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)
{

View file

@ -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