Next: 31.3.0.0.1 Exponential On/Off
Up: 31. Applications and transport
Previous: 31.2.5 An example
31.3 The class TrafficGenerator
TrafficGenerator is an abstract C++ class defined as follows:
class TrafficGenerator : public Application {
public:
TrafficGenerator();
virtual double next\_interval(int &) = 0;
virtual void init() {}
virtual double interval() { return 0; }
virtual int on() { return 0; }
virtual void timeout();
virtual void recv() {}
virtual void resume() {}
protected:
virtual void start();
virtual void stop();
double nextPkttime\_;
int size\_;
int running\_;
TrafficTimer timer\_;
};
The pure virtual function []next_interval returns the time until the
next packet is created and also sets the size in bytes of the next
packet. The function []start calls init and starts the
timer. The function []timeout sends a packet and reschedules the
next timeout. The function []stop cancels any pending transmissions.
Callbacks are typically not used for traffic generators, so these
functions (recv, resume) are null.
Currently, there are four C++ classes derived from the
class TrafficGenerator:
- 1.
- EXPOO_Traffic--generates traffic according to an
Exponential On/Off distribution.
Packets are sent at a fixed rate during on periods, and
no packets are sent during off periods.
Both on and off periods are taken from an exponential distribution.
Packets are constant size.
- 2.
- POO_Traffic--generates traffic
according to a Pareto On/Off distribution.
This is identical to the Exponential On/Off distribution,
except the on and off periods are taken from a pareto distribution.
These sources can be used to generate aggregate traffic
that exhibits long range dependency.
- 3.
- CBR_Traffic--generates traffic according to a deterministic rate.
Packets are constant size. Optionally, some randomizing dither can be
enabled on the interpacket departure intervals.
- 4.
- TrafficTrace--generates traffic according to a trace file.
Each record in the trace file consists of 2 32-bit fields.
The first contains the time in microseconds
until the next packet is generated.
The second contains the length in bytes of the next packet.
These classes can be created from OTcl. The OTcl classes names and
associated parameters are given below:
Next: 31.3.0.0.1 Exponential On/Off
Up: 31. Applications and transport
Previous: 31.2.5 An example
2000-08-24