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_NO_CLIENT = 0,
46 REJECT_REASON_ACTIVE_CALL,
47 REJECT_REASON_NOT_WANTED
50 enum GNUNET_CONVERSATION_NotificationType
52 NotificationType_SERVICE_BLOCKED = 0,
53 NotificationType_NO_PEER,
54 NotificationType_NO_ANSWER,
55 NotificationType_AVAILABLE_AGAIN,
56 NotificationType_CALL_ACCEPTED,
57 NotificationType_CALL_TERMINATED
63 struct GNUNET_CONVERSATION_MissedCall
65 struct GNUNET_PeerIdentity peer;
66 struct GNUNET_TIME_Absolute time;
70 struct GNUNET_CONVERSATION_MissedCallNotification
73 struct GNUNET_CONVERSATION_MissedCall *calls;
76 struct GNUNET_CONVERSATION_CallInformation;
77 struct GNUNET_CONVERSATION_Handle;
80 * Method called whenever a call is incoming
83 * @param handle to the conversation session
84 * @param caller peer that calls you
86 typedef void (GNUNET_CONVERSATION_CallHandler) (void *cls,
88 GNUNET_CONVERSATION_Handle
91 GNUNET_PeerIdentity * caller);
94 * Method called whenever a call is rejected
97 * @param handle to the conversation session
98 * @param peer peer that rejected your call
100 typedef void (GNUNET_CONVERSATION_RejectHandler) (void *cls,
102 GNUNET_CONVERSATION_Handle
107 GNUNET_PeerIdentity * peer);
110 * Method called whenever a notification is there
113 * @param handle to the conversation session
114 * @param type the type of the notification
115 * @param peer peer that the notification is about
117 typedef void (GNUNET_CONVERSATION_NotificationHandler) (void *cls,
119 GNUNET_CONVERSATION_Handle
124 GNUNET_PeerIdentity * peer);
127 * Method called whenever a notification for missed calls is there
130 * @param handle to the conversation session
131 * @param missed_calls a list of missed calls
133 typedef void (GNUNET_CONVERSATION_MissedCallHandler) (void *cls,
135 GNUNET_CONVERSATION_Handle
138 GNUNET_CONVERSATION_MissedCallNotification
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 aabout missed clients
150 * @return handle to the connection to the conversation service
152 struct GNUNET_CONVERSATION_Handle *GNUNET_CONVERSATION_connect (const struct
153 GNUNET_CONFIGURATION_Handle
155 GNUNET_CONVERSATION_CallHandler *
157 GNUNET_CONVERSATION_RejectHandler *
159 GNUNET_CONVERSATION_NotificationHandler
160 * notification_handler,
161 GNUNET_CONVERSATION_MissedCallHandler
162 * missed_call_handler);
165 * Disconnect from the VoIP service
167 * @param handle handle to the VoIP connection
169 void GNUNET_CONVERSATION_disconnect (struct GNUNET_CONVERSATION_Handle *handle);
174 * @param handle handle to the VoIP connection
175 * @param callee the peer (PeerIdentity or GNS name) to call
176 * @param doGnsLookup 0 = no GNS lookup or 1 = GNS lookup
179 GNUNET_CONVERSATION_call (struct GNUNET_CONVERSATION_Handle *handle, const char *callee,
183 * Terminate the active call
185 * @param handle handle to the VoIP connection
187 void GNUNET_CONVERSATION_hangup (struct GNUNET_CONVERSATION_Handle *handle);
190 * Accept an incoming call
192 * @param handle handle to the VoIP connection
194 void GNUNET_CONVERSATION_accept (struct GNUNET_CONVERSATION_Handle *handle);
197 * Reject an incoming call
199 * @param handle handle to the VoIP connection
201 void GNUNET_CONVERSATION_reject (struct GNUNET_CONVERSATION_Handle *handle);
203 #if 0 /* keep Emacsens' auto-indent happy */