WifiMpdu stores a (const) packet along with a MAC header. More...
#include "wifi-mpdu.h"
Classes | |
struct | OriginalInfo |
Information stored by the original copy only. More... | |
Public Types | |
typedef std::list< std::pair< Ptr< const Packet >, AmsduSubframeHeader > > | DeaggregatedMsdus |
DeaggregatedMsdus typedef. | |
typedef std::list< std::pair< Ptr< constPacket >, AmsduSubframeHeader > >::const_iterator | DeaggregatedMsdusCI |
DeaggregatedMsdusCI typedef. | |
typedef std::list< WifiMacQueueElem >::iterator | Iterator |
Const iterator typedef. | |
Public Member Functions | |
WifiMpdu (Ptr< const Packet > p, const WifiMacHeader &header, Time stamp=Simulator::Now()) | |
Create a Wifi MAC queue item containing a packet and a Wifi MAC header. | |
virtual | ~WifiMpdu () |
void | Aggregate (Ptr< const WifiMpdu > msdu) |
Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU). | |
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 value. | |
DeaggregatedMsdusCI | begin () const |
Get a constant iterator pointing to the first MSDU in the list of aggregated MSDUs. | |
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 given ID. | |
DeaggregatedMsdusCI | end () const |
Get a constant iterator indicating past-the-last MSDU in the list of aggregated MSDUs. | |
Mac48Address | GetDestinationAddress () const |
Return the destination address present in the header. | |
Time | GetExpiryTime () const |
WifiMacHeader & | GetHeader () |
Get the header stored in this item. | |
const WifiMacHeader & | GetHeader () const |
Get the header stored in this item. | |
std::set< uint8_t > | GetInFlightLinkIds () const |
Ptr< const WifiMpdu > | GetOriginal () const |
Ptr< const Packet > | GetPacket () const |
Get the packet stored in this item. | |
uint32_t | GetPacketSize () const |
Return the size in bytes of the packet or control header or management header stored by this item. | |
Ptr< Packet > | GetProtocolDataUnit () const |
Get the MAC protocol data unit (MPDU) corresponding to this item (i.e. | |
AcIndex | GetQueueAc () const |
Get the AC of the queue this item is stored into. | |
Iterator | GetQueueIt (WmqIteratorTag tag) const |
uint32_t | GetSize () const |
Return the size of the packet stored by this item, including header size and trailer size. | |
Time | GetTimestamp () const |
bool | HasSeqNoAssigned () const |
bool | IsFragment () const |
Return true if this item contains an MSDU fragment, false otherwise. | |
bool | IsInFlight () const |
bool | IsOriginal () const |
bool | IsQueued () const |
Return true if this item is stored in some queue, false otherwise. | |
virtual void | Print (std::ostream &os) const |
Print the item contents. | |
void | ResetInFlight (uint8_t linkId) const |
Mark this MPDU as not being in flight on the given link. | |
void | SetInFlight (uint8_t linkId) const |
Mark this MPDU as being in flight on the given link. | |
void | SetQueueIt (std::optional< Iterator > queueIt, WmqIteratorTag tag) |
Set the queue iterator stored by this object. | |
void | UnassignSeqNo () |
Record that a sequence number is no (longer) assigned to this MPDU. | |
Public Member Functions inherited from ns3::SimpleRefCount< WifiMpdu > | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Private Types | |
using | InstanceInfo = std::variant< OriginalInfo, Ptr< WifiMpdu > > |
Information stored by the original copy and an alias, respectively. | |
Private Member Functions | |
WifiMpdu ()=default | |
Private default constructor (used to construct aliases). | |
void | DoAggregate (Ptr< const WifiMpdu > msdu) |
Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU). | |
OriginalInfo & | GetOriginalInfo () |
const OriginalInfo & | GetOriginalInfo () const |
Iterator | GetQueueIt () const |
Private Attributes | |
WifiMacHeader | m_header |
Information stored by both the original copy and the aliases. | |
InstanceInfo | m_instanceInfo |
information associated with the instance type | |
Static Private Attributes | |
static constexpr std::size_t | ALIAS = 1 |
index of an alias in the InstanceInfo variant | |
static constexpr std::size_t | ORIGINAL |
index of original copy in the InstanceInfo variant | |
WifiMpdu stores a (const) packet along with a MAC header.
To support 802.11be Multi-Link Operation (MLO), a WifiMpdu variant, referred to as WifiMpdu alias, is added. A WifiMpdu alias stores its own MAC header and a pointer to the original copy of the WifiMpdu.
Definition at line 61 of file wifi-mpdu.h.
typedef std::list<std::pair<Ptr<const Packet>, AmsduSubframeHeader> > ns3::WifiMpdu::DeaggregatedMsdus |
DeaggregatedMsdus typedef.
Definition at line 140 of file wifi-mpdu.h.
typedef std::list<std::pair<Ptr<constPacket>,AmsduSubframeHeader>>::const_iterator ns3::WifiMpdu::DeaggregatedMsdusCI |
DeaggregatedMsdusCI typedef.
Definition at line 143 of file wifi-mpdu.h.
|
private |
Information stored by the original copy and an alias, respectively.
Definition at line 303 of file wifi-mpdu.h.
typedef std::list<WifiMacQueueElem>::iterator ns3::WifiMpdu::Iterator |
Const iterator typedef.
Definition at line 159 of file wifi-mpdu.h.
ns3::WifiMpdu::WifiMpdu | ( | Ptr< const Packet > | p, |
const WifiMacHeader & | header, | ||
Time | stamp = Simulator::Now() |
||
) |
Create a Wifi MAC queue item containing a packet and a Wifi MAC header.
p | the const packet included in the created item. |
header | the Wifi MAC header included in the created item. |
stamp | the timestamp to associate with the MPDU |
Definition at line 37 of file wifi-mpdu.cc.
References ns3::MsduAggregator::Deaggregate(), ns3::WifiMacHeader::IsQosAmsdu(), ns3::WifiMacHeader::IsQosData(), and m_instanceInfo.
|
virtual |
Definition at line 50 of file wifi-mpdu.cc.
References IsQueued(), m_instanceInfo, and NS_ASSERT.
|
privatedefault |
Private default constructor (used to construct aliases).
Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU).
Note that the given MPDU cannot contain an A-MSDU.
msdu | the MPDU containing the MSDU to aggregate |
Definition at line 175 of file wifi-mpdu.cc.
References DoAggregate(), ns3::WifiMacHeader::GetAddr1(), ns3::WifiMacHeader::GetAddr2(), ns3::WifiMacHeader::IsFromDs(), ns3::WifiMacHeader::IsToDs(), m_header, m_instanceInfo, NS_ABORT_MSG_IF, NS_ASSERT, NS_LOG_FUNCTION, ns3::WifiMacHeader::SetAddr3(), and ns3::WifiMacHeader::SetQosAmsdu().
void ns3::WifiMpdu::AssignSeqNo | ( | uint16_t | seqNo | ) |
Set the sequence number of this MPDU (and of the original copy, if this is an alias) to the given value.
Also, record that a sequence number has been assigned to this MPDU.
seqNo | the given sequence number |
Definition at line 337 of file wifi-mpdu.cc.
References GetOriginalInfo(), m_header, m_instanceInfo, ns3::WifiMpdu::OriginalInfo::m_seqNoAssigned, NS_LOG_FUNCTION, and ns3::WifiMacHeader::SetSequenceNumber().
WifiMpdu::DeaggregatedMsdusCI ns3::WifiMpdu::begin | ( | ) | const |
Get a constant iterator pointing to the first MSDU in the list of aggregated MSDUs.
Definition at line 363 of file wifi-mpdu.cc.
References GetOriginalInfo(), and ns3::WifiMpdu::OriginalInfo::m_msduList.
Create an alias for this MPDU (which must be an original copy) for transmission on the link with the given ID.
Aliases have their own copy of the MAC header and cannot be used to perform non-const operations on the frame body.
linkId | the ID of the given link |
Definition at line 73 of file wifi-mpdu.cc.
References ALIAS, IsQueued(), m_header, m_instanceInfo, NS_ABORT_MSG_IF, NS_ASSERT, and NS_LOG_FUNCTION.
Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU).
Note that the given MPDU cannot contain an A-MSDU.
msdu | the MPDU containing the MSDU to aggregate |
Definition at line 213 of file wifi-mpdu.cc.
References ns3::MsduAggregator::CalculatePadding(), m_instanceInfo, NS_ASSERT, NS_LOG_FUNCTION, ns3::AmsduSubframeHeader::SetDestinationAddr(), ns3::AmsduSubframeHeader::SetLength(), and ns3::AmsduSubframeHeader::SetSourceAddr().
Referenced by Aggregate().
WifiMpdu::DeaggregatedMsdusCI ns3::WifiMpdu::end | ( | ) | const |
Get a constant iterator indicating past-the-last MSDU in the list of aggregated MSDUs.
Definition at line 369 of file wifi-mpdu.cc.
References GetOriginalInfo(), and ns3::WifiMpdu::OriginalInfo::m_msduList.
Referenced by grid.TimelinesRenderer::draw_events(), and grid.TimelinesRenderer::draw_ranges().
Mac48Address ns3::WifiMpdu::GetDestinationAddress | ( | ) | const |
Return the destination address present in the header.
Definition at line 142 of file wifi-mpdu.cc.
References ns3::WifiMacHeader::GetAddr1(), and m_header.
Time ns3::WifiMpdu::GetExpiryTime | ( | ) | const |
Definition at line 298 of file wifi-mpdu.cc.
References GetQueueIt().
Referenced by Print().
WifiMacHeader & ns3::WifiMpdu::GetHeader | ( | ) |
Get the header stored in this item.
Definition at line 136 of file wifi-mpdu.cc.
References m_header.
const WifiMacHeader & ns3::WifiMpdu::GetHeader | ( | ) | const |
Get the header stored in this item.
Definition at line 130 of file wifi-mpdu.cc.
References m_header.
std::set< uint8_t > ns3::WifiMpdu::GetInFlightLinkIds | ( | ) | const |
Definition at line 316 of file wifi-mpdu.cc.
References GetQueueIt(), and IsQueued().
Definition at line 63 of file wifi-mpdu.cc.
References m_instanceInfo.
|
private |
Definition at line 91 of file wifi-mpdu.cc.
References m_instanceInfo.
Referenced by AssignSeqNo(), begin(), end(), GetPacket(), GetQueueIt(), HasSeqNoAssigned(), IsQueued(), and UnassignSeqNo().
|
private |
Definition at line 102 of file wifi-mpdu.cc.
References m_instanceInfo.
Get the packet stored in this item.
Definition at line 113 of file wifi-mpdu.cc.
References GetOriginalInfo(), and ns3::WifiMpdu::OriginalInfo::m_packet.
Referenced by GetPacketSize(), GetProtocolDataUnit(), and Print().
uint32_t ns3::WifiMpdu::GetPacketSize | ( | ) | const |
Return the size in bytes of the packet or control header or management header stored by this item.
Definition at line 148 of file wifi-mpdu.cc.
References GetPacket(), and ns3::Packet::GetSize().
Referenced by GetSize(), and Print().
Get the MAC protocol data unit (MPDU) corresponding to this item (i.e.
a copy of the packet stored in this item wrapped with MAC header and trailer)
Definition at line 166 of file wifi-mpdu.cc.
References ns3::AddWifiMacTrailer(), ns3::Packet::Copy(), GetPacket(), and m_header.
AcIndex ns3::WifiMpdu::GetQueueAc | ( | ) | const |
Get the AC of the queue this item is stored into.
Abort if this item is not stored in a queue.
Definition at line 292 of file wifi-mpdu.cc.
References GetQueueIt().
|
private |
Definition at line 285 of file wifi-mpdu.cc.
References GetOriginalInfo(), IsQueued(), ns3::WifiMpdu::OriginalInfo::m_queueIt, and NS_ASSERT.
Referenced by GetExpiryTime(), GetInFlightLinkIds(), GetQueueAc(), GetQueueIt(), IsInFlight(), ResetInFlight(), and SetInFlight().
WifiMpdu::Iterator ns3::WifiMpdu::GetQueueIt | ( | WmqIteratorTag | tag | ) | const |
tag | a wifi MAC queue iterator tag (allows only WifiMacQueue to call this method) |
Definition at line 279 of file wifi-mpdu.cc.
References GetQueueIt().
uint32_t ns3::WifiMpdu::GetSize | ( | ) | const |
Return the size of the packet stored by this item, including header size and trailer size.
Definition at line 154 of file wifi-mpdu.cc.
References GetPacketSize(), ns3::WifiMacHeader::GetSerializedSize(), m_header, and ns3::WIFI_MAC_FCS_LENGTH.
Time ns3::WifiMpdu::GetTimestamp | ( | ) | const |
Definition at line 119 of file wifi-mpdu.cc.
References m_instanceInfo.
bool ns3::WifiMpdu::HasSeqNoAssigned | ( | ) | const |
Definition at line 351 of file wifi-mpdu.cc.
References GetOriginalInfo(), and ns3::WifiMpdu::OriginalInfo::m_seqNoAssigned.
bool ns3::WifiMpdu::IsFragment | ( | ) | const |
Return true if this item contains an MSDU fragment, false otherwise.
Definition at line 160 of file wifi-mpdu.cc.
References ns3::WifiMacHeader::GetFragmentNumber(), ns3::WifiMacHeader::IsMoreFragments(), and m_header.
bool ns3::WifiMpdu::IsInFlight | ( | ) | const |
Definition at line 331 of file wifi-mpdu.cc.
References GetQueueIt(), and IsQueued().
Referenced by Print().
bool ns3::WifiMpdu::IsOriginal | ( | ) | const |
Definition at line 57 of file wifi-mpdu.cc.
References m_instanceInfo.
bool ns3::WifiMpdu::IsQueued | ( | ) | const |
Return true if this item is stored in some queue, false otherwise.
Definition at line 263 of file wifi-mpdu.cc.
References GetOriginalInfo(), and ns3::WifiMpdu::OriginalInfo::m_queueIt.
Referenced by ~WifiMpdu(), CreateAlias(), GetInFlightLinkIds(), GetQueueIt(), IsInFlight(), and Print().
|
virtual |
Print the item contents.
os | output stream in which the data should be printed. |
Definition at line 375 of file wifi-mpdu.cc.
References ns3::WifiMacHeader::GetAddr1(), ns3::WifiMacHeader::GetDuration(), GetExpiryTime(), GetPacket(), GetPacketSize(), ns3::WifiMacHeader::GetQosTid(), ns3::WifiMacHeader::GetSequenceNumber(), ns3::WifiMacHeader::GetTypeString(), IsInFlight(), ns3::WifiMacHeader::IsQosAck(), ns3::WifiMacHeader::IsQosBlockAck(), ns3::WifiMacHeader::IsQosData(), ns3::WifiMacHeader::IsQosNoAck(), IsQueued(), m_header, ns3::Simulator::Now(), and ns3::Time::US.
Referenced by ns3::operator<<().
void ns3::WifiMpdu::ResetInFlight | ( | uint8_t | linkId | ) | const |
Mark this MPDU as not being in flight on the given link.
linkId | the ID of the given link |
Definition at line 310 of file wifi-mpdu.cc.
References GetQueueIt().
void ns3::WifiMpdu::SetInFlight | ( | uint8_t | linkId | ) | const |
Mark this MPDU as being in flight on the given link.
linkId | the ID of the given link |
Definition at line 304 of file wifi-mpdu.cc.
References GetQueueIt().
void ns3::WifiMpdu::SetQueueIt | ( | std::optional< Iterator > | queueIt, |
WmqIteratorTag | tag | ||
) |
Set the queue iterator stored by this object.
queueIt | the queue iterator for this object |
tag | a wifi MAC queue iterator tag (allows only WifiMacQueue to call this method) |
Definition at line 269 of file wifi-mpdu.cc.
References m_instanceInfo, and NS_ABORT_MSG_IF.
void ns3::WifiMpdu::UnassignSeqNo | ( | ) |
Record that a sequence number is no (longer) assigned to this MPDU.
Definition at line 357 of file wifi-mpdu.cc.
References GetOriginalInfo(), and ns3::WifiMpdu::OriginalInfo::m_seqNoAssigned.
|
staticconstexprprivate |
index of an alias in the InstanceInfo variant
Definition at line 308 of file wifi-mpdu.h.
Referenced by CreateAlias().
|
private |
Information stored by both the original copy and the aliases.
Wifi MAC header associated with the packet
Definition at line 279 of file wifi-mpdu.h.
Referenced by Aggregate(), AssignSeqNo(), CreateAlias(), GetDestinationAddress(), GetHeader(), GetProtocolDataUnit(), GetSize(), IsFragment(), and Print().
|
private |
information associated with the instance type
Definition at line 305 of file wifi-mpdu.h.
Referenced by WifiMpdu(), ~WifiMpdu(), Aggregate(), AssignSeqNo(), CreateAlias(), DoAggregate(), GetOriginal(), GetOriginalInfo(), GetTimestamp(), IsOriginal(), and SetQueueIt().
|
staticconstexprprivate |
index of original copy in the InstanceInfo variant
Definition at line 306 of file wifi-mpdu.h.