libyang  2.2.8
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Tree
Collaboration diagram for Data Tree:

Modules

 Data compare options
 
 Data diff merge options.
 
 Data diff options.
 
 Data duplication options
 
 Data merge options.
 
 Data node flags
 
 Data operation type
 
 Data parser options
 
 Data printer flags
 
 Data validation options
 
 Implicit node creation options
 
 New value creation options
 
 Node type format hints
 
 Value and node type format hints
 
 Value format hints.
 

Macros

#define LYD_CTX(node)   ((node)->schema ? (node)->schema->module->ctx : ((const struct lyd_node_opaq *)(node))->ctx)
 Macro to get context from a data tree node. More...
 
#define LYD_LIST_FOR_INST(START, SCHEMA, ELEM)
 Macro to iterate via all schema node data instances in data siblings. More...
 
#define LYD_LIST_FOR_INST_SAFE(START, SCHEMA, NEXT, ELEM)
 Macro to iterate via all schema node data instances in data siblings allowing to modify the list itself. More...
 
#define LYD_NODE_IS_ALONE(NODE)
 Find out if the node is the only instance, i.e. it has no siblings with the same schema. More...
 
#define LYD_TREE_DFS_BEGIN(START, ELEM)
 Macro to iterate via all elements in a data tree. This is the opening part to the LYD_TREE_DFS_END - they always have to be used together. More...
 
#define LYD_TREE_DFS_END(START, ELEM)
 Macro to iterate via all elements in a tree. This is the closing part to the LYD_TREE_DFS_BEGIN - they always have to be used together. More...
 

Enumerations

enum  LYD_ANYDATA_VALUETYPE {
  LYD_ANYDATA_DATATREE, LYD_ANYDATA_STRING, LYD_ANYDATA_XML, LYD_ANYDATA_JSON,
  LYD_ANYDATA_LYB
}
 List of possible value types stored in lyd_node_any. More...
 
enum  LYD_FORMAT { LYD_UNKNOWN = 0, LYD_XML, LYD_JSON, LYD_LYB }
 Data input/output formats supported by libyang parser and printer functions. More...
 

Functions

LIBYANG_API_DECL LY_ERR lyd_parse_data (const struct ly_ctx *ctx, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format, uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree)
 Parse (and validate) data from the input handler as a YANG data tree. More...
 
LIBYANG_API_DECL LY_ERR lyd_parse_data_fd (const struct ly_ctx *ctx, int fd, LYD_FORMAT format, uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree)
 Parse (and validate) input data as a YANG data tree. More...
 
LIBYANG_API_DECL LY_ERR lyd_parse_data_mem (const struct ly_ctx *ctx, const char *data, LYD_FORMAT format, uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree)
 Parse (and validate) input data as a YANG data tree. More...
 
LIBYANG_API_DECL LY_ERR lyd_parse_data_path (const struct ly_ctx *ctx, const char *path, LYD_FORMAT format, uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree)
 Parse (and validate) input data as a YANG data tree. More...
 
LIBYANG_API_DECL LY_ERR lyd_parse_ext_data (const struct lysc_ext_instance *ext, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format, uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree)
 Parse (and validate) data from the input handler as an extension data tree following the schema tree of the given extension instance. More...
 
LIBYANG_API_DECL LY_ERR lyd_parse_ext_op (const struct lysc_ext_instance *ext, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format, enum lyd_type data_type, struct lyd_node **tree, struct lyd_node **op)
 Parse extension data into an operation data tree following only the specification from the given extension instance. More...
 
LIBYANG_API_DECL LY_ERR lyd_parse_op (const struct ly_ctx *ctx, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format, enum lyd_type data_type, struct lyd_node **tree, struct lyd_node **op)
 Parse YANG data into an operation data tree. Specific parsing flags LYD_PARSE_ONLY, LYD_PARSE_STRICT and no validation flags are used. More...
 
LIBYANG_API_DECL LY_ERR lyd_validate_all (struct lyd_node **tree, const struct ly_ctx *ctx, uint32_t val_opts, struct lyd_node **diff)
 Fully validate a data tree. More...
 
LIBYANG_API_DECL LY_ERR lyd_validate_module (struct lyd_node **tree, const struct lys_module *module, uint32_t val_opts, struct lyd_node **diff)
 Fully validate a data tree of a module. More...
 
