GNUnet  0.20.0
Testbed service

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

Collaboration diagram for Testbed service:

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

Writing tests and creating large-scale emulation testbeds for GNUnet.

See also
Documentation

Typedef Documentation

◆ GNUNET_TESTBED_HostHabitableCallback

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.

The Handle returned by GNUNET_TESTBED_is_host_habitable() is invalid after this callback is called

Parameters
clsthe closure given to GNUNET_TESTBED_is_host_habitable()
hostthe host whose status is being reported; will be NULL if the host given to GNUNET_TESTBED_is_host_habitable() is NULL
statusGNUNET_YES if it is habitable; GNUNET_NO if not

Definition at line 171 of file gnunet_testbed_service.h.

◆ GNUNET_TESTBED_ControllerCallback

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.

Parameters
clsclosure
eventinformation about the event

Definition at line 393 of file gnunet_testbed_service.h.

◆ GNUNET_TESTBED_ControllerStatusCallback

typedef void(* GNUNET_TESTBED_ControllerStatusCallback) (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, int status)

Callback to signal successful startup of the controller process.

Parameters
clsthe closure from GNUNET_TESTBED_controller_start()
cfgthe configuration with which the controller has been started; NULL if status is not GNUNET_OK
statusGNUNET_OK if the startup is successful; GNUNET_SYSERR if not, GNUNET_TESTBED_controller_stop() shouldn't be called in this case

Definition at line 414 of file gnunet_testbed_service.h.

◆ GNUNET_TESTBED_HostRegistrationCompletion

typedef void(* GNUNET_TESTBED_HostRegistrationCompletion) (void *cls, const char *emsg)

Callback which will be called to after a host registration succeeded or failed.

Parameters
clsthe closure
emsgthe error message; NULL if host registration is successful

Definition at line 509 of file gnunet_testbed_service.h.

◆ GNUNET_TESTBED_OperationCompletionCallback

typedef void(* GNUNET_TESTBED_OperationCompletionCallback) (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)

Callback to be called when an operation is completed.

Parameters
clsthe callback closure from functions generating an operation
opthe operation that has been finished
emsgerror message in case the operation has failed; will be NULL if operation has executed successfully.

Definition at line 558 of file gnunet_testbed_service.h.

◆ GNUNET_TESTBED_PeerCreateCallback

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.

Parameters
clsthe closure from GNUNET_TESTBED_peer_create()
peerthe handle for the created peer; NULL on any error during creation
emsgNULL if peer is not NULL; else MAY contain the error description

Definition at line 631 of file gnunet_testbed_service.h.

◆ GNUNET_TESTBED_PeerChurnCallback

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.

Parameters
clsthe closure from GNUNET_TESTBED_peer_start/stop()
emsgNULL on success; otherwise an error description

Definition at line 681 of file gnunet_testbed_service.h.

◆ GNUNET_TESTBED_PeerInfoCallback

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.

Parameters
cb_clsthe closure from GNUNET_TESTBED_peer_get_information()
opthe operation this callback corresponds to
pinfothe result; will be NULL if the operation has failed
emsgerror message if the operation has failed; will be NULL if the operation is successful

Definition at line 761 of file gnunet_testbed_service.h.

◆ GNUNET_TESTBED_TopologyCompletionCallback

typedef void(* GNUNET_TESTBED_TopologyCompletionCallback) (void *cls, unsigned int nsuccess, unsigned int nfailures)

Callbacks of this type are called when topology configuration is completed.

Parameters
clsthe operation closure given to GNUNET_TESTBED_overlay_configure_topology_va() and GNUNET_TESTBED_overlay_configure() calls
nsuccessthe number of successful overlay connects
nfailuresthe number of overlay connects which failed

Definition at line 1103 of file gnunet_testbed_service.h.

◆ GNUNET_TESTBED_ConnectAdapter

typedef void*(* GNUNET_TESTBED_ConnectAdapter) (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)

Adapter function called to establish a connection to a service.

Parameters
clsclosure
cfgconfiguration of the peer to connect to; will be available until GNUNET_TESTBED_operation_done() is called on the operation returned from GNUNET_TESTBED_service_connect()
Returns
service handle to return in 'op_result', NULL on error

Definition at line 1203 of file gnunet_testbed_service.h.

◆ GNUNET_TESTBED_DisconnectAdapter

typedef void(* GNUNET_TESTBED_DisconnectAdapter) (void *cls, void *op_result)

Adapter function called to destroy a connection to a service.

Parameters
clsclosure
op_resultservice handle returned from the connect adapter

Definition at line 1215 of file gnunet_testbed_service.h.

◆ GNUNET_TESTBED_ServiceConnectCompletionCallback

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.

Parameters
clsthe callback closure from functions generating an operation
opthe operation that has been finished
ca_resultthe service handle returned from GNUNET_TESTBED_ConnectAdapter()
emsgerror message in case the operation has failed; will be NULL if operation has executed successfully.

Definition at line 1229 of file gnunet_testbed_service.h.

◆ GNUNET_TESTBED_StatisticsIterator

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.

Parameters
clsclosure
peerthe peer the statistic belong to
subsystemname of subsystem that created the statistic
namethe name of the datum
valuethe current value
is_persistentGNUNET_YES if the value is persistent, GNUNET_NO if not
Returns
GNUNET_OK to continue, GNUNET_SYSERR to abort iteration

Definition at line 1307 of file gnunet_testbed_service.h.

◆ GNUNET_TESTBED_TestMaster

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.

Parameters
clsclosure
hthe run handle
num_peersnumber of peers in 'peers'
peershandle to peers run in the testbed. NULL upon timeout (see GNUNET_TESTBED_test_run()).
links_succeededthe number of overlay link connection attempts that succeeded
links_failedthe number of overlay link connection attempts that failed
See also
GNUNET_TESTBED_test_run()

Definition at line 1372 of file gnunet_testbed_service.h.

◆ GNUNET_TESTBED_barrier_status_cb

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().

The callback will be called when status information is available for the barrier.

Parameters
clsthe closure given to GNUNET_TESTBED_barrier_init()
namethe name of the barrier
barrierthe barrier handle
statusstatus of the barrier. The barrier is removed once it has been crossed or an error occurs while processing it. Therefore it is invalid to call GNUNET_TESTBED_barrier_cancel() on a crossed or errored barrier.
emsgif the status were to be GNUNET_SYSERR, this parameter has the error message

Definition at line 1528 of file gnunet_testbed_service.h.

◆ GNUNET_TESTBED_barrier_wait_cb

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().

The callback will be called when the barrier corresponding given in GNUNET_TESTBED_barrier_wait() is crossed or cancelled.

Parameters
clsclosure pointer given to GNUNET_TESTBED_barrier_wait()
namethe barrier name
statusGNUNET_SYSERR in case of error while waiting for the barrier; GNUNET_OK if the barrier is crossed

Definition at line 1583 of file gnunet_testbed_service.h.

Enumeration Type Documentation

◆ GNUNET_TESTBED_EventType

Enumeration with (at most 64) possible event types that can be monitored using the testbed framework.

Enumerator
GNUNET_TESTBED_ET_PEER_START 

A peer has been started.

GNUNET_TESTBED_ET_PEER_STOP 

A peer has been stopped.

GNUNET_TESTBED_ET_CONNECT 

A connection between two peers was established.

GNUNET_TESTBED_ET_DISCONNECT 

A connection between two peers was torn down.

GNUNET_TESTBED_ET_OPERATION_FINISHED 

A requested testbed operation has been completed.

Definition at line 220 of file gnunet_testbed_service.h.

221 {
226 
231 
236 
241 
246 };
@ 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_PeerInformationType

Types of information that can be requested about a peer.

Enumerator
GNUNET_TESTBED_PIT_GENERIC 

Special value (not valid for requesting information) that is used in the event struct if a 'generic' pointer is returned (for other operations not related to this enumeration).

GNUNET_TESTBED_PIT_CONFIGURATION 

What configuration is the peer using? Returns a 'const struct GNUNET_CONFIGURATION_Handle *'.

Valid until 'GNUNET_TESTNIG_operation_done' is called. However, the values may be inaccurate if the peer is reconfigured in the meantime.

GNUNET_TESTBED_PIT_IDENTITY 

What is the identity of the peer? Returns a 'const struct GNUNET_PeerIdentity *'.

Valid until 'GNUNET_TESTNIG_operation_done' is called.

Definition at line 252 of file gnunet_testbed_service.h.

253 {
261 
270 
277 };
@ 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_ConnectOption

Options for peer connections.

Enumerator
GNUNET_TESTBED_CO_NONE 

No option (not valid as an argument).

GNUNET_TESTBED_CO_ALLOW 

Allow or disallow a connection between the specified peers.

Followed by GNUNET_NO (int) if a connection is disallowed or GNUNET_YES if a connection is allowed. Note that the default (all connections allowed or disallowed) is specified in the configuration of the controller.

Definition at line 866 of file gnunet_testbed_service.h.

867 {
872 
881 
887 };
@ 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_TopologyOption

Topologies and topology options supported for testbeds.

Options should always end with GNUNET_TESTBED_TOPOLOGY_OPTION_END

Enumerator
GNUNET_TESTBED_TOPOLOGY_CLIQUE 

A clique (everyone connected to everyone else).

No options. If there are N peers this topology results in (N * (N -1)) connections.

GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD 

Small-world network (2d torus plus random links).

Followed by the number of random links to add (unsigned int).

GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING 

Small-world network (ring plus random links).

Followed by the number of random links to add (unsigned int).

GNUNET_TESTBED_TOPOLOGY_RING 

Ring topology.

No options.

GNUNET_TESTBED_TOPOLOGY_STAR 

Star topology.

No options.

GNUNET_TESTBED_TOPOLOGY_2D_TORUS 

2-d torus.

No options.

GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI 

Random graph.

Followed by the number of random links to be established (unsigned int)

GNUNET_TESTBED_TOPOLOGY_INTERNAT 

Certain percentage of peers are unable to communicate directly replicating NAT conditions.

Followed by the fraction of NAT'ed peers (float).

GNUNET_TESTBED_TOPOLOGY_SCALE_FREE 

Scale free topology.

It is generated according to the method described in "Emergence of Scaling in Random Networks." Science 286, 509-512, 1999.

This options takes two arguments in the following order: an uint16_t to determine the maximum number of edges a peer is permitted to have while generating scale free topology, a good value for this argument is 70; and an uint8_t to determine the number of edges to be established when adding a new node to the scale free network, a good value for this argument is 4.

GNUNET_TESTBED_TOPOLOGY_LINE 

Straight line topology.

No options.

GNUNET_TESTBED_TOPOLOGY_FROM_FILE 

Read a topology from a given file.

Followed by the name of the file (const char *).

GNUNET_TESTBED_TOPOLOGY_NONE 

All peers are disconnected.

No options.

GNUNET_TESTBED_TOPOLOGY_OPTION_END 

The options should always end with this.

GNUNET_TESTBED_TOPOLOGY_RETRY_CNT 

How many times should the failed overlay connect operations be retried before giving up.

The default if this option is not specified is to retry 3 times. This option takes and unsigned integer as a parameter. Use this option with parameter 0 to disable retrying of failed overlay connect operations.

Definition at line 934 of file gnunet_testbed_service.h.

935 {
941 
947 
953 
958 
963 
968 
974 
981 
993 
998 
1003 
1008 
1013 
1014  /* The following are not topologies but influence how the topology has to be
1015  setup. These options should follow the topology specific options (if
1016  required by the chosen topology). Note that these should be given before
1017  GNUNET_TESTBED_TOPOLOGY_OPTION_END */
1018 
1027 };
@ 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_BarrierStatus

Status of a barrier.

Enumerator
GNUNET_TESTBED_BARRIERSTATUS_INITIALISED 

Barrier initialised successfully.

GNUNET_TESTBED_BARRIERSTATUS_CROSSED 

Barrier is crossed.

GNUNET_TESTBED_BARRIERSTATUS_ERROR 

Error status.

Definition at line 1494 of file gnunet_testbed_service.h.

1495 {
1500 
1505 
1510 };
@ GNUNET_TESTBED_BARRIERSTATUS_CROSSED
Barrier is crossed.
@ GNUNET_TESTBED_BARRIERSTATUS_ERROR
Error status.
@ GNUNET_TESTBED_BARRIERSTATUS_INITIALISED
Barrier initialised successfully.

◆ GNUNET_TESTBED_UnderlayLinkModelType

The type of GNUNET_TESTBED_UnderlayLinkModel.

Enumerator
GNUNET_TESTBED_UNDERLAYLINKMODELTYPE_BLACKLIST 

The model is based on white listing of peers to which underlay connections are permitted.

Underlay connections to all other peers will not be permitted.

GNUNET_TESTBED_UNDERLAYLINKMODELTYPE_WHITELIST 

The model is based on black listing of peers to which underlay connections are not permitted.

Underlay connections to all other peers will be permitted

Definition at line 1627 of file gnunet_testbed_service.h.

1628 {
1635 
1642 };
@ 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.

Function Documentation

◆ GNUNET_TESTBED_host_create()

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.

Parameters
hostnamename of the host, use "NULL" for localhost
usernameusername to use for the login; may be NULL
cfgthe configuration to use as a template while starting a controller on this host. Operation queue sizes specific to a host are also read from this configuration handle
portport number to use for ssh; use 0 to let ssh decide
Returns
handle to the host, NULL on error

Definition at line 368 of file testbed_api_hosts.c.

372 {
373  static uint32_t uid_generator;
374 
375  if (NULL == hostname)
377  hostname,
378  username,
379  cfg,
380  port);
381  return GNUNET_TESTBED_host_create_with_id (++uid_generator,
382  hostname,
383  username,
384  cfg,
385  port);
386 }
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static uint16_t port
Port number.
Definition: gnunet-bcd.c:147
static char * hostname
Our hostname; we give this to all the peers we start.
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.

References cfg, GNUNET_TESTBED_host_create_with_id(), hostname, port, and GNUNET_TESTBED_Host::username.

Referenced by GNUNET_TESTBED_hosts_load_from_file(), and GNUNET_TESTBED_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_host_create_with_id()

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.

This function is used if a peer learns about a host via IPC between controllers (and thus some higher-level controller has already determined the unique IDs).

Parameters
idglobal host ID assigned to the host; 0 is reserved to always mean 'localhost'
hostnamename of the host, use "NULL" for localhost
usernameusername to use for the login; may be NULL
cfgthe configuration to use as a template while starting a controller on this host. Operation queue sizes specific to a host are also read from this configuration handle
portport number to use for ssh; use 0 to let ssh decide
Returns
handle to the host, NULL on error
Parameters
idglobal host ID assigned to the host; 0 is reserved to always mean 'localhost'
hostnamename of the host, use "NULL" for localhost
usernameusername to use for the login; may be NULL
cfgthe configuration to use as a template while starting a controller on this host. Operation queue sizes specific to a host are also read from this configuration handle
portport number to use for ssh; use 0 to let ssh decide
Returns
handle to the host, NULL on error

Definition at line 320 of file testbed_api_hosts.c.

326 {
327  struct GNUNET_TESTBED_Host *host;
328  unsigned int new_size;
329 
330  if ((id < host_list_size) && (NULL != host_list[id]))
331  {
332  LOG (GNUNET_ERROR_TYPE_WARNING, "Host with id: %u already created\n", id);
333  return NULL;
334  }
335  host = GNUNET_new (struct GNUNET_TESTBED_Host);
336  host->hostname = (NULL != hostname) ? GNUNET_strdup (hostname) : NULL;
337  host->username = (NULL != username) ? GNUNET_strdup (username) : NULL;
338  host->id = id;
339  host->port = (0 == port) ? 22 : port;
340  host->cfg = GNUNET_CONFIGURATION_dup (cfg);
343  UINT_MAX);
344  new_size = host_list_size;
345  while (id >= new_size)
346  new_size += HOST_LIST_GROW_STEP;
347  if (new_size != host_list_size)
350  LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding host with id: %u\n", host->id);
351  host_list[id] = host;
352  return host;
353 }
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_dup(const struct GNUNET_CONFIGURATION_Handle *cfg)
Duplicate an existing configuration object.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_DEBUG
#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.
Opaque handle to a host running experiments managed by the testing framework.
struct GNUNET_CONFIGURATION_Handle * cfg
the configuration to use as a template while starting a controller on this host.
const char * hostname
The hostname of the host; NULL for localhost.
uint32_t id
Global ID we use to refer to a host on the network.
struct OperationQueue * opq_parallel_overlay_connect_operations
Operation queue for simultaneous overlay connect operations target at this host.
uint16_t port
The port which is to be used for SSH.
const char * username
The username to be used for SSH login.
static unsigned int host_list_size
The size of the available hosts list.
static struct GNUNET_TESTBED_Host ** host_list
Array of available hosts.
#define LOG(kind,...)
Generic logging shorthand.
#define HOST_LIST_GROW_STEP
Number of extra elements we create space for when we grow host list.
struct OperationQueue * GNUNET_TESTBED_operation_queue_create_(enum OperationQueueType type, unsigned int max_active)
Create an operation queue.
@ OPERATION_QUEUE_TYPE_ADAPTIVE
Operation queue which adapts the number of operations to be active based on the operation completion ...

