6LoWPAN reassembly buffer More...

Detailed Description

6LoWPAN reassembly buffer

Files

file  rb.h
 Reassembly buffer definitions.
 

Data Structures

struct  gnrc_sixlowpan_frag_rb_int
 Fragment intervals to identify limits of fragments and duplicates. More...
 
struct  gnrc_sixlowpan_frag_rb_base_t
 Base class for both reassembly buffer and virtual reassembly buffer. More...
 
struct  gnrc_sixlowpan_frag_rb_t
 An entry in the 6LoWPAN reassembly buffer. More...
 

Macros

#define GNRC_SIXLOWPAN_FRAG_RB_GC_MSG   (0x0226)
 Message type for triggering garbage collection reassembly buffer.
 

Typedefs

typedef struct gnrc_sixlowpan_frag_rb_int gnrc_sixlowpan_frag_rb_int_t
 Fragment intervals to identify limits of fragments and duplicates. More...
 

Functions

gnrc_sixlowpan_frag_rb_tgnrc_sixlowpan_frag_rb_add (gnrc_netif_hdr_t *netif_hdr, gnrc_pktsnip_t *frag, size_t offset, unsigned page)
 Adds a new fragment to the reassembly buffer. More...
 
bool gnrc_sixlowpan_frag_rb_exists (const gnrc_netif_hdr_t *netif_hdr, uint16_t tag)
 Checks if a reassembly buffer entry with a given link-layer address pair and tag exists. More...
 
void gnrc_sixlowpan_frag_rb_rm_by_datagram (const gnrc_netif_hdr_t *netif_hdr, uint16_t tag)
 Removes a reassembly buffer entry with a given link-layer address pair and tag. More...
 
static bool gnrc_sixlowpan_frag_rb_entry_empty (const gnrc_sixlowpan_frag_rb_t *rbuf)
 Checks if a reassembly buffer entry is unset. More...
 
void gnrc_sixlowpan_frag_rb_reset (void)
 Resets the packet buffer to a clean state. More...
 
const gnrc_sixlowpan_frag_rb_tgnrc_sixlowpan_frag_rb_array (void)
 Returns a pointer to the array representing the reassembly buffer. More...
 
void gnrc_sixlowpan_frag_rb_base_rm (gnrc_sixlowpan_frag_rb_base_t *entry)
 Remove base entry. More...
 
void gnrc_sixlowpan_frag_rb_gc (void)
 Garbage collect reassembly buffer.
 
int gnrc_sixlowpan_frag_rb_dispatch_when_complete (gnrc_sixlowpan_frag_rb_t *rbuf, gnrc_netif_hdr_t *netif)
 Checks if a reassembly buffer entry is complete and dispatches it to the next layer if that is the case. More...
 
static void gnrc_sixlowpan_frag_rb_remove (gnrc_sixlowpan_frag_rb_t *rbuf)
 Unsets a reassembly buffer entry (but does not free rbuf_t::super::pkt) More...
 

Typedef Documentation

◆ gnrc_sixlowpan_frag_rb_int_t

Fragment intervals to identify limits of fragments and duplicates.

Note
Fragments MUST NOT overlap and overlapping fragments are to be discarded
See also
RFC 4944, section 5.3

Function Documentation

◆ gnrc_sixlowpan_frag_rb_add()

gnrc_sixlowpan_frag_rb_t* gnrc_sixlowpan_frag_rb_add ( gnrc_netif_hdr_t netif_hdr,
gnrc_pktsnip_t frag,
size_t  offset,
unsigned  page 
)

Adds a new fragment to the reassembly buffer.

If the packet is complete, dispatch the packet with the transmit information of the last fragment.

Parameters
[in]netif_hdrThe interface header of the fragment, with gnrc_netif_hdr_t::if_pid and its source and destination address set.
[in]fragThe fragment to add. Will be released by the function.
[in]offsetThe fragment's offset.
[in]pageCurrent 6Lo dispatch parsing page.
Returns
The reassembly buffer entry the fragment was added to on success.
NULL on error.

◆ gnrc_sixlowpan_frag_rb_array()

