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

This file contains definitions constraints on semantic type use. More...

#include "range.h"
#include "cace/config.h"
#include "cace/ari.h"
#include <pcre2.h>
+ Include dependency graph for semtype_cnst.h:
+ This graph shows which files directly or indirectly include this file:

Data Structures

struct  cace_amm_semtype_cnst_t
 A single constraint on a cace_amm_semtype_use_t. More...
 

Macros

#define M_OPL_cace_amm_semtype_cnst_t()    (INIT(API_2(cace_amm_semtype_cnst_init)), CLEAR(API_2(cace_amm_semtype_cnst_deinit)))
 M*LIB OPLIST for cace_amm_semtype_cnst_t.
 

Enumerations

enum  cace_amm_semtype_cnst_type_e { AMM_SEMTYPE_CNST_INVALID , AMM_SEMTYPE_CNST_STRLEN , AMM_SEMTYPE_CNST_TEXTPAT , AMM_SEMTYPE_CNST_RANGE_INT64 }
 Types of constraints on a cace_amm_semtype_use_t. More...
 

Functions

void cace_amm_semtype_cnst_init (cace_amm_semtype_cnst_t *obj)
 
void cace_amm_semtype_cnst_deinit (cace_amm_semtype_cnst_t *obj)
 
cace_amm_range_size_tcace_amm_semtype_cnst_set_strlen (cace_amm_semtype_cnst_t *obj)
 Configure a constraint on text-string or byte-string size.
 
int cace_amm_semtype_cnst_set_textpat (cace_amm_semtype_cnst_t *obj, const char *pat)
 Configure a constraint on text-string regular expression pattern.
 
cace_amm_range_int64_tcace_amm_semtype_cnst_set_range_int64 (cace_amm_semtype_cnst_t *obj)
 Configure a constraint on integer values based on signed 64-bit ranges.
 
bool cace_amm_semtype_cnst_is_valid (const cace_amm_semtype_cnst_t *obj, const cace_ari_t *val)
 Determine if a specific value is valid according to a constraint.
 

Detailed Description

This file contains definitions constraints on semantic type use.

Enumeration Type Documentation

◆ cace_amm_semtype_cnst_type_e

Types of constraints on a cace_amm_semtype_use_t.

This library does not implement constraints for:

  • text pattern regular expressions
  • integer enumerated values
  • integer bitwise values
  • CBOR CDDL
Enumerator
AMM_SEMTYPE_CNST_INVALID 

An initial invalid type with no associated value.

AMM_SEMTYPE_CNST_STRLEN 

Text- or byte-string length range.

AMM_SEMTYPE_CNST_TEXTPAT 

Text-string pattern expression.

AMM_SEMTYPE_CNST_RANGE_INT64 

A signed 64-bit integer multi-interval range.

Function Documentation

◆ cace_amm_semtype_cnst_is_valid()

bool cace_amm_semtype_cnst_is_valid ( const cace_amm_semtype_cnst_t obj,
const cace_ari_t val 
)

◆ cace_amm_semtype_cnst_set_range_int64()

cace_amm_range_int64_t * cace_amm_semtype_cnst_set_range_int64 ( cace_amm_semtype_cnst_t obj)

Configure a constraint on integer values based on signed 64-bit ranges.

This applies to CACE_ARI_TYPE_BYTE, CACE_ARI_TYPE_INT, CACE_ARI_TYPE_UINT, CACE_ARI_TYPE_VAST, and a limited domain of CACE_ARI_TYPE_UVAST as well as untyped primitive integer values.

Parameters
[in,out]objThe struct to set the state of.
Returns
The specific parameters for this constraint type.

References AMM_SEMTYPE_CNST_RANGE_INT64, cace_amm_semtype_cnst_t::as_range_int64, CHKNULL, and cace_amm_semtype_cnst_t::type.

◆ cace_amm_semtype_cnst_set_strlen()

cace_amm_range_size_t * cace_amm_semtype_cnst_set_strlen ( cace_amm_semtype_cnst_t obj)

Configure a constraint on text-string or byte-string size.

This applies to CACE_ARI_TYPE_TEXTSTR and CACE_ARI_TYPE_BYTESTR as well as untyped primitive text- and byte-strings.

Parameters
[in,out]objThe struct to set the state of.
Returns
The specific parameters for this constraint type.

References AMM_SEMTYPE_CNST_STRLEN, cace_amm_semtype_cnst_t::as_strlen, CHKNULL, and cace_amm_semtype_cnst_t::type.

◆ cace_amm_semtype_cnst_set_textpat()

int cace_amm_semtype_cnst_set_textpat ( cace_amm_semtype_cnst_t obj,
const char *  pat 
)

Configure a constraint on text-string regular expression pattern.

This applies to CACE_ARI_TYPE_TEXTSTR as well as untyped primitive text strings.

Note
The pat parameter is the start- and end-anchored PCRE pattern, which conforms to the I-Regexp standard of RFC 9485 [rfc9485]. This pattern does not need to include leading "\A(?" or trailing ")\z" parts.
Parameters
[in,out]objThe struct to set the state of.
[in]patThe regular expression to compile.
Returns
Zero if successful.

References AMM_SEMTYPE_CNST_TEXTPAT, cace_amm_semtype_cnst_t::as_textpat, CACE_LOG_ERR, CHKERR1, and cace_amm_semtype_cnst_t::type.