21 #include "ns3/packet.h" 36 m_mpduList.push_back (Create<WifiMacQueueItem> (p, header));
41 : m_isSingle (isSingle)
58 : m_isSingle (mpduList.size () == 1),
61 NS_ABORT_MSG_IF (mpduList.empty (),
"Cannot initialize a WifiPsdu with an empty MPDU list");
96 packet =
m_mpduList.at (0)->GetPacket ()->Copy ();
121 for (std::size_t i = 1; i <
m_mpduList.size (); i++)
123 if (
m_mpduList.at (i)->GetHeader ().GetAddr1 () != ra)
125 NS_ABORT_MSG (
"MPDUs in an A-AMPDU must have the same receiver address");
138 for (std::size_t i = 1; i <
m_mpduList.size (); i++)
140 if (
m_mpduList.at (i)->GetHeader ().GetAddr2 () != ta)
142 NS_ABORT_MSG (
"MPDUs in an A-AMPDU must have the same transmitter address");
155 for (std::size_t i = 1; i <
m_mpduList.size (); i++)
157 if (
m_mpduList.at (i)->GetHeader ().GetDuration () != duration)
159 NS_ABORT_MSG (
"MPDUs in an A-AMPDU must have the same Duration/ID");
172 mpdu->GetHeader ().SetDuration (duration);
184 if (mpdu->GetHeader ().IsQosData ())
186 s.insert (mpdu->GetHeader ().GetQosTid ());
203 if ((*it)->GetHeader ().IsQosData () && (*it)->GetHeader ().GetQosTid () == tid)
205 policy = (*it)->GetHeader ().GetQosAckPolicy ();
216 if ((*it)->GetHeader ().IsQosData () && (*it)->GetHeader ().GetQosTid () == tid
217 && (*it)->GetHeader ().GetQosAckPolicy () != policy)
219 NS_ABORT_MSG (
"QoS Data frames with the same TID must have the same QoS Ack Policy");
233 if (mpdu->GetHeader ().IsQosData () && mpdu->GetHeader ().GetQosTid () == tid)
235 mpdu->GetHeader ().SetQosAckPolicy (policy);
282 std::vector<Ptr<WifiMacQueueItem>>::const_iterator
289 std::vector<Ptr<WifiMacQueueItem>>::iterator
296 std::vector<Ptr<WifiMacQueueItem>>::const_iterator
303 std::vector<Ptr<WifiMacQueueItem>>::iterator
bool IsSingle(void) const
Return true if the PSDU is an S-MPDU.
Simulation virtual time values and global simulation resolution.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
WifiPsdu(Ptr< const Packet > p, const WifiMacHeader &header)
Create a PSDU storing an MPDU.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
void SetDuration(Time duration)
Set the Duration/ID field on all the MPDUs.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
void AddWifiMacTrailer(Ptr< Packet > packet)
Add FCS trailer to a packet.
Time GetTimeStamp(std::size_t i) const
Get the timestamp of the i-th MPDU.
static const uint16_t WIFI_MAC_FCS_LENGTH
The length in octects of the IEEE 802.11 MAC FCS field.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
std::vector< Ptr< WifiMacQueueItem > >::const_iterator end(void) const
Return a const iterator to past-the-last MPDU.
bool m_isSingle
true for an S-MPDU
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...
uint32_t GetSize(void) const
Return the size of the PSDU.
Ptr< const Packet > GetPacket(void) const
Get the PSDU as a single packet.
WifiMacQueueItem stores (const) packets along with their Wifi MAC headers and the time when they were...
void SetAckPolicyForTid(uint8_t tid, WifiMacHeader::QosAckPolicy policy)
Set the QoS Ack Policy of the QoS Data frames included in the PSDU that have the given TID to the giv...
Time GetDuration(void) const
Get the duration from the Duration/ID field, which is common to all the MPDUs.
Mac48Address GetAddr2(void) const
Get the Transmitter Address (TA), which is common to all the MPDUs.
const WifiMacHeader & GetHeader(std::size_t i) const
Get the header of the i-th MPDU.
static void Aggregate(Ptr< const WifiMacQueueItem > mpdu, Ptr< Packet > ampdu, bool isSingle)
Aggregate an MPDU to an A-MPDU.
WifiPsdu stores an MPDU, S-MPDU or A-MPDU, by keeping header(s) and payload(s) separate for each cons...
std::size_t GetNMpdus(void) const
Return the number of MPDUs constituting the PSDU.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::set< uint8_t > GetTids(void) const
Get the set of TIDs of the QoS Data frames included in the PSDU.
Ptr< T > Create(void)
Create class instances by constructors with varying numbers of arguments and return them by Ptr...
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
uint32_t m_size
the size of the PSDU
std::vector< Ptr< WifiMacQueueItem > >::const_iterator begin(void) const
Return a const iterator to the first MPDU.
Mac48Address GetAddr1(void) const
Get the Receiver Address (RA), which is common to all the MPDUs.
std::vector< Ptr< WifiMacQueueItem > > m_mpduList
list of constituent MPDUs
Ptr< const Packet > GetPayload(std::size_t i) const
Get the payload of the i-th MPDU.
WifiMacHeader::QosAckPolicy GetAckPolicyForTid(uint8_t tid) const
Get the QoS Ack Policy of the QoS Data frames included in the PSDU that have the given TID...
void AddHeader(const Header &header)
Add header to this packet.
bool IsAggregate(void) const
Return true if the PSDU is an S-MPDU or A-MPDU.