yumapro  24.10-3
YumaPro SDK
Loading...
Searching...
No Matches

YANG Parser Control Block and General Access Functions. More...

Collaboration diagram for Parser Utilities:

Data Structures

struct  yang_stmt_t
 YANG statement node to track top-level statement order for doc output. More...
 
struct  yang_node_t
 YANG node entry to track if a module has been used already. More...
 
struct  yang_import_ptr_t
 YANG import pointer node to track all imports used. More...
 
struct  failed_ptr_t
 pointer to failed modules to track all of them Prevents loading a broken module multiple times More...
 
struct  yang_pcb_t
 YANG parser control block. More...
 

Enumerations

enum  yang_parsetype_t {
  YANG_PT_NONE ,
  YANG_PT_TOP ,
  YANG_PT_INCLUDE ,
  YANG_PT_IMPORT
}
 YANG parser mode entry types. More...
 

Functions

status_t yang_consume_semiapp (tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *appinfoQ)
 consume a stmtsep clause More...
 
status_t yang_consume_semiapp2 (tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *appinfoQ, boolean plain_ok)
 consume a stmtsep clause, check plain_ok More...
 
status_t yang_consume_string (tk_chain_t *tkc, ncx_module_t *mod, xmlChar **field)
 consume 1 string token More...
 
status_t yang_consume_keyword (tk_chain_t *tkc, ncx_module_t *mod, xmlChar **prefix, xmlChar **field)
 consume 1 YANG keyword or vendor extension keyword More...
 
status_t yang_consume_nowsp_string (tk_chain_t *tkc, ncx_module_t *mod, xmlChar **field)
 consume 1 string without any whitespace More...
 
status_t yang_consume_id_string (tk_chain_t *tkc, ncx_module_t *mod, xmlChar **field)
 consume an identifier-str token More...
 
status_t yang_consume_pid_string (tk_chain_t *tkc, ncx_module_t *mod, xmlChar **prefix, xmlChar **field)
 consume an identifier-ref-str token More...
 
status_t yang_consume_error_stmts (tk_chain_t *tkc, ncx_module_t *mod, ncx_errinfo_t *errinfo, dlq_hdr_t *appinfoQ, boolean allow_modifier, boolean *gotinverted)
 consume the range. More...
 
status_t yang_consume_descr (tk_chain_t *tkc, ncx_module_t *mod, xmlChar **str, boolean *dupflag, dlq_hdr_t *appinfoQ)
 consume one descriptive string clause More...
 
status_t yang_consume_pid (tk_chain_t *tkc, ncx_module_t *mod, xmlChar **prefixstr, xmlChar **str, boolean *dupflag, dlq_hdr_t *appinfoQ)
 consume one [prefix:]name clause More...
 
status_t yang_consume_strclause (tk_chain_t *tkc, ncx_module_t *mod, xmlChar **str, boolean *dupflag, dlq_hdr_t *appinfoQ)
 consume one normative string clause More...
 
status_t yang_consume_status (tk_chain_t *tkc, ncx_module_t *mod, ncx_status_t *status, boolean *dupflag, dlq_hdr_t *appinfoQ)
 consume one status clause More...
 
status_t yang_consume_ordered_by (tk_chain_t *tkc, ncx_module_t *mod, boolean *ordsys, boolean *dupflag, dlq_hdr_t *appinfoQ)
 consume one ordered-by clause More...
 
status_t yang_consume_max_elements (tk_chain_t *tkc, ncx_module_t *mod, uint32 *maxelems, boolean *dupflag, dlq_hdr_t *appinfoQ)
 consume one max-elements clause More...
 
status_t yang_consume_must (tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *mustQ, dlq_hdr_t *appinfoQ, boolean do_parse)
 consume one must-stmt into mustQ More...
 
status_t yang_consume_when (tk_chain_t *tkc, ncx_module_t *mod, obj_template_t *obj, boolean *whenflag)
 consume one when-stmt into obj->when More...
 
status_t yang_consume_boolean (tk_chain_t *tkc, ncx_module_t *mod, boolean *boolval, boolean *dupflag, dlq_hdr_t *appinfoQ)
 consume one boolean clause Parse the boolean parameter based statement More...
 
status_t yang_consume_int32 (tk_chain_t *tkc, ncx_module_t *mod, int32 *num, boolean *dupflag, dlq_hdr_t *appinfoQ)
 consume one int32 clause Parse the int32 based parameter statement More...
 
status_t yang_consume_uint32 (tk_chain_t *tkc, ncx_module_t *mod, uint32 *num, boolean *dupflag, dlq_hdr_t *appinfoQ)
 consume one uint32 clause More...
 
status_t yang_consume_modifier (tk_chain_t *tkc, ncx_module_t *mod, boolean *dupflag, dlq_hdr_t *appinfoQ)
 consume one modifier-stmt More...
 
status_t yang_find_imp_typedef (yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, const xmlChar *prefix, const xmlChar *name, ncx_error_t *tkerr, typ_template_t **typ)
 Find the specified imported typedef. More...
 
