int
main (int argcx,
      char *argvx[])
{
  static char *const argv[] = {
    "test-gnunet-daemon-hostlist",
    "-c", "test_gnunet_daemon_hostlist_data.conf",
    NULL
  };
  static struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };

  GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-1");
  GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-2");
  GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-3");
  GNUNET_log_setup ("test-gnunet-daemon-hostlist",
                    "WARNING",
                    NULL);
  ok = 1;
  GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
		      argv,
                      "test-gnunet-daemon-hostlist",
		      "nohelp",
		      options,
		      &run,
                      &ok);
  if (0 == ok)
  {
    FPRINTF (stderr, "%s",  ".");
    /* now do it again */
    ok = 1;
    GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
			argv,
			"test-gnunet-daemon-hostlist",
			"nohelp",
			options,
			&run,
			&ok);
    FPRINTF (stderr,
	     "%s",
	     ".\n");
  }
  GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-1");
  GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-2");
  GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-3");
  return ok;
}
int
main (int argc, char *argv0[])
{
  ok = 1;

  GNUNET_TRANSPORT_TESTING_get_test_name (argv0[0], &test_name);

  GNUNET_log_setup ("test-transport-api-blacklisting",
                    "WARNING",
                    NULL);

  static char *const argv[] = { "date",
    "-c",
    "test_transport_api_data.conf",
    NULL
  };
  static struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };

  tth = GNUNET_TRANSPORT_TESTING_init ();

  GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
  										"test-transport-api-blacklisting",
                      "nohelp", options, &run, NULL);


  GNUNET_TRANSPORT_TESTING_done (tth);

  return ok;
}
static int
check ()
{
  int ret;

  char *const argv[] = { "test-testing-topology-churn",
    "-c",
    "test_testing_data_topology_churn.conf",
    NULL
  };
  struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };
  ret =
      GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
                          "test-testing-topology-churn", "nohelp", options,
                          &run, &ok);
  if (ret != GNUNET_OK)
  {
    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                "`test-testing-topology-churn': Failed with error code %d\n",
                ret);
  }

  return ok;
}
Esempio n. 4
0
/**
 * The main function to obtain peer information.
 *
 * @param argc number of arguments from the command line
 * @param argv command line arguments
 * @return 0 ok, 1 on error
 */
int
main (int argc, char *const *argv)
{
  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
    {'n', "numeric", NULL,
     gettext_noop ("don't resolve host names"),
     0, &GNUNET_GETOPT_set_one, &no_resolve},
    {'q', "quiet", NULL,
     gettext_noop ("output only the identity strings"),
     0, &GNUNET_GETOPT_set_one, &be_quiet},
    {'s', "self", NULL,
     gettext_noop ("output our own identity only"),
     0, &GNUNET_GETOPT_set_one, &get_self},
    {'i', "info", NULL,
     gettext_noop ("list all known peers"),
     0, &GNUNET_GETOPT_set_one, &get_info},
    {'g', "get-hello", NULL,
     gettext_noop ("also output HELLO uri(s)"),
     0, &GNUNET_GETOPT_set_one, &get_uri},
    {'p', "put-hello", "HELLO",
     gettext_noop ("add given HELLO uri to the database"),
     1, &GNUNET_GETOPT_set_string, &put_uri},
    GNUNET_GETOPT_OPTION_END
  };
  return (GNUNET_OK ==
          GNUNET_PROGRAM_run (argc, argv, "gnunet-peerinfo",
                              gettext_noop ("Print information about peers."),
                              options, &run, NULL)) ? 0 : 1;
}
Esempio n. 5
0
int
main (int argc, char *argv[])
{
  char cfg_name[128];
  char *const xargv[] = {
    "test-plugin-namestore",
    "-c",
    cfg_name,
    NULL
  };
  struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };

  //GNUNET_DISK_directory_remove ("/tmp/gnunet-test-plugin-namestore-sqlite");
  GNUNET_log_setup ("test-plugin-namestore",
                    "WARNING",
                    NULL);
  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
  GNUNET_snprintf (cfg_name, sizeof (cfg_name), "test_plugin_namestore_%s.conf",
                   plugin_name);
  GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,
                      "test-plugin-namestore", "nohelp", options, &run, NULL);
  if (ok != 0)
    FPRINTF (stderr, "Missed some testcases: %d\n", ok);
  //GNUNET_DISK_directory_remove ("/tmp/gnunet-test-plugin-namestore-sqlite");
  return ok;
}
/**
 * Main: start test
 */
