Move SockRAII declaration to header file 60/28860/1
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Tue, 16 Sep 2014 07:57:45 +0000 (09:57 +0200)
committerBartlomiej Grzelewski <b.grzelewski@samsung.com>
Thu, 16 Oct 2014 13:44:31 +0000 (15:44 +0200)
Change-Id: I968d19db72eaa8677e212a88b5bbb5886163d307

src/manager/client/client-common.cpp
src/manager/client/client-common.h

index aeb79cd..a7a183f 100644 (file)
@@ -37,6 +37,8 @@
 
 #include <ckm/ckm-error.h>
 
+#include <client-common.h>
+
 IMPLEMENT_SAFE_SINGLETON(CKM::Log::LogSystem);
 
 namespace {
@@ -149,30 +151,6 @@ int connectSocket(int& sock, char const * const interface) {
     return CKM_API_SUCCESS;
 }
 
-class SockRAII {
-public:
-    SockRAII()
-      : m_sock(-1)
-    {}
-
-    virtual ~SockRAII() {
-        if (m_sock > -1)
-            close(m_sock);
-    }
-
-    int Connect(char const * const interface) {
-        return CKM::connectSocket(m_sock, interface);
-    }
-
-    int Get() const {
-        return m_sock;
-    }
-
-private:
-    int m_sock;
-};
-
-
 int sendToServer(char const * const interface, const RawBuffer &send, MessageBuffer &recv) {
     int ret;
     SockRAII sock;
index 8616528..ae25a62 100644 (file)
@@ -29,6 +29,7 @@
 #include <vector>
 #include <functional>
 
+#include <noncopyable.h>
 #include <message-buffer.h>
 
 #define KEY_MANAGER_API __attribute__((visibility("default")))
@@ -43,6 +44,32 @@ int connectSocket(int& sock, char const * const interface);
 
 int sendToServer(char const * const interface, const RawBuffer &send, MessageBuffer &recv);
 
+
+class SockRAII {
+public:
+    SockRAII()
+      : m_sock(-1)
+    {}
+
+    NONCOPYABLE(SockRAII);
+
+    virtual ~SockRAII() {
+        if (m_sock > -1)
+            close(m_sock);
+    }
+
+    int Connect(char const * const interface) {
+        return CKM::connectSocket(m_sock, interface);
+    }
+
+    int Get() const {
+        return m_sock;
+    }
+
+private:
+    int m_sock;
+};
+
 /*
  * Decorator function that performs frequently repeated exception handling in
  * SS client API functions. Accepts lambda expression as an argument.