References cfg, GNUNET_TESTBED_Host::cfg, GNUNET_array_grow, GNUNET_assert, GNUNET_CONFIGURATION_dup(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_new, GNUNET_strdup, GNUNET_TESTBED_operation_queue_create_(), host_list, HOST_LIST_GROW_STEP, host_list_size, hostname, GNUNET_TESTBED_Host::hostname, id, GNUNET_TESTBED_Host::id, LOG, OPERATION_QUEUE_TYPE_ADAPTIVE, GNUNET_TESTBED_Host::opq_parallel_overlay_connect_operations, port, GNUNET_TESTBED_Host::port, and GNUNET_TESTBED_Host::username.

Referenced by GNUNET_TESTBED_host_create(), GNUNET_TESTBED_host_create_by_id_(), handle_add_host(), and handle_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_hosts_load_from_file()

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.

The hostfile format is specified at https://gnunet.org/content/hosts-file-format

Parameters
filenamefile with the host specification
cfgthe configuration to use as a template while starting a controller on any of the loaded hosts. Operation queue sizes specific to a host are also read from this configuration handle
hostsset to the hosts found in the file; caller must free this if number of hosts returned is greater than 0
Returns
number of hosts returned in 'hosts', 0 on error

Definition at line 390 of file testbed_api_hosts.c.

394 {
395  struct GNUNET_TESTBED_Host *starting_host;
396  char *data;
397  char *buf;
398  char *username;
399  char *hostname;
400  regex_t rex;
401  regmatch_t pmatch[6];
402  uint64_t fs;
403  short int port;
404  unsigned int offset;
405  unsigned int count;
406 
407 
408  GNUNET_assert (NULL != filename);
410  {
411  LOG (GNUNET_ERROR_TYPE_WARNING, _ ("Hosts file %s not found\n"), filename);
412  return 0;
413  }
414  if (GNUNET_OK !=
416  fs = 0;
417  if (0 == fs)
418  {
420  _ ("Hosts file %s has no data\n"),
421  filename);
422  return 0;
423  }
424  data = GNUNET_malloc (fs);
426  {
427  GNUNET_free (data);
429  _ ("Hosts file %s cannot be read\n"),
430  filename);
431  return 0;
432  }
433  buf = data;
434  offset = 0;
435  starting_host = NULL;
436  count = 0;
437  /* refer RFC 952 and RFC 1123 for valid hostnames */
438  GNUNET_assert (0 == regcomp (&rex,
439  "^(([[:alnum:]]+)@)?" /* username */
440  "([[:alnum:]]+[-[:alnum:]_\\.]+)" /* hostname */
441  "(:([[:digit:]]{1,5}))?", /* port */
442  REG_EXTENDED | REG_ICASE));
443  while (offset < (fs - 1))
444  {
445  offset++;
446  if (((data[offset] == '\n')) && (buf != &data[offset]))
447  {
448  unsigned int size;
449 
450  data[offset] = '\0';
451  username = NULL;
452  hostname = NULL;
453  port = 0;
454  if ((REG_NOMATCH == regexec (&rex, buf, 6, pmatch, 0)) ||
455  (-1 == pmatch[3].rm_so))
456  {
458  "Error reading line `%s' in hostfile\n",
459  buf);
460  buf = &data[offset + 1];
461  continue;
462  }
463  if (-1 != pmatch[2].rm_so)
464  {
465  size = pmatch[2].rm_eo - pmatch[2].rm_so;
466  username = GNUNET_malloc (size + 1);
467  GNUNET_assert (
468  0 != GNUNET_strlcpy (username, buf + pmatch[2].rm_so, size + 1));
469  }
470  if (-1 != pmatch[5].rm_so)
471  {
472  (void) sscanf (buf + pmatch[5].rm_so, "%5hd", &port);
473  }
474  size = pmatch[3].rm_eo - pmatch[3].rm_so;
475  hostname = GNUNET_malloc (size + 1);
476  GNUNET_assert (
477  0 != GNUNET_strlcpy (hostname, buf + pmatch[3].rm_so, size + 1));
479  "Successfully read host %s, port %d and user %s from file\n",
480  (NULL == hostname) ? "NULL" : hostname,
481  port,
482  (NULL == username) ? "NULL" : username);
483  /* We store hosts in a static list; hence we only require the starting
484  * host pointer in that list to access the newly created list of hosts */
485  if (NULL == starting_host)
486  starting_host =
488  else
490  count++;
493  buf = &data[offset + 1];
494  }
495  else if ((data[offset] == '\n') || (data[offset] == '\0'))
496  buf = &data[offset + 1];
497  }
498  regfree (&rex);
499  GNUNET_free (data);
500  if (NULL == starting_host)
501  return 0;
502  *hosts = GNUNET_malloc (sizeof(struct GNUNET_TESTBED_Host *) * count);
503  GNUNET_memcpy (*hosts,
504  &host_list[GNUNET_TESTBED_host_get_id_ (starting_host)],
505  sizeof(struct GNUNET_TESTBED_Host *) * count);
506  return count;
507 }
static char * filename
static struct GNUNET_FS_Handle * fs
Handle to FS service.
Definition: gnunet-fs.c:37
uint32_t data
The data value.
static char buf[2048]
enum GNUNET_GenericReturnValue GNUNET_DISK_file_test(const char *fil)
Check that fil corresponds to a filename (of a file that exists and that is not a directory).
Definition: disk.c:482
enum GNUNET_GenericReturnValue GNUNET_DISK_file_size(const char *filename, uint64_t *size, int include_symbolic_links, int single_file_mode)
Get the size of the file (or directory) of the given file (in bytes).
Definition: disk.c:221
ssize_t GNUNET_DISK_fn_read(const char *fn, void *result, size_t len)
Read the contents of a binary file into a buffer.
Definition: disk.c:664
#define GNUNET_log(kind,...)
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
@ GNUNET_OK
@ GNUNET_YES
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
size_t GNUNET_strlcpy(char *dst, const char *src, size_t n)
Like strlcpy but portable.
Definition: strings.c:138
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.
static unsigned int size
Size of the "table".
Definition: peer.c:68
#define _(String)
GNU gettext support macro.
Definition: platform.h:178
uint32_t GNUNET_TESTBED_host_get_id_(const struct GNUNET_TESTBED_Host *host)
Obtain a host's unique global ID.

References _, buf, cfg, data, filename, fs, GNUNET_assert, GNUNET_DISK_file_size(), GNUNET_DISK_file_test(), GNUNET_DISK_fn_read(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_malloc, GNUNET_memcpy, GNUNET_OK, GNUNET_strlcpy(), GNUNET_TESTBED_host_create(), GNUNET_TESTBED_host_get_id_(), GNUNET_YES, host_list, hostname, LOG, port, size, and GNUNET_TESTBED_Host::username.

Referenced by GNUNET_TESTBED_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_host_destroy()

void GNUNET_TESTBED_host_destroy ( struct GNUNET_TESTBED_Host host)

Destroy a host handle.

Must only be called once everything running on that host has been stopped.

Parameters
hosthandle to destroy

Definition at line 559 of file testbed_api_hosts.c.

560 {
561  GNUNET_assert (host->id < host_list_size);
562  GNUNET_assert (host_list[host->id] == host);
563  host_list[host->id] = NULL;
564  /* clear registered controllers list */
565  for (struct RegisteredController *rc = host->rc_head;
566  NULL != rc;
567  rc = host->rc_head)
568  {
569  GNUNET_CONTAINER_DLL_remove (host->rc_head, host->rc_tail, rc);
570  GNUNET_free (rc);
571  }
572  GNUNET_free_nz ((char *) host->username);
573  GNUNET_free_nz ((char *) host->hostname);
577  GNUNET_free (host);
579  {
580  uint32_t id;
581 
582  for (id = host_list_size - 1; id > host_list_size - HOST_LIST_GROW_STEP;
583  id--)
584  if (NULL != host_list[id])
585  break;
587  break;
588  if (NULL != host_list[id])
589  break;
591  }
592  host_list =
594  sizeof(struct GNUNET_TESTBED_Host *) * host_list_size);
595 }
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_realloc(ptr, size)
Wrapper around realloc.
#define GNUNET_free_nz(ptr)
Wrapper around free.
struct RegisteredController * rc_head
The head for the list of controllers where this host is registered.
struct RegisteredController * rc_tail
The tail for the list of controllers where this host is registered.
A list entry for registered controllers list.
void GNUNET_TESTBED_operation_queue_destroy_(struct OperationQueue *queue)
Destroys an operation queue.

References GNUNET_TESTBED_Host::cfg, GNUNET_assert, GNUNET_CONFIGURATION_destroy(), GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_free_nz, GNUNET_realloc, GNUNET_TESTBED_operation_queue_destroy_(), host_list, HOST_LIST_GROW_STEP, host_list_size, GNUNET_TESTBED_Host::hostname, id, GNUNET_TESTBED_Host::id, GNUNET_TESTBED_Host::opq_parallel_overlay_connect_operations, GNUNET_TESTBED_Host::rc_head, GNUNET_TESTBED_Host::rc_tail, and GNUNET_TESTBED_Host::username.

Referenced by cleanup(), GNUNET_TESTBED_run(), handle_add_host(), and shutdown_task().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_is_host_habitable()

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.

Parameters
hostthe host to check
configthe configuration handle to lookup the path of the testbed helper
cbthe callback to call to inform about habitability of the given host
cb_clsthe closure for the callback
Returns
NULL upon any error or a handle which can be passed to GNUNET_TESTBED_is_host_habitable_cancel()

Definition at line 1297 of file testbed_api_hosts.c.

1302 {
1304  char **rsh_args;
1305  char **rsh_suffix_args;
1306  char *stat_args[3];
1307  const char *hostname;
1308  char *port;
1309 
1311  h->cb = cb;
1312  h->cb_cls = cb_cls;
1313  h->host = host;
1314  hostname = (NULL == host->hostname) ? "127.0.0.1" : host->hostname;
1315  if (GNUNET_OK !=
1317  "testbed",
1318  "HELPER_BINARY_PATH",
1319  &stat_args[1]))
1321  GNUNET_asprintf (&port, "%u", host->port);
1322  rsh_args = gen_rsh_args (port, hostname, host->username);
1323  GNUNET_free (port);
1324  port = NULL;
1325  stat_args[0] = "stat";
1326  stat_args[2] = NULL;
1327  rsh_suffix_args = gen_rsh_suffix_args ((const char **) stat_args);
1328  GNUNET_free (stat_args[1]);
1329  h->helper_argv =
1330  join_argv ((const char **) rsh_args, (const char **) rsh_suffix_args);
1331  free_argv (rsh_suffix_args);
1332  free_argv (rsh_args);
1334  NULL,
1335  NULL,
1336  NULL,
1337  h->helper_argv[0],
1338  h->helper_argv);
1339  if (NULL == h->auxp)
1340  {
1341  GNUNET_break (0); /* Cannot exec SSH? */
1342  free_argv (h->helper_argv);
1343  GNUNET_free (h);
1344  return NULL;
1345  }
1346  h->wait_time = GNUNET_TIME_STD_BACKOFF (h->wait_time);
1347  h->habitability_check_task =
1349  return h;
1350 }
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
static const struct GNUNET_CONFIGURATION_Handle * config
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.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
char * GNUNET_OS_get_libexec_binary_path(const char *progname)
Given the name of a gnunet-helper, gnunet-service or gnunet-daemon binary, try to prefix it with the ...
struct GNUNET_OS_Process * GNUNET_OS_start_process_vap(enum GNUNET_OS_InheritStdioFlags std_inheritance, struct GNUNET_DISK_PipeHandle *pipe_stdin, struct GNUNET_DISK_PipeHandle *pipe_stdout, struct GNUNET_DISK_PipeHandle *pipe_stderr, const char *filename, char *const argv[])
Start a process.
Definition: os_priority.c:567
@ GNUNET_OS_INHERIT_STD_ERR
When this flag is set, the child process will inherit stderr of the parent.
Definition: gnunet_os_lib.h:95
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
#define GNUNET_TIME_STD_BACKOFF(r)
Perform our standard exponential back-off calculation, starting at 1 ms and then going by a factor of...
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.
#define HELPER_TESTBED_BINARY
Testbed Helper binary name.
Definition: testbed_api.h:38
static char ** gen_rsh_args(const char *port, const char *hostname, const char *username)
Generates arguments for opening a remote shell.
static char ** gen_rsh_suffix_args(const char *const *append_args)
Generates the arguments needed for executing the given binary in a remote shell.
static void habitability_check(void *cls)
Task for checking whether a host is habitable or not.
static void free_argv(char **argv)
Frees the given NULL terminated arguments.
static char ** join_argv(const char *const *argv1, const char *const *argv2)
Function to join NULL terminated list of arguments.

References GNUNET_TESTBED_HostHabitableCheckHandle::cb, GNUNET_TESTBED_HostHabitableCheckHandle::cb_cls, config, free_argv(), gen_rsh_args(), gen_rsh_suffix_args(), GNUNET_asprintf(), GNUNET_break, GNUNET_CONFIGURATION_get_value_filename(), GNUNET_free, GNUNET_new, GNUNET_OK, GNUNET_OS_get_libexec_binary_path(), GNUNET_OS_INHERIT_STD_ERR, GNUNET_OS_start_process_vap(), GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_STD_BACKOFF, h, habitability_check(), HELPER_TESTBED_BINARY, GNUNET_TESTBED_HostHabitableCheckHandle::host, hostname, GNUNET_TESTBED_Host::hostname, join_argv(), port, GNUNET_TESTBED_Host::port, and GNUNET_TESTBED_Host::username.

Referenced by GNUNET_TESTBED_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_is_host_habitable_cancel()

void GNUNET_TESTBED_is_host_habitable_cancel ( struct GNUNET_TESTBED_HostHabitableCheckHandle handle)

Function to cancel a request started using GNUNET_TESTBED_is_host_habitable()

Parameters
handlethe habitability check handle

Definition at line 1359 of file testbed_api_hosts.c.

1361 {
1362  GNUNET_SCHEDULER_cancel (handle->habitability_check_task);
1364  (void) GNUNET_OS_process_wait (handle->auxp);
1366  free_argv (handle->helper_argv);
1367  GNUNET_free (handle);
1368 }
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
void GNUNET_OS_process_destroy(struct GNUNET_OS_Process *proc)
Cleans up process structure contents (OS-dependent) and deallocates it.
Definition: os_priority.c:260
int GNUNET_OS_process_kill(struct GNUNET_OS_Process *proc, int sig)
Sends a signal to the process.
Definition: os_priority.c:210
enum GNUNET_GenericReturnValue GNUNET_OS_process_wait(struct GNUNET_OS_Process *proc)
Wait for a process to terminate.
Definition: os_priority.c:871
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:975
#define GNUNET_TERM_SIG
The termination signal.
Definition: platform.h:234

References free_argv(), GNUNET_free, GNUNET_OS_process_destroy(), GNUNET_OS_process_kill(), GNUNET_OS_process_wait(), GNUNET_SCHEDULER_cancel(), GNUNET_TERM_SIG, and handle.

Referenced by GNUNET_TESTBED_run(), and rc_cleanup_operations().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_host_get_hostname()

const char* GNUNET_TESTBED_host_get_hostname ( const struct GNUNET_TESTBED_Host host)

Obtain the host's hostname.

Parameters
hosthandle to the host, NULL means 'localhost'
Returns
hostname of the host

Definition at line 232 of file testbed_api_hosts.c.

233 {
234  return host->hostname;
235 }

References GNUNET_TESTBED_Host::hostname.

Referenced by GNUNET_TESTBED_controller_connect(), GNUNET_TESTBED_register_host(), helper_mst(), and host_habitable_cb().

Here is the caller graph for this function:

◆ GNUNET_TESTBED_controller_start()

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.

The given host's configuration is used as a Template configuration to use for the remote controller; the remote controller will be started with a slightly modified configuration (port numbers, unix domain sockets and service home values are changed as per TESTING library on the remote host). The modified configuration replaces the host's existing configuration before signalling success through the GNUNET_TESTBED_ControllerStatusCallback()

Parameters
trusted_ipthe ip address of the controller which will be set as TRUSTED HOST(all connections from this ip are permitted by the testbed) when starting testbed controller at host. This can either be a single ip address or a network address in CIDR notation.
hostthe host where the controller has to be started. CANNOT be NULL.
cbfunction called when the controller is successfully started or dies unexpectedly; GNUNET_TESTBED_controller_stop shouldn't be called if cb is called with GNUNET_SYSERR as status. Will never be called in the same task as 'GNUNET_TESTBED_controller_start' (synchronous errors will be signalled by returning NULL). This parameter cannot be NULL.
clsclosure for above callbacks
Returns
the controller process handle, NULL on errors

The given host's configuration is used as a Template configuration to use for the remote controller; the remote controller will be started with a slightly modified configuration (port numbers, unix domain sockets and service home values are changed as per TESTING library on the remote host). The modified configuration replaces the host's existing configuration before signalling success through the GNUNET_TESTBED_ControllerStatusCallback()

