#include <TCPReceiveQueue.h>
Public Member Functions | |
TCPReceiveQueue () | |
virtual | ~TCPReceiveQueue () |
virtual void | setConnection (TCPConnection *_conn) |
virtual void | init (uint32 startSeq)=0 |
virtual uint32 | insertBytesFromSegment (TCPSegment *tcpseg)=0 |
virtual cPacket * | extractBytesUpTo (uint32 seq)=0 |
virtual uint32 | getAmountOfBufferedBytes ()=0 |
virtual uint32 | getAmountOfFreeBytes (uint32 maxRcvBuffer)=0 |
virtual uint32 | getQueueLength ()=0 |
virtual void | getQueueStatus ()=0 |
virtual uint32 | getLE (uint32 fromSeqNum)=0 |
virtual uint32 | getRE (uint32 toSeqNum)=0 |
Protected Attributes | |
TCPConnection * | conn |
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.
Definition at line 47 of file TCPReceiveQueue.h.
TCPReceiveQueue::TCPReceiveQueue | ( | ) | [inline] |
virtual TCPReceiveQueue::~TCPReceiveQueue | ( | ) | [inline, virtual] |
virtual cPacket* 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 NULL if there's no more data to be passed up -- this method is called several times until it returns NULL.
Implemented in TCPMsgBasedRcvQueue, and TCPVirtualDataRcvQueue.
Referenced by TCPConnection::processSegment1stThru8th().
virtual uint32 TCPReceiveQueue::getAmountOfBufferedBytes | ( | ) | [pure virtual] |
Returns the number of bytes (out-of-order-segments) currently buffered in queue.
Implemented in TCPVirtualDataRcvQueue.
Referenced by TCPConnection::processSegment1stThru8th().
virtual uint32 TCPReceiveQueue::getAmountOfFreeBytes | ( | uint32 | maxRcvBuffer | ) | [pure virtual] |
Returns the number of bytes currently free (=available) in queue. freeRcvBuffer = maxRcvBuffer - usedRcvBuffer
Implemented in TCPVirtualDataRcvQueue.
Referenced by TCPConnection::updateRcvQueueVars(), and TCPConnection::writeHeaderOptions().
virtual uint32 TCPReceiveQueue::getLE | ( | uint32 | fromSeqNum | ) | [pure virtual] |
Returns left edge of enqueued region.
Implemented in TCPVirtualDataRcvQueue.
Referenced by TCPConnection::addSacks().
virtual uint32 TCPReceiveQueue::getQueueLength | ( | ) | [pure virtual] |
Returns the number of blocks currently buffered in queue.
Implemented in TCPVirtualDataRcvQueue.
Referenced by TCPConnection::processSegment1stThru8th().
virtual void TCPReceiveQueue::getQueueStatus | ( | ) | [pure virtual] |
Shows current queue status.
Implemented in TCPVirtualDataRcvQueue.
virtual uint32 TCPReceiveQueue::getRE | ( | uint32 | toSeqNum | ) | [pure virtual] |
Returns right edge of enqueued region.
Implemented in TCPVirtualDataRcvQueue.
Referenced by TCPConnection::addSacks().
virtual void TCPReceiveQueue::init | ( | uint32 | startSeq | ) | [pure virtual] |
Set initial receive sequence number.
Implemented in TCPMsgBasedRcvQueue, and TCPVirtualDataRcvQueue.
Referenced by TCPConnection::processSegmentInListen(), and TCPConnection::processSegmentInSynSent().
virtual uint32 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 TCPMsgBasedRcvQueue, and TCPVirtualDataRcvQueue.
Referenced by TCPConnection::processSegment1stThru8th(), TCPConnection::processSegmentInListen(), and TCPConnection::processSegmentInSynSent().
virtual void TCPReceiveQueue::setConnection | ( | TCPConnection * | _conn | ) | [inline, virtual] |
Set the connection that owns this queue.
Definition at line 66 of file TCPReceiveQueue.h.
Referenced by TCPConnection::cloneListeningConnection(), and TCPConnection::initConnection().
{conn = _conn;}
TCPConnection* TCPReceiveQueue::conn [protected] |
Definition at line 50 of file TCPReceiveQueue.h.