GNUnet  0.19.4
gnunet-statistics.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2001, 2002, 2004-2007, 2009, 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"
30 #include "statistics.h"
31 
32 
36 static int ret;
37 
41 static char *subsystem;
42 
46 static char *path_testbed;
47 
51 static char *name;
52 
56 static int persistent;
57 
61 static int watch;
62 
66 static int quiet;
67 
71 static char *csv_separator;
72 
76 static char *remote_host;
77 
81 static unsigned long long remote_port;
82 
86 static unsigned long long set_val;
87 
91 static int set_value;
92 
96 static struct Node
97 {
101  unsigned index_node;
102 
107 
112 
121 } *nodes;
122 
126 static unsigned num_nodes;
127 
131 struct ValueSet
132 {
136  char *subsystem;
137 
141  char *name;
142 
146  uint64_t *values;
147 
152 };
153 
154 
159 
163 static int num_nodes_ready;
164 
169 
170 
180 static struct ValueSet *
182  const char *name,
183  unsigned num_values,
184  int is_persistent)
185 {
186  struct ValueSet *value_set;
187 
188  value_set = GNUNET_new (struct ValueSet);
189  value_set->subsystem = GNUNET_strdup (subsystem);
190  value_set->name = GNUNET_strdup (name);
191  value_set->values = GNUNET_new_array (num_values,
192  uint64_t);
193  value_set->is_persistent = persistent;
194  return value_set;
195 }
196 
197 
209 static int
210 printer (void *cls,
211  const struct GNUNET_HashCode *key,
212  void *value)
213 {
215  const char *now_str;
216  struct ValueSet *value_set = value;
217 
218  if (quiet == GNUNET_NO)
219  {
220  if (GNUNET_YES == watch)
221  {
223  fprintf (stdout,
224  "%24s%s %s%s%12s%s %s%50s%s%s ",
225  now_str,
227  value_set->is_persistent ? "!" : " ",
229  value_set->subsystem,
231  (0 == strlen (csv_separator) ? "" : "\""), /* quotes if csv */
232  _ (value_set->name),
233  (0 == strlen (csv_separator) ? "" : "\""), /* quotes if csv */
234  (0 == strlen (csv_separator) ? ":" : csv_separator));
235  }
236  else
237  {
238  fprintf (stdout,
239  "%s%s%12s%s %s%50s%s%s ",
240  value_set->is_persistent ? "!" : " ",
242  value_set->subsystem,
244  (0 == strlen (csv_separator) ? "" : "\""), /* quotes if csv */
245  _ (value_set->name),
246  (0 == strlen (csv_separator) ? "" : "\""), /* quotes if csv */
247  (0 == strlen (csv_separator) ? ":" : csv_separator));
248  }
249  }
250  for (unsigned i = 0; i < num_nodes; i++)
251  {
252  fprintf (stdout,
253  "%16llu%s",
254  (unsigned long long) value_set->values[i],
255  csv_separator);
256  }
257  fprintf (stdout, "\n");
258  GNUNET_free (value_set->subsystem);
259  GNUNET_free (value_set->name);
260  GNUNET_free (value_set->values);
261  GNUNET_free (value_set);
262  return GNUNET_YES;
263 }
264 
265 
276 static int
277 printer_watch (void *cls,
278  const char *subsystem,
279  const char *name,
280  uint64_t value,
281  int is_persistent)
282 {
284  const char *now_str;
285 
286  if (quiet == GNUNET_NO)
287  {
288  if (GNUNET_YES == watch)
289  {
291  fprintf (stdout,
292  "%24s%s %s%s%12s%s %s%50s%s%s %16llu\n",
293  now_str,
295  is_persistent ? "!" : " ",
297  subsystem,
299  (0 == strlen (csv_separator) ? "" : "\""), /* quotes if csv */
300  _ (name),
301  (0 == strlen (csv_separator) ? "" : "\""), /* quotes if csv */
302  (0 == strlen (csv_separator) ? ":" : csv_separator),
303  (unsigned long long) value);
304  }
305  else
306  {
307  fprintf (stdout,
308  "%s%s%12s%s %s%50s%s%s %16llu\n",
309  is_persistent ? "!" : " ",
311  subsystem,
313  (0 == strlen (csv_separator) ? "" : "\""), /* quotes if csv */
314  _ (name),
315  (0 == strlen (csv_separator) ? "" : "\""), /* quotes if csv */
316  (0 == strlen (csv_separator) ? ":" : csv_separator),
317  (unsigned long long) value);
318  }
319  }
320  else
321  fprintf (stdout, "%llu\n", (unsigned long long) value);
322 
323  return GNUNET_OK;
324 }
325 
326 
334 static void
335 clean_node (void *cls)
336 {
337  const unsigned index_node = *(unsigned *) cls;
338  struct GNUNET_STATISTICS_Handle *h;
340 
341  if ((NULL != path_testbed) && /* were issued with -t <testbed-path> option */
342  (NULL != nodes[index_node].conf))
343  {
345  nodes[index_node].conf = NULL;
346  }
347 
348  h = nodes[index_node].handle;
349  gh = nodes[index_node].gh;
350 
351  if (NULL != gh)
352  {
354  gh = NULL;
355  }
356  if (GNUNET_YES == watch)
357  {
358  GNUNET_assert (
359  GNUNET_OK ==
361  subsystem,
362  name,
363  &printer_watch,
364  &nodes[index_node].index_node));
365  }
366 
367  if (NULL != h)
368  {
370  h = NULL;
371  }
372 
374 }
375 
376 
382 static void
384 {
386  &printer,
387  NULL);
390 }
391 
392 
401 static void
403  int success)
404 {
405  const unsigned index_node = *(unsigned *) cls;
406 
407  nodes[index_node].gh = NULL;
408  if (GNUNET_OK != success)
409  {
410  if (NULL == remote_host)
411  fprintf (stderr,
412  "%s",
413  _ ("Failed to obtain statistics.\n"));
414  else
415  fprintf (stderr,
416  _ ("Failed to obtain statistics from host `%s:%llu'\n"),
417  remote_host,
418  remote_port);
419  ret = 1;
420  }
421  if (NULL != nodes[index_node].shutdown_task)
422  {
424  nodes[index_node].shutdown_task = NULL;
425  }
427  &nodes[index_node].index_node);
428  num_nodes_ready++;
429  if (num_nodes_ready == num_nodes)
430  {
432  NULL);
433  }
434 }
435 
436 
444 static void
445 cleanup (void *cls,
446  int success)
447 {
448  for (unsigned i = 0; i < num_nodes; i++)
449  {
450  nodes[i].gh = NULL;
451  }
452  if (GNUNET_OK != success)
453  {
454  if (NULL == remote_host)
455  fprintf (stderr, "%s", _ ("Failed to obtain statistics.\n"));
456  else
457  fprintf (stderr,
458  _ ("Failed to obtain statistics from host `%s:%llu'\n"),
459  remote_host,
460  remote_port);
461  ret = 1;
462  }
464 }
465 
466 
478 static int
479 collector (void *cls,
480  const char *subsystem,
481  const char *name,
482  uint64_t value,
483  int is_persistent)
484 {
485  const unsigned index_node = *(unsigned *) cls;
486  struct GNUNET_HashCode *key;
487  struct GNUNET_HashCode hc;
488  char *subsys_name;
489  unsigned len_subsys_name;
490  struct ValueSet *value_set;
491 
492  len_subsys_name = strlen (subsystem) + 3 + strlen (name) + 1;
493  subsys_name = GNUNET_malloc (len_subsys_name);
494  sprintf (subsys_name, "%s---%s", subsystem, name);
495  key = &hc;
496  GNUNET_CRYPTO_hash (subsys_name, len_subsys_name, key);
497  GNUNET_free (subsys_name);
499  {
501  }
502  else
503  {
505  }
506  value_set->values[index_node] = value;
509  values,
510  key,
511  value_set,
513  return GNUNET_OK;
514 }
515 
516 
522 static void
523 main_task (void *cls)
524 {
525  unsigned index_node = *(unsigned *) cls;
526  const struct GNUNET_CONFIGURATION_Handle *cfg = nodes[index_node].conf;
527 
528  if (set_value)
529  {
530  if (NULL == subsystem)
531  {
532  fprintf (stderr, "%s", _ ("Missing argument: subsystem \n"));
533  ret = 1;
534  return;
535  }
536  if (NULL == name)
537  {
538  fprintf (stderr, "%s", _ ("Missing argument: name\n"));
539  ret = 1;
540  return;
541  }
543  if (NULL == nodes[index_node].handle)
544  {
545  ret = 1;
546  return;
547  }
548  GNUNET_STATISTICS_set (nodes[index_node].handle,
549  name,
550  (uint64_t) set_val,
551  persistent);
553  nodes[index_node].handle = NULL;
554  return;
555  }
556  if (NULL == (nodes[index_node].handle =
557  GNUNET_STATISTICS_create ("gnunet-statistics", cfg)))
558  {
559  ret = 1;
560  return;
561  }
562  if (GNUNET_NO == watch)
563  {
564  if (NULL == (nodes[index_node].gh =
565  GNUNET_STATISTICS_get (nodes[index_node].handle,
566  subsystem,
567  name,
569  &collector,
570  &nodes[index_node].index_node)))
571  cleanup (nodes[index_node].handle, GNUNET_SYSERR);
572  }
573  else
574  {
575  if ((NULL == subsystem) || (NULL == name))
576  {
577  printf (_ ("No subsystem or name given\n"));
579  nodes[index_node].handle = NULL;
580  ret = 1;
581  return;
582  }
583  if (GNUNET_OK != GNUNET_STATISTICS_watch (nodes[index_node].handle,
584  subsystem,
585  name,
586  &printer_watch,
587  &nodes[index_node].index_node))
588  {
589  fprintf (stderr, _ ("Failed to initialize watch routine\n"));
590  nodes[index_node].shutdown_task =
591  GNUNET_SCHEDULER_add_now (&clean_node, &nodes[index_node].index_node);
592  return;
593  }
594  }
595  nodes[index_node].shutdown_task =
596  GNUNET_SCHEDULER_add_shutdown (&clean_node, &nodes[index_node].index_node);
597 }
598 
599 
611 static int
612 iter_check_config (void *cls,
613  const char *filename)
614 {
615  if (0 == strncmp (GNUNET_STRINGS_get_short_name (filename), "config", 6))
616  {
617  /* Found the config - stop iteration successfully */
620  nodes[num_nodes - 1].index_node = num_nodes - 1;
621  if (GNUNET_OK !=
623  {
624  fprintf (stderr, "Failed loading config `%s'\n", filename);
625  return GNUNET_SYSERR;
626  }
627  return GNUNET_NO;
628  }
629  else
630  {
631  /* Continue iteration */
632  return GNUNET_OK;
633  }
634 }
635 
636 
649 static int
650 iter_testbed_path (void *cls,
651  const char *filename)
652 {
653  unsigned index_node;
654 
655  GNUNET_assert (NULL != filename);
656  if (1 == sscanf (GNUNET_STRINGS_get_short_name (filename),
657  "%u",
658  &index_node))
659  {
662  NULL))
663  {
664  /* This is probably no directory for a testbed node
665  * Go on with iteration */
666  return GNUNET_OK;
667  }
668  return GNUNET_OK;
669  }
670  return GNUNET_OK;
671 }
672 
673 
681 static int
683 {
684  int num_dir_entries;
685 
686  num_dir_entries =
689  NULL);
690  if (-1 == num_dir_entries)
691  {
692  fprintf (stderr,
693  "Failure during scanning directory `%s'\n",
694  path_testbed);
695  return -1;
696  }
697  return 0;
698 }
699 
700 
709 static void
710 run (void *cls,
711  char *const *args,
712  const char *cfgfile,
713  const struct GNUNET_CONFIGURATION_Handle *cfg)
714 {
715  struct GNUNET_CONFIGURATION_Handle *c;
716 
717  c = (struct GNUNET_CONFIGURATION_Handle *) cfg;
719  if (NULL == csv_separator)
720  csv_separator = "";
721  if (NULL != args[0])
722  {
723  if (1 != sscanf (args[0], "%llu", &set_val))
724  {
725  fprintf (stderr, _ ("Invalid argument `%s'\n"), args[0]);
726  ret = 1;
727  return;
728  }
730  }
731  if (NULL != remote_host)
732  {
733  if (0 == remote_port)
734  {
735  if (GNUNET_SYSERR ==
737  "statistics",
738  "PORT",
739  &remote_port))
740  {
741  fprintf (stderr,
742  _ ("A port is required to connect to host `%s'\n"),
743  remote_host);
744  return;
745  }
746  }
747  else if (65535 <= remote_port)
748  {
749  fprintf (stderr,
750  _ (
751  "A port has to be between 1 and 65535 to connect to host `%s'\n"),
752  remote_host);
753  return;
754  }
755 
756  /* Manipulate configuration */
758  "statistics",
759  "UNIXPATH",
760  "");
762  "statistics",
763  "HOSTNAME",
764  remote_host);
766  "statistics",
767  "PORT",
768  remote_port);
769  }
770  if (NULL == path_testbed)
771  {
774  nodes[0].index_node = 0;
775  nodes[0].conf = c;
776  GNUNET_SCHEDULER_add_now (&main_task, &nodes[0].index_node);
777  }
778  else
779  {
780  if (GNUNET_YES == watch)
781  {
782  printf (
783  _ ("Not able to watch testbed nodes (yet - feel free to implement)\n"));
784  ret = 1;
785  return;
786  }
789  {
790  return;
791  }
792  /* For each config/node collect statistics */
793  for (unsigned i = 0; i < num_nodes; i++)
794  {
795  GNUNET_SCHEDULER_add_now (&main_task, &nodes[i].index_node);
796  }
797  }
798 }
799 
800 
808 int
809 main (int argc, char *const *argv)
810 {
813  "name",
814  "NAME",
815  gettext_noop (
816  "limit output to statistics for the given NAME"),
817  &name),
819  "persistent",
820  gettext_noop (
821  "make the value being set persistent"),
822  &persistent),
824  "subsystem",
825  "SUBSYSTEM",
826  gettext_noop (
827  "limit output to the given SUBSYSTEM"),
828  &subsystem),
830  "csv-separator",
831  "CSV_SEPARATOR",
832  gettext_noop ("use as csv separator"),
833  &csv_separator),
835  "testbed",
836  "TESTBED",
837  gettext_noop (
838  "path to the folder containing the testbed data"),
839  &path_testbed),
841  "quiet",
842  gettext_noop (
843  "just print the statistics value"),
844  &quiet),
846  "watch",
847  gettext_noop ("watch value continuously"),
848  &watch),
850  "remote",
851  "REMOTE",
852  gettext_noop ("connect to remote host"),
853  &remote_host),
855  "port",
856  "PORT",
857  gettext_noop ("port for remote host"),
858  &remote_port),
860  };
861 
862  remote_port = 0;
863  remote_host = NULL;
864  if (GNUNET_OK !=
865  GNUNET_STRINGS_get_utf8_args (argc, argv,
866  &argc, &argv))
867  return 2;
868 
869  ret = (GNUNET_OK ==
870  GNUNET_PROGRAM_run (argc,
871  argv,
872  "gnunet-statistics [options [value]]",
873  gettext_noop (
874  "Print statistics about GNUnet operations."),
875  options,
876  &run,
877  NULL))
878  ? ret
879  : 1;
881  num_nodes,
882  0);
884  GNUNET_free_nz ((void *) argv);
885  return ret;
886 }
887 
888 
889 /* end of gnunet-statistics.c */
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 const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
static unsigned int num_values
struct GNUNET_HashCode key
The key used in the DHT.
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
static char * filename
struct GNUNET_SCHEDULER_Task * shutdown_task
static char * value
Value of the record to add/remove.
static struct GNUNET_TRANSPORT_HelloGetHandle * gh
Pending GNUNET_TRANSPORT_hello_get() operation.
static unsigned long long set_val
Value to set.
static int iter_check_config(void *cls, const char *filename)
Iter over content of a node's directory to check for existence of a config file.
static int persistent
Make the value that is being set persistent.
static int set_value
Set operation.
static char * path_testbed
The path of the testbed data.
static struct GNUNET_CONTAINER_MultiHashMap * values
Collection of all values (represented with ValueSet).
static int quiet
Quiet mode.
static int collector(void *cls, const char *subsystem, const char *name, uint64_t value, int is_persistent)
Iterate over statistics values and store them in values.
static void print_finish(void *cls)
Print and shutdown.
static char * name
Set to the specific stat value that we are after (or NULL for all).
static int ret
Final status code.
static char * csv_separator
Separator string for csv.
static int num_nodes_ready
Number of nodes that have their values ready.
static struct Node * nodes
static void continuation_print(void *cls, int success)
Called once all statistic values are available.
static void cleanup(void *cls, int success)
Function called last by the statistics code.
static void clean_node(void *cls)
Clean all data structures related to given node.
static int watch
Watch value continuously.
static struct ValueSet * new_value_set(const char *subsystem, const char *name, unsigned num_values, int is_persistent)
Create a new ValueSet.
static int discover_testbed_nodes(const char *path_testbed)
Count the number of nodes running in the testbed.
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
Main function that will be run by the scheduler.
static int printer_watch(void *cls, const char *subsystem, const char *name, uint64_t value, int is_persistent)
Callback function to process statistic values.
int main(int argc, char *const *argv)
The main function to obtain statistics in GNUnet.
static char * remote_host
Remote host.
static int num_nodes_ready_shutdown
Number of nodes that have their values ready.
static int iter_testbed_path(void *cls, const char *filename)
Iterates over filenames in testbed directory.
static char * subsystem
Set to subsystem that we're going to get stats for (or NULL for all).
static int printer(void *cls, const struct GNUNET_HashCode *key, void *value)
Print the (collected) values.
static unsigned num_nodes
Number of configurations of all (testbed) nodes.
static void main_task(void *cls)
Main task that does the actual work.
static unsigned long long remote_port
Remote host's port.
API to create, modify and access statistics.
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.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create(void)
Create a new configuration object.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
void GNUNET_CONFIGURATION_set_value_number(struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long number)
Set a configuration value that should be a number.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_load(struct GNUNET_CONFIGURATION_Handle *cfg, const char *filename)
Load configuration.
int GNUNET_DISK_directory_scan(const char *dir_name, GNUNET_FileNameCallback callback, void *callback_cls)
Scan a directory for files.
Definition: disk.c:814
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_filename(char shortName, const char *name, const char *argumentHelp, const char *description, char **str)
Allow user to specify a filename (automatically path expanded).
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_ulong(char shortName, const char *name, const char *argumentHelp, const char *description, unsigned long long *val)
Allow user to specify an unsigned long long.
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_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.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition: crypto_hash.c:41
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_contains(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Check if the map contains any value under the given key (including values that are NULL).
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_put(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
void * GNUNET_CONTAINER_multihashmap_get(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Given a key find a value in the map matching the key.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY
There must only be one value per key; storing a value should fail if a value under the same key alrea...
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
@ GNUNET_SYSERR
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_array_grow(arr, size, tsize)
Grow a well-typed (!) array.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_new_array(n, type)
Allocate a size n array with structs or unions of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
#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
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:562
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:1299
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
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:975
int GNUNET_STATISTICS_watch_cancel(struct GNUNET_STATISTICS_Handle *handle, const char *subsystem, const char *name, GNUNET_STATISTICS_Iterator proc, void *proc_cls)
Stop watching statistics from the peer.
void GNUNET_STATISTICS_get_cancel(struct GNUNET_STATISTICS_GetHandle *gh)
Cancel a GNUNET_STATISTICS_get request.
struct GNUNET_STATISTICS_Handle * GNUNET_STATISTICS_create(const char *subsystem, const struct GNUNET_CONFIGURATION_Handle *cfg)
Get handle for the statistics service.
void GNUNET_STATISTICS_set(struct GNUNET_STATISTICS_Handle *handle, const char *name, uint64_t value, int make_persistent)
Set statistic value for the peer.
int GNUNET_STATISTICS_watch(struct GNUNET_STATISTICS_Handle *handle, const char *subsystem, const char *name, GNUNET_STATISTICS_Iterator proc, void *proc_cls)
Watch statistics from the peer (be notified whenever they change).
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).
struct GNUNET_STATISTICS_GetHandle * GNUNET_STATISTICS_get(struct GNUNET_STATISTICS_Handle *handle, const char *subsystem, const char *name, GNUNET_STATISTICS_Callback cont, GNUNET_STATISTICS_Iterator proc, void *cls)
Get statistic from the peer.
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
const char * GNUNET_STRINGS_get_short_name(const char *filename)
"man basename" Returns a pointer to a part of filename (allocates nothing)!
Definition: strings.c:639
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:111
const char * GNUNET_STRINGS_absolute_time_to_string(struct GNUNET_TIME_Absolute t)
Like asctime, except for GNUnet time.
Definition: strings.c:616
Definition: conf.py:1
#define _(String)
GNU gettext support macro.
Definition: platform.h:177
Internal representation of the hash map.
Definition of a command line option.
A 512-bit hashcode.
Entry in list of pending tasks.
Definition: scheduler.c:136
Linked list of things we still need to do.
void * cls
Closure for proc and cont.
Handle for the service.
Time for absolute times used by GNUnet, in microseconds.
Representation of all (testbed) nodes.
struct GNUNET_STATISTICS_GetHandle * gh
Handle for pending GET operation.
struct GNUNET_STATISTICS_Handle * handle
Statistics handle nodes.
struct GNUNET_CONFIGURATION_Handle * conf
Configuration handle for this node.
struct GNUNET_SCHEDULER_Task * shutdown_task
Identifier for shutdown task for this node.
unsigned index_node
Index of the node in this array.
Set of values for a combination of subsystem and name.
char * name
Name of the valueset.
int is_persistent
Persistence of the values.
char * subsystem
Subsystem of the valueset.
uint64_t * values
The values.