sysrepo  2.1.64
YANG-based system repository for all-around configuration management.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sysrepo_types.h File Reference

public sysrepo types header More...

#include <inttypes.h>
#include <stddef.h>
#include <sys/stat.h>

Go to the source code of this file.

Data Structures

struct  sr_data_s
 Structure that safely wraps libyang data and prevents unexpected context changes. More...
 
struct  sr_error_info_err_s
 A single, detailed error message. Used in sr_error_info_t. More...
 
struct  sr_error_info_s
 Detailed sysrepo session error information. More...
 
struct  sr_module_ds_s
 Custom datastore implementation config for each datastore and notifications of a module. More...
 
union  sr_val_data_u
 Data of an element (if applicable), properly set according to the type. More...
 
struct  sr_val_s
 Structure that contains value of an data element stored in the sysrepo datastore. More...
 

Typedefs

typedef int(* sr_rpc_cb )(sr_session_ctx_t *session, uint32_t sub_id, const char *xpath, const sr_val_t *input, const size_t input_cnt, sr_event_t event, uint32_t request_id, sr_val_t **output, size_t *output_cnt, void *private_data)
 Callback to be called for the delivery of an RPC/action. Data are represented as sr_val_t structures. More...
 
typedef int(* sr_rpc_tree_cb )(sr_session_ctx_t *session, uint32_t sub_id, const char *op_path, const struct lyd_node *input, sr_event_t event, uint32_t request_id, struct lyd_node *output, void *private_data)
 Callback to be called for the delivery of an RPC/action. Data are represented as libyang subtrees. More...
 
typedef int(* sr_oper_get_items_cb )(sr_session_ctx_t *session, uint32_t sub_id, const char *module_name, const char *path, const char *request_xpath, uint32_t request_id, struct lyd_node **parent, void *private_data)
 Callback to be called when operational data at the selected xpath are requested. Data are represented as libyang subtrees. More...
 
typedef int(* srp_init_cb_t )(sr_session_ctx_t *session, void **private_data)
 Sysrepo plugin initialization callback. More...
 
typedef void(* srp_cleanup_cb_t )(sr_session_ctx_t *session, void *private_data)
 Sysrepo plugin cleanup callback. More...
 
enum  sr_error_t {
  SR_ERR_OK = 0, SR_ERR_INVAL_ARG, SR_ERR_LY, SR_ERR_SYS,
  SR_ERR_NO_MEMORY, SR_ERR_NOT_FOUND, SR_ERR_EXISTS, SR_ERR_INTERNAL,
  SR_ERR_UNSUPPORTED, SR_ERR_VALIDATION_FAILED, SR_ERR_OPERATION_FAILED, SR_ERR_UNAUTHORIZED,
  SR_ERR_LOCKED, SR_ERR_TIME_OUT, SR_ERR_CALLBACK_FAILED, SR_ERR_CALLBACK_SHELVE
}
 Sysrepo error codes. More...
 
enum  sr_log_level_t {
  SR_LL_NONE = 0, SR_LL_ERR, SR_LL_WRN, SR_LL_INF,
  SR_LL_DBG
}
 Log levels used to determine if message of certain severity should be printed. More...
 
typedef void(* sr_log_cb )(sr_log_level_t level, const char *message)
 Sets callback that will be called when a log entry would be populated. More...
 
#define SR_DS_COUNT   4
 Count of all the datastore types. More...
 
#define SR_MOD_DS_NOTIF   4
 Special notification datastore of a module. More...
 
#define SR_MOD_DS_PLUGIN_COUNT   5
 Count of all module datastore plugin types (datastores and notifications). More...
 
enum  sr_conn_flag_t { SR_CONN_DEFAULT = 0, SR_CONN_CACHE_RUNNING = 1 }
 Flags used to override default connection handling by sr_connect call. More...
 
enum  sr_datastore_t { SR_DS_STARTUP = 0, SR_DS_RUNNING = 1, SR_DS_CANDIDATE = 2, SR_DS_OPERATIONAL = 3 }
 Datastores that sysrepo supports. To change which datastore a session operates on, use sr_session_switch_ds. More...
 
typedef struct sr_conn_ctx_s sr_conn_ctx_t
 Sysrepo connection. More...
 
typedef uint32_t sr_cid_t
 Connection ID. More...
 
typedef struct sr_session_ctx_s sr_session_ctx_t
 Sysrepo session on a connection. More...
 
typedef uint32_t sr_conn_options_t
 Options overriding default connection handling by sr_connect call, it is supposed to be bitwise OR-ed value of any sr_conn_flag_t flags. More...
 
typedef struct sr_module_ds_s sr_module_ds_t
 
typedef struct sr_error_info_err_s sr_error_info_err_t
 
typedef struct sr_error_info_s sr_error_info_t
 
