transport component manipulation traffic for simulation More...
#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.
Data Structures | |
struct | TM_Peer |
Struct containing information about manipulations to a specific peer. More... | |
struct | DelayQueueEntry |
Entry in the delay queue for an outbound delayed message. More... | |
Functions | |
void | GST_manipulation_set_metric (const struct TrafficMetricMessage *tm) |
Set traffic metric to manipulate. More... | |
static void | send_delayed (void *cls) |
We have delayed transmission, now it is time to send the message. 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... | |
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... | |
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_init () |
Initialize traffic manipulation. More... | |
void | GST_manipulation_peer_disconnect (const struct GNUNET_PeerIdentity *peer) |
Notify manipulation about disconnect so it can discard queued messages. More... | |
static int | free_tmps (void *cls, const struct GNUNET_PeerIdentity *key, void *value) |
Free manipulation information about a peer. More... | |
void | GST_manipulation_stop () |
Stop traffic manipulation. More... | |
Variables | |
static struct GNUNET_CONTAINER_MultiPeerMap * | peers |
Hashmap contain all peers currently manipulated. More... | |
static struct GNUNET_TIME_Relative | delay_in |
Inbound delay to apply to all peers. More... | |
static struct GNUNET_TIME_Relative | delay_out |
Outbound delay to apply to all peers. More... | |
static struct DelayQueueEntry * | generic_dqe_head |
DLL head for delayed messages based on general delay. More... | |
static struct DelayQueueEntry * | generic_dqe_tail |
DLL tail for delayed messages based on general delay. More... | |
static struct GNUNET_SCHEDULER_Task * | generic_send_delay_task |
Task to schedule delayed sending based on general delay. More... | |
transport component manipulation traffic for simulation
Definition in file gnunet-service-transport_manipulation.c.
void GST_manipulation_set_metric | ( | const struct TrafficMetricMessage * | tm | ) |
Set traffic metric to manipulate.
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().
|
static |
We have delayed transmission, now it is time to send the message.
cls | the struct DelayQueueEntry to transmit |
Definition at line 217 of file gnunet-service-transport_manipulation.c.
References DelayQueueEntry::cont, DelayQueueEntry::cont_cls, generic_dqe_head, generic_dqe_tail, generic_send_delay_task, GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_SCHEDULER_add_at(), GNUNET_YES, GST_neighbours_send(), GST_neighbours_test_connected(), DelayQueueEntry::id, DelayQueueEntry::msg, DelayQueueEntry::msg_size, DelayQueueEntry::next, TM_Peer::send_delay_task, TM_Peer::send_head, TM_Peer::send_tail, DelayQueueEntry::sent_at, DelayQueueEntry::timeout, and DelayQueueEntry::tmp.
Referenced by GST_manipulation_peer_disconnect(), and GST_manipulation_send().
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.
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().
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 | |
[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().
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_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_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().
|
static |
Free manipulation information about a peer.
cls | NULL |
key | peer the info is about |
value | a struct TM_Peer to free |
Definition at line 520 of file gnunet-service-transport_manipulation.c.
References DelayQueueEntry::cont, DelayQueueEntry::cont_cls, GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multipeermap_remove(), GNUNET_free, GNUNET_OK, GNUNET_SCHEDULER_cancel(), GNUNET_SYSERR, GNUNET_YES, key, DelayQueueEntry::msg_size, peers, TM_Peer::send_delay_task, TM_Peer::send_head, TM_Peer::send_tail, DelayQueueEntry::tmp, and value.
void GST_manipulation_stop | ( | void | ) |
Stop traffic manipulation.
Definition at line 557 of file gnunet-service-transport_manipulation.c.
Referenced by shutdown_task().
|
static |
Hashmap contain all peers currently manipulated.
Definition at line 140 of file gnunet-service-transport_manipulation.c.
Referenced by free_tmps(), GST_manipulation_init(), GST_manipulation_manipulate_metrics(), GST_manipulation_peer_disconnect(), GST_manipulation_send(), and GST_manipulation_set_metric().
|
static |
Inbound delay to apply to all peers.
Definition at line 140 of file gnunet-service-transport_manipulation.c.
Referenced by GNUNET_TRANSPORT_manipulation_set(), GST_manipulation_init(), and GST_manipulation_set_metric().
|
static |
Outbound delay to apply to all peers.
Definition at line 140 of file gnunet-service-transport_manipulation.c.
Referenced by GNUNET_TRANSPORT_manipulation_set(), GST_manipulation_init(), GST_manipulation_send(), and GST_manipulation_set_metric().
|
static |
DLL head for delayed messages based on general delay.
Definition at line 155 of file gnunet-service-transport_manipulation.c.
Referenced by GST_manipulation_peer_disconnect(), GST_manipulation_send(), and send_delayed().
|
static |
DLL tail for delayed messages based on general delay.
Definition at line 160 of file gnunet-service-transport_manipulation.c.
Referenced by GST_manipulation_peer_disconnect(), GST_manipulation_send(), and send_delayed().
|
static |
Task to schedule delayed sending based on general delay.
Definition at line 165 of file gnunet-service-transport_manipulation.c.
Referenced by GST_manipulation_peer_disconnect(), GST_manipulation_send(), and send_delayed().