Skip to content

Commit d42a185

Browse files
committed
plugins ext UPDATE custom XPath root ext plugin API
Required for the 'structure' extension. Major ext plugin API refactoring included.
1 parent 90c0647 commit d42a185

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+873
-658
lines changed

src/parser_common.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ lyd_ctx_free(struct lyd_ctx *lydctx)
6464
ly_set_erase(&lydctx->node_types, NULL);
6565
ly_set_erase(&lydctx->meta_types, NULL);
6666
ly_set_erase(&lydctx->node_when, NULL);
67-
ly_set_erase(&lydctx->ext_node, free);
6867
ly_set_erase(&lydctx->ext_val, free);
6968
lyd_val_getnext_ht_free(lydctx->val_getnext_ht);
7069
}
@@ -304,8 +303,8 @@ lyd_parser_create_term(struct lyd_ctx *lydctx, const struct lysc_node *schema, c
304303
ly_bool incomplete;
305304
ly_bool store_only = (lydctx->parse_opts & LYD_PARSE_STORE_ONLY) == LYD_PARSE_STORE_ONLY ? 1 : 0;
306305

307-
if ((r = lyd_create_term(schema, value, value_bits_len, 1, store_only, dynamic, format, prefix_data,
308-
hints, &incomplete, node))) {
306+
if ((r = lyd_create_term(schema, value, value_bits_len, 1, store_only, dynamic, format, prefix_data, hints,
307+
lydctx->ext, &incomplete, node))) {
309308
if (lydctx->data_ctx->ctx != schema->module->ctx) {
310309
/* move errors to the main context */
311310
ly_err_move(schema->module->ctx, (struct ly_ctx *)lydctx->data_ctx->ctx);
@@ -344,7 +343,7 @@ lyd_parser_create_meta(struct lyd_ctx *lydctx, struct lyd_node *parent, struct l
344343
ly_log_location(NULL, NULL, path, NULL);
345344

346345
LY_CHECK_GOTO(rc = lyd_create_meta(parent, meta, mod, name, name_len, value, value_size_bits, 1, store_only,
347-
dynamic, format, prefix_data, hints, ctx_node, 0, &incomplete), cleanup);
346+
dynamic, format, prefix_data, hints, ctx_node, lydctx->ext, 0, &incomplete), cleanup);
348347

349348
if (incomplete && !(lydctx->parse_opts & LYD_PARSE_ONLY)) {
350349
LY_CHECK_GOTO(rc = ly_set_add(&lydctx->meta_types, *meta, 1, NULL), cleanup);
@@ -468,9 +467,8 @@ lyd_parser_validate_new_implicit(struct lyd_ctx *lydctx, struct lyd_node *node)
468467
LY_DPARSER_ERR_GOTO(r, rc = r, lydctx, cleanup);
469468

470469
/* add any missing default children */
471-
r = lyd_new_implicit_r(node, lyd_node_child_p(node), NULL, NULL, &lydctx->node_when, &lydctx->node_types,
472-
&lydctx->ext_node, (lydctx->val_opts & LYD_VALIDATE_NO_STATE) ? LYD_IMPLICIT_NO_STATE : 0,
473-
lydctx->val_getnext_ht, NULL);
470+
r = lyd_new_implicit_r(node, lyd_node_child_p(node), NULL, NULL, lydctx->ext, &lydctx->node_when, &lydctx->node_types,
471+
(lydctx->val_opts & LYD_VALIDATE_NO_STATE) ? LYD_IMPLICIT_NO_STATE : 0, lydctx->val_getnext_ht, NULL);
474472
LY_CHECK_ERR_GOTO(r, rc = r, cleanup);
475473

476474
cleanup:

src/parser_data.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,21 @@ LIBYANG_API_DECL LY_ERR lyd_parse_op(const struct ly_ctx *ctx, struct lyd_node *
478478
LIBYANG_API_DECL LY_ERR lyd_parse_ext_op(const struct lysc_ext_instance *ext, struct lyd_node *parent, struct ly_in *in,
479479
LYD_FORMAT format, enum lyd_type data_type, uint32_t parse_options, struct lyd_node **tree, struct lyd_node **op);
480480

481+
/**
482+
* @brief Validate a data subtree of an extension instance, which is assumed to be a separate data tree independent of
483+
* normal YANG data.
484+
*
485+
* @param[in,out] subtree Data subtree to validate. May be changed by validation, might become NULL.
486+
* @param[in] ext Extension instance whose data to validate.
487+
* @param[in] val_opts Validation options (@ref datavalidationoptions).
488+
* @param[in] dep_tree Tree to be used for validating references from the operation subtree.
489+
* @param[out] diff Optional diff with any changes made by the validation.
490+
* @return LY_SUCCESS on success.
491+
* @return LY_ERR error on error.
492+
*/
493+
LIBYANG_API_DECL LY_ERR lyd_validate_ext(struct lyd_node **ext_tree, const struct lysc_ext_instance *ext,
494+
uint32_t val_opts, const struct lyd_node *dep_tree, struct lyd_node **diff);
495+
481496
/**
482497
* @brief Fully validate a data tree.
483498
*

src/parser_internal.h

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ typedef void (*lyd_ctx_free_clb)(struct lyd_ctx *ctx);
6262
#define LYD_INTOPT_NOTIF 0x08 /**< Notification is being parsed. */
6363
#define LYD_INTOPT_ANY 0x10 /**< Anydata/anyxml content is being parsed, there can be anything. */
6464
#define LYD_INTOPT_WITH_SIBLINGS 0x20 /**< Parse the whole input with any siblings. */
65-
#define LYD_INTOPT_NO_SIBLINGS 0x40 /**< If there are any siblings, return an error. */
66-
#define LYD_INTOPT_EVENTTIME 0x80 /**< Parse notification eventTime node. */
65+
#define LYD_INTOPT_SKIP_SIBLINGS 0x40 /**< Perform the validation task only for the specfic subtree, skip other siblings. */
66+
#define LYD_INTOPT_NO_SIBLINGS 0x80 /**< If there are any siblings, return an error. */
67+
#define LYD_INTOPT_EVENTTIME 0x0100 /**< Parse notification eventTime node. */
6768

6869
/**
6970
* @brief Internal (common) context for YANG data parsers.
@@ -82,7 +83,6 @@ struct lyd_ctx {
8283
struct ly_set node_when; /**< set of nodes with "when" conditions */
8384
struct ly_set node_types; /**< set of nodes validated with LY_EINCOMPLETE result */
8485
struct ly_set meta_types; /**< set of metadata validated with LY_EINCOMPLETE result */
85-
struct ly_set ext_node; /**< set of nodes with extension instances to validate */
8686
struct ly_set ext_val; /**< set of nested subtrees parsed by extensions to validate */
8787
struct lyd_node *op_node; /**< if an RPC/action/notification is being parsed, store the pointer to it */
8888
const struct lys_module *val_getnext_ht_mod; /**< module of the cached schema nodes in getnext HT */
@@ -111,7 +111,6 @@ struct lyd_xml_ctx {
111111
struct ly_set node_when;
112112
struct ly_set node_types;
113113
struct ly_set meta_types;
114-
struct ly_set ext_node;
115114
struct ly_set ext_val;
116115
struct lyd_node *op_node;
117116
const struct lys_module *val_getnext_ht_mod;
@@ -136,7 +135,6 @@ struct lyd_json_ctx {
136135
struct ly_set node_when;
137136
struct ly_set node_types;
138137
struct ly_set meta_types;
139-
struct ly_set ext_node;
140138
struct ly_set ext_val;
141139
struct lyd_node *op_node;
142140
const struct lys_module *val_getnext_ht_mod;
@@ -168,7 +166,6 @@ struct lyd_lyb_ctx {
168166
struct ly_set node_when;
169167
struct ly_set node_types;
170168
struct ly_set meta_types;
171-
struct ly_set ext_node;
172169
struct ly_set ext_val;
173170
struct lyd_node *op_node;
174171
const struct lys_module *val_getnext_ht_mod;
@@ -191,14 +188,6 @@ struct lyd_ctx_ext_val {
191188
struct lyd_node *sibling;
192189
};
193190

194-
/**
195-
* @brief Parsed data node with extension instance to validate.
196-
*/
197-
struct lyd_ctx_ext_node {
198-
struct lysc_ext_instance *ext;
199-
struct lyd_node *node;
200-
};
201-
202191
/**
203192
* @brief Common part to supplement the specific ::lyd_ctx_free_clb callbacks.
204193
*/

src/parser_json.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,8 @@ lydjson_check_list(struct lyd_json_ctx *lydctx, const struct lysc_node *list)
460460

461461
rc = lydjson_value_type_hint(lydctx, &status, &hints);
462462
LY_CHECK_GOTO(rc, cleanup);
463-
rc = ly_value_validate(NULL, snode, jsonctx->value, jsonctx->value_len * 8, LY_VALUE_JSON, NULL, hints);
463+
rc = ly_value_validate(NULL, snode, jsonctx->value, jsonctx->value_len * 8, LY_VALUE_JSON, NULL,
464+
hints, lydctx->ext);
464465
LY_CHECK_GOTO(rc, cleanup);
465466

466467
/* key with a valid value, remove from the set */
@@ -533,7 +534,8 @@ lydjson_data_check_opaq(struct lyd_json_ctx *lydctx, const struct lysc_node *sno
533534
}
534535

535536
prev_lo = ly_temp_log_options(&temp_lo);
536-
if (ly_value_validate(NULL, snode, jsonctx->value, jsonctx->value_len * 8, LY_VALUE_JSON, NULL, *type_hint_p)) {
537+
if (ly_value_validate(NULL, snode, jsonctx->value, jsonctx->value_len * 8, LY_VALUE_JSON, NULL,
538+
*type_hint_p, lydctx->ext)) {
537539
ret = LY_ENOT;
538540
}
539541
ly_temp_log_options(prev_lo);
@@ -1538,12 +1540,6 @@ lydjson_parse_instance(struct lyd_json_ctx *lydctx, struct lyd_node *parent, str
15381540
/* add/correct flags */
15391541
r = lyd_parser_set_data_flags(*node, &(*node)->meta, (struct lyd_ctx *)lydctx, ext);
15401542
LY_CHECK_ERR_GOTO(r, rc = r, cleanup);
1541-
1542-
if (!(lydctx->parse_opts & LYD_PARSE_ONLY)) {
1543-
/* store for ext instance node validation, if needed */
1544-
r = lyd_validate_node_ext(*node, &lydctx->ext_node);
1545-
LY_CHECK_ERR_GOTO(r, rc = r, cleanup);
1546-
}
15471543
} else if (r == LY_ENOT) {
15481544
/* parse it again as an opaq node */
15491545
r = lydjson_parse_opaq(lydctx, name, name_len, prefix, prefix_len, parent, status, status, first_p, node);

src/parser_lyb.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -936,11 +936,6 @@ lyb_finish_node(struct lyd_lyb_ctx *lybctx, struct lyd_node *parent, uint32_t fl
936936
/* insert into parent */
937937
lyb_insert_node(lybctx, parent, *node, first_p, parsed);
938938

939-
if (!(lybctx->parse_opts & LYD_PARSE_ONLY)) {
940-
/* store for ext instance node validation, if needed */
941-
(void)lyd_validate_node_ext(*node, &lybctx->ext_node);
942-
}
943-
944939
*node = NULL;
945940
}
946941

src/parser_xml.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,10 @@ lydxml_attrs(struct lyxml_ctx *xmlctx, struct lyd_attr **attr)
274274
}
275275

276276
static LY_ERR
277-
lydxml_check_list(struct lyxml_ctx *xmlctx, const struct lysc_node *list)
277+
lydxml_check_list(struct lyd_xml_ctx *lydctx, const struct lysc_node *list)
278278
{
279279
LY_ERR ret = LY_SUCCESS, r;
280+
struct lyxml_ctx *xmlctx = lydctx->xmlctx;
280281
enum LYXML_PARSER_STATUS next;
281282
struct ly_set key_set = {0};
282283
const struct lysc_node *snode;
@@ -314,7 +315,8 @@ lydxml_check_list(struct lyxml_ctx *xmlctx, const struct lysc_node *list)
314315
assert(xmlctx->status == LYXML_ELEM_CONTENT);
315316
if (i < key_set.count) {
316317
/* validate the value */
317-
r = ly_value_validate(NULL, snode, xmlctx->value, xmlctx->value_len * 8, LY_VALUE_XML, &xmlctx->ns, LYD_HINT_DATA);
318+
r = ly_value_validate(NULL, snode, xmlctx->value, xmlctx->value_len * 8, LY_VALUE_XML, &xmlctx->ns,
319+
LYD_HINT_DATA, lydctx->ext);
318320
if (!r) {
319321
/* key with a valid value, remove from the set */
320322
ly_set_rm_index(&key_set, i, NULL);
@@ -422,7 +424,8 @@ lydxml_data_check_opaq(struct lyd_xml_ctx *lydctx, const struct lysc_node **snod
422424
if ((*snode)->nodetype & LYD_NODE_TERM) {
423425
/* value may not be valid in which case we parse it as an opaque node */
424426
prev_lo = ly_temp_log_options(&temp_lo);
425-
r = ly_value_validate(NULL, *snode, xmlctx->value, xmlctx->value_len * 8, LY_VALUE_XML, &xmlctx->ns, LYD_HINT_DATA);
427+
r = ly_value_validate(NULL, *snode, xmlctx->value, xmlctx->value_len * 8, LY_VALUE_XML, &xmlctx->ns,
428+
LYD_HINT_DATA, lydctx->ext);
426429
ly_temp_log_options(prev_lo);
427430
if (r) {
428431
LOGVRB("Parsing opaque term node \"%s\" with invalid value \"%.*s\".", (*snode)->name, (int)xmlctx->value_len,
@@ -433,7 +436,7 @@ lydxml_data_check_opaq(struct lyd_xml_ctx *lydctx, const struct lysc_node **snod
433436
/* skip content */
434437
LY_CHECK_GOTO(ret = lyxml_ctx_next(xmlctx), restore);
435438

436-
if (lydxml_check_list(xmlctx, *snode)) {
439+
if (lydxml_check_list(lydctx, *snode)) {
437440
/* invalid list, parse as opaque if it missing/has invalid some keys */
438441
LOGVRB("Parsing opaque list node \"%s\" with missing/invalid keys.", (*snode)->name);
439442
*snode = NULL;
@@ -1108,12 +1111,6 @@ lydxml_subtree_r(struct lyd_xml_ctx *lydctx, struct lyd_node *parent, struct lyd
11081111
/* add/correct flags */
11091112
r = lyd_parser_set_data_flags(node, &meta, (struct lyd_ctx *)lydctx, ext);
11101113
LY_CHECK_ERR_GOTO(r, rc = r; lyd_free_tree(node), cleanup);
1111-
1112-
if (!(lydctx->parse_opts & LYD_PARSE_ONLY)) {
1113-
/* store for ext instance node validation, if needed */
1114-
r = lyd_validate_node_ext(node, &lydctx->ext_node);
1115-
LY_DPARSER_ERR_GOTO(r, rc = r, lydctx, cleanup);
1116-
}
11171114
}
11181115

11191116
/* parser next */

src/path.c

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -643,8 +643,8 @@ ly_path_compile_snode(const struct ly_ctx *ctx, const struct lysc_node *cur_node
643643

644644
LY_ERR
645645
ly_path_compile_predicate(const struct ly_ctx *ctx, const struct lysc_node *cur_node, const struct lys_module *cur_mod,
646-
const struct lysc_node *ctx_node, const struct lyxp_expr *expr, uint32_t *tok_idx, LY_VALUE_FORMAT format,
647-
void *prefix_data, struct ly_path_predicate **predicates)
646+
const struct lysc_node *ctx_node, const struct lysc_ext_instance *top_ext, const struct lyxp_expr *expr,
647+
uint32_t *tok_idx, LY_VALUE_FORMAT format, void *prefix_data, struct ly_path_predicate **predicates)
648648
{
649649
LY_ERR rc = LY_SUCCESS, r;
650650
struct ly_path_predicate *p;
@@ -716,7 +716,8 @@ ly_path_compile_predicate(const struct ly_ctx *ctx, const struct lysc_node *cur_
716716

717717
/* do not store the canonical value, only validate */
718718
LOG_LOCSET(key, NULL);
719-
r = lyd_value_validate2(ctx_node->module->ctx, key, val, val_len, format, prefix_data, NULL, NULL, &p->value);
719+
r = lyd_value_validate2(ctx_node->module->ctx, key, val, val_len, format, prefix_data, NULL, top_ext,
720+
NULL, &p->value);
720721
LOG_LOCBACK(1, 0);
721722
LY_CHECK_ERR_GOTO(r && (r != LY_EINCOMPLETE), rc = r, cleanup);
722723

@@ -774,7 +775,8 @@ ly_path_compile_predicate(const struct ly_ctx *ctx, const struct lysc_node *cur_
774775

775776
/* do not store the value, only validate */
776777
LOG_LOCSET(ctx_node, NULL);
777-
r = lyd_value_validate2(ctx_node->module->ctx, ctx_node, val, val_len, format, prefix_data, NULL, NULL, &p->value);
778+
r = lyd_value_validate2(ctx_node->module->ctx, ctx_node, val, val_len, format, prefix_data, NULL, top_ext, NULL,
779+
&p->value);
778780
LOG_LOCBACK(1, 0);
779781
LY_CHECK_ERR_GOTO(r && (r != LY_EINCOMPLETE), rc = r, cleanup);
780782

@@ -1187,6 +1189,8 @@ _ly_path_compile(const struct ly_ctx *ctx, const struct lys_module *cur_mod, con
11871189

11881190
if (oper == LY_PATH_OPER_OUTPUT) {
11891191
getnext_opts = LYS_GETNEXT_OUTPUT;
1192+
} else if (top_ext) {
1193+
getnext_opts = LYS_GETNEXT_EXT_XPATH;
11901194
} else {
11911195
getnext_opts = 0;
11921196
}
@@ -1263,7 +1267,7 @@ _ly_path_compile(const struct ly_ctx *ctx, const struct lys_module *cur_mod, con
12631267
if (lref) {
12641268
rc = ly_path_compile_predicate_leafref(ctx_node, cur_node, expr, &tok_idx, format, prefix_data);
12651269
} else {
1266-
rc = ly_path_compile_predicate(ctx, cur_node, cur_mod, ctx_node, expr, &tok_idx, format, prefix_data,
1270+
rc = ly_path_compile_predicate(ctx, cur_node, cur_mod, ctx_node, top_ext, expr, &tok_idx, format, prefix_data,
12671271
&p->predicates);
12681272
}
12691273
LY_CHECK_GOTO(rc, cleanup);
@@ -1314,7 +1318,7 @@ ly_path_compile_leafref(const struct ly_ctx *ctx, const struct lysc_node *ctx_no
13141318

13151319
LY_ERR
13161320
ly_path_eval_partial(const struct ly_path *path, const struct lyd_node *start, const struct lyxp_var *vars,
1317-
ly_bool with_opaq, LY_ARRAY_COUNT_TYPE *path_idx, struct lyd_node **match)
1321+
const struct lysc_ext_instance *top_ext, ly_bool with_opaq, LY_ARRAY_COUNT_TYPE *path_idx, struct lyd_node **match)
13181322
{
13191323
LY_ARRAY_COUNT_TYPE u;
13201324
struct lyd_node *prev_node = NULL, *elem, *node = NULL, *target;
@@ -1352,14 +1356,16 @@ ly_path_eval_partial(const struct ly_path *path, const struct lyd_node *start, c
13521356
break;
13531357
case LY_PATH_PREDTYPE_LEAFLIST:
13541358
/* we will use hashes to find one leaf-list instance */
1355-
LY_CHECK_RET(lyd_create_term_canon(path[u].node, path[u].predicates[0].value, &target));
1359+
LY_CHECK_RET(lyd_create_term(path[u].node, path[u].predicates[0].value,
1360+
strlen(path[u].predicates[0].value) * 8, 1, 1, NULL, LY_VALUE_CANON, NULL, LYD_HINT_DATA,
1361+
top_ext, NULL, &target));
13561362
lyd_find_sibling_first(start, target, &node);
13571363
lyd_free_tree(target);
13581364
break;
13591365
case LY_PATH_PREDTYPE_LIST_VAR:
13601366
case LY_PATH_PREDTYPE_LIST:
13611367
/* we will use hashes to find one list instance */
1362-
LY_CHECK_RET(lyd_create_list(path[u].node, path[u].predicates, vars, 1, &target));
1368+
LY_CHECK_RET(lyd_create_list(path[u].node, path[u].predicates, vars, 1, top_ext, &target));
13631369
lyd_find_sibling_first(start, target, &node);
13641370
lyd_free_tree(target);
13651371
break;
@@ -1419,12 +1425,13 @@ ly_path_eval_partial(const struct ly_path *path, const struct lyd_node *start, c
14191425
}
14201426

14211427
LY_ERR
1422-
ly_path_eval(const struct ly_path *path, const struct lyd_node *start, const struct lyxp_var *vars, struct lyd_node **match)
1428+
ly_path_eval(const struct ly_path *path, const struct lyd_node *start, const struct lyxp_var *vars,
1429+
const struct lysc_ext_instance *top_ext, struct lyd_node **match)
14231430
{
14241431
LY_ERR ret;
14251432
struct lyd_node *m;
14261433

1427-
ret = ly_path_eval_partial(path, start, vars, 0, NULL, &m);
1434+
ret = ly_path_eval_partial(path, start, vars, top_ext, 0, NULL, &m);
14281435

14291436
if (ret == LY_SUCCESS) {
14301437
/* last node was found */

src/path.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ LY_ERR ly_path_compile_leafref(const struct ly_ctx *ctx, const struct lysc_node
213213
* @param[in] cur_mod Current module of the path (where it was "instantiated"). Used for nodes without a prefix
214214
* for ::LY_VALUE_SCHEMA and ::LY_VALUE_SCHEMA_RESOLVED format.
215215
* @param[in] ctx_node Context node, node for which the predicate is defined.
216+
* @param[in] top_ext Extension instance containing the definition of the data being created.
216217
* @param[in] expr Parsed path.
217218
* @param[in,out] tok_idx Index in @p expr, is adjusted for parsed tokens.
218219
* @param[in] format Format of the path.
@@ -221,15 +222,16 @@ LY_ERR ly_path_compile_leafref(const struct ly_ctx *ctx, const struct lysc_node
221222
* @return LY_ERR value.
222223
*/
223224
LY_ERR ly_path_compile_predicate(const struct ly_ctx *ctx, const struct lysc_node *cur_node, const struct lys_module *cur_mod,
224-
const struct lysc_node *ctx_node, const struct lyxp_expr *expr, uint32_t *tok_idx, LY_VALUE_FORMAT format,
225-
void *prefix_data, struct ly_path_predicate **predicates);
225+
const struct lysc_node *ctx_node, const struct lysc_ext_instance *top_ext, const struct lyxp_expr *expr,
226+
uint32_t *tok_idx, LY_VALUE_FORMAT format, void *prefix_data, struct ly_path_predicate **predicates);
226227

227228
/**
228229
* @brief Resolve at least partially the target defined by ly_path structure. Not supported for leafref!
229230
*
230231
* @param[in] path Path structure specifying the target.
231232
* @param[in] start Starting node for relative paths, can be any for absolute paths.
232233
* @param[in] vars Array of defined variables to use in predicates, may be NULL.
234+
* @param[in] top_ext Extension instance containing the definition of the data being created.
233235
* @param[in] with_opaq Whether to consider opaque nodes or not.
234236
* @param[out] path_idx Last found path segment index, can be NULL, set to 0 if not found.
235237
* @param[out] match Last found matching node, can be NULL, set to NULL if not found.
@@ -239,21 +241,22 @@ LY_ERR ly_path_compile_predicate(const struct ly_ctx *ctx, const struct lysc_nod
239241
* @return LY_ERR on another error.
240242
*/
241243
LY_ERR ly_path_eval_partial(const struct ly_path *path, const struct lyd_node *start, const struct lyxp_var *vars,
242-
ly_bool with_opaq, LY_ARRAY_COUNT_TYPE *path_idx, struct lyd_node **match);
244+
const struct lysc_ext_instance *top_ext, ly_bool with_opaq, LY_ARRAY_COUNT_TYPE *path_idx, struct lyd_node **match);
243245

244246
/**
245247
* @brief Resolve the target defined by ly_path structure. Not supported for leafref!
246248
*
247249
* @param[in] path Path structure specifying the target.
248250
* @param[in] start Starting node for relative paths, can be any for absolute paths.
249251
* @param[in] vars Array of defined variables to use in predicates, may be NULL.
252+
* @param[in] top_ext Extension instance containing the definition of the data being created.
250253
* @param[out] match Found matching node, can be NULL, set to NULL if not found.
251254
* @return LY_ENOTFOUND if no nodes were found,
252255
* @return LY_SUCCESS when the last node in the path was found,
253256
* @return LY_ERR on another error.
254257
*/
255258
LY_ERR ly_path_eval(const struct ly_path *path, const struct lyd_node *start, const struct lyxp_var *vars,
256-
struct lyd_node **match);
259+
const struct lysc_ext_instance *top_ext, struct lyd_node **match);
257260

258261
/**
259262
* @brief Duplicate ly_path structure.

0 commit comments

Comments
 (0)