libyang 2.1.4
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
Loading...
Searching...
No Matches
Plugins: Extensions
Collaboration diagram for Plugins: Extensions:

Modules

 Schema compile flags
 

Data Structures

struct  lyplg_ext
 Extension plugin implementing various aspects of a YANG extension. More...
 
struct  lyplg_ext_record
 
struct  lysc_ext_instance
 YANG extension compiled instance. More...
 
struct  lysc_ext_substmt
 Structure representing a compiled known YANG substatement in an extension instance. More...
 
struct  lysp_ext_instance
 YANG extension parsed instance. More...
 
struct  lysp_ext_substmt
 Structure representing a parsed known YANG substatement in an extension instance. More...
 
struct  lysp_stmt
 Structure representing a generic parsed YANG substatement in an extension instance. More...
 

Macros

#define LY_STMT_DATA_NODE_MASK
 Mask for a data node statement. More...
 
#define LY_STMT_NODE_MASK   0xFFFF
 Mask for a node statement. More...
 
#define LY_STMT_OP_MASK   (LY_STMT_ACTION | LY_STMT_RPC)
 Mask for an operation statement. More...
 
#define LYPLG_EXT_API_VERSION   6
 Extensions API version. More...
 
#define LYPLG_EXTENSIONS
 Macro to define plugin information in external plugins. More...
 

Typedefs

typedef 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. The later structure is generally prepared and only the extension specific data are supposed to be added (if any). More...
 
typedef 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. More...
 
typedef 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. More...
 
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)
 Callback for getting a schema node for a new YANG instance data described by an extension instance. Needed only if the extension instance supports some nested standard YANG data. More...
 
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)
 Callback for validating parsed YANG instance data described by an extension instance. More...
 
typedef LY_ERR(* lyplg_ext_parse_clb) (struct lysp_ctx *pctx, struct lysp_ext_instance *ext)
 Callback for parsing extension instance substatements. More...
 
typedef 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. More...
 
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)
 Callback to print parent node of ext or to print the contents of the extension. More...
 
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)
 Callback for rewriting the tree-diagram form of a specific node. More...
 
typedef 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. More...
 
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)
 Callback to print parent node of ext or to print the contents of the extension. More...
 
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)
 Callback for rewriting the tree-diagram form of a specific node. More...
 

Enumerations

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 , LY_STMT_SYNTAX_SEMICOLON , LY_STMT_SYNTAX_LEFT_BRACE ,
  LY_STMT_SYNTAX_RIGHT_BRACE , LY_STMT_ARG_TEXT , LY_STMT_ARG_VALUE
}
 List of YANG statements. More...
 

Functions

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 ::lys_compile_extension_instance(). More...
 
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. More...
 
LIBYANG_API_DECL struct ly_ctxlyplg_ext_compile_get_ctx (const struct lysc_ctx *ctx)
 YANG schema compilation context getter for libyang context. More...
 
LIBYANG_API_DECL const struct lys_modulelyplg_ext_compile_get_cur_mod (const struct lysc_ctx *ctx)
 YANG schema compilation context getter for current module. More...
 
LIBYANG_API_DECL uint32_t * lyplg_ext_compile_get_options (const struct lysc_ctx *ctx)
 YANG schema compilation context getter for compilation options. More...
 
LIBYANG_API_DECL struct lysp_modulelyplg_ext_compile_get_pmod (const struct lysc_ctx *ctx)
 YANG schema compilation context getter for currently processed module. More...
 
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_no, const char *format,...)
 Log a message from an extension plugin using the compiled extension instance. More...
 
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_no, const char *format,...)
 Log a message from an extension plugin using the compiled extension instance with an explicit error path. More...
 
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(). More...
 
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. More...
 
LIBYANG_API_DECL LY_ERR lyplg_ext_insert (struct lyd_node *parent, struct lyd_node *first)
 Insert extension instance data into a parent. More...
 
LIBYANG_API_DECL enum ly_stmt lyplg_ext_nodetype2stmt (uint16_t nodetype)
 Convert nodetype to statement identifier. More...
 
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. More...
 
LIBYANG_API_DECL const struct lysp_modulelyplg_ext_parse_get_cur_pmod (const struct lysp_ctx *pctx)
 Get current parsed module from a parse context. More...
 
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_no, const char *format,...)
 Log a message from an extension plugin using the parsed extension instance. More...
 
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. More...
 
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 ::lys_parse_extension_instance(). More...
 
LIBYANG_API_DECL uint16_t * lyplg_ext_print_get_level (const struct lyspr_ctx *ctx)
 YANG printer context getter for printer indentation level. More...
 
LIBYANG_API_DECL uint32_t * lyplg_ext_print_get_options (const struct lyspr_ctx *ctx)
 YANG printer context getter for printer options. More...
 
LIBYANG_API_DECL struct ly_out ** lyplg_ext_print_get_out (const struct lyspr_ctx *ctx)
 YANG printer context getter for output handler. More...
 
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). More...
 
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. Caller is responsible for destroying the resulting context. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
LIBYANG_API_DECL const char * lyplg_ext_stmt2str (enum ly_stmt stmt)
 Stringify statement identifier. More...
 

Detailed Description

Structures and functions to for libyang plugins implementing specific YANG extensions defined in YANG modules. For more information, see Type Plugins.

This part of libyang API is available by including <libyang/plugins_ext.h> header file.


