A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::DcaTxop Class Reference

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. More...

#include <dca-txop.h>

+ Inheritance diagram for ns3::DcaTxop:
+ Collaboration diagram for ns3::DcaTxop:

Classes

class  Dcf
class  TransmissionListener

Public Types

typedef Callback< void, const
WifiMacHeader & > 
TxFailed
typedef Callback< void, const
WifiMacHeader & > 
TxOk

Public Member Functions

 DcaTxop ()
 ~DcaTxop ()
int64_t AssignStreams (int64_t stream)
virtual uint32_t GetAifsn (void) const
virtual uint32_t GetMaxCw (void) const
virtual uint32_t GetMinCw (void) const
Ptr< WifiMacQueueGetQueue () const
void Queue (Ptr< const Packet > packet, const WifiMacHeader &hdr)
virtual void SetAifsn (uint32_t aifsn)
void SetLow (Ptr< MacLow > low)
void SetManager (DcfManager *manager)
virtual void SetMaxCw (uint32_t maxCw)
virtual void SetMinCw (uint32_t minCw)
void SetTxFailedCallback (TxFailed callback)
void SetTxOkCallback (TxOk callback)
void SetWifiRemoteStationManager (Ptr< WifiRemoteStationManager > remoteManager)

Static Public Member Functions

static TypeId GetTypeId (void)
 This method returns the TypeId associated to ns3::DcaTxop.

Private Member Functions

 DcaTxop (const DcaTxop &o)
void Cancel (void)
virtual void DoDispose (void)
void DoStart ()
uint32_t GetFragmentOffset (void)
Ptr< PacketGetFragmentPacket (WifiMacHeader *hdr)
uint32_t GetFragmentSize (void)
uint32_t GetNextFragmentSize (void)
void GotAck (double snr, WifiMode txMode)
void GotCts (double snr, WifiMode txMode)
bool IsLastFragment (void)
Ptr< MacLowLow (void)
void MissedAck (void)
void MissedCts (void)
bool NeedDataRetransmission (void)
bool NeedFragmentation (void)
bool NeedRts (Ptr< const Packet > packet, const WifiMacHeader *header)
bool NeedRtsRetransmission (void)
bool NeedsAccess (void) const
void NextFragment (void)
void NotifyAccessGranted (void)
void NotifyChannelSwitching (void)
void NotifyCollision (void)
void NotifyInternalCollision (void)
DcaTxopoperator= (const DcaTxop &)
void RestartAccessIfNeeded (void)
void StartAccessIfNeeded (void)
void StartNext (void)

Private Attributes

bool m_accessOngoing
WifiMacHeader m_currentHdr
Ptr< const Packetm_currentPacket
Dcfm_dcf
uint8_t m_fragmentNumber
Ptr< MacLowm_low
DcfManagerm_manager
Ptr< WifiMacQueuem_queue
RandomStreamm_rng
Ptr< WifiRemoteStationManagerm_stationManager
TransmissionListenerm_transmissionListener
TxFailed m_txFailedCallback
MacTxMiddlem_txMiddle
TxOk m_txOkCallback

Friends

class Dcf
class TransmissionListener

Additional Inherited Members

- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
virtual void DoDispose (void)
virtual void DoStart (void)
virtual void NotifyNewAggregate (void)

Detailed Description

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 67 of file dca-txop.h.

Member Typedef Documentation

Definition at line 73 of file dca-txop.h.

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

Definition at line 72 of file dca-txop.h.

Constructor & Destructor Documentation

ns3::DcaTxop::DcaTxop ( )
ns3::DcaTxop::~DcaTxop ( )

Definition at line 139 of file dca-txop.cc.

References NS_LOG_FUNCTION.

ns3::DcaTxop::DcaTxop ( const DcaTxop o)
private

Member Function Documentation

int64_t ns3::DcaTxop::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 246 of file dca-txop.cc.

References ns3::RandomStream::AssignStreams(), m_rng, and NS_LOG_FUNCTION.

Referenced by ns3::WifiHelper::AssignStreams().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::DcaTxop::Cancel ( void  )
private

This happens in only one case: in an AP, you have two DcaTxop:

  • one is used exclusively for beacons and has a high priority.
  • the other is used for everything else and has a normal priority.

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 593 of file dca-txop.cc.

References NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ns3::DcaTxop::TransmissionListener::Cancel().

+ Here is the caller graph for this function:

void ns3::DcaTxop::DoDispose ( void  )
privatevirtual
void ns3::DcaTxop::DoStart ( void  )
private

Definition at line 292 of file dca-txop.cc.

References ns3::DcfState::GetCw(), ns3::RandomStream::GetNext(), m_dcf, m_rng, ns3::DcfState::ResetCw(), and ns3::DcfState::StartBackoffNow().

+ Here is the call graph for this function:

uint32_t ns3::DcaTxop::GetAifsn ( void  ) const
virtual

Implements ns3::Dcf.

Definition at line 228 of file dca-txop.cc.

