41 uint32_t options,
LY_VALUE_FORMAT format,
void *UNUSED(prefix_data), uint32_t hints,
42 const struct lysc_node *UNUSED(ctx_node),
struct lyd_value *storage,
struct lys_glob_unres *UNUSED(unres),
50 memset(storage, 0,
sizeof *storage);
55 LY_CHECK_GOTO(ret, cleanup);
61 LY_CHECK_GOTO(ret, cleanup);
66 LY_CHECK_GOTO(ret, cleanup);
70 value = strndup(value, value_len);
71 LY_CHECK_ERR_GOTO(!value, ret =
LY_EMEM, cleanup);
78 for (i = 0; i < value_len; ++i) {
79 ((
char *)value)[i] = tolower(((
char *)value)[i]);
83 options &= ~LYPLG_TYPE_STORE_DYNAMIC;
84 LY_CHECK_GOTO(ret, cleanup);
88 LY_CHECK_GOTO(ret, cleanup);
111 .module =
"ietf-yang-types",
112 .revision =
"2013-07-15",
113 .name =
"phys-address",
115 .plugin.id =
"libyang 2 - hex-string, version 1",
117 .plugin.validate = NULL,
123 .plugin.lyb_data_len = -1,
126 .module =
"ietf-yang-types",
127 .revision =
"2013-07-15",
128 .name =
"mac-address",
130 .plugin.id =
"libyang 2 - hex-string, version 1",
132 .plugin.validate = NULL,
138 .plugin.lyb_data_len = -1,
141 .module =
"ietf-yang-types",
142 .revision =
"2013-07-15",
143 .name =
"hex-string",
145 .plugin.id =
"libyang 2 - hex-string, version 1",
147 .plugin.validate = NULL,
153 .plugin.lyb_data_len = -1,
156 .module =
"ietf-yang-types",
157 .revision =
"2013-07-15",
160 .plugin.id =
"libyang 2 - hex-string, version 1",
162 .plugin.validate = NULL,
168 .plugin.lyb_data_len = -1,
LIBYANG_API_DECL 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...
LIBYANG_API_DECL 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
libyang's error codes returned by the libyang functions.
Libyang full error structure.
LIBYANG_API_DECL LY_ERR lyplg_type_validate_patterns(struct lysc_pattern **patterns, const char *str, size_t str_len, struct ly_err_item **err)
Data type validator for pattern-restricted string values.
LIBYANG_API_DECL LY_ERR lyplg_type_validate_range(LY_DATA_TYPE basetype, struct lysc_range *range, int64_t value, const char *strval, size_t strval_len, struct ly_err_item **err)
Data type validator for a range/length-restricted values.
LIBYANG_API_DECL 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.
LIBYANG_API_DECL const void * lyplg_type_print_simple(const struct ly_ctx *ctx, const struct lyd_value *value, LY_VALUE_FORMAT format, void *prefix_data, ly_bool *dynamic, size_t *value_len)
Implementation of lyplg_type_print_clb for a generic simple type.
LIBYANG_API_DECL 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.
LIBYANG_API_DECL 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.
LIBYANG_API_DECL 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_pattern ** patterns
struct lysc_range * length
LY_VALUE_FORMAT
All kinds of supported value formats and prefix mappings to modules.
LIBYANG_API_DEF LY_ERR lyplg_type_store_hex_string(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)
const struct lyplg_type_record plugins_hex_string[]
Plugin information for string type implementation.
The main libyang public header.
API for (user) types plugins.
const struct lysc_type * realtype
YANG data representation.