Data Structure Documentation

◆ lyplg_ext

struct lyplg_ext

Extension plugin implementing various aspects of a YANG extension.

Definition at line 892 of file plugins_exts.h.

Data Fields
lyplg_ext_compile_free_clb cfree

free the extension-specific data created by its compilation

lyplg_ext_compile_clb compile

callback to compile extension instance from the parsed data

const char * id

plugin identification (mainly for distinguish incompatible versions of the plugins for external tools)

lyplg_ext_data_node_clb node

callback to validate most relevant data instance for the extension instance

lyplg_ext_parse_clb parse

callback to parse the extension instance substatements

lyplg_ext_parse_free_clb pfree

free the extension-specific data created by its parsing

lyplg_ext_sprinter_ctree_clb printer_ctree

callback to print tree format of compiled node containing the compiled content of the extension instance

lyplg_ext_sprinter_info_clb printer_info

callback to print the compiled content (info format) of the extension instance

lyplg_ext_sprinter_ptree_clb printer_ptree

callback to print tree format of parsed node containing the parsed content of the extension instance

lyplg_ext_data_snode_clb snode

callback to get schema node for nested YANG data

lyplg_ext_data_validate_clb validate

callback to validate parsed data instances according to the extension definition

◆ lyplg_ext_record

struct lyplg_ext_record

Definition at line 913 of file plugins_exts.h.

Data Fields
const char * module

name of the module where the extension is defined

const char * name

YANG name of the extension

struct lyplg_ext plugin

data to utilize plugin implementation

const char * revision

optional module revision - if not specified, the plugin applies to any revision, which is not an optimal approach due to a possible future revisions of the module. Instead, there should be defined multiple items in the plugins list, each with the different revision, but all with the same pointer to the plugin functions. The only valid use case for the NULL revision is the case the module has no revision.

◆ lysc_ext_instance

struct lysc_ext_instance

YANG extension compiled instance.

Definition at line 436 of file plugins_exts.h.

Data Fields
const char * argument

optional value of the extension's argument

void * compiled

private plugin compiled data

struct lysc_ext * def

pointer to the extension definition

struct lysc_ext_instance * exts

list of the extension instances (sized array)

struct lys_module * module

module where the extension instantiated is defined

void * parent

pointer to the parent element holding the extension instance(s), use lysc_ext_instance::parent_stmt to access the value/structure

enum ly_stmt parent_stmt

type of the parent statement

uint64_t parent_stmt_index

index of the stamenet in case the parent does not point to the parent statement directly and it is an array

struct lysc_ext_substmt * substmts

list of supported known YANG statements with the pointer to their compiled data (sized array)

◆ lysc_ext_substmt

struct lysc_ext_substmt

Structure representing a compiled known YANG substatement in an extension instance.

Definition at line 427 of file plugins_exts.h.

Data Fields
enum ly_stmt stmt

compiled substatement

void * storage

pointer to the compiled storage of the statement according to the specific lys_ext_substmt::stmt

◆ lysp_ext_instance

struct lysp_ext_instance

YANG extension parsed instance.

Definition at line 403 of file plugins_exts.h.

Data Fields
const char * argument

optional value of the extension's argument

struct lysp_stmt * child

list of generic (unknown) YANG statements

struct lysp_ext * def

pointer to the extension definition

uint16_t flags

LYS_INTERNAL value (Schema nodes flags)

LY_VALUE_FORMAT format

prefix format of the extension name/argument (LY_VALUE_XML is YIN format)

const char * name

extension identifier, including possible prefix

void * parent

pointer to the parent statement holding the extension instance(s), use lysp_ext_instance::parent_stmt to access the value/structure

enum ly_stmt parent_stmt

type of the parent statement

uint64_t parent_stmt_index

index of the stamenet in case the parent does not point to the parent statement directly and it is an array

void * parsed

private plugin parsed data

void * prefix_data

format-specific data for prefix resolution (see ly_resolve_prefix())

const struct lyplg_ext_record * record

extension definition plugin record, if any

struct lysp_ext_substmt * substmts

list of supported known YANG statements with the pointer to their parsed data (sized array)

◆ lysp_ext_substmt

struct lysp_ext_substmt

Structure representing a parsed known YANG substatement in an extension instance.

Definition at line 394 of file plugins_exts.h.

Data Fields
enum ly_stmt stmt

parsed substatement

void * storage

pointer to the parsed storage of the statement according to the specific lys_ext_substmt::stmt

◆ lysp_stmt

struct lysp_stmt

Structure representing a generic parsed YANG substatement in an extension instance.

Definition at line 379 of file plugins_exts.h.

Data Fields
const char * arg

statement's argument

struct lysp_stmt * child

list of the statement's substatements (linked list)

uint16_t flags

statement flags, can be set to LYS_YIN_ATTR

LY_VALUE_FORMAT format

prefix format of the identifier/argument (LY_VALUE_XML is YIN format)

enum ly_stmt kw

numeric respresentation of the stmt value

struct lysp_stmt * next

link to the next statement

void * prefix_data

Format-specific data for prefix resolution (see ly_resolve_prefix())

const char * stmt

identifier of the statement

Macro Definition Documentation

◆ LY_STMT_DATA_NODE_MASK

