mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-21 19:29:18 +00:00
Merge pull request #1997 from yatch/pr/packetbuf-remaininglen
Introduce packetbuf_remaininglen()
This commit is contained in:
commit
9befc02331
@ -184,6 +184,12 @@ packetbuf_totlen(void)
|
||||
return packetbuf_hdrlen() + packetbuf_datalen();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
uint16_t
|
||||
packetbuf_remaininglen(void)
|
||||
{
|
||||
return PACKETBUF_SIZE - packetbuf_totlen();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
packetbuf_attr_clear(void)
|
||||
{
|
||||
@ -196,7 +202,7 @@ packetbuf_attr_clear(void)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
packetbuf_attr_copyto(struct packetbuf_attr *attrs,
|
||||
struct packetbuf_addr *addrs)
|
||||
struct packetbuf_addr *addrs)
|
||||
{
|
||||
memcpy(attrs, packetbuf_attrs, sizeof(packetbuf_attrs));
|
||||
memcpy(addrs, packetbuf_addrs, sizeof(packetbuf_addrs));
|
||||
@ -204,7 +210,7 @@ packetbuf_attr_copyto(struct packetbuf_attr *attrs,
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
packetbuf_attr_copyfrom(struct packetbuf_attr *attrs,
|
||||
struct packetbuf_addr *addrs)
|
||||
struct packetbuf_addr *addrs)
|
||||
{
|
||||
memcpy(packetbuf_attrs, attrs, sizeof(packetbuf_attrs));
|
||||
memcpy(packetbuf_addrs, addrs, sizeof(packetbuf_addrs));
|
||||
|
@ -123,6 +123,13 @@ uint16_t packetbuf_datalen(void);
|
||||
*/
|
||||
uint16_t packetbuf_totlen(void);
|
||||
|
||||
/**
|
||||
* \brief Get the total length of the remaining space in the packetbuf
|
||||
* \return Length of the remaining space in the packetbuf
|
||||
*
|
||||
*/
|
||||
uint16_t packetbuf_remaininglen(void);
|
||||
|
||||
/**
|
||||
* \brief Set the length of the data in the packetbuf
|
||||
* \param len The length of the data
|
||||
@ -343,9 +350,9 @@ int packetbuf_holds_broadcast(void);
|
||||
void packetbuf_attr_clear(void);
|
||||
|
||||
void packetbuf_attr_copyto(struct packetbuf_attr *attrs,
|
||||
struct packetbuf_addr *addrs);
|
||||
struct packetbuf_addr *addrs);
|
||||
void packetbuf_attr_copyfrom(struct packetbuf_attr *attrs,
|
||||
struct packetbuf_addr *addrs);
|
||||
struct packetbuf_addr *addrs);
|
||||
|
||||
#define PACKETBUF_ATTRIBUTES(...) { __VA_ARGS__ PACKETBUF_ATTR_LAST }
|
||||
#define PACKETBUF_ATTR_LAST { PACKETBUF_ATTR_NONE, 0 }
|
||||
|
Loading…
Reference in New Issue
Block a user