57 #define EXTERN_IP_RETRY_TIMEOUT GNUNET_TIME_relative_multiply ( \ 58 GNUNET_TIME_UNIT_MINUTES, 15) 64 #define EXTERN_IP_RETRY_FAILURE GNUNET_TIME_relative_multiply ( \ 65 GNUNET_TIME_UNIT_MINUTES, 30) 71 #define EXTERN_IP_RETRY_SUCCESS GNUNET_TIME_relative_multiply ( \ 72 GNUNET_TIME_UNIT_MINUTES, 5) 139 const struct in_addr *v4)
144 mon->cb (mon->cb_cls,
171 const struct in_addr *addr,
174 char buf[INET_ADDRSTRLEN];
176 probe_external_ip_op = NULL;
178 probe_external_ip_task
191 "Our external IP is now %s\n",
223 probe_external_ip_task
227 if (NULL != probe_external_ip_op)
230 probe_external_ip_op = NULL;
250 (NULL == probe_external_ip_task) &&
251 (NULL == probe_external_ip_op))
253 probe_external_ip_task
260 if (NULL != probe_external_ip_task)
263 probe_external_ip_task = NULL;
265 if (NULL != probe_external_ip_op)
268 probe_external_ip_op = NULL;
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
Opaque handle to cancel "GNUNET_NAT_mini_get_external_ipv4" operation.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
void(* GN_NotifyExternalIPv4Change)(void *cls, const struct in_addr *ip, int add_remove)
Function we call when we believe our external IPv4 address changed.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static void run_external_ip(void *cls)
Task used to run external-ip to get our external IPv4 address and pass it to NATed clients if possibl...
void GN_external_ipv4_monitor_stop(struct GN_ExternalIPMonitor *mon)
Stop calling monitor.
#define EXTERN_IP_RETRY_SUCCESS
How long do we wait until we re-try running external-ip if the command succeeded? ...
#define GNUNET_new(type)
Allocate a struct or union of the given type.
runs the gnunet-helper-nat-server
Handle to monitor for external IP changes.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
struct GN_ExternalIPMonitor * next
Kept in DLL.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
network address translation traversal service
GNUNET_NAT_StatusCode
Error Types for the NAT subsystem (which can then later be converted/resolved to a string) ...
static int result
Global testing status.
static struct in_addr mini_external_ipv4
What is our external IP address as claimed by external-ip? 0 for unknown.
Code to figure out what our external IPv4 address(es) might be (external IPv4s are what is seen on th...
struct GNUNET_NAT_ExternalHandle * GNUNET_NAT_mini_get_external_ipv4_(GNUNET_NAT_IPCallback cb, void *cb_cls)
Try to get the external IPv4 address of this peer.
static struct GN_ExternalIPMonitor * mon_head
List of monitors, kept in DLL.
#define EXTERN_IP_RETRY_TIMEOUT
How long do we wait until we re-try running external-ip if the command failed to terminate nicely...
static int add
Desired action is to add a record.
GN_NotifyExternalIPv4Change cb
Function to call when we believe our external IPv4 address changed.
struct GN_ExternalIPMonitor * prev
Kept in DLL.
static struct GNUNET_SCHEDULER_Task * probe_external_ip_task
Task run to obtain our external IP (if enable_upnp is set and if we find we have a NATed IP address)...
int enable_upnp
Is UPnP enabled? GNUNET_YES if enabled, GNUNET_NO if disabled, GNUNET_SYSERR if configuration enabled...
Messages for interaction with gnunet-nat-server and gnunet-nat-service.
static void handle_external_ip(void *cls, const struct in_addr *addr, enum GNUNET_NAT_StatusCode result)
We learn our current external IP address.
#define GNUNET_log(kind,...)
Entry in list of pending tasks.
void * cb_cls
Closure for cb.
static struct GNUNET_NAT_ExternalHandle * probe_external_ip_op
Handle to our operation to run external-ip.
This code provides some support for doing STUN transactions.
struct GN_ExternalIPMonitor * GN_external_ipv4_monitor_start(GN_NotifyExternalIPv4Change cb, void *cb_cls)
Start monitoring external IPv4 addresses.
void GN_nat_status_changed(int have_nat)
We have changed our opinion about being NATed in the first place.
#define EXTERN_IP_RETRY_FAILURE
How long do we wait until we re-try running external-ip if the command failed (but terminated)...
static struct GN_ExternalIPMonitor * mon_tail
List of monitors, kept in DLL.
void GNUNET_NAT_mini_get_external_ipv4_cancel_(struct GNUNET_NAT_ExternalHandle *eh)
Cancel operation.
#define GNUNET_free(ptr)
Wrapper around free.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
static void notify_monitors_external_ipv4_change(int add, const struct in_addr *v4)
Tell relevant clients about a change in our external IPv4 address.