yumapro  24.10-2
YumaPro SDK
Loading...
Searching...
No Matches
xpath1.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
3 * Copyright (c) 2012 - 2021, YumaWorks, Inc., All Rights Reserved.
4 *
5 * Unless required by applicable law or agreed to in writing,
6 * software distributed under the License is distributed on an
7 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8 * KIND, either express or implied. See the License for the
9 * specific language governing permissions and limitations
10 * under the License.
11 */
12#ifndef _H_xpath1
13#define _H_xpath1
14
15/* FILE: xpath1.h
16*********************************************************************
17* *
18* P U R P O S E *
19* *
20*********************************************************************/
21
27/*********************************************************************
28* *
29* C H A N G E H I S T O R Y *
30* *
31*********************************************************************
32
33date init comment
34----------------------------------------------------------------------
3513-nov-08 abb Begun
36
37*/
38
39#ifndef _H_dlq
40#include "dlq.h"
41#endif
42
43#ifndef _H_getcb
44#include "getcb.h"
45#endif
46
47#ifndef _H_ncxtypes
48#include "ncxtypes.h"
49#endif
50
51#ifndef _H_obj
52#include "obj.h"
53#endif
54
55#ifndef _H_status_enum
56#include "status_enum.h"
57#endif
58
59#ifndef _H_tk
60#include "tk.h"
61#endif
62
63#ifndef _H_val
64#include "val.h"
65#endif
66
67#ifndef _H_xpath
68#include "xpath.h"
69#endif
70
71#ifdef __cplusplus
72extern "C" {
73#endif
74
75/********************************************************************
76* *
77* C O N S T A N T S *
78* *
79*********************************************************************/
80
81
96#define SET_SKIP_MODE(pcb) (pcb)->flags |= XP_FL_SKIP_MODE
97
99#define CLEAR_SKIP_MODE(pcb) (pcb)->flags &= ~XP_FL_SKIP_MODE
100
102#define IS_SKIP_MODE(pcb) ((pcb)->flags & XP_FL_SKIP_MODE)
103
104
105/********************************************************************
106* *
107* T Y P E S *
108* *
109*********************************************************************/
110
111/********************************************************************
112* *
113* F U N C T I O N S *
114* *
115*********************************************************************/
116
117
154extern status_t
156 ncx_module_t *mod,
157 xpath_pcb_t *pcb,
158 xpath_source_t source);
159
160
186extern status_t
188 obj_template_t *obj,
189 xpath_pcb_t *pcb);
190
191
225extern status_t
227 obj_template_t *obj,
228 xpath_pcb_t *pcb,
229 boolean missing_is_error,
230 boolean set_backptrs,
231 ncx_xpath_type_t backptr_type);
232
233
234
246extern status_t
248
249
259extern status_t
261 obj_template_t *when_obj,
262 obj_template_t *context_obj,
263 xpath_pcb_t *pcb);
264
265
266
295extern xpath_result_t *
297 val_value_t *val,
298 val_value_t *docroot,
299 boolean logerrors,
300 boolean configonly,
301 status_t *res);
302
303
333extern xpath_result_t *
335 val_value_t *val,
336 val_value_t *docroot,
337 boolean logerrors,
338 boolean configonly,
339 boolean force_only,
340 status_t *res);
341
342
376extern xpath_result_t *
378 val_value_t *val,
379 val_value_t *docroot,
380 boolean logerrors,
381 boolean configonly,
382 boolean force_only,
383 xml_msg_hdr_t *get2_mhdr,
384 boolean get_when,
385 xpath_get2_node_t *val_get2,
386 status_t *res);
387
388
402extern status_t
404 getcb_get2_t *get2cb,
405 boolean *testres);
406
407
439extern xpath_result_t *
440 xpath1_eval_xmlexpr (xmlTextReaderPtr reader,
441 xpath_pcb_t *pcb,
442 val_value_t *val,
443 val_value_t *docroot,
444 boolean logerrors,
445 boolean configonly,
446 status_t *res);
447
448
460extern void
462 xpath_result_t *result);
463
464
481extern boolean
483 dlq_hdr_t *resultQ,
484 const val_value_t *val);
485
486
504extern boolean
506 dlq_hdr_t *resultQ,
507 const val_value_t *val);
508
509
526extern boolean
528 dlq_hdr_t *resultQ,
529 xpath_resnode_t *resnode);
530
531
545extern status_t
547 const xpath_result_t *result,
548 xmlChar **str);
549
550
562extern status_t
564 val_value_t *val,
565 xmlChar **str);
566
567
580extern boolean
582 xpath_result_t *result,
583 xmlChar *strval,
584 status_t *res);
585
586
600extern boolean
602 xpath_result_t *result,
603 ncx_num_t *numval,
604 status_t *res);
605
606
620extern boolean
622 xpath_result_t *result1,
623 xpath_result_t *result2,
624 status_t *res);
625
626
634extern boolean
636 const xmlChar *valstr);
637
638
649extern boolean
651 val_value_t *testval);
652
653
669extern xpath_result_t *
671 status_t *res);
672
673
684extern xpath_result_t *
686 status_t *res);
687
701extern boolean
703 boolean textmode,
704 xmlns_id_t nsid,
705 const xmlChar *name);
706
707
718extern void
720 xpath_pcb_t *pcb,
721 xpath_result_t *result,
722 const char *banner);
723
724
725
735extern void
737 xpath_resnode_t *resnode,
738 const char *banner);
739
740
753extern boolean
755 obj_template_t *obj);
756
757
761#ifdef __cplusplus
762} /* end extern 'C' */
763#endif
764
765
766#endif /* _H_xpath1 */
dlq provides general double-linked list and queue support:
GET1 and GET2 Callback Support.
log_debug_t
The debug level enumerations used in util/log.c.
Definition: log.h:348
status_t
global error return code
Definition: status_enum.h:210
uint16 xmlns_id_t
integer handle for registered namespaces
Definition: xmlns.h:89
xpath_source_t
XPath expression source type.
Definition: xpath.h:412
boolean xpath1_compare_result_to_number(xpath_pcb_t *pcb, xpath_result_t *result, ncx_num_t *numval, status_t *res)
Compare an XPath result to the specified number.
Definition: xpath1.c:6931
status_t xpath1_validate_expr(ncx_module_t *mod, obj_template_t *obj, xpath_pcb_t *pcb)
Validate the previously parsed expression string.
Definition: xpath1.c:5603
xpath_result_t * xpath1_eval_expr(xpath_pcb_t *pcb, val_value_t *val, val_value_t *docroot, boolean logerrors, boolean configonly, status_t *res)
Evaluate an XPath expression use if the prefixes are YANG: must/when.
Definition: xpath1.c:5765
boolean xpath1_check_when_object(xpath_pcb_t *pcb, obj_template_t *obj)
Check if the object is supposed to be deleted from the XPath context because of self-referencing when...
Definition: xpath1.c:7421
xpath_result_t * xpath1_parse_expr_int(xpath_pcb_t *pcb, status_t *res)
Parse an XPath Expr sequence It has already been tokenized.
Definition: xpath1.c:7201
boolean xpath1_find_val_in_nodeset(xpath_result_t *result, const xmlChar *valstr)
Check a nodeset result and find the same value in one of the nodes.
Definition: xpath1.c:7016
boolean xpath1_check_node_exists_slow(xpath_pcb_t *pcb, dlq_hdr_t *resultQ, const val_value_t *val)
Check if any ancestor-ot-self node is already in the specified Q Slow version.
Definition: xpath1.c:6472
xpath_result_t * xpath1_eval_expr2(xpath_pcb_t *pcb, val_value_t *val, val_value_t *docroot, boolean logerrors, boolean configonly, boolean force_only, status_t *res)
Evaluate an XPath expression (alt)
Definition: xpath1.c:5819
status_t xpath1_eval_obj_expr(xpath_pcb_t *pcb)
Evaluate an OBJECT expression.
Definition: xpath1.c:5630
xpath_result_t * xpath1_eval_xmlexpr(xmlTextReaderPtr reader, xpath_pcb_t *pcb, val_value_t *val, val_value_t *docroot, boolean logerrors, boolean configonly, status_t *res)
Evaluate an XML document expression.
Definition: xpath1.c:6176
status_t xpath1_stringify_node(xpath_pcb_t *pcb, val_value_t *val, xmlChar **str)
Convert a value node to a string node.
Definition: xpath1.c:6750
status_t xpath1_stringify_nodeset(xpath_pcb_t *pcb, const xpath_result_t *result, xmlChar **str)
Convert a value node pointer to a string node.
Definition: xpath1.c:6633
boolean xpath1_check_resnode_exists(xpath_pcb_t *pcb, dlq_hdr_t *resultQ, xpath_resnode_t *resnode)
Check if any ancestor-ot-self node is already in the specified Q.
Definition: xpath1.c:6535
boolean xpath1_check_node_exists(xpath_pcb_t *pcb, dlq_hdr_t *resultQ, const val_value_t *val)
Check if any ancestor-ot-self node is already in the specified Q.
Definition: xpath1.c:6411
status_t xpath1_validate_expr_ex(ncx_module_t *mod, obj_template_t *obj, xpath_pcb_t *pcb, boolean missing_is_error, boolean set_backptrs, ncx_xpath_type_t backptr_type)
Validate the previously parsed expression string.
Definition: xpath1.c:5314
void xpath1_prune_nodeset(xpath_pcb_t *pcb, xpath_result_t *result)
Check the current result nodeset and remove any redundant nodes from a NETCONF POV.
Definition: xpath1.c:6309
boolean xpath1_find_val_in_nodeset_ex(xpath_result_t *result, val_value_t *testval)
Check a nodeset result and find the same value in one of the nodes.
Definition: xpath1.c:7071
boolean xpath1_compare_result_to_string(xpath_pcb_t *pcb, xpath_result_t *result, xmlChar *strval, status_t *res)
Compare an XPath result to the specified string.
Definition: xpath1.c:6879
void xpath1_dump_result(log_debug_t lvl, xpath_pcb_t *pcb, xpath_result_t *result, const char *banner)
Generate log output displaying the contents of a result.
Definition: xpath1.c:7294
xpath_result_t * xpath1_parse_relational_expr_int(xpath_pcb_t *pcb, status_t *res)
Parse an XPath Relational Expr sequence It has already been tokenized.
Definition: xpath1.c:7228
status_t xpath1_validate_when_expr(ncx_module_t *mod, obj_template_t *when_obj, obj_template_t *context_obj, xpath_pcb_t *pcb)
Validate the previously parsed expression string WHEN-STMT.
Definition: xpath1.c:5711
void xpath1_dump_resnode(log_debug_t lvl, xpath_resnode_t *resnode, const char *banner)
Generate log output displaying the contents of an XPath resnode.
Definition: xpath1.c:7392
xpath_result_t * xpath1_eval_expr3(xpath_pcb_t *pcb, val_value_t *val, val_value_t *docroot, boolean logerrors, boolean configonly, boolean force_only, xml_msg_hdr_t *get2_mhdr, boolean get_when, xpath_get2_node_t *val_get2, status_t *res)
Evaluate an XPath expression (alt3)
Definition: xpath1.c:5878
boolean xpath1_compare_nodeset_results(xpath_pcb_t *pcb, xpath_result_t *result1, xpath_result_t *result2, status_t *res)
Compare an XPath result to another result.
Definition: xpath1.c:6982
status_t xpath1_test_data_rule(xpath_pcb_t *pcb, getcb_get2_t *get2cb, boolean *testres)
Test a NACM data rule expression against a GET2 control block.
Definition: xpath1.c:6075
boolean xpath1_keep_object(obj_template_t *testobj, boolean textmode, xmlns_id_t nsid, const xmlChar *name)
Test if an object should be kept in a resnode node-test.
Definition: xpath1.c:7251
status_t xpath1_parse_expr(tk_chain_t *tkc, ncx_module_t *mod, xpath_pcb_t *pcb, xpath_source_t source)
Parse the XPATH 1.0 expression string.
Definition: xpath1.c:5146
ncx_xpath_type_t
enumeration for different XPath back pointer types
Definition: ncxtypes.h:1287
YANG module data structures Many internal representations of YANG module constructs.
Data Object Support.
global error status code enumerations
GET2 control block.
Definition: getcb.h:357
representation of one module or submodule during and after parsing
Definition: ncxtypes.h:1138
One YANG data-def-stmt.
Definition: obj.h:1229
token parsing chain (main parser control block)
Definition: tk.h:415
one value to match one type
Definition: val.h:912
Common Encoding Message Header No longer XML specific!! Used by JSON and CBOR parsing as well!...
Definition: xml_msg.h:404
Special XPath GET2 resnode.
Definition: xpath.h:610
XPath parser control block.
Definition: xpath.h:754
XPath result node struct.
Definition: xpath.h:666
XPath expression result.
Definition: xpath.h:705
NCX Syntax Token Handler.
union of all the basic number types if float not supported, then it is stored as an int64
Definition: ncxtypes.h:784
Value Node Basic Support.
Schema and data model Xpath search support.