#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_peerstore_service.h"
#include "gnunet_transport_core_service.h"
#include "gnunet_transport_application_service.h"
#include "gnunet_testing_lib.h"
Go to the source code of this file.
Data Structures | |
struct | GNUNET_TRANSPORT_TESTING_PeerContext |
Context for a single peer. More... | |
struct | GNUNET_TRANSPORT_TESTING_ConnectRequest |
Handle for a request to connect two peers. More... | |
struct | GNUNET_TRANSPORT_TESTING_Handle |
Handle for a test run. More... | |
struct | GNUNET_TRANSPORT_TESTING_TestMessage |
struct | GNUNET_TRANSPORT_TESTING_PerformanceTestMessage |
struct | GNUNET_TRANSPORT_TESTING_ConnectCheckContext |
Closure that must be passed to GNUNET_TRANSPORT_TESTING_connect_check. More... | |
struct | GNUNET_TRANSPORT_TESTING_SendClosure |
Type of the closure argument to pass to GNUNET_TRANSPORT_TESTING_simple_send() and GNUNET_TRANSPORT_TESTING_large_send(). More... | |
Macros | |
#define | GNUNET_TRANSPORT_TESTING_main(num_peers, check, check_cls) |
Setup testcase. More... | |
#define | GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE 12345 |
Message type used by GNUNET_TRANSPORT_TESTING_simple_send(). More... | |
#define | GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE2 12346 |
Alternative message type for tests. More... | |
#define | GNUNET_TRANSPORT_TESTING_SIMPLE_PERFORMANCE_MTYPE 12347 |
Message type used by #(). More... | |
#define | GNUNET_TRANSPORT_TESTING_LARGE_MESSAGE_SIZE 2600 |
Size of a message sent with GNUNET_TRANSPORT_TESTING_large_send(). More... | |
Typedefs | |
typedef void(* | GNUNET_TRANSPORT_TESTING_ConnectContextCallback) (void *cls, struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc) |
Function called on matching connect requests. More... | |
typedef void(* | GNUNET_TRANSPORT_TESTING_ConnectContinuation) (void *cls, unsigned int num_peers, struct GNUNET_TRANSPORT_TESTING_PeerContext *p[]) |
Function called once the peers have been launched and connected by GNUNET_TRANSPORT_TESTING_connect_check(). More... | |
typedef void(* | GNUNET_TRANSPORT_TESTING_NotifyConnect) (void *cls, struct GNUNET_TRANSPORT_TESTING_PeerContext *me, const struct GNUNET_PeerIdentity *other) |
Function called to notify transport users that another peer connected to us. More... | |
typedef void(* | GNUNET_TRANSPORT_TESTING_NotifyDisconnect) (void *cls, struct GNUNET_TRANSPORT_TESTING_PeerContext *me, const struct GNUNET_PeerIdentity *other) |
Function called to notify transport users that another peer disconnected from us. More... | |
typedef int(* | GNUNET_TRANSPORT_TESTING_CheckCallback) (void *cls, struct GNUNET_TRANSPORT_TESTING_Handle *tth_, const char *test_plugin_, const char *test_name_, unsigned int num_peers, char *cfg_files[]) |
Main function of a testcase. More... | |
Functions | |
struct GNUNET_TRANSPORT_TESTING_Handle * | GNUNET_TRANSPORT_TESTING_init (void) |
Initialize the transport testing. More... | |
void | GNUNET_TRANSPORT_TESTING_done (struct GNUNET_TRANSPORT_TESTING_Handle *tth) |
Clean up the transport testing. More... | |
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. More... | |
void | GNUNET_TRANSPORT_TESTING_stop_peer (struct GNUNET_TRANSPORT_TESTING_PeerContext *pc) |
Shutdown the given peer. More... | |
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. More... | |
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) |
Connect the given peers and call the callback when both peers report the inbound connection. More... | |
void | GNUNET_TRANSPORT_TESTING_connect_peers_cancel (struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc) |
Cancel the request to connect two peers. More... | |
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. 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... | |
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... | |
int | GNUNET_TRANSPORT_TESTING_send (struct GNUNET_TRANSPORT_TESTING_PeerContext *sender, struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver, uint16_t mtype, uint16_t msize, uint32_t num, GNUNET_SCHEDULER_TaskCallback cont, void *cont_cls) |
Send a test message of type mtype and size msize from peer sender to peer receiver. More... | |
void | GNUNET_TRANSPORT_TESTING_simple_send (void *cls) |
Task that sends a minimalistic test message from the first peer to the second peer. More... | |
void | GNUNET_TRANSPORT_TESTING_large_send (void *cls) |
Task that sends a large test message from the first peer to the second peer. More... | |
void | GNUNET_TRANSPORT_TESTING_log_connect (void *cls, struct GNUNET_TRANSPORT_TESTING_PeerContext *me, const struct GNUNET_PeerIdentity *other) |
Log a connect event. More... | |
void | GNUNET_TRANSPORT_TESTING_log_disconnect (void *cls, struct GNUNET_TRANSPORT_TESTING_PeerContext *me, const struct GNUNET_PeerIdentity *other) |
Log a disconnect event. More... | |
char * | GNUNET_TRANSPORT_TESTING_get_test_name (const char *file) |
Extracts the test filename from an absolute file name and removes the extension. More... | |
char * | GNUNET_TRANSPORT_TESTING_get_config_name (const char *file, int count) |
This function takes the filename (e.g. More... | |
char * | GNUNET_TRANSPORT_TESTING_get_test_plugin_name (const char *executable, const char *testname) |
Extracts the plugin name from an absolute file name and the test name. More... | |
char * | GNUNET_TRANSPORT_TESTING_get_test_source_name (const char *file) |
Extracts the filename from an absolute file name and removes the extension. More... | |
Variables | |
GNUNET_NETWORK_STRUCT_END typedef void(* | GNUNET_TRANSPORT_TESTING_ReceiveCallback )(void *cls, struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver, const struct GNUNET_PeerIdentity *sender, const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) |
Function called by the transport for each received message. More... | |
#define GNUNET_TRANSPORT_TESTING_main | ( | num_peers, | |
check, | |||
check_cls | |||
) |
Setup testcase.
Calls check with the data the test needs.
num_peers | number of peers to start |
check | main function to run |
check_cls | closure for check |
Definition at line 742 of file transport-testing2.h.
#define GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE 12345 |
Message type used by GNUNET_TRANSPORT_TESTING_simple_send().
Definition at line 782 of file transport-testing2.h.
#define GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE2 12346 |
Alternative message type for tests.
Definition at line 787 of file transport-testing2.h.
#define GNUNET_TRANSPORT_TESTING_SIMPLE_PERFORMANCE_MTYPE 12347 |
Message type used by #().
Definition at line 792 of file transport-testing2.h.
#define GNUNET_TRANSPORT_TESTING_LARGE_MESSAGE_SIZE 2600 |
Size of a message sent with GNUNET_TRANSPORT_TESTING_large_send().
Big enough to usually force defragmentation.
Definition at line 847 of file transport-testing2.h.
typedef void(* GNUNET_TRANSPORT_TESTING_ConnectContextCallback) (void *cls, struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc) |
Function called on matching connect requests.
cls | closure |
cc | request matching the query |
Definition at line 369 of file transport-testing2.h.
typedef void(* GNUNET_TRANSPORT_TESTING_ConnectContinuation) (void *cls, unsigned int num_peers, struct GNUNET_TRANSPORT_TESTING_PeerContext *p[]) |
Function called once the peers have been launched and connected by GNUNET_TRANSPORT_TESTING_connect_check().
cls | closure |
num_peers | size of the p array |
p | the peers that were launched |
Definition at line 401 of file transport-testing2.h.
typedef void(* GNUNET_TRANSPORT_TESTING_NotifyConnect) (void *cls, struct GNUNET_TRANSPORT_TESTING_PeerContext *me, const struct GNUNET_PeerIdentity *other) |
Function called to notify transport users that another peer connected to us.
cls | closure |
me | peer experiencing the event |
other | peer that connected to me |
Definition at line 476 of file transport-testing2.h.
typedef void(* GNUNET_TRANSPORT_TESTING_NotifyDisconnect) (void *cls, struct GNUNET_TRANSPORT_TESTING_PeerContext *me, const struct GNUNET_PeerIdentity *other) |
Function called to notify transport users that another peer disconnected from us.
cls | closure |
me | peer experiencing the event |
other | peer that disconnected from me |
Definition at line 490 of file transport-testing2.h.
typedef int(* GNUNET_TRANSPORT_TESTING_CheckCallback) (void *cls, struct GNUNET_TRANSPORT_TESTING_Handle *tth_, const char *test_plugin_, const char *test_name_, unsigned int num_peers, char *cfg_files[]) |
Main function of a testcase.
Called with the initial setup data for the test as derived from the source name and the binary name.
cls | closure |
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 707 of file transport-testing2.h.
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_().
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_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().
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().
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.
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 | ||
) |
Connect the given peers and call the callback when both peers report the inbound connection.
Remarks: start_peer's notify_connect callback can be called before.
p1 | peer 1 |
p2 | peer 2 |
cb | the callback to call when both peers notified that they are connected |
cls | callback cls |
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_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().
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.
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.
int GNUNET_TRANSPORT_TESTING_send | ( | struct GNUNET_TRANSPORT_TESTING_PeerContext * | sender, |
struct GNUNET_TRANSPORT_TESTING_PeerContext * | receiver, | ||
uint16_t | mtype, | ||
uint16_t | msize, | ||
uint32_t | num, | ||
GNUNET_SCHEDULER_TaskCallback | cont, | ||
void * | cont_cls | ||
) |
Send a test message of type mtype and size msize from peer sender to peer receiver.
The peers should be connected when this function is called.
sender | the sending peer |
receiver | the receiving peer |
mtype | message type to use |
msize | size of the message, at least sizeof (struct GNUNET_TRANSPORT_TESTING_TestMessage) |
num | unique message number |
cont | continuation to call after transmission |
cont_cls | closure for cont |
Definition at line 67 of file transport-testing-send2.c.
References env, find_cr(), GNUNET_break, GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_MQ_msg_extra, GNUNET_MQ_notify_sent(), GNUNET_MQ_send(), GNUNET_NO, GNUNET_OK, GNUNET_strdup, GNUNET_SYSERR, GNUNET_TRANSPORT_TESTING_find_connecting_context(), GNUNET_TRANSPORT_TESTING_PeerContext::id, GNUNET_TRANSPORT_TESTING_ConnectRequest::mq, GNUNET_TRANSPORT_TESTING_PeerContext::no, GNUNET_TRANSPORT_TESTING_TestMessage::num, and receiver().
Referenced by do_send().
void GNUNET_TRANSPORT_TESTING_simple_send | ( | void * | cls | ) |
Task that sends a minimalistic test message from the first peer to the second peer.
cls | the struct GNUNET_TRANSPORT_TESTING_SendClosure which should contain at least two peers, the first two of which should be currently connected |
cls | the struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext which should contain at least two peers, the first two of which should be currently connected |
Definition at line 178 of file transport-testing-send2.c.
References do_send(), GNUNET_TRANSPORT_TESTING_simple_send(), and sc.
Referenced by GNUNET_TRANSPORT_TESTING_simple_send().
void GNUNET_TRANSPORT_TESTING_large_send | ( | void * | cls | ) |
Task that sends a large test message from the first peer to the second peer.
cls | the struct GNUNET_TRANSPORT_TESTING_SendClosure which should contain at least two peers, the first two of which should be currently connected |
cls | the struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext which should contain at least two peers, the first two of which should be currently connected |
Definition at line 214 of file transport-testing-send2.c.
References do_send(), GNUNET_TRANSPORT_TESTING_large_send(), and sc.
Referenced by GNUNET_TRANSPORT_TESTING_large_send().
void GNUNET_TRANSPORT_TESTING_log_connect | ( | void * | cls, |
struct GNUNET_TRANSPORT_TESTING_PeerContext * | me, | ||
const struct GNUNET_PeerIdentity * | other | ||
) |
Log a connect event.
cls | NULL |
me | peer that had the event |
other | peer that connected. |
Definition at line 37 of file transport-testing-loggers2.c.
References GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_strdup, me, and ps.
void GNUNET_TRANSPORT_TESTING_log_disconnect | ( | void * | cls, |
struct GNUNET_TRANSPORT_TESTING_PeerContext * | me, | ||
const struct GNUNET_PeerIdentity * | other | ||
) |
Log a disconnect event.
cls | NULL |
me | peer that had the event |
other | peer that disconnected. |
Definition at line 62 of file transport-testing-loggers2.c.
References GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_strdup, me, and ps.
char * GNUNET_TRANSPORT_TESTING_get_test_name | ( | const char * | file | ) |
Extracts the test filename from an absolute file name and removes the extension.
file | absolute file name |
file | absolute file name |
Definition at line 73 of file transport-testing-filenames2.c.
References extract_filename(), filename, GNUNET_free, GNUNET_strdup, and ret.
Referenced by GNUNET_TRANSPORT_TESTING_main_().
char * GNUNET_TRANSPORT_TESTING_get_config_name | ( | const char * | file, |
int | count | ||
) |
This function takes the filename (e.g.
argv[0), removes a "lt-"-prefix and if existing ".exe"-prefix and adds the peer-number
file | filename of the test, e.g. argv[0] |
count | peer number |
argv[0), removes a "lt-"-prefix and if existing ".exe"-prefix and adds the peer-number
file | filename of the test, e.g. argv[0] |
count | peer number |
Definition at line 174 of file transport-testing-filenames2.c.
References extract_filename(), filename, GNUNET_asprintf(), GNUNET_free, and ret.
Referenced by GNUNET_TRANSPORT_TESTING_main_().
char * GNUNET_TRANSPORT_TESTING_get_test_plugin_name | ( | const char * | file, |
const char * | test | ||
) |
Extracts the plugin name from an absolute file name and the test name.
file | absolute file name |
test | test name |
file | absolute file name |
test | test name |
Definition at line 127 of file transport-testing-filenames2.c.
References extract_filename(), filename, GNUNET_free, GNUNET_strdup, ret, and t.
Referenced by GNUNET_TRANSPORT_TESTING_main_().
char * GNUNET_TRANSPORT_TESTING_get_test_source_name | ( | const char * | file | ) |
Extracts the filename from an absolute file name and removes the extension.
file | absolute file name |
file | absolute file name |
Definition at line 107 of file transport-testing-filenames2.c.
References extract_filename().
Referenced by GNUNET_TRANSPORT_TESTING_main_().
GNUNET_NETWORK_STRUCT_END typedef void(* GNUNET_TRANSPORT_TESTING_ReceiveCallback) (void *cls, struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver, const struct GNUNET_PeerIdentity *sender, const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) | ( | void * | cls, |
struct GNUNET_TRANSPORT_TESTING_PeerContext * | receiver, | ||
const struct GNUNET_PeerIdentity * | sender, | ||
const struct GNUNET_TRANSPORT_TESTING_TestMessage * | message | ||
) |
Function called by the transport for each received message.
cls | closure |
receiver | receiver of the message |
sender | sender of the message |
message | the message |
Definition at line 461 of file transport-testing2.h.