29 #include "ns3/simulator.h"
43 .AddConstructor<TcpHtcp>()
44 .SetGroupName(
"Internet")
45 .AddAttribute(
"DefaultBackoff",
46 "The default AIMD backoff factor",
49 MakeDoubleChecker<double>(0, 1))
50 .AddAttribute(
"ThroughputRatio",
51 "Threshold value for updating beta",
54 MakeDoubleChecker<double>())
55 .AddAttribute(
"DeltaL",
56 "Delta_L parameter in increase function",
86 m_alpha(sock.m_alpha),
88 m_defaultBackoff(sock.m_defaultBackoff),
89 m_throughputRatio(sock.m_throughputRatio),
90 m_delta(sock.m_delta),
91 m_deltaL(sock.m_deltaL),
92 m_lastCon(sock.m_lastCon),
93 m_minRtt(sock.m_minRtt),
94 m_maxRtt(sock.m_maxRtt),
95 m_throughput(sock.m_throughput),
96 m_lastThroughput(sock.m_lastThroughput),
97 m_dataSent(sock.m_dataSent)
111 return CopyObject<TcpHtcp>(
this);
118 if (segmentsAcked > 0)
120 double adder =
static_cast<double>(
123 tcb->
m_cWnd +=
static_cast<uint32_t
>(adder);
145 m_alpha = (1 + 10 * diffSec + 0.25 * (diffSec * diffSec));
184 uint32_t segWin = 2 * tcb->m_segmentSize;
185 auto bFlight =
static_cast<uint32_t
>(bytesInFlight *
m_beta);
186 uint32_t ssThresh =
std::max(segWin, bFlight);
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Smart pointer class similar to boost::intrusive_ptr.
static Time Now()
Return the current simulation virtual time.
An implementation of the H-TCP variant of TCP.
Time m_minRtt
Minimum RTT in each congestion period.
Time m_lastCon
Time of the last congestion for the flow.
void UpdateBeta()
Updates the multiplicative decrease factor beta for H-TCP.
double m_defaultBackoff
default value when throughput ratio less than default
uint32_t m_dataSent
Current amount of data sent since last congestion.
uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight) override
Get the slow start threshold after a loss event.
double m_throughputRatio
ratio of two consequence throughput
std::string GetName() const override
Get the name of the congestion control algorithm.
Time m_delta
Time in second that has elapsed since the.
void CongestionAvoidance(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override
NewReno congestion avoidance.
uint32_t m_lastThroughput
Throughput in last congestion period.
double m_alpha
AIMD additive increase parameter.
void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt) override
Timing information on received ACK.
double m_beta
AIMD multiplicative decrease factor.
Time m_deltaL
Threshold for switching between standard and new increase function.
Ptr< TcpCongestionOps > Fork() override
Copy the congestion control algorithm across sockets.
TcpHtcp()
Create an unbound tcp socket.
Time m_maxRtt
Maximum RTT in each congestion period.
void UpdateAlpha()
Updates the additive increase parameter for H-TCP.
static TypeId GetTypeId()
Get the type ID.
uint32_t m_throughput
Current throughput since last congestion.
The NewReno implementation.
uint32_t m_segmentSize
Segment size.
TracedValue< TcpCongState_t > m_congState
State in the Congestion state machine.
@ CA_OPEN
Normal state, no dubious events.
TracedValue< uint32_t > m_cWnd
Congestion window.
TracedValue< uint32_t > m_ssThresh
Slow start threshold.
Simulation virtual time values and global simulation resolution.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
static Time Min()
Minimum representable Time Not to be confused with Min(Time,Time).
double GetDouble() const
Get the raw time value, in the current resolution unit.
static Time Max()
Maximum representable Time Not to be confused with Max(Time,Time).
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
int64x64_t Max(const int64x64_t &a, const int64x64_t &b)
Maximum.
int64x64_t Min(const int64x64_t &a, const int64x64_t &b)
Minimum.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)