Writing tests and creating large-scale emulation testbeds for GNUnet. More...
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... | |
Writing tests and creating large-scale emulation testbeds for GNUnet.
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
cls | the closure given to GNUNET_TESTBED_is_host_habitable() |
host | the host whose status is being reported; will be NULL if the host given to GNUNET_TESTBED_is_host_habitable() is NULL |
status | GNUNET_YES if it is habitable; GNUNET_NO if not |
Definition at line 171 of file gnunet_testbed_service.h.
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.
cls | closure |
event | information about the event |
Definition at line 393 of file gnunet_testbed_service.h.
typedef void(* GNUNET_TESTBED_ControllerStatusCallback) (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, int status) |
Callback to signal successful startup of the controller process.
cls | the closure from GNUNET_TESTBED_controller_start() |
cfg | the configuration with which the controller has been started; NULL if status is not GNUNET_OK |
status | GNUNET_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.
typedef void(* GNUNET_TESTBED_HostRegistrationCompletion) (void *cls, const char *emsg) |
Callback which will be called to after a host registration succeeded or failed.
cls | the closure |
emsg | the error message; NULL if host registration is successful |
Definition at line 509 of file gnunet_testbed_service.h.
typedef void(* GNUNET_TESTBED_OperationCompletionCallback) (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg) |
Callback to be called when an operation is completed.
cls | the callback closure from functions generating an operation |
op | the operation that has been finished |
emsg | error 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.
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.
cls | the closure from GNUNET_TESTBED_peer_create() |
peer | the handle for the created peer; NULL on any error during creation |
emsg | NULL if peer is not NULL; else MAY contain the error description |
Definition at line 631 of file gnunet_testbed_service.h.
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.
cls | the closure from GNUNET_TESTBED_peer_start/stop() |
emsg | NULL on success; otherwise an error description |
Definition at line 681 of file gnunet_testbed_service.h.
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.
cb_cls | the closure from GNUNET_TESTBED_peer_get_information() |
op | the operation this callback corresponds to |
pinfo | the result; will be NULL if the operation has failed |
emsg | error message if the operation has failed; will be NULL if the operation is successful |
Definition at line 761 of file gnunet_testbed_service.h.
typedef void(* GNUNET_TESTBED_TopologyCompletionCallback) (void *cls, unsigned int nsuccess, unsigned int nfailures) |
Callbacks of this type are called when topology configuration is completed.
cls | the operation closure given to GNUNET_TESTBED_overlay_configure_topology_va() and GNUNET_TESTBED_overlay_configure() calls |
nsuccess | the number of successful overlay connects |
nfailures | the number of overlay connects which failed |
Definition at line 1103 of file gnunet_testbed_service.h.
typedef void*(* GNUNET_TESTBED_ConnectAdapter) (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Adapter function called to establish a connection to a service.
cls | closure |
cfg | configuration 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() |
Definition at line 1203 of file gnunet_testbed_service.h.
typedef void(* GNUNET_TESTBED_DisconnectAdapter) (void *cls, void *op_result) |
Adapter function called to destroy a connection to a service.
cls | closure |
op_result | service handle returned from the connect adapter |
Definition at line 1215 of file gnunet_testbed_service.h.
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.
cls | the callback closure from functions generating an operation |
op | the operation that has been finished |
ca_result | the service handle returned from GNUNET_TESTBED_ConnectAdapter() |
emsg | error 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.
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.
cls | closure |
peer | the peer the statistic belong to |
subsystem | name of subsystem that created the statistic |
name | the name of the datum |
value | the current value |
is_persistent | GNUNET_YES if the value is persistent, GNUNET_NO if not |
Definition at line 1307 of file gnunet_testbed_service.h.
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.
cls | closure |
h | the run handle |
num_peers | number of peers in 'peers' |
peers | handle to peers run in the testbed. NULL upon timeout (see GNUNET_TESTBED_test_run()). |
links_succeeded | the number of overlay link connection attempts that succeeded |
links_failed | the number of overlay link connection attempts that failed |
Definition at line 1372 of file gnunet_testbed_service.h.
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.
cls | the closure given to GNUNET_TESTBED_barrier_init() |
name | the name of the barrier |
barrier | the barrier handle |
status | status 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. |
emsg | if the status were to be GNUNET_SYSERR, this parameter has the error message |
Definition at line 1528 of file gnunet_testbed_service.h.
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.
cls | closure pointer given to GNUNET_TESTBED_barrier_wait() |
name | the barrier name |
status | GNUNET_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 with (at most 64) possible event types that can be monitored using the testbed framework.
Definition at line 220 of file gnunet_testbed_service.h.
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.
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.
Topologies and topology options supported for testbeds.
Options should always end with GNUNET_TESTBED_TOPOLOGY_OPTION_END
Definition at line 934 of file gnunet_testbed_service.h.
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.
The type of GNUNET_TESTBED_UnderlayLinkModel.
Definition at line 1627 of file gnunet_testbed_service.h.
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.
hostname | name of the host, use "NULL" for localhost |
username | username to use for the login; may be NULL |
cfg | the 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 |
port | port number to use for ssh; use 0 to let ssh decide |
Definition at line 368 of file testbed_api_hosts.c.
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().
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).
id | global host ID assigned to the host; 0 is reserved to always mean 'localhost' |
hostname | name of the host, use "NULL" for localhost |
username | username to use for the login; may be NULL |
cfg | the 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 |
port | port number to use for ssh; use 0 to let ssh decide |
id | global host ID assigned to the host; 0 is reserved to always mean 'localhost' |
hostname | name of the host, use "NULL" for localhost |
username | username to use for the login; may be NULL |
cfg | the 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 |
port | port number to use for ssh; use 0 to let ssh decide |
Definition at line 320 of file testbed_api_hosts.c.
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().
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
filename | file with the host specification |
cfg | the 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 |
hosts | set to the hosts found in the file; caller must free this if number of hosts returned is greater than 0 |
Definition at line 390 of file testbed_api_hosts.c.
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().
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.
host | handle to destroy |
Definition at line 559 of file testbed_api_hosts.c.
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().
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.
host | the host to check |
config | the configuration handle to lookup the path of the testbed helper |
cb | the callback to call to inform about habitability of the given host |
cb_cls | the closure for the callback |
Definition at line 1297 of file testbed_api_hosts.c.
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().
void GNUNET_TESTBED_is_host_habitable_cancel | ( | struct GNUNET_TESTBED_HostHabitableCheckHandle * | handle | ) |
Function to cancel a request started using GNUNET_TESTBED_is_host_habitable()
handle | the habitability check handle |
Definition at line 1359 of file testbed_api_hosts.c.
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().
const char* GNUNET_TESTBED_host_get_hostname | ( | const struct GNUNET_TESTBED_Host * | host | ) |
Obtain the host's hostname.
host | handle to the host, NULL means 'localhost' |
Definition at line 232 of file testbed_api_hosts.c.
References GNUNET_TESTBED_Host::hostname.
Referenced by GNUNET_TESTBED_controller_connect(), GNUNET_TESTBED_register_host(), helper_mst(), and host_habitable_cb().
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()
trusted_ip | the 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. |
host | the host where the controller has to be started. CANNOT be NULL. |
cb | function 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. |
cls | closure for above callbacks |
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()
trusted_ip | the 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. |
host | the host where the controller has to be started. CANNOT be NULL. |
cb | function 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. |
cls | closure for above callbacks |
Definition at line 1037 of file testbed_api_hosts.c.
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().
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.
cproc | the controller process handle |
Definition at line 1187 of file testbed_api_hosts.c.
References GNUNET_TESTBED_controller_destroy_(), and GNUNET_TESTBED_controller_kill_().
Referenced by cleanup(), do_shutdown(), GNUNET_TESTBED_controller_start(), and helper_exp_cb().
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().
host | host to run the controller on; This should be the same host if the controller was previously started with GNUNET_TESTBED_controller_start() |
event_mask | bit 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) | ...") |
cc | controller callback to invoke on events |
cc_cls | closure for cc |
Connect to a controller process.
host | host to run the controller on; This should be the same host if the controller was previously started with GNUNET_TESTBED_controller_start() |
event_mask | bit 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) | ...") |
cc | controller callback to invoke on events |
cc_cls | closure for cc |
Definition at line 1555 of file testbed_api.c.
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().
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 (!).
c | handle to controller to stop |
Definition at line 1721 of file testbed_api.c.
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().
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().
controller | the controller handle |
host | the host to register |
cc | the completion callback to call to inform the status of registration. After calling this callback the registration handle will be invalid. Cannot be NULL |
cc_cls | the closure for the cc |
controller | the controller handle |
host | the host to register |
cc | the completion callback to call to inform the status of registration. After calling this callback the registration handle will be invalid. Cannot be NULL. |
cc_cls | the closure for the cc |
Definition at line 1384 of file testbed_api_hosts.c.
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().
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.
handle | the 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.
handle | the registration handle to cancel |
Definition at line 1467 of file testbed_api_hosts.c.
References GNUNET_break, GNUNET_free, handle, and GNUNET_DNS_Handle::rh.
Referenced by do_shutdown(), kill_slave(), and rc_cleanup_operations().
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
op_cls | the operation closure for the event which is generated to signal success or failure of this operation |
master | handle to the master controller who creates the association |
delegated_host | requests to which host should be delegated; cannot be NULL |
slave_host | which host is used to run the slave controller; use NULL to make the master controller connect to the delegated host |
is_subordinate | GNUNET_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 |
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
op_cls | the operation closure for the event which is generated to signal success or failure of this operation |
master | handle to the master controller who creates the association |
delegated_host | requests to which host should be delegated; cannot be NULL |
slave_host | which host is used to run the slave controller; use NULL to make the master controller connect to the delegated host |
is_subordinate | GNUNET_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 |
Definition at line 1832 of file testbed_api.c.
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().
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
.
op_cls | the closure for the operation |
master | the handle to master controller |
slave_host | the 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 |
Definition at line 1921 of file testbed_api.c.
References GNUNET_NO, GNUNET_TESTBED_get_slave_config_(), GNUNET_TESTBED_host_get_id_(), and GNUNET_TESTBED_is_host_registered_().
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.
controller | controller process to use |
host | host to run the peer on; cannot be NULL |
cfg | Template configuration to use for the peer. Should exist until operation is cancelled or GNUNET_TESTBED_operation_done() is called |
cb | the callback to call when the peer has been created |
cls | the closure to the above callback |
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'.
controller | controller process to use |
host | host to run the peer on; cannot be NULL |
cfg | Template configuration to use for the peer. Should exist until operation is cancelled or GNUNET_TESTBED_operation_done() is called |
cb | the callback to call when the peer has been created |
cls | the closure to the above callback |
Definition at line 591 of file testbed_api_peers.c.
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().
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.
op_cls | the closure for this operation; will be set in the event information |
peer | peer to start |
pcc | function to call upon completion |
pcc_cls | closure for 'pcc' |
op_cls | the closure for this operation; will be set in event->details.operation_finished.op_cls when this operation fails. |
peer | peer to start |
pcc | function to call upon completion |
pcc_cls | closure for 'pcc' |
Definition at line 638 of file testbed_api_peers.c.
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().
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).
op_cls | the closure for this operation; will be set in the event information |
peer | peer to stop |
pcc | function to call upon completion |
pcc_cls | closure for 'pcc' |
Definition at line 665 of file testbed_api_peers.c.
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.
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.
peer | peer to request information about |
pit | desired information |
cb | the convenience callback to be called when results for this operation are available |
cb_cls | the closure for cb |
Definition at line 693 of file testbed_api_peers.c.
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().
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.
peer | peer to change configuration for |
cfg | new configuration |
Change peer configuration.
Must only be called while the peer is stopped. Ports and paths cannot be changed this way.
peer | peer to change configuration for |
cfg | new configuration (differences to existing configuration only) |
Definition at line 734 of file testbed_api_peers.c.
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.
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).
peer | peer to stop |
Definition at line 781 of file testbed_api_peers.c.
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.
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.
op_cls | the closure for the operation |
peer | the peer whose service is to be started/stopped |
service_name | the name of the service |
cb | the operation completion callback |
cb_cls | the closure for cb |
start | 1 to start the service; 0 to stop the service |
Definition at line 921 of file testbed_api_peers.c.
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().
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
c | the controller to send this message to |
op_cls | closure for the operation |
cb | the callback to call when all peers are stopped and destroyed |
cb_cls | the closure for the callback |
Definition at line 2252 of file testbed_api.c.
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().
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.
op_cls | closure argument to give with the operation event |
p1 | first peer |
p2 | second peer |
co | option to change |
ap | option-specific values |
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.
op_cls | closure argument to give with the operation event |
p1 | first peer |
p2 | second peer |
co | option to change |
... | option-specific values |
Definition at line 813 of file testbed_api_peers.c.
References GNUNET_break.
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.
op_cls | closure argument to give with the operation event |
num_peers | number of peers in peers |
peers | array of num_peers with the peers to configure |
topo | desired underlay topology to use |
ap | topology-specific options |
Definition at line 1242 of file testbed_api_topology.c.
References GNUNET_break.
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.
op_cls | closure argument to give with the operation event |
num_peers | number of peers in peers |
peers | array of num_peers with the peers to configure |
topo | desired underlay topology to use |
... | topology-specific options |
Definition at line 1256 of file testbed_api_topology.c.
References GNUNET_break.
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.
op_cls | closure argument to give with the operation event |
cb | the callback to call when this operation has finished |
cb_cls | the closure for cb |
p1 | first peer |
p2 | second peer |
Definition at line 825 of file testbed_api_peers.c.
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().
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.
op_cls | closure argument to give with the peer connect operation events generated through this function |
num_peers | number of peers in 'peers' |
peers | array of 'num_peers' with the peers to configure |
max_connections | the maximums number of overlay connections that will be made to achieve the given topology |
comp_cb | the completion callback to call when the topology generation is completed |
comp_cb_cls | closure for the comp_cb |
topo | desired underlay topology to use |
va | topology-specific options |
Definition at line 1268 of file testbed_api_topology.c.
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().
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.
op_cls | closure argument to give with the peer connect operation events generated through this function |
num_peers | number of peers in 'peers' |
peers | array of 'num_peers' with the peers to configure |
max_connections | the maximums number of overlay connections that will be made to achieve the given topology |
comp_cb | the completion callback to call when the topology generation is completed |
comp_cb_cls | closure for the above completion callback |
topo | desired underlay topology to use |
... | topology-specific options |
Definition at line 1419 of file testbed_api_topology.c.
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().
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!?
controller | overlay controller to inspect |
filename | name of the file the topology should be written to. |
Definition at line 1935 of file testbed_api.c.
References GNUNET_break.
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.
op_cls | closure to pass in operation event // FIXME: didn't we say we'd no longer use the global callback for these? -CG |
peer | peer that runs the service |
service_name | name of the service to connect to |
cb | the callback to call when this operation is ready (that is, right after the connect adapter returns) |
cb_cls | closure for cb |
ca | helper function to establish the connection |
da | helper function to close the connection |
cada_cls | closure for ca and da |
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.
op_cls | closure to pass in operation event |
peer | peer that runs the service |
service_name | name of the service to connect to |
cb | the callback to call when this operation finishes |
cb_cls | closure for the above callback |
ca | helper function to establish the connection |
da | helper function to close the connection |
cada_cls | closure for ca and da |
Definition at line 257 of file testbed_api_services.c.
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().
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.
operation | operation to signal completion or cancellation |
Definition at line 2021 of file testbed_api.c.
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().
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.
num_peers | number of peers to iterate over |
peers | array of peers to iterate over |
subsystem | limit to the specified subsystem, NULL for all subsystems |
name | name of the statistic value, NULL for all values |
proc | processing function for each statistic retrieved |
cont | continuation 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 |
cls | closure to pass to proc and cont |
num_peers | number of peers to iterate over |
peers | array of peers to iterate over |
subsystem | limit to the specified subsystem, NULL for all subsystems |
name | name of the statistic value, NULL for all values |
proc | processing function for each statistic retrieved |
cont | continuation to call once call is completed(?) |
cls | closure to pass to proc and cont |
Definition at line 404 of file testbed_api_statistics.c.
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().
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".
peer | Peer handle. |
Definition at line 2291 of file testbed_api.c.
References peer, and GNUNET_TESTBED_Peer::unique_id.
Referenced by statistics_cb(), and stats_iterator().
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".
host_filename | name of the file with the 'hosts', NULL to run everything on 'localhost' |
cfg | configuration to use (for testbed, controller and peers) |
num_peers | number of peers to start; FIXME: maybe put that ALSO into cfg?; should be greater than 0 |
event_mask | bit 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) || ...") |
cc | controller 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_cls | closure for cc |
test_master | this callback will be called once the test is ready or upon timeout |
test_master_cls | closure 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".
host_filename | name of the file with the 'hosts', NULL to run everything on 'localhost' |
cfg | configuration to use (for testbed, controller and peers) |
num_peers | number of peers to start; FIXME: maybe put that ALSO into cfg? |
event_mask | bit 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) || ...") |
cc | controller 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_cls | closure for cc |
test_master | this callback will be called once the test is ready |
test_master_cls | closure for 'test_master'. |
Definition at line 1245 of file testbed_api_testbed.c.
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().
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'.
testname | name of the testcase (to configure logging, etc.) |
cfg_filename | configuration filename to use (for testbed, controller and peers) |
num_peers | number of peers to start; should be greter than 0 |
event_mask | bit 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) || ...") |
cc | controller 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_cls | closure for cc |
test_master | this callback will be called once the test is ready or upon timeout |
test_master_cls | closure 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 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'.
testname | name of the testcase (to configure logging, etc.) |
cfg_filename | configuration filename to use (for testbed, controller and peers) |
num_peers | number of peers to start |
event_mask | bit 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) || ...") |
cc | controller 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_cls | closure for cc |
test_master | task to run once the test is ready |
test_master_cls | closure for test_master |
Definition at line 123 of file testbed_api_test.c.
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().
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.
h | the testbed run handle |
Definition at line 1461 of file testbed_api_testbed.c.
References h.
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.
controller | the handle to the controller |
name | identification name of the barrier |
quorum | the percentage of peers that is required to reach the barrier. Peers signal reaching a barrier by calling GNUNET_TESTBED_barrier_reached(). |
cb | the callback to call when the barrier is reached or upon error. Cannot be NULL. |
cb_cls | closure for cb |
Initialise a barrier and call the given callback when the required percentage of peers (quorum) reach the barrier.
controller | the handle to the controller |
name | identification name of the barrier |
quorum | the percentage of peers that is required to reach the barrier. Peers signal reaching a barrier by calling GNUNET_TESTBED_barrier_reached(). |
cb | the callback to call when the barrier is reached or upon error. Cannot be NULL. |
cb_cls | closure for the above callback |
Definition at line 2391 of file testbed_api.c.
References GNUNET_TESTBED_Barrier::cb, GNUNET_TESTBED_barrier_init_(), GNUNET_YES, and name.
void GNUNET_TESTBED_barrier_cancel | ( | struct GNUNET_TESTBED_Barrier * | barrier | ) |
Cancel a barrier.
barrier | the barrier handle |
Definition at line 2412 of file testbed_api.c.
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().
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
name | the name of the barrier |
cb | the barrier wait callback |
cls | the closure for the above callback |
Definition at line 164 of file testbed_api_barriers.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().
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.
h | the barrier wait handle |
h | the barrier wait handle |
Definition at line 240 of file testbed_api_barriers.c.
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().
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.
peer | the peer for which the model has to be created |
type | the type of the model |
Definition at line 154 of file testbed_api_underlay.c.
References GNUNET_assert, GNUNET_new, m, peer, type, and GNUNET_TESTBED_Peer::underlay_model_exists.
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.
model | the model |
peer | the peer to add |
Definition at line 179 of file testbed_api_underlay.c.
References GNUNET_TESTBED_UnderlayLinkModel::entries, GNUNET_new, ListEntry::next, ListEntry::peer, and peer.
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.
model | the model |
peer | the other end peer of the link |
latency | latency of the link in microseconds |
loss | data loss of the link expressed as a percentage |
bandwidth | bandwidth of the link in kilobytes per second [kB/s] |
Definition at line 205 of file testbed_api_underlay.c.
References LinkProperty::bandwidth, GNUNET_new, LinkProperty::latency, LinkProperty::loss, LinkProperty::next, LinkProperty::peer, peer, and GNUNET_TESTBED_UnderlayLinkModel::props.
void GNUNET_TESTBED_underlaylinkmodel_commit | ( | struct GNUNET_TESTBED_UnderlayLinkModel * | model | ) |
Commit the model.
The model is freed in this function(!).
model | the model to commit |
Definition at line 251 of file testbed_api_underlay.c.
References free_entries(), free_link_properties(), GNUNET_break, and GNUNET_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.
model | the model to unallocate |
Definition at line 234 of file testbed_api_underlay.c.
References free_entries(), free_link_properties(), GNUNET_TESTBED_UnderlayLinkModel::peer, and GNUNET_TESTBED_Peer::underlay_model_exists.