libnetconf
0.10.0-146_trunk
NETCONF Library
|
libnetconf's implementation of NETCONF asynchronous message delivery as defined in RFC 5277. More...
Typedefs | |
typedef struct nc_msg | nc_ntf |
Event notification message. More... | |
Enumerations | |
enum | NCNTF_EVENT { NCNTF_ERROR = -1, NCNTF_GENERIC = 0, NCNTF_REPLAY_COMPLETE = 1, NCNTF_NTF_COMPLETE = 2, NCNTF_BASE_CFG_CHANGE = 3, NCNTF_BASE_CPBLT_CHANGE = 4, NCNTF_BASE_SESSION_START = 5, NCNTF_BASE_SESSION_END = 6, NCNTF_BASE_CONFIRMED_COMMIT = 7 } |
Enumeration of supported NETCONF event notifications. More... | |
enum | NCNTF_EVENT_BY { NCNTF_EVENT_BY_SERVER, NCNTF_EVENT_BY_USER } |
Enumeration of the possible source of events. More... | |
Functions | |
nc_rpc * | nc_rpc_subscribe (const char *stream, const struct nc_filter *filter, const time_t *start, const time_t *stop) |
Create <create-subsciption> NETCONF rpc message. More... | |
NC_MSG_TYPE | nc_session_recv_notif (struct nc_session *session, int timeout, nc_ntf **ntf) |
Receive a <notification> message from the specified NETCONF session. This function is supposed to be performed only by NETCONF clients. More... | |
int | nc_session_send_notif (struct nc_session *session, const nc_ntf *ntf) |
Send <notification> message from server to client. More... | |
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 subscribtion RPC. Received notifications are processed by the given process_ntf callback function. Functions stops when the final notification <notificationComplete> is received or when the session is terminated. More... | |
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. All events from the specified stream are processed and sent to the client until the stop time is reached or until the session is terminated. More... | |
int | ncntf_event_new (time_t etime, NCNTF_EVENT event,...) |
Store a new event in the specified stream. Parameters are specific for different events. More... | |
nc_ntf * | ncntf_notif_create (time_t event_time, const char *content) |
Create a new <notification> message with the given eventTime and content. More... | |
void | ncntf_notif_free (nc_ntf *ntf) |
Free the notification message. More... | |
char * | ncntf_notif_get_content (const nc_ntf *notif) |
Get description of the event reported in the notification message. More... | |
time_t | ncntf_notif_get_time (const nc_ntf *notif) |
Get Time of the event reported in the notification message. More... | |
NCNTF_EVENT | ncntf_notif_get_type (const nc_ntf *notif) |
Get a specific notification type. More... | |
int | ncntf_session_get_active_subscription (struct nc_session *session) |
Check if a session has an active notification subscription. More... | |
char * | ncntf_status (void) |
Get the status data in xml form describing the currently used streams. More... | |
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. More... | |
int | ncntf_stream_info (const char *stream, char **desc, char **start) |
Get some more details about the specified NETCONF event notifications stream. More... | |
int | ncntf_stream_isavailable (const char *name) |
Test if the given stream is already created and available. More... | |
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 a closing function to nc_ntf_stream_iter_start() More... | |
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_start() function. More... | |
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 the first part of the stream file. More... | |
char ** | ncntf_stream_list (void) |
Get the list of NETCONF event notifications streams. More... | |
int | ncntf_stream_new (const char *name, const char *desc, int replay) |
Create a new NETCONF event stream. More... | |
nc_reply * | ncntf_subscription_check (const nc_rpc *subscribe_rpc) |
Check validity of <create-subscription> message. More... | |
libnetconf's implementation of NETCONF asynchronous message delivery as defined in RFC 5277.
typedef struct nc_msg nc_ntf |
Event notification message.
enum NCNTF_EVENT |
Enumeration of supported NETCONF event notifications.
enum NCNTF_EVENT_BY |
nc_rpc* nc_rpc_subscribe | ( | const char * | stream, |
const struct nc_filter * | filter, | ||
const time_t * | start, | ||
const time_t * | stop | ||
) |
Create <create-subsciption> NETCONF rpc message.
Detailed description of this operation can be found in RFC 5277, section 2.1.1.
[in] | stream | Name of the stream of events that is of interest. Optional parameter (NULL is accepted), if not specified, the default NETCONF stream is subscribed. |
[in] | filter | Specify the subset of all possible events to be received. Optional parameter (NULL is accepted). |
[in] | start | Start time to trigger the replay feature from the specified time. Optional parameter (NULL is accepted). Format of the date is of the type dateTime according to RFC 3339. |
[in] | stop | Stop time to stop the replay of event notifications. Optional parameter (NULL is accepted). Format of the date is of the type dateTime according to RFC 3339. |
NC_MSG_TYPE nc_session_recv_notif | ( | struct nc_session * | session, |
int | timeout, | ||
nc_ntf ** | ntf | ||
) |
Receive a <notification> message from the specified NETCONF session. This function is supposed to be performed only by NETCONF clients.
[in] | session | NETCONF session to use. |
[in] | timeout | Timeout in microseconds, -1 for infinite timeout, 0 for non-blocking |
[out] | ntf | Received <notification> message |
int nc_session_send_notif | ( | struct nc_session * | session, |
const nc_ntf * | ntf | ||
) |
Send <notification> message from server to client.
[in] | session | NETCONF session to use. |
[in] | ntf | <notification> message to send. |
long long int ncntf_dispatch_receive | ( | struct nc_session * | session, |
void(*)(time_t eventtime, const char *content) | process_ntf | ||
) |
Subscribe for receiving notifications from the given session according to parameters in the given subscribtion RPC. Received notifications are processed by the given process_ntf callback function. Functions stops when the final notification <notificationComplete> is received or when the session is terminated.
[in] | session | NETCONF session where the notifications will be sent. |
[in] | process_ntf | Callback function to process content of the notification. If NULL, content of the notification is printed on stdout. |
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. All events from the specified stream are processed and sent to the client until the stop time is reached or until the session is terminated.
[in] | session | NETCONF session where the notifications will be sent. |
[in] | subscribe_rpc | <create-subscription> RPC, if any other RPC is given, -1 is returned. |
int ncntf_event_new | ( | time_t | etime, |
NCNTF_EVENT | event, | ||
... | |||
) |
Store a new event in the specified stream. Parameters are specific for different events.
[in] | etime | Time of the event, if set to -1, the current time is used. |
[in] | event | Event type to distinguish the following parameters. |
[in] | ... | Specific parameters for different event types as described above. |
nc_ntf* ncntf_notif_create | ( | time_t | event_time, |
const char * | content | ||
) |
Create a new <notification> message with the given eventTime and content.
[in] | event_time | Time of the event. |
[in] | content | Description of the event in the XML form. |
void ncntf_notif_free | ( | nc_ntf * | ntf | ) |
Free the notification message.
[in] | ntf | notification message to free. |
char* ncntf_notif_get_content | ( | const nc_ntf * | notif | ) |
Get description of the event reported in the notification message.
[in] | notif | Notification message. |
time_t ncntf_notif_get_time | ( | const nc_ntf * | notif | ) |
Get Time of the event reported in the notification message.
[in] | notif | Notification message. |
NCNTF_EVENT ncntf_notif_get_type | ( | const nc_ntf * | notif | ) |
Get a specific notification type.
[in] | notif | Notification message to explore. |
int ncntf_session_get_active_subscription | ( | struct nc_session * | session | ) |
Check if a session has an active notification subscription.
[in] | session | NETCONF session to check. |
char* ncntf_status | ( | void | ) |
Get the status data in xml form describing the currently used streams.
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.
[in] | stream | Name of the stream where to allow event logging |
[in] | event | Name of the event which to allow on the given stream |
int ncntf_stream_info | ( | const char * | stream, |
char ** | desc, | ||
char ** | start | ||
) |
Get some more details about the specified NETCONF event notifications stream.
[in] | stream | Name of the stream. |
[out] | desc | Pointer to a description string is returned. |
[out] | start | Pointer to a time string of the stream start time is returned. |
int ncntf_stream_isavailable | ( | const char * | name | ) |
Test if the given stream is already created and available.
[in] | name | Name of the stream to check. |
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 a closing function to nc_ntf_stream_iter_start()
[in] | stream | Name of the iterated stream. |
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_start() function.
[in] | stream | Name of the stream to iterate. |
[in] | start | Time of the first event the caller is interested in. |
[in] | stop | Time of the last event the caller is interested in. |
[out] | event_time | Time of the returned event, NULL if caller does not care. |
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 the first part of the stream file.
[in] | stream | Name of the stream to iterate. |
char** ncntf_stream_list | ( | void | ) |
Get the list of NETCONF event notifications streams.
int ncntf_stream_new | ( | const char * | name, |
const char * | desc, | ||
int | replay | ||
) |
Create a new NETCONF event stream.
[in] | name | Name of the stream. |
[in] | desc | Description of the stream. |
[in] | replay | Specify if the replay is allowed (1 for yes, 0 for no). |
Check validity of <create-subscription> message.
This check is done by ncntf_dispatch_send() which returns -1 when test does not pass. However, it can be sometimes useful to run this test before calling ncntf_dispatch_send().
[in] | subscribe_rpc | <create-subscription> RPC. |