GNUnet  0.10.x
Data Structures | Macros | Functions | Variables
gnunet-peerinfo.c File Reference

Print information about other known peers. More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_hello_lib.h"
#include "gnunet_transport_service.h"
#include "gnunet_transport_hello_service.h"
#include "gnunet_peerinfo_service.h"
#include "gnunet-peerinfo_plugins.h"
Include dependency graph for gnunet-peerinfo.c:

Go to the source code of this file.

Data Structures

struct  AddressRecord
 Record we keep for each printable address. More...
 
struct  PrintContext
 Structure we use to collect printable address information. More...
 

Macros

#define TIMEOUT   GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
 How long until we time out during address lookup? More...
 

Functions

static void state_machine (void *cls)
 Main state machine that goes over all options and runs the next requested function. More...
 
static void dump_pc (struct PrintContext *pc)
 Print the collected address information to the console and free pc. More...
 
static void process_resolved_address (void *cls, const char *address, int res)
 Function to call with a human-readable format of an address. More...
 
static int count_address (void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_TIME_Absolute expiration)
 Iterator callback to go over all addresses and count them. More...
 
static int print_address (void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_TIME_Absolute expiration)
 Iterator callback to go over all addresses. More...
 
static void print_peer_info (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Message *hello, const char *err_msg)
 Print information about the peer. More...
 
static int count_addr (void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_TIME_Absolute expiration)
 Count the number of addresses in the HELLO. More...
 
static void dump_my_hello ()
 Write HELLO of my peer to a file. More...
 
static void print_my_uri (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Message *hello, const char *err_msg)
 Print URI of the peer. More...
 
static void add_continuation (void *cls)
 Continuation called from GNUNET_PEERINFO_add_peer() More...
 
static int parse_hello_uri (const char *put_uri)
 Parse the PUT URI given at the command line and add it to our peerinfo database. More...
 
static void shutdown_task (void *cls)
 Main state machine that goes over all options and runs the next requested function. More...
 
static void hello_callback (void *cls, const struct GNUNET_MessageHeader *hello)
 Function called with our peer's HELLO message. 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 obtain peer information. More...
 

Variables

static int no_resolve
 Option '-n'. More...
 
static int be_quiet
 Option '-q'. More...
 
static int include_friend_only
 Option '-f'. More...
 
static int get_self
 Option '-s'. More...
 
static int get_uri
 Option. More...
 
static int default_operation
 Option. More...
 
static int get_info
 Option '-i'. More...
 
static char * put_uri
 Option. More...
 
static char * dump_hello
 Option -d. More...
 
static struct GNUNET_PEERINFO_Handlepeerinfo
 Handle to peerinfo service. More...
 
static const struct GNUNET_CONFIGURATION_Handlecfg
 Configuration handle. More...
 
static struct GNUNET_SCHEDULER_Tasktt
 Main state machine task (if active). More...
 
static struct GNUNET_TRANSPORT_HelloGetHandlegh
 Pending GNUNET_TRANSPORT_hello_get() operation. More...
 
static struct GNUNET_PEERINFO_IteratorContextpic
 Current iterator context (if active, otherwise NULL). More...
 
static struct GNUNET_PeerIdentity my_peer_identity
 My peer identity. More...
 
static struct PrintContextpc_head
 Head of list of print contexts. More...
 
static struct PrintContextpc_tail
 Tail of list of print contexts. More...
 
static struct GNUNET_MQ_Envelopeac
 Handle to current GNUNET_PEERINFO_add_peer() operation. More...
 
static struct GNUNET_HELLO_Messagemy_hello
 Hello of this peer (if initialized). More...
 

Detailed Description

Print information about other known peers.

Author
Christian Grothoff
Matthias Wachs

Definition in file gnunet-peerinfo.c.

Macro Definition Documentation

◆ TIMEOUT

How long until we time out during address lookup?

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

Referenced by print_address().

Function Documentation

◆ state_machine()

static void state_machine ( void *  cls)
static

Main state machine that goes over all options and runs the next requested function.

Parameters
clsunused

Definition at line 765 of file gnunet-peerinfo.c.

