34 #include "ns3/ipv4-route.h"
35 #include "ns3/socket.h"
54 uint32_t numPacketswithdst;
55 for (std::vector<QueueEntry>::const_iterator i =
m_queue.begin (); i
59 && (i->GetIpv4Header ().GetDestination ()
66 NS_LOG_DEBUG (
"Number of packets with this destination: " << numPacketswithdst);
70 NS_LOG_DEBUG (
"Max packets reached for this destination. Not queuing any further packets");
87 for (std::vector<QueueEntry>::iterator i =
m_queue.begin (); i
92 Drop (*i,
"DropPacketWithDst ");
104 for (std::vector<QueueEntry>::iterator i =
m_queue.begin (); i !=
m_queue.end (); ++i)
106 if (i->GetIpv4Header ().GetDestination () == dst)
119 for (std::vector<QueueEntry>::const_iterator i =
m_queue.begin (); i
122 if (i->GetIpv4Header ().GetDestination () == dst)
135 for (std::vector<QueueEntry>::const_iterator i =
m_queue.begin (); i
138 if (i->GetIpv4Header ().GetDestination () == dst)
161 for (std::vector<QueueEntry>::iterator i =
m_queue.begin (); i
167 Drop (*i,
"Drop outdated packet ");
std::vector< QueueEntry > m_queue
#define NS_LOG_FUNCTION(parameters)
Ipv4Header GetIpv4Header() const
uint64_t GetUid(void) const
A packet is allocated a new uid when it is created empty or with zero-filled payload.
uint32_t GetCountForPacketsWithDst(Ipv4Address dst)
Get count of packets with destination dst in the queue.
NS_LOG_COMPONENT_DEFINE("DsdvPacketQueue")
static bool IsEqual(QueueEntry en, const Ipv4Address dst)
#define NS_LOG_LOGIC(msg)
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.
void Purge()
Remove all expired entries.
void SetExpireTime(Time exp)
Ipv4 addresses are stored in host order in this class.
#define NS_LOG_DEBUG(msg)
Ptr< const Packet > GetPacket() const
bool operator()(QueueEntry const &e) const
uint32_t GetSize()
Number of entries.
uint32_t m_maxLen
The maximum number of packets that we allow a routing protocol to buffer.
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.
Time GetExpireTime() const
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...