2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file ocsp_service.cpp
18 * @author Piotr Marcinkiewicz (p.marcinkiew@samsung.com)
20 * @brief This is implementation file of Ocsp service
28 #include <dpl/log/log.h>
29 #include <dpl/single_instance.h>
30 #include <dpl/event/controller.h>
31 #include <dpl/thread.h>
32 #include <vcore/VCore.h>
33 #include <dpl/wrt-dao-ro/WrtDatabase.h>
34 #include "security_daemon.h"
35 #include "security_dbus_service.h"
36 #include "ocsp_server_dbus_interface.h"
37 #include "ocsp_controller.h"
47 virtual int ThreadEntry()
50 ValidationCore::AttachToThread();
51 WrtDB::WrtDatabase::attachToThread();
53 int result = DPL::Thread::ThreadEntry();
56 ValidationCore::DetachFromThread();
57 WrtDB::WrtDatabase::detachFromThread();
63 } //anonymous namespace
65 namespace OcspService {
67 class OcspService : public SecurityDaemon::DaemonService
70 virtual void initialize()
73 m_threadOCSP.reset(new OCSPThread());
75 OCSPControllerSingleton::Instance().Touch();
76 OCSPControllerSingleton::Instance().SwitchToThread(m_threadOCSP.get());
87 virtual void deinitialize()
89 //Deinitialize OCSP thread
90 OCSPControllerSingleton::Instance().SwitchToThread(NULL);
95 std::shared_ptr<OCSPThread> m_threadOCSP;
99 DAEMON_REGISTER_SERVICE_MODULE(OcspService)
101 }//namespace OcspService