예제 #1
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;
}
예제 #2
0
파일: gnunet-uri.c 프로젝트: GNUnet/gnunet
/**
 * 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;
}
예제 #3
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;
}
예제 #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)
{
  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;
}
예제 #5
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;
}
예제 #6
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;
}
예제 #7
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;
}
예제 #8
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;

}
예제 #9
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;
  const char helpstr[] = "Create channels and retreive info about meshs status.";
  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
//     {'a', "channel", "TUNNEL_ID:CHANNEL_ID",
//      gettext_noop ("provide information about a particular channel"),
//      GNUNET_YES, &GNUNET_GETOPT_set_string, &channel_id},
//     {'b', "connection", "TUNNEL_ID:CONNECTION_ID",
//      gettext_noop ("provide information about a particular connection"),
//      GNUNET_YES, &GNUNET_GETOPT_set_string, &conn_id},
    {'e', "echo", NULL,
     gettext_noop ("activate echo mode"),
     GNUNET_NO, &GNUNET_GETOPT_set_one, &echo},
//     {'m', "monitor", NULL,
//      gettext_noop ("provide information about all tunnels (continuously) NOT IMPLEMENTED"), /* FIXME */
//      GNUNET_NO, &GNUNET_GETOPT_set_one, &monitor_connections},
    {'p', "port", NULL,
     gettext_noop ("port to listen to (default; 0)"),
     GNUNET_YES, &GNUNET_GETOPT_set_uint, &listen_port},
    {'P', "peers", NULL,
    gettext_noop ("provide information about all peers"),
    GNUNET_NO, &GNUNET_GETOPT_set_one, &request_peers},
    {'t', "tunnel", "TUNNEL_ID",
     gettext_noop ("provide information about a particular tunnel"),
     GNUNET_YES, &GNUNET_GETOPT_set_string, &tunnel_id},
    {'T', "tunnels", NULL,
     gettext_noop ("provide information about all tunnels"),
     GNUNET_NO, &GNUNET_GETOPT_set_one, &request_tunnels},

    GNUNET_GETOPT_OPTION_END
  };

  monitor_connections = GNUNET_NO;

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

  res = GNUNET_PROGRAM_run (argc, argv, "gnunet-mesh (OPTIONS | TARGET PORT)",
                            gettext_noop (helpstr),
                            options, &run, NULL);

  GNUNET_free ((void *) argv);

  if (GNUNET_OK == res)
    return 0;
  else
    return 1;
}
예제 #10
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;
}
예제 #11
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)
{
  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
    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-daemon-sysmon",
			     gettext_noop ("GNUnet system monitoring and information daemon"), options, &run,
			     NULL)) ? ret : 1;
  GNUNET_free ((void*) argv);
  return ret;
}
예제 #12
0
/**
 * The main function of our code to test microphone and speaker.
 *
 * @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
  };
  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
    return 2;

  ret = (GNUNET_OK ==
	 GNUNET_PROGRAM_run (argc, argv, "gnunet-conversation-test",
			     gettext_noop ("help text"), options, &run,
			     NULL)) ? ret : 1;
  GNUNET_free ((void*) argv);
  return ret;
}
예제 #13
0
파일: gnunet-nat.c 프로젝트: GNUnet/gnunet
/**
 * Main function of gnunet-nat
 *
 * @param argc number of command-line arguments
 * @param argv command line
 * @return 0 on success, -1 on error
 */
