16#include "ns3/simulator.h"
30 .AddConstructor<TcpLedbat>()
31 .SetGroupName(
"Internet")
32 .AddAttribute(
"TargetDelay",
33 "Targeted Queue Delay",
37 .AddAttribute(
"BaseHistoryLen",
38 "Number of Base delay samples",
42 .AddAttribute(
"NoiseFilterLen",
43 "Number of Current delay samples",
52 .AddAttribute(
"SSParam",
53 "Possibility of Slow Start",
57 .AddAttribute(
"MinCwnd",
58 "Minimum cWnd for Ledbat",
62 .AddAttribute(
"AllowedIncrease",
171 if (tcb->m_cWnd.Get() <= tcb->m_segmentSize)
204 if (currentDelay > baseDelay)
206 queueDelay = currentDelay - baseDelay;
207 offset =
m_target.GetMilliSeconds() - queueDelay;
211 queueDelay = baseDelay - currentDelay;
212 offset =
m_target.GetMilliSeconds() + queueDelay;
215 m_sndCwndCnt = offset * segmentsAcked * tcb->m_segmentSize;
217 cwnd += (inc * tcb->m_segmentSize);
223 tcb->m_bytesInFlight.Get() + (segmentsAcked * tcb->m_segmentSize);
225 cwnd = std::min(cwnd, maxCwnd);
226 cwnd = std::max(cwnd,
m_minCwnd * tcb->m_segmentSize);
229 if (tcb->m_cWnd <= tcb->m_ssThresh)
231 tcb->m_ssThresh = tcb->m_cWnd - 1;
251 if (cb.
buffer.size() >= maxlen)
255 auto bufferStart = cb.
buffer.begin();
256 cb.
min = std::distance(bufferStart, std::min_element(bufferStart, cb.
buffer.end()));
295 if (tcb->m_rcvTimestampValue == 0 || tcb->m_rcvTimestampEchoReply == 0)
303 if (rtt.
IsPositive() && tcb->m_rcvTimestampValue >= tcb->m_rcvTimestampEchoReply)
305 uint32_t owd = tcb->m_rcvTimestampValue - tcb->m_rcvTimestampEchoReply;
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Hold variables of type enum.
Smart pointer class similar to boost::intrusive_ptr.
static Time Now()
Return the current simulation virtual time.
An implementation of LEDBAT.
static TypeId GetTypeId()
Get the type ID.
SlowStartType m_doSs
Permissible Slow Start State.
std::string GetName() const override
Get the name of the TCP flavour.
void UpdateBaseDelay(uint32_t owd)
Update the base delay buffer.
uint32_t m_minCwnd
Minimum cWnd value mentioned in RFC 6817.
void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override
Adjust cwnd following LEDBAT algorithm.
uint32_t m_flag
LEDBAT Flag.
double m_allowedIncrease
ALLOWED INCREASE value mentioned in RFC 6817.
uint32_t BaseDelay()
Return the value of base delay.
void SetDoSs(SlowStartType doSS)
Change the Slow Start Capability.
double m_gain
GAIN value from RFC.
@ LEDBAT_CAN_SS
If LEDBAT allows Slow Start.
@ LEDBAT_VALID_OWD
If valid timestamps are present.
Ptr< TcpCongestionOps > Fork() override
Copy the congestion control algorithm across sockets.
double m_sndCwndCnt
The congestion window addition parameter.
void AddDelay(OwdCircBuf &cb, uint32_t owd, uint32_t maxlen)
Add new delay to the buffers.
OwdCircBuf m_noiseFilter
Buffer to store the current delay.
SlowStartType
The slowstart types.
@ DO_NOT_SLOWSTART
Do not Slow Start.
@ DO_SLOWSTART
Do NewReno Slow Start.
void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt) override
Get information from the acked packet.
TcpLedbat()
Create an unbound tcp socket.
~TcpLedbat() override
Destructor.
void CongestionAvoidance(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override
Reduce Congestion.
void InitCircBuf(OwdCircBuf &buffer)
Initialise a new buffer.
static uint32_t MinCircBuf(OwdCircBuf &b)
Return the minimum delay of the buffer.
Time m_target
Target Queue Delay.
Time m_lastRollover
Timestamp of last added delay.
uint32_t m_baseHistoLen
Length of base delay history buffer.
uint32_t m_noiseFilterLen
Length of current delay buffer.
uint32_t(* FilterFunction)(OwdCircBuf &)
Filter function used by LEDBAT for current delay.
OwdCircBuf m_baseHistory
Buffer to store the base delay.
uint32_t CurrentDelay(FilterFunction filter)
Return the value of current delay.
virtual uint32_t SlowStart(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Tcp NewReno slow start algorithm.
virtual void CongestionAvoidance(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
NewReno congestion avoidance.
Simulation virtual time values and global simulation resolution.
bool IsPositive() const
Exactly equivalent to t >= 0.
AttributeValue implementation for Time.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
Ptr< const AttributeChecker > MakeDoubleChecker()
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Ptr< const AttributeChecker > MakeUintegerChecker()
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#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.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
Ptr< T > CopyObject(Ptr< const T > object)
Buffer structure to store delays.
size_t min
The index of minimum value.
std::vector< uint32_t > buffer
Vector to store the delay.