Go to the source code of this file.
Data Structures | |
struct | GNUNET_TRANSPORT_TESTING_ConnectRequestList |
Closure for connect_cb. More... | |
struct | GNUNET_TRANSPORT_TESTING_InternalPeerContext |
Internal data structure. More... | |
struct | ConnectPairInfo |
Information tracked per connected peer. More... | |
Functions | |
static void | do_shutdown (void *cls) |
Shutdown function for the test. More... | |
static void | do_timeout (void *cls) |
Testcase hit timeout, shut it down with error. More... | |
static void | connect_cb (void *cls) |
Function called when we connected two peers. More... | |
struct GNUNET_TRANSPORT_TESTING_PeerContext * | GNUNET_TRANSPORT_TESTING_find_peer (struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc, const struct GNUNET_PeerIdentity *peer) |
Find peer by peer ID. More... | |
static void * | my_nc (void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq) |
Wrapper around peers connecting. More... | |
static void | my_nd (void *cls, const struct GNUNET_PeerIdentity *peer, void *custom_cls) |
Wrapper around peers disconnecting. More... | |
static int | check_test (void *cls, const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) |
Wrapper around receiving data. More... | |
static void | handle_test (void *cls, const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) |
Wrapper around receiving data. More... | |
static int | check_test2 (void *cls, const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) |
Wrapper around receiving data. More... | |
static void | handle_test2 (void *cls, const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) |
Wrapper around receiving data. More... | |
static void | do_connect (void *cls) |
Connect the peers as a clique. More... | |
static void | start_cb (void *cls) |
Function called once we have successfully launched a peer. More... | |
static void | connect_check_run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Function run from GNUNET_TRANSPORT_TESTING_connect_check once the scheduler is up. More... | |
int | GNUNET_TRANSPORT_TESTING_connect_check (void *cls, struct GNUNET_TRANSPORT_TESTING_Handle *tth_, const char *test_plugin_, const char *test_name_, unsigned int num_peers, char *cfg_files[]) |
Common implementation of the GNUNET_TRANSPORT_TESTING_CheckCallback. More... | |
int | GNUNET_TRANSPORT_TESTING_main_ (const char *argv0, const char *filename, unsigned int num_peers, GNUNET_TRANSPORT_TESTING_CheckCallback check, void *check_cls) |
Setup testcase. More... | |
|
static |
Shutdown function for the test.
Stops all peers.
cls | our struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext * |
Definition at line 72 of file transport-testing-main2.c.
References GNUNET_TRANSPORT_TESTING_ConnectRequestList::ccc, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::cls, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::connect_task, GNUNET_TRANSPORT_TESTING_ConnectRequestList::cr, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::crl_head, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::crl_tail, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_SCHEDULER_cancel(), GNUNET_TRANSPORT_TESTING_connect_peers_cancel(), GNUNET_TRANSPORT_TESTING_stop_peer(), GNUNET_TRANSPORT_TESTING_ConnectCheckContext::num_peers, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::p, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::shutdown_task, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::shutdown_task_cls, and GNUNET_TRANSPORT_TESTING_ConnectCheckContext::timeout_task.
Referenced by connect_check_run().
|
static |
Testcase hit timeout, shut it down with error.
cls | our struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext * |
Definition at line 116 of file transport-testing-main2.c.
References GNUNET_TRANSPORT_TESTING_ConnectCheckContext::cls, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::global_ret, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_SCHEDULER_shutdown(), GNUNET_SYSERR, and GNUNET_TRANSPORT_TESTING_ConnectCheckContext::timeout_task.
Referenced by connect_check_run().
|
static |
Function called when we connected two peers.
Once we have gotten to the clique, launch test-specific logic.
cls | our struct GNUNET_TRANSPORT_TESTING_ConnectRequestList * |
Definition at line 171 of file transport-testing-main2.c.
References GNUNET_TRANSPORT_TESTING_ConnectRequestList::ccc, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::connect_continuation, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::connect_continuation_cls, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::crl_head, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::crl_tail, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_SCHEDULER_add_now(), GNUNET_strdup, GNUNET_TRANSPORT_TESTING_PeerContext::id, GNUNET_TRANSPORT_TESTING_PeerContext::no, GNUNET_TRANSPORT_TESTING_ConnectRequestList::p1, and GNUNET_TRANSPORT_TESTING_ConnectRequestList::p2.
Referenced by do_connect().
struct GNUNET_TRANSPORT_TESTING_PeerContext * GNUNET_TRANSPORT_TESTING_find_peer | ( | struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext * | ccc, |
const struct GNUNET_PeerIdentity * | peer | ||
) |
Find peer by peer ID.
ccc | context to search |
peer | peer to look for |
Definition at line 209 of file transport-testing-main2.c.
References GNUNET_TRANSPORT_TESTING_PeerContext::id, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::num_peers, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::p, and GNUNET_TRANSPORT_TESTING_PeerContext::peer.
|
static |
Wrapper around peers connecting.
Calls client's nc function.
cls | our struct GNUNET_TRANSPORT_TESTING_InternalPeerContext * |
peer | peer we got connected to |
mq | message queue for transmissions to peer |
Definition at line 233 of file transport-testing-main2.c.
References GNUNET_TRANSPORT_TESTING_InternalPeerContext::ccc, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::cls, GNUNET_new, ConnectPairInfo::ipi, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::nc, GNUNET_TRANSPORT_TESTING_InternalPeerContext::off, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::p, and ConnectPairInfo::sender.
Referenced by connect_check_run().
|
static |
Wrapper around peers disconnecting.
Calls client's nd function.
cls | our struct GNUNET_TRANSPORT_TESTING_InternalPeerContext * |
peer | peer we got disconnected from |
custom_cls | return value from my_nc |
Definition at line 260 of file transport-testing-main2.c.
References GNUNET_TRANSPORT_TESTING_InternalPeerContext::ccc, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::cls, GNUNET_free, ConnectPairInfo::ipi, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::nd, GNUNET_TRANSPORT_TESTING_InternalPeerContext::off, and GNUNET_TRANSPORT_TESTING_ConnectCheckContext::p.
Referenced by connect_check_run().
|
static |
Wrapper around receiving data.
Calls client's rec function.
cls | our struct ConnectPairInfo * |
message | message we received |
Definition at line 284 of file transport-testing-main2.c.
References GNUNET_OK.
|
static |
Wrapper around receiving data.
Calls client's rec function.
cls | our struct ConnectPairInfo * |
message | message we received |
Definition at line 298 of file transport-testing-main2.c.
References GNUNET_TRANSPORT_TESTING_InternalPeerContext::ccc, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::cls, ConnectPairInfo::ipi, GNUNET_TRANSPORT_TESTING_InternalPeerContext::off, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::p, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::rec, and ConnectPairInfo::sender.
|
static |
Wrapper around receiving data.
Calls client's rec function.
cls | our struct ConnectPairInfo * |
message | message we received |
Definition at line 321 of file transport-testing-main2.c.
References GNUNET_OK.
|
static |
Wrapper around receiving data.
Calls client's rec function.
cls | our struct ConnectPairInfo * |
message | message we received |
Definition at line 335 of file transport-testing-main2.c.
References GNUNET_TRANSPORT_TESTING_InternalPeerContext::ccc, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::cls, ConnectPairInfo::ipi, GNUNET_TRANSPORT_TESTING_InternalPeerContext::off, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::p, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::rec, and ConnectPairInfo::sender.
|
static |
Connect the peers as a clique.
cls | our struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext |
Definition at line 356 of file transport-testing-main2.c.
References GNUNET_TRANSPORT_TESTING_ConnectCheckContext::bi_directional, GNUNET_TRANSPORT_TESTING_ConnectRequestList::ccc, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::cls, connect_cb(), GNUNET_TRANSPORT_TESTING_ConnectCheckContext::connect_task, GNUNET_TRANSPORT_TESTING_ConnectRequestList::cr, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::crl_head, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::crl_tail, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_new, GNUNET_strdup, GNUNET_TRANSPORT_TESTING_connect_peers(), GNUNET_TRANSPORT_TESTING_PeerContext::id, GNUNET_TRANSPORT_TESTING_PeerContext::no, num_peers, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::num_peers, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::p, GNUNET_TRANSPORT_TESTING_ConnectRequestList::p1, and GNUNET_TRANSPORT_TESTING_ConnectRequestList::p2.
Referenced by start_cb().
|
static |
Function called once we have successfully launched a peer.
Once all peers have been launched, we connect all of them in a clique.
cls | our struct GNUNET_TRANSPORT_TESTING_InternalPeerContext * |
Definition at line 403 of file transport-testing-main2.c.
References GNUNET_TRANSPORT_TESTING_InternalPeerContext::ccc, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::connect_task, do_connect(), GNUNET_ERROR_TYPE_INFO, GNUNET_i2s(), GNUNET_log, GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_UNIT_SECONDS, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::num_peers, GNUNET_TRANSPORT_TESTING_InternalPeerContext::off, p, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::p, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::pre_connect_task, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::pre_connect_task_cls, and GNUNET_TRANSPORT_TESTING_ConnectCheckContext::started.
Referenced by connect_check_run(), and GNUNET_TRANSPORT_TESTING_start_peer().
|
static |
Function run from GNUNET_TRANSPORT_TESTING_connect_check once the scheduler is up.
Should launch the peers and then in the continuations try to connect them.
cls | our struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext * |
args | ignored |
cfgfile | ignored |
cfg | configuration |
Definition at line 443 of file transport-testing-main2.c.
References cfg, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::cfg, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::cfg_files, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::cls, do_shutdown(), do_timeout(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_SYSERR, GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE, GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE2, GNUNET_TRANSPORT_TESTING_start_peer(), handlers, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::ip, my_nc(), my_nd(), GNUNET_TRANSPORT_TESTING_ConnectCheckContext::num_peers, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::p, start_cb(), GNUNET_TRANSPORT_TESTING_ConnectCheckContext::timeout, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::timeout_task, and GNUNET_TRANSPORT_TESTING_ConnectCheckContext::tth.
Referenced by GNUNET_TRANSPORT_TESTING_connect_check().
int GNUNET_TRANSPORT_TESTING_connect_check | ( | void * | cls, |
struct GNUNET_TRANSPORT_TESTING_Handle * | tth_, | ||
const char * | test_plugin_, | ||
const char * | test_name_, | ||
unsigned int | num_peers, | ||
char * | cfg_files[] | ||
) |
Common implementation of the GNUNET_TRANSPORT_TESTING_CheckCallback.
Starts and connects the two peers, then invokes the connect_continuation
from cls. Sets up a timeout to abort the test, and a shutdown handler to clean up properly on exit.
cls | closure of type struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext |
tth_ | initialized testing handle |
test_plugin_ | name of the plugin |
test_name_ | name of the test |
num_peers | number of entries in the cfg_file array |
cfg_files | array of names of configuration files for the peers |
Definition at line 508 of file transport-testing-main2.c.
References GNUNET_TRANSPORT_TESTING_InternalPeerContext::ccc, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::cfg_files, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::cls, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::config_file, connect_check_run(), GNUNET_TRANSPORT_TESTING_ConnectCheckContext::global_ret, GNUNET_GETOPT_OPTION_END, GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_SYSERR, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::ip, num_peers, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::num_peers, GNUNET_TRANSPORT_TESTING_InternalPeerContext::off, options, p, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::p, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::test_name, GNUNET_TRANSPORT_TESTING_ConnectCheckContext::test_plugin, and GNUNET_TRANSPORT_TESTING_ConnectCheckContext::tth.
int GNUNET_TRANSPORT_TESTING_main_ | ( | const char * | argv0, |
const char * | filename, | ||
unsigned int | num_peers, | ||
GNUNET_TRANSPORT_TESTING_CheckCallback | check, | ||
void * | check_cls | ||
) |
Setup testcase.
Calls check with the data the test needs.
argv0 | binary name (argv[0]) |
filename | source file name (FILE) |
num_peers | number of peers to start |
check | main function to run |
check_cls | closure for check |
Definition at line 566 of file transport-testing-main2.c.
References filename, GNUNET_free, GNUNET_log_setup(), GNUNET_OK, GNUNET_SYSERR, GNUNET_TRANSPORT_TESTING_done(), GNUNET_TRANSPORT_TESTING_get_config_name(), GNUNET_TRANSPORT_TESTING_get_test_name(), GNUNET_TRANSPORT_TESTING_get_test_plugin_name(), GNUNET_TRANSPORT_TESTING_get_test_source_name(), GNUNET_TRANSPORT_TESTING_init(), num_peers, and ret.