22 #include "ns3/uinteger.h"
36 .SetGroupName (
"Wifi")
71 uint32_t actualSize = aggregatedPacket->
GetSize ();
83 currentPacket = packet->
Copy ();
86 aggregatedPacket->
AddAtEnd (currentPacket);
95 return (4 - (packet->
GetSize () % 4 )) % 4;
106 uint32_t maxSize = aggregatedPacket->
GetSize ();
107 uint16_t extractedLength;
109 uint32_t deserialized = 0;
111 while (deserialized < maxSize)
115 extractedMsdu = aggregatedPacket->
CreateFragment (0, static_cast<uint32_t> (extractedLength));
117 deserialized += extractedLength;
119 padding = (4 - ((extractedLength + 14) % 4 )) % 4;
121 if (padding > 0 && deserialized < maxSize)
124 deserialized += padding;
128 set.push_back (packetHdr);
130 NS_LOG_INFO (
"Deaggreated A-MSDU: extracted " << set.size () <<
" MSDUs");
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 "...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
static DeaggregatedMsdus Deaggregate(Ptr< Packet > aggregatedPacket)
#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.
Ptr< Packet > CreateFragment(uint32_t start, uint32_t length) const
Create a new packet which contains a fragment of the original packet.
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.
uint8_t CalculatePadding(Ptr< const Packet > packet) const
Calculates how much padding must be added to the end of aggregated packet, after that a new packet is...
uint16_t GetMaxAmsduSize(void) const
Returns the maximum A-MSDU size in bytes.
static TypeId GetTypeId(void)
Get the type ID.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
std::list< std::pair< Ptr< Packet >, AmsduSubframeHeader > > DeaggregatedMsdus
DeaggregatedMsdus typedef.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual ~MsduAggregator()
bool Aggregate(Ptr< const Packet > packet, Ptr< Packet > aggregatedPacket, Mac48Address src, Mac48Address dest) const
Adds packet to aggregatedPacket.
Aggregator used to construct A-MSDUs.
A base class which provides memory management and object aggregation.
a unique identifier for an interface.
uint16_t m_maxAmsduLength
maximum AMSDU length
TypeId SetParent(TypeId tid)
Set the parent TypeId.
void AddHeader(const Header &header)
Add header to this packet.
void SetMaxAmsduSize(uint16_t maxSize)
Sets the maximum A-MSDU size in bytes.