Loading...
Searching...
No Matches
sysrepo.h
Go to the documentation of this file.
#ifndef _SYSREPO_H
#define _SYSREPO_H
#include <stdint.h>
#include <stdlib.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include <libyang/libyang.h>
#include "sysrepo_types.h"
#ifdef __cplusplus
extern "C" {
#endif
// Logging API
const char *sr_strerror(int err_code);
void sr_log_stderr(sr_log_level_t log_level);
sr_log_level_t sr_log_get_stderr(void);
void sr_log_syslog(const char *app_name, sr_log_level_t log_level);
sr_log_level_t sr_log_get_syslog(void);
void sr_log_set_cb(sr_log_cb log_callback);
// Connection / Session Management
int sr_connect(const sr_conn_options_t opts, sr_conn_ctx_t **conn);
int sr_disconnect(sr_conn_ctx_t *conn);
const struct ly_ctx *sr_acquire_context(sr_conn_ctx_t *conn);
const struct ly_ctx *sr_session_acquire_context(sr_session_ctx_t *session);
void sr_release_context(sr_conn_ctx_t *conn);
void sr_session_release_context(sr_session_ctx_t *session);
uint32_t sr_get_content_id(sr_conn_ctx_t *conn);
int sr_get_plugins(sr_conn_ctx_t *conn, const char ***ds_plugins, const char ***ntf_plugins);
uid_t sr_get_su_uid(void);
sr_cid_t sr_get_cid(sr_conn_ctx_t *conn);
int sr_session_start(sr_conn_ctx_t *conn, const sr_datastore_t datastore, sr_session_ctx_t **session);
int sr_session_stop(sr_session_ctx_t *session);
int sr_session_unsubscribe(sr_session_ctx_t *session);
int sr_session_notif_buffer(sr_session_ctx_t *session);
int sr_session_switch_ds(sr_session_ctx_t *session, sr_datastore_t ds);
sr_datastore_t sr_session_get_ds(sr_session_ctx_t *session);
int sr_session_set_orig_name(sr_session_ctx_t *session, const char *orig_name);
const char *sr_session_get_orig_name(sr_session_ctx_t *session);
int sr_session_push_orig_data(sr_session_ctx_t *session, uint32_t size, const void *data);
void sr_session_del_orig_data(sr_session_ctx_t *session);
int sr_session_get_orig_data(sr_session_ctx_t *session, uint32_t idx, uint32_t *size, const void **data);
int sr_session_get_error(sr_session_ctx_t *session, const sr_error_info_t **error_info);
int sr_session_dup_error(sr_session_ctx_t *src_session, sr_session_ctx_t *trg_session);
int sr_session_set_error(sr_session_ctx_t *session, const char *err_format_name, sr_error_t err_code,
const char *err_msg_format, ...);
int sr_session_set_error_message(sr_session_ctx_t *session, const char *format, ...);
int sr_session_set_error_format(sr_session_ctx_t *session, const char *error_format);
int sr_session_push_error_data(sr_session_ctx_t *session, uint32_t size, const void *data);
int sr_get_error_data(const sr_error_info_err_t *err, uint32_t idx, uint32_t *size, const void **data);
uint32_t sr_session_get_id(sr_session_ctx_t *session);
int sr_session_set_user(sr_session_ctx_t *session, const char *user);
const char *sr_session_get_user(sr_session_ctx_t *session);
sr_conn_ctx_t *sr_session_get_connection(sr_session_ctx_t *session);
// Schema Manipulation API
const char *sr_get_repo_path(void);
const char *sr_get_shm_path(void);
const char *sr_get_shm_prefix(void);
int sr_install_module(sr_conn_ctx_t *conn, const char *schema_path, const char *search_dirs, const char **features);
const sr_module_ds_t *sr_get_module_ds_default(void);
int sr_install_module2(sr_conn_ctx_t *conn, const char *schema_path, const char *search_dirs, const char **features,
const sr_module_ds_t *module_ds, const char *owner, const char *group, mode_t perm, const char *data,
const char *data_path, LYD_FORMAT format);
int sr_install_modules(sr_conn_ctx_t *conn, const char **schema_paths, const char *search_dirs,
const char ***features);
int sr_install_modules2(sr_conn_ctx_t *conn, const sr_install_mod_t *modules, uint32_t module_count,
const char *search_dirs, const char *data, const char *data_path, LYD_FORMAT format);
int sr_remove_module(sr_conn_ctx_t *conn, const char *module_name, int force);
int sr_remove_modules(sr_conn_ctx_t *conn, const char **module_names, int force);
int sr_update_module(sr_conn_ctx_t *conn, const char *schema_path, const char *search_dirs);
int sr_update_modules(sr_conn_ctx_t *conn, const char **schema_paths, const char *search_dirs);
int sr_set_module_replay_support(sr_conn_ctx_t *conn, const char *module_name, int enable);
int sr_get_module_replay_support(sr_conn_ctx_t *conn, const char *module_name, struct timespec *earliest_notif,
int *enabled);
int sr_set_module_ds_access(sr_conn_ctx_t *conn, const char *module_name, int mod_ds, const char *owner,
const char *group, mode_t perm);
int sr_get_module_ds_access(sr_conn_ctx_t *conn, const char *module_name, int mod_ds, char **owner, char **group,
mode_t *perm);
int sr_check_module_ds_access(sr_conn_ctx_t *conn, const char *module_name, int mod_ds, int *read, int *write);
int sr_enable_module_feature(sr_conn_ctx_t *conn, const char *module_name, const char *feature_name);
int sr_disable_module_feature(sr_conn_ctx_t *conn, const char *module_name, const char *feature_name);
int sr_get_module_info(sr_conn_ctx_t *conn, sr_data_t **sysrepo_data);
int sr_is_module_internal(const struct lys_module *ly_mod);
// Data Retrieval API (get / get-config functionality)
int sr_get_item(sr_session_ctx_t *session, const char *path, uint32_t timeout_ms, sr_val_t **value);
int sr_get_items(sr_session_ctx_t *session, const char *xpath, uint32_t timeout_ms, const sr_get_options_t opts,
sr_val_t **values, size_t *value_cnt);
int sr_session_acquire_data(sr_session_ctx_t *session, struct lyd_node *tree, sr_data_t **data);
int sr_acquire_data(sr_conn_ctx_t *conn, struct lyd_node *tree, sr_data_t **data);
int sr_get_subtree(sr_session_ctx_t *session, const char *path, uint32_t timeout_ms, sr_data_t **subtree);
int sr_get_data(sr_session_ctx_t *session, const char *xpath, uint32_t max_depth, uint32_t timeout_ms,
const sr_get_options_t opts, sr_data_t **data);
int sr_get_node(sr_session_ctx_t *session, const char *path, uint32_t timeout_ms, sr_data_t **node);
void sr_release_data(sr_data_t *data);
void sr_free_val(sr_val_t *value);
void sr_free_values(sr_val_t *values, size_t count);
// Data Manipulation API (edit-config functionality)
int sr_set_item(sr_session_ctx_t *session, const char *path, const sr_val_t *value, const sr_edit_options_t opts);
int sr_set_item_str(sr_session_ctx_t *session, const char *path, const char *value, const char *origin,
const sr_edit_options_t opts);
int sr_delete_item(sr_session_ctx_t *session, const char *path, const sr_edit_options_t opts);
int sr_oper_delete_item_str(sr_session_ctx_t *session, const char *path, const char *value, const sr_edit_options_t opts);
int sr_discard_items(sr_session_ctx_t *session, const char *xpath);
int sr_delete_discard_items(sr_session_ctx_t *session, const char *xpath, const sr_edit_options_t opts);
int sr_move_item(sr_session_ctx_t *session, const char *path, const sr_move_position_t position, const char *list_keys,
const char *leaflist_value, const char *origin, const sr_edit_options_t opts);
int sr_edit_batch(sr_session_ctx_t *session, const struct lyd_node *edit, const char *default_operation);
int sr_validate(sr_session_ctx_t *session, const char *module_name, uint32_t timeout_ms);
int sr_apply_changes(sr_session_ctx_t *session, uint32_t timeout_ms);
int sr_has_changes(sr_session_ctx_t *session);
const struct lyd_node *sr_get_changes(sr_session_ctx_t *session);
int sr_discard_changes(sr_session_ctx_t *session);
int sr_discard_changes_xpath(sr_session_ctx_t *session, const char *xpath);
int sr_replace_config(sr_session_ctx_t *session, const char *module_name, struct lyd_node *src_config,
uint32_t timeout_ms);
int sr_copy_config(sr_session_ctx_t *session, const char *module_name, sr_datastore_t src_datastore, uint32_t timeout_ms);
int sr_discard_oper_changes(sr_conn_ctx_t *conn, sr_session_ctx_t *session, const char *module_name, uint32_t timeout_ms);
int sr_get_oper_changes(sr_session_ctx_t *session, const char *module_name, sr_data_t **data);
int sr_set_oper_changes_order(sr_session_ctx_t *session, const char *module_name, uint32_t order);
int sr_get_oper_changes_order(sr_session_ctx_t *session, const char *module_name, uint32_t *order);
// Locking API
int sr_lock(sr_session_ctx_t *session, const char *module_name, uint32_t timeout_ms);
int sr_unlock(sr_session_ctx_t *session, const char *module_name);
int sr_get_lock(sr_conn_ctx_t *conn, sr_datastore_t datastore, const char *module_name, int *is_locked, uint32_t *id,
struct timespec *timestamp);
// Subscription API
int sr_get_event_pipe(sr_subscription_ctx_t *subscription, int *event_pipe);
int sr_subscription_process_events(sr_subscription_ctx_t *subscription, sr_session_ctx_t *session,
struct timespec *wake_up_in);
uint32_t sr_subscription_get_last_sub_id(const sr_subscription_ctx_t *subscription);
int sr_subscription_get_suspended(sr_subscription_ctx_t *subscription, uint32_t sub_id, int *suspended);
int sr_subscription_suspend(sr_subscription_ctx_t *subscription, uint32_t sub_id);
int sr_subscription_resume(sr_subscription_ctx_t *subscription, uint32_t sub_id);
int sr_unsubscribe_sub(sr_subscription_ctx_t *subscription, uint32_t sub_id);
int sr_subscription_thread_suspend(sr_subscription_ctx_t *subscription);
int sr_subscription_thread_resume(sr_subscription_ctx_t *subscription);
int sr_subscription_thread_notify(sr_subscription_ctx_t *subscription);
int sr_unsubscribe(sr_subscription_ctx_t *subscription);
// Change Subscriptions API
int sr_module_change_set_order(sr_conn_ctx_t *conn, const char *module_name, sr_datastore_t ds, uint32_t priority);
int sr_module_change_get_order(sr_conn_ctx_t *conn, const char *module_name, sr_datastore_t ds, uint32_t *priority);
int sr_module_change_subscribe(sr_session_ctx_t *session, const char *module_name, const char *xpath,
sr_module_change_cb callback, void *private_data, uint32_t priority, sr_subscr_options_t opts,
sr_subscription_ctx_t **subscription);
int sr_module_change_sub_get_info(sr_subscription_ctx_t *subscription, uint32_t sub_id, const char **module_name,
sr_datastore_t *ds, const char **xpath, uint32_t *filtered_out);
int sr_module_change_sub_modify_xpath(sr_subscription_ctx_t *subscription, uint32_t sub_id, const char *xpath);
int sr_get_changes_iter(sr_session_ctx_t *session, const char *xpath, sr_change_iter_t **iter);
int sr_dup_changes_iter(sr_session_ctx_t *session, const char *xpath, sr_change_iter_t **iter);
int sr_get_change_next(sr_session_ctx_t *session, sr_change_iter_t *iter, sr_change_oper_t *operation,
sr_val_t **old_value, sr_val_t **new_value);
int sr_get_change_tree_next(sr_session_ctx_t *session, sr_change_iter_t *iter, sr_change_oper_t *operation,
const struct lyd_node **node, const char **prev_value, const char **prev_list, int *prev_dflt);
void sr_free_change_iter(sr_change_iter_t *iter);
const struct lyd_node *sr_get_change_diff(sr_session_ctx_t *session);
// RPC (Remote Procedure Calls) and Action API
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);
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);
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);
int sr_rpc_send_tree(sr_session_ctx_t *session, struct lyd_node *input, uint32_t timeout_ms, sr_data_t **output);
// Notifications API
int sr_notif_subscribe(sr_session_ctx_t *session, const char *module_name, const char *xpath,
const struct timespec *start_time, const struct timespec *stop_time, sr_event_notif_cb callback,
void *private_data, sr_subscr_options_t opts, sr_subscription_ctx_t **subscription);
int sr_notif_subscribe_tree(sr_session_ctx_t *session, const char *module_name, const char *xpath,
const struct timespec *start_time, const struct timespec *stop_time, sr_event_notif_tree_cb callback,
void *private_data, sr_subscr_options_t opts, sr_subscription_ctx_t **subscription);
int sr_notif_send(sr_session_ctx_t *session, const char *path, const sr_val_t *values, const size_t values_cnt,
uint32_t timeout_ms, int wait);
int sr_notif_send_tree(sr_session_ctx_t *session, struct lyd_node *notif, uint32_t timeout_ms, int wait);
int sr_notif_sub_get_info(sr_subscription_ctx_t *subscription, uint32_t sub_id, const char **module_name,
const char **xpath, struct timespec *start_time, struct timespec *stop_time, uint32_t *filtered_out);
int sr_notif_sub_modify_xpath(sr_subscription_ctx_t *subscription, uint32_t sub_id, const char *xpath);
int sr_notif_sub_modify_stop_time(sr_subscription_ctx_t *subscription, uint32_t sub_id, const struct timespec *stop_time);
// Operational Data API
int sr_oper_get_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);
int sr_oper_poll_subscribe(sr_session_ctx_t *session, const char *module_name, const char *path, uint32_t valid_ms,
sr_subscr_options_t opts, sr_subscription_ctx_t **subscription);
// sysrepo-plugind Plugin API
#define SRP_INIT_CB "sr_plugin_init_cb"
#define SRP_CLEANUP_CB "sr_plugin_cleanup_cb"
void srplg_log_errinfo(sr_error_info_t **err_info, const char *plg_name, const char *err_format_name,
sr_error_t err_code, const char *format, ...) _FORMAT_PRINTF(5, 6);
int srplg_errinfo_push_error_data(sr_error_info_t *err_info, uint32_t size, const void *data);
void srplg_errinfo_free(sr_error_info_t **err_info);
#define SRPLG_LOG_ERR(plg_name, ...) srplg_log(plg_name, SR_LL_ERR, __VA_ARGS__)
#define SRPLG_LOG_WRN(plg_name, ...) srplg_log(plg_name, SR_LL_WRN, __VA_ARGS__)
#define SRPLG_LOG_INF(plg_name, ...) srplg_log(plg_name, SR_LL_INF, __VA_ARGS__)
#define SRPLG_LOG_DBG(plg_name, ...) srplg_log(plg_name, SR_LL_DBG, __VA_ARGS__)
void srplg_log(const char *plg_name, sr_log_level_t ll, const char *format, ...) _FORMAT_PRINTF(3, 4);
#ifdef __cplusplus
}
#endif
#endif /* _SYSREPO_H */
sr_module_change_set_order
int sr_module_change_set_order(sr_conn_ctx_t *conn, const char *module_name, sr_datastore_t ds, uint32_t priority)
Change the global priority of modules being notified about their changes. The default priority of eve...
sr_module_change_sub_modify_xpath
int sr_module_change_sub_modify_xpath(sr_subscription_ctx_t *subscription, uint32_t sub_id, const char *xpath)
Modify an existing change subscription by changing its XPath filter.
sr_get_change_tree_next
int sr_get_change_tree_next(sr_session_ctx_t *session, sr_change_iter_t *iter, sr_change_oper_t *operation, const struct lyd_node **node, const char **prev_value, const char **prev_list, int *prev_dflt)
Returns the next change from the provided iterator created by sr_get_changes_iter call....
sr_change_oper_t
sr_change_oper_t
Type of the operation made on an item, used by changeset retrieval in sr_get_change_next.
Definition sysrepo_types.h:529
sr_get_change_diff
const struct lyd_node * sr_get_change_diff(sr_session_ctx_t *session)
Get the changes directly in the form of a diff in module-change callbacks. It cannot be used outside ...
sr_get_changes_iter
int sr_get_changes_iter(sr_session_ctx_t *session, const char *xpath, sr_change_iter_t **iter)
Create an iterator for retrieving the changes (list of newly added / removed / modified nodes) in mod...
sr_module_change_sub_get_info
int sr_module_change_sub_get_info(sr_subscription_ctx_t *subscription, uint32_t sub_id, const char **module_name, sr_datastore_t *ds, const char **xpath, uint32_t *filtered_out)
Get information about an existing change subscription.
sr_get_change_next
int sr_get_change_next(sr_session_ctx_t *session, sr_change_iter_t *iter, sr_change_oper_t *operation, sr_val_t **old_value, sr_val_t **new_value)
Return the next change from the provided iterator created by sr_get_changes_iter call....
sr_module_change_subscribe
int sr_module_change_subscribe(sr_session_ctx_t *session, const char *module_name, const char *xpath, sr_module_change_cb callback, void *private_data, uint32_t priority, sr_subscr_options_t opts, sr_subscription_ctx_t **subscription)
Subscribe for changes made in the specified module.
sr_change_iter_t
struct sr_change_iter_s sr_change_iter_t
Iterator used for retrieval of a changeset using sr_get_changes_iter call.
Definition sysrepo_types.h:539
sr_module_change_get_order
int sr_module_change_get_order(sr_conn_ctx_t *conn, const char *module_name, sr_datastore_t ds, uint32_t *priority)
Get the current global priority of change subscriptions of a module.
sr_dup_changes_iter
int sr_dup_changes_iter(sr_session_ctx_t *session, const char *xpath, sr_change_iter_t **iter)
Create an iterator for retrieving the changes (list of newly added / removed / modified nodes) in mod...
sr_module_change_cb
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.
Definition sysrepo_types.h:556
sr_free_change_iter
void sr_free_change_iter(sr_change_iter_t *iter)
Frees sr_change_iter_t iterator and all memory allocated within it.
sr_session_set_orig_name
int sr_session_set_orig_name(sr_session_ctx_t *session, const char *orig_name)
Set event originator name used for all events sent on this session. It can then be read from the impl...
sr_session_set_error_message
int sr_session_set_error_message(sr_session_ctx_t *session, const char *format,...)
Deprecated, use sr_session_set_error().
sr_session_switch_ds
int sr_session_switch_ds(sr_session_ctx_t *session, sr_datastore_t ds)
Change datastore which the session operates on. All subsequent calls will be issued on the chosen dat...
sr_session_push_error_data
int sr_session_push_error_data(sr_session_ctx_t *session, uint32_t size, const void *data)
Push (add) another chunk of error data for a failed callback communicated back to the originator....
sr_release_context
void sr_release_context(sr_conn_ctx_t *conn)
Release libyang context obtained from a session/connection.
sr_session_release_context
void sr_session_release_context(sr_session_ctx_t *session)
Release libyang context obtained from a session/connection.
sr_session_push_orig_data
int sr_session_push_orig_data(sr_session_ctx_t *session, uint32_t size, const void *data)
Push (add) another chunk of event originator data used for all events sent on this session....
sr_get_su_uid
uid_t sr_get_su_uid(void)
Get the sysrepo SUPERUSER UID.
sr_disconnect
int sr_disconnect(sr_conn_ctx_t *conn)
Disconnect from the sysrepo datastore.
sr_session_unsubscribe
int sr_session_unsubscribe(sr_session_ctx_t *session)
Unsubscribe all subscriptions created by this session.
sr_session_get_orig_data
int sr_session_get_orig_data(sr_session_ctx_t *session, uint32_t idx, uint32_t *size, const void **data)
Get a specific chunk of event originator data in a callback.
sr_session_get_orig_name
const char * sr_session_get_orig_name(sr_session_ctx_t *session)
Get event originator name.
sr_session_stop
int sr_session_stop(sr_session_ctx_t *session)
Stop the session and releases resources tied to it.
sr_connect
int sr_connect(const sr_conn_options_t opts, sr_conn_ctx_t **conn)
Connects to the sysrepo datastore.
sr_get_cid
sr_cid_t sr_get_cid(sr_conn_ctx_t *conn)
Get the connection ID.
sr_session_set_user
int sr_session_set_user(sr_session_ctx_t *session, const char *user)
Set the effective user of a session to a different one than the process owner.
sr_session_start
int sr_session_start(sr_conn_ctx_t *conn, const sr_datastore_t datastore, sr_session_ctx_t **session)
Start a new session.
sr_session_set_error
int sr_session_set_error(sr_session_ctx_t *session, const char *err_format_name, sr_error_t err_code, const char *err_msg_format,...)
Set an error for a failed callback communicated back to the originator. Does not print the message.
sr_session_acquire_context
const struct ly_ctx * sr_session_acquire_context(sr_session_ctx_t *session)
Get the libyang context used by a connection. Can be used in an application for working with data and...
sr_session_get_ds
sr_datastore_t sr_session_get_ds(sr_session_ctx_t *session)
Learn the datastore a session operates on.
sr_acquire_context
const struct ly_ctx * sr_acquire_context(sr_conn_ctx_t *conn)
Get the libyang context used by a connection. Can be used in an application for working with data and...
sr_session_get_error
int sr_session_get_error(sr_session_ctx_t *session, const sr_error_info_t **error_info)
Retrieve information about the error that has occurred during the last operation executed within prov...
sr_session_get_id
uint32_t sr_session_get_id(sr_session_ctx_t *session)
Return the assigned session ID of the sysrepo session.
sr_get_error_data
int sr_get_error_data(const sr_error_info_err_t *err, uint32_t idx, uint32_t *size, const void **data)
Get a specific chunk of error data.
sr_session_set_error_format
int sr_session_set_error_format(sr_session_ctx_t *session, const char *error_format)
Deprecated, use sr_session_set_error().
sr_session_del_orig_data
void sr_session_del_orig_data(sr_session_ctx_t *session)
Remove all pushed event originator data.
sr_session_notif_buffer
int sr_session_notif_buffer(sr_session_ctx_t *session)
Use notification buffering for the session.
sr_conn_ctx_t
struct sr_conn_ctx_s sr_conn_ctx_t
Sysrepo connection.
Definition sysrepo_types.h:89
sr_get_plugins
int sr_get_plugins(sr_conn_ctx_t *conn, const char ***ds_plugins, const char ***ntf_plugins)
Get loaded plugins of a connection.
sr_session_dup_error
int sr_session_dup_error(sr_session_ctx_t *src_session, sr_session_ctx_t *trg_session)
Copy the first error (if any) from a session to a callback session.
sr_session_get_user
const char * sr_session_get_user(sr_session_ctx_t *session)
Get the effective user of a session.
sr_session_get_connection
sr_conn_ctx_t * sr_session_get_connection(sr_session_ctx_t *session)
Get the connection the session was created on.
sr_get_content_id
uint32_t sr_get_content_id(sr_conn_ctx_t *conn)
Get content ID of the current YANG module set. It conforms to the requirements for ietf-yang-library ...
sr_move_item
int sr_move_item(sr_session_ctx_t *session, const char *path, const sr_move_position_t position, const char *list_keys, const char *leaflist_value, const char *origin, const sr_edit_options_t opts)
Prepare to move/create the instance of an user-ordered list or leaf-list to the specified position....
sr_validate
int sr_validate(sr_session_ctx_t *session, const char *module_name, uint32_t timeout_ms)
Perform the validation a datastore and any changes made in the current session, but do not apply nor ...
sr_copy_config
int sr_copy_config(sr_session_ctx_t *session, const char *module_name, sr_datastore_t src_datastore, uint32_t timeout_ms)
Replaces a conventional datastore with the contents of another conventional datastore....
sr_set_item_str
int sr_set_item_str(sr_session_ctx_t *session, const char *path, const char *value, const char *origin, const sr_edit_options_t opts)
Prepare to set (create) the value of a leaf, leaf-list, list, or presence container....
sr_replace_config
int sr_replace_config(sr_session_ctx_t *session, const char *module_name, struct lyd_node *src_config, uint32_t timeout_ms)
Replace a datastore with the contents of a data tree. If the module is specified, limit the operation...
sr_discard_items
int sr_discard_items(sr_session_ctx_t *session, const char *xpath)
Prepare to discard nodes matching the specified xpath in the operational datastore before applying th...
sr_move_position_t
sr_move_position_t
Options for specifying move direction of sr_move_item call.
Definition sysrepo_types.h:366
sr_discard_oper_changes
int sr_discard_oper_changes(sr_conn_ctx_t *conn, sr_session_ctx_t *session, const char *module_name, uint32_t timeout_ms)
Discard push operational changes of a module for a session.
sr_set_oper_changes_order
int sr_set_oper_changes_order(sr_session_ctx_t *session, const char *module_name, uint32_t order)
Set explicit push operational changes order determining when they are applied relative to other sessi...
sr_edit_batch
int sr_edit_batch(sr_session_ctx_t *session, const struct lyd_node *edit, const char *default_operation)
Provide a prepared edit data tree to be applied. These changes are applied only after calling sr_appl...
sr_delete_item
int sr_delete_item(sr_session_ctx_t *session, const char *path, const sr_edit_options_t opts)
Prepare to delete the nodes matching the specified xpath. These changes are applied only after callin...
sr_get_changes
const struct lyd_node * sr_get_changes(sr_session_ctx_t *session)
Retrieve stored changes (prepared, not yet applied).
sr_get_oper_changes_order
int sr_get_oper_changes_order(sr_session_ctx_t *session, const char *module_name, uint32_t *order)
Get push operational changes order determining when they are applied relative to other sessions for t...
sr_discard_changes_xpath
int sr_discard_changes_xpath(sr_session_ctx_t *session, const char *xpath)
Discard prepared changes made in the current session matching an XPath expression.
sr_discard_changes
int sr_discard_changes(sr_session_ctx_t *session)
Discard prepared changes made in the current session.
sr_set_item
int sr_set_item(sr_session_ctx_t *session, const char *path, const sr_val_t *value, const sr_edit_options_t opts)
Prepare to set (create) the value of a leaf, leaf-list, list, or presence container....
sr_has_changes
int sr_has_changes(sr_session_ctx_t *session)
Learn whether there are any prepared non-applied changes in the session.
sr_edit_options_t
uint32_t sr_edit_options_t
Options overriding default behavior of data manipulation calls, it is supposed to be bitwise OR-ed va...
Definition sysrepo_types.h:361
sr_oper_delete_item_str
int sr_oper_delete_item_str(sr_session_ctx_t *session, const char *path, const char *value, const sr_edit_options_t opts)
Deprecated, not supported.
sr_apply_changes
int sr_apply_changes(sr_session_ctx_t *session, uint32_t timeout_ms)
Apply changes made in the current session. In case the changes could not be applied successfully for ...
sr_get_oper_changes
int sr_get_oper_changes(sr_session_ctx_t *session, const char *module_name, sr_data_t **data)
Get stored push operational changes of a session.
sr_delete_discard_items
int sr_delete_discard_items(sr_session_ctx_t *session, const char *xpath, const sr_edit_options_t opts)
Remove a 'discard-items' node from a push oper data of a session. Usable only for SR_DS_OPERATIONAL d...
sr_data_t
Structure that safely wraps libyang data and prevents unexpected context changes.
Definition sysrepo_types.h:200
sr_free_val
void sr_free_val(sr_val_t *value)
Free sr_val_t structure and all memory allocated within it.
sr_get_items
int sr_get_items(sr_session_ctx_t *session, const char *xpath, uint32_t timeout_ms, const sr_get_options_t opts, sr_val_t **values, size_t *value_cnt)
Retrieve an array of data elements selected by the provided XPath. Data are represented as sr_val_t s...
sr_get_data
int sr_get_data(sr_session_ctx_t *session, const char *xpath, uint32_t max_depth, uint32_t timeout_ms, const sr_get_options_t opts, sr_data_t **data)
Retrieve a tree whose root nodes match the provided XPath. Data are represented as libyang subtrees.
sr_free_values
void sr_free_values(sr_val_t *values, size_t count)
Free array of sr_val_t structures (and all memory allocated within of each array element).
sr_get_item
int sr_get_item(sr_session_ctx_t *session, const char *path, uint32_t timeout_ms, sr_val_t **value)
Retrieve a single data element selected by the provided path. Data are represented as sr_val_t struct...
sr_session_acquire_data
int sr_session_acquire_data(sr_session_ctx_t *session, struct lyd_node *tree, sr_data_t **data)
Acquire libyang data tree together with its context lock in a SR data structure.
sr_get_subtree
int sr_get_subtree(sr_session_ctx_t *session, const char *path, uint32_t timeout_ms, sr_data_t **subtree)
Retrieve a single subtree whose root node is selected by the provided path. Data are represented as l...
sr_release_data
void sr_release_data(sr_data_t *data)
Release SR data structure, whoch consists of freeing the data tree, releasing the context,...
sr_acquire_data
int sr_acquire_data(sr_conn_ctx_t *conn, struct lyd_node *tree, sr_data_t **data)
Acquire libyang data tree together with its context lock in a SR data structure.
sr_get_node
int sr_get_node(sr_session_ctx_t *session, const char *path, uint32_t timeout_ms, sr_data_t **node)
Retrieve a single value matching the provided XPath. Data are represented as a single libyang node.
sr_lock
int sr_lock(sr_session_ctx_t *session, const char *module_name, uint32_t timeout_ms)
Locks the data of the specified module or the whole datastore.
sr_unlock
int sr_unlock(sr_session_ctx_t *session, const char *module_name)
Unlocks the data of the specified module or the whole datastore.
sr_get_lock
int sr_get_lock(sr_conn_ctx_t *conn, sr_datastore_t datastore, const char *module_name, int *is_locked, uint32_t *id, struct timespec *timestamp)
Check whether the data of the specified module or the whole datastore are locked.
sr_log_syslog
void sr_log_syslog(const char *app_name, sr_log_level_t log_level)
Enables / disables / changes log level (verbosity) of logging to system log.
sr_log_set_cb
void sr_log_set_cb(sr_log_cb log_callback)
Sets callback that will be called when a log entry would be populated. Callback will be called for ev...
sr_error_t
sr_error_t
Sysrepo error codes.
Definition sysrepo_types.h:40
sr_log_stderr
void sr_log_stderr(sr_log_level_t log_level)
Enables / disables / changes log level (verbosity) of logging to standard error output.
sr_log_cb
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.
Definition sysrepo_types.h:77
sr_strerror
const char * sr_strerror(int err_code)
Returns the error message corresponding to the error code.
sr_log_get_stderr
sr_log_level_t sr_log_get_stderr(void)
Learn current standard error output log level.
sr_log_get_syslog
sr_log_level_t sr_log_get_syslog(void)
Learn current system log log level.
sr_log_level_t
sr_log_level_t
Log levels used to determine if message of certain severity should be printed.
Definition sysrepo_types.h:63
sr_notif_send
int sr_notif_send(sr_session_ctx_t *session, const char *path, const sr_val_t *values, const size_t values_cnt, uint32_t timeout_ms, int wait)
Send a notification. Data are represented as sr_val_t structures. In case there are particularly many...
sr_notif_sub_get_info
int sr_notif_sub_get_info(sr_subscription_ctx_t *subscription, uint32_t sub_id, const char **module_name, const char **xpath, struct timespec *start_time, struct timespec *stop_time, uint32_t *filtered_out)
Get information about an existing notification subscription.
sr_event_notif_cb
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...
Definition sysrepo_types.h:646
sr_notif_sub_modify_xpath
int sr_notif_sub_modify_xpath(sr_subscription_ctx_t *subscription, uint32_t sub_id, const char *xpath)
Modify an existing notification subscription by changing its XPath filter. Special SR_EV_NOTIF_MODIFI...
sr_event_notif_tree_cb
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.
Definition sysrepo_types.h:661
sr_notif_subscribe_tree
int sr_notif_subscribe_tree(sr_session_ctx_t *session, const char *module_name, const char *xpath, const struct timespec *start_time, const struct timespec *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.
sr_notif_sub_modify_stop_time
int sr_notif_sub_modify_stop_time(sr_subscription_ctx_t *subscription, uint32_t sub_id, const struct timespec *stop_time)
Modify an existing notification subscription by changing its stop time. Special SR_EV_NOTIF_MODIFIED ...
sr_notif_subscribe
int sr_notif_subscribe(sr_session_ctx_t *session, const char *module_name, const char *xpath, const struct timespec *start_time, const struct timespec *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.
sr_notif_send_tree
int sr_notif_send_tree(sr_session_ctx_t *session, struct lyd_node *notif, uint32_t timeout_ms, int wait)
Send a notification. Data are represented as libyang subtrees. In case there are particularly many no...
sr_oper_get_items_cb
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...
Definition sysrepo_types.h:696
sr_oper_poll_subscribe
int sr_oper_poll_subscribe(sr_session_ctx_t *session, const char *module_name, const char *path, uint32_t valid_ms, sr_subscr_options_t opts, sr_subscription_ctx_t **subscription)
Start periodic retrieval and caching of operational data at the given path.
sr_oper_get_subscribe
int sr_oper_get_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 path.
sr_rpc_send_tree
int sr_rpc_send_tree(sr_session_ctx_t *session, struct lyd_node *input, uint32_t timeout_ms, sr_data_t **output)
Send an RPC/action and wait for the result. Data are represented as libyang subtrees.
sr_rpc_subscribe
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.
sr_rpc_send
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.
sr_rpc_cb
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.
Definition sysrepo_types.h:584
sr_rpc_tree_cb
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.
Definition sysrepo_types.h:603
sr_rpc_subscribe_tree
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.
sr_check_module_ds_access
int sr_check_module_ds_access(sr_conn_ctx_t *conn, const char *module_name, int mod_ds, int *read, int *write)
Check whether the current application has read/write access to a module.
sr_install_module2
int sr_install_module2(sr_conn_ctx_t *conn, const char *schema_path, const char *search_dirs, const char **features, const sr_module_ds_t *module_ds, const char *owner, const char *group, mode_t perm, const char *data, const char *data_path, LYD_FORMAT format)
Install a new schema (module) into sysrepo with all the available options.
sr_update_module
int sr_update_module(sr_conn_ctx_t *conn, const char *schema_path, const char *search_dirs)
Update an installed schema (module) to a new revision.
sr_enable_module_feature
int sr_enable_module_feature(sr_conn_ctx_t *conn, const char *module_name, const char *feature_name)
Enable a module feature.
sr_get_module_ds_default
const sr_module_ds_t * sr_get_module_ds_default(void)
Get the default datastore plugins.
sr_install_modules2
int sr_install_modules2(sr_conn_ctx_t *conn, const sr_install_mod_t *modules, uint32_t module_count, const char *search_dirs, const char *data, const char *data_path, LYD_FORMAT format)
Install new schemas (modules) into sysrepo in a batch with all the available options.
sr_get_module_ds_access
int sr_get_module_ds_access(sr_conn_ctx_t *conn, const char *module_name, int mod_ds, char **owner, char **group, mode_t *perm)
Learn about module permissions.
sr_disable_module_feature
int sr_disable_module_feature(sr_conn_ctx_t *conn, const char *module_name, const char *feature_name)
Disable a module feature.
sr_get_module_replay_support
int sr_get_module_replay_support(sr_conn_ctx_t *conn, const char *module_name, struct timespec *earliest_notif, int *enabled)
Learn replay support of a module.
sr_remove_module
int sr_remove_module(sr_conn_ctx_t *conn, const char *module_name, int force)
Remove an installed module from sysrepo.
sr_is_module_internal
int sr_is_module_internal(const struct lys_module *ly_mod)
Check whether a module is an internal libyang or sysrepo module. Evaluates to true for all the module...
sr_get_shm_prefix
const char * sr_get_shm_prefix(void)
Get the common SHM file prefix prepended to all SHM files.
sr_get_repo_path
const char * sr_get_repo_path(void)
Get the path (directory) for all persistent sysrepo files.
sr_set_module_replay_support
int sr_set_module_replay_support(sr_conn_ctx_t *conn, const char *module_name, int enable)
Change module replay support.
sr_install_modules
int sr_install_modules(sr_conn_ctx_t *conn, const char **schema_paths, const char *search_dirs, const char ***features)
Install new schemas (modules) into sysrepo in a batch.
sr_get_module_info
int sr_get_module_info(sr_conn_ctx_t *conn, sr_data_t **sysrepo_data)
Get internal sysrepo data tree, which holds detailed information about installed modules....
sr_remove_modules
int sr_remove_modules(sr_conn_ctx_t *conn, const char **module_names, int force)
Remove installed modules from sysrepo.
sr_update_modules
int sr_update_modules(sr_conn_ctx_t *conn, const char **schema_paths, const char *search_dirs)
Update installed schemas (modules) to new revisions in a batch.
sr_set_module_ds_access
int sr_set_module_ds_access(sr_conn_ctx_t *conn, const char *module_name, int mod_ds, const char *owner, const char *group, mode_t perm)
Change module permissions.
sr_get_shm_path
const char * sr_get_shm_path(void)
Get the path (directory) for all volatile sysrepo files, created as SHM files.
sr_install_module
int sr_install_module(sr_conn_ctx_t *conn, const char *schema_path, const char *search_dirs, const char **features)
Install a new schema (module) into sysrepo.
srplg_errinfo_push_error_data
void int srplg_errinfo_push_error_data(sr_error_info_t *err_info, uint32_t size, const void *data)
Push (add) another chunk of error data for a failed plugin callback. Its meaning is specific to the e...
srplg_log_errinfo
void srplg_log_errinfo(sr_error_info_t **err_info, const char *plg_name, const char *err_format_name, sr_error_t err_code, const char *format,...) _FORMAT_PRINTF(5
Log a plugin error message and add the error into an error info structure.
srplg_errinfo_free
void srplg_errinfo_free(sr_error_info_t **err_info)
Free a superfluous error info.
sr_subscription_thread_notify
int sr_subscription_thread_notify(sr_subscription_ctx_t *subscription)
Notify (wake up) a subscription thread signalling there is a new event to process....
sr_subscription_process_events
int sr_subscription_process_events(sr_subscription_ctx_t *subscription, sr_session_ctx_t *session, struct timespec *wake_up_in)
Process any pending new events on a subscription. Should not be called unless SR_SUBSCR_NO_THREAD fla...
sr_subscription_suspend
int sr_subscription_suspend(sr_subscription_ctx_t *subscription, uint32_t sub_id)
Suspend a specific subscription. Special SR_EV_NOTIF_SUSPENDED notification is delivered for suspende...
sr_unsubscribe_sub
int sr_unsubscribe_sub(sr_subscription_ctx_t *subscription, uint32_t sub_id)
Unsubscribe a specific or all the subscriptions in a subscription structure.
sr_subscription_resume
int sr_subscription_resume(sr_subscription_ctx_t *subscription, uint32_t sub_id)
Resume a previously suspended subscription. Special SR_EV_NOTIF_RESUMED notification is delivered for...
sr_subscription_get_suspended
int sr_subscription_get_suspended(sr_subscription_ctx_t *subscription, uint32_t sub_id, int *suspended)
Learn the suspend state of a specific subscription.
sr_unsubscribe
int sr_unsubscribe(sr_subscription_ctx_t *subscription)
Unsubscribe all the subscriptions in a subscription structure and free it.
sr_subscription_get_last_sub_id
uint32_t sr_subscription_get_last_sub_id(const sr_subscription_ctx_t *subscription)
Get the subscription ID of the last created subscription.
sr_subscr_options_t
uint32_t sr_subscr_options_t
Options overriding default behavior of subscriptions, it is supposed to be a bitwise OR-ed value of a...
Definition sysrepo_types.h:485
sr_subscription_thread_suspend
int sr_subscription_thread_suspend(sr_subscription_ctx_t *subscription)
Suspend the default handler thread of a subscription structure. Meaning it will stop handling any eve...
sr_subscription_ctx_t
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...
Definition sysrepo_types.h:479
sr_get_event_pipe
int sr_get_event_pipe(sr_subscription_ctx_t *subscription, int *event_pipe)
Get the event pipe of a subscription. Do not call unless SR_SUBSCR_NO_THREAD flag was used when subsc...
sr_subscription_thread_resume
int sr_subscription_thread_resume(sr_subscription_ctx_t *subscription)
Resume the default handler thread of a subscription structure that was suspended previously.
srplg_log
void srplg_log(const char *plg_name, sr_log_level_t ll, const char *format,...) _FORMAT_PRINTF(3
sysrepo_types.h
public sysrepo types header
sr_session_ctx_t
struct sr_session_ctx_s sr_session_ctx_t
Sysrepo session on a connection.
Definition sysrepo_types.h:99
sr_conn_options_t
uint32_t sr_conn_options_t
Options overriding default connection handling by sr_connect call, it is supposed to be bitwise OR-ed...
Definition sysrepo_types.h:115
sr_cid_t
uint32_t sr_cid_t
Connection ID.
Definition sysrepo_types.h:94
sr_get_options_t
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...
Definition sysrepo_types.h:332
sr_datastore_t
sr_datastore_t
Datastores that sysrepo supports. To change which datastore a session operates on,...
Definition sysrepo_types.h:121
sr_module_ds_t
Custom datastore implementation config for each datastore and notifications of a module.
Definition sysrepo_types.h:152
sr_install_mod_t
Information about a module to be installed.
Definition sysrepo_types.h:177
sr_val_t
Structure that contains value of an data element stored in the sysrepo datastore.
Definition sysrepo_types.h:272
sr_error_info_err_t
A single, detailed error message. Used in sr_error_info_t.
Definition sysrepo_types.h:159
sr_error_info_t
Detailed sysrepo session error information.
Definition sysrepo_types.h:169