30#include "ns3/packet.h"
31#include "ns3/simulator.h"
109 NS_ABORT_MSG_IF(!msdu->GetHeader().IsQosData() || msdu->GetHeader().IsQosAmsdu(),
110 "Only QoS data frames that do not contain an A-MSDU can be aggregated");
155 : msdu->GetHeader().GetAddr1());
157 ? msdu->GetHeader().GetAddr2()
158 : (!msdu->GetHeader().IsToDs() ? msdu->GetHeader().GetAddr3()
159 : msdu->GetHeader().GetAddr4()));
160 hdr.
SetLength(
static_cast<uint16_t
>(msdu->GetPacket()->GetSize()));
162 m_msduList.emplace_back(msdu->GetPacket(), hdr);
175 amsdu->
AddAtEnd(Create<Packet>(padding));
180 Ptr<Packet> amsduSubframe = msdu->GetPacket()->Copy();
209 return (*m_queueIt)->ac;
216 return (*m_queueIt)->expiryTime;
264 os <<
", ack=NormalAck";
268 os <<
", ack=BlockAck";
static WifiMpdu::DeaggregatedMsdus Deaggregate(Ptr< Packet > aggregatedPacket)
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...
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).
Ptr< Packet > Copy() const
performs a COW copy of the packet.
static Time Now()
Return the current simulation virtual time.
Simulation virtual time values and global simulation resolution.
WifiMpdu stores (const) packets along with their Wifi MAC headers and the time when they were enqueue...
Time GetExpiryTime() const
bool IsInFlight() const
Return true if this MPDU is in flight, false otherwise.
DeaggregatedMsdus m_msduList
The list of aggregated MSDUs included in this MPDU.
Ptr< const Packet > m_packet
The packet (MSDU or A-MSDU) contained in this queue item.
WifiMacHeader m_header
Wifi MAC header associated with the packet.
std::list< std::pair< Ptr< constPacket >, AmsduSubframeHeader > >::const_iterator DeaggregatedMsdusCI
DeaggregatedMsdusCI typedef.
const WifiMacHeader & GetHeader() const
Get the header stored in this item.
void Aggregate(Ptr< const WifiMpdu > msdu)
Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU).
void ResetInFlight()
Mark this MPDU as not being in flight (only used if Block Ack agreement established).
uint32_t GetSize() const
Return the size of the packet stored by this item, including header size and trailer size.
Ptr< Packet > GetProtocolDataUnit() const
Get the MAC protocol data unit (MPDU) corresponding to this item (i.e.
void DoAggregate(Ptr< const WifiMpdu > msdu)
Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU).
bool m_inFlight
whether the MPDU is in flight
virtual void Print(std::ostream &os) const
Print the item contents.
Iterator GetQueueIt(WmqIteratorTag tag) const
void SetInFlight()
Mark this MPDU as being in flight (only used if Block Ack agreement established).
Ptr< const Packet > GetPacket() const
Get the packet stored in this item.
DeaggregatedMsdusCI end() const
Get a constant iterator indicating past-the-last MSDU in the list of aggregated MSDUs.
DeaggregatedMsdusCI begin() const
Get a constant iterator pointing to the first MSDU in the list of aggregated MSDUs.
uint32_t GetPacketSize() const
Return the size in bytes of the packet or control header or management header stored by this item.
AcIndex GetQueueAc() const
Get the AC of the queue this item is stored into.
std::list< WifiMacQueueElem >::iterator Iterator
Const iterator typedef.
Mac48Address GetDestinationAddress() const
Return the destination address present in the header.
bool IsQueued() const
Return true if this item is stored in some queue, false otherwise.
void SetQueueIt(std::optional< Iterator > queueIt, WmqIteratorTag tag)
Set the queue iterator stored by this object.
bool IsFragment() const
Return true if this item contains an MSDU fragment, false otherwise.
WifiMpdu(Ptr< const Packet > p, const WifiMacHeader &header)
Create a Wifi MAC queue item containing a packet and a Wifi MAC header.
std::optional< Iterator > m_queueIt
Queue iterator pointing to this MPDU, if queued.
Tag used to allow (only) WifiMacQueue to access the queue iterator stored by a WifiMpdu.
#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_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static const uint16_t WIFI_MAC_FCS_LENGTH
The length in octects of the IEEE 802.11 MAC FCS field.
std::ostream & operator<<(std::ostream &os, const Angles &a)
void AddWifiMacTrailer(Ptr< Packet > packet)
Add FCS trailer to a packet.