#define LY_STMT_DATA_NODE_MASK
Value:
@ LY_STMT_LEAF
Definition: plugins_exts.h:172
@ LY_STMT_ANYDATA
Definition: plugins_exts.h:156
@ LY_STMT_CONTAINER
Definition: plugins_exts.h:167
@ LY_STMT_ANYXML
Definition: plugins_exts.h:158
@ LY_STMT_CASE
Definition: plugins_exts.h:163
@ LY_STMT_LEAF_LIST
Definition: plugins_exts.h:174
@ LY_STMT_CHOICE
Definition: plugins_exts.h:165
@ LY_STMT_LIST
Definition: plugins_exts.h:176

Mask for a data node statement.

This mask matches anydata, anyxml, case, choice, container, leaf, leaf-list, and list.

Definition at line 126 of file plugins_exts.h.

◆ LY_STMT_NODE_MASK

#define LY_STMT_NODE_MASK   0xFFFF

Mask for a node statement.

This mask matches notification, input, output, action, RPC, anydata, anyxml, augment, case, choice, container, grouping, leaf, leaf-list, list, and uses.

Definition at line 135 of file plugins_exts.h.

◆ LY_STMT_OP_MASK

#define LY_STMT_OP_MASK   (LY_STMT_ACTION | LY_STMT_RPC)

Mask for an operation statement.

This mask matches action and RPC.

Definition at line 119 of file plugins_exts.h.

◆ LYPLG_EXT_API_VERSION

#define LYPLG_EXT_API_VERSION   6

Extensions API version.

Definition at line 112 of file plugins_exts.h.

◆ LYPLG_EXTENSIONS

#define LYPLG_EXTENSIONS
Value:
uint32_t plugins_extensions_apiver__ = LYPLG_EXT_API_VERSION; \
const struct lyplg_ext_record plugins_extensions__[]
#define LYPLG_EXT_API_VERSION
Extensions API version.
Definition: plugins_exts.h:112

Macro to define plugin information in external plugins.

Use as follows: LYPLG_EXTENSIONS = {{<filled information of lyplg_ext_record>}, ..., {0}};

Definition at line 459 of file plugins_exts.h.

Typedef Documentation

◆ lyplg_ext_compile_clb

typedef 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. The later structure is generally prepared and only the extension specific data are supposed to be added (if any).

The parsed generic statements can be processed by the callback on its own or the ::lys_compile_extension_instance function can be used to let the compilation to libyang following the standard rules for processing the YANG statements.

Parameters
[in]cctxCurrent compile context.
[in]extpParsed extension instance data.
[in,out]extPrepared compiled extension instance structure where an addition, extension-specific, data are supposed to be placed for later use (data validation or use of external tool).
Returns
LY_SUCCESS in case of success.
LY_ENOT in case the extension instance is not supported and should be removed.
LY_ERR error on error.

Definition at line 557 of file plugins_exts.h.

◆ lyplg_ext_compile_free_clb

typedef 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.

Parameters
[in]ctxlibyang context.
[in,out]extCompiled extension structure to free.

Definition at line 879 of file plugins_exts.h.

◆ lyplg_ext_data_node_clb

typedef 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.

Can be used for additional data node validation. Is called only after the whole data tree is created and standard validation succeeds. Not called when parsing data and LYD_PARSE_ONLY is used.

Parameters
[in]extCompiled extension instance.
[in]nodeData node to process.
[in]validate_optionsOptions used for the validation phase, see Data validation options.
Returns
LY_SUCCESS on success.
LY_ERR on error.

Definition at line 799 of file plugins_exts.h.

◆ lyplg_ext_data_snode_clb

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)

Callback for getting a schema node for a new YANG instance data described by an extension instance. Needed only if the extension instance supports some nested standard YANG data.

Parameters
[in]extCompiled extension instance.
[in]parentParsed parent data node. Set if sparent is NULL.
[in]sparentSchema parent node. Set if parent is NULL.
[in]prefixElement prefix, if any.
[in]prefix_lenLength of prefix.
[in]formatFormat of prefix.
[in]prefix_dataFormat-specific prefix data.
[in]nameElement name.
[in]name_lenLength of name.
[out]snodeSchema node to use for parsing the node.
Returns
LY_SUCCESS on success.
LY_ENOT if the data are not described by ext.
LY_ERR on error.

Definition at line 823 of file plugins_exts.h.

◆ lyplg_ext_data_validate_clb

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)

Callback for validating parsed YANG instance data described by an extension instance.

This callback is used only for nested data definition (with a standard YANG schema parent).

Parameters
[in]extCompiled extension instance.
[in]siblingFirst sibling with schema node returned by lyplg_ext_data_snode_clb.
[in]dep_treeTree to be used for validating references from the operation subtree, if operation.
[in]data_typeValidated data type, can be LYD_TYPE_DATA_YANG, LYD_TYPE_RPC_YANG, LYD_TYPE_NOTIF_YANG, or LYD_TYPE_REPLY_YANG.
[in]val_optsValidation options, see Data validation options.
[out]diffOptional diff with any changes made by the validation.
Returns
LY_SUCCESS on success.
LY_ERR on error.

Definition at line 846 of file plugins_exts.h.

◆ lyplg_ext_parse_clb

typedef LY_ERR(* lyplg_ext_parse_clb) (struct lysp_ctx *pctx, struct lysp_ext_instance *ext)

Callback for parsing extension instance substatements.

