session time out for http client/server
[oweals/gnunet.git] / src / set / set.h
1 /*
2      This file is part of GNUnet.
3      (C) 2012, 2013 Christian Grothoff (and other contributing authors)
4
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.
9
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.
14
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.
19 */
20
21 /**
22  * @author Florian Dold
23  * @file set/set.h
24  * @brief messages used for the set api
25  */
26 #ifndef SET_H
27 #define SET_H
28
29 #include "platform.h"
30 #include "gnunet_common.h"
31
32 #define GNUNET_SET_ACK_WINDOW 10
33
34
35 GNUNET_NETWORK_STRUCT_BEGIN
36
37 struct GNUNET_SET_CreateMessage
38 {
39   /**
40    * Type: GNUNET_MESSAGE_TYPE_SET_CREATE
41    */
42   struct GNUNET_MessageHeader header;
43
44   /**
45    * Operation type, values of enum GNUNET_SET_OperationType
46    */
47   // FIXME: use 32_t for 'enum'.
48   uint16_t operation GNUNET_PACKED;
49 };
50
51
52 struct GNUNET_SET_ListenMessage
53 {
54   /**
55    * Type: GNUNET_MESSAGE_TYPE_SET_LISTEN
56    */
57   struct GNUNET_MessageHeader header;
58
59   /**
60    * Operation type, values of enum GNUNET_SET_OperationType
61    */
62   uint32_t operation GNUNET_PACKED;
63
64   /**
65    * application id
66    */
67   struct GNUNET_HashCode app_id;
68
69 };
70
71
72 struct GNUNET_SET_AcceptRejectMessage
73 {
74   /**
75    * Type: GNUNET_MESSAGE_TYPE_SET_ACCEPT or
76    *       GNUNET_MESSAGE_TYPE_SET_REJECT
77    */
78   struct GNUNET_MessageHeader header;
79
80   /**
81    * ID of the incoming request we want to accept / reject.
82    */
83   uint32_t accept_reject_id GNUNET_PACKED;
84
85   /**
86    * Request ID to identify responses,
87    * must be 0 if we don't accept the request.
88    */
89   uint32_t request_id GNUNET_PACKED;
90
91   /**
92    * How should results be sent to us?
93    * See enum GNUNET_SET_ResultMode.
94    */
95   uint16_t result_mode GNUNET_PACKED;
96 };
97
98
99 /**
100  * A request for an operation with another client.
101  */
102 struct GNUNET_SET_RequestMessage
103 {
104   /**
105    * Type: GNUNET_MESSAGE_TYPE_SET_Request.
106    */
107   struct GNUNET_MessageHeader header;
108
109   /**
110    * Identity of the requesting peer.
111    */
112   struct GNUNET_PeerIdentity peer_id;
113
114   /**
115    * ID of the to identify the request when accepting or
116    * rejecting it.
117    */
118   uint32_t accept_id GNUNET_PACKED;
119
120   /* rest: nested context message */
121 };
122
123
124 struct GNUNET_SET_EvaluateMessage
125 {
126   /**
127    * Type: GNUNET_MESSAGE_TYPE_SET_EVALUATE
128    */
129   struct GNUNET_MessageHeader header;
130
131   /**
132    * id of our evaluate, chosen by the client
133    */
134   uint32_t request_id GNUNET_PACKED;
135
136   /**
137    * Peer to evaluate the operation with
138    */
139   struct GNUNET_PeerIdentity target_peer;
140
141   /**
142    * Application id
143    */
144   struct GNUNET_HashCode app_id;
145
146   /**
147    * Salt to use for the operation
148    */
149   uint16_t salt GNUNET_PACKED;
150
151   /**
152    * How should results be sent to us?
153    * See enum GNUNET_SET_ResultMode.
154    */
155   uint16_t result_mode GNUNET_PACKED;
156
157   /* rest: inner message */
158 };
159
160
161 struct GNUNET_SET_ResultMessage
162 {
163   /**
164    * Type: GNUNET_MESSAGE_TYPE_SET_RESULT
165    */
166   struct GNUNET_MessageHeader header;
167
168   /**
169    * id the result belongs to
170    */
171   uint32_t request_id GNUNET_PACKED;
172
173   /**
174    * Was the evaluation successful?
175    */
176   uint16_t result_status GNUNET_PACKED;
177
178   /**
179    * Type of the element attachted to the message,
180    * if any.
181    */
182   uint16_t element_type GNUNET_PACKED;
183
184   /* rest: the actual element */
185 };
186
187
188 struct GNUNET_SET_ElementMessage
189 {
190   /**
191    * Type: GNUNET_MESSAGE_TYPE_SET_ADD or
192    *       GNUNET_MESSAGE_TYPE_SET_REMOVE
193    */
194   struct GNUNET_MessageHeader header;
195
196   uint16_t element_type GNUNET_PACKED;
197
198   uint16_t reserved GNUNET_PACKED;
199
200   /* rest: the actual element */
201 };
202
203
204 /**
205  * Sent to the service by the client
206  * in order to cancel a set operation.
207  */
208 struct GNUNET_SET_CancelMessage
209 {
210   /**
211    * Type: GNUNET_MESSAGE_TYPE_SET_CANCEL
212    */
213   struct GNUNET_MessageHeader header;
214
215   /**
216    * ID of the request we want to cancel.
217    */
218   uint32_t request_id GNUNET_PACKED;
219 };
220
221 struct GNUNET_SET_IterResponseMessage
222 {
223   /**
224    * Type: GNUNET_MESSAGE_TYPE_SET_ITER_RESPONSE
225    */
226   struct GNUNET_MessageHeader header;
227
228   /**
229    * Type of the element attachted to the message,
230    * if any.
231    */
232   uint16_t element_type GNUNET_PACKED;
233
234   /* rest: element */
235 };
236
237 struct GNUNET_SET_IterAckMessage
238 {
239   /**
240    * Type: GNUNET_MESSAGE_TYPE_SET_ITER_ACK
241    */
242   struct GNUNET_MessageHeader header;
243
244   /**
245    * Non-zero if the service should continue sending elements.
246    */
247   uint32_t send_more;
248 };
249
250 GNUNET_NETWORK_STRUCT_END
251
252 #endif