A Discrete-Event Network Simulator
API
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
ns3::Txop Class Reference

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

#include "txop.h"

+ Inheritance diagram for ns3::Txop:

Public Types

typedef Callback< void, Ptr< const Packet > > TxDropped
 typedef for a callback to invoke when a packet is dropped. More...
 
typedef Callback< void, const WifiMacHeader & > TxFailed
 typedef for a callback to invoke when a packet transmission was failed. More...
 
typedef Callback< void, const WifiMacHeader & > TxOk
 typedef for a callback to invoke when a packet transmission was completed successfully. More...
 

Public Member Functions

 Txop ()
 
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 void Cancel (void)
 Cancel the transmission. More...
 
bool CanStartNextPolling (void) const
 Check if the next PCF transmission can fit in the remaining CFP duration. More...
 
virtual void EndTxNoAck (void)
 Event handler when a transmission that does not require an ACK has completed. More...
 
uint8_t GetAifsn (void) const
 Return the number of slots that make up an AIFS. More...
 
Ptr< MacLowGetLow (void) const
 Return the MacLow associated with this Txop. More...
 
uint32_t GetMaxCw (void) const
 Return the maximum contention window size. More...
 
uint32_t GetMinCw (void) const
 Return the minimum contention window size. More...
 
Time GetTxopLimit (void) const
 Return the TXOP limit. More...
 
Ptr< WifiMacQueueGetWifiMacQueue () const
 Return the packet queue associated with this Txop. More...
 
virtual void GotAck (void)
 Event handler when an ACK is received. More...
 
virtual void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient, double rxSnr, WifiMode txMode, double dataSnr)
 Event handler when a Block ACK is received. More...
 
void GotCfEnd (void)
 Event handler when a CF-END frame is received. More...
 
virtual bool HasTxop (void) const
 Check if the station has TXOP granted for the next MPDU. More...
 
virtual bool IsAccessRequested (void) const
 
virtual bool IsQosTxop () const
 Check for QoS TXOP. More...
 
virtual void MissedAck (void)
 Event handler when an ACK is missed. More...
 
virtual void MissedBlockAck (uint8_t nMpdus)
 Event handler when a Block ACK timeout has occurred. More...
 
void MissedCfPollResponse (bool expectedCfAck)
 Event handler when a response to a CF-POLL frame is missed. More...
 
virtual void MissedCts (void)
 Event handler when a CTS timeout has occurred. More...
 
virtual void NotifyChannelSwitching (void)
 When a channel switching occurs, enqueued packets are removed. 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 (void)
 When sleep operation occurs, if there is a pending packet transmission, it will be reinserted to the front of the queue. More...
 
virtual void NotifyWakeUp (void)
 When wake up operation occurs, channel access will be restarted. More...
 
virtual void Queue (Ptr< const Packet > packet, const WifiMacHeader &hdr)
 
void SendCfFrame (WifiMacType frameType, Mac48Address addr)
 Sends CF frame to sta with address addr. More...
 
void SetAifsn (uint8_t aifsn)
 Set the number of slots that make up an AIFS. More...
 
void SetChannelAccessManager (const Ptr< ChannelAccessManager > manager)
 Set ChannelAccessManager this Txop is associated to. More...
 
void SetMacLow (const Ptr< MacLow > low)
 Set MacLow associated with this Txop. More...
 
void SetMaxCw (uint32_t maxCw)
 Set the maximum contention window size. More...
 
void SetMinCw (uint32_t minCw)
 Set the minimum contention window size. More...
 
void SetTxDroppedCallback (TxDropped callback)
 
void SetTxFailedCallback (TxFailed callback)
 
void SetTxMiddle (const Ptr< MacTxMiddle > txMiddle)
 Set MacTxMiddle this Txop is associated to. More...
 
void SetTxOkCallback (TxOk callback)
 
void SetTxopLimit (Time txopLimit)
 Set the TXOP limit. More...
 
virtual void SetWifiRemoteStationManager (const Ptr< WifiRemoteStationManager > remoteManager)
 Set WifiRemoteStationsManager this Txop is associated to. More...
 
void StartBackoffNow (uint32_t nSlots)
 
virtual void StartNextFragment (void)
 Start transmission for the next fragment. More...
 
virtual void StartNextPacket (void)
 Start transmission for the next packet if allowed by the TxopLimit. 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<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. 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...
 
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 Member Functions

virtual void DoDispose (void)
 Destructor implementation. More...
 
virtual void DoInitialize (void)
 Initialize() implementation. More...
 
uint32_t GetBackoffSlots (void) const
 Return the current number of backoff slots. More...
 
