yumapro  20.10-14
YumaPro SDK
typ.h File Reference

Parameter Type Handler. More...

#include <xmlstring.h>
#include <regex.h>
#include "ncxconst.h"
#include "ncxtypes.h"
#include "status.h"
#include "tk.h"
#include "xmlns.h"
Include dependency graph for typ.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  typ_listval_t
 one list member stored in simple.queue of instance-qualified strings More...
 
struct  typ_rangedef_t
 one member of a range definition – stored in simple.rangeQ More...
 
struct  typ_enum_t
 one ENUM typdef value – stored in simple.valQ Used for NCX_BT_ENUM and NCX_BT_BITS data type More...
 
struct  typ_sval_t
 one STRING typdef value, pattern value More...
 
struct  typ_range_t
 one YANG range description More...
 
struct  typ_pattern_t
 YANG pattern struct : N per typedef and also across N typdefs in a chain: all are ANDed together like RelaxNG instead of ORed together within the same type step like XSD. More...
 
union  typ_pattern_t::p_
 union contains either a YANG pattern or an OC pattern More...
 
struct  typ_idref_t
 YANG identityref struct the value is an identity-stmt QName that has a base-stmt that resolves to the same value. More...
 
struct  typ_simple_t
 NCX_CL_SIMPLE. More...
 
struct  typ_named_t
 NCX_CL_NAMED. More...
 
struct  typ_ref_t
 NCX_CL_REF. More...
 
union  typ_def_u_t
 Union of all the typdef variants. More...
 
struct  typ_def_t
 Discriminated union for all data typedefs. More...
 
struct  typ_template_t
 One YANG 'typedef' definition – top-level type template. More...
 