status_t yang_find_imp_grouping (yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, const xmlChar *prefix, const xmlChar *name, ncx_error_t *tkerr, grp_template_t **grp)
 Find the specified imported grouping. More...
 
status_t yang_find_imp_extension (yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, const xmlChar *prefix, const xmlChar *name, ncx_error_t *tkerr, ext_template_t **ext)
 Find the specified imported extension. More...
 
status_t yang_find_imp_feature (yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, const xmlChar *prefix, const xmlChar *name, ncx_error_t *tkerr, ncx_feature_t **feature)
 Find the specified imported feature. More...
 
status_t yang_find_imp_identity (yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, const xmlChar *prefix, const xmlChar *name, ncx_error_t *tkerr, ncx_identity_t **identity)
 Find the specified imported identity. More...
 
void yang_check_obj_used (tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *typeQ, dlq_hdr_t *grpQ)
 generate warnings if local typedefs/groupings not used More...
 
void yang_check_imports_used (tk_chain_t *tkc, ncx_module_t *mod)
 generate warnings if imports not used More...
 
yang_node_tyang_new_node (void)
 Create a new YANG parser node. More...
 
void yang_free_node (yang_node_t *node)
 Clean and delete the memory for a YANG parser node. More...
 
void yang_clean_nodeQ (dlq_hdr_t *que)
 Delete all the node entries in a YANG parser node Q. More...
 
yang_node_tyang_find_node (const dlq_hdr_t *que, const xmlChar *name, const xmlChar *revision)
 Find a YANG parser node in the specified Q. More...
 
void yang_dump_nodeQ (dlq_hdr_t *que, const char *name)
 log_debug output for contents of the specified nodeQ More...
 
yang_pcb_tyang_new_pcb (void)
 Create a new YANG parser control block. More...
 
void yang_free_pcb (yang_pcb_t *pcb)
 Delete a YANG parser control block. More...
 
yang_stmt_tyang_new_typ_stmt (typ_template_t *typ)
 Create a new YANG stmt node for a typedef. More...
 
yang_stmt_tyang_new_grp_stmt (grp_template_t *grp)
 Create a new YANG stmt node for a grouping. More...
 
yang_stmt_tyang_new_ext_stmt (ext_template_t *ext)
 Create a new YANG stmt node for an extension. More...
 
yang_stmt_tyang_new_obj_stmt (obj_template_t *obj)
 Create a new YANG stmt node for an object. More...
 
yang_stmt_tyang_new_id_stmt (ncx_identity_t *identity)
 Create a new YANG stmt node for an identity. More...
 
yang_stmt_tyang_new_feature_stmt (ncx_feature_t *feature)
 Create a new YANG stmt node for a feature definition. More...
 
yang_stmt_tyang_new_deviation_stmt (obj_deviation_t *deviation)
 Create a new YANG stmt node for a deviation definition. More...
 
void yang_free_stmt (yang_stmt_t *stmt)
 Delete a YANG statement node. More...
 
void yang_clean_stmtQ (dlq_hdr_t *que)
 Delete a Q of YANG statement node. More...
 
status_t yang_validate_date_string (tk_chain_t *tkc, ncx_module_t *mod, ncx_error_t *tkerr, const xmlChar *datestr)
 Validate a YANG date string for a revision entry. More...
 
void yang_skip_statement (tk_chain_t *tkc, ncx_module_t *mod)
 Skip past the current invalid statement, starting at an invalid keyword. More...
 
boolean yang_top_keyword (const xmlChar *keyword)
 Check if the string is a top-level YANG keyword. More...
 
yang_import_ptr_tyang_new_import_ptr (const xmlChar *modname, const xmlChar *modprefix, const xmlChar *revision, const xmlChar *descr, const xmlChar *ref)
 Create a new YANG import pointer node. More...
 
void yang_free_import_ptr (yang_import_ptr_t *impptr)
 Delete a YANG import pointer node. More...
 
void yang_clean_import_ptrQ (dlq_hdr_t *que)
 Delete all the node entries in a YANG import pointer node Q. More...
 
yang_import_ptr_tyang_find_import_ptr (dlq_hdr_t *que, const xmlChar *name)
 Find a YANG import pointer node in the specified Q. More...
 
int32 yang_compare_revision_dates (const xmlChar *revstring1, const xmlChar *revstring2)
 Compare 2 revision strings, which either may be NULL. More...
 
xmlChar * yang_make_filename (const xmlChar *modname, const xmlChar *revision, boolean isyang)
 Malloc and construct a YANG filename. More...
 
status_t yang_copy_filename (const xmlChar *modname, const xmlChar *revision, xmlChar *buffer, uint32 bufflen, boolean isyang)
 Construct a YANG filename into a provided buffer. More...
 
boolean yang_split_filename (const xmlChar *filename, uint32 *modnamelen)
 Split a module parameter into its filename components. More...
 
boolean yang_fileext_is_yang (const xmlChar *filename)
 Check if the filespec ends with the .yang extension. More...
 
boolean yang_fileext_is_yin (const xmlChar *filename)
 Check if the filespec ends with the .yin extension. More...
 
