DTNMA Reference Tools v2.1.0 - 13.gc5c0bac
Delay-Tolerant Networking Management Architecture (DTNMA) Tool Suite
Loading...
Searching...
No Matches
type.c File Reference
#include "type.h"
#include "cace/util/defs.h"
#include "cace/util/nocase.h"
#include <m-dict.h>
#include <pthread.h>
#include <stddef.h>
+ Include dependency graph for type.c:

Data Structures

struct  _ari_type_name_pair_t
 

Functions

static void _ari_type_dict_init (void)
 Initializer for #amm_builtin_dict.
 
const char * cace_ari_type_to_name (int32_t typenum)
 Lookup a type ID from its integer enumeration.
 
int cace_ari_type_from_name (int32_t *typenum, const char *name)
 Lookup a type ID from its text name.
 

Variables

static _ari_type_name_pair_t _ari_type_names []
 Map from non-negative literal type enumerations to names.
 
static _ari_type_by_id_t _ari_type_id_dict
 Cached type dictionary.
 
static _ari_type_by_name_t _ari_type_name_dict
 
static pthread_once_t _ari_type_dict_ctrl = PTHREAD_ONCE_INIT
 Guard for amm_builtin_dict_init()
 

Function Documentation

◆ _ari_type_dict_init()

static void _ari_type_dict_init ( void  )
static

◆ cace_ari_type_from_name()

int cace_ari_type_from_name ( int32_t *  typenum,
const char *  name 
)

Lookup a type ID from its text name.

Parameters
[out]typenumThe integer value to store the found result. A null value means just search but don't store.
[in]nameThe name to search for.
Returns
Zero upon success.

References _ari_type_dict_ctrl, _ari_type_dict_init(), _ari_type_name_dict, and CHKERR1.

Referenced by cace_amm_type_set_name_aritype(), and cace_ari_objpath_derive_type().

◆ cace_ari_type_to_name()

const char * cace_ari_type_to_name ( int32_t  typenum)

Lookup a type ID from its integer enumeration.

Parameters
typenumThe integer value to search for.
Returns
Non-null text pointer upon success.

References _ari_type_dict_ctrl, _ari_type_dict_init(), and _ari_type_id_dict.

Referenced by cace_ari_objpath_derive_type(), cace_ari_objpath_set_textid_opt(), cace_ari_set_aritype_text(), cace_ari_text_encode_aritype(), refda_agent_bindrefs(), refda_binding_obj(), test_amm_type_get_name_builtin(), and test_ari_text_encode_ariref().

Variable Documentation

◆ _ari_type_dict_ctrl

pthread_once_t _ari_type_dict_ctrl = PTHREAD_ONCE_INIT
static

Guard for amm_builtin_dict_init()

Referenced by cace_ari_type_from_name(), and cace_ari_type_to_name().

◆ _ari_type_id_dict

_ari_type_by_id_t _ari_type_id_dict
static

Cached type dictionary.

Referenced by _ari_type_dict_init(), and cace_ari_type_to_name().

◆ _ari_type_name_dict

_ari_type_by_name_t _ari_type_name_dict
static

◆ _ari_type_names

_ari_type_name_pair_t _ari_type_names[]
static

Map from non-negative literal type enumerations to names.

These are from the IANA sub-registries "Literal Types" and "Managed Object Types" from [IANA:DTNMA].

Referenced by _ari_type_dict_init().