int
main (int argc, char *argv[])
{
  char *const argv2[] = {
    argv[0],
    "-c",
    "test_testing_2dtorus.conf",
#if VERBOSE
    "-L",
    "DEBUG",
#endif
    NULL
  };

  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Start\n");


  GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
                      "test_testing_2dtorus",
                      gettext_noop ("Test testing 2d torus."), options, &run,
                      NULL);
#if REMOVE_DIR
  GNUNET_DISK_directory_remove ("/tmp/test_testing_2dtorus");
#endif
  if (GNUNET_OK != ok)
  {
    GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: FAILED!\n");
    return 1;
  }
  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: success\n");
  return 0;
}
/**
 * Main function
 */
int
main (int argc, char **argv)
{
  int ret;
  char *const argv2[] =
      { "test_testbed_api_operations", "-c", "test_testbed_api.conf", NULL };
  struct GNUNET_GETOPT_CommandLineOption options[] =
      { GNUNET_GETOPT_OPTION_END };

  ret =
      GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
                          "test_testbed_api_operations", "nohelp", options,
                          &run, NULL);
  if ((GNUNET_OK != ret) || (TEST_OP9_RELEASED != result))
    return 1;
  op1 = NULL;
  op2 = NULL;
  op3 = NULL;
  op4 = NULL;
  op5 = NULL;
  op6 = NULL;
  op7 = NULL;
  op8 = NULL;
  op9 = NULL;
  q1 = NULL;
  q2 = NULL;
  return 0;
}
Esempio n. 8
0
int
main (int argc, char *argv[])
{
  char cfg_name[128];
  char *const xargv[] = {
    "perf-datacache",
    "-c",
    cfg_name,
    NULL
  };
  struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };

  GNUNET_log_setup ("perf-datacache",
                    "WARNING",
                    NULL);
  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
  GNUNET_snprintf (cfg_name, sizeof (cfg_name), "perf_datacache_data_%s.conf",
                   plugin_name);
  GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,
                      "perf-datacache", "nohelp", options, &run, NULL);
  if ( (0 != ok) && (77 != ok) )
    FPRINTF (stderr, "Missed some perfcases: %d\n", ok);
  return ok;
}
Esempio n. 9
0
int
main (int argc,
      char *argv1[])
{
  char *const argv[] = {
    "test-core-api",
    "-c",
    "test_core_api_data.conf",
    NULL
  };
  struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };
  ok = 1;
  GNUNET_log_setup ("test-core-api",
                    "WARNING",
                    NULL);
  GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
		      argv,
                      "test-core-api",
		      "nohelp",
		      options,
		      &run,
		      &ok);
  stop_arm (&p1);
  stop_arm (&p2);
  GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-1");
  GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-2");

  return ok;
}
Esempio n. 10
0
/**
 * The main function to obtain peer information.
 *
 * @param argc number of arguments from the command line
 * @param argv command line arguments
 * @return 0 ok, 1 on error
 */