References _, be_quiet, default_operation, get_info, get_self, get_uri, GNUNET_free, GNUNET_i2s_full(), GNUNET_NO, GNUNET_PEERINFO_iterate(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_shutdown(), GNUNET_SYSERR, GNUNET_YES, GPI_plugins_load(), include_friend_only, my_peer_identity, parse_hello_uri(), print_my_uri(), print_peer_info(), and put_uri.

Referenced by add_continuation(), dump_pc(), hello_callback(), parse_hello_uri(), print_my_uri(), print_peer_info(), and run().

766 {
767  tt = NULL;
768 
769  if (NULL != put_uri)
770  {
773  {
774  fprintf (stderr,
775  _("Invalid URI `%s'\n"),
776  put_uri);
778  }
780  put_uri = NULL;
781  }
782  else if (GNUNET_YES == get_info)
783  {
788  NULL,
790  NULL);
791  }
792  else if (GNUNET_YES == get_self)
793  {
795  if (be_quiet)
796  printf ("%s\n",
798  else
799  printf (_("I am peer `%s'.\n"),
802  NULL);
803  }
804  else if (GNUNET_YES == get_uri)
805  {
810  &print_my_uri,
811  NULL);
812  get_uri = GNUNET_NO;
813  }
814  else if (GNUNET_YES == default_operation)
815  {
816  /* default operation list all */
820  NULL);
821  }
822  else
823  {
825  }
827 }
static int default_operation
Option.
static int be_quiet
Option '-q'.
static void print_peer_info(void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Message *hello, const char *err_msg)
Print information about the peer.
static void print_my_uri(void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Message *hello, const char *err_msg)
Print URI of the peer.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration handle.
static struct GNUNET_SCHEDULER_Task * tt
Main state machine task (if active).
static int include_friend_only
Option '-f'.
#define GNUNET_NO
Definition: gnunet_common.h:81
const char * GNUNET_i2s_full(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:524
static char * put_uri
Option.
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
static int get_uri
Option.
struct GNUNET_PEERINFO_IteratorContext * GNUNET_PEERINFO_iterate(struct GNUNET_PEERINFO_Handle *h, int include_friend_only, const struct GNUNET_PeerIdentity *peer, GNUNET_PEERINFO_Processor callback, void *callback_cls)
Call a method for each known matching host.
Definition: peerinfo_api.c:491
static struct GNUNET_PEERINFO_Handle * peerinfo
Handle to peerinfo service.
static struct GNUNET_PEERINFO_IteratorContext * pic
Current iterator context (if active, otherwise NULL).
static void state_machine(void *cls)
Main state machine that goes over all options and runs the next requested function.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
static int parse_hello_uri(const char *put_uri)
Parse the PUT URI given at the command line and add it to our peerinfo database.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
static struct GNUNET_PeerIdentity my_peer_identity
My peer identity.
void GPI_plugins_load(const struct GNUNET_CONFIGURATION_Handle *cfg)
Load and initialize all plugins.
static int get_self
Option '-s'.
#define GNUNET_YES
Definition: gnunet_common.h:80
static int get_info
Option '-i'.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_pc()

static void dump_pc ( struct PrintContext pc)
static

Print the collected address information to the console and free pc.

Parameters
pcprinting context

Definition at line 235 of file gnunet-peerinfo.c.

References _, PrintContext::address_list, AddressRecord::expiration, PrintContext::friend_only, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_free_non_null, GNUNET_i2s_full(), GNUNET_SCHEDULER_add_now(), GNUNET_STRINGS_absolute_time_to_string(), GNUNET_YES, PrintContext::num_addresses, PrintContext::peer, AddressRecord::result, and state_machine().

Referenced by print_peer_info(), and process_resolved_address().

236 {
237  unsigned int i;
238 
239  printf (_("%sPeer `%s'\n"),
240  (GNUNET_YES == pc->friend_only) ? "F2F: " : "",
241  GNUNET_i2s_full (&pc->peer));
242  for (i = 0; i < pc->num_addresses; i++)
243  {
244  if (NULL != pc->address_list[i].result)
245  {
246  printf (_("\tExpires: %s \t %s\n"),
248  pc->address_list[i].result);
250  }
251  }
252  printf ("\n");
255  pc_tail,
256  pc);
257  GNUNET_free (pc);
258  if ( (NULL == pc_head) &&
259  (NULL == pic) )
261  NULL);
262 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct GNUNET_PeerIdentity peer
Identity of the peer.
static struct GNUNET_SCHEDULER_Task * tt
Main state machine task (if active).
const char * GNUNET_i2s_full(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
unsigned int num_addresses
Number of completed addresses in address_list.
static struct GNUNET_PEERINFO_IteratorContext * pic
Current iterator context (if active, otherwise NULL).
static void state_machine(void *cls)
Main state machine that goes over all options and runs the next requested function.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
static struct PrintContext * pc_head
Head of list of print contexts.
struct GNUNET_TIME_Absolute expiration
Address expiration time.
char * result
Printable address.
static struct PrintContext * pc_tail
Tail of list of print contexts.
#define GNUNET_YES
Definition: gnunet_common.h:80
int friend_only
Hello was friend only, GNUNET_YES or GNUNET_NO.
struct AddressRecord * address_list
List of printable addresses.
const char * GNUNET_STRINGS_absolute_time_to_string(struct GNUNET_TIME_Absolute t)
Like asctime, except for GNUnet time.
Definition: strings.c:792
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_resolved_address()

static void process_resolved_address ( void *  cls,
const char *  address,
int  res 
)
static

Function to call with a human-readable format of an address.

Parameters
clsclosure
addressNULL on error, otherwise 0-terminated printable UTF-8 string
resresult of the address to string conversion: if GNUNET_OK: address was valid (conversion to string might still have failed) if GNUNET_SYSERR: address is invalid

Definition at line 279 of file gnunet-peerinfo.c.

References _, PrintContext::address_list_size, AddressRecord::atsc, dump_pc(), GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_strdup, GNUNET_SYSERR, PrintContext::num_addresses, AddressRecord::pc, PrintContext::peer, and AddressRecord::result.

Referenced by print_address().

282 {
283  struct AddressRecord *ar = cls;
284  struct PrintContext *pc = ar->pc;
285 
286  if (NULL != address)
287  {
288  if (0 != strlen (address))
289  {
290  if (NULL != ar->result)
291  GNUNET_free (ar->result);
292  ar->result = GNUNET_strdup (address);
293  }
294  return;
295  }
296  ar->atsc = NULL;
297  if (GNUNET_SYSERR == res)
299  _("Failure: Cannot convert address to string for peer `%s'\n"),
300  GNUNET_i2s (&ar->pc->peer));
301  pc->num_addresses++;
302  if (pc->num_addresses == pc->address_list_size)
303  dump_pc (pc);
304 }
struct GNUNET_PeerIdentity peer
Identity of the peer.
struct PrintContext * pc
Print context this address record belongs to.
Structure we use to collect printable address information.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
unsigned int num_addresses
Number of completed addresses in address_list.
Record we keep for each printable address.
static int res
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
struct GNUNET_TRANSPORT_AddressToStringContext * atsc
Current address-to-string context (if active, otherwise NULL).
char * result
Printable address.
static void dump_pc(struct PrintContext *pc)
Print the collected address information to the console and free pc.
static struct GNUNET_FS_PublishContext * pc
Handle to FS-publishing operation.
#define GNUNET_log(kind,...)
unsigned int address_list_size
Number of addresses allocated in address_list.
static char * address
GNS address for this phone.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ count_address()

