sysrepo  1.4.58
YANG datastore
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Notification Subscription API

Typedefs

typedef enum sr_ev_notif_type_e sr_ev_notif_type_t
 Type of the notification passed to the sr_event_notif_cb and sr_event_notif_tree_cb callbacks. More...
 
typedef void(* sr_event_notif_cb )(sr_session_ctx_t *session, const sr_ev_notif_type_t notif_type, const char *path, const sr_val_t *values, const size_t values_cnt, time_t timestamp, void *private_data)
 Callback to be called for the delivery of a notification. Data are represented as sr_val_t structures. More...
 
typedef void(* sr_event_notif_tree_cb )(sr_session_ctx_t *session, const sr_ev_notif_type_t notif_type, const struct lyd_node *notif, time_t timestamp, void *private_data)
 Callback to be called for the delivery of a notification. Data are represented as libyang subtrees. More...
 

Enumerations

enum  sr_ev_notif_type_e { SR_EV_NOTIF_REALTIME, SR_EV_NOTIF_REPLAY, SR_EV_NOTIF_REPLAY_COMPLETE, SR_EV_NOTIF_STOP }
 Type of the notification passed to the sr_event_notif_cb and sr_event_notif_tree_cb callbacks. More...
 

Functions

int sr_event_notif_subscribe (sr_session_ctx_t *session, const char *module_name, const char *xpath, time_t start_time, time_t stop_time, sr_event_notif_cb callback, void *private_data, sr_subscr_options_t opts, sr_subscription_ctx_t **subscription)
 Subscribe for the delivery of a notification(s). Data are represented as sr_val_t structures. More...
 
int sr_event_notif_subscribe_tree (sr_session_ctx_t *session, const char *module_name, const char *xpath, time_t start_time, time_t stop_time, sr_event_notif_tree_cb callback, void *private_data, sr_subscr_options_t opts, sr_subscription_ctx_t **subscription)
 Subscribes for the delivery of a notification(s). Data are represented as libyang subtrees. More...
 
int sr_event_notif_send (sr_session_ctx_t *session, const char *path, const sr_val_t *values, const size_t values_cnt)
 Send a notification. Data are represented as sr_val_t structures. In case there are particularly many notifications send on a session (100 notif/s or more) and all of them are stored for replay, consider using sr_session_notif_buffer(). More...
 
int sr_event_notif_send_tree (sr_session_ctx_t *session, struct lyd_node *notif)
 Send a notification. Data are represented as libyang subtrees. In case there are particularly many notifications send on a session (100 notif/s or more) and all of them are stored for replay, consider using sr_session_notif_buffer(). More...
 

Detailed Description

Typedef Documentation

Type of the notification passed to the sr_event_notif_cb and sr_event_notif_tree_cb callbacks.

typedef void(* sr_event_notif_cb)(sr_session_ctx_t *session, const sr_ev_notif_type_t notif_type, const char *path, const sr_val_t *values, const size_t values_cnt, time_t timestamp, void *private_data)

Callback to be called for the delivery of a notification. Data are represented as sr_val_t structures.

Note
Callback is allowed to modify installed YANG modules and subscriptions.
Parameters
[in]sessionImplicit session (do not stop) with information about the event originator session IDs.
[in]notif_typeType of the notification.
[in]pathPath identifying the event notification.
[in]valuesArray of all nodes that hold some data in event notification subtree.
[in]values_cntNumber of items inside the values array.
[in]timestampTime when the notification was generated
[in]private_dataPrivate context opaque to sysrepo, as passed to sr_event_notif_subscribe call.

Definition at line 1589 of file sysrepo.h.

typedef void(* sr_event_notif_tree_cb)(sr_session_ctx_t *session, const sr_ev_notif_type_t notif_type, const struct lyd_node *notif, time_t timestamp, void *private_data)

Callback to be called for the delivery of a notification. Data are represented as libyang subtrees.

Note
Callback is allowed to modify installed YANG modules and subscriptions.
Parameters
[in]sessionImplicit session (do not stop) with information about the event originator session IDs.
[in]notif_typeType of the notification.
[in]notifNotification data tree. Always points to the notification itself, even for nested ones.
[in]timestampTime when the notification was generated
[in]private_dataPrivate context opaque to sysrepo, as passed to sr_event_notif_subscribe_tree call.

Definition at line 1603 of file sysrepo.h.

Enumeration Type Documentation

