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 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.
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.
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/>.
18 SPDX-License-Identifier: AGPL3.0-or-later
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;
79 * Message sent by a listening client to the service to accept
80 * performing the operation with the other peer.
82 struct GNUNET_SET_AcceptMessage
85 * Type: #GNUNET_MESSAGE_TYPE_SET_ACCEPT
87 struct GNUNET_MessageHeader header;
90 * ID of the incoming request we want to accept.
92 uint32_t accept_reject_id GNUNET_PACKED;
95 * Request ID to identify responses.
97 uint32_t request_id GNUNET_PACKED;
100 * How should results be sent to us?
101 * See `enum GNUNET_SET_ResultMode`.
103 uint32_t result_mode GNUNET_PACKED;
106 * Always use delta operation instead of sending full sets,
107 * even it it's less efficient.
112 * Always send full sets, even if delta operations would
118 * #GNUNET_YES to fail operations where Byzantine faults
124 * Lower bound for the set size, used only when
125 * byzantine mode is enabled.
127 uint8_t byzantine_lower_bound;
132 * Message sent by a listening client to the service to reject
133 * performing the operation with the other peer.
135 struct GNUNET_SET_RejectMessage
138 * Type: #GNUNET_MESSAGE_TYPE_SET_REJECT
140 struct GNUNET_MessageHeader header;
143 * ID of the incoming request we want to reject.
145 uint32_t accept_reject_id GNUNET_PACKED;
150 * A request for an operation with another client.
152 struct GNUNET_SET_RequestMessage
155 * Type: #GNUNET_MESSAGE_TYPE_SET_REQUEST.
157 struct GNUNET_MessageHeader header;
160 * ID of the to identify the request when accepting or
163 uint32_t accept_id GNUNET_PACKED;
166 * Identity of the requesting peer.
168 struct GNUNET_PeerIdentity peer_id;
170 /* rest: context message, that is, application-specific
171 message to convince listener to pick up */
176 * Message sent by client to service to initiate a set operation as a
177 * client (not as listener). A set (which determines the operation
178 * type) must already exist in association with this client.
180 struct GNUNET_SET_EvaluateMessage
183 * Type: #GNUNET_MESSAGE_TYPE_SET_EVALUATE
185 struct GNUNET_MessageHeader header;
188 * How should results be sent to us?
189 * See `enum GNUNET_SET_ResultMode`.
191 uint32_t result_mode GNUNET_PACKED;
194 * Peer to evaluate the operation with
196 struct GNUNET_PeerIdentity target_peer;
201 struct GNUNET_HashCode app_id;
204 * Id of our set to evaluate, chosen implicitly by the client when it
205 * calls #GNUNET_SET_commit().
207 uint32_t request_id GNUNET_PACKED;
210 * Always use delta operation instead of sending full sets,
211 * even it it's less efficient.
216 * Always send full sets, even if delta operations would
222 * #GNUNET_YES to fail operations where Byzantine faults
228 * Lower bound for the set size, used only when
229 * byzantine mode is enabled.
231 uint8_t byzantine_lower_bound;
233 /* rest: context message, that is, application-specific
234 message to convince listener to pick up */
239 * Message sent by the service to the client to indicate an
240 * element that is removed (set intersection) or added
241 * (set union) or part of the final result, depending on
242 * options specified for the operation.
244 struct GNUNET_SET_ResultMessage
247 * Type: #GNUNET_MESSAGE_TYPE_SET_RESULT
249 struct GNUNET_MessageHeader header;
254 uint64_t current_size;
257 * id the result belongs to
259 uint32_t request_id GNUNET_PACKED;
262 * Was the evaluation successful? Contains
263 * an `enum GNUNET_SET_Status` in NBO.
265 uint16_t result_status GNUNET_PACKED;
268 * Type of the element attachted to the message, if any.
270 uint16_t element_type GNUNET_PACKED;
272 /* rest: the actual element */
277 * Message sent by client to the service to add or remove
278 * an element to/from the set.
280 struct GNUNET_SET_ElementMessage
283 * Type: #GNUNET_MESSAGE_TYPE_SET_ADD or
284 * #GNUNET_MESSAGE_TYPE_SET_REMOVE
286 struct GNUNET_MessageHeader header;
289 * Type of the element to add or remove.
291 uint16_t element_type GNUNET_PACKED;
294 * For alignment, always zero.
296 uint16_t reserved GNUNET_PACKED;
298 /* rest: the actual element */
303 * Sent to the service by the client
304 * in order to cancel a set operation.
306 struct GNUNET_SET_CancelMessage
309 * Type: #GNUNET_MESSAGE_TYPE_SET_CANCEL
311 struct GNUNET_MessageHeader header;
314 * ID of the request we want to cancel.
316 uint32_t request_id GNUNET_PACKED;
321 * Set element transmitted by service to client in response to a set
324 struct GNUNET_SET_IterResponseMessage
327 * Type: #GNUNET_MESSAGE_TYPE_SET_ITER_ELEMENT
329 struct GNUNET_MessageHeader header;
332 * To which set iteration does this reponse belong to? First
333 * iteration (per client) has counter zero. Wraps around.
335 uint16_t iteration_id GNUNET_PACKED;
338 * Type of the element attachted to the message,
341 uint16_t element_type GNUNET_PACKED;
348 * Client acknowledges receiving element in iteration.
350 struct GNUNET_SET_IterAckMessage
353 * Type: #GNUNET_MESSAGE_TYPE_SET_ITER_ACK
355 struct GNUNET_MessageHeader header;
358 * Non-zero if the service should continue sending elements.
365 * Server responds to a lazy copy request.
367 struct GNUNET_SET_CopyLazyResponseMessage
370 * Type: #GNUNET_MESSAGE_TYPE_SET_COPY_LAZY_RESPONSE
372 struct GNUNET_MessageHeader header;
375 * Temporary name for the copied set.
382 * Client connects to a lazily copied set.
384 struct GNUNET_SET_CopyLazyConnectMessage
387 * Type: #GNUNET_MESSAGE_TYPE_SET_COPY_LAZY_CONNECT
389 struct GNUNET_MessageHeader header;
392 * Temporary name for the copied set.
398 GNUNET_NETWORK_STRUCT_END