Parameters
trusted_ipthe ip address of the controller which will be set as TRUSTED HOST(all connections form this ip are permitted by the testbed) when starting testbed controller at host. This can either be a single ip address or a network address in CIDR notation.
hostthe host where the controller has to be started. CANNOT be NULL.
cbfunction called when the controller is successfully started or dies unexpectedly; GNUNET_TESTBED_controller_stop shouldn't be called if cb is called with GNUNET_SYSERR as status. Will never be called in the same task as 'GNUNET_TESTBED_controller_start' (synchronous errors will be signalled by returning NULL). This parameter cannot be NULL.
clsclosure for above callbacks
Returns
the controller process handle, NULL on errors

Definition at line 1037 of file testbed_api_hosts.c.

1041 {
1042  struct GNUNET_TESTBED_ControllerProc *cp;
1044  const struct GNUNET_CONFIGURATION_Handle *cfg;
1045  const char *hostname;
1046  static char *const binary_argv[] = { HELPER_TESTBED_BINARY, NULL };
1047 
1048  GNUNET_assert (NULL != host);
1049  GNUNET_assert (NULL != (cfg = GNUNET_TESTBED_host_get_cfg_ (host)));
1050  hostname = NULL;
1051  API_VIOLATION (
1052  GNUNET_NO == host->locked,
1053  "Host is already locked by a previous call to GNUNET_TESTBED_controller_start()");
1054  host->locked = GNUNET_YES;
1055  API_VIOLATION (
1056  GNUNET_NO == host->controller_started,
1057  "Attempting to start a controller on a host on which a controller is already started");
1059  if (0 == GNUNET_TESTBED_host_get_id_ (host))
1060  {
1063  binary_argv,
1064  &helper_mst,
1065  &helper_exp_cb,
1066  cp);
1067  }
1068  else
1069  {
1070  char *helper_binary_path_args[2];
1071  char **rsh_args;
1072  char **rsh_suffix_args;
1073  const char *username;
1074  char *port;
1075  char *argstr;
1076  char *aux;
1077  unsigned int cnt;
1078 
1079  username = host->username;
1080  hostname = host->hostname;
1081  GNUNET_asprintf (&port, "%u", host->port);
1082  LOG_DEBUG ("Starting remote connection to destination %s\n", hostname);
1083  if (GNUNET_OK !=
1085  "testbed",
1086  "HELPER_BINARY_PATH",
1087  &helper_binary_path_args[0]))
1088  helper_binary_path_args[0] =
1090  helper_binary_path_args[1] = NULL;
1091  rsh_args = gen_rsh_args (port, hostname, username);
1092  rsh_suffix_args =
1093  gen_rsh_suffix_args ((const char **) helper_binary_path_args);
1094  cp->helper_argv =
1095  join_argv ((const char **) rsh_args, (const char **) rsh_suffix_args);
1096  free_argv (rsh_args);
1097  free_argv (rsh_suffix_args);
1098  GNUNET_free (port);
1099  argstr = GNUNET_strdup ("");
1100  for (cnt = 0; NULL != cp->helper_argv[cnt]; cnt++)
1101  {
1102  aux = argstr;
1103  GNUNET_assert (
1104  0 < GNUNET_asprintf (&argstr, "%s %s", aux, cp->helper_argv[cnt]));
1105  GNUNET_free (aux);
1106  }
1107  LOG_DEBUG ("Helper cmd str: %s\n", argstr);
1108  GNUNET_free (argstr);
1110  cp->helper_argv[0],
1111  cp->helper_argv,
1112  &helper_mst,
1113  &helper_exp_cb,
1114  cp);
1115  GNUNET_free (helper_binary_path_args[0]);
1116  }
1117  if (NULL == cp->helper)
1118  {
1119  if (NULL != cp->helper_argv)
1120  free_argv (cp->helper_argv);
1121  GNUNET_free (cp);
1122  return NULL;
1123  }
1124  cp->host = host;
1125  cp->cb = cb;
1126  cp->cls = cls;
1128  cp->msg = &msg->header;
1129  cp->shandle =
1130  GNUNET_HELPER_send (cp->helper, &msg->header, GNUNET_NO, &clear_msg, cp);
1131  if (NULL == cp->shandle)
1132  {
1133  GNUNET_free (msg);
1135  return NULL;
1136  }
1137  return cp;
1138 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_HELPER_SendHandle * GNUNET_HELPER_send(struct GNUNET_HELPER_Handle *h, const struct GNUNET_MessageHeader *msg, int can_drop, GNUNET_HELPER_Continuation cont, void *cont_cls)
Send an message to the helper.
Definition: helper.c:615
struct GNUNET_HELPER_Handle * GNUNET_HELPER_start(int with_control_pipe, const char *binary_name, char *const binary_argv[], GNUNET_MessageTokenizerCallback cb, GNUNET_HELPER_ExceptionCallback exp_cb, void *cb_cls)
Starts a helper and begins reading from it.
Definition: helper.c:462
@ GNUNET_NO
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...
Handle for controller process.
struct GNUNET_HELPER_SendHandle * shandle
The send handle for the helper.
char ** helper_argv
The arguments used to start the helper.
GNUNET_TESTBED_ControllerStatusCallback cb
The controller error callback.
struct GNUNET_HELPER_Handle * helper
The process handle.
struct GNUNET_MessageHeader * msg
The message corresponding to send handle.
struct GNUNET_TESTBED_Host * host
The host where the helper is run.
void * cls
The closure for the above callback.
Initialization message for gnunet-helper-testbed to start testbed service.
int locked
Is this host locked by GNUNET_TESTBED_controller_start()?
int controller_started
Is a controller started on this host? FIXME: Is this needed?
struct GNUNET_TESTBED_HelperInit * GNUNET_TESTBED_create_helper_init_msg_(const char *trusted_ip, const char *hostname, const struct GNUNET_CONFIGURATION_Handle *cfg)
Creates a helper initialization message.
Definition: testbed_api.c:1957
static void clear_msg(void *cls, int result)
Continuation function from GNUNET_HELPER_send()
#define API_VIOLATION(cond, errstr)
Prints API violation message.
static void helper_exp_cb(void *cls)
Callback that will be called when the helper process dies.
#define LOG_DEBUG(...)
Debug logging shorthand.
static int helper_mst(void *cls, const struct GNUNET_MessageHeader *message)
Functions with this signature are called whenever a complete message is received by the tokenizer.
const struct GNUNET_CONFIGURATION_Handle * GNUNET_TESTBED_host_get_cfg_(const struct GNUNET_TESTBED_Host *host)
Obtain the host's configuration template.

References API_VIOLATION, GNUNET_TESTBED_ControllerProc::cb, cfg, clear_msg(), GNUNET_TESTBED_ControllerProc::cls, GNUNET_TESTBED_Host::controller_started, free_argv(), gen_rsh_args(), gen_rsh_suffix_args(), GNUNET_asprintf(), GNUNET_assert, GNUNET_CONFIGURATION_get_value_filename(), GNUNET_free, GNUNET_HELPER_send(), GNUNET_HELPER_start(), GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_OS_get_libexec_binary_path(), GNUNET_strdup, GNUNET_TESTBED_controller_stop(), GNUNET_TESTBED_create_helper_init_msg_(), GNUNET_TESTBED_host_get_cfg_(), GNUNET_TESTBED_host_get_id_(), GNUNET_YES, GNUNET_TESTBED_ControllerProc::helper, GNUNET_TESTBED_ControllerProc::helper_argv, helper_exp_cb(), helper_mst(), HELPER_TESTBED_BINARY, GNUNET_TESTBED_ControllerProc::host, hostname, GNUNET_TESTBED_Host::hostname, join_argv(), GNUNET_TESTBED_Host::locked, LOG_DEBUG, msg, GNUNET_TESTBED_ControllerProc::msg, port, GNUNET_TESTBED_Host::port, GNUNET_TESTBED_ControllerProc::shandle, and GNUNET_TESTBED_Host::username.

Referenced by GNUNET_TESTBED_run(), handle_link_controllers(), and host_habitable_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_controller_stop()

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).

This function blocks until the testbed has been fully terminated (!). The controller status cb from GNUNET_TESTBED_controller_start() will not be called.

Parameters
cprocthe controller process handle

Definition at line 1187 of file testbed_api_hosts.c.

1188 {
1191 }
void GNUNET_TESTBED_controller_kill_(struct GNUNET_TESTBED_ControllerProc *cproc)
Sends termination signal to the controller's helper process.
void GNUNET_TESTBED_controller_destroy_(struct GNUNET_TESTBED_ControllerProc *cproc)
Cleans-up the controller's helper process handle.

References GNUNET_TESTBED_controller_destroy_(), and GNUNET_TESTBED_controller_kill_().

Referenced by cleanup(), do_shutdown(), GNUNET_TESTBED_controller_start(), and helper_exp_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_controller_connect()

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.

The configuration to use for the connection is retrieved from the given host where a controller is started using GNUNET_TESTBED_controller_start().

Parameters
hosthost to run the controller on; This should be the same host if the controller was previously started with GNUNET_TESTBED_controller_start()
event_maskbit mask with set of events to call 'cc' for; or-ed values of "1LL" shifted by the respective 'enum GNUNET_TESTBED_EventType' (e.g. "(1LL << GNUNET_TESTBED_ET_CONNECT) | ...")
cccontroller callback to invoke on events
cc_clsclosure for cc
Returns
handle to the controller

Connect to a controller process.

Parameters
hosthost to run the controller on; This should be the same host if the controller was previously started with GNUNET_TESTBED_controller_start()
event_maskbit mask with set of events to call 'cc' for; or-ed values of "1LL" shifted by the respective 'enum GNUNET_TESTBED_EventType' (e.g. "(1LL << GNUNET_TESTBED_ET_CONNECT) | ...")
cccontroller callback to invoke on events
cc_clsclosure for cc
Returns
handle to the controller

Definition at line 1555 of file testbed_api.c.

1559 {
1560  struct GNUNET_TESTBED_Controller *controller =
1563  { GNUNET_MQ_hd_var_size (add_host_confirm,
1566  controller),
1567  GNUNET_MQ_hd_fixed_size (peer_conevent,
1570  controller),
1571  GNUNET_MQ_hd_fixed_size (opsuccess,
1573  struct
1575  controller),
1576  GNUNET_MQ_hd_var_size (op_fail_event,
1579  controller),
1580  GNUNET_MQ_hd_fixed_size (peer_create_success,
1582  struct
1584  controller),
1585  GNUNET_MQ_hd_fixed_size (peer_event,
1588  controller),
1589  GNUNET_MQ_hd_var_size (peer_config,
1591  struct
1593  controller),
1594  GNUNET_MQ_hd_var_size (slave_config,
1597  controller),
1598  GNUNET_MQ_hd_var_size (link_controllers_result,
1601  controller),
1602  GNUNET_MQ_hd_var_size (barrier_status,
1605  controller),
1606  GNUNET_MQ_handler_end () };
1608  struct GNUNET_MQ_Envelope *env;
1609  const struct GNUNET_CONFIGURATION_Handle *cfg;
1610  const char *controller_hostname;
1611  unsigned long long max_parallel_operations;
1612  unsigned long long max_parallel_service_connections;
1613  unsigned long long max_parallel_topology_config_operations;
1614  size_t slen;
1615 
1616  GNUNET_assert (NULL != (cfg = GNUNET_TESTBED_host_get_cfg_ (host)));
1617  if (GNUNET_OK !=
1619  "testbed",
1620  "MAX_PARALLEL_OPERATIONS",
1621  &max_parallel_operations))
1622  {
1623  GNUNET_break (0);
1624  GNUNET_free (controller);
1625  return NULL;
1626  }
1627  if (GNUNET_OK !=
1629  "testbed",
1630  "MAX_PARALLEL_SERVICE_CONNECTIONS",
1631  &max_parallel_service_connections))
1632  {
1633  GNUNET_break (0);
1634  GNUNET_free (controller);
1635  return NULL;
1636  }
1638  cfg,
1639  "testbed",
1640  "MAX_PARALLEL_TOPOLOGY_CONFIG_OPERATIONS",
1641  &max_parallel_topology_config_operations))
1642  {
1643  GNUNET_break (0);
1644  GNUNET_free (controller);
1645  return NULL;
1646  }
1647  controller->cc = cc;
1648  controller->cc_cls = cc_cls;
1649  controller->event_mask = event_mask;
1650  controller->cfg = GNUNET_CONFIGURATION_dup (cfg);
1651  controller->mq = GNUNET_CLIENT_connect (controller->cfg,
1652  "testbed",
1653  handlers,
1655  controller);
1656  if (NULL == controller->mq)
1657  {
1658  GNUNET_break (0);
1660  return NULL;
1661  }
1662  GNUNET_TESTBED_mark_host_registered_at_ (host, controller);
1663  controller->host = host;
1664  controller->opq_parallel_operations =
1666  (unsigned int)
1667  max_parallel_operations);
1668  controller->opq_parallel_service_connections =
1670  (unsigned int)
1671  max_parallel_service_connections);
1675  (unsigned int) max_parallel_topology_config_operations);
1676  controller_hostname = GNUNET_TESTBED_host_get_hostname (host);
1677  if (NULL == controller_hostname)
1678  controller_hostname = "127.0.0.1";
1679  slen = strlen (controller_hostname) + 1;
1681  msg->host_id = htonl (GNUNET_TESTBED_host_get_id_ (host));
1682  msg->event_mask = GNUNET_htonll (controller->event_mask);
1683  GNUNET_memcpy (&msg[1], controller_hostname, slen);
1684  GNUNET_MQ_send (controller->mq, env);
1685  return controller;
1686 }
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
static struct GNUNET_CADET_MessageHandler handlers[]
Handlers, for diverse services.
uint64_t event_mask
Global event mask for all testbed events.
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
Definition: client.c:1057
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.
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
Definition: common_endian.c:37
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:304
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
Definition: gnunet_mq_lib.h:63
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
#define GNUNET_MESSAGE_TYPE_TESTBED_INIT
Initial message from a client to a testing control service.
#define GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT
Message to signal the result of GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS request.
#define GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT
Message for peer events.
#define GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER_SUCCESS
Message to signal successful peer creation.
#define GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS
Message for signalling status of a barrier.
#define GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS
Message to signal that a add host succeeded.
#define GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION
Message which contains the configuration of slave controller.
#define GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS
Message to signal a generic operation has been successful.
#define GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT
Message for operation events.
#define GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION
Message containing the peer's information.
#define GNUNET_MESSAGE_TYPE_TESTBED_PEER_CONNECT_EVENT
Message for peer connect events.
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
const char * GNUNET_TESTBED_host_get_hostname(const struct GNUNET_TESTBED_Host *host)
Obtain the host's hostname.
Message handler for a specific message type.
Message for signalling status changes of a barrier.
Definition: testbed.h:822
Event notification from a controller to a client.
Definition: testbed.h:476
Response message for ControllerLinkRequest message.
Definition: testbed.h:170
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:194
uint64_t event_mask
The controller event mask.
Definition: testbed_api.h:265
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:208
struct OperationQueue * opq_parallel_topology_config_operations
Operation queue for simultaneous topology configuration operations.
Definition: testbed_api.h:254
struct OperationQueue * opq_parallel_service_connections
Operation queue for simultaneous service connections.
Definition: testbed_api.h:249
struct GNUNET_MQ_Handle * mq
The message queue to the controller service.
Definition: testbed_api.h:218
struct GNUNET_TESTBED_Host * host
The host where the controller is running.
Definition: testbed_api.h:198
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:203
struct OperationQueue * opq_parallel_operations
Operation queue for simultaneous operations.
Definition: testbed_api.h:244
struct GNUNET_CONFIGURATION_Handle * cfg
The configuration to use while connecting to controller.
Definition: testbed_api.h:213
Event notification from a controller to a client for a generic operational success where the operatio...
Definition: testbed.h:558
Confirmation from the service that adding a host worked (or failed).
Definition: testbed.h:115
Initial message from a client to a testing control service.
Definition: testbed.h:37
Event notification from a controller to a client.
Definition: testbed.h:509
Peer configuration and identity reply from controller to a client.
Definition: testbed.h:604
Event notification from a controller to a client.
Definition: testbed.h:534
Event notification from a controller to a client.
Definition: testbed.h:443
Reply to GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION message.
Definition: testbed.h:660
static void mq_error_handler(void *cls, enum GNUNET_MQ_Error error)
Generic error handler, called with the appropriate error code and the same closure specified at the c...
Definition: testbed_api.c:1529
void GNUNET_TESTBED_mark_host_registered_at_(struct GNUNET_TESTBED_Host *host, const struct GNUNET_TESTBED_Controller *const controller)
Marks a host as registered with a controller.
@ OPERATION_QUEUE_TYPE_FIXED
Operation queue which permits a fixed maximum number of operations to be active at any time.

