36 #include "ns3/simulator.h"
51 .SetGroupName (
"Internet")
53 .AddAttribute(
"FilterType",
"Use this to choose no filter or Tustin's approximation filter",
56 .AddAttribute(
"ProtocolType",
"Use this to let the code run as Westwood or WestwoodPlus",
60 .AddTraceSource(
"EstimatedBW",
"The estimated bandwidth",
62 "ns3::TracedValueCallback::DataRate")
81 m_currentBW (sock.m_currentBW),
82 m_lastSampleBW (sock.m_lastSampleBW),
83 m_lastBW (sock.m_lastBW),
84 m_pType (sock.m_pType),
85 m_fType (sock.m_fType),
86 m_IsCount (sock.m_IsCount)
138 "This violates a model assumption and would lead to divide-by-zero; please report to ns-3 maintainers if this occurs.");
155 constexpr
double alpha = 0.9;
170 [[maybe_unused]] uint32_t bytesInFlight)
172 uint32_t ssThresh =
static_cast<uint32_t
> ((
m_currentBW * tcb->m_minRtt) / 8.0);
175 " minRtt: " << tcb->m_minRtt <<
176 " ssThresh: " << ssThresh);
178 return std::max (2 * tcb->m_segmentSize, ssThresh);
184 return CreateObject<TcpWestwood> (*
this);
Class for representing data rates.
Hold variables of type enum.
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static Time Now(void)
Return the current simulation virtual time.
The NewReno implementation.
uint32_t m_segmentSize
Segment size.
An implementation of TCP Westwood and Westwood+.
TracedValue< DataRate > m_currentBW
Current value of the estimated BW.
enum ProtocolType m_pType
0 for Westwood, 1 for Westwood+
enum FilterType m_fType
0 for none, 1 for Tustin
bool m_IsCount
Start keeping track of m_ackedSegments for Westwood+ if TRUE.
DataRate m_lastSampleBW
Last bandwidth sample.
void EstimateBW(const Time &rtt, Ptr< TcpSocketState > tcb)
Estimate the network's bandwidth.
virtual void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t packetsAcked, const Time &rtt)
Timing information on received ACK.
DataRate m_lastBW
Last bandwidth sample after being filtered.
virtual ~TcpWestwood(void)
Time m_lastAck
The last ACK time.
uint32_t m_ackedSegments
The number of segments ACKed between RTTs.
virtual uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight)
Get the slow start threshold after a loss event.
virtual Ptr< TcpCongestionOps > Fork()
Copy the congestion control algorithm across sockets.
EventId m_bwEstimateEvent
The BW estimation event for Westwood+.
static TypeId GetTypeId(void)
Get the type ID.
Simulation virtual time values and global simulation resolution.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
bool IsZero(void) const
Exactly equivalent to t == 0.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#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(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
void(* DataRate)(DataRate oldValue, DataRate newValue)
TracedValue callback signature for DataRate.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeEnumChecker(int v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
float alpha
Plot alpha value (transparency)