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 50 of file wifi-mpdu.h.
typedef std::list<std::pair<Ptr<const Packet>, AmsduSubframeHeader> > ns3::WifiMpdu::DeaggregatedMsdus |
DeaggregatedMsdus typedef.
Definition at line 131 of file wifi-mpdu.h.
typedef std::list<std::pair<Ptr<constPacket>,AmsduSubframeHeader>>::const_iterator ns3::WifiMpdu::DeaggregatedMsdusCI |
DeaggregatedMsdusCI typedef.
Definition at line 134 of file wifi-mpdu.h.
|
private |
Information stored by the original copy and an alias, respectively.
Definition at line 294 of file wifi-mpdu.h.
typedef std::list<WifiMacQueueElem>::iterator ns3::WifiMpdu::Iterator |
Const iterator typedef.
Definition at line 150 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 26 of file wifi-mpdu.cc.
References ns3::MsduAggregator::Deaggregate(), ns3::WifiMacHeader::IsQosAmsdu(), ns3::WifiMacHeader::IsQosData(), and m_instanceInfo.
|
virtual |
Definition at line 39 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. If the given MPDU is a null pointer, the effect of this call is to add only an A-MSDU subframe header, thus producing an A-MSDU containing a single MSDU.
msdu | the MPDU containing the MSDU to aggregate |
Definition at line 162 of file wifi-mpdu.cc.
References ns3::Create(), DoAggregate(), ns3::WifiMacHeader::GetAddr1(), ns3::WifiMacHeader::GetAddr2(), ns3::WifiMacHeader::IsFromDs(), ns3::WifiMacHeader::IsToDs(), m_header, m_instanceInfo, NS_ABORT_MSG_IF, 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 333 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 359 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 62 of file wifi-mpdu.cc.
References ALIAS, 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 209 of file wifi-mpdu.cc.
References ns3::MsduAggregator::CalculatePadding(), ns3::Create(), 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 365 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 129 of file wifi-mpdu.cc.
References ns3::WifiMacHeader::GetAddr1(), and m_header.
Time ns3::WifiMpdu::GetExpiryTime | ( | ) | const |
Definition at line 294 of file wifi-mpdu.cc.
References GetQueueIt().
Referenced by Print().
WifiMacHeader & ns3::WifiMpdu::GetHeader | ( | ) |
Get the header stored in this item.
Definition at line 123 of file wifi-mpdu.cc.
References m_header.
const WifiMacHeader & ns3::WifiMpdu::GetHeader | ( | ) | const |
Get the header stored in this item.
Definition at line 117 of file wifi-mpdu.cc.
References m_header.
std::set< uint8_t > ns3::WifiMpdu::GetInFlightLinkIds | ( | ) | const |
Definition at line 312 of file wifi-mpdu.cc.
References GetQueueIt(), and IsQueued().
Definition at line 52 of file wifi-mpdu.cc.
References m_instanceInfo.
|
private |
Definition at line 78 of file wifi-mpdu.cc.
References m_instanceInfo.
Referenced by AssignSeqNo(), begin(), end(), GetPacket(), GetQueueIt(), HasSeqNoAssigned(), IsQueued(), and UnassignSeqNo().
|
private |
Definition at line 89 of file wifi-mpdu.cc.
References m_instanceInfo.
Get the packet stored in this item.
Definition at line 100 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 135 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 153 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 288 of file wifi-mpdu.cc.
References GetQueueIt().
|
private |
Definition at line 281 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 275 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 141 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 106 of file wifi-mpdu.cc.
References m_instanceInfo.
bool ns3::WifiMpdu::HasSeqNoAssigned | ( | ) | const |
Definition at line 347 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 147 of file wifi-mpdu.cc.
References ns3::WifiMacHeader::GetFragmentNumber(), ns3::WifiMacHeader::IsMoreFragments(), and m_header.
bool ns3::WifiMpdu::IsInFlight | ( | ) | const |
Definition at line 327 of file wifi-mpdu.cc.
References GetQueueIt(), and IsQueued().
Referenced by Print().
bool ns3::WifiMpdu::IsOriginal | ( | ) | const |
Definition at line 46 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 259 of file wifi-mpdu.cc.
References GetOriginalInfo(), and ns3::WifiMpdu::OriginalInfo::m_queueIt.
Referenced by ~WifiMpdu(), GetInFlightLinkIds(), GetQueueIt(), IsInFlight(), and Print().
|
virtual |
Print the item contents.
os | output stream in which the data should be printed. |
Definition at line 371 of file wifi-mpdu.cc.
References GetExpiryTime(), GetPacket(), GetPacketSize(), IsInFlight(), 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 306 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 300 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 265 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 353 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 299 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 270 of file wifi-mpdu.h.
Referenced by Aggregate(), AssignSeqNo(), CreateAlias(), GetDestinationAddress(), GetHeader(), GetHeader(), GetProtocolDataUnit(), GetSize(), IsFragment(), and Print().
|
private |
information associated with the instance type
Definition at line 296 of file wifi-mpdu.h.
Referenced by WifiMpdu(), ~WifiMpdu(), Aggregate(), AssignSeqNo(), CreateAlias(), DoAggregate(), GetOriginal(), GetOriginalInfo(), GetOriginalInfo(), GetTimestamp(), IsOriginal(), and SetQueueIt().
|
staticconstexprprivate |
index of original copy in the InstanceInfo variant
Definition at line 297 of file wifi-mpdu.h.