sysrepo 3.6.11
YANG-based system repository for all-around configuration management.
Loading...
Searching...
No Matches
subscribed_notifications.h
Go to the documentation of this file.
1
16
17#ifndef SYSREPO_SUBSCRIBED_NOTIFICATIONS_H_
18#define SYSREPO_SUBSCRIBED_NOTIFICATIONS_H_
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#include <sys/stat.h>
25
26#include "sysrepo.h"
27
36
46
47typedef struct {
48 uint32_t sub_id;
50 struct timespec stop_time;
51 uint32_t sent_count;
54
56
57 union {
58 struct {
59 char *stream;
60 struct timespec start_time;
61 } sub_notif;
62 struct {
64 uint32_t period;
65 struct timespec anchor_time;
66 } yp_periodic;
67 struct {
69 uint32_t dampening_period;
70 int sync_on_start;
72 } yp_on_change;
73 };
75
84int srsn_filter_subtree2xpath(const struct lyd_node *subtree, sr_session_ctx_t *session, char **xpath_filter);
85
95int srsn_stream_collect_mods(const char *stream, const char *xpath_filter, const struct ly_ctx *ly_ctx,
96 struct ly_set **mod_set);
97
105int srsn_notif_sent(uint32_t sub_id);
106
123int srsn_subscribe(sr_session_ctx_t *session, const char *stream, const char *xpath_filter, const struct timespec *stop_time,
124 const struct timespec *start_time, int sub_no_thread, sr_subscription_ctx_t **sub,
125 struct timespec *replay_start_time, int *fd, uint32_t *sub_id);
126
141int srsn_yang_push_periodic(sr_session_ctx_t *session, sr_datastore_t ds, const char *xpath_filter, uint32_t period_ms,
142 const struct timespec *anchor_time, const struct timespec *stop_time, int *fd, uint32_t *sub_id);
143
162int srsn_yang_push_on_change(sr_session_ctx_t *session, sr_datastore_t ds, const char *xpath_filter,
163 uint32_t dampening_period_ms, int sync_on_start, int excluded_changes[SRSN_COUNT_YP_CHANGE],
164 const struct timespec *stop_time, int sub_no_thread, sr_subscription_ctx_t **sub, int *fd, uint32_t *sub_id);
165
173
183int srsn_modify_xpath_filter(uint32_t sub_id, const char *xpath_filter);
184
194int srsn_modify_stop_time(uint32_t sub_id, const struct timespec *stop_time);
195
206int srsn_yang_push_modify_periodic(uint32_t sub_id, uint32_t period_ms, const struct timespec *anchor_time);
207
217int srsn_yang_push_modify_on_change(uint32_t sub_id, uint32_t dampening_period_ms);
218
228int srsn_suspend(uint32_t sub_id, const char *reason);
229
238int srsn_resume(uint32_t sub_id);
239
252int srsn_terminate(uint32_t sub_id, const char *reason);
253
257int srsn_oper_data_streams_cb(sr_session_ctx_t *session, uint32_t sub_id, const char *module_name, const char *path,
258 const char *request_xpath, uint32_t request_id, struct lyd_node **parent, void *private_data);
259
269
277int srsn_oper_data_sub(uint32_t sub_id, srsn_state_sub_t **sub);
278
286
299int srsn_read_notif(int fd, const struct ly_ctx *ly_ctx, struct timespec *timestamp, struct lyd_node **notif);
300
311int srsn_poll(int fd, uint32_t timeout_ms);
312
320typedef void (*srsn_notif_cb)(const struct lyd_node *notif, const struct timespec *timestamp, void *cb_data);
321
330
334int srsn_read_dispatch_start(int fd, sr_conn_ctx_t *conn, srsn_notif_cb cb, void *cb_data);
335
346int srsn_read_dispatch_add(int fd, void *cb_data);
347
354
361
362#ifdef __cplusplus
363}
364#endif
365
366#endif /* SYSREPO_SUBSCRIBED_NOTIFICATIONS_H_ */
struct sr_conn_ctx_s sr_conn_ctx_t
Sysrepo connection.
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...
int srsn_notif_sent(uint32_t sub_id)
Increase the sent-notifications counter in case of additional manually-generated notifications (such ...
int srsn_modify_xpath_filter(uint32_t sub_id, const char *xpath_filter)
Modify a generic subscription xpath-filter.
int srsn_yang_push_modify_periodic(uint32_t sub_id, uint32_t period_ms, const struct timespec *anchor_time)
Modify a yang-push periodic subscription.
int srsn_stream_collect_mods(const char *stream, const char *xpath_filter, const struct ly_ctx *ly_ctx, struct ly_set **mod_set)
Collect modules to subscribe to.
int srsn_read_dispatch_start(int fd, sr_conn_ctx_t *conn, srsn_notif_cb cb, void *cb_data)
Deprecated, came functionality as calling srsn_read_dispatch_init() and srsn_read_dispatch_add().
int srsn_poll(int fd, uint32_t timeout_ms)
Poll a file descriptor for data to read.
@ SRSN_YP_CHANGE_MOVE
@ SRSN_YP_CHANGE_REPLACE
@ SRSN_COUNT_YP_CHANGE
@ SRSN_YP_CHANGE_DELETE
@ SRSN_YP_CHANGE_INSERT
@ SRSN_YP_CHANGE_INVALID
@ SRSN_YP_CHANGE_CREATE
int srsn_yang_push_on_change_resync(uint32_t sub_id)
Resync a yang-push on-change subscription.
srsn_sub_type_t
Type of the subscribed-notifications subscription.
@ SRSN_YANG_PUSH_PERIODIC
@ SRSN_YANG_PUSH_ON_CHANGE
int srsn_read_dispatch_add(int fd, void *cb_data)
Add another subscription to be handled by the dispatched thread.
int srsn_yang_push_modify_on_change(uint32_t sub_id, uint32_t dampening_period_ms)
Modify a yang-push on-change subscription.
int srsn_oper_data_subscriptions(srsn_state_sub_t **subs, uint32_t *count)
Get subscription state data with most of the information in the subtree '/ietf-subscribed-notificatio...
int excluded_change[SRSN_COUNT_YP_CHANGE]
int srsn_subscribe(sr_session_ctx_t *session, const char *stream, const char *xpath_filter, const struct timespec *stop_time, const struct timespec *start_time, int sub_no_thread, sr_subscription_ctx_t **sub, struct timespec *replay_start_time, int *fd, uint32_t *sub_id)
Subscribe for receiving notifications according to 'ietf-subscribed-notifications' YANG.
int srsn_filter_subtree2xpath(const struct lyd_node *subtree, sr_session_ctx_t *session, char **xpath_filter)
Transform a subtree filter into an XPath filter.
uint32_t srsn_read_dispatch_count(void)
Get the number of subscriptions currently handled by the dispatched thread.
int srsn_modify_stop_time(uint32_t sub_id, const struct timespec *stop_time)
Modify a generic subscription stop-time.
int srsn_resume(uint32_t sub_id)
Resume a subscribed-notifications subscription.
int srsn_oper_data_streams_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)
Sysrepo sr_oper_get_items_cb() providing data of the subtree '/ietf-subscribed-notification:streams'.
int srsn_suspend(uint32_t sub_id, const char *reason)
Suspend a subscribed-notifications subscription.
void(* srsn_notif_cb)(const struct lyd_node *notif, const struct timespec *timestamp, void *cb_data)
Callback for reading notifications.
int srsn_terminate(uint32_t sub_id, const char *reason)
Terminate a subscribed-notifications subscription.
int srsn_read_notif(int fd, const struct ly_ctx *ly_ctx, struct timespec *timestamp, struct lyd_node **notif)
Read a notification.
int srsn_yang_push_on_change(sr_session_ctx_t *session, sr_datastore_t ds, const char *xpath_filter, uint32_t dampening_period_ms, int sync_on_start, int excluded_changes[SRSN_COUNT_YP_CHANGE], const struct timespec *stop_time, int sub_no_thread, sr_subscription_ctx_t **sub, int *fd, uint32_t *sub_id)
Subscribe for receiving notifications according to 'ietf-yang-push' YANG on-change subscriptions.
int srsn_yang_push_periodic(sr_session_ctx_t *session, sr_datastore_t ds, const char *xpath_filter, uint32_t period_ms, const struct timespec *anchor_time, const struct timespec *stop_time, int *fd, uint32_t *sub_id)
Subscribe for receiving notifications according to 'ietf-yang-push' YANG periodic subscriptions.
int srsn_read_dispatch_init(sr_conn_ctx_t *conn, srsn_notif_cb cb)
Init read dispatch for notifications, overwrites any previous parameters.
void srsn_oper_data_subscriptions_free(srsn_state_sub_t *subs, uint32_t count)
Free subscription state data.
int srsn_read_dispatch_destroy(void)
Stop the dispatched thread and clear all the used resources.
int srsn_oper_data_sub(uint32_t sub_id, srsn_state_sub_t **sub)
Get subscription state data of a single subscription.
public API sysrepo header
struct sr_session_ctx_s sr_session_ctx_t
Sysrepo session on a connection.
sr_datastore_t
Datastores that sysrepo supports. To change which datastore a session operates on,...