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

This file contains functions for internal API to access ARI values in a consistent way. More...

#include "base.h"
#include "containers.h"
+ Include dependency graph for access.h:
+ This graph shows which files directly or indirectly include this file:

Functions

bool cace_ari_is_undefined (const cace_ari_t *ari)
 Determine if a value is the undefined value.
 
bool cace_ari_not_undefined (const cace_ari_t *ari)
 Determine if a value is not the undefined value.
 
void cace_ari_set_undefined (cace_ari_t *ari)
 Set the ARI value to be undefined.
 
bool cace_ari_is_null (const cace_ari_t *ari)
 Determine if this is a typed or untyped null value.
 
void cace_ari_set_null (cace_ari_t *ari)
 Set the ARI value to be untyped null.
 
bool cace_ari_is_bool (const cace_ari_t *ari)
 Determine if this ARI contains a primitive boolean type.
 
int cace_ari_get_bool (const cace_ari_t *ari, cace_ari_bool *out)
 Extract a boolean value, if present, from an ARI.
 
int cace_ari_get_int (const cace_ari_t *ari, cace_ari_int *out)
 Extract an integer value, if present, from an ARI.
 
int cace_ari_get_uint (const cace_ari_t *ari, cace_ari_uint *out)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
int cace_ari_get_byte (const cace_ari_t *ari, cace_ari_byte *out)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
int cace_ari_get_vast (const cace_ari_t *ari, cace_ari_vast *out)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
int cace_ari_get_uvast (const cace_ari_t *ari, cace_ari_uvast *out)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
int cace_ari_get_tp (const cace_ari_t *ari, struct timespec *out)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The output in this case is in the DTN time epoch.
 
int cace_ari_get_tp_posix (const cace_ari_t *ari, struct timespec *out)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The output in this case is in the POSIX time epoch.
 
int cace_ari_get_td (const cace_ari_t *ari, struct timespec *out)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
bool cace_ari_is_lit_typed (const cace_ari_t *ari, cace_ari_type_t typ)
 Determine if this is a typed literal of a specific type.
 
const int64_t * cace_ari_get_aritype (const cace_ari_t *ari)
 Require an ARITYPE literal value.
 
void cace_ari_set_prim_bool (cace_ari_t *ari, cace_ari_bool src)
 Set an ARI as an untyped literal value.
 
void cace_ari_set_prim_uint64 (cace_ari_t *ari, uint64_t src)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void cace_ari_set_prim_int64 (cace_ari_t *ari, int64_t src)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void cace_ari_set_prim_float64 (cace_ari_t *ari, cace_ari_real64 src)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void cace_ari_set_bool (cace_ari_t *ari, cace_ari_bool src)
 Set an ARI as a typed literal value.
 
void cace_ari_set_byte (cace_ari_t *ari, cace_ari_byte src)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void cace_ari_set_int (cace_ari_t *ari, cace_ari_int src)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void cace_ari_set_uint (cace_ari_t *ari, cace_ari_uint src)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void cace_ari_set_vast (cace_ari_t *ari, cace_ari_vast src)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void cace_ari_set_uvast (cace_ari_t *ari, cace_ari_uvast src)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void cace_ari_set_real32 (cace_ari_t *ari, cace_ari_real32 src)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void cace_ari_set_real64 (cace_ari_t *ari, cace_ari_real64 src)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void cace_ari_set_tstr (cace_ari_t *ari, const char *buf, bool copy)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void cace_ari_set_bstr (cace_ari_t *ari, cace_data_t *src, bool copy)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void cace_ari_set_tp (cace_ari_t *ari, struct timespec dtntime)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The input in this case is in the DTN time epoch.
 
void cace_ari_set_tp_posix (cace_ari_t *ari, struct timespec ptime)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The input in this case is in the POSIX time epoch.
 
void cace_ari_set_td (cace_ari_t *ari, struct timespec delta)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void cace_ari_set_aritype (cace_ari_t *ari, cace_ari_type_t type)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void cace_ari_set_aritype_text (cace_ari_t *ari, cace_ari_type_t type)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void cace_ari_set_ac (cace_ari_t *ari, struct cace_ari_ac_s *src)
 Set the ARI as an AC, optionally moving values from an external source.
 
void cace_ari_set_am (cace_ari_t *ari, struct cace_ari_am_s *src)
 Set the ARI as an AM, optionally moving values from an external source.
 