References GNUNET_TESTBED_Controller::cc, GNUNET_TESTBED_Controller::cc_cls, cfg, GNUNET_TESTBED_Controller::cfg, env, event_mask, GNUNET_TESTBED_Controller::event_mask, GNUNET_assert, GNUNET_break, GNUNET_CLIENT_connect(), GNUNET_CONFIGURATION_dup(), GNUNET_CONFIGURATION_get_value_number(), GNUNET_free, GNUNET_htonll(), GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS, GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS, GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER_SUCCESS, GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS, GNUNET_MESSAGE_TYPE_TESTBED_INIT, GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT, GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT, GNUNET_MESSAGE_TYPE_TESTBED_PEER_CONNECT_EVENT, GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT, GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION, GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, GNUNET_OK, GNUNET_TESTBED_controller_disconnect(), GNUNET_TESTBED_host_get_cfg_(), GNUNET_TESTBED_host_get_hostname(), GNUNET_TESTBED_host_get_id_(), GNUNET_TESTBED_mark_host_registered_at_(), GNUNET_TESTBED_operation_queue_create_(), handlers, GNUNET_TESTBED_Controller::host, GNUNET_TESTBED_Controller::mq, mq_error_handler(), msg, OPERATION_QUEUE_TYPE_FIXED, GNUNET_TESTBED_Controller::opq_parallel_operations, GNUNET_TESTBED_Controller::opq_parallel_service_connections, and GNUNET_TESTBED_Controller::opq_parallel_topology_config_operations.

Referenced by controller_status_cb(), opstart_neighbour_conn(), and slave_status_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_controller_disconnect()

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).

This function blocks until the testbed has been fully terminated (!).

Parameters
chandle to controller to stop

Definition at line 1721 of file testbed_api.c.

1722 {
1723  if (NULL != c->mq)
1724  {
1725  GNUNET_MQ_destroy (c->mq);
1726  c->mq = NULL;
1727  }
1728  if (NULL != c->host)
1735  if (NULL != c->opc_map)
1736  {
1740  c->opc_map));
1743  }
1744  GNUNET_free (c);
1745 }
unsigned int GNUNET_CONTAINER_multihashmap32_size(const struct GNUNET_CONTAINER_MultiHashMap32 *map)
Get the number of key-value pairs in the 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_SYSERR
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:683
struct GNUNET_CONTAINER_MultiHashMap32 * opc_map
The map of active operation contexts.
Definition: testbed_api.h:229
static int opc_free_iterator(void *cls, uint32_t key, void *value)
Iterator to free opc map entries.
Definition: testbed_api.c:1699
void GNUNET_TESTBED_deregister_host_at_(struct GNUNET_TESTBED_Host *host, const struct GNUNET_TESTBED_Controller *const controller)
Unmarks a host registered at a controller.

References OperationContext::c, GNUNET_TESTBED_Controller::cfg, GNUNET_assert, GNUNET_CONFIGURATION_destroy(), GNUNET_CONTAINER_multihashmap32_destroy(), GNUNET_CONTAINER_multihashmap32_iterate(), GNUNET_CONTAINER_multihashmap32_size(), GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SYSERR, GNUNET_TESTBED_deregister_host_at_(), GNUNET_TESTBED_operation_queue_destroy_(), GNUNET_TESTBED_Controller::host, GNUNET_TESTBED_Controller::mq, opc_free_iterator(), GNUNET_TESTBED_Controller::opc_map, GNUNET_TESTBED_Controller::opq_parallel_operations, GNUNET_TESTBED_Controller::opq_parallel_service_connections, and GNUNET_TESTBED_Controller::opq_parallel_topology_config_operations.

Referenced by cleanup(), do_shutdown(), GNUNET_TESTBED_controller_connect(), kill_slave(), and oprelease_neighbour_conn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_register_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.

This makes the controller aware of the host. A host should be registered at the controller before starting a sub-controller on that host using GNUNET_TESTBED_controller_link().

Parameters
controllerthe controller handle
hostthe host to register
ccthe completion callback to call to inform the status of registration. After calling this callback the registration handle will be invalid. Cannot be NULL
cc_clsthe closure for the cc
Returns
handle to the host registration which can be used to cancel the registration; NULL if another registration handle is present and is not cancelled
Parameters
controllerthe controller handle
hostthe host to register
ccthe completion callback to call to inform the status of registration. After calling this callback the registration handle will be invalid. Cannot be NULL.
cc_clsthe closure for the cc
Returns
handle to the host registration which can be used to cancel the registration

Definition at line 1384 of file testbed_api_hosts.c.

1388 {
1391  const char *username;
1392  const char *hostname;
1393  char *config;
1394  char *cconfig;
1395  void *ptr;
1396  size_t cc_size;
1397  size_t config_size;
1398  uint16_t msg_size;
1399  uint16_t username_length;
1400  uint16_t hostname_length;
1401 
1402  if (NULL != controller->rh)
1403  return NULL;
1405  if (GNUNET_YES == GNUNET_TESTBED_is_host_registered_ (host, controller))
1406  {
1408  "Host hostname: %s already registered\n",
1409  (NULL == hostname) ? "localhost" : hostname);
1410  return NULL;
1411  }
1413  rh->host = host;
1414  rh->c = controller;
1415  GNUNET_assert (NULL != cc);
1416  rh->cc = cc;
1417  rh->cc_cls = cc_cls;
1418  controller->rh = rh;
1419  username = GNUNET_TESTBED_host_get_username_ (host);
1420  username_length = 0;
1421  if (NULL != username)
1422  username_length = strlen (username);
1423  GNUNET_assert (NULL != hostname); /* Hostname must be present */
1424  hostname_length = strlen (hostname);
1425  GNUNET_assert (NULL != host->cfg);
1427  cc_size = GNUNET_TESTBED_compress_config_ (config, config_size, &cconfig);
1428  GNUNET_free (config);
1429  msg_size = (sizeof(struct GNUNET_TESTBED_AddHostMessage));
1430  msg_size += username_length;
1431  msg_size += hostname_length;
1432  msg_size += cc_size;
1433  msg = GNUNET_malloc (msg_size);
1434  msg->header.size = htons (msg_size);
1435  msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST);
1436  msg->host_id = htonl (GNUNET_TESTBED_host_get_id_ (host));
1437  msg->ssh_port = htons (GNUNET_TESTBED_host_get_ssh_port_ (host));
1438  ptr = &msg[1];
1439  if (NULL != username)
1440  {
1441  msg->username_length = htons (username_length);
1442  GNUNET_memcpy (ptr, username, username_length);
1443  ptr += username_length;
1444  }
1445  msg->hostname_length = htons (hostname_length);
1447  ptr += hostname_length;
1448  msg->config_size = htons (config_size);
1449  GNUNET_memcpy (ptr, cconfig, cc_size);
1450  ptr += cc_size;
1451  GNUNET_assert ((ptr - (void *) msg) == msg_size);
1452  GNUNET_free (cconfig);
1453  GNUNET_TESTBED_queue_message_ (controller,
1454  (struct GNUNET_MessageHeader *) msg);
1455  return rh;
1456 }
char * GNUNET_CONFIGURATION_serialize(const struct GNUNET_CONFIGURATION_Handle *cfg, size_t *size)
Serializes the given configuration.
#define GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST
Message to add host.
Header for all communications.
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
Notify the service about a host that we intend to use.
Definition: testbed.h:65
uint16_t username_length
Number of bytes in the user name that follows; 0 to use no user name; otherwise 'strlen (username)',...
Definition: testbed.h:86
uint16_t hostname_length
Number of bytes in the host name (excluding 0-termination) that follows the user name; cannot be 0.
Definition: testbed.h:92
uint16_t config_size
The length of the uncompressed configuration.
Definition: testbed.h:97
struct GNUNET_TESTBED_HostRegistrationHandle * rh
The host registration handle; NULL if no current registration requests are present.
Definition: testbed_api.h:224
handle for host registration
struct GNUNET_TESTBED_Host * host
The host being registered.
struct GNUNET_TESTBED_Controller * c
The controller at which this host is being registered.
GNUNET_TESTBED_HostRegistrationCompletion cc
The Registration completion callback.
void * cc_cls
The closure for above callback.
void GNUNET_TESTBED_queue_message_(struct GNUNET_TESTBED_Controller *controller, struct GNUNET_MessageHeader *msg)
Queues a message in send queue for sending to the service.
Definition: testbed_api.c:1336
size_t GNUNET_TESTBED_compress_config_(const char *config, size_t size, char **xconfig)
Compresses given configuration using zlib compress.
Definition: testbed_api.c:1758
const char * GNUNET_TESTBED_host_get_username_(const struct GNUNET_TESTBED_Host *host)
Obtain the host's username.
int GNUNET_TESTBED_is_host_registered_(const struct GNUNET_TESTBED_Host *host, const struct GNUNET_TESTBED_Controller *const controller)
Checks whether a host has been registered.
uint16_t GNUNET_TESTBED_host_get_ssh_port_(const struct GNUNET_TESTBED_Host *host)
Obtain the host's ssh port.

References GNUNET_TESTBED_HostRegistrationHandle::c, GNUNET_TESTBED_HostRegistrationHandle::cc, GNUNET_TESTBED_HostRegistrationHandle::cc_cls, GNUNET_TESTBED_Host::cfg, config, GNUNET_TESTBED_AddHostMessage::config_size, GNUNET_assert, GNUNET_CONFIGURATION_serialize(), GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_malloc, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST, GNUNET_new, GNUNET_TESTBED_compress_config_(), GNUNET_TESTBED_host_get_hostname(), GNUNET_TESTBED_host_get_id_(), GNUNET_TESTBED_host_get_ssh_port_(), GNUNET_TESTBED_host_get_username_(), GNUNET_TESTBED_is_host_registered_(), GNUNET_TESTBED_queue_message_(), GNUNET_YES, GNUNET_TESTBED_HostRegistrationHandle::host, hostname, GNUNET_TESTBED_AddHostMessage::hostname_length, LOG, msg, GNUNET_TESTBED_Controller::rh, GNUNET_MessageHeader::size, GNUNET_MessageHeader::type, and GNUNET_TESTBED_AddHostMessage::username_length.

Referenced by register_hosts(), and register_next_host().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_cancel_registration()

void GNUNET_TESTBED_cancel_registration ( struct GNUNET_TESTBED_HostRegistrationHandle handle)

Cancel the pending registration.

Note that the registration message will already be queued to be sent to the service, cancellation has only the effect that the registration completion callback for the registration is never called and from our perspective the host is not registered until the completion callback is called.

Parameters
handlethe registration handle to cancel

Note that if the registration message is already sent to the service the cancellation has only the effect that the registration completion callback for the registration is never called.

Parameters
handlethe registration handle to cancel

Definition at line 1467 of file testbed_api_hosts.c.

1469 {
1470  if (handle != handle->c->rh)
1471  {
1472  GNUNET_break (0);
1473  return;
1474  }
1475  handle->c->rh = NULL;
1476  GNUNET_free (handle);
1477 }
GNUNET_DNS_RequestHandler rh
Function to call to get replies.
Definition: dns_api.c:71

References GNUNET_break, GNUNET_free, handle, and GNUNET_DNS_Handle::rh.

Referenced by do_shutdown(), kill_slave(), and rc_cleanup_operations().

Here is the caller graph for this function:

◆ GNUNET_TESTBED_controller_link()

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.

Whenever the master controller is asked to start a peer at the delegated controller the request will be routed towards slave controller (if a route exists). The slave controller will then route it to the delegated controller. The configuration of the delegated controller is given and is used to either create the delegated controller or to connect to an existing controller. Note that while starting the delegated controller the configuration will be modified to accommodate available free ports. the 'is_subordinate' specifies if the given delegated controller should be started and managed by the slave controller, or if the delegated controller already has a master and the slave controller connects to it as a non master controller. The success or failure of this operation will be signalled through the GNUNET_TESTBED_ControllerCallback() with an event of type GNUNET_TESTBED_ET_OPERATION_FINISHED

Parameters
op_clsthe operation closure for the event which is generated to signal success or failure of this operation
masterhandle to the master controller who creates the association
delegated_hostrequests to which host should be delegated; cannot be NULL
slave_hostwhich host is used to run the slave controller; use NULL to make the master controller connect to the delegated host
is_subordinateGNUNET_YES if the controller at delegated_host should be started by the slave controller; GNUNET_NO if the slave controller has to connect to the already started delegated controller via TCP/IP
Returns
the operation handle

Whenever the master controller is asked to start a peer at the delegated controller the request will be routed towards slave controller (if a route exists). The slave controller will then route it to the delegated controller. The configuration of the delegated controller is given and is used to either create the delegated controller or to connect to an existing controller. Note that while starting the delegated controller the configuration will be modified to accommodate available free ports. the 'is_subordinate' specifies if the given delegated controller should be started and managed by the slave controller, or if the delegated controller already has a master and the slave controller connects to it as a non master controller. The success or failure of this operation will be signalled through the GNUNET_TESTBED_ControllerCallback() with an event of type GNUNET_TESTBED_ET_OPERATION_FINISHED

Parameters
op_clsthe operation closure for the event which is generated to signal success or failure of this operation
masterhandle to the master controller who creates the association
delegated_hostrequests to which host should be delegated; cannot be NULL
slave_hostwhich host is used to run the slave controller; use NULL to make the master controller connect to the delegated host
is_subordinateGNUNET_YES if the controller at delegated_host should be started by the slave controller; GNUNET_NO if the slave controller has to connect to the already started delegated controller via TCP/IP
Returns
the operation handle

Definition at line 1832 of file testbed_api.c.

1837 {
1838  struct OperationContext *opc;
1840  struct ControllerLinkData *data;
1841  uint32_t slave_host_id;
1842  uint32_t delegated_host_id;
1843  uint16_t msg_size;
1844 
1846  GNUNET_TESTBED_is_host_registered_ (delegated_host, master));
1847  slave_host_id = GNUNET_TESTBED_host_get_id_ (
1848  (NULL != slave_host) ? slave_host : master->host);
1849  delegated_host_id = GNUNET_TESTBED_host_get_id_ (delegated_host);
1850  if ((NULL != slave_host) && (0 != slave_host_id))
1852  GNUNET_TESTBED_is_host_registered_ (slave_host, master));
1853  msg_size = sizeof(struct GNUNET_TESTBED_ControllerLinkRequest);
1854  msg = GNUNET_malloc (msg_size);
1856  msg->header.size = htons (msg_size);
1857  msg->delegated_host_id = htonl (delegated_host_id);
1858  msg->slave_host_id = htonl (slave_host_id);
1859  msg->is_subordinate = (GNUNET_YES == is_subordinate) ? 1 : 0;
1860  data = GNUNET_new (struct ControllerLinkData);
1861  data->msg = msg;
1862  data->host_id = delegated_host_id;
1863  opc = GNUNET_new (struct OperationContext);
1864  opc->c = master;
1865  opc->data = data;
1866  opc->type = OP_LINK_CONTROLLERS;
1867  opc->id = GNUNET_TESTBED_get_next_op_id (opc->c);
1868  opc->state = OPC_STATE_INIT;
1869  opc->op_cls = op_cls;
1870  msg->operation_id = GNUNET_htonll (opc->id);
1875  opc->op);
1877  return opc->op;
1878 }
#define GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS
Message to link delegated controller to slave controller.
Context data for controller link operations.
Definition: testbed_api.c:100
Client notifies controller that it should delegate requests for a particular client to a particular s...
Definition: testbed.h:137
uint32_t slave_host_id
Which host is responsible for managing the delegation? NBO.
Definition: testbed.h:156
uint32_t delegated_host_id
For which host should requests be delegated? NBO.
Definition: testbed.h:146
uint8_t is_subordinate
Set to 1 if the receiving controller is the master controller for the slave host (and thus responsibl...
Definition: testbed.h:162
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:137
void * op_cls
The operation closure.
Definition: testbed_api.h:151
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:171
enum OperationType type
The type of operation.
Definition: testbed_api.h:166
uint64_t id
The id of the operation.
Definition: testbed_api.h:161
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:146
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:141
void * data
Data relevant to the operation.
Definition: testbed_api.h:156
uint64_t GNUNET_TESTBED_get_next_op_id(struct GNUNET_TESTBED_Controller *controller)
Function to return the operation id for a controller.
Definition: testbed_api.c:2178
static void opstart_link_controllers(void *cls)
Function to call to start a link-controllers type operation once all queues the operation is part of ...
Definition: testbed_api.c:1422
static void oprelease_link_controllers(void *cls)
Callback which will be called when link-controllers type operation is released.
Definition: testbed_api.c:1444
@ OP_LINK_CONTROLLERS
Link controllers operation.
Definition: testbed_api.h:89
@ OPC_STATE_INIT
The initial state where the associated operation has just been created and is waiting in the operatio...
Definition: testbed_api.h:117
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_operation_create_(void *cls, OperationStart start, OperationRelease release)
Create an 'operation' to be performed.
void GNUNET_TESTBED_operation_queue_insert_(struct OperationQueue *queue, struct GNUNET_TESTBED_Operation *op)
Add an operation to a queue.
void GNUNET_TESTBED_operation_begin_wait_(struct GNUNET_TESTBED_Operation *op)
Marks the given operation as waiting on the queues.

References OperationContext::c, OperationContext::data, data, GNUNET_TESTBED_ControllerLinkRequest::delegated_host_id, GNUNET_assert, GNUNET_htonll(), GNUNET_malloc, GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS, GNUNET_new, GNUNET_TESTBED_get_next_op_id(), GNUNET_TESTBED_host_get_id_(), GNUNET_TESTBED_is_host_registered_(), GNUNET_TESTBED_operation_begin_wait_(), GNUNET_TESTBED_operation_create_(), GNUNET_TESTBED_operation_queue_insert_(), GNUNET_YES, GNUNET_TESTBED_Controller::host, OperationContext::id, GNUNET_TESTBED_ControllerLinkRequest::is_subordinate, msg, OperationContext::op, OperationContext::op_cls, OP_LINK_CONTROLLERS, OPC_STATE_INIT, GNUNET_TESTBED_Controller::opq_parallel_operations, oprelease_link_controllers(), opstart_link_controllers(), GNUNET_MessageHeader::size, GNUNET_TESTBED_ControllerLinkRequest::slave_host_id, OperationContext::state, GNUNET_MessageHeader::type, and OperationContext::type.

Referenced by lcf_proc_task(), and register_hosts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_get_slave_config()

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.

The completion of the operation is signalled through the controller_cb from GNUNET_TESTBED_controller_connect(). If the operation is successful the handle to the configuration is available in the generic pointer of operation_finished field of struct GNUNET_TESTBED_EventInformation.

Parameters
op_clsthe closure for the operation
masterthe handle to master controller
slave_hostthe host where the slave controller is running; the handle to the slave_host should remain valid until this operation is cancelled or marked as finished
Returns
the operation handle; NULL if the slave_host is not registered at master

Definition at line 1921 of file testbed_api.c.

1924 {
1925  if (GNUNET_NO == GNUNET_TESTBED_is_host_registered_ (slave_host, master))
1926  return NULL;
1927  return GNUNET_TESTBED_get_slave_config_ (op_cls,
1928  master,
1930  slave_host));
1931 }
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_get_slave_config_(void *op_cls, struct GNUNET_TESTBED_Controller *master, uint32_t slave_host_id)
Like GNUNET_TESTBED_get_slave_config(), however without the host registration check.
Definition: testbed_api.c:1894

