34 #include "ns3/ipv4-route.h" 35 #include "ns3/socket.h" 55 uint32_t numPacketswithdst;
56 for (std::vector<QueueEntry>::const_iterator i =
m_queue.begin (); i
60 && (i->GetIpv4Header ().GetDestination ()
67 NS_LOG_DEBUG (
"Number of packets with this destination: " << numPacketswithdst);
71 NS_LOG_DEBUG (
"Max packets reached for this destination. Not queuing any further packets");
88 for (std::vector<QueueEntry>::iterator i =
m_queue.begin (); i
93 Drop (*i,
"DropPacketWithDst ");
105 for (std::vector<QueueEntry>::iterator i =
m_queue.begin (); i !=
m_queue.end (); ++i)
107 if (i->GetIpv4Header ().GetDestination () == dst)
120 for (std::vector<QueueEntry>::const_iterator i =
m_queue.begin (); i
123 if (i->GetIpv4Header ().GetDestination () == dst)
136 for (std::vector<QueueEntry>::const_iterator i =
m_queue.begin (); i
139 if (i->GetIpv4Header ().GetDestination () == dst)
170 for (std::vector<QueueEntry>::iterator i =
m_queue.begin (); i
176 Drop (*i,
"Drop outdated packet ");
std::vector< QueueEntry > m_queue
the queue
uint64_t GetUid(void) const
Returns the packet's Uid.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Ptr< const Packet > GetPacket() const
Get packet.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint32_t GetCountForPacketsWithDst(Ipv4Address dst)
Get count of packets with destination dst in the queue.
static bool IsEqual(QueueEntry en, const Ipv4Address dst)
Determine if queue entries are equal.
bool operator()(QueueEntry const &e) const
Check for expired entry.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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.
Time GetExpireTime() const
Get expire time.
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
void Purge()
Remove all expired entries.
void SetExpireTime(Time exp)
Set expire time.
Ipv4Header GetIpv4Header() const
Get IP header.
Ipv4 addresses are stored in host order in this class.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Time Seconds(double value)
Construct a Time in the indicated unit.
uint32_t GetSize()
Get the 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 the packet is dropped from queue due to 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...