ns3::MacLow Class Reference

handle RTS/CTS/DATA/ACK transactions. More...

#include <mac-low.h>

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

List of all members.

Public Types

typedef Callback< void, Ptr
< Packet >, WifiMacHeader
const * > 
MacLowRxCallback

Public Member Functions

 MacLow ()
virtual ~MacLow ()
void SetPhy (Ptr< WifiPhy > phy)
void SetWifiRemoteStationManager (Ptr< WifiRemoteStationManager > manager)
void SetAddress (Mac48Address ad)
void SetAckTimeout (Time ackTimeout)
void SetCtsTimeout (Time ctsTimeout)
void SetSifs (Time sifs)
void SetSlotTime (Time slotTime)
void SetPifs (Time pifs)
void SetBssid (Mac48Address ad)
Mac48Address GetAddress (void) const
Time GetAckTimeout (void) const
Time GetCtsTimeout (void) const
Time GetSifs (void) const
Time GetSlotTime (void) const
Time GetPifs (void) const
Mac48Address GetBssid (void) const
void SetRxCallback (Callback< void, Ptr< Packet >, const WifiMacHeader * > callback)
void RegisterNavListener (MacLowNavListener *listener)
Time CalculateTransmissionTime (Ptr< const Packet > packet, WifiMacHeader const *hdr, MacLowTransmissionParameters const &parameters) const
void StartTransmission (Ptr< const Packet > packet, WifiMacHeader const *hdr, MacLowTransmissionParameters parameters, MacLowTransmissionListener *listener)
void ReceiveOk (Ptr< Packet > packet)
void ReceiveError (Ptr< const Packet > packet)

Private Types

typedef std::vector
< MacLowNavListener * >
::const_iterator 
NavListenersCI
typedef std::vector
< MacLowNavListener * > 
NavListeners

Private Member Functions

void CancelAllEvents (void)
uint32_t GetAckSize (void) const
uint32_t GetRtsSize (void) const
uint32_t GetCtsSize (void) const
uint32_t GetSize (Ptr< const Packet > packet, const WifiMacHeader *hdr) const
Time NowUs (void) const
WifiRemoteStationGetStation (Mac48Address to) const
void ForwardDown (Ptr< const Packet > packet, WifiMacHeader const *hdr, WifiMode txMode)
Time CalculateOverallTxTime (Ptr< const Packet > packet, WifiMacHeader const *hdr, MacLowTransmissionParameters const &params) const
WifiMode GetRtsTxMode (Ptr< const Packet > packet, const WifiMacHeader *hdr) const
WifiMode GetDataTxMode (Ptr< const Packet > packet, const WifiMacHeader *hdr) const
WifiMode GetCtsTxModeForRts (Mac48Address to, WifiMode rtsTxMode) const
WifiMode GetAckTxModeForData (Mac48Address to, WifiMode dataTxMode) const
Time GetCtsDuration (Mac48Address to, WifiMode rtsTxMode) const
Time GetAckDuration (Mac48Address to, WifiMode dataTxMode) const
void NotifyNav (const WifiMacHeader &hdr, WifiMode txMode, WifiPreamble preamble)
void DoNavResetNow (Time duration)
bool DoNavStartNow (Time duration)
bool IsNavZero (void) const
void MaybeCancelPrevious (void)
void NavCounterResetCtsMissed (Time rtsEndRxTime)
void NormalAckTimeout (void)
void FastAckTimeout (void)
void SuperFastAckTimeout (void)
void FastAckFailedTimeout (void)
void CtsTimeout (void)
void SendCtsAfterRts (Mac48Address source, Time duration, WifiMode txMode, double rtsSnr)
void SendAckAfterData (Mac48Address source, Time duration, WifiMode txMode, double rtsSnr)
void SendDataAfterCts (Mac48Address source, Time duration, WifiMode txMode)
void WaitSifsAfterEndTx (void)
void SendRtsForPacket (void)
void SendDataPacket (void)
void SendCurrentTxPacket (void)
void StartDataTxTimers (void)
virtual void DoDispose (void)

Private Attributes

