2 This file is part of GNUnet.
3 Copyright (C) 2012-2014 Christian Grothoff (and other contributing authors)
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"
32 GNUNET_NETWORK_STRUCT_BEGIN
35 * Message sent by the client to the service to ask starting
36 * a new set to perform operations with. Includes the desired
39 struct GNUNET_SET_CreateMessage
42 * Type: #GNUNET_MESSAGE_TYPE_SET_CREATE
44 struct GNUNET_MessageHeader header;
47 * Operation type, values of `enum GNUNET_SET_OperationType`
49 uint32_t operation GNUNET_PACKED;
54 * Message sent by the client to the service to start listening for
55 * incoming requests to perform a certain type of set operation for a
56 * certain type of application.
58 struct GNUNET_SET_ListenMessage
61 * Type: #GNUNET_MESSAGE_TYPE_SET_LISTEN
63 struct GNUNET_MessageHeader header;
66 * Operation type, values of `enum GNUNET_SET_OperationType`
68 uint32_t operation GNUNET_PACKED;
73 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;
108 * Message sent by a listening client to the service to reject
109 * performing the operation with the other peer.
111 struct GNUNET_SET_RejectMessage
114 * Type: #GNUNET_MESSAGE_TYPE_SET_REJECT
116 struct GNUNET_MessageHeader header;
119 * ID of the incoming request we want to reject.
121 uint32_t accept_reject_id GNUNET_PACKED;
127 * A request for an operation with another client.
129 struct GNUNET_SET_RequestMessage
132 * Type: #GNUNET_MESSAGE_TYPE_SET_REQUEST.
134 struct GNUNET_MessageHeader header;
137 * ID of the to identify the request when accepting or
140 uint32_t accept_id GNUNET_PACKED;
143 * Identity of the requesting peer.
145 struct GNUNET_PeerIdentity peer_id;
147 /* rest: context message, that is, application-specific
148 message to convince listener to pick up */
153 * Message sent by client to service to initiate a set operation as a
154 * client (not as listener). A set (which determines the operation
155 * type) must already exist in association with this client.
157 struct GNUNET_SET_EvaluateMessage
160 * Type: #GNUNET_MESSAGE_TYPE_SET_EVALUATE
162 struct GNUNET_MessageHeader header;
165 * How should results be sent to us?
166 * See `enum GNUNET_SET_ResultMode`.
168 uint32_t result_mode GNUNET_PACKED;
171 * Peer to evaluate the operation with
173 struct GNUNET_PeerIdentity target_peer;
178 struct GNUNET_HashCode app_id;
181 * Id of our set to evaluate, chosen implicitly by the client when it
182 * calls #GNUNET_SET_commit().
184 uint32_t request_id GNUNET_PACKED;
186 /* rest: context message, that is, application-specific
187 message to convince listener to pick up */
192 * Message sent by the service to the client to indicate an
193 * element that is removed (set intersection) or added
194 * (set union) or part of the final result, depending on
195 * options specified for the operation.
197 struct GNUNET_SET_ResultMessage
200 * Type: #GNUNET_MESSAGE_TYPE_SET_RESULT
202 struct GNUNET_MessageHeader header;
205 * id the result belongs to
207 uint32_t request_id GNUNET_PACKED;
210 * Was the evaluation successful? Contains
211 * an `enum GNUNET_SET_Status` in NBO.
213 uint16_t result_status GNUNET_PACKED;
216 * Type of the element attachted to the message, if any.
218 uint16_t element_type GNUNET_PACKED;
220 /* rest: the actual element */
225 * Message sent by client to the service to add or remove
226 * an element to/from the set.
228 struct GNUNET_SET_ElementMessage
231 * Type: #GNUNET_MESSAGE_TYPE_SET_ADD or
232 * #GNUNET_MESSAGE_TYPE_SET_REMOVE
234 struct GNUNET_MessageHeader header;
237 * Type of the element to add or remove.
239 uint16_t element_type GNUNET_PACKED;
242 * For alignment, always zero.
244 uint16_t reserved GNUNET_PACKED;
246 /* rest: the actual element */
251 * Sent to the service by the client
252 * in order to cancel a set operation.
254 struct GNUNET_SET_CancelMessage
257 * Type: #GNUNET_MESSAGE_TYPE_SET_CANCEL
259 struct GNUNET_MessageHeader header;
262 * ID of the request we want to cancel.
264 uint32_t request_id GNUNET_PACKED;
269 * Set element transmitted by service to client in response to a set
272 struct GNUNET_SET_IterResponseMessage
275 * Type: #GNUNET_MESSAGE_TYPE_SET_ITER_ELEMENT
277 struct GNUNET_MessageHeader header;
280 * To which set iteration does this reponse belong to? First
281 * iteration (per client) has counter zero. Wraps around.
283 uint16_t iteration_id GNUNET_PACKED;
286 * Type of the element attachted to the message,
289 uint16_t element_type GNUNET_PACKED;
296 * Client acknowledges receiving element in iteration.
298 struct GNUNET_SET_IterAckMessage
301 * Type: #GNUNET_MESSAGE_TYPE_SET_ITER_ACK
303 struct GNUNET_MessageHeader header;
306 * Non-zero if the service should continue sending elements.
313 * Server responds to a lazy copy request.
315 struct GNUNET_SET_CopyLazyResponseMessage
318 * Type: #GNUNET_MESSAGE_TYPE_SET_COPY_LAZY_RESPONSE
320 struct GNUNET_MessageHeader header;
323 * Temporary name for the copied set.
330 * Client connects to a lazily copied set.
332 struct GNUNET_SET_CopyLazyConnectMessage
335 * Type: #GNUNET_MESSAGE_TYPE_SET_COPY_LAZY_CONNECT
337 struct GNUNET_MessageHeader header;
340 * Temporary name for the copied set.
346 GNUNET_NETWORK_STRUCT_END