TrafficGen.h

00001 //
00002 // This program is free software: you can redistribute it and/or modify
00003 // it under the terms of the GNU Lesser General Public License as published by
00004 // the Free Software Foundation, either version 3 of the License, or
00005 // (at your option) any later version.
00006 //
00007 // This program is distributed in the hope that it will be useful,
00008 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 // GNU Lesser General Public License for more details.
00011 //
00012 // You should have received a copy of the GNU Lesser General Public License
00013 // along with this program.  If not, see http://www.gnu.org/licenses/.
00014 //
00015 
00016 #ifndef TRAFFICGEN_H_
00017 #define TRAFFICGEN_H_
00018 
00019 #include "BaseApplLayer.h"
00020 #include <BaseWorldUtility.h>
00021 
00022 #include <omnetpp.h>
00023 
00027 class TrafficGen : public BaseApplLayer
00028 {
00029 public:
00030 
00032   enum TrafficGenMessageKinds {
00034     SEND_PACKET_TIMER = LAST_BASE_APPL_MESSAGE_KIND,
00036     TRAFFIC_GEN_PACKET,
00038     LAST_TRAFFIC_GEN_MESSAGE_KIND
00039   };
00040 
00041 protected:
00042 
00045   simtime_t packetTime;
00046 
00049   double pppt;
00050 
00052   int burstSize;
00053 
00055   int remainingBurst;
00056 
00058   int catPacket;
00059 
00061   long nbPacketDropped;
00062 
00064   cMessage *delayTimer;
00065 
00067   BaseWorldUtility* world;
00068 
00069 public:
00070   virtual ~TrafficGen();
00072   virtual void initialize(int stage);
00073 
00075   virtual void finish();
00076 
00077 protected:
00078 
00080   virtual void handleSelfMsg(cMessage *msg);
00081 
00083   virtual void handleLowerMsg(cMessage *msg);
00084 
00086   virtual void sendBroadcast();
00087 };
00088 
00089 #endif