int
main (int argc, char *const *argv)
{
  int res;
  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
    {'m', "monitor", NULL,
     gettext_noop ("provide information about all tunnels (continuously) NOT IMPLEMENTED"), /* FIXME */
     GNUNET_NO, &GNUNET_GETOPT_set_one, &monitor_connections},
    {'t', "tunnel", "OWNER_ID:TUNNEL_ID",
     gettext_noop ("provide information about a particular tunnel"),
     GNUNET_YES, &GNUNET_GETOPT_set_string, &tunnel_id},
    GNUNET_GETOPT_OPTION_END
  };

  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
    return 2;

  res = GNUNET_PROGRAM_run (argc, argv, "gnunet-mesh",
                      gettext_noop
                      ("Print information about mesh tunnels and peers."),
                      options, &run, NULL);

  GNUNET_free ((void *) argv);

  if (GNUNET_OK == res)
    return 0;
  else
    return 1;
}
Esempio n. 11
0
static int
check ()
{
  char *const argv[] = { "test-sensor-api", NULL };
  struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };
  struct GNUNET_OS_Process *proc;
  char *path = GNUNET_OS_get_libexec_binary_path ("gnunet-service-sensor");

  if (NULL == path)
  {
    fprintf (stderr, "Service executable not found `%s'\n",
             "gnunet-service-sensor");
    return -1;
  }

  proc =
      GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL, NULL,
                               NULL, path, "gnunet-service-sensor", NULL);

  GNUNET_free (path);
  GNUNET_assert (NULL != proc);
  GNUNET_PROGRAM_run (1, argv, "test-sensor-api", "nohelp", options, &run, &ok);
  if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
  {
    GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
    ok = 1;
  }
  GNUNET_OS_process_wait (proc);
  GNUNET_OS_process_destroy (proc);
  return ok;
}
Esempio n. 12
0
int
main (int argc, char *const argv[])
{
  struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };

  char *const argv_prog[] = {
    "test-nat-mini",
    "-c",
    "test_nat_data.conf",
    "-L",
    "WARNING",
    NULL
  };

  GNUNET_log_setup ("test-nat-mini",
                    "WARNING",
                    NULL);

  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
              "UPnP test for NAT library, timeout set to %s\n",
              GNUNET_STRINGS_relative_time_to_string (TIMEOUT,
                                                      GNUNET_YES));
  GNUNET_PROGRAM_run (5, argv_prog, "test-nat-mini", "nohelp", options, &run,
                      NULL);
  return 0;
}
static int
check ()
{
  char *binary_name;
  char *config_file_name;

  GNUNET_asprintf (&binary_name, "test-testing-topology-%s", topology_string);
  GNUNET_asprintf (&config_file_name, "test_testing_data_topology_%s.conf",
                   topology_string);
  int ret;

  char *const argv[] = { binary_name,
    "-c",
    config_file_name,
    NULL
  };
  struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };
  ret =
      GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
                          binary_name, "nohelp", options, &run, &ok);
  if (ret != GNUNET_OK)
  {
    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                "`test-testing-topology-%s': Failed with error code %d\n",
                topology_string, ret);
  }
  GNUNET_free (binary_name);
  GNUNET_free (config_file_name);
  return ok;
}
Esempio n. 14
0
/**
 * Program to manipulate RSA key files.
 *
 * @param argc number of arguments from the command line
 * @param argv command line arguments
 * @return 0 ok, 1 on error
 */
