}
+/**
+ * Function obtain the network type for an address.
+ *
+ * @param cls closure (`struct Plugin *`)
+ * @param address the address
+ * @return the network type
+ */
+static enum GNUNET_ATS_Network_Type
+tcp_plugin_get_network_for_address (void *cls,
+ const struct GNUNET_HELLO_Address *address)
+{
+ struct Plugin *plugin = cls;
+ size_t addrlen;
+ struct sockaddr_in a4;
+ struct sockaddr_in6 a6;
+ const struct IPv4TcpAddress *t4;
+ const struct IPv6TcpAddress *t6;
+ const void *sb;
+ size_t sbs;
+
+ addrlen = address->address_length;
+ if (addrlen == sizeof(struct IPv6TcpAddress))
+ {
+ GNUNET_assert (NULL != address->address); /* make static analysis happy */
+ t6 = address->address;
+ memset (&a6, 0, sizeof(a6));
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ a6.sin6_len = sizeof (a6);
+#endif
+ a6.sin6_family = AF_INET6;
+ a6.sin6_port = t6->t6_port;
+ memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr));
+ sb = &a6;
+ sbs = sizeof(a6);
+ }
+ else if (addrlen == sizeof(struct IPv4TcpAddress))
+ {
+ GNUNET_assert (NULL != address->address); /* make static analysis happy */
+ t4 = address->address;
+ memset (&a4, 0, sizeof(a4));
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ a4.sin_len = sizeof (a4);
+#endif
+ a4.sin_family = AF_INET;
+ a4.sin_port = t4->t4_port;
+ a4.sin_addr.s_addr = t4->ipv4_addr;
+ sb = &a4;
+ sbs = sizeof(a4);
+ }
+ else
+ {
+ GNUNET_break (0);
+ return GNUNET_ATS_NET_UNSPECIFIED;
+ }
+ return plugin->env->get_address_type (plugin->env->cls,
+ sb,
+ sbs);
+}
+
+
/**
* Return information about the given session to the
* monitor callback.
api->address_to_string = &tcp_plugin_address_to_string;
api->string_to_address = &tcp_plugin_string_to_address;
api->get_network = &tcp_plugin_get_network;
+ api->get_network_for_address = &tcp_plugin_get_network_for_address;
api->update_session_timeout = &tcp_plugin_update_session_timeout;
api->update_inbound_delay = &tcp_plugin_update_inbound_delay;
api->setup_monitor = &tcp_plugin_setup_monitor;