/*
- * 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>
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");
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;
return false;
}
-void OCSPService::close(const CloseEvent &event) {
- LogDebug("Close event");
- m_connectionInfoMap.erase(event.connectionID.counter);
-}
-
} // namespace CKM