A Discrete-Event Network Simulator
API
ns3::Txop Class Reference

Handle packet fragmentation and retransmissions for data and management frames. More...

#include "txop.h"

+ Inheritance diagram for ns3::Txop:
+ Collaboration diagram for ns3::Txop:

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...
 
virtual ~Txop ()
 
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
 
virtual uint8_t GetAifsn (uint8_t linkId) const
 Return the number of slots that make up an AIFS for the given link. More...
 
uint8_t GetAifsn (void) const
 Return the number of slots that make up an AIFS. More...
 
std::vector< uint8_t > GetAifsns (void) const
 Return the number of slots that make up an AIFS for each link. More...
 
virtual uint32_t GetMaxCw (uint8_t linkId) const
 Return the maximum contention window size for the given link. More...
 
uint32_t GetMaxCw (void) const
 Return the maximum contention window size. More...
 
std::vector< uint32_tGetMaxCws (void) const
 Return the maximum contention window size for each link. More...
 
virtual uint32_t GetMinCw (uint8_t linkId) const
 Return the minimum contention window size for the given link. More...
 
uint32_t GetMinCw (void) const
 Return the minimum contention window size. More...
 
std::vector< uint32_tGetMinCws (void) const
 Return the minimum contention window size for each link. More...
 
Time GetTxopLimit (uint8_t linkId) const
 Return the TXOP limit for the given link. More...
 
Time GetTxopLimit (void) const
 Return the TXOP limit. More...
 
std::vector< TimeGetTxopLimits (void) const
 Return the TXOP limit for each link. More...
 
Ptr< WifiMacQueueGetWifiMacQueue () const
 Return the packet queue associated with this Txop. 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 (void)
 When off operation occurs, the queue gets cleaned up. More...
 
virtual void NotifyOn (void)
 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 StartBackoffNow (uint32_t nSlots, uint8_t linkId)
 
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...
 
virtual ~Object ()
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose (void)
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator (void) const
 Get an iterator to the Objects aggregated to this one. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Get the most derived TypeId for this Object. More...
 
template<>
Ptr< ObjectGetObject () 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< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object. More...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
void Initialize (void)
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized (void) 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)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) 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 erros. More...
 
