Loading...
Searching...
No Matches
parser_data.h
Go to the documentation of this file.
#ifndef LY_PARSER_DATA_H_
#define LY_PARSER_DATA_H_
#include "tree_data.h"
#ifdef __cplusplus
extern "C" {
#endif
struct ly_in;
/* note: keep the lower 16bits free for use by LYD_VALIDATE_ flags. They are not supposed to be combined together,
* but since they are used (as a separate parameter) together in some functions, we want to keep them in a separated
* range to be able detect that the caller put wrong flags into the parser/validate options parameter. */
#define LYD_PARSE_ONLY 0x010000
#define LYD_PARSE_STRICT 0x020000
#define LYD_PARSE_OPAQ 0x040000
#define LYD_PARSE_NO_STATE 0x080000
#define LYD_PARSE_LYB_MOD_UPDATE 0x100000
#define LYD_PARSE_ORDERED 0x200000
#define LYD_PARSE_SUBTREE 0x400000
#define LYD_PARSE_WHEN_TRUE 0x800000
#define LYD_PARSE_NO_NEW 0x1000000
#define LYD_PARSE_STORE_ONLY 0x2010000
#define LYD_PARSE_JSON_NULL 0x4000000
#define LYD_PARSE_JSON_STRING_DATATYPES 0x8000000
#define LYD_PARSE_OPTS_MASK 0xFFFF0000
#define LYD_VALIDATE_NO_STATE 0x0001
#define LYD_VALIDATE_PRESENT 0x0002
#define LYD_VALIDATE_MULTI_ERROR 0x0004
#define LYD_VALIDATE_OPERATIONAL 0x0008
#define LYD_VALIDATE_NO_DEFAULTS 0x0010
#define LYD_VALIDATE_NOT_FINAL 0x0020
#define LYD_VALIDATE_OPTS_MASK 0x0000FFFF
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);
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);
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);
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);
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);
enum lyd_type {
LYD_TYPE_DATA_YANG = 0,
LYD_TYPE_RPC_YANG,
LYD_TYPE_NOTIF_YANG,
LYD_TYPE_REPLY_YANG,
LYD_TYPE_RPC_NETCONF,
LYD_TYPE_NOTIF_NETCONF,
LYD_TYPE_REPLY_NETCONF,
LYD_TYPE_RPC_RESTCONF,
LYD_TYPE_NOTIF_RESTCONF,
LYD_TYPE_REPLY_RESTCONF
};
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);
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);
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);
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);
LIBYANG_API_DECL LY_ERR lyd_validate_module_final(struct lyd_node *tree, const struct lys_module *module,
uint32_t val_opts);
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);
#ifdef __cplusplus
}
#endif
#endif /* LY_PARSER_DATA_H_ */
ly_ctx
libyang context handler.
lyd_parse_ext_data
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 ...
lyd_parse_op
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_data
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.
lyd_validate_all
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.
lyd_validate_module_final
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
LYD_FORMAT
Data input/output formats supported by libyang parser and printer functions.
Definition tree_data.h:539
lyd_validate_op
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...
lyd_validate_module
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.
lyd_parse_data_fd
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.
lyd_parse_ext_op
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 exte...
lyd_parse_data_path
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.
lyd_parse_data_mem
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
lyd_type
Definition parser_data.h:335
LYD_TYPE_REPLY_RESTCONF
@ LYD_TYPE_REPLY_RESTCONF
Definition parser_data.h:357
LYD_TYPE_NOTIF_RESTCONF
@ LYD_TYPE_NOTIF_RESTCONF
Definition parser_data.h:354
LYD_TYPE_DATA_YANG
@ LYD_TYPE_DATA_YANG
Definition parser_data.h:336
LYD_TYPE_NOTIF_YANG
@ LYD_TYPE_NOTIF_YANG
Definition parser_data.h:339
LYD_TYPE_RPC_YANG
@ LYD_TYPE_RPC_YANG
Definition parser_data.h:337
LYD_TYPE_REPLY_YANG
@ LYD_TYPE_REPLY_YANG
Definition parser_data.h:340
LYD_TYPE_REPLY_NETCONF
@ LYD_TYPE_REPLY_NETCONF
Definition parser_data.h:348
LYD_TYPE_NOTIF_NETCONF
@ LYD_TYPE_NOTIF_NETCONF
Definition parser_data.h:346
LYD_TYPE_RPC_RESTCONF
@ LYD_TYPE_RPC_RESTCONF
Definition parser_data.h:352
LYD_TYPE_RPC_NETCONF
@ LYD_TYPE_RPC_NETCONF
Definition parser_data.h:343
LY_ERR
LY_ERR
libyang's error codes returned by the libyang functions.
Definition log.h:237
ly_in
Parser input structure specifying the type of data input.
lysc_ext_instance
YANG extension compiled instance.
Definition plugins_exts.h:437
lys_module
Available YANG schema tree structures representing YANG module.
Definition tree_schema.h:2137
tree_data.h
libyang representation of YANG data trees.
lyd_node
Generic structure for a data node.
Definition tree_data.h:795