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.
Ipv4Address GetDestination() const
Get destination address of entry.
std::vector< DsrSendBuffEntry > m_sendBuffer
The send buffer to cache unsent packet.
Time m_expire
Expire time for queue entry.
void SetDestination(Ipv4Address d)
Set destination address of entry.
Ipv4Address m_dst
Destination address.
uint8_t GetProtocol() const
Get protocol value.
void SetProtocol(uint8_t p)
Set protocol value.
std::vector< DsrSendBuffEntry > & GetBuffer()
Return a pointer to the internal queue.
void SetPacket(Ptr< const Packet > p)
Set pointer to entry's packet.
bool operator==(DsrSendBuffEntry const &o) const
Compare send buffer entries.
uint32_t GetMaxQueueLen() const
Return the maximum queue length.
void Purge()
Remove all expired entries.
Ptr< const Packet > GetPacket() const
Get pointer to entry's packet.
void SetExpireTime(Time exp)
Set expire time for entry.
void DropPacketWithDst(Ipv4Address dst)
Remove all packets with destination IP address dst.
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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Time GetExpireTime() const
Get expire time for entry.
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 GetSendBufferTimeout() const
Return the entry lifetime in the queue.
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.
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.