INET Framework for OMNeT++/OMNEST
TCPSACKRexmitQueue.h
Go to the documentation of this file.
00001 //
00002 // Copyright (C) 2009-2010 Thomas Reschka
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_TCPSACKREXMITQUEUE_H
00019 #define __INET_TCPSACKREXMITQUEUE_H
00020 
00021 #include <omnetpp.h>
00022 #include "TCPConnection.h"
00023 #include "TCPSegment.h"
00024 
00025 
00029 class INET_API TCPSACKRexmitQueue
00030 {
00031   public:
00032     TCPConnection *conn; // the connection that owns this queue
00033 
00034     struct Region
00035     {
00036         uint32 beginSeqNum;
00037         uint32 endSeqNum;
00038         bool sacked;      // indicates whether region has already been sacked by data receiver
00039         bool rexmitted;   // indicates whether region has already been retransmitted by data sender
00040     };
00041     typedef std::list<Region> RexmitQueue;
00042     RexmitQueue rexmitQueue;
00043 
00044     uint32 begin;  // 1st sequence number stored
00045     uint32 end;    // last sequence number stored +1
00046 
00047   public:
00051     TCPSACKRexmitQueue();
00052 
00056     virtual ~TCPSACKRexmitQueue();
00057 
00061     virtual void setConnection(TCPConnection *_conn)  {conn = _conn;}
00062 
00071     virtual void init(uint32 seqNum);
00072 
00076     virtual std::string str() const;
00077 
00081     virtual void info();
00082 
00086     virtual uint32 getBufferStartSeq();
00087 
00092     virtual uint32 getBufferEndSeq();
00093 
00098     virtual void discardUpTo(uint32 seqNum);
00099 
00103     virtual void enqueueSentData(uint32 fromSeqNum, uint32 toSeqNum);
00104 
00111     virtual void setSackedBit(uint32 fromSeqNum, uint32 toSeqNum);
00112 
00116     virtual bool getSackedBit(uint32 seqNum);
00117 
00121     virtual uint32 getQueueLength();
00122 
00126     virtual uint32 getHighestSackedSeqNum();
00127 
00131     virtual uint32 getHighestRexmittedSeqNum();
00132 
00138     virtual uint32 checkRexmitQueueForSackedOrRexmittedSegments(uint32 fromSeq);
00139 
00144     virtual void resetSackedBit();
00145 
00150     virtual void resetRexmittedBit();
00151 
00155     virtual uint32 getTotalAmountOfSackedBytes();
00156 
00160     virtual uint32 getAmountOfSackedBytes(uint32 seqNum);
00161 
00165     virtual uint32 getNumOfDiscontiguousSacks(uint32 seqNum);
00166 };
00167 
00168 #endif