465 for (uint32_t i = 0; i <
rd_count; i++)
485 ccm->
key_len = htonl (key_len);
521 "Connection to conversation service lost, trying to reconnect\n"));
struct GNUNET_MQ_MessageHandlers handlers[]
struct GNUNET_MessageHeader * msg
constants for network protocols
static void fail_call(struct GNUNET_CONVERSATION_Call *call)
The call got disconnected, reconnect to the service.
static void handle_call_audio(void *cls, const struct ClientAudioMessage *am)
We received a struct ClientAudioMessage
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_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 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 transmit_call_audio(void *cls, size_t data_size, const void *data)
Process recorded audio data.
CallState
Possible states of the phone.
@ CS_LOOKUP
We still need to lookup the callee.
@ CS_SUSPENDED_CALLEE
The call was suspended by the callee.
@ CS_SHUTDOWN
The call is in termination.
@ CS_SUSPENDED_CALLER
The call was suspended by the caller.
@ CS_SUSPENDED_BOTH
The call was suspended by both caller and callee.
@ CS_ACTIVE
The call is in an active conversation.
@ CS_RINGING
The call is ringing.
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_suspend(void *cls, const struct ClientPhoneSuspendMessage *msg)
We received a GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND.
static void call_error_handler(void *cls, enum GNUNET_MQ_Error error)
We encountered an error talking with the conversation service.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
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 char * data
The data to insert into the dht.
static unsigned int rd_count
Number of records for currently parsed set.
static struct GNUNET_GNSRECORD_Data rd[50]
The record data under a single label.
static size_t data_size
Number of bytes in data.
API to the conversation service.
API that can be used to manipulate GNS record data.
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.
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.
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_CallEventHandler)(void *cls, enum GNUNET_CONVERSATION_CallEventCode code)
Function called with an event emitted for a call.
@ 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.
void GNUNET_GNS_disconnect(struct GNUNET_GNS_Handle *handle)
Shutdown connection with the GNS service.
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 ...
void * GNUNET_GNS_lookup_with_tld_cancel(struct GNUNET_GNS_LookupWithTldRequest *ltr)
Cancel pending lookup request.
struct GNUNET_GNS_Handle * GNUNET_GNS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize the connection with the GNS service.
@ GNUNET_GNS_LO_DEFAULT
Defaults, look in cache, then in DHT.
const struct GNUNET_CRYPTO_PrivateKey * GNUNET_IDENTITY_ego_get_private_key(const struct GNUNET_IDENTITY_Ego *ego)
Obtain the ECC key associated with a ego.
#define GNUNET_log(kind,...)
ssize_t GNUNET_CRYPTO_private_key_get_length(const struct GNUNET_CRYPTO_PrivateKey *key)
Get the compacted length of a GNUNET_CRYPTO_PrivateKey.
ssize_t GNUNET_CRYPTO_write_private_key_to_buffer(const struct GNUNET_CRYPTO_PrivateKey *key, void *buffer, size_t len)
Writes a GNUNET_CRYPTO_PrivateKey to a compact buffer.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_WARNING
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_MQ_Error
Error codes for the queue.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME
Client <-> Server message to resume connection.
#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND
Client <-> Server message to suspend connection.
#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP
Service -> Client message to notify that phone was picked up.
#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP
Client -> Server message to reject/hangup a call.
#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO
Client <-> Server message to send audio data.
#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL
Client <- Server message to indicate a ringing phone.
#define GNUNET_GNSRECORD_TYPE_PHONE
Endpoint for conversation.
Message Client <-> Service to transmit the audio.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO.
Client -> Service message to call a phone.
struct GNUNET_HashCode line_port
Which phone line to call at the peer?
struct GNUNET_PeerIdentity target
Which peer is hosting the line?
uint32_t key_len
The identity key length.
Client <-> Service hang up phone that may or may not be ringing.
Service -> Client: other peer has picked up the phone, we are now talking.
Service <-> Client message for phone was resumed.
Service <-> Client message for phone was suspended.
Handle for an outgoing call.
void * event_handler_cls
Closure for event_handler.
char * callee
Target callee as a GNS address/name.
struct GNUNET_GNS_LookupWithTldRequest * gns_lookup
Active GNS lookup (or NULL).
struct GNUNET_GNS_Handle * gns
Connection to GNS (can be NULL).
struct GNUNET_MICROPHONE_Handle * mic
Our microphone.
enum CallState state
State machine for the call.
struct GNUNET_MQ_Handle * mq
Handle for transmitting to the CONVERSATION service.
struct GNUNET_SPEAKER_Handle * speaker
Our speaker.
struct GNUNET_CONVERSATION_PhoneRecord phone_record
Target phone record, only valid after the lookup is done.
const struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
GNUNET_CONVERSATION_CallEventHandler event_handler
Function to call with events.
struct GNUNET_IDENTITY_Ego * caller_id
Our caller identity.
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.
A private key for an identity as per LSD0001.
const void * data
Binary value stored in the DNS record.
size_t data_size
Number of bytes in data.
Connection to the GNS service.
Handle to a lookup request.
A microphone is a device that can capture or otherwise produce audio data.
void * cls
Closure for the callbacks.
GNUNET_MICROPHONE_DisableCallback disable_microphone
Turn the microphone off.
GNUNET_MICROPHONE_EnableCallback enable_microphone
Turn on the microphone.
Handle to a message queue.
Message handler for a specific message type.
A speaker is a device that can play or record audio data.
void * cls
Closure for the callbacks.
GNUNET_SPEAKER_PlayCallback play
Play audio.
GNUNET_SPEAKER_EnableCallback enable_speaker
Turn on the speaker.
GNUNET_SPEAKER_DisableCallback disable_speaker
Turn the speaker off.