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 * This class simply redirects the access requests to access control engine.
18 * The aim is to hide access control engine specific details from WRT modules.
19 * It also implements WRT_INTERFACE.h interfaces, so that ACE could access
20 * WRT specific and other information during the decision making.
22 * @file security_controller.cpp
23 * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
24 * @author Ming Jin(ming79.jin@samsung.com)
26 * @brief Implementation file for security controller
28 #include <security_controller.h>
29 #include <ace/PolicyEnforcementPoint.h>
30 #include <ace/WRT_INTERFACE.h>
31 //#include <engine/PolicyEvaluatorFactory.h>
32 //#include <logic/attribute_facade.h>
33 #include <dpl/singleton_impl.h>
34 #include <dpl/log/log.h>
35 #include <security_logic.h>
36 #include <security_caller.h>
38 IMPLEMENT_SINGLETON(SecurityController)
40 struct SecurityController::Impl
45 SecurityController::SecurityController()
47 m_impl.reset(new Impl);
50 SecurityController::~SecurityController()
54 void SecurityController::OnEventReceived(
55 const SecurityControllerEvents::InitializeSyncEvent & /* event */)
57 SecurityCallerSingleton::Instance().Run();
58 m_impl->logic.initialize();
61 void SecurityController::OnEventReceived(
62 const SecurityControllerEvents::UpdatePolicySyncEvent& /* event */)
64 m_impl->logic.updatePolicy();
67 void SecurityController::OnEventReceived(
68 const SecurityControllerEvents::TerminateSyncEvent & /*event*/)
70 SecurityCallerSingleton::Instance().Quit();
71 m_impl->logic.terminate();
74 void SecurityController::OnEventReceived(
75 const SecurityControllerEvents::CheckFunctionCallSyncEvent &ev)
77 *ev.GetArg0() = m_impl->logic.checkFunctionCall(ev.GetArg1());
80 void SecurityController::OnEventReceived(
81 const SecurityControllerEvents::CheckRuntimeCallSyncEvent &ev)
83 *ev.GetArg0() = m_impl->logic.checkFunctionCall(ev.GetArg1(), ev.GetArg2());
86 void SecurityController::OnEventReceived(
87 const SecurityControllerEvents::ValidatePopupResponseEvent &ev)
89 m_impl->logic.validatePopupResponse(ev.GetArg0(),