A Discrete-Event Network Simulator
API
ipv4-queue-disc-item.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2016 Universita' degli Studi di Napoli Federico II
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */
18 
19 #ifndef IPV4_QUEUE_DISC_ITEM_H
20 #define IPV4_QUEUE_DISC_ITEM_H
21 
22 #include "ns3/packet.h"
23 #include "ns3/object.h"
24 #include "ns3/net-device.h"
25 #include "ns3/traced-value.h"
26 #include "ns3/queue-disc.h"
27 #include "ipv4-header.h"
28 
29 namespace ns3 {
30 
40 public:
48  Ipv4QueueDiscItem (Ptr<Packet> p, const Address & addr, uint16_t protocol, const Ipv4Header & header);
49 
50  virtual ~Ipv4QueueDiscItem ();
51 
55  virtual uint32_t GetPacketSize (void) const;
56 
60  const Ipv4Header & GetHeader (void) const;
61 
65  virtual void AddHeader (void);
66 
71  virtual void Print (std::ostream &os) const;
72 
73  /*
74  * The values for the fields of the Ipv4 header are taken from m_header and
75  * thus might differ from those present in the packet in case the header is
76  * modified after being added to the packet. However, this function is likely
77  * to be called before the header is added to the packet (i.e., before the
78  * packet is dequeued from the queue disc)
79  */
80  virtual bool GetUint8Value (Uint8Values field, uint8_t &value) const;
81 
82 private:
102 
105 };
106 
107 } // namespace ns3
108 
109 #endif /* IPV4_QUEUE_DISC_ITEM_H */
Ipv4QueueDiscItem & operator=(const Ipv4QueueDiscItem &)
Assignment operator.
Ipv4Header m_header
The IPv4 header.
virtual void Print(std::ostream &os) const
Print the item contents.
QueueDiscItem is the abstract base class for items that are stored in a queue disc.
Definition: queue-disc.h:43
Ipv4QueueDiscItem()
Default constructor.
a polymophic address class
Definition: address.h:90
Packet header for IPv4.
Definition: ipv4-header.h:33
const Ipv4Header & GetHeader(void) const
virtual bool GetUint8Value(Uint8Values field, uint8_t &value) const
Retrieve the value of a given field from the packet, if present.
virtual uint32_t GetPacketSize(void) const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ipv4QueueDiscItem is a subclass of QueueDiscItem which stores IPv4 packets.
Uint8Values
1-byte fields of the packet whose value can be retrieved, if present
Definition: net-device.h:86
virtual void AddHeader(void)
Add the header to the packet.
bool m_headerAdded
True if the header has already been added to the packet.