Loading...
Searching...
No Matches
6LoWPAN

Provides 6LoWPAN dispatch types and helper functions. More...

Detailed Description

Provides 6LoWPAN dispatch types and helper functions.

Modules

 6LoWPAN Neighbor Discovery
 Message types and helper functions for Neighbor Discovery Optimization for 6LoWPAN (6LoWPAN-ND)
 
 6LoWPAN selective fragment recovery
 Provides dispatches for 6LoWPAN selective fragment recovery and helper functions.
 

Files

file  sixlowpan.h
 6LoWPAN dispatch type and helper function definitions.
 

Data Structures

struct  sixlowpan_frag_t
 General and 1st 6LoWPAN fragmentation header. More...
 
struct  sixlowpan_frag_n_t
 Subsequent 6LoWPAN fragmentation header. More...
 

Functions

void sixlowpan_print (uint8_t *data, size_t size)
 Prints 6LoWPAN dispatch to stdout.
 

6LoWPAN dispatch definition

See also
RFC 4944, section 5.1
static bool sixlowpan_nalp (uint8_t disp)
 Checks if dispatch indicates that frame is not a 6LoWPAN (NALP) frame.
 
#define SIXLOWPAN_UNCOMP   (0x41)
 uncompressed 6LoWPAN frame dispatch.
 
#define SIXLOWPAN_FRAG_DISP_MASK   (0xf8)
 mask for fragmentation dispatch
 
#define SIXLOWPAN_FRAG_1_DISP   (0xc0)
 dispatch for 1st fragment
 
#define SIXLOWPAN_FRAG_N_DISP   (0xe0)
 dispatch for subsequent fragments
 
#define SIXLOWPAN_FRAG_MAX_LEN   (2047)
 Maximum datagram size $ (2^{11} - 1) $.
 
#define SIXLOWPAN_IPHC1_DISP_MASK   (0xe0)
 Dispatch mask for LOWPAN_IPHC.
 
#define SIXLOWPAN_IPHC1_DISP   (0x60)
 Dispatch for LOWPAN_IPHC.
 
#define SIXLOWPAN_SFR_DISP_MASK   (0xfe)
 Dispatch mask for 6LoWPAN selective fragment recovery.
 
#define SIXLOWPAN_SFR_RFRAG_DISP   (0xe8)
 Dispatch for 6LoWPAN recoverable fragment.
 
#define SIXLOWPAN_SFR_ACK_DISP   (0xea)
 Dispatch for 6LoWPAN recoverable fragment acknowledgment.
 

6LoWPAN fragmentation header definitions

static bool sixlowpan_frag_1_is (sixlowpan_frag_t *hdr)
 Checks if a given header is a 1st 6LoWPAN fragment header.
 
static bool sixlowpan_frag_n_is (sixlowpan_frag_t *hdr)
 Checks if a given header is a subsequent 6LoWPAN fragment header.
 
static bool sixlowpan_frag_is (sixlowpan_frag_t *hdr)
 Checks if a given header is a 6LoWPAN fragment header.
 
static uint16_t sixlowpan_frag_datagram_size (sixlowpan_frag_t *hdr)
 Get datagram size from general 6LoWPAN fragment header.
 
static uint16_t sixlowpan_frag_datagram_tag (sixlowpan_frag_t *hdr)
 Get datagram tag from general 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_SIZE_MASK   (0x07ff)
 mask for datagram size
 

6LoWPAN IPHC dispatch definitions

static bool sixlowpan_iphc_is (uint8_t *data)
 Checks if datagram is an IPHC datagram.
 
#define SIXLOWPAN_IPHC1_TF   (0x18)
 Flag for Traffic Class & Flow Label elision (part of first byte of LOWPAN_IPHC).
 
#define SIXLOWPAN_IPHC1_NH   (0x04)
 Flag for Next Header Compression (part of first byte of LOWPAN_IPHC).
 
#define SIXLOWPAN_IPHC1_HL   (0x03)
 Flag for Hop Limit elision (part of first byte of LOWPAN_IPHC).
 
#define SIXLOWPAN_IPHC2_CID_EXT   (0x80)
 Flag for Context Identifier Extension (part of second byte of LOWPAN_IPHC).
 
#define SIXLOWPAN_IPHC2_SAC   (0x40)
 Flag for Source Address Compression (part of second byte of LOWPAN_IPHC).
 
#define SIXLOWPAN_IPHC2_SAM   (0x30)
 Bits for Source Address Mode (part of second byte of LOWPAN_IPHC).
 
#define SIXLOWPAN_IPHC2_DAC   (0x04)
 Flag for Destination Address Compression (part of second byte of LOWPAN_IPHC).
 
#define SIXLOWPAN_IPHC2_DAM   (0x03)
 Bits for Destination Address Mode (part of second byte of LOWPAN_IPHC).
 
#define SIXLOWPAN_IPHC2_M   (0x08)
 Flag for Multicast Compression (part of second byte of LOWPAN_IPHC).
 