boolean yang_fileext_is_xml (const xmlChar *filename)
 Check if the filespec ends with the .xml extension. More...
 
boolean yang_fileext_is_json (const xmlChar *filename)
 Check if the filespec ends with the .json extension. More...
 
void yang_final_memcheck (void)
 Check the node malloc and free counts. More...
 
void yang_set_in_yangdata (yang_pcb_t *pcb, boolean val)
 Set the in_yangdata mode. More...
 
boolean yang_is_in_yangdata (const yang_pcb_t *pcb)
 Get the in_yangdata mode. More...
 
status_t yang_extract_filespec_info (const char *filespec, xmlChar **modname, xmlChar **revision, boolean *isyang)
 Split a filespec into its filename components. More...
 
void yang_clean_pcb_top (yang_pcb_t *pcb)
 Make sure pcb->top is freed before the pcb is reused after the bestmatch failed and NULL revision is tried. More...
 
xmlChar * yang_make_sid_filename (const xmlChar *modname, const xmlChar *revision)
 Malloc and construct a SID filename. More...
 
uint32 yang_hash (const xmlChar *key, uint32 len)
 Generate a yang-hash for the specified key. More...
 

Detailed Description

YANG Parser Control Block and General Access Functions.

Support Experimental YANG Hash identifiers (NOT USED)

Enumeration Type Documentation

◆ yang_parsetype_t

YANG parser mode entry types.

Enumerator
YANG_PT_NONE 

not set

YANG_PT_TOP 

called from top level [sub]module

YANG_PT_INCLUDE 

called from module include-stmt

YANG_PT_IMPORT 

called from module import-stmt

Function Documentation

◆ yang_check_imports_used()

void yang_check_imports_used ( tk_chain_t tkc,
ncx_module_t mod 
)

generate warnings if imports not used

Check if the imports statements are actually used Check if the import is newer than the importing module Generate warnings if so

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

Parameters
tkctoken chain in progress
modmodule in progress
Here is the call graph for this function:

◆ yang_check_obj_used()

void yang_check_obj_used ( tk_chain_t tkc,
ncx_module_t mod,
dlq_hdr_t *  typeQ,
dlq_hdr_t *  grpQ 
)

generate warnings if local typedefs/groupings not used

Check if the local typedefs and groupings are actually used Generate warnings if not used

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

Parameters
tkctoken chain in progress
modmodule in progress
typeQtypedef Q to check
grpQpgrouping Q to check
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_clean_import_ptrQ()

void yang_clean_import_ptrQ ( dlq_hdr_t *  que)

Delete all the node entries in a YANG import pointer node Q.

Parameters
queQ of yang_import_ptr_t to clean
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_clean_nodeQ()

void yang_clean_nodeQ ( dlq_hdr_t *  que)

Delete all the node entries in a YANG parser node Q.

Parameters
queQ of yang_node_t to clean
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_clean_pcb_top()

void yang_clean_pcb_top ( yang_pcb_t pcb)

Make sure pcb->top is freed before the pcb is reused after the bestmatch failed and NULL revision is tried.

Parameters
pcbpcb to clean
Here is the call graph for this function:

◆ yang_clean_stmtQ()

void yang_clean_stmtQ ( dlq_hdr_t *  que)

Delete a Q of YANG statement node.

Parameters
queQ of yang_stmt_t node to delete
Here is the call graph for this function:

◆ yang_compare_revision_dates()

int32 yang_compare_revision_dates ( const xmlChar *  revstring1,
const xmlChar *  revstring2 
)

Compare 2 revision strings, which either may be NULL.

Parameters
revstring1revision string 1 (may be NULL)
revstring2revision string 2 (may be NULL)
Returns
compare result
     -1 if revision 1 < revision 2
     0 of they are the same
     +1 if revision1 > revision 2
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_consume_boolean()

status_t yang_consume_boolean ( tk_chain_t tkc,
ncx_module_t mod,
boolean *  boolval,
boolean *  dupflag,
dlq_hdr_t *  appinfoQ 
)

consume one boolean clause Parse the boolean parameter based statement

Current token is the starting keyword

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

Parameters
tkctoken chain
modmodule in progress
[out]boolvalboolean value to set (may be NULL)
  • *boolval set if NO_ERR
[out]dupflagaddress of flag to check if entry already found
  • may be NUL
  • *dupflag set to TRUE if field already set
[out]appinfoQQ to hold any extensions found
  • *appinfoQ filled in with any extensions found
Returns
status of the operation
Here is the call graph for this function:

◆ yang_consume_descr()

status_t yang_consume_descr ( tk_chain_t tkc,
ncx_module_t mod,
xmlChar **  str,
boolean *  dupflag,
dlq_hdr_t *  appinfoQ 
)

consume one descriptive string clause

Parse the description or reference statement

Current token is the starting keyword

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

Parameters
tkctoken chain
modmodule in progress
[in,out]strstring to set (may be NULL)
  • *str set to the value if str not NULL
[out]dupflagflag to check if entry already found (may be NULL)
  • *dupflag set to TRUE if field already set
