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