TCPSendQueue.h

Go to the documentation of this file.
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_TCPSENDQUEUE_H
00019 #define __INET_TCPSENDQUEUE_H
00020 
00021 #include <omnetpp.h>
00022 #include "TCPConnection.h"
00023 #include "TCPSegment.h"
00024 
00025 
00078 class INET_API TCPSendQueue : public cPolymorphic
00079 {
00080   protected:
00081     TCPConnection *conn; // the connection that owns this queue
00082 
00083   public:
00087     TCPSendQueue()  {conn=NULL;}
00088 
00092     virtual ~TCPSendQueue() {}
00093 
00097     virtual void setConnection(TCPConnection *_conn)  {conn = _conn;}
00098 
00107     virtual void init(uint32 startSeq) = 0;
00108 
00117     virtual void enqueueAppData(cPacket *msg) = 0;
00118 
00122     virtual uint32 getBufferStartSeq() = 0;
00123 
00128     virtual uint32 getBufferEndSeq() = 0;
00129 
00134     inline ulong getBytesAvailable(uint32 fromSeq)
00135     {
00136         uint32 bufEndSeq = getBufferEndSeq();
00137         return seqLess(fromSeq, bufEndSeq) ? bufEndSeq-fromSeq : 0;
00138     }
00139 
00147     virtual TCPSegment *createSegmentWithBytes(uint32 fromSeq, ulong maxNumBytes) = 0;
00148 
00153     virtual void discardUpTo(uint32 seqNum) = 0;
00154 
00155 };
00156 
00157 #endif
00158 
00159