libnetconf2  1.1.48
NETCONF library for clients and servers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
messages_server.h
Go to the documentation of this file.
1 
15 #ifndef NC_MESSAGES_SERVER_H_
16 #define NC_MESSAGES_SERVER_H_
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 #include <stdint.h>
23 #include <libyang/libyang.h>
24 
25 #include "netconf.h"
26 #include "session.h"
27 
39 typedef enum NC_ERROR {
60 } NC_ERR;
61 
65 typedef enum NC_ERROR_TYPE {
71 } NC_ERR_TYPE;
72 
76 struct nc_server_reply;
77 
81 struct nc_server_notif;
82 
86 struct nc_server_error;
87 
93 struct nc_server_reply *nc_server_reply_ok(void);
94 
104 struct nc_server_reply *nc_server_reply_data(struct lyd_node *data, NC_WD_MODE wd, NC_PARAMTYPE paramtype);
105 
112 struct nc_server_reply *nc_server_reply_err(struct nc_server_error *err);
113 
121 int nc_server_reply_add_err(struct nc_server_reply *reply, struct nc_server_error *err);
122 
129 const struct nc_server_error *nc_server_reply_get_last_err(const struct nc_server_reply *reply);
130 
169 struct nc_server_error *nc_err(int tag, ...);
170 
180 struct nc_server_error *nc_err_libyang(struct ly_ctx *ctx);
181 
188 NC_ERR_TYPE nc_err_get_type(const struct nc_server_error *err);
189 
196 NC_ERR nc_err_get_tag(const struct nc_server_error *err);
197 
205 int nc_err_set_app_tag(struct nc_server_error *err, const char *error_app_tag);
206 
213 const char *nc_err_get_app_tag(const struct nc_server_error *err);
214 
222 int nc_err_set_path(struct nc_server_error *err, const char *error_path);
223 
230 const char *nc_err_get_path(const struct nc_server_error *err);
231 
240 int nc_err_set_msg(struct nc_server_error *err, const char *error_message, const char *lang);
241 
248 const char *nc_err_get_msg(const struct nc_server_error *err);
249 
257 int nc_err_set_sid(struct nc_server_error *err, uint32_t session_id);
258 
266 int nc_err_add_bad_attr(struct nc_server_error *err, const char *attr_name);
267 
275 int nc_err_add_bad_elem(struct nc_server_error *err, const char *elem_name);
276 
284 int nc_err_add_bad_ns(struct nc_server_error *err, const char *ns_name);
285 
293 int nc_err_add_info_other(struct nc_server_error *err, struct lyxml_elem *other);
294 
300 void nc_server_reply_free(struct nc_server_reply *reply);
301 
307 void nc_err_free(struct nc_server_error *err);
308 
320 struct nc_server_notif *nc_server_notif_new(struct lyd_node *event, char *eventtime, NC_PARAMTYPE paramtype);
321 
334 NC_MSG_TYPE nc_server_notif_send(struct nc_session *session, struct nc_server_notif *notif, int timeout);
335 
341 void nc_server_notif_free(struct nc_server_notif *notif);
342 
349 const char *nc_server_notif_get_time(const struct nc_server_notif *notif);
350 
353 #ifdef __cplusplus
354 }
355 #endif
356 
357 #endif /* NC_MESSAGES_SERVER_H_ */
NC_MSG_TYPE
Enumeration of NETCONF message types.
Definition: netconf.h:69
NC_ERR nc_err_get_tag(const struct nc_server_error *err)
Get the &lt;error-tag&gt; of a server error.
int nc_err_add_bad_ns(struct nc_server_error *err, const char *ns_name)
Add a &lt;bad-namespace&gt; element to an error.
enum NC_ERROR_TYPE NC_ERR_TYPE
Enumeration of NETCONF error type (layer)
int nc_err_set_sid(struct nc_server_error *err, uint32_t session_id)
Set the &lt;session-id&gt; element of an error. Any previous value will be overwritten. ...
libnetconf2 session manipulation
const char * nc_server_notif_get_time(const struct nc_server_notif *notif)
Get the notification timestamp.
int nc_err_set_path(struct nc_server_error *err, const char *error_path)
Set the &lt;error-path&gt; element of an error. Any previous value will be overwritten. ...
struct nc_server_reply * nc_server_reply_ok(void)
Create an OK rpc-reply object.
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).
NC_ERR_TYPE nc_err_get_type(const struct nc_server_error *err)
Get the &lt;error-type&gt; of a server error.
int nc_err_set_msg(struct nc_server_error *err, const char *error_message, const char *lang)
Set the &lt;error-message&gt; element of an error. Any previous value will be overwritten.
int nc_server_reply_add_err(struct nc_server_reply *reply, struct nc_server_error *err)
Add another error to an ERROR rpc-reply object. It will be freed with the returned object...
NC_PARAMTYPE
Enumeration of function parameter treatments.
Definition: netconf.h:122
struct nc_server_reply * nc_server_reply_err(struct nc_server_error *err)
Create an ERROR rpc-reply object.
int nc_err_set_app_tag(struct nc_server_error *err, const char *error_app_tag)
Set the &lt;error-app-tag&gt; element of an error. Any previous value will be overwritten.
NC_ERROR_TYPE
Enumeration of NETCONF error type (layer)
enum NC_WITHDEFAULTS_MODE NC_WD_MODE
Enumeration of NETCONF with-defaults capability modes.
int nc_err_add_info_other(struct nc_server_error *err, struct lyxml_elem *other)
Add an additional custom element to an error.
int nc_err_add_bad_elem(struct nc_server_error *err, const char *elem_name)
Add a &lt;bad-element&gt; element to an error.
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.
struct nc_server_error * nc_server_reply_get_last_err(const struct nc_server_reply *reply)
Get last error from an ERROR rpy-reply object.
const char * nc_err_get_msg(const struct nc_server_error *err)
Get the &lt;error-message&gt; of a server error.
void nc_err_free(struct nc_server_error *err)
Free a server error structure.
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.
void nc_server_notif_free(struct nc_server_notif *notif)
Free a server Event Notification object.
struct nc_server_error * nc_err(int tag,...)
Create a server error structure. Its &lt;error-message&gt; is filled with a general description of the spec...
int nc_err_add_bad_attr(struct nc_server_error *err, const char *attr_name)
Add a &lt;bad-attribute&gt; element to an error.
const char * nc_err_get_app_tag(const struct nc_server_error *err)
Get the &lt;error-app-tag&gt; of a server error.
libnetconf2&#39;s general public functions and structures definitions.
const char * nc_err_get_path(const struct nc_server_error *err)
Get the &lt;error-path&gt; of a server error.
NC_ERROR
Enumeration of NETCONF errors.
struct nc_server_error * nc_err_libyang(struct ly_ctx *ctx)
Create a server error structure based on libyang error.