sysrepo  2.12.0
YANG-based system repository for all-around configuration management.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sysrepo-plugind Plugin API

Macros

#define SRP_CLEANUP_CB   "sr_plugin_cleanup_cb"
 sysrepo-plugind plugin cleanup callback name that must exist in every plugin. More...
 
#define SRP_INIT_CB   "sr_plugin_init_cb"
 sysrepo-plugind plugin initialization callback name that must exist in every plugin. More...
 
#define SRPLG_LOG_DBG(plg_name,...)   srplg_log(plg_name, SR_LL_DBG, __VA_ARGS__)
 Log a plugin debug message with format arguments. More...
 
#define SRPLG_LOG_ERR(plg_name,...)   srplg_log(plg_name, SR_LL_ERR, __VA_ARGS__)
 Deprecated, use srplg_log_errinfo() instead. More...
 
#define SRPLG_LOG_INF(plg_name,...)   srplg_log(plg_name, SR_LL_INF, __VA_ARGS__)
 Log a plugin info message with format arguments. More...
 
#define SRPLG_LOG_WRN(plg_name,...)   srplg_log(plg_name, SR_LL_WRN, __VA_ARGS__)
 Log a plugin warning message with format arguments. More...
 

Functions

void srplg_errinfo_free (sr_error_info_t **err_info)
 Free a superfluous error info. More...
 
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 error data format name (which must be set prior to calling this function) identifier and can be read from the error structure by the originator using sr_get_error_data(). More...
 
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. More...
 

Detailed Description

Macro Definition Documentation

#define SRP_CLEANUP_CB   "sr_plugin_cleanup_cb"

sysrepo-plugind plugin cleanup callback name that must exist in every plugin.

The callback must be of srp_cleanup_cb_t type.

Definition at line 1794 of file sysrepo.h.

#define SRP_INIT_CB   "sr_plugin_init_cb"

sysrepo-plugind plugin initialization callback name that must exist in every plugin.

The callback must be of srp_init_cb_t type.

Definition at line 1787 of file sysrepo.h.

#define SRPLG_LOG_DBG (   plg_name,
  ... 
)    srplg_log(plg_name, SR_LL_DBG, __VA_ARGS__)

Log a plugin debug message with format arguments.

Parameters
[in]plg_namePlugin name to print.
[in]...Format string and arguments.

Definition at line 1857 of file sysrepo.h.

#define SRPLG_LOG_ERR (   plg_name,
  ... 
)    srplg_log(plg_name, SR_LL_ERR, __VA_ARGS__)

Deprecated, use srplg_log_errinfo() instead.

Definition at line 1833 of file sysrepo.h.

#define SRPLG_LOG_INF (   plg_name,
  ... 
)    srplg_log(plg_name, SR_LL_INF, __VA_ARGS__)

Log a plugin info message with format arguments.

Parameters
[in]plg_namePlugin name to print.
[in]...Format string and arguments.

Definition at line 1849 of file sysrepo.h.

#define SRPLG_LOG_WRN (   plg_name,
  ... 
)    srplg_log(plg_name, SR_LL_WRN, __VA_ARGS__)

Log a plugin warning message with format arguments.

Parameters
[in]plg_namePlugin name to print.
[in]...Format string and arguments.

Definition at line 1841 of file sysrepo.h.

Function Documentation

void srplg_errinfo_free ( sr_error_info_t **  err_info)

Free a superfluous error info.

Parameters
[in,out]err_infoError info to free, is set to NULL.
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 error data format name (which must be set prior to calling this function) identifier and can be read from the error structure by the originator using sr_get_error_data().

Parameters
[in]err_infoError info created by srplg_log_errinfo() with a specific error format name set. The last created error is being modified.
[in]sizeSize of the error data chunk.
[in]dataPointer to an opaque error data chunk.
Returns
Error code (SR_ERR_OK on success).
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,
  ... 
)

Log a plugin error message and add the error into an error info structure.

Parameters
[in,out]err_infoEmpty or an exisiting error info to add to.
[in]plg_namePlugin name to print.
[in]err_format_nameOptional arbitrary error format identifier, set its error data using srplg_errinfo_push_error_data(). More details in sr_session_set_error_format().
[in]err_codeError code of the error.
[in]formatError message format.
[in]...Error message format arguments.