aboutsummaryrefslogtreecommitdiff
path: root/src/multicast
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-21 09:51:18 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-21 09:51:18 +0000
commit34ce99c24a0b09f119da24df01caefe387f36b80 (patch)
treedce096db8915ae8d75218e88809c6a407c436794 /src/multicast
parent632cef13b6015609f980562692df4dddf1d8e6d2 (diff)
downloadgnunet-34ce99c24a0b09f119da24df01caefe387f36b80.tar.gz
gnunet-34ce99c24a0b09f119da24df01caefe387f36b80.zip
towards multicast IPC messages
Diffstat (limited to 'src/multicast')
-rw-r--r--src/multicast/multicast.h279
-rw-r--r--src/multicast/multicast_api.c8
2 files changed, 282 insertions, 5 deletions
diff --git a/src/multicast/multicast.h b/src/multicast/multicast.h
new file mode 100644
index 000000000..5a18af461
--- /dev/null
+++ b/src/multicast/multicast.h
@@ -0,0 +1,279 @@
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 */
26#ifndef MULTICAST_H
27#define MULTICAST_H
28
29GNUNET_NETWORK_STRUCT_BEGIN
30
31
32/**
33 * Message sent from the client to the service to notify the service
34 * about a join decision.
35 */
36struct MulticastJoinDecisionMessage
37{
38
39 /**
40 *
41 */
42 struct GNUNET_MessageHeader header;
43
44 /**
45 * Unique ID that identifies the associated join test.
46 */
47 uint32_t uid;
48
49 /**
50 * #GNUNET_YES if the peer was admitted.
51 */
52 int32_t is_admitted;
53
54 /**
55 * Number of relays given.
56 */
57 uint32_t relay_count;
58
59 /* followed by 'relay_count' peer identities */
60
61 /* followed by the join response message */
62
63};
64
65
66/**
67 * Message sent from the client to the service to notify the service
68 * about the result of a membership test.
69 */
70struct MulticastMembershipTestResponseMessage
71{
72
73 /**
74 *
75 */
76 struct GNUNET_MessageHeader header;
77
78 /**
79 * Unique ID that identifies the associated membership test.
80 */
81 uint32_t uid;
82
83 /**
84 * #GNUNET_YES if the peer is a member, #GNUNET_NO if peer was not a member,
85 * #GNUNET_SYSERR if we cannot answer the test.
86 */
87 int32_t is_admitted;
88
89};
90
91
92/**
93 * Message sent from the client to the service to give the service
94 * a replayed message.
95 */
96struct MulticastReplayResponseMessage
97{
98
99 /**
100 *
101 */
102 struct GNUNET_MessageHeader header;
103
104 /**
105 * Unique ID that identifies the associated replay session.
106 */
107 uint32_t uid;
108
109 /**
110 * An `enum GNUNET_MULTICAST_ReplayErrorCode` identifying issues (in NBO).
111 */
112 int32_t error_code;
113
114 /* followed by replayed message */
115
116};
117
118
119/**
120 * Message sent from the client to the service to notify the service
121 * about the end of a replay session.
122 */
123struct MulticastReplayEndMessage
124{
125
126 /**
127 *
128 */
129 struct GNUNET_MessageHeader header;
130
131 /**
132 * Unique ID that identifies the associated replay session.
133 */
134 uint32_t uid;
135
136};
137
138
139/**
140 * Message sent from the client to the service to notify the service
141 * about the starting of a multicast group with this peers as its origin.
142 */
143struct MulticastOriginStartMessage
144{
145
146 /**
147 *
148 */
149 struct GNUNET_MessageHeader header;
150
151 /**
152 * Always zero.
153 */
154 uint32_t reserved;
155
156 /**
157 * Private, non-ephemeral key for the mutlicast group.
158 */
159 struct GNUNET_CRYPTO_EccPrivateKey group_key;
160
161 /**
162 * Last fragment ID, used to continue counting fragments if we resume operating
163 * a group.
164 */
165 uint64_t last_fragment_id;
166
167};
168
169
170/**
171 * Message sent from the client to the service to broadcast to all group
172 * members.
173 */
174struct MulticastBroadcastMessage
175{
176
177 /**
178 *
179 */
180 struct GNUNET_MessageHeader header;
181
182 /**
183 * #GNUNET_OK normally, #GNUNET_SYSERR if the origin aborted the
184 * transmission.
185 */
186 int32_t status;
187
188 /**
189 * Message ID.
190 */
191 uint64_t message_id;
192
193 /**
194 * Group generation.
195 */
196 uint64_t group_generation;
197
198 /**
199 * Total message size.
200 */
201 uint64_t total_size;
202
203};
204
205
206/**
207 * Message sent from the client to the service to join a multicast group.
208 */
209struct MulticastJoinMessage
210{
211
212 /**
213 *
214 */
215 struct GNUNET_MessageHeader header;
216
217 /**
218 * Number of relays we (think) we already know about.
219 */
220 uint32_t relay_count;
221
222 /**
223 * Public non-ephemeral key of the mutlicast group.
224 */
225 struct GNUNET_CRYPTO_EccPublicSignKey group_key;
226
227 /**
228 * Our private key for the group.
229 */
230 struct GNUNET_CRYPTO_EccPrivateKey member_key;
231
232 /* followed by 'relay_count' `struct GNUNET_PeerIdentity`s */
233
234};
235
236
237
238/**
239 * Message sent from the client to the service OR the service to the
240 * client asking for a message fragment to be replayed.
241 */
242struct MulticastReplayRequestMessage
243{
244
245 /**
246 *
247 */
248 struct GNUNET_MessageHeader header;
249
250 /**
251 * Replay request ID.
252 */
253 uint32_t uid;
254
255 /**
256 *
257 */
258 uint64_t message_id;
259
260 /**
261 *
262 */
263 uint64_t fragment_offset;
264
265 /**
266 *
267 */
268 uint64_t flags;
269
270};
271
272
273
274
275
276GNUNET_NETWORK_STRUCT_END
277
278#endif
279/* end of multicast.h */
diff --git a/src/multicast/multicast_api.c b/src/multicast/multicast_api.c
index b05d2d99c..b8ee42cb3 100644
--- a/src/multicast/multicast_api.c
+++ b/src/multicast/multicast_api.c
@@ -272,8 +272,6 @@ GNUNET_MULTICAST_replay_response2 (struct GNUNET_MULTICAST_ReplayHandle *rh,
272 * @param cfg Configuration to use. 272 * @param cfg Configuration to use.
273 * @param priv_key ECC key that will be used to sign messages for this 273 * @param priv_key ECC key that will be used to sign messages for this
274 * multicast session; public key is used to identify the multicast group; 274 * multicast session; public key is used to identify the multicast group;
275 * FIXME: we'll likely want to use NOT the p521 curve here, but a cheaper
276 * one in the future.
277 * @param last_fragment_id Last fragment ID to continue counting fragments from 275 * @param last_fragment_id Last fragment ID to continue counting fragments from
278 * when restarting the origin. 0 for a new group. 276 * when restarting the origin. 0 for a new group.
279 * @param join_cb Function called to approve / disapprove joining of a peer. 277 * @param join_cb Function called to approve / disapprove joining of a peer.
@@ -318,7 +316,7 @@ struct GNUNET_MULTICAST_OriginMessageHandle
318 * @param origin Handle to the multicast group. 316 * @param origin Handle to the multicast group.
319 * @param message_id Application layer ID for the message. Opaque to multicast. 317 * @param message_id Application layer ID for the message. Opaque to multicast.
320 * @param group_generation Group generation of the message. Documented in 318 * @param group_generation Group generation of the message. Documented in
321 * GNUNET_MULTICAST_MessageHeader. 319 * `struct GNUNET_MULTICAST_MessageHeader`.
322 * @param size Number of bytes to transmit. 320 * @param size Number of bytes to transmit.
323 * FIXME: Needed? The end of the message can be flagged with a last fragment flag. 321 * FIXME: Needed? The end of the message can be flagged with a last fragment flag.
324 * @param notify Function to call to get the message. 322 * @param notify Function to call to get the message.
@@ -405,7 +403,7 @@ GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
405 const struct GNUNET_CRYPTO_EccPublicSignKey *group_key, 403 const struct GNUNET_CRYPTO_EccPublicSignKey *group_key,
406 const struct GNUNET_CRYPTO_EccPrivateKey *member_key, 404 const struct GNUNET_CRYPTO_EccPrivateKey *member_key,
407 const struct GNUNET_PeerIdentity *origin, 405 const struct GNUNET_PeerIdentity *origin,
408 size_t relay_count, 406 uint32_t relay_count,
409 const struct GNUNET_PeerIdentity *relays, 407 const struct GNUNET_PeerIdentity *relays,
410 const struct GNUNET_MessageHeader *join_request, 408 const struct GNUNET_MessageHeader *join_request,
411 GNUNET_MULTICAST_JoinCallback join_cb, 409 GNUNET_MULTICAST_JoinCallback join_cb,
@@ -451,7 +449,7 @@ GNUNET_MULTICAST_member_replay_fragment (struct GNUNET_MULTICAST_Member *member,
451 449
452 450
453/** 451/**
454 * Request a message fr to be replayed. 452 * Request a message fragment to be replayed.
455 * 453 *
456 * Useful if messages below the @e max_known_fragment_id given when joining are 454 * Useful if messages below the @e max_known_fragment_id given when joining are
457 * needed and not known to the client. 455 * needed and not known to the client.