23 #include "ns3/packet.h"
27 #include "ns3/ht-capabilities.h"
31 #include "ns3/ht-frame-exchange-manager.h"
46 .SetGroupName (
"Wifi")
73 m_htFem = DynamicCast<HtFrameExchangeManager> (
m_mac->GetFrameExchangeManager ());
92 NS_ASSERT (peekedItem->GetQueueIteratorPairs ().size () == 1);
94 NS_ASSERT ((*peekedIt.
it)->GetPacket () == peekedItem->GetPacket ());
96 uint8_t tid = peekedItem->GetHeader ().GetQosTid ();
97 Mac48Address recipient = peekedItem->GetHeader ().GetAddr1 ();
129 &&
m_htFem->TryAggregateMsdu (*peekedIt.
it, txParams, availableTime))
138 NS_LOG_DEBUG (
"Aggregation failed (could not aggregate at least two MSDUs)");
151 return (4 - (amsduSize % 4 )) % 4;
168 m_mac->GetAttribute (
"BE_MaxAmsduSize", size);
171 m_mac->GetAttribute (
"BK_MaxAmsduSize", size);
174 m_mac->GetAttribute (
"VI_MaxAmsduSize", size);
177 m_mac->GetAttribute (
"VO_MaxAmsduSize", size);
184 uint16_t maxAmsduSize = size.
Get ();
186 if (maxAmsduSize == 0)
188 NS_LOG_DEBUG (
"A-MSDU Aggregation is disabled on this station for AC " << ac);
205 NS_LOG_DEBUG (
"A-MSDU Aggregation disabled because the recipient did not"
206 " send an HT Capabilities element");
217 NS_ABORT_MSG_IF (!vhtCapabilities,
"VHT Capabilities element not received");
219 maxAmsduSize =
std::min (maxAmsduSize,
static_cast<uint16_t
>(vhtCapabilities->GetMaxMpduLength () - 56));
227 maxAmsduSize =
std::min (maxAmsduSize, htCapabilities->GetMaxAmsduLength ());
234 maxAmsduSize =
std::min (maxAmsduSize,
static_cast<uint16_t
>(3839));
248 uint32_t maxSize = aggregatedPacket->
GetSize ();
249 uint16_t extractedLength;
251 uint32_t deserialized = 0;
253 while (deserialized < maxSize)
257 extractedMsdu = aggregatedPacket->
CreateFragment (0,
static_cast<uint32_t
> (extractedLength));
259 deserialized += extractedLength;
261 padding = (4 - ((extractedLength + 14) % 4 )) % 4;
263 if (padding > 0 && deserialized < maxSize)
266 deserialized += padding;
270 set.push_back (packetHdr);
272 NS_LOG_INFO (
"Deaggreated A-MSDU: extracted " << set.size () <<
" MSDUs");
bool IsBroadcast(void) const
Aggregator used to construct A-MSDUs.
uint16_t GetMaxAmsduSize(Mac48Address recipient, uint8_t tid, WifiModulationClass modulation) const
Determine the maximum size for an A-MSDU of the given TID that can be sent to the given receiver when...
void SetWifiMac(const Ptr< RegularWifiMac > mac)
Set the MAC layer to use.
void DoDispose() override
Destructor implementation.
Ptr< RegularWifiMac > m_mac
the MAC of this station
static TypeId GetTypeId(void)
Get the type ID.
static WifiMacQueueItem::DeaggregatedMsdus Deaggregate(Ptr< Packet > aggregatedPacket)
Ptr< HtFrameExchangeManager > m_htFem
the HT Frame Exchange Manager of this station
static uint16_t GetSizeIfAggregated(uint16_t msduSize, uint16_t amsduSize)
Compute the size of the A-MSDU resulting from the aggregation of an MSDU of size msduSize and an A-MS...
static uint8_t CalculatePadding(uint16_t amsduSize)
Calculate how much padding must be added to the end of an A-MSDU of the given size if a new MSDU is a...
Ptr< WifiMacQueueItem > GetNextAmsdu(Ptr< const WifiMacQueueItem > peekedItem, WifiTxParameters &txParams, Time availableTime, WifiMacQueueItem::QueueIteratorPair &queueIt) const
Attempt to aggregate other MSDUs to the given A-MSDU while meeting the following constraints:
virtual ~MsduAggregator()
A base class which provides memory management and object aggregation.
virtual void DoDispose(void)
Destructor implementation.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
void RemoveAtStart(uint32_t size)
Remove size bytes from the start of the current packet.
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
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Smart pointer class similar to boost::intrusive_ptr.
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.
ConstIterator PeekByTidAndAddress(uint8_t tid, Mac48Address dest, ConstIterator pos=EMPTY) const
Search and return, if present in the queue, the first packet having the receiver address equal to des...
void Aggregate(Ptr< const WifiMacQueueItem > msdu)
Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU).
std::list< std::pair< Ptr< const Packet >, AmsduSubframeHeader > > DeaggregatedMsdus
DeaggregatedMsdus typedef.
Ptr< const HtCapabilities > GetStationHtCapabilities(Mac48Address from)
Return the HT capabilities sent by the remote station.
Ptr< const VhtCapabilities > GetStationVhtCapabilities(Mac48Address from)
Return the VHT capabilities sent by the remote station.
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
WifiTxVector m_txVector
TXVECTOR of the frame being prepared.
WifiModulationClass GetModulationClass(void) const
Get the modulation class specified by this TXVECTOR.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#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.
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
@ WIFI_MOD_CLASS_HT
HT (Clause 19)
@ WIFI_MOD_CLASS_VHT
VHT (Clause 22)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< T > Copy(Ptr< T > object)
Return a deep copy of a Ptr.
Information needed to remove an MSDU from the queue.
WifiMacQueue * queue
pointer to the queue where the MSDU is enqueued
ConstIterator it
iterator pointing to the MSDU in the queue