Ipv4QueueDiscItem is a subclass of QueueDiscItem which stores IPv4 packets. More...
#include "ipv4-queue-disc-item.h"
Public Member Functions | |
Ipv4QueueDiscItem ()=delete | |
Ipv4QueueDiscItem (const Ipv4QueueDiscItem &)=delete | |
Ipv4QueueDiscItem (Ptr< Packet > p, const Address &addr, uint16_t protocol, const Ipv4Header &header) | |
Create an IPv4 queue disc item containing an IPv4 packet. | |
~Ipv4QueueDiscItem () override | |
void | AddHeader () override |
Add the header to the packet. | |
const Ipv4Header & | GetHeader () const |
uint32_t | GetSize () const override |
bool | GetUint8Value (Uint8Values field, uint8_t &value) const override |
Retrieve the value of a given field from the packet, if present. | |
uint32_t | Hash (uint32_t perturbation) const override |
Computes the hash of the packet's 5-tuple. | |
bool | Mark () override |
Marks the packet by setting ECN_CE bits if the packet has ECN_ECT0 or ECN_ECT1 set. | |
Ipv4QueueDiscItem & | operator= (const Ipv4QueueDiscItem &)=delete |
void | Print (std::ostream &os) const override |
Print the item contents. | |
Public Member Functions inherited from ns3::QueueDiscItem | |
QueueDiscItem ()=delete | |
QueueDiscItem (const QueueDiscItem &)=delete | |
QueueDiscItem (Ptr< Packet > p, const Address &addr, uint16_t protocol) | |
Create a queue disc item. | |
~QueueDiscItem () override | |
Address | GetAddress () const |
Get the MAC address included in this item. | |
uint16_t | GetProtocol () const |
Get the L3 protocol included in this item. | |
Time | GetTimeStamp () const |
Get the timestamp included in this item. | |
uint8_t | GetTxQueueIndex () const |
Get the transmission queue index included in this item. | |
QueueDiscItem & | operator= (const QueueDiscItem &)=delete |
void | Print (std::ostream &os) const override |
Print the item contents. | |
void | SetTimeStamp (Time t) |
Set the timestamp included in this item. | |
void | SetTxQueueIndex (uint8_t txq) |
Set the transmission queue index to store in this item. | |
Public Member Functions inherited from ns3::QueueItem | |
QueueItem ()=delete | |
QueueItem (const QueueItem &)=delete | |
QueueItem (Ptr< Packet > p) | |
Create a queue item containing a packet. | |
virtual | ~QueueItem () |
Ptr< Packet > | GetPacket () const |
QueueItem & | operator= (const QueueItem &)=delete |
Public Member Functions inherited from ns3::SimpleRefCount< QueueItem > | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Private Attributes | |
Ipv4Header | m_header |
The IPv4 header. | |
bool | m_headerAdded |
True if the header has already been added to the packet. | |
Additional Inherited Members | |
Public Types inherited from ns3::QueueItem | |
typedef void(* | TracedCallback) (Ptr< const QueueItem > item) |
TracedCallback signature for Ptr<QueueItem> | |
enum | Uint8Values { IP_DSFIELD } |
1-byte fields of the packet whose value can be retrieved, if present More... | |
Ipv4QueueDiscItem is a subclass of QueueDiscItem which stores IPv4 packets.
Header and payload are kept separate to allow the queue disc to manipulate the header, which is added to the packet when the packet is dequeued.
Definition at line 26 of file ipv4-queue-disc-item.h.
ns3::Ipv4QueueDiscItem::Ipv4QueueDiscItem | ( | Ptr< Packet > | p, |
const Address & | addr, | ||
uint16_t | protocol, | ||
const Ipv4Header & | header ) |
Create an IPv4 queue disc item containing an IPv4 packet.
p | the packet included in the created item. |
addr | the destination MAC address |
protocol | the protocol number |
header | the IPv4 header |
Definition at line 19 of file ipv4-queue-disc-item.cc.
|
override |
Definition at line 29 of file ipv4-queue-disc-item.cc.
References NS_LOG_FUNCTION.
|
delete |
|
delete |
|
overridevirtual |
Add the header to the packet.
Implements ns3::QueueDiscItem.
Definition at line 55 of file ipv4-queue-disc-item.cc.
References ns3::QueueItem::GetPacket(), m_header, m_headerAdded, NS_ASSERT, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
const Ipv4Header & ns3::Ipv4QueueDiscItem::GetHeader | ( | ) | const |
Definition at line 49 of file ipv4-queue-disc-item.cc.
References m_header.
|
overridevirtual |
Reimplemented from ns3::QueueItem.
Definition at line 35 of file ipv4-queue-disc-item.cc.
References ns3::QueueItem::GetPacket(), ns3::Ipv4Header::GetSerializedSize(), m_header, m_headerAdded, NS_ASSERT, and NS_LOG_FUNCTION.
|
overridevirtual |
Retrieve the value of a given field from the packet, if present.
field | the field whose value has to be retrieved |
value | the output parameter to store the retrieved value |
Reimplemented from ns3::QueueItem.
Definition at line 92 of file ipv4-queue-disc-item.cc.
References ns3::Ipv4Header::GetTos(), ns3::QueueItem::IP_DSFIELD, and m_header.
Computes the hash of the packet's 5-tuple.
Computes the hash of the source and destination IP addresses, protocol number and, if the transport protocol is either UDP or TCP, the source and destination port
perturbation | hash perturbation value |
Reimplemented from ns3::QueueDiscItem.
Definition at line 108 of file ipv4-queue-disc-item.cc.
References ns3::Ipv4Header::GetDestination(), ns3::TcpHeader::GetDestinationPort(), ns3::UdpHeader::GetDestinationPort(), ns3::Ipv4Header::GetFragmentOffset(), ns3::QueueItem::GetPacket(), ns3::Ipv4Header::GetProtocol(), ns3::Ipv4Header::GetSource(), ns3::TcpHeader::GetSourcePort(), ns3::UdpHeader::GetSourcePort(), ns3::Hash32(), m_header, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_WARN, ns3::Packet::PeekHeader(), and ns3::Ipv4Address::Serialize().
Referenced by operator=().
|
overridevirtual |
Marks the packet by setting ECN_CE bits if the packet has ECN_ECT0 or ECN_ECT1 set.
If ECN_CE is already set, returns true.
Implements ns3::QueueDiscItem.
Definition at line 80 of file ipv4-queue-disc-item.cc.
References ns3::Ipv4Header::ECN_CE, ns3::Ipv4Header::ECN_NotECT, ns3::Ipv4Header::GetEcn(), m_header, m_headerAdded, NS_LOG_FUNCTION, and ns3::Ipv4Header::SetEcn().
|
delete |
|
overridevirtual |
Print the item contents.
os | output stream in which the data should be printed. |
Reimplemented from ns3::QueueItem.
Definition at line 67 of file ipv4-queue-disc-item.cc.
References ns3::QueueDiscItem::GetAddress(), ns3::QueueItem::GetPacket(), ns3::QueueDiscItem::GetProtocol(), ns3::QueueDiscItem::GetTxQueueIndex(), m_header, and m_headerAdded.
|
private |
The IPv4 header.
Definition at line 98 of file ipv4-queue-disc-item.h.
Referenced by AddHeader(), GetHeader(), GetSize(), GetUint8Value(), Hash(), Mark(), and Print().
|
private |
True if the header has already been added to the packet.
Definition at line 99 of file ipv4-queue-disc-item.h.
Referenced by AddHeader(), GetSize(), Mark(), and Print().