yumapro  23.10T-7
YumaPro SDK
Loading...
Searching...
No Matches
XPath Data Structures

Internal data structures used for XPath evaluation. More...

Collaboration diagram for XPath Data Structures:

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...
 
struct  xpath_result_t
 XPath expression result. 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.
 

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

Enumerations

enum  xpath_restype_t {
  XP_RT_NONE ,
  XP_RT_NODESET ,
  XP_RT_NUMBER ,
  XP_RT_STRING ,
  XP_RT_BOOLEAN
}
 XPath expression result type. More...
 
enum  xpath_curmode_t {
  XP_CM_NONE ,
  XP_CM_TARGET ,
  XP_CM_ALT ,
  XP_CM_KEYVAR
}
 XPath dynamic parsing mode for leafref. More...
 
enum  xpath_document_t {
  XP_DOC_NONE ,
  XP_DOC_DATABASE ,
  XP_DOC_RPC ,
  XP_DOC_RPC_REPLY ,
  XP_DOC_NOTIFICATION
}
 document root type. More...
 
enum  xpath_source_t {
  XP_SRC_NONE ,
  XP_SRC_LEAFREF ,
  XP_SRC_YANG ,
  XP_SRC_INSTANCEID ,
  XP_SRC_SCHEMA_INSTANCEID ,
  XP_SRC_XML
}
 XPath expression source type. More...
 
enum  xpath_exop_t {
  XP_EXOP_NONE ,
  XP_EXOP_AND ,
  XP_EXOP_OR ,
  XP_EXOP_EQUAL ,
  XP_EXOP_NOTEQUAL ,
  XP_EXOP_LT ,
  XP_EXOP_GT ,
  XP_EXOP_LEQUAL ,
  XP_EXOP_GEQUAL ,
  XP_EXOP_ADD ,
  XP_EXOP_SUBTRACT ,
  XP_EXOP_MULTIPLY ,
  XP_EXOP_DIV ,
  XP_EXOP_MOD ,
  XP_EXOP_NEGATE ,
  XP_EXOP_UNION ,
  XP_EXOP_FILTER1 ,
  XP_EXOP_FILTER2
}
 XPath expression operation type. More...
 
enum  xpath_nodetype_t {
  XP_EXNT_NONE ,
  XP_EXNT_COMMENT ,
  XP_EXNT_TEXT ,
  XP_EXNT_PROC_INST ,
  XP_EXNT_NODE
}
 XPath expression node types. More...
 
enum  xpath_rntype_t {
  XP_RNT_NONE ,
  XP_RNT_OBJ ,
  XP_RNT_VAL ,
  XP_RNT_VALHDR ,
  XP_RNT_GET2
}
 XPath resnode union types. More...
 
enum  xpath_get2_state_t {
  XP_RST_NONE ,
  XP_RST_GET2_PENDING ,
  XP_RST_GET2_SKIPPED ,
  XP_RST_GET2_START ,
  XP_RST_GET2_DONE ,
  XP_RST_GET2_ERROR
}
 GET2 retrieval states. More...
 
enum  xpath_get2_form_t {
  XP_FORM_NONE ,
  XP_FORM_GETCB ,
  XP_FORM_GETCB_TERM ,
  XP_FORM_GETCB_CHILD
}
 GET2 control block forms. More...
 

Detailed Description

Internal data structures used for XPath evaluation.

Macro Definition Documentation

◆ XP_FL_ACTION_INPUT

#define XP_FL_ACTION_INPUT   bit9

set if starting context node is within action input which is allowed in YANG 1.1

  T: is within action/input
  F: is not within action input set in set_nodeset_parent

◆ XP_FL_DYNNODE

#define XP_FL_DYNNODE   bit0

Begin XPath control block flag definitions (uint32).

If dynnode is present, then at least one component within the entire XPath expression is variable. Only relevant if the source is XP_SRC_LEAFREF!!! Any predicate found will cause this bit to be set If not set, then the expression is considered constant either /foo/bar/baz or ../bar/baz

  **** NO LONGER USED ****
  **** Use xpath_expr_scan_predicates() instead ****

◆ XP_FL_LOAD_IMPORT

#define XP_FL_LOAD_IMPORT   bit2

OLD: bit 2 not used.

during leafref resolution need to force import being loaded

◆ XP_FL_TOP_RPC_INPUT

#define XP_FL_TOP_RPC_INPUT   bit8

set if starting context node is RPC input which is allowed in YANG 1.1

  T: is RPC/input
  F: is not, could be RPC/output or NOTIF

Typedef Documentation

◆ xpath_bool_eval_fn_t

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.

Callback to implement the XPath semantics for a must or when statement for a datastore object.

Use XPATH_EXPRSTR(pcb) to examine the XPath expression The callback must return ERR_NCX_SKIPPED if the expression evaluation is skipped.

Only supported for used during datastore processing to access configuration nodes (val_value_t tree) Support for GET2 callbacks not supported at this time

Used in the server to optimize datastore validation and delete_dead_nodes when-stmt processing.

Parameters
pcbXPath parser control block in use
contextcontext value node to use. The object of this node contains a pointer to this callback function
docrootdocument root value node to use.
[out]resultaddress of return result if NO_ERR
  • *result is TRUE if the must/when result is true
  • *result is FALSE if the must/when result is false
