INET Framework for OMNeT++/OMNEST
inet::tcp::TcpNoCongestionControl Class Reference

TCP with no congestion control (i.e. More...

#include <TcpNoCongestionControl.h>

Inheritance diagram for inet::tcp::TcpNoCongestionControl:
inet::tcp::TcpBaseAlg inet::tcp::TcpAlgorithm

Public Member Functions

 TcpNoCongestionControl ()
 Ctor. More...
 
virtual void initialize () override
 Initialize state vars. More...
 
virtual void receivedDataAck (uint32_t firstSeqAcked) override
 Redefine what should happen when data got acked, to add congestion window management. More...
 
virtual void established (bool active) override
 Called when the connection is going to ESTABLISHED from SYN_SENT or SYN_RCVD. More...
 
virtual bool sendData (bool sendCommandInvoked) override
 Send data, observing Nagle's algorithm and congestion window. More...
 
- Public Member Functions inherited from inet::tcp::TcpBaseAlg
 TcpBaseAlg ()
 Ctor. More...
 
virtual ~TcpBaseAlg ()
 Virtual dtor. 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 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_t 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_t fromseq) override
 Called after we sent data. More...
 
virtual void segmentRetransmitted (uint32_t fromseq, uint32_t toseq) override
 Called after we retransmitted segment. More...
 
virtual void restartRexmitTimer () override
 Restart REXMIT timer. More...
 
virtual bool shouldMarkAck () override
 Called before sending ACK. More...
 
virtual void processEcnInEstablished () override
 Called before processing segment in established state. 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...
 
TcpStateVariablesgetStateVariables ()
 Creates and returns the TCP state variables. More...
 

Protected Member Functions

virtual TcpStateVariablescreateStateVariables () override
 Create and return a TcpNoCongestionControlStateVariables object. More...
 
virtual void processRexmitTimer (TcpEventCode &event) override
 Redefine what should happen on retransmission. More...
 
- Protected Member Functions inherited from inet::tcp::TcpBaseAlg
virtual void processPersistTimer (TcpEventCode &event)
 
virtual void processDelayedAckTimer (TcpEventCode &event)
 
virtual void processKeepAliveTimer (TcpEventCode &event)
 
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_t echoedTS) override
 Converting uint32_t echoedTS to simtime_t and calling rttMeasurementComplete() to update state vars with new measured RTT value. More...
 
cMessage * cancelEvent (cMessage *msg)
 Utility function. More...
 

Protected Attributes

TcpNoCongestionControlStateVariables *& state
 
- Protected Attributes inherited from inet::tcp::TcpBaseAlg
TcpBaseAlgStateVariables *& state
 
cMessage * rexmitTimer
 
cMessage * persistTimer
 
cMessage * delayedAckTimer
 
cMessage * keepAliveTimer
 
- Protected Attributes inherited from inet::tcp::TcpAlgorithm
TcpConnectionconn
 
TcpStateVariablesstate
 

Additional Inherited Members

- Static Protected Attributes inherited from inet::tcp::TcpBaseAlg
static simsignal_t cwndSignal = cComponent::registerSignal("cwnd")
 
static simsignal_t ssthreshSignal = cComponent::registerSignal("ssthresh")
 
static simsignal_t rttSignal = cComponent::registerSignal("rtt")
 
static simsignal_t srttSignal = cComponent::registerSignal("srtt")
 
static simsignal_t rttvarSignal = cComponent::registerSignal("rttvar")
 
static simsignal_t rtoSignal = cComponent::registerSignal("rto")
 
static simsignal_t numRtosSignal = cComponent::registerSignal("numRtos")
 

Detailed Description

TCP with no congestion control (i.e.

congestion window kept very large). Can be used to demonstrate effect of lack of congestion control.

Constructor & Destructor Documentation

◆ TcpNoCongestionControl()

inet::tcp::TcpNoCongestionControl::TcpNoCongestionControl ( )

Member Function Documentation

◆ createStateVariables()

virtual TcpStateVariables* inet::tcp::TcpNoCongestionControl::createStateVariables ( )
inlineoverrideprotectedvirtual

Create and return a TcpNoCongestionControlStateVariables object.

Implements inet::tcp::TcpAlgorithm.

32  {
34  }

◆ established()

void inet::tcp::TcpNoCongestionControl::established ( bool  active)
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.

Reimplemented from inet::tcp::TcpBaseAlg.

31 {
32  if (active) {
33  // finish connection setup with ACK (possibly piggybacked on data)
34  EV_INFO << "Completing connection setup by sending ACK (possibly piggybacked on data)\n";
35  if (!sendData(false)) // FIXME - This condition is never true because the buffer is empty (at this time) therefore the first ACK is never piggyback on data
36  conn->sendAck();
37  }
38 }

◆ initialize()

void inet::tcp::TcpNoCongestionControl::initialize ( )
overridevirtual

Initialize state vars.

Reimplemented from inet::tcp::TcpBaseAlg.

23 {
25 
26  // set congestion window to a practically infinite value
27  state->snd_cwnd = 0x7fffffff;
28 }

◆ processRexmitTimer()

void inet::tcp::TcpNoCongestionControl::processRexmitTimer ( TcpEventCode event)
overrideprotectedvirtual