References GNUNET_NO, GNUNET_TESTBED_get_slave_config_(), GNUNET_TESTBED_host_get_id_(), and GNUNET_TESTBED_is_host_registered_().

Here is the call graph for this function:

◆ GNUNET_TESTBED_peer_create()

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.

If the given controller is not running on the target host, it should find or create a controller at the target host and delegate creating the peer. Explicit delegation paths can be setup using 'GNUNET_TESTBED_controller_link'. If no explicit delegation path exists, a direct link with a subordinate controller is setup for the first delegated peer to a particular host; the subordinate controller is then destroyed once the last peer that was delegated to the remote host is stopped.

Creating the peer only creates the handle to manipulate and further configure the peer; use GNUNET_TESTBED_peer_start and GNUNET_TESTBED_peer_stop to actually start/stop the peer's processes.

Note that the given configuration will be adjusted by the controller to avoid port/path conflicts with other peers. The "final" configuration can be obtained using GNUNET_TESTBED_peer_get_information.

Parameters
controllercontroller process to use
hosthost to run the peer on; cannot be NULL
cfgTemplate configuration to use for the peer. Should exist until operation is cancelled or GNUNET_TESTBED_operation_done() is called
cbthe callback to call when the peer has been created
clsthe closure to the above callback
Returns
the operation handle

If the given controller is not running on the target host, it should find or create a controller at the target host and delegate creating the peer. Explicit delegation paths can be setup using 'GNUNET_TESTBED_controller_link'. If no explicit delegation path exists, a direct link with a subordinate controller is setup for the first delegated peer to a particular host; the subordinate controller is then destroyed once the last peer that was delegated to the remote host is stopped.

Creating the peer only creates the handle to manipulate and further configure the peer; use "GNUNET_TESTBED_peer_start" and "GNUNET_TESTBED_peer_stop" to actually start/stop the peer's processes.

Note that the given configuration will be adjusted by the controller to avoid port/path conflicts with other peers. The "final" configuration can be obtained using 'GNUNET_TESTBED_peer_get_information'.

Parameters
controllercontroller process to use
hosthost to run the peer on; cannot be NULL
cfgTemplate configuration to use for the peer. Should exist until operation is cancelled or GNUNET_TESTBED_operation_done() is called
cbthe callback to call when the peer has been created
clsthe closure to the above callback
Returns
the operation handle

Definition at line 591 of file testbed_api_peers.c.

595 {
596  struct GNUNET_TESTBED_Peer *peer;
597  struct PeerCreateData *data;
598  struct OperationContext *opc;
599  static uint32_t id_gen;
600 
602  peer->controller = controller;
603  peer->host = host;
604  peer->unique_id = id_gen++;
606  data = GNUNET_new (struct PeerCreateData);
607  data->host = host;
608  data->cfg = cfg;
609  data->cb = cb;
610  data->cls = cls;
611  data->peer = peer;
612  opc = GNUNET_new (struct OperationContext);
613  opc->c = controller;
614  opc->data = data;
615  opc->id = GNUNET_TESTBED_get_next_op_id (controller);
616  opc->type = OP_PEER_CREATE;
617  opc->op =
621  opc->op);
623  return opc->op;
624 }
A peer controlled by the testing framework.
enum PeerState state
Peer's state.
struct GNUNET_TESTBED_Controller * controller
Our controller context (not necessarily the controller that is responsible for starting/running the p...
uint32_t unique_id
Globally unique ID of the peer.
struct GNUNET_TESTBED_Host * host
Which host does this peer run on?
Data for the OperationType OP_PEER_CREATE.
@ OP_PEER_CREATE
Peer create operation.
Definition: testbed_api.h:49
static void oprelease_peer_create(void *cls)
Callback which will be called when peer_create type operation is released.
static void opstart_peer_create(void *cls)
Function to call to start a peer_create type operation once all queues the operation is part of decla...
@ TESTBED_PS_INVALID
State to signify that this peer is invalid.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.

References OperationContext::c, cfg, GNUNET_TESTBED_Peer::controller, OperationContext::data, data, GNUNET_new, GNUNET_TESTBED_get_next_op_id(), GNUNET_TESTBED_operation_begin_wait_(), GNUNET_TESTBED_operation_create_(), GNUNET_TESTBED_operation_queue_insert_(), GNUNET_TESTBED_Peer::host, OperationContext::id, OperationContext::op, OP_PEER_CREATE, GNUNET_TESTBED_Controller::opq_parallel_operations, oprelease_peer_create(), opstart_peer_create(), peer, GNUNET_TESTBED_Peer::state, TESTBED_PS_INVALID, OperationContext::type, and GNUNET_TESTBED_Peer::unique_id.

Referenced by create_peers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_peer_start()

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.

Parameters
op_clsthe closure for this operation; will be set in the event information
peerpeer to start
pccfunction to call upon completion
pcc_clsclosure for 'pcc'
Returns
handle to the operation
Parameters
op_clsthe closure for this operation; will be set in event->details.operation_finished.op_cls when this operation fails.
peerpeer to start
pccfunction to call upon completion
pcc_clsclosure for 'pcc'
Returns
handle to the operation

Definition at line 638 of file testbed_api_peers.c.

640 {
641  struct OperationContext *opc;
642  struct PeerEventData *data;
643 
644  data = GNUNET_new (struct PeerEventData);
645  data->peer = peer;
646  data->pcc = pcc;
647  data->pcc_cls = pcc_cls;
648  opc = GNUNET_new (struct OperationContext);
649  opc->c = peer->controller;
650  opc->data = data;
651  opc->op_cls = op_cls;
652  opc->id = GNUNET_TESTBED_get_next_op_id (opc->c);
653  opc->type = OP_PEER_START;
654  opc->op =
658  opc->op);
660  return opc->op;
661 }
Data for OperationType OP_PEER_START and OP_PEER_STOP.
GNUNET_TESTBED_PeerChurnCallback pcc
The Peer churn callback to call when this operation is completed.
void * pcc_cls
Closure for the above callback.
@ OP_PEER_START
Peer start operation.
Definition: testbed_api.h:54
static void oprelease_peer_start(void *cls)
Callback which will be called when peer start type operation is released.
static void opstart_peer_start(void *cls)
Function called when a peer start operation is ready.

References OperationContext::c, GNUNET_TESTBED_Peer::controller, OperationContext::data, data, GNUNET_new, GNUNET_TESTBED_get_next_op_id(), GNUNET_TESTBED_operation_begin_wait_(), GNUNET_TESTBED_operation_create_(), GNUNET_TESTBED_operation_queue_insert_(), OperationContext::id, OperationContext::op, OperationContext::op_cls, OP_PEER_START, GNUNET_TESTBED_Controller::opq_parallel_operations, oprelease_peer_start(), opstart_peer_start(), PeerEventData::pcc, PeerEventData::pcc_cls, peer, and OperationContext::type.

Referenced by start_peers_task().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_peer_stop()

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.

The handle remains valid (use GNUNET_TESTBED_peer_destroy to fully clean up the state of the peer).

Parameters
op_clsthe closure for this operation; will be set in the event information
peerpeer to stop
pccfunction to call upon completion
pcc_clsclosure for 'pcc'
Returns
handle to the operation

Definition at line 665 of file testbed_api_peers.c.

668 {
669  struct OperationContext *opc;
670  struct PeerEventData *data;
671 
672  data = GNUNET_new (struct PeerEventData);
673  data->peer = peer;
674  data->pcc = pcc;
675  data->pcc_cls = pcc_cls;
676  opc = GNUNET_new (struct OperationContext);
677  opc->c = peer->controller;
678  opc->data = data;
679  opc->op_cls = op_cls;
680  opc->id = GNUNET_TESTBED_get_next_op_id (opc->c);
681  opc->type = OP_PEER_STOP;
682  opc->op =
686  opc->op);
688  return opc->op;
689 }
@ OP_PEER_STOP
Peer stop operation.
Definition: testbed_api.h:59
static void opstart_peer_stop(void *cls)
Function called when a peer stop operation is ready.
static void oprelease_peer_stop(void *cls)
Callback which will be called when peer stop type operation is released.

References OperationContext::c, GNUNET_TESTBED_Peer::controller, OperationContext::data, data, GNUNET_new, GNUNET_TESTBED_get_next_op_id(), GNUNET_TESTBED_operation_begin_wait_(), GNUNET_TESTBED_operation_create_(), GNUNET_TESTBED_operation_queue_insert_(), OperationContext::id, OperationContext::op, OperationContext::op_cls, OP_PEER_STOP, GNUNET_TESTBED_Controller::opq_parallel_operations, oprelease_peer_stop(), opstart_peer_stop(), PeerEventData::pcc, PeerEventData::pcc_cls, peer, and OperationContext::type.

Here is the call graph for this function:

◆ GNUNET_TESTBED_peer_get_information()

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.

The controller callback will not be called with event type GNUNET_TESTBED_ET_OPERATION_FINISHED when result for this operation is available. Instead, the GNUNET_TESTBED_PeerInfoCallback() will be called. The peer information in the callback is valid until the operation is canceled.

Parameters
peerpeer to request information about
pitdesired information
cbthe convenience callback to be called when results for this operation are available
cb_clsthe closure for cb
Returns
handle to the operation

Definition at line 693 of file testbed_api_peers.c.

697 {
698  struct OperationContext *opc;
699  struct PeerInfoData *data;
700 
702  GNUNET_assert (NULL != cb);
703  data = GNUNET_new (struct PeerInfoData);
704  data->peer = peer;
705  data->pit = pit;
706  data->cb = cb;
707  data->cb_cls = cb_cls;
708  opc = GNUNET_new (struct OperationContext);
709  opc->c = peer->controller;
710  opc->data = data;
711  opc->type = OP_PEER_INFO;
712  opc->id = GNUNET_TESTBED_get_next_op_id (opc->c);
713  opc->op =
717  opc->op);
719  return opc->op;
720 }
Data for the OperationType OP_PEER_INFO.
GNUNET_TESTBED_PeerInfoCallback cb
The Peer info callback to call when this operation has completed.
void * cb_cls
The closure for peer info callback.
enum GNUNET_TESTBED_PeerInformationType pit
The type of peer information requested.
@ OP_PEER_INFO
Get peer information operation.
Definition: testbed_api.h:69
static void oprelease_peer_getinfo(void *cls)
Callback which will be called when peer stop type operation is released.
static void opstart_peer_getinfo(void *cls)
Function called when a peer get information operation is ready.

References OperationContext::c, PeerInfoData::cb, PeerInfoData::cb_cls, GNUNET_TESTBED_Peer::controller, OperationContext::data, data, GNUNET_assert, GNUNET_new, GNUNET_TESTBED_get_next_op_id(), GNUNET_TESTBED_operation_begin_wait_(), GNUNET_TESTBED_operation_create_(), GNUNET_TESTBED_operation_queue_insert_(), GNUNET_TESTBED_PIT_GENERIC, OperationContext::id, OperationContext::op, OP_PEER_INFO, GNUNET_TESTBED_Controller::opq_parallel_operations, oprelease_peer_getinfo(), opstart_peer_getinfo(), peer, PeerInfoData::pit, and OperationContext::type.

Referenced by run(), test_master(), test_run(), and tmain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_peer_update_configuration()

struct GNUNET_TESTBED_Operation* GNUNET_TESTBED_peer_update_configuration ( struct GNUNET_TESTBED_Peer peer,
const struct GNUNET_CONFIGURATION_Handle cfg 
)

Change peer configuration.

Ports and paths cannot be changed this way.

Parameters
peerpeer to change configuration for
cfgnew configuration
Returns
handle to the operation

Change peer configuration.

Must only be called while the peer is stopped. Ports and paths cannot be changed this way.

Parameters
peerpeer to change configuration for
cfgnew configuration (differences to existing configuration only)
Returns
handle to the operation

Definition at line 734 of file testbed_api_peers.c.

737 {
738  struct OperationContext *opc;
739  struct PeerReconfigureData *data;
740  size_t csize;
741 
743  data->peer = peer;
745  if (NULL == data->config)
746  {
747  GNUNET_free (data);
748  return NULL;
749  }
750  if (csize > UINT16_MAX)
751  {
752  GNUNET_break (0);
753  GNUNET_free (data->config);
754  GNUNET_free (data);
755  return NULL;
756  }
757  data->cfg_size = (uint16_t) csize;
758  opc = GNUNET_new (struct OperationContext);
759  opc->c = peer->controller;
760  opc->data = data;
761  opc->type = OP_PEER_RECONFIGURE;
762  opc->id = GNUNET_TESTBED_get_next_op_id (opc->c);
763  opc->op =
767  opc->op);
769  return opc->op;
770 }
static unsigned int csize
Data for the operations of type OP_PEER_RECONFIGURE.
@ OP_PEER_RECONFIGURE
Reconfigure a peer.
Definition: testbed_api.h:74
static void opstart_peer_reconfigure(void *cls)
Function called when a peer reconfigure operation is ready.
static void oprelease_peer_reconfigure(void *cls)
Callback which will be called when a peer reconfigure operation is released.

References OperationContext::c, cfg, GNUNET_TESTBED_Peer::controller, csize, OperationContext::data, data, GNUNET_break, GNUNET_CONFIGURATION_serialize(), GNUNET_free, GNUNET_new, GNUNET_TESTBED_get_next_op_id(), GNUNET_TESTBED_operation_begin_wait_(), GNUNET_TESTBED_operation_create_(), GNUNET_TESTBED_operation_queue_insert_(), OperationContext::id, OperationContext::op, OP_PEER_RECONFIGURE, GNUNET_TESTBED_Controller::opq_parallel_operations, oprelease_peer_reconfigure(), opstart_peer_reconfigure(), peer, and OperationContext::type.

Here is the call graph for this function:

◆ GNUNET_TESTBED_peer_destroy()

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).

Parameters
peerpeer to stop
Returns
handle to the operation

Definition at line 781 of file testbed_api_peers.c.

782 {
783  struct OperationContext *opc;
784 
785  opc = GNUNET_new (struct OperationContext);
786  opc->data = peer;
787  opc->c = peer->controller;
789  opc->type = OP_PEER_DESTROY;
790  opc->op =
794  opc->op);
796  return opc->op;
797 }
@ OP_PEER_DESTROY
Peer destroy operation.
Definition: testbed_api.h:64
static void opstart_peer_destroy(void *cls)
Function called when a peer destroy operation is ready.
static void oprelease_peer_destroy(void *cls)
Callback which will be called when peer_create type operation is released.

References OperationContext::c, GNUNET_TESTBED_Peer::controller, OperationContext::data, GNUNET_new, GNUNET_TESTBED_get_next_op_id(), GNUNET_TESTBED_operation_begin_wait_(), GNUNET_TESTBED_operation_create_(), GNUNET_TESTBED_operation_queue_insert_(), OperationContext::id, OperationContext::op, OP_PEER_DESTROY, GNUNET_TESTBED_Controller::opq_parallel_operations, oprelease_peer_destroy(), opstart_peer_destroy(), peer, and OperationContext::type.

Here is the call graph for this function:

◆ GNUNET_TESTBED_peer_manage_service()

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.

This should not be called to start/stop the peer's ARM service. Use GNUNET_TESTBED_peer_start(), GNUNET_TESTBED_peer_stop() for starting/stopping peer's ARM service. Success or failure of the generated operation is signalled through the controller event callback and/or operation completion callback.

Parameters
op_clsthe closure for the operation
peerthe peer whose service is to be started/stopped
service_namethe name of the service
cbthe operation completion callback
cb_clsthe closure for cb
start1 to start the service; 0 to stop the service
Returns
an operation handle; NULL upon error (peer not running)

