packetbuf: Made packetbuf_hdrlen applicable to inbound packets, too

This commit is contained in:
kkrentz 2014-03-16 08:53:34 -07:00
parent 7943751b16
commit a5a9b42457
2 changed files with 11 additions and 2 deletions

View File

@ -244,7 +244,16 @@ packetbuf_datalen(void)
uint8_t
packetbuf_hdrlen(void)
{
return PACKETBUF_HDR_SIZE - hdrptr;
uint8_t hdrlen;
hdrlen = PACKETBUF_HDR_SIZE - hdrptr;
if(hdrlen) {
/* outbound packet */
return hdrlen;
} else {
/* inbound packet */
return bufptr;
}
}
/*---------------------------------------------------------------------------*/
uint16_t

View File

@ -132,7 +132,7 @@ void *packetbuf_dataptr(void);
void *packetbuf_hdrptr(void);
/**
* \brief Get the length of the header in the packetbuf, for outbound packets
* \brief Get the length of the header in the packetbuf
* \return Length of the header in the packetbuf
*
* For outbound packets, the packetbuf consists of two