yumapro  20.10-14
YumaPro SDK
XPath Core Functions

XPath Parser Support Functions. More...

Collaboration diagram for XPath Core Functions:

Functions

status_t xpath_find_schema_target (yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, obj_template_t *obj, dlq_hdr_t *datadefQ, const xmlChar *target, obj_template_t **targobj, dlq_hdr_t **targQ)
 Find the schema target, save in *targobj. More...
 
status_t xpath_find_schema_target_force_mod (yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, ncx_module_t *force_mod, obj_template_t *obj, dlq_hdr_t *datadefQ, const xmlChar *target, obj_template_t **targobj, dlq_hdr_t **targQ)
 find target, save in *targobj, force the module More...
 
status_t xpath_find_schema_target_err (yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, obj_template_t *obj, dlq_hdr_t *datadefQ, const xmlChar *target, obj_template_t **targobj, dlq_hdr_t **targQ, ncx_error_t *tkerr)
 find target, save in *targobj, use the errtk if error More...
 
status_t xpath_find_schema_target_int (const xmlChar *target, obj_template_t **targobj)
 @ More...
 
status_t xpath_find_val_target (val_value_t *startval, ncx_module_t *mod, const xmlChar *target, val_value_t **targval)
 Find the XPath value node target. More...
 
status_t xpath_find_schema_target_restconf (const xmlChar *target, obj_template_t **targobj)
 Find a schema target for RESTCONF. More...
 
status_t xpath_find_data_target_pcb (xpath_pcb_t *pcb, obj_template_t **targobj)
 Find schema target for a datastore node. More...
 
status_t xpath_find_val_unique (val_value_t *startval, ncx_module_t *mod, const xmlChar *target, val_value_t *root, boolean logerrors, boolean configonly, xpath_pcb_t **retpcb)
 Find the data node for a unique-stmt target. More...
 
xpath_pcb_txpath_new_pcb (const xmlChar *xpathstr, xpath_getvar_fn_t getvar_fn)
 malloc a new XPath parser control block More...
 
xpath_pcb_txpath_new_pcb_ex (const xmlChar *xpathstr, xpath_getvar_fn_t getvar_fn, void *cookie)
 malloc a new XPath parser control block Extended More...
 
xpath_pcb_txpath_clone_pcb (const xpath_pcb_t *srcpcb)
 Clone an XPath PCB. More...
 
xpath_pcb_txpath_find_pcb (dlq_hdr_t *pcbQ, const xmlChar *exprstr)
 Find an XPath PCB. More...
 
void xpath_free_pcb (xpath_pcb_t *pcb)
 Free a malloced XPath parser control block. More...
 
xpath_result_txpath_new_result (xpath_restype_t restype)
 malloc an XPath result More...
 
void xpath_init_result (xpath_result_t *result, xpath_restype_t restype)
 Initialize an XPath result struct. More...
 
void xpath_free_result (xpath_result_t *result)
 Free a malloced XPath result struct. More...
 
void xpath_clean_result (xpath_result_t *result)
 Clean an XPath result struct. More...
 
xpath_resnode_txpath_new_resnode (void)
 Create and initialize an XPath result node struct. More...
 
void xpath_init_resnode (xpath_resnode_t *resnode)
 Initialize an XPath result node struct. More...
 
void xpath_free_resnode (xpath_resnode_t *resnode)
 Free a malloced XPath result node struct. More...
 
void xpath_delete_resnode (xpath_resnode_t *resnode)
 Delete and free a malloced XPath result node struct. More...
 
void xpath_clean_resnode (xpath_resnode_t *resnode)
 Clean an XPath result node struct. More...
 
status_t xpath_get_curmod_from_prefix (const xmlChar *prefix, ncx_module_t *mod, ncx_module_t **targmod)
 Get the correct module to use for a given prefix. More...
 
status_t xpath_get_curmod_from_prefix2 (const xmlChar *prefix, ncx_module_t *mod, ncx_module_t **targmod, const xmlChar **modname)
 Get the correct module to use for a given prefix Return found module name if returning not-found error. More...
 
status_t xpath_get_modinfo_from_prefix (const xmlChar *prefix, ncx_module_t *mod, const xmlChar **modname, const xmlChar **modrev)
 Get the correct module name/revision to use for a given prefix. More...
 
status_t xpath_get_curmod_from_prefix_str (const xmlChar *prefix, uint32 prefixlen, ncx_module_t *mod, ncx_module_t **targmod)
 Get the correct module to use for a given prefix Unended string version. More...
 
status_t xpath_parse_token (xpath_pcb_t *pcb, tk_type_t tktype)
 Parse the XPath token sequence for a specific token type. More...
 