[out]appinfoQQ to hold any extensions found
  • *appinfoQ filled in with any extensions found
Returns
status of the operation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_consume_error_stmts()

status_t yang_consume_error_stmts ( tk_chain_t tkc,
ncx_module_t mod,
ncx_errinfo_t errinfo,
dlq_hdr_t *  appinfoQ,
boolean  allow_modifier,
boolean *  gotinverted 
)

consume the range.

length. pattern. must error info extensions

Parse the sub-section as a sub-section for error-app-tag and error-message clauses

Current token is the starting left brace for the sub-section that is extending a range, length, pattern, or must statement

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

Parameters
tkctoken chain
modmodule in progress
[out]errinfopointer to valid ncx_errinfo_t struct
  • *errinfo filled in with any clauses found
[out]appinfoQQ to hold any extensions found
  • *appinfoQ filled in with any extensions found
allow_modifierTRUE to check for YANG 1.1 modifier keyword
[out]gotinvertedaddress of return got invert-match flag
  • *gotinverted TRUE if got invert-match flag
Returns
status of the operation
Here is the call graph for this function:

◆ yang_consume_id_string()

status_t yang_consume_id_string ( tk_chain_t tkc,
ncx_module_t mod,
xmlChar **  field 
)

consume an identifier-str token

Consume a YANG string token in any of the 3 forms Check that it is a valid YANG identifier string

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

current token is advanced

Parameters
tkctoken chain
modmodule in progress
[out]fieldaddress of field to get the name string (may be NULL)
  • *field is set with a malloced string in NO_ERR
Returns
status of the operation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_consume_int32()

status_t yang_consume_int32 ( tk_chain_t tkc,
ncx_module_t mod,
int32 *  num,
boolean *  dupflag,
dlq_hdr_t *  appinfoQ 
)

consume one int32 clause Parse the int32 based parameter statement

Current token is the starting keyword

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

Parameters
tkctoken chain
modmodule in progress
[out]numaddress of int32 value to set (may be NULL)
  • *num set to the value if NO_ERR
[out]dupflagaddress of flag to check if entry already found
  • may be NUL
  • *dupflag set to TRUE if field already set
[out]appinfoQQ to hold any extensions found
  • *appinfoQ filled in with any extensions found
Returns
status of the operation
Here is the call graph for this function:

◆ yang_consume_keyword()

status_t yang_consume_keyword ( tk_chain_t tkc,
ncx_module_t mod,
xmlChar **  prefix,
xmlChar **  field 
)

consume 1 YANG keyword or vendor extension keyword

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

current token is advanced

Parameters
tkctoken chain
modmodule in progress
[out]prefixaddress of field to get the prefix string (may be NULL)
  • *prefix is set with a malloced string in NO_ERR
[out]fieldaddress of field to get the name string (may be NULL)
  • *field is set with a malloced string in NO_ERR
Returns
status of the operation
Here is the call graph for this function:

◆ yang_consume_max_elements()

status_t yang_consume_max_elements ( tk_chain_t tkc,
ncx_module_t mod,
uint32 *  maxelems,
boolean *  dupflag,
dlq_hdr_t *  appinfoQ 
)

consume one max-elements clause

Parse the max-elements statement

Current token is the 'max-elements' keyword

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

Parameters
tkctoken chain
modmodule in progress
[out]maxelemsaddress of max-elements object to set (may be NULL)
  • *maxelems set to the value if not NULL
[out]dupflagaddress of flag to check if entry already found
  • may be NUL
  • *dupflag set to TRUE if field already set
[out]appinfoQQ to hold any extensions found
  • *appinfoQ filled in with any extensions found
Returns
status of the operation
Here is the call graph for this function:

◆ yang_consume_modifier()

status_t yang_consume_modifier ( tk_chain_t tkc,
ncx_module_t mod,
boolean *  dupflag,
dlq_hdr_t *  appinfoQ 
)

consume one modifier-stmt

Current token is the 'modifier' keyword

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

Only modifier supported is invert-match This code simply checks the syntax and does not set any fields

Parameters
tkctoken chain
modmodule in progress
[out]dupflagaddress of flag to check if entry already found
  • may be NUL
  • *dupflag set to TRUE if field already set
[out]appinfoQQ to hold any extensions found
  • *appinfoQ filled in with any extensions found
Returns
status of the operation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_consume_must()

status_t yang_consume_must ( tk_chain_t tkc,
ncx_module_t mod,
dlq_hdr_t *  mustQ,
dlq_hdr_t *  appinfoQ,
boolean  do_parse 
)

consume one must-stmt into mustQ

Parse the must statement

Current token is the 'must' keyword

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

Parameters
tkctoken chain
modmodule in progress
[out]mustQaddress of Q of xpath_pcb_t structs to store a new malloced xpath_pcb_t
  • mustQ entry malloced and added to mustQ (if NO_ERR)
[out]appinfoQQ to hold any extensions found
  • *appinfoQ filled in with any extensions found
do_parseTRUE to attempt xpath1_parse_expr; FALSE to skip
Returns
status of the operation
Here is the call graph for this function:

