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