A Discrete-Event Network Simulator
API
ns3::Ipv4QueueDiscItem Class Reference

Ipv4QueueDiscItem is a subclass of QueueDiscItem which stores IPv4 packets. More...

#include "ipv4-queue-disc-item.h"

+ Inheritance diagram for ns3::Ipv4QueueDiscItem:
+ Collaboration diagram for ns3::Ipv4QueueDiscItem:

Public Member Functions

 Ipv4QueueDiscItem (Ptr< Packet > p, const Address &addr, uint16_t protocol, const Ipv4Header &header)
 Create an IPv4 queue disc item containing an IPv4 packet. More...
 
virtual ~Ipv4QueueDiscItem ()
 
virtual void AddHeader (void)
 Add the header to the packet. More...
 
const Ipv4HeaderGetHeader (void) const
 
virtual uint32_t GetSize (void) const
 
virtual bool GetUint8Value (Uint8Values field, uint8_t &value) const
 Retrieve the value of a given field from the packet, if present. More...
 
virtual uint32_t Hash (uint32_t perturbation) const
 Computes the hash of the packet's 5-tuple. More...
 
virtual bool Mark (void)
 Marks the packet by setting ECN_CE bits if the packet has ECN_ECT0 or ECN_ECT1 set. More...
 
virtual void Print (std::ostream &os) const
 Print the item contents. More...
 
- Public Member Functions inherited from ns3::QueueDiscItem
 QueueDiscItem (Ptr< Packet > p, const Address &addr, uint16_t protocol)
 Create a queue disc item. More...
 
virtual ~QueueDiscItem ()
 
Address GetAddress (void) const
 Get the MAC address included in this item. More...
 
uint16_t GetProtocol (void) const
 Get the L3 protocol included in this item. More...
 
Time GetTimeStamp (void) const
 Get the timestamp included in this item. More...
 
uint8_t GetTxQueueIndex (void) const
 Get the transmission queue index included in this item. More...
 
void SetTimeStamp (Time t)
 Set the timestamp included in this item. More...
 
void SetTxQueueIndex (uint8_t txq)
 Set the transmission queue index to store in this item. More...
 
- Public Member Functions inherited from ns3::QueueItem
 QueueItem (Ptr< Packet > p)
 Create a queue item containing a packet. More...
 
virtual ~QueueItem ()
 
Ptr< PacketGetPacket (void) const
 
- Public Member Functions inherited from ns3::SimpleRefCount< QueueItem >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 

Private Member Functions

 Ipv4QueueDiscItem ()
 Default constructor. More...
 
 Ipv4QueueDiscItem (const Ipv4QueueDiscItem &)
 Copy constructor. More...
 
Ipv4QueueDiscItemoperator= (const Ipv4QueueDiscItem &)
 Assignment operator. More...
 

Private Attributes

Ipv4Header m_header
 The IPv4 header. More...
 
bool m_headerAdded
 True if the header has already been added to the packet. More...
 

Additional Inherited Members

- Public Types inherited from ns3::QueueItem
typedef void(* TracedCallback) (Ptr< const QueueItem > item)
 TracedCallback signature for Ptr<QueueItem> More...
 
enum  Uint8Values { IP_DSFIELD }
 1-byte fields of the packet whose value can be retrieved, if present More...
 

Detailed Description

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 36 of file ipv4-queue-disc-item.h.

Constructor & Destructor Documentation

◆ Ipv4QueueDiscItem() [1/3]

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.

Parameters
pthe packet included in the created item.
addrthe destination MAC address
protocolthe protocol number
headerthe IPv4 header

Definition at line 28 of file ipv4-queue-disc-item.cc.

◆ ~Ipv4QueueDiscItem()

ns3::Ipv4QueueDiscItem::~Ipv4QueueDiscItem ( )
virtual

Definition at line 36 of file ipv4-queue-disc-item.cc.

References NS_LOG_FUNCTION.

◆ Ipv4QueueDiscItem() [2/3]

ns3::Ipv4QueueDiscItem::Ipv4QueueDiscItem ( )
private

Default constructor.

Defined and unimplemented to avoid misuse

◆ Ipv4QueueDiscItem() [3/3]

ns3::Ipv4QueueDiscItem::Ipv4QueueDiscItem ( const Ipv4QueueDiscItem )
private

Copy constructor.

