A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::RedQueue Class Reference

#include <red-queue.h>

+ Inheritance diagram for ns3::RedQueue:
+ Collaboration diagram for ns3::RedQueue:

Classes

struct  Stats

Public Types

enum  { DTYPE_NONE, DTYPE_FORCED, DTYPE_UNFORCED }
- Public Types inherited from ns3::Queue
enum  QueueMode { QUEUE_MODE_PACKETS, QUEUE_MODE_BYTES }
 Enumeration of the modes supported in the class. More...

Public Member Functions

 RedQueue ()
virtual ~RedQueue ()
int64_t AssignStreams (int64_t stream)
RedQueue::QueueMode GetMode (void)
uint32_t GetQueueSize (void)
Stats GetStats ()
void SetMode (RedQueue::QueueMode mode)
void SetQueueLimit (uint32_t lim)
void SetTh (double minTh, double maxTh)
- Public Member Functions inherited from ns3::Queue
 Queue ()
virtual ~Queue ()
Ptr< PacketDequeue (void)
void DequeueAll (void)
bool Enqueue (Ptr< Packet > p)
uint32_t GetNBytes (void) const
uint32_t GetNPackets (void) const
uint32_t GetTotalDroppedBytes (void) const
uint32_t GetTotalDroppedPackets (void) const
uint32_t GetTotalReceivedBytes (void) const
uint32_t GetTotalReceivedPackets (void) const
bool IsEmpty (void) const
Ptr< const PacketPeek (void) const
void ResetStatistics (void)
- Public Member Functions inherited from ns3::Object
 Object ()
virtual ~Object ()
void AggregateObject (Ptr< Object > other)
void Dispose (void)
AggregateIterator GetAggregateIterator (void) const
virtual TypeId GetInstanceTypeId (void) const
template<typename T >
Ptr< T > GetObject (void) const
template<typename T >
Ptr< T > GetObject (TypeId tid) const
void Start (void)
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 SimpleRefCount (const SimpleRefCount &o)
uint32_t GetReferenceCount (void) const
SimpleRefCountoperator= (const SimpleRefCount &o)
void Ref (void) const
void Unref (void) const
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
void GetAttribute (std::string name, AttributeValue &value) const
bool GetAttributeFailSafe (std::string name, AttributeValue &attribute) const
void SetAttribute (std::string name, const AttributeValue &value)
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)

Static Public Member Functions

static TypeId GetTypeId (void)
 This method returns the TypeId associated to ns3::RedQueue.

Private Member Functions

double CalculatePNew (double qAvg, double maxTh, bool gentle, double vA, double vB, double vC, double vD, double maxP)
virtual Ptr< PacketDoDequeue (void)
virtual bool DoEnqueue (Ptr< Packet > p)
virtual Ptr< const PacketDoPeek (void) const
uint32_t DropEarly (Ptr< Packet > p, uint32_t qSize)
double Estimator (uint32_t nQueued, uint32_t m, double qAvg, double qW)
void InitializeParams (void)
double ModifyP (double p, uint32_t count, uint32_t countBytes, uint32_t meanPktSize, bool wait, uint32_t size)

Private Attributes

uint32_t m_bytesInQueue
uint32_t m_cautious
uint32_t m_count
uint32_t m_countBytes
double m_curMaxP
bool m_hasRedStarted
uint32_t m_idle
uint32_t m_idlePktSize
Time m_idleTime
bool m_isGentle
bool m_isNs1Compat
bool m_isWait
DataRate m_linkBandwidth
Time m_linkDelay
double m_lInterm
double m_maxTh
uint32_t m_meanPktSize
double m_minTh
QueueMode m_mode
uint32_t m_old
std::list< Ptr< Packet > > m_packets
double m_ptc
double m_qAvg
uint32_t m_queueLimit
double m_qW
Stats m_stats
Ptr< UniformRandomVariablem_uv
double m_vA
double m_vB
double m_vC
double m_vD
double m_vProb
double m_vProb1

Additional Inherited Members

- Protected Member Functions inherited from ns3::Queue
void Drop (Ptr< Packet > packet)

Detailed Description

Definition at line 82 of file red-queue.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
DTYPE_NONE 
DTYPE_FORCED 
DTYPE_UNFORCED 

Definition at line 118 of file red-queue.h.

