463 for (uint32_t i = 0; i < rd_count; i++)
515 "Connection to conversation service lost, trying to reconnect\n"));
533 if (NULL != call->
mq)
601 if (NULL == call->
mq)
615 if (NULL == call->
gns)
647 if ((NULL != call->
mic) &&
654 if (NULL != call->
mq)
664 if (NULL != call->
gns)
Client -> Service message to call a phone.
Connection to the GNS service.
void(* GNUNET_CONVERSATION_CallEventHandler)(void *cls, enum GNUNET_CONVERSATION_CallEventCode code)
Function called with an event emitted for a call.
The call was suspended by the caller.
struct GNUNET_PeerIdentity peer
Identity of the peer hosting the phone service.
static void fail_call(struct GNUNET_CONVERSATION_Call *call)
The call got disconnected, reconnect to the service.
struct GNUNET_MessageHeader * msg
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
enum CallState state
State machine for the call.
struct GNUNET_IDENTITY_PrivateKey caller_id
Identity of the caller.
GNUNET_MQ_Error
Error codes for the queue.
static void handle_call_suspend(void *cls, const struct ClientPhoneSuspendMessage *msg)
We received a GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND.
void * GNUNET_GNS_lookup_with_tld_cancel(struct GNUNET_GNS_LookupWithTldRequest *ltr)
Cancel pending lookup request.
constants for network protocols
GNUNET_MICROPHONE_DisableCallback disable_microphone
Turn the microphone off.
#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL
Client <- Server message to indicate a ringing phone.
static size_t data_size
Number of bytes in data.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
We are the caller and the callee suspended the call.
GNUNET_SPEAKER_PlayCallback play
Play audio.
struct GNUNET_GNS_LookupWithTldRequest * GNUNET_GNS_lookup_with_tld(struct GNUNET_GNS_Handle *handle, const char *name, uint32_t type, enum GNUNET_GNS_LocalOptions options, GNUNET_GNS_LookupResultProcessor2 proc, void *proc_cls)
Perform an asynchronous lookup operation on the GNS, determining the zone using the TLD of the given ...
static void handle_call_hangup(void *cls, const struct ClientPhoneHangupMessage *msg)
We received a #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_HANG_UP.
struct GNUNET_PeerIdentity target
Which peer is hosting the line?
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
static struct Experiment * e
struct GNUNET_CONVERSATION_PhoneRecord phone_record
Target phone record, only valid after the lookup is done.
GNUNET_MICROPHONE_EnableCallback enable_microphone
Turn on the microphone.
struct GNUNET_IDENTITY_Ego * caller_id
Our caller identity.
#define GNUNET_GNSRECORD_TYPE_PHONE
Record type for a phone (of CONVERSATION).
const struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
size_t data_size
Number of bytes in data.
GNUNET_SPEAKER_DisableCallback disable_speaker
Turn the speaker off.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO
Client <-> Server message to send audio data.
struct GNUNET_GNS_Handle * gns
Connection to GNS (can be NULL).
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static void transmit_call_audio(void *cls, size_t data_size, const void *data)
Process recorded audio data.
We are the caller and are now ready to talk as the callee picked up.
The call is in an active conversation.
A phone record specifies which peer is hosting a given user and may also specify the phone line that ...
static void handle_call_audio(void *cls, const struct ClientAudioMessage *am)
We received a struct ClientAudioMessage
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
void * event_handler_cls
Closure for event_handler.
const void * data
Binary value stored in the DNS record.
Client <-> Service hang up phone that may or may not be ringing.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP
Service -> Client message to notify that phone was picked up.
void * cls
Closure for the callbacks.
char * callee
Target callee as a GNS address/name.
void GNUNET_GNS_disconnect(struct GNUNET_GNS_Handle *handle)
Shutdown connection with the GNS service.
struct GNUNET_MQ_Handle * mq
Handle for transmitting to the CONVERSATION service.
static void handle_call_resume(void *cls, const struct ClientPhoneResumeMessage *msg)
We received a GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME.
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.
We are the caller and are now ringing the other party (GNS lookup succeeded).
We are the caller and the callee called GNUNET_CONVERSATION_caller_hang_up.
struct GNUNET_GNS_Handle * GNUNET_GNS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize the connection with the GNS service.
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.
Message handler for a specific message type.
GNUNET_SPEAKER_EnableCallback enable_speaker
Turn on the speaker.
struct GNUNET_SPEAKER_Handle * speaker
Our speaker.
static int check_call_audio(void *cls, const struct ClientAudioMessage *am)
We received a struct ClientAudioMessage, check it is well-formed.
void * cls
Closure for the callbacks.
#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME
Client <-> Server message to resume connection.
We are the caller and failed to locate a phone record in GNS.
CallState
Possible states of the phone.
Service <-> Client message for phone was resumed.
Service -> Client: other peer has picked up the phone, we are now talking.
The call was suspended by the callee.
Handle to a message queue.
static void handle_call_picked_up(void *cls, const struct ClientPhonePickedupMessage *msg)
We received a GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP.
static struct GNUNET_CONVERSATION_Call * call
Call handle (for active outgoing call).
struct GNUNET_HashCode line_port
Which phone line to call at the peer?
The call was suspended by both caller and callee.
const struct GNUNET_IDENTITY_PrivateKey * GNUNET_IDENTITY_ego_get_private_key(const struct GNUNET_IDENTITY_Ego *ego)
Obtain the ECC key associated with a ego.
struct GNUNET_GNS_LookupWithTldRequest * gns_lookup
Active GNS lookup (or NULL).
static void handle_gns_response(void *cls, int was_gns, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Iterator called on obtained result for a GNS lookup.
#define GNUNET_log(kind,...)
Message Client <-> Service to transmit the audio.
struct GNUNET_HashCode line_port
Phone line (CADET port) to connect to.
void GNUNET_CONVERSATION_call_stop(struct GNUNET_CONVERSATION_Call *call)
Terminate a call.
We are the caller and the callee suspended the call.
GNUNET_CONVERSATION_CallEventHandler event_handler
Function to call with events.
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO.
Handle for an outgoing call.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
The call is in termination.
A microphone is a device that can capture or otherwise produce audio data.
#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND
Client <-> Server message to suspend connection.
We had an error handing the call, and are now restarting it (back to lookup).
static void call_error_handler(void *cls, enum GNUNET_MQ_Error error)
We encountered an error talking with the conversation service.
struct GNUNET_MICROPHONE_Handle * mic
Our microphone.
Service <-> Client message for phone was suspended.
We still need to lookup the callee.
Handle to a lookup request.
uint32_t data
The data value.
A speaker is a device that can play or record audio data.
void GNUNET_CONVERSATION_call_suspend(struct GNUNET_CONVERSATION_Call *call)
Pause a call.
#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP
Client -> Server message to reject/hangup a call.
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_free(ptr)
Wrapper around free.