libyang  1.0.101
YANG data modeling language library
tree_data.h
Go to the documentation of this file.
1 
15 #ifndef LY_TREE_DATA_H_
16 #define LY_TREE_DATA_H_
17 
18 #include <stddef.h>
19 #include <stdint.h>
20 
21 #include "libyang.h"
22 #include "tree_schema.h"
23 #include "xml.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
40 typedef enum {
45 } LYD_FORMAT;
46 
50 typedef enum {
74  LYD_ANYDATA_XML = 0x08,
82  LYD_ANYDATA_LYB = 0x20,
90 
94 typedef union lyd_value_u {
95  const char *binary;
96  struct lys_type_bit **bit;
98  int8_t bln;
99  int64_t dec64;
100  struct lys_type_enum *enm;
101  struct lys_ident *ident;
102  struct lyd_node *instance;
105  int8_t int8;
106  int16_t int16;
107  int32_t int32;
108  int64_t int64;
109  struct lyd_node *leafref;
110  const char *string;
111  uint8_t uint8;
112  uint16_t uint16;
113  uint32_t uint32;
114  uint64_t uint64;
115  void *ptr;
116 } lyd_val;
117 
128 struct lyd_attr {
129  struct lyd_node *parent;
130  struct lyd_attr *next;
132  const char *name;
133  const char *value_str;
136  uint8_t value_flags;
137 };
138 
147 #define LYD_VAL_OK 0x00
148 #define LYD_VAL_DUP 0x01
150 #define LYD_VAL_UNIQUE 0x02
151 #define LYD_VAL_MAND 0x04
157 #define LYD_VAL_LEAFREF 0x08
159 #define LYD_VAL_INUSE 0x80
178 struct lyd_node {
179  struct lys_node *schema;
180  uint8_t validity;
181  uint8_t dflt:1;
182  uint8_t when_status:3;
185  struct lyd_attr *attr;
186  struct lyd_node *next;
187  struct lyd_node *prev;
191  struct lyd_node *parent;
193 #ifdef LY_ENABLED_LYD_PRIV
194  void *priv;
195 #endif
196 
197 #ifdef LY_ENABLED_CACHE
198  uint32_t hash;
199  struct hash_table *ht;
200 #endif
201 
202  struct lyd_node *child;
207 };
208 
219 struct lyd_node_leaf_list {
220  struct lys_node *schema;
222  uint8_t validity;
223  uint8_t dflt:1;
224  uint8_t when_status:3;
227  struct lyd_attr *attr;
228  struct lyd_node *next;
229  struct lyd_node *prev;
233  struct lyd_node *parent;
235 #ifdef LY_ENABLED_LYD_PRIV
236  void *priv;
237 #endif
238 
239 #ifdef LY_ENABLED_CACHE
240  uint32_t hash;
241 #endif
242 
243  /* struct lyd_node *child; should be here, but is not */
244 
245  /* leaflist's specific members */
246  const char *value_str;
247  lyd_val value;
249  uint8_t value_flags;
250 };
251 
255 #define LY_VALUE_UNRES 0x01
258 #define LY_VALUE_USER 0x02
259 /* 0x80 is reserved for internal use */
260 
264 typedef union {
265  const char *str;
266  char *mem;
267  struct lyxml_elem *xml;
268  struct lyd_node *tree;
271 
280 struct lyd_node_anydata {
281  struct lys_node *schema;
283  uint8_t validity;
284  uint8_t dflt:1;
285  uint8_t when_status:3;
288  struct lyd_attr *attr;
289  struct lyd_node *next;
290  struct lyd_node *prev;
294  struct lyd_node *parent;
296 #ifdef LY_ENABLED_LYD_PRIV
297  void *priv;
298 #endif
299 
300 #ifdef LY_ENABLED_CACHE
301  uint32_t hash;
302 #endif
303 
304  /* struct lyd_node *child; should be here, but is not */
305 
306  /* anyxml's specific members */
309 };
310 
314 typedef enum {
315  LYD_DIFF_END = 0,
353 
357 struct lyd_difflist {
358  LYD_DIFFTYPE *type;
359  struct lyd_node **first;
361  struct lyd_node **second;
363 };
364 
370 void lyd_free_diff(struct lyd_difflist *diff);
371 
417 struct lyd_difflist *lyd_diff(struct lyd_node *first, struct lyd_node *second, int options);
418 
425 /* LYD_DIFFOPT_NOSIBLINGS value is the same as LYD_OPT_NOSIBLINGS due to backward compatibility. The LYD_OPT_NOSIBLINGS
426  * was used previously as an option for lyd_diff(). */
427 #define LYD_DIFFOPT_NOSIBLINGS 0x0800
429 #define LYD_DIFFOPT_WITHDEFAULTS 0x0001
447 char *lyd_path(const struct lyd_node *node);
448 
480 #define LYD_OPT_DATA 0x00
483 #define LYD_OPT_CONFIG 0x01
486 #define LYD_OPT_GET 0x02
492 #define LYD_OPT_GETCONFIG 0x04
499 #define LYD_OPT_EDIT 0x08
505 #define LYD_OPT_RPC 0x10
508 #define LYD_OPT_RPCREPLY 0x20
509 #define LYD_OPT_NOTIF 0x40
512 #define LYD_OPT_NOTIF_FILTER 0x80
515 #define LYD_OPT_TYPEMASK 0x10000ff
518 /* 0x100 reserved, used internally */
519 #define LYD_OPT_STRICT 0x0200
520 #define LYD_OPT_DESTRUCT 0x0400
523 #define LYD_OPT_OBSOLETE 0x0800
524 #define LYD_OPT_NOSIBLINGS 0x1000
526 #define LYD_OPT_TRUSTED 0x2000
530 #define LYD_OPT_WHENAUTODEL 0x4000
533 #define LYD_OPT_NOEXTDEPS 0x8000
535 #define LYD_OPT_DATA_NO_YANGLIB 0x10000
536 #define LYD_OPT_DATA_ADD_YANGLIB 0x20000
539 #define LYD_OPT_VAL_DIFF 0x40000
541 #define LYD_OPT_DATA_TEMPLATE 0x1000000
581 struct lyd_node *lyd_parse_mem(struct ly_ctx *ctx, const char *data, LYD_FORMAT format, int options, ...);
582 
621 struct lyd_node *lyd_parse_fd(struct ly_ctx *ctx, int fd, LYD_FORMAT format, int options, ...);
622 
659 struct lyd_node *lyd_parse_path(struct ly_ctx *ctx, const char *path, LYD_FORMAT format, int options, ...);
660 
707 struct lyd_node *lyd_parse_xml(struct ly_ctx *ctx, struct lyxml_elem **root, int options,...);
708 
720 struct lyd_node *lyd_new(struct lyd_node *parent, const struct lys_module *module, const char *name);
721 
735 struct lyd_node *lyd_new_leaf(struct lyd_node *parent, const struct lys_module *module, const char *name,
736  const char *val_str);
737 
753 int lyd_change_leaf(struct lyd_node_leaf_list *leaf, const char *val_str);
754 
771 struct lyd_node *lyd_new_anydata(struct lyd_node *parent, const struct lys_module *module, const char *name,
772  void *value, LYD_ANYDATA_VALUETYPE value_type);
773 
785 struct lyd_node *lyd_new_output(struct lyd_node *parent, const struct lys_module *module, const char *name);
786 
800 struct lyd_node *lyd_new_output_leaf(struct lyd_node *parent, const struct lys_module *module, const char *name,
801  const char *val_str);
802 
820 struct lyd_node *lyd_new_output_anydata(struct lyd_node *parent, const struct lys_module *module, const char *name,
821  void *value, LYD_ANYDATA_VALUETYPE value_type);
822 
833 struct lyd_node *lyd_new_yangdata(const struct lys_module *module, const char *name_template, const char *name);
834 
848 #define LYD_PATH_OPT_UPDATE 0x01
851 #define LYD_PATH_OPT_NOPARENT 0x02
853 #define LYD_PATH_OPT_OUTPUT 0x04
854 #define LYD_PATH_OPT_DFLT 0x08
859 #define LYD_PATH_OPT_NOPARENTRET 0x10
861 #define LYD_PATH_OPT_EDIT 0x20
894 struct lyd_node *lyd_new_path(struct lyd_node *data_tree, const struct ly_ctx *ctx, const char *path, void *value,
895  LYD_ANYDATA_VALUETYPE value_type, int options);
896 
904 unsigned int lyd_list_pos(const struct lyd_node *node);
905 
918 #define LYD_DUP_OPT_RECURSIVE 0x01
919 #define LYD_DUP_OPT_NO_ATTR 0x02
920 #define LYD_DUP_OPT_WITH_PARENTS 0x04
922 #define LYD_DUP_OPT_WITH_KEYS 0x08
924 #define LYD_DUP_OPT_WITH_WHEN 0x10
942 struct lyd_node *lyd_dup(const struct lyd_node *node, int options);
943 
954 struct lyd_node *lyd_dup_withsiblings(const struct lyd_node *node, int options);
955 
968 struct lyd_node *lyd_dup_to_ctx(const struct lyd_node *node, int options, struct ly_ctx *ctx);
969 
995 int lyd_merge(struct lyd_node *target, const struct lyd_node *source, int options);
996 
1017 int lyd_merge_to_ctx(struct lyd_node **trg, const struct lyd_node *src, int options, struct ly_ctx *ctx);
1018 
1019 #define LYD_OPT_EXPLICIT 0x0100
1020 
1049 int lyd_insert(struct lyd_node *parent, struct lyd_node *node);
1050 
1080 int lyd_insert_sibling(struct lyd_node **sibling, struct lyd_node *node);
1081 
1099 int lyd_insert_before(struct lyd_node *sibling, struct lyd_node *node);
1100 
1119 int lyd_insert_after(struct lyd_node *sibling, struct lyd_node *node);
1120 
1133 int lyd_schema_sort(struct lyd_node *sibling, int recursive);
1134 
1145 struct ly_set *lyd_find_path(const struct lyd_node *ctx_node, const char *path);
1146 
1157 struct ly_set *lyd_find_instance(const struct lyd_node *data, const struct lys_node *schema);
1158 
1165 struct lyd_node *lyd_first_sibling(struct lyd_node *node);
1166 
1200 int lyd_validate(struct lyd_node **node, int options, void *var_arg, ...);
1201 
1224 int lyd_validate_modules(struct lyd_node **node, const struct lys_module **modules, int mod_count, int options, ...);
1225 
1231 void lyd_free_val_diff(struct lyd_difflist *diff);
1232 
1247 int lyd_validate_value(struct lys_node *node, const char *value);
1248 
1256 int lyd_wd_default(struct lyd_node_leaf_list *node);
1257 
1270 int lyd_unlink(struct lyd_node *node);
1271 
1280 void lyd_free(struct lyd_node *node);
1281 
1292 void lyd_free_withsiblings(struct lyd_node *node);
1293 
1310 struct lyd_attr *lyd_insert_attr(struct lyd_node *parent, const struct lys_module *mod, const char *name,
1311  const char *value);
1312 
1325 void lyd_free_attr(struct ly_ctx *ctx, struct lyd_node *parent, struct lyd_attr *attr, int recursive);
1326 
1336 struct lys_module *lyd_node_module(const struct lyd_node *node);
1337 
1347 const struct lys_type *lyd_leaf_type(const struct lyd_node_leaf_list *leaf);
1348 
1359 int lyd_print_mem(char **strp, const struct lyd_node *root, LYD_FORMAT format, int options);
1360 
1371 int lyd_print_fd(int fd, const struct lyd_node *root, LYD_FORMAT format, int options);
1372 
1383 int lyd_print_file(FILE *f, const struct lyd_node *root, LYD_FORMAT format, int options);
1384 
1395 int lyd_print_path(const char *path, const struct lyd_node *root, LYD_FORMAT format, int options);
1396 
1408 int lyd_print_clb(ssize_t (*writeclb)(void *arg, const void *buf, size_t count), void *arg,
1409  const struct lyd_node *root, LYD_FORMAT format, int options);
1410 
1420 double lyd_dec64_to_double(const struct lyd_node *node);
1421 
1428 int lyd_lyb_data_length(const char *data);
1429 
1430 #ifdef LY_ENABLED_LYD_PRIV
1431 
1441 void *lyd_set_private(const struct lyd_node *node, void *priv);
1442 
1443 #endif
1444 
1447 #ifdef __cplusplus
1448 }
1449 #endif
1450 
1451 #endif /* LY_TREE_DATA_H_ */
lyd_merge_to_ctx
int lyd_merge_to_ctx(struct lyd_node **trg, const struct lyd_node *src, int options, struct ly_ctx *ctx)
Same as lyd_merge(), but moves the resulting data into the specified context.
lyd_dup_to_ctx
struct lyd_node * lyd_dup_to_ctx(const struct lyd_node *node, int options, struct ly_ctx *ctx)
Create a copy of the specified data tree node in the different context. All the schema references and...
_PACKED
#define _PACKED
Compiler flag for packed data types.
Definition: libyang.h:38
lyd_attr::next
struct lyd_attr * next
Definition: tree_data.h:130
lys_type
YANG type structure providing information from the schema.
Definition: tree_schema.h:988
lyd_parse_fd
struct lyd_node * lyd_parse_fd(struct ly_ctx *ctx, int fd, LYD_FORMAT format, int options,...)
Read (and validate) data from the given file descriptor.
lyd_print_clb
int lyd_print_clb(ssize_t(*writeclb)(void *arg, const void *buf, size_t count), void *arg, const struct lyd_node *root, LYD_FORMAT format, int options)
Print data tree in the specified format.
lyd_value_u::int32
int32_t int32
Definition: tree_data.h:107
lyd_validate
int lyd_validate(struct lyd_node **node, int options, void *var_arg,...)
Validate node data subtree.
lyd_node_leaf_list
Structure for data nodes defined as LYS_LEAF or LYS_LEAFLIST.
Definition: tree_data.h:227
lyd_value_u::bit
struct lys_type_bit ** bit
Definition: tree_data.h:96
lyd_value_u::int8
int8_t int8
Definition: tree_data.h:105
lyd_validate_modules
int lyd_validate_modules(struct lyd_node **node, const struct lys_module **modules, int mod_count, int options,...)
Validate node data tree but only subtrees that belong to the schema found in modules....
lys_ext_instance_complex
Complex extension instance structure.
Definition: tree_schema.h:513
lyd_free_attr
void lyd_free_attr(struct ly_ctx *ctx, struct lyd_node *parent, struct lyd_attr *attr, int recursive)
Destroy data attribute.
lyd_value_u::uint8
uint8_t uint8
Definition: tree_data.h:111
LYD_ANYDATA_LYB
Definition: tree_data.h:82
lyd_dup_withsiblings
struct lyd_node * lyd_dup_withsiblings(const struct lyd_node *node, int options)
Create a copy of the specified data tree and all its siblings (preceding as well as following)....
lyd_value_u
node's value representation
Definition: tree_data.h:94
lyd_wd_default
int lyd_wd_default(struct lyd_node_leaf_list *node)
Get know if the node contain (despite implicit or explicit) default value.
LYD_ANYDATA_XML
Definition: tree_data.h:74
lyd_value_u::int16
int16_t int16
Definition: tree_data.h:106
lyd_value_u::binary
const char * binary
Definition: tree_data.h:95
lyd_insert_attr
struct lyd_attr * lyd_insert_attr(struct lyd_node *parent, const struct lys_module *mod, const char *name, const char *value)
Insert attribute into the data node.
lys_module
Main schema node structure representing YANG module.
Definition: tree_schema.h:681
lyd_insert
int lyd_insert(struct lyd_node *parent, struct lyd_node *node)
Insert the node element as child to the parent element. The node is inserted as a last child of the p...
lyd_attr
Attribute structure.
Definition: tree_data.h:128
lyd_node_anydata::value_type
LYD_ANYDATA_VALUETYPE value_type
Definition: tree_data.h:317
lys_type_bit
Single bit value specification for lys_type_info_bits.
Definition: tree_schema.h:835
lyd_free
void lyd_free(struct lyd_node *node)
Free (and unlink) the specified data subtree. Use carefully, since libyang silently creates default n...
lyxml_elem
Structure describing an element in an XML tree.
Definition: xml.h:91
lyd_value_u::ident
struct lys_ident * ident
Definition: tree_data.h:101
lyd_node_module
struct lys_module * lyd_node_module(const struct lyd_node *node)
Return main module of the data tree node.
lyd_print_fd
int lyd_print_fd(int fd, const struct lyd_node *root, LYD_FORMAT format, int options)
Print data tree in the specified format.
LYD_DIFF_DELETED
Definition: tree_data.h:326
xml.h
Public API of libyang XML parser.
lyd_parse_xml
struct lyd_node * lyd_parse_xml(struct ly_ctx *ctx, struct lyxml_elem **root, int options,...)
Parse (and validate) XML tree.
LYD_DIFF_CHANGED
Definition: tree_data.h:334
lyd_new_output
struct lyd_node * lyd_new_output(struct lyd_node *parent, const struct lys_module *module, const char *name)
Create a new container node in a data tree. Ignore RPC/action input nodes and instead use RPC/action ...
lyd_node::next
struct lyd_node * next
Definition: tree_data.h:194
LYD_DIFF_END
Definition: tree_data.h:325
LYD_ANYDATA_STRING
Definition: tree_data.h:54
lyd_parse_path
struct lyd_node * lyd_parse_path(struct ly_ctx *ctx, const char *path, LYD_FORMAT format, int options,...)
Read (and validate) data from the given file path.
lyd_node_leaf_list::when_status
uint8_t when_status
Definition: tree_data.h:232
lyd_list_pos
unsigned int lyd_list_pos(const struct lyd_node *node)
Learn the relative instance position of a list or leaf-list within other instances of the same schema...
lyd_schema_sort
int lyd_schema_sort(struct lyd_node *sibling, int recursive)
Order siblings according to the schema node ordering.
lyd_anydata_value
Anydata value union.
Definition: tree_data.h:274
LYD_DIFF_MOVEDAFTER1
Definition: tree_data.h:336
lyd_value_u::dec64
int64_t dec64
Definition: tree_data.h:99
libyang.h
The main libyang public header.
lyd_node_leaf_list::validity
uint8_t validity
Definition: tree_data.h:230
lyd_node
Generic structure for a data node, directly applicable to the data nodes defined as LYS_CONTAINER,...
Definition: tree_data.h:186
lys_type_enum
Single enumeration value specification for lys_type_info_enums.
Definition: tree_schema.h:875
lyd_value_u::instance
struct lyd_node * instance
Definition: tree_data.h:102
LYD_LYB
Definition: tree_data.h:44
LYD_ANYDATA_SXMLD
Definition: tree_data.h:70
ly_ctx
libyang context handler.
lyd_free_diff
void lyd_free_diff(struct lyd_difflist *diff)
Free the result of lyd_diff(). It frees the structure of the lyd_diff() result, not the referenced no...
LYD_FORMAT
LYD_FORMAT
Data input/output formats supported by libyang parser and printer functions.
Definition: tree_data.h:40
LYD_JSON
Definition: tree_data.h:43
lyd_difflist::first
struct lyd_node ** first
Definition: tree_data.h:369
lyd_insert_after
int lyd_insert_after(struct lyd_node *sibling, struct lyd_node *node)
Insert the node element after the sibling element. If node and siblings are already siblings (just mo...
ly_set
Structure to hold a set of (not necessary somehow connected) lyd_node or lys_node objects....
Definition: libyang.h:1720
lyd_diff
struct lyd_difflist * lyd_diff(struct lyd_node *first, struct lyd_node *second, int options)
Compare two data trees and provide list of differences.
lyd_new_leaf
struct lyd_node * lyd_new_leaf(struct lyd_node *parent, const struct lys_module *module, const char *name, const char *val_str)
Create a new leaf or leaflist node in a data tree with a string value that is converted to the actual...
lyd_node_anydata::value
lyd_anydata_value value
Definition: tree_data.h:318
LYD_ANYDATA_CONSTSTRING
Definition: tree_data.h:51
lyd_new_output_leaf
struct lyd_node * lyd_new_output_leaf(struct lyd_node *parent, const struct lys_module *module, const char *name, const char *val_str)
Create a new leaf or leaflist node in a data tree with a string value that is converted to the actual...
LYD_ANYDATA_JSOND
Definition: tree_data.h:63
lyd_difflist::type
LYD_DIFFTYPE * type
Definition: tree_data.h:368
lyd_find_instance
struct ly_set * lyd_find_instance(const struct lyd_node *data, const struct lys_node *schema)
Search in the given data for instances of the provided schema node.
lyd_node_anydata
Structure for data nodes defined as LYS_ANYDATA or LYS_ANYXML.
Definition: tree_data.h:290
lyd_dec64_to_double
double lyd_dec64_to_double(const struct lyd_node *node)
Get the double value of a decimal64 leaf/leaf-list.
lyd_insert_sibling
int lyd_insert_sibling(struct lyd_node **sibling, struct lyd_node *node)
Insert the node element as a last sibling of the specified sibling element.
lyd_value_u::enm
struct lys_type_enum * enm
Definition: tree_data.h:100
LY_DATA_TYPE
LY_DATA_TYPE
YANG built-in types.
Definition: tree_schema.h:799
LYD_ANYDATA_SXML
Definition: tree_data.h:67
LYD_ANYDATA_LYBD
Definition: tree_data.h:85
lyd_value_u::string
const char * string
Definition: tree_data.h:110
lyd_free_val_diff
void lyd_free_val_diff(struct lyd_difflist *diff)
Free special diff that was returned by lyd_validate() or lyd_validate_modules().
lys_ident
Structure to hold information about identity, see RFC 6020 sec. 7.16
Definition: tree_schema.h:2112
lyd_node::prev
struct lyd_node * prev
Definition: tree_data.h:195
lyd_insert_before
int lyd_insert_before(struct lyd_node *sibling, struct lyd_node *node)
Insert the node element after the sibling element. If node and siblings are already siblings (just mo...
lyd_value_u::ptr
void * ptr
Definition: tree_data.h:115
lyd_attr::name
const char * name
Definition: tree_data.h:132
LYD_DIFF_CREATED
Definition: tree_data.h:343
lyd_attr::value_flags
uint8_t value_flags
Definition: tree_data.h:136
lys_node
Common structure representing single YANG data statement describing.
Definition: tree_schema.h:1239
lyd_value_u::int64
int64_t int64
Definition: tree_data.h:108
lyd_print_mem
int lyd_print_mem(char **strp, const struct lyd_node *root, LYD_FORMAT format, int options)
Print data tree in the specified format.
lyd_find_path
struct ly_set * lyd_find_path(const struct lyd_node *ctx_node, const char *path)
Search in the given data for instances of nodes matching the provided path.
LYD_ANYDATA_DATATREE
Definition: tree_data.h:78
lyd_first_sibling
struct lyd_node * lyd_first_sibling(struct lyd_node *node)
Get the first sibling of the given node.
tree_schema.h
libyang representation of data model trees.
lyd_val
union lyd_value_u lyd_val
node's value representation
lyd_new_yangdata
struct lyd_node * lyd_new_yangdata(const struct lys_module *module, const char *name_template, const char *name)
Create a new yang-data template in a data tree. It creates container, which name is in third paramete...
LYD_DIFFTYPE
LYD_DIFFTYPE
list of possible types of differences in lyd_difflist
Definition: tree_data.h:324
LYD_XML
Definition: tree_data.h:42
lyd_value_u::uint32
uint32_t uint32
Definition: tree_data.h:113
LYD_DIFF_MOVEDAFTER2
Definition: tree_data.h:352
lyd_attr::value_str
const char * value_str
Definition: tree_data.h:133
LYD_UNKNOWN
Definition: tree_data.h:41
lyd_node_leaf_list::schema
struct lys_node * schema
Definition: tree_data.h:228
lyd_leaf_type
const struct lys_type * lyd_leaf_type(const struct lyd_node_leaf_list *leaf)
Get the type structure of a leaf.
lyd_new_output_anydata
struct lyd_node * lyd_new_output_anydata(struct lyd_node *parent, const struct lys_module *module, const char *name, void *value, LYD_ANYDATA_VALUETYPE value_type)
Create a new anydata or anyxml node in a data tree. Ignore RPC/action input nodes and instead use RPC...
lyd_free_withsiblings
void lyd_free_withsiblings(struct lyd_node *node)
Free (and unlink) the specified data tree and all its siblings (preceding as well as following).
lyd_value_u::leafref
struct lyd_node * leafref
Definition: tree_data.h:109
lyd_difflist
Structure for the result of lyd_diff(), describing differences between two data trees.
Definition: tree_data.h:367
lyd_new
struct lyd_node * lyd_new(struct lyd_node *parent, const struct lys_module *module, const char *name)
Create a new container node in a data tree.
lyd_attr::annotation
struct lys_ext_instance_complex * annotation
Definition: tree_data.h:131
lyd_merge
int lyd_merge(struct lyd_node *target, const struct lyd_node *source, int options)
Merge a (sub)tree into a data tree.
lyd_validate_value
int lyd_validate_value(struct lys_node *node, const char *value)
Check restrictions applicable to the particular leaf/leaf-list on the given string value.
lyd_difflist::second
struct lyd_node ** second
Definition: tree_data.h:371
lyd_print_file
int lyd_print_file(FILE *f, const struct lyd_node *root, LYD_FORMAT format, int options)
Print data tree in the specified format.
lyd_print_path
int lyd_print_path(const char *path, const struct lyd_node *root, LYD_FORMAT format, int options)
Print data tree in the specified format.
lyd_value_u::bln
int8_t bln
Definition: tree_data.h:98
lyd_attr::parent
struct lyd_node * parent
Definition: tree_data.h:129
LYD_ANYDATA_VALUETYPE
LYD_ANYDATA_VALUETYPE
List of possible value types stored in lyd_node_anydata.
Definition: tree_data.h:50
lyd_value_u::uint64
uint64_t uint64
Definition: tree_data.h:114
lyd_unlink
int lyd_unlink(struct lyd_node *node)
Unlink the specified data subtree. All referenced namespaces are copied.
lyd_node_leaf_list::attr
struct lyd_attr * attr
Definition: tree_data.h:235
lyd_lyb_data_length
int lyd_lyb_data_length(const char *data)
Get the length of a printed LYB data tree.
lyd_attr::value_type
LY_DATA_TYPE _PACKED value_type
Definition: tree_data.h:135
lyd_change_leaf
int lyd_change_leaf(struct lyd_node_leaf_list *leaf, const char *val_str)
Change value of a leaf node.
lyd_node::child
struct lyd_node * child
Definition: tree_data.h:210
lyd_value_u::uint16
uint16_t uint16
Definition: tree_data.h:112
LYD_ANYDATA_JSON
Definition: tree_data.h:59
lyd_node_leaf_list::dflt
uint8_t dflt
Definition: tree_data.h:231
lyd_new_anydata
struct lyd_node * lyd_new_anydata(struct lyd_node *parent, const struct lys_module *module, const char *name, void *value, LYD_ANYDATA_VALUETYPE value_type)
Create a new anydata or anyxml node in a data tree.
lyd_attr::value
lyd_val value
Definition: tree_data.h:134