Defined and unimplemented to avoid misuse

Member Function Documentation

◆ AddHeader()

void ns3::Ipv4QueueDiscItem::AddHeader ( void  )
virtual

Add the header to the packet.

Implements ns3::QueueDiscItem.

Definition at line 60 of file ipv4-queue-disc-item.cc.

References ns3::Packet::AddHeader(), ns3::QueueItem::GetPacket(), m_header, m_headerAdded, NS_ASSERT, NS_ASSERT_MSG(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ GetHeader()

const Ipv4Header & ns3::Ipv4QueueDiscItem::GetHeader ( void  ) const
Returns
the header stored in this item..

Definition at line 55 of file ipv4-queue-disc-item.cc.

References m_header.

Referenced by UdpSocketImplTest::GetTos(), and UdpSocketImplTest::SentPkt().

+ Here is the caller graph for this function:

◆ GetSize()

uint32_t ns3::Ipv4QueueDiscItem::GetSize ( void  ) const
virtual
Returns
the correct packet size (header plus payload).

Reimplemented from ns3::QueueItem.

Definition at line 41 of file ipv4-queue-disc-item.cc.

References ns3::QueueItem::GetPacket(), ns3::Ipv4Header::GetSerializedSize(), ns3::Packet::GetSize(), m_header, m_headerAdded, NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ GetUint8Value()

bool ns3::Ipv4QueueDiscItem::GetUint8Value ( QueueItem::Uint8Values  field,
uint8_t &  value 
) const
virtual

Retrieve the value of a given field from the packet, if present.

Parameters
fieldthe field whose value has to be retrieved
valuethe output parameter to store the retrieved value
Returns
true if the requested field is present in the packet, false otherwise.

Reimplemented from ns3::QueueItem.

Definition at line 99 of file ipv4-queue-disc-item.cc.

References ns3::Ipv4Header::GetTos(), ns3::QueueItem::IP_DSFIELD, and m_header.

+ Here is the call graph for this function:

◆ Hash()

uint32_t ns3::Ipv4QueueDiscItem::Hash ( uint32_t  perturbation) const
virtual

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

Parameters
perturbationhash perturbation value
Returns
the hash of the packet's 5-tuple

Reimplemented from ns3::QueueDiscItem.

Definition at line 115 of file ipv4-queue-disc-item.cc.

References ns3::Ipv4Header::GetDestination(), ns3::UdpHeader::GetDestinationPort(), ns3::TcpHeader::GetDestinationPort(), ns3::Ipv4Header::GetFragmentOffset(), ns3::QueueItem::GetPacket(), ns3::Ipv4Header::GetProtocol(), ns3::Ipv4Header::GetSource(), ns3::UdpHeader::GetSourcePort(), ns3::TcpHeader::GetSourcePort(), hash, ns3::Hash32(), m_header, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_WARN, ns3::Packet::PeekHeader(), and ns3::Ipv4Address::Serialize().

+ Here is the call graph for this function:

◆ Mark()

bool ns3::Ipv4QueueDiscItem::Mark ( void  )
virtual

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.

Returns
true if the method results in a marked packet, false otherwise

Implements ns3::QueueDiscItem.

Definition at line 86 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().

+ Here is the call graph for this function:

◆ operator=()

Ipv4QueueDiscItem& ns3::Ipv4QueueDiscItem::operator= ( const Ipv4QueueDiscItem )
private

Assignment operator.

Defined and unimplemented to avoid misuse

Returns

◆ Print()

void ns3::Ipv4QueueDiscItem::Print ( std::ostream &  os) const
virtual

Print the item contents.

Parameters
osoutput stream in which the data should be printed.

Reimplemented from ns3::QueueDiscItem.

Definition at line 72 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.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_header

Ipv4Header ns3::Ipv4QueueDiscItem::m_header
private

The IPv4 header.

Definition at line 119 of file ipv4-queue-disc-item.h.

Referenced by AddHeader(), GetHeader(), GetSize(), GetUint8Value(), Hash(), Mark(), and Print().

◆ m_headerAdded

bool ns3::Ipv4QueueDiscItem::m_headerAdded
private

True if the header has already been added to the packet.

Definition at line 120 of file ipv4-queue-disc-item.h.

Referenced by AddHeader(), GetSize(), Mark(), and Print().


The documentation for this class was generated from the following files: