DSR error buffer. More...
#include "dsr-errorbuff.h"
Public Member Functions | |
DsrErrorBuffer () | |
Default constructor. | |
bool | Dequeue (Ipv4Address dst, DsrErrorBuffEntry &entry) |
Return first found (the earliest) entry for given destination. | |
void | DropPacketForErrLink (Ipv4Address source, Ipv4Address nextHop) |
Remove all packets with the error link. | |
bool | Enqueue (DsrErrorBuffEntry &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. | |
std::vector< DsrErrorBuffEntry > & | GetBuffer () |
Get error buffer entry. | |
Time | GetErrorBufferTimeout () const |
Get error buffer timeout. | |
uint32_t | GetMaxQueueLen () const |
Get maximum queue length. | |
uint32_t | GetSize () |
Returns the number of entries in the queue. | |
void | SetErrorBufferTimeout (Time t) |
Set error buffer timeout. | |
void | SetMaxQueueLen (uint32_t len) |
Set maximum queue length. | |
Private Member Functions | |
void | Drop (DsrErrorBuffEntry en, std::string reason) |
Notify that packet is dropped from queue by timeout. | |
void | DropLink (DsrErrorBuffEntry en, std::string reason) |
Notify that packet is dropped from queue by link error. | |
void | Purge () |
Remove all expired entries. | |
Private Attributes | |
std::vector< DsrErrorBuffEntry > | m_errorBuffer |
The send buffer to cache unsent packet. | |
Time | m_errorBufferTimeout |
The maximum period of time that a routing protocol is allowed to buffer a packet for, seconds. | |
uint32_t | m_maxLen |
The maximum number of packets that we allow a routing protocol to buffer. | |
DSR error buffer.
Definition at line 204 of file dsr-errorbuff.h.
|
inline |
Default constructor.
Definition at line 210 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 109 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 181 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 189 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 80 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 45 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 129 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 288 of file dsr-errorbuff.h.
References m_errorBuffer.
|
inline |
Get error buffer timeout.
Definition at line 270 of file dsr-errorbuff.h.
References m_errorBufferTimeout.
|
inline |
Get maximum queue length.
Definition at line 252 of file dsr-errorbuff.h.
References m_maxLen.
uint32_t ns3::dsr::DsrErrorBuffer::GetSize | ( | ) |
Returns the number of entries in the queue.
Definition at line 38 of file dsr-errorbuff.cc.
References m_errorBuffer, and Purge().
Referenced by ns3::dsr::DsrRouting::SendPacketFromBuffer().
|
private |
Remove all expired entries.
Definition at line 161 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 279 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 261 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 295 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 315 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 312 of file dsr-errorbuff.h.
Referenced by Enqueue(), GetMaxQueueLen(), and SetMaxQueueLen().