Ptr< WifiPhym_phy
Ptr< WifiRemoteStationManagerm_stationManager
MacLowRxCallback m_rxCallback
NavListeners m_navListeners
EventId m_normalAckTimeoutEvent
EventId m_fastAckTimeoutEvent
EventId m_superFastAckTimeoutEvent
EventId m_fastAckFailedTimeoutEvent
EventId m_ctsTimeoutEvent
EventId m_sendCtsEvent
EventId m_sendAckEvent
EventId m_sendDataEvent
EventId m_waitSifsEvent
EventId m_navCounterResetCtsMissed
Ptr< Packetm_currentPacket
WifiMacHeader m_currentHdr
MacLowTransmissionParameters m_txParams
MacLowTransmissionListenerm_listener
Mac48Address m_self
Mac48Address m_bssid
Time m_ackTimeout
Time m_ctsTimeout
Time m_sifs
Time m_slotTime
Time m_pifs
Time m_lastNavStart
Time m_lastNavDuration

Detailed Description

handle RTS/CTS/DATA/ACK transactions.

Definition at line 273 of file mac-low.h.


Member Typedef Documentation

Definition at line 275 of file mac-low.h.

typedef std::vector<MacLowNavListener *> ns3::MacLow::NavListeners [private]

Definition at line 397 of file mac-low.h.

typedef std::vector<MacLowNavListener *>::const_iterator ns3::MacLow::NavListenersCI [private]

Definition at line 396 of file mac-low.h.


Constructor & Destructor Documentation

ns3::MacLow::MacLow (  ) 

Definition at line 247 of file mac-low.cc.

References m_lastNavDuration, m_lastNavStart, NS_LOG_FUNCTION, and ns3::Seconds().

ns3::MacLow::~MacLow (  )  [virtual]

Definition at line 265 of file mac-low.cc.

References NS_LOG_FUNCTION.


Member Function Documentation

Time ns3::MacLow::CalculateOverallTxTime ( Ptr< const Packet packet,
WifiMacHeader const *  hdr,
MacLowTransmissionParameters const &  params 
) const [private]
Time ns3::MacLow::CalculateTransmissionTime ( Ptr< const Packet packet,
WifiMacHeader const *  hdr,
MacLowTransmissionParameters const &  parameters 
) const
Parameters:
packet to send (does not include the 802.11 MAC header and checksum)
hdr header associated to the packet to send.
parameters transmission parameters of packet.

This transmission time includes the time required for the next packet transmission if one was selected.

Definition at line 740 of file mac-low.cc.

References CalculateOverallTxTime(), GetDataTxMode(), ns3::MacLowTransmissionParameters::GetNextPacketSize(), GetSifs(), ns3::MacLowTransmissionParameters::HasNextPacket(), m_phy, and ns3::WIFI_PREAMBLE_LONG.

void ns3::MacLow::CancelAllEvents ( void   )  [private]
void ns3::MacLow::CtsTimeout ( void   )  [private]
void ns3::MacLow::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 271 of file mac-low.cc.

References CancelAllEvents(), m_phy, m_stationManager, and NS_LOG_FUNCTION.

void ns3::MacLow::DoNavResetNow ( Time  duration  )  [private]

Definition at line 805 of file mac-low.cc.

References m_lastNavStart, m_navListeners, and ns3::Now().

Referenced by NavCounterResetCtsMissed(), and NotifyNav().

bool ns3::MacLow::DoNavStartNow ( Time  duration  )  [private]

Definition at line 815 of file mac-low.cc.

References m_lastNavDuration, m_lastNavStart, m_navListeners, and ns3::Now().

Referenced by NotifyNav().

void ns3::MacLow::FastAckFailedTimeout ( void   )  [private]
void ns3::MacLow::FastAckTimeout ( void   )  [private]
void ns3::MacLow::ForwardDown ( Ptr< const Packet packet,
WifiMacHeader const *  hdr,
WifiMode  txMode 
) [private]
Time ns3::MacLow::GetAckDuration ( Mac48Address  to,
WifiMode  dataTxMode 
) const [private]
uint32_t ns3::MacLow::GetAckSize ( void   )  const [private]
Time ns3::MacLow::GetAckTimeout ( void   )  const

Definition at line 390 of file mac-low.cc.

References m_ackTimeout.

Referenced by StartDataTxTimers().

WifiMode ns3::MacLow::GetAckTxModeForData ( Mac48Address  to,
WifiMode  dataTxMode 
) const [private]

Definition at line 709 of file mac-low.cc.

References ns3::WifiRemoteStation::GetAckMode(), and GetStation().

Referenced by GetAckDuration(), and SendAckAfterData().

Mac48Address ns3::MacLow::GetAddress ( void   )  const

Definition at line 385 of file mac-low.cc.

References m_self.

Mac48Address ns3::MacLow::GetBssid ( void   )  const

Definition at line 415 of file mac-low.cc.

