DTNMA Reference Tools v2.1.0 - 13.gc5c0bac
Delay-Tolerant Networking Management Architecture (DTNMA) Tool Suite
Loading...
Searching...
No Matches
cbor.h File Reference

This file contains definitions for ARI CBOR CODEC functions. More...

#include "base.h"
#include "containers.h"
#include "cace/cace_data.h"
#include <qcbor/qcbor_encode.h>
#include <qcbor/qcbor_decode.h>
#include <stdint.h>
#include <stdbool.h>
+ Include dependency graph for cbor.h:
+ This graph shows which files directly or indirectly include this file:

Functions

int cace_ari_cbor_encode (cace_data_t *buf, const cace_ari_t *ari)
 Encode an ARI to binary form.
 
int cace_ari_cbor_encode_stream (QCBOREncodeContext *encoder, const cace_ari_t *ari)
 Lower-level stream encoding interface.
 
int cace_ari_cbor_decode (cace_ari_t *ari, const cace_data_t *buf, size_t *used, char **errm)
 Decode an ARI from binary form.
 
int cace_ari_cbor_decode_stream (QCBORDecodeContext *decoder, cace_ari_t *ari)
 Lower-level stream decoding interface.
 

Detailed Description

This file contains definitions for ARI CBOR CODEC functions.

Function Documentation

◆ cace_ari_cbor_decode()

int cace_ari_cbor_decode ( cace_ari_t ari,
const cace_data_t buf,
size_t *  used,
char **  errm 
)

Decode an ARI from binary form.

Note
When used is non-null, extra data after the ARI is not considered to be a decoding failure and the caller is assumed to compare the used value against the buffer size itself.
Parameters
[out]ariThe ARI to decode into. The struct must already be initialized.
[in]bufThe buffer to decode from.
[out]usedIf non-null, the size of used data for this decoding is placed here. This is set even if decoding fails to allow skipping well-formed CBOR which is not a valid ARI.
[out]errmIf non-null, this will be set to a specific error message associated with any failure. When the return code is non-zero, if the pointed-to pointer is non-null it must be freed using CACE_FREE().
Returns
Zero upon success.

References cace_ari_cbor_decode_stream(), cace_ari_reset(), CHKERR1, errm, cace_data_t::len, and cace_data_t::ptr.

Referenced by agentParseHex(), cace_amp_msg_decode(), cace_amp_proxy_cli_recv(), cace_amp_proxy_msg_recv(), check_cnst(), check_convert(), check_decoding(), check_lookup(), check_match(), check_normalize(), LLVMFuzzerTestOneInput(), read_cbor(), read_cborhex(), stdin_recv(), suiteSetUp(), test_ari_cmp(), test_ari_equal(), test_ari_hash(), test_cace_ari_cbor_decode_invalid(), test_cace_ari_cbor_decode_partial(), TEST_CASE(), TEST_CASE(), test_util_ari_decode(), and transform_cbor_str_to_cace_data().

◆ cace_ari_cbor_decode_stream()

int cace_ari_cbor_decode_stream ( QCBORDecodeContext *  decoder,
cace_ari_t ari 
)

Lower-level stream decoding interface.

Parameters
[in]decoderThe existing decoder to write with.
[out]ariThe ARI to decode into. The struct must already be initialized.
Returns
Zero upon success.

References cace_ari_lit_t::ari_type, cace_ari_prim_val_u::as_ac, cace_ari_params_t::as_ac, cace_ari_prim_val_u::as_am, cace_ari_params_t::as_am, cace_ari_prim_val_u::as_execset, cace_ari_prim_val_u::as_rptset, cace_ari_prim_val_u::as_tbl, cace_ari_prim_val_u::as_timespec, cace_ari_cbor_decode_ac(), cace_ari_cbor_decode_am(), cace_ari_cbor_decode_execset(), cace_ari_cbor_decode_idseg(), cace_ari_cbor_decode_label(), cace_ari_cbor_decode_optdate(), cace_ari_cbor_decode_primval(), cace_ari_cbor_decode_rptset(), cace_ari_cbor_decode_tbl(), cace_ari_cbor_decode_timespec(), cace_ari_init_lit(), cace_ari_init_objref(), cace_ari_lit_init_container(), cace_ari_objpath_derive_type(), CACE_ARI_PARAMS_AC, CACE_ARI_PARAMS_AM, CACE_ARI_PARAMS_NONE, CACE_ARI_PRIM_TIMESPEC, cace_ari_reset(), CACE_ARI_TYPE_AC, CACE_ARI_TYPE_AM, CACE_ARI_TYPE_ARITYPE, CACE_ARI_TYPE_EXECSET, CACE_ARI_TYPE_LABEL, CACE_ARI_TYPE_RPTSET, CACE_ARI_TYPE_TBL, CACE_ARI_TYPE_TD, CACE_ARI_TYPE_TP, cace_ari_lit_t::has_ari_type, cace_ari_objpath_t::model_id, cace_ari_objpath_t::model_rev, cace_ari_objpath_t::obj_id, cace_ari_ref_t::objpath, cace_ari_objpath_t::org_id, cace_ari_ref_t::params, cace_ari_lit_t::prim_type, cace_ari_params_t::state, cace_ari_objpath_t::type_id, cace_ari_date_t::valid, and cace_ari_lit_t::value.

Referenced by cace_ari_cbor_decode(), cace_ari_cbor_decode_ac(), cace_ari_cbor_decode_am(), cace_ari_cbor_decode_execset(), cace_ari_cbor_decode_report(), cace_ari_cbor_decode_rptset(), and cace_ari_cbor_decode_tbl().

◆ cace_ari_cbor_encode()

int cace_ari_cbor_encode ( cace_data_t buf,
const cace_ari_t ari 
)

Encode an ARI to binary form.

Parameters
[out]bufThe data buffer to modify and write the result into. It will contain a well-formed CBOR item if successful.
[in]ariThe ARI to encode from.
Returns
Zero upon success.

References cace_ari_cbor_encode_stream(), cace_data_copy_from(), CACE_LOG_WARNING, CHKERR1, cace_data_t::len, and cace_data_t::ptr.

Referenced by agentShowHexReports(), cace_amp_msg_encode(), cace_amp_proxy_cli_send(), cace_amp_proxy_msg_send(), check_convert(), check_encoding(), LLVMFuzzerTestOneInput(), refdm_db_insert_execset(), refdm_db_insert_rptset(), stdout_send(), TEST_CASE(), test_util_ari_encode(), write_cbor(), and write_cborhex().

◆ cace_ari_cbor_encode_stream()

int cace_ari_cbor_encode_stream ( QCBOREncodeContext *  encoder,
const cace_ari_t ari 
)