20 #include "ns3/trace-source-accessor.h"
34 .AddTraceSource (
"Enqueue",
"Enqueue a packet in the queue.",
36 "ns3::Packet::TracedCallback")
37 .AddTraceSource (
"Dequeue",
"Dequeue a packet from the queue.",
39 "ns3::Packet::TracedCallback")
40 .AddTraceSource (
"Drop",
"Drop a packet stored in the queue.",
42 "ns3::Packet::TracedCallback")
49 m_nTotalReceivedBytes (0),
51 m_nTotalReceivedPackets (0),
52 m_nTotalDroppedBytes (0),
53 m_nTotalDroppedPackets (0)
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
bool Enqueue(Ptr< Packet > p)
Place a packet into the rear of the Queue.
uint32_t m_nTotalDroppedBytes
Total dropped bytes.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
virtual Ptr< Packet > DoDequeue(void)=0
Pull a packet from the queue.
uint32_t GetTotalDroppedPackets(void) const
uint32_t m_nTotalReceivedBytes
Total received bytes.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
void ResetStatistics(void)
Resets the counts for dropped packets, dropped bytes, received packets, and received bytes...
uint32_t m_nPackets
Number of packets in the queue.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
uint32_t GetTotalReceivedBytes(void) const
static TypeId GetTypeId(void)
Get the type ID.
virtual bool DoEnqueue(Ptr< Packet > p)=0
Push a packet in the queue.
Ptr< Packet > Dequeue(void)
Remove a packet from the front of the Queue.
uint32_t GetNPackets(void) const
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
uint32_t m_nBytes
Number of bytes in the queue.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
TracedCallback< Ptr< const Packet > > m_traceDequeue
Traced callback: fired when a packet is dequeued.
TracedCallback< Ptr< const Packet > > m_traceDrop
Traced callback: fired when a packet is dropped.
uint32_t GetNBytes(void) const
Ptr< const Packet > Peek(void) const
Get a copy of the item at the front of the queue without removing it.
uint32_t GetTotalReceivedPackets(void) const
uint32_t m_nTotalReceivedPackets
Total received packets.
uint32_t m_nTotalDroppedPackets
Total dropped packets.
void DequeueAll(void)
Flush the queue.
TracedCallback< Ptr< const Packet > > m_traceEnqueue
Traced callback: fired when a packet is enqueued.
virtual Ptr< const Packet > DoPeek(void) const =0
Peek the front packet in the queue.
uint32_t GetTotalDroppedBytes(void) const
A base class which provides memory management and object aggregation.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
void Drop(Ptr< Packet > packet)
Drop a packet.