A Discrete-Event Network Simulator
API
fq-codel-queue-disc.h
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 <stefano.avallone@unina.it>
20  */
21 
22 #ifndef FQ_CODEL_QUEUE_DISC
23 #define FQ_CODEL_QUEUE_DISC
24 
25 #include "ns3/queue-disc.h"
26 #include "ns3/object-factory.h"
27 #include <list>
28 #include <map>
29 
30 namespace ns3 {
31 
38 class FqCoDelFlow : public QueueDiscClass {
39 public:
44  static TypeId GetTypeId (void);
48  FqCoDelFlow ();
49 
50  virtual ~FqCoDelFlow ();
51 
57  {
61  };
62 
67  void SetDeficit (uint32_t deficit);
72  int32_t GetDeficit (void) const;
77  void IncreaseDeficit (int32_t deficit);
82  void SetStatus (FlowStatus status);
87  FlowStatus GetStatus (void) const;
88 
89 private:
90  int32_t m_deficit;
92 };
93 
94 
101 class FqCoDelQueueDisc : public QueueDisc {
102 public:
107  static TypeId GetTypeId (void);
111  FqCoDelQueueDisc ();
112 
113  virtual ~FqCoDelQueueDisc ();
114 
120  void SetQuantum (uint32_t quantum);
121 
127  uint32_t GetQuantum (void) const;
128 
129  // Reasons for dropping packets
130  static constexpr const char* UNCLASSIFIED_DROP = "Unclassified drop";
131  static constexpr const char* OVERLIMIT_DROP = "Overlimit drop";
132 
133 private:
134  virtual bool DoEnqueue (Ptr<QueueDiscItem> item);
135  virtual Ptr<QueueDiscItem> DoDequeue (void);
136  virtual bool CheckConfig (void);
137  virtual void InitializeParams (void);
138 
143  uint32_t FqCoDelDrop (void);
144 
145  std::string m_interval;
146  std::string m_target;
147  uint32_t m_quantum;
148  uint32_t m_flows;
149  uint32_t m_dropBatchSize;
150  uint32_t m_perturbation;
151 
152  std::list<Ptr<FqCoDelFlow> > m_newFlows;
153  std::list<Ptr<FqCoDelFlow> > m_oldFlows;
154 
155  std::map<uint32_t, uint32_t> m_flowsIndices;
156 
159 };
160 
161 } // namespace ns3
162 
163 #endif /* FQ_CODEL_QUEUE_DISC */
void SetDeficit(uint32_t deficit)
Set the deficit for this flow.
A FqCoDel packet queue disc.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
FlowStatus
Used to determine the status of this flow queue.
uint32_t m_quantum
Deficit assigned to flows at each round.
uint32_t FqCoDelDrop(void)
Drop a packet from the head of the queue with the largest current byte count.
uint32_t m_dropBatchSize
Max number of packets dropped from the fat flow.
int32_t GetDeficit(void) const
Get the deficit for this flow.
static TypeId GetTypeId(void)
Get the type ID.
QueueDisc is an abstract base class providing the interface and implementing the operations common to...
Definition: queue-disc.h:182
FqCoDelFlow()
FqCoDelFlow constructor.
void SetStatus(FlowStatus status)
Set the status for this flow.
A flow queue used by the FqCoDel queue disc.
int32_t m_deficit
the deficit for this flow
uint32_t m_flows
Number of flow queues.
uint32_t GetQuantum(void) const
Get the quantum value.
uint32_t m_perturbation
hash perturbation value
virtual bool CheckConfig(void)
Check whether the current configuration is correct.
static constexpr const char * UNCLASSIFIED_DROP
No packet filter able to classify packet.
QueueDiscClass is the base class for classes that are included in a queue disc.
Definition: queue-disc.h:50
std::list< Ptr< FqCoDelFlow > > m_newFlows
The list of new flows.
virtual Ptr< QueueDiscItem > DoDequeue(void)
This function actually extracts a packet from the queue disc.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::string m_interval
CoDel interval attribute.
std::string m_target
CoDel target attribute.
void SetQuantum(uint32_t quantum)
Set the quantum value.
ObjectFactory m_queueDiscFactory
Factory to create a new queue.
static TypeId GetTypeId(void)
Get the type ID.
std::map< uint32_t, uint32_t > m_flowsIndices
Map with the index of class for each flow.
FqCoDelQueueDisc()
FqCoDelQueueDisc constructor.
virtual void InitializeParams(void)
Initialize parameters (if any) before the first packet is enqueued.
Instantiate subclasses of ns3::Object.
FlowStatus GetStatus(void) const
Get the status of this flow.
std::list< Ptr< FqCoDelFlow > > m_oldFlows
The list of old flows.
virtual bool DoEnqueue(Ptr< QueueDiscItem > item)
This function actually enqueues a packet into the queue disc.
static constexpr const char * OVERLIMIT_DROP
Overlimit dropped packets.
void IncreaseDeficit(int32_t deficit)
Increase the deficit for this flow.
FlowStatus m_status
the status of this flow
a unique identifier for an interface.
Definition: type-id.h:58
ObjectFactory m_flowFactory
Factory to create a new flow.