Type of the notification passed to the sr_event_notif_cb and sr_event_notif_tree_cb callbacks.

Enumerator
SR_EV_NOTIF_REALTIME 

Real-time notification.

SR_EV_NOTIF_REPLAY 

Replayed notification.

SR_EV_NOTIF_REPLAY_COMPLETE 

Not a real notification, just a signal that the notification replay has completed (all the stored notifications from the given time interval have been delivered).

SR_EV_NOTIF_STOP 

Not a real notification, just a signal that replay stop time has been reached (delivered only if stop_time was specified when subscribing).

Definition at line 1566 of file sysrepo.h.

Function Documentation

int sr_event_notif_subscribe ( sr_session_ctx_t session,
const char *  module_name,
const char *  xpath,
time_t  start_time,
time_t  stop_time,
sr_event_notif_cb  callback,
void *  private_data,
sr_subscr_options_t  opts,
sr_subscription_ctx_t **  subscription 
)

Subscribe for the delivery of a notification(s). Data are represented as sr_val_t structures.

Required WRITE access.

Parameters
[in]sessionSession (not DS-specific) to use.
[in]module_nameName of the module whose notifications to subscribe to.
[in]xpathOptional XPath further filtering received notifications.
[in]start_timeOptional start time of the subscription. Used for replaying stored notifications.
[in]stop_timeOptional stop time ending the notification subscription.
[in]callbackCallback to be called when the event notification is delivered.
[in]private_dataPrivate context passed to the callback function, opaque to sysrepo.
[in]optsOptions overriding default behavior of the subscription, it is supposed to be a bitwise OR-ed value of any sr_subscr_flag_t flags.
[in,out]subscriptionSubscription context that is supposed to be released by sr_unsubscribe.
Note
An existing context may be passed in case that SR_SUBSCR_CTX_REUSE option is specified.
Returns
Error code (SR_ERR_OK on success).
int sr_event_notif_subscribe_tree ( sr_session_ctx_t session,
const char *  module_name,
const char *  xpath,
time_t  start_time,
time_t  stop_time,
sr_event_notif_tree_cb  callback,
void *  private_data,
sr_subscr_options_t  opts,
sr_subscription_ctx_t **  subscription 
)

Subscribes for the delivery of a notification(s). Data are represented as libyang subtrees.

Required WRITE access.

Parameters
[in]sessionSession (not DS-specific) to use.
[in]module_nameName of the module whose notifications to subscribe to.
[in]xpathOptional XPath further filtering received notifications.
[in]start_timeOptional start time of the subscription. Used for replaying stored notifications.
[in]stop_timeOptional stop time ending the notification subscription.
[in]callbackCallback to be called when the event notification is delivered.
[in]private_dataPrivate context passed to the callback function, opaque to sysrepo.
[in]optsOptions overriding default behavior of the subscription, it is supposed to be a bitwise OR-ed value of any sr_subscr_flag_t flags.
[in,out]subscriptionSubscription context that is supposed to be released by sr_unsubscribe.
Note
An existing context may be passed in case that SR_SUBSCR_CTX_REUSE option is specified.
Returns
Error code (SR_ERR_OK on success).
int sr_event_notif_send ( sr_session_ctx_t session,
const char *  path,
const sr_val_t values,
const size_t  values_cnt 
)

Send a notification. Data are represented as sr_val_t structures. In case there are particularly many notifications send on a session (100 notif/s or more) and all of them are stored for replay, consider using sr_session_notif_buffer().

Required WRITE access. If the module does not support replay, required READ access.

Note
Notification must be valid in (is validated against) the operational datastore context.
Parameters
[in]sessionSession (not DS-specific) to use.
[in]pathPath identifying the notification.
[in]valuesArray of all nodes that hold some data in event notification subtree (same as sr_get_items would return).
[in]values_cntNumber of items inside the values array.
Returns
Error code (SR_ERR_OK on success).
int sr_event_notif_send_tree ( sr_session_ctx_t session,
struct lyd_node *  notif 
)

Send a notification. Data are represented as libyang subtrees. In case there are particularly many notifications send on a session (100 notif/s or more) and all of them are stored for replay, consider using sr_session_notif_buffer().

Required WRITE access. If the module does not support replay, required READ access.

Note
Notification must be valid in (is validated against) the operational datastore context.
Parameters
[in]sessionSession (not DS-specific) to use.
[in]notifNotification data tree to send.
Returns
Error code (SR_ERR_OK on success).