static int count_address ( void *  cls,
const struct GNUNET_HELLO_Address address,
struct GNUNET_TIME_Absolute  expiration 
)
static

Iterator callback to go over all addresses and count them.

Parameters
clsstruct PrintContext * with off to increment
addressthe address
expirationexpiration time
Returns
GNUNET_OK to keep the address and continue

Definition at line 316 of file gnunet-peerinfo.c.

References GNUNET_OK, PrintContext::off, and AddressRecord::pc.

Referenced by print_peer_info().

319 {
320  struct PrintContext *pc = cls;
321 
322  pc->off++;
323  return GNUNET_OK;
324 }
Structure we use to collect printable address information.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
static struct GNUNET_FS_PublishContext * pc
Handle to FS-publishing operation.
unsigned int off
Current offset in address_list (counted down).
Here is the caller graph for this function:

◆ print_address()

static int print_address ( void *  cls,
const struct GNUNET_HELLO_Address address,
struct GNUNET_TIME_Absolute  expiration 
)
static

Iterator callback to go over all addresses.

Parameters
clsclosure
addressthe address
expirationexpiration time
Returns
GNUNET_OK to keep the address and continue

Definition at line 336 of file gnunet-peerinfo.c.

References GNUNET_HELLO_Address::address_length, PrintContext::address_list, AddressRecord::atsc, AddressRecord::expiration, GNUNET_asprintf(), GNUNET_assert, GNUNET_OK, GNUNET_TRANSPORT_address_to_string(), GNUNET_HELLO_Address::local_info, no_resolve, PrintContext::off, AddressRecord::pc, process_resolved_address(), AddressRecord::result, TIMEOUT, and GNUNET_HELLO_Address::transport_name.

Referenced by print_peer_info().

339 {
340  struct PrintContext *pc = cls;
341  struct AddressRecord *ar;
342 
343  GNUNET_assert (0 < pc->off);
344  ar = &pc->address_list[--pc->off];
345  ar->pc = pc;
346  ar->expiration = expiration;
347  GNUNET_asprintf (&ar->result,
348  "%s:%u:%u",
349  address->transport_name,
350  address->address_length,
351  address->local_info);
353  address,
354  no_resolve,
355  TIMEOUT,
357  return GNUNET_OK;
358 }
size_t address_length
Number of bytes in address.
enum GNUNET_HELLO_AddressInfo local_info
Extended information about address.
static char * expiration
Credential TTL.
struct PrintContext * pc
Print context this address record belongs to.
Structure we use to collect printable address information.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration handle.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
#define TIMEOUT
How long until we time out during address lookup?
int GNUNET_asprintf(char **buf, const char *format,...)
Like asprintf, just portable.
Record we keep for each printable address.
const char * transport_name
Name of the transport plugin enabling the communication using this address.
struct GNUNET_TIME_Absolute expiration
Address expiration time.
static int no_resolve
Option &#39;-n&#39;.
struct GNUNET_TRANSPORT_AddressToStringContext * GNUNET_TRANSPORT_address_to_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_HELLO_Address *address, int numeric, struct GNUNET_TIME_Relative timeout, GNUNET_TRANSPORT_AddressToStringCallback aluc, void *aluc_cls)
Convert a binary address into a human readable address.
struct GNUNET_TRANSPORT_AddressToStringContext * atsc
Current address-to-string context (if active, otherwise NULL).
char * result
Printable address.
static struct GNUNET_FS_PublishContext * pc
Handle to FS-publishing operation.
unsigned int off
Current offset in address_list (counted down).
static void process_resolved_address(void *cls, const char *address, int res)
Function to call with a human-readable format of an address.
struct AddressRecord * address_list
List of printable addresses.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_peer_info()

static void print_peer_info ( void *  cls,
const struct GNUNET_PeerIdentity peer,
const struct GNUNET_HELLO_Message hello,
const char *  err_msg 
)
static

Print information about the peer.

Currently prints the struct GNUNET_PeerIdentity and the transport address.

Parameters
clsthe struct PrintContext *
peeridentity of the peer
helloaddresses of the peer
err_msgerror message

Definition at line 371 of file gnunet-peerinfo.c.

References _, PrintContext::address_list, PrintContext::address_list_size, be_quiet, count_address(), dump_pc(), FPRINTF, PrintContext::friend_only, GNUNET_CONTAINER_DLL_insert, GNUNET_HELLO_is_friend_only(), GNUNET_HELLO_iterate_addresses(), GNUNET_i2s_full(), GNUNET_malloc, GNUNET_new, GNUNET_NO, GNUNET_SCHEDULER_add_now(), GNUNET_YES, PrintContext::off, AddressRecord::pc, PrintContext::peer, peer, print_address(), and state_machine().

Referenced by state_machine().