Returns
status
Return values
NO_ERRif test is done and *result is valid
ERR_NCX_SKIPPEDif test is not done and *result is not valid. Actual XPath eval will be done instead.
othererror to force the XPath test to fail with an error and datastore operation will fail

◆ xpath_fn_t

typedef xpath_result_t *(* xpath_fn_t) (xpath_pcb_t *pcb, dlq_hdr_t *parmQ, status_t *res)

XPath function prototype.

The XPath functions are stored in an array and every one uses the same API signature so the XPath parser can invoke them easily without knowing anything about any of the functions

Parameters
pcbXPath parser control block to use
parmQQ of xpath_result_t prepresenting the ordered parameter list
[out]resaddress of return status
  • *res result status
Returns
pointer to malloced XPath result representing the result of the function call

◆ xpath_getvar_fn_t

typedef ncx_var_t *(* xpath_getvar_fn_t) (struct xpath_pcb_t_ *pcb, const xmlChar *varname, status_t *res)

XPath GET variable callback function.

Access to XPath variable implementation. Used in NACM for USER variable. Used in yangcli for complete hierarchy of name, val_value_t pairs

Callback function for retrieval of a variable binding

Parameters
pcbXPath parser control block in use
varnamevariable name requested
[out]resaddress of return status
  • *res return status
Returns
pointer to the ncx_var_t data structure for the specified varbind (malloced and filled in)

Enumeration Type Documentation

◆ xpath_curmode_t

XPath dynamic parsing mode for leafref.

Enumerator
XP_CM_NONE 

not set

XP_CM_TARGET 

target mode (normal)

XP_CM_ALT 

alternate mode

XP_CM_KEYVAR 

key variable mode

◆ xpath_document_t

document root type.

YANG supports several document contexts

Enumerator
XP_DOC_NONE 

not set

XP_DOC_DATABASE 

datastore context

XP_DOC_RPC 

rpc-input context

XP_DOC_RPC_REPLY 

rpc-output context

XP_DOC_NOTIFICATION 

notification context

◆ xpath_exop_t

XPath expression operation type.

Enumerator
XP_EXOP_NONE 

not set

XP_EXOP_AND 

keyword 'and'

XP_EXOP_OR 

keyword 'or'

XP_EXOP_EQUAL 

equals '='

XP_EXOP_NOTEQUAL 

bang equals '!='

XP_EXOP_LT 

left angle bracket '<'

XP_EXOP_GT 

right angle bracket '>'

XP_EXOP_LEQUAL 

l.

angle-equals '<=

XP_EXOP_GEQUAL 

r.

angle-equals '>='

XP_EXOP_ADD 

plus sign '+'

XP_EXOP_SUBTRACT 

minus '-'

XP_EXOP_MULTIPLY 

asterisk '*'

XP_EXOP_DIV 

keyword 'div'

XP_EXOP_MOD 

keyword 'mod'

XP_EXOP_NEGATE 

unary '-'

XP_EXOP_UNION 

vert.

bar '|'

XP_EXOP_FILTER1 

fwd slash '/'

XP_EXOP_FILTER2 

double fwd slash (C++ comment)

◆ xpath_get2_form_t

GET2 control block forms.

Enumerations of internal GET2 API variants

Enumerator
XP_FORM_NONE 

not set

XP_FORM_GETCB 

normal GET2 CB

XP_FORM_GETCB_TERM 

terminal node CB

XP_FORM_GETCB_CHILD 

child node CB

◆ xpath_get2_state_t

GET2 retrieval states.

Enumerations for internal states for GET2 processing

Enumerator
XP_RST_NONE 

not set

XP_RST_GET2_PENDING 

GET2 callback pending.

XP_RST_GET2_SKIPPED 

GET2 callback skipped.

XP_RST_GET2_START 

GET2 callback starting.

XP_RST_GET2_DONE 

GET2 callback done.

XP_RST_GET2_ERROR 

GET2 callback error happened.

◆ xpath_nodetype_t

XPath expression node types.

Defined by the XML standard

Enumerator
XP_EXNT_NONE 

not set

XP_EXNT_COMMENT 

comment node

XP_EXNT_TEXT 

text node

XP_EXNT_PROC_INST 

processing instruction

XP_EXNT_NODE 

XML start, empty, or end tag.

◆ xpath_restype_t

XPath expression result type.

Enumerator
XP_RT_NONE 

not set

XP_RT_NODESET 

node-set result

XP_RT_NUMBER 

number result

XP_RT_STRING 

string result

XP_RT_BOOLEAN 

boolean result

◆ xpath_rntype_t

XPath resnode union types.

Internal enumeration of implementation variants in a result node

Enumerator
XP_RNT_NONE 

not set

XP_RNT_OBJ 

objnode

XP_RNT_VAL 

valptr

XP_RNT_VALHDR 

valhdr

XP_RNT_GET2 

get2ptr

◆ xpath_source_t

XPath expression source type.

Internal classification for YANG handling

Enumerator
XP_SRC_NONE 

not set

XP_SRC_LEAFREF 

leafref path

XP_SRC_YANG 

YANG must or when.

XP_SRC_INSTANCEID 

instance-identifier

XP_SRC_SCHEMA_INSTANCEID 

schema-instance-identifier

XP_SRC_XML 

NETCONF select filter.