libnetconf2
3.5.4
NETCONF server and client library in C.
|
Functions | |
int | nc_server_add_endpt_unix_socket_listen (const char *endpt_name, const char *unix_socket_path, mode_t mode, uid_t uid, gid_t gid) |
Create a new UNIX socket endpoint and start listening. More... | |
void | nc_server_del_endpt_unix_socket (const char *endpt_name) |
Deletes a UNIX socket endpoint. More... | |
void | nc_server_destroy (void) |
Destroy any dynamically allocated libssh and/or libssl/libcrypto and server resources. More... | |
int | nc_server_endpt_count (void) |
Get the number of currently configured listening endpoints. Note that an ednpoint without address and/or port will be included even though it is not, in fact, listening. More... | |
void | nc_server_get_capab_withdefaults (NC_WD_MODE *basic_mode, int *also_supported) |
Get with-defaults capability extra parameters. More... | |
char ** | nc_server_get_cpblts (const struct ly_ctx *ctx) |
Get all the server capabilities including all the schemas. More... | |
char ** | nc_server_get_cpblts_version (const struct ly_ctx *ctx, LYS_VERSION version) |
Get the server capabilities including the schemas with the specified YANG version. More... | |
int | nc_server_init (void) |
Initialize libssh and/or libssl/libcrypto and the server. More... | |
int | nc_server_init_ctx (struct ly_ctx **ctx) |
Initialize a context which can serve as a default server context. More... | |
int | nc_server_set_capab_withdefaults (NC_WD_MODE basic_mode, int also_supported) |
Set the with-defaults capability extra parameters. More... | |
int | nc_server_set_capability (const char *value) |
Set capability of the server. More... | |
void | nc_server_set_content_id_clb (char *(*content_id_clb)(void *user_data), void *user_data, void(*free_user_data)(void *user_data)) |
Set the callback for getting yang-library capability identifier. If none is set, libyang context change count is used. More... | |
int nc_server_init | ( | void | ) |
Initialize libssh and/or libssl/libcrypto and the server.
Must be called before other nc_server* functions.
void nc_server_destroy | ( | void | ) |
Destroy any dynamically allocated libssh and/or libssl/libcrypto and server resources.
int nc_server_init_ctx | ( | struct ly_ctx ** | ctx | ) |
Initialize a context which can serve as a default server context.
Loads the default modules ietf-netconf and ietf-netconf-monitoring and their enabled features - ietf-netconf enabled features are : writable-running, candidate, rollback-on-error, validate, startup, url, xpath, confirmed-commit and ietf-netconf-monitoring has no features.
If ctx is :
[in,out] | ctx | Optional context in which the modules will be loaded. Created if ctx is null. |
int nc_server_set_capab_withdefaults | ( | NC_WD_MODE | basic_mode, |
int | also_supported | ||
) |
Set the with-defaults capability extra parameters.
For the capability to be actually advertised, the server context must also include the ietf-netconf-with-defaults model.
Changing this option has the same ill effects as changing capabilities while sessions are already established.
[in] | basic_mode | basic-mode with-defaults parameter. |
[in] | also_supported | NC_WD_MODE bit array, also-supported with-defaults parameter. |
void nc_server_get_capab_withdefaults | ( | NC_WD_MODE * | basic_mode, |
int * | also_supported | ||
) |
Get with-defaults capability extra parameters.
At least one argument must be non-NULL.
[out] | basic_mode | basic-mode parameter. |
[out] | also_supported | also-supported parameter. |
int nc_server_set_capability | ( | const char * | value | ) |
Set capability of the server.
Capability can be used when some behavior or extension of the server is not defined as a YANG module. The provided value will be advertised in the server's <hello> messages. Note, that libnetconf only checks that the provided value is non-empty string.
[in] | value | Capability string to be advertised in server's <hello> messages. |
void nc_server_set_content_id_clb | ( | char *(*)(void *user_data) | content_id_clb, |
void * | user_data, | ||
void(*)(void *user_data) | free_user_data | ||
) |
Set the callback for getting yang-library capability identifier. If none is set, libyang context change count is used.
[in] | content_id_clb | Callback that should return the yang-library content identifier. |
[in] | user_data | Optional arbitrary user data that will be passed to content_id_clb . |
[in] | free_user_data | Optional callback that will be called during cleanup to free any user_data . |
char** nc_server_get_cpblts | ( | const struct ly_ctx * | ctx | ) |
Get all the server capabilities including all the schemas.
A few capabilities (with-defaults, interleave) depend on the current server options.
[in] | ctx | Context to read most capabilities from. |
char** nc_server_get_cpblts_version | ( | const struct ly_ctx * | ctx, |
LYS_VERSION | version | ||
) |
Get the server capabilities including the schemas with the specified YANG version.
A few capabilities (with-defaults, interleave) depend on the current server options.
[in] | ctx | Context to read most capabilities from. |
[in] | version | YANG version of the schemas to be included in result, with LYS_VERSION_UNDEF the result is the same as from nc_server_get_cpblts(). |
int nc_server_endpt_count | ( | void | ) |
Get the number of currently configured listening endpoints. Note that an ednpoint without address and/or port will be included even though it is not, in fact, listening.
int nc_server_add_endpt_unix_socket_listen | ( | const char * | endpt_name, |
const char * | unix_socket_path, | ||
mode_t | mode, | ||
uid_t | uid, | ||
gid_t | gid | ||
) |
Create a new UNIX socket endpoint and start listening.
[in] | endpt_name | Arbitrary unique identifier of the endpoint. |
[in] | unix_socket_path | Path to the listening socket. |
[in] | mode | New mode, -1 to use default. |
[in] | uid | New uid, -1 to use default. |
[in] | gid | New gid, -1 to use default. |
void nc_server_del_endpt_unix_socket | ( | const char * | endpt_name | ) |
Deletes a UNIX socket endpoint.
[in] | endpt_name | Identifier of the endpoint. Has no effect if the endpoint doesn't exist or if its transport is not UNIX socket. |