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
/**
* @file validation.h
* @author Michal Vasko <mvasko@cesnet.cz>
* @brief Validation routines.
*
* Copyright (c) 2019 - 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 Cached getnext schema nodes stored in a validation HT.
*/
;
/**
* @brief Create a getnext cached schema node validation HT.
*
* @param[out] getnext_ht_p Created getnext HT.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Free a getnext cached schema node validation HT.
*
* @param[in] getnext_ht Getnext HT to free.
*/
void ;
/**
* @brief Get the schema children of a schema parent.
*
* Getnext structure cannot be returned because the pointer may become invalid on HT resize.
*
* @param[in] snode First schema node to use.
* @param[in] sparent Schema parent to use.
* @param[in] mod Module to use.
* @param[in] output Whether to traverse operation output instead of input nodes.
* @param[in,out] getnext_ht Getnext HT to use, new @p sparent is added to it.
* @param[out] choices Array of getnext choices of @p sparent.
* @param[out] snodes Array of getnext schema nodes except for choices of @p sparent.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Add new changes into a diff. They are always merged.
*
* @param[in] node Node/subtree to add.
* @param[in] op Operation of the change.
* @param[in,out] diff Diff to update.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Finish validation of nodes and attributes. Specifically, when (is processed first) and type validation.
*
* !! It is assumed autodeleted nodes cannot be in the unresolved node type set !!
*
* @param[in,out] tree Data tree, is updated if some nodes are autodeleted.
* @param[in] mod Module of the @p tree to take into consideration when deleting @p tree and moving it.
* If set, it is expected @p tree should point to the first node of @p mod. Otherwise it will simply be
* the first top-level sibling.
* @param[in] data_type Validate data type.
* @param[in] node_when Set with nodes with "when" conditions, can be NULL.
* @param[in] when_xp_opts Additional XPath options to use for evaluating "when".
* @param[in] node_types Set with nodes with unresolved types, can be NULL
* @param[in] meta_types Set with metadata with unresolved types, can be NULL.
* @param[in] ext_val Set with extension data to validate, can be NULL.
* @param[in] val_opts Validation options, see @ref datavalidationoptions.
* @param[in,out] diff Validation diff.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Validate new siblings. Specifically, check duplicated instances, autodelete default values and cases.
*
* !! It is assumed autodeleted nodes cannot yet be in the unresolved node type set !!
*
* @param[in,out] first First sibling.
* @param[in] sparent Schema parent of the siblings, NULL for top-level siblings.
* @param[in] mod Module of the siblings, NULL for nested siblings.
* @param[in] val_opts Validation options.
* @param[in] int_opts Internal parser options.
* @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 ;
/**
* @brief Validate data tree created by an extension instance by storing it in unres.
*
* @param[in] node Node with ::LYD_EXT flag whose subtree needs to be validated by an ext instance callback.
* @param[in] ext Extension instance with the validation callback. If not set, is found first.
* @param[in,out] ext_val Set with data to validate.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Validate data node with an extension instance, if any, by storing it in unres.
*
* @param[in] node Node to check for an extension instance with a validate callback.
* @param[in,out] ext_val Set with data to validate.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Validate a data tree.
*
* @param[in,out] tree Data tree to validate, nodes may be autodeleted.
* @param[in] module Module whose data (and schema restrictions) to validate, NULL for all modules.
* @param[in] ctx libyang context.
* @param[in] val_opts Validation options, see @ref datavalidationoptions.
* @param[in] validate_subtree Whether subtree was already validated (as part of data parsing) or not (separate validation).
* @param[in] node_when_p Set of nodes with when conditions, if NULL a local set is used.
* @param[in] node_types_p Set of unres node types, if NULL a local set is used.
* @param[in] meta_types_p Set of unres metadata types, if NULL a local set is used.
* @param[in] ext_val_p Set of unres extension data to validate, if NULL a local set is used.
* @param[out] diff Generated validation diff, not generated if NULL.
* @return LY_ERR value.
*/
LY_ERR ;
/* LY_VALIDATION_H_ */