int
main (int argc, char *const*argv)
{
  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
    { 'g', "generate-keys", "COUNT",
      gettext_noop ("create COUNT public-private key pairs (for testing)"),
      1, &GNUNET_GETOPT_set_uint, &make_keys },
    { 'p', "print-public-key", NULL,
      gettext_noop ("print the public key in ASCII format"),
      0, &GNUNET_GETOPT_set_one, &print_public_key },
    { 'P', "print-peer-identity", NULL,
      gettext_noop ("print the hash of the public key in ASCII format"),
      0, &GNUNET_GETOPT_set_one, &print_peer_identity },
    { 's', "print-short-identity", NULL,
      gettext_noop ("print the short hash of the public key in ASCII format"),
      0, &GNUNET_GETOPT_set_one, &print_short_identity },
    { 'w', "weak-random", NULL,
      gettext_noop ("use insecure, weak random number generator for key generation (for testing only)"),
      0, &GNUNET_GETOPT_set_one, &weak_random },
    GNUNET_GETOPT_OPTION_END
  };
  int ret;

  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
    return 2;

  ret = (GNUNET_OK ==
	 GNUNET_PROGRAM_run (argc, argv, "gnunet-rsa [OPTIONS] keyfile",
			     gettext_noop ("Manipulate GNUnet private RSA key files"),
			     options, &run, NULL)) ? 0 : 1;
  GNUNET_free ((void*) argv);
  return ret;
}
Esempio n. 15
0
int
main (int argc, char *const *argv)
{
  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
    {'4', "ipv4", "IPV4",
     gettext_noop ("set A records"),
     1, &GNUNET_GETOPT_set_string, &n4},
    {'6', "ipv4", "IPV6",
     gettext_noop ("set AAAA records"),
     1, &GNUNET_GETOPT_set_string, &n6},
    GNUNET_GETOPT_OPTION_VERBOSE (&verbosity),
    GNUNET_GETOPT_OPTION_END
  };

  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
    return 2;

  ret = (GNUNET_OK ==
	 GNUNET_PROGRAM_run (argc, argv, "gnunet-dns-redirector",
			     gettext_noop
			     ("Change DNS replies to point elsewhere."), options,
			     &run, NULL)) ? ret : 1;
  GNUNET_free ((void*) argv);
  return ret;
}
Esempio n. 16
0
/**
 * Main
 */
int
main (int argc, char *argv[])
{
  int ret;

  char *const argv2[] = { "test-mesh-local",
    "-c", "test_mesh.conf",
#if VERBOSE
    "-L", "DEBUG",
#endif
    NULL
  };
  struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };

  ret =
      GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
                          "test-mesh-local", "nohelp", options, &run, NULL);

  if (GNUNET_OK != ret)
  {
    GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "run failed with error code %d\n",
                ret);
    return 1;
  }
  if (GNUNET_SYSERR == result)
  {
    GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test failed\n");
    return 1;
  }
  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test ok\n");
  return 0;
}
/**
 * Main function
 */
int
main (int argc, char **argv)
{
  char *const argv2[] = { "test_testbed_api_controllerlink",
    "-c", "test_testbed_api.conf",
    NULL
  };
  struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };
  int ret;

  result = INIT;
  ret =
      GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
                          "test_testbed_api_controllerlink", "nohelp", options,
                          &run, NULL);
  if (GNUNET_OK != ret)
    return 1;
  switch (result)
  {
  case SUCCESS:
    return 0;
  case SKIP:
    return 77;                  /* Mark test as skipped */
  default:
    return 1;
  }
}
Esempio n. 18
0
/**
 * Program to manipulate ECC key files.
 *
 * @param argc number of arguments from the command line
 * @param argv command line arguments
 * @return 0 ok, 1 on error
 */
int
main (int argc, char *const *argv)
{
  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
    { 'b', "bits", "BITS",
      gettext_noop ("number of bits to require for the proof of work"),
      1, &GNUNET_GETOPT_set_ulong, &nse_work_required },
    { 'k', "keyfile", "FILE",
      gettext_noop ("file with private key, otherwise default is used"),
      1, &GNUNET_GETOPT_set_filename, &pkfn },
    { 'o', "outfile", "FILE",
      gettext_noop ("file with proof of work, otherwise default is used"),
      1, &GNUNET_GETOPT_set_filename, &pwfn },
    { 't', "timeout", "TIME",
      gettext_noop ("time to wait between calculations"),
      1, &GNUNET_GETOPT_set_relative_time, &proof_find_delay },
    GNUNET_GETOPT_OPTION_END
  };
  int ret;

  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
    return 2;

  ret = (GNUNET_OK ==
         GNUNET_PROGRAM_run (argc, argv,
                             "gnunet-scrypt [OPTIONS] prooffile",
                             gettext_noop ("Manipulate GNUnet proof of work files"),
                             options, &run, NULL)) ? 0 : 1;
  GNUNET_free ((void*) argv);
  GNUNET_free_non_null (pwfn);
  return ret;
}
Esempio n. 19
0
/**
 * The main function.
 *
 * @param argc number of arguments from the command line
 * @param argv command line arguments
 * @return 0 ok, 1 on error
 */