boolean xpath_cvt_boolean (const xpath_result_t *result)
 Convert an XPath result to a boolean answer. More...
 
void xpath_cvt_number (const xpath_result_t *result, ncx_num_t *num)
 Convert an XPath result to a number answer. More...
 
status_t xpath_cvt_string (xpath_pcb_t *pcb, const xpath_result_t *result, xmlChar **str)
 Convert an XPath result to a string answer. More...
 
dlq_hdr_t * xpath_get_resnodeQ (xpath_result_t *result)
 Get the renodeQ from a result struct. More...
 
xpath_resnode_txpath_get_first_resnode (xpath_result_t *result)
 Get the first result in the renodeQ from a result struct. More...
 
xpath_resnode_txpath_get_next_resnode (xpath_resnode_t *resnode)
 Get the next result in the renodeQ from a result struct. More...
 
val_value_txpath_first_resnode_valptr (xpath_resnode_t *resnode)
 Get the first result in the renodeQ from a result struct. More...
 
val_value_txpath_next_resnode_valptr (xpath_resnode_t *resnode, val_value_t *valptr)
 Get the next node val pointer from a result node struct. More...
 
obj_template_txpath_get_resnode_obj (xpath_resnode_t *resnode)
 Get the resnode object pointer from a value resnode. More...
 
obj_template_txpath_get_cxt_obj (xpath_pcb_t *pcb)
 Get the object pointer for the context node. More...
 
val_value_txpath_get_resnode_val (xpath_resnode_t *resnode)
 Get the resnode value pointer from a resnode, if any. More...
 
obj_template_txpath_get_resnode_objptr (xpath_resnode_t *resnode)
 Get the result node object pointer (obsolete) More...
 
dlq_hdr_t * xpath_get_varbindQ (xpath_pcb_t *pcb)
 Get the varbindQ from a parser control block struct. More...
 
void xpath_move_nodeset (xpath_result_t *srcresult, xpath_result_t *destresult)
 Move the nodes from a nodeset reult into the target nodeset result. More...
 
boolean xpath_nodeset_empty (const xpath_result_t *result)
 Check if the result is an empty nodeset. More...
 
void xpath_nodeset_swap_valptr (xpath_result_t *result, val_value_t *oldval, val_value_t *newval)
 Check if the result has the oldval ptr and if so, replace it with the newval ptr. More...
 
void xpath_nodeset_delete_valptr (xpath_result_t *result, val_value_t *oldval)
 Check if the result has the oldval ptr and if so, delete it. More...
 
xmlChar * xpath_convert_url_to_path (const xmlChar *urlpath, ncx_name_match_t match_names, boolean alt_naming, boolean wildcards, boolean withkeys, boolean fullkeys, boolean withmod, ncx_protocol_t proto, status_t *res)
 Convert a URL format path to XPath format path. More...
 
void xpath_set_backptrs_dirty (xpath_pcb_t *pcb, ncx_cfg_t cfg_id, boolean dirty)
 Set the backptrs_dirty flag in the PCB. More...
 
boolean xpath_check_backptrs_dirty (xpath_pcb_t *pcb, ncx_cfg_t cfg_id)
 Check the backptrs_dirty flag in the PCB. More...
 
boolean xpath_check_manual_clear (xpath_pcb_t *pcb)
 Check the backptrs_dirty flag in the PCB is clearly manually only. More...
 
void xpath_set_manual_clear (xpath_pcb_t *pcb)
 Set the manual clear mode flag in the PCB. More...
 
status_t xpath_add_to_result (xpath_result_t *source, xpath_result_t *target)
 Move the resnodes from 1 XPath result to another. More...
 
uint32 xpath_resnode_count (xpath_result_t *result)
 Get the number of resnodes in the node-set. More...
 
void xpath_discard_resnode (xpath_resnode_t *resnode)
 Discard a result node. More...
 
void xpath_clear_nodeset_result (xpath_result_t *result)
 Clear all the nodes from the node-set result. More...
 
xpath_pcb_txpath_new_session_pcb (ses_cb_t *scb, const xmlChar *expr, status_t *res)
 Get a new XPath parser control block for a session. More...
 
void xpath_set_load_import (xpath_pcb_t *pcb, void *yang_pcb)
 Set the PCB in load import mode. More...
 
void xpath_clear_load_import (xpath_pcb_t *pcb)
 Clear the PCB out of load import mode. More...
 
void * xpath_get_load_import (xpath_pcb_t *pcb)
 Get the PCB in load import mode. More...
 
boolean xpath_need_get2_processing (xpath_result_t *result)
 Check if the result nodeset contains any XP_RNT_GET2 nodes. More...
 