LIBYANG_API_DECL LY_ERR lyd_validate_module_final (struct lyd_node *tree, const struct lys_module *module, uint32_t val_opts)
 Finish validation of a module data that have previously been validated with LYD_VALIDATE_NOT_FINAL flag. More...
 
LIBYANG_API_DECL LY_ERR lyd_validate_op (struct lyd_node *op_tree, const struct lyd_node *dep_tree, enum lyd_type data_type, struct lyd_node **diff)
 Validate an RPC/action request, reply, or notification. Only the operation data tree (input/output/notif) is validate, any parents are ignored. More...
 

Detailed Description

Data structures and functions to manipulate and access instance data tree.

Macro Definition Documentation

#define LYD_CTX (   node)    ((node)->schema ? (node)->schema->module->ctx : ((const struct lyd_node_opaq *)(node))->ctx)

Macro to get context from a data tree node.

Definition at line 527 of file tree_data.h.

#define LYD_LIST_FOR_INST (   START,
  SCHEMA,
  ELEM 
)
Value:
for (lyd_find_sibling_val(START, SCHEMA, NULL, 0, &(ELEM)); \
(ELEM) && ((ELEM)->schema == (SCHEMA)); \
(ELEM) = (ELEM)->next)
LIBYANG_API_DECL LY_ERR lyd_find_sibling_val(const struct lyd_node *siblings, const struct lysc_node *schema, const char *key_or_value, size_t val_len, struct lyd_node **match)
Search in the given siblings for the first schema instance. Uses hashes - should be used whenever pos...

Macro to iterate via all schema node data instances in data siblings.

Parameters
STARTPointer to the starting sibling. Even if it is not first, all the siblings are searched.
SCHEMASchema node of the searched instances.
ELEMIterator.

Definition at line 504 of file tree_data.h.

#define LYD_LIST_FOR_INST_SAFE (   START,
  SCHEMA,
  NEXT,
  ELEM 
)
Value:
for ((NEXT) = (ELEM) = NULL, lyd_find_sibling_val(START, SCHEMA, NULL, 0, &(ELEM)); \
(ELEM) && ((ELEM)->schema == (SCHEMA)) ? ((NEXT) = (ELEM)->next, 1) : 0; \
(ELEM) = (NEXT))
LIBYANG_API_DECL LY_ERR lyd_find_sibling_val(const struct lyd_node *siblings, const struct lysc_node *schema, const char *key_or_value, size_t val_len, struct lyd_node **match)
Search in the given siblings for the first schema instance. Uses hashes - should be used whenever pos...

Macro to iterate via all schema node data instances in data siblings allowing to modify the list itself.

Parameters
STARTPointer to the starting sibling. Even if it is not first, all the siblings are searched.
SCHEMASchema node of the searched instances.
NEXTTemporary storage to allow removing of the current iterator content.
ELEMIterator.

Definition at line 517 of file tree_data.h.

#define LYD_NODE_IS_ALONE (   NODE)
Value:
(((NODE)->prev == NODE) || \
(((NODE)->prev->schema != (NODE)->schema) && (!(NODE)->next || ((NODE)->schema != (NODE)->next->schema))))

Find out if the node is the only instance, i.e. it has no siblings with the same schema.

Parameters
[in]NODEPointer to the struct lyd_node.
Returns
1 NODE is a single instance (is alone).
0 NODE is not alone.

Definition at line 536 of file tree_data.h.

