yumapro  20.10-12
YumaPro SDK
xpath1_res.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_res
13 #define _H_xpath1_res
14 
15 /* FILE: xpath1_res.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 
33 date init comment
34 ----------------------------------------------------------------------
35 27-aug-16 abb Begun; split from xpath1.h
36 
37 */
38 
39 #ifndef _H_xpath
40 #include "xpath.h"
41 #endif
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /********************************************************************
48 * *
49 * C O N S T A N T S *
50 * *
51 *********************************************************************/
52 
53 /********************************************************************
54 * *
55 * T Y P E S *
56 * *
57 *********************************************************************/
58 
59 /********************************************************************
60 * *
61 * F U N C T I O N S *
62 * *
63 *********************************************************************/
64 
78 extern void
79  xpath1_res_malloc_failed_error (xpath_pcb_t *pcb);
80 
81 
89 extern xpath_result_t *
90  xpath1_res_new_result (xpath_pcb_t *pcb,
91  xpath_restype_t restype);
92 
93 
100 extern void
101  xpath1_res_free_result (xpath_pcb_t *pcb,
102  xpath_result_t *result);
103 
104 
119 extern xpath_resnode_t *
120  xpath1_res_new_obj_resnode (xpath_pcb_t *pcb,
121  boolean dblslash,
122  obj_template_t *objptr);
123 
124 
139 extern xpath_resnode_t *
140  xpath1_res_new_val_resnode (xpath_pcb_t *pcb,
141  boolean dblslash,
142  val_value_t *valptr);
143 
144 
159 extern xpath_resnode_t *
160  xpath1_res_new_valhdr_resnode (xpath_pcb_t *pcb,
161  boolean dblslash,
162  val_child_hdr_t *valhdr);
163 
164 
182 extern xpath_resnode_t *
183  xpath1_res_new_get2_resnode (xpath_pcb_t *pcb,
184  boolean dblslash,
185  val_value_t *nodeptr_val,
186  xpath_get2_cb_t *nodeptr_cb,
187  xpath_get2_form_t get2_form);
188 
189 
196 extern void
197  xpath1_res_free_resnode (xpath_pcb_t *pcb,
198  xpath_resnode_t *resnode);
199 
200 
217 extern xpath_result_t *
218  xpath1_res_new_nodeset (xpath_pcb_t *pcb,
219  obj_template_t *obj,
220  val_value_t *val,
221  boolean dblslash);
222 
223 
232 extern xpath_result_t *
233  xpath1_res_new_cxt_nodeset (xpath_pcb_t *pcb,
234  boolean dblslash);
235 
236 
245 extern xpath_result_t *
246  xpath1_res_new_origcxt_nodeset (xpath_pcb_t *pcb,
247  boolean dblslash);
248 
249 
260 extern val_value_t *
261  xpath1_res_find_entry (xpath_result_t *result,
262  int64 position);
263 
264 
272 extern int64
273  xpath1_res_get_count (xpath_result_t *result);
274 
275 
286 extern int64
287  xpath1_res_get_position (xpath_result_t *result,
288  val_value_t *valptr);
289 
290 
297 extern void
298  xpath1_res_add_resnode (xpath_resnode_t *resnode,
299  xpath_result_t *result);
300 
301 
302 
311 extern status_t
312  xpath1_res_flatten_result (xpath_pcb_t *pcb,
313  xpath_result_t *result);
314 
315 
325 extern xpath_resnode_t *
326  xpath1_res_find_resnode (xpath_pcb_t *pcb,
327  dlq_hdr_t *resultQ,
328  const void *ptr);
329 
330 
340 extern xpath_resnode_t *
341  xpath1_res_find_get2_resnode (xpath_pcb_t *pcb,
342  dlq_hdr_t *resultQ,
343  xpath_get2_node_t *get2node);
344 
345 
361 extern xpath_resnode_t *
362  xpath1_res_match_resnode (dlq_hdr_t *resultQ,
363  xpath_resnode_t *findnode,
364  boolean match_exact);
365 
366 
373 extern void
374  xpath1_res_copy_resnode (xpath_resnode_t *srcnode,
375  xpath_resnode_t *dstnode);
376 
377 
384 extern const xmlChar *
385  xpath1_res_get_cxt_name (const xpath_pcb_t *pcb);
386 
387 
394 extern const xmlChar *
395  xpath1_res_get_resnode_name (const xpath_resnode_t *resnode);
396 
397 
408 extern boolean
409  xpath1_res_match_get2node (xpath_get2_cb_t *cb1,
410  xpath_get2_cb_t *cb2);
411 
412 
416 #ifdef __cplusplus
417 } /* end extern 'C' */
418 #endif
419 
420 
421 #endif /* _H_xpath1_res */
xpath1_get2.h
XPath 1.0 expression support for server GET2 callback functions.
XP_FORM_GETCB
@ XP_FORM_GETCB
normal GET2 CB
Definition: xpath.h:448
xpath_get_resnode_obj
obj_template_t * xpath_get_resnode_obj(xpath_resnode_t *resnode)
Get the resnode object pointer from a value resnode.
Definition: xpath.c:4050
ncx_feature.h
NCX Module Library YANG Feature Utility Functions.
xpath_clean_result
void xpath_clean_result(xpath_result_t *result)
Clean an XPath result struct.
Definition: xpath.c:3135
xpath1_res_new_valhdr_resnode
xpath_resnode_t * xpath1_res_new_valhdr_resnode(xpath_pcb_t *pcb, boolean dblslash, val_child_hdr_t *valhdr)
Get a new result node from the cache or malloc if none available.
Definition: xpath1_res.c:380
log_error
void log_error(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_ERROR log entry.
obj_is_leaf_list
boolean obj_is_leaf_list(const obj_template_t *obj)
Check if object is a proper leaf-list.
Definition: obj.c:13336
xpath1_res_new_get2_resnode
xpath_resnode_t * xpath1_res_new_get2_resnode(xpath_pcb_t *pcb, boolean dblslash, val_value_t *nodeptr_val, xpath_get2_cb_t *nodeptr_cb, xpath_get2_form_t get2_form)
Get a new result node from the cache or malloc if none available.
Definition: xpath1_res.c:434
val.h
Value Node Basic Support.
xpath1_res_new_val_resnode
xpath_resnode_t * xpath1_res_new_val_resnode(xpath_pcb_t *pcb, boolean dblslash, val_value_t *valptr)
Get a new result node from the cache or malloc if none available.
Definition: xpath1_res.c:325
obj_next_key
obj_key_t * obj_next_key(obj_key_t *objkey)
Get the next key record.
Definition: obj.c:9559
obj_first_key
obj_key_t * obj_first_key(obj_template_t *obj)
Get the first key record.
Definition: obj.c:9472
tk.h
NCX Syntax Token Handler.
xpath1_get2_find_return_key
val_value_t * xpath1_get2_find_return_key(xpath_get2_cb_t *cb, obj_template_t *keyobj)
Find a return key.
Definition: xpath1_get2.c:2574
ncx_num.h
NCX Module Library Number Utility Functions.
val_compare
int32 val_compare(const val_value_t *val1, const val_value_t *val2)
Compare 2 val_value_t struct value contents.
Definition: val.c:9456
XP_RNT_GET2
@ XP_RNT_GET2
get2ptr
Definition: xpath.h:426
VAL_NAME
#define VAL_NAME(V)
Access the value name.
Definition: val.h:399
ncxconst.h
Contains NCX constants.
ncx_print_errormsg
void ncx_print_errormsg(tk_chain_t *tkc, ncx_module_t *mod, status_t res)
Print an parse error message to STDOUT.
Definition: ncx.c:7048
xpath1_res_new_nodeset
xpath_result_t * xpath1_res_new_nodeset(xpath_pcb_t *pcb, obj_template_t *obj, val_value_t *val, boolean dblslash)
Create a new nodeset.
Definition: xpath1_res.c:545
obj_is_list
boolean obj_is_list(const obj_template_t *obj)
Check if object is a YANG list.
Definition: obj.c:13349
dlq_insertAhead
void dlq_insertAhead(void *newP, void *nodeP)
insert the new queue entry before the current entry
Definition: dlq.c:447
xpath1_res_new_origcxt_nodeset
xpath_result_t * xpath1_res_new_origcxt_nodeset(xpath_pcb_t *pcb, boolean dblslash)
Start a nodeset result with the original context node.
Definition: xpath1_res.c:670
xpath1.h
XPath 1.0 expression support.
def_reg.h
Definition Registry module.
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
xpath.h
Schema and data model Xpath search support.
xpath1_res_malloc_failed_error
void xpath1_res_malloc_failed_error(xpath_pcb_t *pcb)
Generate a malloc failed error if OK.
Definition: xpath1_res.c:125
xpath_discard_resnode
void xpath_discard_resnode(xpath_resnode_t *resnode)
Discard a result node.
Definition: xpath.c:4616
xpath1_res_new_obj_resnode
xpath_resnode_t * xpath1_res_new_obj_resnode(xpath_pcb_t *pcb, boolean dblslash, obj_template_t *objptr)
Get a new result node from the cache or malloc if none available.
Definition: xpath1_res.c:270
val_dump_value
void val_dump_value(val_value_t *val, int32 startindent, log_debug_t lvl)
Printf the specified val_value_t struct to the logfile, or stdout if none set Uses conf file format (...
Definition: val.c:5688
val_get_nsid
xmlns_id_t val_get_nsid(const val_value_t *val)
Get the namespace ID for the specified value node.
Definition: val.c:12277
log_debug4
void void void void void void void void void void void void void log_debug4(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG4 log entry.
obj_get_name
const xmlChar * obj_get_name(const obj_template_t *obj)
Get the name field for this obj.
Definition: obj.c:10511
ERR_NCX_OPERATION_FAILED
@ ERR_NCX_OPERATION_FAILED
274
Definition: status_enum.h:315
xpath1_res_match_get2node
boolean xpath1_res_match_get2node(xpath_get2_cb_t *cb1, xpath_get2_cb_t *cb2)
Compare two GET2 CBs.
Definition: xpath1_res.c:1345
xpath_free_result
void xpath_free_result(xpath_result_t *result)
Free a malloced XPath result struct.
Definition: xpath.c:3107
ERR_INTERNAL_VAL
@ ERR_INTERNAL_VAL
004
Definition: status_enum.h:194
val_child_hdr_next
val_value_t * val_child_hdr_next(const val_child_hdr_t *hdr, const val_value_t *curval)
Get the next entry in the child header.
Definition: val_child.c:3827
XPATH_ANY_CXT
#define XPATH_ANY_CXT(P)
test if context node is a value or get2 in xpath_pcb_t * (P)
Definition: xpath.h:313
xpath1_res_free_resnode
void xpath1_res_free_resnode(xpath_pcb_t *pcb, xpath_resnode_t *resnode)
Free a result node struct: put in cache or free if cache maxed out.
Definition: xpath1_res.c:495
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
xpath_init_result
void xpath_init_result(xpath_result_t *result, xpath_restype_t restype)
Initialize an XPath result struct.
Definition: xpath.c:3066
XP_RNT_OBJ
@ XP_RNT_OBJ
objnode
Definition: xpath.h:423
val_child.h
Value Node Child Access Support.
ERR_INTERNAL_PTR
@ ERR_INTERNAL_PTR
002
Definition: status_enum.h:192
typ.h
Parameter Type Handler.
xpath1_res_add_resnode
void xpath1_res_add_resnode(xpath_resnode_t *resnode, xpath_result_t *result)
Add the specified resnode to the result.
Definition: xpath1_res.c:904
yangconst.h
Contains YANG constants separated to prevent H file include loops.
dlq_nextEntry
#define dlq_nextEntry(nodeP)
get the next queue entry after the current entry
Definition: dlq.h:265
xpath1_res_get_position
int64 xpath1_res_get_position(xpath_result_t *result, val_value_t *valptr)
Find the position of the specified entry.
Definition: xpath1_res.c:851
XP_RST_GET2_DONE
@ XP_RST_GET2_DONE
GET2 callback done.
Definition: xpath.h:438
XP_RNT_VAL
@ XP_RNT_VAL
valptr
Definition: xpath.h:424
xpath_free_resnode
void xpath_free_resnode(xpath_resnode_t *resnode)
Free a malloced XPath result node struct.
Definition: xpath.c:3240
val_child_hdr_last
val_value_t * val_child_hdr_last(const val_child_hdr_t *hdr)
Get the last entry in the child header.
Definition: val_child.c:3808
log_debug4_append
void void void void void void void void void void void void void void log_debug4_append(const char *fstr,...) __attribute__((format(printf
Append to a LOG_DEBUG_DEBUG4 log entry.
xpath1_res_flatten_result
status_t xpath1_res_flatten_result(xpath_pcb_t *pcb, xpath_result_t *result)
Convert any vahdr resnodes to valptr resnodes for simplified processing.
Definition: xpath1_res.c:928
xpath1_res_get_count
int64 xpath1_res_get_count(xpath_result_t *result)
Get the number of entries in the node-set result to support the count() function.
Definition: xpath1_res.c:814
xpath1_res_find_entry
val_value_t * xpath1_res_find_entry(xpath_result_t *result, int64 position)
Find the Nth entry in the node-set result for the position() function.
Definition: xpath1_res.c:746
xml_strcmp
int xml_strcmp(const xmlChar *s1, const xmlChar *s2)
String compare for xmlChar.
Definition: xml_util.c:1746
LOGDEBUG4
#define LOGDEBUG4
Check if at least log-level=debug4.
Definition: log.h:302
xpath_new_result
xpath_result_t * xpath_new_result(xpath_restype_t restype)
malloc an XPath result
Definition: xpath.c:3033
dlq_deque
void * dlq_deque(dlq_hdrT *listP)
remove the first queue node from the queue list
Definition: dlq.c:286
XP_RNT_VALHDR
@ XP_RNT_VALHDR
valhdr
Definition: xpath.h:425
dlq_empty
#define dlq_empty(listP)
check if queue list is empty
Definition: dlq.h:367
xpath1_res_find_get2_resnode
xpath_resnode_t * xpath1_res_find_get2_resnode(xpath_pcb_t *pcb, dlq_hdr_t *resultQ, xpath_get2_node_t *get2node)
Check if the specified resnode ptr is already in the Q (GET2)
Definition: xpath1_res.c:1038
val_child_hdr_first
val_value_t * val_child_hdr_first(const val_child_hdr_t *hdr)
Get the first entry in the child header.
Definition: val_child.c:3789
dlq_firstEntry
#define dlq_firstEntry(listP)
get the first entry in the queue list
Definition: dlq.h:337
ncx.h
YANG module utility functions.
xpath1_res_new_result
xpath_result_t * xpath1_res_new_result(xpath_pcb_t *pcb, xpath_restype_t restype)
Get a new result from the cache or malloc if none available.
Definition: xpath1_res.c:157
obj.h
Data Object Support.
grp.h
YANG Grouping Statement Handler.
xpath1_res_find_resnode
xpath_resnode_t * xpath1_res_find_resnode(xpath_pcb_t *pcb, dlq_hdr_t *resultQ, const void *ptr)
Check if the specified resnode ptr is already in the Q.
Definition: xpath1_res.c:981
XP_FORM_GETCB_CHILD
@ XP_FORM_GETCB_CHILD
child node CB
Definition: xpath.h:450
XP_FORM_NONE
@ XP_FORM_NONE
not set
Definition: xpath.h:447
XPATH_VAL_CXT
#define XPATH_VAL_CXT(P)
test if context node is a value or get2 in xpath_pcb_t * (P)
Definition: xpath.h:310
xpath1_res.h
XPath 1.0 expression support; result support.
dlq_enque
void dlq_enque(REG void *newP, REG dlq_hdrT *listP)
add a queue node to the end of a queue list Add newP to listP
Definition: dlq.c:246
xpath1_res_new_cxt_nodeset
xpath_result_t * xpath1_res_new_cxt_nodeset(xpath_pcb_t *pcb, boolean dblslash)
Start a nodeset result with the current context node.
Definition: xpath1_res.c:595
SET_ERROR
#define SET_ERROR(E)
macro SET_ERROR
Definition: status_enum.h:103
xpath_clean_resnode
void xpath_clean_resnode(xpath_resnode_t *resnode)
Clean an XPath result node struct.
Definition: xpath.c:3289
xpath1_res_get_resnode_name
const xmlChar * xpath1_res_get_resnode_name(const xpath_resnode_t *resnode)
Get the local-name of the resnode node.
Definition: xpath1_res.c:1305
xpath1_res_match_resnode
xpath_resnode_t * xpath1_res_match_resnode(dlq_hdr_t *resultQ, xpath_resnode_t *findnode, boolean match_exact)
Match the specified result node.
Definition: xpath1_res.c:1133
xpath1_res_free_result
void xpath1_res_free_result(xpath_pcb_t *pcb, xpath_result_t *result)
Free a result struct: put in cache or free if cache maxed out.
Definition: xpath1_res.c:204
xpath1_res_copy_resnode
void xpath1_res_copy_resnode(xpath_resnode_t *srcnode, xpath_resnode_t *dstnode)
Copy a resnode struct.
Definition: xpath1_res.c:1245
XP_RT_NODESET
@ XP_RT_NODESET
node-set result
Definition: xpath.h:347
XP_FORM_GETCB_TERM
@ XP_FORM_GETCB_TERM
terminal node CB
Definition: xpath.h:449
dlq.h
dlq provides general double-linked list and queue support:
xpath1_res_get_cxt_name
const xmlChar * xpath1_res_get_cxt_name(const xpath_pcb_t *pcb)
Get the local-name of the context node.
Definition: xpath1_res.c:1286
xpath_new_resnode
xpath_resnode_t * xpath_new_resnode(void)
Create and initialize an XPath result node struct.
Definition: xpath.c:3189