A Discrete-Event Network Simulator
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 * 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 IPV4_QUEUE_DISC_ITEM_H
19#define IPV4_QUEUE_DISC_ITEM_H
20
21#include "ipv4-header.h"
22
23#include "ns3/packet.h"
24#include "ns3/queue-item.h"
25
26namespace ns3
27{
28
38{
39 public:
48 const Address& addr,
49 uint16_t protocol,
50 const Ipv4Header& header);
51
52 ~Ipv4QueueDiscItem() override;
53
54 // Delete default constructor, copy constructor and assignment operator to avoid misuse
58
62 uint32_t GetSize() const override;
63
67 const Ipv4Header& GetHeader() const;
68
72 void AddHeader() override;
73
78 void Print(std::ostream& os) const override;
79
80 /*
81 * The values for the fields of the Ipv4 header are taken from m_header and
82 * thus might differ from those present in the packet in case the header is
83 * modified after being added to the packet. However, this function is likely
84 * to be called before the header is added to the packet (i.e., before the
85 * packet is dequeued from the queue disc)
86 */
87 bool GetUint8Value(Uint8Values field, uint8_t& value) const override;
88
94 bool Mark() override;
95
106 uint32_t Hash(uint32_t perturbation) const override;
107
108 private:
111};
112
113} // namespace ns3
114
115#endif /* IPV4_QUEUE_DISC_ITEM_H */
a polymophic address class
Definition: address.h:101
Packet header for IPv4.
Definition: ipv4-header.h:34
Ipv4QueueDiscItem is a subclass of QueueDiscItem which stores IPv4 packets.
bool m_headerAdded
True if the header has already been added to the packet.
const Ipv4Header & GetHeader() const
Ipv4Header m_header
The IPv4 header.
uint32_t Hash(uint32_t perturbation) const override
Computes the hash of the packet's 5-tuple.
Ipv4QueueDiscItem(const Ipv4QueueDiscItem &)=delete
Ipv4QueueDiscItem & operator=(const Ipv4QueueDiscItem &)=delete
void AddHeader() override
Add the header to the packet.
bool GetUint8Value(Uint8Values field, uint8_t &value) const override
Retrieve the value of a given field from the packet, if present.
bool Mark() override
Marks the packet by setting ECN_CE bits if the packet has ECN_ECT0 or ECN_ECT1 set.
void Print(std::ostream &os) const override
Print the item contents.
uint32_t GetSize() const override
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
QueueDiscItem is the abstract base class for items that are stored in a queue disc.
Definition: queue-item.h:133
Uint8Values
1-byte fields of the packet whose value can be retrieved, if present
Definition: queue-item.h:82
Every class exported by the ns3 library is enclosed in the ns3 namespace.