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 
57 
63 
69 
74 
80 
88 
95 
102 
108 
113 
122 
128 
133 };
134 
135 
144 
149 
154 
159 
164 
169 
174 
179 
184 
189 
194 
199 
204 
209 
214 
219 
224 
229 
234 };
235 
236 
237 
246 
251 
256 
261 
266 };
267 
268 
269 
283 typedef void
285  void **app_ctx,
286  int add_remove,
288  const struct sockaddr *addr,
289  socklen_t addrlen);
290 
291 
301 typedef void
303  const struct sockaddr *remote_addr,
304  socklen_t remote_addrlen);
305 
306 
310 struct GNUNET_NAT_Handle;
311 
312 
333 struct GNUNET_NAT_Handle *
335  const char *config_section,
336  uint8_t proto,
337  unsigned int num_addrs,
338  const struct sockaddr **addrs,
339  const socklen_t *addrlens,
342  void *callback_cls);
343 
344 
358 int
360  const void *addr,
361  socklen_t addrlen);
362 
363 
376 int
378  const struct sockaddr_in *local_sa,
379  const struct sockaddr_in *remote_sa);
380 
381 
389 void
391 
392 
416 int
418  const struct sockaddr *sender_addr,
419  size_t sender_addr_len,
420  const void *data,
421  size_t data_size);
422 
423 
430 
431 
439 typedef void
442 
443 
458 struct GNUNET_NAT_STUN_Handle *
459 GNUNET_NAT_stun_make_request(const char *server,
460  uint16_t port,
461  struct GNUNET_NETWORK_Handle *sock,
463  void *cb_cls);
464 
465 
472 void
474 
475 
476 #endif
477  /* end of group */
479 
480 /* end of gnunet_nat_service.h */
NAT test failed to initiate.
Handle for active NAT registrations.
Definition: nat_api.c:70
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:209
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:245
static uint8_t proto
Protocol to use.
Definition: gnunet-nat.c:60
void * cb_cls
Closure for cb.
Definition: nat_api_stun.c:80
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:75
void * callback_cls
Closure for the various callbacks.
Definition: nat_api.c:109
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:65
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:75
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:376
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:81
static char * remote_addr
Remote address to use for connection reversal request.
Definition: gnunet-nat.c:70
configuration data
Definition: configuration.c:83
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:99
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.