Constructor & Destructor Documentation

ns3::RedQueue::RedQueue ( )

Definition at line 150 of file red-queue.cc.

References m_uv, and NS_LOG_FUNCTION_NOARGS.

ns3::RedQueue::~RedQueue ( )
virtual

Definition at line 160 of file red-queue.cc.

References NS_LOG_FUNCTION_NOARGS.

Member Function Documentation

int64_t ns3::RedQueue::AssignStreams ( int64_t  stream)

Assign a fixed random variable stream number to the random variables used by this model. Return the number of streams (possibly zero) that have been assigned.

Parameters
streamfirst stream index to use
Returns
the number of stream indices assigned by this model

Definition at line 202 of file red-queue.cc.

References m_uv, and ns3::RandomVariableStream::SetStream().

+ Here is the call graph for this function:

double ns3::RedQueue::CalculatePNew ( double  qAvg,
double  maxTh,
bool  gentle,
double  vA,
double  vB,
double  vC,
double  vD,
double  maxP 
)
private

Definition at line 499 of file red-queue.cc.

References NS_LOG_FUNCTION.

Referenced by DropEarly().

+ Here is the caller graph for this function:

Ptr< Packet > ns3::RedQueue::DoDequeue ( void  )
privatevirtual

Definition at line 610 of file red-queue.cc.

References ns3::Packet::GetSize(), m_bytesInQueue, m_idle, m_idleTime, m_packets, ns3::Now(), NS_LOG_FUNCTION, and NS_LOG_LOGIC.

+ Here is the call graph for this function:

Ptr< const Packet > ns3::RedQueue::DoPeek ( void  ) const
privatevirtual

Definition at line 639 of file red-queue.cc.

References m_bytesInQueue, m_packets, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

uint32_t ns3::RedQueue::DropEarly ( Ptr< Packet p,
uint32_t  qSize 
)
private

Definition at line 438 of file red-queue.cc.

References CalculatePNew(), ns3::Packet::GetSize(), ns3::UniformRandomVariable::GetValue(), m_cautious, m_count, m_countBytes, m_curMaxP, m_isGentle, m_isWait, m_maxTh, m_meanPktSize, m_ptc, m_qAvg, m_qW, m_uv, m_vA, m_vB, m_vC, m_vD, m_vProb, m_vProb1, ModifyP(), NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by DoEnqueue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double ns3::RedQueue::Estimator ( uint32_t  nQueued,
uint32_t  m,
double  qAvg,
double  qW 
)
private

Definition at line 418 of file red-queue.cc.

References NS_LOG_FUNCTION.

Referenced by DoEnqueue().

+ Here is the caller graph for this function:

RedQueue::QueueMode ns3::RedQueue::GetMode ( void  )

Definition at line 173 of file red-queue.cc.

References m_mode, and NS_LOG_FUNCTION_NOARGS.

Referenced by DoEnqueue(), GetQueueSize(), and ModifyP().

+ Here is the caller graph for this function:

uint32_t ns3::RedQueue::GetQueueSize ( void  )

Definition at line 592 of file red-queue.cc.

References GetMode(), m_bytesInQueue, m_packets, NS_ABORT_MSG, NS_LOG_FUNCTION_NOARGS, ns3::Queue::QUEUE_MODE_BYTES, and ns3::Queue::QUEUE_MODE_PACKETS.

+ Here is the call graph for this function:

RedQueue::Stats ns3::RedQueue::GetStats ( )

Definition at line 196 of file red-queue.cc.

References m_stats.

TypeId ns3::RedQueue::GetTypeId ( void  )
static

This method returns the TypeId associated to ns3::RedQueue.

This object is accessible through the following paths with Config::Set and Config::Connect:

  • /NodeList/[i]/DeviceList/[i]/$ns3::AlohaNoackNetDevice/Queue/$ns3::RedQueue
  • /NodeList/[i]/DeviceList/[i]/$ns3::CsmaNetDevice/TxQueue/$ns3::RedQueue
  • /NodeList/[i]/DeviceList/[i]/$ns3::EmuNetDevice/TxQueue/$ns3::RedQueue
  • /NodeList/[i]/DeviceList/[i]/$ns3::PointToPointNetDevice/TxQueue/$ns3::RedQueue

