aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_manipulation.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-03-15 14:27:16 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-03-15 14:27:16 +0000
commit7df1fa12d8761e9a08a2aecc1611c398a1663b6f (patch)
tree3c5b4014ea5e80c7a9b9f8a77e8c27631b5006d3 /src/transport/gnunet-service-transport_manipulation.c
parentbfe1307e037a7811c2d9f86393554aa6ac09a957 (diff)
downloadgnunet-7df1fa12d8761e9a08a2aecc1611c398a1663b6f.tar.gz
gnunet-7df1fa12d8761e9a08a2aecc1611c398a1663b6f.zip
clean up
Diffstat (limited to 'src/transport/gnunet-service-transport_manipulation.c')
-rw-r--r--src/transport/gnunet-service-transport_manipulation.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/transport/gnunet-service-transport_manipulation.c b/src/transport/gnunet-service-transport_manipulation.c
index c79176af0..3d9272c53 100644
--- a/src/transport/gnunet-service-transport_manipulation.c
+++ b/src/transport/gnunet-service-transport_manipulation.c
@@ -37,6 +37,14 @@
37#define DELAY 0 37#define DELAY 0
38#define DISTANCE 1 38#define DISTANCE 1
39 39
40
41enum TRAFFIC_METRIC_DIRECTION
42{
43 TM_SEND = 0,
44 TM_RECEIVE = 1,
45 TM_BOTH = 2
46};
47
40struct GST_ManipulationHandle man_handle; 48struct GST_ManipulationHandle man_handle;
41 49
42 50
@@ -175,6 +183,20 @@ GST_manipulation_set_metric (void *cls, struct GNUNET_SERVER_Client *client,
175 if (0 == ntohs (tm->ats_count)) 183 if (0 == ntohs (tm->ats_count))
176 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 184 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
177 185
186 switch (ntohs(tm->direction)) {
187 case 1:
188 direction = TM_SEND;
189 break;
190 case 2:
191 direction = TM_RECEIVE;
192 break;
193 case 3:
194 direction = TM_BOTH;
195 break;
196 default:
197 break;
198 }
199
178 memset (&dummy, '\0', sizeof (struct GNUNET_PeerIdentity)); 200 memset (&dummy, '\0', sizeof (struct GNUNET_PeerIdentity));
179 if (0 == memcmp (&tm->peer, &dummy, sizeof (struct GNUNET_PeerIdentity))) 201 if (0 == memcmp (&tm->peer, &dummy, sizeof (struct GNUNET_PeerIdentity)))
180 { 202 {
@@ -185,7 +207,7 @@ GST_manipulation_set_metric (void *cls, struct GNUNET_SERVER_Client *client,
185 { 207 {
186 type = htonl (ats[c].type); 208 type = htonl (ats[c].type);
187 value = htonl (ats[c].value); 209 value = htonl (ats[c].value);
188 direction = ntohs (tm->direction); 210
189 switch (type) { 211 switch (type) {
190 case GNUNET_ATS_QUALITY_NET_DELAY: 212 case GNUNET_ATS_QUALITY_NET_DELAY:
191 213
@@ -229,10 +251,10 @@ GST_manipulation_set_metric (void *cls, struct GNUNET_SERVER_Client *client,
229 value = htonl (ats[c].value); 251 value = htonl (ats[c].value);
230 switch (type) { 252 switch (type) {
231 case GNUNET_ATS_QUALITY_NET_DELAY: 253 case GNUNET_ATS_QUALITY_NET_DELAY:
232 set_delay (tmp, &tm->peer, ntohs (tm->direction), value); 254 set_delay (tmp, &tm->peer, direction, value);
233 break; 255 break;
234 case GNUNET_ATS_QUALITY_NET_DISTANCE: 256 case GNUNET_ATS_QUALITY_NET_DISTANCE:
235 set_distance (tmp, &tm->peer, ntohs (tm->direction), value); 257 set_distance (tmp, &tm->peer, direction, value);
236 break; 258 break;
237 default: 259 default:
238 break; 260 break;