36#ifndef GNUNET_NAT_SERVICE_H
37#define GNUNET_NAT_SERVICE_H
290 const struct sockaddr *addr,
306 socklen_t remote_addrlen);
337 const char *config_section,
339 unsigned int num_addrs,
340 const struct sockaddr **addrs,
341 const socklen_t *addrlens,
357 unsigned int address_length);
393 const struct sockaddr_in *local_sa,
394 const struct sockaddr_in *remote_sa);
439 const struct sockaddr *sender_addr,
440 size_t sender_addr_len,
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
static uint16_t port
Port number.
static char * data
The data to insert into the dht.
static size_t data_size
Number of bytes in data.
static uint8_t proto
Protocol to use.
static char * remote_addr
Remote address to use for connection reversal request.
static int result
Global testing status.
static void reversal_callback(void *cls, const struct sockaddr_in *ra)
We got a connection reversal request from another peer.
struct GNUNET_NAT_Handle * nh
Handle for connect to the NAT service.
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 respons...
void(* GNUNET_NAT_ReversalCallback)(void *cls, const struct sockaddr *remote_addr, socklen_t remote_addrlen)
Signature of the callback passed to GNUNET_NAT_register().
GNUNET_NAT_StatusCode
Error Types for the NAT subsystem (which can then later be converted/resolved to a string)
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...
void GNUNET_NAT_unregister(struct GNUNET_NAT_Handle *nh)
Stop port redirection and public IP address detection for the given handle.
struct GNUNET_NAT_STUN_Handle * GNUNET_NAT_stun_make_request(const char *server, uint16_t port, struct GNUNET_NETWORK_Handle *sock, GNUNET_NAT_TestCallback cb, void *cb_cls)
Make Generic STUN request.
void(* GNUNET_NAT_TestCallback)(void *cls, enum GNUNET_NAT_StatusCode result)
Function called to report success or failure for NAT configuration test.
void GNUNET_NAT_stun_make_request_cancel(struct GNUNET_NAT_STUN_Handle *rh)
Cancel active STUN request.
GNUNET_NAT_Type
What the situation of the NAT connectivity.
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.
void(* GNUNET_NAT_AddressCallback)(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 ...
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.
GNUNET_NAT_AddressClass
Some addresses contain sensitive information or are not suitable for global distribution.
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.
@ GNUNET_NAT_ERROR_UPNPC_NOT_FOUND
upnpc command not found
@ GNUNET_NAT_ERROR_NOT_ONLINE
detected that we are offline
@ GNUNET_NAT_ERROR_UPNPC_TIMEOUT
‘upnpc’ command took too long, process killed
@ GNUNET_NAT_ERROR_SUCCESS
Just the default.
@ GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_OUTPUT_INVALID
‘external-ip’ command output invalid
@ GNUNET_NAT_ERROR_UPNPC_FAILED
Failed to run upnpc command.
@ GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_FAILED
Failed to run external-ip command.
@ GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR
Failure in network subsystem, check permissions.
@ GNUNET_NAT_ERROR_HELPER_NAT_CLIENT_NOT_FOUND
@ GNUNET_NAT_ERROR_UPNPC_PORTMAP_FAILED
‘upnpc’ command failed to establish port mapping
@ GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_NOT_FOUND
‘external-ip’ command not found
@ GNUNET_NAT_ERROR_NAT_REGISTER_FAILED
NAT test failed to initiate.
@ GNUNET_NAT_ERROR_IPC_FAILURE
IPC Failure.
@ GNUNET_NAT_ERROR_NO_VALID_IF_IP_COMBO
Could not determine interface with internal/local network address.
@ GNUNET_NAT_ERROR_HELPER_NAT_SERVER_NOT_FOUND
No working gnunet-helper-nat-server found.
@ GNUNET_NAT_ERROR_EXTERNAL_IP_ADDRESS_INVALID
"no valid address was returned by `external-ip'"
@ GNUNET_NAT_ERROR_NAT_TEST_START_FAILED
NAT test could not be initialized.
@ GNUNET_NAT_ERROR_NAT_TEST_TIMEOUT
NAT test timeout.
@ GNUNET_NAT_ERROR_TIMEOUT
test timed out
@ GNUNET_NAT_TYPE_UPNP_NAT
We can traverse using UPNP.
@ GNUNET_NAT_TYPE_UNKNOWN
We know nothing about the NAT.
@ GNUNET_NAT_TYPE_UNREACHABLE_NAT
We are under a NAT but cannot traverse it.
@ GNUNET_NAT_TYPE_NO_NAT
We have a direct connection.
@ GNUNET_NAT_TYPE_STUN_PUNCHED_NAT
We can traverse using STUN.
@ GNUNET_NAT_AC_LAN_PRIVATE
Addresses useful in the local wired network, i.e.
@ GNUNET_NAT_AC_LAN
Addresses useful in the local wired network, i.e.
@ GNUNET_NAT_AC_GLOBAL_PRIVATE
Addresses that are global and are sensitive (i.e.
@ GNUNET_NAT_AC_GLOBAL
Addresses that are global (i.e.
@ GNUNET_NAT_AC_PRIVATE
Flag for addresses that are highly sensitive (i.e.
@ GNUNET_NAT_AC_EXTERN
Addresses that should be our external IP address on the outside of a NAT.
@ GNUNET_NAT_AC_ANY
Bitmask for "any" address.
@ GNUNET_NAT_AC_WLAN
Addresses useful in the local wireless network, i.e.
@ GNUNET_NAT_AC_OTHER
Addresses that fall into no other category (i.e.
@ GNUNET_NAT_AC_BT
Addresses useful in the local bluetooth network.
@ GNUNET_NAT_AC_NONE
No address.
@ GNUNET_NAT_AC_MANUAL
Addresses that were manually configured by the user.
@ GNUNET_NAT_AC_LOOPBACK
Loopback addresses, only useful under special circumstances.
Handle for active NAT registrations.
void * callback_cls
Closure for the various callbacks.
GNUNET_NAT_AddressCallback address_callback
Function to call when our addresses change.
Handle to a request given to the resolver.
GNUNET_NAT_TestCallback cb
Function to call when a error occurs.
void * cb_cls
Closure for cb.
struct GNUNET_NETWORK_Handle * sock
Handle to the listen socket.