TCP_NSC_Queues.h

Go to the documentation of this file.
00001 //
00002 // Copyright (C) 2004 Andras Varga
00003 //               2009 Zoltan Bojthe
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_TCP_NSC_QUEUES_H
00020 #define __INET_TCP_NSC_QUEUES_H
00021 
00022 #include <omnetpp.h>
00023 //#include "TCPConnection.h"
00024 #include "TCPSegment.h"
00025 
00026 // forward declarations:
00027 class TCP_NSC_Connection;
00028 
00082 class INET_API TCP_NSC_SendQueue : public cPolymorphic
00083 {
00084   public:
00088     TCP_NSC_SendQueue() : connM(NULL) {}
00089 
00093     virtual ~TCP_NSC_SendQueue() {}
00094 
00098     virtual void setConnection(TCP_NSC_Connection *connP) {connM = connP; }
00099 
00108     virtual void enqueueAppData(cPacket *msgP) = 0;
00109 
00117     virtual int getNscMsg(void* bufferP, int bufferLengthP) = 0;
00118 
00127     virtual void dequeueNscMsg(int msgLengthP) = 0;
00128 
00132     virtual ulong getBytesAvailable() = 0;
00133 
00144     virtual TCPSegment * createSegmentWithBytes(const void* tcpDataP, int tcpLengthP) = 0;
00145 
00150     virtual void discardUpTo(uint32 seqNumP) = 0;
00151 
00152   protected:
00153     TCP_NSC_Connection *connM;
00154 };
00155 
00156 class INET_API TCP_NSC_ReceiveQueue : public cPolymorphic
00157 {
00158   public:
00162     TCP_NSC_ReceiveQueue() : connM(NULL) {};
00163 
00167     virtual ~TCP_NSC_ReceiveQueue() {}
00168 
00172     virtual void setConnection(TCP_NSC_Connection *connP) { connM = connP; }
00173 
00185     virtual uint32 insertBytesFromSegment(const TCPSegment *tcpsegP, void* bufferP, size_t bufferLengthP) = 0;
00186 
00192     virtual void enqueueNscData(void* dataP, int dataLengthP) = 0;
00193 
00202     virtual cPacket *extractBytesUpTo() = 0;
00203 
00207     virtual uint32 getAmountOfBufferedBytes() = 0;
00208 
00212     virtual uint32 getQueueLength() = 0;
00213 
00217     virtual void getQueueStatus() = 0;
00218 
00225     virtual void notifyAboutSending(const TCPSegment *tcpsegP) = 0;
00226 
00227   protected:
00228     TCP_NSC_Connection *connM;
00229 };
00230 
00231 #endif