libnetconf's functions for handling the NETCONF <rpc> messages. These functions accepts parameters as libxml2 structures.
More...
libnetconf's functions for handling the NETCONF <rpc> messages. These functions accepts parameters as libxml2 structures.
Create a new NETCONF filter of the specified type.
- Parameters
-
[in] | type | Type of the filter. |
[in] | ... | Filter content:
- for NC_FILTER_SUBTREE type, single variadic parameter const xmlNodePtr filter with the content for the <filter> element is accepted. The filter parameter is not supposed to contain <filter> element, but only its content. The node is taken as a node list, so the sibling nodes are also added into the filter definition. If NULL is specified, the Empty filter (RFC 6241 sec 6.4.2) is created.
|
- Returns
- Created NETCONF filter structure.
nc_rpc* ncxml_rpc_build |
( |
xmlDocPtr |
rpc_dump, |
|
|
const struct nc_session * |
session |
|
) |
| |
Build <rpc> message from the libxml2 document structure. This is the reverse function of the ncxml_rpc_dump().
- Parameters
-
[in] | rpc_dump | XML document structure with the NETCONF <rpc> message. The structure is integrated into the internal rpc structure and caller should not access (or free) given XML document anymore. |
[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. |
- Returns
- Complete rpc structure used by libnetconf's functions.
Create <copy-config> NETCONF rpc message.
Variadic parameters:
- the source is specified as NC_DATASTORE_CONFIG:
- nc_rpc_copyconfig() accepts as the first variadic parameter const xmlNodePtr source_config providing the complete configuration data to copy.
- the source is specified as NC_DATASTORE_URL:
- nc_rpc_copyconfig() accepts as the first variadic parameter const char* source_url providing the URL to the file
- target is specified as NC_DATASTORE_URL:
- nc_rpc_copyconfig() accepts as another (first or second according to eventual previous variadic parameter) variadic parameter const char* target_url providing the URL to the target file.
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.
- Parameters
-
[in] | source | Source configuration datastore type. If the NC_DATASTORE_NONE 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. |
- Returns
- Created rpc message.
xmlDocPtr ncxml_rpc_dump |
( |
const nc_rpc * |
rpc | ) |
|
Dump the rpc message into a libxml2 document structure.
- Parameters
-
- Returns
- XML document of the NETCONF's <rpc> message. Caller is supposed to free the returned structure with xmlFreeDoc().
Create <edit-config> NETCONF rpc message.
- Parameters
-
[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 the setting of this parameter and use 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:
- const xmlNodePtr config defining the content of the <config> element in case the source parameter is specified as NC_DATASTORE_CONFIG. The config parameter can points to the node list.
- const char* source_url specifying URL, in case the source parameter is specified as NC_DATASTORE_URL. The URL must refer to the file containing configuration data hierarchy to be modified, encoded in XML under the element <config> in the "urn:ietf:params:xml:ns:netconf:base:1.0" namespace.
|
- Returns
- Created rpc message.
nc_rpc* ncxml_rpc_generic |
( |
const xmlNodePtr |
data | ) |
|
Create a generic NETCONF rpc message with the specified content.
The function recieves the data parameter and envelopes it into an <rpc> container. Caller is fully responsible for the correctness of the given data.
- Parameters
-
[in] | data | XML content of the <rpc> request to be sent. |
- Returns
- Created rpc message.
xmlNodePtr ncxml_rpc_get_config |
( |
const nc_rpc * |
rpc | ) |
|
Get <config> element from the RPC operation including its content. This function is valid only for <copy-config> and <edit-config> RPCs.
- Parameters
-
[in] | rpc | <copy-config> or <edit-config> rpc message. |
- Returns
- XML node <config> with its content or NULL on error. Note that <config> can contain no data. Caller is supposed to free the returned structure with xmlFreeNode().
xmlNodePtr ncxml_rpc_get_op_content |
( |
const nc_rpc * |
rpc | ) |
|
Get the content of the operation specification from the given rpc.
- Parameters
-
- Returns
- libxml2 node structure with the NETCONF operation element(s) and its content. Caller is supposed to free the returned structure with xmlFreeNodeList().