A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
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
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Authors: Stefano Avallone <stavallo@unina.it>
7
*/
8
9
#ifndef PRIO_QUEUE_DISC_H
10
#define PRIO_QUEUE_DISC_H
11
12
#include "
queue-disc.h
"
13
14
#include <array>
15
16
namespace
ns3
17
{
18
19
/// Priority map
20
typedef
std::array<uint16_t, 16>
Priomap
;
21
22
/**
23
* \ingroup traffic-control
24
*
25
* The Prio qdisc is a simple classful queueing discipline that contains an
26
* arbitrary number of classes of differing priority. The classes are dequeued
27
* in numerical descending order of priority. By default, three Fifo queue
28
* discs are created, unless the user provides (at least two) child queue
29
* discs.
30
*
31
* If no packet filter is installed or able to classify a packet, then the
32
* packet is assigned a priority band based on its priority (modulo 16), which
33
* is used as an index into an array called priomap. If a packet is classified
34
* by a packet filter and the returned value is non-negative and less than the
35
* number of priority bands, then the packet is assigned the priority band
36
* corresponding to the value returned by the packet filter. Otherwise, the
37
* packet is assigned the priority band specified by the first element of the
38
* priomap array.
39
*/
40
class
PrioQueueDisc
:
public
QueueDisc
41
{
42
public
:
43
/**
44
* \brief Get the type ID.
45
* \return the object TypeId
46
*/
47
static
TypeId
GetTypeId
();
48
/**
49
* \brief PrioQueueDisc constructor
50
*/
51
PrioQueueDisc
();
52
53
~PrioQueueDisc
()
override
;
54
55
/**
56
* Set the band (class) assigned to packets with specified priority.
57
*
58
* \param prio the priority of packets (a value between 0 and 15).
59
* \param band the band assigned to packets.
60
*/
61
void
SetBandForPriority
(uint8_t prio, uint16_t band);
62
63
/**
64
* Get the band (class) assigned to packets with specified priority.
65
*
66
* \param prio the priority of packets (a value between 0 and 15).
67
* \returns the band assigned to packets.
68
*/
69
uint16_t
GetBandForPriority
(uint8_t prio)
const
;
70
71
private
:
72
bool
DoEnqueue
(
Ptr<QueueDiscItem>
item)
override
;
73
Ptr<QueueDiscItem>
DoDequeue
()
override
;
74
Ptr<const QueueDiscItem>
DoPeek
()
override
;
75
bool
CheckConfig
()
override
;
76
void
InitializeParams
()
override
;
77
78
Priomap
m_prio2band
;
//!< Priority to band mapping
79
};
80
81
/**
82
* Serialize the priomap to the given ostream
83
*
84
* \param os
85
* \param priomap
86
*
87
* \return std::ostream
88
*/
89
std::ostream&
operator<<
(std::ostream& os,
const
Priomap
& priomap);
90
91
/**
92
* Serialize from the given istream to this priomap.
93
*
94
* \param is
95
* \param priomap
96
*
97
* \return std::istream
98
*/
99
std::istream&
operator>>
(std::istream& is,
Priomap
& priomap);
100
101
ATTRIBUTE_HELPER_HEADER
(
Priomap
);
102
103
}
// namespace ns3
104
105
#endif
/* PRIO_QUEUE_DISC_H */
ns3::PrioQueueDisc
The Prio qdisc is a simple classful queueing discipline that contains an arbitrary number of classes ...
Definition
prio-queue-disc.h:41
ns3::PrioQueueDisc::SetBandForPriority
void SetBandForPriority(uint8_t prio, uint16_t band)
Set the band (class) assigned to packets with specified priority.
Definition
prio-queue-disc.cc:78
ns3::PrioQueueDisc::~PrioQueueDisc
~PrioQueueDisc() override
Definition
prio-queue-disc.cc:72
ns3::PrioQueueDisc::DoPeek
Ptr< const QueueDiscItem > DoPeek() override
Return a copy of the next packet the queue disc will extract.
Definition
prio-queue-disc.cc:161
ns3::PrioQueueDisc::DoDequeue
Ptr< QueueDiscItem > DoDequeue() override
This function actually extracts a packet from the queue disc.
Definition
prio-queue-disc.cc:139
ns3::PrioQueueDisc::GetBandForPriority
uint16_t GetBandForPriority(uint8_t prio) const
Get the band (class) assigned to packets with specified priority.
Definition
prio-queue-disc.cc:88
ns3::PrioQueueDisc::CheckConfig
bool CheckConfig() override
Check whether the current configuration is correct.
Definition
prio-queue-disc.cc:183
ns3::PrioQueueDisc::PrioQueueDisc
PrioQueueDisc()
PrioQueueDisc constructor.
Definition
prio-queue-disc.cc:66
ns3::PrioQueueDisc::m_prio2band
Priomap m_prio2band
Priority to band mapping.
Definition
prio-queue-disc.h:78
ns3::PrioQueueDisc::DoEnqueue
bool DoEnqueue(Ptr< QueueDiscItem > item) override
This function actually enqueues a packet into the queue disc.
Definition
prio-queue-disc.cc:98
ns3::PrioQueueDisc::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
prio-queue-disc.cc:51
ns3::PrioQueueDisc::InitializeParams
void InitializeParams() override
Initialize parameters (if any) before the first packet is enqueued.
Definition
prio-queue-disc.cc:217
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::QueueDisc
QueueDisc is an abstract base class providing the interface and implementing the operations common to...
Definition
queue-disc.h:173
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ATTRIBUTE_HELPER_HEADER
#define ATTRIBUTE_HELPER_HEADER(type)
Declare the attribute value, accessor and checkers for class type
Definition
attribute-helper.h:397
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition
angles.cc:148
ns3::operator>>
std::istream & operator>>(std::istream &is, Angles &a)
Definition
angles.cc:172
ns3::Priomap
std::array< uint16_t, 16 > Priomap
Priority map.
Definition
prio-queue-disc.h:20
queue-disc.h
src
traffic-control
model
prio-queue-disc.h
Generated on Fri Nov 8 2024 13:59:06 for ns-3 by
1.11.0