Loading...
Searching...
No Matches
plugins_exts.h
Go to the documentation of this file.
#ifndef LY_PLUGINS_EXTS_H_
#define LY_PLUGINS_EXTS_H_
#include "log.h"
#include "parser_data.h"
#include "plugins.h"
#include "tree_data.h"
#include "tree_edit.h"
#include "tree_schema.h"
struct ly_ctx;
struct ly_in;
struct lyd_node;
struct lysc_ctx;
struct lysc_ext_substmt;
struct lysp_ctx;
struct lyspr_ctx;
struct lyspr_tree_ctx;
#ifdef __cplusplus
extern "C" {
#endif
#define LYPLG_EXT_API_VERSION 8
#define LY_STMT_OP_MASK (LY_STMT_ACTION | LY_STMT_RPC)
#define LY_STMT_DATA_NODE_MASK (LY_STMT_ANYDATA | LY_STMT_ANYXML | LY_STMT_CASE | LY_STMT_CHOICE | LY_STMT_CONTAINER |\
LY_STMT_LEAF | LY_STMT_LEAF_LIST | LY_STMT_LIST)
#define LY_STMT_NODE_MASK 0xFFFF
enum ly_stmt {
LY_STMT_NONE = 0,
LY_STMT_NOTIFICATION = 0x0001,
LY_STMT_INPUT = 0x0002,
LY_STMT_OUTPUT = 0x0004,
LY_STMT_ACTION = 0x0008,
LY_STMT_RPC = 0x0010,
LY_STMT_ANYDATA = 0x0020,
LY_STMT_ANYXML = 0x0040,
LY_STMT_AUGMENT = 0x0080,
LY_STMT_CASE = 0x0100,
LY_STMT_CHOICE = 0x0200,
LY_STMT_CONTAINER = 0x0400,
LY_STMT_GROUPING = 0x0800,
LY_STMT_LEAF = 0x1000,
LY_STMT_LEAF_LIST = 0x2000,
LY_STMT_LIST = 0x4000,
LY_STMT_USES = 0x8000,
LY_STMT_ARGUMENT = 0x10000,
LY_STMT_BASE = 0x20000,
LY_STMT_BELONGS_TO = 0x30000,
LY_STMT_BIT = 0x40000,
LY_STMT_CONFIG = 0x50000,
LY_STMT_CONTACT = 0x60000,
LY_STMT_DEFAULT = 0x70000,
LY_STMT_DESCRIPTION = 0x80000,
LY_STMT_DEVIATE = 0x90000,
LY_STMT_DEVIATION = 0xA0000,
LY_STMT_ENUM = 0xB0000,
LY_STMT_ERROR_APP_TAG = 0xC0000,
LY_STMT_ERROR_MESSAGE = 0xD0000,
LY_STMT_EXTENSION = 0xE0000,
LY_STMT_EXTENSION_INSTANCE = 0xF0000,
LY_STMT_FEATURE = 0x100000,
LY_STMT_FRACTION_DIGITS = 0x110000,
LY_STMT_IDENTITY = 0x120000,
LY_STMT_IF_FEATURE = 0x130000,
LY_STMT_IMPORT = 0x140000,
LY_STMT_INCLUDE = 0x150000,
LY_STMT_KEY = 0x160000,
LY_STMT_LENGTH = 0x170000,
LY_STMT_MANDATORY = 0x180000,
LY_STMT_MAX_ELEMENTS = 0x190000,
LY_STMT_MIN_ELEMENTS = 0x1A0000,
LY_STMT_MODIFIER = 0x1B0000,
LY_STMT_MODULE = 0x1C0000,
LY_STMT_MUST = 0x1D0000,
LY_STMT_NAMESPACE = 0x1E0000,
LY_STMT_ORDERED_BY = 0x1F0000,
LY_STMT_ORGANIZATION = 0x200000,
LY_STMT_PATH = 0x210000,
LY_STMT_PATTERN = 0x220000,
LY_STMT_POSITION = 0x230000,
LY_STMT_PREFIX = 0x240000,
LY_STMT_PRESENCE = 0x250000,
LY_STMT_RANGE = 0x260000,
LY_STMT_REFERENCE = 0x270000,
LY_STMT_REFINE = 0x280000,
LY_STMT_REQUIRE_INSTANCE = 0x290000,
LY_STMT_REVISION = 0x2A0000,
LY_STMT_REVISION_DATE = 0x2B0000,
LY_STMT_STATUS = 0x2C0000,
LY_STMT_SUBMODULE = 0x2D0000,
LY_STMT_TYPE = 0x2E0000,
LY_STMT_TYPEDEF = 0x2F0000,
LY_STMT_UNIQUE = 0x300000,
LY_STMT_UNITS = 0x310000,
LY_STMT_VALUE = 0x320000,
LY_STMT_WHEN = 0x330000,
LY_STMT_YANG_VERSION = 0x340000,
LY_STMT_YIN_ELEMENT = 0x350000,
/* separated from the list of statements
* the following tokens are part of the syntax and parsers have to work
* with them, but they are not a standard YANG statements
*/
LY_STMT_SYNTAX_SEMICOLON,
LY_STMT_SYNTAX_LEFT_BRACE,
LY_STMT_SYNTAX_RIGHT_BRACE,
/*
* YIN-specific tokens, still they are part of the syntax, but not the standard statements
*/
LY_STMT_ARG_TEXT,
LY_STMT_ARG_VALUE
};
struct lysp_stmt {
const char *stmt;
const char *arg;
LY_VALUE_FORMAT format;
void *prefix_data;
struct lysp_stmt *next;
struct lysp_stmt *child;
uint16_t flags;
enum ly_stmt kw;
};
struct lysp_ext_substmt {
enum ly_stmt stmt;
void **storage_p;
};
struct lysp_ext_instance {
const char *name;
const char *argument;
LY_VALUE_FORMAT format;
void *prefix_data;
struct lysp_ext *def;
void *parent;
enum ly_stmt parent_stmt;
LY_ARRAY_COUNT_TYPE parent_stmt_index;
uint16_t flags;
const struct lyplg_ext_record *record;
struct lysp_ext_substmt *substmts;
void *parsed;
struct lysp_stmt *child;
struct lysp_ext_instance *exts;
};
struct lysc_ext_substmt {
enum ly_stmt stmt;
void **storage_p;
};
struct lysc_ext_instance {
struct lysc_ext *def;
const char *argument;
struct lys_module *module;
struct lysc_ext_instance *exts;
void *parent;
enum ly_stmt parent_stmt;
LY_ARRAY_COUNT_TYPE parent_stmt_index;
struct lysc_ext_substmt *substmts;
void *compiled;
};
#define LYPLG_EXTENSIONS \
uint32_t plugins_extensions_apiver__ = LYPLG_EXT_API_VERSION; \
const struct lyplg_ext_record plugins_extensions__[]
typedef LY_ERR (*lyplg_ext_parse_clb)(struct lysp_ctx *pctx, struct lysp_ext_instance *ext);
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, ...);
LIBYANG_API_DECL const struct lysp_module *lyplg_ext_parse_get_cur_pmod(const struct lysp_ctx *pctx);
LIBYANG_API_DECL LY_ERR lyplg_ext_parse_extension_instance(struct lysp_ctx *pctx, struct lysp_ext_instance *ext);
#define LYS_COMPILE_GROUPING 0x01
#define LYS_COMPILE_DISABLED 0x02
#define LYS_COMPILE_NO_CONFIG 0x04
#define LYS_COMPILE_NO_DISABLED 0x08
#define LYS_COMPILE_RPC_INPUT (LYS_IS_INPUT | LYS_COMPILE_NO_CONFIG)
#define LYS_COMPILE_RPC_OUTPUT (LYS_IS_OUTPUT | LYS_COMPILE_NO_CONFIG)
#define LYS_COMPILE_NOTIFICATION (LYS_IS_NOTIF | LYS_COMPILE_NO_CONFIG)
typedef LY_ERR (*lyplg_ext_compile_clb)(struct lysc_ctx *cctx, const struct lysp_ext_instance *extp,
struct lysc_ext_instance *ext);
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, ...);
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, ...);
LIBYANG_API_DEF void lyplg_ext_compile_log_err(const struct ly_err_item *eitem, const struct lysc_ext_instance *ext);
LIBYANG_API_DECL struct ly_ctx *lyplg_ext_compile_get_ctx(const struct lysc_ctx *ctx);
LIBYANG_API_DECL uint32_t *lyplg_ext_compile_get_options(const struct lysc_ctx *ctx);
LIBYANG_API_DECL const struct lys_module *lyplg_ext_compile_get_cur_mod(const struct lysc_ctx *ctx);
LIBYANG_API_DECL struct lysp_module *lyplg_ext_compile_get_pmod(const struct lysc_ctx *ctx);
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);
typedef LY_ERR (*lyplg_ext_sprinter_info_clb)(struct lyspr_ctx *ctx, struct lysc_ext_instance *ext, ly_bool *flag);
LIBYANG_API_DECL struct ly_out **lyplg_ext_print_get_out(const struct lyspr_ctx *ctx);
LIBYANG_API_DECL uint32_t *lyplg_ext_print_get_options(const struct lyspr_ctx *ctx);
LIBYANG_API_DECL uint16_t *lyplg_ext_print_get_level(const struct lyspr_ctx *ctx);
LIBYANG_API_DECL void lyplg_ext_print_info_extension_instance(struct lyspr_ctx *ctx, const struct lysc_ext_instance *ext,
ly_bool *flag);
typedef LY_ERR (*lyplg_ext_sprinter_ctree_clb)(struct lysc_ext_instance *ext, const struct lyspr_tree_ctx *ctx,
const char **flags, const char **add_opts);
typedef LY_ERR (*lyplg_ext_sprinter_ctree_override_clb)(const struct lysc_node *node, const void *plugin_priv,
ly_bool *skip, const char **flags, const char **add_opts);
LIBYANG_API_DECL LY_ERR lyplg_ext_sprinter_ctree_add_ext_nodes(const struct lyspr_tree_ctx *ctx,
struct lysc_ext_instance *ext, lyplg_ext_sprinter_ctree_override_clb clb);
LIBYANG_API_DECL LY_ERR lyplg_ext_sprinter_ctree_add_nodes(const struct lyspr_tree_ctx *ctx, struct lysc_node *nodes,
lyplg_ext_sprinter_ctree_override_clb clb);
LIBYANG_API_DECL LY_ERR lyplg_ext_sprinter_tree_set_priv(const struct lyspr_tree_ctx *ctx, void *plugin_priv,
void (*free_clb)(void *plugin_priv));
typedef LY_ERR (*lyplg_ext_sprinter_ptree_clb)(struct lysp_ext_instance *ext, const struct lyspr_tree_ctx *ctx,
const char **flags, const char **add_opts);
typedef LY_ERR (*lyplg_ext_sprinter_ptree_override_clb)(const struct lysp_node *node, const void *plugin_priv,
ly_bool *skip, const char **flags, const char **add_opts);
LIBYANG_API_DECL LY_ERR lyplg_ext_sprinter_ptree_add_ext_nodes(const struct lyspr_tree_ctx *ctx,
struct lysp_ext_instance *ext, lyplg_ext_sprinter_ptree_override_clb clb);
LIBYANG_API_DECL LY_ERR lyplg_ext_sprinter_ptree_add_nodes(const struct lyspr_tree_ctx *ctx, struct lysp_node *nodes,
lyplg_ext_sprinter_ptree_override_clb clb);
/*
* data node
*/
typedef LY_ERR (*lyplg_ext_data_node_clb)(struct lysc_ext_instance *ext, struct lyd_node *node, uint32_t validate_options);
/*
* snode
*/
typedef 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);
/*
* validate
*/
typedef 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);
/*
* parse free
*/
typedef void (*lyplg_ext_parse_free_clb)(const struct ly_ctx *ctx, struct lysp_ext_instance *ext);
LIBYANG_API_DECL void lyplg_ext_pfree_instance_substatements(const struct ly_ctx *ctx, struct lysp_ext_substmt *substmts);
/*
* compile free
*/
typedef void (*lyplg_ext_compile_free_clb)(const struct ly_ctx *ctx, struct lysc_ext_instance *ext);
LIBYANG_API_DECL void lyplg_ext_cfree_instance_substatements(const struct ly_ctx *ctx, struct lysc_ext_substmt *substmts);
struct lyplg_ext {
const char *id;
lyplg_ext_parse_clb parse;
lyplg_ext_compile_clb compile;
lyplg_ext_sprinter_info_clb printer_info;
lyplg_ext_sprinter_ctree_clb printer_ctree;
lyplg_ext_sprinter_ptree_clb printer_ptree;
lyplg_ext_data_node_clb node;
lyplg_ext_data_snode_clb snode;
lyplg_ext_data_validate_clb validate;
lyplg_ext_parse_free_clb pfree;
lyplg_ext_compile_free_clb cfree;
};
struct lyplg_ext_record {
/* plugin identification */
const char *module;
const char *revision;
const char *name;
/* runtime data */
struct lyplg_ext plugin;
};
LIBYANG_API_DECL const char *lyplg_ext_stmt2str(enum ly_stmt stmt);
LIBYANG_API_DECL enum ly_stmt lyplg_ext_nodetype2stmt(uint16_t nodetype);
LIBYANG_API_DECL LY_ERR lyplg_ext_get_storage(const struct lysc_ext_instance *ext, int stmt, uint32_t storage_size,
const void **storage);
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);
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);
LIBYANG_API_DECL LY_ERR lyplg_ext_insert(struct lyd_node *parent, struct lyd_node *first);
LIBYANG_API_DECL LY_ERR lyplg_ext_schema_mount_get_parent_ref(const struct lysc_ext_instance *ext, struct ly_set **refs);
LIBYANG_API_DECL LY_ERR lyplg_ext_schema_mount_create_context(const struct lysc_ext_instance *ext, struct ly_ctx **ctx);
#ifdef __cplusplus
}
#endif
#endif /* LY_PLUGINS_EXTS_H_ */
ly_ctx
libyang context handler.
lyd_type
lyd_type
Definition parser_data.h:335
LY_ERR
LY_ERR
libyang's error codes returned by the libyang functions.
Definition log.h:237
ly_err_item
Libyang full error structure.
Definition log.h:282
ly_in
Parser input structure specifying the type of data input.
LY_LOG_LEVEL
LY_LOG_LEVEL
Verbosity levels of the libyang logger.
Definition log.h:88
ly_set
Structure to hold a set of (not necessary somehow connected) objects. Usually used for lyd_node,...
Definition set.h:47
ly_out
Printer output structure specifying the type of data output.
lyplg_ext_compile_log_err
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...
lyplg_ext_compile_extension_instance
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)
Compile substatements of an extension instance.
lyplg_ext_compile_get_pmod
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.
lyplg_ext_compile_get_ctx
LIBYANG_API_DECL struct ly_ctx * lyplg_ext_compile_get_ctx(const struct lysc_ctx *ctx)
YANG schema compilation context getter for libyang context.
lyplg_ext_compile_get_cur_mod
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.
lyplg_ext_compile_get_options
LIBYANG_API_DECL uint32_t * lyplg_ext_compile_get_options(const struct lysc_ctx *ctx)
YANG schema compilation context getter for compilation options.
lyplg_ext_compile_log_path
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...
lyplg_ext_compile_clb
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:570
lyplg_ext_compile_log
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.
lysp_ext_instance::argument
const char * argument
Definition plugins_exts.h:405
lysc_ext_instance::parent_stmt_index
uint64_t parent_stmt_index
Definition plugins_exts.h:446
lyplg_ext::node
lyplg_ext_data_node_clb node
Definition plugins_exts.h:943
lysp_ext_substmt::stmt
enum ly_stmt stmt
Definition plugins_exts.h:395
lysp_ext_instance::record
const struct lyplg_ext_record * record
Definition plugins_exts.h:417
lysp_ext_instance::name
const char * name
Definition plugins_exts.h:404
lysp_ext_instance::parsed
void * parsed
Definition plugins_exts.h:420
lysp_ext_instance::exts
struct lysp_ext_instance * exts
Definition plugins_exts.h:422
lyplg_ext::snode
lyplg_ext_data_snode_clb snode
Definition plugins_exts.h:945
lysp_ext_instance::prefix_data
void * prefix_data
Definition plugins_exts.h:407
lysp_stmt::arg
const char * arg
Definition plugins_exts.h:381
lysp_ext_instance::format
LY_VALUE_FORMAT format
Definition plugins_exts.h:406
lysc_ext_instance::argument
const char * argument
Definition plugins_exts.h:439
lysp_stmt::child
struct lysp_stmt * child
Definition plugins_exts.h:386
lysp_stmt::flags
uint16_t flags
Definition plugins_exts.h:387
lyplg_ext::id
const char * id
Definition plugins_exts.h:933
lysp_ext_instance::substmts
struct lysp_ext_substmt * substmts
Definition plugins_exts.h:418
lysc_ext_instance::compiled
void * compiled
Definition plugins_exts.h:451
lysp_ext_substmt::storage_p
void ** storage_p
Definition plugins_exts.h:396
lyplg_ext::printer_info
lyplg_ext_sprinter_info_clb printer_info
Definition plugins_exts.h:937
lysp_ext_instance::flags
uint16_t flags
Definition plugins_exts.h:415
lysp_ext_instance::parent_stmt
enum ly_stmt parent_stmt
Definition plugins_exts.h:412
lyplg_ext_record::revision
const char * revision
Definition plugins_exts.h:956
lyplg_ext_record::module
const char * module
Definition plugins_exts.h:955
lysp_stmt::format
LY_VALUE_FORMAT format
Definition plugins_exts.h:382
lysc_ext_substmt::storage_p
void ** storage_p
Definition plugins_exts.h:430
lyplg_ext::cfree
lyplg_ext_compile_free_clb cfree
Definition plugins_exts.h:950
lysc_ext_instance::substmts
struct lysc_ext_substmt * substmts
Definition plugins_exts.h:449
lysp_ext_instance::child
struct lysp_stmt * child
Definition plugins_exts.h:421
lysp_stmt::kw
enum ly_stmt kw
Definition plugins_exts.h:388
lysp_ext_instance::parent
void * parent
Definition plugins_exts.h:410
lyplg_ext_record::plugin
struct lyplg_ext plugin
Definition plugins_exts.h:964
lyplg_ext::parse
lyplg_ext_parse_clb parse
Definition plugins_exts.h:935
lyplg_ext::printer_ctree
lyplg_ext_sprinter_ctree_clb printer_ctree
Definition plugins_exts.h:939
lyplg_ext::validate
lyplg_ext_data_validate_clb validate
Definition plugins_exts.h:946
lysc_ext_instance::def
struct lysc_ext * def
Definition plugins_exts.h:438
lysp_ext_instance::parent_stmt_index
uint64_t parent_stmt_index
Definition plugins_exts.h:413
lysc_ext_instance::exts
struct lysc_ext_instance * exts
Definition plugins_exts.h:441
lysc_ext_instance::parent
void * parent
Definition plugins_exts.h:443
lysp_stmt::stmt
const char * stmt
Definition plugins_exts.h:380
lyplg_ext::pfree
lyplg_ext_parse_free_clb pfree
Definition plugins_exts.h:949
lysc_ext_substmt::stmt
enum ly_stmt stmt
Definition plugins_exts.h:429
lysp_ext_instance::def
struct lysp_ext * def
Definition plugins_exts.h:408
lysp_stmt::next
struct lysp_stmt * next
Definition plugins_exts.h:385
lysc_ext_instance::module
struct lys_module * module
Definition plugins_exts.h:440
lysc_ext_instance::parent_stmt
enum ly_stmt parent_stmt
Definition plugins_exts.h:445
lyplg_ext::compile
lyplg_ext_compile_clb compile
Definition plugins_exts.h:936
lysp_stmt::prefix_data
void * prefix_data
Definition plugins_exts.h:383
lyplg_ext_record::name
const char * name
Definition plugins_exts.h:961
lyplg_ext::printer_ptree
lyplg_ext_sprinter_ptree_clb printer_ptree
Definition plugins_exts.h:941
lyplg_ext_get_storage
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.
lyplg_ext_data_snode_clb
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:860
lyplg_ext_parsed_get_storage
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.
lyplg_ext_data_validate_clb
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:883
lyplg_ext_data_node_clb
LY_ERR(* lyplg_ext_data_node_clb)(struct lysc_ext_instance *ext, struct lyd_node *node, uint32_t validate_options)
Callback called for all data nodes connected to the extension instance.
Definition plugins_exts.h:836
lyplg_ext_compile_free_clb
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:916
ly_stmt
ly_stmt
List of YANG statements.
Definition plugins_exts.h:143
lyplg_ext_schema_mount_get_parent_ref
LIBYANG_API_DECL LY_ERR lyplg_ext_schema_mount_get_parent_ref(const struct lysc_ext_instance *ext, struct ly_set **refs)
Expand parent-reference xpath expressions.
lyplg_ext_nodetype2stmt
LIBYANG_API_DECL enum ly_stmt lyplg_ext_nodetype2stmt(uint16_t nodetype)
Convert nodetype to statement identifier.
lyplg_ext_insert
LIBYANG_API_DECL LY_ERR lyplg_ext_insert(struct lyd_node *parent, struct lyd_node *first)
Insert extension instance data into a parent.
lyplg_ext_schema_mount_create_context
LIBYANG_API_DECL LY_ERR lyplg_ext_schema_mount_create_context(const struct lysc_ext_instance *ext, struct ly_ctx **ctx)
Allocate a new context for a particular instance of the yangmnt:mount-point extension....
lyplg_ext_stmt2str
LIBYANG_API_DECL const char * lyplg_ext_stmt2str(enum ly_stmt stmt)
Stringify statement identifier.
lyplg_ext_cfree_instance_substatements
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().
lyplg_ext_parse_free_clb
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:896
lyplg_ext_pfree_instance_substatements
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().
lyplg_ext_get_data
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().
LY_STMT_REVISION
@ LY_STMT_REVISION
Definition plugins_exts.h:323
LY_STMT_MUST
@ LY_STMT_MUST
Definition plugins_exts.h:276
LY_STMT_ARGUMENT
@ LY_STMT_ARGUMENT
Definition plugins_exts.h:181
LY_STMT_ENUM
@ LY_STMT_ENUM
Definition plugins_exts.h:216
LY_STMT_LEAF
@ LY_STMT_LEAF
Definition plugins_exts.h:172
LY_STMT_ERROR_APP_TAG
@ LY_STMT_ERROR_APP_TAG
Definition plugins_exts.h:220
LY_STMT_MAX_ELEMENTS
@ LY_STMT_MAX_ELEMENTS
Definition plugins_exts.h:263
LY_STMT_REFERENCE
@ LY_STMT_REFERENCE
Definition plugins_exts.h:312
LY_STMT_REVISION_DATE
@ LY_STMT_REVISION_DATE
Definition plugins_exts.h:326
LY_STMT_SYNTAX_LEFT_BRACE
@ LY_STMT_SYNTAX_LEFT_BRACE
Definition plugins_exts.h:366
LY_STMT_UNIQUE
@ LY_STMT_UNIQUE
Definition plugins_exts.h:340
LY_STMT_REQUIRE_INSTANCE
@ LY_STMT_REQUIRE_INSTANCE
Definition plugins_exts.h:319
LY_STMT_DEVIATION
@ LY_STMT_DEVIATION
Definition plugins_exts.h:212
LY_STMT_IMPORT
@ LY_STMT_IMPORT
Definition plugins_exts.h:248
LY_STMT_CONTACT
@ LY_STMT_CONTACT
Definition plugins_exts.h:199
LY_STMT_LENGTH
@ LY_STMT_LENGTH
Definition plugins_exts.h:258
LY_STMT_IF_FEATURE
@ LY_STMT_IF_FEATURE
Definition plugins_exts.h:245
LY_STMT_SYNTAX_RIGHT_BRACE
@ LY_STMT_SYNTAX_RIGHT_BRACE
Definition plugins_exts.h:367
LY_STMT_ANYDATA
@ LY_STMT_ANYDATA
Definition plugins_exts.h:156
LY_STMT_CONTAINER
@ LY_STMT_CONTAINER
Definition plugins_exts.h:167
LY_STMT_PATTERN
@ LY_STMT_PATTERN
Definition plugins_exts.h:296
LY_STMT_POSITION
@ LY_STMT_POSITION
Definition plugins_exts.h:300
LY_STMT_PREFIX
@ LY_STMT_PREFIX
Definition plugins_exts.h:304
LY_STMT_WHEN
@ LY_STMT_WHEN
Definition plugins_exts.h:350
LY_STMT_BELONGS_TO
@ LY_STMT_BELONGS_TO
Definition plugins_exts.h:188
LY_STMT_ORGANIZATION
@ LY_STMT_ORGANIZATION
Definition plugins_exts.h:288
LY_STMT_AUGMENT
@ LY_STMT_AUGMENT
Definition plugins_exts.h:160
LY_STMT_SUBMODULE
@ LY_STMT_SUBMODULE
Definition plugins_exts.h:331
LY_STMT_ANYXML
@ LY_STMT_ANYXML
Definition plugins_exts.h:158
LY_STMT_MIN_ELEMENTS
@ LY_STMT_MIN_ELEMENTS
Definition plugins_exts.h:266
LY_STMT_SYNTAX_SEMICOLON
@ LY_STMT_SYNTAX_SEMICOLON
Definition plugins_exts.h:365
LY_STMT_NAMESPACE
@ LY_STMT_NAMESPACE
Definition plugins_exts.h:280
LY_STMT_YANG_VERSION
@ LY_STMT_YANG_VERSION
Definition plugins_exts.h:352
LY_STMT_MANDATORY
@ LY_STMT_MANDATORY
Definition plugins_exts.h:260
LY_STMT_PATH
@ LY_STMT_PATH
Definition plugins_exts.h:292
LY_STMT_EXTENSION
@ LY_STMT_EXTENSION
Definition plugins_exts.h:228
LY_STMT_CASE
@ LY_STMT_CASE
Definition plugins_exts.h:163
LY_STMT_MODULE
@ LY_STMT_MODULE
Definition plugins_exts.h:273
LY_STMT_ERROR_MESSAGE
@ LY_STMT_ERROR_MESSAGE
Definition plugins_exts.h:224
LY_STMT_OUTPUT
@ LY_STMT_OUTPUT
Definition plugins_exts.h:150
LY_STMT_REFINE
@ LY_STMT_REFINE
Definition plugins_exts.h:315
LY_STMT_IDENTITY
@ LY_STMT_IDENTITY
Definition plugins_exts.h:241
LY_STMT_TYPEDEF
@ LY_STMT_TYPEDEF
Definition plugins_exts.h:336
LY_STMT_NONE
@ LY_STMT_NONE
Definition plugins_exts.h:144
LY_STMT_ARG_VALUE
@ LY_STMT_ARG_VALUE
Definition plugins_exts.h:373
LY_STMT_DESCRIPTION
@ LY_STMT_DESCRIPTION
Definition plugins_exts.h:206
LY_STMT_ARG_TEXT
@ LY_STMT_ARG_TEXT
Definition plugins_exts.h:372
LY_STMT_CONFIG
@ LY_STMT_CONFIG
Definition plugins_exts.h:196
LY_STMT_RANGE
@ LY_STMT_RANGE
Definition plugins_exts.h:310
LY_STMT_ORDERED_BY
@ LY_STMT_ORDERED_BY
Definition plugins_exts.h:284
LY_STMT_INCLUDE
@ LY_STMT_INCLUDE
Definition plugins_exts.h:251
LY_STMT_YIN_ELEMENT
@ LY_STMT_YIN_ELEMENT
Definition plugins_exts.h:356
LY_STMT_EXTENSION_INSTANCE
@ LY_STMT_EXTENSION_INSTANCE
Definition plugins_exts.h:232
LY_STMT_BIT
@ LY_STMT_BIT
Definition plugins_exts.h:192
LY_STMT_FRACTION_DIGITS
@ LY_STMT_FRACTION_DIGITS
Definition plugins_exts.h:237
LY_STMT_ACTION
@ LY_STMT_ACTION
Definition plugins_exts.h:152
LY_STMT_MODIFIER
@ LY_STMT_MODIFIER
Definition plugins_exts.h:269
LY_STMT_TYPE
@ LY_STMT_TYPE
Definition plugins_exts.h:334
LY_STMT_BASE
@ LY_STMT_BASE
Definition plugins_exts.h:185
LY_STMT_LEAF_LIST
@ LY_STMT_LEAF_LIST
Definition plugins_exts.h:174
LY_STMT_FEATURE
@ LY_STMT_FEATURE
Definition plugins_exts.h:234
LY_STMT_RPC
@ LY_STMT_RPC
Definition plugins_exts.h:154
LY_STMT_DEVIATE
@ LY_STMT_DEVIATE
Definition plugins_exts.h:209
LY_STMT_UNITS
@ LY_STMT_UNITS
Definition plugins_exts.h:343
LY_STMT_GROUPING
@ LY_STMT_GROUPING
Definition plugins_exts.h:169
LY_STMT_KEY
@ LY_STMT_KEY
Definition plugins_exts.h:254
LY_STMT_NOTIFICATION
@ LY_STMT_NOTIFICATION
Definition plugins_exts.h:146
LY_STMT_CHOICE
@ LY_STMT_CHOICE
Definition plugins_exts.h:165
LY_STMT_VALUE
@ LY_STMT_VALUE
Definition plugins_exts.h:346
LY_STMT_USES
@ LY_STMT_USES
Definition plugins_exts.h:178
LY_STMT_PRESENCE
@ LY_STMT_PRESENCE
Definition plugins_exts.h:307
LY_STMT_STATUS
@ LY_STMT_STATUS
Definition plugins_exts.h:328
LY_STMT_INPUT
@ LY_STMT_INPUT
Definition plugins_exts.h:148
LY_STMT_LIST
@ LY_STMT_LIST
Definition plugins_exts.h:176
LY_STMT_DEFAULT
@ LY_STMT_DEFAULT
Definition plugins_exts.h:203
lyplg_ext
Extension plugin implementing various aspects of a YANG extension.
Definition plugins_exts.h:932
lyplg_ext_record
Definition plugins_exts.h:953
lysc_ext_instance
YANG extension compiled instance.
Definition plugins_exts.h:437
lysc_ext_substmt
Structure representing a compiled known YANG substatement in an extension instance.
Definition plugins_exts.h:428
lysp_ext_instance
YANG extension parsed instance.
Definition plugins_exts.h:403
lysp_ext_substmt
Structure representing a parsed known YANG substatement in an extension instance.
Definition plugins_exts.h:394
lysp_stmt
Structure representing a generic parsed YANG substatement in an extension instance.
Definition plugins_exts.h:379
lyplg_ext_parse_extension_instance
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.
lyplg_ext_parse_clb
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:484
lyplg_ext_parse_log
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.
lyplg_ext_parse_get_cur_pmod
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.
lyplg_ext_print_get_level
LIBYANG_API_DECL uint16_t * lyplg_ext_print_get_level(const struct lyspr_ctx *ctx)
YANG printer context getter for printer indentation level.
lyplg_ext_sprinter_info_clb
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:675
lyplg_ext_print_get_out
LIBYANG_API_DECL struct ly_out ** lyplg_ext_print_get_out(const struct lyspr_ctx *ctx)
YANG printer context getter for output handler.
lyplg_ext_print_get_options
LIBYANG_API_DECL uint32_t * lyplg_ext_print_get_options(const struct lyspr_ctx *ctx)
YANG printer context getter for printer options.
lyplg_ext_print_info_extension_instance
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).
lyplg_ext_sprinter_tree_set_priv
LIBYANG_API_DECL LY_ERR lyplg_ext_sprinter_tree_set_priv(const struct lyspr_tree_ctx *ctx, void *plugin_priv, void(*free_clb)(void *plugin_priv))
Registration of plugin-private data defined by the plugin that is shared between override_clb calls.
lyplg_ext_sprinter_ctree_clb
LY_ERR(* lyplg_ext_sprinter_ctree_clb)(struct lysc_ext_instance *ext, const struct lyspr_tree_ctx *ctx, const char **flags, const char **add_opts)
Callback to print parent node of ext or to print the contents of the extension.
Definition plugins_exts.h:743
lyplg_ext_sprinter_ptree_clb
LY_ERR(* lyplg_ext_sprinter_ptree_clb)(struct lysp_ext_instance *ext, const struct lyspr_tree_ctx *ctx, const char **flags, const char **add_opts)
Callback to print parent node of ext or to print the contents of the extension.
Definition plugins_exts.h:797
lyplg_ext_sprinter_ptree_override_clb
LY_ERR(* lyplg_ext_sprinter_ptree_override_clb)(const struct lysp_node *node, const void *plugin_priv, ly_bool *skip, const char **flags, const char **add_opts)
Callback for rewriting the tree-diagram form of a specific node.
Definition plugins_exts.h:803
lyplg_ext_sprinter_ctree_add_ext_nodes
LIBYANG_API_DECL LY_ERR lyplg_ext_sprinter_ctree_add_ext_nodes(const struct lyspr_tree_ctx *ctx, struct lysc_ext_instance *ext, lyplg_ext_sprinter_ctree_override_clb clb)
Registration of printing a group of nodes, which is already in the extension.
lyplg_ext_sprinter_ptree_add_nodes
LIBYANG_API_DECL LY_ERR lyplg_ext_sprinter_ptree_add_nodes(const struct lyspr_tree_ctx *ctx, struct lysp_node *nodes, lyplg_ext_sprinter_ptree_override_clb clb)
Registration of printing the group of nodes which were defined in the plugin.
lyplg_ext_sprinter_ctree_add_nodes
LIBYANG_API_DECL LY_ERR lyplg_ext_sprinter_ctree_add_nodes(const struct lyspr_tree_ctx *ctx, struct lysc_node *nodes, lyplg_ext_sprinter_ctree_override_clb clb)
Registration of printing the group of nodes which were defined in the plugin.
lyplg_ext_sprinter_ptree_add_ext_nodes
LIBYANG_API_DECL LY_ERR lyplg_ext_sprinter_ptree_add_ext_nodes(const struct lyspr_tree_ctx *ctx, struct lysp_ext_instance *ext, lyplg_ext_sprinter_ptree_override_clb clb)
Registration of printing a group of nodes, which is already in the extension.
lyplg_ext_sprinter_ctree_override_clb
LY_ERR(* lyplg_ext_sprinter_ctree_override_clb)(const struct lysc_node *node, const void *plugin_priv, ly_bool *skip, const char **flags, const char **add_opts)
Callback for rewriting the tree-diagram form of a specific node.
Definition plugins_exts.h:758
lysp_node::flags
uint16_t flags
Definition tree_schema.h:737
lysc_node::flags
uint16_t flags
Definition tree_schema.h:1423
lysc_node::name
const char * name
Definition tree_schema.h:1432
lys_module::ctx
struct ly_ctx * ctx
Definition tree_schema.h:2138
lys_module
Available YANG schema tree structures representing YANG module.
Definition tree_schema.h:2137
lysc_ext
Compiled YANG extension-stmt.
Definition tree_schema.h:1186
lysc_node
Compiled YANG data node.
Definition tree_schema.h:1421
lysp_ext
YANG extension-stmt.
Definition tree_schema.h:296
lysp_module
Printable YANG schema tree structure representing YANG module.
Definition tree_schema.h:1102
lysp_node
Generic YANG data node.
Definition tree_schema.h:734
LY_VALUE_FORMAT
LY_VALUE_FORMAT
All kinds of supported value formats and prefix mappings to modules.
Definition tree.h:234
LY_ARRAY_COUNT_TYPE
#define LY_ARRAY_COUNT_TYPE
Type (i.e. size) of the sized array's size counter.
Definition tree.h:104
log.h
Logger manipulation routines and error definitions.
ly_bool
uint8_t ly_bool
Type to indicate boolean value.
Definition log.h:35
parser_data.h
Data parsers for libyang.
plugins.h
Plugins manipulation.
tree_data.h
libyang representation of YANG data trees.
lyd_node::parent
struct lyd_node_inner * parent
Definition tree_data.h:802
lyd_node
Generic structure for a data node.
Definition tree_data.h:795
tree_edit.h
libyang generic macros and functions to modify YANG schema or data trees. Intended for internal use a...
tree_schema.h
libyang representation of YANG schema trees.