DTNMA Reference Tools v2.0.0 - 9.gaff6489
Delay-Tolerant Networking Management Architecture (DTNMA) Tool Suite
|
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>
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. | |
This file contains definitions for ARI CBOR CODEC functions.
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.
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.[out] | ari | The ARI to decode into. The struct must already be initialized. |
[in] | buf | The buffer to decode from. |
[out] | used | If 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] | errm | If 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(). |
References cace_ari_cbor_decode_stream(), cace_ari_reset(), CHKERR1, errm, cace_data_t::len, and cace_data_t::ptr.
Referenced by cace_amp_msg_decode(), cace_amp_proxy_cli_recv(), cace_amp_proxy_msg_recv(), and transform_cbor_str_to_cace_data().
int cace_ari_cbor_decode_stream | ( | QCBORDecodeContext * | decoder, |
cace_ari_t * | ari | ||
) |
Lower-level stream decoding interface.
[in] | decoder | The existing decoder to write with. |
[out] | ari | The ARI to decode into. The struct must already be initialized. |
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_init_lit(), cace_ari_init_objref(), cace_ari_lit_init_container(), cace_ari_objpath_derive_type(), CACE_ARI_PRIM_TIMESPEC, cace_ari_reset(), 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().
int cace_ari_cbor_encode | ( | cace_data_t * | buf, |
const cace_ari_t * | ari | ||
) |
Encode an ARI to binary form.
[out] | buf | The data buffer to modify and write the result into. It will contain a well-formed CBOR item if successful. |
[in] | ari | The ARI to encode from. |
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 cace_amp_msg_encode(), cace_amp_proxy_cli_send(), cace_amp_proxy_msg_send(), and refdm_db_insert_rptset().
int cace_ari_cbor_encode_stream | ( | QCBOREncodeContext * | encoder, |
const cace_ari_t * | ari | ||
) |
Lower-level stream encoding interface.
[in] | encoder | The existing encoder to write with. |
[in] | ari | The ARI to encode from. |
References cace_ari_lit_t::ari_type, cace_ari_objpath_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_t::as_lit, cace_ari_t::as_ref, cace_ari_prim_val_u::as_rptset, cace_ari_prim_val_u::as_tbl, CHKERR1, cace_ari_lit_t::has_ari_type, cace_ari_objpath_t::has_ari_type, cace_ari_t::is_ref, 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_params_t::state, cace_ari_objpath_t::type_id, and cace_ari_lit_t::value.
Referenced by cace_ari_cbor_encode().