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