14#include "ns3/packet.h"
15#include "ns3/simulator.h"
16#include "ns3/trace-source-accessor.h"
17#include "ns3/uinteger.h"
31 m_fragmentation(
false),
45 m_fragmentation(
false),
54 uint32_t size = m_packet->GetSize() + m_hdrType.GetSerializedSize();
62 size += m_hdr.GetSerializedSize();
73 .SetGroupName(
"Wimax")
74 .AddAttribute(
"MaxSize",
80 .AddTraceSource(
"Enqueue",
83 "ns3::Packet::TracedCallback")
84 .AddTraceSource(
"Dequeue",
87 "ns3::Packet::TracedCallback")
88 .AddTraceSource(
"Drop",
91 "ns3::Packet::TracedCallback");
107 m_nrRequestPackets(0)
167 "Can not enqueue more packets: no space left in the queue");
172 NS_LOG_INFO(
"Enqueued Packet IS A Request BW packet");
174 "Can not enqueue more packets: no space left in the queue");
182 NS_LOG_INFO(
"FRAG_DEBUG: Enqueued Packet IS NOT a fragment" << std::endl);
190 packet->AddHeader(
element.m_hdr);
192 packet->AddHeader(
element.m_hdrType);
203 NS_LOG_INFO(
"\t Enqueued Packet IS a fragment, add subhdr" << std::endl);
210 "\n\t\t fragmentOffset="
212 <<
"\n\t\t fragmentSize=" <<
fragmentSize << std::endl);
236 element.m_hdr.SetLen((uint16_t)length);
255 NS_LOG_INFO(
"FRAG_DEBUG: Dequeue function" << std::endl);
259 2 +
element.m_hdr.GetSerializedSize() +
element.m_hdrType.GetSerializedSize();
267 "\n\t\t availableByte="
271 "\n\t\t fragmentOffset="
272 <<
fragmentOffset <<
"\n\t\t payloadSize=" << packet->GetSize() << std::endl);
307 element.m_hdr.SetLen((uint16_t)length);
329 packet->AddHeader(
element.m_hdr);
347 packet->AddHeader(
element.m_hdr);
368 packet->AddHeader(
element.m_hdr);
391 packet->AddHeader(
element.m_hdr);
501 "\n\t\t m_fragmentation is true "
505 return element.m_fragmentation;
531 NS_LOG_INFO(
"\t\t\t m_hdrType.GetSerializedSize=" <<
element.m_hdrType.GetSerializedSize());
562 <<
element.m_packet->GetSize() <<
"\n\t\t\t fragmentOffset="
563 <<
element.m_fragmentOffset <<
"\n\t\t\t (fragment)payloadSize="
570 return element.m_packet->GetSize();
593 iter->SetFragmentation();
606 iter->SetFragmentNumber();
619 iter->SetFragmentOffset(offset);
640 m_fragmentOffset += offset;
A base class which provides memory management and object aggregation.
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.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
std::deque< QueueElement > PacketQueue
PacketQueue typedef.
Ptr< Packet > Peek(GenericMacHeader &hdr) const
Exclusively for BS.
uint32_t GetFirstPacketPayloadSize(MacHeaderType::HeaderType packetType)
Get first packet payload size of the specified type.
WimaxMacQueue::QueueElement Front(MacHeaderType::HeaderType packetType) const
In the case of non-UGS service flows at the SS side the queue will store both data packets and bandwi...
void Pop(MacHeaderType::HeaderType packetType)
Pop function.
void SetMaxSize(uint32_t maxSize)
set the maximum queue size
TracedCallback< Ptr< const Packet > > m_traceDequeue
dequeue trace callback
uint32_t GetFirstPacketRequiredByte(MacHeaderType::HeaderType packetType)
Get required number of bytes to hold first packet of packetType.
Ptr< Packet > Dequeue(MacHeaderType::HeaderType packetType)
Dequeue a packet of type packetType from the queue.
TracedCallback< Ptr< const Packet > > m_traceEnqueue
enqueue trace callback
uint32_t GetNBytes() const
Get number of bytes in queue.
static TypeId GetTypeId()
Get the type ID.
~WimaxMacQueue() override
uint32_t GetFirstPacketHdrSize(MacHeaderType::HeaderType packetType)
Get first packet header size of the specified type.
void SetFragmentNumber(MacHeaderType::HeaderType packetType)
Set fragment number for first packet of type packetType.
void SetFragmentation(MacHeaderType::HeaderType packetType)
Set fragmentation function.
void SetFragmentOffset(MacHeaderType::HeaderType packetType, uint32_t offset)
Set fragment offset for first packet of type packetType.
bool CheckForFragmentation(MacHeaderType::HeaderType packetType)
Check for fragmentation of the first packet of the specified type.
uint32_t m_nrDataPackets
number data packets
uint32_t m_maxSize
maximum size
bool Enqueue(Ptr< Packet > packet, const MacHeaderType &hdrType, const GenericMacHeader &hdr)
Enqueue a packet.
PacketQueue m_queue
the queue
uint32_t m_nrRequestPackets
number request packets
uint32_t GetQueueLengthWithMACOverhead()
Get queue length considering also the MAC overhead.
bool IsEmpty() const
Check if queue is empty.
const WimaxMacQueue::PacketQueue & GetPacketQueue() const
Get packet queue function.
TracedCallback< Ptr< const Packet > > m_traceDrop
drop trace callback
uint32_t GetMaxSize() const
uint32_t GetSize() const
Get size of queue.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
uint32_t GetSize() const
Get size function.
bool m_fragmentation
To manage fragmentation feature, each QueueElement have 3 new fields: m_fragmentation that becomes tr...
void SetFragmentNumber()
Set fragment number.
GenericMacHeader m_hdr
header
void SetFragmentOffset(uint32_t offset)
Set fragment offset.
void SetFragmentation()
Set fragmentation.