120 "Failed to connect to DHT service: %s\n",
125 for (
unsigned int i = 0; i <
ctx->num_peers; i++)
126 if (
op ==
ctx->ops[i])
127 ctx->dhts[i] = ca_result;
128 for (
unsigned int i = 0; i <
ctx->num_peers; i++)
129 if (NULL ==
ctx->dhts[i])
133 ctx->app_main (
ctx->app_main_cls,
144 for (
unsigned int i = 0; i <
ctx->num_peers; i++)
158 unsigned int links_succeeded,
159 unsigned int links_failed)
165 for (
unsigned int i = 0; i <
num_peers; i++)
193 ctx->app_main_cls = tmain_cls;
static void * dht_connect_adapter(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
Adapter function called to establish a connection to the DHT service.
static void dht_test_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)
static void dht_disconnect_adapter(void *cls, void *op_result)
Adapter function called to destroy a connection to the DHT service.
void GNUNET_DHT_TEST_cleanup(struct GNUNET_DHT_TEST_Context *ctx)
Clean up the testbed.
static void dht_connect_cb(void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, const char *emsg)
Callback to be called when a service connect operation is completed.
void GNUNET_DHT_TEST_run(const char *testname, const char *cfgname, unsigned int num_peers, GNUNET_DHT_TEST_AppMain tmain, void *tmain_cls)
Run a test using the given name, configuration file and number of peers.
library for writing DHT tests
void(* GNUNET_DHT_TEST_AppMain)(void *cls, struct GNUNET_DHT_TEST_Context *ctx, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, struct GNUNET_DHT_Handle **dhts)
Main function of a DHT test.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
static struct GNUNET_ARM_Operation * op
Current operation.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
static void tmain(void *cls, struct GNUNET_CADET_TEST_Context *ctx, unsigned int num_peers, struct GNUNET_TESTBED_Peer **testbed_peers, struct GNUNET_CADET_Handle **cadetes)
test main: start test when all peers are connected
static struct CadetPeer * peers
Operation to get peer ids.
static unsigned int num_peers
static struct GNUNET_DHT_Handle * dht
Handle to the DHT.
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
struct GNUNET_DHT_Handle * GNUNET_DHT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, unsigned int ht_len)
Initialize the connection with the DHT service.
void GNUNET_DHT_disconnect(struct GNUNET_DHT_Handle *handle)
Shutdown connection with the DHT service.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_new_array(n, type)
Allocate a size n array with structs or unions of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
void GNUNET_TESTBED_operation_done(struct GNUNET_TESTBED_Operation *operation)
This function is used to signal that the event information (struct GNUNET_TESTBED_EventInformation) f...
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'.
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.
static int op_result(struct GNUNET_OP_Handle *h, uint64_t op_id, int64_t result_code, const void *data, uint16_t data_size, void **ctx, uint8_t cancel)
Remove an operation, and call its result callback (unless it was cancelled).
Connection to the DHT service.
Test context for a DHT Test.
struct GNUNET_TESTBED_Operation ** ops
Operation associated with the connection to the DHT.
GNUNET_DHT_TEST_AppMain app_main
Main function of the test to run once all DHTs are available.
struct GNUNET_DHT_Handle ** dhts
Array of handles to the DHT for each peer.
void * app_main_cls
Closure for 'app_main'.
unsigned int num_peers
Number of peers running, size of the arrays above.
struct GNUNET_TESTBED_Peer ** peers
Array of running peers.
Opaque handle to an abstract operation to be executed by the testing framework.
A peer controlled by the testing framework.