Handle packet fragmentation and retransmissions for data and management frames. More...
#include "txop.h"
Classes | |
struct | LinkEntity |
Structure holding information specific to a single link. More... | |
Public Types | |
enum | ChannelAccessStatus { NOT_REQUESTED = 0 , REQUESTED , GRANTED } |
Enumeration for channel access status. More... | |
typedef Callback< void, WifiMacDropReason, Ptr< const WifiMpdu > > | DroppedMpdu |
typedef for a callback to invoke when an MPDU is dropped. More... | |
Public Member Functions | |
Txop () | |
Txop (Ptr< WifiMacQueue > queue) | |
Constructor. More... | |
~Txop () override | |
int64_t | AssignStreams (int64_t stream) |
Assign a fixed random variable stream number to the random variables used by this model. More... | |
virtual ChannelAccessStatus | GetAccessStatus (uint8_t linkId) const |
uint8_t | GetAifsn () const |
Return the number of slots that make up an AIFS. More... | |
virtual uint8_t | GetAifsn (uint8_t linkId) const |
Return the number of slots that make up an AIFS for the given link. More... | |
std::vector< uint8_t > | GetAifsns () const |
Return the number of slots that make up an AIFS for each link. More... | |
uint32_t | GetMaxCw () const |
Return the maximum contention window size. More... | |
virtual uint32_t | GetMaxCw (uint8_t linkId) const |
Return the maximum contention window size for the given link. More... | |
std::vector< uint32_t > | GetMaxCws () const |
Return the maximum contention window size for each link. More... | |
uint32_t | GetMinCw () const |
Return the minimum contention window size. More... | |
virtual uint32_t | GetMinCw (uint8_t linkId) const |
Return the minimum contention window size for the given link. More... | |
std::vector< uint32_t > | GetMinCws () const |
Return the minimum contention window size for each link. More... | |
Time | GetTxopLimit () const |
Return the TXOP limit. More... | |
Time | GetTxopLimit (uint8_t linkId) const |
Return the TXOP limit for the given link. More... | |
std::vector< Time > | GetTxopLimits () const |
Return the TXOP limit for each link. More... | |
Ptr< WifiMacQueue > | GetWifiMacQueue () const |
Return the packet queue associated with this Txop. More... | |
virtual bool | HasFramesToTransmit (uint8_t linkId) |
Check if the Txop has frames to transmit over the given link. More... | |
virtual bool | IsQosTxop () const |
Check for QoS TXOP. More... | |
virtual void | NotifyChannelAccessed (uint8_t linkId, Time txopDuration=Seconds(0)) |
Called by the FrameExchangeManager to notify that channel access has been granted on the given link for the given amount of time. More... | |
virtual void | NotifyChannelReleased (uint8_t linkId) |
Called by the FrameExchangeManager to notify the completion of the transmissions. More... | |
virtual void | NotifyOff () |
When off operation occurs, the queue gets cleaned up. More... | |
virtual void | NotifyOn () |
When on operation occurs, channel access will be started. More... | |
virtual void | NotifySleep (uint8_t linkId) |
Notify that the given link switched to sleep mode. More... | |
virtual void | NotifyWakeUp (uint8_t linkId) |
When wake up operation occurs on a link, channel access on that link will be restarted. More... | |
virtual void | Queue (Ptr< Packet > packet, const WifiMacHeader &hdr) |
virtual void | Queue (Ptr< WifiMpdu > mpdu) |
void | ResetCw (uint8_t linkId) |
Update the value of the CW variable for the given link to take into account a transmission success or a transmission abort (stop transmission of a packet after the maximum number of retransmissions has been reached). More... | |
void | SetAifsn (uint8_t aifsn) |
Set the number of slots that make up an AIFS. More... | |
void | SetAifsn (uint8_t aifsn, uint8_t linkId) |
Set the number of slots that make up an AIFS for the given link. More... | |
void | SetAifsns (std::vector< uint8_t > aifsns) |
Set the number of slots that make up an AIFS for each link. More... | |
virtual void | SetDroppedMpduCallback (DroppedMpdu callback) |
void | SetMaxCw (uint32_t maxCw) |
Set the maximum contention window size. More... | |
void | SetMaxCw (uint32_t maxCw, uint8_t linkId) |
Set the maximum contention window size for the given link. More... | |
void | SetMaxCws (std::vector< uint32_t > maxCws) |
Set the maximum contention window size for each link. More... | |
void | SetMinCw (uint32_t minCw) |
Set the minimum contention window size. More... | |
void | SetMinCw (uint32_t minCw, uint8_t linkId) |
Set the minimum contention window size for the given link. More... | |
void | SetMinCws (std::vector< uint32_t > minCws) |
Set the minimum contention window size for each link. More... | |
void | SetTxMiddle (const Ptr< MacTxMiddle > txMiddle) |
Set MacTxMiddle this Txop is associated to. More... | |
void | SetTxopLimit (Time txopLimit) |
Set the TXOP limit. More... | |
void | SetTxopLimit (Time txopLimit, uint8_t linkId) |
Set the TXOP limit for the given link. More... | |
void | SetTxopLimits (const std::vector< Time > &txopLimits) |
Set the TXOP limit for each link. More... | |
virtual void | SetWifiMac (const Ptr< WifiMac > mac) |
Set the wifi MAC this Txop is associated to. More... | |
void | StartAccessAfterEvent (uint8_t linkId, bool hadFramesToTransmit, bool checkMediumBusy) |
Request channel access on the given link after the occurrence of an event that possibly requires to generate a new backoff value. More... | |
void | StartBackoffNow (uint32_t nSlots, uint8_t linkId) |
void | SwapLinks (std::map< uint8_t, uint8_t > links) |
Swap the links based on the information included in the given map. More... | |
void | UpdateFailedCw (uint8_t linkId) |
Update the value of the CW variable for the given link to take into account a transmission failure. More... | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. More... | |
~Object () override | |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose () |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. More... | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. More... | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. More... | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. More... | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized () const |
Check if the object has been initialized. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
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... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Attributes | |
static constexpr bool | CHECK_MEDIUM_BUSY |
generation of backoff (also) depends on the busy/idle state of the medium More... | |
static constexpr bool | DIDNT_HAVE_FRAMES_TO_TRANSMIT |
no packet available for transmission was in the queue More... | |
static constexpr bool | DONT_CHECK_MEDIUM_BUSY |
generation of backoff is independent of the busy/idle state of the medium More... | |
static constexpr bool | HAD_FRAMES_TO_TRANSMIT |
packets available for transmission were in the queue More... | |
Protected Types | |
typedef TracedCallback< uint32_t, uint8_t > | BackoffValueTracedCallback |
TracedCallback for backoff trace value typedef. More... | |
typedef TracedCallback< uint32_t, uint8_t > | CwValueTracedCallback |
TracedCallback for CW trace value typedef. More... | |
Protected Member Functions | |
void | DoDispose () override |
Destructor implementation. More... | |
void | DoInitialize () override |
Initialize() implementation. More... | |
virtual void | GenerateBackoff (uint8_t linkId) |
Generate a new backoff for the given link now. More... | |
uint32_t | GetBackoffSlots (uint8_t linkId) const |
Return the current number of backoff slots on the given link. More... | |
Time | GetBackoffStart (uint8_t linkId) const |
Return the time when the backoff procedure started on the given link. More... | |
uint32_t | GetCw (uint8_t linkId) const |
Get the current value of the CW variable for the given link. More... | |
LinkEntity & | GetLink (uint8_t linkId) const |
Get a reference to the link associated with the given ID. More... | |
const std::map< uint8_t, std::unique_ptr< LinkEntity > > & | GetLinks () const |
virtual void | NotifyAccessRequested (uint8_t linkId) |
Notify that access request has been received for the given link. More... | |
void | RequestAccess (uint8_t linkId) |
Request access to the ChannelAccessManager associated with the given link. More... | |
void | UpdateBackoffSlotsNow (uint32_t nSlots, Time backoffUpdateBound, uint8_t linkId) |
Update backoff slots for the given link that nSlots has passed. More... | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. More... | |
Protected Attributes | |
BackoffValueTracedCallback | m_backoffTrace |
backoff trace value More... | |
CwValueTracedCallback | m_cwTrace |
CW trace value. More... | |
DroppedMpdu | m_droppedMpduCallback |
the dropped MPDU callback More... | |
Ptr< WifiMac > | m_mac |
the wifi MAC More... | |
Ptr< WifiMacQueue > | m_queue |
the wifi MAC queue More... | |
Ptr< UniformRandomVariable > | m_rng |
the random stream More... | |
Ptr< MacTxMiddle > | m_txMiddle |
the MacTxMiddle More... | |
Private Member Functions | |
virtual std::unique_ptr< LinkEntity > | CreateLinkEntity () const |
Create a LinkEntity object. More... | |
Private Attributes | |
std::map< uint8_t, std::unique_ptr< LinkEntity > > | m_links |
ID-indexed map of LinkEntity objects. More... | |
Friends | |
class | ::EmlsrUlTxopTest |
class | ChannelAccessManager |
< ChannelAccessManager associated class More... | |
Additional Inherited Members | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
Handle packet fragmentation and retransmissions for data and management frames.
This class implements the packet fragmentation and retransmission policy for data and management frames. It uses the ns3::ChannelAccessManager helper class to decide when to send a packet. Packets are stored in a ns3::WifiMacQueue until they can be sent.
The policy currently implemented uses a simple fragmentation threshold: any packet bigger than this threshold is fragmented in fragments whose size is smaller than the threshold.
The retransmission policy is also very simple: every packet is retransmitted until it is either successfully transmitted or it has been retransmitted up until the SSRC or SLRC thresholds.
The RTS/CTS policy is similar to the fragmentation policy: when a packet is bigger than a threshold, the RTS/CTS protocol is used.
|
protected |
TracedCallback for backoff trace value typedef.
|
protected |
TracedCallback for CW trace value typedef.
typedef Callback<void, WifiMacDropReason, Ptr<const WifiMpdu> > ns3::Txop::DroppedMpdu |
ns3::Txop::Txop | ( | Ptr< WifiMacQueue > | queue | ) |
Constructor.
queue | the wifi MAC queue |
Definition at line 140 of file txop.cc.
References m_rng, and NS_LOG_FUNCTION.
|
override |
Definition at line 147 of file txop.cc.
References NS_LOG_FUNCTION.
int64_t ns3::Txop::AssignStreams | ( | int64_t | stream | ) |
Assign a fixed random variable stream number to the random variables used by this model.
Return the number of streams (possibly zero) that have been assigned.
stream | first stream index to use. |
Definition at line 564 of file txop.cc.
References m_rng, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().
Referenced by ns3::MeshHelper::AssignStreams(), ns3::WifiHelper::AssignStreams(), and AssignWifiRandomStreams().
|
privatevirtual |
Create a LinkEntity object.
Reimplemented in ns3::QosTxop.
Definition at line 164 of file txop.cc.
Referenced by SetWifiMac().
|
overrideprotectedvirtual |
Destructor implementation.
This method is called by Dispose() or by the Object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.
It is safe to call GetObject() from within this method.
Reimplemented from ns3::Object.
Definition at line 153 of file txop.cc.
References m_links, m_mac, m_queue, m_rng, m_txMiddle, and NS_LOG_FUNCTION.
Referenced by ns3::QosTxop::DoDispose().
|
overrideprotectedvirtual |
Initialize() implementation.
This method is called only once by Initialize(). If the user calls Initialize() multiple times, DoInitialize() is called only the first time.
Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject() and AggregateObject() from within this method.
Reimplemented from ns3::Object.
Definition at line 593 of file txop.cc.
References GenerateBackoff(), openflow-switch::link, m_links, NS_LOG_FUNCTION, and ResetCw().
|
protectedvirtual |
Generate a new backoff for the given link now.
linkId | the ID of the given link |
Definition at line 646 of file txop.cc.
References GetCw(), ns3::UniformRandomVariable::GetInteger(), m_backoffTrace, m_rng, NS_LOG_FUNCTION, and StartBackoffNow().
Referenced by DoInitialize(), NotifyChannelReleased(), ns3::QosTxop::NotifyChannelReleased(), and StartAccessAfterEvent().
|
virtual |
linkId | the ID of the given link |
Definition at line 604 of file txop.cc.
References ns3::Txop::LinkEntity::access, and GetLink().
Referenced by ns3::ChannelAccessManager::DoGrantDcfAccess(), ns3::ChannelAccessManager::NeedBackoffUponAccess(), and ns3::ChannelAccessManager::RequestAccess().
uint8_t ns3::Txop::GetAifsn | ( | ) | const |
Return the number of slots that make up an AIFS.
For 11be multi-link devices, return the number of slots that make up an AIFS on the first link.
Definition at line 466 of file txop.cc.
Referenced by ns3::ChannelAccessManager::GetBackoffStartFor(), GetTypeId(), ns3::ChannelAccessManager::NeedBackoffUponAccess(), and ns3::ChannelAccessManager::RequestAccess().
|
virtual |
Return the number of slots that make up an AIFS for the given link.
linkId | the ID of the given link |
Reimplemented in ns3::QosTxop.
Definition at line 484 of file txop.cc.
References ns3::Txop::LinkEntity::aifsn, and GetLink().
std::vector< uint8_t > ns3::Txop::GetAifsns | ( | ) | const |
Return the number of slots that make up an AIFS for each link.
Definition at line 472 of file txop.cc.
References openflow-switch::link, and m_links.
Referenced by GetTypeId().
|
protected |
Return the current number of backoff slots on the given link.
linkId | the ID of the given link |
Definition at line 324 of file txop.cc.
References ns3::Txop::LinkEntity::backoffSlots, and GetLink().
Referenced by ns3::ChannelAccessManager::DisableEdcaFor(), ns3::ChannelAccessManager::DoGrantDcfAccess(), ns3::ChannelAccessManager::GetBackoffEndFor(), ns3::ChannelAccessManager::NeedBackoffUponAccess(), and ns3::ChannelAccessManager::ResetBackoff().
|
protected |
Return the time when the backoff procedure started on the given link.
linkId | the ID of the given link |
Definition at line 330 of file txop.cc.
References ns3::Txop::LinkEntity::backoffStart, and GetLink().
Referenced by ns3::ChannelAccessManager::GetBackoffStartFor(), and ns3::ChannelAccessManager::RequestAccess().
|
protected |
Get the current value of the CW variable for the given link.
The initial value is minCw.
linkId | the ID of the given link |
Definition at line 297 of file txop.cc.
References ns3::Txop::LinkEntity::cw, and GetLink().
Referenced by GenerateBackoff().
|
protected |
Get a reference to the link associated with the given ID.
linkId | the given link ID |
Definition at line 170 of file txop.cc.
References m_links, and NS_ASSERT.
Referenced by GetAccessStatus(), GetAifsn(), GetBackoffSlots(), GetBackoffStart(), GetCw(), ns3::QosTxop::GetLink(), GetMaxCw(), GetMinCw(), GetTxopLimit(), NotifyAccessRequested(), NotifyChannelAccessed(), NotifyChannelReleased(), Queue(), RequestAccess(), ns3::ChannelAccessManager::ResetBackoff(), ResetCw(), SetAifsn(), SetMaxCw(), SetMinCw(), SetTxopLimit(), StartAccessAfterEvent(), StartBackoffNow(), UpdateBackoffSlotsNow(), and UpdateFailedCw().
|
protected |
Definition at line 179 of file txop.cc.
References m_links.
Referenced by ns3::QosTxop::QosTxop().
uint32_t ns3::Txop::GetMaxCw | ( | ) | const |
Return the maximum contention window size.
For 11be multi-link devices, return the maximum contention window size on the first link.
Definition at line 442 of file txop.cc.
Referenced by GetTypeId(), and UpdateFailedCw().
|
virtual |
Return the maximum contention window size for the given link.
linkId | the ID of the given link |
Reimplemented in ns3::QosTxop.
Definition at line 460 of file txop.cc.
References ns3::Txop::LinkEntity::cwMax, and GetLink().
std::vector< uint32_t > ns3::Txop::GetMaxCws | ( | ) | const |
Return the maximum contention window size for each link.
Definition at line 448 of file txop.cc.
References openflow-switch::link, and m_links.
Referenced by GetTypeId().
uint32_t ns3::Txop::GetMinCw | ( | ) | const |
Return the minimum contention window size.
For 11be multi-link devices, return the minimum contention window size on the first link.
Definition at line 418 of file txop.cc.
Referenced by GetTypeId(), ResetCw(), and UpdateFailedCw().
|
virtual |
Return the minimum contention window size for the given link.
linkId | the ID of the given link |
Reimplemented in ns3::QosTxop.
Definition at line 436 of file txop.cc.
References ns3::Txop::LinkEntity::cwMin, and GetLink().
std::vector< uint32_t > ns3::Txop::GetMinCws | ( | ) | const |
Return the minimum contention window size for each link.
Definition at line 424 of file txop.cc.
References openflow-switch::link, and m_links.
Referenced by GetTypeId().
Time ns3::Txop::GetTxopLimit | ( | ) | const |
Return the TXOP limit.
Definition at line 490 of file txop.cc.
Referenced by ns3::QosFrameExchangeManager::GetCtsToSelfDurationId(), ns3::ApWifiMac::GetEdcaParameterSet(), ns3::QosFrameExchangeManager::GetFrameDurationId(), ns3::HeFrameExchangeManager::GetMuRtsDurationId(), ns3::HtFrameExchangeManager::GetPsduDurationId(), ns3::QosFrameExchangeManager::GetRtsDurationId(), GetTypeId(), ns3::WifiDefaultAckManager::IsResponseNeeded(), ns3::QosFrameExchangeManager::SendCfEndIfNeeded(), ns3::QosFrameExchangeManager::StartTransmission(), ns3::QosFrameExchangeManager::TransmissionFailed(), ns3::HtFrameExchangeManager::TransmissionSucceeded(), and ns3::QosFrameExchangeManager::TransmissionSucceeded().
Time ns3::Txop::GetTxopLimit | ( | uint8_t | linkId | ) | const |
Return the TXOP limit for the given link.
linkId | the ID of the given link |
Definition at line 508 of file txop.cc.
References GetLink(), and ns3::Txop::LinkEntity::txopLimit.
std::vector< Time > ns3::Txop::GetTxopLimits | ( | ) | const |
Return the TXOP limit for each link.
Definition at line 496 of file txop.cc.
References openflow-switch::link, and m_links.
Referenced by GetTypeId().
|
static |
Get the type ID.
Definition at line 51 of file txop.cc.
References ns3::TypeId::ATTR_GET, ns3::TypeId::ATTR_SET, GetAifsn(), GetAifsns(), GetMaxCw(), GetMaxCws(), GetMinCw(), GetMinCws(), GetTxopLimit(), GetTxopLimits(), GetWifiMacQueue(), m_backoffTrace, m_cwTrace, ns3::MakePointerAccessor(), ns3::MakeTimeAccessor(), ns3::MakeTimeChecker(), ns3::MakeTraceSourceAccessor(), ns3::MakeUintegerAccessor(), ns3::MilliSeconds(), SetAifsn(), SetAifsns(), SetMaxCw(), SetMaxCws(), SetMinCw(), SetMinCws(), ns3::TypeId::SetParent(), SetTxopLimit(), and SetTxopLimits().
Ptr< WifiMacQueue > ns3::Txop::GetWifiMacQueue | ( | ) | const |
Return the packet queue associated with this Txop.
Definition at line 231 of file txop.cc.
References m_queue.
Referenced by AmpduAggregationTest::DoRun(), AmpduAggregationTest::EnqueuePkts(), ns3::ChannelAccessManager::GetBackoffEndFor(), ns3::ChannelAccessManager::GetBackoffStartFor(), ns3::WifiMac::GetTxopQueue(), ns3::ApWifiMac::GetTxopQueue(), GetTypeId(), ns3::WifiHelper::Install(), ns3::WifiDefaultAckManager::IsResponseNeeded(), ns3::HtFrameExchangeManager::NeedSetupBlockAck(), ns3::FrameExchangeManager::NotifyInternalCollision(), ns3::FrameExchangeManager::ReceivedNormalAck(), ns3::HtFrameExchangeManager::SendAddBaRequest(), ns3::FrameExchangeManager::StartTransmission(), and OfdmaAckSequenceTest::Transmit().
|
virtual |
Check if the Txop has frames to transmit over the given link.
linkId | the ID of the given link. |
Reimplemented in ns3::QosTxop.
Definition at line 514 of file txop.cc.
References m_queue, and NS_LOG_FUNCTION.
Referenced by ns3::WifiMac::HasFramesToTransmit(), ns3::ChannelAccessManager::NeedBackoffUponAccess(), NotifyChannelReleased(), Queue(), ns3::ChannelAccessManager::RequestAccess(), and StartAccessAfterEvent().
|
virtual |
Check for QoS TXOP.
Reimplemented in ns3::QosTxop.
Definition at line 687 of file txop.cc.
Referenced by ns3::ChannelAccessManager::DisableEdcaFor(), ns3::ChannelAccessManager::DoGrantDcfAccess(), ns3::ChannelAccessManager::NeedBackoffUponAccess(), ns3::FrameExchangeManager::NotifyInternalCollision(), ns3::ChannelAccessManager::RequestAccess(), and ns3::QosFrameExchangeManager::StartTransmission().
|
protectedvirtual |
Notify that access request has been received for the given link.
linkId | the ID of the given link |
Definition at line 610 of file txop.cc.
References ns3::Txop::LinkEntity::access, GetLink(), NS_LOG_FUNCTION, and REQUESTED.
Referenced by ns3::ChannelAccessManager::RequestAccess().
Called by the FrameExchangeManager to notify that channel access has been granted on the given link for the given amount of time.
linkId | the ID of the given link |
txopDuration | the duration of the TXOP gained (zero for DCF) |
Reimplemented in ns3::QosTxop.
Definition at line 617 of file txop.cc.
References ns3::Txop::LinkEntity::access, GetLink(), GRANTED, and NS_LOG_FUNCTION.
Referenced by ns3::QosTxop::NotifyChannelAccessed(), ns3::FrameExchangeManager::StartTransmission(), and FrameExchangeManagerStub< TxopType >::StartTransmission().
|
virtual |
Called by the FrameExchangeManager to notify the completion of the transmissions.
This method generates a new backoff and restarts access if needed.
linkId | the ID of the link the FrameExchangeManager is operating on |
Reimplemented in ns3::QosTxop.
Definition at line 624 of file txop.cc.
References ns3::Txop::LinkEntity::access, GenerateBackoff(), GetLink(), HasFramesToTransmit(), NOT_REQUESTED, NS_LOG_FUNCTION, RequestAccess(), and ns3::Simulator::ScheduleNow().
Referenced by ns3::FrameExchangeManager::NotifyChannelReleased().
|
virtual |
When off operation occurs, the queue gets cleaned up.
Definition at line 661 of file txop.cc.
References m_queue, and NS_LOG_FUNCTION.
|
virtual |
When on operation occurs, channel access will be started.
Definition at line 676 of file txop.cc.
References DIDNT_HAVE_FRAMES_TO_TRANSMIT, DONT_CHECK_MEDIUM_BUSY, openflow-switch::link, m_links, NS_LOG_FUNCTION, and StartAccessAfterEvent().
|
virtual |
Notify that the given link switched to sleep mode.
linkId | the ID of the given link |
Definition at line 655 of file txop.cc.
References NS_LOG_FUNCTION.
|
virtual |
When wake up operation occurs on a link, channel access on that link will be restarted.
linkId | the ID of the link |
Definition at line 668 of file txop.cc.
References DIDNT_HAVE_FRAMES_TO_TRANSMIT, DONT_CHECK_MEDIUM_BUSY, NS_LOG_FUNCTION, and StartAccessAfterEvent().
|
virtual |
packet | packet to send. |
hdr | header of packet to send. |
Store the packet in the internal queue until it can be sent safely.
Definition at line 523 of file txop.cc.
References NS_LOG_FUNCTION, and ns3::Packet::RemovePacketTag().
Referenced by ns3::AdhocWifiMac::Enqueue(), ns3::StaWifiMac::Enqueue(), ns3::MeshWifiInterfaceMac::ForwardDown(), ns3::ApWifiMac::ForwardDown(), ns3::HtFrameExchangeManager::SendAddBaResponse(), ns3::StaWifiMac::SendAssociationRequest(), ns3::ApWifiMac::SendAssocResp(), ns3::MeshWifiInterfaceMac::SendBeacon(), ns3::HtFrameExchangeManager::SendDelbaFrame(), ns3::EhtFrameExchangeManager::SendEmlOmn(), ns3::MeshWifiInterfaceMac::SendManagementFrame(), ns3::ApWifiMac::SendOneBeacon(), ns3::StaWifiMac::SendProbeRequest(), ns3::ApWifiMac::SendProbeResp(), and ns3::StaWifiMac::SetPowerSaveMode().
mpdu | the given MPDU |
Store the given MPDU in the internal queue until it can be sent safely.
Definition at line 533 of file txop.cc.
References CHECK_MEDIUM_BUSY, ns3::Txop::LinkEntity::event, GetLink(), ns3::WifiMac::GetMacQueueScheduler(), HasFramesToTransmit(), ns3::EventId::IsRunning(), m_mac, m_queue, NS_LOG_FUNCTION, ns3::Simulator::ScheduleNow(), and StartAccessAfterEvent().
|
protected |
Request access to the ChannelAccessManager associated with the given link.
linkId | the ID of the given link |
Definition at line 636 of file txop.cc.
References ns3::WifiMac::GetChannelAccessManager(), GetLink(), m_mac, NOT_REQUESTED, NS_LOG_FUNCTION, and ns3::ChannelAccessManager::RequestAccess().
Referenced by NotifyChannelReleased(), and ns3::QosTxop::NotifyChannelReleased().
void ns3::Txop::ResetCw | ( | uint8_t | linkId | ) |
Update the value of the CW variable for the given link to take into account a transmission success or a transmission abort (stop transmission of a packet after the maximum number of retransmissions has been reached).
By default, this resets the CW variable to minCW.
linkId | the ID of the given link |
Definition at line 303 of file txop.cc.
References GetLink(), GetMinCw(), openflow-switch::link, m_cwTrace, and NS_LOG_FUNCTION.
Referenced by ns3::HtFrameExchangeManager::BlockAckTimeout(), ns3::HeFrameExchangeManager::CtsAfterMuRtsTimeout(), ns3::FrameExchangeManager::DoCtsTimeout(), DoInitialize(), ns3::FrameExchangeManager::NormalAckTimeout(), ns3::FrameExchangeManager::NotifyInternalCollision(), ns3::FrameExchangeManager::ReceivedNormalAck(), ns3::HtFrameExchangeManager::ReceiveMpdu(), ns3::ChannelAccessManager::ResetBackoff(), SetMaxCw(), and SetMinCw().
void ns3::Txop::SetAifsn | ( | uint8_t | aifsn | ) |
Set the number of slots that make up an AIFS.
For 11be multi-link devices, set the number of slots that make up an AIFS on the first link.
aifsn | the number of slots that make up an AIFS. |
Definition at line 365 of file txop.cc.
Referenced by ns3::MeshWifiInterfaceMac::ConfigureContentionWindow(), GetTypeId(), SetAifsns(), and ns3::StaWifiMac::SetEdcaParameters().
void ns3::Txop::SetAifsn | ( | uint8_t | aifsn, |
uint8_t | linkId | ||
) |
Set the number of slots that make up an AIFS for the given link.
aifsn | the number of slots that make up an AIFS. |
linkId | the ID of the given link |
Definition at line 382 of file txop.cc.
References ns3::Txop::LinkEntity::aifsn, GetLink(), and NS_LOG_FUNCTION.
void ns3::Txop::SetAifsns | ( | std::vector< uint8_t > | aifsns | ) |
Set the number of slots that make up an AIFS for each link.
Note that the size of aifsns must match the number of links.
aifsns | the number of slots that make up an AIFS for each link. |
Definition at line 371 of file txop.cc.
References openflow-switch::link, m_links, NS_ABORT_IF, and SetAifsn().
Referenced by ns3::WifiMac::ConfigureDcf(), ns3::ApWifiMac::ConfigureStandard(), and GetTypeId().
|
virtual |
callback | the callback to invoke when an MPDU is dropped |
Reimplemented in ns3::QosTxop.
Definition at line 220 of file txop.cc.
References ns3::Callback< R, UArgs >::Bind(), m_droppedMpduCallback, m_queue, NS_LOG_FUNCTION, ns3::WIFI_MAC_DROP_EXPIRED_LIFETIME, and ns3::WIFI_MAC_DROP_FAILED_ENQUEUE.
Referenced by ns3::QosTxop::SetDroppedMpduCallback(), and ns3::WifiMac::SetQosSupported().
void ns3::Txop::SetMaxCw | ( | uint32_t | maxCw | ) |
Set the maximum contention window size.
For 11be multi-link devices, set the maximum contention window size on the first link.
maxCw | the maximum contention window size. |
Definition at line 267 of file txop.cc.
Referenced by ns3::MeshWifiInterfaceMac::ConfigureContentionWindow(), GetTypeId(), ns3::StaWifiMac::SetEdcaParameters(), and SetMaxCws().
void ns3::Txop::SetMaxCw | ( | uint32_t | maxCw, |
uint8_t | linkId | ||
) |
Set the maximum contention window size for the given link.
maxCw | the maximum contention window size. |
linkId | the ID of the given link |
Definition at line 284 of file txop.cc.
References GetLink(), openflow-switch::link, NS_LOG_FUNCTION, and ResetCw().
void ns3::Txop::SetMaxCws | ( | std::vector< uint32_t > | maxCws | ) |
Set the maximum contention window size for each link.
Note that the size of maxCws must match the number of links.
maxCws | the maximum contention window size values. |
Definition at line 273 of file txop.cc.
References openflow-switch::link, m_links, NS_ABORT_IF, and SetMaxCw().
Referenced by ns3::WifiMac::ConfigureDcf(), ns3::ApWifiMac::ConfigureStandard(), and GetTypeId().
void ns3::Txop::SetMinCw | ( | uint32_t | minCw | ) |
Set the minimum contention window size.
For 11be multi-link devices, set the minimum contention window size on the first link.
minCw | the minimum contention window size. |
Definition at line 237 of file txop.cc.
Referenced by ns3::MeshWifiInterfaceMac::ConfigureContentionWindow(), GetTypeId(), ns3::StaWifiMac::SetEdcaParameters(), and SetMinCws().
void ns3::Txop::SetMinCw | ( | uint32_t | minCw, |
uint8_t | linkId | ||
) |
Set the minimum contention window size for the given link.
minCw | the minimum contention window size. |
linkId | the ID of the given link |
Definition at line 254 of file txop.cc.
References GetLink(), openflow-switch::link, NS_LOG_FUNCTION, and ResetCw().
void ns3::Txop::SetMinCws | ( | std::vector< uint32_t > | minCws | ) |
Set the minimum contention window size for each link.
Note that the size of minCws must match the number of links.
minCws | the minimum contention window size values. |
Definition at line 243 of file txop.cc.
References openflow-switch::link, m_links, NS_ABORT_IF, and SetMinCw().
Referenced by ns3::WifiMac::ConfigureDcf(), ns3::ApWifiMac::ConfigureStandard(), and GetTypeId().
void ns3::Txop::SetTxMiddle | ( | const Ptr< MacTxMiddle > | txMiddle | ) |
Set MacTxMiddle this Txop is associated to.
txMiddle | MacTxMiddle to associate. |
Definition at line 202 of file txop.cc.
References m_txMiddle, and NS_LOG_FUNCTION.
Referenced by ns3::ApWifiMac::ApWifiMac(), ns3::MeshWifiInterfaceMac::ConfigureContentionWindow(), ns3::WifiMac::SetQosSupported(), and ns3::WifiMac::SetupEdcaQueue().
void ns3::Txop::SetTxopLimit | ( | Time | txopLimit | ) |
Set the TXOP limit.
txopLimit | the TXOP limit. Value zero corresponds to default Txop. |
Definition at line 389 of file txop.cc.
Referenced by GetTypeId(), Experiment::Run(), ns3::StaWifiMac::SetEdcaParameters(), and SetTxopLimits().
void ns3::Txop::SetTxopLimit | ( | Time | txopLimit, |
uint8_t | linkId | ||
) |
Set the TXOP limit for the given link.
txopLimit | the TXOP limit. Value zero corresponds to default Txop. |
linkId | the ID of the given link |
Definition at line 409 of file txop.cc.
References GetLink(), ns3::Time::GetMicroSeconds(), NS_ASSERT_MSG, NS_LOG_FUNCTION, and ns3::Txop::LinkEntity::txopLimit.
void ns3::Txop::SetTxopLimits | ( | const std::vector< Time > & | txopLimits | ) |
Set the TXOP limit for each link.
Note that the size of txopLimits must match the number of links.
txopLimits | the TXOP limit for each link. |
Definition at line 395 of file txop.cc.
References openflow-switch::link, m_links, NS_ABORT_MSG_IF, and SetTxopLimit().
Referenced by ns3::WifiMac::ConfigureDcf(), EmlsrDlTxopTest::DoSetup(), and GetTypeId().
Set the wifi MAC this Txop is associated to.
mac | associated wifi MAC |
Definition at line 209 of file txop.cc.
References CreateLinkEntity(), ns3::WifiMac::GetLinkIds(), m_links, m_mac, third::mac, and NS_LOG_FUNCTION.
Referenced by ns3::MeshWifiInterfaceMac::ConfigureContentionWindow(), ns3::WifiMac::ConfigureStandard(), and ns3::ApWifiMac::ConfigureStandard().
void ns3::Txop::StartAccessAfterEvent | ( | uint8_t | linkId, |
bool | hadFramesToTransmit, | ||
bool | checkMediumBusy | ||
) |
Request channel access on the given link after the occurrence of an event that possibly requires to generate a new backoff value.
Examples of such an event are: a packet has been enqueued by the upper layer; the given link has been unblocked after being blocked for some reason (e.g., wait for ADDBA Response, wait for TX on another EMLSR link to finish, etc.); the PHY operating on the given link just woke up from sleep mode. The checkMediumBusy argument is forwarded to the NeedBackoffUponAccess method of the ChannelAccessManager.
linkId | the ID of the given link |
hadFramesToTransmit | whether packets available for transmission were queued just before the occurrence of the event causing this channel access request |
checkMediumBusy | whether generation of backoff (also) depends on the busy/idle state of the medium |
Definition at line 572 of file txop.cc.
References GenerateBackoff(), ns3::WifiMac::GetChannelAccessManager(), GetLink(), HasFramesToTransmit(), m_mac, ns3::ChannelAccessManager::NeedBackoffUponAccess(), NOT_REQUESTED, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::ChannelAccessManager::RequestAccess().
Referenced by ns3::QosTxop::QosTxop(), NotifyOn(), NotifyWakeUp(), Queue(), ns3::EhtFrameExchangeManager::StartTransmission(), and ns3::WifiMac::UnblockUnicastTxOnLinks().
void ns3::Txop::StartBackoffNow | ( | uint32_t | nSlots, |
uint8_t | linkId | ||
) |
nSlots | the number of slots of the backoff. |
linkId | the ID of the given link |
Start a backoff for the given link by initializing the backoff counter to the number of slots specified.
Definition at line 347 of file txop.cc.
References GetLink(), openflow-switch::link, ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by GenerateBackoff().
void ns3::Txop::SwapLinks | ( | std::map< uint8_t, uint8_t > | links | ) |
Swap the links based on the information included in the given map.
This method is normally called by the WifiMac of a non-AP MLD upon completing ML setup to have its link IDs match AP MLD's link IDs.
links | a set of pairs (from, to) each mapping a current link ID to the link ID it has to become (i.e., link 'from' becomes link 'to') |
Definition at line 185 of file txop.cc.
References m_links, and NS_LOG_FUNCTION.
Referenced by ns3::WifiMac::SwapLinks().
|
protected |
Update backoff slots for the given link that nSlots has passed.
nSlots | the number of slots to decrement |
backoffUpdateBound | the time at which backoff should start |
linkId | the ID of the given link |
Definition at line 336 of file txop.cc.
References GetLink(), openflow-switch::link, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by ns3::ChannelAccessManager::DisableEdcaFor(), ns3::ChannelAccessManager::DoGrantDcfAccess(), ns3::ChannelAccessManager::NeedBackoffUponAccess(), ns3::ChannelAccessManager::RequestAccess(), and ns3::ChannelAccessManager::ResetBackoff().
void ns3::Txop::UpdateFailedCw | ( | uint8_t | linkId | ) |
Update the value of the CW variable for the given link to take into account a transmission failure.
By default, this triggers a doubling of CW (capped by maxCW).
linkId | the ID of the given link |
Definition at line 312 of file txop.cc.
References GetLink(), GetMaxCw(), GetMinCw(), openflow-switch::link, m_cwTrace, max, min, and NS_LOG_FUNCTION.
Referenced by ns3::HtFrameExchangeManager::BlockAckTimeout(), ns3::HeFrameExchangeManager::CtsAfterMuRtsTimeout(), ns3::FrameExchangeManager::DoCtsTimeout(), ns3::FrameExchangeManager::NormalAckTimeout(), and ns3::FrameExchangeManager::NotifyInternalCollision().
|
friend |
|
friend |
< ChannelAccessManager associated class
|
staticconstexpr |
generation of backoff (also) depends on the busy/idle state of the medium
Definition at line 419 of file txop.h.
Referenced by ns3::QosTxop::QosTxop(), Queue(), ns3::StaWifiMac::ReceiveAssocResp(), and ns3::WifiMac::UnblockUnicastTxOnLinks().
|
staticconstexpr |
no packet available for transmission was in the queue
Definition at line 417 of file txop.h.
Referenced by NotifyOn(), NotifyWakeUp(), ns3::StaWifiMac::ReceiveAssocResp(), and ns3::EhtFrameExchangeManager::StartTransmission().
|
staticconstexpr |
generation of backoff is independent of the busy/idle state of the medium
Definition at line 421 of file txop.h.
Referenced by NotifyOn(), NotifyWakeUp(), and ns3::EhtFrameExchangeManager::StartTransmission().
|
staticconstexpr |
|
protected |
backoff trace value
Definition at line 563 of file txop.h.
Referenced by GenerateBackoff(), and GetTypeId().
|
protected |
CW trace value.
Definition at line 564 of file txop.h.
Referenced by GetTypeId(), ResetCw(), and UpdateFailedCw().
|
protected |
the dropped MPDU callback
Definition at line 552 of file txop.h.
Referenced by ns3::QosTxop::PeekNextMpdu(), and SetDroppedMpduCallback().
|
private |
ID-indexed map of LinkEntity objects.
Definition at line 575 of file txop.h.
Referenced by DoDispose(), DoInitialize(), GetAifsns(), GetLink(), GetLinks(), GetMaxCws(), GetMinCws(), GetTxopLimits(), NotifyOn(), SetAifsns(), SetMaxCws(), SetMinCws(), SetTxopLimits(), SetWifiMac(), and SwapLinks().
the wifi MAC
Definition at line 555 of file txop.h.
Referenced by ns3::QosTxop::QosTxop(), ns3::QosTxop::CompleteMpduTx(), DoDispose(), ns3::QosTxop::GetNextMpdu(), ns3::QosTxop::IsQosOldPacket(), ns3::QosTxop::NotifyChannelReleased(), ns3::QosTxop::PeekNextMpdu(), ns3::QosTxop::PrepareBlockAckRequest(), Queue(), RequestAccess(), SetWifiMac(), StartAccessAfterEvent(), and ns3::QosTxop::StartMuEdcaTimerNow().
|
protected |
the wifi MAC queue
Definition at line 553 of file txop.h.
Referenced by ns3::QosTxop::QosTxop(), ns3::QosTxop::AssignSequenceNumber(), ns3::QosTxop::CompleteMpduTx(), DoDispose(), ns3::QosTxop::GetQosQueueSize(), GetWifiMacQueue(), ns3::QosTxop::GotAddBaResponse(), HasFramesToTransmit(), ns3::QosTxop::HasFramesToTransmit(), ns3::QosTxop::NotifyChannelReleased(), NotifyOff(), ns3::QosTxop::PeekNextMpdu(), Queue(), and SetDroppedMpduCallback().
|
protected |
the random stream
Definition at line 556 of file txop.h.
Referenced by Txop(), AssignStreams(), DoDispose(), and GenerateBackoff().
|
protected |
the MacTxMiddle
Definition at line 554 of file txop.h.
Referenced by ns3::QosTxop::AssignSequenceNumber(), DoDispose(), ns3::QosTxop::GetNextSequenceNumberFor(), ns3::QosTxop::GotAddBaResponse(), ns3::QosTxop::PeekNextMpdu(), ns3::QosTxop::PeekNextSequenceNumberFor(), and SetTxMiddle().