26#include "plugins_internal.h"
46string_check_chars(
const char *value,
size_t value_len,
struct ly_err_item **err)
48 size_t len, parsed = 0;
50 while (value_len - parsed) {
51 if (ly_checkutf8(value + parsed, value_len - parsed, &len)) {
62 uint32_t options,
LY_VALUE_FORMAT UNUSED(format),
void *UNUSED(prefix_data), uint32_t hints,
63 const struct lysc_node *UNUSED(ctx_node),
struct lyd_value *storage,
struct lys_glob_unres *UNUSED(unres),
70 memset(storage, 0,
sizeof *storage);
75 ret = string_check_chars(value, value_len, err);
76 LY_CHECK_GOTO(ret, cleanup);
81 LY_CHECK_GOTO(ret, cleanup);
87 LY_CHECK_GOTO(ret, cleanup);
92 LY_CHECK_GOTO(ret, cleanup);
98 LY_CHECK_GOTO(ret, cleanup);
101 LY_CHECK_GOTO(ret, cleanup);
126 .name = LY_TYPE_STRING_STR,
128 .plugin.id =
"libyang 2 - string, version 1",
130 .plugin.validate = NULL,
136 .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 ly_err_new(struct ly_err_item **err, LY_ERR ecode, LY_VECODE vecode, char *path, char *apptag, const char *err_format,...) _FORMAT_PRINTF(6
Create and fill error structure.
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_t