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);
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;
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)
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) ||
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;
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);
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);
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);
"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);
}
}
}
//"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)
* 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);
* 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);