diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-03-15 11:40:24 +0100 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-03-15 11:40:47 +0100 |
commit | 796d0e5aa54ed99dd00fae26982a0e99f9d99f8e (patch) | |
tree | 45b58e703374b2227ab606b2758467c3c4fa79c4 | |
parent | f51f3438fa3451ee758152e53fe823780fb1e261 (diff) | |
download | gnunet-796d0e5aa54ed99dd00fae26982a0e99f9d99f8e.tar.gz gnunet-796d0e5aa54ed99dd00fae26982a0e99f9d99f8e.zip |
Porting 'nat'.
-rw-r--r-- | src/datastore/gnunet-datastore.c | 10 | ||||
-rw-r--r-- | src/nat/gnunet-nat.c | 65 | ||||
-rw-r--r-- | src/testing/gnunet-testing.c | 40 | ||||
-rw-r--r-- | 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, | |||
239 | int | 239 | int |
240 | main (int argc, char *const *argv) | 240 | main (int argc, char *const *argv) |
241 | { | 241 | { |
242 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 242 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
243 | { 's', "sourcecfg", "FILENAME", | 243 | GNUNET_GETOPT_OPTION_FILENAME ('s', |
244 | gettext_noop ("specifies the configuration to use to access an alternative datastore; will merge that datastore into our current datastore"), | 244 | "sourcecfg", |
245 | 1, &GNUNET_GETOPT_set_filename, &alternative_cfg }, | 245 | "FILENAME", |
246 | gettext_noop ("specifies the configuration to use to access an alternative datastore; will merge that datastore into our current datastore"), | ||
247 | &alternative_cfg), | ||
246 | GNUNET_GETOPT_OPTION_END | 248 | GNUNET_GETOPT_OPTION_END |
247 | }; | 249 | }; |
248 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 250 | 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; | |||
72 | /** | 72 | /** |
73 | * Should we actually bind to #bind_addr and receive and process STUN requests? | 73 | * Should we actually bind to #bind_addr and receive and process STUN requests? |
74 | */ | 74 | */ |
75 | static unsigned int do_stun; | 75 | static int do_stun; |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * Handle to NAT operation. | 78 | * Handle to NAT operation. |
@@ -417,29 +417,46 @@ int | |||
417 | main (int argc, | 417 | main (int argc, |
418 | char *const argv[]) | 418 | char *const argv[]) |
419 | { | 419 | { |
420 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 420 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
421 | {'i', "in", "ADDRESS", | 421 | |
422 | gettext_noop ("which IP and port are we locally using to bind/listen to"), | 422 | GNUNET_GETOPT_OPTION_STRING ('i', |
423 | GNUNET_YES, &GNUNET_GETOPT_set_string, &local_addr }, | 423 | "in", |
424 | {'r', "remote", "ADDRESS", | 424 | "ADDRESS", |
425 | gettext_noop ("which remote IP and port should be asked for connection reversal"), | 425 | gettext_noop ("which IP and port are we locally using to bind/listen to"), |
426 | GNUNET_YES, &GNUNET_GETOPT_set_string, &remote_addr }, | 426 | &local_addr), |
427 | {'S', "section", NULL, | 427 | |
428 | gettext_noop ("name of configuration section to find additional options, such as manual host punching data"), | 428 | GNUNET_GETOPT_OPTION_STRING ('r', |
429 | GNUNET_YES, &GNUNET_GETOPT_set_string, §ion_name }, | 429 | "remote", |
430 | {'s', "stun", NULL, | 430 | "ADDRESS", |
431 | gettext_noop ("enable STUN processing"), | 431 | gettext_noop ("which remote IP and port should be asked for connection reversal"), |
432 | GNUNET_NO, &GNUNET_GETOPT_set_one, &do_stun }, | 432 | &remote_addr), |
433 | {'t', "tcp", NULL, | 433 | |
434 | gettext_noop ("use TCP"), | 434 | GNUNET_GETOPT_OPTION_STRING ('S', |
435 | GNUNET_NO, &GNUNET_GETOPT_set_one, &use_tcp }, | 435 | "section", |
436 | {'u', "udp", NULL, | 436 | NULL, |
437 | gettext_noop ("use UDP"), | 437 | gettext_noop ("name of configuration section to find additional options, such as manual host punching data"), |
438 | GNUNET_NO, &GNUNET_GETOPT_set_one, &use_udp }, | 438 | §ion_name), |
439 | {'W', "watch", NULL, | 439 | |
440 | gettext_noop ("watch for connection reversal requests"), | 440 | GNUNET_GETOPT_OPTION_SET_ONE ('s', |
441 | GNUNET_NO, &GNUNET_GETOPT_set_one, &listen_reversal }, | 441 | "stun", |
442 | GNUNET_GETOPT_OPTION_END | 442 | gettext_noop ("enable STUN processing"), |
443 | &do_stun), | ||
444 | |||
445 | GNUNET_GETOPT_OPTION_SET_ONE ('t', | ||
446 | "tcp", | ||
447 | gettext_noop ("use TCP"), | ||
448 | &use_tcp), | ||
449 | |||
450 | GNUNET_GETOPT_OPTION_SET_ONE ('u', | ||
451 | "udp", | ||
452 | gettext_noop ("use UDP"), | ||
453 | &use_udp), | ||
454 | |||
455 | GNUNET_GETOPT_OPTION_SET_ONE ('W', | ||
456 | "watch", | ||
457 | gettext_noop ("watch for connection reversal requests"), | ||
458 | &listen_reversal), | ||
459 | GNUNET_GETOPT_OPTION_END | ||
443 | }; | 460 | }; |
444 | 461 | ||
445 | if (GNUNET_OK != | 462 | 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, | |||
348 | int | 348 | int |
349 | main (int argc, char *const *argv) | 349 | main (int argc, char *const *argv) |
350 | { | 350 | { |
351 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 351 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
352 | {'C', "cfg", NULL, gettext_noop ("create unique configuration files"), | 352 | GNUNET_GETOPT_OPTION_SET_ONE ('C', |
353 | GNUNET_NO, &GNUNET_GETOPT_set_one, &create_cfg}, | 353 | "cfg", |
354 | {'k', "key", "FILENAME", gettext_noop ("extract hostkey file from pre-computed hostkey list"), | 354 | gettext_noop ("create unique configuration files"), |
355 | GNUNET_YES, &GNUNET_GETOPT_set_string, &create_hostkey}, | 355 | &create_cfg), |
356 | {'n', "number", "NUMBER", gettext_noop ("number of unique configuration files to create, or number of the hostkey to extract"), | 356 | GNUNET_GETOPT_OPTION_STRING ('k', |
357 | GNUNET_YES, &GNUNET_GETOPT_set_uint, &create_no}, | 357 | "key", |
358 | {'t', "template", "FILENAME", gettext_noop ("configuration template"), | 358 | "FILENAME", |
359 | GNUNET_YES, &GNUNET_GETOPT_set_string, &create_cfg_template}, | 359 | gettext_noop ("extract hostkey file from pre-computed hostkey list"), |
360 | {'r', "run", "SERVICE", gettext_noop ("run the given service, wait on stdin for 'r' (restart) or 'q' (quit)"), | 360 | &create_hostkey), |
361 | GNUNET_YES, &GNUNET_GETOPT_set_string, &run_service_name}, | 361 | |
362 | GNUNET_GETOPT_OPTION_SET_UINT ('n', | ||
363 | "number", | ||
364 | "NUMBER", | ||
365 | gettext_noop ("number of unique configuration files to create, or number of the hostkey to extract"), | ||
366 | &create_no), | ||
367 | |||
368 | |||
369 | GNUNET_GETOPT_OPTION_STRING ('t', | ||
370 | "template", | ||
371 | "FILENAME", | ||
372 | gettext_noop ("configuration template"), | ||
373 | &create_cfg_template), | ||
374 | |||
375 | GNUNET_GETOPT_OPTION_STRING ('r', | ||
376 | "run", | ||
377 | "SERVICE", | ||
378 | gettext_noop ("run the given service, wait on stdin for 'r' (restart) or 'q' (quit)"), | ||
379 | &run_service_name), | ||
362 | GNUNET_GETOPT_OPTION_END | 380 | GNUNET_GETOPT_OPTION_END |
363 | }; | 381 | }; |
364 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 382 | 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; | |||
6 | static unsigned int nskip; | 6 | static unsigned int nskip; |
7 | static int result; | 7 | static int result; |
8 | 8 | ||
9 | |||
10 | |||
11 | |||
12 | |||
13 | /** | 9 | /** |
14 | * Main run function. | 10 | * Main run function. |
15 | * | 11 | * |
@@ -87,12 +83,11 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
87 | int main (int argc, char *argv[]) | 83 | int main (int argc, char *argv[]) |
88 | { | 84 | { |
89 | struct GNUNET_GETOPT_CommandLineOption option[] = { | 85 | struct GNUNET_GETOPT_CommandLineOption option[] = { |
90 | {'n', "num-keys", "COUNT", | 86 | GNUNET_GETOPT_OPTION_SET_UINT ('n', |
91 | gettext_noop ("list COUNT number of keys"), | 87 | "num-keys", |
92 | GNUNET_YES, &GNUNET_GETOPT_set_uint, &nkeys}, | 88 | "COUNT", |
93 | {'s', "skip", "COUNT", | 89 | gettext_noop ("list COUNT number of keys"), |
94 | gettext_noop ("skip COUNT number of keys in the beginning"), | 90 | &nkeys), |
95 | GNUNET_YES, &GNUNET_GETOPT_set_uint, &nskip}, | ||
96 | GNUNET_GETOPT_OPTION_END | 91 | GNUNET_GETOPT_OPTION_END |
97 | }; | 92 | }; |
98 | int ret; | 93 | int ret; |