GNUnet 0.22.2
gnunet-conversation.c File Reference

conversation implementation More...

Include dependency graph for gnunet-conversation.c:

Go to the source code of this file.

Data Structures

struct  CallList
 List of incoming calls. More...
 
struct  VoipCommand
 Structure which defines a command. More...
 

Macros

#define MAX_MESSAGE_LENGTH   1024
 Maximum length allowed for the command line input. More...
 
#define XSTRINGIFY(x)   STRINGIFY (x)
 
#define STRINGIFY(x)   (#x)
 

Typedefs

typedef void(* ActionFunction) (const char *arguments)
 Function declareation for executing a action. More...
 

Enumerations

enum  PhoneState {
  PS_REGISTER = 0 , PS_READY , PS_LOOKUP_EGO , PS_LISTEN ,
  PS_ACCEPTED , PS_ERROR
}
 Possible states of the phone. More...
 
enum  CallState {
  CS_LOOKUP = 0 , CS_RINGING , CS_ACTIVE , CS_SHUTDOWN ,
  CS_SUSPENDED_CALLER , CS_SUSPENDED_CALLEE , CS_SUSPENDED_BOTH , CS_RESOLVING ,
  CS_RINGING , CS_CONNECTED , CS_SUSPENDED
}
 States for current outgoing call. More...
 

Functions

static void phone_event_handler (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...
 
static void caller_event_handler (void *cls, enum GNUNET_CONVERSATION_CallerEventCode code)
 Function called with an event emitted by a caller. More...
 
static void start_phone ()
 Start our phone. More...
 
static void call_event_handler (void *cls, enum GNUNET_CONVERSATION_CallEventCode code)
 Function called with an event emitted by a call. More...
 
static void do_help (const char *args)
 Action function to print help for the command shell. More...
 
static void do_quit (const char *args)
 Terminate the client. More...
 
static void do_unknown (const char *msg)
 Handler for unknown command. More...
 
static void do_call (const char *arg)
 Initiating a new call. More...
 
static void do_accept (const char *args)
 Accepting an incoming call. More...
 
static void do_address (const char *args)
 Print address information for this phone. More...
 
static void do_status (const char *args)
 Accepting an incoming call. More...
 
static void do_suspend (const char *args)
 Suspending a call. More...
 
static void do_resume (const char *args)
 Resuming a call. More...
 
static void do_reject (const char *args)
 Rejecting a call. More...
 
static void do_stop_task (void *cls)
 Task run during shutdown. More...
 
static void handle_command_string (char *message, size_t str_len)
 Handle user command. More...
 
static void handle_command (void *cls)
 Task to handle commands from the terminal. More...
 
static void identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name)
 Function called by identity service with information about egos. More...
 
static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
 Main function that will be run by the scheduler. More...
 
int main (int argc, char *const *argv)
 The main function to conversation. More...
 

Variables

static struct GNUNET_CONVERSATION_Phonephone
 Phone handle. More...
 
static struct GNUNET_CONVERSATION_Callcall
 Call handle (for active outgoing call). More...
 
static struct CallListcl_active
 Caller handle (for active incoming call). More...
 
static struct CallListcl_head
 Head of calls waiting to be accepted. More...
 
static struct CallListcl_tail
 Tail of calls waiting to be accepted. More...
 
static char * line
 Desired phone line (string to be converted to a hash). More...
 
static struct GNUNET_SCHEDULER_Taskhandle_cmd_task
 Task which handles the commands. More...
 
static struct GNUNET_SPEAKER_Handlespeaker
 Our speaker. More...
 
static struct GNUNET_MICROPHONE_Handlemic
 Our microphone. More...
 
static struct GNUNET_CONFIGURATION_Handlecfg
 Our configuration. More...
 
static struct GNUNET_IDENTITY_Egomy_caller_id
 Our ego. More...
 
static struct GNUNET_IDENTITY_Handleid
 Handle to identity service. More...
 
static char * ego_name
 Name of our ego. More...
 
static struct GNUNET_CRYPTO_PublicKey peer_key
 Public key of active conversation partner (if any). More...
 
static char * peer_name
 Name of active conversation partner (if any). More...
 
static struct GNUNET_DISK_FileHandlestdin_fh
 File handle for stdin. More...
 
static enum PhoneState phone_state
 Our phone's current state. More...
 
static enum CallState call_state
 Our call's current state. More...
 
static unsigned int caller_num_gen
 Counts the number of incoming calls we have had so far. More...
 
static char * address
 GNS address for this phone. More...
 
static int verbose
 Be verbose. More...
 
static struct VoipCommand commands []
 List of supported commands. More...
 

Detailed Description

conversation implementation

Author
Simon Dieterle
Andreas Fuchs

Definition in file gnunet-conversation.c.

Macro Definition Documentation

◆ MAX_MESSAGE_LENGTH

#define MAX_MESSAGE_LENGTH   1024

Maximum length allowed for the command line input.

Definition at line 34 of file gnunet-conversation.c.

◆ XSTRINGIFY

#define XSTRINGIFY (   x)    STRINGIFY (x)

Definition at line 36 of file gnunet-conversation.c.

◆ STRINGIFY

#define STRINGIFY (   x)    (#x)

Definition at line 38 of file gnunet-conversation.c.

Typedef Documentation

◆ ActionFunction

typedef void(* ActionFunction) (const char *arguments)

Function declareation for executing a action.

Parameters
argumentsarguments given to the function

Definition at line 444 of file gnunet-conversation.c.

Enumeration Type Documentation

◆ PhoneState

enum PhoneState

Possible states of the phone.

Enumerator
PS_REGISTER 

We still need to register the phone.

PS_READY 

We are waiting for calls.

PS_LOOKUP_EGO 

We're waiting for our own idenitty.

PS_LISTEN 

We're listening for calls.

PS_ACCEPTED 

We accepted an incoming phone call.

PS_ERROR 

