[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r31356 - in gnunet/src: dv include transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r31356 - in gnunet/src: dv include transport |
Date: |
Fri, 13 Dec 2013 14:00:14 +0100 |
Author: grothoff
Date: 2013-12-13 14:00:14 +0100 (Fri, 13 Dec 2013)
New Revision: 31356
Modified:
gnunet/src/dv/dv_api.c
gnunet/src/dv/gnunet-dv.c
gnunet/src/dv/gnunet-service-dv.c
gnunet/src/dv/plugin_transport_dv.c
gnunet/src/include/gnunet_dv_service.h
gnunet/src/transport/gnunet-service-transport.c
gnunet/src/transport/plugin_transport_tcp.c
Log:
use enum GNUNET_ATS_Network_Type instead of uint32_t where appropriate
Modified: gnunet/src/dv/dv_api.c
===================================================================
--- gnunet/src/dv/dv_api.c 2013-12-13 12:52:22 UTC (rev 31355)
+++ gnunet/src/dv/dv_api.c 2013-12-13 13:00:14 UTC (rev 31356)
@@ -359,7 +359,8 @@
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))
@@ -372,7 +373,7 @@
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))
Modified: gnunet/src/dv/gnunet-dv.c
===================================================================
--- gnunet/src/dv/gnunet-dv.c 2013-12-13 12:52:22 UTC (rev 31355)
+++ gnunet/src/dv/gnunet-dv.c 2013-12-13 13:00:14 UTC (rev 31356)
@@ -48,7 +48,8 @@
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),
@@ -68,7 +69,7 @@
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),
Modified: gnunet/src/dv/gnunet-service-dv.c
===================================================================
--- gnunet/src/dv/gnunet-service-dv.c 2013-12-13 12:52:22 UTC (rev 31355)
+++ gnunet/src/dv/gnunet-service-dv.c 2013-12-13 13:00:14 UTC (rev 31356)
@@ -272,7 +272,7 @@
/**
* The network this peer is in
*/
- uint32_t network;
+ enum GNUNET_ATS_Network_Type network;
/**
* Is this neighbor connected at the core level?
@@ -517,7 +517,7 @@
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;
@@ -529,7 +529,7 @@
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);
}
@@ -543,7 +543,8 @@
*/
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;
@@ -553,7 +554,7 @@
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);
}
@@ -1158,7 +1159,7 @@
* @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)
{
@@ -1166,7 +1167,7 @@
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;
}
@@ -1291,7 +1292,7 @@
{
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;
Modified: gnunet/src/dv/plugin_transport_dv.c
===================================================================
--- gnunet/src/dv/plugin_transport_dv.c 2013-12-13 12:52:22 UTC (rev 31355)
+++ gnunet/src/dv/plugin_transport_dv.c 2013-12-13 13:00:14 UTC (rev 31356)
@@ -126,7 +126,7 @@
/**
* 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
@@ -290,7 +290,8 @@
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;
@@ -336,7 +337,7 @@
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,
@@ -357,7 +358,7 @@
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;
Modified: gnunet/src/include/gnunet_dv_service.h
===================================================================
--- gnunet/src/include/gnunet_dv_service.h 2013-12-13 12:52:22 UTC (rev
31355)
+++ gnunet/src/include/gnunet_dv_service.h 2013-12-13 13:00:14 UTC (rev
31356)
@@ -27,8 +27,8 @@
#define GNUNET_SERVICE_DV_H
#include "gnunet_util_lib.h"
+#include "gnunet_ats_service.h"
-
/**
* Signature of a function to be called if DV
* starts to be able to talk to a peer.
@@ -41,7 +41,7 @@
typedef void (*GNUNET_DV_ConnectCallback)(void *cls,
const struct GNUNET_PeerIdentity
*peer,
uint32_t distance,
- uint32_t network);
+ enum GNUNET_ATS_Network_Type
network);
/**
@@ -56,7 +56,7 @@
typedef void (*GNUNET_DV_DistanceChangedCallback)(void *cls,
const struct
GNUNET_PeerIdentity *peer,
uint32_t distance,
- uint32_t network);
+ enum GNUNET_ATS_Network_Type
network);
/**
Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c 2013-12-13 12:52:22 UTC
(rev 31355)
+++ gnunet/src/transport/gnunet-service-transport.c 2013-12-13 13:00:14 UTC
(rev 31356)
@@ -476,9 +476,10 @@
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);
Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2013-12-13 12:52:22 UTC (rev
31355)
+++ gnunet/src/transport/plugin_transport_tcp.c 2013-12-13 13:00:14 UTC (rev
31356)
@@ -2528,7 +2528,7 @@
*
* @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,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r31356 - in gnunet/src: dv include transport,
gnunet <=