packet_generator.h
Go to the documentation of this file.
#ifndef PACKET_GENERATOR_H
#define PACKET_GENERATOR_H
#include <itpp/base/random.h>
#if (defined(_MSC_VER) && defined(ITPP_SHARED_LIB) && !(defined(itpp_EXPORTS) || defined(itpp_debug_EXPORTS)))
#ifndef ITPP_PROTOCOL_EXCLUDED
#define ITPP_PROTOCOL_EXCLUDED
#pragma message( "PROTOCOL definitions are not available for MSVC shared builds" )
#endif
#else
#include <itpp/protocol/packet.h>
namespace itpp
{
class Packet_Generator
{
public:
Packet_Generator(const int Packet_size = 150, const unsigned long int Max_packets = 0);
virtual ~Packet_Generator();
Signal<Packet*> output;
Slot<Packet_Generator, bool> start;
void set_parameters(const int Packet_size, const unsigned long int Max_packets);
int get_packet_size();
int get_max_packets();
protected:
virtual Ttype delta_t() = 0;
private:
Slot<Packet_Generator, Packet*> next;
void handle_next(Packet*);
void handle_start(const bool run);
bool keep_running;
unsigned long int id;
int packet_size;
unsigned long int max_packets;
};
class Poisson_Packet_Generator : public Packet_Generator
{
public:
Poisson_Packet_Generator(const double Avg_bit_rate = 1.0, const int Packet_size = 150, const unsigned long int Max_packets = 0);
virtual ~Poisson_Packet_Generator();
void set_parameters(const double Avg_bit_rate, const int Packet_size, const unsigned long int Max_packets);
double get_avg_bit_rate();
protected:
virtual Ttype delta_t();
double avg_delta_t;
double avg_bit_rate;
Exponential_RNG ee;
};
class Constant_Rate_Packet_Generator : public Poisson_Packet_Generator
{
public:
Constant_Rate_Packet_Generator(const double Avg_bit_rate = 1.0, const int Packet_size = 150, const unsigned long int Max_packets = 0);
virtual ~Constant_Rate_Packet_Generator();
protected:
virtual Ttype delta_t();
};
class Burst_WWW_Packet_Generator : public Poisson_Packet_Generator
{
public:
Burst_WWW_Packet_Generator(const double Avg_bit_rate = 1.0, const int Packet_size = 150, const int Max_packets = 0);
virtual ~Burst_WWW_Packet_Generator();
protected:
virtual Ttype delta_t();
int N;
int Navg;
double Ti;
double Tr;
};
class Sink
{
public:
Sink(const unsigned long int Max_packets = 1000);
~Sink();
// -- Slots -- //
Slot<Sink, Packet*> packet_input;
private:
void handle_packet_input(Packet* packet);
unsigned long int Ncp;
unsigned long int Nbytes;
unsigned long int max_packets;
Ttype start_time;
};
} // namespace itpp
#endif
#endif // #ifndef PACKET_GENERATOR_H
itpp::Array
General array class.
Definition array.h:105
itpp::Burst_WWW_Packet_Generator
Definition packet_generator.h:130
itpp::Burst_WWW_Packet_Generator::Ti
double Ti
ADD DOCUMENTATION HERE.
Definition packet_generator.h:144
itpp::Burst_WWW_Packet_Generator::Tr
double Tr
ADD DOCUMENTATION HERE.
Definition packet_generator.h:146
itpp::Burst_WWW_Packet_Generator::delta_t
virtual Ttype delta_t()
ADD DOCUMENTATION HERE.
Definition packet_generator.cpp:146
itpp::Burst_WWW_Packet_Generator::~Burst_WWW_Packet_Generator
virtual ~Burst_WWW_Packet_Generator()
ADD DOCUMENTATION HERE.
Definition packet_generator.cpp:141
itpp::Burst_WWW_Packet_Generator::N
int N
ADD DOCUMENTATION HERE.
Definition packet_generator.h:140
itpp::Burst_WWW_Packet_Generator::Navg
int Navg
ADD DOCUMENTATION HERE.
Definition packet_generator.h:142
itpp::Constant_Rate_Packet_Generator
Definition packet_generator.h:115
itpp::Constant_Rate_Packet_Generator::~Constant_Rate_Packet_Generator
virtual ~Constant_Rate_Packet_Generator()
ADD DOCUMENTATION HERE.
Definition packet_generator.cpp:122
itpp::Constant_Rate_Packet_Generator::delta_t
virtual Ttype delta_t()
ADD DOCUMENTATION HERE.
Definition packet_generator.cpp:124
itpp::Exponential_RNG
Exponential distribution.
Definition random.h:406
itpp::Packet_Generator
Definition packet_generator.h:55
itpp::Packet_Generator::delta_t
virtual Ttype delta_t()=0
ADD DOCUMENTATION HERE.
itpp::Packet_Generator::set_parameters
void set_parameters(const int Packet_size, const unsigned long int Max_packets)
ADD DOCUMENTATION HERE.
Definition packet_generator.cpp:46
itpp::Packet_Generator::get_packet_size
int get_packet_size()
ADD DOCUMENTATION HERE.
Definition packet_generator.cpp:54
itpp::Packet_Generator::output
Signal< Packet * > output
ADD DOCUMENTATION HERE.
Definition packet_generator.h:62
itpp::Packet_Generator::get_max_packets
int get_max_packets()
ADD DOCUMENTATION HERE.
Definition packet_generator.cpp:59
itpp::Packet_Generator::start
Slot< Packet_Generator, bool > start
ADD DOCUMENTATION HERE.
Definition packet_generator.h:64
itpp::Packet_Generator::~Packet_Generator
virtual ~Packet_Generator()
ADD DOCUMENTATION HERE.
Definition packet_generator.cpp:44
itpp::Packet
Definition packet.h:56
itpp::Poisson_Packet_Generator
Definition packet_generator.h:89
itpp::Poisson_Packet_Generator::get_avg_bit_rate
double get_avg_bit_rate()
ADD DOCUMENTATION HERE.
Definition packet_generator.cpp:106
itpp::Poisson_Packet_Generator::~Poisson_Packet_Generator
virtual ~Poisson_Packet_Generator()
ADD DOCUMENTATION HERE.
Definition packet_generator.cpp:93
itpp::Poisson_Packet_Generator::avg_delta_t
double avg_delta_t
ADD DOCUMENTATION HERE.
Definition packet_generator.h:103
itpp::Poisson_Packet_Generator::avg_bit_rate
double avg_bit_rate
ADD DOCUMENTATION HERE.
Definition packet_generator.h:105
itpp::Poisson_Packet_Generator::set_parameters
void set_parameters(const double Avg_bit_rate, const int Packet_size, const unsigned long int Max_packets)
ADD DOCUMENTATION HERE.
Definition packet_generator.cpp:95
itpp::Poisson_Packet_Generator::delta_t
virtual Ttype delta_t()
ADD DOCUMENTATION HERE.
Definition packet_generator.cpp:112
itpp::Poisson_Packet_Generator::ee
Exponential_RNG ee
ADD DOCUMENTATION HERE.
Definition packet_generator.h:107
itpp::Sink
Definition packet_generator.h:154
itpp::Sink::~Sink
~Sink()
ADD DOCUMENTATION HERE.
Definition packet_generator.cpp:172
itpp::Sink::packet_input
Slot< Sink, Packet * > packet_input
ADD DOCUMENTATION HERE.
Definition packet_generator.h:162
itpp
itpp namespace
Definition itmex.h:37
packet.h
Definition of a Packet class.
random.h
Definition of classes for random number generators.

Generated on Mon Jun 10 2024 11:49:24 for IT++ by Doxygen 1.9.8