#include "platform.h"
#include "gnunet-service-transport_hello.h"
#include "gnunet-service-transport_neighbours.h"
#include "gnunet-service-transport_plugins.h"
#include "gnunet-service-transport_validation.h"
#include "gnunet-service-transport.h"
#include "transport.h"
Go to the source code of this file.
Functions | |
void | GST_manipulation_set_metric (const struct TrafficMetricMessage *tm) |
Set traffic metric to manipulate. More... | |
void | GST_manipulation_send (const struct GNUNET_PeerIdentity *target, const void *msg, size_t msg_size, struct GNUNET_TIME_Relative timeout, GST_NeighbourSendContinuation cont, void *cont_cls) |
Adapter function between transport's send function and transport plugins. More... | |
struct GNUNET_TIME_Relative | GST_manipulation_recv (void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, const struct GNUNET_MessageHeader *message) |
Adapter function between transport plugins and transport receive function manipulation delays for next send. More... | |
void | GST_manipulation_manipulate_metrics (const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, struct GNUNET_ATS_Properties *prop) |
Function that will be called to manipulate ATS information according to current manipulation settings. More... | |
void | GST_manipulation_peer_disconnect (const struct GNUNET_PeerIdentity *peer) |
Notify manipulation about disconnect so it can discard queued messages. More... | |
void | GST_manipulation_init (void) |
Initialize traffic manipulation. More... | |
void | GST_manipulation_stop (void) |
Stop traffic manipulation. More... | |
void GST_manipulation_set_metric | ( | const struct TrafficMetricMessage * | tm | ) |
Set traffic metric to manipulate.
message | containing information |
tm | message containing information |
Definition at line 174 of file gnunet-service-transport_manipulation.c.
References delay_in, TM_Peer::delay_in, TrafficMetricMessage::delay_in, delay_out, TM_Peer::delay_out, TrafficMetricMessage::delay_out, GNUNET_ATS_properties_ntoh(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_CONTAINER_multipeermap_get(), GNUNET_CONTAINER_multipeermap_put(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, GNUNET_new, GNUNET_TIME_relative_ntoh(), TM_Peer::peer, TrafficMetricMessage::peer, peers, TM_Peer::properties, TrafficMetricMessage::properties, and zero.
Referenced by handle_client_set_metric().
void GST_manipulation_send | ( | const struct GNUNET_PeerIdentity * | target, |
const void * | msg, | ||
size_t | msg_size, | ||
struct GNUNET_TIME_Relative | timeout, | ||
GST_NeighbourSendContinuation | cont, | ||
void * | cont_cls | ||
) |
Adapter function between transport's send function and transport plugins.
target | the peer the message to send to |
msg | the message received |
msg_size | message size |
timeout | timeout |
cont | the continuation to call after sending |
cont_cls | cls for continuation |
Delays message transmission if an artificial delay is configured.
target | the peer the message to send to |
msg | the message received |
msg_size | message size |
timeout | timeout |
cont | the continuation to call after sending |
cont_cls | cls for cont |
Definition at line 278 of file gnunet-service-transport_manipulation.c.
References DelayQueueEntry::cont, DelayQueueEntry::cont_cls, delay, delay_out, TM_Peer::delay_out, generic_dqe_head, generic_dqe_tail, generic_send_delay_task, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CONTAINER_multipeermap_get(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, GNUNET_malloc, GNUNET_memcpy, GNUNET_SCHEDULER_add_delayed(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_relative_to_absolute(), GNUNET_YES, GST_neighbours_send(), DelayQueueEntry::id, msg, DelayQueueEntry::msg, DelayQueueEntry::msg_size, peers, GNUNET_TIME_Relative::rel_value_us, TM_Peer::send_delay_task, send_delayed(), TM_Peer::send_head, TM_Peer::send_tail, DelayQueueEntry::sent_at, timeout, DelayQueueEntry::timeout, and DelayQueueEntry::tmp.
Referenced by handle_client_send().
struct GNUNET_TIME_Relative GST_manipulation_recv | ( | void * | cls, |
const struct GNUNET_HELLO_Address * | address, | ||
struct GNUNET_ATS_Session * | session, | ||
const struct GNUNET_MessageHeader * | message | ||
) |
Adapter function between transport plugins and transport receive function manipulation delays for next send.
cls | the closure for transport |
address | the address and the peer the message was received from |
message | the message received |
session | the session the message was received on |
Definition at line 355 of file gnunet-service-transport_manipulation.c.
Referenced by run().
void GST_manipulation_manipulate_metrics | ( | const struct GNUNET_HELLO_Address * | address, |
struct GNUNET_ATS_Session * | session, | ||
struct GNUNET_ATS_Properties * | prop | ||
) |
Function that will be called to manipulate ATS information according to current manipulation settings.
address | binary address | |
session | the session | |
prop[IN|OUT] | metrics to modify | |
address | binary address | |
session | the session | |
[in,out] | prop | metrics to modify |
Definition at line 355 of file gnunet-service-transport_manipulation.c.
References address, GNUNET_CONTAINER_multipeermap_get(), peer, peers, and TM_Peer::properties.
Referenced by GST_ats_update_delay(), GST_ats_update_distance(), and GST_ats_update_utilization().
void GST_manipulation_peer_disconnect | ( | const struct GNUNET_PeerIdentity * | peer | ) |
Notify manipulation about disconnect so it can discard queued messages.
peer | the disconnecting peer |
Definition at line 456 of file gnunet-service-transport_manipulation.c.
References DelayQueueEntry::cont, DelayQueueEntry::cont_cls, generic_dqe_head, generic_dqe_tail, generic_send_delay_task, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multipeermap_get(), GNUNET_free, GNUNET_SCHEDULER_add_at(), GNUNET_SCHEDULER_cancel(), GNUNET_SYSERR, DelayQueueEntry::id, DelayQueueEntry::msg_size, DelayQueueEntry::next, peer, peers, send_delayed(), TM_Peer::send_head, TM_Peer::send_tail, DelayQueueEntry::sent_at, and DelayQueueEntry::tmp.
Referenced by neighbours_disconnect_notification().
void GST_manipulation_init | ( | void | ) |
Initialize traffic manipulation.
Definition at line 415 of file gnunet-service-transport_manipulation.c.
References delay, delay_in, delay_out, GNUNET_CONFIGURATION_get_value_time(), GNUNET_CONTAINER_multipeermap_create(), GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_NO, GNUNET_OK, GNUNET_STRINGS_relative_time_to_string(), GNUNET_YES, GST_cfg, peers, and GNUNET_TIME_Relative::rel_value_us.
Referenced by run().
void GST_manipulation_stop | ( | void | ) |
Stop traffic manipulation.
Definition at line 557 of file gnunet-service-transport_manipulation.c.
Referenced by shutdown_task().