diff --git a/CHANGES.html b/CHANGES.html
index 096ec9490..609d3082e 100644
--- a/CHANGES.html
+++ b/CHANGES.html
@@ -72,6 +72,7 @@ method to configure a specific ack policy selector for a given Access Category.<
allows to choose between Block Ack policy and Implicit Block Ack Request policy and
allows to request an acknowledgment after a configurable number of MPDUs have been
transmitted.
+
The MaxSize attribute is removed from the QueueBase base class and moved to subclasses. A new MaxSize attribute is therefore added to the DropTailQueue class, while the MaxQueueSize attribute of the WifiMacQueue class is renamed as MaxSize for API consistency.
Changes to existing API:
diff --git a/src/network/doc/queue.rst b/src/network/doc/queue.rst
index 12a19652b..b363d997c 100644
--- a/src/network/doc/queue.rst
+++ b/src/network/doc/queue.rst
@@ -68,11 +68,7 @@ There are five trace sources that may be hooked:
* ``DropBeforeEnqueue``
* ``DropAfterDequeue``
-Also, the QueueBase class defines one attribute:
-
-* ``MaxSize``: the maximum queue size
-
-and two trace sources:
+Also, the QueueBase class defines two additional trace sources:
* ``PacketsInQueue``
* ``BytesInQueue``
@@ -83,6 +79,10 @@ DropTail
This is a basic first-in-first-out (FIFO) queue that performs a tail drop
when the queue is full.
+The DropTailQueue class defines one attribute:
+
+* ``MaxSize``: the maximum queue size
+
Usage
*****
diff --git a/src/network/utils/drop-tail-queue.h b/src/network/utils/drop-tail-queue.h
index 981cd23b8..3ea5774fa 100644
--- a/src/network/utils/drop-tail-queue.h
+++ b/src/network/utils/drop-tail-queue.h
@@ -75,6 +75,12 @@ DropTailQueue- ::GetTypeId (void)
.SetParent
> ()
.SetGroupName ("Network")
.template AddConstructor > ()
+ .AddAttribute ("MaxSize",
+ "The max queue size",
+ QueueSizeValue (QueueSize ("100p")),
+ MakeQueueSizeAccessor (&QueueBase::SetMaxSize,
+ &QueueBase::GetMaxSize),
+ MakeQueueSizeChecker ())
;
return tid;
}
diff --git a/src/network/utils/queue.cc b/src/network/utils/queue.cc
index d2d1c7725..9eceefd46 100644
--- a/src/network/utils/queue.cc
+++ b/src/network/utils/queue.cc
@@ -36,12 +36,6 @@ QueueBase::GetTypeId (void)
static TypeId tid = TypeId ("ns3::QueueBase")
.SetParent ()
.SetGroupName ("Network")
- .AddAttribute ("MaxSize",
- "The max queue size",
- QueueSizeValue (QueueSize ("100p")),
- MakeQueueSizeAccessor (&QueueBase::SetMaxSize,
- &QueueBase::GetMaxSize),
- MakeQueueSizeChecker ())
.AddTraceSource ("PacketsInQueue",
"Number of packets currently stored in the queue",
MakeTraceSourceAccessor (&QueueBase::m_nPackets),
@@ -67,6 +61,7 @@ QueueBase::QueueBase () :
m_nTotalDroppedPacketsAfterDequeue (0)
{
NS_LOG_FUNCTION (this);
+ m_maxSize = QueueSize (QueueSizeUnit::PACKETS, std::numeric_limits::max ());
}
QueueBase::~QueueBase ()
diff --git a/src/point-to-point/examples/main-attribute-value.cc b/src/point-to-point/examples/main-attribute-value.cc
index 989520392..158f10984 100644
--- a/src/point-to-point/examples/main-attribute-value.cc
+++ b/src/point-to-point/examples/main-attribute-value.cc
@@ -55,24 +55,24 @@ main (int argc, char *argv[])
// The maximum queue size can either be enforced in bytes ('b') or
// packets ('p'). A special type called the ns3::QueueSize can
// hold queue size values in either unit (bytes or packets). The
- // queue base class ns3::QueueBase has a MaxSize attribute that can
+ // DropTailQueue class has a MaxSize attribute that can
// be set to a QueueSize.
// By default, the MaxSize attribute has a value of 100 packets ('100p')
- // (this default can be observed in the function QueueBase::GetTypeId)
+ // (this default can be observed in the function DropTail- ::GetTypeId)
//
// Here, we set it to 80 packets. We could use one of two value types:
// a string-based value or a QueueSizeValue value
- Config::SetDefault ("ns3::QueueBase::MaxSize", StringValue ("80p"));
+ Config::SetDefault ("ns3::DropTailQueue
::MaxSize", StringValue ("80p"));
// The below function call is redundant
- Config::SetDefault ("ns3::QueueBase::MaxSize", QueueSizeValue (QueueSize (QueueSizeUnit::PACKETS, 80)));
+ Config::SetDefault ("ns3::DropTailQueue::MaxSize", QueueSizeValue (QueueSize (QueueSizeUnit::PACKETS, 80)));
// Allow the user to override any of the defaults and the above
// SetDefaults() at run-time, via command-line arguments
- // For example, via "--ns3::QueueBase::MaxSize=80p"
+ // For example, via "--ns3::DropTailQueue::MaxSize=80p"
CommandLine cmd;
// This provides yet another way to set the value from the command line:
- cmd.AddValue ("maxSize", "ns3::QueueBase::MaxSize");
+ cmd.AddValue ("maxSize", "ns3::DropTailQueue::MaxSize");
cmd.Parse (argc, argv);
// Now, we will create a few objects using the low-level API
diff --git a/src/test/ns3tcp/ns3tcp-state-test-suite.cc b/src/test/ns3tcp/ns3tcp-state-test-suite.cc
index 5f9997436..a8852e644 100644
--- a/src/test/ns3tcp/ns3tcp-state-test-suite.cc
+++ b/src/test/ns3tcp/ns3tcp-state-test-suite.cc
@@ -308,7 +308,7 @@ Ns3TcpStateTestCase::DoRun (void)
Config::SetDefault ("ns3::TcpL4Protocol::SocketType", StringValue (tcpModel));
Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (1000));
Config::SetDefault ("ns3::TcpSocket::DelAckCount", UintegerValue (1));
- Config::SetDefault ("ns3::QueueBase::MaxSize", StringValue ("20p"));
+ Config::SetDefault ("ns3::DropTailQueue::MaxSize", StringValue ("20p"));
Config::SetDefault ("ns3::TcpSocketBase::Timestamp", BooleanValue (false));
if (m_writeLogging)
diff --git a/src/traffic-control/examples/codel-vs-pfifo-basic-test.cc b/src/traffic-control/examples/codel-vs-pfifo-basic-test.cc
index e3ca9d523..0a07c940a 100644
--- a/src/traffic-control/examples/codel-vs-pfifo-basic-test.cc
+++ b/src/traffic-control/examples/codel-vs-pfifo-basic-test.cc
@@ -129,7 +129,7 @@ int main (int argc, char *argv[])
}
// Devices queue configuration
- Config::SetDefault ("ns3::QueueBase::MaxSize",
+ Config::SetDefault ("ns3::DropTailQueue::MaxSize",
QueueSizeValue (QueueSize (QueueSizeUnit::PACKETS, queueSize)));
// Create gateway, source, and sink
diff --git a/src/traffic-control/examples/pfifo-vs-red.cc b/src/traffic-control/examples/pfifo-vs-red.cc
index 37f3defd5..02f87d02f 100644
--- a/src/traffic-control/examples/pfifo-vs-red.cc
+++ b/src/traffic-control/examples/pfifo-vs-red.cc
@@ -70,7 +70,7 @@ int main (int argc, char *argv[])
Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (pktSize));
Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue (appDataRate));
- Config::SetDefault ("ns3::QueueBase::MaxSize",
+ Config::SetDefault ("ns3::DropTailQueue::MaxSize",
QueueSizeValue (QueueSize (QueueSizeUnit::PACKETS, maxPackets)));
if (!modeBytes)
diff --git a/src/traffic-control/examples/red-vs-ared.cc b/src/traffic-control/examples/red-vs-ared.cc
index 6bb123f1a..f210f8e6d 100644
--- a/src/traffic-control/examples/red-vs-ared.cc
+++ b/src/traffic-control/examples/red-vs-ared.cc
@@ -70,7 +70,8 @@ int main (int argc, char *argv[])
Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (pktSize));
Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue (appDataRate));
- Config::SetDefault ("ns3::QueueBase::MaxSize", StringValue (std::to_string (maxPackets) + "p"));
+ Config::SetDefault ("ns3::DropTailQueue::MaxSize",
+ StringValue (std::to_string (maxPackets) + "p"));
if (!modeBytes)
{
diff --git a/src/wifi/model/wifi-mac-queue.cc b/src/wifi/model/wifi-mac-queue.cc
index 7224321d9..9f1c144ce 100644
--- a/src/wifi/model/wifi-mac-queue.cc
+++ b/src/wifi/model/wifi-mac-queue.cc
@@ -39,10 +39,11 @@ WifiMacQueue::GetTypeId (void)
.SetParent > ()
.SetGroupName ("Wifi")
.AddConstructor ()
- .AddAttribute ("MaxQueueSize",
+ .AddAttribute ("MaxSize",
"The max queue size",
QueueSizeValue (QueueSize ("500p")),
- MakeQueueSizeAccessor (&WifiMacQueue::SetMaxQueueSize),
+ MakeQueueSizeAccessor (&QueueBase::SetMaxSize,
+ &QueueBase::GetMaxSize),
MakeQueueSizeChecker ())
.AddAttribute ("MaxDelay", "If a packet stays longer than this delay in the queue, it is dropped.",
TimeValue (MilliSeconds (500)),
@@ -73,19 +74,6 @@ WifiMacQueue::~WifiMacQueue ()
const WifiMacQueue::ConstIterator WifiMacQueue::EMPTY = std::list> ().end ();
-void
-WifiMacQueue::SetMaxQueueSize (QueueSize size)
-{
- NS_LOG_FUNCTION (this << size);
- m_maxSize = size;
-}
-
-QueueSize
-WifiMacQueue::GetMaxQueueSize (void) const
-{
- return m_maxSize;
-}
-
void
WifiMacQueue::SetMaxDelay (Time delay)
{
@@ -139,8 +127,6 @@ WifiMacQueue::Insert (ConstIterator pos, Ptr item)
NS_ASSERT_MSG (GetMaxSize ().GetUnit () == QueueSizeUnit::PACKETS,
"WifiMacQueues must be in packet mode");
- QueueBase::SetMaxSize (GetMaxQueueSize ()); //Make sure QueueBase has the same maximum queue size
-
// insert the item if the queue is not full
if (QueueBase::GetNPackets () < GetMaxSize ().GetValue ())
{
diff --git a/src/wifi/model/wifi-mac-queue.h b/src/wifi/model/wifi-mac-queue.h
index 8d610f64e..e63930bfd 100644
--- a/src/wifi/model/wifi-mac-queue.h
+++ b/src/wifi/model/wifi-mac-queue.h
@@ -78,18 +78,6 @@ public:
using Queue::begin;
using Queue::end;
- /**
- * \brief Set the maximum size of this queue
- *
- * Trying to set a null size has no effect.
- *
- * \param size the maximum size
- */
- void SetMaxQueueSize (QueueSize size);
- /**
- * \return the maximum size of this queue
- */
- QueueSize GetMaxQueueSize (void) const;
/**
* Set the maximum delay before the packet is discarded.
*
@@ -325,7 +313,6 @@ private:
*/
bool TtlExceeded (ConstIterator &it);
- QueueSize m_maxSize; //!< max queue size
Time m_maxDelay; //!< Time to live for packets in the queue
DropPolicy m_dropPolicy; //!< Drop behavior of queue
mutable bool m_expiredPacketsPresent; //!< True if expired packets are in the queue