References ns3::DcfState::GetAifsn(), and m_dcf.

+ Here is the call graph for this function:

uint32_t ns3::DcaTxop::GetFragmentOffset ( void  )
private

Definition at line 345 of file dca-txop.cc.

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

Referenced by GetFragmentPacket().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Ptr< Packet > ns3::DcaTxop::GetFragmentPacket ( WifiMacHeader hdr)
private
uint32_t ns3::DcaTxop::GetFragmentSize ( void  )
private

Definition at line 325 of file dca-txop.cc.

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

Referenced by GetFragmentPacket().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t ns3::DcaTxop::GetMaxCw ( void  ) const
virtual

Implements ns3::Dcf.

Definition at line 223 of file dca-txop.cc.

References ns3::DcfState::GetCwMax(), and m_dcf.

+ Here is the call graph for this function:

uint32_t ns3::DcaTxop::GetMinCw ( void  ) const
virtual

Implements ns3::Dcf.

Definition at line 218 of file dca-txop.cc.

References ns3::DcfState::GetCwMin(), and m_dcf.

+ Here is the call graph for this function:

uint32_t ns3::DcaTxop::GetNextFragmentSize ( void  )
private

Definition at line 338 of file dca-txop.cc.

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

Referenced by NotifyAccessGranted(), and StartNext().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Ptr< WifiMacQueue > ns3::DcaTxop::GetQueue ( void  ) const

Definition at line 193 of file dca-txop.cc.

References m_queue, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

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

This method returns the TypeId associated to ns3::DcaTxop.

This object is accessible through the following paths with Config::Set and Config::Connect:

  • /NodeList/[i]/DeviceList/[i]/$ns3::WifiNetDevice/Mac/$ns3::RegularWifiMac/DcaTxop

Attributes defined for this type:

Attributes defined in parent class ns3::Dcf:

  • MinCw: The minimum value of the contention window.
  • MaxCw: The maximum value of the contention window.
  • Aifsn: The AIFSN: the default value conforms to simple DCA.

No TraceSources defined for this type.

Reimplemented from ns3::Dcf.

Definition at line 114 of file dca-txop.cc.