int
main (int argc, char *const *argv)
{
  int res;

  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
    {'V', "verbose", NULL,
     gettext_noop ("verbose output"),
     0, &GNUNET_GETOPT_set_one, &verbose},
    GNUNET_GETOPT_OPTION_END
  };

  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
    return 2;

  res = GNUNET_PROGRAM_run (argc, argv, "gnunet-dv",
			    gettext_noop ("Print information about DV state"),
			    options, &run,
			    NULL);
  GNUNET_free ((void *) argv);

  if (GNUNET_OK != res)
    return 1;
  return 0;
}
int
main (int argc, char *argv[])
{
    char *const argvx[] = {
        "test-fs-start-stop",
        "-c",
        "test_fs_data.conf",
#if VERBOSE
        "-L", "DEBUG",
#endif
        NULL
    };
    struct GNUNET_GETOPT_CommandLineOption options[] = {
        GNUNET_GETOPT_OPTION_END
    };

    GNUNET_log_setup ("test_fs_start_stop",
#if VERBOSE
                      "DEBUG",
#else
                      "WARNING",
#endif
                      NULL);
    GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, argvx,
                        "test-fs-start-stop", "nohelp", options, &run, NULL);
    stop_arm (&p1);
    GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs/");
    return 0;
}
Esempio n. 21
0
/**
 * The main function to handle gnunet://-URIs.
 *
 * @param argc number of arguments from the command line
 * @param argv command line arguments
 * @return 0 ok, 1 on error
 */
int
main (int argc, char *const *argv)
{
  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };
  struct GNUNET_SIGNAL_Context *shc_chld;
  int ret;

  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
    return 2;
  sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_NO, GNUNET_NO);
  GNUNET_assert (sigpipe != NULL);
  shc_chld =
    GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death);
  ret = GNUNET_PROGRAM_run (argc, argv, "gnunet-uri URI",
			    gettext_noop ("Perform default-actions for GNUnet URIs"),
			    options, &run, NULL);
  GNUNET_SIGNAL_handler_uninstall (shc_chld);
  shc_chld = NULL;
  GNUNET_DISK_pipe_close (sigpipe);
  sigpipe = NULL;
  GNUNET_free ((void *) argv);
  return ((GNUNET_OK == ret) && (0 == exit_code)) ? 0 : 1;
}
static int
check ()
{
  int ret;

  /* Arguments for GNUNET_PROGRAM_run */
  char *const argv[] = { "test-gns-simple-delegated-lookup", /* Name to give running binary */
    "-c",
    "test_gns_simple_lookup.conf",       /* Config file to use */
#if VERBOSE
    "-L", "DEBUG",
#endif
    NULL
  };
  struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };
  /* Run the run function as a new program */
  ret =
      GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
                          "test-gns-simple-delegated-lookup", "nohelp", options, &run,
                          &ok);
  if (ret != GNUNET_OK)
  {
    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                "`test-gns-simple-delegated-lookup': Failed with error code %d\n", ret);
  }
  return ok;
}
int
main (int argc, char *argv[])
{
  char *const argvx[] = {
    "test-fs-file_information",
    "-c",
    "test_fs_file_information_data.conf",
#if VERBOSE
    "-L", "DEBUG",
#endif
    NULL
  };
  struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };

  GNUNET_log_setup ("test_fs_file_information",
#if VERBOSE
                    "DEBUG",
#else
                    "WARNING",
#endif
                    NULL);
  GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, argvx,
                      "test-fs-file_information", "nohelp", options, &run,
                      NULL);
  return 0;
}
Esempio n. 24
0
/**
 * Program to run a file-sharing testbed.
 *
 * @param argc number of arguments from the command line
 * @param argv command line arguments
 * @return 0 ok, 1 on error
 */
