yumapro  20.10-10
YumaPro SDK
Parser Functions for YANG Types

YANG Parser functions to consume and resolve data types. More...

Collaboration diagram for Parser Functions for YANG Types:

Functions

status_t yang_typ_consume_type (yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, typ_def_t *intypdef)
 Consume a type-stmt. More...
 
status_t yang_typ_consume_metadata_type (yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, typ_def_t *intypdef)
 Consume a type-stmt for metadata. More...
 
status_t yang_typ_consume_typedef (yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *que)
 Consume a typedef-stmt. More...
 
status_t yang_typ_resolve_typedefs (yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *typeQ, obj_template_t *parent)
 Resovlve the typeQ of typedefs. More...
 
status_t yang_typ_resolve_typedefs_final (tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *typeQ)
 Resolve typedefs (final pass) More...
 
status_t yang_typ_resolve_typedefs_grp (yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *typeQ, obj_template_t *parent, grp_template_t *grp)
 Resolve typedefs in a grouping (final pass) More...
 
status_t yang_typ_resolve_type (yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, typ_def_t *typdef, const xmlChar *defval, obj_template_t *obj)
 Resolve a type-stmt. More...
 
status_t yang_typ_resolve_type_final (tk_chain_t *tkc, ncx_module_t *mod, typ_def_t *typdef, const xmlChar *name, const xmlChar *defval, obj_template_t *obj)
 Resolve a type-stmt (final pass) More...
 
status_t yang_typ_rangenum_ok (typ_def_t *typdef, const ncx_num_t *num)
 Check is a range number is OK. More...
 
boolean yang_typ_enubit_enabled (typ_enum_t *enubit)
 Check if an enum or bit is enabled. More...
 
boolean yang_typ_identity_enabled (ncx_identity_t *id)
 Check if an identity-stmt is enabled. More...
 
status_t yang_typ_resolve_leafref (yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, obj_template_t *testobj)
 Resolve the typdef in a leafref leaf or leaf-list. More...
 

Detailed Description

YANG Parser functions to consume and resolve data types.

Function Documentation

status_t yang_typ_consume_metadata_type ( yang_pcb_t pcb,
tk_chain_t tkc,
ncx_module_t mod,
typ_def_t intypdef 
)

Consume a type-stmt for metadata.

Parse the next token as a type declaration for an ncx:metadata definition

Error messages are printed by this function!! Do not duplicate error messages upon error return

Parameters
pcbparser control block
tkctoken chain
modmodule in progress
intypdefstruct that will get the type info
Returns
status of the operation
status_t yang_typ_consume_type ( yang_pcb_t pcb,
tk_chain_t tkc,
ncx_module_t mod,
typ_def_t intypdef 
)

Consume a type-stmt.

Parse the next N tokens as a type clause Add to the typ_template_t struct in progress

Error messages are printed by this function!! Do not duplicate error messages upon error return

Current token is the 'type' keyword

Parameters
pcbparser control block
tkctoken chain
modmodule in progress
intypdefstruct that will get the type info
Returns
status of the operation

Here is the caller graph for this function:

status_t yang_typ_consume_typedef ( yang_pcb_t pcb,
tk_chain_t tkc,
ncx_module_t mod,
dlq_hdr_t *  que 
)

Consume a typedef-stmt.

Parse the next N tokens as a typedef clause Create a typ_template_t struct and add it to the specified module

Error messages are printed by this function!! Do not duplicate error messages upon error return

Current token is the 'typedef' keyword

Parameters
pcbparser control block
tkctoken chain
modmodule in progress
quequeue will get the typ_template_t
Returns
status of the operation

Here is the call graph for this function:

Here is the caller graph for this function:

boolean yang_typ_enubit_enabled ( typ_enum_t enubit)

Check if an enum or bit is enabled.

Check an enum or bits typdef for if-feature-stmts Evaluate and determine if the enum or bit is enabled

Parameters
enubitenum or bit from the typdef to check
Returns
TRUE if enabled; FALSE if not or some error

Here is the call graph for this function:

boolean yang_typ_identity_enabled ( ncx_identity_t id)

Check if an identity-stmt is enabled.

Check an identity-stmt for if-feature-stmts Evaluate and determine if the identity is enabled

Parameters
ididentity from the tpedef to check
Returns
TRUE if enabled; FALSE if not or some error

Here is the call graph for this function:

status_t yang_typ_rangenum_ok ( typ_def_t typdef,
const ncx_num_t num 
)

Check is a range number is OK.

Check a typdef for range definitions and check if the specified number passes all the range checks (if any)

Parameters
typdeftypdef to check
numnumber to check
Returns
status of the operation

Here is the call graph for this function:

status_t yang_typ_resolve_leafref ( yang_pcb_t pcb,
tk_chain_t tkc,
ncx_module_t mod,
obj_template_t testobj 
)