References m_bssid.

Time ns3::MacLow::GetCtsDuration ( Mac48Address  to,
WifiMode  rtsTxMode 
) const [private]
uint32_t ns3::MacLow::GetCtsSize ( void   )  const [private]
Time ns3::MacLow::GetCtsTimeout ( void   )  const

Definition at line 395 of file mac-low.cc.

References m_ctsTimeout.

Referenced by SendRtsForPacket().

WifiMode ns3::MacLow::GetCtsTxModeForRts ( Mac48Address  to,
WifiMode  rtsTxMode 
) const [private]

Definition at line 704 of file mac-low.cc.

References ns3::WifiRemoteStation::GetCtsMode(), and GetStation().

Referenced by GetCtsDuration(), and SendCtsAfterRts().

WifiMode ns3::MacLow::GetDataTxMode ( Ptr< const Packet packet,
const WifiMacHeader hdr 
) const [private]
Time ns3::MacLow::GetPifs ( void   )  const

Definition at line 410 of file mac-low.cc.

References m_pifs.

Referenced by StartDataTxTimers().

uint32_t ns3::MacLow::GetRtsSize ( void   )  const [private]
WifiMode ns3::MacLow::GetRtsTxMode ( Ptr< const Packet packet,
const WifiMacHeader hdr 
) const [private]
Time ns3::MacLow::GetSifs ( void   )  const
uint32_t ns3::MacLow::GetSize ( Ptr< const Packet packet,
const WifiMacHeader hdr 
) const [private]
Time ns3::MacLow::GetSlotTime ( void   )  const

Definition at line 405 of file mac-low.cc.

References m_slotTime.

Referenced by NotifyNav().

WifiRemoteStation * ns3::MacLow::GetStation ( Mac48Address  to  )  const [private]
bool ns3::MacLow::IsNavZero ( void   )  const [private]

Definition at line 1046 of file mac-low.cc.

References m_lastNavDuration, m_lastNavStart, and ns3::Simulator::Now().

Referenced by ReceiveOk().

void ns3::MacLow::MaybeCancelPrevious ( void   )  [private]
void ns3::MacLow::NavCounterResetCtsMissed ( Time  rtsEndRxTime  )  [private]

Definition at line 796 of file mac-low.cc.

References DoNavResetNow(), m_phy, and ns3::Seconds().

Referenced by NotifyNav().

void ns3::MacLow::NormalAckTimeout ( void   )  [private]
void ns3::MacLow::NotifyNav ( const WifiMacHeader hdr,
WifiMode  txMode,
WifiPreamble  preamble 
) [private]

A STA that used information from an RTS frame as the most recent basis to update its NAV setting is permitted to reset its NAV if no PHY-RXSTART.indication is detected from the PHY during a period with a duration of (2 * aSIFSTime) + (CTS_Time) + (2 * aSlotTime) starting at the PHY-RXEND.indication corresponding to the detection of the RTS frame. The “CTS_Time” shall be calculated using the length of the CTS frame and the data rate at which the RTS frame used for the most recent NAV update was received.

Definition at line 755 of file mac-low.cc.

References DoNavResetNow(), DoNavStartNow(), ns3::WifiMacHeader::GetAddr1(), ns3::WifiMacHeader::GetAddr2(), ns3::WifiMacHeader::GetDuration(), ns3::WifiMacHeader::GetSerializedSize(), GetSifs(), GetSlotTime(), ns3::WifiMacHeader::IsCfpoll(), ns3::WifiMacHeader::IsRts(), m_bssid, m_lastNavStart, m_navCounterResetCtsMissed, m_phy, m_self, NavCounterResetCtsMissed(), ns3::Simulator::Now(), NS_ASSERT, ns3::Simulator::Schedule(), ns3::WifiMacHeader::SetType(), and ns3::WIFI_MAC_CTL_CTS.

Referenced by ForwardDown(), and ReceiveOk().

Time ns3::MacLow::NowUs ( void   )  const [private]
void ns3::MacLow::ReceiveError ( Ptr< const Packet packet  ) 
Parameters:
packet packet received.

This method is typically invoked by the lower PHY layer to notify the MAC layer that a packet was unsuccessfully received.

Definition at line 478 of file mac-low.cc.

