diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-03-28 13:49:14 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-03-28 13:49:14 +0000 |
commit | ff71fa2f71ad29c1972efd0e57937459a0976389 (patch) | |
tree | b3d6741a74d8f923277538e5a82a88449734ad50 /src/transport/gnunet-service-transport_manipulation.c | |
parent | 80a7c5fe311c13c34411440a98d6d0398c7d3fe6 (diff) | |
download | gnunet-ff71fa2f71ad29c1972efd0e57937459a0976389.tar.gz gnunet-ff71fa2f71ad29c1972efd0e57937459a0976389.zip |
docu
Diffstat (limited to 'src/transport/gnunet-service-transport_manipulation.c')
-rw-r--r-- | src/transport/gnunet-service-transport_manipulation.c | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/src/transport/gnunet-service-transport_manipulation.c b/src/transport/gnunet-service-transport_manipulation.c index e8f64f6cf..145ffc078 100644 --- a/src/transport/gnunet-service-transport_manipulation.c +++ b/src/transport/gnunet-service-transport_manipulation.c | |||
@@ -52,8 +52,6 @@ struct GST_ManipulationHandle | |||
52 | { | 52 | { |
53 | struct GNUNET_CONTAINER_MultiHashMap *peers; | 53 | struct GNUNET_CONTAINER_MultiHashMap *peers; |
54 | 54 | ||
55 | GNUNET_TRANSPORT_UpdateAddressMetrics metric_update_cb; | ||
56 | |||
57 | /** | 55 | /** |
58 | * General inbound delay | 56 | * General inbound delay |
59 | */ | 57 | */ |
@@ -290,6 +288,17 @@ send_delayed (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
290 | GNUNET_free (dqe); | 288 | GNUNET_free (dqe); |
291 | } | 289 | } |
292 | 290 | ||
291 | |||
292 | /** | ||
293 | * Adapter function between transport's send function and transport plugins | ||
294 | * | ||
295 | * @param target the peer the message to send to | ||
296 | * @param msg the message received | ||
297 | * @param msg_size message size | ||
298 | * @param timeout timeout | ||
299 | * @param cont the continuation to call after sending | ||
300 | * @param cont_cls cls for continuation | ||
301 | */ | ||
293 | void | 302 | void |
294 | GST_manipulation_send (const struct GNUNET_PeerIdentity *target, const void *msg, | 303 | GST_manipulation_send (const struct GNUNET_PeerIdentity *target, const void *msg, |
295 | size_t msg_size, struct GNUNET_TIME_Relative timeout, | 304 | size_t msg_size, struct GNUNET_TIME_Relative timeout, |
@@ -393,6 +402,19 @@ GST_manipulation_manipulate_metrics (const struct GNUNET_PeerIdentity *peer, | |||
393 | return ats_new; | 402 | return ats_new; |
394 | } | 403 | } |
395 | 404 | ||
405 | |||
406 | /** | ||
407 | * Adapter function between transport plugins and transport receive function | ||
408 | * manipulation delays for next send. | ||
409 | * | ||
410 | * @param cls the closure for transport | ||
411 | * @param peer the peer the message was received from | ||
412 | * @param message the message received | ||
413 | * @param session the session the message was received on | ||
414 | * @param sender_address the sender address | ||
415 | * @param sender_address_len the length of the sender address | ||
416 | * @return manipulated delay for next receive | ||
417 | */ | ||
396 | struct GNUNET_TIME_Relative | 418 | struct GNUNET_TIME_Relative |
397 | GST_manipulation_recv (void *cls, | 419 | GST_manipulation_recv (void *cls, |
398 | const struct GNUNET_PeerIdentity *peer, | 420 | const struct GNUNET_PeerIdentity *peer, |
@@ -426,12 +448,15 @@ GST_manipulation_recv (void *cls, | |||
426 | return m_delay; | 448 | return m_delay; |
427 | } | 449 | } |
428 | 450 | ||
451 | |||
452 | /** | ||
453 | * Initialize traffic manipulation | ||
454 | * | ||
455 | * @param GST_cfg configuration handle | ||
456 | */ | ||
429 | void | 457 | void |
430 | GST_manipulation_init (const struct GNUNET_CONFIGURATION_Handle *GST_cfg, | 458 | GST_manipulation_init (const struct GNUNET_CONFIGURATION_Handle *GST_cfg) |
431 | GNUNET_TRANSPORT_UpdateAddressMetrics metric_update_cb) | ||
432 | { | 459 | { |
433 | man_handle.metric_update_cb = metric_update_cb; | ||
434 | |||
435 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (GST_cfg, | 460 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (GST_cfg, |
436 | "transport", "MANIPULATE_DISTANCE_IN", &man_handle.distance_recv)) | 461 | "transport", "MANIPULATE_DISTANCE_IN", &man_handle.distance_recv)) |
437 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Setting inbound distance_in to %u\n", | 462 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Setting inbound distance_in to %u\n", |