TCPExampleApp.h

Go to the documentation of this file.
00001 //
00002 // Copyright (C) 2010 Karlsruhe Institute of Technology (KIT),
00003 //                    Institute of Telematics
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 
00025 #ifndef TCPEXAMPLEAPP_H
00026 #define TCPEXAMPLEAPP_H
00027 
00028 #include <omnetpp.h>
00029 #include <BaseApp.h>
00030 
00031 #include "TCPExampleMessage_m.h"
00032 
00043 class TCPExampleApp : public BaseApp
00044 {
00045 public:
00046     TCPExampleApp();
00047     ~TCPExampleApp();
00048 
00049 private:
00050     // application routines
00051     void initializeApp(int stage);
00052     void finishApp();
00053     void handleTimerEvent(cMessage* msg);
00054     void handleDataReceived(TransportAddress address, cPacket* msg, bool urgent);
00055     void handleConnectionEvent(EvCode code, TransportAddress address);
00056 
00057     // module parameters
00058     simtime_t sendPeriod;     // we'll store the "sendPeriod" parameter here
00059 
00060     // statistics
00061     int numSent;              //number of packets sent
00062     int numReceived;          //number of packets received
00063 
00064     // our timer
00065     cMessage *timerMsg;
00066 };
00067 
00068 #endif