375 {
376  struct PrintContext *pc;
377  int friend_only;
378 
379  if (NULL == peer)
380  {
381  pic = NULL; /* end of iteration */
382  if (NULL != err_msg)
383  {
384  FPRINTF (stderr,
385  _("Error in communication with PEERINFO service: %s\n"),
386  err_msg);
387  }
388  if (NULL == pc_head)
390  return;
391  }
392  friend_only = GNUNET_NO;
393  if (NULL != hello)
394  friend_only = GNUNET_HELLO_is_friend_only (hello);
395  if ( (GNUNET_YES == be_quiet) ||
396  (NULL == hello) )
397  {
398  printf ("%s%s\n",
399  (GNUNET_YES == friend_only) ? "F2F: " : "",
400  GNUNET_i2s_full (peer));
401  return;
402  }
403  pc = GNUNET_new (struct PrintContext);
405  pc_tail,
406  pc);
407  pc->peer = *peer;
408  pc->friend_only = friend_only;
410  GNUNET_NO,
411  &count_address,
412  pc);
413  if (0 == pc->off)
414  {
415  dump_pc (pc);
416  return;
417  }
418  pc->address_list_size = pc->off;
419  pc->address_list = GNUNET_malloc (sizeof (struct AddressRecord) * pc->off);
421  GNUNET_NO,
422  &print_address,
423  pc);
424 }
static int be_quiet
Option &#39;-q&#39;.
struct GNUNET_PeerIdentity peer
Identity of the peer.
static int print_address(void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_TIME_Absolute expiration)
Iterator callback to go over all addresses.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
#define FPRINTF
Definition: plibc.h:683
Structure we use to collect printable address information.
static struct GNUNET_SCHEDULER_Task * tt
Main state machine task (if active).
#define GNUNET_NO
Definition: gnunet_common.h:81
const char * GNUNET_i2s_full(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
static struct GNUNET_PEERINFO_IteratorContext * pic
Current iterator context (if active, otherwise NULL).
Record we keep for each printable address.
static void state_machine(void *cls)
Main state machine that goes over all options and runs the next requested function.
struct GNUNET_HELLO_Message * GNUNET_HELLO_iterate_addresses(const struct GNUNET_HELLO_Message *msg, int return_modified, GNUNET_HELLO_AddressIterator it, void *it_cls)
Iterate over all of the addresses in the HELLO.
Definition: hello.c:254
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
static int count_address(void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_TIME_Absolute expiration)
Iterator callback to go over all addresses and count them.
static struct PrintContext * pc_head
Head of list of print contexts.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
int GNUNET_HELLO_is_friend_only(const struct GNUNET_HELLO_Message *h)
Return HELLO type.
Definition: hello.c:89
static void dump_pc(struct PrintContext *pc)
Print the collected address information to the console and free pc.
static struct GNUNET_FS_PublishContext * pc
Handle to FS-publishing operation.
unsigned int off
Current offset in address_list (counted down).
static struct PrintContext * pc_tail
Tail of list of print contexts.
#define GNUNET_YES
Definition: gnunet_common.h:80
int friend_only
Hello was friend only, GNUNET_YES or GNUNET_NO.
struct AddressRecord * address_list
List of printable addresses.
unsigned int address_list_size
Number of addresses allocated in address_list.
#define GNUNET_malloc(size)
Wrapper around malloc.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ count_addr()

static int count_addr ( void *  cls,
const struct GNUNET_HELLO_Address address,
struct GNUNET_TIME_Absolute  expiration 
)
static

Count the number of addresses in the HELLO.

Parameters
clspointer to an int * used for the counter
addressan address to count
expiration(unused)
Returns
GNUNET_OK

Definition at line 437 of file gnunet-peerinfo.c.

References GNUNET_OK.

Referenced by dump_my_hello().

440 {
441  int *c = cls;
442 
443  (*c)++;
444  return GNUNET_OK;
445 }
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
Here is the caller graph for this function:

◆ dump_my_hello()

static void dump_my_hello ( )
static

Write HELLO of my peer to a file.

Parameters
clsthe struct GetUriContext *
peeridentity of the peer (unused)
helloaddresses of the peer
err_msgerror message

Definition at line 457 of file gnunet-peerinfo.c.

References _, be_quiet, count_addr(), dump_hello, FPRINTF, GNUNET_DISK_fn_write(), GNUNET_DISK_PERM_GROUP_READ, GNUNET_DISK_PERM_OTHER_READ, GNUNET_DISK_PERM_USER_READ, GNUNET_DISK_PERM_USER_WRITE, GNUNET_ERROR_TYPE_BULK, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_HELLO_is_friend_only(), GNUNET_HELLO_iterate_addresses(), GNUNET_HELLO_size(), GNUNET_log_strerror_file, GNUNET_NO, GNUNET_SYSERR, GNUNET_YES, size, and UNLINK.

Referenced by hello_callback().

458 {
459  unsigned int size;
460  unsigned int c_addr;
461 
462  size = GNUNET_HELLO_size (my_hello);
463  if (0 == size)
464  {
465  FPRINTF (stderr,
466  _("Failure: Received invalid %s\n"),
467  "HELLO");
468  return;
469  }
470  if (GNUNET_SYSERR ==
472  my_hello,
473  size,
478  {
479  FPRINTF (stderr,
480  _("Failed to write HELLO with %u bytes to file `%s'\n"),
481  size,
482  dump_hello);
483  if (0 != UNLINK (dump_hello))
486  "unlink",
487  dump_hello);
488 
489  }
490  c_addr = 0;
492  GNUNET_NO,
493  count_addr,
494  &c_addr);
495 
496  if (! be_quiet)
497  {
498  FPRINTF (stderr,
499  _("Wrote %s HELLO containing %u addresses with %u bytes to file `%s'\n"),
500  (GNUNET_YES == GNUNET_HELLO_is_friend_only (my_hello)) ? "friend-only": "public",
501  c_addr,
502  size,
503  dump_hello);
504  }
506  dump_hello = NULL;
507 }
static int be_quiet
Option &#39;-q&#39;.
#define FPRINTF
Definition: plibc.h:683
#define GNUNET_NO
Definition: gnunet_common.h:81
static char * dump_hello
Option -d.
ssize_t GNUNET_DISK_fn_write(const char *fn, const void *buffer, size_t n, enum GNUNET_DISK_AccessPermissions mode)
Write a buffer to a file.
Definition: disk.c:1203
#define UNLINK(f)
Definition: plibc.h:666
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
struct GNUNET_HELLO_Message * GNUNET_HELLO_iterate_addresses(const struct GNUNET_HELLO_Message *msg, int return_modified, GNUNET_HELLO_AddressIterator it, void *it_cls)
Iterate over all of the addresses in the HELLO.
Definition: hello.c:254
#define GNUNET_log_strerror_file(level, cmd, filename)
Log an error message at log-level &#39;level&#39; that indicates a failure of the command &#39;cmd&#39; with the mess...
static struct GNUNET_HELLO_Message * my_hello
Hello of this peer (if initialized).
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
static unsigned int size
Size of the "table".
Definition: peer.c:67
int GNUNET_HELLO_is_friend_only(const struct GNUNET_HELLO_Message *h)
Return HELLO type.
Definition: hello.c:89
static int count_addr(void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_TIME_Absolute expiration)
Count the number of addresses in the HELLO.
Everybody can read.
uint16_t GNUNET_HELLO_size(const struct GNUNET_HELLO_Message *hello)
Return the size of the given HELLO message.
Definition: hello.c:649
#define GNUNET_YES
Definition: gnunet_common.h:80
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_my_uri()

