A Discrete-Event Network Simulator
API
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
ns3::TcpSocketState Class Reference

Data structure that records the congestion state of a connection. More...

#include "tcp-socket-state.h"

+ Inheritance diagram for ns3::TcpSocketState:

Public Types

enum  EcnState_t {
  ECN_DISABLED = 0, ECN_IDLE, ECN_CE_RCVD, ECN_SENDING_ECE,
  ECN_ECE_RCVD, ECN_CWR_SENT
}
 Definition of the Ecn state machine. More...
 
enum  TcpCAEvent_t {
  CA_EVENT_TX_START, CA_EVENT_CWND_RESTART, CA_EVENT_COMPLETE_CWR, CA_EVENT_LOSS,
  CA_EVENT_ECN_NO_CE, CA_EVENT_ECN_IS_CE, CA_EVENT_DELAYED_ACK, CA_EVENT_NON_DELAYED_ACK
}
 
enum  TcpCongState_t {
  CA_OPEN, CA_DISORDER, CA_CWR, CA_RECOVERY,
  CA_LOSS, CA_LAST_STATE
}
 Definition of the Congestion state machine. More...
 

Public Member Functions

 TcpSocketState ()
 TcpSocketState Constructor. More...
 
 TcpSocketState (const TcpSocketState &other)
 Copy constructor. More...
 
uint32_t GetCwndInSegments () const
 Get cwnd in segments rather than bytes. More...
 
uint32_t GetSsThreshInSegments () const
 Get slow start thresh in segments rather than bytes. More...
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose (void)
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator (void) const
 Get an iterator to the Objects aggregated to this one. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Get the most derived TypeId for this Object. More...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. More...
 
void Initialize (void)
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized (void) const
 Check if the object has been initialized. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor. More...
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful. More...
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising erros. More...
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful. More...
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors. More...
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context. More...
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context. More...
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context. More...
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context. More...
 

Static Public Member Functions

