|
INET Framework for OMNeT++/OMNEST
|
00001 // 00002 // Copyright (C) 2004 Andras Varga 00003 // 00004 // This program is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public License 00006 // as published by the Free Software Foundation; either version 2 00007 // of the License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU Lesser General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU Lesser General Public License 00015 // along with this program; if not, see <http://www.gnu.org/licenses/>. 00016 // 00017 00018 #ifndef __INET_TCPBASEALG_OLD_H 00019 #define __INET_TCPBASEALG_OLD_H 00020 00021 #include <omnetpp.h> 00022 #include "TCPAlgorithm_old.h" 00023 00024 namespace tcp_old { 00025 00029 class INET_API TCPBaseAlgStateVariables : public TCPStateVariables 00030 { 00031 public: 00032 TCPBaseAlgStateVariables(); 00033 virtual std::string info() const; 00034 virtual std::string detailedInfo() const; 00035 00037 00038 bool delayed_acks_enabled; 00039 bool nagle_enabled; 00040 00041 00043 00044 int rexmit_count; 00045 simtime_t rexmit_timeout; 00046 00047 00049 00050 uint snd_cwnd; 00051 00052 00054 00055 uint32 rtseq; 00056 simtime_t rtseq_sendtime; 00057 00058 00060 00061 simtime_t srtt; 00062 simtime_t rttvar; 00063 00064 }; 00065 00066 00089 class INET_API TCPBaseAlg : public TCPAlgorithm 00090 { 00091 protected: 00092 TCPBaseAlgStateVariables *&state; // alias to TCLAlgorithm's 'state' 00093 00094 cMessage *rexmitTimer; 00095 cMessage *persistTimer; 00096 cMessage *delayedAckTimer; 00097 cMessage *keepAliveTimer; 00098 00099 cOutVector *cwndVector; // will record changes to snd_cwnd 00100 cOutVector *ssthreshVector; // will record changes to ssthresh 00101 cOutVector *rttVector; // will record measured RTT 00102 cOutVector *srttVector; // will record smoothed RTT 00103 cOutVector *rttvarVector;// will record RTT variance (rttvar) 00104 cOutVector *rtoVector; // will record retransmission timeout 00105 00106 protected: 00109 virtual void processRexmitTimer(TCPEventCode& event); 00110 virtual void processPersistTimer(TCPEventCode& event); 00111 virtual void processDelayedAckTimer(TCPEventCode& event); 00112 virtual void processKeepAliveTimer(TCPEventCode& event); 00114 00118 virtual void startRexmitTimer(); 00119 00125 virtual void rttMeasurementComplete(simtime_t tSent, simtime_t tAcked); 00126 00130 virtual bool sendData(); 00131 00133 cMessage *cancelEvent(cMessage *msg) {return conn->getTcpMain()->cancelEvent(msg);} 00134 00135 public: 00139 TCPBaseAlg(); 00140 00144 virtual ~TCPBaseAlg(); 00145 00149 virtual void initialize(); 00150 00151 virtual void established(bool active); 00152 00153 virtual void connectionClosed(); 00154 00158 virtual void processTimer(cMessage *timer, TCPEventCode& event); 00159 00160 virtual void sendCommandInvoked(); 00161 00162 virtual void receivedOutOfOrderSegment(); 00163 00164 virtual void receiveSeqChanged(); 00165 00166 virtual void receivedDataAck(uint32 firstSeqAcked); 00167 00168 virtual void receivedDuplicateAck(); 00169 00170 virtual void receivedAckForDataNotYetSent(uint32 seq); 00171 00172 virtual void ackSent(); 00173 00174 virtual void dataSent(uint32 fromseq); 00175 00176 virtual void restartRexmitTimer(); 00177 }; 00178 00179 } 00180 #endif 00181 00182