A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::QueueDiscItem Class Referenceabstract

QueueDiscItem is the abstract base class for items that are stored in a queue disc. More...

#include "queue-item.h"

+ Inheritance diagram for ns3::QueueDiscItem:
+ Collaboration diagram for ns3::QueueDiscItem:

Public Member Functions

 QueueDiscItem ()=delete
 
 QueueDiscItem (const QueueDiscItem &)=delete
 
 QueueDiscItem (Ptr< Packet > p, const Address &addr, uint16_t protocol)
 Create a queue disc item.
 
 ~QueueDiscItem () override
 
virtual void AddHeader ()=0
 Add the header to the packet.
 
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.
 
virtual uint32_t Hash (uint32_t perturbation=0) const
 Computes the hash of various fields of the packet header.
 
virtual bool Mark ()=0
 Marks the packet as a substitute for dropping it, such as for Explicit Congestion Notification.
 
QueueDiscItemoperator= (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< PacketGetPacket () const
 
virtual uint32_t GetSize () const
 Use this method (instead of GetPacket ()->GetSize ()) to get the packet size.
 
virtual bool GetUint8Value (Uint8Values field, uint8_t &value) const
 Retrieve the value of a given field from the packet, if present.
 
QueueItemoperator= (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.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 

Private Attributes

Address m_address
 MAC destination address.
 
uint16_t m_protocol
 L3 Protocol number.
 
Time m_tstamp
 timestamp when the packet was enqueued
 
uint8_t m_txq
 Transmission queue index.
 

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...
 

Detailed Description

QueueDiscItem is the abstract base class for items that are stored in a queue disc.

It is derived from QueueItem (which only consists of a Ptr<Packet>) to additionally store the destination MAC address, the L3 protocol number and the transmission queue index,

Definition at line 121 of file queue-item.h.

Constructor & Destructor Documentation

◆ QueueDiscItem() [1/3]

ns3::QueueDiscItem::QueueDiscItem ( Ptr< Packet > p,
const Address & addr,
uint16_t protocol )

Create a queue disc item.

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

Definition at line 66 of file queue-item.cc.

References NS_LOG_FUNCTION.

◆ ~QueueDiscItem()

ns3::QueueDiscItem::~QueueDiscItem ( )
override

Definition at line 75 of file queue-item.cc.

References NS_LOG_FUNCTION.

◆ QueueDiscItem() [2/3]

ns3::QueueDiscItem::QueueDiscItem ( )
delete

◆ QueueDiscItem() [3/3]

ns3::QueueDiscItem::QueueDiscItem ( const QueueDiscItem & )
delete

Member Function Documentation

◆ AddHeader()

virtual void ns3::QueueDiscItem::AddHeader ( )
pure virtual

Add the header to the packet.

Subclasses may keep header and payload separate to allow manipulating the header, so this method allows to add the header to the packet before sending the packet to the device.

Implemented in AredQueueDiscTestItem, CobaltQueueDiscTestItem, CodelQueueDiscTestItem, FifoQueueDiscTestItem, ns3::ArpQueueDiscItem, ns3::Ipv4QueueDiscItem, ns3::Ipv6QueueDiscItem, PieQueueDiscTestItem, PrioQueueDiscTestItem, QdTestItem, QueueDiscTestItem, RedQueueDiscTestItem, and TbfQueueDiscTestItem.

◆ GetAddress()

Address ns3::QueueDiscItem::GetAddress ( ) const

Get the MAC address included in this item.

Returns
the MAC address included in this item.

Definition at line 81 of file queue-item.cc.

References m_address, and NS_LOG_FUNCTION.

Referenced by ns3::ArpQueueDiscItem::Print(), ns3::Ipv4QueueDiscItem::Print(), and ns3::Ipv6QueueDiscItem::Print().

+ Here is the caller graph for this function:

◆ GetProtocol()

uint16_t ns3::QueueDiscItem::GetProtocol ( ) const

Get the L3 protocol included in this item.

Returns
the L3 protocol included in this item.

Definition at line 88 of file queue-item.cc.

References m_protocol, and NS_LOG_FUNCTION.

Referenced by ns3::ArpQueueDiscItem::Print(), ns3::Ipv4QueueDiscItem::Print(), and ns3::Ipv6QueueDiscItem::Print().

+ Here is the caller graph for this function:

◆ GetTimeStamp()

Time ns3::QueueDiscItem::GetTimeStamp ( ) const

Get the timestamp included in this item.

Returns
the timestamp included in this item.

Definition at line 109 of file queue-item.cc.

References m_tstamp, and NS_LOG_FUNCTION.

◆ GetTxQueueIndex()

uint8_t ns3::QueueDiscItem::GetTxQueueIndex ( ) const

Get the transmission queue index included in this item.

Returns
the transmission queue index included in this item.

Definition at line 95 of file queue-item.cc.

References m_txq, and NS_LOG_FUNCTION.

Referenced by ns3::ArpQueueDiscItem::Print(), ns3::Ipv4QueueDiscItem::Print(), and ns3::Ipv6QueueDiscItem::Print().

+ Here is the caller graph for this function:

◆ Hash()

uint32_t ns3::QueueDiscItem::Hash ( uint32_t perturbation = 0) const
virtual

Computes the hash of various fields of the packet header.

This method just returns 0. Subclasses should implement a reasonable hash for their protocol type, such as hashing on the TCP/IP 5-tuple.

Parameters
perturbationhash perturbation value
Returns
the hash of various fields of the packet header

Reimplemented in ns3::ArpQueueDiscItem, ns3::Ipv4QueueDiscItem, and ns3::Ipv6QueueDiscItem.

Definition at line 132 of file queue-item.cc.

References NS_LOG_WARN.

Referenced by Mark().

+ Here is the caller graph for this function:

◆ Mark()

virtual bool ns3::QueueDiscItem::Mark ( )
pure virtual

Marks the packet as a substitute for dropping it, such as for Explicit Congestion Notification.

Returns
true if the packet is marked by this method or is already marked, false otherwise

Implemented in AredQueueDiscTestItem, CobaltQueueDiscTestItem, CodelQueueDiscTestItem, FifoQueueDiscTestItem, ns3::ArpQueueDiscItem, ns3::Ipv4QueueDiscItem, ns3::Ipv6QueueDiscItem, PieQueueDiscTestItem, PrioQueueDiscTestItem, QdTestItem, QueueDiscTestItem, RedQueueDiscTestItem, and TbfQueueDiscTestItem.

References Hash().

+ Here is the call graph for this function:

◆ operator=()

QueueDiscItem & ns3::QueueDiscItem::operator= ( const QueueDiscItem & )
delete

◆ Print()

void ns3::QueueDiscItem::Print ( std::ostream & os) const
overridevirtual

Print the item contents.

Parameters
osoutput stream in which the data should be printed.

Reimplemented from ns3::QueueItem.

Definition at line 123 of file queue-item.cc.

References ns3::QueueItem::GetPacket(), m_address, m_protocol, and m_txq.

+ Here is the call graph for this function:

◆ SetTimeStamp()

void ns3::QueueDiscItem::SetTimeStamp ( Time t)

Set the timestamp included in this item.

Parameters
tthe timestamp to include in this item.

Definition at line 116 of file queue-item.cc.

References m_tstamp, and NS_LOG_FUNCTION.

◆ SetTxQueueIndex()

void ns3::QueueDiscItem::SetTxQueueIndex ( uint8_t txq)

Set the transmission queue index to store in this item.

Parameters
txqthe transmission queue index to store in this item.

Definition at line 102 of file queue-item.cc.

References m_txq, and NS_LOG_FUNCTION.

Member Data Documentation

◆ m_address

Address ns3::QueueDiscItem::m_address
private

MAC destination address.

Definition at line 210 of file queue-item.h.

Referenced by GetAddress(), and Print().

◆ m_protocol

uint16_t ns3::QueueDiscItem::m_protocol
private

L3 Protocol number.

Definition at line 211 of file queue-item.h.

Referenced by GetProtocol(), and Print().

◆ m_tstamp

Time ns3::QueueDiscItem::m_tstamp
private

timestamp when the packet was enqueued

Definition at line 213 of file queue-item.h.

Referenced by GetTimeStamp(), and SetTimeStamp().

◆ m_txq

uint8_t ns3::QueueDiscItem::m_txq
private

Transmission queue index.

Definition at line 212 of file queue-item.h.

Referenced by GetTxQueueIndex(), Print(), and SetTxQueueIndex().


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