|
INET Framework for OMNeT++/OMNEST
|
00001 // 00002 // Copyright (C) 2004 Andras Varga 00003 // Copyright (C) 2000 Institut fuer Telematik, Universitaet Karlsruhe 00004 // 00005 // This program is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU General Public License 00007 // as published by the Free Software Foundation; either version 2 00008 // of the License, or (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 // 00019 00020 00021 #ifndef __INET_ANSA_IPTRAFGEN_H 00022 #define __INET_ANSA_IPTRAFGEN_H 00023 00024 #include <vector> 00025 #include <omnetpp.h> 00026 00027 #include "IPvXAddress.h" 00028 00029 00033 class INET_API AnsaIPTrafSink : public cSimpleModule 00034 { 00035 protected: 00036 int numReceived; 00037 00038 virtual void printPacket(cPacket *msg); 00039 virtual void processPacket(cPacket *msg); 00040 00041 protected: 00042 virtual void initialize(); 00043 virtual void handleMessage(cMessage *msg); 00044 }; 00045 00046 00050 class INET_API AnsaIPTrafGen : public AnsaIPTrafSink 00051 { 00052 protected: 00053 std::string nodeName; 00054 int protocol; 00055 int msgByteLength; 00056 int numPackets; 00057 std::vector<IPvXAddress> destAddresses; 00058 00059 static int counter; // counter for generating a global number for each packet 00060 00061 int numSent; 00062 00063 // chooses random destination address 00064 virtual IPvXAddress chooseDestAddr(); 00065 virtual void sendPacket(); 00066 00067 protected: 00068 virtual int numInitStages() const {return 4;} 00069 virtual void initialize(int stage); 00070 virtual void handleMessage(cMessage *msg); 00071 }; 00072 00073 #endif 00074 00075