libyang  1.0.253
YANG data modeling language library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
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 #define LYEXT_API_VERSION 1
33 
38 #ifdef STATIC
39 #define LYEXT_VERSION_CHECK
40 #else
41 #define LYEXT_VERSION_CHECK int lyext_api_version = LYEXT_API_VERSION;
42 #endif
43 
47 typedef enum {
67 } LYEXT_PAR;
68 
82 typedef enum {
127 } LYEXT_SUBSTMT;
128 
142 typedef int (*lyext_check_position_clb)(const void *parent, LYEXT_PAR parent_type, LYEXT_SUBSTMT substmt_type);
143 
153 
165 typedef int (*lyext_check_inherit_clb)(struct lys_ext_instance *ext, struct lys_node *node);
166 
176 typedef int (*lyext_valid_data_clb)(struct lys_ext_instance *ext, struct lyd_node *node);
177 
178 struct lyext_plugin {
180  uint16_t flags;
190 };
191 
194  uint16_t flags;
206  size_t instance_size;
210 };
211 
213  const char *module;
214  const char *revision;
219  const char *name;
221 };
222 
226 void lyext_log(const struct ly_ctx *ctx, LY_LOG_LEVEL level, const char *plugin, const char *function, const char *format, ...);
227 
237 #define LYEXT_LOG(ctx, level, plugin, str, args...) \
238  lyext_log(ctx, level, plugin, __func__, str, ##args); \
239 
240 
244 typedef enum {
252 
256 void lyext_vlog(const struct ly_ctx *ctx, LY_VECODE vecode, const char *plugin, const char *function,
257  LYEXT_VLOG_ELEM elem_type, const void *elem, const char *format, ...);
258 
270 #define LYEXT_VLOG(ctx, vecode, plugin, elem_type, elem, str, args...) \
271  lyext_vlog(ctx, vecode, plugin, __func__, elem_type, elem, str, ##args)
272 
283 void lys_iffeature_free(struct ly_ctx *ctx, struct lys_iffeature *iffeature, uint8_t iffeature_size, int shallow,
284  void (*private_destructor)(const struct lys_node *node, void *priv));
285 
290 #ifdef __cplusplus
291 }
292 #endif
293 
294 #endif /* LY_EXTENSIONS_H_ */
Common structure representing single YANG data statement describing.
Definition: tree_schema.h:1231
lyext_check_inherit_clb check_inherit
Definition: extensions.h:186
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:176
int(* lyext_check_result_clb)(struct lys_ext_instance *ext)
Callback to check that the extension instance is correct - have the valid argument, cardinality, etc.
Definition: extensions.h:152
const char * revision
Definition: extensions.h:214
LYEXT_PAR
Extension instance structure parent enumeration.
Definition: extensions.h:47
Compiled if-feature expression structure.
Definition: tree_schema.h:1077
lyext_valid_data_clb valid_data
Definition: extensions.h:189
LYEXT_TYPE type
Definition: extensions.h:179
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:165
LYEXT_SUBSTMT
List of substatement without extensions storage. If the module contains extension instances in these ...
Definition: extensions.h:82
lyext_check_position_clb check_position
Definition: extensions.h:182
struct lys_ext_instance ** ext
Definition: tree_schema.h:493
struct lyext_plugin * plugin
Definition: extensions.h:220
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:204
void lyext_vlog(const struct ly_ctx *ctx, LY_VECODE vecode, const char *plugin, const char *function, LYEXT_VLOG_ELEM elem_type, const void *elem, const char *format,...)
Validation logging function for extension plugins, use LYEXT_VLOG macro instead!
uint16_t flags
Definition: extensions.h:180
lyext_check_result_clb check_result
Definition: extensions.h:184
const char * module
Definition: extensions.h:213
Description of the extension instance substatement.
Definition: tree_schema.h:442
const char * name
Definition: extensions.h:219
Generic structure for a data node, directly applicable to the data nodes defined as LYS_CONTAINER...
Definition: tree_data.h:183
LYEXT_TYPE
Extension types.
Definition: tree_schema.h:384
Generic extension instance structure.
Definition: tree_schema.h:471
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:142
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...
LYEXT_VLOG_ELEM
Type of object concerned by a validation error. This is used to determine how to compute the path of ...
Definition: extensions.h:244