A Discrete-Event Network Simulator
API
prio-queue-disc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 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: Stefano Avallone <stavallo@unina.it>
18  */
19 
20 #ifndef PRIO_QUEUE_DISC_H
21 #define PRIO_QUEUE_DISC_H
22 
23 #include "queue-disc.h"
24 
25 #include <array>
26 
27 namespace ns3
28 {
29 
31 typedef std::array<uint16_t, 16> Priomap;
32 
51 class PrioQueueDisc : public QueueDisc
52 {
53  public:
58  static TypeId GetTypeId();
62  PrioQueueDisc();
63 
64  ~PrioQueueDisc() override;
65 
72  void SetBandForPriority(uint8_t prio, uint16_t band);
73 
80  uint16_t GetBandForPriority(uint8_t prio) const;
81 
82  private:
83  bool DoEnqueue(Ptr<QueueDiscItem> item) override;
84  Ptr<QueueDiscItem> DoDequeue() override;
86  bool CheckConfig() override;
87  void InitializeParams() override;
88 
90 };
91 
100 std::ostream& operator<<(std::ostream& os, const Priomap& priomap);
101 
110 std::istream& operator>>(std::istream& is, Priomap& priomap);
111 
113 
114 } // namespace ns3
115 
116 #endif /* PRIO_QUEUE_DISC_H */
The Prio qdisc is a simple classful queueing discipline that contains an arbitrary number of classes ...
void SetBandForPriority(uint8_t prio, uint16_t band)
Set the band (class) assigned to packets with specified priority.
~PrioQueueDisc() override
Ptr< const QueueDiscItem > DoPeek() override
Return a copy of the next packet the queue disc will extract.
Ptr< QueueDiscItem > DoDequeue() override
This function actually extracts a packet from the queue disc.
uint16_t GetBandForPriority(uint8_t prio) const
Get the band (class) assigned to packets with specified priority.
bool CheckConfig() override
Check whether the current configuration is correct.
PrioQueueDisc()
PrioQueueDisc constructor.
Priomap m_prio2band
Priority to band mapping.
bool DoEnqueue(Ptr< QueueDiscItem > item) override
This function actually enqueues a packet into the queue disc.
static TypeId GetTypeId()
Get the type ID.
void InitializeParams() override
Initialize parameters (if any) before the first packet is enqueued.
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
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ATTRIBUTE_HELPER_HEADER(ValueClassTest)
std::istream & operator>>(std::istream &is, Angles &a)
Definition: angles.cc:183
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:159
std::array< uint16_t, 16 > Priomap
Priority map.