Time GetBackoffStart (void) const
 Return the time when the backoff procedure started. More...
 
uint32_t GetCw (void) const
 
virtual uint32_t GetFragmentOffset (void) const
 Calculate the offset for the current fragment. More...
 
virtual Ptr< PacketGetFragmentPacket (WifiMacHeader *hdr)
 Get the next fragment from the packet with appropriate Wifi header for the fragment. More...
 
virtual uint32_t GetFragmentSize (void) const
 Calculate the size of the current fragment. More...
 
virtual uint32_t GetNextFragmentSize (void) const
 Calculate the size of the next fragment. More...
 
virtual bool IsLastFragment (void) const
 Check if the current fragment is the last fragment. More...
 
bool NeedDataRetransmission (Ptr< const Packet > packet, const WifiMacHeader &hdr)
 Check if DATA should be re-transmitted if ACK was missed. More...
 
virtual bool NeedFragmentation (void) const
 Check if the current packet should be fragmented. More...
 
bool NeedRtsRetransmission (Ptr< const Packet > packet, const WifiMacHeader &hdr)
 Check if RTS should be re-transmitted if CTS was missed. More...
 
void NextFragment (void)
 Continue to the next fragment. More...
 
virtual void NotifyAccessGranted (void)
 Notify the DCF that access has been granted. More...
 
virtual void NotifyAccessRequested (void)
 Notify that access request has been received. More...
 
virtual void NotifyCollision (void)
 Notify the DCF that collision has occurred. More...
 
virtual void NotifyInternalCollision (void)
 Notify the DCF that internal collision has occurred. More...
 
void ResetCw (void)
 Update the value of the CW variable 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...
 
virtual void RestartAccessIfNeeded (void)
 Restart access request if needed. More...
 
virtual void StartAccessIfNeeded (void)
 Request access from DCF manager if needed. More...
 
void TxDroppedPacket (Ptr< const WifiMacQueueItem > item)
 Pass the packet included in the wifi MAC queue item to the packet dropped callback. More...
 
void UpdateBackoffSlotsNow (uint32_t nSlots, Time backoffUpdateBound)
 Update backoff slots that nSlots has passed. More...
 
void UpdateFailedCw (void)
 Update the value of the CW variable to take into account a transmission failure. More...
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. 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

bool m_accessRequested
 flag whether channel access is already requested More...
 
uint8_t m_aifsn
 the AIFSN More...
 
uint32_t m_backoffSlots
 the backoff slots More...
 
Time m_backoffStart
 the backoffStart variable is used to keep track of the time at which a backoff was started or the time at which the backoff counter was last updated. More...
 
Ptr< ChannelAccessManagerm_channelAccessManager
 the channel access manager More...
 
WifiMacHeader m_currentHdr
 the current header More...
 
Ptr< const Packetm_currentPacket
 the current packet More...
 
MacLowTransmissionParameters m_currentParams
 current transmission parameters More...
 
uint32_t m_cw
 the current CW More...
 
uint32_t m_cwMax
 the CW maximum More...
 
uint32_t m_cwMin
 the CW minimum More...
 
uint8_t m_fragmentNumber
 the fragment number More...
 
Ptr< MacLowm_low
 the MacLow More...
 
Ptr< WifiMacQueuem_queue
 the wifi MAC queue More...
 
Ptr< UniformRandomVariablem_rng
 the random stream More...
 
Ptr< WifiRemoteStationManagerm_stationManager
 the wifi remote station manager More...
 
TxDropped m_txDroppedCallback
 the packet dropped callback More...
 
TxFailed m_txFailedCallback
 the transmit failed callback More...
 
Ptr< MacTxMiddlem_txMiddle
 the MacTxMiddle More...
 
TxOk m_txOkCallback
 the transmit OK callback More...
 
Time m_txopLimit
 the txop limit time More...
 

Friends

class ChannelAccessManager
 < ChannelAccessManager associated class More...
 
class DcfListener
 allow DcfListener class access More...
 
class MacLowTransmissionListener
 allow MacLowTransmissionListener class access 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::MacLow and ns3::ChannelAccessManager helper classes to respectively send packets and decide when to send them. 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:

Attributes

No TraceSources are defined for this type.
Size of this type is 232 bytes (on a 64-bit architecture).

Definition at line 64 of file txop.h.

Member Typedef Documentation

◆ TxDropped

typedef Callback<void, Ptr<const Packet> > ns3::Txop::TxDropped

typedef for a callback to invoke when a packet is dropped.

Definition at line 95 of file txop.h.

◆ TxFailed

typedef for a callback to invoke when a packet transmission was failed.

Definition at line 90 of file txop.h.

◆ TxOk