#define LYD_TREE_DFS_BEGIN (   START,
  ELEM 
)
Value:
{ ly_bool LYD_TREE_DFS_continue = 0; struct lyd_node *LYD_TREE_DFS_next; \
for ((ELEM) = (LYD_TREE_DFS_next) = (struct lyd_node *)(START); \
(ELEM); \
(ELEM) = (LYD_TREE_DFS_next), LYD_TREE_DFS_continue = 0)
Generic structure for a data node.
Definition: tree_data.h:799
uint8_t ly_bool
Type to indicate boolean value.
Definition: log.h:28

Macro to iterate via all elements in a data tree. This is the opening part to the LYD_TREE_DFS_END - they always have to be used together.

The function follows deep-first search algorithm:

    1
   / \
  2   4
 /   / \
3   5   6

Use the same parameters for LYD_TREE_DFS_BEGIN and LYD_TREE_DFS_END. While START can be any of the lyd_node* types, ELEM variable must be a pointer to the generic struct lyd_node.

To skip a particular subtree, instead of the continue statement, set LYD_TREE_DFS_continue variable to non-zero value.

Use with opening curly bracket '{' after the macro.

Parameters
STARTPointer to the starting element processed first.
ELEMIterator intended for use in the block.

Definition at line 450 of file tree_data.h.

#define LYD_TREE_DFS_END (   START,
  ELEM 
)
Value:
/* select element for the next run - children first */ \
if (LYD_TREE_DFS_continue) { \
(LYD_TREE_DFS_next) = NULL; \
} else { \
(LYD_TREE_DFS_next) = lyd_child(ELEM); \
}\
if (!(LYD_TREE_DFS_next)) { \
/* no children */ \
if ((ELEM) == (struct lyd_node *)(START)) { \
/* we are done, (START) has no children */ \
break; \
} \
/* try siblings */ \
(LYD_TREE_DFS_next) = (ELEM)->next; \
} \
while (!(LYD_TREE_DFS_next)) { \
/* parent is already processed, go to its sibling */ \
(ELEM) = (struct lyd_node *)(ELEM)->parent; \
/* no siblings, go back through parents */ \
if ((ELEM)->parent == (START)->parent) { \
/* we are done, no next element to process */ \
break; \
} \
(LYD_TREE_DFS_next) = (ELEM)->next; \
} }
Generic structure for a data node.
Definition: tree_data.h:799
struct lyd_node_inner * parent
Definition: tree_data.h:806
if((v1->size!=v2->size)||memcmp(v1->data, v2->data, v1->size))
Definition: binary.c:372

Macro to iterate via all elements in a tree. This is the closing part to the LYD_TREE_DFS_BEGIN - they always have to be used together.

Use the same parameters for LYD_TREE_DFS_BEGIN and LYD_TREE_DFS_END. While START can be any of the lyd_node* types, ELEM variable must be a pointer to the generic struct lyd_node.

Use with closing curly bracket '}' after the macro.

Parameters
STARTPointer to the starting element processed first.
ELEMIterator intended for use in the block.

Definition at line 470 of file tree_data.h.

Enumeration Type Documentation

List of possible value types stored in lyd_node_any.

Enumerator
LYD_ANYDATA_DATATREE 

Value is a pointer to lyd_node structure (first sibling). When provided as input parameter, the pointer is directly connected into the anydata node without duplication, caller is supposed to not manipulate with the data after a successful call (including calling lyd_free_all() on the provided data)

LYD_ANYDATA_STRING 

Value is a generic string without any knowledge about its format (e.g. anyxml value in JSON encoded as string). XML sensitive characters (such as & or >) are automatically escaped when the anydata is printed in XML format.

LYD_ANYDATA_XML 

Value is a string containing the serialized XML data.

LYD_ANYDATA_JSON 

Value is a string containing the data modeled by YANG and encoded as I-JSON.

LYD_ANYDATA_LYB 

Value is a memory chunk with the serialized data tree in LYB format.

Definition at line 554 of file tree_data.h.

enum LYD_FORMAT

Data input/output formats supported by libyang parser and printer functions.

Enumerator
LYD_UNKNOWN 

unknown data format, invalid value

LYD_XML 

XML instance data format

LYD_JSON 

JSON instance data format

LYD_LYB 

LYB instance data format

Definition at line 544 of file tree_data.h.

Function Documentation

LIBYANG_API_DECL LY_ERR lyd_parse_data ( const struct ly_ctx ctx,
struct lyd_node parent,
struct ly_in in,
LYD_FORMAT  format,
uint32_t  parse_options,
uint32_t  validate_options,
struct lyd_node **  tree 
)

Parse (and validate) data from the input handler as a YANG data tree.

Parameters
[in]ctxContext to connect with the tree being built here.
[in]parentOptional parent to connect the parsed nodes to. If provided, the data are expected to describe a subtree of the YANG model instead of starting at the schema root.
[in]inThe input handle to provide the dumped data in the specified format to parse (and validate).
[in]formatFormat of the input data to be parsed. Can be 0 to try to detect format from the input handler.
[in]parse_optionsOptions for parser, see Data parser options.
[in]validate_optionsOptions for the validation phase, see Data validation options.
[out]treeFull parsed data tree, note that NULL can be a valid tree. If parent is set, the first parsed child.
Returns
LY_SUCCESS in case of successful parsing (and validation).
LY_ERR value in case of error. Additional error information can be obtained from the context using ly_err* functions.

