yumapro  23.10T-6
YumaPro SDK
Loading...
Searching...
No Matches
General Compiler Support

General YANG compiler support functions Lower level functions to process YANG statements. More...

Collaboration diagram for General Compiler Support:

Functions

ncx_module_tncx_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_tncx_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...
 

Detailed Description

General YANG compiler support functions Lower level functions to process YANG statements.

Function Documentation

◆ ncx_add_namespace_to_registry()

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.

Parameters
modmodule to add to registry
tempmodTRUE if this is a temporary add mode FALSE if this is a real registry add
Returns
status of the operation
Here is the call graph for this function:

◆ ncx_add_to_modQ()

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

Parameters
modmodule to add to current module Q
modQQ Q of ncx_module_t * to add to; NULL will pick ncx_curQ
Returns
status of the operation
Here is the caller graph for this function:

◆ ncx_add_to_registry()

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.

Parameters
modmodule to add to registry
Returns
status of the operation
Here is the call graph for this function:

◆ ncx_add_to_root_modQ()

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

Parameters
modmodule to save
Returns
status of the operation
Here is the call graph for this function:

◆ ncx_check_any_object_nolock_get()

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

Parameters
objnameobject name to check
Returns
TRUE if OK for nolock get; FALSE if not
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncx_check_yang_status()

status_t ncx_check_yang_status ( ncx_status_t  mystatus,
ncx_status_t  depstatus 
)

Check the backward compatibility of the 2 YANG status fields.

Parameters
mystatusenum value for the node to be tested
depstatusstatus value of the dependency
Returns
status of the operation

◆ ncx_clean_save_deviationsQ()

void ncx_clean_save_deviationsQ ( dlq_hdr_t *  savedevQ)

Clean a Q of deviation save structs.

Parameters
savedevQQ of ncx_save_deviations_t to clean
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncx_consume_name()

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

Parameters
tkctoken chain
modmodule in progress (NULL if none)
nametoken name
[out]namebuffptr to output name string
  • *namebuff points at the malloced name string
optTRUE for optional param
== FALSE for mandatory param
ctypclose token (use TK_TT_NONE to skip this part)
Returns
status of the operation
Here is the call graph for this function:

◆ ncx_consume_token()

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

Parameters
tkctoken chain
modmodule in progress (NULL if none)
ttyptoken type
Returns
status of the operation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncx_consume_tstring()

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

Parameters
tkctoken chain
modmodule in progress (NULL if none)
nametoken name
optTRUE for optional param
== FALSE for mandatory param
Returns
status of the operation
Here is the call graph for this function:

◆ ncx_free_module()

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

Parameters
modncx_module_t data structure to free
See also
ncx_new_module
Here is the caller graph for this function:

◆ ncx_free_node()

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

Parameters
nodetypNCX node type
nodenode top free case as a void pointer
Here is the call graph for this function:

◆ ncx_free_save_deviations()

void ncx_free_save_deviations ( ncx_save_deviations_t savedev)

Free a deviation save struct.

Parameters
savedevstruct to clean and delete
Here is the caller graph for this function:

◆ ncx_get_name_segment()

const xmlChar * ncx_get_name_segment ( const xmlChar *  str,
xmlChar *  buff,
uint32  buffsize 
)

Get the name string between the dots.

Parameters
strscoped string
[out]buffaddress of return buffer
  • buff is filled in with the namestring segment
buffsizebuffer size
Returns
current string pointer after operation
Here is the caller graph for this function:

◆ ncx_get_tclass()

ncx_tclass_t ncx_get_tclass ( ncx_btype_t  btyp)

Get the token class.

Parameters
btypbase type enum
Returns
tclass enum

◆ ncx_inc_warnings()

void ncx_inc_warnings ( ncx_module_t mod)

Increment the module warning count for mod.

Parameters
modmodule being parsed

◆ ncx_init_user_types()

status_t ncx_init_user_types ( void  )

Initialize the user types after ietf-inet-types module loaded.

Returns
status
Here is the call graph for this function:

◆ ncx_match_rpc_error()

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.

Parameters
modmodule struct to check (may be NULL)
modnamemodule name if mod not set; NULL to match all modules
rpcnameRPC name to match
matchTRUE to match partial command names; FALSE for exact match only
firstmsgTRUE to do the first log_error banner msg FALSE to skip this step
Here is the call graph for this function:

◆ ncx_need_modchecks()

boolean ncx_need_modchecks ( const xmlChar *  modname)

Check if xpath_backptr and obj commit tests needed.

Used only by the compiler

Parameters
modnamemodule to check
Returns
TRUE if XPath back pointer checks needed right now
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncx_new_module()

ncx_module_t * ncx_new_module ( void  )

Malloc and initialize the fields in a ncx_module_t.

Returns
pointer to the malloced and initialized struct or NULL if an error
See also
ncx_free_module
Here is the call graph for this function:

◆ ncx_new_save_deviations()

ncx_save_deviations_t * ncx_new_save_deviations ( ncx_module_t devmod,
boolean  annotation 
)

Create a deviation save structure.

Parameters
devmoddeviations module
annotationTRUE if this is from annotation; FALSE if not
Returns
malloced and initialized save_deviations struct, or NULL if malloc error
Here is the caller graph for this function:

◆ ncx_parse_name()

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

Parameters
strxmlChar string to check
[out]lenaddress of name length
  • *len 0 if no valid name parsed;
  • > 0 for the numbers of chars in the NcxName
Returns
status_t (error if name too long)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncx_set_error()

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

Parameters
[in,out]tkerraddress of ncx_error_t struct to set
*tkerr is filled in
mod[sub]module containing tkerr
linenumcurrent linenum
lineposcurrent column position on the current line
Here is the caller graph for this function:

◆ ncx_setup_mounted_mod()

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

Parameters
modmodule to setup
Returns
status of the operation
Here is the call graph for this function: