GNUnet  0.10.x
gnunet_nat_service.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2007-2017 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19 */
20 
36 #ifndef GNUNET_NAT_SERVICE_H
37 #define GNUNET_NAT_SERVICE_H
38 
39 #include "gnunet_util_lib.h"
40 
41 
53 {
54 
59 
65 
71 
76 
82 
90 
97 
104 
110 
115 
124 
130 
135 
136 };
137 
138 
143 {
148 
153 
158 
163 
168 
173 
178 
183 
188 
193 
198 
203 
208 
213 
218 
223 
228 
233 
238 
239 };
240 
241 
242 
247 {
252 
257 
262 
267 
272 
273 };
274 
275 
276 
290 typedef void
292  void **app_ctx,
293  int add_remove,
295  const struct sockaddr *addr,
296  socklen_t addrlen);
297 
298 
308 typedef void
310  const struct sockaddr *remote_addr,
311  socklen_t remote_addrlen);
312 
313 
317 struct GNUNET_NAT_Handle;
318 
319 
340 struct GNUNET_NAT_Handle *
342  const char *config_section,
343  uint8_t proto,
344  unsigned int num_addrs,
345  const struct sockaddr **addrs,
346  const socklen_t *addrlens,
349  void *callback_cls);
350 
351 
365 int
367  const void *addr,
368  socklen_t addrlen);
369 
370 
383 int
385  const struct sockaddr_in *local_sa,
386  const struct sockaddr_in *remote_sa);
387 
388 
396 void
398 
399 
423 int
425  const struct sockaddr *sender_addr,
426  size_t sender_addr_len,
427  const void *data,
428  size_t data_size);
429 
430 
437 
438 
446 typedef void
449 
450 
465 struct GNUNET_NAT_STUN_Handle *
466 GNUNET_NAT_stun_make_request (const char *server,
467  uint16_t port,
468  struct GNUNET_NETWORK_Handle *sock,
470  void *cb_cls);
471 
472 
479 void
481 
482 
483 #endif
484  /* end of group */
486 
487 /* end of gnunet_nat_service.h */
NAT test failed to initiate.
Handle for active NAT registrations.
Definition: nat_api.c:72
Addresses that were manually configured by the user.
GNUNET_NAT_AddressClass
Some addresses contain sensitive information or are not suitable for global distribution.
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...
Definition: nat_api.c:655
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.
Definition: nat_api_stun.c:212
detected that we are offline
`upnpc&#39; command failed to establish port mapping
Bitmask for "any" address.
void GNUNET_NAT_stun_make_request_cancel(struct GNUNET_NAT_STUN_Handle *rh)
Cancel active STUN request.
Definition: nat_api_stun.c:248
static uint8_t proto
Protocol to use.
Definition: gnunet-nat.c:60
void * cb_cls
Closure for cb.
Definition: nat_api_stun.c:82
Handle to a request given to the resolver.
Definition: nat_api_stun.c:56
`upnpc&#39; command took too long, process killed
Addresses that should be our external IP address on the outside of a NAT.
void(* GNUNET_NAT_TestCallback)(void *cls, enum GNUNET_NAT_StatusCode result)
Function called to report success or failure for NAT configuration test.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
void * callback_cls
Closure for the various callbacks.
Definition: nat_api.c:113
We are under a NAT but cannot traverse it.
Addresses useful in the local wired network, i.e.
`external-ip&#39; command output invalid
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.
Definition: nat_api.c:623
Addresses useful in the local bluetooth network.
Could not determine interface with internal/local network address.
void(* GNUNET_NAT_ReversalCallback)(void *cls, const struct sockaddr *remote_addr, socklen_t remote_addrlen)
Signature of the callback passed to GNUNET_NAT_register().
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 ...
static void reversal_callback(void *cls, const struct sockaddr_in *ra)
We got a connection reversal request from another peer.
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.
Definition: nat_api.c:581
GNUNET_NAT_StatusCode
Error Types for the NAT subsystem (which can then later be converted/resolved to a string) ...
struct GNUNET_NETWORK_Handle * sock
Handle to the listen socket.
Definition: nat_api_stun.c:67
static int result
Global testing status.
No working gnunet-helper-nat-server found.
Loopback addresses, only useful under special cirumstances.
static struct GNUNET_NAT_Handle * nh
Handle to NAT operation.
Definition: gnunet-nat.c:80
Failure in network subsystem, check permissions.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
void GNUNET_NAT_unregister(struct GNUNET_NAT_Handle *nh)
Stop port redirection and public IP address detection for the given handle.
Definition: nat_api.c:690
We know nothing about the NAT.
NAT test could not be initialized.
Addresses that are global (i.e.
GNUNET_NAT_TestCallback cb
Function to call when a error occours.
Definition: nat_api_stun.c:77
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...
Definition: nat_api.c:378
static struct GNUNET_MQ_Envelope * ac
Handle to current GNUNET_PEERINFO_add_peer() operation.
`external-ip&#39; command not found
Addresses useful in the local wired network, i.e.
Flag for addresses that are highly sensitive (i.e.
static uint16_t port
Port number.
Definition: gnunet-bcd.c:79
static char * remote_addr
Remote address to use for connection reversal request.
Definition: gnunet-nat.c:70
configuration data
Definition: configuration.c:85
We can traverse using UPNP.
Failed to run upnpc command.
We have a direct connection.
handle to a socket
Definition: network.c:46
"no valid address was returned by `external-ip&#39;"
GNUNET_NAT_Type
What the situation of the NAT connectivity.
Addresses that fall into no other category (i.e.
GNUNET_NAT_AddressCallback address_callback
Function to call when our addresses change.
Definition: nat_api.c:103
uint32_t data
The data value.
Addresses that are global and are sensitive (i.e.
static size_t data_size
Number of bytes in data.
We can traverse using STUN.
Failed to run external-ip command.
Addresses useful in the local wireless network, i.e.