int
main (int argc, char *const *argv)
{
  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
    {'n', "num-peers", "COUNT",
     gettext_noop ("run the experiment with COUNT peers"),
     1, &GNUNET_GETOPT_set_uint, &num_peers},
    {'H', "hosts", "HOSTFILE",
     gettext_noop ("specifies name of a file with the HOSTS the testbed should use"),
     1, &GNUNET_GETOPT_set_string, &host_filename},
    {'t', "timeout", "DELAY",
     gettext_noop ("automatically terminate experiment after DELAY"),
     1, &GNUNET_GETOPT_set_relative_time, &timeout},
    GNUNET_GETOPT_OPTION_END
  };
  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
    return 2;

  ret = (GNUNET_OK ==
	 GNUNET_PROGRAM_run (argc, argv, "gnunet-fs-profiler",
			     gettext_noop ("run a testbed to measure file-sharing performance"), options, &run,
			     NULL)) ? ret : 1;
  GNUNET_free ((void*) argv);
  return ret;
}
Esempio n. 25
0
/**
 * The main function.
 *
 * @param argc number of arguments from the command line
 * @param argv command line arguments
 * @return 0 ok, 1 on error
 */
int
main (int argc, char *const *argv)
{
  int res;
  resolve_addresses_numeric = GNUNET_NO;
  op_monitor = GNUNET_NO;
  op_list_all = GNUNET_NO;
  op_list_used = GNUNET_NO;
  op_set_pref = GNUNET_NO;
  pending = 0;
  receive_done = GNUNET_NO;

  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
      {'u', "used", NULL,
       gettext_noop ("get list of active addresses currently used"),
       0, &GNUNET_GETOPT_set_one, &op_list_used},
       {'a', "all", NULL,
        gettext_noop ("get list of all active addresses"),
        0, &GNUNET_GETOPT_set_one, &op_list_all},
      {'n', "numeric", NULL,
       gettext_noop ("do not resolve IP addresses to hostnames"),
       0, &GNUNET_GETOPT_set_one, &resolve_addresses_numeric},
       {'m', "monitor", NULL,
        gettext_noop ("monitor mode"),
        0, &GNUNET_GETOPT_set_one, &op_monitor},
       {'p', "preference", NULL,
         gettext_noop ("set preference for the given peer"),
         0, &GNUNET_GETOPT_set_one, &op_set_pref},
       {'i', "id", "TYPE",
         gettext_noop ("peer id"),
         1, &GNUNET_GETOPT_set_string, &pid_str},
       {'t', "type", "TYPE",
         gettext_noop ("preference type to set: latency | bandwidth"),
         1, &GNUNET_GETOPT_set_string, &type_str},
       {'k', "value", "VALUE",
         gettext_noop ("preference value"),
         1, &GNUNET_GETOPT_set_uint, &value},
       {'V', "verbose", NULL,
        gettext_noop ("verbose output (include ATS address properties)"),
        0, &GNUNET_GETOPT_set_one, &verbose},
    GNUNET_GETOPT_OPTION_END
  };

  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
    return 2;

  res = GNUNET_PROGRAM_run (argc, argv, "gnunet-ats",
                              gettext_noop ("Print information about ATS state"), options, &run,
                              NULL);
  GNUNET_free_non_null (pid_str);
  GNUNET_free_non_null (type_str);
  GNUNET_free ((void *) argv);

  if (GNUNET_OK == res)
    return ret;
  else
    return 1;

}
Esempio n. 26
0
/**
 * Entry point for gnunet-dht-put
 *
 * @param argc number of arguments from the command line
 * @param argv command line arguments
 * @return 0 ok, 1 on error
 */
