libyang 1.0.184
YANG data modeling language library
Loading...
Searching...
No Matches
User Types
Collaboration diagram for User Types:

Data Structures

struct  lytype_plugin_list

Macros

#define LYTYPE_API_VERSION   1
 User types API version.
#define LYTYPE_VERSION_CHECK   int lytype_api_version = LYTYPE_API_VERSION;
 Macro to store version of user type plugins API in the plugins. It is matched when the plugin is being loaded by libyang.

Typedefs

typedef int(* lytype_store_clb) (struct ly_ctx *ctx, const char *type_name, const char **value_str, lyd_val *value, char **err_msg)
 Callback for storing user type values.

Detailed Description


Data Structure Documentation

◆ lytype_plugin_list

struct lytype_plugin_list

Definition at line 62 of file user_types.h.

Data Fields
const char * module

Name of the module where the type is defined.

const char * revision

Optional module revision - if not specified, the plugin applies to any revision, which is not the best approach due to a possible future revisions of the module. Instead, there should be defined multiple items in the plugins list, each with the different revision, but all with the same store callback. The only valid use case for the NULL revision is the case when the module has no revision.

const char * name

Name of the type to be stored in a custom way.

lytype_store_clb store_clb

Callback used for storing values of this type.

void(*)(void *ptr) free_clb

Callback used for freeing values of this type.

Macro Definition Documentation

◆ LYTYPE_API_VERSION

#define LYTYPE_API_VERSION   1

User types API version.

Definition at line 33 of file user_types.h.

◆ LYTYPE_VERSION_CHECK

#define LYTYPE_VERSION_CHECK   int lytype_api_version = LYTYPE_API_VERSION;

Macro to store version of user type plugins API in the plugins. It is matched when the plugin is being loaded by libyang.

Definition at line 42 of file user_types.h.

Typedef Documentation

◆ lytype_store_clb

typedef int(* lytype_store_clb) (struct ly_ctx *ctx, const char *type_name, const char **value_str, lyd_val *value, char **err_msg)

Callback for storing user type values.

This callback should overwrite the value stored in value using some custom encoding. Be careful, if the type is LY_TYPE_BITS, the bits must be freed before overwritting the union value.

Parameters
[in]ctxlibyang ctx to enable correct manipulation with values that are in the dictionary.
[in]type_nameName of the type being stored.
[in,out]value_strString value to be stored.
[in,out]valueValue union for the value to be stored in (already is but in the standard way).
[out]err_msgCan be filled on error. If not, a generic error message will be printed.
Returns
0 on success, non-zero if an error occurred and the value could not be stored for any reason.

Definition at line 59 of file user_types.h.