19 #include "ns3/abort.h"
21 #include "ns3/uinteger.h"
22 #include "ns3/trace-source-accessor.h"
37 .SetGroupName (
"Network")
38 .AddAttribute (
"Mode",
39 "Whether to use bytes (see MaxBytes) or packets (see MaxPackets) as the maximum queue size metric.",
46 "Use the MaxSize attribute instead")
47 .AddAttribute (
"MaxPackets",
48 "The maximum number of packets accepted by this queue.",
52 MakeUintegerChecker<uint32_t> (),
54 "Use the MaxSize attribute instead")
55 .AddAttribute (
"MaxBytes",
56 "The maximum number of bytes accepted by this queue.",
60 MakeUintegerChecker<uint32_t> (),
62 "Use the MaxSize attribute instead")
63 .AddAttribute (
"MaxSize",
69 .AddTraceSource (
"PacketsInQueue",
70 "Number of packets currently stored in the queue",
72 "ns3::TracedValueCallback::Uint32")
73 .AddTraceSource (
"BytesInQueue",
74 "Number of bytes currently stored in the queue",
76 "ns3::TracedValueCallback::Uint32")
83 m_nTotalReceivedBytes (0),
85 m_nTotalReceivedPackets (0),
86 m_nTotalDroppedBytes (0),
87 m_nTotalDroppedBytesBeforeEnqueue (0),
88 m_nTotalDroppedBytesAfterDequeue (0),
89 m_nTotalDroppedPackets (0),
90 m_nTotalDroppedPacketsBeforeEnqueue (0),
91 m_nTotalDroppedPacketsAfterDequeue (0),
106 if (typeId.back () !=
'>')
108 typeId.append (
"<" + itemType +
">");
310 "The new maximum queue size cannot be less than the current size");
uint32_t m_nTotalDroppedPacketsBeforeEnqueue
Total dropped packets before enqueue.
uint32_t m_nTotalReceivedPackets
Total received packets.
uint32_t m_nTotalDroppedPackets
Total dropped packets.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Class for representing queue sizes.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
uint32_t m_maxBytes
max bytes in the queue
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
uint32_t m_nTotalDroppedBytes
Total dropped bytes.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint32_t m_nTotalDroppedPacketsAfterDequeue
Total dropped packets after dequeue.
uint32_t m_nTotalDroppedBytesAfterDequeue
Total dropped bytes after dequeue.
QueueSizeUnit GetUnit() const
Get the underlying unit.
uint32_t GetTotalDroppedPacketsBeforeEnqueue(void) const
QueueBase::QueueMode GetMode(void) const
Get the operating mode of this device.
T Get(void) const
Get the underlying value.
TracedValue< uint32_t > m_nPackets
Number of packets in the queue.
uint32_t GetValue() const
Get the underlying value.
static void AppendItemTypeIfNotPresent(std::string &typeId, const std::string &itemType)
Append the item type to the provided type ID if the latter does not end with '>'. ...
QueueSize m_maxSize
max queue size
Use number of packets for maximum queue size.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
uint32_t GetNBytes(void) const
uint32_t m_maxPackets
max packets in the queue
void SetMode(QueueBase::QueueMode mode)
Set the operating mode of this device.
uint32_t m_nTotalDroppedBytesBeforeEnqueue
Total dropped bytes before enqueue.
Hold variables of type enum.
QueueSize GetCurrentSize(void) const
Hold an unsigned integer type.
void SetMaxPackets(uint32_t maxPackets)
Set the maximum amount of packets that can be stored in this queue.
Use number of packets for queue size.
uint32_t GetMaxPackets(void) const
uint32_t GetTotalDroppedBytes(void) const
Ptr< const AttributeAccessor > MakeQueueSizeAccessor(T1 a1)
Attribute or trace source is deprecated; user is warned.
Ptr< const AttributeChecker > MakeQueueSizeChecker(void)
uint32_t m_nTotalReceivedBytes
Total received bytes.
void ResetStatistics(void)
Resets the counts for dropped packets, dropped bytes, received packets, and received bytes...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t GetTotalDroppedBytesAfterDequeue(void) const
void SetMaxBytes(uint32_t maxBytes)
Set the maximum amount of bytes that can be stored in this queue.
Use number of bytes for maximum queue size.
uint32_t GetTotalReceivedPackets(void) const
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
uint32_t GetMaxBytes(void) const
Ptr< const AttributeChecker > MakeEnumChecker(int v1, std::string n1, int v2, std::string n2, int v3, std::string n3, int v4, std::string n4, int v5, std::string n5, int v6, std::string n6, int v7, std::string n7, int v8, std::string n8, int v9, std::string n9, int v10, std::string n10, int v11, std::string n11, int v12, std::string n12, int v13, std::string n13, int v14, std::string n14, int v15, std::string n15, int v16, std::string n16, int v17, std::string n17, int v18, std::string n18, int v19, std::string n19, int v20, std::string n20, int v21, std::string n21, int v22, std::string n22)
Make an EnumChecker pre-configured with a set of allowed values by name.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
uint32_t GetNPackets(void) const
uint32_t GetTotalDroppedPacketsAfterDequeue(void) const
#define NS_OBJECT_TEMPLATE_CLASS_DEFINE(type, param)
Explicitly instantiate a template class and register the resulting instance with the TypeId system...
uint32_t GetTotalDroppedPackets(void) const
A base class which provides memory management and object aggregation.
void SetMaxSize(QueueSize size)
Set the maximum size of this queue.
QueueMode
Enumeration of the modes supported in the class.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Use number of bytes for queue size.
a unique identifier for an interface.
uint32_t GetTotalReceivedBytes(void) const
TypeId SetParent(TypeId tid)
Set the parent TypeId.
QueueSize GetMaxSize(void) const
static TypeId GetTypeId(void)
Get the type ID.
uint32_t GetTotalDroppedBytesBeforeEnqueue(void) const
TracedValue< uint32_t > m_nBytes
Number of bytes in the queue.