typedef Callback<void, const WifiMacHeader&> ns3::Txop::TxOk

typedef for a callback to invoke when a packet transmission was completed successfully.

Definition at line 85 of file txop.h.

Constructor & Destructor Documentation

◆ Txop()

ns3::Txop::Txop ( )

Definition at line 76 of file txop.cc.

References m_queue, m_rng, and NS_LOG_FUNCTION.

◆ ~Txop()

ns3::Txop::~Txop ( )
virtual

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

◆ Cancel()

void ns3::Txop::Cancel ( void  )
virtual

Cancel the transmission.

Definition at line 710 of file txop.cc.

References NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ns3::MacLow::CancelAllEvents().

◆ CanStartNextPolling()

bool ns3::Txop::CanStartNextPolling ( void  ) const

Check if the next PCF transmission can fit in the remaining CFP duration.

Returns
true if the next PCF transmission can fit in the remaining CFP duration, false otherwise

Definition at line 804 of file txop.cc.

References ns3::MacLow::CanTransmitNextCfFrame(), GetLow(), ns3::ChannelAccessManager::IsBusy(), and m_channelAccessManager.

Referenced by ns3::ApWifiMac::SendNextCfFrame().

◆ DoDispose()

void ns3::Txop::DoDispose ( void  )
protectedvirtual

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.

Reimplemented in ns3::QosTxop, and TxopTest.

Definition at line 97 of file txop.cc.

References m_channelAccessManager, m_low, m_queue, m_rng, m_stationManager, m_txMiddle, and NS_LOG_FUNCTION.

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

◆ DoInitialize()

void ns3::Txop::DoInitialize ( void  )
protectedvirtual

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.

Reimplemented in ns3::QosTxop.

Definition at line 345 of file txop.cc.

References GetCw(), ns3::RandomVariableStream::GetInteger(), m_rng, NS_LOG_FUNCTION, ResetCw(), and StartBackoffNow().

◆ EndTxNoAck()

void ns3::Txop::EndTxNoAck ( void  )
virtual

◆ GetAifsn()

uint8_t ns3::Txop::GetAifsn ( void  ) const

Return the number of slots that make up an AIFS.

Returns
the number of slots that make up an AIFS.

Definition at line 284 of file txop.cc.

References m_aifsn.

Referenced by ns3::ChannelAccessManager::GetBackoffStartFor(), ns3::ApWifiMac::GetEdcaParameterSet(), GetTypeId(), and ns3::ChannelAccessManager::IsWithinAifs().

◆ GetBackoffSlots()

uint32_t ns3::Txop::GetBackoffSlots ( void  ) const
protected

◆ GetBackoffStart()

Time ns3::Txop::GetBackoffStart ( void  ) const
protected

Return the time when the backoff procedure started.

Returns
the time when the backoff procedure started

Definition at line 226 of file txop.cc.

References m_backoffStart.

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

◆ GetCw()

uint32_t ns3::Txop::GetCw ( void  ) const
protected

◆ GetFragmentOffset()

uint32_t ns3::Txop::GetFragmentOffset ( void  ) const
protectedvirtual

Calculate the offset for the current fragment.

Returns
the offset for the current fragment.

Reimplemented in ns3::QosTxop.

Definition at line 406 of file txop.cc.

References ns3::WifiMacHeader::GetAddr1(), ns3::WifiRemoteStationManager::GetFragmentOffset(), m_currentHdr, m_currentPacket, m_fragmentNumber, m_stationManager, and NS_LOG_FUNCTION.

Referenced by GetFragmentPacket().

◆ GetFragmentPacket()

Ptr< Packet > ns3::Txop::GetFragmentPacket ( WifiMacHeader hdr)
protectedvirtual

Get the next fragment from the packet with appropriate Wifi header for the fragment.

Parameters
hdrWi-Fi header.
Returns
the fragment with the current fragment number.

Reimplemented in ns3::QosTxop.

Definition at line 414 of file txop.cc.

References ns3::Packet::CreateFragment(), GetFragmentOffset(), GetFragmentSize(), IsLastFragment(), m_currentHdr, m_currentPacket, m_fragmentNumber, NS_LOG_FUNCTION, ns3::WifiMacHeader::SetFragmentNumber(), ns3::WifiMacHeader::SetMoreFragments(), and ns3::WifiMacHeader::SetNoMoreFragments().

Referenced by NotifyAccessGranted(), and StartNextFragment().

◆ GetFragmentSize()

uint32_t ns3::Txop::GetFragmentSize ( void  ) const
protectedvirtual

Calculate the size of the current fragment.

Returns
the size of the current fragment.

Reimplemented in ns3::QosTxop.

Definition at line 382 of file txop.cc.

