22 #include "ns3/packet.h" 37 .SetGroupName (
"Wifi")
71 uint32_t actualSize = aggregatedPacket->
GetSize ();
81 currentPacket = packet->
Copy ();
84 aggregatedPacket->
AddAtEnd (currentPacket);
106 currentPacket = packet->
Copy ();
109 aggregatedPacket->
AddAtEnd (currentPacket);
129 if (padding && !last)
140 uint32_t actualSize = aggregatedPacket->
GetSize ();
141 if (blockAckSize > 0)
143 blockAckSize = blockAckSize + 4 + padding;
158 return (4 - (packet->
GetSize () % 4 )) % 4;
169 uint32_t maxSize = aggregatedPacket->
GetSize ();
170 uint16_t extractedLength;
172 uint32_t deserialized = 0;
174 while (deserialized < maxSize)
178 extractedMpdu = aggregatedPacket->
CreateFragment (0, static_cast<uint32_t> (extractedLength));
180 deserialized += extractedLength;
182 padding = (4 - (extractedLength % 4 )) % 4;
184 if (padding > 0 && deserialized < maxSize)
187 deserialized += padding;
191 set.push_back (packetHdr);
193 NS_LOG_INFO (
"Deaggreated A-MPDU: extracted " <<
set.size () <<
" MPDUs");
Aggregator used to construct A-MPDUs.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
bool Aggregate(Ptr< const Packet > packet, Ptr< Packet > aggregatedPacket) const
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
uint8_t CalculatePadding(Ptr< const Packet > packet) const
Ptr< Packet > CreateFragment(uint32_t start, uint32_t length) const
Create a new packet which contains a fragment of the original packet.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
static DeaggregatedMpdus Deaggregate(Ptr< Packet > aggregatedPacket)
Deaggregates an A-MPDU by removing the A-MPDU subframe header and padding.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
void AddAtEnd(Ptr< const Packet > packet)
Concatenate the input packet at the end of the current packet.
void RemoveAtStart(uint32_t size)
Remove size bytes from the start of the current packet.
void AggregateSingleMpdu(Ptr< const Packet > packet, Ptr< Packet > aggregatedPacket) const
virtual ~MpduAggregator()
uint16_t GetMaxAmpduSize(void) const
Returns the maximum A-MPDU size in bytes.
void AddHeaderAndPad(Ptr< Packet > packet, bool last, bool isSingleMpdu) const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
void SetMaxAmpduSize(uint16_t maxSize)
Sets the maximum A-MPDU size in bytes.
bool CanBeAggregated(uint32_t packetSize, Ptr< Packet > aggregatedPacket, uint8_t blockAckSize) const
static TypeId GetTypeId(void)
Get the type ID.
std::list< std::pair< Ptr< Packet >, AmpduSubframeHeader > > DeaggregatedMpdus
A list of deaggregated packets and their A-MPDU subframe headers.
static const uint32_t packetSize
A base class which provides memory management and object aggregation.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
void AddHeader(const Header &header)
Add header to this packet.
uint16_t m_maxAmpduLength
Maximum length in bytes of A-MPDUs.