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

Typedefs

typedef int(* sr_oper_get_items_cb )(sr_session_ctx_t *session, 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 as libyang subtrees. More...
 

Functions

int sr_oper_get_items_subscribe (sr_session_ctx_t *session, const char *module_name, const char *path, sr_oper_get_items_cb callback, void *private_data, sr_subscr_options_t opts, sr_subscription_ctx_t **subscription)
 Register for providing operational data at the given xpath. More...
 

Detailed Description

Typedef Documentation

typedef int(* sr_oper_get_items_cb)(sr_session_ctx_t *session, 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 as libyang subtrees.

When the callback is called, the data parent is provided. Any parent children (selected by path) are removed and should be provided by the callback instead, if they exist. Callback handler can provide any data matching the path but in case there are other nested subscriptions, they will be called after this one (and when they are called, their parent children will again be removed which can result in nodes provided by the original callback being lost).

Note
Callback is allowed to modify installed YANG modules but MUST not modify subscriptions. It would result in a deadlock and this callback timeout.
Parameters
[in]sessionImplicit session (do not stop) with information about the event originator session IDs.
[in]module_nameName of the affected module.
[in]pathPath identifying the subtree that is supposed to be provided, same as the one used for the subscription.
[in]request_xpathXPath as requested by a client. Can be NULL.
[in]request_idRequest ID unique for the specific module_name.
[in,out]parentPointer to an existing parent of the requested nodes. Is NULL for top-level nodes. Caller is supposed to append the requested nodes to this data subtree and return either the original parent or a top-level node.
[in]private_dataPrivate context opaque to sysrepo, as passed to sr_oper_get_items_subscribe call.
Returns
User error code (SR_ERR_OK on success).

Definition at line 1719 of file sysrepo.h.

Function Documentation

int sr_oper_get_items_subscribe ( sr_session_ctx_t session,
const char *  module_name,
const char *  path,
sr_oper_get_items_cb  callback,
void *  private_data,
sr_subscr_options_t  opts,
sr_subscription_ctx_t **  subscription 
)

Register for providing operational data at the given xpath.

Required WRITE access.

Parameters
[in]sessionSession (not DS-specific) to use.
[in]module_nameName of the affected module.
[in]pathPath identifying the subtree which the provider is able to provide. Predicates can be used to provide only specific instances of nodes. Before calling this callback, any existing data matching this path are deleted.
[in]callbackCallback to be called when the operational data for the given xpath are requested.
[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.
Returns
Error code (SR_ERR_OK on success).