libyang 2.1.148
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
Loading...
Searching...
No Matches
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
22extern "C" {
23#endif
24
25struct 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
145#define LYD_PARSE_STRICT 0x020000
147#define LYD_PARSE_OPAQ 0x040000
149#define LYD_PARSE_NO_STATE 0x080000
151#define LYD_PARSE_LYB_MOD_UPDATE 0x100000
154#define LYD_PARSE_ORDERED 0x200000
160#define LYD_PARSE_SUBTREE 0x400000
168#define LYD_PARSE_WHEN_TRUE 0x800000
171#define LYD_PARSE_NO_NEW 0x1000000
175#define LYD_PARSE_OPTS_MASK 0xFFFF0000
202#define LYD_VALIDATE_NO_STATE 0x0001
204#define LYD_VALIDATE_PRESENT 0x0002
205#define LYD_VALIDATE_MULTI_ERROR 0x0004
206#define LYD_VALIDATE_OPERATIONAL 0x0008
208#define LYD_VALIDATE_NO_DEFAULTS 0x0010
211#define LYD_VALIDATE_NOT_FINAL 0x0020
215#define LYD_VALIDATE_OPTS_MASK 0x0000FFFF
238LIBYANG_API_DECL LY_ERR lyd_parse_data(const struct ly_ctx *ctx, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
239 uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree);
240
255LIBYANG_API_DECL LY_ERR lyd_parse_data_mem(const struct ly_ctx *ctx, const char *data, LYD_FORMAT format, uint32_t parse_options,
256 uint32_t validate_options, struct lyd_node **tree);
257
273LIBYANG_API_DECL LY_ERR lyd_parse_data_fd(const struct ly_ctx *ctx, int fd, LYD_FORMAT format, uint32_t parse_options,
274 uint32_t validate_options, struct lyd_node **tree);
275
290LIBYANG_API_DECL LY_ERR lyd_parse_data_path(const struct ly_ctx *ctx, const char *path, LYD_FORMAT format,
291 uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree);
292
312LIBYANG_API_DECL LY_ERR lyd_parse_ext_data(const struct lysc_ext_instance *ext, struct lyd_node *parent, struct ly_in *in,
313 LYD_FORMAT format, uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree);
314
327 LYD_TYPE_DATA_YANG = 0, /* generic YANG instance data */
328 LYD_TYPE_RPC_YANG, /* instance of a YANG RPC/action request with only "input" data children,
329 including all parents and optional top-level "action" element in case of an action */
330 LYD_TYPE_NOTIF_YANG, /* instance of a YANG notification, including all parents in case of a nested one */
331 LYD_TYPE_REPLY_YANG, /* instance of a YANG RPC/action reply with only "output" data children,
332 including all parents in case of an action */
333
334 LYD_TYPE_RPC_NETCONF, /* complete NETCONF RPC invocation as defined for
335 [RPC](https://tools.ietf.org/html/rfc7950#section-7.14.4) and
336 [action](https://tools.ietf.org/html/rfc7950#section-7.15.2) */
337 LYD_TYPE_NOTIF_NETCONF, /* complete NETCONF notification message as defined for
338 [notification](https://tools.ietf.org/html/rfc7950#section-7.16.2) */
339 LYD_TYPE_REPLY_NETCONF, /* complete NETCONF RPC reply as defined for
340 [RPC](https://tools.ietf.org/html/rfc7950#section-7.14.4) and
341 [action](https://tools.ietf.org/html/rfc7950#section-7.15.2) */
342
343 LYD_TYPE_RPC_RESTCONF, /* message-body of a RESTCONF operation input parameters
344 ([ref](https://www.rfc-editor.org/rfc/rfc8040.html#section-3.6.1)) */
345 LYD_TYPE_NOTIF_RESTCONF, /* RESTCONF JSON notification data
346 ([ref](https://www.rfc-editor.org/rfc/rfc8040.html#section-6.4)), to parse
347 a notification in XML, use ::LYD_TYPE_NOTIF_NETCONF */
348 LYD_TYPE_REPLY_RESTCONF /* message-body of a RESTCONF operation output parameters
349 ([ref](https://www.rfc-editor.org/rfc/rfc8040.html#section-3.6.2)) */
414LIBYANG_API_DECL LY_ERR lyd_parse_op(const struct ly_ctx *ctx, struct lyd_node *parent, struct ly_in *in, LYD_FORMAT format,
415 enum lyd_type data_type, struct lyd_node **tree, struct lyd_node **op);
416
457LIBYANG_API_DECL LY_ERR lyd_parse_ext_op(const struct lysc_ext_instance *ext, struct lyd_node *parent, struct ly_in *in,
458 LYD_FORMAT format, enum lyd_type data_type, struct lyd_node **tree, struct lyd_node **op);
459
473LIBYANG_API_DECL LY_ERR lyd_validate_all(struct lyd_node **tree, const struct ly_ctx *ctx, uint32_t val_opts,
474 struct lyd_node **diff);
475
493LIBYANG_API_DECL LY_ERR lyd_validate_module(struct lyd_node **tree, const struct lys_module *module, uint32_t val_opts,
494 struct lyd_node **diff);
495
507LIBYANG_API_DECL LY_ERR lyd_validate_module_final(struct lyd_node *tree, const struct lys_module *module,
508 uint32_t val_opts);
509
522LIBYANG_API_DECL LY_ERR lyd_validate_op(struct lyd_node *op_tree, const struct lyd_node *dep_tree, enum lyd_type data_type,
523 struct lyd_node **diff);
524
527#ifdef __cplusplus
528}
529#endif
530
531#endif /* LY_PARSER_DATA_H_ */
libyang context handler.
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_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,...
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:533
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_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_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...
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
@ LYD_TYPE_REPLY_RESTCONF
@ LYD_TYPE_NOTIF_RESTCONF
@ LYD_TYPE_DATA_YANG
@ LYD_TYPE_NOTIF_YANG
@ LYD_TYPE_RPC_YANG
@ LYD_TYPE_REPLY_YANG
@ LYD_TYPE_REPLY_NETCONF
@ LYD_TYPE_NOTIF_NETCONF
@ LYD_TYPE_RPC_RESTCONF
@ LYD_TYPE_RPC_NETCONF
LY_ERR
libyang's error codes returned by the libyang functions.
Definition log.h:248
YANG extension compiled instance.
Available YANG schema tree structures representing YANG module.
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:781