corm_htok(3)corm

NAME

corm_htok - HTOK v4 Native Binary Envelope API

- Pack and unpack HTOK v4 binary containers directly in C.

SYNOPSIS

Functions

void corm_htok_set_tok_decoder (corm_htok_tok_decoder_fn fn)

Register an optional token decoder callback for HTOK token-packed fields.

int corm_htok_pack (const char *json_str, size_t json_len, uint8_t **out_bytes, size_t *out_len)

Pack a JSON string representation of a memory envelope into HTOK v4 binary bytes.

int corm_htok_unpack (const uint8_t *bytes, size_t len, char **out_json, size_t *out_json_len)

Unpack an HTOK v4 binary buffer into a clean JSON string representation.

Detailed Description

Pack and unpack HTOK v4 binary containers directly in C.

Function Documentation

int corm_htok_pack (const char * json_str, size_t json_len, uint8_t ** out_bytes, size_t * out_len)

Pack a JSON string representation of a memory envelope into HTOK v4 binary bytes.

Parameters

json_str Pointer to JSON string.
json_len Length of JSON string in bytes (or 0 for strlen).
out_bytes Output pointer receiving allocated binary buffer (caller frees with free()).
out_len Output pointer receiving size in bytes of binary buffer.

Returns

0 on success, negative error code on failure.

void corm_htok_set_tok_decoder (corm_htok_tok_decoder_fn fn)

Register an optional token decoder callback for HTOK token-packed fields. When set, corm_htok_unpack passes TYPE_TOKENS fields to this decoder to recover the original UTF-8 text instead of passing the raw packed bytes.

int corm_htok_unpack (const uint8_t * bytes, size_t len, char ** out_json, size_t * out_json_len)

Unpack an HTOK v4 binary buffer into a clean JSON string representation.

Parameters

bytes Pointer to binary HTOK v4 data.
len Size of binary data in bytes.
out_json Output pointer receiving allocated JSON string (caller frees with free()).
out_json_len Output pointer receiving length of JSON string.

Returns

0 on success, negative error code on failure.

Author

Generated automatically by Doxygen for corm from the source code.