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/type_list.h>
36 #include <ace-dao-ro/PreferenceTypes.h>
37 #include <ace/AbstractPolicyEnforcementPoint.h>
38 #include <ace-dao-ro/PromptModel.h>
40 #include <dpl/event/inter_context_delegate.h>
46 namespace SecurityControllerEvents {
47 DECLARE_GENERIC_EVENT_0(InitializeSyncEvent)
48 DECLARE_GENERIC_EVENT_0(TerminateSyncEvent)
49 DECLARE_GENERIC_EVENT_0(UpdatePolicySyncEvent)
51 DECLARE_GENERIC_EVENT_2(CheckFunctionCallSyncEvent,
56 DECLARE_GENERIC_EVENT_3(CheckRuntimeCallSyncEvent,
59 std::string //sessionId
62 DECLARE_GENERIC_EVENT_5(ValidatePopupResponseEvent,
66 std::string, //sessionId
67 bool* //check return value
70 } // namespace SecurityControllerEvents
72 typedef DPL::TypeListDecl<
73 SecurityControllerEvents::InitializeSyncEvent,
74 SecurityControllerEvents::TerminateSyncEvent,
75 SecurityControllerEvents::UpdatePolicySyncEvent,
76 SecurityControllerEvents::ValidatePopupResponseEvent,
77 SecurityControllerEvents::CheckRuntimeCallSyncEvent,
78 SecurityControllerEvents::CheckFunctionCallSyncEvent>::Type
79 SecurityControllerEventsTypeList;
81 class SecurityController :
82 public DPL::Event::Controller<SecurityControllerEventsTypeList>
85 virtual void OnEventReceived(
86 const SecurityControllerEvents::InitializeSyncEvent &event);
87 virtual void OnEventReceived(
88 const SecurityControllerEvents::UpdatePolicySyncEvent &event);
89 virtual void OnEventReceived(
90 const SecurityControllerEvents::ValidatePopupResponseEvent &e);
91 virtual void OnEventReceived(
92 const SecurityControllerEvents::TerminateSyncEvent &event);
93 virtual void OnEventReceived(
94 const SecurityControllerEvents::CheckFunctionCallSyncEvent &e);
95 virtual void OnEventReceived(
96 const SecurityControllerEvents::CheckRuntimeCallSyncEvent &e);
100 std::unique_ptr<Impl> m_impl;
102 SecurityController();
103 //This desctructor must be in implementation file (cannot be autogenerated)
104 ~SecurityController();
106 friend class DPL::Singleton<SecurityController>;
109 typedef DPL::Singleton<SecurityController> SecurityControllerSingleton;
111 #endif // SECURITY_CONTROLLER_H