yumapro
24.10-2
YumaPro SDK
|
General YANG compiler support functions Lower level functions to process YANG statements. More...
Functions | |
ncx_module_t * | ncx_new_module (void) |
Malloc and initialize the fields in a ncx_module_t. More... | |
void | ncx_free_module (ncx_module_t *mod) |
Free a YANG module. More... | |
status_t | ncx_add_namespace_to_registry (ncx_module_t *mod, boolean tempmod) |
Add the namespace and prefix to the registry or retrieve it if already set. More... | |
status_t | ncx_add_to_registry (ncx_module_t *mod) |
Add all the definitions stored in an ncx_module_t to the registry. More... | |
status_t | ncx_add_to_modQ (ncx_module_t *mod, dlq_hdr_t *modQ) |
Add module to the current module Q. More... | |
status_t | ncx_add_to_root_modQ (ncx_module_t *mod) |
Add module to the current module Q. More... | |
status_t | ncx_setup_mounted_mod (ncx_module_t *mod) |
Setup a module for yangcli in parsemode in SM mode. More... | |
void | ncx_match_rpc_error (ncx_module_t *mod, const xmlChar *modname, const xmlChar *rpcname, boolean match, boolean firstmsg) |
Generate an error for multiple matches. More... | |
const xmlChar * | ncx_get_name_segment (const xmlChar *str, xmlChar *buff, uint32 buffsize) |
Get the name string between the dots. More... | |
status_t | ncx_check_yang_status (ncx_status_t mystatus, ncx_status_t depstatus) |
Check the backward compatibility of the 2 YANG status fields. More... | |
void | ncx_free_node (ncx_node_t nodetyp, void *node) |
Delete a node based on its type. More... | |
ncx_tclass_t | ncx_get_tclass (ncx_btype_t btyp) |
Get the token class. More... | |
status_t | ncx_parse_name (const xmlChar *str, uint32 *len) |
Check if the next N chars represent a valid NcxName. More... | |
status_t | ncx_consume_tstring (tk_chain_t *tkc, ncx_module_t *mod, const xmlChar *name, ncx_opt_t opt) |
Consume a TK_TT_TSTRING with the specified value. More... | |
status_t | ncx_consume_name (tk_chain_t *tkc, ncx_module_t *mod, const xmlChar *name, xmlChar **namebuff, ncx_opt_t opt, tk_type_t ctyp) |
Consume a TK_TSTRING that matches the 'name', then retrieve the next TK_TSTRING token into the namebuff. More... | |
status_t | ncx_consume_token (tk_chain_t *tkc, ncx_module_t *mod, tk_type_t ttyp) |
Consume the next token which should be a 1 or 2 char token without any value. More... | |
ncx_save_deviations_t * | ncx_new_save_deviations (ncx_module_t *devmod, boolean annotation) |
Create a deviation save structure. More... | |
void | ncx_free_save_deviations (ncx_save_deviations_t *savedev) |
Free a deviation save struct. More... | |
void | ncx_clean_save_deviationsQ (dlq_hdr_t *savedevQ) |
Clean a Q of deviation save structs. More... | |
void | ncx_set_error (ncx_error_t *tkerr, ncx_module_t *mod, uint32 linenum, uint32 linepos) |
Set the fields in an ncx_error_t struct. More... | |
void | ncx_inc_warnings (ncx_module_t *mod) |
Increment the module warning count for mod . More... | |
boolean | ncx_need_modchecks (const xmlChar *modname) |
Check if xpath_backptr and obj commit tests needed. More... | |
status_t | ncx_init_user_types (void) |
Initialize the user types after ietf-inet-types module loaded. More... | |
boolean | ncx_check_any_object_nolock_get (const xmlChar *objname) |
Check if the object name will match any config=true nodes. More... | |
General YANG compiler support functions Lower level functions to process YANG statements.
status_t ncx_add_namespace_to_registry | ( | ncx_module_t * | mod, |
boolean | tempmod | ||
) |
Add the namespace and prefix to the registry or retrieve it if already set.
mod | module to add to registry |
tempmod | TRUE if this is a temporary add mode FALSE if this is a real registry add |
status_t ncx_add_to_modQ | ( | ncx_module_t * | mod, |
dlq_hdr_t * | modQ | ||
) |
Add module to the current module Q.
Used by yangdiff to bypass add_to_registry to support N different module trees
mod | module to add to current module Q |
modQ | Q Q of ncx_module_t * to add to; NULL will pick ncx_curQ |
status_t ncx_add_to_registry | ( | ncx_module_t * | mod | ) |
Add all the definitions stored in an ncx_module_t to the registry.
This step is deferred to keep the registry stable as possible and only add modules in an all-or-none fashion.
mod | module to add to registry |
status_t ncx_add_to_root_modQ | ( | ncx_module_t * | mod | ) |
Add module to the current module Q.
Used by Schema Mount to bypass add_to_registry to support N different module trees roots
mod | module to save |
boolean ncx_check_any_object_nolock_get | ( | const xmlChar * | objname | ) |
Check if the object name will match any config=true nodes.
CAN ONLY BE USED BY SERVER
objname | object name to check |
status_t ncx_check_yang_status | ( | ncx_status_t | mystatus, |
ncx_status_t | depstatus | ||
) |
Check the backward compatibility of the 2 YANG status fields.
mystatus | enum value for the node to be tested |
depstatus | status value of the dependency |
void ncx_clean_save_deviationsQ | ( | dlq_hdr_t * | savedevQ | ) |
Clean a Q of deviation save structs.
savedevQ | Q of ncx_save_deviations_t to clean |
status_t ncx_consume_name | ( | tk_chain_t * | tkc, |
ncx_module_t * | mod, | ||
const xmlChar * | name, | ||
xmlChar ** | namebuff, | ||
ncx_opt_t | opt, | ||
tk_type_t | ctyp | ||
) |
Consume a TK_TSTRING that matches the 'name', then retrieve the next TK_TSTRING token into the namebuff.
If ctk specified, then consume the specified close token Store the results in a malloced buffer
Error messages are printed by this function!! Do not duplicate error messages upon error return
tkc | token chain | |
mod | module in progress (NULL if none) | |
name | token name | |
[out] | namebuff | ptr to output name string
|
opt | TRUE for optional param == FALSE for mandatory param | |
ctyp | close token (use TK_TT_NONE to skip this part) |
status_t ncx_consume_token | ( | tk_chain_t * | tkc, |
ncx_module_t * | mod, | ||
tk_type_t | ttyp | ||
) |
Consume the next token which should be a 1 or 2 char token without any value.
However this function does not check the value, just the token type.
Error messages are printed by this function!! Do not duplicate error messages upon error return
tkc | token chain |
mod | module in progress (NULL if none) |
ttyp | token type |
status_t ncx_consume_tstring | ( | tk_chain_t * | tkc, |
ncx_module_t * | mod, | ||
const xmlChar * | name, | ||
ncx_opt_t | opt | ||
) |
Consume a TK_TT_TSTRING with the specified value.
Error messages are printed by this function!! Do not duplicate error messages upon error return
tkc | token chain |
mod | module in progress (NULL if none) |
name | token name |
opt | TRUE for optional param == FALSE for mandatory param |
void ncx_free_module | ( | ncx_module_t * | mod | ) |
Free a YANG module.
Scrub the memory in a ncx_module_t by freeing all the sub-fields and then freeing the entire struct itself use if module was not added to registry
MUST remove this struct from the ncx_modQ before calling Does not remove module definitions from the registry
Use the ncx_remove_module function if the module was already successfully added to the modQ and definition registry
mod | ncx_module_t data structure to free |
void ncx_free_node | ( | ncx_node_t | nodetyp, |
void * | node | ||
) |
Delete a node based on its type.
DO NOT USE! Dangerous free function based on NCX_NT_FOO enums
nodetyp | NCX node type |
node | node top free case as a void pointer |
void ncx_free_save_deviations | ( | ncx_save_deviations_t * | savedev | ) |
Free a deviation save struct.
savedev | struct to clean and delete |
const xmlChar * ncx_get_name_segment | ( | const xmlChar * | str, |
xmlChar * | buff, | ||
uint32 | buffsize | ||
) |
Get the name string between the dots.
str | scoped string | |
[out] | buff | address of return buffer
|
buffsize | buffer size |
ncx_tclass_t ncx_get_tclass | ( | ncx_btype_t | btyp | ) |
Get the token class.
btyp | base type enum |
void ncx_inc_warnings | ( | ncx_module_t * | mod | ) |
Increment the module warning count for mod
.
mod | module being parsed |
status_t ncx_init_user_types | ( | void | ) |
Initialize the user types after ietf-inet-types module loaded.
void ncx_match_rpc_error | ( | ncx_module_t * | mod, |
const xmlChar * | modname, | ||
const xmlChar * | rpcname, | ||
boolean | match, | ||
boolean | firstmsg | ||
) |
Generate an error for multiple matches.
mod | module struct to check (may be NULL) |
modname | module name if mod not set; NULL to match all modules |
rpcname | RPC name to match |
match | TRUE to match partial command names; FALSE for exact match only |
firstmsg | TRUE to do the first log_error banner msg FALSE to skip this step |
boolean ncx_need_modchecks | ( | const xmlChar * | modname | ) |
Check if xpath_backptr and obj commit tests needed.
Used only by the compiler
modname | module to check |
ncx_module_t * ncx_new_module | ( | void | ) |
Malloc and initialize the fields in a ncx_module_t.
ncx_save_deviations_t * ncx_new_save_deviations | ( | ncx_module_t * | devmod, |
boolean | annotation | ||
) |
Create a deviation save structure.
devmod | deviations module |
annotation | TRUE if this is from annotation; FALSE if not |
status_t ncx_parse_name | ( | const xmlChar * | str, |
uint32 * | len | ||
) |
Check if the next N chars represent a valid NcxName.
Will end on the first non-name char
str | xmlChar string to check | |
[out] | len | address of name length
|
void ncx_set_error | ( | ncx_error_t * | tkerr, |
ncx_module_t * | mod, | ||
uint32 | linenum, | ||
uint32 | linepos | ||
) |
Set the fields in an ncx_error_t struct.
When called from NACM or <get> internally, there is no module or line number info
[in,out] | tkerr | address of ncx_error_t struct to set *tkerr is filled in |
mod | [sub]module containing tkerr | |
linenum | current linenum | |
linepos | current column position on the current line |
status_t ncx_setup_mounted_mod | ( | ncx_module_t * | mod | ) |
Setup a module for yangcli in parsemode in SM mode.
Used by yangcli Schema Mount
mod | module to setup |