28 #include "aodv-rqueue.h"
31 #include "ns3/ipv4-route.h"
32 #include "ns3/socket.h"
45 return m_queue.size ();
52 for (std::vector<QueueEntry>::const_iterator i = m_queue.begin (); i
53 != m_queue.end (); ++i)
55 if ((i->GetPacket ()->GetUid () == entry.GetPacket ()->
GetUid ())
56 && (i->GetIpv4Header ().GetDestination ()
63 Drop (m_queue.front (),
"Drop the most aged packet");
64 m_queue.erase (m_queue.begin ());
66 m_queue.push_back (entry);
75 for (std::vector<QueueEntry>::iterator i = m_queue.begin (); i
76 != m_queue.end (); ++i)
78 if (IsEqual (*i, dst))
80 Drop (*i,
"DropPacketWithDst ");
83 m_queue.erase (std::remove_if (m_queue.begin (), m_queue.end (),
84 std::bind2nd (std::ptr_fun (RequestQueue::IsEqual), dst)), m_queue.end ());
91 for (std::vector<QueueEntry>::iterator i = m_queue.begin (); i != m_queue.end (); ++i)
93 if (i->GetIpv4Header ().GetDestination () == dst)
106 for (std::vector<QueueEntry>::const_iterator i = m_queue.begin (); i
107 != m_queue.end (); ++i)
109 if (i->GetIpv4Header ().GetDestination () == dst)
120 return (e.GetExpireTime () <
Seconds (0));
128 for (std::vector<QueueEntry>::iterator i = m_queue.begin (); i
129 != m_queue.end (); ++i)
133 Drop (*i,
"Drop outdated packet ");
136 m_queue.erase (std::remove_if (m_queue.begin (), m_queue.end (), pred),
144 en.GetErrorCallback () (en.GetPacket (), en.GetIpv4Header (),
145 Socket::ERROR_NOROUTETOHOST);
#define NS_LOG_FUNCTION(parameters)
void Drop(QueueEntry en, std::string reason)
Notify that packet is dropped from queue by timeout.
uint64_t GetUid(void) const
#define NS_LOG_COMPONENT_DEFINE(name)
bool Enqueue(QueueEntry &entry)
Push entry in queue, if there is no entry with the same packet and destination address in queue...
void DropPacketWithDst(Ipv4Address dst)
Remove all packets with destination IP address dst.
#define NS_LOG_LOGIC(msg)
uint32_t GetSize()
Number of entries.
Time m_queueTimeout
The maximum period of time that a routing protocol is allowed to buffer a packet for, seconds.
Ipv4 addresses are stored in host order in this class.
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
void Purge()
Remove all expired entries.
uint32_t m_maxLen
The maximum number of packets that we allow a routing protocol to buffer.
bool Find(Ipv4Address dst)
Finds whether a packet with destination dst exists in the queue.
bool Dequeue(Ipv4Address dst, QueueEntry &entry)
Return first found (the earliest) entry for given destination.