const xmlChar * xpath_get_restype_str (xpath_restype_t restype)
 Get the string for the specific result type. More...
 
void xpath_set_keep_result (xpath_pcb_t *pcb)
 Set the keep-result flag in the PCB. More...
 
boolean xpath_find_obj_in_result (xpath_result_t *result, obj_template_t *obj)
 Find the object pointer in the specified result. More...
 
boolean xpath_expr_has_predicates (xpath_pcb_t *pcb)
 Check if any predicates parsed in the expression. More...
 
boolean xpath_expr_scan_predicates (xpath_pcb_t *pcb)
 Check if any predicates parsed in the expression. More...
 
xpath_pred_ent_txpath_new_pred_ent (obj_template_t *keyobj, const xmlChar *keyval)
 Malloc and init an XPath predicate entry struct. More...
 
void xpath_free_pred_ent (xpath_pred_ent_t *ent)
 Free a malloced XPath predicate entry struct. More...
 
boolean xpath_expr_ok_for_nolock_get (xpath_pcb_t *pcb)
 Check an XPath expression to see if it contains any top-level config=true data nodes or not. More...
 
xpath_resnode_txpath_get_first_real_resnode (xpath_result_t *result)
 Get the first result in the renodeQ from a result struct. More...
 
boolean xpath_result_is_get2 (xpath_result_t *result)
 Check if the result is a node-set for GET2 nodes. More...
 

Detailed Description

XPath Parser Support Functions.

Function Documentation

◆ xpath_add_to_result()

status_t xpath_add_to_result ( xpath_result_t source,
xpath_result_t target 
)

Move the resnodes from 1 XPath result to another.

Parameters
sourcesource result
targettarget result
Return values
sourceresultQ is empty
Returns
status: error if either result not a node-set
Here is the call graph for this function:

◆ xpath_check_backptrs_dirty()

boolean xpath_check_backptrs_dirty ( xpath_pcb_t pcb,
ncx_cfg_t  cfg_id 
)

Check the backptrs_dirty flag in the PCB.

Parameters
pcbparser control block to use
cfg_idconfiguration datastore to check
Returns
TRUE: backptr marked as dirty (needs re-evaluation)
FALSE: backptr not dirty (cached result is OK)

◆ xpath_check_manual_clear()

boolean xpath_check_manual_clear ( xpath_pcb_t pcb)

Check the backptrs_dirty flag in the PCB is clearly manually only.

Parameters
pcbparser control block to check
Returns
TRUE: manual clear only for this PCB
FALSE: automatic clear OK

◆ xpath_clean_resnode()

void xpath_clean_resnode ( xpath_resnode_t resnode)

Clean an XPath result node struct.

Parameters
resnodepointer to result node struct to clean
Here is the caller graph for this function:

◆ xpath_clean_result()

void xpath_clean_result ( xpath_result_t result)

Clean an XPath result struct.

Parameters
resultpointer to result struct to clean
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_clear_load_import()

void xpath_clear_load_import ( xpath_pcb_t pcb)

Clear the PCB out of load import mode.

Internal parser function

Parameters
pcbparser CB to clear

◆ xpath_clear_nodeset_result()

void xpath_clear_nodeset_result ( xpath_result_t result)

Clear all the nodes from the node-set result.

Parameters
resultresult to clear
Here is the call graph for this function:

◆ xpath_clone_pcb()

xpath_pcb_t* xpath_clone_pcb ( const xpath_pcb_t srcpcb)

Clone an XPath PCB.

Usually for a must or when clause copy copy from typdef to object for leafref of object to value for NETCONF PDU processing

Parameters
srcpcbstruct with starting contents
Returns
new xpatyh_pcb_t clone of the srcmust, NULL if malloc error. It will not be processed or parsed. Only the starter data will be set
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_convert_url_to_path()

xmlChar* xpath_convert_url_to_path ( const xmlChar *  urlpath,
ncx_name_match_t  match_names,
boolean  alt_naming,
boolean  wildcards,
boolean  withkeys,
boolean  fullkeys,
boolean  withmod,
ncx_protocol_t  proto,
status_t res 
)

Convert a URL format path to XPath format path.

Complex API used by RESTCONF to process target URL searches Also used by CLI for path conversions

Parameters
urlpathURL path string to convert to XPath
match_namesenum for selected match names mode
alt_namingTRUE if alt-name and cli-drop-node-name containers should be checked
wildcardsTRUE if wildcards allowed instead of key values
FALSE if the '-' wildcard mechanism not allowed
withkeysTRUE if keys are expected
FALSE if just nodes are expected
fullkeysTRUE if complete keys are expected
FALSE if last list node can end with a partial or missing key; ignored unless withkeys=TRUE
withmodTRUE if modname:name is expected
FALSE to skip modname match test
protoprotocol enum needed for YANG-API vs. RESTCONF
resaddress of return status
Return values
*resreturn status
Returns
malloced string containing XPath expression from conversion NULL if some error
Here is the call graph for this function:

