![]() |
GNUnet
0.11.x
|
ats testing library: setup topology solvers More...
#include "ats-testing.h"
Go to the source code of this file.
Data Structures | |
struct | TestbedConnectOperation |
Connect peers with testbed. More... | |
Functions | |
static void | do_shutdown (void *cls) |
Shutdown nicely. More... | |
static struct BenchmarkPartner * | find_partner (struct BenchmarkPeer *me, const struct GNUNET_PeerIdentity *peer) |
static struct BenchmarkPeer * | find_peer (const struct GNUNET_PeerIdentity *peer) |
static void * | comm_connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq) |
Method called whenever a given peer connects. More... | |
static void | comm_disconnect_cb (void *cls, const struct GNUNET_PeerIdentity *peer, void *internal_cls) |
static void | handle_pong (void *cls, const struct TestMessage *message) |
static void | handle_ping (void *cls, const struct TestMessage *message) |
static void * | transport_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) |
static void | transport_disconnect_adapter (void *cls, void *op_result) |
static void * | core_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) |
static void | core_disconnect_adapter (void *cls, void *op_result) |
static void | connect_completion_callback (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg) |
static void | do_connect_peers (void *cls) |
static void | comm_connect_completion_cb (void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, const char *emsg) |
static void | do_comm_connect (void *cls) |
static void | ats_performance_info_cb (void *cls, const struct GNUNET_HELLO_Address *address, int address_active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, const struct GNUNET_ATS_Properties *ats_prop) |
static void * | ats_perf_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) |
static void | ats_perf_disconnect_adapter (void *cls, void *op_result) |
static void | ats_connect_completion_cb (void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, const char *emsg) |
static void | do_connect_ats (void *cls) |
static void | peerinformation_cb (void *cb_cls, struct GNUNET_TESTBED_Operation *op, const struct GNUNET_TESTBED_PeerInformation *pinfo, const char *emsg) |
static void | main_run (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... | |
static void | controller_event_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) |
Controller event callback. More... | |
struct BenchmarkPeer * | GNUNET_ATS_TEST_get_peer (int src) |
Topology related functions. More... | |
struct BenchmarkPartner * | GNUNET_ATS_TEST_get_partner (int src, int dest) |
void | GNUNET_ATS_TEST_create_topology (char *name, char *cfg_file, unsigned int num_slaves, unsigned int num_masters, int test_core, GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb, void *done_cb_cls, GNUNET_ATS_AddressInformationCallback log_request_cb) |
Create a topology for ats testing. More... | |
void | GNUNET_ATS_TEST_shutdown_topology (void) |
Shutdown topology. More... | |
Variables | |
struct GNUNET_CONFIGURATION_Handle * | cfg |
Handle to our configuration. More... | |
struct GNUNET_ATS_TEST_Topology * | top |
ats testing library: setup topology solvers
Definition in file ats-testing.c.
|
static |
Shutdown nicely.
cls | NULL |
Definition at line 62 of file ats-testing.c.
References BenchmarkPeer::ats_perf_op, BenchmarkPeer::ats_task, BenchmarkState::benchmarking, BenchmarkPeer::comm_op, TestbedConnectOperation::connect_op, BenchmarkPeer::core_connect_ops, GNUNET_ATS_TEST_generate_traffic_stop_all(), GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_log, GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_SCHEDULER_shutdown(), GNUNET_TESTBED_operation_done(), GNUNET_ATS_TEST_Topology::mps, GNUNET_ATS_TEST_Topology::num_masters, BenchmarkPeer::num_partners, GNUNET_ATS_TEST_Topology::num_slaves, p, BenchmarkPeer::partners, BenchmarkPeer::peer_id_op, GNUNET_ATS_TEST_Topology::sps, and GNUNET_ATS_TEST_Topology::state.
Referenced by main_run().
|
static |
Definition at line 146 of file ats-testing.c.
References BenchmarkPartner::dest, GNUNET_memcmp, BenchmarkPeer::id, BenchmarkPeer::num_partners, and BenchmarkPeer::partners.
Referenced by ats_performance_info_cb(), and comm_connect_cb().
|
static |
Definition at line 166 of file ats-testing.c.
References GNUNET_memcmp, BenchmarkPeer::id, GNUNET_ATS_TEST_Topology::mps, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, and GNUNET_ATS_TEST_Topology::sps.
Referenced by comm_connect_cb().
|
static |
Method called whenever a given peer connects.
cls | closure |
peer | peer identity this notification is about |
mq | queue to use to send messages to peer |
struct BenchmarkPartner
of peer Definition at line 196 of file ats-testing.c.
References BenchmarkState::connected_CORE, BenchmarkPeer::core_connections, BenchmarkPeer::core_slave_connections, GNUNET_ATS_TEST_Topology::done_cb, GNUNET_ATS_TEST_Topology::done_cb_cls, find_partner(), find_peer(), GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_INFO, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_NO, GNUNET_strdup, GNUNET_YES, BenchmarkPeer::id, id, BenchmarkPeer::master, me, GNUNET_ATS_TEST_Topology::mps, mq, BenchmarkPartner::mq, BenchmarkPeer::no, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, p, GNUNET_ATS_TEST_Topology::sps, and GNUNET_ATS_TEST_Topology::state.
Referenced by core_connect_adapter(), and transport_connect_adapter().
|
static |
cls | this peer |
peer | id of disconnecting peer |
internal_cls | the struct BenchmarkPartner of peer |
Definition at line 273 of file ats-testing.c.
References BenchmarkState::benchmarking, BenchmarkPeer::core_connections, BenchmarkPartner::dest, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_strdup, GNUNET_YES, BenchmarkPeer::id, id, BenchmarkPeer::master, me, p, and GNUNET_ATS_TEST_Topology::state.
Referenced by core_connect_adapter(), and transport_connect_adapter().
|
static |
Definition at line 306 of file ats-testing.c.
References GNUNET_ATS_TEST_traffic_handle_pong(), and p.
|
static |
Definition at line 316 of file ats-testing.c.
References GNUNET_ATS_TEST_traffic_handle_ping(), and p.
|
static |
Definition at line 326 of file ats-testing.c.
References comm_connect_cb(), comm_disconnect_cb(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_TRANSPORT_core_connect(), BenchmarkPeer::id, me, ping(), pong(), TEST_MESSAGE_TYPE_PING, TEST_MESSAGE_TYPE_PONG, and BenchmarkPeer::th.
Referenced by do_comm_connect().
|
static |
Definition at line 357 of file ats-testing.c.
References GNUNET_TRANSPORT_core_disconnect(), me, and BenchmarkPeer::th.
Referenced by do_comm_connect().
|
static |
Definition at line 368 of file ats-testing.c.
References BenchmarkPeer::ch, comm_connect_cb(), comm_disconnect_cb(), GNUNET_CORE_connect(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, me, ping(), pong(), TEST_MESSAGE_TYPE_PING, and TEST_MESSAGE_TYPE_PONG.
Referenced by do_comm_connect().
|
static |
Definition at line 398 of file ats-testing.c.
References BenchmarkPeer::ch, GNUNET_CORE_disconnect(), and me.
Referenced by do_comm_connect().
|
static |
Definition at line 409 of file ats-testing.c.
References _, TestbedConnectOperation::connect_op, BenchmarkState::connected_PEERS, BenchmarkPeer::core_connect_ops, GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_SCHEDULER_shutdown(), GNUNET_TESTBED_operation_done(), GNUNET_YES, TestbedConnectOperation::master, BenchmarkPeer::no, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, TestbedConnectOperation::slave, and GNUNET_ATS_TEST_Topology::state.
Referenced by do_connect_peers().
|
static |
Definition at line 447 of file ats-testing.c.
References connect_completion_callback(), TestbedConnectOperation::connect_op, BenchmarkState::connected_ATS_service, BenchmarkState::connected_COMM_service, BenchmarkPeer::core_connect_ops, GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_malloc, GNUNET_NO, GNUNET_SCHEDULER_shutdown(), GNUNET_TESTBED_overlay_connect(), TestbedConnectOperation::master, GNUNET_ATS_TEST_Topology::mps, BenchmarkPeer::no, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, p, BenchmarkPeer::peer, TestbedConnectOperation::slave, GNUNET_ATS_TEST_Topology::sps, and GNUNET_ATS_TEST_Topology::state.
Referenced by comm_connect_completion_cb().
|
static |
Definition at line 496 of file ats-testing.c.
References BenchmarkState::connected_COMM_service, do_connect_peers(), GNUNET_break, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_shutdown(), GNUNET_YES, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, GNUNET_ATS_TEST_Topology::state, and GNUNET_ATS_TEST_Topology::test_core.
Referenced by do_comm_connect().
|
static |
Definition at line 526 of file ats-testing.c.
References comm_connect_completion_cb(), BenchmarkPeer::comm_op, core_connect_adapter(), core_disconnect_adapter(), GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_TESTBED_service_connect(), GNUNET_YES, GNUNET_ATS_TEST_Topology::mps, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, BenchmarkPeer::peer, GNUNET_ATS_TEST_Topology::sps, GNUNET_ATS_TEST_Topology::test_core, transport_connect_adapter(), and transport_disconnect_adapter().
Referenced by ats_connect_completion_cb().
|
static |
Definition at line 589 of file ats-testing.c.
References GNUNET_ATS_TEST_Topology::ats_perf_cb, BenchmarkPartner::bandwidth_in, BenchmarkPartner::bandwidth_out, GNUNET_ATS_Properties::delay, BenchmarkPartner::dest, GNUNET_ATS_Properties::distance, find_partner(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_NO, GNUNET_strdup, GNUNET_YES, BenchmarkPeer::id, BenchmarkPeer::master, me, BenchmarkPartner::me, BenchmarkPeer::no, p, GNUNET_HELLO_Address::peer, peer_id, BenchmarkPartner::props, GNUNET_ATS_Properties::scope, GNUNET_ATS_Properties::utilization_in, GNUNET_ATS_Properties::utilization_out, and GNUNET_BANDWIDTH_Value32NBO::value__.
Referenced by ats_perf_connect_adapter().
|
static |
Definition at line 650 of file ats-testing.c.
References BenchmarkPeer::ats_perf_handle, ats_performance_info_cb(), GNUNET_ATS_performance_init(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, and me.
Referenced by do_connect_ats().
|
static |
Definition at line 667 of file ats-testing.c.
References BenchmarkPeer::ats_perf_handle, GNUNET_ATS_performance_done(), and me.
Referenced by do_connect_ats().
|
static |
Definition at line 678 of file ats-testing.c.
References BenchmarkState::connected_ATS_service, do_comm_connect(), GNUNET_break, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_shutdown(), GNUNET_YES, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, and GNUNET_ATS_TEST_Topology::state.
Referenced by do_connect_ats().
|
static |
Definition at line 706 of file ats-testing.c.
References ats_connect_completion_cb(), ats_perf_connect_adapter(), ats_perf_disconnect_adapter(), BenchmarkPeer::ats_perf_op, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_TESTBED_service_connect(), GNUNET_ATS_TEST_Topology::mps, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, BenchmarkPeer::peer, and GNUNET_ATS_TEST_Topology::sps.
Referenced by peerinformation_cb().
|
static |
Definition at line 742 of file ats-testing.c.
References do_connect_ats(), done(), GNUNET_assert, GNUNET_ERROR_TYPE_INFO, GNUNET_i2s(), GNUNET_log, GNUNET_SCHEDULER_add_now(), GNUNET_TESTBED_operation_done(), GNUNET_TESTBED_PIT_IDENTITY, GNUNET_YES, BenchmarkPeer::id, GNUNET_TESTBED_PeerInformation::id, BenchmarkPeer::master, BenchmarkPeer::no, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, p, BenchmarkPeer::peer_id_op, GNUNET_TESTBED_PeerInformation::pit, and GNUNET_TESTBED_PeerInformation::result.
Referenced by main_run().
|
static |
Signature of a main function for a testcase.
cls | closure |
h | testbed handle |
num_peers | number of peers in 'peers' |
peers_ | handle to peers run in the testbed |
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 786 of file ats-testing.c.
References GNUNET_ATS_Properties::delay, BenchmarkPartner::dest, GNUNET_ATS_Properties::distance, do_shutdown(), GNUNET_assert, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_malloc, GNUNET_new_array, GNUNET_NO, GNUNET_NT_UNSPECIFIED, GNUNET_SCHEDULER_add_shutdown(), GNUNET_TESTBED_peer_get_information(), GNUNET_TESTBED_PIT_IDENTITY, GNUNET_TIME_UNIT_ZERO, GNUNET_YES, BenchmarkPeer::master, BenchmarkPartner::me, GNUNET_ATS_TEST_Topology::mps, BenchmarkPeer::no, GNUNET_ATS_TEST_Topology::num_masters, BenchmarkPeer::num_partners, GNUNET_ATS_TEST_Topology::num_slaves, BenchmarkPeer::partners, BenchmarkPeer::peer, BenchmarkPeer::peer_id_op, peerinformation_cb(), BenchmarkPeer::pref_partner, BenchmarkPeer::pref_value, BenchmarkPartner::props, GNUNET_ATS_Properties::scope, GNUNET_ATS_TEST_Topology::sps, TEST_ATS_PREFERENCE_DEFAULT, GNUNET_ATS_Properties::utilization_in, and GNUNET_ATS_Properties::utilization_out.
Referenced by GNUNET_ATS_TEST_create_topology().
|
static |
Controller event callback.
cls | NULL |
event | the controller event |
Definition at line 875 of file ats-testing.c.
References GNUNET_break, GNUNET_SCHEDULER_shutdown(), GNUNET_TESTBED_ET_CONNECT, GNUNET_TESTBED_ET_OPERATION_FINISHED, and GNUNET_TESTBED_EventInformation::type.
Referenced by GNUNET_ATS_TEST_create_topology().
struct BenchmarkPeer* GNUNET_ATS_TEST_get_peer | ( | int | src | ) |
Topology related functions.
Definition at line 894 of file ats-testing.c.
References GNUNET_ATS_TEST_Topology::mps, and GNUNET_ATS_TEST_Topology::num_masters.
Referenced by enforce_start_preference(), and enforce_start_send().
struct BenchmarkPartner* GNUNET_ATS_TEST_get_partner | ( | int | src, |
int | dest | ||
) |
Definition at line 903 of file ats-testing.c.
References BenchmarkPartner::dest, GNUNET_ATS_TEST_Topology::mps, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, and BenchmarkPeer::partners.
Referenced by enforce_start_preference(), enforce_start_send(), enforce_stop_preference(), and enforce_stop_send().
void GNUNET_ATS_TEST_create_topology | ( | char * | name, |
char * | cfg_file, | ||
unsigned int | num_slaves, | ||
unsigned int | num_masters, | ||
int | test_core, | ||
GNUNET_ATS_TEST_TopologySetupDoneCallback | done_cb, | ||
void * | done_cb_cls, | ||
GNUNET_ATS_AddressInformationCallback | log_request_cb | ||
) |
Create a topology for ats testing.
name | test name |
cfg_file | configuration file to use for the peers |
num_slaves | number of slaves |
num_masters | number of masters |
test_core | connect to CORE service (GNUNET_YES) or transport (GNUNET_NO) |
done_cb | function to call when topology is setup |
done_cb_cls | cls for callback |
log_request_cb | callback to call when logging is required |
Definition at line 927 of file ats-testing.c.
References GNUNET_ATS_TEST_Topology::ats_perf_cb, controller_event_cb(), GNUNET_ATS_TEST_Topology::done_cb, GNUNET_ATS_TEST_Topology::done_cb_cls, event_mask, GNUNET_new, GNUNET_new_array, GNUNET_TESTBED_ET_CONNECT, GNUNET_TESTBED_ET_OPERATION_FINISHED, GNUNET_TESTBED_test_run(), main_run(), GNUNET_ATS_TEST_Topology::mps, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, GNUNET_ATS_TEST_Topology::sps, and GNUNET_ATS_TEST_Topology::test_core.
Referenced by main().
void GNUNET_ATS_TEST_shutdown_topology | ( | void | ) |
Shutdown topology.
Definition at line 967 of file ats-testing.c.
References GNUNET_SCHEDULER_shutdown().
Referenced by do_shutdown().
struct GNUNET_CONFIGURATION_Handle* cfg |
Handle to our configuration.
Definition at line 51 of file ats-testing.c.
struct GNUNET_ATS_TEST_Topology* top |
Definition at line 53 of file ats-testing.c.
Referenced by exchange().