GNUnet 0.21.1
gnunet_nat_service.h File Reference
#include "gnunet_util_lib.h"
Include dependency graph for gnunet_nat_service.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef 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 'valid' addresses changes. More...
 
typedef void(* GNUNET_NAT_ReversalCallback) (void *cls, const struct sockaddr *remote_addr, socklen_t remote_addrlen)
 Signature of the callback passed to GNUNET_NAT_register(). More...
 
typedef void(* GNUNET_NAT_TestCallback) (void *cls, enum GNUNET_NAT_StatusCode result)
 Function called to report success or failure for NAT configuration test. More...
 

Enumerations

enum  GNUNET_NAT_AddressClass {
  GNUNET_NAT_AC_NONE = 0 , GNUNET_NAT_AC_OTHER = 1 , GNUNET_NAT_AC_PRIVATE = 2 , GNUNET_NAT_AC_GLOBAL = 4 ,
  GNUNET_NAT_AC_GLOBAL_PRIVATE = 6 , GNUNET_NAT_AC_LAN = 8 , GNUNET_NAT_AC_LAN_PRIVATE = 10 , GNUNET_NAT_AC_WLAN = 16 ,
  GNUNET_NAT_AC_BT = 32 , GNUNET_NAT_AC_LOOPBACK = 64 , GNUNET_NAT_AC_EXTERN = 128 , GNUNET_NAT_AC_MANUAL = 256 ,
  GNUNET_NAT_AC_ANY = 65535
}
 Some addresses contain sensitive information or are not suitable for global distribution. More...
 
enum  GNUNET_NAT_StatusCode {
  GNUNET_NAT_ERROR_SUCCESS = GNUNET_OK , GNUNET_NAT_ERROR_IPC_FAILURE , GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR , GNUNET_NAT_ERROR_TIMEOUT ,
  GNUNET_NAT_ERROR_NOT_ONLINE , GNUNET_NAT_ERROR_UPNPC_NOT_FOUND , GNUNET_NAT_ERROR_UPNPC_FAILED , GNUNET_NAT_ERROR_UPNPC_TIMEOUT ,
  GNUNET_NAT_ERROR_UPNPC_PORTMAP_FAILED , GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_NOT_FOUND , GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_FAILED , GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_OUTPUT_INVALID ,
  GNUNET_NAT_ERROR_EXTERNAL_IP_ADDRESS_INVALID , GNUNET_NAT_ERROR_NO_VALID_IF_IP_COMBO , GNUNET_NAT_ERROR_HELPER_NAT_SERVER_NOT_FOUND , GNUNET_NAT_ERROR_NAT_TEST_START_FAILED ,
  GNUNET_NAT_ERROR_NAT_TEST_TIMEOUT , GNUNET_NAT_ERROR_NAT_REGISTER_FAILED , GNUNET_NAT_ERROR_HELPER_NAT_CLIENT_NOT_FOUND
}
 Error Types for the NAT subsystem (which can then later be converted/resolved to a string) More...
 
enum  GNUNET_NAT_Type {
  GNUNET_NAT_TYPE_NO_NAT = GNUNET_OK , GNUNET_NAT_TYPE_UNREACHABLE_NAT , GNUNET_NAT_TYPE_STUN_PUNCHED_NAT , GNUNET_NAT_TYPE_UPNP_NAT ,
  GNUNET_NAT_TYPE_UNKNOWN
}
 What the situation of the NAT connectivity. More...
 

Functions

struct GNUNET_NAT_HandleGNUNET_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...
 
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...
 
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...
 
struct GNUNET_NAT_STUN_HandleGNUNET_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. More...
 
void GNUNET_NAT_stun_make_request_cancel (struct GNUNET_NAT_STUN_Handle *rh)
 Cancel active STUN request. More...
 

Detailed Description

Author
Christian Grothoff
Milan Bouchet-Valat

Service for handling UPnP and NAT-PMP port forwarding and external IP address retrieval

Definition in file gnunet_nat_service.h.