pub trait TrafficGenerator<T: Scenario>: Send + Sync {
// Required methods
fn get_data_rate_channel(&self) -> Receiver<(f32, f32)>;
fn get_sent_packets_channel(&self) -> Receiver<usize>;
fn get_error_rate_channel(&self) -> Receiver<(f32, f32)>;
fn send_packet(&mut self);
fn set_scenario(&mut self, schem: T);
fn get_scenario(&self) -> &T;
fn run_scenario(&mut self);
fn fire_hose(&mut self);
}
Expand description
Traffic Generators are the bread and butter of pdc. Structs that implement TrafficGenerator will take in a scenario and try to replicate the network traffic described by that scenario.
Required Methods§
Sourcefn get_data_rate_channel(&self) -> Receiver<(f32, f32)>
fn get_data_rate_channel(&self) -> Receiver<(f32, f32)>
Give a bounded channel that sends time series data on the send rate of
a generator. The data is encoded as
(Miliseconds since start of scenario, counts/sec)
.
Sourcefn get_sent_packets_channel(&self) -> Receiver<usize>
fn get_sent_packets_channel(&self) -> Receiver<usize>
Give a bounded channel that sends the total amount of packets/requests sent
Sourcefn get_error_rate_channel(&self) -> Receiver<(f32, f32)>
fn get_error_rate_channel(&self) -> Receiver<(f32, f32)>
Give a bounded channel that sends time series data on the send rate of
a generator. The data is encoded as
(Miliseconds since start of scenario, counts/sec)
.
Sourcefn send_packet(&mut self)
fn send_packet(&mut self)
Send a single packet per call, used for debuging and low traffic testing.
Sourcefn set_scenario(&mut self, schem: T)
fn set_scenario(&mut self, schem: T)
Sets a Scenario
for the generator to try and replicate.
Sourcefn get_scenario(&self) -> &T
fn get_scenario(&self) -> &T
Gets the current Scenario
Sourcefn run_scenario(&mut self)
fn run_scenario(&mut self)
Runs the current scenario