static TypeId GetTypeId (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Public Attributes

TracedValue< uint32_t > m_bytesInFlight {0}
 Bytes in flight. More...
 
TracedValue< TcpCongState_tm_congState {CA_OPEN}
 State in the Congestion state machine. More...
 
DataRate m_currentPacingRate {0}
 Current Pacing rate. More...
 
TracedValue< uint32_t > m_cWnd {0}
 Congestion window. More...
 
TracedValue< uint32_t > m_cWndInfl {0}
 Inflated congestion window trace (used only for backward compatibility purpose) More...
 
TracedValue< EcnState_tm_ecnState {ECN_DISABLED}
 Current ECN State, represented as combination of EcnState values. More...
 
TracedValue< SequenceNumber32m_highTxMark {0}
 Highest seqno ever sent, regardless of ReTx. More...
 
uint32_t m_initialCWnd {0}
 Initial cWnd value. More...
 
uint32_t m_initialSsThresh {0}
 Initial Slow Start Threshold value. More...
 
SequenceNumber32 m_lastAckedSeq {0}
 Last sequence ACKed. More...
 
TracedValue< Timem_lastRtt {Seconds (0.0)}
 Last RTT sample collected. More...
 
DataRate m_maxPacingRate {0}
 Max Pacing rate. More...
 
Time m_minRtt {Time::Max ()}
 Minimum RTT observed throughout the connection. More...
 
TracedValue< SequenceNumber32m_nextTxSequence {0}
 Next seqnum to be sent (SND.NXT), ReTx pushes it back. More...
 
bool m_pacing {false}
 Pacing status. More...
 
uint32_t m_rcvTimestampEchoReply {0}
 Sender Timestamp echoed by the receiver. More...
 
uint32_t m_rcvTimestampValue {0}
 Receiver Timestamp value. More...
 
uint32_t m_segmentSize {0}
 Segment size. More...
 
TracedValue< uint32_t > m_ssThresh {0}
 Slow start threshold. More...
 

Static Public Attributes

static const char *const EcnStateName [TcpSocketState::ECN_CWR_SENT+1]
 Literal names of ECN states for use in log messages. More...
 
static const char *const TcpCongStateName [TcpSocketState::CA_LAST_STATE]
 Literal names of TCP states for use in log messages. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void DoDispose (void)
 Destructor implementation. More...
 
virtual void DoInitialize (void)
 Initialize() implementation. More...
 
virtual void NotifyNewAggregate (void)
 Notify all Objects aggregated to this one of a new Object being aggregated. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes. More...
 
virtual void NotifyConstructionCompleted (void)
 Notifier called once the ObjectBase is fully constructed. More...
 

Detailed Description

Data structure that records the congestion state of a connection.


Introspection did not find any typical Config paths.

In this data structure, basic information that should be passed between socket and the congestion control algorithm are saved. Through the code, it will be referred as Transmission Control Block (TCB), but there are some differencies. In the RFCs, the TCB contains all the variables that defines a connection, while we preferred to maintain in this class only the values that should be exchanged between socket and other parts, like congestion control algorithms.


Attributes

TraceSources

Size of this type is 376 bytes (on a 64-bit architecture).

Definition at line 39 of file tcp-socket-state.h.

Member Enumeration Documentation

◆ EcnState_t

Definition of the Ecn state machine.

Enumerator
ECN_DISABLED 

ECN disabled traffic.

ECN_IDLE 

ECN is enabled but currently there is no action pertaining to ECE or CWR to be taken.

ECN_CE_RCVD 

Last packet received had CE bit set in IP header.

ECN_SENDING_ECE 

Receiver sends an ACK with ECE bit set in TCP header.

ECN_ECE_RCVD 

Last ACK received had ECE bit set in TCP header.

ECN_CWR_SENT 

Sender has reduced the congestion window, and sent a packet with CWR bit set in TCP header.

This state is used for tracing.

Definition at line 105 of file tcp-socket-state.h.

◆ TcpCAEvent_t

Enumerator
CA_EVENT_TX_START 

first transmit when no packets in flight

CA_EVENT_CWND_RESTART 

congestion window restart.

Not triggered

CA_EVENT_COMPLETE_CWR 

end of congestion recovery

CA_EVENT_LOSS 

loss timeout

CA_EVENT_ECN_NO_CE 

ECT set, but not CE marked.

Not triggered

CA_EVENT_ECN_IS_CE 

received CE marked IP packet.

Not triggered

CA_EVENT_DELAYED_ACK 

Delayed ack is sent.

CA_EVENT_NON_DELAYED_ACK 

Non-delayed ack is sent.

Definition at line 89 of file tcp-socket-state.h.

◆ TcpCongState_t

Definition of the Congestion state machine.

The design of this state machine is taken from Linux v4.0, but it has been maintained in the Linux mainline from ages. It basically avoids to maintain a lot of boolean variables, and it allows to check the transitions from different algorithm in a cleaner way.

These states represent the situation from a congestion control point of view: in fact, apart the CA_OPEN state, the other states represent a situation in which there is a congestion, and different actions should be taken, depending on the case.

Enumerator
CA_OPEN 

Normal state, no dubious events.

CA_DISORDER 

In all the respects it is "Open", but requires a bit more attention.

It is entered when we see some SACKs or dupacks. It is split of "Open"

CA_CWR 

cWnd was reduced due to some Congestion Notification event.

It can be ECN, ICMP source quench, local device congestion. Not used in NS-3 right now.

CA_RECOVERY 

CWND was reduced, we are fast-retransmitting.

CA_LOSS 

CWND was reduced due to RTO timeout or SACK reneging.

CA_LAST_STATE 

Used only in debug messages.

Definition at line 74 of file tcp-socket-state.h.

Constructor & Destructor Documentation

◆ TcpSocketState() [1/2]

ns3::TcpSocketState::TcpSocketState ( )
inline

TcpSocketState Constructor.

Definition at line 52 of file tcp-socket-state.h.

◆ TcpSocketState() [2/2]

ns3::TcpSocketState::TcpSocketState ( const TcpSocketState other)

Copy constructor.

Parameters
otherobject to copy.

Definition at line 79 of file tcp-socket-state.cc.

Member Function Documentation

◆ GetCwndInSegments()

uint32_t ns3::TcpSocketState::GetCwndInSegments ( ) const
inline

◆ GetSsThreshInSegments()

uint32_t ns3::TcpSocketState::GetSsThreshInSegments ( ) const
inline

Get slow start thresh in segments rather than bytes.

Returns
Slow start threshold in segments

Definition at line 172 of file tcp-socket-state.h.

References m_segmentSize, and m_ssThresh.

◆ GetTypeId()

TypeId ns3::TcpSocketState::GetTypeId ( void  )
static

Member Data Documentation

◆ EcnStateName

const char *const ns3::TcpSocketState::EcnStateName
static

◆ m_bytesInFlight

TracedValue<uint32_t> ns3::TcpSocketState::m_bytesInFlight {0}

◆ m_congState

TracedValue<TcpCongState_t> ns3::TcpSocketState::m_congState {CA_OPEN}

◆ m_currentPacingRate

DataRate ns3::TcpSocketState::m_currentPacingRate {0}

◆ m_cWnd

TracedValue<uint32_t> ns3::TcpSocketState::m_cWnd {0}

Congestion window.

Definition at line 127 of file tcp-socket-state.h.

Referenced by ns3::TcpHtcp::CongestionAvoidance(), ns3::TcpHybla::CongestionAvoidance(), ns3::TcpHighSpeed::CongestionAvoidance(), ns3::TcpScalable::CongestionAvoidance(), ns3::TcpLedbat::CongestionAvoidance(), ns3::TcpNewReno::CongestionAvoidance(), ns3::TcpSocketBase::DoForwardUp(), ns3::TcpPrrRecovery::DoRecovery(), TcpHighSpeedIncrementTest::DoRun(), TcpHyblaIncrementTest::DoRun(), ClassicRecoveryTest::DoRun(), TcpBicIncrementTest::DoRun(), TcpScalableIncrementTest::DoRun(), TcpHtcpIncrementTest::DoRun(), TcpVegasTest::DoRun(), PrrRecoveryTest::DoRun(), TcpVenoTest::DoRun(), TcpYeahIncrementTest::DoRun(), TcpIllinoisTest::DoRun(), TcpHighSpeedDecrementTest::DoRun(), TcpScalableDecrementTest::DoRun(), TcpBicDecrementTest::DoRun(), TcpYeahDecrementTest::DoRun(), ns3::TcpSocketBase::DupAck(), ns3::TcpClassicRecovery::EnterRecovery(), ns3::TcpSocketBase::EnterRecovery(), ns3::TcpLpToNewReno::ExecuteTest(), TcpLedbatToNewReno::ExecuteTest(), TcpBicIncrementTest::ExecuteTest(), ns3::TcpLpInferenceTest1::ExecuteTest(), TcpLedbatIncrementTest::ExecuteTest(), ns3::TcpLpInferenceTest2::ExecuteTest(), TcpBicDecrementTest::ExecuteTest(), TcpLedbatDecrementTest::ExecuteTest(), ns3::TcpPrrRecovery::ExitRecovery(), GetCwndInSegments(), GetTypeId(), ns3::TcpBic::IncreaseWindow(), ns3::TcpLedbat::IncreaseWindow(), ns3::TcpVegas::IncreaseWindow(), ns3::TcpVeno::IncreaseWindow(), ns3::TcpYeah::IncreaseWindow(), ns3::TcpIllinois::IncreaseWindow(), ns3::TcpNewReno::IncreaseWindow(), TcpVenoTest::NewReno_CongestionAvoidance(), TcpVenoTest::NewReno_IncreaseWindow(), TcpVenoTest::NewReno_SlowStart(), ns3::TcpLp::PktsAcked(), ns3::TcpSocketBase::ProcessAck(), ns3::TcpSocketBase::ReTxTimeout(), ns3::TcpSocketCongestedRouter::SendDataPacket(), ns3::TcpSocketBase::SendDataPacket(), ns3::TcpSocketBase::SendPendingData(), ns3::TcpHybla::SlowStart(), ns3::TcpNewReno::SlowStart(), TcpBicIncrementTest::Update(), and ns3::TcpSocketBase::Window().

◆ m_cWndInfl

TracedValue<uint32_t> ns3::TcpSocketState::m_cWndInfl {0}

◆ m_ecnState

TracedValue<EcnState_t> ns3::TcpSocketState::m_ecnState {ECN_DISABLED}

◆ m_highTxMark

TracedValue<SequenceNumber32> ns3::TcpSocketState::m_highTxMark {0}

◆ m_initialCWnd

uint32_t ns3::TcpSocketState::m_initialCWnd {0}

Initial cWnd value.

Definition at line 130 of file tcp-socket-state.h.

Referenced by ns3::TcpSocketBase::GetInitialCwnd(), and ns3::TcpSocketBase::SetInitialCwnd().

◆ m_initialSsThresh

uint32_t ns3::TcpSocketState::m_initialSsThresh {0}

Initial Slow Start Threshold value.

Definition at line 131 of file tcp-socket-state.h.

Referenced by ns3::TcpSocketBase::GetInitialSSThresh(), and ns3::TcpSocketBase::SetInitialSSThresh().

◆ m_lastAckedSeq

SequenceNumber32 ns3::TcpSocketState::m_lastAckedSeq {0}

◆ m_lastRtt

TracedValue<Time> ns3::TcpSocketState::m_lastRtt {Seconds (0.0)}

Last RTT sample collected.

Definition at line 155 of file tcp-socket-state.h.

Referenced by ns3::TcpSocketBase::EstimateRtt(), GetTypeId(), and ns3::TcpSocketBase::ProcessAck().

◆ m_maxPacingRate

DataRate ns3::TcpSocketState::m_maxPacingRate {0}

Max Pacing rate.

Definition at line 149 of file tcp-socket-state.h.

Referenced by GetTypeId(), and ns3::TcpSocketBase::TcpSocketBase().

◆ m_minRtt

Time ns3::TcpSocketState::m_minRtt {Time::Max ()}

◆ m_nextTxSequence

TracedValue<SequenceNumber32> ns3::TcpSocketState::m_nextTxSequence {0}

◆ m_pacing

bool ns3::TcpSocketState::m_pacing {false}

Pacing status.

Definition at line 148 of file tcp-socket-state.h.

Referenced by GetTypeId(), ns3::TcpSocketBase::SendDataPacket(), and ns3::TcpSocketBase::SendPendingData().

◆ m_rcvTimestampEchoReply

uint32_t ns3::TcpSocketState::m_rcvTimestampEchoReply {0}

◆ m_rcvTimestampValue

uint32_t ns3::TcpSocketState::m_rcvTimestampValue {0}

◆ m_segmentSize

uint32_t ns3::TcpSocketState::m_segmentSize {0}

Segment size.

Definition at line 134 of file tcp-socket-state.h.

Referenced by TcpSsThreshRtoTest::AfterRTOExpired(), ns3::TcpHybla::CongestionAvoidance(), ns3::TcpHtcp::CongestionAvoidance(), ns3::TcpHighSpeed::CongestionAvoidance(), ns3::TcpScalable::CongestionAvoidance(), ns3::TcpLedbat::CongestionAvoidance(), ns3::TcpNewReno::CongestionAvoidance(), ns3::TcpPrrRecovery::DoRecovery(), ns3::TcpClassicRecovery::DoRecovery(), ns3::TcpSocketBase::DoRetransmit(), TcpHighSpeedIncrementTest::DoRun(), TcpHyblaIncrementTest::DoRun(), TcpBicIncrementTest::DoRun(), ClassicRecoveryTest::DoRun(), TcpScalableIncrementTest::DoRun(), TcpHtcpIncrementTest::DoRun(), TcpVegasTest::DoRun(), PrrRecoveryTest::DoRun(), TcpVenoTest::DoRun(), TcpYeahIncrementTest::DoRun(), TcpIllinoisTest::DoRun(), TcpHighSpeedDecrementTest::DoRun(), TcpScalableDecrementTest::DoRun(), TcpBicDecrementTest::DoRun(), TcpYeahDecrementTest::DoRun(), ns3::TcpSocketBase::DupAck(), ns3::TcpClassicRecovery::EnterRecovery(), ns3::TcpSocketBase::EnterRecovery(), ns3::TcpWestwood::EstimateBW(), ns3::TcpLpToNewReno::ExecuteTest(), TcpLedbatToNewReno::ExecuteTest(), ns3::TcpLpInferenceTest1::ExecuteTest(), TcpLedbatIncrementTest::ExecuteTest(), ns3::TcpLpInferenceTest2::ExecuteTest(), TcpLedbatDecrementTest::ExecuteTest(), GetCwndInSegments(), ns3::TcpSocketBase::GetSegSize(), GetSsThreshInSegments(), ns3::TcpBic::IncreaseWindow(), ns3::TcpLedbat::IncreaseWindow(), ns3::TcpVegas::IncreaseWindow(), ns3::TcpYeah::IncreaseWindow(), ns3::TcpIllinois::IncreaseWindow(), TcpVenoTest::NewReno_CongestionAvoidance(), TcpVenoTest::NewReno_SlowStart(), ns3::TcpLp::PktsAcked(), ns3::TcpHtcp::PktsAcked(), ns3::TcpSocketBase::ProcessAck(), ns3::TcpSocketBase::ReceivedAck(), ns3::TcpSocketBase::ReTxTimeout(), ns3::TcpSocketCongestedRouter::SendDataPacket(), ns3::TcpSocketBase::SendDataPacket(), ns3::TcpSocketBase::SendPendingData(), ns3::TcpSocketBase::SetSegSize(), ns3::TcpHybla::SlowStart(), ns3::TcpNewReno::SlowStart(), and TcpBicIncrementTest::Update().

◆ m_ssThresh

TracedValue<uint32_t> ns3::TcpSocketState::m_ssThresh {0}

◆ TcpCongStateName

const char *const ns3::TcpSocketState::TcpCongStateName
static
Initial value:
=
{
"CA_OPEN", "CA_DISORDER", "CA_CWR", "CA_RECOVERY", "CA_LOSS"
}

Literal names of TCP states for use in log messages.

Definition at line 119 of file tcp-socket-state.h.

Referenced by ns3::TcpSocketBase::EnterRecovery(), ns3::TcpSocketBase::ProcessAck(), ns3::TcpSocketCongestedRouter::SendDataPacket(), and ns3::TcpSocketBase::SendDataPacket().


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