INET Framework for OMNeT++/OMNEST
inet::tcp::TCPReceiveQueue Class Referenceabstract

Abstract base class for TCP receive queues. More...

#include <TCPReceiveQueue.h>

Inheritance diagram for inet::tcp::TCPReceiveQueue:
inet::tcp::TCPVirtualDataRcvQueue inet::tcp::TCPByteStreamRcvQueue inet::tcp::TCPMsgBasedRcvQueue

Public Member Functions

 TCPReceiveQueue ()
 Ctor. More...
 
virtual ~TCPReceiveQueue ()
 Virtual dtor. More...
 
virtual void setConnection (TCPConnection *_conn)
 Set the connection that owns this queue. More...
 
virtual void init (uint32 startSeq)=0
 Set initial receive sequence number. More...
 
virtual uint32 insertBytesFromSegment (TCPSegment *tcpseg)=0
 Called when a TCP segment arrives, it should extract the payload from the segment and store it in the receive queue. More...
 
virtual cPacket * extractBytesUpTo (uint32 seq)=0
 Should create a packet to be passed up to the app, up to (but NOT including) the given sequence no (usually rcv_nxt). More...
 
virtual uint32 getAmountOfBufferedBytes ()=0
 Returns the number of bytes (out-of-order-segments) currently buffered in queue. More...
 
virtual uint32 getAmountOfFreeBytes (uint32 maxRcvBuffer)=0
 Returns the number of bytes currently free (=available) in queue. More...
 
virtual uint32 getQueueLength ()=0
 Returns the number of blocks currently buffered in queue. More...
 
virtual void getQueueStatus ()=0
 Shows current queue status. More...
 
virtual uint32 getLE (uint32 fromSeqNum)=0
 Returns left edge of enqueued region. More...
 
virtual uint32 getRE (uint32 toSeqNum)=0
 Returns right edge of enqueued region. More...
 
virtual uint32 getFirstSeqNo ()=0
 Returns the minimum of first byte seq.no. More...
 

Protected Attributes

TCPConnectionconn
 

Detailed Description

Abstract base class for TCP receive queues.

This class represents data received by TCP but not yet passed up to the application. The class also accomodates for selective retransmission, i.e. also acts as a segment buffer.

This class goes hand-in-hand with TCPSendQueue.

This class is polymorphic because depending on where and how you use the TCP model you might have different ideas about "sending data" on a simulated connection: you might want to transmit real bytes, "dummy" (byte count only), cMessage objects, etc; see discussion at TCPSendQueue. Different subclasses can be written to accomodate different needs.

See also
TCPSendQueue

Constructor & Destructor Documentation

inet::tcp::TCPReceiveQueue::TCPReceiveQueue ( )
inline

Ctor.

60 { conn = nullptr; }
TCPConnection * conn
Definition: TCPReceiveQueue.h:54
virtual inet::tcp::TCPReceiveQueue::~TCPReceiveQueue ( )
inlinevirtual

Virtual dtor.

65 {}

Member Function Documentation

virtual cPacket* inet::tcp::TCPReceiveQueue::extractBytesUpTo ( uint32  seq)
pure virtual

Should create a packet to be passed up to the app, up to (but NOT including) the given sequence no (usually rcv_nxt).

It should return nullptr if there's no more data to be passed up – this method is called several times until it returns nullptr.

Implemented in inet::tcp::TCPVirtualDataRcvQueue, inet::tcp::TCPByteStreamRcvQueue, and inet::tcp::TCPMsgBasedRcvQueue.

Referenced by inet::tcp::TCPConnection::process_READ_REQUEST(), and inet::tcp::TCPConnection::processSegment1stThru8th().

virtual uint32 inet::tcp::TCPReceiveQueue::getAmountOfBufferedBytes ( )
pure virtual

Returns the number of bytes (out-of-order-segments) currently buffered in queue.

Implemented in inet::tcp::TCPVirtualDataRcvQueue.

Referenced by inet::tcp::TCPConnection::processSegment1stThru8th().

virtual uint32 inet::tcp::TCPReceiveQueue::getAmountOfFreeBytes ( uint32  maxRcvBuffer)
pure virtual

Returns the number of bytes currently free (=available) in queue.

freeRcvBuffer = maxRcvBuffer - usedRcvBuffer

Implemented in inet::tcp::TCPVirtualDataRcvQueue.

Referenced by inet::tcp::TCPConnection::updateRcvQueueVars().

virtual uint32 inet::tcp::TCPReceiveQueue::getFirstSeqNo ( )
pure virtual

Returns the minimum of first byte seq.no.

in queue and rcv_nxt

Implemented in inet::tcp::TCPVirtualDataRcvQueue.

Referenced by inet::tcp::TCPConnection::hasEnoughSpaceForSegmentInReceiveQueue(), and inet::tcp::TCPConnection::writeHeaderOptions().

virtual uint32 inet::tcp::TCPReceiveQueue::getLE ( uint32  fromSeqNum)
pure virtual

Returns left edge of enqueued region.

Implemented in inet::tcp::TCPVirtualDataRcvQueue.

Referenced by inet::tcp::TCPConnection::addSacks().

virtual uint32 inet::tcp::TCPReceiveQueue::getQueueLength ( )
pure virtual

Returns the number of blocks currently buffered in queue.

Implemented in inet::tcp::TCPVirtualDataRcvQueue.

Referenced by inet::tcp::TCPConnection::processSegment1stThru8th().

virtual void inet::tcp::TCPReceiveQueue::getQueueStatus ( )
pure virtual

Shows current queue status.

Implemented in inet::tcp::TCPVirtualDataRcvQueue.

virtual uint32 inet::tcp::TCPReceiveQueue::getRE ( uint32  toSeqNum)
pure virtual

Returns right edge of enqueued region.

Implemented in inet::tcp::TCPVirtualDataRcvQueue.

Referenced by inet::tcp::TCPConnection::addSacks().

virtual void inet::tcp::TCPReceiveQueue::init ( uint32  startSeq)
pure virtual
virtual uint32 inet::tcp::TCPReceiveQueue::insertBytesFromSegment ( TCPSegment tcpseg)
pure virtual

Called when a TCP segment arrives, it should extract the payload from the segment and store it in the receive queue.

The segment object should not be deleted.

The method should return the sequence number to be ACKed.

Implemented in inet::tcp::TCPVirtualDataRcvQueue, and inet::tcp::TCPMsgBasedRcvQueue.

Referenced by inet::tcp::TCPConnection::processSegment1stThru8th(), inet::tcp::TCPConnection::processSegmentInListen(), and inet::tcp::TCPConnection::processSegmentInSynSent().

virtual void inet::tcp::TCPReceiveQueue::setConnection ( TCPConnection _conn)
inlinevirtual

Set the connection that owns this queue.

Referenced by inet::tcp::TCPConnection::cloneListeningConnection(), and inet::tcp::TCPConnection::initConnection().

70 { conn = _conn; }
TCPConnection * conn
Definition: TCPReceiveQueue.h:54

Member Data Documentation

TCPConnection* inet::tcp::TCPReceiveQueue::conn
protected

The documentation for this class was generated from the following file: