IT++ Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
packet_generator.h
Go to the documentation of this file.
1 
29 #ifndef PACKET_GENERATOR_H
30 #define PACKET_GENERATOR_H
31 
32 #include <itpp/protocol/packet.h>
33 #include <itpp/base/random.h>
34 
35 
36 namespace itpp
37 {
38 
40 
41 
46 {
47 public:
49  Packet_Generator(const int Packet_size = 150, const unsigned long int Max_packets = 0);
51  virtual ~Packet_Generator();
57  void set_parameters(const int Packet_size, const unsigned long int Max_packets);
59  int get_packet_size();
61  int get_max_packets();
62 protected:
64  virtual Ttype delta_t() = 0;
65 private:
67  void handle_next(Packet*);
68  void handle_start(const bool run);
69  bool keep_running;
70  unsigned long int id;
71  int packet_size;
72  unsigned long int max_packets;
73 };
74 
75 
80 {
81 public:
83  Poisson_Packet_Generator(const double Avg_bit_rate = 1.0, const int Packet_size = 150, const unsigned long int Max_packets = 0);
85  virtual ~Poisson_Packet_Generator();
87  void set_parameters(const double Avg_bit_rate, const int Packet_size, const unsigned long int Max_packets);
89  double get_avg_bit_rate();
90 protected:
92  virtual Ttype delta_t();
94  double avg_delta_t;
96  double avg_bit_rate;
99 };
100 
101 
106 {
107 public:
109  Constant_Rate_Packet_Generator(const double Avg_bit_rate = 1.0, const int Packet_size = 150, const unsigned long int Max_packets = 0);
112 protected:
114  virtual Ttype delta_t();
115 };
116 
121 {
122 public:
124  Burst_WWW_Packet_Generator(const double Avg_bit_rate = 1.0, const int Packet_size = 150, const int Max_packets = 0);
126  virtual ~Burst_WWW_Packet_Generator();
127 protected:
129  virtual Ttype delta_t();
131  int N;
133  int Navg;
135  double Ti;
137  double Tr;
138 };
139 
140 
144 class Sink
145 {
146 public:
148  Sink(const unsigned long int Max_packets = 1000);
150  ~Sink();
151  // -- Slots -- //
154 private:
155  void handle_packet_input(Packet* packet);
156  unsigned long int Ncp;
157  unsigned long int Nbytes;
158  unsigned long int max_packets;
159  Ttype start_time;
160 };
161 
163 
164 } // namespace itpp
165 
166 #endif // #ifndef PACKET_GENERATOR_H
167 
SourceForge Logo

Generated on Fri Mar 21 2014 17:14:13 for IT++ by Doxygen 1.8.1.2