#define SIXLOWPAN_IPHC_HDR_LEN   (2)
 6LoWPAN IPHC header length
 
#define SIXLOWPAN_IPHC_CID_EXT_LEN   (1)
 6LoWPAN context identifier extension header length
 

Macro Definition Documentation

◆ SIXLOWPAN_FRAG_1_DISP

#define SIXLOWPAN_FRAG_1_DISP   (0xc0)

dispatch for 1st fragment

Definition at line 43 of file sixlowpan.h.

◆ SIXLOWPAN_FRAG_DISP_MASK

#define SIXLOWPAN_FRAG_DISP_MASK   (0xf8)

mask for fragmentation dispatch

Definition at line 42 of file sixlowpan.h.

◆ SIXLOWPAN_FRAG_MAX_LEN

#define SIXLOWPAN_FRAG_MAX_LEN   (2047)

Maximum datagram size $ (2^{11} - 1) $.

Definition at line 46 of file sixlowpan.h.

◆ SIXLOWPAN_FRAG_N_DISP

#define SIXLOWPAN_FRAG_N_DISP   (0xe0)

dispatch for subsequent fragments

Definition at line 45 of file sixlowpan.h.

◆ SIXLOWPAN_FRAG_SIZE_MASK

#define SIXLOWPAN_FRAG_SIZE_MASK   (0x07ff)

mask for datagram size

Definition at line 100 of file sixlowpan.h.

◆ SIXLOWPAN_IPHC1_DISP

#define SIXLOWPAN_IPHC1_DISP   (0x60)

Dispatch for LOWPAN_IPHC.

See also
RFC 6282, section 3.1

Definition at line 62 of file sixlowpan.h.

◆ SIXLOWPAN_IPHC1_DISP_MASK

#define SIXLOWPAN_IPHC1_DISP_MASK   (0xe0)

Dispatch mask for LOWPAN_IPHC.

See also
RFC 6282, section 3.1

Definition at line 54 of file sixlowpan.h.

◆ SIXLOWPAN_IPHC1_HL

#define SIXLOWPAN_IPHC1_HL   (0x03)

Flag for Hop Limit elision (part of first byte of LOWPAN_IPHC).

See also
RFC 6282, section 3.1.1

Definition at line 254 of file sixlowpan.h.

◆ SIXLOWPAN_IPHC1_NH

#define SIXLOWPAN_IPHC1_NH   (0x04)

Flag for Next Header Compression (part of first byte of LOWPAN_IPHC).

See also
RFC 6282, section 3.1.1

Definition at line 246 of file sixlowpan.h.

◆ SIXLOWPAN_IPHC1_TF

#define SIXLOWPAN_IPHC1_TF   (0x18)

Flag for Traffic Class & Flow Label elision (part of first byte of LOWPAN_IPHC).

See also
RFC 6282, section 3.1.1

Definition at line 237 of file sixlowpan.h.

◆ SIXLOWPAN_IPHC2_CID_EXT

#define SIXLOWPAN_IPHC2_CID_EXT   (0x80)

Flag for Context Identifier Extension (part of second byte of LOWPAN_IPHC).

See also
RFC 6282, section 3.1.1

Definition at line 263 of file sixlowpan.h.

◆ SIXLOWPAN_IPHC2_DAC

#define SIXLOWPAN_IPHC2_DAC   (0x04)

Flag for Destination Address Compression (part of second byte of LOWPAN_IPHC).

See also
RFC 6282, section 3.1.1

Definition at line 290 of file sixlowpan.h.

◆ SIXLOWPAN_IPHC2_DAM

#define SIXLOWPAN_IPHC2_DAM   (0x03)

Bits for Destination Address Mode (part of second byte of LOWPAN_IPHC).

See also
RFC 6282, section 3.1.1

Definition at line 299 of file sixlowpan.h.

◆ SIXLOWPAN_IPHC2_M

#define SIXLOWPAN_IPHC2_M   (0x08)

Flag for Multicast Compression (part of second byte of LOWPAN_IPHC).

See also
RFC 6282, section 3.1.1

Definition at line 308 of file sixlowpan.h.

◆ SIXLOWPAN_IPHC2_SAC

#define SIXLOWPAN_IPHC2_SAC   (0x40)

Flag for Source Address Compression (part of second byte of LOWPAN_IPHC).

See also
RFC 6282, section 3.1.1

Definition at line 272 of file sixlowpan.h.

◆ SIXLOWPAN_IPHC2_SAM

#define SIXLOWPAN_IPHC2_SAM   (0x30)

Bits for Source Address Mode (part of second byte of LOWPAN_IPHC).

See also
RFC 6282, section 3.1.1

Definition at line 281 of file sixlowpan.h.

◆ SIXLOWPAN_IPHC_CID_EXT_LEN

#define SIXLOWPAN_IPHC_CID_EXT_LEN   (1)

6LoWPAN context identifier extension header length

Definition at line 318 of file sixlowpan.h.

