libyang  4.0.3
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
plugins_types.h
Go to the documentation of this file.
1 
16 #ifndef LY_PLUGINS_TYPES_H_
17 #define LY_PLUGINS_TYPES_H_
18 
19 #include <stddef.h>
20 #include <stdint.h>
21 
22 #include "log.h"
23 #include "ly_config.h"
24 #include "plugins.h"
25 #include "set.h"
26 #include "tree.h"
27 
28 #include "tree_edit.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 struct ly_ctx;
35 struct ly_path;
36 struct lyd_node;
37 struct lyd_value;
38 struct lyd_value_xpath10;
39 struct lys_module;
40 struct lys_glob_unres;
41 struct lysc_ext_instance;
42 struct lysc_ident;
43 struct lysc_node;
44 struct lysc_pattern;
45 struct lysc_range;
46 struct lysc_type;
47 struct lysc_type_bits;
48 struct lysc_type_leafref;
49 
148 #define LYPLG_TYPE_API_VERSION 3
149 
158 };
159 
166 #define LYPLG_TYPES \
167  uint32_t plugins_types_apiver__ = LYPLG_TYPE_API_VERSION; \
168  const struct lyplg_type_record plugins_types__[]
169 
175 #define LYPLG_TYPE_VAL_IS_DYN(type_val) \
176  (sizeof *(type_val) > LYD_VALUE_FIXED_MEM_SIZE)
177 
187 #define LYPLG_TYPE_VAL_INLINE_PREPARE(storage, type_val) \
188  (LYPLG_TYPE_VAL_IS_DYN(type_val) \
189  ? ((type_val) = ((storage)->dyn_mem = calloc(1, sizeof *(type_val)))) \
190  : ((type_val) = memset((storage)->fixed_mem, 0, sizeof *(type_val))))
191 
199 #define LYPLG_TYPE_VAL_INLINE_DESTROY(type_val) \
200  do { if (LYPLG_TYPE_VAL_IS_DYN(type_val)) free(type_val); } while(0)
201 
221 LIBYANG_API_DECL LY_ERR ly_err_new(struct ly_err_item **err, LY_ERR ecode, LY_VECODE vecode, char *data_path, char *apptag,
222  const char *err_format, ...) _FORMAT_PRINTF(6, 7);
223 
232 LIBYANG_API_DECL void ly_err_free(void *ptr);
233 
240 #define LYPLG_BITS2BYTES(bits) ((bits) / 8 + ((bits) % 8 ? 1 : 0))
241 
256 LIBYANG_API_DECL LY_ERR lyplg_type_check_value_size(const char *type_name, LY_VALUE_FORMAT format,
257  uint32_t value_size_bits, enum lyplg_lyb_size_type lyb_size_type, uint32_t lyb_fixed_size_bits,
258  uint32_t *value_size, struct ly_err_item **err);
259 
275 LIBYANG_API_DECL LY_ERR lyplg_type_check_hints(uint32_t hints, const char *value, uint32_t value_len, LY_DATA_TYPE type,
276  int *base, struct ly_err_item **err);
277 
289 LIBYANG_API_DECL LY_ERR lyplg_type_check_status(const struct lysc_node *ctx_node, uint16_t val_flags, LY_VALUE_FORMAT format,
290  void *prefix_data, const char *val_name, struct ly_err_item **err);
291 
302 LIBYANG_API_DECL LY_ERR lyplg_type_lypath_check_status(const struct lysc_node *ctx_node, const struct ly_path *path,
303  LY_VALUE_FORMAT format, void *prefix_data, struct ly_err_item **err);
304 
321 LIBYANG_API_DECL const struct lys_module *lyplg_type_identity_module(const struct ly_ctx *ctx,
322  const struct lysc_node *ctx_node, const char *prefix, uint32_t prefix_len, LY_VALUE_FORMAT format,
323  const void *prefix_data);
324 
336 LIBYANG_API_DECL LY_ERR lyplg_type_make_implemented(struct lys_module *mod, const char **features,
337  struct lys_glob_unres *unres);
338 
347 LIBYANG_API_DECL ly_bool lyplg_type_bits_is_bit_set(const char *bitmap, uint32_t size_bits, uint32_t bit_position);
348 
365 LIBYANG_API_DECL LY_ERR lyplg_type_xpath10_print_token(const char *token, uint16_t tok_len, ly_bool is_nametest,
366  const struct lys_module **context_mod, const struct ly_ctx *resolve_ctx, LY_VALUE_FORMAT resolve_format, const void *resolve_prefix_data, LY_VALUE_FORMAT get_format, void *get_prefix_data, char **token_p,
367  struct ly_err_item **err);
368 
380 LIBYANG_API_DECL const char *lyplg_type_get_prefix(const struct lys_module *mod, LY_VALUE_FORMAT format, void *prefix_data);
381 
399 LIBYANG_API_DECL LY_ERR lyplg_type_prefix_data_new(const struct ly_ctx *ctx, const void *value, uint32_t value_size,
400  LY_VALUE_FORMAT format, const void *prefix_data, LY_VALUE_FORMAT *format_p, void **prefix_data_p);
412 LIBYANG_API_DECL LY_ERR lyplg_type_prefix_data_dup(const struct ly_ctx *ctx, LY_VALUE_FORMAT format, const void *orig,
413  void **dup);
414 
423 LIBYANG_API_DECL void lyplg_type_prefix_data_free(LY_VALUE_FORMAT format, void *prefix_data);
424 
447 LIBYANG_API_DECL LY_ERR lyplg_type_lypath_new(const struct ly_ctx *ctx, const char *value, uint32_t value_len,
448  uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, const struct lysc_node *ctx_node,
449  const struct lysc_ext_instance *top_ext, struct lys_glob_unres *unres, struct ly_path **path, struct ly_err_item **err);
450 
461 LIBYANG_API_DECL LY_ERR lyplg_type_print_val(const struct lysc_node *node, const char *canon, LY_VALUE_FORMAT format,
462  void *prefix_data, const char **value);
463 
471 LIBYANG_API_DECL void lyplg_type_lypath_free(struct ly_path *path);
472 
483 LIBYANG_API_DECL LY_ERR lyplg_type_print_xpath10_value(const struct lyd_value_xpath10 *xp_val, LY_VALUE_FORMAT format,
484  void *prefix_data, char **str_value, struct ly_err_item **err);
485 
494 LIBYANG_API_DECL typedef void (*lyplg_type_lyb_size_clb)(const struct lysc_type *type,
495  enum lyplg_lyb_size_type *size_type, uint32_t *fixed_size_bits);
496 
504 #define LYPLG_TYPE_STORE_DYNAMIC 0x01
508 #define LYPLG_TYPE_STORE_IMPLEMENT 0x02
510 #define LYPLG_TYPE_STORE_IS_UTF8 0x04
511 #define LYPLG_TYPE_STORE_ONLY 0x08
550 LIBYANG_API_DECL typedef LY_ERR (*lyplg_type_store_clb)(const struct ly_ctx *ctx, const struct lysc_type *type,
551  const void *value, uint32_t value_size_bits, uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints,
552  const struct lysc_node *ctx_node, const struct lysc_ext_instance *top_ext, struct lyd_value *storage,
553  struct lys_glob_unres *unres, struct ly_err_item **err);
570 LIBYANG_API_DECL typedef LY_ERR (*lyplg_type_validate_value_clb)(const struct ly_ctx *ctx, const struct lysc_type *type,
571  struct lyd_value *storage, struct ly_err_item **err);
572 
590 LIBYANG_API_DECL typedef LY_ERR (*lyplg_type_validate_tree_clb)(const struct ly_ctx *ctx, const struct lysc_type *type,
591  const struct lyd_node *ctx_node, const struct lyd_node *tree, const struct lysc_ext_instance *top_ext,
592  struct lyd_value *storage, struct ly_err_item **err);
593 
606 LIBYANG_API_DECL typedef LY_ERR (*lyplg_type_compare_clb)(const struct ly_ctx *ctx, const struct lyd_value *val1,
607  const struct lyd_value *val2);
608 
622 LIBYANG_API_DECL typedef int (*lyplg_type_sort_clb)(const struct ly_ctx *ctx, const struct lyd_value *val1,
623  const struct lyd_value *val2);
624 
645 LIBYANG_API_DECL typedef const void *(*lyplg_type_print_clb)(const struct ly_ctx *ctx, const struct lyd_value *value,
646  LY_VALUE_FORMAT format, void *prefix_data, ly_bool *dynamic, uint32_t *value_size_bits);
647 
657 LIBYANG_API_DECL typedef LY_ERR (*lyplg_type_dup_clb)(const struct ly_ctx *ctx, const struct lyd_value *original,
658  struct lyd_value *dup);
659 
668 LIBYANG_API_DECL typedef void (*lyplg_type_free_clb)(const struct ly_ctx *ctx, struct lyd_value *value);
669 
678 struct lyplg_type {
679  const char *id;
689 };
692  /* plugin identification */
693  const char *module;
694  const char *revision;
699  const char *name;
701  /* runtime data */
702  struct lyplg_type plugin;
703 };
704 
717 LIBYANG_API_DECL LY_ERR lyplg_type_compare_simple(const struct ly_ctx *ctx, const struct lyd_value *val1,
718  const struct lyd_value *val2);
719 
723 LIBYANG_API_DEF int lyplg_type_sort_simple(const struct ly_ctx *ctx, const struct lyd_value *val1,
724  const struct lyd_value *val2);
725 
729 LIBYANG_API_DECL const void *lyplg_type_print_simple(const struct ly_ctx *ctx, const struct lyd_value *value,
730  LY_VALUE_FORMAT format, void *prefix_data, ly_bool *dynamic, uint32_t *value_size_bits);
731 
735 LIBYANG_API_DECL LY_ERR lyplg_type_dup_simple(const struct ly_ctx *ctx, const struct lyd_value *original,
736  struct lyd_value *dup);
737 
741 LIBYANG_API_DECL void lyplg_type_free_simple(const struct ly_ctx *ctx, struct lyd_value *value);
742 
746 LIBYANG_API_DECL void lyplg_type_lyb_size_variable_bits(const struct lysc_type *type,
747  enum lyplg_lyb_size_type *size_type, uint32_t *fixed_size_bits);
748 
752 LIBYANG_API_DECL void lyplg_type_lyb_size_variable_bytes(const struct lysc_type *type,
753  enum lyplg_lyb_size_type *size_type, uint32_t *fixed_size_bits);
754 
760 LIBYANG_API_DECL void lyplg_type_free_instanceid(const struct ly_ctx *ctx, struct lyd_value *value);
761 
765 LIBYANG_API_DECL LY_ERR lyplg_type_store_string(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value,
766  uint32_t value_len, uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints,
767  const struct lysc_node *ctx_node, const struct lysc_ext_instance *top_ext, struct lyd_value *storage,
768  struct lys_glob_unres *unres, struct ly_err_item **err);
769 
773 LIBYANG_API_DECL LY_ERR lyplg_type_validate_value_string(const struct ly_ctx *ctx, const struct lysc_type *type,
774  struct lyd_value *storage, struct ly_err_item **err);
775 
779 LIBYANG_API_DECL const void *lyplg_type_print_xpath10(const struct ly_ctx *ctx, const struct lyd_value *value,
780  LY_VALUE_FORMAT format, void *prefix_data, ly_bool *dynamic, uint32_t *value_len);
781 
785 LIBYANG_API_DECL LY_ERR lyplg_type_dup_xpath10(const struct ly_ctx *ctx, const struct lyd_value *original,
786  struct lyd_value *dup);
787 
791 LIBYANG_API_DECL void lyplg_type_free_xpath10(const struct ly_ctx *ctx, struct lyd_value *value);
792 
807 LIBYANG_API_DECL LY_ERR lyplg_type_parse_int(const char *datatype, int base, int64_t min, int64_t max, const char *value,
808  uint32_t value_len, int64_t *ret, struct ly_err_item **err);
809 
823 LIBYANG_API_DECL LY_ERR lyplg_type_parse_uint(const char *datatype, int base, uint64_t max, const char *value,
824  uint32_t value_len, uint64_t *ret, struct ly_err_item **err);
825 
837 LIBYANG_API_DECL LY_ERR lyplg_type_parse_dec64(uint8_t fraction_digits, const char *value, uint32_t value_len, int64_t *ret,
838  struct ly_err_item **err);
839 
848 LIBYANG_API_DECL LY_ERR lyplg_type_identity_isderived(const struct lysc_ident *base, const struct lysc_ident *derived);
849 
861 LIBYANG_API_DECL LY_ERR lyplg_type_validate_range(LY_DATA_TYPE basetype, struct lysc_range *range, int64_t value,
862  const char *strval, uint32_t strval_len, struct ly_err_item **err);
863 
877 LIBYANG_API_DECL LY_ERR lyplg_type_validate_patterns(const struct ly_ctx *ctx, struct lysc_pattern **patterns,
878  const char *str, uint32_t str_len, struct ly_err_item **err);
879 
892 LIBYANG_API_DECL LY_ERR lyplg_type_resolve_leafref(const struct lysc_type_leafref *lref, const struct lyd_node *node,
893  struct lyd_value *value, const struct lyd_node *tree, const struct lysc_ext_instance *top_ext,
894  struct ly_set **targets, char **errmsg);
895 
903 LIBYANG_API_DECL uint64_t lyplg_type_get_highest_set_bit_pos(uint64_t num);
904 
907 #ifdef __cplusplus
908 }
909 #endif
910 
911 #endif /* LY_PLUGINS_TYPES_H_ */
LIBYANG_API_DECL void lyplg_type_lyb_size_variable_bits(const struct lysc_type *type, enum lyplg_lyb_size_type *size_type, uint32_t *fixed_size_bits)
Implementation of lyplg_type_lyb_size_clb for a type with variable length in bits.
lyplg_type_lyb_size_clb lyb_size
LIBYANG_API_DECL ly_bool lyplg_type_bits_is_bit_set(const char *bitmap, uint32_t size_bits, uint32_t bit_position)
Check whether a particular bit of a bitmap is set.
Definition: bits.c:58
Compiled YANG data node.
Definition: tree_schema.h:1434
LIBYANG_API_DECL typedef void(* lyplg_type_lyb_size_clb)(const struct lysc_type *type, enum lyplg_lyb_size_type *size_type, uint32_t *fixed_size_bits)
Callback for learning the size of a LYB value in bits. If of a variable size, -1 is returned...
LIBYANG_API_DECL LY_ERR lyplg_type_lypath_new(const struct ly_ctx *ctx, const char *value, uint32_t value_len, uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, const struct lysc_node *ctx_node, const struct lysc_ext_instance *top_ext, struct lys_glob_unres *unres, struct ly_path **path, struct ly_err_item **err)
Helper function to create internal schema path representation for instance-identifier value represent...
struct ly_ctx * ctx
Definition: tree_schema.h:2185
LIBYANG_API_DECL typedef LY_ERR(* lyplg_type_validate_tree_clb)(const struct ly_ctx *ctx, const struct lysc_type *type, const struct lyd_node *ctx_node, const struct lyd_node *tree, const struct lysc_ext_instance *top_ext, struct lyd_value *storage, struct ly_err_item **err)
Callback to validate the stored value in the accessible data tree.
LIBYANG_API_DECL void lyplg_type_lypath_free(struct ly_path *path)
Free ly_path structure used by instanceid value representation.
const char * revision
const char * id
Hold type-specific functions for various operations with the data values.
LIBYANG_API_DECL LY_ERR lyplg_type_check_value_size(const char *type_name, LY_VALUE_FORMAT format, uint32_t value_size_bits, enum lyplg_lyb_size_type lyb_size_type, uint32_t lyb_fixed_size_bits, uint32_t *value_size, struct ly_err_item **err)
Check a value type in bits is correct and as expected.
lyplg_lyb_size_type
Type of the LYB size of a value of a particular type.
Generic structure for a data node.
Definition: tree_data.h:792
YANG extension compiled instance.
Definition: plugins_exts.h:436
LIBYANG_API_DECL const void * lyplg_type_print_simple(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format, void *prefix_data, ly_bool *dynamic, uint32_t *value_size_bits)
Implementation of lyplg_type_print_clb for a generic simple type.
Generic set structure and manipulation routines.
LIBYANG_API_DECL LY_ERR lyplg_type_compare_simple(const struct ly_ctx *ctx, const struct lyd_value *val1, const struct lyd_value *val2)
Implementation of lyplg_type_compare_clb for a generic simple type.
const char * prefix
Definition: tree_schema.h:2189
LY_ERR
libyang&#39;s error codes returned by the libyang functions.
Definition: log.h:240
uint8_t ly_bool
Type to indicate boolean value.
Definition: log.h:28
LIBYANG_API_DECL LY_ERR lyplg_type_make_implemented(struct lys_module *mod, const char **features, struct lys_glob_unres *unres)
Implement a module (just like lys_set_implemented()), but keep maintaining unresolved items...
lyplg_type_free_clb free
LY_ERR err
Definition: log.h:287
LY_VECODE
libyang&#39;s codes of validation error. Whenever ly_errno is set to LY_EVALID, the ly_vecode is also set...
Definition: log.h:267
LIBYANG_API_DECL LY_ERR lyplg_type_lypath_check_status(const struct lysc_node *ctx_node, const struct ly_path *path, LY_VALUE_FORMAT format, void *prefix_data, struct ly_err_item **err)
Check that the lypath instance-identifier value is allowed based on the status of the nodes...
LY_DATA_TYPE
YANG built-in types.
Definition: tree.h:202
YANG identity-stmt.
Definition: tree_schema.h:1226
LIBYANG_API_DECL typedef LY_ERR(* lyplg_type_store_clb)(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, uint32_t value_size_bits, uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node, const struct lysc_ext_instance *top_ext, struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err)
Callback to store the given value according to the given type.
LIBYANG_API_DECL LY_ERR lyplg_type_validate_patterns(const struct ly_ctx *ctx, struct lysc_pattern **patterns, const char *str, uint32_t str_len, struct ly_err_item **err)
Data type validator for pattern-restricted string values.
libyang generic macros and functions to work with YANG schema or data trees.
LIBYANG_API_DECL LY_ERR lyplg_type_parse_dec64(uint8_t fraction_digits, const char *value, uint32_t value_len, int64_t *ret, struct ly_err_item **err)
Convert a string with a decimal64 value into libyang representation: ret = value * 10^fraction-digits...
struct lyplg_type plugin
LIBYANG_API_DECL LY_ERR lyplg_type_prefix_data_new(const struct ly_ctx *ctx, const void *value, uint32_t value_size, 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 typedef LY_ERR(* lyplg_type_compare_clb)(const struct ly_ctx *ctx, const struct lyd_value *val1, const struct lyd_value *val2)
Callback for comparing 2 values of the same type.
LIBYANG_API_DECL LY_ERR lyplg_type_parse_int(const char *datatype, int base, int64_t min, int64_t max, const char *value, uint32_t value_len, int64_t *ret, struct ly_err_item **err)
Unsigned integer value parser and validator.
LIBYANG_API_DECL LY_ERR lyplg_type_dup_xpath10(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup)
Implementation of lyplg_type_dup_clb for the ietf-yang-types xpath1.0 type.
Definition: xpath1.0.c:474
LIBYANG_API_DEF int lyplg_type_sort_simple(const struct ly_ctx *ctx, const struct lyd_value *val1, const struct lyd_value *val2)
Implementation of lyplg_type_sort_clb for a generic simple type.
LIBYANG_API_DECL LY_ERR lyplg_type_check_status(const struct lysc_node *ctx_node, uint16_t val_flags, LY_VALUE_FORMAT format, void *prefix_data, const char *val_name, struct ly_err_item **err)
Check that the value of a type is allowed based on its status.
LIBYANG_API_DECL void lyplg_type_free_instanceid(const struct ly_ctx *ctx, struct lyd_value *value)
Implementation of lyplg_type_free_clb for the built-in instance-identifier type.
Definition: instanceid.c:312
LIBYANG_API_DECL LY_ERR lyplg_type_print_val(const struct lysc_node *node, const char *canon, LY_VALUE_FORMAT format, void *prefix_data, const char **value)
Convert canonical value into a value in a specific format.
LIBYANG_API_DECL const char * lyplg_type_get_prefix(const struct lys_module *mod, LY_VALUE_FORMAT format, void *prefix_data)
Get format-specific prefix for a module.
LIBYANG_API_DECL typedef LY_ERR(* lyplg_type_validate_value_clb)(const struct ly_ctx *ctx, const struct lysc_type *type, struct lyd_value *storage, struct ly_err_item **err)
Callback to validate the stored value local semantic constraints of the type.
LIBYANG_API_DECL void lyplg_type_lyb_size_variable_bytes(const struct lysc_type *type, enum lyplg_lyb_size_type *size_type, uint32_t *fixed_size_bits)
Implementation of lyplg_type_lyb_size_clb for a type with variable length rounded to bytes...
lyplg_type_validate_tree_clb validate_tree
YANG data representation.
Definition: tree_data.h:563
lyplg_type_store_clb store
struct lyxp_expr * path
Definition: tree_schema.h:1379
Libyang full error structure.
Definition: log.h:285
LIBYANG_API_DECL LY_ERR LIBYANG_API_DECL void ly_err_free(void *ptr)
Destructor for the error records created with ly_err_new().
LIBYANG_API_DECL struct lys_module * lyplg_type_identity_module(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *prefix, uint32_t prefix_len, LY_VALUE_FORMAT format, const void *prefix_data)
Get the corresponding module for the identity value.
LIBYANG_API_DECL LY_ERR lyplg_type_validate_value_string(const struct ly_ctx *ctx, const struct lysc_type *type, struct lyd_value *storage, struct ly_err_item **err)
Implementation of lyplg_type_validate_value_clb for the string type.
Definition: string.c:118
LIBYANG_API_DECL LY_ERR ly_err_new(struct ly_err_item **err, LY_ERR ecode, LY_VECODE vecode, char *data_path, char *apptag, const char *err_format,...) _FORMAT_PRINTF(6
Create and fill error structure.
LIBYANG_API_DECL typedef LY_ERR(* lyplg_type_dup_clb)(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup)
Callback to duplicate data in the data structure.
Structure to hold a set of (not necessary somehow connected) objects. Usually used for lyd_node...
Definition: set.h:47
Available YANG schema tree structures representing YANG module.
Definition: tree_schema.h:2184
LIBYANG_API_DECL LY_ERR lyplg_type_identity_isderived(const struct lysc_ident *base, const struct lysc_ident *derived)
Decide if the derived identity is derived from (based on) the base identity.
LIBYANG_API_DECL const void * lyplg_type_print_xpath10(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format, void *prefix_data, ly_bool *dynamic, uint32_t *value_len)
Implementation of lyplg_type_print_clb for the ietf-yang-types xpath1.0 type.
Definition: xpath1.0.c:435
const char * name
lyplg_type_validate_value_clb validate_value
lyplg_type_dup_clb duplicate
const char * module
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.
lyplg_type_sort_clb sort
LIBYANG_API_DECL void lyplg_type_prefix_data_free(LY_VALUE_FORMAT format, void *prefix_data)
Free internal prefix data.
LIBYANG_API_DECL LY_ERR lyplg_type_parse_uint(const char *datatype, int base, uint64_t max, const char *value, uint32_t value_len, uint64_t *ret, struct ly_err_item **err)
Unsigned integer value parser and validator.
libyang generic macros and functions to modify YANG schema or data trees. Intended for internal use a...
Special lyd_value structure for ietf-yang-types xpath1.0 values.
Definition: tree_data.h:709
LIBYANG_API_DECL LY_ERR lyplg_type_print_xpath10_value(const struct lyd_value_xpath10 *xp_val, LY_VALUE_FORMAT format, void *prefix_data, char **str_value, struct ly_err_item **err)
Print xpath1.0 value in the specific format.
Definition: xpath1.0.c:213
LIBYANG_API_DECL uint64_t lyplg_type_get_highest_set_bit_pos(uint64_t num)
Learn the position of the highest set bit in a number. Represents also the least amount of bits requi...
LY_VALUE_FORMAT
All kinds of supported value formats and prefix mappings to modules.
Definition: tree.h:234
lyplg_type_print_clb print
Plugins manipulation.
LIBYANG_API_DECL void lyplg_type_free_xpath10(const struct ly_ctx *ctx, struct lyd_value *value)
Implementation of lyplg_type_free_clb for the ietf-yang-types xpath1.0 type.
Definition: xpath1.0.c:506
LIBYANG_API_DECL LY_ERR lyplg_type_resolve_leafref(const struct lysc_type_leafref *lref, const struct lyd_node *node, struct lyd_value *value, const struct lyd_node *tree, const struct lysc_ext_instance *top_ext, struct ly_set **targets, char **errmsg)
Find leafref target in data.
LIBYANG_API_DECL LY_ERR lyplg_type_store_string(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, uint32_t value_len, uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node, const struct lysc_ext_instance *top_ext, struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err)
Implementation of lyplg_type_store_clb for the built-in string type.
LIBYANG_API_DECL typedef int(* lyplg_type_sort_clb)(const struct ly_ctx *ctx, const struct lyd_value *val1, const struct lyd_value *val2)
Callback for sorting values.
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 LY_ERR lyplg_type_xpath10_print_token(const char *token, uint16_t tok_len, ly_bool is_nametest, const struct lys_module **context_mod, const struct ly_ctx *resolve_ctx, LY_VALUE_FORMAT resolve_format, const void *resolve_prefix_data, LY_VALUE_FORMAT get_format, void *get_prefix_data, char **token_p, struct ly_err_item **err)
Print xpath1.0 token in the specific format.
Definition: xpath1.0.c:41
LIBYANG_API_DECL typedef void(* lyplg_type_free_clb)(const struct ly_ctx *ctx, struct lyd_value *value)
Callback for freeing the user type values stored by lyplg_type_store_clb.
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.
Logger manipulation routines and error definitions.
lyplg_type_compare_clb compare
LIBYANG_API_DECL LY_ERR lyplg_type_check_hints(uint32_t hints, const char *value, uint32_t value_len, LY_DATA_TYPE type, int *base, struct ly_err_item **err)
Check that the type is suitable for the parser&#39;s hints (if any) in the specified format.
LIBYANG_API_DECL typedef const void *(* lyplg_type_print_clb)(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format, void *prefix_data, ly_bool *dynamic, uint32_t *value_size_bits)
Callback for getting the value of the data stored in value.
libyang context handler.
LIBYANG_API_DECL LY_ERR lyplg_type_validate_range(LY_DATA_TYPE basetype, struct lysc_range *range, int64_t value, const char *strval, uint32_t strval_len, struct ly_err_item **err)
Data type validator for a range/length-restricted values.