ON Semiconductor / mbed-os

Dependents:   mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510

Embed: (wiki syntax)

« Back to documentation index

thread_meshcop_lib.h File Reference

thread_meshcop_lib.h File Reference

Public API to handle the Thread management framework message parsing and building. More...

Go to the source code of this file.

Functions

uint8_t * thread_meshcop_tlv_data_write (uint8_t *ptr, const uint8_t type, const uint16_t length, const uint8_t *data)
 Write array TLV.
uint8_t * thread_meshcop_tlv_data_write_header (uint8_t *ptr, uint8_t type, uint16_t length)
 Write header.
uint8_t * thread_meshcop_tlv_data_write_uint8 (uint8_t *ptr, const uint8_t type, const uint8_t data)
 Write 1 byte length TLV.
uint8_t * thread_meshcop_tlv_data_write_uint16 (uint8_t *ptr, const uint8_t type, const uint16_t data)
 Write 2 byte length TLV.
uint8_t * thread_meshcop_tlv_data_write_uint32 (uint8_t *ptr, const uint8_t type, const uint32_t data)
 Write 4 byte length TLV.
uint8_t * thread_meshcop_tlv_data_write_uint64 (uint8_t *ptr, const uint8_t type, const uint64_t data)
 Write 8 byte length TLV.
bool thread_meshcop_tlv_exist (const uint8_t *ptr, const uint16_t length, const uint8_t type)
 Check if TLV exists in the message.
uint16_t thread_meshcop_tlv_find (const uint8_t *ptr, const uint16_t length, const uint8_t type, uint8_t **result_ptr)
 Find TLV from message.
uint8_t thread_meshcop_tlv_data_get_uint8 (const uint8_t *ptr, const uint16_t length, const uint8_t type, uint8_t *data_ptr)
 Read 1 byte length TLV.
uint8_t thread_meshcop_tlv_data_get_uint16 (const uint8_t *ptr, const uint16_t length, const uint8_t type, uint16_t *data_ptr)
 Read 2 byte length TLV.
uint8_t thread_meshcop_tlv_data_get_uint32 (const uint8_t *ptr, const uint16_t length, const uint8_t type, uint32_t *data_ptr)
 Read 4 byte length TLV.
uint8_t thread_meshcop_tlv_data_get_uint64 (const uint8_t *ptr, const uint16_t length, const uint8_t type, uint64_t *data_ptr)
 Read 8 byte length TLV.

Detailed Description

Public API to handle the Thread management framework message parsing and building.

Definition in file thread_meshcop_lib.h.


Function Documentation

uint8_t thread_meshcop_tlv_data_get_uint16 ( const uint8_t *  ptr,
const uint16_t  length,
const uint8_t  type,
uint16_t *  data_ptr 
)

Read 2 byte length TLV.

Parameters:
ptrpointer TLV message array.
lengthlength of TLV message array.
typeType of TLV.
data_ptrpointer to variable where the value is read.
Returns:
pointer length of TLV 2 if success. 0 means TLV not found or does not have any data.
Any other value indicates that TLV is not as expected.
uint8_t thread_meshcop_tlv_data_get_uint32 ( const uint8_t *  ptr,
const uint16_t  length,
const uint8_t  type,
uint32_t *  data_ptr 
)

Read 4 byte length TLV.

Parameters:
ptrpointer TLV message array.
lengthlength of TLV message array.
typeType of TLV.
data_ptrpointer to variable where the value is read.
Returns:
pointer length of TLV 4 if success. 0 means TLV not found or does not have any data.
Any other value indicates that TLV is not as expected.
uint8_t thread_meshcop_tlv_data_get_uint64 ( const uint8_t *  ptr,
const uint16_t  length,
const uint8_t  type,
uint64_t *  data_ptr 
)

Read 8 byte length TLV.

Parameters:
ptrpointer TLV message array.
lengthlength of TLV message array.
typeType of TLV.
data_ptrpointer to variable where the value is read.
Returns:
pointer length of TLV 4 if success. 0 means TLV not found or does not have any data.
Any other value indicates that TLV is not as expected.
uint8_t thread_meshcop_tlv_data_get_uint8 ( const uint8_t *  ptr,
const uint16_t  length,
const uint8_t  type,
uint8_t *  data_ptr 
)

Read 1 byte length TLV.

Parameters:
ptrpointer TLV message array.
lengthlength of TLV message array.
typeType of TLV.
data_ptrpointer to variable where the value is read.
Returns:
pointer length of TLV 1 if success. 0 means TLV not found or does not have any data.
Any other value indicates that TLV is not as expected.
uint8_t* thread_meshcop_tlv_data_write ( uint8_t *  ptr,
const uint8_t  type,
const uint16_t  length,
const uint8_t *  data 
)

Write array TLV.

Parameters:
ptrpointer for array where to write the TLV.
typeType of TLV.
lengthlength of the data that is written in TLV.
dataarray for TLV value.
Returns:
pointer value for writing the next TLV.
uint8_t* thread_meshcop_tlv_data_write_header ( uint8_t *  ptr,
uint8_t  type,
uint16_t  length 
)

Write header.

Parameters:
ptrpointer for array where to write the TLV.
typeType of TLV.
lengthlength of the data that is written in TLV.
Returns:
pointer value for writing the remaining bytes of network data.
uint8_t* thread_meshcop_tlv_data_write_uint16 ( uint8_t *  ptr,
const uint8_t  type,
const uint16_t  data 
)

Write 2 byte length TLV.

Parameters:
ptrpointer for array where to write the TLV.
typeType of TLV.
datavalue.
Returns:
pointer value for writing the next TLV.
uint8_t* thread_meshcop_tlv_data_write_uint32 ( uint8_t *  ptr,
const uint8_t  type,
const uint32_t  data 
)

Write 4 byte length TLV.

Parameters:
ptrpointer for array where to write the TLV.
typeType of TLV.
datavalue.
Returns:
pointer value for writing the next TLV.
uint8_t* thread_meshcop_tlv_data_write_uint64 ( uint8_t *  ptr,
const uint8_t  type,
const uint64_t  data 
)

Write 8 byte length TLV.

Parameters:
ptrpointer for array where to write the TLV.
typeType of TLV.
datavalue.
Returns:
pointer value for writing the next TLV.
uint8_t* thread_meshcop_tlv_data_write_uint8 ( uint8_t *  ptr,
const uint8_t  type,
const uint8_t  data 
)

Write 1 byte length TLV.

Parameters:
ptrpointer for array where to write the TLV.
typeType of TLV.
datavalue.
Returns:
pointer value for writing the next TLV.
bool thread_meshcop_tlv_exist ( const uint8_t *  ptr,
const uint16_t  length,
const uint8_t  type 
)

Check if TLV exists in the message.

Parameters:
ptrMessage buffer.
lengthLength of the message buffer to validate message.
typeType of TLV searched.
Returns:
true if TLV is found.
false if TLV does not exist.
uint16_t thread_meshcop_tlv_find ( const uint8_t *  ptr,
const uint16_t  length,
const uint8_t  type,
uint8_t **  result_ptr 
)

Find TLV from message.

Parameters:
ptrMessage buffer.
lengthLength of the message buffer to validate message.
typeType of TLV searched.
result_ptrPointer value is given as result if length is positive. Can be NULL which only searches for the length.
Returns:
The length of the TLV data found
0 if TLV is empty or no TLV found.
negative value indicates corrupted message.