20#ifndef DSDV_PACKETQUEUE_H
21#define DSDV_PACKETQUEUE_H
23#include "ns3/ipv4-routing-protocol.h"
24#include "ns3/simulator.h"
Ipv4 addresses are stored in host order in this class.
Smart pointer class similar to boost::intrusive_ptr.
static Time Now()
Return the current simulation virtual time.
Simulation virtual time values and global simulation resolution.
std::vector< QueueEntry > m_queue
the queue
bool Find(Ipv4Address dst)
Finds whether a packet with destination dst exists in the queue.
bool Enqueue(QueueEntry &entry)
Push entry in queue, if there is no entry with the same packet and destination address in queue.
uint32_t GetMaxPacketsPerDst() const
Get maximum packets per destination.
void SetQueueTimeout(Time t)
Set queue timeout.
bool Dequeue(Ipv4Address dst, QueueEntry &entry)
Return first found (the earliest) entry for given destination.
void SetMaxPacketsPerDst(uint32_t len)
Set maximum packets per destination.
void DropPacketWithDst(Ipv4Address dst)
Remove all packets with destination IP address dst.
uint32_t GetSize()
Get the number of entries.
void Drop(QueueEntry en, std::string reason)
Notify that the packet is dropped from queue due to timeout.
Time GetQueueTimeout() const
Get queue timeout.
uint32_t GetCountForPacketsWithDst(Ipv4Address dst)
Get count of packets with destination dst in the queue.
PacketQueue()
Default c-tor.
uint32_t m_maxLenPerDst
The maximum number of packets that we allow per destination to buffer.
uint32_t GetMaxQueueLen() const
Get maximum queue length.
void SetMaxQueueLen(uint32_t len)
Set maximum queue length.
uint32_t m_maxLen
The maximum number of packets that we allow a routing protocol to buffer.
void Purge()
Remove all expired entries.
Time m_queueTimeout
The maximum period of time that a routing protocol is allowed to buffer a packet for,...
Ptr< const Packet > GetPacket() const
Get packet.
void SetErrorCallback(ErrorCallback ecb)
Set error callback function.
void SetUnicastForwardCallback(UnicastForwardCallback ucb)
Set unicast forward callback function.
void SetExpireTime(Time exp)
Set expire time.
QueueEntry(Ptr< const Packet > pa=nullptr, const Ipv4Header &h=Ipv4Header(), UnicastForwardCallback ucb=UnicastForwardCallback(), ErrorCallback ecb=ErrorCallback())
c-tor
Time GetExpireTime() const
Get expire time.
void SetPacket(Ptr< const Packet > p)
Set packet.
Ipv4RoutingProtocol::UnicastForwardCallback UnicastForwardCallback
Unicast forward call back function typedef.
Ptr< const Packet > m_packet
Data packet.
UnicastForwardCallback m_ucb
Unicast forward callback.
ErrorCallback GetErrorCallback() const
Get error callback function.
bool operator==(const QueueEntry &o) const
Compare queue entries.
ErrorCallback m_ecb
Error callback.
Ipv4Header GetIpv4Header() const
Get IP header.
Ipv4Header m_header
IP header.
Time m_expire
Expire time for queue entry.
Ipv4RoutingProtocol::ErrorCallback ErrorCallback
Error callback function typedef.
void SetIpv4Header(Ipv4Header h)
Set IP header.
UnicastForwardCallback GetUnicastForwardCallback() const
Get unicast forward callback function.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.