aboutsummaryrefslogtreecommitdiff
path: root/src/ats-tool
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-11-16 13:06:51 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-11-16 13:06:51 +0000
commit8e13c09bafa9ef36c83955f82d883d47e597ca78 (patch)
tree9141764bf42d4a745c999769dfb05fd72c50a502 /src/ats-tool
parent57dc1a4ec314043cfdbf6e5a0bcf3c4ca103ddec (diff)
print ats information
Diffstat (limited to 'src/ats-tool')
-rw-r--r--src/ats-tool/gnunet-ats.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/ats-tool/gnunet-ats.c b/src/ats-tool/gnunet-ats.c
index a9a8073b07..73e017fc12 100644
--- a/src/ats-tool/gnunet-ats.c
+++ b/src/ats-tool/gnunet-ats.c
@@ -61,6 +61,9 @@ struct PendingResolutions
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
+ struct GNUNET_ATS_Information *ats;
+ uint32_t ats_count;
+
struct GNUNET_TRANSPORT_AddressToStringContext * tats_ctx;
};
@@ -70,11 +73,23 @@ struct PendingResolutions *tail;
void transport_addr_to_str_cb (void *cls, const char *address)
{
struct PendingResolutions * pr = cls;
+ char *ats_str;
+ char *ats_tmp;
+ unsigned int c;
if (NULL != address)
{
- fprintf (stderr, _("Peer `%s' plugin `%s', address `%s', bandwidth out: %u Bytes/s, bandwidth in %u Bytes/s\n"),
+ ats_str = GNUNET_strdup("");
+ for (c = 0; c < pr->ats_count; c++)
+ {
+ ats_tmp = ats_str;
+ GNUNET_asprintf (&ats_str, "%s%u %u ", ats_tmp, ntohl(pr->ats[c].type), ntohl(pr->ats[c].value));
+ GNUNET_free (ats_tmp);
+ }
+
+ fprintf (stderr, _("Peer `%s' plugin `%s', address `%s', bw out: %u Bytes/s, bw in %u Bytes/s, %s\n"),
GNUNET_i2s (&pr->address->peer), pr->address->transport_name, address,
- ntohl (pr->bandwidth_out.value__), ntohl (pr->bandwidth_in.value__));
+ ntohl (pr->bandwidth_out.value__), ntohl (pr->bandwidth_in.value__),ats_str);
+ GNUNET_free (ats_str);
}
else if (NULL != pr)
{
@@ -102,7 +117,13 @@ void ats_perf_cb (void *cls,
{
struct PendingResolutions * pr;
- pr = GNUNET_malloc (sizeof (struct PendingResolutions));
+ pr = GNUNET_malloc (sizeof (struct PendingResolutions) +
+ ats_count * sizeof (struct GNUNET_ATS_Information));
+
+ pr->ats_count = ats_count;
+ pr->ats = (struct GNUNET_ATS_Information *) &pr[1];
+ if (ats_count > 0)
+ memcpy (pr->ats, ats, ats_count * sizeof (struct GNUNET_ATS_Information));
pr->address = GNUNET_HELLO_address_copy (address);
pr->bandwidth_in = bandwidth_in;
pr->bandwidth_out = bandwidth_out;