1
0
Fork 0

Merging upstream version 3.7.8.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-05 08:08:50 +01:00
parent 099007bbc4
commit a3c6363c26
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
52 changed files with 13518 additions and 998 deletions

View file

@ -4,7 +4,7 @@
* @author Michal Vasko <mvasko@cesnet.cz>
* @brief internal functions for YANG schema trees.
*
* Copyright (c) 2015 - 2023 CESNET, z.s.p.o.
* Copyright (c) 2015 - 2024 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.
@ -117,13 +117,6 @@ const struct lys_module *lyd_mod_next_module(struct lyd_node *tree, const struct
*/
const struct lys_module *lyd_data_next_module(struct lyd_node **next, struct lyd_node **first);
/**
* @brief Set dflt flag for a NP container if applicable, recursively for parents.
*
* @param[in] node Node whose criteria for the dflt flag has changed.
*/
void lyd_cont_set_dflt(struct lyd_node *node);
/**
* @brief Search in the given siblings (NOT recursively) for the first schema node data instance.
* Uses hashes - should be used whenever possible for best performance.
@ -147,6 +140,20 @@ LY_ERR lyd_find_sibling_schema(const struct lyd_node *siblings, const struct lys
*/
void lyd_del_move_root(struct lyd_node **root, const struct lyd_node *to_del, const struct lys_module *mod);
/**
* @brief After adding a default child, check the node and all of its parent NP containers and set their dflt flag.
*
* @param[in] parent Changed first parent to check.
*/
void lyd_np_cont_dflt_set(struct lyd_node *parent);
/**
* @brief After adding a non-default child, remove the dflt flag from parent and other parent NP containers.
*
* @param[in] parent Changed first parent to update.
*/
void lyd_np_cont_dflt_del(struct lyd_node *parent);
/**
* @brief Try to get schema node for data with a parent based on an extension instance.
*
@ -345,7 +352,24 @@ LY_ERR lyd_create_opaq(const struct ly_ctx *ctx, const char *name, size_t name_l
LY_VALUE_FORMAT format, void *val_prefix_data, uint32_t hints, struct lyd_node **node);
/**
* @brief Check the existence and create any non-existing implicit siblings, recursively for the created nodes.
* @brief Change the value of a term (leaf or leaf-list) node.
*
* Node changed this way is always considered explicitly set, meaning its default flag
* is always cleared.
*
* @param[in] term Term node to change.
* @param[in] val New value to use.
* @param[in] use_val Whether @p val can be used and spent or should only be duplicated.
* @param[in] is_dflt Whether @p val is a default value or not.
* @return LY_SUCCESS if value was changed,
* @return LY_EEXIST if value was the same and only the default flag was cleared,
* @return LY_ENOT if the values were equal and no change occured,
* @return LY_ERR value on other errors.
*/
LY_ERR lyd_change_term_val(struct lyd_node *term, struct lyd_value *val, ly_bool use_val, ly_bool is_dflt);
/**
* @brief Check the existence and create any non-existing implicit children.
*
* @param[in] parent Parent of the potential default values, NULL for top-level siblings.
* @param[in,out] first First sibling.
@ -355,12 +379,32 @@ LY_ERR lyd_create_opaq(const struct ly_ctx *ctx, const char *name, size_t name_l
* @param[in] node_types Optional set to add nodes with unresolved types into.
* @param[in] ext_node Optional set to add nodes with extension instance node callbacks into.
* @param[in] impl_opts Implicit options (@ref implicitoptions).
* @param[in,out] getnext_ht Getnext HT to use, new @p sparent is added to it.
* @param[in,out] diff Validation diff.
* @return LY_ERR value.
*/
LY_ERR lyd_new_implicit(struct lyd_node *parent, struct lyd_node **first, const struct lysc_node *sparent,
const struct lys_module *mod, struct ly_set *node_when, struct ly_set *node_types, struct ly_set *ext_node,
uint32_t impl_opts, struct ly_ht *getnext_ht, struct lyd_node **diff);
/**
* @brief Check the existence and create any non-existing implicit children, recursively for containers.
*
* @param[in] parent Parent of the potential default values, NULL for top-level siblings.
* @param[in,out] first First sibling.
* @param[in] sparent Schema parent of the siblings, NULL if schema of @p parent can be used.
* @param[in] mod Module of the default values, NULL for nested siblings.
* @param[in] node_when Optional set to add nodes with "when" conditions into.
* @param[in] node_types Optional set to add nodes with unresolved types into.
* @param[in] ext_node Optional set to add nodes with extension instance node callbacks into.
* @param[in] impl_opts Implicit options (@ref implicitoptions).
* @param[in,out] getnext_ht Getnext HT to use, new @p sparent is added to it.
* @param[in,out] diff Validation diff.
* @return LY_ERR value.
*/
LY_ERR lyd_new_implicit_r(struct lyd_node *parent, struct lyd_node **first, const struct lysc_node *sparent,
const struct lys_module *mod, struct ly_set *node_when, struct ly_set *node_types, struct ly_set *ext_node,
uint32_t impl_opts, struct lyd_node **diff);
uint32_t impl_opts, struct ly_ht *getnext_ht, struct lyd_node **diff);
/**
* @brief Find the next node, before which to insert the new node.
@ -719,4 +763,17 @@ LY_ERR lyd_unlink_leafref_node(const struct lyd_node_term *node, const struct ly
*/
void lyd_unlink_ignore_lyds(struct lyd_node **first_sibling, struct lyd_node *node);
/**
* @brief Check a string matches a compiled pattern.
*
* @param[in] pcode Compiled pattern.
* @param[in] str String to match.
* @param[in] str_len Length of @p str.
* @param[out] err Error, if generated.
* @return LY_SUCCESS on a match;
* @return LY_ENOT if the string does not match;
* @return LY_ERR on error.
*/
LY_ERR ly_pattern_code_match(pcre2_code *pcode, const char *str, size_t str_len, struct ly_err_item **err);
#endif /* LY_TREE_DATA_INTERNAL_H_ */