32 #ifndef DSDV_PACKETQUEUE_H
33 #define DSDV_PACKETQUEUE_H
36 #include "ns3/ipv4-routing-protocol.h"
37 #include "ns3/simulator.h"
72 UnicastForwardCallback GetUnicastForwardCallback ()
const
76 void SetUnicastForwardCallback (UnicastForwardCallback ucb)
80 ErrorCallback GetErrorCallback ()
const
84 void SetErrorCallback (ErrorCallback ecb)
88 Ptr<const Packet> GetPacket ()
const
92 void SetPacket (Ptr<const Packet> p)
96 Ipv4Header GetIpv4Header ()
const
100 void SetIpv4Header (Ipv4Header h)
104 void SetExpireTime (Time exp)
108 Time GetExpireTime ()
const
155 uint32_t GetMaxQueueLen ()
const
159 void SetMaxQueueLen (uint32_t len)
163 uint32_t GetMaxPacketsPerDst ()
const
167 void SetMaxPacketsPerDst (uint32_t len)
171 Time GetQueueTimeout ()
const
175 void SetQueueTimeout (Time t)
182 std::vector<QueueEntry> m_queue;
186 void Drop (QueueEntry en, std::string reason);
QueueEntry(Ptr< const Packet > pa=0, Ipv4Header const &h=Ipv4Header(), UnicastForwardCallback ucb=UnicastForwardCallback(), ErrorCallback ecb=ErrorCallback())
c-tor
Ipv4Header m_header
IP header.
uint32_t GetCountForPacketsWithDst(Ipv4Address dst)
Get count of packets with destination dst in the queue.
Ptr< const Packet > m_packet
Data packet.
void DropPacketWithDst(Ipv4Address dst)
Remove all packets with destination IP address dst.
bool Dequeue(Ipv4Address dst, QueueEntry &entry)
Return first found (the earliest) entry for given destination.
PacketQueue()
Default c-tor.
void Purge()
Remove all expired entries.
Time m_expire
Expire time for queue entry.
Ipv4 addresses are stored in host order in this class.
UnicastForwardCallback m_ucb
Unicast forward callback.
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
bool operator==(QueueEntry const &o) const
uint32_t GetSize()
Number of entries.
uint32_t m_maxLen
The maximum number of packets that we allow a routing protocol to buffer.
ErrorCallback m_ecb
Error callback.
void Drop(QueueEntry en, std::string reason)
Notify that packet is dropped from queue by timeout.
bool Find(Ipv4Address dst)
Finds whether a packet with destination dst exists in the queue.
Time m_queueTimeout
The maximum period of time that a routing protocol is allowed to buffer a packet for, seconds.
uint32_t m_maxLenPerDst
The maximum number of packets that we allow per destination to buffer.
bool Enqueue(QueueEntry &entry)
Push entry in queue, if there is no entry with the same packet and destination address in queue...