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"
Public Types | |
typedef Callback< void, uint8_t, Ptr< const WifiMacQueueItem >, const WifiTxVector & > | MpduResponseTimeout |
MPDU response timeout callback typedef. More... | |
typedef Callback< void, uint8_t, WifiPsduMap *, const std::set< Mac48Address > *, std::size_t > | PsduMapResponseTimeout |
PSDU map 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 , WAIT_NORMAL_ACK_AFTER_DL_MU_PPDU , WAIT_BLOCK_ACKS_IN_TB_PPDU , WAIT_TB_PPDU_AFTER_BASIC_TF , WAIT_QOS_NULL_AFTER_BSRP_TF , WAIT_BLOCK_ACK_AFTER_TB_PPDU } |
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 | SetPsduMapResponseTimeoutCallback (PsduMapResponseTimeout callback) const |
Set the callback to invoke when the TX timer following the transmission of a PSDU map 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 | |
void | FeedTraceSource (Ptr< WifiMacQueueItem > item, WifiTxVector txVector) |
This method is called when the timer expires to feed the MPDU response timeout callback. More... | |
void | FeedTraceSource (Ptr< WifiPsdu > psdu, WifiTxVector txVector) |
This method is called when the timer expires to feed the PSDU response timeout callback. More... | |
void | FeedTraceSource (WifiPsduMap *psduMap, std::set< Mac48Address > *missingStations, std::size_t nTotalStations) |
This method is called when the timer expires to feed the PSDU map 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< EventImpl > | m_endRxEvent |
event to schedule upon RXSTART.indication More... | |
MpduResponseTimeout | m_mpduResponseTimeoutCallback |
the MPDU response timeout callback More... | |
PsduMapResponseTimeout | m_psduMapResponseTimeoutCallback |
the PSDU map response timeout callback More... | |
PsduResponseTimeout | m_psduResponseTimeoutCallback |
the PSDU response timeout callback More... | |
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... | |
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 47 of file wifi-tx-timer.h.
typedef Callback<void, uint8_t, Ptr<const WifiMacQueueItem>, const WifiTxVector&> ns3::WifiTxTimer::MpduResponseTimeout |
MPDU response timeout callback typedef.
Definition at line 137 of file wifi-tx-timer.h.
typedef Callback<void, uint8_t, WifiPsduMap*, const std::set<Mac48Address>*, std::size_t> ns3::WifiTxTimer::PsduMapResponseTimeout |
PSDU map response timeout callback typedef.
Definition at line 147 of file wifi-tx-timer.h.
typedef Callback<void, uint8_t, Ptr<const WifiPsdu>, const WifiTxVector&> ns3::WifiTxTimer::PsduResponseTimeout |
PSDU response timeout callback typedef.
Definition at line 142 of file wifi-tx-timer.h.
enum ns3::WifiTxTimer::Reason : uint8_t |
The reason why the timer was started.
Definition at line 54 of file wifi-tx-timer.h.
ns3::WifiTxTimer::WifiTxTimer | ( | ) |
Default constructor.
Definition at line 32 of file wifi-tx-timer.cc.
|
virtual |
Definition at line 38 of file wifi-tx-timer.cc.
References ns3::EventId::Cancel(), m_endRxEvent, and m_timeoutEvent.
void ns3::WifiTxTimer::Cancel | ( | void | ) |
Cancel the timer.
Definition at line 100 of file wifi-tx-timer.cc.
References ns3::EventId::Cancel(), GetReasonString(), m_endRxEvent, m_reason, m_timeoutEvent, and NS_LOG_FUNCTION.
Referenced by ns3::FrameExchangeManager::ReceivedNormalAck(), ns3::FrameExchangeManager::ReceiveMpdu(), ns3::HtFrameExchangeManager::ReceiveMpdu(), ns3::FrameExchangeManager::Reset(), ns3::QosFrameExchangeManager::StartTransmission(), ns3::WaveFrameExchangeManager::StartTransmission(), and ns3::FrameExchangeManager::StartTransmission().
|
private |
This method is called when the timer expires to feed the MPDU response timeout callback.
item | the MPDU followed by no response |
txVector | the TXVECTOR used to transmit the MPDU |
Definition at line 120 of file wifi-tx-timer.cc.
References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_mpduResponseTimeoutCallback, and m_reason.
Referenced by Timeout().
|
private |
This method is called when the timer expires to feed the PSDU response timeout callback.
psdu | the PSDU followed by no response |
txVector | the TXVECTOR used to transmit the PSDU |
Definition at line 135 of file wifi-tx-timer.cc.
References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_psduResponseTimeoutCallback, and m_reason.
|
private |
This method is called when the timer expires to feed the PSDU map response timeout callback.
psduMap | the PSDU map for which not all responses were received |
missingStations | the set of stations that did not respond |
nTotalStations | the total number of expected responses |
Definition at line 150 of file wifi-tx-timer.cc.
References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_psduMapResponseTimeoutCallback, and m_reason.
Time ns3::WifiTxTimer::GetDelayLeft | ( | void | ) | const |
Get the remaining time until the timer will expire.
Definition at line 108 of file wifi-tx-timer.cc.
References ns3::Simulator::GetDelayLeft(), and m_timeoutEvent.
WifiTxTimer::Reason ns3::WifiTxTimer::GetReason | ( | void | ) | const |
Get the reason why the timer was started.
Call this method only if the timer is running
Definition at line 60 of file wifi-tx-timer.cc.
References IsRunning(), m_reason, and NS_ASSERT.
Referenced by ns3::FrameExchangeManager::ReceiveMpdu(), and ns3::HtFrameExchangeManager::ReceiveMpdu().
std::string ns3::WifiTxTimer::GetReasonString | ( | Reason | reason | ) | const |
Get a string associated with the given reason.
reason | 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().
bool ns3::WifiTxTimer::IsRunning | ( | void | ) | const |
Return true if the timer is running.
Definition at line 94 of file wifi-tx-timer.cc.
References ns3::EventId::IsRunning(), and m_timeoutEvent.
Referenced by GetReason(), ns3::FrameExchangeManager::ReceiveMpdu(), ns3::HtFrameExchangeManager::ReceiveMpdu(), ns3::FrameExchangeManager::RxStartIndication(), ns3::FrameExchangeManager::SendMpdu(), ns3::HtFrameExchangeManager::SendPsdu(), ns3::HeFrameExchangeManager::SendPsduMap(), ns3::FrameExchangeManager::SendRts(), ns3::QosFrameExchangeManager::StartTransmission(), and ns3::FrameExchangeManager::StartTransmission().
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.
delay | the 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().
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.
MEM | [deduced] Class method function signature type |
OBJ | [deduced] Class type of the object |
Args | [deduced] Type template parameter pack |
reason | the reason why the timer was started |
delay | the time to the expiration of the timer |
mem_ptr | Member method pointer to invoke |
obj | The object on which to invoke the member method |
args | The arguments to pass to the invoked method |
Definition at line 241 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(), ns3::HeFrameExchangeManager::SendPsduMap(), and ns3::FrameExchangeManager::SendRts().
void ns3::WifiTxTimer::SetMpduResponseTimeoutCallback | ( | MpduResponseTimeout | callback | ) | const |
Set the callback to invoke when the TX timer following the transmission of an MPDU expires.
callback | the callback to invoke when the TX timer following the transmission of an MPDU expires |
Definition at line 114 of file wifi-tx-timer.cc.
References m_mpduResponseTimeoutCallback.
void ns3::WifiTxTimer::SetPsduMapResponseTimeoutCallback | ( | PsduMapResponseTimeout | callback | ) | const |
Set the callback to invoke when the TX timer following the transmission of a PSDU map expires.
callback | the callback to invoke when the TX timer following the transmission of a PSDU map expires |
Definition at line 144 of file wifi-tx-timer.cc.
References m_psduMapResponseTimeoutCallback.
void ns3::WifiTxTimer::SetPsduResponseTimeoutCallback | ( | PsduResponseTimeout | callback | ) | const |
Set the callback to invoke when the TX timer following the transmission of a PSDU expires.
callback | the callback to invoke when the TX timer following the transmission of a PSDU expires |
Definition at line 129 of file wifi-tx-timer.cc.
References m_psduResponseTimeoutCallback.
|
private |
This method is called when the timer expires.
It invokes the callbacks and the method set by the user.
MEM | [deduced] Class method function signature type |
OBJ | [deduced] Class type of the object |
Args | [deduced] Type template parameter pack |
mem_ptr | Member method pointer to invoke |
obj | The object on which to invoke the member method |
args | The arguments to pass to the invoked method |
Definition at line 256 of file wifi-tx-timer.h.
References FeedTraceSource().
Referenced by Set().
event to schedule upon RXSTART.indication
Definition at line 219 of file wifi-tx-timer.h.
Referenced by ~WifiTxTimer(), Cancel(), Reschedule(), and Set().
|
mutableprivate |
the MPDU response timeout callback
Definition at line 223 of file wifi-tx-timer.h.
Referenced by FeedTraceSource(), and SetMpduResponseTimeoutCallback().
|
mutableprivate |
the PSDU map response timeout callback
Definition at line 227 of file wifi-tx-timer.h.
Referenced by FeedTraceSource(), and SetPsduMapResponseTimeoutCallback().
|
mutableprivate |
the PSDU response timeout callback
Definition at line 225 of file wifi-tx-timer.h.
Referenced by FeedTraceSource(), and SetPsduResponseTimeoutCallback().
|
private |
the reason why the timer was started
Definition at line 218 of file wifi-tx-timer.h.
Referenced by Cancel(), FeedTraceSource(), GetReason(), Reschedule(), and Set().
|
private |
whether the timer has been already rescheduled
Definition at line 220 of file wifi-tx-timer.h.
Referenced by Reschedule(), and Set().
|
private |
the timeout event after a missing response
Definition at line 217 of file wifi-tx-timer.h.
Referenced by ~WifiTxTimer(), Cancel(), GetDelayLeft(), IsRunning(), Reschedule(), and Set().