Attributes defined for this type:

  • Mode: Determines unit for QueueLimit
  • MeanPktSize: Average of packet size
  • IdlePktSize: Average packet size used during idle times. Used when m_cautions = 3
  • Wait: True for waiting between dropped packets
    • Set with class: BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: construct write read
  • Gentle: True to increases dropping probability slowly when average queue exceeds maxthresh
    • Set with class: BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: construct write read
  • MinTh: Minimum average length threshold in packets/bytes
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 5
    • Flags: construct write read
  • MaxTh: Maximum average length threshold in packets/bytes
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 15
    • Flags: construct write read
  • QueueLimit: Queue limit in bytes/packets
  • QW: Queue weight related to the exponential weighted moving average (EWMA)
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 0.002
    • Flags: construct write read
  • LInterm: The maximum probability of dropping a packet
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 50
    • Flags: construct write read
  • Ns1Compat: NS-1 compatibility
    • Set with class: BooleanValue
    • Underlying type: bool
    • Initial value: false
    • Flags: construct write read
  • LinkBandwidth: The RED link bandwidth
    • Set with class: DataRateValue
    • Underlying type: DataRate
    • Initial value: 1500000bps
    • Flags: construct write read
  • LinkDelay: The RED link delay
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +20000000.0ns
    • Flags: construct write read

No TraceSources defined for this type.
TraceSources defined in parent class ns3::Queue:

  • Enqueue: Enqueue a packet in the queue.
  • Dequeue: Dequeue a packet from the queue.
  • Drop: Drop a packet stored in the queue.

Reimplemented from ns3::Queue.

Definition at line 74 of file red-queue.cc.

