libyang  2.0.194
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
integer.c
Go to the documentation of this file.
1 
15 #define _GNU_SOURCE /* asprintf, strdup */
16 
17 #include "plugins_types.h"
18 
19 #include <stdint.h>
20 #include <stdio.h>
21 #include <stdlib.h>
22 
23 #include "libyang.h"
24 
25 /* additional internal headers for some useful simple macros */
26 #include "common.h"
27 #include "compat.h"
28 #include "plugins_internal.h" /* LY_TYPE_*_STR */
29 
42 static size_t integer_lyb_size[] = {
43  [LY_TYPE_INT8] = 1, [LY_TYPE_INT16] = 2, [LY_TYPE_INT32] = 4, [LY_TYPE_INT64] = 8,
45 };
46 
47 LIBYANG_API_DEF LY_ERR
48 lyplg_type_store_int(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
49  uint32_t options, LY_VALUE_FORMAT format, void *UNUSED(prefix_data), uint32_t hints,
50  const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
51  struct ly_err_item **err)
52 {
53  LY_ERR ret = LY_SUCCESS;
54  int64_t num = 0;
55  int base = 1;
56  char *canon = NULL;
57  struct lysc_type_num *type_num = (struct lysc_type_num *)type;
58 
59  /* init storage */
60  memset(storage, 0, sizeof *storage);
61  storage->realtype = type;
62 
63  if (format == LY_VALUE_LYB) {
64  /* validation */
65  if (value_len != integer_lyb_size[type->basetype]) {
66  ret = ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, NULL, "Invalid LYB signed integer value size %zu (expected %zu).",
67  value_len, integer_lyb_size[type->basetype]);
68  goto cleanup;
69  }
70 
71  /* copy the integer and correct the byte order */
72  memcpy(&num, value, value_len);
73  num = le64toh(num);
74  } else {
75  /* check hints */
76  ret = lyplg_type_check_hints(hints, value, value_len, type->basetype, &base, err);
77  LY_CHECK_GOTO(ret, cleanup);
78 
79  /* parse the integer */
80  switch (type->basetype) {
81  case LY_TYPE_INT8:
82  ret = lyplg_type_parse_int("int8", base, INT64_C(-128), INT64_C(127), value, value_len, &num, err);
83  break;
84  case LY_TYPE_INT16:
85  ret = lyplg_type_parse_int("int16", base, INT64_C(-32768), INT64_C(32767), value, value_len, &num, err);
86  break;
87  case LY_TYPE_INT32:
88  ret = lyplg_type_parse_int("int32", base, INT64_C(-2147483648), INT64_C(2147483647), value, value_len, &num, err);
89  break;
90  case LY_TYPE_INT64:
91  ret = lyplg_type_parse_int("int64", base, INT64_C(-9223372036854775807) - INT64_C(1),
92  INT64_C(9223372036854775807), value, value_len, &num, err);
93  break;
94  default:
95  LOGINT(ctx);
96  ret = LY_EINT;
97  }
98  LY_CHECK_GOTO(ret, cleanup);
99  }
100 
101  /* set the value (matters for big-endian) and get the correct int64 number */
102  switch (type->basetype) {
103  case LY_TYPE_INT8:
104  storage->int8 = num;
105  num = storage->int8;
106  break;
107  case LY_TYPE_INT16:
108  storage->int16 = num;
109  num = storage->int16;
110  break;
111  case LY_TYPE_INT32:
112  storage->int32 = num;
113  num = storage->int32;
114  break;
115  case LY_TYPE_INT64:
116  storage->int64 = num;
117  num = storage->int64;
118  break;
119  default:
120  break;
121  }
122 
123  if (format == LY_VALUE_CANON) {
124  /* store canonical value */
125  if (options & LYPLG_TYPE_STORE_DYNAMIC) {
126  ret = lydict_insert_zc(ctx, (char *)value, &storage->_canonical);
127  options &= ~LYPLG_TYPE_STORE_DYNAMIC;
128  LY_CHECK_GOTO(ret, cleanup);
129  } else {
130  ret = lydict_insert(ctx, value, value_len, &storage->_canonical);
131  LY_CHECK_GOTO(ret, cleanup);
132  }
133  } else {
134  /* generate canonical value */
135  switch (type->basetype) {
136  case LY_TYPE_INT8:
137  LY_CHECK_ERR_GOTO(asprintf(&canon, "%" PRId8, storage->int8) == -1, ret = LY_EMEM, cleanup);
138  break;
139  case LY_TYPE_INT16:
140  LY_CHECK_ERR_GOTO(asprintf(&canon, "%" PRId16, storage->int16) == -1, ret = LY_EMEM, cleanup);
141  break;
142  case LY_TYPE_INT32:
143  LY_CHECK_ERR_GOTO(asprintf(&canon, "%" PRId32, storage->int32) == -1, ret = LY_EMEM, cleanup);
144  break;
145  case LY_TYPE_INT64:
146  LY_CHECK_ERR_GOTO(asprintf(&canon, "%" PRId64, storage->int64) == -1, ret = LY_EMEM, cleanup);
147  break;
148  default:
149  break;
150  }
151 
152  /* store it */
153  ret = lydict_insert_zc(ctx, canon, (const char **)&storage->_canonical);
154  LY_CHECK_GOTO(ret, cleanup);
155  }
156 
157  /* validate range of the number */
158  if (type_num->range) {
159  ret = lyplg_type_validate_range(type->basetype, type_num->range, num, storage->_canonical,
160  strlen(storage->_canonical), err);
161  LY_CHECK_GOTO(ret, cleanup);
162  }
163 
164 cleanup:
165  if (options & LYPLG_TYPE_STORE_DYNAMIC) {
166  free((void *)value);
167  }
168 
169  if (ret) {
170  lyplg_type_free_simple(ctx, storage);
171  }
172  return ret;
173 }
174 
175 LIBYANG_API_DEF LY_ERR
176 lyplg_type_compare_int(const struct lyd_value *val1, const struct lyd_value *val2)
177 {
178  if (val1->realtype != val2->realtype) {
179  return LY_ENOT;
180  }
181 
182  switch (val1->realtype->basetype) {
183  case LY_TYPE_INT8:
184  if (val1->int8 != val2->int8) {
185  return LY_ENOT;
186  }
187  break;
188  case LY_TYPE_INT16:
189  if (val1->int16 != val2->int16) {
190  return LY_ENOT;
191  }
192  break;
193  case LY_TYPE_INT32:
194  if (val1->int32 != val2->int32) {
195  return LY_ENOT;
196  }
197  break;
198  case LY_TYPE_INT64:
199  if (val1->int64 != val2->int64) {
200  return LY_ENOT;
201  }
202  break;
203  default:
204  break;
205  }
206  return LY_SUCCESS;
207 }
208 
209 LIBYANG_API_DEF const void *
210 lyplg_type_print_int(const struct ly_ctx *UNUSED(ctx), const struct lyd_value *value, LY_VALUE_FORMAT format,
211  void *UNUSED(prefix_data), ly_bool *dynamic, size_t *value_len)
212 {
213  int64_t prev_num = 0, num = 0;
214  void *buf;
215 
216  if (format == LY_VALUE_LYB) {
217  switch (value->realtype->basetype) {
218  case LY_TYPE_INT8:
219  prev_num = num = value->int8;
220  break;
221  case LY_TYPE_INT16:
222  prev_num = num = value->int16;
223  break;
224  case LY_TYPE_INT32:
225  prev_num = num = value->int32;
226  break;
227  case LY_TYPE_INT64:
228  prev_num = num = value->int64;
229  break;
230  default:
231  break;
232  }
233  num = htole64(num);
234  if (num == prev_num) {
235  /* values are equal, little-endian or int8 */
236  *dynamic = 0;
237  if (value_len) {
238  *value_len = integer_lyb_size[value->realtype->basetype];
239  }
240  return &value->int64;
241  } else {
242  /* values differ, big-endian */
243  buf = calloc(1, integer_lyb_size[value->realtype->basetype]);
244  LY_CHECK_RET(!buf, NULL);
245 
246  *dynamic = 1;
247  if (value_len) {
248  *value_len = integer_lyb_size[value->realtype->basetype];
249  }
250  memcpy(buf, &num, integer_lyb_size[value->realtype->basetype]);
251  return buf;
252  }
253  }
254 
255  /* use the cached canonical value */
256  if (dynamic) {
257  *dynamic = 0;
258  }
259  if (value_len) {
260  *value_len = strlen(value->_canonical);
261  }
262  return value->_canonical;
263 }
264 
265 LIBYANG_API_DEF LY_ERR
266 lyplg_type_store_uint(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len,
267  uint32_t options, LY_VALUE_FORMAT format, void *UNUSED(prefix_data), uint32_t hints,
268  const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
269  struct ly_err_item **err)
270 {
271  LY_ERR ret = LY_SUCCESS;
272  uint64_t num = 0;
273  int base = 0;
274  char *canon;
275  struct lysc_type_num *type_num = (struct lysc_type_num *)type;
276 
277  /* init storage */
278  memset(storage, 0, sizeof *storage);
279  storage->realtype = type;
280 
281  if (format == LY_VALUE_LYB) {
282  /* validation */
283  if (value_len != integer_lyb_size[type->basetype]) {
284  ret = ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, NULL, "Invalid LYB unsigned integer value size %zu (expected %zu).",
285  value_len, integer_lyb_size[type->basetype]);
286  goto cleanup;
287  }
288 
289  /* copy the integer and correct the byte order */
290  memcpy(&num, value, value_len);
291  num = le64toh(num);
292  } else {
293  /* check hints */
294  ret = lyplg_type_check_hints(hints, value, value_len, type->basetype, &base, err);
295  LY_CHECK_GOTO(ret, cleanup);
296 
297  /* parse the integer */
298  switch (type->basetype) {
299  case LY_TYPE_UINT8:
300  ret = lyplg_type_parse_uint("uint8", base, UINT64_C(255), value, value_len, &num, err);
301  break;
302  case LY_TYPE_UINT16:
303  ret = lyplg_type_parse_uint("uint16", base, UINT64_C(65535), value, value_len, &num, err);
304  break;
305  case LY_TYPE_UINT32:
306  ret = lyplg_type_parse_uint("uint32", base, UINT64_C(4294967295), value, value_len, &num, err);
307  break;
308  case LY_TYPE_UINT64:
309  ret = lyplg_type_parse_uint("uint64", base, UINT64_C(18446744073709551615), value, value_len, &num, err);
310  break;
311  default:
312  LOGINT(ctx);
313  ret = LY_EINT;
314  }
315  LY_CHECK_GOTO(ret, cleanup);
316  }
317 
318  /* store value, matters for big-endian */
319  switch (type->basetype) {
320  case LY_TYPE_UINT8:
321  storage->uint8 = num;
322  break;
323  case LY_TYPE_UINT16:
324  storage->uint16 = num;
325  break;
326  case LY_TYPE_UINT32:
327  storage->uint32 = num;
328  break;
329  case LY_TYPE_UINT64:
330  storage->uint64 = num;
331  break;
332  default:
333  break;
334  }
335 
336  if (format == LY_VALUE_CANON) {
337  /* store canonical value */
338  if (options & LYPLG_TYPE_STORE_DYNAMIC) {
339  ret = lydict_insert_zc(ctx, (char *)value, &storage->_canonical);
340  options &= ~LYPLG_TYPE_STORE_DYNAMIC;
341  LY_CHECK_GOTO(ret, cleanup);
342  } else {
343  ret = lydict_insert(ctx, value, value_len, &storage->_canonical);
344  LY_CHECK_GOTO(ret, cleanup);
345  }
346  } else {
347  /* generate canonical value */
348  LY_CHECK_ERR_GOTO(asprintf(&canon, "%" PRIu64, num) == -1, ret = LY_EMEM, cleanup);
349 
350  /* store it */
351  ret = lydict_insert_zc(ctx, canon, (const char **)&storage->_canonical);
352  LY_CHECK_GOTO(ret, cleanup);
353  }
354 
355  /* validate range of the number */
356  if (type_num->range) {
357  ret = lyplg_type_validate_range(type->basetype, type_num->range, num, storage->_canonical,
358  strlen(storage->_canonical), err);
359  LY_CHECK_GOTO(ret, cleanup);
360  }
361 
362 cleanup:
363  if (options & LYPLG_TYPE_STORE_DYNAMIC) {
364  free((void *)value);
365  }
366 
367  if (ret) {
368  lyplg_type_free_simple(ctx, storage);
369  }
370  return ret;
371 }
372 
373 LIBYANG_API_DEF LY_ERR
374 lyplg_type_compare_uint(const struct lyd_value *val1, const struct lyd_value *val2)
375 {
376  if (val1->realtype != val2->realtype) {
377  return LY_ENOT;
378  }
379 
380  switch (val1->realtype->basetype) {
381  case LY_TYPE_UINT8:
382  if (val1->uint8 != val2->uint8) {
383  return LY_ENOT;
384  }
385  break;
386  case LY_TYPE_UINT16:
387  if (val1->uint16 != val2->uint16) {
388  return LY_ENOT;
389  }
390  break;
391  case LY_TYPE_UINT32:
392  if (val1->uint32 != val2->uint32) {
393  return LY_ENOT;
394  }
395  break;
396  case LY_TYPE_UINT64:
397  if (val1->uint64 != val2->uint64) {
398  return LY_ENOT;
399  }
400  break;
401  default:
402  break;
403  }
404  return LY_SUCCESS;
405 }
406 
407 LIBYANG_API_DEF const void *
408 lyplg_type_print_uint(const struct ly_ctx *UNUSED(ctx), const struct lyd_value *value, LY_VALUE_FORMAT format,
409  void *UNUSED(prefix_data), ly_bool *dynamic, size_t *value_len)
410 {
411  uint64_t num = 0;
412  void *buf;
413 
414  if (format == LY_VALUE_LYB) {
415  switch (value->realtype->basetype) {
416  case LY_TYPE_UINT8:
417  num = value->uint8;
418  break;
419  case LY_TYPE_UINT16:
420  num = value->uint16;
421  break;
422  case LY_TYPE_UINT32:
423  num = value->uint32;
424  break;
425  case LY_TYPE_UINT64:
426  num = value->uint64;
427  break;
428  default:
429  break;
430  }
431  num = htole64(num);
432  if (num == value->uint64) {
433  /* values are equal, little-endian or uint8 */
434  *dynamic = 0;
435  if (value_len) {
436  *value_len = integer_lyb_size[value->realtype->basetype];
437  }
438  return &value->uint64;
439  } else {
440  /* values differ, big-endian */
441  buf = calloc(1, integer_lyb_size[value->realtype->basetype]);
442  LY_CHECK_RET(!buf, NULL);
443 
444  *dynamic = 1;
445  if (value_len) {
446  *value_len = integer_lyb_size[value->realtype->basetype];
447  }
448  memcpy(buf, &num, integer_lyb_size[value->realtype->basetype]);
449  return buf;
450  }
451  }
452 
453  /* use the cached canonical value */
454  if (dynamic) {
455  *dynamic = 0;
456  }
457  if (value_len) {
458  *value_len = strlen(value->_canonical);
459  }
460  return value->_canonical;
461 }
462 
470 const struct lyplg_type_record plugins_integer[] = {
471  {
472  .module = "",
473  .revision = NULL,
474  .name = LY_TYPE_UINT8_STR,
475 
476  .plugin.id = "libyang 2 - integers, version 1",
477  .plugin.store = lyplg_type_store_uint,
478  .plugin.validate = NULL,
479  .plugin.compare = lyplg_type_compare_uint,
480  .plugin.sort = NULL,
481  .plugin.print = lyplg_type_print_uint,
482  .plugin.duplicate = lyplg_type_dup_simple,
483  .plugin.free = lyplg_type_free_simple,
484  .plugin.lyb_data_len = 1,
485  }, {
486  .module = "",
487  .revision = NULL,
488  .name = LY_TYPE_UINT16_STR,
489 
490  .plugin.id = "libyang 2 - integers, version 1",
491  .plugin.store = lyplg_type_store_uint,
492  .plugin.validate = NULL,
493  .plugin.compare = lyplg_type_compare_uint,
494  .plugin.sort = NULL,
495  .plugin.print = lyplg_type_print_uint,
496  .plugin.duplicate = lyplg_type_dup_simple,
497  .plugin.free = lyplg_type_free_simple,
498  .plugin.lyb_data_len = 2,
499  }, {
500  .module = "",
501  .revision = NULL,
502  .name = LY_TYPE_UINT32_STR,
503 
504  .plugin.id = "libyang 2 - integers, version 1",
505  .plugin.store = lyplg_type_store_uint,
506  .plugin.validate = NULL,
507  .plugin.compare = lyplg_type_compare_uint,
508  .plugin.sort = NULL,
509  .plugin.print = lyplg_type_print_uint,
510  .plugin.duplicate = lyplg_type_dup_simple,
511  .plugin.free = lyplg_type_free_simple,
512  .plugin.lyb_data_len = 4,
513  }, {
514  .module = "",
515  .revision = NULL,
516  .name = LY_TYPE_UINT64_STR,
517 
518  .plugin.id = "libyang 2 - integers, version 1",
519  .plugin.store = lyplg_type_store_uint,
520  .plugin.validate = NULL,
521  .plugin.compare = lyplg_type_compare_uint,
522  .plugin.sort = NULL,
523  .plugin.print = lyplg_type_print_uint,
524  .plugin.duplicate = lyplg_type_dup_simple,
525  .plugin.free = lyplg_type_free_simple,
526  .plugin.lyb_data_len = 8,
527  }, {
528  .module = "",
529  .revision = NULL,
530  .name = LY_TYPE_INT8_STR,
531 
532  .plugin.id = "libyang 2 - integers, version 1",
533  .plugin.store = lyplg_type_store_int,
534  .plugin.validate = NULL,
535  .plugin.compare = lyplg_type_compare_int,
536  .plugin.sort = NULL,
537  .plugin.print = lyplg_type_print_int,
538  .plugin.duplicate = lyplg_type_dup_simple,
539  .plugin.free = lyplg_type_free_simple,
540  .plugin.lyb_data_len = 1,
541  }, {
542  .module = "",
543  .revision = NULL,
544  .name = LY_TYPE_INT16_STR,
545 
546  .plugin.id = "libyang 2 - integers, version 1",
547  .plugin.store = lyplg_type_store_int,
548  .plugin.validate = NULL,
549  .plugin.compare = lyplg_type_compare_int,
550  .plugin.sort = NULL,
551  .plugin.print = lyplg_type_print_int,
552  .plugin.duplicate = lyplg_type_dup_simple,
553  .plugin.free = lyplg_type_free_simple,
554  .plugin.lyb_data_len = 2,
555  }, {
556  .module = "",
557  .revision = NULL,
558  .name = LY_TYPE_INT32_STR,
559 
560  .plugin.id = "libyang 2 - integers, version 1",
561  .plugin.store = lyplg_type_store_int,
562  .plugin.validate = NULL,
563  .plugin.compare = lyplg_type_compare_int,
564  .plugin.sort = NULL,
565  .plugin.print = lyplg_type_print_int,
566  .plugin.duplicate = lyplg_type_dup_simple,
567  .plugin.free = lyplg_type_free_simple,
568  .plugin.lyb_data_len = 4,
569  }, {
570  .module = "",
571  .revision = NULL,
572  .name = LY_TYPE_INT64_STR,
573 
574  .plugin.id = "libyang 2 - integers, version 1",
575  .plugin.store = lyplg_type_store_int,
576  .plugin.validate = NULL,
577  .plugin.compare = lyplg_type_compare_int,
578  .plugin.sort = NULL,
579  .plugin.print = lyplg_type_print_int,
580  .plugin.duplicate = lyplg_type_dup_simple,
581  .plugin.free = lyplg_type_free_simple,
582  .plugin.lyb_data_len = 8,
583  },
584  {0}
585 };
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_insert_zc(const struct ly_ctx *ctx, char *value, const char **str_p)
Insert string into dictionary - zerocopy version. If the string is already present,...
LY_ERR
libyang's error codes returned by the libyang functions.
Definition: log.h:244
@ LYVE_DATA
Definition: log.h:281
@ LY_EMEM
Definition: log.h:246
@ LY_ENOT
Definition: log.h:258
@ LY_EVALID
Definition: log.h:252
@ LY_EINT
Definition: log.h:251
@ LY_SUCCESS
Definition: log.h:245
Libyang full error structure.
Definition: log.h:289
const char * module
LIBYANG_API_DECL LY_ERR lyplg_type_parse_int(const char *datatype, int base, int64_t min, int64_t max, const char *value, size_t value_len, int64_t *ret, struct ly_err_item **err)
Unsigned integer value parser and validator.
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 lyplg_type_parse_uint(const char *datatype, int base, uint64_t max, const char *value, size_t value_len, uint64_t *ret, struct ly_err_item **err)
Unsigned integer value parser and validator.
LIBYANG_API_DECL LY_ERR lyplg_type_validate_range(LY_DATA_TYPE basetype, struct lysc_range *range, int64_t value, const char *strval, size_t strval_len, struct ly_err_item **err)
Data type validator for a range/length-restricted values.
LIBYANG_API_DECL LY_ERR lyplg_type_check_hints(uint32_t hints, const char *value, size_t value_len, LY_DATA_TYPE type, int *base, struct ly_err_item **err)
Check that the type is suitable for the parser's hints (if any) in the specified format.
LIBYANG_API_DEF LY_ERR lyplg_type_compare_uint(const struct lyd_value *val1, const struct lyd_value *val2)
Implementation of lyplg_type_compare_clb for the built-in unsigned integer types.
Definition: integer.c:374
LIBYANG_API_DEF LY_ERR lyplg_type_compare_int(const struct lyd_value *val1, const struct lyd_value *val2)
Implementation of lyplg_type_compare_clb for the built-in signed integer types.
Definition: integer.c:176
LIBYANG_API_DECL LY_ERR lyplg_type_dup_simple(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup)
Implementation of lyplg_type_dup_clb for a generic simple type.
LIBYANG_API_DECL void lyplg_type_free_simple(const struct ly_ctx *ctx, struct lyd_value *value)
Implementation of lyplg_type_free_clb for a generic simple type.
#define LYPLG_TYPE_STORE_DYNAMIC
struct lysc_range * range
Definition: tree_schema.h:1546
LY_DATA_TYPE basetype
Definition: tree_schema.h:1536
Compiled YANG data node.
Definition: tree_schema.h:1650
LY_VALUE_FORMAT
All kinds of supported value formats and prefix mappings to modules.
Definition: tree.h:235
@ LY_TYPE_UINT16
Definition: tree.h:207
@ LY_TYPE_INT16
Definition: tree.h:221
@ LY_TYPE_INT32
Definition: tree.h:222
@ LY_TYPE_UINT8
Definition: tree.h:206
@ LY_TYPE_INT64
Definition: tree.h:223
@ LY_TYPE_INT8
Definition: tree.h:220
@ LY_TYPE_UINT64
Definition: tree.h:209
@ LY_TYPE_UINT32
Definition: tree.h:208
@ LY_VALUE_CANON
Definition: tree.h:236
@ LY_VALUE_LYB
Definition: tree.h:241
LIBYANG_API_DEF const void * lyplg_type_print_int(const struct ly_ctx *UNUSED(ctx), const struct lyd_value *value, LY_VALUE_FORMAT format, void *UNUSED(prefix_data), ly_bool *dynamic, size_t *value_len)
Definition: integer.c:210
const struct lyplg_type_record plugins_integer[]
Plugin information for integer types implementation.
Definition: integer.c:470
LIBYANG_API_DEF LY_ERR lyplg_type_store_uint(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 *UNUSED(prefix_data), uint32_t hints, const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres), struct ly_err_item **err)
Definition: integer.c:266
LIBYANG_API_DEF const void * lyplg_type_print_uint(const struct ly_ctx *UNUSED(ctx), const struct lyd_value *value, LY_VALUE_FORMAT format, void *UNUSED(prefix_data), ly_bool *dynamic, size_t *value_len)
Definition: integer.c:408
LIBYANG_API_DEF LY_ERR lyplg_type_store_int(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 *UNUSED(prefix_data), uint32_t hints, const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres), struct ly_err_item **err)
Definition: integer.c:48
The main libyang public header.
uint8_t ly_bool
Type to indicate boolean value.
Definition: log.h:27
API for (user) types plugins.
const struct lysc_type * realtype
Definition: tree_data.h:564
const char * _canonical
Definition: tree_data.h:561
YANG data representation.
Definition: tree_data.h:560