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()
Returns the number of entries in the queue.
void SetExpireTime(Time exp)
Set expire time.
Simulation virtual time values and global simulation resolution.
Time GetExpireTime() const
Get expire time.
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
Get destination address.
bool Find(Ipv4Address dst)
Finds whether a packet with destination dst exists in the queue.
void SetPacket(Ptr< const Packet > p)
Set packet for entry.
uint32_t m_maxLen
The maximum number of packets that we allow a routing protocol to buffer.
void SetDestination(Ipv4Address d)
Set destination address.
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 link error.
Ptr< const Packet > m_packet
Data packet.
void SetNextHop(Ipv4Address n)
Set next hop.
void DropPacketForErrLink(Ipv4Address source, Ipv4Address nextHop)
Remove all packets with the error link.
void SetErrorBufferTimeout(Time t)
Set error buffer timeout.
void SetProtocol(uint8_t p)
Set protocol number.
void SetMaxQueueLen(uint32_t len)
Set maximum queue length.
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()
Get error buffer entry.
uint8_t GetProtocol() const
Get protocol number.
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)
Set source address.
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
Get source address.
Ipv4 addresses are stored in host order in this class.
uint8_t m_protocol
The protocol number.
Ptr< const Packet > GetPacket() const
Get packet from entry.
uint32_t GetMaxQueueLen() const
Get maximum queue length.
Time GetErrorBufferTimeout() const
Get error buffer timeout.
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
Get next hop.
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.