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 * @author Florian Dold
24 * @brief messages used for the set api
30 #include "gnunet_common.h"
32 #define GNUNET_SET_ACK_WINDOW 10
35 GNUNET_NETWORK_STRUCT_BEGIN
37 struct GNUNET_SET_CreateMessage
40 * Type: GNUNET_MESSAGE_TYPE_SET_CREATE
42 struct GNUNET_MessageHeader header;
45 * Operation type, values of enum GNUNET_SET_OperationType
47 // FIXME: use 32_t for 'enum'.
48 uint16_t operation GNUNET_PACKED;
52 struct GNUNET_SET_ListenMessage
55 * Type: GNUNET_MESSAGE_TYPE_SET_LISTEN
57 struct GNUNET_MessageHeader header;
60 * Operation type, values of enum GNUNET_SET_OperationType
62 uint32_t operation GNUNET_PACKED;
67 struct GNUNET_HashCode app_id;
72 struct GNUNET_SET_AcceptRejectMessage
75 * Type: GNUNET_MESSAGE_TYPE_SET_ACCEPT or
76 * GNUNET_MESSAGE_TYPE_SET_REJECT
78 struct GNUNET_MessageHeader header;
81 * ID of the incoming request we want to accept / reject.
83 uint32_t accept_reject_id GNUNET_PACKED;
86 * Request ID to identify responses,
87 * must be 0 if we don't accept the request.
89 uint32_t request_id GNUNET_PACKED;
92 * How should results be sent to us?
93 * See enum GNUNET_SET_ResultMode.
95 uint16_t result_mode GNUNET_PACKED;
100 * A request for an operation with another client.
102 struct GNUNET_SET_RequestMessage
105 * Type: GNUNET_MESSAGE_TYPE_SET_Request.
107 struct GNUNET_MessageHeader header;
110 * Identity of the requesting peer.
112 struct GNUNET_PeerIdentity peer_id;
115 * ID of the to identify the request when accepting or
118 uint32_t accept_id GNUNET_PACKED;
120 /* rest: nested context message */
124 struct GNUNET_SET_EvaluateMessage
127 * Type: GNUNET_MESSAGE_TYPE_SET_EVALUATE
129 struct GNUNET_MessageHeader header;
132 * id of our evaluate, chosen by the client
134 uint32_t request_id GNUNET_PACKED;
137 * Peer to evaluate the operation with
139 struct GNUNET_PeerIdentity target_peer;
144 struct GNUNET_HashCode app_id;
147 * Salt to use for the operation
149 uint16_t salt GNUNET_PACKED;
152 * How should results be sent to us?
153 * See enum GNUNET_SET_ResultMode.
155 uint16_t result_mode GNUNET_PACKED;
157 /* rest: inner message */
161 struct GNUNET_SET_ResultMessage
164 * Type: GNUNET_MESSAGE_TYPE_SET_RESULT
166 struct GNUNET_MessageHeader header;
169 * id the result belongs to
171 uint32_t request_id GNUNET_PACKED;
174 * Was the evaluation successful?
176 uint16_t result_status GNUNET_PACKED;
179 * Type of the element attachted to the message,
182 uint16_t element_type GNUNET_PACKED;
184 /* rest: the actual element */
188 struct GNUNET_SET_ElementMessage
191 * Type: GNUNET_MESSAGE_TYPE_SET_ADD or
192 * GNUNET_MESSAGE_TYPE_SET_REMOVE
194 struct GNUNET_MessageHeader header;
196 uint16_t element_type GNUNET_PACKED;
198 uint16_t reserved GNUNET_PACKED;
200 /* rest: the actual element */
205 * Sent to the service by the client
206 * in order to cancel a set operation.
208 struct GNUNET_SET_CancelMessage
211 * Type: GNUNET_MESSAGE_TYPE_SET_CANCEL
213 struct GNUNET_MessageHeader header;
216 * ID of the request we want to cancel.
218 uint32_t request_id GNUNET_PACKED;
221 struct GNUNET_SET_IterResponseMessage
224 * Type: GNUNET_MESSAGE_TYPE_SET_ITER_RESPONSE
226 struct GNUNET_MessageHeader header;
229 * Type of the element attachted to the message,
232 uint16_t element_type GNUNET_PACKED;
237 struct GNUNET_SET_IterAckMessage
240 * Type: GNUNET_MESSAGE_TYPE_SET_ITER_ACK
242 struct GNUNET_MessageHeader header;
245 * Non-zero if the service should continue sending elements.
250 GNUNET_NETWORK_STRUCT_END