◆ yang_consume_nowsp_string()

status_t yang_consume_nowsp_string ( tk_chain_t tkc,
ncx_module_t mod,
xmlChar **  field 
)

consume 1 string without any whitespace

Consume a YANG string token in any of the 3 forms Check No whitespace allowed!

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

current token is advanced

Parameters
tkctoken chain
modmodule in progress
[out]fieldaddress of field to get the name string (may be NULL)
  • *field is set with a malloced string in NO_ERR
Returns
status of the operation
Here is the call graph for this function:

◆ yang_consume_ordered_by()

status_t yang_consume_ordered_by ( tk_chain_t tkc,
ncx_module_t mod,
boolean *  ordsys,
boolean *  dupflag,
dlq_hdr_t *  appinfoQ 
)

consume one ordered-by clause

Parse the ordered-by statement

Current token is the 'ordered-by' keyword

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

Parameters
tkctoken chain
modmodule in progress
[out]ordsysaddress of ordered-by object to set
  • may be NUL
  • *ordsys set to the value if ordsys not NULL
[out]dupflagaddress of flag to check if entry already found
  • may be NULL
  • *dupflag set to TRUE if field already set
[out]appinfoQQ to hold any extensions found
  • *appinfoQ filled in with any extensions found
Returns
status of the operation
Here is the call graph for this function:

◆ yang_consume_pid()

status_t yang_consume_pid ( tk_chain_t tkc,
ncx_module_t mod,
xmlChar **  prefixstr,
xmlChar **  str,
boolean *  dupflag,
dlq_hdr_t *  appinfoQ 
)

consume one [prefix:]name clause

Parse the rest of the statement (2 forms):

         keyword [prefix:]name;

         keyword [prefix:]name { appinfo }

Current token is the starting keyword

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

Parameters
tkctoken chain
modmodule in progress
[out]prefixstraddress of prefix string to set (may be NULL)
  • *prefixstr set to the prefix value is any, if str not NULL
[out]straddress of string to set (may be NULL)
  • *str set to the value if str not NULL
[out]dupflagaddress of flag to check if entry already found
  • may be NULL
  • *dupflag set to TRUE if field already set
[out]appinfoQQ to hold any extensions found
  • *appinfoQ filled in with any extensions found
Returns
status of the operation
Here is the call graph for this function:

◆ yang_consume_pid_string()

status_t yang_consume_pid_string ( tk_chain_t tkc,
ncx_module_t mod,
xmlChar **  prefix,
xmlChar **  field 
)

consume an identifier-ref-str token

Consume a YANG string token in any of the 3 forms Check that it is a valid identifier-ref-string Get the prefix if any is set

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

current token is advanced

Parameters
tkctoken chain
modmodule in progress
[out]prefixaddress of field to get the prefix string (may be NULL)
  • *prefix is set with a malloced string in NO_ERR
[out]fieldaddress of field to get the name string (may be NULL)
  • *field is set with a malloced string in NO_ERR
Returns
status of the operation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_consume_semiapp()

status_t yang_consume_semiapp ( tk_chain_t tkc,
ncx_module_t mod,
dlq_hdr_t *  appinfoQ 
)

consume a stmtsep clause

Consume a semi-colon to end a simple clause, or consume a vendor extension

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

Parameters
tkctoken chain
modmodule in progress
[out]appinfoQqueue to receive any vendor extension found
  • *appinfoQ has the extesnion added if any current token is advanced
Returns
status of the operation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_consume_semiapp2()

status_t yang_consume_semiapp2 ( tk_chain_t tkc,
ncx_module_t mod,
dlq_hdr_t *  appinfoQ,
boolean  plain_ok 
)

consume a stmtsep clause, check plain_ok

Consume a semi-colon to end a simple clause, or consume a vendor extension

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

Parameters
tkctoken chain
modmodule in progress
[out]appinfoQqueue to receive any vendor extension found
  • *appinfoQ has the extesnion added if any current token is advanced
plain_okTRUE if plain YANG OK; FALSE if only ext. stmts
Returns
status of the operation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_consume_status()

status_t yang_consume_status ( tk_chain_t tkc,
ncx_module_t mod,
ncx_status_t status,
boolean *  dupflag,
dlq_hdr_t *  appinfoQ 
)

consume one status clause

Parse the status statement

Current token is the 'status' keyword

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

Parameters
tkctoken chain
modmodule in progress
[out]statusaddress of status object to set (may be NULL)
  • *status set to the value if status not NULL
[out]dupflagaddress of flag to check if entry already found
  • may be NULL
  • *dupflag set to TRUE if field already set
[out]appinfoQQ to hold any extensions found
  • *appinfoQ filled in with any extensions found
Returns
status of the operation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_consume_strclause()

status_t yang_consume_strclause ( tk_chain_t tkc,
ncx_module_t mod,
xmlChar **  str,
boolean *  dupflag,
dlq_hdr_t *  appinfoQ 
)

consume one normative string clause

Parse the string-parameter-based statement

Current token is the starting keyword

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

