Example #1
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;
}
Example #2
0
static int
testVerbose ()
{
  char *const myargv[] = {
    "test",
    "-V",
    "-V",
    "more",
    NULL
  };
  unsigned int vflags = 0;

  const struct GNUNET_GETOPT_CommandLineOption verboseoptionlist[] = {
    GNUNET_GETOPT_OPTION_VERBOSE (&vflags),
    GNUNET_GETOPT_OPTION_END
  };

  if (3 != GNUNET_GETOPT_run ("test", verboseoptionlist, 4, myargv))
  {
    GNUNET_break (0);
    return 1;
  }
  if (vflags != 2)
  {
    GNUNET_break (0);
    return 1;
  }
  return 0;
}
Example #3
0
int
main (int argc, char *const *argv)
{
  int res;
  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
    {'b', "benchmark", NULL,
     gettext_noop ("measure how fast we are receiving data from all peers (until CTRL-C)"),
     0, &GNUNET_GETOPT_set_one, &benchmark_receive},
    {'C', "connect", NULL,
     gettext_noop ("connect to a peer"),
     0, &GNUNET_GETOPT_set_one, &try_connect},
    {'i', "information", NULL,
     gettext_noop ("provide information about all current connections (once)"),
     0, &GNUNET_GETOPT_set_one, &iterate_connections},
    {'m', "monitor", NULL,
     gettext_noop ("provide information about all current connections (continuously)"),
     0, &GNUNET_GETOPT_set_one, &monitor_connections},
    {'e', "events", NULL,
     gettext_noop ("provide information about all connects and disconnect events (continuously)"),
     0, &GNUNET_GETOPT_set_one, &monitor_connects},
    {'n', "numeric", NULL,
     gettext_noop ("do not resolve hostnames"),
     0, &GNUNET_GETOPT_set_one, &numeric},
     {'p', "peer", "PEER",
      gettext_noop ("peer identity"),
      1, &GNUNET_GETOPT_set_string, &cpid},
    {'s', "send", NULL,
     gettext_noop
     ("send data for benchmarking to the other peer (until CTRL-C)"),
     0, &GNUNET_GETOPT_set_one, &benchmark_send},
    {'t', "test", NULL,
     gettext_noop ("test transport configuration (involves external server)"),
     0, &GNUNET_GETOPT_set_one, &test_configuration},
    GNUNET_GETOPT_OPTION_VERBOSE (&verbosity),
    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-transport",
                              gettext_noop
                              ("Direct access to transport service."), options,
                              &run, NULL);
  GNUNET_free ((void *) argv);
  if (GNUNET_OK == res)
    return ret;
  return 1;
}
Example #4
0
int
main (int argc, char *const *argv)
{
  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
    {'4', "ipv4", NULL,
     gettext_noop ("request that result should be an IPv4 address"),
     0, &GNUNET_GETOPT_set_one, &ipv4},
    {'6', "ipv6", NULL,
     gettext_noop ("request that result should be an IPv6 address"),
     0, &GNUNET_GETOPT_set_one, &ipv6},
    {'d', "duration", "TIME",
     gettext_noop ("how long should the mapping be valid for new tunnels?"),
     1, &GNUNET_GETOPT_set_relative_time, &duration},
    {'i', "ip", "IP",
     gettext_noop ("destination IP for the tunnel"),
     1, &GNUNET_GETOPT_set_string, &target_ip},
    {'p', "peer", "PEERID",
     gettext_noop ("peer offering the service we would like to access"),
     1, &GNUNET_GETOPT_set_string, &peer_id},
    {'s', "service", "NAME",
     gettext_noop ("name of the service we would like to access"),
     1, &GNUNET_GETOPT_set_string, &service_name},
    {'t', "tcp", NULL,
     gettext_noop ("service is offered via TCP"),
     0, &GNUNET_GETOPT_set_one, &tcp},
    {'u', "udp", NULL,
     gettext_noop ("service is offered via UDP"),
     0, &GNUNET_GETOPT_set_one, &udp},

    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-vpn",
			     gettext_noop
			     ("Setup tunnels via VPN."), options,
                              &run, NULL)) ? ret : 1;
  GNUNET_free ((void *) argv);
  return ret;
}