23 #include "ns3/object.h"
24 #include "ns3/traced-value.h"
25 #include "ns3/net-device.h"
26 #include "ns3/queue-item.h"
36 template <
typename Item>
class Queue;
37 class NetDeviceQueueInterface;
237 void Print (std::ostream &os)
const;
287 virtual void SetQuota (
const uint32_t quota);
293 virtual uint32_t
GetQuota (
void)
const;
uint32_t nTotalDequeuedPackets
Total dequeued packets.
Structure that keeps the queue disc statistics.
TracedValue< Time > m_sojourn
Sojourn time of the latest dequeued packet.
uint32_t nTotalMarkedPackets
Total marked packets.
uint32_t GetNQueueDiscClasses(void) const
Get the number of queue disc classes.
Ptr< QueueDiscItem > m_requeued
The last packet that failed to be transmitted.
std::map< std::string, uint32_t > nDroppedPacketsAfterDequeue
Packets dropped after dequeue, for each reason.
uint32_t nTotalDroppedPackets
Total dropped packets.
void AddQueueDiscClass(Ptr< QueueDiscClass > qdClass)
Add a queue disc class to the tail of the list of classes.
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...
bool Enqueue(Ptr< QueueDiscItem > item)
Pass a packet to store to the queue discipline.
virtual ~QueueDiscClass()
uint32_t GetNBytes(void) const
Get the amount of bytes stored by the queue disc.
uint32_t nTotalRequeuedPackets
Total requeued packets.
bool Mark(Ptr< QueueDiscItem > item, const char *reason)
Marks the given packet and, if successful, updates the counters associated with the given reason...
Ptr< QueueDisc > m_queueDisc
Queue disc attached to this class.
Forward calls to a chain of Callback.
virtual void DoDispose(void)
Dispose of the object.
void SetQueueDisc(Ptr< QueueDisc > qd)
Set the queue disc attached to this class.
ChildQueueDiscDropFunctor m_childQueueDiscDbeFunctor
Function object called when a child queue disc dropped a packet before enqueue.
uint32_t nTotalSentPackets
Total sent packets – this value is not kept up to date, call GetStats first.
virtual Ptr< QueueDiscItem > DoDequeue(void)=0
This function actually extracts a packet from the queue disc.
TracedCallback< Ptr< const QueueDiscItem >, const char * > m_traceMark
Traced callback: fired when a packet is marked.
QueueDisc is an abstract base class providing the interface and implementing the operations common to...
std::function< void(Ptr< const QueueDiscItem >, const char *)> ChildQueueDiscDropFunctor
Type for the function objects notifying that a packet has been dropped by a child queue disc...
WakeMode
Used to determine whether the queue disc itself or its children must be activated when a netdevice wa...
TracedCallback< Ptr< const QueueDiscItem >, const char * > m_traceDropAfterDequeue
Traced callback: fired when a packet is dropped after dequeue.
uint32_t nTotalMarkedBytes
Total marked bytes.
uint32_t nTotalDroppedPacketsBeforeEnqueue
Total packets dropped before enqueue.
Ptr< InternalQueue > GetInternalQueue(uint32_t i) const
Get the i-th internal queue.
uint64_t GetNDroppedBytes(std::string reason) const
Get the amount of bytes dropped for the given reason.
static constexpr const char * CHILD_QUEUE_DISC_DROP
Packet dropped by a child queue disc.
uint32_t GetNInternalQueues(void) const
Get the number of internal queues.
void AddInternalQueue(Ptr< InternalQueue > queue)
Add an internal queue to the tail of the list of queues.
uint64_t nTotalEnqueuedBytes
Total enqueued bytes.
void PacketEnqueued(Ptr< const QueueDiscItem > item)
Perform the actions required when the queue disc is notified of a packet enqueue. ...
std::string m_childQueueDiscDropMsg
Reason why a packet was dropped by a child queue disc.
void DoInitialize(void)
Check whether the configuration is correct and initialize parameters.
Ptr< NetDeviceQueueInterface > m_devQueueIface
NetDevice queue interface.
InternalQueueDropFunctor m_internalQueueDbeFunctor
Function object called when an internal queue dropped a packet before enqueue.
TracedCallback< Ptr< const QueueDiscItem > > m_traceDequeue
Traced callback: fired when a packet is dequeued.
QueueDisc & operator=(const QueueDisc &o)
Assignment operator.
uint64_t nTotalSentBytes
Total sent bytes – this value is not kept up to date, call GetStats first.
void Run(void)
Modelled after the Linux function __qdisc_run (net/sched/sch_generic.c) Dequeues multiple packets...
Ptr< PacketFilter > GetPacketFilter(uint32_t i) const
Get the i-th packet filter.
virtual bool DoEnqueue(Ptr< QueueDiscItem > item)=0
This function actually enqueues a packet into the queue disc.
const Stats & GetStats(void)
Retrieve all the collected statistics.
std::map< std::string, uint64_t > nDroppedBytesAfterDequeue
Bytes dropped after dequeue, for each reason.
bool Transmit(Ptr< QueueDiscItem > item)
Modelled after the Linux function sch_direct_xmit (net/sched/sch_generic.c) Sends a packet to the dev...
Ptr< QueueDisc > GetQueueDisc(void) const
Get the queue disc attached to this class.
uint64_t nTotalDroppedBytesBeforeEnqueue
Total bytes dropped before enqueue.
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 void DoDispose(void)
Dispose of the object.
uint32_t GetNPacketFilters(void) const
Get the number of packet filters.
uint32_t GetNDroppedPackets(std::string reason) const
Get the number of packets dropped for the given reason.
std::map< std::string, uint32_t > nMarkedPackets
Marked packets, for each reason.
virtual WakeMode GetWakeMode(void) const
When setting up the wake callbacks on the netdevice queues, it is necessary to determine which queue ...
InternalQueueDropFunctor m_internalQueueDadFunctor
Function object called when an internal queue dropped a packet after dequeue.
QueueDiscClass is the base class for classes that are included in a queue disc.
static const uint32_t DEFAULT_QUOTA
Default quota (as in /proc/sys/net/core/dev_weight)
Ptr< QueueDiscItem > Dequeue(void)
Request the queue discipline to extract a packet.
uint64_t nTotalRequeuedBytes
Total requeued bytes.
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
uint32_t nTotalDroppedPacketsAfterDequeue
Total packets dropped after dequeue.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t nTotalReceivedPackets
Total received packets.
TracedCallback< Ptr< const QueueDiscItem >, const char * > m_traceDropBeforeEnqueue
Traced callback: fired when a packet is dropped before enqueue.
uint32_t m_quota
Maximum number of packets dequeued in a qdisc run.
uint64_t GetNMarkedBytes(std::string reason) const
Get the amount of bytes marked for the given reason.
void Print(std::ostream &os) const
Print the statistics.
std::vector< Ptr< InternalQueue > > m_queues
Internal queues.
bool RunBegin(void)
Modelled after the Linux function qdisc_run_begin (include/net/sch_generic.h).
TracedCallback< Ptr< const QueueDiscItem > > m_traceEnqueue
Traced callback: fired when a packet is enqueued.
bool m_running
The queue disc is performing multiple dequeue operations.
uint64_t nTotalReceivedBytes
Total received bytes.
virtual uint32_t GetQuota(void) const
Get the maximum number of dequeue operations following a packet enqueue.
virtual bool CheckConfig(void)=0
Check whether the current configuration is correct.
TracedValue< uint32_t > m_nBytes
Number of bytes in the queue.
void Requeue(Ptr< QueueDiscItem > item)
Modelled after the Linux function dev_requeue_skb (net/sched/sch_generic.c) Requeues a packet whose t...
TracedValue< uint32_t > m_nPackets
Number of packets in the queue.
void PacketDequeued(Ptr< const QueueDiscItem > item)
Perform the actions required when the queue disc is notified of a packet dequeue. ...
std::vector< Ptr< PacketFilter > > m_filters
Packet filters.
uint64_t nTotalDequeuedBytes
Total dequeued bytes.
std::map< std::string, uint64_t > nDroppedBytesBeforeEnqueue
Bytes dropped before enqueue, for each reason.
uint64_t nTotalDroppedBytesAfterDequeue
Total bytes dropped after dequeue.
Introspection did not find any typical Config paths.
Queue< QueueDiscItem > InternalQueue
Internal queues store QueueDiscItem objects.
Ptr< NetDevice > m_device
The NetDevice on which this queue discipline is installed.
virtual void SetQuota(const uint32_t quota)
Set the maximum number of dequeue operations following a packet enqueue.
ChildQueueDiscDropFunctor m_childQueueDiscDadFunctor
Function object called when a child queue disc dropped a packet after dequeue.
uint32_t nTotalEnqueuedPackets
Total enqueued packets.
void AddPacketFilter(Ptr< PacketFilter > filter)
Add a packet filter to the tail of the list of filters used to classify packets.
std::function< void(Ptr< const QueueDiscItem >)> InternalQueueDropFunctor
Type for the function objects notifying that a packet has been dropped by an internal queue...
void DropAfterDequeue(Ptr< const QueueDiscItem > item, const char *reason)
Perform the actions required when the queue disc is notified of a packet dropped after dequeue...
Stats m_stats
The collected statistics.
uint64_t nTotalDroppedBytes
Total dropped bytes.
std::map< std::string, uint64_t > nMarkedBytes
Marked bytes, for each reason.
TracedCallback< Ptr< const QueueDiscItem > > m_traceDrop
Traced callback: fired when a packet is dropped.
virtual void InitializeParams(void)=0
Initialize parameters (if any) before the first packet is enqueued.
static TypeId GetTypeId(void)
Get the type ID.
uint32_t GetNMarkedPackets(std::string reason) const
Get the number of packets marked for the given reason.
A base class which provides memory management and object aggregation.
virtual Ptr< const QueueDiscItem > DoPeek(void) const =0
This function returns a copy of the next packet the queue disc will extract.
bool Restart(void)
Modelled after the Linux function qdisc_restart (net/sched/sch_generic.c) Dequeue a packet (by callin...
a unique identifier for an interface.
Ptr< QueueDiscItem > DequeuePacket(void)
Modelled after the Linux function dequeue_skb (net/sched/sch_generic.c)
Ptr< NetDevice > GetNetDevice(void) const
Get the NetDevice on which this queue discipline is installed.
static TypeId GetTypeId(void)
Get the type ID.
TracedCallback< Ptr< const QueueDiscItem > > m_traceRequeue
Traced callback: fired when a packet is requeued.
Ptr< const QueueDiscItem > Peek(void) const
Get a copy of the next packet the queue discipline will extract, without actually extracting the pack...
void SetNetDevice(Ptr< NetDevice > device)
Set the NetDevice on which this queue discipline is installed.
Ptr< QueueDiscClass > GetQueueDiscClass(uint32_t i) const
Get the i-th queue disc class.
static constexpr const char * INTERNAL_QUEUE_DROP
Packet dropped by an internal queue.
void RunEnd(void)
Modelled after the Linux function qdisc_run_end (include/net/sch_generic.h).
std::vector< Ptr< QueueDiscClass > > m_classes
Classes.
uint32_t GetNPackets(void) const
Get the number of packets stored by the queue disc.
std::map< std::string, uint32_t > nDroppedPacketsBeforeEnqueue
Packets dropped before enqueue, for each reason.