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

DSR maintain buffer. More...

#include "dsr-maintain-buff.h"

Public Member Functions

 DsrMaintainBuffer ()
 Default constructor. More...
 
bool AllEqual (DsrMaintainBuffEntry &entry)
 Verify if all the elements in the maintenance buffer entry is the same. More...
 
bool Dequeue (Ipv4Address dst, DsrMaintainBuffEntry &entry)
 Return first found (the earliest) entry for given destination. More...
 
void DropPacketWithNextHop (Ipv4Address nextHop)
 Remove all packets with next hop IP address dst. More...
 
bool Enqueue (DsrMaintainBuffEntry &entry)
 Push entry in queue, if there is no entry with the same packet and destination address in queue. More...
 
bool Find (Ipv4Address nextHop)
 Finds whether a packet with next hop dst exists in the queue. More...
 
Time GetMaintainBufferTimeout () const
 Get maintain buffer timeout. More...
 
uint32_t GetMaxQueueLen () const
 Get maximum queue length. More...
 
uint32_t GetSize ()
 Number of entries. More...
 
bool LinkEqual (DsrMaintainBuffEntry &entry)
 Verify if the maintain buffer entry is the same in every field for link ack. More...
 
bool NetworkEqual (DsrMaintainBuffEntry &entry)
 Verify if the maintain buffer entry is the same in every field for network ack. More...
 
bool PromiscEqual (DsrMaintainBuffEntry &entry)
 Verify if the maintain buffer entry is the same in every field for promiscuous ack. More...
 
void SetMaintainBufferTimeout (Time t)
 Set maintain buffer timeout. More...
 
void SetMaxQueueLen (uint32_t len)
 Set maximum queue length. More...
 

Private Member Functions

void Purge ()
 Remove all expired entries. More...
 

Static Private Member Functions

static bool IsEqual (DsrMaintainBuffEntry en, const Ipv4Address nextHop)
 Verify if the maintain buffer is equal or not. More...
 

Private Attributes

std::vector< NetworkKeym_allNetworkKey
 The vector of network keys. More...
 
std::vector< DsrMaintainBuffEntrym_maintainBuffer
 The vector of maintain buffer entries. More...
 
Time m_maintainBufferTimeout
 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 maintain buffer.

Definition at line 394 of file dsr-maintain-buff.h.

Constructor & Destructor Documentation

◆ DsrMaintainBuffer()

ns3::dsr::DsrMaintainBuffer::DsrMaintainBuffer ( )
inline

Default constructor.

Definition at line 400 of file dsr-maintain-buff.h.

Member Function Documentation

◆ AllEqual()

bool ns3::dsr::DsrMaintainBuffer::AllEqual ( DsrMaintainBuffEntry entry)

Verify if all the elements in the maintenance buffer entry is the same.

Note
For real this function checks if at most one entry is equal. If it is, that entry is removed. Further entries are NOT checked. This could be a bug.
Parameters
entryThe Entry to check
Returns
true if an Entry was found and removed.

Definition at line 125 of file dsr-maintain-buff.cc.

References ns3::dsr::DsrMaintainBuffEntry::GetAckId(), ns3::dsr::DsrMaintainBuffEntry::GetDst(), ns3::dsr::DsrMaintainBuffEntry::GetNextHop(), ns3::dsr::DsrMaintainBuffEntry::GetOurAdd(), ns3::dsr::DsrMaintainBuffEntry::GetSegsLeft(), ns3::dsr::DsrMaintainBuffEntry::GetSrc(), and m_maintainBuffer.

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

◆ Dequeue()

bool ns3::dsr::DsrMaintainBuffer::Dequeue ( Ipv4Address  dst,
DsrMaintainBuffEntry entry 
)

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

Parameters
[in]dstEntry destination
[out]entryThe Entry found (if any).
Returns
true on success

Definition at line 93 of file dsr-maintain-buff.cc.

References ns3::dsr::DsrMaintainBuffEntry::GetPacket(), ns3::Packet::GetSize(), m_maintainBuffer, NS_LOG_DEBUG, and Purge().

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

◆ DropPacketWithNextHop()

void ns3::dsr::DsrMaintainBuffer::DropPacketWithNextHop ( Ipv4Address  nextHop)

Remove all packets with next hop IP address dst.

Parameters
nextHopNext hop in the route.

Definition at line 83 of file dsr-maintain-buff.cc.

References IsEqual(), m_maintainBuffer, NS_LOG_FUNCTION, NS_LOG_INFO, and Purge().

◆ Enqueue()

bool ns3::dsr::DsrMaintainBuffer::Enqueue ( DsrMaintainBuffEntry entry)

◆ Find()

bool ns3::dsr::DsrMaintainBuffer::Find ( Ipv4Address  nextHop)

Finds whether a packet with next hop dst exists in the queue.

Parameters
nextHopNext hop in the route.
Returns
true if there is a packet directed to the next hop.

Definition at line 110 of file dsr-maintain-buff.cc.

References m_maintainBuffer, and NS_LOG_DEBUG.

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

◆ GetMaintainBufferTimeout()

Time ns3::dsr::DsrMaintainBuffer::GetMaintainBufferTimeout ( ) const
inline

Get maintain buffer timeout.

Returns
the maintain buffer timeout

Definition at line 444 of file dsr-maintain-buff.h.

References m_maintainBufferTimeout.

◆ GetMaxQueueLen()

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