Definition at line 921 of file testbed_api_peers.c.

928 {
929  struct ManageServiceData *data;
930  struct OperationContext *opc;
931  size_t msize;
932 
933  GNUNET_assert (TESTBED_PS_STARTED == peer->state); /* peer is not running? */
934  msize = strlen (service_name) + 1;
935  msize += sizeof(struct GNUNET_TESTBED_ManagePeerServiceMessage);
936  if (GNUNET_MAX_MESSAGE_SIZE < msize)
937  return NULL;
938  data = GNUNET_new (struct ManageServiceData);
939  data->cb = cb;
940  data->cb_cls = cb_cls;
941  data->peer = peer;
942  data->service_name = GNUNET_strdup (service_name);
943  data->start = start;
944  data->msize = (uint16_t) msize;
945  opc = GNUNET_new (struct OperationContext);
946  opc->data = data;
947  opc->c = peer->controller;
948  opc->id = GNUNET_TESTBED_get_next_op_id (opc->c);
949  opc->type = OP_MANAGE_SERVICE;
950  opc->op_cls = op_cls;
951  opc->op =
955  opc->op);
957  return opc->op;
958 }
static int start
Set if we are to start default services (including ARM).
Definition: gnunet-arm.c:39
static char * service_name
Option -s: service name (hash to get service descriptor)
Definition: gnunet-vpn.c:50
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message,...
Message to start/stop services of a peer.
Definition: testbed.h:706
@ OP_MANAGE_SERVICE
Start/stop service at a peer.
Definition: testbed_api.h:104
static void oprelease_manage_service(void *cls)
Callback which will be called when peer manage server operation is released.
static void opstart_manage_service(void *cls)
Function called when a peer manage service operation is ready.
@ TESTBED_PS_STARTED
The peer is running.

References OperationContext::c, GNUNET_TESTBED_Peer::controller, OperationContext::data, data, GNUNET_assert, GNUNET_MAX_MESSAGE_SIZE, GNUNET_new, GNUNET_strdup, GNUNET_TESTBED_get_next_op_id(), GNUNET_TESTBED_operation_begin_wait_(), GNUNET_TESTBED_operation_create_(), GNUNET_TESTBED_operation_queue_insert_(), OperationContext::id, OperationContext::op, OperationContext::op_cls, OP_MANAGE_SERVICE, GNUNET_TESTBED_Controller::opq_parallel_operations, oprelease_manage_service(), opstart_manage_service(), peer, service_name, start, GNUNET_TESTBED_Peer::state, TESTBED_PS_STARTED, and OperationContext::type.

Referenced by adjust_running_peers(), announce_next_regex(), manage_service_wrapper(), and test_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_shutdown_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.

Is equivalent of calling GNUNET_TESTBED_peer_stop() and GNUNET_TESTBED_peer_destroy() on all peers, except that the peer stop event and operation finished event corresponding to the respective functions are not generated. This function should be called when there are no other pending operations. If there are pending operations, it will return NULL

Parameters
cthe controller to send this message to
op_clsclosure for the operation
cbthe callback to call when all peers are stopped and destroyed
cb_clsthe closure for the callback
Returns
operation handle on success; NULL if any pending operations are present

Definition at line 2252 of file testbed_api.c.

2256 {
2257  struct OperationContext *opc;
2258  struct ShutdownPeersData *data;
2259 
2261  return NULL;
2262  data = GNUNET_new (struct ShutdownPeersData);
2263  data->cb = cb;
2264  data->cb_cls = cb_cls;
2265  opc = GNUNET_new (struct OperationContext);
2266  opc->c = c;
2267  opc->op_cls = op_cls;
2268  opc->data = data;
2269  opc->id = GNUNET_TESTBED_get_next_op_id (c);
2270  opc->type = OP_SHUTDOWN_PEERS;
2271  opc->state = OPC_STATE_INIT;
2276  opc->op);
2278  return opc->op;
2279 }
Date context for OP_SHUTDOWN_PEERS operations.
Definition: testbed_api.c:117
void * cb_cls
The closure for the above callback.
Definition: testbed_api.c:126
GNUNET_TESTBED_OperationCompletionCallback cb
The operation completion callback to call.
Definition: testbed_api.c:121
static void opstart_shutdown_peers(void *cls)
Function called when a shutdown peers operation is ready.
Definition: testbed_api.c:2195
static void oprelease_shutdown_peers(void *cls)
Callback which will be called when shutdown peers operation is released.
Definition: testbed_api.c:2215
@ OP_SHUTDOWN_PEERS
Stop and destroy all peers.
Definition: testbed_api.h:99

References OperationContext::c, ShutdownPeersData::cb, ShutdownPeersData::cb_cls, OperationContext::data, data, GNUNET_CONTAINER_multihashmap32_size(), GNUNET_new, GNUNET_TESTBED_get_next_op_id(), GNUNET_TESTBED_operation_begin_wait_(), GNUNET_TESTBED_operation_create_(), GNUNET_TESTBED_operation_queue_insert_(), OperationContext::id, OperationContext::op, OperationContext::op_cls, OP_SHUTDOWN_PEERS, GNUNET_TESTBED_Controller::opc_map, OPC_STATE_INIT, GNUNET_TESTBED_Controller::opq_parallel_operations, oprelease_shutdown_peers(), opstart_shutdown_peers(), OperationContext::state, and OperationContext::type.

Referenced by wait_op_completion().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_underlay_configure_link_va()

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.

Parameters
op_clsclosure argument to give with the operation event
p1first peer
p2second peer
cooption to change
apoption-specific values
Returns
handle to the operation, NULL if configuring the link at this time is not allowed

◆ GNUNET_TESTBED_underlay_configure_link()

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.

Parameters
op_clsclosure argument to give with the operation event
p1first peer
p2second peer
cooption to change
...option-specific values
Returns
handle to the operation, NULL if configuring the link at this time is not allowed

Definition at line 813 of file testbed_api_peers.c.

818 {
819  GNUNET_break (0);
820  return NULL;
821 }

References GNUNET_break.

◆ GNUNET_TESTBED_underlay_configure_topology_va()

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.

Parameters
op_clsclosure argument to give with the operation event
num_peersnumber of peers in peers
peersarray of num_peers with the peers to configure
topodesired underlay topology to use
aptopology-specific options
Returns
handle to the operation, NULL if configuring the topology is not allowed at this time

Definition at line 1242 of file testbed_api_topology.c.

1249 {
1250  GNUNET_break (0);
1251  return NULL;
1252 }

References GNUNET_break.

◆ GNUNET_TESTBED_underlay_configure_topology()

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.

Parameters
op_clsclosure argument to give with the operation event
num_peersnumber of peers in peers
peersarray of num_peers with the peers to configure
topodesired underlay topology to use
...topology-specific options
Returns
handle to the operation, NULL if configuring the topology is not allowed at this time

Definition at line 1256 of file testbed_api_topology.c.

1261 {
1262  GNUNET_break (0);
1263  return NULL;
1264 }

References GNUNET_break.

◆ GNUNET_TESTBED_overlay_connect()

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.

This function then obtains a HELLO from p1, gives it to p2 and asks p2 to connect to p1.

Parameters
op_clsclosure argument to give with the operation event
cbthe callback to call when this operation has finished
cb_clsthe closure for cb
p1first peer
p2second peer
Returns
handle to the operation, NULL if connecting these two peers is fundamentally not possible at this time (peers not running or underlay disallows)

Definition at line 825 of file testbed_api_peers.c.

829 {
830  struct OperationContext *opc;
831  struct OverlayConnectData *data;
832 
834  p2->state));
836  data->p1 = p1;
837  data->p2 = p2;
838  data->cb = cb;
839  data->cb_cls = cb_cls;
840  opc = GNUNET_new (struct OperationContext);
841  opc->data = data;
842  opc->c = p1->controller;
843  opc->id = GNUNET_TESTBED_get_next_op_id (opc->c);
844  opc->type = OP_OVERLAY_CONNECT;
845  opc->op_cls = op_cls;
846  opc->op =
851  return opc->op;
852 }
Data structure for OperationType OP_OVERLAY_CONNECT.
void * cb_cls
The closure for the above callback.
struct GNUNET_TESTBED_Peer * p2
Peer B.
GNUNET_TESTBED_OperationCompletionCallback cb
The operation completion callback to call once this operation is done.
struct GNUNET_TESTBED_Peer * p1
Peer A to connect to peer B.
@ OP_OVERLAY_CONNECT
Overlay connection operation.
Definition: testbed_api.h:79
void GNUNET_TESTBED_host_queue_oc_(struct GNUNET_TESTBED_Host *h, struct GNUNET_TESTBED_Operation *op)
Queues the given operation in the queue for parallel overlay connects of the given host.
static void opstart_overlay_connect(void *cls)
Function called when a overlay connect operation is ready.
static void oprelease_overlay_connect(void *cls)
Callback which will be called when overlay connect operation is released.

References OperationContext::c, OverlayConnectData::cb, OverlayConnectData::cb_cls, GNUNET_TESTBED_Peer::controller, OperationContext::data, data, GNUNET_assert, GNUNET_new, GNUNET_TESTBED_get_next_op_id(), GNUNET_TESTBED_host_queue_oc_(), GNUNET_TESTBED_operation_begin_wait_(), GNUNET_TESTBED_operation_create_(), GNUNET_TESTBED_Peer::host, OperationContext::id, OperationContext::op, OperationContext::op_cls, OP_OVERLAY_CONNECT, oprelease_overlay_connect(), opstart_overlay_connect(), OverlayConnectData::p1, OverlayConnectData::p2, GNUNET_TESTBED_Peer::state, TESTBED_PS_STARTED, and OperationContext::type.

Referenced by opstart_overlay_configure_topology(), and overlay_link_completed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_overlay_configure_topology_va()

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.

This function then connects the given peers in the P2P overlay using the given topology.

Parameters
op_clsclosure argument to give with the peer connect operation events generated through this function
num_peersnumber of peers in 'peers'
peersarray of 'num_peers' with the peers to configure
max_connectionsthe maximums number of overlay connections that will be made to achieve the given topology
comp_cbthe completion callback to call when the topology generation is completed
comp_cb_clsclosure for the comp_cb
topodesired underlay topology to use
vatopology-specific options
Returns
handle to the operation, NULL if connecting these peers is fundamentally not possible at this time (peers not running or underlay disallows) or if num_peers is less than 2

Definition at line 1268 of file testbed_api_topology.c.

1278 {
1279  struct TopologyContext *tc;
1280  struct TopologyContextOverlay *overlay;
1281  struct GNUNET_TESTBED_Operation *op;
1282  struct GNUNET_TESTBED_Controller *c;
1283  enum GNUNET_TESTBED_TopologyOption secondary_option;
1284 
1285  if (num_peers < 2)
1286  return NULL;
1287  c = peers[0]->controller;
1288  tc = GNUNET_new (struct TopologyContext);
1289  tc->type = TOPOLOGYCONTEXT_TYPE_OVERLAY;
1290  overlay = &tc->u.overlay;
1291  overlay->peers = peers;
1292  tc->num_peers = num_peers;
1293  overlay->op_cls = op_cls;
1294  overlay->retry_cnt = DEFAULT_RETRY_CNT;
1295  overlay->comp_cb = comp_cb;
1296  overlay->comp_cb_cls = comp_cb_cls;
1297  switch (topo)
1298  {
1300  gen_topo_line (tc);
1301  break;
1302 
1304  gen_topo_star (tc);
1305  break;
1306 
1308  gen_topo_ring (tc);
1309  break;
1310 
1312  gen_topo_random (tc, va_arg (va, unsigned int), GNUNET_NO);
1313  break;
1314 
1316  gen_topo_ring (tc);
1317  gen_topo_random (tc, va_arg (va, unsigned int), GNUNET_YES);
1318  break;
1319 
1321  gen_topo_clique (tc);
1322  break;
1323 
1325  gen_topo_2dtorus (tc);
1326  break;
1327 
1329  gen_topo_2dtorus (tc);
1330  gen_topo_random (tc, va_arg (va, unsigned int), GNUNET_YES);
1331 
1332  break;
1333 
1335  {
1336  uint16_t cap;
1337  uint8_t m;
1338 
1339  cap = (uint16_t) va_arg (va, unsigned int);
1340  m = (uint8_t) va_arg (va, unsigned int);
1341  gen_topo_scale_free (tc, cap, m);
1342  }
1343  break;
1344 
1346  {
1347  const char *filename;
1348 
1349  filename = va_arg (va, const char *);
1350 
1351  GNUNET_assert (NULL != filename);
1353  }
1354  break;
1355 
1356  default:
1357  GNUNET_break (0);
1358  GNUNET_free (tc);
1359  return NULL;
1360  }
1361  do
1362  {
1363  secondary_option = GNUNET_VA_ARG_ENUM (va, GNUNET_TESTBED_TopologyOption);
1364 
1365  switch (secondary_option)
1366  {
1368  overlay->retry_cnt = va_arg (va, unsigned int);
1369  break;
1370 
1372  break;
1373 
1374  default:
1375  GNUNET_break (0); /* Should not use any other option apart from
1376  * the ones handled here */
1377  GNUNET_free (overlay->link_array);
1378  GNUNET_free (tc);
1379  return NULL;
1380  }
1381  }
1382  while (GNUNET_TESTBED_TOPOLOGY_OPTION_END != secondary_option);
1390  "Generated topology with %u connections\n",
1391  tc->link_array_size);
1392  if (NULL != max_connections)
1393  *max_connections = tc->link_array_size;
1394  return op;
1395 }
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
Definition: gnunet-arm.c:104
static struct CadetPeer * peers
Operation to get peer ids.
static unsigned int num_peers
static unsigned long long max_connections
If there are at least this many connections, old ones will be removed.
#define GNUNET_VA_ARG_ENUM(va, X)
wrap va_arg for enums
GNUNET_TESTBED_TopologyOption
Topologies and topology options supported for testbeds.
static struct GNUNET_SCHEDULER_TaskContext tc
Task context of the current task.
Definition: scheduler.c:431
Opaque handle to an abstract operation to be executed by the testing framework.
Context information for overlay topologies.
struct GNUNET_TESTBED_Peer ** peers
The array of peers.
unsigned int retry_cnt
How many retries to do before we give up.
void * comp_cb_cls
The closure for the above callback.
struct OverlayLink * link_array
An array of links; this array is of size link_array_size.
void * op_cls
The operation closure.
GNUNET_TESTBED_TopologyCompletionCallback comp_cb
topology generation completion callback
Context information for topology operations.
#define DEFAULT_RETRY_CNT
Default number of retires.
static void gen_topo_scale_free(struct TopologyContext *tc, uint16_t cap, uint8_t m)
Generates scale free network.
static void gen_topo_line(struct TopologyContext *tc)
Generates line topology.
static void gen_topo_star(struct TopologyContext *tc)
Generates star topology.
static void gen_topo_from_file(struct TopologyContext *tc, const char *filename)
Generates topology from the given file.
static void opstart_overlay_configure_topology(void *cls)
Function called when a overlay connect operation is ready.
static void gen_topo_clique(struct TopologyContext *tc)
Generates clique topology.
static void gen_topo_random(struct TopologyContext *tc, unsigned int links, int append)
Generates ring topology.
static void oprelease_overlay_configure_topology(void *cls)
Callback which will be called when overlay connect operation is released.
#define LOG(kind,...)
Generic loggins shorthand.
static void gen_topo_2dtorus(struct TopologyContext *tc)
Generates ring topology.
static void gen_topo_ring(struct TopologyContext *tc)
Generates ring topology.

References TopologyContextOverlay::comp_cb, TopologyContextOverlay::comp_cb_cls, DEFAULT_RETRY_CNT, filename, gen_topo_2dtorus(), gen_topo_clique(), gen_topo_from_file(), gen_topo_line(), gen_topo_random(), gen_topo_ring(), gen_topo_scale_free(), gen_topo_star(), GNUNET_assert, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_new, GNUNET_NO, GNUNET_TESTBED_operation_begin_wait_(), GNUNET_TESTBED_operation_create_(), GNUNET_TESTBED_operation_queue_insert_(), GNUNET_TESTBED_TOPOLOGY_2D_TORUS, GNUNET_TESTBED_TOPOLOGY_CLIQUE, GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, GNUNET_TESTBED_TOPOLOGY_FROM_FILE, GNUNET_TESTBED_TOPOLOGY_LINE, GNUNET_TESTBED_TOPOLOGY_OPTION_END, GNUNET_TESTBED_TOPOLOGY_RETRY_CNT, GNUNET_TESTBED_TOPOLOGY_RING, GNUNET_TESTBED_TOPOLOGY_SCALE_FREE, GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD, GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING, GNUNET_TESTBED_TOPOLOGY_STAR, GNUNET_VA_ARG_ENUM, GNUNET_YES, TopologyContextOverlay::link_array, LOG, m, max_connections, num_peers, op, TopologyContextOverlay::op_cls, GNUNET_TESTBED_Controller::opq_parallel_topology_config_operations, oprelease_overlay_configure_topology(), opstart_overlay_configure_topology(), peers, TopologyContextOverlay::peers, TopologyContextOverlay::retry_cnt, and tc.

Referenced by GNUNET_TESTBED_overlay_configure_topology().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_overlay_configure_topology()

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.

