libnetconf
0.10.0-146_trunk
NETCONF Library
|
libnetconf's functions for handling NETCONF <rpc> messages. More...
Typedefs | |
typedef struct nc_msg | nc_rpc |
rpc message. More... | |
Functions | |
void | nc_filter_free (struct nc_filter *filter) |
Destroy the filter structure. More... | |
struct nc_filter * | nc_filter_new (NC_FILTER_TYPE type,...) |
Create a new NETCONF filter of the specified type. More... | |
nc_rpc * | nc_rpc_build (const char *rpc_dump, const struct nc_session *session) |
Build <rpc> message from the string. This is the reverse function of the nc_rpc_dump(). More... | |
int | nc_rpc_capability_attr (nc_rpc *rpc, NC_CAP_ATTR attr,...) |
Set the attribute of the given <rpc> which is specific for some NETCONF capability. More... | |
nc_rpc * | nc_rpc_commit (void) |
Create <commit> NETCONF rpc message. More... | |
nc_rpc * | nc_rpc_copyconfig (NC_DATASTORE source, NC_DATASTORE target,...) |
Create <copy-config> NETCONF rpc message. More... | |
nc_rpc * | nc_rpc_deleteconfig (NC_DATASTORE target,...) |
Create <delete-config> NETCONF rpc message. More... | |
nc_rpc * | nc_rpc_discardchanges (void) |
Create <discard-changes> NETCONF rpc message. More... | |
char * | nc_rpc_dump (const nc_rpc *rpc) |
Dump the rpc message into a string. More... | |
nc_rpc * | nc_rpc_dup (const nc_rpc *rpc) |
Duplicate <rpc> message. More... | |
nc_rpc * | nc_rpc_editconfig (NC_DATASTORE target, NC_DATASTORE source, NC_EDIT_DEFOP_TYPE default_operation, NC_EDIT_ERROPT_TYPE error_option, NC_EDIT_TESTOPT_TYPE test_option,...) |
Create <edit-config> NETCONF rpc message. More... | |
void | nc_rpc_free (nc_rpc *rpc) |
Free rpc message. More... | |
nc_rpc * | nc_rpc_generic (const char *data) |
Create a generic NETCONF rpc message with the specified content. More... | |
nc_rpc * | nc_rpc_get (const struct nc_filter *filter) |
Create <get> NETCONF rpc message. More... | |
char * | nc_rpc_get_config (const nc_rpc *rpc) |
Get serialized content of the config parameter (<config> itself is not a part of the returned data). This function is valid only for <copy-config> and <edit-config> RPCs. More... | |
NC_EDIT_DEFOP_TYPE | nc_rpc_get_defop (const nc_rpc *rpc) |
Get default-operation type, valid only for <edit-config> RPCs. More... | |
NC_EDIT_ERROPT_TYPE | nc_rpc_get_erropt (const nc_rpc *rpc) |
Get error-option type, valid only for <edit-config> RPCs. More... | |
struct nc_filter * | nc_rpc_get_filter (const nc_rpc *rpc) |
Get filter from <get> or <get-config> RPC. More... | |
const nc_msgid | nc_rpc_get_msgid (const nc_rpc *rpc) |
Get message-id of the given rpc. More... | |
char * | nc_rpc_get_ns (const nc_rpc *rpc) |
Get user's rpc operation namespace. More... | |
NC_OP | nc_rpc_get_op (const nc_rpc *rpc) |
Get operation of the given rpc. More... | |
char * | nc_rpc_get_op_content (const nc_rpc *rpc) |
Get content of the operation specification from the given rpc. More... | |
char * | nc_rpc_get_op_name (const nc_rpc *rpc) |
Get operation name of the given rpc. More... | |
char * | nc_rpc_get_op_namespace (const nc_rpc *rpc) |
Get operation namespace of the given rpc. More... | |
NC_DATASTORE | nc_rpc_get_source (const nc_rpc *rpc) |
Get the source datastore type (running, startup, candidate) of the rpc request. More... | |
NC_DATASTORE | nc_rpc_get_target (const nc_rpc *rpc) |
Get the target datastore type (running, startup, candidate) of the rpc request. More... | |
NC_EDIT_TESTOPT_TYPE | nc_rpc_get_testopt (const nc_rpc *rpc) |
Get test-option type, valid only for <edit-config> RPCs supporting :validate:1.1 capability. More... | |
NC_RPC_TYPE | nc_rpc_get_type (const nc_rpc *rpc) |
Get type of the rpc message. More... | |
nc_rpc * | nc_rpc_getconfig (NC_DATASTORE source, const struct nc_filter *filter) |
Create <get-config> NETCONF rpc message. More... | |
nc_rpc * | nc_rpc_getschema (const char *name, const char *version, const char *format) |
Create <get-schema> NETCONF rpc message (RFC 6022). More... | |
nc_rpc * | nc_rpc_killsession (const char *kill_sid) |
Create <kill-session> NETCONF rpc message. More... | |
nc_rpc * | nc_rpc_lock (NC_DATASTORE target) |
Create <lock> NETCONF rpc message. More... | |
nc_rpc * | nc_rpc_unlock (NC_DATASTORE target) |
Create <unlock> NETCONF rpc message. More... | |
nc_rpc * | nc_rpc_validate (NC_DATASTORE source,...) |
Create <validate> NETCONF rpc message. More... | |
NC_MSG_TYPE | nc_session_recv_rpc (struct nc_session *session, int timeout, nc_rpc **rpc) |
Receive <rpc> request from the specified NETCONF session. This function is supposed to be performed only by NETCONF servers. More... | |
NC_MSG_TYPE | nc_session_send_recv (struct nc_session *session, nc_rpc *rpc, nc_reply **reply) |
Send <rpc> and receive <rpc-reply> via the specified NETCONF session. More... | |
const nc_msgid | nc_session_send_rpc (struct nc_session *session, nc_rpc *rpc) |
Send <rpc> request via specified NETCONF session. This function is supposed to be performed only by NETCONF clients. More... | |
libnetconf's functions for handling NETCONF <rpc> messages.
typedef struct nc_msg nc_rpc |
rpc message.
enum NC_CAP_ATTR |
RPC attributes list.
List of specific attributes that can be added to selected RPC operations. The attributes can be set by (possibly repeated) call of the nc_rpc_capability_attr() function.
Enumerator | |
---|---|
NC_CAP_ATTR_WITHDEFAULTS_MODE |
Set <with-default> attribute of the operation |
enum NC_EDIT_DEFOP_TYPE |
Enumeration of edit-config's <default-operation> element values.
enum NC_EDIT_ERROPT_TYPE |
Enumeration of edit-config's <error-option> element values.
enum NC_EDIT_OP_TYPE |
Enumeration of edit-config's operation attribute values.
enum NC_EDIT_TESTOPT_TYPE |
Enumeration of edit-config's <test-option> element values.
Valid only with enabled :validate:1.1 capability.
enum NC_FILTER_TYPE |
enum NC_OP |
Enumeration of supported <rpc> operations.
enum NC_RPC_TYPE |
Enumeration of <rpc> operation types.
void nc_filter_free | ( | struct nc_filter * | filter | ) |
Destroy the filter structure.
[in] | filter | Filter to destroy. |
struct nc_filter* nc_filter_new | ( | NC_FILTER_TYPE | type, |
... | |||
) |
Create a new NETCONF filter of the specified type.
[in] | type | Type of the filter. |
[in] | ... | Filter content:
|
nc_rpc* nc_rpc_build | ( | const char * | rpc_dump, |
const struct nc_session * | session | ||
) |
Build <rpc> message from the string. This is the reverse function of the nc_rpc_dump().
[in] | rpc_dump | String containing the NETCONF <rpc> message. |
[in] | session | Session information needed for ACM. If NULL, ACM structure is not prepared and no ACM rules will be applied to the created RPC message. |
int nc_rpc_capability_attr | ( | nc_rpc * | rpc, |
NC_CAP_ATTR | attr, | ||
... | |||
) |
Set the attribute of the given <rpc> which is specific for some NETCONF capability.
[in] | rpc | RPC to be modified. This RPC must be created by one of the nc_rpc* functions. RPC received by the server side's nc_session_recv_rpc() is not accepted. |
[in] | attr | RPC's attribute defined by a capability to be set or changed. The list of accepted operations can be found in the description of this function. |
nc_rpc* nc_rpc_commit | ( | void | ) |
Create <commit> NETCONF rpc message.
nc_rpc* nc_rpc_copyconfig | ( | NC_DATASTORE | source, |
NC_DATASTORE | target, | ||
... | |||
) |
Create <copy-config> NETCONF rpc message.
The file that the url refers to contains the complete datastore, encoded in XML under the element <config> in the "urn:ietf:params:xml:ns:netconf:base:1.0" namespace.
[in] | source | Source configuration of the datastore type. If the NC_DATASTORE_CONFIG is specified, data parameter is used as the complete configuration to copy. |
[in] | target | Target configuration datastore type to be replaced. |
[in] | ... | Specific parameters according to the source and target parameters. |
nc_rpc* nc_rpc_deleteconfig | ( | NC_DATASTORE | target, |
... | |||
) |
Create <delete-config> NETCONF rpc message.
[in] | target | Target configuration datastore type to be deleted. |
[in] | ... | URL as const char* url if the target parameter is specified as NC_DATASTORE_URL. |
nc_rpc* nc_rpc_discardchanges | ( | void | ) |
Create <discard-changes> NETCONF rpc message.
char* nc_rpc_dump | ( | const nc_rpc * | rpc | ) |
Dump the rpc message into a string.
[in] | rpc | rpc message. |
Duplicate <rpc> message.
[in] | rpc | <rpc> message to replicate. |
nc_rpc* nc_rpc_editconfig | ( | NC_DATASTORE | target, |
NC_DATASTORE | source, | ||
NC_EDIT_DEFOP_TYPE | default_operation, | ||
NC_EDIT_ERROPT_TYPE | error_option, | ||
NC_EDIT_TESTOPT_TYPE | test_option, | ||
... | |||
) |
Create <edit-config> NETCONF rpc message.
[in] | target | Target configuration datastore type to be edited. |
[in] | source | Specifies the type of the source data taken from the variadic parameter. Only NC_DATASTORE_CONFIG (variadic parameter contains the <config> data) and NC_DATASTORE_URL (variadic parameter contains URL for <url> element) values are accepted. |
[in] | default_operation | Default operation for this request, 0 to skip setting this parameter and use the default server ('merge') behavior. |
[in] | error_option | Set the response to an error, 0 for the server default behavior. |
[in] | test_option | Set test-option element according to :validate:1.1 capability specified in RFC 6241. |
[in] | ... | According to the source parameter, variadic parameter can be one of the following:
|
void nc_rpc_free | ( | nc_rpc * | rpc | ) |
Free rpc message.
[in] | rpc | rpc message to free. |
nc_rpc* nc_rpc_generic | ( | const char * | data | ) |
Create a generic NETCONF rpc message with the specified content.
Function gets the data parameter and envelopes it into <rpc> container. Caller is fully responsible for the correctness of the given data.
[in] | data | XML content of the <rpc> request to be sent. |
nc_rpc* nc_rpc_get | ( | const struct nc_filter * | filter | ) |
Create <get> NETCONF rpc message.
[in] | filter | NETCONF filter or NULL if no filter is required. |
char* nc_rpc_get_config | ( | const nc_rpc * | rpc | ) |
Get serialized content of the config parameter (<config> itself is not a part of the returned data). This function is valid only for <copy-config> and <edit-config> RPCs.
[in] | rpc | <copy-config> or <edit-config> rpc message. |
NC_EDIT_DEFOP_TYPE nc_rpc_get_defop | ( | const nc_rpc * | rpc | ) |
Get default-operation type, valid only for <edit-config> RPCs.
[in] | rpc | <edit-config> rpc message |
NC_EDIT_ERROPT_TYPE nc_rpc_get_erropt | ( | const nc_rpc * | rpc | ) |
Get error-option type, valid only for <edit-config> RPCs.
[in] | rpc | <edit-config> rpc message |
struct nc_filter* nc_rpc_get_filter | ( | const nc_rpc * | rpc | ) |
Get filter from <get> or <get-config> RPC.
[in] | rpc | <get> or <get-config> rpc message |
Get message-id of the given rpc.
[in] | rpc | rpc message. |
char* nc_rpc_get_ns | ( | const nc_rpc * | rpc | ) |
Get user's rpc operation namespace.
rpc | rpc message. |
Get operation of the given rpc.
[in] | rpc | rpc message. |
char* nc_rpc_get_op_content | ( | const nc_rpc * | rpc | ) |
Get content of the operation specification from the given rpc.
[in] | rpc | rpc message. |
char* nc_rpc_get_op_name | ( | const nc_rpc * | rpc | ) |
Get operation name of the given rpc.
[in] | rpc | rpc message. |
char* nc_rpc_get_op_namespace | ( | const nc_rpc * | rpc | ) |
Get operation namespace of the given rpc.
[in] | rpc | rpc message. |
NC_DATASTORE nc_rpc_get_source | ( | const nc_rpc * | rpc | ) |
Get the source datastore type (running, startup, candidate) of the rpc request.
For <rpc> message that does not affect datastore (e.g. kill-session), the NC_DATASTORE_ERROR is returned.
[in] | rpc | rpc message |
NC_DATASTORE nc_rpc_get_target | ( | const nc_rpc * | rpc | ) |
Get the target datastore type (running, startup, candidate) of the rpc request.
For <rpc> message that does not affect datastore (e.g. kill-session), the NC_DATASTORE_ERROR is returned.
[in] | rpc | rpc message |
NC_EDIT_TESTOPT_TYPE nc_rpc_get_testopt | ( | const nc_rpc * | rpc | ) |
Get test-option type, valid only for <edit-config> RPCs supporting :validate:1.1 capability.
[in] | rpc | <edit-config> rpc message |
NC_RPC_TYPE nc_rpc_get_type | ( | const nc_rpc * | rpc | ) |
Get type of the rpc message.
<rpc> message can affect the datastore, the session or it can be unknown for the libnetconf (defined by an unsupported capability or device configuration model)
[in] | rpc | rpc message |
nc_rpc* nc_rpc_getconfig | ( | NC_DATASTORE | source, |
const struct nc_filter * | filter | ||
) |
Create <get-config> NETCONF rpc message.
[in] | source | Source configuration datastore type being queried. |
[in] | filter | NETCONF filter or NULL if no filter required. |
nc_rpc* nc_rpc_getschema | ( | const char * | name, |
const char * | version, | ||
const char * | format | ||
) |
Create <get-schema> NETCONF rpc message (RFC 6022).
[in] | name | Identifier for the schema list entry. |
[in] | version | Optional parameter specifying version of the requested schema. |
[in] | format | Optional parameter specifying the data modeling language of the schema. |
nc_rpc* nc_rpc_killsession | ( | const char * | kill_sid | ) |
Create <kill-session> NETCONF rpc message.
[in] | kill_sid | ID of session to kill. |
nc_rpc* nc_rpc_lock | ( | NC_DATASTORE | target | ) |
Create <lock> NETCONF rpc message.
[in] | target | Target configuration datastore type to be locked. |
nc_rpc* nc_rpc_unlock | ( | NC_DATASTORE | target | ) |
Create <unlock> NETCONF rpc message.
[in] | target | Target configuration datastore type to be unlocked. |
nc_rpc* nc_rpc_validate | ( | NC_DATASTORE | source, |
... | |||
) |
Create <validate> NETCONF rpc message.
[in] | source | Name of the configuration datastore to validate. |
NC_MSG_TYPE nc_session_recv_rpc | ( | struct nc_session * | session, |
int | timeout, | ||
nc_rpc ** | rpc | ||
) |
Receive <rpc> request from the specified NETCONF session. This function is supposed to be performed only by NETCONF servers.
[in] | session | NETCONF session to use. |
[in] | timeout | Timeout in microseconds, -1 for infinite timeout, 0 for non-blocking |
[out] | rpc | Received <rpc> |
NC_MSG_TYPE nc_session_send_recv | ( | struct nc_session * | session, |
nc_rpc * | rpc, | ||
nc_reply ** | reply | ||
) |
Send <rpc> and receive <rpc-reply> via the specified NETCONF session.
[in] | session | NETCONF session to use. |
[in] | rpc | RPC message to send. |
[out] | reply | Received <rpc-reply> |
Send <rpc> request via specified NETCONF session. This function is supposed to be performed only by NETCONF clients.
This function IS thread safe.
[in] | session | NETCONF session to use. |
[in] | rpc | <rpc> message to send. |