sysrepo 3.6.11
YANG-based system repository for all-around configuration management.
Loading...
Searching...
No Matches
sysrepo_types.h
Go to the documentation of this file.
1
16
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
25struct lyd_node;
26struct timespec;
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
36
59
70
77typedef void (*sr_log_cb)(sr_log_level_t level, const char *message);
78
80
85
89typedef struct sr_conn_ctx_s sr_conn_ctx_t;
90
94typedef uint32_t sr_cid_t;
95
99typedef struct sr_session_ctx_s sr_session_ctx_t;
100
110
115typedef uint32_t sr_conn_options_t;
116
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
152typedef struct {
155
165
169typedef struct {
171 uint32_t err_count;
173
177typedef 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
191
196
200typedef struct {
203
205 struct lyd_node *tree;
206} sr_data_t;
207
241
245typedef union {
247 char *bits_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;
261 uint8_t uint8_val;
262 uint16_t uint16_val;
263 uint32_t uint32_val;
264 uint64_t uint64_val;
268
272typedef struct {
274 char *xpath;
275
278
285 int dflt;
286
288 char *origin;
289
292} sr_val_t;
293
314
315#define SR_OPER_MASK 0xFFFF
316
320typedef enum {
325
330typedef uint32_t sr_get_options_t;
331
333
338
354
359typedef uint32_t sr_edit_options_t;
360
370
372
377
470
475typedef struct sr_subscription_ctx_s sr_subscription_ctx_t;
476
481typedef uint32_t sr_subscr_options_t;
482
484
489
521
531
535typedef struct sr_change_iter_s sr_change_iter_t;
536
552typedef int (*sr_module_change_cb)(sr_session_ctx_t *session, uint32_t sub_id, const char *module_name, const char *xpath,
553 sr_event_t event, uint32_t operation_id, void *private_data);
554
556
561
580typedef int (*sr_rpc_cb)(sr_session_ctx_t *session, uint32_t sub_id, const char *xpath, const sr_val_t *input,
581 const size_t input_cnt, sr_event_t event, uint32_t operation_id, sr_val_t **output, size_t *output_cnt,
582 void *private_data);
583
599typedef int (*sr_rpc_tree_cb)(sr_session_ctx_t *session, uint32_t sub_id, const char *op_path, const struct lyd_node *input,
600 sr_event_t event, uint32_t operation_id, struct lyd_node *output, void *private_data);
601
603
608
627
642typedef void (*sr_event_notif_cb)(sr_session_ctx_t *session, uint32_t sub_id, const sr_ev_notif_type_t notif_type,
643 const char *xpath, const sr_val_t *values, const size_t values_cnt, struct timespec *timestamp, void *private_data);
644
657typedef void (*sr_event_notif_tree_cb)(sr_session_ctx_t *session, uint32_t sub_id, const sr_ev_notif_type_t notif_type,
658 const struct lyd_node *notif, struct timespec *timestamp, void *private_data);
659
661
666
692typedef int (*sr_oper_get_items_cb)(sr_session_ctx_t *session, uint32_t sub_id, const char *module_name, const char *path,
693 const char *request_xpath, uint32_t operation_id, struct lyd_node **parent, void *private_data);
694
696
701
713typedef int (*srp_init_cb_t)(sr_session_ctx_t *session, void **private_data);
714
723typedef void (*srp_cleanup_cb_t)(sr_session_ctx_t *session, void *private_data);
724
726
727#ifdef __cplusplus
728}
729#endif
730
731#endif /* _SYSREPO_TYPES_H */
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).
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 operation_id, void *private_data)
Callback to be called on the event of changing datastore content of the specified module.
@ 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.
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
const sr_conn_ctx_t * conn
struct lyd_node * tree
Structure that safely wraps libyang data and prevents unexpected context changes.
sr_error_t
Sysrepo error codes.
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.
sr_log_level_t
Log levels used to determine if message of certain severity should be printed.
@ SR_ERR_LY
@ SR_ERR_NOT_FOUND
@ SR_ERR_UNSUPPORTED
@ SR_ERR_LOCKED
@ SR_ERR_OPERATION_FAILED
@ SR_ERR_EXISTS
@ SR_ERR_VALIDATION_FAILED
@ SR_ERR_OK
@ SR_ERR_CALLBACK_SHELVE
@ SR_ERR_CALLBACK_FAILED
@ SR_ERR_INVAL_ARG
@ SR_ERR_INTERNAL
@ SR_ERR_SYS
@ SR_ERR_UNAUTHORIZED
@ SR_ERR_NO_MEMORY
@ SR_ERR_TIME_OUT
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
@ SR_EV_NOTIF_STOP_TIME
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 operation_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(* 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 operation_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 operation_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.
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.
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_FILTER_ORIG
Normally, XPath filter is applied by the listener (subscriber) for counting its statistics of filtere...
@ SR_SUBSCR_CHANGE_ALL_MODULES
If you call getters (sr_get_data()) in the module change callback for data from other modules than th...
@ 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_OPER_POLL_DIFF
On every data retrieval additionally compute diff with the previous data and report the changes to an...
@ 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...
const char ** features
struct sr_session_ctx_s sr_session_ctx_t
Sysrepo session on a connection.
uint64_t uint64_val
sr_error_info_err_t * err
char * instanceid_val
const char * group
const char * owner
#define SR_MOD_DS_PLUGIN_COUNT
Count of all module 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...
sr_get_oper_flag_t
Flags used to override default data get behaviour on SR_DS_OPERATIONAL.
@ SR_OPER_NO_PUSH_NP_CONT
@ SR_OPER_NO_POLL_CACHED
@ SR_OPER_NO_STATE
@ SR_OPER_NO_STORED
@ SR_OPER_NO_CONFIG
@ SR_OPER_NO_RUN_CACHED
@ SR_OPER_DEFAULT
@ SR_OPER_NO_SUBS
@ SR_OPER_WITH_ORIGIN
sr_val_type_t
Possible types of a data element stored in the sysrepo datastore.
@ 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_conn_flag_t
Flags used to override default connection handling by sr_connect call.
@ SR_CONN_CTX_SET_PRIV_PARSED
@ SR_CONN_DEFAULT
@ SR_CONN_CACHE_RUNNING
uint32_t sr_cid_t
Connection ID.
char * origin
uint32_t uint32_val
char * identityref_val
char * xpath
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
sr_get_flag_t
Flags used to override default data get behavior.
@ SR_GET_NO_FILTER
sr_val_data_t data
sr_datastore_t
Datastores that sysrepo supports. To change which datastore a session operates on,...
@ SR_DS_RUNNING
@ SR_DS_CANDIDATE
@ SR_DS_FACTORY_DEFAULT
@ SR_DS_OPERATIONAL
@ SR_DS_STARTUP
const char * plugin_name[6]
uint16_t uint16_val
sr_val_type_t type
@ SR_MOVE_LAST
@ SR_MOVE_FIRST
@ SR_MOVE_AFTER
@ SR_MOVE_BEFORE
@ SR_OP_CREATED
@ SR_OP_MOVED
@ SR_OP_MODIFIED
@ SR_OP_DELETED
@ SR_LL_ERR
@ SR_LL_INF
@ SR_LL_NONE
@ SR_LL_WRN
@ SR_LL_DBG
A single, detailed error message. Used in sr_error_info_t.
Detailed sysrepo session error information.
Information about a module to be installed.
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.