multicast,psyc,social: remove DEBUG #defines from tests to keep `make check` working
[oweals/gnunet.git] / src / multicast / multicast.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  * @file multicast/multicast.h
23  * @brief multicast IPC messages
24  * @author Christian Grothoff
25  * @author Gabor X Toth
26  */
27 #ifndef MULTICAST_H
28 #define MULTICAST_H
29
30 GNUNET_NETWORK_STRUCT_BEGIN
31
32
33 /**
34  * Header of a join request sent to the origin or another member.
35  */
36 struct MulticastJoinRequestMessage
37 {
38   /**
39    * Type: GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_REQUEST
40    */
41   struct GNUNET_MessageHeader header;
42
43   /**
44    * Always zero.
45    */
46   uint32_t reserved;
47
48   /**
49    * ECC signature of the rest of the fields of the join request.
50    *
51    * Signature must match the public key of the joining member.
52    */
53   struct GNUNET_CRYPTO_EcdsaSignature signature;
54
55   /**
56    * Purpose for the signature and size of the signed data.
57    */
58   struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
59
60   /**
61    * Public key of the target group.
62    */
63   struct GNUNET_CRYPTO_EddsaPublicKey group_key;
64
65   /**
66    * Public key of the joining member.
67    */
68   struct GNUNET_CRYPTO_EcdsaPublicKey member_key;
69
70   /**
71    * Peer identity of the joining member.
72    */
73   struct GNUNET_PeerIdentity member_peer;
74
75   /* Followed by struct GNUNET_MessageHeader join_request */
76 };
77
78
79 /**
80  * Header of a join decision message sent to a peer requesting join.
81  */
82 struct MulticastJoinDecisionMessage
83 {
84   /**
85    * Type: GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_DECISION
86    */
87   struct GNUNET_MessageHeader header;
88
89   /**
90    * #GNUNET_YES    if the peer was admitted
91    * #GNUNET_NO     if entry was refused,
92    * #GNUNET_SYSERR if the request could not be answered.
93    */
94   int32_t is_admitted;
95
96   /**
97    * Number of relays given.
98    */
99   uint32_t relay_count;
100
101   /* Followed by relay_count peer identities */
102
103   /* Followed by the join response message */
104 };
105
106
107 /**
108  * Header added to a struct MulticastJoinDecisionMessage
109  * when sent between the client and service.
110  */
111 struct MulticastJoinDecisionMessageHeader
112 {
113   /**
114    * Type: GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_DECISION
115    */
116   struct GNUNET_MessageHeader header;
117
118   /**
119    * C->S: Peer to send the join decision to.
120    * S->C: Peer we received the join decision from.
121    */
122   struct GNUNET_PeerIdentity peer;
123
124   /**
125    * C->S: Public key of the member requesting join.
126    * S->C: Unused.
127    */
128   struct GNUNET_CRYPTO_EcdsaPublicKey member_key;
129
130   /* Followed by struct MulticastJoinDecisionMessage */
131 };
132
133
134 /**
135  * Message sent from the client to the service to notify the service
136  * about the result of a membership test.
137  */
138 struct MulticastMembershipTestResultMessage
139 {
140   /**
141    * Type: GNUNET_MESSAGE_TYPE_MULTICAST_MEMBERSHIP_TEST_RESULT
142    */
143   struct GNUNET_MessageHeader header;
144
145   /**
146    * Unique ID that identifies the associated membership test.
147    */
148   uint32_t uid;
149
150   /**
151    * #GNUNET_YES    if the peer is a member
152    * #GNUNET_NO     if peer is not a member,
153    * #GNUNET_SYSERR if the test could not be answered.
154    */
155   int32_t is_admitted;
156 };
157
158
159 /**
160  * Message sent from the client to the service to give the service
161  * a replayed message.
162  */
163 struct MulticastReplayResponseMessage
164 {
165
166   /**
167    *
168    */
169   struct GNUNET_MessageHeader header;
170
171   /**
172    * Unique ID that identifies the associated replay session.
173    */
174   uint32_t uid;
175
176   /**
177    * An `enum GNUNET_MULTICAST_ReplayErrorCode` identifying issues (in NBO).
178    */
179   int32_t error_code;
180
181   /* followed by replayed message */
182
183 };
184
185
186 /**
187  * Message sent from the client to the service to notify the service
188  * about the end of a replay session.
189  */
190 struct MulticastReplayEndMessage
191 {
192
193   /**
194    *
195    */
196   struct GNUNET_MessageHeader header;
197
198   /**
199    * Unique ID that identifies the associated replay session.
200    */
201   uint32_t uid;
202
203 };
204
205
206 /**
207  * Message sent from the client to the service to notify the service
208  * about the starting of a multicast group with this peers as its origin.
209  */
210 struct MulticastOriginStartMessage
211 {
212   /**
213    * Type: GNUNET_MESSAGE_TYPE_MULTICAST_ORIGIN_START
214    */
215   struct GNUNET_MessageHeader header;
216
217   /**
218    * Always zero.
219    */
220   uint32_t reserved;
221
222   /**
223    * Private, non-ephemeral key for the multicast group.
224    */
225   struct GNUNET_CRYPTO_EddsaPrivateKey group_key;
226
227   /**
228    * Last fragment ID sent to the group, used to continue counting fragments if
229    * we resume operating * a group.
230    */
231   uint64_t max_fragment_id;
232
233 };
234
235
236 struct MulticastMemberJoinMessage
237 {
238   /**
239    * Type: GNUNET_MESSAGE_TYPE_MULTICAST_MEMBER_JOIN
240    */
241   struct GNUNET_MessageHeader header;
242
243   uint32_t relay_count GNUNET_PACKED;
244
245   struct GNUNET_CRYPTO_EddsaPublicKey group_key;
246
247   struct GNUNET_CRYPTO_EcdsaPrivateKey member_key;
248
249   struct GNUNET_PeerIdentity origin;
250
251   /* Followed by struct GNUNET_PeerIdentity relays[relay_count] */
252
253   /* Followed by struct GNUNET_MessageHeader join_msg */
254 };
255
256
257 /**
258  * Message sent from the client to the service to broadcast to all group
259  * members.
260  */
261 struct MulticastBroadcastMessage
262 {
263
264   /**
265    *
266    */
267   struct GNUNET_MessageHeader header;
268
269   /**
270    * #GNUNET_OK normally, #GNUNET_SYSERR if the origin aborted the
271    * transmission.
272    */
273   int32_t status;
274
275   /**
276    * Message ID.
277    */
278   uint64_t message_id;
279
280   /**
281    * Group generation.
282    */
283   uint64_t group_generation;
284
285   /**
286    * Total message size.
287    */
288   uint64_t total_size;
289
290 };
291
292
293 /**
294  * Message sent from the client to the service to join a multicast group.
295  */
296 struct MulticastJoinMessage
297 {
298
299   /**
300    *
301    */
302   struct GNUNET_MessageHeader header;
303
304   /**
305    * Number of relays we (think) we already know about.
306    */
307   uint32_t relay_count;
308
309   /**
310    * Public non-ephemeral key of the mutlicast group.
311    */
312   struct GNUNET_CRYPTO_EddsaPublicKey group_key;
313
314   /**
315    * Our private key for the group.
316    */
317   struct GNUNET_CRYPTO_EcdsaPrivateKey member_key;
318
319   /* followed by 'relay_count' `struct GNUNET_PeerIdentity`s */
320
321 };
322
323
324
325 /**
326  * Message sent from the client to the service OR the service to the
327  * client asking for a message fragment to be replayed.
328  */
329 struct MulticastReplayRequestMessage
330 {
331
332   /**
333    * The message type can be either
334    * #GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_REQUEST or
335    * #GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_REQUEST_CANCEL.
336    */
337   struct GNUNET_MessageHeader header;
338
339   /**
340    * Replay request ID.
341    */
342   uint32_t uid;
343
344   /**
345    * ID of the message that is being requested.
346    */
347   uint64_t message_id;
348
349   /**
350    * Offset of the fragment that is being requested.
351    */
352   uint64_t fragment_offset;
353
354   /**
355    * Additional flags for the request.
356    */
357   uint64_t flags;
358
359 };
360
361
362
363 /**
364  * Message sent from the client to the service to unicast to the group origin.
365  */
366 struct MulticastUnicastToOriginMessage
367 {
368
369   /**
370    *
371    */
372   struct GNUNET_MessageHeader header;
373
374   /**
375    * Reserved (always 0).
376    */
377   uint32_t reserved;
378
379   /**
380    * Message ID.
381    */
382   uint64_t message_id;
383
384   /**
385    * Total message size.
386    */
387   uint64_t total_size;
388
389   /* followed by payload */
390
391 };
392
393
394 /**
395  * Message sent from the client to the service to
396  * cancel unicast to the group origin.
397  */
398 struct MulticastUnicastToOriginCancelMessage
399 {
400
401   /**
402    *
403    */
404   struct GNUNET_MessageHeader header;
405
406   /**
407    * Reserved (always 0).
408    */
409   uint32_t reserved;
410
411   /**
412    * Message ID.
413    */
414   uint64_t message_id;
415
416 };
417
418
419 GNUNET_NETWORK_STRUCT_END
420
421 #endif
422 /* end of multicast.h */