Go to the source code of this file.
Data Structures | |
struct | AddrEntry |
Entry in DLL of addresses of this peer. More... | |
struct | GNUNET_NAT_Handle |
Handle for active NAT registrations. More... | |
Functions | |
static void | do_connect (void *cls) |
Task to connect to the NAT service. More... | |
static void | reconnect (struct GNUNET_NAT_Handle *nh) |
Task to connect to the NAT service. More... | |
static int | check_connection_reversal_request (void *cls, const struct GNUNET_NAT_ConnectionReversalRequestedMessage *crm) |
Check connection reversal request. More... | |
static void | handle_connection_reversal_request (void *cls, const struct GNUNET_NAT_ConnectionReversalRequestedMessage *crm) |
Handle connection reversal request. More... | |
static int | check_address_change_notification (void *cls, const struct GNUNET_NAT_AddressChangeNotificationMessage *acn) |
Check address change notification. More... | |
static void | handle_address_change_notification (void *cls, const struct GNUNET_NAT_AddressChangeNotificationMessage *acn) |
Handle connection reversal request. More... | |
static void | mq_error_handler (void *cls, enum GNUNET_MQ_Error error) |
Handle queue errors by reconnecting to NAT. More... | |
struct GNUNET_NAT_Handle * | GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *config_section, uint8_t proto, unsigned int num_addrs, const struct sockaddr **addrs, const socklen_t *addrlens, GNUNET_NAT_AddressCallback address_callback, GNUNET_NAT_ReversalCallback reversal_callback, void *callback_cls) |
Attempt to enable port redirection and detect public IP address contacting UPnP or NAT-PMP routers on the local network. More... | |
void | GNUNET_NAT_add_global_address (struct GNUNET_NAT_Handle *nh, char *addr, unsigned int address_length) |
Add global address to the list of addresses and notify clients. More... | |
static enum GNUNET_GenericReturnValue | test_stun_packet (const void *data, size_t len) |
Check if an incoming message is a STUN message. More... | |
int | GNUNET_NAT_stun_handle_packet (struct GNUNET_NAT_Handle *nh, const struct sockaddr *sender_addr, size_t sender_addr_len, const void *data, size_t data_size) |
Handle an incoming STUN message. More... | |
int | GNUNET_NAT_test_address (struct GNUNET_NAT_Handle *nh, const void *addr, socklen_t addrlen) |
Test if the given address is (currently) a plausible IP address for this peer. More... | |
int | GNUNET_NAT_request_reversal (struct GNUNET_NAT_Handle *nh, const struct sockaddr_in *local_sa, const struct sockaddr_in *remote_sa) |
We learned about a peer (possibly behind NAT) so run the gnunet-nat-client to send dummy ICMP responses to cause that peer to connect to us (connection reversal). More... | |
void | GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *nh) |
Stop port redirection and public IP address detection for the given handle. More... | |
Service for handling UPnP and NAT-PMP port forwarding and external IP address retrieval
Definition in file nat_api.c.
|
static |
Task to connect to the NAT service.
cls | our struct GNUNET_NAT_Handle * |
Definition at line 329 of file nat_api.c.
References GNUNET_NAT_Handle::cfg, env, GNUNET_CLIENT_connect(), GNUNET_MESSAGE_TYPE_NAT_ADDRESS_CHANGE, GNUNET_MESSAGE_TYPE_NAT_CONNECTION_REVERSAL_REQUESTED, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg_copy(), GNUNET_MQ_send(), handlers, GNUNET_NAT_Handle::mq, mq_error_handler(), nh, reconnect(), GNUNET_NAT_Handle::reconnect_task, and GNUNET_NAT_Handle::reg.
Referenced by GNUNET_NAT_register(), and reconnect().
|
static |
Task to connect to the NAT service.
nh | handle to reconnect |
Definition at line 140 of file nat_api.c.
References AddrEntry::ac, GNUNET_NAT_Handle::address_callback, AddrEntry::addrlen, GNUNET_NAT_Handle::ae_head, GNUNET_NAT_Handle::ae_tail, AddrEntry::app_ctx, GNUNET_NAT_Handle::callback_cls, do_connect(), GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_MQ_destroy(), GNUNET_NO, GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_STD_BACKOFF, GNUNET_NAT_Handle::mq, nh, GNUNET_NAT_Handle::reconnect_delay, and GNUNET_NAT_Handle::reconnect_task.
Referenced by do_connect(), handle_address_change_notification(), and mq_error_handler().
|
static |
Check connection reversal request.
cls | our struct GNUNET_NAT_Handle |
crm | the message |
Definition at line 174 of file nat_api.c.
References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, GNUNET_NAT_ConnectionReversalRequestedMessage::header, and GNUNET_MessageHeader::size.
|
static |
Handle connection reversal request.
cls | our struct GNUNET_NAT_Handle |
crm | the message |
Definition at line 194 of file nat_api.c.
References GNUNET_NAT_Handle::callback_cls, nh, and GNUNET_NAT_Handle::reversal_callback.
|
static |
Check address change notification.
cls | our struct GNUNET_NAT_Handle |
acn | the message |
Definition at line 214 of file nat_api.c.
References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, GNUNET_NAT_AddressChangeNotificationMessage::header, and GNUNET_MessageHeader::size.
|
static |
Handle connection reversal request.
cls | our struct GNUNET_NAT_Handle |
acn | the message |
Definition at line 257 of file nat_api.c.
References AddrEntry::ac, GNUNET_NAT_AddressChangeNotificationMessage::add_remove, GNUNET_NAT_AddressChangeNotificationMessage::addr_class, GNUNET_NAT_Handle::address_callback, AddrEntry::addrlen, GNUNET_NAT_Handle::ae_head, GNUNET_NAT_Handle::ae_tail, AddrEntry::app_ctx, GNUNET_NAT_Handle::callback_cls, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_malloc, GNUNET_memcpy, GNUNET_YES, GNUNET_NAT_AddressChangeNotificationMessage::header, AddrEntry::next, nh, reconnect(), and GNUNET_MessageHeader::size.
|
static |
Handle queue errors by reconnecting to NAT.
cls | the struct GNUNET_NAT_Handle * |
error | details about the error |
Definition at line 314 of file nat_api.c.
References nh, and reconnect().
Referenced by do_connect().
|
static |
Check if an incoming message is a STUN message.
data | the packet |
len | the length of the packet in data |
Definition at line 497 of file nat_api.c.
References stun_attr::attr, data, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NO, GNUNET_OK, stun_attr::len, stun_header::magic, stun_header::msglen, stun_header::msgtype, and STUN_MAGIC_COOKIE.
Referenced by GNUNET_NAT_stun_handle_packet().