A Discrete-Event Network Simulator
API
mq-queue-disc.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Universita' degli Studi di Napoli Federico II
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Authors: Pasquale Imputato <p.imputato@gmail.com>
18  * Stefano Avallone <stavallo@unina.it>
19  */
20 
21 #include "mq-queue-disc.h"
22 
23 #include "ns3/log.h"
24 
25 namespace ns3
26 {
27 
28 NS_LOG_COMPONENT_DEFINE("MqQueueDisc");
29 
30 NS_OBJECT_ENSURE_REGISTERED(MqQueueDisc);
31 
32 TypeId
34 {
35  static TypeId tid = TypeId("ns3::MqQueueDisc")
37  .SetGroupName("TrafficControl")
38  .AddConstructor<MqQueueDisc>();
39  return tid;
40 }
41 
44 {
45  NS_LOG_FUNCTION(this);
46 }
47 
49 {
50  NS_LOG_FUNCTION(this);
51 }
52 
55 {
56  return WAKE_CHILD;
57 }
58 
59 bool
61 {
62  NS_FATAL_ERROR("MqQueueDisc: DoEnqueue should never be called");
63 }
64 
67 {
68  NS_FATAL_ERROR("MqQueueDisc: DoDequeue should never be called");
69 }
70 
73 {
74  NS_FATAL_ERROR("MqQueueDisc: DoPeek should never be called");
75 }
76 
77 bool
79 {
80  NS_LOG_FUNCTION(this);
81 
82  if (GetNPacketFilters() > 0)
83  {
84  NS_LOG_ERROR("MqQueueDisc cannot have packet filters");
85  return false;
86  }
87 
88  if (GetNInternalQueues() > 0)
89  {
90  NS_LOG_ERROR("MqQueueDisc cannot have internal queues");
91  return false;
92  }
93 
94  return true;
95 }
96 
97 void
99 {
100  NS_LOG_FUNCTION(this);
101 }
102 
103 } // namespace ns3
mq is a classful multi-queue aware dummy scheduler.
Definition: mq-queue-disc.h:37
Ptr< QueueDiscItem > DoDequeue() override
This function actually extracts a packet from the queue disc.
Ptr< const QueueDiscItem > DoPeek() override
Return a copy of the next packet the queue disc will extract.
void InitializeParams() override
Initialize parameters (if any) before the first packet is enqueued.
MqQueueDisc()
MqQueueDisc constructor.
static TypeId GetTypeId()
Get the type ID.
bool DoEnqueue(Ptr< QueueDiscItem > item) override
This function actually enqueues a packet into the queue disc.
bool CheckConfig() override
Check whether the current configuration is correct.
~MqQueueDisc() override
WakeMode GetWakeMode() const override
Return the wake mode adopted by this queue disc.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
QueueDisc is an abstract base class providing the interface and implementing the operations common to...
Definition: queue-disc.h:184
WakeMode
Used to determine whether the queue disc itself or its children must be activated when a netdevice wa...
Definition: queue-disc.h:503
std::size_t GetNPacketFilters() const
Get the number of packet filters.
Definition: queue-disc.cc:618
std::size_t GetNInternalQueues() const
Get the number of internal queues.
Definition: queue-disc.cc:598
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:931
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition: log.h:254
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
QueueDiscSizePolicy
Enumeration of the available policies to handle the queue disc size.
Definition: queue-disc.h:107
@ NO_LIMITS
Used by queue discs with unlimited size.
Definition: queue-disc.h:111
Every class exported by the ns3 library is enclosed in the ns3 namespace.