20#ifndef NET_SIXLOWPAN_H
21#define NET_SIXLOWPAN_H
40#define SIXLOWPAN_UNCOMP (0x41)
41#define SIXLOWPAN_FRAG_DISP_MASK (0xf8)
43#define SIXLOWPAN_FRAG_1_DISP (0xc0)
44#define SIXLOWPAN_FRAG_N_DISP (0xe0)
46#define SIXLOWPAN_FRAG_MAX_LEN (2047)
54#define SIXLOWPAN_IPHC1_DISP_MASK (0xe0)
62#define SIXLOWPAN_IPHC1_DISP (0x60)
68#define SIXLOWPAN_SFR_DISP_MASK (0xfe)
74#define SIXLOWPAN_SFR_RFRAG_DISP (0xe8)
80#define SIXLOWPAN_SFR_ACK_DISP (0xea)
92 return ((disp & 0xc0) == 0);
100#define SIXLOWPAN_FRAG_SIZE_MASK (0x07ff)
113typedef struct __attribute__((packed)) {
133typedef struct __attribute__((packed)) {
222 return (hdr->
offset * 8U);
237#define SIXLOWPAN_IPHC1_TF (0x18)
246#define SIXLOWPAN_IPHC1_NH (0x04)
254#define SIXLOWPAN_IPHC1_HL (0x03)
263#define SIXLOWPAN_IPHC2_CID_EXT (0x80)
272#define SIXLOWPAN_IPHC2_SAC (0x40)
281#define SIXLOWPAN_IPHC2_SAM (0x30)
290#define SIXLOWPAN_IPHC2_DAC (0x04)
299#define SIXLOWPAN_IPHC2_DAM (0x03)
308#define SIXLOWPAN_IPHC2_M (0x08)
313#define SIXLOWPAN_IPHC_HDR_LEN (2)
318#define SIXLOWPAN_IPHC_CID_EXT_LEN (1)
Functions to work with different byte orders.
static uint16_t byteorder_ntohs(network_uint16_t v)
Convert from network byte order to host byte order, 16 bit.
static bool sixlowpan_frag_n_is(sixlowpan_frag_t *hdr)
Checks if a given header is a subsequent 6LoWPAN fragment header.
#define SIXLOWPAN_IPHC1_DISP_MASK
Dispatch mask for LOWPAN_IPHC.
#define SIXLOWPAN_FRAG_DISP_MASK
mask for fragmentation dispatch
#define SIXLOWPAN_IPHC1_DISP
Dispatch for LOWPAN_IPHC.
static bool sixlowpan_frag_1_is(sixlowpan_frag_t *hdr)
Checks if a given header is a 1st 6LoWPAN fragment header.
static bool sixlowpan_iphc_is(uint8_t *data)
Checks if datagram is an IPHC datagram.
void sixlowpan_print(uint8_t *data, size_t size)
Prints 6LoWPAN dispatch to stdout.
#define SIXLOWPAN_FRAG_SIZE_MASK
mask for datagram size
static bool sixlowpan_frag_is(sixlowpan_frag_t *hdr)
Checks if a given header is a 6LoWPAN fragment header.
static uint16_t sixlowpan_frag_offset(sixlowpan_frag_n_t *hdr)
Get fragment offset from a subsequent 6LoWPAN fragment header.
#define SIXLOWPAN_FRAG_1_DISP
dispatch for 1st fragment
static uint16_t sixlowpan_frag_datagram_tag(sixlowpan_frag_t *hdr)
Get datagram tag from general 6LoWPAN fragment header.
static uint16_t sixlowpan_frag_datagram_size(sixlowpan_frag_t *hdr)
Get datagram size from general 6LoWPAN fragment header.
#define SIXLOWPAN_FRAG_N_DISP
dispatch for subsequent fragments
static bool sixlowpan_nalp(uint8_t disp)
Checks if dispatch indicates that frame is not a 6LoWPAN (NALP) frame.
Subsequent 6LoWPAN fragmentation header.
network_uint16_t disp_size
Dispatch and datagram size.
network_uint16_t tag
datagram tag
General and 1st 6LoWPAN fragmentation header.
network_uint16_t disp_size
Dispatch and datagram size.
network_uint16_t tag
datagram tag
A 16 bit integer in big endian aka network byte order.
uint8_t u8[2]
8 bit representation