Loading...
Searching...
No Matches
Contexts for 6LoWPAN address compression

Context buffer for stateful 6LoWPAN address compression. More...

Detailed Description

Context buffer for stateful 6LoWPAN address compression.

See also
RFC 6282, section 3.1.2
RFC 6775, section 4.2

Files

file  ctx.h
 Context buffer definitions.
 

Data Structures

struct  gnrc_sixlowpan_ctx_t
 Entry in the 6LoWPAN context buffer. More...
 

Macros

#define GNRC_SIXLOWPAN_CTX_SIZE   (16)
 maximum number of entries in context buffer
 

Functions

gnrc_sixlowpan_ctx_tgnrc_sixlowpan_ctx_lookup_addr (const ipv6_addr_t *addr)
 Gets a context matching the given IPv6 address best with its prefix.
 
gnrc_sixlowpan_ctx_tgnrc_sixlowpan_ctx_lookup_id (uint8_t id)
 Gets context by ID.
 
gnrc_sixlowpan_ctx_tgnrc_sixlowpan_ctx_update (uint8_t id, const ipv6_addr_t *prefix, uint8_t prefix_len, uint16_t ltime, bool comp)
 Updates (or adds if currently not registered) a context.
 
static void gnrc_sixlowpan_ctx_remove (uint8_t id)
 Removes context.
 
static bool gnrc_sixlowpan_ctx_match (const gnrc_sixlowpan_ctx_t *ctx, const ipv6_addr_t *prefix, uint8_t prefix_len)
 Check if a prefix matches a compression context.
 
static bool gnrc_sixlowpan_ctx_update_6ctx (const ipv6_addr_t *prefix, uint8_t prefix_len, uint32_t valid)
 Create or update a compression context.
 
void gnrc_sixlowpan_ctx_reset (void)
 Resets the whole context buffer.
 

Context flags.

Flags to set in gnrc_sixlowpan_ctx_t::flags_id.

#define GNRC_SIXLOWPAN_CTX_FLAGS_CID_MASK   (0x0f)
 mask for the Context ID.
 
#define GNRC_SIXLOWPAN_CTX_FLAGS_COMP   (0x10)
 Use context for compression.
 

Macro Definition Documentation

◆ GNRC_SIXLOWPAN_CTX_FLAGS_CID_MASK

#define GNRC_SIXLOWPAN_CTX_FLAGS_CID_MASK   (0x0f)

mask for the Context ID.

Definition at line 48 of file ctx.h.

◆ GNRC_SIXLOWPAN_CTX_FLAGS_COMP

#define GNRC_SIXLOWPAN_CTX_FLAGS_COMP   (0x10)

Use context for compression.

Definition at line 49 of file ctx.h.

◆ GNRC_SIXLOWPAN_CTX_SIZE

#define GNRC_SIXLOWPAN_CTX_SIZE   (16)

maximum number of entries in context buffer

Definition at line 41 of file ctx.h.

Function Documentation

◆ gnrc_sixlowpan_ctx_lookup_addr()

gnrc_sixlowpan_ctx_t * gnrc_sixlowpan_ctx_lookup_addr ( const ipv6_addr_t addr)

Gets a context matching the given IPv6 address best with its prefix.

Parameters
[in]addrAn IPv6 address.
Returns
The context associated with the best prefix for addr.
NULL if there is no such context.

◆ gnrc_sixlowpan_ctx_lookup_id()

gnrc_sixlowpan_ctx_t * gnrc_sixlowpan_ctx_lookup_id ( uint8_t  id)

Gets context by ID.

Parameters
[in]idA context ID.
Returns
The context associated with id.
NULL if there is no such context.

◆ gnrc_sixlowpan_ctx_match()

static bool gnrc_sixlowpan_ctx_match ( const gnrc_sixlowpan_ctx_t ctx,
const ipv6_addr_t prefix,
uint8_t  prefix_len 
)
inlinestatic

Check if a prefix matches a compression context.

Parameters
[in]ctxThe compression context
[in]prefixIPv6 prefix
[in]prefix_lenLength of the IPv6 prefix
Returns
true if the prefix matches the compression context.

Definition at line 139 of file ctx.h.

◆ gnrc_sixlowpan_ctx_remove()

static void gnrc_sixlowpan_ctx_remove ( uint8_t  id)
inlinestatic

Removes context.

Parameters
[in]idA context ID.

Definition at line 123 of file ctx.h.

◆ gnrc_sixlowpan_ctx_update()

gnrc_sixlowpan_ctx_t * gnrc_sixlowpan_ctx_update ( uint8_t  id,
const ipv6_addr_t prefix,
uint8_t  prefix_len,
uint16_t  ltime,
bool  comp 
)

Updates (or adds if currently not registered) a context.

Parameters
[in]idThe ID for the context. Must be < GNRC_SIXLOWPAN_CTX_SIZE.
[in]prefixThe prefix for the context.
[in]prefix_lenLength of prefix in bits. Must be > 0.
[in]ltimeNew lifetime of the context. comp will be implicitly set to false if ltime == 0.
[in]compUse for compression if true, do not use for compression, but still for decompression if false.
Returns
The new context on success.
NULL, on error or on removal.

◆ gnrc_sixlowpan_ctx_update_6ctx()

static bool gnrc_sixlowpan_ctx_update_6ctx ( const ipv6_addr_t prefix,
uint8_t  prefix_len,
uint32_t  valid 
)
inlinestatic

Create or update a compression context.

Parameters
[in]prefixIPv6 prefix of the compression context
[in]prefix_lenLength of the IPv6 prefix
[in]validLifetime of the prefix in seconds
Returns
true if a new compression context was created or an existing context was updated. false if no new context could be added

Definition at line 158 of file ctx.h.