libyang  2.0.7
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 
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 
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
146 #define LYD_PARSE_STRICT 0x020000
148 #define LYD_PARSE_OPAQ 0x040000
150 #define LYD_PARSE_NO_STATE 0x080000
152 #define LYD_PARSE_LYB_MOD_UPDATE 0x100000
156 #define LYD_PARSE_OPTS_MASK 0xFFFF0000
183 #define LYD_VALIDATE_NO_STATE 0x0001
185 #define LYD_VALIDATE_PRESENT 0x0002
187 #define LYD_VALIDATE_OPTS_MASK 0x0000FFFF
204 LY_ERR lyd_parse_data(const struct ly_ctx *ctx, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
205  uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree);
206 
221 LY_ERR lyd_parse_data_mem(const struct ly_ctx *ctx, const char *data, LYD_FORMAT format, uint32_t parse_options,
222  uint32_t validate_options, struct lyd_node **tree);
223 
239 LY_ERR lyd_parse_data_fd(const struct ly_ctx *ctx, int fd, LYD_FORMAT format, uint32_t parse_options,
240  uint32_t validate_options, struct lyd_node **tree);
241 
256 LY_ERR lyd_parse_data_path(const struct ly_ctx *ctx, const char *path, LYD_FORMAT format, uint32_t parse_options,
257  uint32_t validate_options, struct lyd_node **tree);
258 
278 LY_ERR lyd_parse_ext_data(const struct lysc_ext_instance *ext, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
279  uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree);
280 
292 enum lyd_type {
293  LYD_TYPE_DATA_YANG = 0, /* generic YANG instance data */
294  LYD_TYPE_RPC_YANG, /* instance of a YANG RPC/action request with only "input" data children,
295  including all parents in case of an action */
296  LYD_TYPE_NOTIF_YANG, /* instance of a YANG notification , including all parents in case of a nested one */
297  LYD_TYPE_REPLY_YANG, /* instance of a YANG RPC/action reply with only "output" data children,
298  including all parents in case of an action */
299 
300  LYD_TYPE_RPC_NETCONF, /* complete NETCONF RPC invocation as defined for
301  [RPC](https://tools.ietf.org/html/rfc7950#section-7.14.4) and
302  [action](https://tools.ietf.org/html/rfc7950#section-7.15.2) */
303  LYD_TYPE_NOTIF_NETCONF, /* complete NETCONF notification message as defined for
304  [notification](https://tools.ietf.org/html/rfc7950#section-7.16.2) */
305  LYD_TYPE_REPLY_NETCONF /* complete NETCONF RPC reply as defined for
306  [RPC](https://tools.ietf.org/html/rfc7950#section-7.14.4) and
307  [action](https://tools.ietf.org/html/rfc7950#section-7.15.2) */
308 };
349 LY_ERR lyd_parse_op(const struct ly_ctx *ctx, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
350  enum lyd_type data_type, struct lyd_node **tree, struct lyd_node **op);
351 
392 LY_ERR lyd_parse_ext_op(const struct lysc_ext_instance *ext, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
393  enum lyd_type data_type, struct lyd_node **tree, struct lyd_node **op);
394 
405 LY_ERR lyd_validate_all(struct lyd_node **tree, const struct ly_ctx *ctx, uint32_t val_opts, struct lyd_node **diff);
406 
417 LY_ERR lyd_validate_module(struct lyd_node **tree, const struct lys_module *module, uint32_t val_opts, struct lyd_node **diff);
418 
430 LY_ERR lyd_validate_op(struct lyd_node *op_tree, const struct lyd_node *dep_tree, enum lyd_type data_type,
431  struct lyd_node **diff);
432 
435 #ifdef __cplusplus
436 }
437 #endif
438 
439 #endif /* LY_PARSER_DATA_H_ */
libyang context handler.
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.
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 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.
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...
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_FORMAT
Data input/output formats supported by libyang parser and printer functions.
Definition: tree_data.h:504
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.
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.
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 ...
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.
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:292
@ LYD_TYPE_DATA_YANG
Definition: parser_data.h:293
@ LYD_TYPE_NOTIF_YANG
Definition: parser_data.h:296
@ LYD_TYPE_RPC_YANG
Definition: parser_data.h:294
@ LYD_TYPE_REPLY_YANG
Definition: parser_data.h:297
@ LYD_TYPE_REPLY_NETCONF
Definition: parser_data.h:305
@ LYD_TYPE_NOTIF_NETCONF
Definition: parser_data.h:303
@ LYD_TYPE_RPC_NETCONF
Definition: parser_data.h:300
LY_ERR
libyang's error codes returned by the libyang functions.
Definition: log.h:242
Available YANG schema tree structures representing YANG module.
Definition: tree_schema.h:2295
YANG extension instance.
Definition: tree_schema.h:1425
Parser input structure specifying where the data are read.
libyang representation of YANG data trees.
Generic structure for a data node.
Definition: tree_data.h:754