19#include "ns3/packet.h" 
   43    if (&txParams == 
this)
 
 
   73    auto infoIt = 
m_info.find(receiver);
 
   75    if (infoIt == 
m_info.end())
 
   79    return &infoIt->second;
 
 
   97    if (infoIt == 
m_info.end())
 
  100        std::map<uint8_t, std::set<uint16_t>> seqNumbers;
 
  107        const auto [it, inserted] =
 
  119                  "An MPDU can only be aggregated to an existing (A-)MPDU");
 
  124        PsduInfo{infoIt->second.
header, infoIt->second.amsduSize, infoIt->second.ampduSize, {}};
 
  134        infoIt->second.ampduSize);
 
  135    infoIt->second.header = hdr;
 
  136    infoIt->second.amsduSize = mpdu->GetPacketSize();
 
  140        const auto [it, inserted] =
 
  141            infoIt->second.seqNumbers.emplace(hdr.
GetQosTid(),
 
  142                                              std::set<uint16_t>{hdr.GetSequenceNumber()});
 
 
  166    auto& lastInfo = (*m_lastInfoIt)->second;
 
  178        NS_ASSERT(lastInfo.seqNumbers.contains(tid));
 
  179        lastInfo.seqNumbers.at(tid).erase(*seqNoSet.cbegin());
 
 
  187    auto infoIt = 
m_info.find(receiver);
 
 
  198    auto infoIt = 
m_info.find(mpdu->GetHeader().GetAddr1());
 
  200    if (infoIt == 
m_info.end())
 
  208        return mpdu->GetSize();
 
  214        infoIt->second.ampduSize);
 
 
  224    auto infoIt = 
m_info.find(msdu->GetHeader().GetAddr1());
 
  226                  "There must be already an MPDU addressed to the same receiver");
 
  231        PsduInfo{infoIt->second.
header, infoIt->second.amsduSize, infoIt->second.ampduSize, {}};
 
  234    infoIt->second.header.SetQosAmsdu();
 
 
  243                  "Can only aggregate a QoS data frame to an A-MSDU");
 
  245    auto infoIt = 
m_info.find(msdu->GetHeader().GetAddr1());
 
  247                  "There must be already an MPDU addressed to the same receiver");
 
  250                  "The amsduSize should be set to the size of the previous MSDU(s)");
 
  252                  "The MPDU being built for this receiver must be a QoS data frame");
 
  253    NS_ASSERT_MSG(infoIt->second.header.GetQosTid() == msdu->GetHeader().GetQosTid(),
 
  254                  "The MPDU being built must belong to the same TID as the MSDU to aggregate");
 
  255    NS_ASSERT_MSG(infoIt->second.seqNumbers.contains(msdu->GetHeader().GetQosTid()),
 
  256                  "At least one MPDU with the same TID must have been added previously");
 
  259    uint32_t currAmsduSize = infoIt->second.amsduSize;
 
  261    if (!infoIt->second.header.IsQosAmsdu())
 
 
  273    auto infoIt = 
m_info.find(receiver);
 
  275    if (infoIt == 
m_info.end())
 
 
  304    for (
const auto& info : 
m_info)
 
  306        os << 
" [To=" << info.second.header.GetAddr1() << 
", A-MSDU size=" << info.second.amsduSize
 
  307           << 
", A-MPDU size=" << info.second.ampduSize << 
"]";
 
 
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...
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...
Smart pointer class similar to boost::intrusive_ptr.
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
uint32_t GetSizeIfAddMpdu(Ptr< const WifiMpdu > mpdu) const
Get the size in bytes of the frame in case the given MPDU is added.
std::optional< Time > m_txDuration
TX duration of the frame.
const PsduInfoMap & GetPsduInfoMap() const
Get a const reference to the map containing information about PSDUs.
PsduInfo m_undoInfo
information needed to undo the addition of an MPDU
std::unique_ptr< WifiProtection > m_protection
protection method
WifiTxParameters & operator=(const WifiTxParameters &txParams)
Copy assignment operator.
uint32_t GetSizeIfAggregateMsdu(Ptr< const WifiMpdu > msdu) const
Get the size in bytes of the frame in case the given MSDU is aggregated.
uint32_t GetSize(Mac48Address receiver) const
Get the size in bytes of the (A-)MPDU addressed to the given receiver.
std::unique_ptr< WifiAcknowledgment > m_acknowledgment
acknowledgment method
const PsduInfo * GetPsduInfo(Mac48Address receiver) const
Get a pointer to the information about the PSDU addressed to the given receiver, if present,...
void UndoAddMpdu()
Undo the addition of the last MPDU added by calling AddMpdu().
bool LastAddedIsFirstMpdu(Mac48Address receiver) const
Check if the last added MPDU is the first MPDU for the given receiver.
WifiTxVector m_txVector
TXVECTOR of the frame being prepared.
PsduInfoMap m_info
information about the frame being prepared.
void AggregateMsdu(Ptr< const WifiMpdu > msdu)
Record that an MSDU is being aggregated to the last MPDU added to the frame that hase the same receiv...
void Print(std::ostream &os) const
Print the object contents.
void AddMpdu(Ptr< const WifiMpdu > mpdu)
Record that an MPDU is being added to the current frame.
void Clear()
Reset the TX parameters.
std::map< Mac48Address, PsduInfo > PsduInfoMap
Map containing information about the PSDUs addressed to every receiver.
std::optional< PsduInfoMap::iterator > m_lastInfoIt
iterator pointing to the entry in the m_info map that was created/modified by the last added MPDU
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
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_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#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 ",...
@ WIFI_MOD_CLASS_VHT
VHT (Clause 22)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static constexpr 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)
information about the frame being prepared for a specific receiver
std::map< uint8_t, std::set< uint16_t > > seqNumbers
set of the sequence numbers of the MPDUs added for each TID
uint32_t ampduSize
the size in bytes of the A-MPDU if multiple MPDUs have been added, and zero otherwise
WifiMacHeader header
MAC header of the last MPDU added.
uint32_t amsduSize
the size in bytes of the MSDU or A-MSDU included in the last MPDU added