[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r13882 - in gnunet/src: include transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r13882 - in gnunet/src: include transport |
Date: |
Mon, 6 Dec 2010 18:43:49 +0100 |
Author: wachs
Date: 2010-12-06 18:43:49 +0100 (Mon, 06 Dec 2010)
New Revision: 13882
Modified:
gnunet/src/include/gnunet_transport_plugin.h
gnunet/src/transport/gnunet-service-transport.c
gnunet/src/transport/plugin_transport_http.c
gnunet/src/transport/plugin_transport_tcp.c
gnunet/src/transport/plugin_transport_udp.c
gnunet/src/transport/plugin_transport_wlan.c
gnunet/src/transport/test_plugin_transport_http.c
gnunet/src/transport/test_plugin_transport_https.c
Log:
- modified transport plugin interface to support ATS
- modified transport plugins to support ATS
Modified: gnunet/src/include/gnunet_transport_plugin.h
===================================================================
--- gnunet/src/include/gnunet_transport_plugin.h 2010-12-06 16:53:51 UTC
(rev 13881)
+++ gnunet/src/include/gnunet_transport_plugin.h 2010-12-06 17:43:49 UTC
(rev 13882)
@@ -111,7 +111,8 @@
const struct
GNUNET_MessageHeader *
message,
-
uint32_t distance,
+
const struct GNUNET_TRANSPORT_ATS_Information *ats,
+ uint32_t
ats_count,
struct Session *session,
const char *sender_address,
uint16_t sender_address_len);
Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c 2010-12-06 16:53:51 UTC
(rev 13881)
+++ gnunet/src/transport/gnunet-service-transport.c 2010-12-06 17:43:49 UTC
(rev 13882)
@@ -4703,9 +4703,10 @@
static struct GNUNET_TIME_Relative
plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
- uint32_t distance,
- struct Session *session,
- const char *sender_address,
+ const struct GNUNET_TRANSPORT_ATS_Information *ats,
+ uint32_t ats_count,
+ struct Session *session,
+ const char *sender_address,
uint16_t sender_address_len)
{
struct TransportPlugin *plugin = cls;
@@ -4716,6 +4717,8 @@
struct GNUNET_TIME_Relative ret;
if (is_blacklisted (peer, plugin))
return GNUNET_TIME_UNIT_FOREVER_REL;
+ uint32_t distance;
+ int c;
n = find_neighbour (peer);
if (n == NULL)
@@ -4725,6 +4728,15 @@
service_context = service_context->next;
GNUNET_assert ((plugin->api->send == NULL) || (service_context != NULL));
peer_address = NULL;
+ distance = 1;
+ for (c=0; c<ats_count; c++)
+ {
+ if (ntohl(ats[c].type) == GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE)
+ {
+ distance = ntohl(ats[c].value);
+ }
+ }
+
if (message != NULL)
{
if ( (session != NULL) ||
Modified: gnunet/src/transport/plugin_transport_http.c
===================================================================
--- gnunet/src/transport/plugin_transport_http.c 2010-12-06 16:53:51 UTC
(rev 13881)
+++ gnunet/src/transport/plugin_transport_http.c 2010-12-06 17:43:49 UTC
(rev 13882)
@@ -873,9 +873,18 @@
ntohs(message->size),
GNUNET_i2s(&(ps->peercontext)->identity),http_plugin_address_to_string(NULL,ps->addr,ps->addrlen));
#endif
+ struct GNUNET_TRANSPORT_ATS_Information distance[2];
+ distance[0].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
+ distance[0].value = htonl (1);
+ distance[1].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR);
+ distance[1].value = htonl (0);
+
delay = pc->plugin->env->receive (ps->peercontext->plugin->env->cls,
&pc->identity,
-
message, 1, ps,
+
message,
+
(const struct
GNUNET_TRANSPORT_ATS_Information *) &distance,
+
2,
+
ps,
NULL,
0);
pc->delay = delay;
@@ -1576,9 +1585,17 @@
ntohs(message->size),
GNUNET_i2s(&(pc->identity)),http_plugin_address_to_string(NULL,ps->addr,ps->addrlen));
#endif
+ struct GNUNET_TRANSPORT_ATS_Information distance[2];
+ distance[0].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
+ distance[0].value = htonl (1);
+ distance[1].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR);
+ distance[1].value = htonl (0);
+
delay = pc->plugin->env->receive (pc->plugin->env->cls,
&pc->identity,
- message, 1, ps,
+ message,
+ (const struct
GNUNET_TRANSPORT_ATS_Information *) &distance, 2,
+ ps,
ps->addr,
ps->addrlen);
Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2010-12-06 16:53:51 UTC (rev
13881)
+++ gnunet/src/transport/plugin_transport_tcp.c 2010-12-06 17:43:49 UTC (rev
13882)
@@ -2020,6 +2020,7 @@
session->receive_delay_task = GNUNET_SCHEDULER_NO_TASK;
delay = session->plugin->env->receive (session->plugin->env->cls,
&session->target,
+ NULL,
NULL, 0,
session,
NULL, 0);
@@ -2076,7 +2077,14 @@
gettext_noop ("# bytes received via TCP"),
ntohs (message->size),
GNUNET_NO);
- delay = plugin->env->receive (plugin->env->cls, &session->target, message, 1,
+ struct GNUNET_TRANSPORT_ATS_Information distance[2];
+ distance[0].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
+ distance[0].value = htonl (1);
+ distance[1].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR);
+ distance[1].value = htonl (0);
+ delay = plugin->env->receive (plugin->env->cls, &session->target, message,
+ (const struct GNUNET_TRANSPORT_ATS_Information
*) &distance,
+ 2,
session,
(GNUNET_YES == session->inbound) ? NULL :
session->connect_addr,
(GNUNET_YES == session->inbound) ? 0 :
session->connect_alen);
Modified: gnunet/src/transport/plugin_transport_udp.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp.c 2010-12-06 16:53:51 UTC (rev
13881)
+++ gnunet/src/transport/plugin_transport_udp.c 2010-12-06 17:43:49 UTC (rev
13882)
@@ -1474,7 +1474,14 @@
"Sending message type %d to transport!\n",
ntohs(currhdr->type));
#endif
- plugin->env->receive (plugin->env->cls, sender, currhdr,
UDP_DIRECT_DISTANCE,
+ struct GNUNET_TRANSPORT_ATS_Information distance[2];
+ distance[0].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
+ distance[0].value = htonl (UDP_DIRECT_DISTANCE);
+ distance[1].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR);
+ distance[1].value = htonl (0);
+
+ plugin->env->receive (plugin->env->cls, sender, currhdr,
+ (const struct GNUNET_TRANSPORT_ATS_Information *)
&distance, 2,
NULL, sender_addr, fromlen);
}
Modified: gnunet/src/transport/plugin_transport_wlan.c
===================================================================
--- gnunet/src/transport/plugin_transport_wlan.c 2010-12-06 16:53:51 UTC
(rev 13881)
+++ gnunet/src/transport/plugin_transport_wlan.c 2010-12-06 17:43:49 UTC
(rev 13882)
@@ -1750,8 +1750,15 @@
}
}
//"receive" the message
+ struct GNUNET_TRANSPORT_ATS_Information distance[2];
+ distance[0].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
+ distance[0].value = htonl (1);
+ distance[1].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR);
+ distance[1].value = htonl (0);
+
plugin->env->receive(plugin, &session->target,
- temp_hdr, 1, session, session->addr, sizeof(session->addr));
+ temp_hdr, (const struct GNUNET_TRANSPORT_ATS_Information *)
&distance, 2,
+ session, session->addr, sizeof(session->addr));
}
else if (ntohs(hdr->type) == GNUNET_MESSAGE_TYPE_WLAN_FRAGMENT)
Modified: gnunet/src/transport/test_plugin_transport_http.c
===================================================================
--- gnunet/src/transport/test_plugin_transport_http.c 2010-12-06 16:53:51 UTC
(rev 13881)
+++ gnunet/src/transport/test_plugin_transport_http.c 2010-12-06 17:43:49 UTC
(rev 13882)
@@ -505,13 +505,13 @@
* Recieves messages from plugin, in real world transport
*/
static struct GNUNET_TIME_Relative
-receive (void *cls,
- const struct GNUNET_PeerIdentity * peer,
- const struct GNUNET_MessageHeader * message,
- uint32_t distance,
- struct Session *session,
- const char *sender_address,
- uint16_t sender_address_len)
+receive (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message,
+ const struct GNUNET_TRANSPORT_ATS_Information *ats,
+ uint32_t ats_count,
+ struct Session *session,
+ const char *sender_address,
+ uint16_t sender_address_len)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testcase recieved new message from
peer `%s' with type %u and length %u, session %X\n", GNUNET_i2s(peer),
ntohs(message->type), ntohs(message->size),session);
Modified: gnunet/src/transport/test_plugin_transport_https.c
===================================================================
--- gnunet/src/transport/test_plugin_transport_https.c 2010-12-06 16:53:51 UTC
(rev 13881)
+++ gnunet/src/transport/test_plugin_transport_https.c 2010-12-06 17:43:49 UTC
(rev 13882)
@@ -528,13 +528,13 @@
* Recieves messages from plugin, in real world transport
*/
static struct GNUNET_TIME_Relative
-receive (void *cls,
- const struct GNUNET_PeerIdentity * peer,
- const struct GNUNET_MessageHeader * message,
- uint32_t distance,
- struct Session *session,
- const char *sender_address,
- uint16_t sender_address_len)
+receive (void *cls, const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message,
+ const struct GNUNET_TRANSPORT_ATS_Information *ats,
+ uint32_t ats_count,
+ struct Session *session,
+ const char *sender_address,
+ uint16_t sender_address_len)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testcase recieved new message from
peer `%s' with type %u and length %u, session %X\n", GNUNET_i2s(peer),
ntohs(message->type), ntohs(message->size),session);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r13882 - in gnunet/src: include transport,
gnunet <=