27 #include "ly_common.h"
28 #include "plugins_internal.h"
29 #include "tree_data_internal.h"
49 lyplg_type_store_leafref(
const struct ly_ctx *ctx,
const struct lysc_type *type,
const void *value, uint32_t value_size_bits,
61 format, prefix_data, hints, ctx_node, top_ext, storage, unres, err);
77 lyplg_type_validate_tree_leafref(
const struct ly_ctx *ctx,
const struct lysc_type *type,
const struct lyd_node *ctx_node,
83 char *errmsg = NULL, *
path;
84 struct ly_set *targets = NULL;
104 for (i = 0; i < targets->
count; ++i) {
106 LY_CHECK_GOTO(rc, cleanup);
129 void *prefix_data,
ly_bool *dynamic, uint32_t *value_size_bits)
131 return LYSC_GET_TYPE_PLG(value->
realtype->
plugin_ref)->print(ctx, value, format, prefix_data, dynamic, value_size_bits);
137 return LYSC_GET_TYPE_PLG(original->
realtype->
plugin_ref)->duplicate(ctx, original, dup);
141 lyplg_type_free_leafref(
const struct ly_ctx *ctx,
struct lyd_value *value)
157 .name = LY_TYPE_LEAFREF_STR,
159 .plugin.id =
"ly2 leafref",
160 .plugin.lyb_size = lyplg_type_lyb_size_leafref,
161 .plugin.store = lyplg_type_store_leafref,
162 .plugin.validate_value = NULL,
163 .plugin.validate_tree = lyplg_type_validate_tree_leafref,
164 .plugin.compare = lyplg_type_compare_leafref,
165 .plugin.sort = lyplg_type_sort_leafref,
166 .plugin.print = lyplg_type_print_leafref,
167 .plugin.duplicate = lyplg_type_dup_leafref,
168 .plugin.free = lyplg_type_free_leafref,
struct lysc_type * realtype
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.
LIBYANG_API_DECL char * lyd_path(const struct lyd_node *node, LYD_PATH_TYPE pathtype, char *buffer, size_t buflen)
Generate path of the given node in the requested format.
Data node structure for the terminal data tree nodes - leaves and leaf-lists.
LIBYANG_API_DECL void ly_set_free(struct ly_set *set, void(*destructor)(void *obj))
Free the ly_set data. If the destructor is not provided, it frees only the set structure content...
struct lyplg_type_record plugins_leafref[]
Plugin information for leafref type implementation.
The main libyang public header.
YANG data representation.
Libyang full error structure.
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.
Structure to hold a set of (not necessary somehow connected) objects. Usually used for lyd_node...
LY_VALUE_FORMAT
All kinds of supported value formats and prefix mappings to modules.
LIBYANG_API_DECL uint32_t ly_ctx_get_options(const struct ly_ctx *ctx)
Get the currently set context's options.
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.
#define LY_CTX_LEAFREF_LINKING
API for (user) types plugins.
struct lysc_type * realtype
assert(!value->_canonical)