Added function that removes the header
This commit is contained in:
parent
4c3b69dc07
commit
4e3268e2e2
2 changed files with 12 additions and 9 deletions
|
@ -33,7 +33,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* 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());
|
packetbuf_datalen());
|
||||||
} else if (bufptr > 0) {
|
} else if (bufptr > 0) {
|
||||||
len = packetbuf_datalen() + PACKETBUF_HDR_SIZE;
|
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];
|
packetbuf[i] = packetbuf[bufptr + i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,13 +176,19 @@ packetbuf_hdralloc(int size)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
packetbuf_hdr_remove(int size)
|
||||||
|
{
|
||||||
|
hdrptr += size;
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
int
|
int
|
||||||
packetbuf_hdrreduce(int size)
|
packetbuf_hdrreduce(int size)
|
||||||
{
|
{
|
||||||
if(buflen < size) {
|
if(buflen < size) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bufptr += size;
|
bufptr += size;
|
||||||
buflen -= size;
|
buflen -= size;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -245,19 +251,14 @@ packetbuf_totlen(void)
|
||||||
return packetbuf_hdrlen() + packetbuf_datalen();
|
return packetbuf_hdrlen() + packetbuf_datalen();
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
packetbuf_attr_clear(void)
|
packetbuf_attr_clear(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < PACKETBUF_NUM_ATTRS; ++i) {
|
for(i = 0; i < PACKETBUF_NUM_ATTRS; ++i) {
|
||||||
/* packetbuf_attrs[i].type = PACKETBUF_ATTR_NONE; */
|
|
||||||
packetbuf_attrs[i].val = 0;
|
packetbuf_attrs[i].val = 0;
|
||||||
}
|
}
|
||||||
for(i = 0; i < PACKETBUF_NUM_ADDRS; ++i) {
|
for(i = 0; i < PACKETBUF_NUM_ADDRS; ++i) {
|
||||||
/* packetbuf_addrs[i].type = PACKETBUF_ATTR_NONE; */
|
|
||||||
rimeaddr_copy(&packetbuf_addrs[i].addr, &rimeaddr_null);
|
rimeaddr_copy(&packetbuf_addrs[i].addr, &rimeaddr_null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* 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_clear_hdr(void);
|
||||||
|
|
||||||
|
void packetbuf_hdr_remove(int bytes);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Get a pointer to the data in the packetbuf
|
* \brief Get a pointer to the data in the packetbuf
|
||||||
* \return Pointer to the packetbuf data
|
* \return Pointer to the packetbuf data
|
||||||
|
|
Loading…
Reference in a new issue