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/>.
20 * @brief messages used for the set api
21 * @author Florian Dold
22 * @author Christian Grothoff
28 #include "gnunet_common.h"
29 #include "gnunet_set_service.h"
31 GNUNET_NETWORK_STRUCT_BEGIN
34 * Message sent by the client to the service to ask starting
35 * a new set to perform operations with. Includes the desired
38 struct GNUNET_SET_CreateMessage
41 * Type: #GNUNET_MESSAGE_TYPE_SET_CREATE
43 struct GNUNET_MessageHeader header;
46 * Operation type, values of `enum GNUNET_SET_OperationType`
48 uint32_t operation GNUNET_PACKED;
53 * Message sent by the client to the service to start listening for
54 * incoming requests to perform a certain type of set operation for a
55 * certain type of application.
57 struct GNUNET_SET_ListenMessage
60 * Type: #GNUNET_MESSAGE_TYPE_SET_LISTEN
62 struct GNUNET_MessageHeader header;
65 * Operation type, values of `enum GNUNET_SET_OperationType`
67 uint32_t operation GNUNET_PACKED;
72 struct GNUNET_HashCode app_id;
78 * Message sent by a listening client to the service to accept
79 * performing the operation with the other peer.
81 struct GNUNET_SET_AcceptMessage
84 * Type: #GNUNET_MESSAGE_TYPE_SET_ACCEPT
86 struct GNUNET_MessageHeader header;
89 * ID of the incoming request we want to accept.
91 uint32_t accept_reject_id GNUNET_PACKED;
94 * Request ID to identify responses.
96 uint32_t request_id GNUNET_PACKED;
99 * How should results be sent to us?
100 * See `enum GNUNET_SET_ResultMode`.
102 uint32_t result_mode GNUNET_PACKED;
105 * Always use delta operation instead of sending full sets,
106 * even it it's less efficient.
111 * Always send full sets, even if delta operations would
117 * #GNUNET_YES to fail operations where Byzantine faults
123 * Lower bound for the set size, used only when
124 * byzantine mode is enabled.
126 uint8_t byzantine_lower_bound;
131 * Message sent by a listening client to the service to reject
132 * performing the operation with the other peer.
134 struct GNUNET_SET_RejectMessage
137 * Type: #GNUNET_MESSAGE_TYPE_SET_REJECT
139 struct GNUNET_MessageHeader header;
142 * ID of the incoming request we want to reject.
144 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