A utility to parse TridentIot TLV data. More...
#include <stdint.h>#include <stddef.h>#include <stdbool.h>
Include dependency graph for tr_tlv_parser.h:Go to the source code of this file.
Functions | |
| bool | find_tlv_by_tag (const uint8_t *buffer, size_t buffer_len, uint8_t tag, uint8_t *out_value, uint8_t *out_value_len) |
| Search for a TLV entry by tag and validate its length. | |
| bool | update_tlv_tag (uint8_t *buffer, size_t buffer_size, uint8_t tag, const uint8_t *value, uint8_t length) |
| Update an existing TLV entry if found, or append a new one. Assumes unused buffer space is filled with 0xFF. | |
A utility to parse TridentIot TLV data.
SPDX-License-Identifier: LicenseRef-TridentMSLA SPDX-FileCopyrightText: 2025 Trident IoT, LLC https://www.tridentiot.com
| bool find_tlv_by_tag | ( | const uint8_t * | buffer, |
| size_t | buffer_len, | ||
| uint8_t | tag, | ||
| uint8_t * | out_value, | ||
| uint8_t * | out_value_len ) |
Search for a TLV entry by tag and validate its length.
If a matching tag is found and its value length is not zero, the value is copied into the provided output buffer.
| buffer | Pointer to the TLV data buffer. |
| buffer_len | Length of the TLV data buffer in bytes. |
| tag | Tag value to search for. |
| out_value | Pointer to a buffer where the value will be copied. |
| out_value_len | Pointer to variable holding the length of the copied data. |
| bool update_tlv_tag | ( | uint8_t * | buffer, |
| size_t | buffer_size, | ||
| uint8_t | tag, | ||
| const uint8_t * | value, | ||
| uint8_t | length ) |
Update an existing TLV entry if found, or append a new one. Assumes unused buffer space is filled with 0xFF.
| buffer | Pointer to the TLV buffer. |
| buffer_size | Total size of the buffer in bytes. |
| tag | Tag to search or insert. |
| value | Pointer to the value data to insert/update. |
| length | Length of the value in bytes. |