36#include "ns3/he-capabilities.h"
37#include "ns3/ht-capabilities.h"
39#include "ns3/packet.h"
40#include "ns3/vht-capabilities.h"
134 if (maxAmpduSize == 0)
136 NS_LOG_DEBUG(
"A-MPDU Aggregation is disabled on this station for AC " << ac);
153 NS_ABORT_MSG_IF(!heCapabilities,
"HE Capabilities element not received");
155 maxAmpduSize =
std::min(maxAmpduSize, heCapabilities->GetMaxAmpduLength());
159 NS_ABORT_MSG_IF(!vhtCapabilities,
"VHT Capabilities element not received");
161 maxAmpduSize =
std::min(maxAmpduSize, vhtCapabilities->GetMaxAmpduLength());
165 NS_ABORT_MSG_IF(!htCapabilities,
"HT Capabilities element not received");
167 maxAmpduSize =
std::min(maxAmpduSize, htCapabilities->GetMaxAmpduLength());
171 NS_LOG_DEBUG(
"A-MPDU aggregation is not available for non-HT PHYs");
182 return (4 - (ampduSize % 4)) % 4;
197std::vector<Ptr<WifiMpdu>>
200 Time availableTime)
const
204 std::vector<Ptr<WifiMpdu>> mpduList;
208 uint8_t tid = mpdu->GetHeader().GetQosTid();
224 << nextMpdu->GetHeader().GetSequenceNumber()
225 <<
" to A-MPDU, packet size = " << nextMpdu->GetSize()
226 <<
", A-MPDU size = " << txParams.
GetSize(recipient));
228 mpduList.push_back(nextMpdu);
253 if (mpduList.size() == 1)
Aggregator used to construct A-MPDUs.
static uint8_t CalculatePadding(uint32_t ampduSize)
~MpduAggregator() override
void DoDispose() override
Destructor implementation.
static void Aggregate(Ptr< const WifiMpdu > mpdu, Ptr< Packet > ampdu, bool isSingle)
Aggregate an MPDU to an A-MPDU.
Ptr< WifiMac > m_mac
the MAC of this station
uint32_t GetMaxAmpduSize(Mac48Address recipient, uint8_t tid, WifiModulationClass modulation) const
Determine the maximum size for an A-MPDU of the given TID that can be sent to the given receiver when...
static AmpduSubframeHeader GetAmpduSubframeHeader(uint16_t mpduSize, bool isSingle)
Get the A-MPDU subframe header corresponding to the MPDU size and whether the MPDU is a single MPDU.
static TypeId GetTypeId()
Get the type ID.
void SetWifiMac(const Ptr< WifiMac > mac)
Set the MAC layer to use.
static uint32_t GetSizeIfAggregated(uint32_t mpduSize, uint32_t ampduSize)
Compute the size of the A-MPDU resulting from the aggregation of an MPDU of size mpduSize and an A-MP...
std::vector< Ptr< WifiMpdu > > GetNextAmpdu(Ptr< WifiMpdu > mpdu, WifiTxParameters &txParams, Time availableTime) const
Attempt to aggregate other MPDUs to the given MPDU, while meeting the following constraints:
A base class which provides memory management and object aggregation.
virtual void DoDispose()
Destructor implementation.
void AddAtEnd(Ptr< const Packet > packet)
Concatenate the input packet at the end of the current packet.
void AddHeader(const Header &header)
Add header to this packet.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Smart pointer class similar to boost::intrusive_ptr.
uint16_t GetBaBufferSize(Mac48Address address, uint8_t tid) const
bool GetBaAgreementEstablished(Mac48Address address, uint8_t tid) const
Ptr< WifiMpdu > PeekNextMpdu(uint8_t linkId, uint8_t tid=8, Mac48Address recipient=Mac48Address::GetBroadcast(), Ptr< WifiMpdu > item=nullptr)
Peek the next frame to transmit on the given link to the given receiver and of the given TID from the...
Ptr< WifiMpdu > GetNextMpdu(uint8_t linkId, Ptr< WifiMpdu > peekedItem, WifiTxParameters &txParams, Time availableTime, bool initialFrame)
Prepare the frame to transmit on the given link starting from the MPDU that has been previously peeke...
uint16_t GetBaStartingSequence(Mac48Address address, uint8_t tid) const
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< const HtCapabilities > GetStationHtCapabilities(Mac48Address from)
Return the HT capabilities sent by the remote station.
Ptr< const HeCapabilities > GetStationHeCapabilities(Mac48Address from)
Return the HE 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,...
uint32_t GetSize(Mac48Address receiver) const
Get the size in bytes of the (A-)MPDU addressed to the given receiver.
WifiTxVector m_txVector
TXVECTOR of the frame being prepared.
WifiModulationClass GetModulationClass() 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_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(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.
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)
@ WIFI_MOD_CLASS_HE
HE (Clause 27)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static constexpr uint8_t SINGLE_LINK_OP_ID
Link ID for single link operations (helps tracking places where correct link ID is to be used to supp...
void AddWifiMacTrailer(Ptr< Packet > packet)
Add FCS trailer to a packet.
bool IsInWindow(uint16_t seq, uint16_t winstart, uint16_t winsize)