messages_server.h
Go to the documentation of this file.
#ifndef NC_MESSAGES_SERVER_H_
#define NC_MESSAGES_SERVER_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <libyang/libyang.h>
#include <stdint.h>
#include "netconf.h"
#include "session.h"
typedef enum NC_ERROR {
NC_ERR_UNKNOWN = 0,
NC_ERR_IN_USE,
NC_ERR_INVALID_VALUE,
NC_ERR_TOO_BIG,
NC_ERR_MISSING_ATTR,
NC_ERR_BAD_ATTR,
NC_ERR_UNKNOWN_ATTR,
NC_ERR_MISSING_ELEM,
NC_ERR_BAD_ELEM,
NC_ERR_UNKNOWN_ELEM,
NC_ERR_UNKNOWN_NS,
NC_ERR_ACCESS_DENIED,
NC_ERR_LOCK_DENIED,
NC_ERR_RES_DENIED,
NC_ERR_ROLLBACK_FAILED,
NC_ERR_DATA_EXISTS,
NC_ERR_DATA_MISSING,
NC_ERR_OP_NOT_SUPPORTED,
NC_ERR_OP_FAILED,
NC_ERR_MALFORMED_MSG
} NC_ERR;
typedef enum NC_ERROR_TYPE {
NC_ERR_TYPE_UNKNOWN = 0,
NC_ERR_TYPE_TRAN,
NC_ERR_TYPE_RPC,
NC_ERR_TYPE_PROT,
NC_ERR_TYPE_APP
} NC_ERR_TYPE;
struct nc_server_reply;
struct nc_server_notif;
struct nc_server_error;
struct nc_server_reply *nc_server_reply_ok(void);
struct nc_server_reply *nc_server_reply_data(struct lyd_node *data, NC_WD_MODE wd, NC_PARAMTYPE paramtype);
struct nc_server_reply *nc_server_reply_err(struct lyd_node *err);
int nc_server_reply_add_err(struct nc_server_reply *reply, struct lyd_node *err);
const struct lyd_node *nc_server_reply_get_last_err(const struct nc_server_reply *reply);
struct lyd_node *nc_err(const struct ly_ctx *ctx, NC_ERR tag, ...);
NC_ERR_TYPE nc_err_get_type(const struct lyd_node *err);
NC_ERR nc_err_get_tag(const struct lyd_node *err);
int nc_err_set_app_tag(struct lyd_node *err, const char *error_app_tag);
const char *nc_err_get_app_tag(const struct lyd_node *err);
int nc_err_set_path(struct lyd_node *err, const char *error_path);
const char *nc_err_get_path(const struct lyd_node *err);
int nc_err_set_msg(struct lyd_node *err, const char *error_message, const char *lang);
const char *nc_err_get_msg(const struct lyd_node *err);
int nc_err_set_sid(struct lyd_node *err, uint32_t session_id);
int nc_err_add_bad_attr(struct lyd_node *err, const char *attr_name);
int nc_err_add_bad_elem(struct lyd_node *err, const char *elem_name);
int nc_err_add_bad_ns(struct lyd_node *err, const char *ns_name);
int nc_err_add_info_other(struct lyd_node *err, struct lyd_node *other);
void nc_server_reply_free(struct nc_server_reply *reply);
struct nc_server_notif *nc_server_notif_new(struct lyd_node *event, char *eventtime, NC_PARAMTYPE paramtype);
NC_MSG_TYPE nc_server_notif_send(struct nc_session *session, struct nc_server_notif *notif, int timeout);
void nc_server_notif_free(struct nc_server_notif *notif);
const char *nc_server_notif_get_time(const struct nc_server_notif *notif);
#ifdef __cplusplus
}
#endif
#endif /* NC_MESSAGES_SERVER_H_ */
NC_MSG_TYPE
NC_MSG_TYPE
Enumeration of NETCONF message types.
Definition: netconf.h:69
NC_WD_MODE
enum NC_WITHDEFAULTS_MODE NC_WD_MODE
Enumeration of NETCONF with-defaults capability modes.
NC_PARAMTYPE
NC_PARAMTYPE
Enumeration of function parameter treatments.
Definition: netconf.h:122
nc_server_reply_err
struct nc_server_reply * nc_server_reply_err(struct lyd_node *err)
Create an ERROR rpc-reply object.
NC_ERR_TYPE
enum NC_ERROR_TYPE NC_ERR_TYPE
Enumeration of NETCONF error type (layer)
nc_err_add_bad_attr
int nc_err_add_bad_attr(struct lyd_node *err, const char *attr_name)
Add a <bad-attribute> element to an error.
nc_server_reply_add_err
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_get_app_tag
const char * nc_err_get_app_tag(const struct lyd_node *err)
Get the <error-app-tag> of a server error.
nc_server_notif_get_time
const char * nc_server_notif_get_time(const struct nc_server_notif *notif)
Get the notification timestamp.
nc_err_get_type
NC_ERR_TYPE nc_err_get_type(const struct lyd_node *err)
Get the <error-type> of a server error.
nc_server_notif_free
void nc_server_notif_free(struct nc_server_notif *notif)
Free a server Event Notification object.
NC_ERROR
NC_ERROR
Enumeration of NETCONF errors.
Definition: messages_server.h:39
nc_err_set_sid
int nc_err_set_sid(struct lyd_node *err, uint32_t session_id)
Set the <session-id> element of an error. Any previous value will be overwritten.
nc_server_notif_send
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.
nc_err_set_path
int nc_err_set_path(struct lyd_node *err, const char *error_path)
Set the <error-path> element of an error. Any previous value will be overwritten.
nc_server_reply_free
void nc_server_reply_free(struct nc_server_reply *reply)
Free a server rpc-reply object.
nc_err_get_msg
const char * nc_err_get_msg(const struct lyd_node *err)
Get the <error-message> of a server error.
NC_ERR
enum NC_ERROR NC_ERR
Enumeration of NETCONF errors.
nc_server_reply_data
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.
nc_err_add_bad_elem
int nc_err_add_bad_elem(struct lyd_node *err, const char *elem_name)
Add a <bad-element> element to an error.
nc_server_reply_ok
struct nc_server_reply * nc_server_reply_ok(void)
Create an OK rpc-reply object.
nc_server_reply_get_last_err
const struct lyd_node * nc_server_reply_get_last_err(const struct nc_server_reply *reply)
Get last error from an ERROR rpc-reply object.
nc_err
struct lyd_node * nc_err(const struct ly_ctx *ctx, NC_ERR tag,...)
Create a server error structure. Its <error-message> is filled with a general description of the spec...
nc_err_set_app_tag
int nc_err_set_app_tag(struct lyd_node *err, const char *error_app_tag)
Set the <error-app-tag> element of an error. Any previous value will be overwritten.
nc_err_set_msg
int nc_err_set_msg(struct lyd_node *err, const char *error_message, const char *lang)
Set the <error-message> element of an error. Any previous value will be overwritten.
nc_err_add_info_other
int nc_err_add_info_other(struct lyd_node *err, struct lyd_node *other)
Add an additional custom element to an error.
nc_err_add_bad_ns
int nc_err_add_bad_ns(struct lyd_node *err, const char *ns_name)
Add a <bad-namespace> element to an error.
nc_err_get_tag
NC_ERR nc_err_get_tag(const struct lyd_node *err)
Get the <error-tag> of a server error.
nc_err_get_path
const char * nc_err_get_path(const struct lyd_node *err)
Get the <error-path> of a server error.
NC_ERROR_TYPE
NC_ERROR_TYPE
Enumeration of NETCONF error type (layer)
Definition: messages_server.h:65
nc_server_notif_new
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_RES_DENIED
@ NC_ERR_RES_DENIED
Definition: messages_server.h:53
NC_ERR_INVALID_VALUE
@ NC_ERR_INVALID_VALUE
Definition: messages_server.h:42
NC_ERR_ROLLBACK_FAILED
@ NC_ERR_ROLLBACK_FAILED
Definition: messages_server.h:54
NC_ERR_UNKNOWN_ATTR
@ NC_ERR_UNKNOWN_ATTR
Definition: messages_server.h:46
NC_ERR_UNKNOWN
@ NC_ERR_UNKNOWN
Definition: messages_server.h:40
NC_ERR_BAD_ATTR
@ NC_ERR_BAD_ATTR
Definition: messages_server.h:45
NC_ERR_DATA_EXISTS
@ NC_ERR_DATA_EXISTS
Definition: messages_server.h:55
NC_ERR_IN_USE
@ NC_ERR_IN_USE
Definition: messages_server.h:41
NC_ERR_UNKNOWN_ELEM
@ NC_ERR_UNKNOWN_ELEM
Definition: messages_server.h:49
NC_ERR_ACCESS_DENIED
@ NC_ERR_ACCESS_DENIED
Definition: messages_server.h:51
NC_ERR_OP_NOT_SUPPORTED
@ NC_ERR_OP_NOT_SUPPORTED
Definition: messages_server.h:57
NC_ERR_UNKNOWN_NS
@ NC_ERR_UNKNOWN_NS
Definition: messages_server.h:50
NC_ERR_MISSING_ATTR
@ NC_ERR_MISSING_ATTR
Definition: messages_server.h:44
NC_ERR_LOCK_DENIED
@ NC_ERR_LOCK_DENIED
Definition: messages_server.h:52
NC_ERR_MALFORMED_MSG
@ NC_ERR_MALFORMED_MSG
Definition: messages_server.h:59
NC_ERR_DATA_MISSING
@ NC_ERR_DATA_MISSING
Definition: messages_server.h:56
NC_ERR_BAD_ELEM
@ NC_ERR_BAD_ELEM
Definition: messages_server.h:48
NC_ERR_MISSING_ELEM
@ NC_ERR_MISSING_ELEM
Definition: messages_server.h:47
NC_ERR_TOO_BIG
@ NC_ERR_TOO_BIG
Definition: messages_server.h:43
NC_ERR_OP_FAILED
@ NC_ERR_OP_FAILED
Definition: messages_server.h:58
NC_ERR_TYPE_RPC
@ NC_ERR_TYPE_RPC
Definition: messages_server.h:68
NC_ERR_TYPE_UNKNOWN
@ NC_ERR_TYPE_UNKNOWN
Definition: messages_server.h:66
NC_ERR_TYPE_TRAN
@ NC_ERR_TYPE_TRAN
Definition: messages_server.h:67
NC_ERR_TYPE_APP
@ NC_ERR_TYPE_APP
Definition: messages_server.h:70
NC_ERR_TYPE_PROT
@ NC_ERR_TYPE_PROT
Definition: messages_server.h:69
netconf.h
libnetconf2's general public functions and structures definitions.
session.h
libnetconf2 session manipulation