◆ xpath_cvt_boolean()

boolean xpath_cvt_boolean ( const xpath_result_t result)

Convert an XPath result to a boolean answer.

Parameters
resultresult struct to convert to boolean
Returns
TRUE or FALSE depending on conversion
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_cvt_number()

void xpath_cvt_number ( const xpath_result_t result,
ncx_num_t num 
)

Convert an XPath result to a number answer.

Parameters
resultresult struct to convert to a number
numpointer to ncx_num_t to hold the conversion result
Return values
*numnumeric result from conversion
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_cvt_string()

status_t xpath_cvt_string ( xpath_pcb_t pcb,
const xpath_result_t result,
xmlChar **  str 
)

Convert an XPath result to a string answer.

Parameters
pcbparser control block to use
resultresult struct to convert to a number
strpointer to xmlChar * to hold the conversion result
Return values
*strpointer to malloced string from conversion
Returns
status; could get an ERR_INTERNAL_MEM error or NO_RER
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_delete_resnode()

void xpath_delete_resnode ( xpath_resnode_t resnode)

Delete and free a malloced XPath result node struct.

Parameters
resnodepointer to result node struct to free
Here is the call graph for this function:

◆ xpath_discard_resnode()

void xpath_discard_resnode ( xpath_resnode_t resnode)

Discard a result node.

Parameters
resnoderesult node to remove and free
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_expr_has_predicates()

boolean xpath_expr_has_predicates ( xpath_pcb_t pcb)

Check if any predicates parsed in the expression.

Parameters
pcbparser control block to use
Returns
TRUE if predicates found; FALSE otherwise

◆ xpath_expr_ok_for_nolock_get()

boolean xpath_expr_ok_for_nolock_get ( xpath_pcb_t pcb)

Check an XPath expression to see if it contains any top-level config=true data nodes or not.

This does not parse the expression at all! It cannot check for a node-set result; Sinple scan looking for path-expr

Parameters
pcbXPath control block with token chain expected to be present
Here is the call graph for this function:

◆ xpath_expr_scan_predicates()

boolean xpath_expr_scan_predicates ( xpath_pcb_t pcb)

Check if any predicates parsed in the expression.

Checks the token chain to see if any predicates

Parameters
pcbparser control block to use
Returns
TRUE if predicates found; FALSE otherwise
Here is the caller graph for this function:

◆ xpath_find_data_target_pcb()

status_t xpath_find_data_target_pcb ( xpath_pcb_t pcb,
obj_template_t **  targobj 
)

Find schema target for a datastore node.

Internal find target, without any error reporting Follow the absolute-path expression and return the obj_template_t that it indicates

Looks for data nodes only (not choice/case)

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

Parameters
pcbXPath control block containing expression string to evaluate
targobjaddress of return object (may be NULL)
Return values
*targobjtarget object
Returns
status

◆ xpath_find_obj_in_result()

boolean xpath_find_obj_in_result ( xpath_result_t result,
obj_template_t obj 
)

Find the object pointer in the specified result.

Parameters
resultresult to check
objobject pointer to find
Returns
TRUE if obj node found; FALSE otherwise
Here is the call graph for this function:

◆ xpath_find_pcb()

xpath_pcb_t* xpath_find_pcb ( dlq_hdr_t *  pcbQ,
const xmlChar *  exprstr 
)

Find an XPath PCB.

find by exact match of the expressions string

Parameters
pcbQQ of xpath_pcb_t structs to check
exprstrXPath expression string to find
Returns
pointer to found xpath_pcb_t or NULL if not found

◆ xpath_find_schema_target()

status_t xpath_find_schema_target ( yang_pcb_t pcb,
tk_chain_t tkc,
ncx_module_t mod,
obj_template_t obj,
dlq_hdr_t *  datadefQ,
const xmlChar *  target,
obj_template_t **  targobj,
dlq_hdr_t **  targQ 
)

Find the schema target, save in *targobj.

Used by YANG XPath processing usually for YANG module validation.

This is not the API for internal schema node access!

Follow the absolute-path or descendant-node path expression and return the obj_template_t that it indicates, and the que that the object is in

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

Parameters
pcbparser control block to use
tkctoken chain in progress (may be NULL: errmsg only)
modmodule in progress
objaugment object initiating search, NULL to start at top
datadefQ== Q of obj_template_t containing 'obj'
targetXpath expression string to evaluate
targobjaddress of return object (may be NULL)
targQaddress of return target queue (may be NULL)
Return values
*targobjtarget object
*targQdatadefQ Q header which contains targobj
Returns
status