References m_idlePktSize, m_isGentle, m_isNs1Compat, m_isWait, m_linkBandwidth, m_linkDelay, m_lInterm, m_maxTh, m_meanPktSize, m_minTh, m_queueLimit, m_qW, ns3::MakeEnumAccessor(), ns3::MakeEnumChecker(), ns3::MilliSeconds(), ns3::Queue::QUEUE_MODE_BYTES, ns3::Queue::QUEUE_MODE_PACKETS, SetMode(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

double ns3::RedQueue::ModifyP ( double  p,
uint32_t  count,
uint32_t  countBytes,
uint32_t  meanPktSize,
bool  wait,
uint32_t  size 
)
private

Definition at line 540 of file red-queue.cc.

References GetMode(), NS_LOG_FUNCTION, and ns3::Queue::QUEUE_MODE_BYTES.

Referenced by DropEarly().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::RedQueue::SetMode ( RedQueue::QueueMode  mode)

Definition at line 166 of file red-queue.cc.

References m_mode, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

void ns3::RedQueue::SetQueueLimit ( uint32_t  lim)

Definition at line 180 of file red-queue.cc.

References m_queueLimit, and NS_LOG_FUNCTION.

void ns3::RedQueue::SetTh ( double  minTh,
double  maxTh 
)

Definition at line 187 of file red-queue.cc.

References m_maxTh, m_minTh, NS_ASSERT, and NS_LOG_FUNCTION.

Member Data Documentation

uint32_t ns3::RedQueue::m_bytesInQueue
private

Definition at line 200 of file red-queue.h.

Referenced by DoDequeue(), DoEnqueue(), DoPeek(), and GetQueueSize().

uint32_t ns3::RedQueue::m_cautious
private

Definition at line 264 of file red-queue.h.

Referenced by DoEnqueue(), DropEarly(), and InitializeParams().

uint32_t ns3::RedQueue::m_count
private

Definition at line 257 of file red-queue.h.

Referenced by DoEnqueue(), DropEarly(), and InitializeParams().

uint32_t ns3::RedQueue::m_countBytes
private

Definition at line 247 of file red-queue.h.

Referenced by DoEnqueue(), DropEarly(), and InitializeParams().

double ns3::RedQueue::m_curMaxP
private

Definition at line 243 of file red-queue.h.

Referenced by DropEarly(), and InitializeParams().

bool ns3::RedQueue::m_hasRedStarted
private

Definition at line 201 of file red-queue.h.

Referenced by DoEnqueue().

uint32_t ns3::RedQueue::m_idle
private

Definition at line 251 of file red-queue.h.

Referenced by DoDequeue(), DoEnqueue(), and InitializeParams().

uint32_t ns3::RedQueue::m_idlePktSize
private

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

Referenced by DoEnqueue(), and GetTypeId().

Time ns3::RedQueue::m_idleTime
private

Definition at line 266 of file red-queue.h.

Referenced by DoDequeue(), DoEnqueue(), and InitializeParams().

bool ns3::RedQueue::m_isGentle
private

Definition at line 214 of file red-queue.h.

Referenced by DoEnqueue(), DropEarly(), GetTypeId(), and InitializeParams().

bool ns3::RedQueue::m_isNs1Compat
private

Definition at line 226 of file red-queue.h.

Referenced by DoEnqueue(), and GetTypeId().

bool ns3::RedQueue::m_isWait
private

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

Referenced by DropEarly(), GetTypeId(), and InitializeParams().

DataRate ns3::RedQueue::m_linkBandwidth
private

Definition at line 228 of file red-queue.h.

Referenced by GetTypeId(), and InitializeParams().

Time ns3::RedQueue::m_linkDelay
private

Definition at line 230 of file red-queue.h.

Referenced by GetTypeId(), and InitializeParams().

double ns3::RedQueue::m_lInterm
private

Definition at line 224 of file red-queue.h.

Referenced by GetTypeId(), and InitializeParams().

double ns3::RedQueue::m_maxTh
private

Definition at line 218 of file red-queue.h.

Referenced by DoEnqueue(), DropEarly(), GetTypeId(), InitializeParams(), and SetTh().

uint32_t ns3::RedQueue::m_meanPktSize
private

Definition at line 208 of file red-queue.h.

Referenced by DoEnqueue(), DropEarly(), GetTypeId(), and InitializeParams().

double ns3::RedQueue::m_minTh
private

Definition at line 216 of file red-queue.h.

Referenced by DoEnqueue(), GetTypeId(), InitializeParams(), and SetTh().

QueueMode ns3::RedQueue::m_mode
private

Definition at line 206 of file red-queue.h.

Referenced by GetMode(), and SetMode().

uint32_t ns3::RedQueue::m_old
private

Definition at line 249 of file red-queue.h.

Referenced by DoEnqueue(), and InitializeParams().

std::list<Ptr<Packet> > ns3::RedQueue::m_packets
private

Definition at line 198 of file red-queue.h.

Referenced by DoDequeue(), DoEnqueue(), DoPeek(), and GetQueueSize().

double ns3::RedQueue::m_ptc
private

Definition at line 253 of file red-queue.h.

Referenced by DoEnqueue(), DropEarly(), and InitializeParams().

double ns3::RedQueue::m_qAvg
private

Definition at line 255 of file red-queue.h.

Referenced by DoEnqueue(), DropEarly(), and InitializeParams().

uint32_t ns3::RedQueue::m_queueLimit
private

Definition at line 220 of file red-queue.h.

Referenced by DoEnqueue(), GetTypeId(), and SetQueueLimit().

double ns3::RedQueue::m_qW
private

Definition at line 222 of file red-queue.h.

Referenced by DoEnqueue(), DropEarly(), GetTypeId(), and InitializeParams().

Stats ns3::RedQueue::m_stats
private

Definition at line 202 of file red-queue.h.

Referenced by DoEnqueue(), GetStats(), and InitializeParams().

Ptr<UniformRandomVariable> ns3::RedQueue::m_uv
private

Definition at line 268 of file red-queue.h.

Referenced by AssignStreams(), DropEarly(), and RedQueue().

double ns3::RedQueue::m_vA
private

Definition at line 236 of file red-queue.h.

Referenced by DropEarly(), and InitializeParams().

double ns3::RedQueue::m_vB
private

Definition at line 237 of file red-queue.h.

Referenced by DropEarly(), and InitializeParams().

double ns3::RedQueue::m_vC
private

Definition at line 239 of file red-queue.h.

Referenced by DropEarly(), and InitializeParams().

double ns3::RedQueue::m_vD
private

Definition at line 241 of file red-queue.h.

Referenced by DropEarly(), and InitializeParams().

double ns3::RedQueue::m_vProb
private

Definition at line 245 of file red-queue.h.

Referenced by DoEnqueue(), and DropEarly().

double ns3::RedQueue::m_vProb1
private

Definition at line 234 of file red-queue.h.

Referenced by DropEarly().


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