35  m_rnd_generator(m_seed),
 
   36  m_recv_packet_loss_seq(recv_packet_loss_seq),
 
   37  m_recv_packet_loss_distribution(recv_packet_loss_prob),
 
   38  m_recv_latency_seq(recv_latency_seq),
 
   39  m_recv_latency_distribution_msec(recv_latency_range.first.count(),
 
   40                                   recv_latency_range.second.count()),
 
   41  m_recv_packet_dup_seq(recv_packet_dup_seq),
 
   42  m_recv_packet_dup_distribution(recv_packet_dup_prob)
 
   44  using boost::chrono::round;
 
   45  using boost::chrono::milliseconds; 
 
   47  FLOW_LOG_INFO(
"Net_env_simulator [" << 
this << 
"] started with random seed [" << 
m_seed << 
"]; " 
   48                "receiver packet loss [" 
   49                << (recv_packet_loss_prob * 
prob_type_t(100)) << 
"%]; " 
   50                "latency range [" << round<milliseconds>(recv_latency_range.first) << 
", " 
   51                << round<milliseconds>(recv_latency_range.second) << 
"]; " 
   52                "packet duplication probability [" 
   53                << (recv_packet_dup_prob * 
prob_type_t(100)) << 
"%]" 
Interface that the user should implement, passing the implementing Logger into logging classes (Flow'...
std::queue< Fine_duration > Latency_seq
Short-hand for list of packet latencies.
Net_env_simulator(log::Logger *logger_ptr, seed_type_t random_seed=0, prob_type_t recv_packet_loss_prob=0, const Packet_loss_seq &recv_packet_loss_seq=Packet_loss_seq(), const Latency_range &recv_latency_range=Latency_range(), const Latency_seq &recv_latency_seq=Latency_seq(), prob_type_t recv_packet_dup_prob=0, const Packet_dup_seq &recv_packet_dup_seq=Packet_dup_seq())
Constructs simulator.
Packet_dup_seq m_recv_packet_dup_seq
At a given point in time, the i-th from now (in chronological order) received packet will be duplicat...
std::queue< bool > Packet_dup_seq
Short-hand for list of packet duplication outcomes.
Random_generator m_rnd_generator
Random number generator for various random events like packet loss.
boost::random::bernoulli_distribution< prob_type_t > m_recv_packet_loss_distribution
Returns true or false according to some probability set at construction; used for received packet los...
double prob_type_t
Short-hand for floating point between 0 and 1 used to express probability.
Packet_loss_seq m_recv_packet_loss_seq
At a given point in time, the i-th from now (in chronological order) received packet will be dropped ...
std::pair< Fine_duration, Fine_duration > Latency_range
Short-hand for latency range [low, high].
boost::random::uniform_int_distribution< Fine_duration::rep > m_recv_latency_distribution_msec
Returns random latencies (in units of Fine_duration) within the improper [low, high] range given at c...
Fine_duration received_packet_latency()
Low-level packet was received and not dropped, but should we simulate that it was lagged by an additi...
boost::random::bernoulli_distribution< prob_type_t > m_recv_packet_dup_distribution
Returns true or false according to some probability set at construction; used for received packet dup...
uint32_t seed_type_t
Short-hand for the random seed integer type.
Latency_seq m_recv_latency_seq
At a given point in time, the i-th from now (in chronological order) received packet will be lagged b...
seed_type_t m_seed
Random seed for m_rnd_generator (saved for reproducibility of "random" events).
bool should_duplicate_received_packet()
Low-level packet was received, but should we simulate that it was duplicated? Probability and/or pres...
bool should_drop_received_packet()
Low-level packet was received, but should we simulate that it was dropped before receipt?...
std::queue< bool > Packet_loss_seq
Short-hand for list of packet loss outcomes.
#define FLOW_LOG_INFO(ARG_stream_fragment)
Logs an INFO message into flow::log::Logger *get_logger() with flow::log::Component get_log_component...
Flow module containing the API and implementation of the Flow network protocol, a TCP-inspired stream...
boost::chrono::microseconds time_since_posix_epoch()
Get the current POSIX (Unix) time as a duration from the Epoch time point.
Flow_log_component
The flow::log::Component payload enumeration comprising various log components used by Flow's own int...
Fine_clock::duration Fine_duration
A high-res time duration as computed from two Fine_time_pts.