libnetconf2  3.5.4
NETCONF server and client library in C.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
messages_server.h
Go to the documentation of this file.
1 
16 #ifndef NC_MESSAGES_SERVER_H_
17 #define NC_MESSAGES_SERVER_H_
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #include <stdarg.h>
24 #include <stdint.h>
25 
26 #include <libyang/libyang.h>
27 
28 #include "netconf.h"
29 #include "session.h"
30 
42 typedef enum NC_ERROR {
63 } NC_ERR;
64 
68 typedef enum NC_ERROR_TYPE {
74 } NC_ERR_TYPE;
75 
79 struct nc_server_reply;
80 
84 struct nc_server_notif;
85 
89 struct nc_server_error;
90 
96 struct nc_server_reply *nc_server_reply_ok(void);
97 
107 struct nc_server_reply *nc_server_reply_data(struct lyd_node *data, NC_WD_MODE wd, NC_PARAMTYPE paramtype);
108 
115 struct nc_server_reply *nc_server_reply_err(struct lyd_node *err);
116 
124 int nc_server_reply_add_err(struct nc_server_reply *reply, struct lyd_node *err);
125 
132 const struct lyd_node *nc_server_reply_get_last_err(const struct nc_server_reply *reply);
133 
174 struct lyd_node *nc_err(const struct ly_ctx *ctx, NC_ERR tag, ...);
175 
182 NC_ERR_TYPE nc_err_get_type(const struct lyd_node *err);
183 
190 NC_ERR nc_err_get_tag(const struct lyd_node *err);
191 
199 int nc_err_set_app_tag(struct lyd_node *err, const char *error_app_tag);
200 
207 const char *nc_err_get_app_tag(const struct lyd_node *err);
208 
216 int nc_err_set_path(struct lyd_node *err, const char *error_path);
217 
224 const char *nc_err_get_path(const struct lyd_node *err);
225 
234 int nc_err_set_msg(struct lyd_node *err, const char *error_message, const char *lang);
235 
242 const char *nc_err_get_msg(const struct lyd_node *err);
243 
251 int nc_err_set_sid(struct lyd_node *err, uint32_t session_id);
252 
260 int nc_err_add_bad_attr(struct lyd_node *err, const char *attr_name);
261 
269 int nc_err_add_bad_elem(struct lyd_node *err, const char *elem_name);
270 
278 int nc_err_add_bad_ns(struct lyd_node *err, const char *ns_name);
279 
287 int nc_err_add_info_other(struct lyd_node *err, struct lyd_node *other);
288 
294 void nc_server_reply_free(struct nc_server_reply *reply);
295 
307 struct nc_server_notif *nc_server_notif_new(struct lyd_node *event, char *eventtime, NC_PARAMTYPE paramtype);
308 
321 NC_MSG_TYPE nc_server_notif_send(struct nc_session *session, struct nc_server_notif *notif, int timeout);
322 
328 void nc_server_notif_free(struct nc_server_notif *notif);
329 
336 const char *nc_server_notif_get_time(const struct nc_server_notif *notif);
337 
340 #ifdef __cplusplus
341 }
342 #endif
343 
344 #endif /* NC_MESSAGES_SERVER_H_ */
NC_MSG_TYPE
Enumeration of NETCONF message types.
Definition: netconf.h:68
enum NC_ERROR_TYPE NC_ERR_TYPE
Enumeration of NETCONF error type (layer)
int nc_err_add_bad_elem(struct lyd_node *err, const char *elem_name)
Add a &lt;bad-element&gt; element to an error.
libnetconf2 session manipulation
const char * nc_server_notif_get_time(const struct nc_server_notif *notif)
Get the notification timestamp.
const char * nc_err_get_path(const struct lyd_node *err)
Get the &lt;error-path&gt; of a server error.
int nc_server_reply_add_err(struct nc_server_reply *reply, struct lyd_node *err)
Add another error opaque data node tree to an ERROR rpc-reply object.
NC_ERR_TYPE nc_err_get_type(const struct lyd_node *err)
Get the &lt;error-type&gt; of a server error.
struct nc_server_reply * nc_server_reply_ok(void)
Create an OK rpc-reply object.
int nc_err_add_bad_attr(struct lyd_node *err, const char *attr_name)
Add a &lt;bad-attribute&gt; element to an error.
int nc_err_set_app_tag(struct lyd_node *err, const char *error_app_tag)
Set the &lt;error-app-tag&gt; element of an error. Any previous value will be overwritten.
int nc_err_add_bad_ns(struct lyd_node *err, const char *ns_name)
Add a &lt;bad-namespace&gt; element to an error.
void nc_server_reply_free(struct nc_server_reply *reply)
Free a server rpc-reply object.
struct nc_server_notif * nc_server_notif_new(struct lyd_node *event, char *eventtime, NC_PARAMTYPE paramtype)
Create Event Notification object to be sent to the subscribed client(s).
int nc_err_add_info_other(struct lyd_node *err, struct lyd_node *other)
Add an additional custom element to an error.
struct lyd_node * nc_err(const struct ly_ctx *ctx, NC_ERR tag,...)
Create a server error structure. Its &lt;error-message&gt; is filled with a general description of the spec...
int nc_err_set_sid(struct lyd_node *err, uint32_t session_id)
Set the &lt;session-id&gt; element of an error. Any previous value will be overwritten. ...
const char * nc_err_get_msg(const struct lyd_node *err)
Get the &lt;error-message&gt; of a server error.
int nc_err_set_msg(struct lyd_node *err, const char *error_message, const char *lang)
Set the &lt;error-message&gt; element of an error. Any previous value will be overwritten.
NC_PARAMTYPE
Enumeration of function parameter treatments.
Definition: netconf.h:121
NC_ERR nc_err_get_tag(const struct lyd_node *err)
Get the &lt;error-tag&gt; of a server error.
NC_ERROR_TYPE
Enumeration of NETCONF error type (layer)
enum NC_WITHDEFAULTS_MODE NC_WD_MODE
Enumeration of NETCONF with-defaults capability modes.
struct nc_server_reply * nc_server_reply_data(struct lyd_node *data, NC_WD_MODE wd, NC_PARAMTYPE paramtype)
Create a DATA rpc-reply object.
const char * nc_err_get_app_tag(const struct lyd_node *err)
Get the &lt;error-app-tag&gt; of a server error.
NC_MSG_TYPE nc_server_notif_send(struct nc_session *session, struct nc_server_notif *notif, int timeout)
Send NETCONF Event Notification via the session.
enum NC_ERROR NC_ERR
Enumeration of NETCONF errors.
struct lyd_node * nc_server_reply_get_last_err(const struct nc_server_reply *reply)
Get last error from an ERROR rpc-reply object.
void nc_server_notif_free(struct nc_server_notif *notif)
Free a server Event Notification object.
struct nc_server_reply * nc_server_reply_err(struct lyd_node *err)
Create an ERROR rpc-reply object.
libnetconf2&#39;s general public functions and structures definitions.
NC_ERROR
Enumeration of NETCONF errors.
int nc_err_set_path(struct lyd_node *err, const char *error_path)
Set the &lt;error-path&gt; element of an error. Any previous value will be overwritten. ...