19#include "ns3/packet.h"
30 original.m_packet = p;
31 original.m_timestamp = stamp;
66 "This method can only be called on the original version of the MPDU");
71 alias->m_instanceInfo =
Ptr(
const_cast<WifiMpdu*
>(
this));
85 return std::get<OriginalInfo>(origInstanceInfo);
96 return std::get<OriginalInfo>(origInstanceInfo);
110 return original->m_timestamp;
113 return std::get<OriginalInfo>(origInstanceInfo).m_timestamp;
172 NS_ABORT_MSG_IF(msdu && (!msdu->GetHeader().IsQosData() || msdu->GetHeader().IsQosAmsdu()),
173 "Only QoS data frames that do not contain an A-MSDU can be aggregated");
175 "This method can only be called on the original version of the MPDU");
179 if (original.m_msduList.empty())
225 : msdu->GetHeader().GetAddr1());
227 ? msdu->GetHeader().GetAddr2()
228 : (!msdu->GetHeader().IsToDs() ? msdu->GetHeader().GetAddr3()
229 : msdu->GetHeader().GetAddr4()));
230 hdr.
SetLength(
static_cast<uint16_t
>(msdu->GetPacket()->GetSize()));
234 original.m_msduList.emplace_back(msdu->GetPacket(), hdr);
241 if (original.m_packet->GetSize() > 0)
252 Ptr<Packet> amsduSubframe = msdu->GetPacket()->Copy();
253 amsduSubframe->AddHeader(hdr);
254 amsdu->AddAtEnd(amsduSubframe);
255 original.m_packet = amsdu;
268 "This method can only be called on the original version of the MPDU");
271 original.m_queueIt = queueIt;
318 std::set<uint8_t> linkIds;
319 for (
const auto& [linkId, mpdu] :
GetQueueIt()->inflights)
321 linkIds.insert(linkId);
341 (*originalPtr)->m_header.SetSequenceNumber(seqNo);
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...
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.
Smart pointer class similar to boost::intrusive_ptr.
static Time Now()
Return the current simulation virtual time.
Simulation virtual time values and global simulation resolution.
WifiMpdu stores a (const) packet along with a MAC header.
InstanceInfo m_instanceInfo
information associated with the instance type
Time GetTimestamp() const
bool HasSeqNoAssigned() const
Time GetExpiryTime() const
static constexpr std::size_t ALIAS
index of an alias in the InstanceInfo variant
void ResetInFlight(uint8_t linkId) const
Mark this MPDU as not being in flight on the given link.
WifiMacHeader m_header
Information stored by both the original copy and the aliases.
void SetInFlight(uint8_t linkId) const
Mark this MPDU as being in flight on the given link.
Iterator GetQueueIt() const
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).
OriginalInfo & GetOriginalInfo()
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).
void UnassignSeqNo()
Record that a sequence number is no (longer) assigned to this MPDU.
virtual void Print(std::ostream &os) const
Print the item contents.
WifiMpdu()=default
Private default constructor (used to construct aliases).
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.
std::set< uint8_t > GetInFlightLinkIds() const
Ptr< const WifiMpdu > GetOriginal() const
void AssignSeqNo(uint16_t seqNo)
Set the sequence number of this MPDU (and of the original copy, if this is an alias) to the given val...
Ptr< WifiMpdu > CreateAlias(uint8_t linkId) const
Create an alias for this MPDU (which must be an original copy) for transmission on the link with the ...
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 ",...
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
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 octets 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.
Information stored by the original copy only.
bool m_seqNoAssigned
whether a sequence number has been assigned
DeaggregatedMsdus m_msduList
list of aggregated MSDUs included in this MPDU
Ptr< const Packet > m_packet
MSDU or A-MSDU contained in this queue item.
std::optional< Iterator > m_queueIt
Queue iterator pointing to this MPDU, if queued.