nRF51 IoT SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Context Manager

Manages context identifiers and prefixes related to the identifiers. More...

Functions

uint32_t iot_context_manager_init (void)
 Function for initializing the module. More...
 
uint32_t iot_context_manager_table_alloc (const iot_interface_t *p_interface)
 Function for allocating the table for the specific interface. More...
 
uint32_t iot_context_manager_table_free (const iot_interface_t *p_interface)
 Function for freeing the table for the specific interface. More...
 
uint32_t iot_context_manager_update (const iot_interface_t *p_interface, iot_context_t *p_context)
 Function for updating the context table. More...
 
uint32_t iot_context_manager_remove (const iot_interface_t *p_interface, iot_context_t *p_context)
 Function for removing context from the context table. More...
 
uint32_t iot_context_manager_get_by_addr (const iot_interface_t *p_interface, const ipv6_addr_t *p_addr, iot_context_t **pp_context)
 Function for searching the proper entry in the context table by IPv6 address. More...
 
uint32_t iot_context_manager_get_by_cid (const iot_interface_t *p_interface, uint8_t context_id, iot_context_t **pp_context)
 Function for searching the proper entry in the context table by context identifier. More...
 

Detailed Description

Manages context identifiers and prefixes related to the identifiers.

This module allows to handle context information throughout the IoT application. The module is used in the compression and decompression procedures of IPv6 addresses. It allows more efficient communication between two nodes using global addresses. The Context Manager contains tables of context, which can be accessed through API functions. The table is mainatined by the IPv6 stack while is referenced by 6LoWPAN module to be able to compress and decompress paackets.

You can configure the module by changing the sdk_config.h configuration file.

Function Documentation

uint32_t iot_context_manager_get_by_addr ( const iot_interface_t p_interface,
const ipv6_addr_t p_addr,
iot_context_t **  pp_context 
)

Function for searching the proper entry in the context table by IPv6 address.

Parameters
[in]p_interfacePointer to the IoT interface.
[in]p_addrPointer to IPv6 address to be compared with records in the context table.
[out]pp_contextPointer to the context in the context table.
Return values
NRF_SUCCESSIf the procedure succeeded. Otherwise, an error code that indicates the reason for the failure is returned.
uint32_t iot_context_manager_get_by_cid ( const iot_interface_t p_interface,
uint8_t  context_id,
iot_context_t **  pp_context 
)

Function for searching the proper entry in the context table by context identifier.

Parameters
[in]p_interfacePointer to the IoT interface.
[in]context_idContext identifier to be compared with records in the context table.
[out]pp_contextPointer to the context in the context table.
Return values
NRF_SUCCESSIf the procedure succeeded. Otherwise, an error code that indicates the reason for the failure is returned.
uint32_t iot_context_manager_init ( void  )

Function for initializing the module.

Return values
NRF_SUCCESSIf the module was successfully initialized. Otherwise, an error code that indicates the reason for the failure is returned.
uint32_t iot_context_manager_remove ( const iot_interface_t p_interface,
iot_context_t p_context 
)

Function for removing context from the context table.

Parameters
[in]p_interfacePointer to the IoT interface.
[in]p_contextPointer to the context entry, retrieved from iot_context_manager_get_by_addr or iot_context_manager_get_by_cid.
Return values
NRF_SUCCESSIf the context was successfully removed. Otherwise, an error code that indicates the reason for the failure is returned.
uint32_t iot_context_manager_table_alloc ( const iot_interface_t p_interface)

Function for allocating the table for the specific interface.

Parameters
[in]p_interfacePointer to the IoT interface.
Return values
NRF_SUCCESSIf the table was successfully allocated. Otherwise, an error code that indicates the reason for the failure is returned.
uint32_t iot_context_manager_table_free ( const iot_interface_t p_interface)

Function for freeing the table for the specific interface.

Parameters
[in]p_interfacePointer to the IoT interface.
Return values
NRF_SUCCESSIf the table was successfully freed. Otherwise, an error code that indicates the reason for the failure is returned.
uint32_t iot_context_manager_update ( const iot_interface_t p_interface,
iot_context_t p_context 
)

Function for updating the context table.

Update requests are treated as follows:

  • If the context identifier already exists in the context table, the context is updated.
  • If the context identifier does not exist yet, a new entry is generated. If no memory is available, NRF_ERROR_NO_MEMORY is returned.

The compression flag indicates if a context can be used for compression. The context table can hold up to 16 context's information.

Parameters
[in]p_interfacePointer to the IoT interface.
[in]p_contextPointer to the context entry that shall be modified or added.
Return values
NRF_SUCCESSIf the table was successfully updated. Otherwise, an error code that indicates the reason for the failure is returned.