static void print_my_uri ( void *  cls,
const struct GNUNET_PeerIdentity peer,
const struct GNUNET_HELLO_Message hello,
const char *  err_msg 
)
static

Print URI of the peer.

Parameters
clsthe struct GetUriContext *
peeridentity of the peer (unused)
helloaddresses of the peer
err_msgerror message

Definition at line 522 of file gnunet-peerinfo.c.

References _, FPRINTF, GNUNET_free, GNUNET_HELLO_compose_uri(), GNUNET_SCHEDULER_add_now(), GPI_plugins_find(), state_machine(), and uri.

Referenced by state_machine().

526 {
527  char *uri;
528 
529  if (NULL == peer)
530  {
531  pic = NULL;
532  if (NULL != err_msg)
533  FPRINTF (stderr,
534  _("Error in communication with PEERINFO service: %s\n"),
535  err_msg);
537  return;
538  }
539 
540  if (NULL == hello)
541  return;
542  uri = GNUNET_HELLO_compose_uri (hello,
544  if (NULL != uri)
545  {
546  printf ("%s\n",
547  (const char *) uri);
548  GNUNET_free (uri);
549  }
550 }
#define FPRINTF
Definition: plibc.h:683
char * GNUNET_HELLO_compose_uri(const struct GNUNET_HELLO_Message *hello, GNUNET_HELLO_TransportPluginsFind plugins_find)
Compose a hello URI string from a hello message.
Definition: hello.c:1028
static struct GNUNET_SCHEDULER_Task * tt
Main state machine task (if active).
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
static struct GNUNET_FS_Uri * uri
Value of URI provided on command-line (when not publishing a file but just creating UBlocks to refer ...
static struct GNUNET_PEERINFO_IteratorContext * pic
Current iterator context (if active, otherwise NULL).
static void state_machine(void *cls)
Main state machine that goes over all options and runs the next requested function.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
struct GNUNET_TRANSPORT_PluginFunctions * GPI_plugins_find(const char *name)
Obtain the plugin API based on a plugin name.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_continuation()

static void add_continuation ( void *  cls)
static

Continuation called from GNUNET_PEERINFO_add_peer()

Parameters
clsclosure, NULL

Definition at line 562 of file gnunet-peerinfo.c.

References GNUNET_SCHEDULER_add_now(), and state_machine().

Referenced by parse_hello_uri().

563 {
564  ac = NULL;
566 }
static struct GNUNET_SCHEDULER_Task * tt
Main state machine task (if active).
static void state_machine(void *cls)
Main state machine that goes over all options and runs the next requested function.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
static struct GNUNET_MQ_Envelope * ac
Handle to current GNUNET_PEERINFO_add_peer() operation.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_hello_uri()

static int parse_hello_uri ( const char *  put_uri)
static

Parse the PUT URI given at the command line and add it to our peerinfo database.

Parameters
put_uriURI string to parse
Returns
GNUNET_OK on success, GNUNET_SYSERR if the URI was invalid, GNUNET_NO on other errors

Definition at line 579 of file gnunet-peerinfo.c.

References add_continuation(), GNUNET_free, GNUNET_HELLO_parse_uri(), GNUNET_OK, GNUNET_PEERINFO_add_peer(), GNUNET_SCHEDULER_add_now(), GPI_plugins_find(), my_peer_identity, GNUNET_PeerIdentity::public_key, ret, and state_machine().

Referenced by state_machine().

580 {
581  struct GNUNET_HELLO_Message *hello = NULL;
582 
585  &hello,
587 
588  if (NULL != hello)
589  {
590  /* WARNING: this adds the address from URI WITHOUT verification! */
591  if (GNUNET_OK == ret)
593  hello,
595  NULL);
596  else
598  GNUNET_free (hello);
599  }
600  return ret;
601 }
static void add_continuation(void *cls)
Continuation called from GNUNET_PEERINFO_add_peer()
A HELLO message is used to exchange information about transports with other peers.
static struct GNUNET_SCHEDULER_Task * tt
Main state machine task (if active).
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
static int ret
Final status code.
Definition: gnunet-arm.c:89
static char * put_uri
Option.
static struct GNUNET_PEERINFO_Handle * peerinfo
Handle to peerinfo service.
static void state_machine(void *cls)
Main state machine that goes over all options and runs the next requested function.
int GNUNET_HELLO_parse_uri(const char *uri, struct GNUNET_CRYPTO_EddsaPublicKey *pubkey, struct GNUNET_HELLO_Message **hello, GNUNET_HELLO_TransportPluginsFind plugins_find)
Parse a hello URI string to a hello message.
Definition: hello.c:1213
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
struct GNUNET_MQ_Envelope * GNUNET_PEERINFO_add_peer(struct GNUNET_PEERINFO_Handle *h, const struct GNUNET_HELLO_Message *hello, GNUNET_SCHEDULER_TaskCallback cont, void *cont_cls)
Add a host to the persistent list.
Definition: peerinfo_api.c:557
static struct GNUNET_MQ_Envelope * ac
Handle to current GNUNET_PEERINFO_add_peer() operation.
static struct GNUNET_PeerIdentity my_peer_identity
My peer identity.
struct GNUNET_TRANSPORT_PluginFunctions * GPI_plugins_find(const char *name)
Obtain the plugin API based on a plugin name.
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_CRYPTO_EddsaPublicKey public_key
Here is the call graph for this function:
Here is the caller graph for this function:

◆ shutdown_task()

static void shutdown_task ( void *  cls)
static

Main state machine that goes over all options and runs the next requested function.

Parameters
clsunused

Definition at line 614 of file gnunet-peerinfo.c.

References PrintContext::address_list, PrintContext::address_list_size, AddressRecord::atsc, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_free_non_null, GNUNET_MQ_send_cancel(), GNUNET_PEERINFO_disconnect(), GNUNET_PEERINFO_iterate_cancel(), GNUNET_SCHEDULER_cancel(), GNUNET_TRANSPORT_address_to_string_cancel(), GNUNET_TRANSPORT_hello_get_cancel(), GPI_plugins_unload(), AddressRecord::pc, and AddressRecord::result.

Referenced by run().

615 {
616  struct PrintContext *pc;
617  struct AddressRecord *ar;
618  unsigned int i;
619 
620  if (NULL != ac)
621  {
623  ac = NULL;
624  }
625  if (NULL != tt)
626  {
628  tt = NULL;
629  }
630  if (NULL != pic)
631  {
633  pic = NULL;
634  }
635  if (NULL != gh)
636  {
638  gh = NULL;
639  }
640  while (NULL != (pc = pc_head))
641  {
643  pc_tail,
644  pc);
645  for (i=0;i<pc->address_list_size;i++)
646  {
647  ar = &pc->address_list[i];
649  if (NULL != ar->atsc)
650  {
652  ar->atsc = NULL;
653  }
654  }
656  GNUNET_free (pc);
657  }
659  if (NULL != peerinfo)
660  {
662  peerinfo = NULL;
663  }
664  if (NULL != my_hello)
665  {
667  my_hello = NULL;
668  }
669 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
Structure we use to collect printable address information.
static struct GNUNET_SCHEDULER_Task * tt
Main state machine task (if active).
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
static struct GNUNET_PEERINFO_Handle * peerinfo
Handle to peerinfo service.
static struct GNUNET_PEERINFO_IteratorContext * pic
Current iterator context (if active, otherwise NULL).
void GNUNET_PEERINFO_iterate_cancel(struct GNUNET_PEERINFO_IteratorContext *ic)
Cancel an iteration over peer information.
Definition: peerinfo_api.c:524
Record we keep for each printable address.
void GNUNET_TRANSPORT_address_to_string_cancel(struct GNUNET_TRANSPORT_AddressToStringContext *alc)
Cancel request for address conversion.
static struct PrintContext * pc_head
Head of list of print contexts.
void GPI_plugins_unload()
Unload all plugins.
static struct GNUNET_HELLO_Message * my_hello
Hello of this peer (if initialized).
static struct GNUNET_MQ_Envelope * ac
Handle to current GNUNET_PEERINFO_add_peer() operation.
struct GNUNET_TRANSPORT_AddressToStringContext * atsc
Current address-to-string context (if active, otherwise NULL).
char * result
Printable address.
static struct GNUNET_FS_PublishContext * pc
Handle to FS-publishing operation.
static struct PrintContext * pc_tail
Tail of list of print contexts.
static struct GNUNET_TRANSPORT_HelloGetHandle * gh
Pending GNUNET_TRANSPORT_hello_get() operation.
void GNUNET_PEERINFO_disconnect(struct GNUNET_PEERINFO_Handle *h)
Disconnect from the peerinfo service.
Definition: peerinfo_api.c:159
struct AddressRecord * address_list
List of printable addresses.
unsigned int address_list_size
Number of addresses allocated in address_list.
void GNUNET_MQ_send_cancel(struct GNUNET_MQ_Envelope *ev)
Cancel sending the message.
Definition: mq.c:916
void GNUNET_TRANSPORT_hello_get_cancel(struct GNUNET_TRANSPORT_HelloGetHandle *ghh)
Stop receiving updates about changes to our HELLO message.
#define GNUNET_free(ptr)
Wrapper around free.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:965
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hello_callback()

static void hello_callback ( void *  cls,
const struct GNUNET_MessageHeader hello 
)
static

Function called with our peer's HELLO message.

Used to obtain our peer's public key.

Parameters
clsNULL
hellothe HELLO message

Definition at line 680 of file gnunet-peerinfo.c.

References dump_hello, dump_my_hello(), GNUNET_assert, GNUNET_copy_message(), GNUNET_HELLO_get_id(), GNUNET_OK, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_shutdown(), GNUNET_TRANSPORT_hello_get_cancel(), my_peer_identity, and state_machine().

Referenced by run().

682 {
683  if (NULL == hello)
684  {
685  fprintf (stderr,
686  "Failed to get my own HELLO from this peer!\n");
688  return;
689  }
693  &my_peer_identity));
695  gh = NULL;
696  if (NULL != dump_hello)
697  dump_my_hello ();
699 }
int GNUNET_HELLO_get_id(const struct GNUNET_HELLO_Message *hello, struct GNUNET_PeerIdentity *peer)
Get the peer identity from a HELLO message.
Definition: hello.c:668
A HELLO message is used to exchange information about transports with other peers.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static struct GNUNET_SCHEDULER_Task * tt
Main state machine task (if active).
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:524
static char * dump_hello
Option -d.
static void state_machine(void *cls)
Main state machine that goes over all options and runs the next requested function.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
static struct GNUNET_HELLO_Message * my_hello
Hello of this peer (if initialized).
static struct GNUNET_PeerIdentity my_peer_identity
My peer identity.
static struct GNUNET_TRANSPORT_HelloGetHandle * gh
Pending GNUNET_TRANSPORT_hello_get() operation.
static void dump_my_hello()
Write HELLO of my peer to a file.
void GNUNET_TRANSPORT_hello_get_cancel(struct GNUNET_TRANSPORT_HelloGetHandle *ghh)
Stop receiving updates about changes to our HELLO message.
struct GNUNET_MessageHeader * GNUNET_copy_message(const struct GNUNET_MessageHeader *msg)
Create a copy of the given message.
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 711 of file gnunet-peerinfo.c.