int
main (int argc,
      char *const argv[])
{
  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
    {'i', "in", "ADDRESS",
     gettext_noop ("which IP and port are we locally using to bind/listen to"),
     GNUNET_YES, &GNUNET_GETOPT_set_string, &local_addr },
    {'r', "remote", "ADDRESS",
     gettext_noop ("which remote IP and port should be asked for connection reversal"),
     GNUNET_YES, &GNUNET_GETOPT_set_string, &remote_addr },
    {'S', "section", NULL,
     gettext_noop ("name of configuration section to find additional options, such as manual host punching data"),
     GNUNET_YES, &GNUNET_GETOPT_set_string, &section_name },
    {'s', "stun", NULL,
     gettext_noop ("enable STUN processing"),
     GNUNET_NO, &GNUNET_GETOPT_set_one, &do_stun },
    {'t', "tcp", NULL,
     gettext_noop ("use TCP"),
     GNUNET_NO, &GNUNET_GETOPT_set_one, &use_tcp },
    {'u', "udp", NULL,
     gettext_noop ("use UDP"),
     GNUNET_NO, &GNUNET_GETOPT_set_one, &use_udp },
    {'W', "watch", NULL,
     gettext_noop ("watch for connection reversal requests"),
     GNUNET_NO, &GNUNET_GETOPT_set_one, &listen_reversal },
   GNUNET_GETOPT_OPTION_END
  };

  if (GNUNET_OK !=
      GNUNET_STRINGS_get_utf8_args (argc, argv,
				    &argc, &argv))
    return 2;
  if (GNUNET_OK !=
      GNUNET_PROGRAM_run (argc, argv,
			  "gnunet-nat [options]",
                          _("GNUnet NAT traversal autoconfigure daemon"),
			  options,
                          &run,
			  NULL))
  {
    global_ret = 1;
  }
  GNUNET_free ((void*) argv);
  return global_ret;
}
예제 #14
0
/**
 * The main function to inspect GNUnet directories.
 *
 * @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 struct GNUNET_GETOPT_CommandLineOption options[] = {
    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-directory [OPTIONS] FILENAME",
			     gettext_noop
			     ("Display contents of a GNUnet directory"),
			     options, &run, NULL)) ? ret : 1;
  GNUNET_free ((void*) argv);
  return ret;
}
예제 #15
0
/**
 * The main function to download GNUnet.
 *
 * @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[] = {
    {'a', "anonymity", "LEVEL",
     gettext_noop ("set the desired LEVEL of receiver-anonymity"),
     1, &GNUNET_GETOPT_set_uint, &anonymity},
    {'D', "delete-incomplete", NULL,
     gettext_noop ("delete incomplete downloads (when aborted with CTRL-C)"),
     0, &GNUNET_GETOPT_set_one, &delete_incomplete},
    {'n', "no-network", NULL,
     gettext_noop ("only search the local peer (no P2P network search)"),
     0, &GNUNET_GETOPT_set_uint, &local_only},
    {'o', "output", "FILENAME",
     gettext_noop ("write the file to FILENAME"),
     1, &GNUNET_GETOPT_set_string, &filename},
    {'p', "parallelism", "DOWNLOADS",
     gettext_noop
     ("set the maximum number of parallel downloads that is allowed"),
     1, &GNUNET_GETOPT_set_uint, &parallelism},
    {'r', "request-parallelism", "REQUESTS",
     gettext_noop
     ("set the maximum number of parallel requests for blocks that is allowed"),
     1, &GNUNET_GETOPT_set_uint, &request_parallelism},
    {'R', "recursive", NULL,
     gettext_noop ("download a GNUnet directory recursively"),
     0, &GNUNET_GETOPT_set_one, &do_recursive},
    {'V', "verbose", NULL,
     gettext_noop ("be verbose (print progress information)"),
     0, &GNUNET_GETOPT_increment_value, &verbose},
    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-download [OPTIONS] URI",
			     gettext_noop
			     ("Download files from GNUnet using a GNUnet CHK or LOC URI (gnunet://fs/chk/...)"),
			     options, &run, NULL)) ? ret : 1;
  GNUNET_free ((void*) argv);
  return ret;
}
예제 #16
0
파일: gnunet-vpn.c 프로젝트: tg-x/gnunet
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;
}
/**
 * The main function for the topology daemon.
 *
 * @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
  };
  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-daemon-topology",
                           _
                           ("GNUnet topology control (maintaining P2P mesh and F2F constraints)"),
                           options, &run, NULL)) ? 0 : 1;
  GNUNET_free ((void*) argv);
  return ret;
}
/**
 *
 * The main function for gnunet-service-identity-token
 *
 * @param argc number of arguments from the cli
 * @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
  };
  int ret;

  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
    return 2;
  GNUNET_log_setup ("gnunet-service-identity-token", "WARNING", NULL);
  ret =
    (GNUNET_OK ==
     GNUNET_PROGRAM_run (argc, argv, "gnunet-service-identity-token",
                         _("GNUnet identity token service"),
                         options,
                         &run, NULL)) ? 0: 1;
  GNUNET_free_non_null ((char *) argv);
  return ret;
}
예제 #19
0
/**
 * The main function to obtain statistics in GNUnet.
 *
 * @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', "name", "NAME",
     gettext_noop ("limit output to statistics for the given NAME"), 1,
     &GNUNET_GETOPT_set_string, &name},
    {'p', "persistent", NULL,
     gettext_noop ("make the value being set persistent"), 0,
     &GNUNET_GETOPT_set_one, &persistent},
    {'s', "subsystem", "SUBSYSTEM",
     gettext_noop ("limit output to the given SUBSYSTEM"), 1,
     &GNUNET_GETOPT_set_string, &subsystem},
    {'q', "quiet", NULL,
     gettext_noop ("just print the statistics value"), 0,
     &GNUNET_GETOPT_set_one, &quiet},
    {'w', "watch", NULL,
     gettext_noop ("watch value continuously"), 0,
     &GNUNET_GETOPT_set_one, &watch},
     {'r', "remote", NULL,
      gettext_noop ("connect to remote host"), 1,
      &GNUNET_GETOPT_set_string, &remote_host},
    {'o', "port", NULL,
     gettext_noop ("port for remote host"), 1,
     &GNUNET_GETOPT_set_uint, &remote_port},
    GNUNET_GETOPT_OPTION_END
  };
  remote_port = 0;
  remote_host = NULL;
  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
    return 2;

  ret = (GNUNET_OK ==
	 GNUNET_PROGRAM_run (argc, argv, "gnunet-statistics [options [value]]",
			     gettext_noop
			     ("Print statistics about GNUnet operations."),
			     options, &run, NULL)) ? ret : 1;
  GNUNET_free_non_null (remote_host);
  GNUNET_free ((void*) argv);
  return ret;
}
예제 #20
0
/**
 * The main function to unindex content.
 *
 * @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[] = {
    {'V', "verbose", NULL,
     gettext_noop ("be verbose (print progress information)"),
     0, &GNUNET_GETOPT_set_one, &verbose},
    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-unindex [OPTIONS] FILENAME",
			     gettext_noop
			     ("Unindex a file that was previously indexed with gnunet-publish."),
			     options, &run, NULL)) ? ret : 1;
  GNUNET_free ((void*) argv);
  return ret;
}
예제 #21
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[] = {
    {'C', "create", "NAME",
     gettext_noop ("create ego NAME"),
     1, &GNUNET_GETOPT_set_string, &create_ego},
    {'D', "delete", "NAME",
     gettext_noop ("delete ego NAME "),
     1, &GNUNET_GETOPT_set_string, &delete_ego},
    {'d', "display", NULL,
     gettext_noop ("display all egos"),
     0, &GNUNET_GETOPT_set_one, &list},
    {'e', "ego", "NAME",
     gettext_noop ("set default identity to EGO for a subsystem SUBSYSTEM (use together with -s)"),
     1, &GNUNET_GETOPT_set_string, &set_ego},
    {'m', "monitor", NULL,
     gettext_noop ("run in monitor mode egos"),
     0, &GNUNET_GETOPT_set_one, &monitor},
    {'s', "set", "SUBSYSTEM",
     gettext_noop ("set default identity to EGO for a subsystem SUBSYSTEM (use together with -e)"),
     1, &GNUNET_GETOPT_set_string, &set_subsystem},
    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-identity",
			    gettext_noop ("Maintain egos"),
			    options, &run,
			    NULL);
  GNUNET_free ((void *) argv);

  if (GNUNET_OK != res)
    return 1;
  return 0;
}
예제 #22
0
/**
 * The main function for the hostlist daemon.
 *
 * @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[] = {
#if HAVE_MHD
    {'a', "advertise", NULL,
     gettext_noop ("advertise our hostlist to other peers"),
     GNUNET_NO, &GNUNET_GETOPT_set_one, &advertising},
#endif
    {'b', "bootstrap", NULL,
     gettext_noop
     ("bootstrap using hostlists (it is highly recommended that you always use this option)"),
     GNUNET_NO, &GNUNET_GETOPT_set_one, &bootstrapping},
    {'e', "enable-learning", NULL,
     gettext_noop ("enable learning about hostlist servers from other peers"),
     GNUNET_NO, &GNUNET_GETOPT_set_one, &learning},
#if HAVE_MHD
    {'p', "provide-hostlist", NULL,
     gettext_noop ("provide a hostlist server"),
     GNUNET_NO, &GNUNET_GETOPT_set_one, &provide_hostlist},
#endif
    GNUNET_GETOPT_OPTION_END
  };

  int ret;

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

  GNUNET_log_setup ("hostlist", "WARNING", NULL);
  ret =
      (GNUNET_OK ==
       GNUNET_PROGRAM_run (argc, argv,
                           "hostlist",
                           _("GNUnet hostlist server and client"),
                           options,
                           &run, NULL)) ? 0 : 1;
  GNUNET_free ((void*) argv);
  return ret;
}
예제 #23
0
/**
 * Main function of gnunet-nat-auto
 *
 * @param argc number of command-line arguments
 * @param argv command line
 * @return 0 on success, -1 on error
 */