All known YANG substatements can easily be parsed using ::lys_parse_extension_instance.

Parameters
[in]pctxParse context.
[in,out]extParsed extension instance data.
Returns
LY_SUCCESS on success.
LY_ENOT if the extension instance is not supported and should be removed.
LY_ERR error on error.

Definition at line 478 of file plugins_exts.h.

◆ lyplg_ext_parse_free_clb

typedef 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.

Parameters
[in]ctxlibyang context.
[in,out]extParsed extension structure to free.

Definition at line 859 of file plugins_exts.h.

◆ lyplg_ext_sprinter_ctree_clb

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)

Callback to print parent node of ext or to print the contents of the extension.

Function is called in two different cases. If the printer_tree needs the tree-diagram form of a parent node, then ctx is set to NULL. In the second case, if printer_tree needs to print the contents of the extension, then ctx is set and function must prepare the nodes that should be printed using the lyplg_ext_sprinter_tree* functions.

Parameters
[in]extExtension instance.
[in,out]ctxContext for the tree printer. Extension contents can be inserted into it by functions lyplg_ext_sprinter_ctree_add_ext_nodes(), lyplg_ext_sprinter_ctree_add_nodes() or by their ptree alternatives. It parameter is set to NULL, then flags and add_opts are used by printer_tree.
[out]flagsOptional override tree-diagram <flags> in a parent node. If ctx is set, ignore this parameter.
[out]add_optsAdditional tree-diagram <opts> string in a parent node which is printed before <opts>. If ctx is set, ignore this parameter.
Returns
LY_ERR value.

Definition at line 708 of file plugins_exts.h.

◆ lyplg_ext_sprinter_ctree_override_clb

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)

Callback for rewriting the tree-diagram form of a specific node.

If this callback is set, then it is called for each node that belongs to the extension instance.

Parameters
[in]nodeNode whose tree-diagram form can be modified by the function.
[in,out]plugin_privPrivate context set by plugin.
[out]skipFlag set to 1 removes the node from printed diagram.
[out]flagsOverride tree-diagram <flags> string in the node.
[out]add_optsAdditional tree-diagram <opts> string in the node which is printed before <opts>.
Returns
LY_ERR value.

Definition at line 723 of file plugins_exts.h.

◆ lyplg_ext_sprinter_info_clb

typedef 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.

Parameters
[in]ctxYANG printer context to provide output handler and other information for printing.
[in]extThe compiled extension instance, mainly to access the extensions.
[in,out]flagFlag to be shared with the caller regarding the opening brackets - 0 if the '{' not yet printed, 1 otherwise.
Returns
LY_SUCCESS when everything was fine, other LY_ERR values in case of failure

Definition at line 647 of file plugins_exts.h.

◆ lyplg_ext_sprinter_ptree_clb

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)

Callback to print parent node of ext or to print the contents of the extension.

Function is called in two different cases. If the printer_tree needs the tree-diagram form of a parent node, then ctx is set to NULL. In the second case, if printer_tree needs to print the contents of the extension, then ctx is set and function must prepare the nodes that should be printed using the lyplg_ext_sprinter_tree* functions.

Parameters
[in]extExtension instance.
[in,out]ctxContext for the tree printer. Extension contents can be inserted into it by functions lyplg_ext_sprinter_ctree_add_ext_nodes(), lyplg_ext_sprinter_ctree_add_nodes() or by their ptree alternatives. It parameter is set to NULL, then flags and add_opts are used by printer_tree.
[out]flagsOptional override tree-diagram <flags> in a parent node. If ctx is set, ignore this parameter.
[out]add_optsAdditional tree-diagram <opts> string in a parent node which is printed before <opts>. If ctx is set, ignore this parameter.
Returns
LY_ERR value.

Definition at line 762 of file plugins_exts.h.

◆ lyplg_ext_sprinter_ptree_override_clb

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)

Callback for rewriting the tree-diagram form of a specific node.

If this callback is set, then it is called for each node that belongs to the extension instance.

Parameters
[in]nodeNode whose tree-diagram form can be modified by the function.
[in,out]plugin_privPrivate context set by plugin.
[out]skipFlag set to 1 removes the node from printed diagram.
[out]flagsOverride tree-diagram <flags> string in the node.
[out]add_optsAdditional tree-diagram <opts> string in the node which is printed before <opts>.
Returns
LY_ERR value.

Definition at line 768 of file plugins_exts.h.

Enumeration Type Documentation

◆ ly_stmt

enum ly_stmt

List of YANG statements.

Their description mentions what types are stored for each statement. Note that extension instance storage always stores a pointer to the type, not the type itself.

Enumerator
LY_STMT_NONE 
LY_STMT_NOTIFICATION 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_node_notif * lysc_ext_substmt.storage and lysc_ext_instance.parent - struct lysc_node_notif *

LY_STMT_INPUT 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_node_action_inout * lysc_ext_substmt.storage and lysc_ext_instance.parent - struct lysc_node_action_inout *

LY_STMT_OUTPUT 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_node_action_inout * lysc_ext_substmt.storage and lysc_ext_instance.parent - struct lysc_node_action_inout *

LY_STMT_ACTION 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_node_action * lysc_ext_substmt.storage and lysc_ext_instance.parent - struct lysc_node_action *

LY_STMT_RPC 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_node_action * lysc_ext_substmt.storage and lysc_ext_instance.parent - struct lysc_node_action *

