|
INET Framework for OMNeT++/OMNEST
|
00001 // 00002 // Copyright (C) 2004 Andras Varga 00003 // Copyright (C) 2009-2010 Thomas Reschka 00004 // 00005 // This program is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU Lesser 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 Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this program; if not, see <http://www.gnu.org/licenses/>. 00017 // 00018 00019 #ifndef __INET_TCPALGORITHM_H 00020 #define __INET_TCPALGORITHM_H 00021 00022 #include <omnetpp.h> 00023 #include "TCPConnection.h" 00024 #include "TCPSegment.h" 00025 00026 00027 00034 class INET_API TCPAlgorithm : public cPolymorphic 00035 { 00036 protected: 00037 TCPConnection *conn; // we belong to this connection 00038 TCPStateVariables *state; // our state variables 00039 00046 virtual TCPStateVariables *createStateVariables() = 0; 00047 00048 public: 00052 TCPAlgorithm() {state = NULL; conn = NULL;} 00053 00057 virtual ~TCPAlgorithm() {} 00058 00063 void setConnection(TCPConnection *_conn) {conn = _conn;} 00064 00068 TCPStateVariables *getStateVariables() { 00069 if (!state) state = createStateVariables(); 00070 return state; 00071 } 00072 00078 virtual void initialize() {} 00079 00087 virtual void established(bool active) = 0; 00088 00092 virtual void connectionClosed() = 0; 00093 00103 virtual void processTimer(cMessage *timer, TCPEventCode& event) = 0; 00104 00108 virtual void sendCommandInvoked() = 0; 00109 00117 virtual void receivedOutOfOrderSegment() = 0; 00118 00125 virtual void receiveSeqChanged() = 0; 00126 00135 virtual void receivedDataAck(uint32 firstSeqAcked) = 0; 00136 00143 virtual void receivedDuplicateAck() = 0; 00144 00149 virtual void receivedAckForDataNotYetSent(uint32 seq) = 0; 00150 00155 virtual void ackSent() = 0; 00156 00162 virtual void dataSent(uint32 fromseq) = 0; 00163 00167 virtual void restartRexmitTimer() = 0; 00168 00173 virtual void rttMeasurementCompleteUsingTS(uint32 echoedTS) = 0; 00174 00175 }; 00176 00177 #endif 00178 00179