A Discrete-Event Network Simulator
API
ns3::TcpSocketState Class Reference

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

#include "tcp-socket-base.h"

+ Inheritance diagram for ns3::TcpSocketState:
+ Collaboration diagram for ns3::TcpSocketState:

Public Types

enum  TcpCongState_t {
  CA_OPEN, CA_DISORDER, CA_CWR, CA_RECOVERY,
  CA_LOSS, CA_LAST_STATE
}
 Definition of the Congestion state machine. More...
 
typedef void(* TcpCongStatesTracedValueCallback) (const TcpCongState_t oldValue, const TcpCongState_t newValue)
 TracedValue Callback signature for TcpCongState_t. More...
 

Public Member Functions

 TcpSocketState ()
 
 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
 Implement the GetInstanceTypeId method defined in ObjectBase. 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 ()
 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. 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::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
static void Cleanup (void)
 Noop. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Public Attributes

TracedValue< TcpCongState_tm_congState
 State in the Congestion state machine. More...
 
TracedValue< uint32_t > m_cWnd
 Congestion window. More...
 
TracedValue< SequenceNumber32m_highTxMark
 Highest seqno ever sent, regardless of ReTx. More...
 
uint32_t m_initialCWnd
 Initial cWnd value. More...
 
uint32_t m_initialSsThresh
 Initial Slow Start Threshold value. More...
 
SequenceNumber32 m_lastAckedSeq
 Last sequence ACKed. More...
 
TracedValue< SequenceNumber32m_nextTxSequence
 Next seqnum to be sent (SND.NXT), ReTx pushes it back. More...
 
uint32_t m_segmentSize
 Segment size. More...
 
TracedValue< uint32_t > m_ssThresh
 Slow start threshold. More...
 

Static Public Attributes

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.

In this data structure, basic informations 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.

Definition at line 92 of file tcp-socket-base.h.

Member Enumeration Documentation

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 124 of file tcp-socket-base.h.

Constructor & Destructor Documentation

ns3::TcpSocketState::TcpSocketState ( void  )

Definition at line 230 of file tcp-socket-base.cc.

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

Copy constructor.

Parameters
otherobject to copy.

Definition at line 245 of file tcp-socket-base.cc.

Member Function Documentation

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

Get cwnd in segments rather than bytes.

Returns
Congestion window in segments

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

References m_segmentSize.

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 182 of file tcp-socket-base.h.

References m_segmentSize.

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

Get the type ID.

Get the type ID.

Returns
the object TypeId

Definition at line 200 of file tcp-socket-base.cc.

References m_congState, m_cWnd, m_highTxMark, m_nextTxSequence, m_ssThresh, ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

Member Data Documentation

TracedValue<TcpCongState_t> ns3::TcpSocketState::m_congState

State in the Congestion state machine.

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

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

TracedValue<uint32_t> ns3::TcpSocketState::m_cWnd
TracedValue<SequenceNumber32> ns3::TcpSocketState::m_highTxMark

Highest seqno ever sent, regardless of ReTx.

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

Referenced by GetTypeId().

uint32_t ns3::TcpSocketState::m_initialCWnd

Initial cWnd value.

Definition at line 156 of file tcp-socket-base.h.

uint32_t ns3::TcpSocketState::m_initialSsThresh

Initial Slow Start Threshold value.

Definition at line 157 of file tcp-socket-base.h.

SequenceNumber32 ns3::TcpSocketState::m_lastAckedSeq

Last sequence ACKed.

Definition at line 161 of file tcp-socket-base.h.

TracedValue<SequenceNumber32> ns3::TcpSocketState::m_nextTxSequence

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

Definition at line 165 of file tcp-socket-base.h.

Referenced by GetTypeId().

uint32_t ns3::TcpSocketState::m_segmentSize
TracedValue<uint32_t> ns3::TcpSocketState::m_ssThresh

Slow start threshold.

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

Referenced by ns3::TcpVenoTest::DoRun(), GetTypeId(), and ns3::NewReno_IncreaseWindow().

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-base.h.


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