DTNMA Reference Tools v2.0.0 - 9.gaff6489
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 cace_amp_msg_decode(), cace_amp_proxy_cli_recv(), cace_amp_proxy_msg_recv(), and transform_cbor_str_to_cace_data().

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

◆ cace_ari_cbor_encode_stream()