|
@@ -575,6 +575,57 @@ public:
|
|
/// \param id The id of request as returned by groupRecvMsgAsync.
|
|
/// \param id The id of request as returned by groupRecvMsgAsync.
|
|
void cancelAsyncRecv(const AsyncRecvRequestID& id);
|
|
void cancelAsyncRecv(const AsyncRecvRequestID& id);
|
|
|
|
|
|
|
|
+ /// \brief Called when a notification comes
|
|
|
|
+ ///
|
|
|
|
+ /// The callback should be exception-free. If it raises an exception,
|
|
|
|
+ /// it'll leak through the event loop up and probably terminate the
|
|
|
|
+ /// application.
|
|
|
|
+ ///
|
|
|
|
+ /// \param event_name The identification of event type.
|
|
|
|
+ /// \param params The parameters of the event. This may be NULL
|
|
|
|
+ /// pointer in case no parameters were sent with the event.
|
|
|
|
+ typedef boost::function<void (const std::string& event_name,
|
|
|
|
+ const data::ConstElementPtr& params)>
|
|
|
|
+ NotificationCallback;
|
|
|
|
+
|
|
|
|
+ /// \brief Multiple notification callbacks for the same notification
|
|
|
|
+ typedef std::list<NotificationCallback> NotificationCallbacks;
|
|
|
|
+
|
|
|
|
+ /// \brief Mapping from groups to callbacks
|
|
|
|
+ typedef std::map<std::string, NotificationCallbacks>
|
|
|
|
+ SubscribedNotifications;
|
|
|
|
+
|
|
|
|
+ /// \brief Identification of single callback
|
|
|
|
+ typedef std::pair<SubscribedNotifications::iterator,
|
|
|
|
+ NotificationCallbacks::iterator>
|
|
|
|
+ NotificationID;
|
|
|
|
+
|
|
|
|
+ /// \brief Subscribe to a notification group
|
|
|
|
+ ///
|
|
|
|
+ /// From now on, every notification that is sent to the given group
|
|
|
|
+ /// triggers the passed callback.
|
|
|
|
+ ///
|
|
|
|
+ /// There may be multiple (independent) callbacks for the same channel.
|
|
|
|
+ /// This one adds a new one, to the end of the chain (the callbacks
|
|
|
|
+ /// are called in the same order as they were registered).
|
|
|
|
+ ///
|
|
|
|
+ /// \param notification_group The channel of notifications.
|
|
|
|
+ /// \param callback The callback to be added.
|
|
|
|
+ /// \return ID of the notification callback. It is an opaque ID and can
|
|
|
|
+ /// be used to remove this callback.
|
|
|
|
+ NotificationID subscribeNotification(const std::string& notification_group,
|
|
|
|
+ const NotificationCallback& callback);
|
|
|
|
+
|
|
|
|
+ /// \brief Unsubscribe the callback from its notification group.
|
|
|
|
+ ///
|
|
|
|
+ /// Express that the desire for this callback to be executed is no longer
|
|
|
|
+ /// relevant. All the other callbacks (even for the same notification
|
|
|
|
+ /// group) are left intact.
|
|
|
|
+ ///
|
|
|
|
+ /// \param notification The ID of notification callback returned by
|
|
|
|
+ /// subscribeNotification.
|
|
|
|
+ void unsubscribeNotification(const NotificationID& notification);
|
|
|
|
+
|
|
/// \brief Subscribe to a group
|
|
/// \brief Subscribe to a group
|
|
///
|
|
///
|
|
/// Wrapper around the CCSession::subscribe.
|
|
/// Wrapper around the CCSession::subscribe.
|
|
@@ -634,6 +685,8 @@ private:
|
|
/// otherwise.
|
|
/// otherwise.
|
|
bool checkAsyncRecv(const data::ConstElementPtr& envelope,
|
|
bool checkAsyncRecv(const data::ConstElementPtr& envelope,
|
|
const data::ConstElementPtr& msg);
|
|
const data::ConstElementPtr& msg);
|
|
|
|
+ bool checkNotification(const data::ConstElementPtr& envelope,
|
|
|
|
+ const data::ConstElementPtr& msg);
|
|
/// \brief Checks if a message with this envelope matches the request
|
|
/// \brief Checks if a message with this envelope matches the request
|
|
bool requestMatch(const AsyncRecvRequest& request,
|
|
bool requestMatch(const AsyncRecvRequest& request,
|
|
const data::ConstElementPtr& envelope) const;
|
|
const data::ConstElementPtr& envelope) const;
|
|
@@ -643,6 +696,8 @@ private:
|
|
isc::cc::AbstractSession& session_;
|
|
isc::cc::AbstractSession& session_;
|
|
ModuleSpec module_specification_;
|
|
ModuleSpec module_specification_;
|
|
AsyncRecvRequests async_recv_requests_;
|
|
AsyncRecvRequests async_recv_requests_;
|
|
|
|
+ SubscribedNotifications notifications_;
|
|
|
|
+
|
|
isc::data::ConstElementPtr handleConfigUpdate(
|
|
isc::data::ConstElementPtr handleConfigUpdate(
|
|
isc::data::ConstElementPtr new_config);
|
|
isc::data::ConstElementPtr new_config);
|
|
|
|
|