24 #include "ns3/packet.h"
25 #include "ns3/trace-source-accessor.h"
26 #include "ns3/uinteger.h"
27 #include "ns3/simulator.h"
41 m_timeStamp (Seconds (0)),
42 m_fragmentation (false),
54 m_timeStamp (timeStamp),
55 m_fragmentation (false),
64 uint32_t size = m_packet->GetSize () + m_hdrType.GetSerializedSize ();
71 size += m_hdr.GetSerializedSize ();
88 MakeUintegerChecker<uint32_t> ())
89 .AddTraceSource (
"Enqueue",
92 .AddTraceSource (
"Dequeue",
95 .AddTraceSource (
"Drop",
111 : m_maxSize (maxSize),
114 m_nrRequestPackets (0)
175 "Can not enqueue more packets: no space left in the queue");
180 NS_LOG_INFO (
"Enqueued Packet IS A Request BW packet");
182 "Can not enqueue more packets: no space left in the queue");
190 NS_LOG_INFO (
"FRAG_DEBUG: Enqueued Packet IS NOT a fragment" << std::endl);
210 NS_LOG_INFO (
"\t Enqueued Packet IS a fragment, add subhdr" << std::endl);
217 "\n\t\t fragmentOffset=" << fragmentOffset <<
219 "\n\t\t fragmentSize=" << fragmentSize << std::endl);
225 fragmentSubhdr.
SetFc (2);
228 NS_LOG_INFO (
"\t FragmentSize=" << fragment->GetSize () << std::endl);
229 fragment->AddHeader (fragmentSubhdr);
244 fragment->AddHeader (element.
m_hdr);
261 NS_LOG_INFO (
"FRAG_DEBUG: Dequeue function" << std::endl);
268 uint32_t maxFragmentSize = availableByte - headerSize;
273 "\n\t\t availableByte=" << availableByte <<
274 "\n\t\t headerSize=" << headerSize <<
275 "\n\t\t maxFragmentSize=" << maxFragmentSize <<
""
276 "\n\t\t fragmentOffset=" << fragmentOffset <<
277 "\n\t\t payloadSize=" << packet->
GetSize ()
288 fragmentSubhdr.
SetFc (1);
293 fragmentSubhdr.
SetFc (3);
296 NS_LOG_INFO (
"\t FragmentSize=" << fragment->GetSize () << std::endl);
297 fragment->AddHeader (fragmentSubhdr);
315 fragment->AddHeader (element.
m_hdr);
383 Time &timeStamp)
const
434 for (std::deque<QueueElement>::const_iterator iter =
m_queue.begin (); iter
452 for (std::deque<QueueElement>::iterator iter =
m_queue.begin (); iter
495 for (std::deque<QueueElement>::const_iterator iter =
m_queue.begin (); iter
508 "\n\t\t m_fragmentation is true " << std::endl);
518 for (std::deque<QueueElement>::const_iterator iter =
m_queue.begin (); iter
530 uint32_t hdrSize = 0;
539 NS_LOG_INFO (
"\t\t\t m_hdrType.GetSerializedSize=" <<
557 for (std::deque<QueueElement>::const_iterator iter =
m_queue.begin (); iter
573 <<
"\n\t\t\t (fragment)payloadSize=" <<
592 NS_LOG_INFO (
"\t Required Bytes = " << requiredByte << std::endl);
600 for (std::deque<QueueElement>::iterator iter =
m_queue.begin (); iter
603 if (iter->m_hdrType.GetType () == packetType)
605 iter->SetFragmentation ();
614 for (std::deque<QueueElement>::iterator iter =
m_queue.begin (); iter
617 if (iter->m_hdrType.GetType () == packetType)
619 iter->SetFragmentNumber ();
628 for (std::deque<QueueElement>::iterator iter =
m_queue.begin (); iter
631 if (iter->m_hdrType.GetType () == packetType)
633 iter->SetFragmentOffset (offset);
654 m_fragmentOffset += offset;