References ns3::WifiMacHeader::GetAddr1(), ns3::WifiRemoteStationManager::GetFragmentSize(), m_currentHdr, m_currentPacket, m_fragmentNumber, m_stationManager, and NS_LOG_FUNCTION.

Referenced by GetFragmentPacket().

◆ GetLow()

Ptr< MacLow > ns3::Txop::GetLow ( void  ) const

◆ GetMaxCw()

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

Return the maximum contention window size.

Returns
the maximum contention window size.

Definition at line 278 of file txop.cc.

References m_cwMax.

Referenced by ns3::ApWifiMac::GetEdcaParameterSet(), and GetTypeId().

◆ GetMinCw()

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

Return the minimum contention window size.

Returns
the minimum contention window size.

Definition at line 272 of file txop.cc.

References m_cwMin.

Referenced by ns3::ApWifiMac::GetEdcaParameterSet(), and GetTypeId().

◆ GetNextFragmentSize()

uint32_t ns3::Txop::GetNextFragmentSize ( void  ) const
protectedvirtual

Calculate the size of the next fragment.

Returns
the size of the next fragment.

Reimplemented in ns3::QosTxop.

Definition at line 398 of file txop.cc.

References ns3::WifiMacHeader::GetAddr1(), ns3::WifiRemoteStationManager::GetFragmentSize(), m_currentHdr, m_currentPacket, m_fragmentNumber, m_stationManager, and NS_LOG_FUNCTION.

Referenced by NotifyAccessGranted(), and StartNextFragment().

◆ GetTxopLimit()

Time ns3::Txop::GetTxopLimit ( void  ) const

◆ GetTypeId()

TypeId ns3::Txop::GetTypeId ( void  )
static

◆ GetWifiMacQueue()

Ptr< WifiMacQueue > ns3::Txop::GetWifiMacQueue ( ) const

Return the packet queue associated with this Txop.

Returns
WifiMacQueue

Definition at line 168 of file txop.cc.

References m_queue, and NS_LOG_FUNCTION.

Referenced by AmpduAggregationTest::DoRun(), TwoLevelAggregationTest::DoRun(), and GetTypeId().

◆ GotAck()

void ns3::Txop::GotAck ( void  )
virtual

◆ GotBlockAck()

void ns3::Txop::GotBlockAck ( const CtrlBAckResponseHeader blockAck,
Mac48Address  recipient,
double  rxSnr,
WifiMode  txMode,
double  dataSnr 
)
virtual

Event handler when a Block ACK is received.

Parameters
blockAckblock ack.
recipientaddress of the recipient.
rxSnrSNR of the block ack itself.
txModewifi mode.
dataSnrreported data SNR from the peer.

Reimplemented in ns3::QosTxop.

Definition at line 822 of file txop.cc.

References NS_LOG_WARN.

Referenced by ns3::MacLow::ReceiveOk().

◆ GotCfEnd()

void ns3::Txop::GotCfEnd ( void  )

Event handler when a CF-END frame is received.

Definition at line 648 of file txop.cc.

References m_currentPacket, NS_LOG_FUNCTION, RestartAccessIfNeeded(), and StartAccessIfNeeded().

Referenced by ns3::MacLow::ReceiveOk().

◆ HasTxop()

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

Check if the station has TXOP granted for the next MPDU.

Returns
true if the station has TXOP granted for the next MPDU, false otherwise

Reimplemented in ns3::QosTxop.

Definition at line 834 of file txop.cc.

Referenced by ns3::MacLow::ReceiveOk(), and ns3::MacLow::StartDataTxTimers().

◆ IsAccessRequested()

bool ns3::Txop::IsAccessRequested ( void  ) const
virtual
Returns
true if access has been requested for this function and has not been granted already, false otherwise.

Reimplemented in TxopTest.

Definition at line 435 of file txop.cc.

References m_accessRequested.

Referenced by ns3::ChannelAccessManager::DoGrantAccess(), ns3::ChannelAccessManager::DoRestartAccessTimeoutIfNeeded(), ns3::ChannelAccessManager::RequestAccess(), ns3::QosTxop::RestartAccessIfNeeded(), RestartAccessIfNeeded(), ns3::QosTxop::StartAccessIfNeeded(), and StartAccessIfNeeded().

◆ IsLastFragment()

bool ns3::Txop::IsLastFragment ( void  ) const
protectedvirtual

Check if the current fragment is the last fragment.

Returns
true if the current fragment is the last fragment, false otherwise.

Reimplemented in ns3::QosTxop.

Definition at line 390 of file txop.cc.