Internal error.

Definition at line 43 of file gnunet-conversation.c.

44{
49
54
59
64};
@ PS_ERROR
Internal error.
@ PS_ACCEPTED
We accepted an incoming phone call.
@ PS_LOOKUP_EGO
We're waiting for our own idenitty.
@ PS_LISTEN
We're listening for calls.

◆ CallState

enum CallState

States for current outgoing call.

Enumerator
CS_LOOKUP 

We still need to lookup the callee.

CS_RINGING 

The call is ringing.

CS_ACTIVE 

The call is in an active conversation.

CS_SHUTDOWN 

The call is in termination.

CS_SUSPENDED_CALLER 

The call was suspended by the caller.

CS_SUSPENDED_CALLEE 

The call was suspended by the callee.

CS_SUSPENDED_BOTH 

The call was suspended by both caller and callee.

CS_RESOLVING 

We are looking up some other participant.

CS_RINGING 

We are now ringing the other participant.

CS_CONNECTED 

The other party accepted our call and we are now connected.

CS_SUSPENDED 

The call is currently suspended (by us).

Definition at line 70 of file gnunet-conversation.c.

71{
76
81
86
91};
@ CS_SUSPENDED
The call is currently suspended (by us).
@ CS_CONNECTED
The other party accepted our call and we are now connected.
@ CS_RESOLVING
We are looking up some other participant.
@ CS_RINGING
We are now ringing the other participant.

Function Documentation

◆ phone_event_handler()

static void phone_event_handler ( void *  cls,
enum GNUNET_CONVERSATION_PhoneEventCode  code,
struct GNUNET_CONVERSATION_Caller caller,
const struct GNUNET_CRYPTO_PublicKey caller_id 
)
static

Function called with an event emitted by a phone.

Parameters
clsclosure
codetype of the event
callerhandle for the caller
caller_idpublic key of the caller (in GNS)

Definition at line 242 of file gnunet-conversation.c.

