fixing unchecked return values
[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 GNUNET_MULTICAST_JoinRequest
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 request body. */
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   /**
188    *
189    */
190   struct GNUNET_MessageHeader header;
191
192   /**
193    * Always zero.
194    */
195   uint32_t reserved;
196
197   /**
198    * Private, non-ephemeral key for the mutlicast group.
199    */
200   struct GNUNET_CRYPTO_EddsaPrivateKey group_key;
201
202   /**
203    * Last fragment ID, used to continue counting fragments if we resume operating
204    * a group.
205    */
206   uint64_t last_fragment_id;
207
208 };
209
210
211 /**
212  * Message sent from the client to the service to broadcast to all group
213  * members.
214  */
215 struct MulticastBroadcastMessage
216 {
217
218   /**
219    *
220    */
221   struct GNUNET_MessageHeader header;
222
223   /**
224    * #GNUNET_OK normally, #GNUNET_SYSERR if the origin aborted the
225    * transmission.
226    */
227   int32_t status;
228
229   /**
230    * Message ID.
231    */
232   uint64_t message_id;
233
234   /**
235    * Group generation.
236    */
237   uint64_t group_generation;
238
239   /**
240    * Total message size.
241    */
242   uint64_t total_size;
243
244 };
245
246
247 /**
248  * Message sent from the client to the service to join a multicast group.
249  */
250 struct MulticastJoinMessage
251 {
252
253   /**
254    *
255    */
256   struct GNUNET_MessageHeader header;
257
258   /**
259    * Number of relays we (think) we already know about.
260    */
261   uint32_t relay_count;
262
263   /**
264    * Public non-ephemeral key of the mutlicast group.
265    */
266   struct GNUNET_CRYPTO_EddsaPublicKey group_key;
267
268   /**
269    * Our private key for the group.
270    */
271   struct GNUNET_CRYPTO_EddsaPrivateKey member_key;
272
273   /* followed by 'relay_count' `struct GNUNET_PeerIdentity`s */
274
275 };
276
277
278
279 /**
280  * Message sent from the client to the service OR the service to the
281  * client asking for a message fragment to be replayed.
282  */
283 struct MulticastReplayRequestMessage
284 {
285
286   /**
287    * The message type can be either
288    * #GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_REQUEST or
289    * #GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_REQUEST_CANCEL.
290    */
291   struct GNUNET_MessageHeader header;
292
293   /**
294    * Replay request ID.
295    */
296   uint32_t uid;
297
298   /**
299    * ID of the message that is being requested.
300    */
301   uint64_t message_id;
302
303   /**
304    * Offset of the fragment that is being requested.
305    */
306   uint64_t fragment_offset;
307
308   /**
309    * Additional flags for the request.
310    */
311   uint64_t flags;
312
313 };
314
315
316
317 /**
318  * Message sent from the client to the service to unicast to the group origin.
319  */
320 struct MulticastUnicastToOriginMessage
321 {
322
323   /**
324    *
325    */
326   struct GNUNET_MessageHeader header;
327
328   /**
329    * Reserved (always 0).
330    */
331   uint32_t reserved;
332
333   /**
334    * Message ID.
335    */
336   uint64_t message_id;
337
338   /**
339    * Total message size.
340    */
341   uint64_t total_size;
342
343   /* followed by payload */
344
345 };
346
347
348 /**
349  * Message sent from the client to the service to
350  * cancel unicast to the group origin.
351  */
352 struct MulticastUnicastToOriginCancelMessage
353 {
354
355   /**
356    *
357    */
358   struct GNUNET_MessageHeader header;
359
360   /**
361    * Reserved (always 0).
362    */
363   uint32_t reserved;
364
365   /**
366    * Message ID.
367    */
368   uint64_t message_id;
369
370 };
371
372
373 GNUNET_NETWORK_STRUCT_END
374
375 #endif
376 /* end of multicast.h */