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