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 (
"Mode",
50 "Determines unit for QueueLimit",
55 .AddAttribute (
"MeanPktSize",
56 "Average of packet size",
59 MakeUintegerChecker<uint32_t> ())
64 MakeDoubleChecker<double> ())
69 MakeDoubleChecker<double> ())
70 .AddAttribute (
"Tupdate",
71 "Time period to calculate drop probability",
75 .AddAttribute (
"Supdate",
76 "Start time of the update timer",
80 .AddAttribute (
"QueueLimit",
81 "Queue limit in bytes/packets",
84 MakeUintegerChecker<uint32_t> ())
85 .AddAttribute (
"DequeueThreshold",
86 "Minimum queue size in bytes before dequeue rate is measured",
89 MakeUintegerChecker<uint32_t> ())
90 .AddAttribute (
"QueueDelayReference",
91 "Desired queue delay",
95 .AddAttribute (
"MaxBurstAllowance",
96 "Current max burst allowance in seconds before random drop",
109 m_uv = CreateObject<UniformRandomVariable> ();
261 bool earlyDrop =
true;
294 bool missingInitFlag =
false;
302 missingInitFlag =
true;
412 uint32_t pktSize = item->GetPacketSize ();
494 NS_LOG_ERROR (
"PieQueueDisc cannot have packet filters");
521 NS_LOG_ERROR (
"The mode of the provided queue does not match the mode set on the PieQueueDisc");
528 NS_LOG_ERROR (
"The size of the internal queue is less than the queue disc limit");
Stats GetStats()
Get PIE statistics after running.
uint32_t m_dqCount
Number of bytes departed since current measurement cycle starts.
Simulation virtual time values and global simulation resolution.
Time m_tUpdate
Time period after which CalculateP () is called.
uint32_t GetNQueueDiscClasses(void) const
Get the number of queue disc classes.
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 "...
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
uint32_t unforcedDrop
Early probability drops: proactive.
double m_avgDqRate
Time averaged dequeue rate.
Queue::QueueMode m_mode
Mode (bytes or packets)
Time m_maxBurst
Maximum burst allowed before random early dropping kicks in.
virtual Ptr< const QueueDiscItem > DoPeek(void) const
This function returns a copy of the next packet the queue disc will extract.
Ptr< Queue > GetInternalQueue(uint32_t i) const
Get the i-th internal queue.
double m_a
Parameter to pie controller.
uint32_t GetNBytes(void) const
Get the amount of bytes stored by the queue disc.
Use number of bytes for maximum queue size.
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
virtual void InitializeParams(void)
Initialize the queue parameters.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint32_t m_burstReset
Used to reset value of burst allowance.
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
QueueDisc is an abstract base class providing the interface and implementing the operations common to...
Implements PIE Active Queue Management discipline.
Time m_qDelayRef
Desired queue delay.
double m_dropProb
Variable used in calculation of drop probability.
uint32_t m_meanPktSize
Average packet size in bytes.
Queue::QueueMode GetMode(void)
Get the encapsulation mode of this queue.
void SetQueueLimit(uint32_t lim)
Set the limit of the queue in bytes or packets.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
QueueMode
Enumeration of the modes supported in the class.
uint32_t GetNInternalQueues(void) const
Get the number of internal queues.
Time GetQueueDelay(void)
Get queue delay.
void Drop(Ptr< QueueItem > item)
Drop a packet.
Hold variables of type enum.
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
virtual bool CheckConfig(void)
Check whether the current configuration is correct.
uint32_t forcedDrop
Drops due to queue limit: reactive.
AttributeValue implementation for Time.
Hold an unsigned integer type.
void AddInternalQueue(Ptr< Queue > queue)
Add an internal queue to the tail of the list of queues.
Time m_sUpdate
Start time of the update timer.
uint32_t m_dqThreshold
Minimum queue size in bytes before dequeue rate is measured.
#define BURST_RESET_TIMEOUT
virtual void DoDispose(void)
Dispose of the object.
Time m_qDelayOld
Old value of queue delay.
uint32_t GetNPacketFilters(void) const
Get the number of packet filters.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
double m_dqStart
Start timestamp of current measurement cycle.
bool DropEarly(Ptr< QueueDiscItem > item, uint32_t qSize)
Check if a packet needs to be dropped due to probability drop.
void SetMode(Queue::QueueMode mode)
Set the operating mode of this queue.
virtual void DoDispose(void)
Dispose of the object.
void CalculateP()
Periodically update the drop probability based on the delay samples: not only the current delay sampl...
static void Remove(const EventId &id)
Remove an event from the event list.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Stats m_stats
PIE statistics.
uint32_t GetQueueSize(void)
Get the current value of the queue in bytes or packets.
EventId m_rtrsEvent
Event used to decide the decision of interval of drop probability calculation.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
static Time Now(void)
Return the current simulation virtual time.
Ptr< UniformRandomVariable > m_uv
Rng stream.
PieQueueDisc()
PieQueueDisc Constructor.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
virtual Ptr< QueueDiscItem > DoDequeue(void)
This function actually extracts a packet from the queue disc.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Ptr< const AttributeChecker > MakeEnumChecker(int v1, std::string n1, int v2, std::string n2, int v3, std::string n3, int v4, std::string n4, int v5, std::string n5, int v6, std::string n6, int v7, std::string n7, int v8, std::string n8, int v9, std::string n9, int v10, std::string n10, int v11, std::string n11, int v12, std::string n12, int v13, std::string n13, int v14, std::string n14, int v15, std::string n15, int v16, std::string n16, int v17, std::string n17, int v18, std::string n18, int v19, std::string n19, int v20, std::string n20, int v21, std::string n21, int v22, std::string n22)
Make an EnumChecker pre-configured with a set of allowed values by name.
Time m_qDelay
Current value of queue delay.
static TypeId GetTypeId(void)
Get the type ID.
BurstStateT m_burstState
Used to determine the current state of burst.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time m_burstAllowance
Current max burst value in seconds that is allowed before random drops kick in.
virtual ~PieQueueDisc()
PieQueueDisc Destructor.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
static const uint32_t packetSize
virtual bool DoEnqueue(Ptr< QueueDiscItem > item)
This function actually enqueues a packet into the queue disc.
Use number of packets for maximum queue size.
uint32_t m_queueLimit
Queue limit in bytes / packets.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
double m_b
Parameter to pie controller.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
uint32_t GetNPackets(void) const
Get the number of packets stored by the queue disc.
bool m_inMeasurement
Indicates whether we are in a measurement cycle.