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

Abstract base class for TCP algorithms which encapsulate all behaviour during data transfer state: flavour of congestion control, fast retransmit/recovery, selective acknowledgement etc. More...

#include <TCPAlgorithm.h>

Inheritance diagram for inet::tcp::TCPAlgorithm:
inet::tcp::DumbTCP inet::tcp::TCPBaseAlg inet::tcp::TCPNoCongestionControl inet::tcp::TCPTahoeRenoFamily inet::tcp::TCPVegas inet::tcp::TCPWestwood inet::tcp::TCPNewReno inet::tcp::TCPReno inet::tcp::TCPTahoe

Public Member Functions

 TCPAlgorithm ()
 Ctor. More...
 
virtual ~TCPAlgorithm ()
 Virtual dtor. More...
 
void setConnection (TCPConnection *_conn)
 Assign this object to a TCPConnection. More...
 
TCPStateVariablesgetStateVariables ()
 Creates and returns the TCP state variables. More...
 
virtual void initialize ()
 Should be redefined to initialize the object: create timers, etc. More...
 
virtual void established (bool active)=0
 Called when the connection is going to ESTABLISHED from SYN_SENT or SYN_RCVD. More...
 
virtual void connectionClosed ()=0
 Called when the connection closes, it should cancel all running timers. More...
 
virtual void processTimer (cMessage *timer, TCPEventCode &event)=0
 Place to process timers specific to this TCPAlgorithm class. More...
 
virtual void sendCommandInvoked ()=0
 Called after user sent TCP_C_SEND command to us. More...
 
virtual void receivedOutOfOrderSegment ()=0
 Called after receiving data which are in the window, but not at its left edge (seq != rcv_nxt). More...
 
virtual void receiveSeqChanged ()=0
 Called after rcv_nxt got advanced, either because we received in-sequence data ("text" in RFC 793 lingo) or a FIN. More...
 
virtual void receivedDataAck (uint32 firstSeqAcked)=0
 Called after we received an ACK which acked some data (that is, we could advance snd_una). More...
 
