ca4cab215c1189eaf44685bdcf0018703cdd81e7
[platform/core/security/vasum.git] / common / api / messages.hpp
1 /*
2  *  Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *  Contact: Jan Olszak (j.olszak@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  Jan Olszak (j.olszak@samsung.com)
22  * @brief   Host's internal IPC messages declaration
23  */
24
25
26 #ifndef COMMON_API_MESSAGES
27 #define COMMON_API_MESSAGES
28
29 #include "config/fields.hpp"
30 #include <string>
31 #include <vector>
32
33 namespace vasum {
34 namespace api {
35
36 struct Void {
37     CONFIG_REGISTER_EMPTY
38 };
39
40 struct String {
41     std::string value;
42
43     CONFIG_REGISTER
44     (
45         value
46     )
47 };
48
49 struct StringPair {
50     std::string first;
51     std::string second;
52
53     CONFIG_REGISTER
54     (
55         first,
56         second
57     )
58 };
59
60 struct VectorOfStrings {
61     std::vector<std::string> values;
62
63     CONFIG_REGISTER
64     (
65         values
66     )
67 };
68
69 struct VectorOfStringPairs {
70     std::vector<api::StringPair> values;
71
72     CONFIG_REGISTER
73     (
74         values
75     )
76 };
77
78 typedef api::String ZoneId;
79 typedef api::String Declaration;
80 typedef api::String FileMoveRequestStatus;
81 typedef api::StringPair GetNetDevAttrsIn;
82 typedef api::StringPair CreateNetDevPhysIn;
83 typedef api::StringPair RemoveDeclarationIn;
84 typedef api::StringPair CreateZoneIn;
85 typedef api::StringPair RevokeDeviceIn;
86 typedef api::StringPair DestroyNetDevIn;
87 typedef api::StringPair ConnectionState;
88 typedef api::StringPair NotifActiveZoneIn;
89 typedef api::StringPair FileMoveRequestIn;
90 typedef api::VectorOfStrings ZoneIds;
91 typedef api::VectorOfStrings Declarations;
92 typedef api::VectorOfStrings NetDevList;
93 typedef api::VectorOfStringPairs Connections;
94 typedef api::VectorOfStringPairs GetNetDevAttrs;
95
96 struct ZoneInfoOut {
97     std::string id;
98     int vt;
99     std::string state;
100     std::string rootPath;
101
102     CONFIG_REGISTER
103     (
104         id,
105         vt,
106         state,
107         rootPath
108     )
109 };
110
111 struct SetNetDevAttrsIn {
112     std::string id; // Zone's id
113     std::string netDev;
114     std::vector<StringPair> attrs;
115
116     CONFIG_REGISTER
117     (
118         id,
119         netDev,
120         attrs
121     )
122 };
123
124 struct CreateNetDevVethIn {
125     std::string id;
126     std::string zoneDev;
127     std::string hostDev;
128
129     CONFIG_REGISTER
130     (
131         id,
132         zoneDev,
133         hostDev
134     )
135 };
136
137 struct CreateNetDevMacvlanIn {
138     std::string id;
139     std::string zoneDev;
140     std::string hostDev;
141     uint32_t mode;
142
143     CONFIG_REGISTER
144     (
145         id,
146         zoneDev,
147         hostDev,
148         mode
149     )
150 };
151
152 struct DeleteNetdevIpAddressIn {
153     std::string zone;
154     std::string netdev;
155     std::string ip;
156
157     CONFIG_REGISTER
158     (
159         zone,
160         netdev,
161         ip
162     )
163 };
164
165 struct DeclareFileIn {
166     std::string zone;
167     int32_t type;
168     std::string path;
169     int32_t flags;
170     int32_t mode;
171
172     CONFIG_REGISTER
173     (
174         zone,
175         type,
176         path,
177         flags,
178         mode
179     )
180 };
181
182 struct DeclareMountIn {
183     std::string source;
184     std::string zone;
185     std::string target;
186     std::string type;
187     uint64_t flags;
188     std::string data;
189
190     CONFIG_REGISTER
191     (
192         source,
193         zone,
194         target,
195         type,
196         flags,
197         data
198     )
199 };
200
201 struct DeclareLinkIn
202 {
203     std::string source;
204     std::string zone;
205     std::string target;
206
207     CONFIG_REGISTER
208     (
209         source,
210         zone,
211         target
212     )
213 };
214
215 struct GrantDeviceIn
216 {
217     std::string id;
218     std::string device;
219     uint32_t flags;
220
221     CONFIG_REGISTER
222     (
223         id,
224         device,
225         flags
226     )
227 };
228
229 struct Notification
230 {
231     std::string zone;
232     std::string application;
233     std::string message;
234
235     CONFIG_REGISTER
236     (
237         zone,
238         application,
239         message
240     )
241 };
242
243 } // namespace api
244 } // namespace vasum
245
246 #endif // COMMON_API_MESSAGES