![]() |
libnetconf
0.10.0-146_trunk
NETCONF Library
|
libnetconf's miscellaneous functions. More...
Enumerations | |
enum | NC_MSG_TYPE { NC_MSG_UNKNOWN, NC_MSG_WOULDBLOCK, NC_MSG_NONE, NC_MSG_HELLO, NC_MSG_RPC, NC_MSG_REPLY, NC_MSG_NOTIFICATION = -5 } |
Enumeration of NETCONF message types. More... | |
enum | NC_VERB_LEVEL { NC_VERB_ERROR, NC_VERB_WARNING, NC_VERB_VERBOSE, NC_VERB_DEBUG } |
Verbosity levels. More... | |
Functions | |
void | nc_callback_print (void(*func)(NC_VERB_LEVEL level, const char *msg)) |
Set a callback function for printing libnetconf's messages.If the func parameter is NULL, the callback is set back to the default (no) function. More... | |
int | nc_close (void) |
Release libnetconf resources. Init flag is used to determine if close should be applied as system-wide (NC_INIT_MULTILAYER) or not (NC_INIT_SINGLELAYER). System-wide nc_close() closes all the shared structures if no other libnetconf participant is currently running. Local release of the calling instance from the shared structures is done in both cases. More... | |
time_t | nc_datetime2time (const char *datetime) |
Transform given string in RFC 3339 compliant format to the time_t (seconds since the epoch) accepted by most Linux functions. More... | |
struct nc_err * | nc_err_dup (const struct nc_err *error) |
Duplicate an error description structure. More... | |
void | nc_err_free (struct nc_err *err) |
Free NETCONF error structure. More... | |
const char * | nc_err_get (const struct nc_err *err, NC_ERR_PARAM param) |
Get value of the specified parameter of the NETCONF error structure. More... | |
struct nc_err * | nc_err_new (NC_ERR error) |
Create a new error description structure. More... | |
int | nc_err_set (struct nc_err *err, NC_ERR_PARAM param, const char *value) |
Set selected parameter of the NETCONF error structure to the specified value. More... | |
void | nc_hello_timeout (int timeout) |
Set <hello> timeout - how long libnetconf will wait for the <hello> message from the other side. Default value is -1 (infinite timeout). More... | |
int | nc_init (int flags) |
Initialize libnetconf for system-wide usage. This initialization is shared across all the processes. More... | |
int | nc_msgid_compare (const nc_msgid id1, const nc_msgid id2) |
Compare two message IDs if they are the same. More... | |
char * | nc_time2datetime (time_t time, const char *tz) |
Transform given time_t (seconds since the epoch) into the RFC 3339 format accepted by NETCONF functions. More... | |
void | nc_verb_error (const char *format,...) |
Function for logging error messages. More... | |
void | nc_verb_verbose (const char *format,...) |
Function for logging verbose messages. More... | |
void | nc_verb_warning (const char *format,...) |
Function for logging warning messages. More... | |
void | nc_verbosity (NC_VERB_LEVEL level) |
Set libnetconf's verbosity level. More... | |
libnetconf's miscellaneous functions.
enum NC_MSG_TYPE |
Enumeration of NETCONF message types.
enum NC_VERB_LEVEL |
void nc_callback_print | ( | void(*)(NC_VERB_LEVEL level, const char *msg) | func | ) |
Set a callback function for printing libnetconf's messages.If the func parameter is NULL, the callback is set back to the default (no) function.
[in] | func | Callback function to use. |
int nc_close | ( | void | ) |
Release libnetconf resources. Init flag is used to determine if close should be applied as system-wide (NC_INIT_MULTILAYER) or not (NC_INIT_SINGLELAYER). System-wide nc_close() closes all the shared structures if no other libnetconf participant is currently running. Local release of the calling instance from the shared structures is done in both cases.
time_t nc_datetime2time | ( | const char * | datetime | ) |
Transform given string in RFC 3339 compliant format to the time_t (seconds since the epoch) accepted by most Linux functions.
This is a reverse function to nc_time2datetime().
[in] | datetime | Time structure returned e.g. by localtime(). |
struct nc_err* nc_err_dup | ( | const struct nc_err * | error | ) |
Duplicate an error description structure.
[in] | error | Existing NETCONF error description structure to be duplicated. |
void nc_err_free | ( | struct nc_err * | err | ) |
Free NETCONF error structure.
err | NETCONF error structure to free. |
const char* nc_err_get | ( | const struct nc_err * | err, |
NC_ERR_PARAM | param | ||
) |
Get value of the specified parameter of the NETCONF error structure.
err | NETCONF error structure from which the value will be read. |
param | NETCONF error structure's parameter to be returned. |
struct nc_err* nc_err_new | ( | NC_ERR | error | ) |
Create a new error description structure.
[in] | error | Predefined NETCONF error (according to RFC 6241 Appendix A). |
int nc_err_set | ( | struct nc_err * | err, |
NC_ERR_PARAM | param, | ||
const char * | value | ||
) |
Set selected parameter of the NETCONF error structure to the specified value.
err | NETCONF error structure to be modified. |
param | NETCONF error structure's parameter to be modified. |
value | New value for the specified parameter. |
void nc_hello_timeout | ( | int | timeout | ) |
Set <hello> timeout - how long libnetconf will wait for the <hello> message from the other side. Default value is -1 (infinite timeout).
[in] | timeout | Timeout in milliseconds, -1 for infinite timeout, 0 for non-blocking. |
int nc_init | ( | int | flags | ) |
Initialize libnetconf for system-wide usage. This initialization is shared across all the processes.
[in] | flags | ORed flags for libnetconf initialization. Must include NC_INIT_CLIENT, NC_INIT_MULTILAYER, or NC_INIT_SINGLELAYER with other accepted values including:
|
Clients call init just for libssh initialization, if it is used. The difference between the multi-layer and single-layer flag is strictly in the behaviour when cleaning shared library resources, either during nc_close() or if the calling process crashed before (equals did not call nc_close()). On multi-layer crash/close, if it was/is the only running libnetconf application, full cleanup is performed, unlike single-layer crash, when this situation is reflected just in the return flag or single-layer close, when only the local resources are released.
Compare two message IDs if they are the same.
[in] | id1 | First message ID to compare. |
[in] | id2 | Second message ID to compare. |
char* nc_time2datetime | ( | time_t | time, |
const char * | tz | ||
) |
Transform given time_t (seconds since the epoch) into the RFC 3339 format accepted by NETCONF functions.
This is a reverse function to nc_datetime2time().
[in] | time | time_t type value returned e.g. by time(). |
[in] | tz | timezone name for the result. See tzselect(1) for list of correct values. If not specified (NULL), the result is provided in UTC (Zulu). |
void nc_verb_error | ( | const char * | format, |
... | |||
) |
Function for logging error messages.
[in] | format | printf's format string |
[in] | ... | list of arguments specified in format |
void nc_verb_verbose | ( | const char * | format, |
... | |||
) |
Function for logging verbose messages.
[in] | format | printf's format string |
[in] | ... | list of arguments specified in format |
void nc_verb_warning | ( | const char * | format, |
... | |||
) |
Function for logging warning messages.
[in] | format | printf's format string |
[in] | ... | list of arguments specified in format |
void nc_verbosity | ( | NC_VERB_LEVEL | level | ) |
Set libnetconf's verbosity level.
[in] | level | Enabled verbosity level (includes all the levels with higher priority). |