Library for NAT traversal related functionality. More...
Go to the source code of this file.
Macros | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "util-nat", __VA_ARGS__) |
#define | SEND_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS, 10) |
#define | TIMEOUT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 100) |
#define | RTT_DIFF GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 150) |
Difference of the average RTT for the DistanceVector calculate by us and the target we are willing to accept for starting the burst. More... | |
Functions | |
struct GNUNET_BurstSync * | GNUNET_get_burst_sync_msg (struct GNUNET_TIME_Relative rtt_average, enum GNUNET_GenericReturnValue sync_ready) |
Create GNUNET_BurstSync message. More... | |
void | GNUNET_is_burst_ready (struct GNUNET_TIME_Relative rtt_average, struct GNUNET_BurstSync *burst_sync, GNUNET_SCHEDULER_TaskCallback task, struct GNUNET_StartBurstCls *task_cls) |
Checks if we are ready and starts burst when we and the other peer is ready. More... | |
void | GNUNET_stop_burst (struct GNUNET_NETWORK_Handle *do_not_touch) |
Method to stop all sockets we established to the other peer. More... | |
static void | sock_read (void *cls) |
Socket read task. More... | |
static struct sockaddr * | udp_address_to_sockaddr (const char *bindto, socklen_t *sock_len) |
Convert UDP bind specification to a struct sockaddr * More... | |
static void | timeout_task_cb (void *cls) |
static void | read_send (void *cls) |
struct GNUNET_SCHEDULER_Task * | GNUNET_get_udp_socket (struct GNUNET_UdpSocketInfo *sock_info, GNUNET_NotifyUdpSocket nus) |
Method to get a UDP socket for a peer that is natted. More... | |
Variables | |
static struct GNUNET_UdpSocketInfo * | sock_infos_head |
static struct GNUNET_UdpSocketInfo * | sock_infos_tail |
static struct GNUNET_SCHEDULER_Task * | read_send_task |
unsigned int | udp_port |
unsigned int | nr_open_sockets |
Maximum of open sockets. More... | |
Library for NAT traversal related functionality.
Definition in file nat.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "util-nat", __VA_ARGS__) |
#define SEND_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS, 10) |
#define TIMEOUT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 100) |
#define RTT_DIFF GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 150) |
Difference of the average RTT for the DistanceVector calculate by us and the target we are willing to accept for starting the burst.
|
static |
Socket read task.
cls | NULL |
Definition at line 151 of file nat.c.
References GNUNET_UdpSocketInfo::actual_address, GNUNET_a2s(), GNUNET_break_op, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_log_strerror, GNUNET_NETWORK_socket_recvfrom(), GNUNET_stop_burst(), GNUNET_BurstMessage::local_port, GNUNET_UdpSocketInfo::nus, GNUNET_UdpSocketInfo::port, GNUNET_UdpSocketInfo::read_task, and GNUNET_UdpSocketInfo::udp_sock.
Referenced by read_send().
|
static |
Convert UDP bind specification to a struct sockaddr *
bindto | bind specification to convert | |
[out] | sock_len | set to the length of the address |
Definition at line 226 of file nat.c.
References dummy, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_memdup, GNUNET_strdup, port, and start.
Referenced by GNUNET_get_udp_socket(), and read_send().
|
static |
Definition at line 318 of file nat.c.
References GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_NETWORK_socket_close(), GNUNET_SCHEDULER_cancel(), nr_open_sockets, GNUNET_UdpSocketInfo::read_task, sock_infos_head, sock_infos_tail, and GNUNET_UdpSocketInfo::udp_sock.
Referenced by read_send().
|
static |
Definition at line 343 of file nat.c.
References address, GNUNET_UdpSocketInfo::address, GNUNET_UdpSocketInfo::bind_address, GNUNET_a2s(), GNUNET_asprintf(), GNUNET_assert, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_log_strerror, GNUNET_memcpy, GNUNET_NETWORK_socket_bind(), GNUNET_NETWORK_socket_close(), GNUNET_NETWORK_socket_create(), GNUNET_NETWORK_socket_sendto(), GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_read_net(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_relative_multiply(), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_BurstMessage::local_port, nr_open_sockets, GNUNET_UdpSocketInfo::port, read_send(), read_send_task, GNUNET_UdpSocketInfo::read_task, SEND_DELAY, sock_infos_head, sock_infos_tail, sock_read(), GNUNET_UdpSocketInfo::std_port, TIMEOUT_DELAY, GNUNET_UdpSocketInfo::timeout_task, timeout_task_cb(), udp_address_to_sockaddr(), udp_port, GNUNET_UdpSocketInfo::udp_sock, and udp_sock.
Referenced by GNUNET_get_udp_socket(), and read_send().
|
static |
Definition at line 46 of file nat.c.
Referenced by GNUNET_stop_burst(), read_send(), and timeout_task_cb().
|
static |
Definition at line 48 of file nat.c.
Referenced by GNUNET_stop_burst(), read_send(), and timeout_task_cb().
|
static |
Definition at line 50 of file nat.c.
Referenced by GNUNET_get_udp_socket(), GNUNET_stop_burst(), and read_send().
unsigned int udp_port |
Definition at line 52 of file nat.c.
Referenced by GNUNET_get_udp_socket(), and read_send().
unsigned int nr_open_sockets |
Maximum of open sockets.
Definition at line 57 of file nat.c.
Referenced by GNUNET_get_udp_socket(), read_send(), and timeout_task_cb().