OverSim
TCPExampleApp.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2010 Karlsruhe Institute of Technology (KIT),
3 // Institute of Telematics
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 //
19 
25 #ifndef TCPEXAMPLEAPP_H
26 #define TCPEXAMPLEAPP_H
27 
28 #include <omnetpp.h>
29 #include <BaseApp.h>
30 
31 #include "TCPExampleMessage_m.h"
32 
43 class TCPExampleApp : public BaseApp
44 {
45 public:
46  TCPExampleApp();
48 
49 private:
50  // application routines
51  void initializeApp(int stage);
52  void finishApp();
53  void handleTimerEvent(cMessage* msg);
54  void handleDataReceived(TransportAddress address, cPacket* msg, bool urgent);
55  void handleConnectionEvent(EvCode code, TransportAddress address);
56 
57  // module parameters
58  simtime_t sendPeriod; // we'll store the "sendPeriod" parameter here
59 
60  // statistics
61  int numSent; //number of packets sent
62  int numReceived; //number of packets received
63 
64  // our timer
65  cMessage *timerMsg;
66 };
67 
68 #endif