NAH 1.0.6
Native Application Host - Library API Reference
Loading...
Searching...
No Matches
manifest_tlv.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <optional>
5#include <string>
6#include <vector>
7
8namespace nah {
9
10struct TLVEntry {
12 std::string value;
13};
14
16 bool ok;
17 std::string error;
18 std::vector<TLVEntry> entries;
19 std::vector<std::string> warnings;
20};
21
22// Decode TLV payload with ordering and size limits per SPEC; CRC is expected to be verified separately.
23// If expected_total_size is provided and does not match the payload size, entries are discarded and
24// invalid_manifest is reported via warnings.
25ManifestDecodeResult decode_manifest_tlv(const std::vector<uint8_t>& data,
26 std::optional<size_t> expected_total_size = std::nullopt);
27
28// Validate ASSET_EXPORT entry of form id:relative_path[:type], returns parsed components or std::nullopt on invalid.
30 std::string id;
31 std::string path;
32 std::string type; // may be empty
33};
34std::optional<AssetExportParts> parse_asset_export(const std::string& value);
35
36} // namespace nah
Result type for fallible operations.
Definition nahhost.hpp:109
std::optional< AssetExportParts > parse_asset_export(const std::string &value)
ManifestDecodeResult decode_manifest_tlv(const std::vector< uint8_t > &data, std::optional< size_t > expected_total_size=std::nullopt)
std::vector< std::string > warnings
std::vector< TLVEntry > entries
std::string value