DTNMA Reference Tools v2.0.0 - 7.g88e232c
Delay-Tolerant Networking Management Architecture (DTNMA) Tool Suite
Loading...
Searching...
No Matches
cbor.c File Reference

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"
+ Include dependency graph for cbor.c:

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
 

Detailed Description

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.

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 cace_amp_msg_decode(), cace_amp_proxy_cli_recv(), and cace_amp_proxy_msg_recv().

◆ cace_ari_cbor_decode_stream()

◆ 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 cace_amp_msg_encode(), cace_amp_proxy_cli_send(), and cace_amp_proxy_msg_send().

◆ cace_ari_cbor_encode_stream()