- log
[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  * Message to transmit the audio (between client and helpers).
44  */
45 struct AudioMessage
46 {
47   /**
48    * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO
49    */
50   struct GNUNET_MessageHeader header;
51
52   /* followed by audio data */
53
54 };
55
56
57 /**
58  * Client -> Service message to register a phone.
59  */
60 struct ClientPhoneRegisterMessage
61 {
62   /**
63    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_REGISTER
64    */
65   struct GNUNET_MessageHeader header;
66
67   /**
68    * Phone line to register.
69    */
70   uint32_t line GNUNET_PACKED;
71 };
72
73
74 /**
75  * Service -> Client message for phone is ringing.
76  */
77 struct ClientPhoneRingMessage
78 {
79   /**
80    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING
81    */
82   struct GNUNET_MessageHeader header;
83
84   /**
85    * CID, internal caller ID to identify which active call we are
86    * talking about.
87    */
88   uint32_t cid GNUNET_PACKED;
89
90   /**
91    * Who is calling us?
92    */
93   struct GNUNET_CRYPTO_EcdsaPublicKey caller_id;
94
95 };
96
97
98 /**
99  * Service <-> Client message for phone was suspended.
100  */
101 struct ClientPhoneSuspendMessage
102 {
103   /**
104    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND
105    */
106   struct GNUNET_MessageHeader header;
107
108   /**
109    * CID, internal caller ID to identify which active call we are
110    * talking about.
111    */
112   uint32_t cid GNUNET_PACKED;
113
114 };
115
116
117 /**
118  * Service <-> Client message for phone was resumed.
119  */
120 struct ClientPhoneResumeMessage
121 {
122   /**
123    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME
124    */
125   struct GNUNET_MessageHeader header;
126
127   /**
128    * CID, internal caller ID to identify which active call we are
129    * talking about.
130    */
131   uint32_t cid GNUNET_PACKED;
132
133 };
134
135
136 /**
137  * Client -> Service pick up phone that is ringing.
138  */
139 struct ClientPhonePickupMessage
140 {
141   /**
142    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICK_UP
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 /**
156  * Client <-> Service hang up phone that may or may not be ringing.
157  * Also sent in response to a (failed) `struct ClientCallMessage`.
158  */
159 struct ClientPhoneHangupMessage
160 {
161   /**
162    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP
163    */
164   struct GNUNET_MessageHeader header;
165
166   /**
167    * CID, internal caller ID to identify which active call we are
168    * talking about.
169    */
170   uint32_t cid GNUNET_PACKED;
171
172 };
173
174
175 /**
176  * Message Client <->Service to transmit the audio.
177  */
178 struct ClientAudioMessage
179 {
180   /**
181    * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO
182    */
183   struct GNUNET_MessageHeader header;
184
185   /**
186    * CID, internal caller ID to identify which active call we are
187    * sending data to.
188    */
189   uint32_t cid GNUNET_PACKED;
190
191   /* followed by audio data */
192
193 };
194
195
196 /**
197  * Client -> Service message to call a phone.
198  */
199 struct ClientCallMessage
200 {
201   /**
202    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL
203    */
204   struct GNUNET_MessageHeader header;
205
206   /**
207    * Which phone line to call at the peer?
208    */
209   uint32_t line GNUNET_PACKED;
210
211   /**
212    * Which peer is hosting the line?
213    */
214   struct GNUNET_PeerIdentity target;
215
216   /**
217    * Identity of the caller.
218    */
219   struct GNUNET_CRYPTO_EcdsaPrivateKey caller_id;
220 };
221
222
223 /**
224  * Service -> Client: other peer has picked up the phone, we are
225  * now talking.
226  */
227 struct ClientPhonePickedupMessage
228 {
229   /**
230    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP
231    */
232   struct GNUNET_MessageHeader header;
233
234 };
235
236
237 /**
238  * Mesh message for phone is ringing.
239  */
240 struct MeshPhoneRingMessage
241 {
242   /**
243    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RING
244    */
245   struct GNUNET_MessageHeader header;
246
247   /**
248    * Desired target line.
249    */
250   uint32_t remote_line GNUNET_PACKED;
251
252   /**
253    * Purpose for the signature.
254    */
255   struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
256
257   /**
258    * Who is calling us? (also who is signing).
259    */
260   struct GNUNET_CRYPTO_EcdsaPublicKey caller_id;
261
262   /**
263    * Who are we calling?
264    */
265   struct GNUNET_PeerIdentity target;
266
267   /**
268    * From where are we calling?
269    */
270   struct GNUNET_PeerIdentity source;
271
272   /**
273    * When does the signature expire?
274    */
275   struct GNUNET_TIME_AbsoluteNBO expiration_time;
276
277   /**
278    * Signature on the above.
279    */
280   struct GNUNET_CRYPTO_EcdsaSignature signature;
281
282   /**
283    * Source line for audio data in the other direction.
284    */
285   uint32_t source_line GNUNET_PACKED;
286
287 };
288
289
290 /**
291  * Mesh message for hanging up.
292  */
293 struct MeshPhoneHangupMessage
294 {
295   /**
296    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP
297    */
298   struct GNUNET_MessageHeader header;
299
300 };
301
302
303 /**
304  * Mesh message for picking up.
305  */
306 struct MeshPhonePickupMessage
307 {
308   /**
309    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_PICK_UP
310    */
311   struct GNUNET_MessageHeader header;
312
313 };
314
315
316 /**
317  * Mesh message for phone suspended.
318  */
319 struct MeshPhoneSuspendMessage
320 {
321   /**
322    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_SUSPEND
323    */
324   struct GNUNET_MessageHeader header;
325
326 };
327
328
329 /**
330  * Mesh message for phone resumed.
331  */
332 struct MeshPhoneResumeMessage
333 {
334   /**
335    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RESUME
336    */
337   struct GNUNET_MessageHeader header;
338
339 };
340
341
342 /**
343  * Mesh message to transmit the audio.
344  */
345 struct MeshAudioMessage
346 {
347   /**
348    * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO
349    */
350   struct GNUNET_MessageHeader header;
351
352   /**
353    * Target line on the receiving end.
354    */
355   uint32_t remote_line;
356
357   /* followed by audio data */
358
359 };
360
361
362
363 #if 0                           /* keep Emacsens' auto-indent happy */
364 {
365 #endif
366 #ifdef __cplusplus
367 }
368 #endif
369
370 /* ifndef GNUNET_PROTOCOLS_CONVERSATION_H */
371 #endif
372 /* end of gnunet_protocols_conversation.h */