libyang  0.16.105
YANG data modeling language library
extensions.h
Go to the documentation of this file.
1 
15 #ifndef LY_EXTENSIONS_H_
16 #define LY_EXTENSIONS_H_
17 
18 #include "libyang.h"
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
32 typedef enum {
52 } LYEXT_PAR;
53 
67 typedef enum {
112 } LYEXT_SUBSTMT;
113 
127 typedef int (*lyext_check_position_clb)(const void *parent, LYEXT_PAR parent_type, LYEXT_SUBSTMT substmt_type);
128 
138 
150 typedef int (*lyext_check_inherit_clb)(struct lys_ext_instance *ext, struct lys_node *node);
151 
161 typedef int (*lyext_valid_data_clb)(struct lys_ext_instance *ext, struct lyd_node *node);
162 
163 struct lyext_plugin {
165  uint16_t flags;
175 };
176 
179  uint16_t flags;
191  size_t instance_size;
195 };
196 
198  const char *module;
199  const char *revision;
204  const char *name;
206 };
207 
211 void lyext_log(const struct ly_ctx *ctx, LY_LOG_LEVEL level, const char *plugin, const char *function, const char *format, ...);
212 
222 #define LYEXT_LOG(ctx, level, plugin, str, args...) \
223  lyext_log(ctx, level, plugin, __func__, str, ##args); \
224 
225 
235 void lys_iffeature_free(struct ly_ctx *ctx, struct lys_iffeature *iffeature, uint8_t iffeature_size, int shallow,
236  void (*private_destructor)(const struct lys_node *node, void *priv));
237 
242 #ifdef __cplusplus
243 }
244 #endif
245 
246 #endif /* LY_EXTENSIONS_H_ */
Common structure representing single YANG data statement describing.
Definition: tree_schema.h:1229
lyext_check_inherit_clb check_inherit
Definition: extensions.h:171
const char * revision
Definition: extensions.h:199
LYEXT_PAR
Extension instance structure parent enumeration.
Definition: extensions.h:32
Compiled if-feature expression structure.
Definition: tree_schema.h:1078
lyext_valid_data_clb valid_data
Definition: extensions.h:174
The main libyang public header.
LYEXT_TYPE type
Definition: extensions.h:164
int(* lyext_valid_data_clb)(struct lys_ext_instance *ext, struct lyd_node *node)
Callback to decide if data is valid towards to schema.
Definition: extensions.h:161
LYEXT_SUBSTMT
List of substatement without extensions storage. If the module contains extension instances in these ...
Definition: extensions.h:67
lyext_check_position_clb check_position
Definition: extensions.h:167
struct lys_ext_instance ** ext
Definition: tree_schema.h:494
struct lyext_plugin * plugin
Definition: extensions.h:205
void lyext_log(const struct ly_ctx *ctx, LY_LOG_LEVEL level, const char *plugin, const char *function, const char *format,...)
Logging function for extension plugins, use LYEXT_LOG macro instead!
struct lyext_substmt * substmt
Definition: extensions.h:189
LY_LOG_LEVEL
Verbosity levels of the libyang logger.
Definition: libyang.h:1880
uint16_t flags
Definition: extensions.h:165
lyext_check_result_clb check_result
Definition: extensions.h:169
const char * module
Definition: extensions.h:198
Description of the extension instance substatement.
Definition: tree_schema.h:443
const char * name
Definition: extensions.h:204
Generic structure for a data node, directly applicable to the data nodes defined as LYS_CONTAINER,...
Definition: tree_data.h:186
LYEXT_TYPE
Extension types.
Definition: tree_schema.h:392
int(* lyext_check_position_clb)(const void *parent, LYEXT_PAR parent_type, LYEXT_SUBSTMT substmt_type)
Callback to check that the extension can be instantiated inside the provided node.
Definition: extensions.h:127
Generic extension instance structure.
Definition: tree_schema.h:472
int(* lyext_check_inherit_clb)(struct lys_ext_instance *ext, struct lys_node *node)
Callback to decide whether the extension will be inherited into the provided schema node....
Definition: extensions.h:150
void lys_iffeature_free(struct ly_ctx *ctx, struct lys_iffeature *iffeature, uint8_t iffeature_size, int shallow, void(*private_destructor)(const struct lys_node *node, void *priv))
Free iffeature structure. In API only for plugins that want to handle if-feature statements similarly...
libyang context handler.
int(* lyext_check_result_clb)(struct lys_ext_instance *ext)
Callback to check that the extension instance is correct - have the valid argument,...
Definition: extensions.h:137