const gnrc_sixlowpan_frag_rb_t* gnrc_sixlowpan_frag_rb_array ( void  )

Returns a pointer to the array representing the reassembly buffer.

Note
Only available when TEST_SUITES is defined
Returns
The first element of the reassembly buffer. const, so that write access is immediately spotted at compile time of tests. The const qualifier may however be discarded if required by the tests.

◆ gnrc_sixlowpan_frag_rb_base_rm()

void gnrc_sixlowpan_frag_rb_base_rm ( gnrc_sixlowpan_frag_rb_base_t entry)

Remove base entry.

Parameters
[in,out]entryEntry to remove

◆ gnrc_sixlowpan_frag_rb_dispatch_when_complete()

int gnrc_sixlowpan_frag_rb_dispatch_when_complete ( gnrc_sixlowpan_frag_rb_t rbuf,
gnrc_netif_hdr_t netif 
)

Checks if a reassembly buffer entry is complete and dispatches it to the next layer if that is the case.

Precondition
rbuf != NULL
netif != NULL
Parameters
[in]rbufA reassembly buffer entry. Must not be NULL.
[in]netifOriginal gnrc_netif_hdr_t of the last received frame. Used to construct the gnrc_netif_hdr_t of the completed datagram. Must not be NULL.
Returns
>0, when the datagram in rbuf was complete and dispatched.
0, when the datagram in rbuf is not complete.
-1, if the the reassembled datagram was not dispatched. rbuf is destroyed either way.

◆ gnrc_sixlowpan_frag_rb_entry_empty()

static bool gnrc_sixlowpan_frag_rb_entry_empty ( const gnrc_sixlowpan_frag_rb_t rbuf)
inlinestatic

Checks if a reassembly buffer entry is unset.

Parameters
[in]rbufA reassembly buffer entry
Returns
true, if rbuf is empty (i.e. rbuf->super.pkt is NULL).
false, if rbuf is in use.

Definition at line 168 of file rb.h.

◆ gnrc_sixlowpan_frag_rb_exists()

bool gnrc_sixlowpan_frag_rb_exists ( const gnrc_netif_hdr_t netif_hdr,
uint16_t  tag 
)

Checks if a reassembly buffer entry with a given link-layer address pair and tag exists.

Precondition
netif_hdr != NULL
Parameters
[in]netif_hdrAn interface header to provide the (source, destination) link-layer address pair. Must not be NULL.
[in]tagTag to search for.
Note
datagram_size is not a search parameter as the primary use case for this function is Selective Fragment Recovery where this information only exists in the first fragment.
Returns
true, if an entry with the given tuple exist.
false, if no entry with the given tuple exist.

◆ gnrc_sixlowpan_frag_rb_remove()

static void gnrc_sixlowpan_frag_rb_remove ( gnrc_sixlowpan_frag_rb_t rbuf)
inlinestatic

Unsets a reassembly buffer entry (but does not free rbuf_t::super::pkt)

Precondition
rbuf != NULL

This functions sets rbuf_t::super::pkt to NULL and removes all rbuf::ints.

Note
Does nothing if module gnrc_sixlowpan_frag_rb is not included.
Parameters
[in]rbufA reassembly buffer entry. Must not be NULL.

Definition at line 238 of file rb.h.

◆ gnrc_sixlowpan_frag_rb_reset()

void gnrc_sixlowpan_frag_rb_reset ( void  )

Resets the packet buffer to a clean state.

Note
Only available when TEST_SUITES is defined

◆ gnrc_sixlowpan_frag_rb_rm_by_datagram()

void gnrc_sixlowpan_frag_rb_rm_by_datagram ( const gnrc_netif_hdr_t netif_hdr,
uint16_t  tag 
)

Removes a reassembly buffer entry with a given link-layer address pair and tag.

Precondition
netif_hdr != NULL
Parameters
[in]netif_hdrAn interface header to provide the (source, destination) link-layer address pair. Must not be NULL.
[in]tagTag to search for.
Note
datagram_size is not a search parameter as the primary use case for this function is Selective Fragment Recovery where this information only exists in the first fragment.