A Discrete-Event Network Simulator
API
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
ns3::dsdv::PacketQueue Class Reference

DSDV Packet queue. More...

#include "dsdv-packet-queue.h"

Public Member Functions

 PacketQueue ()
 Default c-tor. More...
 
bool Dequeue (Ipv4Address dst, QueueEntry &entry)
 Return first found (the earliest) entry for given destination. More...
 
void DropPacketWithDst (Ipv4Address dst)
 Remove all packets with destination IP address dst. More...
 
bool Enqueue (QueueEntry &entry)
 Push entry in queue, if there is no entry with the same packet and destination address in queue. More...
 
bool Find (Ipv4Address dst)
 Finds whether a packet with destination dst exists in the queue. More...
 
uint32_t GetCountForPacketsWithDst (Ipv4Address dst)
 Get count of packets with destination dst in the queue. More...
 
uint32_t GetMaxPacketsPerDst () const
 Get maximum packets per destination. More...
 
uint32_t GetMaxQueueLen () const
 Get maximum queue length. More...
 
Time GetQueueTimeout () const
 Get queue timeout. More...
 
uint32_t GetSize ()
 Get the number of entries. More...
 
void SetMaxPacketsPerDst (uint32_t len)
 Set maximum packets per destination. More...
 
void SetMaxQueueLen (uint32_t len)
 Set maximum queue length. More...
 
void SetQueueTimeout (Time t)
 Set queue timeout. More...
 

Private Member Functions

void Drop (QueueEntry en, std::string reason)
 Notify that the packet is dropped from queue due to timeout. More...
 
void Purge ()
 Remove all expired entries. More...
 

Static Private Member Functions

static bool IsEqual (QueueEntry en, const Ipv4Address dst)
 Determine if queue entries are equal. More...
 

Private Attributes

uint32_t m_maxLen
 The maximum number of packets that we allow a routing protocol to buffer. More...
 
uint32_t m_maxLenPerDst
 The maximum number of packets that we allow per destination to buffer. More...
 
std::vector< QueueEntrym_queue
 the queue More...
 
Time m_queueTimeout
 The maximum period of time that a routing protocol is allowed to buffer a packet for, seconds. More...
 

Detailed Description

DSDV Packet queue.

When a route is not available, the packets are queued. Every node can buffer up to 5 packets per destination. We have implemented a "drop front on full" queue where the first queued packet will be dropped to accommodate newer packets.

Definition at line 183 of file dsdv-packet-queue.h.

Constructor & Destructor Documentation

◆ PacketQueue()

ns3::dsdv::PacketQueue::PacketQueue ( )
inline

Default c-tor.

Definition at line 187 of file dsdv-packet-queue.h.

Member Function Documentation

◆ Dequeue()

bool ns3::dsdv::PacketQueue::Dequeue ( Ipv4Address  dst,
QueueEntry entry 
)

Return first found (the earliest) entry for given destination.

Parameters
dstthe destination IP address
entrythe queue entry
Returns
true if successful

Definition at line 101 of file dsdv-packet-queue.cc.

References m_queue, NS_LOG_FUNCTION, and Purge().

Referenced by ns3::dsdv::RoutingProtocol::SendPacketFromQueue().

◆ Drop()

void ns3::dsdv::PacketQueue::Drop ( QueueEntry  en,
std::string  reason 
)
private

Notify that the packet is dropped from queue due to timeout.

Parameters
enthe queue entry
reasonthe reason for the packet drop

Definition at line 184 of file dsdv-packet-queue.cc.

References ns3::Ipv4Header::GetDestination(), ns3::dsdv::QueueEntry::GetIpv4Header(), ns3::dsdv::QueueEntry::GetPacket(), ns3::Packet::GetUid(), and NS_LOG_LOGIC().

Referenced by DropPacketWithDst(), and Purge().

◆ DropPacketWithDst()

void ns3::dsdv::PacketQueue::DropPacketWithDst ( Ipv4Address  dst)

Remove all packets with destination IP address dst.

Parameters
dstthe destination IP address

Definition at line 84 of file dsdv-packet-queue.cc.

References Drop(), IsEqual(), m_queue, NS_LOG_FUNCTION, and Purge().

◆ Enqueue()

bool ns3::dsdv::PacketQueue::Enqueue ( QueueEntry entry)

Push entry in queue, if there is no entry with the same packet and destination address in queue.

Parameters
entryQueueEntry to compare
Returns
true if successful

For Brock Paper comparison

Definition at line 51 of file dsdv-packet-queue.cc.

References GetCountForPacketsWithDst(), ns3::Ipv4Header::GetDestination(), ns3::dsdv::QueueEntry::GetIpv4Header(), ns3::dsdv::QueueEntry::GetPacket(), ns3::Packet::GetUid(), m_maxLen, m_maxLenPerDst, m_queue, m_queueTimeout, NS_LOG_DEBUG, NS_LOG_FUNCTION, Purge(), and ns3::dsdv::QueueEntry::SetExpireTime().

Referenced by ns3::dsdv::RoutingProtocol::DeferredRouteOutput().

◆ Find()

bool ns3::dsdv::PacketQueue::Find ( Ipv4Address  dst)

Finds whether a packet with destination dst exists in the queue.

