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