struct  typ_unionnode_t
 One YANG union node One of the 2 pointers (typ or typdef will be NULL If a named type is used, then 'typ' is active If an inline type is used, then typdef is active. More...
 

Typedefs

typedef boolean(* typ_union_walker_fn_t) (const xmlChar *the_typename, void *cookie)
 union typename walker function More...
 
typedef boolean(* typ_union_walker2_fn_t) (ncx_btype_t the_btype, void *cookie)
 complex union base type walker function More...
 

Enumerations

enum  typ_pmode_t {
  TYP_PM_NONE,
  TYP_PM_NORMAL,
  TYP_PM_INDEX,
  TYP_PM_MDATA
}
 type parser used in 3 separate modes More...
 

Functions

status_t typ_load_basetypes (void)
 Create typ_template_t structs for the base types. More...
 
void typ_unload_basetypes (void)
 Unload and destroy the typ_template_t structs for the base types unload the typ_template_t structs for the ncx_btype_t types. More...
 
typ_template_ttyp_new_template (void)
 Malloc and initialize the fields in a typ_template_t. More...
 
void typ_free_template (typ_template_t *typ)
 Scrub the memory in a typ_template_t by freeing all the sub-fields and then freeing the entire struct itself. More...
 
typ_def_ttyp_new_typdef (void)
 Malloc and initialize the fields in a typ_def_t. More...
 
void typ_init_typdef (typ_def_t *typdef)
 init a pre-allocated typdef (done first) More...
 
void typ_init_simple (typ_def_t *tdef, ncx_btype_t btyp)
 Init a typ_simple_t struct inside a typ_def_t. More...
 
void typ_init_named (typ_def_t *tdef)
 Init a typ_named_t struct inside a typ_def_t. More...
 
void typ_free_typdef (typ_def_t *typdef)
 Scrub the memory in a typ_def_t by freeing all Then free the typdef itself. More...
 
void typ_clean_typdef (typ_def_t *typdef)
 Clean a typ_def_t struct, but do not delete it. More...
 
void typ_set_named_typdef (typ_def_t *typdef, typ_template_t *imptyp)
 Set the fields in a named typedef (used by YANG parser) More...
 
void typ_unset_named_typdef (typ_def_t *typdef)
 UnSet the typ link in a named typedef (used by YANG parser) More...
 
const xmlChar * typ_get_named_typename (const typ_def_t *typdef)
 Get the type name of the named typ. More...
 
const xmlChar * typ_get_named_type_modname (const typ_def_t *typdef)
 Get the module name of the named typ. More...
 
uint32 typ_get_named_type_linenum (const typ_def_t *typdef)
 Get the line number of the type template of the named type. More...
 
status_t typ_set_new_named (typ_def_t *typdef, ncx_btype_t btyp)
 Create a new typdef inside a typ_named_t struct inside a typ_def_t. More...
 
typ_def_ttyp_get_new_named (typ_def_t *typdef)
 Access the new typdef inside a typ_named_t struct inside a typ_def_t. More...
 
const typ_def_ttyp_cget_new_named (const typ_def_t *typdef)
 Access the new typdef inside a typ_named_t struct inside a typ_def_t. More...
 
void typ_set_simple_typdef (typ_template_t *typ, ncx_btype_t btyp)
 Set the fields in a simple typedef (used by YANG parser) More...
 
typ_enum_ttyp_new_enum (const xmlChar *name)
 Alloc and Init a typ_enum_t struct. More...
 
typ_enum_ttyp_new_enum2 (xmlChar *name)
 Alloc and Init a typ_enum_t struct. More...
 
void typ_free_enum (typ_enum_t *en)
 Free a typ_enum_t struct. More...
 
typ_rangedef_ttyp_new_rangedef (void)
 Alloc and Init a typ_rangedef_t struct (range-stmt) More...
 
void typ_free_rangedef (typ_rangedef_t *rv, ncx_btype_t btyp)
 Free a typ_rangedef_t struct (range-stmt) More...
 
void typ_normalize_rangeQ (dlq_hdr_t *rangeQ, ncx_btype_t btyp)
 Start with a valid rangedef chain. More...
 
dlq_hdr_t * typ_get_rangeQ (typ_def_t *typdef)
 Return the rangeQ for the given typdef. More...
 
dlq_hdr_t * typ_get_rangeQ_con (typ_def_t *typdef)
 Return the rangeQ for the given typdef Do not follow typdef chains. More...
 
const dlq_hdr_t * typ_get_crangeQ (const typ_def_t *typdef)
 Return the rangeQ for the given typdef. More...
 
const dlq_hdr_t * typ_get_crangeQ_con (const typ_def_t *typdef)
 Return the rangeQ for the given typdef Do not follow typdef chains. More...
 
typ_range_ttyp_get_range_con (typ_def_t *typdef)
 Return the range struct for the given typdef Do not follow typdef chains. More...
 
const typ_range_ttyp_get_crange_con (const typ_def_t *typdef)
 Return the range struct for the given typdef Do not follow typdef chains. More...
 
const xmlChar * typ_get_rangestr (const typ_def_t *typdef)
 Return the range string for the given typdef chain. More...
 
const typ_rangedef_ttyp_first_rangedef (const typ_def_t *typdef)
 Return the lower bound range definition struct. More...
 
const typ_rangedef_ttyp_first_rangedef_con (const typ_def_t *typdef)
 Return the lower bound range definition struct Constrain search to this typdef. More...
 
status_t typ_get_rangebounds_con (const typ_def_t *typdef, ncx_btype_t *btyp, const ncx_num_t **lb, const ncx_num_t **ub)
 Return the lower and upper bound range number. More...
 
ncx_strrest_t typ_get_strrest (const typ_def_t *typdef)
 Get the string restrinvtion type set for this typdef. More...
 
void typ_set_strrest (typ_def_t *typdef, ncx_strrest_t strrest)
 Set the string restrinvtion type set for this typdef. More...
 
typ_sval_ttyp_new_sval (const xmlChar *str, ncx_btype_t btyp)
 Alloc and Init a typ_sval_t struct malloc and init a string descriptor. More...
 
void typ_free_sval (typ_sval_t *sv)
 Free a typ_sval_t struct free a string descriptor. More...
 
typ_listval_ttyp_new_listval (void)
 Alloc and Init a typ_listval_t struct malloc and init a list descriptor. More...
 
void typ_free_listval (typ_listval_t *lv)
 Free a typ_listval_t struct free a list descriptor. More...
 
ncx_btype_t typ_get_range_type (ncx_btype_t btyp)
 Get the correct typ_rangedef_t data type for the indicated base type. More...
 
ncx_btype_t typ_get_basetype (const typ_def_t *typdef)
 Get the final base type of the specified typ_def_t. More...
 
ncx_btype_t typ_get_basetype2 (typ_def_t *typdef)
 Get the final base type of the specified typ_def_t. More...
 
const xmlChar * typ_get_name (const typ_def_t *typdef)
 Get the name for the specified typdef. More...
 
const xmlChar * typ_get_basetype_name (const typ_template_t *typ)
 Get the name of the final base type of the specified typ_template_t. More...
 
const xmlChar * typ_get_parenttype_name (const typ_template_t *typ)
 Get the final base type of the specified typ_def_t. More...
 
ncx_tclass_t typ_get_base_class (const typ_def_t *typdef)
 Follow any typdef links and get the class of the base typdef for the specified typedef. More...
 
typ_template_ttyp_get_basetype_typ (ncx_btype_t btyp)
 Get the default typ_template_t for the specified base type. More...
 
typ_def_ttyp_get_basetype_typdef (ncx_btype_t btyp)
 Get the default typdef for the specified base type. More...
 
typ_def_ttyp_get_parent_typdef (typ_def_t *typdef)
 Get the next typ_def_t in a chain – for NCX_CL_NAMED chained typed. More...
 
const typ_template_ttyp_get_parent_type (const typ_template_t *typ)
 Get the next typ_template_t in a chain – for NCX_CL_NAMED only. More...
 
const typ_def_ttyp_get_cparent_typdef (const typ_def_t *typdef)
 Get the next typ_def_t in a chain – for NCX_CL_NAMED chained typed. More...
 
typ_def_ttyp_get_next_typdef (typ_def_t *typdef)
 Get the next typ_def_t in a chain – for NCX_CL_NAMED chained typed. More...
 
typ_def_ttyp_get_base_typdef (typ_def_t *typdef)
 Get the base typ_def_t in a chain – for NCX_CL_NAMED chained typed. More...
 
typ_def_ttyp_get_userdef_typdef (typ_def_t *typdef)
 Get the base typ_def_t in a chain – for NCX_CL_NAMED chained typed. More...
 
const typ_def_ttyp_get_cuserdef_typdef (const typ_def_t *typdef)
 Get the base typ_def_t in a chain – for NCX_CL_NAMED chained typed. More...
 
const typ_def_ttyp_get_cbase_typdef (const typ_def_t *typdef)
 Get the base typ_def_t in a chain – for NCX_CL_NAMED chained typed Also NCX_CL_REF pointer typdefs. More...
 
typ_def_ttyp_get_qual_typdef (typ_def_t *typdef, ncx_squal_t squal)
 Get the final typ_def_t of the specified typ_def_t based on the qualifier. More...
 
const typ_def_ttyp_get_cqual_typdef (const typ_def_t *typdef, ncx_squal_t squal)
 Get the final typ_def_t of the specified typ_def_t based on the qualifier. More...
 
const ncx_appinfo_ttyp_find_appinfo (const typ_def_t *typdef, const xmlChar *prefix, const xmlChar *name)
 Find the specified appinfo variable by its prefix and name. More...
 
const ncx_appinfo_ttyp_find_appinfo_con (const typ_def_t *typdef, const xmlChar *prefix, const xmlChar *name)
 Find the specified appinfo name, constrained to the current typdef. More...
 
boolean typ_is_xpath_string (const typ_def_t *typdef)
 Find the ncx:xpath extension within the specified typdef chain. More...
 
boolean typ_is_qname_string (const typ_def_t *typdef)
 Find the ncx:qname extension within the specified typdef chain. More...
 
boolean typ_is_schema_instance_string (const typ_def_t *typdef)
 Find the ncx:schema-instance extension within the specified typdef chain. More...
 
const xmlChar * typ_get_defval (const typ_template_t *typ)
 Find the default value string for the specified type template get default from template. More...
 
const xmlChar * typ_get_default (const typ_def_t *typdef)
 Check if this typdef has a default value defined get default from typdef. More...
 
ncx_iqual_t typ_get_iqualval (const typ_template_t *typ)
 Find the instance qualifier value enum for the specified type template. More...
 
ncx_iqual_t typ_get_iqualval_def (const typ_def_t *typdef)
 Find the instance qualifier value enum for the specified type template. More...
 
const xmlChar * typ_get_units (const typ_template_t *typ)
 Find the units string for the specified type template. More...
 
const xmlChar * typ_get_units_from_typdef (const typ_def_t *typdef)
 Find the units string for the specified typdef template. More...
 
boolean typ_has_children (ncx_btype_t btyp)
 Check if this is a data type that uses the val.v.childQ. More...
 
boolean typ_has_index (ncx_btype_t btyp)
 Check if this is a data type that has an index. More...
 
boolean typ_is_simple (ncx_btype_t btyp)
 Check if this is a simple data type. More...
 
boolean typ_is_xsd_simple (ncx_btype_t btyp)
 Check if this is a simple data type in XSD encoding. More...
 
typ_enum_ttyp_first_enumdef (typ_def_t *typdef)
 Get the first enum def struct looks past named typedefs to base typedef. More...
 
typ_enum_ttyp_next_enumdef (typ_enum_t *enumdef)
 Get the next enum def struct. More...
 
typ_enum_ttyp_get_enumdef_n (typ_def_t *typdef, uint32 num)
 Get the enum defs defined based on enum order. More...
 
typ_enum_ttyp_first_enumdef2 (typ_def_t *typdef)
 Get the first enum def struct. More...
 
const typ_enum_ttyp_first_con_enumdef (const typ_def_t *typdef)
 Get the first enum def struct constrained to this typdef. More...
 
typ_enum_ttyp_find_enumdef (dlq_hdr_t *ebQ, const xmlChar *name)
 Get the specified enum def struct. More...
 
uint32 typ_enumdef_count (const typ_def_t *typdef)
 Get the number of typ_enum_t Q entries. More...
 
boolean typ_enumdef_conditional (typ_def_t *typdef, const xmlChar *valstr)
 Check if the specified enumdef value is conditional on if-feature. More...
 
typ_def_ttyp_get_correct_enumdef (typ_def_t *typdef)
 Get the typ_enum_t to use. More...
 
typ_enum_ttyp_get_enumdef (typ_def_t *typdef, const xmlChar *valstr)
 Get the typ_enum_t. More...
 
const typ_sval_ttyp_first_strdef (const typ_def_t *typdef)
 Get the first string def struct. More...
 
uint32 typ_get_maxrows (const typ_def_t *typdef)
 Get the maxrows value if it exists or zero if not. More...
 
ncx_access_t typ_get_maxaccess (const typ_def_t *typdef)
 Find the max-access value for the specified typdef. More...
 
ncx_data_class_t typ_get_dataclass (const typ_def_t *typdef)
 Find the data-class value for the specified typdef. More...
 
ncx_merge_t typ_get_mergetype (const typ_def_t *typdef)
 Get the merge type for a specified type def. More...
 
xmlns_id_t typ_get_nsid (const typ_template_t *typ)
 Return the namespace ID. More...
 
typ_template_ttyp_get_listtyp (typ_def_t *typdef)
 Return the typ_template for the list type, if the supplied. More...
 
const typ_template_ttyp_get_clisttyp (const typ_def_t *typdef)
 Return the typ_template for the list type, if the supplied. More...
 
typ_unionnode_ttyp_new_unionnode (typ_template_t *typ)
 Alloc and Init a typ_unionnode_t struct. More...
 
void typ_free_unionnode (typ_unionnode_t *un)
 Free a typ_unionnode_t struct. More...
 
typ_def_ttyp_get_unionnode_ptr (typ_unionnode_t *un)
 Get the proper typdef pointer from a unionnode. More...
 
typ_unionnode_ttyp_first_unionnode (typ_def_t *typdef)
 Get the first union node in the queue for a given typdef. More...
 
const typ_unionnode_ttyp_first_con_unionnode (const typ_def_t *typdef)
 Get the first union node in the queue for a given typdef constrained. More...
 
boolean typ_is_number (ncx_btype_t btyp)
 Check if the base type is numeric. More...
 
boolean typ_is_string (ncx_btype_t btyp)
 Check if the base type is a simple string (not list) More...
 
boolean typ_is_enum (ncx_btype_t btyp)
 Check if the base type is an enumeration. More...
 
typ_pattern_ttyp_new_pattern (const xmlChar *pat_str, boolean ocmode)
 Malloc and init a pattern struct. More...
 
void typ_free_pattern (typ_pattern_t *pat)
 Free a pattern struct. More...
 
status_t typ_compile_pattern (typ_pattern_t *pat)
 Compile a pattern as into a regex_t struct. More...
 
typ_pattern_ttyp_get_first_pattern (typ_def_t *typdef)
 Get the first pattern struct for a typdef. More...
 
typ_pattern_ttyp_get_next_pattern (typ_pattern_t *curpat)
 Get the next pattern struct for a typdef. More...
 
const typ_pattern_ttyp_get_first_cpattern (const typ_def_t *typdef)
 Get the first pattern struct for a typdef Const version. More...
 
const typ_pattern_ttyp_get_next_cpattern (const typ_pattern_t *curpat)
 Get the next pattern struct for a typdef Const version. More...
 
uint32 typ_get_pattern_count (const typ_def_t *typdef)
 Get the number of pattern structs in a typdef. More...
 
ncx_errinfo_ttyp_get_range_errinfo (typ_def_t *typdef)
 Get the range errinfo for a typdef. More...
 
void typ_clean_typeQ (dlq_hdr_t *que)
 Clean a queue of typ_template_t structs. More...
 
boolean typ_ok_for_inline_index (ncx_yang_version_t langver, ncx_btype_t btyp)
 Check if the base type is okay to use in an inline index decl. More...
 
boolean typ_ok_for_metadata (ncx_btype_t btyp)
 Check if the base type is okay to use in an XML attribute. More...
 
boolean typ_ok_for_union (ncx_yang_version_t langver, ncx_btype_t btyp)
 Check if the base type is okay to use in an union decl. More...
 
boolean typ_ok (const typ_def_t *typdef)
 Check if the typdef chain has any errors. More...
 
boolean typ_ok_for_xsdlist (ncx_btype_t btyp)
 Check if the base type is okay to use in an ncx:xsdlist typedef. More...
 
const xmlChar * typ_get_leafref_path (const typ_def_t *typdef)
 Get the path argument for the leafref data type. More...
 
const void * typ_get_leafref_path_addr (const typ_def_t *typdef)
 Get the address of the path argument for the leafref data type. More...
 
struct xpath_pcb_t_ * typ_get_leafref_pcb (typ_def_t *typdef)
 Get the XPath parser control block for the leafref data type returns xpath_pcb_t but cannot import due to H file loop. More...
 
ncx_leafref_class_t typ_get_leafref_class (typ_def_t *typdef)
 Get the leafref class for the leafref type. More...
 
void typ_set_leafref_class_key (typ_def_t *typdef)
 Change the leafref class for the type to NCX_LEAFREF_CLASS_KEY. More...
 
boolean typ_get_constrained (const typ_def_t *typdef)
 Get the constrained true/false field for the data type leafref or instance-identifier constrained flag. More...
 
boolean typ_get_constrained_set (const typ_def_t *typdef)
 Return TRUE if the require-instance stmt is set. More...
 
void typ_set_xref_typdef (typ_def_t *typdef, typ_def_t *target)
 Set the target typdef for a leafref or instance-identifier NCX_BT_LEAFREF or NCX_BT_INSTANCE_ID. More...
 
typ_def_ttyp_get_xref_typdef (typ_def_t *typdef)
 Get the xrefdef target typdef from a leafref or instance-identifier. More...
 
boolean typ_has_subclauses (const typ_def_t *typdef)
 Check if the specified typdef has any sub-clauses. More...
 
typ_idref_ttyp_get_first_idref (typ_def_t *typdef)
 Get the first idref field if this is an NCX_BT_IDREF typdef. More...
 
typ_idref_ttyp_get_next_idref (typ_def_t *typdef, typ_idref_t *curdef)
 Get the next idref field if this is an NCX_BT_IDREF typdef. More...
 
const typ_idref_ttyp_get_first_cidref (typ_def_t *typdef)
 Get the idref field if this is an NCX_BT_IDREF typdef Const version. More...
 
const typ_idref_ttyp_get_next_cidref (const typ_def_t *typdef, const typ_idref_t *curdef)
 Get the next idref field if this is an NCX_BT_IDREF typdef. More...
 
uint8 typ_get_fraction_digits (const typ_def_t *typdef)
 Get the fraction-digits field from the typdef chain typdef must be an NCX_BT_DECIMAL64 or 0 will be returned valid values are 1..18. More...
 
status_t typ_set_fraction_digits (typ_def_t *typdef, uint8 digits)
 Set the fraction-digits field from the typdef chain. More...
 
uint32 typ_get_typ_linenum (const typ_template_t *typ)
 Get the line number for the typ_template_t. More...
 
uint32 typ_get_typdef_linenum (const typ_def_t *typdef)
 Get the line number for the typ_def_t. More...
 
void typ_get_union_types (typ_def_t *typdef, typ_union_walker_fn_t walkerfn, void *cookie)
 Walk the union type nodes to print the names. More...
 
void typ_get_union_basetypes (typ_def_t *typdef, typ_union_walker2_fn_t walkerfn, void *cookie)
 Walk the union type nodes to print the base type names. More...
 
const xmlChar * typ_get_yang_typename (const typ_def_t *typdef)
 Get the YANG type name for this typdef if there is one. More...
 
boolean typ_union_needs_xpath_check (typ_def_t *checkdef)
 Walk the union type nodes to check if there are any unconstrained leafref or instance-identifier nodes that need validation. More...
 
typ_idref_ttyp_new_idref (void)
 Malloc a new idref. More...
 
void typ_free_idref (typ_idref_t *idref)
 Clean and freec an idref. More...
 

Detailed Description

Parameter Type Handler.