void cace_ari_set_tbl (cace_ari_t *ari, struct cace_ari_tbl_s *src)
 Set the ARI as a TBL, optionally moving values from an external source.
 
const cace_data_tcace_ari_cget_tstr (const cace_ari_t *ari)
 Require a TEXTSTR value and get the pointer to its storage.
 
const cace_data_tcace_ari_cget_bstr (const cace_ari_t *ari)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
struct cace_ari_ac_s * cace_ari_get_ac (cace_ari_t *ari)
 Require an AC value and extract a pointer to its item list.
 
const struct cace_ari_ac_s * cace_ari_cget_ac (const cace_ari_t *ari)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
struct cace_ari_am_s * cace_ari_get_am (cace_ari_t *ari)
 Require an AM value and extract a pointer to its item list.
 
const struct cace_ari_am_s * cace_ari_cget_am (const cace_ari_t *ari)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
struct cace_ari_tbl_s * cace_ari_get_tbl (cace_ari_t *ari)
 
const struct cace_ari_tbl_s * cace_ari_cget_tbl (const cace_ari_t *ari)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
struct cace_ari_execset_s * cace_ari_get_execset (cace_ari_t *ari)
 Require an EXECSET value and extract a pointer to its struct.
 
const struct cace_ari_execset_s * cace_ari_cget_execset (const cace_ari_t *ari)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
struct cace_ari_execset_s * cace_ari_set_execset (cace_ari_t *ari)
 Set an ARI as an EXECSET literal value.
 
struct cace_ari_rptset_s * cace_ari_get_rptset (cace_ari_t *ari)
 Require an RPTSET value and extract a pointer to its struct.
 
const struct cace_ari_rptset_s * cace_ari_cget_rptset (const cace_ari_t *ari)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
struct cace_ari_rptset_s * cace_ari_set_rptset (cace_ari_t *ari)
 Set an ARI as an RPTSET literal value.
 
static void cace_ari_set_objref_path_intid (cace_ari_t *ari, cace_ari_int_id_t org_id, cace_ari_int_id_t model_id, cace_ari_type_t type_id, cace_ari_int_id_t obj_id)
 Convenience setter.
 
static void cace_ari_set_objref_path_textid (cace_ari_t *ari, const char *org_id, const char *model_id, cace_ari_type_t type_id, const char *obj_id)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 

Detailed Description

This file contains functions for internal API to access ARI values in a consistent way.

Function Documentation

◆ cace_ari_cget_tstr()

const cace_data_t * cace_ari_cget_tstr ( const cace_ari_t ari)

Require a TEXTSTR value and get the pointer to its storage.

Parameters
[in]ariThe ARI to read.
Returns
Pointer to the contained data, if present, otherwise NULL. @notice This data will always have a terminating null byte.

References cace_ari_prim_val_u::as_data, cace_ari_t::as_lit, CACE_ARI_PRIM_TSTR, cace_ari_t::is_ref, cace_ari_lit_t::prim_type, and cace_ari_lit_t::value.

◆ cace_ari_get_ac()

struct cace_ari_ac_s * cace_ari_get_ac ( cace_ari_t ari)

Require an AC value and extract a pointer to its item list.

Parameters
[in]ariThe ARI to read.
Returns
Pointer to the contained AC struct, if present, otherwise NULL.

References cace_ari_prim_val_u::as_ac, cace_ari_t::as_lit, and cace_ari_lit_t::value.

◆ cace_ari_get_am()

struct cace_ari_am_s * cace_ari_get_am ( cace_ari_t ari)

Require an AM value and extract a pointer to its item list.

Parameters
[in]ariThe ARI to read.
Returns
Pointer to the contained AM struct, if present, otherwise NULL.

References cace_ari_prim_val_u::as_am, cace_ari_t::as_lit, and cace_ari_lit_t::value.

◆ cace_ari_get_aritype()

const int64_t * cace_ari_get_aritype ( const cace_ari_t ari)

Require an ARITYPE literal value.

Parameters
[in]ariThe ARI to read.
Returns
Pointer to the contained type value, if present, otherwise NULL.

References cace_ari_prim_val_u::as_int64, cace_ari_t::as_lit, CACE_ARI_PRIM_INT64, cace_ari_lit_t::prim_type, and cace_ari_lit_t::value.

◆ cace_ari_get_bool()

