Partially clean up function logging of wifi module.
This commit is contained in:
@@ -84,14 +84,17 @@ AarfWifiManager::GetTypeId (void)
|
||||
|
||||
AarfWifiManager::AarfWifiManager ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
AarfWifiManager::~AarfWifiManager ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
WifiRemoteStation *
|
||||
AarfWifiManager::DoCreateStation (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
AarfWifiRemoteStation *station = new AarfWifiRemoteStation ();
|
||||
|
||||
station->m_successThreshold = m_minSuccessThreshold;
|
||||
@@ -109,6 +112,7 @@ AarfWifiManager::DoCreateStation (void) const
|
||||
void
|
||||
AarfWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
}
|
||||
/**
|
||||
* It is important to realize that "recovery" mode starts after failure of
|
||||
@@ -122,6 +126,7 @@ AarfWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
|
||||
void
|
||||
AarfWifiManager::DoReportDataFailed (WifiRemoteStation *st)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st);
|
||||
AarfWifiRemoteStation *station = (AarfWifiRemoteStation *)st;
|
||||
station->m_timer++;
|
||||
station->m_failed++;
|
||||
@@ -168,17 +173,20 @@ void
|
||||
AarfWifiManager::DoReportRxOk (WifiRemoteStation *station,
|
||||
double rxSnr, WifiMode txMode)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station << rxSnr << txMode);
|
||||
}
|
||||
void
|
||||
AarfWifiManager::DoReportRtsOk (WifiRemoteStation *station,
|
||||
double ctsSnr, WifiMode ctsMode, double rtsSnr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station << ctsSnr << ctsMode << rtsSnr);
|
||||
NS_LOG_DEBUG ("station=" << station << " rts ok");
|
||||
}
|
||||
void
|
||||
AarfWifiManager::DoReportDataOk (WifiRemoteStation *st,
|
||||
double ackSnr, WifiMode ackMode, double dataSnr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << ackSnr << ackMode << dataSnr);
|
||||
AarfWifiRemoteStation *station = (AarfWifiRemoteStation *) st;
|
||||
station->m_timer++;
|
||||
station->m_success++;
|
||||
@@ -200,21 +208,25 @@ AarfWifiManager::DoReportDataOk (WifiRemoteStation *st,
|
||||
void
|
||||
AarfWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
}
|
||||
void
|
||||
AarfWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
}
|
||||
|
||||
WifiMode
|
||||
AarfWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << size);
|
||||
AarfWifiRemoteStation *station = (AarfWifiRemoteStation *) st;
|
||||
return GetSupported (station, station->m_rate);
|
||||
}
|
||||
WifiMode
|
||||
AarfWifiManager::DoGetRtsMode (WifiRemoteStation *st)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st);
|
||||
// XXX: we could/should implement the Aarf algorithm for
|
||||
// RTS only by picking a single rate within the BasicRateSet.
|
||||
AarfWifiRemoteStation *station = (AarfWifiRemoteStation *) st;
|
||||
@@ -224,6 +236,7 @@ AarfWifiManager::DoGetRtsMode (WifiRemoteStation *st)
|
||||
bool
|
||||
AarfWifiManager::IsLowLatency (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -111,13 +111,16 @@ AarfcdWifiManager::GetTypeId (void)
|
||||
AarfcdWifiManager::AarfcdWifiManager ()
|
||||
: WifiRemoteStationManager ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
AarfcdWifiManager::~AarfcdWifiManager ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
WifiRemoteStation *
|
||||
AarfcdWifiManager::DoCreateStation (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
AarfcdWifiRemoteStation *station = new AarfcdWifiRemoteStation ();
|
||||
|
||||
// aarf fields below
|
||||
@@ -143,6 +146,7 @@ AarfcdWifiManager::DoCreateStation (void) const
|
||||
void
|
||||
AarfcdWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
}
|
||||
/**
|
||||
* It is important to realize that "recovery" mode starts after failure of
|
||||
@@ -156,7 +160,7 @@ AarfcdWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
|
||||
void
|
||||
AarfcdWifiManager::DoReportDataFailed (WifiRemoteStation *st)
|
||||
{
|
||||
|
||||
NS_LOG_FUNCTION (this << st);
|
||||
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *)st;
|
||||
station->m_timer++;
|
||||
station->m_failed++;
|
||||
@@ -235,11 +239,13 @@ void
|
||||
AarfcdWifiManager::DoReportRxOk (WifiRemoteStation *station,
|
||||
double rxSnr, WifiMode txMode)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station << rxSnr << txMode);
|
||||
}
|
||||
void
|
||||
AarfcdWifiManager::DoReportRtsOk (WifiRemoteStation *st,
|
||||
double ctsSnr, WifiMode ctsMode, double rtsSnr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << ctsSnr << ctsMode << rtsSnr);
|
||||
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
|
||||
NS_LOG_DEBUG ("station=" << station << " rts ok");
|
||||
station->m_rtsCounter--;
|
||||
@@ -248,6 +254,7 @@ void
|
||||
AarfcdWifiManager::DoReportDataOk (WifiRemoteStation *st,
|
||||
double ackSnr, WifiMode ackMode, double dataSnr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << ackSnr << ackMode << dataSnr);
|
||||
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
|
||||
station->m_timer++;
|
||||
station->m_success++;
|
||||
@@ -279,21 +286,25 @@ AarfcdWifiManager::DoReportDataOk (WifiRemoteStation *st,
|
||||
void
|
||||
AarfcdWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
}
|
||||
void
|
||||
AarfcdWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
}
|
||||
|
||||
WifiMode
|
||||
AarfcdWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << size);
|
||||
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
|
||||
return GetSupported (station, station->m_rate);
|
||||
}
|
||||
WifiMode
|
||||
AarfcdWifiManager::DoGetRtsMode (WifiRemoteStation *st)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st);
|
||||
// XXX: we could/should implement the Aarf algorithm for
|
||||
// RTS only by picking a single rate within the BasicRateSet.
|
||||
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
|
||||
@@ -304,6 +315,7 @@ bool
|
||||
AarfcdWifiManager::DoNeedRts (WifiRemoteStation *st,
|
||||
Ptr<const Packet> packet, bool normally)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << packet << normally);
|
||||
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
|
||||
NS_LOG_INFO ("" << station << " rate=" << station->m_rate << " rts=" << (station->m_rtsOn ? "RTS" : "BASIC") <<
|
||||
" rtsCounter=" << station->m_rtsCounter);
|
||||
@@ -313,12 +325,14 @@ AarfcdWifiManager::DoNeedRts (WifiRemoteStation *st,
|
||||
bool
|
||||
AarfcdWifiManager::IsLowLatency (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
AarfcdWifiManager::CheckRts (AarfcdWifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
if (station->m_rtsCounter == 0 && station->m_rtsOn)
|
||||
{
|
||||
TurnOffRts (station);
|
||||
@@ -328,6 +342,7 @@ AarfcdWifiManager::CheckRts (AarfcdWifiRemoteStation *station)
|
||||
void
|
||||
AarfcdWifiManager::TurnOffRts (AarfcdWifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
station->m_rtsOn = false;
|
||||
station->m_haveASuccess = false;
|
||||
}
|
||||
@@ -335,12 +350,14 @@ AarfcdWifiManager::TurnOffRts (AarfcdWifiRemoteStation *station)
|
||||
void
|
||||
AarfcdWifiManager::TurnOnRts (AarfcdWifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
station->m_rtsOn = true;
|
||||
}
|
||||
|
||||
void
|
||||
AarfcdWifiManager::IncreaseRtsWnd (AarfcdWifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
if (station->m_rtsWnd == m_maxRtsWnd)
|
||||
{
|
||||
return;
|
||||
@@ -356,6 +373,7 @@ AarfcdWifiManager::IncreaseRtsWnd (AarfcdWifiRemoteStation *station)
|
||||
void
|
||||
AarfcdWifiManager::ResetRtsWnd (AarfcdWifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
station->m_rtsWnd = m_minRtsWnd;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ AdhocWifiMac::~AdhocWifiMac ()
|
||||
void
|
||||
AdhocWifiMac::SetAddress (Mac48Address address)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << address);
|
||||
// In an IBSS, the BSSID is supposed to be generated per Section
|
||||
// 11.1.3 of IEEE 802.11. We don't currently do this - instead we
|
||||
// make an IBSS STA a bit like an AP, with the BSSID for frames
|
||||
@@ -152,7 +153,7 @@ AdhocWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to)
|
||||
void
|
||||
AdhocWifiMac::SetLinkUpCallback (Callback<void> linkUp)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_LOG_FUNCTION (this << &linkUp);
|
||||
RegularWifiMac::SetLinkUpCallback (linkUp);
|
||||
|
||||
// The approach taken here is that, from the point of view of a STA
|
||||
|
||||
@@ -81,11 +81,13 @@ AmrrWifiManager::GetTypeId (void)
|
||||
|
||||
AmrrWifiManager::AmrrWifiManager ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
WifiRemoteStation *
|
||||
AmrrWifiManager::DoCreateStation (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
AmrrWifiRemoteStation *station = new AmrrWifiRemoteStation ();
|
||||
station->m_nextModeUpdate = Simulator::Now () + m_updatePeriod;
|
||||
station->m_tx_ok = 0;
|
||||
@@ -104,14 +106,17 @@ void
|
||||
AmrrWifiManager::DoReportRxOk (WifiRemoteStation *station,
|
||||
double rxSnr, WifiMode txMode)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station << rxSnr << txMode);
|
||||
}
|
||||
void
|
||||
AmrrWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
}
|
||||
void
|
||||
AmrrWifiManager::DoReportDataFailed (WifiRemoteStation *st)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st);
|
||||
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
|
||||
station->m_retry++;
|
||||
station->m_tx_retr++;
|
||||
@@ -120,11 +125,13 @@ void
|
||||
AmrrWifiManager::DoReportRtsOk (WifiRemoteStation *st,
|
||||
double ctsSnr, WifiMode ctsMode, double rtsSnr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << ctsSnr << ctsMode << rtsSnr);
|
||||
}
|
||||
void
|
||||
AmrrWifiManager::DoReportDataOk (WifiRemoteStation *st,
|
||||
double ackSnr, WifiMode ackMode, double dataSnr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << ackSnr << ackMode << dataSnr);
|
||||
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
|
||||
station->m_retry = 0;
|
||||
station->m_tx_ok++;
|
||||
@@ -132,10 +139,12 @@ AmrrWifiManager::DoReportDataOk (WifiRemoteStation *st,
|
||||
void
|
||||
AmrrWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
}
|
||||
void
|
||||
AmrrWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st);
|
||||
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
|
||||
station->m_retry = 0;
|
||||
station->m_tx_err++;
|
||||
@@ -143,32 +152,38 @@ AmrrWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
|
||||
bool
|
||||
AmrrWifiManager::IsMinRate (AmrrWifiRemoteStation *station) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
return (station->m_txrate == 0);
|
||||
}
|
||||
bool
|
||||
AmrrWifiManager::IsMaxRate (AmrrWifiRemoteStation *station) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
NS_ASSERT (station->m_txrate + 1 <= GetNSupported (station));
|
||||
return (station->m_txrate + 1 == GetNSupported (station));
|
||||
}
|
||||
bool
|
||||
AmrrWifiManager::IsSuccess (AmrrWifiRemoteStation *station) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
return (station->m_tx_retr + station->m_tx_err) < station->m_tx_ok * m_successRatio;
|
||||
}
|
||||
bool
|
||||
AmrrWifiManager::IsFailure (AmrrWifiRemoteStation *station) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
return (station->m_tx_retr + station->m_tx_err) > station->m_tx_ok * m_failureRatio;
|
||||
}
|
||||
bool
|
||||
AmrrWifiManager::IsEnough (AmrrWifiRemoteStation *station) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
return (station->m_tx_retr + station->m_tx_err + station->m_tx_ok) > 10;
|
||||
}
|
||||
void
|
||||
AmrrWifiManager::ResetCnt (AmrrWifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
station->m_tx_ok = 0;
|
||||
station->m_tx_err = 0;
|
||||
station->m_tx_retr = 0;
|
||||
@@ -176,18 +191,21 @@ AmrrWifiManager::ResetCnt (AmrrWifiRemoteStation *station)
|
||||
void
|
||||
AmrrWifiManager::IncreaseRate (AmrrWifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
station->m_txrate++;
|
||||
NS_ASSERT (station->m_txrate < GetNSupported (station));
|
||||
}
|
||||
void
|
||||
AmrrWifiManager::DecreaseRate (AmrrWifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
station->m_txrate--;
|
||||
}
|
||||
|
||||
void
|
||||
AmrrWifiManager::UpdateMode (AmrrWifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
if (Simulator::Now () < station->m_nextModeUpdate)
|
||||
{
|
||||
return;
|
||||
@@ -252,6 +270,7 @@ AmrrWifiManager::UpdateMode (AmrrWifiRemoteStation *station)
|
||||
WifiMode
|
||||
AmrrWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << size);
|
||||
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
|
||||
UpdateMode (station);
|
||||
NS_ASSERT (station->m_txrate < GetNSupported (station));
|
||||
@@ -299,6 +318,7 @@ AmrrWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
|
||||
WifiMode
|
||||
AmrrWifiManager::DoGetRtsMode (WifiRemoteStation *st)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st);
|
||||
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
|
||||
UpdateMode (station);
|
||||
// XXX: can we implement something smarter ?
|
||||
@@ -309,6 +329,7 @@ AmrrWifiManager::DoGetRtsMode (WifiRemoteStation *st)
|
||||
bool
|
||||
AmrrWifiManager::IsLowLatency (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
*/
|
||||
#include "amsdu-subframe-header.h"
|
||||
#include "ns3/address-utils.h"
|
||||
#include "ns3/log.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("AmsduSubframeHeader");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -43,21 +46,25 @@ AmsduSubframeHeader::GetInstanceTypeId (void) const
|
||||
AmsduSubframeHeader::AmsduSubframeHeader ()
|
||||
: m_length (0)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
AmsduSubframeHeader::~AmsduSubframeHeader ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
AmsduSubframeHeader::GetSerializedSize () const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return (6 + 6 + 2);
|
||||
}
|
||||
|
||||
void
|
||||
AmsduSubframeHeader::Serialize (Buffer::Iterator i) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &i);
|
||||
WriteTo (i, m_da);
|
||||
WriteTo (i, m_sa);
|
||||
i.WriteHtonU16 (m_length);
|
||||
@@ -66,6 +73,7 @@ AmsduSubframeHeader::Serialize (Buffer::Iterator i) const
|
||||
uint32_t
|
||||
AmsduSubframeHeader::Deserialize (Buffer::Iterator start)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &start);
|
||||
Buffer::Iterator i = start;
|
||||
ReadFrom (i, m_da);
|
||||
ReadFrom (i, m_sa);
|
||||
@@ -76,42 +84,49 @@ AmsduSubframeHeader::Deserialize (Buffer::Iterator start)
|
||||
void
|
||||
AmsduSubframeHeader::Print (std::ostream &os) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &os);
|
||||
os << "DA = " << m_da << ", SA = " << m_sa << ", length = " << m_length;
|
||||
}
|
||||
|
||||
void
|
||||
AmsduSubframeHeader::SetDestinationAddr (Mac48Address to)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << to);
|
||||
m_da = to;
|
||||
}
|
||||
|
||||
void
|
||||
AmsduSubframeHeader::SetSourceAddr (Mac48Address from)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << from);
|
||||
m_sa = from;
|
||||
}
|
||||
|
||||
void
|
||||
AmsduSubframeHeader::SetLength (uint16_t length)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << length);
|
||||
m_length = length;
|
||||
}
|
||||
|
||||
Mac48Address
|
||||
AmsduSubframeHeader::GetDestinationAddr (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_da;
|
||||
}
|
||||
|
||||
Mac48Address
|
||||
AmsduSubframeHeader::GetSourceAddr (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_sa;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
AmsduSubframeHeader::GetLength (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_length;
|
||||
}
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@ ApWifiMac::DoDispose ()
|
||||
void
|
||||
ApWifiMac::SetAddress (Mac48Address address)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << address);
|
||||
// As an AP, our MAC address is also the BSSID. Hence we are
|
||||
// overriding this function and setting both in our parent class.
|
||||
RegularWifiMac::SetAddress (address);
|
||||
@@ -122,12 +123,14 @@ ApWifiMac::SetBeaconGeneration (bool enable)
|
||||
bool
|
||||
ApWifiMac::GetBeaconGeneration (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_enableBeaconGeneration;
|
||||
}
|
||||
|
||||
Time
|
||||
ApWifiMac::GetBeaconInterval (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_beaconInterval;
|
||||
}
|
||||
|
||||
@@ -142,7 +145,7 @@ ApWifiMac::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationMan
|
||||
void
|
||||
ApWifiMac::SetLinkUpCallback (Callback<void> linkUp)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_LOG_FUNCTION (this << &linkUp);
|
||||
RegularWifiMac::SetLinkUpCallback (linkUp);
|
||||
|
||||
// The approach taken here is that, from the point of view of an AP,
|
||||
@@ -173,6 +176,7 @@ void
|
||||
ApWifiMac::ForwardDown (Ptr<const Packet> packet, Mac48Address from,
|
||||
Mac48Address to)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << packet << from << to);
|
||||
// If we are not a QoS AP then we definitely want to use AC_BE to
|
||||
// transmit the packet. A TID of zero will map to AC_BE (through \c
|
||||
// QosUtilsMapTidToAc()), so we use that as our default here.
|
||||
@@ -198,7 +202,7 @@ void
|
||||
ApWifiMac::ForwardDown (Ptr<const Packet> packet, Mac48Address from,
|
||||
Mac48Address to, uint8_t tid)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << packet << from << to);
|
||||
NS_LOG_FUNCTION (this << packet << from << to << static_cast<uint32_t> (tid));
|
||||
WifiMacHeader hdr;
|
||||
|
||||
// For now, an AP that supports QoS does not support non-QoS
|
||||
@@ -254,6 +258,7 @@ ApWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from
|
||||
void
|
||||
ApWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << packet << to);
|
||||
// We're sending this packet with a from address that is our own. We
|
||||
// get that address from the lower MAC and make use of the
|
||||
// from-spoofing Enqueue() method to avoid duplicated code.
|
||||
@@ -263,12 +268,14 @@ ApWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to)
|
||||
bool
|
||||
ApWifiMac::SupportsSendFrom (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return true;
|
||||
}
|
||||
|
||||
SupportedRates
|
||||
ApWifiMac::GetSupportedRates (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
// send the set of supported rates and make sure that we indicate
|
||||
// the Basic Rate set in this set of supported rates.
|
||||
SupportedRates rates;
|
||||
@@ -542,6 +549,7 @@ void
|
||||
ApWifiMac::DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
|
||||
const WifiMacHeader *hdr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << aggregatedPacket << hdr);
|
||||
MsduAggregator::DeaggregatedMsdus packets =
|
||||
MsduAggregator::Deaggregate (aggregatedPacket);
|
||||
|
||||
@@ -566,6 +574,7 @@ ApWifiMac::DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
|
||||
void
|
||||
ApWifiMac::DoInitialize (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_beaconDca->Initialize ();
|
||||
m_beaconEvent.Cancel ();
|
||||
if (m_enableBeaconGeneration)
|
||||
|
||||
@@ -65,13 +65,16 @@ ArfWifiManager::GetTypeId (void)
|
||||
|
||||
ArfWifiManager::ArfWifiManager ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
ArfWifiManager::~ArfWifiManager ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
WifiRemoteStation *
|
||||
ArfWifiManager::DoCreateStation (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
ArfWifiRemoteStation *station = new ArfWifiRemoteStation ();
|
||||
|
||||
station->m_successThreshold = m_successThreshold;
|
||||
@@ -89,6 +92,7 @@ ArfWifiManager::DoCreateStation (void) const
|
||||
void
|
||||
ArfWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
}
|
||||
/**
|
||||
* It is important to realize that "recovery" mode starts after failure of
|
||||
@@ -102,6 +106,7 @@ ArfWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
|
||||
void
|
||||
ArfWifiManager::DoReportDataFailed (WifiRemoteStation *st)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st);
|
||||
ArfWifiRemoteStation *station = (ArfWifiRemoteStation *)st;
|
||||
station->m_timer++;
|
||||
station->m_failed++;
|
||||
@@ -142,15 +147,18 @@ void
|
||||
ArfWifiManager::DoReportRxOk (WifiRemoteStation *station,
|
||||
double rxSnr, WifiMode txMode)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station << rxSnr << txMode);
|
||||
}
|
||||
void ArfWifiManager::DoReportRtsOk (WifiRemoteStation *station,
|
||||
double ctsSnr, WifiMode ctsMode, double rtsSnr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station << ctsSnr << ctsMode << rtsSnr);
|
||||
NS_LOG_DEBUG ("station=" << station << " rts ok");
|
||||
}
|
||||
void ArfWifiManager::DoReportDataOk (WifiRemoteStation *st,
|
||||
double ackSnr, WifiMode ackMode, double dataSnr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << ackSnr << ackMode << dataSnr);
|
||||
ArfWifiRemoteStation *station = (ArfWifiRemoteStation *) st;
|
||||
station->m_timer++;
|
||||
station->m_success++;
|
||||
@@ -172,21 +180,25 @@ void ArfWifiManager::DoReportDataOk (WifiRemoteStation *st,
|
||||
void
|
||||
ArfWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
}
|
||||
void
|
||||
ArfWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
}
|
||||
|
||||
WifiMode
|
||||
ArfWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << size);
|
||||
ArfWifiRemoteStation *station = (ArfWifiRemoteStation *) st;
|
||||
return GetSupported (station, station->m_rate);
|
||||
}
|
||||
WifiMode
|
||||
ArfWifiManager::DoGetRtsMode (WifiRemoteStation *st)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st);
|
||||
// XXX: we could/should implement the Arf algorithm for
|
||||
// RTS only by picking a single rate within the BasicRateSet.
|
||||
ArfWifiRemoteStation *station = (ArfWifiRemoteStation *) st;
|
||||
@@ -196,6 +208,7 @@ ArfWifiManager::DoGetRtsMode (WifiRemoteStation *st)
|
||||
bool
|
||||
ArfWifiManager::IsLowLatency (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
* Author: Mirko Banchi <mk.banchi@gmail.com>
|
||||
*/
|
||||
#include "block-ack-agreement.h"
|
||||
#include "ns3/log.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("BlockAckAgreement");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -26,6 +29,7 @@ BlockAckAgreement::BlockAckAgreement ()
|
||||
m_blockAckPolicy (1),
|
||||
m_inactivityEvent ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
BlockAckAgreement::BlockAckAgreement (Mac48Address peer, uint8_t tid)
|
||||
@@ -33,18 +37,21 @@ BlockAckAgreement::BlockAckAgreement (Mac48Address peer, uint8_t tid)
|
||||
m_blockAckPolicy (1),
|
||||
m_inactivityEvent ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this << peer << static_cast<uint32_t> (tid));
|
||||
m_tid = tid;
|
||||
m_peer = peer;
|
||||
}
|
||||
|
||||
BlockAckAgreement::~BlockAckAgreement ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_inactivityEvent.Cancel ();
|
||||
}
|
||||
|
||||
void
|
||||
BlockAckAgreement::SetBufferSize (uint16_t bufferSize)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << bufferSize);
|
||||
NS_ASSERT (bufferSize <= 1024);
|
||||
NS_ASSERT (bufferSize % 16 == 0);
|
||||
m_bufferSize = bufferSize;
|
||||
@@ -52,69 +59,82 @@ BlockAckAgreement::SetBufferSize (uint16_t bufferSize)
|
||||
void
|
||||
BlockAckAgreement::SetTimeout (uint16_t timeout)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << timeout);
|
||||
m_timeout = timeout;
|
||||
}
|
||||
void
|
||||
BlockAckAgreement::SetStartingSequence (uint16_t seq)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << seq);
|
||||
NS_ASSERT (seq < 4096);
|
||||
m_startingSeq = seq;
|
||||
}
|
||||
void
|
||||
BlockAckAgreement::SetImmediateBlockAck (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_blockAckPolicy = 1;
|
||||
}
|
||||
void
|
||||
BlockAckAgreement::SetDelayedBlockAck (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_blockAckPolicy = 0;
|
||||
}
|
||||
void
|
||||
BlockAckAgreement::SetAmsduSupport (bool supported)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << supported);
|
||||
m_amsduSupported = supported;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
BlockAckAgreement::GetTid (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_tid;
|
||||
}
|
||||
Mac48Address
|
||||
BlockAckAgreement::GetPeer (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_peer;
|
||||
}
|
||||
uint16_t
|
||||
BlockAckAgreement::GetBufferSize (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_bufferSize;
|
||||
}
|
||||
uint16_t
|
||||
BlockAckAgreement::GetTimeout (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_timeout;
|
||||
}
|
||||
uint16_t
|
||||
BlockAckAgreement::GetStartingSequence (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_startingSeq;
|
||||
}
|
||||
uint16_t
|
||||
BlockAckAgreement::GetStartingSequenceControl (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
uint16_t seqControl = (m_startingSeq << 4) | 0xfff0;
|
||||
return seqControl;
|
||||
}
|
||||
bool
|
||||
BlockAckAgreement::IsImmediateBlockAck (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return (m_blockAckPolicy == 1);
|
||||
}
|
||||
bool
|
||||
BlockAckAgreement::IsAmsduSupported (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return (m_amsduSupported == 1) ? true : false;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,14 +21,18 @@
|
||||
#include "ctrl-headers.h"
|
||||
#include "wifi-mac-header.h"
|
||||
#include "qos-utils.h"
|
||||
#include "ns3/log.h"
|
||||
|
||||
#define WINSIZE_ASSERT NS_ASSERT ((m_winEnd - m_winStart + 4096) % 4096 == m_winSize - 1)
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("BlockAckCache");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
void
|
||||
BlockAckCache::Init (uint16_t winStart, uint16_t winSize)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << winStart << winSize);
|
||||
m_winStart = winStart;
|
||||
m_winSize = winSize <= 64 ? winSize : 64;
|
||||
m_winEnd = (m_winStart + m_winSize - 1) % 4096;
|
||||
@@ -38,6 +42,7 @@ BlockAckCache::Init (uint16_t winStart, uint16_t winSize)
|
||||
void
|
||||
BlockAckCache::UpdateWithMpdu (const WifiMacHeader *hdr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << hdr);
|
||||
uint16_t seqNumber = hdr->GetSequenceNumber ();
|
||||
if (!QosUtilsIsOldPacket (m_winStart, seqNumber))
|
||||
{
|
||||
@@ -60,6 +65,7 @@ BlockAckCache::UpdateWithMpdu (const WifiMacHeader *hdr)
|
||||
void
|
||||
BlockAckCache::UpdateWithBlockAckReq (uint16_t startingSeq)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << startingSeq);
|
||||
if (!QosUtilsIsOldPacket (m_winStart, startingSeq))
|
||||
{
|
||||
if (IsInWindow (startingSeq))
|
||||
@@ -88,6 +94,7 @@ BlockAckCache::UpdateWithBlockAckReq (uint16_t startingSeq)
|
||||
void
|
||||
BlockAckCache::ResetPortionOfBitmap (uint16_t start, uint16_t end)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << start << end);
|
||||
uint32_t i = start;
|
||||
for (; i != end; i = (i + 1) % 4096)
|
||||
{
|
||||
@@ -99,12 +106,14 @@ BlockAckCache::ResetPortionOfBitmap (uint16_t start, uint16_t end)
|
||||
bool
|
||||
BlockAckCache::IsInWindow (uint16_t seq)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << seq);
|
||||
return ((seq - m_winStart + 4096) % 4096) < m_winSize;
|
||||
}
|
||||
|
||||
void
|
||||
BlockAckCache::FillBlockAckBitmap (CtrlBAckResponseHeader *blockAckHeader)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << blockAckHeader);
|
||||
if (blockAckHeader->IsBasic ())
|
||||
{
|
||||
NS_FATAL_ERROR ("Basic block ack is only partially implemented.");
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace ns3 {
|
||||
|
||||
BlockAckManager::Item::Item ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
BlockAckManager::Item::Item (Ptr<const Packet> packet, const WifiMacHeader &hdr, Time tStamp)
|
||||
@@ -44,10 +45,12 @@ BlockAckManager::Item::Item (Ptr<const Packet> packet, const WifiMacHeader &hdr,
|
||||
hdr (hdr),
|
||||
timestamp (tStamp)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << packet << hdr << tStamp);
|
||||
}
|
||||
|
||||
Bar::Bar ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
Bar::Bar (Ptr<const Packet> bar, Mac48Address recipient, uint8_t tid, bool immediate)
|
||||
@@ -56,14 +59,17 @@ Bar::Bar (Ptr<const Packet> bar, Mac48Address recipient, uint8_t tid, bool immed
|
||||
tid (tid),
|
||||
immediate (immediate)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << bar << recipient << static_cast<uint32_t> (tid) << immediate);
|
||||
}
|
||||
|
||||
BlockAckManager::BlockAckManager ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
BlockAckManager::~BlockAckManager ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_queue = 0;
|
||||
m_agreements.clear ();
|
||||
m_retryPackets.clear ();
|
||||
@@ -72,6 +78,7 @@ BlockAckManager::~BlockAckManager ()
|
||||
bool
|
||||
BlockAckManager::ExistsAgreement (Mac48Address recipient, uint8_t tid) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << recipient << static_cast<uint32_t> (tid));
|
||||
return (m_agreements.find (std::make_pair (recipient, tid)) != m_agreements.end ());
|
||||
}
|
||||
|
||||
@@ -79,6 +86,7 @@ bool
|
||||
BlockAckManager::ExistsAgreementInState (Mac48Address recipient, uint8_t tid,
|
||||
enum OriginatorBlockAckAgreement::State state) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << recipient << static_cast<uint32_t> (tid) << state);
|
||||
AgreementsCI it;
|
||||
it = m_agreements.find (std::make_pair (recipient, tid));
|
||||
if (it != m_agreements.end ())
|
||||
@@ -103,6 +111,7 @@ BlockAckManager::ExistsAgreementInState (Mac48Address recipient, uint8_t tid,
|
||||
void
|
||||
BlockAckManager::CreateAgreement (const MgtAddBaRequestHeader *reqHdr, Mac48Address recipient)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << reqHdr << recipient);
|
||||
std::pair<Mac48Address, uint8_t> key (recipient, reqHdr->GetTid ());
|
||||
OriginatorBlockAckAgreement agreement (recipient, reqHdr->GetTid ());
|
||||
agreement.SetStartingSequence (reqHdr->GetStartingSequence ());
|
||||
@@ -129,6 +138,7 @@ BlockAckManager::CreateAgreement (const MgtAddBaRequestHeader *reqHdr, Mac48Addr
|
||||
void
|
||||
BlockAckManager::DestroyAgreement (Mac48Address recipient, uint8_t tid)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << recipient << static_cast<uint32_t> (tid));
|
||||
AgreementsI it = m_agreements.find (std::make_pair (recipient, tid));
|
||||
if (it != m_agreements.end ())
|
||||
{
|
||||
@@ -162,6 +172,7 @@ BlockAckManager::DestroyAgreement (Mac48Address recipient, uint8_t tid)
|
||||
void
|
||||
BlockAckManager::UpdateAgreement (const MgtAddBaResponseHeader *respHdr, Mac48Address recipient)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << respHdr << recipient);
|
||||
uint8_t tid = respHdr->GetTid ();
|
||||
AgreementsI it = m_agreements.find (std::make_pair (recipient, tid));
|
||||
if (it != m_agreements.end ())
|
||||
@@ -194,7 +205,7 @@ BlockAckManager::UpdateAgreement (const MgtAddBaResponseHeader *respHdr, Mac48Ad
|
||||
void
|
||||
BlockAckManager::StorePacket (Ptr<const Packet> packet, const WifiMacHeader &hdr, Time tStamp)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_LOG_FUNCTION (this << packet << hdr << tStamp);
|
||||
NS_ASSERT (hdr.IsQosData ());
|
||||
|
||||
uint8_t tid = hdr.GetQosTid ();
|
||||
@@ -209,7 +220,7 @@ BlockAckManager::StorePacket (Ptr<const Packet> packet, const WifiMacHeader &hdr
|
||||
Ptr<const Packet>
|
||||
BlockAckManager::GetNextPacket (WifiMacHeader &hdr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_LOG_FUNCTION (this << &hdr);
|
||||
Ptr<const Packet> packet = 0;
|
||||
if (m_retryPackets.size () > 0)
|
||||
{
|
||||
@@ -248,6 +259,7 @@ BlockAckManager::GetNextPacket (WifiMacHeader &hdr)
|
||||
bool
|
||||
BlockAckManager::HasBar (struct Bar &bar)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &bar);
|
||||
if (m_bars.size () > 0)
|
||||
{
|
||||
bar = m_bars.front ();
|
||||
@@ -260,12 +272,14 @@ BlockAckManager::HasBar (struct Bar &bar)
|
||||
bool
|
||||
BlockAckManager::HasPackets (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return (m_retryPackets.size () > 0 || m_bars.size () > 0);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
BlockAckManager::GetNBufferedPackets (Mac48Address recipient, uint8_t tid) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << recipient << static_cast<uint32_t> (tid));
|
||||
uint32_t nPackets = 0;
|
||||
if (ExistsAgreement (recipient, tid))
|
||||
{
|
||||
@@ -290,6 +304,7 @@ BlockAckManager::GetNBufferedPackets (Mac48Address recipient, uint8_t tid) const
|
||||
uint32_t
|
||||
BlockAckManager::GetNRetryNeededPackets (Mac48Address recipient, uint8_t tid) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << recipient << static_cast<uint32_t> (tid));
|
||||
uint32_t nPackets = 0;
|
||||
uint16_t currentSeq = 0;
|
||||
if (ExistsAgreement (recipient, tid))
|
||||
@@ -315,13 +330,14 @@ BlockAckManager::GetNRetryNeededPackets (Mac48Address recipient, uint8_t tid) co
|
||||
void
|
||||
BlockAckManager::SetBlockAckThreshold (uint8_t nPackets)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << static_cast<uint32_t> (nPackets));
|
||||
m_blockAckThreshold = nPackets;
|
||||
}
|
||||
|
||||
void
|
||||
BlockAckManager::NotifyGotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_LOG_FUNCTION (this << blockAck << recipient);
|
||||
uint16_t sequenceFirstLost = 0;
|
||||
if (!blockAck->IsMultiTid ())
|
||||
{
|
||||
@@ -410,6 +426,7 @@ BlockAckManager::NotifyGotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac4
|
||||
void
|
||||
BlockAckManager::SetBlockAckType (enum BlockAckType bAckType)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << bAckType);
|
||||
m_blockAckType = bAckType;
|
||||
}
|
||||
|
||||
@@ -421,7 +438,7 @@ BlockAckManager::ScheduleBlockAckReqIfNeeded (Mac48Address recipient, uint8_t ti
|
||||
this number could be incorrect. In fact is possible that a block ack agreement exists for n
|
||||
packets but some of these packets are dropped due to MSDU lifetime expiration.
|
||||
*/
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_LOG_FUNCTION (this << recipient << static_cast<uint32_t> (tid));
|
||||
AgreementsI it = m_agreements.find (std::make_pair (recipient, tid));
|
||||
NS_ASSERT (it != m_agreements.end ());
|
||||
|
||||
@@ -457,13 +474,14 @@ BlockAckManager::ScheduleBlockAckReqIfNeeded (Mac48Address recipient, uint8_t ti
|
||||
void
|
||||
BlockAckManager::InactivityTimeout (Mac48Address recipient, uint8_t tid)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << recipient << static_cast<uint32_t> (tid));
|
||||
m_blockAckInactivityTimeout (recipient, tid, true);
|
||||
}
|
||||
|
||||
void
|
||||
BlockAckManager::NotifyAgreementEstablished (Mac48Address recipient, uint8_t tid, uint16_t startingSeq)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_LOG_FUNCTION (this << recipient << static_cast<uint32_t> (tid) << startingSeq);
|
||||
AgreementsI it = m_agreements.find (std::make_pair (recipient, tid));
|
||||
NS_ASSERT (it != m_agreements.end ());
|
||||
|
||||
@@ -474,7 +492,7 @@ BlockAckManager::NotifyAgreementEstablished (Mac48Address recipient, uint8_t tid
|
||||
void
|
||||
BlockAckManager::NotifyAgreementUnsuccessful (Mac48Address recipient, uint8_t tid)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_LOG_FUNCTION (this << recipient << static_cast<uint32_t> (tid));
|
||||
AgreementsI it = m_agreements.find (std::make_pair (recipient, tid));
|
||||
NS_ASSERT (it != m_agreements.end ());
|
||||
if (it != m_agreements.end ())
|
||||
@@ -486,7 +504,7 @@ BlockAckManager::NotifyAgreementUnsuccessful (Mac48Address recipient, uint8_t ti
|
||||
void
|
||||
BlockAckManager::NotifyMpduTransmission (Mac48Address recipient, uint8_t tid, uint16_t nextSeqNumber)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_LOG_FUNCTION (this << recipient << static_cast<uint32_t> (tid) << nextSeqNumber);
|
||||
Ptr<Packet> bar = 0;
|
||||
AgreementsI it = m_agreements.find (std::make_pair (recipient, tid));
|
||||
NS_ASSERT (it != m_agreements.end ());
|
||||
@@ -512,13 +530,14 @@ BlockAckManager::NotifyMpduTransmission (Mac48Address recipient, uint8_t tid, ui
|
||||
void
|
||||
BlockAckManager::SetQueue (Ptr<WifiMacQueue> queue)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << queue);
|
||||
m_queue = queue;
|
||||
}
|
||||
|
||||
bool
|
||||
BlockAckManager::SwitchToBlockAckIfNeeded (Mac48Address recipient, uint8_t tid, uint16_t startingSeq)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_LOG_FUNCTION (this << recipient << static_cast<uint32_t> (tid) << startingSeq);
|
||||
NS_ASSERT (!ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::PENDING));
|
||||
if (!ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::UNSUCCESSFUL) && ExistsAgreement (recipient, tid))
|
||||
{
|
||||
@@ -536,13 +555,14 @@ BlockAckManager::SwitchToBlockAckIfNeeded (Mac48Address recipient, uint8_t tid,
|
||||
void
|
||||
BlockAckManager::TearDownBlockAck (Mac48Address recipient, uint8_t tid)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_LOG_FUNCTION (this << recipient << static_cast<uint32_t> (tid));
|
||||
DestroyAgreement (recipient, tid);
|
||||
}
|
||||
|
||||
bool
|
||||
BlockAckManager::HasOtherFragments (uint16_t sequenceNumber) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << sequenceNumber);
|
||||
bool retVal = false;
|
||||
if (m_retryPackets.size () > 0)
|
||||
{
|
||||
@@ -558,6 +578,7 @@ BlockAckManager::HasOtherFragments (uint16_t sequenceNumber) const
|
||||
uint32_t
|
||||
BlockAckManager::GetNextPacketSize (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
uint32_t size = 0;
|
||||
if (m_retryPackets.size () > 0)
|
||||
{
|
||||
@@ -570,6 +591,7 @@ BlockAckManager::GetNextPacketSize (void) const
|
||||
void
|
||||
BlockAckManager::CleanupBuffers (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
for (AgreementsI j = m_agreements.begin (); j != m_agreements.end (); j++)
|
||||
{
|
||||
if (j->second.second.empty ())
|
||||
@@ -611,37 +633,42 @@ BlockAckManager::CleanupBuffers (void)
|
||||
void
|
||||
BlockAckManager::SetMaxPacketDelay (Time maxDelay)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_LOG_FUNCTION (this << maxDelay);
|
||||
m_maxDelay = maxDelay;
|
||||
}
|
||||
|
||||
void
|
||||
BlockAckManager::SetBlockAckInactivityCallback (Callback<void, Mac48Address, uint8_t, bool> callback)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &callback);
|
||||
m_blockAckInactivityTimeout = callback;
|
||||
}
|
||||
|
||||
void
|
||||
BlockAckManager::SetBlockDestinationCallback (Callback<void, Mac48Address, uint8_t> callback)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &callback);
|
||||
m_blockPackets = callback;
|
||||
}
|
||||
|
||||
void
|
||||
BlockAckManager::SetUnblockDestinationCallback (Callback<void, Mac48Address, uint8_t> callback)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &callback);
|
||||
m_unblockPackets = callback;
|
||||
}
|
||||
|
||||
void
|
||||
BlockAckManager::SetTxMiddle (MacTxMiddle* txMiddle)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << txMiddle);
|
||||
m_txMiddle = txMiddle;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
BlockAckManager::GetSeqNumOfNextRetryPacket (Mac48Address recipient, uint8_t tid) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << recipient << static_cast<uint32_t> (tid));
|
||||
std::list<PacketQueueI>::const_iterator it = m_retryPackets.begin ();
|
||||
while (it != m_retryPackets.end ())
|
||||
{
|
||||
|
||||
@@ -18,23 +18,29 @@
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
#include "capability-information.h"
|
||||
#include "ns3/log.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("CapabilityInformation");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
CapabilityInformation::CapabilityInformation ()
|
||||
: m_capability (0)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
void
|
||||
CapabilityInformation::SetEss (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
Set (0);
|
||||
Clear (1);
|
||||
}
|
||||
void
|
||||
CapabilityInformation::SetIbss (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
Clear (0);
|
||||
Set (1);
|
||||
}
|
||||
@@ -42,17 +48,20 @@ CapabilityInformation::SetIbss (void)
|
||||
bool
|
||||
CapabilityInformation::IsEss (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return Is (0);
|
||||
}
|
||||
bool
|
||||
CapabilityInformation::IsIbss (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return Is (1);
|
||||
}
|
||||
|
||||
void
|
||||
CapabilityInformation::Set (uint8_t n)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << static_cast<uint32_t> (n));
|
||||
uint32_t mask = 1 << n;
|
||||
m_capability |= mask;
|
||||
}
|
||||
@@ -60,6 +69,7 @@ CapabilityInformation::Set (uint8_t n)
|
||||
void
|
||||
CapabilityInformation::Clear (uint8_t n)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << static_cast<uint32_t> (n));
|
||||
uint32_t mask = 1 << n;
|
||||
m_capability &= ~mask;
|
||||
}
|
||||
@@ -67,6 +77,7 @@ CapabilityInformation::Clear (uint8_t n)
|
||||
bool
|
||||
CapabilityInformation::Is (uint8_t n) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << static_cast<uint32_t> (n));
|
||||
uint32_t mask = 1 << n;
|
||||
return (m_capability & mask) == mask;
|
||||
}
|
||||
@@ -75,17 +86,20 @@ CapabilityInformation::Is (uint8_t n) const
|
||||
uint32_t
|
||||
CapabilityInformation::GetSerializedSize (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return 2;
|
||||
}
|
||||
Buffer::Iterator
|
||||
CapabilityInformation::Serialize (Buffer::Iterator start) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &start);
|
||||
start.WriteHtolsbU16 (m_capability);
|
||||
return start;
|
||||
}
|
||||
Buffer::Iterator
|
||||
CapabilityInformation::Deserialize (Buffer::Iterator start)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &start);
|
||||
m_capability = start.ReadLsbtohU16 ();
|
||||
return start;
|
||||
}
|
||||
|
||||
@@ -73,14 +73,17 @@ CaraWifiManager::GetTypeId (void)
|
||||
CaraWifiManager::CaraWifiManager ()
|
||||
: WifiRemoteStationManager ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
CaraWifiManager::~CaraWifiManager ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
WifiRemoteStation *
|
||||
CaraWifiManager::DoCreateStation (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
CaraWifiRemoteStation *station = new CaraWifiRemoteStation ();
|
||||
station->m_rate = 0;
|
||||
station->m_success = 0;
|
||||
@@ -92,13 +95,14 @@ CaraWifiManager::DoCreateStation (void) const
|
||||
void
|
||||
CaraWifiManager::DoReportRtsFailed (WifiRemoteStation *st)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st);
|
||||
}
|
||||
|
||||
void
|
||||
CaraWifiManager::DoReportDataFailed (WifiRemoteStation *st)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st);
|
||||
CaraWifiRemoteStation *station = (CaraWifiRemoteStation *) st;
|
||||
NS_LOG_FUNCTION (station);
|
||||
station->m_timer++;
|
||||
station->m_failed++;
|
||||
station->m_success = 0;
|
||||
@@ -117,17 +121,20 @@ void
|
||||
CaraWifiManager::DoReportRxOk (WifiRemoteStation *st,
|
||||
double rxSnr, WifiMode txMode)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << rxSnr << txMode);
|
||||
}
|
||||
void
|
||||
CaraWifiManager::DoReportRtsOk (WifiRemoteStation *st,
|
||||
double ctsSnr, WifiMode ctsMode, double rtsSnr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << ctsSnr << ctsMode << rtsSnr);
|
||||
NS_LOG_DEBUG ("self=" << st << " rts ok");
|
||||
}
|
||||
void
|
||||
CaraWifiManager::DoReportDataOk (WifiRemoteStation *st,
|
||||
double ackSnr, WifiMode ackMode, double dataSnr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << ackSnr << ackMode << dataSnr);
|
||||
CaraWifiRemoteStation *station = (CaraWifiRemoteStation *) st;
|
||||
station->m_timer++;
|
||||
station->m_success++;
|
||||
@@ -148,22 +155,26 @@ CaraWifiManager::DoReportDataOk (WifiRemoteStation *st,
|
||||
void
|
||||
CaraWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *st)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st);
|
||||
}
|
||||
void
|
||||
CaraWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st);
|
||||
}
|
||||
|
||||
WifiMode
|
||||
CaraWifiManager::DoGetDataMode (WifiRemoteStation *st,
|
||||
uint32_t size)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << size);
|
||||
CaraWifiRemoteStation *station = (CaraWifiRemoteStation *) st;
|
||||
return GetSupported (station, station->m_rate);
|
||||
}
|
||||
WifiMode
|
||||
CaraWifiManager::DoGetRtsMode (WifiRemoteStation *st)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st);
|
||||
// XXX: we could/should implement the Arf algorithm for
|
||||
// RTS only by picking a single rate within the BasicRateSet.
|
||||
return GetSupported (st, 0);
|
||||
@@ -173,6 +184,7 @@ bool
|
||||
CaraWifiManager::DoNeedRts (WifiRemoteStation *st,
|
||||
Ptr<const Packet> packet, bool normally)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << normally);
|
||||
CaraWifiRemoteStation *station = (CaraWifiRemoteStation *) st;
|
||||
return normally || station->m_failed >= m_probeThreshold;
|
||||
}
|
||||
@@ -180,6 +192,7 @@ CaraWifiManager::DoNeedRts (WifiRemoteStation *st,
|
||||
bool
|
||||
CaraWifiManager::IsLowLatency (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/assert.h"
|
||||
#include "ns3/log.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("ConstantRateWifiManager");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -47,15 +50,18 @@ ConstantRateWifiManager::GetTypeId (void)
|
||||
|
||||
ConstantRateWifiManager::ConstantRateWifiManager ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
ConstantRateWifiManager::~ConstantRateWifiManager ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
|
||||
WifiRemoteStation *
|
||||
ConstantRateWifiManager::DoCreateStation (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
WifiRemoteStation *station = new WifiRemoteStation ();
|
||||
return station;
|
||||
}
|
||||
@@ -65,48 +71,58 @@ void
|
||||
ConstantRateWifiManager::DoReportRxOk (WifiRemoteStation *station,
|
||||
double rxSnr, WifiMode txMode)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station << rxSnr << txMode);
|
||||
}
|
||||
void
|
||||
ConstantRateWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
}
|
||||
void
|
||||
ConstantRateWifiManager::DoReportDataFailed (WifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
}
|
||||
void
|
||||
ConstantRateWifiManager::DoReportRtsOk (WifiRemoteStation *st,
|
||||
double ctsSnr, WifiMode ctsMode, double rtsSnr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << ctsSnr << ctsMode << rtsSnr);
|
||||
}
|
||||
void
|
||||
ConstantRateWifiManager::DoReportDataOk (WifiRemoteStation *st,
|
||||
double ackSnr, WifiMode ackMode, double dataSnr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << ackSnr << ackMode << dataSnr);
|
||||
}
|
||||
void
|
||||
ConstantRateWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
}
|
||||
void
|
||||
ConstantRateWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << station);
|
||||
}
|
||||
|
||||
WifiMode
|
||||
ConstantRateWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << size);
|
||||
return m_dataMode;
|
||||
}
|
||||
WifiMode
|
||||
ConstantRateWifiManager::DoGetRtsMode (WifiRemoteStation *st)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st);
|
||||
return m_ctlMode;
|
||||
}
|
||||
|
||||
bool
|
||||
ConstantRateWifiManager::IsLowLatency (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,12 @@
|
||||
* Author: Mirko Banchi <mk.banchi@gmail.com>
|
||||
*/
|
||||
#include "ns3/fatal-error.h"
|
||||
#include "ns3/log.h"
|
||||
|
||||
#include "ctrl-headers.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("CtrlHeaders");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
/***********************************
|
||||
@@ -34,15 +37,18 @@ CtrlBAckRequestHeader::CtrlBAckRequestHeader ()
|
||||
m_multiTid (false),
|
||||
m_compressed (false)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
CtrlBAckRequestHeader::~CtrlBAckRequestHeader ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
TypeId
|
||||
CtrlBAckRequestHeader::GetTypeId (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
static TypeId tid = TypeId ("ns3::CtrlBAckRequestHeader")
|
||||
.SetParent<Header> ()
|
||||
.AddConstructor<CtrlBAckRequestHeader> ()
|
||||
@@ -53,18 +59,21 @@ CtrlBAckRequestHeader::GetTypeId (void)
|
||||
TypeId
|
||||
CtrlBAckRequestHeader::GetInstanceTypeId (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return GetTypeId ();
|
||||
}
|
||||
|
||||
void
|
||||
CtrlBAckRequestHeader::Print (std::ostream &os) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &os);
|
||||
os << "TID_INFO=" << m_tidInfo << ", StartingSeq=" << std::hex << m_startingSeq;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
CtrlBAckRequestHeader::GetSerializedSize () const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
uint32_t size = 0;
|
||||
size += 2; //Bar control
|
||||
if (!m_multiTid)
|
||||
@@ -88,6 +97,7 @@ CtrlBAckRequestHeader::GetSerializedSize () const
|
||||
void
|
||||
CtrlBAckRequestHeader::Serialize (Buffer::Iterator start) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &start);
|
||||
Buffer::Iterator i = start;
|
||||
i.WriteHtolsbU16 (GetBarControl ());
|
||||
if (!m_multiTid)
|
||||
@@ -110,6 +120,7 @@ CtrlBAckRequestHeader::Serialize (Buffer::Iterator start) const
|
||||
uint32_t
|
||||
CtrlBAckRequestHeader::Deserialize (Buffer::Iterator start)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &start);
|
||||
Buffer::Iterator i = start;
|
||||
SetBarControl (i.ReadLsbtohU16 ());
|
||||
if (!m_multiTid)
|
||||
@@ -133,6 +144,7 @@ CtrlBAckRequestHeader::Deserialize (Buffer::Iterator start)
|
||||
uint16_t
|
||||
CtrlBAckRequestHeader::GetBarControl (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
uint16_t res = 0;
|
||||
if (m_barAckPolicy)
|
||||
{
|
||||
@@ -153,6 +165,7 @@ CtrlBAckRequestHeader::GetBarControl (void) const
|
||||
void
|
||||
CtrlBAckRequestHeader::SetBarControl (uint16_t bar)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << bar);
|
||||
m_barAckPolicy = ((bar & 0x01) == 1) ? true : false;
|
||||
m_multiTid = (((bar >> 1) & 0x01) == 1) ? true : false;
|
||||
m_compressed = (((bar >> 2) & 0x01) == 1) ? true : false;
|
||||
@@ -162,24 +175,28 @@ CtrlBAckRequestHeader::SetBarControl (uint16_t bar)
|
||||
uint16_t
|
||||
CtrlBAckRequestHeader::GetStartingSequenceControl (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return (m_startingSeq << 4) & 0xfff0;
|
||||
}
|
||||
|
||||
void
|
||||
CtrlBAckRequestHeader::SetStartingSequenceControl (uint16_t seqControl)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << seqControl);
|
||||
m_startingSeq = (seqControl >> 4) & 0x0fff;
|
||||
}
|
||||
|
||||
void
|
||||
CtrlBAckRequestHeader::SetHtImmediateAck (bool immediateAck)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << immediateAck);
|
||||
m_barAckPolicy = immediateAck;
|
||||
}
|
||||
|
||||
void
|
||||
CtrlBAckRequestHeader::SetType (enum BlockAckType type)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << type);
|
||||
switch (type)
|
||||
{
|
||||
case BASIC_BLOCK_ACK:
|
||||
@@ -203,24 +220,28 @@ CtrlBAckRequestHeader::SetType (enum BlockAckType type)
|
||||
void
|
||||
CtrlBAckRequestHeader::SetTidInfo (uint8_t tid)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << static_cast<uint32_t> (tid));
|
||||
m_tidInfo = static_cast<uint16_t> (tid);
|
||||
}
|
||||
|
||||
void
|
||||
CtrlBAckRequestHeader::SetStartingSequence (uint16_t seq)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << seq);
|
||||
m_startingSeq = seq;
|
||||
}
|
||||
|
||||
bool
|
||||
CtrlBAckRequestHeader::MustSendHtImmediateAck (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_barAckPolicy;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
CtrlBAckRequestHeader::GetTidInfo (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
uint8_t tid = static_cast<uint8_t> (m_tidInfo);
|
||||
return tid;
|
||||
}
|
||||
@@ -228,24 +249,28 @@ CtrlBAckRequestHeader::GetTidInfo (void) const
|
||||
uint16_t
|
||||
CtrlBAckRequestHeader::GetStartingSequence (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_startingSeq;
|
||||
}
|
||||
|
||||
bool
|
||||
CtrlBAckRequestHeader::IsBasic (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return (!m_multiTid && !m_compressed) ? true : false;
|
||||
}
|
||||
|
||||
bool
|
||||
CtrlBAckRequestHeader::IsCompressed (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return (!m_multiTid && m_compressed) ? true : false;
|
||||
}
|
||||
|
||||
bool
|
||||
CtrlBAckRequestHeader::IsMultiTid (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return (m_multiTid && m_compressed) ? true : false;
|
||||
}
|
||||
|
||||
@@ -260,11 +285,13 @@ CtrlBAckResponseHeader::CtrlBAckResponseHeader ()
|
||||
m_multiTid (false),
|
||||
m_compressed (false)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
memset (&bitmap, 0, sizeof (bitmap));
|
||||
}
|
||||
|
||||
CtrlBAckResponseHeader::~CtrlBAckResponseHeader ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
TypeId
|
||||
@@ -286,12 +313,14 @@ CtrlBAckResponseHeader::GetInstanceTypeId (void) const
|
||||
void
|
||||
CtrlBAckResponseHeader::Print (std::ostream &os) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &os);
|
||||
os << "TID_INFO=" << m_tidInfo << ", StartingSeq=" << std::hex << m_startingSeq;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
CtrlBAckResponseHeader::GetSerializedSize (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
uint32_t size = 0;
|
||||
size += 2; //Bar control
|
||||
if (!m_multiTid)
|
||||
@@ -322,6 +351,7 @@ CtrlBAckResponseHeader::GetSerializedSize (void) const
|
||||
void
|
||||
CtrlBAckResponseHeader::Serialize (Buffer::Iterator start) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &start);
|
||||
Buffer::Iterator i = start;
|
||||
i.WriteHtolsbU16 (GetBaControl ());
|
||||
if (!m_multiTid)
|
||||
@@ -345,6 +375,7 @@ CtrlBAckResponseHeader::Serialize (Buffer::Iterator start) const
|
||||
uint32_t
|
||||
CtrlBAckResponseHeader::Deserialize (Buffer::Iterator start)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &start);
|
||||
Buffer::Iterator i = start;
|
||||
SetBaControl (i.ReadLsbtohU16 ());
|
||||
if (!m_multiTid)
|
||||
@@ -369,12 +400,14 @@ CtrlBAckResponseHeader::Deserialize (Buffer::Iterator start)
|
||||
void
|
||||
CtrlBAckResponseHeader::SetHtImmediateAck (bool immediateAck)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << immediateAck);
|
||||
m_baAckPolicy = immediateAck;
|
||||
}
|
||||
|
||||
void
|
||||
CtrlBAckResponseHeader::SetType (enum BlockAckType type)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << type);
|
||||
switch (type)
|
||||
{
|
||||
case BASIC_BLOCK_ACK:
|
||||
@@ -398,24 +431,28 @@ CtrlBAckResponseHeader::SetType (enum BlockAckType type)
|
||||
void
|
||||
CtrlBAckResponseHeader::SetTidInfo (uint8_t tid)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << static_cast<uint32_t> (tid));
|
||||
m_tidInfo = static_cast<uint16_t> (tid);
|
||||
}
|
||||
|
||||
void
|
||||
CtrlBAckResponseHeader::SetStartingSequence (uint16_t seq)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << seq);
|
||||
m_startingSeq = seq;
|
||||
}
|
||||
|
||||
bool
|
||||
CtrlBAckResponseHeader::MustSendHtImmediateAck (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return (m_baAckPolicy) ? true : false;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
CtrlBAckResponseHeader::GetTidInfo (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
uint8_t tid = static_cast<uint8_t> (m_tidInfo);
|
||||
return tid;
|
||||
}
|
||||
@@ -423,30 +460,35 @@ CtrlBAckResponseHeader::GetTidInfo (void) const
|
||||
uint16_t
|
||||
CtrlBAckResponseHeader::GetStartingSequence (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_startingSeq;
|
||||
}
|
||||
|
||||
bool
|
||||
CtrlBAckResponseHeader::IsBasic (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return (!m_multiTid && !m_compressed) ? true : false;
|
||||
}
|
||||
|
||||
bool
|
||||
CtrlBAckResponseHeader::IsCompressed (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return (!m_multiTid && m_compressed) ? true : false;
|
||||
}
|
||||
|
||||
bool
|
||||
CtrlBAckResponseHeader::IsMultiTid (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return (m_multiTid && m_compressed) ? true : false;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
CtrlBAckResponseHeader::GetBaControl (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
uint16_t res = 0;
|
||||
if (m_baAckPolicy)
|
||||
{
|
||||
@@ -467,6 +509,7 @@ CtrlBAckResponseHeader::GetBaControl (void) const
|
||||
void
|
||||
CtrlBAckResponseHeader::SetBaControl (uint16_t ba)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << ba);
|
||||
m_baAckPolicy = ((ba & 0x01) == 1) ? true : false;
|
||||
m_multiTid = (((ba >> 1) & 0x01) == 1) ? true : false;
|
||||
m_compressed = (((ba >> 2) & 0x01) == 1) ? true : false;
|
||||
@@ -476,18 +519,21 @@ CtrlBAckResponseHeader::SetBaControl (uint16_t ba)
|
||||
uint16_t
|
||||
CtrlBAckResponseHeader::GetStartingSequenceControl (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return (m_startingSeq << 4) & 0xfff0;
|
||||
}
|
||||
|
||||
void
|
||||
CtrlBAckResponseHeader::SetStartingSequenceControl (uint16_t seqControl)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << seqControl);
|
||||
m_startingSeq = (seqControl >> 4) & 0x0fff;
|
||||
}
|
||||
|
||||
Buffer::Iterator
|
||||
CtrlBAckResponseHeader::SerializeBitmap (Buffer::Iterator start) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &start);
|
||||
Buffer::Iterator i = start;
|
||||
if (!m_multiTid)
|
||||
{
|
||||
@@ -520,6 +566,7 @@ CtrlBAckResponseHeader::SerializeBitmap (Buffer::Iterator start) const
|
||||
Buffer::Iterator
|
||||
CtrlBAckResponseHeader::DeserializeBitmap (Buffer::Iterator start)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &start);
|
||||
Buffer::Iterator i = start;
|
||||
if (!m_multiTid)
|
||||
{
|
||||
@@ -552,6 +599,7 @@ CtrlBAckResponseHeader::DeserializeBitmap (Buffer::Iterator start)
|
||||
void
|
||||
CtrlBAckResponseHeader::SetReceivedPacket (uint16_t seq)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << seq);
|
||||
if (!IsInBitmap (seq))
|
||||
{
|
||||
return;
|
||||
@@ -585,6 +633,7 @@ CtrlBAckResponseHeader::SetReceivedPacket (uint16_t seq)
|
||||
void
|
||||
CtrlBAckResponseHeader::SetReceivedFragment (uint16_t seq, uint8_t frag)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << seq << static_cast<uint32_t> (frag));
|
||||
NS_ASSERT (frag < 16);
|
||||
if (!IsInBitmap (seq))
|
||||
{
|
||||
@@ -618,6 +667,7 @@ CtrlBAckResponseHeader::SetReceivedFragment (uint16_t seq, uint8_t frag)
|
||||
bool
|
||||
CtrlBAckResponseHeader::IsPacketReceived (uint16_t seq) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << seq);
|
||||
if (!IsInBitmap (seq))
|
||||
{
|
||||
return false;
|
||||
@@ -652,6 +702,7 @@ CtrlBAckResponseHeader::IsPacketReceived (uint16_t seq) const
|
||||
bool
|
||||
CtrlBAckResponseHeader::IsFragmentReceived (uint16_t seq, uint8_t frag) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << seq << static_cast<uint32_t> (frag));
|
||||
NS_ASSERT (frag < 16);
|
||||
if (!IsInBitmap (seq))
|
||||
{
|
||||
@@ -689,6 +740,7 @@ CtrlBAckResponseHeader::IsFragmentReceived (uint16_t seq, uint8_t frag) const
|
||||
uint8_t
|
||||
CtrlBAckResponseHeader::IndexInBitmap (uint16_t seq) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << seq);
|
||||
uint8_t index;
|
||||
if (seq >= m_startingSeq)
|
||||
{
|
||||
@@ -705,24 +757,28 @@ CtrlBAckResponseHeader::IndexInBitmap (uint16_t seq) const
|
||||
bool
|
||||
CtrlBAckResponseHeader::IsInBitmap (uint16_t seq) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << seq);
|
||||
return (seq - m_startingSeq + 4096) % 4096 < 64;
|
||||
}
|
||||
|
||||
const uint16_t*
|
||||
CtrlBAckResponseHeader::GetBitmap (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return bitmap.m_bitmap;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
CtrlBAckResponseHeader::GetCompressedBitmap (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return bitmap.m_compressedBitmap;
|
||||
}
|
||||
|
||||
void
|
||||
CtrlBAckResponseHeader::ResetBitmap (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
memset (&bitmap, 0, sizeof (bitmap));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user