Resolve the typdef in a leafref leaf or leaf-list.

Parameters
pcbparser control block
tkctoken chain
mod[sub]module in progress within the tree walking
testobjobject to check
Returns
status of the operation

Here is the call graph for this function:

status_t yang_typ_resolve_type ( yang_pcb_t pcb,
tk_chain_t tkc,
ncx_module_t mod,
typ_def_t typdef,
const xmlChar *  defval,
obj_template_t obj 
)

Resolve a type-stmt.

Analyze the typdef within a single leaf or leaf-list statement Finish if a named type, and/or range clauses present, which were left unfinished due to possible forward references

  Algorithm for checking named types in 4 separate loops:
    1) resolve all open type name references
    2) check for any name loops in all named types
    3) check that all base types and builtin types
       in each type chain are correct.  Also check that
       all restrictions given are correct for that type
    4) Check all range clauses and resolve all min/max
       keyword uses to decimal numbers and validate that
       each range is well-formed.

Error messages are printed by this function!! Do not duplicate error messages upon error return

Parameters
pcbparser control block
tkctoken chain from parsing (needed for error msgs)
modmodule in progress
typdeftypdef struct from leaf or leaf-list to check
defvaldefault value string for this leaf (may be NULL)
objobj_template containing this typdef
NULL if this is a top-level union typedef, checking its nested unnamed type clauses
Returns
status of the operation
status_t yang_typ_resolve_type_final ( tk_chain_t tkc,
ncx_module_t mod,
typ_def_t typdef,
const xmlChar *  name,
const xmlChar *  defval,
obj_template_t obj 
)

Resolve a type-stmt (final pass)

Check default values for XPath types

Error messages are printed by this function!! Do not duplicate error messages upon error return

Parameters
tkctoken chain from parsing (needed for error msgs)
modmodule in progress
typdeftypdef struct from leaf or leaf-list to check
nametype name id any
defvaldefault value string for this leaf (may be NULL)
objobj_template containing this typdef
NULL if this is a top-level union typedef, checking its nested unnamed type clauses
Returns
status of the operation
status_t yang_typ_resolve_typedefs ( yang_pcb_t pcb,
tk_chain_t tkc,
ncx_module_t mod,
dlq_hdr_t *  typeQ,
obj_template_t parent 
)

Resovlve the typeQ of typedefs.

Analyze the entire typeQ within the module struct Finish all the named types and range clauses, which were left unfinished due to possible forward references

Check all the types in the Q If a type has validation errors, it will be removed from the typeQ

  Algorithm for checking named types in 4 separate loops:
    1) resolve all open type name references
    2) check for any name loops in all named types
    3) check that all base types and builtin types
       in each type chain are correct.  Also check that
       all restrictions given are correct for that type
    4) Check all range clauses and resolve all min/max
       keyword uses to decimal numbers and validate that
       each range is well-formed.

Error messages are printed by this function!! Do not duplicate error messages upon error return

Parameters
pcbparser control block
tkctoken chain
modmodule in progress
typeQqueue of typ_template_t to check
parentobj_template containing this typeQ
NULL if this is a module-level typeQ
Returns
status of the operation
status_t yang_typ_resolve_typedefs_final ( tk_chain_t tkc,
ncx_module_t mod,
dlq_hdr_t *  typeQ 
)

Resolve typedefs (final pass)

Analyze the entire typeQ within the module struct Finish all default value checking that was not done before

Error messages are printed by this function!! Do not duplicate error messages upon error return

Parameters
tkctoken chain
modmodule in progress
typeQqueue of typ_template_t to check
Returns
status of the operation
status_t yang_typ_resolve_typedefs_grp ( yang_pcb_t pcb,
tk_chain_t tkc,
ncx_module_t mod,
dlq_hdr_t *  typeQ,
obj_template_t parent,
grp_template_t grp 
)

Resolve typedefs in a grouping (final pass)

Analyze the entire typeQ within the module struct Finish all the named types and range clauses, which were left unfinished due to possible forward references

Check all the types in the Q If a type has validation errors, it will be removed from the typeQ

  Algorithm for checking named types in 4 separate loops:
    1) resolve all open type name references
    2) check for any name loops in all named types
    3) check that all base types and builtin types
       in each type chain are correct.  Also check that
       all restrictions given are correct for that type
    4) Check all range clauses and resolve all min/max
       keyword uses to decimal numbers and validate that
       each range is well-formed.

Error messages are printed by this function!! Do not duplicate error messages upon error return

Parameters
pcbparser control block
tkctoken chain
modmodule in progress
typeQqueue of typ_template_t to check
parentobj_template containing this typeQ
NULL if this is a module-level typeQ
grpgrp_template containing this typedef
Returns
status of the operation

Here is the caller graph for this function: