lxcpp: fix cgroup unit tests
[platform/core/security/vasum.git] / server / host-ipc-connection.hpp
1 /*
2  *  Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *  Contact: Mateusz Malicki <m.malicki2@samsung.com>
5  *
6  *  Licensed under the Apache License, Version 2.0 (the "License");
7  *  you may not use this file except in compliance with the License.
8  *  You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *  Unless required by applicable law or agreed to in writing, software
13  *  distributed under the License is distributed on an "AS IS" BASIS,
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *  See the License for the specific language governing permissions and
16  *  limitations under the License
17  */
18
19 /**
20  * @file
21  * @author  Mateusz Malicki (m.malicki2@samsung.com)
22  * @brief   HostIPCConnection class
23  */
24
25
26 #ifndef SERVER_HOST_IPC_CONNECTION_HPP
27 #define SERVER_HOST_IPC_CONNECTION_HPP
28
29 #include "api/messages.hpp"
30 #include "ipc/epoll/event-poll.hpp"
31 #include "ipc/service.hpp"
32 #include "ipc-callback-wrapper.hpp"
33
34 namespace vasum {
35
36 class ZonesManager;
37
38 class HostIPCConnection {
39 public:
40     template<typename ArgIn = const api::Void, typename ArgOut = api::Void>
41     class Method {
42     public:
43         typedef typename IPCMethodWrapper<ArgIn, ArgOut>::type type;
44     };
45     template<typename ArgIn>
46     class Signal {
47     public:
48         typedef typename IPCSignalWrapper<ArgIn>::type type;
49     };
50
51     HostIPCConnection(ipc::epoll::EventPoll& eventPoll, ZonesManager* zm);
52     ~HostIPCConnection();
53
54     void start();
55     void stop(bool wait);
56     void signalZoneConnectionState(const api::ConnectionState& connectionState);
57     bool isRunning();
58
59 private:
60     void setLockQueueCallback(const Method<api::Void>::type& callback);
61     void setUnlockQueueCallback(const Method<api::Void>::type& callback);
62     void setGetZoneIdsCallback(const Method<api::ZoneIds>::type& callback);
63     void setGetZoneConnectionsCallback(const Method<api::Connections>::type& callback);
64     void setGetActiveZoneIdCallback(const Method<api::ZoneId>::type& callback);
65     void setGetZoneInfoCallback(const Method<const api::ZoneId, api::ZoneInfoOut>::type& callback);
66     void setSetNetdevAttrsCallback(const Method<const api::SetNetDevAttrsIn>::type& callback);
67     void setGetNetdevAttrsCallback(const Method<const api::GetNetDevAttrsIn, api::GetNetDevAttrs>::type& callback);
68     void setGetNetdevListCallback(const Method<const api::ZoneId, api::NetDevList>::type& callback);
69     void setCreateNetdevVethCallback(const Method<const api::CreateNetDevVethIn>::type& callback);
70     void setCreateNetdevMacvlanCallback(const Method<const api::CreateNetDevMacvlanIn>::type& callback);
71     void setCreateNetdevPhysCallback(const Method<const api::CreateNetDevPhysIn>::type& callback);
72     void setDestroyNetdevCallback(const Method<const api::DestroyNetDevIn>::type& callback);
73     void setDeleteNetdevIpAddressCallback(const Method<const api::DeleteNetdevIpAddressIn>::type& callback);
74     void setDeclareFileCallback(const Method<const api::DeclareFileIn, api::Declaration>::type& callback);
75     void setDeclareMountCallback(const Method<const api::DeclareMountIn, api::Declaration>::type& callback);
76     void setDeclareLinkCallback(const Method<const api::DeclareLinkIn, api::Declaration>::type& callback);
77     void setGetDeclarationsCallback(const Method<const api::ZoneId, api::Declarations>::type& callback);
78     void setRemoveDeclarationCallback(const Method<const api::RemoveDeclarationIn>::type& callback);
79     void setSetActiveZoneCallback(const Method<const api::ZoneId>::type& callback);
80     void setCreateZoneCallback(const Method<const api::CreateZoneIn>::type& callback);
81     void setDestroyZoneCallback(const Method<const api::ZoneId>::type& callback);
82     void setShutdownZoneCallback(const Method<const api::ZoneId>::type& callback);
83     void setStartZoneCallback(const Method<const api::ZoneId>::type& callback);
84     void setLockZoneCallback(const Method<const api::ZoneId>::type& callback);
85     void setUnlockZoneCallback(const Method<const api::ZoneId>::type& callback);
86     void setGrantDeviceCallback(const Method<const api::GrantDeviceIn>::type& callback);
87     void setRevokeDeviceCallback(const Method<const api::RevokeDeviceIn>::type& callback);
88     void setSwitchToDefaultCallback(const Method<api::Void>::type& callback);
89     void setCreateFileCallback(const Method<const api::CreateFileIn, api::CreateFileOut>::type& callback);
90     void setCleanUpZonesRootCallback(const Method<api::Void>::type& callback);
91
92     std::unique_ptr<ipc::Service> mService;
93     ZonesManager* mZonesManagerPtr;
94 };
95
96 } // namespace vasum
97
98 #endif // SERVER_HOST_IPC_CONNECTION_HPP