31 #ifndef DSR_MAINTAIN_BUFF_H
32 #define DSR_MAINTAIN_BUFF_H
36 #include "ns3/ipv4-header.h"
37 #include "ns3/ipv4-routing-protocol.h"
38 #include "ns3/simulator.h"
237 uint8_t segsLeft = 0,
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.
DSR Maintain Buffer Entry.
uint8_t GetSegsLeft() const
Get segments left.
void SetDst(Ipv4Address n)
Set destination address.
DsrMaintainBuffEntry(Ptr< const Packet > packet=nullptr, Ipv4Address ourAddress=Ipv4Address(), Ipv4Address nextHop=Ipv4Address(), Ipv4Address src=Ipv4Address(), Ipv4Address dst=Ipv4Address(), uint16_t ackId=0, uint8_t segsLeft=0, Time expire=Simulator::Now())
Construct a DsrMaintainBuffEntry with the given parameters.
void SetExpireTime(Time exp)
Set expiration time.
Ptr< const Packet > GetPacket() const
Get packet.
void SetNextHop(Ipv4Address n)
Set next hop of entry.
Ipv4Address m_nextHop
Next hop Ip address.
Ipv4Address GetSrc() const
Get source address.
void SetSegsLeft(uint8_t segs)
Set segments left.
void SetPacket(Ptr< const Packet > p)
Set packet.
uint8_t m_segsLeft
The segments left field.
Ipv4Address m_dst
The destination address.
Ptr< const Packet > m_packet
Data packet.
Ipv4Address m_ourAdd
Our own ip address.
void SetOurAdd(Ipv4Address us)
Set local address of entry.
void SetSrc(Ipv4Address s)
Set source address.
uint16_t m_ackId
The data ack id.
uint16_t GetAckId() const
Get acknowledge ID.
Ipv4Address GetOurAdd() const
Get local address of entry.
Time GetExpireTime() const
Get expiration time.
void SetAckId(uint16_t ackId)
Set acknowledge ID.
Time m_expire
Expire time for queue entry.
Ipv4Address GetNextHop() const
Get next hop of entry.
Ipv4Address m_src
The source address.
Ipv4Address GetDst() const
Get destination address.
bool Dequeue(Ipv4Address dst, DsrMaintainBuffEntry &entry)
Return first found (the earliest) entry for given destination.
Time m_maintainBufferTimeout
The maximum period of time that a routing protocol is allowed to buffer a packet for,...
void DropPacketWithNextHop(Ipv4Address nextHop)
Remove all packets with next hop IP address dst.
void SetMaxQueueLen(uint32_t len)
Set maximum queue length.
bool AllEqual(DsrMaintainBuffEntry &entry)
Verify if all the elements in the maintenance buffer entry is the same.
bool LinkEqual(DsrMaintainBuffEntry &entry)
Verify if the maintain buffer entry is the same in every field for link ack.
std::vector< NetworkKey > m_allNetworkKey
The vector of network keys.
bool Find(Ipv4Address nextHop)
Finds whether a packet with next hop dst exists in the queue.
void SetMaintainBufferTimeout(Time t)
Set maintain buffer timeout.
uint32_t m_maxLen
The maximum number of packets that we allow a routing protocol to buffer.
uint32_t GetMaxQueueLen() const
Get maximum queue length.
uint32_t GetSize()
Number of entries.
bool PromiscEqual(DsrMaintainBuffEntry &entry)
Verify if the maintain buffer entry is the same in every field for promiscuous ack.
DsrMaintainBuffer()
Default constructor.
bool NetworkEqual(DsrMaintainBuffEntry &entry)
Verify if the maintain buffer entry is the same in every field for network ack.
bool Enqueue(DsrMaintainBuffEntry &entry)
Push entry in queue, if there is no entry with the same packet and destination address in queue.
std::vector< DsrMaintainBuffEntry > m_maintainBuffer
The vector of maintain buffer entries.
Time GetMaintainBufferTimeout() const
Get maintain buffer timeout.
void Purge()
Remove all expired entries.
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.
The maintenance buffer is responsible for maintaining packet next hop delivery The data packet is sav...
Ipv4Address m_source
source address
Ipv4Address m_ourAdd
local address
bool operator<(const LinkKey &o) const
Compare maintain Buffer entries.
Ipv4Address m_destination
destination address
Ipv4Address m_nextHop
next hop address
Ipv4Address m_ourAdd
local address
bool operator<(const NetworkKey &o) const
Compare maintain Buffer entries.
Ipv4Address m_destination
destination address
uint16_t m_ackId
acknowledge ID
Ipv4Address m_source
source address
Ipv4Address m_nextHop
next hop
Ipv4Address m_destination
destination address
Ipv4Address m_source
source address
bool operator<(const PassiveKey &o) const
Compare maintain Buffer entries.
uint8_t m_segsLeft
segments left
uint16_t m_ackId
acknowledge ID