2 This file is part of GNUnet
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.
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
43 enum GNUNET_CONVERSATION_RejectReason
45 REJECT_REASON_GENERIC = 0,
46 REJECT_REASON_NOT_AVAILABLE,
47 REJECT_REASON_NO_CLIENT,
48 REJECT_REASON_ACTIVE_CALL,
49 REJECT_REASON_NOT_WANTED,
50 REJECT_REASON_NO_ANSWER
54 enum GNUNET_CONVERSATION_NotificationType
56 NotificationType_SERVICE_BLOCKED = 0,
57 NotificationType_NO_PEER,
58 NotificationType_NO_ANSWER,
59 NotificationType_AVAILABLE_AGAIN,
60 NotificationType_CALL_ACCEPTED,
61 NotificationType_CALL_TERMINATED
69 struct GNUNET_CONVERSATION_MissedCall
71 struct GNUNET_PeerIdentity peer;
72 struct GNUNET_TIME_Absolute time;
76 struct GNUNET_CONVERSATION_MissedCallNotification
79 struct GNUNET_CONVERSATION_MissedCall *calls;
82 struct GNUNET_CONVERSATION_CallInformation;
83 struct GNUNET_CONVERSATION_Handle;
86 * Method called whenever a call is incoming
89 * @param handle to the conversation session
90 * @param caller peer that calls you
92 typedef void (GNUNET_CONVERSATION_CallHandler) (void *cls,
94 GNUNET_CONVERSATION_Handle
97 GNUNET_PeerIdentity * caller);
100 * Method called whenever a call is rejected
103 * @param handle to the conversation session
104 * @param peer peer that rejected your call
106 typedef void (GNUNET_CONVERSATION_RejectHandler) (void *cls,
108 GNUNET_CONVERSATION_Handle
113 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,
125 GNUNET_CONVERSATION_Handle
130 GNUNET_PeerIdentity * peer);
133 * Method called whenever a notification for missed calls is there
136 * @param handle to the conversation session
137 * @param missed_calls a list of missed calls
139 typedef void (GNUNET_CONVERSATION_MissedCallHandler) (void *cls,
141 GNUNET_CONVERSATION_Handle
144 GNUNET_CONVERSATION_MissedCallNotification
148 * Connect to the VoIP service
150 * @param cfg configuration
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 aabout missed clients
156 * @return handle to the connection to the conversation service
158 struct GNUNET_CONVERSATION_Handle *GNUNET_CONVERSATION_connect (const struct
159 GNUNET_CONFIGURATION_Handle
161 GNUNET_CONVERSATION_CallHandler *
163 GNUNET_CONVERSATION_RejectHandler *
165 GNUNET_CONVERSATION_NotificationHandler
166 * notification_handler,
167 GNUNET_CONVERSATION_MissedCallHandler
168 * missed_call_handler);
171 * Disconnect from the VoIP service
173 * @param handle handle to the VoIP connection
175 void GNUNET_CONVERSATION_disconnect (struct GNUNET_CONVERSATION_Handle *handle);
180 * @param handle handle to the VoIP connection
181 * @param callee the peer (PeerIdentity or GNS name) to call
182 * @param doGnsLookup 0 = no GNS lookup or 1 = GNS lookup
185 GNUNET_CONVERSATION_call (struct GNUNET_CONVERSATION_Handle *handle, const char *callee,
189 * Terminate the active call
191 * @param handle handle to the VoIP connection
193 void GNUNET_CONVERSATION_hangup (struct GNUNET_CONVERSATION_Handle *handle);
196 * Accept an incoming call
198 * @param handle handle to the VoIP connection
200 void GNUNET_CONVERSATION_accept (struct GNUNET_CONVERSATION_Handle *handle);
203 * Reject an incoming call
205 * @param handle handle to the VoIP connection
207 void GNUNET_CONVERSATION_reject (struct GNUNET_CONVERSATION_Handle *handle);
209 #if 0 /* keep Emacsens' auto-indent happy */