1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
/**
* @file tree_data_internal.h
* @author Radek Krejci <rkrejci@cesnet.cz>
* @author Michal Vasko <mvasko@cesnet.cz>
* @brief internal functions for YANG schema trees.
*
* Copyright (c) 2015 - 2026 CESNET, z.s.p.o.
*
* This source code is licensed under BSD 3-Clause License (the "License").
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/BSD-3-Clause
*/
;
;
;
/**
* @brief Internal item structure for remembering "used" instances of duplicate node instances.
*/
;
/**
* @brief Update a found inst using a duplicate instance cache hash table. Needs to be called for every "used"
* (that should not be considered next time) instance.
*
* @param[in,out] inst Found instance, is updated so that the same instance is not returned twice.
* @param[in] dup_inst_ht Duplicate instance cache hash table.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Free duplicate instance cache.
*
* @param[in] dup_inst Duplicate instance cache hash table to free.
*/
void ;
/**
* @brief Just like ::lys_getnext() but iterates over all data instances of the schema nodes.
*
* @param[in] last Last returned data node.
* @param[in] sibling Data node sibling to search in.
* @param[in,out] slast Schema last node, set to NULL for first call and do not change afterwards.
* May not be set if the function is used only for any suitable node existence check (such as the existence
* of any choice case data).
* @param[in] parent Schema parent of the iterated children nodes.
* @param[in] module Schema module of the iterated top-level nodes.
* @return Next matching data node,
* @return NULL if last data node was already returned.
*/
struct lyd_node *;
/**
* @brief Get address of a node's child pointer if any.
*
* @param[in] node Node to check.
* @return Address of the node's child member,
* @return NULL if there is no child pointer.
*/
struct lyd_node **;
/**
* @brief Update node pointer to point to the first data node of a module, leave unchanged if there is none.
*
* @param[in,out] node Node pointer, may be updated.
* @param[in] mod Module whose data to search for.
*/
void ;
/**
* @brief Iterate over implemented modules for functions that accept specific modules or the whole context.
*
* @param[in] tree Data tree.
* @param[in] module Selected module, NULL for all.
* @param[in] ctx Context, NULL for selected modules.
* @param[in,out] i Iterator, set to 0 on first call.
* @param[out] first First sibling of the returned module.
* @return Next module.
* @return NULL if all modules were traversed.
*/
const struct lys_module *;
/**
* @brief Iterate over modules for functions that want to traverse all the top-level data.
*
* @param[in,out] next Pointer to the next module data, set to first top-level sibling on first call.
* @param[out] first First sibling of the returned module.
* @return Next module.
* @return NULL if all modules were traversed.
*/
const struct lys_module *;
/**
* @brief Search in the given siblings (NOT recursively) for the first schema node data instance.
* Uses hashes - should be used whenever possible for best performance.
*
* @param[in] siblings Siblings to search in including preceding and succeeding nodes.
* @param[in] schema Target data node schema to find.
* @param[out] match Can be NULL, otherwise the found data node.
* @return LY_SUCCESS on success, @p match set.
* @return LY_ENOTFOUND if not found, @p match set to NULL.
* @return LY_ERR value if another error occurred.
*/
LY_ERR ;
/**
* @brief Check whether a node to be deleted is the root node, move it if it is.
*
* @param[in] root Root sibling.
* @param[in] to_del Node to be deleted.
* @param[in] mod If set, it is expected @p tree should point to the first node of @p mod. Otherwise it will simply be
* the first top-level sibling.
*/
void ;
/**
* @brief After adding a default child, check the node and all of its parent NP containers and set their dflt flag.
*
* @param[in] parent Changed first parent to check.
*/
void ;
/**
* @brief After adding a non-default child, remove the dflt flag from parent and other parent NP containers.
*
* @param[in] parent Changed first parent to update.
*/
void ;
/**
* @brief Free stored prefix data.
*
* @param[in] format Format of the prefixes.
* @param[in] prefix_data Format-specific data to free:
* LY_PREF_SCHEMA - const struct lysp_module * (module used for resolving prefixes from imports)
* LY_PREF_SCHEMA_RESOLVED - struct lyd_value_prefix * (sized array of pairs: prefix - module)
* LY_PREF_XML - const struct ly_set * (set with defined namespaces stored as ::lyxml_ns)
* LY_PREF_JSON - NULL
*/
void ;
/**
* @brief Duplicate prefix data.
*
* @param[in] ctx libyang context.
* @param[in] format Format of the prefixes in the value.
* @param[in] prefix_data Prefix data to duplicate.
* @param[out] prefix_data_p Duplicated prefix data.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Store used prefixes in a string.
*
* If @p prefix_data_p are non-NULL, they are treated as valid according to the @p format_p and new possible
* prefixes are simply added. This way it is possible to store prefix data for several strings together.
*
* @param[in] ctx libyang context.
* @param[in] value Value to be parsed.
* @param[in] value_size Size of the @p value in bytes.
* @param[in] format Format of the prefixes in the value.
* @param[in] prefix_data Format-specific data for resolving any prefixes (see ::ly_resolve_prefix).
* @param[in,out] format_p Resulting format of the prefixes.
* @param[in,out] prefix_data_p Resulting prefix data for the value in format @p format_p.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Get string name of the format.
*
* @param[in] format Format whose name to get.
* @return Format string name.
*/
const char *;
/**
* @brief Create a term (leaf/leaf-list) node from a string value.
*
* Hash is calculated and new node flag is set.
*
* @param[in] schema Schema node of the new data node.
* @param[in] lnode Parent node for logging.
* @param[in] value Value to be parsed.
* @param[in] value_size_bits Size of @p value in bits, must be set correctly.
* @param[in] is_utf8 Whether @p value is a valid UTF-8 string, if applicable.
* @param[in] store_only Whether to perform storing operation only.
* @param[in,out] dynamic Flag if @p value is dynamically allocated, is adjusted when @p value is consumed.
* @param[in] format Input format of @p value.
* @param[in] prefix_data Format-specific data for resolving any prefixes (see ::ly_resolve_prefix).
* @param[in] hints [Value hints](@ref lydvalhints) from the parser regarding the value type.
* @param[out] incomplete Whether the value needs to be resolved, optional.
* @param[out] node Created node.
* @return LY_SUCCESS on success.
* @return LY_ERR value if an error occurred.
*/
LY_ERR ;
/**
* @brief Create an inner (container/list/RPC/action/notification) node.
*
* Hash is calculated and new node flag is set except
* for list with keys, when the hash is not calculated!
* Also, non-presence container has its default flag set.
*
* @param[in] schema Schema node of the new data node.
* @param[out] node Created node.
* @return LY_SUCCESS on success.
* @return LY_ERR value if an error occurred.
*/
LY_ERR ;
/**
* @brief Create a list with all its keys (cannot be used for key-less list).
*
* Hash is calculated and new node flag is set.
*
* @param[in] schema Schema node of the new data node.
* @param[in] predicates Compiled key list predicates.
* @param[in] vars Array of defined variables to use in predicates, may be NULL.
* @param[in] store_only Whether to perform storing operation only.
* @param[out] node Created node.
* @return LY_SUCCESS on success.
* @return LY_ERR value if an error occurred.
*/
LY_ERR ;
/**
* @brief Create a list with all its keys (cannot be used for key-less list).
*
* Hash is calculated and new node flag is set.
*
* @param[in] schema Schema node of the new data node.
* @param[in] keys Key list predicates.
* @param[in] keys_len Length of @p keys.
* @param[in] store_only Whether to perform storing operation only.
* @param[out] node Created node.
* @return LY_SUCCESS on success.
* @return LY_ERR value if an error occurred.
*/
LY_ERR ;
/**
* @brief Create an anyxml/anydata node.
*
* @param[in] schema Schema node of the new data node.
* @param[in] child Data tree value.
* @param[in] value String value.
* @param[in] hints Value hints.
* @param[in] use_value Whether to use @p child / @p value or duplicate it.
* @param[in] try_parse Set if parsing the string value into a data tree should be attempted.
* @param[out] node Created node.
* @return LY_SUCCESS on success.
* @return LY_ERR value if an error occurred.
*/
LY_ERR ;
/**
* @brief Create an opaque node.
*
* @param[in] ctx libyang context.
* @param[in] name Element name.
* @param[in] name_len Length of @p name, must be set correctly.
* @param[in] prefix Element prefix.
* @param[in] pref_len Length of @p prefix, must be set correctly.
* @param[in] module_key Mandatory key to reference module, can be namespace or name.
* @param[in] module_key_len Length of @p module_key, must be set correctly.
* @param[in] value String value to be parsed.
* @param[in] value_len Length of @p value, must be set correctly.
* @param[in,out] dynamic Flag if @p value is dynamically allocated, is adjusted when @p value is consumed.
* @param[in] format Input format of @p value and @p ns.
* @param[in] val_prefix_data Format-specific prefix data, param is spent (even in case the function fails):
* LY_PREF_SCHEMA - const struct lysp_module * (module used for resolving prefixes from imports)
* LY_PREF_SCHEMA_RESOLVED - struct lyd_value_prefix * (sized array of pairs: prefix - module)
* LY_PREF_XML - const struct ly_set * (set with defined namespaces stored as ::lyxml_ns)
* LY_PREF_JSON - NULL
* @param[in] hints [Hints](@ref lydhints) from the parser regarding the node/value type.
* @param[out] node Created node.
* @return LY_SUCCESS on success.
* @return LY_ERR value if an error occurred.
*/
LY_ERR ;
/**
* @brief Change the value of a term (leaf or leaf-list) node.
*
* Node changed this way is always considered explicitly set, meaning its default flag
* is always cleared.
*
* @param[in] term Term node to change.
* @param[in] val New value to use.
* @param[in] use_val Whether @p val can be used and spent or should only be duplicated.
* @param[in] is_dflt Whether @p val is a default value or not.
* @return LY_SUCCESS if value was changed,
* @return LY_EEXIST if value was the same and only the default flag was cleared,
* @return LY_ENOT if the values were equal and no change occured,
* @return LY_ERR value on other errors.
*/
LY_ERR ;
/**
* @brief Create a new node in the data tree based on a ly_path structure @p. All node types can be created.
*
* If @p path points to a list key, the key value from the predicate is used and @p value is ignored.
* Also, if a leaf-list is being created and both a predicate is defined in @p path
* and @p value is set, the predicate is preferred.
*
* For key-less lists and state leaf-lists, positional predicates can be used. If no preciate is used for these
* nodes, they are always created.
*
* @param[in] parent Data parent to add to/modify, can be NULL. Note that in case a first top-level sibling is used,
* it may no longer be first if @p path is absolute and starts with a non-existing top-level node inserted
* before @p parent. Use ::lyd_first_sibling() to adjust @p parent in these cases.
* @param[in] ctx libyang context, must be set if @p parent is NULL.
* @param[in] p Compiled path.
* @param[in] path [Path](@ref howtoXPath) to create.
* @param[in] value Value of the new leaf/leaf-list (const char *) in ::LY_VALUE_JSON format. If creating an
* anyxml/anydata node, the expected type depends on @p value_type. For other node types, it should be NULL.
* @param[in] value_size_bits Size of @p value in bits, must be set correctly. Ignored when
* creating anyxml/anydata nodes.
* @param[in] any_hints Hints for @p value when creating an anyxml/anydata node.
* @param[in] options Bitmask of new value creation options, see @ref newvaloptions.
* @param[out] new_parent Optional first parent node created. If only one node was created, equals to @p new_node.
* @param[out] new_node Optional last node created.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Check the existence and create any non-existing implicit children.
*
* @param[in] parent Parent of the potential default values, NULL for top-level siblings.
* @param[in,out] first First sibling.
* @param[in] sparent Schema parent of the siblings, NULL if schema of @p parent can be used.
* @param[in] mod Module of the default values, NULL for nested siblings.
* @param[in] node_when Optional set to add nodes with "when" conditions into.
* @param[in] node_types Optional set to add nodes with unresolved types into.
* @param[in] ext_val Optional set to add nodes with extension instances into.
* @param[in] impl_opts Implicit options (@ref implicitoptions).
* @param[in,out] getnext_ht Getnext HT to use, new @p sparent is added to it.
* @param[in,out] diff Validation diff.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Check the existence and create any non-existing implicit children, recursively for containers.
*
* @param[in] parent Parent of the potential default values, NULL for top-level siblings.
* @param[in,out] first First sibling.
* @param[in] sparent Schema parent of the siblings, NULL if schema of @p parent can be used.
* @param[in] mod Module of the default values, NULL for nested siblings.
* @param[in] node_when Optional set to add nodes with "when" conditions into.
* @param[in] node_types Optional set to add nodes with unresolved types into.
* @param[in] ext_val Optional set to add nodes with extension instances into.
* @param[in] impl_opts Implicit options (@ref implicitoptions).
* @param[in,out] getnext_ht Getnext HT to use, new @p sparent is added to it.
* @param[in,out] diff Validation diff.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Find the next node, before which to insert the new node.
*
* @param[in] first_sibling First sibling of the nodes to consider.
* @param[in] new_node Node that will be inserted.
* @return Node to insert after.
* @return NULL if the new node should be first.
*/
struct lyd_node *;
/**
* @brief Insert node after a sibling.
*
* Handles inserting into NP containers and key-less lists.
*
* @param[in,out] first_sibling Optional, useful for optimization. The function operates with the first sibling
* only if the node is inserted last. It is optimal when the first sibling is set. If it is set to NULL or
* if it points to a NULL pointer, then the function will find the first sibling itself.
* @param[in] sibling Sibling to insert after.
* @param[in] node Node to insert.
*/
void ;
/**
* @brief Insert node before a sibling.
*
* Handles inserting into NP containers and key-less lists.
*
* @param[in] sibling Sibling to insert before.
* @param[in] node Node to insert.
*/
void ;
/**
* @defgroup insertorder Data insert order.
*
* Various options for optimal node insertion.
* Flags that cause the order of nodes not to be checked are adapted to fast insertion but can cause
* nodes for (leaf-)lists with LYS_ORDBY_SYSTEM flag set to be out of order, which is an undesirable state,
* so these flags must be set carefully. In such exceptional cases, (leaf-)list instances may remain unsorted,
* in which case inserting a new node causes sorting to be invoked.
* @{
*/
/** @} insertorder */
/**
* @brief Insert a node into parent/siblings. Order and hashes are fully handled.
*
* @param[in] parent Parent to insert into, NULL for top-level sibling.
* @param[in,out] first_sibling First sibling, NULL if no top-level sibling exist yet. Can be also NULL if @p parent is set.
* @param[in] node Individual node (without siblings) to insert.
* @param[in] order Options for inserting (sorting) the node (@ref insertorder).
*/
void ;
/**
* @brief Insert a node into parent/siblings, either before the 'anchor' or as the last sibling.
*
* @param[in] parent Parent to insert into, NULL for top-level sibling.
* @param[in,out] first_sibling First sibling, pointing to NULL pointer if no top-level sibling exist yet
* or if @p parent is set.
* @param[in] node Individual node (without siblings) to insert.
*/
void ;
/**
* @brief Unlink the specified data subtree.
*
* @param[in] node Data tree node to be unlinked (together with all the children).
*/
void ;
/**
* @brief Insert a metadata (last) into a parent
*
* @param[in] parent Parent of the metadata.
* @param[in] meta Metadata (list) to be added into the @p parent.
* @param[in] clear_dflt Whether to clear dflt flag starting from @p parent, recursively all NP containers.
*/
void ;
/**
* @brief Unlink a single metadata instance.
*
* @param[in] meta Metadata to unlink.
*/
void ;
/**
* @brief Get the annotation definition in the module.
*
* @param[in] mod Metadata module (with the annotation definition).
* @param[in] name Metadata name.
* @param[in] name_len Length of @p name, must be set correctly.
* @return YANG extension annotation instance.
*/
struct lysc_ext_instance *;
/**
* @brief Create and insert a metadata (last) into a parent.
*
* @param[in] parent Parent of the metadata, can be NULL.
* @param[in,out] meta Metadata list to add at its end if @p parent is NULL, returned created attribute.
* @param[in] mod Metadata module (with the annotation definition).
* @param[in] name Metadata name.
* @param[in] name_len Length of @p name, must be set correctly.
* @param[in] value Value to be parsed.
* @param[in] value_size_bits Size of @p value in bits, must be set correctly.
* @param[in] is_utf8 Whether @p value is a valid UTF-8 string, if applicable.
* @param[in] store_only Whether to perform storing operation only.
* @param[in,out] dynamic Flag if @p value is dynamically allocated, is adjusted when @p value is consumed.
* @param[in] format Input format of @p value.
* @param[in] prefix_data Format-specific data for resolving any prefixes (see ::ly_resolve_prefix).
* @param[in] hints [Value hints](@ref lydvalhints) from the parser regarding the value type.
* @param[in] ctx_node Value context node, may be NULL for metadata.
* @param[in] lnode Data node for logging.
* @param[in] clear_dflt Whether to clear dflt flag starting from @p parent, recursively all NP containers.
* @param[out] incomplete Whether the value needs to be resolved.
* @return LY_SUCCESS on success.
* @return LY_EINCOMPLETE in case data tree is needed to finish the validation.
* @return LY_ERR value if an error occurred.
*/
LY_ERR ;
/**
* @brief Create a copy of the metadata.
*
* @param[in] parent_ctx Target context for duplicated nodes.
* @param[in] meta Metadata to copy.
* @param[in] parent Node where to append the new metadata.
* @param[out] dup Optional created metadata copy.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Insert an attribute (last) into a parent
*
* @param[in] parent Parent of the attributes.
* @param[in] attr Attribute (list) to be added into the @p parent.
*/
void ;
/**
* @brief Create and insert a generic attribute (last) into a parent.
*
* @param[in] parent Parent of the attribute, can be NULL.
* @param[in,out] attr Attribute list to add at its end if @p parent is NULL, returned created attribute.
* @param[in] ctx libyang context.
* @param[in] name Attribute name.
* @param[in] name_len Length of @p name, must be set correctly.
* @param[in] prefix Attribute prefix.
* @param[in] prefix_len Attribute prefix length.
* @param[in] module_key Mandatory key to reference module, can be namespace or name.
* @param[in] module_key_len Length of @p module_key, must be set correctly.
* @param[in] value String value to be parsed.
* @param[in] value_len Length of @p value, must be set correctly.
* @param[in,out] dynamic Flag if @p value is dynamically allocated, is adjusted when @p value is consumed.
* @param[in] format Input format of @p value and @p ns.
* @param[in] val_prefix_data Format-specific prefix data, param is spent (even in case the function fails).
* @param[in] hints [Hints](@ref lydhints) from the parser regarding the node/value type.
* @return LY_SUCCESS on success,
* @return LY_ERR value on error.
*/
LY_ERR ;
/**
* @brief Check the equality of the two schemas.
*
* @param[in] schema1 Schema of first node.
* @param[in] schema2 Schema of second node.
* @param[in] cmp_parents Whether to also compare all the parents.
* @return 1 if the schemas are equal otherwise 0.
*/
ly_bool ;
/**
* @brief Store and canonize the given @p value into @p val according to the schema node type rules.
*
* @param[in] ctx libyang context.
* @param[in] lnode Data node for logging.
* @param[in,out] val Storage for the value.
* @param[in] type Type of the value.
* @param[in] value Value to be parsed, must not be NULL.
* @param[in] value_size_bits Size of @p value in bits, must be set correctly.
* @param[in] is_utf8 Whether @p value is a valid UTF-8 string, if applicable.
* @param[in] store_only Whether to perform storing operation only.
* @param[in,out] dynamic Flag if @p value is dynamically allocated, is adjusted when @p value is consumed.
* @param[in] format Input format of @p value.
* @param[in] prefix_data Format-specific data for resolving any prefixes (see ::ly_resolve_prefix).
* @param[in] hints [Value hints](@ref lydvalhints) from the parser.
* @param[in] ctx_snode Context schema node.
* @param[out] incomplete Optional, set if the value also needs to be resolved.
* @return LY_SUCCESS on success,
* @return LY_ERR value on error.
*/
LY_ERR ;
/**
* @brief Validate previously incompletely stored value.
*
* @param[in] ctx libyang context.
* @param[in] type Schema type of the value (not the stored one, but the original one).
* @param[in,out] val Stored value to resolve.
* @param[in] ctx_node Context node for the resolution.
* @param[in] tree Data tree for the resolution.
* @return LY_SUCCESS on success,
* @return LY_ERR value on error.
*/
LY_ERR ;
/**
* @brief Check type restrictions applicable to the particular leaf/leaf-list with the given string @p value.
*
* This function check just the type's restriction, if you want to check also the data tree context (e.g. in case of
* require-instance restriction), use ::lyd_value_validate().
*
* @param[in] ctx libyang context for logging (function does not log errors when @p ctx is NULL)
* @param[in] node Schema node for the @p value.
* @param[in] value Value to be checked in @p format.
* @param[in] value_size_bits Size of the given @p value in bits.
* @param[in] format Value prefix format.
* @param[in] prefix_data Format-specific data for resolving any prefixes (see ::ly_resolve_prefix).
* @param[in] hints Value encoding hints.
* @return LY_SUCCESS on success
* @return LY_ERR value if an error occurred.
*/
LY_ERR ;
/**
* @brief Check type restrictions applicable to the particular leaf/leaf-list with the given string @p value.
*
* The given node is not modified in any way - it is just checked if the @p value can be set to the node.
*
* @param[in] schema Schema node of the @p value.
* @param[in] value String value to be checked, it is expected to be in JSON format.
* @param[in] value_len Length of the given @p value (mandatory).
* @param[in] format Value prefix format.
* @param[in] prefix_data Format-specific data for resolving any prefixes (see ::ly_resolve_prefix).
* @param[in] hints Value hints, bitmap of LYD_VALHINT_* values.
* @param[in] ctx_node Optional data tree context node for the value (leafref target, instance-identifier).
* If not set and is required for the validation to complete, ::LY_EINCOMPLETE is be returned.
* @param[in] log Whether to log errors or not.
* @param[out] realtype Optional real type of @p value.
* @param[out] canonical Optional canonical value of @p value (in the dictionary).
* @return LY_SUCCESS on success
* @return LY_EINCOMPLETE in case the @p ctx_node is not provided and it was needed to finish the validation
* (e.g. due to require-instance).
* @return LY_ERR value if an error occurred.
*/
LY_ERR ;
/**
* @defgroup datahash Data nodes hash manipulation
* @ingroup datatree
* @{
*/
/**
* @brief Generate hash for the node.
*
* @param[in] node Data node to (re)generate hash value.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Compare callback for values in hash table.
*
* Implementation of ::lyht_value_equal_cb.
*/
ly_bool ;
/**
* @brief Insert hash of the node into the hash table of its parent.
*
* @param[in] node Data node which hash will be inserted into the ::lyd_node_inner.children_ht hash table of its parent.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Maintain node's parent's children hash table when unlinking the node.
*
* When completely freeing data tree, it is expected to free the parent's children hash table first, at once.
*
* @param[in] node The data node being unlinked from its parent.
*/
void ;
/** @} datahash */
/**
* @brief Append all list key predicates to path.
*
* @param[in] node Node with keys to print.
* @param[in,out] buffer Buffer to print to.
* @param[in,out] buflen Current buffer length.
* @param[in,out] bufused Current number of characters used in @p buffer.
* @param[in] is_static Whether buffer is static or can be reallocated.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Generate a path similar to ::lyd_path() except read the parents from a set.
*
* @param[in] dnodes Set with the data nodes, from parent to the last descendant.
* @param[in] pathtype Type of data path to generate.
* @return Generated data path.
*/
char *;
/**
* @brief Remove an object on the specific set index keeping the order of the other objects.
*
* @param[in] set Set from which a node will be removed.
* @param[in] index Index of the object to remove in the \p set.
* @param[in] destructor Optional function to free the objects being removed.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Frees data within leafref links record
*
* @param[in] rec The leafref links record
*/
void ;
/**
* @brief Frees all leafref nodes and target node of given data node
*
* @param[in] node The data node, which leafref nodes and/or target node should be cleared.
*/
void ;
/**
* @brief Gets or creates the leafref links record.
*
* @param[in] node The term data node.
* @param[out] record The leafref links record.
* @param[in] create Whether to create record if not exists.
* @return LY_SUCCESS on success.
* @return LY_ERR value on error.
*/
LY_ERR ;
/**
* @brief Adds links between leafref and data node.
*
* If the links were already added, it will not be added again.
* This API requires usage of LY_CTX_LEAFREF_LINKING context flag.
*
* @param[in] node Data node to which, the leafref is pointing to.
* @param[in] leafref_node The leafref, which points to given node.
* @return LY_SUCCESS on success.
* @return LY_ERR value on error.
*/
LY_ERR ;
/**
* @brief Removes links between leafref and data node.
*
* If the links were never added, it will be silently ignored.
* This API requires usage of LY_CTX_LEAFREF_LINKING context flag.
*
* @param[in] node Data node to which, the leafref is pointing to.
* @param[in] leafref_node The leafref, which points to given node.
* @return LY_SUCCESS on success.
* @return LY_ERR value on error.
*/
LY_ERR ;
/**
* @brief Unlink the specified data subtree.
*
* The lyds_unlink() is NOT called in this function.
*
* @param[in,out] first_sibling Optional, performs an update if @p node is first or @p sibling is last.
* @param[in] node Data tree node to be unlinked (together with all the children).
*/
void ;
/* LY_TREE_DATA_INTERNAL_H_ */