31 #ifndef DSR_PASSIVEBUFF_H
32 #define DSR_PASSIVEBUFF_H
34 #include "ns3/ipv4-routing-protocol.h"
35 #include "ns3/simulator.h"
double f(double x, void *params)
Ipv4 addresses are stored in host order in this class.
A base class which provides memory management and object aggregation.
Control the scheduling of simulation events.
static Time Now()
Return the current simulation virtual time.
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
DSR Passive Buffer Entry.
bool operator==(const DsrPassiveBuffEntry &o) const
Compare send buffer entries.
uint8_t m_protocol
The protocol number.
void SetExpireTime(Time exp)
Set expire time.
uint16_t m_fragmentOffset
Fragment offset.
Ipv4Address GetDestination() const
Get destination address function.
void SetIdentification(uint16_t i)
Set identification function.
void SetDestination(Ipv4Address d)
Set destination address function.
uint8_t m_segsLeft
Segments left.
uint8_t GetProtocol() const
Get protocol.
Ipv4Address m_dst
Destination address.
void SetNextHop(Ipv4Address n)
Set next hop address function.
Ipv4Address GetNextHop() const
Get next hop address function.
void SetSegsLeft(uint8_t seg)
Set segments left.
uint16_t m_identification
Identification.
Ipv4Address GetSource() const
Get source address function.
void SetSource(Ipv4Address s)
Set surce address function.
Ipv4Address m_nextHop
Nexthop address.
Ptr< const Packet > m_packet
Data packet.
void SetProtocol(uint8_t p)
Set protocol function.
Time GetExpireTime() const
Get expire time.
DsrPassiveBuffEntry(Ptr< const Packet > pa=nullptr, Ipv4Address d=Ipv4Address(), Ipv4Address s=Ipv4Address(), Ipv4Address n=Ipv4Address(), uint16_t i=0, uint16_t f=0, uint8_t seg=0, Time exp=Simulator::Now(), uint8_t p=0)
Construct a DsrPassiveBuffEntry with the given parameters.
uint8_t GetSegsLeft() const
Get segments left function.
void SetPacket(Ptr< const Packet > p)
Set packet function.
uint16_t GetIdentification() const
Get identification function.
uint16_t GetFragmentOffset() const
Get fragment offset function.
Ipv4Address m_source
Source address.
Ptr< const Packet > GetPacket() const
Get packet function.
Time m_expire
Expire time for queue entry.
void SetFragmentOffset(uint16_t f)
Set fragment offset function.
Time GetPassiveBufferTimeout() const
Get passive buffer timeout.
bool Enqueue(DsrPassiveBuffEntry &entry)
Push entry in queue, if there is no entry with the same packet and destination address in queue.
void SetPassiveBufferTimeout(Time t)
Set passive buffer timeout.
uint32_t GetSize()
Number of entries.
bool Find(Ipv4Address dst)
Finds whether a packet with destination dst exists in the queue.
void SetMaxQueueLen(uint32_t len)
Set maximum queue length.
bool Dequeue(Ipv4Address dst, DsrPassiveBuffEntry &entry)
Return first found (the earliest) entry for given destination.
void DropLink(DsrPassiveBuffEntry en, std::string reason)
Notify that packet is dropped from queue by timeout.
~DsrPassiveBuffer() override
uint32_t m_maxLen
The maximum number of packets that we allow a routing protocol to buffer.
Time m_passiveBufferTimeout
The maximum period of time that a routing protocol is allowed to buffer a packet for,...
void Purge()
Remove all expired entries.
uint32_t GetMaxQueueLen() const
Get maximum queue length.
static bool LinkEqual(DsrPassiveBuffEntry en, const std::vector< Ipv4Address > link)
Check if the send buffer entry is the same or not.
std::vector< DsrPassiveBuffEntry > m_passiveBuffer
The send buffer to cache unsent packet.
void Drop(DsrPassiveBuffEntry en, std::string reason)
Notify that packet is dropped from queue by timeout.
static TypeId GetTypeId()
Get the type ID.
bool AllEqual(DsrPassiveBuffEntry &entry)
Check if all the entries in passive buffer entry is all equal or not.
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.