sysrepo-plugins-common

sysrepo-plugins-common (SRPC)

sysrepo-plugins-common (opens in a new tab) is a helper static library used by all developed plugins. It provides common functionalites which can be needed at some point in the plugin. As an example, src/srpc/common.h header file can be looked at:

/**
 * Check wether the datastore contains any data or not based on the provided path to check.
 *
 * @param session Sysrepo session to the datastore to check.
 * @param path Path to the data for checking.
 * @param empty Boolean value to set.
 *
 * @return Error code - 0 on success.
 */
int srpc_check_empty_datastore(sr_session_ctx_t *session, const char *path, bool *empty);

For example, this function checks the path in the provided session datastore and sets the empty variable to true if the datastore data at the provided path is empty.

Follow the instructions in the README and install the library. When running CMake, set CMAKE_INSTALL_PREFIX to a path to libyang2 or libyang1 folder from the sysrepo-dev-env. In most cases, the libyang2 folder is used.

Documentation about CMAKE_INSTALL_PREFIX is available at https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html (opens in a new tab).

Some parts of the SRPC library will be explained later.