References _, dump_hello, FPRINTF, get_self, get_uri, GNUNET_PEERINFO_connect(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_strdup, GNUNET_TRANSPORT_AC_ANY, GNUNET_TRANSPORT_hello_get(), GNUNET_YES, hello_callback(), put_uri, shutdown_task(), and state_machine().

Referenced by main().

715 {
716  cfg = c;
717  if ( (NULL != args[0]) &&
718  (NULL == put_uri) &&
719  (args[0] == strcasestr (args[0],
720  "gnunet://hello/")) )
721  {
722  put_uri = GNUNET_strdup (args[0]);
723  args++;
724  }
725  if (NULL != args[0])
726  {
727  FPRINTF (stderr,
728  _("Invalid command line argument `%s'\n"),
729  args[0]);
730  return;
731  }
732  if (NULL == (peerinfo = GNUNET_PEERINFO_connect (cfg)))
733  {
734  FPRINTF (stderr,
735  "%s",
736  "Could not access PEERINFO service. Exiting.\n");
737  return;
738  }
739  if ( (GNUNET_YES == get_self) ||
740  (GNUNET_YES == get_uri) ||
741  (NULL != dump_hello) )
742  {
746  NULL);
747  }
748  else
749  {
751  NULL);
752  }
754  NULL);
755 }
static void shutdown_task(void *cls)
Main state machine that goes over all options and runs the next requested function.
struct GNUNET_PEERINFO_Handle * GNUNET_PEERINFO_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the peerinfo service.
Definition: peerinfo_api.c:133
#define FPRINTF
Definition: plibc.h:683
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, or when GNUNET_SCHEDULER_shutdown() is being invoked.
Definition: scheduler.c:1293
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration handle.
static struct GNUNET_SCHEDULER_Task * tt
Main state machine task (if active).
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
static char * put_uri
Option.
static char * dump_hello
Option -d.
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
static int get_uri
Option.
static struct GNUNET_PEERINFO_Handle * peerinfo
Handle to peerinfo service.
static void state_machine(void *cls)
Main state machine that goes over all options and runs the next requested function.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
static void hello_callback(void *cls, const struct GNUNET_MessageHeader *hello)
Function called with our peer&#39;s HELLO message.
static int get_self
Option &#39;-s&#39;.
struct GNUNET_TRANSPORT_HelloGetHandle * GNUNET_TRANSPORT_hello_get(const struct GNUNET_CONFIGURATION_Handle *cfg, enum GNUNET_TRANSPORT_AddressClass ac, GNUNET_TRANSPORT_HelloUpdateCallback rec, void *rec_cls)
Obtain updates on changes to the HELLO message for this peer.
static struct GNUNET_TRANSPORT_HelloGetHandle * gh
Pending GNUNET_TRANSPORT_hello_get() operation.
#define GNUNET_YES
Definition: gnunet_common.h:80
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 obtain peer information.

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