References ns3::WifiMacHeader::GetAddr1(), ns3::WifiRemoteStationManager::IsLastFragment(), m_currentHdr, m_currentPacket, m_fragmentNumber, m_stationManager, and NS_LOG_FUNCTION.

Referenced by GetFragmentPacket(), GotAck(), NotifyAccessGranted(), and StartNextFragment().

◆ IsQosTxop()

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

Check for QoS TXOP.

Returns
true if QoS TXOP.

Reimplemented in ns3::QosTxop.

Definition at line 810 of file txop.cc.

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

◆ MissedAck()

void ns3::Txop::MissedAck ( void  )
virtual

◆ MissedBlockAck()

void ns3::Txop::MissedBlockAck ( uint8_t  nMpdus)
virtual

Event handler when a Block ACK timeout has occurred.

Parameters
nMpdusthe number of MPDUs sent in the A-MPDU transmission that results in a Block ACK timeout.

Reimplemented in ns3::QosTxop.

Definition at line 828 of file txop.cc.

References NS_LOG_WARN.

Referenced by ns3::MacLow::BlockAckTimeout().

◆ MissedCfPollResponse()

void ns3::Txop::MissedCfPollResponse ( bool  expectedCfAck)

◆ MissedCts()

void ns3::Txop::MissedCts ( void  )
virtual

◆ NeedDataRetransmission()

bool ns3::Txop::NeedDataRetransmission ( Ptr< const Packet packet,
const WifiMacHeader hdr 
)
protected

Check if DATA should be re-transmitted if ACK was missed.

Parameters
packetcurrent packet being transmitted.
hdrcurrent header being transmitted.
Returns
true if DATA should be re-transmitted, false otherwise.

Definition at line 360 of file txop.cc.

References ns3::WifiMacHeader::GetAddr1(), m_stationManager, ns3::WifiRemoteStationManager::NeedRetransmission(), and NS_LOG_FUNCTION.

Referenced by ns3::QosTxop::MissedAck(), MissedAck(), MissedCfPollResponse(), ns3::QosTxop::NotifyInternalCollision(), and SendCfFrame().

◆ NeedFragmentation()

bool ns3::Txop::NeedFragmentation ( void  ) const
protectedvirtual

Check if the current packet should be fragmented.

Returns
true if the current packet should be fragmented, false otherwise

Reimplemented in ns3::QosTxop.

Definition at line 367 of file txop.cc.

References ns3::WifiMacHeader::GetAddr1(), m_currentHdr, m_currentPacket, m_stationManager, ns3::WifiRemoteStationManager::NeedFragmentation(), and NS_LOG_FUNCTION.

Referenced by GotAck(), and NotifyAccessGranted().

◆ NeedRtsRetransmission()

bool ns3::Txop::NeedRtsRetransmission ( Ptr< const Packet packet,
const WifiMacHeader hdr 
)
protected

Check if RTS should be re-transmitted if CTS was missed.

Parameters
packetcurrent packet being transmitted.
hdrcurrent header being transmitted.
Returns
true if RTS should be re-transmitted, false otherwise.

Definition at line 353 of file txop.cc.

References ns3::WifiMacHeader::GetAddr1(), m_stationManager, ns3::WifiRemoteStationManager::NeedRetransmission(), and NS_LOG_FUNCTION.

Referenced by ns3::QosTxop::MissedCts(), MissedCts(), and ns3::QosTxop::NotifyInternalCollision().

◆ NextFragment()

void ns3::Txop::NextFragment ( void  )
protected

Continue to the next fragment.

This method simply increments the internal variable that keep track of the current fragment number.

Definition at line 375 of file txop.cc.

References m_fragmentNumber, and NS_LOG_FUNCTION.

Referenced by StartNextFragment().

◆ NotifyAccessGranted()

void ns3::Txop::NotifyAccessGranted ( void  )
protectedvirtual

◆ NotifyAccessRequested()

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

Notify that access request has been received.

Reimplemented in TxopTest.

Definition at line 441 of file txop.cc.

References m_accessRequested, and NS_LOG_FUNCTION.

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

◆ NotifyChannelSwitching()

void ns3::Txop::NotifyChannelSwitching ( void  )
virtual

When a channel switching occurs, enqueued packets are removed.

Reimplemented in TxopTest.

Definition at line 527 of file txop.cc.

References m_currentPacket, m_queue, and NS_LOG_FUNCTION.

Referenced by ns3::OcbWifiMac::CancleTx(), and ns3::ChannelAccessManager::NotifySwitchingStartNow().

◆ NotifyCollision()

void ns3::Txop::NotifyCollision ( void  )
protectedvirtual

Notify the DCF that collision has occurred.

Reimplemented in ns3::QosTxop, and TxopTest.

