2 #include "gnunet_util_lib.h"
3 #include "gnunet_dht_service.h"
4 #include "gnunet_mesh_service_new.h"
6 static struct GNUNET_MESH_MessageHandler handlers[] = {
14 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) {
15 struct GNUNET_OS_Process *arm_pid;
16 struct GNUNET_MESH_Handle *mesh;
17 struct GNUNET_DHT_Handle *dht;
18 GNUNET_MESH_ApplicationType app;
22 arm_pid = GNUNET_OS_start_process (NULL, NULL,
26 "-c", "test_mesh.conf",
28 dht = GNUNET_DHT_connect(cfg, 100);
30 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Couldn't connect to dht :(\n");
32 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "YAY! CONNECTED TO DHT :D\n");
36 mesh = GNUNET_MESH_connect(cfg, NULL, NULL, handlers, &app);
38 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Couldn't connect to mesh :(\n");
40 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "YAY! CONNECTED TO MESH :D\n");
43 /* do real test work here */
44 if (0 != GNUNET_OS_process_kill (arm_pid, SIGTERM))
45 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
46 GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (arm_pid));
47 GNUNET_OS_process_close (arm_pid);
54 int main (int argc, char *argv[]) {
56 char *const argv2[] = {"test-mesh-api",
57 "-c", "test_mesh.conf",
61 struct GNUNET_GETOPT_CommandLineOption options[] = {
62 GNUNET_GETOPT_OPTION_END
64 GNUNET_log_setup ("test-dht-api","DEBUG", NULL);
65 ret = GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1,
66 argv2, "test-mesh-api", "nohelp",
68 if (ret != GNUNET_OK) {
69 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "test-mesh-api': Failed with error code %d\n", ret);