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.h
23 * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
24 * @author Ming Jin(ming79.jin@samsung.com)
26 * @brief Header file for security controller
28 #ifndef SECURITY_CONTROLLER_H
29 #define SECURITY_CONTROLLER_H
31 #include <dpl/singleton.h>
32 #include <dpl/event/controller.h>
33 #include <dpl/generic_event.h>
34 #include <dpl/scoped_ptr.h>
35 #include <dpl/type_list.h>
37 #include <ace-dao-ro/PreferenceTypes.h>
38 #include <ace/AbstractPolicyEnforcementPoint.h>
39 #include <ace-dao-ro/PromptModel.h>
41 #include <dpl/event/inter_context_delegate.h>
47 namespace SecurityControllerEvents {
48 DECLARE_GENERIC_EVENT_0(InitializeSyncEvent)
49 DECLARE_GENERIC_EVENT_0(TerminateSyncEvent)
50 DECLARE_GENERIC_EVENT_0(UpdatePolicySyncEvent)
52 DECLARE_GENERIC_EVENT_2(CheckFunctionCallSyncEvent,
57 DECLARE_GENERIC_EVENT_3(CheckRuntimeCallSyncEvent,
60 std::string //sessionId
63 DECLARE_GENERIC_EVENT_5(ValidatePopupResponseEvent,
67 std::string, //sessionId
68 bool* //check return value
71 } // namespace SecurityControllerEvents
73 typedef DPL::TypeListDecl<
74 SecurityControllerEvents::InitializeSyncEvent,
75 SecurityControllerEvents::TerminateSyncEvent,
76 SecurityControllerEvents::UpdatePolicySyncEvent,
77 SecurityControllerEvents::ValidatePopupResponseEvent,
78 SecurityControllerEvents::CheckRuntimeCallSyncEvent,
79 SecurityControllerEvents::CheckFunctionCallSyncEvent>::Type
80 SecurityControllerEventsTypeList;
82 class SecurityController :
83 public DPL::Event::Controller<SecurityControllerEventsTypeList>
86 virtual void OnEventReceived(
87 const SecurityControllerEvents::InitializeSyncEvent &event);
88 virtual void OnEventReceived(
89 const SecurityControllerEvents::UpdatePolicySyncEvent &event);
90 virtual void OnEventReceived(
91 const SecurityControllerEvents::ValidatePopupResponseEvent &e);
92 virtual void OnEventReceived(
93 const SecurityControllerEvents::TerminateSyncEvent &event);
94 virtual void OnEventReceived(
95 const SecurityControllerEvents::CheckFunctionCallSyncEvent &e);
96 virtual void OnEventReceived(
97 const SecurityControllerEvents::CheckRuntimeCallSyncEvent &e);
101 DPL::ScopedPtr<Impl> m_impl;
103 SecurityController();
104 //This desctructor must be in implementation file (cannot be autogenerated)
105 ~SecurityController();
107 friend class DPL::Singleton<SecurityController>;
110 typedef DPL::Singleton<SecurityController> SecurityControllerSingleton;
112 #endif // SECURITY_CONTROLLER_H