Old privileges restored
[platform/core/security/key-manager.git] / src / manager / service / ocsp-service.cpp
index 9e8c2f6..33111d5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2014 Samsung Electronics Co.
+ *  Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
  * @version     1.0
  * @brief       OCSP service implementation.
  */
-#include <service-thread.h>
-#include <generic-socket-manager.h>
-#include <connection-info.h>
-#include <message-buffer.h>
+
 #include <protocols.h>
 
 #include <dpl/serialization.h>
@@ -45,34 +42,25 @@ OCSPService::~OCSPService() {
     delete m_logic;
 }
 
-GenericSocketService::ServiceDescriptionVector OCSPService::GetServiceDescription()
-{
-    return ServiceDescriptionVector {
-        {SERVICE_SOCKET_OCSP, "key-manager::api-ocsp", SOCKET_ID_OCSP}
-    };
-}
-
-void OCSPService::accept(const AcceptEvent &event) {
-    LogDebug("Accept event");
-    auto &info = m_connectionInfoMap[event.connectionID.counter];
-    info.interfaceID = event.interfaceID;
-    info.credentials = event.credentials;
+void OCSPService::Start() {
+    Create();
 }
 
-void OCSPService::write(const WriteEvent &event) {
-    LogDebug("Write event (" << event.size << " bytes )");
+void OCSPService::Stop() {
+    Join();
 }
 
-void OCSPService::process(const ReadEvent &event) {
-    LogDebug("Read event");
-    auto &info = m_connectionInfoMap[event.connectionID.counter];
-    info.buffer.Push(event.rawBuffer);
-    while(processOne(event.connectionID, info));
+GenericSocketService::ServiceDescriptionVector OCSPService::GetServiceDescription()
+{
+    return ServiceDescriptionVector {
+        {SERVICE_SOCKET_OCSP, "http://tizen.org/privilege/keymanager", SOCKET_ID_OCSP}
+    };
 }
 
-bool OCSPService::processOne(
+bool OCSPService::ProcessOne(
     const ConnectionID &conn,
-    ConnectionInfo &info)
+    ConnectionInfo &info,
+    bool allowed)
 {
     LogDebug ("process One");
 
@@ -86,7 +74,7 @@ bool OCSPService::processOne(
         RawBufferVector chainVector;
         buffer.Deserialize(commandId, chainVector);
 
-        RawBuffer response = m_logic->ocspCheck(commandId, chainVector);
+        RawBuffer response = m_logic->ocspCheck(commandId, chainVector, allowed);
         m_serviceManager->Write(conn, response);
 
         return true;
@@ -102,10 +90,5 @@ bool OCSPService::processOne(
     return false;
 }
 
-void OCSPService::close(const CloseEvent &event) {
-    LogDebug("Close event");
-    m_connectionInfoMap.erase(event.connectionID.counter);
-}
-
 } // namespace CKM