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