◆ xpath_find_schema_target_err()

status_t xpath_find_schema_target_err ( yang_pcb_t pcb,
tk_chain_t tkc,
ncx_module_t mod,
obj_template_t obj,
dlq_hdr_t *  datadefQ,
const xmlChar *  target,
obj_template_t **  targobj,
dlq_hdr_t **  targQ,
ncx_error_t tkerr 
)

find target, save in *targobj, use the errtk if error

Used by YANG XPath processing usually for YANG module validation.

This is not the API for internal schema node access!

Same as xpath_find_schema_target except a token struct is provided to use for the error token, instead of 'obj'

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

Parameters
pcbparser control block to use
tkctoken chain in progress (may be NULL: errmsg only)
modmodule in progress
objaugment object initiating search, NULL to start at top
datadefQ== Q of obj_template_t containing 'obj'
targetXpath expression string to evaluate
targobjaddress of return object (may be NULL)
targQaddress of return target queue (may be NULL)
tkerrerror struct to use if any messages generated
Return values
*targobjtarget object
*targQdatadefQ Q header which contains targobj
Returns
status

◆ xpath_find_schema_target_force_mod()

status_t xpath_find_schema_target_force_mod ( yang_pcb_t pcb,
tk_chain_t tkc,
ncx_module_t mod,
ncx_module_t force_mod,
obj_template_t obj,
dlq_hdr_t *  datadefQ,
const xmlChar *  target,
obj_template_t **  targobj,
dlq_hdr_t **  targQ 
)

find target, save in *targobj, force the module

Used by YANG XPath processing usually for YANG module validation.

This is not the API for internal schema node access!

Follow the absolute-path or descendant-node path expression and return the obj_template_t that it indicates, and the que that the object is in

Only look for target if target object is in the specified force_mod; exist with ERR_NCX_SKIPPED status if a node is found in the target object path that is from a different module

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

Parameters
pcbparser control block to use
tkctoken chain in progress (may be NULL: errmsg only)
modmodule in progress
force_modlimit target object to this module
objaugment object initiating search, NULL to start at top
datadefQ== Q of obj_template_t containing 'obj'
targetXpath expression string to evaluate
targobjaddress of return object (may be NULL)
targQaddress of return target queue (may be NULL)
Return values
*targobjtarget object
*targQdatadefQ Q header which contains targobj
Returns
status

◆ xpath_find_schema_target_int()

status_t xpath_find_schema_target_int ( const xmlChar *  target,
obj_template_t **  targobj 
)

@

internal find target, without any error reporting.

This is the internal API for SIL and SIL-SA code to use for finding an obj_template_t within a YANG subtree

Follow the absolute-path expression and return the obj_template_t that it indicates

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

Parameters
targetabsolute Xpath expression string to evaluate
targobjaddress of return object (may be NULL)
Return values
*targobjtarget object
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_find_schema_target_restconf()

status_t xpath_find_schema_target_restconf ( const xmlChar *  target,
obj_template_t **  targobj 
)

Find a schema target for RESTCONF.

internal find target, without any error reporting Follow the absolute-path expression and return the obj_template_t that it indicates RESTCONF module-name prefix syntax

Parameters
targetabsolute Xpath expression string to evaluate
targobjaddress of return object (may be NULL)
Return values
*targobjtarget object
Returns
status
Here is the call graph for this function:

◆ xpath_find_val_target()

status_t xpath_find_val_target ( val_value_t startval,
ncx_module_t mod,
const xmlChar *  target,
val_value_t **  targval 
)

Find the XPath value node target.

used by cfg.c to find parms in the value struct for a config file (ncx:cli)

Follow the absolute-path Xpath expression as used internally to identify a config DB node and return the val_value_t that it indicates

Expression must be the node-path from root for the desired node.

Error messages are logged by this function

Parameters
startvaltop-level start element to search
modmodule to use for the default context and prefixes will be relative to this module's import statements.
== NULL and the default registered prefixes will be used
targetXpath expression string to evaluate
targvaladdress of return value (may be NULL)
Return values
*targvaltarget value node. If non-NULL targval and error exit: *targval is last good node visited in expression (if any)
Returns
status

◆ xpath_find_val_unique()

status_t xpath_find_val_unique ( val_value_t startval,
ncx_module_t mod,
const xmlChar *  target,
val_value_t root,
boolean  logerrors,
boolean  configonly,
xpath_pcb_t **  retpcb 
)

Find the data node for a unique-stmt target.

