/* start subsystems */
GST_hello_start (&process_hello_update, NULL);
GST_blacklist_start (server);
+ GST_ats =
+ GNUNET_ATS_scheduling_init (GST_cfg, &ats_request_address_change, NULL);
GST_plugins_load (&plugin_env_receive_callback,
&plugin_env_address_change_notification,
&plugin_env_session_end);
- GST_ats =
- GNUNET_ATS_scheduling_init (GST_cfg, &ats_request_address_change, NULL);
GST_neighbours_start (NULL, &neighbours_connect_notification,
&neighbours_disconnect_notification);
GST_clients_start (server);
*/
int is_nat;
+ /**
+ * ATS network type in NBO
+ */
+ uint32_t ats_address_network_type;
};
session->connect_addr = GNUNET_malloc (addrlen);
memcpy (session->connect_addr, addr, addrlen);
session->connect_alen = addrlen;
+ if ((addrlen != 0) && (plugin->env->ats != NULL))
+ {
+ struct GNUNET_ATS_Information ats;
+ GNUNET_assert(plugin->env->ats != NULL);
+ ats = GNUNET_ATS_address_get_type(plugin->env->ats, sb ,sbs);
+ session->ats_address_network_type = ats.value;
+ }
+ else
+ GNUNET_break (0);
}
else /* session != NULL */
{
"Found address `%s' for incoming connection\n",
GNUNET_a2s (vaddr, alen));
#endif
+
if (alen == sizeof (struct sockaddr_in))
{
s4 = vaddr;
session->connect_alen = sizeof (struct IPv6TcpAddress);
}
+ if (plugin->env->ats != NULL)
+ {
+ struct GNUNET_ATS_Information ats;
+ GNUNET_assert(plugin->env->ats != NULL);
+ ats = GNUNET_ATS_address_get_type(plugin->env->ats, vaddr ,alen);
+ session->ats_address_network_type = ats.value;
+ }
+ else
+ GNUNET_break (0);
GNUNET_free (vaddr);
}
else
GNUNET_STATISTICS_update (plugin->env->stats,
gettext_noop ("# bytes received via TCP"),
ntohs (message->size), GNUNET_NO);
- struct GNUNET_ATS_Information distance;
+ struct GNUNET_ATS_Information distance[2];
+
+ distance[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
+ distance[0].value = htonl (1);
+ distance[1].type = htonl (GNUNET_ATS_NETWORK_TYPE);
+ distance[1].value = session->ats_address_network_type;
+ GNUNET_break (ntohl(session->ats_address_network_type) != GNUNET_ATS_NET_UNSPECIFIED);
- distance.type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
- distance.value = htonl (1);
delay =
plugin->env->receive (plugin->env->cls, &session->target, message,
(const struct GNUNET_ATS_Information *) &distance,