A Discrete-Event Network Simulator
API
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
ns3::dsr::DsrErrorBuffer Class Reference

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...
 

Static Private Member Functions

static bool LinkEqual (DsrErrorBuffEntry en, const std::vector< Ipv4Address > link)
 Check if the send buffer entry is the same or not. More...
 

Private Attributes

std::vector< DsrErrorBuffEntrym_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...
 

Detailed Description

DSR error buffer.

Definition at line 196 of file dsr-errorbuff.h.

Constructor & Destructor Documentation

◆ DsrErrorBuffer()

ns3::dsr::DsrErrorBuffer::DsrErrorBuffer ( )
inline

Default constructor.

Definition at line 202 of file dsr-errorbuff.h.

Member Function Documentation

◆ Dequeue()

bool ns3::dsr::DsrErrorBuffer::Dequeue ( Ipv4Address  dst,
DsrErrorBuffEntry entry 
)

Return first found (the earliest) entry for given destination.

Parameters
[in]dstThe destination to look for
[out]entryThe entry
Returns
true if an entry is found

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().

◆ Drop()

void ns3::dsr::DsrErrorBuffer::Drop ( DsrErrorBuffEntry  en,
std::string  reason 
)
private

Notify that packet is dropped from queue by timeout.

Parameters
enError Buffer Entry
reasonDrop reason.

Definition at line 184 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().

◆ DropLink()

void ns3::dsr::DsrErrorBuffer::DropLink ( DsrErrorBuffEntry  en,
std::string  reason 
)
private

Notify that packet is dropped from queue by link error.

Parameters
enError Buffer Entry
reasonDrop reason.

Definition at line 193 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().

◆ DropPacketForErrLink()

void ns3::dsr::DsrErrorBuffer::DropPacketForErrLink ( Ipv4Address  source,
Ipv4Address  nextHop 
)

Remove all packets with the error link.

Parameters
sourceThe source
nextHopThe next hop

Definition at line 85 of file dsr-errorbuff.cc.

References DropLink(), LinkEqual(), list, m_errorBuffer, NS_LOG_FUNCTION, and Purge().

Referenced by ns3::dsr::DsrRouting::AddRoute(), and ns3::dsr::DsrRouting::AddRoute_Link().

◆ Enqueue()

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.

Parameters
entryerror buffer entry
Returns
true if entry added
Todo:
check the source and destination over here

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().

◆ Find()

bool ns3::dsr::DsrErrorBuffer::Find ( Ipv4Address  dst)

Finds whether a packet with destination dst exists in the queue.

Parameters
dstThe destination
Returns
true if a packet is found.

Definition at line 129 of file dsr-errorbuff.cc.

References m_errorBuffer, and NS_LOG_DEBUG.

Referenced by ns3::dsr::DsrRouting::SendPacketFromBuffer().

◆ GetBuffer()

std::vector<DsrErrorBuffEntry>& ns3::dsr::DsrErrorBuffer::GetBuffer ( )
inline

Get error buffer entry.

Returns
the DSR error buffer

Definition at line 274 of file dsr-errorbuff.h.

References m_errorBuffer.

◆ GetErrorBufferTimeout()

Time ns3::dsr::DsrErrorBuffer::GetErrorBufferTimeout ( ) const
inline

Get error buffer timeout.

Returns
the error buffer timeout

Definition at line 258 of file dsr-errorbuff.h.

References m_errorBufferTimeout.

◆ GetMaxQueueLen()

uint32_t ns3::dsr::DsrErrorBuffer::GetMaxQueueLen ( ) const
inline

Get maximum queue length.

Returns
the maximum queue length

Definition at line 242 of file dsr-errorbuff.h.

References m_maxLen.

◆ GetSize()

uint32_t ns3::dsr::DsrErrorBuffer::GetSize ( void  )

Returns the number of entries in the queue.

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().

◆ LinkEqual()

static bool ns3::dsr::DsrErrorBuffer::LinkEqual ( DsrErrorBuffEntry  en,
const std::vector< Ipv4Address link 
)
inlinestaticprivate

Check if the send buffer entry is the same or not.

Parameters
enBuffer Entry
linkLink description.
Returns
true if the entry is compatible with the link description (source and next hop)

Definition at line 308 of file dsr-errorbuff.h.

Referenced by DropPacketForErrLink().

◆ Purge()

void ns3::dsr::DsrErrorBuffer::Purge ( )
private

Remove all expired entries.

Definition at line 163 of file dsr-errorbuff.cc.

References Drop(), m_errorBuffer, and NS_LOG_DEBUG.

Referenced by Dequeue(), DropPacketForErrLink(), Enqueue(), and GetSize().

◆ SetErrorBufferTimeout()

void ns3::dsr::DsrErrorBuffer::SetErrorBufferTimeout ( Time  t)
inline

Set error buffer timeout.

Parameters
tthe error buffer timeout

Definition at line 266 of file dsr-errorbuff.h.

References m_errorBufferTimeout.

Referenced by ns3::dsr::DsrRouting::Start().

◆ SetMaxQueueLen()

void ns3::dsr::DsrErrorBuffer::SetMaxQueueLen ( uint32_t  len)
inline

Set maximum queue length.

Parameters
lenthe maximum queue length

Definition at line 250 of file dsr-errorbuff.h.

References m_maxLen.

Referenced by ns3::dsr::DsrRouting::Start().

Member Data Documentation

◆ m_errorBuffer

std::vector<DsrErrorBuffEntry> ns3::dsr::DsrErrorBuffer::m_errorBuffer
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().

◆ m_errorBufferTimeout

Time ns3::dsr::DsrErrorBuffer::m_errorBufferTimeout
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().

◆ m_maxLen

uint32_t ns3::dsr::DsrErrorBuffer::m_maxLen
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().


The documentation for this class was generated from the following files: