20#ifndef DSR_ERRORBUFF_H
21#define DSR_ERRORBUFF_H
23#include "ns3/ipv4-routing-protocol.h"
24#include "ns3/simulator.h"
Ipv4 addresses are stored in host order in this class.
Smart pointer class similar to boost::intrusive_ptr.
Control the scheduling of simulation events.
static Time Now()
Return the current simulation virtual time.
Simulation virtual time values and global simulation resolution.
DsrErrorBuffEntry(Ptr< const Packet > pa=nullptr, Ipv4Address d=Ipv4Address(), Ipv4Address s=Ipv4Address(), Ipv4Address n=Ipv4Address(), Time exp=Simulator::Now(), uint8_t p=0)
Create an DsrErrorBuffEntry with the given parameters.
Ptr< const Packet > GetPacket() const
Get packet from entry.
void SetDestination(Ipv4Address d)
Set destination address.
Ipv4Address m_nextHop
Nexthop address.
void SetNextHop(Ipv4Address n)
Set next hop.
Ptr< const Packet > m_packet
Data packet.
void SetSource(Ipv4Address s)
Set source address.
void SetProtocol(uint8_t p)
Set protocol number.
void SetExpireTime(Time exp)
Set expire time.
Ipv4Address m_source
Source address.
Ipv4Address m_dst
Destination address.
Ipv4Address GetNextHop() const
Get next hop.
Ipv4Address GetSource() const
Get source address.
Time GetExpireTime() const
Get expire time.
void SetPacket(Ptr< const Packet > p)
Set packet for entry.
uint8_t m_protocol
The protocol number.
Time m_expire
Expire time for queue entry.
Ipv4Address GetDestination() const
Get destination address.
uint8_t GetProtocol() const
Get protocol number.
bool operator==(const DsrErrorBuffEntry &o) const
Compare send buffer entries.
Time m_errorBufferTimeout
The maximum period of time that a routing protocol is allowed to buffer a packet for,...
uint32_t m_maxLen
The maximum number of packets that we allow a routing protocol to buffer.
uint32_t GetMaxQueueLen() const
Get maximum queue length.
void SetMaxQueueLen(uint32_t len)
Set maximum queue length.
std::vector< DsrErrorBuffEntry > & GetBuffer()
Get error buffer entry.
Time GetErrorBufferTimeout() const
Get error buffer timeout.
bool Enqueue(DsrErrorBuffEntry &entry)
Push entry in queue, if there is no entry with the same packet and destination address in queue.
void DropLink(DsrErrorBuffEntry en, std::string reason)
Notify that packet is dropped from queue by link error.
bool Dequeue(Ipv4Address dst, DsrErrorBuffEntry &entry)
Return first found (the earliest) entry for given destination.
bool Find(Ipv4Address dst)
Finds whether a packet with destination dst exists in the queue.
DsrErrorBuffer()
Default constructor.
void DropPacketForErrLink(Ipv4Address source, Ipv4Address nextHop)
Remove all packets with the error link.
void SetErrorBufferTimeout(Time t)
Set error buffer timeout.
uint32_t GetSize()
Returns the number of entries in the queue.
std::vector< DsrErrorBuffEntry > m_errorBuffer
The send buffer to cache unsent packet.
void Drop(DsrErrorBuffEntry en, std::string reason)
Notify that packet is dropped from queue by timeout.
void Purge()
Remove all expired entries.
Time Now()
create an ns3::Time instance which contains the current simulation time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.