libnetconf2  3.5.1
NETCONF server and client library in C.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Server Functions
Collaboration diagram for Server Functions:

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...
 

Detailed Description

Function Documentation

int nc_server_init ( void  )

Initialize libssh and/or libssl/libcrypto and the server.

Must be called before other nc_server* functions.

Returns
0 on success, -1 on error.
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 :

  • NULL: a new context will be created and if the call is successful you have to free it,
  • non NULL: context will be searched for the two modules and their features and if anything is missing, it will be implemented.
Parameters
[in,out]ctxOptional context in which the modules will be loaded. Created if ctx is null.
Returns
0 on success, -1 on error.
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.

Parameters
[in]basic_modebasic-mode with-defaults parameter.
[in]also_supportedNC_WD_MODE bit array, also-supported with-defaults parameter.
Returns
0 on success, -1 on error.
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.

Parameters
[out]basic_modebasic-mode parameter.
[out]also_supportedalso-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.

Parameters
[in]valueCapability 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.

Parameters
[in]content_id_clbCallback that should return the yang-library content identifier.
[in]user_dataOptional arbitrary user data that will be passed to content_id_clb.
[in]free_user_dataOptional 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.

Parameters
[in]ctxContext to read most capabilities from.
Returns
Array of capabilities, NULL on error.
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.

Parameters
[in]ctxContext to read most capabilities from.
[in]versionYANG version of the schemas to be included in result, with LYS_VERSION_UNDEF the result is the same as from nc_server_get_cpblts().
Returns
Array of capabilities, NULL on error.
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.

Returns
Number of added listening endpoints.
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.

Parameters
[in]endpt_nameArbitrary unique identifier of the endpoint.
[in]unix_socket_pathPath to the listening socket.
[in]modeNew mode, -1 to use default.
[in]uidNew uid, -1 to use default.
[in]gidNew gid, -1 to use default.
Returns
0 on success, 1 on error.
void nc_server_del_endpt_unix_socket ( const char *  endpt_name)

Deletes a UNIX socket endpoint.

Parameters
[in]endpt_nameIdentifier of the endpoint. Has no effect if the endpoint doesn't exist or if its transport is not UNIX socket.