Definition at line 519 of file txop.cc.

References GetCw(), ns3::RandomVariableStream::GetInteger(), m_rng, NS_LOG_FUNCTION, RestartAccessIfNeeded(), and StartBackoffNow().

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

◆ NotifyInternalCollision()

void ns3::Txop::NotifyInternalCollision ( void  )
protectedvirtual

Notify the DCF that internal collision has occurred.

Reimplemented in ns3::QosTxop, and TxopTest.

Definition at line 512 of file txop.cc.

References NotifyCollision(), and NS_LOG_FUNCTION.

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

◆ NotifyOff()

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

When off operation occurs, the queue gets cleaned up.

Definition at line 546 of file txop.cc.

References m_currentPacket, m_queue, and NS_LOG_FUNCTION.

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

◆ NotifyOn()

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

When on operation occurs, channel access will be started.

Definition at line 561 of file txop.cc.

References NS_LOG_FUNCTION, and StartAccessIfNeeded().

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

◆ NotifySleep()

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

When sleep operation occurs, if there is a pending packet transmission, it will be reinserted to the front of the queue.

Reimplemented in TxopTest.

Definition at line 535 of file txop.cc.

References m_currentHdr, m_currentPacket, m_queue, and NS_LOG_FUNCTION.

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

◆ NotifyWakeUp()

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

When wake up operation occurs, channel access will be restarted.

Reimplemented in TxopTest.

Definition at line 554 of file txop.cc.

References NS_LOG_FUNCTION, and RestartAccessIfNeeded().

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

◆ Queue()

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

◆ ResetCw()

void ns3::Txop::ResetCw ( void  )
protected

Update the value of the CW variable 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.

Definition at line 205 of file txop.cc.

References m_cw, m_cwMin, and NS_LOG_FUNCTION.

Referenced by DoInitialize(), ns3::QosTxop::DoInitialize(), ns3::QosTxop::EndTxNoAck(), EndTxNoAck(), ns3::QosTxop::GotAck(), GotAck(), ns3::QosTxop::GotBlockAck(), ns3::QosTxop::MissedAck(), MissedAck(), ns3::QosTxop::MissedBlockAck(), ns3::QosTxop::MissedCts(), MissedCts(), ns3::QosTxop::NotifyInternalCollision(), ns3::ChannelAccessManager::NotifyOnNow(), ns3::ChannelAccessManager::NotifySwitchingStartNow(), ns3::ChannelAccessManager::NotifyWakeupNow(), SetMaxCw(), and SetMinCw().

◆ RestartAccessIfNeeded()

void ns3::Txop::RestartAccessIfNeeded ( void  )
protectedvirtual

◆ SendCfFrame()

void ns3::Txop::SendCfFrame ( WifiMacType  frameType,
Mac48Address  addr 
)

◆ SetAifsn()

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

Set the number of slots that make up an AIFS.

Parameters
aifsnthe number of slots that make up an AIFS.

Definition at line 257 of file txop.cc.

References m_aifsn, and NS_LOG_FUNCTION.

Referenced by ChannelAccessManagerTest::AddDcfState(), ns3::ApWifiMac::ApWifiMac(), ns3::WifiMac::ConfigureDcf(), ns3::OcbWifiMac::ConfigureEdca(), ns3::MeshWifiInterfaceMac::FinishConfigureStandard(), GetTypeId(), and ns3::StaWifiMac::SetEdcaParameters().

◆ SetChannelAccessManager()

void ns3::Txop::SetChannelAccessManager ( const Ptr< ChannelAccessManager manager)

◆ SetMacLow()

void ns3::Txop::SetMacLow ( const Ptr< MacLow low)

◆ SetMaxCw()

void ns3::Txop::SetMaxCw ( uint32_t  maxCw)

Set the maximum contention window size.

Parameters
maxCwthe maximum contention window size.

Definition at line 187 of file txop.cc.

References m_cwMax, NS_LOG_FUNCTION, and ResetCw().

Referenced by ns3::ApWifiMac::ApWifiMac(), ns3::WifiMac::ConfigureDcf(), ns3::OcbWifiMac::ConfigureEdca(), ns3::MeshWifiInterfaceMac::FinishConfigureStandard(), GetTypeId(), and ns3::StaWifiMac::SetEdcaParameters().

◆ SetMinCw()

void ns3::Txop::SetMinCw ( uint32_t  minCw)

Set the minimum contention window size.

Parameters
minCwthe minimum contention window size.

Definition at line 175 of file txop.cc.

References m_cwMin, NS_LOG_FUNCTION, and ResetCw().

Referenced by ns3::ApWifiMac::ApWifiMac(), ns3::WifiMac::ConfigureDcf(), ns3::OcbWifiMac::ConfigureEdca(), ns3::MeshWifiInterfaceMac::FinishConfigureStandard(), GetTypeId(), and ns3::StaWifiMac::SetEdcaParameters().

◆ SetTxDroppedCallback()

void ns3::Txop::SetTxDroppedCallback ( TxDropped  callback)
Parameters
callbackthe callback to invoke when a packet is dropped.

Definition at line 151 of file txop.cc.

References m_queue, m_txDroppedCallback, ns3::MakeCallback(), NS_LOG_FUNCTION, and TxDroppedPacket().

Referenced by ns3::RegularWifiMac::RegularWifiMac().

◆ SetTxFailedCallback()

void ns3::Txop::SetTxFailedCallback ( TxFailed  callback)
Parameters
callbackthe callback to invoke when a packet transmission was completed unsuccessfully.

Definition at line 144 of file txop.cc.

References m_txFailedCallback, and NS_LOG_FUNCTION.

Referenced by ns3::RegularWifiMac::RegularWifiMac().

◆ SetTxMiddle()

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

Set MacTxMiddle this Txop is associated to.

Parameters
txMiddleMacTxMiddle.

Definition at line 116 of file txop.cc.

References m_txMiddle, and NS_LOG_FUNCTION.

Referenced by ns3::ApWifiMac::ApWifiMac(), AmpduAggregationTest::DoRun(), and ns3::RegularWifiMac::RegularWifiMac().

◆ SetTxOkCallback()

void ns3::Txop::SetTxOkCallback ( TxOk  callback)
Parameters
callbackthe callback to invoke when a packet transmission was completed successfully.

Definition at line 137 of file txop.cc.

References m_txOkCallback, and NS_LOG_FUNCTION.

Referenced by ns3::ApWifiMac::ApWifiMac(), and ns3::RegularWifiMac::RegularWifiMac().

◆ SetTxopLimit()

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

Set the TXOP limit.

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

Definition at line 264 of file txop.cc.

References ns3::Time::GetMicroSeconds(), m_txopLimit, NS_ASSERT_MSG(), and NS_LOG_FUNCTION.

Referenced by ns3::WifiMac::ConfigureDcf(), GetTypeId(), Experiment::Run(), and ns3::StaWifiMac::SetEdcaParameters().

◆ SetWifiRemoteStationManager()

void ns3::Txop::SetWifiRemoteStationManager ( const Ptr< WifiRemoteStationManager remoteManager)
virtual

Set WifiRemoteStationsManager this Txop is associated to.

Parameters
remoteManagerWifiRemoteStationManager.

Reimplemented in ns3::QosTxop.

Definition at line 130 of file txop.cc.

References m_stationManager, and NS_LOG_FUNCTION.

Referenced by ns3::ApWifiMac::SetWifiRemoteStationManager(), ns3::QosTxop::SetWifiRemoteStationManager(), and ns3::RegularWifiMac::SetWifiRemoteStationManager().

◆ StartAccessIfNeeded()

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

Request access from DCF manager if needed.

Reimplemented in ns3::QosTxop.

Definition at line 326 of file txop.cc.

References IsAccessRequested(), ns3::MacLow::IsCfPeriod(), m_channelAccessManager, m_currentPacket, m_low, m_queue, NS_LOG_FUNCTION, and ns3::ChannelAccessManager::RequestAccess().

Referenced by EndTxNoAck(), GotCfEnd(), NotifyOn(), and Queue().

◆ StartBackoffNow()

void ns3::Txop::StartBackoffNow ( uint32_t  nSlots)

◆ StartNextFragment()

void ns3::Txop::StartNextFragment ( void  )
virtual

◆ StartNextPacket()

void ns3::Txop::StartNextPacket ( void  )
virtual

Start transmission for the next packet if allowed by the TxopLimit.

Reimplemented in ns3::QosTxop.

Definition at line 816 of file txop.cc.

References NS_LOG_WARN.

Referenced by ns3::MacLow::WaitIfsAfterEndTxPacket().

◆ TxDroppedPacket()

void ns3::Txop::TxDroppedPacket ( Ptr< const WifiMacQueueItem item)
protected

Pass the packet included in the wifi MAC queue item to the packet dropped callback.

Parameters
itemthe wifi MAC queue item.

Definition at line 159 of file txop.cc.

References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), and m_txDroppedCallback.

Referenced by SetTxDroppedCallback().

◆ UpdateBackoffSlotsNow()

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

Update backoff slots that nSlots has passed.

Parameters
nSlots
backoffUpdateBound

Definition at line 232 of file txop.cc.