Parameters
tkctoken chain
modmodule in progress
[out]straddress of string to set
  • may be NULL
  • *str set to the value if str not NULL
[out]dupflagaddress of flag to check if entry already found
  • may be NULL
  • *dupflag set to TRUE if field already set
[out]appinfoQQ to hold any extensions found
  • *appinfoQ filled in with any extensions found
Returns
status of the operation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_consume_string()

status_t yang_consume_string ( tk_chain_t tkc,
ncx_module_t mod,
xmlChar **  field 
)

consume 1 string token

Consume a YANG string token in any of the 3 forms

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

Parameters
tkctoken chain
modmodule in progress
[out]fieldaddress of field to get the string (may be NULL)
  • *field is set with a malloced string in NO_ERR current token is advanced
Returns
status of the operation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_consume_uint32()

status_t yang_consume_uint32 ( tk_chain_t tkc,
ncx_module_t mod,
uint32 *  num,
boolean *  dupflag,
dlq_hdr_t *  appinfoQ 
)

consume one uint32 clause

Parse the uint32 based parameter statement

Current token is the starting keyword

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

Parameters
tkctoken chain
modmodule in progress
[out]numaddress of uint32 value to set (may be NULL)
  • *num set if NO_ERR
[out]dupflagaddress of flag to check if entry already found
  • may be NUL
  • *dupflag set to TRUE if field already set
[out]appinfoQQ to hold any extensions found
  • *appinfoQ filled in with any extensions found
Returns
status of the operation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_consume_when()

status_t yang_consume_when ( tk_chain_t tkc,
ncx_module_t mod,
obj_template_t obj,
boolean *  whenflag 
)

consume one when-stmt into obj->when

Parse the when statement

Current token is the 'when' keyword

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

Parameters
tkctoken chain
modmodule in progress
[out]objobj_template_t of the parent object of this 'when'
  • obj->when malloced and filled in
[out]whenflagaddress of boolean set-once flag for the when-stmt an error will be generated if the value passed in is TRUE.
  • Set the initial value to FALSE before first call, and do not change it after that
    • *whenflag set if not set already
Returns
status of the operation
Here is the call graph for this function:

◆ yang_copy_filename()

status_t yang_copy_filename ( const xmlChar *  modname,
const xmlChar *  revision,
xmlChar *  buffer,
uint32  bufflen,
boolean  isyang 
)

Construct a YANG filename into a provided buffer.

Parameters
modname[sub]module name
revision[sub]module revision date (may be NULL)
bufferbuffer to copy filename into
bufflennumber of bytes available in buffer
isyangTRUE for YANG extension
FALSE for YIN extension
Returns
malloced and filled in string buffer with filename
NULL if any error
Here is the call graph for this function:

◆ yang_dump_nodeQ()

void yang_dump_nodeQ ( dlq_hdr_t *  que,
const char *  name 
)

log_debug output for contents of the specified nodeQ

Parameters
queQ of yang_node_t to check
nameQ name (may be NULL)
Here is the call graph for this function:

◆ yang_extract_filespec_info()

status_t yang_extract_filespec_info ( const char *  filespec,
xmlChar **  modname,
xmlChar **  revision,
boolean *  isyang 
)

Split a filespec into its filename components.

Parameters
filespecfilespec string
[out]modnameaddress of return malloced module name
  • *modname malloced mod name string (must free with m__free)
[out]revisionaddress of return malloced revision date
  • *revision malloced revision date string (must free with m__free)
[out]isyangaddress of return yang/yin flag
  • *isyang TRUE if .yang, FALSE if .yin
Returns
status
Here is the call graph for this function:

◆ yang_fileext_is_json()

boolean yang_fileext_is_json ( const xmlChar *  filename)

Check if the filespec ends with the .json extension.

Parameters
filenamefilename string
Returns
TRUE if .json file extension found
FALSE if not
Here is the call graph for this function:

◆ yang_fileext_is_xml()

boolean yang_fileext_is_xml ( const xmlChar *  filename)

Check if the filespec ends with the .xml extension.

Parameters
filenamefilename string
Returns
TRUE if .xml file extension found
FALSE if not
Here is the call graph for this function:

◆ yang_fileext_is_yang()

boolean yang_fileext_is_yang ( const xmlChar *  filename)

Check if the filespec ends with the .yang extension.

Parameters
filenamefilename string
Returns
TRUE if .yang file extension found
FALSE if not
Here is the call graph for this function:

◆ yang_fileext_is_yin()

boolean yang_fileext_is_yin ( const xmlChar *  filename)

Check if the filespec ends with the .yin extension.

Parameters
filenamefilename string
Returns
TRUE if .yin file extension found
FALSE if not
Here is the call graph for this function:

◆ yang_final_memcheck()

void yang_final_memcheck ( void  )

Check the node malloc and free counts.

◆ yang_find_imp_extension()

status_t yang_find_imp_extension ( yang_pcb_t pcb,
tk_chain_t tkc,
ncx_module_t mod,
const xmlChar *  prefix,
const xmlChar *  name,
ncx_error_t tkerr,
ext_template_t **  ext 
)

