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
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 #include <sys/stat.h>
23 
24 struct lyd_node;
25 struct timespec;
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
39 typedef enum {
40  SR_ERR_OK = 0,
57 } sr_error_t;
58 
62 typedef enum {
63  SR_LL_NONE = 0,
69 
76 typedef void (*sr_log_cb)(sr_log_level_t level, const char *message);
77 
88 typedef struct sr_conn_ctx_s sr_conn_ctx_t;
89 
93 typedef uint32_t sr_cid_t;
94 
98 typedef struct sr_session_ctx_s sr_session_ctx_t;
99 
103 typedef enum {
108 
113 typedef uint32_t sr_conn_options_t;
114 
119 typedef enum {
125 
129 #define SR_DS_COUNT 4
130 
134 #define SR_MOD_DS_NOTIF 4
135 
139 #define SR_MOD_DS_PLUGIN_COUNT 5
140 
146 };
147 
149 
155  char *message;
156  char *error_format;
157  void *error_data;
158 };
159 
161 
167  uint32_t err_count;
168 };
169 
171 
182 struct sr_data_s {
185 
187  struct lyd_node *tree;
188 };
189 
190 typedef struct sr_data_s sr_data_t;
191 
195 typedef enum {
196  /* special types that does not contain any data */
205  /* types containing some data */
224 } sr_val_type_t;
225 
230  char *binary_val;
231  char *bits_val;
232  int bool_val;
233  double decimal64_val;
237  char *enum_val;
240  int8_t int8_val;
241  int16_t int16_val;
242  int32_t int32_val;
243  int64_t int64_val;
244  char *string_val;
245  uint8_t uint8_val;
246  uint16_t uint16_val;
247  uint32_t uint32_val;
248  uint64_t uint64_val;
249  char *anyxml_val;
250  char *anydata_val;
251 };
252 
254 
258 struct sr_val_s {
260  char *xpath;
261 
264 
271  int dflt;
272 
274  char *origin;
275 
278 };
279 
280 typedef struct sr_val_s sr_val_t;
281 
285 typedef enum {
295 
300 typedef uint32_t sr_get_oper_options_t;
301 
312 typedef enum {
324 
329 typedef uint32_t sr_edit_options_t;
330 
334 typedef enum {
340 
351 typedef enum {
363 
370 
377 
384 
393 
401 
408 
415 
417 
422 typedef struct sr_subscription_ctx_s sr_subscription_ctx_t;
423 
428 typedef uint32_t sr_subscr_options_t;
429 
445 typedef enum {
467 } sr_event_t;
468 
472 typedef enum {
478 
482 typedef struct sr_change_iter_s sr_change_iter_t;
483 
500 typedef int (*sr_module_change_cb)(sr_session_ctx_t *session, uint32_t sub_id, const char *module_name, const char *xpath,
501  sr_event_t event, uint32_t request_id, void *private_data);
502 
528 typedef int (*sr_rpc_cb)(sr_session_ctx_t *session, uint32_t sub_id, const char *xpath, const sr_val_t *input,
529  const size_t input_cnt, sr_event_t event, uint32_t request_id, sr_val_t **output, size_t *output_cnt,
530  void *private_data);
531 
547 typedef int (*sr_rpc_tree_cb)(sr_session_ctx_t *session, uint32_t sub_id, const char *op_path, const struct lyd_node *input,
548  sr_event_t event, uint32_t request_id, struct lyd_node *output, void *private_data);
549 
560 typedef enum {
572 
587 typedef void (*sr_event_notif_cb)(sr_session_ctx_t *session, uint32_t sub_id, const sr_ev_notif_type_t notif_type,
588  const char *xpath, const sr_val_t *values, const size_t values_cnt, struct timespec *timestamp, void *private_data);
589 
602 typedef void (*sr_event_notif_tree_cb)(sr_session_ctx_t *session, uint32_t sub_id, const sr_ev_notif_type_t notif_type,
603  const struct lyd_node *notif, struct timespec *timestamp, void *private_data);
604 
637 typedef int (*sr_oper_get_items_cb)(sr_session_ctx_t *session, uint32_t sub_id, const char *module_name, const char *path,
638  const char *request_xpath, uint32_t request_id, struct lyd_node **parent, void *private_data);
639 
658 typedef int (*srp_init_cb_t)(sr_session_ctx_t *session, void **private_data);
659 
668 typedef void (*srp_cleanup_cb_t)(sr_session_ctx_t *session, void *private_data);
669 
672 #ifdef __cplusplus
673 }
674 #endif
675 
676 #endif /* _SYSREPO_TYPES_H */
Instead of removing any previous existing matching data before getting them from an operational subsc...
The subscriber will be called before any other subscribers for the particular module with an addition...
char * origin
sr_datastore_t
Datastores that sysrepo supports. To change which datastore a session operates on, use sr_session_switch_ds.
sr_event_t
Type of the event that has occurred (passed to application callbacks).
uint32_t uint32_val
const char * plugin_name[5]
uint32_t sr_edit_options_t
Options overriding default behavior of data manipulation calls, it is supposed to be bitwise OR-ed va...
int(* srp_init_cb_t)(sr_session_ctx_t *session, void **private_data)
Sysrepo plugin initialization callback.
sr_val_type_t
Possible types of a data element stored in the sysrepo datastore.
char * instanceid_val
sr_error_t
Sysrepo error codes.
Definition: sysrepo_types.h:39
uint8_t uint8_val
sr_error_info_err_t * err
double decimal64_val
sr_log_level_t
Log levels used to determine if message of certain severity should be printed.
Definition: sysrepo_types.h:62
Default behavior of the subscription. In case of sr_module_change_subscribe call it means that: ...
int64_t int64_val
char * anydata_val
char * xpath
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...
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_subscr_flag_t
Flags used to override default handling of subscriptions.
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...
Custom datastore implementation config for each datastore and notifications of a module.
uint32_t err_count
The subscriber wants to be notified about the current configuration at the moment of subscribing...
uint32_t sr_conn_options_t
Options overriding default connection handling by sr_connect call, it is supposed to be bitwise OR-ed...
Detailed sysrepo session error information.
Suspend the default handler thread before adding the subscription if it is running. In case of the first subscription, start the handler thread suspended. Meaning any events will not be handled until sr_subscription_thread_resume() is called.
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...
uint32_t sr_cid_t
Connection ID.
Definition: sysrepo_types.h:93
struct sr_session_ctx_s sr_session_ctx_t
Sysrepo session on a connection.
Definition: sysrepo_types.h:98
struct lyd_node * tree
char * identityref_val
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...
A single, detailed error message. Used in sr_error_info_t.
struct sr_conn_ctx_s sr_conn_ctx_t
Sysrepo connection.
Definition: sysrepo_types.h:88
Data of an element (if applicable), properly set according to the type.
sr_get_oper_flag_t
Flags used to override default data get behaviour on SR_DS_OPERATIONAL by sr_get_data call...
#define SR_MOD_DS_PLUGIN_COUNT
Count of all module datastore plugin types (datastores and notifications).
struct sr_change_iter_s sr_change_iter_t
Iterator used for retrieval of a changeset using sr_get_changes_iter call.
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_edit_flag_t
Flags used to override default behavior of data manipulation calls.
sr_change_oper_t
Type of the operation made on an item, used by changeset retrieval in sr_get_change_next.
sr_ev_notif_type_t
Type of the notification passed to the sr_event_notif_cb and sr_event_notif_tree_cb callbacks...
int16_t int16_val
uint64_t uint64_val
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:76
The subscriber does not support verification of the changes and wants to be notified only after the c...
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...
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...
uint16_t uint16_val
sr_conn_flag_t
Flags used to override default connection handling by sr_connect call.
sr_val_type_t type
There will be no thread created for handling this subscription meaning no event will be processed! Us...
The subscriber is not the &quot;owner&quot; of the subscribed data tree, just a passive watcher for changes...
const sr_conn_ctx_t * conn
uint32_t sr_subscr_options_t
Options overriding default behavior of subscriptions, it is supposed to be a bitwise OR-ed value of a...
sr_move_position_t
Options for specifying move direction of sr_move_item call.
void(* srp_cleanup_cb_t)(sr_session_ctx_t *session, void *private_data)
Sysrepo plugin cleanup callback.
Structure that safely wraps libyang data and prevents unexpected context changes. ...
sr_val_data_t data
Structure that contains value of an data element stored in the sysrepo datastore. ...
int32_t int32_val