Go to the documentation of this file.
22 #ifndef NET_SIXLOWPAN_SFR_H
23 #define NET_SIXLOWPAN_SFR_H
46 #define SIXLOWPAN_SFR_GEN_DISP_MASK (0xfc)
47 #define SIXLOWPAN_SFR_GEN_DISP (0xe8)
48 #define SIXLOWPAN_SFR_ECN (0x01U)
49 #define SIXLOWPAN_SFR_ACK_REQ (0x80U)
50 #define SIXLOWPAN_SFR_SEQ_MASK (0x7cU)
51 #define SIXLOWPAN_SFR_SEQ_POS (2U)
52 #define SIXLOWPAN_SFR_SEQ_MAX (0x1fU)
53 #define SIXLOWPAN_SFR_FRAG_SIZE_MASK (0x03ffU)
54 #define SIXLOWPAN_SFR_FRAG_SIZE_MAX (0x03ffU)
55 #define SIXLOWPAN_SFR_ACK_BITMAP_SIZE (32U)
63 typedef struct __attribute__((packed)) {
98 typedef struct __attribute__((packed)) {
143 typedef struct __attribute__((packed)) {
static void sixlowpan_sfr_ack_set_disp(sixlowpan_sfr_t *hdr)
Initialize 6LoWPAN RFRAG acknowledgment dispatch.
static uint16_t sixlowpan_sfr_rfrag_get_offset(const sixlowpan_sfr_rfrag_t *hdr)
Get fragment offset from a 6LoWPAN recoverable fragment header.
static bool sixlowpan_sfr_ecn(const sixlowpan_sfr_t *hdr)
Check if the ECN flag in a 6LoWPAN recoverable fragment header is set.
static uint16_t sixlowpan_sfr_rfrag_get_frag_size(const sixlowpan_sfr_rfrag_t *hdr)
Get fragment size from a 6LoWPAN recoverable fragment header.
static bool sixlowpan_sfr_rfrag_is(const sixlowpan_sfr_t *hdr)
Check if given header is a 6LoWPAN recoverable fragment header.
static bool sixlowpan_sfr_is(sixlowpan_sfr_t *hdr)
Check if given header is a 6LoWPAN selective fragment recovery header (either RFRAG or RFRAG ACK)
sixlowpan_sfr_t base
generic part
bitfields operations on bitfields of arbitrary length
6LoWPAN dispatch type and helper function definitions.
Functions to work with different byte orders.
A 16 bit integer in big endian aka network byte order.
#define assert(cond)
abort the program if assertion is false
static void sixlowpan_sfr_clear_ecn(sixlowpan_sfr_t *hdr)
Clear the ECN flag in a 6LoWPAN recoverable fragment header.
uint8_t u8[2]
8 bit representation
POSIX.1-2008 compliant version of the assert macro.
static void sixlowpan_sfr_rfrag_set_seq(sixlowpan_sfr_rfrag_t *hdr, uint8_t seq)
Set sequence number in a 6LoWPAN recoverable fragment header.
static void sixlowpan_sfr_rfrag_set_disp(sixlowpan_sfr_t *hdr)
Initialize 6LoWPAN recoverable fragment dispatch.
Generic type for selective fragment recovery headers.
#define SIXLOWPAN_SFR_ACK_DISP
Dispatch for 6LoWPAN recoverable fragment acknowledgment.
static void sixlowpan_sfr_rfrag_set_offset(sixlowpan_sfr_rfrag_t *hdr, uint16_t offset)
Set fragment offset in a 6LoWPAN recoverable fragment header.
static bool sixlowpan_sfr_ack_is(const sixlowpan_sfr_t *hdr)
Check if given header is a 6LoWPAN RFRAG acknowledgment header.
Recoverable fragment (RFRAG) acknowledgment header.
static void sixlowpan_sfr_rfrag_set_frag_size(sixlowpan_sfr_rfrag_t *hdr, uint16_t frag_size)
Set fragment size in a 6LoWPAN recoverable fragment header.
static void sixlowpan_sfr_rfrag_set_ack_req(sixlowpan_sfr_rfrag_t *hdr)
Set the Acknowledgment request flag in a 6LoWPAN recoverable fragment header.
#define SIXLOWPAN_SFR_ACK_REQ
Acknowledgment request flag (for 8 MSB)
network_uint16_t ar_seq_fs
Acknowledgment request flag, sequence number, and fragment size.
#define SIXLOWPAN_SFR_DISP_MASK
Dispatch mask for 6LoWPAN selective fragment recovery.
#define SIXLOWPAN_SFR_ECN
explicit congestion notification flag
#define SIXLOWPAN_SFR_ACK_BITMAP_SIZE
Acknowledgment bitmap size in bits.
#define SIXLOWPAN_SFR_FRAG_SIZE_MASK
Fragment size mask.
uint8_t disp_ecn
Dispatch and explicit congestion notification (ECN) flag.
static network_uint16_t byteorder_htons(uint16_t v)
Convert from host byte order to network byte order, 16 bit.
Recoverable fragment header.
#define SIXLOWPAN_SFR_SEQ_POS
Sequence number position (for 8 MSB)
network_uint16_t offset
Fragment offset.
#define SIXLOWPAN_SFR_FRAG_SIZE_MAX
Maximum value for fragment size.
static void sixlowpan_sfr_set_ecn(sixlowpan_sfr_t *hdr)
Set the ECN flag in a 6LoWPAN selective fragment recovery header.
static uint16_t htons(uint16_t v)
Convert from host byte order to network byte order, 16 bit.
static uint16_t byteorder_ntohs(network_uint16_t v)
Convert from network byte order to host byte order, 16 bit.
uint16_t u16
16 bit representation
static uint8_t sixlowpan_sfr_rfrag_get_seq(const sixlowpan_sfr_rfrag_t *hdr)
Get sequence number from a 6LoWPAN recoverable fragment header.
#define SIXLOWPAN_SFR_SEQ_MAX
Maximum value for sequence number.
#define SIXLOWPAN_SFR_SEQ_MASK
Sequence number mask (for 8 MSB)
sixlowpan_sfr_t base
generic part
static void sixlowpan_sfr_rfrag_clear_ack_req(sixlowpan_sfr_rfrag_t *hdr)
Clear the Acknowledgment request flag in a 6LoWPAN recoverable fragment header.
#define BITFIELD(NAME, SIZE)
Declare a bitfield of a given size.
static bool sixlowpan_sfr_rfrag_ack_req(sixlowpan_sfr_rfrag_t *hdr)
Check if the Acknowledgment request flag in a 6LoWPAN recoverable fragment header is set.
#define SIXLOWPAN_SFR_GEN_DISP
generic dispatch for both SFR headers
#define SIXLOWPAN_SFR_GEN_DISP_MASK
Mask for generic dispatch of both selective fragment recovery headers.
#define SIXLOWPAN_SFR_RFRAG_DISP
Dispatch for 6LoWPAN recoverable fragment.