Contexts for 6LoWPAN address compression

Context buffer for stateful 6LoWPAN address compression.

GNRC_SIXLOWPAN_CTX_FLAGS_CID_MASK

mask for the Context ID.

1
(0x0f)
GNRC_SIXLOWPAN_CTX_FLAGS_COMP

Use context for compression.

1
(0x10)
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

addr:An IPv6 address.

Return values

  • The context associated with the best prefix for addr.
  • NULL if there is no such context.
gnrc_sixlowpan_ctx_t * gnrc_sixlowpan_ctx_lookup_id(uint8_t id)

Gets context by ID.

Parameters

id:A context ID.

Return values

  • The context associated with id.
  • NULL if there is no such context.
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

id:The ID for the context. Must be < ctx.h::GNRC_SIXLOWPAN_CTX_SIZE.
prefix:The prefix for the context.
prefix_len:Length of prefix in bits. Must be > 0.
ltime:New lifetime of the context. comp will be implicitly set to false if ltime == 0.
comp:Use for compression if true, do not use for compression, but still for decompression if false.

Return values

  • The new context on success.
  • NULL, on error or on removal.
void gnrc_sixlowpan_ctx_reset(void)

Resets the whole context buffer.

GNRC_SIXLOWPAN_CTX_SIZE

maximum number of entries in context buffer

1
(16)
struct gnrc_sixlowpan_ctx_t

Entry in the 6LoWPAN context buffer.

ipv6_addr_t prefix

The prefix associated to this context.

uint8_t prefix_len

Length of ctx.h::gnrc_sixlowpan_ctx_t::prefix in bit.

uint8_t flags_id

4-bit flags, 4-bit Context ID.

Note

This needs to be here to easily translate prefixes to ID.

The flags are defined as above.

uint16_t ltime

Lifetime in minutes this context is valid.