libnetconf  0.10.0-146_trunk
NETCONF Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
NETCONF Event Notifications (libxml2)

libnetconf's implementation of NETCONF asynchronous message delivery as defined in RFC 5277. These functions accepts selected parameters as libxml2 structures. More...

Functions

int ncxmlntf_event_new (time_t etime, NCNTF_EVENT event,...)
 Store a new event into the specified stream. Parameters are specific for different events. More...
 
nc_ntfncxmlntf_notif_create (time_t event_time, const xmlNodePtr content)
 Create a new <notification> message with the given eventTime and content. More...
 
xmlNodePtr ncxmlntf_notif_get_content (nc_ntf *notif)
 Get the description of the event reported in the notification message. More...
 

Detailed Description

libnetconf's implementation of NETCONF asynchronous message delivery as defined in RFC 5277. These functions accepts selected parameters as libxml2 structures.

Function Documentation

int ncxmlntf_event_new ( time_t  etime,
NCNTF_EVENT  event,
  ... 
)

Store a new event into the specified stream. Parameters are specific for different events.

Event parameters:

  • NCNTF_GENERIC
    • const xmlNodePtr content Content of the notification as defined in RFC 5277. eventTime is added automatically. The parameter can be a single XML node as well as a node list.
  • NCNTF_BASE_CFG_CHANGE
    • NC_DATASTORE datastore Specify which datastore has changed.
    • NCNTF_EVENT_BY changed_by Specify the source of the change.
    • const struct nc_session* session Session that required the configuration change.
  • NCNTF_BASE_CPBLT_CHANGE
    • const struct nc_cpblts* old Old list of capabilities.
    • const struct nc_cpblts* new New list of capabilities.
    • NCNTF_EVENT_BY changed_by Specify the source of the change.
    • const struct nc_session* session Session that required the configuration change.
  • NCNTF_BASE_SESSION_START
  • NCNTF_BASE_SESSION_END
    • const struct nc_session* session Finished session (NC_SESSION_STATUS_DUMMY session is also allowed).
    • NC_SESSION_TERM_REASON reason Session termination reason.
    • const char* killed-by-sid The ID of the session that directly caused the session termination. If the session was terminated by a non-NETCONF process unknown to the server, use NULL as the value.

Examples:

  • ncxmlntf_event_new("mystream", -1, NCNTF_GENERIC, my_xml_data);
  • ncxmlntf_event_new("netconf", -1, NCNTF_BASE_CFG_CHANGE, NC_DATASTORE_RUNNING, NCNTF_EVENT_BY_USER, my_session);
  • ncxmlntf_event_new("netconf", -1, NCNTF_BASE_CPBLT_CHANGE, old_cpblts, new_cpblts, NCNTF_EVENT_BY_SERVER);
  • ncxmlntf_event_new("netconf", -1, NCNTF_BASE_SESSION_START, my_session);
  • ncxmlntf_event_new("netconf", -1, NCNTF_BASE_SESSION_END, my_session, NC_SESSION_TERM_KILLED, "123456");
Parameters
[in]etimeTime of the event, if set to -1, the current time is used.
[in]eventEvent type to distinguish the following parameters.
[in]...Specific parameters for different event types as described above.
Returns
0 for success, non-zero value else.
nc_ntf* ncxmlntf_notif_create ( time_t  event_time,
const xmlNodePtr  content 
)

Create a new <notification> message with the given eventTime and content.

Parameters
[in]event_timeTime of the event.
[in]contentDescription of the event in XML. This parameter is taken as a node list, so the sibling nodes will be also included.
Returns
Created notification message.
xmlNodePtr ncxmlntf_notif_get_content ( nc_ntf notif)

Get the description of the event reported in the notification message.

Parameters
[in]notifNotification message.
Returns
Copy of the event description content (single node or node list, eventTime is not included). The caller is supposed to free the returned structure with xmlFreeNodeList().