References FastAckFailedTimeout(), GetSifs(), ns3::EventId::IsExpired(), m_fastAckFailedTimeoutEvent, m_txParams, ns3::MacLowTransmissionParameters::MustWaitFastAck(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Simulator::Schedule().

Referenced by SetPhy().

void ns3::MacLow::ReceiveOk ( Ptr< Packet packet  ) 
Parameters:
packet packet received

This method is typically invoked by the lower PHY layer to notify the MAC layer that a packet was successfully received.

Definition at line 492 of file mac-low.cc.

References ns3::EventId::Cancel(), ns3::WifiMacHeader::GetAddr1(), ns3::WifiMacHeader::GetAddr2(), ns3::WifiMacHeader::GetDuration(), GetSifs(), ns3::WifiPhyRxTag::GetSnr(), GetStation(), ns3::WifiMacHeader::GetTypeString(), ns3::WifiPhyTxTag::GetWifiMode(), ns3::WifiPhyTxTag::GetWifiPreamble(), ns3::MacLowTransmissionListener::GotAck(), ns3::MacLowTransmissionListener::GotCts(), ns3::MacLowTransmissionParameters::HasNextPacket(), ns3::WifiMacHeader::IsAck(), ns3::Mac48Address::IsBroadcast(), ns3::WifiMacHeader::IsCtl(), ns3::WifiMacHeader::IsCts(), ns3::WifiMacHeader::IsData(), ns3::EventId::IsExpired(), ns3::WifiMacHeader::IsMgt(), IsNavZero(), ns3::WifiMacHeader::IsQosData(), ns3::WifiMacHeader::IsQosNoAck(), ns3::WifiMacHeader::IsRts(), ns3::EventId::IsRunning(), m_ctsTimeoutEvent, m_currentHdr, m_currentPacket, m_fastAckTimeoutEvent, m_listener, m_normalAckTimeoutEvent, m_rxCallback, m_self, m_sendAckEvent, m_sendCtsEvent, m_sendDataEvent, m_superFastAckTimeoutEvent, m_txParams, m_waitSifsEvent, ns3::MacLowTransmissionParameters::MustWaitAck(), ns3::MacLowTransmissionParameters::MustWaitFastAck(), ns3::MacLowTransmissionParameters::MustWaitNormalAck(), NotifyNav(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::WifiRemoteStation::ReportDataOk(), ns3::WifiRemoteStation::ReportRtsOk(), ns3::WifiRemoteStation::ReportRxOk(), ns3::Simulator::Schedule(), SendAckAfterData(), SendCtsAfterRts(), SendDataAfterCts(), and WaitSifsAfterEndTx().

Referenced by SetPhy().

void ns3::MacLow::RegisterNavListener ( MacLowNavListener listener  ) 
Parameters:
listener listen to NAV events for every incoming and outgoing packet.

Definition at line 426 of file mac-low.cc.

References m_navListeners.

void ns3::MacLow::SendAckAfterData ( Mac48Address  source,
Time  duration,
WifiMode  txMode,
double  rtsSnr 
) [private]
void ns3::MacLow::SendCtsAfterRts ( Mac48Address  source,
Time  duration,
WifiMode  txMode,
double  rtsSnr 
) [private]
void ns3::MacLow::SendCurrentTxPacket ( void   )  [private]
void ns3::MacLow::SendDataAfterCts ( Mac48Address  source,
Time  duration,
WifiMode  txMode 
) [private]
void ns3::MacLow::SendDataPacket ( void   )  [private]
void ns3::MacLow::SendRtsForPacket ( void   )  [private]
void ns3::MacLow::SetAckTimeout ( Time  ackTimeout  ) 

Definition at line 355 of file mac-low.cc.

References m_ackTimeout.

void ns3::MacLow::SetAddress ( Mac48Address  ad  ) 

Definition at line 350 of file mac-low.cc.

References m_self.

void ns3::MacLow::SetBssid ( Mac48Address  ad  ) 

Definition at line 380 of file mac-low.cc.

References m_bssid.

void ns3::MacLow::SetCtsTimeout ( Time  ctsTimeout  ) 

Definition at line 360 of file mac-low.cc.

References m_ctsTimeout.

void ns3::MacLow::SetPhy ( Ptr< WifiPhy phy  ) 

Definition at line 337 of file mac-low.cc.

References m_phy, ns3::MakeCallback(), ReceiveError(), and ReceiveOk().

void ns3::MacLow::SetPifs ( Time  pifs  ) 

Definition at line 375 of file mac-low.cc.

References m_pifs.

void ns3::MacLow::SetRxCallback ( Callback< void, Ptr< Packet >, const WifiMacHeader * >  callback  ) 
Parameters:
callback the callback which receives every incoming packet.

This callback typically forwards incoming packets to an instance of ns3::MacRxMiddle.

Definition at line 421 of file mac-low.cc.

References m_rxCallback.

void ns3::MacLow::SetSifs ( Time  sifs  ) 

Definition at line 365 of file mac-low.cc.

References m_sifs.

void ns3::MacLow::SetSlotTime ( Time  slotTime  ) 

Definition at line 370 of file mac-low.cc.

References m_slotTime.

void ns3::MacLow::SetWifiRemoteStationManager ( Ptr< WifiRemoteStationManager manager  ) 

Definition at line 344 of file mac-low.cc.

References m_stationManager.

void ns3::MacLow::StartDataTxTimers ( void   )  [private]
void ns3::MacLow::StartTransmission ( Ptr< const Packet packet,
WifiMacHeader const *  hdr,
MacLowTransmissionParameters  parameters,
MacLowTransmissionListener listener 
)
Parameters:
packet packet to send
hdr 802.11 header for packet to send
parameters the transmission parameters to use for this packet.
listener listen to transmission events.

Start the transmission of the input packet and notify the listener of transmission events.

Definition at line 433 of file mac-low.cc.

References CancelAllEvents(), ns3::WifiMacHeader::GetAddr1(), GetSize(), m_currentHdr, m_currentPacket, m_listener, m_phy, m_txParams, ns3::MacLowTransmissionParameters::MustSendRts(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, SendDataPacket(), and SendRtsForPacket().

void ns3::MacLow::SuperFastAckTimeout ( void   )  [private]
void ns3::MacLow::WaitSifsAfterEndTx ( void   )  [private]

Definition at line 1128 of file mac-low.cc.

References m_listener, and ns3::MacLowTransmissionListener::StartNext().

Referenced by ReceiveOk(), and StartDataTxTimers().


Member Data Documentation

Definition at line 417 of file mac-low.h.

Referenced by GetAckTimeout(), and SetAckTimeout().

Definition at line 416 of file mac-low.h.

Referenced by GetBssid(), NotifyNav(), and SetBssid().

Definition at line 418 of file mac-low.h.

Referenced by GetCtsTimeout(), and SetCtsTimeout().

Definition at line 404 of file mac-low.h.

Referenced by CancelAllEvents(), ReceiveOk(), and SendRtsForPacket().

Definition at line 403 of file mac-low.h.

Referenced by CancelAllEvents(), and ReceiveError().

Definition at line 401 of file mac-low.h.

Referenced by CancelAllEvents(), ReceiveOk(), and StartDataTxTimers().

Definition at line 424 of file mac-low.h.

Referenced by DoNavStartNow(), IsNavZero(), and MacLow().

Definition at line 423 of file mac-low.h.

Referenced by DoNavResetNow(), DoNavStartNow(), IsNavZero(), MacLow(), and NotifyNav().

Definition at line 409 of file mac-low.h.

Referenced by NotifyNav().

Definition at line 398 of file mac-low.h.

Referenced by DoNavResetNow(), DoNavStartNow(), and RegisterNavListener().

Definition at line 400 of file mac-low.h.

Referenced by CancelAllEvents(), ReceiveOk(), and StartDataTxTimers().

Definition at line 421 of file mac-low.h.

Referenced by GetPifs(), and SetPifs().

Definition at line 395 of file mac-low.h.

Referenced by ReceiveOk(), and SetRxCallback().

Definition at line 415 of file mac-low.h.

Referenced by GetAddress(), NotifyNav(), ReceiveOk(), SendRtsForPacket(), and SetAddress().

Definition at line 406 of file mac-low.h.

Referenced by CancelAllEvents(), and ReceiveOk().

Definition at line 405 of file mac-low.h.

Referenced by CancelAllEvents(), and ReceiveOk().

Definition at line 407 of file mac-low.h.

Referenced by CancelAllEvents(), and ReceiveOk().

Definition at line 419 of file mac-low.h.

Referenced by GetSifs(), and SetSifs().

Definition at line 420 of file mac-low.h.

Referenced by GetSlotTime(), and SetSlotTime().

Definition at line 394 of file mac-low.h.

Referenced by DoDispose(), GetStation(), and SetWifiRemoteStationManager().

Definition at line 402 of file mac-low.h.

Referenced by CancelAllEvents(), ReceiveOk(), and StartDataTxTimers().

Definition at line 408 of file mac-low.h.

Referenced by CancelAllEvents(), ReceiveOk(), and StartDataTxTimers().


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