32 #ifndef DSDV_PACKETQUEUE_H
33 #define DSDV_PACKETQUEUE_H
36 #include "ns3/ipv4-routing-protocol.h"
37 #include "ns3/simulator.h"
61 UnicastForwardCallback ucb = UnicastForwardCallback (),
62 ErrorCallback ecb = ErrorCallback ())
std::vector< QueueEntry > m_queue
the queue
Simulation virtual time values and global simulation resolution.
void SetUnicastForwardCallback(UnicastForwardCallback ucb)
Set unicast forward callback function.
Ipv4Header GetIpv4Header() const
Get IP header.
QueueEntry(Ptr< const Packet > pa=0, Ipv4Header const &h=Ipv4Header(), UnicastForwardCallback ucb=UnicastForwardCallback(), ErrorCallback ecb=ErrorCallback())
c-tor
void SetMaxPacketsPerDst(uint32_t len)
Set maximum packets per destination.
void SetIpv4Header(Ipv4Header h)
Set IP header.
Ipv4Header m_header
IP header.
uint32_t GetCountForPacketsWithDst(Ipv4Address dst)
Get count of packets with destination dst in the queue.
Ipv4RoutingProtocol::UnicastForwardCallback UnicastForwardCallback
Unicast forward call back function typedef.
uint32_t GetMaxQueueLen() const
Get maximum queue length.
Ptr< const Packet > m_packet
Data packet.
static bool IsEqual(QueueEntry en, const Ipv4Address dst)
Determine if queue entries are equal.
void SetMaxQueueLen(uint32_t len)
Set maximum queue length.
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.
PacketQueue()
Default c-tor.
UnicastForwardCallback GetUnicastForwardCallback() const
Get unicast forward callback function.
void SetQueueTimeout(Time t)
Set queue timeout.
Ipv4RoutingProtocol::ErrorCallback ErrorCallback
Error callback function typedef.
static Time Now(void)
Return the current simulation virtual time.
uint32_t GetMaxPacketsPerDst() const
Get maximum packets per destination.
void Purge()
Remove all expired entries.
void SetExpireTime(Time exp)
Set expire time.
Time m_expire
Expire time for queue entry.
Ipv4 addresses are stored in host order in this class.
UnicastForwardCallback m_ucb
Unicast forward callback.
ErrorCallback GetErrorCallback() const
Get error callback function.
void SetPacket(Ptr< const Packet > p)
Set packet.
bool operator==(QueueEntry const &o) const
Compare queue entries.
Time Seconds(double value)
Construct a Time in the indicated unit.
Ptr< const Packet > GetPacket() const
Get packet.
void SetErrorCallback(ErrorCallback ecb)
Set error callback function.
Time GetQueueTimeout() const
Get queue timeout.
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.
ErrorCallback m_ecb
Error callback.
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.
Time GetExpireTime() const
Get expire time.
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...