sysrepo  2.11.7
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 <fcntl.h>
21 #include <inttypes.h>
22 #include <stddef.h>
23 #include <sys/stat.h>
24 
25 struct lyd_node;
26 struct timespec;
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
40 typedef enum {
41  SR_ERR_OK = 0,
58 } sr_error_t;
59 
63 typedef enum {
64  SR_LL_NONE = 0,
70 
77 typedef void (*sr_log_cb)(sr_log_level_t level, const char *message);
78 
89 typedef struct sr_conn_ctx_s sr_conn_ctx_t;
90 
94 typedef uint32_t sr_cid_t;
95 
99 typedef struct sr_session_ctx_s sr_session_ctx_t;
100 
104 typedef enum {
110 
115 typedef uint32_t sr_conn_options_t;
116 
121 typedef enum {
128 
132 #define SR_DS_COUNT 4
133 
137 #define SR_DS_READ_COUNT 5
138 
142 #define SR_MOD_DS_NOTIF 5
143 
147 #define SR_MOD_DS_PLUGIN_COUNT 6
148 
152 typedef struct {
153  const char *plugin_name[SR_MOD_DS_PLUGIN_COUNT];
155 
159 typedef struct {
161  char *message;
162  char *error_format;
163  void *error_data;
165 
169 typedef struct {
171  uint32_t err_count;
173 
177 typedef struct {
178  union {
179  const char *schema_path;
180  const char *schema_yang;
181  };
182  const char **features;
185  const char *owner;
186  const char *group;
187  mode_t perm;
189 
200 typedef struct {
203 
205  struct lyd_node *tree;
206 } sr_data_t;
207 
211 typedef enum {
212  /* special types that does not contain any data */
221  /* types containing some data */
240 } sr_val_type_t;
241 
245 typedef union {
246  char *binary_val;
247  char *bits_val;
248  int bool_val;
249  double decimal64_val;
253  char *enum_val;
256  int8_t int8_val;
257  int16_t int16_val;
258  int32_t int32_val;
259  int64_t int64_val;
260  char *string_val;
261  uint8_t uint8_val;
262  uint16_t uint16_val;
263  uint32_t uint32_val;
264  uint64_t uint64_val;
265  char *anyxml_val;
266  char *anydata_val;
267 } sr_val_data_t;
268 
272 typedef struct {
274  char *xpath;
275 
278 
285  int dflt;
286 
288  char *origin;
289 
292 } sr_val_t;
293 
297 typedef enum {
311 
312 #define SR_OPER_MASK 0xFFFF
317 typedef enum {
318  SR_GET_NO_FILTER = 0x010000
321 } sr_get_flag_t;
322 
327 typedef uint32_t sr_get_options_t;
328 
339 typedef enum {
351 
356 typedef uint32_t sr_edit_options_t;
357 
361 typedef enum {
367 
378 typedef enum {
392 
399 
406 
413 
422 
430 
437 
444 
450 
458 
460 
465 typedef struct sr_subscription_ctx_s sr_subscription_ctx_t;
466 
471 typedef uint32_t sr_subscr_options_t;
472 
488 typedef enum {
510 } sr_event_t;
511 
515 typedef enum {
521 
525 typedef struct sr_change_iter_s sr_change_iter_t;
526 
543 typedef int (*sr_module_change_cb)(sr_session_ctx_t *session, uint32_t sub_id, const char *module_name, const char *xpath,
544  sr_event_t event, uint32_t request_id, void *private_data);
545 
571 typedef int (*sr_rpc_cb)(sr_session_ctx_t *session, uint32_t sub_id, const char *xpath, const sr_val_t *input,
572  const size_t input_cnt, sr_event_t event, uint32_t request_id, sr_val_t **output, size_t *output_cnt,
573  void *private_data);
574 
590 typedef int (*sr_rpc_tree_cb)(sr_session_ctx_t *session, uint32_t sub_id, const char *op_path, const struct lyd_node *input,
591  sr_event_t event, uint32_t request_id, struct lyd_node *output, void *private_data);
592 
603 typedef enum {
618 
633 typedef void (*sr_event_notif_cb)(sr_session_ctx_t *session, uint32_t sub_id, const sr_ev_notif_type_t notif_type,
634  const char *xpath, const sr_val_t *values, const size_t values_cnt, struct timespec *timestamp, void *private_data);
635 
648 typedef void (*sr_event_notif_tree_cb)(sr_session_ctx_t *session, uint32_t sub_id, const sr_ev_notif_type_t notif_type,
649  const struct lyd_node *notif, struct timespec *timestamp, void *private_data);
650 
683 typedef int (*sr_oper_get_items_cb)(sr_session_ctx_t *session, uint32_t sub_id, const char *module_name, const char *path,
684  const char *request_xpath, uint32_t request_id, struct lyd_node **parent, void *private_data);
685 
704 typedef int (*srp_init_cb_t)(sr_session_ctx_t *session, void **private_data);
705 
714 typedef void (*srp_cleanup_cb_t)(sr_session_ctx_t *session, void *private_data);
715 
718 #ifdef __cplusplus
719 }
720 #endif
721 
722 #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...
uint32_t sr_get_options_t
Options overriding default get handling by sr_get_data call, it is supposed to be a bitmask sr_get_op...
sr_module_ds_t module_ds
int64_t int64_val
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 sr_edit_options_t
Options overriding default behavior of data manipulation calls, it is supposed to be bitwise OR-ed va...
double decimal64_val
sr_val_type_t
Possible types of a data element stored in the sysrepo datastore.
On every data retrieval additionally compute diff with the previous data and report the changes to an...
Normally, XPath filter is applied by the listener (subscriber) for counting its statistics of filtere...
sr_error_t
Sysrepo error codes.
Definition: sysrepo_types.h:40
sr_error_info_err_t * err
uint32_t err_count
uint16_t uint16_val
Information about a module to be installed.
char * origin
sr_log_level_t
Log levels used to determine if message of certain severity should be printed.
Definition: sysrepo_types.h:63
Default behavior of the subscription. In case of sr_module_change_subscribe call it means that: ...
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...
uint8_t uint8_val
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_val_type_t type
sr_subscr_flag_t
Flags used to override default handling of subscriptions.
const char * owner
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...
struct lyd_node * tree
Custom datastore implementation config for each datastore and notifications of a module.
void(* srp_cleanup_cb_t)(sr_session_ctx_t *session, void *private_data)
Sysrepo plugin cleanup callback.
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.
char * identityref_val
int(* srp_init_cb_t)(sr_session_ctx_t *session, void **private_data)
Sysrepo plugin initialization callback.
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:94
struct sr_session_ctx_s sr_session_ctx_t
Sysrepo session on a connection.
Definition: sysrepo_types.h:99
sr_val_data_t data
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...
char * instanceid_val
A single, detailed error message. Used in sr_error_info_t.
uint64_t uint64_val
struct sr_conn_ctx_s sr_conn_ctx_t
Sysrepo connection.
Definition: sysrepo_types.h:89
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.
#define SR_MOD_DS_PLUGIN_COUNT
Count of all module 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...
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:77
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...
char * anydata_val
uint32_t uint32_val
char * xpath
sr_conn_flag_t
Flags used to override default connection handling by sr_connect call.
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...
int32_t int32_val
uint32_t sr_subscr_options_t
Options overriding default behavior of subscriptions, it is supposed to be a bitwise OR-ed value of a...
const char ** features
sr_move_position_t
Options for specifying move direction of sr_move_item call.
Structure that safely wraps libyang data and prevents unexpected context changes. ...
const sr_conn_ctx_t * conn
int16_t int16_val
const char * group
sr_get_flag_t
Flags used to override default data get behavior.
Structure that contains value of an data element stored in the sysrepo datastore. ...