12#include "ns3/object-factory.h"
13#include "ns3/pointer.h"
14#include "ns3/socket.h"
31 std::copy(priomap.begin(), priomap.end() - 1, std::ostream_iterator<uint16_t>(os,
" "));
39 for (
int i = 0; i < 16; i++)
41 if (!(is >> priomap[i]))
44 << i <<
" values provided, 16 required)");
54 TypeId(
"ns3::PrioQueueDisc")
56 .SetGroupName(
"TrafficControl")
58 .AddAttribute(
"Priomap",
59 "The priority to band mapping.",
60 PriomapValue(
Priomap{{1, 2, 2, 2, 1, 2, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1}}),
82 NS_ASSERT_MSG(prio < 16,
"Priority must be a value between 0 and 15");
92 NS_ASSERT_MSG(prio < 16,
"Priority must be a value between 0 and 15");
108 NS_LOG_DEBUG(
"No filter has been able to classify this packet, using priomap.");
111 if (item->GetPacket()->PeekPacketTag(priorityTag))
188 NS_LOG_ERROR(
"PrioQueueDisc cannot have internal queues");
197 for (uint8_t i = 0; i < 2; i++)
Instantiate subclasses of ns3::Object.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
static const int PF_NO_MATCH
Standard value used by packet filters to indicate that no match was possible.
The Prio qdisc is a simple classful queueing discipline that contains an arbitrary number of classes ...
void SetBandForPriority(uint8_t prio, uint16_t band)
Set the band (class) assigned to packets with specified priority.
~PrioQueueDisc() override
Ptr< const QueueDiscItem > DoPeek() override
Return a copy of the next packet the queue disc will extract.
Ptr< QueueDiscItem > DoDequeue() override
This function actually extracts a packet from the queue disc.
uint16_t GetBandForPriority(uint8_t prio) const
Get the band (class) assigned to packets with specified priority.
bool CheckConfig() override
Check whether the current configuration is correct.
PrioQueueDisc()
PrioQueueDisc constructor.
Priomap m_prio2band
Priority to band mapping.
bool DoEnqueue(Ptr< QueueDiscItem > item) override
This function actually enqueues a packet into the queue disc.
static TypeId GetTypeId()
Get the type ID.
void InitializeParams() override
Initialize parameters (if any) before the first packet is enqueued.
Smart pointer class similar to boost::intrusive_ptr.
QueueDisc is an abstract base class providing the interface and implementing the operations common to...
void AddQueueDiscClass(Ptr< QueueDiscClass > qdClass)
Add a queue disc class to the tail of the list of classes.
uint32_t GetNPackets() const
Get the number of packets stored by the queue disc.
int32_t Classify(Ptr< QueueDiscItem > item)
Classify a packet by calling the packet filters, one at a time, until either a filter able to classif...
std::size_t GetNQueueDiscClasses() const
Get the number of queue disc classes.
Ptr< QueueDiscClass > GetQueueDiscClass(std::size_t i) const
Get the i-th queue disc class.
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.
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_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define ATTRIBUTE_HELPER_CPP(type)
Define the attribute value, accessor and checkers for class type
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#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_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#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 ",...
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
QueueDiscSizePolicy
Enumeration of the available policies to handle the queue disc size.
@ NO_LIMITS
Used by queue discs with unlimited size.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
std::istream & operator>>(std::istream &is, Angles &a)
Ptr< const AttributeAccessor > MakePriomapAccessor(T1 a1)
std::array< uint16_t, 16 > Priomap
Priority map.
Ptr< const AttributeChecker > MakePriomapChecker()