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 /src/nat/gnunet-nat.c | |
parent | f51f3438fa3451ee758152e53fe823780fb1e261 (diff) | |
download | gnunet-796d0e5aa54ed99dd00fae26982a0e99f9d99f8e.tar.gz gnunet-796d0e5aa54ed99dd00fae26982a0e99f9d99f8e.zip |
Porting 'nat'.
Diffstat (limited to 'src/nat/gnunet-nat.c')
-rw-r--r-- | src/nat/gnunet-nat.c | 65 |
1 files changed, 41 insertions, 24 deletions
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 != |