diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-10-02 14:48:56 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-10-02 14:48:56 +0000 |
commit | 437a8ac3b0f835c2035575331c1c9272ed93ae43 (patch) | |
tree | 855ace201e4ea83a2bdb0086031b9c15d6f336fd /src/conversation/conversation.h | |
parent | 5b82f1062147ef5da89971d515d93fd4df8cd40d (diff) | |
download | gnunet-437a8ac3b0f835c2035575331c1c9272ed93ae43.tar.gz gnunet-437a8ac3b0f835c2035575331c1c9272ed93ae43.zip |
-towards canonical header structure for conversation
Diffstat (limited to 'src/conversation/conversation.h')
-rw-r--r-- | src/conversation/conversation.h | 417 |
1 files changed, 417 insertions, 0 deletions
diff --git a/src/conversation/conversation.h b/src/conversation/conversation.h new file mode 100644 index 000000000..1f30b21bf --- /dev/null +++ b/src/conversation/conversation.h | |||
@@ -0,0 +1,417 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) | ||
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 2, 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 | * Messages for the Client <-> Server communication | ||
44 | */ | ||
45 | |||
46 | |||
47 | /** | ||
48 | * VoipClient. | ||
49 | */ | ||
50 | struct VoipClient | ||
51 | { | ||
52 | /** | ||
53 | * Handle for a conversation client. | ||
54 | */ | ||
55 | struct GNUNET_SERVER_Client *client; | ||
56 | }; | ||
57 | |||
58 | /** | ||
59 | * The connection status of the service | ||
60 | */ | ||
61 | struct ConnectionStatus | ||
62 | { | ||
63 | /** | ||
64 | * The client which is in interaction | ||
65 | */ | ||
66 | struct GNUNET_SERVER_Client *client; | ||
67 | |||
68 | /** | ||
69 | * The PeerIdentity of the peer | ||
70 | */ | ||
71 | struct GNUNET_PeerIdentity peer; | ||
72 | |||
73 | /** | ||
74 | * The status (see enum) | ||
75 | */ | ||
76 | int status; | ||
77 | }; | ||
78 | |||
79 | /** | ||
80 | * Information about a missed call | ||
81 | */ | ||
82 | struct MissedCall | ||
83 | { | ||
84 | /** | ||
85 | * The PeerIdentity of the peer | ||
86 | */ | ||
87 | struct GNUNET_PeerIdentity peer; | ||
88 | |||
89 | /** | ||
90 | * The time the call was | ||
91 | */ | ||
92 | struct GNUNET_TIME_Absolute time; | ||
93 | |||
94 | }; | ||
95 | |||
96 | |||
97 | |||
98 | |||
99 | /** | ||
100 | * Client <-> Server message to initiate a new call | ||
101 | */ | ||
102 | struct ClientServerSessionInitiateMessage | ||
103 | { | ||
104 | /** | ||
105 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_INITIATE | ||
106 | */ | ||
107 | struct GNUNET_MessageHeader header; | ||
108 | struct GNUNET_PeerIdentity peer; | ||
109 | }; | ||
110 | |||
111 | |||
112 | /** | ||
113 | * Client <-> Server meessage to accept an incoming call | ||
114 | */ | ||
115 | struct ClientServerSessionAcceptMessage | ||
116 | { | ||
117 | /** | ||
118 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_ACCEPT | ||
119 | */ | ||
120 | struct GNUNET_MessageHeader header; | ||
121 | }; | ||
122 | |||
123 | |||
124 | /** | ||
125 | * Client <-> Server message to reject an incoming call | ||
126 | */ | ||
127 | struct ClientServerSessionRejectMessage | ||
128 | { | ||
129 | /** | ||
130 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_REJECT | ||
131 | */ | ||
132 | struct GNUNET_MessageHeader header; | ||
133 | int reason; | ||
134 | }; | ||
135 | |||
136 | |||
137 | /** | ||
138 | * Client <-> Server message to terminat a call | ||
139 | */ | ||
140 | struct ClientServerSessionTerminateMessage | ||
141 | { | ||
142 | /** | ||
143 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_TERMINATE | ||
144 | */ | ||
145 | struct GNUNET_MessageHeader header; | ||
146 | }; | ||
147 | |||
148 | |||
149 | /** | ||
150 | * Client <-> Server message to initiate a new call | ||
151 | */ | ||
152 | struct ClientServerTestMessage | ||
153 | { | ||
154 | /** | ||
155 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_TEST | ||
156 | */ | ||
157 | struct GNUNET_MessageHeader header; | ||
158 | struct GNUNET_PeerIdentity peer; | ||
159 | }; | ||
160 | |||
161 | /************************************************************************************************************************ | ||
162 | * Messages for the Server <-> Client communication | ||
163 | */ | ||
164 | |||
165 | /** | ||
166 | * Server <-> Client message to initiate a new call | ||
167 | */ | ||
168 | struct ServerClientSessionInitiateMessage | ||
169 | { | ||
170 | /** | ||
171 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_INITIATE | ||
172 | */ | ||
173 | struct GNUNET_MessageHeader header; | ||
174 | struct GNUNET_PeerIdentity peer; | ||
175 | }; | ||
176 | |||
177 | |||
178 | /** | ||
179 | * Server <-> Client meessage to accept an incoming call | ||
180 | */ | ||
181 | struct ServerClientSessionAcceptMessage | ||
182 | { | ||
183 | /** | ||
184 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_ACCEPT | ||
185 | */ | ||
186 | struct GNUNET_MessageHeader header; | ||
187 | }; | ||
188 | |||
189 | |||
190 | /** | ||
191 | * Server <-> Client message to reject an incoming call | ||
192 | */ | ||
193 | struct ServerClientSessionRejectMessage | ||
194 | { | ||
195 | /** | ||
196 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_REJECT | ||
197 | */ | ||
198 | struct GNUNET_MessageHeader header; | ||
199 | int reason; | ||
200 | int notify; | ||
201 | }; | ||
202 | |||
203 | |||
204 | /** | ||
205 | * Server <-> Client message to terminat a call | ||
206 | */ | ||
207 | struct ServerClientSessionTerminateMessage | ||
208 | { | ||
209 | /** | ||
210 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_TERMINATE | ||
211 | */ | ||
212 | struct GNUNET_MessageHeader header; | ||
213 | }; | ||
214 | |||
215 | |||
216 | /** | ||
217 | * Server <-> Client message to signalize the client that the service is already in use | ||
218 | */ | ||
219 | struct ServerClientServiceBlockedMessage | ||
220 | { | ||
221 | /** | ||
222 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SERVICE_BLOCKED | ||
223 | */ | ||
224 | struct GNUNET_MessageHeader header; | ||
225 | }; | ||
226 | |||
227 | /** | ||
228 | * Server <-> Client message to signalize the client that the called peer is not connected | ||
229 | */ | ||
230 | struct ServerClientPeerNotConnectedMessage | ||
231 | { | ||
232 | /** | ||
233 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_NOT_CONNECTED | ||
234 | */ | ||
235 | struct GNUNET_MessageHeader header; | ||
236 | }; | ||
237 | |||
238 | |||
239 | /** | ||
240 | * Server <-> Client message to signalize the client that called peer does not answer | ||
241 | */ | ||
242 | struct ServerClientNoAnswerMessage | ||
243 | { | ||
244 | /** | ||
245 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_NO_ANSWER | ||
246 | */ | ||
247 | struct GNUNET_MessageHeader header; | ||
248 | }; | ||
249 | |||
250 | /** | ||
251 | * Server <-> Client message to notify client of missed call | ||
252 | */ | ||
253 | struct ServerClientMissedCallMessage | ||
254 | { | ||
255 | /** | ||
256 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_MISSED_CALL | ||
257 | */ | ||
258 | struct GNUNET_MessageHeader header; | ||
259 | int number; | ||
260 | struct MissedCall *missed_call; | ||
261 | }; | ||
262 | |||
263 | |||
264 | /** | ||
265 | * Server <-> Client message to signalize the client that there occured an error | ||
266 | */ | ||
267 | struct ServerClientErrorMessage | ||
268 | { | ||
269 | /** | ||
270 | * Type is: #define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_ERROR | ||
271 | */ | ||
272 | struct GNUNET_MessageHeader header; | ||
273 | }; | ||
274 | |||
275 | |||
276 | /** | ||
277 | * Server <-> Client message to notify client of peer being available | ||
278 | */ | ||
279 | struct ServerClientPeerAvailableMessage | ||
280 | { | ||
281 | /** | ||
282 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_AVAILABLE | ||
283 | */ | ||
284 | struct GNUNET_MessageHeader header; | ||
285 | struct GNUNET_PeerIdentity peer; | ||
286 | struct GNUNET_TIME_Absolute time; | ||
287 | }; | ||
288 | |||
289 | /************************************************************************************************************************ | ||
290 | * Messages for the Mesh communication | ||
291 | */ | ||
292 | |||
293 | struct VoIPMeshMessageHeader | ||
294 | { | ||
295 | /** | ||
296 | * Type is: | ||
297 | */ | ||
298 | struct GNUNET_MessageHeader header; | ||
299 | int SequenceNumber; | ||
300 | struct GNUNET_TIME_Absolute time; | ||
301 | }; | ||
302 | |||
303 | |||
304 | /** | ||
305 | * Mesh message to sinal the remote peer the wish to initiate a new call | ||
306 | */ | ||
307 | struct MeshSessionInitiateMessage | ||
308 | { | ||
309 | /** | ||
310 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_INITIATE | ||
311 | */ | ||
312 | struct GNUNET_MessageHeader header; | ||
313 | int SequenceNumber; | ||
314 | struct GNUNET_TIME_Absolute time; | ||
315 | struct GNUNET_PeerIdentity peer; | ||
316 | }; | ||
317 | |||
318 | /** | ||
319 | * Mesh message to signal the remote peer the acceptance of an initiated call | ||
320 | */ | ||
321 | struct MeshSessionAcceptMessage | ||
322 | { | ||
323 | /** | ||
324 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_ACCEPT | ||
325 | */ | ||
326 | struct GNUNET_MessageHeader header; | ||
327 | int SequenceNumber; | ||
328 | struct GNUNET_TIME_Absolute time; | ||
329 | }; | ||
330 | |||
331 | |||
332 | /** | ||
333 | * Mesh message to reject an a wish to initiate a new call | ||
334 | */ | ||
335 | struct MeshSessionRejectMessage | ||
336 | { | ||
337 | /** | ||
338 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_REJECT | ||
339 | */ | ||
340 | struct GNUNET_MessageHeader header; | ||
341 | int SequenceNumber; | ||
342 | struct GNUNET_TIME_Absolute time; | ||
343 | int reason; | ||
344 | int notify; | ||
345 | }; | ||
346 | |||
347 | |||
348 | /** | ||
349 | * Mesh message to signal a remote peer the terminatation of a call | ||
350 | */ | ||
351 | struct MeshSessionTerminateMessage | ||
352 | { | ||
353 | /** | ||
354 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_TERMINATE | ||
355 | */ | ||
356 | struct GNUNET_MessageHeader header; | ||
357 | int SequenceNumber; | ||
358 | struct GNUNET_TIME_Absolute time; | ||
359 | }; | ||
360 | |||
361 | |||
362 | /** | ||
363 | * Server <-> Client message to notify client of peer being available | ||
364 | */ | ||
365 | struct MeshPeerAvailableMessage | ||
366 | { | ||
367 | /** | ||
368 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PEER_AVAILABLE | ||
369 | */ | ||
370 | struct GNUNET_MessageHeader header; | ||
371 | int SequenceNumber; | ||
372 | struct GNUNET_TIME_Absolute time; | ||
373 | struct GNUNET_PeerIdentity peer; | ||
374 | struct GNUNET_TIME_Absolute call; | ||
375 | }; | ||
376 | |||
377 | |||
378 | /** | ||
379 | * Messages for the audio communication | ||
380 | */ | ||
381 | struct TestMessage | ||
382 | { | ||
383 | /** | ||
384 | * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_TEST | ||
385 | */ | ||
386 | struct GNUNET_MessageHeader header; | ||
387 | }; | ||
388 | |||
389 | |||
390 | /** | ||
391 | * Message to transmit the audio | ||
392 | */ | ||
393 | struct AudioMessage | ||
394 | { | ||
395 | /** | ||
396 | * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO | ||
397 | */ | ||
398 | struct GNUNET_MessageHeader header; | ||
399 | int SequenceNumber; | ||
400 | struct GNUNET_TIME_Absolute time; | ||
401 | int length; | ||
402 | int encrypted; | ||
403 | uint8_t audio[200]; | ||
404 | |||
405 | }; | ||
406 | |||
407 | |||
408 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
409 | { | ||
410 | #endif | ||
411 | #ifdef __cplusplus | ||
412 | } | ||
413 | #endif | ||
414 | |||
415 | /* ifndef GNUNET_PROTOCOLS_CONVERSATION_H */ | ||
416 | #endif | ||
417 | /* end of gnunet_protocols_conversation.h */ | ||