blob: 13608b8a58eff6263e7f1864d26bfdd4dfe01af8 [file] [log] [blame]
Michal Vaskocde73ac2019-11-14 16:10:27 +01001/**
2 * @file validation.h
3 * @author Michal Vasko <mvasko@cesnet.cz>
4 * @brief Validation routines.
5 *
6 * Copyright (c) 2019 CESNET, z.s.p.o.
7 *
8 * This source code is licensed under BSD 3-Clause License (the "License").
9 * You may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * https://opensource.org/licenses/BSD-3-Clause
13 */
14
15#ifndef LY_VALIDATION_H_
16#define LY_VALIDATION_H_
17
18#include "log.h"
19#include "tree_data.h"
20
21/**
22 * @brief Finish validation of nodes and attributes. Specifically, type and when validation.
23 *
24 * @param[in] node_types Set with nodes with unresolved types, can be NULL
25 * @param[in] attr_types Set with attributes with unresolved types, can be NULL.
26 * @param[in] node_when Set with nodes with "when" conditions, can be NULL.
27 * @param[in] format Format of the unresolved data.
28 * @param[in] get_prefix_clb Format-specific getter to resolve prefixes.
29 * @param[in] parser_data Parser's data for @p get_prefix_clb.
30 * @param[in] trees Array of all data trees.
31 * @return LY_ERR value.
32 */
33LY_ERR lyd_validate_unres(struct ly_set *node_types, struct ly_set *attr_types, struct ly_set *node_when, LYD_FORMAT format,
34 ly_clb_resolve_prefix get_prefix_clb, void *parser_data, const struct lyd_node **trees);
35
36/**
37 * @brief Perform all vaidation tasks that depend on other nodes, the data tree must
38 * be complete when calling this function.
39 *
40 * @param[in] trees Array of all data trees.
41 * @param[in] modules Array of modules that should be validated, NULL for all modules.
42 * @param[in] mod_count Modules count.
43 * @param[in] ctx Context if all modules should be validated, NULL for only selected modules.
44 * @param[in] options Validation options.
45 * @return LY_ERR value.
46 */
47LY_ERR lyd_validate_modules(const struct lyd_node **trees, const struct lys_module **modules, int mod_count,
48 struct ly_ctx *ctx, int options);
49
50#endif /* LY_VALIDATION_H_ */