enum  sr_val_type_t {
  SR_UNKNOWN_T, SR_LIST_T, SR_CONTAINER_T, SR_CONTAINER_PRESENCE_T,
  SR_LEAF_EMPTY_T, SR_NOTIFICATION_T, SR_BINARY_T, SR_BITS_T,
  SR_BOOL_T, SR_DECIMAL64_T, SR_ENUM_T, SR_IDENTITYREF_T,
  SR_INSTANCEID_T, SR_INT8_T, SR_INT16_T, SR_INT32_T,
  SR_INT64_T, SR_STRING_T, SR_UINT8_T, SR_UINT16_T,
  SR_UINT32_T, SR_UINT64_T, SR_ANYXML_T, SR_ANYDATA_T
}
 Possible types of a data element stored in the sysrepo datastore. More...
 
enum  sr_get_oper_flag_t {
  SR_OPER_DEFAULT = 0, SR_OPER_NO_STATE = 1, SR_OPER_NO_CONFIG = 2, SR_OPER_NO_SUBS = 4,
  SR_OPER_NO_STORED = 8, SR_OPER_WITH_ORIGIN = 16
}
 Flags used to override default data get behaviour on SR_DS_OPERATIONAL by sr_get_data call. More...
 
typedef struct sr_data_s sr_data_t
 
typedef union sr_val_data_u sr_val_data_t
 
typedef struct sr_val_s sr_val_t
 
typedef uint32_t sr_get_oper_options_t
 Options overriding default get handling by sr_get_data call, it is supposed to be bitwise OR-ed value of any sr_get_oper_flag_t flags. More...
 
enum  sr_edit_flag_t { SR_EDIT_DEFAULT = 0, SR_EDIT_NON_RECURSIVE = 1, SR_EDIT_STRICT = 2, SR_EDIT_ISOLATE = 4 }
 Flags used to override default behavior of data manipulation calls. More...
 
enum  sr_move_position_t { SR_MOVE_BEFORE = 0, SR_MOVE_AFTER = 1, SR_MOVE_FIRST = 2, SR_MOVE_LAST = 3 }
 Options for specifying move direction of sr_move_item call. More...
 
typedef uint32_t sr_edit_options_t
 Options overriding default behavior of data manipulation calls, it is supposed to be bitwise OR-ed value of any sr_edit_flag_t flags. More...
 
enum  sr_subscr_flag_t {
  SR_SUBSCR_DEFAULT = 0, SR_SUBSCR_NO_THREAD = 1, SR_SUBSCR_PASSIVE = 2, SR_SUBSCR_DONE_ONLY = 4,
  SR_SUBSCR_ENABLED = 8, SR_SUBSCR_UPDATE = 16, SR_SUBSCR_OPER_MERGE = 32, SR_SUBSCR_THREAD_SUSPEND = 64
}
 Flags used to override default handling of subscriptions. More...
 
typedef struct
sr_subscription_ctx_s 
sr_subscription_ctx_t
 Sysrepo subscription context returned from sr_*_subscribe calls, it is supposed to be released by the caller using sr_unsubscribe call. More...
 
typedef uint32_t sr_subscr_options_t
 Options overriding default behavior of subscriptions, it is supposed to be a bitwise OR-ed value of any sr_subscr_flag_t flags. More...
 
enum  sr_event_t {
  SR_EV_UPDATE, SR_EV_CHANGE, SR_EV_DONE, SR_EV_ABORT,
  SR_EV_ENABLED, SR_EV_RPC
}
 Type of the event that has occurred (passed to application callbacks). More...
 
enum  sr_change_oper_t { SR_OP_CREATED, SR_OP_MODIFIED, SR_OP_DELETED, SR_OP_MOVED }
 Type of the operation made on an item, used by changeset retrieval in sr_get_change_next. More...
 
typedef struct sr_change_iter_s sr_change_iter_t
 Iterator used for retrieval of a changeset using sr_get_changes_iter call. More...
 
typedef int(* sr_module_change_cb )(sr_session_ctx_t *session, uint32_t sub_id, const char *module_name, const char *xpath, sr_event_t event, uint32_t request_id, void *private_data)
 Callback to be called on the event of changing datastore content of the specified module. More...
 
enum  sr_ev_notif_type_t {
  SR_EV_NOTIF_REALTIME, SR_EV_NOTIF_REPLAY, SR_EV_NOTIF_REPLAY_COMPLETE, SR_EV_NOTIF_TERMINATED,
  SR_EV_NOTIF_MODIFIED, SR_EV_NOTIF_SUSPENDED, SR_EV_NOTIF_RESUMED
}
 Type of the notification passed to the sr_event_notif_cb and sr_event_notif_tree_cb callbacks. More...
 
