openaliro
Aliro reader: UWB/CCC core and ESP32-S3/C5/C6 port
Loading...
Searching...
No Matches
tlv.c File Reference

BER-TLV parser and encoder for Aliro protocol: parse TLVs with definite length and advance offset, compute encoded sizes, and write new TLVs. More...

#include "tlv.h"
#include <string.h>
#include <limits.h>
Include dependency graph for tlv.c:

Functions

static size_t tag_size (uint32_t tag)
 Compute the BER-TLV tag byte count for a given tag value: 1 byte for 0x00–0xff, 2 for 0x0100–0xffff, 3 for 0x010000–0xffffff, or 0 if tag is unsupported.
 
static size_t length_size (size_t length)
 Compute the BER-TLV length field byte count for a given value length: 1 byte for 0x00–0x7f, 2 for 0x80–0xff, 3 for 0x0100–0xffff, or 0 if length is unsupported.
 

Detailed Description

BER-TLV parser and encoder for Aliro protocol: parse TLVs with definite length and advance offset, compute encoded sizes, and write new TLVs.