When parsing subtrees (i.e., when parent is non-NULL), validation is only performed on the newly parsed data. This might result in allowing invalid datastore content when the schema contains cross-branch constraints, complicated must statements, etc. When a full-datastore validation is desirable, parse all subtrees first, and then request validation of the complete datastore content.

LIBYANG_API_DECL LY_ERR lyd_parse_data_fd ( const struct ly_ctx ctx,
int  fd,
LYD_FORMAT  format,
uint32_t  parse_options,
uint32_t  validate_options,
struct lyd_node **  tree 
)

Parse (and validate) input data as a YANG data tree.

Wrapper around lyd_parse_data() hiding work with the input handler and some obscure options.

Parameters
[in]ctxContext to connect with the tree being built here.
[in]fdFile descriptor of a regular file (e.g. sockets are not supported) containing the input data in the specified format to parse.
[in]formatFormat of the input data to be parsed.
[in]parse_optionsOptions for parser, see Data parser options.
[in]validate_optionsOptions for the validation phase, see Data validation options.
[out]treeFull parsed data tree, note that NULL can be a valid tree
Returns
LY_SUCCESS in case of successful parsing (and validation).
LY_ERR value in case of error. Additional error information can be obtained from the context using ly_err* functions.
LIBYANG_API_DECL LY_ERR lyd_parse_data_mem ( const struct ly_ctx ctx,
const char *  data,
LYD_FORMAT  format,
uint32_t  parse_options,
uint32_t  validate_options,
struct lyd_node **  tree 
)

Parse (and validate) input data as a YANG data tree.

Wrapper around lyd_parse_data() hiding work with the input handler and some obscure options.

Parameters
[in]ctxContext to connect with the tree being built here.
[in]dataThe input data in the specified format to parse (and validate).
[in]formatFormat of the input data to be parsed.
[in]parse_optionsOptions for parser, see Data parser options.
[in]validate_optionsOptions for the validation phase, see Data validation options.
[out]treeFull parsed data tree, note that NULL can be a valid tree
Returns
LY_SUCCESS in case of successful parsing (and validation).
LY_ERR value in case of error. Additional error information can be obtained from the context using ly_err* functions.
LIBYANG_API_DECL LY_ERR lyd_parse_data_path ( const struct ly_ctx ctx,
const char *  path,
LYD_FORMAT  format,
uint32_t  parse_options,
uint32_t  validate_options,
struct lyd_node **  tree 
)

Parse (and validate) input data as a YANG data tree.

Wrapper around lyd_parse_data() hiding work with the input handler and some obscure options.

Parameters
[in]ctxContext to connect with the tree being built here.
[in]pathPath to the file with the input data in the specified format to parse (and validate).
[in]formatFormat of the input data to be parsed. Can be 0 to try to detect format from path extension.
[in]parse_optionsOptions for parser, see Data parser options.
[in]validate_optionsOptions for the validation phase, see Data validation options.
[out]treeFull parsed data tree, note that NULL can be a valid tree
Returns
LY_SUCCESS in case of successful parsing (and validation).
LY_ERR value in case of error. Additional error information can be obtained from the context using ly_err* functions.
LIBYANG_API_DECL LY_ERR lyd_parse_ext_data ( const struct lysc_ext_instance ext,
struct lyd_node parent,
struct ly_in in,
LYD_FORMAT  format,
uint32_t  parse_options,
uint32_t  validate_options,
struct lyd_node **  tree 
)

Parse (and validate) data from the input handler as an extension data tree following the schema tree of the given extension instance.

Note that the data being parsed are limited only to the schema tree specified by the given extension, it does not allow to mix them with the standard data from any module.

Directly applicable to data defined as yang-data.

Parameters
[in]extExtension instance providing the specific schema tree to match with the data being parsed.
[in]parentOptional parent to connect the parsed nodes to.
[in]inThe input handle to provide the dumped data in the specified format to parse (and validate).
[in]formatFormat of the input data to be parsed. Can be 0 to try to detect format from the input handler.
[in]parse_optionsOptions for parser, see Data parser options.
[in]validate_optionsOptions for the validation phase, see Data validation options.
[out]treeFull parsed data tree, note that NULL can be a valid tree. If parent is set, set to NULL.
Returns
LY_SUCCESS in case of successful parsing (and validation).
LY_ERR value in case of error. Additional error information can be obtained from the context using ly_err* functions.
LIBYANG_API_DECL LY_ERR lyd_parse_ext_op ( const struct lysc_ext_instance ext,
struct lyd_node parent,
struct ly_in in,
LYD_FORMAT  format,
enum lyd_type  data_type,
struct lyd_node **  tree,
struct lyd_node **  op 
)

