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