#include "platform.h"
#include "gnunet_util_lib.h"
#include "mesh_test_lib.h"
-#include "gnunet_mesh_service_enc.h"
+#include "gnunet_mesh_service.h"
/**
* Test context for a MESH Test.
* Main function of the test to run once all MESHs are available.
*/
GNUNET_MESH_TEST_AppMain app_main;
-
+
/**
* Closure for 'app_main'.
*/
* @param cls closure
* @param op_result service handle returned from the connect adapter
*/
-static void
+static void
mesh_disconnect_adapter (void *cls,
void *op_result)
{
*
* @param cls The callback closure from functions generating an operation.
* @param op The operation that has been finished.
- * @param ca_result The service handle returned from
+ * @param ca_result The service handle returned from
* GNUNET_TESTBED_ConnectAdapter() (mesh handle).
* @param emsg Error message in case the operation has failed.
* NULL if operation has executed successfully.
*/
-static void
+static void
mesh_connect_cb (void *cls,
struct GNUNET_TESTBED_Operation *op,
void *ca_result,
{
struct GNUNET_MESH_TEST_Context *ctx = cls;
unsigned int i;
-
+
if (NULL != emsg)
{
fprintf (stderr, "Failed to connect to MESH service: %s\n",
/**
* Callback run when the testbed is ready (peers running and connected to
* each other)
- *
+ *
* @param cls Closure (context).
+ * @param h the run handle
* @param num_peers Number of peers that are running.
* @param peers Handles to each one of the @c num_peers peers.
* @param links_succeeded the number of overlay link connection attempts that
*/
static void
mesh_test_run (void *cls,
+ struct GNUNET_TESTBED_RunHandle *h,
unsigned int num_peers,
struct GNUNET_TESTBED_Peer **peers,
unsigned int links_succeeded,
for (i = 0; i < num_peers; i++)
{
struct GNUNET_MESH_TEST_AdapterContext *newctx;
- newctx = GNUNET_malloc (sizeof (struct GNUNET_MESH_TEST_AdapterContext));
+ newctx = GNUNET_new (struct GNUNET_MESH_TEST_AdapterContext);
newctx->peer = i;
newctx->ctx = ctx;
ctx->ops[i] = GNUNET_TESTBED_service_connect (ctx,
}
-void
+void
GNUNET_MESH_TEST_run (const char *testname,
const char *cfgname,
unsigned int num_peers,
{
struct GNUNET_MESH_TEST_Context *ctx;
- ctx = GNUNET_malloc (sizeof (struct GNUNET_MESH_TEST_Context));
+ ctx = GNUNET_new (struct GNUNET_MESH_TEST_Context);
ctx->num_peers = num_peers;
ctx->ops = GNUNET_malloc (num_peers * sizeof (struct GNUNET_TESTBED_Operation *));
ctx->meshes = GNUNET_malloc (num_peers * sizeof (struct GNUNET_MESH_Handle *));