libnetconf  0.10.0-0.10.0
NETCONF Library
notifications.h
Go to the documentation of this file.
1 
40 #ifndef NC_NOTIFICATIONS_H_
41 #define NC_NOTIFICATIONS_H_
42 
43 #include <time.h>
44 
45 #include "netconf.h"
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 #define NCNTF_STREAM_DEFAULT "NETCONF"
52 #define NCNTF_STREAM_BASE NCNTF_STREAM_DEFAULT
53 
58 typedef enum {
59  NCNTF_ERROR = -1,
68 } NCNTF_EVENT;
69 
74 typedef enum {
78 
85 char* ncntf_status(void);
86 
95 int ncntf_stream_new(const char* name, const char* desc, int replay);
96 
105 int ncntf_stream_allow_events(const char* stream, const char* event);
106 
113 char** ncntf_stream_list(void);
114 
127 int ncntf_stream_info(const char* stream, char** desc, char** start);
128 
135 int ncntf_stream_isavailable(const char* name);
136 
144 void ncntf_stream_iter_start(const char* stream);
145 
157 char* ncntf_stream_iter_next(const char* stream, time_t start, time_t stop, time_t *event_time);
158 
166 void ncntf_stream_iter_finish(const char* stream);
167 
214 int ncntf_event_new(time_t etime, NCNTF_EVENT event, ...);
215 
224 nc_ntf* ncntf_notif_create(time_t event_time, const char* content);
225 
231 void ncntf_notif_free(nc_ntf *ntf);
232 
241 
248 char* ncntf_notif_get_content(const nc_ntf* notif);
249 
256 time_t ncntf_notif_get_time(const nc_ntf* notif);
257 
270 nc_reply* ncntf_subscription_check(const nc_rpc* subscribe_rpc);
271 
285 long long int ncntf_dispatch_send(struct nc_session* session, const nc_rpc* subscribe_rpc);
286 
301 long long int ncntf_dispatch_receive(struct nc_session *session, void (*process_ntf)(time_t eventtime, const char* content));
302 
311 int ncntf_session_get_active_subscription(struct nc_session *session);
312 
313 #ifdef __cplusplus
314 }
315 #endif
316 
317 #endif /* NC_NOTIFICATIONS_H_ */
char ** ncntf_stream_list(void)
Get the list of NETCONF event notifications streams.
char * ncntf_notif_get_content(const nc_ntf *notif)
Get description of the event reported in the notification message.
NCNTF_EVENT_BY
Enumeration of the possible source of events.
Definition: notifications.h:74
struct nc_msg nc_reply
reply message.
Definition: netconf.h:62
long long int ncntf_dispatch_receive(struct nc_session *session, void(*process_ntf)(time_t eventtime, const char *content))
Subscribe for receiving notifications from the given session according to parameters in the given sub...
struct nc_msg nc_ntf
Event notification message.
Definition: netconf.h:68
char * ncntf_stream_iter_next(const char *stream, time_t start, time_t stop, time_t *event_time)
Pop the next event record from the stream file. The iteration must be started by nc_ntf_stream_iter_s...
nc_ntf * ncntf_notif_create(time_t event_time, const char *content)
Create a new <notification> message with the given eventTime and content.
Definition: notifications.h:76
int ncntf_stream_isavailable(const char *name)
Test if the given stream is already created and available.
struct nc_msg nc_rpc
rpc message.
Definition: netconf.h:56
int ncntf_stream_new(const char *name, const char *desc, int replay)
Create a new NETCONF event stream.
long long int ncntf_dispatch_send(struct nc_session *session, const nc_rpc *subscribe_rpc)
Start sending notifications according to the given <create-subscription> NETCONF RPC request...
int ncntf_session_get_active_subscription(struct nc_session *session)
Check if a session has an active notification subscription.
nc_reply * ncntf_subscription_check(const nc_rpc *subscribe_rpc)
Check validity of <create-subscription> message.
int ncntf_event_new(time_t etime, NCNTF_EVENT event,...)
Store a new event in the specified stream. Parameters are specific for different events.
Definition: notifications.h:59
Definition: notifications.h:75
NCNTF_EVENT
Enumeration of supported NETCONF event notifications.
Definition: notifications.h:58
Definition: notifications.h:62
Definition: notifications.h:61
NCNTF_EVENT ncntf_notif_get_type(const nc_ntf *notif)
Get a specific notification type.
time_t ncntf_notif_get_time(const nc_ntf *notif)
Get Time of the event reported in the notification message.
int ncntf_stream_allow_events(const char *stream, const char *event)
Set the rule to allow logging of the specified event on the given Notification stream.
char * ncntf_status(void)
Get the status data in xml form describing the currently used streams.
void ncntf_stream_iter_start(const char *stream)
Start iteration on the events in the specified stream file. Iteration starts on the first event in th...
Definition: notifications.h:60
int ncntf_stream_info(const char *stream, char **desc, char **start)
Get some more details about the specified NETCONF event notifications stream.
Definition: notifications.h:64
Definition: notifications.h:63
void ncntf_stream_iter_finish(const char *stream)
Clean all the structures used for iteration in the specified stream. This function must be called as ...
void ncntf_notif_free(nc_ntf *ntf)
Free the notification message.
Definition: notifications.h:67
libnetconf&#39;s general public functions and structures definitions.
Definition: notifications.h:66
Definition: notifications.h:65