Parse extension data into an operation data tree following only the specification from the given extension instance.

Directly applicable to data defined as yang-data.

At least one of parent, tree, or op must always be set.

Specific data_type values have different parameter meaning as follows:

  • LYD_TYPE_RPC_NETCONF:
    • parent - must be NULL, the whole RPC is expected;
    • format - must be LYD_XML, NETCONF supports only this format;
    • tree - must be provided, all the NETCONF-specific XML envelopes will be returned here as a separate opaque data tree, even if the function fails, this may be returned;
    • op - must be provided, the RPC/action data tree itself will be returned here, pointing to the operation;
  • LYD_TYPE_NOTIF_NETCONF:
    • parent - must be NULL, the whole notification is expected;
    • format - must be LYD_XML, NETCONF supports only this format;
    • tree - must be provided, all the NETCONF-specific XML envelopes will be returned here as a separate opaque data tree, even if the function fails, this may be returned;
    • op - must be provided, the notification data tree itself will be returned here, pointing to the operation;
  • LYD_TYPE_REPLY_NETCONF:
    • parent - must be set, pointing to the invoked RPC operation (RPC or action) node;
    • format - must be LYD_XML, NETCONF supports only this format;
    • tree - must be provided, all the NETCONF-specific XML envelopes will be returned here as a separate opaque data tree, even if the function fails, this may be returned;
    • op - must be NULL, the reply is appended to the RPC; Note that there are 3 kinds of NETCONF replies - ok, error, and data. Only data reply appends any nodes to the RPC.
Parameters
[in]extExtension instance providing the specific schema tree to match with the data being parsed.
[in]parentOptional parent to connect the parsed nodes to.
[in]inInput handle to read the input from.
[in]formatExpected format of the data in in.
[in]data_typeExpected operation to parse (Data operation type).
[out]treeOptional full parsed data tree. If parent is set, set to NULL.
[out]opOptional pointer to the operation (action/RPC) node.
Returns
LY_ERR value.
LY_ENOT if data_type is a NETCONF message and the root XML element is not the expected one.
LIBYANG_API_DECL LY_ERR lyd_parse_op ( const struct ly_ctx ctx,
struct lyd_node parent,
struct ly_in in,
LYD_FORMAT  format,
enum lyd_type  data_type,
struct lyd_node **  tree,
struct lyd_node **  op 
)

Parse YANG data into an operation data tree. Specific parsing flags LYD_PARSE_ONLY, LYD_PARSE_STRICT and no validation flags are used.

At least one of parent, tree, or op must always be set.

Specific data_type values have different parameter meaning as follows:

  • LYD_TYPE_RPC_NETCONF:
    • parent - must be NULL, the whole RPC is expected;
    • format - must be LYD_XML, NETCONF supports only this format;
    • tree - must be provided, all the NETCONF-specific XML envelopes will be returned here as a separate opaque data tree, even if the function fails, this may be returned;
    • op - must be provided, the RPC/action data tree itself will be returned here, pointing to the operation;
  • LYD_TYPE_NOTIF_NETCONF:
    • parent - must be NULL, the whole notification is expected;
    • format - must be LYD_XML, NETCONF supports only this format;
    • tree - must be provided, all the NETCONF-specific XML envelopes will be returned here as a separate opaque data tree, even if the function fails, this may be returned;
    • op - must be provided, the notification data tree itself will be returned here, pointing to the operation;
  • LYD_TYPE_REPLY_NETCONF:
    • parent - must be set, pointing to the invoked RPC operation (RPC or action) node;
    • format - must be LYD_XML, NETCONF supports only this format;
    • tree - must be provided, all the NETCONF-specific XML envelopes will be returned here as a separate opaque data tree, even if the function fails, this may be returned;
    • op - must be NULL, the reply is appended to the RPC; Note that there are 3 kinds of NETCONF replies - ok, error, and data. Only data reply appends any nodes to the RPC.
  • LYD_TYPE_RPC_RESTCONF:
    • parent - must be set, pointing to the invoked RPC operation (RPC or action) node;
    • format - can be both LYD_JSON and LYD_XML;
    • tree - must be provided, all the RESTCONF-specific JSON objects will be returned here as a separate opaque data tree, even if the function fails, this may be returned;
    • op - must be NULL, parent points to the operation;
  • LYD_TYPE_NOTIF_RESTCONF:
    • parent - must be NULL, the whole notification is expected;
    • format - must be LYD_JSON, XML-formatted notifications are parsed using LYD_TYPE_NOTIF_NETCONF;
    • tree - must be provided, all the RESTCONF-specific JSON objects will be returned here as a separate opaque data tree, even if the function fails, this may be returned;
    • op - must be provided, the notification data tree itself will be returned here, pointing to the operation;
  • LYD_TYPE_REPLY_RESTCONF:
    • parent - must be set, pointing to the invoked RPC operation (RPC or action) node;
    • format - can be both LYD_JSON and LYD_XML;
    • tree - must be provided, all the RESTCONF-specific JSON objects will be returned here as a separate opaque data tree, even if the function fails, this may be returned;
    • op - must be NULL, parent points to the operation; Note that error reply should be parsed as 'yang-data' extension data.
Parameters
[in]ctxlibyang context.
[in]parentOptional parent to connect the parsed nodes to.
[in]inInput handle to read the input from.
[in]formatExpected format of the data in in.
[in]data_typeExpected operation to parse (Data operation type).
[out]treeOptional full parsed data tree. If parent is set, set to NULL.
[out]opOptional pointer to the operation (action/RPC) node.
Returns
LY_ERR value.
LY_ENOT if data_type is a NETCONF message and the root XML element is not the expected one.
LIBYANG_API_DECL LY_ERR lyd_validate_all ( struct lyd_node **  tree,
const struct ly_ctx ctx,
uint32_t  val_opts,
struct lyd_node **  diff 
)

Fully validate a data tree.

The data tree is modified in-place. As a result of the validation, some data might be removed from the tree. In that case, the removed items are freed, not just unlinked.

Parameters
[in,out]treeData tree to recursively validate. May be changed by validation, might become NULL.
[in]ctxlibyang context. Can be NULL if tree is set.
[in]val_optsValidation options (Data validation options).
[out]diffOptional diff with any changes made by the validation.
Returns
LY_SUCCESS on success.
LY_ERR error on error.
LIBYANG_API_DECL LY_ERR lyd_validate_module ( struct lyd_node **  tree,
const struct lys_module module,
uint32_t  val_opts,
struct lyd_node **  diff 
)

Fully validate a data tree of a module.

The data tree is modified in-place. As a result of the validation, some data might be removed from the tree. In that case, the removed items are freed, not just unlinked.

If several modules need to be validated, the flag LYD_VALIDATE_NOT_FINAL should be used first for validation of each module and then lyd_validate_module_final() should be called also for each module. Otherwise, false-positive validation errors for foreign dependencies may occur.

Parameters
[in,out]treeData tree to recursively validate. May be changed by validation, might become NULL.
[in]moduleModule whose data (and schema restrictions) to validate.
[in]val_optsValidation options (Data validation options).
[out]diffOptional diff with any changes made by the validation.
Returns
LY_SUCCESS on success.
LY_ERR error on error.
LIBYANG_API_DECL LY_ERR lyd_validate_module_final ( struct lyd_node tree,
const struct lys_module module,
uint32_t  val_opts 
)

Finish validation of a module data that have previously been validated with LYD_VALIDATE_NOT_FINAL flag.

This final validation will not add or remove any nodes.

Parameters
[in]treeData tree to recursively validate.
[in]moduleModule whose data (and schema restrictions) to validate.
[in]val_optsValidation options (Data validation options).
Returns
LY_SUCCESS on success.
LY_ERR error on error.
LIBYANG_API_DECL LY_ERR lyd_validate_op ( struct lyd_node op_tree,
const struct lyd_node dep_tree,
enum lyd_type  data_type,
struct lyd_node **  diff 
)

Validate an RPC/action request, reply, or notification. Only the operation data tree (input/output/notif) is validate, any parents are ignored.

Parameters
[in,out]op_treeOperation tree with any parents. It can point to the operation itself or any of its parents, only the operation subtree is actually validated.
[in]dep_treeTree to be used for validating references from the operation subtree.
[in]data_typeOperation type to validate (only YANG operations are accepted, Data operation type).
[out]diffOptional diff with any changes made by the validation.
Returns
LY_SUCCESS on success.
LY_ERR error on error.