32 #include "dsr-rsendbuff.h"
35 #include "ns3/ipv4-route.h"
36 #include "ns3/socket.h"
45 SendBuffer::GetSize ()
52 SendBuffer::Enqueue (SendBuffEntry & entry)
55 for (std::vector<SendBuffEntry>::const_iterator i =
m_sendBuffer.begin (); i
61 if ((i->GetPacket ()->GetUid () == entry.GetPacket ()->GetUid ())
62 && (i->GetDestination () == entry.GetDestination ()))
83 SendBuffer::DropPacketWithDst (Ipv4Address dst)
90 for (std::vector<SendBuffEntry>::iterator i =
m_sendBuffer.begin (); i
95 Drop (*i,
"DropPacketWithDst");
103 SendBuffer::Dequeue (Ipv4Address dst, SendBuffEntry & entry)
111 if (i->GetDestination () == dst)
115 NS_LOG_DEBUG (
"Packet size while dequeuing " << entry.GetPacket ()->GetSize ());
123 SendBuffer::Find (Ipv4Address dst)
128 for (std::vector<SendBuffEntry>::const_iterator i =
m_sendBuffer.begin (); i
131 if (i->GetDestination () == dst)
143 operator() (SendBuffEntry
const & e)
const
146 return (e.GetExpireTime () <
Seconds (0));
158 for (std::vector<SendBuffEntry>::iterator i =
m_sendBuffer.begin (); i
164 Drop (*i,
"Drop out-dated packet ");
Time m_sendBufferTimeout
The maximum period of time that a routing protocol is allowed to buffer a packet for, seconds.
void Drop(SendBuffEntry en, std::string reason)
Notify that packet is dropped from queue by timeout.
#define NS_LOG_FUNCTION(parameters)
uint64_t GetUid(void) const
#define NS_LOG_COMPONENT_DEFINE(name)
void Purge()
Remove all expired entries.
#define NS_LOG_LOGIC(msg)
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
#define NS_LOG_DEBUG(msg)
uint32_t m_maxLen
The maximum number of packets that we allow a routing protocol to buffer.
std::vector< SendBuffEntry > m_sendBuffer
The send buffer to cache unsent packet.
static bool IsEqual(SendBuffEntry en, const Ipv4Address dst)