diff options
author | Tobias Platen <tplaten@posteo.de> | 2022-07-20 20:26:59 +0200 |
---|---|---|
committer | Tobias Platen <tplaten@posteo.de> | 2022-07-20 20:26:59 +0200 |
commit | 12db287bf58f2076a65bc34382ce07ec9fe76e38 (patch) | |
tree | 89ae191a5c25c701f5fd734f738ac25f7561bdba /src/multicast/multicast.h | |
parent | 6a60c7d436f5c4c47752ee54a0980583f0c3fe37 (diff) | |
download | gnunet-12db287bf58f2076a65bc34382ce07ec9fe76e38.tar.gz gnunet-12db287bf58f2076a65bc34382ce07ec9fe76e38.zip |
inital import of multicast from secusharedev/tplaten/multicast_messenger
Diffstat (limited to 'src/multicast/multicast.h')
-rw-r--r-- | src/multicast/multicast.h | 303 |
1 files changed, 303 insertions, 0 deletions
diff --git a/src/multicast/multicast.h b/src/multicast/multicast.h new file mode 100644 index 000000000..8a3ca14c8 --- /dev/null +++ b/src/multicast/multicast.h | |||
@@ -0,0 +1,303 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2012, 2013 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your 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 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
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 | #include "platform.h" | ||
31 | #include "gnunet_multicast_service.h" | ||
32 | |||
33 | GNUNET_NETWORK_STRUCT_BEGIN | ||
34 | |||
35 | |||
36 | /** | ||
37 | * Header of a join request sent to the origin or another member. | ||
38 | */ | ||
39 | struct MulticastJoinRequestMessage | ||
40 | { | ||
41 | /** | ||
42 | * Type: GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_REQUEST | ||
43 | */ | ||
44 | struct GNUNET_MessageHeader header; | ||
45 | |||
46 | /** | ||
47 | * Always zero. | ||
48 | */ | ||
49 | uint32_t reserved; | ||
50 | |||
51 | /** | ||
52 | * ECC signature of the rest of the fields of the join request. | ||
53 | * | ||
54 | * Signature must match the public key of the joining member. | ||
55 | */ | ||
56 | struct GNUNET_CRYPTO_EcdsaSignature signature; | ||
57 | |||
58 | /** | ||
59 | * Purpose for the signature and size of the signed data. | ||
60 | */ | ||
61 | struct GNUNET_CRYPTO_EccSignaturePurpose purpose; | ||
62 | |||
63 | /** | ||
64 | * Public key of the target group. | ||
65 | */ | ||
66 | struct GNUNET_CRYPTO_EddsaPublicKey group_pub_key; | ||
67 | |||
68 | /** | ||
69 | * Public key of the joining member. | ||
70 | */ | ||
71 | struct GNUNET_CRYPTO_EcdsaPublicKey member_pub_key; | ||
72 | |||
73 | /** | ||
74 | * Peer identity of the joining member. | ||
75 | */ | ||
76 | struct GNUNET_PeerIdentity peer; | ||
77 | |||
78 | /* Followed by struct GNUNET_MessageHeader join_message */ | ||
79 | }; | ||
80 | |||
81 | |||
82 | /** | ||
83 | * Header of a join decision message sent to a peer requesting join. | ||
84 | */ | ||
85 | struct MulticastJoinDecisionMessage | ||
86 | { | ||
87 | /** | ||
88 | * Type: GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_DECISION | ||
89 | */ | ||
90 | struct GNUNET_MessageHeader header; | ||
91 | |||
92 | /** | ||
93 | * #GNUNET_YES if the peer was admitted | ||
94 | * #GNUNET_NO if entry was refused, | ||
95 | * #GNUNET_SYSERR if the request could not be answered. | ||
96 | */ | ||
97 | int32_t is_admitted; | ||
98 | |||
99 | /** | ||
100 | * Number of relays given. | ||
101 | */ | ||
102 | uint32_t relay_count; | ||
103 | |||
104 | /* Followed by relay_count peer identities */ | ||
105 | |||
106 | /* Followed by the join response message */ | ||
107 | }; | ||
108 | |||
109 | |||
110 | /** | ||
111 | * Header added to a struct MulticastJoinDecisionMessage | ||
112 | * when sent between the client and service. | ||
113 | */ | ||
114 | struct MulticastJoinDecisionMessageHeader | ||
115 | { | ||
116 | /** | ||
117 | * Type: GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_DECISION | ||
118 | */ | ||
119 | struct GNUNET_MessageHeader header; | ||
120 | |||
121 | /** | ||
122 | * C->S: Peer to send the join decision to. | ||
123 | * S->C: Peer we received the join decision from. | ||
124 | */ | ||
125 | struct GNUNET_PeerIdentity peer; | ||
126 | |||
127 | /** | ||
128 | * C->S: Public key of the member requesting join. | ||
129 | * S->C: Unused. | ||
130 | */ | ||
131 | struct GNUNET_CRYPTO_EcdsaPublicKey member_pub_key; | ||
132 | |||
133 | /* Followed by struct MulticastJoinDecisionMessage */ | ||
134 | }; | ||
135 | |||
136 | |||
137 | /** | ||
138 | * Message sent from the client to the service to notify the service | ||
139 | * about the result of a membership test. | ||
140 | */ | ||
141 | struct MulticastMembershipTestResultMessage | ||
142 | { | ||
143 | /** | ||
144 | * Type: GNUNET_MESSAGE_TYPE_MULTICAST_MEMBERSHIP_TEST_RESULT | ||
145 | */ | ||
146 | struct GNUNET_MessageHeader header; | ||
147 | |||
148 | /** | ||
149 | * Unique ID that identifies the associated membership test. | ||
150 | */ | ||
151 | uint32_t uid; | ||
152 | |||
153 | /** | ||
154 | * #GNUNET_YES if the peer is a member | ||
155 | * #GNUNET_NO if peer is not a member, | ||
156 | * #GNUNET_SYSERR if the test could not be answered. | ||
157 | */ | ||
158 | int32_t is_admitted; | ||
159 | }; | ||
160 | |||
161 | |||
162 | /** | ||
163 | * Message sent from the client to the service OR the service to the | ||
164 | * client asking for a message fragment to be replayed. | ||
165 | */ | ||
166 | struct MulticastReplayRequestMessage | ||
167 | { | ||
168 | |||
169 | /** | ||
170 | * The message type should be | ||
171 | * #GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_REQUEST. | ||
172 | */ | ||
173 | struct GNUNET_MessageHeader header; | ||
174 | |||
175 | /** | ||
176 | * S->C: Public key of the member requesting replay. | ||
177 | * C->S: Unused. | ||
178 | */ | ||
179 | struct GNUNET_CRYPTO_EcdsaPublicKey member_pub_key; | ||
180 | |||
181 | /** | ||
182 | * ID of the message that is being requested. | ||
183 | */ | ||
184 | uint64_t fragment_id; | ||
185 | |||
186 | /** | ||
187 | * ID of the message that is being requested. | ||
188 | */ | ||
189 | uint64_t message_id; | ||
190 | |||
191 | /** | ||
192 | * Offset of the fragment that is being requested. | ||
193 | */ | ||
194 | uint64_t fragment_offset; | ||
195 | |||
196 | /** | ||
197 | * Additional flags for the request. | ||
198 | */ | ||
199 | uint64_t flags; | ||
200 | |||
201 | /** | ||
202 | * Replay request ID. | ||
203 | */ | ||
204 | uint32_t uid; | ||
205 | }; | ||
206 | |||
207 | |||
208 | /** | ||
209 | * Message sent from the client to the service to give the service | ||
210 | * a replayed message. | ||
211 | */ | ||
212 | struct MulticastReplayResponseMessage | ||
213 | { | ||
214 | |||
215 | /** | ||
216 | * Type: GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_RESPONSE | ||
217 | * or GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_RESPONSE_END | ||
218 | */ | ||
219 | struct GNUNET_MessageHeader header; | ||
220 | |||
221 | /** | ||
222 | * ID of the message that is being requested. | ||
223 | */ | ||
224 | uint64_t fragment_id; | ||
225 | |||
226 | /** | ||
227 | * ID of the message that is being requested. | ||
228 | */ | ||
229 | uint64_t message_id; | ||
230 | |||
231 | /** | ||
232 | * Offset of the fragment that is being requested. | ||
233 | */ | ||
234 | uint64_t fragment_offset; | ||
235 | |||
236 | /** | ||
237 | * Additional flags for the request. | ||
238 | */ | ||
239 | uint64_t flags; | ||
240 | |||
241 | /** | ||
242 | * An `enum GNUNET_MULTICAST_ReplayErrorCode` identifying issues (in NBO). | ||
243 | */ | ||
244 | int32_t error_code; | ||
245 | |||
246 | /* followed by replayed message */ | ||
247 | }; | ||
248 | |||
249 | |||
250 | /** | ||
251 | * Message sent from the client to the service to notify the service | ||
252 | * about the starting of a multicast group with this peers as its origin. | ||
253 | */ | ||
254 | struct MulticastOriginStartMessage | ||
255 | { | ||
256 | /** | ||
257 | * Type: GNUNET_MESSAGE_TYPE_MULTICAST_ORIGIN_START | ||
258 | */ | ||
259 | struct GNUNET_MessageHeader header; | ||
260 | |||
261 | /** | ||
262 | * Always zero. | ||
263 | */ | ||
264 | uint32_t reserved; | ||
265 | |||
266 | /** | ||
267 | * Private, non-ephemeral key for the multicast group. | ||
268 | */ | ||
269 | struct GNUNET_CRYPTO_EddsaPrivateKey group_key; | ||
270 | |||
271 | /** | ||
272 | * Last fragment ID sent to the group, used to continue counting fragments if | ||
273 | * we resume operating * a group. | ||
274 | */ | ||
275 | uint64_t max_fragment_id; | ||
276 | }; | ||
277 | |||
278 | |||
279 | struct MulticastMemberJoinMessage | ||
280 | { | ||
281 | /** | ||
282 | * Type: GNUNET_MESSAGE_TYPE_MULTICAST_MEMBER_JOIN | ||
283 | */ | ||
284 | struct GNUNET_MessageHeader header; | ||
285 | |||
286 | uint32_t relay_count GNUNET_PACKED; | ||
287 | |||
288 | struct GNUNET_CRYPTO_EddsaPublicKey group_pub_key; | ||
289 | |||
290 | struct GNUNET_CRYPTO_EcdsaPrivateKey member_key; | ||
291 | |||
292 | struct GNUNET_PeerIdentity origin; | ||
293 | |||
294 | /* Followed by struct GNUNET_PeerIdentity relays[relay_count] */ | ||
295 | |||
296 | /* Followed by struct GNUNET_MessageHeader join_msg */ | ||
297 | }; | ||
298 | |||
299 | |||
300 | GNUNET_NETWORK_STRUCT_END | ||
301 | |||
302 | #endif | ||
303 | /* end of multicast.h */ | ||