aboutsummaryrefslogtreecommitdiff
path: root/src/nat/nat.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nat/nat.c')
-rw-r--r--src/nat/nat.c38
1 files changed, 13 insertions, 25 deletions
diff --git a/src/nat/nat.c b/src/nat/nat.c
index 57961ffaf..1c60e4e0d 100644
--- a/src/nat/nat.c
+++ b/src/nat/nat.c
@@ -463,11 +463,9 @@ start_gnunet_nat_server (struct GNUNET_NAT_Handle *h);
463 * Call task to process STUN 463 * Call task to process STUN
464 * 464 *
465 * @param cls handle to NAT 465 * @param cls handle to NAT
466 * @param tc TaskContext
467 */ 466 */
468static void 467static void
469process_stun (void *cls, 468process_stun (void *cls);
470 const struct GNUNET_SCHEDULER_TaskContext *tc);
471 469
472 470
473/** 471/**
@@ -662,10 +660,9 @@ add_ip_to_address_list (struct GNUNET_NAT_Handle *h,
662 * get DynDNS-IP addresses. 660 * get DynDNS-IP addresses.
663 * 661 *
664 * @param cls the NAT handle 662 * @param cls the NAT handle
665 * @param tc scheduler context
666 */ 663 */
667static void 664static void
668resolve_dns (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); 665resolve_dns (void *cls);
669 666
670 667
671/** 668/**
@@ -716,11 +713,9 @@ process_external_ip (void *cls,
716 * Task to do a lookup on our hostname for IP addresses. 713 * Task to do a lookup on our hostname for IP addresses.
717 * 714 *
718 * @param cls the NAT handle 715 * @param cls the NAT handle
719 * @param tc scheduler context
720 */ 716 */
721static void 717static void
722resolve_hostname (void *cls, 718resolve_hostname (void *cls);
723 const struct GNUNET_SCHEDULER_TaskContext *tc);
724 719
725 720
726/** 721/**
@@ -938,14 +933,15 @@ process_interfaces (void *cls,
938 * after a certain delay. 933 * after a certain delay.
939 * 934 *
940 * @param cls the `struct GNUNET_NAT_Handle` 935 * @param cls the `struct GNUNET_NAT_Handle`
941 * @param tc scheduler context
942 */ 936 */
943static void 937static void
944restart_nat_server (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 938restart_nat_server (void *cls)
945{ 939{
946 struct GNUNET_NAT_Handle *h = cls; 940 struct GNUNET_NAT_Handle *h = cls;
941 const struct GNUNET_SCHEDULER_TaskContext *tc;
947 942
948 h->server_read_task = NULL; 943 h->server_read_task = NULL;
944 tc = GNUNET_SCHEDULER_get_task_context ();
949 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 945 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
950 return; 946 return;
951 start_gnunet_nat_server (h); 947 start_gnunet_nat_server (h);
@@ -958,11 +954,9 @@ restart_nat_server (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
958 * function to be called again once more is available. 954 * function to be called again once more is available.
959 * 955 *
960 * @param cls the NAT handle 956 * @param cls the NAT handle
961 * @param tc the scheduling context
962 */ 957 */
963static void 958static void
964nat_server_read (void *cls, 959nat_server_read (void *cls)
965 const struct GNUNET_SCHEDULER_TaskContext *tc)
966{ 960{
967 struct GNUNET_NAT_Handle *h = cls; 961 struct GNUNET_NAT_Handle *h = cls;
968 char mybuf[40]; 962 char mybuf[40];
@@ -971,8 +965,10 @@ nat_server_read (void *cls,
971 int port; 965 int port;
972 const char *port_start; 966 const char *port_start;
973 struct sockaddr_in sin_addr; 967 struct sockaddr_in sin_addr;
968 const struct GNUNET_SCHEDULER_TaskContext *tc;
974 969
975 h->server_read_task = NULL; 970 h->server_read_task = NULL;
971 tc = GNUNET_SCHEDULER_get_task_context ();
976 if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) 972 if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
977 return; 973 return;
978 memset (mybuf, 0, sizeof (mybuf)); 974 memset (mybuf, 0, sizeof (mybuf));
@@ -1099,11 +1095,9 @@ start_gnunet_nat_server (struct GNUNET_NAT_Handle *h)
1099 * Task to scan the local network interfaces for IP addresses. 1095 * Task to scan the local network interfaces for IP addresses.
1100 * 1096 *
1101 * @param cls the NAT handle 1097 * @param cls the NAT handle
1102 * @param tc scheduler context
1103 */ 1098 */
1104static void 1099static void
1105list_interfaces (void *cls, 1100list_interfaces (void *cls)
1106 const struct GNUNET_SCHEDULER_TaskContext *tc)
1107{ 1101{
1108 struct GNUNET_NAT_Handle *h = cls; 1102 struct GNUNET_NAT_Handle *h = cls;
1109 1103
@@ -1209,11 +1203,9 @@ GNUNET_NAT_is_valid_stun_packet (void *cls,
1209 * Task to do a STUN request 1203 * Task to do a STUN request
1210 * 1204 *
1211 * @param cls the NAT handle 1205 * @param cls the NAT handle
1212 * @param tc scheduler context
1213 */ 1206 */
1214static void 1207static void
1215process_stun (void *cls, 1208process_stun (void *cls)
1216 const struct GNUNET_SCHEDULER_TaskContext *tc)
1217{ 1209{
1218 struct GNUNET_NAT_Handle *h = cls; 1210 struct GNUNET_NAT_Handle *h = cls;
1219 struct StunServerList* elem = h->actual_stun_server; 1211 struct StunServerList* elem = h->actual_stun_server;
@@ -1264,11 +1256,9 @@ process_stun (void *cls,
1264 * Task to do a lookup on our hostname for IP addresses. 1256 * Task to do a lookup on our hostname for IP addresses.
1265 * 1257 *
1266 * @param cls the NAT handle 1258 * @param cls the NAT handle
1267 * @param tc scheduler context
1268 */ 1259 */
1269static void 1260static void
1270resolve_hostname (void *cls, 1261resolve_hostname (void *cls)
1271 const struct GNUNET_SCHEDULER_TaskContext *tc)
1272{ 1262{
1273 struct GNUNET_NAT_Handle *h = cls; 1263 struct GNUNET_NAT_Handle *h = cls;
1274 1264
@@ -1285,11 +1275,9 @@ resolve_hostname (void *cls,
1285 * get DynDNS-IP addresses. 1275 * get DynDNS-IP addresses.
1286 * 1276 *
1287 * @param cls the NAT handle 1277 * @param cls the NAT handle
1288 * @param tc scheduler context
1289 */ 1278 */
1290static void 1279static void
1291resolve_dns (void *cls, 1280resolve_dns (void *cls)
1292 const struct GNUNET_SCHEDULER_TaskContext *tc)
1293{ 1281{
1294 struct GNUNET_NAT_Handle *h = cls; 1282 struct GNUNET_NAT_Handle *h = cls;
1295 struct LocalAddressList *pos; 1283 struct LocalAddressList *pos;