runs the gnunet-helper-nat-server More...
Go to the source code of this file.
Data Structures | |
struct | HelperContext |
Information we keep per NAT helper process. More... | |
Functions | |
static void | restart_nat_server (void *cls) |
Task that restarts the gnunet-helper-nat-server process after a crash after a certain delay. More... | |
static void | try_again (struct HelperContext *h) |
Try again starting the helper later. More... | |
static void | nat_server_read (void *cls) |
We have been notified that gnunet-helper-nat-server has written something to stdout. More... | |
struct HelperContext * | GN_start_gnunet_nat_server_ (const struct in_addr *internal_address, GN_ReversalCallback cb, void *cb_cls, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Start the gnunet-helper-nat-server and process incoming requests. More... | |
void | GN_stop_gnunet_nat_server_ (struct HelperContext *h) |
Start the gnunet-helper-nat-server and process incoming requests. More... | |
int | GN_request_connection_reversal (const struct in_addr *internal_address, uint16_t internal_port, const struct in_addr *remote_v4, const struct GNUNET_CONFIGURATION_Handle *cfg) |
We want to connect to a peer that is behind NAT. More... | |
runs the gnunet-helper-nat-server
Definition in file gnunet-service-nat_helper.c.
|
static |
Task that restarts the gnunet-helper-nat-server process after a crash after a certain delay.
cls | a struct HelperContext |
Definition at line 205 of file gnunet-service-nat_helper.c.
References _, GNUNET_ARM_Handle::cfg, GNUNET_assert, GNUNET_DISK_PF_BLOCKING_RW, GNUNET_DISK_pipe(), GNUNET_DISK_pipe_close(), GNUNET_DISK_pipe_close_end(), GNUNET_DISK_PIPE_END_READ, GNUNET_DISK_PIPE_END_WRITE, GNUNET_DISK_pipe_handle(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_log_strerror, GNUNET_OS_check_helper_binary(), GNUNET_OS_get_suid_binary_path(), GNUNET_OS_INHERIT_STD_NONE, GNUNET_OS_start_process(), GNUNET_SCHEDULER_add_read_file(), GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD, GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, h, nat_server_read(), and try_again().
Referenced by GN_start_gnunet_nat_server_(), and try_again().
|
static |
Try again starting the helper later.
h | context of the helper |
Definition at line 100 of file gnunet-service-nat_helper.c.
References GNUNET_assert, GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_STD_BACKOFF, h, and restart_nat_server().
Referenced by nat_server_read(), and restart_nat_server().
|
static |
We have been notified that gnunet-helper-nat-server has written something to stdout.
Handle the output, then reschedule this function to be called again once more is available.
cls | the struct HelperContext |
Definition at line 118 of file gnunet-service-nat_helper.c.
References _, GNUNET_DISK_file_read(), GNUNET_DISK_pipe_close(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_log_from_strerror, GNUNET_OS_process_destroy(), GNUNET_OS_process_kill(), GNUNET_OS_process_wait(), GNUNET_SCHEDULER_add_read_file(), GNUNET_TERM_SIG, GNUNET_TIME_UNIT_FOREVER_REL, h, nat_server_read(), port, and try_again().
Referenced by nat_server_read(), and restart_nat_server().
struct HelperContext * GN_start_gnunet_nat_server_ | ( | const struct in_addr * | internal_address, |
GN_ReversalCallback | cb, | ||
void * | cb_cls, | ||
const struct GNUNET_CONFIGURATION_Handle * | cfg | ||
) |
Start the gnunet-helper-nat-server and process incoming requests.
internal_address | |
cb | function to call if we receive a request |
cb_cls | closure for cb |
cfg | handle to the GNUnet configuration |
Definition at line 269 of file gnunet-service-nat_helper.c.
References HelperContext::cb, HelperContext::cb_cls, cfg, GNUNET_ARM_Handle::cfg, GN_stop_gnunet_nat_server_(), GNUNET_new, h, HelperContext::internal_address, and restart_nat_server().
Referenced by run_scan().
void GN_stop_gnunet_nat_server_ | ( | struct HelperContext * | h | ) |
Start the gnunet-helper-nat-server and process incoming requests.
h | helper context to stop |
Definition at line 298 of file gnunet-service-nat_helper.c.
References GNUNET_DISK_pipe_close(), GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log_strerror, GNUNET_OS_process_destroy(), GNUNET_OS_process_kill(), GNUNET_OS_process_wait(), GNUNET_SCHEDULER_cancel(), GNUNET_TERM_SIG, and h.
Referenced by free_lal(), and GN_start_gnunet_nat_server_().
int GN_request_connection_reversal | ( | const struct in_addr * | internal_address, |
uint16_t | internal_port, | ||
const struct in_addr * | remote_v4, | ||
const struct GNUNET_CONFIGURATION_Handle * | cfg | ||
) |
We want to connect to a peer that is behind NAT.
Run the gnunet-helper-nat-client to send dummy ICMP responses to cause that peer to connect to us (connection reversal).
internal_address | out internal address to use |
internal_port | port to use |
remote_v4 | the address of the peer (IPv4-only) |
cfg | handle to the GNUnet configuration |
Definition at line 339 of file gnunet-service-nat_helper.c.
References cfg, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_log_strerror, GNUNET_OK, GNUNET_OS_get_suid_binary_path(), GNUNET_OS_INHERIT_STD_NONE, GNUNET_OS_process_destroy(), GNUNET_OS_process_wait(), GNUNET_OS_start_process(), GNUNET_snprintf(), and GNUNET_SYSERR.
Referenced by handle_request_connection_reversal().