GNUnet  0.19.5
testbed_api_testbed.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2008--2013 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 
28 #include "platform.h"
29 #include "gnunet_util_lib.h"
30 #include "gnunet_testbed_service.h"
31 #include "testbed_api.h"
32 #include "testbed_api_peers.h"
33 #include "testbed_api_hosts.h"
34 #include "testbed_api_topology.h"
35 
39 #define LOG(kind, ...) \
40  GNUNET_log_from (kind, "testbed-api-testbed", __VA_ARGS__)
41 
45 #define DEBUG(...) \
46  LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)
47 
51 #define DEFAULT_SETUP_TIMEOUT 300
52 
53 
57 #define TESTBED_CONFIG_SECTION "testbed"
58 
63 #define SCALE_FREE_CAP "SCALE_FREE_TOPOLOGY_CAP"
64 
69 #define SCALE_FREE_M "SCALE_FREE_TOPOLOGY_M"
70 
75 {
80 
85 
89  void *cls;
90 };
91 
92 
96 enum State
97 {
101  RC_INIT = 0,
102 
107 
112 
119 
120  /* /\** */
121  /* * Peers are stopped */
122  /* *\/ */
123  /* RC_PEERS_STOPPED, */
124 
125  /* /\** */
126  /* * Peers are destroyed */
127  /* *\/ */
128  /* RC_PEERS_DESTROYED */
129 
134 };
135 
136 
141 {
146 
151 
155  unsigned int index;
156 };
157 
158 
163 {
168 
175 
180 
185 
190 
194  void *cc_cls;
195 
199  char *trusted_ip;
200 
205 
210 
215 
220 
225 
230 
236 
240  char *topo_file;
241 
246 
251 
256 
261 
266 
270  uint64_t event_mask;
271 
275  enum State state;
276 
281 
285  int shutdown;
286 
290  unsigned int num_hosts;
291 
296  unsigned int reg_hosts;
297 
302  unsigned int peer_count;
303 
307  unsigned int num_peers;
308 
312  unsigned int num_oc;
313 
317  unsigned int random_links;
318 
322  unsigned int links_succeeded;
323 
327  unsigned int links_failed;
328 };
329 
330 
337 static uint32_t
338 rcop_key (void *rcop)
339 {
340  return *((uint32_t *) &rcop);
341 }
342 
343 
347 struct SearchContext
348 {
353 
358 };
359 
360 
369 static int
370 search_iterator (void *cls, uint32_t key, void *value)
371 {
372  struct RunContextOperation *rcop = value;
373  struct SearchContext *sc = cls;
374 
375  GNUNET_assert (NULL != rcop);
376  if (sc->query == rcop->op)
377  {
378  GNUNET_assert (NULL == sc->result);
379  sc->result = rcop;
380  return GNUNET_NO;
381  }
382  return GNUNET_YES;
383 }
384 
385 
394 static struct RunContextOperation *
397 {
398  struct SearchContext sc;
399 
400  sc.query = op;
401  sc.result = NULL;
402  if (GNUNET_SYSERR ==
404  rcop_key (op),
406  &sc))
407  {
408  GNUNET_assert (NULL != sc.result);
409  return sc.result;
410  }
411  return NULL;
412 }
413 
414 
421 static void
423  RunContextOperation *rcop)
424 {
427  rcop_key (rcop->op), rcop,
429 }
430 
431 
439 static void
441  RunContextOperation *rcop)
442 {
445  rcop_key (rcop->op),
446  rcop));
447 }
448 
449 
455 static void
457 {
458  unsigned int hid;
459 
460  GNUNET_assert (NULL == rc->register_hosts_task);
461  GNUNET_assert (NULL == rc->reg_handle);
462  GNUNET_assert (NULL == rc->peers);
463  GNUNET_assert (NULL == rc->hclist);
467  if (NULL != rc->c)
469  if (NULL != rc->cproc)
471  if (NULL != rc->h)
473  for (hid = 0; hid < rc->num_hosts; hid++)
475  GNUNET_free (rc->hosts);
476  if (NULL != rc->cfg)
478  GNUNET_free (rc->topo_file);
479  GNUNET_free (rc->trusted_ip);
480  GNUNET_free (rc);
481 }
482 
483 
492 static int
493 rcop_cleanup_iterator (void *cls, uint32_t key, void *value)
494 {
495  struct GNUNET_TESTBED_RunHandle *rc = cls;
496  struct RunContextOperation *rcop = value;
497 
498  GNUNET_assert (rc == rcop->rc);
499  remove_rcop (rc, rcop);
501  GNUNET_free (rcop);
502  return GNUNET_YES;
503 }
504 
505 
511 static void
513 {
514  struct CompatibilityCheckContext *hc;
515  unsigned int nhost;
516 
517  if (NULL != rc->hclist)
518  {
519  for (nhost = 0; nhost < rc->num_hosts; nhost++)
520  {
521  hc = &rc->hclist[nhost];
522  if (NULL != hc->h)
524  }
525  GNUNET_free (rc->hclist);
526  rc->hclist = NULL;
527  }
528  /* Stop register hosts task if it is running */
529  if (NULL != rc->register_hosts_task)
530  {
532  rc->register_hosts_task = NULL;
533  }
534  if (NULL != rc->timeout_task)
535  {
537  rc->timeout_task = NULL;
538  }
539  if (NULL != rc->reg_handle)
540  {
542  rc->reg_handle = NULL;
543  }
544  if (NULL != rc->topology_operation)
545  {
547  rc->topology_operation = NULL;
548  }
549  /* cancel any exiting operations */
553  rc));
554 }
555 
556 
562 static void
564 {
566  rc->interrupt_task = NULL;
567 }
568 
569 
576 static void
578 {
579  struct GNUNET_TESTBED_RunHandle *rc = cls;
580  struct RunContextOperation *rcop;
581 
582  if ((NULL == rc->cproc)
583  || (NULL == rc->c)
584  || (GNUNET_YES == rc->shutdown))
585  {
586  if (NULL != rc->peers)
587  {
588  GNUNET_free (rc->peers);
589  rc->peers = NULL;
590  }
591  goto cleanup_;
592  }
593  if (NULL == rc->peers)
594  goto cleanup_;
596  rcop = GNUNET_new (struct RunContextOperation);
597  rcop->rc = rc;
598  rcop->op = GNUNET_TESTBED_shutdown_peers (rc->c, rcop, NULL, NULL);
599  GNUNET_assert (NULL != rcop->op);
600  DEBUG ("Shutting down peers\n");
602  insert_rcop (rc, rcop);
603  return;
604 
605 cleanup_:
608  cleanup (rc);
609 }
610 
611 
617 static void
618 interrupt (void *cls)
619 {
620  struct GNUNET_TESTBED_RunHandle *rc = cls;
621  struct GNUNET_TESTBED_Controller *c = rc->c;
622  unsigned int size;
623 
624  /* reschedule */
627  if ((GNUNET_NO == rc->shutdown) &&
628  (NULL != c) &&
629  (NULL != c->opc_map) &&
631  {
633  "Shutdown postponed as there are %u operations currently active\n",
634  size);
636  c->opcq_empty_cls = rc;
637  return;
638  }
639  wait_op_completion (rc);
640 }
641 
642 
650 static const char *
652 {
653  struct GNUNET_TIME_Relative ptime;
654 
657 }
658 
659 
665 static void
666 start_peers_task (void *cls)
667 {
668  struct GNUNET_TESTBED_RunHandle *rc = cls;
669  struct RunContextOperation *rcop;
670  unsigned int peer;
671 
672  DEBUG ("Starting Peers\n");
674  for (peer = 0; peer < rc->num_peers; peer++)
675  {
676  rcop = GNUNET_new (struct RunContextOperation);
677  rcop->rc = rc;
678  rcop->op = GNUNET_TESTBED_peer_start (NULL, rc->peers[peer], NULL, NULL);
679  GNUNET_assert (NULL != rcop->op);
680  rcop->cls = rc->peers[peer];
681  insert_rcop (rc, rcop);
682  }
683  rc->peer_count = 0;
684 }
685 
686 
696 static void
697 peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
698 {
699  struct RunContextOperation *rcop = cls;
700  struct GNUNET_TESTBED_RunHandle *rc;
701 
702  GNUNET_assert (NULL != rcop);
703  GNUNET_assert (NULL != (rc = rcop->rc));
704  remove_rcop (rc, rcop);
706  GNUNET_free (rcop);
707  if (NULL == peer)
708  {
709  if (NULL != emsg)
710  LOG (GNUNET_ERROR_TYPE_ERROR, "Error while creating a peer: %s\n",
711  emsg);
713  return;
714  }
715  rc->peers[rc->peer_count] = peer;
716  rc->peer_count++;
717  if (rc->peer_count < rc->num_peers)
718  return;
719  DEBUG ("%u peers created in %s\n", rc->num_peers, prof_time (rc));
720  rc->state = RC_PEERS_CREATED;
722 }
723 
724 
730 static void
732 {
734  rc->timeout_task = NULL;
735  if (NULL != rc->test_master)
736  rc->test_master (rc->test_master_cls, rc, rc->num_peers, rc->peers,
737  rc->links_succeeded, rc->links_failed);
738 }
739 
740 
750 static void
751 topology_completion_callback (void *cls, unsigned int nsuccess,
752  unsigned int nfailures)
753 {
754  struct GNUNET_TESTBED_RunHandle *rc = cls;
755 
756  DEBUG ("Overlay topology generated in %s\n", prof_time (rc));
758  rc->topology_operation = NULL;
759  rc->links_succeeded = nsuccess;
760  rc->links_failed = nfailures;
761  rc->state = RC_READY;
762  call_master (rc);
763 }
764 
765 
771 static void
773 {
774  struct RunContextOperation *rcop;
775  unsigned int peer;
776 
777  DEBUG ("Creating peers\n");
779  rc->peers =
780  GNUNET_malloc (sizeof(struct GNUNET_TESTBED_Peer *) * rc->num_peers);
781  GNUNET_assert (NULL != rc->c);
782  rc->peer_count = 0;
783  for (peer = 0; peer < rc->num_peers; peer++)
784  {
785  rcop = GNUNET_new (struct RunContextOperation);
786  rcop->rc = rc;
787  rcop->op =
789  (0 ==
790  rc->num_hosts) ? rc->h : rc->hosts[peer
791  % rc->
792  num_hosts],
793  rc->cfg, &peer_create_cb, rcop);
794  GNUNET_assert (NULL != rcop->op);
795  insert_rcop (rc, rcop);
796  }
797 }
798 
799 
807 static void
808 event_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
809 {
810  struct GNUNET_TESTBED_RunHandle *rc = cls;
811  struct RunContextOperation *rcop;
812 
813  if (RC_INIT == rc->state)
814  {
815  switch (event->type)
816  {
818  rcop = event->op_cls;
819  if (NULL != event->details.operation_finished.emsg)
820  {
822  "Linking controllers failed. Exiting"));
824  }
825  else
826  rc->reg_hosts++;
827  GNUNET_assert (event->op == rcop->op);
828  remove_rcop (rc, rcop);
830  GNUNET_free (rcop);
831  if (rc->reg_hosts == rc->num_hosts)
832  {
833  rc->state = RC_LINKED;
834  create_peers (rc);
835  }
836  return;
837 
838  default:
839  GNUNET_break (0);
841  return;
842  }
843  }
845  goto call_cc;
846  if (NULL == (rcop = search_rcop (rc, event->op)))
847  goto call_cc;
848  remove_rcop (rc, rcop);
850  GNUNET_free (rcop);
851  if ((GNUNET_NO == rc->shutdown)
852  && (NULL != event->details.operation_finished.emsg))
853  {
854  LOG (GNUNET_ERROR_TYPE_ERROR, "A operation has failed with error: %s\n",
855  event->details.operation_finished.emsg);
857  return;
858  }
860  switch (rc->state)
861  {
862  case RC_LINKED:
863  case RC_PEERS_CREATED:
864  case RC_READY:
866  GNUNET_free (rc->peers);
867  rc->peers = NULL;
868  DEBUG ("Peers shut down in %s\n", prof_time (rc));
870  break;
871 
872  default:
873  GNUNET_assert (0);
874  }
875  return;
876 
877 call_cc:
878  if ((0 != (rc->event_mask & (1LL << event->type))) && (NULL != rc->cc))
879  rc->cc (rc->cc_cls, event);
880  if (GNUNET_TESTBED_ET_PEER_START != event->type)
881  return;
882  if (NULL == (rcop = search_rcop (rc, event->op))) /* Not our operation */
883  return;
884  remove_rcop (rc, rcop);
886  GNUNET_free (rcop);
887  rc->peer_count++;
888  if (rc->peer_count < rc->num_peers)
889  return;
890  DEBUG ("%u peers started in %s\n", rc->num_peers, prof_time (rc));
892  {
893  switch (rc->topology)
894  {
896  GNUNET_assert (0);
897 
903  rc->peers, &rc->num_oc,
905  rc,
906  rc->topology,
907  rc->random_links,
909  break;
910 
912  GNUNET_assert (NULL != rc->topo_file);
915  rc->peers, &rc->num_oc,
917  rc,
918  rc->topology,
919  rc->topo_file,
921  break;
922 
924  {
925  unsigned long long number;
926  unsigned int cap;
931  &number));
932  cap = (unsigned int) number;
936  SCALE_FREE_M,
937  &number));
940  rc->peers, &rc->num_oc,
941  &
943  rc,
944  rc->topology,
945  cap, /* uint16_t */
946  (unsigned int) number, /* uint8_t */
948  }
949  break;
950 
951  default:
954  rc->peers, &rc->num_oc,
956  rc,
957  rc->topology,
959  }
960  if (NULL == rc->topology_operation)
962  "Not generating a topology. Check number of peers\n");
963  else
964  {
965  DEBUG ("Creating overlay topology\n");
967  return;
968  }
969  }
970  rc->state = RC_READY;
971  call_master (rc);
972 }
973 
974 
980 static void
981 register_hosts (void *cls);
982 
983 
990 static void
991 host_registration_completion (void *cls, const char *emsg)
992 {
993  struct GNUNET_TESTBED_RunHandle *rc = cls;
994 
995  rc->reg_handle = NULL;
996  if (NULL != emsg)
997  {
999  _ ("Host registration failed for a host. Error: %s\n"), emsg);
1001  return;
1002  }
1004  rc);
1005 }
1006 
1007 
1008 static void
1009 register_hosts (void *cls)
1010 {
1011  struct GNUNET_TESTBED_RunHandle *rc = cls;
1012  struct RunContextOperation *rcop;
1013  unsigned int slave;
1014 
1015  rc->register_hosts_task = NULL;
1016  if (rc->reg_hosts == rc->num_hosts)
1017  {
1018  DEBUG ("All hosts successfully registered\n");
1019  /* Start slaves */
1020  for (slave = 0; slave < rc->num_hosts; slave++)
1021  {
1022  rcop = GNUNET_new (struct RunContextOperation);
1023  rcop->rc = rc;
1024  rcop->op =
1025  GNUNET_TESTBED_controller_link (rcop, rc->c, rc->hosts[slave],
1026  rc->h, GNUNET_YES);
1027  GNUNET_assert (NULL != rcop->op);
1028  insert_rcop (rc, rcop);
1029  }
1030  rc->reg_hosts = 0;
1031  return;
1032  }
1033  rc->reg_handle =
1036  rc->reg_hosts++;
1037 }
1038 
1039 
1049 static void
1051  int status)
1052 {
1053  struct GNUNET_TESTBED_RunHandle *rc = cls;
1054  uint64_t event_mask;
1055 
1056  if (status != GNUNET_OK)
1057  {
1058  rc->cproc = NULL;
1060  _ ("Controller crash detected. Shutting down.\n"));
1062  return;
1063  }
1066  event_mask = rc->event_mask;
1071  rc->c =
1073  if (0 < rc->num_hosts)
1074  {
1075  rc->reg_hosts = 0;
1077  return;
1078  }
1079  rc->state = RC_LINKED;
1080  create_peers (rc);
1081 }
1082 
1083 
1096 static int
1097 netint_proc (void *cls, const char *name, int isDefault,
1098  const struct sockaddr *addr, const struct sockaddr *broadcast_addr,
1099  const struct sockaddr *netmask, socklen_t addrlen)
1100 {
1101  struct GNUNET_TESTBED_RunHandle *rc = cls;
1102  char hostip[NI_MAXHOST];
1103  char *buf;
1104 
1105  if (sizeof(struct sockaddr_in) != addrlen)
1106  return GNUNET_OK; /* Only consider IPv4 for now */
1107  if (0 !=
1108  getnameinfo (addr, addrlen, hostip, NI_MAXHOST, NULL, 0, NI_NUMERICHOST))
1110  if (NULL == rc->trusted_ip)
1111  {
1112  rc->trusted_ip = GNUNET_strdup (hostip);
1113  return GNUNET_YES;
1114  }
1115  (void) GNUNET_asprintf (&buf, "%s; %s", rc->trusted_ip, hostip);
1116  GNUNET_free (rc->trusted_ip);
1117  rc->trusted_ip = buf;
1118  return GNUNET_YES;
1119 }
1120 
1121 
1132 static void
1133 host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *host,
1134  int status)
1135 {
1136  struct CompatibilityCheckContext *hc = cls;
1137  struct GNUNET_TESTBED_RunHandle *rc;
1138  struct GNUNET_TESTBED_Host **old_hosts;
1139  unsigned int nhost;
1140 
1141  GNUNET_assert (NULL != (rc = hc->rc));
1142  nhost = hc->index;
1143  GNUNET_assert (nhost <= rc->num_hosts);
1144  GNUNET_assert (host == rc->hosts[nhost]);
1145  hc->h = NULL;
1146  if (GNUNET_NO == status)
1147  {
1148  if ((NULL != host) && (NULL != GNUNET_TESTBED_host_get_hostname (host)))
1149  LOG (GNUNET_ERROR_TYPE_ERROR, _ ("Host %s cannot start testbed\n"),
1151  else
1153  _ ("Testbed cannot be started on localhost\n"));
1155  return;
1156  }
1157  rc->reg_hosts++;
1158  if (rc->reg_hosts < rc->num_hosts)
1159  return;
1160  GNUNET_free (rc->hclist);
1161  rc->hclist = NULL;
1162  rc->h = rc->hosts[0];
1163  rc->num_hosts--;
1164  if (0 < rc->num_hosts)
1165  {
1166  old_hosts = rc->hosts;
1167  rc->hosts =
1168  GNUNET_malloc (sizeof(struct GNUNET_TESTBED_Host *) * rc->num_hosts);
1169  GNUNET_memcpy (rc->hosts, &old_hosts[1],
1170  (sizeof(struct GNUNET_TESTBED_Host *) * rc->num_hosts));
1171  GNUNET_free (old_hosts);
1172  }
1173  else
1174  {
1175  GNUNET_free (rc->hosts);
1176  rc->hosts = NULL;
1177  }
1179  for (nhost = 0; nhost < rc->num_hosts; nhost++)
1180  GNUNET_TESTBED_host_resolve_ (rc->hosts[nhost]);
1182  if (NULL == rc->trusted_ip)
1183  rc->trusted_ip = GNUNET_strdup ("127.0.0.1");
1184  rc->cproc =
1186  &controller_status_cb, rc);
1187  GNUNET_free (rc->trusted_ip);
1188  rc->trusted_ip = NULL;
1189  if (NULL == rc->cproc)
1190  {
1191  LOG (GNUNET_ERROR_TYPE_ERROR, _ ("Cannot start the master controller"));
1193  }
1194 }
1195 
1196 
1202 static void
1203 timeout_task (void *cls)
1204 {
1205  struct GNUNET_TESTBED_RunHandle *rc = cls;
1206 
1207  rc->timeout_task = NULL;
1209  _ ("Shutting down testbed due to timeout while setup.\n"));
1211  if (NULL != rc->test_master)
1212  rc->test_master (rc->test_master_cls, rc, 0, NULL, 0, 0);
1213  rc->test_master = NULL;
1214 }
1215 
1216 
1244 void
1246  const struct GNUNET_CONFIGURATION_Handle *cfg,
1247  unsigned int num_peers, uint64_t event_mask,
1250  void *test_master_cls)
1251 {
1252  struct GNUNET_TESTBED_RunHandle *rc;
1253  char *topology;
1254  struct CompatibilityCheckContext *hc;
1256  unsigned long long number;
1257  unsigned int hid;
1258  unsigned int nhost;
1259 
1260  GNUNET_assert (num_peers > 0);
1261  rc = GNUNET_new (struct GNUNET_TESTBED_RunHandle);
1263  if (NULL != host_filename)
1264  {
1265  rc->num_hosts =
1267  &rc->hosts);
1268  if (0 == rc->num_hosts)
1269  {
1271  _ ("No hosts loaded. Need at least one host\n"));
1272  goto error_cleanup;
1273  }
1274  }
1275  else
1276  rc->h = GNUNET_TESTBED_host_create (NULL, NULL, rc->cfg, 0);
1277  rc->num_peers = num_peers;
1278  rc->event_mask = event_mask;
1279  rc->cc = cc;
1280  rc->cc_cls = cc_cls;
1281  rc->test_master = test_master;
1282  rc->test_master_cls = test_master_cls;
1283  rc->state = RC_INIT;
1285  if (GNUNET_OK ==
1287  "OVERLAY_TOPOLOGY", &topology))
1288  {
1290  {
1293  "OVERLAY_TOPLOGY",
1294  _
1295  (
1296  "Specified topology must be supported by testbed"));
1297  }
1299  }
1300  switch (rc->topology)
1301  {
1305  if (GNUNET_OK !=
1307  "OVERLAY_RANDOM_LINKS",
1308  &number))
1309  {
1310  /* OVERLAY option RANDOM & SMALL_WORLD_RING requires OVERLAY_RANDOM_LINKS
1311  * option to be set to the number of random links to be established */
1314  "OVERLAY_RANDOM_LINKS");
1315  goto error_cleanup;
1316  }
1317  if (number > UINT32_MAX)
1318  {
1319  GNUNET_break (0); /* Too big number */
1320  goto error_cleanup;
1321  }
1322  rc->random_links = (unsigned int) number;
1323  break;
1324 
1326  if (GNUNET_OK !=
1329  "OVERLAY_TOPOLOGY_FILE",
1330  &rc->topo_file))
1331  {
1334  "OVERLAY_TOPOLOGY_FILE");
1335  goto error_cleanup;
1336  }
1337  goto warn_ignore;
1338 
1340  if (GNUNET_OK !=
1343  {
1346  SCALE_FREE_CAP);
1347  goto error_cleanup;
1348  }
1349  if (UINT16_MAX < number)
1350  {
1352  _ ("Maximum number of edges a peer can have in a scale free topology"
1353  " cannot be more than %u. Given `%s = %llu'"), UINT16_MAX,
1355  goto error_cleanup;
1356  }
1357  if (GNUNET_OK !=
1359  SCALE_FREE_M, &number))
1360  {
1363  SCALE_FREE_M);
1364  goto error_cleanup;
1365  }
1366  if (UINT8_MAX < number)
1367  {
1369  _ ("The number of edges that can established when adding a new node"
1370  " to scale free topology cannot be more than %u. Given `%s = %llu'"),
1371  UINT8_MAX, SCALE_FREE_M, number);
1372  goto error_cleanup;
1373  }
1374  goto warn_ignore;
1375 
1377  /* not allowed! */
1378  GNUNET_assert (0);
1379 
1380  default:
1381 warn_ignore:
1382  /* Warn if OVERLAY_RANDOM_LINKS is present that it will be ignored */
1383  if (GNUNET_YES ==
1385  "OVERLAY_RANDOM_LINKS"))
1387  "Ignoring value of `OVERLAY_RANDOM_LINKS' in given configuration\n");
1388  break;
1389  }
1390  if (0 != rc->num_hosts)
1391  {
1392  rc->hclist = GNUNET_malloc (sizeof(struct CompatibilityCheckContext)
1393  * rc->num_hosts);
1394  for (nhost = 0; nhost < rc->num_hosts; nhost++)
1395  {
1396  hc = &rc->hclist[nhost];
1397  hc->index = nhost;
1398  hc->rc = rc;
1399  hc->h = GNUNET_TESTBED_is_host_habitable (rc->hosts[nhost], rc->cfg,
1400  &host_habitable_cb, hc);
1401  if (NULL == hc->h)
1402  {
1403  GNUNET_break (0);
1404  for (nhost = 0; nhost < rc->num_hosts; nhost++)
1405  {
1406  hc = &rc->hclist[nhost];
1407  if (NULL != hc->h)
1409  }
1410  GNUNET_free (rc->hclist);
1411  rc->hclist = NULL;
1412  goto error_cleanup;
1413  }
1414  }
1415  }
1416  else
1417  rc->cproc =
1418  GNUNET_TESTBED_controller_start ("127.0.0.1", rc->h,
1419  &controller_status_cb, rc);
1422  "SETUP_TIMEOUT",
1423  &timeout))
1424  {
1427  }
1429  rc->timeout_task =
1431  GNUNET_assert (NULL == rc->interrupt_task);
1432  rc->interrupt_task =
1434  rc);
1435  return;
1436 
1437 error_cleanup:
1438  if (NULL != rc->h)
1440  if (NULL != rc->hosts)
1441  {
1442  for (hid = 0; hid < rc->num_hosts; hid++)
1443  if (NULL != rc->hosts[hid])
1445  GNUNET_free (rc->hosts);
1446  }
1447  if (NULL != rc->cfg)
1449  GNUNET_free (rc);
1450 }
1451 
1452 
1462 {
1463  return h->c;
1464 }
1465 
1466 
1467 /* end of testbed_api_testbed.c */
enum GNUNET_TESTBED_TopologyOption topology
The topology to generate.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).
Definition: gnunet-abd.c:61
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
static void test_master(void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, struct GNUNET_TESTBED_Peer **started_peers, unsigned int links_succeeded, unsigned int links_failed)
Signature of a main function for a testcase.
static unsigned int num_peers
struct GNUNET_HashCode key
The key used in the DHT.
static char * host_filename
Data file with the hosts for the testbed.
uint16_t status
See PRISM_STATUS_*-constants.
static char * value
Value of the record to add/remove.
State
Available states during profiling.
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:87
static char buf[2048]
uint64_t event_mask
Global event mask for all testbed events.
API for writing tests and creating large-scale emulation testbeds for GNUnet.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_filename(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be the name of a file or directory.
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.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_time(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, struct GNUNET_TIME_Relative *time)
Get a configuration value that should be a relative time.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be a string.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_have_value(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option)
Test if we have a value for a particular option.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_dup(const struct GNUNET_CONFIGURATION_Handle *cfg)
Duplicate an existing configuration object.
int GNUNET_CONTAINER_multihashmap32_get_multiple(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, GNUNET_CONTAINER_MultiHashMapIterator32Callback it, void *it_cls)
Iterate over all entries in the map that match a particular key.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap32_put(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap32_remove(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, const void *value)
Remove the given key-value pair from the map.
unsigned int GNUNET_CONTAINER_multihashmap32_size(const struct GNUNET_CONTAINER_MultiHashMap32 *map)
Get the number of key-value pairs in the map.
struct GNUNET_CONTAINER_MultiHashMap32 * GNUNET_CONTAINER_multihashmap32_create(unsigned int len)
Create a 32-bit key multi hash map.
void GNUNET_CONTAINER_multihashmap32_destroy(struct GNUNET_CONTAINER_MultiHashMap32 *map)
Destroy a 32-bit key hash map.
int GNUNET_CONTAINER_multihashmap32_iterate(struct GNUNET_CONTAINER_MultiHashMap32 *map, GNUNET_CONTAINER_MultiHashMapIterator32Callback it, void *it_cls)
Iterate over all entries in the map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE
Allow multiple values with the same key.
#define GNUNET_log(kind,...)
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
@ GNUNET_SYSERR
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
void GNUNET_log_config_invalid(enum GNUNET_ErrorType kind, const char *section, const char *option, const char *required)
Log error message about invalid configuration option value.
void GNUNET_log_config_missing(enum GNUNET_ErrorType kind, const char *section, const char *option)
Log error message about missing configuration option.
#define GNUNET_log_strerror(level, cmd)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_ERROR
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_OS_network_interfaces_list(GNUNET_OS_NetworkInterfaceProcessor proc, void *proc_cls)
Enumerate all network interfaces.
Definition: os_network.c:397
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
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1272
void(* GNUNET_TESTBED_ControllerCallback)(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
Signature of the event handler function called by the respective event controller.
GNUNET_TESTBED_TopologyOption
Topologies and topology options supported for testbeds.
void GNUNET_TESTBED_operation_done(struct GNUNET_TESTBED_Operation *operation)
This function is used to signal that the event information (struct GNUNET_TESTBED_EventInformation) f...
Definition: testbed_api.c:2021
void GNUNET_TESTBED_cancel_registration(struct GNUNET_TESTBED_HostRegistrationHandle *handle)
Cancel the pending registration.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_peer_create(struct GNUNET_TESTBED_Controller *controller, struct GNUNET_TESTBED_Host *host, const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_TESTBED_PeerCreateCallback cb, void *cls)
Create the given peer at the specified host using the given controller.
struct GNUNET_TESTBED_HostHabitableCheckHandle * GNUNET_TESTBED_is_host_habitable(const struct GNUNET_TESTBED_Host *host, const struct GNUNET_CONFIGURATION_Handle *config, GNUNET_TESTBED_HostHabitableCallback cb, void *cb_cls)
Checks whether a host can be used to start testbed service.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_overlay_configure_topology(void *op_cls, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, unsigned int *max_connections, GNUNET_TESTBED_TopologyCompletionCallback comp_cb, void *comp_cb_cls, enum GNUNET_TESTBED_TopologyOption topo,...)
All peers must have been started before calling this function.
struct GNUNET_TESTBED_Controller * GNUNET_TESTBED_run_get_controller_handle(struct GNUNET_TESTBED_RunHandle *h)
Obtain handle to the master controller from a testbed run.
struct GNUNET_TESTBED_Host * GNUNET_TESTBED_host_create(const char *hostname, const char *username, const struct GNUNET_CONFIGURATION_Handle *cfg, uint16_t port)
Create a host to run peers and controllers on.
void GNUNET_TESTBED_is_host_habitable_cancel(struct GNUNET_TESTBED_HostHabitableCheckHandle *handle)
Function to cancel a request started using GNUNET_TESTBED_is_host_habitable()
void(* GNUNET_TESTBED_TestMaster)(void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, unsigned int links_succeeded, unsigned int links_failed)
Signature of a main function for a testcase.
void GNUNET_TESTBED_run(const char *host_filename, const struct GNUNET_CONFIGURATION_Handle *cfg, unsigned int num_peers, uint64_t event_mask, GNUNET_TESTBED_ControllerCallback cc, void *cc_cls, GNUNET_TESTBED_TestMaster test_master, void *test_master_cls)
Convenience method for running a testbed with a single call.
unsigned int GNUNET_TESTBED_hosts_load_from_file(const char *filename, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTBED_Host ***hosts)
Load a set of hosts from a configuration file.
void GNUNET_TESTBED_controller_stop(struct GNUNET_TESTBED_ControllerProc *cproc)
Stop the controller process (also will terminate all peers and controllers dependent on this controll...
void GNUNET_TESTBED_controller_disconnect(struct GNUNET_TESTBED_Controller *c)
Stop the given controller (also will terminate all peers and controllers dependent on this controller...
Definition: testbed_api.c:1721
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_shutdown_peers(struct GNUNET_TESTBED_Controller *c, void *op_cls, GNUNET_TESTBED_OperationCompletionCallback cb, void *cb_cls)
Stops and destroys all peers.
Definition: testbed_api.c:2252
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_controller_link(void *op_cls, struct GNUNET_TESTBED_Controller *master, struct GNUNET_TESTBED_Host *delegated_host, struct GNUNET_TESTBED_Host *slave_host, int is_subordinate)
Create a link from slave controller to delegated controller.
Definition: testbed_api.c:1832
void GNUNET_TESTBED_host_destroy(struct GNUNET_TESTBED_Host *host)
Destroy a host handle.
struct GNUNET_TESTBED_Controller * GNUNET_TESTBED_controller_connect(struct GNUNET_TESTBED_Host *host, uint64_t event_mask, GNUNET_TESTBED_ControllerCallback cc, void *cc_cls)
Connect to a controller process.
Definition: testbed_api.c:1555
const char * GNUNET_TESTBED_host_get_hostname(const struct GNUNET_TESTBED_Host *host)
Obtain the host's hostname.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_peer_start(void *op_cls, struct GNUNET_TESTBED_Peer *peer, GNUNET_TESTBED_PeerChurnCallback pcc, void *pcc_cls)
Start the given peer.
struct GNUNET_TESTBED_ControllerProc * GNUNET_TESTBED_controller_start(const char *trusted_ip, struct GNUNET_TESTBED_Host *host, GNUNET_TESTBED_ControllerStatusCallback cb, void *cls)
Starts a controller process at the given host.
struct GNUNET_TESTBED_HostRegistrationHandle * GNUNET_TESTBED_register_host(struct GNUNET_TESTBED_Controller *controller, struct GNUNET_TESTBED_Host *host, GNUNET_TESTBED_HostRegistrationCompletion cc, void *cc_cls)
Register a host with the controller.
@ GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD
Small-world network (2d torus plus random links).
@ GNUNET_TESTBED_TOPOLOGY_FROM_FILE
Read a topology from a given file.
@ GNUNET_TESTBED_TOPOLOGY_NONE
All peers are disconnected.
@ GNUNET_TESTBED_TOPOLOGY_SCALE_FREE
Scale free topology.
@ GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI
Random graph.
@ GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING
Small-world network (ring plus random links).
@ GNUNET_TESTBED_TOPOLOGY_OPTION_END
The options should always end with this.
@ GNUNET_TESTBED_ET_CONNECT
A connection between two peers was established.
@ GNUNET_TESTBED_ET_OPERATION_FINISHED
A requested testbed operation has been completed.
@ GNUNET_TESTBED_ET_PEER_START
A peer has been started.
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_duration(struct GNUNET_TIME_Absolute whence)
Get the duration of an operation as the difference of the current time and the given start time "henc...
Definition: time.c:436
#define GNUNET_TIME_UNIT_SECONDS
One second.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:111
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
Definition: time.c:484
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
Definition: strings.c:569
static unsigned int size
Size of the "table".
Definition: peer.c:68
#define _(String)
GNU gettext support macro.
Definition: platform.h:178
const char * name
uint32_t number
Context for host compatibility checks.
struct GNUNET_TESTBED_HostHabitableCheckHandle * h
Handle for the compatibility check.
struct GNUNET_TESTBED_RunHandle * rc
The run context.
unsigned int index
Index of the host in the run context's hosts array.
Internal representation of the hash map.
Entry in list of pending tasks.
Definition: scheduler.c:136
Handle for controller process.
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:194
void * opcq_empty_cls
Closure for the above task.
Definition: testbed_api.h:239
struct GNUNET_CONTAINER_MultiHashMap32 * opc_map
The map of active operation contexts.
Definition: testbed_api.h:229
TESTBED_opcq_empty_cb opcq_empty_cb
If this callback is not NULL, schedule it as a task when opc_map gets empty.
Definition: testbed_api.h:234
Argument to GNUNET_TESTBED_ControllerCallback with details about the event.
enum GNUNET_TESTBED_EventType type
Type of the event.
struct GNUNET_TESTBED_Operation * op
Handle for the corresponding operation that generated this event.
union GNUNET_TESTBED_EventInformation::@43 details
Details about the event.
struct GNUNET_TESTBED_EventInformation::@43::@48 operation_finished
Details about an operation finished event.
The handle for whether a host is habitable or not.
handle for host registration
Opaque handle to a host running experiments managed by the testing framework.
Opaque handle to an abstract operation to be executed by the testing framework.
A peer controlled by the testing framework.
GNUNET_TESTBED_ControllerCallback cc
The callback to use as controller callback.
void * test_master_cls
The closure for the TestMaster callback.
struct GNUNET_TIME_Absolute pstart_time
Profiling start time.
struct GNUNET_TESTBED_Operation * topology_operation
The topology generation operation.
unsigned int num_hosts
Number of hosts in the given host file.
unsigned int peer_count
Current peer count for an operation; Set this to 0 and increment for each successful operation on a p...
unsigned int reg_hosts
Number of registered hosts.
struct GNUNET_SCHEDULER_Task * interrupt_task
Task run upon shutdown interrupts.
struct GNUNET_TESTBED_Peer ** peers
Array of peers which we create.
GNUNET_TESTBED_TestMaster test_master
TestMaster callback to call when testbed initialization is done.
struct GNUNET_TESTBED_ControllerProc * cproc
The handle to the controller process.
struct CompatibilityCheckContext * hclist
Array of compatibility check contexts.
struct GNUNET_SCHEDULER_Task * timeout_task
Task to be run of a timeout.
struct GNUNET_TESTBED_HostRegistrationHandle * reg_handle
Host registration handle.
struct GNUNET_CONFIGURATION_Handle * cfg
The configuration of the controller.
void * cc_cls
The pointer to the controller callback.
unsigned int random_links
Number of random links to established.
struct GNUNET_TESTBED_Host ** hosts
An array of hosts loaded from the hostkeys file.
char * trusted_ip
The trusted IP string.
enum GNUNET_TESTBED_TopologyOption topology
The topology which has to be achieved with the peers started in this context.
uint64_t event_mask
The event mask for the controller.
unsigned int links_failed
the number of overlay link connection attempts that failed
unsigned int num_oc
Expected overlay connects.
int shutdown
Have we already shutdown.
struct GNUNET_CONTAINER_MultiHashMap32 * rcop_map
A hashmap for operations started by us.
unsigned int num_peers
number of peers to start
enum State state
State of this context.
unsigned int links_succeeded
the number of overlay link connection attempts that succeeded
struct GNUNET_TESTBED_Host * h
Handle to the host on which the controller runs.
struct GNUNET_SCHEDULER_Task * register_hosts_task
Host registration task.
struct GNUNET_TESTBED_Controller * c
The controller handle.
char * topo_file
The file containing topology data.
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.
Context information for the operation we start.
struct GNUNET_TESTBED_Operation * op
The testbed operation handle.
struct GNUNET_TESTBED_RunHandle * rc
Context information for GNUNET_TESTBED_run()
Context information to be used while searching for operation contexts.
Definition: testbed_api.c:226
struct GNUNET_TESTBED_Operation * query
The operation pointer to look for.
struct RunContextOperation * result
The Run context operation which has the operation being queried.
Interface for functions internally exported from testbed_api.c.
void GNUNET_TESTBED_host_resolve_(struct GNUNET_TESTBED_Host *host)
Resolves the hostname of the host to an ip address.
internal API to access the 'hosts' subsystem
internal API to access the 'peers' subsystem
#define DEFAULT_SETUP_TIMEOUT
The default setup timeout in seconds.
static int netint_proc(void *cls, const char *name, int isDefault, const struct sockaddr *addr, const struct sockaddr *broadcast_addr, const struct sockaddr *netmask, socklen_t addrlen)
Callback function invoked for each interface found.
static void controller_status_cb(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, int status)
Callback to signal successful startup of the controller process.
static void register_hosts(void *cls)
Task to register all hosts available in the global host list.
static void insert_rcop(struct GNUNET_TESTBED_RunHandle *rc, struct RunContextOperation *rcop)
Insert an RunContextOperation into the rcop_map of the given RunContext.
static void cleanup(struct GNUNET_TESTBED_RunHandle *rc)
Assuming all peers have been destroyed cleanup run handle.
static void timeout_task(void *cls)
Task run upon timeout while setting up the testbed.
static void rc_cleanup_operations(struct GNUNET_TESTBED_RunHandle *rc)
Cancels operations and tasks which are assigned to the given run context.
@ RC_INIT
Initial state.
@ RC_PEERS_CREATED
Peers are created.
@ RC_READY
The testbed run is ready and the master callback can be called now.
@ RC_PEERS_SHUTDOWN
All peers shutdown (stopped and destroyed)
@ RC_LINKED
Controllers on given hosts started and linked.
static void cancel_interrupt_task(struct GNUNET_TESTBED_RunHandle *rc)
Cancels the scheduled interrupt task.
static void start_peers_task(void *cls)
Task for starting peers.
static void wait_op_completion(void *cls)
This callback will be called when all the operations are completed (done/cancelled)
static struct RunContextOperation * search_rcop(struct GNUNET_TESTBED_RunHandle *rc, struct GNUNET_TESTBED_Operation *op)
Initiate a search for the given operation in the rcop_map.
static uint32_t rcop_key(void *rcop)
Return a 32-bit key from a pointer.
#define DEBUG(...)
Debug logging shortcut.
static void topology_completion_callback(void *cls, unsigned int nsuccess, unsigned int nfailures)
Callbacks of this type are called when topology configuration is completed.
static void call_master(struct GNUNET_TESTBED_RunHandle *rc)
call test master callback
static void peer_create_cb(void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
Functions of this signature are called when a peer has been successfully created.
#define TESTBED_CONFIG_SECTION
Configuration section for testbed.
#define SCALE_FREE_CAP
Option string for the maximum number of edges a peer is permitted to have while generating scale free...
static int rcop_cleanup_iterator(void *cls, uint32_t key, void *value)
Iterator for cleaning up elements from rcop_map.
#define LOG(kind,...)
Generic loggins shorthand.
static void interrupt(void *cls)
Task run upon interrupts (SIGINT, SIGTERM) and upon scheduler shutdown.
#define SCALE_FREE_M
Option string for the number of edges to be established when adding a new node to the scale free netw...
static void remove_rcop(struct GNUNET_TESTBED_RunHandle *rc, struct RunContextOperation *rcop)
Remove a RunContextOperation from the rcop_map of the given RunContext.
static void host_registration_completion(void *cls, const char *emsg)
Callback which will be called to after a host registration succeeded or failed.
static void create_peers(struct GNUNET_TESTBED_RunHandle *rc)
Function to create peers.
static void host_habitable_cb(void *cls, const struct GNUNET_TESTBED_Host *host, int status)
Callbacks of this type are called by GNUNET_TESTBED_is_host_habitable to inform whether the given hos...
static int search_iterator(void *cls, uint32_t key, void *value)
Iterator for searching over the elements matching a given query.
static const char * prof_time(struct GNUNET_TESTBED_RunHandle *rc)
Function to return the string representation of the duration between current time and ‘pstart_time’ i...
static void event_cb(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
Signature of the event handler function called by the respective event controller.
int GNUNET_TESTBED_topology_get_(enum GNUNET_TESTBED_TopologyOption *topology, const char *topology_string)
Get a topology from a string input.
header for intra library exported functions
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.