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");
Ptr< const QueueDiscItem > Peek(void)
Get a copy of the next packet the queue discipline will extract.
std::istream & operator>>(std::istream &is, Angles &a)
initialize a struct Angles from input
static TypeId GetTypeId(void)
Get the type ID.
virtual bool DoEnqueue(Ptr< QueueDiscItem > item)
This function actually enqueues a packet into the queue disc.
uint32_t GetNPackets(void) const
Get the number of packets stored by the queue disc.
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 AddQueueDiscClass(Ptr< QueueDiscClass > qdClass)
Add a queue disc class to the tail of the list of classes.
std::array< uint16_t, 16 > Priomap
static const int PF_NO_MATCH
Standard value used by packet filters to indicate that no match was possible.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
#define ATTRIBUTE_HELPER_CPP(type)
Define the attribute value, accessor and checkers for class type.
uint8_t GetPriority(void) const
Get the tag's priority.
Used by queue discs with unlimited size.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
QueueDisc is an abstract base class providing the interface and implementing the operations common to...
virtual Ptr< const QueueDiscItem > DoPeek(void)
Return a copy of the next packet the queue disc will extract.
Ptr< const AttributeChecker > MakePriomapChecker(void)
PrioQueueDisc()
PrioQueueDisc constructor.
void SetBandForPriority(uint8_t prio, uint16_t band)
Set the band (class) assigned to packets with specified priority.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
indicates whether the socket has a priority set.
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...
Ptr< QueueDiscClass > GetQueueDiscClass(std::size_t i) const
Get the i-th queue disc class.
Ptr< QueueDiscItem > Dequeue(void)
Extract from the queue disc the packet that has been dequeued by calling Peek, if any...
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::size_t GetNQueueDiscClasses(void) const
Get the number of queue disc classes.
virtual bool CheckConfig(void)
Check whether the current configuration is correct.
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
virtual void InitializeParams(void)
Initialize parameters (if any) before the first packet is enqueued.
QueueDiscSizePolicy
Enumeration of the available policies to handle the queue disc size.
Instantiate subclasses of ns3::Object.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
uint16_t GetBandForPriority(uint8_t prio) const
Get the band (class) assigned to packets with specified priority.
Priomap m_prio2band
Priority to band mapping.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Ptr< const AttributeAccessor > MakePriomapAccessor(T1 a1)
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
The Prio qdisc is a simple classful queueing discipline that contains an arbitrary number of classes ...
virtual Ptr< QueueDiscItem > DoDequeue(void)
This function actually extracts a packet from the queue disc.
std::size_t GetNInternalQueues(void) const
Get the number of internal queues.