LY_STMT_ANYDATA 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_node_anydata * lysc_ext_substmt.storage and lysc_ext_instance.parent - struct lysc_node_anydata *

LY_STMT_ANYXML 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_node_anydata * lysc_ext_substmt.storage and lysc_ext_instance.parent - struct lysc_node_anydata *

LY_STMT_AUGMENT 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_node_augment * lysc_ext_substmt.storage - not compiled lysc_ext_instance.parent - struct lysc_node *

LY_STMT_CASE 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_node_case * lysc_ext_substmt.storage and lysc_ext_instance.parent - struct lysc_node_case *

LY_STMT_CHOICE 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_node_choice * lysc_ext_substmt.storage and lysc_ext_instance.parent - struct lysc_node_choice *

LY_STMT_CONTAINER 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_node_container * lysc_ext_substmt.storage and lysc_ext_instance.parent - struct lysc_node_container *

LY_STMT_GROUPING 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_node_grp * lysc_ext_substmt.storage - not compiled lysc_ext_instance.parent - struct lysc_node *

LY_STMT_LEAF 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_node_leaf * lysc_ext_substmt.storage and lysc_ext_instance.parent - struct lysc_node_leaf *

LY_STMT_LEAF_LIST 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_node_leaflist * lysc_ext_substmt.storage and lysc_ext_instance.parent - struct lysc_node_leaflist *

LY_STMT_LIST 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_node_list * lysc_ext_substmt.storage and lysc_ext_instance.parent - struct lysc_node_list *

LY_STMT_USES 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_node_uses * lysc_ext_substmt.storage and lysc_ext_instance.parent - struct lysc_node *

LY_STMT_ARGUMENT 

lysp_ext_substmt.storage - const char * lysp_ext_instance.parent - struct lysp_ext * lysc_ext_substmt.storage - const char * lysc_ext_instance.parent - struct lysc_ext *

LY_STMT_BASE 

lysp_ext_substmt.storage and lysp_ext_instance.parent - const char **[] lysc_ext_substmt.storage - not compiled lysc_ext_instance.parent - struct lysc_ident *

LY_STMT_BELONGS_TO 

lysp_ext_substmt.storage - const char * lysp_ext_instance.parent - struct lysp_submodule * lysc_ext_substmt.storage - not compiled lysc_ext_instance.parent - struct lysc_module *

LY_STMT_BIT 

lysp_ext_substmt.storage - struct lysp_type_enum *[] lysp_ext_instance.parent - struct lysp_type_enum * lysc_ext_substmt.storage - struct lysc_type_bitenum_item *[] lysc_ext_instance.parent - struct lysc_type_bitenum_item *

LY_STMT_CONFIG 

lysp_ext_substmt.storage and lysp_ext_instance.parent - uint16_t * lysc_ext_substmt.storage - uint16_t * lysc_ext_instance.parent - struct lysc_node *

LY_STMT_CONTACT 

lysp_ext_substmt.storage - const char * lysp_ext_instance.parent - struct lysp_(sub)module * lysc_ext_substmt.storage - const char * lysc_ext_instance.parent - struct lysc_module *

LY_STMT_DEFAULT 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_qname * lysc_ext_substmt.storage - not compiled lysc_ext_instance.parent - struct lysc_node *, struct lysc_type * (typedef)

LY_STMT_DESCRIPTION 

lysp_ext_substmt.storage and lysp_ext_instance.parent - const char * lysc_ext_substmt.storage - const char * lysc_ext_instance.parent - compiled parent statement

LY_STMT_DEVIATE 

lysp_ext_substmt.storage - struct lysp_deviate *[] lysp_ext_instance.parent - struct lysp_deviate * lysc_ext_substmt.storage and lysc_ext_instance.parent - not compiled

LY_STMT_DEVIATION 

lysp_ext_substmt.storage - struct lysp_deviation *[] lysp_ext_instance.parent - struct lysp_deviation * lysc_ext_substmt.storage - not compiled lysc_ext_instance.parent - struct lysc_node *

LY_STMT_ENUM 

lysp_ext_substmt.storage - struct lysp_type_enum *[] lysp_ext_instance.parent - struct lysp_type_enum * lysc_ext_substmt.storage - struct lysc_type_bitenum_item *[] lysc_ext_instance.parent - struct lysc_type_bitenum_item *

LY_STMT_ERROR_APP_TAG 

lysp_ext_substmt.storage - const char * lysp_ext_instance.parent - struct lysp_restr * lysc_ext_substmt.storage - const char * lysc_ext_instance.parent - compiled restriction structure

LY_STMT_ERROR_MESSAGE 

lysp_ext_substmt.storage - const char * lysp_ext_instance.parent - struct lysp_restr * lysc_ext_substmt.storage - const char * lysc_ext_instance.parent - compiled restriction structure

LY_STMT_EXTENSION 

lysp_ext_substmt.storage - struct lysp_ext *[] lysp_ext_instance.parent - struct lysp_ext * lysc_ext_substmt.storage - not compiled explicitly lysc_ext_instance.parent - struct lysc_ext *

LY_STMT_EXTENSION_INSTANCE 

lysp_ext_substmt.storage - struct lysp_ext_instance *[] lysc_ext_substmt.storage - struct lysc_ext_instance *[]

LY_STMT_FEATURE 

lysp_ext_substmt.storage - struct lysp_feature *[] lysp_ext_instance.parent - struct lysp_feature * lysc_ext_substmt.storage and lysc_ext_instance.parent - not compiled

LY_STMT_FRACTION_DIGITS 

lysp_ext_substmt.storage - uint8_t * lysp_ext_instance.parent - struct lysp_type * lysc_ext_substmt.storage - uint8_t * lysc_ext_instance.parent - struct lysc_type *

LY_STMT_IDENTITY 

lysp_ext_substmt.storage - struct lysp_ident *[] lysp_ext_instance.parent - struct lysp_ident * lysc_ext_substmt.storage - struct lysc_ident *[] lysc_ext_instance.parent - struct lysc_ident *

LY_STMT_IF_FEATURE 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_qname *[] lysc_ext_substmt.storage - no storage, evaluated when compiled lysc_ext_instance.parent - compiled parent statement

LY_STMT_IMPORT 

lysp_ext_substmt.storage - struct lysp_import *[] lysp_ext_instance.parent - struct lysp_import * lysc_ext_substmt.storage and lysc_ext_instance.parent - not compiled

LY_STMT_INCLUDE 

lysp_ext_substmt.storage - struct lysp_include *[] lysp_ext_instance.parent - struct lysp_include * lysc_ext_substmt.storage and lysc_ext_instance.parent - not compiled

LY_STMT_KEY 

lysp_ext_substmt.storage - const char * lysp_ext_instance.parent - struct lysp_node_list * lysc_ext_substmt.storage - const char * lysc_ext_instance.parent - struct lysc_node_list *

LY_STMT_LENGTH 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_restr * lysc_ext_substmt.storage and lysc_ext_instance.parent - struct lysc_range *

LY_STMT_MANDATORY 

lysp_ext_substmt.storage and lysp_ext_instance.parent - uint16_t * lysc_ext_substmt.storage - uint16_t * lysc_ext_instance.parent - struct lysc_node *

LY_STMT_MAX_ELEMENTS 

lysp_ext_substmt.storage and lysp_ext_instance.parent - uint32_t * lysc_ext_substmt.storage - uint32_t * lysc_ext_instance.parent - struct lysc_node_list *

LY_STMT_MIN_ELEMENTS 

lysp_ext_substmt.storage and lysp_ext_instance.parent - uint32_t * lysc_ext_substmt.storage - uint32_t * lysc_ext_instance.parent - struct lysc_node_list *

LY_STMT_MODIFIER 

lysp_ext_substmt.storage - const char * lysp_ext_instance.parent - struct lysp_restr * lysc_ext_substmt.storage - const char * lysc_ext_instance.parent - struct lysc_pattern *

LY_STMT_MODULE 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_module * lysc_ext_substmt.storage - not compiled lysc_ext_instance.parent - struct lysc_module *

LY_STMT_MUST 

lysp_ext_substmt.storage - struct lysp_restr *[] lysp_ext_instance.parent - struct lysp_restr * lysc_ext_substmt.storage - struct lysc_must *[] lysc_ext_instance.parent - struct lysc_must *

LY_STMT_NAMESPACE 

lysp_ext_substmt.storage - const char * lysp_ext_instance.parent - struct lysp_module * lysc_ext_substmt.storage - const char * lysc_ext_instance.parent - struct lysc_module *

LY_STMT_ORDERED_BY 

lysp_ext_substmt.storage - uint16_t * lysp_ext_instance.parent - struct lysp_node * lysc_ext_substmt.storage - uint16_t * lysc_ext_instance.parent - struct lysc_node *

LY_STMT_ORGANIZATION 

lysp_ext_substmt.storage - const char * lysp_ext_instance.parent - struct lysp_(sub)module * lysc_ext_substmt.storage - const char * lysc_ext_instance.parent - struct lysc_module *

LY_STMT_PATH 

lysp_ext_substmt.storage - struct lyxp_expr * lysp_ext_instance.parent - struct lysp_type * lysc_ext_substmt.storage - not compiled lysc_ext_instance.parent - struct lysc_type *

LY_STMT_PATTERN 

lysp_ext_substmt.storage - struct lysp_restr *[] lysp_ext_instance.parent - struct lysp_restr * lysc_ext_substmt.storage - struct lysc_pattern **[] lysc_ext_instance.parent - struct lysc_pattern *

LY_STMT_POSITION 

lysp_ext_substmt.storage - int64_t * lysp_ext_instance.parent - struct lysp_type_enum * lysc_ext_substmt.storage - int64_t * lysc_ext_instance.parent - struct lysc_type_bitenum_item *

LY_STMT_PREFIX 

lysp_ext_substmt.storage and lysp_ext_instance.parent - const char * lysc_ext_substmt.storage - not compiled lysc_ext_instance.parent - struct lysc_module *

LY_STMT_PRESENCE 

lysp_ext_substmt.storage and lysp_ext_instance.parent - const char * lysc_ext_substmt.storage - const char * lysc_ext_instance.parent - struct lysc_node_container *

LY_STMT_RANGE 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_restr * lysc_ext_substmt.storage and lysc_ext_instance.parent - struct lysc_range *

LY_STMT_REFERENCE 

lysp_ext_substmt.storage and lysp_ext_instance.parent - const char * lysc_ext_substmt.storage - const char * lysc_ext_instance.parent - compiled parent statement

