GNUnet  0.11.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 {
58 
64 
70 
75 
81 
89 
96 
103 
109 
114 
123 
129 
134 };
135 
136 
141 {
146 
151 
156 
161 
166 
171 
176 
181 
186 
191 
196 
201 
206 
211 
216 
221 
226 
231 
236 };
237 
238 
243 {
248 
253 
258 
263 
268 };
269 
270 
284 typedef void
286  void **app_ctx,
287  int add_remove,
289  const struct sockaddr *addr,
290  socklen_t addrlen);
291 
292 
302 typedef void
304  const struct sockaddr *remote_addr,
305  socklen_t remote_addrlen);
306 
307 
311 struct GNUNET_NAT_Handle;
312 
313 
334 struct GNUNET_NAT_Handle *
336  const char *config_section,
337  uint8_t proto,
338  unsigned int num_addrs,
339  const struct sockaddr **addrs,
340  const socklen_t *addrlens,
343  void *callback_cls);
344 
345 
359 int
361  const void *addr,
362  socklen_t addrlen);
363 
364 
377 int
379  const struct sockaddr_in *local_sa,
380  const struct sockaddr_in *remote_sa);
381 
382 
390 void
392 
393 
417 int
419  const struct sockaddr *sender_addr,
420  size_t sender_addr_len,
421  const void *data,
422  size_t data_size);
423 
424 
431 
432 
440 typedef void
443 
444 
459 struct GNUNET_NAT_STUN_Handle *
460 GNUNET_NAT_stun_make_request (const char *server,
461  uint16_t port,
462  struct GNUNET_NETWORK_Handle *sock,
464  void *cb_cls);
465 
466 
473 void
475 
476 
477 #endif
478  /* end of group */
480 
481 /* end of gnunet_nat_service.h */
NAT test failed to initiate.
Handle for active NAT registrations.
Definition: nat_api.c:71
Addresses that were manually configured by the user.
GNUNET_NAT_AddressClass
Some addresses contain sensitive information or are not suitable for global distribution.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
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:657
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:211
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:247
static uint8_t proto
Protocol to use.
Definition: gnunet-nat.c:60
void * cb_cls
Closure for cb.
Definition: nat_api_stun.c:81
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
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:111
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:625
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:583
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:66
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.
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:692
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:76
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:81
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:52
"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:101
uint32_t data
The data value.
Addresses that are global and are sensitive (i.e.
We can traverse using STUN.
Failed to run external-ip command.
Addresses useful in the local wireless network, i.e.