TCPSessionApp.h

Go to the documentation of this file.
00001 //
00002 // Copyright 2004 Andras Varga
00003 //
00004 // This library is free software, you can redistribute it and/or modify
00005 // it under  the terms of the GNU Lesser General Public License
00006 // as published by the Free Software Foundation;
00007 // either version 2 of the License, or any later version.
00008 // The library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00011 // See the GNU Lesser General Public License for more details.
00012 //
00013 
00014 #ifndef __INET_TCPSESSIONAPP_H
00015 #define __INET_TCPSESSIONAPP_H
00016 
00017 #include <vector>
00018 #include <omnetpp.h>
00019 #include "TCPSocket.h"
00020 
00021 
00025 class INET_API TCPSessionApp : public cSimpleModule
00026 {
00027   protected:
00028     struct Command
00029     {
00030         simtime_t tSend;
00031         int numBytes;
00032     };
00033     typedef std::vector<Command> CommandVector;
00034     CommandVector commands;
00035 
00036     TCPSocket socket;
00037 
00038     // statistics
00039     int packetsRcvd;
00040     long bytesRcvd;
00041     long bytesSent;
00042     int indicationsRcvd;
00043 
00044   public:
00045     TCPSessionApp() : cSimpleModule(65536) {}
00046 
00047   protected:
00048     virtual void parseScript(const char *script);
00049     virtual void waitUntil(simtime_t t);
00050     virtual void count(cMessage *msg);
00051 
00052     virtual void activity();
00053     virtual void finish();
00054 };
00055 
00056 #endif
00057 
00058