25#include "plugins_internal.h"
26#include "tree_data_sorted.h"
28static void lyplg_type_free_lyds(
const struct ly_ctx *ctx,
struct lyd_value *value);
32 uint64_t *fixed_size_bits)
39lyplg_type_store_lyds(
const struct ly_ctx *ctx,
const struct lysc_type *type,
const void *value,
40 uint64_t UNUSED(value_size_bits), uint32_t options,
LY_VALUE_FORMAT format,
void *UNUSED(prefix_data),
41 uint32_t UNUSED(hints),
const struct lysc_node *UNUSED(ctx_node),
struct lyd_value *storage,
42 struct lys_glob_unres *UNUSED(unres),
struct ly_err_item **UNUSED(err))
45 struct rb_node *rbt = NULL;
50 LY_CHECK_ERR_GOTO(!val, ret =
LY_EMEM, cleanup);
54 memset(storage->fixed_mem, 0, LYD_VALUE_FIXED_MEM_SIZE);
62 ret = lyds_create_node((
struct lyd_node *)value, &
rbt);
63 LY_CHECK_GOTO(ret, cleanup);
71 lyplg_type_free_lyds(ctx, storage);
78lyplg_type_free_lyds(
const struct ly_ctx *UNUSED(ctx),
struct lyd_value *value)
87 lyds_free_tree(val->
rbt);
89 memset(value->fixed_mem, 0, LYD_VALUE_FIXED_MEM_SIZE);
98 memset(dup, 0,
sizeof *dup);
105lyplg_type_compare_lyds(
const struct ly_ctx *UNUSED(ctx),
const struct lyd_value *UNUSED(val1),
112lyplg_type_sort_lyds(
const struct ly_ctx *UNUSED(ctx),
const struct lyd_value *UNUSED(val1),
119lyplg_type_print_lyds(
const struct ly_ctx *UNUSED(ctx),
const struct lyd_value *UNUSED(value),
125 if (value_size_bits) {
126 *value_size_bits = 0;
145 .plugin.id =
"ly2 lyds_tree",
146 .plugin.lyb_size = lyplg_type_lyb_size_lyds,
147 .plugin.store = lyplg_type_store_lyds,
148 .plugin.validate_value = NULL,
149 .plugin.validate_tree = NULL,
150 .plugin.compare = lyplg_type_compare_lyds,
151 .plugin.sort = lyplg_type_sort_lyds,
152 .plugin.print = lyplg_type_print_lyds,
153 .plugin.duplicate = lyplg_type_dupl_lyds,
154 .plugin.free = lyplg_type_free_lyds,
LY_ERR
libyang's error codes returned by the libyang functions.
Libyang full error structure.
const char *const char * revision
#define LYPLG_TYPE_VAL_INLINE_PREPARE(storage, type_val)
Prepare value memory for storing a specific type value, may be allocated dynamically.
lyplg_lyb_size_type
Type of the LYB size of a value of a particular type.
#define LYPLG_TYPE_VAL_INLINE_DESTROY(type_val)
Destroy a prepared value.
@ LYPLG_LYB_SIZE_FIXED_BITS
#define LYPLG_TYPE_STORE_DYNAMIC
uint8_t ly_bool
Type to indicate boolean value.
const struct lyplg_type_record plugins_lyds_tree[]
Plugin information for lyds_tree type implementation.
API for (user) types plugins.
const struct lysc_type * realtype
#define LYD_VALUE_GET(value, type_val)
Get the value in format specific to the type.
Generic structure for a data node.
YANG data representation.
Special lyd_value structure for lyds tree value.
LY_VALUE_FORMAT
All kinds of supported value formats and prefix mappings to modules.