25 #include "ns3/object-factory.h"
26 #include "ns3/queue.h"
27 #include "ns3/socket.h"
40 TypeId(
"ns3::PfifoFastQueueDisc")
42 .SetGroupName(
"TrafficControl")
44 .AddAttribute(
"MaxSize",
45 "The maximum number of packets accepted by this queue disc.",
48 MakeQueueSizeChecker());
63 const uint32_t
PfifoFastQueueDisc::prio2band[16] = {1, 2, 2, 2, 1, 2, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1};
72 NS_LOG_LOGIC(
"Queue disc limit exceeded -- dropping packet");
79 if (item->GetPacket()->PeekPacketTag(priorityTag))
84 uint32_t band =
prio2band[priority & 0x0f];
93 NS_LOG_WARN(
"Packet enqueue failed. Check the size of the internal queues");
155 NS_LOG_ERROR(
"PfifoFastQueueDisc needs no packet filter");
163 factory.
SetTypeId(
"ns3::DropTailQueue<QueueDiscItem>");
172 NS_LOG_ERROR(
"PfifoFastQueueDisc needs 3 internal queues");
180 NS_LOG_ERROR(
"PfifoFastQueueDisc needs 3 internal queues operating in packet mode");
184 for (uint8_t i = 0; i < 2; i++)
189 "The capacity of some internal queue(s) is less than the queue disc capacity");
Instantiate subclasses of ns3::Object.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Linux pfifo_fast is the default priority queue enabled on Linux systems.
bool DoEnqueue(Ptr< QueueDiscItem > item) override
This function actually enqueues a packet into the queue disc.
Ptr< const QueueDiscItem > DoPeek() override
Return a copy of the next packet the queue disc will extract.
static TypeId GetTypeId()
Get the type ID.
bool CheckConfig() override
Check whether the current configuration is correct.
Ptr< QueueDiscItem > DoDequeue() override
This function actually extracts a packet from the queue disc.
static constexpr const char * LIMIT_EXCEEDED_DROP
Packet dropped due to queue disc limit exceeded.
void InitializeParams() override
Initialize parameters (if any) before the first packet is enqueued.
static const uint32_t prio2band[16]
Priority to band map.
~PfifoFastQueueDisc() override
PfifoFastQueueDisc()
PfifoFastQueueDisc constructor.
Smart pointer class similar to boost::intrusive_ptr.
QueueDisc is an abstract base class providing the interface and implementing the operations common to...
void AddInternalQueue(Ptr< InternalQueue > queue)
Add an internal queue to the tail of the list of queues.
uint32_t GetNPackets() const
Get the number of packets stored by the queue disc.
Ptr< InternalQueue > GetInternalQueue(std::size_t i) const
Get the i-th internal queue.
QueueSize GetCurrentSize() const
Get the current size of the queue disc in bytes, if operating in bytes mode, or packets,...
std::size_t GetNQueueDiscClasses() const
Get the number of queue disc classes.
QueueSize GetMaxSize() const
Get the maximum size of the queue disc.
std::size_t GetNPacketFilters() const
Get the number of packet filters.
bool SetMaxSize(QueueSize size)
Set the maximum size of the queue disc.
std::size_t GetNInternalQueues() const
Get the number of internal queues.
Ptr< QueueDiscItem > Dequeue()
Extract from the queue disc the packet that has been dequeued by calling Peek, if any,...
Ptr< const QueueDiscItem > Peek()
Get a copy of the next packet the queue discipline will extract.
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.
Template class for packet Queues.
Class for representing queue sizes.
indicates whether the socket has a priority set.
uint8_t GetPriority() const
Get the tag's priority.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
#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.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
QueueSizeUnit
Enumeration of the operating modes of queues.
@ PACKETS
Use number of packets for queue size.
QueueDiscSizePolicy
Enumeration of the available policies to handle the queue disc size.
@ MULTIPLE_QUEUES
Used by queue discs with multiple internal queues/child queue discs.
Every class exported by the ns3 library is enclosed in the ns3 namespace.