A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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:
+ Collaboration diagram for ns3::TcpSocketState:

Public Types

enum  EcnCodePoint_t { NotECT = 0 , Ect1 = 1 , Ect0 = 2 , CongExp = 3 }
 ECN code points. More...
 
enum  EcnMode_t { ClassicEcn , DctcpEcn }
 ECN Modes. More...
 
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
}
 Congestion avoidance events. More...
 
enum  TcpCongState_t {
  CA_OPEN , CA_DISORDER , CA_CWR , CA_RECOVERY ,
  CA_LOSS , CA_LAST_STATE
}
 Definition of the Congestion state machine. More...
 
enum  UseEcn_t { Off = 0 , On = 1 , AcceptOnly = 2 }
 Parameter value related to ECN enable/disable functionality similar to sysctl for tcp_ecn. More...
 

Public Member Functions

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

Static Public Member Functions

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

Public Attributes

TracedValue< uint32_tm_bytesInFlight {0}
 Bytes in flight.
 
TracedValue< TcpCongState_tm_congState {CA_OPEN}
 State in the Congestion state machine.
 
TracedValue< uint32_tm_cWnd {0}
 Congestion window.
 
TracedValue< uint32_tm_cWndInfl
 Inflated congestion window trace (used only for backward compatibility purpose)
 
EcnMode_t m_ecnMode {ClassicEcn}
 ECN mode.
 
TracedValue< EcnState_tm_ecnState
 Current ECN State, represented as combination of EcnState values.
 
EcnCodePoint_t m_ectCodePoint {Ect0}
 ECT code point to use.
 
TracedValue< SequenceNumber32m_highTxMark {0}
 Highest seqno ever sent, regardless of ReTx.
 
uint32_t m_initialCWnd {0}
 Initial cWnd value.
 
uint32_t m_initialSsThresh {0}
 Initial Slow Start Threshold value.
 
bool m_isCwndLimited {false}
 Whether throughput is limited by cwnd.
 
bool m_isRetransDataAcked {false}
 Retransmitted data is ACKed if true.
 
uint32_t m_lastAckedSackedBytes
 The number of bytes acked and sacked as indicated by the current ACK received.
 
SequenceNumber32 m_lastAckedSeq {0}
 Last sequence ACKed.
 
TracedValue< Timem_lastRtt
 RTT of the last (S)ACKed packet.
 
DataRate m_maxPacingRate {0}
 Max Pacing rate.
 
Time m_minRtt {Time::Max()}
 Minimum RTT observed throughout the connection.
 
TracedValue< SequenceNumber32m_nextTxSequence
 Next seqnum to be sent (SND.NXT), ReTx pushes it back.
 
bool m_paceInitialWindow {false}
 Enable/Disable pacing for the initial window.
 
bool m_pacing {false}
 Pacing status.
 
uint16_t m_pacingCaRatio {0}
 CA pacing ratio.
 
TracedValue< DataRatem_pacingRate {0}
 Current Pacing rate.
 
uint16_t m_pacingSsRatio {0}
 SS pacing ratio.
 
uint32_t m_rcvTimestampEchoReply {0}
 Sender Timestamp echoed by the receiver.
 
uint32_t m_rcvTimestampValue {0}
 Receiver Timestamp value.
 
Ptr< TcpRxBufferm_rxBuffer
 Rx buffer (reordering buffer)
 
uint32_t m_segmentSize {0}
 Segment size.
 
Callback< void, uint8_t > m_sendEmptyPacketCallback
 Callback to send an empty packet.
 
TracedValue< Timem_srtt
 Smoothed RTT.
 
TracedValue< uint32_tm_ssThresh {0}
 Slow start threshold.
 
UseEcn_t m_useEcn {Off}
 Socket ECN capability.
 

Static Public Attributes

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

