#include "dsdv-packet-queue.h"
Public Member Functions | |
PacketQueue () | |
Default c-tor. | |
bool | Dequeue (Ipv4Address dst, QueueEntry &entry) |
Return first found (the earliest) entry for given destination. | |
void | DropPacketWithDst (Ipv4Address dst) |
Remove all packets with destination IP address dst. | |
bool | Enqueue (QueueEntry &entry) |
Push entry in queue, if there is no entry with the same packet and destination address in queue. | |
bool | Find (Ipv4Address dst) |
Finds whether a packet with destination dst exists in the queue. | |
uint32_t | GetCountForPacketsWithDst (Ipv4Address dst) |
Get count of packets with destination dst in the queue. | |
uint32_t | GetMaxPacketsPerDst () const |
Get maximum packets per destination. | |
uint32_t | GetMaxQueueLen () const |
Get maximum queue length. | |
Time | GetQueueTimeout () const |
Get queue timeout. | |
uint32_t | GetSize () |
Get the number of entries. | |
void | SetMaxPacketsPerDst (uint32_t len) |
Set maximum packets per destination. | |
void | SetMaxQueueLen (uint32_t len) |
Set maximum queue length. | |
void | SetQueueTimeout (Time t) |
Set queue timeout. | |
Private Member Functions | |
void | Drop (QueueEntry en, std::string reason) |
Notify that the packet is dropped from queue due to timeout. | |
void | Purge () |
Remove all expired entries. | |
Private Attributes | |
uint32_t | m_maxLen |
The maximum number of packets that we allow a routing protocol to buffer. | |
uint32_t | m_maxLenPerDst |
The maximum number of packets that we allow per destination to buffer. | |
std::vector< QueueEntry > | m_queue |
the queue | |
Time | m_queueTimeout |
The maximum period of time that a routing protocol is allowed to buffer a packet for, seconds. | |
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 188 of file dsdv-packet-queue.h.
|
inline |
Default c-tor.
Definition at line 192 of file dsdv-packet-queue.h.
bool ns3::dsdv::PacketQueue::Dequeue | ( | Ipv4Address | dst, |
QueueEntry & | entry ) |
Return first found (the earliest) entry for given destination.
dst | the destination IP address |
entry | the queue entry |
Definition at line 92 of file dsdv-packet-queue.cc.
References m_queue, NS_LOG_FUNCTION, and Purge().
Referenced by ns3::dsdv::RoutingProtocol::SendPacketFromQueue().
|
private |
Notify that the packet is dropped from queue due to timeout.
en | the queue entry |
reason | the reason for the packet drop |
Definition at line 170 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().
void ns3::dsdv::PacketQueue::DropPacketWithDst | ( | Ipv4Address | dst | ) |
Remove all packets with destination IP address dst.
dst | the destination IP address |
Definition at line 74 of file dsdv-packet-queue.cc.
References Drop(), m_queue, NS_LOG_FUNCTION, and Purge().
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.
entry | QueueEntry to compare |
For Brock Paper comparison
Definition at line 43 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().
bool ns3::dsdv::PacketQueue::Find | ( | Ipv4Address | dst | ) |
Finds whether a packet with destination dst exists in the queue.
dst | the destination IP address |
Definition at line 109 of file dsdv-packet-queue.cc.
References m_queue, and NS_LOG_DEBUG.
Referenced by ns3::dsdv::RoutingProtocol::LookForQueuedPackets(), and ns3::dsdv::RoutingProtocol::SendPacketFromQueue().
uint32_t ns3::dsdv::PacketQueue::GetCountForPacketsWithDst | ( | Ipv4Address | dst | ) |
Get count of packets with destination dst in the queue.
dst | the destination IP address |
Definition at line 123 of file dsdv-packet-queue.cc.
References m_queue.
Referenced by Enqueue().
|
inline |
Get maximum packets per destination.
Definition at line 257 of file dsdv-packet-queue.h.
References m_maxLenPerDst.
|
inline |
Get maximum queue length.
Definition at line 239 of file dsdv-packet-queue.h.
References m_maxLen.
|
inline |
Get queue timeout.
Definition at line 275 of file dsdv-packet-queue.h.
References m_queueTimeout.
uint32_t ns3::dsdv::PacketQueue::GetSize | ( | ) |
Get the number of entries.
Definition at line 36 of file dsdv-packet-queue.cc.
References m_queue, and Purge().
Referenced by ns3::dsdv::RoutingProtocol::SendPacketFromQueue().
|
private |
Remove all expired entries.
Definition at line 154 of file dsdv-packet-queue.cc.
References Drop(), m_queue, and NS_LOG_DEBUG.
Referenced by Dequeue(), DropPacketWithDst(), Enqueue(), and GetSize().
|
inline |
Set maximum packets per destination.
len | The maximum packets per destination |
Definition at line 266 of file dsdv-packet-queue.h.
References m_maxLenPerDst.
Referenced by ns3::dsdv::RoutingProtocol::Start().
|
inline |
Set maximum queue length.
len | the maximum queue length |
Definition at line 248 of file dsdv-packet-queue.h.
References m_maxLen.
Referenced by ns3::dsdv::RoutingProtocol::Start().
|
inline |
Set queue timeout.
t | The queue timeout |
Definition at line 284 of file dsdv-packet-queue.h.
References m_queueTimeout.
Referenced by ns3::dsdv::RoutingProtocol::Start().
|
private |
The maximum number of packets that we allow a routing protocol to buffer.
Definition at line 300 of file dsdv-packet-queue.h.
Referenced by Enqueue(), GetMaxQueueLen(), and SetMaxQueueLen().
|
private |
The maximum number of packets that we allow per destination to buffer.
Definition at line 302 of file dsdv-packet-queue.h.
Referenced by Enqueue(), GetMaxPacketsPerDst(), and SetMaxPacketsPerDst().
|
private |
the queue
Definition at line 290 of file dsdv-packet-queue.h.
Referenced by Dequeue(), DropPacketWithDst(), Enqueue(), Find(), GetCountForPacketsWithDst(), GetSize(), and Purge().
|
private |
The maximum period of time that a routing protocol is allowed to buffer a packet for, seconds.
Definition at line 305 of file dsdv-packet-queue.h.
Referenced by Enqueue(), GetQueueTimeout(), and SetQueueTimeout().