246{
247 struct CallList *cl;
248
249 (void) cls;
250 switch (code)
251 {
253 /*
254 * FIXME: we should be playing our ringtones from contrib/sounds now!
255 *
256 ring_my_bell();
257 *
258 * see https://gstreamer.freedesktop.org/documentation/application-development/highlevel/playback-components.html on how to play a wav using the gst framework being used here
259 */fprintf (
260 stdout,
261 _ (
262 "Incoming call from `%s'. Please /accept %u or /cancel %u the call.\n"),
266 cl = GNUNET_new (struct CallList);
267 cl->caller = caller;
268 cl->caller_id = *caller_id;
271 break;
272
274 for (cl = cl_head; NULL != cl; cl = cl->next)
275 if (caller == cl->caller)
276 break;
277 if ((NULL == cl) && (caller == cl_active->caller))
278 cl = cl_active;
279 if (NULL == cl)
280 {
281 GNUNET_break (0);
282 return;
283 }
284 fprintf (stdout,
285 _ ("Call from `%s' terminated\n"),
287 if (cl == cl_active)
288 {
289 cl_active = NULL;
291 }
292 else
293 {
295 }
296 GNUNET_free (cl);
297 break;
298 }
299}
static struct CallList * cl_active
Caller handle (for active incoming call).
static unsigned int caller_num_gen
Counts the number of incoming calls we have had so far.
static enum PhoneState phone_state
Our phone's current state.
static struct CallList * cl_tail
Tail of calls waiting to be accepted.
static struct CallList * cl_head
Head of calls waiting to be accepted.
@ GNUNET_CONVERSATION_EC_PHONE_HUNG_UP
The conversation was terminated by the caller.
@ GNUNET_CONVERSATION_EC_PHONE_RING
We are the callee and the phone is ringing.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
const char * GNUNET_GNSRECORD_pkey_to_zkey(const struct GNUNET_CRYPTO_PublicKey *pkey)
Convert public key to the respective absolute domain name in the ".zkey" pTLD.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
#define _(String)
GNU gettext support macro.
Definition: platform.h:178
List of incoming calls.
unsigned int caller_num
Unique number of the call.
struct GNUNET_CRYPTO_PublicKey caller_id
Public key identifying the caller.
struct CallList * next
A DLL.
struct GNUNET_CONVERSATION_Caller * caller
Handle to hang up or activate.

References _, CallList::caller, CallList::caller_id, CallList::caller_num, caller_num_gen, cl_active, cl_head, cl_tail, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_DLL_remove, GNUNET_CONVERSATION_EC_PHONE_HUNG_UP, GNUNET_CONVERSATION_EC_PHONE_RING, GNUNET_free, GNUNET_GNSRECORD_pkey_to_zkey(), GNUNET_new, CallList::next, phone_state, and PS_LISTEN.

Referenced by start_phone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ caller_event_handler()

static void caller_event_handler ( void *  cls,
enum GNUNET_CONVERSATION_CallerEventCode  code 
)
static

Function called with an event emitted by a caller.

Parameters
clsclosure with the struct CallList of the caller
codetype of the event issued by the caller

Definition at line 309 of file gnunet-conversation.c.

310{
311 struct CallList *cl = cls;
312
313 switch (code)
314 {
316 fprintf (stdout,
317 _ ("Call from `%s' suspended by other user\n"),
319 break;
320
322 fprintf (stdout,
323 _ ("Call from `%s' resumed by other user\n"),
325 break;
326 }
327}
@ GNUNET_CONVERSATION_EC_CALLER_RESUME
We are the callee and the caller resumed the call.
@ GNUNET_CONVERSATION_EC_CALLER_SUSPEND
We are the callee and the caller suspended the call.

References _, CallList::caller_id, GNUNET_CONVERSATION_EC_CALLER_RESUME, GNUNET_CONVERSATION_EC_CALLER_SUSPEND, and GNUNET_GNSRECORD_pkey_to_zkey().

Referenced by do_accept().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ start_phone()

static void start_phone ( )
static

Start our phone.

Definition at line 334 of file gnunet-conversation.c.

335{
337
338 if (NULL == my_caller_id)
339 {
340 fprintf (stderr,
341 _ ("Ego `%s' no longer available, phone is now down.\n"),
342 ego_name);
344 return;
345 }
346 GNUNET_assert (NULL == phone);
350 NULL);
351 /* FIXME: get record and print full GNS record info later here... */
352 if (NULL == phone)
353 {
354 fprintf (stderr, "%s", _ ("Failed to setup phone (internal error)\n"));
356 }
357 else
358 {
361 address =
363 fprintf (
364 stdout,
365 _ (
366 "Phone active at `%s'. Type `/help' for a list of available commands\n"),
367 address);
369 }
370}
static struct GNUNET_IDENTITY_Ego * my_caller_id
Our ego.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
static char * ego_name
Name of our ego.
static char * address
GNS address for this phone.
static void phone_event_handler(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.
static struct GNUNET_CONVERSATION_Phone * phone
Phone handle.
static struct GNUNET_GNSRECORD_Data rd[50]
The record data under a single label.
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.
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.
char * GNUNET_GNSRECORD_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the binary value data of a record of type type to a human-readable string.
Definition: gnsrecord.c:147
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
uint32_t record_type
Type of the GNS/DNS record.
const void * data
Binary value stored in the DNS record.
size_t data_size
Number of bytes in data.

References _, address, cfg, GNUNET_GNSRECORD_Data::data, GNUNET_GNSRECORD_Data::data_size, ego_name, GNUNET_assert, GNUNET_CONVERSATION_phone_create(), GNUNET_CONVERSATION_phone_get_record(), GNUNET_free, GNUNET_GNSRECORD_value_to_string(), my_caller_id, phone, phone_event_handler(), phone_state, PS_ERROR, PS_LISTEN, PS_LOOKUP_EGO, rd, and GNUNET_GNSRECORD_Data::record_type.

Referenced by identity_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ call_event_handler()

static void call_event_handler ( void *  cls,
enum GNUNET_CONVERSATION_CallEventCode  code 
)
static

Function called with an event emitted by a call.

Parameters
clsclosure, NULL
codetype of the event on the call

Definition at line 380 of file gnunet-conversation.c.

381{
382 (void) cls;
383
384 switch (code)
385 {
388 fprintf (stdout,
389 _ ("Resolved address of `%s'. Now ringing other party.\n"),
390 peer_name);
392 break;
393
396 fprintf (stdout, _ ("Connection established to `%s'\n"), peer_name);
398 break;
399
402 fprintf (stdout, _ ("Failed to resolve `%s'\n"), peer_name);
404 peer_name = NULL;
405 call = NULL;
406 break;
407
409 fprintf (stdout, _ ("Call to `%s' terminated\n"), peer_name);
411 peer_name = NULL;
412 call = NULL;
413 break;
414
417 fprintf (stdout,
418 _ ("Connection to `%s' suspended (by other user)\n"),
419 peer_name);
420 break;
421
424 fprintf (stdout,
425 _ ("Connection to `%s' resumed (by other user)\n"),
426 peer_name);
427 break;
428
430 fprintf (stdout, _ ("Error with the call, restarting it\n"));
432 peer_name = NULL;
433 call = NULL;
434 break;
435 }
436}
static struct GNUNET_CONVERSATION_Call * call
Call handle (for active outgoing call).
static enum CallState call_state
Our call's current state.
static char * peer_name
Name of active conversation partner (if any).
@ 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.

References _, call, call_state, CS_CONNECTED, CS_RESOLVING, CS_RINGING, GNUNET_break, GNUNET_CONVERSATION_EC_CALL_ERROR, GNUNET_CONVERSATION_EC_CALL_GNS_FAIL, GNUNET_CONVERSATION_EC_CALL_HUNG_UP, GNUNET_CONVERSATION_EC_CALL_PICKED_UP, GNUNET_CONVERSATION_EC_CALL_RESUMED, GNUNET_CONVERSATION_EC_CALL_RINGING, GNUNET_CONVERSATION_EC_CALL_SUSPENDED, GNUNET_free, and peer_name.

Referenced by do_call().

Here is the caller graph for this function:

◆ do_help()

static void do_help ( const char *  args)
static

Action function to print help for the command shell.

Parameters
argsarguments given to the command

Definition at line 974 of file gnunet-conversation.c.

975{
976 unsigned int i;
977
978 i = 0;
979 while ((NULL != args) && (0 != strlen (args)) &&
980 (commands[i].Action != &do_help))
981 {
982 if (0 == strncasecmp (&args[1], &commands[i].command[1], strlen (args) - 1))
983 {
984 fprintf (stdout, "%s\n", gettext (commands[i].helptext));
985 return;
986 }
987 i++;
988 }
989 i = 0;
990 fprintf (stdout, "%s", "Available commands:\n");
991 while (commands[i].Action != &do_help)
992 {
993 fprintf (stdout, "%s\n", gettext (commands[i].command));
994 i++;
995 }
996 fprintf (stdout, "%s", "\n");
997 fprintf (stdout, "%s\n", gettext (commands[i].helptext));
998}
#define gettext(Msgid)
Definition: gettext.h:50
static void do_help(const char *args)
Action function to print help for the command shell.
static struct VoipCommand commands[]
List of supported commands.

References VoipCommand::Action, consensus-simulation::args, VoipCommand::command, commands, do_help(), gettext, and VoipCommand::helptext.

Referenced by do_call(), and do_help().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_quit()

static void do_quit ( const char *  args)
static

Terminate the client.

Parameters
argsarguments given to the command

Definition at line 484 of file gnunet-conversation.c.

485{
486 (void) args;
488}
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:567

References consensus-simulation::args, and GNUNET_SCHEDULER_shutdown().

Here is the call graph for this function:

◆ do_unknown()

static void do_unknown ( const char *  msg)
static

Handler for unknown command.

Parameters
msgarguments given to the command

Definition at line 497 of file gnunet-conversation.c.

498{
499 fprintf (stderr, _ ("Unknown command `%s'\n"), msg);
500}
struct GNUNET_MessageHeader * msg
Definition: 005.c:2

References _, and msg.

◆ do_call()

static void do_call ( const char *  arg)
static

Initiating a new call.

Parameters
argarguments given to the command

Definition at line 509 of file gnunet-conversation.c.

510{
511 if (NULL == my_caller_id)
512 {
513 fprintf (stderr, _ ("Ego `%s' not available\n"), ego_name);
514 return;
515 }
516 if (NULL != call)
517 {
518 fprintf (stderr,
519 _ ("You are calling someone else already, hang up first!\n"));
520 return;
521 }
522 switch (phone_state)
523 {
524 case PS_LOOKUP_EGO:
525 fprintf (stderr, _ ("Ego `%s' not available\n"), ego_name);
526 return;
527
528 case PS_LISTEN:
529 /* ok to call! */
530 break;
531
532 case PS_ACCEPTED:
533 fprintf (
534 stderr,
535 _ (
536 "You are answering call from `%s', hang up or suspend that call first!\n"),
538 return;
539
540 case PS_ERROR:
541 /* ok to call */
542 break;
543 }
544 if (NULL == arg)
545 {
546 fprintf (stderr, _ ("Call recipient missing.\n"));
547 do_help ("/call");
548 return;
549 }
552 GNUNET_assert (NULL == call);
555 arg,
556 speaker,
557 mic,
559 NULL);
560}
static struct GNUNET_CRYPTO_PublicKey peer_key
Public key of active conversation partner (if any).
static struct GNUNET_MICROPHONE_Handle * mic
Our microphone.
static void call_event_handler(void *cls, enum GNUNET_CONVERSATION_CallEventCode code)
Function called with an event emitted by a call.
static struct GNUNET_SPEAKER_Handle * speaker
Our speaker.
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.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.

References _, find_typedefs::arg, call, call_event_handler(), call_state, cfg, CS_RESOLVING, do_help(), ego_name, GNUNET_assert, GNUNET_CONVERSATION_call_start(), GNUNET_GNSRECORD_pkey_to_zkey(), GNUNET_strdup, mic, my_caller_id, peer_key, peer_name, phone_state, PS_ACCEPTED, PS_ERROR, PS_LISTEN, PS_LOOKUP_EGO, and speaker.

Here is the call graph for this function:

◆ do_accept()

static void do_accept ( const char *  args)
static

Accepting an incoming call.

Parameters
argsarguments given to the command

Definition at line 569 of file gnunet-conversation.c.

570{
571 struct CallList *cl;
572 char buf[32];
573
574 if ((NULL != call) && (CS_SUSPENDED != call_state))
575 {
576 fprintf (stderr,
577 _ ("You are calling someone else already, hang up first!\n"));
578 return;
579 }
580 switch (phone_state)
581 {
582 case PS_LOOKUP_EGO:
583 GNUNET_break (0);
584 break;
585
586 case PS_LISTEN:
587 /* this is the expected state */
588 break;
589
590 case PS_ACCEPTED:
591 fprintf (
592 stderr,
593 _ (
594 "You are answering call from `%s', hang up or suspend that call first!\n"),
596 return;
597
598 case PS_ERROR:
599 GNUNET_break (0);
600 break;
601 }
602 cl = cl_head;
603 if (NULL == cl)
604 {
605 fprintf (stderr, _ ("There is no incoming call to accept here!\n"));
606 return;
607 }
608 if ((NULL != cl->next) || (NULL != args))
609 {
610 for (cl = cl_head; NULL != cl; cl = cl->next)
611 {
612 GNUNET_snprintf (buf, sizeof(buf), "%u", cl->caller_num);
613 if (0 == strcmp (buf, args))
614 break;
615 }
616 }
617 if (NULL == cl)
618 {
619 fprintf (stderr,
620 _ ("There is no incoming call `%s' to accept right now!\n"),
621 args);
622 return;
623 }
625 cl_active = cl;
626 peer_key = cl->caller_id;
630 cl,
631 speaker,
632 mic);
633}
static void caller_event_handler(void *cls, enum GNUNET_CONVERSATION_CallerEventCode code)
Function called with an event emitted by a caller.
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.
int GNUNET_snprintf(char *buf, size_t size, const char *format,...) __attribute__((format(printf
Like snprintf, just aborts if the buffer is of insufficient size.

References _, consensus-simulation::args, call, call_state, CallList::caller, caller_event_handler(), CallList::caller_id, CallList::caller_num, cl_active, cl_head, cl_tail, CS_SUSPENDED, GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_CONVERSATION_caller_pick_up(), GNUNET_GNSRECORD_pkey_to_zkey(), GNUNET_snprintf(), mic, CallList::next, peer_key, phone_state, PS_ACCEPTED, PS_ERROR, PS_LISTEN, PS_LOOKUP_EGO, and speaker.

Here is the call graph for this function:

◆ do_address()

static void do_address ( const char *  args)
static

Print address information for this phone.

Parameters
argsarguments given to the command

Definition at line 642 of file gnunet-conversation.c.

643{
644 (void) args;
645 if (NULL == address)
646 {
647 fprintf (stdout, "%s", _ ("We currently do not have an address.\n"));
648 return;
649 }
650 fprintf (stdout, "%s\n", address);
651}

References _, address, and consensus-simulation::args.

◆ do_status()

static void do_status ( const char *  args)
static

Accepting an incoming call.

Parameters
argsarguments given to the command

Definition at line 660 of file gnunet-conversation.c.

661{
662 struct CallList *cl;
663
664 (void) args;
665 switch (phone_state)
666 {
667 case PS_LOOKUP_EGO:
668 fprintf (
669 stdout,
670 _ (
671 "We are currently trying to locate the private key for the ego `%s'.\n"),
672 ego_name);
673 break;
674
675 case PS_LISTEN:
676 fprintf (stdout,
677 _ (
678 "We are listening for incoming calls for ego `%s' on line `%s'.\n"),
679 ego_name,
680 line);
681 break;
682
683 case PS_ACCEPTED:
684 fprintf (stdout,
685 _ ("You are having a conversation with `%s'.\n"),
687 ;
688 break;
689
690 case PS_ERROR:
691 fprintf (
692 stdout,
693 _ (
694 "We had an internal error setting up our phone line. You can still make calls.\n"));
695 break;
696 }
697 if (NULL != call)
698 {
699 switch (call_state)
700 {
701 case CS_RESOLVING:
702 fprintf (stdout,
703 _ ("We are trying to find the network address to call `%s'.\n"),
704 peer_name);
705 break;
706
707 case CS_RINGING:
708 fprintf (stdout,
709 _ ("We are calling `%s', their phone should be ringing.\n"),
710 peer_name);
711 break;
712
713 case CS_CONNECTED:
714 fprintf (stdout,
715 _ ("You are having a conversation with `%s'.\n"),
716 peer_name);
717 break;
718
719 case CS_SUSPENDED:
720 /* ok to accept incoming call right now */
721 break;
722 }
723 }
724 if ((NULL != cl_head) && ((cl_head != cl_active) || (cl_head != cl_tail)))
725 {
726 fprintf (stdout, "%s", _ ("Calls waiting:\n"));
727 for (cl = cl_head; NULL != cl; cl = cl->next)
728 {
729 if (cl == cl_active)
730 continue;
731 fprintf (stdout,
732 _ ("#%u: `%s'\n"),
733 cl->caller_num,
735 }
736 fprintf (stdout, "%s", "\n");
737 }
738}
static char * line
Desired phone line (string to be converted to a hash).

References _, consensus-simulation::args, call, call_state, CallList::caller_id, CallList::caller_num, cl_active, cl_head, cl_tail, CS_CONNECTED, CS_RESOLVING, CS_RINGING, CS_SUSPENDED, ego_name, GNUNET_GNSRECORD_pkey_to_zkey(), line, CallList::next, peer_key, peer_name, phone_state, PS_ACCEPTED, PS_ERROR, PS_LISTEN, and PS_LOOKUP_EGO.

Here is the call graph for this function:

◆ do_suspend()

static void do_suspend ( const char *  args)
static

Suspending a call.

Parameters
argsarguments given to the command

Definition at line 747 of file gnunet-conversation.c.

748{
749 (void) args;
750 if (NULL != call)
751 {
752 switch (call_state)
753 {
754 case CS_RESOLVING:
755 case CS_RINGING:
756 case CS_SUSPENDED:
757 fprintf (stderr,
758 "%s",
759 _ ("There is no call that could be suspended right now.\n"));
760 return;
761
762 case CS_CONNECTED:
765 return;
766 }
767 }
768 switch (phone_state)
769 {
770 case PS_LOOKUP_EGO:
771 case PS_LISTEN:
772 case PS_ERROR:
773 fprintf (stderr,
774 "%s",
775 _ ("There is no call that could be suspended right now.\n"));
776 return;
777
778 case PS_ACCEPTED:
779 /* expected state, do rejection logic */
780 break;
781 }
782 GNUNET_assert (NULL != cl_active);
784 cl_active = NULL;
786}
void GNUNET_CONVERSATION_call_suspend(struct GNUNET_CONVERSATION_Call *call)
Pause a call.
void GNUNET_CONVERSATION_caller_suspend(struct GNUNET_CONVERSATION_Caller *caller)
Pause conversation of an active call.

References _, consensus-simulation::args, call, call_state, CallList::caller, cl_active, CS_CONNECTED, CS_RESOLVING, CS_RINGING, CS_SUSPENDED, GNUNET_assert, GNUNET_CONVERSATION_call_suspend(), GNUNET_CONVERSATION_caller_suspend(), phone_state, PS_ACCEPTED, PS_ERROR, PS_LISTEN, and PS_LOOKUP_EGO.

Here is the call graph for this function:

◆ do_resume()

static void do_resume ( const char *  args)
static

Resuming a call.

Parameters
argsarguments given to the command

Definition at line 795 of file gnunet-conversation.c.

796{
797 struct CallList *cl;
798 char buf[32];
799
800 if (NULL != call)
801 {
802 switch (call_state)
803 {
804 case CS_RESOLVING:
805 case CS_RINGING:
806 case CS_CONNECTED:
807 fprintf (stderr,
808 "%s",
809 _ ("There is no call that could be resumed right now.\n"));
810 return;
811
812 case CS_SUSPENDED:
815 return;
816 }
817 }
818 switch (phone_state)
819 {
820 case PS_LOOKUP_EGO:
821 case PS_ERROR:
822 fprintf (stderr,
823 "%s",
824 _ ("There is no call that could be resumed right now.\n"));
825 return;
826
827 case PS_LISTEN:
828 /* expected state, do resume logic */
829 break;
830
831 case PS_ACCEPTED:
832 fprintf (stderr,
833 _ ("Already talking with `%s', cannot resume a call right now.\n"),
835 return;
836 }
837 GNUNET_assert (NULL == cl_active);
838 cl = cl_head;
839 if (NULL == cl)
840 {
841 fprintf (stderr, _ ("There is no incoming call to resume here!\n"));
842 return;
843 }
844 if ((NULL != cl->next) || (NULL != args))
845 {
846 for (cl = cl_head; NULL != cl; cl = cl->next)
847 {
848 GNUNET_snprintf (buf, sizeof(buf), "%u", cl->caller_num);
849 if (0 == strcmp (buf, args))
850 break;
851 }
852 }
853 if (NULL == cl)
854 {
855 fprintf (stderr,
856 _ ("There is no incoming call `%s' to resume right now!\n"),
857 args);
858 return;
859 }
860 cl_active = cl;
863}
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.
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.

References _, consensus-simulation::args, call, call_state, CallList::caller, CallList::caller_num, cl_active, cl_head, CS_CONNECTED, CS_RESOLVING, CS_RINGING, CS_SUSPENDED, GNUNET_assert, GNUNET_CONVERSATION_call_resume(), GNUNET_CONVERSATION_caller_resume(), GNUNET_GNSRECORD_pkey_to_zkey(), GNUNET_snprintf(), mic, CallList::next, peer_key, phone_state, PS_ACCEPTED, PS_ERROR, PS_LISTEN, PS_LOOKUP_EGO, and speaker.

Here is the call graph for this function:

◆ do_reject()

static void do_reject ( const char *  args)
static

Rejecting a call.

Parameters
argsarguments given to the command

Definition at line 872 of file gnunet-conversation.c.

873{
874 struct CallList *cl;
875 char buf[32];
876
877 if (NULL != call)
878 {
880 call = NULL;
881 return;
882 }
883 switch (phone_state)
884 {
885 case PS_LOOKUP_EGO:
886 case PS_ERROR:
887 fprintf (stderr,
888 "%s",
889 _ ("There is no call that could be cancelled right now.\n"));
890 return;
891
892 case PS_LISTEN:
893 /* look for active incoming calls to refuse */
894 cl = cl_head;
895 if (NULL == cl)
896 {
897 fprintf (stderr, _ ("There is no incoming call to refuse here!\n"));
898 return;
899 }
900 if ((NULL != cl->next) || (NULL != args))
901 {
902 for (cl = cl_head; NULL != cl; cl = cl->next)
903 {
904 GNUNET_snprintf (buf, sizeof(buf), "%u", cl->caller_num);
905 if (0 == strcmp (buf, args))
906 break;
907 }
908 }
909 if (NULL == cl)
910 {
911 fprintf (stderr,
912 _ ("There is no incoming call `%s' to refuse right now!\n"),
913 args);
914 return;
915 }
918 GNUNET_free (cl);
919 break;
920
921 case PS_ACCEPTED:
922 /* expected state, do rejection logic */
923 GNUNET_assert (NULL != cl_active);
925 cl_active = NULL;
927 break;
928 }
929}
void GNUNET_CONVERSATION_call_stop(struct GNUNET_CONVERSATION_Call *call)
Terminate a call.
void GNUNET_CONVERSATION_caller_hang_up(struct GNUNET_CONVERSATION_Caller *caller)
Hang up up a (possibly ringing) phone.

References _, consensus-simulation::args, call, CallList::caller, CallList::caller_num, cl_active, cl_head, cl_tail, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_CONVERSATION_call_stop(), GNUNET_CONVERSATION_caller_hang_up(), GNUNET_free, GNUNET_snprintf(), CallList::next, phone_state, PS_ACCEPTED, PS_ERROR, PS_LISTEN, and PS_LOOKUP_EGO.

Here is the call graph for this function:

◆ do_stop_task()

static void do_stop_task ( void *  cls)
static

Task run during shutdown.

Parameters
clsNULL

Definition at line 1007 of file gnunet-conversation.c.

1008{
1009 (void) cls;
1010 if (NULL != call)
1011 {
1013 call = NULL;
1014 }
1015 if (NULL != phone)
1016 {
1018 phone = NULL;
1019 }
1020 if (NULL != handle_cmd_task)
1021 {
1023 handle_cmd_task = NULL;
1024 }
1025 if (NULL != id)
1026 {
1028 id = NULL;
1029 }
1031 speaker = NULL;
1033 mic = NULL;
1035 ego_name = NULL;
1037 peer_name = NULL;
1039}
static struct GNUNET_SCHEDULER_Task * handle_cmd_task
Task which handles the commands.
void GNUNET_CONVERSATION_phone_destroy(struct GNUNET_CONVERSATION_Phone *phone)
Destroys a phone.
void GNUNET_IDENTITY_disconnect(struct GNUNET_IDENTITY_Handle *h)
Disconnect from identity service.
Definition: identity_api.c:732
void GNUNET_MICROPHONE_destroy(struct GNUNET_MICROPHONE_Handle *microphone)
Destroy a microphone.
Definition: microphone.c:195
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:980
void GNUNET_SPEAKER_destroy(struct GNUNET_SPEAKER_Handle *speaker)
Destroy a speaker.
Definition: speaker.c:184

References call, ego_name, GNUNET_CONVERSATION_call_stop(), GNUNET_CONVERSATION_phone_destroy(), GNUNET_free, GNUNET_IDENTITY_disconnect(), GNUNET_MICROPHONE_destroy(), GNUNET_SCHEDULER_cancel(), GNUNET_SPEAKER_destroy(), handle_cmd_task, mic, peer_name, phone, phone_state, PS_ERROR, and speaker.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_command_string()

static void handle_command_string ( char *  message,
size_t  str_len 
)
static

Handle user command.

Parameters
messagecommand the user typed in
str_lennumber of bytes to process in message

Definition at line 1049 of file gnunet-conversation.c.

1050{
1051 size_t i;
1052 const char *ptr;
1053
1054 if (0 == str_len)
1055 return;
1056 if (message[str_len - 1] == '\n')
1057 message[str_len - 1] = '\0';
1058 if (message[str_len - 2] == '\r')
1059 message[str_len - 2] = '\0';
1060 if (0 == strlen (message))
1061 return;
1062 i = 0;
1063 while (
1064 (NULL != commands[i].command) &&
1065 (0 !=
1066 strncasecmp (commands[i].command, message, strlen (commands[i].command))))
1067 i++;
1068 ptr = &message[strlen (commands[i].command)];
1069 while (isspace ((unsigned char) *ptr))
1070 ptr++;
1071 if ('\0' == *ptr)
1072 ptr = NULL;
1073 commands[i].Action (ptr);
1074}
ActionFunction Action
Function to call on command.

References VoipCommand::Action, VoipCommand::command, and commands.

Referenced by handle_command().

Here is the caller graph for this function:

◆ handle_command()

static void handle_command ( void *  cls)
static

Task to handle commands from the terminal.

Parameters
clsNULL

Definition at line 1083 of file gnunet-conversation.c.

1084{
1085 char message[MAX_MESSAGE_LENGTH + 1];
1086
1087 (void) cls;
1090 stdin_fh,
1092 NULL);
1093 /* read message from command line and handle it */
1094 memset (message, 0, MAX_MESSAGE_LENGTH + 1);
1095 if (NULL == fgets (message, MAX_MESSAGE_LENGTH, stdin))
1096 return;
1097 handle_command_string (message, strlen (message));
1098}
static void handle_command_string(char *message, size_t str_len)
Handle user command.
static void handle_command(void *cls)
Task to handle commands from the terminal.
static struct GNUNET_DISK_FileHandle * stdin_fh
File handle for stdin.
#define MAX_MESSAGE_LENGTH
Maximum length allowed for the command line input.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_read_file(struct GNUNET_TIME_Relative delay, const struct GNUNET_DISK_FileHandle *rfd, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay or when the specified file descriptor is ready f...
Definition: scheduler.c:1661
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".

References GNUNET_SCHEDULER_add_read_file(), GNUNET_TIME_UNIT_FOREVER_REL, handle_cmd_task, handle_command(), handle_command_string(), MAX_MESSAGE_LENGTH, and stdin_fh.

Referenced by handle_command(), and run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ identity_cb()

static void identity_cb ( void *  cls,
struct GNUNET_IDENTITY_Ego ego,
void **  ctx,
const char *  name 
)
static

Function called by identity service with information about egos.

Parameters
clsNULL
egoego handle
ctxunused
namename of the ego

Definition at line 1110 of file gnunet-conversation.c.

1114{
1115 (void) cls;
1116 (void) ctx;
1117 if (NULL == name)
1118 return;
1119 if (ego == my_caller_id)
1120 {
1121 if (verbose)
1122 fprintf (stdout, _ ("Name of our ego changed to `%s'\n"), name);
1125 return;
1126 }
1127 if (0 != strcmp (name, ego_name))
1128 return;
1129 if (NULL == ego)
1130 {
1131 if (verbose)
1132 fprintf (stdout, _ ("Our ego `%s' was deleted!\n"), ego_name);
1133 my_caller_id = NULL;
1134 return;
1135 }
1136 my_caller_id = ego;
1137 GNUNET_CONFIGURATION_set_value_string (cfg, "CONVERSATION", "LINE", line);
1138 start_phone ();
1139}
static int verbose
Be verbose.
static void start_phone()
Start our phone.
static struct GNUNET_FS_Handle * ctx
static char * name
Name (label) of the records to list.
void GNUNET_CONFIGURATION_set_value_string(struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, const char *value)
Set a configuration value that should be a string.

References _, cfg, ctx, ego_name, GNUNET_CONFIGURATION_set_value_string(), GNUNET_free, GNUNET_strdup, line, my_caller_id, name, start_phone(), and verbose.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

static void run ( void *  cls,
char *const *  args,
const char *  cfgfile,
const struct GNUNET_CONFIGURATION_Handle c 
)
static

Main function that will be run by the scheduler.

Parameters
clsclosure
argsremaining command-line arguments
cfgfilename of the configuration file used (for saving, can be NULL!)
cconfiguration

Definition at line 1151 of file gnunet-conversation.c.

1155{
1156 (void) cls;
1157 (void) args;
1158 (void) cfgfile;
1162 if (NULL == ego_name)
1163 {
1164 fprintf (stderr, "%s", _ ("You must specify the NAME of an ego to use\n"));
1165 return;
1166 }
1171 NULL);
1173}
static void do_stop_task(void *cls)
Task run during shutdown.
static void identity_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name)
Function called by identity service with information about egos.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_dup(const struct GNUNET_CONFIGURATION_Handle *cfg)
Duplicate an existing configuration object.
struct GNUNET_IDENTITY_Handle * GNUNET_IDENTITY_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_IDENTITY_Callback cb, void *cb_cls)
Connect to the identity service.
Definition: identity_api.c:487
@ GNUNET_SCHEDULER_PRIORITY_UI
Run with priority for interactive tasks.
struct GNUNET_MICROPHONE_Handle * GNUNET_MICROPHONE_create_from_hardware(const struct GNUNET_CONFIGURATION_Handle *cfg)
Create a microphone that corresponds to the microphone hardware of our system.
Definition: microphone.c:172
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received,...
Definition: scheduler.c:1339
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_with_priority(enum GNUNET_SCHEDULER_Priority prio, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified priority.
Definition: scheduler.c:1231
struct GNUNET_SPEAKER_Handle * GNUNET_SPEAKER_create_from_hardware(const struct GNUNET_CONFIGURATION_Handle *cfg)
Create a speaker that corresponds to the speaker hardware of our system.
Definition: speaker.c:160

References _, consensus-simulation::args, cfg, do_stop_task(), ego_name, GNUNET_CONFIGURATION_dup(), GNUNET_IDENTITY_connect(), GNUNET_MICROPHONE_create_from_hardware(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_add_with_priority(), GNUNET_SCHEDULER_PRIORITY_UI, GNUNET_SPEAKER_create_from_hardware(), handle_cmd_task, handle_command(), identity_cb(), mic, and speaker.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *const *  argv 
)

The main function to conversation.

Parameters
argcnumber of arguments from the command line
argvcommand line arguments
Returns
0 ok, 1 on error

Definition at line 1184 of file gnunet-conversation.c.

1185{
1188 'e',
1189 "ego",
1190 "NAME",
1191 gettext_noop ("sets the NAME of the ego to use for the caller ID"),
1192 &ego_name),
1194 "phone",
1195 "LINE",
1196 gettext_noop (
1197 "sets the LINE to use for the phone"),
1198 &line),
1200 int ret;
1201
1202 int flags;
1203 flags = fcntl (0, F_GETFL, 0);
1204 flags |= O_NONBLOCK;
1205 if (0 != fcntl (0, F_SETFL, flags))
1208
1209 ret =
1211 argc,
1212 argv,
1213 "gnunet-conversation",
1214 gettext_noop (
1215 "Enables having a conversation with other GNUnet users."),
1216 options,
1217 &run,
1218 NULL);
1219 if (NULL != cfg)
1220 {
1222 cfg = NULL;
1223 }
1224 return (GNUNET_OK == ret) ? 0 : 1;
1225}
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
Definition: 002.c:13
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
#define gettext_noop(String)
Definition: gettext.h:74
static int ret
Final status code.
Definition: gnunet-arm.c:93
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
Main function that will be run by the scheduler.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
struct GNUNET_DISK_FileHandle * GNUNET_DISK_get_handle_from_int_fd(int fno)
Get a handle from a native integer FD.
Definition: disk.c:1311
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_string(char shortName, const char *name, const char *argumentHelp, const char *description, char **str)
Allow user to specify a string.
@ GNUNET_OK
#define GNUNET_log_strerror(level, cmd)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
@ GNUNET_ERROR_TYPE_WARNING
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_gnunet(void)
Return default project data used by 'libgnunetutil' for GNUnet.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(const struct GNUNET_OS_ProjectData *pd, int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration,...
Definition: program.c:407
Definition of a command line option.

References cfg, ego_name, gettext_noop, GNUNET_CONFIGURATION_destroy(), GNUNET_DISK_get_handle_from_int_fd(), GNUNET_ERROR_TYPE_WARNING, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_string(), GNUNET_log_strerror, GNUNET_OK, GNUNET_OS_project_data_gnunet(), GNUNET_PROGRAM_run(), line, options, ret, run(), and stdin_fh.

Here is the call graph for this function:

Variable Documentation

◆ phone

◆ call

◆ cl_active

struct CallList* cl_active
static

Caller handle (for active incoming call).

This call handler is NOT in the cl_head / cl_tail list.

Definition at line 140 of file gnunet-conversation.c.

Referenced by do_accept(), do_reject(), do_resume(), do_status(), do_suspend(), and phone_event_handler().

◆ cl_head

struct CallList* cl_head
static

Head of calls waiting to be accepted.

Definition at line 145 of file gnunet-conversation.c.

Referenced by do_accept(), do_reject(), do_resume(), do_status(), and phone_event_handler().

◆ cl_tail

struct CallList* cl_tail
static

Tail of calls waiting to be accepted.

Definition at line 150 of file gnunet-conversation.c.

Referenced by do_accept(), do_reject(), do_status(), and phone_event_handler().

◆ line

◆ handle_cmd_task

struct GNUNET_SCHEDULER_Task* handle_cmd_task
static

Task which handles the commands.

Definition at line 160 of file gnunet-conversation.c.

Referenced by do_stop_task(), handle_command(), and run().

◆ speaker

struct GNUNET_SPEAKER_Handle* speaker
static

Our speaker.

Definition at line 165 of file gnunet-conversation.c.

Referenced by do_accept(), do_call(), do_resume(), do_stop_task(), and run().

◆ mic

◆ cfg

struct GNUNET_CONFIGURATION_Handle* cfg
static

Our configuration.

Definition at line 175 of file gnunet-conversation.c.

Referenced by do_call(), identity_cb(), main(), run(), and start_phone().

◆ my_caller_id

struct GNUNET_IDENTITY_Ego* my_caller_id
static

Our ego.

Definition at line 180 of file gnunet-conversation.c.

Referenced by do_call(), identity_cb(), and start_phone().

◆ id

struct GNUNET_IDENTITY_Handle* id
static

Handle to identity service.

Definition at line 185 of file gnunet-conversation.c.

◆ ego_name

char* ego_name
static

Name of our ego.

Definition at line 190 of file gnunet-conversation.c.

Referenced by do_call(), do_status(), do_stop_task(), identity_cb(), main(), run(), and start_phone().

◆ peer_key

struct GNUNET_CRYPTO_PublicKey peer_key
static

Public key of active conversation partner (if any).

Definition at line 195 of file gnunet-conversation.c.

Referenced by do_accept(), do_call(), do_resume(), and do_status().

◆ peer_name

char* peer_name
static

Name of active conversation partner (if any).

Definition at line 200 of file gnunet-conversation.c.

Referenced by call_event_handler(), do_call(), do_status(), and do_stop_task().

◆ stdin_fh

struct GNUNET_DISK_FileHandle* stdin_fh
static

File handle for stdin.

Definition at line 205 of file gnunet-conversation.c.

Referenced by handle_command(), and main().

◆ phone_state

enum PhoneState phone_state
static

Our phone's current state.

Definition at line 210 of file gnunet-conversation.c.

Referenced by do_accept(), do_call(), do_reject(), do_resume(), do_status(), do_stop_task(), do_suspend(), phone_event_handler(), and start_phone().

◆ call_state

enum CallState call_state
static

Our call's current state.

Definition at line 215 of file gnunet-conversation.c.

Referenced by call_event_handler(), do_accept(), do_call(), do_resume(), do_status(), and do_suspend().

◆ caller_num_gen

unsigned int caller_num_gen
static

Counts the number of incoming calls we have had so far.

Definition at line 220 of file gnunet-conversation.c.

Referenced by phone_event_handler().

◆ address

◆ verbose

int verbose
static

Be verbose.

Definition at line 230 of file gnunet-conversation.c.

Referenced by identity_cb().

◆ commands