aboutsummaryrefslogtreecommitdiff
path: root/src/setu/setu.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/setu/setu.h')
-rw-r--r--src/setu/setu.h304
1 files changed, 304 insertions, 0 deletions
diff --git a/src/setu/setu.h b/src/setu/setu.h
new file mode 100644
index 000000000..f1c5df92b
--- /dev/null
+++ b/src/setu/setu.h
@@ -0,0 +1,304 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2012-2014, 2020 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20/**
21 * @file set/set.h
22 * @brief messages used for the set union api
23 * @author Florian Dold
24 * @author Christian Grothoff
25 */
26#ifndef SET_H
27#define SET_H
28
29#include "platform.h"
30#include "gnunet_common.h"
31#include "gnunet_set_service.h"
32
33GNUNET_NETWORK_STRUCT_BEGIN
34
35/**
36 * Message sent by the client to the service to ask starting
37 * a new set to perform operations with. Includes the desired
38 * set operation type.
39 */
40struct GNUNET_SETU_CreateMessage
41{
42 /**
43 * Type: #GNUNET_MESSAGE_TYPE_SETU_CREATE
44 */
45 struct GNUNET_MessageHeader header;
46
47};
48
49
50/**
51 * Message sent by the client to the service to start listening for
52 * incoming requests to perform a certain type of set operation for a
53 * certain type of application.
54 */
55struct GNUNET_SETU_ListenMessage
56{
57 /**
58 * Type: #GNUNET_MESSAGE_TYPE_SETU_LISTEN
59 */
60 struct GNUNET_MessageHeader header;
61
62 /**
63 * Always zero.
64 */
65 uint32_t reserved GNUNET_PACKED;
66
67 /**
68 * application id
69 */
70 struct GNUNET_HashCode app_id;
71};
72
73
74/**
75 * Message sent by a listening client to the service to accept
76 * performing the operation with the other peer.
77 */
78struct GNUNET_SETU_AcceptMessage
79{
80 /**
81 * Type: #GNUNET_MESSAGE_TYPE_SETU_ACCEPT
82 */
83 struct GNUNET_MessageHeader header;
84
85 /**
86 * ID of the incoming request we want to accept.
87 */
88 uint32_t accept_reject_id GNUNET_PACKED;
89
90 /**
91 * Request ID to identify responses.
92 */
93 uint32_t request_id GNUNET_PACKED;
94
95 /**
96 * Always use delta operation instead of sending full sets,
97 * even it it's less efficient.
98 */
99 uint8_t force_delta;
100
101 /**
102 * Always send full sets, even if delta operations would
103 * be more efficient.
104 */
105 uint8_t force_full;
106
107 /**
108 * #GNUNET_YES to fail operations where Byzantine faults
109 * are suspected
110 */
111 uint8_t byzantine;
112
113 /**
114 * Lower bound for the set size, used only when
115 * byzantine mode is enabled.
116 */
117 uint8_t byzantine_lower_bound;
118};
119
120
121/**
122 * Message sent by a listening client to the service to reject
123 * performing the operation with the other peer.
124 */
125struct GNUNET_SETU_RejectMessage
126{
127 /**
128 * Type: #GNUNET_MESSAGE_TYPE_SETU_REJECT
129 */
130 struct GNUNET_MessageHeader header;
131
132 /**
133 * ID of the incoming request we want to reject.
134 */
135 uint32_t accept_reject_id GNUNET_PACKED;
136};
137
138
139/**
140 * A request for an operation with another client.
141 */
142struct GNUNET_SETU_RequestMessage
143{
144 /**
145 * Type: #GNUNET_MESSAGE_TYPE_SETU_REQUEST.
146 */
147 struct GNUNET_MessageHeader header;
148
149 /**
150 * ID of the to identify the request when accepting or
151 * rejecting it.
152 */
153 uint32_t accept_id GNUNET_PACKED;
154
155 /**
156 * Identity of the requesting peer.
157 */
158 struct GNUNET_PeerIdentity peer_id;
159
160 /* rest: context message, that is, application-specific
161 message to convince listener to pick up */
162};
163
164
165/**
166 * Message sent by client to service to initiate a set operation as a
167 * client (not as listener). A set (which determines the operation
168 * type) must already exist in association with this client.
169 */
170struct GNUNET_SETU_EvaluateMessage
171{
172 /**
173 * Type: #GNUNET_MESSAGE_TYPE_SETU_EVALUATE
174 */
175 struct GNUNET_MessageHeader header;
176
177 /**
178 * Id of our set to evaluate, chosen implicitly by the client when it
179 * calls #GNUNET_SETU_commit().
180 */
181 uint32_t request_id GNUNET_PACKED;
182
183 /**
184 * Peer to evaluate the operation with
185 */
186 struct GNUNET_PeerIdentity target_peer;
187
188 /**
189 * Application id
190 */
191 struct GNUNET_HashCode app_id;
192
193 /**
194 * Always use delta operation instead of sending full sets,
195 * even it it's less efficient.
196 */
197 uint8_t force_delta;
198
199 /**
200 * Always send full sets, even if delta operations would
201 * be more efficient.
202 */
203 uint8_t force_full;
204
205 /**
206 * #GNUNET_YES to fail operations where Byzantine faults
207 * are suspected
208 */
209 uint8_t byzantine;
210
211 /**
212 * Lower bound for the set size, used only when
213 * byzantine mode is enabled.
214 */
215 uint8_t byzantine_lower_bound;
216
217 /* rest: context message, that is, application-specific
218 message to convince listener to pick up */
219};
220
221
222/**
223 * Message sent by the service to the client to indicate an
224 * element that is removed (set intersection) or added
225 * (set union) or part of the final result, depending on
226 * options specified for the operation.
227 */
228struct GNUNET_SETU_ResultMessage
229{
230 /**
231 * Type: #GNUNET_MESSAGE_TYPE_SETU_RESULT
232 */
233 struct GNUNET_MessageHeader header;
234
235 /**
236 * Current set size.
237 */
238 uint64_t current_size;
239
240 /**
241 * id the result belongs to
242 */
243 uint32_t request_id GNUNET_PACKED;
244
245 /**
246 * Was the evaluation successful? Contains
247 * an `enum GNUNET_SETU_Status` in NBO.
248 */
249 uint16_t result_status GNUNET_PACKED;
250
251 /**
252 * Type of the element attachted to the message, if any.
253 */
254 uint16_t element_type GNUNET_PACKED;
255
256 /* rest: the actual element */
257};
258
259
260/**
261 * Message sent by client to the service to add
262 * an element to the set.
263 */
264struct GNUNET_SETU_ElementMessage
265{
266 /**
267 * Type: #GNUNET_MESSAGE_TYPE_SETU_ADD
268 */
269 struct GNUNET_MessageHeader header;
270
271 /**
272 * Type of the element to add or remove.
273 */
274 uint16_t element_type GNUNET_PACKED;
275
276 /**
277 * For alignment, always zero.
278 */
279 uint16_t reserved GNUNET_PACKED;
280
281 /* rest: the actual element */
282};
283
284
285/**
286 * Sent to the service by the client in order to cancel a set operation.
287 */
288struct GNUNET_SETU_CancelMessage
289{
290 /**
291 * Type: #GNUNET_MESSAGE_TYPE_SETU_CANCEL
292 */
293 struct GNUNET_MessageHeader header;
294
295 /**
296 * ID of the request we want to cancel.
297 */
298 uint32_t request_id GNUNET_PACKED;
299};
300
301
302GNUNET_NETWORK_STRUCT_END
303
304#endif