[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 16/28: Porting 'nat'.
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 16/28: Porting 'nat'. |
Date: |
Fri, 17 Mar 2017 12:09:48 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
commit 796d0e5aa54ed99dd00fae26982a0e99f9d99f8e
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed Mar 15 11:40:24 2017 +0100
Porting 'nat'.
---
src/datastore/gnunet-datastore.c | 10 ++++---
src/nat/gnunet-nat.c | 65 +++++++++++++++++++++++++---------------
src/testing/gnunet-testing.c | 40 ++++++++++++++++++-------
src/testing/list-keys.c | 15 ++++------
4 files changed, 81 insertions(+), 49 deletions(-)
diff --git a/src/datastore/gnunet-datastore.c b/src/datastore/gnunet-datastore.c
index b3d14c43c..509c7f8b1 100644
--- a/src/datastore/gnunet-datastore.c
+++ b/src/datastore/gnunet-datastore.c
@@ -239,10 +239,12 @@ run (void *cls, char *const *args, const char *cfgfile,
int
main (int argc, char *const *argv)
{
- static const struct GNUNET_GETOPT_CommandLineOption options[] = {
- { 's', "sourcecfg", "FILENAME",
- gettext_noop ("specifies the configuration to use to access an
alternative datastore; will merge that datastore into our current datastore"),
- 1, &GNUNET_GETOPT_set_filename, &alternative_cfg },
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+ GNUNET_GETOPT_OPTION_FILENAME ('s',
+ "sourcecfg",
+ "FILENAME",
+ gettext_noop ("specifies the configuration
to use to access an alternative datastore; will merge that datastore into our
current datastore"),
+ &alternative_cfg),
GNUNET_GETOPT_OPTION_END
};
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
diff --git a/src/nat/gnunet-nat.c b/src/nat/gnunet-nat.c
index 04bde5111..50e0dff0f 100644
--- a/src/nat/gnunet-nat.c
+++ b/src/nat/gnunet-nat.c
@@ -72,7 +72,7 @@ static char *remote_addr;
/**
* Should we actually bind to #bind_addr and receive and process STUN requests?
*/
-static unsigned int do_stun;
+static int do_stun;
/**
* Handle to NAT operation.
@@ -417,29 +417,46 @@ 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, §ion_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
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+
+ GNUNET_GETOPT_OPTION_STRING ('i',
+ "in",
+ "ADDRESS",
+ gettext_noop ("which IP and port are we
locally using to bind/listen to"),
+ &local_addr),
+
+ GNUNET_GETOPT_OPTION_STRING ('r',
+ "remote",
+ "ADDRESS",
+ gettext_noop ("which remote IP and port
should be asked for connection reversal"),
+ &remote_addr),
+
+ GNUNET_GETOPT_OPTION_STRING ('S',
+ "section",
+ NULL,
+ gettext_noop ("name of configuration section
to find additional options, such as manual host punching data"),
+ §ion_name),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('s',
+ "stun",
+ gettext_noop ("enable STUN processing"),
+ &do_stun),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('t',
+ "tcp",
+ gettext_noop ("use TCP"),
+ &use_tcp),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('u',
+ "udp",
+ gettext_noop ("use UDP"),
+ &use_udp),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('W',
+ "watch",
+ gettext_noop ("watch for connection reversal
requests"),
+ &listen_reversal),
+ GNUNET_GETOPT_OPTION_END
};
if (GNUNET_OK !=
diff --git a/src/testing/gnunet-testing.c b/src/testing/gnunet-testing.c
index 07f1560cb..686b38192 100644
--- a/src/testing/gnunet-testing.c
+++ b/src/testing/gnunet-testing.c
@@ -348,17 +348,35 @@ run_no_scheduler (void *cls, char *const *args, const
char *cfgfile,
int
main (int argc, char *const *argv)
{
- static const struct GNUNET_GETOPT_CommandLineOption options[] = {
- {'C', "cfg", NULL, gettext_noop ("create unique configuration files"),
- GNUNET_NO, &GNUNET_GETOPT_set_one, &create_cfg},
- {'k', "key", "FILENAME", gettext_noop ("extract hostkey file from
pre-computed hostkey list"),
- GNUNET_YES, &GNUNET_GETOPT_set_string, &create_hostkey},
- {'n', "number", "NUMBER", gettext_noop ("number of unique configuration
files to create, or number of the hostkey to extract"),
- GNUNET_YES, &GNUNET_GETOPT_set_uint, &create_no},
- {'t', "template", "FILENAME", gettext_noop ("configuration template"),
- GNUNET_YES, &GNUNET_GETOPT_set_string, &create_cfg_template},
- {'r', "run", "SERVICE", gettext_noop ("run the given service, wait on
stdin for 'r' (restart) or 'q' (quit)"),
- GNUNET_YES, &GNUNET_GETOPT_set_string, &run_service_name},
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+ GNUNET_GETOPT_OPTION_SET_ONE ('C',
+ "cfg",
+ gettext_noop ("create unique configuration
files"),
+ &create_cfg),
+ GNUNET_GETOPT_OPTION_STRING ('k',
+ "key",
+ "FILENAME",
+ gettext_noop ("extract hostkey file from
pre-computed hostkey list"),
+ &create_hostkey),
+
+ GNUNET_GETOPT_OPTION_SET_UINT ('n',
+ "number",
+ "NUMBER",
+ gettext_noop ("number of unique
configuration files to create, or number of the hostkey to extract"),
+ &create_no),
+
+
+ GNUNET_GETOPT_OPTION_STRING ('t',
+ "template",
+ "FILENAME",
+ gettext_noop ("configuration template"),
+ &create_cfg_template),
+
+ GNUNET_GETOPT_OPTION_STRING ('r',
+ "run",
+ "SERVICE",
+ gettext_noop ("run the given service, wait on
stdin for 'r' (restart) or 'q' (quit)"),
+ &run_service_name),
GNUNET_GETOPT_OPTION_END
};
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
diff --git a/src/testing/list-keys.c b/src/testing/list-keys.c
index 1fd46ebf2..cfb49460a 100644
--- a/src/testing/list-keys.c
+++ b/src/testing/list-keys.c
@@ -6,10 +6,6 @@ static unsigned int nkeys;
static unsigned int nskip;
static int result;
-
-
-
-
/**
* Main run function.
*
@@ -87,12 +83,11 @@ run (void *cls, char *const *args, const char *cfgfile,
int main (int argc, char *argv[])
{
struct GNUNET_GETOPT_CommandLineOption option[] = {
- {'n', "num-keys", "COUNT",
- gettext_noop ("list COUNT number of keys"),
- GNUNET_YES, &GNUNET_GETOPT_set_uint, &nkeys},
- {'s', "skip", "COUNT",
- gettext_noop ("skip COUNT number of keys in the beginning"),
- GNUNET_YES, &GNUNET_GETOPT_set_uint, &nskip},
+ GNUNET_GETOPT_OPTION_SET_UINT ('n',
+ "num-keys",
+ "COUNT",
+ gettext_noop ("list COUNT number of keys"),
+ &nkeys),
GNUNET_GETOPT_OPTION_END
};
int ret;
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnunet] 04/28: Merge branch 'getopt' of git+ssh://gnunet.org/gnunet into getopt, (continued)
- [GNUnet-SVN] [gnunet] 04/28: Merge branch 'getopt' of git+ssh://gnunet.org/gnunet into getopt, gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 05/28: add GNUNET_GETOPT_OPTION_SET_ABSOLUTE_TIME, gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 06/28: Port 'statistics' to the new getopt API., gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 03/28: fix test case, implement base32 argument parser logic, gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 01/28: getopt major style fix, remove macro-mania with nicer typed functions, gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 12/28: Port 'statistics' to the new getopt API., gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 11/28: add json command line option parser, gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 13/28: Porting 'arm'., gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 10/28: add GNUNET_GETOPT_OPTION_SET_ABSOLUTE_TIME, gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 15/28: merging, gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 16/28: Porting 'nat'.,
gnunet <=
- [GNUnet-SVN] [gnunet] 07/28: Porting 'arm'., gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 17/28: Porting 'nat-auto'., gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 14/28: add way to mark options as mandatory, get tests to pass again, gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 09/28: fix test case, implement base32 argument parser logic, gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 26/28: Fix compiler warnings., gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 27/28: Merge branch 'master' into getopt, gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 25/28: Last commit as of getopt porting. 'social' still gives warnings., gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 18/28: Still porting to new getopt API., gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 23/28: porting fs finished., gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 21/28: porting, gnunet, 2017/03/17