aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwachs <wachs@140774ce-b5e7-0310-ab8b-a85725594a96>2013-02-05 16:02:05 +0000
committerwachs <wachs@140774ce-b5e7-0310-ab8b-a85725594a96>2013-02-05 16:02:05 +0000
commitabdfc3e7e20edb6fbaa6634e4b882af7d8feeea4 (patch)
tree53e4075cc0b8a6be6ceb3060641b905cb5b7efb9
parentd5245f4381430904ed7be39f912f03cb157b2da4 (diff)
docu
git-svn-id: https://gnunet.org/svn/gnunet@26024 140774ce-b5e7-0310-ab8b-a85725594a96
-rw-r--r--src/include/gnunet_transport_service.h25
-rw-r--r--src/transport/transport_api.c26
2 files changed, 51 insertions, 0 deletions
diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h
index 00b06c44f3..5fb46a1824 100644
--- a/src/include/gnunet_transport_service.h
+++ b/src/include/gnunet_transport_service.h
@@ -289,6 +289,31 @@ GNUNET_TRANSPORT_check_neighbour_connected (struct GNUNET_TRANSPORT_Handle *hand
const struct GNUNET_PeerIdentity *peer);
+/**
+ * Set transport metrics for a peer and a direction
+ *
+ * @param handle transport handle
+ * @param peer the peer to set the metric for
+ * @param direction can be: TM_SEND, TM_RECV, TM_BOTH
+ * @param ats the metric as ATS information
+ * @param ats_count the number of metrics
+ *
+ * Supported ATS values:
+ * GNUNET_ATS_QUALITY_NET_DELAY (value in ms)
+ * GNUNET_ATS_QUALITY_NET_DISTANCE (value in #hops)
+ *
+ * Example
+ * To enforce a delay of 10 ms for peer p1 in sending direction use:
+ *
+ * struct GNUNET_ATS_Information ats;
+ * ats.type = ntohl (GNUNET_ATS_QUALITY_NET_DELAY);
+ * ats.value = ntohl (10);
+ * GNUNET_TRANSPORT_set_traffic_metric (th, p1, TM_SEND, &ats, 1);
+ *
+ * Note:
+ * Delay restrictions in receiving direction will be enforced with
+ * 1 message delay.
+ */
void
GNUNET_TRANSPORT_set_traffic_metric (struct GNUNET_TRANSPORT_Handle *handle,
const struct GNUNET_PeerIdentity *peer,
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c
index 966a71ee33..7f0bc92d25 100644
--- a/src/transport/transport_api.c
+++ b/src/transport/transport_api.c
@@ -1207,6 +1207,32 @@ send_metric (void *cls, size_t size, void *buf)
return ssize;
}
+
+/**
+ * Set transport metrics for a peer and a direction
+ *
+ * @param handle transport handle
+ * @param peer the peer to set the metric for
+ * @param direction can be: TM_SEND, TM_RECV, TM_BOTH
+ * @param ats the metric as ATS information
+ * @param ats_count the number of metrics
+ *
+ * Supported ATS values:
+ * GNUNET_ATS_QUALITY_NET_DELAY (value in ms)
+ * GNUNET_ATS_QUALITY_NET_DISTANCE (value in #hops)
+ *
+ * Example
+ * To enforce a delay of 10 ms for peer p1 in sending direction use:
+ *
+ * struct GNUNET_ATS_Information ats;
+ * ats.type = ntohl (GNUNET_ATS_QUALITY_NET_DELAY);
+ * ats.value = ntohl (10);
+ * GNUNET_TRANSPORT_set_traffic_metric (th, p1, TM_SEND, &ats, 1);
+ *
+ * Note:
+ * Delay restrictions in receiving direction will be enforced with
+ * 1 message delay.
+ */
void
GNUNET_TRANSPORT_set_traffic_metric (struct GNUNET_TRANSPORT_Handle *handle,
const struct GNUNET_PeerIdentity *peer,