1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
/**
* @file path.h
* @author Michal Vasko <mvasko@cesnet.cz>
* @brief Path structure and manipulation routines.
*
* Copyright (c) 2020 - 2026 CESNET, z.s.p.o.
*
* This source code is licensed under BSD 3-Clause License (the "License").
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/BSD-3-Clause
*/
;
;
;
;
;
/**
* @brief Similar to LOGVAL, but also logs path of CUR_SCNODE and if not set, CTX_SCNODE, in this order.
*
* @param[in] CTX Context to use.
* @param[in] CUR_SCNODE Current (original context) node.
* @param[in] CTX_SCNODE Context node.
*/
/**
* @brief Common types of predicates.
*/
;
/**
* @brief Structure for simple path predicate.
*/
;
/**
* @brief Structure for holding one segment of resolved path on schema including
* simple predicates. Is used as a [sized array](@ref sizedarrays).
*/
;
/**
* @defgroup path_begin_options Path begin options.
* @{
*/
/** @} */
/**
* @defgroup path_prefix_options Path prefix options.
* @{
*/
/** @} */
/**
* @defgroup path_pred_options Path predicate options.
* @{
*/
/** @} */
/**
* @brief Parse path into XPath token structure and perform all additional checks.
*
* @param[in] ctx libyang context.
* @param[in] ctx_node Optional context node, used for logging.
* @param[in] str_path Path to parse.
* @param[in] path_len Length of @p str_path, may be 0 if @p str_path is 0-terminated.
* @param[in] lref Whether leafref is being parsed or not.
* @param[in] begin Begin option (@ref path_begin_options).
* @param[in] prefix Prefix option (@ref path_prefix_options).
* @param[in] pred Predicate option (@ref path_pred_options).
* @param[out] expr Parsed path.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Parse predicate into XPath token structure and perform all additional checks.
*
* @param[in] ctx libyang context.
* @param[in] cur_node Optional current (original context) node, used for logging.
* @param[in] str_path Path to parse.
* @param[in] path_len Length of @p str_path, may be 0 if @p str_path is 0-terminated.
* @param[in] prefix Prefix option (@ref path_prefix_options).
* @param[in] pred Predicate option (@ref path_pred_options).
* @param[out] expr Parsed path.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @defgroup path_oper_options Path operation options.
* @{
*/
/** @} */
/* lref */
/**
* @defgroup path_target_options Path target options.
* @{
*/
/** @} */
/**
* @brief Compile path into ly_path structure.
*
* @param[in] ctx libyang context.
* @param[in] ctx_node Optional context node.
* @param[in] expr Parsed path.
* @param[in] oper Oper option (@ref path_oper_options).
* @param[in] target Target option (@ref path_target_options).
* @param[in] is_xpath Whether we are compiling an XPath path and should limit the accessible tree.
* @param[in] format Format of the path.
* @param[in] prefix_data Format-specific data for resolving any prefixes (see ::ly_resolve_prefix).
* @param[out] path Compiled path.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Compile path into ly_path structure. Any predicates of a leafref are only checked, not compiled.
*
* @param[in] ctx libyang context.
* @param[in] ctx_node Context node.
* @param[in] expr Parsed path.
* @param[in] oper Oper option (@ref path_oper_options).
* @param[in] target Target option (@ref path_target_options).
* @param[in] format Format of the path.
* @param[in] prefix_data Format-specific data for resolving any prefixes (see ::ly_resolve_prefix).
* @param[out] path Compiled path.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Compile predicate into ly_path_predicate structure. Only simple predicates (not leafref) are supported.
*
* @param[in] ctx libyang context.
* @param[in] cur_node Optional current (original context) node.
* @param[in] ctx_node Context node, node for which the predicate is defined.
* @param[in] expr Parsed path.
* @param[in,out] tok_idx Index in @p expr, is adjusted for parsed tokens.
* @param[in] format Format of the path.
* @param[in] prefix_data Format-specific data for resolving any prefixes (see ::ly_resolve_prefix).
* @param[out] predicates Compiled predicates.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Resolve at least partially the target defined by ly_path structure. Not supported for leafref!
*
* @param[in] path Path structure specifying the target.
* @param[in] ctx_node Context node, NULL for the root node.
* @param[in] tree Whoe data tree to search, must be set if @p ctx_node is not.
* @param[in] vars Array of defined variables to use in predicates, may be NULL.
* @param[in] with_opaq Whether to consider opaque nodes or not.
* @param[out] path_idx Last found path segment index, can be NULL, set to 0 if not found.
* @param[out] match Last found matching node, can be NULL, set to NULL if not found.
* @return LY_ENOTFOUND if no nodes were found,
* @return LY_EINCOMPLETE if some node was found but not the last one,
* @return LY_SUCCESS when the last node in the path was found,
* @return LY_ERR on another error.
*/
LY_ERR ;
/**
* @brief Resolve the target defined by ly_path structure. Not supported for leafref!
*
* @param[in] path Path structure specifying the target.
* @param[in] ctx_node Context node for relative paths, can be any for absolute paths.
* @param[in] vars Array of defined variables to use in predicates, may be NULL.
* @param[out] match Found matching node, can be NULL, set to NULL if not found.
* @return LY_ENOTFOUND if no nodes were found,
* @return LY_SUCCESS when the last node in the path was found,
* @return LY_ERR on another error.
*/
LY_ERR ;
/**
* @brief Duplicate ly_path structure.
*
* @param[in] ctx libyang context.
* @param[in] path Path to duplicate.
* @param[out] dup Duplicated path.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Free ly_path_predicate structure.
*
* @param[in] ctx libyang context.
* @param[in] predicates Predicates ([sized array](@ref sizedarrays)) to free.
*/
void ;
/**
* @brief Free ly_path structure.
*
* @param[in] path The structure ([sized array](@ref sizedarrays)) to free.
*/
void ;
/* LY_PATH_H_ */