aboutsummaryrefslogtreecommitdiff
path: root/src/nat/upnp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nat/upnp.c')
-rw-r--r--src/nat/upnp.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/nat/upnp.c b/src/nat/upnp.c
index e383055b5..8dd7d626c 100644
--- a/src/nat/upnp.c
+++ b/src/nat/upnp.c
@@ -57,7 +57,6 @@ enum UPNP_State
57 57
58struct GNUNET_NAT_UPNP_Handle 58struct GNUNET_NAT_UPNP_Handle
59{ 59{
60 struct GNUNET_SCHEDULER_Handle *sched;
61 int hasDiscovered; 60 int hasDiscovered;
62 char *control_url; 61 char *control_url;
63 char *service_type; 62 char *service_type;
@@ -91,8 +90,7 @@ process_if (void *cls,
91 90
92 91
93struct GNUNET_NAT_UPNP_Handle * 92struct GNUNET_NAT_UPNP_Handle *
94GNUNET_NAT_UPNP_init (struct GNUNET_SCHEDULER_Handle *sched, 93GNUNET_NAT_UPNP_init (const struct sockaddr *addr,
95 const struct sockaddr *addr,
96 socklen_t addrlen, 94 socklen_t addrlen,
97 u_short port, 95 u_short port,
98 GNUNET_NAT_UPNP_pulse_cb pulse_cb, void *pulse_cls) 96 GNUNET_NAT_UPNP_pulse_cb pulse_cb, void *pulse_cls)
@@ -100,7 +98,6 @@ GNUNET_NAT_UPNP_init (struct GNUNET_SCHEDULER_Handle *sched,
100 struct GNUNET_NAT_UPNP_Handle *handle; 98 struct GNUNET_NAT_UPNP_Handle *handle;
101 99
102 handle = GNUNET_malloc (sizeof (struct GNUNET_NAT_UPNP_Handle)); 100 handle = GNUNET_malloc (sizeof (struct GNUNET_NAT_UPNP_Handle));
103 handle->sched = sched;
104 handle->processing = GNUNET_NO; 101 handle->processing = GNUNET_NO;
105 handle->state = UPNP_DISCOVER; 102 handle->state = UPNP_DISCOVER;
106 handle->addr = addr; 103 handle->addr = addr;
@@ -350,7 +347,7 @@ GNUNET_NAT_UPNP_pulse (struct GNUNET_NAT_UPNP_Handle *handle,
350 if (is_enabled && (handle->state == UPNP_DISCOVER)) 347 if (is_enabled && (handle->state == UPNP_DISCOVER))
351 { 348 {
352 handle->processing = GNUNET_YES; 349 handle->processing = GNUNET_YES;
353 UPNP_discover_ (handle->sched, handle->iface, handle->addr, discover_cb, 350 UPNP_discover_ (handle->iface, handle->addr, discover_cb,
354 handle); 351 handle);
355 } 352 }
356 353
@@ -367,8 +364,7 @@ GNUNET_NAT_UPNP_pulse (struct GNUNET_NAT_UPNP_Handle *handle,
367 GNUNET_snprintf (portStr, sizeof (portStr), "%d", handle->port); 364 GNUNET_snprintf (portStr, sizeof (portStr), "%d", handle->port);
368 365
369 handle->processing = GNUNET_YES; 366 handle->processing = GNUNET_YES;
370 UPNP_get_specific_port_mapping_entry_ (handle->sched, 367 UPNP_get_specific_port_mapping_entry_ (handle->control_url,
371 handle->control_url,
372 handle->service_type, portStr, 368 handle->service_type, portStr,
373 "TCP", check_port_mapping_cb, 369 "TCP", check_port_mapping_cb,
374 handle); 370 handle);
@@ -380,7 +376,7 @@ GNUNET_NAT_UPNP_pulse (struct GNUNET_NAT_UPNP_Handle *handle,
380 GNUNET_snprintf (portStr, sizeof (portStr), "%d", handle->port); 376 GNUNET_snprintf (portStr, sizeof (portStr), "%d", handle->port);
381 377
382 handle->processing = GNUNET_YES; 378 handle->processing = GNUNET_YES;
383 UPNP_delete_port_mapping_ (handle->sched, handle->control_url, 379 UPNP_delete_port_mapping_ (handle->control_url,
384 handle->service_type, portStr, "TCP", NULL, 380 handle->service_type, portStr, "TCP", NULL,
385 delete_port_mapping_cb, handle); 381 delete_port_mapping_cb, handle);
386 } 382 }
@@ -403,7 +399,7 @@ GNUNET_NAT_UPNP_pulse (struct GNUNET_NAT_UPNP_Handle *handle,
403 GNUNET_snprintf (desc, sizeof (desc), "GNUnet at %d", handle->port); 399 GNUNET_snprintf (desc, sizeof (desc), "GNUnet at %d", handle->port);
404 400
405 handle->processing = GNUNET_YES; 401 handle->processing = GNUNET_YES;
406 UPNP_add_port_mapping_ (handle->sched, handle->control_url, 402 UPNP_add_port_mapping_ (handle->control_url,
407 handle->service_type, 403 handle->service_type,
408 portStr, portStr, GNUNET_a2s (handle->addr, 404 portStr, portStr, GNUNET_a2s (handle->addr,
409 handle->addrlen), 405 handle->addrlen),
@@ -415,7 +411,7 @@ GNUNET_NAT_UPNP_pulse (struct GNUNET_NAT_UPNP_Handle *handle,
415 if (handle->state != UPNP_DISCOVER) 411 if (handle->state != UPNP_DISCOVER)
416 { 412 {
417 handle->processing = GNUNET_YES; 413 handle->processing = GNUNET_YES;
418 UPNP_get_external_ip_address_ (handle->sched, handle->control_url, 414 UPNP_get_external_ip_address_ (handle->control_url,
419 handle->service_type, 415 handle->service_type,
420 get_ip_address_cb, handle); 416 get_ip_address_cb, handle);
421 } 417 }