int
main (int argc,
      char *const argv[])
{
  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
    {'a', "auto", NULL,
     gettext_noop ("run autoconfiguration"),
     GNUNET_NO, &GNUNET_GETOPT_set_one, &do_auto },
    {'S', "section", "NAME",
     gettext_noop ("section name providing the configuration for the adapter"),
     GNUNET_YES, &GNUNET_GETOPT_set_string, &section_name },
    {'t', "tcp", NULL,
     gettext_noop ("use TCP"),
     GNUNET_NO, &GNUNET_GETOPT_set_one, &use_tcp },
    {'u', "udp", NULL,
     gettext_noop ("use UDP"),
     GNUNET_NO, &GNUNET_GETOPT_set_one, &use_udp },
    {'w', "write", NULL,
     gettext_noop ("write configuration file (for autoconfiguration)"),
     GNUNET_NO, &GNUNET_GETOPT_set_one, &write_cfg },
    GNUNET_GETOPT_OPTION_END
  };

  if (GNUNET_OK !=
      GNUNET_STRINGS_get_utf8_args (argc, argv,
				    &argc, &argv))
    return 2;
  if (GNUNET_OK !=
      GNUNET_PROGRAM_run (argc, argv,
			  "gnunet-nat-auto [options]",
                          _("GNUnet NAT traversal autoconfiguration"),
			  options,
                          &run,
			  NULL))
  {
    global_ret = 1;
  }
  GNUNET_free ((void*) argv);
  return global_ret;
}
/**
 * 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)
{
    static const struct GNUNET_GETOPT_CommandLineOption options[] = {
        GNUNET_GETOPT_OPTION_END
    };
    int ret;

    if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
        return 2;
#ifdef SQLITE_CONFIG_MMAP_SIZE
    (void) sqlite3_config (SQLITE_CONFIG_MMAP_SIZE, 512000, 256000000);
#endif
    ret =
        (GNUNET_OK ==
         GNUNET_PROGRAM_run (argc, argv, "testbed-underlay",
                             _
                             ("Daemon to restrict underlay network in testbed deployments"),
                             options, &run, NULL)) ? 0 : 1;
    GNUNET_free ((void*) argv);
    return ret;
}
/**
 * Main function.
 *
 * @return 0 on success
 */