Definition at line 838 of file gnunet-peerinfo.c.

References be_quiet, default_operation, dump_hello, get_info, get_self, get_uri, gettext_noop, GNUNET_free, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_string(), GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_STRINGS_get_utf8_args(), GNUNET_YES, include_friend_only, no_resolve, put_uri, ret, and run().

839 {
842  "numeric",
843  gettext_noop ("don't resolve host names"),
844  &no_resolve),
845 
847  "quiet",
848  gettext_noop ("output only the identity strings"),
849  &be_quiet),
851  "friends",
852  gettext_noop ("include friend-only information"),
854 
856  "self",
857  gettext_noop ("output our own identity only"),
858  &get_self),
859 
861  "info",
862  gettext_noop ("list all known peers"),
863  &get_info),
864 
866  "dump-hello",
867  NULL,
868  gettext_noop ("dump hello to file"),
869  &dump_hello),
870 
872  "get-hello",
873  gettext_noop ("also output HELLO uri(s)"),
874  &get_uri),
875 
877  "put-hello",
878  "HELLO",
879  gettext_noop ("add given HELLO uri to the database"),
880  &put_uri),
881 
883  };
884  int ret;
885 
888  argv,
889  &argc,
890  &argv))
891  return 2;
892 
893  ret = (GNUNET_OK ==
894  GNUNET_PROGRAM_run (argc,
895  argv,
896  "gnunet-peerinfo",
897  gettext_noop ("Print information about peers."),
898  options,
899  &run,
900  NULL)) ? 0 : 1;
901  GNUNET_free ((void*) argv);
902  return ret;
903 }
static int default_operation
Option.
static int be_quiet
Option &#39;-q&#39;.
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
int GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
Definition: strings.c:1521
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.
static int include_friend_only
Option &#39;-f&#39;.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
Definition of a command line option.
static int ret
Final status code.
Definition: gnunet-arm.c:89
static char * put_uri
Option.
static char * dump_hello
Option -d.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
Definition: 002.c:13
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.
static int get_uri
Option.
static int no_resolve
Option &#39;-n&#39;.
static int get_self
Option &#39;-s&#39;.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_flag(char shortName, const char *name, const char *description, int *val)
Allow user to specify a flag (which internally means setting an integer to 1/GNUNET_YES/GNUNET_OK.
int 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, parse options).
Definition: program.c:361
#define GNUNET_YES
Definition: gnunet_common.h:80
static int get_info
Option &#39;-i&#39;.
#define GNUNET_free(ptr)
Wrapper around free.
#define gettext_noop(String)
Definition: gettext.h:69
Here is the call graph for this function:

