libnetconf  0.10.0-146_trunk
NETCONF Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
messages.h
Go to the documentation of this file.
1 
40 #ifndef NC_MESSAGES_H_
41 #define NC_MESSAGES_H_
42 
43 #include <time.h>
44 #include "netconf.h"
45 #include "error.h"
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
60 struct nc_filter* nc_filter_new(NC_FILTER_TYPE type, ...);
61 
67 void nc_filter_free(struct nc_filter *filter);
68 
77 char* nc_reply_dump(const nc_reply *reply);
78 
85 nc_rpc* nc_rpc_dup(const nc_rpc* rpc);
86 
93 nc_reply* nc_reply_dup(const nc_reply* reply);
94 
103 nc_reply* nc_reply_build(const char* reply_dump);
104 
111 const nc_msgid nc_reply_get_msgid(const nc_reply *reply);
112 
121 char* nc_rpc_dump(const nc_rpc *rpc);
122 
133 nc_rpc* nc_rpc_build(const char* rpc_dump, const struct nc_session* session);
134 
141 const nc_msgid nc_rpc_get_msgid(const nc_rpc *rpc);
142 
149 char* nc_rpc_get_ns(const nc_rpc *rpc);
150 
157 NC_OP nc_rpc_get_op(const nc_rpc *rpc);
158 
166 char* nc_rpc_get_op_name(const nc_rpc* rpc);
167 
175 char* nc_rpc_get_op_namespace(const nc_rpc* rpc);
176 
184 char* nc_rpc_get_op_content(const nc_rpc *rpc);
185 
198 
210 
222 
235 char* nc_rpc_get_config(const nc_rpc *rpc);
236 
246 
255 
266 
275 struct nc_filter* nc_rpc_get_filter(const nc_rpc * rpc);
276 
287 
295 char* nc_reply_get_data(const nc_reply *reply);
296 
303 const char* nc_reply_get_data_ns(const nc_reply *reply);
304 
313 const char* nc_reply_get_errormsg(const nc_reply *reply);
314 
320 void nc_rpc_free(nc_rpc *rpc);
321 
327 void nc_reply_free(nc_reply *reply);
328 
334 nc_reply* nc_reply_ok(void);
335 
344 nc_reply* nc_reply_data(const char* data);
345 
354 nc_reply* nc_reply_data_ns(const char* data, const char* ns);
355 
363 nc_reply* nc_reply_error(struct nc_err* error);
364 
377 int nc_reply_error_add(nc_reply *reply, struct nc_err* error);
378 
397 nc_reply* nc_reply_merge(int count, ...);
398 
426 nc_rpc* nc_rpc_copyconfig(NC_DATASTORE source, NC_DATASTORE target, ...);
427 
438 
465 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, ...);
466 
474 nc_rpc* nc_rpc_get(const struct nc_filter *filter);
475 
484 nc_rpc* nc_rpc_getconfig(NC_DATASTORE source, const struct nc_filter *filter);
485 
493 nc_rpc* nc_rpc_killsession(const char *kill_sid);
494 
503 
512 
528 nc_rpc* nc_rpc_validate(NC_DATASTORE source, ...);
529 
549 nc_rpc* nc_rpc_subscribe(const char* stream, const struct nc_filter *filter, const time_t* start, const time_t* stop);
550 
557 nc_rpc* nc_rpc_commit(void);
558 
566 
577 nc_rpc* nc_rpc_getschema(const char* name, const char* version, const char* format);
578 
589 nc_rpc* nc_rpc_generic(const char* data);
590 
613 int nc_rpc_capability_attr(nc_rpc* rpc, NC_CAP_ATTR attr, ...);
614 
615 #ifdef __cplusplus
616 }
617 #endif
618 
619 #endif /* NC_MESSAGES_H_ */
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).
NC_EDIT_ERROPT_TYPE
Enumeration of edit-config's <error-option> element values.
Definition: netconf.h:308
nc_reply * nc_reply_ok(void)
Create <ok> rpc-reply response.
NC_EDIT_DEFOP_TYPE
Enumeration of edit-config's <default-operation> element values.
Definition: netconf.h:296
NC_REPLY_TYPE nc_reply_get_type(const nc_reply *reply)
Get the type of the rpc-reply message.
void nc_filter_free(struct nc_filter *filter)
Destroy the filter structure.
NC_DATASTORE
Enumeration of the supported types of datastores defined by NETCONF.
Definition: netconf.h:260
char * nc_rpc_get_ns(const nc_rpc *rpc)
Get user's rpc operation namespace.
struct nc_msg nc_reply
reply message.
Definition: netconf.h:62
char * nc_reply_get_data(const nc_reply *reply)
Get content of the <data> element in <rpc-reply>.
nc_rpc * nc_rpc_commit(void)
Create <commit> NETCONF 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.
nc_reply * nc_reply_merge(int count,...)
Merge reply messages. All messages MUST be of the same type.
nc_rpc * nc_rpc_getschema(const char *name, const char *version, const char *format)
Create <get-schema> NETCONF rpc message (RFC 6022).
char * nc_rpc_get_op_namespace(const nc_rpc *rpc)
Get operation namespace of the given rpc.
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.
NETCONF error handling functions.
void nc_rpc_free(nc_rpc *rpc)
Free rpc message.
nc_rpc * nc_rpc_validate(NC_DATASTORE source,...)
Create <validate> NETCONF rpc message.
struct nc_msg nc_rpc
rpc message.
Definition: netconf.h:56
NC_OP
Enumeration of supported <rpc> operations.
Definition: netconf.h:179
NC_EDIT_ERROPT_TYPE nc_rpc_get_erropt(const nc_rpc *rpc)
Get error-option type, valid only for <edit-config> RPCs.
NC_OP nc_rpc_get_op(const nc_rpc *rpc)
Get operation of the given rpc.
nc_rpc * nc_rpc_subscribe(const char *stream, const struct nc_filter *filter, const time_t *start, const time_t *stop)
Create <create-subsciption> NETCONF rpc message.
void nc_reply_free(nc_reply *reply)
Free reply message.
const char * nc_reply_get_data_ns(const nc_reply *reply)
Get namespace of the <data> element in <rpc-reply>.
nc_reply * nc_reply_data_ns(const char *data, const char *ns)
Create rpc-reply response with <data> content in the specified namespace.
NC_DATASTORE nc_rpc_get_target(const nc_rpc *rpc)
Get the target datastore type (running, startup, candidate) of the rpc request.
nc_rpc * nc_rpc_deleteconfig(NC_DATASTORE target,...)
Create <delete-config> NETCONF rpc message.
NC_RPC_TYPE nc_rpc_get_type(const nc_rpc *rpc)
Get type of the rpc message.
nc_rpc * nc_rpc_killsession(const char *kill_sid)
Create <kill-session> NETCONF rpc message.
NC_DATASTORE nc_rpc_get_source(const nc_rpc *rpc)
Get the source datastore type (running, startup, candidate) of the rpc request.
char * nc_rpc_get_op_content(const nc_rpc *rpc)
Get content of the operation specification from the given rpc.
nc_rpc * nc_rpc_dup(const nc_rpc *rpc)
Duplicate <rpc> message.
char * nc_rpc_get_op_name(const nc_rpc *rpc)
Get operation name of the given rpc.
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.
struct nc_filter * nc_filter_new(NC_FILTER_TYPE type,...)
Create a new NETCONF filter of the specified type.
nc_reply * nc_reply_dup(const nc_reply *reply)
Duplicate <reply> message.
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.
char * nc_reply_dump(const nc_reply *reply)
Dump the rpc-reply message into a string.
nc_rpc * nc_rpc_unlock(NC_DATASTORE target)
Create <unlock> NETCONF rpc message.
NC_EDIT_TESTOPT_TYPE
Enumeration of edit-config's <test-option> element values.
Definition: netconf.h:322
nc_rpc * nc_rpc_copyconfig(NC_DATASTORE source, NC_DATASTORE target,...)
Create <copy-config> NETCONF rpc message.
const nc_msgid nc_rpc_get_msgid(const nc_rpc *rpc)
Get message-id of the given rpc.
#define nc_msgid
Type representing NETCONF message-id attribute.
Definition: netconf.h:91
const nc_msgid nc_reply_get_msgid(const nc_reply *reply)
Get message-id of the given rpc-reply.
nc_reply * nc_reply_error(struct nc_err *error)
Create rpc-reply response with <rpc-error> content.
nc_rpc * nc_rpc_get(const struct nc_filter *filter)
Create <get> NETCONF rpc message.
nc_rpc * nc_rpc_getconfig(NC_DATASTORE source, const struct nc_filter *filter)
Create <get-config> NETCONF rpc message.
NC_REPLY_TYPE
Enumeration of <rpc-reply> types.
Definition: netconf.h:150
nc_rpc * nc_rpc_generic(const char *data)
Create a generic NETCONF rpc message with the specified content.
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().
NC_RPC_TYPE
Enumeration of <rpc> operation types.
Definition: netconf.h:162
struct nc_filter * nc_rpc_get_filter(const nc_rpc *rpc)
Get filter from <get> or <get-config> RPC.
char * nc_rpc_dump(const nc_rpc *rpc)
Dump the rpc message into a string.
NC_EDIT_DEFOP_TYPE nc_rpc_get_defop(const nc_rpc *rpc)
Get default-operation type, valid only for <edit-config> RPCs.
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().
NC_FILTER_TYPE
Enumeration of supported NETCONF filter types.
Definition: netconf.h:273
NC_CAP_ATTR
RPC attributes list.
Definition: netconf.h:353
libnetconf's general public functions and structures definitions.
nc_rpc * nc_rpc_lock(NC_DATASTORE target)
Create <lock> NETCONF rpc message.
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)...
const char * nc_reply_get_errormsg(const nc_reply *reply)
Get error-message from the server's <rpc-error> reply.
nc_rpc * nc_rpc_discardchanges(void)
Create <discard-changes> NETCONF rpc message.