libyang  2.0.112
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
plugins_exts.h
Go to the documentation of this file.
1 
15 #ifndef LY_PLUGINS_EXTS_H_
16 #define LY_PLUGINS_EXTS_H_
17 
18 #include "log.h"
19 #include "plugins.h"
20 #include "tree_edit.h"
21 #include "tree_schema.h"
22 
23 #include "plugins_exts_compile.h"
24 #include "plugins_exts_print.h"
25 
26 struct ly_ctx;
27 struct lyd_node;
28 struct lysc_ext_substmt;
29 struct lysp_ext_instance;
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
101 #define LYPLG_EXT_API_VERSION 1
102 
109 #define LYPLG_EXTENSIONS \
110  uint32_t plugins_extensions_apiver__ = LYPLG_EXT_API_VERSION; \
111  const struct lyplg_ext_record plugins_extensions__[]
112 
120 void lyplg_ext_instance_substatements_free(struct ly_ctx *ctx, struct lysc_ext_substmt *substmts);
121 
137 typedef LY_ERR (*lyplg_ext_compile_clb)(struct lysc_ctx *cctx, const struct lysp_ext_instance *p_ext, struct lysc_ext_instance *c_ext);
138 
145 typedef void (*lyplg_ext_free_clb)(struct ly_ctx *ctx, struct lysc_ext_instance *ext);
146 
159 typedef LY_ERR (*lyplg_ext_data_validation_clb)(struct lysc_ext_instance *ext, struct lyd_node *node);
160 
171 typedef LY_ERR (*lyplg_ext_schema_printer_clb)(struct lyspr_ctx *ctx, struct lysc_ext_instance *ext, ly_bool *flag);
172 
176 struct lyplg_ext {
177  const char *id;
182 };
183 
185  /* plugin identification */
186  const char *module;
187  const char *revision;
192  const char *name;
194  /* runtime data */
195  struct lyplg_ext plugin;
196 };
197 
207 void lyplg_ext_log(const struct lysc_ext_instance *ext, LY_LOG_LEVEL level, LY_ERR err_no, const char *path,
208  const char *format, ...);
209 
212 #ifdef __cplusplus
213 }
214 #endif
215 
216 #endif /* LY_PLUGINS_EXTS_H_ */
YANG extension instance.
Definition: tree_schema.h:525
const char * module
Definition: plugins_exts.h:186
const char * name
Definition: plugins_exts.h:192
const char * revision
Definition: plugins_exts.h:187
Extension plugin implementing various aspects of a YANG extension.
Definition: plugins_exts.h:176
Generic structure for a data node.
Definition: tree_data.h:759
lyplg_ext_schema_printer_clb sprinter
Definition: plugins_exts.h:180
YANG extension instance.
Definition: tree_schema.h:1445
uint8_t ly_bool
Type to indicate boolean value.
Definition: log.h:25
libyang representation of YANG schema trees.
lyplg_ext_free_clb free
Definition: plugins_exts.h:181
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:171
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. The later structure is generally prepared and only the extension specific data are supposed to be added (if any).
Definition: plugins_exts.h:137
const char * id
Definition: plugins_exts.h:177
LY_ERR(* lyplg_ext_data_validation_clb)(struct lysc_ext_instance *ext, struct lyd_node *node)
Callback to decide if data instance is valid according to the schema.
Definition: plugins_exts.h:159
libyang support for YANG extensions implementation - schema print related items.
LY_LOG_LEVEL
Verbosity levels of the libyang logger.
Definition: log.h:85
struct lyplg_ext plugin
Definition: plugins_exts.h:195
lyplg_ext_compile_clb compile
Definition: plugins_exts.h:178
Description of the extension instance substatements.
Definition: tree_schema.h:1435
void(* lyplg_ext_free_clb)(struct ly_ctx *ctx, struct lysc_ext_instance *ext)
Callback to free the extension specific data created by the lyplg_ext_compile_clb callback of the sam...
Definition: plugins_exts.h:145
libyang support for YANG extensions implementation - schema compilation related items.
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().
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.
libyang generic macros and functions to modify YANG schema or data trees. Intended for internal use a...
Plugins manipulation.
LY_ERR
libyang's error codes returned by the libyang functions.
Definition: log.h:245
Logger manipulation routines and error definitions.
lyplg_ext_data_validation_clb validate
Definition: plugins_exts.h:179
libyang context handler.