blob: dd108230e37b16096c2c5f5114dda77f4cf6d94a [file] [log] [blame]
Radek Krejci04699f02021-03-22 21:50:29 +01001/**
2 * @file plugins_internal.h
3 * @author Radek Krejci <rkrejci@cesnet.cz>
4 * @brief internal functions to support extension and type plugins.
5 *
6 * Copyright (c) 2019-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_INTERNAL_H_
16#define LY_PLUGINS_INTERNAL_H_
17
Radek Krejci3e6632f2021-03-22 22:08:21 +010018#include <stdint.h>
19
20#include "plugins.h"
21#include "plugins_exts.h"
22#include "tree_schema.h"
23
Radek Krejci04699f02021-03-22 21:50:29 +010024#define LY_TYPE_UNKNOWN_STR "unknown" /**< text representation of ::LY_TYPE_UNKNOWN */
25#define LY_TYPE_BINARY_STR "binary" /**< text representation of ::LY_TYPE_BINARY */
26#define LY_TYPE_UINT8_STR "8bit unsigned integer" /**< text representation of ::LY_TYPE_UINT8 */
27#define LY_TYPE_UINT16_STR "16bit unsigned integer" /**< text representation of ::LY_TYPE_UINT16 */
28#define LY_TYPE_UINT32_STR "32bit unsigned integer" /**< text representation of ::LY_TYPE_UINT32 */
29#define LY_TYPE_UINT64_STR "64bit unsigned integer" /**< text representation of ::LY_TYPE_UINT64 */
30#define LY_TYPE_STRING_STR "string" /**< text representation of ::LY_TYPE_STRING */
31#define LY_TYPE_BITS_STR "bits" /**< text representation of ::LY_TYPE_BITS */
32#define LY_TYPE_BOOL_STR "boolean" /**< text representation of ::LY_TYPE_BOOL */
33#define LY_TYPE_DEC64_STR "decimal64" /**< text representation of ::LY_TYPE_DEC64 */
34#define LY_TYPE_EMPTY_STR "empty" /**< text representation of ::LY_TYPE_EMPTY */
35#define LY_TYPE_ENUM_STR "enumeration" /**< text representation of ::LY_TYPE_ENUM */
36#define LY_TYPE_IDENT_STR "identityref" /**< text representation of ::LY_TYPE_IDENT */
37#define LY_TYPE_INST_STR "instance-identifier" /**< text representation of ::LY_TYPE_INST */
38#define LY_TYPE_LEAFREF_STR "leafref" /**< text representation of ::LY_TYPE_LEAFREF */
39#define LY_TYPE_UNION_STR "union" /**< text representation of ::LY_TYPE_UNION */
40#define LY_TYPE_INT8_STR "8bit integer" /**< text representation of ::LY_TYPE_INT8 */
41#define LY_TYPE_INT16_STR "16bit integer" /**< text representation of ::LY_TYPE_INT16 */
42#define LY_TYPE_INT32_STR "32bit integer" /**< text representation of ::LY_TYPE_INT32 */
43#define LY_TYPE_INT64_STR "64bit integer" /**< text representation of ::LY_TYPE_INT64 */
44
Radek Krejci3e6632f2021-03-22 22:08:21 +010045/**
46 * @brief Initiate libyang plugins.
47 *
48 * Covers both the types and extensions plugins.
49 *
50 * @return LY_SUCCESS in case of success
51 * @return LY_EINT in case of internal error
52 * @return LY_EMEM in case of memory allocation failure.
53 */
54LY_ERR lyplg_init(void);
55
56/**
57 * @brief Remove (unload) all the plugins currently available.
58 */
59void lyplg_clean(void);
60
61/**
62 * @brief Find the plugin matching the provided attributes.
63 *
64 * @param[in] type Type of the plugin to find (type or extension)
65 * @param[in] module Name of the module where the type/extension is defined. Must not be NULL, in case of plugins for
66 * built-in types, the module is "".
67 * @param[in] revision The revision of the module for which the plugin is implemented. NULL is not a wildcard, it matches
68 * only the plugins with NULL revision specified.
69 * @param[in] name Name of the type/extension which the plugin implements.
70 * @return NULL if the plugin matching the restrictions is not present.
71 * @return Pointer to the matching ::ly_type_plugin or ::lyext_plugin according to the plugin's @p type.
72 */
73void *lyplg_find(enum LYPLG type, const char *module, const char *revision, const char *name);
74
Radek Krejci04699f02021-03-22 21:50:29 +010075#endif /* LY_PLUGINS_INTERNAL_H_ */