|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
22 #include "ns3/pointer.h"
23 #include "ns3/object-factory.h"
24 #include "ns3/socket.h"
40 std::copy (priomap.begin (), priomap.end ()-1, std::ostream_iterator<uint16_t>(os,
" "));
41 os << priomap.back ();
47 for (
int i = 0; i < 16; i++)
49 if (!(is >> priomap[i]))
51 NS_FATAL_ERROR (
"Incomplete priomap specification (" << i <<
" values provided, 16 required)");
61 .SetGroupName (
"TrafficControl")
63 .AddAttribute (
"Priomap",
"The priority to band mapping.",
64 PriomapValue (
Priomap{{1, 2, 2, 2, 1, 2, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1}}),
87 NS_ASSERT_MSG (prio < 16,
"Priority must be a value between 0 and 15");
97 NS_ASSERT_MSG (prio < 16,
"Priority must be a value between 0 and 15");
113 NS_LOG_DEBUG (
"No filter has been able to classify this packet, using priomap.");
116 if (item->GetPacket ()->PeekPacketTag (priorityTag))
153 NS_LOG_LOGIC (
"Popped from band " << i <<
": " << item);
174 NS_LOG_LOGIC (
"Peeked from band " << i <<
": " << item);
190 NS_LOG_ERROR (
"PrioQueueDisc cannot have internal queues");
198 factory.
SetTypeId (
"ns3::FifoQueueDisc");
199 for (uint8_t i = 0; i < 2; i++)
204 c->SetQueueDisc (qd);
211 NS_LOG_ERROR (
"PrioQueueDisc needs at least 2 classes");
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.
PrioQueueDisc()
PrioQueueDisc constructor.
uint16_t GetBandForPriority(uint8_t prio) const
Get the band (class) assigned to packets with specified priority.
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...
Ptr< QueueDiscClass > GetQueueDiscClass(std::size_t i) const
Get the i-th queue disc class.
@ NO_LIMITS
Used by queue discs with unlimited size.
The Prio qdisc is a simple classful queueing discipline that contains an arbitrary number of classes ...
virtual void InitializeParams(void)
Initialize parameters (if any) before the first packet is enqueued.
virtual bool CheckConfig(void)
Check whether the current configuration is correct.
void AddQueueDiscClass(Ptr< QueueDiscClass > qdClass)
Add a queue disc class to the tail of the list of classes.
Priomap m_prio2band
Priority to band mapping.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< const QueueDiscItem > Peek(void)
Get a copy of the next packet the queue discipline will extract.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
virtual bool DoEnqueue(Ptr< QueueDiscItem > item)
This function actually enqueues a packet into the queue disc.
void SetBandForPriority(uint8_t prio, uint16_t band)
Set the band (class) assigned to packets with specified priority.
uint8_t GetPriority(void) const
Get the tag's priority.
#define ATTRIBUTE_HELPER_CPP(type)
Define the attribute value, accessor and checkers for class type
Instantiate subclasses of ns3::Object.
std::size_t GetNInternalQueues(void) const
Get the number of internal queues.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
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< QueueDiscItem > Dequeue(void)
Extract from the queue disc the packet that has been dequeued by calling Peek, if any,...
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
uint32_t GetNPackets(void) const
Get the number of packets stored by the queue disc.
indicates whether the socket has a priority set.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
static const int PF_NO_MATCH
Standard value used by packet filters to indicate that no match was possible.
Ptr< const AttributeChecker > MakePriomapChecker(void)
Ptr< const AttributeAccessor > MakePriomapAccessor(T1 a1)
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
virtual Ptr< QueueDiscItem > DoDequeue(void)
This function actually extracts a packet from the queue disc.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
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...
virtual Ptr< const QueueDiscItem > DoPeek(void)
Return a copy of the next packet the queue disc will extract.
std::size_t GetNQueueDiscClasses(void) const
Get the number of queue disc classes.
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
std::ostream & operator<<(std::ostream &os, const Angles &a)
std::array< uint16_t, 16 > Priomap
std::istream & operator>>(std::istream &is, Angles &a)