called by server to find a descendant value node based on a relative-path sub-clause of a unique-stmt

Follow the relative-path Xpath expression as used internally to identify a config DB node and return the val_value_t that it indicates

Error messages are logged by this function only if logerrors is TRUE

Parameters
startvalstarting context node (contains unique-stmt)
modmodule to use for the default context and prefixes will be relative to this module's import statements.
== NULL and the default registered prefixes will be used
targetXpath expression string to evaluate
rootXPath docroot to use
logerrorsTRUE to use log_error, FALSE to skip it
configonlyTRUE if only checking config=treu objects
retpcb== address of return value
Return values
*retpcbmalloced XPath PCB with result
Returns
status
Here is the call graph for this function:

◆ xpath_first_resnode_valptr()

val_value_t* xpath_first_resnode_valptr ( xpath_resnode_t resnode)

Get the first result in the renodeQ from a result struct.

Parameters
resnoderesult node struct to check
Returns
pointer to value node resnode or NULL if some error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_free_pcb()

void xpath_free_pcb ( xpath_pcb_t pcb)

Free a malloced XPath parser control block.

Parameters
pcbpointer to parser control block to free
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_free_pred_ent()

void xpath_free_pred_ent ( xpath_pred_ent_t ent)

Free a malloced XPath predicate entry struct.

Parameters
entpredicate struct to free
Here is the caller graph for this function:

◆ xpath_free_resnode()

void xpath_free_resnode ( xpath_resnode_t resnode)

Free a malloced XPath result node struct.

Parameters
resnodepointer to result node struct to free
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_free_result()

void xpath_free_result ( xpath_result_t result)

Free a malloced XPath result struct.

Parameters
resultpointer to result struct to free
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_get_curmod_from_prefix()

status_t xpath_get_curmod_from_prefix ( const xmlChar *  prefix,
ncx_module_t mod,
ncx_module_t **  targmod 
)

Get the correct module to use for a given prefix.

This is used internally when processing YANG module expressions

Parameters
prefixstring to check
modmodule to use for the default context and prefixes will be relative to this module's import statements.
== NULL and the default registered prefixes will be used
targmodaddress of return module
Return values
*targmodtarget module to use
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_get_curmod_from_prefix2()

status_t xpath_get_curmod_from_prefix2 ( const xmlChar *  prefix,
ncx_module_t mod,
ncx_module_t **  targmod,
const xmlChar **  modname 
)

Get the correct module to use for a given prefix Return found module name if returning not-found error.

This is used internally when processing YANG module expressions

Parameters
prefixstring to check
modmodule to use for the default context and prefixes will be relative to this module's import statements.
== NULL and the default registered prefixes will be used
targmodaddress of return module
modnameaddress ot return modname
Return values
*targmodtarget module to use
*modnamemodule name not found
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_get_curmod_from_prefix_str()

status_t xpath_get_curmod_from_prefix_str ( const xmlChar *  prefix,
uint32  prefixlen,
ncx_module_t mod,
ncx_module_t **  targmod 
)

Get the correct module to use for a given prefix Unended string version.

This is used internally when processing YANG module expressions

Parameters
prefixstring to check
prefixlenlength of prefix
modmodule to use for the default context and prefixes will be relative to this module's import statements.
== NULL and the default registered prefixes will be used
targmodaddress of return module
Return values
*targmodtarget moduke to use
Returns
status
Here is the call graph for this function:

◆ xpath_get_cxt_obj()

obj_template_t* xpath_get_cxt_obj ( xpath_pcb_t pcb)

Get the object pointer for the context node.

Parameters
pcbparser control block to use
Returns
pointer to context object
Here is the call graph for this function:

◆ xpath_get_first_real_resnode()

xpath_resnode_t* xpath_get_first_real_resnode ( xpath_result_t result)

Get the first result in the renodeQ from a result struct.

That has a value node in it that has a real node; check all the nodes if needed

Parameters
resultresult struct to check
Returns
pointer to resnode or NULL if no resonde with values not deleted
Here is the call graph for this function:

◆ xpath_get_first_resnode()

xpath_resnode_t* xpath_get_first_resnode ( xpath_result_t result)

Get the first result in the renodeQ from a result struct.

Parameters
resultresult struct to check
Returns
pointer to resnode or NULL if some error
Here is the caller graph for this function:

◆ xpath_get_load_import()

void* xpath_get_load_import ( xpath_pcb_t pcb)

Get the PCB in load import mode.

Internal parser function

Parameters
pcbparser CB to check
Returns
import record cast as void *

◆ xpath_get_modinfo_from_prefix()

