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

This class is used to handle the timer that a station starts when transmitting a frame that solicits a response. More...

#include "wifi-tx-timer.h"

+ Collaboration diagram for ns3::WifiTxTimer:

Public Types

typedef Callback< void, uint8_t, Ptr< const WifiMacQueueItem >, const WifiTxVector & > MpduResponseTimeout
 MPDU response timeout callback typedef. More...
 
typedef Callback< void, uint8_t, Ptr< const WifiPsdu >, const WifiTxVector & > PsduResponseTimeout
 PSDU response timeout callback typedef. More...
 
enum  Reason : uint8_t { NOT_RUNNING = 0, WAIT_CTS, WAIT_NORMAL_ACK, WAIT_BLOCK_ACK }
 The reason why the timer was started. More...
 

Public Member Functions

 WifiTxTimer ()
 Default constructor. More...
 
virtual ~WifiTxTimer ()
 
void Cancel (void)
 Cancel the timer. More...
 
Time GetDelayLeft (void) const
 Get the remaining time until the timer will expire. More...
 
Reason GetReason (void) const
 Get the reason why the timer was started. More...
 
std::string GetReasonString (Reason reason) const
 Get a string associated with the given reason. More...
 
bool IsRunning (void) const
 Return true if the timer is running. More...
 
void Reschedule (const Time &delay)
 Reschedule the timer to time out the given amount of time from the moment this function is called. More...
 
template<typename MEM , typename OBJ , typename... Args>
void Set (Reason reason, const Time &delay, MEM mem_ptr, OBJ obj, Args... args)
 This method is called when a frame soliciting a response is transmitted. More...
 
void SetMpduResponseTimeoutCallback (MpduResponseTimeout callback) const
 Set the callback to invoke when the TX timer following the transmission of an MPDU expires. More...
 
void SetPsduResponseTimeoutCallback (PsduResponseTimeout callback) const
 Set the callback to invoke when the TX timer following the transmission of a PSDU expires. More...
 

Private Member Functions

template<>
void FeedTraceSource (Ptr< WifiMacQueueItem > item, WifiTxVector txVector)
 
template<>
void FeedTraceSource (Ptr< WifiPsdu > psdu, WifiTxVector txVector)
 
template<typename... Args>
void FeedTraceSource (Args... args)
 This method is called when the timer expires to feed the trace sources reporting timeout events. More...
 
template<>
void FeedTraceSource (Ptr< WifiMacQueueItem > item, WifiTxVector txVector)
 Explicit specialization of the FeedTraceSource member function template that feeds the MPDU response timeout callback. More...
 
template<>
void FeedTraceSource (Ptr< WifiPsdu > psdu, WifiTxVector txVector)
 Explicit specialization of the FeedTraceSource member function template that feeds the PSDU response timeout callback. More...
 
template<typename MEM , typename OBJ , typename... Args>
void Timeout (MEM mem_ptr, OBJ obj, Args... args)
 This method is called when the timer expires. More...
 

Private Attributes

Ptr< EventImplm_endRxEvent
 event to schedule upon RXSTART.indication More...
 
MpduResponseTimeout m_mpduResponseTimeoutCallback
 the PSDU response timeout callback More...
 
PsduResponseTimeout m_psduResponseTimeoutCallback
 
Reason m_reason
 the reason why the timer was started More...
 
bool m_rescheduled
 whether the timer has been already rescheduled More...
 
EventId m_timeoutEvent
 the timeout event after a missing response More...
 

Detailed Description

This class is used to handle the timer that a station starts when transmitting a frame that solicits a response.

The timeout can be rescheduled (only once) when the RXSTART.indication is received from the PHY.

Definition at line 43 of file wifi-tx-timer.h.

Member Typedef Documentation

◆ MpduResponseTimeout

MPDU response timeout callback typedef.

Definition at line 128 of file wifi-tx-timer.h.

◆ PsduResponseTimeout

PSDU response timeout callback typedef.

Definition at line 133 of file wifi-tx-timer.h.

Member Enumeration Documentation

◆ Reason

enum ns3::WifiTxTimer::Reason : uint8_t

The reason why the timer was started.

Enumerator
NOT_RUNNING 
WAIT_CTS 
WAIT_NORMAL_ACK 
WAIT_BLOCK_ACK 

Definition at line 50 of file wifi-tx-timer.h.

Constructor & Destructor Documentation

