DTNMA Reference Tools v2.1.0 - 13.gc5c0bac
Delay-Tolerant Networking Management Architecture (DTNMA) Tool Suite
Loading...
Searching...
No Matches
cace_ari.c File Reference
#include <cace/config.h>
#include <cace/ari.h>
#include <cace/ari/text.h>
#include <cace/ari/cbor.h>
#include <cace/ari/text_util.h>
#include <cace/util/logging.h>
#include <qcbor/qcbor_decode.h>
#include <getopt.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
+ Include dependency graph for cace_ari.c:

Macros

#define CBOR_STORE_WANT   1024
 

Enumerations

enum  cace_ari_form_t {
  CACE_ARI_FORM_INVALID , CACE_ARI_FORM_AUTO , CACE_ARI_FORM_TEXT , CACE_ARI_FORM_CBOR ,
  CACE_ARI_FORM_CBORHEX
}
 

Functions

static cace_ari_form_t get_form (const char *text)
 
static FILE * get_file (const char *name, const char *mode)
 
static int read_text (cace_ari_t *inval, FILE *source)
 Read a single value and indicate whether to continue reading.
 
static int read_cbor (cace_ari_t *inval, FILE *source)
 
static int read_cborhex (cace_ari_t *inval, FILE *source)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static int read_auto (cace_ari_form_t *inform, cace_ari_form_t *outform, cace_ari_t *inval, FILE *source)
 
static int write_text (const cace_ari_t *val, FILE *dest, cace_ari_text_enc_opts_t opts)
 
static int write_cbor (const cace_ari_t *val, FILE *dest)
 
static int write_cborhex (const cace_ari_t *val, FILE *dest)
 
static void show_usage (const char *argv0)
 
int main (int argc, char *argv[])
 

Macro Definition Documentation

◆ CBOR_STORE_WANT

#define CBOR_STORE_WANT   1024

Enumeration Type Documentation

◆ cace_ari_form_t

Enumerator
CACE_ARI_FORM_INVALID 

Default invalid value.

CACE_ARI_FORM_AUTO 

Detect the input by its initial characters as either text or hex and use the opposite on output.

CACE_ARI_FORM_TEXT 

Use text form ARIs.

CACE_ARI_FORM_CBOR 

Use binary form ARIs.

CACE_ARI_FORM_CBORHEX 

Use hex-encoded binary form ARIs.

Function Documentation

◆ get_file()

static FILE * get_file ( const char *  name,
const char *  mode 
)
static

Referenced by main().

◆ get_form()

static cace_ari_form_t get_form ( const char *  text)
static

◆ main()

◆ read_auto()

static int read_auto ( cace_ari_form_t inform,
cace_ari_form_t outform,
cace_ari_t inval,
FILE *  source 
)
static

◆ read_cbor()

static int read_cbor ( cace_ari_t inval,
FILE *  source 
)
static

◆ read_cborhex()

static int read_cborhex ( cace_ari_t inval,
FILE *  source 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References cace_ari_cbor_decode(), cace_base16_decode(), cace_data_deinit(), cace_data_init(), CACE_FREE, and errm.

Referenced by main(), and read_auto().

◆ read_text()

static int read_text ( cace_ari_t inval,
FILE *  source 
)
static

Read a single value and indicate whether to continue reading.

Returns
Zero upon success. A negative value to indicate end-of-input.

References cace_ari_text_decode(), CACE_FREE, and errm.

Referenced by main(), and read_auto().

◆ show_usage()

static void show_usage ( const char *  argv0)
static

References ARI_TEXT_PARSE.

Referenced by main().

◆ write_cbor()

static int write_cbor ( const cace_ari_t val,
FILE *  dest 
)
static

◆ write_cborhex()

static int write_cborhex ( const cace_ari_t val,
FILE *  dest 
)
static

◆ write_text()

static int write_text ( const cace_ari_t val,
FILE *  dest,
cace_ari_text_enc_opts_t  opts 
)
static

References cace_ari_text_encode().

Referenced by main().