aboutsummaryrefslogtreecommitdiff
path: root/src/conversation
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-10-05 15:40:55 +0000
committerChristian Grothoff <christian@grothoff.org>2013-10-05 15:40:55 +0000
commit95b51ca1ee2a3d75a9570934dfcf1862cf830b7e (patch)
treeb9784d7a5669524f4b28a08218a2cc95e420766a /src/conversation
parentd710c7df91151dde63d3304e4fdb27dc5fa8c781 (diff)
downloadgnunet-95b51ca1ee2a3d75a9570934dfcf1862cf830b7e.tar.gz
gnunet-95b51ca1ee2a3d75a9570934dfcf1862cf830b7e.zip
-enable printing and parsing of conversation's PHONE records
Diffstat (limited to 'src/conversation')
-rw-r--r--src/conversation/conversation.h350
-rw-r--r--src/conversation/conversation_api.c36
2 files changed, 4 insertions, 382 deletions
diff --git a/src/conversation/conversation.h b/src/conversation/conversation.h
index dceb9b9e4..685d98d16 100644
--- a/src/conversation/conversation.h
+++ b/src/conversation/conversation.h
@@ -39,356 +39,6 @@ extern "C"
39#define MAX_TRANSMIT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) 39#define MAX_TRANSMIT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
40 40
41 41
42/************************************************************************************************************************
43* Messages for the Client <-> Server communication
44*/
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
58
59/**
60 * The connection status of the service
61 */
62struct ConnectionStatus
63{
64 /**
65 * The client which is in interaction
66 */
67 struct GNUNET_SERVER_Client *client;
68
69 /**
70 * The PeerIdentity of the peer
71 */
72 struct GNUNET_PeerIdentity peer;
73
74 /**
75 * The status (see enum)
76 */
77 int status;
78};
79
80/**
81* Information about a missed call
82*/
83struct MissedCall
84{
85 /**
86 * The PeerIdentity of the peer
87 */
88 struct GNUNET_PeerIdentity peer;
89
90 /**
91 * The time the call was
92 */
93 struct GNUNET_TIME_Absolute time;
94
95};
96
97
98
99
100/**
101 * Client <-> Server message to initiate a new call
102 */
103struct ClientServerSessionInitiateMessage
104{
105 /**
106 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_INITIATE
107 */
108 struct GNUNET_MessageHeader header;
109 struct GNUNET_PeerIdentity peer;
110};
111
112
113/**
114 * Client <-> Server meessage to accept an incoming call
115 */
116struct ClientServerSessionAcceptMessage
117{
118 /**
119 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_ACCEPT
120 */
121 struct GNUNET_MessageHeader header;
122};
123
124
125/**
126 * Client <-> Server message to reject an incoming call
127 */
128struct ClientServerSessionRejectMessage
129{
130 /**
131 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_REJECT
132 */
133 struct GNUNET_MessageHeader header;
134 int reason;
135};
136
137
138/**
139 * Client <-> Server message to terminat a call
140 */
141struct ClientServerSessionTerminateMessage
142{
143 /**
144 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_TERMINATE
145 */
146 struct GNUNET_MessageHeader header;
147};
148
149
150/**
151 * Client <-> Server message to initiate a new call
152 */
153struct ClientServerTestMessage
154{
155 /**
156 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_TEST
157 */
158 struct GNUNET_MessageHeader header;
159 struct GNUNET_PeerIdentity peer;
160};
161
162/************************************************************************************************************************
163* Messages for the Server <-> Client communication
164*/
165
166/**
167 * Server <-> Client message to initiate a new call
168 */
169struct ServerClientSessionInitiateMessage
170{
171 /**
172 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_INITIATE
173 */
174 struct GNUNET_MessageHeader header;
175 struct GNUNET_PeerIdentity peer;
176};
177
178
179/**
180 * Server <-> Client meessage to accept an incoming call
181 */
182struct ServerClientSessionAcceptMessage
183{
184 /**
185 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_ACCEPT
186 */
187 struct GNUNET_MessageHeader header;
188};
189
190
191/**
192 * Server <-> Client message to reject an incoming call
193 */
194struct ServerClientSessionRejectMessage
195{
196 /**
197 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_REJECT
198 */
199 struct GNUNET_MessageHeader header;
200 int reason;
201 int notify;
202};
203
204
205/**
206 * Server <-> Client message to terminat a call
207 */
208struct ServerClientSessionTerminateMessage
209{
210 /**
211 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_TERMINATE
212 */
213 struct GNUNET_MessageHeader header;
214};
215
216
217/**
218 * Server <-> Client message to signalize the client that the service is already in use
219 */
220struct ServerClientServiceBlockedMessage
221{
222 /**
223 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SERVICE_BLOCKED
224 */
225 struct GNUNET_MessageHeader header;
226};
227
228/**
229 * Server <-> Client message to signalize the client that the called peer is not connected
230 */
231struct ServerClientPeerNotConnectedMessage
232{
233 /**
234 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_NOT_CONNECTED
235 */
236 struct GNUNET_MessageHeader header;
237};
238
239
240/**
241 * Server <-> Client message to signalize the client that called peer does not answer
242 */
243struct ServerClientNoAnswerMessage
244{
245 /**
246 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_NO_ANSWER
247 */
248 struct GNUNET_MessageHeader header;
249};
250
251/**
252 * Server <-> Client message to notify client of missed call
253 */
254struct ServerClientMissedCallMessage
255{
256 /**
257 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_MISSED_CALL
258 */
259 struct GNUNET_MessageHeader header;
260 int number;
261 struct MissedCall *missed_call;
262};
263
264
265/**
266 * Server <-> Client message to signalize the client that there occured an error
267 */
268struct ServerClientErrorMessage
269{
270 /**
271 * Type is: #define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_ERROR
272 */
273 struct GNUNET_MessageHeader header;
274};
275
276
277/**
278 * Server <-> Client message to notify client of peer being available
279 */
280struct ServerClientPeerAvailableMessage
281{
282 /**
283 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_AVAILABLE
284 */
285 struct GNUNET_MessageHeader header;
286 struct GNUNET_PeerIdentity peer;
287 struct GNUNET_TIME_Absolute time;
288};
289
290/************************************************************************************************************************
291* Messages for the Mesh communication
292*/
293
294struct VoIPMeshMessageHeader
295{
296 /**
297 * Type is:
298 */
299 struct GNUNET_MessageHeader header;
300 int SequenceNumber;
301 struct GNUNET_TIME_Absolute time;
302};
303
304
305/**
306 * Mesh message to sinal the remote peer the wish to initiate a new call
307 */
308struct MeshSessionInitiateMessage
309{
310 /**
311 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_INITIATE
312 */
313 struct GNUNET_MessageHeader header;
314 int SequenceNumber;
315 struct GNUNET_TIME_Absolute time;
316 struct GNUNET_PeerIdentity peer;
317};
318
319/**
320 * Mesh message to signal the remote peer the acceptance of an initiated call
321 */
322struct MeshSessionAcceptMessage
323{
324 /**
325 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_ACCEPT
326 */
327 struct GNUNET_MessageHeader header;
328 int SequenceNumber;
329 struct GNUNET_TIME_Absolute time;
330};
331
332
333/**
334 * Mesh message to reject an a wish to initiate a new call
335 */
336struct MeshSessionRejectMessage
337{
338 /**
339 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_REJECT
340 */
341 struct GNUNET_MessageHeader header;
342 int SequenceNumber;
343 struct GNUNET_TIME_Absolute time;
344 int reason;
345 int notify;
346};
347
348
349/**
350 * Mesh message to signal a remote peer the terminatation of a call
351 */
352struct MeshSessionTerminateMessage
353{
354 /**
355 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_TERMINATE
356 */
357 struct GNUNET_MessageHeader header;
358 int SequenceNumber;
359 struct GNUNET_TIME_Absolute time;
360};
361
362
363/**
364 * Server <-> Client message to notify client of peer being available
365 */
366struct MeshPeerAvailableMessage
367{
368 /**
369 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PEER_AVAILABLE
370 */
371 struct GNUNET_MessageHeader header;
372 int SequenceNumber;
373 struct GNUNET_TIME_Absolute time;
374 struct GNUNET_PeerIdentity peer;
375 struct GNUNET_TIME_Absolute call;
376};
377
378
379/**
380 * Messages for the audio communication
381 */
382struct TestMessage
383{
384 /**
385 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_TEST
386 */
387 struct GNUNET_MessageHeader header;
388};
389
390////////////////////////////////////////////////////////////
391
392/** 42/**
393 * Message to transmit the audio (between client and helpers). 43 * Message to transmit the audio (between client and helpers).
394 */ 44 */
diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c
index 6ce198e64..130358613 100644
--- a/src/conversation/conversation_api.c
+++ b/src/conversation/conversation_api.c
@@ -32,34 +32,6 @@
32 32
33 33
34/** 34/**
35 * A phone record specifies which peer is hosting a given user and
36 * may also specify the phone line that is used (typically zero).
37 * The version is also right now always zero.
38 */
39struct PhoneRecord
40{
41
42 /**
43 * Version of the phone record, for now always zero. We may
44 * use other versions for anonymously hosted phone lines in
45 * the future.
46 */
47 uint32_t version GNUNET_PACKED;
48
49 /**
50 * Phone line to use at the peer.
51 */
52 uint32_t line GNUNET_PACKED;
53
54 /**
55 * Identity of the peer hosting the phone service.
56 */
57 struct GNUNET_PeerIdentity peer;
58
59};
60
61
62/**
63 * Possible states of the phone. 35 * Possible states of the phone.
64 */ 36 */
65enum PhoneState 37enum PhoneState
@@ -147,7 +119,7 @@ struct GNUNET_CONVERSATION_Phone
147 /** 119 /**
148 * This phone's record. 120 * This phone's record.
149 */ 121 */
150 struct PhoneRecord my_record; 122 struct GNUNET_CONVERSATION_PhoneRecord my_record;
151 123
152 /** 124 /**
153 * My GNS zone. 125 * My GNS zone.
@@ -473,7 +445,7 @@ GNUNET_CONVERSATION_phone_get_record (struct GNUNET_CONVERSATION_Phone *phone,
473{ 445{
474 rd->data = &phone->my_record; 446 rd->data = &phone->my_record;
475 rd->expiration_time = 0; 447 rd->expiration_time = 0;
476 rd->data_size = sizeof (struct PhoneRecord); 448 rd->data_size = sizeof (struct GNUNET_CONVERSATION_PhoneRecord);
477 rd->record_type = GNUNET_NAMESTORE_TYPE_PHONE; 449 rd->record_type = GNUNET_NAMESTORE_TYPE_PHONE;
478 rd->flags = GNUNET_NAMESTORE_RF_NONE; 450 rd->flags = GNUNET_NAMESTORE_RF_NONE;
479} 451}
@@ -702,7 +674,7 @@ struct GNUNET_CONVERSATION_Call
702 /** 674 /**
703 * Target phone record, only valid after the lookup is done. 675 * Target phone record, only valid after the lookup is done.
704 */ 676 */
705 struct PhoneRecord phone_record; 677 struct GNUNET_CONVERSATION_PhoneRecord phone_record;
706 678
707 /** 679 /**
708 * State machine for the call. 680 * State machine for the call.
@@ -932,7 +904,7 @@ handle_gns_response (void *cls,
932 { 904 {
933 if (GNUNET_NAMESTORE_TYPE_PHONE == rd[i].record_type) 905 if (GNUNET_NAMESTORE_TYPE_PHONE == rd[i].record_type)
934 { 906 {
935 if (rd[i].data_size != sizeof (struct PhoneRecord)) 907 if (rd[i].data_size != sizeof (struct GNUNET_CONVERSATION_PhoneRecord))
936 { 908 {
937 GNUNET_break_op (0); 909 GNUNET_break_op (0);
938 continue; 910 continue;