2 This file is part of GNUnet.
3 Copyright (C) 2012-2014 GNUnet e.V.
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 * @brief messages used for the set api
23 * @author Florian Dold
24 * @author Christian Grothoff
30 #include "gnunet_common.h"
31 #include "gnunet_set_service.h"
33 GNUNET_NETWORK_STRUCT_BEGIN
36 * Message sent by the client to the service to ask starting
37 * a new set to perform operations with. Includes the desired
40 struct GNUNET_SET_CreateMessage
43 * Type: #GNUNET_MESSAGE_TYPE_SET_CREATE
45 struct GNUNET_MessageHeader header;
48 * Operation type, values of `enum GNUNET_SET_OperationType`
50 uint32_t operation GNUNET_PACKED;
55 * Message sent by the client to the service to start listening for
56 * incoming requests to perform a certain type of set operation for a
57 * certain type of application.
59 struct GNUNET_SET_ListenMessage
62 * Type: #GNUNET_MESSAGE_TYPE_SET_LISTEN
64 struct GNUNET_MessageHeader header;
67 * Operation type, values of `enum GNUNET_SET_OperationType`
69 uint32_t operation GNUNET_PACKED;
74 struct GNUNET_HashCode app_id;
80 * Message sent by a listening client to the service to accept
81 * performing the operation with the other peer.
83 struct GNUNET_SET_AcceptMessage
86 * Type: #GNUNET_MESSAGE_TYPE_SET_ACCEPT
88 struct GNUNET_MessageHeader header;
91 * ID of the incoming request we want to accept.
93 uint32_t accept_reject_id GNUNET_PACKED;
96 * Request ID to identify responses.
98 uint32_t request_id GNUNET_PACKED;
101 * How should results be sent to us?
102 * See `enum GNUNET_SET_ResultMode`.
104 uint32_t result_mode GNUNET_PACKED;
107 * Always use delta operation instead of sending full sets,
108 * even it it's less efficient.
113 * Always send full sets, even if delta operations would
119 * #GNUNET_YES to fail operations where Byzantine faults
125 * Lower bound for the set size, used only when
126 * byzantine mode is enabled.
128 uint8_t byzantine_lower_bound;
133 * Message sent by a listening client to the service to reject
134 * performing the operation with the other peer.
136 struct GNUNET_SET_RejectMessage
139 * Type: #GNUNET_MESSAGE_TYPE_SET_REJECT
141 struct GNUNET_MessageHeader header;
144 * ID of the incoming request we want to reject.
146 uint32_t accept_reject_id GNUNET_PACKED;
152 * A request for an operation with another client.
154 struct GNUNET_SET_RequestMessage
157 * Type: #GNUNET_MESSAGE_TYPE_SET_REQUEST.
159 struct GNUNET_MessageHeader header;
162 * ID of the to identify the request when accepting or
165 uint32_t accept_id GNUNET_PACKED;
168 * Identity of the requesting peer.
170 struct GNUNET_PeerIdentity peer_id;
172 /* rest: context message, that is, application-specific
173 message to convince listener to pick up */
178 * Message sent by client to service to initiate a set operation as a
179 * client (not as listener). A set (which determines the operation
180 * type) must already exist in association with this client.
182 struct GNUNET_SET_EvaluateMessage
185 * Type: #GNUNET_MESSAGE_TYPE_SET_EVALUATE
187 struct GNUNET_MessageHeader header;
190 * How should results be sent to us?
191 * See `enum GNUNET_SET_ResultMode`.
193 uint32_t result_mode GNUNET_PACKED;
196 * Peer to evaluate the operation with
198 struct GNUNET_PeerIdentity target_peer;
203 struct GNUNET_HashCode app_id;
206 * Id of our set to evaluate, chosen implicitly by the client when it
207 * calls #GNUNET_SET_commit().
209 uint32_t request_id GNUNET_PACKED;
212 * Always use delta operation instead of sending full sets,
213 * even it it's less efficient.
218 * Always send full sets, even if delta operations would
224 * #GNUNET_YES to fail operations where Byzantine faults
230 * Lower bound for the set size, used only when
231 * byzantine mode is enabled.
233 uint8_t byzantine_lower_bound;
235 /* rest: context message, that is, application-specific
236 message to convince listener to pick up */
241 * Message sent by the service to the client to indicate an
242 * element that is removed (set intersection) or added
243 * (set union) or part of the final result, depending on
244 * options specified for the operation.
246 struct GNUNET_SET_ResultMessage
249 * Type: #GNUNET_MESSAGE_TYPE_SET_RESULT
251 struct GNUNET_MessageHeader header;
254 * id the result belongs to
256 uint32_t request_id GNUNET_PACKED;
259 * Was the evaluation successful? Contains
260 * an `enum GNUNET_SET_Status` in NBO.
262 uint16_t result_status GNUNET_PACKED;
265 * Type of the element attachted to the message, if any.
267 uint16_t element_type GNUNET_PACKED;
269 /* rest: the actual element */
274 * Message sent by client to the service to add or remove
275 * an element to/from the set.
277 struct GNUNET_SET_ElementMessage
280 * Type: #GNUNET_MESSAGE_TYPE_SET_ADD or
281 * #GNUNET_MESSAGE_TYPE_SET_REMOVE
283 struct GNUNET_MessageHeader header;
286 * Type of the element to add or remove.
288 uint16_t element_type GNUNET_PACKED;
291 * For alignment, always zero.
293 uint16_t reserved GNUNET_PACKED;
295 /* rest: the actual element */
300 * Sent to the service by the client
301 * in order to cancel a set operation.
303 struct GNUNET_SET_CancelMessage
306 * Type: #GNUNET_MESSAGE_TYPE_SET_CANCEL
308 struct GNUNET_MessageHeader header;
311 * ID of the request we want to cancel.
313 uint32_t request_id GNUNET_PACKED;
318 * Set element transmitted by service to client in response to a set
321 struct GNUNET_SET_IterResponseMessage
324 * Type: #GNUNET_MESSAGE_TYPE_SET_ITER_ELEMENT
326 struct GNUNET_MessageHeader header;
329 * To which set iteration does this reponse belong to? First
330 * iteration (per client) has counter zero. Wraps around.
332 uint16_t iteration_id GNUNET_PACKED;
335 * Type of the element attachted to the message,
338 uint16_t element_type GNUNET_PACKED;
345 * Client acknowledges receiving element in iteration.
347 struct GNUNET_SET_IterAckMessage
350 * Type: #GNUNET_MESSAGE_TYPE_SET_ITER_ACK
352 struct GNUNET_MessageHeader header;
355 * Non-zero if the service should continue sending elements.
362 * Server responds to a lazy copy request.
364 struct GNUNET_SET_CopyLazyResponseMessage
367 * Type: #GNUNET_MESSAGE_TYPE_SET_COPY_LAZY_RESPONSE
369 struct GNUNET_MessageHeader header;
372 * Temporary name for the copied set.
379 * Client connects to a lazily copied set.
381 struct GNUNET_SET_CopyLazyConnectMessage
384 * Type: #GNUNET_MESSAGE_TYPE_SET_COPY_LAZY_CONNECT
386 struct GNUNET_MessageHeader header;
389 * Temporary name for the copied set.
395 GNUNET_NETWORK_STRUCT_END