libyang  6.4.26
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 "ly_array.h"
20 #include "parser_data.h"
21 
22 struct ly_ctx;
23 struct ly_in;
24 struct lyd_node;
25 struct lysc_ctx;
26 struct lysc_ext_substmt;
27 struct lysp_ctx;
28 struct lyspr_ctx;
29 struct lyspr_tree_ctx;
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
101 #define LYPLG_EXT_API_VERSION 12
102 
108 #define LY_STMT_OP_MASK (LY_STMT_ACTION | LY_STMT_RPC)
109 
115 #define LY_STMT_DATA_NODE_MASK (LY_STMT_ANYDATA | LY_STMT_ANYXML | LY_STMT_CASE | LY_STMT_CHOICE | LY_STMT_CONTAINER |\
116  LY_STMT_LEAF | LY_STMT_LEAF_LIST | LY_STMT_LIST)
117 
124 #define LY_STMT_NODE_MASK 0xFFFF
125 
132 enum ly_stmt {
134 
135  LY_STMT_NOTIFICATION = 0x0001,
137  LY_STMT_INPUT = 0x0002,
139  LY_STMT_OUTPUT = 0x0004,
141  LY_STMT_ACTION = 0x0008,
143  LY_STMT_RPC = 0x0010,
145  LY_STMT_ANYDATA = 0x0020,
147  LY_STMT_ANYXML = 0x0040,
149  LY_STMT_AUGMENT = 0x0080,
152  LY_STMT_CASE = 0x0100,
154  LY_STMT_CHOICE = 0x0200,
156  LY_STMT_CONTAINER = 0x0400,
158  LY_STMT_GROUPING = 0x0800,
161  LY_STMT_LEAF = 0x1000,
163  LY_STMT_LEAF_LIST = 0x2000,
165  LY_STMT_LIST = 0x4000,
167  LY_STMT_USES = 0x8000,
170  LY_STMT_ARGUMENT = 0x10000,
174  LY_STMT_BASE = 0x20000,
177  LY_STMT_BELONGS_TO = 0x30000,
181  LY_STMT_BIT = 0x40000,
185  LY_STMT_CONFIG = 0x50000,
188  LY_STMT_CONTACT = 0x60000,
192  LY_STMT_DEFAULT = 0x70000,
195  LY_STMT_DESCRIPTION = 0x80000,
198  LY_STMT_DEVIATE = 0x90000,
201  LY_STMT_DEVIATION = 0xA0000,
205  LY_STMT_ENUM = 0xB0000,
209  LY_STMT_ERROR_APP_TAG = 0xC0000,
213  LY_STMT_ERROR_MESSAGE = 0xD0000,
217  LY_STMT_EXTENSION = 0xE0000,
221  LY_STMT_EXTENSION_INSTANCE = 0xF0000,
223  LY_STMT_FEATURE = 0x100000,
226  LY_STMT_FRACTION_DIGITS = 0x110000,
230  LY_STMT_IDENTITY = 0x120000,
234  LY_STMT_IF_FEATURE = 0x130000,
237  LY_STMT_IMPORT = 0x140000,
240  LY_STMT_INCLUDE = 0x150000,
243  LY_STMT_KEY = 0x160000,
247  LY_STMT_LENGTH = 0x170000,
249  LY_STMT_MANDATORY = 0x180000,
252  LY_STMT_MAX_ELEMENTS = 0x190000,
255  LY_STMT_MIN_ELEMENTS = 0x1A0000,
258  LY_STMT_MODIFIER = 0x1B0000,
262  LY_STMT_MODULE = 0x1C0000,
265  LY_STMT_MUST = 0x1D0000,
269  LY_STMT_NAMESPACE = 0x1E0000,
273  LY_STMT_ORDERED_BY = 0x1F0000,
277  LY_STMT_ORGANIZATION = 0x200000,
281  LY_STMT_PATH = 0x210000,
285  LY_STMT_PATTERN = 0x220000,
289  LY_STMT_POSITION = 0x230000,
293  LY_STMT_PREFIX = 0x240000,
296  LY_STMT_PRESENCE = 0x250000,
299  LY_STMT_RANGE = 0x260000,
301  LY_STMT_REFERENCE = 0x270000,
304  LY_STMT_REFINE = 0x280000,
308  LY_STMT_REQUIRE_INSTANCE = 0x290000,
312  LY_STMT_REVISION = 0x2A0000,
315  LY_STMT_REVISION_DATE = 0x2B0000,
317  LY_STMT_STATUS = 0x2C0000,
320  LY_STMT_SUBMODULE = 0x2D0000,
323  LY_STMT_TYPE = 0x2E0000,
325  LY_STMT_TYPEDEF = 0x2F0000,
329  LY_STMT_UNIQUE = 0x300000,
332  LY_STMT_UNITS = 0x310000,
335  LY_STMT_VALUE = 0x320000,
339  LY_STMT_WHEN = 0x330000,
341  LY_STMT_YANG_VERSION = 0x340000,
345  LY_STMT_YIN_ELEMENT = 0x350000,
350  /* separated from the list of statements
351  * the following tokens are part of the syntax and parsers have to work
352  * with them, but they are not a standard YANG statements
353  */
357 
358  /*
359  * YIN-specific tokens, still they are part of the syntax, but not the standard statements
360  */
363 };
364 
368 struct lysp_stmt {
369  const char *stmt;
370  const char *arg;
372  void *prefix_data;
374  struct lysp_stmt *next;
375  struct lysp_stmt *child;
376  uint16_t flags;
377  enum ly_stmt kw;
378 };
379 
384  enum ly_stmt stmt;
385  void **storage_p;
387 };
388 
393  const char *name;
394  const char *argument;
396  void *prefix_data;
397  uintptr_t plugin_ref;
399  void *parent;
401  enum ly_stmt parent_stmt;
404  uint16_t flags;
409  void *parsed;
410  struct lysp_stmt *child;
412 };
413 
418  enum ly_stmt stmt;
419  void **storage_p;
421 };
422 
427  struct lysc_ext *def;
428  const char *argument;
429  struct lys_module *module;
432  void *parent;
434  enum ly_stmt parent_stmt;
440  void *compiled;
441 };
442 
449 #define LYPLG_EXTENSIONS \
450  uint32_t plugins_extensions_apiver__ = LYPLG_EXT_API_VERSION; \
451  const struct lyplg_ext_record plugins_extensions__[]
452 
473 typedef LY_ERR (*lyplg_ext_parse_clb)(struct lysp_ctx *pctx, struct lysp_ext_instance *ext);
474 
485 LIBYANG_API_DECL void lyplg_ext_parse_log(const struct lysp_ctx *pctx, const struct lysp_ext_instance *ext,
486  LY_LOG_LEVEL level, LY_ERR err, const char *format, ...);
487 
494 LIBYANG_API_DECL const struct lysp_module *lyplg_ext_parse_get_cur_pmod(const struct lysp_ctx *pctx);
495 
508 LIBYANG_API_DECL LY_ERR lyplg_ext_parse_extension_instance(struct lysp_ctx *pctx, struct lysp_ext_instance *ext);
509 
527 #define LYS_COMPILE_GROUPING 0x01
532 #define LYS_COMPILE_DISABLED 0x02
535 #define LYS_COMPILE_NO_CONFIG 0x04
536 #define LYS_COMPILE_NO_DISABLED 0x08
537 #define LYS_COMPILE_LOCAL_ONLY 0x10
540 #define LYS_COMPILE_RPC_INPUT (LYS_IS_INPUT | LYS_COMPILE_NO_CONFIG)
541 #define LYS_COMPILE_RPC_OUTPUT (LYS_IS_OUTPUT | LYS_COMPILE_NO_CONFIG)
542 #define LYS_COMPILE_NOTIFICATION (LYS_IS_NOTIF | LYS_COMPILE_NO_CONFIG)
561 typedef LY_ERR (*lyplg_ext_compile_clb)(struct lysc_ctx *cctx, const struct lysp_ext_instance *extp,
562  struct lysc_ext_instance *ext);
563 
573 LIBYANG_API_DECL void lyplg_ext_compile_log(const struct lysc_ctx *cctx, const struct lysc_ext_instance *ext,
574  LY_LOG_LEVEL level, LY_ERR err, const char *format, ...);
575 
585 LIBYANG_API_DECL void lyplg_ext_compile_log_path(const char *path, const struct lysc_ext_instance *ext,
586  LY_LOG_LEVEL level, LY_ERR err, const char *format, ...);
587 
594 LIBYANG_API_DEF void lyplg_ext_compile_log_err(const struct ly_err_item *eitem, const struct lysc_ext_instance *ext);
595 
602 LIBYANG_API_DECL struct ly_ctx *lyplg_ext_compile_get_ctx(const struct lysc_ctx *ctx);
603 
610 LIBYANG_API_DECL uint32_t *lyplg_ext_compile_get_options(const struct lysc_ctx *ctx);
611 
618 LIBYANG_API_DECL const struct lys_module *lyplg_ext_compile_get_cur_mod(const struct lysc_ctx *ctx);
619 
626 LIBYANG_API_DECL struct lysp_module *lyplg_ext_compile_get_pmod(const struct lysc_ctx *ctx);
627 
644 LIBYANG_API_DECL LY_ERR lyplg_ext_compile_extension_instance(struct lysc_ctx *ctx, const struct lysp_ext_instance *extp,
645  struct lysc_ext_instance *ext, struct lysc_node *parent);
646 
658 LIBYANG_API_DECL LY_ERR lyplg_ext_compiled_node_augments(struct lysc_ctx *ctx, struct lysc_ext_instance *ext,
659  struct lysc_node *node);
660 
681 typedef LY_ERR (*lyplg_ext_sprinter_info_clb)(struct lyspr_ctx *ctx, struct lysc_ext_instance *ext, ly_bool *flag);
682 
690 LIBYANG_API_DECL struct ly_out **lyplg_ext_print_get_out(const struct lyspr_ctx *ctx);
691 
698 LIBYANG_API_DECL uint32_t *lyplg_ext_print_get_options(const struct lyspr_ctx *ctx);
699 
706 LIBYANG_API_DECL uint16_t *lyplg_ext_print_get_level(const struct lyspr_ctx *ctx);
707 
718 LIBYANG_API_DECL void lyplg_ext_print_info_extension_instance(struct lyspr_ctx *ctx, const struct lysc_ext_instance *ext,
719  ly_bool *flag);
720 
723 /*
724  * node xpath
725  */
726 
734 typedef void (*lyplg_ext_node_xpath_clb)(struct lysc_ext_instance *ext, const struct lyd_node *cur_node,
735  const struct lyd_node **node);
736 
737 /*
738  * snode xpath
739  */
740 
753 typedef LY_ERR (*lyplg_ext_snode_xpath_clb)(struct lysc_ext_instance *ext, const char *prefix, uint32_t prefix_len,
754  LY_VALUE_FORMAT format, void *prefix_data, const char *name, uint32_t name_len, const struct lysc_node **snode);
755 
756 /*
757  * data snode
758  */
759 
789 typedef LY_ERR (*lyplg_ext_data_snode_clb)(struct lysc_ext_instance *ext, const struct lyd_node *parent,
790  const struct lysc_node *sparent, const char *prefix, uint32_t prefix_len, LY_VALUE_FORMAT format, void *prefix_data,
791  const char *name, uint32_t name_len, const struct lysc_node **snode);
792 
793 /*
794  * data validate
795  */
796 
817 typedef LY_ERR (*lyplg_ext_data_validate_clb)(struct lysc_ext_instance *ext, struct lyd_node *node,
818  const struct lyd_node *dep_tree, enum lyd_type data_type, uint32_t val_opts, struct lyd_node **diff);
819 
820 /*
821  * parse free
822  */
823 
830 typedef void (*lyplg_ext_parse_free_clb)(const struct ly_ctx *ctx, struct lysp_ext_instance *ext);
831 
838 LIBYANG_API_DECL void lyplg_ext_pfree_instance_substatements(const struct ly_ctx *ctx, struct lysp_ext_substmt *substmts);
839 
840 /*
841  * compile free
842  */
843 
850 typedef void (*lyplg_ext_compile_free_clb)(const struct ly_ctx *ctx, struct lysc_ext_instance *ext);
851 
858 LIBYANG_API_DECL void lyplg_ext_cfree_instance_substatements(const struct ly_ctx *ctx, struct lysc_ext_substmt *substmts);
859 
860 /*
861  * compiled size
862  */
863 
867 #define LY_CTXP_MEM_ALIGN 8
868 
874 #define LY_CTXP_MEM_SIZE(SIZE) ((SIZE) + ((~(SIZE) + 1) & (LY_CTXP_MEM_ALIGN - 1)))
875 
886 typedef int (*lyplg_ext_compiled_size_clb)(const struct lysc_ext_instance *ext, struct ly_ht *addr_ht);
887 
896 LIBYANG_API_DECL int lyplg_ext_compiled_stmts_storage_size(const struct lysc_ext_substmt *substmts, struct ly_ht *addr_ht);
897 
898 /*
899  * compiled print
900  */
901 
915 typedef LY_ERR (*lyplg_ext_compiled_print_clb)(const struct lysc_ext_instance *orig_ext, struct lysc_ext_instance *ext,
916  struct ly_ht *addr_ht, struct ly_set *ptr_set, void **mem);
917 
930 LIBYANG_API_DECL LY_ERR lyplg_ext_compiled_stmts_storage_print(const struct lysc_ext_substmt *orig_substmts,
931  struct lysc_ext_substmt *substmts, struct ly_ht *addr_ht, struct ly_set *ptr_set, void **mem);
932 
941 LIBYANG_API_DECL void *lyplg_ext_compiled_print_get_addr(const struct ly_ht *addr_ht, const void *addr);
942 
953 LIBYANG_API_DECL LY_ERR lyplg_ext_compiled_print_add_addr(struct ly_ht *addr_ht, const void *orig_addr,
954  const void *addr);
955 
962 struct lyplg_ext {
963  const char *id;
978 };
979 
981  /* plugin identification */
982  const char *module;
983  const char *revision;
988  const char *name;
990  /* runtime data */
991  struct lyplg_ext plugin;
992 };
993 
1000 LIBYANG_API_DECL const char *lyplg_ext_stmt2str(enum ly_stmt stmt);
1001 
1008 LIBYANG_API_DECL enum ly_stmt lyplg_ext_nodetype2stmt(uint16_t nodetype);
1009 
1021 LIBYANG_API_DECL LY_ERR lyplg_ext_get_storage(const struct lysc_ext_instance *ext, int stmt, uint32_t storage_size,
1022  const void **storage);
1023 
1035 LIBYANG_API_DECL LY_ERR lyplg_ext_parsed_get_storage(const struct lysc_ext_instance *ext, int stmt,
1036  uint32_t storage_size, const void **storage);
1037 
1049 LIBYANG_API_DECL LY_ERR lyplg_ext_get_data(const struct ly_ctx *ctx, const struct lysc_ext_instance *ext,
1050  const struct lyd_node *parent, void **ext_data, ly_bool *ext_data_free);
1051 
1060 LIBYANG_API_DECL LY_ERR lyplg_ext_set_parent_ctx(struct ly_ctx *ctx, const struct ly_ctx *parent_ctx);
1061 
1071  const struct lyd_node *parent, struct ly_set **refs);
1072 
1083  const struct lyd_node *parent, struct ly_ctx **ctx);
1084 
1098  const struct lyd_node *ext_data);
1099 
1112 
1126 
1129 #ifdef __cplusplus
1130 }
1131 #endif
1132 
1133 #endif /* LY_PLUGINS_EXTS_H_ */
#define LYA_COUNT_T
Type (i.e. size) of the sized array's size counter.
Definition: ly_array.h:38
libyang context handler.
lyd_type
Definition: parser_data.h:351
LY_ERR
libyang's error codes returned by the libyang functions.
Definition: log.h:252
Libyang full error structure.
Definition: log.h:298
Parser input structure specifying the type of data input.
LY_LOG_LEVEL
Verbosity levels of the libyang logger.
Definition: log.h:89
Structure to hold a set of (not necessary somehow connected) objects. Usually used for lyd_node,...
Definition: set.h:47
Printer output structure specifying the type of data output.
LIBYANG_API_DECL struct lysp_module * lyplg_ext_compile_get_pmod(const struct lysc_ctx *ctx)
YANG schema compilation context getter for currently processed module.
LIBYANG_API_DEF void lyplg_ext_compile_log_err(const struct ly_err_item *eitem, const struct lysc_ext_instance *ext)
Log a message from an extension plugin using the compiled extension instance and a generated error it...
LIBYANG_API_DECL struct ly_ctx * lyplg_ext_compile_get_ctx(const struct lysc_ctx *ctx)
YANG schema compilation context getter for libyang context.
LIBYANG_API_DECL uint32_t * lyplg_ext_compile_get_options(const struct lysc_ctx *ctx)
YANG schema compilation context getter for compilation options.
LIBYANG_API_DECL LY_ERR lyplg_ext_compile_extension_instance(struct lysc_ctx *ctx, const struct lysp_ext_instance *extp, struct lysc_ext_instance *ext, struct lysc_node *parent)
Compile substatements of an extension instance.
LIBYANG_API_DECL void lyplg_ext_compile_log_path(const char *path, const struct lysc_ext_instance *ext, LY_LOG_LEVEL level, LY_ERR err, const char *format,...)
Log a message from an extension plugin using the compiled extension instance with an explicit error p...
LY_ERR(* lyplg_ext_compile_clb)(struct lysc_ctx *cctx, const struct lysp_ext_instance *extp, struct lysc_ext_instance *ext)
Callback to compile extension from the lysp_ext_instance to the lysc_ext_instance....
Definition: plugins_exts.h:561
LIBYANG_API_DECL void lyplg_ext_compile_log(const struct lysc_ctx *cctx, const struct lysc_ext_instance *ext, LY_LOG_LEVEL level, LY_ERR err, const char *format,...)
Log a message from an extension plugin using the compiled extension instance.
LIBYANG_API_DECL const struct lys_module * lyplg_ext_compile_get_cur_mod(const struct lysc_ctx *ctx)
YANG schema compilation context getter for current module.
LIBYANG_API_DECL LY_ERR lyplg_ext_compiled_node_augments(struct lysc_ctx *ctx, struct lysc_ext_instance *ext, struct lysc_node *node)
Compile augments for a specific node in an extension instance.
const char * argument
Definition: plugins_exts.h:394
uint64_t parent_stmt_index
Definition: plugins_exts.h:435
enum ly_stmt stmt
Definition: plugins_exts.h:384
lyplg_ext_snode_xpath_clb snode_xpath
Definition: plugins_exts.h:969
const char * name
Definition: plugins_exts.h:393
struct lysp_ext_instance * exts
Definition: plugins_exts.h:411
lyplg_ext_data_snode_clb snode
Definition: plugins_exts.h:970
const char * arg
Definition: plugins_exts.h:370
LY_VALUE_FORMAT format
Definition: plugins_exts.h:395
const char * argument
Definition: plugins_exts.h:428
struct lysp_stmt * child
Definition: plugins_exts.h:375
uint16_t flags
Definition: plugins_exts.h:376
const char * id
Definition: plugins_exts.h:963
struct lysp_ext_substmt * substmts
Definition: plugins_exts.h:407
lyplg_ext_sprinter_info_clb printer_info
Definition: plugins_exts.h:967
lyplg_ext_compiled_print_clb compiled_print
Definition: plugins_exts.h:976
enum ly_stmt parent_stmt
Definition: plugins_exts.h:401
const char * revision
Definition: plugins_exts.h:983
const char * module
Definition: plugins_exts.h:982
LY_VALUE_FORMAT format
Definition: plugins_exts.h:371
lyplg_ext_compile_free_clb cfree
Definition: plugins_exts.h:974
struct lysc_ext_substmt * substmts
Definition: plugins_exts.h:438
struct lysp_stmt * child
Definition: plugins_exts.h:410
lyplg_ext_compiled_size_clb compiled_size
Definition: plugins_exts.h:975
enum ly_stmt kw
Definition: plugins_exts.h:377
uintptr_t plugin_ref
Definition: plugins_exts.h:397
struct lyplg_ext plugin
Definition: plugins_exts.h:991
lyplg_ext_node_xpath_clb node_xpath
Definition: plugins_exts.h:968
lyplg_ext_parse_clb parse
Definition: plugins_exts.h:965
lyplg_ext_data_validate_clb validate
Definition: plugins_exts.h:971
struct lysc_ext * def
Definition: plugins_exts.h:427
uint64_t parent_stmt_index
Definition: plugins_exts.h:402
struct lysc_ext_instance * exts
Definition: plugins_exts.h:430
const char * stmt
Definition: plugins_exts.h:369
lyplg_ext_parse_free_clb pfree
Definition: plugins_exts.h:973
enum ly_stmt stmt
Definition: plugins_exts.h:418
struct lysp_stmt * next
Definition: plugins_exts.h:374
struct lys_module * module
Definition: plugins_exts.h:429
enum ly_stmt parent_stmt
Definition: plugins_exts.h:434
lyplg_ext_compile_clb compile
Definition: plugins_exts.h:966
void * prefix_data
Definition: plugins_exts.h:372
const char * name
Definition: plugins_exts.h:988
LIBYANG_API_DECL LY_ERR lyplg_ext_compiled_stmts_storage_print(const struct lysc_ext_substmt *orig_substmts, struct lysc_ext_substmt *substmts, struct ly_ht *addr_ht, struct ly_set *ptr_set, void **mem)
Print the substatements array storage and assign it to the serialized extension instance substatement...
int(* lyplg_ext_compiled_size_clb)(const struct lysc_ext_instance *ext, struct ly_ht *addr_ht)
Callback to return the size of the custom compiled structure and substmts array. If there are none,...
Definition: plugins_exts.h:886
LIBYANG_API_DECL LY_ERR lyplg_ext_get_storage(const struct lysc_ext_instance *ext, int stmt, uint32_t storage_size, const void **storage)
Get compiled ext instance storage for a specific statement.
void(* lyplg_ext_node_xpath_clb)(struct lysc_ext_instance *ext, const struct lyd_node *cur_node, const struct lyd_node **node)
Callback for getting the first child data node of an XPath document root of the extension instance.
Definition: plugins_exts.h:734
LIBYANG_API_DECL LY_ERR lyplg_ext_parsed_get_storage(const struct lysc_ext_instance *ext, int stmt, uint32_t storage_size, const void **storage)
Get parsed ext instance storage for a specific statement.
LIBYANG_API_DECL LY_ERR lyplg_ext_get_data(const struct ly_ctx *ctx, const struct lysc_ext_instance *ext, const struct lyd_node *parent, 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().
LIBYANG_API_DECL const char * lyplg_ext_stmt2str(enum ly_stmt stmt)
Stringify statement identifier.
LIBYANG_API_DECL LY_ERR lyplg_ext_compiled_print_add_addr(struct ly_ht *addr_ht, const void *orig_addr, const void *addr)
Add a printed address of a shared structure to be reused by later prints.
LIBYANG_API_DECL int lyplg_ext_compiled_stmts_storage_size(const struct lysc_ext_substmt *substmts, struct ly_ht *addr_ht)
Get the size of the compiled substatements storage.
LY_ERR(* lyplg_ext_compiled_print_clb)(const struct lysc_ext_instance *orig_ext, struct lysc_ext_instance *ext, struct ly_ht *addr_ht, struct ly_set *ptr_set, void **mem)
Callback to print (serialize) the custom compiled structure and substmts array storage.
Definition: plugins_exts.h:915
LY_ERR(* lyplg_ext_data_validate_clb)(struct lysc_ext_instance *ext, struct lyd_node *node, 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:817
LIBYANG_API_DECL LY_ERR lyplg_ext_schema_mount_get_parent_ref(const struct lysc_ext_instance *ext, const struct lyd_node *parent, struct ly_set **refs)
Expand parent-reference xpath expressions.
LIBYANG_API_DECL LY_ERR lyplg_ext_schema_mount_create_shared_context(struct lysc_ext_instance *ext, const struct lyd_node *ext_data)
Create a shared schema mount context for a schema mount point.
void(* lyplg_ext_compile_free_clb)(const struct ly_ctx *ctx, struct lysc_ext_instance *ext)
Callback to free the extension-specific data created by its compilation.
Definition: plugins_exts.h:850
LIBYANG_API_DECL void * lyplg_ext_compiled_print_get_addr(const struct ly_ht *addr_ht, const void *addr)
Get the printed address of a shared structure, in case it has already been printed.
ly_stmt
List of YANG statements.
Definition: plugins_exts.h:132
LIBYANG_API_DECL void lyplg_ext_schema_mount_destroy_shared_contexts(struct lysc_ext_instance *ext)
Destroy all the shared schema mount contexts for a given libyang context.
LIBYANG_API_DECL enum ly_stmt lyplg_ext_nodetype2stmt(uint16_t nodetype)
Convert nodetype to statement identifier.
LIBYANG_API_DECL LY_ERR lyplg_ext_set_parent_ctx(struct ly_ctx *ctx, const struct ly_ctx *parent_ctx)
Set parent context of a context. Errors and callbacks of the parent context will then always be used.
LIBYANG_API_DECL LY_ERR lyplg_ext_schema_mount_create_context(const struct lysc_ext_instance *ext, const struct lyd_node *parent, struct ly_ctx **ctx)
Allocate a new context for a particular instance of the yangmnt:mount-point extension....
LIBYANG_API_DECL void lyplg_ext_cfree_instance_substatements(const struct ly_ctx *ctx, struct lysc_ext_substmt *substmts)
Free the extension instance's data compiled with lyplg_ext_compile_extension_instance().
void(* lyplg_ext_parse_free_clb)(const struct ly_ctx *ctx, struct lysp_ext_instance *ext)
Callback to free the extension-specific data created by its parsing.
Definition: plugins_exts.h:830
LY_ERR(* lyplg_ext_snode_xpath_clb)(struct lysc_ext_instance *ext, const char *prefix, uint32_t prefix_len, LY_VALUE_FORMAT format, void *prefix_data, const char *name, uint32_t name_len, const struct lysc_node **snode)
Callback for getting the first child schema node of an XPath document root of the extension instance.
Definition: plugins_exts.h:753
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, uint32_t prefix_len, LY_VALUE_FORMAT format, void *prefix_data, const char *name, uint32_t name_len, const struct lysc_node **snode)
Callback for getting a schema node for new YANG instance data described by an extension instance.
Definition: plugins_exts.h:789
LIBYANG_API_DECL void lyplg_ext_pfree_instance_substatements(const struct ly_ctx *ctx, struct lysp_ext_substmt *substmts)
Free the extension instance's data parsed with lyplg_ext_parse_extension_instance().
LIBYANG_API_DECL void lyplg_ext_schema_mount_destroy_inline_contexts(struct lysc_ext_instance *ext)
Destroy all the inline contexts for a given libyang context.
@ LY_STMT_REVISION
Definition: plugins_exts.h:312
@ LY_STMT_MUST
Definition: plugins_exts.h:265
@ LY_STMT_ARGUMENT
Definition: plugins_exts.h:170
@ LY_STMT_ENUM
Definition: plugins_exts.h:205
@ LY_STMT_LEAF
Definition: plugins_exts.h:161
@ LY_STMT_ERROR_APP_TAG
Definition: plugins_exts.h:209
@ LY_STMT_MAX_ELEMENTS
Definition: plugins_exts.h:252
@ LY_STMT_REFERENCE
Definition: plugins_exts.h:301
@ LY_STMT_REVISION_DATE
Definition: plugins_exts.h:315
@ LY_STMT_SYNTAX_LEFT_BRACE
Definition: plugins_exts.h:355
@ LY_STMT_UNIQUE
Definition: plugins_exts.h:329
@ LY_STMT_REQUIRE_INSTANCE
Definition: plugins_exts.h:308
@ LY_STMT_DEVIATION
Definition: plugins_exts.h:201
@ LY_STMT_IMPORT
Definition: plugins_exts.h:237
@ LY_STMT_CONTACT
Definition: plugins_exts.h:188
@ LY_STMT_LENGTH
Definition: plugins_exts.h:247
@ LY_STMT_IF_FEATURE
Definition: plugins_exts.h:234
@ LY_STMT_SYNTAX_RIGHT_BRACE
Definition: plugins_exts.h:356
@ LY_STMT_ANYDATA
Definition: plugins_exts.h:145
@ LY_STMT_CONTAINER
Definition: plugins_exts.h:156
@ LY_STMT_PATTERN
Definition: plugins_exts.h:285
@ LY_STMT_POSITION
Definition: plugins_exts.h:289
@ LY_STMT_PREFIX
Definition: plugins_exts.h:293
@ LY_STMT_WHEN
Definition: plugins_exts.h:339
@ LY_STMT_BELONGS_TO
Definition: plugins_exts.h:177
@ LY_STMT_ORGANIZATION
Definition: plugins_exts.h:277
@ LY_STMT_AUGMENT
Definition: plugins_exts.h:149
@ LY_STMT_SUBMODULE
Definition: plugins_exts.h:320
@ LY_STMT_ANYXML
Definition: plugins_exts.h:147
@ LY_STMT_MIN_ELEMENTS
Definition: plugins_exts.h:255
@ LY_STMT_SYNTAX_SEMICOLON
Definition: plugins_exts.h:354
@ LY_STMT_NAMESPACE
Definition: plugins_exts.h:269
@ LY_STMT_YANG_VERSION
Definition: plugins_exts.h:341
@ LY_STMT_MANDATORY
Definition: plugins_exts.h:249
@ LY_STMT_PATH
Definition: plugins_exts.h:281
@ LY_STMT_EXTENSION
Definition: plugins_exts.h:217
@ LY_STMT_CASE
Definition: plugins_exts.h:152
@ LY_STMT_MODULE
Definition: plugins_exts.h:262
@ LY_STMT_ERROR_MESSAGE
Definition: plugins_exts.h:213
@ LY_STMT_OUTPUT
Definition: plugins_exts.h:139
@ LY_STMT_REFINE
Definition: plugins_exts.h:304
@ LY_STMT_IDENTITY
Definition: plugins_exts.h:230
@ LY_STMT_TYPEDEF
Definition: plugins_exts.h:325
@ LY_STMT_NONE
Definition: plugins_exts.h:133
@ LY_STMT_ARG_VALUE
Definition: plugins_exts.h:362
@ LY_STMT_DESCRIPTION
Definition: plugins_exts.h:195
@ LY_STMT_ARG_TEXT
Definition: plugins_exts.h:361
@ LY_STMT_CONFIG
Definition: plugins_exts.h:185
@ LY_STMT_RANGE
Definition: plugins_exts.h:299
@ LY_STMT_ORDERED_BY
Definition: plugins_exts.h:273
@ LY_STMT_INCLUDE
Definition: plugins_exts.h:240
@ LY_STMT_YIN_ELEMENT
Definition: plugins_exts.h:345
@ LY_STMT_EXTENSION_INSTANCE
Definition: plugins_exts.h:221
@ LY_STMT_BIT
Definition: plugins_exts.h:181
@ LY_STMT_FRACTION_DIGITS
Definition: plugins_exts.h:226
@ LY_STMT_ACTION
Definition: plugins_exts.h:141
@ LY_STMT_MODIFIER
Definition: plugins_exts.h:258
@ LY_STMT_TYPE
Definition: plugins_exts.h:323
@ LY_STMT_BASE
Definition: plugins_exts.h:174
@ LY_STMT_LEAF_LIST
Definition: plugins_exts.h:163
@ LY_STMT_FEATURE
Definition: plugins_exts.h:223
@ LY_STMT_RPC
Definition: plugins_exts.h:143
@ LY_STMT_DEVIATE
Definition: plugins_exts.h:198
@ LY_STMT_UNITS
Definition: plugins_exts.h:332
@ LY_STMT_GROUPING
Definition: plugins_exts.h:158
@ LY_STMT_KEY
Definition: plugins_exts.h:243
@ LY_STMT_NOTIFICATION
Definition: plugins_exts.h:135
@ LY_STMT_CHOICE
Definition: plugins_exts.h:154
@ LY_STMT_VALUE
Definition: plugins_exts.h:335
@ LY_STMT_USES
Definition: plugins_exts.h:167
@ LY_STMT_PRESENCE
Definition: plugins_exts.h:296
@ LY_STMT_STATUS
Definition: plugins_exts.h:317
@ LY_STMT_INPUT
Definition: plugins_exts.h:137
@ LY_STMT_LIST
Definition: plugins_exts.h:165
@ LY_STMT_DEFAULT
Definition: plugins_exts.h:192
Extension plugin implementing various aspects of a YANG extension.
Definition: plugins_exts.h:962
YANG extension compiled instance.
Definition: plugins_exts.h:426
Structure representing a compiled known YANG substatement in an extension instance.
Definition: plugins_exts.h:417
YANG extension parsed instance.
Definition: plugins_exts.h:392
Structure representing a parsed known YANG substatement in an extension instance.
Definition: plugins_exts.h:383
Structure representing a generic parsed YANG substatement in an extension instance.
Definition: plugins_exts.h:368
LIBYANG_API_DECL LY_ERR lyplg_ext_parse_extension_instance(struct lysp_ctx *pctx, struct lysp_ext_instance *ext)
Parse substatements of an extension instance.
LY_ERR(* lyplg_ext_parse_clb)(struct lysp_ctx *pctx, struct lysp_ext_instance *ext)
Callback for parsing extension instance substatements.
Definition: plugins_exts.h:473
LIBYANG_API_DECL void lyplg_ext_parse_log(const struct lysp_ctx *pctx, const struct lysp_ext_instance *ext, LY_LOG_LEVEL level, LY_ERR err, const char *format,...)
Log a message from an extension plugin using the parsed extension instance.
LIBYANG_API_DECL const struct lysp_module * lyplg_ext_parse_get_cur_pmod(const struct lysp_ctx *pctx)
Get current parsed module from a parse context.
LIBYANG_API_DECL uint16_t * lyplg_ext_print_get_level(const struct lyspr_ctx *ctx)
YANG printer context getter for printer indentation level.
LY_ERR(* lyplg_ext_sprinter_info_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:681
LIBYANG_API_DECL struct ly_out ** lyplg_ext_print_get_out(const struct lyspr_ctx *ctx)
YANG printer context getter for output handler.
LIBYANG_API_DECL uint32_t * lyplg_ext_print_get_options(const struct lyspr_ctx *ctx)
YANG printer context getter for printer options.
LIBYANG_API_DECL void lyplg_ext_print_info_extension_instance(struct lyspr_ctx *ctx, const struct lysc_ext_instance *ext, ly_bool *flag)
Print substatements of an extension instance in info format (compiled YANG).
const char * name
Definition: tree_schema.h:1423
struct ly_ctx * ctx
Definition: tree_schema.h:2243
Available YANG schema tree structures representing YANG module.
Definition: tree_schema.h:2242
Compiled YANG extension-stmt.
Definition: tree_schema.h:1177
Compiled YANG data node.
Definition: tree_schema.h:1412
Printable YANG schema tree structure representing YANG module.
Definition: tree_schema.h:1094
uint8_t ly_bool
Type to indicate boolean value.
Definition: log.h:29
libyang sized array API.
libyang hash table.
Data parsers for libyang.
struct lyd_node * parent
Definition: tree_data.h:882
Generic structure for a data node.
Definition: tree_data.h:875
LY_VALUE_FORMAT
All kinds of supported value formats and prefix mappings to modules.
Definition: utils.h:93