4b42277a55fcf6fb3437d5c98f12079ef56735ea
[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    * Always zero.
86    */
87   uint32_t reserved GNUNET_PACKED;
88
89   /**
90    * Who is calling us?
91    */
92   struct GNUNET_CRYPTO_EccPublicSignKey caller_id;
93
94 };
95
96
97 /**
98  * Service -> Client message for phone is busy.
99  */
100 struct ClientPhoneBusyMessage
101 {
102   /**
103    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_BUSY
104    */
105   struct GNUNET_MessageHeader header;
106
107 };
108
109
110 /**
111  * Client -> Service pick up phone that is ringing.
112  */
113 struct ClientPhonePickupMessage
114 {
115   /**
116    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICK_UP
117    */
118   struct GNUNET_MessageHeader header;
119
120   /* followed by variable length 0-terminated string with meta data */
121
122 };
123
124
125 /**
126  * Client <-> Service hang up phone that may or may not be ringing.
127  * Also sent in response to a (failed) `struct ClientCallMessage`.
128  */
129 struct ClientPhoneHangupMessage
130 {
131   /**
132    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP
133    */
134   struct GNUNET_MessageHeader header;
135
136   /* followed by variable length 0-terminated string with meta data */
137
138 };
139
140
141 /**
142  * Message Client <->Service to transmit the audio.
143  */
144 struct ClientAudioMessage
145 {
146   /**
147    * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO
148    */
149   struct GNUNET_MessageHeader header;
150
151   /* followed by audio data */
152
153 };
154
155
156 /**
157  * Client -> Service message to call a phone.
158  */
159 struct ClientCallMessage
160 {
161   /**
162    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL
163    */
164   struct GNUNET_MessageHeader header;
165
166   /**
167    * Which phone line to call at the peer?
168    */
169   uint32_t line GNUNET_PACKED;
170
171   /**
172    * Which peer is hosting the line?
173    */
174   struct GNUNET_PeerIdentity target;
175
176   /**
177    * Identity of the caller.
178    */
179   struct GNUNET_CRYPTO_EccPrivateKey caller_id;
180 };
181
182
183 /**
184  * Service -> Client: other peer has picked up the phone, we are
185  * now talking.
186  */
187 struct ClientPhonePickedupMessage
188 {
189   /**
190    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP
191    */
192   struct GNUNET_MessageHeader header;
193
194   /* followed by variable length 0-terminated string with meta data */
195
196 };
197
198
199 /**
200  * Mesh message for phone is ringing.
201  */
202 struct MeshPhoneRingMessage
203 {
204   /**
205    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RING
206    */
207   struct GNUNET_MessageHeader header;
208
209   /**
210    * Desired target line.
211    */
212   uint32_t remote_line GNUNET_PACKED;
213
214   /**
215    * Purpose for the signature.
216    */
217   struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
218
219   /**
220    * Who is calling us? (also who is signing).
221    */
222   struct GNUNET_CRYPTO_EccPublicSignKey caller_id;
223
224   /**
225    * Who are we calling?
226    */
227   struct GNUNET_PeerIdentity target;
228
229   /**
230    * From where are we calling?
231    */
232   struct GNUNET_PeerIdentity source;
233
234   /**
235    * When does the signature expire?
236    */
237   struct GNUNET_TIME_AbsoluteNBO expiration_time;
238
239   /**
240    * Signature on the above.
241    */
242   struct GNUNET_CRYPTO_EccSignature signature;
243
244   /**
245    * Source line for audio data in the other direction.
246    */
247   uint32_t source_line GNUNET_PACKED;
248
249 };
250
251
252 /**
253  * Mesh message for hanging up.
254  */
255 struct MeshPhoneHangupMessage
256 {
257   /**
258    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP
259    */
260   struct GNUNET_MessageHeader header;
261
262   /* followed by variable-size 0-terminated reason string */
263 };
264
265
266 /**
267  * Mesh message for picking up.
268  */
269 struct MeshPhonePickupMessage
270 {
271   /**
272    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_PICK_UP
273    */
274   struct GNUNET_MessageHeader header;
275
276   /* followed by variable-size 0-terminated metadata string */
277 };
278
279
280 /**
281  * Mesh message for phone busy.
282  */
283 struct MeshPhoneBusyMessage
284 {
285   /**
286    * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_BUSY
287    */
288   struct GNUNET_MessageHeader header;
289
290 };
291
292
293 /**
294  * Mesh message to transmit the audio.
295  */
296 struct MeshAudioMessage
297 {
298   /**
299    * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO
300    */
301   struct GNUNET_MessageHeader header;
302
303   /**
304    * Target line on the receiving end.
305    */
306   uint32_t remote_line;
307
308   /* followed by audio data */
309
310 };
311
312
313
314 #if 0                           /* keep Emacsens' auto-indent happy */
315 {
316 #endif
317 #ifdef __cplusplus
318 }
319 #endif
320
321 /* ifndef GNUNET_PROTOCOLS_CONVERSATION_H */
322 #endif
323 /* end of gnunet_protocols_conversation.h */