libnetconf2  1.1.26
NETCONF library for clients and servers
messages_client.h
Go to the documentation of this file.
1 
16 #ifndef NC_MESSAGES_CLIENT_H_
17 #define NC_MESSAGES_CLIENT_H_
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #include <stdint.h>
24 
25 #include "netconf.h"
26 
40 typedef enum {
44  /* ietf-netconf */
58  /* ietf-netconf-monitoring */
61  /* notifications */
64  /* ietf-netconf-nmda */
67 } NC_RPC_TYPE;
68 
72 typedef enum {
78 
82 typedef enum {
88 
92 typedef enum {
98 
102 struct nc_err {
104  const char *type;
106  const char *tag;
108  const char *severity;
110  const char *apptag;
112  const char *path;
114  const char *message;
116  const char *message_lang;
117 
118  /* <error-info> */
119 
121  const char *sid;
123  const char **attr;
125  const char **elem;
127  const char **ns;
129  struct lyxml_elem **other;
130 
132  uint16_t attr_count;
134  uint16_t elem_count;
136  uint16_t ns_count;
138  uint16_t other_count;
139 };
140 
144 struct nc_rpc;
145 
149 struct nc_reply {
151 };
152 
158  struct lyd_node *data;
163 };
164 
170  const struct nc_err *err;
171  uint32_t count;
172 };
173 
177 struct nc_notif {
179  const char *datetime;
180  struct lyd_node *tree;
181 };
182 
189 NC_RPC_TYPE nc_rpc_get_type(const struct nc_rpc *rpc);
190 
201 struct nc_rpc *nc_rpc_act_generic(const struct lyd_node *data, NC_PARAMTYPE paramtype);
202 
216 struct nc_rpc *nc_rpc_act_generic_xml(const char *xml_str, NC_PARAMTYPE paramtype);
217 
233 struct nc_rpc *nc_rpc_getconfig(NC_DATASTORE source, const char *filter, NC_WD_MODE wd_mode,
234  NC_PARAMTYPE paramtype);
235 
253 struct nc_rpc *nc_rpc_edit(NC_DATASTORE target, NC_RPC_EDIT_DFLTOP default_op, NC_RPC_EDIT_TESTOPT test_opt,
254  NC_RPC_EDIT_ERROPT error_opt, const char *edit_content, NC_PARAMTYPE paramtype);
255 
273 struct nc_rpc *nc_rpc_copy(NC_DATASTORE target, const char *url_trg, NC_DATASTORE source,
274  const char *url_or_config_src, NC_WD_MODE wd_mode, NC_PARAMTYPE paramtype);
275 
290 struct nc_rpc *nc_rpc_delete(NC_DATASTORE target, const char *url, NC_PARAMTYPE paramtype);
291 
304 struct nc_rpc *nc_rpc_lock(NC_DATASTORE target);
305 
318 struct nc_rpc *nc_rpc_unlock(NC_DATASTORE target);
319 
334 struct nc_rpc *nc_rpc_get(const char *filter, NC_WD_MODE wd_mode, NC_PARAMTYPE paramtype);
335 
348 struct nc_rpc *nc_rpc_kill(uint32_t session_id);
349 
366 struct nc_rpc *nc_rpc_commit(int confirmed, uint32_t confirm_timeout, const char *persist, const char *persist_id,
367  NC_PARAMTYPE paramtype);
368 
380 struct nc_rpc *nc_rpc_discard(void);
381 
395 struct nc_rpc *nc_rpc_cancel(const char *persist_id, NC_PARAMTYPE paramtype);
396 
411 struct nc_rpc *nc_rpc_validate(NC_DATASTORE source, const char *url_or_config, NC_PARAMTYPE paramtype);
412 
428 struct nc_rpc *nc_rpc_getschema(const char *identifier, const char *version, const char *format, NC_PARAMTYPE paramtype);
429 
446 struct nc_rpc *nc_rpc_subscribe(const char *stream_name, const char *filter, const char *start_time,
447  const char *stop_time, NC_PARAMTYPE paramtype);
448 
470 struct nc_rpc *nc_rpc_getdata(const char *datastore, const char *filter, const char *config_filter, char **origin_filter,
471  int origin_filter_count, int neg_origin_filter, uint16_t max_depth, int with_origin,
472  NC_WD_MODE wd_mode, NC_PARAMTYPE paramtype);
473 
489 struct nc_rpc *nc_rpc_editdata(const char *datastore, NC_RPC_EDIT_DFLTOP default_op, const char *edit_content,
490  NC_PARAMTYPE paramtype);
491 
497 void nc_rpc_free(struct nc_rpc *rpc);
498 
504 void nc_reply_free(struct nc_reply *reply);
505 
511 void nc_notif_free(struct nc_notif *notif);
512 
515 #ifdef __cplusplus
516 }
517 #endif
518 
519 #endif /* NC_MESSAGES_CLIENT_H_ */
nc_rpc_get
struct nc_rpc * nc_rpc_get(const char *filter, NC_WD_MODE wd_mode, NC_PARAMTYPE paramtype)
Create NETCONF RPC <get>
nc_notif_free
void nc_notif_free(struct nc_notif *notif)
Free the NETCONF Notification object.
NC_RPC_GETDATA
@ NC_RPC_GETDATA
Definition: messages_client.h:65
nc_err::ns
const char ** ns
<bad-namespace>, array of the unexpected XML namespaces that caused the error. Part of <error-info>.
Definition: messages_client.h:127
nc_rpc_kill
struct nc_rpc * nc_rpc_kill(uint32_t session_id)
Create NETCONF RPC <kill-session>
nc_rpc_discard
struct nc_rpc * nc_rpc_discard(void)
Create NETCONF RPC <discard-changes>
NC_RPC_EDIT_ERROPT_UNKNOWN
@ NC_RPC_EDIT_ERROPT_UNKNOWN
Definition: messages_client.h:93
NC_RPC_UNKNOWN
@ NC_RPC_UNKNOWN
Definition: messages_client.h:41
netconf.h
libnetconf2's general public functions and structures definitions.
NC_RPC_TYPE
NC_RPC_TYPE
Enumeration of RPC types.
Definition: messages_client.h:40
nc_err::elem
const char ** elem
<bad-element>, array of the names of the data-model-specific XML element that caused the error....
Definition: messages_client.h:125
NC_RPC_GETCONFIG
@ NC_RPC_GETCONFIG
Definition: messages_client.h:45
nc_rpc_act_generic_xml
struct nc_rpc * nc_rpc_act_generic_xml(const char *xml_str, NC_PARAMTYPE paramtype)
Create a generic NETCONF RPC or action from an XML string.
nc_rpc_delete
struct nc_rpc * nc_rpc_delete(NC_DATASTORE target, const char *url, NC_PARAMTYPE paramtype)
Create NETCONF RPC <delete-config>
NC_RPC_LOCK
@ NC_RPC_LOCK
Definition: messages_client.h:49
NC_RPC_EDIT_DFLTOP_REPLACE
@ NC_RPC_EDIT_DFLTOP_REPLACE
Definition: messages_client.h:75
NC_DATASTORE
enum NC_DATASTORE_TYPE NC_DATASTORE
Enumeration of the supported types of datastores defined by NETCONF.
NC_RPC_EDIT_TESTOPT_TESTSET
@ NC_RPC_EDIT_TESTOPT_TESTSET
Definition: messages_client.h:84
nc_notif::datetime
const char * datetime
Definition: messages_client.h:179
nc_err
NETCONF error structure representation.
Definition: messages_client.h:102
NC_RPC_VALIDATE
@ NC_RPC_VALIDATE
Definition: messages_client.h:56
nc_err::other_count
uint16_t other_count
Number of items in the other array.
Definition: messages_client.h:138
nc_rpc_edit
struct nc_rpc * nc_rpc_edit(NC_DATASTORE target, NC_RPC_EDIT_DFLTOP default_op, NC_RPC_EDIT_TESTOPT test_opt, NC_RPC_EDIT_ERROPT error_opt, const char *edit_content, NC_PARAMTYPE paramtype)
Create NETCONF RPC <edit-config>
NC_RPL
enum NC_REPLY NC_RPL
Enumeration of NETCONF (both server and client) rpc-reply types.
NC_RPC_EDIT_DFLTOP_UNKNOWN
@ NC_RPC_EDIT_DFLTOP_UNKNOWN
Definition: messages_client.h:73
nc_err::ns_count
uint16_t ns_count
Number of items in the ns array.
Definition: messages_client.h:136
NC_WD_MODE
enum NC_WITHDEFAULTS_MODE NC_WD_MODE
Enumeration of NETCONF with-defaults capability modes.
nc_err::elem_count
uint16_t elem_count
Number of items in the elem array.
Definition: messages_client.h:134
NC_RPC_EDIT_ERROPT_STOP
@ NC_RPC_EDIT_ERROPT_STOP
Definition: messages_client.h:94
NC_PARAMTYPE
NC_PARAMTYPE
Enumeration of function parameter treatments.
Definition: netconf.h:122
NC_RPC_EDIT_DFLTOP
NC_RPC_EDIT_DFLTOP
Enumeration of <edit-config> default operation.
Definition: messages_client.h:72
nc_reply
NETCONF client rpc-reply object.
Definition: messages_client.h:149
nc_rpc_free
void nc_rpc_free(struct nc_rpc *rpc)
Free the NETCONF RPC object.
nc_rpc_validate
struct nc_rpc * nc_rpc_validate(NC_DATASTORE source, const char *url_or_config, NC_PARAMTYPE paramtype)
Create NETCONF RPC <validate>
nc_rpc_copy
struct nc_rpc * nc_rpc_copy(NC_DATASTORE target, const char *url_trg, NC_DATASTORE source, const char *url_or_config_src, NC_WD_MODE wd_mode, NC_PARAMTYPE paramtype)
Create NETCONF RPC <copy-config>
NC_RPC_DELETE
@ NC_RPC_DELETE
Definition: messages_client.h:48
nc_err::severity
const char * severity
<error-severity>.
Definition: messages_client.h:108
nc_rpc_get_type
NC_RPC_TYPE nc_rpc_get_type(const struct nc_rpc *rpc)
Get the type of the RPC.
nc_err::type
const char * type
<error-type>, error layer where the error occurred.
Definition: messages_client.h:104
nc_rpc_unlock
struct nc_rpc * nc_rpc_unlock(NC_DATASTORE target)
Create NETCONF RPC <unlock>
NC_RPC_EDIT_DFLTOP_MERGE
@ NC_RPC_EDIT_DFLTOP_MERGE
Definition: messages_client.h:74
nc_reply_data
NETCONF client data rpc-reply object.
Definition: messages_client.h:156
nc_rpc_getschema
struct nc_rpc * nc_rpc_getschema(const char *identifier, const char *version, const char *format, NC_PARAMTYPE paramtype)
Create NETCONF RPC <get-schema>
NC_RPC_COPY
@ NC_RPC_COPY
Definition: messages_client.h:47
NC_RPC_EDIT
@ NC_RPC_EDIT
Definition: messages_client.h:46
nc_rpc_getconfig
struct nc_rpc * nc_rpc_getconfig(NC_DATASTORE source, const char *filter, NC_WD_MODE wd_mode, NC_PARAMTYPE paramtype)
Create NETCONF RPC <get-config>
NC_RPC_EDIT_ERROPT_ROLLBACK
@ NC_RPC_EDIT_ERROPT_ROLLBACK
Definition: messages_client.h:96
NC_RPC_CANCEL
@ NC_RPC_CANCEL
Definition: messages_client.h:55
nc_err::apptag
const char * apptag
<error-app-tag>, the data-model-specific or implementation-specific error condition,...
Definition: messages_client.h:110
NC_RPC_EDIT_TESTOPT_SET
@ NC_RPC_EDIT_TESTOPT_SET
Definition: messages_client.h:85
NC_RPC_SUBSCRIBE
@ NC_RPC_SUBSCRIBE
Definition: messages_client.h:62
nc_err::other
struct lyxml_elem ** other
Array of the remaining non-standard elements.
Definition: messages_client.h:129
nc_rpc_editdata
struct nc_rpc * nc_rpc_editdata(const char *datastore, NC_RPC_EDIT_DFLTOP default_op, const char *edit_content, NC_PARAMTYPE paramtype)
Create NETCONF RPC <get-data>
nc_err::path
const char * path
<error-path>, XPATH expression identifying the element with the error.
Definition: messages_client.h:112
nc_rpc_commit
struct nc_rpc * nc_rpc_commit(int confirmed, uint32_t confirm_timeout, const char *persist, const char *persist_id, NC_PARAMTYPE paramtype)
Create NETCONF RPC <commit>
NC_RPC_UNLOCK
@ NC_RPC_UNLOCK
Definition: messages_client.h:50
nc_reply_data::data
struct lyd_node * data
Definition: messages_client.h:158
nc_rpc_getdata
struct nc_rpc * nc_rpc_getdata(const char *datastore, const char *filter, const char *config_filter, char **origin_filter, int origin_filter_count, int neg_origin_filter, uint16_t max_depth, int with_origin, NC_WD_MODE wd_mode, NC_PARAMTYPE paramtype)
Create NETCONF RPC <get-data>
nc_reply::type
NC_RPL type
Definition: messages_client.h:150
nc_rpc_act_generic
struct nc_rpc * nc_rpc_act_generic(const struct lyd_node *data, NC_PARAMTYPE paramtype)
Create a generic NETCONF RPC or action.
NC_RPC_DISCARD
@ NC_RPC_DISCARD
Definition: messages_client.h:54
nc_rpc_subscribe
struct nc_rpc * nc_rpc_subscribe(const char *stream_name, const char *filter, const char *start_time, const char *stop_time, NC_PARAMTYPE paramtype)
Create NETCONF RPC <create-subscription>
nc_err::sid
const char * sid
<session-id>, session ID of the session holding the requested lock. Part of <error-info>.
Definition: messages_client.h:121
NC_RPC_EDIT_ERROPT_CONTINUE
@ NC_RPC_EDIT_ERROPT_CONTINUE
Definition: messages_client.h:95
NC_RPC_ACT_GENERIC
@ NC_RPC_ACT_GENERIC
Definition: messages_client.h:42
nc_reply_error::count
uint32_t count
Definition: messages_client.h:171
NC_RPC_EDITDATA
@ NC_RPC_EDITDATA
Definition: messages_client.h:66
nc_rpc_cancel
struct nc_rpc * nc_rpc_cancel(const char *persist_id, NC_PARAMTYPE paramtype)
Create NETCONF RPC <cancel-commit>
nc_err::message
const char * message
<error-message>, Human-readable description of the error.
Definition: messages_client.h:114
nc_err::message_lang
const char * message_lang
xml:lang attribute of the error-message.
Definition: messages_client.h:116
nc_rpc_lock
struct nc_rpc * nc_rpc_lock(NC_DATASTORE target)
Create NETCONF RPC <lock>
nc_reply_error
NETCONF client error rpc-reply object.
Definition: messages_client.h:168
nc_notif::tree
struct lyd_node * tree
Definition: messages_client.h:180
NC_RPC_EDIT_TESTOPT
NC_RPC_EDIT_TESTOPT
Enumeration of <edit-config> test option.
Definition: messages_client.h:82
NC_RPC_GET
@ NC_RPC_GET
Definition: messages_client.h:51
NC_RPC_KILL
@ NC_RPC_KILL
Definition: messages_client.h:52
nc_reply_error::err
const struct nc_err * err
Definition: messages_client.h:170
nc_notif
NETCONF client notification object.
Definition: messages_client.h:177
NC_RPC_GETSCHEMA
@ NC_RPC_GETSCHEMA
Definition: messages_client.h:59
nc_err::attr_count
uint16_t attr_count
Number of items in the attr array.
Definition: messages_client.h:132
nc_err::attr
const char ** attr
<bad-attr>, array of the names of the data-model-specific XML attributes that caused the error....
Definition: messages_client.h:123
NC_RPC_COMMIT
@ NC_RPC_COMMIT
Definition: messages_client.h:53
NC_RPC_EDIT_TESTOPT_UNKNOWN
@ NC_RPC_EDIT_TESTOPT_UNKNOWN
Definition: messages_client.h:83
NC_RPC_EDIT_ERROPT
NC_RPC_EDIT_ERROPT
Enumeration of <edit-config> error option.
Definition: messages_client.h:92
NC_RPC_EDIT_DFLTOP_NONE
@ NC_RPC_EDIT_DFLTOP_NONE
Definition: messages_client.h:76
NC_RPC_EDIT_TESTOPT_TEST
@ NC_RPC_EDIT_TESTOPT_TEST
Definition: messages_client.h:86
nc_err::tag
const char * tag
<error-tag>.
Definition: messages_client.h:106
nc_reply_free
void nc_reply_free(struct nc_reply *reply)
Free the NETCONF RPC reply object.