Find the specified imported extension.

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

Parameters
pcbparser control block to use
tkctoken chain
modmodule in progress
prefixprefix value to use
nameextension name to use
tkerrerror record to use in error messages (may be NULL)
[out]extaddress of return ext_template_t pointer
Returns
status of the operation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_find_imp_feature()

status_t yang_find_imp_feature ( yang_pcb_t pcb,
tk_chain_t tkc,
ncx_module_t mod,
const xmlChar *  prefix,
const xmlChar *  name,
ncx_error_t tkerr,
ncx_feature_t **  feature 
)

Find the specified imported feature.

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

Parameters
pcbparser control block to use
tkctoken chain
modmodule in progress
prefixprefix value to use
namefeature name to use
tkerrerror record to use in error messages (may be NULL)
[out]featureaddress of return ncx_feature_t pointer
Returns
status of the operation
Here is the call graph for this function:

◆ yang_find_imp_grouping()

status_t yang_find_imp_grouping ( yang_pcb_t pcb,
tk_chain_t tkc,
ncx_module_t mod,
const xmlChar *  prefix,
const xmlChar *  name,
ncx_error_t tkerr,
grp_template_t **  grp 
)

Find the specified imported grouping.

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

Parameters
pcbparser control block to use
tkctoken chain
modmodule in progress
prefixprefix value to use
namegrouping name to use
tkerrerror record to use in error messages (may be NULL)
[out]grpaddress of return grp_template_t pointer
Returns
status of the operation
Here is the call graph for this function:

◆ yang_find_imp_identity()

status_t yang_find_imp_identity ( yang_pcb_t pcb,
tk_chain_t tkc,
ncx_module_t mod,
const xmlChar *  prefix,
const xmlChar *  name,
ncx_error_t tkerr,
ncx_identity_t **  identity 
)

Find the specified imported identity.

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

Parameters
pcbparser control block to use
tkctoken chain
modmodule in progress
prefixprefix value to use
namefeature name to use
tkerrerror record to use in error messages (may be NULL)
[out]identityaddress of return ncx_identity_t pointer
Returns
status of the operation
Here is the call graph for this function:

◆ yang_find_imp_typedef()

status_t yang_find_imp_typedef ( yang_pcb_t pcb,
tk_chain_t tkc,
ncx_module_t mod,
const xmlChar *  prefix,
const xmlChar *  name,
ncx_error_t tkerr,
typ_template_t **  typ 
)

Find the specified imported typedef.

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

Parameters
pcbparser control block to use
tkctoken chain
modmodule in progress
prefixprefix value to use
nametype name to find
tkerrerror record to use in error messages (may be NULL)
[out]typaddress of return typ_template_t pointer
Returns
status of the operation
Here is the call graph for this function:

◆ yang_find_import_ptr()

yang_import_ptr_t * yang_find_import_ptr ( dlq_hdr_t *  que,
const xmlChar *  name 
)

Find a YANG import pointer node in the specified Q.

Parameters
queQ of yang_import_ptr_t to check
namemodule name to find
Returns
pointer to found node, NULL if not found
Here is the call graph for this function:

◆ yang_find_node()

yang_node_t * yang_find_node ( const dlq_hdr_t *  que,
const xmlChar *  name,
const xmlChar *  revision 
)

Find a YANG parser node in the specified Q.

Parameters
queQ of yang_node_t to check
namemodule name to find
revisionmodule revision date (may be NULL)
Returns
pointer to found node, NULL if not found
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_free_import_ptr()

void yang_free_import_ptr ( yang_import_ptr_t impptr)

Delete a YANG import pointer node.

Parameters
impptrimport pointer node to delete
Here is the caller graph for this function:

◆ yang_free_node()

void yang_free_node ( yang_node_t node)

Clean and delete the memory for a YANG parser node.

Parameters
nodeparser node to delete
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_free_pcb()

void yang_free_pcb ( yang_pcb_t pcb)

Delete a YANG parser control block.

Parameters
pcbparser control block to delete
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_free_stmt()

void yang_free_stmt ( yang_stmt_t stmt)

Delete a YANG statement node.

Parameters
stmtyang_stmt_t node to delete
Here is the caller graph for this function:

◆ yang_hash()

uint32 yang_hash ( const xmlChar *  key,
uint32  len 
)

Generate a yang-hash for the specified key.

Murmur3_32 hash function but only return low 30 bits The seed is fixed to be 42

Parameters
keystring to hash
lenlength of key in bytes
Returns
hash value
Here is the caller graph for this function:

◆ yang_is_in_yangdata()

boolean yang_is_in_yangdata ( const yang_pcb_t pcb)

Get the in_yangdata mode.

Parameters
pcbparser control block to check
Returns
current yangdata mode

◆ yang_make_filename()

xmlChar * yang_make_filename ( const xmlChar *  modname,
const xmlChar *  revision,
boolean  isyang 
)

Malloc and construct a YANG filename.

