![]() |
libyang
4.0.2
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
|
Modules | |
Plugins: Extensions compilation support | |
Plugins: Extensions parsing support | |
Plugins: Extensions schema info printer support | |
Plugins: Extensions schema parsed and compiled tree printer support | |
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 9 |
Extensions API version. More... | |
#define | LYPLG_EXTENSIONS |
Macro to define plugin information in external plugins. More... | |
Typedefs | |
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_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. More... | |
typedef 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, do not define this callback. More... | |
typedef void(* | lyplg_ext_data_node_xpath_clb )(struct lysc_ext_instance *ext, const struct lyd_node *tree, const struct lyd_node **node) |
Callback for getting the first child data node of an XPath document root of 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, uint32_t prefix_len, LY_VALUE_FORMAT format, void *prefix_data, const char *name, uint32_t name_len, ly_bool in_xpath, const struct lysc_node **snode) |
Callback for getting a schema node for new YANG instance data described by an extension instance. Needed only if the extension instance defines some instantiable YANG data nodes. 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 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... | |
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 lyplg_ext_compile_extension_instance(). More... | |
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. More... | |
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. More... | |
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 substatements array. More... | |
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. More... | |
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(). 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_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 lyplg_ext_parse_extension_instance(). More... | |
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. Caller is responsible for freeing the created context. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
LIBYANG_API_DECL const char * | lyplg_ext_stmt2str (enum ly_stmt stmt) |
Stringify statement identifier. More... | |
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.
struct lyplg_ext |
Extension plugin implementing various aspects of a YANG extension.
Every plugin should have at least either ::parse() or ::compile() callback defined but other than that all the callbacks are optional.
Definition at line 1030 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 |
lyplg_ext_compiled_print_clb | compiled_print |
callback to print the compiled structure into a pre-allocated memory chunk |
lyplg_ext_compiled_size_clb | compiled_size |
callback to get size of the custom compiled structure and substmts |
const char * | id |
plugin identification (mainly for distinguish incompatible versions of the plugins for external tools) |
lyplg_ext_data_node_xpath_clb | node_xpath |
callback to get first XPath document root child node |
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 a compiled node |
lyplg_ext_sprinter_info_clb | printer_info |
callback to print the compiled content (info format) |
lyplg_ext_sprinter_ptree_clb | printer_ptree |
callback to print tree format of a parsed node |
lyplg_ext_data_snode_clb | snode |
callback to get schema node in various use-cases |
lyplg_ext_data_validate_clb | validate |
callback to validate parsed data instances |
struct lyplg_ext_record |
Definition at line 1049 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. |
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) |
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_p |
pointer to the compiled storage of the statement according to the specific lys_ext_substmt::stmt |
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_instance * | exts |
list of the extension instances (sized array) |
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 |
uintptr_t | plugin_ref |
reference to extension plugin, use lysc_get_ext_plugin() to get the plugin |
void * | prefix_data |
format-specific data for prefix resolution (see ly_resolve_prefix()) |
struct lysp_ext_substmt * | substmts |
list of supported known YANG statements with the pointer to their parsed data (sized array) |
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_p |
pointer to the parsed storage of the statement according to the specific lys_ext_substmt::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 |
#define LY_STMT_DATA_NODE_MASK |
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.
#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.
#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.
#define LYPLG_EXT_API_VERSION 9 |
Extensions API version.
Definition at line 112 of file plugins_exts.h.
#define LYPLG_EXTENSIONS |
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 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.
[in] | ctx | libyang context. |
[in,out] | ext | Compiled extension structure to free. |
Definition at line 931 of file plugins_exts.h.
typedef 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.
[in] | orig_ext | Compiled extension structure to print. |
[in,out] | ext | Printed extension structure to modify. |
[in,out] | mem | Memory chunk of the size returned by lyplg_ext_compiled_size_clb() to print into, is moved after all the printed data. |
[in,out] | ptr_set | Set with pointers to set to printed addresses. |
[in,out] | addr_ht | Hash table with pairs of addresses of shared structures to be printed and their printed addresses, can be added to. |
Definition at line 983 of file plugins_exts.h.
typedef 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, do not define this callback.
[in] | ext | Compiled extension structure. |
[in,out] | addr_ht | Hash table with addresses of shared structures that were already accounted for, can be added to. |
Definition at line 954 of file plugins_exts.h.
typedef void(* lyplg_ext_data_node_xpath_clb)(struct lysc_ext_instance *ext, const struct lyd_node *tree, const struct lyd_node **node) |
Callback for getting the first child data node of an XPath document root of the extension instance.
[in] | ext | Compiled extension instance. |
[in] | tree | Whole data tree. |
[out] | node | First XPath document root child node, if any. |
Definition at line 836 of file plugins_exts.h.
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, uint32_t prefix_len, LY_VALUE_FORMAT format, void *prefix_data, const char *name, uint32_t name_len, ly_bool in_xpath, const struct lysc_node **snode) |
Callback for getting a schema node for new YANG instance data described by an extension instance. Needed only if the extension instance defines some instantiable YANG data nodes.
1) Schema nodes are compiled and connected to each other:
2) YANG instance data is being parsed:
in_xpath
0;3) XPath expression is being evaluated during schema compilation (must, when, leafref path, unique):
in_xpath
1;[in] | ext | Compiled extension instance. |
[in] | parent | Parsed parent data node. |
[in] | sparent | Schema parent node. |
[in] | prefix | Element prefix, if any. |
[in] | prefix_len | Length of prefix . |
[in] | format | Format of prefix . |
[in] | prefix_data | Format-specific prefix data. |
[in] | name | Element name. If NULL, the first node should be returned (top-level, parent and sparent will not be set). |
[in] | name_len | Length of name . |
[in] | in_xpath | Whether we are in an XPath accessible tree context or standard YANG data handling (parsing). |
[out] | snode | Schema node to use for parsing the node. |
ext
. Definition at line 875 of file plugins_exts.h.
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).
[in] | ext | Compiled extension instance. |
[in] | sibling | First sibling with schema node returned by lyplg_ext_data_snode_clb. |
[in] | dep_tree | Tree to be used for validating references from the operation subtree, if operation. |
[in] | data_type | Validated data type, can be LYD_TYPE_DATA_YANG, LYD_TYPE_RPC_YANG, LYD_TYPE_NOTIF_YANG, or LYD_TYPE_REPLY_YANG. |
[in] | val_opts | Validation options, see Data validation options. |
[out] | diff | Optional diff with any changes made by the validation. |
Definition at line 898 of file plugins_exts.h.
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.
[in] | ctx | libyang context. |
[in,out] | ext | Parsed extension structure to free. |
Definition at line 911 of file plugins_exts.h.
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 - |
LY_STMT_INPUT |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_OUTPUT |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_ACTION |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_RPC |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_ANYDATA |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_ANYXML |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_AUGMENT |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_CASE |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_CHOICE |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_CONTAINER |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_GROUPING |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_LEAF |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_LEAF_LIST |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_LIST |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_USES |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_ARGUMENT |
::lysp_ext_substmt.storage - |
LY_STMT_BASE |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_BELONGS_TO |
::lysp_ext_substmt.storage - |
LY_STMT_BIT |
::lysp_ext_substmt.storage - |
LY_STMT_CONFIG |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_CONTACT |
::lysp_ext_substmt.storage - |
LY_STMT_DEFAULT |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_DESCRIPTION |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_DEVIATE |
::lysp_ext_substmt.storage - |
LY_STMT_DEVIATION |
::lysp_ext_substmt.storage - |
LY_STMT_ENUM |
::lysp_ext_substmt.storage - |
LY_STMT_ERROR_APP_TAG |
::lysp_ext_substmt.storage - |
LY_STMT_ERROR_MESSAGE |
::lysp_ext_substmt.storage - |
LY_STMT_EXTENSION |
::lysp_ext_substmt.storage - |
LY_STMT_EXTENSION_INSTANCE |
::lysp_ext_substmt.storage - |
LY_STMT_FEATURE |
::lysp_ext_substmt.storage - |
LY_STMT_FRACTION_DIGITS |
::lysp_ext_substmt.storage - |
LY_STMT_IDENTITY |
::lysp_ext_substmt.storage - |
LY_STMT_IF_FEATURE |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_IMPORT |
::lysp_ext_substmt.storage - |
LY_STMT_INCLUDE |
::lysp_ext_substmt.storage - |
LY_STMT_KEY |
::lysp_ext_substmt.storage - |
LY_STMT_LENGTH |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_MANDATORY |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_MAX_ELEMENTS |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_MIN_ELEMENTS |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_MODIFIER |
::lysp_ext_substmt.storage - |
LY_STMT_MODULE |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_MUST |
::lysp_ext_substmt.storage - |
LY_STMT_NAMESPACE |
::lysp_ext_substmt.storage - |
LY_STMT_ORDERED_BY |
::lysp_ext_substmt.storage - |
LY_STMT_ORGANIZATION |
::lysp_ext_substmt.storage - |
LY_STMT_PATH |
::lysp_ext_substmt.storage - |
LY_STMT_PATTERN |
::lysp_ext_substmt.storage - |
LY_STMT_POSITION |
::lysp_ext_substmt.storage - |
LY_STMT_PREFIX |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_PRESENCE |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_RANGE |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_REFERENCE |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_REFINE |
::lysp_ext_substmt.storage - |
LY_STMT_REQUIRE_INSTANCE |
::lysp_ext_substmt.storage - |
LY_STMT_REVISION |
::lysp_ext_substmt.storage - |
LY_STMT_REVISION_DATE |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_STATUS |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_SUBMODULE |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_TYPE |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_TYPEDEF |
::lysp_ext_substmt.storage - |
LY_STMT_UNIQUE |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_UNITS |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_VALUE |
::lysp_ext_substmt.storage - |
LY_STMT_WHEN |
::lysp_ext_substmt.storage and lysp_ext_instance.parent - |
LY_STMT_YANG_VERSION |
::lysp_ext_substmt.storage - |
LY_STMT_YIN_ELEMENT |
::lysp_ext_substmt.storage - |
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.
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().
[in] | ctx | libyang context |
[in] | substmts | Extension instance substatements to free. |
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.
[in,out] | addr_ht | Hash table with pairs of addresses of shared structures to be printed and their printed addresses, is added to. |
[in] | orig_addr | Address of the original shared structure that was printed. |
[in] | addr | Address of the printed structure to be reused. |
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.
[in] | addr_ht | Hash table with all the printed addresses of shared structures. |
[in] | addr | Address of the original shared structure to be printed. |
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 substatements array.
[in] | orig_substmts | Extension instance substatements to print. |
[in,out] | substmts | Serialized extension structure substatements whose storage to modify. |
[in,out] | addr_ht | Hash table with pairs of addresses of shared structures to be printed and their printed addresses, can be added to. |
[in,out] | ptr_set | Set with pointers to set to printed addresses. |
[in,out] | mem | Memory chunk to print into, is moved after all the printed data. |
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.
[in] | substmts | Compiled extension instance substatements array. |
[in,out] | addr_ht | Hash table with addresses of shared structures that were already accounted for, can be added to. |
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().
[in] | ctx | Context with the callback. |
[in] | ext | Compiled extension instance. |
[in] | parent | Data parent node instance of a schema node with ext instance. |
[out] | ext_data | Provided extension instance data. |
[out] | ext_data_free | Whether the extension instance should free ext_data or not. |
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.
[in] | ext | Compiled ext instance. |
[in] | stmt | Compiled 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_size | Size of the value at storage address (dereferenced). |
[out] | storage | Compiled ext instance substatement storage, NULL if was not compiled. |
Insert extension instance data into a parent.
[in] | parent | Parent node to insert into. |
[in] | first | First top-level sibling node to insert. |
LIBYANG_API_DECL enum ly_stmt lyplg_ext_nodetype2stmt | ( | uint16_t | nodetype | ) |
Convert nodetype to statement identifier.
[in] | nodetype | Nodetype to convert. |
nodetype
. 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.
[in] | ext | Compiled ext instance. |
[in] | stmt | Parsed 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_size | Size of the value at storage address (dereferenced). |
[out] | storage | Parsed ext instance substatement storage, NULL if was not parsed. |
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().
[in] | ctx | libyang context |
[in] | substmts | Extension instance substatements to free. |
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. Caller is responsible for freeing the created context.
[in] | ext | Compiled extension instance. |
[in] | parent | Data parent node instance of a schema node with ext instance. |
[out] | ctx | Context with modules loaded from the list found in the extension data. |
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.
Does nothing if the mount point is not shared or if the context already exists.
For printed contexts (read-only), all shared contexts must be created beforehand by calling this function as they cannot be created once the context is printed.
[in] | ext | Compiled extension instance of a schema mount point. |
[in] | ext_data | ietf-yang-schema-mount and ietf-yang-library YANG data for the ext mount point. |
ext
mount point data was not found in ext_data
, other LY_ERR value otherwise. 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.
For standard contexts this is done automatically when the context is destroyed. Useful when using a long-lived libyang context for cleaning up memory after completing operations with schema mount extension data that require inline contexts.
Inline contexts are currently not supported in printed contexts.
[in] | ext | Compiled extension instance of a schema mount point. All the inline schema mount contexts that belong to the same libyang context as ext will be destroyed. |
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.
For standard contexts this is done automatically when the context is destroyed.
For printed contexts (read-only), all shared contexts must be destroyed by calling this function as otherwise they will be lost once the original context is destroyed.
[in] | ext | Compiled extension instance of a schema mount point. All the shared schema mount contexts that belong to the same libyang context as ext will be destroyed. |
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.
[in] | ext | Context allocated for extension. |
[in] | parent | Data parent node instance of a schema node with ext instance. |
[out] | refs | Set of schema node matching parent-reference XPaths. |
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.
[in] | ctx | Context to change. |
[in] | parent_ctx | Parent context to set. |
LIBYANG_API_DECL const char* lyplg_ext_stmt2str | ( | enum ly_stmt | stmt | ) |
Stringify statement identifier.
[in] | stmt | The statement identifier to stringify. |
stmt
.