typedef void(* sr_event_notif_cb )(sr_session_ctx_t *session, uint32_t sub_id, const sr_ev_notif_type_t notif_type, const char *xpath, const sr_val_t *values, const size_t values_cnt, struct timespec *timestamp, void *private_data)
 Callback to be called for the delivery of a notification. Data are represented as sr_val_t structures. More...
 
typedef void(* sr_event_notif_tree_cb )(sr_session_ctx_t *session, uint32_t sub_id, const sr_ev_notif_type_t notif_type, const struct lyd_node *notif, struct timespec *timestamp, void *private_data)
 Callback to be called for the delivery of a notification. Data are represented as libyang subtrees. More...
 

Detailed Description

public sysrepo types header

Author
Michal Vasko mvask.nosp@m.o@ce.nosp@m.snet..nosp@m.cz

This source code is licensed under BSD 3-Clause License (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at

https://opensource.org/licenses/BSD-3-Clause

Definition in file sysrepo_types.h.


Data Structure Documentation

struct sr_error_info_err_s

A single, detailed error message. Used in sr_error_info_t.

Definition at line 153 of file sysrepo_types.h.

Data Fields
sr_error_t err_code

Error code.

void * error_data

Opaque error data specific for error_format.

char * error_format

Error format identifier.

char * message

Error message.

struct sr_error_info_s

Detailed sysrepo session error information.

Definition at line 165 of file sysrepo_types.h.

Data Fields
sr_error_info_err_t * err

Array of all generated errors.

uint32_t err_count

Error count.

struct sr_module_ds_s

Custom datastore implementation config for each datastore and notifications of a module.

Definition at line 144 of file sysrepo_types.h.

Data Fields
const char * plugin_name[5]

Datastore plugin name.

union sr_val_data_u

Data of an element (if applicable), properly set according to the type.

Definition at line 229 of file sysrepo_types.h.

Data Fields
char * anydata_val

Unknown set of nodes, encoded in XML (RFC 7950 sec 7.10)

char * anyxml_val

Unknown chunk of XML (RFC 7950 sec 7.10)

char * binary_val

Base64-encoded binary data (RFC 7950 sec 9.8)

char * bits_val

A set of bits or flags (RFC 7950 sec 9.7)

int bool_val

A boolean value (RFC 7950 sec 9.5)

double decimal64_val

64-bit signed decimal number (RFC 7950 sec 9.3) Be careful with this value! It is not always possible and the value can change when converting between a double and YANG decimal64. Because of that you may see some unexpected behavior setting or reading this value. To avoid these problems, use *_tree() API variants instead.

char * enum_val

A string from enumerated strings list (RFC 7950 sec 9.6)

char * identityref_val

A reference to an abstract identity (RFC 7950 sec 9.10)

char * instanceid_val

References a data tree node (RFC 7950 sec 9.13)

int16_t int16_val

16-bit signed integer (RFC 7950 sec 9.2)

int32_t int32_val

32-bit signed integer (RFC 7950 sec 9.2)

int64_t int64_val

64-bit signed integer (RFC 7950 sec 9.2)

int8_t int8_val

8-bit signed integer (RFC 7950 sec 9.2)

char * string_val

Human-readable string (RFC 7950 sec 9.4)

uint16_t uint16_val

16-bit unsigned integer (RFC 7950 sec 9.2)

uint32_t uint32_val

32-bit unsigned integer (RFC 7950 sec 9.2)

uint64_t uint64_val

64-bit unsigned integer (RFC 7950 sec 9.2)

uint8_t uint8_val

8-bit unsigned integer (RFC 7950 sec 9.2)

struct sr_val_s

Structure that contains value of an data element stored in the sysrepo datastore.

Definition at line 258 of file sysrepo_types.h.

Data Fields
sr_val_data_t data

Data of an element (if applicable), properly set according to the type.

int dflt

Flag for node with default value (applicable only for leaves). It is set to TRUE only if the value was implicitly set by the datastore as per module schema. Explicitly set/modified data element (through the sysrepo API) always has this flag unset regardless of the entered value.

char * origin

Origin of the value.

sr_val_type_t type

Type of an element.

char * xpath

XPath (or rather path) identifier of the data element.

Macro Definition Documentation

#define SR_DS_COUNT   4

Count of all the datastore types.

Definition at line 129 of file sysrepo_types.h.

#define SR_MOD_DS_NOTIF   4

Special notification datastore of a module.

Definition at line 134 of file sysrepo_types.h.

#define SR_MOD_DS_PLUGIN_COUNT   5

Count of all module datastore plugin types (datastores and notifications).

Definition at line 139 of file sysrepo_types.h.

Typedef Documentation

typedef uint32_t sr_cid_t

Connection ID.

Definition at line 93 of file sysrepo_types.h.

typedef uint32_t sr_conn_options_t

Options overriding default connection handling by sr_connect call, it is supposed to be bitwise OR-ed value of any sr_conn_flag_t flags.

Definition at line 113 of file sysrepo_types.h.

typedef struct sr_data_s sr_data_t

Definition at line 190 of file sysrepo_types.h.

Definition at line 160 of file sysrepo_types.h.

Definition at line 170 of file sysrepo_types.h.

typedef uint32_t sr_get_oper_options_t

Options overriding default get handling by sr_get_data call, it is supposed to be bitwise OR-ed value of any sr_get_oper_flag_t flags.

Definition at line 300 of file sysrepo_types.h.

Definition at line 148 of file sysrepo_types.h.

typedef struct sr_session_ctx_s sr_session_ctx_t

Sysrepo session on a connection.

Definition at line 98 of file sysrepo_types.h.

Definition at line 253 of file sysrepo_types.h.

typedef struct sr_val_s sr_val_t

Definition at line 280 of file sysrepo_types.h.

Enumeration Type Documentation

Flags used to override default connection handling by sr_connect call.

Enumerator
SR_CONN_DEFAULT 

No special behaviour.

SR_CONN_CACHE_RUNNING 

Always cache running datastore data which makes mainly repeated retrieval of data much faster. Affects all sessions created on this connection.

Definition at line 103 of file sysrepo_types.h.

Datastores that sysrepo supports. To change which datastore a session operates on, use sr_session_switch_ds.

Enumerator
SR_DS_STARTUP 

Contains configuration data that will be loaded when a device starts.

SR_DS_RUNNING 

Contains current configuration data.

SR_DS_CANDIDATE 

Contains prepared configuration data that do not affect actual configuration.

SR_DS_OPERATIONAL 

Contains currently used configuration (see operational datastore).

Definition at line 119 of file sysrepo_types.h.

Flags used to override default data get behaviour on SR_DS_OPERATIONAL by sr_get_data call.

Enumerator
SR_OPER_DEFAULT 

No special behaviour.

SR_OPER_NO_STATE 

Return only configuration data.

SR_OPER_NO_CONFIG 

Return only state data. If there are some state subtrees with configuration parents, these are also returned (with keys if lists).

SR_OPER_NO_SUBS 

Return only stored operational data (push), do not call subscriber callbacks (pull).

SR_OPER_NO_STORED 

Do not merge with stored operational data (push).

SR_OPER_WITH_ORIGIN 

Return data with their origin attributes. Nodes without one inherit the origin from parents.

Definition at line 285 of file sysrepo_types.h.

Possible types of a data element stored in the sysrepo datastore.

Enumerator
SR_UNKNOWN_T 

Element unknown to sysrepo (unsupported element).

SR_LIST_T 

List instance. (RFC 7950 sec 7.8)

SR_CONTAINER_T 

Non-presence container. (RFC 7950 sec 7.5)

SR_CONTAINER_PRESENCE_T 

Presence container. (RFC 7950 sec 7.5.1)

SR_LEAF_EMPTY_T 

A leaf that does not hold any value (RFC 7950 sec 9.11)

SR_NOTIFICATION_T 

Notification instance (RFC 7095 sec 7.16)

SR_BINARY_T 

Base64-encoded binary data (RFC 7950 sec 9.8)

SR_BITS_T 

A set of bits or flags (RFC 7950 sec 9.7)

SR_BOOL_T 

A boolean value (RFC 7950 sec 9.5)

SR_DECIMAL64_T 

64-bit signed decimal number (RFC 7950 sec 9.3)

SR_ENUM_T 

A string from enumerated strings list (RFC 7950 sec 9.6)

SR_IDENTITYREF_T 

A reference to an abstract identity (RFC 7950 sec 9.10)

SR_INSTANCEID_T 

References a data tree node (RFC 7950 sec 9.13)

SR_INT8_T 

8-bit signed integer (RFC 7950 sec 9.2)

SR_INT16_T 

16-bit signed integer (RFC 7950 sec 9.2)

SR_INT32_T 

32-bit signed integer (RFC 7950 sec 9.2)

SR_INT64_T 

64-bit signed integer (RFC 7950 sec 9.2)

SR_STRING_T 

Human-readable string (RFC 7950 sec 9.4)

SR_UINT8_T 

8-bit unsigned integer (RFC 7950 sec 9.2)

SR_UINT16_T 

16-bit unsigned integer (RFC 7950 sec 9.2)

SR_UINT32_T 

32-bit unsigned integer (RFC 7950 sec 9.2)

SR_UINT64_T 

64-bit unsigned integer (RFC 7950 sec 9.2)

SR_ANYXML_T 

Unknown chunk of XML (RFC 7950 sec 7.10)

SR_ANYDATA_T 

Unknown set of nodes, encoded in XML (RFC 7950 sec 7.10)

Definition at line 195 of file sysrepo_types.h.