2 This file is part of GNUnet
3 (C) 2013 Christian Grothoff (and other contributing authors)
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.
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.
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.
22 * @file include/gnunet_conversation_service.h
23 * @brief API to the conversation service
24 * @author Simon Dieterle
25 * @author Andreas Fuchs
27 #ifndef GNUNET_CONVERSATION_SERVICE_H
28 #define GNUNET_CONVERSATION_SERVICE_H
33 #if 0 /* keep Emacsens' auto-indent happy */
39 * Version of the conversation API.
41 #define GNUNET_CONVERSATION_VERSION 0x00000001
44 enum GNUNET_CONVERSATION_RejectReason
46 GNUNET_CONVERSATION_REJECT_REASON_GENERIC = 0,
47 GNUNET_CONVERSATION_REJECT_REASON_NOT_AVAILABLE,
48 GNUNET_CONVERSATION_REJECT_REASON_NO_CLIENT,
49 GNUNET_CONVERSATION_REJECT_REASON_ACTIVE_CALL,
50 GNUNET_CONVERSATION_REJECT_REASON_NOT_WANTED,
51 GNUNET_CONVERSATION_REJECT_REASON_NO_ANSWER
56 enum GNUNET_CONVERSATION_NotificationType
58 GNUNET_CONVERSATION_NT_SERVICE_BLOCKED = 0,
59 GNUNET_CONVERSATION_NT_NO_PEER,
60 GNUNET_CONVERSATION_NT_NO_ANSWER,
61 GNUNET_CONVERSATION_NT_AVAILABLE_AGAIN,
62 GNUNET_CONVERSATION_NT_CALL_ACCEPTED,
63 GNUNET_CONVERSATION_NT_CALL_TERMINATED
70 struct GNUNET_CONVERSATION_MissedCall
72 struct GNUNET_PeerIdentity peer;
73 struct GNUNET_TIME_Absolute time;
77 struct GNUNET_CONVERSATION_MissedCallNotification
80 struct GNUNET_CONVERSATION_MissedCall *calls;
83 struct GNUNET_CONVERSATION_CallInformation;
85 struct GNUNET_CONVERSATION_Handle;
89 * Method called whenever a call is incoming
92 * @param handle to the conversation session
93 * @param caller peer that calls you
95 typedef void (GNUNET_CONVERSATION_CallHandler) (void *cls,
97 GNUNET_CONVERSATION_Handle *handle,
98 const struct GNUNET_PeerIdentity *caller);
102 * Method called whenever a call is rejected
105 * @param handle to the conversation session
106 * @param reason reason given for rejecting the call
107 * @param peer peer that rejected your call
109 typedef void (GNUNET_CONVERSATION_RejectHandler) (void *cls,
110 struct GNUNET_CONVERSATION_Handle *handle,
111 enum GNUNET_CONVERSATION_RejectReason reason,
112 const struct GNUNET_PeerIdentity *peer);
116 * Method called whenever a notification is there
119 * @param handle to the conversation session
120 * @param type the type of the notification
121 * @param peer peer that the notification is about
123 typedef void (GNUNET_CONVERSATION_NotificationHandler) (void *cls,
124 struct GNUNET_CONVERSATION_Handle *handle,
125 enum GNUNET_CONVERSATION_NotificationType type,
126 const struct GNUNET_PeerIdentity *peer);
130 * Method called whenever a notification for missed calls is there
133 * @param handle to the conversation session
134 * @param missed_calls a list of missed calls
136 typedef void (GNUNET_CONVERSATION_MissedCallHandler) (void *cls,
137 struct GNUNET_CONVERSATION_Handle *handle,
138 struct GNUNET_CONVERSATION_MissedCallNotification *missed_calls);
142 * Connect to the VoIP service
144 * @param cfg configuration
146 * @param call_handler the callback which is called when a call is incoming
147 * @param reject_handler the callback which is called when a call is rejected
148 * @param notification_handler the callback which is called when there is a notification
149 * @param missed_call_handler the callback which is called when the service notifies the client about missed clients
150 * @return handle to the connection to the conversation service
152 struct GNUNET_CONVERSATION_Handle *
153 GNUNET_CONVERSATION_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
155 GNUNET_CONVERSATION_CallHandler call_handler,
156 GNUNET_CONVERSATION_RejectHandler reject_handler,
157 GNUNET_CONVERSATION_NotificationHandler notification_handler,
158 GNUNET_CONVERSATION_MissedCallHandler missed_call_handler);
162 * Disconnect from the VoIP service
164 * @param handle handle to the VoIP connection
167 GNUNET_CONVERSATION_disconnect (struct GNUNET_CONVERSATION_Handle *handle);
173 * @param handle handle to the VoIP connection
174 * @param callee the peer (PeerIdentity or GNS name) to call
175 * @param doGnsLookup 0 = no GNS lookup or 1 = GNS lookup
178 GNUNET_CONVERSATION_call (struct GNUNET_CONVERSATION_Handle *handle,
184 * Terminate the active call
186 * @param handle handle to the VoIP connection
189 GNUNET_CONVERSATION_hangup (struct GNUNET_CONVERSATION_Handle *handle);
193 * Accept an incoming call
195 * @param handle handle to the VoIP connection
198 GNUNET_CONVERSATION_accept (struct GNUNET_CONVERSATION_Handle *handle);
202 * Reject an incoming call
204 * @param handle handle to the VoIP connection
207 GNUNET_CONVERSATION_reject (struct GNUNET_CONVERSATION_Handle *handle);
210 #if 0 /* keep Emacsens' auto-indent happy */