#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_nat_service.h"
#include "gnunet_nat_auto_service.h"
Go to the source code of this file.
Functions | |
static void | test_finished () |
Test if all activities have finished, and if so, terminate. More... | |
static void | auto_conf_iter (void *cls, const char *section, const char *option, const char *value) |
Function to iterate over suggested changes options. More... | |
static void | auto_config_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *diff, enum GNUNET_NAT_StatusCode result, enum GNUNET_NAT_Type type) |
Function called with the result from the autoconfiguration. More... | |
static void | test_report_cb (void *cls, enum GNUNET_NAT_StatusCode result) |
Function called to report success or failure for NAT configuration test. More... | |
static void | do_shutdown (void *cls) |
Task run on shutdown. More... | |
static void | run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) |
Main function that will be run. More... | |
int | main (int argc, char *const argv[]) |
Main function of gnunet-nat-auto. More... | |
Variables | |
static int | global_ret |
Value to return from main(). More... | |
static struct GNUNET_NAT_AUTO_AutoHandle * | ah |
Handle to ongoing autoconfiguration. More... | |
static int | write_cfg |
If we do auto-configuration, should we write the result to a file? More... | |
static const char * | cfg_file |
Configuration filename. More... | |
static const struct GNUNET_CONFIGURATION_Handle * | cfg |
Original configuration. More... | |
static char * | section_name |
Adapter we are supposed to test. More... | |
static int | do_auto |
Should we run autoconfiguration? More... | |
static struct GNUNET_NAT_AUTO_Test * | nt |
Handle to a NAT test operation. More... | |
static int | use_udp |
Flag set to 1 if we use IPPROTO_UDP. More... | |
static int | use_tcp |
Flag set to 1 if we use IPPROTO_TCP. More... | |
static uint8_t | proto |
Protocol to use. More... | |
|
static |
Test if all activities have finished, and if so, terminate.
Definition at line 93 of file gnunet-nat-auto.c.
References ah, GNUNET_SCHEDULER_shutdown(), and nt.
Referenced by auto_config_cb(), run(), and test_report_cb().
|
static |
Function to iterate over suggested changes options.
cls | closure |
section | name of the section |
option | name of the option |
value | value of the option |
Definition at line 112 of file gnunet-nat-auto.c.
References GNUNET_CONFIGURATION_set_value_string(), and value.
Referenced by auto_config_cb().
|
static |
Function called with the result from the autoconfiguration.
cls | closure |
diff | minimal suggested changes to the original configuration to make it work (as best as we can) |
result | GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code |
type | what the situation of the NAT |
Definition at line 135 of file gnunet-nat-auto.c.
References _, ah, auto_conf_iter(), cfg, cfg_file, global_ret, GNUNET_break, GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_destroy(), GNUNET_CONFIGURATION_dup(), GNUNET_CONFIGURATION_is_dirty(), GNUNET_CONFIGURATION_iterate_section_values(), GNUNET_CONFIGURATION_load(), GNUNET_CONFIGURATION_set_value_string(), GNUNET_CONFIGURATION_write_diffs(), GNUNET_ERROR_TYPE_MESSAGE, GNUNET_log, GNUNET_NAT_AUTO_status2string(), GNUNET_NAT_TYPE_NO_NAT, GNUNET_NAT_TYPE_STUN_PUNCHED_NAT, GNUNET_NAT_TYPE_UNREACHABLE_NAT, GNUNET_NAT_TYPE_UPNP_NAT, GNUNET_NO, GNUNET_OK, GNUNET_OS_project_data_gnunet(), result, test_finished(), type, and write_cfg.
Referenced by run().
|
static |
Function called to report success or failure for NAT configuration test.
cls | closure |
result | GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code |
Definition at line 235 of file gnunet-nat-auto.c.
References GNUNET_NAT_AUTO_status2string(), nt, result, and test_finished().
Referenced by run().
|
static |
Task run on shutdown.
cls | NULL |
Definition at line 249 of file gnunet-nat-auto.c.
References ah, GNUNET_NAT_AUTO_autoconfig_cancel(), GNUNET_NAT_AUTO_test_stop(), and nt.
Referenced by run().
|
static |
Main function that will be run.
cls | closure |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
c | configuration |
Definition at line 273 of file gnunet-nat-auto.c.
References ah, auto_config_cb(), cfg, cfg_file, do_auto, do_shutdown(), global_ret, GNUNET_ERROR_TYPE_MESSAGE, GNUNET_log, GNUNET_NAT_AUTO_autoconfig_start(), GNUNET_NAT_AUTO_test_start(), GNUNET_SCHEDULER_add_shutdown(), nt, proto, section_name, test_finished(), test_report_cb(), use_tcp, and use_udp.
Referenced by main().
int main | ( | int | argc, |
char *const | argv[] | ||
) |
Main function of gnunet-nat-auto.
argc | number of command-line arguments |
argv | command line |
Definition at line 322 of file gnunet-nat-auto.c.
References _, do_auto, gettext_noop, global_ret, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_string(), GNUNET_OK, GNUNET_OS_project_data_gnunet(), GNUNET_PROGRAM_run(), options, run(), section_name, use_tcp, use_udp, and write_cfg.
|
static |
Definition at line 35 of file gnunet-nat-auto.c.
Referenced by auto_config_cb(), main(), and run().
|
static |
Handle to ongoing autoconfiguration.
Definition at line 40 of file gnunet-nat-auto.c.
Referenced by ah_error_handler(), auto_config_cb(), backchannel_check_run(), connect_peers_run(), do_shutdown(), do_udp_read(), GNUNET_NAT_AUTO_autoconfig_cancel(), GNUNET_NAT_AUTO_autoconfig_start(), GNUNET_NAT_autoconfig_cancel(), GNUNET_NAT_autoconfig_start(), handle_auto_result(), mq_error_handler(), next_phase(), process_if(), process_stun_reply(), result_callback(), reversal_test(), run(), set_external_ipv4(), start_peer_traits(), stop_peer_run(), test_external_ip(), test_finished(), test_icmp_client(), test_icmp_server(), test_local_ip(), test_nat_punched(), test_stun(), and test_upnpc().
|
static |
If we do auto-configuration, should we write the result to a file?
Definition at line 46 of file gnunet-nat-auto.c.
Referenced by auto_config_cb(), and main().
|
static |
Configuration filename.
Definition at line 51 of file gnunet-nat-auto.c.
Referenced by auto_config_cb(), and run().
|
static |
Original configuration.
Definition at line 56 of file gnunet-nat-auto.c.
Referenced by auto_config_cb(), and run().
|
static |
Adapter we are supposed to test.
Definition at line 61 of file gnunet-nat-auto.c.
Referenced by communicator_start(), GNUNET_NAT_AUTO_test_start(), main(), and run().
|
static |
Should we run autoconfiguration?
Definition at line 66 of file gnunet-nat-auto.c.
|
static |
Handle to a NAT test operation.
Definition at line 71 of file gnunet-nat-auto.c.
Referenced by connect_peers_run(), create_address_entry(), do_shutdown(), GNUNET_HELLO_sign_address(), GNUNET_TRANSPORT_application_validate(), GNUNET_TRANSPORT_communicator_address_add(), GNUNET_TRANSPORT_communicator_mq_add(), gnunet_try_connect(), nat_address_cb(), notify_monitor(), notify_monitors(), run(), sock_read(), test_finished(), and test_report_cb().
|
static |
Flag set to 1 if we use IPPROTO_UDP.
Definition at line 76 of file gnunet-nat-auto.c.
|
static |
Flag set to 1 if we use IPPROTO_TCP.
Definition at line 81 of file gnunet-nat-auto.c.
|
static |
Protocol to use.
Definition at line 86 of file gnunet-nat-auto.c.
Referenced by add_services(), gns_string_to_value(), GNUNET_NAT_AUTO_test_start(), GNUNET_NAT_register(), make_up_icmpv4_payload(), make_up_icmpv6_payload(), resolver_getservbyname(), run(), setup_fresh_address(), and store_service().