Further work on cleaning up function logging of wifi module.
This commit is contained in:
@@ -185,11 +185,13 @@ DcaTxop::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> remoteManage
|
||||
void
|
||||
DcaTxop::SetTxOkCallback (TxOk callback)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &callback);
|
||||
m_txOkCallback = callback;
|
||||
}
|
||||
void
|
||||
DcaTxop::SetTxFailedCallback (TxFailed callback)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &callback);
|
||||
m_txFailedCallback = callback;
|
||||
}
|
||||
|
||||
@@ -221,16 +223,19 @@ DcaTxop::SetAifsn (uint32_t aifsn)
|
||||
uint32_t
|
||||
DcaTxop::GetMinCw (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_dcf->GetCwMin ();
|
||||
}
|
||||
uint32_t
|
||||
DcaTxop::GetMaxCw (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_dcf->GetCwMax ();
|
||||
}
|
||||
uint32_t
|
||||
DcaTxop::GetAifsn (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_dcf->GetAifsn ();
|
||||
}
|
||||
|
||||
@@ -282,12 +287,14 @@ DcaTxop::StartAccessIfNeeded (void)
|
||||
Ptr<MacLow>
|
||||
DcaTxop::Low (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_low;
|
||||
}
|
||||
|
||||
bool
|
||||
DcaTxop::NeedRts (Ptr<const Packet> packet, const WifiMacHeader *header)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << packet << header);
|
||||
return m_stationManager->NeedRts (header->GetAddr1 (), header,
|
||||
packet);
|
||||
}
|
||||
@@ -295,6 +302,7 @@ DcaTxop::NeedRts (Ptr<const Packet> packet, const WifiMacHeader *header)
|
||||
void
|
||||
DcaTxop::DoInitialize ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_dcf->ResetCw ();
|
||||
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
|
||||
ns3::Dcf::DoInitialize ();
|
||||
@@ -302,6 +310,7 @@ DcaTxop::DoInitialize ()
|
||||
bool
|
||||
DcaTxop::NeedRtsRetransmission (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_stationManager->NeedRtsRetransmission (m_currentHdr.GetAddr1 (), &m_currentHdr,
|
||||
m_currentPacket);
|
||||
}
|
||||
@@ -309,12 +318,14 @@ DcaTxop::NeedRtsRetransmission (void)
|
||||
bool
|
||||
DcaTxop::NeedDataRetransmission (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_stationManager->NeedDataRetransmission (m_currentHdr.GetAddr1 (), &m_currentHdr,
|
||||
m_currentPacket);
|
||||
}
|
||||
bool
|
||||
DcaTxop::NeedFragmentation (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_stationManager->NeedFragmentation (m_currentHdr.GetAddr1 (), &m_currentHdr,
|
||||
m_currentPacket);
|
||||
}
|
||||
@@ -322,18 +333,21 @@ DcaTxop::NeedFragmentation (void)
|
||||
void
|
||||
DcaTxop::NextFragment (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_fragmentNumber++;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
DcaTxop::GetFragmentSize (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr,
|
||||
m_currentPacket, m_fragmentNumber);
|
||||
}
|
||||
bool
|
||||
DcaTxop::IsLastFragment (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_stationManager->IsLastFragment (m_currentHdr.GetAddr1 (), &m_currentHdr,
|
||||
m_currentPacket, m_fragmentNumber);
|
||||
}
|
||||
@@ -341,6 +355,7 @@ DcaTxop::IsLastFragment (void)
|
||||
uint32_t
|
||||
DcaTxop::GetNextFragmentSize (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr,
|
||||
m_currentPacket, m_fragmentNumber + 1);
|
||||
}
|
||||
@@ -348,6 +363,7 @@ DcaTxop::GetNextFragmentSize (void)
|
||||
uint32_t
|
||||
DcaTxop::GetFragmentOffset (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_stationManager->GetFragmentOffset (m_currentHdr.GetAddr1 (), &m_currentHdr,
|
||||
m_currentPacket, m_fragmentNumber);
|
||||
}
|
||||
@@ -355,6 +371,7 @@ DcaTxop::GetFragmentOffset (void)
|
||||
Ptr<Packet>
|
||||
DcaTxop::GetFragmentPacket (WifiMacHeader *hdr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << hdr);
|
||||
*hdr = m_currentHdr;
|
||||
hdr->SetFragmentNumber (m_fragmentNumber);
|
||||
uint32_t startOffset = GetFragmentOffset ();
|
||||
@@ -375,6 +392,7 @@ DcaTxop::GetFragmentPacket (WifiMacHeader *hdr)
|
||||
bool
|
||||
DcaTxop::NeedsAccess (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return !m_queue->IsEmpty () || m_currentPacket != 0;
|
||||
}
|
||||
void
|
||||
@@ -479,6 +497,7 @@ DcaTxop::NotifyCollision (void)
|
||||
void
|
||||
DcaTxop::NotifyChannelSwitching (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_queue->Flush ();
|
||||
m_currentPacket = 0;
|
||||
}
|
||||
|
||||
@@ -272,6 +272,7 @@ DcfManager::DcfManager ()
|
||||
m_phyListener (0),
|
||||
m_lowListener (0)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
DcfManager::~DcfManager ()
|
||||
@@ -285,12 +286,14 @@ DcfManager::~DcfManager ()
|
||||
void
|
||||
DcfManager::SetupPhyListener (Ptr<WifiPhy> phy)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << phy);
|
||||
m_phyListener = new PhyListener (this);
|
||||
phy->RegisterListener (m_phyListener);
|
||||
}
|
||||
void
|
||||
DcfManager::SetupLowListener (Ptr<MacLow> low)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << low);
|
||||
m_lowListener = new LowDcfListener (this);
|
||||
low->RegisterDcfListener (m_lowListener);
|
||||
}
|
||||
@@ -298,38 +301,45 @@ DcfManager::SetupLowListener (Ptr<MacLow> low)
|
||||
void
|
||||
DcfManager::SetSlot (Time slotTime)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << slotTime);
|
||||
m_slotTimeUs = slotTime.GetMicroSeconds ();
|
||||
}
|
||||
void
|
||||
DcfManager::SetSifs (Time sifs)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << sifs);
|
||||
m_sifs = sifs;
|
||||
}
|
||||
void
|
||||
DcfManager::SetEifsNoDifs (Time eifsNoDifs)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << eifsNoDifs);
|
||||
m_eifsNoDifs = eifsNoDifs;
|
||||
}
|
||||
Time
|
||||
DcfManager::GetEifsNoDifs () const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_eifsNoDifs;
|
||||
}
|
||||
|
||||
void
|
||||
DcfManager::Add (DcfState *dcf)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << dcf);
|
||||
m_states.push_back (dcf);
|
||||
}
|
||||
|
||||
Time
|
||||
DcfManager::MostRecent (Time a, Time b) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << a << b);
|
||||
return Max (a, b);
|
||||
}
|
||||
Time
|
||||
DcfManager::MostRecent (Time a, Time b, Time c) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << a << b << c);
|
||||
Time retval;
|
||||
retval = Max (a, b);
|
||||
retval = Max (retval, c);
|
||||
@@ -338,6 +348,7 @@ DcfManager::MostRecent (Time a, Time b, Time c) const
|
||||
Time
|
||||
DcfManager::MostRecent (Time a, Time b, Time c, Time d) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << a << b << c << d);
|
||||
Time e = Max (a, b);
|
||||
Time f = Max (c, d);
|
||||
Time retval = Max (e, f);
|
||||
@@ -346,6 +357,7 @@ DcfManager::MostRecent (Time a, Time b, Time c, Time d) const
|
||||
Time
|
||||
DcfManager::MostRecent (Time a, Time b, Time c, Time d, Time e, Time f) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << a << b << c << d << e << f);
|
||||
Time g = Max (a, b);
|
||||
Time h = Max (c, d);
|
||||
Time i = Max (e, f);
|
||||
@@ -357,6 +369,7 @@ DcfManager::MostRecent (Time a, Time b, Time c, Time d, Time e, Time f) const
|
||||
Time
|
||||
DcfManager::MostRecent (Time a, Time b, Time c, Time d, Time e, Time f, Time g) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << a << b << c << d << e << f << g);
|
||||
Time h = Max (a, b);
|
||||
Time i = Max (c, d);
|
||||
Time j = Max (e, f);
|
||||
@@ -369,6 +382,7 @@ DcfManager::MostRecent (Time a, Time b, Time c, Time d, Time e, Time f, Time g)
|
||||
bool
|
||||
DcfManager::IsBusy (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
// PHY busy
|
||||
if (m_rxing)
|
||||
{
|
||||
@@ -392,6 +406,7 @@ DcfManager::IsBusy (void) const
|
||||
void
|
||||
DcfManager::RequestAccess (DcfState *state)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << state);
|
||||
UpdateBackoff ();
|
||||
NS_ASSERT (!state->IsAccessRequested ());
|
||||
state->NotifyAccessRequested ();
|
||||
@@ -415,6 +430,7 @@ DcfManager::RequestAccess (DcfState *state)
|
||||
void
|
||||
DcfManager::DoGrantAccess (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
uint32_t k = 0;
|
||||
for (States::const_iterator i = m_states.begin (); i != m_states.end (); k++)
|
||||
{
|
||||
@@ -469,6 +485,7 @@ DcfManager::DoGrantAccess (void)
|
||||
void
|
||||
DcfManager::AccessTimeout (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
UpdateBackoff ();
|
||||
DoGrantAccess ();
|
||||
DoRestartAccessTimeoutIfNeeded ();
|
||||
@@ -477,6 +494,7 @@ DcfManager::AccessTimeout (void)
|
||||
Time
|
||||
DcfManager::GetAccessGrantStart (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
Time rxAccessStart;
|
||||
if (!m_rxing)
|
||||
{
|
||||
@@ -515,6 +533,7 @@ DcfManager::GetAccessGrantStart (void) const
|
||||
Time
|
||||
DcfManager::GetBackoffStartFor (DcfState *state)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << state);
|
||||
Time mostRecentEvent = MostRecent (state->GetBackoffStart (),
|
||||
GetAccessGrantStart () + MicroSeconds (state->GetAifsn () * m_slotTimeUs));
|
||||
|
||||
@@ -530,6 +549,7 @@ DcfManager::GetBackoffEndFor (DcfState *state)
|
||||
void
|
||||
DcfManager::UpdateBackoff (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
uint32_t k = 0;
|
||||
for (States::const_iterator i = m_states.begin (); i != m_states.end (); i++, k++)
|
||||
{
|
||||
@@ -551,6 +571,7 @@ DcfManager::UpdateBackoff (void)
|
||||
void
|
||||
DcfManager::DoRestartAccessTimeoutIfNeeded (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
/**
|
||||
* Is there a DcfState which needs to access the medium, and,
|
||||
* if there is one, how many slots for AIFS+backoff does it require ?
|
||||
@@ -590,6 +611,7 @@ DcfManager::DoRestartAccessTimeoutIfNeeded (void)
|
||||
void
|
||||
DcfManager::NotifyRxStartNow (Time duration)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << duration);
|
||||
MY_DEBUG ("rx start for=" << duration);
|
||||
UpdateBackoff ();
|
||||
m_lastRxStart = Simulator::Now ();
|
||||
@@ -599,6 +621,7 @@ DcfManager::NotifyRxStartNow (Time duration)
|
||||
void
|
||||
DcfManager::NotifyRxEndOkNow (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
MY_DEBUG ("rx end ok");
|
||||
m_lastRxEnd = Simulator::Now ();
|
||||
m_lastRxReceivedOk = true;
|
||||
@@ -607,6 +630,7 @@ DcfManager::NotifyRxEndOkNow (void)
|
||||
void
|
||||
DcfManager::NotifyRxEndErrorNow (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
MY_DEBUG ("rx end error");
|
||||
m_lastRxEnd = Simulator::Now ();
|
||||
m_lastRxReceivedOk = false;
|
||||
@@ -615,6 +639,7 @@ DcfManager::NotifyRxEndErrorNow (void)
|
||||
void
|
||||
DcfManager::NotifyTxStartNow (Time duration)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << duration);
|
||||
if (m_rxing)
|
||||
{
|
||||
//this may be caused only if PHY has started to receive a packet
|
||||
@@ -634,6 +659,7 @@ DcfManager::NotifyTxStartNow (Time duration)
|
||||
void
|
||||
DcfManager::NotifyMaybeCcaBusyStartNow (Time duration)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << duration);
|
||||
MY_DEBUG ("busy start for " << duration);
|
||||
UpdateBackoff ();
|
||||
m_lastBusyStart = Simulator::Now ();
|
||||
@@ -644,6 +670,7 @@ DcfManager::NotifyMaybeCcaBusyStartNow (Time duration)
|
||||
void
|
||||
DcfManager::NotifySwitchingStartNow (Time duration)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << duration);
|
||||
Time now = Simulator::Now ();
|
||||
NS_ASSERT (m_lastTxStart + m_lastTxDuration <= now);
|
||||
NS_ASSERT (m_lastSwitchingStart + m_lastSwitchingDuration <= now);
|
||||
@@ -703,6 +730,7 @@ DcfManager::NotifySwitchingStartNow (Time duration)
|
||||
void
|
||||
DcfManager::NotifyNavResetNow (Time duration)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << duration);
|
||||
MY_DEBUG ("nav reset for=" << duration);
|
||||
UpdateBackoff ();
|
||||
m_lastNavStart = Simulator::Now ();
|
||||
@@ -719,6 +747,7 @@ DcfManager::NotifyNavResetNow (Time duration)
|
||||
void
|
||||
DcfManager::NotifyNavStartNow (Time duration)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << duration);
|
||||
NS_ASSERT (m_lastNavStart < Simulator::Now ());
|
||||
MY_DEBUG ("nav start for=" << duration);
|
||||
UpdateBackoff ();
|
||||
@@ -733,23 +762,27 @@ DcfManager::NotifyNavStartNow (Time duration)
|
||||
void
|
||||
DcfManager::NotifyAckTimeoutStartNow (Time duration)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << duration);
|
||||
NS_ASSERT (m_lastAckTimeoutEnd < Simulator::Now ());
|
||||
m_lastAckTimeoutEnd = Simulator::Now () + duration;
|
||||
}
|
||||
void
|
||||
DcfManager::NotifyAckTimeoutResetNow ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_lastAckTimeoutEnd = Simulator::Now ();
|
||||
DoRestartAccessTimeoutIfNeeded ();
|
||||
}
|
||||
void
|
||||
DcfManager::NotifyCtsTimeoutStartNow (Time duration)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << duration);
|
||||
m_lastCtsTimeoutEnd = Simulator::Now () + duration;
|
||||
}
|
||||
void
|
||||
DcfManager::NotifyCtsTimeoutResetNow ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_lastCtsTimeoutEnd = Simulator::Now ();
|
||||
DoRestartAccessTimeoutIfNeeded ();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
*/
|
||||
#include "dcf.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/log.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("Dcf");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ const double DsssErrorRateModel::WLAN_SIR_IMPOSSIBLE = 0.1;
|
||||
double
|
||||
DsssErrorRateModel::DqpskFunction (double x)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
return ((std::sqrt (2.0) + 1.0) / std::sqrt (8.0 * 3.1415926 * std::sqrt (2.0)))
|
||||
* (1.0 / std::sqrt (x)) * std::exp ( -(2.0 - std::sqrt (2.0)) * x);
|
||||
}
|
||||
@@ -41,6 +42,7 @@ DsssErrorRateModel::DqpskFunction (double x)
|
||||
double
|
||||
DsssErrorRateModel::GetDsssDbpskSuccessRate (double sinr, uint32_t nbits)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
double EbN0 = sinr * 22000000.0 / 1000000.0; // 1 bit per symbol with 1 MSPS
|
||||
double ber = 0.5 * std::exp (-EbN0);
|
||||
return std::pow ((1.0 - ber), static_cast<double> (nbits));
|
||||
@@ -49,6 +51,7 @@ DsssErrorRateModel::GetDsssDbpskSuccessRate (double sinr, uint32_t nbits)
|
||||
double
|
||||
DsssErrorRateModel::GetDsssDqpskSuccessRate (double sinr,uint32_t nbits)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
double EbN0 = sinr * 22000000.0 / 1000000.0 / 2.0; // 2 bits per symbol, 1 MSPS
|
||||
double ber = DqpskFunction (EbN0);
|
||||
return std::pow ((1.0 - ber), static_cast<double> (nbits));
|
||||
@@ -57,6 +60,7 @@ DsssErrorRateModel::GetDsssDqpskSuccessRate (double sinr,uint32_t nbits)
|
||||
double
|
||||
DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (double sinr,uint32_t nbits)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
#ifdef ENABLE_GSL
|
||||
// symbol error probability
|
||||
double EbN0 = sinr * 22000000.0 / 1375000.0 / 4.0;
|
||||
@@ -90,6 +94,7 @@ DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (double sinr,uint32_t nbits)
|
||||
double
|
||||
DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (double sinr,uint32_t nbits)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
#ifdef ENABLE_GSL
|
||||
// symbol error probability
|
||||
double EbN0 = sinr * 22000000.0 / 1375000.0 / 8.0;
|
||||
|
||||
@@ -227,12 +227,14 @@ EdcaTxopN::SetManager (DcfManager *manager)
|
||||
void
|
||||
EdcaTxopN::SetTxOkCallback (TxOk callback)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &callback);
|
||||
m_txOkCallback = callback;
|
||||
}
|
||||
|
||||
void
|
||||
EdcaTxopN::SetTxFailedCallback (TxFailed callback)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &callback);
|
||||
m_txFailedCallback = callback;
|
||||
}
|
||||
|
||||
@@ -245,13 +247,14 @@ EdcaTxopN::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> remoteMana
|
||||
void
|
||||
EdcaTxopN::SetTypeOfStation (enum TypeOfStation type)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << type);
|
||||
NS_LOG_FUNCTION (this << static_cast<uint32_t> (type));
|
||||
m_typeOfStation = type;
|
||||
}
|
||||
|
||||
enum TypeOfStation
|
||||
EdcaTxopN::GetTypeOfStation (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_typeOfStation;
|
||||
}
|
||||
|
||||
@@ -286,30 +289,35 @@ EdcaTxopN::SetAifsn (uint32_t aifsn)
|
||||
uint32_t
|
||||
EdcaTxopN::GetMinCw (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_dcf->GetCwMin ();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
EdcaTxopN::GetMaxCw (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_dcf->GetCwMax ();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
EdcaTxopN::GetAifsn (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_dcf->GetAifsn ();
|
||||
}
|
||||
|
||||
void
|
||||
EdcaTxopN::SetTxMiddle (MacTxMiddle *txMiddle)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << txMiddle);
|
||||
m_txMiddle = txMiddle;
|
||||
}
|
||||
|
||||
Ptr<MacLow>
|
||||
EdcaTxopN::Low (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_low;
|
||||
}
|
||||
|
||||
@@ -323,6 +331,7 @@ EdcaTxopN::SetLow (Ptr<MacLow> low)
|
||||
bool
|
||||
EdcaTxopN::NeedsAccess (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return !m_queue->IsEmpty () || m_currentPacket != 0 || m_baManager->HasPackets ();
|
||||
}
|
||||
|
||||
@@ -539,6 +548,7 @@ EdcaTxopN::MissedCts (void)
|
||||
void
|
||||
EdcaTxopN::NotifyChannelSwitching (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_queue->Flush ();
|
||||
m_currentPacket = 0;
|
||||
}
|
||||
@@ -675,6 +685,7 @@ EdcaTxopN::StartAccessIfNeeded (void)
|
||||
bool
|
||||
EdcaTxopN::NeedRts (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_stationManager->NeedRts (m_currentHdr.GetAddr1 (), &m_currentHdr,
|
||||
m_currentPacket);
|
||||
}
|
||||
@@ -682,6 +693,7 @@ EdcaTxopN::NeedRts (void)
|
||||
bool
|
||||
EdcaTxopN::NeedRtsRetransmission (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_stationManager->NeedRtsRetransmission (m_currentHdr.GetAddr1 (), &m_currentHdr,
|
||||
m_currentPacket);
|
||||
}
|
||||
@@ -689,6 +701,7 @@ EdcaTxopN::NeedRtsRetransmission (void)
|
||||
bool
|
||||
EdcaTxopN::NeedDataRetransmission (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_stationManager->NeedDataRetransmission (m_currentHdr.GetAddr1 (), &m_currentHdr,
|
||||
m_currentPacket);
|
||||
}
|
||||
@@ -696,6 +709,7 @@ EdcaTxopN::NeedDataRetransmission (void)
|
||||
void
|
||||
EdcaTxopN::NextFragment (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_fragmentNumber++;
|
||||
}
|
||||
|
||||
@@ -744,6 +758,7 @@ EdcaTxopN::EndTxNoAck (void)
|
||||
bool
|
||||
EdcaTxopN::NeedFragmentation (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_stationManager->NeedFragmentation (m_currentHdr.GetAddr1 (), &m_currentHdr,
|
||||
m_currentPacket);
|
||||
}
|
||||
@@ -751,6 +766,7 @@ EdcaTxopN::NeedFragmentation (void) const
|
||||
uint32_t
|
||||
EdcaTxopN::GetFragmentSize (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr,
|
||||
m_currentPacket, m_fragmentNumber);
|
||||
}
|
||||
@@ -758,6 +774,7 @@ EdcaTxopN::GetFragmentSize (void)
|
||||
uint32_t
|
||||
EdcaTxopN::GetNextFragmentSize (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr,
|
||||
m_currentPacket, m_fragmentNumber + 1);
|
||||
}
|
||||
@@ -765,6 +782,7 @@ EdcaTxopN::GetNextFragmentSize (void)
|
||||
uint32_t
|
||||
EdcaTxopN::GetFragmentOffset (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_stationManager->GetFragmentOffset (m_currentHdr.GetAddr1 (), &m_currentHdr,
|
||||
m_currentPacket, m_fragmentNumber);
|
||||
}
|
||||
@@ -773,6 +791,7 @@ EdcaTxopN::GetFragmentOffset (void)
|
||||
bool
|
||||
EdcaTxopN::IsLastFragment (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_stationManager->IsLastFragment (m_currentHdr.GetAddr1 (), &m_currentHdr,
|
||||
m_currentPacket, m_fragmentNumber);
|
||||
}
|
||||
@@ -780,6 +799,7 @@ EdcaTxopN::IsLastFragment (void) const
|
||||
Ptr<Packet>
|
||||
EdcaTxopN::GetFragmentPacket (WifiMacHeader *hdr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << hdr);
|
||||
*hdr = m_currentHdr;
|
||||
hdr->SetFragmentNumber (m_fragmentNumber);
|
||||
uint32_t startOffset = GetFragmentOffset ();
|
||||
@@ -800,12 +820,14 @@ EdcaTxopN::GetFragmentPacket (WifiMacHeader *hdr)
|
||||
void
|
||||
EdcaTxopN::SetAccessCategory (enum AcIndex ac)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << static_cast<uint32_t> (ac));
|
||||
m_ac = ac;
|
||||
}
|
||||
|
||||
Mac48Address
|
||||
EdcaTxopN::MapSrcAddressForAggregation (const WifiMacHeader &hdr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &hdr);
|
||||
Mac48Address retval;
|
||||
if (m_typeOfStation == STA || m_typeOfStation == ADHOC_STA)
|
||||
{
|
||||
@@ -821,6 +843,7 @@ EdcaTxopN::MapSrcAddressForAggregation (const WifiMacHeader &hdr)
|
||||
Mac48Address
|
||||
EdcaTxopN::MapDestAddressForAggregation (const WifiMacHeader &hdr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &hdr);
|
||||
Mac48Address retval;
|
||||
if (m_typeOfStation == AP || m_typeOfStation == ADHOC_STA)
|
||||
{
|
||||
@@ -836,6 +859,7 @@ EdcaTxopN::MapDestAddressForAggregation (const WifiMacHeader &hdr)
|
||||
void
|
||||
EdcaTxopN::SetMsduAggregator (Ptr<MsduAggregator> aggr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << aggr);
|
||||
m_aggregator = aggr;
|
||||
}
|
||||
|
||||
@@ -854,7 +878,7 @@ EdcaTxopN::PushFront (Ptr<const Packet> packet, const WifiMacHeader &hdr)
|
||||
void
|
||||
EdcaTxopN::GotAddBaResponse (const MgtAddBaResponseHeader *respHdr, Mac48Address recipient)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_LOG_FUNCTION (this << respHdr << recipient);
|
||||
NS_LOG_DEBUG ("received ADDBA response from " << recipient);
|
||||
uint8_t tid = respHdr->GetTid ();
|
||||
if (m_baManager->ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::PENDING))
|
||||
@@ -876,7 +900,7 @@ EdcaTxopN::GotAddBaResponse (const MgtAddBaResponseHeader *respHdr, Mac48Address
|
||||
void
|
||||
EdcaTxopN::GotDelBaFrame (const MgtDelBaHeader *delBaHdr, Mac48Address recipient)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_LOG_FUNCTION (this << delBaHdr << recipient);
|
||||
NS_LOG_DEBUG ("received DELBA frame from=" << recipient);
|
||||
m_baManager->TearDownBlockAck (recipient, delBaHdr->GetTid ());
|
||||
}
|
||||
@@ -884,6 +908,7 @@ EdcaTxopN::GotDelBaFrame (const MgtDelBaHeader *delBaHdr, Mac48Address recipient
|
||||
void
|
||||
EdcaTxopN::GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << blockAck << recipient);
|
||||
NS_LOG_DEBUG ("got block ack from=" << recipient);
|
||||
m_baManager->NotifyGotBlockAck (blockAck, recipient);
|
||||
m_currentPacket = 0;
|
||||
@@ -912,6 +937,7 @@ EdcaTxopN::VerifyBlockAck (void)
|
||||
void
|
||||
EdcaTxopN::CompleteTx (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
if (m_currentHdr.IsQosData () && m_currentHdr.IsQosBlockAck ())
|
||||
{
|
||||
if (!m_currentHdr.IsRetry ())
|
||||
@@ -927,6 +953,7 @@ EdcaTxopN::CompleteTx (void)
|
||||
bool
|
||||
EdcaTxopN::SetupBlockAckIfNeeded ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
uint8_t tid = m_currentHdr.GetQosTid ();
|
||||
Mac48Address recipient = m_currentHdr.GetAddr1 ();
|
||||
|
||||
@@ -945,7 +972,7 @@ EdcaTxopN::SetupBlockAckIfNeeded ()
|
||||
void
|
||||
EdcaTxopN::SendBlockAckRequest (const struct Bar &bar)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_LOG_FUNCTION (this << &bar);
|
||||
WifiMacHeader hdr;
|
||||
hdr.SetType (WIFI_MAC_CTL_BACKREQ);
|
||||
hdr.SetAddr1 (bar.recipient);
|
||||
@@ -998,6 +1025,7 @@ EdcaTxopN::CompleteConfig (void)
|
||||
void
|
||||
EdcaTxopN::SetBlockAckThreshold (uint8_t threshold)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << static_cast<uint32_t> (threshold));
|
||||
m_blockAckThreshold = threshold;
|
||||
m_baManager->SetBlockAckThreshold (threshold);
|
||||
}
|
||||
@@ -1005,12 +1033,14 @@ EdcaTxopN::SetBlockAckThreshold (uint8_t threshold)
|
||||
void
|
||||
EdcaTxopN::SetBlockAckInactivityTimeout (uint16_t timeout)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << timeout);
|
||||
m_blockAckInactivityTimeout = timeout;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
EdcaTxopN::GetBlockAckThreshold (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_blockAckThreshold;
|
||||
}
|
||||
|
||||
@@ -1018,7 +1048,7 @@ void
|
||||
EdcaTxopN::SendAddBaRequest (Mac48Address dest, uint8_t tid, uint16_t startSeq,
|
||||
uint16_t timeout, bool immediateBAck)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_LOG_FUNCTION (this << dest << static_cast<uint32_t> (tid) << startSeq << timeout << immediateBAck);
|
||||
NS_LOG_DEBUG ("sent ADDBA request to " << dest);
|
||||
WifiMacHeader hdr;
|
||||
hdr.SetAction ();
|
||||
@@ -1080,6 +1110,7 @@ EdcaTxopN::SendAddBaRequest (Mac48Address dest, uint8_t tid, uint16_t startSeq,
|
||||
void
|
||||
EdcaTxopN::SendDelbaFrame (Mac48Address addr, uint8_t tid, bool byOriginator)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << addr << static_cast<uint32_t> (tid) << byOriginator);
|
||||
WifiMacHeader hdr;
|
||||
hdr.SetAction ();
|
||||
hdr.SetAddr1 (addr);
|
||||
@@ -1122,6 +1153,7 @@ EdcaTxopN::AssignStreams (int64_t stream)
|
||||
void
|
||||
EdcaTxopN::DoInitialize ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_dcf->ResetCw ();
|
||||
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
|
||||
ns3::Dcf::DoInitialize ();
|
||||
|
||||
Reference in New Issue
Block a user