DSR error buffer. More...
#include "dsr-errorbuff.h"
Public Member Functions | |
DsrErrorBuffer () | |
Default constructor. More... | |
bool | Dequeue (Ipv4Address dst, DsrErrorBuffEntry &entry) |
Return first found (the earliest) entry for given destination. More... | |
void | DropPacketForErrLink (Ipv4Address source, Ipv4Address nextHop) |
Remove all packets with the error link. More... | |
bool | Enqueue (DsrErrorBuffEntry &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... | |
std::vector< DsrErrorBuffEntry > & | GetBuffer () |
Get error buffer entry. More... | |
Time | GetErrorBufferTimeout () const |
Get error buffer timeout. More... | |
uint32_t | GetMaxQueueLen () const |
Get maximum queue length. More... | |
uint32_t | GetSize () |
Returns the number of entries in the queue. More... | |
void | SetErrorBufferTimeout (Time t) |
Set error buffer timeout. More... | |
void | SetMaxQueueLen (uint32_t len) |
Set maximum queue length. More... | |
Private Member Functions | |
void | Drop (DsrErrorBuffEntry en, std::string reason) |
Notify that packet is dropped from queue by timeout. More... | |
void | DropLink (DsrErrorBuffEntry en, std::string reason) |
Notify that packet is dropped from queue by link error. More... | |
void | Purge () |
Remove all expired entries. More... | |
Private Attributes | |
std::vector< DsrErrorBuffEntry > | m_errorBuffer |
The send buffer to cache unsent packet. More... | |
Time | m_errorBufferTimeout |
The maximum period of time that a routing protocol is allowed to buffer a packet for, seconds. More... | |
uint32_t | m_maxLen |
The maximum number of packets that we allow a routing protocol to buffer. More... | |
DSR error buffer.
Definition at line 196 of file dsr-errorbuff.h.
|
inline |
Default constructor.
Definition at line 202 of file dsr-errorbuff.h.
bool ns3::dsr::DsrErrorBuffer::Dequeue | ( | Ipv4Address | dst, |
DsrErrorBuffEntry & | entry | ||
) |
Return first found (the earliest) entry for given destination.
[in] | dst | The destination to look for |
[out] | entry | The entry |
Definition at line 111 of file dsr-errorbuff.cc.
References ns3::dsr::DsrErrorBuffEntry::GetPacket(), ns3::Packet::GetSize(), m_errorBuffer, NS_LOG_DEBUG, and Purge().
Referenced by ns3::dsr::DsrRouting::SendPacketFromBuffer().
|
private |
Notify that packet is dropped from queue by timeout.
en | Error Buffer Entry |
reason | Drop reason. |
Definition at line 186 of file dsr-errorbuff.cc.
References ns3::dsr::DsrErrorBuffEntry::GetDestination(), ns3::dsr::DsrErrorBuffEntry::GetPacket(), ns3::Packet::GetUid(), and NS_LOG_LOGIC.
Referenced by Enqueue(), and Purge().
|
private |
Notify that packet is dropped from queue by link error.
en | Error Buffer Entry |
reason | Drop reason. |
Definition at line 195 of file dsr-errorbuff.cc.
References ns3::dsr::DsrErrorBuffEntry::GetNextHop(), ns3::dsr::DsrErrorBuffEntry::GetPacket(), ns3::dsr::DsrErrorBuffEntry::GetSource(), ns3::Packet::GetUid(), and NS_LOG_LOGIC.
Referenced by DropPacketForErrLink().
void ns3::dsr::DsrErrorBuffer::DropPacketForErrLink | ( | Ipv4Address | source, |
Ipv4Address | nextHop | ||
) |
Remove all packets with the error link.
source | The source |
nextHop | The next hop |
Definition at line 85 of file dsr-errorbuff.cc.
References DropLink(), list, m_errorBuffer, NS_LOG_FUNCTION, and Purge().
Referenced by ns3::dsr::DsrRouting::AddRoute(), and ns3::dsr::DsrRouting::AddRoute_Link().
bool ns3::dsr::DsrErrorBuffer::Enqueue | ( | DsrErrorBuffEntry & | entry | ) |
Push entry in queue, if there is no entry with the same packet and destination address in queue.
entry | error buffer entry |
Definition at line 53 of file dsr-errorbuff.cc.
References Drop(), ns3::dsr::DsrErrorBuffEntry::GetDestination(), ns3::dsr::DsrErrorBuffEntry::GetNextHop(), ns3::dsr::DsrErrorBuffEntry::GetPacket(), ns3::dsr::DsrErrorBuffEntry::GetSource(), ns3::Packet::GetUid(), m_errorBuffer, m_errorBufferTimeout, m_maxLen, NS_LOG_INFO, Purge(), and ns3::dsr::DsrErrorBuffEntry::SetExpireTime().
Referenced by ns3::dsr::DsrRouting::SendUnreachError().
bool ns3::dsr::DsrErrorBuffer::Find | ( | Ipv4Address | dst | ) |
Finds whether a packet with destination dst exists in the queue.
dst | The destination |
Definition at line 131 of file dsr-errorbuff.cc.
References m_errorBuffer, and NS_LOG_DEBUG.
Referenced by ns3::dsr::DsrRouting::SendPacketFromBuffer().
|
inline |
Get error buffer entry.
Definition at line 274 of file dsr-errorbuff.h.
References m_errorBuffer.
|
inline |
Get error buffer timeout.
Definition at line 258 of file dsr-errorbuff.h.
References m_errorBufferTimeout.
|
inline |
Get maximum queue length.
Definition at line 242 of file dsr-errorbuff.h.
References m_maxLen.
uint32_t ns3::dsr::DsrErrorBuffer::GetSize | ( | void | ) |
Returns the number of entries in the queue.
Definition at line 46 of file dsr-errorbuff.cc.
References m_errorBuffer, and Purge().
Referenced by ns3::dsr::DsrRouting::SendPacketFromBuffer().
|
private |
Remove all expired entries.
Definition at line 165 of file dsr-errorbuff.cc.
References Drop(), m_errorBuffer, and NS_LOG_DEBUG.
Referenced by Dequeue(), DropPacketForErrLink(), Enqueue(), and GetSize().
|
inline |
Set error buffer timeout.
t | the error buffer timeout |
Definition at line 266 of file dsr-errorbuff.h.
References m_errorBufferTimeout.
Referenced by ns3::dsr::DsrRouting::Start().
|
inline |
Set maximum queue length.
len | the maximum queue length |
Definition at line 250 of file dsr-errorbuff.h.
References m_maxLen.
Referenced by ns3::dsr::DsrRouting::Start().
|
private |
The send buffer to cache unsent packet.
Definition at line 281 of file dsr-errorbuff.h.
Referenced by Dequeue(), DropPacketForErrLink(), Enqueue(), Find(), GetBuffer(), GetSize(), and Purge().
|
private |
The maximum period of time that a routing protocol is allowed to buffer a packet for, seconds.
Definition at line 300 of file dsr-errorbuff.h.
Referenced by Enqueue(), GetErrorBufferTimeout(), and SetErrorBufferTimeout().
|
private |
The maximum number of packets that we allow a routing protocol to buffer.
Definition at line 298 of file dsr-errorbuff.h.
Referenced by Enqueue(), GetMaxQueueLen(), and SetMaxQueueLen().