blob: 085e9172e2711b7733d3ddb730e135d069b4ebd3 [file] [log] [blame]
Radek Krejci0935f412019-08-20 16:15:18 +02001/**
2 * @file plugins_exts_internal.h
3 * @author Radek Krejci <rkrejci@cesnet.cz>
4 * @brief internal functions to support extension plugins.
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_PLUGINS_EXTS_INTERNAL_H_
16#define LY_PLUGINS_EXTS_INTERNAL_H_
17
Radek Krejci38d85362019-09-05 16:26:38 +020018#include "plugins_exts.h"
Michal Vasko69730152020-10-09 16:30:07 +020019#include "tree_schema.h"
Radek Krejci38d85362019-09-05 16:26:38 +020020
21#include "plugins_exts_metadata.h"
22
23/**
Radek Krejcic0c872a2021-03-10 13:30:08 +010024 * @brief Record describing an implemented extension.
25 */
26struct lyext_plugin_record {
27 const char *module; /**< name of the module where the extension is defined */
28 const char *revision; /**< optional module revision - if not specified, the plugin applies to any revision,
29 which is not an optimal approach due to a possible future revisions of the module.
30 Instead, there should be defined multiple items in the plugins list, each with the
31 different revision, but all with the same pointer to the plugin extension. The
32 only valid use case for the NULL revision is the case the module has no revision. */
33 const char *name; /**< name of the extension */
34 struct lyext_plugin *plugin; /**< plugin for the extension */
35};
36
37/**
Radek Krejci38d85362019-09-05 16:26:38 +020038 * @brief List of internally implemented extension plugins.
39 */
Radek Krejcic0c872a2021-03-10 13:30:08 +010040extern struct lyext_plugin_record lyext_plugins_internal[];
Radek Krejci38d85362019-09-05 16:26:38 +020041
42/**
43 * @brief Index of Metadata's annotation extension plugin in lyext_plugins_internal
44 */
45#define LYEXT_PLUGIN_INTERNAL_ANNOTATION 4
Radek Krejci0935f412019-08-20 16:15:18 +020046
47/**
Radek Krejci5fa32a32021-02-08 18:12:38 +010048 * @brief Index of yang-data extension plugin in lyext_plugins_internal
49 */
50#define LYEXT_PLUGIN_INTERNAL_YANGDATA 5
51
52/**
Radek Krejci0935f412019-08-20 16:15:18 +020053 * @brief Find the extension plugin for the specified extension instance.
54 *
55 * @param[in] mod YANG module where the
56 */
57struct lyext_plugin *lyext_get_plugin(struct lysc_ext *ext);
58
59#endif /* LY_PLUGINS_EXTS_INTERNAL_H_ */