24 #include "ly_common.h"
25 #include "tree_data_sorted.h"
27 static void lyplg_type_free_lyds(
const struct ly_ctx *ctx,
struct lyd_value *value);
31 uint32_t *fixed_size_bits)
38 lyplg_type_store_lyds(
const struct ly_ctx *ctx,
const struct lysc_type *type,
const void *value,
39 uint32_t UNUSED(value_size_bits), uint32_t options,
LY_VALUE_FORMAT format,
void *UNUSED(prefix_data),
41 struct lyd_value *storage,
struct lys_glob_unres *UNUSED(unres),
struct ly_err_item **UNUSED(err))
44 struct rb_node *rbt = NULL;
49 LY_CHECK_ERR_GOTO(!val, ret =
LY_EMEM, cleanup);
53 memset(storage->fixed_mem, 0, LYD_VALUE_FIXED_MEM_SIZE);
61 ret = lyds_create_node((
struct lyd_node *)value, &rbt);
62 LY_CHECK_GOTO(ret, cleanup);
70 lyplg_type_free_lyds(ctx, storage);
77 lyplg_type_free_lyds(
const struct ly_ctx *UNUSED(ctx),
struct lyd_value *value)
88 memset(value->fixed_mem, 0, LYD_VALUE_FIXED_MEM_SIZE);
97 memset(dup, 0,
sizeof *dup);
104 lyplg_type_compare_lyds(
const struct ly_ctx *UNUSED(ctx),
const struct lyd_value *UNUSED(val1),
111 lyplg_type_sort_lyds(
const struct ly_ctx *UNUSED(ctx),
const struct lyd_value *UNUSED(val1),
118 lyplg_type_print_lyds(
const struct ly_ctx *UNUSED(ctx),
const struct lyd_value *UNUSED(value),
124 if (value_size_bits) {
125 *value_size_bits = 0;
144 .plugin.id =
"ly2 lyds_tree",
145 .plugin.lyb_size = lyplg_type_lyb_size_lyds,
146 .plugin.store = lyplg_type_store_lyds,
147 .plugin.validate_value = NULL,
148 .plugin.validate_tree = NULL,
149 .plugin.compare = lyplg_type_compare_lyds,
150 .plugin.sort = lyplg_type_sort_lyds,
151 .plugin.print = lyplg_type_print_lyds,
152 .plugin.duplicate = lyplg_type_dupl_lyds,
153 .plugin.free = lyplg_type_free_lyds,
struct lysc_type * realtype
memset(value->fixed_mem, 0, LYD_VALUE_FIXED_MEM_SIZE)
struct lyplg_type_record plugins_lyds_tree[]
Plugin information for lyds_tree type implementation.
lyplg_lyb_size_type
Type of the LYB size of a value of a particular type.
Generic structure for a data node.
YANG extension compiled instance.
LY_ERR
libyang's error codes returned by the libyang functions.
uint8_t ly_bool
Type to indicate boolean value.
#define LYPLG_TYPE_STORE_DYNAMIC
LYPLG_TYPE_VAL_INLINE_DESTROY(val)
The main libyang public header.
YANG data representation.
Libyang full error structure.
#define LYD_VALUE_GET(value, type_val)
Get the value in format specific to the type.
Special lyd_value structure for lyds tree value.
LY_VALUE_FORMAT
All kinds of supported value formats and prefix mappings to modules.
#define LYPLG_TYPE_VAL_INLINE_PREPARE(storage, type_val)
Prepare value memory for storing a specific type value, may be allocated dynamically.
API for (user) types plugins.
assert(!value->_canonical)