One-to-one voice communication over CADET. More...
Data Structures | |
struct | GNUNET_CONVERSATION_PhoneRecord |
A phone record specifies which peer is hosting a given user and may also specify the phone line that is used (typically zero). More... | |
Macros | |
#define | GNUNET_CONVERSATION_VERSION 0x00000004 |
Version of the conversation API. More... | |
Typedefs | |
typedef void(* | GNUNET_CONVERSATION_PhoneEventHandler) (void *cls, enum GNUNET_CONVERSATION_PhoneEventCode code, struct GNUNET_CONVERSATION_Caller *caller, const struct GNUNET_CRYPTO_PublicKey *caller_id) |
Function called with an event emitted by a phone. More... | |
typedef void(* | GNUNET_CONVERSATION_CallerEventHandler) (void *cls, enum GNUNET_CONVERSATION_CallerEventCode code) |
Function called with an event emitted by a caller. More... | |
typedef void(* | GNUNET_CONVERSATION_CallEventHandler) (void *cls, enum GNUNET_CONVERSATION_CallEventCode code) |
Function called with an event emitted for a call. More... | |
Enumerations | |
enum | GNUNET_CONVERSATION_PhoneEventCode { GNUNET_CONVERSATION_EC_PHONE_RING , GNUNET_CONVERSATION_EC_PHONE_HUNG_UP } |
Information about active callers to a phone. More... | |
enum | GNUNET_CONVERSATION_CallerEventCode { GNUNET_CONVERSATION_EC_CALLER_SUSPEND , GNUNET_CONVERSATION_EC_CALLER_RESUME } |
Information about the current status of a call. More... | |
enum | GNUNET_CONVERSATION_CallEventCode { GNUNET_CONVERSATION_EC_CALL_RINGING , GNUNET_CONVERSATION_EC_CALL_PICKED_UP , GNUNET_CONVERSATION_EC_CALL_GNS_FAIL , GNUNET_CONVERSATION_EC_CALL_HUNG_UP , GNUNET_CONVERSATION_EC_CALL_SUSPENDED , GNUNET_CONVERSATION_EC_CALL_RESUMED , GNUNET_CONVERSATION_EC_CALL_ERROR } |
Information about the current status of a call. More... | |
One-to-one voice communication over CADET.
NOTE: This API is deliberately deceptively simple; the idea is that advanced features (such as answering machines) will be done with a separate service (an answering machine service) with its own APIs; the speaker/microphone abstractions are used to facilitate plugging in custom logic for implementing such a service later by creating "software" versions of speakers and microphones that record to disk or play a file. Notifications about missed calls should similarly be done using a separate service; CONVERSATION is supposed to be just the "bare bones" voice service.
As this is supposed to be a "secure" service, caller ID is of course provided as part of the basic implementation, as only the CONVERSATION service can know for sure who it is that we are talking to.
#define GNUNET_CONVERSATION_VERSION 0x00000004 |
Version of the conversation API.
Definition at line 75 of file gnunet_conversation_service.h.
typedef void(* GNUNET_CONVERSATION_PhoneEventHandler) (void *cls, enum GNUNET_CONVERSATION_PhoneEventCode code, struct GNUNET_CONVERSATION_Caller *caller, const struct GNUNET_CRYPTO_PublicKey *caller_id) |
Function called with an event emitted by a phone.
cls | closure |
code | type of the event |
caller | handle for the caller |
caller_id | public key of the caller (in GNS) |
Definition at line 147 of file gnunet_conversation_service.h.
typedef void(* GNUNET_CONVERSATION_CallerEventHandler) (void *cls, enum GNUNET_CONVERSATION_CallerEventCode code) |
Function called with an event emitted by a caller.
These events are only generated after the phone is picked up.
cls | closure |
code | type of the event for this caller |
Definition at line 188 of file gnunet_conversation_service.h.
typedef void(* GNUNET_CONVERSATION_CallEventHandler) (void *cls, enum GNUNET_CONVERSATION_CallEventCode code) |
Function called with an event emitted for a call.
cls | closure |
code | type of the event on the call |
Definition at line 371 of file gnunet_conversation_service.h.
Information about active callers to a phone.
Definition at line 123 of file gnunet_conversation_service.h.
Information about the current status of a call.
Each call progresses from ring over ready to terminated. Steps may be skipped.
Definition at line 162 of file gnunet_conversation_service.h.
Information about the current status of a call.
Enumerator | |
---|---|
GNUNET_CONVERSATION_EC_CALL_RINGING | We are the caller and are now ringing the other party (GNS lookup succeeded). |
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_GNS_FAIL | We are the caller and failed to locate a phone record in GNS. After this invocation, the respective call handle will be automatically destroyed and the client must no longer call GNUNET_CONVERSATION_call_stop or any other function on the call object. |
GNUNET_CONVERSATION_EC_CALL_HUNG_UP | We are the caller and the callee called GNUNET_CONVERSATION_caller_hang_up. After this invocation, the respective call handle will be automatically destroyed and the client must no longer call GNUNET_CONVERSATION_call_stop. |
GNUNET_CONVERSATION_EC_CALL_SUSPENDED | We are the caller and the callee suspended the call. Note that both sides can independently suspend and resume calls; a call is only "working" of both sides are active. |
GNUNET_CONVERSATION_EC_CALL_RESUMED | We are the caller and the callee suspended the call. Note that both sides can independently suspend and resume calls; a call is only "working" of both sides are active. |
GNUNET_CONVERSATION_EC_CALL_ERROR | We had an error handing the call, and are now restarting it (back to lookup). This happens, for example, if the peer is restarted during a call. |
Definition at line 312 of file gnunet_conversation_service.h.
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.
cfg | configuration for the phone; specifies the phone service and which line the phone is to be connected to |
ego | ego to use for name resolution (when determining caller ID) |
event_handler | how to notify the owner of the phone about events |
event_handler_cls | closure for event_handler |
cfg | configuration for the phone; specifies the phone service and which line the phone is to be connected to |
ego | ego to use for name resolution (when determining caller ID) |
event_handler | how to notify the owner of the phone about events |
event_handler_cls | closure for event_handler |
Definition at line 650 of file conversation_api.c.
References cfg, GNUNET_CONVERSATION_Phone::cfg, GNUNET_CONVERSATION_Phone::event_handler, GNUNET_CONVERSATION_Phone::event_handler_cls, GNUNET_break, GNUNET_CONFIGURATION_get_value_string(), GNUNET_CONVERSATION_phone_destroy(), GNUNET_CRYPTO_get_peer_identity(), GNUNET_CRYPTO_hash(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_IDENTITY_ego_get_private_key(), GNUNET_log_config_missing(), GNUNET_NAMESTORE_connect(), GNUNET_new, GNUNET_OK, line, GNUNET_CONVERSATION_PhoneRecord::line_port, GNUNET_CONVERSATION_Phone::mq, GNUNET_CONVERSATION_Phone::my_record, GNUNET_CONVERSATION_Phone::my_zone, GNUNET_CONVERSATION_Phone::ns, GNUNET_CONVERSATION_PhoneRecord::peer, phone, reconnect_phone(), GNUNET_CONVERSATION_PhoneRecord::reserved, and GNUNET_CONVERSATION_PhoneRecord::version.
Referenced by start_phone().
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.
Note that the filled in "data" value is only valid until the phone is destroyed.
phone | phone to create a record for |
rd | namestore record to fill in |
Definition at line 713 of file conversation_api.c.
References GNUNET_GNSRECORD_Data::data, GNUNET_GNSRECORD_Data::data_size, GNUNET_GNSRECORD_Data::expiration_time, GNUNET_GNSRECORD_Data::flags, GNUNET_GNSRECORD_RF_NONE, GNUNET_GNSRECORD_TYPE_PHONE, GNUNET_CONVERSATION_Phone::my_record, phone, rd, and GNUNET_GNSRECORD_Data::record_type.
Referenced by start_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.
This will connect the speaker to the microphone of the other party, and vice versa.
caller | handle that identifies which caller should be answered |
event_handler | how to notify about events by the caller |
event_handler_cls | closure for event_handler |
speaker | speaker to use |
mic | microphone to use |
Picks up a (ringing) phone call.
This will connect the speaker to the microphone of the other party, and vice versa.
caller | handle that identifies which caller should be answered |
event_handler | how to notify about events by the caller |
event_handler_cls | closure for event_handler |
speaker | speaker to use |
mic | microphone to use |
Definition at line 735 of file conversation_api.c.
References ClientPhonePickupMessage::cid, GNUNET_CONVERSATION_Caller::cid, GNUNET_MICROPHONE_Handle::cls, GNUNET_SPEAKER_Handle::cls, CS_ACTIVE, CS_RINGING, GNUNET_MICROPHONE_Handle::enable_microphone, GNUNET_SPEAKER_Handle::enable_speaker, GNUNET_CONVERSATION_Caller::event_handler, GNUNET_CONVERSATION_Caller::event_handler_cls, GNUNET_assert, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICK_UP, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_CONVERSATION_Caller::mic, mic, GNUNET_CONVERSATION_Phone::mq, GNUNET_CONVERSATION_Caller::phone, phone, GNUNET_CONVERSATION_Caller::speaker, speaker, GNUNET_CONVERSATION_Caller::state, and transmit_phone_audio().
Referenced by do_accept().
void GNUNET_CONVERSATION_caller_suspend | ( | struct GNUNET_CONVERSATION_Caller * | caller | ) |
Pause conversation of an active call.
This will disconnect the speaker and the microphone. The call can later be resumed with GNUNET_CONVERSATION_caller_resume.
caller | call to suspend |
Definition at line 830 of file conversation_api.c.
References ClientPhoneSuspendMessage::cid, GNUNET_CONVERSATION_Caller::cid, GNUNET_MICROPHONE_Handle::cls, GNUNET_SPEAKER_Handle::cls, CS_ACTIVE, CS_BOTH_SUSPENDED, CS_CALLEE_SUSPENDED, CS_CALLER_SUSPENDED, GNUNET_MICROPHONE_Handle::disable_microphone, GNUNET_SPEAKER_Handle::disable_speaker, GNUNET_assert, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_CONVERSATION_Caller::mic, GNUNET_CONVERSATION_Phone::mq, GNUNET_CONVERSATION_Caller::phone, phone, GNUNET_CONVERSATION_Caller::speaker, and GNUNET_CONVERSATION_Caller::state.
Referenced by do_suspend().
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.
caller | call to resume |
speaker | speaker to use |
mic | microphone to use |
Definition at line 865 of file conversation_api.c.
References ClientPhoneResumeMessage::cid, GNUNET_CONVERSATION_Caller::cid, GNUNET_MICROPHONE_Handle::cls, GNUNET_SPEAKER_Handle::cls, CS_ACTIVE, CS_BOTH_SUSPENDED, CS_CALLEE_SUSPENDED, CS_CALLER_SUSPENDED, GNUNET_MICROPHONE_Handle::enable_microphone, GNUNET_SPEAKER_Handle::enable_speaker, GNUNET_assert, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_CONVERSATION_Caller::mic, mic, GNUNET_CONVERSATION_Phone::mq, GNUNET_CONVERSATION_Caller::phone, phone, GNUNET_CONVERSATION_Caller::speaker, speaker, GNUNET_CONVERSATION_Caller::state, and transmit_phone_audio().
Referenced by do_resume().
void GNUNET_CONVERSATION_caller_hang_up | ( | struct GNUNET_CONVERSATION_Caller * | caller | ) |
Hang up up a (possibly ringing or paused) phone.
This will notify the caller that we are no longer interested in talking with them.
caller | who should we hang up on |
Hang up up a (possibly ringing or paused) phone.
This will notify the other party that we are no longer interested in talking with them.
caller | conversation to hang up on |
Definition at line 771 of file conversation_api.c.
References GNUNET_CONVERSATION_Phone::caller_head, GNUNET_CONVERSATION_Phone::caller_tail, ClientPhoneHangupMessage::cid, GNUNET_CONVERSATION_Caller::cid, GNUNET_MICROPHONE_Handle::cls, GNUNET_SPEAKER_Handle::cls, CS_ACTIVE, GNUNET_MICROPHONE_Handle::disable_microphone, GNUNET_SPEAKER_Handle::disable_speaker, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_CONVERSATION_Caller::mic, GNUNET_CONVERSATION_Phone::mq, GNUNET_CONVERSATION_Caller::phone, phone, GNUNET_CONVERSATION_Caller::speaker, and GNUNET_CONVERSATION_Caller::state.
Referenced by clean_up_callers(), and do_reject().
void GNUNET_CONVERSATION_phone_destroy | ( | struct GNUNET_CONVERSATION_Phone * | phone | ) |
Destroys a phone.
phone | phone to destroy |
Definition at line 805 of file conversation_api.c.
References clean_up_callers(), GNUNET_free, GNUNET_MQ_destroy(), GNUNET_NAMESTORE_disconnect(), GNUNET_CONVERSATION_Phone::mq, GNUNET_CONVERSATION_Phone::ns, and phone.
Referenced by do_stop_task(), and GNUNET_CONVERSATION_phone_create().
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.
cfg | configuration to use, specifies our phone service |
caller_id | identity of the caller |
callee | GNS name of the callee (used to locate the callee's record) |
speaker | speaker to use (will be used automatically immediately once the GNUNET_CONVERSATION_EC_CALL_PICKED_UP event is generated); we will NOT generate a ring tone on the speaker |
mic | microphone to use (will be used automatically immediately once the GNUNET_CONVERSATION_EC_CALL_PICKED_UP event is generated) |
event_handler | how to notify the owner of the phone about events |
event_handler_cls | closure for event_handler |
cfg | configuration to use, specifies our phone service |
caller_id | identity of the caller |
callee | GNS name of the callee (used to locate the callee's record) |
speaker | speaker to use (will be used automatically immediately once the GNUNET_CONVERSATION_EC_CALL_PICKED_UP event is generated); we will NOT generate a ring tone on the speaker |
mic | microphone to use (will be used automatically immediately once the GNUNET_CONVERSATION_EC_CALL_PICKED_UP event is generated) |
event_handler | how to notify the owner of the phone about events |
event_handler_cls | closure for event_handler |
Definition at line 567 of file conversation_api_call.c.
References call, call_error_handler(), GNUNET_CONVERSATION_Call::callee, GNUNET_CONVERSATION_Call::caller_id, cfg, GNUNET_CONVERSATION_Call::cfg, CS_LOOKUP, GNUNET_CONVERSATION_Call::event_handler, GNUNET_CONVERSATION_Call::event_handler_cls, GNUNET_CONVERSATION_Call::gns, GNUNET_CONVERSATION_Call::gns_lookup, GNUNET_break, GNUNET_CLIENT_connect(), GNUNET_CONVERSATION_call_stop(), GNUNET_free, GNUNET_GNS_connect(), GNUNET_GNS_LO_DEFAULT, GNUNET_GNS_lookup_with_tld(), GNUNET_GNSRECORD_TYPE_PHONE, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_new, GNUNET_strdup, handle_gns_response(), handlers, GNUNET_CONVERSATION_Call::mic, mic, GNUNET_CONVERSATION_Call::mq, GNUNET_CONVERSATION_Call::speaker, speaker, and GNUNET_CONVERSATION_Call::state.
Referenced by do_call().
void GNUNET_CONVERSATION_call_suspend | ( | struct GNUNET_CONVERSATION_Call * | call | ) |
Pause a call.
Temporarily suspends the use of speaker and microphone.
call | call to pause |
Definition at line 687 of file conversation_api_call.c.
References call, GNUNET_MICROPHONE_Handle::cls, GNUNET_SPEAKER_Handle::cls, CS_ACTIVE, CS_SUSPENDED_BOTH, CS_SUSPENDED_CALLEE, CS_SUSPENDED_CALLER, GNUNET_MICROPHONE_Handle::disable_microphone, GNUNET_SPEAKER_Handle::disable_speaker, GNUNET_assert, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_CONVERSATION_Call::mic, GNUNET_CONVERSATION_Call::mq, GNUNET_CONVERSATION_Call::speaker, and GNUNET_CONVERSATION_Call::state.
Referenced by do_suspend().
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 | call to resume |
speaker | speaker to use |
mic | microphone to use |
call | call to resume |
speaker | speaker to use a ring tone on the speaker |
mic | microphone to use |
Definition at line 721 of file conversation_api_call.c.
References call, GNUNET_MICROPHONE_Handle::cls, GNUNET_SPEAKER_Handle::cls, CS_ACTIVE, CS_SUSPENDED_BOTH, CS_SUSPENDED_CALLEE, CS_SUSPENDED_CALLER, GNUNET_MICROPHONE_Handle::enable_microphone, GNUNET_SPEAKER_Handle::enable_speaker, GNUNET_assert, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_CONVERSATION_Call::mic, mic, GNUNET_CONVERSATION_Call::mq, GNUNET_CONVERSATION_Call::speaker, speaker, GNUNET_CONVERSATION_Call::state, and transmit_call_audio().
Referenced by do_resume().
void GNUNET_CONVERSATION_call_stop | ( | struct GNUNET_CONVERSATION_Call * | call | ) |
Terminate a call.
The call may be ringing or ready at this time.
call | call to terminate |
Definition at line 648 of file conversation_api_call.c.
References call, GNUNET_CONVERSATION_Call::callee, 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::gns, GNUNET_CONVERSATION_Call::gns_lookup, GNUNET_free, GNUNET_GNS_disconnect(), GNUNET_GNS_lookup_with_tld_cancel(), 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(), do_reject(), do_stop_task(), fail_call(), GNUNET_CONVERSATION_call_start(), handle_call_audio(), handle_call_hangup(), handle_call_picked_up(), handle_call_resume(), handle_call_suspend(), and handle_gns_response().