Redefine what should happen on retransmission.

Reimplemented from inet::tcp::TcpBaseAlg.

65 {
67 
68  if (event == TCP_E_ABORT)
69  return;
70 
71  // Tahoe-style retransmission: only one segment
73 
74  ASSERT(state->snd_cwnd == 0x7fffffff);
75 }

◆ receivedDataAck()

void inet::tcp::TcpNoCongestionControl::receivedDataAck ( uint32_t  firstSeqAcked)
overridevirtual

Redefine what should happen when data got acked, to add congestion window management.

Reimplemented from inet::tcp::TcpBaseAlg.

78 {
79  TcpBaseAlg::receivedDataAck(firstSeqAcked);
80 
81  // ack may have freed up some room in the window, try sending
82  sendData(false);
83 
84  ASSERT(state->snd_cwnd == 0x7fffffff);
85 }

◆ sendData()

bool inet::tcp::TcpNoCongestionControl::sendData ( bool  sendCommandInvoked)
overridevirtual

Send data, observing Nagle's algorithm and congestion window.

Reimplemented from inet::tcp::TcpBaseAlg.

41 {
42  //
43  // Nagle's algorithm: when a TCP connection has outstanding data that has not
44  // yet been acknowledged, small segments cannot be sent until the outstanding
45  // data is acknowledged. (In this case, small amounts of data are collected
46  // by TCP and sent in a single segment.)
47  //
48  // FIXME there's also something like this: can still send if
49  // "b) a segment that can be sent is at least half the size of
50  // the largest window ever advertised by the receiver"
51 
52  bool fullSegmentsOnly = sendCommandInvoked && state->nagle_enabled && state->snd_una != state->snd_max;
53 
54  if (fullSegmentsOnly)
55  EV_INFO << "Nagle is enabled and there's unacked data: only full segments will be sent\n";
56 
57  //
58  // Send window is effectively the minimum of the congestion window (cwnd)
59  // and the advertised window (snd_wnd).
60  //
61  return conn->sendData(state->snd_cwnd);
62 }

Referenced by established(), and receivedDataAck().

Member Data Documentation

◆ state

TcpNoCongestionControlStateVariables*& inet::tcp::TcpNoCongestionControl::state
protected

The documentation for this class was generated from the following files:
inet::tcp::TcpBaseAlg::TcpBaseAlg
TcpBaseAlg()
Ctor.
Definition: TcpBaseAlg.cc:95
inet::tcp::TcpBaseAlg::processRexmitTimer
virtual void processRexmitTimer(TcpEventCode &event)
Definition: TcpBaseAlg.cc:208
inet::tcp::TcpBaseAlg::initialize
virtual void initialize() override
Create timers, etc.
Definition: TcpBaseAlg.cc:116
inet::tcp::TcpConnection::sendAck
virtual void sendAck()
Utility: send ACK.
Definition: TcpConnectionUtil.cc:679
inet::tcp::TcpBaseAlgStateVariables::snd_cwnd
uint32_t snd_cwnd
congestion window
Definition: TcpBaseAlg.h:40
inet::tcp::TcpStateVariables::nagle_enabled
bool nagle_enabled
Definition: TcpConnection.h:179
inet::tcp::TcpNoCongestionControlStateVariables
TcpBaseAlgStateVariables TcpNoCongestionControlStateVariables
State variables for TcpNoCongestionControl.
Definition: TcpNoCongestionControl.h:19
inet::tcp::TcpAlgorithm::conn
TcpConnection * conn
Definition: TcpAlgorithm.h:26
inet::tcp::TcpBaseAlg::receivedDataAck
virtual void receivedDataAck(uint32_t firstSeqAcked) override
Called after we received an ACK which acked some data (that is, we could advance snd_una).
Definition: TcpBaseAlg.cc:483
inet::tcp::TcpBaseAlg::sendCommandInvoked
virtual void sendCommandInvoked() override
Called after user sent TCP_C_SEND command to us.
Definition: TcpBaseAlg.cc:431
inet::tcp::TcpConnection::sendData
virtual bool sendData(uint32_t congestionWindow)
Utility: Send data from sendQueue, at most congestionWindow.
Definition: TcpConnectionUtil.cc:848
inet::tcp::TcpNoCongestionControl::state
TcpNoCongestionControlStateVariables *& state
Definition: TcpNoCongestionControl.h:28
inet::tcp::TCP_E_ABORT
@ TCP_E_ABORT
Definition: TcpConnection.h:75
inet::tcp::TcpConnection::retransmitOneSegment
virtual void retransmitOneSegment(bool called_at_rto)
Utility: retransmit one segment from snd_una.
Definition: TcpConnectionUtil.cc:960
inet::tcp::TcpStateVariables::snd_una
uint32_t snd_una
Definition: TcpConnection.h:147
inet::tcp::TcpAlgorithm::state
TcpStateVariables * state
Definition: TcpAlgorithm.h:27
inet::tcp::TcpNoCongestionControl::sendData
virtual bool sendData(bool sendCommandInvoked) override
Send data, observing Nagle's algorithm and congestion window.
Definition: TcpNoCongestionControl.cc:40
inet::tcp::TcpStateVariables::snd_max
uint32_t snd_max
Definition: TcpConnection.h:149