23 #include "ly_common.h"
24 #include "tree_data_sorted.h"
26 static void lyplg_type_free_lyds(
const struct ly_ctx *ctx,
struct lyd_value *value);
29 lyplg_type_store_lyds(
const struct ly_ctx *ctx,
const struct lysc_type *type,
const void *value,
30 size_t UNUSED(value_len), uint32_t options,
LY_VALUE_FORMAT format,
void *UNUSED(prefix_data),
31 uint32_t UNUSED(hints),
const struct lysc_node *UNUSED(ctx_node),
struct lyd_value *storage,
32 struct lys_glob_unres *UNUSED(unres),
struct ly_err_item **UNUSED(err))
35 struct rb_node *rbt = NULL;
40 LY_CHECK_ERR_GOTO(!val, ret =
LY_EMEM, cleanup);
44 memset(storage->fixed_mem, 0, LYD_VALUE_FIXED_MEM_SIZE);
52 ret = lyds_create_node((
struct lyd_node *)value, &rbt);
53 LY_CHECK_GOTO(ret, cleanup);
61 lyplg_type_free_lyds(ctx, storage);
68 lyplg_type_free_lyds(
const struct ly_ctx *UNUSED(ctx),
struct lyd_value *value)
79 memset(value->fixed_mem, 0, LYD_VALUE_FIXED_MEM_SIZE);
88 memset(dup, 0,
sizeof *dup);
95 lyplg_type_compare_lyds(
const struct ly_ctx *UNUSED(ctx),
const struct lyd_value *UNUSED(val1),
102 lyplg_type_sort_lyds(
const struct ly_ctx *UNUSED(ctx),
const struct lyd_value *UNUSED(val1),
109 lyplg_type_print_lyds(
const struct ly_ctx *UNUSED(ctx),
const struct lyd_value *UNUSED(value),
135 .plugin.id =
"libyang 2 - lyds_tree, version 1",
136 .plugin.store = lyplg_type_store_lyds,
137 .plugin.validate = NULL,
138 .plugin.compare = lyplg_type_compare_lyds,
139 .plugin.sort = lyplg_type_sort_lyds,
140 .plugin.print = lyplg_type_print_lyds,
141 .plugin.duplicate = lyplg_type_dupl_lyds,
142 .plugin.free = lyplg_type_free_lyds,
143 .plugin.lyb_data_len = 0
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.
Generic structure for a data node.
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.
LY_ERR
libyang's error codes returned by the libyang functions.
assert(!value->_canonical)