GNUnet  0.19.4
gnunet_conversation_service.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2013, 2014, 2016 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
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  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
53 #ifndef GNUNET_CONVERSATION_SERVICE_H
54 #define GNUNET_CONVERSATION_SERVICE_H
55 
56 #ifdef __cplusplus
57 extern "C"
58 {
59 #if 0 /* keep Emacsens' auto-indent happy */
60 }
61 #endif
62 #endif
63 
64 
65 #include "gnunet_util_lib.h"
68 #include "gnunet_speaker_lib.h"
69 #include "gnunet_microphone_lib.h"
70 
71 
75 #define GNUNET_CONVERSATION_VERSION 0x00000004
76 
84 
85 
87 
94 {
101 
106 
110  struct GNUNET_PeerIdentity peer;
111 
115  struct GNUNET_HashCode line_port;
116 };
117 
119 
124 {
130 
136 };
137 
138 
147 typedef void
150  code,
152  caller,
153  const struct
155 
156 
163 {
170 
177 };
178 
179 
188 typedef void
190  enum
192  code);
193 
194 
207 
208 
220  const struct GNUNET_IDENTITY_Ego *ego,
223  void *event_handler_cls);
224 
225 
234 void
236  struct GNUNET_GNSRECORD_Data *rd);
237 
238 
249 void
253  void *event_handler_cls,
255  struct GNUNET_MICROPHONE_Handle *mic);
256 
257 
265 void
267 
268 
276 void
279  struct GNUNET_MICROPHONE_Handle *mic);
280 
281 
288 void
290 
291 
297 void
299 
300 
301 /* *********************** CALL API ************************ */
302 
307 
308 
313 {
319 
324 
333 
341 
348 
355 
362 };
363 
364 
371 typedef void
374  code);
375 
376 
395  const char *callee,
400  void *event_handler_cls);
401 
402 
409 void
411 
412 
420 void
423  struct GNUNET_MICROPHONE_Handle *mic);
424 
425 
431 void
433 
434 
435 #if 0 /* keep Emacsens' auto-indent happy */
436 {
437 #endif
438 #ifdef __cplusplus
439 }
440 #endif
441 
442 #endif
443  /* end of group */
445  /* end of group addition */
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static struct GNUNET_SPEAKER_Handle * speaker
Handle to the speaker.
static struct GNUNET_CONVERSATION_Call * call
Call handle (for active outgoing call).
static struct GNUNET_MICROPHONE_Handle * mic
Our microphone.
static struct GNUNET_CONVERSATION_Phone * phone
Phone handle.
static struct GNUNET_GNSRECORD_Data rd[50]
The record data under a single label.
Identity service; implements identity management for GNUnet.
API to access an audio microphone; provides access to hardware microphones.
API that can be used to store naming information on a GNUnet node;.
API to access an audio speaker; provides access to hardware speakers.
void GNUNET_CONVERSATION_phone_get_record(struct GNUNET_CONVERSATION_Phone *phone, struct GNUNET_GNSRECORD_Data *rd)
Fill in a namestore record with the contact information for this phone.
struct GNUNET_CONVERSATION_Call * GNUNET_CONVERSATION_call_start(const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_IDENTITY_Ego *caller_id, const char *callee, struct GNUNET_SPEAKER_Handle *speaker, struct GNUNET_MICROPHONE_Handle *mic, GNUNET_CONVERSATION_CallEventHandler event_handler, void *event_handler_cls)
Call the phone of another user.
void GNUNET_CONVERSATION_call_suspend(struct GNUNET_CONVERSATION_Call *call)
Pause a call.
void(* GNUNET_CONVERSATION_CallerEventHandler)(void *cls, enum GNUNET_CONVERSATION_CallerEventCode code)
Function called with an event emitted by a caller.
void GNUNET_CONVERSATION_caller_suspend(struct GNUNET_CONVERSATION_Caller *caller)
Pause conversation of an active call.
void GNUNET_CONVERSATION_call_resume(struct GNUNET_CONVERSATION_Call *call, struct GNUNET_SPEAKER_Handle *speaker, struct GNUNET_MICROPHONE_Handle *mic)
Resumes a call after GNUNET_CONVERSATION_call_suspend.
void(* GNUNET_CONVERSATION_PhoneEventHandler)(void *cls, enum GNUNET_CONVERSATION_PhoneEventCode code, struct GNUNET_CONVERSATION_Caller *caller, const struct GNUNET_IDENTITY_PublicKey *caller_id)
Function called with an event emitted by a phone.
void GNUNET_CONVERSATION_call_stop(struct GNUNET_CONVERSATION_Call *call)
Terminate a call.
void GNUNET_CONVERSATION_phone_destroy(struct GNUNET_CONVERSATION_Phone *phone)
Destroys a phone.
GNUNET_CONVERSATION_CallerEventCode
Information about the current status of a call.
GNUNET_CONVERSATION_PhoneEventCode
Information about active callers to a phone.
void GNUNET_CONVERSATION_caller_resume(struct GNUNET_CONVERSATION_Caller *caller, struct GNUNET_SPEAKER_Handle *speaker, struct GNUNET_MICROPHONE_Handle *mic)
Resume suspended conversation of a phone.
void GNUNET_CONVERSATION_caller_hang_up(struct GNUNET_CONVERSATION_Caller *caller)
Hang up up a (possibly ringing or paused) phone.
void GNUNET_CONVERSATION_caller_pick_up(struct GNUNET_CONVERSATION_Caller *caller, GNUNET_CONVERSATION_CallerEventHandler event_handler, void *event_handler_cls, struct GNUNET_SPEAKER_Handle *speaker, struct GNUNET_MICROPHONE_Handle *mic)
Picks up a (ringing) phone call.
struct GNUNET_CONVERSATION_Phone * GNUNET_CONVERSATION_phone_create(const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_IDENTITY_Ego *ego, GNUNET_CONVERSATION_PhoneEventHandler event_handler, void *event_handler_cls)
Create a new phone.
GNUNET_CONVERSATION_CallEventCode
Information about the current status of a call.
void(* GNUNET_CONVERSATION_CallEventHandler)(void *cls, enum GNUNET_CONVERSATION_CallEventCode code)
Function called with an event emitted for a call.
@ GNUNET_CONVERSATION_EC_CALLER_RESUME
We are the callee and the caller resumed the call.
@ GNUNET_CONVERSATION_EC_CALLER_SUSPEND
We are the callee and the caller suspended the call.
@ GNUNET_CONVERSATION_EC_PHONE_HUNG_UP
The conversation was terminated by the caller.
@ GNUNET_CONVERSATION_EC_PHONE_RING
We are the callee and the phone is ringing.
@ GNUNET_CONVERSATION_EC_CALL_SUSPENDED
We are the caller and the callee suspended the call.
@ GNUNET_CONVERSATION_EC_CALL_GNS_FAIL
We are the caller and failed to locate a phone record in GNS.
@ GNUNET_CONVERSATION_EC_CALL_PICKED_UP
We are the caller and are now ready to talk as the callee picked up.
@ GNUNET_CONVERSATION_EC_CALL_RESUMED
We are the caller and the callee suspended the call.
@ GNUNET_CONVERSATION_EC_CALL_RINGING
We are the caller and are now ringing the other party (GNS lookup succeeded).
@ GNUNET_CONVERSATION_EC_CALL_ERROR
We had an error handing the call, and are now restarting it (back to lookup).
@ GNUNET_CONVERSATION_EC_CALL_HUNG_UP
We are the caller and the callee called GNUNET_CONVERSATION_caller_hang_up.
#define GNUNET_NETWORK_STRUCT_BEGIN
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32.
#define GNUNET_NETWORK_STRUCT_END
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;.
#define GNUNET_PACKED
gcc-ism to get packed structs.
Handle for an outgoing call.
void * event_handler_cls
Closure for event_handler.
char * callee
Target callee as a GNS address/name.
GNUNET_CONVERSATION_CallEventHandler event_handler
Function to call with events.
struct GNUNET_IDENTITY_Ego * caller_id
Our caller identity.
A caller is the handle we have for an incoming call.
struct GNUNET_IDENTITY_PublicKey caller_id
Identity of the person calling us.
A phone record specifies which peer is hosting a given user and may also specify the phone line that ...
struct GNUNET_HashCode line_port
Phone line (CADET port) to connect to.
struct GNUNET_PeerIdentity peer
Identity of the peer hosting the phone service.
uint32_t version
Version of the phone record, for now always one.
A phone is a device that can ring to signal an incoming call and that you can pick up to answer the c...
GNUNET_CONVERSATION_PhoneEventHandler event_handler
Function to call for phone events.
void * event_handler_cls
Closure for event_handler.
A 512-bit hashcode.
Handle for an ego.
Definition: identity.h:37
An identity key as per LSD0001.
A microphone is a device that can capture or otherwise produce audio data.
The identity of the host (wraps the signing key of the peer).
A speaker is a device that can play or record audio data.