LY_STMT_REFINE 

lysp_ext_substmt.storage - struct lysp_refine *[] lysp_ext_instance.parent - struct lysp_refine * lysc_ext_substmt.storage - not compiled lysc_ext_instance.parent - struct lysc_node *

LY_STMT_REQUIRE_INSTANCE 

lysp_ext_substmt.storage - uint8_t * lysp_ext_instance.parent - struct lysp_type * lysc_ext_substmt.storage - uint8_t * lysc_ext_instance.parent - struct lysc_type *

LY_STMT_REVISION 

lysp_ext_substmt.storage - struct lysp_revision *[] lysp_ext_instance.parent - struct lysp_revision * lysc_ext_substmt.storage and lysc_ext_instance.parent - not compiled

LY_STMT_REVISION_DATE 

lysp_ext_substmt.storage and lysp_ext_instance.parent - const char * lysc_ext_substmt.storage and lysc_ext_instance.parent - not compiled

LY_STMT_STATUS 

lysp_ext_substmt.storage and lysp_ext_instance.parent - uint16_t * lysc_ext_substmt.storage - uint16_t * lysc_ext_instance.parent - compiled parent statement

LY_STMT_SUBMODULE 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_submodule * lysc_ext_substmt.storage - not compiled lysc_ext_instance.parent - struct lysc_module *

LY_STMT_TYPE 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_type * lysc_ext_substmt.storage and lysc_ext_instance.parent - struct lysc_type *

LY_STMT_TYPEDEF 

lysp_ext_substmt.storage - struct lysp_tpdf *[] lysp_ext_instance.parent - struct lysp_tpdf * lysc_ext_substmt.storage - not compiled lysc_ext_instance.parent - struct lysc_type *

LY_STMT_UNIQUE 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_qname *[] lysc_ext_substmt.storage - not compiled lysc_ext_instance.parent - struct lysc_node_list *

LY_STMT_UNITS 

lysp_ext_substmt.storage and lysp_ext_instance.parent - const char * lysc_ext_substmt.storage - const char * lysc_ext_instance.parent - struct lysc_node *, struct lysc_type * (typedef)

LY_STMT_VALUE 

lysp_ext_substmt.storage - int64_t * lysp_ext_instance.parent - struct lysp_type_enum * lysc_ext_substmt.storage - int64_t * lysc_ext_instance.parent - struct lysc_type_bitenum_item *

LY_STMT_WHEN 

lysp_ext_substmt.storage and lysp_ext_instance.parent - struct lysp_when * lysc_ext_substmt.storage and lysc_ext_instance.parent - struct lysc_when *

LY_STMT_YANG_VERSION 

lysp_ext_substmt.storage - uint8_t * lysp_ext_instance.parent - struct lysp_(sub)module * lysc_ext_substmt.storage - not compiled lysc_ext_instance.parent - struct lysc_module *

LY_STMT_YIN_ELEMENT 

lysp_ext_substmt.storage - uint16_t * lysp_ext_instance.parent - struct lysp_ext * lysc_ext_substmt.storage - not compiled lysc_ext_instance.parent - struct lysc_ext *

LY_STMT_SYNTAX_SEMICOLON 
LY_STMT_SYNTAX_LEFT_BRACE 
LY_STMT_SYNTAX_RIGHT_BRACE 
LY_STMT_ARG_TEXT 
LY_STMT_ARG_VALUE 

Definition at line 143 of file plugins_exts.h.

Function Documentation

◆ 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 ::lys_compile_extension_instance().

Parameters
[in]ctxlibyang context
[in]substmtsExtension instance substatements to free.

◆ 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.

Uses standard libyang schema compiler to transform YANG statements into the compiled schema structures. The plugins are supposed to use this function when the extension instance's substatements are supposed to be compiled in a standard way (or if just the Schema compile flags are enough to modify the compilation process).

Parameters
[in]ctxCompile context.
[in]extpParsed representation of the extension instance being processed.
[in,out]extCompiled extension instance with the prepared lysc_ext_instance.substmts array, which will be updated by storing the compiled data.
Returns
LY_SUCCESS on success.
LY_EVALID if compilation of the substatements fails.
LY_ENOT if the extension is disabled (by if-feature) and should be ignored.

◆ 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.

Parameters
[in]ctxYANG schema compilation context.
Returns
libyang context connected with the compilation 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.

Parameters
[in]ctxYANG schema compilation context.
Returns
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.

Parameters
[in]ctxYANG schema compilation context.
Returns
pointer to the compilation options to allow modifying them with Schema compile flags values.

◆ 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.

Parameters
[in]ctxYANG schema compilation context.
Returns
Currently processed module.

◆ 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_no,
const char *  format,
  ... 
)

Log a message from an extension plugin using the compiled extension instance.

Parameters
[in]cctxOptional compile context to generate the path from.
[in]extCompiled extension instance.
[in]levelLog message level (error, warning, etc.)
[in]err_noError type code.
[in]formatFormat string to print.

◆ 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_no,
const char *  format,
  ... 
)

Log a message from an extension plugin using the compiled extension instance with an explicit error path.

Parameters
[in]pathLog error path to use.
[in]extCompiled extension instance.
[in]levelLog message level (error, warning, etc.)
[in]err_noError type code.
[in]formatFormat string to print.

◆ 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().