int
main (int argc, char *const *argv)
{
  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
    { 'p', "num-peers", "COUNT",
      gettext_noop ("create COUNT number of peers"),
      GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_peers },
    { 'n', "num-links", "COUNT",
      gettext_noop ("create COUNT number of random links"),
      GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_links },
    { 'e', "num-errors", "COUNT",
      gettext_noop ("tolerate COUNT number of continious timeout failures"),
      GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_cont_fails },
    { 't', "topology", "TOPOLOGY",
      gettext_noop ("Try to acheive TOPOLOGY. This options takes either CLIQUE "
                    "or RANDOM. For CLIQUE the parameter -n is ignored. The "
                    "default is to acheive a random graph topology."),
      GNUNET_YES, &set_topology, &topology },
    GNUNET_GETOPT_OPTION_END
  };
  int ret;

  topology = GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI;
  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
    return 2;
  
  result = GNUNET_SYSERR;
  ret =
      GNUNET_PROGRAM_run (argc, argv, "gnunet-testbed-profiler [OPTIONS] hosts-file",
                          _("Profiler for testbed"),
                          options, &run, NULL);
  GNUNET_free ((void*) argv);
  if (GNUNET_OK != ret)
    return ret;
  if (GNUNET_OK != result)
    return 1;
  return 0;
}
예제 #26
0
/**
 * The main function for gnunet-gns.
 *
 * @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[] = {
    {'p', "port", "PORT",
      gettext_noop ("Run HTTP serve on port PORT (default is 8888)"), 1,
      &GNUNET_GETOPT_set_uint, &port},
    GNUNET_GETOPT_OPTION_END
  };
  int ret;

  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
    return 2;
  GNUNET_log_setup ("gnunet-bcd", "WARNING", NULL);
  ret =
      (GNUNET_OK ==
       GNUNET_PROGRAM_run (argc, argv, "gnunet-bcd",
                           _("GNUnet HTTP server to create business cards"),
			   options,
                           &run, NULL)) ? 0 : 1;
  GNUNET_free ((void*) argv);
  return ret;
}
예제 #27
0
파일: gnunet-search.c 프로젝트: tg-x/gnunet
/**
 * The main function to search GNUnet.
 *
 * @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[] = {
    {'a', "anonymity", "LEVEL",
     gettext_noop ("set the desired LEVEL of receiver-anonymity"),
     1, &GNUNET_GETOPT_set_uint, &anonymity},
    {'n', "no-network", NULL,
     gettext_noop ("only search the local peer (no P2P network search)"),
     0, &GNUNET_GETOPT_set_one, &local_only},
    {'o', "output", "PREFIX",
     gettext_noop ("write search results to file starting with PREFIX"),
     1, &GNUNET_GETOPT_set_string, &output_filename},
    {'t', "timeout", "DELAY",
     gettext_noop ("automatically terminate search after DELAY"),
     1, &GNUNET_GETOPT_set_relative_time, &timeout},
    {'V', "verbose", NULL,
     gettext_noop ("be verbose (print progress information)"),
     0, &GNUNET_GETOPT_set_one, &verbose},
    {'N', "results", "VALUE",
     gettext_noop
     ("automatically terminate search after VALUE results are found"),
     1, &GNUNET_GETOPT_set_uint, &results_limit},
    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-search [OPTIONS] KEYWORD",
			     gettext_noop
			     ("Search GNUnet for files that were published on GNUnet"),
			     options, &run, NULL)) ? ret : 1;
  GNUNET_free ((void*) argv);
  return ret;
}
예제 #28
0
int
main (int argc, char *const *argv)
{
  /* Init invalid */
  update_percentage = UINT_MAX;
  static struct GNUNET_GETOPT_CommandLineOption options[] = {
    {'a', "addresses", NULL,
     gettext_noop ("addresses per peer"), 1,
     &GNUNET_GETOPT_set_uint, &addresses},
    {'p', "peers", NULL,
     gettext_noop ("peers"), 1,
     &GNUNET_GETOPT_set_uint, &peers},
     {'n', "numeric", NULL,
      gettext_noop ("numeric output only"), 0,
      &GNUNET_GETOPT_set_one, &numeric},
    {'e', "end", NULL,
     gettext_noop ("end solving problem"), 1,
     &GNUNET_GETOPT_set_uint, &end},
   {'s', "start", NULL,
    gettext_noop ("start solving problem"), 1,
    &GNUNET_GETOPT_set_uint, &start},
    {'u', "update", NULL,
     gettext_noop ("benchmark with existing solution (address updates)"), 1,
     &GNUNET_GETOPT_set_uint, &update_percentage},
    GNUNET_GETOPT_OPTION_END
  };

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

  GNUNET_PROGRAM_run (argc, argv,
                      "perf_ats_mlp", "nohelp", options,
                      &check, NULL);
  GNUNET_free ((void *) argv);
  return ret;
}
예제 #29
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
  };
  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-peerinfo",
			     gettext_noop ("Print information about peers."),
			     options, &run, NULL)) ? 0 : 1;
  GNUNET_free ((void*) argv);
  return ret;
}
예제 #30
0
/**
 * Main function of the helper process to extract meta data.
 *
 * @param argc should be 3
 * @param argv [0] our binary name
 *             [1] name of the file or directory to process
 *             [2] "-" to disable extraction, NULL for defaults,
 *                 otherwise custom plugins to load from LE
 * @return 0 on success
 */
