41.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 in network (big-endian) byte order. 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:



Subsections
Tom Henderson 2014-12-17