phone and caller API to the conversation service More...
Go to the source code of this file.
Data Structures | |
struct | GNUNET_CONVERSATION_Caller |
A caller is the handle we have for an incoming call. More... | |
struct | GNUNET_CONVERSATION_Phone |
A phone is a device that can ring to signal an incoming call and that you can pick up to answer the call and hang up to terminate the call. More... | |
Enumerations | |
enum | CallerState { CS_RINGING , CS_ACTIVE , CS_CALLEE_SUSPENDED , CS_CALLER_SUSPENDED , CS_BOTH_SUSPENDED } |
Possible states of a caller. More... | |
enum | PhoneState { PS_REGISTER = 0 , PS_READY , PS_LOOKUP_EGO , PS_LISTEN , PS_ACCEPTED , PS_ERROR } |
Possible states of a phone. More... | |
Functions | |
static void | reconnect_phone (struct GNUNET_CONVERSATION_Phone *phone) |
The phone got disconnected, reconnect to the service. More... | |
static void | transmit_phone_audio (void *cls, size_t data_size, const void *data) |
Process recorded audio data. More... | |
static enum GNUNET_GenericReturnValue | check_phone_ring (void *cls, const struct ClientPhoneRingMessage *ring) |
We received a struct ClientPhoneRingMessage More... | |
static void | handle_phone_ring (void *cls, const struct ClientPhoneRingMessage *ring) |
We received a struct ClientPhoneRingMessage More... | |
static struct GNUNET_CONVERSATION_Caller * | find_caller (struct GNUNET_CONVERSATION_Phone *phone, uint32_t cid) |
Find the record of the caller matching the cid. More... | |
static void | handle_phone_hangup (void *cls, const struct ClientPhoneHangupMessage *hang) |
We received a struct ClientPhoneHangupMessage . More... | |
static void | handle_phone_suspend (void *cls, const struct ClientPhoneSuspendMessage *suspend) |
We received a struct ClientPhoneSuspendMessage . More... | |
static void | handle_phone_resume (void *cls, const struct ClientPhoneResumeMessage *resume) |
We received a struct ClientPhoneResumeMessage . More... | |
static int | check_phone_audio (void *cls, const struct ClientAudioMessage *am) |
We received a struct ClientAudioMessage , check it is well-formed. More... | |
static void | handle_phone_audio (void *cls, const struct ClientAudioMessage *am) |
We received a struct ClientAudioMessage More... | |
static void | phone_error_handler (void *cls, enum GNUNET_MQ_Error error) |
We encountered an error talking with the conversation service. More... | |
static void | clean_up_callers (struct GNUNET_CONVERSATION_Phone *phone) |
Clean up all callers of the given phone. More... | |
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. More... | |
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. More... | |
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. More... | |
void | GNUNET_CONVERSATION_caller_hang_up (struct GNUNET_CONVERSATION_Caller *caller) |
Hang up up a (possibly ringing) phone. More... | |
void | GNUNET_CONVERSATION_phone_destroy (struct GNUNET_CONVERSATION_Phone *phone) |
Destroys a phone. More... | |
void | GNUNET_CONVERSATION_caller_suspend (struct GNUNET_CONVERSATION_Caller *caller) |
Pause conversation of an active call. More... | |
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. More... | |
phone and caller API to the conversation service
Definition in file conversation_api.c.
enum CallerState |
Possible states of a caller.
Definition at line 36 of file conversation_api.c.
enum PhoneState |
Possible states of a phone.
Definition at line 125 of file conversation_api.c.
|
static |
The phone got disconnected, reconnect to the service.
phone | phone to reconnect |
Definition at line 588 of file conversation_api.c.
References GNUNET_CONVERSATION_Phone::cfg, clean_up_callers(), GNUNET_CLIENT_connect(), GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_REGISTER, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND, GNUNET_MQ_destroy(), GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg, GNUNET_MQ_send(), handlers, ClientPhoneRegisterMessage::line_port, GNUNET_CONVERSATION_PhoneRecord::line_port, GNUNET_CONVERSATION_Phone::mq, GNUNET_CONVERSATION_Phone::my_record, phone, phone_error_handler(), PS_READY, PS_REGISTER, and GNUNET_CONVERSATION_Phone::state.
Referenced by GNUNET_CONVERSATION_phone_create(), and phone_error_handler().
|
static |
Process recorded audio data.
cls | closure with the struct GNUNET_CONVERSATION_Caller |
data_size | number of bytes in data |
data | audio data to play |
Definition at line 221 of file conversation_api.c.
References ClientAudioMessage::cid, GNUNET_CONVERSATION_Caller::cid, data, data_size, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_CONVERSATION_Phone::mq, GNUNET_CONVERSATION_Caller::phone, and phone.
Referenced by GNUNET_CONVERSATION_caller_pick_up(), GNUNET_CONVERSATION_caller_resume(), and handle_phone_resume().
|
static |
We received a struct ClientPhoneRingMessage
cls | the struct GNUNET_CONVERSATION_Phone |
ring | the message |
Definition at line 248 of file conversation_api.c.
References GNUNET_OK.
|
static |
We received a struct ClientPhoneRingMessage
cls | the struct GNUNET_CONVERSATION_Phone |
ring | the message |
Definition at line 261 of file conversation_api.c.
References GNUNET_CONVERSATION_Phone::caller_head, GNUNET_CONVERSATION_Caller::caller_id, GNUNET_CONVERSATION_Phone::caller_tail, ClientPhoneRingMessage::cid, GNUNET_CONVERSATION_Caller::cid, CS_RINGING, GNUNET_CONVERSATION_Phone::event_handler, GNUNET_CONVERSATION_Phone::event_handler_cls, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_CONVERSATION_EC_PHONE_RING, GNUNET_CRYPTO_read_public_key_from_buffer(), GNUNET_new, GNUNET_SYSERR, ClientPhoneRingMessage::key_len, GNUNET_CONVERSATION_Caller::phone, phone, PS_READY, PS_REGISTER, GNUNET_CONVERSATION_Caller::state, and GNUNET_CONVERSATION_Phone::state.
|
static |
Find the record of the caller matching the cid.
phone | phone to search |
cid | caller ID to search for (in NBO) |
Definition at line 313 of file conversation_api.c.
References GNUNET_CONVERSATION_Phone::caller_head, GNUNET_CONVERSATION_Caller::cid, GNUNET_CONVERSATION_Caller::next, and phone.
Referenced by handle_phone_audio(), handle_phone_hangup(), handle_phone_resume(), and handle_phone_suspend().
|
static |
We received a struct ClientPhoneHangupMessage
.
cls | the struct GNUNET_CONVERSATION_Phone * |
hang | the message |
Definition at line 332 of file conversation_api.c.
References GNUNET_CONVERSATION_Phone::caller_head, GNUNET_CONVERSATION_Caller::caller_id, GNUNET_CONVERSATION_Phone::caller_tail, ClientPhoneHangupMessage::cid, GNUNET_MICROPHONE_Handle::cls, GNUNET_SPEAKER_Handle::cls, CS_ACTIVE, CS_BOTH_SUSPENDED, CS_CALLEE_SUSPENDED, CS_CALLER_SUSPENDED, CS_RINGING, GNUNET_MICROPHONE_Handle::disable_microphone, GNUNET_SPEAKER_Handle::disable_speaker, GNUNET_CONVERSATION_Phone::event_handler, GNUNET_CONVERSATION_Phone::event_handler_cls, find_caller(), GNUNET_CONTAINER_DLL_remove, GNUNET_CONVERSATION_EC_PHONE_HUNG_UP, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_GNSRECORD_pkey_to_zkey(), GNUNET_log, GNUNET_CONVERSATION_Caller::mic, phone, GNUNET_CONVERSATION_Caller::speaker, and GNUNET_CONVERSATION_Caller::state.
|
static |
We received a struct ClientPhoneSuspendMessage
.
cls | the struct GNUNET_CONVERSATION_Phone |
suspend | the message |
Definition at line 392 of file conversation_api.c.
References ClientPhoneSuspendMessage::cid, GNUNET_MICROPHONE_Handle::cls, GNUNET_SPEAKER_Handle::cls, CS_ACTIVE, CS_BOTH_SUSPENDED, CS_CALLEE_SUSPENDED, CS_CALLER_SUSPENDED, CS_RINGING, GNUNET_MICROPHONE_Handle::disable_microphone, GNUNET_SPEAKER_Handle::disable_speaker, GNUNET_CONVERSATION_Caller::event_handler, GNUNET_CONVERSATION_Caller::event_handler_cls, find_caller(), GNUNET_break_op, GNUNET_CONVERSATION_EC_CALLER_SUSPEND, GNUNET_CONVERSATION_Caller::mic, phone, GNUNET_CONVERSATION_Caller::speaker, and GNUNET_CONVERSATION_Caller::state.
|
static |
We received a struct ClientPhoneResumeMessage
.
cls | the struct GNUNET_CONVERSATION_Phone |
resume | the message |
Definition at line 437 of file conversation_api.c.
References ClientPhoneResumeMessage::cid, GNUNET_MICROPHONE_Handle::cls, GNUNET_SPEAKER_Handle::cls, CS_ACTIVE, CS_BOTH_SUSPENDED, CS_CALLEE_SUSPENDED, CS_CALLER_SUSPENDED, CS_RINGING, GNUNET_MICROPHONE_Handle::enable_microphone, GNUNET_SPEAKER_Handle::enable_speaker, GNUNET_CONVERSATION_Caller::event_handler, GNUNET_CONVERSATION_Caller::event_handler_cls, find_caller(), GNUNET_break_op, GNUNET_CONVERSATION_EC_CALLER_RESUME, GNUNET_CONVERSATION_Caller::mic, phone, GNUNET_CONVERSATION_Caller::speaker, GNUNET_CONVERSATION_Caller::state, and transmit_phone_audio().
|
static |
We received a struct ClientAudioMessage
, check it is well-formed.
cls | the struct GNUNET_CONVERSATION_Phone |
am | the message |
Definition at line 485 of file conversation_api.c.
References GNUNET_OK.
|
static |
We received a struct ClientAudioMessage
cls | the struct GNUNET_CONVERSATION_Phone |
am | the message |
Definition at line 503 of file conversation_api.c.
References ClientAudioMessage::cid, GNUNET_SPEAKER_Handle::cls, CS_ACTIVE, CS_BOTH_SUSPENDED, CS_CALLEE_SUSPENDED, CS_CALLER_SUSPENDED, CS_RINGING, find_caller(), GNUNET_break_op, ClientAudioMessage::header, phone, GNUNET_SPEAKER_Handle::play, GNUNET_MessageHeader::size, GNUNET_CONVERSATION_Caller::speaker, and GNUNET_CONVERSATION_Caller::state.
|
static |
We encountered an error talking with the conversation service.
cls | the struct GNUNET_CONVERSATION_Phone |
error | details about the error |
Definition at line 541 of file conversation_api.c.
References _, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, phone, and reconnect_phone().
Referenced by reconnect_phone().
|
static |
Clean up all callers of the given phone.
phone | phone to clean up callers for |
Definition at line 560 of file conversation_api.c.
References GNUNET_CONVERSATION_Phone::caller_head, GNUNET_CONVERSATION_Caller::caller_id, GNUNET_MICROPHONE_Handle::cls, GNUNET_SPEAKER_Handle::cls, CS_ACTIVE, CS_CALLER_SUSPENDED, GNUNET_MICROPHONE_Handle::disable_microphone, GNUNET_SPEAKER_Handle::disable_speaker, GNUNET_CONVERSATION_Phone::event_handler, GNUNET_CONVERSATION_Phone::event_handler_cls, GNUNET_CONVERSATION_caller_hang_up(), GNUNET_CONVERSATION_EC_PHONE_HUNG_UP, GNUNET_CONVERSATION_Caller::mic, phone, GNUNET_CONVERSATION_Caller::speaker, and GNUNET_CONVERSATION_Caller::state.
Referenced by GNUNET_CONVERSATION_phone_destroy(), and reconnect_phone().