Get maximum queue length.

Returns
the maximum queue length

Definition at line 428 of file dsr-maintain-buff.h.

References m_maxLen.

◆ GetSize()

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

Number of entries.

Returns
The number of entries.

Definition at line 46 of file dsr-maintain-buff.cc.

References m_maintainBuffer, and Purge().

Referenced by ns3::dsr::DsrRouting::CancelLinkPacketTimer(), and ns3::dsr::DsrRouting::CancelPacketTimerNextHop().

◆ IsEqual()

static bool ns3::dsr::DsrMaintainBuffer::IsEqual ( DsrMaintainBuffEntry  en,
const Ipv4Address  nextHop 
)
inlinestaticprivate

Verify if the maintain buffer is equal or not.

Parameters
enThe Entry to check
nextHopThe next hop to check
Returns
true if an Entry next hop is equal to the function second parameter

Definition at line 490 of file dsr-maintain-buff.h.

References ns3::dsr::DsrMaintainBuffEntry::GetNextHop().

Referenced by DropPacketWithNextHop().

◆ LinkEqual()

bool ns3::dsr::DsrMaintainBuffer::LinkEqual ( DsrMaintainBuffEntry entry)

Verify if the maintain buffer entry is the same in every field for link ack.

Parameters
entryThe Entry to check
Returns
true if an Entry was found and removed.

Definition at line 190 of file dsr-maintain-buff.cc.

References ns3::dsr::DsrMaintainBuffEntry::GetDst(), ns3::dsr::DsrMaintainBuffEntry::GetNextHop(), ns3::dsr::DsrMaintainBuffEntry::GetOurAdd(), ns3::dsr::DsrMaintainBuffEntry::GetSrc(), m_maintainBuffer, and NS_LOG_DEBUG.

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

◆ NetworkEqual()

bool ns3::dsr::DsrMaintainBuffer::NetworkEqual ( DsrMaintainBuffEntry entry)

Verify if the maintain buffer entry is the same in every field for network ack.

Parameters
entryThe Entry to check
Returns
true if an Entry was found and removed.

Definition at line 146 of file dsr-maintain-buff.cc.

References ns3::dsr::DsrMaintainBuffEntry::GetAckId(), ns3::dsr::DsrMaintainBuffEntry::GetDst(), ns3::dsr::DsrMaintainBuffEntry::GetNextHop(), ns3::dsr::DsrMaintainBuffEntry::GetOurAdd(), ns3::dsr::DsrMaintainBuffEntry::GetSrc(), and m_maintainBuffer.

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

◆ PromiscEqual()

bool ns3::dsr::DsrMaintainBuffer::PromiscEqual ( DsrMaintainBuffEntry entry)

Verify if the maintain buffer entry is the same in every field for promiscuous ack.

Parameters
entryThe Entry to check
Returns
true if an Entry was found and removed.

Definition at line 167 of file dsr-maintain-buff.cc.

References ns3::dsr::DsrMaintainBuffEntry::GetAckId(), ns3::dsr::DsrMaintainBuffEntry::GetDst(), ns3::dsr::DsrMaintainBuffEntry::GetSegsLeft(), ns3::dsr::DsrMaintainBuffEntry::GetSrc(), m_maintainBuffer, and NS_LOG_DEBUG.

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

◆ Purge()

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

Remove all expired entries.

Definition at line 229 of file dsr-maintain-buff.cc.

References m_maintainBuffer, and NS_LOG_DEBUG.

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

◆ SetMaintainBufferTimeout()

void ns3::dsr::DsrMaintainBuffer::SetMaintainBufferTimeout ( Time  t)
inline

Set maintain buffer timeout.

Parameters
tthe maintain buffer timeoout

Definition at line 452 of file dsr-maintain-buff.h.

References m_maintainBufferTimeout.

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

◆ SetMaxQueueLen()

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

Set maximum queue length.

Parameters
lenthe maximum queue length

Definition at line 436 of file dsr-maintain-buff.h.

References m_maxLen.

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

Member Data Documentation

◆ m_allNetworkKey

std::vector<NetworkKey> ns3::dsr::DsrMaintainBuffer::m_allNetworkKey
private

The vector of network keys.

Definition at line 479 of file dsr-maintain-buff.h.

◆ m_maintainBuffer

std::vector<DsrMaintainBuffEntry> ns3::dsr::DsrMaintainBuffer::m_maintainBuffer
private

The vector of maintain buffer entries.

Definition at line 477 of file dsr-maintain-buff.h.

Referenced by AllEqual(), Dequeue(), DropPacketWithNextHop(), Enqueue(), Find(), GetSize(), LinkEqual(), NetworkEqual(), PromiscEqual(), and Purge().

◆ m_maintainBufferTimeout

Time ns3::dsr::DsrMaintainBuffer::m_maintainBufferTimeout
private

The maximum period of time that a routing protocol is allowed to buffer a packet for, seconds.

Definition at line 485 of file dsr-maintain-buff.h.

Referenced by Enqueue(), GetMaintainBufferTimeout(), and SetMaintainBufferTimeout().

◆ m_maxLen

uint32_t ns3::dsr::DsrMaintainBuffer::m_maxLen
private

The maximum number of packets that we allow a routing protocol to buffer.

Definition at line 483 of file dsr-maintain-buff.h.

Referenced by Enqueue(), GetMaxQueueLen(), and SetMaxQueueLen().


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