ns3::DcaTxop Class Reference

handle packet fragmentation and retransmissions. More...

#include <dca-txop.h>

Inheritance diagram for ns3::DcaTxop:
Inheritance graph
[legend]
Collaboration diagram for ns3::DcaTxop:
Collaboration graph
[legend]

List of all members.

Classes

class  Dcf
class  TransmissionListener

Public Types

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

Public Member Functions

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

Static Public Member Functions

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

Private Member Functions

Ptr< MacLowLow (void)
bool NeedsAccess (void) const
void NotifyAccessGranted (void)
void NotifyInternalCollision (void)
void NotifyCollision (void)
void GotCts (double snr, WifiMode txMode)
void MissedCts (void)
void GotAck (double snr, WifiMode txMode)
void MissedAck (void)
void StartNext (void)
void Cancel (void)
void RestartAccessIfNeeded (void)
void StartAccessIfNeeded (void)
bool NeedRts (void)
bool NeedRtsRetransmission (void)
bool NeedDataRetransmission (void)
bool NeedFragmentation (void)
uint32_t GetNextFragmentSize (void)
uint32_t GetFragmentSize (void)
uint32_t GetFragmentOffset (void)
WifiRemoteStationGetStation (Mac48Address to) const
bool IsLastFragment (void)
void NextFragment (void)
Ptr< PacketGetFragmentPacket (WifiMacHeader *hdr)
virtual void DoDispose (void)

Private Attributes

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

Friends

class Dcf
class TransmissionListener
class WifiRemoteStation

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


Member Typedef Documentation

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.


Constructor & Destructor Documentation

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

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

References NS_LOG_FUNCTION.


Member Function Documentation

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 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]
Ptr< Packet > ns3::DcaTxop::GetFragmentPacket ( WifiMacHeader hdr  )  [private]
uint32_t ns3::DcaTxop::GetFragmentSize ( void   )  [private]
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]
WifiRemoteStation * ns3::DcaTxop::GetStation ( Mac48Address  to  )  const [private]
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]
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]
Ptr< MacLow > ns3::DcaTxop::Low ( void   )  [private]

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

References m_low.

Referenced by NotifyAccessGranted(), and StartNext().

void ns3::DcaTxop::MissedAck ( void   )  [private]
void ns3::DcaTxop::MissedCts ( void   )  [private]
bool ns3::DcaTxop::NeedDataRetransmission ( void   )  [private]
bool ns3::DcaTxop::NeedFragmentation ( void   )  [private]
bool ns3::DcaTxop::NeedRts ( void   )  [private]
bool ns3::DcaTxop::NeedRtsRetransmission ( void   )  [private]
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]

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

References m_fragmentNumber.

Referenced by StartNext().

void ns3::DcaTxop::NotifyAccessGranted ( void   )  [private]
void ns3::DcaTxop::NotifyCollision ( void   )  [private]
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 
)
Parameters:
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]
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().

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

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  ) 
Parameters:
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  ) 
Parameters:
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]
void ns3::DcaTxop::StartNext ( void   )  [private]

Friends And Related Function Documentation

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.


Member Data Documentation

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

uint8_t ns3::DcaTxop::m_fragmentNumber [private]

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

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

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

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

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().

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

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

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

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

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

Referenced by GotAck(), and SetTxOkCallback().


The documentation for this class was generated from the following files:
Generated on Thu Dec 3 14:10:55 2009 for NS-3 by  doxygen 1.6.3