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. More... | |
typedef std::list< std::pair< Ptr< const Packet >, AmsduSubframeHeader > >::const_iterator | DeaggregatedMsdusCI |
DeaggregatedMsdusCI typedef. More... | |
typedef std::list< WifiMacQueueElem >::iterator | Iterator |
Const iterator typedef. More... | |
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. More... | |
virtual | ~WifiMpdu () |
void | Aggregate (Ptr< const WifiMpdu > msdu) |
Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU). More... | |
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. More... | |
DeaggregatedMsdusCI | begin () const |
Get a constant iterator pointing to the first MSDU in the list of aggregated MSDUs. More... | |
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. More... | |
DeaggregatedMsdusCI | end () const |
Get a constant iterator indicating past-the-last MSDU in the list of aggregated MSDUs. More... | |
Mac48Address | GetDestinationAddress () const |
Return the destination address present in the header. More... | |
Time | GetExpiryTime () const |
WifiMacHeader & | GetHeader () |
Get the header stored in this item. More... | |
const WifiMacHeader & | GetHeader () const |
Get the header stored in this item. More... | |
std::set< uint8_t > | GetInFlightLinkIds () const |
Ptr< const WifiMpdu > | GetOriginal () const |
Ptr< const Packet > | GetPacket () const |
Get the packet stored in this item. More... | |
uint32_t | GetPacketSize () const |
Return the size in bytes of the packet or control header or management header stored by this item. More... | |
Ptr< Packet > | GetProtocolDataUnit () const |
Get the MAC protocol data unit (MPDU) corresponding to this item (i.e. More... | |
AcIndex | GetQueueAc () const |
Get the AC of the queue this item is stored into. More... | |
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. More... | |
Time | GetTimestamp () const |
bool | HasSeqNoAssigned () const |
bool | IsFragment () const |
Return true if this item contains an MSDU fragment, false otherwise. More... | |
bool | IsInFlight () const |
bool | IsOriginal () const |
bool | IsQueued () const |
Return true if this item is stored in some queue, false otherwise. More... | |
virtual void | Print (std::ostream &os) const |
Print the item contents. More... | |
void | ResetInFlight (uint8_t linkId) const |
Mark this MPDU as not being in flight on the given link. More... | |
void | SetInFlight (uint8_t linkId) const |
Mark this MPDU as being in flight on the given link. More... | |
void | SetQueueIt (std::optional< Iterator > queueIt, WmqIteratorTag tag) |
Set the queue iterator stored by this object. More... | |
void | UnassignSeqNo () |
Record that a sequence number is no (longer) assigned to this MPDU. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< WifiMpdu > | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o[[maybe_unused]]) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o[[maybe_unused]]) |
Assignment operator. More... | |
void | Ref () const |
Increment the reference count. More... | |
void | Unref () const |
Decrement the reference count. More... | |
Private Types | |
using | InstanceInfo = std::variant< OriginalInfo, Ptr< WifiMpdu > > |
Information stored by the original copy and an alias, respectively. More... | |
Private Member Functions | |
WifiMpdu ()=default | |
Private default constructor (used to construct aliases). More... | |
void | DoAggregate (Ptr< const WifiMpdu > msdu) |
Aggregate the MSDU contained in the given MPDU to this MPDU (thus constituting an A-MSDU). More... | |
OriginalInfo & | GetOriginalInfo () |
const OriginalInfo & | GetOriginalInfo () const |
Iterator | GetQueueIt () const |
Private Attributes | |
WifiMacHeader | m_header |
Information stored by both the original copy and the aliases. More... | |
InstanceInfo | m_instanceInfo |
information associated with the instance type More... | |
Static Private Attributes | |
static constexpr std::size_t | ALIAS = 1 |
index of an alias in the InstanceInfo variant More... | |
static constexpr std::size_t | ORIGINAL |
index of original copy in the InstanceInfo variant More... | |
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 142 of file wifi-mpdu.h.
typedef std::list<std::pair<Ptr<const Packet>, AmsduSubframeHeader> >::const_iterator ns3::WifiMpdu::DeaggregatedMsdusCI |
DeaggregatedMsdusCI typedef.
Definition at line 145 of file wifi-mpdu.h.
|
private |
Information stored by the original copy and an alias, respectively.
Definition at line 305 of file wifi-mpdu.h.
typedef std::list<WifiMacQueueElem>::iterator ns3::WifiMpdu::Iterator |
Const iterator typedef.
Definition at line 161 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::Packet::Copy(), 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. 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 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_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 346 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 372 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 222 of file wifi-mpdu.cc.
References ns3::Packet::AddAtEnd(), ns3::Packet::AddHeader(), ns3::MsduAggregator::CalculatePadding(), ns3::Packet::Copy(), 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 378 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 307 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 325 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::Packet::AddHeader(), 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 301 of file wifi-mpdu.cc.
References GetQueueIt().
|
private |
Definition at line 294 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 288 of file wifi-mpdu.cc.
References GetQueueIt().
uint32_t ns3::WifiMpdu::GetSize | ( | void | ) | 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 360 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 340 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 272 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 384 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 319 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 313 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 278 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 366 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 310 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 281 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 307 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 308 of file wifi-mpdu.h.