handle packet fragmentation and retransmissions. More...
#include <dca-txop.h>
handle packet fragmentation and retransmissions.
This class implements the packet fragmentation and retransmission policy. It uses the ns3::MacLow and ns3::DcfManager 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.
Definition at line 65 of file dca-txop.h.
typedef Callback<void, WifiMacHeader const&> ns3::DcaTxop::TxFailed |
Definition at line 71 of file dca-txop.h.
typedef Callback<void, WifiMacHeader const&> ns3::DcaTxop::TxOk |
Definition at line 70 of file dca-txop.h.
ns3::DcaTxop::DcaTxop | ( | ) |
Definition at line 121 of file dca-txop.cc.
References Dcf, m_dcf, m_queue, m_rng, m_transmissionListener, m_txMiddle, NS_LOG_FUNCTION, and TransmissionListener.
ns3::DcaTxop::~DcaTxop | ( | ) |
Definition at line 133 of file dca-txop.cc.
References NS_LOG_FUNCTION.
void ns3::DcaTxop::Cancel | ( | void | ) | [private] |
This happens in only one case: in an AP, you have two DcaTxop:
If the normal queue tries to send a unicast data frame, but if the tx fails (ack timeout), it starts a backoff. If the beacon queue gets a tx oportunity during this backoff, it will trigger a call to this Cancel function.
Since we are already doing a backoff, we will get access to the medium when we can, we have nothing to do here. We just ignore the cancel event and wait until we are given again a tx oportunity.
Note that this is really non-trivial because each of these frames is assigned a sequence number from the same sequence counter (because this is a non-802.11e device) so, the scheme described here fails to ensure in-order delivery of frames at the receiving side. This, however, does not matter in this case because we assume that the receiving side does not update its <seq,ad> tupple for packets whose destination address is a broadcast address.
Definition at line 571 of file dca-txop.cc.
References MY_DEBUG, and NS_LOG_FUNCTION.
Referenced by ns3::DcaTxop::TransmissionListener::Cancel().
void ns3::DcaTxop::DoDispose | ( | void | ) | [private, virtual] |
This method is called by Object::Dispose or by the object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overriden 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.
Reimplemented from ns3::Object.
Definition at line 139 of file dca-txop.cc.
References m_dcf, m_low, m_queue, m_rng, m_stationManager, m_transmissionListener, m_txMiddle, and NS_LOG_FUNCTION.
uint32_t ns3::DcaTxop::GetAifsn | ( | void | ) | const |
Definition at line 227 of file dca-txop.cc.
References ns3::DcfState::GetAifsn(), and m_dcf.
Referenced by GetTypeId().
uint32_t ns3::DcaTxop::GetFragmentOffset | ( | void | ) | [private] |
Definition at line 335 of file dca-txop.cc.
References ns3::WifiMacHeader::GetAddr1(), ns3::WifiRemoteStation::GetFragmentOffset(), GetStation(), m_currentHdr, m_currentPacket, and m_fragmentNumber.
Referenced by GetFragmentPacket().
Ptr< Packet > ns3::DcaTxop::GetFragmentPacket | ( | WifiMacHeader * | hdr | ) | [private] |
Definition at line 342 of file dca-txop.cc.
References GetFragmentOffset(), GetFragmentSize(), IsLastFragment(), m_currentHdr, m_currentPacket, m_fragmentNumber, ns3::WifiMacHeader::SetFragmentNumber(), ns3::WifiMacHeader::SetMoreFragments(), and ns3::WifiMacHeader::SetNoMoreFragments().
Referenced by NotifyAccessGranted(), and StartNext().
uint32_t ns3::DcaTxop::GetFragmentSize | ( | void | ) | [private] |
Definition at line 315 of file dca-txop.cc.
References ns3::WifiMacHeader::GetAddr1(), ns3::WifiRemoteStation::GetFragmentSize(), GetStation(), m_currentHdr, m_currentPacket, and m_fragmentNumber.
Referenced by GetFragmentPacket().
uint32_t ns3::DcaTxop::GetMaxCw | ( | void | ) | const |
Definition at line 222 of file dca-txop.cc.
References ns3::DcfState::GetCwMax(), and m_dcf.
Referenced by GetTypeId().
uint32_t ns3::DcaTxop::GetMinCw | ( | void | ) | const |
Definition at line 217 of file dca-txop.cc.
References ns3::DcfState::GetCwMin(), and m_dcf.
Referenced by GetTypeId().
uint32_t ns3::DcaTxop::GetNextFragmentSize | ( | void | ) | [private] |
Definition at line 328 of file dca-txop.cc.
References ns3::WifiMacHeader::GetAddr1(), ns3::WifiRemoteStation::GetFragmentSize(), GetStation(), m_currentHdr, m_currentPacket, and m_fragmentNumber.
Referenced by NotifyAccessGranted(), and StartNext().
WifiRemoteStation * ns3::DcaTxop::GetStation | ( | Mac48Address | to | ) | const [private] |
Definition at line 245 of file dca-txop.cc.
References m_stationManager.
Referenced by GetFragmentOffset(), GetFragmentSize(), GetNextFragmentSize(), IsLastFragment(), MissedAck(), MissedCts(), NeedDataRetransmission(), NeedFragmentation(), NeedRts(), NeedRtsRetransmission(), and Queue().
TypeId ns3::DcaTxop::GetTypeId | ( | void | ) | [static] |
This method returns the TypeId associated to ns3::Object.
No Attributes defined for this type.
No TraceSources defined for this type.
Reimplemented from ns3::Object.
Definition at line 97 of file dca-txop.cc.
References ns3::TypeId::AddAttribute(), GetAifsn(), GetMaxCw(), GetMinCw(), SetAifsn(), SetMaxCw(), SetMinCw(), and ns3::TypeId::SetParent().
void ns3::DcaTxop::GotAck | ( | double | snr, | |
WifiMode | txMode | |||
) | [private] |
Definition at line 494 of file dca-txop.cc.
References ns3::DcfState::GetCw(), ns3::RandomStream::GetNext(), IsLastFragment(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_currentHdr, m_currentPacket, m_dcf, m_rng, m_txOkCallback, MY_DEBUG, NeedFragmentation(), NS_LOG_FUNCTION, ns3::DcfState::ResetCw(), RestartAccessIfNeeded(), and ns3::DcfState::StartBackoffNow().
Referenced by ns3::DcaTxop::TransmissionListener::GotAck().
void ns3::DcaTxop::GotCts | ( | double | snr, | |
WifiMode | txMode | |||
) | [private] |
Definition at line 463 of file dca-txop.cc.
References MY_DEBUG, and NS_LOG_FUNCTION.
Referenced by ns3::DcaTxop::TransmissionListener::GotCts().
bool ns3::DcaTxop::IsLastFragment | ( | void | ) | [private] |
Definition at line 321 of file dca-txop.cc.
References ns3::WifiMacHeader::GetAddr1(), GetStation(), ns3::WifiRemoteStation::IsLastFragment(), m_currentHdr, m_currentPacket, and m_fragmentNumber.
Referenced by GetFragmentPacket(), GotAck(), NotifyAccessGranted(), and StartNext().
Definition at line 276 of file dca-txop.cc.
References m_low.
Referenced by NotifyAccessGranted(), and StartNext().
void ns3::DcaTxop::MissedAck | ( | void | ) | [private] |
Definition at line 520 of file dca-txop.cc.
References ns3::WifiMacHeader::GetAddr1(), ns3::DcfState::GetCw(), ns3::RandomStream::GetNext(), GetStation(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_currentHdr, m_currentPacket, m_dcf, m_rng, m_txFailedCallback, MY_DEBUG, NeedDataRetransmission(), NS_LOG_FUNCTION, ns3::WifiRemoteStation::ReportFinalDataFailed(), ns3::DcfState::ResetCw(), RestartAccessIfNeeded(), ns3::WifiMacHeader::SetRetry(), ns3::DcfState::StartBackoffNow(), and ns3::DcfState::UpdateFailedCw().
Referenced by ns3::DcaTxop::TransmissionListener::MissedAck().
void ns3::DcaTxop::MissedCts | ( | void | ) | [private] |
Definition at line 469 of file dca-txop.cc.
References ns3::WifiMacHeader::GetAddr1(), ns3::DcfState::GetCw(), ns3::RandomStream::GetNext(), GetStation(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_currentHdr, m_currentPacket, m_dcf, m_rng, m_txFailedCallback, MY_DEBUG, NeedRtsRetransmission(), NS_LOG_FUNCTION, ns3::WifiRemoteStation::ReportFinalRtsFailed(), ns3::DcfState::ResetCw(), RestartAccessIfNeeded(), ns3::DcfState::StartBackoffNow(), and ns3::DcfState::UpdateFailedCw().
Referenced by ns3::DcaTxop::TransmissionListener::MissedCts().
bool ns3::DcaTxop::NeedDataRetransmission | ( | void | ) | [private] |
Definition at line 296 of file dca-txop.cc.
References ns3::WifiMacHeader::GetAddr1(), GetStation(), m_currentHdr, m_currentPacket, and ns3::WifiRemoteStation::NeedDataRetransmission().
Referenced by MissedAck().
bool ns3::DcaTxop::NeedFragmentation | ( | void | ) | [private] |
Definition at line 302 of file dca-txop.cc.
References ns3::WifiMacHeader::GetAddr1(), GetStation(), m_currentHdr, m_currentPacket, and ns3::WifiRemoteStation::NeedFragmentation().
Referenced by GotAck(), and NotifyAccessGranted().
bool ns3::DcaTxop::NeedRts | ( | void | ) | [private] |
Definition at line 282 of file dca-txop.cc.
References ns3::WifiMacHeader::GetAddr1(), GetStation(), m_currentHdr, m_currentPacket, and ns3::WifiRemoteStation::NeedRts().
Referenced by NotifyAccessGranted().
bool ns3::DcaTxop::NeedRtsRetransmission | ( | void | ) | [private] |
Definition at line 289 of file dca-txop.cc.
References ns3::WifiMacHeader::GetAddr1(), GetStation(), m_currentHdr, m_currentPacket, and ns3::WifiRemoteStation::NeedRtsRetransmission().
Referenced by MissedCts().
bool ns3::DcaTxop::NeedsAccess | ( | void | ) | const [private] |
Definition at line 362 of file dca-txop.cc.
References m_currentPacket, and m_queue.
void ns3::DcaTxop::NextFragment | ( | void | ) | [private] |
void ns3::DcaTxop::NotifyAccessGranted | ( | void | ) | [private] |
Definition at line 367 of file dca-txop.cc.
References ns3::MacLowTransmissionParameters::DisableAck(), ns3::MacLowTransmissionParameters::DisableNextData(), ns3::MacLowTransmissionParameters::DisableOverrideDurationId(), ns3::MacLowTransmissionParameters::DisableRts(), ns3::MacLowTransmissionParameters::EnableAck(), ns3::MacLowTransmissionParameters::EnableNextData(), ns3::MacLowTransmissionParameters::EnableRts(), ns3::WifiMacHeader::GetAddr1(), ns3::DcfState::GetCw(), GetFragmentPacket(), ns3::RandomStream::GetNext(), GetNextFragmentSize(), ns3::MacTxMiddle::GetNextSequenceNumberfor(), ns3::WifiMacHeader::GetSequenceControl(), ns3::Mac48Address::IsBroadcast(), IsLastFragment(), Low(), m_currentHdr, m_currentPacket, m_dcf, m_fragmentNumber, m_queue, m_rng, m_transmissionListener, m_txMiddle, MY_DEBUG, NeedFragmentation(), NeedRts(), NS_ASSERT, NS_LOG_FUNCTION, ns3::DcfState::ResetCw(), ns3::WifiMacHeader::SetFragmentNumber(), ns3::WifiMacHeader::SetNoMoreFragments(), ns3::WifiMacHeader::SetNoRetry(), ns3::WifiMacHeader::SetSequenceNumber(), StartAccessIfNeeded(), and ns3::DcfState::StartBackoffNow().
Referenced by ns3::DcaTxop::Dcf::DoNotifyAccessGranted().
void ns3::DcaTxop::NotifyCollision | ( | void | ) | [private] |
Definition at line 454 of file dca-txop.cc.
References ns3::DcfState::GetCw(), ns3::RandomStream::GetNext(), m_dcf, m_rng, MY_DEBUG, NS_LOG_FUNCTION, RestartAccessIfNeeded(), and ns3::DcfState::StartBackoffNow().
Referenced by ns3::DcaTxop::Dcf::DoNotifyCollision(), and NotifyInternalCollision().
void ns3::DcaTxop::NotifyInternalCollision | ( | void | ) | [private] |
Definition at line 448 of file dca-txop.cc.
References NotifyCollision(), and NS_LOG_FUNCTION.
Referenced by ns3::DcaTxop::Dcf::DoNotifyInternalCollision().
void ns3::DcaTxop::Queue | ( | Ptr< const Packet > | packet, | |
WifiMacHeader const & | hdr | |||
) |
packet | packet to send | |
hdr | header of packet to send. |
Store the packet in the internal queue until it can be sent safely.
Definition at line 233 of file dca-txop.cc.
References ns3::WifiMacHeader::GetAddr1(), ns3::WifiMacTrailer::GetSerializedSize(), ns3::WifiMacHeader::GetSerializedSize(), GetStation(), m_queue, NS_LOG_FUNCTION, ns3::WifiRemoteStation::PrepareForQueue(), and StartAccessIfNeeded().
void ns3::DcaTxop::RestartAccessIfNeeded | ( | void | ) | [private] |
Definition at line 251 of file dca-txop.cc.
References ns3::DcfState::IsAccessRequested(), m_currentPacket, m_dcf, m_manager, m_queue, NS_LOG_FUNCTION, and ns3::DcfManager::RequestAccess().
Referenced by GotAck(), MissedAck(), MissedCts(), and NotifyCollision().
void ns3::DcaTxop::SetAifsn | ( | uint32_t | aifsn | ) |
Definition at line 211 of file dca-txop.cc.
References m_dcf, NS_LOG_FUNCTION, and ns3::DcfState::SetAifsn().
Referenced by GetTypeId().
Definition at line 164 of file dca-txop.cc.
References m_low, and NS_LOG_FUNCTION.
void ns3::DcaTxop::SetManager | ( | DcfManager * | manager | ) |
Definition at line 156 of file dca-txop.cc.
References ns3::DcfManager::Add(), m_dcf, m_manager, and NS_LOG_FUNCTION.
void ns3::DcaTxop::SetMaxCw | ( | uint32_t | maxCw | ) |
Definition at line 205 of file dca-txop.cc.
References m_dcf, NS_LOG_FUNCTION, and ns3::DcfState::SetCwMax().
Referenced by GetTypeId().
void ns3::DcaTxop::SetMaxQueueDelay | ( | Time | delay | ) |
Definition at line 193 of file dca-txop.cc.
References m_queue, and NS_LOG_FUNCTION.
void ns3::DcaTxop::SetMaxQueueSize | ( | uint32_t | size | ) |
Definition at line 187 of file dca-txop.cc.
References m_queue, and NS_LOG_FUNCTION.
void ns3::DcaTxop::SetMinCw | ( | uint32_t | minCw | ) |
Definition at line 199 of file dca-txop.cc.
References m_dcf, NS_LOG_FUNCTION, and ns3::DcfState::SetCwMin().
Referenced by GetTypeId().
void ns3::DcaTxop::SetTxFailedCallback | ( | TxFailed | callback | ) |
callback | the callback to invoke when a packet transmission was completed unsuccessfully. |
Definition at line 181 of file dca-txop.cc.
References m_txFailedCallback.
void ns3::DcaTxop::SetTxOkCallback | ( | TxOk | callback | ) |
callback | the callback to invoke when a packet transmission was completed successfully. |
Definition at line 176 of file dca-txop.cc.
References m_txOkCallback.
void ns3::DcaTxop::SetWifiRemoteStationManager | ( | Ptr< WifiRemoteStationManager > | remoteManager | ) |
Definition at line 170 of file dca-txop.cc.
References m_stationManager, and NS_LOG_FUNCTION.
void ns3::DcaTxop::StartAccessIfNeeded | ( | void | ) | [private] |
Definition at line 263 of file dca-txop.cc.
References ns3::DcfState::IsAccessRequested(), m_currentPacket, m_dcf, m_manager, m_queue, NS_LOG_FUNCTION, and ns3::DcfManager::RequestAccess().
Referenced by NotifyAccessGranted(), and Queue().
void ns3::DcaTxop::StartNext | ( | void | ) | [private] |
Definition at line 547 of file dca-txop.cc.
References ns3::MacLowTransmissionParameters::DisableNextData(), ns3::MacLowTransmissionParameters::DisableOverrideDurationId(), ns3::MacLowTransmissionParameters::DisableRts(), ns3::MacLowTransmissionParameters::EnableAck(), ns3::MacLowTransmissionParameters::EnableNextData(), GetFragmentPacket(), GetNextFragmentSize(), IsLastFragment(), Low(), m_transmissionListener, MY_DEBUG, NextFragment(), and NS_LOG_FUNCTION.
Referenced by ns3::DcaTxop::TransmissionListener::StartNext().
friend class Dcf [friend] |
Definition at line 113 of file dca-txop.h.
Referenced by DcaTxop().
friend class TransmissionListener [friend] |
Definition at line 115 of file dca-txop.h.
Referenced by DcaTxop().
friend class WifiRemoteStation [friend] |
Definition at line 116 of file dca-txop.h.
bool ns3::DcaTxop::m_accessOngoing [private] |
Definition at line 161 of file dca-txop.h.
WifiMacHeader ns3::DcaTxop::m_currentHdr [private] |
Definition at line 163 of file dca-txop.h.
Referenced by GetFragmentOffset(), GetFragmentPacket(), GetFragmentSize(), GetNextFragmentSize(), GotAck(), IsLastFragment(), MissedAck(), MissedCts(), NeedDataRetransmission(), NeedFragmentation(), NeedRts(), NeedRtsRetransmission(), and NotifyAccessGranted().
Ptr<const Packet> ns3::DcaTxop::m_currentPacket [private] |
Definition at line 162 of file dca-txop.h.
Referenced by GetFragmentOffset(), GetFragmentPacket(), GetFragmentSize(), GetNextFragmentSize(), GotAck(), IsLastFragment(), MissedAck(), MissedCts(), NeedDataRetransmission(), NeedFragmentation(), NeedRts(), NeedRtsRetransmission(), NeedsAccess(), NotifyAccessGranted(), RestartAccessIfNeeded(), and StartAccessIfNeeded().
Dcf* ns3::DcaTxop::m_dcf [private] |
Definition at line 149 of file dca-txop.h.
Referenced by DcaTxop(), DoDispose(), GetAifsn(), GetMaxCw(), GetMinCw(), GotAck(), MissedAck(), MissedCts(), NotifyAccessGranted(), NotifyCollision(), RestartAccessIfNeeded(), SetAifsn(), SetManager(), SetMaxCw(), SetMinCw(), and StartAccessIfNeeded().
uint8_t ns3::DcaTxop::m_fragmentNumber [private] |
Definition at line 164 of file dca-txop.h.
Referenced by GetFragmentOffset(), GetFragmentPacket(), GetFragmentSize(), GetNextFragmentSize(), IsLastFragment(), NextFragment(), and NotifyAccessGranted().
Ptr<MacLow> ns3::DcaTxop::m_low [private] |
Definition at line 155 of file dca-txop.h.
Referenced by DoDispose(), Low(), and SetLow().
DcfManager* ns3::DcaTxop::m_manager [private] |
Definition at line 150 of file dca-txop.h.
Referenced by RestartAccessIfNeeded(), SetManager(), and StartAccessIfNeeded().
Ptr<WifiMacQueue> ns3::DcaTxop::m_queue [private] |
Definition at line 153 of file dca-txop.h.
Referenced by DcaTxop(), DoDispose(), NeedsAccess(), NotifyAccessGranted(), Queue(), RestartAccessIfNeeded(), SetMaxQueueDelay(), SetMaxQueueSize(), and StartAccessIfNeeded().
RandomStream* ns3::DcaTxop::m_rng [private] |
Definition at line 158 of file dca-txop.h.
Referenced by DcaTxop(), DoDispose(), GotAck(), MissedAck(), MissedCts(), NotifyAccessGranted(), and NotifyCollision().
Definition at line 156 of file dca-txop.h.
Referenced by DoDispose(), GetStation(), and SetWifiRemoteStationManager().
Definition at line 157 of file dca-txop.h.
Referenced by DcaTxop(), DoDispose(), NotifyAccessGranted(), and StartNext().
TxFailed ns3::DcaTxop::m_txFailedCallback [private] |
Definition at line 152 of file dca-txop.h.
Referenced by MissedAck(), MissedCts(), and SetTxFailedCallback().
MacTxMiddle* ns3::DcaTxop::m_txMiddle [private] |
Definition at line 154 of file dca-txop.h.
Referenced by DcaTxop(), DoDispose(), and NotifyAccessGranted().
TxOk ns3::DcaTxop::m_txOkCallback [private] |
Definition at line 151 of file dca-txop.h.
Referenced by GotAck(), and SetTxOkCallback().