GNUnet  0.10.x
gnunet-peerinfo.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2001-2014, 2016 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
27 #include "platform.h"
28 #include "gnunet_util_lib.h"
29 #include "gnunet_hello_lib.h"
34 
38 #define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5)
39 
43 struct PrintContext;
44 
48 struct AddressRecord {
53 
58 
62  char *result;
63 
67  struct PrintContext *pc;
68 };
69 
70 
74 struct PrintContext {
78  struct PrintContext *next;
79 
83  struct PrintContext *prev;
84 
89 
94 
98  unsigned int num_addresses;
99 
103  unsigned int address_list_size;
104 
108  unsigned int off;
109 
114 };
115 
116 
120 static int no_resolve;
121 
125 static int be_quiet;
126 
131 
135 static int get_self;
136 
140 static int get_uri;
141 
145 static int default_operation;
146 
150 static int get_info;
151 
155 static char *put_uri;
156 
160 static char *dump_hello;
161 
166 
170 static const struct GNUNET_CONFIGURATION_Handle *cfg;
171 
175 static struct GNUNET_SCHEDULER_Task *tt;
176 
181 
186 
191 
195 static struct PrintContext *pc_head;
196 
200 static struct PrintContext *pc_tail;
201 
205 static struct GNUNET_MQ_Envelope *ac;
206 
211 
212 
219 static void
220 state_machine(void *cls);
221 
222 
223 /* ********************* 'get_info' ******************* */
224 
230 static void
232 {
233  unsigned int i;
234 
235  printf(_("%sPeer `%s'\n"),
236  (GNUNET_YES == pc->friend_only) ? "F2F: " : "",
237  GNUNET_i2s_full(&pc->peer));
238  for (i = 0; i < pc->num_addresses; i++)
239  {
240  if (NULL != pc->address_list[i].result)
241  {
242  printf(_("\tExpires: %s \t %s\n"),
244  pc->address_list[i].expiration),
245  pc->address_list[i].result);
247  }
248  }
249  printf("\n");
251  GNUNET_CONTAINER_DLL_remove(pc_head, pc_tail, pc);
252  GNUNET_free(pc);
253  if ((NULL == pc_head) && (NULL == pic))
255 }
256 
257 
258 /* ************************* list all known addresses **************** */
259 
260 
271 static void
272 process_resolved_address(void *cls, const char *address, int res)
273 {
274  struct AddressRecord *ar = cls;
275  struct PrintContext *pc = ar->pc;
276 
277  if (NULL != address)
278  {
279  if (0 != strlen(address))
280  {
281  if (NULL != ar->result)
282  GNUNET_free(ar->result);
283  ar->result = GNUNET_strdup(address);
284  }
285  return;
286  }
287  ar->atsc = NULL;
288  if (GNUNET_SYSERR == res)
290  _("Failure: Cannot convert address to string for peer `%s'\n"),
291  GNUNET_i2s(&ar->pc->peer));
292  pc->num_addresses++;
293  if (pc->num_addresses == pc->address_list_size)
294  dump_pc(pc);
295 }
296 
297 
306 static int
307 count_address(void *cls,
308  const struct GNUNET_HELLO_Address *address,
310 {
311  struct PrintContext *pc = cls;
312 
313  pc->off++;
314  return GNUNET_OK;
315 }
316 
317 
326 static int
327 print_address(void *cls,
328  const struct GNUNET_HELLO_Address *address,
330 {
331  struct PrintContext *pc = cls;
332  struct AddressRecord *ar;
333 
334  GNUNET_assert(0 < pc->off);
335  ar = &pc->address_list[--pc->off];
336  ar->pc = pc;
337  ar->expiration = expiration;
338  GNUNET_asprintf(&ar->result,
339  "%s:%u:%u",
340  address->transport_name,
341  address->address_length,
342  address->local_info);
344  address,
345  no_resolve,
346  TIMEOUT,
348  ar);
349  return GNUNET_OK;
350 }
351 
352 
362 static void
363 print_peer_info(void *cls,
364  const struct GNUNET_PeerIdentity *peer,
365  const struct GNUNET_HELLO_Message *hello,
366  const char *err_msg)
367 {
368  struct PrintContext *pc;
369  int friend_only;
370 
371  if (NULL == peer)
372  {
373  pic = NULL; /* end of iteration */
374  if (NULL != err_msg)
375  {
376  fprintf(stderr,
377  _("Error in communication with PEERINFO service: %s\n"),
378  err_msg);
379  }
380  if (NULL == pc_head)
382  return;
383  }
384  friend_only = GNUNET_NO;
385  if (NULL != hello)
386  friend_only = GNUNET_HELLO_is_friend_only(hello);
387  if ((GNUNET_YES == be_quiet) || (NULL == hello))
388  {
389  printf("%s%s\n",
390  (GNUNET_YES == friend_only) ? "F2F: " : "",
391  GNUNET_i2s_full(peer));
392  return;
393  }
394  pc = GNUNET_new(struct PrintContext);
395  GNUNET_CONTAINER_DLL_insert(pc_head, pc_tail, pc);
396  pc->peer = *peer;
397  pc->friend_only = friend_only;
399  if (0 == pc->off)
400  {
401  dump_pc(pc);
402  return;
403  }
404  pc->address_list_size = pc->off;
405  pc->address_list = GNUNET_malloc(sizeof(struct AddressRecord) * pc->off);
407 }
408 
409 /* ************************* DUMP Hello ************************** */
410 
419 static int
420 count_addr(void *cls,
421  const struct GNUNET_HELLO_Address *address,
423 {
424  int *c = cls;
425 
426  (*c)++;
427  return GNUNET_OK;
428 }
429 
430 
439 static void
441 {
442  unsigned int size;
443  unsigned int c_addr;
444 
445  size = GNUNET_HELLO_size(my_hello);
446  if (0 == size)
447  {
448  fprintf(stderr, _("Failure: Received invalid %s\n"), "HELLO");
449  return;
450  }
452  my_hello,
453  size,
458  {
459  fprintf(stderr,
460  _("Failed to write HELLO with %u bytes to file `%s'\n"),
461  size,
462  dump_hello);
463  if (0 != unlink(dump_hello))
466  "unlink",
467  dump_hello);
468  }
469  c_addr = 0;
471 
472  if (!be_quiet)
473  {
474  fprintf(
475  stderr,
476  _("Wrote %s HELLO containing %u addresses with %u bytes to file `%s'\n"),
477  (GNUNET_YES == GNUNET_HELLO_is_friend_only(my_hello)) ? "friend-only"
478  : "public",
479  c_addr,
480  size,
481  dump_hello);
482  }
484  dump_hello = NULL;
485 }
486 
487 
488 /* ************************* GET URI ************************** */
489 
490 
499 static void
500 print_my_uri(void *cls,
501  const struct GNUNET_PeerIdentity *peer,
502  const struct GNUNET_HELLO_Message *hello,
503  const char *err_msg)
504 {
505  char *uri;
506 
507  if (NULL == peer)
508  {
509  pic = NULL;
510  if (NULL != err_msg)
511  fprintf(stderr,
512  _("Error in communication with PEERINFO service: %s\n"),
513  err_msg);
515  return;
516  }
517 
518  if (NULL == hello)
519  return;
521  if (NULL != uri)
522  {
523  printf("%s\n", (const char *)uri);
524  GNUNET_free(uri);
525  }
526 }
527 
528 
529 /* ************************* import HELLO by URI ********************* */
530 
531 
537 static void
539 {
540  ac = NULL;
542 }
543 
544 
554 static int
556 {
557  struct GNUNET_HELLO_Message *hello = NULL;
558 
559  int ret = GNUNET_HELLO_parse_uri(put_uri,
561  &hello,
563 
564  if (NULL != hello)
565  {
566  /* WARNING: this adds the address from URI WITHOUT verification! */
567  if (GNUNET_OK == ret)
568  ac = GNUNET_PEERINFO_add_peer(peerinfo, hello, &add_continuation, NULL);
569  else
571  GNUNET_free(hello);
572  }
573  return ret;
574 }
575 
576 
577 /* ************************ Main state machine ********************* */
578 
579 
586 static void
587 shutdown_task(void *cls)
588 {
589  struct PrintContext *pc;
590  struct AddressRecord *ar;
591  unsigned int i;
592 
593  if (NULL != ac)
594  {
596  ac = NULL;
597  }
598  if (NULL != tt)
599  {
601  tt = NULL;
602  }
603  if (NULL != pic)
604  {
606  pic = NULL;
607  }
608  if (NULL != gh)
609  {
611  gh = NULL;
612  }
613  while (NULL != (pc = pc_head))
614  {
615  GNUNET_CONTAINER_DLL_remove(pc_head, pc_tail, pc);
616  for (i = 0; i < pc->address_list_size; i++)
617  {
618  ar = &pc->address_list[i];
620  if (NULL != ar->atsc)
621  {
623  ar->atsc = NULL;
624  }
625  }
627  GNUNET_free(pc);
628  }
630  if (NULL != peerinfo)
631  {
632  GNUNET_PEERINFO_disconnect(peerinfo);
633  peerinfo = NULL;
634  }
635  if (NULL != my_hello)
636  {
637  GNUNET_free(my_hello);
638  my_hello = NULL;
639  }
640 }
641 
642 
650 static void
651 hello_callback(void *cls, const struct GNUNET_MessageHeader *hello)
652 {
653  if (NULL == hello)
654  {
655  fprintf(stderr, "Failed to get my own HELLO from this peer!\n");
657  return;
658  }
659  my_hello = (struct GNUNET_HELLO_Message *)GNUNET_copy_message(hello);
663  gh = NULL;
664  if (NULL != dump_hello)
665  dump_my_hello();
667 }
668 
669 
678 static void
679 run(void *cls,
680  char *const *args,
681  const char *cfgfile,
682  const struct GNUNET_CONFIGURATION_Handle *c)
683 {
684  cfg = c;
685  if ((NULL != args[0]) && (NULL == put_uri) &&
686  (args[0] == strcasestr(args[0], "gnunet://hello/")))
687  {
688  put_uri = GNUNET_strdup(args[0]);
689  args++;
690  }
691  if (NULL != args[0])
692  {
693  fprintf(stderr, _("Invalid command line argument `%s'\n"), args[0]);
694  return;
695  }
696  if (NULL == (peerinfo = GNUNET_PEERINFO_connect(cfg)))
697  {
698  fprintf(stderr, "%s", "Could not access PEERINFO service. Exiting.\n");
699  return;
700  }
701  if ((GNUNET_YES == get_self) || (GNUNET_YES == get_uri) ||
702  (NULL != dump_hello))
703  {
707  NULL);
708  }
709  else
710  {
712  }
714 }
715 
716 
723 static void
724 state_machine(void *cls)
725 {
726  tt = NULL;
727 
728  if (NULL != put_uri)
729  {
730  GPI_plugins_load(cfg);
732  {
733  fprintf(stderr, _("Invalid URI `%s'\n"), put_uri);
735  }
737  put_uri = NULL;
738  }
739  else if (GNUNET_YES == get_info)
740  {
742  GPI_plugins_load(cfg);
743  pic = GNUNET_PEERINFO_iterate(peerinfo,
745  NULL,
747  NULL);
748  }
749  else if (GNUNET_YES == get_self)
750  {
752  if (be_quiet)
753  printf("%s\n", GNUNET_i2s_full(&my_peer_identity));
754  else
755  printf(_("I am peer `%s'.\n"), GNUNET_i2s_full(&my_peer_identity));
757  }
758  else if (GNUNET_YES == get_uri)
759  {
760  GPI_plugins_load(cfg);
761  pic = GNUNET_PEERINFO_iterate(peerinfo,
764  &print_my_uri,
765  NULL);
766  get_uri = GNUNET_NO;
767  }
768  else if (GNUNET_YES == default_operation)
769  {
770  /* default operation list all */
774  }
775  else
776  {
778  }
780 }
781 
782 
790 int
791 main(int argc, char *const *argv)
792 {
793  struct GNUNET_GETOPT_CommandLineOption options[] =
795  "numeric",
796  gettext_noop("don't resolve host names"),
797  &no_resolve),
798 
800  "quiet",
801  gettext_noop(
802  "output only the identity strings"),
803  &be_quiet),
805  "friends",
806  gettext_noop(
807  "include friend-only information"),
809 
811  "self",
812  gettext_noop("output our own identity only"),
813  &get_self),
814 
816  "info",
817  gettext_noop("list all known peers"),
818  &get_info),
819 
821  "dump-hello",
822  NULL,
823  gettext_noop("dump hello to file"),
824  &dump_hello),
825 
827  "get-hello",
828  gettext_noop("also output HELLO uri(s)"),
829  &get_uri),
830 
832  "put-hello",
833  "HELLO",
834  gettext_noop(
835  "add given HELLO uri to the database"),
836  &put_uri),
837 
839  int ret;
840 
842  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args(argc, argv, &argc, &argv))
843  return 2;
844 
845  ret = (GNUNET_OK ==
846  GNUNET_PROGRAM_run(argc,
847  argv,
848  "gnunet-peerinfo",
849  gettext_noop("Print information about peers."),
850  options,
851  &run,
852  NULL))
853  ? 0
854  : 1;
855  GNUNET_free((void *)argv);
856  return ret;
857 }
858 
859 /* end of gnunet-peerinfo.c */
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
size_t address_length
Number of bytes in address.
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:662
static int default_operation
Option.
enum GNUNET_HELLO_AddressInfo local_info
Extended information about address.
static void add_continuation(void *cls)
Continuation called from GNUNET_PEERINFO_add_peer()
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.
Handle to the peerinfo service.
Definition: peerinfo_api.c:83
A HELLO message is used to exchange information about transports with other peers.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
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:128
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:1284
struct PrintContext * pc
Print context this address record belongs to.
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:1020
int GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
Definition: strings.c:1439
Structure we use to collect printable address information.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
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 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 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 &#39;-f&#39;.
#define GNUNET_NO
Definition: gnunet_common.h:78
const char * GNUNET_i2s_full(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
Definition of a command line option.
#define TIMEOUT
How long until we time out during address lookup?
struct PrintContext * next
Kept in DLL.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:517
static int ret
Final status code.
Definition: gnunet-arm.c:89
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
static char * put_uri
Option.
Context for an iteration request.
Definition: peerinfo_api.c:37
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:877
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.
#define _(String)
GNU gettext support macro.
Definition: platform.h:181
static int get_uri
Option.
int main(int argc, char *const *argv)
The main function to obtain peer information.
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:486
static struct GNUNET_FS_Uri * uri
Value of URI provided on command-line (when not publishing a file but just creating UBlocks to refer ...
unsigned int num_addresses
Number of completed addresses in address_list.
static struct GNUNET_PEERINFO_Handle * peerinfo
Handle to peerinfo service.
int GNUNET_asprintf(char **buf, const char *format,...)
Like asprintf, just portable.
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:519
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:252
#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...
void GNUNET_TRANSPORT_address_to_string_cancel(struct GNUNET_TRANSPORT_AddressToStringContext *alc)
Cancel request for address conversion.
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:1205
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:1264
const char * transport_name
Name of the transport plugin enabling the communication using this address.
plugin management API
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.
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.
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:552
static void hello_callback(void *cls, const struct GNUNET_MessageHeader *hello)
Function called with our peer&#39;s HELLO message.
struct PrintContext * prev
Kept in DLL.
static int res
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).
struct GNUNET_TIME_Absolute expiration
Address expiration time.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
static unsigned int size
Size of the "table".
Definition: peer.c:66
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.
int GNUNET_HELLO_is_friend_only(const struct GNUNET_HELLO_Message *h)
Return HELLO type.
Definition: hello.c:87
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_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 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.
The identity of the host (wraps the signing key of the peer).
unsigned int off
Current offset in address_list (counted down).
configuration data
Definition: configuration.c:83
static struct PrintContext * pc_tail
Tail of list of print contexts.
void GPI_plugins_load(const struct GNUNET_CONFIGURATION_Handle *cfg)
Load and initialize all plugins.
An address for communicating with a peer.
static int get_self
Option &#39;-s&#39;.
struct GNUNET_TRANSPORT_PluginFunctions * GPI_plugins_find(const char *name)
Obtain the plugin API based on a plugin name.
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.
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_log(kind,...)
Entry in list of pending tasks.
Definition: scheduler.c:131
uint16_t GNUNET_HELLO_size(const struct GNUNET_HELLO_Message *hello)
Return the size of the given HELLO message.
Definition: hello.c:643
void GNUNET_PEERINFO_disconnect(struct GNUNET_PEERINFO_Handle *h)
Disconnect from the peerinfo service.
Definition: peerinfo_api.c:154
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:367
Functions to call with this peer&#39;s HELLO.
Header for all communications.
Time for absolute times used by GNUnet, in microseconds.
#define GNUNET_YES
Definition: gnunet_common.h:77
int friend_only
Hello was friend only, GNUNET_YES or GNUNET_NO.
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.
static void dump_my_hello()
Write HELLO of my peer to a file.
const char * GNUNET_STRINGS_absolute_time_to_string(struct GNUNET_TIME_Absolute t)
Like asctime, except for GNUnet time.
Definition: strings.c:741
unsigned int address_list_size
Number of addresses allocated in address_list.
static char * address
GNS address for this phone.
void GNUNET_MQ_send_cancel(struct GNUNET_MQ_Envelope *ev)
Cancel sending the message.
Definition: mq.c:913
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
void GNUNET_TRANSPORT_hello_get_cancel(struct GNUNET_TRANSPORT_HelloGetHandle *ghh)
Stop receiving updates about changes to our HELLO message.
#define GNUNET_malloc(size)
Wrapper around malloc.
static int get_info
Option &#39;-i&#39;.
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_CRYPTO_EddsaPublicKey public_key
struct GNUNET_MessageHeader * GNUNET_copy_message(const struct GNUNET_MessageHeader *msg)
Create a copy of the given message.
#define gettext_noop(String)
Definition: gettext.h:69
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:956