api fix
[oweals/gnunet.git] / src / set / set.h
1 /*
2      This file is part of GNUnet.
3      (C) 2012 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 2, 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 consensus/consensus.h
24  * @brief
25  */
26 #ifndef SET_H
27 #define SET_H
28
29 #include "gnunet_common.h"
30
31
32 /**
33  * The service sends up to GNUNET_SET_ACK_WINDOW messages per client handle,
34  * the client should send an ack every GNUNET_SET_ACK_WINDOW/2 messages.
35  */
36 #define GNUNET_SET_ACK_WINDOW 8
37
38
39 GNUNET_NETWORK_STRUCT_BEGIN
40
41 struct SetCreateMessage
42 {
43   /**
44    * Type: GNUNET_MESSAGE_TYPE_SET_CREATE
45    */
46   struct GNUNET_MessageHeader header;
47
48   /**
49    * Operation type, values of enum GNUNET_SET_OperationType
50    */
51   uint16_t operation GNUNET_PACKED;
52 };
53
54
55 struct ListenMessage
56 {
57   /**
58    * Type: GNUNET_MESSAGE_TYPE_SET_LISTEN
59    */
60   struct GNUNET_MessageHeader header;
61
62   /**
63    * application id
64    */
65   struct GNUNET_HashCode app_id;
66
67   /**
68    * Operation type, values of enum GNUNET_SET_OperationType
69    */
70   uint16_t operation GNUNET_PACKED;
71
72   /**
73    * Operation type, values of enum GNUNET_SET_OperationType
74    */
75   uint16_t op GNUNET_PACKED;
76   
77 };
78
79
80 struct AcceptMessage
81 {
82   /**
83    * Type: GNUNET_MESSAGE_TYPE_SET_ACCEPT
84    */
85   struct GNUNET_MessageHeader header;
86
87   /**
88    * request id of the request we want to accept
89    */
90   uint32_t request_id GNUNET_PACKED;
91 };
92
93
94 struct RequestMessage
95 {
96   /**
97    * Type: GNUNET_MESSAGE_TYPE_SET_Request
98    */
99   struct GNUNET_MessageHeader header;
100
101   /**
102    * requesting peer
103    */
104   struct GNUNET_PeerIdentity peer_id;
105
106   /**
107    * request id of the request we want to accept
108    */
109   uint32_t request_id GNUNET_PACKED;
110
111   /* rest: inner message */
112 };
113
114
115 struct EvaluateMessage
116 {
117   /**
118    * Type: GNUNET_MESSAGE_TYPE_SET_EVALUATE
119    */
120   struct GNUNET_MessageHeader header;
121
122   struct GNUNET_PeerIdentity other_peer;
123
124   struct GNUNET_HashCode app_id;
125
126   /**
127    * id of our evaluate
128    */
129   uint32_t request_id GNUNET_PACKED;
130
131   /* rest: inner message */
132 };
133
134
135 struct ResultMessage
136 {
137   /**
138    * Type: GNUNET_MESSAGE_TYPE_SET_RESULT
139    */
140   struct GNUNET_MessageHeader header;
141
142   /**
143    * id the result belongs to
144    */
145   uint32_t request_id GNUNET_PACKED;
146
147   uint16_t result_status GNUNET_PACKED;
148
149   uint16_t element_type GNUNET_PACKED;
150
151   /* rest: the actual element */
152 };
153
154
155 struct ElementMessage
156 {
157   /**
158    * Type: GNUNET_MESSAGE_TYPE_SET_ADD or
159    *       GNUNET_MESSAGE_TYPE_SET_REMOVE
160    */
161   struct GNUNET_MessageHeader header;
162
163   uint16_t element_type GNUNET_PACKED;
164
165   /* rest: the actual element */
166 };
167
168
169 struct CancelMessage
170 {
171   /**
172    * Type: GNUNET_MESSAGE_TYPE_SET_CANCEL
173    */
174   struct GNUNET_MessageHeader header;
175
176   /**
177    * id we want to cancel result belongs to
178    */
179   uint32_t request_id GNUNET_PACKED;
180 };
181
182 GNUNET_NETWORK_STRUCT_END
183
184 #endif