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 2, 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"
34 * The service sends up to GNUNET_SET_ACK_WINDOW messages per client handle,
35 * the client should send an ack every GNUNET_SET_ACK_WINDOW/2 messages.
37 #define GNUNET_SET_ACK_WINDOW 8
40 GNUNET_NETWORK_STRUCT_BEGIN
42 struct SetCreateMessage
45 * Type: GNUNET_MESSAGE_TYPE_SET_CREATE
47 struct GNUNET_MessageHeader header;
50 * Operation type, values of enum GNUNET_SET_OperationType
52 // FIXME: use 32_t for 'enum'.
53 uint16_t operation GNUNET_PACKED;
60 * Type: GNUNET_MESSAGE_TYPE_SET_LISTEN
62 struct GNUNET_MessageHeader header;
65 * Operation type, values of enum GNUNET_SET_OperationType
67 uint16_t operation GNUNET_PACKED;
72 struct GNUNET_HashCode app_id;
80 * Type: GNUNET_MESSAGE_TYPE_SET_ACCEPT
82 struct GNUNET_MessageHeader header;
85 * Request id that will be sent along with
86 * results for the accepted operation.
87 * Chosen by the client.
88 * Must be 0 if the request has been rejected.
90 uint32_t request_id GNUNET_PACKED;
93 * ID of the incoming request we want to accept / reject.
95 uint32_t accept_id GNUNET_PACKED;
100 * A request for an operation with another client.
102 struct RequestMessage
105 * Type: GNUNET_MESSAGE_TYPE_SET_Request.
107 struct GNUNET_MessageHeader header;
110 * ID of the request we want to accept,
111 * chosen by the service.
113 uint32_t accept_id GNUNET_PACKED;
116 * Identity of the requesting peer.
118 struct GNUNET_PeerIdentity peer_id;
120 /* rest: nested context message */
124 struct 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 peer;
144 struct GNUNET_HashCode app_id;
147 * Salt to use for the operation
149 uint16_t salt GNUNET_PACKED;
154 uint16_t reserved GNUNET_PACKED;
156 /* rest: inner message */
163 * Type: GNUNET_MESSAGE_TYPE_SET_RESULT
165 struct GNUNET_MessageHeader header;
168 * id the result belongs to
170 uint32_t request_id GNUNET_PACKED;
173 * Was the evaluation successful?
175 uint16_t result_status GNUNET_PACKED;
178 * Type of the element attachted to the message,
181 uint16_t element_type GNUNET_PACKED;
183 /* rest: the actual element */
187 struct ElementMessage
190 * Type: GNUNET_MESSAGE_TYPE_SET_ADD or
191 * GNUNET_MESSAGE_TYPE_SET_REMOVE
193 struct GNUNET_MessageHeader header;
195 uint16_t element_type GNUNET_PACKED;
197 uint16_t reserved GNUNET_PACKED;
199 /* rest: the actual element */
206 * Type: GNUNET_MESSAGE_TYPE_SET_CANCEL
208 struct GNUNET_MessageHeader header;
211 * id we want to cancel result belongs to
213 uint32_t request_id GNUNET_PACKED;
217 GNUNET_NETWORK_STRUCT_END