#include "platform.h"
#include "gnunet_hello_lib.h"
#include "gnunet_constants.h"
-#include "gnunet_connection_lib.h"
-#include "gnunet_container_lib.h"
+#include "gnunet_util_lib.h"
#include "gnunet_nat_lib.h"
-#include "gnunet_os_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_resolver_service.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_service_lib.h"
#include "gnunet_signatures.h"
#include "gnunet_statistics_service.h"
#include "gnunet_transport_service.h"
#define PLUGIN_NAME "tcp"
+#define EXTRA_CHECKS ALLOW_EXTRA_CHECKS
+
/**
* How long until we give up on establishing an NAT connection?
* Must be > 4 RTT
struct WelcomeMessage
{
/**
- * Type is GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_WELCOME.
+ * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_WELCOME.
*/
struct GNUNET_MessageHeader header;
struct TCP_NAT_ProbeMessage
{
/**
- * Type is GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_NAT_PROBE.
+ * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_NAT_PROBE.
*/
struct GNUNET_MessageHeader header;
/**
* ATS network type in NBO
*/
- uint32_t ats_address_network_type;
+ enum GNUNET_ATS_Network_Type ats_address_network_type;
};
/**
- * Start session timeout
- */
-static void
-start_session_timeout (struct Session *s);
-
-
-/**
- * Increment session timeout due to activity
- */
-static void
-reschedule_session_timeout (struct Session *s);
-
-
-/**
- * Cancel timeout
+ * Function called for a quick conversion of the binary address to
+ * a numeric address. Note that the caller must not free the
+ * address and that the next call to this function is allowed
+ * to override the address again.
*
- * @param s session to cancel timeout for
+ * @param cls closure ('struct Plugin*')
+ * @param addr binary address
+ * @param addrlen length of the address
+ * @return string representing the same address
*/
-static void
-stop_session_timeout (struct Session *s);
-
-
-/* DEBUG CODE */
static const char *
-tcp_address_to_string (void *cls, const void *addr, size_t addrlen);
-
-
-static unsigned int sessions;
-
-
-static void
-inc_sessions (struct Plugin *plugin, struct Session *session, int line)
-{
- sessions++;
- unsigned int size = GNUNET_CONTAINER_multipeermap_size (plugin->sessionmap);
- if (sessions != size)
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Inconsistent sessions %u <-> session map size: %u\n",
- sessions, size);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "%4i Session increased to %u (session map size: %u): `%s' `%s'\n",
- line,
- sessions,
- size,
- GNUNET_i2s (&session->target),
- tcp_address_to_string (NULL, session->addr, session->addrlen));
-}
-
-
-static void
-dec_sessions (struct Plugin *plugin,
- struct Session *session, int line)
-{
- GNUNET_assert (sessions > 0);
- unsigned int size = GNUNET_CONTAINER_multipeermap_size(plugin->sessionmap);
- sessions--;
- if (sessions != size)
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Inconsistent sessions %u <-> session map size: %u\n",
- sessions, size);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "%4i Session decreased to %u (session map size: %u): `%s' `%s'\n",
- line,
- sessions,
- size,
- GNUNET_i2s (&session->target),
- tcp_address_to_string (NULL, session->addr, session->addrlen));
-}
-/* DEBUG CODE */
+tcp_address_to_string (void *cls,
+ const void *addr,
+ size_t addrlen);
/**
* Mostly used to limit the total number of open connections
* we can have.
*
- * @param cls the 'struct Plugin'
+ * @param cls the `struct Plugin`
* @param ucred credentials, if available, otherwise NULL
* @param addr address
* @param addrlen length of address
/**
* Our external IP address/port mapping has changed.
*
- * @param cls closure, the 'struct LocalAddrList'
+ * @param cls closure, the 'struct Plugin'
* @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean
* the previous (now invalid) one
* @param addr either the previous or the new public IP address
*/
static void
tcp_nat_port_map_callback (void *cls, int add_remove,
- const struct sockaddr *addr, socklen_t addrlen)
+ const struct sockaddr *addr,
+ socklen_t addrlen)
{
struct Plugin *plugin = cls;
struct IPv4TcpAddress t4;
* address and that the next call to this function is allowed
* to override the address again.
*
- * @param cls closure ('struct Plugin*')
+ * @param cls closure (`struct Plugin*`)
* @param addr binary address
* @param addrlen length of the address
* @return string representing the same address
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "inet_ntop");
return NULL;
}
- GNUNET_snprintf (rbuf, sizeof (rbuf), (af == AF_INET6) ? "%s.%u.[%s]:%u" : "%s.%u.%s:%u",
- PLUGIN_NAME, options, buf, port);
+ GNUNET_snprintf (rbuf,
+ sizeof (rbuf),
+ (af == AF_INET6)
+ ? "%s.%u.[%s]:%u"
+ : "%s.%u.%s:%u",
+ PLUGIN_NAME,
+ options,
+ buf,
+ port);
return rbuf;
}
* Function called to convert a string address to
* a binary address.
*
- * @param cls closure ('struct Plugin*')
+ * @param cls closure (`struct Plugin*`)
* @param addr string address
* @param addrlen length of the address
* @param buf location to store the buffer
{
struct IPv4TcpAddress *t4;
struct sockaddr_in *in4 = (struct sockaddr_in *) &socket_address;
- t4 = GNUNET_malloc (sizeof (struct IPv4TcpAddress));
+ t4 = GNUNET_new (struct IPv4TcpAddress);
t4->options = htonl (options);
t4->ipv4_addr = in4->sin_addr.s_addr;
t4->t4_port = in4->sin_port;
{
struct IPv6TcpAddress *t6;
struct sockaddr_in6 *in6 = (struct sockaddr_in6 *) &socket_address;
- t6 = GNUNET_malloc (sizeof (struct IPv6TcpAddress));
+ t6 = GNUNET_new (struct IPv6TcpAddress);
t6->options = htonl (options);
t6->ipv6_addr = in6->sin6_addr;
t6->t6_port = in6->sin6_port;
}
+/**
+ * Closure for #session_lookup_by_client_it().
+ */
struct SessionClientCtx
{
+ /**
+ * Client we are looking for.
+ */
const struct GNUNET_SERVER_Client *client;
+
+ /**
+ * Session that was found.
+ */
struct Session *ret;
};
/**
* Find the session handle for the given client.
+ * Currently uses both the hashmap and the client
+ * context, as the client context is new and the
+ * logic still needs to be tested.
*
* @param plugin the plugin
* @param client which client to find the session handle for
*/
static struct Session *
lookup_session_by_client (struct Plugin *plugin,
- const struct GNUNET_SERVER_Client *client)
+ struct GNUNET_SERVER_Client *client)
{
+ struct Session *ret;
struct SessionClientCtx sc_ctx;
+ ret = GNUNET_SERVER_client_get_user_context (client, struct Session);
sc_ctx.client = client;
sc_ctx.ret = NULL;
- GNUNET_CONTAINER_multipeermap_iterate (plugin->sessionmap, &session_lookup_by_client_it, &sc_ctx);
+ GNUNET_CONTAINER_multipeermap_iterate (plugin->sessionmap,
+ &session_lookup_by_client_it, &sc_ctx);
+ /* check both methods yield the same result */
+ GNUNET_break (ret == sc_ctx.ret);
return sc_ctx.ret;
}
+/**
+ * Functions with this signature are called whenever we need
+ * to close a session due to a disconnect or failure to
+ * establish a connection.
+ *
+ * @param cls the `struct Plugin`
+ * @param session session to close down
+ * @return #GNUNET_OK on success
+ */
+static int
+tcp_disconnect_session (void *cls,
+ struct Session *session)
+{
+ struct Plugin *plugin = cls;
+ struct PendingMessage *pm;
+
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Disconnecting session of peer `%s' address `%s'\n",
+ GNUNET_i2s (&session->target),
+ tcp_address_to_string (NULL, session->addr, session->addrlen));
+
+ if (GNUNET_SCHEDULER_NO_TASK != session->timeout_task)
+ {
+ GNUNET_SCHEDULER_cancel (session->timeout_task);
+ session->timeout_task = GNUNET_SCHEDULER_NO_TASK;
+ }
+
+ if (GNUNET_YES ==
+ GNUNET_CONTAINER_multipeermap_remove (plugin->sessionmap,
+ &session->target,
+ session))
+ {
+ GNUNET_STATISTICS_update (session->plugin->env->stats,
+ gettext_noop ("# TCP sessions active"), -1,
+ GNUNET_NO);
+ }
+ else
+ {
+ GNUNET_assert (GNUNET_YES ==
+ GNUNET_CONTAINER_multipeermap_remove (plugin->nat_wait_conns,
+ &session->target,
+ session));
+ }
+ if (NULL != session->client)
+ GNUNET_SERVER_client_set_user_context (session->client,
+ (void *) NULL);
+
+ /* clean up state */
+ if (NULL != session->transmit_handle)
+ {
+ GNUNET_SERVER_notify_transmit_ready_cancel (session->transmit_handle);
+ session->transmit_handle = NULL;
+ }
+ session->plugin->env->session_end (session->plugin->env->cls,
+ &session->target, session);
+
+ if (GNUNET_SCHEDULER_NO_TASK != session->nat_connection_timeout)
+ {
+ GNUNET_SCHEDULER_cancel (session->nat_connection_timeout);
+ session->nat_connection_timeout = GNUNET_SCHEDULER_NO_TASK;
+ }
+
+ while (NULL != (pm = session->pending_messages_head))
+ {
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ pm->transmit_cont !=
+ NULL ? "Could not deliver message to `%4s'.\n" :
+ "Could not deliver message to `%4s', notifying.\n",
+ GNUNET_i2s (&session->target));
+ GNUNET_STATISTICS_update (session->plugin->env->stats,
+ gettext_noop ("# bytes currently in TCP buffers"),
+ -(int64_t) pm->message_size, GNUNET_NO);
+ GNUNET_STATISTICS_update (session->plugin->env->stats,
+ gettext_noop
+ ("# bytes discarded by TCP (disconnect)"),
+ pm->message_size, GNUNET_NO);
+ GNUNET_CONTAINER_DLL_remove (session->pending_messages_head,
+ session->pending_messages_tail, pm);
+ if (NULL != pm->transmit_cont)
+ pm->transmit_cont (pm->transmit_cont_cls, &session->target,
+ GNUNET_SYSERR, pm->message_size, 0);
+ GNUNET_free (pm);
+ }
+ if (session->receive_delay_task != GNUNET_SCHEDULER_NO_TASK)
+ {
+ GNUNET_SCHEDULER_cancel (session->receive_delay_task);
+ if (NULL != session->client)
+ GNUNET_SERVER_receive_done (session->client, GNUNET_SYSERR);
+ }
+ if (NULL != session->client)
+ {
+ GNUNET_SERVER_client_disconnect (session->client);
+ GNUNET_SERVER_client_drop (session->client);
+ session->client = NULL;
+ }
+ GNUNET_free_non_null (session->addr);
+ GNUNET_assert (NULL == session->transmit_handle);
+ GNUNET_free (session);
+ return GNUNET_OK;
+}
+
+
+/**
+ * Function that is called to get the keepalive factor.
+ * GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
+ * calculate the interval between keepalive packets.
+ *
+ * @param cls closure with the `struct Plugin`
+ * @return keepalive factor
+ */
+static unsigned int
+tcp_query_keepalive_factor (void *cls)
+{
+ return 3;
+}
+
+
+/**
+ * Session was idle, so disconnect it
+ *
+ * @param cls the `struct Session` of the idle session
+ * @param tc scheduler context
+ */
+static void
+session_timeout (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ struct Session *s = cls;
+
+ s->timeout_task = GNUNET_SCHEDULER_NO_TASK;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Session %p was idle for %s, disconnecting\n",
+ s,
+ GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
+ GNUNET_YES));
+ /* call session destroy function */
+ tcp_disconnect_session (s->plugin, s);
+}
+
+
+/**
+ * Increment session timeout due to activity
+ *
+ * @param s session to increment timeout for
+ */
+static void
+reschedule_session_timeout (struct Session *s)
+{
+ GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != s->timeout_task);
+ GNUNET_SCHEDULER_cancel (s->timeout_task);
+ s->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
+ &session_timeout,
+ s);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Timeout rescheduled for session %p set to %s\n",
+ s,
+ GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
+ GNUNET_YES));
+}
+
+
/**
* Create a new session. Also queues a welcome message.
*
* @return new session object
*/
static struct Session *
-create_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target,
+create_session (struct Plugin *plugin,
+ const struct GNUNET_PeerIdentity *target,
struct GNUNET_SERVER_Client *client, int is_nat)
{
struct Session *session;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Creating new session for peer `%4s'\n",
GNUNET_i2s (target));
- session = GNUNET_malloc (sizeof (struct Session));
+ session = GNUNET_new (struct Session);
session->last_activity = GNUNET_TIME_absolute_get ();
session->plugin = plugin;
session->is_nat = is_nat;
session->client = client;
session->target = *target;
session->expecting_welcome = GNUNET_YES;
- session->ats_address_network_type = htonl (GNUNET_ATS_NET_UNSPECIFIED);
+ session->ats_address_network_type = GNUNET_ATS_NET_UNSPECIFIED;
pm = GNUNET_malloc (sizeof (struct PendingMessage) +
sizeof (struct WelcomeMessage));
pm->msg = (const char *) &pm[1];
gettext_noop ("# TCP sessions active"), 1,
GNUNET_NO);
}
- start_session_timeout (session);
-
+ session->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
+ &session_timeout,
+ session);
return session;
}
char *cbuf;
size_t ret;
- GNUNET_assert (NULL != session);
session->transmit_handle = NULL;
plugin = session->plugin;
if (NULL == buf)
{
struct PendingMessage *pm;
- GNUNET_assert (session->client != NULL);
- if (session->transmit_handle != NULL)
+ GNUNET_assert (NULL != session->client);
+ if (NULL != session->transmit_handle)
return;
if (NULL == (pm = session->pending_messages_head))
return;
}
+#if EXTRA_CHECKS
/**
- * Functions with this signature are called whenever we need
- * to close a session due to a disconnect or failure to
- * establish a connection.
- *
- * @param cls the `struct Plugin`
- * @param session session to close down
- * @return #GNUNET_OK on success
+ * Closure for #session_it().
*/
-static int
-tcp_disconnect_session (void *cls,
- struct Session *session)
-{
- struct Plugin *plugin = cls;
- struct PendingMessage *pm;
-
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Disconnecting session of peer `%s' address `%s'\n",
- GNUNET_i2s (&session->target),
- tcp_address_to_string (NULL, session->addr, session->addrlen));
-
- stop_session_timeout (session);
-
- if (GNUNET_YES ==
- GNUNET_CONTAINER_multipeermap_remove (plugin->sessionmap,
- &session->target,
- session))
- {
- GNUNET_STATISTICS_update (session->plugin->env->stats,
- gettext_noop ("# TCP sessions active"), -1,
- GNUNET_NO);
- dec_sessions (plugin, session, __LINE__);
- }
- else
- {
- GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multipeermap_remove (plugin->nat_wait_conns,
- &session->target,
- session));
- }
- /* clean up state */
- if (NULL != session->transmit_handle)
- {
- GNUNET_SERVER_notify_transmit_ready_cancel (session->transmit_handle);
- session->transmit_handle = NULL;
- }
- session->plugin->env->session_end (session->plugin->env->cls,
- &session->target, session);
-
- if (GNUNET_SCHEDULER_NO_TASK != session->nat_connection_timeout)
- {
- GNUNET_SCHEDULER_cancel (session->nat_connection_timeout);
- session->nat_connection_timeout = GNUNET_SCHEDULER_NO_TASK;
- }
-
- while (NULL != (pm = session->pending_messages_head))
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- pm->transmit_cont !=
- NULL ? "Could not deliver message to `%4s'.\n" :
- "Could not deliver message to `%4s', notifying.\n",
- GNUNET_i2s (&session->target));
- GNUNET_STATISTICS_update (session->plugin->env->stats,
- gettext_noop ("# bytes currently in TCP buffers"),
- -(int64_t) pm->message_size, GNUNET_NO);
- GNUNET_STATISTICS_update (session->plugin->env->stats,
- gettext_noop
- ("# bytes discarded by TCP (disconnect)"),
- pm->message_size, GNUNET_NO);
- GNUNET_CONTAINER_DLL_remove (session->pending_messages_head,
- session->pending_messages_tail, pm);
- if (NULL != pm->transmit_cont)
- pm->transmit_cont (pm->transmit_cont_cls, &session->target,
- GNUNET_SYSERR, pm->message_size, 0);
- GNUNET_free (pm);
- }
- if (session->receive_delay_task != GNUNET_SCHEDULER_NO_TASK)
- {
- GNUNET_SCHEDULER_cancel (session->receive_delay_task);
- if (NULL != session->client)
- GNUNET_SERVER_receive_done (session->client, GNUNET_SYSERR);
- }
- if (NULL != session->client)
- {
- GNUNET_SERVER_client_disconnect (session->client);
- GNUNET_SERVER_client_drop (session->client);
- session->client = NULL;
- }
- GNUNET_free_non_null (session->addr);
- GNUNET_assert (NULL == session->transmit_handle);
- GNUNET_free (session);
- return GNUNET_OK;
-}
-
-
struct FindSessionContext
{
+ /**
+ * Session we are looking for.
+ */
struct Session *s;
+
+ /**
+ * Set to #GNUNET_OK if we found the session.
+ */
int res;
};
+/**
+ * Function called to check if a session is in our maps.
+ *
+ * @param cls the `struct FindSessionContext`
+ * @param key peer identity
+ * @param value session in the map
+ * @return #GNUNET_YES to continue looking, #GNUNET_NO if we found the session
+ */
static int
session_it (void *cls,
- const struct GNUNET_PeerIdentity * key,
+ const struct GNUNET_PeerIdentity *key,
void *value)
{
struct FindSessionContext *res = cls;
+ struct Session *session = value;
- if (res->s == value)
+ if (res->s == session)
{
res->res = GNUNET_OK;
return GNUNET_NO;
}
+/**
+ * Check that the given session is known to the plugin and
+ * is in one of our maps.
+ *
+ * @param plugin the plugin to check against
+ * @param session the session to check
+ * @return #GNUNET_OK if all is well, #GNUNET_SYSERR if the session is invalid
+ */
static int
-find_session (struct Plugin *plugin, struct Session *session)
+find_session (struct Plugin *plugin,
+ struct Session *session)
{
struct FindSessionContext session_map_res;
struct FindSessionContext nat_map_res;
session_map_res.s = session;
session_map_res.res = GNUNET_SYSERR;
- GNUNET_CONTAINER_multipeermap_iterate (plugin->sessionmap, &session_it, &session_map_res);
-
+ GNUNET_CONTAINER_multipeermap_iterate (plugin->sessionmap,
+ &session_it, &session_map_res);
+ if (GNUNET_SYSERR != session_map_res.res)
+ return GNUNET_OK;
nat_map_res.s = session;
nat_map_res.res = GNUNET_SYSERR;
- GNUNET_CONTAINER_multipeermap_iterate (plugin->nat_wait_conns, &session_it, &nat_map_res);
-
- if ((session_map_res.res == GNUNET_SYSERR) && (nat_map_res.res == GNUNET_SYSERR))
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- return GNUNET_OK;
+ GNUNET_CONTAINER_multipeermap_iterate (plugin->nat_wait_conns,
+ &session_it, &nat_map_res);
+ if (GNUNET_SYSERR != nat_map_res.res)
+ return GNUNET_OK;
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
}
+#endif
/**
*/
static ssize_t
tcp_plugin_send (void *cls,
- struct Session *session,
- const char *msgbuf, size_t msgbuf_size,
- unsigned int priority,
- struct GNUNET_TIME_Relative to,
- GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
+ struct Session *session,
+ const char *msgbuf, size_t msgbuf_size,
+ unsigned int priority,
+ struct GNUNET_TIME_Relative to,
+ GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
{
struct Plugin * plugin = cls;
struct PendingMessage *pm;
- GNUNET_assert (NULL != plugin);
- GNUNET_assert (NULL != session);
-
- if (GNUNET_SYSERR == find_session(plugin, session))
+#if EXTRA_CHECKS
+ if (GNUNET_SYSERR == find_session (plugin, session))
{
- LOG (GNUNET_ERROR_TYPE_ERROR,
- _("Trying to send with invalid session %p\n"));
- return GNUNET_SYSERR;
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ _("Trying to send with invalid session %p\n"));
+ GNUNET_assert (0);
+ return GNUNET_SYSERR;
}
-
+#endif
/* create new message entry */
pm = GNUNET_malloc (sizeof (struct PendingMessage) + msgbuf_size);
pm->msg = (const char *) &pm[1];
"Asked to transmit %u bytes to `%s', added message to list.\n",
msgbuf_size, GNUNET_i2s (&session->target));
- if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessionmap,
- &session->target,
- session))
+ if (GNUNET_YES ==
+ GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessionmap,
+ &session->target,
+ session))
{
- GNUNET_assert (session->client != NULL);
- reschedule_session_timeout (session);
+ GNUNET_assert (NULL != session->client);
GNUNET_SERVER_client_set_timeout (session->client,
GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
GNUNET_STATISTICS_update (plugin->env->stats,
process_pending_messages (session);
return msgbuf_size;
}
- else if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains_value(plugin->nat_wait_conns, &session->target, session))
+ else if (GNUNET_YES ==
+ GNUNET_CONTAINER_multipeermap_contains_value(plugin->nat_wait_conns,
+ &session->target,
+ session))
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"This NAT WAIT session for peer `%s' is not yet ready!\n",
GNUNET_i2s (&session->target));
- reschedule_session_timeout (session);
GNUNET_STATISTICS_update (plugin->env->stats,
gettext_noop ("# bytes currently in TCP buffers"),
msgbuf_size, GNUNET_NO);
LOG (GNUNET_ERROR_TYPE_ERROR,
"Invalid session %p\n", session);
if (NULL != cont)
- cont (cont_cls, &session->target, GNUNET_SYSERR, pm->message_size, 0);
+ cont (cont_cls,
+ &session->target,
+ GNUNET_SYSERR,
+ pm->message_size,
+ 0);
GNUNET_break (0);
GNUNET_free (pm);
return GNUNET_SYSERR; /* session does not exist here */
}
+/**
+ * Closure for #session_lookup_it().
+ */
struct SessionItCtx
{
+ /**
+ * Address we are looking for.
+ */
void *addr;
+
+ /**
+ * Number of bytes in @e addr.
+ */
size_t addrlen;
+
+ /**
+ * Where to store the session (if we found it).
+ */
struct Session *result;
};
+/**
+ * Look for a session by address.
+ *
+ * @param cls the `struct SessionItCtx`
+ * @param key unused
+ * @param value a `struct Session`
+ * @return #GNUNET_YES to continue looking, #GNUNET_NO if we found the session
+ */
static int
session_lookup_it (void *cls,
const struct GNUNET_PeerIdentity *key,
{
struct SessionItCtx * si_ctx = cls;
struct Session * session = value;
-#if 0
- char * a1 = strdup (tcp_address_to_string(NULL, session->addr, session->addrlen));
- char * a2 = strdup (tcp_address_to_string(NULL, si_ctx->addr, si_ctx->addrlen));
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Comparing: %s %u <-> %s %u\n",
- a1,
- session->addrlen,
- a2,
- si_ctx->addrlen);
- GNUNET_free (a1);
- GNUNET_free (a2);
-#endif
+
if (session->addrlen != si_ctx->addrlen)
- {
return GNUNET_YES;
- }
if (0 != memcmp (session->addr, si_ctx->addr, si_ctx->addrlen))
- {
return GNUNET_YES;
- }
-#if 0
- a1 = strdup (tcp_address_to_string(NULL, session->addr, session->addrlen));
- a2 = strdup (tcp_address_to_string(NULL, si_ctx->addr, si_ctx->addrlen));
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Comparing: %s %u <-> %s %u , OK!\n",
- a1,
- session->addrlen,
- a2,
- si_ctx->addrlen);
- GNUNET_free (a1);
- GNUNET_free (a2);
-#endif
/* Found existing session */
si_ctx->result = session;
return GNUNET_NO;
/**
* Task cleaning up a NAT connection attempt after timeout
+ *
+ * @param cls the `struct Session`
+ * @param tc scheduler context (unused)
*/
static void
nat_connect_timeout (void *cls,
}
+static void
+tcp_plugin_update_session_timeout (void *cls,
+ const struct GNUNET_PeerIdentity *peer,
+ struct Session *session)
+{
+ struct Plugin *plugin = cls;
+
+ if (GNUNET_SYSERR == find_session (plugin, session))
+ return;
+ reschedule_session_timeout (session);
+}
+
+
/**
* Create a new session to transmit data to the target
* This session will used to send data to this peer and the plugin will
* notify us by calling the env->session_end function
*
* @param cls closure
- * @param address pointer to the GNUNET_HELLO_Address
+ * @param address the address to use
* @return the session if the address is valid, NULL otherwise
*/
static struct Session *
unsigned int is_natd = GNUNET_NO;
size_t addrlen;
- GNUNET_assert (plugin != NULL);
- GNUNET_assert (address != NULL);
addrlen = address->address_length;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Trying to get session for `%s' address of peer `%s'\n",
return NULL;
}
- ats = plugin->env->get_address_type (plugin->env->cls, sb ,sbs);
+ ats = plugin->env->get_address_type (plugin->env->cls, sb, sbs);
if ((is_natd == GNUNET_YES) && (addrlen == sizeof (struct IPv6TcpAddress)))
{
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Found valid IPv4 NAT address (creating session)!\n") ;
- session = create_session (plugin, &address->peer, NULL, GNUNET_YES);
+ session = create_session (plugin,
+ &address->peer,
+ NULL,
+ GNUNET_YES);
session->addrlen = 0;
session->addr = NULL;
- session->ats_address_network_type = ats.value;
+ session->ats_address_network_type = (enum GNUNET_ATS_Network_Type) ntohl (ats.value);
+ GNUNET_break (session->ats_address_network_type != GNUNET_ATS_NET_UNSPECIFIED);
session->nat_connection_timeout = GNUNET_SCHEDULER_add_delayed (NAT_TIMEOUT,
&nat_connect_timeout,
session);
/* create new outbound session */
GNUNET_assert (plugin->cur_connections <= plugin->max_connections);
sa = GNUNET_CONNECTION_create_from_sockaddr (af, sb, sbs);
- if (sa == NULL)
+ if (NULL == sa)
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Failed to create connection to `%4s' at `%s'\n",
}
plugin->cur_connections++;
if (plugin->cur_connections == plugin->max_connections)
- GNUNET_SERVER_suspend (plugin->server); /* Maximum number of connections rechead */
+ GNUNET_SERVER_suspend (plugin->server); /* Maximum number of connections rechead */
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Asked to transmit to `%4s', creating fresh session using address `%s'.\n",
- GNUNET_i2s (&address->peer), GNUNET_a2s (sb, sbs));
+ GNUNET_i2s (&address->peer),
+ GNUNET_a2s (sb, sbs));
session = create_session (plugin,
&address->peer,
session->addr = GNUNET_malloc (addrlen);
memcpy (session->addr, address->address, addrlen);
session->addrlen = addrlen;
- session->ats_address_network_type = ats.value;
-
+ session->ats_address_network_type = (enum GNUNET_ATS_Network_Type) ntohl (ats.value);
+ GNUNET_break (session->ats_address_network_type != GNUNET_ATS_NET_UNSPECIFIED);
+ GNUNET_SERVER_client_set_user_context (session->client, session);
GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap,
&session->target,
- session, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
- inc_sessions (plugin, session, __LINE__);
+ session,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Creating new session for `%s' address `%s' session %p\n",
GNUNET_i2s (&address->peer),
* to be cancelled
*/
static void
-tcp_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target)
+tcp_plugin_disconnect (void *cls,
+ const struct GNUNET_PeerIdentity *target)
{
struct Plugin *plugin = cls;
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Disconnecting peer `%4s'\n", GNUNET_i2s (target));
+ "Disconnecting peer `%4s'\n",
+ GNUNET_i2s (target));
GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessionmap, target,
&session_disconnect_it, plugin);
GNUNET_CONTAINER_multipeermap_get_multiple (plugin->nat_wait_conns, target,
ppc_cancel_task (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- int count = 0;
struct PrettyPrinterContext *ppc = cls;
- struct PrettyPrinterContext *cur;
-
- for (cur = ppc_dll_head; (NULL != cur); cur = cur->next)
- {
- if (cur != ppc)
- count++;
- }
- // GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cancel request %p, %u pending\n", ppc, count);
ppc->timeout_task = GNUNET_SCHEDULER_NO_TASK;
if (NULL != ppc->resolver_handle)
{
struct PrettyPrinterContext *ppc = cls;
struct PrettyPrinterContext *cur;
char *ret;
- int count = 0;
- for (cur = ppc_dll_head; (NULL != cur); cur = cur->next)
- {
- if (cur != ppc)
- count++;
- }
- //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Callback request %p == %s, %u pending\n", ppc, hostname, count);
- if (hostname == NULL)
+ if (NULL == hostname)
{
ppc->asc (ppc->asc_cls, NULL);
GNUNET_CONTAINER_DLL_remove (ppc_dll_head, ppc_dll_tail, ppc);
GNUNET_SCHEDULER_cancel (ppc->timeout_task);
ppc->timeout_task = GNUNET_SCHEDULER_NO_TASK;
ppc->resolver_handle = NULL;
- //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Done request %p, %u pending\n", ppc, count);
GNUNET_free (ppc);
return;
}
for (cur = ppc_dll_head; (NULL != cur); cur = cur->next)
- {
- if (cur == ppc)
- break;
- }
+ if (cur == ppc)
+ break;
if (NULL == cur)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Invalid callback for PPC %p \n", ppc);
- return;
+ GNUNET_break (0);
+ return;
}
if (GNUNET_YES == ppc->ipv6)
- GNUNET_asprintf (&ret, "%s.%u.[%s]:%d", PLUGIN_NAME, ppc->options, hostname, ppc->port);
+ GNUNET_asprintf (&ret,
+ "%s.%u.[%s]:%d",
+ PLUGIN_NAME,
+ ppc->options,
+ hostname,
+ ppc->port);
else
- GNUNET_asprintf (&ret, "%s.%u.%s:%d", PLUGIN_NAME, ppc->options, hostname, ppc->port);
+ GNUNET_asprintf (&ret,
+ "%s.%u.%s:%d",
+ PLUGIN_NAME,
+ ppc->options,
+ hostname,
+ ppc->port);
ppc->asc (ppc->asc_cls, ret);
GNUNET_free (ret);
}
asc (asc_cls, NULL);
return;
}
- ppc = GNUNET_malloc (sizeof (struct PrettyPrinterContext));
+ ppc = GNUNET_new (struct PrettyPrinterContext);
if (addrlen == sizeof (struct IPv6TcpAddress))
ppc->ipv6 = GNUNET_YES;
else
* Check if the given port is plausible (must be either our listen
* port or our advertised port), or any port if we are behind NAT
* and do not have a port open. If it is neither, we return
- * GNUNET_SYSERR.
+ * #GNUNET_SYSERR.
*
* @param plugin global variables
* @param in_port port number to check
- * @return GNUNET_OK if port is either open_port or adv_port
+ * @return #GNUNET_OK if port is either open_port or adv_port
*/
static int
check_port (struct Plugin *plugin, uint16_t in_port)
* traffic to a 3rd party that might try to man-in-the-middle our
* traffic.
*
- * @param cls closure, our 'struct Plugin*'
+ * @param cls closure, our `struct Plugin *`
* @param addr pointer to the address
* @param addrlen length of addr
- * @return GNUNET_OK if this is a plausible address for this peer
- * and transport, GNUNET_SYSERR if not
+ * @return #GNUNET_OK if this is a plausible address for this peer
+ * and transport, #GNUNET_SYSERR if not
*/
static int
tcp_plugin_check_address (void *cls, const void *addr, size_t addrlen)
if ((addrlen != sizeof (struct IPv4TcpAddress)) &&
(addrlen != sizeof (struct IPv6TcpAddress)))
{
-
-
- return GNUNET_SYSERR;
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
}
if (addrlen == sizeof (struct IPv4TcpAddress))
v4 = (struct IPv4TcpAddress *) addr;
if (0 != memcmp (&v4->options, &myoptions, sizeof (myoptions)))
{
- GNUNET_break (0);
- return GNUNET_SYSERR;
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
}
if (GNUNET_OK != check_port (plugin, ntohs (v4->t4_port)))
return GNUNET_SYSERR;
* @param message the actual message
*/
static void
-handle_tcp_nat_probe (void *cls, struct GNUNET_SERVER_Client *client,
+handle_tcp_nat_probe (void *cls,
+ struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
struct Plugin *plugin = cls;
const struct sockaddr_in *s4;
const struct sockaddr_in6 *s6;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Received NAT probe\n");
-
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Received NAT probe\n");
/* We have received a TCP NAT probe, meaning we (hopefully) initiated
* a connection to this peer by running gnunet-nat-client. This peer
* received the punch message and now wants us to use the new connection
}
session =
- GNUNET_CONTAINER_multipeermap_get (plugin->nat_wait_conns,
- &tcp_nat_probe->
- clientIdentity);
+ GNUNET_CONTAINER_multipeermap_get (plugin->nat_wait_conns,
+ &tcp_nat_probe->clientIdentity);
if (session == NULL)
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
(plugin->nat_wait_conns,
&tcp_nat_probe->clientIdentity,
session) == GNUNET_YES);
+ GNUNET_SERVER_client_set_user_context (client, session);
GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap,
&session->target, session,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
{
case AF_INET:
s4 = vaddr;
- t4 = GNUNET_malloc (sizeof (struct IPv4TcpAddress));
+ t4 = GNUNET_new (struct IPv4TcpAddress);
t4->options = 0;
t4->t4_port = s4->sin_port;
t4->ipv4_addr = s4->sin_addr.s_addr;
break;
case AF_INET6:
s6 = vaddr;
- t6 = GNUNET_malloc (sizeof (struct IPv6TcpAddress));
+ t6 = GNUNET_new (struct IPv6TcpAddress);
t6->options = 0;
t6->t6_port = s6->sin6_port;
memcpy (&t6->ipv6_addr, &s6->sin6_addr, sizeof (struct in6_addr));
GNUNET_break (NULL == session->client);
GNUNET_SERVER_client_keep (client);
session->client = client;
- inc_sessions (plugin, session, __LINE__);
GNUNET_STATISTICS_update (plugin->env->stats,
gettext_noop ("# TCP sessions active"), 1,
GNUNET_NO);
gettext_noop ("# TCP WELCOME messages received"), 1,
GNUNET_NO);
session = lookup_session_by_client (plugin, client);
- if (session != NULL)
+ if (NULL != session)
{
- if (GNUNET_OK == GNUNET_SERVER_client_get_address (client, &vaddr, &alen))
+ if (GNUNET_OK ==
+ GNUNET_SERVER_client_get_address (client, &vaddr, &alen))
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Found existing session %p for peer `%s'\n",
else
{
GNUNET_SERVER_client_keep (client);
- if (plugin->service != NULL) /* Otherwise value is incremented in tcp_access_check */
+ if (NULL != plugin->service) /* Otherwise value is incremented in tcp_access_check */
plugin->cur_connections++;
if (plugin->cur_connections == plugin->max_connections)
GNUNET_SERVER_suspend (plugin->server); /* Maximum number of connections rechead */
if (alen == sizeof (struct sockaddr_in))
{
s4 = vaddr;
- t4 = GNUNET_malloc (sizeof (struct IPv4TcpAddress));
+ t4 = GNUNET_new (struct IPv4TcpAddress);
t4->options = htonl (0);
t4->t4_port = s4->sin_port;
t4->ipv4_addr = s4->sin_addr.s_addr;
else if (alen == sizeof (struct sockaddr_in6))
{
s6 = vaddr;
- t6 = GNUNET_malloc (sizeof (struct IPv6TcpAddress));
+ t6 = GNUNET_new (struct IPv6TcpAddress);
t6->options = htonl (0);
t6->t6_port = s6->sin6_port;
memcpy (&t6->ipv6_addr, &s6->sin6_addr, sizeof (struct in6_addr));
}
ats = plugin->env->get_address_type (plugin->env->cls, vaddr ,alen);
- session->ats_address_network_type = ats.value;
+ session->ats_address_network_type = (enum GNUNET_ATS_Network_Type) ntohl (ats.value);
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Creating new session %p for peer `%s'\n",
- session,
- GNUNET_a2s (vaddr, alen));
+ "Creating new session %p for peer `%s'\n",
+ session,
+ GNUNET_a2s (vaddr, alen));
GNUNET_free (vaddr);
+ GNUNET_SERVER_client_set_user_context (session->client, session);
GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap,
- &session->target,
- session,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
- inc_sessions (plugin, session, __LINE__);
+ &session->target,
+ session,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
}
else
{
/* Notify transport and ATS about new session */
if (GNUNET_YES == session->inbound)
{
- plugin->env->session_start (NULL, &wm->clientIdentity, PLUGIN_NAME,
- (GNUNET_YES == session->inbound) ? NULL : session->addr,
- (GNUNET_YES == session->inbound) ? 0 : session->addrlen,
- session, &ats, 1);
+ plugin->env->session_start (NULL,
+ &wm->clientIdentity,
+ PLUGIN_NAME,
+ (GNUNET_YES == session->inbound) ? NULL : session->addr,
+ (GNUNET_YES == session->inbound) ? 0 : session->addrlen,
+ session, &ats, 1);
}
-
process_pending_messages (session);
-
GNUNET_SERVER_client_set_timeout (client,
GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
* Task to signal the server that we can continue
* receiving from the TCP client now.
*
- * @param cls the 'struct Session*'
+ * @param cls the `struct Session*`
* @param tc task context (unused)
*/
static void
-delayed_done (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+delayed_done (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct Session *session = cls;
struct GNUNET_ATS_Information distance;
distance.type = htonl (GNUNET_ATS_NETWORK_TYPE);
- distance.value = session->ats_address_network_type;
- GNUNET_break (ntohl(session->ats_address_network_type) != GNUNET_ATS_NET_UNSPECIFIED);
+ distance.value = htonl ((uint32_t) session->ats_address_network_type);
+ GNUNET_break (session->ats_address_network_type != GNUNET_ATS_NET_UNSPECIFIED);
GNUNET_assert (GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessionmap,
&session->target,
(GNUNET_YES == session->inbound) ? NULL : session->addr,
(GNUNET_YES == session->inbound) ? 0 : session->addrlen);
plugin->env->update_address_metrics (plugin->env->cls,
- &session->target,
- (GNUNET_YES == session->inbound) ? NULL : session->addr,
- (GNUNET_YES == session->inbound) ? 0 : session->addrlen,
- session, &distance, 1);
-
+ &session->target,
+ (GNUNET_YES == session->inbound) ? NULL : session->addr,
+ (GNUNET_YES == session->inbound) ? 0 : session->addrlen,
+ session, &distance, 1);
reschedule_session_timeout (session);
-
if (0 == delay.rel_value_us)
{
GNUNET_SERVER_receive_done (client, GNUNET_OK);
GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
GNUNET_SERVER_disable_receive_done_warning (client);
session->receive_delay_task =
- GNUNET_SCHEDULER_add_delayed (delay, &delayed_done, session);
+ GNUNET_SCHEDULER_add_delayed (delay, &delayed_done, session);
}
}
/* FIXME: do we need to track these probe context objects so that
* we can clean them up on plugin unload? */
- tcp_probe_ctx = GNUNET_malloc (sizeof (struct TCPProbeContext));
+ tcp_probe_ctx = GNUNET_new (struct TCPProbeContext);
tcp_probe_ctx->message.header.size =
htons (sizeof (struct TCP_NAT_ProbeMessage));
tcp_probe_ctx->message.header.type =
}
-/**
- * Session was idle, so disconnect it
- */
-static void
-session_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- struct Session *s = cls;
-
- s->timeout_task = GNUNET_SCHEDULER_NO_TASK;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Session %p was idle for %s, disconnecting\n",
- s,
- GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
- GNUNET_YES));
- /* call session destroy function */
- tcp_disconnect_session(s->plugin, s);
-}
-
-
-/**
- * Start session timeout
- */
-static void
-start_session_timeout (struct Session *s)
-{
- GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == s->timeout_task);
- s->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
- &session_timeout,
- s);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Timeout for session %p set to %s\n",
- s,
- GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
- GNUNET_YES));
-}
-
-
-/**
- * Increment session timeout due to activity
- */
-static void
-reschedule_session_timeout (struct Session *s)
-{
- GNUNET_assert (NULL != s);
- GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != s->timeout_task);
-
- GNUNET_SCHEDULER_cancel (s->timeout_task);
- s->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
- &session_timeout,
- s);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Timeout rescheduled for session %p set to %s\n",
- s,
- GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
- GNUNET_YES));
-}
-
-
-/**
- * Cancel timeout.
- *
- * @param s session to cancel timeout for
- */
-static void
-stop_session_timeout (struct Session *s)
-{
- GNUNET_assert (NULL != s);
-
- if (GNUNET_SCHEDULER_NO_TASK != s->timeout_task)
- {
- GNUNET_SCHEDULER_cancel (s->timeout_task);
- s->timeout_task = GNUNET_SCHEDULER_NO_TASK;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Timeout stopped for session %p canceled\n",
- s);
- }
-}
-
/**
* Function obtain the network type for a session
*
struct Session *session)
{
GNUNET_assert (NULL != session);
- return ntohl (session->ats_address_network_type);
+ return session->ats_address_network_type;
}
api->get_session = &tcp_plugin_get_session;
api->disconnect_session = &tcp_disconnect_session;
+ api->query_keepalive_factor = &tcp_query_keepalive_factor;
api->disconnect_peer = &tcp_plugin_disconnect;
api->address_pretty_printer = &tcp_plugin_address_pretty_printer;
api->check_address = &tcp_plugin_check_address;
api->address_to_string = &tcp_address_to_string;
api->string_to_address = &tcp_string_to_address;
api->get_network = &tcp_get_network;
+ api->update_session_timeout = &tcp_plugin_update_session_timeout;
plugin->service = service;
if (NULL != service)
{
/* Initially set connections to 0 */
GNUNET_assert (NULL != plugin->env->stats);
GNUNET_STATISTICS_set (plugin->env->stats,
- gettext_noop ("# TCP sessions active"), 0,
- GNUNET_NO);
+ gettext_noop ("# TCP sessions active"), 0,
+ GNUNET_NO);
return api;
}
/**
* Exit point from the plugin.
+ *
+ * @param cls the `struct GNUNET_TRANSPORT_PluginFunctions`
+ * @return NULL
*/
void *
libgnunet_plugin_transport_tcp_done (void *cls)