Code to figure out what our external IPv4 address(es) might be (external IPv4s are what is seen on the rest of the Internet). More...
#include "platform.h"
Go to the source code of this file.
Typedefs | |
typedef void(* | GN_NotifyExternalIPv4Change) (void *cls, const struct in_addr *ip, int add_remove) |
Function we call when we believe our external IPv4 address changed. More... | |
Functions | |
void | GN_nat_status_changed (int have_nat) |
We have changed our opinion about being NATed in the first place. More... | |
struct GN_ExternalIPMonitor * | GN_external_ipv4_monitor_start (GN_NotifyExternalIPv4Change cb, void *cb_cls) |
Start monitoring external IPv4 addresses. More... | |
void | GN_external_ipv4_monitor_stop (struct GN_ExternalIPMonitor *mon) |
Stop calling monitor. More... | |
Code to figure out what our external IPv4 address(es) might be (external IPv4s are what is seen on the rest of the Internet).
This can be implemented using different methods, and we allow the main service to be notified about changes to what we believe is our external IPv4 address.
Note that this is explicitly only about NATed systems; if one of our network interfaces has a global IP address this does not count as "external".
Functions for monitoring external IPv4 addresses
Definition in file gnunet-service-nat_externalip.h.
typedef void(* GN_NotifyExternalIPv4Change) (void *cls, const struct in_addr *ip, int add_remove) |
Function we call when we believe our external IPv4 address changed.
cls | closure |
ip | address to add/remove |
add_remove | GNUNET_YES to add, GNUNET_NO to remove |
Definition at line 59 of file gnunet-service-nat_externalip.h.
void GN_nat_status_changed | ( | int | have_nat | ) |
We have changed our opinion about being NATed in the first place.
Adapt our probing.
have_nat | GNUNET_YES if we believe we are behind NAT |
Definition at line 245 of file gnunet-service-nat_externalip.c.
References enable_upnp, GNUNET_NAT_mini_get_external_ipv4_cancel_(), GNUNET_NO, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_cancel(), GNUNET_YES, probe_external_ip_op, probe_external_ip_task, and run_external_ip().
Referenced by run_scan(), and shutdown_task().
struct GN_ExternalIPMonitor * GN_external_ipv4_monitor_start | ( | GN_NotifyExternalIPv4Change | cb, |
void * | cb_cls | ||
) |
Start monitoring external IPv4 addresses.
cb | function to call on changes |
cb_cls | closure for cb |
Definition at line 282 of file gnunet-service-nat_externalip.c.
References GN_ExternalIPMonitor::cb, GN_ExternalIPMonitor::cb_cls, GNUNET_CONTAINER_DLL_insert, GNUNET_new, GNUNET_YES, mini_external_ipv4, mon_head, and mon_tail.
Referenced by handle_register().
void GN_external_ipv4_monitor_stop | ( | struct GN_ExternalIPMonitor * | mon | ) |
Stop calling monitor.
mon | monitor to call |
Definition at line 307 of file gnunet-service-nat_externalip.c.
References GNUNET_CONTAINER_DLL_remove, GNUNET_free, mon_head, and mon_tail.
Referenced by client_disconnect_cb().