#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< 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 183 of file dsdv-packet-queue.h.
|
inline |
Default c-tor.
Definition at line 187 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 101 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 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().
void ns3::dsdv::PacketQueue::DropPacketWithDst | ( | Ipv4Address | dst | ) |
Remove all packets with destination IP address dst.
dst | the destination IP address |
Definition at line 84 of file dsdv-packet-queue.cc.
References Drop(), IsEqual(), 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 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().
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 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().
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 133 of file dsdv-packet-queue.cc.
References m_queue.
Referenced by Enqueue().
|
inline |
Get maximum packets per destination.
Definition at line 249 of file dsdv-packet-queue.h.
References m_maxLenPerDst.
|
inline |
Get maximum queue length.
Definition at line 233 of file dsdv-packet-queue.h.
References m_maxLen.
|
inline |
Get queue timeout.
Definition at line 265 of file dsdv-packet-queue.h.
References m_queueTimeout.
uint32_t ns3::dsdv::PacketQueue::GetSize | ( | void | ) |
Get 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().
|
inlinestaticprivate |
Determine if queue entries are equal.
en | the queue entry |
dst | the IPv4 destination address |
Definition at line 300 of file dsdv-packet-queue.h.
References ns3::Ipv4Header::GetDestination(), and ns3::dsdv::QueueEntry::GetIpv4Header().
Referenced by DropPacketWithDst().
|
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().
|
inline |
Set maximum packets per destination.
len | The maximum packets per destination |
Definition at line 257 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 241 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 273 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 289 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 291 of file dsdv-packet-queue.h.
Referenced by Enqueue(), GetMaxPacketsPerDst(), and SetMaxPacketsPerDst().
|
private |
the queue
Definition at line 279 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 293 of file dsdv-packet-queue.h.
Referenced by Enqueue(), GetQueueTimeout(), and SetQueueTimeout().