int
main (int argc,
      char *const *argv)
{
  const char *filename_expanded;
  const char *ex;
  struct ScanTreeNode *root;

#if WINDOWS
  /* We're using stdout to communicate binary data back to the parent; use
   * binary mode.
   */
  _setmode (1, _O_BINARY);
  /* Get utf-8-encoded arguments */
  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
    return 5;
  output_stream = 1; /* stdout */
#else
  ignore_sigpipe ();
  /* move stdout to some other FD for IPC, bind
     stdout/stderr to /dev/null */
  output_stream = dup (1);
  make_dev_zero (1, O_WRONLY);
  make_dev_zero (2, O_WRONLY);
#endif

  /* parse command line */
  if ( (3 != argc) && (2 != argc) )
  {
    FPRINTF (stderr,
	     "%s",
	     "gnunet-helper-fs-publish needs exactly one or two arguments\n");
#if WINDOWS
    GNUNET_free ((void*) argv);
#endif
    return 1;
  }
  filename_expanded = argv[1];
  ex = argv[2];
  if ( (NULL == ex) ||
       (0 != strcmp (ex, "-")) )
  {
#if HAVE_LIBEXTRACTOR
    plugins = EXTRACTOR_plugin_add_defaults (EXTRACTOR_OPTION_DEFAULT_POLICY);
    if (NULL != ex)
      plugins = EXTRACTOR_plugin_add_config (plugins, ex,
					     EXTRACTOR_OPTION_DEFAULT_POLICY);
#endif
  }

  /* scan tree to find out how much work there is to be done */
  if (GNUNET_OK != preprocess_file (filename_expanded,
				    &root))
  {
    (void) write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_ERROR, NULL, 0);
#if HAVE_LIBEXTRACTOR
    EXTRACTOR_plugin_remove_all (plugins);
#endif
#if WINDOWS
    GNUNET_free ((void*) argv);
#endif
    return 2;
  }
  /* signal that we're done counting files, so that a percentage of
     progress can now be calculated */
  if (GNUNET_OK !=
      write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_COUNTING_DONE, NULL, 0))
  {
#if HAVE_LIBEXTRACTOR
    EXTRACTOR_plugin_remove_all (plugins);
#endif
#if WINDOWS
    GNUNET_free ((void*) argv);
#endif
    return 3;
  }
  if (NULL != root)
  {
    if (GNUNET_OK !=
	extract_files (root))
    {
      (void) write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_ERROR, NULL, 0);
      free_tree (root);
#if HAVE_LIBEXTRACTOR
      EXTRACTOR_plugin_remove_all (plugins);
#endif
#if WINDOWS
      GNUNET_free ((void*) argv);
#endif
      return 4;
    }
    free_tree (root);
  }
  /* enable "clean" shutdown by telling parent that we are done */
  (void) write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_FINISHED, NULL, 0);
#if HAVE_LIBEXTRACTOR
  EXTRACTOR_plugin_remove_all (plugins);
#endif
#if WINDOWS
  GNUNET_free ((void*) argv);
#endif
  return 0;
}