◆ SIXLOWPAN_IPHC_HDR_LEN

#define SIXLOWPAN_IPHC_HDR_LEN   (2)

6LoWPAN IPHC header length

Definition at line 313 of file sixlowpan.h.

◆ SIXLOWPAN_SFR_ACK_DISP

#define SIXLOWPAN_SFR_ACK_DISP   (0xea)

Dispatch for 6LoWPAN recoverable fragment acknowledgment.

See also
RFC 8931, section 5.2

Definition at line 80 of file sixlowpan.h.

◆ SIXLOWPAN_SFR_DISP_MASK

#define SIXLOWPAN_SFR_DISP_MASK   (0xfe)

Dispatch mask for 6LoWPAN selective fragment recovery.

See also
RFC 8931, section 5

Definition at line 68 of file sixlowpan.h.

◆ SIXLOWPAN_SFR_RFRAG_DISP

#define SIXLOWPAN_SFR_RFRAG_DISP   (0xe8)

Dispatch for 6LoWPAN recoverable fragment.

See also
RFC 8931, section 5.1

Definition at line 74 of file sixlowpan.h.

◆ SIXLOWPAN_UNCOMP

#define SIXLOWPAN_UNCOMP   (0x41)

uncompressed 6LoWPAN frame dispatch.

Definition at line 40 of file sixlowpan.h.

Function Documentation

◆ sixlowpan_frag_1_is()

static bool sixlowpan_frag_1_is ( sixlowpan_frag_t hdr)
inlinestatic

Checks if a given header is a 1st 6LoWPAN fragment header.

Parameters
[in]hdrA 6LoWPAN fragmentation header.
Returns
true, if given fragment is a 1st 6LoWPAN fragment.
false, if given fragment is not a 1st 6LoWPAN fragment.

Definition at line 153 of file sixlowpan.h.

◆ sixlowpan_frag_datagram_size()

static uint16_t sixlowpan_frag_datagram_size ( sixlowpan_frag_t hdr)
inlinestatic

Get datagram size from general 6LoWPAN fragment header.

Parameters
[in]hdrA general 6LoWPAN fragment header.
Returns
The datagram size for the 6LoWPAN fragment.

Definition at line 191 of file sixlowpan.h.

◆ sixlowpan_frag_datagram_tag()

static uint16_t sixlowpan_frag_datagram_tag ( sixlowpan_frag_t hdr)
inlinestatic

Get datagram tag from general 6LoWPAN fragment header.

Parameters
[in]hdrA general 6LoWPAN fragment header.
Returns
The datagram tag for the 6LoWPAN fragment.

Definition at line 203 of file sixlowpan.h.

◆ sixlowpan_frag_is()

static bool sixlowpan_frag_is ( sixlowpan_frag_t hdr)
inlinestatic

Checks if a given header is a 6LoWPAN fragment header.

Parameters
[in]hdrA 6LoWPAN fragmentation header.
Returns
true, if given fragment is a 6LoWPAN fragment.
false, if given fragment is not a 6LoWPAN fragment.

Definition at line 179 of file sixlowpan.h.

◆ sixlowpan_frag_n_is()

static bool sixlowpan_frag_n_is ( sixlowpan_frag_t hdr)
inlinestatic

Checks if a given header is a subsequent 6LoWPAN fragment header.

Parameters
[in]hdrA 6LoWPAN fragmentation header.
Returns
true, if given fragment is a subsequent 6LoWPAN fragment.
false, if given fragment is not a subsequent 6LoWPAN fragment.

Definition at line 166 of file sixlowpan.h.

◆ sixlowpan_frag_offset()

static uint16_t sixlowpan_frag_offset ( sixlowpan_frag_n_t hdr)
inlinestatic

Get fragment offset from a subsequent 6LoWPAN fragment header.

Parameters
[in]hdrA subsequent 6LoWPAN fragment header.
Returns
The offset of the 6LoWPAN fragment.

Definition at line 215 of file sixlowpan.h.

◆ sixlowpan_iphc_is()

static bool sixlowpan_iphc_is ( uint8_t *  data)
inlinestatic

Checks if datagram is an IPHC datagram.

Parameters
[in]dataData of a datagram. Must not be NULL.
Returns
true, if datagram is an IPHC datagram.
false, if datagram is not an IPHC datagram.

Definition at line 328 of file sixlowpan.h.

◆ sixlowpan_nalp()

static bool sixlowpan_nalp ( uint8_t  disp)
inlinestatic

Checks if dispatch indicates that frame is not a 6LoWPAN (NALP) frame.

Parameters
[in]dispThe first byte of a frame.
Returns
true, if frame is a NALP.
false, if frame is not a NALP.

Definition at line 90 of file sixlowpan.h.

◆ sixlowpan_print()

void sixlowpan_print ( uint8_t *  data,
size_t  size 
)

Prints 6LoWPAN dispatch to stdout.

Parameters
[in]dataA 6LoWPAN frame.
[in]sizeSize of data.