aboutsummaryrefslogtreecommitdiff
path: root/src/contrib/service/conversation/conversation.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/contrib/service/conversation/conversation.h')
-rw-r--r--src/contrib/service/conversation/conversation.h407
1 files changed, 407 insertions, 0 deletions
diff --git a/src/contrib/service/conversation/conversation.h b/src/contrib/service/conversation/conversation.h
new file mode 100644
index 000000000..ee4ca372c
--- /dev/null
+++ b/src/contrib/service/conversation/conversation.h
@@ -0,0 +1,407 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2013-2016 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 conversation/conversation.h
23 * @brief constants for network protocols
24 * @author Siomon Dieterle
25 * @author Andreas Fuchs
26 */
27#ifndef CONVERSATION_H
28#define CONVERSATION_H
29
30#include "gnunet_identity_service.h"
31
32#ifdef __cplusplus
33extern "C"
34{
35#if 0 /* keep Emacsens' auto-indent happy */
36}
37#endif
38#endif
39
40
41#define MAX_TRANSMIT_DELAY GNUNET_TIME_relative_multiply ( \
42 GNUNET_TIME_UNIT_SECONDS, 60)
43
44
45/**
46 * Highest bit in a 32-bit unsigned integer,
47 * bit set if we are making an outgoing call,
48 * bit unset for local lines.
49 */
50#define HIGH_BIT ((uint32_t) (1LL << 31))
51
52GNUNET_NETWORK_STRUCT_BEGIN
53
54
55/**
56 * Message to transmit the audio (between client and helpers).
57 */
58struct AudioMessage
59{
60 /**
61 * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO
62 */
63 struct GNUNET_MessageHeader header;
64
65 /* followed by audio data */
66};
67
68
69/**
70 * Client -> Service message to register a phone.
71 */
72struct ClientPhoneRegisterMessage
73{
74 /**
75 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_REGISTER
76 */
77 struct GNUNET_MessageHeader header;
78
79 /**
80 * Always zero.
81 */
82 uint32_t reserved GNUNET_PACKED;
83
84 /**
85 * Phone line / CADET port to register.
86 */
87 struct GNUNET_HashCode line_port;
88};
89
90
91/**
92 * Service -> Client message for phone is ringing.
93 */
94struct ClientPhoneRingMessage
95{
96 /**
97 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING
98 */
99 struct GNUNET_MessageHeader header;
100
101 /**
102 * CID, internal caller ID number used in the future to identify
103 * which active call we are talking about.
104 */
105 uint32_t cid GNUNET_PACKED;
106
107 /**
108 * The identity key length
109 */
110 uint32_t key_len;
111
112 /**
113 * followed by who is calling us?, a public key
114 */
115};
116
117
118/**
119 * Service <-> Client message for phone was suspended.
120 */
121struct ClientPhoneSuspendMessage
122{
123 /**
124 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND
125 */
126 struct GNUNET_MessageHeader header;
127
128 /**
129 * CID, internal caller ID to identify which active call we are
130 * talking about.
131 */
132 uint32_t cid GNUNET_PACKED;
133};
134
135
136/**
137 * Service <-> Client message for phone was resumed.
138 */
139struct ClientPhoneResumeMessage
140{
141 /**
142 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME
143 */
144 struct GNUNET_MessageHeader header;
145
146 /**
147 * CID, internal caller ID to identify which active call we are
148 * talking about.
149 */
150 uint32_t cid GNUNET_PACKED;
151};
152
153
154/**
155 * Client -> Service pick up phone that is ringing.
156 */
157struct ClientPhonePickupMessage
158{
159 /**
160 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICK_UP
161 */
162 struct GNUNET_MessageHeader header;
163
164 /**
165 * CID, internal caller ID to identify which active call we are
166 * talking about.
167 */
168 uint32_t cid GNUNET_PACKED;
169};
170
171
172/**
173 * Client <-> Service hang up phone that may or may not be ringing.
174 * Also sent in response to a (failed) `struct ClientCallMessage`.
175 */
176struct ClientPhoneHangupMessage
177{
178 /**
179 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP
180 */
181 struct GNUNET_MessageHeader header;
182
183 /**
184 * CID, internal caller ID to identify which active call we are
185 * talking about.
186 */
187 uint32_t cid GNUNET_PACKED;
188};
189
190
191/**
192 * Message Client <-> Service to transmit the audio.
193 */
194struct ClientAudioMessage
195{
196 /**
197 * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO
198 */
199 struct GNUNET_MessageHeader header;
200
201 /**
202 * CID, internal caller ID to identify which active call we are
203 * sending data to.
204 */
205 uint32_t cid GNUNET_PACKED;
206
207 /* followed by audio data */
208};
209
210
211/**
212 * Client -> Service message to call a phone.
213 */
214struct ClientCallMessage
215{
216 /**
217 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL
218 */
219 struct GNUNET_MessageHeader header;
220
221 /**
222 * Always zero.
223 */
224 uint32_t reserved GNUNET_PACKED;
225
226 /**
227 * Which peer is hosting the line?
228 */
229 struct GNUNET_PeerIdentity target;
230
231 /**
232 * Which phone line to call at the peer?
233 */
234 struct GNUNET_HashCode line_port;
235
236 /**
237 * The identity key length
238 */
239 uint32_t key_len;
240
241 /**
242 * followed by the identity of the caller.
243 */
244};
245
246
247/**
248 * Service -> Client: other peer has picked up the phone, we are
249 * now talking.
250 */
251struct ClientPhonePickedupMessage
252{
253 /**
254 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP
255 */
256 struct GNUNET_MessageHeader header;
257
258 /**
259 * Call ID of the corresponding
260 * #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL
261 */
262 uint32_t cid GNUNET_PACKED;
263};
264
265
266/**
267 * Information signed in a `struct CadetPhoneRingMessage`
268 * whereby the caller self-identifies to the receiver.
269 */
270struct CadetPhoneRingInfoPS
271{
272 /**
273 * Purpose for the signature, must be
274 * #GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING.
275 */
276 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
277
278 /**
279 * Which port did the call go to?
280 */
281 struct GNUNET_HashCode line_port;
282
283 /**
284 * Which peer is the call for?
285 */
286 struct GNUNET_PeerIdentity target_peer;
287
288 /**
289 * When does the signature expire?
290 */
291 struct GNUNET_TIME_AbsoluteNBO expiration_time;
292};
293
294
295/**
296 * Cadet message to make a phone ring. Sent to the port
297 * of the respective phone.
298 */
299struct CadetPhoneRingMessage
300{
301 /**
302 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING
303 */
304 struct GNUNET_MessageHeader header;
305
306 /**
307 * Always zero.
308 */
309 uint32_t reserved GNUNET_PACKED;
310
311 /**
312 * When does the signature expire?
313 */
314 struct GNUNET_TIME_AbsoluteNBO expiration_time;
315
316 /**
317 * The length of the key
318 */
319 uint32_t key_len;
320
321 /**
322 * The length of the signature
323 */
324 uint32_t sig_len;
325
326 /**
327 * Followed by the public key of who is calling us? (also who is signing).
328 * followed by the signature over a `struct CadetPhoneRingInfoPS`
329 */
330};
331
332
333/**
334 * Cadet message for hanging up.
335 */
336struct CadetPhoneHangupMessage
337{
338 /**
339 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_HANG_UP
340 */
341 struct GNUNET_MessageHeader header;
342};
343
344
345/**
346 * Cadet message for picking up.
347 */
348struct CadetPhonePickupMessage
349{
350 /**
351 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_PICK_UP
352 */
353 struct GNUNET_MessageHeader header;
354};
355
356
357/**
358 * Cadet message for phone suspended.
359 */
360struct CadetPhoneSuspendMessage
361{
362 /**
363 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_SUSPEND
364 */
365 struct GNUNET_MessageHeader header;
366};
367
368
369/**
370 * Cadet message for phone resumed.
371 */
372struct CadetPhoneResumeMessage
373{
374 /**
375 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RESUME
376 */
377 struct GNUNET_MessageHeader header;
378};
379
380
381/**
382 * Cadet message to transmit the audio.
383 */
384struct CadetAudioMessage
385{
386 /**
387 * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO
388 */
389 struct GNUNET_MessageHeader header;
390
391 /* followed by audio data */
392};
393
394
395GNUNET_NETWORK_STRUCT_END
396
397
398#if 0 /* keep Emacsens' auto-indent happy */
399{
400#endif
401#ifdef __cplusplus
402}
403#endif
404
405/* ifndef GNUNET_PROTOCOLS_CONVERSATION_H */
406#endif
407/* end of gnunet_protocols_conversation.h */