virtual void receivedDuplicateAck ()=0
 Called after we received a duplicate ACK (that is: ackNo == snd_una, no data in segment, segment doesn't carry window update, and also, we have unacked data). More...
 
virtual void receivedAckForDataNotYetSent (uint32 seq)=0
 Called after we received an ACK for data not yet sent. More...
 
virtual void ackSent ()=0
 Called after we sent an ACK. More...
 
virtual void dataSent (uint32 fromseq)=0
 Called after we sent data. More...
 
virtual void segmentRetransmitted (uint32 fromseq, uint32 toseq)=0
 Called after we retransmitted segment. More...
 
virtual void restartRexmitTimer ()=0
 Restart REXMIT timer. More...
 
virtual void rttMeasurementCompleteUsingTS (uint32 echoedTS)=0
 Converting uint32 echoedTS to simtime_t and calling rttMeasurementComplete() to update state vars with new measured RTT value. More...
 

Protected Member Functions

virtual TCPStateVariablescreateStateVariables ()=0
 Create state block (TCB) used by this TCP variant. More...
 

Protected Attributes

TCPConnectionconn
 
TCPStateVariablesstate
 

Detailed Description

Abstract base class for TCP algorithms which encapsulate all behaviour during data transfer state: flavour of congestion control, fast retransmit/recovery, selective acknowledgement etc.

Subclasses may implement various sets and flavours of the above algorithms.

Constructor & Destructor Documentation

inet::tcp::TCPAlgorithm::TCPAlgorithm ( )
inline

Ctor.

55 { state = nullptr; conn = nullptr; }
TCPStateVariables * state
Definition: TCPAlgorithm.h:41
TCPConnection * conn
Definition: TCPAlgorithm.h:40
virtual inet::tcp::TCPAlgorithm::~TCPAlgorithm ( )
inlinevirtual

Virtual dtor.

60 {}

Member Function Documentation

virtual void inet::tcp::TCPAlgorithm::connectionClosed ( )
pure virtual

Called when the connection closes, it should cancel all running timers.

Implemented in inet::tcp::TCPBaseAlg, and inet::tcp::DumbTCP.

virtual TCPStateVariables* inet::tcp::TCPAlgorithm::createStateVariables ( )
protectedpure virtual

Create state block (TCB) used by this TCP variant.

It is expected that every TCPAlgorithm subclass will have its own state block, subclassed from TCPStateVariables. This factory method should create and return a "blank" state block of the appropriate type.

Implemented in inet::tcp::TCPVegas, inet::tcp::TCPWestwood, inet::tcp::DumbTCP, inet::tcp::TCPNoCongestionControl, inet::tcp::TCPTahoe, inet::tcp::TCPNewReno, and inet::tcp::TCPReno.

virtual void inet::tcp::TCPAlgorithm::dataSent ( uint32  fromseq)
pure virtual

Called after we sent data.

This hook can be used to schedule the retransmission timer, to start round-trip time measurement, etc. The argument is the seqno of the first byte sent.

Implemented in inet::tcp::TCPBaseAlg, inet::tcp::TCPVegas, inet::tcp::DumbTCP, and inet::tcp::TCPWestwood.

Referenced by inet::tcp::TCPConnection::sendData(), inet::tcp::TCPConnection::sendOneNewSegment(), inet::tcp::TCPConnection::sendProbe(), and inet::tcp::TCPConnection::sendSegmentDuringLossRecoveryPhase().

virtual void inet::tcp::TCPAlgorithm::established ( bool  active)
pure virtual

Called when the connection is going to ESTABLISHED from SYN_SENT or SYN_RCVD.

This is a place to initialize some variables (e.g. set cwnd to the MSS learned during connection setup). If we are on the active side, here we also have to finish the 3-way connection setup procedure by sending an ACK, possibly piggybacked on data.

Implemented in inet::tcp::TCPBaseAlg, and inet::tcp::DumbTCP.

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

TCPStateVariables* inet::tcp::TCPAlgorithm::getStateVariables ( )
inline

Creates and returns the TCP state variables.

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

72  {
73  if (!state)
75 
76  return state;
77  }
TCPStateVariables * state
Definition: TCPAlgorithm.h:41
virtual TCPStateVariables * createStateVariables()=0
Create state block (TCB) used by this TCP variant.
virtual void inet::tcp::TCPAlgorithm::initialize ( )
inlinevirtual

Should be redefined to initialize the object: create timers, etc.

This method is necessary because the TCPConnection ptr is not available in the constructor yet.

Reimplemented in inet::tcp::TCPBaseAlg, inet::tcp::DumbTCP, and inet::tcp::TCPNoCongestionControl.

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

84 {}
virtual void inet::tcp::TCPAlgorithm::processTimer ( cMessage *  timer,
TCPEventCode event 
)
pure virtual

Place to process timers specific to this TCPAlgorithm class.

TCPConnection will invoke this method on any timer (self-message) it doesn't recognize (that is, any timer other than the 2MSL, CONN-ESTAB and FIN-WAIT-2 timers).

Method may also change the event code (by default set to TCP_E_IGNORE) to cause the state transition of TCP FSM.

Implemented in inet::tcp::TCPBaseAlg, and inet::tcp::DumbTCP.

virtual void inet::tcp::TCPAlgorithm::receivedAckForDataNotYetSent ( uint32  seq)
pure virtual

Called after we received an ACK for data not yet sent.

According to RFC 793 this function should send an ACK.

Implemented in inet::tcp::TCPBaseAlg, and inet::tcp::DumbTCP.

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

virtual void inet::tcp::TCPAlgorithm::receivedDataAck ( uint32  firstSeqAcked)
pure virtual

Called after we received an ACK which acked some data (that is, we could advance snd_una).

At this point the state variables (snd_una, snd_wnd) have already been updated. The argument firstSeqAcked is the previous snd_una value, that is, the number of bytes acked is (snd_una - firstSeqAcked). The dupack counter still reflects the old value (needed for Reno and NewReno); it'll be reset to 0 after this call returns.

Implemented in inet::tcp::TCPBaseAlg, inet::tcp::TCPVegas, inet::tcp::TCPWestwood, inet::tcp::DumbTCP, inet::tcp::TCPNoCongestionControl, inet::tcp::TCPTahoe, inet::tcp::TCPNewReno, and inet::tcp::TCPReno.

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

virtual void inet::tcp::TCPAlgorithm::receivedDuplicateAck ( )
pure virtual

Called after we received a duplicate ACK (that is: ackNo == snd_una, no data in segment, segment doesn't carry window update, and also, we have unacked data).

The dupack counter got already updated when calling this method (i.e. dupacks == 1 on first duplicate ACK.)

Implemented in inet::tcp::TCPBaseAlg, inet::tcp::TCPVegas, inet::tcp::TCPWestwood, inet::tcp::DumbTCP, inet::tcp::TCPTahoe, inet::tcp::TCPNewReno, and inet::tcp::TCPReno.

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

virtual void inet::tcp::TCPAlgorithm::receivedOutOfOrderSegment ( )
pure virtual

Called after receiving data which are in the window, but not at its left edge (seq != rcv_nxt).

This indicates that either segments got re-ordered in the way, or one segment was lost. RFC 1122 and RFC 2001 recommend sending an immediate ACK here (Fast Retransmit relies on that).

Implemented in inet::tcp::TCPBaseAlg, and inet::tcp::DumbTCP.

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

virtual void inet::tcp::TCPAlgorithm::receiveSeqChanged ( )
pure virtual

Called after rcv_nxt got advanced, either because we received in-sequence data ("text" in RFC 793 lingo) or a FIN.

At this point, rcv_nxt has already been updated. This method should take care to send or schedule an ACK some time.

Implemented in inet::tcp::TCPBaseAlg, and inet::tcp::DumbTCP.

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

virtual void inet::tcp::TCPAlgorithm::restartRexmitTimer ( )
pure virtual
virtual void inet::tcp::TCPAlgorithm::rttMeasurementCompleteUsingTS ( uint32  echoedTS)
pure virtual

Converting uint32 echoedTS to simtime_t and calling rttMeasurementComplete() to update state vars with new measured RTT value.

Implemented in inet::tcp::TCPBaseAlg, and inet::tcp::DumbTCP.

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

virtual void inet::tcp::TCPAlgorithm::segmentRetransmitted ( uint32  fromseq,
uint32  toseq 
)
pure virtual

Called after we retransmitted segment.

The argument fromseq is the seqno of the first byte sent. The argument toseq is the seqno of the last byte sent+1.

Implemented in inet::tcp::TCPBaseAlg, inet::tcp::TCPVegas, inet::tcp::DumbTCP, and inet::tcp::TCPWestwood.

Referenced by inet::tcp::TCPConnection::retransmitData(), and inet::tcp::TCPConnection::retransmitOneSegment().

virtual void inet::tcp::TCPAlgorithm::sendCommandInvoked ( )
pure virtual

Called after user sent TCP_C_SEND command to us.

Implemented in inet::tcp::TCPBaseAlg, and inet::tcp::DumbTCP.

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

void inet::tcp::TCPAlgorithm::setConnection ( TCPConnection _conn)
inline

Assign this object to a TCPConnection.

Its sendQueue and receiveQueue must be set already at this time, because we cache their pointers here.

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

66 { conn = _conn; }
TCPConnection * conn
Definition: TCPAlgorithm.h:40

Member Data Documentation

TCPConnection* inet::tcp::TCPAlgorithm::conn
protected

Referenced by inet::tcp::DumbTCP::connectionClosed(), inet::tcp::DumbTCP::dataSent(), inet::tcp::DumbTCP::established(), inet::tcp::TCPBaseAlg::established(), inet::tcp::DumbTCP::initialize(), inet::tcp::TCPBaseAlg::initialize(), inet::tcp::TCPBaseAlg::processDelayedAckTimer(), inet::tcp::TCPBaseAlg::processPersistTimer(), inet::tcp::TCPNoCongestionControl::processRexmitTimer(), inet::tcp::TCPNewReno::processRexmitTimer(), inet::tcp::TCPReno::processRexmitTimer(), inet::tcp::TCPTahoe::processRexmitTimer(), inet::tcp::TCPWestwood::processRexmitTimer(), inet::tcp::TCPVegas::processRexmitTimer(), inet::tcp::TCPBaseAlg::processRexmitTimer(), inet::tcp::DumbTCP::processTimer(), inet::tcp::DumbTCP::receivedAckForDataNotYetSent(), inet::tcp::TCPBaseAlg::receivedAckForDataNotYetSent(), inet::tcp::TCPNewReno::receivedDataAck(), inet::tcp::TCPReno::receivedDataAck(), inet::tcp::DumbTCP::receivedDataAck(), inet::tcp::TCPVegas::receivedDataAck(), inet::tcp::TCPBaseAlg::receivedDataAck(), inet::tcp::TCPNewReno::receivedDuplicateAck(), inet::tcp::TCPReno::receivedDuplicateAck(), inet::tcp::TCPTahoe::receivedDuplicateAck(), inet::tcp::TCPWestwood::receivedDuplicateAck(), inet::tcp::TCPVegas::receivedDuplicateAck(), inet::tcp::TCPBaseAlg::receivedDuplicateAck(), inet::tcp::DumbTCP::receivedOutOfOrderSegment(), inet::tcp::TCPBaseAlg::receivedOutOfOrderSegment(), inet::tcp::DumbTCP::receiveSeqChanged(), inet::tcp::TCPBaseAlg::receiveSeqChanged(), inet::tcp::TCPBaseAlg::rttMeasurementCompleteUsingTS(), inet::tcp::DumbTCP::sendCommandInvoked(), inet::tcp::TCPBaseAlg::sendData(), inet::tcp::TCPBaseAlg::startRexmitTimer(), and inet::tcp::DumbTCP::~DumbTCP().

TCPStateVariables* inet::tcp::TCPAlgorithm::state
protected

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