int cace_ari_get_bool ( const cace_ari_t ari,
cace_ari_bool *  out 
)

Extract a boolean value, if present, from an ARI.

This works for both typed and untyped literal values.

Parameters
[in]ariNon-null pointer to the ARI to read.
[out]outThe value to output.
Returns
Zero upon success.

References cace_ari_prim_val_u::as_bool, cace_ari_t::as_lit, CACE_ARI_PRIM_BOOL, CHKERR1, cace_ari_t::is_ref, cace_ari_lit_t::prim_type, and cace_ari_lit_t::value.

◆ cace_ari_get_execset()

struct cace_ari_execset_s * cace_ari_get_execset ( cace_ari_t ari)

Require an EXECSET value and extract a pointer to its struct.

Parameters
[in]ariThe ARI to read.
Returns
Pointer to the contained struct, if present, otherwise NULL.

References cace_ari_prim_val_u::as_execset, cace_ari_t::as_lit, and cace_ari_lit_t::value.

◆ cace_ari_get_int()

int cace_ari_get_int ( const cace_ari_t ari,
cace_ari_int *  out 
)

Extract an integer value, if present, from an ARI.

This works for both typed and untyped literal values and will coerce signed and unsigned values to the desired type where possible.

Parameters
[in]ariNon-null pointer to the ARI to read.
[out]outThe value to output.
Returns
Zero upon success.

References cace_ari_prim_val_u::as_int64, cace_ari_t::as_lit, cace_ari_prim_val_u::as_uint64, CACE_ARI_PRIM_INT64, CACE_ARI_PRIM_UINT64, CHKERR1, cace_ari_t::is_ref, cace_ari_lit_t::prim_type, and cace_ari_lit_t::value.

◆ cace_ari_get_rptset()

struct cace_ari_rptset_s * cace_ari_get_rptset ( cace_ari_t ari)

Require an RPTSET value and extract a pointer to its struct.

Parameters
[in]ariThe ARI to read.
Returns
Pointer to the contained struct, if present, otherwise NULL.

References cace_ari_t::as_lit, cace_ari_prim_val_u::as_rptset, and cace_ari_lit_t::value.

◆ cace_ari_is_bool()

bool cace_ari_is_bool ( const cace_ari_t ari)

Determine if this ARI contains a primitive boolean type.

Parameters
[in]ariNon-null pointer to the ARI to read.
Returns
True if the primitive is boolean.

References cace_ari_t::as_lit, CACE_ARI_PRIM_BOOL, CHKFALSE, cace_ari_t::is_ref, and cace_ari_lit_t::prim_type.

◆ cace_ari_is_lit_typed()

bool cace_ari_is_lit_typed ( const cace_ari_t ari,
cace_ari_type_t  typ 
)

Determine if this is a typed literal of a specific type.

Parameters
[in]ariThe value to check.
typThe type to compare with.
Returns
True if the value is of that type.

References cace_ari_lit_t::ari_type, cace_ari_t::as_lit, cace_ari_lit_t::has_ari_type, and cace_ari_t::is_ref.

◆ cace_ari_is_null()

bool cace_ari_is_null ( const cace_ari_t ari)

Determine if this is a typed or untyped null value.

Parameters
[in]ariThe value to check.
See also
cace_ari_set_null()

References cace_ari_t::as_lit, CACE_ARI_PRIM_NULL, CHKFALSE, cace_ari_t::is_ref, and cace_ari_lit_t::prim_type.

◆ cace_ari_is_undefined()

bool cace_ari_is_undefined ( const cace_ari_t ari)

Determine if a value is the undefined value.

Parameters
[in]ariThe value to check, or a NULL pointer.
Returns
True if the ARI is valid and is the undefined value.
See also
ARI_UNDEFINED cace_ari_init()

References cace_ari_t::as_lit, CACE_ARI_PRIM_UNDEFINED, CHKFALSE, cace_ari_t::is_ref, and cace_ari_lit_t::prim_type.

◆ cace_ari_not_undefined()

bool cace_ari_not_undefined ( const cace_ari_t ari)

Determine if a value is not the undefined value.

This can be useful as a CTRL or OPER precondition.

Parameters
[in]ariThe value to check, or a NULL pointer.
Returns
True if the ARI is valid and is not the undefined value.
See also
ARI_UNDEFINED cace_ari_init()

References cace_ari_t::as_lit, CACE_ARI_PRIM_UNDEFINED, CHKFALSE, cace_ari_t::is_ref, and cace_ari_lit_t::prim_type.

◆ cace_ari_set_ac()

void cace_ari_set_ac ( cace_ari_t ari,
struct cace_ari_ac_s *  src 
)

Set the ARI as an AC, optionally moving values from an external source.

Parameters
[in,out]ariThe ARI value to modify.
[in,out]srcAn optional existing value struct to move from.

References cace_ari_deinit(), cace_ari_init_lit(), CACE_ARI_PRIM_OTHER, CHKVOID, cace_ari_lit_t::has_ari_type, cace_ari_ac_t::items, and M_MEMORY_ALLOC.

◆ cace_ari_set_am()

void cace_ari_set_am ( cace_ari_t ari,
struct cace_ari_am_s *  src 
)

Set the ARI as an AM, optionally moving values from an external source.

Parameters
[in,out]ariThe ARI value to modify.
[in,out]srcAn optional existing value struct to move from.

References cace_ari_deinit(), cace_ari_init_lit(), CACE_ARI_PRIM_OTHER, CHKVOID, cace_ari_lit_t::has_ari_type, cace_ari_am_t::items, and M_MEMORY_ALLOC.

◆ cace_ari_set_bool()

void cace_ari_set_bool ( cace_ari_t ari,
cace_ari_bool  src 
)

Set an ARI as a typed literal value.

Parameters
[in,out]ariThe ARI to set the value on. This must have been initialized.
srcThe value to set to.

References cace_ari_deinit(), cace_ari_init_lit(), CACE_ARI_PRIM_BOOL, CHKVOID, and cace_ari_lit_t::has_ari_type.

◆ cace_ari_set_execset()

struct cace_ari_execset_s * cace_ari_set_execset ( cace_ari_t ari)

Set an ARI as an EXECSET literal value.

Any previous value is de-initialized.

Parameters
[out]ariThe value to set.
Returns
The new execset struct.

References cace_ari_deinit(), cace_ari_init_lit(), CACE_ARI_PRIM_OTHER, CACE_MALLOC, CHKNULL, and cace_ari_lit_t::has_ari_type.

◆ cace_ari_set_null()

void cace_ari_set_null ( cace_ari_t ari)

Set the ARI value to be untyped null.

Parameters
[in,out]ariThe value to set.

References cace_ari_deinit(), cace_ari_init_lit(), CACE_ARI_PRIM_NULL, CHKVOID, and cace_ari_lit_t::has_ari_type.

◆ cace_ari_set_prim_bool()

void cace_ari_set_prim_bool ( cace_ari_t ari,
cace_ari_bool  src 
)

Set an ARI as an untyped literal value.

Parameters
[in,out]ariThe ARI to set the value on. This must have been initialized.
srcThe primitive value to set to.

References cace_ari_deinit(), cace_ari_init_lit(), CACE_ARI_PRIM_BOOL, CHKVOID, and cace_ari_lit_t::has_ari_type.

◆ cace_ari_set_rptset()

struct cace_ari_rptset_s * cace_ari_set_rptset ( cace_ari_t ari)

Set an ARI as an RPTSET literal value.

Any previous value is de-initialized.

Parameters
[out]ariThe value to set.
Returns
The new rptset struct.

References cace_ari_deinit(), cace_ari_init_lit(), CACE_ARI_PRIM_OTHER, CACE_MALLOC, CHKNULL, and cace_ari_lit_t::has_ari_type.

◆ cace_ari_set_tbl()

void cace_ari_set_tbl ( cace_ari_t ari,
struct cace_ari_tbl_s *  src 
)

Set the ARI as a TBL, optionally moving values from an external source.

Parameters
[in,out]ariThe ARI value to modify.
[in,out]srcAn optional existing value struct to move from.

References cace_ari_deinit(), cace_ari_init_lit(), CACE_ARI_PRIM_OTHER, CHKVOID, cace_ari_lit_t::has_ari_type, cace_ari_tbl_t::items, M_MEMORY_ALLOC, and cace_ari_tbl_t::ncols.

◆ cace_ari_set_undefined()

void cace_ari_set_undefined ( cace_ari_t ari)

Set the ARI value to be undefined.

Parameters
[in,out]ariThe value to set, which should not be NULL pointer.

References cace_ari_deinit().