GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
sh->connect_cb (sh->cls,
&cm->peer,
- ntohl (cm->distance), ntohl (cm->network));
+ ntohl (cm->distance),
+ (enum GNUNET_ATS_Network_Type) ntohl (cm->network));
break;
case GNUNET_MESSAGE_TYPE_DV_DISTANCE_CHANGED:
if (ntohs (msg->size) != sizeof (struct GNUNET_DV_DistanceUpdateMessage))
sh->distance_cb (sh->cls,
&dum->peer,
ntohl (dum->distance),
- ntohl (dum->network));
+ (enum GNUNET_ATS_Network_Type) ntohl (dum->network));
break;
case GNUNET_MESSAGE_TYPE_DV_DISCONNECT:
if (ntohs (msg->size) != sizeof (struct GNUNET_DV_DisconnectMessage))
static void
connect_cb (void *cls,
const struct GNUNET_PeerIdentity *peer,
- uint32_t distance, uint32_t network)
+ uint32_t distance,
+ enum GNUNET_ATS_Network_Type network)
{
fprintf (stderr, "Connect: %s at %u\n",
GNUNET_i2s (peer),
change_cb (void *cls,
const struct GNUNET_PeerIdentity *peer,
uint32_t distance,
- uint32_t network)
+ enum GNUNET_ATS_Network_Type network)
{
fprintf (stderr, "Change: %s at %u\n",
GNUNET_i2s (peer),
/**
* The network this peer is in
*/
- uint32_t network;
+ enum GNUNET_ATS_Network_Type network;
/**
* Is this neighbor connected at the core level?
static void
send_distance_change_to_plugin (const struct GNUNET_PeerIdentity *peer,
uint32_t distance,
- uint32_t network)
+ enum GNUNET_ATS_Network_Type network)
{
struct GNUNET_DV_DistanceUpdateMessage du_msg;
du_msg.header.type = htons (GNUNET_MESSAGE_TYPE_DV_DISTANCE_CHANGED);
du_msg.distance = htonl (distance);
du_msg.peer = *peer;
- du_msg.network = htonl (network);
+ du_msg.network = htonl ((uint32_t) network);
send_control_to_plugin (&du_msg.header);
}
*/
static void
send_connect_to_plugin (const struct GNUNET_PeerIdentity *target,
- uint32_t distance, uint32_t network)
+ uint32_t distance,
+ enum GNUNET_ATS_Network_Type network)
{
struct GNUNET_DV_ConnectMessage cm;
cm.header.size = htons (sizeof (cm));
cm.header.type = htons (GNUNET_MESSAGE_TYPE_DV_CONNECT);
cm.distance = htonl (distance);
- cm.network = htonl (network);
+ cm.network = htonl ((uint32_t) network);
cm.peer = *target;
send_control_to_plugin (&cm.header);
}
* @param atsi_count number of entries in atsi
* @return connected transport network
*/
-static uint32_t
+static enum GNUNET_ATS_Network_Type
get_atsi_network (const struct GNUNET_ATS_Information *atsi,
uint32_t atsi_count)
{
for (i = 0; i < atsi_count; i++)
if (ntohl (atsi[i].type) == GNUNET_ATS_NETWORK_TYPE)
- return ntohl (atsi[i].value);
+ return (enum GNUNET_ATS_Network_Type) ntohl (atsi[i].value);
return GNUNET_ATS_NET_UNSPECIFIED;
}
{
struct DirectNeighbor *neighbor;
uint32_t distance;
- uint32_t network = GNUNET_ATS_NET_UNSPECIFIED;
+ enum GNUNET_ATS_Network_Type network = GNUNET_ATS_NET_UNSPECIFIED;
if (GNUNET_NO == active)
return;
/**
* Current network the next hop peer is located in
*/
- uint32_t network;
+ enum GNUNET_ATS_Network_Type network;
/**
* Does the transport service know about this session (and we thus
static void
handle_dv_connect (void *cls,
const struct GNUNET_PeerIdentity *peer,
- uint32_t distance, uint32_t network)
+ uint32_t distance,
+ enum GNUNET_ATS_Network_Type network)
{
struct Plugin *plugin = cls;
struct Session *session;
ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
ats[0].value = htonl (distance);
ats[1].type = htonl (GNUNET_ATS_NETWORK_TYPE);
- ats[1].value = htonl (network);
+ ats[1].value = htonl ((uint32_t) network);
session->active = GNUNET_YES;
plugin->env->session_start (plugin->env->cls, peer,
PLUGIN_NAME,
handle_dv_distance_changed (void *cls,
const struct GNUNET_PeerIdentity *peer,
uint32_t distance,
- uint32_t network)
+ enum GNUNET_ATS_Network_Type network)
{
struct Plugin *plugin = cls;
struct Session *session;
#define GNUNET_SERVICE_DV_H
#include "gnunet_util_lib.h"
-
+#include "gnunet_ats_service.h"
/**
* Signature of a function to be called if DV
typedef void (*GNUNET_DV_ConnectCallback)(void *cls,
const struct GNUNET_PeerIdentity *peer,
uint32_t distance,
- uint32_t network);
+ enum GNUNET_ATS_Network_Type network);
/**
typedef void (*GNUNET_DV_DistanceChangedCallback)(void *cls,
const struct GNUNET_PeerIdentity *peer,
uint32_t distance,
- uint32_t network);
+ enum GNUNET_ATS_Network_Type network);
/**
if (GNUNET_ATS_NET_UNSPECIFIED != net)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Could not obtain a valid network for `%s' %s\n"),
+ _("Could not obtain a valid network for `%s' %s (%s)\n"),
GNUNET_i2s (&address->peer),
- GST_plugins_a2s (address));
+ GST_plugins_a2s (address),
+ address->transport_name);
GNUNET_break (0);
}
ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
*
* @param cls closure ('struct Plugin*')
* @param session the session
- * @return the network type in HBO or GNUNET_SYSERR
+ * @return the network type in HBO or #GNUNET_SYSERR
*/
static enum GNUNET_ATS_Network_Type
tcp_get_network (void *cls,