INET Framework for OMNeT++/OMNEST
TCP_NSC_VirtualDataQueues.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_VIRTUALDATAQUEUES_H
00020 #define __INET_TCP_NSC_VIRTUALDATAQUEUES_H
00021 
00022 #include <omnetpp.h>
00023 
00024 #include "TCP_NSC_Queues.h"
00025 
00026 #include "TCPConnection.h"
00027 
00032 class INET_API TCP_NSC_VirtualDataSendQueue : public TCP_NSC_SendQueue
00033 {
00034   public:
00038     TCP_NSC_VirtualDataSendQueue();
00039 
00043     virtual ~TCP_NSC_VirtualDataSendQueue();
00044 
00048     virtual void setConnection(TCP_NSC_Connection *connP);
00049 
00058     virtual void enqueueAppData(cPacket *msgP);
00059 
00067     virtual int getNscMsg(void* bufferP, int bufferLengthP);
00068 
00074     virtual void dequeueNscMsg(int msgLengthP);
00075 
00079     ulong getBytesAvailable();
00080 
00091     virtual TCPSegment * createSegmentWithBytes(const void* tcpDataP, int tcpLengthP);
00092 
00097     virtual void discardUpTo(uint32 seqNumP);
00098 
00099   protected:
00100     long int unsentNscBytesM;
00101 };
00102 
00103 class INET_API TCP_NSC_VirtualDataReceiveQueue : public TCP_NSC_ReceiveQueue
00104 {
00105   public:
00109     TCP_NSC_VirtualDataReceiveQueue();
00110 
00114     virtual ~TCP_NSC_VirtualDataReceiveQueue();
00115 
00119     virtual void setConnection(TCP_NSC_Connection *connP);
00120 
00132     virtual uint32 insertBytesFromSegment(const TCPSegment *tcpsegP, void* bufferP, size_t bufferLengthP);
00133 
00139     virtual void enqueueNscData(void* dataP, int dataLengthP);
00140 
00149     virtual cPacket *extractBytesUpTo();
00150 
00154     virtual uint32 getAmountOfBufferedBytes();
00155 
00159     virtual uint32 getQueueLength();
00160 
00164     virtual void getQueueStatus();
00165 
00172     virtual void notifyAboutSending(const TCPSegment *tcpsegP);
00173 
00174   protected:
00175     long int bytesInQueueM;
00176 };
00177 
00178 #endif