yumapro
24.10-3
YumaPro SDK
|
XPath Parser Support Functions. More...
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_schema_target_load (const xmlChar *target, boolean for_mp, obj_template_t **targobj) |
@ 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_t * | xpath_new_pcb (const xmlChar *xpathstr, xpath_getvar_fn_t getvar_fn) |
malloc a new XPath parser control block More... | |
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 More... | |
xpath_pcb_t * | xpath_clone_pcb (const xpath_pcb_t *srcpcb) |
Clone an XPath PCB. More... | |
xpath_pcb_t * | xpath_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_t * | xpath_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_t * | xpath_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 (xpath_pcb_t *pcb, 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 (xpath_pcb_t *pcb, 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 (xpath_pcb_t *pcb, 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_t * | xpath_get_first_resnode (xpath_result_t *result) |
Get the first result in the renodeQ from a result struct. More... | |
xpath_resnode_t * | xpath_get_next_resnode (xpath_resnode_t *resnode) |
Get the next result in the renodeQ from a result struct. More... | |
val_value_t * | xpath_first_resnode_valptr (xpath_resnode_t *resnode) |
Get the first result in the renodeQ from a result struct. More... | |
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. More... | |
obj_template_t * | xpath_get_resnode_obj (xpath_resnode_t *resnode) |
Get the resnode object pointer from a value resnode. More... | |
obj_template_t * | xpath_get_cxt_obj (xpath_pcb_t *pcb) |
Get the object pointer for the context node. More... | |
val_value_t * | xpath_get_resnode_val (xpath_resnode_t *resnode) |
Get the resnode value pointer from a resnode, if any. More... | |
obj_template_t * | xpath_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_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. 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_t * | xpath_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_t * | xpath_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... | |
status_t | xpath_set_result (xpath_pcb_t *pcb, xpath_result_t *result) |
Set the result field to save a result with the PCB. More... | |
xpath_result_t * | xpath_get_result (xpath_pcb_t *pcb) |
Get the result from a PCB. More... | |
status_t | xpath_make_load_path (const xmlChar *target, xmlChar **retbuff) |
Convert the schema path string to the internal canonical format. More... | |
XPath Parser Support Functions.
status_t xpath_add_to_result | ( | xpath_result_t * | source, |
xpath_result_t * | target | ||
) |
Move the resnodes from 1 XPath result to another.
[in,out] | source | source result
|
[in,out] | target | target result
|
boolean xpath_check_backptrs_dirty | ( | xpath_pcb_t * | pcb, |
ncx_cfg_t | cfg_id | ||
) |
Check the backptrs_dirty flag in the PCB.
pcb | parser control block to use |
cfg_id | configuration datastore to check |
boolean xpath_check_manual_clear | ( | xpath_pcb_t * | pcb | ) |
Check the backptrs_dirty flag in the PCB is clearly manually only.
pcb | parser control block to check |
void xpath_clean_resnode | ( | xpath_resnode_t * | resnode | ) |
Clean an XPath result node struct.
resnode | pointer to result node struct to clean |
void xpath_clean_result | ( | xpath_result_t * | result | ) |
Clean an XPath result struct.
result | pointer to result struct to clean |
void xpath_clear_load_import | ( | xpath_pcb_t * | pcb | ) |
Clear the PCB out of load import mode.
Internal parser function
pcb | parser CB to clear |
void xpath_clear_nodeset_result | ( | xpath_result_t * | result | ) |
Clear all the nodes from the node-set result.
result | result to clear |
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
srcpcb | struct with starting contents |
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
urlpath | URL path string to convert to XPath | |
match_names | enum for selected match names mode | |
alt_naming | TRUE if alt-name and cli-drop-node-name containers should be checked | |
wildcards | TRUE if wildcards allowed instead of key values FALSE if the '-' wildcard mechanism not allowed | |
withkeys | TRUE if keys are expected FALSE if just nodes are expected | |
fullkeys | TRUE if complete keys are expected FALSE if last list node can end with a partial or missing key; ignored unless withkeys=TRUE | |
withmod | TRUE if modname:name is expected FALSE to skip modname match test | |
proto | protocol enum needed for YANG-API vs. RESTCONF | |
[out] | res | address of return status
|
boolean xpath_cvt_boolean | ( | const xpath_result_t * | result | ) |
Convert an XPath result to a boolean answer.
result | result struct to convert to boolean |
void xpath_cvt_number | ( | const xpath_result_t * | result, |
ncx_num_t * | num | ||
) |
Convert an XPath result to a number answer.
result | result struct to convert to a number | |
[out] | num | pointer to ncx_num_t to hold the conversion result
|
status_t xpath_cvt_string | ( | xpath_pcb_t * | pcb, |
const xpath_result_t * | result, | ||
xmlChar ** | str | ||
) |
Convert an XPath result to a string answer.
pcb | parser control block to use | |
result | result struct to convert to a number | |
[out] | str | pointer to xmlChar * to hold the conversion result
|
void xpath_delete_resnode | ( | xpath_resnode_t * | resnode | ) |
Delete and free a malloced XPath result node struct.
resnode | pointer to result node struct to free |
void xpath_discard_resnode | ( | xpath_resnode_t * | resnode | ) |
Discard a result node.
resnode | result node to remove and free |
boolean xpath_expr_has_predicates | ( | xpath_pcb_t * | pcb | ) |
Check if any predicates parsed in the expression.
pcb | parser control block to use |
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
pcb | XPath control block with token chain expected to be present |
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
pcb | parser control block to use |
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
pcb | XPath control block containing expression string to evaluate | |
[out] | targobj | address of return object (may be NULL)
|
boolean xpath_find_obj_in_result | ( | xpath_result_t * | result, |
obj_template_t * | obj | ||
) |
Find the object pointer in the specified result.
result | result to check |
obj | object pointer to find |
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
pcbQ | Q of xpath_pcb_t structs to check |
exprstr | XPath expression string to find |
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
pcb | parser control block to use | |
tkc | token chain in progress (may be NULL: errmsg only) | |
mod | module in progress | |
obj | augment object initiating search, NULL to start at top | |
datadefQ | == Q of obj_template_t containing 'obj' | |
target | Xpath expression string to evaluate | |
[out] | targobj | address of return object (may be NULL)
|
[out] | targQ | address of return target queue (may be NULL)
|
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
pcb | parser control block to use | |
tkc | token chain in progress (may be NULL: errmsg only) | |
mod | module in progress | |
obj | augment object initiating search, NULL to start at top | |
datadefQ | == Q of obj_template_t containing 'obj' | |
target | Xpath expression string to evaluate | |
[out] | targobj | address of return object (may be NULL)
|
[out] | targQ | address of return target queue (may be NULL)
|
tkerr | error struct to use if any messages generated |
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
pcb | parser control block to use | |
tkc | token chain in progress (may be NULL: errmsg only) | |
mod | module in progress | |
force_mod | limit target object to this module | |
obj | augment object initiating search, NULL to start at top | |
datadefQ | == Q of obj_template_t containing 'obj' | |
target | Xpath expression string to evaluate | |
[out] | targobj | address of return object (may be NULL)
|
[out] | targQ | address of return target queue (may be NULL)
|
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
target | absolute Xpath expression string to evaluate | |
[out] | targobj | address of return object (may be NULL)
|
status_t xpath_find_schema_target_load | ( | const xmlChar * | target, |
boolean | for_mp, | ||
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 FOR SCHEMA MOUNT SUPPORT
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
target | absolute Xpath expression string to evaluate | |
for_mp | TRUE if loading a mount point module; FALSE for top module | |
[out] | targobj | address of return object (may be NULL)
|
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
target | absolute Xpath expression string to evaluate | |
[out] | targobj | address of return object (may be NULL)
|
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
startval | top-level start element to search | |
mod | module 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 | |
target | Xpath expression string to evaluate | |
[out] | targval | address of return value (may be NULL)
|
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
startval | starting context node (contains unique-stmt) | |
mod | module 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 | |
target | Xpath expression string to evaluate | |
root | XPath docroot to use | |
logerrors | TRUE to use log_error, FALSE to skip it | |
configonly | TRUE if only checking config=treu objects | |
[out] | retpcb | == address of return value
|
val_value_t * xpath_first_resnode_valptr | ( | xpath_resnode_t * | resnode | ) |
Get the first result in the renodeQ from a result struct.
resnode | result node struct to check |
void xpath_free_pcb | ( | xpath_pcb_t * | pcb | ) |
Free a malloced XPath parser control block.
pcb | pointer to parser control block to free |
void xpath_free_pred_ent | ( | xpath_pred_ent_t * | ent | ) |
Free a malloced XPath predicate entry struct.
ent | predicate struct to free |
void xpath_free_resnode | ( | xpath_resnode_t * | resnode | ) |
Free a malloced XPath result node struct.
resnode | pointer to result node struct to free |
void xpath_free_result | ( | xpath_result_t * | result | ) |
Free a malloced XPath result struct.
result | pointer to result struct to free |
status_t xpath_get_curmod_from_prefix | ( | xpath_pcb_t * | pcb, |
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
pcb | parser control block in progress | |
prefix | string to check | |
mod | module 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 | |
[out] | targmod | address of return module
|
status_t xpath_get_curmod_from_prefix2 | ( | xpath_pcb_t * | pcb, |
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
pcb | parser control block in progress | |
prefix | string to check | |
mod | module 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 | |
[out] | targmod | address of return module
|
[out] | modname | address ot return modname
|
status_t xpath_get_curmod_from_prefix_str | ( | xpath_pcb_t * | pcb, |
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
pcb | parser control block in progress | |
prefix | string to check | |
prefixlen | length of prefix | |
mod | module 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 | |
[out] | targmod | address of return module
|
obj_template_t * xpath_get_cxt_obj | ( | xpath_pcb_t * | pcb | ) |
Get the object pointer for the context node.
pcb | parser control block to use |
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
result | result struct to check |
xpath_resnode_t * xpath_get_first_resnode | ( | xpath_result_t * | result | ) |
Get the first result in the renodeQ from a result struct.
result | result struct to check |
void * xpath_get_load_import | ( | xpath_pcb_t * | pcb | ) |
Get the PCB in load import mode.
Internal parser function
pcb | parser CB to check |
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
prefix | string to check | |
mod | module 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 | |
[out] | modname | address ot return modname
|
[out] | modrev | address of return module revision
|
xpath_resnode_t * xpath_get_next_resnode | ( | xpath_resnode_t * | resnode | ) |
Get the next result in the renodeQ from a result struct.
resnode | current result node to get next from |
obj_template_t * xpath_get_resnode_obj | ( | xpath_resnode_t * | resnode | ) |
Get the resnode object pointer from a value resnode.
resnode | pointer of result node struct |
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
resnode | result node struct to check |
val_value_t * xpath_get_resnode_val | ( | xpath_resnode_t * | resnode | ) |
Get the resnode value pointer from a resnode, if any.
resnode | pointer of result node struct |
dlq_hdr_t * xpath_get_resnodeQ | ( | xpath_result_t * | result | ) |
Get the renodeQ from a result struct.
result | result struct to check |
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
restype | XPath result type to get string for |
xpath_result_t * xpath_get_result | ( | xpath_pcb_t * | pcb | ) |
Get the result from a PCB.
pcb | XPath PCB to save result in |
dlq_hdr_t * xpath_get_varbindQ | ( | xpath_pcb_t * | pcb | ) |
Get the varbindQ from a parser control block struct.
pcb | parser control block to use |
void xpath_init_resnode | ( | xpath_resnode_t * | resnode | ) |
Initialize an XPath result node struct.
resnode | pointer to result node struct to initialize |
void xpath_init_result | ( | xpath_result_t * | result, |
xpath_restype_t | restype | ||
) |
Initialize an XPath result struct.
result | pointer to result struct to initialize |
restype | the desired result type |
status_t xpath_make_load_path | ( | const xmlChar * | target, |
xmlChar ** | retbuff | ||
) |
Convert the schema path string to the internal canonical format.
YPW-2155: a SIL or subsystem from 22.10 and lower has a different defpath format than the 23.10 and onward. It is possible for multiple callback entries to point to the same object. This function is used in agt_cb.c to make sure all SIL and SIL-SA register/unregister path strings are in canonical format.
target | Xpath expression string in progress to convert | |
[out] | retbuff | malloced return buffer if NO_ERR |
ERR_NCX_SKIPPED | if no change |
NO_ERR | if changed and *retbuff has the new value |
ERR_INTERNAL_MEM | if malloc failed |
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
[in,out] | srcresult | XPath result nodeset source |
[out] | destresult | XPath result nodeset target
|
boolean xpath_need_get2_processing | ( | xpath_result_t * | result | ) |
Check if the result nodeset contains any XP_RNT_GET2 nodes.
result | XPath result to check |
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
xpathstr | XPath expression string to save (a copy will be made) NULL if this step should be skipped |
getvar_fn | callback function to retirieve an XPath variable binding NULL if no variables are used |
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
xpathstr | XPath expression string to save (a copy will be made) == NULL if this step should be skipped |
getvar_fn | callback function to retirieve an XPath variable binding NULL if no variables are used |
cookie | runstack context pointer to use, cast as a cookie |
xpath_pred_ent_t * xpath_new_pred_ent | ( | obj_template_t * | keyobj, |
const xmlChar * | keyval | ||
) |
Malloc and init an XPath predicate entry struct.
keyobj | key object in path for this predicate |
keyval | value string to compare to GET2 matching key |
xpath_resnode_t * xpath_new_resnode | ( | void | ) |
Create and initialize an XPath result node struct.
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
restype | the desired result type |
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
scb | session evaluating the XPath expression | |
expr | expression string to use (may be NULL) | |
[out] | res | address of return status
|
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.
resnode | pointer of result node struct |
valptr | current value pointer to get next for |
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.
result | result struct to check |
oldval | value ptr to find |
boolean xpath_nodeset_empty | ( | const xpath_result_t * | result | ) |
Check if the result is an empty nodeset.
result | XPath result to check |
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.
result | result struct to check |
oldval | value ptr to find |
newval | new value replace it with if oldval is found |
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
pcb | parser control block in progress |
tktype | expected token type |
uint32 xpath_resnode_count | ( | xpath_result_t * | result | ) |
Get the number of resnodes in the node-set.
result | result to check |
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
result | result struct to check |
void xpath_set_backptrs_dirty | ( | xpath_pcb_t * | pcb, |
ncx_cfg_t | cfg_id, | ||
boolean | dirty | ||
) |
Set the backptrs_dirty flag in the PCB.
pcb | parser control block to use |
cfg_id | configuration datastore to check |
dirty | new value TRUE=dirty; FALSE is cleared |
void xpath_set_keep_result | ( | xpath_pcb_t * | pcb | ) |
Set the keep-result flag in the PCB.
pcb | parser control block to use |
void xpath_set_load_import | ( | xpath_pcb_t * | pcb, |
void * | yang_pcb | ||
) |
Set the PCB in load import mode.
Internal parser function
pcb | parser CB to set |
yang_pcb | YANG parser CB to store |
void xpath_set_manual_clear | ( | xpath_pcb_t * | pcb | ) |
Set the manual clear mode flag in the PCB.
pcb | parser control block to check |
status_t xpath_set_result | ( | xpath_pcb_t * | pcb, |
xpath_result_t * | result | ||
) |
Set the result field to save a result with the PCB.
Hand off result memory here to the PCB
pcb | XPath PCB to save result in |
result | result struct to save |