From 4e3268e2e2a16a380b622d60838c910ed824e374 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Mon, 29 Mar 2010 21:53:04 +0000 Subject: [PATCH] Added function that removes the header --- core/net/rime/packetbuf.c | 17 +++++++++-------- core/net/rime/packetbuf.h | 4 +++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/core/net/rime/packetbuf.c b/core/net/rime/packetbuf.c index 19926b962..a47a09240 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.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); } } diff --git a/core/net/rime/packetbuf.h b/core/net/rime/packetbuf.h index d4780c260..3f7079552 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.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