sysrepo  1.4.70
YANG datastore
RPC/Action Subscription API

Typedefs

typedef int(* sr_rpc_cb) (sr_session_ctx_t *session, 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. More...
 
typedef int(* sr_rpc_tree_cb) (sr_session_ctx_t *session, 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. More...
 

Functions

int sr_rpc_subscribe (sr_session_ctx_t *session, const char *xpath, sr_rpc_cb callback, void *private_data, uint32_t priority, sr_subscr_options_t opts, sr_subscription_ctx_t **subscription)
 Subscribe for the delivery of an RPC/action. Data are represented as sr_val_t structures. More...
 
int sr_rpc_subscribe_tree (sr_session_ctx_t *session, const char *xpath, sr_rpc_tree_cb callback, void *private_data, uint32_t priority, sr_subscr_options_t opts, sr_subscription_ctx_t **subscription)
 Subscribe for the delivery of an RPC/action. Data are represented as libyang subtrees. More...
 
int sr_rpc_send (sr_session_ctx_t *session, const char *path, const sr_val_t *input, const size_t input_cnt, uint32_t timeout_ms, sr_val_t **output, size_t *output_cnt)
 Send an RPC/action and wait for the result. Data are represented as sr_val_t structures. More...
 
int sr_rpc_send_tree (sr_session_ctx_t *session, struct lyd_node *input, uint32_t timeout_ms, struct lyd_node **output)
 Send an RPC/action and wait for the result. Data are represented as libyang subtrees. More...
 

Detailed Description

Typedef Documentation

◆ sr_rpc_cb

typedef int(* sr_rpc_cb) (sr_session_ctx_t *session, 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.

Note
Callback is allowed to modify installed YANG modules but MUST not modify subscriptions. It would result in a deadlock and this callback timeout (unless SR_SUBSCR_UNLOCKED is used when subscribing).
Parameters
[in]sessionImplicit session (do not stop) with information about event originator session IDs.
[in]xpathFull operation xpath identifying the exact RPC/action executed.
[in]inputArray of input parameters.
[in]input_cntNumber of input parameters.
[in]eventType of the callback event that has occurred.
[in]request_idRequest ID unique for the specific op_path.
[out]outputArray of output parameters. Should be allocated on heap, will be freed by sysrepo after sending of the RPC response.
[out]output_cntNumber of output parameters.
[in]private_dataPrivate context opaque to sysrepo, as passed to sr_rpc_subscribe call.
Returns
User error code (SR_ERR_OK on success).

Definition at line 1462 of file sysrepo.h.

◆ sr_rpc_tree_cb

typedef int(* sr_rpc_tree_cb) (sr_session_ctx_t *session, 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.

Note
Callback is allowed to modify installed YANG modules but MUST not modify subscriptions. It would result in a deadlock and this callback timeout (unless SR_SUBSCR_UNLOCKED is used when subscribing).
Parameters
[in]sessionImplicit session (do not stop) with information about the event originator session IDs.
[in]op_pathSimple operation path identifying the RPC/action.
[in]inputData tree of input parameters. Always points to the RPC/action itself, even for nested operations.
[in]eventType of the callback event that has occurred.
[in]request_idRequest ID unique for the specific op_path.
[out]outputData tree of output parameters. Should be allocated on heap, will be freed by sysrepo after sending of the RPC response.
[in]private_dataPrivate context opaque to sysrepo, as passed to sr_rpc_subscribe_tree call.
Returns
User error code (