|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
28 #include "ns3/packet.h"
52 if (&txParams ==
this)
82 auto infoIt =
m_info.find (receiver);
84 if (infoIt ==
m_info.end ())
88 return &infoIt->second;
106 if (infoIt ==
m_info.end ())
109 std::map<uint8_t, std::set<uint16_t>> seqNumbers;
117 PsduInfo {hdr, mpdu->GetPacketSize (), 0, seqNumbers});
123 "An MPDU can only be aggregated to an existing (A-)MPDU");
127 + infoIt->second.amsduSize
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 ();
166 + infoIt->second.amsduSize
168 infoIt->second.ampduSize);
178 auto infoIt =
m_info.find (msdu->GetHeader ().GetAddr1 ());
180 "There must be already an MPDU addressed to the same receiver");
183 infoIt->second.header.SetQosAmsdu ();
186 std::pair<uint32_t, uint32_t>
191 NS_ASSERT_MSG (msdu->GetHeader ().IsQosData (),
"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 ()) != infoIt->second.seqNumbers.end (),
204 "At least one MPDU with the same TID must have been added previously");
207 uint32_t currAmsduSize = infoIt->second.amsduSize;
209 if (!infoIt->second.header.IsQosAmsdu ())
216 uint32_t newMpduSize = infoIt->second.header.GetSize () + newAmsduSize +
WIFI_MAC_FCS_LENGTH;
223 return {newAmsduSize, newMpduSize};
231 auto infoIt =
m_info.find (receiver);
233 if (infoIt ==
m_info.end ())
238 uint32_t newMpduSize = infoIt->second.header.GetSize () + infoIt->second.amsduSize +
WIFI_MAC_FCS_LENGTH;
261 for (
const auto& info :
m_info)
263 os <<
" [To=" << info.second.header.GetAddr1 () <<
", A-MSDU size="
264 << info.second.amsduSize <<
", A-MPDU size=" << info.second.ampduSize <<
"]";
270 txParams->
Print (os);
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
std::map< Mac48Address, PsduInfo > PsduInfoMap
Map containing information about the PSDUs addressed to every receiver.
const PsduInfo * GetPsduInfo(Mac48Address receiver) const
Get a pointer to the information about the PSDU addressed to the given receiver, if present,...
void Print(std::ostream &os) const
Print the object contents.
Time m_txDuration
TX duration of the frame.
const PsduInfoMap & GetPsduInfoMap(void) const
Get a const reference to the map containing information about PSDUs.
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.
uint32_t GetSize(Mac48Address receiver) const
Get the size in bytes of the (A-)MPDU addressed to the given receiver.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiTxParameters & operator=(const WifiTxParameters &txParams)
Copy assignment operator.
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
std::unique_ptr< WifiProtection > m_protection
protection method
Smart pointer class similar to boost::intrusive_ptr.
WifiModulationClass GetModulationClass(void) const
Get the modulation class specified by this TXVECTOR.
uint32_t GetSizeIfAddMpdu(Ptr< const WifiMacQueueItem > mpdu) const
Get the size in bytes of the frame in case the given MPDU is added.
std::pair< uint32_t, uint32_t > GetSizeIfAggregateMsdu(Ptr< const WifiMacQueueItem > msdu) const
Get the size in bytes of the frame in case the given MSDU is aggregated.
void Clear(void)
Reset the TX parameters.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
std::unique_ptr< WifiAcknowledgment > m_acknowledgment
acknowledgment method
static Time Min()
Minimum representable Time Not to be confused with Min(Time,Time).
WifiTxVector m_txVector
TXVECTOR of the frame being prepared.
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...
PsduInfoMap m_info
information about the frame being prepared.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
information about the frame being prepared for a specific receiver
void AggregateMsdu(Ptr< const WifiMacQueueItem > msdu)
Record that an MSDU is being aggregated to the last MPDU added to the frame that hase the same receiv...
void AddMpdu(Ptr< const WifiMacQueueItem > mpdu)
Record that an MPDU is being added to the current frame.
@ WIFI_MOD_CLASS_VHT
VHT (Clause 22)
std::ostream & operator<<(std::ostream &os, const Angles &a)
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...