Parameters
modname[sub]module name
revision[sub]module revision date (may be NULL)
isyangTRUE for YANG extension
FALSE for YIN extension
Returns
malloced and filled in string buffer with filename
NULL if any error
Here is the call graph for this function:

◆ yang_make_sid_filename()

xmlChar * yang_make_sid_filename ( const xmlChar *  modname,
const xmlChar *  revision 
)

Malloc and construct a SID filename.

Parameters
modnamename
revision(may be NULL)
Returns
malloced and filled in string buffer with filename
NULL if any error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_new_deviation_stmt()

yang_stmt_t * yang_new_deviation_stmt ( obj_deviation_t deviation)

Create a new YANG stmt node for a deviation definition.

Parameters
deviationdeviation template to use for new statement struct
Returns
pointer to new and initialized struct, NULL if memory error
Here is the caller graph for this function:

◆ yang_new_ext_stmt()

yang_stmt_t * yang_new_ext_stmt ( ext_template_t ext)

Create a new YANG stmt node for an extension.

Parameters
extextension template to use for new statement struct
Returns
pointer to new and initialized struct, NULL if memory error
Here is the caller graph for this function:

◆ yang_new_feature_stmt()

yang_stmt_t * yang_new_feature_stmt ( ncx_feature_t feature)

Create a new YANG stmt node for a feature definition.

Parameters
featurefeature template to use for new statement struct
Returns
pointer to new and initialized struct, NULL if memory error
Here is the caller graph for this function:

◆ yang_new_grp_stmt()

yang_stmt_t * yang_new_grp_stmt ( grp_template_t grp)

Create a new YANG stmt node for a grouping.

Parameters
grpgrouping template to use for new statement struct
Returns
pointer to new and initialized struct, NULL if memory error
Here is the caller graph for this function:

◆ yang_new_id_stmt()

yang_stmt_t * yang_new_id_stmt ( ncx_identity_t identity)

Create a new YANG stmt node for an identity.

Parameters
identityidentity template to use for new statement struct
Returns
pointer to new and initialized struct, NULL if memory error

◆ yang_new_import_ptr()

yang_import_ptr_t * yang_new_import_ptr ( const xmlChar *  modname,
const xmlChar *  modprefix,
const xmlChar *  revision,
const xmlChar *  descr,
const xmlChar *  ref 
)

Create a new YANG import pointer node.

Parameters
modnamemodule name to set
modprefixmodule prefix to set
revisionrevision date to set
descrdescription string (YANG 1.1)
refreference string (YANG 1.1)
Returns
pointer to new and initialized struct, NULL if memory error
Here is the call graph for this function:

◆ yang_new_node()

yang_node_t * yang_new_node ( void  )

Create a new YANG parser node.

Returns
pointer to new and initialized struct, NULL if memory error

◆ yang_new_obj_stmt()

yang_stmt_t * yang_new_obj_stmt ( obj_template_t obj)

Create a new YANG stmt node for an object.

Parameters
objobject template to use for new statement struct
Returns
pointer to new and initialized struct, NULL if memory error

◆ yang_new_pcb()

yang_pcb_t * yang_new_pcb ( void  )

Create a new YANG parser control block.

Returns
pointer to new and initialized struct, NULL if memory error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_new_typ_stmt()

yang_stmt_t * yang_new_typ_stmt ( typ_template_t typ)

Create a new YANG stmt node for a typedef.

Parameters
typtype template to use for new statement struct
Returns
pointer to new and initialized struct, NULL if memory error
Here is the caller graph for this function:

◆ yang_set_in_yangdata()

void yang_set_in_yangdata ( yang_pcb_t pcb,
boolean  val 
)

Set the in_yangdata mode.

Parameters
pcbparser control block to set
valcurrent mode to set
Here is the caller graph for this function:

◆ yang_skip_statement()

void yang_skip_statement ( tk_chain_t tkc,
ncx_module_t mod 
)

Skip past the current invalid statement, starting at an invalid keyword.

Parameters
tkctoken chain in progress
modmodule in progress
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_split_filename()

boolean yang_split_filename ( const xmlChar *  filename,
uint32 *  modnamelen 
)

Split a module parameter into its filename components.

Parameters
filenamefilename string
[out]modnamelenaddress of return modname length
  • *modnamelen module name length
Returns
TRUE if "module@revision" form was found
FALSE if not, and ignore the output because a different form of the module parameter was used
Here is the call graph for this function:

◆ yang_top_keyword()

boolean yang_top_keyword ( const xmlChar *  keyword)

Check if the string is a top-level YANG keyword.

Parameters
keywordstring to check
Returns
TRUE if a top-level YANG keyword, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_validate_date_string()

status_t yang_validate_date_string ( tk_chain_t tkc,
ncx_module_t mod,
ncx_error_t tkerr,
const xmlChar *  datestr 
)

Validate a YANG date string for a revision entry.

  Expected format is:

     YYYY-MM-DD

Error messages are printed by this function

Parameters
tkctoken chain in progress
modmodule in progress
tkerrerror struct to use (may be NULL to use tkc->cur)
datestrstring to validate
Returns
status
Here is the call graph for this function: