30 #include "ns3/trace-source-accessor.h"
31 #include "ns3/simulator.h"
32 #include "ns3/abort.h"
35 #include "ns3/tcp-socket-base.h"
36 #include "ns3/sequence-number.h"
37 #include "ns3/double.h"
38 #include "ns3/nstime.h"
50 .AddConstructor<TcpHtcp> ()
51 .SetGroupName (
"Internet")
52 .AddAttribute (
"DefaultBackoff",
53 "The default AIMD backoff factor",
56 MakeDoubleChecker<double> (0,1))
57 .AddAttribute (
"ThroughputRatio",
58 "Threshold value for updating beta",
61 MakeDoubleChecker<double> ())
62 .AddAttribute (
"DeltaL",
63 "Delta_L parameter in increase function",
93 m_alpha (sock.m_alpha),
95 m_defaultBackoff (sock.m_defaultBackoff),
96 m_throughputRatio (sock.m_throughputRatio),
97 m_delta (sock.m_delta),
98 m_deltaL (sock.m_deltaL),
99 m_lastCon (sock.m_lastCon),
100 m_minRtt (sock.m_minRtt),
101 m_maxRtt (sock.m_maxRtt),
102 m_throughput (sock.m_throughput),
103 m_lastThroughput (sock.m_lastThroughput),
104 m_dataSent (sock.m_dataSent)
117 return CopyObject<TcpHtcp> (
this);
121 uint32_t segmentsAcked)
124 if (segmentsAcked > 0)
126 double adder =
static_cast<double> (((tcb->m_segmentSize
127 * tcb->m_segmentSize) + (tcb->m_cWnd *
m_alpha)) / tcb->m_cWnd);
129 tcb->m_cWnd +=
static_cast<uint32_t
> (adder);
130 NS_LOG_INFO (
"In CongAvoid, updated to cwnd " << tcb->m_cWnd
131 <<
" ssthresh " << tcb->m_ssThresh);
150 m_alpha = (1 + 10 * diffSec + 0.25 * (diffSec * diffSec));
182 uint32_t bytesInFlight)
191 uint32_t segWin = 2 * tcb->m_segmentSize;
192 uint32_t bFlight = bytesInFlight *
m_beta;
193 uint32_t ssThresh =
std::max (segWin, bFlight);
199 NS_LOG_DEBUG (
this <<
" ssThresh: " << ssThresh <<
" m_beta: " << m_beta);
211 m_dataSent += segmentsAcked * tcb->m_segmentSize;
Custom version of log2() to deal with Bug 1467.
Time m_delta
Time in second that has elapsed since the.
virtual void CongestionAvoidance(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
NewReno congestion avoidance.
Simulation virtual time values and global simulation resolution.
double m_alpha
AIMD additive increase parameter.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Normal state, no dubious events.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
static Time Min()
Minimum representable Time.
void UpdateAlpha(void)
Updates the additive increase parameter for H-TCP.
virtual void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt)
Timing information on received ACK.
virtual std::string GetName() const
Get the name of the congestion control algorithm.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time m_maxRtt
Maximum RTT in each congestion period.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
The NewReno implementation.
An implementation of the H-TCP variant of TCP.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
static Time Max()
Maximum representable Time.
void UpdateBeta(void)
Updates the multiplicative decrease factor beta for H-TCP.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
int64x64_t Min(const int64x64_t &a, const int64x64_t &b)
Minimum.
AttributeValue implementation for Time.
static TypeId GetTypeId(void)
Get the type ID.
int64x64_t Max(const int64x64_t &a, const int64x64_t &b)
Maximum.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Time m_minRtt
Minimum RTT in each congestion period.
uint32_t m_lastThroughput
Throughput in last congestion period.
uint32_t m_throughput
Current throughput since last congestion.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
double GetDouble(void) const
Get the raw time value, in the current resolution unit.
Time m_deltaL
Threshold for switching between standard and new increase function.
static Time Now(void)
Return the current simulation virtual time.
double m_defaultBackoff
default value when throughput ratio less than default
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
double m_throughputRatio
ratio of two consequence throughput
virtual uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight)
Get the slow start threshold after a loss event.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Time Seconds(double value)
Construct a Time in the indicated unit.
virtual Ptr< TcpCongestionOps > Fork()
Copy the congestion control algorithm across socket.
TcpHtcp(void)
Create an unbound tcp socket.
Time m_lastCon
Time of the last congestion for the flow.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
a unique identifier for an interface.
uint32_t m_dataSent
Current amount of data sent since last congestion.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
double m_beta
AIMD multiplicative decrease factor.