- re-added testcase for crypto-paillier
[oweals/gnunet.git] / src / psyc / psyc.h
1 /*
2  * This file is part of GNUnet
3  * (C) 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  * @file psyc/psyc.h
23  * @brief Common type definitions for the PSYC service and API.
24  * @author Gabor X Toth
25  */
26
27 #ifndef PSYC_H
28 #define PSYC_H
29
30 #include "gnunet_common.h"
31
32
33 enum MessageState
34 {
35   MSG_STATE_START = 0,
36   MSG_STATE_HEADER = 1,
37   MSG_STATE_METHOD = 2,
38   MSG_STATE_MODIFIER = 3,
39   MSG_STATE_MOD_CONT = 4,
40   MSG_STATE_DATA = 5,
41   MSG_STATE_END = 6,
42   MSG_STATE_CANCEL = 7,
43 };
44
45
46 GNUNET_NETWORK_STRUCT_BEGIN
47
48 /**** service -> library ****/
49
50 /**
51  * Answer from service to client about last operation.
52  */
53 struct OperationResult
54 {
55   /**
56    * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_CODE
57    */
58   struct GNUNET_MessageHeader header;
59
60   /**
61    * Operation ID.
62    */
63   uint32_t op_id GNUNET_PACKED;
64
65   /**
66    * Status code for the operation.
67    */
68   int64_t result_code GNUNET_PACKED;
69
70   /* followed by NUL-terminated error message (on error) */
71 };
72
73
74 struct CountersResult
75 {
76   /**
77    * Type: GNUNET_MESSAGE_TYPE_PSYC_RESULT_COUNTERS
78    */
79   struct GNUNET_MessageHeader header;
80
81   /**
82    * Status code for the operation.
83    */
84   int32_t result_code GNUNET_PACKED;
85
86   uint64_t max_message_id;
87 };
88
89
90 #if REMOVE
91 /**
92  * Transmit acknowledgment.
93  *
94  * Sent after the last GNUNET_PSYC_MessageModifier and after each
95  * GNUNET_PSYC_MessageData.
96  *
97  * This message acknowledges previously received messages and asks for the next
98  * fragment of data.
99  */
100 struct TransmitAck
101 {
102   /**
103    * Type: GNUNET_MESSAGE_TYPE_PSYC_TRANSMIT_ACK
104    */
105   struct GNUNET_MessageHeader header;
106
107   /**
108    * Buffer space available for the next data fragment.
109    */
110   uint16_t buf_avail;
111 };
112 #endif
113
114
115 /**** library -> service ****/
116
117
118 struct MasterStartRequest
119 {
120   /**
121    * Type: GNUNET_MESSAGE_TYPE_PSYC_MASTER_START
122    */
123   struct GNUNET_MessageHeader header;
124
125   struct GNUNET_CRYPTO_EddsaPrivateKey channel_key;
126
127   uint32_t policy GNUNET_PACKED;
128 };
129
130
131 struct SlaveJoinRequest
132 {
133   /**
134    * Type: GNUNET_MESSAGE_TYPE_PSYC_SLAVE_JOIN
135    */
136   struct GNUNET_MessageHeader header;
137
138   uint32_t relay_count GNUNET_PACKED;
139
140   struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
141
142   struct GNUNET_CRYPTO_EddsaPrivateKey slave_key;
143
144   struct GNUNET_PeerIdentity origin;
145
146   /* Followed by struct GNUNET_PeerIdentity relays[relay_count] */
147 };
148
149
150 struct ChannelSlaveAdd
151 {
152   /**
153    * Type: GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_SLAVE_ADD
154    */
155   struct GNUNET_MessageHeader header;
156
157   uint32_t reserved;
158
159   struct GNUNET_CRYPTO_EddsaPublicKey *slave_key;
160
161   uint64_t announced_at;
162
163   uint64_t effective_since;
164 };
165
166
167 struct ChannelSlaveRemove
168 {
169   /**
170    * Type: GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_SLAVE_RM
171    */
172   struct GNUNET_MessageHeader header;
173
174   uint32_t reserved;
175
176   struct GNUNET_CRYPTO_EddsaPublicKey *slave_key;
177
178   uint64_t announced_at;
179 };
180
181
182 struct StoryRequest
183 {
184   /**
185    * Type: GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_STORY_REQUEST
186    */
187   struct GNUNET_MessageHeader header;
188
189   uint64_t op_id;
190
191   uint64_t start_message_id;
192
193   uint64_t end_message_id;
194 };
195
196
197 struct StateQuery
198 {
199   /**
200    * Type: GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_STATE_QUERY
201    */
202   struct GNUNET_MessageHeader header;
203
204   uint64_t op_id;
205
206   /* Followed by NUL-terminated name. */
207 };
208
209
210 struct StateResult
211 {
212   /**
213    * Type: GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_STATE_RESULT
214    */
215   struct GNUNET_MessageHeader header;
216
217   /**
218    * Size of name, including NUL terminator.
219    */
220   uint16_t name_size GNUNET_PACKED;
221
222   /**
223    * OR'd StateOpFlags
224    */
225   uint8_t flags;
226
227   /* Followed by NUL-terminated name, then the value. */
228 };
229
230
231 GNUNET_NETWORK_STRUCT_END
232
233 #endif