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 | address_cb (void *cls, void **app_ctx, int add_remove, enum GNUNET_NAT_AddressClass ac, const struct sockaddr *addr, socklen_t addrlen) |
Signature of the callback passed to GNUNET_NAT_register() for a function to call whenever our set of 'valid' addresses changes. More... | |
static void | reversal_cb (void *cls, const struct sockaddr *addr, socklen_t remote_addrlen) |
Signature of the callback passed to GNUNET_NAT_register(). More... | |
static void | do_shutdown (void *cls) |
Task run on shutdown. More... | |
static void | stun_read_task (void *cls) |
Task to receive incoming packets for STUN processing. 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. More... | |
Variables | |
static int | global_ret |
Value to return from main(). More... | |
static char * | section_name |
Name of section in configuration file to use for additional options. More... | |
static int | use_udp |
Flag set to 1 if we use IPPROTO_UDP. More... | |
static int | listen_reversal |
Flag set to 1 if we are to listen for connection reversal requests. More... | |
static int | use_tcp |
Flag set to 1 if we use IPPROTO_TCP. More... | |
static uint8_t | proto |
Protocol to use. More... | |
static char * | local_addr |
Local address to use for connection reversal request. More... | |
static char * | remote_addr |
Remote address to use for connection reversal request. More... | |
static int | do_stun |
Should we actually bind to #bind_addr and receive and process STUN requests? More... | |
static struct GNUNET_NAT_Handle * | nh |
Handle to NAT operation. More... | |
static struct GNUNET_NETWORK_Handle * | ls |
Listen socket for STUN processing. More... | |
static struct GNUNET_SCHEDULER_Task * | rtask |
Task for reading STUN packets. More... | |
|
static |
Test if all activities have finished, and if so, terminate.
Definition at line 98 of file gnunet-nat.c.
References GNUNET_SCHEDULER_shutdown(), nh, and rtask.
Referenced by run().
|
static |
Signature of the callback passed to GNUNET_NAT_register() for a function to call whenever our set of 'valid' addresses changes.
cls | closure, NULL | |
[in,out] | app_ctx | location where the app can store stuff on add and retrieve it on remove |
add_remove | GNUNET_YES to add a new public IP address, GNUNET_NO to remove a previous (now invalid) one | |
ac | address class the address belongs to | |
addr | either the previous or the new public IP address | |
addrlen | actual length of the addr |
Definition at line 122 of file gnunet-nat.c.
References GNUNET_a2s().
Referenced by run().
|
static |
Signature of the callback passed to GNUNET_NAT_register().
for a function to call whenever someone asks us to do connection reversal.
cls | closure, NULL |
remote_addr | public IP address of the other peer |
remote_addrlen | actual length of the remote_addr |
Definition at line 150 of file gnunet-nat.c.
References GNUNET_a2s(), GNUNET_ERROR_TYPE_MESSAGE, and GNUNET_log.
Referenced by run().
|
static |
Task run on shutdown.
cls | NULL |
Definition at line 166 of file gnunet-nat.c.
References GNUNET_NAT_unregister(), GNUNET_NETWORK_socket_close(), GNUNET_SCHEDULER_cancel(), ls, nh, and rtask.
Referenced by run().
|
static |
Task to receive incoming packets for STUN processing.
Definition at line 190 of file gnunet-nat.c.
References global_ret, GNUNET_break, GNUNET_NAT_stun_handle_packet(), GNUNET_NETWORK_socket_recvfrom(), GNUNET_NETWORK_socket_recvfrom_amount(), GNUNET_SCHEDULER_add_read_net(), GNUNET_SCHEDULER_shutdown(), GNUNET_TIME_UNIT_FOREVER_REL, ls, nh, ret, rtask, size, and stun_read_task().
Referenced by run(), and stun_read_task().
|
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 242 of file gnunet-nat.c.
References address_cb(), do_shutdown(), do_stun, global_ret, GNUNET_a2s(), GNUNET_assert, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_MESSAGE, GNUNET_free, GNUNET_log, GNUNET_NAT_register(), GNUNET_NAT_request_reversal(), GNUNET_NETWORK_socket_bind(), GNUNET_NETWORK_socket_create(), GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_read_net(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_strdup, GNUNET_STRINGS_parse_socket_addr(), GNUNET_SYSERR, GNUNET_TIME_UNIT_FOREVER_REL, listen_reversal, local_addr, ls, nh, proto, remote_addr, ret, reversal_cb(), rtask, section_name, stun_read_task(), test_finished(), use_tcp, and use_udp.
Referenced by main().
int main | ( | int | argc, |
char *const | argv[] | ||
) |
Main function of gnunet-nat.
argc | number of command-line arguments |
argv | command line |
Definition at line 415 of file gnunet-nat.c.
References _, do_stun, 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(), listen_reversal, local_addr, options, remote_addr, run(), section_name, use_tcp, and use_udp.
|
static |
Definition at line 34 of file gnunet-nat.c.
Referenced by main(), run(), and stun_read_task().
|
static |
Name of section in configuration file to use for additional options.
Definition at line 40 of file gnunet-nat.c.
|
static |
Flag set to 1 if we use IPPROTO_UDP.
Definition at line 45 of file gnunet-nat.c.
|
static |
Flag set to 1 if we are to listen for connection reversal requests.
Definition at line 50 of file gnunet-nat.c.
|
static |
Flag set to 1 if we use IPPROTO_TCP.
Definition at line 55 of file gnunet-nat.c.
|
static |
|
static |
Local address to use for connection reversal request.
Definition at line 65 of file gnunet-nat.c.
Referenced by client_quic_init(), connection_feed_data(), connection_init(), connection_on_read(), create_conn(), main(), mq_init(), run(), server_read_pkt(), and sock_read().
|
static |
Remote address to use for connection reversal request.
Definition at line 70 of file gnunet-nat.c.
Referenced by client_quic_init(), connection_feed_data(), connection_init(), connection_on_read(), main(), mq_init(), run(), and server_read_pkt().
|
static |
Should we actually bind to #bind_addr and receive and process STUN requests?
Definition at line 75 of file gnunet-nat.c.
|
static |
Handle to NAT operation.
Definition at line 80 of file gnunet-nat.c.
Referenced by do_shutdown(), run(), stun_read_task(), and test_finished().
|
static |
Listen socket for STUN processing.
Definition at line 85 of file gnunet-nat.c.
Referenced by bind_v4(), bind_v6(), do_shutdown(), new_service_channel(), run(), setup_service(), start_process(), and stun_read_task().
|
static |
Task for reading STUN packets.
Definition at line 90 of file gnunet-nat.c.
Referenced by do_shutdown(), run(), stun_read_task(), and test_finished().