References m_backoffSlots, m_backoffStart, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ns3::ChannelAccessManager::NotifyOnNow(), ns3::ChannelAccessManager::NotifySwitchingStartNow(), ns3::ChannelAccessManager::NotifyWakeupNow(), and ns3::ChannelAccessManager::UpdateBackoff().

◆ UpdateFailedCw()

void ns3::Txop::UpdateFailedCw ( void  )
protected

Update the value of the CW variable to take into account a transmission failure.

By default, this triggers a doubling of CW (capped by maxCW).

Definition at line 212 of file txop.cc.

References m_cw, m_cwMax, min, and NS_LOG_FUNCTION.

Referenced by ns3::QosTxop::MissedAck(), MissedAck(), ns3::QosTxop::MissedBlockAck(), ns3::QosTxop::MissedCts(), MissedCts(), and ns3::QosTxop::NotifyInternalCollision().

Friends And Related Function Documentation

◆ ChannelAccessManager

friend class ChannelAccessManager
friend

< ChannelAccessManager associated class

Definition at line 351 of file txop.h.

◆ DcfListener

friend class DcfListener
friend

allow DcfListener class access

Definition at line 68 of file txop.h.

◆ MacLowTransmissionListener

friend class MacLowTransmissionListener
friend

allow MacLowTransmissionListener class access

Definition at line 70 of file txop.h.

Member Data Documentation

◆ m_accessRequested

bool ns3::Txop::m_accessRequested
protected

◆ m_aifsn

uint8_t ns3::Txop::m_aifsn
protected

the AIFSN

Definition at line 518 of file txop.h.

Referenced by GetAifsn(), and SetAifsn().

◆ m_backoffSlots

uint32_t ns3::Txop::m_backoffSlots
protected

the backoff slots

Definition at line 510 of file txop.h.

Referenced by GetBackoffSlots(), StartBackoffNow(), and UpdateBackoffSlotsNow().

◆ m_backoffStart

Time ns3::Txop::m_backoffStart
protected

the backoffStart variable is used to keep track of the time at which a backoff was started or the time at which the backoff counter was last updated.

Definition at line 516 of file txop.h.

Referenced by GetBackoffStart(), StartBackoffNow(), and UpdateBackoffSlotsNow().

◆ m_channelAccessManager

Ptr<ChannelAccessManager> ns3::Txop::m_channelAccessManager
protected

◆ m_currentHdr

WifiMacHeader ns3::Txop::m_currentHdr
protected

◆ m_currentPacket

Ptr<const Packet> ns3::Txop::m_currentPacket
protected

◆ m_currentParams

MacLowTransmissionParameters ns3::Txop::m_currentParams
protected

◆ m_cw

uint32_t ns3::Txop::m_cw
protected

the current CW

Definition at line 508 of file txop.h.

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

◆ m_cwMax

uint32_t ns3::Txop::m_cwMax
protected

the CW maximum

Definition at line 507 of file txop.h.

Referenced by GetMaxCw(), SetMaxCw(), and UpdateFailedCw().

◆ m_cwMin

uint32_t ns3::Txop::m_cwMin
protected

the CW minimum

Definition at line 506 of file txop.h.

Referenced by GetMinCw(), ResetCw(), and SetMinCw().

◆ m_fragmentNumber

uint8_t ns3::Txop::m_fragmentNumber
protected

◆ m_low

Ptr<MacLow> ns3::Txop::m_low
protected

◆ m_queue

Ptr<WifiMacQueue> ns3::Txop::m_queue
protected

◆ m_rng

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

◆ m_stationManager

Ptr<WifiRemoteStationManager> ns3::Txop::m_stationManager
protected

◆ m_txDroppedCallback

TxDropped ns3::Txop::m_txDroppedCallback
protected

the packet dropped callback

Definition at line 499 of file txop.h.

Referenced by SetTxDroppedCallback(), and TxDroppedPacket().

◆ m_txFailedCallback

TxFailed ns3::Txop::m_txFailedCallback
protected

◆ m_txMiddle

Ptr<MacTxMiddle> ns3::Txop::m_txMiddle
protected

◆ m_txOkCallback

TxOk ns3::Txop::m_txOkCallback
protected

the transmit OK callback

Definition at line 497 of file txop.h.

Referenced by ns3::QosTxop::BaTxOk(), EndTxNoAck(), ns3::QosTxop::GotAck(), GotAck(), ns3::QosTxop::GotBlockAck(), and SetTxOkCallback().

◆ m_txopLimit

Time ns3::Txop::m_txopLimit
protected

the txop limit time

Definition at line 519 of file txop.h.

Referenced by GetTxopLimit(), and SetTxopLimit().


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