summaryrefslogtreecommitdiff
path: root/src/transport/gnunet-communicator-tcp.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-01-28 13:55:42 +0100
committerChristian Grothoff <christian@grothoff.org>2019-01-28 13:55:42 +0100
commitd80214febe4e0e4cc64dddc74e990b3c5ca8a5df (patch)
treeb3145143d73774d5a312b1ed6808cf81a8bf037a /src/transport/gnunet-communicator-tcp.c
parent5f8301275181a3349e2df231d7e3c530d6c4d8e9 (diff)
first iteraton of TCP communicator done
Diffstat (limited to 'src/transport/gnunet-communicator-tcp.c')
-rw-r--r--src/transport/gnunet-communicator-tcp.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c
index 884fbb0cb..2980ad532 100644
--- a/src/transport/gnunet-communicator-tcp.c
+++ b/src/transport/gnunet-communicator-tcp.c
@@ -24,7 +24,7 @@
* @author Christian Grothoff
*
* TODO:
- * - NAT service API change to handle address stops!
+ * - support DNS names in BINDTO option
* - support NAT connection reversal method
* - support other TCP-specific NAT traversal methods
*/
@@ -2180,28 +2180,32 @@ nat_address_cb (void *cls,
socklen_t addrlen)
{
char *my_addr;
- static struct GNUNET_TRANSPORT_AddressIdentifier *ai; // FIXME: store in *ctx of NAT!
+ struct GNUNET_TRANSPORT_AddressIdentifier *ai;
if (GNUNET_YES == add_remove)
{
- // FIXME: do better job at stringification of @a addr?
+ enum GNUNET_NetworkType nt;
+
GNUNET_asprintf (&my_addr,
"%s-%s",
COMMUNICATOR_ADDRESS_PREFIX,
GNUNET_a2s (addr,
addrlen));
- // FIXME: translate 'ac' to 'nt'?
+ nt = GNUNET_NT_scanner_get_type (is,
+ addr,
+ addrlen);
ai = GNUNET_TRANSPORT_communicator_address_add (ch,
my_addr,
- GNUNET_NT_LOOPBACK, // FIXME: wrong NT!
+ nt,
GNUNET_TIME_UNIT_FOREVER_REL);
GNUNET_free (my_addr);
+ *app_ctx = ai;
}
else
{
- // FIXME: support removal! => improve NAT API!
+ ai = *app_ctx;
GNUNET_TRANSPORT_communicator_address_remove (ai);
- ai = NULL;
+ *app_ctx = NULL;
}
}