glitch in the license text detected by hyazinthe, thank you!
[oweals/gnunet.git] / src / nat / gnunet-service-nat_externalip.h
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 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 /**
16  * Code to figure out what our external IPv4 address(es) might
17  * be (external IPv4s are what is seen on the rest of the Internet).
18  *
19  * This can be implemented using different methods, and we allow
20  * the main service to be notified about changes to what we believe
21  * is our external IPv4 address.  
22  *
23  * Note that this is explicitly only about NATed systems; if one
24  * of our network interfaces has a global IP address this does
25  * not count as "external".
26  *
27  * @file nat/gnunet-service-nat_externalip.h
28  * @brief Functions for monitoring external IPv4 addresses
29  * @author Christian Grothoff
30  */
31 #ifndef GNUNET_SERVICE_NAT_EXTERNALIP_H
32 #define GNUNET_SERVICE_NAT_EXTERNALIP_H
33
34 #include "platform.h"
35
36
37 /**
38  * We have changed our opinion about being NATed in the first
39  * place. Adapt our probing.
40  *
41  * @param have_nat #GNUNET_YES if we believe we are behind NAT
42  */
43 void
44 GN_nat_status_changed (int have_nat);
45
46
47 /**
48  * Function we call when we believe our external IPv4 address changed.
49  *
50  * @param cls closure
51  * @param ip address to add/remove
52  * @param add_remove #GNUNET_YES to add, #GNUNET_NO to remove
53  */
54 typedef void
55 (*GN_NotifyExternalIPv4Change)(void *cls,
56                                const struct in_addr *ip,
57                                int add_remove);
58
59
60 /**
61  * Handle to monitor for external IP changes.
62  */
63 struct GN_ExternalIPMonitor;
64
65
66 /**
67  * Start monitoring external IPv4 addresses.
68  *
69  * @param cb function to call on changes
70  * @param cb_cls closure for @a cb
71  * @return handle to cancel
72  */
73 struct GN_ExternalIPMonitor *
74 GN_external_ipv4_monitor_start (GN_NotifyExternalIPv4Change cb,
75                                 void *cb_cls);
76
77
78 /**
79  * Stop calling monitor.
80  *
81  * @param mon monitor to call
82  */
83 void
84 GN_external_ipv4_monitor_stop (struct GN_ExternalIPMonitor *mon);
85
86
87 #endif