libyang 2.0.231
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
plugins_exts.h
Go to the documentation of this file.
1
16#ifndef LY_PLUGINS_EXTS_H_
17#define LY_PLUGINS_EXTS_H_
18
19#include "log.h"
20#include "parser_data.h"
21#include "plugins.h"
22#include "tree_data.h"
23#include "tree_edit.h"
24#include "tree_schema.h"
25
27#include "plugins_exts_print.h"
28
29struct ly_ctx;
30struct ly_in;
31struct lyd_node;
32struct lysc_ext_substmt;
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
105#define LYPLG_EXT_API_VERSION 4
106
113#define LYPLG_EXTENSIONS \
114 uint32_t plugins_extensions_apiver__ = LYPLG_EXT_API_VERSION; \
115 const struct lyplg_ext_record plugins_extensions__[]
116
124LIBYANG_API_DECL void lyplg_ext_instance_substatements_free(struct ly_ctx *ctx, struct lysc_ext_substmt *substmts);
125
141typedef LY_ERR (*lyplg_ext_compile_clb)(struct lysc_ctx *cctx, const struct lysp_ext_instance *p_ext,
142 struct lysc_ext_instance *c_ext);
143
153typedef LY_ERR (*lyplg_ext_schema_printer_clb)(struct lyspr_ctx *ctx, struct lysc_ext_instance *ext, ly_bool *flag);
154
161typedef void (*lyplg_ext_free_clb)(struct ly_ctx *ctx, struct lysc_ext_instance *ext);
162
182 const struct lysc_node *sparent, const char *prefix, size_t prefix_len, LY_VALUE_FORMAT format, void *prefix_data,
183 const char *name, size_t name_len, const struct lysc_node **snode);
184
200typedef LY_ERR (*lyplg_ext_data_validate_clb)(struct lysc_ext_instance *ext, struct lyd_node *sibling,
201 const struct lyd_node *dep_tree, enum lyd_type data_type, uint32_t val_opts, struct lyd_node **diff);
202
206struct lyplg_ext {
207 const char *id;
217};
218
220 /* plugin identification */
221 const char *module;
222 const char *revision;
227 const char *name;
229 /* runtime data */
231};
232
243LIBYANG_API_DECL LY_ERR lyplg_ext_get_data(const struct ly_ctx *ctx, const struct lysc_ext_instance *ext, void **ext_data,
244 ly_bool *ext_data_free);
245
254LIBYANG_API_DECL LY_ERR lyd_insert_ext(struct lyd_node *parent, struct lyd_node *first);
255
265LIBYANG_API_DECL void lyplg_ext_log(const struct lysc_ext_instance *ext, LY_LOG_LEVEL level, LY_ERR err_no, const char *path,
266 const char *format, ...);
267
270#ifdef __cplusplus
271}
272#endif
273
274#endif /* LY_PLUGINS_EXTS_H_ */
libyang context handler.
lyd_type
Definition: parser_data.h:299
LY_ERR
libyang's error codes returned by the libyang functions.
Definition: log.h:244
LY_LOG_LEVEL
Verbosity levels of the libyang logger.
Definition: log.h:88
lyplg_ext_free_clb free
Definition: plugins_exts.h:212
lyplg_ext_data_snode_clb snode
Definition: plugins_exts.h:214
const char * id
Definition: plugins_exts.h:207
const char * revision
Definition: plugins_exts.h:222
const char * module
Definition: plugins_exts.h:221
struct lyplg_ext plugin
Definition: plugins_exts.h:230
lyplg_ext_data_validate_clb validate
Definition: plugins_exts.h:215
lyplg_ext_schema_printer_clb sprinter
Definition: plugins_exts.h:210
lyplg_ext_compile_clb compile
Definition: plugins_exts.h:209
const char * name
Definition: plugins_exts.h:227
LY_ERR(* lyplg_ext_schema_printer_clb)(struct lyspr_ctx *ctx, struct lysc_ext_instance *ext, ly_bool *flag)
Callback to print the compiled extension instance's private data in the INFO format.
Definition: plugins_exts.h:153
void(* lyplg_ext_free_clb)(struct ly_ctx *ctx, struct lysc_ext_instance *ext)
Callback to free the extension-specific data created by its compilation.
Definition: plugins_exts.h:161
LY_ERR(* lyplg_ext_data_snode_clb)(struct lysc_ext_instance *ext, const struct lyd_node *parent, const struct lysc_node *sparent, const char *prefix, size_t prefix_len, LY_VALUE_FORMAT format, void *prefix_data, const char *name, size_t name_len, const struct lysc_node **snode)
Callback for getting a schema node for a new YANG instance data described by an extension instance....
Definition: plugins_exts.h:181
LY_ERR(* lyplg_ext_data_validate_clb)(struct lysc_ext_instance *ext, struct lyd_node *sibling, const struct lyd_node *dep_tree, enum lyd_type data_type, uint32_t val_opts, struct lyd_node **diff)
Callback for validating parsed YANG instance data described by an extension instance.
Definition: plugins_exts.h:200
LIBYANG_API_DECL LY_ERR lyd_insert_ext(struct lyd_node *parent, struct lyd_node *first)
Insert extension instance data into a parent.
LIBYANG_API_DECL void lyplg_ext_log(const struct lysc_ext_instance *ext, LY_LOG_LEVEL level, LY_ERR err_no, const char *path, const char *format,...)
Provide a log message from an extension plugin.
LY_ERR(* lyplg_ext_compile_clb)(struct lysc_ctx *cctx, const struct lysp_ext_instance *p_ext, struct lysc_ext_instance *c_ext)
Callback to compile extension from the lysp_ext_instance to the lysc_ext_instance....
Definition: plugins_exts.h:141
LIBYANG_API_DECL void lyplg_ext_instance_substatements_free(struct ly_ctx *ctx, struct lysc_ext_substmt *substmts)
Free the extension instance's data compiled with lys_compile_extension_instance().
LIBYANG_API_DECL LY_ERR lyplg_ext_get_data(const struct ly_ctx *ctx, const struct lysc_ext_instance *ext, void **ext_data, ly_bool *ext_data_free)
Get specific run-time extension instance data from a callback set by ly_ctx_set_ext_data_clb().
Extension plugin implementing various aspects of a YANG extension.
Definition: plugins_exts.h:206
const char * name
Definition: tree_schema.h:1661
YANG extension instance.
Definition: tree_schema.h:1429
Description of the extension instance substatements.
Definition: tree_schema.h:1419
Compiled YANG data node.
Definition: tree_schema.h:1650
YANG extension instance.
Definition: tree_schema.h:525
LY_VALUE_FORMAT
All kinds of supported value formats and prefix mappings to modules.
Definition: tree.h:235
Logger manipulation routines and error definitions.
uint8_t ly_bool
Type to indicate boolean value.
Definition: log.h:34
Parser input structure specifying where the data are read.
Data parsers for libyang.
Plugins manipulation.
libyang support for YANG extensions implementation - schema compilation related items.
libyang support for YANG extensions implementation - schema print related items.
libyang representation of YANG data trees.
struct lyd_node_inner * parent
Definition: tree_data.h:805
Generic structure for a data node.
Definition: tree_data.h:798
libyang generic macros and functions to modify YANG schema or data trees. Intended for internal use a...
libyang representation of YANG schema trees.