A Discrete-Event Network Simulator
API
ns3::dsdv::PacketQueue Class Reference

DSDV Packet queue. More...

#include "dsdv-packet-queue.h"

+ Collaboration diagram for ns3::dsdv::PacketQueue:

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

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 199 of file dsdv-packet-queue.h.

Constructor & Destructor Documentation

◆ PacketQueue()

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

Default c-tor.

Definition at line 203 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 103 of file dsdv-packet-queue.cc.

References m_queue, NS_LOG_FUNCTION, and Purge().

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

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

◆ 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 181 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().

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

◆ DropPacketWithDst()

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

Remove all packets with destination IP address dst.

Parameters
dstthe destination IP address

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

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

+ Here is the call graph for this function:

◆ 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 54 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().

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

◆ 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 120 of file dsdv-packet-queue.cc.

References m_queue, and NS_LOG_DEBUG.

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

+ Here is the caller graph for this function:

◆ 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 134 of file dsdv-packet-queue.cc.

References m_queue.

Referenced by Enqueue().

+ Here is the caller graph for this function:

◆ GetMaxPacketsPerDst()

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

Get maximum packets per destination.

Returns
the maximum packets per destination

Definition at line 268 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 250 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 286 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 47 of file dsdv-packet-queue.cc.

References m_queue, and Purge().

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

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

◆ Purge()

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

Remove all expired entries.

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

References Drop(), m_queue, and NS_LOG_DEBUG.

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

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

◆ SetMaxPacketsPerDst()

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

Set maximum packets per destination.

Parameters
lenThe maximum packets per destination

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

References m_maxLenPerDst.

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

+ Here is the caller graph for this function:

◆ SetMaxQueueLen()

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

Set maximum queue length.

Parameters
lenthe maximum queue length

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

References m_maxLen.

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

+ Here is the caller graph for this function:

◆ SetQueueTimeout()

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

Set queue timeout.

Parameters
tThe queue timeout

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

References m_queueTimeout.

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

+ Here is the caller graph for this function:

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 311 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 313 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 301 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 316 of file dsdv-packet-queue.h.

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


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