|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
24 #include "ns3/abort.h"
25 #include "ns3/tcp-socket-state.h"
37 .AddConstructor<TcpDctcp> ()
38 .SetGroupName (
"Internet")
39 .AddAttribute (
"DctcpShiftG",
40 "Parameter G for updating dctcp_alpha",
43 MakeDoubleChecker<double> (0, 1))
44 .AddAttribute (
"DctcpAlphaOnInit",
45 "Initial alpha value",
48 MakeDoubleChecker<double> (0, 1))
49 .AddAttribute (
"UseEct0",
50 "Use ECT(0) for ECN codepoint, if false use ECT(1)",
54 .AddTraceSource (
"CongestionEstimate",
55 "Update sender-side congestion estimate state",
57 "ns3::TcpDctcp::CongestionEstimateTracedCallback")
70 m_ackedBytesTotal (0),
72 m_priorRcvNxtFlag (false),
74 m_nextSeqFlag (false),
76 m_delayedAckReserved (false),
84 m_ackedBytesEcn (sock.m_ackedBytesEcn),
85 m_ackedBytesTotal (sock.m_ackedBytesTotal),
86 m_priorRcvNxt (sock.m_priorRcvNxt),
87 m_priorRcvNxtFlag (sock.m_priorRcvNxtFlag),
88 m_alpha (sock.m_alpha),
89 m_nextSeq (sock.m_nextSeq),
90 m_nextSeqFlag (sock.m_nextSeqFlag),
91 m_ceState (sock.m_ceState),
92 m_delayedAckReserved (sock.m_delayedAckReserved),
94 m_useEct0 (sock.m_useEct0),
95 m_initialized (sock.m_initialized)
108 return CopyObject<TcpDctcp> (
this);
115 NS_LOG_INFO (
this <<
"Enabling DctcpEcn for DCTCP");
129 return static_cast<uint32_t
> ((1 -
m_alpha / 2.0) * tcb->m_cWnd);
148 double bytesEcn = 0.0;
185 tmpRcvNxt = tcb->
m_rxBuffer->NextRxSequence ();
192 tcb->
m_rxBuffer->SetNextRxSequence (tmpRcvNxt);
212 tmpRcvNxt = tcb->
m_rxBuffer->NextRxSequence ();
219 tcb->
m_rxBuffer->SetNextRxSequence (tmpRcvNxt);
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
virtual void CwndEvent(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCAEvent_t event)
Trigger events/calculations on occurrence of congestion window event.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
AttributeValue implementation for Boolean.
virtual Ptr< TcpCongestionOps > Fork()
Copy the congestion control algorithm across sockets.
@ ECN_ECE_RCVD
Last ACK received had ECE bit set in TCP header
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static TypeId GetTypeId(void)
Get the type ID.
SequenceNumber32 m_nextSeq
TCP sequence number threshold for beginning a new observation window.
bool m_priorRcvNxtFlag
Variable used in setting the value of m_priorRcvNxt for first time.
TracedValue< SequenceNumber32 > m_nextTxSequence
Next seqnum to be sent (SND.NXT), ReTx pushes it back.
uint32_t m_segmentSize
Segment size.
bool m_nextSeqFlag
Variable used in setting the value of m_nextSeq for first time.
SequenceNumber32 m_lastAckedSeq
Last sequence ACKed.
TracedValue< EcnState_t > m_ecnState
Current ECN State, represented as combination of EcnState values.
bool m_initialized
Whether DCTCP has been initialized.
bool m_useEct0
Use ECT(0) for ECN codepoint.
double m_g
Estimation gain.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
bool m_ceState
DCTCP Congestion Experienced state.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
uint32_t m_ackedBytesEcn
Number of acked bytes which are marked.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
EcnCodePoint_t m_ectCodePoint
ECT code point to use.
void InitializeDctcpAlpha(double alpha)
Initialize the value of m_alpha.
Smart pointer class similar to boost::intrusive_ptr.
void UpdateAckReserved(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCAEvent_t event)
Updates the value of m_delayedAckReserved.
virtual ~TcpDctcp(void)
Destructor.
SequenceNumber32 m_priorRcvNxt
Sequence number of the first missing byte in data.
void CeState0to1(Ptr< TcpSocketState > tcb)
Changes state of m_ceState to true.
virtual uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight)
Get the slow start threshold after a loss event.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
double m_alpha
Parameter used to estimate the amount of network congestion.
virtual void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt)
Timing information on received ACK.
@ ECN_IDLE
ECN is enabled but currently there is no action pertaining to ECE or CWR to be taken
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Simulation virtual time values and global simulation resolution.
void Reset(Ptr< TcpSocketState > tcb)
Resets the value of m_ackedBytesEcn, m_ackedBytesTotal and m_nextSeq.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
@ DctcpEcn
ECN functionality as described in RFC 8257.
uint32_t m_ackedBytesTotal
Total number of acked bytes.
Ptr< TcpRxBuffer > m_rxBuffer
Rx buffer (reordering buffer)
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
@ CA_EVENT_ECN_IS_CE
received CE marked IP packet.
TracedCallback< uint32_t, uint32_t, double > m_traceCongestionEstimate
Callback pointer for congestion state update.
TcpDctcp()
Create an unbound tcp socket.
@ CA_EVENT_ECN_NO_CE
ECT set, but not CE marked.
An implementation of DCTCP.
virtual void Init(Ptr< TcpSocketState > tcb)
Set configuration required by congestion control algorithm, This method will force DctcpEcn mode and ...
@ CA_EVENT_NON_DELAYED_ACK
Non-delayed ack is sent.
TcpCAEvent_t
Congestion avoidance events.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Callback< void, uint8_t > m_sendEmptyPacketCallback
Callback to send an empty packet.
UseEcn_t m_useEcn
Socket ECN capability.
bool m_delayedAckReserved
Delayed Ack state.
void CeState1to0(Ptr< TcpSocketState > tcb)
Changes state of m_ceState to false.
@ ECN_CE_RCVD
Last packet received had CE bit set in IP header
@ CA_EVENT_DELAYED_ACK
Delayed ack is sent.
EcnMode_t m_ecnMode
ECN mode.
virtual std::string GetName() const
Get the name of the congestion control algorithm.
@ ECN_SENDING_ECE
Receiver sends an ACK with ECE bit set in TCP header