26 #include "plugins_internal.h"
39 uint32_t options,
LY_VALUE_FORMAT format,
void *UNUSED(prefix_data), uint32_t hints,
40 const struct lysc_node *UNUSED(ctx_node),
struct lyd_value *storage,
struct lys_glob_unres *UNUSED(unres),
49 memset(storage, 0,
sizeof *storage);
62 if (type_enum->
enums[u].value == *(int32_t *)value) {
77 LY_CHECK_GOTO(ret, cleanup);
81 if (!ly_strncmp(type_enum->
enums[u].
name, value, value_len)) {
96 storage->enum_item = &type_enum->
enums[u];
102 LY_CHECK_GOTO(ret, cleanup);
105 LY_CHECK_GOTO(ret, cleanup);
121 void *UNUSED(prefix_data),
ly_bool *dynamic,
size_t *value_len)
128 return &value->enum_item->value;
152 .name = LY_TYPE_ENUM_STR,
154 .plugin.id =
"libyang 2 - enumeration, version 1",
156 .plugin.validate = NULL,
API const void * lyplg_type_print_enum(const struct ly_ctx *UNUSED(ctx), const struct lyd_value *value, LY_VALUE_FORMAT format, void *UNUSED(prefix_data), ly_bool *dynamic, size_t *value_len)
const struct lyplg_type_record plugins_enumeration[]
Plugin information for enumeration type implementation.
API LY_ERR lyplg_type_store_enum(const struct ly_ctx *ctx, const struct lysc_type *type, const void *value, size_t value_len, uint32_t options, LY_VALUE_FORMAT format, void *UNUSED(prefix_data), uint32_t hints, const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres), struct ly_err_item **err)
LY_ERR lydict_insert_zc(const struct ly_ctx *ctx, char *value, const char **str_p)
Insert string into dictionary - zerocopy version. If the string is already present,...
LY_ERR lydict_insert(const struct ly_ctx *ctx, const char *value, size_t len, const char **str_p)
Insert string into dictionary. If the string is already present, only a reference counter is incremen...
LY_ERR
libyang's error codes returned by the libyang functions.
Libyang full error structure.
LY_ERR lyplg_type_check_hints(uint32_t hints, const char *value, size_t value_len, LY_DATA_TYPE type, int *base, struct ly_err_item **err)
Check that the type is suitable for the parser's hints (if any) in the specified format.
LY_ERR ly_err_new(struct ly_err_item **err, LY_ERR ecode, LY_VECODE vecode, char *path, char *apptag, const char *err_msg,...)
Create and fill error structure.
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.
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.
LY_ERR lyplg_type_compare_simple(const struct lyd_value *val1, const struct lyd_value *val2)
Implementation of lyplg_type_compare_clb for a generic simple type.
#define LYPLG_TYPE_STORE_DYNAMIC
struct lysc_type_bitenum_item * enums
#define LY_ARRAY_FOR(ARRAY,...)
Sized-array iterator (for-loop).
LY_VALUE_FORMAT
All kinds of supported value formats and prefix mappings to modules.
#define LY_ARRAY_COUNT_TYPE
Type (i.e. size) of the sized array's size counter.
The main libyang public header.
uint8_t ly_bool
Type to indicate boolean value.
API for (user) types plugins.
const struct lysc_type * realtype
YANG data representation.