-sync before server reboot, work on conversation service
[oweals/gnunet.git] / src / conversation / conversation.h
1 /*
2      This file is part of GNUnet.
3      (C) 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 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 * Messages for the Client <-> Server communication
44 */
45
46
47 /**
48  * VoipClient.
49  */
50 struct VoipClient
51 {
52   /**
53    * Handle for a conversation client.
54    */
55   struct GNUNET_SERVER_Client *client;
56 };
57
58
59 /**
60  * The connection status of the service
61  */
62 struct ConnectionStatus
63 {
64         /**
65         * The client which is in interaction
66         */
67   struct GNUNET_SERVER_Client *client;
68
69         /**
70         * The PeerIdentity of the peer
71         */
72   struct GNUNET_PeerIdentity peer;
73
74         /**
75         * The status (see enum)
76         */
77   int status;
78 };
79
80 /**
81 * Information about a missed call
82 */
83 struct MissedCall
84 {
85         /**
86         * The PeerIdentity of the peer
87         */
88   struct GNUNET_PeerIdentity peer;
89
90         /**
91         * The time the call was
92         */
93   struct GNUNET_TIME_Absolute time;
94
95 };
96
97
98
99
100 /**
101  * Client <-> Server message to initiate a new call
102  */
103 struct ClientServerSessionInitiateMessage
104 {
105   /**
106    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_INITIATE 
107    */
108   struct GNUNET_MessageHeader header;
109   struct GNUNET_PeerIdentity peer;
110 };
111
112
113 /**
114  * Client <-> Server meessage to accept an incoming call
115  */
116 struct ClientServerSessionAcceptMessage
117 {
118   /**
119    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_ACCEPT 
120    */
121   struct GNUNET_MessageHeader header;
122 };
123
124
125 /**
126  * Client <-> Server message to reject an incoming call
127  */
128 struct ClientServerSessionRejectMessage
129 {
130   /**
131    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_REJECT
132    */
133   struct GNUNET_MessageHeader header;
134   int reason;
135 };
136
137
138 /**
139  * Client <-> Server message to terminat a call
140  */
141 struct ClientServerSessionTerminateMessage
142 {
143   /**
144    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_TERMINATE 
145    */
146   struct GNUNET_MessageHeader header;
147 };
148
149
150 /**
151  * Client <-> Server message to initiate a new call
152  */
153 struct ClientServerTestMessage
154 {
155   /**
156    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_TEST 
157    */
158   struct GNUNET_MessageHeader header;
159   struct GNUNET_PeerIdentity peer;
160 };
161
162 /************************************************************************************************************************
163 * Messages for the Server <-> Client communication
164 */
165
166 /**
167  * Server <-> Client message to initiate a new call
168  */
169 struct ServerClientSessionInitiateMessage
170 {
171   /**
172    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_INITIATE
173    */
174   struct GNUNET_MessageHeader header;
175   struct GNUNET_PeerIdentity peer;
176 };
177
178
179 /**
180  * Server <-> Client meessage to accept an incoming call
181  */
182 struct ServerClientSessionAcceptMessage
183 {
184   /**
185    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_ACCEPT 
186    */
187   struct GNUNET_MessageHeader header;
188 };
189
190
191 /**
192  * Server <-> Client message to reject an incoming call
193  */
194 struct ServerClientSessionRejectMessage
195 {
196   /**
197    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_REJECT 
198    */
199   struct GNUNET_MessageHeader header;
200   int reason;
201   int notify;
202 };
203
204
205 /**
206  * Server <-> Client message to terminat a call
207  */
208 struct ServerClientSessionTerminateMessage
209 {
210   /**
211    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_TERMINATE 
212    */
213   struct GNUNET_MessageHeader header;
214 };
215
216
217 /**
218  * Server <-> Client message to signalize the client that the service is already in use
219  */
220 struct ServerClientServiceBlockedMessage
221 {
222   /**
223    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SERVICE_BLOCKED
224    */
225   struct GNUNET_MessageHeader header;
226 };
227
228 /**
229  * Server <-> Client message to signalize the client that the called peer is not connected
230  */
231 struct ServerClientPeerNotConnectedMessage
232 {
233   /**
234    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_NOT_CONNECTED 
235    */
236   struct GNUNET_MessageHeader header;
237 };
238
239
240 /**
241  * Server <-> Client message to signalize the client that called peer does not answer
242  */
243 struct ServerClientNoAnswerMessage
244 {
245   /**
246    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_NO_ANSWER
247    */
248   struct GNUNET_MessageHeader header;
249 };
250
251 /**
252  * Server <-> Client message to notify client of missed call
253  */
254 struct ServerClientMissedCallMessage
255 {
256   /**
257    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_MISSED_CALL 
258    */
259   struct GNUNET_MessageHeader header;
260   int number;
261   struct MissedCall *missed_call;
262 };
263
264
265 /**
266  * Server <-> Client message to signalize the client that there occured an error
267  */
268 struct ServerClientErrorMessage
269 {
270   /**
271    * Type is: #define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_ERROR 
272    */
273   struct GNUNET_MessageHeader header;
274 };
275
276
277 /**
278  * Server <-> Client message to notify client of peer being available
279  */
280 struct ServerClientPeerAvailableMessage
281 {
282   /**
283    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_AVAILABLE
284    */
285   struct GNUNET_MessageHeader header;
286   struct GNUNET_PeerIdentity peer;
287   struct GNUNET_TIME_Absolute time;
288 };
289
290 /************************************************************************************************************************
291 * Messages for the Mesh communication
292 */
293
294 struct VoIPMeshMessageHeader
295 {
296   /**
297    * Type is: 
298    */
299   struct GNUNET_MessageHeader header;
300   int SequenceNumber;
301   struct GNUNET_TIME_Absolute time;
302 };
303
304
305 /**
306  * Mesh message to sinal the remote peer the wish to initiate a new call
307  */
308 struct MeshSessionInitiateMessage
309 {
310   /**
311    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_INITIATE
312    */
313   struct GNUNET_MessageHeader header;
314   int SequenceNumber;
315   struct GNUNET_TIME_Absolute time;
316   struct GNUNET_PeerIdentity peer;
317 };
318
319 /**
320  * Mesh message to signal the remote peer the acceptance of an initiated call
321  */
322 struct MeshSessionAcceptMessage
323 {
324   /**
325    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_ACCEPT
326    */
327   struct GNUNET_MessageHeader header;
328   int SequenceNumber;
329   struct GNUNET_TIME_Absolute time;
330 };
331
332
333 /**
334  * Mesh message to reject an a wish to initiate a new call
335  */
336 struct MeshSessionRejectMessage
337 {
338   /**
339    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_REJECT 
340    */
341   struct GNUNET_MessageHeader header;
342   int SequenceNumber;
343   struct GNUNET_TIME_Absolute time;
344   int reason;
345   int notify;
346 };
347
348
349 /**
350  * Mesh message to signal a remote peer the terminatation of a call
351  */
352 struct MeshSessionTerminateMessage
353 {
354   /**
355    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_TERMINATE 
356    */
357   struct GNUNET_MessageHeader header;
358   int SequenceNumber;
359   struct GNUNET_TIME_Absolute time;
360 };
361
362
363 /**
364  * Server <-> Client message to notify client of peer being available
365  */
366 struct MeshPeerAvailableMessage
367 {
368   /**
369    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PEER_AVAILABLE 
370    */
371   struct GNUNET_MessageHeader header;
372   int SequenceNumber;
373   struct GNUNET_TIME_Absolute time;
374   struct GNUNET_PeerIdentity peer;
375   struct GNUNET_TIME_Absolute call;
376 };
377
378
379 /**
380  * Messages for the audio communication
381  */
382 struct TestMessage
383 {
384   /**
385    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_TEST 
386    */
387   struct GNUNET_MessageHeader header;
388 };
389
390 ////////////////////////////////////////////////////////////
391
392 /**
393  * Message to transmit the audio (between client and helpers).
394  */
395 struct AudioMessage
396 {
397   /**
398    * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO
399    */
400   struct GNUNET_MessageHeader header;
401
402   /* followed by audio data */
403
404 };
405
406
407 /**
408  * Client -> Service message to register a phone.
409  */
410 struct ClientPhoneRegisterMessage
411 {
412   /**
413    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_REGISTER
414    */
415   struct GNUNET_MessageHeader header;
416
417   /**
418    * Phone line to register.
419    */
420   uint32_t line GNUNET_PACKED;
421 };
422
423
424 /**
425  * Service -> Client message for phone is ringing.
426  */
427 struct ClientPhoneRingMessage
428 {
429   /**
430    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING
431    */
432   struct GNUNET_MessageHeader header;
433
434   /**
435    * Always zero.
436 p   */
437   uint32_t reserved GNUNET_PACKED;
438
439   /**
440    * Who is calling us?
441    */
442   struct GNUNET_CRYPTO_EccPublicSignKey caller_id;
443
444 };
445
446
447 /**
448  * Service -> Client message for phone is busy.
449  */
450 struct ClientPhoneBusyMessage
451 {
452   /**
453    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_BUSY
454    */
455   struct GNUNET_MessageHeader header;
456
457 };
458
459
460 /**
461  * Client -> Service pick up phone that is ringing.
462  */
463 struct ClientPhonePickupMessage
464 {
465   /**
466    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICK_UP
467    */
468   struct GNUNET_MessageHeader header;
469   
470   /* followed by variable length 0-terminated string with meta data */
471
472 };
473
474
475 /**
476  * Client <-> Service hang up phone that may or may not be ringing.
477  * Also sent in response to a (failed) `struct ClientCallMessage`.
478  */
479 struct ClientPhoneHangupMessage
480 {
481   /**
482    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP
483    */
484   struct GNUNET_MessageHeader header;
485   
486   /* followed by variable length 0-terminated string with meta data */
487
488 };
489
490
491 /**
492  * Message Client <->Service to transmit the audio.
493  */
494 struct ClientAudioMessage
495 {
496   /**
497    * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO
498    */
499   struct GNUNET_MessageHeader header;
500
501   /* followed by audio data */
502
503 };
504
505
506 /**
507  * Client -> Service message to call a phone.
508  */
509 struct ClientCallMessage
510 {
511   /**
512    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL
513    */
514   struct GNUNET_MessageHeader header;
515
516   /**
517    * Which phone line to call at the peer?
518    */
519   uint32_t line GNUNET_PACKED;
520
521   /**
522    * Which peer is hosting the line?
523    */
524   struct GNUNET_PeerIdentity target;
525
526   /**
527    * Identity of the caller.
528    */
529   struct GNUNET_CRYPTO_EccPrivateKey caller_id;
530 };
531
532
533 /**
534  * Service -> Client: other peer has picked up the phone, we are
535  * now talking.
536  */
537 struct ClientPhonePickedupMessage
538 {
539   /**
540    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP
541    */
542   struct GNUNET_MessageHeader header;
543   
544   /* followed by variable length 0-terminated string with meta data */
545
546 };
547
548
549 /**
550  * Mesh message for phone is ringing.
551  */
552 struct MeshPhoneRingMessage
553 {
554   /**
555    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RING
556    */
557   struct GNUNET_MessageHeader header;
558
559   /**
560    * Desired target line.
561    */
562   uint32_t line GNUNET_PACKED;
563
564   /**
565    * Purpose for the signature.
566    */
567   struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
568
569   /**
570    * Who is calling us? (also who is signing).
571    */
572   struct GNUNET_CRYPTO_EccPublicSignKey caller_id;
573
574   /**
575    * Who are we calling?
576    */
577   struct GNUNET_PeerIdentity target;
578
579   /**
580    * From where are we calling?
581    */
582   struct GNUNET_PeerIdentity source;
583
584   /**
585    * When does the signature expire?
586    */ 
587   struct GNUNET_TIME_AbsoluteNBO expiration_time;
588
589   /**
590    * Signature on the above.
591    */
592   struct GNUNET_CRYPTO_EccSignature signature;
593
594 };
595
596
597 /**
598  * Mesh message for hanging up.
599  */
600 struct MeshPhoneHangupMessage
601 {
602   /**
603    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP
604    */
605   struct GNUNET_MessageHeader header;
606
607   /* followed by variable-size 0-terminated reason string */
608 };
609
610
611 /**
612  * Mesh message for picking up.
613  */
614 struct MeshPhonePickupMessage
615 {
616   /**
617    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_PICK_UP
618    */
619   struct GNUNET_MessageHeader header;
620
621   /* followed by variable-size 0-terminated metadata string */
622 };
623
624
625 /**
626  * Mesh message for phone busy.
627  */
628 struct MeshPhoneBusyMessage
629 {
630   /**
631    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_BUSY
632    */
633   struct GNUNET_MessageHeader header;
634
635 };
636
637
638 /**
639  * Mesh message to transmit the audio.
640  */
641 struct MeshAudioMessage
642 {
643   /**
644    * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO
645    */
646   struct GNUNET_MessageHeader header;
647
648   /* followed by audio data */
649
650 };
651
652
653
654 #if 0                           /* keep Emacsens' auto-indent happy */
655 {
656 #endif
657 #ifdef __cplusplus
658 }
659 #endif
660
661 /* ifndef GNUNET_PROTOCOLS_CONVERSATION_H */
662 #endif
663 /* end of gnunet_protocols_conversation.h */