Public Member Functions | Protected Attributes

tcp_old::TCPSendQueue Class Reference

#include <TCPSendQueue_old.h>

Inheritance diagram for tcp_old::TCPSendQueue:
tcp_old::TCPMsgBasedSendQueue tcp_old::TCPVirtualDataSendQueue

List of all members.

Public Member Functions

 TCPSendQueue ()
virtual ~TCPSendQueue ()
virtual void setConnection (TCPConnection *_conn)
virtual void init (uint32 startSeq)=0
virtual void enqueueAppData (cPacket *msg)=0
virtual uint32 getBufferEndSeq ()=0
ulong getBytesAvailable (uint32 fromSeq)
virtual TCPSegmentcreateSegmentWithBytes (uint32 fromSeq, ulong maxNumBytes)=0
virtual void discardUpTo (uint32 seqNum)=0

Protected Attributes

TCPConnectionconn

Detailed Description

Abstract base class for TCP send queues. In fact a single object represents both the send queue and the retransmission queue (no need to separate them). The TCPConnection object knows which data in the queue have already been transmitted ("retransmission queue") and which not ("send queue"). This class is not interested in where's the boundary.

There is another particularity about this class: as a retransmission queue, it stores bytes and not segments. TCP is a bytestream oriented protocol (sequence numbers refer to bytes and not to TPDUs as e.g. in ISO TP4), and the protocol doesn't rely on retransmitted segments having the same segment boundaries as the original segments. Some implementations store segments on the retransmission queue, and others store only the data bytes; RFCs explicitly allow both. (See e.g. RFC1122 p90, section 4.2.2.15, "IMPLEMENTATION" note).

To simulate a TCP that retains segment boundaries in retransmissions, the appropriate TCPAlgorithm class should remember where the segment boundaries were at the original transmission, and it should form identical segments when retransmitting. The createSegmentWithBytes() send queue method makes this possible.

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:

Different TCPSendQueue subclasses can be written to accomodate different needs.

This class goes hand-in-hand with TCPReceiveQueue.

See also:
TCPReceiveQueue

Definition at line 79 of file TCPSendQueue_old.h.


Constructor & Destructor Documentation

tcp_old::TCPSendQueue::TCPSendQueue (  )  [inline]

Ctor.

Definition at line 88 of file TCPSendQueue_old.h.

{conn=NULL;}

virtual tcp_old::TCPSendQueue::~TCPSendQueue (  )  [inline, virtual]

Virtual dtor.

Definition at line 93 of file TCPSendQueue_old.h.

{}


Member Function Documentation

virtual TCPSegment* tcp_old::TCPSendQueue::createSegmentWithBytes ( uint32  fromSeq,
ulong  maxNumBytes 
) [pure virtual]

Called when the TCP wants to send or retransmit data, it constructs a TCP segment which contains the data from the requested sequence number range. The actually returned segment may contain less than maxNumBytes bytes if the subclass wants to reproduce the original segment boundaries when retransmitting.

Implemented in tcp_old::TCPMsgBasedSendQueue, and tcp_old::TCPVirtualDataSendQueue.

Referenced by tcp_old::TCPConnection::sendSegment().

virtual void tcp_old::TCPSendQueue::discardUpTo ( uint32  seqNum  )  [pure virtual]

Tells the queue that bytes up to (but NOT including) seqNum have been transmitted and ACKed, so they can be removed from the queue.

Implemented in tcp_old::TCPMsgBasedSendQueue, and tcp_old::TCPVirtualDataSendQueue.

Referenced by tcp_old::TCPConnection::processAckInEstabEtc(), tcp_old::TCPConnection::processRstInSynReceived(), and tcp_old::TCPConnection::processSegmentInSynSent().

virtual void tcp_old::TCPSendQueue::enqueueAppData ( cPacket *  msg  )  [pure virtual]

Called on SEND app command, it inserts in the queue the data the user wants to send. Implementations of this abstract class will decide what this means: copying actual bytes, just increasing the "last byte queued" variable, or storing cMessage object(s). The msg object should not be referenced after this point (sendQueue may delete it.)

Implemented in tcp_old::TCPMsgBasedSendQueue, and tcp_old::TCPVirtualDataSendQueue.

Referenced by tcp_old::TCPConnection::process_SEND().

virtual uint32 tcp_old::TCPSendQueue::getBufferEndSeq (  )  [pure virtual]

Returns the sequence number of the last byte stored in the buffer plus one. (The first byte of the next send operation would get this sequence number.)

Implemented in tcp_old::TCPMsgBasedSendQueue, and tcp_old::TCPVirtualDataSendQueue.

Referenced by tcp_old::TCPConnection::process_CLOSE(), and tcp_old::TCPConnection::processRstInSynReceived().

ulong tcp_old::TCPSendQueue::getBytesAvailable ( uint32  fromSeq  )  [inline]

Utility function: returns how many bytes are available in the queue, from (and including) the given sequence number.

Definition at line 130 of file TCPSendQueue_old.h.

Referenced by tcp_old::TCPConnection::process_SEND(), tcp_old::TCPConnection::retransmitData(), tcp_old::TCPConnection::sendData(), tcp_old::TCPConnection::sendProbe(), and tcp_old::TCPConnection::sendSegment().

    {
        uint32 bufEndSeq = getBufferEndSeq();
        return seqLess(fromSeq, bufEndSeq) ? bufEndSeq-fromSeq : 0;
    }

virtual void tcp_old::TCPSendQueue::init ( uint32  startSeq  )  [pure virtual]

Initialize the object. The startSeq parameter tells what sequence number the first byte of app data should get. This is usually ISS+1 because SYN consumes one byte in the sequence number space.

init() may be called more than once; every call flushes the existing contents of the queue.

Implemented in tcp_old::TCPMsgBasedSendQueue, and tcp_old::TCPVirtualDataSendQueue.

Referenced by tcp_old::TCPConnection::selectInitialSeqNum().

virtual void tcp_old::TCPSendQueue::setConnection ( TCPConnection _conn  )  [inline, virtual]

Set the connection that owns this queue.

Definition at line 98 of file TCPSendQueue_old.h.

Referenced by tcp_old::TCPConnection::cloneListeningConnection(), and tcp_old::TCPConnection::initConnection().

{conn = _conn;}


Member Data Documentation


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