This function then connects the given peers in the P2P overlay using the given topology.

Parameters
op_clsclosure argument to give with the peer connect operation events generated through this function
num_peersnumber of peers in 'peers'
peersarray of 'num_peers' with the peers to configure
max_connectionsthe maximums number of overlay connections that will be made to achieve the given topology
comp_cbthe completion callback to call when the topology generation is completed
comp_cb_clsclosure for the above completion callback
topodesired underlay topology to use
...topology-specific options
Returns
handle to the operation, NULL if connecting these peers is fundamentally not possible at this time (peers not running or underlay disallows) or if num_peers is less than 2

Definition at line 1419 of file testbed_api_topology.c.

1429 {
1430  struct GNUNET_TESTBED_Operation *op;
1431  va_list vargs;
1432 
1434  va_start (vargs, topo);
1437  comp_cb, comp_cb_cls,
1438  topo,
1439  vargs);
1440  va_end (vargs);
1441  return op;
1442 }
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.

References GNUNET_assert, GNUNET_TESTBED_overlay_configure_topology_va(), GNUNET_TESTBED_TOPOLOGY_OPTION_END, max_connections, num_peers, op, and peers.

Referenced by event_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_overlay_write_topology_to_file()

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.

Naturally, the file will only contain a snapshot as the topology may evolve all the time. FIXME: needs continuation!?

Parameters
controlleroverlay controller to inspect
filenamename of the file the topology should be written to.

Definition at line 1935 of file testbed_api.c.

1938 {
1939  GNUNET_break (0);
1940 }

References GNUNET_break.

◆ GNUNET_TESTBED_service_connect()

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.

Will ensure that the request is queued to not overwhelm our ability to create and maintain connections with other systems. The actual service handle is then returned via the 'op_result' member in the event callback. The ca callback is used to create the connection when the time is right; the da callback will be used to destroy the connection (upon GNUNET_TESTBED_operation_done). GNUNET_TESTBED_operation_done can be used to abort this operation until the event callback has been called.

Parameters
op_clsclosure to pass in operation event // FIXME: didn't we say we'd no longer use the global callback for these? -CG
peerpeer that runs the service
service_namename of the service to connect to
cbthe callback to call when this operation is ready (that is, right after the connect adapter returns)
cb_clsclosure for cb
cahelper function to establish the connection
dahelper function to close the connection
cada_clsclosure for ca and da
Returns
handle for the operation

Will ensure that the request is queued to not overwhelm our ability to create and maintain connections with other systems. The actual service handle is then returned via the 'op_result' member in the event callback. The 'ca' callback is used to create the connection when the time is right; the 'da' callback will be used to destroy the connection (upon 'GNUNET_TESTBED_operation_done'). 'GNUNET_TESTBED_operation_done' can be used to abort this operation until the event callback has been called.

Parameters
op_clsclosure to pass in operation event
peerpeer that runs the service
service_namename of the service to connect to
cbthe callback to call when this operation finishes
cb_clsclosure for the above callback
cahelper function to establish the connection
dahelper function to close the connection
cada_clsclosure for ca and da
Returns
handle for the operation

Definition at line 257 of file testbed_api_services.c.

264 {
265  struct ServiceConnectData *data;
266 
268  data->ca = ca;
269  data->da = da;
270  data->cada_cls = cada_cls;
271  data->op_cls = op_cls;
272  data->peer = peer;
273  data->state = INIT;
274  data->cb = cb;
275  data->cb_cls = cb_cls;
276  data->operation =
280  controller->
281  opq_parallel_service_connections,
282  data->operation);
284  controller->opq_parallel_operations,
285  data->operation);
287  return data->operation;
288 }
Data accessed during service connections.
GNUNET_TESTBED_ConnectAdapter ca
helper function callback to establish the connection
GNUNET_TESTBED_ServiceConnectCompletionCallback cb
The operation completion callback.
GNUNET_TESTBED_DisconnectAdapter da
helper function callback to close the connection
void * op_cls
Closure for operation event.
void * cb_cls
The closure for operation completion callback.
void * cada_cls
Closure to the above callbacks.
@ INIT
Initial state.
static void opstart_service_connect(void *cls)
Function called when a service connect operation is ready.
static void oprelease_service_connect(void *cls)
Callback which will be called when service connect type operation is released.

References ServiceConnectData::ca, ServiceConnectData::cada_cls, ServiceConnectData::cb, ServiceConnectData::cb_cls, ServiceConnectData::da, data, GNUNET_new, GNUNET_TESTBED_operation_begin_wait_(), GNUNET_TESTBED_operation_create_(), GNUNET_TESTBED_operation_queue_insert_(), INIT, ServiceConnectData::op_cls, oprelease_service_connect(), opstart_service_connect(), and peer.

Referenced by cadet_test_run(), connect_nse_service(), dht_test_run(), do_collect_stats(), find_string(), GNUNET_FS_TEST_download(), GNUNET_FS_TEST_publish(), opstart_get_stats(), peer_info_cb(), session_disconnect_adapter(), start_profiling(), stats_cb(), test_master(), and test_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_operation_done()

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.

if the event callback is ever called for this operation. If the event callback for this operation has not yet been called, calling this function cancels the operation, frees its resources and ensures the no event is generated with respect to this operation. Note that however cancelling an operation does NOT guarantee that the operation will be fully undone (or that nothing ever happened).

This function MUST be called for every operation to fully remove the operation from the operation queue. After calling this function, if operation is completed and its event information is of type GNUNET_TESTBED_ET_OPERATION_FINISHED, the 'op_result' becomes invalid (!).

If the operation is generated from GNUNET_TESTBED_service_connect() then calling this function on such as operation calls the disconnect adapter if the connect adapter was ever called.

Parameters
operationoperation to signal completion or cancellation

Definition at line 2021 of file testbed_api.c.

2022 {
2023  (void) exop_check (operation);
2025 }
static int exop_check(const struct GNUNET_TESTBED_Operation *const op)
Checks if an operation is present in the list of operations marked for expiry.
Definition: testbed_api.c:191
void GNUNET_TESTBED_operation_release_(struct GNUNET_TESTBED_Operation *op)
An operation is 'done' (was cancelled or finished); remove it from the queues and release associated ...

References exop_check(), and GNUNET_TESTBED_operation_release_().

Referenced by cancel_get(), churn_cb(), clean_peer(), close_monitor_connections(), daemon_started(), decrypt_cb(), delayed_put(), destroy(), destroy_pooled_connection(), dht_connected(), disconnect_cadet_peers(), do_shutdown(), download_timeout(), event_cb(), get_iter(), GNUNET_CADET_TEST_cleanup(), GNUNET_DHT_TEST_cleanup(), GST_free_lcf(), GST_link_notify_disconnect(), handle_shutdown(), info_cb(), lcf_proc_task(), manage_service_cb(), op_done_task(), oprelease_get_stats(), oprelease_overlay_configure_topology(), overlay_link_completed(), peer_create_cb(), peer_id_cb(), peer_info_cb(), post_test_op(), post_test_shutdown_ready_cb(), publish_fs_connect_complete_cb(), publish_timeout(), rc_cleanup_operations(), rcop_cleanup_iterator(), regex_found_handler(), report_success(), report_uri(), search_timed_out(), secret_ready_cb(), service_started(), shutdown_cb(), shutdown_op(), shutdown_task(), slave_event_cb(), statistics_done_cb(), stats_cb(), stats_cont(), and topology_completion_callback().

Here is the call graph for this function:

◆ GNUNET_TESTBED_get_statistics()

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.

Parameters
num_peersnumber of peers to iterate over
peersarray of peers to iterate over
subsystemlimit to the specified subsystem, NULL for all subsystems
namename of the statistic value, NULL for all values
procprocessing function for each statistic retrieved
contcontinuation to call once call is completed. The completion of this operation is ONLY signalled through this callback – no GNUNET_TESTBED_ET_OPERATION_FINISHED is generated
clsclosure to pass to proc and cont
Returns
operation handle to cancel the operation
Parameters
num_peersnumber of peers to iterate over
peersarray of peers to iterate over
subsystemlimit to the specified subsystem, NULL for all subsystems
namename of the statistic value, NULL for all values
procprocessing function for each statistic retrieved
contcontinuation to call once call is completed(?)
clsclosure to pass to proc and cont
Returns
operation handle to cancel the operation

Definition at line 404 of file testbed_api_statistics.c.

410 {
411  struct GetStatsContext *sc;
412 
413  GNUNET_assert (NULL != proc);
414  GNUNET_assert (NULL != cont);
415  if (NULL == no_wait_queue)
417  (OPERATION_QUEUE_TYPE_FIXED, UINT_MAX);
418  sc = GNUNET_new (struct GetStatsContext);
419  sc->peers = peers;
420  sc->subsystem = (NULL == subsystem) ? NULL : GNUNET_strdup (subsystem);
421  sc->name = (NULL == name) ? NULL : GNUNET_strdup (name);
422  sc->proc = proc;
423  sc->cont = cont;
424  sc->cb_cls = cls;
425  sc->num_peers = num_peers;
426  sc->main_op =
431  return sc->main_op;
432 }
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:87
static char * subsystem
Set to subsystem that we're going to get stats for (or NULL for all).
const char * name
Context information for use in GNUNET_TESTBED_get_statistics()
GNUNET_TESTBED_OperationCompletionCallback cont
The callback to call when we are done iterating through all peers' statistics services.
GNUNET_TESTBED_StatisticsIterator proc
The iterator to call with statistics information.
static void oprelease_get_stats(void *cls)
Function called when get_statistics operation is cancelled or marked as done.
static struct OperationQueue * no_wait_queue
A no-wait operation queue.
static void opstart_get_stats(void *cls)
Function called when get_statistics operation is ready.

References GetStatsContext::cont, GNUNET_assert, GNUNET_new, GNUNET_strdup, GNUNET_TESTBED_operation_begin_wait_(), GNUNET_TESTBED_operation_create_(), GNUNET_TESTBED_operation_queue_create_(), GNUNET_TESTBED_operation_queue_insert_(), name, no_wait_queue, num_peers, OPERATION_QUEUE_TYPE_FIXED, oprelease_get_stats(), opstart_get_stats(), peers, GetStatsContext::proc, sc, and subsystem.

Referenced by collect_stats(), destroy(), summarize(), and terminate_task().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_get_index()

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.

the peer's "unique ID".

Parameters
peerPeer handle.
Returns
The peer's unique ID.

Definition at line 2291 of file testbed_api.c.

2292 {
2293  return peer->unique_id;
2294 }

References peer, and GNUNET_TESTBED_Peer::unique_id.

Referenced by statistics_cb(), and stats_iterator().

Here is the caller graph for this function:

◆ GNUNET_TESTBED_run()

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.

Underlay and overlay topology are configured using the "UNDERLAY" and "OVERLAY" options in the "[testbed]" section of the configuration\ (with possible options given in "UNDERLAY_XXX" and/or "OVERLAY_XXX").

The test_master callback will be called once the testbed setup is finished or upon a timeout. This timeout is given through the configuration file by setting the option "SETUP_TIMEOUT" in "[TESTBED]" section.

The testbed is to be terminated using a call to "GNUNET_SCHEDULER_shutdown".

Parameters
host_filenamename of the file with the 'hosts', NULL to run everything on 'localhost'
cfgconfiguration to use (for testbed, controller and peers)
num_peersnumber of peers to start; FIXME: maybe put that ALSO into cfg?; should be greater than 0
event_maskbit mask with set of events to call 'cc' for; or-ed values of "1LL" shifted by the respective 'enum GNUNET_TESTBED_EventType' (e.g. "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...")
cccontroller callback to invoke on events; This callback is called for all peer start events even if GNUNET_TESTBED_ET_PEER_START isn't set in the event_mask as this is the only way get access to the handle of each peer
cc_clsclosure for cc
test_masterthis callback will be called once the test is ready or upon timeout
test_master_clsclosure for 'test_master'.

Underlay and overlay topology are configured using the "UNDERLAY" and "OVERLAY" options in the "[testbed]" section of the configuration\ (with possible options given in "UNDERLAY_XXX" and/or "OVERLAY_XXX").

The testbed is to be terminated using a call to "GNUNET_SCHEDULER_shutdown".

Parameters
host_filenamename of the file with the 'hosts', NULL to run everything on 'localhost'
cfgconfiguration to use (for testbed, controller and peers)
num_peersnumber of peers to start; FIXME: maybe put that ALSO into cfg?
event_maskbit mask with set of events to call 'cc' for; or-ed values of "1LL" shifted by the respective 'enum GNUNET_TESTBED_EventType' (e.g. "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...")
cccontroller callback to invoke on events; This callback is called for all peer start events even if GNUNET_TESTBED_ET_PEER_START isn't set in the event_mask as this is the only way get access to the handle of each peer
cc_clsclosure for cc
test_masterthis callback will be called once the test is ready
test_master_clsclosure for 'test_master'.

Definition at line 1245 of file testbed_api_testbed.c.

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 }
enum GNUNET_TESTBED_TopologyOption topology
The topology to generate.
static struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).
Definition: gnunet-abd.c:61
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 char * host_filename
Data file with the hosts for the testbed.
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_CONTAINER_MultiHashMap32 * GNUNET_CONTAINER_multihashmap32_create(unsigned int len)
Create a 32-bit key multi hash map.
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.
@ GNUNET_ERROR_TYPE_ERROR
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
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.
void GNUNET_TESTBED_is_host_habitable_cancel(struct GNUNET_TESTBED_HostHabitableCheckHandle *handle)
Function to cancel a request started using GNUNET_TESTBED_is_host_habitable()
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_host_destroy(struct GNUNET_TESTBED_Host *host)
Destroy a host handle.
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.
#define GNUNET_TIME_UNIT_SECONDS
One second.
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
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.
GNUNET_TESTBED_ControllerCallback cc
The callback to use as controller callback.
void * test_master_cls
The closure for the TestMaster callback.
unsigned int num_hosts
Number of hosts in the given host file.
struct GNUNET_SCHEDULER_Task * interrupt_task
Task run upon shutdown interrupts.
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_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.
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.
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.
struct GNUNET_TESTBED_Host * h
Handle to the host on which the controller runs.
char * topo_file
The file containing topology data.
Time for relative time used by GNUnet, in microseconds.
#define DEFAULT_SETUP_TIMEOUT
The default setup timeout in seconds.
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 timeout_task(void *cls)
Task run upon timeout while setting up the testbed.
@ RC_INIT
Initial state.
#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...
#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 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...
int GNUNET_TESTBED_topology_get_(enum GNUNET_TESTBED_TopologyOption *topology, const char *topology_string)
Get a topology from a string input.

References _, GNUNET_TESTBED_RunHandle::cc, GNUNET_TESTBED_RunHandle::cc_cls, cfg, GNUNET_TESTBED_RunHandle::cfg, controller_status_cb(), GNUNET_TESTBED_RunHandle::cproc, DEFAULT_SETUP_TIMEOUT, event_mask, GNUNET_TESTBED_RunHandle::event_mask, GNUNET_assert, GNUNET_break, GNUNET_CONFIGURATION_destroy(), GNUNET_CONFIGURATION_dup(), GNUNET_CONFIGURATION_get_value_filename(), GNUNET_CONFIGURATION_get_value_number(), GNUNET_CONFIGURATION_get_value_string(), GNUNET_CONFIGURATION_get_value_time(), GNUNET_CONFIGURATION_have_value(), GNUNET_CONTAINER_multihashmap32_create(), GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log_config_invalid(), GNUNET_log_config_missing(), GNUNET_malloc, GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_TESTBED_controller_start(), GNUNET_TESTBED_host_create(), GNUNET_TESTBED_host_destroy(), GNUNET_TESTBED_hosts_load_from_file(), GNUNET_TESTBED_is_host_habitable(), GNUNET_TESTBED_is_host_habitable_cancel(), GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, GNUNET_TESTBED_TOPOLOGY_FROM_FILE, GNUNET_TESTBED_topology_get_(), GNUNET_TESTBED_TOPOLOGY_NONE, GNUNET_TESTBED_TOPOLOGY_OPTION_END, GNUNET_TESTBED_TOPOLOGY_SCALE_FREE, GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD, GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING, GNUNET_TIME_relative_multiply(), GNUNET_TIME_UNIT_SECONDS, GNUNET_YES, CompatibilityCheckContext::h, GNUNET_TESTBED_RunHandle::h, GNUNET_TESTBED_RunHandle::hclist, host_filename, host_habitable_cb(), GNUNET_TESTBED_RunHandle::hosts, CompatibilityCheckContext::index, consensus-simulation::int, interrupt(), GNUNET_TESTBED_RunHandle::interrupt_task, LOG, GNUNET_TESTBED_RunHandle::num_hosts, num_peers, GNUNET_TESTBED_RunHandle::num_peers, number, GNUNET_TESTBED_RunHandle::random_links, CompatibilityCheckContext::rc, RC_INIT, GNUNET_TESTBED_RunHandle::rcop_map, SCALE_FREE_CAP, SCALE_FREE_M, GNUNET_TESTBED_RunHandle::state, test_master(), GNUNET_TESTBED_RunHandle::test_master, GNUNET_TESTBED_RunHandle::test_master_cls, TESTBED_CONFIG_SECTION, timeout, GNUNET_TESTBED_RunHandle::timeout_task, timeout_task(), GNUNET_TESTBED_RunHandle::topo_file, topology, and GNUNET_TESTBED_RunHandle::topology.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_test_run()

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'.

Underlay and overlay topology are configured using the "UNDERLAY" and "OVERLAY" options in the "[TESTBED]" section of the configuration (with possible options given in "UNDERLAY_XXX" and/or "OVERLAY_XXX").

The test_master callback will be called once the testbed setup is finished or upon a timeout. This timeout is given through the configuration file by setting the option "SETUP_TIMEOUT" in "[TESTBED]" section.

The test is to be terminated using a call to "GNUNET_SCHEDULER_shutdown". If starting the test fails, the program is stopped without 'master' ever being run.

NOTE: this function should be called from 'main', NOT from within a GNUNET_SCHEDULER-loop. This function will initialize the scheduler loop, the testbed and then pass control to 'master'.

Parameters
testnamename of the testcase (to configure logging, etc.)
cfg_filenameconfiguration filename to use (for testbed, controller and peers)
num_peersnumber of peers to start; should be greter than 0
event_maskbit mask with set of events to call 'cc' for; or-ed values of "1LL" shifted by the respective 'enum GNUNET_TESTBED_EventType' (e.g. "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...")
cccontroller callback to invoke on events; This callback is called for all peer start events even if GNUNET_TESTBED_ET_PEER_START isn't set in the event_mask as this is the only way get access to the handle of each peer
cc_clsclosure for cc
test_masterthis callback will be called once the test is ready or upon timeout
test_master_clsclosure for test_master.
Returns
GNUNET_SYSERR on error, GNUNET_OK on success

Underlay and overlay topology are configured using the "UNDERLAY" and "OVERLAY" options in the "[testbed]" section of the configuration (with possible options given in "UNDERLAY_XXX" and/or "OVERLAY_XXX").

The test is to be terminated using a call to "GNUNET_SCHEDULER_shutdown". If starting the test fails, the program is stopped without 'master' ever being run.

NOTE: this function should be called from 'main', NOT from within a GNUNET_SCHEDULER-loop. This function will initialize the scheduler loop, the testbed and then pass control to 'master'.

Parameters
testnamename of the testcase (to configure logging, etc.)
cfg_filenameconfiguration filename to use (for testbed, controller and peers)
num_peersnumber of peers to start
event_maskbit mask with set of events to call 'cc' for; or-ed values of "1LL" shifted by the respective 'enum GNUNET_TESTBED_EventType' (e.g. "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...")
cccontroller callback to invoke on events; This callback is called for all peer start events even if GNUNET_TESTBED_ET_PEER_START isn't set in the event_mask as this is the only way get access to the handle of each peer
cc_clsclosure for cc
test_mastertask to run once the test is ready
test_master_clsclosure for test_master
Returns
GNUNET_SYSERR on error, GNUNET_OK on success

Definition at line 123 of file testbed_api_test.c.

131 {
132  char *argv2[] = {
133  NULL,
134  "-c",
135  NULL,
136  NULL
137  };
140  };
141  struct TestRunContext *rc;
142  int ret;
143 
144  argv2[0] = GNUNET_strdup (testname);
145  argv2[2] = GNUNET_strdup (cfg_filename);
146  GNUNET_assert (NULL != test_master);
147  GNUNET_assert (num_peers > 0);
148 
149  char* envcfg = getenv(ENV_TESTBED_CONFIG);
150  setenv(ENV_TESTBED_CONFIG, cfg_filename, 1);
151 
152  rc = GNUNET_malloc (sizeof(struct TestRunContext)
153  + (num_peers * sizeof(struct GNUNET_TESTBED_Peer *)));
154  rc->test_master = test_master;
156  rc->num_peers = num_peers;
157  rc->event_mask = event_mask;
158  rc->cc = cc;
159  rc->cc_cls = cc_cls;
160  ret = GNUNET_PROGRAM_run ((sizeof(argv2) / sizeof(char *)) - 1, argv2,
161  testname, "nohelp", options, &run, rc);
162 
163  if (envcfg)
164  setenv(ENV_TESTBED_CONFIG, envcfg, 1);
165  else
166  unsetenv(ENV_TESTBED_CONFIG);
167 
168  GNUNET_free (rc);
169  GNUNET_free (argv2[0]);
170  GNUNET_free (argv2[2]);
171  return ret;
172 }
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
Definition: 002.c:13
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
char * getenv()
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
static char * cfg_filename
Name of the configuration file.
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
Definition of a command line option.
Context information for test run.
GNUNET_TESTBED_ControllerCallback cc
The controller event callback.
unsigned int num_peers
Number of peers to start.
void * test_master_cls
Closure for test master.
void * cc_cls
Closure for the above callback.
uint64_t event_mask
event mask for the controller callback
GNUNET_TESTBED_TestMaster test_master
Test master callback.
#define ENV_TESTBED_CONFIG
The environmental variable which when available refers to the configuration file the local testbed co...
Definition: testbed.h:776
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *config)
Main run function.

References TestRunContext::cc, TestRunContext::cc_cls, cfg_filename, ENV_TESTBED_CONFIG, event_mask, TestRunContext::event_mask, getenv(), GNUNET_assert, GNUNET_free, GNUNET_GETOPT_OPTION_END, GNUNET_malloc, GNUNET_PROGRAM_run(), GNUNET_strdup, num_peers, TestRunContext::num_peers, options, ret, run(), test_master(), TestRunContext::test_master, and TestRunContext::test_master_cls.

Referenced by GNUNET_CADET_TEST_ruN(), GNUNET_DHT_TEST_run(), GNUNET_run_messenger_setup(), main(), and run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_run_get_controller_handle()

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.

The handle returned should not be disconnected.

Parameters
hthe testbed run handle
Returns
handle to the master controller

Definition at line 1461 of file testbed_api_testbed.c.

1462 {
1463  return h->c;
1464 }

References h.

◆ GNUNET_TESTBED_barrier_init()

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 the barrier.

Parameters
controllerthe handle to the controller
nameidentification name of the barrier
quorumthe percentage of peers that is required to reach the barrier. Peers signal reaching a barrier by calling GNUNET_TESTBED_barrier_reached().
cbthe callback to call when the barrier is reached or upon error. Cannot be NULL.
cb_clsclosure for cb
Returns
barrier handle

Initialise a barrier and call the given callback when the required percentage of peers (quorum) reach the barrier.

Parameters
controllerthe handle to the controller
nameidentification name of the barrier
quorumthe percentage of peers that is required to reach the barrier. Peers signal reaching a barrier by calling GNUNET_TESTBED_barrier_reached().
cbthe callback to call when the barrier is reached or upon error. Cannot be NULL.
cb_clsclosure for the above callback
Returns
barrier handle; NULL upon error

Definition at line 2391 of file testbed_api.c.

2396 {
2397  return GNUNET_TESTBED_barrier_init_ (controller,
2398  name,
2399  quorum,
2400  cb,
2401  cb_cls,
2402  GNUNET_YES);
2403 }
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 *cls, int echo)
Initialise a barrier and call the given callback when the required percentage of peers (quorum) reach...
Definition: testbed_api.c:2324

References GNUNET_TESTBED_Barrier::cb, GNUNET_TESTBED_barrier_init_(), GNUNET_YES, and name.

Here is the call graph for this function:

◆ GNUNET_TESTBED_barrier_cancel()

void GNUNET_TESTBED_barrier_cancel ( struct GNUNET_TESTBED_Barrier barrier)

Cancel a barrier.

Parameters
barrierthe barrier handle

Definition at line 2412 of file testbed_api.c.

2413 {
2414  struct GNUNET_MQ_Envelope *env;
2416  size_t slen;
2417 
2418  slen = strlen (barrier->name);
2419  env =
2421  GNUNET_memcpy (msg->name, barrier->name, slen);
2422  GNUNET_MQ_send (barrier->c->mq, env);
2424 }
#define GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_CANCEL
Message to cancel a barrier.
Message to cancel a barrier.
Definition: testbed.h:805
struct GNUNET_TESTBED_Controller * c
The controller handle given while initialising this barrier.
Definition: testbed_api.h:287
char * name
The name of the barrier.
Definition: testbed_api.h:292
void GNUNET_TESTBED_barrier_remove_(struct GNUNET_TESTBED_Barrier *barrier)
Remove a barrier and it was the last one in the barrier hash map, destroy the hash map.
Definition: testbed_api.c:2304

References GNUNET_TESTBED_Barrier::c, env, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_CANCEL, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_TESTBED_barrier_remove_(), GNUNET_TESTBED_Controller::mq, msg, and GNUNET_TESTBED_Barrier::name.

Referenced by cancel_wrappers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_barrier_wait()

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.

This function should be called by the peers which have been started by the testbed. If the peer is not started by testbed this function may return error

Parameters
namethe name of the barrier
cbthe barrier wait callback
clsthe closure for the above callback
Returns
barrier wait handle which can be used to cancel the waiting at anytime before the callback is called. NULL upon error.

Definition at line 164 of file testbed_api_barriers.c.

167 {
174  h),
176  };
177  struct GNUNET_MQ_Envelope *env;
179  const char *cfg_filename;
180  size_t name_len;
181 
182  GNUNET_assert (NULL != cb);
184  if (NULL == cfg_filename)
185  {
187  "Are you running under testbed?\n");
188  GNUNET_free (h);
189  return NULL;
190  }
192  if (GNUNET_OK !=
194  cfg_filename))
195  {
197  "Unable to load configuration from file `%s'\n",
198  cfg_filename);
200  GNUNET_free (h);
201  return NULL;
202  }
204  "Waiting on barrier `%s'\n",
205  name);
206  h->name = GNUNET_strdup (name);
207  h->cb = cb;
208  h->cb_cls = cb_cls;
210  "testbed-barrier",
211  handlers,
213  h);
214  if (NULL == h->mq)
215  {
217  "Unable to connect to local testbed-barrier service\n");
219  return NULL;
220  }
221  name_len = strlen (name); /* NOTE: unusual to not have 0-termination, change? */
223  name_len,
225  GNUNET_memcpy (msg->name,
226  name,
227  name_len);
228  GNUNET_MQ_send (h->mq,
229  env);
230  return h;
231 }
uint16_t status
See PRISM_STATUS_*-constants.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create(void)
Create a new configuration object.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_load(struct GNUNET_CONFIGURATION_Handle *cfg, const char *filename)
Load configuration.
#define GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_WAIT
Message sent by a peer when it has reached a barrier and is waiting for it to be crossed.
void GNUNET_TESTBED_barrier_wait_cancel(struct GNUNET_TESTBED_BarrierWaitHandle *h)
Cancel a barrier wait handle.
struct GNUNET_MQ_Handle * mq
Our connection to the ARM service.
Definition: arm_api.c:107
const struct GNUNET_CONFIGURATION_Handle * cfg
The configuration that we are using.
Definition: arm_api.c:112
Message sent from peers to the testbed-barrier service to indicate that they have reached a barrier a...
Definition: testbed.h:851
#define LOG(type,...)
Logging shorthand.
static void mq_error_handler(void *cls, enum GNUNET_MQ_Error error)
Generic error handler, called with the appropriate error code and the same closure specified at the c...

References GNUNET_ARM_Handle::cfg, cfg_filename, env, ENV_TESTBED_CONFIG, getenv(), GNUNET_assert, GNUNET_CLIENT_connect(), GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_destroy(), GNUNET_CONFIGURATION_load(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS, GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_WAIT, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, GNUNET_OK, GNUNET_strdup, GNUNET_TESTBED_barrier_wait_cancel(), h, handlers, LOG, GNUNET_ARM_Handle::mq, mq_error_handler(), msg, name, and status.

Referenced by do_wait().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_barrier_wait_cancel()

void GNUNET_TESTBED_barrier_wait_cancel ( struct GNUNET_TESTBED_BarrierWaitHandle h)

Cancel a barrier wait handle.

Should not be called in or after the callback given to GNUNET_TESTBED_barrier_wait() has been called.

Parameters
hthe barrier wait handle
hthe barrier wait handle

Definition at line 240 of file testbed_api_barriers.c.

241 {
242  if (NULL != h->mq)
243  {
245  h->mq = NULL;
246  }
247  GNUNET_free (h->name);
249  GNUNET_free (h);
250 }

References GNUNET_ARM_Handle::cfg, GNUNET_CONFIGURATION_destroy(), GNUNET_free, GNUNET_MQ_destroy(), h, and GNUNET_ARM_Handle::mq.

Referenced by do_shutdown(), GNUNET_TESTBED_barrier_wait(), handle_status(), and mq_error_handler().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_underlaylinkmodel_create()

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.

A peer can have ONLY ONE model and it can be either a blacklist or whitelist based one.

Parameters
peerthe peer for which the model has to be created
typethe type of the model
Returns
the model

Definition at line 154 of file testbed_api_underlay.c.

158 {
160 
164  m->type = type;
165  return m;
166 }
uint8_t underlay_model_exists
Has an underlay model already set for this peer?
Model for configuring underlay links of a peer.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model

References GNUNET_assert, GNUNET_new, m, peer, type, and GNUNET_TESTBED_Peer::underlay_model_exists.

◆ GNUNET_TESTBED_underlaylinkmodel_add_peer()

void GNUNET_TESTBED_underlaylinkmodel_add_peer ( struct GNUNET_TESTBED_UnderlayLinkModel model,
struct GNUNET_TESTBED_Peer peer 
)

Add a peer to the given model.

Underlay connections to the given peer will be permitted if the model is whitelist based; otherwise they will not be permitted.

Parameters
modelthe model
peerthe peer to add

Definition at line 179 of file testbed_api_underlay.c.

183 {
184  struct ListEntry *entry;
185 
186  entry = GNUNET_new (struct ListEntry);
187  entry->peer = peer;
188  entry->next = model->entries;
189  model->entries = entry;
190 }
struct ListEntry * entries
List of peers in the list.
Container for holding a peer in whitelist/blacklist.
struct GNUNET_TESTBED_Peer * peer
the peer
struct ListEntry * next
the next pointer

References GNUNET_TESTBED_UnderlayLinkModel::entries, GNUNET_new, ListEntry::next, ListEntry::peer, and peer.

◆ GNUNET_TESTBED_underlaylinkmodel_set_link()

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.

The link SHOULD be permittable according to the given model.

Parameters
modelthe model
peerthe other end peer of the link
latencylatency of the link in microseconds
lossdata loss of the link expressed as a percentage
bandwidthbandwidth of the link in kilobytes per second [kB/s]

Definition at line 205 of file testbed_api_underlay.c.

212 {
213  struct LinkProperty *prop;
214 
215  prop = GNUNET_new (struct LinkProperty);
216  prop->peer = peer;
217  prop->latency = latency;
218  prop->loss = loss;
219  prop->bandwidth = bandwidth;
220  prop->next = model->props;
221  model->props = prop;
222 }
struct LinkProperty * props
list of link properties
An underlay link.
uint32_t bandwidth
bandwidth of the link in kilobytes per second
struct LinkProperty * next
next pointer for list
uint32_t latency
latency of the link in microseconds
uint32_t loss
data loss on the link expressed as percentage
struct GNUNET_TESTBED_Peer * peer
the peer whose link is defined by these properties

References LinkProperty::bandwidth, GNUNET_new, LinkProperty::latency, LinkProperty::loss, LinkProperty::next, LinkProperty::peer, peer, and GNUNET_TESTBED_UnderlayLinkModel::props.

◆ GNUNET_TESTBED_underlaylinkmodel_commit()

void GNUNET_TESTBED_underlaylinkmodel_commit ( struct GNUNET_TESTBED_UnderlayLinkModel model)

Commit the model.

The model is freed in this function(!).

Parameters
modelthe model to commit

Definition at line 251 of file testbed_api_underlay.c.

253 {
254  /* FIXME: Marshal the model into a message */
255  GNUNET_break (0);
256  /* do not reset the value of model->peer->underlay_model_exists */
257  free_entries (model);
258  free_link_properties (model);
259  GNUNET_free (model);
260 }
struct GNUNET_TESTBED_UnderlayLinkModel free_entries(struct GNUNET_TESTBED_UnderlayLinkModel *model)
Function to free resources of list entries.
static void free_link_properties(struct GNUNET_TESTBED_UnderlayLinkModel *model)
Function to free resources of link properties added to the given model.

References free_entries(), free_link_properties(), GNUNET_break, and GNUNET_free.

Here is the call graph for this function:

◆ GNUNET_TESTBED_underlaylinkmodel_free()

void GNUNET_TESTBED_underlaylinkmodel_free ( struct GNUNET_TESTBED_UnderlayLinkModel model)

Free the resources of the model.

Use this function only if the model has not be committed and has to be unallocated. The peer can then have another model created.

Parameters
modelthe model to unallocate

Definition at line 234 of file testbed_api_underlay.c.

236 {
237  model->peer->underlay_model_exists = 0;
238  free_entries (model);
239  free_link_properties (model);
240  gnunet_free (model);
241 }
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.

References free_entries(), free_link_properties(), GNUNET_TESTBED_UnderlayLinkModel::peer, and GNUNET_TESTBED_Peer::underlay_model_exists.

Here is the call graph for this function: