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