GNUnet  0.19.4
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_IDENTITY_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_IDENTITY_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 36 of file gnunet-conversation.c.

◆ XSTRINGIFY

#define XSTRINGIFY (   x)    STRINGIFY (x)

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

◆ STRINGIFY

#define STRINGIFY (   x)    (#x)

Definition at line 40 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 446 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 45 of file gnunet-conversation.c.

46 {
51 
55  PS_LISTEN,
56 
61 
65  PS_ERROR
66 };
@ 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 72 of file gnunet-conversation.c.

73 {
78 
82  CS_RINGING,
83 
88 
93 };
@ 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_IDENTITY_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 244 of file gnunet-conversation.c.

248 {
249  struct CallList *cl;
250 
251  (void) cls;
252  switch (code)
253  {
255  /*
256  * FIXME: we should be playing our ringtones from contrib/sounds now!
257  *
258  ring_my_bell();
259  *
260  * 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
261  */fprintf (
262  stdout,
263  _ (
264  "Incoming call from `%s'. Please /accept %u or /cancel %u the call.\n"),
268  cl = GNUNET_new (struct CallList);
269  cl->caller = caller;
270  cl->caller_id = *caller_id;
271  cl->caller_num = caller_num_gen++;
273  break;
274 
276  for (cl = cl_head; NULL != cl; cl = cl->next)
277  if (caller == cl->caller)
278  break;
279  if ((NULL == cl) && (caller == cl_active->caller))
280  cl = cl_active;
281  if (NULL == cl)
282  {
283  GNUNET_break (0);
284  return;
285  }
286  fprintf (stdout,
287  _ ("Call from `%s' terminated\n"),
289  if (cl == cl_active)
290  {
291  cl_active = NULL;
293  }
294  else
295  {
297  }
298  GNUNET_free (cl);
299  break;
300  }
301 }
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_IDENTITY_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_IDENTITY_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 311 of file gnunet-conversation.c.

312 {
313  struct CallList *cl = cls;
314 
315  switch (code)
316  {
318  fprintf (stdout,
319  _ ("Call from `%s' suspended by other user\n"),
321  break;
322 
324  fprintf (stdout,
325  _ ("Call from `%s' resumed by other user\n"),
327  break;
328  }
329 }
@ 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 336 of file gnunet-conversation.c.

337 {
338  struct GNUNET_GNSRECORD_Data rd;
339 
340  if (NULL == my_caller_id)
341  {
342  fprintf (stderr,
343  _ ("Ego `%s' no longer available, phone is now down.\n"),
344  ego_name);
346  return;
347  }
348  GNUNET_assert (NULL == phone);
350  my_caller_id,
352  NULL);
353  /* FIXME: get record and print full GNS record info later here... */
354  if (NULL == phone)
355  {
356  fprintf (stderr, "%s", _ ("Failed to setup phone (internal error)\n"));
358  }
359  else
360  {
363  address =
365  fprintf (
366  stdout,
367  _ (
368  "Phone active at `%s'. Type `/help' for a list of available commands\n"),
369  address);
371  }
372 }
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_IDENTITY_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 'value' of a record to a string.
Definition: gnsrecord.c:155
#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 382 of file gnunet-conversation.c.

383 {
384  (void) cls;
385 
386  switch (code)
387  {
390  fprintf (stdout,
391  _ ("Resolved address of `%s'. Now ringing other party.\n"),
392  peer_name);
394  break;
395 
398  fprintf (stdout, _ ("Connection established to `%s'\n"), peer_name);
400  break;
401 
404  fprintf (stdout, _ ("Failed to resolve `%s'\n"), peer_name);
406  peer_name = NULL;
407  call = NULL;
408  break;
409 
411  fprintf (stdout, _ ("Call to `%s' terminated\n"), peer_name);
413  peer_name = NULL;
414  call = NULL;
415  break;
416 
419  fprintf (stdout,
420  _ ("Connection to `%s' suspended (by other user)\n"),
421  peer_name);
422  break;
423 
426  fprintf (stdout,
427  _ ("Connection to `%s' resumed (by other user)\n"),
428  peer_name);
429  break;
430 
432  fprintf (stdout, _ ("Error with the call, restarting it\n"));
434  peer_name = NULL;
435  call = NULL;
436  break;
437  }
438 }
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 976 of file gnunet-conversation.c.

977 {
978  unsigned int i;
979 
980  i = 0;
981  while ((NULL != args) && (0 != strlen (args)) &&
982  (commands[i].Action != &do_help))
983  {
984  if (0 == strncasecmp (&args[1], &commands[i].command[1], strlen (args) - 1))
985  {
986  fprintf (stdout, "%s\n", gettext (commands[i].helptext));
987  return;
988  }
989  i++;
990  }
991  i = 0;
992  fprintf (stdout, "%s", "Available commands:\n");
993  while (commands[i].Action != &do_help)
994  {
995  fprintf (stdout, "%s\n", gettext (commands[i].command));
996  i++;
997  }
998  fprintf (stdout, "%s", "\n");
999  fprintf (stdout, "%s\n", gettext (commands[i].helptext));
1000 }
#define gettext(Msgid)
Definition: gettext.h:46
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, gettext, and VoipCommand::helptext.

Referenced by do_call().

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 486 of file gnunet-conversation.c.

487 {
488  (void) args;
490 }
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:562

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 499 of file gnunet-conversation.c.

500 {
501  fprintf (stderr, _ ("Unknown command `%s'\n"), msg);
502 }
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 511 of file gnunet-conversation.c.

512 {
513  if (NULL == my_caller_id)
514  {
515  fprintf (stderr, _ ("Ego `%s' not available\n"), ego_name);
516  return;
517  }
518  if (NULL != call)
519  {
520  fprintf (stderr,
521  _ ("You are calling someone else already, hang up first!\n"));
522  return;
523  }
524  switch (phone_state)
525  {
526  case PS_LOOKUP_EGO:
527  fprintf (stderr, _ ("Ego `%s' not available\n"), ego_name);
528  return;
529 
530  case PS_LISTEN:
531  /* ok to call! */
532  break;
533 
534  case PS_ACCEPTED:
535  fprintf (
536  stderr,
537  _ (
538  "You are answering call from `%s', hang up or suspend that call first!\n"),
540  return;
541 
542  case PS_ERROR:
543  /* ok to call */
544  break;
545  }
546  if (NULL == arg)
547  {
548  fprintf (stderr, _ ("Call recipient missing.\n"));
549  do_help ("/call");
550  return;
551  }
554  GNUNET_assert (NULL == call);
556  my_caller_id,
557  arg,
558  speaker,
559  mic,
561  NULL);
562 }
static struct GNUNET_IDENTITY_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 571 of file gnunet-conversation.c.

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

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

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 662 of file gnunet-conversation.c.

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

750 {
751  (void) args;
752  if (NULL != call)
753  {
754  switch (call_state)
755  {
756  case CS_RESOLVING:
757  case CS_RINGING:
758  case CS_SUSPENDED:
759  fprintf (stderr,
760  "%s",
761  _ ("There is no call that could be suspended right now.\n"));
762  return;
763 
764  case CS_CONNECTED:
767  return;
768  }
769  }
770  switch (phone_state)
771  {
772  case PS_LOOKUP_EGO:
773  case PS_LISTEN:
774  case PS_ERROR:
775  fprintf (stderr,
776  "%s",
777  _ ("There is no call that could be suspended right now.\n"));
778  return;
779 
780  case PS_ACCEPTED:
781  /* expected state, do rejection logic */
782  break;
783  }
784  GNUNET_assert (NULL != cl_active);
786  cl_active = NULL;
788 }
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 797 of file gnunet-conversation.c.

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

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

◆ do_stop_task()

static void do_stop_task ( void *  cls)
static

Task run during shutdown.

Parameters
clsNULL

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

1010 {
1011  (void) cls;
1012  if (NULL != call)
1013  {
1015  call = NULL;
1016  }
1017  if (NULL != phone)
1018  {
1020  phone = NULL;
1021  }
1022  if (NULL != handle_cmd_task)
1023  {
1025  handle_cmd_task = NULL;
1026  }
1027  if (NULL != id)
1028  {
1030  id = NULL;
1031  }
1033  speaker = NULL;
1035  mic = NULL;
1037  ego_name = NULL;
1039  peer_name = NULL;
1041 }
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:757
void GNUNET_MICROPHONE_destroy(struct GNUNET_MICROPHONE_Handle *microphone)
Destroy a microphone.
Definition: microphone.c:193
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:975
void GNUNET_SPEAKER_destroy(struct GNUNET_SPEAKER_Handle *speaker)
Destroy a speaker.
Definition: speaker.c:182

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 1051 of file gnunet-conversation.c.

1052 {
1053  size_t i;
1054  const char *ptr;
1055 
1056  if (0 == str_len)
1057  return;
1058  if (message[str_len - 1] == '\n')
1059  message[str_len - 1] = '\0';
1060  if (message[str_len - 2] == '\r')
1061  message[str_len - 2] = '\0';
1062  if (0 == strlen (message))
1063  return;
1064  i = 0;
1065  while (
1066  (NULL != commands[i].command) &&
1067  (0 !=
1068  strncasecmp (commands[i].command, message, strlen (commands[i].command))))
1069  i++;
1070  ptr = &message[strlen (commands[i].command)];
1071  while (isspace ((unsigned char) *ptr))
1072  ptr++;
1073  if ('\0' == *ptr)
1074  ptr = NULL;
1075  commands[i].Action (ptr);
1076 }
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 1085 of file gnunet-conversation.c.

1086 {
1087  char message[MAX_MESSAGE_LENGTH + 1];
1088 
1089  (void) cls;
1090  handle_cmd_task =
1092  stdin_fh,
1093  &handle_command,
1094  NULL);
1095  /* read message from command line and handle it */
1096  memset (message, 0, MAX_MESSAGE_LENGTH + 1);
1097  if (NULL == fgets (message, MAX_MESSAGE_LENGTH, stdin))
1098  return;
1099  handle_command_string (message, strlen (message));
1100 }
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:1656
#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_string(), MAX_MESSAGE_LENGTH, and stdin_fh.

Referenced by 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 1112 of file gnunet-conversation.c.

1116 {
1117  (void) cls;
1118  (void) ctx;
1119  if (NULL == name)
1120  return;
1121  if (ego == my_caller_id)
1122  {
1123  if (verbose)
1124  fprintf (stdout, _ ("Name of our ego changed to `%s'\n"), name);
1127  return;
1128  }
1129  if (0 != strcmp (name, ego_name))
1130  return;
1131  if (NULL == ego)
1132  {
1133  if (verbose)
1134  fprintf (stdout, _ ("Our ego `%s' was deleted!\n"), ego_name);
1135  my_caller_id = NULL;
1136  return;
1137  }
1138  my_caller_id = ego;
1139  GNUNET_CONFIGURATION_set_value_string (cfg, "CONVERSATION", "LINE", line);
1140  start_phone ();
1141 }
static int verbose
Be verbose.
static void start_phone()
Start our phone.
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
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.
const char * name

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 1153 of file gnunet-conversation.c.

1157 {
1158  (void) cls;
1159  (void) args;
1160  (void) cfgfile;
1164  if (NULL == ego_name)
1165  {
1166  fprintf (stderr, "%s", _ ("You must specify the NAME of an ego to use\n"));
1167  return;
1168  }
1169  id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL);
1170  handle_cmd_task =
1172  &handle_command,
1173  NULL);
1175 }
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:531
@ 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:170
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:1226
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:1334
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:158

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 1186 of file gnunet-conversation.c.

