Added function that removes the header

This commit is contained in:
adamdunkels 2010-03-29 21:53:04 +00:00
parent 4c3b69dc07
commit 4e3268e2e2
2 changed files with 12 additions and 9 deletions

View file

@ -33,7 +33,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: packetbuf.c,v 1.6 2010/02/28 20:20:19 adamdunkels Exp $
* $Id: packetbuf.c,v 1.7 2010/03/29 21:53:04 adamdunkels Exp $
*/
/**
@ -112,7 +112,7 @@ packetbuf_compact(void)
packetbuf_datalen());
} else if (bufptr > 0) {
len = packetbuf_datalen() + PACKETBUF_HDR_SIZE;
for (i = PACKETBUF_HDR_SIZE; i < len; i++) {
for(i = PACKETBUF_HDR_SIZE; i < len; i++) {
packetbuf[i] = packetbuf[bufptr + i];
}
@ -176,13 +176,19 @@ packetbuf_hdralloc(int size)
return 0;
}
/*---------------------------------------------------------------------------*/
void
packetbuf_hdr_remove(int size)
{
hdrptr += size;
}
/*---------------------------------------------------------------------------*/
int
packetbuf_hdrreduce(int size)
{
if(buflen < size) {
return 0;
}
bufptr += size;
buflen -= size;
return 1;
@ -245,19 +251,14 @@ packetbuf_totlen(void)
return packetbuf_hdrlen() + packetbuf_datalen();
}
/*---------------------------------------------------------------------------*/
void
packetbuf_attr_clear(void)
{
int i;
for(i = 0; i < PACKETBUF_NUM_ATTRS; ++i) {
/* packetbuf_attrs[i].type = PACKETBUF_ATTR_NONE; */
packetbuf_attrs[i].val = 0;
}
for(i = 0; i < PACKETBUF_NUM_ADDRS; ++i) {
/* packetbuf_addrs[i].type = PACKETBUF_ATTR_NONE; */
rimeaddr_copy(&packetbuf_addrs[i].addr, &rimeaddr_null);
}
}

View file

@ -40,7 +40,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: packetbuf.h,v 1.7 2010/03/26 12:29:29 nifi Exp $
* $Id: packetbuf.h,v 1.8 2010/03/29 21:53:04 adamdunkels Exp $
*/
/**
@ -98,6 +98,8 @@ void packetbuf_clear(void);
*/
void packetbuf_clear_hdr(void);
void packetbuf_hdr_remove(int bytes);
/**
* \brief Get a pointer to the data in the packetbuf
* \return Pointer to the packetbuf data