/usr/include/ns3.27/ns3/fq-codel-queue-disc.h is in libns3-dev 3.27+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2016 Universita' degli Studi di Napoli Federico II
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Pasquale Imputato <p.imputato@gmail.com>
* Stefano Avallone <stefano.avallone@unina.it>
*/
#ifndef FQ_CODEL_QUEUE_DISC
#define FQ_CODEL_QUEUE_DISC
#include "ns3/queue-disc.h"
#include "ns3/object-factory.h"
#include <list>
#include <map>
namespace ns3 {
/**
* \ingroup traffic-control
*
* \brief A flow queue used by the FqCoDel queue disc
*/
class FqCoDelFlow : public QueueDiscClass {
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
/**
* \brief FqCoDelFlow constructor
*/
FqCoDelFlow ();
virtual ~FqCoDelFlow ();
/**
* \enum FlowStatus
* \brief Used to determine the status of this flow queue
*/
enum FlowStatus
{
INACTIVE,
NEW_FLOW,
OLD_FLOW
};
/**
* \brief Set the deficit for this flow
* \param deficit the deficit for this flow
*/
void SetDeficit (uint32_t deficit);
/**
* \brief Get the deficit for this flow
* \return the deficit for this flow
*/
int32_t GetDeficit (void) const;
/**
* \brief Increase the deficit for this flow
* \param deficit the amount by which the deficit is to be increased
*/
void IncreaseDeficit (int32_t deficit);
/**
* \brief Set the status for this flow
* \param status the status for this flow
*/
void SetStatus (FlowStatus status);
/**
* \brief Get the status of this flow
* \return the status of this flow
*/
FlowStatus GetStatus (void) const;
private:
int32_t m_deficit; //!< the deficit for this flow
FlowStatus m_status; //!< the status of this flow
};
/**
* \ingroup traffic-control
*
* \brief A FqCoDel packet queue disc
*/
class FqCoDelQueueDisc : public QueueDisc {
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
/**
* \brief FqCoDelQueueDisc constructor
*/
FqCoDelQueueDisc ();
virtual ~FqCoDelQueueDisc ();
/**
* \brief Set the quantum value.
*
* \param quantum The number of bytes each queue gets to dequeue on each round of the scheduling algorithm
*/
void SetQuantum (uint32_t quantum);
/**
* \brief Get the quantum value.
*
* \returns The number of bytes each queue gets to dequeue on each round of the scheduling algorithm
*/
uint32_t GetQuantum (void) const;
// Reasons for dropping packets
static constexpr const char* UNCLASSIFIED_DROP = "Unclassified drop"; //!< No packet filter able to classify packet
static constexpr const char* OVERLIMIT_DROP = "Overlimit drop"; //!< Overlimit dropped packets
private:
virtual bool DoEnqueue (Ptr<QueueDiscItem> item);
virtual Ptr<QueueDiscItem> DoDequeue (void);
virtual Ptr<const QueueDiscItem> DoPeek (void) const;
virtual bool CheckConfig (void);
virtual void InitializeParams (void);
/**
* \brief Drop a packet from the head of the queue with the largest current byte count
* \return the index of the queue with the largest current byte count
*/
uint32_t FqCoDelDrop (void);
std::string m_interval; //!< CoDel interval attribute
std::string m_target; //!< CoDel target attribute
uint32_t m_limit; //!< Maximum number of packets in the queue disc
uint32_t m_quantum; //!< Deficit assigned to flows at each round
uint32_t m_flows; //!< Number of flow queues
uint32_t m_dropBatchSize; //!< Max number of packets dropped from the fat flow
std::list<Ptr<FqCoDelFlow> > m_newFlows; //!< The list of new flows
std::list<Ptr<FqCoDelFlow> > m_oldFlows; //!< The list of old flows
std::map<uint32_t, uint32_t> m_flowsIndices; //!< Map with the index of class for each flow
ObjectFactory m_flowFactory; //!< Factory to create a new flow
ObjectFactory m_queueDiscFactory; //!< Factory to create a new queue
};
} // namespace ns3
#endif /* FQ_CODEL_QUEUE_DISC */
|