GNUnet  0.20.0
gnunet_testbed_service.h File Reference

API for writing tests and creating large-scale emulation testbeds for GNUnet. More...

Include dependency graph for gnunet_testbed_service.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GNUNET_TESTBED_EventInformation
 Argument to GNUNET_TESTBED_ControllerCallback with details about the event. More...
 
struct  GNUNET_TESTBED_PeerInformation
 Data returned from GNUNET_TESTBED_peer_get_information. More...
 

Typedefs

typedef 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 host is habitable or not. More...
 
typedef void(* GNUNET_TESTBED_ControllerCallback) (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
 Signature of the event handler function called by the respective event controller. More...
 
typedef void(* GNUNET_TESTBED_ControllerStatusCallback) (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, int status)
 Callback to signal successful startup of the controller process. More...
 
typedef void(* GNUNET_TESTBED_HostRegistrationCompletion) (void *cls, const char *emsg)
 Callback which will be called to after a host registration succeeded or failed. More...
 
typedef void(* GNUNET_TESTBED_OperationCompletionCallback) (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
 Callback to be called when an operation is completed. More...
 
typedef 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. More...
 
typedef void(* GNUNET_TESTBED_PeerChurnCallback) (void *cls, const char *emsg)
 Functions of this signature are called when a peer has been successfully started or stopped. More...
 
typedef 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 callback is valid until the operation 'op' is canceled. More...
 
typedef void(* GNUNET_TESTBED_TopologyCompletionCallback) (void *cls, unsigned int nsuccess, unsigned int nfailures)
 Callbacks of this type are called when topology configuration is completed. More...
 
typedef void *(* GNUNET_TESTBED_ConnectAdapter) (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
 Adapter function called to establish a connection to a service. More...
 
typedef void(* GNUNET_TESTBED_DisconnectAdapter) (void *cls, void *op_result)
 Adapter function called to destroy a connection to a service. More...
 
typedef 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. More...
 
typedef 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. More...
 
typedef 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. More...
 
typedef 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(). More...
 
typedef 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(). More...
 

Enumerations

enum  GNUNET_TESTBED_EventType {
  GNUNET_TESTBED_ET_PEER_START = 0 , GNUNET_TESTBED_ET_PEER_STOP = 1 , GNUNET_TESTBED_ET_CONNECT = 2 , GNUNET_TESTBED_ET_DISCONNECT = 3 ,
  GNUNET_TESTBED_ET_OPERATION_FINISHED = 4
}
 Enumeration with (at most 64) possible event types that can be monitored using the testbed framework. More...
 
enum  GNUNET_TESTBED_PeerInformationType { GNUNET_TESTBED_PIT_GENERIC = 0 , GNUNET_TESTBED_PIT_CONFIGURATION , GNUNET_TESTBED_PIT_IDENTITY }
 Types of information that can be requested about a peer. More...
 
enum  GNUNET_TESTBED_ConnectOption { GNUNET_TESTBED_CO_NONE = 0 , GNUNET_TESTBED_CO_ALLOW = 1 }
 Options for peer connections. More...
 
enum  GNUNET_TESTBED_TopologyOption {
  GNUNET_TESTBED_TOPOLOGY_CLIQUE , GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD , GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING , GNUNET_TESTBED_TOPOLOGY_RING ,
  GNUNET_TESTBED_TOPOLOGY_STAR , GNUNET_TESTBED_TOPOLOGY_2D_TORUS , GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI , GNUNET_TESTBED_TOPOLOGY_INTERNAT ,
  GNUNET_TESTBED_TOPOLOGY_SCALE_FREE , GNUNET_TESTBED_TOPOLOGY_LINE , GNUNET_TESTBED_TOPOLOGY_FROM_FILE , GNUNET_TESTBED_TOPOLOGY_NONE ,
  GNUNET_TESTBED_TOPOLOGY_OPTION_END , GNUNET_TESTBED_TOPOLOGY_RETRY_CNT
}
 Topologies and topology options supported for testbeds. More...
 
enum  GNUNET_TESTBED_BarrierStatus { GNUNET_TESTBED_BARRIERSTATUS_INITIALISED = 1 , GNUNET_TESTBED_BARRIERSTATUS_CROSSED , GNUNET_TESTBED_BARRIERSTATUS_ERROR }
 Status of a barrier. More...
 
enum  GNUNET_TESTBED_UnderlayLinkModelType { GNUNET_TESTBED_UNDERLAYLINKMODELTYPE_BLACKLIST , GNUNET_TESTBED_UNDERLAYLINKMODELTYPE_WHITELIST }
 The type of GNUNET_TESTBED_UnderlayLinkModel. More...
 

Functions

struct GNUNET_TESTBED_HostGNUNET_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. More...
 
struct GNUNET_TESTBED_HostGNUNET_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. More...
 
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. More...
 
void GNUNET_TESTBED_host_destroy (struct GNUNET_TESTBED_Host *host)
 Destroy a host handle. More...
 
struct GNUNET_TESTBED_HostHabitableCheckHandleGNUNET_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. More...
 
void GNUNET_TESTBED_is_host_habitable_cancel (struct GNUNET_TESTBED_HostHabitableCheckHandle *handle)
 Function to cancel a request started using GNUNET_TESTBED_is_host_habitable() More...
 
const char * GNUNET_TESTBED_host_get_hostname (const struct GNUNET_TESTBED_Host *host)
 Obtain the host's hostname. More...
 
struct GNUNET_TESTBED_ControllerProcGNUNET_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. More...
 
void GNUNET_TESTBED_controller_stop (struct GNUNET_TESTBED_ControllerProc *cproc)
 Stop the controller process (also will terminate all peers and controllers dependent on this controller). More...
 
struct GNUNET_TESTBED_ControllerGNUNET_TESTBED_controller_connect (struct GNUNET_TESTBED_Host *host, uint64_t event_mask, GNUNET_TESTBED_ControllerCallback cc, void *cc_cls)
 Connect to a controller process. More...
 
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). More...
 
struct GNUNET_TESTBED_HostRegistrationHandleGNUNET_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. More...
 
void GNUNET_TESTBED_cancel_registration (struct GNUNET_TESTBED_HostRegistrationHandle *handle)
 Cancel the pending registration. More...
 
struct GNUNET_TESTBED_OperationGNUNET_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. More...
 
struct GNUNET_TESTBED_OperationGNUNET_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. More...
 
struct GNUNET_TESTBED_OperationGNUNET_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. More...
 
struct GNUNET_TESTBED_OperationGNUNET_TESTBED_peer_start (void *op_cls, struct GNUNET_TESTBED_Peer *peer, GNUNET_TESTBED_PeerChurnCallback pcc, void *pcc_cls)
 Start the given peer. More...
 
struct GNUNET_TESTBED_OperationGNUNET_TESTBED_peer_stop (void *op_cls, struct GNUNET_TESTBED_Peer *peer, GNUNET_TESTBED_PeerChurnCallback pcc, void *pcc_cls)
 Stop the given peer. More...
 
struct GNUNET_TESTBED_OperationGNUNET_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. More...
 
struct GNUNET_TESTBED_OperationGNUNET_TESTBED_peer_update_configuration (struct GNUNET_TESTBED_Peer *peer, const struct GNUNET_CONFIGURATION_Handle *cfg)
 Change peer configuration. More...
 
struct GNUNET_TESTBED_OperationGNUNET_TESTBED_peer_destroy (struct GNUNET_TESTBED_Peer *peer)
 Destroy the given peer; the peer should have been stopped first (if it was started). More...
 
struct GNUNET_TESTBED_OperationGNUNET_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. More...
 
struct GNUNET_TESTBED_OperationGNUNET_TESTBED_shutdown_peers (struct GNUNET_TESTBED_Controller *c, void *op_cls, GNUNET_TESTBED_OperationCompletionCallback cb, void *cb_cls)
 Stops and destroys all peers. More...
 
struct GNUNET_TESTBED_OperationGNUNET_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. More...
 
struct GNUNET_TESTBED_OperationGNUNET_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. More...
 
struct GNUNET_TESTBED_OperationGNUNET_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. More...
 
struct GNUNET_TESTBED_OperationGNUNET_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. More...
 
struct GNUNET_TESTBED_OperationGNUNET_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. More...
 
struct GNUNET_TESTBED_OperationGNUNET_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. More...
 
struct GNUNET_TESTBED_OperationGNUNET_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. More...
 
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. More...
 
struct GNUNET_TESTBED_OperationGNUNET_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. More...
 
void GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation)
 This function is used to signal that the event information (struct GNUNET_TESTBED_EventInformation) from an operation has been fully processed i.e. More...
 
struct GNUNET_TESTBED_OperationGNUNET_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. More...
 
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. More...
 
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. More...
 
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'. More...
 
struct GNUNET_TESTBED_ControllerGNUNET_TESTBED_run_get_controller_handle (struct GNUNET_TESTBED_RunHandle *h)
 Obtain handle to the master controller from a testbed run. More...
 
struct GNUNET_TESTBED_BarrierGNUNET_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 the barrier. More...
 
void GNUNET_TESTBED_barrier_cancel (struct GNUNET_TESTBED_Barrier *barrier)
 Cancel a barrier. More...
 
struct GNUNET_TESTBED_BarrierWaitHandleGNUNET_TESTBED_barrier_wait (const char *name, GNUNET_TESTBED_barrier_wait_cb cb, void *cls)
 Wait for a barrier to be crossed. More...
 
void GNUNET_TESTBED_barrier_wait_cancel (struct GNUNET_TESTBED_BarrierWaitHandle *h)
 Cancel a barrier wait handle. More...
 
struct GNUNET_TESTBED_UnderlayLinkModelGNUNET_TESTBED_underlaylinkmodel_create (struct GNUNET_TESTBED_Peer *peer, enum GNUNET_TESTBED_UnderlayLinkModelType type)
 Create a GNUNET_TESTBED_UnderlayLinkModel for the given peer. More...
 
void GNUNET_TESTBED_underlaylinkmodel_add_peer (struct GNUNET_TESTBED_UnderlayLinkModel *model, struct GNUNET_TESTBED_Peer *peer)
 Add a peer to the given model. More...
 
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. More...
 
void GNUNET_TESTBED_underlaylinkmodel_commit (struct GNUNET_TESTBED_UnderlayLinkModel *model)
 Commit the model. More...
 
void GNUNET_TESTBED_underlaylinkmodel_free (struct GNUNET_TESTBED_UnderlayLinkModel *model)
 Free the resources of the model. More...
 

Detailed Description

API for writing tests and creating large-scale emulation testbeds for GNUnet.

Definition in file gnunet_testbed_service.h.