libyang  2.1.30
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
parser_data.h
Go to the documentation of this file.
1 
15 #ifndef LY_PARSER_DATA_H_
16 #define LY_PARSER_DATA_H_
17 
18 #include "tree_data.h"
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 struct ly_in;
25 
138 /* note: keep the lower 16bits free for use by LYD_VALIDATE_ flags. They are not supposed to be combined together,
139  * but since they are used (as a separate parameter) together in some functions, we want to keep them in a separated
140  * range to be able detect that the caller put wrong flags into the parser/validate options parameter. */
141 #define LYD_PARSE_ONLY 0x010000
144 #define LYD_PARSE_STRICT 0x020000
146 #define LYD_PARSE_OPAQ 0x040000
148 #define LYD_PARSE_NO_STATE 0x080000
150 #define LYD_PARSE_LYB_MOD_UPDATE 0x100000
153 #define LYD_PARSE_ORDERED 0x200000
159 #define LYD_PARSE_SUBTREE 0x400000
162 #define LYD_PARSE_WHEN_TRUE 0x800000
165 #define LYD_PARSE_NO_NEW 0x1000000
169 #define LYD_PARSE_OPTS_MASK 0xFFFF0000
196 #define LYD_VALIDATE_NO_STATE 0x0001
198 #define LYD_VALIDATE_PRESENT 0x0002
200 #define LYD_VALIDATE_OPTS_MASK 0x0000FFFF
217 LIBYANG_API_DECL LY_ERR lyd_parse_data(const struct ly_ctx *ctx, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
218  uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree);
219 
234 LIBYANG_API_DECL LY_ERR lyd_parse_data_mem(const struct ly_ctx *ctx, const char *data, LYD_FORMAT format, uint32_t parse_options,
235  uint32_t validate_options, struct lyd_node **tree);
236 
252 LIBYANG_API_DECL LY_ERR lyd_parse_data_fd(const struct ly_ctx *ctx, int fd, LYD_FORMAT format, uint32_t parse_options,
253  uint32_t validate_options, struct lyd_node **tree);
254 
269 LIBYANG_API_DECL LY_ERR lyd_parse_data_path(const struct ly_ctx *ctx, const char *path, LYD_FORMAT format,
270  uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree);
271 
291 LIBYANG_API_DECL LY_ERR lyd_parse_ext_data(const struct lysc_ext_instance *ext, struct lyd_node *parent, struct ly_in *in,
292  LYD_FORMAT format, uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree);
293 
305 enum lyd_type {
306  LYD_TYPE_DATA_YANG = 0, /* generic YANG instance data */
307  LYD_TYPE_RPC_YANG, /* instance of a YANG RPC/action request with only "input" data children,
308  including all parents in case of an action */
309  LYD_TYPE_NOTIF_YANG, /* instance of a YANG notification, including all parents in case of a nested one */
310  LYD_TYPE_REPLY_YANG, /* instance of a YANG RPC/action reply with only "output" data children,
311  including all parents in case of an action */
312 
313  LYD_TYPE_RPC_NETCONF, /* complete NETCONF RPC invocation as defined for
314  [RPC](https://tools.ietf.org/html/rfc7950#section-7.14.4) and
315  [action](https://tools.ietf.org/html/rfc7950#section-7.15.2) */
316  LYD_TYPE_NOTIF_NETCONF, /* complete NETCONF notification message as defined for
317  [notification](https://tools.ietf.org/html/rfc7950#section-7.16.2) */
318  LYD_TYPE_REPLY_NETCONF /* complete NETCONF RPC reply as defined for
319  [RPC](https://tools.ietf.org/html/rfc7950#section-7.14.4) and
320  [action](https://tools.ietf.org/html/rfc7950#section-7.15.2) */
321 };
362 LIBYANG_API_DECL LY_ERR lyd_parse_op(const struct ly_ctx *ctx, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
363  enum lyd_type data_type, struct lyd_node **tree, struct lyd_node **op);
364 
405 LIBYANG_API_DECL LY_ERR lyd_parse_ext_op(const struct lysc_ext_instance *ext, struct lyd_node *parent, struct ly_in *in,
406  LYD_FORMAT format, enum lyd_type data_type, struct lyd_node **tree, struct lyd_node **op);
407 
421 LIBYANG_API_DECL LY_ERR lyd_validate_all(struct lyd_node **tree, const struct ly_ctx *ctx, uint32_t val_opts,
422  struct lyd_node **diff);
423 
437 LIBYANG_API_DECL LY_ERR lyd_validate_module(struct lyd_node **tree, const struct lys_module *module, uint32_t val_opts,
438  struct lyd_node **diff);
439 
452 LIBYANG_API_DECL LY_ERR lyd_validate_op(struct lyd_node *op_tree, const struct lyd_node *dep_tree, enum lyd_type data_type,
453  struct lyd_node **diff);
454 
457 #ifdef __cplusplus
458 }
459 #endif
460 
461 #endif /* LY_PARSER_DATA_H_ */
Generic structure for a data node.
Definition: tree_data.h:781
YANG extension compiled instance.
Definition: plugins_exts.h:436
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_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...
struct lyd_node_inner * parent
Definition: tree_data.h:788
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_all(struct lyd_node **tree, const struct ly_ctx *ctx, uint32_t val_opts, struct lyd_node **diff)
Fully validate a data tree.
libyang representation of YANG data trees.
Parser input structure specifying where the data are read.
LYD_FORMAT
Data input/output formats supported by libyang parser and printer functions.
Definition: tree_data.h:533
lyd_type
Definition: parser_data.h:323
Available YANG schema tree structures representing YANG module.
Definition: tree_schema.h:2097
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 ...
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_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.
LY_ERR
libyang's error codes returned by the libyang functions.
Definition: log.h:254
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.
libyang context handler.
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.