Parameters
[in]ctxContext with the callback.
[in]extCompiled extension instance.
[out]ext_dataProvided extension instance data.
[out]ext_data_freeWhether the extension instance should free ext_data or not.
Returns
LY_SUCCESS on success.
LY_ERR on error.

◆ 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.

Parameters
[in]extCompiled ext instance.
[in]stmtCompiled statement. Can be a mask when the first match is returned, it is expected the storage is the same for all the masked statements.
[in]storage_sizeSize of the value at storage address (dereferenced).
[out]storageCompiled ext instance substatement storage, NULL if was not compiled.
Returns
LY_SUCCESS on success.
LY_ENOT if the substatement is not supported.

◆ 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.

Parameters
[in]parentParent node to insert into.
[in]firstFirst top-level sibling node to insert.
Returns
LY_SUCCESS on success.
LY_ERR error on error.

◆ lyplg_ext_nodetype2stmt()

LIBYANG_API_DECL enum ly_stmt lyplg_ext_nodetype2stmt ( uint16_t  nodetype)

Convert nodetype to statement identifier.

Parameters
[in]nodetypeNodetype to convert.
Returns
Statement identifier representing the given nodetype.

◆ 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.

Uses standard libyang schema compiler to transform YANG statements into the parsed schema structures. The plugins are supposed to use this function when the extension instance's substatements can be parsed in a standard way.

Parameters
[in]pctxParse context.
[in,out]extParsed extension instance with the prepared lysp_ext_instance.substmts array, which will be updated by storing the parsed data.
Returns
LY_SUCCESS on success.
LY_ERR error on error.

◆ 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.

Parameters
[in]pctxParse context.
Returns
Current (local) parse mod.

◆ 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_no,
const char *  format,
  ... 
)

Log a message from an extension plugin using the parsed extension instance.

Parameters
[in]pctxParse context to use.
[in]extParsed extensiopn instance.
[in]levelLog message level (error, warning, etc.)
[in]err_noError type code.
[in]formatFormat string to print.
[in]...Format variable parameters.

◆ 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.

Parameters
[in]extCompiled ext instance.
[in]stmtParsed statement. Can be a mask when the first match is returned, it is expected the storage is the same for all the masked statements.
[in]storage_sizeSize of the value at storage address (dereferenced).
[out]storageParsed ext instance substatement storage, NULL if was not parsed.
Returns
LY_SUCCESS on success.
LY_ENOT if the substatement is not supported.

◆ 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 ::lys_parse_extension_instance().

Parameters
[in]ctxlibyang context
[in]substmtsExtension instance substatements to free.

◆ 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.

Parameters
[in]ctxYANG printer context.
Returns
pointer to the printer's indentation level to allow modifying its value.

◆ 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.

Parameters
[in]ctxYANG printer context.
Returns
pointer to the printer options to allow modifying them with Schema output options values.

◆ 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.

Parameters
[in]ctxYANG printer context.
Returns
Output handler where the data are being printed. Note that the address of the handler pointer in the context is returned to allow to modify the handler.

◆ 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).

Generic function to access YANG printer functions from the extension plugins (lyplg_ext_sprinter_info_clb).

Parameters
[in]ctxYANG printer context to provide output handler and other information for printing.
[in]extThe compiled extension instance to access the extensions and substatements data.
[in,out]flagFlag to be shared with the caller regarding the opening brackets - 0 if the '{' not yet printed, 1 otherwise.

◆ 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. Caller is responsible for destroying the resulting context.

Parameters
[in]extCompiled extension instance.
[out]ctxA context with modules loaded from the list found in the extension data.
Returns
LY_ERR value.

◆ 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.

Parameters
[in]extContext allocated for extension.
[out]refsSet of schema node matching parent-reference XPaths.
Returns
LY_ERR value.

◆ 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.

Parameters
[in]ctxContext of printer_tree in which the group of nodes is saved and later printed.
[in]extExtension in which the group of nodes will be searched.
[in]clbOverride function that will be applied to each delivered node.
Returns
LY_ERR value.

◆ 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.

Parameters
[in]ctxContext of printer_tree in which the group of nodes is saved and later printed.
[in]nodesPoints to the first node in group.
[in]clbOverride function that will be applied to each delivered node.
Returns
LY_ERR value.

◆ 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.

Parameters
[in]ctxContext of printer_tree in which the group of nodes is saved and later printed.
[in]extExtension in which the group of nodes will be searched.
[in]clbOverride function that will be applied to each delivered node.
Returns
LY_ERR value.

◆ 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.

Parameters
[in]ctxContext of printer_tree in which the group of nodes is saved and later printed.
[in]nodesPoints to the first node in group.
[in]clbOverride function that will be applied to each delivered node.
Returns
LY_ERR value.

◆ 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(*)(void *plugin_priv)  free_clb 
)

Registration of plugin-private data defined by the plugin that is shared between override_clb calls.

Parameters
[in]ctxContext of printer_tree in which plugin-private data will be saved.
[in]plugin_privPlugin-private data shared between oberride_clb calls.
[in]free_clbRelease function for plugin_priv.
Returns
LY_ERR value.

◆ lyplg_ext_stmt2str()

LIBYANG_API_DECL const char * lyplg_ext_stmt2str ( enum ly_stmt  stmt)

Stringify statement identifier.

Parameters
[in]stmtThe statement identifier to stringify.
Returns
Constant string representation of the given stmt.