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"
35 #define GNUNET_SET_ACK_WINDOW 10
38 GNUNET_NETWORK_STRUCT_BEGIN
41 * Message sent by the client to the service to ask starting
42 * a new set to perform operations with. Includes the desired
45 struct GNUNET_SET_CreateMessage
48 * Type: #GNUNET_MESSAGE_TYPE_SET_CREATE
50 struct GNUNET_MessageHeader header;
53 * Operation type, values of `enum GNUNET_SET_OperationType`
55 uint32_t operation GNUNET_PACKED;
60 * Message sent by the client to the service to start listening for
61 * incoming requests to perform a certain type of set operation for a
62 * certain type of application.
64 struct GNUNET_SET_ListenMessage
67 * Type: #GNUNET_MESSAGE_TYPE_SET_LISTEN
69 struct GNUNET_MessageHeader header;
72 * Operation type, values of `enum GNUNET_SET_OperationType`
74 uint32_t operation GNUNET_PACKED;
79 struct GNUNET_HashCode app_id;
85 * Message sent by a listening client to the service to accept
86 * performing the operation with the other peer.
88 struct GNUNET_SET_AcceptMessage
91 * Type: #GNUNET_MESSAGE_TYPE_SET_ACCEPT
93 struct GNUNET_MessageHeader header;
96 * ID of the incoming request we want to accept.
98 uint32_t accept_reject_id GNUNET_PACKED;
101 * Request ID to identify responses.
103 uint32_t request_id GNUNET_PACKED;
106 * How should results be sent to us?
107 * See `enum GNUNET_SET_ResultMode`.
109 uint32_t result_mode GNUNET_PACKED;
114 * Message sent by a listening client to the service to reject
115 * performing the operation with the other peer.
117 struct GNUNET_SET_RejectMessage
120 * Type: #GNUNET_MESSAGE_TYPE_SET_REJECT
122 struct GNUNET_MessageHeader header;
125 * ID of the incoming request we want to reject.
127 uint32_t accept_reject_id GNUNET_PACKED;
133 * A request for an operation with another client.
135 struct GNUNET_SET_RequestMessage
138 * Type: #GNUNET_MESSAGE_TYPE_SET_REQUEST.
140 struct GNUNET_MessageHeader header;
143 * ID of the to identify the request when accepting or
146 uint32_t accept_id GNUNET_PACKED;
149 * Identity of the requesting peer.
151 struct GNUNET_PeerIdentity peer_id;
153 /* rest: nested context message */
158 * Message sent by client to service to initiate a set operation as a
159 * client (not as listener). A set (which determines the operation
160 * type) must already exist in association with this client.
162 struct GNUNET_SET_EvaluateMessage
165 * Type: #GNUNET_MESSAGE_TYPE_SET_EVALUATE
167 struct GNUNET_MessageHeader header;
170 * How should results be sent to us?
171 * See `enum GNUNET_SET_ResultMode`.
173 uint32_t result_mode GNUNET_PACKED;
176 * Peer to evaluate the operation with
178 struct GNUNET_PeerIdentity target_peer;
183 struct GNUNET_HashCode app_id;
186 * Id of our set to evaluate, chosen implicitly by the client when it
187 * calls #GNUNE_SET_commit().
189 uint32_t request_id GNUNET_PACKED;
191 /* rest: context message, that is, application-specific
192 message to convince listener to pick up */
196 struct GNUNET_SET_ResultMessage
199 * Type: #GNUNET_MESSAGE_TYPE_SET_RESULT
201 struct GNUNET_MessageHeader header;
204 * id the result belongs to
206 uint32_t request_id GNUNET_PACKED;
209 * Was the evaluation successful?
211 uint16_t result_status GNUNET_PACKED;
214 * Type of the element attachted to the message,
217 uint16_t element_type GNUNET_PACKED;
219 /* rest: the actual element */
224 * Message sent by client to the service to add or remove
225 * an element to/from the set.
227 struct GNUNET_SET_ElementMessage
230 * Type: #GNUNET_MESSAGE_TYPE_SET_ADD or
231 * #GNUNET_MESSAGE_TYPE_SET_REMOVE
233 struct GNUNET_MessageHeader header;
236 * Type of the element to add or remove.
238 uint16_t element_type GNUNET_PACKED;
241 * For alignment, always zero.
243 uint16_t reserved GNUNET_PACKED;
245 /* rest: the actual element */
250 * Sent to the service by the client
251 * in order to cancel a set operation.
253 struct GNUNET_SET_CancelMessage
256 * Type: #GNUNET_MESSAGE_TYPE_SET_CANCEL
258 struct GNUNET_MessageHeader header;
261 * ID of the request we want to cancel.
263 uint32_t request_id GNUNET_PACKED;
267 struct GNUNET_SET_IterResponseMessage
270 * Type: #GNUNET_MESSAGE_TYPE_SET_ITER_RESPONSE
272 struct GNUNET_MessageHeader header;
275 * Type of the element attachted to the message,
278 uint16_t element_type GNUNET_PACKED;
283 struct GNUNET_SET_IterAckMessage
286 * Type: #GNUNET_MESSAGE_TYPE_SET_ITER_ACK
288 struct GNUNET_MessageHeader header;
291 * Non-zero if the service should continue sending elements.
296 GNUNET_NETWORK_STRUCT_END