Add inter-service messages
[platform/core/security/key-manager.git] / src / manager / main / generic-socket-manager.h
index d24c397..4108c3b 100644 (file)
 
 #include <sys/types.h>
 
-#include <safe-buffer.h>
-
 #include <dpl/exception.h>
-
 #include <generic-event.h>
+#include <dpl/raw-buffer.h>
+#include <ckm/ckm-type.h>
+#include <credentials.h>
 
 extern "C" {
 struct msghdr;
@@ -45,11 +45,6 @@ namespace CKM {
 
 typedef int InterfaceID;
 
-struct Credentials {
-    uid_t uid;
-    std::string smackLabel;
-};
-
 struct ConnectionID {
     int sock;                                 // This is decriptor used for connection
     int counter;                              // Unique handler per socket
@@ -61,7 +56,6 @@ struct ConnectionID {
 struct GenericSocketManager;
 
 struct GenericSocketService {
-    typedef std::string SmackLabel;
     typedef std::string ServiceHandlerPath;
     struct ServiceDescription {
         ServiceDescription(const char *path,
@@ -74,7 +68,7 @@ struct GenericSocketService {
           , useSendMsg(useSendMsg)
         {}
 
-        SmackLabel smackLabel;                 // Smack label for socket
+        Label smackLabel;                      // Smack label for socket
         InterfaceID interfaceID;               // All data from serviceHandlerPath will be marked with this interfaceHandler
         ServiceHandlerPath serviceHandlerPath; // Path to file
         bool useSendMsg;
@@ -96,7 +90,7 @@ struct GenericSocketService {
 
     struct ReadEvent : public GenericEvent {
         ConnectionID connectionID;
-        SafeBuffer rawBuffer;
+        RawBuffer rawBuffer;
     };
 
     struct CloseEvent : public GenericEvent {
@@ -113,6 +107,9 @@ struct GenericSocketService {
     virtual void Event(const ReadEvent &event) = 0;
     virtual void Event(const CloseEvent &event) = 0;
 
+    virtual void Start() = 0;
+    virtual void Stop() = 0;
+
     GenericSocketService() : m_serviceManager(NULL) {}
     virtual ~GenericSocketService(){}
 protected:
@@ -123,7 +120,7 @@ struct GenericSocketManager {
     virtual void MainLoop() = 0;
     virtual void RegisterSocketService(GenericSocketService *ptr) = 0;
     virtual void Close(ConnectionID connectionID) = 0;
-    virtual void Write(ConnectionID connectionID, const SafeBuffer &rawBuffer) = 0;
+    virtual void Write(ConnectionID connectionID, const RawBuffer &rawBuffer) = 0;
     virtual ~GenericSocketManager(){}
 };