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,
96 struct GNUNET_CONVERSATION_Handle *handle,
97 const struct GNUNET_PeerIdentity *caller);
101 * Method called whenever a call is rejected
104 * @param handle to the conversation session
105 * @param reason reason given for rejecting the call
106 * @param peer peer that rejected your call
108 typedef void (GNUNET_CONVERSATION_RejectHandler) (void *cls,
109 struct GNUNET_CONVERSATION_Handle *handle,
110 enum GNUNET_CONVERSATION_RejectReason reason,
111 const struct GNUNET_PeerIdentity *peer);
115 * Method called whenever a notification is there
118 * @param handle to the conversation session
119 * @param type the type of the notification
120 * @param peer peer that the notification is about
122 typedef void (GNUNET_CONVERSATION_NotificationHandler) (void *cls,
123 struct GNUNET_CONVERSATION_Handle *handle,
124 enum GNUNET_CONVERSATION_NotificationType type,
125 const struct GNUNET_PeerIdentity *peer);
129 * Method called whenever a notification for missed calls is there
132 * @param handle to the conversation session
133 * @param missed_calls a list of missed calls
135 typedef void (GNUNET_CONVERSATION_MissedCallHandler) (void *cls,
136 struct GNUNET_CONVERSATION_Handle *handle,
137 struct GNUNET_CONVERSATION_MissedCallNotification *missed_calls);
141 * Connect to the VoIP service
143 * @param cfg configuration
145 * @param call_handler the callback which is called when a call is incoming
146 * @param reject_handler the callback which is called when a call is rejected
147 * @param notification_handler the callback which is called when there is a notification
148 * @param missed_call_handler the callback which is called when the service notifies the client about missed clients
149 * @return handle to the connection to the conversation service
151 struct GNUNET_CONVERSATION_Handle *
152 GNUNET_CONVERSATION_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
154 GNUNET_CONVERSATION_CallHandler call_handler,
155 GNUNET_CONVERSATION_RejectHandler reject_handler,
156 GNUNET_CONVERSATION_NotificationHandler notification_handler,
157 GNUNET_CONVERSATION_MissedCallHandler missed_call_handler);
161 * Disconnect from the VoIP service
163 * @param handle handle to the VoIP connection
166 GNUNET_CONVERSATION_disconnect (struct GNUNET_CONVERSATION_Handle *handle);
172 * @param handle handle to the VoIP connection
173 * @param callee the peer (PeerIdentity or GNS name) to call
174 * @param doGnsLookup 0 = no GNS lookup or 1 = GNS lookup
177 GNUNET_CONVERSATION_call (struct GNUNET_CONVERSATION_Handle *handle,
183 * Terminate the active call
185 * @param handle handle to the VoIP connection
188 GNUNET_CONVERSATION_hangup (struct GNUNET_CONVERSATION_Handle *handle);
192 * Accept an incoming call
194 * @param handle handle to the VoIP connection
197 GNUNET_CONVERSATION_accept (struct GNUNET_CONVERSATION_Handle *handle);
201 * Reject an incoming call
203 * @param handle handle to the VoIP connection
206 GNUNET_CONVERSATION_reject (struct GNUNET_CONVERSATION_Handle *handle);
209 #if 0 /* keep Emacsens' auto-indent happy */