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 
42 {
43  NS_LOG_FUNCTION (this);
44 }
45 
47 {
48  NS_LOG_FUNCTION (this);
49 }
50 
53 {
54  return WAKE_CHILD;
55 }
56 
57 bool
59 {
60  NS_FATAL_ERROR ("MqQueueDisc: DoEnqueue should never be called");
61 }
62 
65 {
66  NS_FATAL_ERROR ("MqQueueDisc: DoDequeue should never be called");
67 }
68 
70 MqQueueDisc::DoPeek (void) const
71 {
72  NS_FATAL_ERROR ("MqQueueDisc: DoPeek should never be called");
73 }
74 
75 bool
77 {
78  NS_LOG_FUNCTION (this);
79 
80  if (GetNPacketFilters () > 0)
81  {
82  NS_LOG_ERROR ("MqQueueDisc cannot have packet filters");
83  return false;
84  }
85 
86  if (GetNInternalQueues () > 0)
87  {
88  NS_LOG_ERROR ("MqQueueDisc cannot have internal queues");
89  return false;
90  }
91 
92  return true;
93 }
94 
95 void
97 {
98  NS_LOG_FUNCTION (this);
99 }
100 
101 } // namespace ns3
mq is a classful multi-queue aware dummy scheduler.
Definition: mq-queue-disc.h:36
WakeMode GetWakeMode(void) const
Return the wake mode adopted by this queue disc.
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.
MqQueueDisc()
MqQueueDisc constructor.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:162
QueueDisc is an abstract base class providing the interface and implementing the operations common to...
Definition: queue-disc.h:151
WakeMode
Used to determine whether the queue disc itself or its children must be activated when a netdevice wa...
Definition: queue-disc.h:402
virtual bool CheckConfig(void)
Check whether the current configuration is correct.
uint32_t GetNInternalQueues(void) const
Get the number of internal queues.
Definition: queue-disc.cc:499
virtual void InitializeParams(void)
Initialize parameters (if any) before the first packet is enqueued.
uint32_t GetNPacketFilters(void) const
Get the number of packet filters.
Definition: queue-disc.cc:519
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual ~MqQueueDisc()
virtual Ptr< const QueueDiscItem > DoPeek(void) const
This function returns a copy of the next packet the queue disc will extract.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition: log.h:253
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:914