aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/conversation/conversation.h (renamed from src/conversation/gnunet_protocols_conversation.h)259
-rw-r--r--src/conversation/conversation_api.c3
-rw-r--r--src/conversation/gnunet-service-conversation.c72
-rw-r--r--src/conversation/gnunet_conversation.h163
-rw-r--r--src/include/gnunet_conversation_service.h10
-rw-r--r--src/include/gnunet_protocols.h117
6 files changed, 379 insertions, 245 deletions
diff --git a/src/conversation/gnunet_protocols_conversation.h b/src/conversation/conversation.h
index b6ebd903b..1f30b21bf 100644
--- a/src/conversation/gnunet_protocols_conversation.h
+++ b/src/conversation/conversation.h
@@ -19,14 +19,13 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file include/gnunet_protocols_conversation.h 22 * @file conversation/conversation.h
23 * @brief constants for network protocols 23 * @brief constants for network protocols
24 * @author Siomon Dieterle 24 * @author Siomon Dieterle
25 * @author Andreas Fuchs 25 * @author Andreas Fuchs
26 */ 26 */
27 27#ifndef CONVERSATION_H
28#ifndef GNUNET_PROTOCOLS_CONVERSATION_H 28#define CONVERSATION_H
29#define GNUNET_PROTOCOLS_CONVERSATION_H
30 29
31#ifdef __cplusplus 30#ifdef __cplusplus
32extern "C" 31extern "C"
@@ -37,54 +36,124 @@ extern "C"
37#endif 36#endif
38 37
39 38
39#define MAX_TRANSMIT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
40
41
40/************************************************************************************************************************ 42/************************************************************************************************************************
41* Messages for the Client <-> Server communication 43* Messages for the Client <-> Server communication
42*/ 44*/
43 45
46
47/**
48 * VoipClient.
49 */
50struct VoipClient
51{
52 /**
53 * Handle for a conversation client.
54 */
55 struct GNUNET_SERVER_Client *client;
56};
57
44/** 58/**
45* Client <-> Server message to initiate a new call 59* The connection status of the service
46*/ 60*/
47#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_INITIATE 30002 61struct 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*/
82struct 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 */
48struct ClientServerSessionInitiateMessage 102struct ClientServerSessionInitiateMessage
49{ 103{
104 /**
105 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_INITIATE
106 */
50 struct GNUNET_MessageHeader header; 107 struct GNUNET_MessageHeader header;
51 struct GNUNET_PeerIdentity peer; 108 struct GNUNET_PeerIdentity peer;
52}; 109};
53 110
111
54/** 112/**
55* Client <-> Server meessage to accept an incoming call 113 * Client <-> Server meessage to accept an incoming call
56*/ 114 */
57#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_ACCEPT 30003
58struct ClientServerSessionAcceptMessage 115struct ClientServerSessionAcceptMessage
59{ 116{
117 /**
118 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_ACCEPT
119 */
60 struct GNUNET_MessageHeader header; 120 struct GNUNET_MessageHeader header;
61}; 121};
62 122
123
63/** 124/**
64* Client <-> Server message to reject an incoming call 125 * Client <-> Server message to reject an incoming call
65*/ 126 */
66#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_REJECT 30004
67struct ClientServerSessionRejectMessage 127struct ClientServerSessionRejectMessage
68{ 128{
129 /**
130 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_REJECT
131 */
69 struct GNUNET_MessageHeader header; 132 struct GNUNET_MessageHeader header;
70 int reason; 133 int reason;
71}; 134};
72 135
136
73/** 137/**
74* Client <-> Server message to terminat a call 138 * Client <-> Server message to terminat a call
75*/ 139 */
76#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_TERMINATE 30005
77struct ClientServerSessionTerminateMessage 140struct ClientServerSessionTerminateMessage
78{ 141{
142 /**
143 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_TERMINATE
144 */
79 struct GNUNET_MessageHeader header; 145 struct GNUNET_MessageHeader header;
80}; 146};
81 147
148
82/** 149/**
83* Client <-> Server message to initiate a new call 150 * Client <-> Server message to initiate a new call
84*/ 151 */
85#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_TEST 30099
86struct ClientServerTestMessage 152struct ClientServerTestMessage
87{ 153{
154 /**
155 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_TEST
156 */
88 struct GNUNET_MessageHeader header; 157 struct GNUNET_MessageHeader header;
89 struct GNUNET_PeerIdentity peer; 158 struct GNUNET_PeerIdentity peer;
90}; 159};
@@ -94,97 +163,124 @@ struct ClientServerTestMessage
94*/ 163*/
95 164
96/** 165/**
97* Server <-> Client message to initiate a new call 166 * Server <-> Client message to initiate a new call
98*/ 167 */
99#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_INITIATE 30006
100struct ServerClientSessionInitiateMessage 168struct ServerClientSessionInitiateMessage
101{ 169{
170 /**
171 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_INITIATE
172 */
102 struct GNUNET_MessageHeader header; 173 struct GNUNET_MessageHeader header;
103 struct GNUNET_PeerIdentity peer; 174 struct GNUNET_PeerIdentity peer;
104}; 175};
105 176
177
106/** 178/**
107* Server <-> Client meessage to accept an incoming call 179 * Server <-> Client meessage to accept an incoming call
108*/ 180 */
109#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_ACCEPT 30007
110struct ServerClientSessionAcceptMessage 181struct ServerClientSessionAcceptMessage
111{ 182{
183 /**
184 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_ACCEPT
185 */
112 struct GNUNET_MessageHeader header; 186 struct GNUNET_MessageHeader header;
113}; 187};
114 188
189
115/** 190/**
116* Server <-> Client message to reject an incoming call 191 * Server <-> Client message to reject an incoming call
117*/ 192 */
118#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_REJECT 30008
119struct ServerClientSessionRejectMessage 193struct ServerClientSessionRejectMessage
120{ 194{
195 /**
196 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_REJECT
197 */
121 struct GNUNET_MessageHeader header; 198 struct GNUNET_MessageHeader header;
122 int reason; 199 int reason;
123 int notify; 200 int notify;
124}; 201};
125 202
203
126/** 204/**
127* Server <-> Client message to terminat a call 205 * Server <-> Client message to terminat a call
128*/ 206 */
129#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_TERMINATE 30009
130struct ServerClientSessionTerminateMessage 207struct ServerClientSessionTerminateMessage
131{ 208{
209 /**
210 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_TERMINATE
211 */
132 struct GNUNET_MessageHeader header; 212 struct GNUNET_MessageHeader header;
133}; 213};
134 214
215
135/** 216/**
136* Server <-> Client message to signalize the client that the service is already in use 217 * Server <-> Client message to signalize the client that the service is already in use
137*/ 218 */
138#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SERVICE_BLOCKED 30010
139struct ServerClientServiceBlockedMessage 219struct ServerClientServiceBlockedMessage
140{ 220{
221 /**
222 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SERVICE_BLOCKED
223 */
141 struct GNUNET_MessageHeader header; 224 struct GNUNET_MessageHeader header;
142}; 225};
143 226
144/** 227/**
145* Server <-> Client message to signalize the client that the called peer is not connected 228 * Server <-> Client message to signalize the client that the called peer is not connected
146*/ 229 */
147#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_NOT_CONNECTED 30011
148struct ServerClientPeerNotConnectedMessage 230struct ServerClientPeerNotConnectedMessage
149{ 231{
232 /**
233 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_NOT_CONNECTED
234 */
150 struct GNUNET_MessageHeader header; 235 struct GNUNET_MessageHeader header;
151}; 236};
152 237
238
153/** 239/**
154* Server <-> Client message to signalize the client that called peer does not answer 240 * Server <-> Client message to signalize the client that called peer does not answer
155*/ 241 */
156#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_NO_ANSWER 30012
157struct ServerClientNoAnswerMessage 242struct ServerClientNoAnswerMessage
158{ 243{
244 /**
245 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_NO_ANSWER
246 */
159 struct GNUNET_MessageHeader header; 247 struct GNUNET_MessageHeader header;
160}; 248};
161 249
162/** 250/**
163* Server <-> Client message to notify client of missed call 251 * Server <-> Client message to notify client of missed call
164*/ 252 */
165#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_MISSED_CALL 30013
166struct ServerClientMissedCallMessage 253struct ServerClientMissedCallMessage
167{ 254{
255 /**
256 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_MISSED_CALL
257 */
168 struct GNUNET_MessageHeader header; 258 struct GNUNET_MessageHeader header;
169 int number; 259 int number;
170 struct MissedCall *missed_call; 260 struct MissedCall *missed_call;
171}; 261};
172 262
263
173/** 264/**
174* Server <-> Client message to signalize the client that there occured an error 265 * Server <-> Client message to signalize the client that there occured an error
175*/ 266 */
176#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_ERROR 30014
177struct ServerClientErrorMessage 267struct ServerClientErrorMessage
178{ 268{
269 /**
270 * Type is: #define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_ERROR
271 */
179 struct GNUNET_MessageHeader header; 272 struct GNUNET_MessageHeader header;
180}; 273};
181 274
275
182/** 276/**
183* Server <-> Client message to notify client of peer being available 277 * Server <-> Client message to notify client of peer being available
184*/ 278 */
185#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_AVAILABLE 30015
186struct ServerClientPeerAvailableMessage 279struct ServerClientPeerAvailableMessage
187{ 280{
281 /**
282 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_AVAILABLE
283 */
188 struct GNUNET_MessageHeader header; 284 struct GNUNET_MessageHeader header;
189 struct GNUNET_PeerIdentity peer; 285 struct GNUNET_PeerIdentity peer;
190 struct GNUNET_TIME_Absolute time; 286 struct GNUNET_TIME_Absolute time;
@@ -196,17 +292,23 @@ struct ServerClientPeerAvailableMessage
196 292
197struct VoIPMeshMessageHeader 293struct VoIPMeshMessageHeader
198{ 294{
295 /**
296 * Type is:
297 */
199 struct GNUNET_MessageHeader header; 298 struct GNUNET_MessageHeader header;
200 int SequenceNumber; 299 int SequenceNumber;
201 struct GNUNET_TIME_Absolute time; 300 struct GNUNET_TIME_Absolute time;
202}; 301};
203 302
303
204/** 304/**
205* Mesh message to sinal the remote peer the wish to initiate a new call 305 * Mesh message to sinal the remote peer the wish to initiate a new call
206*/ 306 */
207#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_INITIATE 40000
208struct MeshSessionInitiateMessage 307struct MeshSessionInitiateMessage
209{ 308{
309 /**
310 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_INITIATE
311 */
210 struct GNUNET_MessageHeader header; 312 struct GNUNET_MessageHeader header;
211 int SequenceNumber; 313 int SequenceNumber;
212 struct GNUNET_TIME_Absolute time; 314 struct GNUNET_TIME_Absolute time;
@@ -214,22 +316,27 @@ struct MeshSessionInitiateMessage
214}; 316};
215 317
216/** 318/**
217* Mesh message to signal the remote peer the acceptance of an initiated call 319 * Mesh message to signal the remote peer the acceptance of an initiated call
218*/ 320 */
219#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_ACCEPT 40001
220struct MeshSessionAcceptMessage 321struct MeshSessionAcceptMessage
221{ 322{
323 /**
324 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_ACCEPT
325 */
222 struct GNUNET_MessageHeader header; 326 struct GNUNET_MessageHeader header;
223 int SequenceNumber; 327 int SequenceNumber;
224 struct GNUNET_TIME_Absolute time; 328 struct GNUNET_TIME_Absolute time;
225}; 329};
226 330
331
227/** 332/**
228* Mesh message to reject an a wish to initiate a new call 333 * Mesh message to reject an a wish to initiate a new call
229*/ 334 */
230#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_REJECT 40002
231struct MeshSessionRejectMessage 335struct MeshSessionRejectMessage
232{ 336{
337 /**
338 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_REJECT
339 */
233 struct GNUNET_MessageHeader header; 340 struct GNUNET_MessageHeader header;
234 int SequenceNumber; 341 int SequenceNumber;
235 struct GNUNET_TIME_Absolute time; 342 struct GNUNET_TIME_Absolute time;
@@ -237,23 +344,29 @@ struct MeshSessionRejectMessage
237 int notify; 344 int notify;
238}; 345};
239 346
347
240/** 348/**
241* Mesh message to signal a remote peer the terminatation of a call 349 * Mesh message to signal a remote peer the terminatation of a call
242*/ 350 */
243#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_TERMINATE 40003
244struct MeshSessionTerminateMessage 351struct MeshSessionTerminateMessage
245{ 352{
353 /**
354 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_TERMINATE
355 */
246 struct GNUNET_MessageHeader header; 356 struct GNUNET_MessageHeader header;
247 int SequenceNumber; 357 int SequenceNumber;
248 struct GNUNET_TIME_Absolute time; 358 struct GNUNET_TIME_Absolute time;
249}; 359};
250 360
361
251/** 362/**
252* Server <-> Client message to notify client of peer being available 363 * Server <-> Client message to notify client of peer being available
253*/ 364 */
254#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PEER_AVAILABLE 40004
255struct MeshPeerAvailableMessage 365struct MeshPeerAvailableMessage
256{ 366{
367 /**
368 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PEER_AVAILABLE
369 */
257 struct GNUNET_MessageHeader header; 370 struct GNUNET_MessageHeader header;
258 int SequenceNumber; 371 int SequenceNumber;
259 struct GNUNET_TIME_Absolute time; 372 struct GNUNET_TIME_Absolute time;
@@ -261,23 +374,27 @@ struct MeshPeerAvailableMessage
261 struct GNUNET_TIME_Absolute call; 374 struct GNUNET_TIME_Absolute call;
262}; 375};
263 376
264/************************************************************************************************************************
265* Messages for the audio communication
266*/
267
268 377
269#define GNUNET_MESSAGE_TYPE_CONVERSATION_TEST 50001 378/**
379 * Messages for the audio communication
380 */
270struct TestMessage 381struct TestMessage
271{ 382{
383 /**
384 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_TEST
385 */
272 struct GNUNET_MessageHeader header; 386 struct GNUNET_MessageHeader header;
273}; 387};
274 388
389
275/** 390/**
276* Message to transmit the audio 391 * Message to transmit the audio
277*/ 392 */
278#define GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO 50000
279struct AudioMessage 393struct AudioMessage
280{ 394{
395 /**
396 * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO
397 */
281 struct GNUNET_MessageHeader header; 398 struct GNUNET_MessageHeader header;
282 int SequenceNumber; 399 int SequenceNumber;
283 struct GNUNET_TIME_Absolute time; 400 struct GNUNET_TIME_Absolute time;
diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c
index 031a69da6..2c18f0eb1 100644
--- a/src/conversation/conversation_api.c
+++ b/src/conversation/conversation_api.c
@@ -37,7 +37,8 @@
37#include "gnunet_util_lib.h" 37#include "gnunet_util_lib.h"
38#include "gnunet_dnsparser_lib.h" 38#include "gnunet_dnsparser_lib.h"
39#include "gnunet_gns_service.h" 39#include "gnunet_gns_service.h"
40#include "gnunet_protocols_conversation.h" 40#include "gnunet_protocols.h"
41#include "conversation.h"
41#include "gnunet_conversation_service.h" 42#include "gnunet_conversation_service.h"
42 43
43#define MAX_TRANSMIT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) 44#define MAX_TRANSMIT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c
index d9af9a523..2d2d815d8 100644
--- a/src/conversation/gnunet-service-conversation.c
+++ b/src/conversation/gnunet-service-conversation.c
@@ -34,12 +34,27 @@
34 * - TUNNEL HANDLING 34 * - TUNNEL HANDLING
35 * - CLIENT HANDLING 35 * - CLIENT HANDLING
36 */ 36 */
37#include <gnunet/platform.h> 37#include "platform.h"
38#include <gnunet/gnunet_util_lib.h> 38#include "gnunet_util_lib.h"
39#include <gnunet/gnunet_constants.h> 39#include "gnunet_protocols.h"
40#include <gnunet/gnunet_mesh_service.h> 40#include "gnunet_constants.h"
41#include "gnunet_conversation.h" 41#include "gnunet_mesh_service.h"
42#include "gnunet_protocols_conversation.h" 42#include "gnunet_conversation_service.h"
43#include "conversation.h"
44
45
46
47/*
48* The possible connection status
49*/
50enum connection_status
51{
52 LISTEN,
53 CALLER,
54 CALLEE,
55 CONNECTED
56};
57
43 58
44/******************************************************** 59/********************************************************
45 * Ugly hack because of not working MESH API 60 * Ugly hack because of not working MESH API
@@ -158,6 +173,51 @@ static int data_sent_size;
158static int data_received; 173static int data_received;
159static int data_received_size; 174static int data_received_size;
160 175
176
177/**
178* Transmit a mesh message
179 * @param cls closure, NULL
180 * @param size number of bytes available in buf
181 * @param buf where the callee should write the error message
182 * @return number of bytes written to buf
183 */
184static size_t transmit_mesh_message (void *cls, size_t size, void *buf);
185
186/**
187 * Function called to send a peer no answer message to the client.
188 * "buf" will be NULL and "size" zero if the socket was closed for writing in
189 * the meantime.
190 *
191 * @param cls closure, NULL
192 * @param size number of bytes available in buf
193 * @param buf where the callee should write the peer no answer message
194 * @return number of bytes written to buf
195 */
196static size_t
197transmit_server_no_answer_message (void *cls, size_t size, void *buf);
198
199/**
200 * Task to schedule a audio transmission.
201 *
202 * @param cls Closure.
203 * @param tc Task Context.
204 */
205static void
206transmit_audio_task (void *cls,
207 const struct GNUNET_SCHEDULER_TaskContext *tc);
208
209/**
210* Start the audio helpers
211*/
212int start_helpers (void);
213
214/**
215* Stop the audio helpers
216*/
217void stop_helpers (void);
218
219
220
161/******************************************************************************/ 221/******************************************************************************/
162/*********************** AUXILIARY FUNCTIONS *************************/ 222/*********************** AUXILIARY FUNCTIONS *************************/
163/******************************************************************************/ 223/******************************************************************************/
diff --git a/src/conversation/gnunet_conversation.h b/src/conversation/gnunet_conversation.h
deleted file mode 100644
index 8b79cb73b..000000000
--- a/src/conversation/gnunet_conversation.h
+++ /dev/null
@@ -1,163 +0,0 @@
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 include/gnunet_conversation.h
23 * @brief Header to the conversation service
24 * @author Simon Dieterle
25 * @author Andreas Fuchs
26 */
27#ifndef GNUNET_CONVERSATION_H
28#define GNUNET_CONVERSATION_H
29
30#ifdef __cplusplus
31extern "C"
32{
33#if 0 /* keep Emacsens' auto-indent happy */
34}
35#endif
36#endif
37
38#define MAX_TRANSMIT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
39
40/**
41* Reasons for rejecting an incoming call
42*/
43enum reject_reason
44{
45 REJECT_REASON_GENERIC = 0,
46 REJECT_REASON_NOT_AVAILABLE,
47 REJECT_REASON_NO_CLIENT,
48 REJECT_REASON_ACTIVE_CALL,
49 REJECT_REASON_NO_ANSWER
50};
51
52/*
53* The possible connection status
54*/
55enum connection_status
56{
57 LISTEN,
58 CALLER,
59 CALLEE,
60 CONNECTED
61};
62
63/**
64 * VoipClient.
65 */
66struct VoipClient
67{
68 /**
69 * Handle for a conversation client.
70 */
71 struct GNUNET_SERVER_Client *client;
72};
73
74/**
75* The connection status of the service
76*/
77struct ConnectionStatus
78{
79 /**
80 * The client which is in interaction
81 */
82 struct GNUNET_SERVER_Client *client;
83
84 /**
85 * The PeerIdentity of the peer
86 */
87 struct GNUNET_PeerIdentity peer;
88
89 /**
90 * The status (see enum)
91 */
92 int status;
93};
94
95/**
96* Iformation about a missed call
97*/
98struct MissedCall
99{
100 /**
101 * The PeerIdentity of the peer
102 */
103 struct GNUNET_PeerIdentity peer;
104
105 /**
106 * The time the call was
107 */
108 struct GNUNET_TIME_Absolute time;
109
110};
111
112/**
113* Transmit a mesh message
114 * @param cls closure, NULL
115 * @param size number of bytes available in buf
116 * @param buf where the callee should write the error message
117 * @return number of bytes written to buf
118 */
119static size_t transmit_mesh_message (void *cls, size_t size, void *buf);
120
121/**
122 * Function called to send a peer no answer message to the client.
123 * "buf" will be NULL and "size" zero if the socket was closed for writing in
124 * the meantime.
125 *
126 * @param cls closure, NULL
127 * @param size number of bytes available in buf
128 * @param buf where the callee should write the peer no answer message
129 * @return number of bytes written to buf
130 */
131static size_t
132transmit_server_no_answer_message (void *cls, size_t size, void *buf);
133
134/**
135 * Task to schedule a audio transmission.
136 *
137 * @param cls Closure.
138 * @param tc Task Context.
139 */
140static void
141transmit_audio_task (void *cls,
142 const struct GNUNET_SCHEDULER_TaskContext *tc);
143
144/**
145* Start the audio helpers
146*/
147int start_helpers (void);
148
149/**
150* Stop the audio helpers
151*/
152void stop_helpers (void);
153
154
155
156#if 0 /* keep Emacsens' auto-indent happy */
157{
158#endif
159#ifdef __cplusplus
160}
161#endif
162
163#endif
diff --git a/src/include/gnunet_conversation_service.h b/src/include/gnunet_conversation_service.h
index e1ce55e46..51e734f03 100644
--- a/src/include/gnunet_conversation_service.h
+++ b/src/include/gnunet_conversation_service.h
@@ -42,9 +42,13 @@ extern "C"
42 42
43enum GNUNET_CONVERSATION_RejectReason 43enum GNUNET_CONVERSATION_RejectReason
44{ 44{
45 REJECT_REASON_NO_CLIENT = 0, 45 REJECT_REASON_GENERIC = 0,
46 REJECT_REASON_NOT_AVAILABLE,
47 REJECT_REASON_NO_CLIENT,
46 REJECT_REASON_ACTIVE_CALL, 48 REJECT_REASON_ACTIVE_CALL,
47 REJECT_REASON_NOT_WANTED 49 REJECT_REASON_NOT_WANTED,
50 REJECT_REASON_NO_ANSWER
51
48}; 52};
49 53
50enum GNUNET_CONVERSATION_NotificationType 54enum GNUNET_CONVERSATION_NotificationType
@@ -57,6 +61,8 @@ enum GNUNET_CONVERSATION_NotificationType
57 NotificationType_CALL_TERMINATED 61 NotificationType_CALL_TERMINATED
58}; 62};
59 63
64
65
60/** 66/**
61* 67*
62*/ 68*/
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index a98f0fe35..60ad23097 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -2118,6 +2118,119 @@ extern "C"
2118 2118
2119 2119
2120/******************************************************************************* 2120/*******************************************************************************
2121 * CONVERSATION message types
2122 ******************************************************************************/
2123
2124/**
2125 * Client <-> Server message to initiate a new call
2126 */
2127#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_INITIATE 730
2128
2129/**
2130 * Client <-> Server meessage to accept an incoming call
2131 */
2132#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_ACCEPT 731
2133
2134/**
2135 * Client <-> Server message to reject an incoming call
2136 */
2137#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_REJECT 732
2138
2139/**
2140 * Client <-> Server message to terminate a call
2141 */
2142#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_TERMINATE 733
2143
2144/**
2145 * Client <-> Server message to initiate a new call
2146 */
2147#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_TEST 734
2148
2149/**
2150 * Server <-> Client message to initiate a new call
2151 */
2152#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_INITIATE 735
2153
2154/**
2155 * Server <-> Client meessage to accept an incoming call
2156 */
2157#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_ACCEPT 736
2158
2159/**
2160 * Server <-> Client message to reject an incoming call
2161 */
2162#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_REJECT 737
2163
2164/**
2165 * Server <-> Client message to terminat a call
2166 */
2167#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_TERMINATE 738
2168
2169/**
2170 * Server <-> Client message to signalize the client that the service is already in use
2171 */
2172#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SERVICE_BLOCKED 739
2173
2174/**
2175 * Server <-> Client message to signalize the client that the called peer is not connected
2176 */
2177#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_NOT_CONNECTED 740
2178
2179/**
2180 * Server <-> Client message to signalize the client that called peer does not answer
2181 */
2182#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_NO_ANSWER 741
2183
2184/**
2185 * Server <-> Client message to notify client of missed call
2186 */
2187#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_MISSED_CALL 742
2188
2189/**
2190 * Server <-> Client message to signalize the client that there occured an error
2191 */
2192#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_ERROR 743
2193
2194/**
2195 * Server <-> Client message to notify client of peer being available
2196 */
2197#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_AVAILABLE 744
2198
2199/**
2200 * Mesh message to sinal the remote peer the wish to initiate a new call
2201 */
2202#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_INITIATE 745
2203
2204/**
2205 * Mesh message to signal the remote peer the acceptance of an initiated call
2206 */
2207#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_ACCEPT 746
2208
2209/**
2210 * Mesh message to reject an a wish to initiate a new call
2211 */
2212#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_REJECT 747
2213
2214/**
2215 * Mesh message to signal a remote peer the terminatation of a call
2216 */
2217#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_TERMINATE 748
2218
2219/**
2220 * Server <-> Client message to notify client of peer being available
2221 */
2222#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PEER_AVAILABLE 749
2223
2224
2225#define GNUNET_MESSAGE_TYPE_CONVERSATION_TEST 750
2226
2227/**
2228* Message to transmit the audio
2229*/
2230#define GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO 751
2231
2232
2233/*******************************************************************************
2121 * MULTICAST message types 2234 * MULTICAST message types
2122 ******************************************************************************/ 2235 ******************************************************************************/
2123 2236
@@ -2127,7 +2240,7 @@ extern "C"
2127/** 2240/**
2128 * Multicast message from the origin to all members. 2241 * Multicast message from the origin to all members.
2129 */ 2242 */
2130#define GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE 730 2243#define GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE 760
2131 2244
2132/** 2245/**
2133 * A unicast message from a group member to the origin. 2246 * A unicast message from a group member to the origin.
@@ -2177,7 +2290,7 @@ extern "C"
2177 2290
2178 2291
2179/** 2292/**
2180 * Next available: 750 2293 * Next available: 780
2181 */ 2294 */
2182 2295
2183 2296