Additional Inherited Members

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

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 differences. 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

  • EnablePacing: Enable Pacing
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: false
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • MaxPacingRate: Set Max Pacing Rate
    • Set with class: ns3::DataRateValue
    • Underlying type: DataRate
    • Initial value: 4000000000bps
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • PaceInitialWindow: Perform pacing for initial window of data
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: false
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • PacingCaRatio: Percent pacing rate increase for congestion avoidance conditions
    • Set with class: ns3::UintegerValue
    • Underlying type: uint16_t 0:65535
    • Initial value: 120
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • PacingSsRatio: Percent pacing rate increase for slow start conditions
    • Set with class: ns3::UintegerValue
    • Underlying type: uint16_t 0:65535
    • Initial value: 200
    • Flags: constructwriteread
    • Support level: SUPPORTED

TraceSources

Group: Internet

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

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

Member Enumeration Documentation

◆ EcnCodePoint_t

ECN code points.

Enumerator
NotECT 

Unmarkable.

Ect1 

Markable.

Ect0 

Markable.

CongExp 

Marked.

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

◆ EcnMode_t

ECN Modes.

Enumerator
ClassicEcn 

ECN functionality as described in RFC 3168.

DctcpEcn 

ECN functionality as described in RFC 8257.

Note: this mode is specific to DCTCP.

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

◆ 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 136 of file tcp-socket-state.h.

◆ TcpCAEvent_t

Congestion avoidance events.

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 86 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, such as ECN, ICMP source quench, local device congestion.

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 69 of file tcp-socket-state.h.

◆ UseEcn_t

Parameter value related to ECN enable/disable functionality similar to sysctl for tcp_ecn.

Currently value 2 from https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt is not implemented.

Enumerator
Off 

Disable.

On 

Enable.

AcceptOnly 

Enable only when the peer endpoint is ECN capable.

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

Constructor & Destructor Documentation

◆ TcpSocketState() [1/2]

ns3::TcpSocketState::TcpSocketState ( )
inline

TcpSocketState Constructor.

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

◆ TcpSocketState() [2/2]

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

Copy constructor.

Parameters
otherobject to copy.

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

Member Function Documentation

◆ GetCwndInSegments()

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

Get cwnd in segments rather than bytes.

Returns
Congestion window in segments

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

References m_cWnd, and m_segmentSize.

◆ 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 229 of file tcp-socket-state.h.

References m_segmentSize, and m_ssThresh.

◆ GetTypeId()

TypeId ns3::TcpSocketState::GetTypeId ( )
static

Get the type ID.

Get the type ID.

Returns
the object TypeId

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