Parameters
dstthe destination IP address
Returns
true if a packet found

Definition at line 118 of file dsdv-packet-queue.cc.

References m_queue, and NS_LOG_DEBUG.

Referenced by ns3::dsdv::RoutingProtocol::LookForQueuedPackets(), and ns3::dsdv::RoutingProtocol::SendPacketFromQueue().

◆ GetCountForPacketsWithDst()

uint32_t ns3::dsdv::PacketQueue::GetCountForPacketsWithDst ( Ipv4Address  dst)

Get count of packets with destination dst in the queue.

Parameters
dstthe destination IP address
Returns
the count

Definition at line 133 of file dsdv-packet-queue.cc.

References m_queue.

Referenced by Enqueue().

◆ GetMaxPacketsPerDst()

uint32_t ns3::dsdv::PacketQueue::GetMaxPacketsPerDst ( ) const
inline

Get maximum packets per destination.

Returns
the maximum packets per destination

Definition at line 249 of file dsdv-packet-queue.h.

References m_maxLenPerDst.

◆ GetMaxQueueLen()

uint32_t ns3::dsdv::PacketQueue::GetMaxQueueLen ( ) const
inline

Get maximum queue length.

Returns
the maximum queue length

Definition at line 233 of file dsdv-packet-queue.h.

References m_maxLen.

◆ GetQueueTimeout()

Time ns3::dsdv::PacketQueue::GetQueueTimeout ( ) const
inline

Get queue timeout.

Returns
the queue timeout

Definition at line 265 of file dsdv-packet-queue.h.

References m_queueTimeout.

◆ GetSize()

uint32_t ns3::dsdv::PacketQueue::GetSize ( void  )

Get the number of entries.

Returns
the number of entries

Definition at line 44 of file dsdv-packet-queue.cc.

References m_queue, and Purge().

Referenced by ns3::dsdv::RoutingProtocol::SendPacketFromQueue().

◆ IsEqual()

static bool ns3::dsdv::PacketQueue::IsEqual ( QueueEntry  en,
const Ipv4Address  dst 
)
inlinestaticprivate

Determine if queue entries are equal.

Parameters
enthe queue entry
dstthe IPv4 destination address
Returns
true if the entry is for the destination address

Definition at line 300 of file dsdv-packet-queue.h.

References ns3::Ipv4Header::GetDestination(), and ns3::dsdv::QueueEntry::GetIpv4Header().

Referenced by DropPacketWithDst().

◆ Purge()

void ns3::dsdv::PacketQueue::Purge ( )
private

Remove all expired entries.

Definition at line 166 of file dsdv-packet-queue.cc.

References Drop(), m_queue, and NS_LOG_DEBUG.

Referenced by Dequeue(), DropPacketWithDst(), Enqueue(), and GetSize().

◆ SetMaxPacketsPerDst()

void ns3::dsdv::PacketQueue::SetMaxPacketsPerDst ( uint32_t  len)
inline

Set maximum packets per destination.

Parameters
lenThe maximum packets per destination

Definition at line 257 of file dsdv-packet-queue.h.

References m_maxLenPerDst.

Referenced by ns3::dsdv::RoutingProtocol::Start().

◆ SetMaxQueueLen()

void ns3::dsdv::PacketQueue::SetMaxQueueLen ( uint32_t  len)
inline

Set maximum queue length.

Parameters
lenthe maximum queue length

Definition at line 241 of file dsdv-packet-queue.h.

References m_maxLen.

Referenced by ns3::dsdv::RoutingProtocol::Start().

◆ SetQueueTimeout()

void ns3::dsdv::PacketQueue::SetQueueTimeout ( Time  t)
inline

Set queue timeout.

Parameters
tThe queue timeout

Definition at line 273 of file dsdv-packet-queue.h.

References m_queueTimeout.

Referenced by ns3::dsdv::RoutingProtocol::Start().

Member Data Documentation

◆ m_maxLen

uint32_t ns3::dsdv::PacketQueue::m_maxLen
private

The maximum number of packets that we allow a routing protocol to buffer.

Definition at line 289 of file dsdv-packet-queue.h.

Referenced by Enqueue(), GetMaxQueueLen(), and SetMaxQueueLen().

◆ m_maxLenPerDst

uint32_t ns3::dsdv::PacketQueue::m_maxLenPerDst
private

The maximum number of packets that we allow per destination to buffer.

Definition at line 291 of file dsdv-packet-queue.h.

Referenced by Enqueue(), GetMaxPacketsPerDst(), and SetMaxPacketsPerDst().

◆ m_queue

std::vector<QueueEntry> ns3::dsdv::PacketQueue::m_queue
private

the queue

Definition at line 279 of file dsdv-packet-queue.h.

Referenced by Dequeue(), DropPacketWithDst(), Enqueue(), Find(), GetCountForPacketsWithDst(), GetSize(), and Purge().

◆ m_queueTimeout

Time ns3::dsdv::PacketQueue::m_queueTimeout
private

The maximum period of time that a routing protocol is allowed to buffer a packet for, seconds.

Definition at line 293 of file dsdv-packet-queue.h.

Referenced by Enqueue(), GetQueueTimeout(), and SetQueueTimeout().


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