Change-Id: I968d19db72eaa8677e212a88b5bbb5886163d307
#include <ckm/ckm-error.h>
+#include <client-common.h>
+
IMPLEMENT_SAFE_SINGLETON(CKM::Log::LogSystem);
namespace {
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;
#include <vector>
#include <functional>
+#include <noncopyable.h>
#include <message-buffer.h>
#define KEY_MANAGER_API __attribute__((visibility("default")))
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.