INET Framework for OMNeT++/OMNEST
|
Includes basic TCP algorithms: adaptive retransmission, PERSIST timer, keep-alive, delayed acks – EXCLUDING congestion control. More...
#include <TCPBaseAlg.h>
Public Member Functions | |
TCPBaseAlg () | |
Ctor. More... | |
virtual | ~TCPBaseAlg () |
Virtual dtor. More... | |
virtual void | initialize () override |
Create timers, etc. More... | |
virtual void | established (bool active) override |
Called when the connection is going to ESTABLISHED from SYN_SENT or SYN_RCVD. More... | |
virtual void | connectionClosed () override |
Called when the connection closes, it should cancel all running timers. More... | |
virtual void | processTimer (cMessage *timer, TCPEventCode &event) override |
Process REXMIT, PERSIST, DELAYED-ACK and KEEP-ALIVE timers. More... | |
virtual void | sendCommandInvoked () override |
Called after user sent TCP_C_SEND command to us. More... | |
virtual void | receivedOutOfOrderSegment () override |
Called after receiving data which are in the window, but not at its left edge (seq != rcv_nxt). More... | |
virtual void | receiveSeqChanged () override |
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) override |
Called after we received an ACK which acked some data (that is, we could advance snd_una). More... | |
virtual void | receivedDuplicateAck () override |
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) override |
Called after we received an ACK for data not yet sent. More... | |
virtual void | ackSent () override |
Called after we sent an ACK. More... | |
virtual void | dataSent (uint32 fromseq) override |
Called after we sent data. More... | |
virtual void | segmentRetransmitted (uint32 fromseq, uint32 toseq) override |
Called after we retransmitted segment. More... | |
virtual void | restartRexmitTimer () override |
Restart REXMIT timer. More... | |
Public Member Functions inherited from inet::tcp::TCPAlgorithm | |
TCPAlgorithm () | |
Ctor. More... | |
virtual | ~TCPAlgorithm () |
Virtual dtor. More... | |
void | setConnection (TCPConnection *_conn) |
Assign this object to a TCPConnection. More... | |
TCPStateVariables * | getStateVariables () |
Creates and returns the TCP state variables. More... | |
Protected Member Functions | |
virtual void | startRexmitTimer () |
Start REXMIT timer and initialize retransmission variables. More... | |
virtual void | rttMeasurementComplete (simtime_t tSent, simtime_t tAcked) |
Update state vars with new measured RTT value. More... | |
virtual void | rttMeasurementCompleteUsingTS (uint32 echoedTS) override |
Converting uint32 echoedTS to simtime_t and calling rttMeasurementComplete() to update state vars with new measured RTT value. More... | |
virtual bool | sendData (bool sendCommandInvoked) |
Send data, observing Nagle's algorithm and congestion window. More... | |
cMessage * | cancelEvent (cMessage *msg) |
Utility function. More... | |
Process REXMIT, PERSIST, DELAYED-ACK and KEEP-ALIVE timers | |
virtual void | processRexmitTimer (TCPEventCode &event) |
virtual void | processPersistTimer (TCPEventCode &event) |
virtual void | processDelayedAckTimer (TCPEventCode &event) |
virtual void | processKeepAliveTimer (TCPEventCode &event) |
Protected Member Functions inherited from inet::tcp::TCPAlgorithm | |
virtual TCPStateVariables * | createStateVariables ()=0 |
Create state block (TCB) used by this TCP variant. More... | |
Protected Attributes | |
TCPBaseAlgStateVariables *& | state |
cMessage * | rexmitTimer |
cMessage * | persistTimer |
cMessage * | delayedAckTimer |
cMessage * | keepAliveTimer |
cOutVector * | cwndVector |
cOutVector * | ssthreshVector |
cOutVector * | rttVector |
cOutVector * | srttVector |
cOutVector * | rttvarVector |
cOutVector * | rtoVector |
cOutVector * | numRtosVector |
Protected Attributes inherited from inet::tcp::TCPAlgorithm | |
TCPConnection * | conn |
TCPStateVariables * | state |
Includes basic TCP algorithms: adaptive retransmission, PERSIST timer, keep-alive, delayed acks – EXCLUDING congestion control.
Congestion control is implemented in subclasses such as TCPTahoeAlg or TCPRenoAlg.
Implements:
To be done:
Note: currently the timers and time calculations are done in double and NOT in Unix (200ms or 500ms) ticks. It's possible to write another TCPAlgorithm which uses ticks (or rather, factor out timer handling to separate methods, and redefine only those).
Congestion window is set to SMSS when the connection is established, and not touched after that. Subclasses may redefine any of the virtual functions here to add their congestion control code.
inet::tcp::TCPBaseAlg::TCPBaseAlg | ( | ) |
Ctor.
|
virtual |
Virtual dtor.
|
overridevirtual |
Called after we sent an ACK.
This hook can be used to cancel the delayed-ACK timer.
Implements inet::tcp::TCPAlgorithm.
|
inlineprotected |
Utility function.
Referenced by ackSent(), connectionClosed(), receivedDataAck(), restartRexmitTimer(), and ~TCPBaseAlg().
|
overridevirtual |
Called when the connection closes, it should cancel all running timers.
Implements inet::tcp::TCPAlgorithm.
|
overridevirtual |
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.
Implements inet::tcp::TCPAlgorithm.
Reimplemented in inet::tcp::TCPVegas, and inet::tcp::TCPWestwood.
Referenced by inet::tcp::TCPWestwood::dataSent(), and inet::tcp::TCPVegas::dataSent().
|
overridevirtual |
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.
Implements inet::tcp::TCPAlgorithm.
|
overridevirtual |
Create timers, etc.
Reimplemented from inet::tcp::TCPAlgorithm.
Reimplemented in inet::tcp::TCPNoCongestionControl.
Referenced by inet::tcp::TCPNoCongestionControl::initialize().
|
protectedvirtual |
Referenced by processTimer().
|
protectedvirtual |
Referenced by processTimer().
|
protectedvirtual |
Referenced by processTimer().
|
protectedvirtual |
Reimplemented in inet::tcp::TCPVegas, inet::tcp::TCPWestwood, inet::tcp::TCPTahoe, inet::tcp::TCPNewReno, inet::tcp::TCPReno, and inet::tcp::TCPNoCongestionControl.
Referenced by inet::tcp::TCPNoCongestionControl::processRexmitTimer(), inet::tcp::TCPReno::processRexmitTimer(), inet::tcp::TCPNewReno::processRexmitTimer(), inet::tcp::TCPTahoe::processRexmitTimer(), inet::tcp::TCPWestwood::processRexmitTimer(), inet::tcp::TCPVegas::processRexmitTimer(), and processTimer().
|
overridevirtual |
Process REXMIT, PERSIST, DELAYED-ACK and KEEP-ALIVE timers.
Implements inet::tcp::TCPAlgorithm.
|
overridevirtual |
Called after we received an ACK for data not yet sent.
According to RFC 793 this function should send an ACK.
Implements inet::tcp::TCPAlgorithm.
|
overridevirtual |
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.
Implements inet::tcp::TCPAlgorithm.
Reimplemented in inet::tcp::TCPVegas, inet::tcp::TCPWestwood, inet::tcp::TCPNoCongestionControl, inet::tcp::TCPTahoe, inet::tcp::TCPNewReno, and inet::tcp::TCPReno.
Referenced by inet::tcp::TCPNewReno::receivedDataAck(), inet::tcp::TCPReno::receivedDataAck(), inet::tcp::TCPNoCongestionControl::receivedDataAck(), inet::tcp::TCPTahoe::receivedDataAck(), inet::tcp::TCPWestwood::receivedDataAck(), and inet::tcp::TCPVegas::receivedDataAck().
|
overridevirtual |
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.)
Implements inet::tcp::TCPAlgorithm.
Reimplemented in inet::tcp::TCPVegas, inet::tcp::TCPWestwood, inet::tcp::TCPTahoe, inet::tcp::TCPNewReno, and inet::tcp::TCPReno.
Referenced by inet::tcp::TCPNewReno::receivedDuplicateAck(), inet::tcp::TCPReno::receivedDuplicateAck(), inet::tcp::TCPTahoe::receivedDuplicateAck(), inet::tcp::TCPWestwood::receivedDuplicateAck(), and inet::tcp::TCPVegas::receivedDuplicateAck().
|
overridevirtual |
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).
Implements inet::tcp::TCPAlgorithm.
|
overridevirtual |
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.
Implements inet::tcp::TCPAlgorithm.
|
overridevirtual |
Restart REXMIT timer.
Implements inet::tcp::TCPAlgorithm.
Referenced by inet::tcp::TCPNewReno::receivedDataAck(), inet::tcp::TCPReno::receivedDuplicateAck(), inet::tcp::TCPWestwood::receivedDuplicateAck(), and inet::tcp::TCPVegas::receivedDuplicateAck().
|
protectedvirtual |
Update state vars with new measured RTT value.
Passing two simtime_t's will allow rttMeasurementComplete() to do calculations in double or in 200ms/500ms ticks, as needed)
Referenced by receivedDataAck(), and rttMeasurementCompleteUsingTS().
|
overrideprotectedvirtual |
Converting uint32 echoedTS to simtime_t and calling rttMeasurementComplete() to update state vars with new measured RTT value.
Implements inet::tcp::TCPAlgorithm.
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.
Implements inet::tcp::TCPAlgorithm.
Reimplemented in inet::tcp::TCPVegas, and inet::tcp::TCPWestwood.
Referenced by inet::tcp::TCPWestwood::segmentRetransmitted(), and inet::tcp::TCPVegas::segmentRetransmitted().
|
overridevirtual |
Called after user sent TCP_C_SEND command to us.
Implements inet::tcp::TCPAlgorithm.
|
protectedvirtual |
Send data, observing Nagle's algorithm and congestion window.
Referenced by established(), inet::tcp::TCPNewReno::receivedDataAck(), inet::tcp::TCPReno::receivedDataAck(), inet::tcp::TCPNoCongestionControl::receivedDataAck(), inet::tcp::TCPTahoe::receivedDataAck(), inet::tcp::TCPWestwood::receivedDataAck(), inet::tcp::TCPVegas::receivedDataAck(), inet::tcp::TCPReno::receivedDuplicateAck(), inet::tcp::TCPNewReno::receivedDuplicateAck(), inet::tcp::TCPWestwood::receivedDuplicateAck(), inet::tcp::TCPVegas::receivedDuplicateAck(), and sendCommandInvoked().
|
protectedvirtual |
Start REXMIT timer and initialize retransmission variables.
Referenced by dataSent(), receivedDataAck(), and restartRexmitTimer().
|
protected |
Referenced by initialize(), inet::tcp::TCPNewReno::processRexmitTimer(), inet::tcp::TCPReno::processRexmitTimer(), inet::tcp::TCPTahoe::processRexmitTimer(), inet::tcp::TCPWestwood::processRexmitTimer(), inet::tcp::TCPVegas::processRexmitTimer(), inet::tcp::TCPReno::receivedDataAck(), inet::tcp::TCPNewReno::receivedDataAck(), inet::tcp::TCPTahoe::receivedDataAck(), inet::tcp::TCPWestwood::receivedDataAck(), inet::tcp::TCPVegas::receivedDataAck(), inet::tcp::TCPReno::receivedDuplicateAck(), inet::tcp::TCPNewReno::receivedDuplicateAck(), inet::tcp::TCPTahoe::receivedDuplicateAck(), inet::tcp::TCPWestwood::receivedDuplicateAck(), inet::tcp::TCPVegas::receivedDuplicateAck(), TCPBaseAlg(), and ~TCPBaseAlg().
|
protected |
Referenced by ackSent(), connectionClosed(), initialize(), processTimer(), receiveSeqChanged(), TCPBaseAlg(), and ~TCPBaseAlg().
|
protected |
Referenced by connectionClosed(), initialize(), processTimer(), TCPBaseAlg(), and ~TCPBaseAlg().
|
protected |
Referenced by initialize(), processRexmitTimer(), TCPBaseAlg(), and ~TCPBaseAlg().
|
protected |
Referenced by connectionClosed(), initialize(), processPersistTimer(), processTimer(), receivedDataAck(), TCPBaseAlg(), and ~TCPBaseAlg().
|
protected |
|
protected |
Referenced by initialize(), rttMeasurementComplete(), TCPBaseAlg(), and ~TCPBaseAlg().
|
protected |
Referenced by initialize(), rttMeasurementComplete(), TCPBaseAlg(), and ~TCPBaseAlg().
|
protected |
Referenced by initialize(), rttMeasurementComplete(), TCPBaseAlg(), and ~TCPBaseAlg().
|
protected |
Referenced by initialize(), rttMeasurementComplete(), TCPBaseAlg(), and ~TCPBaseAlg().
|
protected |
Referenced by initialize(), inet::tcp::TCPNewReno::recalculateSlowStartThreshold(), inet::tcp::TCPReno::recalculateSlowStartThreshold(), inet::tcp::TCPTahoe::recalculateSlowStartThreshold(), inet::tcp::TCPWestwood::recalculateSlowStartThreshold(), inet::tcp::TCPVegas::recalculateSlowStartThreshold(), TCPBaseAlg(), and ~TCPBaseAlg().
|
protected |
Referenced by ackSent(), dataSent(), established(), processDelayedAckTimer(), processPersistTimer(), processRexmitTimer(), receivedDataAck(), receivedDuplicateAck(), receivedOutOfOrderSegment(), receiveSeqChanged(), rttMeasurementComplete(), rttMeasurementCompleteUsingTS(), sendData(), and startRexmitTimer().