References m_bytesInFlight, m_congState, m_cWnd, m_cWndInfl, m_ecnState, m_highTxMark, m_lastRtt, m_maxPacingRate, m_nextTxSequence, m_paceInitialWindow, m_pacing, m_pacingCaRatio, m_pacingRate, m_pacingSsRatio, m_srtt, m_ssThresh, ns3::MakeBooleanAccessor(), ns3::MakeBooleanChecker(), ns3::MakeDataRateAccessor(), ns3::MakeDataRateChecker(), ns3::MakeTraceSourceAccessor(), ns3::MakeUintegerAccessor(), ns3::MakeUintegerChecker(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

Member Data Documentation

◆ EcnStateName

◆ m_bytesInFlight

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

Bytes in flight.

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

Referenced by GetTypeId().

◆ m_congState

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

State in the Congestion state machine.

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

Referenced by GetTypeId().

◆ m_cWnd

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

Congestion window.

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

Referenced by TcpVenoTest::DoRun(), GetCwndInSegments(), and GetTypeId().

◆ m_cWndInfl

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

Inflated congestion window trace (used only for backward compatibility purpose)

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

Referenced by GetTypeId().

◆ m_ecnMode

EcnMode_t ns3::TcpSocketState::m_ecnMode {ClassicEcn}

ECN mode.

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

◆ m_ecnState

TracedValue<EcnState_t> ns3::TcpSocketState::m_ecnState
Initial value:
{
@ ECN_DISABLED
ECN disabled traffic.

Current ECN State, represented as combination of EcnState values.

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

Referenced by GetTypeId().

◆ m_ectCodePoint

EcnCodePoint_t ns3::TcpSocketState::m_ectCodePoint {Ect0}

ECT code point to use.

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

◆ m_highTxMark

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

Highest seqno ever sent, regardless of ReTx.

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

Referenced by GetTypeId().

◆ m_initialCWnd

uint32_t ns3::TcpSocketState::m_initialCWnd {0}

Initial cWnd value.

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

◆ m_initialSsThresh

uint32_t ns3::TcpSocketState::m_initialSsThresh {0}

Initial Slow Start Threshold value.

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

◆ m_isCwndLimited

bool ns3::TcpSocketState::m_isCwndLimited {false}

Whether throughput is limited by cwnd.

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

◆ m_isRetransDataAcked

bool ns3::TcpSocketState::m_isRetransDataAcked {false}

Retransmitted data is ACKed if true.

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

◆ m_lastAckedSackedBytes

uint32_t ns3::TcpSocketState::m_lastAckedSackedBytes
Initial value:
{
0}

The number of bytes acked and sacked as indicated by the current ACK received.

This is similar to acked_sacked variable in Linux

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

◆ m_lastAckedSeq

SequenceNumber32 ns3::TcpSocketState::m_lastAckedSeq {0}

Last sequence ACKed.

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

◆ m_lastRtt

TracedValue<Time> ns3::TcpSocketState::m_lastRtt

RTT of the last (S)ACKed packet.

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

Referenced by GetTypeId().

◆ m_maxPacingRate

DataRate ns3::TcpSocketState::m_maxPacingRate {0}

Max Pacing rate.

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

Referenced by GetTypeId().

◆ m_minRtt

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

Minimum RTT observed throughout the connection.

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

◆ m_nextTxSequence

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

Next seqnum to be sent (SND.NXT), ReTx pushes it back.

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

Referenced by GetTypeId().

◆ m_paceInitialWindow

bool ns3::TcpSocketState::m_paceInitialWindow {false}

Enable/Disable pacing for the initial window.

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

Referenced by GetTypeId().

◆ m_pacing

bool ns3::TcpSocketState::m_pacing {false}

Pacing status.

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

Referenced by GetTypeId().

◆ m_pacingCaRatio

uint16_t ns3::TcpSocketState::m_pacingCaRatio {0}

CA pacing ratio.

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

Referenced by GetTypeId().

◆ m_pacingRate

TracedValue<DataRate> ns3::TcpSocketState::m_pacingRate {0}

Current Pacing rate.

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

Referenced by GetTypeId().

◆ m_pacingSsRatio

uint16_t ns3::TcpSocketState::m_pacingSsRatio {0}

SS pacing ratio.

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

Referenced by GetTypeId().

◆ m_rcvTimestampEchoReply

uint32_t ns3::TcpSocketState::m_rcvTimestampEchoReply {0}

Sender Timestamp echoed by the receiver.

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

◆ m_rcvTimestampValue

uint32_t ns3::TcpSocketState::m_rcvTimestampValue {0}

Receiver Timestamp value.

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

◆ m_rxBuffer

Ptr<TcpRxBuffer> ns3::TcpSocketState::m_rxBuffer

Rx buffer (reordering buffer)

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

◆ m_segmentSize

uint32_t ns3::TcpSocketState::m_segmentSize {0}

Segment size.

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

Referenced by TcpVenoTest::DoRun(), GetCwndInSegments(), and GetSsThreshInSegments().

◆ m_sendEmptyPacketCallback

Callback<void, uint8_t> ns3::TcpSocketState::m_sendEmptyPacketCallback

Callback to send an empty packet.

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

◆ m_srtt

TracedValue<Time> ns3::TcpSocketState::m_srtt

Smoothed RTT.

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

Referenced by GetTypeId().

◆ m_ssThresh

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

Slow start threshold.

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

Referenced by TcpVenoTest::DoRun(), GetSsThreshInSegments(), and GetTypeId().

◆ m_useEcn

UseEcn_t ns3::TcpSocketState::m_useEcn {Off}

Socket ECN capability.

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

◆ 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 151 of file tcp-socket-state.h.

Referenced by ns3::TcpSocketBase::EnterCwr(), ns3::TcpSocketBase::EnterRecovery(), ns3::TcpSocketBase::ProcessAck(), ns3::TcpSocketBase::ReceivedAck(), and TcpDctcpCongestedRouter::SendDataPacket().


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