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
arp-queue-disc-item.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2018 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
18
#ifndef ARP_QUEUE_DISC_ITEM_H
19
#define ARP_QUEUE_DISC_ITEM_H
20
21
#include "
arp-header.h
"
22
23
#include "ns3/packet.h"
24
#include "ns3/queue-item.h"
25
26
namespace
ns3
27
{
28
29
/**
30
* \ingroup arp
31
* \ingroup traffic-control
32
*
33
* ArpQueueDiscItem is a subclass of QueueDiscItem which stores ARP packets.
34
* Header and payload are kept separate to allow the queue disc to hash the
35
* fields of the header, which is added to the packet when the packet is dequeued.
36
*/
37
class
ArpQueueDiscItem
:
public
QueueDiscItem
38
{
39
public
:
40
/**
41
* \brief Create an ARP queue disc item containing an ARP packet.
42
* \param p the packet included in the created item.
43
* \param addr the destination MAC address
44
* \param protocol the protocol number
45
* \param header the ARP header
46
*/
47
ArpQueueDiscItem
(
Ptr<Packet>
p,
48
const
Address
& addr,
49
uint16_t protocol,
50
const
ArpHeader
& header);
51
52
/** Destructor. */
53
~ArpQueueDiscItem
()
override
;
54
55
// Delete default constructor, copy constructor and assignment operator to avoid misuse
56
ArpQueueDiscItem
() =
delete
;
57
ArpQueueDiscItem
(
const
ArpQueueDiscItem
&) =
delete
;
58
ArpQueueDiscItem
&
operator=
(
const
ArpQueueDiscItem
&) =
delete
;
59
60
/**
61
* \return the correct packet size (header plus payload).
62
*/
63
uint32_t
GetSize
()
const override
;
64
65
/**
66
* \return the header stored in this item..
67
*/
68
const
ArpHeader
&
GetHeader
()
const
;
69
70
/**
71
* \brief Add the header to the packet
72
*/
73
void
AddHeader
()
override
;
74
75
/**
76
* \brief Print the item contents.
77
* \param os output stream in which the data should be printed.
78
*/
79
void
Print
(std::ostream& os)
const override
;
80
81
/**
82
* \brief Inherited from the base class, but we cannot mark ARP packets
83
* \return false
84
*/
85
bool
Mark
()
override
;
86
87
/**
88
* \brief Computes the hash of the packet's 5-tuple
89
*
90
* \param perturbation hash perturbation value
91
* \return the hash of the packet's 5-tuple
92
*/
93
uint32_t
Hash
(
uint32_t
perturbation)
const override
;
94
95
private
:
96
ArpHeader
m_header
;
//!< The ARP header.
97
bool
m_headerAdded
;
//!< True if the header has already been added to the packet.
98
};
99
100
}
// namespace ns3
101
102
#endif
/* ARP_QUEUE_DISC_ITEM_H */
arp-header.h
ns3::Address
a polymophic address class
Definition:
address.h:101
ns3::ArpHeader
The packet header for an ARP packet.
Definition:
arp-header.h:36
ns3::ArpQueueDiscItem
ArpQueueDiscItem is a subclass of QueueDiscItem which stores ARP packets.
Definition:
arp-queue-disc-item.h:38
ns3::ArpQueueDiscItem::AddHeader
void AddHeader() override
Add the header to the packet.
Definition:
arp-queue-disc-item.cc:65
ns3::ArpQueueDiscItem::m_header
ArpHeader m_header
The ARP header.
Definition:
arp-queue-disc-item.h:96
ns3::ArpQueueDiscItem::ArpQueueDiscItem
ArpQueueDiscItem()=delete
ns3::ArpQueueDiscItem::GetHeader
const ArpHeader & GetHeader() const
Definition:
arp-queue-disc-item.cc:59
ns3::ArpQueueDiscItem::m_headerAdded
bool m_headerAdded
True if the header has already been added to the packet.
Definition:
arp-queue-disc-item.h:97
ns3::ArpQueueDiscItem::Hash
uint32_t Hash(uint32_t perturbation) const override
Computes the hash of the packet's 5-tuple.
Definition:
arp-queue-disc-item.cc:97
ns3::ArpQueueDiscItem::operator=
ArpQueueDiscItem & operator=(const ArpQueueDiscItem &)=delete
ns3::ArpQueueDiscItem::Print
void Print(std::ostream &os) const override
Print the item contents.
Definition:
arp-queue-disc-item.cc:77
ns3::ArpQueueDiscItem::ArpQueueDiscItem
ArpQueueDiscItem(const ArpQueueDiscItem &)=delete
ns3::ArpQueueDiscItem::Mark
bool Mark() override
Inherited from the base class, but we cannot mark ARP packets.
Definition:
arp-queue-disc-item.cc:90
ns3::ArpQueueDiscItem::GetSize
uint32_t GetSize() const override
Definition:
arp-queue-disc-item.cc:45
ns3::ArpQueueDiscItem::~ArpQueueDiscItem
~ArpQueueDiscItem() override
Destructor.
Definition:
arp-queue-disc-item.cc:39
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
ns3::QueueDiscItem
QueueDiscItem is the abstract base class for items that are stored in a queue disc.
Definition:
queue-item.h:133
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
internet
model
arp-queue-disc-item.h
Generated on Tue May 28 2024 23:35:40 for ns-3 by
1.9.6