|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
30 #include "ns3/uinteger.h"
31 #include "ns3/double.h"
32 #include "ns3/simulator.h"
33 #include "ns3/abort.h"
35 #include "ns3/drop-tail-queue.h"
47 .SetGroupName (
"TrafficControl")
49 .AddAttribute (
"MeanPktSize",
50 "Average of packet size",
53 MakeUintegerChecker<uint32_t> ())
58 MakeDoubleChecker<double> ())
63 MakeDoubleChecker<double> ())
64 .AddAttribute (
"Tupdate",
65 "Time period to calculate drop probability",
69 .AddAttribute (
"Supdate",
70 "Start time of the update timer",
74 .AddAttribute (
"MaxSize",
75 "The maximum number of packets accepted by this queue disc",
80 .AddAttribute (
"DequeueThreshold",
81 "Minimum queue size in bytes before dequeue rate is measured",
84 MakeUintegerChecker<uint32_t> ())
85 .AddAttribute (
"QueueDelayReference",
86 "Desired queue delay",
90 .AddAttribute (
"MaxBurstAllowance",
91 "Current max burst allowance before random drop",
95 .AddAttribute (
"UseDequeueRateEstimator",
96 "Enable/Disable usage of Dequeue Rate Estimator",
100 .AddAttribute (
"UseCapDropAdjustment",
101 "Enable/Disable Cap Drop Adjustment feature mentioned in RFC 8033",
105 .AddAttribute (
"UseEcn",
106 "True to use ECN (packets are marked instead of being dropped)",
110 .AddAttribute (
"MarkEcnThreshold",
111 "ECN marking threshold (RFC 8033 suggests 0.1 (i.e., 10%) default)",
114 MakeDoubleChecker<double> (0,1))
115 .AddAttribute (
"UseDerandomization",
116 "Enable/Disable Derandomization feature mentioned in RFC 8033",
120 .AddAttribute (
"ActiveThreshold",
121 "Threshold for activating PIE (disabled by default)",
125 .AddAttribute (
"CeThreshold",
126 "The FqPie CE threshold for marking packets",
130 .AddAttribute (
"UseL4s",
131 "True to use L4S (only ECT1 packets are marked at CE threshold)",
144 m_uv = CreateObject<UniformRandomVariable> ();
187 if (item->GetUint8Value (
QueueItem::IP_DSFIELD, tosByte) && (((tosByte & 0x3) == 1) || (tosByte & 0x3) == 3))
189 if ((tosByte & 0x3) == 1)
191 NS_LOG_DEBUG (
"Enqueueing ECT1 packet " <<
static_cast<uint16_t
> (tosByte & 0x3));
195 NS_LOG_DEBUG (
"Enqueueing CE packet " <<
static_cast<uint16_t
> (tosByte & 0x3));
339 bool missingInitFlag =
false;
350 missingInitFlag =
true;
482 NS_ASSERT_MSG (item !=
nullptr,
"Dequeue null, but internal queue not empty");
490 if (item->GetUint8Value (
QueueItem::IP_DSFIELD, tosByte) && (((tosByte & 0x3) == 1) || (tosByte & 0x3) == 3))
492 if ((tosByte & 0x3) == 1)
494 NS_LOG_DEBUG (
"ECT1 packet " <<
static_cast<uint16_t
> (tosByte & 0x3));
498 NS_LOG_DEBUG (
"CE packet " <<
static_cast<uint16_t
> (tosByte & 0x3));
579 NS_LOG_ERROR (
"PieQueueDisc cannot have packet filters");
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
QueueDiscSizePolicy
Enumeration of the available policies to handle the queue disc size.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
bool DropEarly(Ptr< QueueDiscItem > item, uint32_t qSize)
Check if a packet needs to be dropped due to probability drop.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
AttributeValue implementation for Boolean.
static constexpr const char * CE_THRESHOLD_EXCEEDED_MARK
Early probability marks: proactive.
bool SetMaxSize(QueueSize size)
Set the maximum size of the queue disc.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
QueueDisc is an abstract base class providing the interface and implementing the operations common to...
QueueSize GetMaxSize(void) const
Get the maximum size of the queue disc.
virtual bool DoEnqueue(Ptr< QueueDiscItem > item)
This function actually enqueues a packet into the queue disc.
bool m_useDerandomization
Enable Derandomization feature mentioned in RFC 8033.
Ptr< const AttributeChecker > MakeQueueSizeChecker(void)
PieQueueDisc()
PieQueueDisc Constructor.
Implements PIE Active Queue Management discipline.
bool m_useDqRateEstimator
Enable/Disable usage of dequeue rate estimator for queue delay calculation.
bool m_useL4s
True if L4S is used (ECT1 packets are marked at CE threshold)
uint32_t GetNBytes(void) const
Get the amount of bytes stored by the queue disc.
@ PACKETS
Use number of packets for queue size.
bool m_isCapDropAdjustment
Enable/Disable Cap Drop Adjustment feature mentioned in RFC 8033.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
BurstStateT m_burstState
Used to determine the current state of burst.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
std::size_t GetNPacketFilters(void) const
Get the number of packet filters.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
bool Mark(Ptr< QueueDiscItem > item, const char *reason)
Marks the given packet and, if successful, updates the counters associated with the given reason.
void CalculateP()
Periodically update the drop probability based on the delay samples: not only the current delay sampl...
Smart pointer class similar to boost::intrusive_ptr.
virtual void DoDispose(void)
Dispose of the object.
virtual void DoDispose(void)
Dispose of the object.
virtual ~PieQueueDisc()
PieQueueDisc Destructor.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Time m_activeThreshold
Threshold for activating PIE (disabled by default)
virtual Ptr< QueueDiscItem > DoDequeue(void)
This function actually extracts a packet from the queue disc.
Time m_qDelayRef
Desired queue delay.
Time m_sUpdate
Start time of the update timer.
Time m_dqStart
Start timestamp of current measurement cycle.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
static Time Max()
Maximum representable Time Not to be confused with Max(Time,Time).
@ SINGLE_INTERNAL_QUEUE
Used by queue discs with single internal queue.
bool m_active
Indicates whether PIE is in active state or not.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
bool m_useEcn
Enable ECN Marking functionality.
double m_dropProb
Variable used in calculation of drop probability.
Simulation virtual time values and global simulation resolution.
void AddInternalQueue(Ptr< InternalQueue > queue)
Add an internal queue to the tail of the list of queues.
std::size_t GetNInternalQueues(void) const
Get the number of internal queues.
QueueSize GetCurrentSize(void)
Get the current size of the queue disc in bytes, if operating in bytes mode, or packets,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Introspection did not find any typical Config paths.
double m_b
Parameter to pie controller.
double m_accuProb
Accumulated drop probability.
Ptr< T > CreateObjectWithAttributes(Args... args)
Allocate an Object on the heap and initialize with a set of attributes.
static TypeId GetTypeId(void)
Get the type ID.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
bool m_inMeasurement
Indicates whether we are in a measurement cycle.
int64_t GetMilliSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
uint32_t GetNPackets(void) const
Get the number of packets stored by the queue disc.
Ptr< UniformRandomVariable > m_uv
Rng stream.
Time m_qDelayOld
Old value of queue delay.
uint32_t m_burstReset
Used to reset value of burst allowance.
static constexpr const char * UNFORCED_DROP
Early probability drops: proactive.
static constexpr const char * FORCED_DROP
Drops due to queue limit: reactive.
double m_avgDqRate
Time averaged dequeue rate.
Time GetQueueDelay(void)
Get queue delay.
uint32_t m_meanPktSize
Average packet size in bytes.
uint64_t m_dqCount
Number of bytes departed since current measurement cycle starts.
static const uint32_t packetSize
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
virtual void InitializeParams(void)
Initialize the queue parameters.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time m_ceThreshold
Threshold above which to CE mark.
#define BURST_RESET_TIMEOUT
@ BYTES
Use number of bytes for queue size.
AttributeValue implementation for Time.
double m_a
Parameter to pie controller.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< const AttributeAccessor > MakeQueueSizeAccessor(T1 a1)
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
Hold an unsigned integer type.
uint32_t GetValue() const
Get the underlying value.
Time m_burstAllowance
Current max burst value in seconds that is allowed before random drops kick in.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
std::size_t GetNQueueDiscClasses(void) const
Get the number of queue disc classes.
void DropBeforeEnqueue(Ptr< const QueueDiscItem > item, const char *reason)
Perform the actions required when the queue disc is notified of a packet dropped before enqueue.
virtual bool CheckConfig(void)
Check whether the current configuration is correct.
Ptr< InternalQueue > GetInternalQueue(std::size_t i) const
Get the i-th internal queue.
Class for representing queue sizes.
EventId m_rtrsEvent
Event used to decide the decision of interval of drop probability calculation.
uint32_t m_dqThreshold
Minimum queue size in bytes before dequeue rate is measured.
static constexpr const char * UNFORCED_MARK
Early probability marks: proactive.
Time m_qDelay
Current value of queue delay.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
static const uint64_t DQCOUNT_INVALID
Invalid dqCount value.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
double m_markEcnTh
ECN marking threshold (default 10% as suggested in RFC 8033)
Time m_maxBurst
Maximum burst allowed before random early dropping kicks in.
Time m_tUpdate
Time period after which CalculateP () is called.