2 This file is part of GNUnet.
3 (C) 2012, 2013 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., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, 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 #GNUNE_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 */
191 struct GNUNET_SET_ResultMessage
194 * Type: #GNUNET_MESSAGE_TYPE_SET_RESULT
196 struct GNUNET_MessageHeader header;
199 * id the result belongs to
201 uint32_t request_id GNUNET_PACKED;
204 * Was the evaluation successful? Contains
205 * an `enum GNUNET_SET_Status` in NBO.
207 uint16_t result_status GNUNET_PACKED;
210 * Type of the element attachted to the message,
213 uint16_t element_type GNUNET_PACKED;
215 /* rest: the actual element */
220 * Message sent by client to the service to add or remove
221 * an element to/from the set.
223 struct GNUNET_SET_ElementMessage
226 * Type: #GNUNET_MESSAGE_TYPE_SET_ADD or
227 * #GNUNET_MESSAGE_TYPE_SET_REMOVE
229 struct GNUNET_MessageHeader header;
232 * Type of the element to add or remove.
234 uint16_t element_type GNUNET_PACKED;
237 * For alignment, always zero.
239 uint16_t reserved GNUNET_PACKED;
241 /* rest: the actual element */
246 * Sent to the service by the client
247 * in order to cancel a set operation.
249 struct GNUNET_SET_CancelMessage
252 * Type: #GNUNET_MESSAGE_TYPE_SET_CANCEL
254 struct GNUNET_MessageHeader header;
257 * ID of the request we want to cancel.
259 uint32_t request_id GNUNET_PACKED;
264 * Set element transmitted by service to client in response to a set
267 struct GNUNET_SET_IterResponseMessage
270 * Type: #GNUNET_MESSAGE_TYPE_SET_ITER_RESPONSE
272 struct GNUNET_MessageHeader header;
275 * To which set iteration does this reponse belong to? First
276 * iteration (per client) has counter zero. Wraps around.
278 uint16_t iteration_id GNUNET_PACKED;
281 * Type of the element attachted to the message,
284 uint16_t element_type GNUNET_PACKED;
291 * Client acknowledges receiving element in iteration.
293 struct GNUNET_SET_IterAckMessage
296 * Type: #GNUNET_MESSAGE_TYPE_SET_ITER_ACK
298 struct GNUNET_MessageHeader header;
301 * Non-zero if the service should continue sending elements.
306 GNUNET_NETWORK_STRUCT_END