sysrepo  2.0.53
YANG-based system repository for all-around configuration management.
sysrepo_types.h
Go to the documentation of this file.
1 
17 #ifndef _SYSREPO_TYPES_H
18 #define _SYSREPO_TYPES_H
19 
20 #include <inttypes.h>
21 #include <stddef.h>
22 
23 struct lyd_node;
24 struct timespec;
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
38 typedef enum {
39  SR_ERR_OK = 0,
57 
61 typedef enum {
62  SR_LL_NONE = 0,
66  SR_LL_DBG
68 
75 typedef void (*sr_log_cb)(sr_log_level_t level, const char *message);
76 
87 typedef struct sr_conn_ctx_s sr_conn_ctx_t;
88 
92 typedef struct sr_session_ctx_s sr_session_ctx_t;
93 
97 typedef enum {
106 
111 typedef uint32_t sr_conn_options_t;
112 
117 typedef enum {
121  SR_DS_OPERATIONAL = 3
123 
127 #define SR_DS_COUNT 4
128 
132 #define SR_MOD_DS_NOTIF 4
133 
137 #define SR_MOD_DS_PLUGIN_COUNT 5
138 
144 };
145 
146 typedef struct sr_module_ds_s sr_module_ds_t;
147 
153  char *message;
154  char *error_format;
155  void *error_data;
156 };
157 
159 
165  uint32_t err_count;
166 };
167 
168 typedef struct sr_error_info_s sr_error_info_t;
169 
177 typedef int (*sr_diff_check_cb)(sr_session_ctx_t *session, const struct lyd_node *diff);
178 
189 typedef enum {
190  /* special types that does not contain any data */
199  /* types containing some data */
217  SR_ANYDATA_T
219 
223 union sr_data_u {
224  char *binary_val;
225  char *bits_val;
226  int bool_val;
227  double decimal64_val;
231  char *enum_val;
234  int8_t int8_val;
235  int16_t int16_val;
236  int32_t int32_val;
237  int64_t int64_val;
238  char *string_val;
239  uint8_t uint8_val;
240  uint16_t uint16_val;
241  uint32_t uint32_val;
242  uint64_t uint64_val;
243  char *anyxml_val;
244  char *anydata_val;
245 };
246 
247 typedef union sr_data_u sr_data_t;
248 
252 struct sr_val_s {
254  char *xpath;
255 
258 
265  int dflt;
266 
268  char *origin;
269 
272 };
273 
274 typedef struct sr_val_s sr_val_t;
275 
279 typedef enum {
282  SR_OPER_NO_CONFIG = 2,
286  SR_OPER_WITH_ORIGIN = 16
289 
294 typedef uint32_t sr_get_oper_options_t;
295 
306 typedef enum {
310  SR_EDIT_STRICT = 2,
313  SR_EDIT_ISOLATE = 4
318 
323 typedef uint32_t sr_edit_options_t;
324 
328 typedef enum {
332  SR_MOVE_LAST = 3
334 
345 typedef enum {
357 
364 
371 
378 
385 
394 
402 
409 
416 
418 
423 typedef struct sr_subscription_ctx_s sr_subscription_ctx_t;
424 
429 typedef uint32_t sr_subscr_options_t;
430 
446 typedef enum {
447  SR_EV_UPDATE,
450  SR_EV_CHANGE,
454  SR_EV_DONE,
457  SR_EV_ABORT,
463  SR_EV_ENABLED,
467  SR_EV_RPC
469 
473 typedef enum {
477  SR_OP_MOVED
479 
483 typedef struct sr_change_iter_s sr_change_iter_t;
484 
501 typedef int (*sr_module_change_cb)(sr_session_ctx_t *session, uint32_t sub_id, const char *module_name, const char *xpath,
502  sr_event_t event, uint32_t request_id, void *private_data);
503 
529 typedef int (*sr_rpc_cb)(sr_session_ctx_t *session, uint32_t sub_id, const char *xpath, const sr_val_t *input,
530  const size_t input_cnt, sr_event_t event, uint32_t request_id, sr_val_t **output, size_t *output_cnt,
531  void *private_data);
532 
548 typedef int (*sr_rpc_tree_cb)(sr_session_ctx_t *session, uint32_t sub_id, const char *op_path, const struct lyd_node *input,
549  sr_event_t event, uint32_t request_id, struct lyd_node *output, void *private_data);
550 
561 typedef enum {
573 
589 typedef void (*sr_event_notif_cb)(sr_session_ctx_t *session, uint32_t sub_id, const sr_ev_notif_type_t notif_type,
590  const char *xpath, const sr_val_t *values, const size_t values_cnt, struct timespec *timestamp, void *private_data);
591 
604 typedef void (*sr_event_notif_tree_cb)(sr_session_ctx_t *session, uint32_t sub_id, const sr_ev_notif_type_t notif_type,
605  const struct lyd_node *notif, struct timespec *timestamp, void *private_data);
606 
639 typedef int (*sr_oper_get_items_cb)(sr_session_ctx_t *session, uint32_t sub_id, const char *module_name, const char *path,
640  const char *request_xpath, uint32_t request_id, struct lyd_node **parent, void *private_data);
641 
660 typedef int (*srp_init_cb_t)(sr_session_ctx_t *session, void **private_data);
661 
670 typedef void (*srp_cleanup_cb_t)(sr_session_ctx_t *session, void *private_data);
671 
674 #ifdef __cplusplus
675 }
676 #endif
677 
678 #endif /* _SYSREPO_TYPES_H */
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.
sr_change_oper_t
Type of the operation made on an item, used by changeset retrieval in sr_get_change_next.
struct sr_change_iter_s sr_change_iter_t
Iterator used for retrieval of a changeset using sr_get_changes_iter call.
sr_event_t
Type of the event that has occurred (passed to application callbacks).
@ SR_EV_RPC
@ SR_EV_ENABLED
@ SR_EV_UPDATE
@ SR_EV_DONE
@ SR_EV_CHANGE
@ SR_EV_ABORT
struct sr_conn_ctx_s sr_conn_ctx_t
Sysrepo connection.
Definition: sysrepo_types.h:87
sr_move_position_t
Options for specifying move direction of sr_move_item call.
uint32_t sr_edit_options_t
Options overriding default behavior of data manipulation calls, it is supposed to be bitwise OR-ed va...
sr_edit_flag_t
Flags used to override default behavior of data manipulation calls.
@ SR_EDIT_DEFAULT
@ SR_EDIT_STRICT
@ SR_EDIT_ISOLATE
@ SR_EDIT_NON_RECURSIVE
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...
sr_type_t
Possible types of a data element stored in the sysrepo datastore.
sr_get_oper_flag_t
Flags used to override default data get behaviour on SR_DS_OPERATIONAL by sr_get_data call.
@ SR_INT64_T
@ SR_UNKNOWN_T
@ SR_LEAF_EMPTY_T
@ SR_INT8_T
@ SR_BINARY_T
@ SR_CONTAINER_T
@ SR_INT32_T
@ SR_INT16_T
@ SR_ANYDATA_T
@ SR_UINT8_T
@ SR_STRING_T
@ SR_UINT32_T
@ SR_IDENTITYREF_T
@ SR_BITS_T
@ SR_ENUM_T
@ SR_ANYXML_T
@ SR_NOTIFICATION_T
@ SR_CONTAINER_PRESENCE_T
@ SR_UINT64_T
@ SR_LIST_T
@ SR_INSTANCEID_T
@ SR_UINT16_T
@ SR_BOOL_T
@ SR_DECIMAL64_T
sr_error_t
Sysrepo error codes.
Definition: sysrepo_types.h:38
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.
Definition: sysrepo_types.h:75
sr_log_level_t
Log levels used to determine if message of certain severity should be printed.
Definition: sysrepo_types.h:61
@ SR_ERR_LY
Definition: sysrepo_types.h:41
@ SR_ERR_NOT_FOUND
Definition: sysrepo_types.h:44
@ SR_ERR_UNSUPPORTED
Definition: sysrepo_types.h:47
@ SR_ERR_LOCKED
Definition: sysrepo_types.h:51
@ SR_ERR_OPERATION_FAILED
Definition: sysrepo_types.h:49
@ SR_ERR_EXISTS
Definition: sysrepo_types.h:45
@ SR_ERR_VALIDATION_FAILED
Definition: sysrepo_types.h:48
@ SR_ERR_OK
Definition: sysrepo_types.h:39
@ SR_ERR_CALLBACK_SHELVE
Definition: sysrepo_types.h:54
@ SR_ERR_CALLBACK_FAILED
Definition: sysrepo_types.h:53
@ SR_ERR_INVAL_ARG
Definition: sysrepo_types.h:40
@ SR_ERR_INTERNAL
Definition: sysrepo_types.h:46
@ SR_ERR_SYS
Definition: sysrepo_types.h:42
@ SR_ERR_UNAUTHORIZED
Definition: sysrepo_types.h:50
@ SR_ERR_NO_MEMORY
Definition: sysrepo_types.h:43
@ SR_ERR_TIME_OUT
Definition: sysrepo_types.h:52
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...
sr_ev_notif_type_t
Type of the notification passed to the sr_event_notif_cb and sr_event_notif_tree_cb callbacks.
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.
@ SR_EV_NOTIF_SUSPENDED
@ SR_EV_NOTIF_REALTIME
@ SR_EV_NOTIF_TERMINATED
@ SR_EV_NOTIF_MODIFIED
@ SR_EV_NOTIF_RESUMED
@ SR_EV_NOTIF_REPLAY_COMPLETE
@ SR_EV_NOTIF_REPLAY
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...
int(* srp_init_cb_t)(sr_session_ctx_t *session, void **private_data)
Sysrepo plugin initialization callback.
void(* srp_cleanup_cb_t)(sr_session_ctx_t *session, void *private_data)
Sysrepo plugin cleanup callback.
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.
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.
sr_subscr_flag_t
Flags used to override default handling of subscriptions.
uint32_t sr_subscr_options_t
Options overriding default behavior of subscriptions, it is supposed to be a bitwise OR-ed value of a...
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...
@ SR_SUBSCR_DONE_ONLY
The subscriber does not support verification of the changes and wants to be notified only after the c...
@ SR_SUBSCR_CTX_REUSE
This option enables the application to re-use an already existing subscription context previously ret...
@ SR_SUBSCR_PASSIVE
The subscriber is not the "owner" of the subscribed data tree, just a passive watcher for changes....
@ SR_SUBSCR_DEFAULT
Default behavior of the subscription. In case of sr_module_change_subscribe call it means that:
@ SR_SUBSCR_UPDATE
The subscriber will be called before any other subscribers for the particular module with an addition...
@ SR_SUBSCR_THREAD_SUSPEND
Suspend the default handler thread before adding the subscription if it is running....
@ SR_SUBSCR_NO_THREAD
There will be no thread created for handling this subscription meaning no event will be processed!...
@ SR_SUBSCR_ENABLED
The subscriber wants to be notified about the current configuration at the moment of subscribing....
@ SR_SUBSCR_OPER_MERGE
Instead of removing any previous existing matching data before getting them from an operational subsc...
sr_type_t type
char * bits_val
struct sr_session_ctx_s sr_session_ctx_t
Sysrepo session on a connection.
Definition: sysrepo_types.h:92
uint32_t uint32_val
char * origin
uint16_t uint16_val
char * anydata_val
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.
int8_t int8_val
#define SR_MOD_DS_PLUGIN_COUNT
Count of all module datastore plugin types (datastores and notifications).
uint32_t sr_conn_options_t
Options overriding default connection handling by sr_connect call, it is supposed to be bitwise OR-ed...
char * instanceid_val
sr_data_t data
char * enum_val
int32_t int32_val
int16_t int16_val
char * identityref_val
sr_conn_flag_t
Flags used to override default connection handling by sr_connect call.
Definition: sysrepo_types.h:97
@ SR_CONN_NO_SCHED_CHANGES
@ SR_CONN_DEFAULT
Definition: sysrepo_types.h:98
@ SR_CONN_CACHE_RUNNING
Definition: sysrepo_types.h:99
@ SR_CONN_ERR_ON_SCHED_FAIL
char * anyxml_val
uint64_t uint64_val
uint32_t err_count
int64_t int64_val
char * string_val
sr_error_info_err_t * err
sr_datastore_t
Datastores that sysrepo supports. To change which datastore a session operates on,...
@ SR_DS_RUNNING
@ SR_DS_CANDIDATE
@ SR_DS_OPERATIONAL
@ SR_DS_STARTUP
uint8_t uint8_val
double decimal64_val
char * xpath
char * binary_val
const char * plugin_name[5]
@ SR_MOVE_LAST
@ SR_MOVE_FIRST
@ SR_MOVE_AFTER
@ SR_MOVE_BEFORE
@ SR_OPER_NO_STATE
@ SR_OPER_NO_STORED
@ SR_OPER_NO_CONFIG
@ SR_OPER_DEFAULT
@ SR_OPER_NO_SUBS
@ SR_OPER_WITH_ORIGIN
@ SR_OP_CREATED
@ SR_OP_MOVED
@ SR_OP_MODIFIED
@ SR_OP_DELETED
@ SR_LL_ERR
Definition: sysrepo_types.h:63
@ SR_LL_INF
Definition: sysrepo_types.h:65
@ SR_LL_NONE
Definition: sysrepo_types.h:62
@ SR_LL_WRN
Definition: sysrepo_types.h:64
@ SR_LL_DBG
Definition: sysrepo_types.h:66
A single, detailed error message. Used in sr_error_info_t.
Detailed sysrepo session error information.
Custom datastore implementation config for each datastore and notifications of a module.
Structure that contains value of an data element stored in the sysrepo datastore.
Data of an element (if applicable), properly set according to the type.