prf::cbor namespace

Classes

class Value
Strongly typed scalar value used by CBOR map encoding and decoding.

Enums

enum class ValueType: uint8_t { Bool = 0, Int64 = 1, UInt64 = 2, Double = 3, String = 4, Bytes = 5 }
Supported scalar value categories for the embedded CBOR subset used by firmware.

Typedefs

using StringKeyValueMap = std::vector<std::pair<std::string, Value>>
String-keyed map used by persistent configuration sections.
using UnsignedKeyValueMap = std::vector<std::pair<uint64_t, Value>>
Unsigned-integer-keyed map used by compact management messages.

Functions

auto append_string_map_header(size_t entry_count, std::vector<uint8_t>* out_bytes) -> bool
Appends a finite string-keyed map header with the specified entry count.
auto append_text_string(const std::string_view value, std::vector<uint8_t>*const out_bytes) -> bool
Appends a CBOR text string value.
auto append_value(const Value& value, std::vector<uint8_t>*const out_bytes) -> bool
Appends a scalar value from the supported embedded CBOR subset.
auto decode_string_map(const std::vector<uint8_t>& bytes, StringKeyValueMap* out_entries) -> bool
Decodes a string-keyed CBOR map.
auto decode_unsigned_map(const std::vector<uint8_t>& bytes, UnsignedKeyValueMap* out_entries) -> bool
Decodes an unsigned-keyed CBOR map.
auto encode_string_map(const StringKeyValueMap& entries, std::vector<uint8_t>*const out_bytes) -> bool
Encodes a string-keyed CBOR map in entry order provided by caller.
auto encode_unsigned_map_canonical(const UnsignedKeyValueMap& entries, std::vector<uint8_t>* out_bytes) -> bool
Encodes an unsigned-keyed CBOR map in deterministic canonical order.

Enum documentation

enum class prf::cbor::ValueType: uint8_t

Supported scalar value categories for the embedded CBOR subset used by firmware.

Typedef documentation

using prf::cbor::StringKeyValueMap = std::vector<std::pair<std::string, Value>>

String-keyed map used by persistent configuration sections.

using prf::cbor::UnsignedKeyValueMap = std::vector<std::pair<uint64_t, Value>>

Unsigned-integer-keyed map used by compact management messages.

Function documentation

bool prf::cbor::append_string_map_header(size_t entry_count, std::vector<uint8_t>* out_bytes)

Appends a finite string-keyed map header with the specified entry count.

This helper is useful when callers need to build a CBOR map incrementally without first materializing a second temporary container with all entries.

bool prf::cbor::append_text_string(const std::string_view value, std::vector<uint8_t>*const out_bytes)

Appends a CBOR text string value.

bool prf::cbor::append_value(const Value& value, std::vector<uint8_t>*const out_bytes)

Appends a scalar value from the supported embedded CBOR subset.

bool prf::cbor::decode_string_map(const std::vector<uint8_t>& bytes, StringKeyValueMap* out_entries)

Decodes a string-keyed CBOR map.

Returns false when payload is not a valid finite map, when any key is not text, or when any value is outside the supported scalar subset.

bool prf::cbor::decode_unsigned_map(const std::vector<uint8_t>& bytes, UnsignedKeyValueMap* out_entries)

Decodes an unsigned-keyed CBOR map.

Returns false when payload is not a valid finite map, when any key is not unsigned integer, or when any value is outside the supported scalar subset.

bool prf::cbor::encode_string_map(const StringKeyValueMap& entries, std::vector<uint8_t>*const out_bytes)

Encodes a string-keyed CBOR map in entry order provided by caller.

bool prf::cbor::encode_unsigned_map_canonical(const UnsignedKeyValueMap& entries, std::vector<uint8_t>* out_bytes)

Encodes an unsigned-keyed CBOR map in deterministic canonical order.

Canonical order for unsigned integer keys is ascending numeric order.