add attestation API
[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 Affero 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      You should have received a copy of the GNU Affero General Public License
16      along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18      SPDX-License-Identifier: AGPL3.0-or-later
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 ( \
40     GNUNET_TIME_UNIT_SECONDS, 60)
41
42
43 /**
44  * Highest bit in a 32-bit unsigned integer,
45  * bit set if we are making an outgoing call,
46  * bit unset for local lines.
47  */
48 #define HIGH_BIT ((uint32_t) (1LL << 31))
49
50 GNUNET_NETWORK_STRUCT_BEGIN
51
52
53 /**
54  * Message to transmit the audio (between client and helpers).
55  */
56 struct AudioMessage
57 {
58   /**
59    * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO
60    */
61   struct GNUNET_MessageHeader header;
62
63   /* followed by audio data */
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  * Service <-> Client message for phone was suspended.
114  */
115 struct ClientPhoneSuspendMessage
116 {
117   /**
118    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND
119    */
120   struct GNUNET_MessageHeader header;
121
122   /**
123    * CID, internal caller ID to identify which active call we are
124    * talking about.
125    */
126   uint32_t cid GNUNET_PACKED;
127 };
128
129
130 /**
131  * Service <-> Client message for phone was resumed.
132  */
133 struct ClientPhoneResumeMessage
134 {
135   /**
136    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME
137    */
138   struct GNUNET_MessageHeader header;
139
140   /**
141    * CID, internal caller ID to identify which active call we are
142    * talking about.
143    */
144   uint32_t cid GNUNET_PACKED;
145 };
146
147
148 /**
149  * Client -> Service pick up phone that is ringing.
150  */
151 struct ClientPhonePickupMessage
152 {
153   /**
154    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICK_UP
155    */
156   struct GNUNET_MessageHeader header;
157
158   /**
159    * CID, internal caller ID to identify which active call we are
160    * talking about.
161    */
162   uint32_t cid GNUNET_PACKED;
163 };
164
165
166 /**
167  * Client <-> Service hang up phone that may or may not be ringing.
168  * Also sent in response to a (failed) `struct ClientCallMessage`.
169  */
170 struct ClientPhoneHangupMessage
171 {
172   /**
173    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP
174    */
175   struct GNUNET_MessageHeader header;
176
177   /**
178    * CID, internal caller ID to identify which active call we are
179    * talking about.
180    */
181   uint32_t cid GNUNET_PACKED;
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  * Client -> Service message to call a phone.
207  */
208 struct ClientCallMessage
209 {
210   /**
211    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL
212    */
213   struct GNUNET_MessageHeader header;
214
215   /**
216    * Always zero.
217    */
218   uint32_t reserved GNUNET_PACKED;
219
220   /**
221    * Which peer is hosting the line?
222    */
223   struct GNUNET_PeerIdentity target;
224
225   /**
226    * Which phone line to call at the peer?
227    */
228   struct GNUNET_HashCode line_port;
229
230   /**
231    * Identity of the caller.
232    */
233   struct GNUNET_CRYPTO_EcdsaPrivateKey caller_id;
234 };
235
236
237 /**
238  * Service -> Client: other peer has picked up the phone, we are
239  * now talking.
240  */
241 struct ClientPhonePickedupMessage
242 {
243   /**
244    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP
245    */
246   struct GNUNET_MessageHeader header;
247
248   /**
249    * Call ID of the corresponding
250    * #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL
251    */
252   uint32_t cid GNUNET_PACKED;
253 };
254
255
256 /**
257  * Information signed in a `struct CadetPhoneRingMessage`
258  * whereby the caller self-identifies to the receiver.
259  */
260 struct CadetPhoneRingInfoPS
261 {
262   /**
263    * Purpose for the signature, must be
264    * #GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING.
265    */
266   struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
267
268   /**
269    * Which port did the call go to?
270    */
271   struct GNUNET_HashCode line_port;
272
273   /**
274    * Which peer is the call for?
275    */
276   struct GNUNET_PeerIdentity target_peer;
277
278   /**
279    * When does the signature expire?
280    */
281   struct GNUNET_TIME_AbsoluteNBO expiration_time;
282 };
283
284
285 /**
286  * Cadet message to make a phone ring.  Sent to the port
287  * of the respective phone.
288  */
289 struct CadetPhoneRingMessage
290 {
291   /**
292    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING
293    */
294   struct GNUNET_MessageHeader header;
295
296   /**
297    * Always zero.
298    */
299   uint32_t reserved GNUNET_PACKED;
300
301   /**
302    * Who is calling us? (also who is signing).
303    */
304   struct GNUNET_CRYPTO_EcdsaPublicKey caller_id;
305
306   /**
307    * When does the signature expire?
308    */
309   struct GNUNET_TIME_AbsoluteNBO expiration_time;
310
311   /**
312    * Signature over a `struct CadetPhoneRingInfoPS`
313    */
314   struct GNUNET_CRYPTO_EcdsaSignature signature;
315 };
316
317
318 /**
319  * Cadet message for hanging up.
320  */
321 struct CadetPhoneHangupMessage
322 {
323   /**
324    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_HANG_UP
325    */
326   struct GNUNET_MessageHeader header;
327 };
328
329
330 /**
331  * Cadet message for picking up.
332  */
333 struct CadetPhonePickupMessage
334 {
335   /**
336    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_PICK_UP
337    */
338   struct GNUNET_MessageHeader header;
339 };
340
341
342 /**
343  * Cadet message for phone suspended.
344  */
345 struct CadetPhoneSuspendMessage
346 {
347   /**
348    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_SUSPEND
349    */
350   struct GNUNET_MessageHeader header;
351 };
352
353
354 /**
355  * Cadet message for phone resumed.
356  */
357 struct CadetPhoneResumeMessage
358 {
359   /**
360    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RESUME
361    */
362   struct GNUNET_MessageHeader header;
363 };
364
365
366 /**
367  * Cadet message to transmit the audio.
368  */
369 struct CadetAudioMessage
370 {
371   /**
372    * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO
373    */
374   struct GNUNET_MessageHeader header;
375
376   /* followed by audio data */
377 };
378
379
380 GNUNET_NETWORK_STRUCT_END
381
382
383 #if 0                           /* keep Emacsens' auto-indent happy */
384 {
385 #endif
386 #ifdef __cplusplus
387 }
388 #endif
389
390 /* ifndef GNUNET_PROTOCOLS_CONVERSATION_H */
391 #endif
392 /* end of gnunet_protocols_conversation.h */