32 #ifndef DSR_SENDBUFF_H
33 #define DSR_SENDBUFF_H
36 #include "ns3/ipv4-routing-protocol.h"
37 #include "ns3/simulator.h"
uint32_t GetSize()
Number of entries.
Simulation virtual time values and global simulation resolution.
static bool IsEqual(DsrSendBuffEntry en, const Ipv4Address dst)
Check if the send buffer entry is the same or not.
Control the scheduling of simulation events.
Time GetSendBufferTimeout() const
Return the entry lifetime in the queue.
std::vector< DsrSendBuffEntry > m_sendBuffer
The send buffer to cache unsent packet.
Time m_expire
Expire time for queue entry.
Ptr< const Packet > GetPacket() const
void SetDestination(Ipv4Address d)
Ipv4Address m_dst
Destination address.
void SetProtocol(uint8_t p)
std::vector< DsrSendBuffEntry > & GetBuffer()
Return a pointer to the internal queue.
void SetPacket(Ptr< const Packet > p)
void Purge()
Remove all expired entries.
void SetExpireTime(Time exp)
void DropPacketWithDst(Ipv4Address dst)
Remove all packets with destination IP address dst.
bool operator==(DsrSendBuffEntry const &o) const
Compare send buffer entries.
DsrSendBuffer()
Default constructor.
void SetSendBufferTimeout(Time t)
Set the entry lifetime in the queue.
Time m_sendBufferTimeout
The maximum period of time that a routing protocol is allowed to buffer a packet for, seconds.
void Drop(DsrSendBuffEntry en, std::string reason)
Notify that packet is dropped from queue by timeout.
bool Find(Ipv4Address dst)
Check if a packet with destination dst exists in the queue.
Ipv4Address GetDestination() const
bool Enqueue(DsrSendBuffEntry &entry)
Push entry in queue, if there is no entry with the same packet and destination address in queue...
static Time Now(void)
Return the current simulation virtual time.
Time GetExpireTime() const
Ipv4 addresses are stored in host order in this class.
void SetMaxQueueLen(uint32_t len)
Set the maximum queue length.
DsrSendBuffEntry(Ptr< const Packet > pa=0, Ipv4Address d=Ipv4Address(), Time exp=Simulator::Now(), uint8_t p=0)
Construct DsrSendBuffEntry with the given parameters.
uint32_t GetMaxQueueLen() const
Return the maximum queue length.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
uint32_t m_maxLen
The maximum number of packets that we allow a routing protocol to buffer.
Ptr< const Packet > m_packet
Data packet.
uint8_t m_protocol
The protocol number.
bool Dequeue(Ipv4Address dst, DsrSendBuffEntry &entry)
Return first found (the earliest) entry for the given destination.
uint8_t GetProtocol() const