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: context message, that is, application-specific
154 message to convince listener to pick up */
159 * Message sent by client to service to initiate a set operation as a
160 * client (not as listener). A set (which determines the operation
161 * type) must already exist in association with this client.
163 struct GNUNET_SET_EvaluateMessage
166 * Type: #GNUNET_MESSAGE_TYPE_SET_EVALUATE
168 struct GNUNET_MessageHeader header;
171 * How should results be sent to us?
172 * See `enum GNUNET_SET_ResultMode`.
174 uint32_t result_mode GNUNET_PACKED;
177 * Peer to evaluate the operation with
179 struct GNUNET_PeerIdentity target_peer;
184 struct GNUNET_HashCode app_id;
187 * Id of our set to evaluate, chosen implicitly by the client when it
188 * calls #GNUNE_SET_commit().
190 uint32_t request_id GNUNET_PACKED;
192 /* rest: context message, that is, application-specific
193 message to convince listener to pick up */
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,
219 uint16_t element_type GNUNET_PACKED;
221 /* rest: the actual element */
226 * Message sent by client to the service to add or remove
227 * an element to/from the set.
229 struct GNUNET_SET_ElementMessage
232 * Type: #GNUNET_MESSAGE_TYPE_SET_ADD or
233 * #GNUNET_MESSAGE_TYPE_SET_REMOVE
235 struct GNUNET_MessageHeader header;
238 * Type of the element to add or remove.
240 uint16_t element_type GNUNET_PACKED;
243 * For alignment, always zero.
245 uint16_t reserved GNUNET_PACKED;
247 /* rest: the actual element */
252 * Sent to the service by the client
253 * in order to cancel a set operation.
255 struct GNUNET_SET_CancelMessage
258 * Type: #GNUNET_MESSAGE_TYPE_SET_CANCEL
260 struct GNUNET_MessageHeader header;
263 * ID of the request we want to cancel.
265 uint32_t request_id GNUNET_PACKED;
269 struct GNUNET_SET_IterResponseMessage
272 * Type: #GNUNET_MESSAGE_TYPE_SET_ITER_RESPONSE
274 struct GNUNET_MessageHeader header;
277 * Type of the element attachted to the message,
280 uint16_t element_type GNUNET_PACKED;
285 struct GNUNET_SET_IterAckMessage
288 * Type: #GNUNET_MESSAGE_TYPE_SET_ITER_ACK
290 struct GNUNET_MessageHeader header;
293 * Non-zero if the service should continue sending elements.
298 GNUNET_NETWORK_STRUCT_END