Browse Source

[2932] Interface to subscribe and unsubscribe notifications

Not documented as of yet, and no implementation.
Michal 'vorner' Vaner 11 years ago
parent
commit
ccb473862e
1 changed files with 13 additions and 0 deletions
  1. 13 0
      src/lib/config/ccsession.h

+ 13 - 0
src/lib/config/ccsession.h

@@ -575,6 +575,19 @@ 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);
 
 
+    typedef boost::function<void (const std::string& event_name,
+                                  const data::ConstElementPtr& params)>
+        NotificationCallback;
+    typedef std::list<NotificationCallback> NotificationCallbacks;
+    typedef std::map<std::string, NotificationCallbacks>
+        SubscribedNotifications;
+    typedef std::pair<SubscribedNotifications::iterator,
+                      NotificationCallbacks::iterator>
+        NotificationID;
+    NotificationID subscribeNotification(const std::string& notification_group,
+                                         const NotificationCallback& callback);
+    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.