1187 {
1190  'e',
1191  "ego",
1192  "NAME",
1193  gettext_noop ("sets the NAME of the ego to use for the caller ID"),
1194  &ego_name),
1196  "phone",
1197  "LINE",
1198  gettext_noop (
1199  "sets the LINE to use for the phone"),
1200  &line),
1202  int ret;
1203 
1204  int flags;
1205  flags = fcntl (0, F_GETFL, 0);
1206  flags |= O_NONBLOCK;
1207  if (0 != fcntl (0, F_SETFL, flags))
1210 
1211  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
1212  return 2;
1213  ret =
1214  GNUNET_PROGRAM_run (argc,
1215  argv,
1216  "gnunet-conversation",
1217  gettext_noop (
1218  "Enables having a conversation with other GNUnet users."),
1219  options,
1220  &run,
1221  NULL);
1222  GNUNET_free_nz ((void *) argv);
1223  if (NULL != cfg)
1224  {
1226  cfg = NULL;
1227  }
1228  return (GNUNET_OK == ret) ? 0 : 1;
1229 }
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:70
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
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:1330
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
#define GNUNET_free_nz(ptr)
Wrapper around free.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(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:400
enum GNUNET_GenericReturnValue GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
Definition: strings.c:1222
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_free_nz, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_string(), GNUNET_log_strerror, GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_STRINGS_get_utf8_args(), 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 142 of file gnunet-conversation.c.

Referenced by do_accept(), 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 147 of file gnunet-conversation.c.

Referenced by do_accept(), 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 152 of file gnunet-conversation.c.

Referenced by do_accept(), 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 162 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 167 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 177 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 182 of file gnunet-conversation.c.

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

◆ id

◆ ego_name

char* ego_name
static

Name of our ego.

Definition at line 192 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_IDENTITY_PublicKey peer_key
static

Public key of active conversation partner (if any).

Definition at line 192 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 202 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 207 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 207 of file gnunet-conversation.c.

Referenced by do_accept(), do_call(), 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 207 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 222 of file gnunet-conversation.c.

Referenced by phone_event_handler().

◆ address

char* address
static

GNS address for this phone.

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

Referenced by ack_proc(), add_address_to_hello(), add_address_to_uri(), add_to_buf(), add_valid_address(), addr_info_cb(), address_cb(), address_notification(), allocation_cb(), ats_perf_cb(), ats_perf_mon_cb(), ats_request_address_change(), bandwidth_changed_cb(), broadcast_mst_cb(), check_address_add(), check_client_address_to_string(), check_reply(), client_lookup_session(), compose_address_iterate_response_message(), connect_bl_check_cont(), connect_peers_run(), copy_latest(), count_addresses(), create_channel_to_destination(), create_session(), delta_match(), discard_expired(), do_address(), dump_pc(), find_ai(), find_ai_no_session(), find_matching(), find_other_matching(), find_prop_gen(), find_queue(), find_session_id(), find_validation_entry(), free_all_it(), GAS_handle_address_add(), GAS_normalization_update_property(), GAS_plugin_delete_address(), GAS_plugin_notify_property_changed(), GAS_proportional_address_add(), GAS_proportional_address_delete(), GAS_proportional_address_property_changed(), GDS_u_try_connect(), get_address_without_port(), get_destination_key_from_ip(), get_match_exp(), GNUNET_ATS_address_add(), GNUNET_HELLO_add_address(), GNUNET_HELLO_address_allocate(), GNUNET_HELLO_address_check_option(), GNUNET_HELLO_address_copy(), GNUNET_HELLO_address_get_size(), GNUNET_HELLO_iterate_addresses(), GNUNET_HELLO_sign_address(), GNUNET_NETWORK_socket_accept(), GNUNET_NETWORK_socket_connect(), GNUNET_TRANSPORT_address_to_string(), GNUNET_TRANSPORT_communicator_address_add(), GNUNET_TRANSPORT_communicator_mq_add(), GNUNET_TRANSPORT_TESTING_transport_communicator_open_queue(), gnunet_try_connect(), GST_ats_add_address(), GST_ats_add_inbound_address(), GST_ats_block_address(), GST_ats_block_reset(), GST_ats_del_session(), GST_ats_expire_address(), GST_ats_is_known(), GST_ats_is_known_no_session(), GST_ats_new_session(), GST_ats_update_delay(), GST_ats_update_distance(), GST_ats_update_utilization(), GST_blacklist_abort_matching(), GST_blacklist_test_allowed(), GST_clients_broadcast_peer_notification(), GST_hello_modify_addresses(), GST_hello_test_address(), GST_manipulation_manipulate_metrics(), GST_neighbours_handle_session_ack(), GST_neighbours_handle_session_syn_ack(), GST_neighbours_notify_data_recv(), GST_neighbours_notify_data_sent(), GST_neighbours_switch_to_address(), GST_plugins_a2s(), GST_validation_handle_address(), GST_validation_handle_ping(), GST_validation_handle_pong(), handle_address_list(), handle_client_address_to_string(), handle_peer_information(), handle_reply(), handle_response(), handle_tcp_welcome(), http_client_plugin_get_session(), http_common_address_from_socket(), http_common_plugin_address_pretty_printer(), http_common_plugin_address_to_string(), http_common_plugin_address_to_url(), http_common_plugin_string_to_address(), ip_try_connect(), LIBGNUNET_PLUGIN_TRANSPORT_DONE(), libgnunet_plugin_transport_unix_done(), lookup_session(), main(), make_up_icmpv4_payload(), make_up_icmpv6_payload(), mq_init(), multicast_pong(), neighbours_changed_notification(), normalize_address(), notify_change(), notify_monitor(), notify_monitors(), plugin_env_address_change_notification(), plugin_env_address_to_type(), plugin_env_session_end(), plugin_env_session_start(), plugin_env_session_start_bl_check_cont(), print_address(), process_data(), process_peer_iteration_cb(), process_peer_monitoring_cb(), process_peer_string(), process_resolved_address(), process_udp_message(), read_process_ack(), resolve_peer_address(), send_peer_information(), send_syn_ack_message(), send_with_session(), server_add_address(), server_remove_address(), set_address4(), set_address6(), set_primary_address(), setup_sender(), sockaddr_to_udpaddr_string(), solver_bandwidth_changed_cb(), start_address_validation(), start_phone(), suggest_to_connect(), switch_address_bl_check_cont(), tcp_nat_port_map_callback(), tcp_plugin_get_session(), tcp_plugin_string_to_address(), test_connection_ok(), transmit_ping_if_allowed(), transport_addr_to_str_cb(), try_run_fast_ats_update(), u_address_add(), udp_nat_port_map_callback(), udp_plugin_create_session(), udp_plugin_get_session(), udp_plugin_lookup_session(), udp_string_to_address(), unix_demultiplexer(), unix_plugin_get_session(), unix_plugin_string_to_address(), update_latencies(), validate_address_iterator(), vpn_allocation_callback(), and wlan_plugin_get_session().

◆ verbose

int verbose
static

Be verbose.

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

Referenced by identity_cb().

◆ commands

struct VoipCommand commands[]
static

List of supported commands.

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

Referenced by do_help(), GNUNET_TESTING_command_new(), GNUNET_TESTING_main(), and handle_command_string().