int
main (int argc, char *const *argv)
{
  return (GNUNET_OK ==
          GNUNET_PROGRAM_run (argc, argv, "gnunet-dht-put",
                              gettext_noop
                              ("Issue a PUT request to the GNUnet DHT insert DATA under KEY."),
                              options, &run, NULL)) ? ret : 1;
}
Esempio n. 27
0
int
main (int argc, char *argv[])
{
  char *test_source;
  int ret;

  static char *const argv_new[] = {
    "test-transport-api-reliability",
    "-c",
    "test_transport_api_data.conf",
    NULL
  };
  static struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };

  GNUNET_TRANSPORT_TESTING_get_test_name (argv[0],
                                          &test_name);
  GNUNET_log_setup (test_name,
                    "WARNING",
                    NULL);
  GNUNET_TRANSPORT_TESTING_get_test_source_name (__FILE__,
                                                 &test_source);
  GNUNET_TRANSPORT_TESTING_get_test_plugin_name (argv[0],
                                                 test_source,
                                                 &test_plugin);

  tth = GNUNET_TRANSPORT_TESTING_init ();

  GNUNET_TRANSPORT_TESTING_get_config_name (argv[0], &cfg_file_p1, 1);
  GNUNET_TRANSPORT_TESTING_get_config_name (argv[0], &cfg_file_p2, 2);

#if WRITECONFIG
  setTransportOptions ("test_transport_api_data.conf");
#endif
  ok = GNUNET_SYSERR;

  ret = GNUNET_PROGRAM_run ((sizeof (argv_new) / sizeof (char *)) - 1,
                            argv_new, test_name,
                            "nohelp", options,
                            &run, &ok);
  if (GNUNET_SYSERR == ret)
  {
    fprintf (stderr,
             "Test failed: %d\n",
             ok);
    ok = -1;
  }
  GNUNET_free (cfg_file_p1);
  GNUNET_free (cfg_file_p2);
  GNUNET_free (test_source);
  GNUNET_free (test_plugin);
  GNUNET_free (test_name);

  return ok;
}
Esempio n. 28
0
/**
 * Main function
 */
int
main (int argc, char **argv)
{
  char *argv2[] = {
    "test_testbed_api_testbed_run",
    "-c", NULL,
    NULL
  };
  struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };
  char *testname;
  char *config_filename;
  int ret;

  if (NULL == (testname = strrchr (argv[0], (int) '_')))
  {
    GNUNET_break (0);
    return 1;
  }
  testname++;
  testname = GNUNET_strdup (testname);
#ifdef MINGW
  {
    char *period;

    /* check and remove .exe extension */
    period = strrchr (testname, (int) '.');
    if (NULL != period)
      *period = '\0';
    else
      GNUNET_break (0);         /* Windows with no .exe? */
  }
#endif
  if (0 == strcmp ("waitforever", testname))
    wait_forever = GNUNET_YES;
  if ( (GNUNET_YES != wait_forever) && (0 != strcmp ("run", testname)) )
  {
    GNUNET_asprintf (&config_filename, "test_testbed_api_testbed_run_%s.conf",
                     testname);
  }
  else
    config_filename = GNUNET_strdup ("test_testbed_api.conf");
  GNUNET_free (testname);
  argv2[2] = config_filename;
  result = GNUNET_SYSERR;
  ret =
      GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
                          "test_testbed_api_testbed_run", "nohelp", options,
                          &run, NULL);
  GNUNET_free (config_filename);
  if ((GNUNET_OK != ret) || (GNUNET_OK != result))
    return 1;
  return 0;
}
Esempio n. 29
0
int
main (int argc, char **argv)
{
   static const struct GNUNET_GETOPT_CommandLineOption options[] = {
        GNUNET_GETOPT_OPTION_END
   };
  GNUNET_PROGRAM_run (argc, argv, "gnunet-consensus",
		      "help",
		      options, &run, NULL);
  return 0;
}
Esempio n. 30
0
/**
 * The main function to obtain peer information.
 *
 * @param argc number of arguments from the command line
 * @param argv command line arguments
 * @return 0 ok, 1 on error
 */
int
main (int argc, char *const *argv)
{
  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };
  return (GNUNET_OK ==
          GNUNET_PROGRAM_run (argc, argv, "gnunet-core",
                              gettext_noop
                              ("Print information about connected peers."),
                              options, &run, NULL)) ? 0 : 1;
}