status_t xpath_get_modinfo_from_prefix ( const xmlChar *  prefix,
ncx_module_t mod,
const xmlChar **  modname,
const xmlChar **  modrev 
)

Get the correct module name/revision to use for a given prefix.

This is used internally when processing YANG module expressions

Parameters
prefixstring to check
modmodule to use for the default context and prefixes will be relative to this module's import statements.
== NULL and the default registered prefixes will be used
modnameaddress ot return modname
modrevaddress of return module revision
Return values
*modnamemodule name not found
*modrevrevision to use (may be set to NULL
Returns
status
Here is the call graph for this function:

◆ xpath_get_next_resnode()

xpath_resnode_t* xpath_get_next_resnode ( xpath_resnode_t resnode)

Get the next result in the renodeQ from a result struct.

Parameters
resnodecurrent result node to get next from
Returns
pointer to next resnode or NULL if some error
Here is the caller graph for this function:

◆ xpath_get_resnode_obj()

obj_template_t* xpath_get_resnode_obj ( xpath_resnode_t resnode)

Get the resnode object pointer from a value resnode.

Parameters
resnodepointer of result node struct
Returns
the object pointer or NULL if some error
Here is the caller graph for this function:

◆ xpath_get_resnode_objptr()

obj_template_t* xpath_get_resnode_objptr ( xpath_resnode_t resnode)

Get the result node object pointer (obsolete)

OBSOLETE: use xpath_get_resnode_obj instead

Parameters
resnoderesult node struct to check
Returns
pointer to resnode or NULL if some error
Here is the call graph for this function:

◆ xpath_get_resnode_val()

val_value_t* xpath_get_resnode_val ( xpath_resnode_t resnode)

Get the resnode value pointer from a resnode, if any.

Parameters
resnodepointer of result node struct
Returns
the value node pointer or NULL if no val pointer
Here is the call graph for this function:

◆ xpath_get_resnodeQ()

dlq_hdr_t* xpath_get_resnodeQ ( xpath_result_t result)

Get the renodeQ from a result struct.

Parameters
resultresult struct to check
Returns
pointer to resnodeQ or NULL if some error

◆ xpath_get_restype_str()

const xmlChar* xpath_get_restype_str ( xpath_restype_t  restype)

Get the string for the specific result type.

Used for debugging to print the node type

Parameters
restypeXPath result type to get string for
Returns
string for the specified result type
Here is the caller graph for this function:

◆ xpath_get_varbindQ()

dlq_hdr_t* xpath_get_varbindQ ( xpath_pcb_t pcb)

Get the varbindQ from a parser control block struct.

Parameters
pcbparser control block to use
Returns
pointer to varbindQ or NULL if some error

◆ xpath_init_resnode()

void xpath_init_resnode ( xpath_resnode_t resnode)

Initialize an XPath result node struct.

Parameters
resnodepointer to result node struct to initialize
Here is the caller graph for this function:

◆ xpath_init_result()

void xpath_init_result ( xpath_result_t result,
xpath_restype_t  restype 
)

Initialize an XPath result struct.

Parameters
resultpointer to result struct to initialize
restypethe desired result type
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_move_nodeset()

void xpath_move_nodeset ( xpath_result_t srcresult,
xpath_result_t destresult 
)

Move the nodes from a nodeset reult into the target nodeset result.

This is needed to support partial lock because multiple select expressions are allowed for the same partial lock

Parameters
srcresultXPath result nodeset source
destresultXPath result nodeset target
Return values
srcresultnodes will be moved to the target result
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_need_get2_processing()

boolean xpath_need_get2_processing ( xpath_result_t result)

Check if the result nodeset contains any XP_RNT_GET2 nodes.

Parameters
resultXPath result to check
Returns
TRUE if any GET2 nodes; FALSE if no GET2 nodes
Here is the call graph for this function:

◆ xpath_new_pcb()

xpath_pcb_t* xpath_new_pcb ( const xmlChar *  xpathstr,
xpath_getvar_fn_t  getvar_fn 
)

malloc a new XPath parser control block

xpathstr is allowed to be NULL, otherwise a strdup will be made and exprstr will be set

Create and initialize an XPath parser control block

Parameters
xpathstrXPath expression string to save (a copy will be made)
NULL if this step should be skipped
getvar_fncallback function to retirieve an XPath variable binding
NULL if no variables are used
Returns
pointer to malloced struct, NULL if malloc error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_new_pcb_ex()

xpath_pcb_t* xpath_new_pcb_ex ( const xmlChar *  xpathstr,
xpath_getvar_fn_t  getvar_fn,
void *  cookie 
)

malloc a new XPath parser control block Extended

xpathstr is allowed to be NULL, otherwise a strdup will be made and exprstr will be set

Create and initialize an XPath parser control block

Parameters
xpathstrXPath expression string to save (a copy will be made)
== NULL if this step should be skipped
getvar_fncallback function to retirieve an XPath variable binding
NULL if no variables are used
cookierunstack context pointer to use, cast as a cookie
Returns
pointer to malloced struct, NULL if malloc error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_new_pred_ent()

xpath_pred_ent_t* xpath_new_pred_ent ( obj_template_t keyobj,
const xmlChar *  keyval 
)

Malloc and init an XPath predicate entry struct.

Parameters
keyobjkey object in path for this predicate
keyvalvalue string to compare to GET2 matching key
Returns
malloced and initialized struct

◆ xpath_new_resnode()

xpath_resnode_t* xpath_new_resnode ( void  )

Create and initialize an XPath result node struct.

Returns
pointer to malloced struct, NULL if malloc error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_new_result()

xpath_result_t* xpath_new_result ( xpath_restype_t  restype)

malloc an XPath result

Create and initialize an XPath result struct Note that xpath_res module is used for actual management of XPath result nodes

Parameters
restypethe desired result type
Returns
pointer to malloced struct, NULL if malloc error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_new_session_pcb()

xpath_pcb_t* xpath_new_session_pcb ( ses_cb_t scb,
const xmlChar *  expr,
status_t res 
)

Get a new XPath parser control block for a session.

Set up the server variable bindings

Parameters
scbsession evaluating the XPath expression
exprexpression string to use (may be NULL)
resaddress of return status
Return values
*resreturn status
Returns
malloced and initialied xpath_pcb_t structure NULL if some error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_next_resnode_valptr()

val_value_t* xpath_next_resnode_valptr ( xpath_resnode_t resnode,
val_value_t valptr 
)

Get the next node val pointer from a result node struct.

Parameters
resnodepointer of result node struct
valptrcurrent value pointer to get next for
Returns
the next val pointer or NULL if some error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_nodeset_delete_valptr()

void xpath_nodeset_delete_valptr ( xpath_result_t result,
val_value_t oldval 
)

Check if the result has the oldval ptr and if so, delete it.

Parameters
resultresult struct to check
oldvalvalue ptr to find
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_nodeset_empty()

boolean xpath_nodeset_empty ( const xpath_result_t result)

Check if the result is an empty nodeset.

Parameters
resultXPath result to check
Returns
TRUE if this is an empty nodeset
FALSE if not empty or not a nodeset
Here is the caller graph for this function:

◆ xpath_nodeset_swap_valptr()

void xpath_nodeset_swap_valptr ( xpath_result_t result,
val_value_t oldval,
val_value_t newval 
)

Check if the result has the oldval ptr and if so, replace it with the newval ptr.

Parameters
resultresult struct to check
oldvalvalue ptr to find
newvalnew value replace it with if oldval is found
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_parse_token()

status_t xpath_parse_token ( xpath_pcb_t pcb,
tk_type_t  tktype 
)

Parse the XPath token sequence for a specific token type.

It has already been tokenized

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

Parameters
pcbparser control block in progress
tktypeexpected token type
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_resnode_count()

uint32 xpath_resnode_count ( xpath_result_t result)

Get the number of resnodes in the node-set.

Parameters
resultresult to check
Returns
number of resnodes (0 if not a node-set)
Here is the call graph for this function:

◆ xpath_result_is_get2()

boolean xpath_result_is_get2 ( xpath_result_t result)

Check if the result is a node-set for GET2 nodes.

Assumes cannot have a mixed result with GET2 and VALPTR or VALHDR

Parameters
resultresult struct to check
Returns
true if nodeset is not empty and has GET2 nodes

◆ xpath_set_backptrs_dirty()

void xpath_set_backptrs_dirty ( xpath_pcb_t pcb,
ncx_cfg_t  cfg_id,
boolean  dirty 
)

Set the backptrs_dirty flag in the PCB.

Parameters
pcbparser control block to use
cfg_idconfiguration datastore to check
dirtynew value TRUE=dirty; FALSE is cleared

◆ xpath_set_keep_result()

void xpath_set_keep_result ( xpath_pcb_t pcb)

Set the keep-result flag in the PCB.

Parameters
pcbparser control block to use

◆ xpath_set_load_import()

void xpath_set_load_import ( xpath_pcb_t pcb,
void *  yang_pcb 
)

Set the PCB in load import mode.

Internal parser function

Parameters
pcbparser CB to set
yang_pcbYANG parser CB to store

◆ xpath_set_manual_clear()

void xpath_set_manual_clear ( xpath_pcb_t pcb)

Set the manual clear mode flag in the PCB.

Parameters
pcbparser control block to check