From abdfc3e7e20edb6fbaa6634e4b882af7d8feeea4 Mon Sep 17 00:00:00 2001 From: wachs Date: Tue, 5 Feb 2013 16:02:05 +0000 Subject: docu git-svn-id: https://gnunet.org/svn/gnunet@26024 140774ce-b5e7-0310-ab8b-a85725594a96 --- src/include/gnunet_transport_service.h | 25 +++++++++++++++++++++++++ src/transport/transport_api.c | 26 ++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) 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, -- cgit v1.2.3-18-g5258