18#include "ns3/simulator.h"
32 .AddConstructor<TcpHtcp>()
33 .SetGroupName(
"Internet")
34 .AddAttribute(
"DefaultBackoff",
35 "The default AIMD backoff factor",
39 .AddAttribute(
"ThroughputRatio",
40 "Threshold value for updating beta",
44 .AddAttribute(
"DeltaL",
45 "Delta_L parameter in increase function",
75 m_alpha(sock.m_alpha),
77 m_defaultBackoff(sock.m_defaultBackoff),
78 m_throughputRatio(sock.m_throughputRatio),
79 m_delta(sock.m_delta),
80 m_deltaL(sock.m_deltaL),
81 m_lastCon(sock.m_lastCon),
82 m_minRtt(sock.m_minRtt),
83 m_maxRtt(sock.m_maxRtt),
84 m_throughput(sock.m_throughput),
85 m_lastThroughput(sock.m_lastThroughput),
86 m_dataSent(sock.m_dataSent)
107 if (segmentsAcked > 0)
109 double adder =
static_cast<double>(
110 ((tcb->m_segmentSize * tcb->m_segmentSize) + (tcb->m_cWnd *
m_alpha)) / tcb->m_cWnd);
111 adder = std::max(1.0, adder);
112 tcb->m_cWnd +=
static_cast<uint32_t>(adder);
113 NS_LOG_INFO(
"In CongAvoid, updated to cwnd " << tcb->m_cWnd <<
" ssthresh "
134 m_alpha = (1 + 10 * diffSec + 0.25 * (diffSec * diffSec));
173 uint32_t segWin = 2 * tcb->m_segmentSize;
175 uint32_t ssThresh = std::max(segWin, bFlight);
192 m_dataSent += segmentsAcked * tcb->m_segmentSize;
This class can be used to hold variables of floating point type such as 'double' or 'float'.
friend Ptr< T > CopyObject(Ptr< T > object)
Copy an Object.
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.
@ CA_OPEN
Normal state, no dubious events.
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.
#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 > MakeDoubleChecker()
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.