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

Base class to represent items of packet Queues. More...

#include "queue-item.h"

+ Inheritance diagram for ns3::QueueItem:
+ Collaboration diagram for ns3::QueueItem:

Public Types

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

Public Member Functions

 QueueItem ()=delete
 
 QueueItem (const QueueItem &)=delete
 
 QueueItem (Ptr< Packet > p)
 Create a queue item containing a packet. More...
 
virtual ~QueueItem ()
 
Ptr< PacketGetPacket (void) const
 
virtual uint32_t GetSize (void) const
 Use this method (instead of GetPacket ()->GetSize ()) to get the packet size. More...
 
virtual bool GetUint8Value (Uint8Values field, uint8_t &value) const
 Retrieve the value of a given field from the packet, if present. More...
 
QueueItemoperator= (const QueueItem &)=delete
 
virtual void Print (std::ostream &os) const
 Print the item contents. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< QueueItem >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o[[maybe_unused]])
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= ([[maybe_unused]] 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 Attributes

Ptr< Packetm_packet
 The packet contained in the queue item. More...
 

Detailed Description

Base class to represent items of packet Queues.

An item stored in an ns-3 packet Queue contains a packet and possibly other information. An item of the base class only contains a packet. Subclasses can be derived from this base class to allow items to contain additional information.

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

Member Typedef Documentation

◆ TracedCallback

typedef void(* ns3::QueueItem::TracedCallback) (Ptr< const QueueItem > item)

TracedCallback signature for Ptr<QueueItem>

Parameters
[in]itemThe queue item.

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

Member Enumeration Documentation

◆ Uint8Values

1-byte fields of the packet whose value can be retrieved, if present

Enumerator
IP_DSFIELD 

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

Constructor & Destructor Documentation

◆ QueueItem() [1/3]

ns3::QueueItem::QueueItem ( Ptr< Packet p)

Create a queue item containing a packet.

Parameters
pthe packet included in the created item.

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

References m_packet, and NS_LOG_FUNCTION.

◆ ~QueueItem()

ns3::QueueItem::~QueueItem ( )
virtual

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

References m_packet, and NS_LOG_FUNCTION.

◆ QueueItem() [2/3]

ns3::QueueItem::QueueItem ( )
delete

◆ QueueItem() [3/3]

ns3::QueueItem::QueueItem ( const QueueItem )
delete

Member Function Documentation

◆ GetPacket()

◆ GetSize()

uint32_t ns3::QueueItem::GetSize ( void  ) const
virtual

Use this method (instead of GetPacket ()->GetSize ()) to get the packet size.

Subclasses may keep header and payload separate to allow manipulating the header, so using this method ensures that the correct packet size is returned.

Returns
the size of the packet included in this item.

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

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

References ns3::Packet::GetSize(), m_packet, NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ GetUint8Value()

bool ns3::QueueItem::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 in ns3::Ipv6QueueDiscItem, and ns3::Ipv4QueueDiscItem.

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

References NS_LOG_FUNCTION.

◆ operator=()

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

◆ Print()

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

Print the item contents.

Parameters
osoutput stream in which the data should be printed.

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

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

References GetPacket().

Referenced by ns3::operator<<().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_packet

Ptr<Packet> ns3::QueueItem::m_packet
private

The packet contained in the queue item.

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

Referenced by QueueItem(), ~QueueItem(), GetPacket(), and GetSize().


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