diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:55:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:55:11 +0000 |
commit | cd07912073c951b4bbb871ed2653af1be2cfc714 (patch) | |
tree | 1073c2308492e6aea4c66cb7436ee92db2abfd42 /src/schema_features.h | |
parent | Initial commit. (diff) | |
download | libyang2-upstream/2.1.30.tar.xz libyang2-upstream/2.1.30.zip |
Adding upstream version 2.1.30.upstream/2.1.30upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/schema_features.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/schema_features.h b/src/schema_features.h new file mode 100644 index 0000000..c73561f --- /dev/null +++ b/src/schema_features.h @@ -0,0 +1,67 @@ +/** + * @file schema_features.h + * @author Michal Vasko <mvasko@cesnet.cz> + * @brief Header for schema features. + * + * Copyright (c) 2015 - 2020 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 + */ + +#ifndef LY_SCHEMA_FEATURES_H_ +#define LY_SCHEMA_FEATURES_H_ + +#include "log.h" + +struct ly_ctx; +struct lysp_module; +struct lysp_qname; + +/** + * @brief Evaluate if-features array. + * + * @param[in] ctx libyang context. + * @param[in] iffeatures Sized array of if-features to evaluate. + * @param[out] enabled Whether if-features evaluated to true or false. + * @return LY_SUCCESS on success. + * @return LY_ERR on error. + */ +LY_ERR lys_eval_iffeatures(const struct ly_ctx *ctx, const struct lysp_qname *iffeatures, ly_bool *enabled); + +/** + * @brief Check whether all enabled features have their if-features satisfied. + * + * @param[in] pmod Parsed module features to check. + * @return LY_SUCCESS on success. + * @return LY_EDENIED if there was an enabled feature with disabled if-feature. + */ +LY_ERR lys_check_features(const struct lysp_module *pmod); + +/** + * @brief Set the specified features of a parsed module ignoring their own if-features. These are all checked before + * compiling the module(s). + * + * @param[in] pmod Parsed module to modify. + * @param[in] features Array of features ended with NULL to be enabled if the module is being implemented. + * The feature string '*' enables all and array of length 1 with only the terminating NULL explicitly disables all + * the features. In case the parameter is NULL, the features are untouched - left disabled in newly loaded module or + * with the current features settings in case the module is already present in the context. + * @return LY_SUCCESS on success. + * @return LY_EEXIST if the specified features were already set. + * @return LY_ERR on error. + */ +LY_ERR lys_set_features(struct lysp_module *pmod, const char **features); + +/** + * @brief Compile if-features of features in the provided module and all its submodules. + * + * @param[in] pmod Parsed module to process. + * @return LY_ERR value. + */ +LY_ERR lys_compile_feature_iffeatures(struct lysp_module *pmod); + +#endif /* LY_SCHEMA_FEATURES_H_ */ |