24 #include "ns3/packet.h"
25 #include "ns3/trace-source-accessor.h"
26 #include "ns3/uinteger.h"
27 #include "ns3/simulator.h"
42 m_timeStamp (Seconds (0)),
43 m_fragmentation (false),
55 m_timeStamp (timeStamp),
56 m_fragmentation (false),
65 uint32_t size = m_packet->GetSize () + m_hdrType.GetSerializedSize ();
72 size += m_hdr.GetSerializedSize ();
89 MakeUintegerChecker<uint32_t> ())
90 .AddTraceSource (
"Enqueue",
93 .AddTraceSource (
"Dequeue",
96 .AddTraceSource (
"Drop",
112 : m_maxSize (maxSize),
115 m_nrRequestPackets (0)
176 "Can not enqueue more packets: no space left in the queue");
181 NS_LOG_INFO (
"Enqueued Packet IS A Request BW packet");
183 "Can not enqueue more packets: no space left in the queue");
191 NS_LOG_INFO (
"FRAG_DEBUG: Enqueued Packet IS NOT a fragment" << std::endl);
211 NS_LOG_INFO (
"\t Enqueued Packet IS a fragment, add subhdr" << std::endl);
218 "\n\t\t fragmentOffset=" << fragmentOffset <<
220 "\n\t\t fragmentSize=" << fragmentSize << std::endl);
226 fragmentSubhdr.
SetFc (2);
229 NS_LOG_INFO (
"\t FragmentSize=" << fragment->GetSize () << std::endl);
230 fragment->AddHeader (fragmentSubhdr);
245 fragment->AddHeader (element.
m_hdr);
262 NS_LOG_INFO (
"FRAG_DEBUG: Dequeue function" << std::endl);
269 uint32_t maxFragmentSize = availableByte - headerSize;
274 "\n\t\t availableByte=" << availableByte <<
275 "\n\t\t headerSize=" << headerSize <<
276 "\n\t\t maxFragmentSize=" << maxFragmentSize <<
""
277 "\n\t\t fragmentOffset=" << fragmentOffset <<
278 "\n\t\t payloadSize=" << packet->
GetSize ()
289 fragmentSubhdr.
SetFc (1);
294 fragmentSubhdr.
SetFc (3);
297 NS_LOG_INFO (
"\t FragmentSize=" << fragment->GetSize () << std::endl);
298 fragment->AddHeader (fragmentSubhdr);
316 fragment->AddHeader (element.
m_hdr);
384 Time &timeStamp)
const
435 for (std::deque<QueueElement>::const_iterator iter =
m_queue.begin (); iter
453 for (std::deque<QueueElement>::iterator iter =
m_queue.begin (); iter
496 for (std::deque<QueueElement>::const_iterator iter =
m_queue.begin (); iter
509 "\n\t\t m_fragmentation is true " << std::endl);
519 for (std::deque<QueueElement>::const_iterator iter =
m_queue.begin (); iter
531 uint32_t hdrSize = 0;
540 NS_LOG_INFO (
"\t\t\t m_hdrType.GetSerializedSize=" <<
558 for (std::deque<QueueElement>::const_iterator iter =
m_queue.begin (); iter
574 <<
"\n\t\t\t (fragment)payloadSize=" <<
593 NS_LOG_INFO (
"\t Required Bytes = " << requiredByte << std::endl);
601 for (std::deque<QueueElement>::iterator iter =
m_queue.begin (); iter
604 if (iter->m_hdrType.GetType () == packetType)
606 iter->SetFragmentation ();
615 for (std::deque<QueueElement>::iterator iter =
m_queue.begin (); iter
618 if (iter->m_hdrType.GetType () == packetType)
620 iter->SetFragmentNumber ();
629 for (std::deque<QueueElement>::iterator iter =
m_queue.begin (); iter
632 if (iter->m_hdrType.GetType () == packetType)
634 iter->SetFragmentOffset (offset);
655 m_fragmentOffset += offset;
uint32_t GetFirstPacketHdrSize(MacHeaderType::HeaderType packetType)
void SetFragmentOffset(MacHeaderType::HeaderType packetType, uint32_t offset)
keep track of time values and allow control of global simulation resolution
TracedCallback< Ptr< const Packet > > m_traceDrop
std::deque< QueueElement > PacketQueue
TracedCallback< Ptr< const Packet > > m_traceDequeue
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
uint32_t GetSize(void) const
uint32_t GetNBytes(void) const
uint32_t GetSize(void) const
Ptr< Packet > Peek(GenericMacHeader &hdr) const
Same as Dequeue but does not pop from queue.
NS_LOG_COMPONENT_DEFINE("WimaxMacQueue")
void SetFragmentOffset(uint32_t offset)
Ptr< Packet > CreateFragment(uint32_t start, uint32_t length) const
Create a new packet which contains a fragment of the original packet.
uint32_t GetSize(void) const
Hold an unsigned integer type.
void SetFragmentation(void)
TracedCallback< Ptr< const Packet > > m_traceEnqueue
void SetFragmentNumber(void)
uint32_t GetQueueLengthWithMACOverhead(void)
bool CheckForFragmentation(MacHeaderType::HeaderType packetType)
Fragmentation utilities.
uint32_t m_fragmentNumber
bool Enqueue(Ptr< Packet > packet, const MacHeaderType &hdrType, const GenericMacHeader &hdr)
Enqueue a packet.
uint32_t GetFirstPacketRequiredByte(MacHeaderType::HeaderType packetType)
uint32_t m_nrRequestPackets
Ptr< Packet > Copy(void) const
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
uint32_t m_fragmentOffset
WimaxMacQueue::QueueElement Front(MacHeaderType::HeaderType packetType) const
void SetFragmentation(MacHeaderType::HeaderType packetType)
static Time Now(void)
Return the "current simulation time".
uint32_t GetMaxSize(void) const
void SetMaxSize(uint32_t maxSize)
set the maximum queue size
#define NS_ASSERT_MSG(condition, message)
const WimaxMacQueue::PacketQueue & GetPacketQueue(void) const
static TypeId GetTypeId(void)
void Pop(MacHeaderType::HeaderType packetType)
void SetFragmentNumber(MacHeaderType::HeaderType packetType)
a base class which provides memory management and object aggregation
Ptr< Packet > Dequeue(MacHeaderType::HeaderType packetType)
Dequeue a packet of type packetType from the queue.
uint32_t GetFirstPacketPayloadSize(MacHeaderType::HeaderType packetType)
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
void AddHeader(const Header &header)
Add header to this packet.