virtual TypeId GetInstanceTypeId (void) const =0
 Get the most derived TypeId for this Object. 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 (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. 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 (void) override
 Destructor implementation. More...
 
void DoInitialize (void) 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...
 
LinkEntityGetLink (uint8_t linkId) const
 Get a reference to the link associated with the given ID. More...
 
uint8_t GetNLinks (void) const
 Get the number of links. More...
 
virtual bool HasFramesToTransmit (uint8_t linkId)
 Check if the Txop has frames to transmit over the given link. More...
 
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...
 
virtual void StartAccessIfNeeded (uint8_t linkId)
 Request access from Txop on the given link if needed. 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 DoDispose (void)
 Destructor implementation. More...
 
virtual void DoInitialize (void)
 Initialize() implementation. More...
 
virtual void NotifyNewAggregate (void)
 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 (void)
 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< WifiMacm_mac
 the wifi MAC More...
 
Ptr< WifiMacQueuem_queue
 the wifi MAC queue More...
 
Ptr< UniformRandomVariablem_rng
 the random stream More...
 
Ptr< MacTxMiddlem_txMiddle
 the MacTxMiddle More...
 

Private Member Functions

virtual std::unique_ptr< LinkEntityCreateLinkEntity (void) const
 Create a LinkEntity object. More...
 

Private Attributes

std::vector< std::unique_ptr< LinkEntity > > m_links
 vector of LinkEntity objects More...
 

Friends

class ChannelAccessManager
 < ChannelAccessManager associated class More...
 

Additional Inherited Members

Detailed Description

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.

Config Paths

ns3::Txop is accessible through the following paths with Config::Set and Config::Connect:

  • "/NodeList/[i]/DeviceList/[i]/$ns3::WifiNetDevice/Mac/Txop"

Attributes

TraceSources

Size of this type is 128 bytes (on a 64-bit architecture).

Definition at line 66 of file txop.h.

Member Typedef Documentation

◆ BackoffValueTracedCallback

TracedCallback for backoff trace value typedef.

Definition at line 516 of file txop.h.

◆ CwValueTracedCallback

TracedCallback for CW trace value typedef.

Definition at line 518 of file txop.h.

◆ DroppedMpdu

typedef for a callback to invoke when an MPDU is dropped.

Definition at line 89 of file txop.h.

Member Enumeration Documentation

◆ ChannelAccessStatus

Enumeration for channel access status.

Enumerator
NOT_REQUESTED 
REQUESTED 
GRANTED 

Definition at line 94 of file txop.h.

Constructor & Destructor Documentation

◆ Txop() [1/2]

ns3::Txop::Txop ( )

Definition at line 124 of file txop.cc.

◆ Txop() [2/2]

ns3::Txop::Txop ( Ptr< WifiMacQueue queue)

Constructor.

Parameters
queuethe wifi MAC queue

Definition at line 129 of file txop.cc.

References m_rng, and NS_LOG_FUNCTION.

◆ ~Txop()

ns3::Txop::~Txop ( )
virtual

Definition at line 136 of file txop.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ AssignStreams()

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.

Parameters
streamfirst stream index to use.
Returns
the number of stream indices assigned by this model.

Definition at line 517 of file txop.cc.

References m_rng, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().

Referenced by ns3::MeshHelper::AssignStreams(), ns3::WaveHelper::AssignStreams(), ns3::WifiHelper::AssignStreams(), and AssignWifiRandomStreams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateLinkEntity()

std::unique_ptr< Txop::LinkEntity > ns3::Txop::CreateLinkEntity ( void  ) const
privatevirtual

Create a LinkEntity object.

Returns
a unique pointer to the created LinkEntity object

Reimplemented in ns3::QosTxop.

Definition at line 153 of file txop.cc.

Referenced by SetWifiMac().

+ Here is the caller graph for this function:

◆ DoDispose()

void ns3::Txop::DoDispose ( void  )
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 142 of file txop.cc.

References m_links, m_mac, m_queue, m_rng, m_txMiddle, and NS_LOG_FUNCTION.

Referenced by ns3::QosTxop::DoDispose().

+ Here is the caller graph for this function:

◆ DoInitialize()

void ns3::Txop::DoInitialize ( void  )
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 535 of file txop.cc.

References GenerateBackoff(), m_links, NS_LOG_FUNCTION, and ResetCw().

+ Here is the call graph for this function:

◆ GenerateBackoff()

void ns3::Txop::GenerateBackoff ( uint8_t  linkId)
protectedvirtual

Generate a new backoff for the given link now.

Parameters
linkIdthe ID of the given link

Definition at line 588 of file txop.cc.

References GetCw(), ns3::UniformRandomVariable::GetInteger(), m_backoffTrace, m_rng, NS_LOG_FUNCTION, and StartBackoffNow().

Referenced by ns3::QosTxop::AddBaResponseTimeout(), DoInitialize(), NotifyChannelReleased(), and Queue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAccessStatus()

Txop::ChannelAccessStatus ns3::Txop::GetAccessStatus ( uint8_t  linkId) const
virtual
Parameters
linkIdthe ID of the given link
Returns
the current channel access status for the given link

Definition at line 546 of file txop.cc.

References ns3::Txop::LinkEntity::access, and GetLink().

Referenced by ns3::ChannelAccessManager::DoGrantDcfAccess(), ns3::ChannelAccessManager::NeedBackoffUponAccess(), and ns3::ChannelAccessManager::RequestAccess().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAifsn() [1/2]

uint8_t ns3::Txop::GetAifsn ( uint8_t  linkId) const
virtual

Return the number of slots that make up an AIFS for the given link.

Parameters
linkIdthe ID of the given link
Returns
the number of slots that make up an AIFS.

Reimplemented in ns3::QosTxop.

Definition at line 449 of file txop.cc.

References ns3::Txop::LinkEntity::aifsn, and GetLink().

+ Here is the call graph for this function:

◆ GetAifsn() [2/2]

uint8_t ns3::Txop::GetAifsn ( void  ) 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.

Returns
the number of slots that make up an AIFS.

Definition at line 432 of file txop.cc.

References GetAifsn().

Referenced by GetAifsn(), GetAifsns(), ns3::ChannelAccessManager::GetBackoffStartFor(), GetTypeId(), ns3::ChannelAccessManager::NeedBackoffUponAccess(), and ns3::ChannelAccessManager::RequestAccess().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAifsns()

std::vector< uint8_t > ns3::Txop::GetAifsns ( void  ) const

Return the number of slots that make up an AIFS for each link.

Returns
the number of slots that make up an AIFS for each link.

Definition at line 438 of file txop.cc.

References GetAifsn(), and m_links.

Referenced by GetTypeId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetBackoffSlots()

uint32_t ns3::Txop::GetBackoffSlots ( uint8_t  linkId) const
protected

Return the current number of backoff slots on the given link.

Parameters
linkIdthe ID of the given link
Returns
the current number of backoff slots

Definition at line 296 of file txop.cc.

References ns3::Txop::LinkEntity::backoffSlots, and GetLink().

Referenced by ns3::ChannelAccessManager::DisableEdcaFor(), ns3::ChannelAccessManager::DoGrantDcfAccess(), ns3::ChannelAccessManager::GetBackoffEndFor(), and ns3::ChannelAccessManager::NeedBackoffUponAccess().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetBackoffStart()

Time ns3::Txop::GetBackoffStart ( uint8_t  linkId) const
protected

Return the time when the backoff procedure started on the given link.

Parameters
linkIdthe ID of the given link
Returns
the time when the backoff procedure started

Definition at line 302 of file txop.cc.

References ns3::Txop::LinkEntity::backoffStart, and GetLink().

Referenced by ns3::ChannelAccessManager::GetBackoffStartFor(), and ns3::ChannelAccessManager::RequestAccess().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetCw()

uint32_t ns3::Txop::GetCw ( uint8_t  linkId) const
protected

Get the current value of the CW variable for the given link.

The initial value is minCw.

Parameters
linkIdthe ID of the given link
Returns
the current value of the CW variable for the given link

Definition at line 269 of file txop.cc.

References ns3::Txop::LinkEntity::cw, and GetLink().

Referenced by GenerateBackoff().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLink()

Txop::LinkEntity & ns3::Txop::GetLink ( uint8_t  linkId) const
protected

Get a reference to the link associated with the given ID.

Parameters
linkIdthe given link ID
Returns
a reference to the link associated with the given ID

Definition at line 159 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(), RequestAccess(), ResetCw(), SetAifsn(), SetMaxCw(), SetMinCw(), SetTxopLimit(), StartAccessIfNeeded(), StartBackoffNow(), UpdateBackoffSlotsNow(), and UpdateFailedCw().

+ Here is the caller graph for this function:

◆ GetMaxCw() [1/2]

uint32_t ns3::Txop::GetMaxCw ( uint8_t  linkId) const
virtual

Return the maximum contention window size for the given link.

Parameters
linkIdthe ID of the given link
Returns
the maximum contention window size.

Reimplemented in ns3::QosTxop.

Definition at line 426 of file txop.cc.

References ns3::Txop::LinkEntity::cwMax, and GetLink().

+ Here is the call graph for this function:

◆ GetMaxCw() [2/2]

uint32_t ns3::Txop::GetMaxCw ( void  ) const

Return the maximum contention window size.

For 11be multi-link devices, return the maximum contention window size on the first link.

Returns
the maximum contention window size.

Definition at line 409 of file txop.cc.

References GetMaxCw().

Referenced by GetMaxCw(), GetMaxCws(), GetTypeId(), and UpdateFailedCw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMaxCws()

std::vector< uint32_t > ns3::Txop::GetMaxCws ( void  ) const

Return the maximum contention window size for each link.

Returns
the maximum contention window size values.

Definition at line 415 of file txop.cc.

References GetMaxCw(), and m_links.

Referenced by GetTypeId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMinCw() [1/2]

uint32_t ns3::Txop::GetMinCw ( uint8_t  linkId) const
virtual

Return the minimum contention window size for the given link.

Parameters
linkIdthe ID of the given link
Returns
the minimum contention window size.

Reimplemented in ns3::QosTxop.

Definition at line 403 of file txop.cc.

References ns3::Txop::LinkEntity::cwMin, and GetLink().

+ Here is the call graph for this function:

◆ GetMinCw() [2/2]

uint32_t ns3::Txop::GetMinCw ( void  ) const

Return the minimum contention window size.

For 11be multi-link devices, return the minimum contention window size on the first link.

Returns
the minimum contention window size.

Definition at line 386 of file txop.cc.

References GetMinCw().

Referenced by GetMinCw(), GetMinCws(), GetTypeId(), ResetCw(), and UpdateFailedCw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMinCws()

std::vector< uint32_t > ns3::Txop::GetMinCws ( void  ) const

Return the minimum contention window size for each link.

Returns
the minimum contention window size values.

Definition at line 392 of file txop.cc.

References GetMinCw(), and m_links.

Referenced by GetTypeId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetNLinks()

uint8_t ns3::Txop::GetNLinks ( void  ) const
protected

Get the number of links.

Returns
the number of links

Definition at line 167 of file txop.cc.

References m_links.

◆ GetTxopLimit() [1/2]

Time ns3::Txop::GetTxopLimit ( uint8_t  linkId) const

Return the TXOP limit for the given link.

Parameters
linkIdthe ID of the given link
Returns
the TXOP limit.

Definition at line 472 of file txop.cc.

References GetLink(), and ns3::Txop::LinkEntity::txopLimit.

+ Here is the call graph for this function:

◆ GetTxopLimit() [2/2]

◆ GetTxopLimits()

std::vector< Time > ns3::Txop::GetTxopLimits ( void  ) const

Return the TXOP limit for each link.

Returns
the TXOP limit for each link.

Definition at line 461 of file txop.cc.

References GetTxopLimit(), and m_links.

Referenced by GetTypeId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetTypeId()

◆ GetWifiMacQueue()

◆ HasFramesToTransmit()

bool ns3::Txop::HasFramesToTransmit ( uint8_t  linkId)
protectedvirtual

Check if the Txop has frames to transmit over the given link.

Parameters
linkIdthe ID of the given link.
Returns
true if the Txop has frames to transmit.

Reimplemented in ns3::QosTxop.

Definition at line 478 of file txop.cc.

References m_queue, and NS_LOG_FUNCTION.

Referenced by ns3::ChannelAccessManager::NeedBackoffUponAccess(), NotifyChannelReleased(), and StartAccessIfNeeded().

+ Here is the caller graph for this function:

◆ IsQosTxop()

bool ns3::Txop::IsQosTxop ( void  ) const
virtual

◆ NotifyAccessRequested()

void ns3::Txop::NotifyAccessRequested ( uint8_t  linkId)
protectedvirtual

Notify that access request has been received for the given link.

Parameters
linkIdthe ID of the given link

Definition at line 552 of file txop.cc.

References ns3::Txop::LinkEntity::access, GetLink(), NS_LOG_FUNCTION, and REQUESTED.

Referenced by ns3::ChannelAccessManager::RequestAccess().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NotifyChannelAccessed()

void ns3::Txop::NotifyChannelAccessed ( uint8_t  linkId,
Time  txopDuration = Seconds (0) 
)
virtual

Called by the FrameExchangeManager to notify that channel access has been granted on the given link for the given amount of time.

Parameters
linkIdthe ID of the given link
txopDurationthe duration of the TXOP gained (zero for DCF)

Reimplemented in ns3::QosTxop.

Definition at line 559 of file txop.cc.

References ns3::Txop::LinkEntity::access, GetLink(), GRANTED, and NS_LOG_FUNCTION.

Referenced by ns3::QosTxop::NotifyChannelAccessed(), ns3::WaveFrameExchangeManager::StartTransmission(), ns3::FrameExchangeManager::StartTransmission(), and FrameExchangeManagerStub< TxopType >::StartTransmission().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NotifyChannelReleased()

void ns3::Txop::NotifyChannelReleased ( uint8_t  linkId)
virtual

Called by the FrameExchangeManager to notify the completion of the transmissions.

This method generates a new backoff and restarts access if needed.

Parameters
linkIdthe ID of the link the FrameExchangeManager is operating on

Reimplemented in ns3::QosTxop.

Definition at line 566 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::QosTxop::NotifyChannelReleased(), ns3::QosFrameExchangeManager::SendCfEndIfNeeded(), ns3::WaveFrameExchangeManager::StartTransmission(), ns3::FrameExchangeManager::StartTransmission(), ns3::FrameExchangeManager::TransmissionFailed(), and ns3::FrameExchangeManager::TransmissionSucceeded().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NotifyOff()

void ns3::Txop::NotifyOff ( void  )
virtual

When off operation occurs, the queue gets cleaned up.

Definition at line 603 of file txop.cc.

References m_queue, and NS_LOG_FUNCTION.

◆ NotifyOn()

void ns3::Txop::NotifyOn ( void  )
virtual

When on operation occurs, channel access will be started.

Definition at line 617 of file txop.cc.

References m_links, NS_LOG_FUNCTION, and StartAccessIfNeeded().

+ Here is the call graph for this function:

◆ NotifySleep()

void ns3::Txop::NotifySleep ( uint8_t  linkId)
virtual

Notify that the given link switched to sleep mode.

Parameters
linkIdthe ID of the given link

Definition at line 597 of file txop.cc.

References NS_LOG_FUNCTION.

◆ NotifyWakeUp()

void ns3::Txop::NotifyWakeUp ( uint8_t  linkId)
virtual

When wake up operation occurs on a link, channel access on that link will be restarted.

Parameters
linkIdthe ID of the link

Definition at line 610 of file txop.cc.

References NS_LOG_FUNCTION, and StartAccessIfNeeded().

+ Here is the call graph for this function:

◆ Queue() [1/2]

void ns3::Txop::Queue ( Ptr< Packet packet,
const WifiMacHeader hdr 
)
virtual

◆ Queue() [2/2]

void ns3::Txop::Queue ( Ptr< WifiMpdu mpdu)
virtual
Parameters
mpduthe given MPDU

Store the given MPDU in the internal queue until it can be sent safely.

Definition at line 497 of file txop.cc.

References GenerateBackoff(), ns3::WifiMacQueueContainer::GetQueueId(), m_mac, m_queue, NS_LOG_FUNCTION, and StartAccessIfNeeded().

+ Here is the call graph for this function:

◆ RequestAccess()

void ns3::Txop::RequestAccess ( uint8_t  linkId)
protected

Request access to the ChannelAccessManager associated with the given link.

Parameters
linkIdthe ID of the given link

Definition at line 578 of file txop.cc.

References GetLink(), m_mac, NOT_REQUESTED, and NS_LOG_FUNCTION.

Referenced by NotifyChannelReleased().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ResetCw()

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.

Parameters
linkIdthe ID of the given link

Definition at line 275 of file txop.cc.

References GetLink(), GetMinCw(), m_cwTrace, and NS_LOG_FUNCTION.

Referenced by ns3::HtFrameExchangeManager::BlockAckTimeout(), ns3::FrameExchangeManager::DoCtsTimeout(), DoInitialize(), ns3::FrameExchangeManager::NormalAckTimeout(), ns3::FrameExchangeManager::NotifyInternalCollision(), ns3::FrameExchangeManager::ReceivedNormalAck(), ns3::HtFrameExchangeManager::ReceiveMpdu(), SetMaxCw(), and SetMinCw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetAifsn() [1/2]

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.

Parameters
aifsnthe number of slots that make up an AIFS.

Definition at line 337 of file txop.cc.

References SetAifsn().

Referenced by ns3::MeshWifiInterfaceMac::ConfigureContentionWindow(), ns3::OcbWifiMac::ConfigureEdca(), GetTypeId(), SetAifsn(), SetAifsns(), and ns3::StaWifiMac::SetEdcaParameters().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetAifsn() [2/2]

void ns3::Txop::SetAifsn ( uint8_t  aifsn,
uint8_t  linkId 
)

Set the number of slots that make up an AIFS for the given link.

Parameters
aifsnthe number of slots that make up an AIFS.
linkIdthe ID of the given link

Definition at line 353 of file txop.cc.

References ns3::Txop::LinkEntity::aifsn, GetLink(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ SetAifsns()

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.

Parameters
aifsnsthe number of slots that make up an AIFS for each link.

Definition at line 343 of file txop.cc.

References m_links, NS_ABORT_IF, and SetAifsn().

Referenced by ns3::WifiMac::ConfigureDcf(), ns3::ApWifiMac::ConfigureStandard(), and GetTypeId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDroppedMpduCallback()

void ns3::Txop::SetDroppedMpduCallback ( DroppedMpdu  callback)
virtual
Parameters
callbackthe callback to invoke when an MPDU is dropped

Reimplemented in ns3::QosTxop.

Definition at line 193 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetMaxCw() [1/2]

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.

Parameters
maxCwthe maximum contention window size.

Definition at line 240 of file txop.cc.

References SetMaxCw().

Referenced by ns3::MeshWifiInterfaceMac::ConfigureContentionWindow(), ns3::OcbWifiMac::ConfigureEdca(), GetTypeId(), ns3::StaWifiMac::SetEdcaParameters(), SetMaxCw(), and SetMaxCws().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetMaxCw() [2/2]

void ns3::Txop::SetMaxCw ( uint32_t  maxCw,
uint8_t  linkId 
)

Set the maximum contention window size for the given link.

Parameters
maxCwthe maximum contention window size.
linkIdthe ID of the given link

Definition at line 256 of file txop.cc.

References GetLink(), NS_LOG_FUNCTION, and ResetCw().

+ Here is the call graph for this function:

◆ SetMaxCws()

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.

Parameters
maxCwsthe maximum contention window size values.

Definition at line 246 of file txop.cc.

References m_links, NS_ABORT_IF, and SetMaxCw().

Referenced by ns3::WifiMac::ConfigureDcf(), ns3::ApWifiMac::ConfigureStandard(), and GetTypeId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetMinCw() [1/2]

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.

Parameters
minCwthe minimum contention window size.

Definition at line 211 of file txop.cc.

References SetMinCw().

Referenced by ns3::MeshWifiInterfaceMac::ConfigureContentionWindow(), ns3::OcbWifiMac::ConfigureEdca(), GetTypeId(), ns3::StaWifiMac::SetEdcaParameters(), SetMinCw(), and SetMinCws().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetMinCw() [2/2]

void ns3::Txop::SetMinCw ( uint32_t  minCw,
uint8_t  linkId 
)

Set the minimum contention window size for the given link.

Parameters
minCwthe minimum contention window size.
linkIdthe ID of the given link

Definition at line 227 of file txop.cc.

References GetLink(), NS_LOG_FUNCTION, and ResetCw().

+ Here is the call graph for this function:

◆ SetMinCws()

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.

Parameters
minCwsthe minimum contention window size values.

Definition at line 217 of file txop.cc.

References m_links, NS_ABORT_IF, and SetMinCw().

Referenced by ns3::WifiMac::ConfigureDcf(), ns3::ApWifiMac::ConfigureStandard(), and GetTypeId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetTxMiddle()

void ns3::Txop::SetTxMiddle ( const Ptr< MacTxMiddle txMiddle)

Set MacTxMiddle this Txop is associated to.

Parameters
txMiddleMacTxMiddle to associate.

Definition at line 172 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().

+ Here is the caller graph for this function:

◆ SetTxopLimit() [1/2]

void ns3::Txop::SetTxopLimit ( Time  txopLimit)

Set the TXOP limit.

Parameters
txopLimitthe TXOP limit. Value zero corresponds to default Txop.

Definition at line 360 of file txop.cc.

References SetTxopLimit().

Referenced by GetTypeId(), Experiment::Run(), ns3::StaWifiMac::SetEdcaParameters(), SetTxopLimit(), and SetTxopLimits().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetTxopLimit() [2/2]

void ns3::Txop::SetTxopLimit ( Time  txopLimit,
uint8_t  linkId 
)

Set the TXOP limit for the given link.

Parameters
txopLimitthe TXOP limit. Value zero corresponds to default Txop.
linkIdthe ID of the given link

Definition at line 378 of file txop.cc.

References GetLink(), ns3::Time::GetMicroSeconds(), NS_ASSERT_MSG, NS_LOG_FUNCTION, and ns3::Txop::LinkEntity::txopLimit.

+ Here is the call graph for this function:

◆ SetTxopLimits()

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.

Parameters
txopLimitsthe TXOP limit for each link.

Definition at line 366 of file txop.cc.

References m_links, NS_ABORT_MSG_IF, and SetTxopLimit().

Referenced by ns3::WifiMac::ConfigureDcf(), and GetTypeId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetWifiMac()

void ns3::Txop::SetWifiMac ( const Ptr< WifiMac mac)
virtual

Set the wifi MAC this Txop is associated to.

Parameters
macassociated wifi MAC

Definition at line 179 of file txop.cc.

References CreateLinkEntity(), m_links, m_mac, third::mac, and NS_LOG_FUNCTION.

Referenced by ns3::MeshWifiInterfaceMac::ConfigureContentionWindow(), ns3::OcbWifiMac::ConfigureEdca(), ns3::WifiMac::ConfigureStandard(), and ns3::ApWifiMac::ConfigureStandard().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ StartAccessIfNeeded()

void ns3::Txop::StartAccessIfNeeded ( uint8_t  linkId)
protectedvirtual

Request access from Txop on the given link if needed.

Parameters
linkIdthe ID of the given link

Definition at line 525 of file txop.cc.

References GetLink(), HasFramesToTransmit(), m_mac, NOT_REQUESTED, and NS_LOG_FUNCTION.

Referenced by NotifyOn(), NotifyWakeUp(), and Queue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ StartBackoffNow()

void ns3::Txop::StartBackoffNow ( uint32_t  nSlots,
uint8_t  linkId 
)
Parameters
nSlotsthe number of slots of the backoff.
linkIdthe 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 319 of file txop.cc.

References GetLink(), ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by GenerateBackoff().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateBackoffSlotsNow()

void ns3::Txop::UpdateBackoffSlotsNow ( uint32_t  nSlots,
Time  backoffUpdateBound,
uint8_t  linkId 
)
protected

Update backoff slots for the given link that nSlots has passed.

Parameters
nSlotsthe number of slots to decrement
backoffUpdateBoundthe time at which backoff should start
linkIdthe ID of the given link

Definition at line 308 of file txop.cc.

References GetLink(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ns3::ChannelAccessManager::DisableEdcaFor(), ns3::ChannelAccessManager::NeedBackoffUponAccess(), and ns3::ChannelAccessManager::RequestAccess().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateFailedCw()

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).

Parameters
linkIdthe ID of the given link

Definition at line 284 of file txop.cc.

References GetLink(), GetMaxCw(), GetMinCw(), m_cwTrace, max, min, and NS_LOG_FUNCTION.

Referenced by ns3::HtFrameExchangeManager::BlockAckTimeout(), ns3::FrameExchangeManager::DoCtsTimeout(), ns3::FrameExchangeManager::NormalAckTimeout(), and ns3::FrameExchangeManager::NotifyInternalCollision().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ ChannelAccessManager

friend class ChannelAccessManager
friend

< ChannelAccessManager associated class

Definition at line 402 of file txop.h.

Member Data Documentation

◆ m_backoffTrace

BackoffValueTracedCallback ns3::Txop::m_backoffTrace
protected

backoff trace value

Definition at line 520 of file txop.h.

Referenced by GenerateBackoff(), and GetTypeId().

◆ m_cwTrace

CwValueTracedCallback ns3::Txop::m_cwTrace
protected

CW trace value.

Definition at line 521 of file txop.h.

Referenced by GetTypeId(), ResetCw(), and UpdateFailedCw().

◆ m_droppedMpduCallback

DroppedMpdu ns3::Txop::m_droppedMpduCallback
protected

the dropped MPDU callback

Definition at line 509 of file txop.h.

Referenced by ns3::QosTxop::PeekNextMpdu(), and SetDroppedMpduCallback().

◆ m_links

std::vector<std::unique_ptr<LinkEntity> > ns3::Txop::m_links
private

◆ m_mac

◆ m_queue

◆ m_rng

Ptr<UniformRandomVariable> ns3::Txop::m_rng
protected

the random stream

Definition at line 513 of file txop.h.

Referenced by Txop(), AssignStreams(), DoDispose(), and GenerateBackoff().

◆ m_txMiddle


The documentation for this class was generated from the following files: