libyang  6.4.26
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
parser_data.h
Go to the documentation of this file.
1 
16 #ifndef LY_PARSER_DATA_H_
17 #define LY_PARSER_DATA_H_
18 
19 #include "tree_data.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 struct ly_in;
26 
139 /* note: keep the lower 16bits free for use by LYD_VALIDATE_ flags. They are not supposed to be combined together,
140  * but since they are used (as a separate parameter) together in some functions, we want to keep them in a separated
141  * range to be able detect that the caller put wrong flags into the parser/validate options parameter. */
142 #define LYD_PARSE_ONLY 0x010000
147 #define LYD_PARSE_STRICT 0x020000
149 #define LYD_PARSE_OPAQ 0x040000
151 #define LYD_PARSE_NO_STATE 0x080000
152 #define LYD_PARSE_LYB_SKIP_MODULE_CHECK 0x100000
157 #define LYD_PARSE_ORDERED 0x200000
163 #define LYD_PARSE_WHEN_TRUE 0x400000
166 #define LYD_PARSE_NO_NEW 0x800000
169 #define LYD_PARSE_STORE_ONLY 0x01010000
173 #define LYD_PARSE_JSON_NULL 0x02000000
176 #define LYD_PARSE_JSON_STRING_DATATYPES 0x04000000
180 #define LYD_PARSE_ANYDATA_STRICT 0x08000000
184 #define LYD_PARSE_OPTS_MASK 0xFFFF0000
211 #define LYD_VALIDATE_NO_STATE 0x0001
213 #define LYD_VALIDATE_PRESENT 0x0002
214 #define LYD_VALIDATE_MULTI_ERROR 0x0004
215 #define LYD_VALIDATE_OPERATIONAL 0x0008
217 #define LYD_VALIDATE_NO_DEFAULTS 0x0010
220 #define LYD_VALIDATE_NOT_FINAL 0x0020
225 #define LYD_VALIDATE_OPTS_MASK 0x0000FFFF
248 LIBYANG_API_DECL LY_ERR lyd_parse_data(const struct ly_ctx *ctx, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
249  uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree);
250 
265 LIBYANG_API_DECL LY_ERR lyd_parse_data_mem(const struct ly_ctx *ctx, const char *data, LYD_FORMAT format, uint32_t parse_options,
266  uint32_t validate_options, struct lyd_node **tree);
267 
284 LIBYANG_API_DECL LY_ERR lyd_parse_data_mem_len(const struct ly_ctx *ctx, const char *data, uint32_t data_len, LYD_FORMAT format,
285  uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree);
286 
302 LIBYANG_API_DECL LY_ERR lyd_parse_data_fd(const struct ly_ctx *ctx, int fd, LYD_FORMAT format, uint32_t parse_options,
303  uint32_t validate_options, struct lyd_node **tree);
304 
319 LIBYANG_API_DECL LY_ERR lyd_parse_data_path(const struct ly_ctx *ctx, const char *path, LYD_FORMAT format,
320  uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree);
321 
336 LIBYANG_API_DECL LY_ERR lyd_parse_value_fragment(const struct ly_ctx *ctx, const char *path, struct ly_in *in,
337  LYD_FORMAT format, uint32_t new_val_options, uint32_t parse_options, uint32_t validate_options,
338  struct lyd_node **tree);
339 
351 enum lyd_type {
382 };
475 LIBYANG_API_DECL LY_ERR lyd_parse_op(const struct ly_ctx *ctx, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
476  enum lyd_type data_type, uint32_t parse_options, struct lyd_node **tree, struct lyd_node **op);
477 
489 LIBYANG_API_DECL LY_ERR lyd_validate_ext(struct lyd_node **ext_tree, const struct lysc_ext_instance *ext,
490  uint32_t val_opts, struct lyd_node **diff);
491 
505 LIBYANG_API_DECL LY_ERR lyd_validate_all(struct lyd_node **tree, const struct ly_ctx *ctx, uint32_t val_opts,
506  struct lyd_node **diff);
507 
525 LIBYANG_API_DECL LY_ERR lyd_validate_module(struct lyd_node **tree, const struct lys_module *module, uint32_t val_opts,
526  struct lyd_node **diff);
527 
539 LIBYANG_API_DECL LY_ERR lyd_validate_module_final(struct lyd_node *tree, const struct lys_module *module,
540  uint32_t val_opts);
541 
554 LIBYANG_API_DECL LY_ERR lyd_validate_op(struct lyd_node *op_tree, const struct lyd_node *dep_tree, enum lyd_type data_type,
555  struct lyd_node **diff);
556 
573 LIBYANG_API_DECL LY_ERR lyd_validate_op2(struct lyd_node *op_tree, const struct lyd_node *dep_tree, enum lyd_type data_type,
574  uint32_t val_opts, struct lyd_node **diff);
575 
578 #ifdef __cplusplus
579 }
580 #endif
581 
582 #endif /* LY_PARSER_DATA_H_ */
libyang context handler.
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, uint32_t parse_options, struct lyd_node **tree, struct lyd_node **op)
Parse YANG data into an operation data tree. Specific parsing flags LYD_PARSE_ONLY,...
LIBYANG_API_DECL LY_ERR lyd_validate_ext(struct lyd_node **ext_tree, const struct lysc_ext_instance *ext, uint32_t val_opts, struct lyd_node **diff)
Validate a data subtree of an extension instance, which is assumed to be a separate data tree indepen...
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.
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.
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 fl...
LYD_FORMAT
Data input/output formats supported by libyang parser and printer functions.
Definition: tree_data.h:597
LIBYANG_API_DECL LY_ERR lyd_validate_op2(struct lyd_node *op_tree, const struct lyd_node *dep_tree, enum lyd_type data_type, uint32_t val_opts, struct lyd_node **diff)
Validate an RPC/action request, reply, or notification. Only the operation data tree (input/output/no...
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/no...
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.
LIBYANG_API_DECL LY_ERR lyd_parse_data_mem_len(const struct ly_ctx *ctx, const char *data, uint32_t data_len, 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 from a bounded memory buffer.
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.
LIBYANG_API_DECL LY_ERR lyd_parse_value_fragment(const struct ly_ctx *ctx, const char *path, struct ly_in *in, LYD_FORMAT format, uint32_t new_val_options, uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree)
Parse data from the input handler as a bare JSON value and connect it to the node parsed from the pat...
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.
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.
lyd_type
Definition: parser_data.h:351
@ LYD_TYPE_REPLY_RESTCONF
Definition: parser_data.h:373
@ LYD_TYPE_NOTIF_RESTCONF
Definition: parser_data.h:370
@ LYD_TYPE_DATA_YANG
Definition: parser_data.h:352
@ LYD_TYPE_NOTIF_YANG
Definition: parser_data.h:355
@ LYD_TYPE_RPC_YANG
Definition: parser_data.h:353
@ LYD_TYPE_REPLY_YANG
Definition: parser_data.h:356
@ LYD_TYPE_REPLY_NETCONF
Definition: parser_data.h:364
@ LYD_TYPE_NOTIF_AUTO
Definition: parser_data.h:379
@ LYD_TYPE_NOTIF_NETCONF
Definition: parser_data.h:362
@ LYD_TYPE_NOTIF_ENVELOPE
Definition: parser_data.h:376
@ LYD_TYPE_RPC_RESTCONF
Definition: parser_data.h:368
@ LYD_TYPE_RPC_NETCONF
Definition: parser_data.h:359
LY_ERR
libyang's error codes returned by the libyang functions.
Definition: log.h:252
Parser input structure specifying the type of data input.
YANG extension compiled instance.
Definition: plugins_exts.h:426
Available YANG schema tree structures representing YANG module.
Definition: tree_schema.h:2242
libyang representation of YANG data trees.
Generic structure for a data node.
Definition: tree_data.h:875