From d80214febe4e0e4cc64dddc74e990b3c5ca8a5df Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 28 Jan 2019 13:55:42 +0100 Subject: first iteraton of TCP communicator done --- src/transport/.gitignore | 1 + src/transport/gnunet-communicator-tcp.c | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/transport/.gitignore b/src/transport/.gitignore index e2f12c230..169604467 100644 --- a/src/transport/.gitignore +++ b/src/transport/.gitignore @@ -85,3 +85,4 @@ test_transport_testing_restart test_transport_testing_startstop gnunet-communicator-unix gnunet-service-tng +gnunet-communicator-tcp 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; } } -- cgit v1.2.3