libnetconf
0.10.0-146_trunk
NETCONF Library
|
libnetconf's functions for handling NETCONF <rpc-reply> messages. More...
Typedefs | |
typedef struct nc_msg | nc_reply |
reply message. More... | |
Enumerations | |
enum | NC_REPLY_TYPE { NC_REPLY_UNKNOWN, NC_REPLY_HELLO, NC_REPLY_OK, NC_REPLY_ERROR, NC_REPLY_DATA } |
Enumeration of <rpc-reply> types. More... | |
Functions | |
void | nc_callback_error_reply (void(*func)(const char *tag, const char *type, const char *severity, const char *apptag, const char *path, const char *message, const char *attribute, const char *element, const char *ns, const char *sid)) |
Set a callback function to process (e.g. print) NETCONF <rpc-error> message items.If the func parameter is NULL, the callback is set back to the default (no) function. More... | |
nc_reply * | nc_reply_build (const char *reply_dump) |
Build <rpc-reply> message from the string. This is the reverse function of the nc_reply_dump(). More... | |
nc_reply * | nc_reply_data (const char *data) |
Create rpc-reply response with <data> content (in urn:ietf:params:xml:ns:netconf:base:1.0 namespace). More... | |
nc_reply * | nc_reply_data_ns (const char *data, const char *ns) |
Create rpc-reply response with <data> content in the specified namespace. More... | |
char * | nc_reply_dump (const nc_reply *reply) |
Dump the rpc-reply message into a string. More... | |
nc_reply * | nc_reply_dup (const nc_reply *reply) |
Duplicate <reply> message. More... | |
nc_reply * | nc_reply_error (struct nc_err *error) |
Create rpc-reply response with <rpc-error> content. More... | |
int | nc_reply_error_add (nc_reply *reply, struct nc_err *error) |
Add another error description into the existing rpc-reply with <rpc-error> content. More... | |
void | nc_reply_free (nc_reply *reply) |
Free reply message. More... | |
char * | nc_reply_get_data (const nc_reply *reply) |
Get content of the <data> element in <rpc-reply>. More... | |
const char * | nc_reply_get_data_ns (const nc_reply *reply) |
Get namespace of the <data> element in <rpc-reply>. More... | |
const char * | nc_reply_get_errormsg (const nc_reply *reply) |
Get error-message from the server's <rpc-error> reply. More... | |
const nc_msgid | nc_reply_get_msgid (const nc_reply *reply) |
Get message-id of the given rpc-reply. More... | |
NC_REPLY_TYPE | nc_reply_get_type (const nc_reply *reply) |
Get the type of the rpc-reply message. More... | |
nc_reply * | nc_reply_merge (int count,...) |
Merge reply messages. All messages MUST be of the same type. More... | |
nc_reply * | nc_reply_ok (void) |
Create <ok> rpc-reply response. More... | |
NC_MSG_TYPE | nc_session_recv_reply (struct nc_session *session, int timeout, nc_reply **reply) |
Receive <rpc-reply> response from the specified NETCONF session. This function is supposed to be performed only by NETCONF clients. More... | |
const nc_msgid | nc_session_send_reply (struct nc_session *session, const nc_rpc *rpc, const nc_reply *reply) |
Send <rpc-reply> response via specified NETCONF session. This function is supposed to be performed only by NETCONF servers. More... | |
libnetconf's functions for handling NETCONF <rpc-reply> messages.
typedef struct nc_msg nc_reply |
reply message.
enum NC_REPLY_TYPE |
Enumeration of <rpc-reply> types.
void nc_callback_error_reply | ( | void(*)(const char *tag, const char *type, const char *severity, const char *apptag, const char *path, const char *message, const char *attribute, const char *element, const char *ns, const char *sid) | func | ) |
Set a callback function to process (e.g. print) NETCONF <rpc-error> message items.If the func parameter is NULL, the callback is set back to the default (no) function.
[in] | func | Callback function to use. Passed parameters are:
|
nc_reply* nc_reply_build | ( | const char * | reply_dump | ) |
Build <rpc-reply> message from the string. This is the reverse function of the nc_reply_dump().
[in] | reply_dump | String containing the NETCONF <rpc-reply> message. |
nc_reply* nc_reply_data | ( | const char * | data | ) |
Create rpc-reply response with <data> content (in urn:ietf:params:xml:ns:netconf:base:1.0 namespace).
[in] | data | Serialized XML content of the <data> element for the <rpc-reply> message being created. |
nc_reply* nc_reply_data_ns | ( | const char * | data, |
const char * | ns | ||
) |
Create rpc-reply response with <data> content in the specified namespace.
[in] | data | Serialized XML content of the <data> element for the <rpc-reply> message being created. |
[in] | ns | Default namespace for the data element. |
char* nc_reply_dump | ( | const nc_reply * | reply | ) |
Dump the rpc-reply message into a string.
[in] | reply | rpc-reply message. |
Duplicate <reply> message.
[in] | reply | <reply> message to replicate. |
nc_reply* nc_reply_error | ( | struct nc_err * | error | ) |
Create rpc-reply response with <rpc-error> content.
[in] | error | NETCONF error description structure for the reply message. From now, the error is connected with the reply and should not be used by the caller. |
int nc_reply_error_add | ( | nc_reply * | reply, |
struct nc_err * | error | ||
) |
Add another error description into the existing rpc-reply with <rpc-error> content.
This function can be applied only to reply messages created by nc_reply_error().
[in,out] | reply | Reply structure to which the given error description will be added. |
[in] | error | NETCONF error description structure for the reply message. From now, the error is connected with the reply and should not be used by the caller. |
void nc_reply_free | ( | nc_reply * | reply | ) |
Free reply message.
[in] | reply | reply message to free. |
char* nc_reply_get_data | ( | const nc_reply * | reply | ) |
Get content of the <data> element in <rpc-reply>.
reply | rpc-reply message. |
const char* nc_reply_get_data_ns | ( | const nc_reply * | reply | ) |
Get namespace of the <data> element in <rpc-reply>.
reply | rpc-reply message. |
const char* nc_reply_get_errormsg | ( | const nc_reply * | reply | ) |
Get error-message from the server's <rpc-error> reply.
reply | rpc-reply message of the NC_REPLY_ERROR type. |
Get message-id of the given rpc-reply.
[in] | reply | rpc-reply message. |
NC_REPLY_TYPE nc_reply_get_type | ( | const nc_reply * | reply | ) |
Get the type of the rpc-reply message.
<rpc-reply> message can contain <ok>, <rpc-error> or <data>
[in] | reply | rpc-reply message |
nc_reply* nc_reply_merge | ( | int | count, |
... | |||
) |
Merge reply messages. All messages MUST be of the same type.
Function merges a number of <rpc-reply> specified by the count parameter (at least 2) into one <rpc-reply> message which is returned as the result. When the merge is successful, all input messages are freed and MUST NOT be used after this call. Merge can fail only because of an invalid input parameter. In such a case, NULL is returned and input messages are left unchanged.
[in] | count | Number of messages to merge |
[in] | ... | Messages to merge (all are of nc_reply* type). Total number of messages MUST be equal to count. |
nc_reply* nc_reply_ok | ( | void | ) |
Create <ok> rpc-reply response.
NC_MSG_TYPE nc_session_recv_reply | ( | struct nc_session * | session, |
int | timeout, | ||
nc_reply ** | reply | ||
) |
Receive <rpc-reply> response from the specified NETCONF session. This function is supposed to be performed only by NETCONF clients.
[in] | session | NETCONF session to use. |
[in] | timeout | Timeout in microseconds, -1 for infinite timeout, 0 for non-blocking |
[out] | reply | Received <rpc-reply> |
const nc_msgid nc_session_send_reply | ( | struct nc_session * | session, |
const nc_rpc * | rpc, | ||
const nc_reply * | reply | ||
) |
Send <rpc-reply> response via specified NETCONF session. This function is supposed to be performed only by NETCONF servers.
This function IS thread safe.
[in] | session | NETCONF session to use. |
[in] | rpc | <rpc> message which is request for the sending reply |
[in] | reply | <repc-reply> message to send. |