nRF5 IoT SDK  v0.9.0
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Context Manager

The Context Manager provides the functionality for maintaining and using context identifiers (see IETF RFC 6282). Context identifiers are used to compress IPv6 global addresses for effective transmission.

The Context Manager provides functions to maintain and to search and match context identifiers. It can be used both on 6LoWPAN and IPv6 stack layer.

To find context identifiers by a given prefix, or to find a prefix by a given context identifier, the Content Manager uses look-up tables. These tables are called context tables. The Context Manager can have up to IOT_CONTEXT_MANAGER_MAX_TABLES context tables, each of which holds a maximum of IOT_CONTEXT_MANAGER_MAX_CONTEXTS contexts. Preferably, there should be one context table for each interface.

Using the Context Manager is not mandatory, because it might cause problems with decompression and effective compression if the router implements a context option in the Router Advertisement Message.

6LoWPAN layer

In 6LoWPAN, the Context Manager performs on both transmit and receive paths.

RX Path

If the compression bit in the IPHC packet is set, the context identifier is read and matched to the table elements of the existing context. If a prefix is found for a given context identifier, it is used to construct the IPv6 address. 6LoWPAN uses iot_context_manager_get_by_cid to find a proper prefix if needed.

TX Path

If one or two of the addresses in the IPv6 header are global addresses, the Context Manager looks for matches between the given IPv6 prefix and the table elements of the context. 6LoWPAN uses iot_context_manager_get_by_addr to find a proper context identifier if needed.

IPv6 layer

The IPv6 layer is responsible for allocating and freeing the context table using iot_context_manager_table_alloc and iot_context_manager_table_free whenever an interface is added or removed.

The stack should also take the information from the 6LoWPAN context identifier in the Router Advertisement message and use iot_context_manager_update and iot_context_manager_remove to manage the entries of the context table.

Configuration parameters

The following configuration parameters should be defined in sdk_config.h.

IOT_CONTEXT_MANAGER_DISABLE_LOG

Disables debug tracing in the module. To enable tracing, this flag must be set to 0 and ENABLE_DEBUG_LOG_SUPPORT must be set to 1.

Description Value
Enable debug trace 0
Disable debug trace 1
Dependencies ENABLE_DEBUG_LOG_SUPPORT

IOT_CONTEXT_MANAGER_DISABLE_API_PARAM_CHECK

Disables API parameter checks in the module. Set this define to 1 to disable checks on API parameters in the module.

API parameter checks are added to ensure that the correct parameters are passed to the module. These checks are useful during development phase, but they might be redundant when the application is finalized. Disabling these checks might improve performance.

Description Value
Enable API parameters check 0
Disable API parameters check 1
Dependencies None

IOT_CONTEXT_MANAGER_MAX_CONTEXTS

Maximum number of supported context identifiers in each table.

Restriction Value
Minimum value 1
Maximum value 16
Recommended value 16
Dependencies None

IOT_CONTEXT_MANAGER_MAX_TABLES

Maximum number of supported context tables. Each interface requires a separate table.

Restriction Value
Minimum value 1
Maximum value BLE_IPSP_MAX_CHANNELS
Dependencies BLE_IPSP_MAX_CHANNELS