aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_conversation_service.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-10-05 13:13:29 +0000
committerChristian Grothoff <christian@grothoff.org>2013-10-05 13:13:29 +0000
commit51197efdfb417a9388a7f5f46b51ffe3077d9b24 (patch)
tree1acf82f5ff957955c715c4f59d25740b86ffea1b /src/include/gnunet_conversation_service.h
parentac3a1c494fd48fc1d01fcc4eafa0b3f4878f5441 (diff)
downloadgnunet-51197efdfb417a9388a7f5f46b51ffe3077d9b24.tar.gz
gnunet-51197efdfb417a9388a7f5f46b51ffe3077d9b24.zip
-removing old legacy conversation API
Diffstat (limited to 'src/include/gnunet_conversation_service.h')
-rw-r--r--src/include/gnunet_conversation_service.h226
1 files changed, 26 insertions, 200 deletions
diff --git a/src/include/gnunet_conversation_service.h b/src/include/gnunet_conversation_service.h
index 248a66325..3c3112745 100644
--- a/src/include/gnunet_conversation_service.h
+++ b/src/include/gnunet_conversation_service.h
@@ -25,6 +25,26 @@
25 * @author Andreas Fuchs 25 * @author Andreas Fuchs
26 * @author Christian Grothoff 26 * @author Christian Grothoff
27 * 27 *
28 *
29 * NOTE: This API is deliberately deceptively simple; the idea
30 * is that advanced features (such as answering machines) will
31 * be done with a separate service (an answering machine service)
32 * with its own APIs; the speaker/microphone abstractions are
33 * used to facilitate plugging in custom logic for implementing
34 * such a service later by creating "software" versions of
35 * speakers and microphones that record to disk or play a file.
36 * Notifications about missed calls should similarly be done
37 * using a separate service; CONVERSATION is supposed to be just
38 * the "bare bones" voice service.
39 *
40 * Meta data passing is supported so that advanced services
41 * can identify themselves appropriately.
42 *
43 * As this is supposed to be a "secure" service, caller ID is of
44 * course provided as part of the basic implementation, as only the
45 * CONVERSATION service can know for sure who it is that we are
46 * talking to.
47 *
28 * TODO: 48 * TODO:
29 * - call waiting 49 * - call waiting
30 * - put on hold 50 * - put on hold
@@ -41,206 +61,6 @@ extern "C"
41#endif 61#endif
42 62
43#include "gnunet_util_lib.h" 63#include "gnunet_util_lib.h"
44
45/**
46 * Version of the conversation API.
47 */
48#define GNUNET_CONVERSATION_VERSION 0x00000001
49
50
51enum GNUNET_CONVERSATION_RejectReason
52{
53 GNUNET_CONVERSATION_REJECT_REASON_GENERIC = 0,
54 GNUNET_CONVERSATION_REJECT_REASON_NOT_AVAILABLE,
55 GNUNET_CONVERSATION_REJECT_REASON_NO_CLIENT,
56 GNUNET_CONVERSATION_REJECT_REASON_ACTIVE_CALL,
57 GNUNET_CONVERSATION_REJECT_REASON_NOT_WANTED,
58 GNUNET_CONVERSATION_REJECT_REASON_NO_ANSWER
59
60};
61
62
63enum GNUNET_CONVERSATION_NotificationType
64{
65 GNUNET_CONVERSATION_NT_SERVICE_BLOCKED = 0,
66 GNUNET_CONVERSATION_NT_NO_PEER,
67 GNUNET_CONVERSATION_NT_NO_ANSWER,
68 GNUNET_CONVERSATION_NT_AVAILABLE_AGAIN,
69 GNUNET_CONVERSATION_NT_CALL_ACCEPTED,
70 GNUNET_CONVERSATION_NT_CALL_TERMINATED
71};
72
73
74/**
75 *
76 */
77struct GNUNET_CONVERSATION_MissedCall
78{
79 struct GNUNET_PeerIdentity peer;
80 struct GNUNET_TIME_Absolute time;
81};
82
83
84struct GNUNET_CONVERSATION_MissedCallNotification
85{
86 int number;
87 struct GNUNET_CONVERSATION_MissedCall *calls;
88};
89
90struct GNUNET_CONVERSATION_CallInformation;
91
92struct GNUNET_CONVERSATION_Handle;
93
94
95/**
96 * Method called whenever a call is incoming
97 *
98 * @param cls closure
99 * @param handle to the conversation session
100 * @param caller peer that calls you
101 */
102typedef void (GNUNET_CONVERSATION_CallHandler) (void *cls,
103 struct GNUNET_CONVERSATION_Handle *handle,
104 const struct GNUNET_PeerIdentity *caller);
105
106
107/**
108 * Method called whenever a call is rejected
109 *
110 * @param cls closure
111 * @param handle to the conversation session
112 * @param reason reason given for rejecting the call
113 * @param peer peer that rejected your call
114 */
115typedef void (GNUNET_CONVERSATION_RejectHandler) (void *cls,
116 struct GNUNET_CONVERSATION_Handle *handle,
117 enum GNUNET_CONVERSATION_RejectReason reason,
118 const struct GNUNET_PeerIdentity *peer);
119
120
121/**
122 * Method called whenever a notification is there
123 *
124 * @param cls closure
125 * @param handle to the conversation session
126 * @param type the type of the notification
127 * @param peer peer that the notification is about
128 */
129typedef void (GNUNET_CONVERSATION_NotificationHandler) (void *cls,
130 struct GNUNET_CONVERSATION_Handle *handle,
131 enum GNUNET_CONVERSATION_NotificationType type,
132 const struct GNUNET_PeerIdentity *peer);
133
134
135/**
136 * Method called whenever a notification for missed calls is there
137 *
138 * @param cls closure
139 * @param handle to the conversation session
140 * @param missed_calls a list of missed calls
141 */
142typedef void (GNUNET_CONVERSATION_MissedCallHandler) (void *cls,
143 struct GNUNET_CONVERSATION_Handle *handle,
144 struct GNUNET_CONVERSATION_MissedCallNotification *missed_calls);
145
146
147/**
148 * Connect to the VoIP service
149 *
150 * @param cfg configuration
151 * @param cls NULL
152 * @param call_handler the callback which is called when a call is incoming
153 * @param reject_handler the callback which is called when a call is rejected
154 * @param notification_handler the callback which is called when there is a notification
155 * @param missed_call_handler the callback which is called when the service notifies the client about missed clients
156 * @return handle to the connection to the conversation service
157 */
158struct GNUNET_CONVERSATION_Handle *
159GNUNET_CONVERSATION_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
160 void *cls,
161 GNUNET_CONVERSATION_CallHandler call_handler,
162 GNUNET_CONVERSATION_RejectHandler reject_handler,
163 GNUNET_CONVERSATION_NotificationHandler notification_handler,
164 GNUNET_CONVERSATION_MissedCallHandler missed_call_handler);
165
166
167/**
168 * Disconnect from the VoIP service
169 *
170 * @param handle handle to the VoIP connection
171 */
172void
173GNUNET_CONVERSATION_disconnect (struct GNUNET_CONVERSATION_Handle *handle);
174
175
176/**
177 * Establish a call
178 *
179 * @param handle handle to the VoIP connection
180 * @param callee the peer (PeerIdentity or GNS name) to call
181 * @param doGnsLookup 0 = no GNS lookup or 1 = GNS lookup
182 */
183void
184GNUNET_CONVERSATION_call (struct GNUNET_CONVERSATION_Handle *handle,
185 const char *callee,
186 int doGnsLookup);
187
188
189/**
190 * Terminate the active call
191 *
192 * @param handle handle to the VoIP connection
193 */
194void
195GNUNET_CONVERSATION_hangup (struct GNUNET_CONVERSATION_Handle *handle);
196
197
198/**
199 * Accept an incoming call
200 *
201 * @param handle handle to the VoIP connection
202 */
203void
204GNUNET_CONVERSATION_accept (struct GNUNET_CONVERSATION_Handle *handle);
205
206
207/**
208 * Reject an incoming call
209 *
210 * @param handle handle to the VoIP connection
211 */
212void
213GNUNET_CONVERSATION_reject (struct GNUNET_CONVERSATION_Handle *handle);
214
215
216
217////////////////////////////////////////////////////////////////////
218////////////////////////// NEW API /////////////////////////////////
219////////////////////////////////////////////////////////////////////
220
221/*
222 NOTE: This API is deliberately deceptively simple; the idea
223 is that advanced features (such as answering machines) will
224 be done with a separate service (an answering machine service)
225 with its own APIs; the speaker/microphone abstractions are
226 used to facilitate plugging in custom logic for implementing
227 such a service later by creating "software" versions of
228 speakers and microphones that record to disk or play a file.
229 Notifications about missed calls should similarly be done
230 using a separate service; CONVERSATION is supposed to be just
231 the "bare bones" voice service.
232
233 Meta data passing is supported so that advanced services
234 can identify themselves appropriately.
235
236 As this is supposed to be a "secure" service, caller ID is of
237 course provided as part of the basic implementation, as only the
238 CONVERSATION service can know for sure who it is that we are
239 talking to.
240 */
241
242
243#include "gnunet_util_lib.h"
244#include "gnunet_identity_service.h" 64#include "gnunet_identity_service.h"
245#include "gnunet_namestore_service.h" 65#include "gnunet_namestore_service.h"
246#include "gnunet_speaker_lib.h" 66#include "gnunet_speaker_lib.h"
@@ -248,6 +68,12 @@ GNUNET_CONVERSATION_reject (struct GNUNET_CONVERSATION_Handle *handle);
248 68
249 69
250/** 70/**
71 * Version of the conversation API.
72 */
73#define GNUNET_CONVERSATION_VERSION 0x00000002
74
75
76/**
251 * Information about the current status of a call. Each call 77 * Information about the current status of a call. Each call
252 * progresses from ring over ready to terminated. Steps may 78 * progresses from ring over ready to terminated. Steps may
253 * be skipped. 79 * be skipped.