call API to the conversation service More...
#include "platform.h"
#include "gnunet_conversation_service.h"
#include "gnunet_gnsrecord_lib.h"
#include "gnunet_gns_service.h"
#include "conversation.h"
Go to the source code of this file.
Data Structures | |
struct | GNUNET_CONVERSATION_Call |
Handle for an outgoing call. More... | |
Enumerations | |
enum | CallState { CS_LOOKUP = 0 , CS_RINGING , CS_ACTIVE , CS_SHUTDOWN , CS_SUSPENDED_CALLER , CS_SUSPENDED_CALLEE , CS_SUSPENDED_BOTH } |
Possible states of the phone. More... | |
Functions | |
static void | fail_call (struct GNUNET_CONVERSATION_Call *call) |
The call got disconnected, reconnect to the service. | |
static void | transmit_call_audio (void *cls, size_t data_size, const void *data) |
Process recorded audio data. | |
static void | handle_call_suspend (void *cls, const struct ClientPhoneSuspendMessage *msg) |
We received a GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND. | |
static void | handle_call_resume (void *cls, const struct ClientPhoneResumeMessage *msg) |
We received a GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME. | |
static void | handle_call_picked_up (void *cls, const struct ClientPhonePickedupMessage *msg) |
We received a GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP. | |
static void | handle_call_hangup (void *cls, const struct ClientPhoneHangupMessage *msg) |
We received a #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_HANG_UP. | |
static int | check_call_audio (void *cls, const struct ClientAudioMessage *am) |
We received a struct ClientAudioMessage , check it is well-formed. | |
static void | handle_call_audio (void *cls, const struct ClientAudioMessage *am) |
We received a struct ClientAudioMessage | |
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. | |
static void | call_error_handler (void *cls, enum GNUNET_MQ_Error error) |
We encountered an error talking with the conversation 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. | |
void | GNUNET_CONVERSATION_call_stop (struct GNUNET_CONVERSATION_Call *call) |
Terminate a call. | |
void | GNUNET_CONVERSATION_call_suspend (struct GNUNET_CONVERSATION_Call *call) |
Pause a 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. | |
call API to the conversation service
Definition in file conversation_api_call.c.
enum CallState |
Possible states of the phone.
Definition at line 38 of file conversation_api_call.c.
|
static |
The call got disconnected, reconnect to the service.
The call got disconnected, destroy the handle.
call | call to reconnect |
Definition at line 532 of file conversation_api_call.c.
References call, GNUNET_MICROPHONE_Handle::cls, GNUNET_SPEAKER_Handle::cls, CS_ACTIVE, CS_SHUTDOWN, GNUNET_MICROPHONE_Handle::disable_microphone, GNUNET_SPEAKER_Handle::disable_speaker, GNUNET_CONVERSATION_Call::event_handler, GNUNET_CONVERSATION_Call::event_handler_cls, GNUNET_CONVERSATION_call_stop(), GNUNET_CONVERSATION_EC_CALL_ERROR, GNUNET_MQ_destroy(), GNUNET_CONVERSATION_Call::mic, GNUNET_CONVERSATION_Call::mq, GNUNET_CONVERSATION_Call::speaker, and GNUNET_CONVERSATION_Call::state.
Referenced by call_error_handler(), handle_call_audio(), handle_call_hangup(), handle_call_picked_up(), handle_call_resume(), and handle_call_suspend().
|
static |
Process recorded audio data.
cls | closure with the struct GNUNET_CONVERSATION_Call |
data_size | number of bytes in data |
data | audio data to play |
Definition at line 161 of file conversation_api_call.c.
References call, CS_ACTIVE, data, data_size, GNUNET_assert, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_CONVERSATION_Call::mq, and GNUNET_CONVERSATION_Call::state.
Referenced by GNUNET_CONVERSATION_call_resume(), handle_call_picked_up(), and handle_call_resume().
|
static |
We received a GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND.
cls | the struct GNUNET_CONVERSATION_Call |
msg | the message |
Definition at line 188 of file conversation_api_call.c.
References call, GNUNET_MICROPHONE_Handle::cls, GNUNET_SPEAKER_Handle::cls, CS_ACTIVE, CS_LOOKUP, CS_RINGING, CS_SHUTDOWN, CS_SUSPENDED_BOTH, CS_SUSPENDED_CALLEE, CS_SUSPENDED_CALLER, GNUNET_MICROPHONE_Handle::disable_microphone, GNUNET_SPEAKER_Handle::disable_speaker, GNUNET_CONVERSATION_Call::event_handler, GNUNET_CONVERSATION_Call::event_handler_cls, fail_call(), GNUNET_break, GNUNET_break_op, GNUNET_CONVERSATION_call_stop(), GNUNET_CONVERSATION_EC_CALL_SUSPENDED, GNUNET_CONVERSATION_Call::mic, msg, GNUNET_CONVERSATION_Call::speaker, and GNUNET_CONVERSATION_Call::state.
|
static |
We received a GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME.
cls | the struct GNUNET_CONVERSATION_Call |
msg | the message |
Definition at line 239 of file conversation_api_call.c.
References call, GNUNET_MICROPHONE_Handle::cls, GNUNET_SPEAKER_Handle::cls, CS_ACTIVE, CS_LOOKUP, CS_RINGING, CS_SHUTDOWN, CS_SUSPENDED_BOTH, CS_SUSPENDED_CALLEE, CS_SUSPENDED_CALLER, GNUNET_MICROPHONE_Handle::enable_microphone, GNUNET_SPEAKER_Handle::enable_speaker, GNUNET_CONVERSATION_Call::event_handler, GNUNET_CONVERSATION_Call::event_handler_cls, fail_call(), GNUNET_break, GNUNET_break_op, GNUNET_CONVERSATION_call_stop(), GNUNET_CONVERSATION_EC_CALL_RESUMED, GNUNET_CONVERSATION_Call::mic, msg, GNUNET_CONVERSATION_Call::speaker, GNUNET_CONVERSATION_Call::state, and transmit_call_audio().
|
static |
We received a GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP.
cls | the struct GNUNET_CONVERSATION_Call |
msg | the message |
Definition at line 295 of file conversation_api_call.c.
References call, GNUNET_MICROPHONE_Handle::cls, GNUNET_SPEAKER_Handle::cls, CS_ACTIVE, CS_LOOKUP, CS_RINGING, CS_SHUTDOWN, CS_SUSPENDED_BOTH, CS_SUSPENDED_CALLEE, CS_SUSPENDED_CALLER, GNUNET_MICROPHONE_Handle::enable_microphone, GNUNET_SPEAKER_Handle::enable_speaker, GNUNET_CONVERSATION_Call::event_handler, GNUNET_CONVERSATION_Call::event_handler_cls, fail_call(), GNUNET_break, GNUNET_CONVERSATION_call_stop(), GNUNET_CONVERSATION_EC_CALL_PICKED_UP, GNUNET_CONVERSATION_Call::mic, msg, GNUNET_CONVERSATION_Call::speaker, GNUNET_CONVERSATION_Call::state, and transmit_call_audio().
|
static |
We received a #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_HANG_UP.
cls | the struct GNUNET_CONVERSATION_Call |
msg | the message |
Definition at line 340 of file conversation_api_call.c.
References call, CS_ACTIVE, CS_LOOKUP, CS_RINGING, CS_SHUTDOWN, CS_SUSPENDED_BOTH, CS_SUSPENDED_CALLEE, CS_SUSPENDED_CALLER, GNUNET_CONVERSATION_Call::event_handler, GNUNET_CONVERSATION_Call::event_handler_cls, fail_call(), GNUNET_break, GNUNET_CONVERSATION_call_stop(), GNUNET_CONVERSATION_EC_CALL_HUNG_UP, msg, and GNUNET_CONVERSATION_Call::state.
|
static |
We received a struct ClientAudioMessage
, check it is well-formed.
cls | the struct GNUNET_CONVERSATION_Call |
am | the message |
Definition at line 382 of file conversation_api_call.c.
References GNUNET_OK.
|
static |
We received a struct ClientAudioMessage
cls | the struct GNUNET_CONVERSATION_Call |
am | the message |
Definition at line 399 of file conversation_api_call.c.
References call, GNUNET_SPEAKER_Handle::cls, CS_ACTIVE, CS_LOOKUP, CS_RINGING, CS_SHUTDOWN, CS_SUSPENDED_BOTH, CS_SUSPENDED_CALLEE, CS_SUSPENDED_CALLER, fail_call(), GNUNET_break, GNUNET_CONVERSATION_call_stop(), ClientAudioMessage::header, GNUNET_SPEAKER_Handle::play, GNUNET_MessageHeader::size, GNUNET_CONVERSATION_Call::speaker, and GNUNET_CONVERSATION_Call::state.
|
static |
Iterator called on obtained result for a GNS lookup.
cls | closure with the struct GNUNET_CONVERSATION_Call |
was_gns | GNUNET_NO if name was not a GNS name |
rd_count | number of records in rd |
rd | the records in reply |
Definition at line 450 of file conversation_api_call.c.
References call, GNUNET_CONVERSATION_Call::caller_id, CS_LOOKUP, CS_RINGING, GNUNET_GNSRECORD_Data::data, data_size, GNUNET_GNSRECORD_Data::data_size, GNUNET_CONVERSATION_Call::event_handler, GNUNET_CONVERSATION_Call::event_handler_cls, GNUNET_CONVERSATION_Call::gns_lookup, GNUNET_break, GNUNET_break_op, GNUNET_CONVERSATION_call_stop(), GNUNET_CONVERSATION_EC_CALL_GNS_FAIL, GNUNET_CONVERSATION_EC_CALL_RINGING, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_GNSRECORD_TYPE_PHONE, GNUNET_IDENTITY_ego_get_private_key(), GNUNET_memcpy, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), ClientCallMessage::key_len, ClientCallMessage::line_port, GNUNET_CONVERSATION_PhoneRecord::line_port, GNUNET_CONVERSATION_Call::mq, GNUNET_CONVERSATION_PhoneRecord::peer, GNUNET_CONVERSATION_Call::phone_record, rd, rd_count, GNUNET_CONVERSATION_Call::state, and ClientCallMessage::target.
Referenced by GNUNET_CONVERSATION_call_start().
|
static |
We encountered an error talking with the conversation service.
cls | the struct GNUNET_CONVERSATION_Call |
error | details about the error |
Definition at line 508 of file conversation_api_call.c.
References _, call, CS_SHUTDOWN, fail_call(), GNUNET_CONVERSATION_call_stop(), GNUNET_ERROR_TYPE_WARNING, GNUNET_log, and GNUNET_CONVERSATION_Call::state.
Referenced by GNUNET_CONVERSATION_call_start().