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