DTNMA Reference Tools v2.0.0 - 7.g88e232c
Delay-Tolerant Networking Management Architecture (DTNMA) Tool Suite
|
This file contains the definitions, prototypes, constants, and other information necessary for the identification and processing of AMM Resource Identifiers (ARIs). More...
#include "cbor.h"
#include "access.h"
#include "text_util.h"
#include "cace/util/defs.h"
#include "cace/util/logging.h"
#include <qcbor/qcbor_spiffy_decode.h>
#include "text.h"
Functions | |
int | cace_ari_cbor_encode (cace_data_t *buf, const cace_ari_t *ari) |
Encode an ARI to binary form. | |
static int | cace_ari_cbor_encode_idseg (QCBOREncodeContext *enc, const cace_ari_idseg_t *obj) |
static int | cace_ari_cbor_decode_idseg (QCBORDecodeContext *dec, cace_ari_idseg_t *obj) |
static int | cace_ari_cbor_encode_optdate (QCBOREncodeContext *enc, const cace_ari_date_t *obj) |
static int | cace_ari_cbor_decode_optdate (QCBORDecodeContext *dec, cace_ari_date_t *obj) |
static int | cace_ari_cbor_encode_timespec (QCBOREncodeContext *enc, const struct timespec *ts) |
static int | cace_ari_cbor_decode_timespec (QCBORDecodeContext *dec, struct timespec *ts) |
static int | cace_ari_cbor_encode_ac (QCBOREncodeContext *enc, const cace_ari_ac_t *obj) |
static int | cace_ari_cbor_decode_ac (QCBORDecodeContext *dec, cace_ari_ac_t *obj) |
static int | cace_ari_cbor_encode_am (QCBOREncodeContext *enc, const cace_ari_am_t *obj) |
static int | cace_ari_cbor_decode_am (QCBORDecodeContext *dec, cace_ari_am_t *obj) |
static int | cace_ari_cbor_encode_tbl (QCBOREncodeContext *enc, const cace_ari_tbl_t *obj) |
static int | cace_ari_cbor_decode_tbl (QCBORDecodeContext *dec, cace_ari_tbl_t *obj) |
static int | cace_ari_cbor_encode_execset (QCBOREncodeContext *enc, const cace_ari_execset_t *obj) |
static int | cace_ari_cbor_decode_execset (QCBORDecodeContext *dec, cace_ari_execset_t *obj) |
static int | cace_ari_cbor_encode_report (QCBOREncodeContext *enc, const cace_ari_report_t *obj) |
static int | cace_ari_cbor_decode_report (QCBORDecodeContext *dec, cace_ari_report_t *obj) |
static int | cace_ari_cbor_encode_rptset (QCBOREncodeContext *enc, const cace_ari_rptset_t *obj) |
static int | cace_ari_cbor_decode_rptset (QCBORDecodeContext *dec, cace_ari_rptset_t *obj) |
static int | cace_ari_cbor_encode_primval (QCBOREncodeContext *enc, const cace_ari_lit_t *obj) |
int | cace_ari_cbor_encode_stream (QCBOREncodeContext *enc, const cace_ari_t *ari) |
Lower-level stream encoding interface. | |
static int | cace_ari_cbor_decode_primval (QCBORDecodeContext *dec, cace_ari_lit_t *lit) |
static int | cace_ari_cbor_decode_label (QCBORDecodeContext *dec, cace_ari_lit_t *lit) |
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 *dec, cace_ari_t *ari) |
Lower-level stream decoding interface. | |
Variables | |
static const int64_t | nsec_scale = (int64_t)1e9 |
This file contains the definitions, prototypes, constants, and other information necessary for the identification and processing of AMM Resource Identifiers (ARIs).
Every object in the AMM can be uniquely identified using an ARI.
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(), and cace_amp_proxy_msg_recv().
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(), and cace_amp_proxy_msg_send().
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().