References ns3::TypeId::AddConstructor(), GetQueue(), ns3::Dcf::GetTypeId(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

void ns3::DcaTxop::GotCts ( double  snr,
WifiMode  txMode 
)
private

Definition at line 487 of file dca-txop.cc.

References NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ns3::DcaTxop::TransmissionListener::GotCts().

+ Here is the caller graph for this function:

bool ns3::DcaTxop::IsLastFragment ( void  )
private

Definition at line 331 of file dca-txop.cc.

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Ptr< MacLow > ns3::DcaTxop::Low ( void  )
private

Definition at line 279 of file dca-txop.cc.

References m_low.

Referenced by NotifyAccessGranted(), and StartNext().

+ Here is the caller graph for this function:

bool ns3::DcaTxop::NeedDataRetransmission ( void  )
private

Definition at line 306 of file dca-txop.cc.

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

Referenced by MissedAck().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::DcaTxop::NeedFragmentation ( void  )
private

Definition at line 312 of file dca-txop.cc.

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

Referenced by GotAck(), and NotifyAccessGranted().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::DcaTxop::NeedRts ( Ptr< const Packet packet,
const WifiMacHeader header 
)
private

Definition at line 285 of file dca-txop.cc.

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

Referenced by NotifyAccessGranted().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::DcaTxop::NeedRtsRetransmission ( void  )
private

Definition at line 299 of file dca-txop.cc.

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

Referenced by MissedCts().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::DcaTxop::NeedsAccess ( void  ) const
private

Definition at line 372 of file dca-txop.cc.

References ns3::WifiMacQueue::IsEmpty(), m_currentPacket, and m_queue.

+ Here is the call graph for this function:

void ns3::DcaTxop::NextFragment ( void  )
private

Definition at line 319 of file dca-txop.cc.

References m_fragmentNumber.

Referenced by StartNext().

+ Here is the caller graph for this function:

void ns3::DcaTxop::NotifyChannelSwitching ( void  )
private

When a channel switching occurs, enqueued packets are removed.

Definition at line 480 of file dca-txop.cc.

References ns3::WifiMacQueue::Flush(), m_currentPacket, and m_queue.

Referenced by ns3::DcaTxop::Dcf::DoNotifyChannelSwitching().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::DcaTxop::NotifyCollision ( void  )
private

Definition at line 471 of file dca-txop.cc.

References ns3::DcfState::GetCw(), ns3::RandomStream::GetNext(), m_dcf, m_rng, NS_LOG_DEBUG, NS_LOG_FUNCTION, RestartAccessIfNeeded(), and ns3::DcfState::StartBackoffNow().

Referenced by ns3::DcaTxop::Dcf::DoNotifyCollision(), and NotifyInternalCollision().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::DcaTxop::NotifyInternalCollision ( void  )
private

Definition at line 465 of file dca-txop.cc.

References NotifyCollision(), and NS_LOG_FUNCTION.

Referenced by ns3::DcaTxop::Dcf::DoNotifyInternalCollision().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

DcaTxop& ns3::DcaTxop::operator= ( const DcaTxop )
private
void ns3::DcaTxop::RestartAccessIfNeeded ( void  )
private

Definition at line 254 of file dca-txop.cc.

References ns3::DcfState::IsAccessRequested(), ns3::WifiMacQueue::IsEmpty(), m_currentPacket, m_dcf, m_manager, m_queue, NS_LOG_FUNCTION, and ns3::DcfManager::RequestAccess().

Referenced by GotAck(), MissedAck(), MissedCts(), and NotifyCollision().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::DcaTxop::SetAifsn ( uint32_t  aifsn)
virtual

Implements ns3::Dcf.

Definition at line 212 of file dca-txop.cc.

References m_dcf, NS_LOG_FUNCTION, and ns3::DcfState::SetAifsn().

Referenced by ns3::ApWifiMac::ApWifiMac(), and ns3::MeshWifiInterfaceMac::FinishConfigureStandard().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::DcaTxop::SetLow ( Ptr< MacLow low)

Definition at line 170 of file dca-txop.cc.

References m_low, and NS_LOG_FUNCTION.

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

+ Here is the caller graph for this function:

void ns3::DcaTxop::SetManager ( DcfManager manager)

Definition at line 162 of file dca-txop.cc.

References ns3::DcfManager::Add(), m_dcf, m_manager, and NS_LOG_FUNCTION.

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::DcaTxop::SetMaxCw ( uint32_t  maxCw)
virtual

Implements ns3::Dcf.

Definition at line 206 of file dca-txop.cc.

References m_dcf, NS_LOG_FUNCTION, and ns3::DcfState::SetCwMax().

Referenced by ns3::ApWifiMac::ApWifiMac(), and ns3::MeshWifiInterfaceMac::FinishConfigureStandard().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::DcaTxop::SetMinCw ( uint32_t  minCw)
virtual

Implements ns3::Dcf.

Definition at line 200 of file dca-txop.cc.

References m_dcf, NS_LOG_FUNCTION, and ns3::DcfState::SetCwMin().

Referenced by ns3::ApWifiMac::ApWifiMac(), and ns3::MeshWifiInterfaceMac::FinishConfigureStandard().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 187 of file dca-txop.cc.

References m_txFailedCallback.

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

+ Here is the caller graph for this function:

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

Definition at line 182 of file dca-txop.cc.

References m_txOkCallback.

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

+ Here is the caller graph for this function:

void ns3::DcaTxop::SetWifiRemoteStationManager ( Ptr< WifiRemoteStationManager remoteManager)

Definition at line 176 of file dca-txop.cc.

References m_stationManager, and NS_LOG_FUNCTION.

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

+ Here is the caller graph for this function:

void ns3::DcaTxop::StartAccessIfNeeded ( void  )
private

Definition at line 266 of file dca-txop.cc.

References ns3::DcfState::IsAccessRequested(), ns3::WifiMacQueue::IsEmpty(), m_currentPacket, m_dcf, m_manager, m_queue, NS_LOG_FUNCTION, and ns3::DcfManager::RequestAccess().

Referenced by NotifyAccessGranted(), and Queue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend class Dcf
friend

Definition at line 124 of file dca-txop.h.

Referenced by DcaTxop().

friend class TransmissionListener
friend

Definition at line 126 of file dca-txop.h.

Referenced by DcaTxop().

Member Data Documentation

bool ns3::DcaTxop::m_accessOngoing
private

Definition at line 176 of file dca-txop.h.

uint8_t ns3::DcaTxop::m_fragmentNumber
private
Ptr<MacLow> ns3::DcaTxop::m_low
private

Definition at line 171 of file dca-txop.h.

Referenced by DoDispose(), Low(), and SetLow().

DcfManager* ns3::DcaTxop::m_manager
private

Definition at line 166 of file dca-txop.h.

Referenced by RestartAccessIfNeeded(), SetManager(), and StartAccessIfNeeded().

RandomStream* ns3::DcaTxop::m_rng
private
TransmissionListener* ns3::DcaTxop::m_transmissionListener
private

Definition at line 173 of file dca-txop.h.

Referenced by DcaTxop(), DoDispose(), NotifyAccessGranted(), and StartNext().

TxFailed ns3::DcaTxop::m_txFailedCallback
private

Definition at line 168 of file dca-txop.h.

Referenced by MissedAck(), MissedCts(), and SetTxFailedCallback().

MacTxMiddle* ns3::DcaTxop::m_txMiddle
private

Definition at line 170 of file dca-txop.h.

Referenced by DcaTxop(), DoDispose(), and NotifyAccessGranted().

TxOk ns3::DcaTxop::m_txOkCallback
private

Definition at line 167 of file dca-txop.h.

Referenced by GotAck(), and SetTxOkCallback().


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