Microchip® Advanced Software Framework

packetbuf.h File Reference

    Header file for the Rime buffer (packetbuf) management
Author
Adam Dunkels adam@.nosp@m.sics.nosp@m..se
#include "contiki-conf.h"
#include "net/linkaddr.h"

Data Structures

struct  packetbuf_addr
 
struct  packetbuf_attr
 
struct  packetbuf_attrlist
 

Macros

#define PACKETBUF_ADDR_FIRST   PACKETBUF_ADDR_SENDER
 
#define PACKETBUF_ADDRSIZE   (sizeof(linkaddr_t) * PACKETBUF_ATTR_BYTE)
 
#define PACKETBUF_ATTR_BIT   1
 
#define PACKETBUF_ATTR_BYTE   8
 
#define PACKETBUF_ATTR_LAST   { PACKETBUF_ATTR_NONE, 0 }
 
#define PACKETBUF_ATTR_PACKET_TYPE_ACK   1
 
#define PACKETBUF_ATTR_PACKET_TYPE_DATA   0
 
#define PACKETBUF_ATTR_PACKET_TYPE_STREAM   2
 
#define PACKETBUF_ATTR_PACKET_TYPE_STREAM_END   3
 
#define PACKETBUF_ATTR_PACKET_TYPE_TIMESTAMP   4
 
#define PACKETBUF_ATTRIBUTES(...)   { __VA_ARGS__ PACKETBUF_ATTR_LAST }
 
#define PACKETBUF_HDR_SIZE   48
 The size of the packetbuf header, in bytes. More...
 
#define PACKETBUF_IS_ADDR(type)   ((type) >= PACKETBUF_ADDR_FIRST)
 
#define PACKETBUF_NUM_ADDRS   4
 
#define PACKETBUF_NUM_ATTRS   (PACKETBUF_ATTR_MAX - PACKETBUF_NUM_ADDRS)
 
#define PACKETBUF_SIZE   128
 The size of the packetbuf, in bytes. More...
 

Typedefs

typedef uint16_t packetbuf_attr_t
 

Enumerations

enum  {
  PACKETBUF_ATTR_NONE,
  PACKETBUF_ATTR_CHANNEL,
  PACKETBUF_ATTR_NETWORK_ID,
  PACKETBUF_ATTR_LINK_QUALITY,
  PACKETBUF_ATTR_RSSI,
  PACKETBUF_ATTR_TIMESTAMP,
  PACKETBUF_ATTR_RADIO_TXPOWER,
  PACKETBUF_ATTR_LISTEN_TIME,
  PACKETBUF_ATTR_TRANSMIT_TIME,
  PACKETBUF_ATTR_MAC_TRANSMISSIONS,
  PACKETBUF_ATTR_MAX_MAC_TRANSMISSIONS,
  PACKETBUF_ATTR_MAC_SEQNO,
  PACKETBUF_ATTR_MAC_ACK,
  PACKETBUF_ATTR_MAC_PIGGYBACK_LEN,
  PACKETBUF_ATTR_MAC_FRAMETYPE,
  PACKETBUF_ATTR_NET_ID,
  PACKETBUF_ATTR_RELIABLE,
  PACKETBUF_ATTR_PACKET_ID,
  PACKETBUF_ATTR_PACKET_TYPE,
  PACKETBUF_ATTR_REXMIT,
  PACKETBUF_ATTR_MAX_REXMIT,
  PACKETBUF_ATTR_NUM_REXMIT,
  PACKETBUF_ATTR_PENDING,
  PACKETBUF_ATTR_HOPS,
  PACKETBUF_ATTR_TTL,
  PACKETBUF_ATTR_EPACKET_ID,
  PACKETBUF_ATTR_EPACKET_TYPE,
  PACKETBUF_ATTR_ERELIABLE,
  PACKETBUF_ADDR_SENDER,
  PACKETBUF_ADDR_RECEIVER,
  PACKETBUF_ADDR_ESENDER,
  PACKETBUF_ADDR_ERECEIVER,
  PACKETBUF_ATTR_MAX
}
 

Functions

const linkaddr_tpacketbuf_addr (uint8_t type)
 
packetbuf_attr_t packetbuf_attr (uint8_t type)
 
void packetbuf_attr_clear (void)
 
void packetbuf_attr_copyfrom (struct packetbuf_attr *attrs, struct packetbuf_addr *addrs)
 
void packetbuf_attr_copyto (struct packetbuf_attr *attrs, struct packetbuf_addr *addrs)
 
void packetbuf_clear (void)
 Clear and reset the packetbuf. More...
 
void packetbuf_clear_hdr (void)
 Clear and reset the header of the packetbuf. More...
 
void packetbuf_compact (void)
 Compact the packetbuf. More...
 
int packetbuf_copyfrom (const void *from, uint16_t len)
 Copy from external data into the packetbuf. More...
 
int packetbuf_copyto (void *to)
 Copy the entire packetbuf to an external buffer. More...
 
int packetbuf_copyto_hdr (uint8_t *to)
 Copy the header portion of the packetbuf to an external buffer. More...
 
uint16_t packetbuf_datalen (void)
 Get the length of the data in the packetbuf. More...
 
void * packetbuf_dataptr (void)
 Get a pointer to the data in the packetbuf. More...
 
void packetbuf_hdr_remove (int size)
 
int packetbuf_hdralloc (int size)
 Extend the header of the packetbuf, for outbound packets. More...
 
uint8_t packetbuf_hdrlen (void)
 Get the length of the header in the packetbuf, for outbound packets. More...
 
void * packetbuf_hdrptr (void)
 Get a pointer to the header in the packetbuf, for outbound packets. More...
 
int packetbuf_hdrreduce (int size)
 Reduce the header in the packetbuf, for incoming packets. More...
 
int packetbuf_is_reference (void)
 Check if the packetbuf references external data. More...
 
void packetbuf_reference (void *ptr, uint16_t len)
 Point the packetbuf to external data. More...
 
void * packetbuf_reference_ptr (void)
 Get a pointer to external data referenced by the packetbuf. More...
 
int packetbuf_set_addr (uint8_t type, const linkaddr_t *addr)
 
int packetbuf_set_attr (uint8_t type, const packetbuf_attr_t val)
 
void packetbuf_set_datalen (uint16_t len)
 Set the length of the data in the packetbuf. More...
 
uint16_t packetbuf_totlen (void)
 Get the total length of the header and data in the packetbuf. More...