nx_cbor_decode.nx
buildroot/runtime/nx_cbor_decode.nx
about
nx_cbor_decode.nx -- RFC 8949 decoder, inverse of nx_cbor.nx.
Closes the storage roundtrip: spans encoded via nx_cbor_emit_span
land in nx_log_chunked, then come back through this decoder when
nx_trace_query (or any downstream consumer) walks the log.
Same major-type subset as the encoder:
0 unsigned integer
1 negative integer
4 array
5 map
Decoder is push-style: caller passes (buf, pos), each read returns
(value, new_pos). No malloc, no internal state. Out-of-bounds
reads are NOT bounds-checked here -- caller is responsible for
staying within the chunk_pos limit recorded in the manifest.
genealogy_id: rfc_8949_section_3
lineage_id: substrate_native_cbor_decoder_v1
dependencies 3 imports · 2 importers
imports: nx_syscalls.nxnx_tier.nxnx_cbor.nx
imported by: nx_cbor_decode_test.nxnx_trace_query.nx
structs
| none |
consts
| 36 | const NX_CBOR_DK_UINT: nx_int = 0 |
| 37 | const NX_CBOR_DK_NINT: nx_int = 1 |
| 38 | const NX_CBOR_DK_ARRAY: nx_int = 2 |
| 39 | const NX_CBOR_DK_MAP: nx_int = 3 |
| 40 | const NX_CBOR_DK_OTHER: nx_int = 4 // major 2/3/6/7 -- not yet supported |
| 41 | const NX_CBOR_DK_N_KINDS: nx_int = 5 |
functions
| 43 | func nx_cbor_dk_is_valid(k: nx_int) -> nx_int called by 1: main |
| 53 | func nx_cbor_peek_kind(buf: *u8, pos: nx_int) -> nx_int |
| 74 | func nx_cbor_read_length(buf: *u8, pos: nx_int, new_pos: *i64) -> nx_int |
| 117 | func nx_cbor_read_i64(buf: *u8, pos: nx_int, new_pos: *i64) -> nx_int |
| 130 | func nx_cbor_read_array_header(buf: *u8, pos: nx_int, new_pos: *i64) -> nx_int |
| 134 | func nx_cbor_read_map_header(buf: *u8, pos: nx_int, new_pos: *i64) -> nx_int |
| 148 | func nx_cbor_read_span(buf: *u8, pos: nx_int, new_pos: *i64, |