GNUnet  0.17.6
gnunet_testbed_service.h
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 
38 #ifndef GNUNET_TESTBED_SERVICE_H
39 #define GNUNET_TESTBED_SERVICE_H
40 
41 #include "gnunet_util_lib.h"
42 #include "gnunet_testing_lib.h"
43 
44 #ifdef __cplusplus
45 extern "C"
46 {
47 #if 0 /* keep Emacsens' auto-indent happy */
48 }
49 #endif
50 #endif
51 
52 
58 struct GNUNET_TESTBED_Host;
59 
64 struct GNUNET_TESTBED_Peer;
65 
70 
81 
82 
94 struct GNUNET_TESTBED_Host *
96  const char *username,
97  const struct GNUNET_CONFIGURATION_Handle *cfg,
98  uint16_t port);
99 
100 
116 struct GNUNET_TESTBED_Host *
118  const char *hostname,
119  const char *username,
120  const struct GNUNET_CONFIGURATION_Handle
121  *cfg,
122  uint16_t port);
123 
124 
137 unsigned int
139  const struct GNUNET_CONFIGURATION_Handle
140  *cfg,
141  struct GNUNET_TESTBED_Host ***hosts);
142 
143 
150 void
152 
153 
158 
159 
170 typedef void
172  const struct GNUNET_TESTBED_Host *host,
173  int status);
174 
175 
189  const struct GNUNET_CONFIGURATION_Handle
190  *config,
192  void *cb_cls);
193 
194 
200 void
203  *handle);
204 
211 const char *
213 
214 
220 {
225 
230 
235 
240 
245 };
246 
247 
252 {
260 
269 
276 };
277 
278 
284 {
289 
294 
298  void *op_cls;
299 
303  union
304  {
308  struct
309  {
315 
321 
325  struct
326  {
330  struct GNUNET_TESTBED_Peer *peer;
332 
336  struct
337  {
342 
348 
352  struct
353  {
357  struct GNUNET_TESTBED_Peer *peer1;
358 
362  struct GNUNET_TESTBED_Peer *peer2;
364 
368  struct
369  {
373  const char *emsg;
374 
379  void *generic;
382 };
383 
384 
392 typedef void
394  const struct
396 
397 
402 
403 
413 typedef void
415  const struct
417  int status);
418 
419 
444 GNUNET_TESTBED_controller_start (const char *trusted_ip,
445  struct GNUNET_TESTBED_Host *host,
447  void *cls);
448 
449 
458 void
460 
461 
480  uint64_t event_mask,
482  void *cc_cls);
483 
484 
492 void
494 
495 
500 
501 
508 typedef void
510  const char *emsg);
511 
512 
530  struct GNUNET_TESTBED_Host *host,
532  void *cc_cls);
533 
534 
544 void
546  *handle);
547 
548 
557 typedef void
559  struct GNUNET_TESTBED_Operation *
560  op,
561  const char *emsg);
562 
563 
593 GNUNET_TESTBED_controller_link (void *op_cls,
594  struct GNUNET_TESTBED_Controller *master,
595  struct GNUNET_TESTBED_Host *delegated_host,
596  struct GNUNET_TESTBED_Host *slave_host,
597  int is_subordinate);
598 
599 
616 GNUNET_TESTBED_get_slave_config (void *op_cls,
617  struct GNUNET_TESTBED_Controller *master,
618  struct GNUNET_TESTBED_Host *slave_host);
619 
620 
630 typedef void
632  struct GNUNET_TESTBED_Peer *peer,
633  const char *emsg);
634 
635 
667  struct GNUNET_TESTBED_Host *host,
668  const struct GNUNET_CONFIGURATION_Handle *cfg,
670  void *cls);
671 
672 
680 typedef void
682  const char *emsg);
683 
684 
696 GNUNET_TESTBED_peer_start (void *op_cls,
697  struct GNUNET_TESTBED_Peer *peer,
699  void *pcc_cls);
700 
701 
715 GNUNET_TESTBED_peer_stop (void *op_cls,
716  struct GNUNET_TESTBED_Peer *peer,
718  void *pcc_cls);
719 
720 
725 {
731 
735  union
736  {
741 
747 };
748 
749 
760 typedef void
761 (*GNUNET_TESTBED_PeerInfoCallback) (void *cb_cls,
763  const struct
765  const char *emsg);
766 
767 
785  pit,
787  void *cb_cls);
788 
789 
800  const struct
802 
803 
813 
814 
832  struct GNUNET_TESTBED_Peer *peer,
833  const char *service_name,
835  cb,
836  void *cb_cls,
837  unsigned int start);
838 
839 
857  void *op_cls,
859  void *cb_cls);
860 
861 
866 {
871 
880 
886 };
887 
888 
903  struct GNUNET_TESTBED_Peer *p1,
904  struct GNUNET_TESTBED_Peer *p2,
906  va_list ap);
907 
908 
923  struct GNUNET_TESTBED_Peer *p1,
924  struct GNUNET_TESTBED_Peer *p2,
926  ...);
927 
928 
934 {
940 
946 
952 
957 
962 
967 
973 
980 
992 
997 
1002 
1007 
1012 
1013  /* The following are not topologies but influence how the topology has to be
1014  setup. These options should follow the topology specific options (if
1015  required by the chosen topology). Note that these should be given before
1016  GNUNET_TESTBED_TOPOLOGY_OPTION_END */
1017 
1026 };
1027 
1028 
1040 struct GNUNET_TESTBED_Operation *
1042  unsigned int num_peers,
1043  struct GNUNET_TESTBED_Peer **
1044  peers,
1045  enum
1047  topo,
1048  va_list ap);
1049 
1050 
1062 struct GNUNET_TESTBED_Operation *
1064  unsigned int num_peers,
1065  struct GNUNET_TESTBED_Peer **peers,
1067  topo,
1068  ...);
1069 
1070 
1085 struct GNUNET_TESTBED_Operation *
1086 GNUNET_TESTBED_overlay_connect (void *op_cls,
1088  void *cb_cls,
1089  struct GNUNET_TESTBED_Peer *p1,
1090  struct GNUNET_TESTBED_Peer *p2);
1091 
1092 
1103  unsigned int
1104  nsuccess,
1105  unsigned int
1106  nfailures);
1107 
1108 
1129 struct GNUNET_TESTBED_Operation *
1131  unsigned int num_peers,
1132  struct GNUNET_TESTBED_Peer **peers,
1133  unsigned int *max_connections,
1135  comp_cb,
1136  void *comp_cb_cls,
1138  topo,
1139  va_list va);
1140 
1141 
1162 struct GNUNET_TESTBED_Operation *
1164  unsigned int num_peers,
1165  struct GNUNET_TESTBED_Peer **peers,
1166  unsigned int *max_connections,
1168  comp_cb,
1169  void *comp_cb_cls,
1171  topo,
1172  ...);
1173 
1174 
1185 void
1188  controller,
1189  const char *filename);
1190 
1191 
1202 typedef void *
1203 (*GNUNET_TESTBED_ConnectAdapter)(void *cls,
1204  const struct GNUNET_CONFIGURATION_Handle *cfg);
1205 
1206 
1214 typedef void
1216  void *op_result);
1217 
1218 
1228 typedef void
1230  struct
1232  void *ca_result,
1233  const char *emsg);
1234 
1235 
1258 struct GNUNET_TESTBED_Operation *
1259 GNUNET_TESTBED_service_connect (void *op_cls,
1260  struct GNUNET_TESTBED_Peer *peer,
1261  const char *service_name,
1263  cb,
1264  void *cb_cls,
1267  void *cada_cls);
1268 
1269 
1291 void
1293 
1294 
1306 typedef int
1307 (*GNUNET_TESTBED_StatisticsIterator) (void *cls,
1308  const struct GNUNET_TESTBED_Peer *peer,
1309  const char *subsystem,
1310  const char *name,
1311  uint64_t value,
1312  int is_persistent);
1313 
1314 
1330 struct GNUNET_TESTBED_Operation *
1332  struct GNUNET_TESTBED_Peer **peers,
1333  const char *subsystem, const char *name,
1336  void *cls);
1337 
1338 
1347 uint32_t
1349 
1350 
1355 
1356 
1371 typedef void
1372 (*GNUNET_TESTBED_TestMaster)(void *cls,
1373  struct GNUNET_TESTBED_RunHandle *h,
1374  unsigned int num_peers,
1375  struct GNUNET_TESTBED_Peer **peers,
1376  unsigned int links_succeeded,
1377  unsigned int links_failed);
1378 
1379 
1413 void
1414 GNUNET_TESTBED_run (const char *host_filename,
1415  const struct GNUNET_CONFIGURATION_Handle *cfg,
1416  unsigned int num_peers,
1417  uint64_t event_mask,
1419  void *cc_cls,
1421  void *test_master_cls);
1422 
1423 
1462 int
1463 GNUNET_TESTBED_test_run (const char *testname,
1464  const char *cfg_filename,
1465  unsigned int num_peers,
1466  uint64_t event_mask,
1468  void *cc_cls,
1470  void *test_master_cls);
1471 
1472 
1482 
1483 
1487 struct GNUNET_TESTBED_Barrier;
1488 
1489 
1494 {
1499 
1504 
1509 };
1510 
1511 
1527 typedef void
1528 (*GNUNET_TESTBED_barrier_status_cb) (void *cls,
1529  const char *name,
1530  struct GNUNET_TESTBED_Barrier *barrier,
1532  const char *emsg);
1533 
1534 
1549 struct GNUNET_TESTBED_Barrier *
1551  const char *name,
1552  unsigned int quorum,
1554  void *cb_cls);
1555 
1556 
1562 void
1564 
1565 
1570 
1571 
1582 typedef void
1583 (*GNUNET_TESTBED_barrier_wait_cb) (void *cls,
1584  const char *name,
1585  int status);
1586 
1587 
1600 GNUNET_TESTBED_barrier_wait (const char *name,
1602  void *cls);
1603 
1604 
1611 void
1613 
1614 
1620 
1621 
1627 {
1634 
1641 };
1642 
1643 
1655  enum
1657  type);
1658 
1659 
1669 void
1672  model,
1673  struct GNUNET_TESTBED_Peer *peer);
1674 
1675 
1687 void
1690  model,
1691  struct GNUNET_TESTBED_Peer *peer,
1692  uint32_t latency,
1693  uint32_t loss,
1694  uint32_t bandwidth);
1695 
1696 
1703 void
1706 
1707 
1716 void
1719 
1720 
1721 #if 0 /* keep Emacsens' auto-indent happy */
1722 {
1723 #endif
1724 
1725 
1726 #ifdef __cplusplus
1727 }
1728 #endif
1729 
1730 #endif
1731  /* end of group */
1733  /* end of group addition */
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
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 int start
Set if we are to start default services (including ARM).
Definition: gnunet-arm.c:39
static char * cfg_filename
Name of the configuration file.
static uint16_t port
Port number.
Definition: gnunet-bcd.c:147
static struct CadetPeer * peers
Operation to get peer ids.
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
static unsigned long long max_connections
If there are at least this many connections, old ones will be removed.
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
static char * filename
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.
static int result
Global testing status.
static char * hostname
Our hostname; we give this to all the peers we start.
static const struct GNUNET_CONFIGURATION_Handle * config
static char * subsystem
Set to subsystem that we're going to get stats for (or NULL for all).
uint64_t event_mask
Global event mask for all testbed events.
static char * service_name
Option -s: service name (hash to get service descriptor)
Definition: gnunet-vpn.c:51
Convenience API for writing testcases for GNUnet.
void(* GNUNET_TESTBED_ControllerCallback)(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
Signature of the event handler function called by the respective event controller.
struct GNUNET_TESTBED_Barrier * GNUNET_TESTBED_barrier_init(struct GNUNET_TESTBED_Controller *controller, const char *name, unsigned int quorum, GNUNET_TESTBED_barrier_status_cb cb, void *cb_cls)
Initialise a barrier and call the given callback when the required percentage of peers (quorum) reach...
Definition: testbed_api.c:2438
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_peer_stop(void *op_cls, struct GNUNET_TESTBED_Peer *peer, GNUNET_TESTBED_PeerChurnCallback pcc, void *pcc_cls)
Stop the given peer.
GNUNET_TESTBED_TopologyOption
Topologies and topology options supported for testbeds.
struct GNUNET_TESTBED_BarrierWaitHandle * GNUNET_TESTBED_barrier_wait(const char *name, GNUNET_TESTBED_barrier_wait_cb cb, void *cls)
Wait for a barrier to be crossed.
void(* GNUNET_TESTBED_DisconnectAdapter)(void *cls, void *op_result)
Adapter function called to destroy a connection to a service.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_peer_update_configuration(struct GNUNET_TESTBED_Peer *peer, const struct GNUNET_CONFIGURATION_Handle *cfg)
Change peer configuration.
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:2045
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_underlay_configure_link_va(void *op_cls, struct GNUNET_TESTBED_Peer *p1, struct GNUNET_TESTBED_Peer *p2, enum GNUNET_TESTBED_ConnectOption co, va_list ap)
Manipulate the P2P underlay topology by configuring a link between two peers.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_peer_get_information(struct GNUNET_TESTBED_Peer *peer, enum GNUNET_TESTBED_PeerInformationType pit, GNUNET_TESTBED_PeerInfoCallback cb, void *cb_cls)
Request information about a peer.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_underlay_configure_topology(void *op_cls, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, enum GNUNET_TESTBED_TopologyOption topo,...)
Configure overall network topology to have a particular shape.
void(* GNUNET_TESTBED_TopologyCompletionCallback)(void *cls, unsigned int nsuccess, unsigned int nfailures)
Callbacks of this type are called when topology configuration is completed.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_get_slave_config(void *op_cls, struct GNUNET_TESTBED_Controller *master, struct GNUNET_TESTBED_Host *slave_host)
Function to acquire the configuration of a running slave controller.
Definition: testbed_api.c:1936
struct GNUNET_TESTBED_Host * GNUNET_TESTBED_host_create_with_id(uint32_t id, const char *hostname, const char *username, const struct GNUNET_CONFIGURATION_Handle *cfg, uint16_t port)
Create a host to run peers and controllers on.
int GNUNET_TESTBED_test_run(const char *testname, const char *cfg_filename, 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 "simple" test on the local system with a single call from 'main'.
void GNUNET_TESTBED_cancel_registration(struct GNUNET_TESTBED_HostRegistrationHandle *handle)
Cancel the pending registration.
void(* GNUNET_TESTBED_ServiceConnectCompletionCallback)(void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, const char *emsg)
Callback to be called when a service connect operation is completed.
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.
void(* GNUNET_TESTBED_barrier_status_cb)(void *cls, const char *name, struct GNUNET_TESTBED_Barrier *barrier, enum GNUNET_TESTBED_BarrierStatus status, const char *emsg)
Functions of this type are to be given as callback argument to GNUNET_TESTBED_barrier_init().
void(* GNUNET_TESTBED_barrier_wait_cb)(void *cls, const char *name, int status)
Functions of this type are to be given as acallback argument to GNUNET_TESTBED_barrier_wait().
void(* GNUNET_TESTBED_PeerChurnCallback)(void *cls, const char *emsg)
Functions of this signature are called when a peer has been successfully started or stopped.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_peer_manage_service(void *op_cls, struct GNUNET_TESTBED_Peer *peer, const char *service_name, GNUNET_TESTBED_OperationCompletionCallback cb, void *cb_cls, unsigned int start)
Start or stop given service at a peer.
GNUNET_TESTBED_UnderlayLinkModelType
The type of GNUNET_TESTBED_UnderlayLinkModel.
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.
GNUNET_TESTBED_PeerInformationType
Types of information that can be requested about a peer.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_overlay_connect(void *op_cls, GNUNET_TESTBED_OperationCompletionCallback cb, void *cb_cls, struct GNUNET_TESTBED_Peer *p1, struct GNUNET_TESTBED_Peer *p2)
Both peers must have been started before calling this function.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_overlay_configure_topology_va(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, va_list va)
All peers must have been started before calling this function.
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.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_service_connect(void *op_cls, struct GNUNET_TESTBED_Peer *peer, const char *service_name, GNUNET_TESTBED_ServiceConnectCompletionCallback cb, void *cb_cls, GNUNET_TESTBED_ConnectAdapter ca, GNUNET_TESTBED_DisconnectAdapter da, void *cada_cls)
Connect to a service offered by the given peer.
void(* GNUNET_TESTBED_ControllerStatusCallback)(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, int status)
Callback to signal successful startup of the controller process.
int(* GNUNET_TESTBED_StatisticsIterator)(void *cls, const struct GNUNET_TESTBED_Peer *peer, const char *subsystem, const char *name, uint64_t value, int is_persistent)
Callback function to process statistic values from all peers.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_get_statistics(unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, const char *subsystem, const char *name, GNUNET_TESTBED_StatisticsIterator proc, GNUNET_TESTBED_OperationCompletionCallback cont, void *cls)
Convenience method that iterates over all (running) peers and retrieves all statistics from each peer...
void(* GNUNET_TESTBED_OperationCompletionCallback)(void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
Callback to be called when an operation is completed.
void(* GNUNET_TESTBED_PeerCreateCallback)(void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
Functions of this signature are called when a peer has been successfully created.
GNUNET_TESTBED_ConnectOption
Options for peer connections.
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_HostHabitableCallback)(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...
void(* GNUNET_TESTBED_HostRegistrationCompletion)(void *cls, const char *emsg)
Callback which will be called to after a host registration succeeded or failed.
void GNUNET_TESTBED_underlaylinkmodel_free(struct GNUNET_TESTBED_UnderlayLinkModel *model)
Free the resources of the model.
void GNUNET_TESTBED_barrier_wait_cancel(struct GNUNET_TESTBED_BarrierWaitHandle *h)
Cancel a barrier wait handle.
void GNUNET_TESTBED_underlaylinkmodel_set_link(struct GNUNET_TESTBED_UnderlayLinkModel *model, struct GNUNET_TESTBED_Peer *peer, uint32_t latency, uint32_t loss, uint32_t bandwidth)
Set the metrics for a link to the given peer in the underlay model.
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_UnderlayLinkModel * GNUNET_TESTBED_underlaylinkmodel_create(struct GNUNET_TESTBED_Peer *peer, enum GNUNET_TESTBED_UnderlayLinkModelType type)
Create a GNUNET_TESTBED_UnderlayLinkModel for the given peer.
void GNUNET_TESTBED_overlay_write_topology_to_file(struct GNUNET_TESTBED_Controller *controller, const char *filename)
Ask the testbed controller to write the current overlay topology to a file.
Definition: testbed_api.c:1959
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_underlay_configure_link(void *op_cls, struct GNUNET_TESTBED_Peer *p1, struct GNUNET_TESTBED_Peer *p2, enum GNUNET_TESTBED_ConnectOption co,...)
Manipulate the P2P underlay topology by configuring a link between two peers.
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:2283
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
uint32_t GNUNET_TESTBED_get_index(const struct GNUNET_TESTBED_Peer *peer)
Return the index of the peer inside of the total peer array, aka.
Definition: testbed_api.c:2322
void GNUNET_TESTBED_host_destroy(struct GNUNET_TESTBED_Host *host)
Destroy a host handle.
void(* GNUNET_TESTBED_PeerInfoCallback)(void *cb_cls, struct GNUNET_TESTBED_Operation *op, const struct GNUNET_TESTBED_PeerInformation *pinfo, const char *emsg)
Callback to be called when the requested peer information is available The peer information in the ca...
GNUNET_TESTBED_EventType
Enumeration with (at most 64) possible event types that can be monitored using the testbed framework.
void *(* GNUNET_TESTBED_ConnectAdapter)(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
Adapter function called to establish a connection to a service.
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
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_underlay_configure_topology_va(void *op_cls, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, enum GNUNET_TESTBED_TopologyOption topo, va_list ap)
Configure overall network topology to have a particular shape.
GNUNET_TESTBED_BarrierStatus
Status of a barrier.
const char * GNUNET_TESTBED_host_get_hostname(const struct GNUNET_TESTBED_Host *host)
Obtain the host's hostname.
void GNUNET_TESTBED_underlaylinkmodel_add_peer(struct GNUNET_TESTBED_UnderlayLinkModel *model, struct GNUNET_TESTBED_Peer *peer)
Add a peer to the given model.
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_Operation * GNUNET_TESTBED_peer_destroy(struct GNUNET_TESTBED_Peer *peer)
Destroy the given peer; the peer should have been stopped first (if it was started).
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.
void GNUNET_TESTBED_barrier_cancel(struct GNUNET_TESTBED_Barrier *barrier)
Cancel a barrier.
Definition: testbed_api.c:2459
void GNUNET_TESTBED_underlaylinkmodel_commit(struct GNUNET_TESTBED_UnderlayLinkModel *model)
Commit the model.
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_RING
Ring topology.
@ GNUNET_TESTBED_TOPOLOGY_CLIQUE
A clique (everyone connected to everyone else).
@ GNUNET_TESTBED_TOPOLOGY_SCALE_FREE
Scale free topology.
@ GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI
Random graph.
@ GNUNET_TESTBED_TOPOLOGY_INTERNAT
Certain percentage of peers are unable to communicate directly replicating NAT conditions.
@ GNUNET_TESTBED_TOPOLOGY_STAR
Star topology.
@ GNUNET_TESTBED_TOPOLOGY_RETRY_CNT
How many times should the failed overlay connect operations be retried before giving up.
@ GNUNET_TESTBED_TOPOLOGY_2D_TORUS
2-d torus.
@ GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING
Small-world network (ring plus random links).
@ GNUNET_TESTBED_TOPOLOGY_LINE
Straight line topology.
@ GNUNET_TESTBED_TOPOLOGY_OPTION_END
The options should always end with this.
@ GNUNET_TESTBED_UNDERLAYLINKMODELTYPE_WHITELIST
The model is based on black listing of peers to which underlay connections are not permitted.
@ GNUNET_TESTBED_UNDERLAYLINKMODELTYPE_BLACKLIST
The model is based on white listing of peers to which underlay connections are permitted.
@ GNUNET_TESTBED_PIT_CONFIGURATION
What configuration is the peer using? Returns a 'const struct GNUNET_CONFIGURATION_Handle *'.
@ GNUNET_TESTBED_PIT_IDENTITY
What is the identity of the peer? Returns a 'const struct GNUNET_PeerIdentity *'.
@ GNUNET_TESTBED_PIT_GENERIC
Special value (not valid for requesting information) that is used in the event struct if a 'generic' ...
@ GNUNET_TESTBED_CO_NONE
No option (not valid as an argument).
@ GNUNET_TESTBED_CO_ALLOW
Allow or disallow a connection between the specified peers.
@ 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.
@ GNUNET_TESTBED_ET_DISCONNECT
A connection between two peers was torn down.
@ GNUNET_TESTBED_ET_PEER_STOP
A peer has been stopped.
@ GNUNET_TESTBED_BARRIERSTATUS_CROSSED
Barrier is crossed.
@ GNUNET_TESTBED_BARRIERSTATUS_ERROR
Error status.
@ GNUNET_TESTBED_BARRIERSTATUS_INITIALISED
Barrier initialised successfully.
static int op_result(struct GNUNET_OP_Handle *h, uint64_t op_id, int64_t result_code, const void *data, uint16_t data_size, void **ctx, uint8_t cancel)
Remove an operation, and call its result callback (unless it was cancelled).
Definition: op.c:245
const char * name
The identity of the host (wraps the signing key of the peer).
Handle for barrier.
Definition: testbed_api.h:278
Handle for controller process.
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:194
Argument to GNUNET_TESTBED_ControllerCallback with details about the event.
enum GNUNET_TESTBED_EventType type
Type of the event.
struct GNUNET_TESTBED_EventInformation::@43::@44 peer_start
Details about peer start event.
struct GNUNET_TESTBED_Operation * op
Handle for the corresponding operation that generated this event.
const char * emsg
Error message for the operation, NULL on success.
struct GNUNET_TESTBED_Peer * peer2
Handle for one of the connected peers.
union GNUNET_TESTBED_EventInformation::@43 details
Details about the event.
struct GNUNET_TESTBED_EventInformation::@43::@48 operation_finished
Details about an operation finished event.
struct GNUNET_TESTBED_EventInformation::@43::@46 peer_connect
Details about connect event.
void * op_cls
Closure given while creating the above operation.
struct GNUNET_TESTBED_Host * host
Handle for the host where the peer was started.
struct GNUNET_TESTBED_EventInformation::@43::@45 peer_stop
Details about peer stop event.
struct GNUNET_TESTBED_Peer * peer
Handle for the peer that was started.
struct GNUNET_TESTBED_EventInformation::@43::@47 peer_disconnect
Details about disconnect event.
struct GNUNET_TESTBED_Peer * peer1
Handle for one of the connected peers.
The handle for whether a host is habitable or not.
const struct GNUNET_TESTBED_Host * host
The host to check.
GNUNET_TESTBED_HostHabitableCallback cb
The callback to call once we have the status.
handle for host registration
Opaque handle to a host running experiments managed by the testing framework.
const char * username
The username to be used for SSH login.
Opaque handle to an abstract operation to be executed by the testing framework.
Data returned from GNUNET_TESTBED_peer_get_information.
struct GNUNET_CONFIGURATION_Handle * cfg
The configuration of the peer.
struct GNUNET_PeerIdentity * id
The identity of the peer.
A peer controlled by the testing framework.
struct GNUNET_TESTBED_Controller * controller
Our controller context (not necessarily the controller that is responsible for starting/running the p...
struct GNUNET_TESTBED_Host * host
Which host does this peer run on?
Model for configuring underlay links of a peer.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.