#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... | |
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< QueueEntry > | m_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... | |
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.
|
inline |
Default c-tor.
Definition at line 203 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 103 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 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().
void ns3::dsdv::PacketQueue::DropPacketWithDst | ( | Ipv4Address | dst | ) |
Remove all packets with destination IP address dst.
dst | the destination IP address |
Definition at line 85 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 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().
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 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().
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 134 of file dsdv-packet-queue.cc.
References m_queue.
Referenced by Enqueue().
|
inline |
Get maximum packets per destination.
Definition at line 268 of file dsdv-packet-queue.h.
References m_maxLenPerDst.
|
inline |
Get maximum queue length.
Definition at line 250 of file dsdv-packet-queue.h.
References m_maxLen.
|
inline |
Get queue timeout.
Definition at line 286 of file dsdv-packet-queue.h.
References m_queueTimeout.
uint32_t ns3::dsdv::PacketQueue::GetSize | ( | void | ) |
Get 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().
|
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().
|
inline |
Set maximum packets per destination.
len | The maximum packets per destination |
Definition at line 277 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 259 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 295 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 311 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 313 of file dsdv-packet-queue.h.
Referenced by Enqueue(), GetMaxPacketsPerDst(), and SetMaxPacketsPerDst().
|
private |
the queue
Definition at line 301 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 316 of file dsdv-packet-queue.h.
Referenced by Enqueue(), GetQueueTimeout(), and SetQueueTimeout().