Go to the source code of this file.
Macros | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "transport-testing", __VA_ARGS__) |
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "transport-testing", __VA_ARGS__) |
Definition at line 30 of file transport-testing2.c.
|
static |
Definition at line 34 of file transport-testing2.c.
References GNUNET_SCHEDULER_Task::next, GNUNET_TRANSPORT_TESTING_Handle::p_head, GNUNET_TRANSPORT_TESTING_PeerContext::peer, t, and GNUNET_TRANSPORT_TESTING_PeerContext::tth.
Referenced by notify_connect(), and notify_disconnect().
void GNUNET_TRANSPORT_TESTING_find_connecting_context | ( | struct GNUNET_TRANSPORT_TESTING_PeerContext * | p1, |
struct GNUNET_TRANSPORT_TESTING_PeerContext * | p2, | ||
GNUNET_TRANSPORT_TESTING_ConnectContextCallback | cb, | ||
void * | cb_cls | ||
) |
Find any connecting context matching the given pair of peers.
p1 | first peer |
p2 | second peer |
cb | function to call |
cb_cls | closure for cb |
Definition at line 57 of file transport-testing2.c.
References GNUNET_TRANSPORT_TESTING_ConnectRequest::cb, GNUNET_TRANSPORT_TESTING_ConnectRequest::cb_cls, GNUNET_TRANSPORT_TESTING_Handle::cc_head, GNUNET_TRANSPORT_TESTING_ConnectRequest::next, GNUNET_TRANSPORT_TESTING_ConnectRequest::p1, GNUNET_TRANSPORT_TESTING_ConnectRequest::p2, and GNUNET_TRANSPORT_TESTING_PeerContext::tth.
Referenced by GNUNET_TRANSPORT_TESTING_send(), notify_connect(), and notify_disconnect().
|
static |
Definition at line 83 of file transport-testing2.c.
References GNUNET_YES, and GNUNET_TRANSPORT_TESTING_ConnectRequest::p1_c.
Referenced by notify_connect().
|
static |
Definition at line 95 of file transport-testing2.c.
References mq, and GNUNET_TRANSPORT_TESTING_ConnectRequest::mq.
Referenced by notify_connect(), and notify_disconnect().
|
static |
Definition at line 105 of file transport-testing2.c.
References GNUNET_YES, and GNUNET_TRANSPORT_TESTING_ConnectRequest::p2_c.
Referenced by notify_connect().
|
static |
Definition at line 117 of file transport-testing2.c.
References GNUNET_NO, GNUNET_YES, and GNUNET_TRANSPORT_TESTING_ConnectRequest::p1_c.
Referenced by notify_disconnect().
|
static |
Definition at line 129 of file transport-testing2.c.
References GNUNET_NO, GNUNET_YES, and GNUNET_TRANSPORT_TESTING_ConnectRequest::p2_c.
Referenced by notify_disconnect().
|
static |
Definition at line 141 of file transport-testing2.c.
References GNUNET_TRANSPORT_TESTING_ConnectRequest::ah_sh, GNUNET_TRANSPORT_TESTING_ConnectRequest::cb, GNUNET_TRANSPORT_TESTING_ConnectRequest::cb_cls, GNUNET_TRANSPORT_TESTING_Handle::cc_head, GNUNET_TRANSPORT_TESTING_Handle::cc_tail, GNUNET_TRANSPORT_TESTING_ConnectRequest::connected, find_peer_context(), GNUNET_asprintf(), GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_i2s(), GNUNET_new, GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_TRANSPORT_application_suggest_cancel(), GNUNET_TRANSPORT_TESTING_find_connecting_context(), GNUNET_YES, GNUNET_TRANSPORT_TESTING_PeerContext::id, LOG, mq, GNUNET_TRANSPORT_TESTING_ConnectRequest::next, GNUNET_TRANSPORT_TESTING_PeerContext::no, p, GNUNET_TRANSPORT_TESTING_ConnectRequest::p1, GNUNET_TRANSPORT_TESTING_ConnectRequest::p1_c, GNUNET_TRANSPORT_TESTING_ConnectRequest::p2, GNUNET_TRANSPORT_TESTING_ConnectRequest::p2_c, ret, set_mq(), set_p1c(), set_p2c(), and GNUNET_TRANSPORT_TESTING_ConnectRequest::tct.
Referenced by GNUNET_TRANSPORT_TESTING_restart_peer(), and GNUNET_TRANSPORT_TESTING_start_peer().
|
static |
Definition at line 251 of file transport-testing2.c.
References GNUNET_TRANSPORT_TESTING_PeerContext::ah, GNUNET_TRANSPORT_TESTING_ConnectRequest::ah_sh, GNUNET_TRANSPORT_TESTING_Handle::cc_head, clear_p1c(), clear_p2c(), GNUNET_TRANSPORT_TESTING_ConnectRequest::connected, find_peer_context(), GNUNET_asprintf(), GNUNET_BANDWIDTH_ZERO, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_i2s(), GNUNET_MQ_PRIO_BEST_EFFORT, GNUNET_NO, GNUNET_TRANSPORT_application_suggest(), GNUNET_TRANSPORT_TESTING_find_connecting_context(), GNUNET_YES, GNUNET_TRANSPORT_TESTING_PeerContext::id, LOG, GNUNET_TRANSPORT_TESTING_ConnectRequest::next, GNUNET_TRANSPORT_TESTING_PeerContext::no, p, GNUNET_TRANSPORT_TESTING_ConnectRequest::p1, GNUNET_TRANSPORT_TESTING_ConnectRequest::p1_c, GNUNET_TRANSPORT_TESTING_ConnectRequest::p2, GNUNET_TRANSPORT_TESTING_ConnectRequest::p2_c, and set_mq().
Referenced by GNUNET_TRANSPORT_TESTING_restart_peer(), and GNUNET_TRANSPORT_TESTING_start_peer().
|
static |
Definition at line 359 of file transport-testing2.c.
References GNUNET_PEERSTORE_iteration_start(), GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY, hello_iter_cb(), and p.
Referenced by GNUNET_TRANSPORT_TESTING_start_peer(), and hello_iter_cb().
|
static |
Definition at line 326 of file transport-testing2.c.
References GNUNET_TRANSPORT_TESTING_PeerContext::cb_cls, GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_malloc, GNUNET_PEERSTORE_iteration_stop(), GNUNET_SCHEDULER_add_now(), LOG, p, record(), and retrieve_hello().
Referenced by GNUNET_TRANSPORT_TESTING_restart_peer(), and retrieve_hello().
struct GNUNET_TRANSPORT_TESTING_PeerContext * GNUNET_TRANSPORT_TESTING_start_peer | ( | struct GNUNET_TRANSPORT_TESTING_Handle * | tth, |
const char * | cfgname, | ||
int | peer_id, | ||
const struct GNUNET_MQ_MessageHandler * | handlers, | ||
GNUNET_TRANSPORT_NotifyConnect | nc, | ||
GNUNET_TRANSPORT_NotifyDisconnect | nd, | ||
void * | cb_cls, | ||
GNUNET_SCHEDULER_TaskCallback | start_cb, | ||
void * | start_cb_cls | ||
) |
Start a peer with the given configuration.
tth | the testing handle |
cfgname | configuration file |
peer_id | an identification number for the peer |
handlers | functions for receiving messages |
nc | connect callback |
nd | disconnect callback |
cb_cls | closure for nc and nd callback |
start_cb | start callback |
start_cb_cls | closure for start_cb |
Definition at line 374 of file transport-testing2.c.
References dummy, GNUNET_assert, GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_destroy(), GNUNET_CONFIGURATION_load(), GNUNET_CONTAINER_DLL_insert, GNUNET_DISK_file_test(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_i2s_full(), GNUNET_memcpy, GNUNET_new, GNUNET_new_array, GNUNET_NO, GNUNET_OK, GNUNET_PEERSTORE_connect(), GNUNET_SCHEDULER_add_now(), GNUNET_SYSERR, GNUNET_TRANSPORT_application_init(), GNUNET_TRANSPORT_core_connect(), GNUNET_TRANSPORT_TESTING_stop_peer(), handlers, LOG, nc, notify_connect(), notify_disconnect(), p, GNUNET_TRANSPORT_TESTING_Handle::p_head, GNUNET_TRANSPORT_TESTING_Handle::p_tail, peer_id, retrieve_hello(), start_cb(), and GNUNET_TRANSPORT_TESTING_Handle::tl_system.
Referenced by connect_check_run().
int GNUNET_TRANSPORT_TESTING_restart_peer | ( | struct GNUNET_TRANSPORT_TESTING_PeerContext * | p, |
GNUNET_SCHEDULER_TaskCallback | restart_cb, | ||
void * | restart_cb_cls | ||
) |
Stops and restarts the given peer, sleeping (!) for 5s in between.
p | the peer |
restart_cb | restart callback |
restart_cb_cls | callback closure |
Definition at line 524 of file transport-testing2.c.
References GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_i2s(), GNUNET_OK, GNUNET_PEERSTORE_iteration_start(), GNUNET_PEERSTORE_iteration_stop(), GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY, GNUNET_SYSERR, GNUNET_TRANSPORT_application_done(), GNUNET_TRANSPORT_application_init(), GNUNET_TRANSPORT_core_connect(), GNUNET_TRANSPORT_core_disconnect(), GNUNET_TRANSPORT_TESTING_connect_peers_cancel(), hello_iter_cb(), LOG, GNUNET_TRANSPORT_TESTING_ConnectRequest::next, notify_connect(), notify_disconnect(), p, GNUNET_TRANSPORT_TESTING_ConnectRequest::p1, and GNUNET_TRANSPORT_TESTING_ConnectRequest::p2.
void GNUNET_TRANSPORT_TESTING_stop_peer | ( | struct GNUNET_TRANSPORT_TESTING_PeerContext * | p | ) |
Shutdown the given peer.
p | the peer |
Definition at line 614 of file transport-testing2.c.
References GNUNET_TRANSPORT_TESTING_Handle::cc_head, GNUNET_CONFIGURATION_destroy(), GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_OK, GNUNET_PEERSTORE_disconnect(), GNUNET_PEERSTORE_iteration_stop(), GNUNET_SCHEDULER_cancel(), GNUNET_TRANSPORT_application_done(), GNUNET_TRANSPORT_core_disconnect(), GNUNET_TRANSPORT_TESTING_connect_peers_cancel(), LOG, GNUNET_TRANSPORT_TESTING_ConnectRequest::next, p, GNUNET_TRANSPORT_TESTING_ConnectRequest::p1, GNUNET_TRANSPORT_TESTING_ConnectRequest::p2, GNUNET_TRANSPORT_TESTING_Handle::p_head, and GNUNET_TRANSPORT_TESTING_Handle::p_tail.
Referenced by do_shutdown(), GNUNET_TRANSPORT_TESTING_done(), and GNUNET_TRANSPORT_TESTING_start_peer().
struct GNUNET_TRANSPORT_TESTING_ConnectRequest * GNUNET_TRANSPORT_TESTING_connect_peers | ( | struct GNUNET_TRANSPORT_TESTING_PeerContext * | p1, |
struct GNUNET_TRANSPORT_TESTING_PeerContext * | p2, | ||
GNUNET_SCHEDULER_TaskCallback | cb, | ||
void * | cls | ||
) |
Function called after the HELLO was passed to the transport service.
Connect the given peers and call the callback when both peers report the inbound connection.
FIXME maybe schedule the application_validate somehow Initiate a connection from p1 to p2 by offering p1 p2's HELLO message
Remarks: start_peer's notify_connect callback can be called before.
tth | transport testing handle |
p1 | peer 1 |
p2 | peer 2 |
cb | the callback to call when both peers notified that they are connected |
cls | callback cls |
Definition at line 729 of file transport-testing2.c.
References GNUNET_TRANSPORT_TESTING_PeerContext::ah, GNUNET_TRANSPORT_TESTING_ConnectRequest::ah_sh, GNUNET_TRANSPORT_TESTING_ConnectRequest::cb, GNUNET_TRANSPORT_TESTING_ConnectRequest::cb_cls, GNUNET_TRANSPORT_TESTING_Handle::cc_head, GNUNET_TRANSPORT_TESTING_Handle::cc_tail, GNUNET_TRANSPORT_TESTING_ConnectRequest::connected, GNUNET_BANDWIDTH_ZERO, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MQ_PRIO_BEST_EFFORT, GNUNET_new, GNUNET_TRANSPORT_application_suggest(), GNUNET_TRANSPORT_TESTING_PeerContext::id, LOG, GNUNET_TRANSPORT_TESTING_ConnectRequest::next, GNUNET_TRANSPORT_TESTING_ConnectRequest::p1, GNUNET_TRANSPORT_TESTING_ConnectRequest::p1_c, GNUNET_TRANSPORT_TESTING_ConnectRequest::p2, GNUNET_TRANSPORT_TESTING_ConnectRequest::p2_c, and GNUNET_TRANSPORT_TESTING_PeerContext::tth.
Referenced by do_connect().
void GNUNET_TRANSPORT_TESTING_connect_peers_cancel | ( | struct GNUNET_TRANSPORT_TESTING_ConnectRequest * | cc | ) |
Cancel the request to connect two peers.
You MUST cancel the request if you stop the peers before the peers connected successfully.
cc | a connect request handle |
Definition at line 780 of file transport-testing2.c.
References GNUNET_TRANSPORT_TESTING_ConnectRequest::ah_sh, GNUNET_TRANSPORT_TESTING_Handle::cc_head, GNUNET_TRANSPORT_TESTING_Handle::cc_tail, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_SCHEDULER_cancel(), GNUNET_TRANSPORT_application_suggest_cancel(), LOG, GNUNET_TRANSPORT_TESTING_ConnectRequest::p1, GNUNET_TRANSPORT_TESTING_ConnectRequest::tct, and GNUNET_TRANSPORT_TESTING_PeerContext::tth.
Referenced by do_shutdown(), GNUNET_TRANSPORT_TESTING_done(), GNUNET_TRANSPORT_TESTING_restart_peer(), and GNUNET_TRANSPORT_TESTING_stop_peer().
void GNUNET_TRANSPORT_TESTING_done | ( | struct GNUNET_TRANSPORT_TESTING_Handle * | tth | ) |
Clean up the transport testing.
tth | transport testing handle |
Definition at line 811 of file transport-testing2.c.
References GNUNET_TRANSPORT_TESTING_Handle::cc_head, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_TRANSPORT_TESTING_connect_peers_cancel(), GNUNET_TRANSPORT_TESTING_stop_peer(), GNUNET_YES, LOG, GNUNET_TRANSPORT_TESTING_ConnectRequest::next, p, GNUNET_TRANSPORT_TESTING_Handle::p_head, t, GNUNET_TRANSPORT_TESTING_Handle::tl_system, and GNUNET_TRANSPORT_TESTING_PeerContext::tth.
Referenced by GNUNET_TRANSPORT_TESTING_main_().
struct GNUNET_TRANSPORT_TESTING_Handle * GNUNET_TRANSPORT_TESTING_init | ( | void | ) |
Initialize the transport testing.
Definition at line 851 of file transport-testing2.c.
References GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_new, and GNUNET_TRANSPORT_TESTING_Handle::tl_system.
Referenced by GNUNET_TRANSPORT_TESTING_main_().