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 WifiMpdu >, const WifiTxVector & > | MpduResponseTimeout |
MPDU response timeout callback typedef. | |
typedef Callback< void, uint8_t, WifiPsduMap *, const std::set< Mac48Address > *, std::size_t > | PsduMapResponseTimeout |
PSDU map response timeout callback typedef. | |
typedef Callback< void, uint8_t, Ptr< const WifiPsdu >, const WifiTxVector & > | PsduResponseTimeout |
PSDU response timeout callback typedef. | |
enum | Reason : uint8_t { NOT_RUNNING = 0 , WAIT_CTS , WAIT_NORMAL_ACK , WAIT_BLOCK_ACK , WAIT_CTS_AFTER_MU_RTS , 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. | |
virtual | ~WifiTxTimer () |
void | Cancel () |
Cancel the timer. | |
Time | GetDelayLeft () const |
Get the remaining time until the timer will expire. | |
Reason | GetReason () const |
Get the reason why the timer was started. | |
std::string | GetReasonString (Reason reason) const |
Get a string associated with the given reason. | |
const std::set< Mac48Address > & | GetStasExpectedToRespond () const |
void | GotResponseFrom (const Mac48Address &from) |
Notify that a response was got from the given station. | |
bool | IsRunning () const |
Return true if the timer is running. | |
void | Reschedule (const Time &delay) |
Reschedule the timer to time out the given amount of time from the moment this function is called. | |
template<typename MEM , typename OBJ , typename... Args> | |
void | Set (Reason reason, const Time &delay, const std::set< Mac48Address > &from, MEM mem_ptr, OBJ obj, Args... args) |
This method is called when a frame soliciting a response is transmitted. | |
void | SetMpduResponseTimeoutCallback (MpduResponseTimeout callback) const |
Set the callback to invoke when the TX timer following the transmission of an MPDU expires. | |
void | SetPsduMapResponseTimeoutCallback (PsduMapResponseTimeout callback) const |
Set the callback to invoke when the TX timer following the transmission of a PSDU map expires. | |
void | SetPsduResponseTimeoutCallback (PsduResponseTimeout callback) const |
Set the callback to invoke when the TX timer following the transmission of a PSDU expires. | |
Private Member Functions | |
void | Expire () |
Internal callback invoked when the timer expires. | |
void | FeedTraceSource (Ptr< WifiMpdu > item, WifiTxVector txVector) |
This method is called when the timer expires to feed the MPDU response timeout callback. | |
void | FeedTraceSource (Ptr< WifiPsdu > psdu, WifiTxVector txVector) |
This method is called when the timer expires to feed the PSDU response timeout callback. | |
void | FeedTraceSource (WifiPsduMap *psduMap, std::size_t nTotalStations) |
This method is called when the timer expires to feed the PSDU map response timeout callback. | |
template<typename MEM , typename OBJ , typename... Args> | |
void | Timeout (MEM mem_ptr, OBJ obj, Args... args) |
This method is called when the timer expires. | |
Private Attributes | |
Time | m_end |
the absolute time when the timer will expire | |
Ptr< EventImpl > | m_impl |
the timer implementation, which contains the bound callback function and arguments | |
MpduResponseTimeout | m_mpduResponseTimeoutCallback |
the MPDU response timeout callback | |
PsduMapResponseTimeout | m_psduMapResponseTimeoutCallback |
the PSDU map response timeout callback | |
PsduResponseTimeout | m_psduResponseTimeoutCallback |
the PSDU response timeout callback | |
Reason | m_reason |
the reason why the timer was started | |
std::set< Mac48Address > | m_staExpectResponseFrom |
the set of stations we expect to receive a response from | |
EventId | m_timeoutEvent |
the timeout event after a missing response | |
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 (multiple times) when the RXSTART.indication is received from the PHY.
Definition at line 37 of file wifi-tx-timer.h.
typedef Callback<void, uint8_t, Ptr<const WifiMpdu>, const WifiTxVector&> ns3::WifiTxTimer::MpduResponseTimeout |
MPDU response timeout callback typedef.
Definition at line 145 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 156 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 150 of file wifi-tx-timer.h.
enum ns3::WifiTxTimer::Reason : uint8_t |
The reason why the timer was started.
Definition at line 44 of file wifi-tx-timer.h.
ns3::WifiTxTimer::WifiTxTimer | ( | ) |
Default constructor.
Definition at line 22 of file wifi-tx-timer.cc.
|
virtual |
Definition at line 30 of file wifi-tx-timer.cc.
References ns3::EventId::Cancel(), m_impl, and m_timeoutEvent.
void ns3::WifiTxTimer::Cancel | ( | ) |
Cancel the timer.
Definition at line 116 of file wifi-tx-timer.cc.
References ns3::EventId::Cancel(), GetReasonString(), m_impl, m_reason, m_staExpectResponseFrom, m_timeoutEvent, and NS_LOG_FUNCTION.
Referenced by ns3::FrameExchangeManager::ReceivedNormalAck(), ns3::FrameExchangeManager::ReceiveMpdu(), ns3::HtFrameExchangeManager::ReceiveMpdu(), ns3::FrameExchangeManager::Reset(), ns3::FrameExchangeManager::StartTransmission(), and ns3::QosFrameExchangeManager::StartTransmission().
|
private |
Internal callback invoked when the timer expires.
Definition at line 61 of file wifi-tx-timer.cc.
References Expire(), m_end, m_impl, m_timeoutEvent, ns3::Simulator::Now(), NS_LOG_FUNCTION, and ns3::Simulator::Schedule().
Referenced by Expire(), Reschedule(), and Set().
|
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 149 of file wifi-tx-timer.cc.
References ns3::Callback< R, UArgs >::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 164 of file wifi-tx-timer.cc.
References ns3::Callback< R, UArgs >::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 |
nTotalStations | the total number of expected responses |
Definition at line 179 of file wifi-tx-timer.cc.
References ns3::Callback< R, UArgs >::IsNull(), m_psduMapResponseTimeoutCallback, m_reason, and m_staExpectResponseFrom.
Time ns3::WifiTxTimer::GetDelayLeft | ( | ) | const |
Get the remaining time until the timer will expire.
Definition at line 137 of file wifi-tx-timer.cc.
References m_end, and ns3::Simulator::Now().
Referenced by ns3::EhtFrameExchangeManager::UpdateTxopEndOnTxStart().
WifiTxTimer::Reason ns3::WifiTxTimer::GetReason | ( | ) | const |
Get the reason why the timer was started.
Call this method only if the timer is running
Definition at line 77 of file wifi-tx-timer.cc.
References IsRunning(), m_reason, and NS_ASSERT.
Referenced by ns3::FrameExchangeManager::ReceiveMpdu(), ns3::HtFrameExchangeManager::ReceiveMpdu(), and ns3::HeFrameExchangeManager::TransmissionSucceeded().
std::string ns3::WifiTxTimer::GetReasonString | ( | Reason | reason | ) | const |
Get a string associated with the given reason.
reason | the given reason |
Definition at line 84 of file wifi-tx-timer.cc.
References CASE_REASON, NOT_RUNNING, and NS_ABORT_MSG.
Referenced by Cancel(), and Reschedule().
const std::set< Mac48Address > & ns3::WifiTxTimer::GetStasExpectedToRespond | ( | ) | const |
Definition at line 131 of file wifi-tx-timer.cc.
References m_staExpectResponseFrom.
Referenced by ns3::EhtFrameExchangeManager::BlockAcksInTbPpduTimeout(), ns3::EhtFrameExchangeManager::PreProcessFrame(), ns3::EhtFrameExchangeManager::TbPpduTimeout(), ns3::QosFrameExchangeManager::TransmissionFailed(), and ns3::HeFrameExchangeManager::TransmissionSucceeded().
void ns3::WifiTxTimer::GotResponseFrom | ( | const Mac48Address & | from | ) |
Notify that a response was got from the given station.
from | the MAC address of the given station |
Definition at line 125 of file wifi-tx-timer.cc.
References m_staExpectResponseFrom.
Referenced by ns3::FrameExchangeManager::ReceivedNormalAck(), and ns3::HtFrameExchangeManager::ReceiveMpdu().
bool ns3::WifiTxTimer::IsRunning | ( | ) | const |
Return true if the timer is running.
Definition at line 110 of file wifi-tx-timer.cc.
References ns3::EventId::IsPending(), and m_timeoutEvent.
Referenced by GetReason(), ns3::FrameExchangeManager::NotifySwitchingStartNow(), ns3::FrameExchangeManager::ReceiveMpdu(), ns3::HtFrameExchangeManager::ReceiveMpdu(), ns3::FrameExchangeManager::RxStartIndication(), ns3::FrameExchangeManager::SendMpdu(), ns3::HeFrameExchangeManager::SendMuRts(), ns3::HtFrameExchangeManager::SendPsdu(), ns3::FrameExchangeManager::SendRts(), ns3::FrameExchangeManager::StartTransmission(), ns3::QosFrameExchangeManager::StartTransmission(), ns3::HeFrameExchangeManager::TransmissionSucceeded(), and ns3::EhtFrameExchangeManager::UpdateTxopEndOnTxStart().
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 nothing is done if the timer is not running.
delay | the time to the expiration of the timer |
Definition at line 37 of file wifi-tx-timer.cc.
References ns3::Time::As(), ns3::EventId::Cancel(), Expire(), GetReasonString(), ns3::EventId::IsPending(), m_end, m_reason, m_timeoutEvent, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), and ns3::Time::US.
Referenced by ns3::FrameExchangeManager::NotifySwitchingStartNow(), and ns3::FrameExchangeManager::RxStartIndication().
void ns3::WifiTxTimer::Set | ( | Reason | reason, |
const Time & | delay, | ||
const std::set< Mac48Address > & | from, | ||
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 |
from | the set of stations we expect to receive a response from |
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 257 of file wifi-tx-timer.h.
References Expire(), m_end, m_impl, m_reason, m_staExpectResponseFrom, m_timeoutEvent, ns3::MakeEvent(), ns3::Simulator::Now(), ns3::Simulator::Schedule(), and Timeout().
Referenced by ns3::FrameExchangeManager::SendMpdu(), ns3::HeFrameExchangeManager::SendMuRts(), ns3::HtFrameExchangeManager::SendPsdu(), 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 143 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 173 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 158 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 282 of file wifi-tx-timer.h.
References FeedTraceSource().
Referenced by Set().
|
private |
the absolute time when the timer will expire
Definition at line 234 of file wifi-tx-timer.h.
Referenced by Expire(), GetDelayLeft(), Reschedule(), and Set().
the timer implementation, which contains the bound callback function and arguments
Definition at line 232 of file wifi-tx-timer.h.
Referenced by ~WifiTxTimer(), Cancel(), Expire(), and Set().
|
mutableprivate |
the MPDU response timeout callback
Definition at line 239 of file wifi-tx-timer.h.
Referenced by FeedTraceSource(), and SetMpduResponseTimeoutCallback().
|
mutableprivate |
the PSDU map response timeout callback
Definition at line 243 of file wifi-tx-timer.h.
Referenced by FeedTraceSource(), and SetPsduMapResponseTimeoutCallback().
|
mutableprivate |
the PSDU response timeout callback
Definition at line 241 of file wifi-tx-timer.h.
Referenced by FeedTraceSource(), and SetPsduResponseTimeoutCallback().
|
private |
the reason why the timer was started
Definition at line 231 of file wifi-tx-timer.h.
Referenced by Cancel(), FeedTraceSource(), FeedTraceSource(), FeedTraceSource(), GetReason(), Reschedule(), and Set().
|
private |
the set of stations we expect to receive a response from
Definition at line 236 of file wifi-tx-timer.h.
Referenced by Cancel(), FeedTraceSource(), GetStasExpectedToRespond(), GotResponseFrom(), and Set().
|
private |
the timeout event after a missing response
Definition at line 230 of file wifi-tx-timer.h.
Referenced by ~WifiTxTimer(), Cancel(), Expire(), IsRunning(), Reschedule(), and Set().