aboutsummaryrefslogtreecommitdiff
path: root/src/nat/gnunet-service-nat_externalip.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-01-05 18:51:02 +0100
committerChristian Grothoff <christian@grothoff.org>2017-01-05 18:51:02 +0100
commit8c1ee5dd1319bcd9ddb6c55d2104c286b61b2e99 (patch)
tree704449a28ae0249ca3a3bd2789c2cbadb8171230 /src/nat/gnunet-service-nat_externalip.h
parent3c31d74877c1243b98e7b31a0d5acab91fc5795e (diff)
downloadgnunet-8c1ee5dd1319bcd9ddb6c55d2104c286b61b2e99.tar.gz
gnunet-8c1ee5dd1319bcd9ddb6c55d2104c286b61b2e99.zip
move external IP logic to separate file
Diffstat (limited to 'src/nat/gnunet-service-nat_externalip.h')
-rw-r--r--src/nat/gnunet-service-nat_externalip.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/src/nat/gnunet-service-nat_externalip.h b/src/nat/gnunet-service-nat_externalip.h
new file mode 100644
index 000000000..31910555d
--- /dev/null
+++ b/src/nat/gnunet-service-nat_externalip.h
@@ -0,0 +1,92 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2009, 2015, 2016, 2017 GNUnet e.V.
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 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 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20/**
21 * Code to figure out what our external IPv4 address(es) might
22 * be (external IPv4s are what is seen on the rest of the Internet).
23 *
24 * This can be implemented using different methods, and we allow
25 * the main service to be notified about changes to what we believe
26 * is our external IPv4 address.
27 *
28 * Note that this is explicitly only about NATed systems; if one
29 * of our network interfaces has a global IP address this does
30 * not count as "external".
31 *
32 * @file nat/gnunet-service-nat_externalip.h
33 * @brief Functions for monitoring external IPv4 addresses
34 * @author Christian Grothoff
35 */
36#ifndef GNUNET_SERVICE_NAT_EXTERNALIP_H
37#define GNUNET_SERVICE_NAT_EXTERNALIP_H
38
39#include "platform.h"
40
41
42/**
43 * We have changed our opinion about being NATed in the first
44 * place. Adapt our probing.
45 *
46 * @param have_nat #GNUNET_YES if we believe we are behind NAT
47 */
48void
49GN_nat_status_changed (int have_nat);
50
51
52/**
53 * Function we call when we believe our external IPv4 address changed.
54 *
55 * @param cls closure
56 * @param ip address to add/remove
57 * @param add_remove #GNUNET_YES to add, #GNUNET_NO to remove
58 */
59typedef void
60(*GN_NotifyExternalIPv4Change)(void *cls,
61 const struct in_addr *ip,
62 int add_remove);
63
64
65/**
66 * Handle to monitor for external IP changes.
67 */
68struct GN_ExternalIPMonitor;
69
70
71/**
72 * Start monitoring external IPv4 addresses.
73 *
74 * @param cb function to call on changes
75 * @param cb_cls closure for @a cb
76 * @return handle to cancel
77 */
78struct GN_ExternalIPMonitor *
79GN_external_ipv4_monitor_start (GN_NotifyExternalIPv4Change cb,
80 void *cb_cls);
81
82
83/**
84 * Stop calling monitor.
85 *
86 * @param mon monitor to call
87 */
88void
89GN_external_ipv4_monitor_stop (struct GN_ExternalIPMonitor *mon);
90
91
92#endif