Variable Documentation

◆ no_resolve

int no_resolve
static

Option '-n'.

Definition at line 124 of file gnunet-peerinfo.c.

Referenced by main(), and print_address().

◆ be_quiet

int be_quiet
static

Option '-q'.

Definition at line 129 of file gnunet-peerinfo.c.

Referenced by dump_my_hello(), main(), print_peer_info(), and state_machine().

◆ include_friend_only

int include_friend_only
static

Option '-f'.

Definition at line 134 of file gnunet-peerinfo.c.

Referenced by main(), peerinfo_get(), and state_machine().

◆ get_self

int get_self
static

Option '-s'.

Definition at line 139 of file gnunet-peerinfo.c.

Referenced by main(), run(), and state_machine().

◆ get_uri

int get_uri
static

Option.

Definition at line 144 of file gnunet-peerinfo.c.

Referenced by main(), run(), and state_machine().

◆ default_operation

int default_operation
static

Option.

Definition at line 149 of file gnunet-peerinfo.c.

Referenced by main(), and state_machine().

◆ get_info

int get_info
static

Option '-i'.

Definition at line 154 of file gnunet-peerinfo.c.

Referenced by main(), and state_machine().

◆ put_uri

char* put_uri
static

Option.

Definition at line 159 of file gnunet-peerinfo.c.

Referenced by main(), run(), and state_machine().

◆ dump_hello

char* dump_hello
static

Option -d.

Definition at line 164 of file gnunet-peerinfo.c.

Referenced by dump_my_hello(), hello_callback(), main(), and run().

◆ peerinfo

struct GNUNET_PEERINFO_Handle* peerinfo
static

Handle to peerinfo service.

Definition at line 169 of file gnunet-peerinfo.c.

◆ cfg

const struct GNUNET_CONFIGURATION_Handle* cfg
static

Configuration handle.

Definition at line 174 of file gnunet-peerinfo.c.

◆ tt

struct GNUNET_SCHEDULER_Task* tt
static

Main state machine task (if active).

Definition at line 179 of file gnunet-peerinfo.c.

◆ gh

◆ pic

struct GNUNET_PEERINFO_IteratorContext* pic
static

Current iterator context (if active, otherwise NULL).

Definition at line 189 of file gnunet-peerinfo.c.

◆ my_peer_identity

struct GNUNET_PeerIdentity my_peer_identity
static

My peer identity.

Definition at line 194 of file gnunet-peerinfo.c.

Referenced by hello_callback(), parse_hello_uri(), and state_machine().

◆ pc_head

struct PrintContext* pc_head
static

Head of list of print contexts.

Definition at line 199 of file gnunet-peerinfo.c.

◆ pc_tail

struct PrintContext* pc_tail
static

Tail of list of print contexts.

Definition at line 204 of file gnunet-peerinfo.c.

◆ ac

struct GNUNET_MQ_Envelope* ac
static

◆ my_hello

struct GNUNET_HELLO_Message* my_hello
static

Hello of this peer (if initialized).

Definition at line 214 of file gnunet-peerinfo.c.