yumapro
24.10-1
YumaPro SDK
|
Schema and data model Xpath search support. More...
#include <xmlstring.h>
#include <xmlreader.h>
#include <xmlregexp.h>
#include "dlq.h"
#include "ncxtypes.h"
#include "status.h"
#include "obj.h"
#include "tk.h"
#include "val.h"
#include "var.h"
#include "yang.h"
Go to the source code of this file.
Data Structures | |
struct | xpath_get2_cb_t |
Special XPath GET2 state record to be used instead of val_value_t or val_child_hdr_t pointers. More... | |
struct | xpath_get2_node_t |
Special XPath GET2 resnode. More... | |
struct | xpath_resnode_t |
XPath result node struct. More... | |
union | xpath_resnode_t::node_ |
if the result->isval flag is false then the objptr is used in all resnodes in that result More... | |
struct | xpath_result_t |
XPath expression result. More... | |
union | xpath_result_t::r_ |
result r contains the appropiate data depending on restype More... | |
struct | xpath_pred_ent_t |
quick processing of NACM data rule predicates. More... | |
struct | xpath_pcb_t |
XPath parser control block. More... | |
struct | xpath_fncb_t |
XPath function control block. More... | |
struct | xpath_walkerparms_t |
Value or object node walker fn callback parameters. More... | |
struct | xpath_compwalkerparms_t |
Value node compare walker fn callback parameters. More... | |
struct | xpath_stringwalkerparms_t |
Value node stringify walker fn callback parameters. More... | |
struct | xpath_aio_cb_t |
AIO Subtree respresentation. More... | |
Macros | |
#define | XP_URL_ESC_WILDCARD '-' |
Special URL to XPath translation. | |
#define | XP_FL_DYNNODE bit0 |
Begin XPath control block flag definitions (uint32). More... | |
#define | XP_FL_SKIP_MODE bit1 |
during XPath evaluation, skipping the rest of a FALSE AND or TRUE OR expression | |
#define | XP_FL_LOAD_IMPORT bit2 |
OLD: bit 2 not used. More... | |
#define | XP_FL_ABSPATH bit3 |
used by xpath_leafref.c to keep track of path type | |
#define | XP_FL_CONFIGONLY bit4 |
used for YANG/NETCONF to auto-filter any non-config nodes that are matched by an XPath wildcard mechanism | |
#define | XP_FL_USEROOT bit5 |
used to indicate the top object node is set FALSE to indicate that all the ncx_module_t datadefQs need to be searched instead | |
#define | XP_FL_INSTANCEID bit6 |
used to restrict the XPath expression to the YANG instance-identifier syntax | |
#define | XP_FL_SCHEMA_INSTANCEID bit7 |
used to restrict the XPath expression to an ncx:schema-instance string syntax | |
#define | XP_FL_TOP_RPC_INPUT bit8 |
set if starting context node is RPC input which is allowed in YANG 1.1 More... | |
#define | XP_FL_ACTION_INPUT bit9 |
set if starting context node is within action input which is allowed in YANG 1.1 More... | |
#define | XP_FL_NACM_GET2 bit10 |
set if the XPath parser is being called to cache a data rule but found a GET2 node, forcing this rule to be checked during GET2 traversal | |
#define | XP_FL_KEEP_RESULT bit11 |
set if the caller wants the test result to be kept will free pcb->result if already set when trying to save eval result | |
#define | XP_FL_FOUND_PRED bit12 |
set if the parser found any predicates in the XPath expression | |
#define | XP_FL_GET_WHEN bit13 |
the parser is processing a when-stmt for a GET node so retrieve the value now instead of leaving the state to XP_RSP_GET2_PENDING | |
#define | XP_FL_FROM_DBLSLASH bit14 |
if the PCB is created from a converted dblslash expression then the scb->reader cannot be used so flag it as a converted filter | |
#define | XP_FL_EMPTY_GET bit15 |
flag to indicate that the get operation has an empty return set for the filter evaluation and the final output needs to skip the XPath evaluation | |
#define | XP_FL_BACKPTR_CDIRTY bit0 |
static config dirty for <candidate> | |
#define | XP_FL_BACKPTR_RDIRTY bit1 |
static config dirty for <running> | |
#define | XP_FL_BACKPTR_SDIRTY bit2 |
static config dirty for <startup> | |
#define | XPATH_GET_TYPE(P) (P)->xpath_type |
get the XPath type from xpath_pcb_t * (P) | |
#define | XPATH_GET_RESTYPE(R) (R)->restype |
get the result type from xpath_result_t * (R) | |
#define | XPATH_NACM_GET2(P) ((P)->flags & XP_FL_NACM_GET2) |
test if the NACM GET2 mode is active in xpath_pcb_t (P) | |
#define | XPATH_NONCONFIG_WARN(P) (P)->nonconfig_warn_obj |
YPW-1363: check nonconfig warning. | |
#define | XPATH_VAL_CXT(P) ((P)->val || (P)->val_get2) |
test if context node is a value or get2 in xpath_pcb_t * (P) | |
#define | XPATH_ANY_CXT(P) ((P)->val || (P)->val_get2 || (P)->obj) |
test if context node is a value or get2 in xpath_pcb_t * (P) | |
#define | XPATH_SCB(P) (P)->scb |
access the XPath scb backptr in xpath_pcb_t * (P) | |
#define | XPATH_GET2CB_OBJ(N) (N)->cb->obj |
access the GET2 control block object in xpath_get2_node_t (N) | |
#define | XPATH_MHDR(P) (P)->mhdr |
access the message header back pointer | |
#define | XPATH_EXPRSTR(P) (P)->exprstr |
access the XPath extression string | |
#define | XPATH_SET_DISABLED_OBJ_OK(P) (P)->disabled_obj_ok = TRUE |
set the disabled_obj_ok flag | |
#define | XPATH_CLR_DISABLED_OBJ_OK(P) (P)->disabled_obj_ok = FALSE |
clear the disabled_obj_ok flag | |
#define | XPATH_DISABLED_OBJ_OK(P) (P)->disabled_obj_ok |
check the disabled_obj_ok flag | |
#define | XPATH_ROOTCB(P) (P)->rootcb |
access the rootcb back pointer | |
#define | XPATH_SET_FROM_DBLSLASH(P) (P)->flags |= XP_FL_FROM_DBLSLASH |
SET if the PCB is from a converted dblslash expression. | |
#define | XPATH_IS_FROM_DBLSLASH(P) ((P)->flags & XP_FL_FROM_DBLSLASH) |
TEST if the PCB is from a converted dblslash expression. | |
#define | XPATH_SET_EMPTY_GET(P) (P)->flags |= XP_FL_EMPTY_GET |
SET if the PCB is a forced empty return. | |
#define | XPATH_IS_EMPTY_GET(P) ((P)->flags & XP_FL_EMPTY_GET) |
TEST if the PCB is a forced empty return. | |
#define | XPATH_WHEN_OBJ(P) (P)->when_obj |
access the when_obj backptr in xpath_pcb_t * (P) | |
Typedefs | |
typedef ncx_var_t *(* | xpath_getvar_fn_t) (struct xpath_pcb_t_ *pcb, const xmlChar *varname, status_t *res) |
XPath GET variable callback function. More... | |
typedef status_t(* | xpath_bool_eval_fn_t) (struct xpath_pcb_t_ *pcb, val_value_t *context, val_value_t *docroot, boolean *result) |
XPath Boolean EVAL Replacement Callback. More... | |
typedef xpath_result_t *(* | xpath_fn_t) (xpath_pcb_t *pcb, dlq_hdr_t *parmQ, status_t *res) |
XPath function prototype. 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... | |
Schema and data model Xpath search support.