Radek Krejci | 3e6632f | 2021-03-22 22:08:21 +0100 | [diff] [blame] | 1 | /** |
| 2 | * @file plugins.h |
| 3 | * @author Radek Krejci <rkrejci@cesnet.cz> |
| 4 | * @brief Plugins manipulation. |
| 5 | * |
| 6 | * Copyright (c) 2021 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_PLUGINS_H_ |
| 16 | #define LY_PLUGINS_H_ |
| 17 | |
| 18 | #include "log.h" |
| 19 | |
| 20 | #ifdef __cplusplus |
| 21 | extern "C" { |
| 22 | #endif |
| 23 | |
| 24 | /** |
| 25 | * @defgroup plugins Plugins |
| 26 | * @{ |
| 27 | * |
| 28 | */ |
| 29 | |
| 30 | /** |
| 31 | * @brief Identifiers of the plugin type. |
| 32 | */ |
| 33 | enum LYPLG { |
| 34 | LYPLG_TYPE, /**< Specific type (typedef) */ |
| 35 | LYPLG_EXTENSION /**< YANG extension */ |
| 36 | }; |
| 37 | |
Radek Krejci | bf940f9 | 2021-03-24 21:04:13 +0100 | [diff] [blame] | 38 | /** |
| 39 | * @brief Manually load a plugin file. |
| 40 | * |
| 41 | * Note, that a plugin can be loaded only if there is at least one context. The loaded plugins are connected with the |
| 42 | * existence of a context. When all the contexts are destroyed, all the plugins are unloaded. |
| 43 | * |
| 44 | * @param[in] pathname Path to the plugin file. It can contain types or extensions plugins, both are accepted and correctly |
| 45 | * loaded. |
| 46 | * |
| 47 | * @return LY_SUCCESS if the file contains valid plugin compatible with the library version. |
| 48 | * @return LY_EDENIED in case there is no context and the plugin cannot be loaded. |
| 49 | * @return LY_EINVAL when pathname is NULL or the plugin contains invalid content for this libyang version. |
| 50 | * @return LY_ESYS when the plugin file cannot be loaded. |
| 51 | */ |
| 52 | LY_ERR lyplg_add(const char *pathname); |
| 53 | |
Radek Krejci | 3e6632f | 2021-03-22 22:08:21 +0100 | [diff] [blame] | 54 | /** @} plugins */ |
| 55 | |
| 56 | #ifdef __cplusplus |
| 57 | } |
| 58 | #endif |
| 59 | |
| 60 | #endif /* LY_PLUGINS_H_ */ |