yumapro  20.10-12
YumaPro SDK
xpath1_cmp.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_cmp
13 #define _H_xpath1_cmp
14 
15 /* FILE: xpath1_cmp.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 05-sep-16 abb Begun; split from xpath1.c
36 
37 */
38 
39 #ifndef _H_xpath
40 #include "xpath.h"
41 #endif
42 
43 
44 #ifndef _H_status_enum
45 #include "status_enum.h"
46 #endif
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 /********************************************************************
53 * *
54 * C O N S T A N T S *
55 * *
56 *********************************************************************/
57 
58 /********************************************************************
59 * *
60 * T Y P E S *
61 * *
62 *********************************************************************/
63 
64 /********************************************************************
65 * *
66 * F U N C T I O N S *
67 * *
68 *********************************************************************/
69 
70 /* Group defiied in xpath1.h */
71 
92 extern boolean
93  xpath1_cmp_results (xpath_pcb_t *pcb,
94  xpath_result_t *val1,
95  xpath_result_t *val2,
96  xpath_exop_t exop,
97  status_t *res);
98 
99 
103 #ifdef __cplusplus
104 } /* end extern 'C' */
105 #endif
106 
107 
108 #endif /* _H_xpath1_cmp */
XP_EXOP_EQUAL
@ XP_EXOP_EQUAL
equals '='
Definition: xpath.h:388
ERR_NCX_SKIPPED
@ ERR_NCX_SKIPPED
2001
Definition: status_enum.h:551
OBJ_TYP_NONE
@ OBJ_TYP_NONE
not set
Definition: obj.h:612
ERR_NCX_NOT_IN_RANGE
@ ERR_NCX_NOT_IN_RANGE
288
Definition: status_enum.h:331
NCX_NF_OCTAL
@ NCX_NF_OCTAL
YANG octal format.
Definition: ncxtypes.h:334
ncx_feature.h
NCX Module Library YANG Feature Utility Functions.
XP_RT_NUMBER
@ XP_RT_NUMBER
number result
Definition: xpath.h:348
obj_get_typdef
typ_def_t * obj_get_typdef(obj_template_t *obj)
Get the typdef for the leaf or leaf-list.
Definition: obj.c:11991
xpath_first_resnode_valptr
val_value_t * xpath_first_resnode_valptr(xpath_resnode_t *resnode)
Get the first result in the renodeQ from a result struct.
Definition: xpath.c:3982
ncx_warning_enabled
boolean ncx_warning_enabled(status_t res)
Check if a specific status_t code is enabled.
Definition: ncx.c:9394
xpath_next_resnode_valptr
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.
Definition: xpath.c:4017
ncx_print_errormsg_ex
void ncx_print_errormsg_ex(tk_chain_t *tkc, ncx_module_t *mod, status_t res, const char *filename, uint32 linenum, boolean fineoln)
Print an parse error message to STDOUT (Extended)
Definition: ncx.c:7070
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
NCX_BT_BOOLEAN
@ NCX_BT_BOOLEAN
boolean
Definition: ncxtypes.h:206
val.h
Value Node Basic Support.
XP_FL_CONFIGONLY
#define XP_FL_CONFIGONLY
used for YANG/NETCONF to auto-filter any non-config nodes that are matched by an XPath wildcard mecha...
Definition: xpath.h:221
ERR_NCX_XPATH_OBJ_COMPARE
@ ERR_NCX_XPATH_OBJ_COMPARE
1053
Definition: status_enum.h:542
val_child_find_all_descendants
boolean val_child_find_all_descendants(val_walker2_fn_t walkerfn, void *cookie1, void *cookie2, val_value_t *startnode, xmlns_id_t mod_nsid, const xmlChar *name, boolean configonly, boolean textmode, boolean orself, boolean forceall)
Find all occurances of the specified node within the current subtree.
Definition: val_child.c:2785
ncx_set_num_nan
void ncx_set_num_nan(ncx_num_t *num, ncx_btype_t btyp)
Set a FP number to the Not a Number value.
Definition: ncx_num.c:592
NCX_BT_IDREF
@ NCX_BT_IDREF
identityref
Definition: ncxtypes.h:222
xpath_cvt_boolean
boolean xpath_cvt_boolean(const xpath_result_t *result)
Convert an XPath result to a boolean answer.
Definition: xpath.c:3630
status_enum.h
global error status code enumerations
typ_is_number
boolean typ_is_number(ncx_btype_t btyp)
Check if the base type is numeric.
Definition: typ.c:4063
NCX_BT_LEAFREF
@ NCX_BT_LEAFREF
leafref (needs special processing)
Definition: ncxtypes.h:221
tk.h
NCX Syntax Token Handler.
log_debug3
void void void void void void void void void void void log_debug3(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG3 log entry.
ncx_num.h
NCX Module Library Number Utility Functions.
val_get_mod_name
const xmlChar * val_get_mod_name(const val_value_t *val)
Get the module name associated with this value node.
Definition: val.c:12223
VAL_IDREF_NAME
#define VAL_IDREF_NAME(V)
Access the name string value as an identityref ONLY if NCX_BT_IDREF.
Definition: val.h:476
ncx_init_num
void ncx_init_num(ncx_num_t *num)
Init a ncx_num_t struct.
Definition: ncx_num.c:162
XP_RNT_GET2
@ XP_RNT_GET2
get2ptr
Definition: xpath.h:426
val_child_find_all_descendants_old
boolean val_child_find_all_descendants_old(val_walker_fn_t walkerfn, void *cookie1, void *cookie2, val_value_t *startnode, xmlns_id_t mod_nsid, const xmlChar *name, boolean configonly, boolean textmode, boolean orself, boolean forceall)
Find all occurances of the specified node within the current subtree.
Definition: val_child.c:2920
xpath1_cmp.h
XPath 1.0 expression support; Compare utilities.
ncxconst.h
Contains NCX constants.
XP_RT_STRING
@ XP_RT_STRING
string result
Definition: xpath.h:349
val_is_virtual
boolean val_is_virtual(const val_value_t *val)
Check if the specified value is a virtual value such that a 'get' callback function is required to ac...
Definition: val.c:11260
NCX_NF_DEC
@ NCX_NF_DEC
YANG deciaml format.
Definition: ncxtypes.h:335
XP_EXOP_GEQUAL
@ XP_EXOP_GEQUAL
r.
Definition: xpath.h:393
xmlns_id_t
uint16 xmlns_id_t
integer handle for registered namespaces
Definition: xmlns.h:89
NCX_NF_NONE
@ NCX_NF_NONE
not set
Definition: ncxtypes.h:333
xpath1.h
XPath 1.0 expression support.
obj_is_leafy
boolean obj_is_leafy(const obj_template_t *obj)
Check if object is a proper leaf or leaflist.
Definition: obj.c:13478
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.
val_convert_leafref
val_value_t * val_convert_leafref(const val_value_t *val)
Convert a value of type NCX_BT_LEAFREF to the value that the final leafref is pointing at.
Definition: val.c:14761
NCX_NF_REAL
@ NCX_NF_REAL
internal format for XPath
Definition: ncxtypes.h:337
xpath_cvt_number
void xpath_cvt_number(const xpath_result_t *result, ncx_num_t *num)
Convert an XPath result to a number answer.
Definition: xpath.c:3690
obj_get_name
const xmlChar * obj_get_name(const obj_template_t *obj)
Get the name field for this obj.
Definition: obj.c:10511
log_warn
void void void log_warn(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_WARN log entry.
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
typ_get_name
const xmlChar * typ_get_name(const typ_def_t *typdef)
Get the name for the specified typdef.
Definition: typ.c:1871
XP_EXOP_GT
@ XP_EXOP_GT
right angle bracket '>'
Definition: xpath.h:391
ERR_NCX_INVALID_VALUE
@ ERR_NCX_INVALID_VALUE
258
Definition: status_enum.h:299
XP_RT_NONE
@ XP_RT_NONE
not set
Definition: xpath.h:346
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
val_child.h
Value Node Child Access Support.
XP_EXOP_LEQUAL
@ XP_EXOP_LEQUAL
l.
Definition: xpath.h:392
typ.h
Parameter Type Handler.
val_parse_idref
status_t val_parse_idref(ncx_module_t *mod, const xmlChar *qname, xmlns_id_t *nsid, const xmlChar **name, ncx_identity_t **id)
Parse a CLI BASED identityref QName into its various parts.
Definition: val.c:3927
yangconst.h
Contains YANG constants separated to prevent H file include loops.
ncx_get_numfmt
ncx_numfmt_t ncx_get_numfmt(const xmlChar *numstr)
Get the number format of the specified string.
Definition: ncx_num.c:2164
val_get_virtual_value
val_value_t * val_get_virtual_value(ses_cb_t *scb, val_value_t *val, status_t *res)
Get the value of a virtual value node.
Definition: val.c:11310
ncx_compare_nums
int32 ncx_compare_nums(const ncx_num_t *num1, const ncx_num_t *num2, ncx_btype_t btyp)
Compare 2 ncx_num_t union contents.
Definition: ncx_num.c:242
XP_RNT_VAL
@ XP_RNT_VAL
valptr
Definition: xpath.h:424
NCX_BT_UNION
@ NCX_BT_UNION
union (needs special processing)
Definition: ncxtypes.h:220
XPATH_GET_RESTYPE
#define XPATH_GET_RESTYPE(R)
get the result type from xpath_result_t * (R)
Definition: xpath.h:301
XP_EXOP_LT
@ XP_EXOP_LT
left angle bracket '<'
Definition: xpath.h:390
NCX_MAX_NUMLEN
#define NCX_MAX_NUMLEN
max number len to use for static buffer allocation only
Definition: ncxconst.h:136
xpath_get_next_resnode
xpath_resnode_t * xpath_get_next_resnode(xpath_resnode_t *resnode)
Get the next result in the renodeQ from a result struct.
Definition: xpath.c:3959
ncx_sprintf_num
status_t ncx_sprintf_num(xmlChar *buff, const ncx_num_t *num, ncx_btype_t btyp, uint32 *len)
Sprintf a ncx_num_t contents.
Definition: ncx_num.c:2357
obj_get_mod_name
const xmlChar * obj_get_mod_name(const obj_template_t *obj)
Get the module name for this object.
Definition: obj.c:12176
xpath1_stringify_node
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:6198
ncx_clean_num
void ncx_clean_num(ncx_btype_t btyp, ncx_num_t *num)
Scrub the memory in a ncx_num_t by freeing all the sub-fields.
Definition: ncx_num.c:189
typ_is_simple
boolean typ_is_simple(ncx_btype_t btyp)
Check if this is a simple data type.
Definition: typ.c:3107
xpath_get_first_resnode
xpath_resnode_t * xpath_get_first_resnode(xpath_result_t *result)
Get the first result in the renodeQ from a result struct.
Definition: xpath.c:3931
xml_strcmp
int xml_strcmp(const xmlChar *s1, const xmlChar *s2)
String compare for xmlChar.
Definition: xml_util.c:1746
xpath1_cmp_results
boolean xpath1_cmp_results(xpath_pcb_t *pcb, xpath_result_t *val1, xpath_result_t *val2, xpath_exop_t exop, status_t *res)
Compare 2 results, using the specified logic operator.
Definition: xpath1_cmp.c:1440
ERR_NCX_WRONG_NUMTYP
@ ERR_NCX_WRONG_NUMTYP
289
Definition: status_enum.h:332
log.h
NCX System Logging Manager.
xpath_cvt_string
status_t xpath_cvt_string(xpath_pcb_t *pcb, const xpath_result_t *result, xmlChar **str)
Convert an XPath result to a string answer.
Definition: xpath.c:3821
xpath_get_resnode_objptr
obj_template_t * xpath_get_resnode_objptr(xpath_resnode_t *resnode)
Get the result node object pointer (obsolete)
Definition: xpath.c:4148
ncx_num_zero
boolean ncx_num_zero(const ncx_num_t *num, ncx_btype_t btyp)
Compare a ncx_num_t to zero.
Definition: ncx_num.c:663
NCX_BT_FLOAT64
@ NCX_BT_FLOAT64
hidden: just for XPath
Definition: ncxtypes.h:216
XP_RNT_VALHDR
@ XP_RNT_VALHDR
valhdr
Definition: xpath.h:425
typ_is_string
boolean typ_is_string(ncx_btype_t btyp)
Check if the base type is a simple string (not list)
Definition: typ.c:4097
dlq_empty
#define dlq_empty(listP)
check if queue list is empty
Definition: dlq.h:367
ncx_cast_num
status_t ncx_cast_num(const ncx_num_t *num1, ncx_btype_t btyp1, ncx_num_t *num2, ncx_btype_t btyp2)
Cast a number as another number type.
Definition: ncx_num.c:1516
ncx_get_mod_source
const xmlChar * ncx_get_mod_source(const ncx_module_t *mod)
Get the module file source string for the specified module.
Definition: ncx.c:8954
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
VAL_TYPE
#define VAL_TYPE(V)
Access the base type : same as VAL_BTYPE.
Definition: val.h:387
obj_get_basetype
ncx_btype_t obj_get_basetype(const obj_template_t *obj)
Get the NCX base type enum for the object type.
Definition: obj.c:12077
VAL_OBJ
#define VAL_OBJ(V)
Access the object template.
Definition: val.h:381
ncx.h
YANG module utility functions.
VAL_IDREF_NSID
#define VAL_IDREF_NSID(V)
Access the namespace ID value as an identityref ONLY if NCX_BT_IDREF.
Definition: val.h:473
obj.h
Data Object Support.
grp.h
YANG Grouping Statement Handler.
XP_EXOP_NOTEQUAL
@ XP_EXOP_NOTEQUAL
bang equals '!='
Definition: xpath.h:389
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.
XP_RT_BOOLEAN
@ XP_RT_BOOLEAN
boolean result
Definition: xpath.h:350
val_sprintf_simval_nc
status_t val_sprintf_simval_nc(xmlChar *buff, const val_value_t *val, uint32 *len)
Sprintf the xmlChar string NETCONF representation of a simple value.
Definition: val.c:9931
ncx_convert_num
status_t ncx_convert_num(const xmlChar *numstr, ncx_numfmt_t numfmt, ncx_btype_t btyp, ncx_num_t *val)
Convert a number string to a numeric type.
Definition: ncx_num.c:717
VAL_STR
#define VAL_STR(V)
Access the value as a string ONLY if typ_is_string() is true.
Definition: val.h:464
SET_ERROR
#define SET_ERROR(E)
macro SET_ERROR
Definition: status_enum.h:103
NCX_BT_STRING
@ NCX_BT_STRING
string
Definition: ncxtypes.h:217
XP_RT_NODESET
@ XP_RT_NODESET
node-set result
Definition: xpath.h:347
obj_get_typestr
const xmlChar * obj_get_typestr(const obj_template_t *obj)
Get the name of the object type.
Definition: obj.c:11392
val_free_value
void val_free_value(val_value_t *val)
Scrub the memory in a val_value_t by freeing all the sub-fields and then freeing the entire struct it...
Definition: val.c:2842
ERR_NCX_XPATH_COMPARE
@ ERR_NCX_XPATH_COMPARE
1052
Definition: status_enum.h:541
obj_is_password
boolean obj_is_password(const obj_template_t *obj)
Check if object is marked as a password object.
Definition: obj.c:14195
dlq.h
dlq provides general double-linked list and queue support:
val_simval_ok_ex
status_t val_simval_ok_ex(typ_def_t *typdef, const xmlChar *simval, ncx_errinfo_t **errinfo, ncx_module_t *mod)
check any simple type to see if it is valid, but do not retrieve the value; used to check the default...
Definition: val.c:4443
LOGDEBUG3
#define LOGDEBUG3
Check if at least log-level=debug3.
Definition: log.h:297
xpath_get_restype_str
const xmlChar * xpath_get_restype_str(xpath_restype_t restype)
Get the string for the specific result type.
Definition: xpath.c:4811