30 #include "ns3/packet.h"
54 if (&txParams ==
this)
84 auto infoIt =
m_info.find(receiver);
86 if (infoIt ==
m_info.end())
90 return &infoIt->second;
108 if (infoIt ==
m_info.end())
111 std::map<uint8_t, std::set<uint16_t>> seqNumbers;
124 "An MPDU can only be aggregated to an existing (A-)MPDU");
129 infoIt->second.ampduSize);
130 infoIt->second.header = hdr;
131 infoIt->second.amsduSize = mpdu->GetPacketSize();
135 auto ret = infoIt->second.seqNumbers.emplace(hdr.
GetQosTid(),
136 std::set<uint16_t>{hdr.GetSequenceNumber()});
151 auto infoIt =
m_info.find(mpdu->GetHeader().GetAddr1());
153 if (infoIt ==
m_info.end())
161 return mpdu->GetSize();
167 infoIt->second.ampduSize);
177 auto infoIt =
m_info.find(msdu->GetHeader().GetAddr1());
179 "There must be already an MPDU addressed to the same receiver");
182 infoIt->second.header.SetQosAmsdu();
185 std::pair<uint32_t, uint32_t>
191 "Can only aggregate a QoS data frame to an A-MSDU");
193 auto infoIt =
m_info.find(msdu->GetHeader().GetAddr1());
195 "There must be already an MPDU addressed to the same receiver");
198 "The amsduSize should be set to the size of the previous MSDU(s)");
200 "The MPDU being built for this receiver must be a QoS data frame");
201 NS_ASSERT_MSG(infoIt->second.header.GetQosTid() == msdu->GetHeader().GetQosTid(),
202 "The MPDU being built must belong to the same TID as the MSDU to aggregate");
203 NS_ASSERT_MSG(infoIt->second.seqNumbers.find(msdu->GetHeader().GetQosTid()) !=
204 infoIt->second.seqNumbers.end(),
205 "At least one MPDU with the same TID must have been added previously");
208 uint32_t currAmsduSize = infoIt->second.amsduSize;
210 if (!infoIt->second.header.IsQosAmsdu())
216 uint32_t newAmsduSize =
218 uint32_t newMpduSize = infoIt->second.header.GetSize() + newAmsduSize +
WIFI_MAC_FCS_LENGTH;
222 return {newAmsduSize,
226 return {newAmsduSize, newMpduSize};
234 auto infoIt =
m_info.find(receiver);
236 if (infoIt ==
m_info.end())
241 uint32_t newMpduSize =
265 for (
const auto& info :
m_info)
267 os <<
" [To=" << info.second.header.GetAddr1() <<
", A-MSDU size=" << info.second.amsduSize
268 <<
", 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.
static Time Min()
Minimum representable Time Not to be confused with Min(Time,Time).
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.
const PsduInfoMap & GetPsduInfoMap() const
Get a const reference to the map containing information about PSDUs.
std::pair< uint32_t, uint32_t > GetSizeIfAggregateMsdu(Ptr< const WifiMpdu > msdu) const
Get the size in bytes of the frame in case the given MSDU is aggregated.
std::unique_ptr< WifiProtection > m_protection
protection method
WifiTxParameters & operator=(const WifiTxParameters &txParams)
Copy assignment operator.
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,...
Time m_txDuration
TX duration of the frame.
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.
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_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 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)
information about the frame being prepared for a specific receiver