libyang 2.1.4
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
Loading...
Searching...
No Matches
union.c
Go to the documentation of this file.
1
15#define _GNU_SOURCE /* strdup */
16
17#include "plugins_types.h"
18
19#include <assert.h>
20#include <stdint.h>
21#include <stdlib.h>
22#include <string.h>
23
24#include "libyang.h"
25
26/* additional internal headers for some useful simple macros */
27#include "common.h"
28#include "compat.h"
29#include "plugins_internal.h" /* LY_TYPE_*_STR */
30
46#define IDX_SIZE 4
47
58static LY_ERR
59union_subvalue_assignment(const void *value, size_t value_len, void **original, size_t *orig_len, uint32_t *options)
60{
61 LY_ERR ret = LY_SUCCESS;
62
63 if (*options & LYPLG_TYPE_STORE_DYNAMIC) {
64 /* The allocated value is stored and spend. */
65 *original = (void *)value;
66 *options &= ~LYPLG_TYPE_STORE_DYNAMIC;
67 } else if (value_len) {
68 /* Make copy of the value. */
69 *original = calloc(1, value_len);
70 LY_CHECK_ERR_RET(!*original, ret = LY_EMEM, ret);
71 memcpy(*original, value, value_len);
72 } else {
73 /* Empty value. */
74 *original = strdup("");
75 LY_CHECK_ERR_RET(!*original, ret = LY_EMEM, ret);
76 }
77 *orig_len = value_len;
78
79 return ret;
80}
81
91static LY_ERR
92lyb_union_validate(const void *lyb_data, size_t lyb_data_len, const struct lysc_type_union *type_u, struct ly_err_item **err)
93{
94 LY_ERR ret = LY_SUCCESS;
95 uint64_t type_idx = 0;
96
97 /* Basic validation. */
98 if (lyb_data_len < IDX_SIZE) {
99 ret = ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, NULL, "Invalid LYB union value size %zu (expected at least 4).",
100 lyb_data_len);
101 return ret;
102 }
103
104 /* Get index in correct byte order. */
105 memcpy(&type_idx, lyb_data, IDX_SIZE);
106 type_idx = le64toh(type_idx);
107 if (type_idx >= LY_ARRAY_COUNT(type_u->types)) {
108 ret = ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, NULL,
109 "Invalid LYB union type index %" PRIu64 " (type count %" LY_PRI_ARRAY_COUNT_TYPE ").",
110 type_idx, LY_ARRAY_COUNT(type_u->types));
111 return ret;
112 }
113
114 return ret;
115}
116
127static void
128lyb_parse_union(const void *lyb_data, size_t lyb_data_len, uint32_t *type_idx, const void **lyb_value, size_t *lyb_value_len)
129{
130 uint64_t num = 0;
131
132 assert(lyb_data && !(lyb_value && !lyb_value_len));
133
134 if (type_idx) {
135 memcpy(&num, lyb_data, IDX_SIZE);
136 num = le64toh(num);
137
138 *type_idx = num;
139 }
140
141 if (lyb_value && lyb_value_len && lyb_data_len) {
142 /* Get lyb_value and its length. */
143 if (lyb_data_len == IDX_SIZE) {
144 *lyb_value_len = 0;
145 *lyb_value = "";
146 } else {
147 *lyb_value_len = lyb_data_len - IDX_SIZE;
148 *lyb_value = (char *)lyb_data + IDX_SIZE;
149 }
150 }
151}
152
166static LY_ERR
167union_store_type(const struct ly_ctx *ctx, struct lysc_type *type, struct lyd_value_union *subvalue,
168 ly_bool resolve, const struct lyd_node *ctx_node, const struct lyd_node *tree, struct lys_glob_unres *unres,
169 struct ly_err_item **err)
170{
171 LY_ERR ret;
172 const void *value = NULL;
173 size_t value_len = 0;
174
175 if (subvalue->format == LY_VALUE_LYB) {
176 lyb_parse_union(subvalue->original, subvalue->orig_len, NULL, &value, &value_len);
177 } else {
178 value = subvalue->original;
179 value_len = subvalue->orig_len;
180 }
181
182 ret = type->plugin->store(ctx, type, value, value_len, 0, subvalue->format, subvalue->prefix_data, subvalue->hints,
183 subvalue->ctx_node, &subvalue->value, unres, err);
184 if ((ret != LY_SUCCESS) && (ret != LY_EINCOMPLETE)) {
185 /* clear any leftover/freed garbage */
186 memset(&subvalue->value, 0, sizeof subvalue->value);
187 return ret;
188 }
189
190 if (resolve && (ret == LY_EINCOMPLETE)) {
191 /* we need the value resolved */
192 ret = type->plugin->validate(ctx, type, ctx_node, tree, &subvalue->value, err);
193 if (ret) {
194 /* resolve failed, we need to free the stored value */
195 type->plugin->free(ctx, &subvalue->value);
196 }
197 }
198
199 return ret;
200}
201
216static LY_ERR
217union_find_type(const struct ly_ctx *ctx, struct lysc_type **types, struct lyd_value_union *subvalue,
218 ly_bool resolve, const struct lyd_node *ctx_node, const struct lyd_node *tree, uint32_t *type_idx,
219 struct lys_glob_unres *unres, struct ly_err_item **err)
220{
221 LY_ERR ret = LY_SUCCESS;
223 uint32_t prev_lo;
224
225 if (!types || !LY_ARRAY_COUNT(types)) {
226 return LY_EINVAL;
227 }
228
229 *err = NULL;
230
231 /* turn logging off */
232 prev_lo = ly_log_options(0);
233
234 /* use the first usable subtype to store the value */
235 for (u = 0; u < LY_ARRAY_COUNT(types); ++u) {
236 ret = union_store_type(ctx, types[u], subvalue, resolve, ctx_node, tree, unres, err);
237 if ((ret == LY_SUCCESS) || (ret == LY_EINCOMPLETE)) {
238 break;
239 }
240
241 ly_err_free(*err);
242 *err = NULL;
243 }
244
245 if (u == LY_ARRAY_COUNT(types)) {
246 ret = ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, NULL, "Invalid union value \"%.*s\" - no matching subtype found.",
247 (int)subvalue->orig_len, (char *)subvalue->original);
248 } else if (type_idx) {
249 *type_idx = u;
250 }
251
252 /* restore logging */
253 ly_log_options(prev_lo);
254 return ret;
255}
256
275static LY_ERR
276lyb_fill_subvalue(const struct ly_ctx *ctx, struct lysc_type_union *type_u, const void *lyb_data, size_t lyb_data_len,
277 void *prefix_data, struct lyd_value_union *subvalue, uint32_t *options, struct lys_glob_unres *unres,
278 struct ly_err_item **err)
279{
280 LY_ERR ret;
281 uint32_t type_idx;
282 const void *lyb_value = NULL;
283 size_t lyb_value_len = 0;
284
285 ret = lyb_union_validate(lyb_data, lyb_data_len, type_u, err);
286 LY_CHECK_RET(ret);
287
288 /* Parse lyb_data and set the lyb_value and lyb_value_len. */
289 lyb_parse_union(lyb_data, lyb_data_len, &type_idx, &lyb_value, &lyb_value_len);
290 LY_CHECK_RET(ret);
291
292 /* Store lyb_data to subvalue. */
293 ret = union_subvalue_assignment(lyb_data, lyb_data_len,
294 &subvalue->original, &subvalue->orig_len, options);
295 LY_CHECK_RET(ret);
296
297 if (lyb_value) {
298 /* Resolve prefix_data and set format. */
299 ret = lyplg_type_prefix_data_new(ctx, lyb_value, lyb_value_len, LY_VALUE_LYB, prefix_data, &subvalue->format,
300 &subvalue->prefix_data);
301 LY_CHECK_RET(ret);
302 assert(subvalue->format == LY_VALUE_LYB);
303 } else {
304 /* The lyb_parse_union() did not find lyb_value.
305 * Just set format.
306 */
307 subvalue->format = LY_VALUE_LYB;
308 }
309
310 /* Use the specific type to store the value. */
311 ret = union_store_type(ctx, type_u->types[type_idx], subvalue, 0, NULL, NULL, unres, err);
312
313 return ret;
314}
315
316LIBYANG_API_DEF LY_ERR
317lyplg_type_store_union(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
318 uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
319 struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err)
320{
321 LY_ERR ret = LY_SUCCESS, r;
322 struct lysc_type_union *type_u = (struct lysc_type_union *)type;
323 struct lyd_value_union *subvalue;
324
325 *err = NULL;
326
327 /* init storage */
328 memset(storage, 0, sizeof *storage);
329 LYPLG_TYPE_VAL_INLINE_PREPARE(storage, subvalue);
330 LY_CHECK_ERR_GOTO(!subvalue, ret = LY_EMEM, cleanup);
331 storage->realtype = type;
332 subvalue->hints = hints;
333 subvalue->ctx_node = ctx_node;
334
335 if (format == LY_VALUE_LYB) {
336 ret = lyb_fill_subvalue(ctx, type_u, value, value_len,
337 prefix_data, subvalue, &options, unres, err);
338 LY_CHECK_GOTO((ret != LY_SUCCESS) && (ret != LY_EINCOMPLETE), cleanup);
339 } else {
340 /* Store @p value to subvalue. */
341 ret = union_subvalue_assignment(value, value_len,
342 &subvalue->original, &subvalue->orig_len, &options);
343 LY_CHECK_GOTO(ret, cleanup);
344
345 /* store format-specific data for later prefix resolution */
346 ret = lyplg_type_prefix_data_new(ctx, value, value_len, format, prefix_data, &subvalue->format,
347 &subvalue->prefix_data);
348 LY_CHECK_GOTO(ret, cleanup);
349
350 /* use the first usable subtype to store the value */
351 ret = union_find_type(ctx, type_u->types, subvalue, 0, NULL, NULL, NULL, unres, err);
352 LY_CHECK_GOTO((ret != LY_SUCCESS) && (ret != LY_EINCOMPLETE), cleanup);
353 }
354
355 /* store canonical value, if any (use the specific type value) */
356 r = lydict_insert(ctx, subvalue->value._canonical, 0, &storage->_canonical);
357 LY_CHECK_ERR_GOTO(r, ret = r, cleanup);
358
359cleanup:
360 if (options & LYPLG_TYPE_STORE_DYNAMIC) {
361 free((void *)value);
362 }
363
364 if ((ret != LY_SUCCESS) && (ret != LY_EINCOMPLETE)) {
365 lyplg_type_free_union(ctx, storage);
366 }
367 return ret;
368}
369
370LIBYANG_API_DEF LY_ERR
371lyplg_type_validate_union(const struct ly_ctx *ctx, const struct lysc_type *type, const struct lyd_node *ctx_node,
372 const struct lyd_node *tree, struct lyd_value *storage, struct ly_err_item **err)
373{
374 LY_ERR ret = LY_SUCCESS;
375 struct lysc_type_union *type_u = (struct lysc_type_union *)type;
376 struct lyd_value_union *subvalue = storage->subvalue;
377
378 *err = NULL;
379
380 /* because of types that do not store their own type as realtype (leafref), we are not able to call their
381 * validate callback (there is no way to get the type TODO could be added to struct lyd_value_union), so
382 * we have to perform union value storing again from scratch */
383 subvalue->value.realtype->plugin->free(ctx, &subvalue->value);
384
385 /* use the first usable subtype to store the value */
386 ret = union_find_type(ctx, type_u->types, subvalue, 1, ctx_node, tree, NULL, NULL, err);
387 LY_CHECK_RET(ret);
388
389 /* success, update the canonical value, if any generated */
390 lydict_remove(ctx, storage->_canonical);
391 LY_CHECK_RET(lydict_insert(ctx, subvalue->value._canonical, 0, &storage->_canonical));
392 return LY_SUCCESS;
393}
394
395LIBYANG_API_DEF LY_ERR
396lyplg_type_compare_union(const struct lyd_value *val1, const struct lyd_value *val2)
397{
398 if (val1->realtype != val2->realtype) {
399 return LY_ENOT;
400 }
401
402 if (val1->subvalue->value.realtype != val2->subvalue->value.realtype) {
403 return LY_ENOT;
404 }
405 return val1->subvalue->value.realtype->plugin->compare(&val1->subvalue->value, &val2->subvalue->value);
406}
407
420static const void *
421lyb_union_print(const struct ly_ctx *ctx, struct lysc_type_union *type_u, struct lyd_value_union *subvalue,
422 void *prefix_data, size_t *value_len)
423{
424 void *ret = NULL;
425 LY_ERR retval;
426 struct ly_err_item *err;
427 uint64_t num = 0;
428 uint32_t type_idx;
429 ly_bool dynamic;
430 size_t pval_len;
431 void *pval;
432
433 /* Find out the index number (type_idx). The call should succeed
434 * because the union_find_type() has already been called in the
435 * lyplg_type_store_union().
436 */
437 if (!ctx) {
438 assert(subvalue->ctx_node);
439 ctx = subvalue->ctx_node->module->ctx;
440 }
441 subvalue->value.realtype->plugin->free(ctx, &subvalue->value);
442 retval = union_find_type(ctx, type_u->types, subvalue, 0, NULL, NULL, &type_idx, NULL, &err);
443 LY_CHECK_RET((retval != LY_SUCCESS) && (retval != LY_EINCOMPLETE), NULL);
444
445 /* Print subvalue in LYB format. */
446 pval = (void *)subvalue->value.realtype->plugin->print(NULL, &subvalue->value, LY_VALUE_LYB, prefix_data, &dynamic,
447 &pval_len);
448 LY_CHECK_RET(!pval, NULL);
449
450 /* Create LYB data. */
451 *value_len = IDX_SIZE + pval_len;
452 ret = malloc(*value_len);
453 LY_CHECK_RET(!ret, NULL);
454
455 num = type_idx;
456 num = htole64(num);
457 memcpy(ret, &num, IDX_SIZE);
458 memcpy((char *)ret + IDX_SIZE, pval, pval_len);
459
460 if (dynamic) {
461 free(pval);
462 }
463
464 return ret;
465}
466
467LIBYANG_API_DEF const void *
468lyplg_type_print_union(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format,
469 void *prefix_data, ly_bool *dynamic, size_t *value_len)
470{
471 const void *ret;
472 struct lyd_value_union *subvalue = value->subvalue;
473 struct lysc_type_union *type_u = (struct lysc_type_union *)value->realtype;
474 size_t lyb_data_len = 0;
475
476 if ((format == LY_VALUE_LYB) && (subvalue->format == LY_VALUE_LYB)) {
477 /* The return value is already ready. */
478 *dynamic = 0;
479 if (value_len) {
480 *value_len = subvalue->orig_len;
481 }
482 return subvalue->original;
483 } else if ((format == LY_VALUE_LYB) && (subvalue->format != LY_VALUE_LYB)) {
484 /* The return LYB data must be created. */
485 *dynamic = 1;
486 ret = lyb_union_print(ctx, type_u, subvalue, prefix_data, &lyb_data_len);
487 if (value_len) {
488 *value_len = lyb_data_len;
489 }
490 return ret;
491 }
492
493 assert(format != LY_VALUE_LYB);
494 ret = (void *)subvalue->value.realtype->plugin->print(ctx, &subvalue->value, format, prefix_data, dynamic, value_len);
495 if (!value->_canonical && (format == LY_VALUE_CANON)) {
496 /* the canonical value is supposed to be stored now */
497 lydict_insert(ctx, subvalue->value._canonical, 0, (const char **)&value->_canonical);
498 }
499
500 return ret;
501}
502
503LIBYANG_API_DEF LY_ERR
504lyplg_type_dup_union(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup)
505{
506 LY_ERR ret = LY_SUCCESS;
507 struct lyd_value_union *orig_val = original->subvalue, *dup_val;
508
509 /* init dup value */
510 memset(dup, 0, sizeof *dup);
511 dup->realtype = original->realtype;
512
513 ret = lydict_insert(ctx, original->_canonical, 0, &dup->_canonical);
514 LY_CHECK_GOTO(ret, cleanup);
515
516 dup_val = calloc(1, sizeof *dup_val);
517 LY_CHECK_ERR_GOTO(!dup_val, LOGMEM(ctx); ret = LY_EMEM, cleanup);
518 dup->subvalue = dup_val;
519
520 ret = orig_val->value.realtype->plugin->duplicate(ctx, &orig_val->value, &dup_val->value);
521 LY_CHECK_GOTO(ret, cleanup);
522
523 if (orig_val->orig_len) {
524 dup_val->original = calloc(1, orig_val->orig_len);
525 LY_CHECK_ERR_GOTO(!dup_val->original, LOGMEM(ctx); ret = LY_EMEM, cleanup);
526 memcpy(dup_val->original, orig_val->original, orig_val->orig_len);
527 } else {
528 dup_val->original = strdup("");
529 LY_CHECK_ERR_GOTO(!dup_val->original, LOGMEM(ctx); ret = LY_EMEM, cleanup);
530 }
531 dup_val->orig_len = orig_val->orig_len;
532
533 dup_val->format = orig_val->format;
534 dup_val->ctx_node = orig_val->ctx_node;
535 dup_val->hints = orig_val->hints;
536 ret = lyplg_type_prefix_data_dup(ctx, orig_val->format, orig_val->prefix_data, &dup_val->prefix_data);
537 LY_CHECK_GOTO(ret, cleanup);
538
539cleanup:
540 if (ret) {
541 lyplg_type_free_union(ctx, dup);
542 }
543 return ret;
544}
545
546LIBYANG_API_DEF void
547lyplg_type_free_union(const struct ly_ctx *ctx, struct lyd_value *value)
548{
549 struct lyd_value_union *val;
550
552 value->_canonical = NULL;
553 LYD_VALUE_GET(value, val);
554 if (val) {
555 if (val->value.realtype) {
556 val->value.realtype->plugin->free(ctx, &val->value);
557 }
559 free(val->original);
560
562 }
563}
564
573 {
574 .module = "",
575 .revision = NULL,
576 .name = LY_TYPE_UNION_STR,
577
578 .plugin.id = "libyang 2 - union,version 1",
579 .plugin.store = lyplg_type_store_union,
580 .plugin.validate = lyplg_type_validate_union,
581 .plugin.compare = lyplg_type_compare_union,
582 .plugin.sort = NULL,
583 .plugin.print = lyplg_type_print_union,
584 .plugin.duplicate = lyplg_type_dup_union,
585 .plugin.free = lyplg_type_free_union,
586 .plugin.lyb_data_len = -1,
587 },
588 {0}
589};
libyang context handler.
LIBYANG_API_DECL LY_ERR lydict_insert(const struct ly_ctx *ctx, const char *value, size_t len, const char **str_p)
Insert string into dictionary. If the string is already present, only a reference counter is incremen...
LIBYANG_API_DECL LY_ERR lydict_remove(const struct ly_ctx *ctx, const char *value)
Remove specified string from the dictionary. It decrement reference counter for the string and if it ...
LY_ERR
libyang's error codes returned by the libyang functions.
Definition: log.h:244
@ LYVE_DATA
Definition: log.h:281
@ LY_EINVAL
Definition: log.h:248
@ LY_EMEM
Definition: log.h:246
@ LY_ENOT
Definition: log.h:258
@ LY_EVALID
Definition: log.h:252
@ LY_SUCCESS
Definition: log.h:245
@ LY_EINCOMPLETE
Definition: log.h:254
Libyang full error structure.
Definition: log.h:289
LIBYANG_API_DECL uint32_t ly_log_options(uint32_t opts)
Set logger options. Default is LY_LOLOG | LY_LOSTORE_LAST.
const char * module
lyplg_type_print_clb print
lyplg_type_store_clb store
lyplg_type_compare_clb compare
lyplg_type_validate_clb validate
lyplg_type_dup_clb duplicate
lyplg_type_free_clb free
#define LYPLG_TYPE_VAL_INLINE_PREPARE(storage, type_val)
Prepare value memory for storing a specific type value, may be allocated dynamically.
LIBYANG_API_DECL LY_ERR ly_err_new(struct ly_err_item **err, LY_ERR ecode, LY_VECODE vecode, char *path, char *apptag, const char *err_format,...) _FORMAT_PRINTF(6
Create and fill error structure.
LIBYANG_API_DECL LY_ERR LIBYANG_API_DECL void ly_err_free(void *ptr)
Destructor for the error records created with ly_err_new().
#define LYPLG_TYPE_VAL_INLINE_DESTROY(type_val)
Destroy a prepared value.
LIBYANG_API_DECL LY_ERR lyplg_type_prefix_data_new(const struct ly_ctx *ctx, const void *value, size_t value_len, LY_VALUE_FORMAT format, const void *prefix_data, LY_VALUE_FORMAT *format_p, void **prefix_data_p)
Store used prefixes in a string into an internal libyang structure used in lyd_value.
LIBYANG_API_DECL LY_ERR lyplg_type_prefix_data_dup(const struct ly_ctx *ctx, LY_VALUE_FORMAT format, const void *orig, void **dup)
Duplicate prefix data.
LIBYANG_API_DECL void lyplg_type_prefix_data_free(LY_VALUE_FORMAT format, void *prefix_data)
Free internal prefix data.
LIBYANG_API_DEF void lyplg_type_free_union(const struct ly_ctx *ctx, struct lyd_value *value)
Implementation of lyplg_type_free_clb for the built-in union type.
Definition: union.c:547
LIBYANG_API_DEF LY_ERR lyplg_type_compare_union(const struct lyd_value *val1, const struct lyd_value *val2)
Implementation of lyplg_type_compare_clb for the built-in union type.
Definition: union.c:396
LIBYANG_API_DEF const void * lyplg_type_print_union(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format, void *prefix_data, ly_bool *dynamic, size_t *value_len)
Implementation of lyplg_type_print_clb for the built-in union type.
Definition: union.c:468
LIBYANG_API_DEF LY_ERR lyplg_type_validate_union(const struct ly_ctx *ctx, const struct lysc_type *type, const struct lyd_node *ctx_node, const struct lyd_node *tree, struct lyd_value *storage, struct ly_err_item **err)
Implementation of lyplg_type_validate_clb for the built-in union type.
Definition: union.c:371
LIBYANG_API_DEF LY_ERR lyplg_type_store_union(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len, uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node, struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err)
Implementation of lyplg_type_store_clb for the built-in union type.
Definition: union.c:317
LIBYANG_API_DEF LY_ERR lyplg_type_dup_union(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup)
Implementation of lyplg_type_dup_clb for the built-in union type.
Definition: union.c:504
#define LYPLG_TYPE_STORE_DYNAMIC
struct lys_module * module
Definition: tree_schema.h:1402
struct lyplg_type * plugin
Definition: tree_schema.h:1282
struct lysc_type ** types
Definition: tree_schema.h:1379
struct ly_ctx * ctx
Definition: tree_schema.h:2081
Compiled YANG data node.
Definition: tree_schema.h:1398
#define LY_ARRAY_COUNT(ARRAY)
Get the number of records in the ARRAY.
Definition: tree.h:148
LY_VALUE_FORMAT
All kinds of supported value formats and prefix mappings to modules.
Definition: tree.h:234
#define LY_PRI_ARRAY_COUNT_TYPE
Printing format specifier macro for LY_ARRAY_SIZE_TYPE values.
Definition: tree.h:109
#define LY_ARRAY_COUNT_TYPE
Type (i.e. size) of the sized array's size counter.
Definition: tree.h:104
@ LY_VALUE_CANON
Definition: tree.h:235
@ LY_VALUE_LYB
Definition: tree.h:240
The main libyang public header.
uint8_t ly_bool
Type to indicate boolean value.
Definition: log.h:35
API for (user) types plugins.
const struct lysc_type * realtype
Definition: tree_data.h:564
void * original
Definition: tree_data.h:618
void * prefix_data
Definition: tree_data.h:624
uint32_t hints
Definition: tree_data.h:620
#define LYD_VALUE_GET(value, type_val)
Get the value in format specific to the type.
Definition: tree_data.h:603
size_t orig_len
Definition: tree_data.h:619
struct lyd_value value
Definition: tree_data.h:616
const char * _canonical
Definition: tree_data.h:561
LY_VALUE_FORMAT format
Definition: tree_data.h:621
const struct lysc_node * ctx_node
Definition: tree_data.h:625
Generic structure for a data node.
Definition: tree_data.h:781
YANG data representation.
Definition: tree_data.h:560
Special lyd_value structure for built-in union values.
Definition: tree_data.h:615
#define LOGMEM(CTX)
Definition: tree_edit.h:22
#define IDX_SIZE
Size in bytes of the index in the LYB Binary Format.
Definition: union.c:46
const struct lyplg_type_record plugins_union[]
Plugin information for union type implementation.
Definition: union.c:572