◆ WifiTxTimer()

ns3::WifiTxTimer::WifiTxTimer ( )

Default constructor.

Definition at line 32 of file wifi-tx-timer.cc.

◆ ~WifiTxTimer()

ns3::WifiTxTimer::~WifiTxTimer ( )
virtual

Definition at line 38 of file wifi-tx-timer.cc.

References ns3::EventId::Cancel(), m_endRxEvent, and m_timeoutEvent.

+ Here is the call graph for this function:

Member Function Documentation

◆ Cancel()

◆ FeedTraceSource() [1/5]

template<>
void ns3::WifiTxTimer::FeedTraceSource ( Ptr< WifiMacQueueItem item,
WifiTxVector  txVector 
)
private

Definition at line 116 of file wifi-tx-timer.cc.

◆ FeedTraceSource() [2/5]

template<>
void ns3::WifiTxTimer::FeedTraceSource ( Ptr< WifiPsdu psdu,
WifiTxVector  txVector 
)
private

Definition at line 133 of file wifi-tx-timer.cc.

◆ FeedTraceSource() [3/5]

template<typename... Args>
void ns3::WifiTxTimer::FeedTraceSource ( Args...  args)
private

This method is called when the timer expires to feed the trace sources reporting timeout events.

This method does nothing, while its specializations actually do the job of feeding the trace sources.

Template Parameters
Args[deduced] Type template parameter pack
Parameters
argsThe arguments to pass to the trace sources

Definition at line 255 of file wifi-tx-timer.h.

Referenced by Timeout().

+ Here is the caller graph for this function:

◆ FeedTraceSource() [4/5]

template<>
void ns3::WifiTxTimer::FeedTraceSource ( Ptr< WifiMacQueueItem item,
WifiTxVector  txVector 
)
private

Explicit specialization of the FeedTraceSource member function template that feeds the MPDU response timeout callback.

Parameters
itemthe MPDU followed by no response
txVectorthe TXVECTOR used to transmit the MPDU

◆ FeedTraceSource() [5/5]

template<>
void ns3::WifiTxTimer::FeedTraceSource ( Ptr< WifiPsdu psdu,
WifiTxVector  txVector 
)
private

Explicit specialization of the FeedTraceSource member function template that feeds the PSDU response timeout callback.

Parameters
psduthe PSDU followed by no response
txVectorthe TXVECTOR used to transmit the PSDU

◆ GetDelayLeft()

Time ns3::WifiTxTimer::GetDelayLeft ( void  ) const

Get the remaining time until the timer will expire.

Returns
the remaining time until the timer will expire. If the timer is not running, this method returns zero.

Definition at line 103 of file wifi-tx-timer.cc.

References ns3::Simulator::GetDelayLeft(), and m_timeoutEvent.

+ Here is the call graph for this function:

◆ GetReason()

WifiTxTimer::Reason ns3::WifiTxTimer::GetReason ( void  ) const

Get the reason why the timer was started.

Call this method only if the timer is running

Returns
the reason why the timer was started

Definition at line 60 of file wifi-tx-timer.cc.

References IsRunning(), m_reason, and NS_ASSERT.

Referenced by ns3::HtFrameExchangeManager::ReceiveMpdu(), and ns3::FrameExchangeManager::ReceiveMpdu().

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

◆ GetReasonString()

std::string ns3::WifiTxTimer::GetReasonString ( Reason  reason) const

Get a string associated with the given reason.

Parameters
reasonthe given reason
Returns
a string associated with the given reason

Definition at line 67 of file wifi-tx-timer.cc.

References FOO, NOT_RUNNING, and NS_ABORT_MSG.

Referenced by Cancel(), and Reschedule().

+ Here is the caller graph for this function:

◆ IsRunning()

bool ns3::WifiTxTimer::IsRunning ( void  ) const

◆ Reschedule()

void ns3::WifiTxTimer::Reschedule ( const Time delay)

Reschedule the timer to time out the given amount of time from the moment this function is called.

Note that the timer must be running and must not have been already rescheduled.

Parameters
delaythe time to the expiration of the timer

Definition at line 45 of file wifi-tx-timer.cc.

References ns3::Time::As(), ns3::EventId::Cancel(), GetReasonString(), ns3::EventId::IsRunning(), m_endRxEvent, m_reason, m_rescheduled, m_timeoutEvent, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), and ns3::Time::US.

Referenced by ns3::FrameExchangeManager::RxStartIndication().

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

◆ Set()

template<typename MEM , typename OBJ , typename... Args>
void ns3::WifiTxTimer::Set ( Reason  reason,
const Time delay,
MEM  mem_ptr,
OBJ  obj,
Args...  args 
)

This method is called when a frame soliciting a response is transmitted.

This method starts a timer of the given duration and schedules a call to the given method in case the timer expires.

Template Parameters
MEM[deduced] Class method function signature type
OBJ[deduced] Class type of the object
Args[deduced] Type template parameter pack
Parameters
reasonthe reason why the timer was started
delaythe time to the expiration of the timer
mem_ptrMember method pointer to invoke
objThe object on which to invoke the member method
argsThe arguments to pass to the invoked method

Definition at line 230 of file wifi-tx-timer.h.

References m_endRxEvent, m_reason, m_rescheduled, m_timeoutEvent, and Timeout().

Referenced by ns3::FrameExchangeManager::SendMpdu(), ns3::HtFrameExchangeManager::SendPsdu(), and ns3::FrameExchangeManager::SendRts().

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

◆ SetMpduResponseTimeoutCallback()

void ns3::WifiTxTimer::SetMpduResponseTimeoutCallback ( MpduResponseTimeout  callback) const

Set the callback to invoke when the TX timer following the transmission of an MPDU expires.

Parameters
callbackthe callback to invoke when the TX timer following the transmission of an MPDU expires

Definition at line 109 of file wifi-tx-timer.cc.

References m_mpduResponseTimeoutCallback.

◆ SetPsduResponseTimeoutCallback()

void ns3::WifiTxTimer::SetPsduResponseTimeoutCallback ( PsduResponseTimeout  callback) const

Set the callback to invoke when the TX timer following the transmission of a PSDU expires.

Parameters
callbackthe callback to invoke when the TX timer following the transmission of a PSDU expires

Definition at line 126 of file wifi-tx-timer.cc.

References m_psduResponseTimeoutCallback.

◆ Timeout()

template<typename MEM , typename OBJ , typename... Args>
void ns3::WifiTxTimer::Timeout ( MEM  mem_ptr,
OBJ  obj,
Args...  args 
)
private

This method is called when the timer expires.

It invokes the callbacks and the method set by the user.

Template Parameters
MEM[deduced] Class method function signature type
OBJ[deduced] Class type of the object
Args[deduced] Type template parameter pack
Parameters
mem_ptrMember method pointer to invoke
objThe object on which to invoke the member method
argsThe arguments to pass to the invoked method

Definition at line 245 of file wifi-tx-timer.h.

References FeedTraceSource().

Referenced by Set().

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

Member Data Documentation

◆ m_endRxEvent

Ptr<EventImpl> ns3::WifiTxTimer::m_endRxEvent
private

event to schedule upon RXSTART.indication

Definition at line 179 of file wifi-tx-timer.h.

Referenced by Cancel(), Reschedule(), Set(), and ~WifiTxTimer().

◆ m_mpduResponseTimeoutCallback

MpduResponseTimeout ns3::WifiTxTimer::m_mpduResponseTimeoutCallback
mutableprivate

the PSDU response timeout callback

Definition at line 183 of file wifi-tx-timer.h.

Referenced by SetMpduResponseTimeoutCallback().

◆ m_psduResponseTimeoutCallback

PsduResponseTimeout ns3::WifiTxTimer::m_psduResponseTimeoutCallback
mutableprivate

Definition at line 185 of file wifi-tx-timer.h.

Referenced by SetPsduResponseTimeoutCallback().

◆ m_reason

Reason ns3::WifiTxTimer::m_reason
private

the reason why the timer was started

Definition at line 178 of file wifi-tx-timer.h.

Referenced by Cancel(), GetReason(), Reschedule(), and Set().

◆ m_rescheduled

bool ns3::WifiTxTimer::m_rescheduled
private

whether the timer has been already rescheduled

the MPDU response timeout callback

Definition at line 180 of file wifi-tx-timer.h.

Referenced by Reschedule(), and Set().

◆ m_timeoutEvent

EventId ns3::WifiTxTimer::m_timeoutEvent
private

the timeout event after a missing response

Definition at line 177 of file wifi-tx-timer.h.

Referenced by Cancel(), GetDelayLeft(), IsRunning(), Reschedule(), Set(), and ~WifiTxTimer().


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