sysrepo  2.0.1
YANG-basedsystemrepositoryforall-aroundconfigurationmanagement.
 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>

Go to the source code of this file.

Data Structures

union  sr_data_t
 Data of an element (if applicable), properly set according to the type. More...
 
struct  sr_error_info_err_t
 A single, detailed error message. Used in sr_error_info_t. More...
 
struct  sr_error_info_t
 Detailed sysrepo session error information. More...
 
struct  sr_val_t
 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...
 
enum  sr_conn_flag_t { SR_CONN_DEFAULT = 0, SR_CONN_CACHE_RUNNING = 1, SR_CONN_NO_SCHED_CHANGES = 2, SR_CONN_ERR_ON_SCHED_FAIL = 4 }
 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 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 int(* sr_diff_check_cb )(sr_session_ctx_t *session, const struct lyd_node *diff)
 Callback to be called before applying a diff. Set it using sr_set_diff_check_callback. More...
 
enum  sr_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 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_CTX_REUSE = 1, SR_SUBSCR_NO_THREAD = 2, SR_SUBSCR_PASSIVE = 4,
  SR_SUBSCR_DONE_ONLY = 8, SR_SUBSCR_ENABLED = 16, SR_SUBSCR_UPDATE = 32, SR_SUBSCR_OPER_MERGE = 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

union sr_data_t

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

Definition at line 200 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_error_info_err_t

A single, detailed error message. Used in sr_error_info_t.

Definition at line 132 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_t

Detailed sysrepo session error information.

Definition at line 142 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_val_t

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

Definition at line 227 of file sysrepo_types.h.

Data Fields
sr_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_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 127 of file sysrepo_types.h.

Typedef Documentation

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 111 of file sysrepo_types.h.

typedef int(* sr_diff_check_cb)(sr_session_ctx_t *session, const struct lyd_node *diff)

Callback to be called before applying a diff. Set it using sr_set_diff_check_callback.

Parameters
[in]sessionImplicit session (do not stop) with information about the event originator session IDs.
[in]diffDiff to be applied.
Returns
Error code (SR_ERR_OK on success).

Definition at line 154 of file sysrepo_types.h.

typedef struct sr_session_ctx_s sr_session_ctx_t

Sysrepo session on a connection.

Definition at line 92 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.

SR_CONN_NO_SCHED_CHANGES 

Do not parse internal modules data and apply any scheduled changes. Makes creating the connection faster but, obviously, scheduled changes are not applied.

SR_CONN_ERR_ON_SCHED_FAIL 

If applying any of the scheduled changes fails, do not create a connection and return an error.

Definition at line 97 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 117 of file sysrepo_types.h.