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
ipv4-queue-disc-item.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2016 Universita' degli Studi di Napoli Federico II
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*/
6
7
#ifndef IPV4_QUEUE_DISC_ITEM_H
8
#define IPV4_QUEUE_DISC_ITEM_H
9
10
#include "
ipv4-header.h
"
11
12
#include "ns3/packet.h"
13
#include "ns3/queue-item.h"
14
15
namespace
ns3
16
{
17
18
/**
19
* \ingroup ipv4
20
* \ingroup traffic-control
21
*
22
* Ipv4QueueDiscItem is a subclass of QueueDiscItem which stores IPv4 packets.
23
* Header and payload are kept separate to allow the queue disc to manipulate
24
* the header, which is added to the packet when the packet is dequeued.
25
*/
26
class
Ipv4QueueDiscItem
:
public
QueueDiscItem
27
{
28
public
:
29
/**
30
* \brief Create an IPv4 queue disc item containing an IPv4 packet.
31
* \param p the packet included in the created item.
32
* \param addr the destination MAC address
33
* \param protocol the protocol number
34
* \param header the IPv4 header
35
*/
36
Ipv4QueueDiscItem
(
Ptr<Packet>
p,
37
const
Address
& addr,
38
uint16_t protocol,
39
const
Ipv4Header
& header);
40
41
~Ipv4QueueDiscItem
()
override
;
42
43
// Delete default constructor, copy constructor and assignment operator to avoid misuse
44
Ipv4QueueDiscItem
() =
delete
;
45
Ipv4QueueDiscItem
(
const
Ipv4QueueDiscItem
&) =
delete
;
46
Ipv4QueueDiscItem
&
operator=
(
const
Ipv4QueueDiscItem
&) =
delete
;
47
48
/**
49
* \return the correct packet size (header plus payload).
50
*/
51
uint32_t
GetSize
()
const override
;
52
53
/**
54
* \return the header stored in this item..
55
*/
56
const
Ipv4Header
&
GetHeader
()
const
;
57
58
/**
59
* \brief Add the header to the packet
60
*/
61
void
AddHeader
()
override
;
62
63
/**
64
* \brief Print the item contents.
65
* \param os output stream in which the data should be printed.
66
*/
67
void
Print
(std::ostream& os)
const override
;
68
69
/*
70
* The values for the fields of the Ipv4 header are taken from m_header and
71
* thus might differ from those present in the packet in case the header is
72
* modified after being added to the packet. However, this function is likely
73
* to be called before the header is added to the packet (i.e., before the
74
* packet is dequeued from the queue disc)
75
*/
76
bool
GetUint8Value
(
Uint8Values
field, uint8_t& value)
const override
;
77
78
/**
79
* \brief Marks the packet by setting ECN_CE bits if the packet has
80
* ECN_ECT0 or ECN_ECT1 set. If ECN_CE is already set, returns true.
81
* \return true if the method results in a marked packet, false otherwise
82
*/
83
bool
Mark
()
override
;
84
85
/**
86
* \brief Computes the hash of the packet's 5-tuple
87
*
88
* Computes the hash of the source and destination IP addresses, protocol
89
* number and, if the transport protocol is either UDP or TCP, the source
90
* and destination port
91
*
92
* \param perturbation hash perturbation value
93
* \return the hash of the packet's 5-tuple
94
*/
95
uint32_t
Hash
(
uint32_t
perturbation)
const override
;
96
97
private
:
98
Ipv4Header
m_header
;
//!< The IPv4 header.
99
bool
m_headerAdded
;
//!< True if the header has already been added to the packet.
100
};
101
102
}
// namespace ns3
103
104
#endif
/* IPV4_QUEUE_DISC_ITEM_H */
ns3::Address
a polymophic address class
Definition
address.h:90
ns3::Ipv4Header
Packet header for IPv4.
Definition
ipv4-header.h:23
ns3::Ipv4QueueDiscItem
Ipv4QueueDiscItem is a subclass of QueueDiscItem which stores IPv4 packets.
Definition
ipv4-queue-disc-item.h:27
ns3::Ipv4QueueDiscItem::m_headerAdded
bool m_headerAdded
True if the header has already been added to the packet.
Definition
ipv4-queue-disc-item.h:99
ns3::Ipv4QueueDiscItem::GetHeader
const Ipv4Header & GetHeader() const
Definition
ipv4-queue-disc-item.cc:49
ns3::Ipv4QueueDiscItem::m_header
Ipv4Header m_header
The IPv4 header.
Definition
ipv4-queue-disc-item.h:98
ns3::Ipv4QueueDiscItem::Hash
uint32_t Hash(uint32_t perturbation) const override
Computes the hash of the packet's 5-tuple.
Definition
ipv4-queue-disc-item.cc:108
ns3::Ipv4QueueDiscItem::~Ipv4QueueDiscItem
~Ipv4QueueDiscItem() override
Definition
ipv4-queue-disc-item.cc:29
ns3::Ipv4QueueDiscItem::Ipv4QueueDiscItem
Ipv4QueueDiscItem(const Ipv4QueueDiscItem &)=delete
ns3::Ipv4QueueDiscItem::operator=
Ipv4QueueDiscItem & operator=(const Ipv4QueueDiscItem &)=delete
ns3::Ipv4QueueDiscItem::AddHeader
void AddHeader() override
Add the header to the packet.
Definition
ipv4-queue-disc-item.cc:55
ns3::Ipv4QueueDiscItem::GetUint8Value
bool GetUint8Value(Uint8Values field, uint8_t &value) const override
Retrieve the value of a given field from the packet, if present.
Definition
ipv4-queue-disc-item.cc:92
ns3::Ipv4QueueDiscItem::Ipv4QueueDiscItem
Ipv4QueueDiscItem()=delete
ns3::Ipv4QueueDiscItem::Mark
bool Mark() override
Marks the packet by setting ECN_CE bits if the packet has ECN_ECT0 or ECN_ECT1 set.
Definition
ipv4-queue-disc-item.cc:80
ns3::Ipv4QueueDiscItem::Print
void Print(std::ostream &os) const override
Print the item contents.
Definition
ipv4-queue-disc-item.cc:67
ns3::Ipv4QueueDiscItem::GetSize
uint32_t GetSize() const override
Definition
ipv4-queue-disc-item.cc:35
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::QueueDiscItem
QueueDiscItem is the abstract base class for items that are stored in a queue disc.
Definition
queue-item.h:122
ns3::QueueItem::Uint8Values
Uint8Values
1-byte fields of the packet whose value can be retrieved, if present
Definition
queue-item.h:71
uint32_t
ipv4-header.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
internet
model
ipv4-queue-disc-item.h
Generated on Fri Nov 8 2024 13:59:01 for ns-3 by
1.11.0