--- a/src/wifi/helper/athstats-helper.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/helper/athstats-helper.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 CTTC
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -30,7 +30,7 @@
#include <fstream>
-NS_LOG_COMPONENT_DEFINE("Athstats");
+NS_LOG_COMPONENT_DEFINE ("Athstats");
namespace ns3 {
@@ -43,10 +43,10 @@
void
AthstatsHelper::EnableAthstats (std::string filename, uint32_t nodeid, uint32_t deviceid)
{
- Ptr<AthstatsWifiTraceSink> athstats = CreateObject<AthstatsWifiTraceSink> ();
+ Ptr<AthstatsWifiTraceSink> athstats = CreateObject<AthstatsWifiTraceSink> ();
std::ostringstream oss;
oss << filename
- << "_" << std::setfill ('0') << std::setw (3) << std::right << nodeid
+ << "_" << std::setfill ('0') << std::setw (3) << std::right << nodeid
<< "_" << std::setfill ('0') << std::setw (3) << std::right << deviceid;
athstats->Open (oss.str ());
@@ -75,7 +75,7 @@
}
-void
+void
AthstatsHelper::EnableAthstats (std::string filename, NetDeviceContainer d)
{
for (NetDeviceContainer::Iterator i = d.Begin (); i != d.End (); ++i)
@@ -107,7 +107,7 @@
NS_OBJECT_ENSURE_REGISTERED (AthstatsWifiTraceSink);
-TypeId
+TypeId
AthstatsWifiTraceSink::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::AthstatsWifiTraceSink")
@@ -115,23 +115,23 @@
.AddConstructor<AthstatsWifiTraceSink> ()
.AddAttribute ("Interval",
"Time interval between reports",
- TimeValue (Seconds(1.0)),
+ TimeValue (Seconds (1.0)),
MakeTimeAccessor (&AthstatsWifiTraceSink::m_interval),
MakeTimeChecker ())
- ;
+ ;
return tid;
}
AthstatsWifiTraceSink::AthstatsWifiTraceSink ()
: m_txCount (0),
- m_rxCount (0),
- m_shortRetryCount (0),
- m_longRetryCount (0),
- m_exceededRetryCount (0),
- m_phyRxOkCount (0),
- m_phyRxErrorCount (0),
- m_phyTxCount (0),
- m_writer (0)
+ m_rxCount (0),
+ m_shortRetryCount (0),
+ m_longRetryCount (0),
+ m_exceededRetryCount (0),
+ m_phyRxOkCount (0),
+ m_phyRxErrorCount (0),
+ m_phyTxCount (0),
+ m_writer (0)
{
Simulator::ScheduleNow (&AthstatsWifiTraceSink::WriteStats, this);
}
@@ -161,7 +161,7 @@
}
}
-void
+void
AthstatsWifiTraceSink::ResetCounters ()
{
m_txCount = 0;
@@ -177,14 +177,14 @@
void
AthstatsWifiTraceSink::DevTxTrace (std::string context, Ptr<const Packet> p)
{
- NS_LOG_FUNCTION (this << context <<p);
+ NS_LOG_FUNCTION (this << context << p);
++m_txCount;
}
void
AthstatsWifiTraceSink::DevRxTrace (std::string context, Ptr<const Packet> p)
{
- NS_LOG_FUNCTION (this << context <<p);
+ NS_LOG_FUNCTION (this << context << p);
++m_rxCount;
}
@@ -222,14 +222,14 @@
void
AthstatsWifiTraceSink::PhyRxOkTrace (std::string context, Ptr<const Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble)
{
- NS_LOG_FUNCTION (this << context <<packet<< " mode=" << mode << " snr=" << snr );
+ NS_LOG_FUNCTION (this << context << packet << " mode=" << mode << " snr=" << snr );
++m_phyRxOkCount;
}
void
AthstatsWifiTraceSink::PhyRxErrorTrace (std::string context, Ptr<const Packet> packet, double snr)
{
- NS_LOG_FUNCTION (this << context <<packet <<" snr=" << snr );
+ NS_LOG_FUNCTION (this << context << packet << " snr=" << snr );
++m_phyRxErrorCount;
}
@@ -278,24 +278,24 @@
// I know C strings are ugly but that's the quickest way to use exactly the same format as in madwifi
char str[200];
snprintf (str, 200, "%8u %8u %7u %7u %7u %6u %6u %6u %7u %4u %3uM\n",
- (unsigned int) m_txCount, // /proc/net/dev transmitted packets to which we should subract mgmt frames
- (unsigned int) m_rxCount, // /proc/net/dev received packets but subracts mgmt frames from it
- (unsigned int) 0, // ast_tx_altrate,
- (unsigned int) m_shortRetryCount, // ast_tx_shortretry,
- (unsigned int) m_longRetryCount, // ast_tx_longretry,
- (unsigned int) m_exceededRetryCount, // ast_tx_xretries,
- (unsigned int) m_phyRxErrorCount, // ast_rx_crcerr,
- (unsigned int) 0, // ast_rx_badcrypt,
- (unsigned int) 0, // ast_rx_phyerr,
- (unsigned int) 0, // ast_rx_rssi,
- (unsigned int) 0 // rate
- );
+ (unsigned int) m_txCount, // /proc/net/dev transmitted packets to which we should subract mgmt frames
+ (unsigned int) m_rxCount, // /proc/net/dev received packets but subracts mgmt frames from it
+ (unsigned int) 0, // ast_tx_altrate,
+ (unsigned int) m_shortRetryCount, // ast_tx_shortretry,
+ (unsigned int) m_longRetryCount, // ast_tx_longretry,
+ (unsigned int) m_exceededRetryCount, // ast_tx_xretries,
+ (unsigned int) m_phyRxErrorCount, // ast_rx_crcerr,
+ (unsigned int) 0, // ast_rx_badcrypt,
+ (unsigned int) 0, // ast_rx_phyerr,
+ (unsigned int) 0, // ast_rx_rssi,
+ (unsigned int) 0 // rate
+ );
if (m_writer)
{
-
+
*m_writer << str;
-
+
ResetCounters ();
Simulator::Schedule (m_interval, &AthstatsWifiTraceSink::WriteStats, this);
}
--- a/src/wifi/helper/athstats-helper.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/helper/athstats-helper.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 CTTC
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -21,7 +21,7 @@
#ifndef ATHSTATS_HELPER_H
#define ATHSTATS_HELPER_H
-#include<string>
+#include <string>
#include "ns3/object.h"
#include "ns3/attribute.h"
#include "ns3/object-factory.h"
@@ -40,7 +40,7 @@
/**
* @brief create AthstatsWifiTraceSink instances and connect them to wifi devices
*
- *
+ *
*/
class AthstatsHelper
{
@@ -50,9 +50,9 @@
void EnableAthstats (std::string filename, Ptr<NetDevice> nd);
void EnableAthstats (std::string filename, NetDeviceContainer d);
void EnableAthstats (std::string filename, NodeContainer n);
-
+
private:
- Time m_interval;
+ Time m_interval;
};
@@ -67,8 +67,8 @@
* driver. In particular, the reproduced behavior is that obtained
* when executing athstats without parameters: a report written in
* text format is produced every fixed interval, based on the events
- * observed by the wifi device.
- *
+ * observed by the wifi device.
+ *
* Differences with the "real" athstats:
*
* - AthstatsWifiTraceSink is expected to write its output to a file
@@ -76,130 +76,129 @@
*
* - only a subset of the metrics supported by athstats is supported
* by AthstatsWifiTraceSink
- *
+ *
* - AthstatsWifiTraceSink does never produce a cumulative report.
*/
class AthstatsWifiTraceSink : public Object
{
-public:
+public:
static TypeId GetTypeId (void);
AthstatsWifiTraceSink ();
virtual ~AthstatsWifiTraceSink ();
-
+
- /**
+ /**
* function to be called when the net device transmits a packet
- *
- * @param context
+ *
+ * @param context
* @param p the packet being transmitted
*/
void DevTxTrace (std::string context, Ptr<const Packet> p);
- /**
+ /**
* function to be called when the net device receives a packet
- *
- * @param context
+ *
+ * @param context
* @param p the packet being received
*/
void DevRxTrace (std::string context, Ptr<const Packet> p);
- /**
+ /**
* Function to be called when a RTS frame transmission by the considered
* device has failed
- *
- * @param context
+ *
+ * @param context
* @param address the MAC address of the remote station
*/
- void TxRtsFailedTrace (std::string context, Mac48Address address);
+ void TxRtsFailedTrace (std::string context, Mac48Address address);
- /**
+ /**
* Function to be called when a data frame transmission by the considered
* device has failed
- *
- * @param context
+ *
+ * @param context
* @param address the MAC address of the remote station
*/
- void TxDataFailedTrace (std::string context, Mac48Address address);
+ void TxDataFailedTrace (std::string context, Mac48Address address);
- /**
+ /**
* Function to be called when the transmission of a RTS frame has
* exceeded the retry limit
- *
- * @param context
+ *
+ * @param context
* @param address the MAC address of the remote station
*/
- void TxFinalRtsFailedTrace (std::string context, Mac48Address address);
+ void TxFinalRtsFailedTrace (std::string context, Mac48Address address);
- /**
+ /**
* Function to be called when the transmission of a data frame has
* exceeded the retry limit
- *
- * @param context
+ *
+ * @param context
* @param address the MAC address of the remote station
- */
- void TxFinalDataFailedTrace (std::string context, Mac48Address address);
+ */
+ void TxFinalDataFailedTrace (std::string context, Mac48Address address);
- /**
+ /**
* Function to be called when the PHY layer of the considered
* device receives a frame
- *
- * @param context
- * @param packet
- * @param snr
- * @param mode
- * @param preamble
+ *
+ * @param context
+ * @param packet
+ * @param snr
+ * @param mode
+ * @param preamble
*/
void PhyRxOkTrace (std::string context, Ptr<const Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble);
- /**
+ /**
* Function to be called when a frame reception by the PHY
* layer of the considered device resulted in an error due to a failure in the CRC check of
* the frame
- *
- * @param context
- * @param packet
- * @param snr
+ *
+ * @param context
+ * @param packet
+ * @param snr
*/
void PhyRxErrorTrace (std::string context, Ptr<const Packet> packet, double snr);
- /**
+ /**
* Function to be called when a frame is being transmitted by the
* PHY layer of the considered device
- *
- * @param context
- * @param packet
- * @param mode
- * @param preamble
- * @param txPower
+ *
+ * @param context
+ * @param packet
+ * @param mode
+ * @param preamble
+ * @param txPower
*/
void PhyTxTrace (std::string context, Ptr<const Packet> packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower);
- /**
+ /**
* Function to be called when the PHY layer of the considered device
* changes state
- *
- * @param context
- * @param start
- * @param duration
- * @param state
+ *
+ * @param context
+ * @param start
+ * @param duration
+ * @param state
*/
void PhyStateTrace (std::string context, Time start, Time duration, enum WifiPhy::State state);
- /**
+ /**
* Open a file for output
- *
+ *
* @param name the name of the file to be opened.
*/
void Open (std::string const& name);
private:
-
- /**
+ /**
* @internal
*/
void WriteStats ();
- /**
+ /**
* @internal
*/
void ResetCounters ();
@@ -215,13 +214,13 @@
std::ofstream *m_writer;
- Time m_interval;
+ Time m_interval;
}; // class AthstatsWifiTraceSink
-
+
} // namespace ns3
--- a/src/wifi/helper/nqos-wifi-mac-helper.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/helper/nqos-wifi-mac-helper.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
--- a/src/wifi/helper/nqos-wifi-mac-helper.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/helper/nqos-wifi-mac-helper.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -34,7 +34,7 @@
{
public:
/**
- * Create a NqosWifiMacHelper to make life easier for people who want to
+ * Create a NqosWifiMacHelper to make life easier for people who want to
* work with non-QOS Wifi MAC layers.
*/
NqosWifiMacHelper ();
--- a/src/wifi/helper/qos-wifi-mac-helper.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/helper/qos-wifi-mac-helper.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -128,11 +128,11 @@
}
if (m_bAckThresholds.find (ac) != m_bAckThresholds.end ())
{
- edca->SetBlockAckThreshold (m_bAckThresholds.find(ac)->second);
+ edca->SetBlockAckThreshold (m_bAckThresholds.find (ac)->second);
}
if (m_bAckInactivityTimeouts.find (ac) != m_bAckInactivityTimeouts.end ())
{
- edca->SetBlockAckInactivityTimeout (m_bAckInactivityTimeouts.find(ac)->second);
+ edca->SetBlockAckInactivityTimeout (m_bAckInactivityTimeouts.find (ac)->second);
}
}
--- a/src/wifi/helper/qos-wifi-mac-helper.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/helper/qos-wifi-mac-helper.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -125,7 +125,7 @@
* block ack agreement is teared down. Timer is reset in an recipient station every time
* that a block ack request or a MPDU with ack policy BLOCK ACK is received.
* Timer is reset in a originator station every time that a block ack frame is received.
- *
+ *
* \param ac access category for which we are setting block ack threshold. Possibilities
* are: AC_BK, AC_BE, AC_VI, AC_VO.
* \param timeout number of block of 1024 microseconds.
@@ -144,7 +144,7 @@
ObjectFactory m_mac;
std::map<AcIndex, ObjectFactory> m_aggregators;
- /*
+ /*
* Next maps contain, for every access category, the values for
* block ack threshold and block ack inactivity timeout.
*/
--- a/src/wifi/helper/wifi-helper.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/helper/wifi-helper.cc Sat May 07 21:49:46 2011 +0200
@@ -59,7 +59,7 @@
return helper;
}
-void
+void
WifiHelper::SetRemoteStationManager (std::string type,
std::string n0, const AttributeValue &v0,
std::string n1, const AttributeValue &v1,
@@ -82,13 +82,13 @@
m_stationManager.Set (n7, v7);
}
-void
+void
WifiHelper::SetStandard (enum WifiPhyStandard standard)
{
m_standard = standard;
}
-NetDeviceContainer
+NetDeviceContainer
WifiHelper::Install (const WifiPhyHelper &phyHelper,
const WifiMacHelper &macHelper, NodeContainer c) const
{
@@ -108,19 +108,19 @@
device->SetRemoteStationManager (manager);
node->AddDevice (device);
devices.Add (device);
- NS_LOG_DEBUG ("node="<<node<<", mob="<<node->GetObject<MobilityModel> ());
+ NS_LOG_DEBUG ("node=" << node << ", mob=" << node->GetObject<MobilityModel> ());
}
return devices;
}
-NetDeviceContainer
+NetDeviceContainer
WifiHelper::Install (const WifiPhyHelper &phy,
const WifiMacHelper &mac, Ptr<Node> node) const
{
return Install (phy, mac, NodeContainer (node));
}
-NetDeviceContainer
+NetDeviceContainer
WifiHelper::Install (const WifiPhyHelper &phy,
const WifiMacHelper &mac, std::string nodeName) const
{
--- a/src/wifi/helper/wifi-helper.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/helper/wifi-helper.h Sat May 07 21:49:46 2011 +0200
@@ -98,7 +98,7 @@
* \returns a new WifiHelper in a default state
*
* The default state is defined as being an Adhoc MAC layer with an ARF rate control algorithm
- * and both objects using their default attribute values. By default, configure MAC and PHY
+ * and both objects using their default attribute values. By default, configure MAC and PHY
* for 802.11a.
*/
static WifiHelper Default (void);
@@ -167,7 +167,7 @@
void SetStandard (enum WifiPhyStandard standard);
/**
- * Helper to enable all WifiNetDevice log components with one statement
+ * Helper to enable all WifiNetDevice log components with one statement
*/
static void EnableLogComponents (void);
--- a/src/wifi/helper/yans-wifi-helper.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/helper/yans-wifi-helper.cc Sat May 07 21:49:46 2011 +0200
@@ -38,12 +38,12 @@
namespace ns3 {
-static void
+static void
AsciiPhyTransmitSinkWithContext (
- Ptr<OutputStreamWrapper> stream,
- std::string context,
+ Ptr<OutputStreamWrapper> stream,
+ std::string context,
Ptr<const Packet> p,
- WifiMode mode,
+ WifiMode mode,
WifiPreamble preamble,
uint8_t txLevel)
{
@@ -51,11 +51,11 @@
*stream->GetStream () << "t " << Simulator::Now ().GetSeconds () << " " << context << " " << *p << std::endl;
}
-static void
+static void
AsciiPhyTransmitSinkWithoutContext (
- Ptr<OutputStreamWrapper> stream,
+ Ptr<OutputStreamWrapper> stream,
Ptr<const Packet> p,
- WifiMode mode,
+ WifiMode mode,
WifiPreamble preamble,
uint8_t txLevel)
{
@@ -63,12 +63,12 @@
*stream->GetStream () << "t " << Simulator::Now ().GetSeconds () << " " << *p << std::endl;
}
-static void
+static void
AsciiPhyReceiveSinkWithContext (
Ptr<OutputStreamWrapper> stream,
std::string context,
- Ptr<const Packet> p,
- double snr,
+ Ptr<const Packet> p,
+ double snr,
WifiMode mode,
enum WifiPreamble preamble)
{
@@ -76,11 +76,11 @@
*stream->GetStream () << "r " << Simulator::Now ().GetSeconds () << " " << context << " " << *p << std::endl;
}
-static void
+static void
AsciiPhyReceiveSinkWithoutContext (
Ptr<OutputStreamWrapper> stream,
- Ptr<const Packet> p,
- double snr,
+ Ptr<const Packet> p,
+ double snr,
WifiMode mode,
enum WifiPreamble preamble)
{
@@ -89,9 +89,10 @@
}
YansWifiChannelHelper::YansWifiChannelHelper ()
-{}
+{
+}
-YansWifiChannelHelper
+YansWifiChannelHelper
YansWifiChannelHelper::Default (void)
{
YansWifiChannelHelper helper;
@@ -100,16 +101,16 @@
return helper;
}
-void
+void
YansWifiChannelHelper::AddPropagationLoss (std::string type,
- std::string n0, const AttributeValue &v0,
- std::string n1, const AttributeValue &v1,
- std::string n2, const AttributeValue &v2,
- std::string n3, const AttributeValue &v3,
- std::string n4, const AttributeValue &v4,
- std::string n5, const AttributeValue &v5,
- std::string n6, const AttributeValue &v6,
- std::string n7, const AttributeValue &v7)
+ std::string n0, const AttributeValue &v0,
+ std::string n1, const AttributeValue &v1,
+ std::string n2, const AttributeValue &v2,
+ std::string n3, const AttributeValue &v3,
+ std::string n4, const AttributeValue &v4,
+ std::string n5, const AttributeValue &v5,
+ std::string n6, const AttributeValue &v6,
+ std::string n7, const AttributeValue &v7)
{
ObjectFactory factory;
factory.SetTypeId (type);
@@ -124,16 +125,16 @@
m_propagationLoss.push_back (factory);
}
-void
+void
YansWifiChannelHelper::SetPropagationDelay (std::string type,
- std::string n0, const AttributeValue &v0,
- std::string n1, const AttributeValue &v1,
- std::string n2, const AttributeValue &v2,
- std::string n3, const AttributeValue &v3,
- std::string n4, const AttributeValue &v4,
- std::string n5, const AttributeValue &v5,
- std::string n6, const AttributeValue &v6,
- std::string n7, const AttributeValue &v7)
+ std::string n0, const AttributeValue &v0,
+ std::string n1, const AttributeValue &v1,
+ std::string n2, const AttributeValue &v2,
+ std::string n3, const AttributeValue &v3,
+ std::string n4, const AttributeValue &v4,
+ std::string n5, const AttributeValue &v5,
+ std::string n6, const AttributeValue &v6,
+ std::string n7, const AttributeValue &v7)
{
ObjectFactory factory;
factory.SetTypeId (type);
@@ -148,7 +149,7 @@
m_propagationDelay = factory;
}
-Ptr<YansWifiChannel>
+Ptr<YansWifiChannel>
YansWifiChannelHelper::Create (void) const
{
Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> ();
@@ -157,13 +158,13 @@
{
Ptr<PropagationLossModel> cur = (*i).Create<PropagationLossModel> ();
if (prev != 0)
- {
- prev->SetNext (cur);
- }
+ {
+ prev->SetNext (cur);
+ }
if (m_propagationLoss.begin () == i)
- {
- channel->SetPropagationLossModel (cur);
- }
+ {
+ channel->SetPropagationLossModel (cur);
+ }
prev = cur;
}
Ptr<PropagationDelayModel> delay = m_propagationDelay.Create<PropagationDelayModel> ();
@@ -174,12 +175,12 @@
YansWifiPhyHelper::YansWifiPhyHelper ()
: m_channel (0),
- m_pcapDlt(PcapHelper::DLT_IEEE802_11)
+ m_pcapDlt (PcapHelper::DLT_IEEE802_11)
{
m_phy.SetTypeId ("ns3::YansWifiPhy");
}
-YansWifiPhyHelper
+YansWifiPhyHelper
YansWifiPhyHelper::Default (void)
{
YansWifiPhyHelper helper;
@@ -187,33 +188,33 @@
return helper;
}
-void
+void
YansWifiPhyHelper::SetChannel (Ptr<YansWifiChannel> channel)
{
m_channel = channel;
}
-void
+void
YansWifiPhyHelper::SetChannel (std::string channelName)
{
Ptr<YansWifiChannel> channel = Names::Find<YansWifiChannel> (channelName);
m_channel = channel;
}
-void
+void
YansWifiPhyHelper::Set (std::string name, const AttributeValue &v)
{
m_phy.Set (name, v);
}
-void
+void
YansWifiPhyHelper::SetErrorRateModel (std::string name,
- std::string n0, const AttributeValue &v0,
- std::string n1, const AttributeValue &v1,
- std::string n2, const AttributeValue &v2,
- std::string n3, const AttributeValue &v3,
- std::string n4, const AttributeValue &v4,
- std::string n5, const AttributeValue &v5,
- std::string n6, const AttributeValue &v6,
- std::string n7, const AttributeValue &v7)
+ std::string n0, const AttributeValue &v0,
+ std::string n1, const AttributeValue &v1,
+ std::string n2, const AttributeValue &v2,
+ std::string n3, const AttributeValue &v3,
+ std::string n4, const AttributeValue &v4,
+ std::string n5, const AttributeValue &v5,
+ std::string n6, const AttributeValue &v6,
+ std::string n7, const AttributeValue &v7)
{
m_errorRateModel = ObjectFactory ();
m_errorRateModel.SetTypeId (name);
@@ -227,7 +228,7 @@
m_errorRateModel.Set (n7, v7);
}
-Ptr<WifiPhy>
+Ptr<WifiPhy>
YansWifiPhyHelper::Create (Ptr<Node> node, Ptr<WifiNetDevice> device) const
{
Ptr<YansWifiPhy> phy = m_phy.Create<YansWifiPhy> ();
@@ -239,7 +240,7 @@
return phy;
}
-static void
+static void
PcapSniffTxEvent (
Ptr<PcapFileWrapper> file,
Ptr<const Packet> packet,
@@ -279,7 +280,7 @@
header.SetRate (rate);
uint16_t channelFlags = 0;
- switch (rate)
+ switch (rate)
{
case 2: // 1Mbps
case 4: // 2Mbps
@@ -287,10 +288,10 @@
case 22: // 11Mbps
channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;
break;
-
+
default:
channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;
- break;
+ break;
}
if (channelFreqMhz < 2500)
@@ -301,7 +302,7 @@
{
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ;
}
-
+
header.SetChannelFrequencyAndFlags (channelFreqMhz, channelFlags);
p->AddHeader (header);
@@ -313,7 +314,7 @@
}
}
-static void
+static void
PcapSniffRxEvent (
Ptr<PcapFileWrapper> file,
Ptr<const Packet> packet,
@@ -355,7 +356,7 @@
header.SetRate (rate);
uint16_t channelFlags = 0;
- switch (rate)
+ switch (rate)
{
case 2: // 1Mbps
case 4: // 2Mbps
@@ -363,10 +364,10 @@
case 22: // 11Mbps
channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;
break;
-
+
default:
channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;
- break;
+ break;
}
if (channelFreqMhz < 2500)
@@ -377,7 +378,7 @@
{
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ;
}
-
+
header.SetChannelFrequencyAndFlags (channelFreqMhz, channelFlags);
header.SetAntennaSignalPower (signalDbm);
@@ -392,7 +393,7 @@
}
}
-void
+void
YansWifiPhyHelper::SetPcapDataLinkType (enum SupportedPcapDataLinkTypes dlt)
{
switch (dlt)
@@ -411,7 +412,7 @@
}
}
-void
+void
YansWifiPhyHelper::EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool promiscuous, bool explicitFilename)
{
//
@@ -447,10 +448,10 @@
phy->TraceConnectWithoutContext ("PromiscSnifferRx", MakeBoundCallback (&PcapSniffRxEvent, file));
}
-void
+void
YansWifiPhyHelper::EnableAsciiInternal (
- Ptr<OutputStreamWrapper> stream,
- std::string prefix,
+ Ptr<OutputStreamWrapper> stream,
+ std::string prefix,
Ptr<NetDevice> nd,
bool explicitFilename)
{
@@ -477,15 +478,15 @@
std::ostringstream oss;
//
- // If we are not provided an OutputStreamWrapper, we are expected to create
- // one using the usual trace filename conventions and write our traces
+ // If we are not provided an OutputStreamWrapper, we are expected to create
+ // one using the usual trace filename conventions and write our traces
// without a context since there will be one file per context and therefore
// the context would be redundant.
//
if (stream == 0)
{
//
- // Set up an output stream object to deal with private ofstream copy
+ // Set up an output stream object to deal with private ofstream copy
// constructor and lifetime issues. Let the helper decide the actual
// name of the file given the prefix.
//
@@ -503,8 +504,8 @@
Ptr<OutputStreamWrapper> theStream = asciiTraceHelper.CreateFileStream (filename);
//
- // We could go poking through the phy and the state looking for the
- // correct trace source, but we can let Config deal with that with
+ // We could go poking through the phy and the state looking for the
+ // correct trace source, but we can let Config deal with that with
// some search cost. Since this is presumably happening at topology
// creation time, it doesn't seem much of a price to pay.
//
@@ -522,7 +523,7 @@
//
// If we are provided an OutputStreamWrapper, we are expected to use it, and
// to provide a context. We are free to come up with our own context if we
- // want, and use the AsciiTraceHelper Hook*WithContext functions, but for
+ // want, and use the AsciiTraceHelper Hook*WithContext functions, but for
// compatibility and simplicity, we just use Config::Connect and let it deal
// with coming up with a context.
//
--- a/src/wifi/helper/yans-wifi-helper.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/helper/yans-wifi-helper.h Sat May 07 21:49:46 2011 +0200
@@ -80,14 +80,14 @@
* gains) are calculated in the order the models are added.
*/
void AddPropagationLoss (std::string name,
- std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
- std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
- std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
- std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
- std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
- std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
- std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
- std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
+ std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
+ std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
+ std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
+ std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
+ std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
+ std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
+ std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
+ std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
/**
* \param name the name of the model to set
* \param n0 the name of the attribute to set
@@ -110,14 +110,14 @@
* Configure a propagation delay for this channel.
*/
void SetPropagationDelay (std::string name,
- std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
- std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
- std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
- std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
- std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
- std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
- std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
- std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
+ std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
+ std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
+ std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
+ std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
+ std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
+ std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
+ std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
+ std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
/**
* \returns a new channel
@@ -134,7 +134,7 @@
/**
* \brief Make it easy to create and manage PHY objects for the yans model.
*
- * The yans PHY model is described in "Yet Another Network Simulator",
+ * The yans PHY model is described in "Yet Another Network Simulator",
* http://cutebugs.net/files/wns2-yans.pdf
*
* The Pcap and ascii traces generated by the EnableAscii and EnablePcap methods defined
@@ -142,7 +142,8 @@
*
*/
class YansWifiPhyHelper : public WifiPhyHelper,
- public PcapHelperForDevice, public AsciiTraceHelperForDevice
+ public PcapHelperForDevice,
+ public AsciiTraceHelperForDevice
{
public:
/**
@@ -207,26 +208,27 @@
std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
/**
- * An enumeration of the pcap data link types (DLTs) which this helper
+ * An enumeration of the pcap data link types (DLTs) which this helper
* supports. See http://wiki.wireshark.org/Development/LibpcapFileFormat
* for more information on these formats.
*/
- enum SupportedPcapDataLinkTypes {
+ enum SupportedPcapDataLinkTypes
+ {
DLT_IEEE802_11 = PcapHelper::DLT_IEEE802_11, /**< IEEE 802.11 Wireless LAN headers on packets */
DLT_PRISM_HEADER = PcapHelper::DLT_PRISM_HEADER, /**< Include Prism monitor mode information */
DLT_IEEE802_11_RADIO = PcapHelper::DLT_IEEE802_11_RADIO /**< Include Radiotap link layer information */
};
- /**
+ /**
* Set the data link type of PCAP traces to be used. This function has to be
- * called before EnablePcap(), so that the header of the pcap file can be
+ * called before EnablePcap(), so that the header of the pcap file can be
* written correctly.
*
* @see SupportedPcapDataLinkTypes
*
* @param dlt The data link type of the pcap file (and packets) to be used
*/
- void SetPcapDataLinkType (enum SupportedPcapDataLinkTypes dlt);
+ void SetPcapDataLinkType (enum SupportedPcapDataLinkTypes dlt);
private:
/**
@@ -249,9 +251,9 @@
* @param promiscuous If true capture all possible packets available at the device.
* @param explicitFilename Treat the prefix as an explicit filename if true
*/
- virtual void EnablePcapInternal (std::string prefix,
- Ptr<NetDevice> nd,
- bool promiscuous,
+ virtual void EnablePcapInternal (std::string prefix,
+ Ptr<NetDevice> nd,
+ bool promiscuous,
bool explicitFilename);
/**
@@ -265,8 +267,8 @@
* \param prefix Filename prefix to use for ascii trace files.
* \param nd Net device for which you want to enable tracing.
*/
- virtual void EnableAsciiInternal (Ptr<OutputStreamWrapper> stream,
- std::string prefix,
+ virtual void EnableAsciiInternal (Ptr<OutputStreamWrapper> stream,
+ std::string prefix,
Ptr<NetDevice> nd,
bool explicitFilename);
--- a/src/wifi/model/aarf-wifi-manager.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/aarf-wifi-manager.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2004,2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -24,8 +24,8 @@
#include "ns3/uinteger.h"
#include "ns3/log.h"
-#define Min(a,b) ((a<b)?a:b)
-#define Max(a,b) ((a>b)?a:b)
+#define Min(a,b) ((a < b) ? a : b)
+#define Max(a,b) ((a > b) ? a : b)
NS_LOG_COMPONENT_DEFINE ("AarfWifiManager");
@@ -38,7 +38,7 @@
uint32_t m_failed;
bool m_recovery;
uint32_t m_retry;
-
+
uint32_t m_timerTimeout;
uint32_t m_successThreshold;
@@ -48,7 +48,7 @@
NS_OBJECT_ENSURE_REGISTERED (AarfWifiManager);
-TypeId
+TypeId
AarfWifiManager::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::AarfWifiManager")
@@ -78,14 +78,16 @@
UintegerValue (10),
MakeUintegerAccessor (&AarfWifiManager::m_minSuccessThreshold),
MakeUintegerChecker<uint32_t> ())
- ;
+ ;
return tid;
}
AarfWifiManager::AarfWifiManager ()
-{}
+{
+}
AarfWifiManager::~AarfWifiManager ()
-{}
+{
+}
WifiRemoteStation *
AarfWifiManager::DoCreateStation (void) const
@@ -104,9 +106,10 @@
return station;
}
-void
+void
AarfWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
-{}
+{
+}
/**
* It is important to realize that "recovery" mode starts after failure of
* the first transmission after a rate increase and ends at the first successful
@@ -116,7 +119,7 @@
* The fundamental reason for this is that there is a backoff between each data
* transmission, be it an initial transmission or a retransmission.
*/
-void
+void
AarfWifiManager::DoReportDataFailed (WifiRemoteStation *st)
{
AarfWifiRemoteStation *station = (AarfWifiRemoteStation *)st;
@@ -125,7 +128,7 @@
station->m_retry++;
station->m_success = 0;
- if (station->m_recovery)
+ if (station->m_recovery)
{
NS_ASSERT (station->m_retry >= 1);
if (station->m_retry == 1)
@@ -141,8 +144,8 @@
}
}
station->m_timer = 0;
- }
- else
+ }
+ else
{
NS_ASSERT (station->m_retry >= 1);
if (((station->m_retry - 1) % 2) == 1)
@@ -155,23 +158,24 @@
station->m_rate--;
}
}
- if (station->m_retry >= 2)
+ if (station->m_retry >= 2)
{
station->m_timer = 0;
}
}
}
-void
+void
AarfWifiManager::DoReportRxOk (WifiRemoteStation *station,
- double rxSnr, WifiMode txMode)
-{}
-void
+ double rxSnr, WifiMode txMode)
+{
+}
+void
AarfWifiManager::DoReportRtsOk (WifiRemoteStation *station,
double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
NS_LOG_DEBUG ("station=" << station << " rts ok");
}
-void
+void
AarfWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
{
@@ -182,23 +186,25 @@
station->m_recovery = false;
station->m_retry = 0;
NS_LOG_DEBUG ("station=" << station << " data ok success=" << station->m_success << ", timer=" << station->m_timer);
- if ((station->m_success == station->m_successThreshold ||
- station->m_timer == station->m_timerTimeout) &&
- (station->m_rate < (GetNSupported (station) - 1)))
+ if ((station->m_success == station->m_successThreshold
+ || station->m_timer == station->m_timerTimeout)
+ && (station->m_rate < (GetNSupported (station) - 1)))
{
- NS_LOG_DEBUG ("station="<<station<<" inc rate");
+ NS_LOG_DEBUG ("station=" << station << " inc rate");
station->m_rate++;
station->m_timer = 0;
station->m_success = 0;
station->m_recovery = true;
}
}
-void
+void
AarfWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
-{}
-void
+{
+}
+void
AarfWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
-{}
+{
+}
WifiMode
AarfWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
@@ -215,7 +221,7 @@
return GetSupported (station, 0);
}
-bool
+bool
AarfWifiManager::IsLowLatency (void) const
{
return true;
--- a/src/wifi/model/aarf-wifi-manager.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/aarf-wifi-manager.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -30,10 +30,10 @@
*
* This class implements the AARF rate control algorithm which
* was initially described in <i>IEEE 802.11 Rate Adaptation:
- * A Practical Approach</i>, by M. Lacage, M.H. Manshaei, and
+ * A Practical Approach</i>, by M. Lacage, M.H. Manshaei, and
* T. Turletti.
*/
-class AarfWifiManager : public WifiRemoteStationManager
+class AarfWifiManager : public WifiRemoteStationManager
{
public:
static TypeId GetTypeId (void);
@@ -41,8 +41,8 @@
virtual ~AarfWifiManager ();
private:
// overriden from base class
- virtual WifiRemoteStation *DoCreateStation (void) const;
- virtual void DoReportRxOk (WifiRemoteStation *station,
+ virtual WifiRemoteStation * DoCreateStation (void) const;
+ virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
virtual void DoReportRtsFailed (WifiRemoteStation *station);
virtual void DoReportDataFailed (WifiRemoteStation *station);
--- a/src/wifi/model/aarfcd-wifi-manager.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/aarfcd-wifi-manager.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2004,2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -27,8 +27,8 @@
#include "ns3/uinteger.h"
#include <algorithm>
-#define Min(a,b) ((a<b)?a:b)
-#define Max(a,b) ((a>b)?a:b)
+#define Min(a,b) ((a < b) ? a : b)
+#define Max(a,b) ((a > b) ? a : b)
NS_LOG_COMPONENT_DEFINE ("Aarfcd");
@@ -42,7 +42,7 @@
bool m_recovery;
bool m_justModifyRate;
uint32_t m_retry;
-
+
uint32_t m_successThreshold;
uint32_t m_timerTimeout;
@@ -53,9 +53,9 @@
bool m_haveASuccess;
};
-NS_OBJECT_ENSURE_REGISTERED(AarfcdWifiManager);
+NS_OBJECT_ENSURE_REGISTERED (AarfcdWifiManager);
-TypeId
+TypeId
AarfcdWifiManager::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::AarfcdWifiManager")
@@ -85,12 +85,12 @@
UintegerValue (10),
MakeUintegerAccessor (&AarfcdWifiManager::m_minSuccessThreshold),
MakeUintegerChecker<uint32_t> ())
- .AddAttribute ("MinRtsWnd",
+ .AddAttribute ("MinRtsWnd",
"Minimum value for Rts window of Aarf-CD",
UintegerValue (1),
MakeUintegerAccessor (&AarfcdWifiManager::m_minRtsWnd),
MakeUintegerChecker<uint32_t> ())
- .AddAttribute ("MaxRtsWnd",
+ .AddAttribute ("MaxRtsWnd",
"Maximum value for Rts window of Aarf-CD",
UintegerValue (40),
MakeUintegerAccessor (&AarfcdWifiManager::m_maxRtsWnd),
@@ -105,14 +105,16 @@
BooleanValue (true),
MakeBooleanAccessor (&AarfcdWifiManager::m_turnOnRtsAfterRateIncrease),
MakeBooleanChecker ())
- ;
+ ;
return tid;
}
AarfcdWifiManager::AarfcdWifiManager ()
: WifiRemoteStationManager ()
-{}
+{
+}
AarfcdWifiManager::~AarfcdWifiManager ()
-{}
+{
+}
WifiRemoteStation *
AarfcdWifiManager::DoCreateStation (void) const
{
@@ -138,9 +140,10 @@
return station;
}
-void
+void
AarfcdWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
-{}
+{
+}
/**
* It is important to realize that "recovery" mode starts after failure of
* the first transmission after a rate increase and ends at the first successful
@@ -150,7 +153,7 @@
* The fundamental reason for this is that there is a backoff between each data
* transmission, be it an initial transmission or a retransmission.
*/
-void
+void
AarfcdWifiManager::DoReportDataFailed (WifiRemoteStation *st)
{
@@ -160,24 +163,24 @@
station->m_retry++;
station->m_success = 0;
- if (!station->m_rtsOn)
+ if (!station->m_rtsOn)
{
TurnOnRts (station);
- if (!station->m_justModifyRate && !station->m_haveASuccess)
+ if (!station->m_justModifyRate && !station->m_haveASuccess)
{
IncreaseRtsWnd (station);
}
- else
+ else
{
ResetRtsWnd (station);
}
station->m_rtsCounter = station->m_rtsWnd;
- if (station->m_retry >= 2)
+ if (station->m_retry >= 2)
{
station->m_timer = 0;
}
}
- else if (station->m_recovery)
+ else if (station->m_recovery)
{
NS_ASSERT (station->m_retry >= 1);
station->m_justModifyRate = false;
@@ -185,7 +188,7 @@
if (station->m_retry == 1)
{
// need recovery fallback
- if (m_turnOffRtsAfterRateDecrease)
+ if (m_turnOffRtsAfterRateDecrease)
{
TurnOffRts (station);
}
@@ -200,8 +203,8 @@
}
}
station->m_timer = 0;
- }
- else
+ }
+ else
{
NS_ASSERT (station->m_retry >= 1);
station->m_justModifyRate = false;
@@ -209,7 +212,7 @@
if (((station->m_retry - 1) % 2) == 1)
{
// need normal fallback
- if (m_turnOffRtsAfterRateDecrease)
+ if (m_turnOffRtsAfterRateDecrease)
{
TurnOffRts (station);
}
@@ -221,28 +224,29 @@
station->m_rate--;
}
}
- if (station->m_retry >= 2)
+ if (station->m_retry >= 2)
{
station->m_timer = 0;
}
}
CheckRts (station);
}
-void
+void
AarfcdWifiManager::DoReportRxOk (WifiRemoteStation *station,
- double rxSnr, WifiMode txMode)
-{}
-void
+ double rxSnr, WifiMode txMode)
+{
+}
+void
AarfcdWifiManager::DoReportRtsOk (WifiRemoteStation *st,
- double ctsSnr, WifiMode ctsMode, double rtsSnr)
+ double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
NS_LOG_DEBUG ("station=" << station << " rts ok");
station->m_rtsCounter--;
}
-void
+void
AarfcdWifiManager::DoReportDataOk (WifiRemoteStation *st,
- double ackSnr, WifiMode ackMode, double dataSnr)
+ double ackSnr, WifiMode ackMode, double dataSnr)
{
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
station->m_timer++;
@@ -253,17 +257,17 @@
station->m_justModifyRate = false;
station->m_haveASuccess = true;
NS_LOG_DEBUG ("station=" << station << " data ok success=" << station->m_success << ", timer=" << station->m_timer);
- if ((station->m_success == station->m_successThreshold ||
- station->m_timer == station->m_timerTimeout) &&
- (station->m_rate < (GetNSupported (station) - 1)))
+ if ((station->m_success == station->m_successThreshold
+ || station->m_timer == station->m_timerTimeout)
+ && (station->m_rate < (GetNSupported (station) - 1)))
{
- NS_LOG_DEBUG ("station="<<station<<" inc rate");
+ NS_LOG_DEBUG ("station=" << station << " inc rate");
station->m_rate++;
station->m_timer = 0;
station->m_success = 0;
station->m_recovery = true;
station->m_justModifyRate = true;
- if (m_turnOnRtsAfterRateIncrease)
+ if (m_turnOnRtsAfterRateIncrease)
{
TurnOnRts (station);
ResetRtsWnd (station);
@@ -272,12 +276,14 @@
}
CheckRts (station);
}
-void
+void
AarfcdWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
-{}
-void
+{
+}
+void
AarfcdWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
-{}
+{
+}
WifiMode
AarfcdWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
@@ -299,12 +305,12 @@
Ptr<const Packet> packet, bool normally)
{
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
- NS_LOG_INFO ("" << station << " rate=" << station->m_rate << " rts=" << (station->m_rtsOn?"RTS":"BASIC") <<
+ NS_LOG_INFO ("" << station << " rate=" << station->m_rate << " rts=" << (station->m_rtsOn ? "RTS" : "BASIC") <<
" rtsCounter=" << station->m_rtsCounter);
return station->m_rtsOn;
}
-bool
+bool
AarfcdWifiManager::IsLowLatency (void) const
{
return true;
@@ -313,7 +319,7 @@
void
AarfcdWifiManager::CheckRts (AarfcdWifiRemoteStation *station)
{
- if (station->m_rtsCounter == 0 && station->m_rtsOn)
+ if (station->m_rtsCounter == 0 && station->m_rtsOn)
{
TurnOffRts (station);
}
--- a/src/wifi/model/aarfcd-wifi-manager.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/aarfcd-wifi-manager.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -35,7 +35,7 @@
* version of ns-3. Federico died before merging this work in ns-3 itself so his code was ported
* to ns-3 later without his supervision.
*/
-class AarfcdWifiManager : public WifiRemoteStationManager
+class AarfcdWifiManager : public WifiRemoteStationManager
{
public:
static TypeId GetTypeId (void);
@@ -44,8 +44,8 @@
private:
// overriden from base class
- virtual WifiRemoteStation *DoCreateStation (void) const;
- virtual void DoReportRxOk (WifiRemoteStation *station,
+ virtual WifiRemoteStation * DoCreateStation (void) const;
+ virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
virtual void DoReportRtsFailed (WifiRemoteStation *station);
virtual void DoReportDataFailed (WifiRemoteStation *station);
@@ -57,7 +57,7 @@
virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
virtual WifiMode DoGetDataMode (WifiRemoteStation *station, uint32_t size);
virtual WifiMode DoGetRtsMode (WifiRemoteStation *station);
- virtual bool DoNeedRts (WifiRemoteStation *station,
+ virtual bool DoNeedRts (WifiRemoteStation *station,
Ptr<const Packet> packet, bool normally);
virtual bool IsLowLatency (void) const;
--- a/src/wifi/model/adhoc-wifi-mac.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/adhoc-wifi-mac.cc Sat May 07 21:49:46 2011 +0200
@@ -172,7 +172,7 @@
{
if (hdr->IsQosData () && hdr->IsQosAmsdu ())
{
- NS_LOG_DEBUG ("Received A-MSDU from"<<from);
+ NS_LOG_DEBUG ("Received A-MSDU from" << from);
DeaggregateAmsduAndForward (packet, hdr);
}
else
--- a/src/wifi/model/adhoc-wifi-mac.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/adhoc-wifi-mac.h Sat May 07 21:49:46 2011 +0200
@@ -30,8 +30,8 @@
/**
* \ingroup wifi
- *
- *
+ *
+ *
*/
class AdhocWifiMac : public RegularWifiMac
{
--- a/src/wifi/model/amrr-wifi-manager.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/amrr-wifi-manager.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2003,2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -57,12 +57,12 @@
MakeTimeChecker ())
.AddAttribute ("FailureRatio",
"Ratio of minimum erroneous transmissions needed to switch to a lower rate",
- DoubleValue (1.0/3.0),
+ DoubleValue (1.0 / 3.0),
MakeDoubleAccessor (&AmrrWifiManager::m_failureRatio),
MakeDoubleChecker<double> (0.0, 1.0))
.AddAttribute ("SuccessRatio",
"Ratio of maximum erroneous transmissions needed to switch to a higher rate",
- DoubleValue (1.0/10.0),
+ DoubleValue (1.0 / 10.0),
MakeDoubleAccessor (&AmrrWifiManager::m_successRatio),
MakeDoubleChecker<double> (0.0, 1.0))
.AddAttribute ("MaxSuccessThreshold",
@@ -75,12 +75,13 @@
UintegerValue (1),
MakeUintegerAccessor (&AmrrWifiManager::m_minSuccessThreshold),
MakeUintegerChecker<uint32_t> ())
- ;
+ ;
return tid;
}
AmrrWifiManager::AmrrWifiManager ()
-{}
+{
+}
WifiRemoteStation *
AmrrWifiManager::DoCreateStation (void) const
@@ -99,37 +100,40 @@
}
-void
+void
AmrrWifiManager::DoReportRxOk (WifiRemoteStation *station,
- double rxSnr, WifiMode txMode)
-{}
-void
+ double rxSnr, WifiMode txMode)
+{
+}
+void
AmrrWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
-{}
-void
+{
+}
+void
AmrrWifiManager::DoReportDataFailed (WifiRemoteStation *st)
{
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
station->m_retry++;
station->m_tx_retr++;
}
-void
+void
AmrrWifiManager::DoReportRtsOk (WifiRemoteStation *st,
- double ctsSnr, WifiMode ctsMode, double rtsSnr)
+ double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
}
-void
+void
AmrrWifiManager::DoReportDataOk (WifiRemoteStation *st,
- double ackSnr, WifiMode ackMode, double dataSnr)
+ double ackSnr, WifiMode ackMode, double dataSnr)
{
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
station->m_retry = 0;
station->m_tx_ok++;
}
-void
+void
AmrrWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
-{}
-void
+{
+}
+void
AmrrWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
{
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
@@ -162,20 +166,20 @@
{
return (station->m_tx_retr + station->m_tx_err + station->m_tx_ok) > 10;
}
-void
+void
AmrrWifiManager::ResetCnt (AmrrWifiRemoteStation *station)
{
station->m_tx_ok = 0;
station->m_tx_err = 0;
station->m_tx_retr = 0;
}
-void
+void
AmrrWifiManager::IncreaseRate (AmrrWifiRemoteStation *station)
{
station->m_txrate++;
NS_ASSERT (station->m_txrate < GetNSupported (station));
}
-void
+void
AmrrWifiManager::DecreaseRate (AmrrWifiRemoteStation *station)
{
station->m_txrate--;
@@ -193,59 +197,59 @@
bool needChange = false;
- if (IsSuccess (station) && IsEnough (station))
+ if (IsSuccess (station) && IsEnough (station))
{
station->m_success++;
- NS_LOG_DEBUG ("++ success="<<station->m_success<<" successThreshold="<<station->m_successThreshold<<
- " tx_ok="<<station->m_tx_ok<<" tx_err="<<station->m_tx_err<<" tx_retr="<<station->m_tx_retr<<
- " rate="<<station->m_txrate<<" n-supported-rates="<<GetNSupported (station));
- if (station->m_success >= station->m_successThreshold &&
- !IsMaxRate (station))
+ NS_LOG_DEBUG ("++ success=" << station->m_success << " successThreshold=" << station->m_successThreshold <<
+ " tx_ok=" << station->m_tx_ok << " tx_err=" << station->m_tx_err << " tx_retr=" << station->m_tx_retr <<
+ " rate=" << station->m_txrate << " n-supported-rates=" << GetNSupported (station));
+ if (station->m_success >= station->m_successThreshold
+ && !IsMaxRate (station))
{
station->m_recovery = true;
station->m_success = 0;
IncreaseRate (station);
needChange = true;
- }
- else
+ }
+ else
{
station->m_recovery = false;
}
- }
- else if (IsFailure (station))
+ }
+ else if (IsFailure (station))
{
station->m_success = 0;
- NS_LOG_DEBUG ("-- success="<<station->m_success<<" successThreshold="<<station->m_successThreshold<<
- " tx_ok="<<station->m_tx_ok<<" tx_err="<<station->m_tx_err<<" tx_retr="<<station->m_tx_retr<<
- " rate="<<station->m_txrate<<" n-supported-rates="<<GetNSupported (station));
- if (!IsMinRate (station))
+ NS_LOG_DEBUG ("-- success=" << station->m_success << " successThreshold=" << station->m_successThreshold <<
+ " tx_ok=" << station->m_tx_ok << " tx_err=" << station->m_tx_err << " tx_retr=" << station->m_tx_retr <<
+ " rate=" << station->m_txrate << " n-supported-rates=" << GetNSupported (station));
+ if (!IsMinRate (station))
{
- if (station->m_recovery)
+ if (station->m_recovery)
{
station->m_successThreshold *= 2;
station->m_successThreshold = std::min (station->m_successThreshold,
m_maxSuccessThreshold);
- }
- else
+ }
+ else
{
station->m_successThreshold = m_minSuccessThreshold;
}
station->m_recovery = false;
DecreaseRate (station);
needChange = true;
- }
- else
+ }
+ else
{
station->m_recovery = false;
}
}
- if (IsEnough (station) || needChange)
+ if (IsEnough (station) || needChange)
{
NS_LOG_DEBUG ("Reset");
ResetCnt (station);
}
}
-WifiMode
+WifiMode
AmrrWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
{
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
@@ -292,7 +296,7 @@
return GetSupported (station, rateIndex);
}
-WifiMode
+WifiMode
AmrrWifiManager::DoGetRtsMode (WifiRemoteStation *st)
{
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
@@ -302,7 +306,7 @@
}
-bool
+bool
AmrrWifiManager::IsLowLatency (void) const
{
return true;
--- a/src/wifi/model/amrr-wifi-manager.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/amrr-wifi-manager.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2003,2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -33,7 +33,7 @@
*
* This class implements the AMRR rate control algorithm which
* was initially described in <i>IEEE 802.11 Rate Adaptation:
- * A Practical Approach</i>, by M. Lacage, M.H. Manshaei, and
+ * A Practical Approach</i>, by M. Lacage, M.H. Manshaei, and
* T. Turletti.
*/
class AmrrWifiManager : public WifiRemoteStationManager
@@ -45,8 +45,8 @@
private:
// overriden from base class
- virtual WifiRemoteStation *DoCreateStation (void) const;
- virtual void DoReportRxOk (WifiRemoteStation *station,
+ virtual WifiRemoteStation * DoCreateStation (void) const;
+ virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
virtual void DoReportRtsFailed (WifiRemoteStation *station);
virtual void DoReportDataFailed (WifiRemoteStation *station);
--- a/src/wifi/model/amsdu-subframe-header.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/amsdu-subframe-header.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -30,11 +30,11 @@
static TypeId tid = TypeId ("ns3::AmsduSubframeHeader")
.SetParent<Header> ()
.AddConstructor<AmsduSubframeHeader> ()
- ;
- return tid;
+ ;
+ return tid;
}
-TypeId
+TypeId
AmsduSubframeHeader::GetInstanceTypeId (void) const
{
return GetTypeId ();
@@ -42,10 +42,12 @@
AmsduSubframeHeader::AmsduSubframeHeader ()
: m_length (0)
-{}
+{
+}
AmsduSubframeHeader::~AmsduSubframeHeader ()
-{}
+{
+}
uint32_t
AmsduSubframeHeader::GetSerializedSize () const
@@ -106,7 +108,7 @@
{
return m_sa;
}
-
+
uint16_t
AmsduSubframeHeader::GetLength (void) const
{
--- a/src/wifi/model/amsdu-subframe-header.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/amsdu-subframe-header.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -27,16 +27,15 @@
/**
* \ingroup wifi
- *
- *
+ *
+ *
*/
class AmsduSubframeHeader : public Header
{
public:
-
AmsduSubframeHeader ();
virtual ~AmsduSubframeHeader ();
-
+
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
virtual void Print (std::ostream &os) const;
--- a/src/wifi/model/ap-wifi-mac.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/ap-wifi-mac.cc Sat May 07 21:49:46 2011 +0200
@@ -68,9 +68,9 @@
{
NS_LOG_FUNCTION (this);
m_beaconDca = CreateObject<DcaTxop> ();
- m_beaconDca->SetAifsn(1);
- m_beaconDca->SetMinCw(0);
- m_beaconDca->SetMaxCw(0);
+ m_beaconDca->SetAifsn (1);
+ m_beaconDca->SetMinCw (0);
+ m_beaconDca->SetMaxCw (0);
m_beaconDca->SetLow (m_low);
m_beaconDca->SetManager (m_dcfManager);
@@ -374,10 +374,10 @@
NS_LOG_FUNCTION (this);
RegularWifiMac::TxOk (hdr);
- if (hdr.IsAssocResp () &&
- m_stationManager->IsWaitAssocTxOk (hdr.GetAddr1 ()))
+ if (hdr.IsAssocResp ()
+ && m_stationManager->IsWaitAssocTxOk (hdr.GetAddr1 ()))
{
- NS_LOG_DEBUG ("associated with sta="<<hdr.GetAddr1 ());
+ NS_LOG_DEBUG ("associated with sta=" << hdr.GetAddr1 ());
m_stationManager->RecordGotAssocTxOk (hdr.GetAddr1 ());
}
}
@@ -388,10 +388,10 @@
NS_LOG_FUNCTION (this);
RegularWifiMac::TxFailed (hdr);
- if (hdr.IsAssocResp () &&
- m_stationManager->IsWaitAssocTxOk (hdr.GetAddr1 ()))
+ if (hdr.IsAssocResp ()
+ && m_stationManager->IsWaitAssocTxOk (hdr.GetAddr1 ()))
{
- NS_LOG_DEBUG ("assoc failed with sta="<<hdr.GetAddr1 ());
+ NS_LOG_DEBUG ("assoc failed with sta=" << hdr.GetAddr1 ());
m_stationManager->RecordGotAssocTxFailed (hdr.GetAddr1 ());
}
}
@@ -406,20 +406,20 @@
if (hdr->IsData ())
{
Mac48Address bssid = hdr->GetAddr1 ();
- if (!hdr->IsFromDs () &&
- hdr->IsToDs () &&
- bssid == GetAddress () &&
- m_stationManager->IsAssociated (from))
+ if (!hdr->IsFromDs ()
+ && hdr->IsToDs ()
+ && bssid == GetAddress ()
+ && m_stationManager->IsAssociated (from))
{
Mac48Address to = hdr->GetAddr3 ();
if (to == GetAddress ())
{
- NS_LOG_DEBUG ("frame for me from="<<from);
+ NS_LOG_DEBUG ("frame for me from=" << from);
if (hdr->IsQosData ())
{
if (hdr->IsQosAmsdu ())
{
- NS_LOG_DEBUG ("Received A-MSDU from="<<from<<", size="<<packet->GetSize ());
+ NS_LOG_DEBUG ("Received A-MSDU from=" << from << ", size=" << packet->GetSize ());
DeaggregateAmsduAndForward (packet, hdr);
packet = 0;
}
@@ -433,10 +433,10 @@
ForwardUp (packet, from, bssid);
}
}
- else if (to.IsGroup () ||
- m_stationManager->IsAssociated (to))
+ else if (to.IsGroup ()
+ || m_stationManager->IsAssociated (to))
{
- NS_LOG_DEBUG ("forwarding frame from="<<from<<", to="<<to);
+ NS_LOG_DEBUG ("forwarding frame from=" << from << ", to=" << to);
Ptr<Packet> copy = packet->Copy ();
// If the frame we are forwarding is of type QoS Data,
@@ -457,8 +457,8 @@
ForwardUp (packet, from, to);
}
}
- else if (hdr->IsFromDs () &&
- hdr->IsToDs ())
+ else if (hdr->IsFromDs ()
+ && hdr->IsToDs ())
{
// this is an AP-to-AP frame
// we ignore for now.
@@ -557,7 +557,7 @@
{
Mac48Address from = (*i).second.GetSourceAddr ();
Mac48Address to = (*i).second.GetDestinationAddr ();
- NS_LOG_DEBUG ("forwarding QoS frame from="<<from<<", to="<<to);
+ NS_LOG_DEBUG ("forwarding QoS frame from=" << from << ", to=" << to);
ForwardDown ((*i).first, from, to, hdr->GetQosTid ());
}
}
--- a/src/wifi/model/arf-wifi-manager.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/arf-wifi-manager.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2004,2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -35,7 +35,7 @@
uint32_t m_failed;
bool m_recovery;
uint32_t m_retry;
-
+
uint32_t m_timerTimeout;
uint32_t m_successThreshold;
@@ -44,7 +44,7 @@
NS_OBJECT_ENSURE_REGISTERED (ArfWifiManager);
-TypeId
+TypeId
ArfWifiManager::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::ArfWifiManager")
@@ -59,14 +59,16 @@
UintegerValue (10),
MakeUintegerAccessor (&ArfWifiManager::m_successThreshold),
MakeUintegerChecker<uint32_t> ())
- ;
+ ;
return tid;
}
ArfWifiManager::ArfWifiManager ()
-{}
+{
+}
ArfWifiManager::~ArfWifiManager ()
-{}
+{
+}
WifiRemoteStation *
ArfWifiManager::DoCreateStation (void) const
{
@@ -84,9 +86,10 @@
return station;
}
-void
+void
ArfWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
-{}
+{
+}
/**
* It is important to realize that "recovery" mode starts after failure of
* the first transmission after a rate increase and ends at the first successful
@@ -96,7 +99,7 @@
* The fundamental reason for this is that there is a backoff between each data
* transmission, be it an initial transmission or a retransmission.
*/
-void
+void
ArfWifiManager::DoReportDataFailed (WifiRemoteStation *st)
{
ArfWifiRemoteStation *station = (ArfWifiRemoteStation *)st;
@@ -105,7 +108,7 @@
station->m_retry++;
station->m_success = 0;
- if (station->m_recovery)
+ if (station->m_recovery)
{
NS_ASSERT (station->m_retry >= 1);
if (station->m_retry == 1)
@@ -117,8 +120,8 @@
}
}
station->m_timer = 0;
- }
- else
+ }
+ else
{
NS_ASSERT (station->m_retry >= 1);
if (((station->m_retry - 1) % 2) == 1)
@@ -129,20 +132,21 @@
station->m_rate--;
}
}
- if (station->m_retry >= 2)
+ if (station->m_retry >= 2)
{
station->m_timer = 0;
}
}
}
-void
+void
ArfWifiManager::DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode)
-{}
+{
+}
void ArfWifiManager::DoReportRtsOk (WifiRemoteStation *station,
double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
- NS_LOG_DEBUG ("station="<<station<<" rts ok");
+ NS_LOG_DEBUG ("station=" << station << " rts ok");
}
void ArfWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
@@ -154,23 +158,25 @@
station->m_recovery = false;
station->m_retry = 0;
NS_LOG_DEBUG ("station=" << station << " data ok success=" << station->m_success << ", timer=" << station->m_timer);
- if ((station->m_success == m_successThreshold ||
- station->m_timer == m_timerThreshold) &&
- (station->m_rate < (station->m_state->m_operationalRateSet.size () - 1)))
+ if ((station->m_success == m_successThreshold
+ || station->m_timer == m_timerThreshold)
+ && (station->m_rate < (station->m_state->m_operationalRateSet.size () - 1)))
{
- NS_LOG_DEBUG ("station="<<station<<" inc rate");
+ NS_LOG_DEBUG ("station=" << station << " inc rate");
station->m_rate++;
station->m_timer = 0;
station->m_success = 0;
station->m_recovery = true;
}
}
-void
+void
ArfWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
-{}
-void
+{
+}
+void
ArfWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
-{}
+{
+}
WifiMode
ArfWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
@@ -187,7 +193,7 @@
return GetSupported (station, 0);
}
-bool
+bool
ArfWifiManager::IsLowLatency (void) const
{
return true;
--- a/src/wifi/model/arf-wifi-manager.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/arf-wifi-manager.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -29,14 +29,14 @@
* \brief ARF Rate control algorithm
*
* This class implements the so-called ARF algorithm which was
- * initially described in <i>WaveLAN-II: A High-performance wireless
+ * initially described in <i>WaveLAN-II: A High-performance wireless
* LAN for the unlicensed band</i>, by A. Kamerman and L. Monteban. in
* Bell Lab Technical Journal, pages 118-133, Summer 1997.
*
* This implementation differs from the initial description in that it
- * uses a packet-based timer rather than a time-based timer as described
+ * uses a packet-based timer rather than a time-based timer as described
* in XXX (I cannot find back the original paper which described how
- * the time-based timer could be easily replaced with a packet-based
+ * the time-based timer could be easily replaced with a packet-based
* timer.)
*/
class ArfWifiManager : public WifiRemoteStationManager
@@ -48,8 +48,8 @@
private:
// overriden from base class
- virtual WifiRemoteStation *DoCreateStation (void) const;
- virtual void DoReportRxOk (WifiRemoteStation *station,
+ virtual WifiRemoteStation * DoCreateStation (void) const;
+ virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
virtual void DoReportRtsFailed (WifiRemoteStation *station);
virtual void DoReportDataFailed (WifiRemoteStation *station);
--- a/src/wifi/model/block-ack-agreement.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/block-ack-agreement.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -22,15 +22,16 @@
namespace ns3 {
BlockAckAgreement::BlockAckAgreement ()
- : m_amsduSupported (0),
- m_blockAckPolicy (1),
- m_inactivityEvent ()
-{}
+ : m_amsduSupported (0),
+ m_blockAckPolicy (1),
+ m_inactivityEvent ()
+{
+}
BlockAckAgreement::BlockAckAgreement (Mac48Address peer, uint8_t tid)
- : m_amsduSupported (0),
- m_blockAckPolicy (1),
- m_inactivityEvent ()
+ : m_amsduSupported (0),
+ m_blockAckPolicy (1),
+ m_inactivityEvent ()
{
m_tid = tid;
m_peer = peer;
@@ -103,7 +104,7 @@
uint16_t
BlockAckAgreement::GetStartingSequenceControl (void) const
{
- uint16_t seqControl = (m_startingSeq<<4) | 0xfff0;
+ uint16_t seqControl = (m_startingSeq << 4) | 0xfff0;
return seqControl;
}
bool
@@ -114,7 +115,7 @@
bool
BlockAckAgreement::IsAmsduSupported (void) const
{
- return (m_amsduSupported == 1)?true:false;
+ return (m_amsduSupported == 1) ? true : false;
}
} //namespace ns3
--- a/src/wifi/model/block-ack-agreement.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/block-ack-agreement.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -28,7 +28,7 @@
* \brief Maintains information for a block ack agreement.
* \ingroup wifi
*/
-class BlockAckAgreement
+class BlockAckAgreement
{
friend class MacLow;
public:
@@ -52,7 +52,6 @@
bool IsAmsduSupported (void) const;
protected:
-
Mac48Address m_peer;
uint8_t m_amsduSupported;
uint8_t m_blockAckPolicy; /* represents type of block ack: immediate or delayed */
@@ -60,7 +59,7 @@
uint16_t m_bufferSize;
uint16_t m_timeout;
uint16_t m_startingSeq;
-
+
EventId m_inactivityEvent;
};
--- a/src/wifi/model/block-ack-cache.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/block-ack-cache.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2010 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -53,7 +53,7 @@
WINSIZE_ASSERT;
}
- m_bitmap[seqNumber] |= (0x0001<<hdr->GetFragmentNumber ());
+ m_bitmap[seqNumber] |= (0x0001 << hdr->GetFragmentNumber ());
}
}
@@ -91,7 +91,7 @@
uint32_t i = start;
for (; i != end; i = (i + 1) % 4096)
{
- m_bitmap[i] = 0;
+ m_bitmap[i] = 0;
}
m_bitmap[i] = 0;
}
@@ -112,7 +112,7 @@
else if (blockAckHeader->IsCompressed ())
{
uint32_t i = blockAckHeader->GetStartingSequence ();
- uint32_t end = ((i + m_winSize) % 4096) - 1;
+ uint32_t end = ((i + m_winSize) % 4096) - 1;
for (; i != end; i = (i + 1) % 4096)
{
if (m_bitmap[i] == 1)
--- a/src/wifi/model/block-ack-cache.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/block-ack-cache.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2010 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -29,8 +29,8 @@
/**
* \ingroup wifi
- *
- *
+ *
+ *
*/
class BlockAckCache
{
--- a/src/wifi/model/block-ack-manager.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/block-ack-manager.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009, 2010 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -36,21 +36,31 @@
namespace ns3 {
BlockAckManager::Item::Item ()
-{}
+{
+}
BlockAckManager::Item::Item (Ptr<const Packet> packet, const WifiMacHeader &hdr, Time tStamp)
- : packet (packet), hdr (hdr), timestamp (tStamp)
-{}
+ : packet (packet),
+ hdr (hdr),
+ timestamp (tStamp)
+{
+}
Bar::Bar ()
-{}
+{
+}
Bar::Bar (Ptr<const Packet> bar, Mac48Address recipient, uint8_t tid, bool immediate)
- : bar (bar), recipient (recipient), tid (tid), immediate (immediate)
-{}
+ : bar (bar),
+ recipient (recipient),
+ tid (tid),
+ immediate (immediate)
+{
+}
BlockAckManager::BlockAckManager ()
-{}
+{
+}
BlockAckManager::~BlockAckManager ()
{
@@ -66,14 +76,15 @@
}
bool
-BlockAckManager::ExistsAgreementInState (Mac48Address recipient, uint8_t tid,
+BlockAckManager::ExistsAgreementInState (Mac48Address recipient, uint8_t tid,
enum OriginatorBlockAckAgreement::State state) const
{
AgreementsCI it;
it = m_agreements.find (std::make_pair (recipient, tid));
if (it != m_agreements.end ())
{
- switch (state) {
+ switch (state)
+ {
case OriginatorBlockAckAgreement::INACTIVE:
return it->second.first.IsInactive ();
case OriginatorBlockAckAgreement::ESTABLISHED:
@@ -84,7 +95,7 @@
return it->second.first.IsUnsuccessful ();
default:
NS_FATAL_ERROR ("Invalid state for block ack agreement");
- }
+ }
}
return false;
}
@@ -95,7 +106,7 @@
pair<Mac48Address, uint8_t> key (recipient, reqHdr->GetTid ());
OriginatorBlockAckAgreement agreement (recipient, reqHdr->GetTid ());
agreement.SetStartingSequence (reqHdr->GetStartingSequence ());
- /* for now we assume that originator doesn't use this field. Use of this field
+ /* for now we assume that originator doesn't use this field. Use of this field
is mandatory only for recipient */
agreement.SetBufferSize (0);
agreement.SetTimeout (reqHdr->GetTimeout ());
@@ -103,13 +114,13 @@
if (reqHdr->IsImmediateBlockAck ())
{
agreement.SetImmediateBlockAck ();
- }
+ }
else
{
agreement.SetDelayedBlockAck ();
}
agreement.SetState (OriginatorBlockAckAgreement::PENDING);
- PacketQueue queue(0);
+ PacketQueue queue (0);
pair<OriginatorBlockAckAgreement, PacketQueue> value (agreement, queue);
m_agreements.insert (make_pair (key, value));
m_blockPackets (recipient, reqHdr->GetTid ());
@@ -162,7 +173,7 @@
if (respHdr->IsImmediateBlockAck ())
{
agreement.SetImmediateBlockAck ();
- }
+ }
else
{
agreement.SetDelayedBlockAck ();
@@ -171,8 +182,8 @@
if (agreement.GetTimeout () != 0)
{
Time timeout = MicroSeconds (1024 * agreement.GetTimeout ());
- agreement.m_inactivityEvent = Simulator::Schedule (timeout,
- &BlockAckManager::InactivityTimeout,
+ agreement.m_inactivityEvent = Simulator::Schedule (timeout,
+ &BlockAckManager::InactivityTimeout,
this,
recipient, tid);
}
@@ -208,12 +219,12 @@
packet = queueIt->packet;
hdr = queueIt->hdr;
hdr.SetRetry ();
- NS_LOG_INFO ("Retry packet seq="<<hdr.GetSequenceNumber ());
+ NS_LOG_INFO ("Retry packet seq=" << hdr.GetSequenceNumber ());
uint8_t tid = hdr.GetQosTid ();
Mac48Address recipient = hdr.GetAddr1 ();
- if (ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::ESTABLISHED) ||
- SwitchToBlockAckIfNeeded (recipient, tid, hdr.GetSequenceNumber ()))
+ if (ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::ESTABLISHED)
+ || SwitchToBlockAckIfNeeded (recipient, tid, hdr.GetSequenceNumber ()))
{
hdr.SetQosAckPolicy (WifiMacHeader::BLOCK_ACK);
}
@@ -223,7 +234,7 @@
* In order to improve efficiency, originators using the Block Ack facility
* may send MPDU frames with the Ack Policy subfield in QoS control frames
* set to Normal Ack if only a few MPDUs are available for transmission.[...]
- * When there are sufficient number of MPDUs, the originator may switch back to
+ * When there are sufficient number of MPDUs, the originator may switch back to
* the use of Block Ack.
*/
hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
@@ -323,13 +334,13 @@
if (it->second.first.m_inactivityEvent.IsRunning ())
{
- /* Upon reception of a block ack frame, the inactivity timer at the
- originator must be reset.
+ /* Upon reception of a block ack frame, the inactivity timer at the
+ originator must be reset.
For more details see section 11.5.3 in IEEE802.11e standard */
it->second.first.m_inactivityEvent.Cancel ();
Time timeout = MicroSeconds (1024 * it->second.first.GetTimeout ());
it->second.first.m_inactivityEvent = Simulator::Schedule (timeout,
- &BlockAckManager::InactivityTimeout,
+ &BlockAckManager::InactivityTimeout,
this,
recipient, tid);
}
@@ -362,8 +373,8 @@
if (blockAck->IsPacketReceived ((*queueIt).hdr.GetSequenceNumber ()))
{
uint16_t currentSeq = (*queueIt).hdr.GetSequenceNumber ();
- while (queueIt != queueEnd &&
- (*queueIt).hdr.GetSequenceNumber () == currentSeq)
+ while (queueIt != queueEnd
+ && (*queueIt).hdr.GetSequenceNumber () == currentSeq)
{
queueIt = it->second.second.erase (queueIt);
}
@@ -382,8 +393,8 @@
}
}
uint16_t newSeq = m_txMiddle->GetNextSeqNumberByTidAndAddress (tid, recipient);
- if ((foundFirstLost && !SwitchToBlockAckIfNeeded (recipient, tid, sequenceFirstLost)) ||
- (!foundFirstLost && !SwitchToBlockAckIfNeeded (recipient, tid, newSeq)))
+ if ((foundFirstLost && !SwitchToBlockAckIfNeeded (recipient, tid, sequenceFirstLost))
+ || (!foundFirstLost && !SwitchToBlockAckIfNeeded (recipient, tid, newSeq)))
{
it->second.first.SetState (OriginatorBlockAckAgreement::INACTIVE);
}
@@ -414,9 +425,9 @@
AgreementsI it = m_agreements.find (std::make_pair (recipient, tid));
NS_ASSERT (it != m_agreements.end ());
- if ((*it).second.first.IsBlockAckRequestNeeded () ||
- (GetNRetryNeededPackets (recipient, tid) == 0 &&
- m_queue->GetNPacketsByTidAndAddress (tid, WifiMacHeader::ADDR1, recipient) == 0))
+ if ((*it).second.first.IsBlockAckRequestNeeded ()
+ || (GetNRetryNeededPackets (recipient, tid) == 0
+ && m_queue->GetNPacketsByTidAndAddress (tid, WifiMacHeader::ADDR1, recipient) == 0))
{
OriginatorBlockAckAgreement &agreement = (*it).second.first;
agreement.CompleteExchange ();
@@ -455,7 +466,7 @@
NS_LOG_FUNCTION (this);
AgreementsI it = m_agreements.find (std::make_pair (recipient, tid));
NS_ASSERT (it != m_agreements.end ());
-
+
it->second.first.SetState (OriginatorBlockAckAgreement::ESTABLISHED);
it->second.first.SetStartingSequence (startingSeq);
}
@@ -512,7 +523,7 @@
if (!ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::UNSUCCESSFUL) && ExistsAgreement (recipient, tid))
{
uint32_t packets = m_queue->GetNPacketsByTidAndAddress (tid, WifiMacHeader::ADDR1, recipient) +
- GetNBufferedPackets (recipient, tid);
+ GetNBufferedPackets (recipient, tid);
if (packets >= m_blockAckThreshold)
{
NotifyAgreementEstablished (recipient, tid, startingSeq);
@@ -559,17 +570,17 @@
void
BlockAckManager::CleanupBuffers (void)
{
- for (AgreementsI j = m_agreements.begin(); j != m_agreements.end (); j++)
+ for (AgreementsI j = m_agreements.begin (); j != m_agreements.end (); j++)
{
- if (j->second.second.empty ())
+ if (j->second.second.empty ())
{
continue;
}
Time now = Simulator::Now ();
PacketQueueI end = j->second.second.begin ();
- for (PacketQueueI i = j->second.second.begin (); i != j->second.second.end (); i++)
+ for (PacketQueueI i = j->second.second.begin (); i != j->second.second.end (); i++)
{
- if (i->timestamp + m_maxDelay > now)
+ if (i->timestamp + m_maxDelay > now)
{
end = i;
break;
@@ -579,9 +590,9 @@
/* remove retry packet iterator if it's present in retry queue */
for (list<PacketQueueI>::iterator it = m_retryPackets.begin (); it != m_retryPackets.end (); it++)
{
- if ((*it)->hdr.GetAddr1 () == j->second.first.GetPeer () &&
- (*it)->hdr.GetQosTid () == j->second.first.GetTid () &&
- (*it)->hdr.GetSequenceNumber () == i->hdr.GetSequenceNumber ())
+ if ((*it)->hdr.GetAddr1 () == j->second.first.GetPeer ()
+ && (*it)->hdr.GetQosTid () == j->second.first.GetTid ()
+ && (*it)->hdr.GetSequenceNumber () == i->hdr.GetSequenceNumber ())
{
m_retryPackets.erase (it);
}
--- a/src/wifi/model/block-ack-manager.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/block-ack-manager.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009, 2010 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -43,19 +43,20 @@
/**
* \ingroup wifi
- * \brief Block Ack Request
- *
+ * \brief Block Ack Request
+ *
*/
-struct Bar {
- Bar ();
- Bar (Ptr<const Packet> packet,
- Mac48Address recipient,
- uint8_t tid,
- bool immediate);
- Ptr<const Packet> bar;
- Mac48Address recipient;
- uint8_t tid;
- bool immediate;
+struct Bar
+{
+ Bar ();
+ Bar (Ptr<const Packet> packet,
+ Mac48Address recipient,
+ uint8_t tid,
+ bool immediate);
+ Ptr<const Packet> bar;
+ Mac48Address recipient;
+ uint8_t tid;
+ bool immediate;
};
/**
@@ -75,7 +76,7 @@
* \param recipient Address of peer station involved in block ack mechanism.
* \param tid Traffic ID.
*
- * Checks if a block ack agreement exists with station addressed by
+ * Checks if a block ack agreement exists with station addressed by
* <i>recipient</i> for tid <i>tid</i>.
*/
bool ExistsAgreement (Mac48Address recipient, uint8_t tid) const;
@@ -87,17 +88,17 @@
* Checks if a block ack agreement with a state equals to <i>state</i> exists with
* station addressed by <i>recipient</i> for tid <i>tid</i>.
*/
- bool ExistsAgreementInState (Mac48Address recipient, uint8_t tid,
+ bool ExistsAgreementInState (Mac48Address recipient, uint8_t tid,
enum OriginatorBlockAckAgreement::State state) const;
- /**
+ /**
* \param reqHdr Relative Add block ack request (action frame).
* \param recipient Address of peer station involved in block ack mechanism.
*
- * Creates a new block ack agreement in pending state. When a ADDBA response
- * with a successful status code is received, the relative agreement becomes established.
+ * Creates a new block ack agreement in pending state. When a ADDBA response
+ * with a successful status code is received, the relative agreement becomes established.
*/
void CreateAgreement (const MgtAddBaRequestHeader *reqHdr, Mac48Address recipient);
- /**
+ /**
* \param recipient Address of peer station involved in block ack mechanism.
* \param tid Tid Traffic id of transmitted packet.
*
@@ -140,15 +141,15 @@
*
* Invoked upon receipt of a block ack frame. Typically, this function, is called
* by ns3::EdcaTxopN object. Performs a check on which MPDUs, previously sent
- * with ack policy set to Block Ack, were correctly received by the recipient.
- * An acknowledged MPDU is removed from the buffer, retransmitted otherwise.
+ * with ack policy set to Block Ack, were correctly received by the recipient.
+ * An acknowledged MPDU is removed from the buffer, retransmitted otherwise.
*/
void NotifyGotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient);
/**
* \param recipient Address of peer station involved in block ack mechanism.
* \param tid Traffic ID.
*
- * Returns number of packets buffered for a specified agreement. This methods doesn't return
+ * Returns number of packets buffered for a specified agreement. This methods doesn't return
* number of buffered MPDUs but number of buffered MSDUs.
*/
uint32_t GetNBufferedPackets (Mac48Address recipient, uint8_t tid) const;
@@ -166,7 +167,7 @@
* \param startingSeq starting sequence field
*
* Puts corresponding agreement in established state and updates number of packets
- * and starting sequence field. Invoked typically after a block ack refresh.
+ * and starting sequence field. Invoked typically after a block ack refresh.
*/
void NotifyAgreementEstablished (Mac48Address recipient, uint8_t tid, uint16_t startingSeq);
/**
@@ -192,7 +193,7 @@
* \param nPackets Minimum number of packets for use of block ack.
*
* Upon receipt of a block ack frame, if total number of packets (packets in WifiMacQueue
- * and buffered packets) is greater of <i>nPackets</i>, they are transmitted using block ack mechanism.
+ * and buffered packets) is greater of <i>nPackets</i>, they are transmitted using block ack mechanism.
*/
void SetBlockAckThreshold (uint8_t nPackets);
/**
@@ -215,7 +216,7 @@
*/
void TearDownBlockAck (Mac48Address recipient, uint8_t tid);
/**
- * \param sequenceNumber Sequence number of the packet which fragment is
+ * \param sequenceNumber Sequence number of the packet which fragment is
* part of.
*
* Returns true if another fragment with sequence number <i>sequenceNumber</i> is scheduled
@@ -228,7 +229,7 @@
uint32_t GetNextPacketSize (void) const;
/**
* \param maxDelay Max delay for a buffered packet.
- *
+ *
* This method is always called by ns3::WifiMacQueue object and sets max delay equals
* to ns3:WifiMacQueue delay value.
*/
@@ -241,7 +242,7 @@
/**
* Checks if there are in the queue other packets that could be send under block ack.
* If yes adds these packets in current block ack exchange.
- * However, number of packets exchanged in the current block ack, will not exceed
+ * However, number of packets exchanged in the current block ack, will not exceed
* the value of BufferSize in the corresponding OriginatorBlockAckAgreement object.
*/
bool SwitchToBlockAckIfNeeded (Mac48Address recipient, uint8_t tid, uint16_t startingSeq);
@@ -254,7 +255,7 @@
private:
/**
* Checks if all packets, for which a block ack agreement was established or refreshed,
- * have been transmitted. If yes, adds a pair in m_bAckReqs to indicate that
+ * have been transmitted. If yes, adds a pair in m_bAckReqs to indicate that
* at next channel access a block ack request (for established agreement
* <i>recipient</i>,<i>tid</i>) is needed.
*/
@@ -269,15 +270,16 @@
typedef std::list<Item> PacketQueue;
typedef std::list<Item>::iterator PacketQueueI;
typedef std::list<Item>::const_iterator PacketQueueCI;
-
- typedef std::map<std::pair<Mac48Address, uint8_t>,
- std::pair<OriginatorBlockAckAgreement, PacketQueue> > Agreements;
- typedef std::map<std::pair<Mac48Address, uint8_t>,
- std::pair<OriginatorBlockAckAgreement, PacketQueue> >::iterator AgreementsI;
- typedef std::map<std::pair<Mac48Address, uint8_t>,
- std::pair<OriginatorBlockAckAgreement, PacketQueue> >::const_iterator AgreementsCI;
- struct Item {
+ typedef std::map<std::pair<Mac48Address, uint8_t>,
+ std::pair<OriginatorBlockAckAgreement, PacketQueue> > Agreements;
+ typedef std::map<std::pair<Mac48Address, uint8_t>,
+ std::pair<OriginatorBlockAckAgreement, PacketQueue> >::iterator AgreementsI;
+ typedef std::map<std::pair<Mac48Address, uint8_t>,
+ std::pair<OriginatorBlockAckAgreement, PacketQueue> >::const_iterator AgreementsCI;
+
+ struct Item
+ {
Item ();
Item (Ptr<const Packet> packet,
const WifiMacHeader &hdr,
@@ -286,11 +288,11 @@
WifiMacHeader hdr;
Time timestamp;
};
-
+
/**
* This data structure contains, for each block ack agreement (recipient, tid), a set of packets
* for which an ack by block ack is requested.
- * Every packet or fragment indicated as correctly received in block ack frame is
+ * Every packet or fragment indicated as correctly received in block ack frame is
* erased from this data structure. Pushed back in retransmission queue otherwise.
*/
Agreements m_agreements;
@@ -301,7 +303,7 @@
*/
std::list<PacketQueueI> m_retryPackets;
std::list<Bar> m_bars;
-
+
uint8_t m_blockAckThreshold;
enum BlockAckType m_blockAckType;
Time m_maxDelay;
--- a/src/wifi/model/capability-information.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/capability-information.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -23,27 +23,28 @@
CapabilityInformation::CapabilityInformation ()
: m_capability (0)
-{}
+{
+}
-void
+void
CapabilityInformation::SetEss (void)
{
Set (0);
Clear (1);
}
-void
+void
CapabilityInformation::SetIbss (void)
{
Clear (0);
Set (1);
}
-bool
+bool
CapabilityInformation::IsEss (void) const
{
return Is (0);
}
-bool
+bool
CapabilityInformation::IsIbss (void) const
{
return Is (1);
@@ -52,37 +53,37 @@
void
CapabilityInformation::Set (uint8_t n)
{
- uint32_t mask = 1<<n;
+ uint32_t mask = 1 << n;
m_capability |= mask;
}
void
CapabilityInformation::Clear (uint8_t n)
{
- uint32_t mask = 1<<n;
+ uint32_t mask = 1 << n;
m_capability &= ~mask;
}
bool
CapabilityInformation::Is (uint8_t n) const
{
- uint32_t mask = 1<<n;
+ uint32_t mask = 1 << n;
return (m_capability & mask) == mask;
}
-uint32_t
+uint32_t
CapabilityInformation::GetSerializedSize (void) const
{
return 2;
}
-Buffer::Iterator
+Buffer::Iterator
CapabilityInformation::Serialize (Buffer::Iterator start) const
{
start.WriteHtolsbU16 (m_capability);
return start;
}
-Buffer::Iterator
+Buffer::Iterator
CapabilityInformation::Deserialize (Buffer::Iterator start)
{
m_capability = start.ReadLsbtohU16 ();
--- a/src/wifi/model/capability-information.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/capability-information.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -27,10 +27,10 @@
/**
* \ingroup wifi
- *
- *
+ *
+ *
*/
-class CapabilityInformation
+class CapabilityInformation
{
public:
CapabilityInformation ();
--- a/src/wifi/model/cara-wifi-manager.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/cara-wifi-manager.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2004,2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -34,47 +34,49 @@
{
uint32_t m_timer;
uint32_t m_success;
- uint32_t m_failed;
+ uint32_t m_failed;
uint32_t m_rate;
};
-NS_OBJECT_ENSURE_REGISTERED(CaraWifiManager);
+NS_OBJECT_ENSURE_REGISTERED (CaraWifiManager);
-TypeId
+TypeId
CaraWifiManager::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::CaraWifiManager")
- .SetParent<WifiRemoteStationManager> ()
- .AddConstructor<CaraWifiManager> ()
- .AddAttribute ("ProbeThreshold",
- "The number of consecutive transmissions failure to activate the RTS probe.",
- UintegerValue (1),
- MakeUintegerAccessor (&CaraWifiManager::m_probeThreshold),
- MakeUintegerChecker<uint32_t> ())
- .AddAttribute ("FailureThreshold",
- "The number of consecutive transmissions failure to decrease the rate.",
- UintegerValue (2),
- MakeUintegerAccessor (&CaraWifiManager::m_failureThreshold),
- MakeUintegerChecker<uint32_t> ())
- .AddAttribute ("SuccessThreshold",
- "The minimum number of sucessfull transmissions to try a new rate.",
- UintegerValue (10),
- MakeUintegerAccessor (&CaraWifiManager::m_successThreshold),
- MakeUintegerChecker<uint32_t> ())
- .AddAttribute ("Timeout",
- "The 'timer' in the CARA algorithm",
- UintegerValue (15),
- MakeUintegerAccessor (&CaraWifiManager::m_timerTimeout),
- MakeUintegerChecker<uint32_t> ())
- ;
- return tid;
+ static TypeId tid = TypeId ("ns3::CaraWifiManager")
+ .SetParent<WifiRemoteStationManager> ()
+ .AddConstructor<CaraWifiManager> ()
+ .AddAttribute ("ProbeThreshold",
+ "The number of consecutive transmissions failure to activate the RTS probe.",
+ UintegerValue (1),
+ MakeUintegerAccessor (&CaraWifiManager::m_probeThreshold),
+ MakeUintegerChecker<uint32_t> ())
+ .AddAttribute ("FailureThreshold",
+ "The number of consecutive transmissions failure to decrease the rate.",
+ UintegerValue (2),
+ MakeUintegerAccessor (&CaraWifiManager::m_failureThreshold),
+ MakeUintegerChecker<uint32_t> ())
+ .AddAttribute ("SuccessThreshold",
+ "The minimum number of sucessfull transmissions to try a new rate.",
+ UintegerValue (10),
+ MakeUintegerAccessor (&CaraWifiManager::m_successThreshold),
+ MakeUintegerChecker<uint32_t> ())
+ .AddAttribute ("Timeout",
+ "The 'timer' in the CARA algorithm",
+ UintegerValue (15),
+ MakeUintegerAccessor (&CaraWifiManager::m_timerTimeout),
+ MakeUintegerChecker<uint32_t> ())
+ ;
+ return tid;
}
CaraWifiManager::CaraWifiManager ()
: WifiRemoteStationManager ()
-{}
+{
+}
CaraWifiManager::~CaraWifiManager ()
-{}
+{
+}
WifiRemoteStation *
CaraWifiManager::DoCreateStation (void) const
@@ -87,11 +89,12 @@
return station;
}
-void
+void
CaraWifiManager::DoReportRtsFailed (WifiRemoteStation *st)
-{}
+{
+}
-void
+void
CaraWifiManager::DoReportDataFailed (WifiRemoteStation *st)
{
CaraWifiRemoteStation *station = (CaraWifiRemoteStation *) st;
@@ -99,9 +102,9 @@
station->m_timer++;
station->m_failed++;
station->m_success = 0;
- if (station->m_failed >= m_failureThreshold)
+ if (station->m_failed >= m_failureThreshold)
{
- NS_LOG_DEBUG ("self="<<station<<" dec rate");
+ NS_LOG_DEBUG ("self=" << station << " dec rate");
if (station->m_rate != 0)
{
station->m_rate--;
@@ -110,47 +113,50 @@
station->m_timer = 0;
}
}
-void
+void
CaraWifiManager::DoReportRxOk (WifiRemoteStation *st,
- double rxSnr, WifiMode txMode)
-{}
-void
+ double rxSnr, WifiMode txMode)
+{
+}
+void
CaraWifiManager::DoReportRtsOk (WifiRemoteStation *st,
- double ctsSnr, WifiMode ctsMode, double rtsSnr)
+ double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
- NS_LOG_DEBUG ("self="<<st<<" rts ok");
+ NS_LOG_DEBUG ("self=" << st << " rts ok");
}
-void
+void
CaraWifiManager::DoReportDataOk (WifiRemoteStation *st,
- double ackSnr, WifiMode ackMode, double dataSnr)
+ double ackSnr, WifiMode ackMode, double dataSnr)
{
CaraWifiRemoteStation *station = (CaraWifiRemoteStation *) st;
station->m_timer++;
station->m_success++;
station->m_failed = 0;
- NS_LOG_DEBUG ("self="<<station<<" data ok success="<<station->m_success<<", timer="<<station->m_timer);
- if ((station->m_success == m_successThreshold ||
- station->m_timer >= m_timerTimeout))
+ NS_LOG_DEBUG ("self=" << station << " data ok success=" << station->m_success << ", timer=" << station->m_timer);
+ if ((station->m_success == m_successThreshold
+ || station->m_timer >= m_timerTimeout))
{
if (station->m_rate < GetNSupported (station) - 1)
{
station->m_rate++;
}
- NS_LOG_DEBUG ("self="<<station<<" inc rate=" << station->m_rate);
+ NS_LOG_DEBUG ("self=" << station << " inc rate=" << station->m_rate);
station->m_timer = 0;
station->m_success = 0;
}
}
-void
+void
CaraWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *st)
-{}
-void
+{
+}
+void
CaraWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
-{}
+{
+}
WifiMode
CaraWifiManager::DoGetDataMode (WifiRemoteStation *st,
- uint32_t size)
+ uint32_t size)
{
CaraWifiRemoteStation *station = (CaraWifiRemoteStation *) st;
return GetSupported (station, station->m_rate);
@@ -165,13 +171,13 @@
bool
CaraWifiManager::DoNeedRts (WifiRemoteStation *st,
- Ptr<const Packet> packet, bool normally)
+ Ptr<const Packet> packet, bool normally)
{
CaraWifiRemoteStation *station = (CaraWifiRemoteStation *) st;
return normally || station->m_failed >= m_probeThreshold;
}
-bool
+bool
CaraWifiManager::IsLowLatency (void) const
{
return true;
--- a/src/wifi/model/cara-wifi-manager.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/cara-wifi-manager.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -29,13 +29,13 @@
* \ingroup wifi
*
* Implement the CARA algorithm from:
- * J. Kim, S. Kim, S. Choi, and D. Qiao.
+ * J. Kim, S. Kim, S. Choi, and D. Qiao.
* "CARA: Collision-Aware Rate Adaptation for IEEE 802.11 WLANs."
*
- * Originally implemented by Federico Maguolo for a very early
+ * Originally implemented by Federico Maguolo for a very early
* prototype version of ns-3.
*/
-class CaraWifiManager : public WifiRemoteStationManager
+class CaraWifiManager : public WifiRemoteStationManager
{
public:
static TypeId GetTypeId (void);
@@ -44,8 +44,8 @@
private:
// overriden from base class
- virtual WifiRemoteStation *DoCreateStation (void) const;
- virtual void DoReportRxOk (WifiRemoteStation *station,
+ virtual WifiRemoteStation * DoCreateStation (void) const;
+ virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
virtual void DoReportRtsFailed (WifiRemoteStation *station);
virtual void DoReportDataFailed (WifiRemoteStation *station);
--- a/src/wifi/model/constant-rate-wifi-manager.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/constant-rate-wifi-manager.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2004,2005 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -27,7 +27,7 @@
NS_OBJECT_ENSURE_REGISTERED (ConstantRateWifiManager);
-TypeId
+TypeId
ConstantRateWifiManager::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::ConstantRateWifiManager")
@@ -41,14 +41,16 @@
StringValue ("OfdmRate6Mbps"),
MakeWifiModeAccessor (&ConstantRateWifiManager::m_ctlMode),
MakeWifiModeChecker ())
- ;
+ ;
return tid;
}
ConstantRateWifiManager::ConstantRateWifiManager ()
-{}
+{
+}
ConstantRateWifiManager::~ConstantRateWifiManager ()
-{}
+{
+}
WifiRemoteStation *
@@ -59,32 +61,37 @@
}
-void
+void
ConstantRateWifiManager::DoReportRxOk (WifiRemoteStation *station,
- double rxSnr, WifiMode txMode)
-{}
-void
+ double rxSnr, WifiMode txMode)
+{
+}
+void
ConstantRateWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
-{}
-void
+{
+}
+void
ConstantRateWifiManager::DoReportDataFailed (WifiRemoteStation *station)
-{}
-void
-ConstantRateWifiManager::DoReportRtsOk (WifiRemoteStation *st,
- double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
}
-void
-ConstantRateWifiManager::DoReportDataOk (WifiRemoteStation *st,
- double ackSnr, WifiMode ackMode, double dataSnr)
+void
+ConstantRateWifiManager::DoReportRtsOk (WifiRemoteStation *st,
+ double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
}
-void
+void
+ConstantRateWifiManager::DoReportDataOk (WifiRemoteStation *st,
+ double ackSnr, WifiMode ackMode, double dataSnr)
+{
+}
+void
ConstantRateWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
-{}
-void
+{
+}
+void
ConstantRateWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
-{}
+{
+}
WifiMode
ConstantRateWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
@@ -97,7 +104,7 @@
return m_ctlMode;
}
-bool
+bool
ConstantRateWifiManager::IsLowLatency (void) const
{
return true;
--- a/src/wifi/model/constant-rate-wifi-manager.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/constant-rate-wifi-manager.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -42,8 +42,8 @@
private:
// overriden from base class
- virtual WifiRemoteStation *DoCreateStation (void) const;
- virtual void DoReportRxOk (WifiRemoteStation *station,
+ virtual WifiRemoteStation* DoCreateStation (void) const;
+ virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
virtual void DoReportRtsFailed (WifiRemoteStation *station);
virtual void DoReportDataFailed (WifiRemoteStation *station);
--- a/src/wifi/model/ctrl-headers.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/ctrl-headers.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -33,10 +33,12 @@
: m_barAckPolicy (false),
m_multiTid (false),
m_compressed (false)
-{}
+{
+}
CtrlBAckRequestHeader::~CtrlBAckRequestHeader ()
-{}
+{
+}
TypeId
CtrlBAckRequestHeader::GetTypeId (void)
@@ -126,7 +128,7 @@
}
}
return i.GetDistanceFrom (start);
-}
+}
uint16_t
CtrlBAckRequestHeader::GetBarControl (void) const
@@ -138,22 +140,22 @@
}
if (m_multiTid)
{
- res |= (0x1<<1);
+ res |= (0x1 << 1);
}
if (m_compressed)
{
- res |= (0x1<<2);
+ res |= (0x1 << 2);
}
- res |= (m_tidInfo << 12) & (0xf<<12);
+ res |= (m_tidInfo << 12) & (0xf << 12);
return res;
}
void
CtrlBAckRequestHeader::SetBarControl (uint16_t bar)
{
- m_barAckPolicy = ((bar & 0x01) == 1)?true:false;
- m_multiTid = (((bar >> 1) & 0x01) == 1)?true:false;
- m_compressed = (((bar >> 2) & 0x01) == 1)?true:false;
+ m_barAckPolicy = ((bar & 0x01) == 1) ? true : false;
+ m_multiTid = (((bar >> 1) & 0x01) == 1) ? true : false;
+ m_compressed = (((bar >> 2) & 0x01) == 1) ? true : false;
m_tidInfo = (bar >> 12) & 0x0f;
}
@@ -178,7 +180,8 @@
void
CtrlBAckRequestHeader::SetType (enum BlockAckType type)
{
- switch (type) {
+ switch (type)
+ {
case BASIC_BLOCK_ACK:
m_multiTid = false;
m_compressed = false;
@@ -194,7 +197,7 @@
default:
NS_FATAL_ERROR ("Invalid variant type");
break;
- }
+ }
}
void
@@ -231,19 +234,19 @@
bool
CtrlBAckRequestHeader::IsBasic (void) const
{
- return (!m_multiTid && !m_compressed)?true:false;
+ return (!m_multiTid && !m_compressed) ? true : false;
}
bool
CtrlBAckRequestHeader::IsCompressed (void) const
{
- return (!m_multiTid && m_compressed)?true:false;
+ return (!m_multiTid && m_compressed) ? true : false;
}
bool
CtrlBAckRequestHeader::IsMultiTid (void) const
{
- return (m_multiTid && m_compressed)?true:false;
+ return (m_multiTid && m_compressed) ? true : false;
}
/***********************************
@@ -261,7 +264,8 @@
}
CtrlBAckResponseHeader::~CtrlBAckResponseHeader ()
-{}
+{
+}
TypeId
CtrlBAckResponseHeader::GetTypeId (void)
@@ -270,7 +274,7 @@
.SetParent<Header> ()
.AddConstructor<CtrlBAckResponseHeader> ()
;
- return tid;
+ return tid;
}
TypeId
@@ -371,7 +375,8 @@
void
CtrlBAckResponseHeader::SetType (enum BlockAckType type)
{
- switch (type) {
+ switch (type)
+ {
case BASIC_BLOCK_ACK:
m_multiTid = false;
m_compressed = false;
@@ -387,7 +392,7 @@
default:
NS_FATAL_ERROR ("Invalid variant type");
break;
- }
+ }
}
void
@@ -405,7 +410,7 @@
bool
CtrlBAckResponseHeader::MustSendHtImmediateAck (void) const
{
- return (m_baAckPolicy)?true:false;
+ return (m_baAckPolicy) ? true : false;
}
uint8_t
@@ -424,47 +429,47 @@
bool
CtrlBAckResponseHeader::IsBasic (void) const
{
- return (!m_multiTid && !m_compressed)?true:false;
+ return (!m_multiTid && !m_compressed) ? true : false;
}
bool
CtrlBAckResponseHeader::IsCompressed (void) const
{
- return (!m_multiTid && m_compressed)?true:false;
+ return (!m_multiTid && m_compressed) ? true : false;
}
bool
CtrlBAckResponseHeader::IsMultiTid (void) const
{
- return (m_multiTid && m_compressed)?true:false;
+ return (m_multiTid && m_compressed) ? true : false;
}
uint16_t
CtrlBAckResponseHeader::GetBaControl (void) const
{
uint16_t res = 0;
- if (m_baAckPolicy)
+ if (m_baAckPolicy)
{
res |= 0x1;
}
if (m_multiTid)
{
- res |= (0x1<<1);
+ res |= (0x1 << 1);
}
if (m_compressed)
{
- res |= (0x1<<2);
+ res |= (0x1 << 2);
}
- res |= (m_tidInfo << 12) & (0xf<<12);
+ res |= (m_tidInfo << 12) & (0xf << 12);
return res;
}
void
CtrlBAckResponseHeader::SetBaControl (uint16_t ba)
{
- m_baAckPolicy = ((ba & 0x01) == 1)?true:false;
- m_multiTid = (((ba >> 1) & 0x01) == 1)?true:false;
- m_compressed = (((ba >> 2) & 0x01) == 1)?true:false;
+ m_baAckPolicy = ((ba & 0x01) == 1) ? true : false;
+ m_multiTid = (((ba >> 1) & 0x01) == 1) ? true : false;
+ m_compressed = (((ba >> 2) & 0x01) == 1) ? true : false;
m_tidInfo = (ba >> 12) & 0x0f;
}
@@ -548,7 +553,9 @@
CtrlBAckResponseHeader::SetReceivedPacket (uint16_t seq)
{
if (!IsInBitmap (seq))
- return;
+ {
+ return;
+ }
if (!m_multiTid)
{
if (!m_compressed)
@@ -559,7 +566,7 @@
}
else
{
- bitmap.m_compressedBitmap |= (uint64_t(0x0000000000000001) << IndexInBitmap (seq));
+ bitmap.m_compressedBitmap |= (uint64_t (0x0000000000000001) << IndexInBitmap (seq));
}
}
else
@@ -580,12 +587,14 @@
{
NS_ASSERT (frag < 16);
if (!IsInBitmap (seq))
- return;
+ {
+ return;
+ }
if (!m_multiTid)
{
if (!m_compressed)
{
- bitmap.m_bitmap[IndexInBitmap (seq)] |= (0x0001<<frag);
+ bitmap.m_bitmap[IndexInBitmap (seq)] |= (0x0001 << frag);
}
else
{
@@ -610,18 +619,20 @@
CtrlBAckResponseHeader::IsPacketReceived (uint16_t seq) const
{
if (!IsInBitmap (seq))
- return false;
+ {
+ return false;
+ }
if (!m_multiTid)
{
if (!m_compressed)
{
/*It's impossible to say if an entire packet was correctly received. */
- return false;
+ return false;
}
else
{
- uint64_t mask = uint64_t(0x0000000000000001);
- return (((bitmap.m_compressedBitmap >> IndexInBitmap (seq)) & mask) == 1)?true:false;
+ uint64_t mask = uint64_t (0x0000000000000001);
+ return (((bitmap.m_compressedBitmap >> IndexInBitmap (seq)) & mask) == 1) ? true : false;
}
}
else
@@ -643,20 +654,22 @@
{
NS_ASSERT (frag < 16);
if (!IsInBitmap (seq))
- return false;
+ {
+ return false;
+ }
if (!m_multiTid)
{
if (!m_compressed)
{
- return ((bitmap.m_bitmap[IndexInBitmap (seq)] & (0x0001<<frag)) != 0x0000)?true:false;
+ return ((bitmap.m_bitmap[IndexInBitmap (seq)] & (0x0001 << frag)) != 0x0000) ? true : false;
}
else
{
/* Although this could make no sense, if packet with sequence number
- equal to <i>seq</i> was correctly received, also all of its fragments
+ equal to <i>seq</i> was correctly received, also all of its fragments
were correctly received. */
- uint64_t mask = uint64_t(0x0000000000000001);
- return (((bitmap.m_compressedBitmap >> IndexInBitmap (seq)) & mask) == 1)?true:false;
+ uint64_t mask = uint64_t (0x0000000000000001);
+ return (((bitmap.m_compressedBitmap >> IndexInBitmap (seq)) & mask) == 1) ? true : false;
}
}
else
--- a/src/wifi/model/ctrl-headers.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/ctrl-headers.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -39,11 +39,12 @@
* - Basic block ack (unique type in 802.11e)
* - Compressed block ack
* - Multi-TID block ack
- * For now only basic block ack and compressed block ack
+ * For now only basic block ack and compressed block ack
* are supported.
* Basic block ack is also default variant.
*/
-class CtrlBAckRequestHeader : public Header {
+class CtrlBAckRequestHeader : public Header
+{
public:
CtrlBAckRequestHeader ();
~CtrlBAckRequestHeader ();
@@ -67,13 +68,12 @@
bool IsMultiTid (void) const;
uint16_t GetStartingSequenceControl (void) const;
-
+
private:
-
void SetStartingSequenceControl (uint16_t seqControl);
uint16_t GetBarControl (void) const;
void SetBarControl (uint16_t bar);
-
+
/**
* The lsb bit of the BAR control field is used only for the
* HT (High Throughput) delayed block ack configuration.
@@ -95,11 +95,12 @@
* - Basic block ack (unique type in 802.11e)
* - Compressed block ack
* - Multi-TID block ack
- * For now only basic block ack and compressed block ack
+ * For now only basic block ack and compressed block ack
* are supported.
* Basic block ack is also default variant.
*/
-class CtrlBAckResponseHeader : public Header {
+class CtrlBAckResponseHeader : public Header
+{
public:
CtrlBAckResponseHeader ();
~CtrlBAckResponseHeader ();
@@ -133,12 +134,11 @@
uint64_t GetCompressedBitmap (void) const;
void ResetBitmap (void);
-
+
private:
-
uint16_t GetBaControl (void) const;
void SetBaControl (uint16_t bar);
-
+
Buffer::Iterator SerializeBitmap (Buffer::Iterator start) const;
Buffer::Iterator DeserializeBitmap (Buffer::Iterator start);
@@ -149,21 +149,21 @@
* for more details see 7.2.1.8 in IEEE 802.11n/D4.00
*
* \param seq the sequence number
- *
- * \return If we are using basic block ack, return value represents index of
+ *
+ * \return If we are using basic block ack, return value represents index of
* block of 16 bits for packet having sequence number equals to <i>seq</i>.
- * If we are using compressed block ack, return value represents bit
- * to set to 1 in the compressed bitmap to indicate that packet having
+ * If we are using compressed block ack, return value represents bit
+ * to set to 1 in the compressed bitmap to indicate that packet having
* sequence number equals to <i>seq</i> was correctly received.
*/
uint8_t IndexInBitmap (uint16_t seq) const;
/**
* Checks if sequence number <i>seq</i> can be acknowledged in the bitmap.
- *
+ *
* \param seq the sequence number
- *
- * \return
+ *
+ * \return
*/
bool IsInBitmap (uint16_t seq) const;
@@ -179,7 +179,8 @@
uint16_t m_tidInfo;
uint16_t m_startingSeq;
- union {
+ union
+ {
uint16_t m_bitmap[64];
uint64_t m_compressedBitmap;
} bitmap;
--- a/src/wifi/model/dca-txop.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/dca-txop.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -38,56 +38,69 @@
NS_LOG_COMPONENT_DEFINE ("DcaTxop");
#undef NS_LOG_APPEND_CONTEXT
-#define NS_LOG_APPEND_CONTEXT if (m_low != 0) {std::clog << "[mac=" << m_low->GetAddress () << "] ";}
+#define NS_LOG_APPEND_CONTEXT if (m_low != 0) { std::clog << "[mac=" << m_low->GetAddress () << "] ";}
namespace ns3 {
class DcaTxop::Dcf : public DcfState
{
public:
- Dcf (DcaTxop *txop)
+ Dcf (DcaTxop * txop)
: m_txop (txop)
- {}
+ {
+ }
private:
- virtual void DoNotifyAccessGranted (void) {
+ virtual void DoNotifyAccessGranted (void)
+ {
m_txop->NotifyAccessGranted ();
}
- virtual void DoNotifyInternalCollision (void) {
+ virtual void DoNotifyInternalCollision (void)
+ {
m_txop->NotifyInternalCollision ();
}
- virtual void DoNotifyCollision (void) {
+ virtual void DoNotifyCollision (void)
+ {
m_txop->NotifyCollision ();
}
- virtual void DoNotifyChannelSwitching (void) {
+ virtual void DoNotifyChannelSwitching (void)
+ {
m_txop->NotifyChannelSwitching ();
}
DcaTxop *m_txop;
};
-class DcaTxop::TransmissionListener : public MacLowTransmissionListener {
+class DcaTxop::TransmissionListener : public MacLowTransmissionListener
+{
public:
- TransmissionListener (DcaTxop *txop)
+ TransmissionListener (DcaTxop * txop)
: MacLowTransmissionListener (),
- m_txop (txop) {}
-
+ m_txop (txop) {
+ }
+
virtual ~TransmissionListener () {}
- virtual void GotCts (double snr, WifiMode txMode) {
+ virtual void GotCts (double snr, WifiMode txMode)
+ {
m_txop->GotCts (snr, txMode);
}
- virtual void MissedCts (void) {
+ virtual void MissedCts (void)
+ {
m_txop->MissedCts ();
}
- virtual void GotAck (double snr, WifiMode txMode) {
+ virtual void GotAck (double snr, WifiMode txMode)
+ {
m_txop->GotAck (snr, txMode);
}
- virtual void MissedAck (void) {
+ virtual void MissedAck (void)
+ {
m_txop->MissedAck ();
}
- virtual void StartNext (void) {
+ virtual void StartNext (void)
+ {
m_txop->StartNext ();
}
- virtual void Cancel (void) {
+ virtual void Cancel (void)
+ {
m_txop->Cancel ();
}
@@ -97,7 +110,7 @@
NS_OBJECT_ENSURE_REGISTERED (DcaTxop);
-TypeId
+TypeId
DcaTxop::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::DcaTxop")
@@ -107,7 +120,7 @@
PointerValue (),
MakePointerAccessor (&DcaTxop::GetQueue),
MakePointerChecker<WifiMacQueue> ())
- ;
+ ;
return tid;
}
@@ -153,24 +166,24 @@
m_manager->Add (m_dcf);
}
-void
+void
DcaTxop::SetLow (Ptr<MacLow> low)
{
NS_LOG_FUNCTION (this << low);
m_low = low;
}
-void
+void
DcaTxop::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> remoteManager)
{
NS_LOG_FUNCTION (this << remoteManager);
m_stationManager = remoteManager;
}
-void
+void
DcaTxop::SetTxOkCallback (TxOk callback)
{
m_txOkCallback = callback;
}
-void
+void
DcaTxop::SetTxFailedCallback (TxFailed callback)
{
m_txFailedCallback = callback;
@@ -183,41 +196,41 @@
return m_queue;
}
-void
+void
DcaTxop::SetMinCw (uint32_t minCw)
{
NS_LOG_FUNCTION (this << minCw);
m_dcf->SetCwMin (minCw);
}
-void
+void
DcaTxop::SetMaxCw (uint32_t maxCw)
{
NS_LOG_FUNCTION (this << maxCw);
m_dcf->SetCwMax (maxCw);
}
-void
+void
DcaTxop::SetAifsn (uint32_t aifsn)
{
NS_LOG_FUNCTION (this << aifsn);
m_dcf->SetAifsn (aifsn);
}
-uint32_t
+uint32_t
DcaTxop::GetMinCw (void) const
{
return m_dcf->GetCwMin ();
}
-uint32_t
+uint32_t
DcaTxop::GetMaxCw (void) const
{
return m_dcf->GetCwMax ();
}
-uint32_t
+uint32_t
DcaTxop::GetAifsn (void) const
{
return m_dcf->GetAifsn ();
}
-void
+void
DcaTxop::Queue (Ptr<const Packet> packet, const WifiMacHeader &hdr)
{
NS_LOG_FUNCTION (this << packet << &hdr);
@@ -233,9 +246,9 @@
DcaTxop::RestartAccessIfNeeded (void)
{
NS_LOG_FUNCTION (this);
- if ((m_currentPacket != 0 ||
- !m_queue->IsEmpty ()) &&
- !m_dcf->IsAccessRequested ())
+ if ((m_currentPacket != 0
+ || !m_queue->IsEmpty ())
+ && !m_dcf->IsAccessRequested ())
{
m_manager->RequestAccess (m_dcf);
}
@@ -245,9 +258,9 @@
DcaTxop::StartAccessIfNeeded (void)
{
NS_LOG_FUNCTION (this);
- if (m_currentPacket == 0 &&
- !m_queue->IsEmpty () &&
- !m_dcf->IsAccessRequested ())
+ if (m_currentPacket == 0
+ && !m_queue->IsEmpty ()
+ && !m_dcf->IsAccessRequested ())
{
m_manager->RequestAccess (m_dcf);
}
@@ -307,21 +320,21 @@
m_currentPacket, m_fragmentNumber);
}
bool
-DcaTxop::IsLastFragment (void)
+DcaTxop::IsLastFragment (void)
{
return m_stationManager->IsLastFragment (m_currentHdr.GetAddr1 (), &m_currentHdr,
m_currentPacket, m_fragmentNumber);
}
uint32_t
-DcaTxop::GetNextFragmentSize (void)
+DcaTxop::GetNextFragmentSize (void)
{
return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr,
m_currentPacket, m_fragmentNumber + 1);
}
uint32_t
-DcaTxop::GetFragmentOffset (void)
+DcaTxop::GetFragmentOffset (void)
{
return m_stationManager->GetFragmentOffset (m_currentHdr.GetAddr1 (), &m_currentHdr,
m_currentPacket, m_fragmentNumber);
@@ -334,31 +347,31 @@
hdr->SetFragmentNumber (m_fragmentNumber);
uint32_t startOffset = GetFragmentOffset ();
Ptr<Packet> fragment;
- if (IsLastFragment ())
+ if (IsLastFragment ())
{
hdr->SetNoMoreFragments ();
- }
- else
+ }
+ else
{
hdr->SetMoreFragments ();
}
- fragment = m_currentPacket->CreateFragment (startOffset,
- GetFragmentSize ());
+ fragment = m_currentPacket->CreateFragment (startOffset,
+ GetFragmentSize ());
return fragment;
}
-bool
+bool
DcaTxop::NeedsAccess (void) const
{
return !m_queue->IsEmpty () || m_currentPacket != 0;
}
-void
+void
DcaTxop::NotifyAccessGranted (void)
{
NS_LOG_FUNCTION (this);
- if (m_currentPacket == 0)
+ if (m_currentPacket == 0)
{
- if (m_queue->IsEmpty ())
+ if (m_queue->IsEmpty ())
{
NS_LOG_DEBUG ("queue empty");
return;
@@ -371,9 +384,9 @@
m_currentHdr.SetNoMoreFragments ();
m_currentHdr.SetNoRetry ();
m_fragmentNumber = 0;
- NS_LOG_DEBUG ("dequeued size="<<m_currentPacket->GetSize ()<<
- ", to="<<m_currentHdr.GetAddr1 ()<<
- ", seq="<<m_currentHdr.GetSequenceControl ());
+ NS_LOG_DEBUG ("dequeued size=" << m_currentPacket->GetSize () <<
+ ", to=" << m_currentHdr.GetAddr1 () <<
+ ", seq=" << m_currentHdr.GetSequenceControl ());
}
MacLowTransmissionParameters params;
params.DisableOverrideDurationId ();
@@ -391,12 +404,12 @@
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
StartAccessIfNeeded ();
NS_LOG_DEBUG ("tx broadcast");
- }
- else
+ }
+ else
{
params.EnableAck ();
-
- if (NeedFragmentation ())
+
+ if (NeedFragmentation ())
{
WifiMacHeader hdr;
Ptr<Packet> fragment = GetFragmentPacket (&hdr);
@@ -408,27 +421,27 @@
{
params.DisableRts ();
}
- if (IsLastFragment ())
+ if (IsLastFragment ())
{
- NS_LOG_DEBUG ("fragmenting last fragment size="<<fragment->GetSize ());
+ NS_LOG_DEBUG ("fragmenting last fragment size=" << fragment->GetSize ());
params.DisableNextData ();
- }
- else
+ }
+ else
{
- NS_LOG_DEBUG ("fragmenting size="<<fragment->GetSize ());
+ NS_LOG_DEBUG ("fragmenting size=" << fragment->GetSize ());
params.EnableNextData (GetNextFragmentSize ());
}
- Low ()->StartTransmission (fragment, &hdr, params,
+ Low ()->StartTransmission (fragment, &hdr, params,
m_transmissionListener);
- }
- else
+ }
+ else
{
- if (NeedRts (m_currentPacket, &m_currentHdr))
+ if (NeedRts (m_currentPacket, &m_currentHdr))
{
params.EnableRts ();
NS_LOG_DEBUG ("tx unicast rts");
- }
- else
+ }
+ else
{
params.DisableRts ();
NS_LOG_DEBUG ("tx unicast");
@@ -440,13 +453,13 @@
}
}
-void
+void
DcaTxop::NotifyInternalCollision (void)
{
NS_LOG_FUNCTION (this);
NotifyCollision ();
}
-void
+void
DcaTxop::NotifyCollision (void)
{
NS_LOG_FUNCTION (this);
@@ -455,20 +468,20 @@
RestartAccessIfNeeded ();
}
-void
+void
DcaTxop::NotifyChannelSwitching (void)
{
- m_queue->Flush();
+ m_queue->Flush ();
m_currentPacket = 0;
}
-void
+void
DcaTxop::GotCts (double snr, WifiMode txMode)
{
NS_LOG_FUNCTION (this << snr << txMode);
NS_LOG_DEBUG ("got cts");
}
-void
+void
DcaTxop::MissedCts (void)
{
NS_LOG_FUNCTION (this);
@@ -477,30 +490,30 @@
{
NS_LOG_DEBUG ("Cts Fail");
m_stationManager->ReportFinalRtsFailed (m_currentHdr.GetAddr1 (), &m_currentHdr);
- if (!m_txFailedCallback.IsNull ())
+ if (!m_txFailedCallback.IsNull ())
{
m_txFailedCallback (m_currentHdr);
}
// to reset the dcf.
m_currentPacket = 0;
m_dcf->ResetCw ();
- }
- else
+ }
+ else
{
m_dcf->UpdateFailedCw ();
}
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
RestartAccessIfNeeded ();
}
-void
+void
DcaTxop::GotAck (double snr, WifiMode txMode)
{
NS_LOG_FUNCTION (this << snr << txMode);
- if (!NeedFragmentation () ||
- IsLastFragment ())
+ if (!NeedFragmentation ()
+ || IsLastFragment ())
{
NS_LOG_DEBUG ("got ack. tx done.");
- if (!m_txOkCallback.IsNull ())
+ if (!m_txOkCallback.IsNull ())
{
m_txOkCallback (m_currentHdr);
}
@@ -512,30 +525,30 @@
m_dcf->ResetCw ();
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
RestartAccessIfNeeded ();
- }
- else
+ }
+ else
{
- NS_LOG_DEBUG ("got ack. tx not done, size="<<m_currentPacket->GetSize ());
+ NS_LOG_DEBUG ("got ack. tx not done, size=" << m_currentPacket->GetSize ());
}
}
-void
+void
DcaTxop::MissedAck (void)
{
NS_LOG_FUNCTION (this);
NS_LOG_DEBUG ("missed ack");
- if (!NeedDataRetransmission ())
+ if (!NeedDataRetransmission ())
{
NS_LOG_DEBUG ("Ack Fail");
m_stationManager->ReportFinalDataFailed (m_currentHdr.GetAddr1 (), &m_currentHdr);
- if (!m_txFailedCallback.IsNull ())
+ if (!m_txFailedCallback.IsNull ())
{
m_txFailedCallback (m_currentHdr);
}
// to reset the dcf.
m_currentPacket = 0;
m_dcf->ResetCw ();
- }
- else
+ }
+ else
{
NS_LOG_DEBUG ("Retransmit");
m_currentHdr.SetRetry ();
@@ -544,7 +557,7 @@
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
RestartAccessIfNeeded ();
}
-void
+void
DcaTxop::StartNext (void)
{
NS_LOG_FUNCTION (this);
@@ -557,11 +570,11 @@
params.EnableAck ();
params.DisableRts ();
params.DisableOverrideDurationId ();
- if (IsLastFragment ())
+ if (IsLastFragment ())
{
params.DisableNextData ();
- }
- else
+ }
+ else
{
params.EnableNextData (GetNextFragmentSize ());
}
@@ -579,18 +592,18 @@
* - the other is used for everything else and has a normal
* priority.
*
- * If the normal queue tries to send a unicast data frame, but
+ * If the normal queue tries to send a unicast data frame, but
* if the tx fails (ack timeout), it starts a backoff. If the beacon
* queue gets a tx oportunity during this backoff, it will trigger
* a call to this Cancel function.
*
* Since we are already doing a backoff, we will get access to
- * the medium when we can, we have nothing to do here. We just
- * ignore the cancel event and wait until we are given again a
+ * the medium when we can, we have nothing to do here. We just
+ * ignore the cancel event and wait until we are given again a
* tx oportunity.
*
* Note that this is really non-trivial because each of these
- * frames is assigned a sequence number from the same sequence
+ * frames is assigned a sequence number from the same sequence
* counter (because this is a non-802.11e device) so, the scheme
* described here fails to ensure in-order delivery of frames
* at the receiving side. This, however, does not matter in
--- a/src/wifi/model/dca-txop.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/dca-txop.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -47,9 +47,9 @@
* \brief handle packet fragmentation and retransmissions.
* \ingroup wifi
*
- * This class implements the packet fragmentation and
+ * This class implements the packet fragmentation and
* retransmission policy. It uses the ns3::MacLow and ns3::DcfManager
- * helper classes to respectively send packets and decide when
+ * helper classes to respectively send packets and decide when
* to send them. Packets are stored in a ns3::WifiMacQueue until
* they can be sent.
*
@@ -80,17 +80,17 @@
void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> remoteManager);
/**
- * \param callback the callback to invoke when a
+ * \param callback the callback to invoke when a
* packet transmission was completed successfully.
*/
void SetTxOkCallback (TxOk callback);
/**
- * \param callback the callback to invoke when a
+ * \param callback the callback to invoke when a
* packet transmission was completed unsuccessfully.
*/
void SetTxFailedCallback (TxFailed callback);
- Ptr<WifiMacQueue > GetQueue () const;
+ Ptr<WifiMacQueue > GetQueue () const;
virtual void SetMinCw (uint32_t minCw);
virtual void SetMaxCw (uint32_t maxCw);
virtual void SetAifsn (uint32_t aifsn);
@@ -129,7 +129,7 @@
/**
* When a channel switching occurs, enqueued packets are removed.
*/
- void NotifyChannelSwitching (void);
+ void NotifyChannelSwitching (void);
/* event handlers */
void GotCts (double snr, WifiMode txMode);
void MissedCts (void);
@@ -162,7 +162,7 @@
Ptr<WifiRemoteStationManager> m_stationManager;
TransmissionListener *m_transmissionListener;
RandomStream *m_rng;
-
+
bool m_accessOngoing;
Ptr<const Packet> m_currentPacket;
--- a/src/wifi/model/dcf-manager.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/dcf-manager.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -46,29 +46,31 @@
m_cwMax (0),
m_cw (0),
m_accessRequested (false)
-{}
+{
+}
DcfState::~DcfState ()
-{}
+{
+}
-void
+void
DcfState::SetAifsn (uint32_t aifsn)
{
m_aifsn = aifsn;
}
-void
+void
DcfState::SetCwMin (uint32_t minCw)
{
m_cwMin = minCw;
ResetCw ();
}
-void
+void
DcfState::SetCwMax (uint32_t maxCw)
{
m_cwMax = maxCw;
ResetCw ();
}
-uint32_t
+uint32_t
DcfState::GetAifsn (void) const
{
return m_aifsn;
@@ -78,36 +80,36 @@
{
return m_cwMin;
}
-uint32_t
+uint32_t
DcfState::GetCwMax (void) const
{
return m_cwMax;
}
-void
+void
DcfState::ResetCw (void)
{
m_cw = m_cwMin;
}
-void
+void
DcfState::UpdateFailedCw (void)
{
// see 802.11-2007, section 9.9.1.5
m_cw = std::min ( 2 * (m_cw + 1) - 1, m_cwMax);
}
-void
+void
DcfState::UpdateBackoffSlotsNow (uint32_t nSlots, Time backoffUpdateBound)
{
m_backoffSlots -= nSlots;
m_backoffStart = backoffUpdateBound;
- MY_DEBUG ("update slots="<<nSlots<<" slots, backoff="<<m_backoffSlots);
+ MY_DEBUG ("update slots=" << nSlots << " slots, backoff=" << m_backoffSlots);
}
-void
+void
DcfState::StartBackoffNow (uint32_t nSlots)
{
NS_ASSERT (m_backoffSlots == 0);
- MY_DEBUG ("start backoff="<<nSlots<<" slots");
+ MY_DEBUG ("start backoff=" << nSlots << " slots");
m_backoffSlots = nSlots;
m_backoffStart = Simulator::Now ();
}
@@ -117,45 +119,45 @@
{
return m_cw;
}
-uint32_t
+uint32_t
DcfState::GetBackoffSlots (void) const
{
return m_backoffSlots;
}
-Time
+Time
DcfState::GetBackoffStart (void) const
{
return m_backoffStart;
}
-bool
+bool
DcfState::IsAccessRequested (void) const
{
return m_accessRequested;
}
-void
+void
DcfState::NotifyAccessRequested (void)
{
m_accessRequested = true;
}
-void
+void
DcfState::NotifyAccessGranted (void)
{
NS_ASSERT (m_accessRequested);
m_accessRequested = false;
DoNotifyAccessGranted ();
}
-void
+void
DcfState::NotifyCollision (void)
{
DoNotifyCollision ();
}
-void
+void
DcfState::NotifyInternalCollision (void)
{
DoNotifyInternalCollision ();
}
-void
-DcfState::NotifyChannelSwitching (void)
+void
+DcfState::NotifyChannelSwitching (void)
{
DoNotifyChannelSwitching ();
}
@@ -165,27 +167,38 @@
* Listener for Nav events. Forwards to DcfManager
***************************************************************/
-class LowDcfListener : public ns3::MacLowDcfListener {
+class LowDcfListener : public ns3::MacLowDcfListener
+{
public:
LowDcfListener (ns3::DcfManager *dcf)
- : m_dcf (dcf) {}
- virtual ~LowDcfListener () {}
- virtual void NavStart (Time duration) {
+ : m_dcf (dcf)
+ {
+ }
+ virtual ~LowDcfListener ()
+ {
+ }
+ virtual void NavStart (Time duration)
+ {
m_dcf->NotifyNavStartNow (duration);
}
- virtual void NavReset (Time duration) {
+ virtual void NavReset (Time duration)
+ {
m_dcf->NotifyNavResetNow (duration);
}
- virtual void AckTimeoutStart (Time duration) {
+ virtual void AckTimeoutStart (Time duration)
+ {
m_dcf->NotifyAckTimeoutStartNow (duration);
}
- virtual void AckTimeoutReset () {
+ virtual void AckTimeoutReset ()
+ {
m_dcf->NotifyAckTimeoutResetNow ();
}
- virtual void CtsTimeoutStart (Time duration) {
+ virtual void CtsTimeoutStart (Time duration)
+ {
m_dcf->NotifyCtsTimeoutStartNow (duration);
}
- virtual void CtsTimeoutReset () {
+ virtual void CtsTimeoutReset ()
+ {
m_dcf->NotifyCtsTimeoutResetNow ();
}
private:
@@ -196,27 +209,38 @@
* Listener for PHY events. Forwards to DcfManager
***************************************************************/
-class PhyListener : public ns3::WifiPhyListener {
+class PhyListener : public ns3::WifiPhyListener
+{
public:
PhyListener (ns3::DcfManager *dcf)
- : m_dcf (dcf) {}
- virtual ~PhyListener () {}
- virtual void NotifyRxStart (Time duration) {
+ : m_dcf (dcf)
+ {
+ }
+ virtual ~PhyListener ()
+ {
+ }
+ virtual void NotifyRxStart (Time duration)
+ {
m_dcf->NotifyRxStartNow (duration);
}
- virtual void NotifyRxEndOk (void) {
+ virtual void NotifyRxEndOk (void)
+ {
m_dcf->NotifyRxEndOkNow ();
}
- virtual void NotifyRxEndError (void) {
+ virtual void NotifyRxEndError (void)
+ {
m_dcf->NotifyRxEndErrorNow ();
}
- virtual void NotifyTxStart (Time duration) {
+ virtual void NotifyTxStart (Time duration)
+ {
m_dcf->NotifyTxStartNow (duration);
}
- virtual void NotifyMaybeCcaBusyStart (Time duration) {
+ virtual void NotifyMaybeCcaBusyStart (Time duration)
+ {
m_dcf->NotifyMaybeCcaBusyStartNow (duration);
}
- virtual void NotifySwitchingStart (Time duration) {
+ virtual void NotifySwitchingStart (Time duration)
+ {
m_dcf->NotifySwitchingStartNow (duration);
}
private:
@@ -240,14 +264,15 @@
m_lastTxDuration (MicroSeconds (0)),
m_lastBusyStart (MicroSeconds (0)),
m_lastBusyDuration (MicroSeconds (0)),
- m_lastSwitchingStart (MicroSeconds (0)),
- m_lastSwitchingDuration (MicroSeconds (0)),
+ m_lastSwitchingStart (MicroSeconds (0)),
+ m_lastSwitchingDuration (MicroSeconds (0)),
m_rxing (false),
m_slotTimeUs (0),
m_sifs (Seconds (0.0)),
m_phyListener (0),
m_lowListener (0)
-{}
+{
+}
DcfManager::~DcfManager ()
{
@@ -257,30 +282,30 @@
m_lowListener = 0;
}
-void
+void
DcfManager::SetupPhyListener (Ptr<WifiPhy> phy)
{
m_phyListener = new PhyListener (this);
phy->RegisterListener (m_phyListener);
}
-void
+void
DcfManager::SetupLowListener (Ptr<MacLow> low)
{
m_lowListener = new LowDcfListener (this);
low->RegisterDcfListener (m_lowListener);
}
-void
+void
DcfManager::SetSlot (Time slotTime)
{
m_slotTimeUs = slotTime.GetMicroSeconds ();
}
-void
+void
DcfManager::SetSifs (Time sifs)
{
m_sifs = sifs;
}
-void
+void
DcfManager::SetEifsNoDifs (Time eifsNoDifs)
{
m_eifsNoDifs = eifsNoDifs;
@@ -291,7 +316,7 @@
return m_eifsNoDifs;
}
-void
+void
DcfManager::Add (DcfState *dcf)
{
m_states.push_back (dcf);
@@ -341,16 +366,16 @@
return retval;
}
-bool
+bool
DcfManager::IsBusy (void) const
{
// PHY busy
- if (m_rxing)
+ if (m_rxing)
{
return true;
}
Time lastTxEnd = m_lastTxStart + m_lastTxDuration;
- if (lastTxEnd > Simulator::Now ())
+ if (lastTxEnd > Simulator::Now ())
{
return true;
}
@@ -364,7 +389,7 @@
}
-void
+void
DcfManager::RequestAccess (DcfState *state)
{
UpdateBackoff ();
@@ -374,8 +399,8 @@
* If there is a collision, generate a backoff
* by notifying the collision to the user.
*/
- if (state->GetBackoffSlots () == 0 &&
- IsBusy ())
+ if (state->GetBackoffSlots () == 0
+ && IsBusy ())
{
MY_DEBUG ("medium is busy: collision");
/* someone else has accessed the medium.
@@ -384,7 +409,7 @@
state->NotifyCollision ();
}
DoGrantAccess ();
- DoRestartAccessTimeoutIfNeeded ();
+ DoRestartAccessTimeoutIfNeeded ();
}
void
@@ -394,24 +419,24 @@
for (States::const_iterator i = m_states.begin (); i != m_states.end (); k++)
{
DcfState *state = *i;
- if (state->IsAccessRequested () &&
- GetBackoffEndFor (state) <= Simulator::Now () )
+ if (state->IsAccessRequested ()
+ && GetBackoffEndFor (state) <= Simulator::Now () )
{
/**
* This is the first dcf we find with an expired backoff and which
* needs access to the medium. i.e., it has data to send.
*/
- MY_DEBUG ("dcf " << k << " needs access. backoff expired. access granted. slots="<<state->GetBackoffSlots ());
+ MY_DEBUG ("dcf " << k << " needs access. backoff expired. access granted. slots=" << state->GetBackoffSlots ());
i++; // go to the next item in the list.
k++;
std::vector<DcfState *> internalCollisionStates;
for (States::const_iterator j = i; j != m_states.end (); j++, k++)
{
DcfState *otherState = *j;
- if (otherState->IsAccessRequested () &&
- GetBackoffEndFor (otherState) <= Simulator::Now ())
+ if (otherState->IsAccessRequested ()
+ && GetBackoffEndFor (otherState) <= Simulator::Now ())
{
- MY_DEBUG ("dcf " << k << " needs access. backoff expired. internal collision. slots=" <<
+ MY_DEBUG ("dcf " << k << " needs access. backoff expired. internal collision. slots=" <<
otherState->GetBackoffSlots ());
/**
* all other dcfs with a lower priority whose backoff
@@ -423,11 +448,11 @@
}
/**
- * Now, we notify all of these changes in one go. It is necessary to
+ * Now, we notify all of these changes in one go. It is necessary to
* perform first the calculations of which states are colliding and then
* only apply the changes because applying the changes through notification
* could change the global state of the manager, and, thus, could change
- * the result of the calculations.
+ * the result of the calculations.
*/
state->NotifyAccessGranted ();
for (std::vector<DcfState *>::const_iterator k = internalCollisionStates.begin ();
@@ -453,15 +478,15 @@
DcfManager::GetAccessGrantStart (void) const
{
Time rxAccessStart;
- if (!m_rxing)
+ if (!m_rxing)
{
rxAccessStart = m_lastRxEnd + m_sifs;
if (!m_lastRxReceivedOk)
{
rxAccessStart += m_eifsNoDifs;
}
- }
- else
+ }
+ else
{
rxAccessStart = m_lastRxStart + m_lastRxDuration + m_sifs;
}
@@ -470,14 +495,14 @@
Time navAccessStart = m_lastNavStart + m_lastNavDuration + m_sifs;
Time ackTimeoutAccessStart = m_lastAckTimeoutEnd + m_sifs;
Time ctsTimeoutAccessStart = m_lastCtsTimeoutEnd + m_sifs;
- Time switchingAccessStart = m_lastSwitchingStart + m_lastSwitchingDuration + m_sifs;
- Time accessGrantedStart = MostRecent (rxAccessStart,
+ Time switchingAccessStart = m_lastSwitchingStart + m_lastSwitchingDuration + m_sifs;
+ Time accessGrantedStart = MostRecent (rxAccessStart,
busyAccessStart,
- txAccessStart,
+ txAccessStart,
navAccessStart,
ackTimeoutAccessStart,
ctsTimeoutAccessStart,
- switchingAccessStart
+ switchingAccessStart
);
NS_LOG_INFO ("access grant start=" << accessGrantedStart <<
", rx access start=" << rxAccessStart <<
@@ -492,7 +517,7 @@
{
Time mostRecentEvent = MostRecent (state->GetBackoffStart (),
GetAccessGrantStart () + MicroSeconds (state->GetAifsn () * m_slotTimeUs));
-
+
return mostRecentEvent;
}
@@ -527,7 +552,7 @@
DcfManager::DoRestartAccessTimeoutIfNeeded (void)
{
/**
- * Is there a DcfState which needs to access the medium, and,
+ * Is there a DcfState which needs to access the medium, and,
* if there is one, how many slots for AIFS+backoff does it require ?
*/
bool accessTimeoutNeeded = false;
@@ -547,10 +572,10 @@
}
if (accessTimeoutNeeded)
{
- MY_DEBUG ("expected backoff end="<<expectedBackoffEnd);
+ MY_DEBUG ("expected backoff end=" << expectedBackoffEnd);
Time expectedBackoffDelay = expectedBackoffEnd - Simulator::Now ();
- if (m_accessTimeout.IsRunning () &&
- Simulator::GetDelayLeft (m_accessTimeout) > expectedBackoffDelay)
+ if (m_accessTimeout.IsRunning ()
+ && Simulator::GetDelayLeft (m_accessTimeout) > expectedBackoffDelay)
{
m_accessTimeout.Cancel ();
}
@@ -562,16 +587,16 @@
}
}
-void
+void
DcfManager::NotifyRxStartNow (Time duration)
{
- MY_DEBUG ("rx start for="<<duration);
+ MY_DEBUG ("rx start for=" << duration);
UpdateBackoff ();
m_lastRxStart = Simulator::Now ();
m_lastRxDuration = duration;
m_rxing = true;
}
-void
+void
DcfManager::NotifyRxEndOkNow (void)
{
MY_DEBUG ("rx end ok");
@@ -579,7 +604,7 @@
m_lastRxReceivedOk = true;
m_rxing = false;
}
-void
+void
DcfManager::NotifyRxEndErrorNow (void)
{
MY_DEBUG ("rx end error");
@@ -587,7 +612,7 @@
m_lastRxReceivedOk = false;
m_rxing = false;
}
-void
+void
DcfManager::NotifyTxStartNow (Time duration)
{
if (m_rxing)
@@ -601,22 +626,22 @@
m_lastRxReceivedOk = true;
m_rxing = false;
}
- MY_DEBUG ("tx start for "<<duration);
+ MY_DEBUG ("tx start for " << duration);
UpdateBackoff ();
m_lastTxStart = Simulator::Now ();
m_lastTxDuration = duration;
}
-void
+void
DcfManager::NotifyMaybeCcaBusyStartNow (Time duration)
{
- MY_DEBUG ("busy start for "<<duration);
+ MY_DEBUG ("busy start for " << duration);
UpdateBackoff ();
m_lastBusyStart = Simulator::Now ();
m_lastBusyDuration = duration;
}
-void
+void
DcfManager::NotifySwitchingStartNow (Time duration)
{
Time now = Simulator::Now ();
@@ -659,26 +684,26 @@
{
DcfState *state = *i;
uint32_t remainingSlots = state->GetBackoffSlots ();
- if (remainingSlots > 0)
+ if (remainingSlots > 0)
{
state->UpdateBackoffSlotsNow (remainingSlots, now);
- NS_ASSERT(state->GetBackoffSlots()==0);
+ NS_ASSERT (state->GetBackoffSlots () == 0);
}
- state->ResetCw();
+ state->ResetCw ();
state->m_accessRequested = false;
- state->NotifyChannelSwitching();
- }
-
- MY_DEBUG ("switching start for "<<duration);
+ state->NotifyChannelSwitching ();
+ }
+
+ MY_DEBUG ("switching start for " << duration);
m_lastSwitchingStart = Simulator::Now ();
m_lastSwitchingDuration = duration;
}
-void
+void
DcfManager::NotifyNavResetNow (Time duration)
{
- MY_DEBUG ("nav reset for="<<duration);
+ MY_DEBUG ("nav reset for=" << duration);
UpdateBackoff ();
m_lastNavStart = Simulator::Now ();
m_lastNavDuration = duration;
@@ -691,11 +716,11 @@
*/
DoRestartAccessTimeoutIfNeeded ();
}
-void
+void
DcfManager::NotifyNavStartNow (Time duration)
{
NS_ASSERT (m_lastNavStart < Simulator::Now ());
- MY_DEBUG ("nav start for="<<duration);
+ MY_DEBUG ("nav start for=" << duration);
UpdateBackoff ();
Time newNavEnd = Simulator::Now () + duration;
Time lastNavEnd = m_lastNavStart + m_lastNavDuration;
@@ -708,7 +733,7 @@
void
DcfManager::NotifyAckTimeoutStartNow (Time duration)
{
- NS_ASSERT(m_lastAckTimeoutEnd < Simulator::Now ());
+ NS_ASSERT (m_lastAckTimeoutEnd < Simulator::Now ());
m_lastAckTimeoutEnd = Simulator::Now () + duration;
}
void
--- a/src/wifi/model/dcf-manager.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/dcf-manager.h Sat May 07 21:49:46 2011 +0200
@@ -30,15 +30,17 @@
class WifiPhy;
class WifiMac;
class MacLow;
+class PhyListener;
+class LowDcfListener;
/**
- * \brief keep track of the state needed for a single DCF
+ * \brief keep track of the state needed for a single DCF
* function.
* \ingroup wifi
*
* Multiple instances of a DcfState can be registered in a single
* DcfManager to implement 802.11e-style relative QoS.
- * DcfState::SetAifsn and DcfState::SetCwBounds allow the user to
+ * DcfState::SetAifsn and DcfState::SetCwBounds allow the user to
* control the relative QoS differentiation.
*/
class DcfState
@@ -101,7 +103,7 @@
void NotifyAccessGranted (void);
void NotifyCollision (void);
void NotifyInternalCollision (void);
- void NotifyChannelSwitching (void);
+ void NotifyChannelSwitching (void);
/**
@@ -132,14 +134,14 @@
* is access is still needed.
*/
virtual void DoNotifyCollision (void) = 0;
- /**
- * Called by DcfManager to notify a DcfState subclass
- * that a channel switching occured.
- *
- * The subclass is expected to flush the queue of
- * packets.
- */
- virtual void DoNotifyChannelSwitching () = 0;
+ /**
+ * Called by DcfManager to notify a DcfState subclass
+ * that a channel switching occured.
+ *
+ * The subclass is expected to flush the queue of
+ * packets.
+ */
+ virtual void DoNotifyChannelSwitching () = 0;
uint32_t m_aifsn;
uint32_t m_backoffSlots;
@@ -159,13 +161,13 @@
*
* Handle a set of independent ns3::DcfState, each of which represents
* a single DCF within a MAC stack. Each ns3::DcfState has a priority
- * implicitely associated with it (the priority is determined when the
+ * implicitely associated with it (the priority is determined when the
* ns3::DcfState is added to the DcfManager: the first DcfState to be
* added gets the highest priority, the second, the second highest
* priority, and so on.) which is used to handle "internal" collisions.
- * i.e., when two local DcfState are expected to get access to the
+ * i.e., when two local DcfState are expected to get access to the
* medium at the same time, the highest priority local DcfState wins
- * access to the medium and the other DcfState suffers a "internal"
+ * access to the medium and the other DcfState suffers a "internal"
* collision.
*/
class DcfManager
@@ -212,7 +214,7 @@
* must make sure that the DcfState pointer will stay valid as long
* as the DcfManager is valid. Note that the order in which DcfState
* objects are added to a DcfManager matters: the first DcfState added
- * has the highest priority, the second DcfState added, has the second
+ * has the highest priority, the second DcfState added, has the second
* highest priority, etc.
*/
void Add (DcfState *dcf);
@@ -220,9 +222,9 @@
/**
* \param state a DcfState
*
- * Notify the DcfManager that a specific DcfState needs access to the
+ * Notify the DcfManager that a specific DcfState needs access to the
* medium. The DcfManager is then responsible for starting an access
- * timer and, invoking DcfState::DoNotifyAccessGranted when the access
+ * timer and, invoking DcfState::DoNotifyAccessGranted when the access
* is granted if it ever gets granted.
*/
void RequestAccess (DcfState *state);
@@ -230,7 +232,7 @@
/**
* \param duration expected duration of reception
*
- * Notify the DCF that a packet reception started
+ * Notify the DCF that a packet reception started
* for the expected duration.
*/
void NotifyRxStartNow (Time duration);
@@ -265,7 +267,7 @@
* During switching state, new packets can be enqueued in DcaTxop/EdcaTxop
* but they won't access to the medium until the end of the channel switching.
*/
- void NotifySwitchingStartNow (Time duration);
+ void NotifySwitchingStartNow (Time duration);
/**
* \param duration the value of the received NAV.
*
@@ -288,12 +290,12 @@
Time MostRecent (Time a, Time b, Time c) const;
Time MostRecent (Time a, Time b, Time c, Time d) const;
Time MostRecent (Time a, Time b, Time c, Time d, Time e, Time f) const;
- Time MostRecent (Time a, Time b, Time c, Time d, Time e, Time f, Time g) const;
+ Time MostRecent (Time a, Time b, Time c, Time d, Time e, Time f, Time g) const;
/**
* Access will never be granted to the medium _before_
* the time returned by this method.
- *
- * \returns the absolute time at which access could start to
+ *
+ * \returns the absolute time at which access could start to
* be granted
*/
Time GetAccessGrantStart (void) const;
@@ -319,16 +321,16 @@
Time m_lastTxDuration;
Time m_lastBusyStart;
Time m_lastBusyDuration;
- Time m_lastSwitchingStart;
- Time m_lastSwitchingDuration;
+ Time m_lastSwitchingStart;
+ Time m_lastSwitchingDuration;
bool m_rxing;
bool m_sleeping;
Time m_eifsNoDifs;
EventId m_accessTimeout;
uint32_t m_slotTimeUs;
Time m_sifs;
- class PhyListener *m_phyListener;
- class LowDcfListener *m_lowListener;
+ PhyListener* m_phyListener;
+ LowDcfListener* m_lowListener;
};
} // namespace ns3
--- a/src/wifi/model/dcf.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/dcf.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -24,7 +24,7 @@
NS_OBJECT_ENSURE_REGISTERED (Dcf);
-TypeId
+TypeId
Dcf::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::Dcf")
@@ -44,7 +44,7 @@
MakeUintegerAccessor (&Dcf::SetAifsn,
&Dcf::GetAifsn),
MakeUintegerChecker<uint32_t> ())
- ;
+ ;
return tid;
}
--- a/src/wifi/model/dcf.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/dcf.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -26,12 +26,12 @@
namespace ns3 {
/**
- * \ingroup wifi
- *
+ * \ingroup wifi
+ *
*/
class Dcf : public Object
{
- public:
+public:
static TypeId GetTypeId (void);
virtual void SetMinCw (uint32_t minCw) = 0;
--- a/src/wifi/model/dsss-error-rate-model.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/dsss-error-rate-model.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2010 The Boeing Company
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -26,46 +26,46 @@
namespace ns3 {
#ifndef ENABLE_GSL
-const double DsssErrorRateModel::WLAN_SIR_PERFECT = 10.0;
-const double DsssErrorRateModel::WLAN_SIR_IMPOSSIBLE = 0.1;
+const double DsssErrorRateModel::WLAN_SIR_PERFECT = 10.0;
+const double DsssErrorRateModel::WLAN_SIR_IMPOSSIBLE = 0.1;
#endif
-double
-DsssErrorRateModel::DqpskFunction (double x)
+double
+DsssErrorRateModel::DqpskFunction (double x)
{
- return ((sqrt (2.0) + 1.0) / sqrt (8.0*3.1415926*sqrt (2.0)))
- *(1.0/sqrt (x))
- *exp ( -(2.0 - sqrt (2.0)) * x);
+ return ((sqrt (2.0) + 1.0) / sqrt (8.0 * 3.1415926 * sqrt (2.0)))
+ * (1.0 / sqrt (x))
+ * exp ( -(2.0 - sqrt (2.0)) * x);
}
-double
-DsssErrorRateModel::GetDsssDbpskSuccessRate (double sinr, uint32_t nbits)
+double
+DsssErrorRateModel::GetDsssDbpskSuccessRate (double sinr, uint32_t nbits)
{
double EbN0 = sinr * 22000000.0 / 1000000.0; // 1 bit per symbol with 1 MSPS
double ber = 0.5 * exp (-EbN0);
return pow ((1.0 - ber), nbits);
}
-double
-DsssErrorRateModel::GetDsssDqpskSuccessRate (double sinr,uint32_t nbits)
+double
+DsssErrorRateModel::GetDsssDqpskSuccessRate (double sinr,uint32_t nbits)
{
double EbN0 = sinr * 22000000.0 / 1000000.0 / 2.0; // 2 bits per symbol, 1 MSPS
double ber = DqpskFunction (EbN0);
return pow ((1.0 - ber), nbits);
}
-double
-DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (double sinr,uint32_t nbits)
+double
+DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (double sinr,uint32_t nbits)
{
#ifdef ENABLE_GSL
// symbol error probability
double EbN0 = sinr * 22000000.0 / 1375000.0 / 4.0;
- double sep = SymbolErrorProb16Cck (4.0*EbN0/2.0);
- return pow (1.0-sep,nbits/4.0);
+ double sep = SymbolErrorProb16Cck (4.0 * EbN0 / 2.0);
+ return pow (1.0 - sep,nbits / 4.0);
#else
- NS_LOG_WARN ("Running a 802.11b CCK Matlab model less accurate than GSL model");
+ NS_LOG_WARN ("Running a 802.11b CCK Matlab model less accurate than GSL model");
// The matlab model
- double ber;
+ double ber;
if (sinr > WLAN_SIR_PERFECT)
{
ber = 0.0;
@@ -75,29 +75,30 @@
ber = 0.5;
}
else
- { // fitprops.coeff from matlab berfit
+ {
+ // fitprops.coeff from matlab berfit
double a1 = 5.3681634344056195e-001;
double a2 = 3.3092430025608586e-003;
double a3 = 4.1654372361004000e-001;
double a4 = 1.0288981434358866e+000;
- ber = a1 * exp (-(pow ((sinr-a2)/a3,a4)));
+ ber = a1 * exp (-(pow ((sinr - a2) / a3,a4)));
}
return pow ((1.0 - ber), nbits);
#endif
}
-double
-DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (double sinr,uint32_t nbits)
+double
+DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (double sinr,uint32_t nbits)
{
#ifdef ENABLE_GSL
// symbol error probability
double EbN0 = sinr * 22000000.0 / 1375000.0 / 8.0;
- double sep = SymbolErrorProb256Cck (8.0*EbN0/2.0);
- return pow (1.0-sep,nbits/8.0);
+ double sep = SymbolErrorProb256Cck (8.0 * EbN0 / 2.0);
+ return pow (1.0 - sep,nbits / 8.0);
#else
- NS_LOG_WARN ("Running a 802.11b CCK Matlab model less accurate than GSL model");
+ NS_LOG_WARN ("Running a 802.11b CCK Matlab model less accurate than GSL model");
// The matlab model
- double ber;
+ double ber;
if (sinr > WLAN_SIR_PERFECT)
{
ber = 0.0;
@@ -107,49 +108,50 @@
ber = 0.5;
}
else
- { // fitprops.coeff from matlab berfit
+ {
+ // fitprops.coeff from matlab berfit
double a1 = 7.9056742265333456e-003;
double a2 = -1.8397449399176360e-001;
double a3 = 1.0740689468707241e+000;
double a4 = 1.0523316904502553e+000;
double a5 = 3.0552298746496687e-001;
double a6 = 2.2032715128698435e+000;
- ber = (a1*sinr*sinr+a2*sinr+a3)/(sinr*sinr*sinr+a4*sinr*sinr+a5*sinr+a6);
+ ber = (a1 * sinr * sinr + a2 * sinr + a3) / (sinr * sinr * sinr + a4 * sinr * sinr + a5 * sinr + a6);
}
return pow ((1.0 - ber), nbits);
#endif
}
#ifdef ENABLE_GSL
-double
+double
IntegralFunction (double x, void *params)
{
double beta = ((FunctionParameters *) params)->beta;
double n = ((FunctionParameters *) params)->n;
- double IntegralFunction = pow (2*gsl_cdf_ugaussian_P (x+ beta) - 1, n-1)
- * exp (-x*x/2.0) / sqrt (2.0 * M_PI);
+ double IntegralFunction = pow (2 * gsl_cdf_ugaussian_P (x + beta) - 1, n - 1)
+ * exp (-x * x / 2.0) / sqrt (2.0 * M_PI);
return IntegralFunction;
}
-double
-DsssErrorRateModel::SymbolErrorProb16Cck (double e2)
+double
+DsssErrorRateModel::SymbolErrorProb16Cck (double e2)
{
double sep;
double error;
-
+
FunctionParameters params;
- params.beta = sqrt (2.0*e2);
+ params.beta = sqrt (2.0 * e2);
params.n = 8.0;
- gsl_integration_workspace * w = gsl_integration_workspace_alloc (1000);
-
+ gsl_integration_workspace * w = gsl_integration_workspace_alloc (1000);
+
gsl_function F;
F.function = &IntegralFunction;
F.params = ¶ms;
gsl_integration_qagiu (&F,-params.beta, 0, 1e-7, 1000, w, &sep, &error);
gsl_integration_workspace_free (w);
- if (error == 0.0)
+ if (error == 0.0)
{
sep = 1.0;
}
@@ -157,9 +159,9 @@
return 1.0 - sep;
}
-double DsssErrorRateModel::SymbolErrorProb256Cck (double e1)
+double DsssErrorRateModel::SymbolErrorProb256Cck (double e1)
{
- return 1.0 - pow (1.0 - SymbolErrorProb16Cck (e1/2.0), 2.0);
+ return 1.0 - pow (1.0 - SymbolErrorProb16Cck (e1 / 2.0), 2.0);
}
#endif
--- a/src/wifi/model/dsss-error-rate-model.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/dsss-error-rate-model.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2010 The Boeing Company
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -48,20 +48,20 @@
* The 802.11b modulations:
* - 1 Mbps mode is based on DBPSK. BER is from equation 5.2-69 from John G. Proakis
* Digitial Communications, 2001 edition
- * - 2 Mbps model is based on DQPSK. Equation 8 from "Tight bounds and accurate
- * approximations for dqpsk transmission bit error rate", G. Ferrari and G.E. Corazza
+ * - 2 Mbps model is based on DQPSK. Equation 8 from "Tight bounds and accurate
+ * approximations for dqpsk transmission bit error rate", G. Ferrari and G.E. Corazza
* ELECTRONICS LETTERS, 40(20):1284-1285, September 2004
- * - 5.5 Mbps and 11 Mbps are based on equations (18) and (17) from "Properties and
- * performance of the ieee 802.11b complementarycode-key signal sets",
- * Michael B. Pursley and Thomas C. Royster. IEEE TRANSACTIONS ON COMMUNICATIONS,
+ * - 5.5 Mbps and 11 Mbps are based on equations (18) and (17) from "Properties and
+ * performance of the ieee 802.11b complementarycode-key signal sets",
+ * Michael B. Pursley and Thomas C. Royster. IEEE TRANSACTIONS ON COMMUNICATIONS,
* 57(2):440-449, February 2009.
- *
- * This model is designed to run with highest accuracy using the Gnu
+ *
+ * This model is designed to run with highest accuracy using the Gnu
* Scientific Library (GSL), but if GSL is not installed on the platform,
* will fall back to (slightly less accurate) Matlab-derived models for
* the CCK modulation types.
*
- * More detailed description and validation can be found in
+ * More detailed description and validation can be found in
* http://www.nsnam.org/~pei/80211b.pdf
*/
class DsssErrorRateModel
--- a/src/wifi/model/edca-txop-n.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/edca-txop-n.cc Sat May 07 21:49:46 2011 +0200
@@ -4,7 +4,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -38,27 +38,32 @@
NS_LOG_COMPONENT_DEFINE ("EdcaTxopN");
#undef NS_LOG_APPEND_CONTEXT
-#define NS_LOG_APPEND_CONTEXT if (m_low != 0) {std::clog << "[mac=" << m_low->GetAddress () << "] ";}
+#define NS_LOG_APPEND_CONTEXT if (m_low != 0) { std::clog << "[mac=" << m_low->GetAddress () << "] ";}
namespace ns3 {
class EdcaTxopN::Dcf : public DcfState
{
public:
- Dcf (EdcaTxopN *txop)
+ Dcf (EdcaTxopN * txop)
: m_txop (txop)
- {}
+ {
+ }
private:
- virtual void DoNotifyAccessGranted (void) {
+ virtual void DoNotifyAccessGranted (void)
+ {
m_txop->NotifyAccessGranted ();
}
- virtual void DoNotifyInternalCollision (void) {
+ virtual void DoNotifyInternalCollision (void)
+ {
m_txop->NotifyInternalCollision ();
}
- virtual void DoNotifyCollision (void) {
+ virtual void DoNotifyCollision (void)
+ {
m_txop->NotifyCollision ();
}
- virtual void DoNotifyChannelSwitching (void) {
+ virtual void DoNotifyChannelSwitching (void)
+ {
m_txop->NotifyChannelSwitching ();
}
EdcaTxopN *m_txop;
@@ -67,34 +72,43 @@
class EdcaTxopN::TransmissionListener : public MacLowTransmissionListener
{
public:
- TransmissionListener (EdcaTxopN *txop)
+ TransmissionListener (EdcaTxopN * txop)
: MacLowTransmissionListener (),
- m_txop (txop) {}
-
+ m_txop (txop) {
+ }
+
virtual ~TransmissionListener () {}
- virtual void GotCts (double snr, WifiMode txMode) {
+ virtual void GotCts (double snr, WifiMode txMode)
+ {
m_txop->GotCts (snr, txMode);
}
- virtual void MissedCts (void) {
+ virtual void MissedCts (void)
+ {
m_txop->MissedCts ();
}
- virtual void GotAck (double snr, WifiMode txMode) {
+ virtual void GotAck (double snr, WifiMode txMode)
+ {
m_txop->GotAck (snr, txMode);
}
- virtual void MissedAck (void) {
+ virtual void MissedAck (void)
+ {
m_txop->MissedAck ();
}
- virtual void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address source) {
+ virtual void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address source)
+ {
m_txop->GotBlockAck (blockAck, source);
}
- virtual void MissedBlockAck (void) {
+ virtual void MissedBlockAck (void)
+ {
m_txop->MissedBlockAck ();
}
- virtual void StartNext (void) {
+ virtual void StartNext (void)
+ {
m_txop->StartNext ();
}
- virtual void Cancel (void) {
+ virtual void Cancel (void)
+ {
m_txop->Cancel ();
}
@@ -105,12 +119,14 @@
class EdcaTxopN::BlockAckEventListener : public MacLowBlockAckEventListener
{
public:
- BlockAckEventListener (EdcaTxopN *txop)
+ BlockAckEventListener (EdcaTxopN * txop)
: MacLowBlockAckEventListener (),
- m_txop (txop) {}
+ m_txop (txop) {
+ }
virtual ~BlockAckEventListener () {}
- virtual void BlockAckInactivityTimeout (Mac48Address address, uint8_t tid) {
+ virtual void BlockAckInactivityTimeout (Mac48Address address, uint8_t tid)
+ {
m_txop->SendDelbaFrame (address, tid, false);
}
@@ -127,29 +143,29 @@
.SetParent (ns3::Dcf::GetTypeId ())
.AddConstructor<EdcaTxopN> ()
.AddAttribute ("BlockAckThreshold", "If number of packets in this queue reaches this value,\
- block ack mechanism is used. If this value is 0, block ack is never used.",
- UintegerValue(0),
+ block ack mechanism is used. If this value is 0, block ack is never used." ,
+ UintegerValue (0),
MakeUintegerAccessor (&EdcaTxopN::SetBlockAckThreshold,
&EdcaTxopN::GetBlockAckThreshold),
MakeUintegerChecker<uint8_t> (0, 64))
.AddAttribute ("BlockAckInactivityTimeout", "Represents max time (blocks of 1024 micro seconds) allowed for block ack\
inactivity. If this value isn't equal to 0 a timer start after that a\
block ack setup is completed and will be reset every time that a block\
- ack frame is received. If this value is 0, block ack inactivity timeout won't be used.",
- UintegerValue(0),
+ ack frame is received. If this value is 0, block ack inactivity timeout won't be used." ,
+ UintegerValue (0),
MakeUintegerAccessor (&EdcaTxopN::SetBlockAckInactivityTimeout),
MakeUintegerChecker<uint16_t> ())
.AddAttribute ("Queue", "The WifiMacQueue object",
PointerValue (),
MakePointerAccessor (&EdcaTxopN::GetQueue),
MakePointerChecker<WifiMacQueue> ())
- ;
+ ;
return tid;
}
EdcaTxopN::EdcaTxopN ()
: m_manager (0),
- m_currentPacket(0),
+ m_currentPacket (0),
m_aggregator (0),
m_blockAckType (COMPRESSED_BLOCK_ACK)
{
@@ -210,7 +226,7 @@
m_txOkCallback = callback;
}
-void
+void
EdcaTxopN::SetTxFailedCallback (TxFailed callback)
{
m_txFailedCallback = callback;
@@ -242,40 +258,40 @@
return m_queue;
}
-void
+void
EdcaTxopN::SetMinCw (uint32_t minCw)
{
NS_LOG_FUNCTION (this << minCw);
m_dcf->SetCwMin (minCw);
}
-void
+void
EdcaTxopN::SetMaxCw (uint32_t maxCw)
{
NS_LOG_FUNCTION (this << maxCw);
m_dcf->SetCwMax (maxCw);
}
-void
+void
EdcaTxopN::SetAifsn (uint32_t aifsn)
{
NS_LOG_FUNCTION (this << aifsn);
m_dcf->SetAifsn (aifsn);
}
-uint32_t
+uint32_t
EdcaTxopN::GetMinCw (void) const
{
return m_dcf->GetCwMin ();
}
-uint32_t
+uint32_t
EdcaTxopN::GetMaxCw (void) const
{
return m_dcf->GetCwMax ();
}
-uint32_t
+uint32_t
EdcaTxopN::GetAifsn (void) const
{
return m_dcf->GetAifsn ();
@@ -294,7 +310,7 @@
}
void
-EdcaTxopN::SetLow(Ptr<MacLow> low)
+EdcaTxopN::SetLow (Ptr<MacLow> low)
{
NS_LOG_FUNCTION (this << low);
m_low = low;
@@ -315,7 +331,7 @@
if (m_queue->IsEmpty () && !m_baManager->HasPackets ())
{
NS_LOG_DEBUG ("queue is empty");
- return;
+ return;
}
if (m_baManager->HasBar (m_currentBar))
{
@@ -331,25 +347,25 @@
NS_LOG_DEBUG ("no available packets in the queue");
return;
}
- if (m_currentHdr.IsQosData () && !m_currentHdr.GetAddr1 ().IsBroadcast () &&
- m_blockAckThreshold > 0 &&
- !m_baManager->ExistsAgreement (m_currentHdr.GetAddr1 (), m_currentHdr.GetQosTid ()) &&
- SetupBlockAckIfNeeded ())
+ if (m_currentHdr.IsQosData () && !m_currentHdr.GetAddr1 ().IsBroadcast ()
+ && m_blockAckThreshold > 0
+ && !m_baManager->ExistsAgreement (m_currentHdr.GetAddr1 (), m_currentHdr.GetQosTid ())
+ && SetupBlockAckIfNeeded ())
{
return;
}
m_currentPacket = m_queue->DequeueFirstAvailable (&m_currentHdr, m_currentPacketTimestamp, m_qosBlockedDestinations);
NS_ASSERT (m_currentPacket != 0);
-
+
uint16_t sequence = m_txMiddle->GetNextSequenceNumberfor (&m_currentHdr);
m_currentHdr.SetSequenceNumber (sequence);
m_currentHdr.SetFragmentNumber (0);
m_currentHdr.SetNoMoreFragments ();
m_currentHdr.SetNoRetry ();
m_fragmentNumber = 0;
- NS_LOG_DEBUG ("dequeued size="<<m_currentPacket->GetSize ()<<
- ", to="<<m_currentHdr.GetAddr1 ()<<
- ", seq="<<m_currentHdr.GetSequenceControl ());
+ NS_LOG_DEBUG ("dequeued size=" << m_currentPacket->GetSize () <<
+ ", to=" << m_currentHdr.GetAddr1 () <<
+ ", seq=" << m_currentHdr.GetSequenceControl ());
if (m_currentHdr.IsQosData () && !m_currentHdr.GetAddr1 ().IsBroadcast ())
{
VerifyBlockAck ();
@@ -358,7 +374,7 @@
}
MacLowTransmissionParameters params;
params.DisableOverrideDurationId ();
- if (m_currentHdr.GetAddr1 ().IsGroup ())
+ if (m_currentHdr.GetAddr1 ().IsGroup ())
{
params.DisableRts ();
params.DisableAck ();
@@ -367,14 +383,14 @@
&m_currentHdr,
params,
m_transmissionListener);
-
+
m_currentPacket = 0;
m_dcf->ResetCw ();
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
StartAccessIfNeeded ();
NS_LOG_DEBUG ("tx broadcast");
}
- else if (m_currentHdr.GetType() == WIFI_MAC_CTL_BACKREQ)
+ else if (m_currentHdr.GetType () == WIFI_MAC_CTL_BACKREQ)
{
SendBlockAckRequest (m_currentBar);
}
@@ -388,37 +404,37 @@
{
params.EnableAck ();
}
- if (NeedFragmentation () && ((m_currentHdr.IsQosData () &&
- !m_currentHdr.IsQosAmsdu ()) ||
- m_currentHdr.IsData ()) &&
- (m_blockAckThreshold == 0 ||
- m_blockAckType == BASIC_BLOCK_ACK))
+ if (NeedFragmentation () && ((m_currentHdr.IsQosData ()
+ && !m_currentHdr.IsQosAmsdu ())
+ || m_currentHdr.IsData ())
+ && (m_blockAckThreshold == 0
+ || m_blockAckType == BASIC_BLOCK_ACK))
{
//With COMPRESSED_BLOCK_ACK fragmentation must be avoided.
params.DisableRts ();
WifiMacHeader hdr;
Ptr<Packet> fragment = GetFragmentPacket (&hdr);
- if (IsLastFragment ())
+ if (IsLastFragment ())
{
NS_LOG_DEBUG ("fragmenting last fragment size=" << fragment->GetSize ());
params.DisableNextData ();
- }
- else
+ }
+ else
{
NS_LOG_DEBUG ("fragmenting size=" << fragment->GetSize ());
params.EnableNextData (GetNextFragmentSize ());
}
- m_low->StartTransmission (fragment, &hdr, params,
+ m_low->StartTransmission (fragment, &hdr, params,
m_transmissionListener);
}
else
{
WifiMacHeader peekedHdr;
- if (m_currentHdr.IsQosData () &&
- m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (),
- WifiMacHeader::ADDR1, m_currentHdr.GetAddr1 ()) &&
- !m_currentHdr.GetAddr1 ().IsBroadcast () &&
- m_aggregator != 0 && !m_currentHdr.IsRetry ())
+ if (m_currentHdr.IsQosData ()
+ && m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (),
+ WifiMacHeader::ADDR1, m_currentHdr.GetAddr1 ())
+ && !m_currentHdr.GetAddr1 ().IsBroadcast ()
+ && m_aggregator != 0 && !m_currentHdr.IsRetry ())
{
/* here is performed aggregation */
Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
@@ -427,15 +443,15 @@
MapDestAddressForAggregation (peekedHdr));
bool aggregated = false;
bool isAmsdu = false;
- Ptr<const Packet> peekedPacket = m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (),
- WifiMacHeader::ADDR1,
+ Ptr<const Packet> peekedPacket = m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (),
+ WifiMacHeader::ADDR1,
m_currentHdr.GetAddr1 ());
while (peekedPacket != 0)
{
aggregated = m_aggregator->Aggregate (peekedPacket, currentAggregatedPacket,
MapSrcAddressForAggregation (peekedHdr),
MapDestAddressForAggregation (peekedHdr));
- if (aggregated)
+ if (aggregated)
{
isAmsdu = true;
m_queue->Remove (peekedPacket);
@@ -444,7 +460,7 @@
{
break;
}
- peekedPacket = m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (),
+ peekedPacket = m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (),
WifiMacHeader::ADDR1, m_currentHdr.GetAddr1 ());
}
if (isAmsdu)
@@ -460,8 +476,8 @@
{
params.EnableRts ();
NS_LOG_DEBUG ("tx unicast rts");
- }
- else
+ }
+ else
{
params.DisableRts ();
NS_LOG_DEBUG ("tx unicast");
@@ -488,14 +504,14 @@
RestartAccessIfNeeded ();
}
-void
+void
EdcaTxopN::GotCts (double snr, WifiMode txMode)
{
NS_LOG_FUNCTION (this << snr << txMode);
NS_LOG_DEBUG ("got cts");
}
-void
+void
EdcaTxopN::MissedCts (void)
{
NS_LOG_FUNCTION (this);
@@ -504,15 +520,15 @@
{
NS_LOG_DEBUG ("Cts Fail");
m_stationManager->ReportFinalRtsFailed (m_currentHdr.GetAddr1 (), &m_currentHdr);
- if (!m_txFailedCallback.IsNull ())
+ if (!m_txFailedCallback.IsNull ())
{
m_txFailedCallback (m_currentHdr);
}
// to reset the dcf.
m_currentPacket = 0;
m_dcf->ResetCw ();
- }
- else
+ }
+ else
{
m_dcf->UpdateFailedCw ();
}
@@ -520,10 +536,10 @@
RestartAccessIfNeeded ();
}
-void
+void
EdcaTxopN::NotifyChannelSwitching (void)
{
- m_queue->Flush();
+ m_queue->Flush ();
m_currentPacket = 0;
}
@@ -543,23 +559,23 @@
EdcaTxopN::GotAck (double snr, WifiMode txMode)
{
NS_LOG_FUNCTION (this << snr << txMode);
- if (!NeedFragmentation () ||
- IsLastFragment () ||
- m_currentHdr.IsQosAmsdu ())
+ if (!NeedFragmentation ()
+ || IsLastFragment ()
+ || m_currentHdr.IsQosAmsdu ())
{
NS_LOG_DEBUG ("got ack. tx done.");
if (!m_txOkCallback.IsNull ())
{
- m_txOkCallback (m_currentHdr);
+ m_txOkCallback (m_currentHdr);
}
-
+
if (m_currentHdr.IsAction ())
{
WifiActionHeader actionHdr;
Ptr<Packet> p = m_currentPacket->Copy ();
p->RemoveHeader (actionHdr);
- if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK &&
- actionHdr.GetAction ().blockAck == WifiActionHeader::BLOCK_ACK_DELBA)
+ if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK
+ && actionHdr.GetAction ().blockAck == WifiActionHeader::BLOCK_ACK_DELBA)
{
MgtDelBaHeader delBa;
p->PeekHeader (delBa);
@@ -574,14 +590,14 @@
}
}
m_currentPacket = 0;
-
+
m_dcf->ResetCw ();
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
RestartAccessIfNeeded ();
- }
- else
+ }
+ else
{
- NS_LOG_DEBUG ("got ack. tx not done, size="<<m_currentPacket->GetSize ());
+ NS_LOG_DEBUG ("got ack. tx not done, size=" << m_currentPacket->GetSize ());
}
}
@@ -590,19 +606,19 @@
{
NS_LOG_FUNCTION (this);
NS_LOG_DEBUG ("missed ack");
- if (!NeedDataRetransmission ())
+ if (!NeedDataRetransmission ())
{
NS_LOG_DEBUG ("Ack Fail");
m_stationManager->ReportFinalDataFailed (m_currentHdr.GetAddr1 (), &m_currentHdr);
- if (!m_txFailedCallback.IsNull ())
+ if (!m_txFailedCallback.IsNull ())
{
m_txFailedCallback (m_currentHdr);
}
// to reset the dcf.
m_currentPacket = 0;
m_dcf->ResetCw ();
- }
- else
+ }
+ else
{
NS_LOG_DEBUG ("Retransmit");
m_currentHdr.SetRetry ();
@@ -621,7 +637,7 @@
NS_LOG_DEBUG ("Retransmit block ack request");
m_currentHdr.SetRetry ();
m_dcf->UpdateFailedCw ();
-
+
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
RestartAccessIfNeeded ();
}
@@ -636,9 +652,9 @@
EdcaTxopN::RestartAccessIfNeeded (void)
{
NS_LOG_FUNCTION (this);
- if ((m_currentPacket != 0 ||
- !m_queue->IsEmpty () || m_baManager->HasPackets ()) &&
- !m_dcf->IsAccessRequested ())
+ if ((m_currentPacket != 0
+ || !m_queue->IsEmpty () || m_baManager->HasPackets ())
+ && !m_dcf->IsAccessRequested ())
{
m_manager->RequestAccess (m_dcf);
}
@@ -648,9 +664,9 @@
EdcaTxopN::StartAccessIfNeeded (void)
{
NS_LOG_FUNCTION (this);
- if (m_currentPacket == 0 &&
- (!m_queue->IsEmpty () || m_baManager->HasPackets ()) &&
- !m_dcf->IsAccessRequested ())
+ if (m_currentPacket == 0
+ && (!m_queue->IsEmpty () || m_baManager->HasPackets ())
+ && !m_dcf->IsAccessRequested ())
{
m_manager->RequestAccess (m_dcf);
}
@@ -683,7 +699,7 @@
m_fragmentNumber++;
}
-void
+void
EdcaTxopN::StartNext (void)
{
NS_LOG_FUNCTION (this);
@@ -696,11 +712,11 @@
params.EnableAck ();
params.DisableRts ();
params.DisableOverrideDurationId ();
- if (IsLastFragment ())
+ if (IsLastFragment ())
{
params.DisableNextData ();
- }
- else
+ }
+ else
{
params.EnableNextData (GetNextFragmentSize ());
}
@@ -729,14 +745,14 @@
}
uint32_t
-EdcaTxopN::GetNextFragmentSize (void)
+EdcaTxopN::GetNextFragmentSize (void)
{
return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr,
m_currentPacket, m_fragmentNumber + 1);
}
uint32_t
-EdcaTxopN::GetFragmentOffset (void)
+EdcaTxopN::GetFragmentOffset (void)
{
return m_stationManager->GetFragmentOffset (m_currentHdr.GetAddr1 (), &m_currentHdr,
m_currentPacket, m_fragmentNumber);
@@ -757,15 +773,15 @@
hdr->SetFragmentNumber (m_fragmentNumber);
uint32_t startOffset = GetFragmentOffset ();
Ptr<Packet> fragment;
- if (IsLastFragment ())
+ if (IsLastFragment ())
{
hdr->SetNoMoreFragments ();
- }
- else
+ }
+ else
{
hdr->SetMoreFragments ();
}
- fragment = m_currentPacket->CreateFragment (startOffset,
+ fragment = m_currentPacket->CreateFragment (startOffset,
GetFragmentSize ());
return fragment;
}
@@ -828,20 +844,20 @@
EdcaTxopN::GotAddBaResponse (const MgtAddBaResponseHeader *respHdr, Mac48Address recipient)
{
NS_LOG_FUNCTION (this);
- NS_LOG_DEBUG ("received ADDBA response from "<<recipient);
+ NS_LOG_DEBUG ("received ADDBA response from " << recipient);
uint8_t tid = respHdr->GetTid ();
if (m_baManager->ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::PENDING))
- {
- if (respHdr->GetStatusCode ().IsSuccess ())
- {
- NS_LOG_DEBUG ("block ack agreement established with "<<recipient);
- m_baManager->UpdateAgreement (respHdr, recipient);
- }
- else
- {
- NS_LOG_DEBUG ("discard ADDBA response"<<recipient);
- m_baManager->NotifyAgreementUnsuccessful (recipient, tid);
- }
+ {
+ if (respHdr->GetStatusCode ().IsSuccess ())
+ {
+ NS_LOG_DEBUG ("block ack agreement established with " << recipient);
+ m_baManager->UpdateAgreement (respHdr, recipient);
+ }
+ else
+ {
+ NS_LOG_DEBUG ("discard ADDBA response" << recipient);
+ m_baManager->NotifyAgreementUnsuccessful (recipient, tid);
+ }
}
RestartAccessIfNeeded ();
}
@@ -850,14 +866,14 @@
EdcaTxopN::GotDelBaFrame (const MgtDelBaHeader *delBaHdr, Mac48Address recipient)
{
NS_LOG_FUNCTION (this);
- NS_LOG_DEBUG ("received DELBA frame from="<<recipient);
+ NS_LOG_DEBUG ("received DELBA frame from=" << recipient);
m_baManager->TearDownBlockAck (recipient, delBaHdr->GetTid ());
}
void
EdcaTxopN::GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient)
{
- NS_LOG_DEBUG ("got block ack from="<<recipient);
+ NS_LOG_DEBUG ("got block ack from=" << recipient);
m_baManager->NotifyGotBlockAck (blockAck, recipient);
m_currentPacket = 0;
m_dcf->ResetCw ();
@@ -993,11 +1009,11 @@
}
void
-EdcaTxopN::SendAddBaRequest (Mac48Address dest, uint8_t tid, uint16_t startSeq,
+EdcaTxopN::SendAddBaRequest (Mac48Address dest, uint8_t tid, uint16_t startSeq,
uint16_t timeout, bool immediateBAck)
{
NS_LOG_FUNCTION (this);
- NS_LOG_DEBUG ("sent ADDBA request to "<<dest);
+ NS_LOG_DEBUG ("sent ADDBA request to " << dest);
WifiMacHeader hdr;
hdr.SetAction ();
hdr.SetAddr1 (dest);
@@ -1005,7 +1021,7 @@
hdr.SetAddr3 (m_low->GetAddress ());
hdr.SetDsNotTo ();
hdr.SetDsNotFrom ();
-
+
WifiActionHeader actionHdr;
WifiActionHeader::ActionValue action;
action.blockAck = WifiActionHeader::BLOCK_ACK_ADDBA_REQUEST;
@@ -1032,10 +1048,10 @@
reqHdr.SetStartingSequence (startSeq);
m_baManager->CreateAgreement (&reqHdr, dest);
-
+
packet->AddHeader (reqHdr);
packet->AddHeader (actionHdr);
-
+
m_currentPacket = packet;
m_currentHdr = hdr;
@@ -1044,14 +1060,14 @@
m_currentHdr.SetFragmentNumber (0);
m_currentHdr.SetNoMoreFragments ();
m_currentHdr.SetNoRetry ();
-
+
MacLowTransmissionParameters params;
params.EnableAck ();
params.DisableRts ();
params.DisableNextData ();
params.DisableOverrideDurationId ();
-
- m_low->StartTransmission (m_currentPacket, &m_currentHdr, params,
+
+ m_low->StartTransmission (m_currentPacket, &m_currentHdr, params,
m_transmissionListener);
}
@@ -1081,7 +1097,7 @@
WifiActionHeader::ActionValue action;
action.blockAck = WifiActionHeader::BLOCK_ACK_DELBA;
actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
-
+
Ptr<Packet> packet = Create<Packet> ();
packet->AddHeader (delbaHdr);
packet->AddHeader (actionHdr);
--- a/src/wifi/model/edca-txop-n.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/edca-txop-n.h Sat May 07 21:49:46 2011 +0200
@@ -4,7 +4,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -62,7 +62,7 @@
};
-/**
+/**
* \ingroup wifi
* This queue contains packets for a particular access class.
* possibles access classes are:
@@ -71,13 +71,12 @@
* -AC_VI : video, tid = 4,5 |
* -AC_BE : best-effort, tid = 0,3 | priority
* -AC_BK : background, tid = 1,2 |
- *
+ *
* For more details see section 9.1.3.1 in 802.11 standard.
*/
class EdcaTxopN : public Dcf
{
public:
-
typedef Callback <void, const WifiMacHeader&> TxOk;
typedef Callback <void, const WifiMacHeader&> TxFailed;
@@ -95,7 +94,7 @@
void SetTypeOfStation (enum TypeOfStation type);
enum TypeOfStation GetTypeOfStation (void) const;
- Ptr<WifiMacQueue > GetQueue () const;
+ Ptr<WifiMacQueue > GetQueue () const;
virtual void SetMinCw (uint32_t minCw);
virtual void SetMaxCw (uint32_t maxCw);
virtual void SetAifsn (uint32_t aifsn);
--- a/src/wifi/model/error-rate-model.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/error-rate-model.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -27,11 +27,11 @@
{
static TypeId tid = TypeId ("ns3::ErrorRateModel")
.SetParent<Object> ()
- ;
+ ;
return tid;
}
-double
+double
ErrorRateModel::CalculateSnr (WifiMode txMode, double ber) const
{
// This is a very simple binary search.
@@ -39,15 +39,15 @@
low = 1e-25;
high = 1e25;
precision = 1e-12;
- while (high - low > precision)
+ while (high - low > precision)
{
NS_ASSERT (high >= low);
double middle = low + (high - low) / 2;
- if ((1 - GetChunkSuccessRate (txMode, middle, 1)) > ber)
+ if ((1 - GetChunkSuccessRate (txMode, middle, 1)) > ber)
{
low = middle;
- }
- else
+ }
+ else
{
high = middle;
}
--- a/src/wifi/model/error-rate-model.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/error-rate-model.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -28,7 +28,7 @@
/**
* \ingroup wifi
* \brief the interface for Wifi's error models
- *
+ *
*/
class ErrorRateModel : public Object
{
--- a/src/wifi/model/ideal-wifi-manager.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/ideal-wifi-manager.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -32,7 +32,7 @@
NS_OBJECT_ENSURE_REGISTERED (IdealWifiManager);
-TypeId
+TypeId
IdealWifiManager::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::IdealWifiManager")
@@ -43,32 +43,34 @@
DoubleValue (10e-6),
MakeDoubleAccessor (&IdealWifiManager::m_ber),
MakeDoubleChecker<double> ())
- ;
+ ;
return tid;
}
IdealWifiManager::IdealWifiManager ()
-{}
+{
+}
IdealWifiManager::~IdealWifiManager ()
-{}
+{
+}
-void
+void
IdealWifiManager::SetupPhy (Ptr<WifiPhy> phy)
{
uint32_t nModes = phy->GetNModes ();
- for (uint32_t i = 0; i < nModes; i++)
+ for (uint32_t i = 0; i < nModes; i++)
{
WifiMode mode = phy->GetMode (i);
AddModeSnrThreshold (mode, phy->CalculateSnr (mode, m_ber));
}
-
+
WifiRemoteStationManager::SetupPhy (phy);
}
-double
+double
IdealWifiManager::GetSnrThreshold (WifiMode mode) const
{
- for (Thresholds::const_iterator i = m_thresholds.begin (); i != m_thresholds.end (); i++)
+ for (Thresholds::const_iterator i = m_thresholds.begin (); i != m_thresholds.end (); i++)
{
if (mode == i->second)
{
@@ -79,7 +81,7 @@
return 0.0;
}
-void
+void
IdealWifiManager::AddModeSnrThreshold (WifiMode mode, double snr)
{
m_thresholds.push_back (std::make_pair (snr,mode));
@@ -94,43 +96,48 @@
}
-void
+void
IdealWifiManager::DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode)
-{}
-void
+{
+}
+void
IdealWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
-{}
-void
+{
+}
+void
IdealWifiManager::DoReportDataFailed (WifiRemoteStation *station)
-{}
-void
+{
+}
+void
IdealWifiManager::DoReportRtsOk (WifiRemoteStation *st,
double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st;
station->m_lastSnr = rtsSnr;
}
-void
+void
IdealWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
{
IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st;
station->m_lastSnr = dataSnr;
}
-void
+void
IdealWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
-{}
-void
+{
+}
+void
IdealWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
-{}
+{
+}
WifiMode
IdealWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
{
IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st;
- // We search within the Supported rate set the mode with the
- // highest snr threshold possible which is smaller than m_lastSnr
+ // We search within the Supported rate set the mode with the
+ // highest snr threshold possible which is smaller than m_lastSnr
// to ensure correct packet delivery.
double maxThreshold = 0.0;
WifiMode maxMode = GetDefaultMode ();
@@ -138,8 +145,8 @@
{
WifiMode mode = GetSupported (station, i);
double threshold = GetSnrThreshold (mode);
- if (threshold > maxThreshold &&
- threshold < station->m_lastSnr)
+ if (threshold > maxThreshold
+ && threshold < station->m_lastSnr)
{
maxThreshold = threshold;
maxMode = mode;
@@ -151,8 +158,8 @@
IdealWifiManager::DoGetRtsMode (WifiRemoteStation *st)
{
IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st;
- // We search within the Basic rate set the mode with the highest
- // snr threshold possible which is smaller than m_lastSnr to
+ // We search within the Basic rate set the mode with the highest
+ // snr threshold possible which is smaller than m_lastSnr to
// ensure correct packet delivery.
double maxThreshold = 0.0;
WifiMode maxMode = GetDefaultMode ();
@@ -160,8 +167,8 @@
{
WifiMode mode = GetBasicMode (i);
double threshold = GetSnrThreshold (mode);
- if (threshold > maxThreshold &&
- threshold < station->m_lastSnr)
+ if (threshold > maxThreshold
+ && threshold < station->m_lastSnr)
{
maxThreshold = threshold;
maxMode = mode;
@@ -170,7 +177,7 @@
return maxMode;
}
-bool
+bool
IdealWifiManager::IsLowLatency (void) const
{
return true;
--- a/src/wifi/model/ideal-wifi-manager.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/ideal-wifi-manager.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -36,13 +36,13 @@
* protocol for multihop wireless networks</i> by G. Holland,
* N. Vaidya, and P. Bahl.): every station keeps track of the
* snr of every packet received and sends back this snr to the
- * original transmitter by an out-of-band mechanism. Each
+ * original transmitter by an out-of-band mechanism. Each
* transmitter keeps track of the last snr sent back by a receiver
* and uses it to pick a transmission mode based on a set
- * of snr thresholds built from a target ber and transmission
+ * of snr thresholds built from a target ber and transmission
* mode-specific snr/ber curves.
*/
-class IdealWifiManager : public WifiRemoteStationManager
+class IdealWifiManager : public WifiRemoteStationManager
{
public:
static TypeId GetTypeId (void);
@@ -53,8 +53,8 @@
private:
// overriden from base class
- virtual WifiRemoteStation *DoCreateStation (void) const;
- virtual void DoReportRxOk (WifiRemoteStation *station,
+ virtual WifiRemoteStation* DoCreateStation (void) const;
+ virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
virtual void DoReportRtsFailed (WifiRemoteStation *station);
virtual void DoReportDataFailed (WifiRemoteStation *station);
--- a/src/wifi/model/interference-helper.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/interference-helper.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -32,74 +32,78 @@
* Phy event class
****************************************************************/
-InterferenceHelper::Event::Event (uint32_t size, WifiMode payloadMode,
- enum WifiPreamble preamble,
- Time duration, double rxPower)
+InterferenceHelper::Event::Event (uint32_t size, WifiMode payloadMode,
+ enum WifiPreamble preamble,
+ Time duration, double rxPower)
: m_size (size),
m_payloadMode (payloadMode),
m_preamble (preamble),
m_startTime (Simulator::Now ()),
m_endTime (m_startTime + duration),
m_rxPowerW (rxPower)
-{}
+{
+}
InterferenceHelper::Event::~Event ()
-{}
-
-Time
-InterferenceHelper::Event::GetDuration (void) const
+{
+}
+
+Time
+InterferenceHelper::Event::GetDuration (void) const
{
return m_endTime - m_startTime;
}
-Time
+Time
InterferenceHelper::Event::GetStartTime (void) const
{
return m_startTime;
}
-Time
+Time
InterferenceHelper::Event::GetEndTime (void) const
{
return m_endTime;
}
-double
+double
InterferenceHelper::Event::GetRxPowerW (void) const
{
return m_rxPowerW;
}
-uint32_t
+uint32_t
InterferenceHelper::Event::GetSize (void) const
{
return m_size;
}
-WifiMode
+WifiMode
InterferenceHelper::Event::GetPayloadMode (void) const
{
return m_payloadMode;
}
-enum WifiPreamble
+enum WifiPreamble
InterferenceHelper::Event::GetPreambleType (void) const
{
return m_preamble;
}
/****************************************************************
- * Class which records SNIR change events for a
+ * Class which records SNIR change events for a
* short period of time.
****************************************************************/
InterferenceHelper::NiChange::NiChange (Time time, double delta)
- : m_time (time), m_delta (delta)
-{}
+ : m_time (time),
+ m_delta (delta)
+{
+}
Time
InterferenceHelper::NiChange::GetTime (void) const
{
return m_time;
}
-double
+double
InterferenceHelper::NiChange::GetDelta (void) const
{
return m_delta;
}
-bool
+bool
InterferenceHelper::NiChange::operator < (const InterferenceHelper::NiChange& o) const
{
return (m_time < o.m_time);
@@ -113,56 +117,56 @@
: m_errorRateModel (0),
m_firstPower (0.0),
m_rxing (false)
-{}
+{
+}
InterferenceHelper::~InterferenceHelper ()
{
EraseEvents ();
m_errorRateModel = 0;
}
-Ptr<InterferenceHelper::Event>
-InterferenceHelper::Add (uint32_t size, WifiMode payloadMode,
- enum WifiPreamble preamble,
- Time duration, double rxPowerW)
+Ptr<InterferenceHelper::Event>
+InterferenceHelper::Add (uint32_t size, WifiMode payloadMode,
+ enum WifiPreamble preamble,
+ Time duration, double rxPowerW)
{
Ptr<InterferenceHelper::Event> event;
- event = Create<InterferenceHelper::Event>
- (size,
- payloadMode,
- preamble,
- duration,
- rxPowerW);
+ event = Create<InterferenceHelper::Event> (size,
+ payloadMode,
+ preamble,
+ duration,
+ rxPowerW);
AppendEvent (event);
return event;
}
-void
+void
InterferenceHelper::SetNoiseFigure (double value)
{
m_noiseFigure = value;
}
-double
+double
InterferenceHelper::GetNoiseFigure (void) const
{
return m_noiseFigure;
}
-void
+void
InterferenceHelper::SetErrorRateModel (Ptr<ErrorRateModel> rate)
{
m_errorRateModel = rate;
}
-Ptr<ErrorRateModel>
+Ptr<ErrorRateModel>
InterferenceHelper::GetErrorRateModel (void) const
{
return m_errorRateModel;
}
-Time
+Time
InterferenceHelper::GetEnergyDuration (double energyW)
{
Time now = Simulator::Now ();
@@ -178,53 +182,54 @@
continue;
}
if (noiseInterferenceW < energyW)
- {
- break;
- }
+ {
+ break;
+ }
}
return end > now ? end - now : MicroSeconds (0);
}
-WifiMode
+WifiMode
InterferenceHelper::GetPlcpHeaderMode (WifiMode payloadMode, WifiPreamble preamble)
{
switch (payloadMode.GetModulationClass ())
- {
- case WIFI_MOD_CLASS_OFDM:
- {
- switch (payloadMode.GetBandwidth ()) {
- case 5000000:
- return WifiPhy::GetOfdmRate1_5MbpsBW5MHz ();
- case 10000000:
- return WifiPhy::GetOfdmRate3MbpsBW10MHz ();
- default:
- // IEEE Std 802.11-2007, 17.3.2
- // actually this is only the first part of the PlcpHeader,
- // because the last 16 bits of the PlcpHeader are using the
- // same mode of the payload
- return WifiPhy::GetOfdmRate6Mbps ();
- }
- }
+ {
+ case WIFI_MOD_CLASS_OFDM:
+ {
+ switch (payloadMode.GetBandwidth ())
+ {
+ case 5000000:
+ return WifiPhy::GetOfdmRate1_5MbpsBW5MHz ();
+ case 10000000:
+ return WifiPhy::GetOfdmRate3MbpsBW10MHz ();
+ default:
+ // IEEE Std 802.11-2007, 17.3.2
+ // actually this is only the first part of the PlcpHeader,
+ // because the last 16 bits of the PlcpHeader are using the
+ // same mode of the payload
+ return WifiPhy::GetOfdmRate6Mbps ();
+ }
+ }
- case WIFI_MOD_CLASS_ERP_OFDM:
- return WifiPhy::GetErpOfdmRate6Mbps ();
+ case WIFI_MOD_CLASS_ERP_OFDM:
+ return WifiPhy::GetErpOfdmRate6Mbps ();
- case WIFI_MOD_CLASS_DSSS:
- if (preamble == WIFI_PREAMBLE_LONG)
- {
- // IEEE Std 802.11-2007, sections 15.2.3 and 18.2.2.1
- return WifiPhy::GetDsssRate1Mbps ();
- }
- else // WIFI_PREAMBLE_SHORT
- {
- // IEEE Std 802.11-2007, section 18.2.2.2
- return WifiPhy::GetDsssRate2Mbps ();
- }
+ case WIFI_MOD_CLASS_DSSS:
+ if (preamble == WIFI_PREAMBLE_LONG)
+ {
+ // IEEE Std 802.11-2007, sections 15.2.3 and 18.2.2.1
+ return WifiPhy::GetDsssRate1Mbps ();
+ }
+ else // WIFI_PREAMBLE_SHORT
+ {
+ // IEEE Std 802.11-2007, section 18.2.2.2
+ return WifiPhy::GetDsssRate2Mbps ();
+ }
- default:
- NS_FATAL_ERROR("unsupported modulation class");
- return WifiMode ();
- }
+ default:
+ NS_FATAL_ERROR ("unsupported modulation class");
+ return WifiMode ();
+ }
}
uint32_t
@@ -234,23 +239,24 @@
{
case WIFI_MOD_CLASS_OFDM:
{
- switch (payloadMode.GetBandwidth ()) {
- case 20000000:
- default:
- // IEEE Std 802.11-2007, section 17.3.3 and figure 17-4
- // also section 17.3.2.3, table 17-4
- // We return the duration of the SIGNAL field only, since the
- // SERVICE field (which strictly speaking belongs to the PLCP
- // header, see section 17.3.2 and figure 17-1) is sent using the
- // payload mode.
- return 4;
- case 10000000:
- // IEEE Std 802.11-2007, section 17.3.2.3, table 17-4
- return 8;
- case 5000000:
- // IEEE Std 802.11-2007, section 17.3.2.3, table 17-4
- return 16;
- }
+ switch (payloadMode.GetBandwidth ())
+ {
+ case 20000000:
+ default:
+ // IEEE Std 802.11-2007, section 17.3.3 and figure 17-4
+ // also section 17.3.2.3, table 17-4
+ // We return the duration of the SIGNAL field only, since the
+ // SERVICE field (which strictly speaking belongs to the PLCP
+ // header, see section 17.3.2 and figure 17-1) is sent using the
+ // payload mode.
+ return 4;
+ case 10000000:
+ // IEEE Std 802.11-2007, section 17.3.2.3, table 17-4
+ return 8;
+ case 5000000:
+ // IEEE Std 802.11-2007, section 17.3.2.3, table 17-4
+ return 16;
+ }
}
case WIFI_MOD_CLASS_ERP_OFDM:
@@ -269,33 +275,34 @@
}
default:
- NS_FATAL_ERROR("unsupported modulation class");
+ NS_FATAL_ERROR ("unsupported modulation class");
return 0;
}
}
-uint32_t
+uint32_t
InterferenceHelper::GetPlcpPreambleDurationMicroSeconds (WifiMode payloadMode, WifiPreamble preamble)
{
switch (payloadMode.GetModulationClass ())
{
case WIFI_MOD_CLASS_OFDM:
{
- switch (payloadMode.GetBandwidth ()) {
- case 20000000:
- default:
- // IEEE Std 802.11-2007, section 17.3.3, figure 17-4
- // also section 17.3.2.3, table 17-4
- return 16;
- case 10000000:
- // IEEE Std 802.11-2007, section 17.3.3, table 17-4
- // also section 17.3.2.3, table 17-4
- return 32;
- case 5000000:
- // IEEE Std 802.11-2007, section 17.3.3
- // also section 17.3.2.3, table 17-4
- return 64;
- }
+ switch (payloadMode.GetBandwidth ())
+ {
+ case 20000000:
+ default:
+ // IEEE Std 802.11-2007, section 17.3.3, figure 17-4
+ // also section 17.3.2.3, table 17-4
+ return 16;
+ case 10000000:
+ // IEEE Std 802.11-2007, section 17.3.3, table 17-4
+ // also section 17.3.2.3, table 17-4
+ return 32;
+ case 5000000:
+ // IEEE Std 802.11-2007, section 17.3.3
+ // also section 17.3.2.3, table 17-4
+ return 64;
+ }
}
case WIFI_MOD_CLASS_ERP_OFDM:
@@ -314,15 +321,15 @@
}
default:
- NS_FATAL_ERROR("unsupported modulation class");
+ NS_FATAL_ERROR ("unsupported modulation class");
return 0;
}
}
-uint32_t
+uint32_t
InterferenceHelper::GetPayloadDurationMicroSeconds (uint32_t size, WifiMode payloadMode)
{
- NS_LOG_FUNCTION(size << payloadMode);
+ NS_LOG_FUNCTION (size << payloadMode);
switch (payloadMode.GetModulationClass ())
{
@@ -333,56 +340,61 @@
// corresponds to T_{SYM} in the table
uint32_t symbolDurationUs;
- switch (payloadMode.GetBandwidth ()) {
- case 20000000:
- default:
- symbolDurationUs = 4;
- break;
- case 10000000:
- symbolDurationUs = 8;
- break;
- case 5000000:
- symbolDurationUs = 16;
- break;
- }
+ switch (payloadMode.GetBandwidth ())
+ {
+ case 20000000:
+ default:
+ symbolDurationUs = 4;
+ break;
+ case 10000000:
+ symbolDurationUs = 8;
+ break;
+ case 5000000:
+ symbolDurationUs = 16;
+ break;
+ }
// IEEE Std 802.11-2007, section 17.3.2.2, table 17-3
// corresponds to N_{DBPS} in the table
double numDataBitsPerSymbol = payloadMode.GetDataRate () * symbolDurationUs / 1e6;
// IEEE Std 802.11-2007, section 17.3.5.3, equation (17-11)
- uint32_t numSymbols = lrint (ceil ((16 + size * 8.0 + 6.0)/numDataBitsPerSymbol));
+ uint32_t numSymbols = lrint (ceil ((16 + size * 8.0 + 6.0) / numDataBitsPerSymbol));
// Add signal extension for ERP PHY
if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
- return numSymbols*symbolDurationUs + 6;
+ {
+ return numSymbols * symbolDurationUs + 6;
+ }
else
- return numSymbols*symbolDurationUs;
+ {
+ return numSymbols * symbolDurationUs;
+ }
}
case WIFI_MOD_CLASS_DSSS:
// IEEE Std 802.11-2007, section 18.2.3.5
- NS_LOG_LOGIC(" size=" << size
- << " mode=" << payloadMode
- << " rate=" << payloadMode.GetDataRate () );
- return lrint(ceil ((size * 8.0) / (payloadMode.GetDataRate () / 1.0e6)));
+ NS_LOG_LOGIC (" size=" << size
+ << " mode=" << payloadMode
+ << " rate=" << payloadMode.GetDataRate () );
+ return lrint (ceil ((size * 8.0) / (payloadMode.GetDataRate () / 1.0e6)));
default:
- NS_FATAL_ERROR("unsupported modulation class");
+ NS_FATAL_ERROR ("unsupported modulation class");
return 0;
}
}
Time
-InterferenceHelper::CalculateTxDuration (uint32_t size, WifiMode payloadMode, WifiPreamble preamble)
+InterferenceHelper::CalculateTxDuration (uint32_t size, WifiMode payloadMode, WifiPreamble preamble)
{
- uint32_t duration = GetPlcpPreambleDurationMicroSeconds (payloadMode, preamble)
- + GetPlcpHeaderDurationMicroSeconds (payloadMode, preamble)
- + GetPayloadDurationMicroSeconds (size, payloadMode);
+ uint32_t duration = GetPlcpPreambleDurationMicroSeconds (payloadMode, preamble)
+ + GetPlcpHeaderDurationMicroSeconds (payloadMode, preamble)
+ + GetPayloadDurationMicroSeconds (size, payloadMode);
return MicroSeconds (duration);
}
-void
+void
InterferenceHelper::AppendEvent (Ptr<InterferenceHelper::Event> event)
{
Time now = Simulator::Now ();
@@ -394,13 +406,13 @@
m_firstPower += i->GetDelta ();
}
m_niChanges.erase (m_niChanges.begin (), nowIterator);
- m_niChanges.insert (m_niChanges.begin (), NiChange (event->GetStartTime (), event->GetRxPowerW ()));
+ m_niChanges.insert (m_niChanges.begin (), NiChange (event->GetStartTime (), event->GetRxPowerW ()));
}
else
{
AddNiChangeEvent (NiChange (event->GetStartTime (), event->GetRxPowerW ()));
}
- AddNiChangeEvent(NiChange (event->GetEndTime (), -event->GetRxPowerW ()));
+ AddNiChangeEvent (NiChange (event->GetEndTime (), -event->GetRxPowerW ()));
}
@@ -440,21 +452,22 @@
double
InterferenceHelper::CalculateChunkSuccessRate (double snir, Time duration, WifiMode mode) const
{
- if (duration == NanoSeconds (0)) {
- return 1.0;
- }
+ if (duration == NanoSeconds (0))
+ {
+ return 1.0;
+ }
uint32_t rate = mode.GetPhyRate ();
uint64_t nbits = (uint64_t)(rate * duration.GetSeconds ());
double csr = m_errorRateModel->GetChunkSuccessRate (mode, snir, (uint32_t)nbits);
return csr;
}
-double
+double
InterferenceHelper::CalculatePer (Ptr<const InterferenceHelper::Event> event, NiChanges *ni) const
-{
+{
double psr = 1.0; /* Packet Success Rate */
NiChanges::iterator j = ni->begin ();
- Time previous = (*j).GetTime ();
+ Time previous = (*j).GetTime ();
WifiMode payloadMode = event->GetPayloadMode ();
WifiPreamble preamble = event->GetPreambleType ();
WifiMode headerMode = GetPlcpHeaderMode (payloadMode, preamble);
@@ -464,64 +477,64 @@
double powerW = event->GetRxPowerW ();
j++;
- while (ni->end () != j)
+ while (ni->end () != j)
{
Time current = (*j).GetTime ();
NS_ASSERT (current >= previous);
-
- if (previous >= plcpPayloadStart)
+
+ if (previous >= plcpPayloadStart)
{
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- payloadMode),
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ payloadMode),
current - previous,
payloadMode);
- }
- else if (previous >= plcpHeaderStart)
+ }
+ else if (previous >= plcpHeaderStart)
{
- if (current >= plcpPayloadStart)
+ if (current >= plcpPayloadStart)
{
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- headerMode),
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ headerMode),
plcpPayloadStart - previous,
headerMode);
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
payloadMode),
current - plcpPayloadStart,
payloadMode);
- }
- else
+ }
+ else
{
NS_ASSERT (current >= plcpHeaderStart);
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- headerMode),
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ headerMode),
current - previous,
headerMode);
}
- }
- else
+ }
+ else
{
- if (current >= plcpPayloadStart)
+ if (current >= plcpPayloadStart)
{
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- headerMode),
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ headerMode),
plcpPayloadStart - plcpHeaderStart,
headerMode);
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- payloadMode),
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ payloadMode),
current - plcpPayloadStart,
payloadMode);
- }
- else if (current >= plcpHeaderStart)
+ }
+ else if (current >= plcpHeaderStart)
{
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- headerMode),
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ headerMode),
current - plcpHeaderStart,
headerMode);
}
@@ -537,7 +550,7 @@
}
-struct InterferenceHelper::SnrPer
+struct InterferenceHelper::SnrPer
InterferenceHelper::CalculateSnrPer (Ptr<InterferenceHelper::Event> event)
{
NiChanges ni;
@@ -545,7 +558,7 @@
double snr = CalculateSnr (event->GetRxPowerW (),
noiseInterferenceW,
event->GetPayloadMode ());
-
+
/* calculate the SNIR at the start of the packet and accumulate
* all SNIR changes in the snir vector.
*/
@@ -558,8 +571,8 @@
}
void
-InterferenceHelper::EraseEvents (void)
-{
+InterferenceHelper::EraseEvents (void)
+{
m_niChanges.clear ();
m_rxing = false;
m_firstPower = 0.0;
--- a/src/wifi/model/interference-helper.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/interference-helper.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -42,12 +42,12 @@
public:
class Event : public SimpleRefCount<InterferenceHelper::Event>
{
- public:
- Event (uint32_t size, WifiMode payloadMode,
- enum WifiPreamble preamble,
- Time duration, double rxPower);
+public:
+ Event (uint32_t size, WifiMode payloadMode,
+ enum WifiPreamble preamble,
+ Time duration, double rxPower);
~Event ();
-
+
Time GetDuration (void) const;
Time GetStartTime (void) const;
Time GetEndTime (void) const;
@@ -55,7 +55,7 @@
uint32_t GetSize (void) const;
WifiMode GetPayloadMode (void) const;
enum WifiPreamble GetPreambleType (void) const;
- private:
+private:
uint32_t m_size;
WifiMode m_payloadMode;
enum WifiPreamble m_preamble;
@@ -63,7 +63,7 @@
Time m_endTime;
double m_rxPowerW;
};
- struct SnrPer
+ struct SnrPer
{
double snr;
double per;
@@ -81,34 +81,35 @@
/**
* \param energyW the minimum energy (W) requested
- * \returns the expected amount of time the observed
+ * \returns the expected amount of time the observed
* energy on the medium will be higher than
* the requested threshold.
*/
Time GetEnergyDuration (double energyW);
-
+
static WifiMode GetPlcpHeaderMode (WifiMode payloadMode, WifiPreamble preamble);
static uint32_t GetPlcpHeaderDurationMicroSeconds (WifiMode payloadMode, WifiPreamble preamble);
static uint32_t GetPlcpPreambleDurationMicroSeconds (WifiMode mode, WifiPreamble preamble);
static uint32_t GetPayloadDurationMicroSeconds (uint32_t size, WifiMode payloadMode);
static Time CalculateTxDuration (uint32_t size, WifiMode payloadMode, WifiPreamble preamble);
- Ptr<InterferenceHelper::Event> Add (uint32_t size, WifiMode payloadMode,
- enum WifiPreamble preamble,
- Time duration, double rxPower);
+ Ptr<InterferenceHelper::Event> Add (uint32_t size, WifiMode payloadMode,
+ enum WifiPreamble preamble,
+ Time duration, double rxPower);
struct InterferenceHelper::SnrPer CalculateSnrPer (Ptr<InterferenceHelper::Event> event);
void NotifyRxStart ();
void NotifyRxEnd ();
- void EraseEvents (void);
+ void EraseEvents (void);
private:
- class NiChange {
- public:
+ class NiChange
+ {
+public:
NiChange (Time time, double delta);
Time GetTime (void) const;
double GetDelta (void) const;
bool operator < (const NiChange& o) const;
- private:
+private:
Time m_time;
double m_delta;
};
--- a/src/wifi/model/mac-low.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/mac-low.cc Sat May 07 21:49:46 2011 +0200
@@ -4,7 +4,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -45,7 +45,6 @@
class SnrTag : public Tag
{
public:
-
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
@@ -60,7 +59,7 @@
double m_snr;
};
-TypeId
+TypeId
SnrTag::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::SnrTag")
@@ -73,38 +72,38 @@
;
return tid;
}
-TypeId
+TypeId
SnrTag::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
-uint32_t
+uint32_t
SnrTag::GetSerializedSize (void) const
{
return sizeof (double);
}
-void
+void
SnrTag::Serialize (TagBuffer i) const
{
i.WriteDouble (m_snr);
}
-void
+void
SnrTag::Deserialize (TagBuffer i)
{
m_snr = i.ReadDouble ();
}
-void
+void
SnrTag::Print (std::ostream &os) const
{
os << "Snr=" << m_snr;
}
-void
+void
SnrTag::Set (double snr)
{
m_snr = snr;
}
-double
+double
SnrTag::Get (void) const
{
return m_snr;
@@ -247,12 +246,12 @@
{
return (m_waitAck == BLOCK_ACK_MULTI_TID) ? true : false;
}
-bool
+bool
MacLowTransmissionParameters::MustSendRts (void) const
{
return m_sendRts;
}
-bool
+bool
MacLowTransmissionParameters::HasDurationId (void) const
{
return (m_overrideDurationId != Seconds (0));
@@ -263,12 +262,12 @@
NS_ASSERT (m_overrideDurationId != Seconds (0));
return m_overrideDurationId;
}
-bool
+bool
MacLowTransmissionParameters::HasNextPacket (void) const
{
return (m_nextSize != 0);
}
-uint32_t
+uint32_t
MacLowTransmissionParameters::GetNextPacketSize (void) const
{
NS_ASSERT (HasNextPacket ());
@@ -277,12 +276,13 @@
std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters ¶ms)
{
- os << "["
- << "send rts=" << params.m_sendRts << ", "
- << "next size=" << params.m_nextSize << ", "
- << "dur=" << params.m_overrideDurationId << ", "
- << "ack=";
- switch (params.m_waitAck) {
+ os << "["
+ << "send rts=" << params.m_sendRts << ", "
+ << "next size=" << params.m_nextSize << ", "
+ << "dur=" << params.m_overrideDurationId << ", "
+ << "ack=";
+ switch (params.m_waitAck)
+ {
case MacLowTransmissionParameters::ACK_NONE:
os << "none";
break;
@@ -315,17 +315,33 @@
***************************************************************/
-class PhyMacLowListener : public ns3::WifiPhyListener {
+class PhyMacLowListener : public ns3::WifiPhyListener
+{
public:
PhyMacLowListener (ns3::MacLow *macLow)
- : m_macLow (macLow) {}
- virtual ~PhyMacLowListener () {}
- virtual void NotifyRxStart (Time duration) {}
- virtual void NotifyRxEndOk (void) {}
- virtual void NotifyRxEndError (void) {}
- virtual void NotifyTxStart (Time duration) {}
- virtual void NotifyMaybeCcaBusyStart (Time duration) {}
- virtual void NotifySwitchingStart (Time duration) {
+ : m_macLow (macLow)
+ {
+ }
+ virtual ~PhyMacLowListener ()
+ {
+ }
+ virtual void NotifyRxStart (Time duration)
+ {
+ }
+ virtual void NotifyRxEndOk (void)
+ {
+ }
+ virtual void NotifyRxEndError (void)
+ {
+ }
+ virtual void NotifyTxStart (Time duration)
+ {
+ }
+ virtual void NotifyMaybeCcaBusyStart (Time duration)
+ {
+ }
+ virtual void NotifySwitchingStart (Time duration)
+ {
m_macLow->NotifySwitchingStartNow (duration);
}
private:
@@ -357,15 +373,15 @@
NS_LOG_FUNCTION (this);
}
-void
+void
MacLow::SetupPhyMacLowListener (Ptr<WifiPhy> phy)
{
- m_phyMacLowListener = new PhyMacLowListener (this);
+ m_phyMacLowListener = new PhyMacLowListener (this);
phy->RegisterListener (m_phyMacLowListener);
}
-void
+void
MacLow::DoDispose (void)
{
NS_LOG_FUNCTION (this);
@@ -390,22 +406,22 @@
{
NS_LOG_FUNCTION (this);
bool oneRunning = false;
- if (m_normalAckTimeoutEvent.IsRunning ())
+ if (m_normalAckTimeoutEvent.IsRunning ())
{
m_normalAckTimeoutEvent.Cancel ();
oneRunning = true;
}
- if (m_fastAckTimeoutEvent.IsRunning ())
+ if (m_fastAckTimeoutEvent.IsRunning ())
{
m_fastAckTimeoutEvent.Cancel ();
oneRunning = true;
}
- if (m_superFastAckTimeoutEvent.IsRunning ())
+ if (m_superFastAckTimeoutEvent.IsRunning ())
{
m_superFastAckTimeoutEvent.Cancel ();
oneRunning = true;
}
- if (m_fastAckFailedTimeoutEvent.IsRunning ())
+ if (m_fastAckFailedTimeoutEvent.IsRunning ())
{
m_fastAckFailedTimeoutEvent.Cancel ();
oneRunning = true;
@@ -415,32 +431,32 @@
m_blockAckTimeoutEvent.Cancel ();
oneRunning = true;
}
- if (m_ctsTimeoutEvent.IsRunning ())
+ if (m_ctsTimeoutEvent.IsRunning ())
{
m_ctsTimeoutEvent.Cancel ();
oneRunning = true;
}
- if (m_sendCtsEvent.IsRunning ())
+ if (m_sendCtsEvent.IsRunning ())
{
m_sendCtsEvent.Cancel ();
oneRunning = true;
}
- if (m_sendAckEvent.IsRunning ())
+ if (m_sendAckEvent.IsRunning ())
{
m_sendAckEvent.Cancel ();
oneRunning = true;
}
- if (m_sendDataEvent.IsRunning ())
+ if (m_sendDataEvent.IsRunning ())
{
m_sendDataEvent.Cancel ();
oneRunning = true;
}
- if (m_waitSifsEvent.IsRunning ())
+ if (m_waitSifsEvent.IsRunning ())
{
m_waitSifsEvent.Cancel ();
oneRunning = true;
}
- if (oneRunning && m_listener != 0)
+ if (oneRunning && m_listener != 0)
{
m_listener->Cancel ();
m_listener = 0;
@@ -453,20 +469,20 @@
m_phy = phy;
m_phy->SetReceiveOkCallback (MakeCallback (&MacLow::ReceiveOk, this));
m_phy->SetReceiveErrorCallback (MakeCallback (&MacLow::ReceiveError, this));
- SetupPhyMacLowListener(phy);
+ SetupPhyMacLowListener (phy);
}
-void
+void
MacLow::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> manager)
{
m_stationManager = manager;
}
-void
+void
MacLow::SetAddress (Mac48Address ad)
{
m_self = ad;
}
-void
+void
MacLow::SetAckTimeout (Time ackTimeout)
{
m_ackTimeout = ackTimeout;
@@ -481,7 +497,7 @@
{
m_compressedBlockAckTimeout = blockAckTimeout;
}
-void
+void
MacLow::SetCtsTimeout (Time ctsTimeout)
{
m_ctsTimeout = ctsTimeout;
@@ -491,12 +507,12 @@
{
m_sifs = sifs;
}
-void
+void
MacLow::SetSlotTime (Time slotTime)
{
m_slotTime = slotTime;
}
-void
+void
MacLow::SetPifs (Time pifs)
{
m_pifs = pifs;
@@ -506,12 +522,12 @@
{
m_bssid = bssid;
}
-Mac48Address
+Mac48Address
MacLow::GetAddress (void) const
{
return m_self;
}
-Time
+Time
MacLow::GetAckTimeout (void) const
{
return m_ackTimeout;
@@ -526,7 +542,7 @@
{
return m_compressedBlockAckTimeout;
}
-Time
+Time
MacLow::GetCtsTimeout (void) const
{
return m_ctsTimeout;
@@ -536,37 +552,37 @@
{
return m_sifs;
}
-Time
+Time
MacLow::GetSlotTime (void) const
{
return m_slotTime;
}
-Time
+Time
MacLow::GetPifs (void) const
{
return m_pifs;
}
-Mac48Address
+Mac48Address
MacLow::GetBssid (void) const
{
return m_bssid;
}
-void
+void
MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *> callback)
{
m_rxCallback = callback;
}
-void
+void
MacLow::RegisterDcfListener (MacLowDcfListener *listener)
{
m_dcfListeners.push_back (listener);
}
-void
-MacLow::StartTransmission (Ptr<const Packet> packet,
- const WifiMacHeader* hdr,
+void
+MacLow::StartTransmission (Ptr<const Packet> packet,
+ const WifiMacHeader* hdr,
MacLowTransmissionParameters params,
MacLowTransmissionListener *listener)
{
@@ -576,12 +592,12 @@
* - ctsTimeout
* - sendDataAfterCTS
* expired. This means that one of these timers is still
- * running. They are all cancelled below anyway by the
+ * running. They are all cancelled below anyway by the
* call to CancelAllEvents (because of at least one
* of these two timer) which will trigger a call to the
* previous listener's cancel method.
*
- * This typically happens because the high-priority
+ * This typically happens because the high-priority
* QapScheduler has taken access to the channel from
* one of the Edca of the QAP.
*/
@@ -593,14 +609,14 @@
//NS_ASSERT (m_phy->IsStateIdle ());
- NS_LOG_DEBUG ("startTx size="<< GetSize (m_currentPacket, &m_currentHdr) <<
- ", to=" << m_currentHdr.GetAddr1()<<", listener="<<m_listener);
+ NS_LOG_DEBUG ("startTx size=" << GetSize (m_currentPacket, &m_currentHdr) <<
+ ", to=" << m_currentHdr.GetAddr1 () << ", listener=" << m_listener);
- if (m_txParams.MustSendRts ())
+ if (m_txParams.MustSendRts ())
{
SendRtsForPacket ();
- }
- else
+ }
+ else
{
SendDataPacket ();
}
@@ -614,32 +630,32 @@
{
NS_LOG_FUNCTION (this << packet << rxSnr);
NS_LOG_DEBUG ("rx failed ");
- if (m_txParams.MustWaitFastAck ())
+ if (m_txParams.MustWaitFastAck ())
{
NS_ASSERT (m_fastAckFailedTimeoutEvent.IsExpired ());
- m_fastAckFailedTimeoutEvent = Simulator::Schedule (GetSifs (),
+ m_fastAckFailedTimeoutEvent = Simulator::Schedule (GetSifs (),
&MacLow::FastAckFailedTimeout, this);
}
return;
}
-void
+void
MacLow::NotifySwitchingStartNow (Time duration)
{
- NS_LOG_DEBUG ("switching channel. Cancelling MAC pending events");
- m_stationManager->Reset();
- CancelAllEvents();
+ NS_LOG_DEBUG ("switching channel. Cancelling MAC pending events");
+ m_stationManager->Reset ();
+ CancelAllEvents ();
if (m_navCounterResetCtsMissed.IsRunning ())
{
- m_navCounterResetCtsMissed.Cancel();
+ m_navCounterResetCtsMissed.Cancel ();
}
- m_lastNavStart = Simulator::Now ();
+ m_lastNavStart = Simulator::Now ();
m_lastNavDuration = Seconds (0);
m_currentPacket = 0;
m_listener = 0;
}
-void
+void
MacLow::ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiMode txMode, WifiPreamble preamble)
{
NS_LOG_FUNCTION (this << packet << rxSnr << txMode << preamble);
@@ -654,39 +670,39 @@
bool isPrevNavZero = IsNavZero ();
NS_LOG_DEBUG ("duration/id=" << hdr.GetDuration ());
NotifyNav (hdr, txMode, preamble);
- if (hdr.IsRts ())
+ if (hdr.IsRts ())
{
/* see section 9.2.5.7 802.11-1999
- * A STA that is addressed by an RTS frame shall transmit a CTS frame after a SIFS
- * period if the NAV at the STA receiving the RTS frame indicates that the medium is
- * idle. If the NAV at the STA receiving the RTS indicates the medium is not idle,
+ * A STA that is addressed by an RTS frame shall transmit a CTS frame after a SIFS
+ * period if the NAV at the STA receiving the RTS frame indicates that the medium is
+ * idle. If the NAV at the STA receiving the RTS indicates the medium is not idle,
* that STA shall not respond to the RTS frame.
*/
- if (isPrevNavZero &&
- hdr.GetAddr1 () == m_self)
+ if (isPrevNavZero
+ && hdr.GetAddr1 () == m_self)
{
NS_LOG_DEBUG ("rx RTS from=" << hdr.GetAddr2 () << ", schedule CTS");
NS_ASSERT (m_sendCtsEvent.IsExpired ());
- m_stationManager->ReportRxOk (hdr.GetAddr2 (), &hdr,
+ m_stationManager->ReportRxOk (hdr.GetAddr2 (), &hdr,
rxSnr, txMode);
m_sendCtsEvent = Simulator::Schedule (GetSifs (),
&MacLow::SendCtsAfterRts, this,
- hdr.GetAddr2 (),
+ hdr.GetAddr2 (),
hdr.GetDuration (),
txMode,
rxSnr);
- }
- else
+ }
+ else
{
NS_LOG_DEBUG ("rx RTS from=" << hdr.GetAddr2 () << ", cannot schedule CTS");
}
- }
- else if (hdr.IsCts () &&
- hdr.GetAddr1 () == m_self &&
- m_ctsTimeoutEvent.IsRunning () &&
- m_currentPacket != 0)
+ }
+ else if (hdr.IsCts ()
+ && hdr.GetAddr1 () == m_self
+ && m_ctsTimeoutEvent.IsRunning ()
+ && m_currentPacket != 0)
{
- NS_LOG_DEBUG ("receive cts from="<<m_currentHdr.GetAddr1 ());
+ NS_LOG_DEBUG ("receive cts from=" << m_currentHdr.GetAddr1 ());
SnrTag tag;
packet->RemovePacketTag (tag);
m_stationManager->ReportRxOk (m_currentHdr.GetAddr1 (), &m_currentHdr,
@@ -698,20 +714,20 @@
NotifyCtsTimeoutResetNow ();
m_listener->GotCts (rxSnr, txMode);
NS_ASSERT (m_sendDataEvent.IsExpired ());
- m_sendDataEvent = Simulator::Schedule (GetSifs (),
- &MacLow::SendDataAfterCts, this,
+ m_sendDataEvent = Simulator::Schedule (GetSifs (),
+ &MacLow::SendDataAfterCts, this,
hdr.GetAddr1 (),
hdr.GetDuration (),
txMode);
- }
- else if (hdr.IsAck () &&
- hdr.GetAddr1 () == m_self &&
- (m_normalAckTimeoutEvent.IsRunning () ||
- m_fastAckTimeoutEvent.IsRunning () ||
- m_superFastAckTimeoutEvent.IsRunning ()) &&
- m_txParams.MustWaitAck ())
+ }
+ else if (hdr.IsAck ()
+ && hdr.GetAddr1 () == m_self
+ && (m_normalAckTimeoutEvent.IsRunning ()
+ || m_fastAckTimeoutEvent.IsRunning ()
+ || m_superFastAckTimeoutEvent.IsRunning ())
+ && m_txParams.MustWaitAck ())
{
- NS_LOG_DEBUG ("receive ack from="<<m_currentHdr.GetAddr1 ());
+ NS_LOG_DEBUG ("receive ack from=" << m_currentHdr.GetAddr1 ());
SnrTag tag;
packet->RemovePacketTag (tag);
m_stationManager->ReportRxOk (m_currentHdr.GetAddr1 (), &m_currentHdr,
@@ -719,35 +735,35 @@
m_stationManager->ReportDataOk (m_currentHdr.GetAddr1 (), &m_currentHdr,
rxSnr, txMode, tag.Get ());
bool gotAck = false;
- if (m_txParams.MustWaitNormalAck () &&
- m_normalAckTimeoutEvent.IsRunning ())
+ if (m_txParams.MustWaitNormalAck ()
+ && m_normalAckTimeoutEvent.IsRunning ())
{
m_normalAckTimeoutEvent.Cancel ();
NotifyAckTimeoutResetNow ();
gotAck = true;
}
- if (m_txParams.MustWaitFastAck () &&
- m_fastAckTimeoutEvent.IsRunning ())
+ if (m_txParams.MustWaitFastAck ()
+ && m_fastAckTimeoutEvent.IsRunning ())
{
m_fastAckTimeoutEvent.Cancel ();
NotifyAckTimeoutResetNow ();
gotAck = true;
}
- if (gotAck)
+ if (gotAck)
{
m_listener->GotAck (rxSnr, txMode);
}
- if (m_txParams.HasNextPacket ())
+ if (m_txParams.HasNextPacket ())
{
- m_waitSifsEvent = Simulator::Schedule (GetSifs (),
+ m_waitSifsEvent = Simulator::Schedule (GetSifs (),
&MacLow::WaitSifsAfterEndTx, this);
}
- }
- else if (hdr.IsBlockAck () && hdr.GetAddr1 () == m_self &&
- (m_txParams.MustWaitBasicBlockAck () || m_txParams.MustWaitCompressedBlockAck ()) &&
- m_blockAckTimeoutEvent.IsRunning ())
+ }
+ else if (hdr.IsBlockAck () && hdr.GetAddr1 () == m_self
+ && (m_txParams.MustWaitBasicBlockAck () || m_txParams.MustWaitCompressedBlockAck ())
+ && m_blockAckTimeoutEvent.IsRunning ())
{
- NS_LOG_DEBUG ("got block ack from "<<hdr.GetAddr2 ());
+ NS_LOG_DEBUG ("got block ack from " << hdr.GetAddr2 ());
CtrlBAckResponseHeader blockAck;
packet->RemoveHeader (blockAck);
m_blockAckTimeoutEvent.Cancel ();
@@ -773,11 +789,11 @@
ResetBlockAckInactivityTimerIfNeeded (it->second.first);
if ((*it).second.first.IsImmediateBlockAck ())
{
- NS_LOG_DEBUG ("rx blockAckRequest/sendImmediateBlockAck from="<< hdr.GetAddr2 ());
+ NS_LOG_DEBUG ("rx blockAckRequest/sendImmediateBlockAck from=" << hdr.GetAddr2 ());
m_sendAckEvent = Simulator::Schedule (GetSifs (),
&MacLow::SendBlockAckAfterBlockAckRequest, this,
blockAckReq,
- hdr.GetAddr2 (),
+ hdr.GetAddr2 (),
hdr.GetDuration (),
txMode);
}
@@ -796,16 +812,16 @@
NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
}
}
- else if (hdr.IsCtl ())
+ else if (hdr.IsCtl ())
{
NS_LOG_DEBUG ("rx drop " << hdr.GetTypeString ());
- }
- else if (hdr.GetAddr1 () == m_self)
+ }
+ else if (hdr.GetAddr1 () == m_self)
{
m_stationManager->ReportRxOk (hdr.GetAddr2 (), &hdr,
rxSnr, txMode);
- if (hdr.IsQosData () && StoreMpduIfNeeded (packet, hdr))
+ if (hdr.IsQosData () && StoreMpduIfNeeded (packet, hdr))
{
/* From section 9.10.4 in IEEE802.11:
Upon the receipt of a QoS data frame from the originator for which
@@ -821,7 +837,7 @@
NS_ASSERT (m_sendAckEvent.IsExpired ());
m_sendAckEvent = Simulator::Schedule (GetSifs (),
&MacLow::SendAckAfterData, this,
- hdr.GetAddr2 (),
+ hdr.GetAddr2 (),
hdr.GetDuration (),
txMode,
rxSnr);
@@ -842,29 +858,29 @@
From section 11.5.3 in IEEE802.11e:
When a recipient does not have an active Block ack for a TID, but receives
data MPDUs with the Ack Policy subfield set to Block Ack, it shall discard
- them and shall send a DELBA frame using the normal access
+ them and shall send a DELBA frame using the normal access
mechanisms. */
AcIndex ac = QosUtilsMapTidToAc (hdr.GetQosTid ());
m_edcaListeners[ac]->BlockAckInactivityTimeout (hdr.GetAddr2 (), hdr.GetQosTid ());
return;
}
- else if (hdr.IsQosData () && hdr.IsQosNoAck ())
+ else if (hdr.IsQosData () && hdr.IsQosNoAck ())
{
- NS_LOG_DEBUG ("rx unicast/noAck from="<<hdr.GetAddr2 ());
- }
- else if (hdr.IsData () || hdr.IsMgt ())
+ NS_LOG_DEBUG ("rx unicast/noAck from=" << hdr.GetAddr2 ());
+ }
+ else if (hdr.IsData () || hdr.IsMgt ())
{
NS_LOG_DEBUG ("rx unicast/sendAck from=" << hdr.GetAddr2 ());
NS_ASSERT (m_sendAckEvent.IsExpired ());
m_sendAckEvent = Simulator::Schedule (GetSifs (),
&MacLow::SendAckAfterData, this,
- hdr.GetAddr2 (),
+ hdr.GetAddr2 (),
hdr.GetDuration (),
txMode,
rxSnr);
}
goto rxPacket;
- }
+ }
else if (hdr.GetAddr1 ().IsGroup ())
{
if (hdr.IsData () || hdr.IsMgt ())
@@ -877,7 +893,7 @@
// DROP
}
}
- else
+ else
{
//NS_LOG_DEBUG_VERBOSE ("rx not-for-me from %d", GetSource (packet));
}
@@ -889,7 +905,7 @@
return;
}
-uint32_t
+uint32_t
MacLow::GetAckSize (void) const
{
WifiMacHeader ack;
@@ -915,9 +931,9 @@
//Not implemented
NS_ASSERT (false);
}
- return hdr.GetSize () + blockAck.GetSerializedSize () + 4;
+ return hdr.GetSize () + blockAck.GetSerializedSize () + 4;
}
-uint32_t
+uint32_t
MacLow::GetRtsSize (void) const
{
WifiMacHeader rts;
@@ -933,7 +949,7 @@
Time
MacLow::GetBlockAckDuration (Mac48Address to, WifiMode blockAckReqTxMode, enum BlockAckType type) const
{
- /*
+ /*
* For immediate BlockAck we should transmit the frame with the same WifiMode
* as the BlockAckReq.
*
@@ -949,14 +965,14 @@
WifiMode ctsMode = GetCtsTxModeForRts (to, rtsTxMode);
return m_phy->CalculateTxDuration (GetCtsSize (), ctsMode, WIFI_PREAMBLE_LONG);
}
-uint32_t
+uint32_t
MacLow::GetCtsSize (void) const
{
WifiMacHeader cts;
cts.SetType (WIFI_MAC_CTL_CTS);
return cts.GetSize () + 4;
}
-uint32_t
+uint32_t
MacLow::GetSize (Ptr<const Packet> packet, const WifiMacHeader *hdr) const
{
WifiMacTrailer fcs;
@@ -992,13 +1008,13 @@
Time
MacLow::CalculateOverallTxTime (Ptr<const Packet> packet,
- const WifiMacHeader* hdr,
+ const WifiMacHeader* hdr,
const MacLowTransmissionParameters& params) const
{
Time txTime = Seconds (0);
WifiMode rtsMode = GetRtsTxMode (packet, hdr);
WifiMode dataMode = GetDataTxMode (packet, hdr);
- if (params.MustSendRts ())
+ if (params.MustSendRts ())
{
txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsMode, WIFI_PREAMBLE_LONG);
txTime += GetCtsDuration (hdr->GetAddr1 (), rtsMode);
@@ -1016,11 +1032,11 @@
Time
MacLow::CalculateTransmissionTime (Ptr<const Packet> packet,
- const WifiMacHeader* hdr,
+ const WifiMacHeader* hdr,
const MacLowTransmissionParameters& params) const
{
Time txTime = CalculateOverallTxTime (packet, hdr, params);
- if (params.HasNextPacket ())
+ if (params.HasNextPacket ())
{
WifiMode dataMode = GetDataTxMode (packet, hdr);
txTime += GetSifs ();
@@ -1035,8 +1051,8 @@
NS_ASSERT (m_lastNavStart <= Simulator::Now ());
Time duration = hdr.GetDuration ();
- if (hdr.IsCfpoll () &&
- hdr.GetAddr2 () == m_bssid)
+ if (hdr.IsCfpoll ()
+ && hdr.GetAddr2 () == m_bssid)
{
// see section 9.3.2.2 802.11-1999
DoNavResetNow (duration);
@@ -1051,16 +1067,16 @@
if (hdr.IsRts () && navUpdated)
{
/**
- * 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
+ * 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.
*/
WifiMacHeader cts;
cts.SetType (WIFI_MAC_CTL_CTS);
- Time navCounterResetCtsMissedDelay =
+ Time navCounterResetCtsMissedDelay =
m_phy->CalculateTxDuration (cts.GetSerializedSize (), txMode, preamble) +
Time (2 * GetSifs ()) + Time (2 * GetSlotTime ());
m_navCounterResetCtsMissed = Simulator::Schedule (navCounterResetCtsMissedDelay,
@@ -1082,7 +1098,7 @@
void
MacLow::DoNavResetNow (Time duration)
{
- for (DcfListenersCI i = m_dcfListeners.begin (); i != m_dcfListeners.end (); i++)
+ for (DcfListenersCI i = m_dcfListeners.begin (); i != m_dcfListeners.end (); i++)
{
(*i)->NavReset (duration);
}
@@ -1092,7 +1108,7 @@
bool
MacLow::DoNavStartNow (Time duration)
{
- for (DcfListenersCI i = m_dcfListeners.begin (); i != m_dcfListeners.end (); i++)
+ for (DcfListenersCI i = m_dcfListeners.begin (); i != m_dcfListeners.end (); i++)
{
(*i)->NavStart (duration);
}
@@ -1109,7 +1125,7 @@
void
MacLow::NotifyAckTimeoutStartNow (Time duration)
{
- for (DcfListenersCI i = m_dcfListeners.begin (); i != m_dcfListeners.end (); i++)
+ for (DcfListenersCI i = m_dcfListeners.begin (); i != m_dcfListeners.end (); i++)
{
(*i)->AckTimeoutStart (duration);
}
@@ -1117,7 +1133,7 @@
void
MacLow::NotifyAckTimeoutResetNow ()
{
- for (DcfListenersCI i = m_dcfListeners.begin (); i != m_dcfListeners.end (); i++)
+ for (DcfListenersCI i = m_dcfListeners.begin (); i != m_dcfListeners.end (); i++)
{
(*i)->AckTimeoutReset ();
}
@@ -1125,7 +1141,7 @@
void
MacLow::NotifyCtsTimeoutStartNow (Time duration)
{
- for (DcfListenersCI i = m_dcfListeners.begin (); i != m_dcfListeners.end (); i++)
+ for (DcfListenersCI i = m_dcfListeners.begin (); i != m_dcfListeners.end (); i++)
{
(*i)->CtsTimeoutStart (duration);
}
@@ -1133,14 +1149,14 @@
void
MacLow::NotifyCtsTimeoutResetNow ()
{
- for (DcfListenersCI i = m_dcfListeners.begin (); i != m_dcfListeners.end (); i++)
+ for (DcfListenersCI i = m_dcfListeners.begin (); i != m_dcfListeners.end (); i++)
{
(*i)->CtsTimeoutReset ();
}
}
void
-MacLow::ForwardDown (Ptr<const Packet> packet, const WifiMacHeader* hdr,
+MacLow::ForwardDown (Ptr<const Packet> packet, const WifiMacHeader* hdr,
WifiMode txMode)
{
NS_LOG_FUNCTION (this << packet << hdr << txMode);
@@ -1149,7 +1165,7 @@
", size=" << packet->GetSize () <<
", mode=" << txMode <<
", duration=" << hdr->GetDuration () <<
- ", seq=0x"<< std::hex << m_currentHdr.GetSequenceControl () << std::dec);
+ ", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec);
m_phy->SendPacket (packet, txMode, WIFI_PREAMBLE_LONG, 0);
}
@@ -1187,7 +1203,7 @@
m_stationManager->ReportDataFailed (m_currentHdr.GetAddr1 (), &m_currentHdr);
MacLowTransmissionListener *listener = m_listener;
m_listener = 0;
- if (m_phy->IsStateIdle ())
+ if (m_phy->IsStateIdle ())
{
NS_LOG_DEBUG ("fast Ack idle missed");
listener->MissedAck ();
@@ -1215,12 +1231,12 @@
m_stationManager->ReportDataFailed (m_currentHdr.GetAddr1 (), &m_currentHdr);
MacLowTransmissionListener *listener = m_listener;
m_listener = 0;
- if (m_phy->IsStateIdle ())
+ if (m_phy->IsStateIdle ())
{
NS_LOG_DEBUG ("super fast Ack failed");
listener->MissedAck ();
- }
- else
+ }
+ else
{
NS_LOG_DEBUG ("super fast Ack ok");
listener->GotAck (0.0, WifiMode ());
@@ -1242,17 +1258,17 @@
rts.SetAddr2 (m_self);
WifiMode rtsTxMode = GetRtsTxMode (m_currentPacket, &m_currentHdr);
Time duration = Seconds (0);
- if (m_txParams.HasDurationId ())
+ if (m_txParams.HasDurationId ())
{
duration += m_txParams.GetDurationId ();
- }
- else
+ }
+ else
{
WifiMode dataTxMode = GetDataTxMode (m_currentPacket, &m_currentHdr);
duration += GetSifs ();
duration += GetCtsDuration (m_currentHdr.GetAddr1 (), rtsTxMode);
duration += GetSifs ();
- duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr),
+ duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr),
dataTxMode, WIFI_PREAMBLE_LONG);
duration += GetSifs ();
duration += GetAckDuration (m_currentHdr.GetAddr1 (), dataTxMode);
@@ -1279,26 +1295,26 @@
{
WifiMode dataTxMode = GetDataTxMode (m_currentPacket, &m_currentHdr);
Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), dataTxMode, WIFI_PREAMBLE_LONG);
- if (m_txParams.MustWaitNormalAck ())
+ if (m_txParams.MustWaitNormalAck ())
{
Time timerDelay = txDuration + GetAckTimeout ();
NS_ASSERT (m_normalAckTimeoutEvent.IsExpired ());
NotifyAckTimeoutStartNow (timerDelay);
m_normalAckTimeoutEvent = Simulator::Schedule (timerDelay, &MacLow::NormalAckTimeout, this);
- }
- else if (m_txParams.MustWaitFastAck ())
+ }
+ else if (m_txParams.MustWaitFastAck ())
{
Time timerDelay = txDuration + GetPifs ();
NS_ASSERT (m_fastAckTimeoutEvent.IsExpired ());
NotifyAckTimeoutStartNow (timerDelay);
m_fastAckTimeoutEvent = Simulator::Schedule (timerDelay, &MacLow::FastAckTimeout, this);
- }
- else if (m_txParams.MustWaitSuperFastAck ())
+ }
+ else if (m_txParams.MustWaitSuperFastAck ())
{
Time timerDelay = txDuration + GetPifs ();
NS_ASSERT (m_superFastAckTimeoutEvent.IsExpired ());
NotifyAckTimeoutStartNow (timerDelay);
- m_superFastAckTimeoutEvent = Simulator::Schedule (timerDelay,
+ m_superFastAckTimeoutEvent = Simulator::Schedule (timerDelay,
&MacLow::SuperFastAckTimeout, this);
}
else if (m_txParams.MustWaitBasicBlockAck ())
@@ -1313,13 +1329,13 @@
NS_ASSERT (m_blockAckTimeoutEvent.IsExpired ());
m_blockAckTimeoutEvent = Simulator::Schedule (timerDelay, &MacLow::BlockAckTimeout, this);
}
- else if (m_txParams.HasNextPacket ())
+ else if (m_txParams.HasNextPacket ())
{
Time delay = txDuration + GetSifs ();
NS_ASSERT (m_waitSifsEvent.IsExpired ());
m_waitSifsEvent = Simulator::Schedule (delay, &MacLow::WaitSifsAfterEndTx, this);
- }
- else
+ }
+ else
{
// since we do not expect any timer to be triggered.
m_listener = 0;
@@ -1335,11 +1351,11 @@
WifiMode dataTxMode = GetDataTxMode (m_currentPacket, &m_currentHdr);
Time duration = Seconds (0.0);
- if (m_txParams.HasDurationId ())
+ if (m_txParams.HasDurationId ())
{
duration += m_txParams.GetDurationId ();
- }
- else
+ }
+ else
{
if (m_txParams.MustWaitBasicBlockAck ())
{
@@ -1351,17 +1367,17 @@
duration += GetSifs ();
duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), dataTxMode, COMPRESSED_BLOCK_ACK);
}
- else if (m_txParams.MustWaitAck ())
+ else if (m_txParams.MustWaitAck ())
{
duration += GetSifs ();
duration += GetAckDuration (m_currentHdr.GetAddr1 (), dataTxMode);
}
- if (m_txParams.HasNextPacket ())
+ if (m_txParams.HasNextPacket ())
{
duration += GetSifs ();
- duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (),
+ duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (),
dataTxMode, WIFI_PREAMBLE_LONG);
- if (m_txParams.MustWaitAck ())
+ if (m_txParams.MustWaitAck ())
{
duration += GetSifs ();
duration += GetAckDuration (m_currentHdr.GetAddr1 (), dataTxMode);
@@ -1378,14 +1394,14 @@
m_currentPacket = 0;
}
-bool
+bool
MacLow::IsNavZero (void) const
{
- if (m_lastNavStart + m_lastNavDuration < Simulator::Now ())
+ if (m_lastNavStart + m_lastNavDuration < Simulator::Now ())
{
return true;
- }
- else
+ }
+ else
{
return false;
}
@@ -1395,7 +1411,7 @@
MacLow::SendCtsAfterRts (Mac48Address source, Time duration, WifiMode rtsTxMode, double rtsSnr)
{
NS_LOG_FUNCTION (this << source << duration << rtsTxMode << rtsSnr);
- /* send a CTS when you receive a RTS
+ /* send a CTS when you receive a RTS
* right after SIFS.
*/
WifiMode ctsTxMode = GetCtsTxModeForRts (source, rtsTxMode);
@@ -1427,8 +1443,8 @@
MacLow::SendDataAfterCts (Mac48Address source, Time duration, WifiMode txMode)
{
NS_LOG_FUNCTION (this);
- /* send the third step in a
- * RTS/CTS/DATA/ACK hanshake
+ /* send the third step in a
+ * RTS/CTS/DATA/ACK hanshake
*/
NS_ASSERT (m_currentPacket != 0);
StartDataTxTimers ();
@@ -1437,7 +1453,7 @@
Time newDuration = Seconds (0);
newDuration += GetSifs ();
newDuration += GetAckDuration (m_currentHdr.GetAddr1 (), dataTxMode);
- Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr),
+ Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr),
dataTxMode, WIFI_PREAMBLE_LONG);
duration -= txDuration;
duration -= GetSifs ();
@@ -1454,7 +1470,7 @@
m_currentPacket = 0;
}
-void
+void
MacLow::WaitSifsAfterEndTx (void)
{
m_listener->StartNext ();
@@ -1474,8 +1490,8 @@
MacLow::SendAckAfterData (Mac48Address source, Time duration, WifiMode dataTxMode, double dataSnr)
{
NS_LOG_FUNCTION (this);
- /* send an ACK when you receive
- * a packet after SIFS.
+ /* send an ACK when you receive
+ * a packet after SIFS.
*/
WifiMode ackTxMode = GetAckTxModeForData (source, dataTxMode);
WifiMacHeader ack;
@@ -1516,15 +1532,18 @@
uint16_t mappedSeqControl = QosUtilsMapSeqControlToUniqueInteger (hdr.GetSequenceControl (), endSequence);
BufferedPacketI i = (*it).second.second.begin ();
- for (; i != (*it).second.second.end () &&
- QosUtilsMapSeqControlToUniqueInteger ((*i).second.GetSequenceControl (), endSequence) < mappedSeqControl; i++) ;
+ for (; i != (*it).second.second.end ()
+ && QosUtilsMapSeqControlToUniqueInteger ((*i).second.GetSequenceControl (), endSequence) < mappedSeqControl; i++)
+ {
+ ;
+ }
(*it).second.second.insert (i, bufferedPacket);
//Update block ack cache
BlockAckCachesI j = m_bAckCaches.find (std::make_pair (hdr.GetAddr2 (), hdr.GetQosTid ()));
NS_ASSERT (j != m_bAckCaches.end ());
(*j).second.UpdateWithMpdu (&hdr);
-
+
return true;
}
return false;
@@ -1596,12 +1615,12 @@
{
uint16_t endSequence = ((*it).second.first.GetStartingSequence () + 2047) % 4096;
uint16_t mappedStart = QosUtilsMapSeqControlToUniqueInteger (seq, endSequence);
- uint16_t guard = (*it).second.second.begin ()->second.GetSequenceControl() & 0xfff0;
+ uint16_t guard = (*it).second.second.begin ()->second.GetSequenceControl () & 0xfff0;
BufferedPacketI last = (*it).second.second.begin ();
BufferedPacketI i = (*it).second.second.begin ();
- for (; i != (*it).second.second.end () &&
- QosUtilsMapSeqControlToUniqueInteger ((*i).second.GetSequenceNumber (), endSequence) < mappedStart;)
+ for (; i != (*it).second.second.end ()
+ && QosUtilsMapSeqControlToUniqueInteger ((*i).second.GetSequenceNumber (), endSequence) < mappedStart;)
{
if (guard == (*i).second.GetSequenceControl ())
{
@@ -1654,12 +1673,12 @@
AgreementsI it = m_bAckAgreements.find (std::make_pair (originator, tid));
if (it != m_bAckAgreements.end ())
{
- uint16_t startingSeqCtrl = ((*it).second.first.GetStartingSequence ()<<4) & 0xfff0;
+ uint16_t startingSeqCtrl = ((*it).second.first.GetStartingSequence () << 4) & 0xfff0;
uint16_t guard = startingSeqCtrl;
BufferedPacketI lastComplete = (*it).second.second.begin ();
BufferedPacketI i = (*it).second.second.begin ();
- for (; i != (*it).second.second.end() && guard == (*i).second.GetSequenceControl (); i++)
+ for (; i != (*it).second.second.end () && guard == (*i).second.GetSequenceControl (); i++)
{
if (!(*i).second.IsMoreFragments ())
{
@@ -1673,8 +1692,8 @@
}
guard = (*i).second.IsMoreFragments () ? (guard + 1) : ((guard + 16) & 0xfff0);
}
- (*it).second.first.SetStartingSequence ((guard>>4)&0x0fff);
- /* All packets already forwarded to WifiMac must be removed from buffer:
+ (*it).second.first.SetStartingSequence ((guard >> 4) & 0x0fff);
+ /* All packets already forwarded to WifiMac must be removed from buffer:
[begin (), lastComplete) */
(*it).second.second.erase ((*it).second.second.begin (), lastComplete);
}
@@ -1765,7 +1784,7 @@
NS_ASSERT (i != m_bAckCaches.end ());
(*i).second.FillBlockAckBitmap (&blockAck);
- /* All packets with smaller sequence than starting sequence control must be passed up to Wifimac
+ /* All packets with smaller sequence than starting sequence control must be passed up to Wifimac
* See 9.10.3 in IEEE8022.11e standard.
*/
RxCompleteBufferedPacketsWithSmallerSequence (reqHdr.GetStartingSequence (), originator, tid);
@@ -1773,7 +1792,7 @@
}
else
{
- NS_LOG_DEBUG ("there's not a valid block ack agreement with "<<originator);
+ NS_LOG_DEBUG ("there's not a valid block ack agreement with " << originator);
}
}
else
@@ -1797,8 +1816,8 @@
//std::map<AcIndex, MacLowTransmissionListener*>::iterator it = m_edcaListeners.find (ac);
//NS_ASSERT (it != m_edcaListeners.end ());
- agreement.m_inactivityEvent = Simulator::Schedule (timeout,
- &MacLowBlockAckEventListener::BlockAckInactivityTimeout,
+ agreement.m_inactivityEvent = Simulator::Schedule (timeout,
+ &MacLowBlockAckEventListener::BlockAckInactivityTimeout,
m_edcaListeners[ac],
agreement.GetPeer (),
agreement.GetTid ());
--- a/src/wifi/model/mac-low.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/mac-low.h Sat May 07 21:49:46 2011 +0200
@@ -4,7 +4,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -52,7 +52,8 @@
* \ingroup wifi
* \brief listen to events coming from ns3::MacLow.
*/
-class MacLowTransmissionListener {
+class MacLowTransmissionListener
+{
public:
MacLowTransmissionListener ();
virtual ~MacLowTransmissionListener ();
@@ -76,7 +77,7 @@
*
* ns3::MacLow received an expected ACL within
* AckTimeout. The <i>snr</i> and <i>txMode</i>
- * arguments are not valid when SUPER_FAST_ACK is
+ * arguments are not valid when SUPER_FAST_ACK is
* used.
*/
virtual void GotAck (double snr, WifiMode txMode) = 0;
@@ -91,7 +92,7 @@
*
* Invoked when ns3::MacLow receives a block ack frame.
* Block ack frame is received after a block ack request
- * and contains information about the correct reception
+ * and contains information about the correct reception
* of a set of packet for which a normal ack wasn't send.
* Default implementation for this method is empty. Every
* queue that intends to be notified by MacLow of reception
@@ -100,7 +101,7 @@
virtual void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address source);
/**
* ns3::MacLow did not receive an expected BLOCK_ACK within
- * BlockAckTimeout. This method is used only for immediate
+ * BlockAckTimeout. This method is used only for immediate
* block ack variant. With delayed block ack, the MissedAck method will be
* called instead: upon receipt of a block ack request, the rx station will
* reply with a normal ack frame. Later, when the rx station gets a txop, it
@@ -117,7 +118,7 @@
virtual void StartNext (void) = 0;
/**
- * Invoked if this transmission was canceled
+ * Invoked if this transmission was canceled
* one way or another. When this method is invoked,
* you can assume that the packet has not been passed
* down the stack to the PHY.
@@ -134,7 +135,8 @@
* and calls to its methods are forwards to the corresponding
* ns3::Dcf methods.
*/
-class MacLowDcfListener {
+class MacLowDcfListener
+{
public:
MacLowDcfListener ();
virtual ~MacLowDcfListener ();
@@ -156,14 +158,15 @@
* \ingroup wifi
* \brief listen for block ack events.
*/
-class MacLowBlockAckEventListener {
+class MacLowBlockAckEventListener
+{
public:
MacLowBlockAckEventListener ();
virtual ~MacLowBlockAckEventListener ();
/**
* Typically is called in order to notify EdcaTxopN that a block ack inactivity
* timeout occurs for the block ack agreement identified by the pair <i>originator</i>, <i>tid</i>.
- *
+ *
* Rx station maintains an inactivity timer for each block ack
* agreement. Timer is reset when a frame with ack policy block ack
* or a block ack request are received. When this timer reaches zero
@@ -180,7 +183,8 @@
* an instance of this class to describe how the packet
* should be transmitted.
*/
-class MacLowTransmissionParameters {
+class MacLowTransmissionParameters
+{
public:
MacLowTransmissionParameters ();
@@ -194,9 +198,9 @@
* - wait PIFS after end-of-tx. If idle, call
* MacLowTransmissionListener::MissedAck.
* - if busy at end-of-tx+PIFS, wait end-of-rx
- * - if Ack ok at end-of-rx, call
+ * - if Ack ok at end-of-rx, call
* MacLowTransmissionListener::GotAck.
- * - if Ack not ok at end-of-rx, report call
+ * - if Ack not ok at end-of-rx, report call
* MacLowTransmissionListener::MissedAck
* at end-of-rx+SIFS.
*
@@ -204,8 +208,8 @@
* proper HCCA support.
*/
void EnableFastAck (void);
- /**
- * - if busy at end-of-tx+PIFS, call
+ /**
+ * - if busy at end-of-tx+PIFS, call
* MacLowTransmissionListener::GotAck
* - if idle at end-of-tx+PIFS, call
* MacLowTransmissionListener::MissedAck
@@ -224,7 +228,7 @@
*/
void EnableMultiTidBlockAck (void);
/**
- * Send a RTS, and wait CTSTimeout for a CTS. If we get a
+ * Send a RTS, and wait CTSTimeout for a CTS. If we get a
* CTS on time, call MacLowTransmissionListener::GotCts
* and send data. Otherwise, call MacLowTransmissionListener::MissedCts
* and do not send data.
@@ -234,9 +238,9 @@
* \param size size of next data to send after current packet is
* sent.
*
- * Add the transmission duration of the next data to the
- * durationId of the outgoing packet and call
- * MacLowTransmissionListener::StartNext at the end of
+ * Add the transmission duration of the next data to the
+ * durationId of the outgoing packet and call
+ * MacLowTransmissionListener::StartNext at the end of
* the current transmission + SIFS.
*/
void EnableNextData (uint32_t size);
@@ -245,7 +249,7 @@
* \param durationId the value to set in the duration/Id field of
* the outgoing packet.
*
- * Ignore all other durationId calculation and simply force the
+ * Ignore all other durationId calculation and simply force the
* packet's durationId field to this value.
*/
void EnableOverrideDurationId (Time durationId);
@@ -286,14 +290,14 @@
*/
bool MustWaitNormalAck (void) const;
/**
- * \returns true if fast ack protocol should be used, false
+ * \returns true if fast ack protocol should be used, false
* otherwise.
*
* \sa EnableFastAck
*/
bool MustWaitFastAck (void) const;
/**
- * \returns true if super fast ack protocol should be used, false
+ * \returns true if super fast ack protocol should be used, false
* otherwise.
*
* \sa EnableSuperFastAck
@@ -318,12 +322,12 @@
*/
bool MustWaitMultiTidBlockAck (void) const;
/**
- * \returns true if RTS should be sent and CTS waited for before
+ * \returns true if RTS should be sent and CTS waited for before
* sending data, false otherwise.
*/
bool MustSendRts (void) const;
/**
- * \returns true if a duration/id was forced with
+ * \returns true if a duration/id was forced with
* EnableOverrideDurationId, false otherwise.
*/
bool HasDurationId (void) const;
@@ -343,7 +347,8 @@
private:
friend std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters ¶ms);
uint32_t m_nextSize;
- enum {
+ enum
+ {
ACK_NONE,
ACK_NORMAL,
ACK_FAST,
@@ -363,7 +368,8 @@
* \ingroup wifi
* \brief handle RTS/CTS/DATA/ACK transactions.
*/
-class MacLow : public Object {
+class MacLow : public Object
+{
public:
typedef Callback<void, Ptr<Packet>, const WifiMacHeader*> MacLowRxCallback;
@@ -414,7 +420,7 @@
* the next packet transmission if one was selected.
*/
Time CalculateTransmissionTime (Ptr<const Packet> packet,
- const WifiMacHeader* hdr,
+ const WifiMacHeader* hdr,
const MacLowTransmissionParameters& parameters) const;
/**
@@ -426,8 +432,8 @@
* Start the transmission of the input packet and notify the listener
* of transmission events.
*/
- void StartTransmission (Ptr<const Packet> packet,
- const WifiMacHeader* hdr,
+ void StartTransmission (Ptr<const Packet> packet,
+ const WifiMacHeader* hdr,
MacLowTransmissionParameters parameters,
MacLowTransmissionListener *listener);
@@ -456,7 +462,7 @@
* the MAC layer that a channel switching occured. When a channel switching
* occurs, pending MAC transmissions (RTS, CTS, DATA and ACK) are cancelled.
*/
- void NotifySwitchingStartNow (Time duration);
+ void NotifySwitchingStartNow (Time duration);
/**
* \param respHdr Add block ack response from originator (action
* frame).
@@ -500,10 +506,10 @@
uint32_t GetCtsSize (void) const;
uint32_t GetSize (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
Time NowUs (void) const;
- void ForwardDown (Ptr<const Packet> packet, const WifiMacHeader *hdr,
+ void ForwardDown (Ptr<const Packet> packet, const WifiMacHeader *hdr,
WifiMode txMode);
Time CalculateOverallTxTime (Ptr<const Packet> packet,
- const WifiMacHeader* hdr,
+ const WifiMacHeader* hdr,
const MacLowTransmissionParameters ¶ms) const;
WifiMode GetRtsTxMode (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
WifiMode GetDataTxMode (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
@@ -562,8 +568,8 @@
* See section 9.10.4 in IEEE802.11 standard for more details.
*/
void RxCompleteBufferedPacketsUntilFirstLost (Mac48Address originator, uint8_t tid);
- /*
- * This method checks if exists a valid established block ack agreement.
+ /*
+ * This method checks if exists a valid established block ack agreement.
* If there is, store the packet without pass it up to WifiMac. The packet is buffered
* in order of increasing sequence control field. All comparison are performed
* circularly modulo 2^12.
@@ -588,7 +594,7 @@
*/
void ResetBlockAckInactivityTimerIfNeeded (BlockAckAgreement &agreement);
- void SetupPhyMacLowListener (Ptr<WifiPhy> phy);
+ void SetupPhyMacLowListener (Ptr<WifiPhy> phy);
Ptr<WifiPhy> m_phy;
Ptr<WifiRemoteStationManager> m_stationManager;
@@ -626,8 +632,8 @@
Time m_lastNavStart;
Time m_lastNavDuration;
- // Listerner needed to monitor when a channel switching occurs.
- class PhyMacLowListener *m_phyMacLowListener;
+ // Listerner needed to monitor when a channel switching occurs.
+ class PhyMacLowListener * m_phyMacLowListener;
/*
* BlockAck data structures.
--- a/src/wifi/model/mac-rx-middle.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/mac-rx-middle.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -33,7 +33,8 @@
namespace ns3 {
-class OriginatorRxStatus {
+class OriginatorRxStatus
+{
private:
typedef std::list<Ptr<const Packet> > Fragments;
typedef std::list<Ptr<const Packet> >::const_iterator FragmentsCI;
@@ -42,58 +43,65 @@
uint16_t m_lastSequenceControl;
Fragments m_fragments;
public:
- OriginatorRxStatus () {
+ OriginatorRxStatus ()
+ {
/* this is a magic value necessary. */
m_lastSequenceControl = 0xffff;
m_defragmenting = false;
}
- ~OriginatorRxStatus () {
+ ~OriginatorRxStatus ()
+ {
m_fragments.clear ();
}
- bool IsDeFragmenting (void) {
+ bool IsDeFragmenting (void)
+ {
return m_defragmenting;
}
- void AccumulateFirstFragment (Ptr<const Packet> packet) {
+ void AccumulateFirstFragment (Ptr<const Packet> packet)
+ {
NS_ASSERT (!m_defragmenting);
m_defragmenting = true;
m_fragments.push_back (packet);
}
- Ptr<Packet> AccumulateLastFragment (Ptr<const Packet> packet) {
+ Ptr<Packet> AccumulateLastFragment (Ptr<const Packet> packet)
+ {
NS_ASSERT (m_defragmenting);
m_fragments.push_back (packet);
m_defragmenting = false;
Ptr<Packet> full = Create<Packet> ();
- for (FragmentsCI i = m_fragments.begin (); i != m_fragments.end (); i++)
+ for (FragmentsCI i = m_fragments.begin (); i != m_fragments.end (); i++)
{
full->AddAtEnd (*i);
}
m_fragments.erase (m_fragments.begin (), m_fragments.end ());
return full;
}
- void AccumulateFragment (Ptr<const Packet> packet) {
+ void AccumulateFragment (Ptr<const Packet> packet)
+ {
NS_ASSERT (m_defragmenting);
m_fragments.push_back (packet);
}
- bool IsNextFragment (uint16_t sequenceControl) {
- if ((sequenceControl >> 4) == (m_lastSequenceControl >> 4) &&
- (sequenceControl & 0x0f) == ((m_lastSequenceControl & 0x0f)+1))
+ bool IsNextFragment (uint16_t sequenceControl)
+ {
+ if ((sequenceControl >> 4) == (m_lastSequenceControl >> 4)
+ && (sequenceControl & 0x0f) == ((m_lastSequenceControl & 0x0f) + 1))
{
return true;
- }
- else
+ }
+ else
{
return false;
}
}
- uint16_t GetLastSequenceControl (void)
+ uint16_t GetLastSequenceControl (void)
{
return m_lastSequenceControl;
}
- void SetSequenceControl (uint16_t sequenceControl)
+ void SetSequenceControl (uint16_t sequenceControl)
{
m_lastSequenceControl = sequenceControl;
}
-
+
};
@@ -106,14 +114,14 @@
{
NS_LOG_FUNCTION_NOARGS ();
for (OriginatorsI i = m_originatorStatus.begin ();
- i != m_originatorStatus.end (); i++)
+ i != m_originatorStatus.end (); i++)
{
delete (*i).second;
}
m_originatorStatus.erase (m_originatorStatus.begin (),
m_originatorStatus.end ());
for (QosOriginatorsI i = m_qosOriginatorStatus.begin ();
- i != m_qosOriginatorStatus.end (); i++)
+ i != m_qosOriginatorStatus.end (); i++)
{
delete (*i).second;
}
@@ -121,7 +129,7 @@
m_qosOriginatorStatus.end ());
}
-void
+void
MacRxMiddle::SetForwardCallback (ForwardUpCallback callback)
{
NS_LOG_FUNCTION_NOARGS ();
@@ -134,17 +142,17 @@
NS_LOG_FUNCTION (hdr);
OriginatorRxStatus *originator;
Mac48Address source = hdr->GetAddr2 ();
- if (hdr->IsQosData () &&
- !hdr->GetAddr2 ().IsGroup ())
+ if (hdr->IsQosData ()
+ && !hdr->GetAddr2 ().IsGroup ())
{
/* only for qos data non-broadcast frames */
- originator = m_qosOriginatorStatus[std::make_pair(source, hdr->GetQosTid ())];
- if (originator == 0)
+ originator = m_qosOriginatorStatus[std::make_pair (source, hdr->GetQosTid ())];
+ if (originator == 0)
{
originator = new OriginatorRxStatus ();
- m_qosOriginatorStatus[std::make_pair(source, hdr->GetQosTid ())] = originator;
+ m_qosOriginatorStatus[std::make_pair (source, hdr->GetQosTid ())] = originator;
}
- }
+ }
else
{
/* - management frames
@@ -153,7 +161,7 @@
* see section 7.1.3.4.1
*/
originator = m_originatorStatus[source];
- if (originator == 0)
+ if (originator == 0)
{
originator = new OriginatorRxStatus ();
m_originatorStatus[source] = originator;
@@ -163,12 +171,12 @@
}
bool
-MacRxMiddle::IsDuplicate (const WifiMacHeader* hdr,
+MacRxMiddle::IsDuplicate (const WifiMacHeader* hdr,
OriginatorRxStatus *originator) const
{
NS_LOG_FUNCTION (hdr << originator);
- if (hdr->IsRetry () &&
- originator->GetLastSequenceControl () == hdr->GetSequenceControl ())
+ if (hdr->IsRetry ()
+ && originator->GetLastSequenceControl () == hdr->GetSequenceControl ())
{
return true;
}
@@ -180,54 +188,54 @@
OriginatorRxStatus *originator)
{
NS_LOG_FUNCTION (packet << hdr << originator);
- if (originator->IsDeFragmenting ())
+ if (originator->IsDeFragmenting ())
{
- if (hdr->IsMoreFragments ())
+ if (hdr->IsMoreFragments ())
{
- if (originator->IsNextFragment (hdr->GetSequenceControl ()))
+ if (originator->IsNextFragment (hdr->GetSequenceControl ()))
{
- NS_LOG_DEBUG ("accumulate fragment seq="<<hdr->GetSequenceNumber ()<<
- ", frag="<<hdr->GetFragmentNumber ()<<
- ", size="<<packet->GetSize ());
+ NS_LOG_DEBUG ("accumulate fragment seq=" << hdr->GetSequenceNumber () <<
+ ", frag=" << hdr->GetFragmentNumber () <<
+ ", size=" << packet->GetSize ());
originator->AccumulateFragment (packet);
originator->SetSequenceControl (hdr->GetSequenceControl ());
- }
- else
+ }
+ else
{
NS_LOG_DEBUG ("non-ordered fragment");
}
return 0;
- }
- else
+ }
+ else
{
- if (originator->IsNextFragment (hdr->GetSequenceControl ()))
+ if (originator->IsNextFragment (hdr->GetSequenceControl ()))
{
- NS_LOG_DEBUG ("accumulate last fragment seq="<<hdr->GetSequenceNumber ()<<
- ", frag="<<hdr->GetFragmentNumber ()<<
- ", size="<<hdr->GetSize ());
+ NS_LOG_DEBUG ("accumulate last fragment seq=" << hdr->GetSequenceNumber () <<
+ ", frag=" << hdr->GetFragmentNumber () <<
+ ", size=" << hdr->GetSize ());
Ptr<Packet> p = originator->AccumulateLastFragment (packet);
originator->SetSequenceControl (hdr->GetSequenceControl ());
return p;
- }
- else
+ }
+ else
{
NS_LOG_DEBUG ("non-ordered fragment");
return 0;
}
}
- }
- else
+ }
+ else
{
- if (hdr->IsMoreFragments ())
+ if (hdr->IsMoreFragments ())
{
- NS_LOG_DEBUG ("accumulate first fragment seq="<<hdr->GetSequenceNumber ()<<
- ", frag="<<hdr->GetFragmentNumber ()<<
- ", size="<<packet->GetSize ());
+ NS_LOG_DEBUG ("accumulate first fragment seq=" << hdr->GetSequenceNumber () <<
+ ", frag=" << hdr->GetFragmentNumber () <<
+ ", size=" << packet->GetSize ());
originator->AccumulateFirstFragment (packet);
originator->SetSequenceControl (hdr->GetSequenceControl ());
return 0;
- }
- else
+ }
+ else
{
return packet;
}
@@ -242,34 +250,34 @@
OriginatorRxStatus *originator = Lookup (hdr);
/**
* The check below is really uneeded because it can fail in a lot of
- * normal cases. Specifically, it is possible for sequence numbers to
- * loop back to zero once they reach 0xfff0 and to go up to 0xf7f0 in
- * which case the check below will report the two sequence numbers to
+ * normal cases. Specifically, it is possible for sequence numbers to
+ * loop back to zero once they reach 0xfff0 and to go up to 0xf7f0 in
+ * which case the check below will report the two sequence numbers to
* not have the correct order relationship.
* So, this check cannot be used to discard old duplicate frames. It is
* thus here only for documentation purposes.
*/
if (!(SequenceNumber16 (originator->GetLastSequenceControl ()) < SequenceNumber16 (hdr->GetSequenceControl ())))
{
- NS_LOG_DEBUG ("Sequence numbers have looped back. last recorded="<<originator->GetLastSequenceControl ()<<
- " currently seen="<< hdr->GetSequenceControl ());
+ NS_LOG_DEBUG ("Sequence numbers have looped back. last recorded=" << originator->GetLastSequenceControl () <<
+ " currently seen=" << hdr->GetSequenceControl ());
}
// filter duplicates.
- if (IsDuplicate (hdr, originator))
+ if (IsDuplicate (hdr, originator))
{
- NS_LOG_DEBUG ("duplicate from="<<hdr->GetAddr2 ()<<
- ", seq="<<hdr->GetSequenceNumber ()<<
- ", frag="<<hdr->GetFragmentNumber ());
+ NS_LOG_DEBUG ("duplicate from=" << hdr->GetAddr2 () <<
+ ", seq=" << hdr->GetSequenceNumber () <<
+ ", frag=" << hdr->GetFragmentNumber ());
return;
}
Ptr<Packet> agregate = HandleFragments (packet, hdr, originator);
- if (agregate == 0)
+ if (agregate == 0)
{
return;
}
- NS_LOG_DEBUG ("forwarding data from="<<hdr->GetAddr2 ()<<
- ", seq="<<hdr->GetSequenceNumber ()<<
- ", frag="<<hdr->GetFragmentNumber ());
+ NS_LOG_DEBUG ("forwarding data from=" << hdr->GetAddr2 () <<
+ ", seq=" << hdr->GetSequenceNumber () <<
+ ", frag=" << hdr->GetFragmentNumber ());
if (!hdr->GetAddr1 ().IsGroup ())
{
originator->SetSequenceControl (hdr->GetSequenceControl ());
--- a/src/wifi/model/mac-rx-middle.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/mac-rx-middle.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -34,7 +34,7 @@
/**
* \ingroup wifi
- *
+ *
* This class handles duplicate detection and recomposition of fragments.
*/
class MacRxMiddle
@@ -50,7 +50,7 @@
void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
private:
friend class MacRxMiddleTest;
- OriginatorRxStatus *Lookup (const WifiMacHeader* hdr);
+ OriginatorRxStatus* Lookup (const WifiMacHeader* hdr);
bool IsDuplicate (const WifiMacHeader* hdr, OriginatorRxStatus *originator) const;
Ptr<Packet> HandleFragments (Ptr<Packet> packet, const WifiMacHeader* hdr,
OriginatorRxStatus *originator);
--- a/src/wifi/model/mac-tx-middle.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/mac-tx-middle.cc Sat May 07 21:49:46 2011 +0200
@@ -4,7 +4,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -29,22 +29,23 @@
MacTxMiddle::MacTxMiddle ()
: m_sequence (0)
-{}
+{
+}
MacTxMiddle::~MacTxMiddle ()
{
- for (std::map<Mac48Address,uint16_t*>::iterator i = m_qosSequences.begin(); i != m_qosSequences.end (); i++)
+ for (std::map<Mac48Address,uint16_t*>::iterator i = m_qosSequences.begin (); i != m_qosSequences.end (); i++)
{
delete [] i->second;
}
}
-uint16_t
+uint16_t
MacTxMiddle::GetNextSequenceNumberfor (const WifiMacHeader *hdr)
{
uint16_t retval;
- if (hdr->IsQosData () &&
- !hdr->GetAddr1 ().IsGroup ())
+ if (hdr->IsQosData ()
+ && !hdr->GetAddr1 ().IsGroup ())
{
uint8_t tid = hdr->GetQosTid ();
NS_ASSERT (tid < 16);
@@ -60,15 +61,15 @@
retval = 0;
std::pair <Mac48Address,uint16_t*> newSeq (hdr->GetAddr1 (), new uint16_t[16]);
std::pair <std::map<Mac48Address,uint16_t*>::iterator,bool> newIns = m_qosSequences.insert (newSeq);
- NS_ASSERT(newIns.second == true);
+ NS_ASSERT (newIns.second == true);
for (uint8_t i = 0; i < 16; i++)
{
newIns.first->second[i] = 0;
}
newIns.first->second[tid]++;
}
- }
- else
+ }
+ else
{
retval = m_sequence;
m_sequence++;
--- a/src/wifi/model/mac-tx-middle.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/mac-tx-middle.h Sat May 07 21:49:46 2011 +0200
@@ -4,7 +4,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -33,10 +33,11 @@
/**
* \ingroup wifi
- *
+ *
* Handles sequence numbering of IEEE 802.11 data frames
*/
-class MacTxMiddle {
+class MacTxMiddle
+{
public:
MacTxMiddle ();
~MacTxMiddle ();
--- a/src/wifi/model/mgt-headers.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/mgt-headers.cc Sat May 07 21:49:46 2011 +0200
@@ -4,7 +4,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -32,25 +32,26 @@
NS_OBJECT_ENSURE_REGISTERED (MgtProbeRequestHeader);
MgtProbeRequestHeader::~MgtProbeRequestHeader ()
-{}
+{
+}
-void
+void
MgtProbeRequestHeader::SetSsid (Ssid ssid)
{
m_ssid = ssid;
}
-Ssid
+Ssid
MgtProbeRequestHeader::GetSsid (void) const
{
return m_ssid;
}
-void
+void
MgtProbeRequestHeader::SetSupportedRates (SupportedRates rates)
{
m_rates = rates;
}
-SupportedRates
+SupportedRates
MgtProbeRequestHeader::GetSupportedRates (void) const
{
return m_rates;
@@ -64,29 +65,29 @@
size += m_rates.extended.GetSerializedSize ();
return size;
}
-TypeId
+TypeId
MgtProbeRequestHeader::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::MgtProbeRequestHeader")
.SetParent<Header> ()
.AddConstructor<MgtProbeRequestHeader> ()
- ;
+ ;
return tid;
}
-TypeId
+TypeId
MgtProbeRequestHeader::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
-void
+void
MgtProbeRequestHeader::Print (std::ostream &os) const
{
- os << "ssid="<<m_ssid<<", "
- << "rates="<<m_rates;
+ os << "ssid=" << m_ssid << ", "
+ << "rates=" << m_rates;
}
void
MgtProbeRequestHeader::Serialize (Buffer::Iterator start) const
-{
+{
Buffer::Iterator i = start;
i = m_ssid.Serialize (i);
i = m_rates.Serialize (i);
@@ -110,36 +111,38 @@
NS_OBJECT_ENSURE_REGISTERED (MgtProbeResponseHeader);
MgtProbeResponseHeader::MgtProbeResponseHeader ()
-{}
+{
+}
MgtProbeResponseHeader::~MgtProbeResponseHeader ()
-{}
+{
+}
uint64_t
-MgtProbeResponseHeader::GetTimestamp()
+MgtProbeResponseHeader::GetTimestamp ()
{
return m_timestamp;
}
-Ssid
+Ssid
MgtProbeResponseHeader::GetSsid (void) const
{
return m_ssid;
}
-uint64_t
+uint64_t
MgtProbeResponseHeader::GetBeaconIntervalUs (void) const
{
return m_beaconInterval;
}
-SupportedRates
+SupportedRates
MgtProbeResponseHeader::GetSupportedRates (void) const
{
return m_rates;
}
-void
+void
MgtProbeResponseHeader::SetSsid (Ssid ssid)
{
m_ssid = ssid;
}
-void
+void
MgtProbeResponseHeader::SetBeaconIntervalUs (uint64_t us)
{
m_beaconInterval = us;
@@ -149,16 +152,16 @@
{
m_rates = rates;
}
-TypeId
+TypeId
MgtProbeResponseHeader::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::MgtProbeResponseHeader")
.SetParent<Header> ()
.AddConstructor<MgtProbeResponseHeader> ()
- ;
+ ;
return tid;
}
-TypeId
+TypeId
MgtProbeResponseHeader::GetInstanceTypeId (void) const
{
return GetTypeId ();
@@ -177,13 +180,13 @@
// xxx
return size;
}
-void
+void
MgtProbeResponseHeader::Print (std::ostream &os) const
{
- os << "ssid="<<m_ssid<<", "
- << "rates="<<m_rates;
+ os << "ssid=" << m_ssid << ", "
+ << "rates=" << m_rates;
}
-void
+void
MgtProbeResponseHeader::Serialize (Buffer::Iterator start) const
{
// timestamp
@@ -209,7 +212,7 @@
MgtProbeResponseHeader::Deserialize (Buffer::Iterator start)
{
Buffer::Iterator i = start;
- m_timestamp = i.ReadLsbtohU64();
+ m_timestamp = i.ReadLsbtohU64 ();
m_beaconInterval = i.ReadLsbtohU16 ();
m_beaconInterval *= 1024;
i = m_capability.Deserialize (i);
@@ -228,16 +231,18 @@
MgtAssocRequestHeader::MgtAssocRequestHeader ()
: m_listenInterval (0)
-{}
+{
+}
MgtAssocRequestHeader::~MgtAssocRequestHeader ()
-{}
+{
+}
-void
+void
MgtAssocRequestHeader::SetSsid (Ssid ssid)
{
m_ssid = ssid;
}
-void
+void
MgtAssocRequestHeader::SetSupportedRates (SupportedRates rates)
{
m_rates = rates;
@@ -247,12 +252,12 @@
{
m_listenInterval = interval;
}
-Ssid
+Ssid
MgtAssocRequestHeader::GetSsid (void) const
{
return m_ssid;
}
-SupportedRates
+SupportedRates
MgtAssocRequestHeader::GetSupportedRates (void) const
{
return m_rates;
@@ -263,21 +268,21 @@
return m_listenInterval;
}
-TypeId
+TypeId
MgtAssocRequestHeader::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::MgtAssocRequestHeader")
.SetParent<Header> ()
.AddConstructor<MgtAssocRequestHeader> ()
- ;
+ ;
return tid;
}
-TypeId
+TypeId
MgtAssocRequestHeader::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
-uint32_t
+uint32_t
MgtAssocRequestHeader::GetSerializedSize (void) const
{
uint32_t size = 0;
@@ -288,13 +293,13 @@
size += m_rates.extended.GetSerializedSize ();
return size;
}
-void
+void
MgtAssocRequestHeader::Print (std::ostream &os) const
{
- os << "ssid="<<m_ssid<<", "
- << "rates="<<m_rates;
+ os << "ssid=" << m_ssid << ", "
+ << "rates=" << m_rates;
}
-void
+void
MgtAssocRequestHeader::Serialize (Buffer::Iterator start) const
{
Buffer::Iterator i = start;
@@ -324,41 +329,43 @@
MgtAssocResponseHeader::MgtAssocResponseHeader ()
: m_aid (0)
-{}
+{
+}
MgtAssocResponseHeader::~MgtAssocResponseHeader ()
-{}
+{
+}
-StatusCode
+StatusCode
MgtAssocResponseHeader::GetStatusCode (void)
{
return m_code;
}
-SupportedRates
+SupportedRates
MgtAssocResponseHeader::GetSupportedRates (void)
{
return m_rates;
}
-void
+void
MgtAssocResponseHeader::SetStatusCode (StatusCode code)
{
m_code = code;
}
-void
+void
MgtAssocResponseHeader::SetSupportedRates (SupportedRates rates)
{
m_rates = rates;
}
-TypeId
+TypeId
MgtAssocResponseHeader::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::MgtAssocResponseHeader")
.SetParent<Header> ()
.AddConstructor<MgtAssocResponseHeader> ()
- ;
+ ;
return tid;
}
-TypeId
+TypeId
MgtAssocResponseHeader::GetInstanceTypeId (void) const
{
return GetTypeId ();
@@ -375,13 +382,13 @@
return size;
}
-void
+void
MgtAssocResponseHeader::Print (std::ostream &os) const
{
- os << "status code="<<m_code<<", "
- << "rates="<<m_rates;
+ os << "status code=" << m_code << ", "
+ << "rates=" << m_rates;
}
-void
+void
MgtAssocResponseHeader::Serialize (Buffer::Iterator start) const
{
Buffer::Iterator i = start;
@@ -413,56 +420,56 @@
}
void
WifiActionHeader::SetAction (WifiActionHeader::CategoryValue type,
- WifiActionHeader::ActionValue action)
+ WifiActionHeader::ActionValue action)
{
m_category = type;
switch (type)
{
- case BLOCK_ACK:
- {
- m_actionValue = action.blockAck;
- break;
- }
- case MESH_PEERING_MGT:
- {
- m_actionValue = action.peerLink;
+ case BLOCK_ACK:
+ {
+ m_actionValue = action.blockAck;
+ break;
+ }
+ case MESH_PEERING_MGT:
+ {
+ m_actionValue = action.peerLink;
+ break;
+ }
+ case MESH_PATH_SELECTION:
+ {
+ m_actionValue = action.pathSelection;
+ break;
+ }
+ case MESH_LINK_METRIC:
+ case MESH_INTERWORKING:
+ case MESH_RESOURCE_COORDINATION:
+ case MESH_PROXY_FORWARDING:
break;
}
- case MESH_PATH_SELECTION:
- {
- m_actionValue = action.pathSelection;
- break;
- }
- case MESH_LINK_METRIC:
- case MESH_INTERWORKING:
- case MESH_RESOURCE_COORDINATION:
- case MESH_PROXY_FORWARDING:
- break;
- }
}
WifiActionHeader::CategoryValue
WifiActionHeader::GetCategory ()
{
switch (m_category)
{
- case BLOCK_ACK:
- return BLOCK_ACK;
- case MESH_PEERING_MGT:
- return MESH_PEERING_MGT;
- case MESH_LINK_METRIC:
- return MESH_LINK_METRIC;
- case MESH_PATH_SELECTION:
- return MESH_PATH_SELECTION;
- case MESH_INTERWORKING:
- return MESH_INTERWORKING;
- case MESH_RESOURCE_COORDINATION:
- return MESH_RESOURCE_COORDINATION;
- case MESH_PROXY_FORWARDING:
- return MESH_PROXY_FORWARDING;
- default:
- NS_FATAL_ERROR ("Unknown action value");
- return MESH_PEERING_MGT;
+ case BLOCK_ACK:
+ return BLOCK_ACK;
+ case MESH_PEERING_MGT:
+ return MESH_PEERING_MGT;
+ case MESH_LINK_METRIC:
+ return MESH_LINK_METRIC;
+ case MESH_PATH_SELECTION:
+ return MESH_PATH_SELECTION;
+ case MESH_INTERWORKING:
+ return MESH_INTERWORKING;
+ case MESH_RESOURCE_COORDINATION:
+ return MESH_RESOURCE_COORDINATION;
+ case MESH_PROXY_FORWARDING:
+ return MESH_PROXY_FORWARDING;
+ default:
+ NS_FATAL_ERROR ("Unknown action value");
+ return MESH_PEERING_MGT;
}
}
WifiActionHeader::ActionValue
@@ -472,65 +479,65 @@
retval.peerLink = PEER_LINK_OPEN; // Needs to be initialized to something to quiet valgrind in default cases
switch (m_category)
{
- case BLOCK_ACK:
- switch (m_actionValue)
- {
- case BLOCK_ACK_ADDBA_REQUEST:
- retval.blockAck = BLOCK_ACK_ADDBA_REQUEST;
- return retval;
- case BLOCK_ACK_ADDBA_RESPONSE:
- retval.blockAck = BLOCK_ACK_ADDBA_RESPONSE;
- return retval;
- case BLOCK_ACK_DELBA:
- retval.blockAck = BLOCK_ACK_DELBA;
- return retval;
- }
- case MESH_PEERING_MGT:
- switch (m_actionValue)
- {
- case PEER_LINK_OPEN:
- retval.peerLink = PEER_LINK_OPEN;
- return retval;
- case PEER_LINK_CONFIRM:
- retval.peerLink = PEER_LINK_CONFIRM;
- return retval;
- case PEER_LINK_CLOSE:
- retval.peerLink = PEER_LINK_CLOSE;
- return retval;
+ case BLOCK_ACK:
+ switch (m_actionValue)
+ {
+ case BLOCK_ACK_ADDBA_REQUEST:
+ retval.blockAck = BLOCK_ACK_ADDBA_REQUEST;
+ return retval;
+ case BLOCK_ACK_ADDBA_RESPONSE:
+ retval.blockAck = BLOCK_ACK_ADDBA_RESPONSE;
+ return retval;
+ case BLOCK_ACK_DELBA:
+ retval.blockAck = BLOCK_ACK_DELBA;
+ return retval;
+ }
+ case MESH_PEERING_MGT:
+ switch (m_actionValue)
+ {
+ case PEER_LINK_OPEN:
+ retval.peerLink = PEER_LINK_OPEN;
+ return retval;
+ case PEER_LINK_CONFIRM:
+ retval.peerLink = PEER_LINK_CONFIRM;
+ return retval;
+ case PEER_LINK_CLOSE:
+ retval.peerLink = PEER_LINK_CLOSE;
+ return retval;
+ default:
+ NS_FATAL_ERROR ("Unknown mesh peering management action code");
+ retval.peerLink = PEER_LINK_OPEN; /* quiet compiler */
+ return retval;
+ }
+ case MESH_PATH_SELECTION:
+ switch (m_actionValue)
+ {
+ case PATH_SELECTION:
+ retval.pathSelection = PATH_SELECTION;
+ return retval;
+ default:
+ NS_FATAL_ERROR ("Unknown mesh path selection action code");
+ retval.peerLink = PEER_LINK_OPEN; /* quiet compiler */
+ return retval;
+ }
+ case MESH_LINK_METRIC:
+ // not yet supported
+ case MESH_INTERWORKING:
+ // not yet supported
+ case MESH_RESOURCE_COORDINATION:
+ // not yet supported
default:
- NS_FATAL_ERROR ("Unknown mesh peering management action code");
- retval.peerLink = PEER_LINK_OPEN; /* quiet compiler */
- return retval;
- }
- case MESH_PATH_SELECTION:
- switch (m_actionValue)
- {
- case PATH_SELECTION:
- retval.pathSelection = PATH_SELECTION;
+ NS_FATAL_ERROR ("Unsupported mesh action");
+ retval.peerLink = PEER_LINK_OPEN; /* quiet compiler */
return retval;
- default:
- NS_FATAL_ERROR ("Unknown mesh path selection action code");
- retval.peerLink = PEER_LINK_OPEN; /* quiet compiler */
- return retval;
- }
- case MESH_LINK_METRIC:
- // not yet supported
- case MESH_INTERWORKING:
- // not yet supported
- case MESH_RESOURCE_COORDINATION:
- // not yet supported
- default:
- NS_FATAL_ERROR ("Unsupported mesh action");
- retval.peerLink = PEER_LINK_OPEN; /* quiet compiler */
- return retval;
}
}
TypeId
WifiActionHeader::GetTypeId ()
{
static TypeId tid = TypeId ("ns3::WifiActionHeader")
- .SetParent<Header> ()
- .AddConstructor<WifiActionHeader> ();
+ .SetParent<Header> ()
+ .AddConstructor<WifiActionHeader> ();
return tid;
}
TypeId
@@ -569,10 +576,11 @@
NS_OBJECT_ENSURE_REGISTERED (MgtAddBaRequestHeader);
MgtAddBaRequestHeader::MgtAddBaRequestHeader ()
- : m_dialogToken (1),
- m_amsduSupport (1),
- m_bufferSize (0)
-{}
+ : m_dialogToken (1),
+ m_amsduSupport (1),
+ m_bufferSize (0)
+{
+}
TypeId
MgtAddBaRequestHeader::GetTypeId (void)
@@ -580,7 +588,6 @@
static TypeId tid = TypeId ("ns3::MgtAddBaRequestHeader")
.SetParent<Header> ()
.AddConstructor<MgtAddBaRequestHeader> ();
- ;
return tid;
}
@@ -592,7 +599,8 @@
void
MgtAddBaRequestHeader::Print (std::ostream &os) const
-{}
+{
+}
uint32_t
MgtAddBaRequestHeader::GetSerializedSize (void) const
@@ -637,7 +645,7 @@
{
m_policy = 1;
}
-
+
void
MgtAddBaRequestHeader::SetTid (uint8_t tid)
{
@@ -678,7 +686,7 @@
bool
MgtAddBaRequestHeader::IsImmediateBlockAck (void) const
{
- return (m_policy == 1)?true:false;
+ return (m_policy == 1) ? true : false;
}
uint16_t
@@ -696,7 +704,7 @@
bool
MgtAddBaRequestHeader::IsAmsduSupported (void) const
{
- return (m_amsduSupport == 1)?true:false;
+ return (m_amsduSupport == 1) ? true : false;
}
uint16_t
@@ -747,7 +755,8 @@
: m_dialogToken (1),
m_amsduSupport (1),
m_bufferSize (0)
-{}
+{
+}
TypeId
MgtAddBaResponseHeader::GetTypeId ()
@@ -768,7 +777,7 @@
void
MgtAddBaResponseHeader::Print (std::ostream &os) const
{
- os <<"status code="<<m_code;
+ os << "status code=" << m_code;
}
uint32_t
@@ -861,7 +870,7 @@
bool
MgtAddBaResponseHeader::IsImmediateBlockAck (void) const
{
- return (m_policy == 1)?true:false;
+ return (m_policy == 1) ? true : false;
}
uint16_t
@@ -879,7 +888,7 @@
bool
MgtAddBaResponseHeader::IsAmsduSupported (void) const
{
- return (m_amsduSupport == 1)?true:false;
+ return (m_amsduSupport == 1) ? true : false;
}
uint16_t
@@ -910,7 +919,8 @@
MgtDelBaHeader::MgtDelBaHeader ()
: m_reasonCode (1)
-{}
+{
+}
TypeId
MgtDelBaHeader::GetTypeId (void)
@@ -930,7 +940,8 @@
void
MgtDelBaHeader::Print (std::ostream &os) const
-{}
+{
+}
uint32_t
MgtDelBaHeader::GetSerializedSize (void) const
@@ -961,7 +972,7 @@
bool
MgtDelBaHeader::IsByOriginator (void) const
{
- return (m_initiator == 1)?true:false;
+ return (m_initiator == 1) ? true : false;
}
uint8_t
--- a/src/wifi/model/mgt-headers.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/mgt-headers.h Sat May 07 21:49:46 2011 +0200
@@ -4,7 +4,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -36,7 +36,7 @@
* \ingroup wifi
* Implement the header for management frames of type association request.
*/
-class MgtAssocRequestHeader : public Header
+class MgtAssocRequestHeader : public Header
{
public:
MgtAssocRequestHeader ();
@@ -69,7 +69,8 @@
* \ingroup wifi
* Implement the header for management frames of type association response.
*/
-class MgtAssocResponseHeader : public Header {
+class MgtAssocResponseHeader : public Header
+{
public:
MgtAssocResponseHeader ();
~MgtAssocResponseHeader ();
@@ -99,7 +100,8 @@
* \ingroup wifi
* Implement the header for management frames of type probe request.
*/
-class MgtProbeRequestHeader : public Header {
+class MgtProbeRequestHeader : public Header
+{
public:
~MgtProbeRequestHeader ();
@@ -115,7 +117,6 @@
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
private:
-
Ssid m_ssid;
SupportedRates m_rates;
};
@@ -125,7 +126,8 @@
* \ingroup wifi
* Implement the header for management frames of type probe response.
*/
-class MgtProbeResponseHeader : public Header {
+class MgtProbeResponseHeader : public Header
+{
public:
MgtProbeResponseHeader ();
~MgtProbeResponseHeader ();
@@ -137,7 +139,7 @@
void SetSsid (Ssid ssid);
void SetBeaconIntervalUs (uint64_t us);
void SetSupportedRates (SupportedRates rates);
- uint64_t GetTimestamp();
+ uint64_t GetTimestamp ();
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
virtual void Print (std::ostream &os) const;
@@ -158,7 +160,9 @@
* \ingroup wifi
* Implement the header for management frames of type beacon.
*/
-class MgtBeaconHeader : public MgtProbeResponseHeader {};
+class MgtBeaconHeader : public MgtProbeResponseHeader
+{
+};
/****************************
* Action frames
@@ -166,7 +170,7 @@
/**
* \ingroup wifi
- *
+ *
* See IEEE 802.11 chapter 7.3.1.11
* Header format: | category: 1 | action value: 1 |
*
@@ -256,9 +260,9 @@
* \ingroup wifi
* Implement the header for management frames of type add block ack request.
*/
-class MgtAddBaRequestHeader : public Header {
+class MgtAddBaRequestHeader : public Header
+{
public:
-
MgtAddBaRequestHeader ();
static TypeId GetTypeId (void);
@@ -275,20 +279,20 @@
void SetBufferSize (uint16_t size);
void SetStartingSequence (uint16_t seq);
void SetAmsduSupport (bool supported);
-
+
uint16_t GetStartingSequence (void) const;
uint8_t GetTid (void) const;
bool IsImmediateBlockAck (void) const;
uint16_t GetTimeout (void) const;
uint16_t GetBufferSize (void) const;
bool IsAmsduSupported (void) const;
-
+
private:
uint16_t GetParameterSet (void) const;
void SetParameterSet (uint16_t params);
uint16_t GetStartingSequenceControl (void) const;
void SetStartingSequenceControl (uint16_t seqControl);
-
+
uint8_t m_dialogToken; /* Not used for now */
uint8_t m_amsduSupport;
uint8_t m_policy;
@@ -297,15 +301,15 @@
uint16_t m_timeoutValue;
uint16_t m_startingSeq;
};
-
+
/**
* \ingroup wifi
* Implement the header for management frames of type add block ack response.
*/
-class MgtAddBaResponseHeader : public Header {
+class MgtAddBaResponseHeader : public Header
+{
public:
-
MgtAddBaResponseHeader ();
static TypeId GetTypeId (void);
@@ -333,7 +337,7 @@
private:
uint16_t GetParameterSet (void) const;
void SetParameterSet (uint16_t params);
-
+
uint8_t m_dialogToken; /* Not used for now */
StatusCode m_code;
uint8_t m_amsduSupport;
@@ -348,7 +352,8 @@
* \ingroup wifi
* Implement the header for management frames of type del block ack.
*/
-class MgtDelBaHeader : public Header {
+class MgtDelBaHeader : public Header
+{
public:
MgtDelBaHeader ();
--- a/src/wifi/model/minstrel-wifi-manager.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/minstrel-wifi-manager.cc Sat May 07 21:49:46 2011 +0200
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2009 Duy Nguyen
+ * Copyright (c) 2009 Duy Nguyen
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -16,13 +16,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Duy Nguyen <duy@soe.ucsc.edu>
- *
- * Some Comments:
- *
- * 1) Segment Size is declared for completeness but not used because it has
+ *
+ * Some Comments:
+ *
+ * 1) Segment Size is declared for completeness but not used because it has
* to do more with the requirement of the specific hardware.
*
- * 2) By default, Minstrel applies the multi-rate retry(the core of Minstrel
+ * 2) By default, Minstrel applies the multi-rate retry(the core of Minstrel
* algorithm). Otherwise, please use ConstantRateWifiManager instead.
*
* http://linuxwireless.org/en/developers/Documentation/mac80211/RateControl/minstrel
@@ -55,8 +55,8 @@
* then we wrap back to the row 1 col 1.
* note: there are many other ways to do this.
*/
- uint32_t m_col, m_index;
- uint32_t m_maxTpRate; ///< the current throughput rate
+ uint32_t m_col, m_index;
+ uint32_t m_maxTpRate; ///< the current throughput rate
uint32_t m_maxTpRate2; ///< second highest throughput rate
uint32_t m_maxProbRate; ///< rate with highest prob of success
@@ -65,7 +65,7 @@
bool m_isSampling; ///< a flag to indicate we are currently sampling
uint32_t m_sampleRate; ///< current sample rate
- bool m_sampleRateSlower; ///< a flag to indicate sample rate is slower
+ bool m_sampleRateSlower; ///< a flag to indicate sample rate is slower
uint32_t m_currentRate; ///< current rate we are using
uint32_t m_shortRetry; ///< short retries such as control packts
@@ -90,12 +90,12 @@
TimeValue (Seconds (0.1)),
MakeTimeAccessor (&MinstrelWifiManager::m_updateStats),
MakeTimeChecker ())
- .AddAttribute ("LookAroundRate",
+ .AddAttribute ("LookAroundRate",
"the percentage to try other rates",
DoubleValue (10),
MakeDoubleAccessor (&MinstrelWifiManager::m_lookAroundRate),
MakeDoubleChecker<double> ())
- .AddAttribute ("EWMA",
+ .AddAttribute ("EWMA",
"EWMA level",
DoubleValue (75),
MakeDoubleAccessor (&MinstrelWifiManager::m_ewmaLevel),
@@ -115,7 +115,7 @@
DoubleValue (1200),
MakeDoubleAccessor (&MinstrelWifiManager::m_pktLen),
MakeDoubleChecker <double> ())
- ;
+ ;
return tid;
}
@@ -125,7 +125,8 @@
}
MinstrelWifiManager::~MinstrelWifiManager ()
-{}
+{
+}
void
MinstrelWifiManager::SetupPhy (Ptr<WifiPhy> phy)
@@ -157,7 +158,7 @@
void
MinstrelWifiManager::AddCalcTxTime (WifiMode mode, Time t)
{
- m_calcTxTime.push_back (std::make_pair (t, mode));
+ m_calcTxTime.push_back (std::make_pair (t, mode));
}
WifiRemoteStation *
@@ -167,13 +168,13 @@
station->m_nextStatsUpdate = Simulator::Now () + m_updateStats;
station->m_col = 0;
- station->m_index = 0;
- station->m_maxTpRate = 0;
- station->m_maxTpRate2 = 0;
+ station->m_index = 0;
+ station->m_maxTpRate = 0;
+ station->m_maxTpRate2 = 0;
station->m_maxProbRate = 0;
- station->m_packetCount = 0;
- station->m_sampleCount = 0;
- station->m_isSampling = false;
+ station->m_packetCount = 0;
+ station->m_sampleCount = 0;
+ station->m_isSampling = false;
station->m_sampleRate = 0;
station->m_sampleRateSlower = false;
station->m_currentRate = 0;
@@ -187,17 +188,17 @@
return station;
}
-void
-MinstrelWifiManager::CheckInit(MinstrelWifiRemoteStation *station)
+void
+MinstrelWifiManager::CheckInit (MinstrelWifiRemoteStation *station)
{
if (!station->m_initialized && GetNSupported (station) > 1)
{
- // Note: we appear to be doing late initialization of the table
+ // Note: we appear to be doing late initialization of the table
// to make sure that the set of supported rates has been initialized
// before we perform our own initialization.
m_nsupported = GetNSupported (station);
- m_minstrelTable = MinstrelRate(m_nsupported);
- m_sampleTable = SampleRate(m_nsupported, std::vector<uint32_t> (m_sampleCol));
+ m_minstrelTable = MinstrelRate (m_nsupported);
+ m_sampleTable = SampleRate (m_nsupported, std::vector<uint32_t> (m_sampleCol));
InitSampleTable (station);
RateInit (station);
station->m_initialized = true;
@@ -208,14 +209,14 @@
MinstrelWifiManager::DoReportRxOk (WifiRemoteStation *st,
double rxSnr, WifiMode txMode)
{
- NS_LOG_DEBUG("DoReportRxOk m_txrate=" << ((MinstrelWifiRemoteStation *)st)->m_txrate);
+ NS_LOG_DEBUG ("DoReportRxOk m_txrate=" << ((MinstrelWifiRemoteStation *)st)->m_txrate);
}
void
MinstrelWifiManager::DoReportRtsFailed (WifiRemoteStation *st)
{
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st;
- NS_LOG_DEBUG("DoReportRtsFailed m_txrate=" << station->m_txrate);
+ NS_LOG_DEBUG ("DoReportRtsFailed m_txrate=" << station->m_txrate);
station->m_shortRetry++;
}
@@ -223,7 +224,7 @@
void
MinstrelWifiManager::DoReportRtsOk (WifiRemoteStation *st, double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
- NS_LOG_DEBUG ("self="<<st<<" rts ok");
+ NS_LOG_DEBUG ("self=" << st << " rts ok");
}
void
@@ -254,7 +255,7 @@
* After a failing 7 times, DoReportFinalDataFailed will be called
*/
- CheckInit(station);
+ CheckInit (station);
if (!station->m_initialized)
{
return;
@@ -274,24 +275,24 @@
}
/// use second best throughput rate
- else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
+ else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
{
station->m_txrate = station->m_maxTpRate2;
}
/// use best probability rate
- else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
- m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount +
+ else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
+ m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount +
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
{
station->m_txrate = station->m_maxProbRate;
}
- /// use lowest base rate
- else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount +
- m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount +
- m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
+ /// use lowest base rate
+ else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount +
+ m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount +
+ m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
{
station->m_txrate = 0;
}
@@ -306,65 +307,65 @@
/// use best throughput rate
if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount)
{
- ; ///< there are a few retries left
+ ; ///< there are a few retries left
}
/// use random rate
- else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
+ else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
{
station->m_txrate = station->m_sampleRate;
}
/// use max probability rate
- else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
- m_minstrelTable[station->m_sampleRate].adjustedRetryCount +
+ else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
+ m_minstrelTable[station->m_sampleRate].adjustedRetryCount +
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount ))
{
station->m_txrate = station->m_maxProbRate;
}
/// use lowest base rate
- else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount +
- m_minstrelTable[station->m_sampleRate].adjustedRetryCount +
+ else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount +
+ m_minstrelTable[station->m_sampleRate].adjustedRetryCount +
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
{
station->m_txrate = 0;
}
}
- /// current sampling rate is better than current best rate
- else
- {
- /// use random rate
- if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount)
- {
- ; ///< keep using it
- }
+ /// current sampling rate is better than current best rate
+ else
+ {
+ /// use random rate
+ if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount)
+ {
+ ; ///< keep using it
+ }
- /// use the best rate
- else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
- m_minstrelTable[station->m_sampleRate].adjustedRetryCount))
- {
- station->m_txrate = station->m_maxTpRate;
- }
+ /// use the best rate
+ else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
+ m_minstrelTable[station->m_sampleRate].adjustedRetryCount))
+ {
+ station->m_txrate = station->m_maxTpRate;
+ }
- /// use the best probability rate
- else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
- m_minstrelTable[station->m_maxTpRate].adjustedRetryCount +
- m_minstrelTable[station->m_sampleRate].adjustedRetryCount))
- {
- station->m_txrate = station->m_maxProbRate;
- }
+ /// use the best probability rate
+ else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
+ m_minstrelTable[station->m_maxTpRate].adjustedRetryCount +
+ m_minstrelTable[station->m_sampleRate].adjustedRetryCount))
+ {
+ station->m_txrate = station->m_maxProbRate;
+ }
- /// use the lowest base rate
- else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount +
- m_minstrelTable[station->m_maxTpRate].adjustedRetryCount +
- m_minstrelTable[station->m_sampleRate].adjustedRetryCount))
- {
- station->m_txrate = 0;
- }
- }
+ /// use the lowest base rate
+ else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount +
+ m_minstrelTable[station->m_maxTpRate].adjustedRetryCount +
+ m_minstrelTable[station->m_sampleRate].adjustedRetryCount))
+ {
+ station->m_txrate = 0;
+ }
+ }
}
}
@@ -375,7 +376,7 @@
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st;
station->m_isSampling = false;
- station->m_sampleRateSlower=false;
+ station->m_sampleRateSlower = false;
CheckInit (station);
if (!station->m_initialized)
@@ -385,7 +386,7 @@
m_minstrelTable[station->m_txrate].numRateSuccess++;
m_minstrelTable[station->m_txrate].numRateAttempt++;
-
+
UpdateRetry (station);
m_minstrelTable[station->m_txrate].numRateAttempt += station->m_retry;
@@ -404,7 +405,7 @@
NS_LOG_DEBUG ("DoReportFinalDataFailed m_txrate=" << station->m_txrate);
station->m_isSampling = false;
- station->m_sampleRateSlower=false;
+ station->m_sampleRateSlower = false;
UpdateRetry (station);
@@ -450,12 +451,12 @@
return GetSupported (station, 0);
}
-bool
+bool
MinstrelWifiManager::IsLowLatency (void) const
{
return true;
}
-uint32_t
+uint32_t
MinstrelWifiManager::GetNextSample (MinstrelWifiRemoteStation *station)
{
uint32_t bitrate;
@@ -463,9 +464,9 @@
station->m_index++;
/// bookeeping for m_index and m_col variables
- if (station->m_index > (m_nsupported - 2))
+ if (station->m_index > (m_nsupported - 2))
{
- station->m_index =0;
+ station->m_index = 0;
station->m_col++;
if (station->m_col >= m_sampleCol)
{
@@ -488,29 +489,29 @@
uint32_t idx;
- /// for determining when to try a sample rate
+ /// for determining when to try a sample rate
UniformVariable coinFlip (0, 100);
/**
* if we are below the target of look around rate percentage, look around
- * note: do it randomly by flipping a coin instead sampling
+ * note: do it randomly by flipping a coin instead sampling
* all at once until it reaches the look around rate
*/
- if ( (((100* station->m_sampleCount) / (station->m_sampleCount + station->m_packetCount )) < m_lookAroundRate) &&
- ((int)coinFlip.GetValue ()) % 2 == 1 )
+ if ( (((100 * station->m_sampleCount) / (station->m_sampleCount + station->m_packetCount )) < m_lookAroundRate)
+ && ((int)coinFlip.GetValue ()) % 2 == 1 )
{
/// now go through the table and find an index rate
- idx = GetNextSample(station);
-
-
+ idx = GetNextSample (station);
+
+
/**
* This if condition is used to make sure that we don't need to use
* the sample rate it is the same as our current rate
*/
- if (idx != station->m_maxTpRate && idx != station->m_txrate)
+ if (idx != station->m_maxTpRate && idx != station->m_txrate)
{
-
+
/// start sample count
station->m_sampleCount++;
@@ -518,7 +519,7 @@
station->m_isSampling = true;
/// bookeeping for resetting stuff
- if (station->m_packetCount >= 10000)
+ if (station->m_packetCount >= 10000)
{
station->m_sampleCount = 0;
station->m_packetCount = 0;
@@ -539,7 +540,7 @@
}
/// is this rate slower than the current best rate
- station->m_sampleRateSlower =
+ station->m_sampleRateSlower =
(m_minstrelTable[idx].perfectTxTime > m_minstrelTable[station->m_maxTpRate].perfectTxTime);
/// using the best rate instead
@@ -548,13 +549,13 @@
idx = station->m_maxTpRate;
}
}
-
- }
+
+ }
/// continue using the best rate
else
{
- idx = station->m_maxTpRate;
+ idx = station->m_maxTpRate;
}
@@ -575,18 +576,18 @@
{
return;
}
- NS_LOG_DEBUG ("Updating stats="<<this);
+ NS_LOG_DEBUG ("Updating stats=" << this);
station->m_nextStatsUpdate = Simulator::Now () + m_updateStats;
Time txTime;
uint32_t tempProb;
- for (uint32_t i =0; i < m_nsupported; i++)
- {
+ for (uint32_t i = 0; i < m_nsupported; i++)
+ {
/// calculate the perfect tx time for this rate
- txTime = m_minstrelTable[i].perfectTxTime;
+ txTime = m_minstrelTable[i].perfectTxTime;
/// just for initialization
if (txTime.GetMicroSeconds () == 0)
@@ -594,8 +595,8 @@
txTime = Seconds (1);
}
- NS_LOG_DEBUG ("m_txrate=" << station->m_txrate <<
- "\t attempt=" << m_minstrelTable[i].numRateAttempt <<
+ NS_LOG_DEBUG ("m_txrate=" << station->m_txrate <<
+ "\t attempt=" << m_minstrelTable[i].numRateAttempt <<
"\t success=" << m_minstrelTable[i].numRateSuccess);
/// if we've attempted something
@@ -613,12 +614,12 @@
m_minstrelTable[i].prob = tempProb;
/// ewma probability (cast for gcc 3.4 compatibility)
- tempProb = static_cast<uint32_t>(((tempProb * (100 - m_ewmaLevel)) + (m_minstrelTable[i].ewmaProb * m_ewmaLevel) )/100);
+ tempProb = static_cast<uint32_t> (((tempProb * (100 - m_ewmaLevel)) + (m_minstrelTable[i].ewmaProb * m_ewmaLevel) ) / 100);
m_minstrelTable[i].ewmaProb = tempProb;
/// calculating throughput
- m_minstrelTable[i].throughput = tempProb * (1000000 / txTime.GetMicroSeconds());
+ m_minstrelTable[i].throughput = tempProb * (1000000 / txTime.GetMicroSeconds ());
}
@@ -629,7 +630,7 @@
m_minstrelTable[i].numRateAttempt = 0;
/// Sample less often below 10% and above 95% of success
- if ((m_minstrelTable[i].ewmaProb > 17100) || (m_minstrelTable[i].ewmaProb < 1800))
+ if ((m_minstrelTable[i].ewmaProb > 17100) || (m_minstrelTable[i].ewmaProb < 1800))
{
/**
* retry count denotes the number of retries permitted for each rate
@@ -654,21 +655,21 @@
}
- uint32_t max_prob = 0, index_max_prob =0, max_tp =0, index_max_tp=0, index_max_tp2=0;
+ uint32_t max_prob = 0, index_max_prob = 0, max_tp = 0, index_max_tp = 0, index_max_tp2 = 0;
/// go find max throughput, second maximum throughput, high probability succ
- for (uint32_t i =0; i < m_nsupported; i++)
+ for (uint32_t i = 0; i < m_nsupported; i++)
{
- NS_LOG_DEBUG ("throughput" << m_minstrelTable[i].throughput <<
+ NS_LOG_DEBUG ("throughput" << m_minstrelTable[i].throughput <<
"\n ewma" << m_minstrelTable[i].ewmaProb);
- if (max_tp < m_minstrelTable[i].throughput)
+ if (max_tp < m_minstrelTable[i].throughput)
{
index_max_tp = i;
max_tp = m_minstrelTable[i].throughput;
}
- if (max_prob < m_minstrelTable[i].ewmaProb)
+ if (max_prob < m_minstrelTable[i].ewmaProb)
{
index_max_prob = i;
max_prob = m_minstrelTable[i].ewmaProb;
@@ -678,7 +679,7 @@
max_tp = 0;
/// find the second highest max
- for (uint32_t i =0; i < m_nsupported; i++)
+ for (uint32_t i = 0; i < m_nsupported; i++)
{
if ((i != index_max_tp) && (max_tp < m_minstrelTable[i].throughput))
{
@@ -697,7 +698,7 @@
station->m_txrate = index_max_tp;
}
- NS_LOG_DEBUG ("max tp="<< index_max_tp << "\nmax tp2="<< index_max_tp2<< "\nmax prob="<< index_max_prob);
+ NS_LOG_DEBUG ("max tp=" << index_max_tp << "\nmax tp2=" << index_max_tp2 << "\nmax prob=" << index_max_prob);
/// reset it
RateInit (station);
@@ -706,7 +707,7 @@
void
MinstrelWifiManager::RateInit (MinstrelWifiRemoteStation *station)
{
- NS_LOG_DEBUG ("RateInit="<<station);
+ NS_LOG_DEBUG ("RateInit=" << station);
for (uint32_t i = 0; i < m_nsupported; i++)
{
@@ -728,11 +729,11 @@
void
MinstrelWifiManager::InitSampleTable (MinstrelWifiRemoteStation *station)
{
- NS_LOG_DEBUG ("InitSampleTable="<<this);
-
+ NS_LOG_DEBUG ("InitSampleTable=" << this);
+
station->m_col = station->m_index = 0;
- /// for off-seting to make rates fall between 0 and numrates
+ /// for off-seting to make rates fall between 0 and numrates
uint32_t numSampleRates = m_nsupported;
uint32_t newIndex;
@@ -743,13 +744,13 @@
/**
* The next two lines basically tries to generate a random number
- * between 0 and the number of available rates
+ * between 0 and the number of available rates
*/
UniformVariable uv (0, numSampleRates);
- newIndex = (i + (uint32_t)uv.GetValue ()) % numSampleRates;
+ newIndex = (i + (uint32_t)uv.GetValue ()) % numSampleRates;
/// this loop is used for filling in other uninitilized places
- while (m_sampleTable[newIndex][col] != 0)
+ while (m_sampleTable[newIndex][col] != 0)
{
newIndex = (newIndex + 1) % m_nsupported;
}
@@ -762,7 +763,7 @@
void
MinstrelWifiManager::PrintSampleTable (MinstrelWifiRemoteStation *station)
{
- NS_LOG_DEBUG ("PrintSampleTable="<<station);
+ NS_LOG_DEBUG ("PrintSampleTable=" << station);
uint32_t numSampleRates = m_nsupported;
for (uint32_t i = 0; i < numSampleRates; i++)
@@ -774,15 +775,15 @@
std::cout << std::endl;
}
}
-
+
void
MinstrelWifiManager::PrintTable (MinstrelWifiRemoteStation *station)
{
- NS_LOG_DEBUG ("PrintTable="<<station);
+ NS_LOG_DEBUG ("PrintTable=" << station);
- for (uint32_t i=0; i < m_nsupported; i++)
+ for (uint32_t i = 0; i < m_nsupported; i++)
{
- std::cout << "index(" << i << ") = " << m_minstrelTable[i].perfectTxTime<< "\n";
+ std::cout << "index(" << i << ") = " << m_minstrelTable[i].perfectTxTime << "\n";
}
}
--- a/src/wifi/model/minstrel-wifi-manager.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/minstrel-wifi-manager.h Sat May 07 21:49:46 2011 +0200
@@ -1,7 +1,7 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2009 Duy Nguyen
- *
+/*
+ * Copyright (c) 2009 Duy Nguyen
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
@@ -14,8 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Duy Nguyen <duy@soe.ucsc.edu>
+ *
+ * Author: Duy Nguyen <duy@soe.ucsc.edu>
*/
@@ -49,7 +49,7 @@
uint32_t retryCount; ///< retry limit
uint32_t adjustedRetryCount; ///< adjust the retry limit for this rate
uint32_t numRateAttempt; ///< how many number of attempts so far
- uint32_t numRateSuccess; ///< number of successful pkts
+ uint32_t numRateSuccess; ///< number of successful pkts
uint32_t prob; ///< (# pkts success )/(# total pkts)
/**
@@ -80,10 +80,10 @@
/**
* \author Duy Nguyen
- * \brief Implementation of Minstrel Rate Control Algorithm
+ * \brief Implementation of Minstrel Rate Control Algorithm
* \ingroup wifi
*
- * Porting Minstrel from Madwifi and Linux Kernel
+ * Porting Minstrel from Madwifi and Linux Kernel
* http://linuxwireless.org/en/developers/Documentation/mac80211/RateControl/minstrel
*/
class MinstrelWifiManager : public WifiRemoteStationManager
@@ -92,14 +92,14 @@
public:
static TypeId GetTypeId (void);
MinstrelWifiManager ();
- virtual ~MinstrelWifiManager();
+ virtual ~MinstrelWifiManager ();
virtual void SetupPhy (Ptr<WifiPhy> phy);
private:
// overriden from base class
- virtual WifiRemoteStation *DoCreateStation (void) const;
- virtual void DoReportRxOk (WifiRemoteStation *station,
+ virtual WifiRemoteStation * DoCreateStation (void) const;
+ virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
virtual void DoReportRtsFailed (WifiRemoteStation *station);
virtual void DoReportDataFailed (WifiRemoteStation *station);
@@ -113,7 +113,7 @@
virtual WifiMode DoGetRtsMode (WifiRemoteStation *station);
virtual bool IsLowLatency (void) const;
- /// for estimating the TxTime of a packet with a given mode
+ /// for estimating the TxTime of a packet with a given mode
Time GetCalcTxTime (WifiMode mode) const;
void AddCalcTxTime (WifiMode mode, Time t);
@@ -151,14 +151,14 @@
TxTime m_calcTxTime; ///< to hold all the calculated TxTime for all modes
Time m_updateStats; ///< how frequent do we calculate the stats(1/10 seconds)
- double m_lookAroundRate; ///< the % to try other rates than our current rate
+ double m_lookAroundRate; ///< the % to try other rates than our current rate
double m_ewmaLevel; ///< exponential weighted moving average
uint32_t m_segmentSize; ///< largest allowable segment size
uint32_t m_sampleCol; ///< number of sample columns
- uint32_t m_pktLen; ///< packet length used for calculate mode TxTime
+ uint32_t m_pktLen; ///< packet length used for calculate mode TxTime
uint32_t m_nsupported; ///< modes supported
};
-}// namespace ns3
+} // namespace ns3
#endif /* MINSTREL_WIFI_MANAGER_H */
--- a/src/wifi/model/msdu-aggregator.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/msdu-aggregator.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -33,7 +33,7 @@
{
static TypeId tid = TypeId ("ns3::MsduAggregator")
.SetParent<Object> ()
- ;
+ ;
return tid;
}
@@ -42,7 +42,7 @@
{
NS_LOG_FUNCTION_NOARGS ();
DeaggregatedMsdus set;
-
+
AmsduSubframeHeader hdr;
Ptr<Packet> extractedMsdu = Create<Packet> ();
uint32_t maxSize = aggregatedPacket->GetSize ();
@@ -51,25 +51,25 @@
uint32_t deserialized = 0;
while (deserialized < maxSize)
- {
- deserialized += aggregatedPacket->RemoveHeader (hdr);
- extractedLength = hdr.GetLength ();
- extractedMsdu = aggregatedPacket->CreateFragment (0, static_cast<uint32_t>(extractedLength));
- aggregatedPacket->RemoveAtStart (extractedLength);
- deserialized += extractedLength;
-
- padding = (4 - ((extractedLength + 14) %4 )) % 4;
-
- if (padding > 0 && deserialized < maxSize)
- {
- aggregatedPacket->RemoveAtStart (padding);
- deserialized += padding;
- }
-
- std::pair<Ptr<Packet>, AmsduSubframeHeader> packetHdr (extractedMsdu, hdr);
- set.push_back (packetHdr);
- }
- NS_LOG_INFO ("Deaggreated A-MSDU: extracted "<< set.size () << " MSDUs");
+ {
+ deserialized += aggregatedPacket->RemoveHeader (hdr);
+ extractedLength = hdr.GetLength ();
+ extractedMsdu = aggregatedPacket->CreateFragment (0, static_cast<uint32_t> (extractedLength));
+ aggregatedPacket->RemoveAtStart (extractedLength);
+ deserialized += extractedLength;
+
+ padding = (4 - ((extractedLength + 14) % 4 )) % 4;
+
+ if (padding > 0 && deserialized < maxSize)
+ {
+ aggregatedPacket->RemoveAtStart (padding);
+ deserialized += padding;
+ }
+
+ std::pair<Ptr<Packet>, AmsduSubframeHeader> packetHdr (extractedMsdu, hdr);
+ set.push_back (packetHdr);
+ }
+ NS_LOG_INFO ("Deaggreated A-MSDU: extracted " << set.size () << " MSDUs");
return set;
}
--- a/src/wifi/model/msdu-aggregator.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/msdu-aggregator.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -29,7 +29,7 @@
#include <list>
namespace ns3 {
-
+
class WifiMacHeader;
/**
@@ -43,7 +43,7 @@
typedef std::list<std::pair<Ptr<Packet>, AmsduSubframeHeader> >::const_iterator DeaggregatedMsdusCI;
static TypeId GetTypeId (void);
- /* Adds <i>packet</i> to <i>aggregatedPacket</i>. In concrete aggregator's implementation is
+ /* Adds <i>packet</i> to <i>aggregatedPacket</i>. In concrete aggregator's implementation is
* specified how and if <i>packet</i> can be added to <i>aggregatedPacket</i>. If <i>packet</i>
* can be added returns true, false otherwise.
*/
--- a/src/wifi/model/msdu-standard-aggregator.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/msdu-standard-aggregator.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -39,15 +39,17 @@
UintegerValue (7935),
MakeUintegerAccessor (&MsduStandardAggregator::m_maxAmsduLength),
MakeUintegerChecker<uint32_t> ())
- ;
+ ;
return tid;
}
-MsduStandardAggregator::MsduStandardAggregator ()
-{}
+MsduStandardAggregator::MsduStandardAggregator ()
+{
+}
MsduStandardAggregator::~MsduStandardAggregator ()
-{}
+{
+}
bool
MsduStandardAggregator::Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket,
@@ -59,7 +61,7 @@
uint32_t padding = CalculatePadding (aggregatedPacket);
uint32_t actualSize = aggregatedPacket->GetSize ();
-
+
if ((14 + packet->GetSize () + actualSize + padding) <= m_maxAmsduLength)
{
if (padding)
@@ -71,7 +73,7 @@
currentHdr.SetSourceAddr (src);
currentHdr.SetLength (packet->GetSize ());
currentPacket = packet->Copy ();
-
+
currentPacket->AddHeader (currentHdr);
aggregatedPacket->AddAtEnd (currentPacket);
return true;
@@ -82,7 +84,7 @@
uint32_t
MsduStandardAggregator::CalculatePadding (Ptr<const Packet> packet)
{
- return (4 - (packet->GetSize() %4 )) % 4;
+ return (4 - (packet->GetSize () % 4 )) % 4;
}
} //namespace ns3
--- a/src/wifi/model/msdu-standard-aggregator.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/msdu-standard-aggregator.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -27,23 +27,22 @@
/**
* \ingroup wifi
* Standard MSDU aggregator
- *
+ *
*/
class MsduStandardAggregator : public MsduAggregator
{
public:
-
static TypeId GetTypeId (void);
MsduStandardAggregator ();
~MsduStandardAggregator ();
/**
* \param packet Packet we have to insert into <i>aggregatedPacket</i>.
- * \param aggregatedPacket Packet that will contain <i>packet</i>, if aggregation is possible,
+ * \param aggregatedPacket Packet that will contain <i>packet</i>, if aggregation is possible,
* \param src Source address of <i>packet</i>.
* \param dest Destination address of <i>packet</i>.
- *
+ *
* This method performs an MSDU aggregation.
- * Returns true if <i>packet</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
+ * Returns true if <i>packet</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
*/
virtual bool Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket,
Mac48Address src, Mac48Address dest);
--- a/src/wifi/model/nist-error-rate-model.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/nist-error-rate-model.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2010 The Boeing Company
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -27,7 +27,7 @@
NS_OBJECT_ENSURE_REGISTERED (NistErrorRateModel);
-TypeId
+TypeId
NistErrorRateModel::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::NistErrorRateModel")
@@ -44,41 +44,41 @@
double
NistErrorRateModel::GetBpskBer (double snr) const
{
- double z = sqrt(snr);
- double ber = 0.5 * erfc(z);
- NS_LOG_INFO ("bpsk snr="<<snr<<" ber="<<ber);
+ double z = sqrt (snr);
+ double ber = 0.5 * erfc (z);
+ NS_LOG_INFO ("bpsk snr=" << snr << " ber=" << ber);
return ber;
}
double
NistErrorRateModel::GetQpskBer (double snr) const
{
- double z = sqrt(snr/2.0);
- double ber = 0.5 * erfc(z);
- NS_LOG_INFO ("qpsk snr="<<snr<<" ber="<<ber);
+ double z = sqrt (snr / 2.0);
+ double ber = 0.5 * erfc (z);
+ NS_LOG_INFO ("qpsk snr=" << snr << " ber=" << ber);
return ber;
}
-double
+double
NistErrorRateModel::Get16QamBer (double snr) const
{
- double z = sqrt(snr/(5.0 * 2.0));
- double ber = 0.75 * 0.5 * erfc(z);
- NS_LOG_INFO ("16-Qam" << " snr="<<snr<<" ber="<<ber);
- return ber;
-}
-double
-NistErrorRateModel::Get64QamBer (double snr) const
-{
- double z = sqrt(snr/(21.0 * 2.0));
- double ber = 7.0 / 12.0 * 0.5 * erfc(z);
- NS_LOG_INFO ("64-Qam" << " snr="<<snr<<" ber="<<ber);
+ double z = sqrt (snr / (5.0 * 2.0));
+ double ber = 0.75 * 0.5 * erfc (z);
+ NS_LOG_INFO ("16-Qam" << " snr=" << snr << " ber=" << ber);
return ber;
}
double
-NistErrorRateModel::GetFecBpskBer (double snr, double nbits,
+NistErrorRateModel::Get64QamBer (double snr) const
+{
+ double z = sqrt (snr / (21.0 * 2.0));
+ double ber = 7.0 / 12.0 * 0.5 * erfc (z);
+ NS_LOG_INFO ("64-Qam" << " snr=" << snr << " ber=" << ber);
+ return ber;
+}
+double
+NistErrorRateModel::GetFecBpskBer (double snr, double nbits,
uint32_t bValue) const
{
double ber = GetBpskBer (snr);
- if (ber == 0.0)
+ if (ber == 0.0)
{
return 1.0;
}
@@ -88,11 +88,11 @@
return pms;
}
double
-NistErrorRateModel::GetFecQpskBer (double snr, double nbits,
+NistErrorRateModel::GetFecQpskBer (double snr, double nbits,
uint32_t bValue) const
{
double ber = GetQpskBer (snr);
- if (ber == 0.0)
+ if (ber == 0.0)
{
return 1.0;
}
@@ -104,7 +104,7 @@
double
NistErrorRateModel::CalculatePe (double p, uint32_t bValue) const
{
- double D = sqrt (4.0 * p * (1.0 -p));
+ double D = sqrt (4.0 * p * (1.0 - p));
double pe = 1.0;
if (bValue == 1)
{
@@ -123,7 +123,7 @@
else if (bValue == 2)
{
// code rate 2/3, use table 3.1.2
- pe = 1.0 / (2.0 * bValue) *
+ pe = 1.0 / (2.0 * bValue) *
( 3.0 * pow (D, 6.0)
+ 70.0 * pow (D, 7.0)
+ 285.0 * pow (D, 8.0)
@@ -139,7 +139,7 @@
else if (bValue == 3)
{
// code rate 3/4, use table 3.1.2
- pe = 1.0 / (2.0 * bValue) *
+ pe = 1.0 / (2.0 * bValue) *
( 42.0 * pow (D, 5.0)
+ 201.0 * pow (D, 6.0)
+ 1492.0 * pow (D, 7.0)
@@ -160,11 +160,11 @@
}
double
-NistErrorRateModel::GetFec16QamBer (double snr, uint32_t nbits,
+NistErrorRateModel::GetFec16QamBer (double snr, uint32_t nbits,
uint32_t bValue) const
{
double ber = Get16QamBer (snr);
- if (ber == 0.0)
+ if (ber == 0.0)
{
return 1.0;
}
@@ -174,11 +174,11 @@
return pms;
}
double
-NistErrorRateModel::GetFec64QamBer (double snr, uint32_t nbits,
+NistErrorRateModel::GetFec64QamBer (double snr, uint32_t nbits,
uint32_t bValue) const
{
double ber = Get64QamBer (snr);
- if (ber == 0.0)
+ if (ber == 0.0)
{
return 1.0;
}
@@ -187,11 +187,11 @@
double pms = pow (1 - pe, nbits);
return pms;
}
-double
+double
NistErrorRateModel::GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const
{
- if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM ||
- mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM)
+ if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM
+ || mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM)
{
if (mode.GetConstellationSize () == 2)
{
--- a/src/wifi/model/nist-error-rate-model.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/nist-error-rate-model.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2010 The Boeing Company
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -31,7 +31,7 @@
* \ingroup wifi
*
* A model for the error rate for different modulations. For OFDM modulation,
- * the model description and validation can be found in
+ * the model description and validation can be found in
* http://www.nsnam.org/~pei/80211ofdm.pdf. For DSSS modulations (802.11b),
* the model uses the DsssErrorRateModel.
*/
@@ -50,13 +50,13 @@
double GetQpskBer (double snr) const;
double Get16QamBer (double snr) const;
double Get64QamBer (double snr) const;
- double GetFecBpskBer (double snr, double nbits,
+ double GetFecBpskBer (double snr, double nbits,
uint32_t bValue) const;
- double GetFecQpskBer (double snr, double nbits,
+ double GetFecQpskBer (double snr, double nbits,
uint32_t bValue) const;
- double GetFec16QamBer (double snr, uint32_t nbits,
+ double GetFec16QamBer (double snr, uint32_t nbits,
uint32_t bValue) const;
- double GetFec64QamBer (double snr, uint32_t nbits,
+ double GetFec64QamBer (double snr, uint32_t nbits,
uint32_t bValue) const;
};
--- a/src/wifi/model/onoe-wifi-manager.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/onoe-wifi-manager.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2003,2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -61,12 +61,13 @@
UintegerValue (10),
MakeUintegerAccessor (&OnoeWifiManager::m_addCreditThreshold),
MakeUintegerChecker<uint32_t> ())
- ;
+ ;
return tid;
}
OnoeWifiManager::OnoeWifiManager ()
-{}
+{
+}
WifiRemoteStation *
OnoeWifiManager::DoCreateStation (void) const
{
@@ -81,42 +82,44 @@
station->m_txrate = 0;
return station;
}
-void
+void
OnoeWifiManager::DoReportRxOk (WifiRemoteStation *station,
- double rxSnr, WifiMode txMode)
-{}
-void
+ double rxSnr, WifiMode txMode)
+{
+}
+void
OnoeWifiManager::DoReportRtsFailed (WifiRemoteStation *st)
{
OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
station->m_shortRetry++;
}
-void
+void
OnoeWifiManager::DoReportDataFailed (WifiRemoteStation *st)
{
OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
station->m_longRetry++;
}
-void
+void
OnoeWifiManager::DoReportRtsOk (WifiRemoteStation *station,
- double ctsSnr, WifiMode ctsMode, double rtsSnr)
-{}
-void
+ double ctsSnr, WifiMode ctsMode, double rtsSnr)
+{
+}
+void
OnoeWifiManager::DoReportDataOk (WifiRemoteStation *st,
- double ackSnr, WifiMode ackMode, double dataSnr)
+ double ackSnr, WifiMode ackMode, double dataSnr)
{
OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
UpdateRetry (station);
station->m_tx_ok++;
}
-void
+void
OnoeWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *st)
{
OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
UpdateRetry (station);
station->m_tx_err++;
}
-void
+void
OnoeWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
{
OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
@@ -149,55 +152,72 @@
/* no packet reached -> down */
if (station->m_tx_err > 0 && station->m_tx_ok == 0)
- dir = -1;
+ {
+ dir = -1;
+ }
/* all packets needs retry in average -> down */
if (enough && station->m_tx_ok < station->m_tx_retr)
- dir = -1;
+ {
+ dir = -1;
+ }
/* no error and less than rate_raise% of packets need retry -> up */
- if (enough && station->m_tx_err == 0 &&
- station->m_tx_retr < (station->m_tx_ok * m_addCreditThreshold) / 100)
- dir = 1;
+ if (enough && station->m_tx_err == 0
+ && station->m_tx_retr < (station->m_tx_ok * m_addCreditThreshold) / 100)
+ {
+ dir = 1;
+ }
NS_LOG_DEBUG (this << " ok " << station->m_tx_ok << " err " << station->m_tx_err << " retr " << station->m_tx_retr <<
" upper " << station->m_tx_upper << " dir " << dir);
nrate = station->m_txrate;
- switch (dir) {
- case 0:
- if (enough && station->m_tx_upper > 0)
- station->m_tx_upper--;
- break;
- case -1:
- if (nrate > 0) {
- nrate--;
+ switch (dir)
+ {
+ case 0:
+ if (enough && station->m_tx_upper > 0)
+ {
+ station->m_tx_upper--;
+ }
+ break;
+ case - 1:
+ if (nrate > 0)
+ {
+ nrate--;
+ }
+ station->m_tx_upper = 0;
+ break;
+ case 1:
+ /* raise rate if we hit rate_raise_threshold */
+ if (++station->m_tx_upper < m_raiseThreshold)
+ {
+ break;
+ }
+ station->m_tx_upper = 0;
+ if (nrate + 1 < GetNSupported (station))
+ {
+ nrate++;
+ }
+ break;
}
- station->m_tx_upper = 0;
- break;
- case 1:
- /* raise rate if we hit rate_raise_threshold */
- if (++station->m_tx_upper < m_raiseThreshold)
- break;
- station->m_tx_upper = 0;
- if (nrate + 1 < GetNSupported (station)) {
- nrate++;
+
+ if (nrate != station->m_txrate)
+ {
+ NS_ASSERT (nrate < GetNSupported (station));
+ station->m_txrate = nrate;
+ station->m_tx_ok = station->m_tx_err = station->m_tx_retr = station->m_tx_upper = 0;
}
- break;
- }
-
- if (nrate != station->m_txrate) {
- NS_ASSERT (nrate < GetNSupported (station));
- station->m_txrate = nrate;
- station->m_tx_ok = station->m_tx_err = station->m_tx_retr = station->m_tx_upper = 0;
- } else if (enough)
- station->m_tx_ok = station->m_tx_err = station->m_tx_retr = 0;
+ else if (enough)
+ {
+ station->m_tx_ok = station->m_tx_err = station->m_tx_retr = 0;
+ }
}
-WifiMode
+WifiMode
OnoeWifiManager::DoGetDataMode (WifiRemoteStation *st,
- uint32_t size)
+ uint32_t size)
{
OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
UpdateMode (station);
@@ -242,7 +262,7 @@
}
return GetSupported (station, rateIndex);
}
-WifiMode
+WifiMode
OnoeWifiManager::DoGetRtsMode (WifiRemoteStation *st)
{
OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
@@ -251,7 +271,7 @@
return GetSupported (station, 0);
}
-bool
+bool
OnoeWifiManager::IsLowLatency (void) const
{
return false;
--- a/src/wifi/model/onoe-wifi-manager.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/onoe-wifi-manager.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2003,2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -28,7 +28,7 @@
struct OnoeWifiRemoteStation;
/**
- * \brief an implementation of the rate control algorithm developed
+ * \brief an implementation of the rate control algorithm developed
* by Atsushi Onoe
*
* \ingroup wifi
@@ -47,8 +47,8 @@
private:
// overriden from base class
- virtual WifiRemoteStation *DoCreateStation (void) const;
- virtual void DoReportRxOk (WifiRemoteStation *station,
+ virtual WifiRemoteStation * DoCreateStation (void) const;
+ virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
virtual void DoReportRtsFailed (WifiRemoteStation *station);
virtual void DoReportDataFailed (WifiRemoteStation *station);
--- a/src/wifi/model/originator-block-ack-agreement.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/originator-block-ack-agreement.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009, 2010 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -27,15 +27,18 @@
m_state (PENDING),
m_sentMpdus (0),
m_needBlockAckReq (false)
-{}
+{
+}
OriginatorBlockAckAgreement::OriginatorBlockAckAgreement (Mac48Address recipient, uint8_t tid)
: BlockAckAgreement (recipient, tid),
m_state (PENDING),
m_sentMpdus (0),
m_needBlockAckReq (false)
-{}
+{
+}
OriginatorBlockAckAgreement::~OriginatorBlockAckAgreement ()
-{}
+{
+}
void
OriginatorBlockAckAgreement::SetState (enum State state)
{
@@ -49,22 +52,22 @@
bool
OriginatorBlockAckAgreement::IsPending (void) const
{
- return (m_state == PENDING)?true:false;
+ return (m_state == PENDING) ? true : false;
}
bool
OriginatorBlockAckAgreement::IsEstablished (void) const
{
- return (m_state == ESTABLISHED)?true:false;
+ return (m_state == ESTABLISHED) ? true : false;
}
bool
OriginatorBlockAckAgreement::IsInactive (void) const
{
- return (m_state == INACTIVE)?true:false;
+ return (m_state == INACTIVE) ? true : false;
}
bool
OriginatorBlockAckAgreement::IsUnsuccessful (void) const
{
- return (m_state == UNSUCCESSFUL)?true:false;
+ return (m_state == UNSUCCESSFUL) ? true : false;
}
void
OriginatorBlockAckAgreement::NotifyMpduTransmission (uint16_t nextSeqNumber)
--- a/src/wifi/model/originator-block-ack-agreement.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/originator-block-ack-agreement.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009, 2010 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -25,7 +25,7 @@
namespace ns3 {
-/**
+/**
* \ingroup wifi
* Maintains the state and information about transmitted MPDUs with ack policy block ack
* for an originator station.
@@ -48,45 +48,46 @@
* --------------- blockAckThreshold / | | | blockAckThreshold
* | UNSUCCESSFUL | / | | |
* --------------- v | ----------|
- * -------------- |
- * | INACTIVE | |
+ * -------------- |
+ * | INACTIVE | |
* -------------- |
* send a MPDU (Normal Ack) | |
* retryPkts + queuePkts | |
* >= | |
* blockAckThreshold |----------------
- */
- /**
- * Represents the state for this agreement.
- *
- * PENDING:
- * If an agreement is in PENDING state it means that an ADDBARequest frame was sent to
- * recipient in order to setup the block ack and the originator is waiting for the relative
- * ADDBAResponse frame.
- *
- * ESTABLISHED:
- * The block ack is active and all packets relative to this agreement are transmitted
- * with ack policy set to block ack.
- *
- * INACTIVE:
- * In our implementation, block ack tear-down happens only if an inactivity timeout occurs
- * so we could have an active block ack but a number of packets that doesn't reach the value of
- * m_blockAckThreshold (see ns3::BlockAckManager). In these conditions the agreement becomes
- * INACTIVE until that the number of packets reaches the value of m_blockAckThreshold again.
- *
- * UNSUCCESSFUL (not used for now):
- * The agreement's state becomes UNSUCCESSFUL if:
- *
- * - its previous state was PENDING and an ADDBAResponse frame wasn't received from
- * recipient station within an interval of time defined by m_bAckSetupTimeout attribute
- * in ns3::WifiMac.
- * - an ADDBAResponse frame is received from recipient and the Status Code field is set
- * to failure.
- *
- * In both cases for station addressed by BlockAckAgreement::m_peer and for
- * TID BlockAckAgreement::m_tid block ack mechanism won't be used.
*/
- enum State {
+ /**
+ * Represents the state for this agreement.
+ *
+ * PENDING:
+ * If an agreement is in PENDING state it means that an ADDBARequest frame was sent to
+ * recipient in order to setup the block ack and the originator is waiting for the relative
+ * ADDBAResponse frame.
+ *
+ * ESTABLISHED:
+ * The block ack is active and all packets relative to this agreement are transmitted
+ * with ack policy set to block ack.
+ *
+ * INACTIVE:
+ * In our implementation, block ack tear-down happens only if an inactivity timeout occurs
+ * so we could have an active block ack but a number of packets that doesn't reach the value of
+ * m_blockAckThreshold (see ns3::BlockAckManager). In these conditions the agreement becomes
+ * INACTIVE until that the number of packets reaches the value of m_blockAckThreshold again.
+ *
+ * UNSUCCESSFUL (not used for now):
+ * The agreement's state becomes UNSUCCESSFUL if:
+ *
+ * - its previous state was PENDING and an ADDBAResponse frame wasn't received from
+ * recipient station within an interval of time defined by m_bAckSetupTimeout attribute
+ * in ns3::WifiMac.
+ * - an ADDBAResponse frame is received from recipient and the Status Code field is set
+ * to failure.
+ *
+ * In both cases for station addressed by BlockAckAgreement::m_peer and for
+ * TID BlockAckAgreement::m_tid block ack mechanism won't be used.
+ */
+ enum State
+ {
PENDING,
ESTABLISHED,
INACTIVE,
--- a/src/wifi/model/qos-blocked-destinations.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/qos-blocked-destinations.cc Sat May 07 21:49:46 2011 +0200
@@ -4,7 +4,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -23,10 +23,12 @@
namespace ns3 {
QosBlockedDestinations::QosBlockedDestinations ()
-{}
+{
+}
QosBlockedDestinations::~QosBlockedDestinations ()
-{}
+{
+}
bool
QosBlockedDestinations::IsBlocked (Mac48Address dest, uint8_t tid) const
--- a/src/wifi/model/qos-blocked-destinations.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/qos-blocked-destinations.h Sat May 07 21:49:46 2011 +0200
@@ -4,7 +4,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
--- a/src/wifi/model/qos-tag.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/qos-tag.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -25,7 +25,7 @@
NS_OBJECT_ENSURE_REGISTERED (QosTag);
-TypeId
+TypeId
QosTag::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::QosTag")
@@ -35,7 +35,7 @@
UintegerValue (0),
MakeUintegerAccessor (&QosTag::GetTid),
MakeUintegerChecker<uint8_t> ())
- ;
+ ;
return tid;
}
@@ -45,13 +45,15 @@
return GetTypeId ();
}
-QosTag::QosTag ():
- m_tid (0)
-{}
-QosTag::QosTag (uint8_t tid):
- m_tid (tid)
-{}
-
+QosTag::QosTag ()
+ : m_tid (0)
+{
+}
+QosTag::QosTag (uint8_t tid)
+ : m_tid (tid)
+{
+}
+
void
QosTag::SetTid (uint8_t tid)
{
@@ -64,7 +66,7 @@
m_tid = up;
}
-uint32_t
+uint32_t
QosTag::GetSerializedSize (void) const
{
return 1;
--- a/src/wifi/model/qos-tag.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/qos-tag.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -36,7 +36,8 @@
* case the mapping between UPs and TIDs should be determined by a
* TSPEC element as per IEEE Std. 802.11-2007, Section 7.3.2.30
*/
-enum UserPriority {
+enum UserPriority
+{
UP_BK = 1, /**< background */
UP_BE = 0, /**< best effort (default) */
UP_EE = 3, /**< excellent effort */
@@ -45,9 +46,9 @@
UP_VO = 6, /**< voice, < 10ms latency and jitter */
UP_NC = 7 /**< network control */
};
-
+
-
+
/**
* \ingroup wifi
*
@@ -55,7 +56,7 @@
* specify the TID which will be used by a QoS-aware WifiMac for a
* given traffic flow. Note that the current QosTag class was
* designed to be completely mac/wifi specific without any attempt
- * at being generic.
+ * at being generic.
*/
class QosTag : public Tag
{
@@ -63,34 +64,34 @@
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
- /**
- * Create a QosTag with the default TID = 0 (best effort traffic)
- */
+ /**
+ * Create a QosTag with the default TID = 0 (best effort traffic)
+ */
QosTag ();
- /**
- * Create a QosTag with the given TID
- */
+ /**
+ * Create a QosTag with the given TID
+ */
QosTag (uint8_t tid);
- /**
+ /**
* Set the TID to the given value. This assumes that the
* application is aware of the QoS support provided by the MAC
- * layer, and is therefore able to set the correct TID.
- *
+ * layer, and is therefore able to set the correct TID.
+ *
* @param tid the value of the TID to set
*/
void SetTid (uint8_t tid);
- /**
+ /**
* Set the TID to the value that corresponds to the requested
* UserPriority. Note that, since the mapping of UserPriority to TID
* is defined for EDCA only, you should call this method only when
* EDCA is used. When using HDCA, QosTag(uint8_t tid) should be used
* instead.
- *
+ *
* @param up the requested UserPriority
- *
+ *
*/
void SetUserPriority (UserPriority up);
--- a/src/wifi/model/qos-utils.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/qos-utils.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -26,32 +26,33 @@
AcIndex
QosUtilsMapTidToAc (uint8_t tid)
{
- switch (tid) {
- case 0 :
- return AC_BE;
- break;
- case 1 :
- return AC_BK;
- break;
- case 2 :
- return AC_BK;
- break;
- case 3 :
- return AC_BE;
- break;
- case 4 :
- return AC_VI;
- break;
- case 5 :
- return AC_VI;
- break;
- case 6 :
- return AC_VO;
- break;
- case 7 :
- return AC_VO;
- break;
- }
+ switch (tid)
+ {
+ case 0:
+ return AC_BE;
+ break;
+ case 1:
+ return AC_BK;
+ break;
+ case 2:
+ return AC_BK;
+ break;
+ case 3:
+ return AC_BE;
+ break;
+ case 4:
+ return AC_VI;
+ break;
+ case 5:
+ return AC_VI;
+ break;
+ case 6:
+ return AC_VO;
+ break;
+ case 7:
+ return AC_VO;
+ break;
+ }
return AC_UNDEF;
}
@@ -74,11 +75,11 @@
QosUtilsMapSeqControlToUniqueInteger (uint16_t seqControl, uint16_t endSequence)
{
uint32_t integer = 0;
- uint16_t numberSeq = (seqControl>>4) & 0x0fff;
+ uint16_t numberSeq = (seqControl >> 4) & 0x0fff;
integer = (4096 - (endSequence + 1) + numberSeq) % 4096;
integer *= 16;
integer += (seqControl & 0x000f);
- return integer;
+ return integer;
}
bool
--- a/src/wifi/model/qos-utils.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/qos-utils.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -32,7 +32,8 @@
* with values corresponding to the AC index (ACI) values specified in
* Table 7-36 of IEEE 802.11-2007.
*/
-enum AcIndex {
+enum AcIndex
+{
/** Best Effort */
AC_BE = 0,
/** Background */
@@ -80,7 +81,7 @@
*
* ----- = old packets
* +++++ = new packets
- *
+ *
* CASE A:
*
* 0 4095
@@ -90,7 +91,7 @@
*
*
* CASE B:
- *
+ *
* 0 4095
* |------|++++++++++++++++|-----|
* ^ ^
--- a/src/wifi/model/random-stream.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/random-stream.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -25,26 +25,28 @@
namespace ns3 {
RandomStream::~RandomStream ()
-{}
+{
+}
RealRandomStream::RealRandomStream ()
: m_stream (UniformVariable ())
-{}
-uint32_t
+{
+}
+uint32_t
RealRandomStream::GetNext (uint32_t min, uint32_t max)
{
return m_stream.GetInteger (min, max);
}
-void
+void
TestRandomStream::AddNext (uint32_t v)
{
m_nexts.push_back (v);
}
-uint32_t
+uint32_t
TestRandomStream::GetNext (uint32_t min, uint32_t max)
{
NS_ASSERT (!m_nexts.empty ());
--- a/src/wifi/model/random-stream.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/random-stream.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -27,7 +27,7 @@
namespace ns3 {
/**
- * A simple wrapper around RngStream to make testing
+ * A simple wrapper around RngStream to make testing
* of the code easier.
*/
class RandomStream
--- a/src/wifi/model/regular-wifi-mac.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/regular-wifi-mac.cc Sat May 07 21:49:46 2011 +0200
@@ -153,7 +153,7 @@
edca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this));
edca->SetAccessCategory (ac);
edca->CompleteConfig ();
- m_edca.insert (std::make_pair(ac, edca));
+ m_edca.insert (std::make_pair (ac, edca));
}
void
@@ -447,7 +447,7 @@
{
case WifiActionHeader::BLOCK_ACK:
- switch (actionHdr.GetAction().blockAck)
+ switch (actionHdr.GetAction ().blockAck)
{
case WifiActionHeader::BLOCK_ACK_ADDBA_REQUEST:
{
@@ -607,22 +607,22 @@
.AddAttribute ("VO_EdcaTxopN",
"Queue that manages packets belonging to AC_VO access class",
PointerValue (),
- MakePointerAccessor(&RegularWifiMac::GetVOQueue),
+ MakePointerAccessor (&RegularWifiMac::GetVOQueue),
MakePointerChecker<EdcaTxopN> ())
.AddAttribute ("VI_EdcaTxopN",
"Queue that manages packets belonging to AC_VI access class",
PointerValue (),
- MakePointerAccessor(&RegularWifiMac::GetVIQueue),
+ MakePointerAccessor (&RegularWifiMac::GetVIQueue),
MakePointerChecker<EdcaTxopN> ())
.AddAttribute ("BE_EdcaTxopN",
"Queue that manages packets belonging to AC_BE access class",
PointerValue (),
- MakePointerAccessor(&RegularWifiMac::GetBEQueue),
+ MakePointerAccessor (&RegularWifiMac::GetBEQueue),
MakePointerChecker<EdcaTxopN> ())
.AddAttribute ("BK_EdcaTxopN",
"Queue that manages packets belonging to AC_BK access class",
PointerValue (),
- MakePointerAccessor(&RegularWifiMac::GetBKQueue),
+ MakePointerAccessor (&RegularWifiMac::GetBKQueue),
MakePointerChecker<EdcaTxopN> ())
.AddTraceSource ( "TxOkHeader",
"The header of successfully transmitted packet",
--- a/src/wifi/model/rraa-wifi-manager.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/rraa-wifi-manager.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2004,2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -44,9 +44,9 @@
uint32_t m_rate;
};
-NS_OBJECT_ENSURE_REGISTERED(RraaWifiManager);
+NS_OBJECT_ENSURE_REGISTERED (RraaWifiManager);
-TypeId
+TypeId
RraaWifiManager::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::RraaWifiManager")
@@ -172,15 +172,17 @@
DoubleValue (0.3932),
MakeDoubleAccessor (&RraaWifiManager::m_pmtlfor9),
MakeDoubleChecker<double> ())
- ;
+ ;
return tid;
}
RraaWifiManager::RraaWifiManager ()
-{}
+{
+}
RraaWifiManager::~RraaWifiManager ()
-{}
+{
+}
WifiRemoteStation *
@@ -220,11 +222,12 @@
}
-void
+void
RraaWifiManager::DoReportRtsFailed (WifiRemoteStation *st)
-{}
+{
+}
-void
+void
RraaWifiManager::DoReportDataFailed (WifiRemoteStation *st)
{
RraaWifiRemoteStation *station = (RraaWifiRemoteStation *) st;
@@ -234,17 +237,18 @@
station->m_failed++;
RunBasicAlgorithm (station);
}
-void
+void
RraaWifiManager::DoReportRxOk (WifiRemoteStation *st,
double rxSnr, WifiMode txMode)
-{}
-void
+{
+}
+void
RraaWifiManager::DoReportRtsOk (WifiRemoteStation *st,
double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
- NS_LOG_DEBUG ("self="<<st<<" rts ok");
+ NS_LOG_DEBUG ("self=" << st << " rts ok");
}
-void
+void
RraaWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
{
@@ -254,12 +258,14 @@
station->m_counter--;
RunBasicAlgorithm (station);
}
-void
+void
RraaWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *st)
-{}
-void
+{
+}
+void
RraaWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
-{}
+{
+}
WifiMode
RraaWifiManager::DoGetDataMode (WifiRemoteStation *st,
@@ -295,7 +301,7 @@
RraaWifiManager::CheckTimeout (RraaWifiRemoteStation *station)
{
Time d = Simulator::Now () - station->m_lastReset;
- if (station->m_counter == 0 || d > m_timeout)
+ if (station->m_counter == 0 || d > m_timeout)
{
ResetCountersBasic (station);
}
@@ -306,16 +312,16 @@
{
ThresholdsItem thresholds = GetThresholds (station, station->m_rate);
double ploss = (double) station->m_failed / (double) thresholds.ewnd;
- if (station->m_counter == 0 ||
- ploss > thresholds.pmtl)
+ if (station->m_counter == 0
+ || ploss > thresholds.pmtl)
{
- if (station->m_rate > GetMinRate (station) &&
- ploss > thresholds.pmtl)
+ if (station->m_rate > GetMinRate (station)
+ && ploss > thresholds.pmtl)
{
station->m_rate--;
}
- else if (station->m_rate < GetMaxRate (station) &&
- ploss < thresholds.pori)
+ else if (station->m_rate < GetMaxRate (station)
+ && ploss < thresholds.pori)
{
station->m_rate++;
}
@@ -326,31 +332,31 @@
void
RraaWifiManager::ARts (RraaWifiRemoteStation *station)
{
- if (!station->m_rtsOn &&
- station->m_lastFrameFail)
+ if (!station->m_rtsOn
+ && station->m_lastFrameFail)
{
station->m_rtsWnd++;
station->m_rtsCounter = station->m_rtsWnd;
}
- else if ((station->m_rtsOn && station->m_lastFrameFail) ||
- (!station->m_rtsOn && !station->m_lastFrameFail))
+ else if ((station->m_rtsOn && station->m_lastFrameFail)
+ || (!station->m_rtsOn && !station->m_lastFrameFail))
{
station->m_rtsWnd = station->m_rtsWnd / 2;
station->m_rtsCounter = station->m_rtsWnd;
}
- if (station->m_rtsCounter > 0)
+ if (station->m_rtsCounter > 0)
{
station->m_rtsOn = true;
station->m_rtsCounter--;
}
- else
+ else
{
station->m_rtsOn = false;
}
}
struct RraaWifiManager::ThresholdsItem
-RraaWifiManager::GetThresholds (RraaWifiRemoteStation *station,
+RraaWifiManager::GetThresholds (RraaWifiRemoteStation *station,
uint32_t rate) const
{
WifiMode mode = GetSupported (station, rate);
@@ -360,66 +366,90 @@
struct RraaWifiManager::ThresholdsItem
RraaWifiManager::GetThresholds (WifiMode mode) const
{
- switch (mode.GetDataRate () / 1000000)
+ switch (mode.GetDataRate () / 1000000)
{
- case 54: {
- ThresholdsItem mode54 = {54000000,
- 0.0,
- m_pmtlfor54,
- m_ewndfor54};
- return mode54;
- } break;
- case 48: {
- ThresholdsItem mode48 = {48000000,
- m_porifor48,
- m_pmtlfor48,
- m_ewndfor48};
- return mode48;
- } break;
- case 36: {
- ThresholdsItem mode36 = {36000000,
- m_porifor36,
- m_pmtlfor36,
- m_ewndfor36};
- return mode36;
- } break;
- case 24: {
- ThresholdsItem mode24 = {24000000,
- m_porifor24,
- m_pmtlfor24,
- m_ewndfor24};
- return mode24;
- } break;
- case 18: {
- ThresholdsItem mode18 = {18000000,
- m_porifor18,
- m_pmtlfor18,
- m_ewndfor18};
- return mode18;
- } break;
- case 12: {
- ThresholdsItem mode12 = {12000000,
- m_porifor12,
- m_pmtlfor12,
- m_ewndfor12};
- return mode12;
- } break;
- case 9: {
- ThresholdsItem mode9 = {9000000,
- m_porifor9,
- m_pmtlfor9,
- m_ewndfor9};
- return mode9;
- } break;
- case 6: {
- ThresholdsItem mode6 = {6000000,
- m_porifor6,
- 1.0,
- m_ewndfor6};
- return mode6;
- } break;
+ case 54:
+ {
+ ThresholdsItem mode54 = {
+ 54000000,
+ 0.0,
+ m_pmtlfor54,
+ m_ewndfor54
+ };
+ return mode54;
+ } break;
+ case 48:
+ {
+ ThresholdsItem mode48 = {
+ 48000000,
+ m_porifor48,
+ m_pmtlfor48,
+ m_ewndfor48
+ };
+ return mode48;
+ } break;
+ case 36:
+ {
+ ThresholdsItem mode36 = {
+ 36000000,
+ m_porifor36,
+ m_pmtlfor36,
+ m_ewndfor36
+ };
+ return mode36;
+ } break;
+ case 24:
+ {
+ ThresholdsItem mode24 = {
+ 24000000,
+ m_porifor24,
+ m_pmtlfor24,
+ m_ewndfor24
+ };
+ return mode24;
+ } break;
+ case 18:
+ {
+ ThresholdsItem mode18 = {
+ 18000000,
+ m_porifor18,
+ m_pmtlfor18,
+ m_ewndfor18
+ };
+ return mode18;
+ } break;
+ case 12:
+ {
+ ThresholdsItem mode12 = {
+ 12000000,
+ m_porifor12,
+ m_pmtlfor12,
+ m_ewndfor12
+ };
+ return mode12;
+ } break;
+ case 9:
+ {
+ ThresholdsItem mode9 = {
+ 9000000,
+ m_porifor9,
+ m_pmtlfor9,
+ m_ewndfor9
+ };
+ return mode9;
+ } break;
+ case 6:
+ {
+ ThresholdsItem mode6 = {
+ 6000000,
+ m_porifor6,
+ 1.0,
+ m_ewndfor6
+ };
+ return mode6;
+ } break;
}
- NS_ASSERT_MSG(false, "Thresholds for an unknown mode are asked (" << mode << ")");
+ NS_ASSERT_MSG (false, "Thresholds for an unknown mode are asked (" << mode << ")");
return ThresholdsItem ();
}
--- a/src/wifi/model/rraa-wifi-manager.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/rraa-wifi-manager.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -36,7 +36,7 @@
* by "Starsky H. Y. Wong", "Hao Yang", "Songwu Lu", and,
* "Vaduvur Bharghavan" published in Mobicom 06.
*/
-class RraaWifiManager : public WifiRemoteStationManager
+class RraaWifiManager : public WifiRemoteStationManager
{
public:
static TypeId GetTypeId (void);
@@ -45,8 +45,7 @@
virtual ~RraaWifiManager ();
private:
-
- struct ThresholdsItem
+ struct ThresholdsItem
{
uint32_t datarate;
double pori;
@@ -55,8 +54,8 @@
};
// overriden from base class
- virtual WifiRemoteStation *DoCreateStation (void) const;
- virtual void DoReportRxOk (WifiRemoteStation *station,
+ virtual WifiRemoteStation * DoCreateStation (void) const;
+ virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
virtual void DoReportRtsFailed (WifiRemoteStation *station);
virtual void DoReportDataFailed (WifiRemoteStation *station);
--- a/src/wifi/model/ssid.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/ssid.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -25,7 +25,7 @@
Ssid::Ssid ()
{
m_length = 0;
- for (uint8_t i = 0; i < 33; i++)
+ for (uint8_t i = 0; i < 33; i++)
{
m_ssid[i] = 0;
}
@@ -35,7 +35,7 @@
NS_ASSERT (s.size () < 32);
const char *ssid = s.c_str ();
uint8_t len = 0;
- while (*ssid != 0 && len < 32)
+ while (*ssid != 0 && len < 32)
{
m_ssid[len] = *ssid;
ssid++;
@@ -43,7 +43,7 @@
}
NS_ASSERT (len <= 32);
m_length = len;
- while (len < 33)
+ while (len < 33)
{
m_ssid[len] = 0;
len++;
@@ -53,38 +53,38 @@
{
NS_ASSERT (length <= 32);
uint8_t len = 0;
- while (len < length)
+ while (len < length)
{
m_ssid[len] = ssid[len];
len++;
}
m_length = length;
- while (len < 33)
+ while (len < 33)
{
m_ssid[len] = 0;
len++;
}
}
-bool
+bool
Ssid::IsEqual (const Ssid& o) const
{
uint8_t i = 0;
- while (i < 32 &&
- m_ssid[i] == o.m_ssid[i] &&
- m_ssid[i] != 0)
+ while (i < 32
+ && m_ssid[i] == o.m_ssid[i]
+ && m_ssid[i] != 0)
{
i++;
}
- if (m_ssid[i] != o.m_ssid[i])
+ if (m_ssid[i] != o.m_ssid[i])
{
return false;
}
return true;
}
-bool
+bool
Ssid::IsBroadcast (void) const
{
- if (m_ssid[0] == 0)
+ if (m_ssid[0] == 0)
{
return true;
}
@@ -119,7 +119,7 @@
}
uint8_t
Ssid::DeserializeInformationField (Buffer::Iterator start,
- uint8_t length)
+ uint8_t length)
{
m_length = length;
NS_ASSERT (m_length <= 32);
--- a/src/wifi/model/ssid.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/ssid.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -43,13 +43,13 @@
bool IsEqual (const Ssid& o) const;
bool IsBroadcast (void) const;
- char *PeekString (void) const;
+ char* PeekString (void) const;
WifiInformationElementId ElementId () const;
uint8_t GetInformationFieldSize () const;
void SerializeInformationField (Buffer::Iterator start) const;
uint8_t DeserializeInformationField (Buffer::Iterator start,
- uint8_t length);
+ uint8_t length);
private:
uint8_t m_ssid[33];
--- a/src/wifi/model/sta-wifi-mac.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/sta-wifi-mac.cc Sat May 07 21:49:46 2011 +0200
@@ -211,7 +211,8 @@
StaWifiMac::TryToEnsureAssociated (void)
{
NS_LOG_FUNCTION (this);
- switch (m_state) {
+ switch (m_state)
+ {
case ASSOCIATED:
return;
break;
@@ -283,8 +284,8 @@
{
NS_LOG_FUNCTION (this << delay);
m_beaconWatchdogEnd = std::max (Simulator::Now () + delay, m_beaconWatchdogEnd);
- if (Simulator::GetDelayLeft (m_beaconWatchdog) < delay &&
- m_beaconWatchdog.IsExpired ())
+ if (Simulator::GetDelayLeft (m_beaconWatchdog) < delay
+ && m_beaconWatchdog.IsExpired ())
{
NS_LOG_DEBUG ("really restart watchdog.");
m_beaconWatchdog = Simulator::Schedule (delay, &StaWifiMac::MissedBeacons, this);
@@ -379,8 +380,8 @@
NS_LOG_LOGIC ("packet sent by us.");
return;
}
- else if (hdr->GetAddr1 () != GetAddress () &&
- !hdr->GetAddr1 ().IsGroup ())
+ else if (hdr->GetAddr1 () != GetAddress ()
+ && !hdr->GetAddr1 ().IsGroup ())
{
NS_LOG_LOGIC ("packet is not for us");
NotifyRxDrop (packet);
@@ -426,8 +427,8 @@
}
return;
}
- else if (hdr->IsProbeReq () ||
- hdr->IsAssocReq ())
+ else if (hdr->IsProbeReq ()
+ || hdr->IsAssocReq ())
{
// This is a frame aimed at an AP, so we can safely ignore it.
NotifyRxDrop (packet);
@@ -438,8 +439,8 @@
MgtBeaconHeader beacon;
packet->RemoveHeader (beacon);
bool goodBeacon = false;
- if (GetSsid ().IsBroadcast () ||
- beacon.GetSsid ().IsEqual (GetSsid ()))
+ if (GetSsid ().IsBroadcast ()
+ || beacon.GetSsid ().IsEqual (GetSsid ()))
{
goodBeacon = true;
}
@@ -545,13 +546,13 @@
void
StaWifiMac::SetState (MacState value)
{
- if (value == ASSOCIATED &&
- m_state != ASSOCIATED)
+ if (value == ASSOCIATED
+ && m_state != ASSOCIATED)
{
m_assocLogger (GetBssid ());
}
- else if (value != ASSOCIATED &&
- m_state == ASSOCIATED)
+ else if (value != ASSOCIATED
+ && m_state == ASSOCIATED)
{
m_deAssocLogger (GetBssid ());
}
--- a/src/wifi/model/sta-wifi-mac.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/sta-wifi-mac.h Sat May 07 21:49:46 2011 +0200
@@ -36,8 +36,8 @@
class MgtAddBaRequestHeader;
/**
- * \ingroup wifi
- *
+ * \ingroup wifi
+ *
* The Wifi MAC high model for a non-AP STA in a BSS.
*/
class StaWifiMac : public RegularWifiMac
@@ -84,7 +84,8 @@
void StartActiveAssociation (void);
private:
- enum MacState {
+ enum MacState
+ {
ASSOCIATED,
WAIT_PROBE_RESP,
WAIT_ASSOC_RESP,
--- a/src/wifi/model/status-code.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/status-code.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -25,35 +25,36 @@
namespace ns3 {
StatusCode::StatusCode ()
-{}
-void
+{
+}
+void
StatusCode::SetSuccess (void)
{
m_code = 0;
}
-void
+void
StatusCode::SetFailure (void)
{
m_code = 1;
}
-bool
+bool
StatusCode::IsSuccess (void) const
{
return (m_code == 0);
}
-uint32_t
+uint32_t
StatusCode::GetSerializedSize (void) const
{
return 2;
}
-Buffer::Iterator
+Buffer::Iterator
StatusCode::Serialize (Buffer::Iterator start) const
{
start.WriteHtolsbU16 (m_code);
return start;
}
-Buffer::Iterator
+Buffer::Iterator
StatusCode::Deserialize (Buffer::Iterator start)
{
m_code = start.ReadLsbtohU16 ();
--- a/src/wifi/model/status-code.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/status-code.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -26,7 +26,8 @@
namespace ns3 {
-class StatusCode {
+class StatusCode
+{
public:
StatusCode ();
void SetSuccess (void);
--- a/src/wifi/model/supported-rates.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/supported-rates.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -27,10 +27,12 @@
namespace ns3 {
SupportedRates::SupportedRates ()
- : extended (this), m_nRates (0)
-{}
+ : extended (this),
+ m_nRates (0)
+{
+}
-void
+void
SupportedRates::AddSupportedRate (uint32_t bs)
{
NS_ASSERT (m_nRates < MAX_SUPPORTED_RATES);
@@ -38,11 +40,11 @@
{
return;
}
- m_rates[m_nRates] = bs/500000;
+ m_rates[m_nRates] = bs / 500000;
m_nRates++;
- NS_LOG_DEBUG ("add rate="<<bs<<", n rates="<<(uint32_t)m_nRates);
+ NS_LOG_DEBUG ("add rate=" << bs << ", n rates=" << (uint32_t)m_nRates);
}
-void
+void
SupportedRates::SetBasicRate (uint32_t bs)
{
uint8_t rate = bs / 500000;
@@ -54,7 +56,7 @@
}
if (rate == m_rates[i])
{
- NS_LOG_DEBUG ("set basic rate="<<bs<<", n rates="<<(uint32_t)m_nRates);
+ NS_LOG_DEBUG ("set basic rate=" << bs << ", n rates=" << (uint32_t)m_nRates);
m_rates[i] |= 0x80;
return;
}
@@ -62,7 +64,7 @@
AddSupportedRate (bs);
SetBasicRate (bs);
}
-bool
+bool
SupportedRates::IsBasicRate (uint32_t bs) const
{
uint8_t rate = (bs / 500000) | 0x80;
@@ -75,29 +77,29 @@
}
return false;
}
-bool
+bool
SupportedRates::IsSupportedRate (uint32_t bs) const
{
uint8_t rate = bs / 500000;
- for (uint8_t i = 0; i < m_nRates; i++)
+ for (uint8_t i = 0; i < m_nRates; i++)
{
- if (rate == m_rates[i] ||
- (rate|0x80) == m_rates[i])
+ if (rate == m_rates[i]
+ || (rate | 0x80) == m_rates[i])
{
return true;
}
}
return false;
}
-uint8_t
+uint8_t
SupportedRates::GetNRates (void) const
{
return m_nRates;
}
-uint32_t
+uint32_t
SupportedRates::GetRate (uint8_t i) const
{
- return (m_rates[i]&0x7f) * 500000;
+ return (m_rates[i] & 0x7f) * 500000;
}
WifiInformationElementId
@@ -123,7 +125,7 @@
}
uint8_t
SupportedRates::DeserializeInformationField (Buffer::Iterator start,
- uint8_t length)
+ uint8_t length)
{
NS_ASSERT (length <= 8);
m_nRates = length;
@@ -132,7 +134,8 @@
}
ExtendedSupportedRatesIE::ExtendedSupportedRatesIE ()
-{}
+{
+}
ExtendedSupportedRatesIE::ExtendedSupportedRatesIE (SupportedRates *sr)
{
@@ -153,7 +156,7 @@
// overriding the GetSerializedSize() method, so if this function is
// invoked in that case then it indicates a programming error. Hence
// we have an assertion on that condition.
- NS_ASSERT(m_supportedRates->m_nRates > 8);
+ NS_ASSERT (m_supportedRates->m_nRates > 8);
// The number of rates we have beyond the initial 8 is the size of
// the information field.
@@ -170,7 +173,7 @@
// Our overridden version of the Serialize() method should ensure
// that this routine is never invoked in that case (by ensuring that
// WifiInformationElement::Serialize() is not invoked).
- NS_ASSERT(m_supportedRates->m_nRates > 8);
+ NS_ASSERT (m_supportedRates->m_nRates > 8);
start.Write (m_supportedRates->m_rates + 8, m_supportedRates->m_nRates - 8);
}
--- a/src/wifi/model/supported-rates.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/supported-rates.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -49,7 +49,8 @@
* instance of \c ExtendedSupportedRatesIE lies within \c
* SupportedRates.
*/
-class ExtendedSupportedRatesIE : public WifiInformationElement {
+class ExtendedSupportedRatesIE : public WifiInformationElement
+{
public:
ExtendedSupportedRatesIE ();
ExtendedSupportedRatesIE (SupportedRates *rates);
@@ -88,7 +89,8 @@
* The \c ExtendedSupportedRatesIE class (of which an instance exists
* in objects of this class) deals with rates beyond the first 8.
*/
-class SupportedRates : public WifiInformationElement {
+class SupportedRates : public WifiInformationElement
+{
public:
SupportedRates ();
@@ -105,7 +107,7 @@
uint8_t GetInformationFieldSize () const;
void SerializeInformationField (Buffer::Iterator start) const;
uint8_t DeserializeInformationField (Buffer::Iterator start,
- uint8_t length);
+ uint8_t length);
/*
* We support the Extended Supported Rates Information Element
--- a/src/wifi/model/wifi-channel.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-channel.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2006,2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -37,12 +37,12 @@
NS_OBJECT_ENSURE_REGISTERED (WifiChannel);
-TypeId
+TypeId
WifiChannel::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::WifiChannel")
.SetParent<Channel> ()
- ;
+ ;
return tid;
}
--- a/src/wifi/model/wifi-channel.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-channel.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2006,2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -33,7 +33,7 @@
* \ingroup wifi
*
* This class works in tandem with the ns3::WifiPhy class. If you want to
- * provide a new Wifi PHY layer, you have to subclass both ns3::WifiChannel
+ * provide a new Wifi PHY layer, you have to subclass both ns3::WifiChannel
* and ns3::WifiPhy.
*
* Typically, MyWifiChannel will define a Send method whose job is to distribute
--- a/src/wifi/model/wifi-information-element-vector.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-information-element-vector.cc Sat May 07 21:49:46 2011 +0200
@@ -26,8 +26,8 @@
NS_OBJECT_ENSURE_REGISTERED (WifiInformationElementVector);
-WifiInformationElementVector::WifiInformationElementVector () :
- m_maxSize (1500)
+WifiInformationElementVector::WifiInformationElementVector ()
+ : m_maxSize (1500)
{
}
WifiInformationElementVector::~WifiInformationElementVector ()
@@ -42,8 +42,8 @@
WifiInformationElementVector::GetTypeId ()
{
static TypeId tid = TypeId ("ns3::WifiInformationElementVector")
- .SetParent<Header> ()
- .AddConstructor<WifiInformationElementVector> ();
+ .SetParent<Header> ()
+ .AddConstructor<WifiInformationElementVector> ();
return tid;
}
TypeId
@@ -59,7 +59,7 @@
void
WifiInformationElementVector::Serialize (Buffer::Iterator start) const
{
- for(IE_VECTOR::const_iterator i = m_elements.begin (); i != m_elements.end (); i ++)
+ for (IE_VECTOR::const_iterator i = m_elements.begin (); i != m_elements.end (); i++)
{
start = (*i)->Serialize (start);
}
@@ -68,17 +68,17 @@
WifiInformationElementVector::Deserialize (Buffer::Iterator start)
{
Buffer::Iterator i = start;
- uint32_t size = start.GetSize();
+ uint32_t size = start.GetSize ();
while (size > 0)
{
- uint32_t deserialized = DeserializeSingleIe(i);
+ uint32_t deserialized = DeserializeSingleIe (i);
i.Next (deserialized);
size -= deserialized;
}
- return i.GetDistanceFrom(start);
+ return i.GetDistanceFrom (start);
}
uint32_t
-WifiInformationElementVector::DeserializeSingleIe(Buffer::Iterator start)
+WifiInformationElementVector::DeserializeSingleIe (Buffer::Iterator start)
{
Buffer::Iterator i = start;
uint8_t id = i.ReadU8 ();
@@ -97,10 +97,10 @@
newElement->DeserializeInformationField (i, length);
i.Next (length);
m_elements.push_back (newElement);
- return i.GetDistanceFrom(start);
+ return i.GetDistanceFrom (start);
}
void
-WifiInformationElementVector::Print(std::ostream & os) const
+WifiInformationElementVector::Print (std::ostream & os) const
{
//TODO
}
@@ -167,7 +167,7 @@
{
if (m_elements.size () != a.m_elements.size ())
{
- NS_ASSERT(false);
+ NS_ASSERT (false);
return false;
}
// In principle we could bypass some of the faffing about (and speed
@@ -179,10 +179,12 @@
// flexible equality operators.
WifiInformationElementVector::IE_VECTOR::const_iterator j = a.m_elements.begin ();
for (WifiInformationElementVector::IE_VECTOR::const_iterator i = m_elements.begin (); i
- != m_elements.end (); i++, j++)
+ != m_elements.end (); i++, j++)
{
if (!(*(*i) == *(*j)))
- return false;
+ {
+ return false;
+ }
}
return true;
--- a/src/wifi/model/wifi-information-element-vector.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-information-element-vector.h Sat May 07 21:49:46 2011 +0200
@@ -34,7 +34,7 @@
* \brief Information element vector
* \ingroup wifi
*
- * Implements a vector of WifiInformationElements.
+ * Implements a vector of WifiInformationElements.
* Information elements typically come in groups, and the
* WifiInformationElementVector class provides a representation of a
* series of IEs, and the facility for serialisation to and
--- a/src/wifi/model/wifi-information-element.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-information-element.cc Sat May 07 21:49:46 2011 +0200
@@ -23,18 +23,20 @@
namespace ns3 {
WifiInformationElement::~WifiInformationElement ()
-{}
+{
+}
void
WifiInformationElement::Print (std::ostream &os) const
-{}
+{
+}
uint16_t
WifiInformationElement::GetSerializedSize () const
{
return (2 + GetInformationFieldSize ());
}
-
+
Buffer::Iterator
WifiInformationElement::Serialize (Buffer::Iterator i) const
{
@@ -82,28 +84,32 @@
bool
WifiInformationElement::operator< (WifiInformationElement const & a) const
{
- return (ElementId () < a.ElementId ());
+ return (ElementId () < a.ElementId ());
}
bool
WifiInformationElement::operator== (WifiInformationElement const & a) const
{
- if (ElementId () != a.ElementId ())
- return false;
+ if (ElementId () != a.ElementId ())
+ {
+ return false;
+ }
- if (GetInformationFieldSize () != a.GetInformationFieldSize ())
- return false;
-
- uint32_t ieSize = GetInformationFieldSize ();
+ if (GetInformationFieldSize () != a.GetInformationFieldSize ())
+ {
+ return false;
+ }
- Buffer myIe, hisIe;
- myIe.AddAtEnd (ieSize);
- hisIe.AddAtEnd (ieSize);
+ uint32_t ieSize = GetInformationFieldSize ();
- SerializeInformationField (myIe.Begin ());
- a.SerializeInformationField (hisIe.Begin ());
+ Buffer myIe, hisIe;
+ myIe.AddAtEnd (ieSize);
+ hisIe.AddAtEnd (ieSize);
- return (memcmp(myIe.PeekData (), hisIe.PeekData (), ieSize) == 0);
+ SerializeInformationField (myIe.Begin ());
+ a.SerializeInformationField (hisIe.Begin ());
+
+ return (memcmp (myIe.PeekData (), hisIe.PeekData (), ieSize) == 0);
}
}
--- a/src/wifi/model/wifi-mac-header.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-mac-header.cc Sat May 07 21:49:46 2011 +0200
@@ -27,13 +27,15 @@
NS_OBJECT_ENSURE_REGISTERED (WifiMacHeader);
-enum {
+enum
+{
TYPE_MGT = 0,
TYPE_CTL = 1,
TYPE_DATA = 2
};
-enum {
+enum
+{
SUBTYPE_CTL_BACKREQ = 8,
SUBTYPE_CTL_BACKRESP = 9,
SUBTYPE_CTL_RTS = 11,
@@ -47,76 +49,78 @@
m_ctrlWep (0),
m_ctrlOrder (1),
m_amsduPresent (0)
-{}
+{
+}
WifiMacHeader::~WifiMacHeader ()
-{}
+{
+}
-void
+void
WifiMacHeader::SetDsFrom (void)
{
m_ctrlFromDs = 1;
}
-void
+void
WifiMacHeader::SetDsNotFrom (void)
{
m_ctrlFromDs = 0;
}
-void
+void
WifiMacHeader::SetDsTo (void)
{
m_ctrlToDs = 1;
}
-void
+void
WifiMacHeader::SetDsNotTo (void)
{
m_ctrlToDs = 0;
}
-void
+void
WifiMacHeader::SetAddr1 (Mac48Address address)
{
m_addr1 = address;
}
-void
+void
WifiMacHeader::SetAddr2 (Mac48Address address)
{
m_addr2 = address;
}
-void
+void
WifiMacHeader::SetAddr3 (Mac48Address address)
{
m_addr3 = address;
}
-void
+void
WifiMacHeader::SetAddr4 (Mac48Address address)
{
m_addr4 = address;
}
-void
+void
WifiMacHeader::SetAssocReq (void)
{
m_ctrlType = TYPE_MGT;
m_ctrlSubtype = 0;
}
-void
+void
WifiMacHeader::SetAssocResp (void)
{
m_ctrlType = TYPE_MGT;
m_ctrlSubtype = 1;
}
-void
+void
WifiMacHeader::SetProbeReq (void)
{
m_ctrlType = TYPE_MGT;
m_ctrlSubtype = 4;
}
-void
+void
WifiMacHeader::SetProbeResp (void)
{
m_ctrlType = TYPE_MGT;
m_ctrlSubtype = 5;
}
-void
+void
WifiMacHeader::SetBeacon (void)
{
m_ctrlType = TYPE_MGT;
@@ -135,7 +139,7 @@
m_ctrlSubtype = 9;
}
-void
+void
WifiMacHeader::SetTypeData (void)
{
m_ctrlType = TYPE_DATA;
@@ -144,159 +148,160 @@
void
WifiMacHeader::SetAction (void)
{
- m_ctrlType = TYPE_MGT;
- m_ctrlSubtype = 0x0D;
+ m_ctrlType = TYPE_MGT;
+ m_ctrlSubtype = 0x0D;
}
void
WifiMacHeader::SetMultihopAction (void)
{
- m_ctrlType = TYPE_MGT;
- m_ctrlSubtype = 0x0F;
+ m_ctrlType = TYPE_MGT;
+ m_ctrlSubtype = 0x0F;
}
-void
+void
WifiMacHeader::SetType (enum WifiMacType type)
{
- switch (type) {
- case WIFI_MAC_CTL_BACKREQ:
- m_ctrlType = TYPE_CTL;
- m_ctrlSubtype = SUBTYPE_CTL_BACKREQ;
- break;
- case WIFI_MAC_CTL_BACKRESP:
- m_ctrlType = TYPE_CTL;
- m_ctrlSubtype = SUBTYPE_CTL_BACKRESP;
- break;
- case WIFI_MAC_CTL_RTS:
- m_ctrlType = TYPE_CTL;
- m_ctrlSubtype = SUBTYPE_CTL_RTS;
- break;
- case WIFI_MAC_CTL_CTS:
- m_ctrlType = TYPE_CTL;
- m_ctrlSubtype = SUBTYPE_CTL_CTS;
- break;
- case WIFI_MAC_CTL_ACK:
- m_ctrlType = TYPE_CTL;
- m_ctrlSubtype = SUBTYPE_CTL_ACK;
- break;
- case WIFI_MAC_MGT_ASSOCIATION_REQUEST:
- m_ctrlType = TYPE_MGT;
- m_ctrlSubtype = 0;
- break;
- case WIFI_MAC_MGT_ASSOCIATION_RESPONSE:
- m_ctrlType = TYPE_MGT;
- m_ctrlSubtype = 1;
- break;
- case WIFI_MAC_MGT_REASSOCIATION_REQUEST:
- m_ctrlType = TYPE_MGT;
- m_ctrlSubtype = 2;
- break;
- case WIFI_MAC_MGT_REASSOCIATION_RESPONSE:
- m_ctrlType = TYPE_MGT;
- m_ctrlSubtype = 3;
- break;
- case WIFI_MAC_MGT_PROBE_REQUEST:
- m_ctrlType = TYPE_MGT;
- m_ctrlSubtype = 4;
- break;
- case WIFI_MAC_MGT_PROBE_RESPONSE:
- m_ctrlType = TYPE_MGT;
- m_ctrlSubtype = 5;
- break;
- case WIFI_MAC_MGT_BEACON:
- m_ctrlType = TYPE_MGT;
- m_ctrlSubtype = 8;
- break;
- case WIFI_MAC_MGT_DISASSOCIATION:
- m_ctrlType = TYPE_MGT;
- m_ctrlSubtype = 10;
- break;
- case WIFI_MAC_MGT_AUTHENTICATION:
- m_ctrlType = TYPE_MGT;
- m_ctrlSubtype = 11;
- break;
- case WIFI_MAC_MGT_DEAUTHENTICATION:
- m_ctrlType = TYPE_MGT;
- m_ctrlSubtype = 12;
- case WIFI_MAC_MGT_ACTION:
- m_ctrlType = TYPE_MGT;
- m_ctrlSubtype = 13;
- case WIFI_MAC_MGT_ACTION_NO_ACK:
- m_ctrlType = TYPE_MGT;
- m_ctrlSubtype = 14;
- case WIFI_MAC_MGT_MULTIHOP_ACTION:
- m_ctrlType = TYPE_MGT;
- m_ctrlSubtype = 15;
- break;
+ switch (type)
+ {
+ case WIFI_MAC_CTL_BACKREQ:
+ m_ctrlType = TYPE_CTL;
+ m_ctrlSubtype = SUBTYPE_CTL_BACKREQ;
+ break;
+ case WIFI_MAC_CTL_BACKRESP:
+ m_ctrlType = TYPE_CTL;
+ m_ctrlSubtype = SUBTYPE_CTL_BACKRESP;
+ break;
+ case WIFI_MAC_CTL_RTS:
+ m_ctrlType = TYPE_CTL;
+ m_ctrlSubtype = SUBTYPE_CTL_RTS;
+ break;
+ case WIFI_MAC_CTL_CTS:
+ m_ctrlType = TYPE_CTL;
+ m_ctrlSubtype = SUBTYPE_CTL_CTS;
+ break;
+ case WIFI_MAC_CTL_ACK:
+ m_ctrlType = TYPE_CTL;
+ m_ctrlSubtype = SUBTYPE_CTL_ACK;
+ break;
+ case WIFI_MAC_MGT_ASSOCIATION_REQUEST:
+ m_ctrlType = TYPE_MGT;
+ m_ctrlSubtype = 0;
+ break;
+ case WIFI_MAC_MGT_ASSOCIATION_RESPONSE:
+ m_ctrlType = TYPE_MGT;
+ m_ctrlSubtype = 1;
+ break;
+ case WIFI_MAC_MGT_REASSOCIATION_REQUEST:
+ m_ctrlType = TYPE_MGT;
+ m_ctrlSubtype = 2;
+ break;
+ case WIFI_MAC_MGT_REASSOCIATION_RESPONSE:
+ m_ctrlType = TYPE_MGT;
+ m_ctrlSubtype = 3;
+ break;
+ case WIFI_MAC_MGT_PROBE_REQUEST:
+ m_ctrlType = TYPE_MGT;
+ m_ctrlSubtype = 4;
+ break;
+ case WIFI_MAC_MGT_PROBE_RESPONSE:
+ m_ctrlType = TYPE_MGT;
+ m_ctrlSubtype = 5;
+ break;
+ case WIFI_MAC_MGT_BEACON:
+ m_ctrlType = TYPE_MGT;
+ m_ctrlSubtype = 8;
+ break;
+ case WIFI_MAC_MGT_DISASSOCIATION:
+ m_ctrlType = TYPE_MGT;
+ m_ctrlSubtype = 10;
+ break;
+ case WIFI_MAC_MGT_AUTHENTICATION:
+ m_ctrlType = TYPE_MGT;
+ m_ctrlSubtype = 11;
+ break;
+ case WIFI_MAC_MGT_DEAUTHENTICATION:
+ m_ctrlType = TYPE_MGT;
+ m_ctrlSubtype = 12;
+ case WIFI_MAC_MGT_ACTION:
+ m_ctrlType = TYPE_MGT;
+ m_ctrlSubtype = 13;
+ case WIFI_MAC_MGT_ACTION_NO_ACK:
+ m_ctrlType = TYPE_MGT;
+ m_ctrlSubtype = 14;
+ case WIFI_MAC_MGT_MULTIHOP_ACTION:
+ m_ctrlType = TYPE_MGT;
+ m_ctrlSubtype = 15;
+ break;
- case WIFI_MAC_DATA:
- m_ctrlType = TYPE_DATA;
- m_ctrlSubtype = 0;
- break;
- case WIFI_MAC_DATA_CFACK:
- m_ctrlType = TYPE_DATA;
- m_ctrlSubtype = 1;
- break;
- case WIFI_MAC_DATA_CFPOLL:
- m_ctrlType = TYPE_DATA;
- m_ctrlSubtype = 2;
- break;
- case WIFI_MAC_DATA_CFACK_CFPOLL:
- m_ctrlType = TYPE_DATA;
- m_ctrlSubtype = 3;
- break;
- case WIFI_MAC_DATA_NULL:
- m_ctrlType = TYPE_DATA;
- m_ctrlSubtype = 4;
- break;
- case WIFI_MAC_DATA_NULL_CFACK:
- m_ctrlType = TYPE_DATA;
- m_ctrlSubtype = 5;
- break;
- case WIFI_MAC_DATA_NULL_CFPOLL:
- m_ctrlType = TYPE_DATA;
- m_ctrlSubtype = 6;
- break;
- case WIFI_MAC_DATA_NULL_CFACK_CFPOLL:
- m_ctrlType = TYPE_DATA;
- m_ctrlSubtype = 7;
- break;
- case WIFI_MAC_QOSDATA:
- m_ctrlType = TYPE_DATA;
- m_ctrlSubtype = 8;
- break;
- case WIFI_MAC_QOSDATA_CFACK:
- m_ctrlType = TYPE_DATA;
- m_ctrlSubtype = 9;
- break;
- case WIFI_MAC_QOSDATA_CFPOLL:
- m_ctrlType = TYPE_DATA;
- m_ctrlSubtype = 10;
- break;
- case WIFI_MAC_QOSDATA_CFACK_CFPOLL:
- m_ctrlType = TYPE_DATA;
- m_ctrlSubtype = 11;
- break;
- case WIFI_MAC_QOSDATA_NULL:
- m_ctrlType = TYPE_DATA;
- m_ctrlSubtype = 12;
- break;
- case WIFI_MAC_QOSDATA_NULL_CFPOLL:
- m_ctrlType = TYPE_DATA;
- m_ctrlSubtype = 14;
- break;
- case WIFI_MAC_QOSDATA_NULL_CFACK_CFPOLL:
- m_ctrlType = TYPE_DATA;
- m_ctrlSubtype = 15;
- break;
- }
+ case WIFI_MAC_DATA:
+ m_ctrlType = TYPE_DATA;
+ m_ctrlSubtype = 0;
+ break;
+ case WIFI_MAC_DATA_CFACK:
+ m_ctrlType = TYPE_DATA;
+ m_ctrlSubtype = 1;
+ break;
+ case WIFI_MAC_DATA_CFPOLL:
+ m_ctrlType = TYPE_DATA;
+ m_ctrlSubtype = 2;
+ break;
+ case WIFI_MAC_DATA_CFACK_CFPOLL:
+ m_ctrlType = TYPE_DATA;
+ m_ctrlSubtype = 3;
+ break;
+ case WIFI_MAC_DATA_NULL:
+ m_ctrlType = TYPE_DATA;
+ m_ctrlSubtype = 4;
+ break;
+ case WIFI_MAC_DATA_NULL_CFACK:
+ m_ctrlType = TYPE_DATA;
+ m_ctrlSubtype = 5;
+ break;
+ case WIFI_MAC_DATA_NULL_CFPOLL:
+ m_ctrlType = TYPE_DATA;
+ m_ctrlSubtype = 6;
+ break;
+ case WIFI_MAC_DATA_NULL_CFACK_CFPOLL:
+ m_ctrlType = TYPE_DATA;
+ m_ctrlSubtype = 7;
+ break;
+ case WIFI_MAC_QOSDATA:
+ m_ctrlType = TYPE_DATA;
+ m_ctrlSubtype = 8;
+ break;
+ case WIFI_MAC_QOSDATA_CFACK:
+ m_ctrlType = TYPE_DATA;
+ m_ctrlSubtype = 9;
+ break;
+ case WIFI_MAC_QOSDATA_CFPOLL:
+ m_ctrlType = TYPE_DATA;
+ m_ctrlSubtype = 10;
+ break;
+ case WIFI_MAC_QOSDATA_CFACK_CFPOLL:
+ m_ctrlType = TYPE_DATA;
+ m_ctrlSubtype = 11;
+ break;
+ case WIFI_MAC_QOSDATA_NULL:
+ m_ctrlType = TYPE_DATA;
+ m_ctrlSubtype = 12;
+ break;
+ case WIFI_MAC_QOSDATA_NULL_CFPOLL:
+ m_ctrlType = TYPE_DATA;
+ m_ctrlSubtype = 14;
+ break;
+ case WIFI_MAC_QOSDATA_NULL_CFACK_CFPOLL:
+ m_ctrlType = TYPE_DATA;
+ m_ctrlSubtype = 15;
+ break;
+ }
m_ctrlToDs = 0;
m_ctrlFromDs = 0;
}
-void
+void
WifiMacHeader::SetRawDuration (uint16_t duration)
{
m_duration = duration;
}
-void
+void
WifiMacHeader::SetDuration (Time duration)
{
int64_t duration_us = duration.GetMicroSeconds ();
@@ -346,20 +351,21 @@
}
void WifiMacHeader::SetQosAckPolicy (enum QosAckPolicy policy)
{
- switch (policy) {
- case NORMAL_ACK :
- m_qosAckPolicy = 0;
- break;
- case NO_ACK :
- m_qosAckPolicy = 1;
- break;
- case NO_EXPLICIT_ACK :
- m_qosAckPolicy = 2;
- break;
- case BLOCK_ACK :
- m_qosAckPolicy = 3;
- break;
- }
+ switch (policy)
+ {
+ case NORMAL_ACK:
+ m_qosAckPolicy = 0;
+ break;
+ case NO_ACK:
+ m_qosAckPolicy = 1;
+ break;
+ case NO_EXPLICIT_ACK:
+ m_qosAckPolicy = 2;
+ break;
+ case BLOCK_ACK:
+ m_qosAckPolicy = 3;
+ break;
+ }
}
void
WifiMacHeader::SetQosNormalAck ()
@@ -389,261 +395,266 @@
m_qosStuff = txop;
}
-Mac48Address
+Mac48Address
WifiMacHeader::GetAddr1 (void) const
{
return m_addr1;
}
-Mac48Address
+Mac48Address
WifiMacHeader::GetAddr2 (void) const
{
return m_addr2;
}
-Mac48Address
+Mac48Address
WifiMacHeader::GetAddr3 (void) const
{
return m_addr3;
}
-Mac48Address
+Mac48Address
WifiMacHeader::GetAddr4 (void) const
{
return m_addr4;
}
-enum WifiMacType
+enum WifiMacType
WifiMacHeader::GetType (void) const
{
- switch (m_ctrlType) {
- case TYPE_MGT:
- switch (m_ctrlSubtype) {
- case 0:
- return WIFI_MAC_MGT_ASSOCIATION_REQUEST;
- break;
- case 1:
- return WIFI_MAC_MGT_ASSOCIATION_RESPONSE;
- break;
- case 2:
- return WIFI_MAC_MGT_REASSOCIATION_REQUEST;
- break;
- case 3:
- return WIFI_MAC_MGT_REASSOCIATION_RESPONSE;
- break;
- case 4:
- return WIFI_MAC_MGT_PROBE_REQUEST;
- break;
- case 5:
- return WIFI_MAC_MGT_PROBE_RESPONSE;
- break;
- case 8:
- return WIFI_MAC_MGT_BEACON;
- break;
- case 10:
- return WIFI_MAC_MGT_DISASSOCIATION;
- break;
- case 11:
- return WIFI_MAC_MGT_AUTHENTICATION;
+ switch (m_ctrlType)
+ {
+ case TYPE_MGT:
+ switch (m_ctrlSubtype)
+ {
+ case 0:
+ return WIFI_MAC_MGT_ASSOCIATION_REQUEST;
+ break;
+ case 1:
+ return WIFI_MAC_MGT_ASSOCIATION_RESPONSE;
+ break;
+ case 2:
+ return WIFI_MAC_MGT_REASSOCIATION_REQUEST;
+ break;
+ case 3:
+ return WIFI_MAC_MGT_REASSOCIATION_RESPONSE;
+ break;
+ case 4:
+ return WIFI_MAC_MGT_PROBE_REQUEST;
+ break;
+ case 5:
+ return WIFI_MAC_MGT_PROBE_RESPONSE;
+ break;
+ case 8:
+ return WIFI_MAC_MGT_BEACON;
+ break;
+ case 10:
+ return WIFI_MAC_MGT_DISASSOCIATION;
+ break;
+ case 11:
+ return WIFI_MAC_MGT_AUTHENTICATION;
+ break;
+ case 12:
+ return WIFI_MAC_MGT_DEAUTHENTICATION;
+ break;
+ case 13:
+ return WIFI_MAC_MGT_ACTION;
+ break;
+ case 14:
+ return WIFI_MAC_MGT_ACTION_NO_ACK;
+ break;
+ case 15:
+ return WIFI_MAC_MGT_MULTIHOP_ACTION;
+ break;
+
+ }
break;
- case 12:
- return WIFI_MAC_MGT_DEAUTHENTICATION;
- break;
- case 13:
- return WIFI_MAC_MGT_ACTION;
+ case TYPE_CTL:
+ switch (m_ctrlSubtype)
+ {
+ case SUBTYPE_CTL_BACKREQ:
+ return WIFI_MAC_CTL_BACKREQ;
+ break;
+ case SUBTYPE_CTL_BACKRESP:
+ return WIFI_MAC_CTL_BACKRESP;
+ break;
+ case SUBTYPE_CTL_RTS:
+ return WIFI_MAC_CTL_RTS;
+ break;
+ case SUBTYPE_CTL_CTS:
+ return WIFI_MAC_CTL_CTS;
+ break;
+ case SUBTYPE_CTL_ACK:
+ return WIFI_MAC_CTL_ACK;
+ break;
+ }
break;
- case 14:
- return WIFI_MAC_MGT_ACTION_NO_ACK;
- break;
- case 15:
- return WIFI_MAC_MGT_MULTIHOP_ACTION;
- break;
+ case TYPE_DATA:
+ switch (m_ctrlSubtype)
+ {
+ case 0:
+ return WIFI_MAC_DATA;
+ break;
+ case 1:
+ return WIFI_MAC_DATA_CFACK;
+ break;
+ case 2:
+ return WIFI_MAC_DATA_CFPOLL;
+ break;
+ case 3:
+ return WIFI_MAC_DATA_CFACK_CFPOLL;
+ break;
+ case 4:
+ return WIFI_MAC_DATA_NULL;
+ break;
+ case 5:
+ return WIFI_MAC_DATA_NULL_CFACK;
+ break;
+ case 6:
+ return WIFI_MAC_DATA_NULL_CFPOLL;
+ break;
+ case 7:
+ return WIFI_MAC_DATA_NULL_CFACK_CFPOLL;
+ break;
+ case 8:
+ return WIFI_MAC_QOSDATA;
+ break;
+ case 9:
+ return WIFI_MAC_QOSDATA_CFACK;
+ break;
+ case 10:
+ return WIFI_MAC_QOSDATA_CFPOLL;
+ break;
+ case 11:
+ return WIFI_MAC_QOSDATA_CFACK_CFPOLL;
+ break;
+ case 12:
+ return WIFI_MAC_QOSDATA_NULL;
+ break;
+ case 14:
+ return WIFI_MAC_QOSDATA_NULL_CFPOLL;
+ break;
+ case 15:
+ return WIFI_MAC_QOSDATA_NULL_CFACK_CFPOLL;
+ break;
- }
- break;
- case TYPE_CTL:
- switch (m_ctrlSubtype) {
- case SUBTYPE_CTL_BACKREQ:
- return WIFI_MAC_CTL_BACKREQ;
- break;
- case SUBTYPE_CTL_BACKRESP:
- return WIFI_MAC_CTL_BACKRESP;
- break;
- case SUBTYPE_CTL_RTS:
- return WIFI_MAC_CTL_RTS;
- break;
- case SUBTYPE_CTL_CTS:
- return WIFI_MAC_CTL_CTS;
- break;
- case SUBTYPE_CTL_ACK:
- return WIFI_MAC_CTL_ACK;
+ }
break;
}
- break;
- case TYPE_DATA:
- switch (m_ctrlSubtype) {
- case 0:
- return WIFI_MAC_DATA;
- break;
- case 1:
- return WIFI_MAC_DATA_CFACK;
- break;
- case 2:
- return WIFI_MAC_DATA_CFPOLL;
- break;
- case 3:
- return WIFI_MAC_DATA_CFACK_CFPOLL;
- break;
- case 4:
- return WIFI_MAC_DATA_NULL;
- break;
- case 5:
- return WIFI_MAC_DATA_NULL_CFACK;
- break;
- case 6:
- return WIFI_MAC_DATA_NULL_CFPOLL;
- break;
- case 7:
- return WIFI_MAC_DATA_NULL_CFACK_CFPOLL;
- break;
- case 8:
- return WIFI_MAC_QOSDATA;
- break;
- case 9:
- return WIFI_MAC_QOSDATA_CFACK;
- break;
- case 10:
- return WIFI_MAC_QOSDATA_CFPOLL;
- break;
- case 11:
- return WIFI_MAC_QOSDATA_CFACK_CFPOLL;
- break;
- case 12:
- return WIFI_MAC_QOSDATA_NULL;
- break;
- case 14:
- return WIFI_MAC_QOSDATA_NULL_CFPOLL;
- break;
- case 15:
- return WIFI_MAC_QOSDATA_NULL_CFACK_CFPOLL;
- break;
-
- }
- break;
- }
// NOTREACHED
NS_ASSERT (false);
return (enum WifiMacType)-1;
}
-bool
+bool
WifiMacHeader::IsFromDs (void) const
{
return m_ctrlFromDs == 1;
}
-bool
+bool
WifiMacHeader::IsToDs (void) const
{
return m_ctrlToDs == 1;
}
-bool
+bool
WifiMacHeader::IsData (void) const
{
return (m_ctrlType == TYPE_DATA);
-
+
}
-bool
+bool
WifiMacHeader::IsQosData (void) const
{
return (m_ctrlType == TYPE_DATA && (m_ctrlSubtype & 0x08));
}
-bool
+bool
WifiMacHeader::IsCtl (void) const
{
return (m_ctrlType == TYPE_CTL);
}
-bool
+bool
WifiMacHeader::IsMgt (void) const
{
return (m_ctrlType == TYPE_MGT);
}
-bool
+bool
WifiMacHeader::IsCfpoll (void) const
{
- switch (GetType ()) {
- case WIFI_MAC_DATA_CFPOLL:
- case WIFI_MAC_DATA_CFACK_CFPOLL:
- case WIFI_MAC_DATA_NULL_CFPOLL:
- case WIFI_MAC_DATA_NULL_CFACK_CFPOLL:
- case WIFI_MAC_QOSDATA_CFPOLL:
- case WIFI_MAC_QOSDATA_CFACK_CFPOLL:
- case WIFI_MAC_QOSDATA_NULL_CFPOLL:
- case WIFI_MAC_QOSDATA_NULL_CFACK_CFPOLL:
- return true;
- break;
- default:
- return false;
- break;
- }
+ switch (GetType ())
+ {
+ case WIFI_MAC_DATA_CFPOLL:
+ case WIFI_MAC_DATA_CFACK_CFPOLL:
+ case WIFI_MAC_DATA_NULL_CFPOLL:
+ case WIFI_MAC_DATA_NULL_CFACK_CFPOLL:
+ case WIFI_MAC_QOSDATA_CFPOLL:
+ case WIFI_MAC_QOSDATA_CFACK_CFPOLL:
+ case WIFI_MAC_QOSDATA_NULL_CFPOLL:
+ case WIFI_MAC_QOSDATA_NULL_CFACK_CFPOLL:
+ return true;
+ break;
+ default:
+ return false;
+ break;
+ }
}
-bool
+bool
WifiMacHeader::IsRts (void) const
{
return (GetType () == WIFI_MAC_CTL_RTS);
}
-bool
+bool
WifiMacHeader::IsCts (void) const
{
return (GetType () == WIFI_MAC_CTL_CTS);
}
-bool
+bool
WifiMacHeader::IsAck (void) const
{
return (GetType () == WIFI_MAC_CTL_ACK);
}
-bool
+bool
WifiMacHeader::IsAssocReq (void) const
{
return (GetType () == WIFI_MAC_MGT_ASSOCIATION_REQUEST);
}
-bool
+bool
WifiMacHeader::IsAssocResp (void) const
{
return (GetType () == WIFI_MAC_MGT_ASSOCIATION_RESPONSE);
}
-bool
+bool
WifiMacHeader::IsReassocReq (void) const
{
return (GetType () == WIFI_MAC_MGT_REASSOCIATION_REQUEST);
}
-bool
+bool
WifiMacHeader::IsReassocResp (void) const
{
return (GetType () == WIFI_MAC_MGT_REASSOCIATION_RESPONSE);
}
-bool
+bool
WifiMacHeader::IsProbeReq (void) const
{
return (GetType () == WIFI_MAC_MGT_PROBE_REQUEST);
}
-bool
+bool
WifiMacHeader::IsProbeResp (void) const
{
return (GetType () == WIFI_MAC_MGT_PROBE_RESPONSE);
}
-bool
+bool
WifiMacHeader::IsBeacon (void) const
{
return (GetType () == WIFI_MAC_MGT_BEACON);
}
-bool
+bool
WifiMacHeader::IsDisassociation (void) const
{
return (GetType () == WIFI_MAC_MGT_DISASSOCIATION);
}
-bool
+bool
WifiMacHeader::IsAuthentication (void) const
{
return (GetType () == WIFI_MAC_MGT_AUTHENTICATION);
}
-bool
+bool
WifiMacHeader::IsDeauthentication (void) const
{
return (GetType () == WIFI_MAC_MGT_DEAUTHENTICATION);
@@ -661,16 +672,16 @@
bool
WifiMacHeader::IsBlockAckReq (void) const
{
- return (GetType () == WIFI_MAC_CTL_BACKREQ)?true:false;
+ return (GetType () == WIFI_MAC_CTL_BACKREQ) ? true : false;
}
bool
WifiMacHeader::IsBlockAck (void) const
{
- return (GetType () == WIFI_MAC_CTL_BACKRESP)?true:false;
+ return (GetType () == WIFI_MAC_CTL_BACKRESP) ? true : false;
}
-uint16_t
+uint16_t
WifiMacHeader::GetRawDuration (void) const
{
return m_duration;
@@ -680,7 +691,7 @@
{
return MicroSeconds (m_duration);
}
-uint16_t
+uint16_t
WifiMacHeader::GetSequenceControl (void) const
{
return (m_seqSeq << 4) | m_seqFrag;
@@ -695,29 +706,29 @@
{
return m_seqFrag;
}
-bool
+bool
WifiMacHeader::IsRetry (void) const
{
return (m_ctrlRetry == 1);
}
-bool
+bool
WifiMacHeader::IsMoreFragments (void) const
{
return (m_ctrlMoreFrag == 1);
}
-bool
+bool
WifiMacHeader::IsQosBlockAck (void) const
{
NS_ASSERT (IsQosData ());
return (m_qosAckPolicy == 3);
}
-bool
+bool
WifiMacHeader::IsQosNoAck (void) const
{
NS_ASSERT (IsQosData ());
return (m_qosAckPolicy == 1);
}
-bool
+bool
WifiMacHeader::IsQosAck (void) const
{
NS_ASSERT (IsQosData ());
@@ -744,26 +755,27 @@
enum WifiMacHeader::QosAckPolicy
WifiMacHeader::GetQosAckPolicy (void) const
{
- switch (m_qosAckPolicy) {
- case 0 :
- return NORMAL_ACK;
- break;
- case 1 :
- return NO_ACK;
- break;
- case 2 :
- return NO_EXPLICIT_ACK;
- break;
- case 3 :
- return BLOCK_ACK;
- break;
- }
+ switch (m_qosAckPolicy)
+ {
+ case 0:
+ return NORMAL_ACK;
+ break;
+ case 1:
+ return NO_ACK;
+ break;
+ case 2:
+ return NO_EXPLICIT_ACK;
+ break;
+ case 3:
+ return BLOCK_ACK;
+ break;
+ }
// NOTREACHED
NS_ASSERT (false);
return (enum QosAckPolicy)-1;
}
-uint8_t
+uint8_t
WifiMacHeader::GetQosTxopLimit (void) const
{
NS_ASSERT (IsQosData ());
@@ -774,15 +786,15 @@
WifiMacHeader::GetFrameControl (void) const
{
uint16_t val = 0;
- val |= (m_ctrlType << 2) & (0x3<<2);
- val |= (m_ctrlSubtype << 4) & (0xf<<4);
- val |= (m_ctrlToDs << 8) & (0x1<<8);
- val |= (m_ctrlFromDs << 9) & (0x1<<9);
- val |= (m_ctrlMoreFrag << 10) & (0x1<<10);
- val |= (m_ctrlRetry << 11) & (0x1<<11);
- val |= (m_ctrlMoreData << 13) & (0x1<<13);
- val |= (m_ctrlWep << 14) & (0x1<<14);
- val |= (m_ctrlOrder << 15) & (0x1<<15);
+ val |= (m_ctrlType << 2) & (0x3 << 2);
+ val |= (m_ctrlSubtype << 4) & (0xf << 4);
+ val |= (m_ctrlToDs << 8) & (0x1 << 8);
+ val |= (m_ctrlFromDs << 9) & (0x1 << 9);
+ val |= (m_ctrlMoreFrag << 10) & (0x1 << 10);
+ val |= (m_ctrlRetry << 11) & (0x1 << 11);
+ val |= (m_ctrlMoreData << 13) & (0x1 << 13);
+ val |= (m_ctrlWep << 14) & (0x1 << 14);
+ val |= (m_ctrlOrder << 15) & (0x1 << 15);
return val;
}
@@ -811,7 +823,7 @@
m_ctrlWep = (ctrl >> 14) & 0x01;
m_ctrlOrder = (ctrl >> 15) & 0x01;
}
-void
+void
WifiMacHeader::SetSequenceControl (uint16_t seq)
{
m_seqFrag = seq & 0x0f;
@@ -827,39 +839,43 @@
m_qosStuff = (qos >> 8) & 0x00ff;
}
-uint32_t
+uint32_t
WifiMacHeader::GetSize (void) const
{
uint32_t size = 0;
- switch (m_ctrlType) {
- case TYPE_MGT:
- size = 2+2+6+6+6+2;
- break;
- case TYPE_CTL:
- switch (m_ctrlSubtype) {
- case SUBTYPE_CTL_RTS:
- size = 2+2+6+6;
+ switch (m_ctrlType)
+ {
+ case TYPE_MGT:
+ size = 2 + 2 + 6 + 6 + 6 + 2;
break;
- case SUBTYPE_CTL_CTS:
- case SUBTYPE_CTL_ACK:
- size = 2+2+6;
+ case TYPE_CTL:
+ switch (m_ctrlSubtype)
+ {
+ case SUBTYPE_CTL_RTS:
+ size = 2 + 2 + 6 + 6;
+ break;
+ case SUBTYPE_CTL_CTS:
+ case SUBTYPE_CTL_ACK:
+ size = 2 + 2 + 6;
+ break;
+ case SUBTYPE_CTL_BACKREQ:
+ case SUBTYPE_CTL_BACKRESP:
+ size = 2 + 2 + 6 + 6;
+ break;
+ }
break;
- case SUBTYPE_CTL_BACKREQ:
- case SUBTYPE_CTL_BACKRESP:
- size = 2+2+6+6;
+ case TYPE_DATA:
+ size = 2 + 2 + 6 + 6 + 6 + 2;
+ if (m_ctrlToDs && m_ctrlFromDs)
+ {
+ size += 6;
+ }
+ if (m_ctrlSubtype & 0x08)
+ {
+ size += 2;
+ }
break;
}
- break;
- case TYPE_DATA:
- size = 2+2+6+6+6+2;
- if (m_ctrlToDs && m_ctrlFromDs) {
- size += 6;
- }
- if (m_ctrlSubtype & 0x08) {
- size += 2;
- }
- break;
- }
return size;
}
const char *
@@ -867,79 +883,80 @@
{
#define FOO(x) \
case WIFI_MAC_ ## x: \
- return #x; \
+ return # x; \
break;
- switch (GetType ()) {
- FOO (CTL_RTS);
- FOO (CTL_CTS);
- FOO (CTL_ACK);
- FOO (CTL_BACKREQ);
- FOO (CTL_BACKRESP);
+ switch (GetType ())
+ {
+ FOO (CTL_RTS);
+ FOO (CTL_CTS);
+ FOO (CTL_ACK);
+ FOO (CTL_BACKREQ);
+ FOO (CTL_BACKRESP);
- FOO (MGT_BEACON);
- FOO (MGT_ASSOCIATION_REQUEST);
- FOO (MGT_ASSOCIATION_RESPONSE);
- FOO (MGT_DISASSOCIATION);
- FOO (MGT_REASSOCIATION_REQUEST);
- FOO (MGT_REASSOCIATION_RESPONSE);
- FOO (MGT_PROBE_REQUEST);
- FOO (MGT_PROBE_RESPONSE);
- FOO (MGT_AUTHENTICATION);
- FOO (MGT_DEAUTHENTICATION);
- FOO (MGT_ACTION);
- FOO (MGT_ACTION_NO_ACK);
- FOO (MGT_MULTIHOP_ACTION);
-
- FOO (DATA);
- FOO (DATA_CFACK);
- FOO (DATA_CFPOLL);
- FOO (DATA_CFACK_CFPOLL);
- FOO (DATA_NULL);
- FOO (DATA_NULL_CFACK);
- FOO (DATA_NULL_CFPOLL);
- FOO (DATA_NULL_CFACK_CFPOLL);
- FOO (QOSDATA);
- FOO (QOSDATA_CFACK);
- FOO (QOSDATA_CFPOLL);
- FOO (QOSDATA_CFACK_CFPOLL);
- FOO (QOSDATA_NULL);
- FOO (QOSDATA_NULL_CFPOLL);
- FOO (QOSDATA_NULL_CFACK_CFPOLL);
- default:
- return "ERROR";
- }
+ FOO (MGT_BEACON);
+ FOO (MGT_ASSOCIATION_REQUEST);
+ FOO (MGT_ASSOCIATION_RESPONSE);
+ FOO (MGT_DISASSOCIATION);
+ FOO (MGT_REASSOCIATION_REQUEST);
+ FOO (MGT_REASSOCIATION_RESPONSE);
+ FOO (MGT_PROBE_REQUEST);
+ FOO (MGT_PROBE_RESPONSE);
+ FOO (MGT_AUTHENTICATION);
+ FOO (MGT_DEAUTHENTICATION);
+ FOO (MGT_ACTION);
+ FOO (MGT_ACTION_NO_ACK);
+ FOO (MGT_MULTIHOP_ACTION);
+
+ FOO (DATA);
+ FOO (DATA_CFACK);
+ FOO (DATA_CFPOLL);
+ FOO (DATA_CFACK_CFPOLL);
+ FOO (DATA_NULL);
+ FOO (DATA_NULL_CFACK);
+ FOO (DATA_NULL_CFPOLL);
+ FOO (DATA_NULL_CFACK_CFPOLL);
+ FOO (QOSDATA);
+ FOO (QOSDATA_CFACK);
+ FOO (QOSDATA_CFPOLL);
+ FOO (QOSDATA_CFACK_CFPOLL);
+ FOO (QOSDATA_NULL);
+ FOO (QOSDATA_NULL_CFPOLL);
+ FOO (QOSDATA_NULL_CFACK_CFPOLL);
+ default:
+ return "ERROR";
+ }
#undef FOO
// needed to make gcc 4.0.1 ppc darwin happy.
return "BIG_ERROR";
}
-TypeId
+TypeId
WifiMacHeader::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::WifiMacHeader")
.SetParent<Header> ()
.AddConstructor<WifiMacHeader> ()
- ;
+ ;
return tid;
}
-TypeId
+TypeId
WifiMacHeader::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
-void
+void
WifiMacHeader::PrintFrameControl (std::ostream &os) const
{
- os << "ToDS=" << std::hex << (int) m_ctrlToDs << ", FromDS=" << std::hex << (int) m_ctrlFromDs
- << ", MoreFrag=" << std::hex << (int) m_ctrlMoreFrag << ", Retry=" << std::hex << (int) m_ctrlRetry
- << ", MoreData=" << std::hex << (int) m_ctrlMoreData << std::dec
- ;
+ os << "ToDS=" << std::hex << (int) m_ctrlToDs << ", FromDS=" << std::hex << (int) m_ctrlFromDs
+ << ", MoreFrag=" << std::hex << (int) m_ctrlMoreFrag << ", Retry=" << std::hex << (int) m_ctrlRetry
+ << ", MoreData=" << std::hex << (int) m_ctrlMoreData << std::dec
+ ;
}
-void
+void
WifiMacHeader::Print (std::ostream &os) const
{
os << GetTypeString () << " ";
@@ -1028,57 +1045,62 @@
break;
}
}
-uint32_t
+uint32_t
WifiMacHeader::GetSerializedSize (void) const
{
return GetSize ();
}
-void
+void
WifiMacHeader::Serialize (Buffer::Iterator i) const
{
i.WriteHtolsbU16 (GetFrameControl ());
i.WriteHtolsbU16 (m_duration);
WriteTo (i, m_addr1);
- switch (m_ctrlType) {
- case TYPE_MGT:
- WriteTo (i, m_addr2);
- WriteTo (i, m_addr3);
- i.WriteHtolsbU16 (GetSequenceControl ());
- break;
- case TYPE_CTL:
- switch (m_ctrlSubtype) {
- case SUBTYPE_CTL_RTS:
+ switch (m_ctrlType)
+ {
+ case TYPE_MGT:
WriteTo (i, m_addr2);
- break;
- case SUBTYPE_CTL_CTS:
- case SUBTYPE_CTL_ACK:
+ WriteTo (i, m_addr3);
+ i.WriteHtolsbU16 (GetSequenceControl ());
break;
- case SUBTYPE_CTL_BACKREQ:
- case SUBTYPE_CTL_BACKRESP:
- WriteTo (i, m_addr2);
+ case TYPE_CTL:
+ switch (m_ctrlSubtype)
+ {
+ case SUBTYPE_CTL_RTS:
+ WriteTo (i, m_addr2);
+ break;
+ case SUBTYPE_CTL_CTS:
+ case SUBTYPE_CTL_ACK:
+ break;
+ case SUBTYPE_CTL_BACKREQ:
+ case SUBTYPE_CTL_BACKRESP:
+ WriteTo (i, m_addr2);
+ break;
+ default:
+ //NOTREACHED
+ NS_ASSERT (false);
+ break;
+ }
break;
+ case TYPE_DATA:
+ {
+ WriteTo (i, m_addr2);
+ WriteTo (i, m_addr3);
+ i.WriteHtolsbU16 (GetSequenceControl ());
+ if (m_ctrlToDs && m_ctrlFromDs)
+ {
+ WriteTo (i, m_addr4);
+ }
+ if (m_ctrlSubtype & 0x08)
+ {
+ i.WriteHtolsbU16 (GetQosControl ());
+ }
+ } break;
default:
//NOTREACHED
NS_ASSERT (false);
break;
}
- break;
- case TYPE_DATA: {
- WriteTo (i, m_addr2);
- WriteTo (i, m_addr3);
- i.WriteHtolsbU16 (GetSequenceControl ());
- if (m_ctrlToDs && m_ctrlFromDs) {
- WriteTo (i, m_addr4);
- }
- if (m_ctrlSubtype & 0x08) {
- i.WriteHtolsbU16 (GetQosControl ());
- }
- } break;
- default:
- //NOTREACHED
- NS_ASSERT (false);
- break;
- }
}
uint32_t
WifiMacHeader::Deserialize (Buffer::Iterator start)
@@ -1088,38 +1110,42 @@
SetFrameControl (frame_control);
m_duration = i.ReadLsbtohU16 ();
ReadFrom (i, m_addr1);
- switch (m_ctrlType) {
- case TYPE_MGT:
- ReadFrom (i, m_addr2);
- ReadFrom (i, m_addr3);
- SetSequenceControl (i.ReadLsbtohU16 ());
- break;
- case TYPE_CTL:
- switch (m_ctrlSubtype) {
- case SUBTYPE_CTL_RTS:
+ switch (m_ctrlType)
+ {
+ case TYPE_MGT:
ReadFrom (i, m_addr2);
- break;
- case SUBTYPE_CTL_CTS:
- case SUBTYPE_CTL_ACK:
+ ReadFrom (i, m_addr3);
+ SetSequenceControl (i.ReadLsbtohU16 ());
break;
- case SUBTYPE_CTL_BACKREQ:
- case SUBTYPE_CTL_BACKRESP:
+ case TYPE_CTL:
+ switch (m_ctrlSubtype)
+ {
+ case SUBTYPE_CTL_RTS:
+ ReadFrom (i, m_addr2);
+ break;
+ case SUBTYPE_CTL_CTS:
+ case SUBTYPE_CTL_ACK:
+ break;
+ case SUBTYPE_CTL_BACKREQ:
+ case SUBTYPE_CTL_BACKRESP:
+ ReadFrom (i, m_addr2);
+ break;
+ }
+ break;
+ case TYPE_DATA:
ReadFrom (i, m_addr2);
+ ReadFrom (i, m_addr3);
+ SetSequenceControl (i.ReadLsbtohU16 ());
+ if (m_ctrlToDs && m_ctrlFromDs)
+ {
+ ReadFrom (i, m_addr4);
+ }
+ if (m_ctrlSubtype & 0x08)
+ {
+ SetQosControl (i.ReadLsbtohU16 ());
+ }
break;
}
- break;
- case TYPE_DATA:
- ReadFrom (i, m_addr2);
- ReadFrom (i, m_addr3);
- SetSequenceControl (i.ReadLsbtohU16 ());
- if (m_ctrlToDs && m_ctrlFromDs) {
- ReadFrom (i, m_addr4);
- }
- if (m_ctrlSubtype & 0x08) {
- SetQosControl (i.ReadLsbtohU16 ());
- }
- break;
- }
return i.GetDistanceFrom (start);
}
--- a/src/wifi/model/wifi-mac-header.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-mac-header.h Sat May 07 21:49:46 2011 +0200
@@ -29,7 +29,8 @@
namespace ns3 {
-enum WifiMacType {
+enum WifiMacType
+{
WIFI_MAC_CTL_RTS = 0,
WIFI_MAC_CTL_CTS,
WIFI_MAC_CTL_ACK,
@@ -72,18 +73,20 @@
*
* Implements the IEEE 802.11 MAC header
*/
-class WifiMacHeader : public Header
+class WifiMacHeader : public Header
{
public:
- enum QosAckPolicy {
+ enum QosAckPolicy
+ {
NORMAL_ACK = 0,
NO_ACK = 1,
NO_EXPLICIT_ACK = 2,
BLOCK_ACK = 3,
};
-
- enum AddressType {
- ADDR1,
+
+ enum AddressType
+ {
+ ADDR1,
ADDR2,
ADDR3,
ADDR4
@@ -109,7 +112,7 @@
void SetAction ();
void SetBlockAckReq (void);
void SetBlockAck (void);
- void SetMultihopAction();
+ void SetMultihopAction ();
void SetDsFrom (void);
void SetDsNotFrom (void);
void SetDsTo (void);
@@ -138,7 +141,7 @@
void SetQosAmsdu (void);
void SetQosNoAmsdu (void);
void SetQosTxopLimit (uint8_t txop);
-
+
Mac48Address GetAddr1 (void) const;
Mac48Address GetAddr2 (void) const;
@@ -186,7 +189,7 @@
uint8_t GetQosTxopLimit (void) const;
uint32_t GetSize (void) const;
- const char *GetTypeString (void) const;
+ const char * GetTypeString (void) const;
private:
--- a/src/wifi/model/wifi-mac-queue.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-mac-queue.cc Sat May 07 21:49:46 2011 +0200
@@ -4,7 +4,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -32,13 +32,16 @@
NS_OBJECT_ENSURE_REGISTERED (WifiMacQueue);
-WifiMacQueue::Item::Item (Ptr<const Packet> packet,
- const WifiMacHeader &hdr,
+WifiMacQueue::Item::Item (Ptr<const Packet> packet,
+ const WifiMacHeader &hdr,
Time tstamp)
- : packet (packet), hdr (hdr), tstamp (tstamp)
-{}
+ : packet (packet),
+ hdr (hdr),
+ tstamp (tstamp)
+{
+}
-TypeId
+TypeId
WifiMacQueue::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::WifiMacQueue")
@@ -52,20 +55,21 @@
TimeValue (Seconds (10.0)),
MakeTimeAccessor (&WifiMacQueue::m_maxDelay),
MakeTimeChecker ())
- ;
+ ;
return tid;
}
WifiMacQueue::WifiMacQueue ()
: m_size (0)
-{}
+{
+}
WifiMacQueue::~WifiMacQueue ()
{
Flush ();
}
-void
+void
WifiMacQueue::SetMaxSize (uint32_t maxSize)
{
m_maxSize = maxSize;
@@ -77,23 +81,23 @@
m_maxDelay = delay;
}
-uint32_t
+uint32_t
WifiMacQueue::GetMaxSize (void) const
{
return m_maxSize;
}
-Time
+Time
WifiMacQueue::GetMaxDelay (void) const
{
return m_maxDelay;
}
-void
+void
WifiMacQueue::Enqueue (Ptr<const Packet> packet, const WifiMacHeader &hdr)
{
Cleanup ();
- if (m_size == m_maxSize)
+ if (m_size == m_maxSize)
{
return;
}
@@ -105,16 +109,16 @@
void
WifiMacQueue::Cleanup (void)
{
- if (m_queue.empty ())
+ if (m_queue.empty ())
{
return;
}
Time now = Simulator::Now ();
uint32_t n = 0;
- for (PacketQueueI i = m_queue.begin (); i != m_queue.end ();)
+ for (PacketQueueI i = m_queue.begin (); i != m_queue.end ();)
{
- if (i->tstamp + m_maxDelay > now)
+ if (i->tstamp + m_maxDelay > now)
{
i++;
}
@@ -131,7 +135,7 @@
WifiMacQueue::Dequeue (WifiMacHeader *hdr)
{
Cleanup ();
- if (!m_queue.empty ())
+ if (!m_queue.empty ())
{
Item i = m_queue.front ();
m_queue.pop_front ();
@@ -146,7 +150,7 @@
WifiMacQueue::Peek (WifiMacHeader *hdr)
{
Cleanup ();
- if (!m_queue.empty ())
+ if (!m_queue.empty ())
{
Item i = m_queue.front ();
*hdr = i.hdr;
@@ -156,7 +160,7 @@
}
Ptr<const Packet>
-WifiMacQueue::DequeueByTidAndAddress (WifiMacHeader *hdr, uint8_t tid,
+WifiMacQueue::DequeueByTidAndAddress (WifiMacHeader *hdr, uint8_t tid,
WifiMacHeader::AddressType type, Mac48Address dest)
{
Cleanup ();
@@ -169,8 +173,8 @@
{
if (it->hdr.IsQosData ())
{
- if (GetAddressForPacket (type, it) == dest &&
- it->hdr.GetQosTid () == tid)
+ if (GetAddressForPacket (type, it) == dest
+ && it->hdr.GetQosTid () == tid)
{
packet = it->packet;
*hdr = it->hdr;
@@ -185,7 +189,7 @@
}
Ptr<const Packet>
-WifiMacQueue::PeekByTidAndAddress (WifiMacHeader *hdr, uint8_t tid,
+WifiMacQueue::PeekByTidAndAddress (WifiMacHeader *hdr, uint8_t tid,
WifiMacHeader::AddressType type, Mac48Address dest)
{
Cleanup ();
@@ -197,8 +201,8 @@
{
if (it->hdr.IsQosData ())
{
- if (GetAddressForPacket (type, it) == dest &&
- it->hdr.GetQosTid () == tid)
+ if (GetAddressForPacket (type, it) == dest
+ && it->hdr.GetQosTid () == tid)
{
*hdr = it->hdr;
return it->packet;
@@ -308,8 +312,8 @@
Ptr<const Packet> packet = 0;
for (PacketQueueI it = m_queue.begin (); it != m_queue.end (); it++)
{
- if (!it->hdr.IsQosData () ||
- !blockedPackets->IsBlocked (it->hdr.GetAddr1 (), it->hdr.GetQosTid ()))
+ if (!it->hdr.IsQosData ()
+ || !blockedPackets->IsBlocked (it->hdr.GetAddr1 (), it->hdr.GetQosTid ()))
{
*hdr = it->hdr;
timestamp = it->tstamp;
@@ -329,8 +333,8 @@
Cleanup ();
for (PacketQueueI it = m_queue.begin (); it != m_queue.end (); it++)
{
- if (!it->hdr.IsQosData () ||
- !blockedPackets->IsBlocked (it->hdr.GetAddr1 (), it->hdr.GetQosTid ()))
+ if (!it->hdr.IsQosData ()
+ || !blockedPackets->IsBlocked (it->hdr.GetAddr1 (), it->hdr.GetQosTid ()))
{
*hdr = it->hdr;
timestamp = it->tstamp;
--- a/src/wifi/model/wifi-mac-queue.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-mac-queue.h Sat May 07 21:49:46 2011 +0200
@@ -4,7 +4,7 @@
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -40,12 +40,12 @@
* This queue implements the timeout procedure described in IEEE
* Std. 802.11-2007, section 9.9.1.6, paragraph 6.
*
- * When a packet is received by the MAC, to be sent to the PHY,
- * it is queued in the internal queue after being tagged by the
+ * When a packet is received by the MAC, to be sent to the PHY,
+ * it is queued in the internal queue after being tagged by the
* current time.
*
- * When a packet is dequeued, the queue checks its timestamp
- * to verify whether or not it should be dropped. If
+ * When a packet is dequeued, the queue checks its timestamp
+ * to verify whether or not it should be dropped. If
* dot11EDCATableMSDULifetime has elapsed, it is dropped.
* Otherwise, it is returned to the caller.
*/
@@ -66,19 +66,19 @@
Ptr<const Packet> Dequeue (WifiMacHeader *hdr);
Ptr<const Packet> Peek (WifiMacHeader *hdr);
/**
- * Searchs and returns, if is present in this queue, first packet having
- * address indicated by <i>type</i> equals to <i>addr</i>, and tid
- * equals to <i>tid</i>. This method removes the packet from this queue.
- * Is typically used by ns3::EdcaTxopN in order to perform correct MSDU
+ * Searchs and returns, if is present in this queue, first packet having
+ * address indicated by <i>type</i> equals to <i>addr</i>, and tid
+ * equals to <i>tid</i>. This method removes the packet from this queue.
+ * Is typically used by ns3::EdcaTxopN in order to perform correct MSDU
* aggregation (A-MSDU).
*/
Ptr<const Packet> DequeueByTidAndAddress (WifiMacHeader *hdr,
- uint8_t tid,
+ uint8_t tid,
WifiMacHeader::AddressType type,
Mac48Address addr);
/**
* Searchs and returns, if is present in this queue, first packet having
- * address indicated by <i>type</i> equals to <i>addr</i>, and tid
+ * address indicated by <i>type</i> equals to <i>addr</i>, and tid
* equals to <i>tid</i>. This method doesn't remove the packet from this queue.
* Is typically used by ns3::EdcaTxopN in order to perform correct MSDU
* aggregation (A-MSDU).
@@ -90,7 +90,7 @@
/**
* If exists, removes <i>packet</i> from queue and returns true. Otherwise it
* takes no effects and return false. Deletion of the packet is
- * performed in linear time (O(n)).
+ * performed in linear time (O(n)).
*/
bool Remove (Ptr<const Packet> packet);
/**
@@ -105,7 +105,7 @@
* if it's a QoS packet with a tid and an address1 fields equal to <i>tid</i> and <i>addr</i>
* respectively that index a pending agreement in the BlockAckManager object.
* So that packet must not be transmitted until reception of an ADDBA response frame from station
- * addressed by <i>addr</i>. This method removes the packet from queue.
+ * addressed by <i>addr</i>. This method removes the packet from queue.
*/
Ptr<const Packet> DequeueFirstAvailable (WifiMacHeader *hdr,
Time &tStamp,
@@ -122,17 +122,18 @@
uint32_t GetSize (void);
private:
struct Item;
-
+
typedef std::list<struct Item> PacketQueue;
typedef std::list<struct Item>::reverse_iterator PacketQueueRI;
typedef std::list<struct Item>::iterator PacketQueueI;
-
+
void Cleanup (void);
Mac48Address GetAddressForPacket (enum WifiMacHeader::AddressType type, PacketQueueI);
-
- struct Item {
- Item (Ptr<const Packet> packet,
- const WifiMacHeader &hdr,
+
+ struct Item
+ {
+ Item (Ptr<const Packet> packet,
+ const WifiMacHeader &hdr,
Time tstamp);
Ptr<const Packet> packet;
WifiMacHeader hdr;
--- a/src/wifi/model/wifi-mac-trailer.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-mac-trailer.cc Sat May 07 21:49:46 2011 +0200
@@ -25,35 +25,38 @@
NS_OBJECT_ENSURE_REGISTERED (WifiMacTrailer);
WifiMacTrailer::WifiMacTrailer ()
-{}
+{
+}
WifiMacTrailer::~WifiMacTrailer ()
-{}
+{
+}
-TypeId
+TypeId
WifiMacTrailer::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::WifiMacTrailer")
.SetParent<Trailer> ()
.AddConstructor<WifiMacTrailer> ()
- ;
+ ;
return tid;
}
-TypeId
+TypeId
WifiMacTrailer::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
-void
+void
WifiMacTrailer::Print (std::ostream &os) const
-{}
-uint32_t
+{
+}
+uint32_t
WifiMacTrailer::GetSerializedSize (void) const
{
return WIFI_MAC_FCS_LENGTH;
}
-void
+void
WifiMacTrailer::Serialize (Buffer::Iterator start) const
{
start.Prev (WIFI_MAC_FCS_LENGTH);
--- a/src/wifi/model/wifi-mac-trailer.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-mac-trailer.h Sat May 07 21:49:46 2011 +0200
@@ -27,7 +27,7 @@
-/**
+/**
* The length in octects of the IEEE 802.11 MAC FCS field
*/
static const uint16_t WIFI_MAC_FCS_LENGTH = 4;
@@ -35,9 +35,9 @@
/**
* \ingroup wifi
*
- * Implements the IEEE 802.11 MAC trailer
+ * Implements the IEEE 802.11 MAC trailer
*/
-class WifiMacTrailer : public Trailer
+class WifiMacTrailer : public Trailer
{
public:
WifiMacTrailer ();
--- a/src/wifi/model/wifi-mac.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-mac.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -29,7 +29,7 @@
Time
WifiMac::GetDefaultMaxPropagationDelay (void)
{
- // 1000m
+ // 1000m
return Seconds (1000.0 / 300000000.0);
}
Time
@@ -58,8 +58,8 @@
Time
WifiMac::GetDefaultCtsAckTimeout (void)
{
- /* Cts_Timeout and Ack_Timeout are specified in the Annex C
- (Formal description of MAC operation, see details on the
+ /* Cts_Timeout and Ack_Timeout are specified in the Annex C
+ (Formal description of MAC operation, see details on the
Trsp timer setting at page 346)
*/
Time ctsTimeout = GetDefaultSifs ();
@@ -126,7 +126,7 @@
return MicroSeconds (0);
}
-TypeId
+TypeId
WifiMac::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::WifiMac")
@@ -154,17 +154,17 @@
.AddAttribute ("Sifs", "The value of the SIFS constant.",
TimeValue (GetDefaultSifs ()),
MakeTimeAccessor (&WifiMac::SetSifs,
- &WifiMac::GetSifs),
+ &WifiMac::GetSifs),
MakeTimeChecker ())
.AddAttribute ("EifsNoDifs", "The value of EIFS-DIFS",
- TimeValue (GetDefaultEifsNoDifs ()),
- MakeTimeAccessor (&WifiMac::SetEifsNoDifs,
- &WifiMac::GetEifsNoDifs),
- MakeTimeChecker ())
+ TimeValue (GetDefaultEifsNoDifs ()),
+ MakeTimeAccessor (&WifiMac::SetEifsNoDifs,
+ &WifiMac::GetEifsNoDifs),
+ MakeTimeChecker ())
.AddAttribute ("Slot", "The duration of a Slot.",
TimeValue (GetDefaultSlot ()),
MakeTimeAccessor (&WifiMac::SetSlot,
- &WifiMac::GetSlot),
+ &WifiMac::GetSlot),
MakeTimeChecker ())
.AddAttribute ("Pifs", "The value of the PIFS constant.",
TimeValue (GetDefaultSifs () + GetDefaultSlot ()),
@@ -176,41 +176,41 @@
MakeTimeAccessor (&WifiMac::m_maxPropagationDelay),
MakeTimeChecker ())
.AddAttribute ("Ssid", "The ssid we want to belong to.",
- SsidValue (Ssid ("default")),
- MakeSsidAccessor (&WifiMac::GetSsid,
- &WifiMac::SetSsid),
- MakeSsidChecker ())
- .AddTraceSource ("MacTx",
+ SsidValue (Ssid ("default")),
+ MakeSsidAccessor (&WifiMac::GetSsid,
+ &WifiMac::SetSsid),
+ MakeSsidChecker ())
+ .AddTraceSource ("MacTx",
"A packet has been received from higher layers and is being processed in preparation for "
"queueing for transmission.",
MakeTraceSourceAccessor (&WifiMac::m_macTxTrace))
- .AddTraceSource ("MacTxDrop",
+ .AddTraceSource ("MacTxDrop",
"A packet has been dropped in the MAC layer before being queued for transmission.",
MakeTraceSourceAccessor (&WifiMac::m_macTxDropTrace))
- .AddTraceSource ("MacPromiscRx",
+ .AddTraceSource ("MacPromiscRx",
"A packet has been received by this device, has been passed up from the physical layer "
"and is being forwarded up the local protocol stack. This is a promiscuous trace,",
MakeTraceSourceAccessor (&WifiMac::m_macPromiscRxTrace))
- .AddTraceSource ("MacRx",
+ .AddTraceSource ("MacRx",
"A packet has been received by this device, has been passed up from the physical layer "
"and is being forwarded up the local protocol stack. This is a non-promiscuous trace,",
MakeTraceSourceAccessor (&WifiMac::m_macRxTrace))
- .AddTraceSource ("MacRxDrop",
+ .AddTraceSource ("MacRxDrop",
"A packet has been dropped in the MAC layer after it has been passed up from the physical "
"layer.",
MakeTraceSourceAccessor (&WifiMac::m_macRxDropTrace))
#if 0
// Not currently implemented in this device
- .AddTraceSource ("Sniffer",
+ .AddTraceSource ("Sniffer",
"Trace source simulating a non-promiscuous packet sniffer attached to the device",
MakeTraceSourceAccessor (&WifiMac::m_snifferTrace))
#endif
- ;
+ ;
return tid;
}
-void
+void
WifiMac::SetMaxPropagationDelay (Time delay)
{
m_maxPropagationDelay = delay;
@@ -227,32 +227,32 @@
return m_maxPropagationDelay;
}
-void
+void
WifiMac::NotifyTx (Ptr<const Packet> packet)
{
m_macTxTrace (packet);
}
-void
-WifiMac::NotifyTxDrop (Ptr<const Packet> packet)
+void
+WifiMac::NotifyTxDrop (Ptr<const Packet> packet)
{
m_macTxDropTrace (packet);
}
-void
-WifiMac::NotifyRx (Ptr<const Packet> packet)
+void
+WifiMac::NotifyRx (Ptr<const Packet> packet)
{
m_macRxTrace (packet);
}
-void
-WifiMac::NotifyPromiscRx (Ptr<const Packet> packet)
+void
+WifiMac::NotifyPromiscRx (Ptr<const Packet> packet)
{
m_macPromiscRxTrace (packet);
}
-void
-WifiMac::NotifyRxDrop (Ptr<const Packet> packet)
+void
+WifiMac::NotifyRxDrop (Ptr<const Packet> packet)
{
m_macRxDropTrace (packet);
}
@@ -260,185 +260,188 @@
void
WifiMac::ConfigureStandard (enum WifiPhyStandard standard)
{
- switch (standard) {
- case WIFI_PHY_STANDARD_80211a:
- Configure80211a ();
- break;
- case WIFI_PHY_STANDARD_80211b:
- Configure80211b ();
- break;
- case WIFI_PHY_STANDARD_80211g:
- Configure80211g ();
- break;
- case WIFI_PHY_STANDARD_80211_10Mhz:
- Configure80211_10Mhz ();
- break;
- case WIFI_PHY_STANDARD_80211_5Mhz:
- Configure80211_5Mhz ();
- break;
- case WIFI_PHY_STANDARD_holland:
- Configure80211a ();
- break;
- case WIFI_PHY_STANDARD_80211p_CCH:
- Configure80211p_CCH ();
- break;
- case WIFI_PHY_STANDARD_80211p_SCH:
- Configure80211p_SCH ();
- break;
- default:
- NS_ASSERT (false);
- break;
- }
+ switch (standard)
+ {
+ case WIFI_PHY_STANDARD_80211a:
+ Configure80211a ();
+ break;
+ case WIFI_PHY_STANDARD_80211b:
+ Configure80211b ();
+ break;
+ case WIFI_PHY_STANDARD_80211g:
+ Configure80211g ();
+ break;
+ case WIFI_PHY_STANDARD_80211_10Mhz:
+ Configure80211_10Mhz ();
+ break;
+ case WIFI_PHY_STANDARD_80211_5Mhz:
+ Configure80211_5Mhz ();
+ break;
+ case WIFI_PHY_STANDARD_holland:
+ Configure80211a ();
+ break;
+ case WIFI_PHY_STANDARD_80211p_CCH:
+ Configure80211p_CCH ();
+ break;
+ case WIFI_PHY_STANDARD_80211p_SCH:
+ Configure80211p_SCH ();
+ break;
+ default:
+ NS_ASSERT (false);
+ break;
+ }
FinishConfigureStandard (standard);
}
void
WifiMac::Configure80211a (void)
{
- SetSifs(MicroSeconds(16));
- SetSlot(MicroSeconds(9));
- SetEifsNoDifs(MicroSeconds(16+44));
- SetPifs(MicroSeconds(16+9));
- SetCtsTimeout(MicroSeconds(16+44+9+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2));
- SetAckTimeout(MicroSeconds(16+44+9+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2));
+ SetSifs (MicroSeconds (16));
+ SetSlot (MicroSeconds (9));
+ SetEifsNoDifs (MicroSeconds (16 + 44));
+ SetPifs (MicroSeconds (16 + 9));
+ SetCtsTimeout (MicroSeconds (16 + 44 + 9 + GetDefaultMaxPropagationDelay ().GetMicroSeconds () * 2));
+ SetAckTimeout (MicroSeconds (16 + 44 + 9 + GetDefaultMaxPropagationDelay ().GetMicroSeconds () * 2));
}
void
WifiMac::Configure80211b (void)
{
- SetSifs(MicroSeconds(10));
- SetSlot(MicroSeconds(20));
- SetEifsNoDifs(MicroSeconds(10+304));
- SetPifs(MicroSeconds(10+20));
- SetCtsTimeout(MicroSeconds(10+304+20+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2));
- SetAckTimeout(MicroSeconds(10+304+20+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2));
+ SetSifs (MicroSeconds (10));
+ SetSlot (MicroSeconds (20));
+ SetEifsNoDifs (MicroSeconds (10 + 304));
+ SetPifs (MicroSeconds (10 + 20));
+ SetCtsTimeout (MicroSeconds (10 + 304 + 20 + GetDefaultMaxPropagationDelay ().GetMicroSeconds () * 2));
+ SetAckTimeout (MicroSeconds (10 + 304 + 20 + GetDefaultMaxPropagationDelay ().GetMicroSeconds () * 2));
}
void
WifiMac::Configure80211g (void)
{
- SetSifs(MicroSeconds(10));
+ SetSifs (MicroSeconds (10));
// Note no support for Short Slot Time as yet
- SetSlot(MicroSeconds(20));
- SetEifsNoDifs(MicroSeconds(10+304));
- SetPifs(MicroSeconds(10+20));
- SetCtsTimeout(MicroSeconds(10+304+20+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2));
- SetAckTimeout(MicroSeconds(10+304+20+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2));
+ SetSlot (MicroSeconds (20));
+ SetEifsNoDifs (MicroSeconds (10 + 304));
+ SetPifs (MicroSeconds (10 + 20));
+ SetCtsTimeout (MicroSeconds (10 + 304 + 20 + GetDefaultMaxPropagationDelay ().GetMicroSeconds () * 2));
+ SetAckTimeout (MicroSeconds (10 + 304 + 20 + GetDefaultMaxPropagationDelay ().GetMicroSeconds () * 2));
}
void
WifiMac::Configure80211_10Mhz (void)
{
- SetSifs(MicroSeconds(32));
- SetSlot(MicroSeconds(13));
- SetEifsNoDifs(MicroSeconds(32+88));
- SetPifs(MicroSeconds(32+13));
- SetCtsTimeout(MicroSeconds(32+88+13+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2));
- SetAckTimeout(MicroSeconds(32+88+13+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2));
+ SetSifs (MicroSeconds (32));
+ SetSlot (MicroSeconds (13));
+ SetEifsNoDifs (MicroSeconds (32 + 88));
+ SetPifs (MicroSeconds (32 + 13));
+ SetCtsTimeout (MicroSeconds (32 + 88 + 13 + GetDefaultMaxPropagationDelay ().GetMicroSeconds () * 2));
+ SetAckTimeout (MicroSeconds (32 + 88 + 13 + GetDefaultMaxPropagationDelay ().GetMicroSeconds () * 2));
}
void
WifiMac::Configure80211_5Mhz (void)
{
- SetSifs(MicroSeconds(64));
- SetSlot(MicroSeconds(21));
- SetEifsNoDifs(MicroSeconds(64+176));
- SetPifs(MicroSeconds(64+21));
- SetCtsTimeout(MicroSeconds(64+176+21+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2));
- SetAckTimeout(MicroSeconds(64+176+21+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2));
+ SetSifs (MicroSeconds (64));
+ SetSlot (MicroSeconds (21));
+ SetEifsNoDifs (MicroSeconds (64 + 176));
+ SetPifs (MicroSeconds (64 + 21));
+ SetCtsTimeout (MicroSeconds (64 + 176 + 21 + GetDefaultMaxPropagationDelay ().GetMicroSeconds () * 2));
+ SetAckTimeout (MicroSeconds (64 + 176 + 21 + GetDefaultMaxPropagationDelay ().GetMicroSeconds () * 2));
}
void
WifiMac::Configure80211p_CCH (void)
{
- SetSifs(MicroSeconds(32));
- SetSlot(MicroSeconds(16));
- SetEifsNoDifs(MicroSeconds(32+88));
- SetPifs(MicroSeconds(32+16));
- SetCtsTimeout(MicroSeconds(32+88+16+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2));
- SetAckTimeout(MicroSeconds(32+88+16+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2));
+ SetSifs (MicroSeconds (32));
+ SetSlot (MicroSeconds (16));
+ SetEifsNoDifs (MicroSeconds (32 + 88));
+ SetPifs (MicroSeconds (32 + 16));
+ SetCtsTimeout (MicroSeconds (32 + 88 + 16 + GetDefaultMaxPropagationDelay ().GetMicroSeconds () * 2));
+ SetAckTimeout (MicroSeconds (32 + 88 + 16 + GetDefaultMaxPropagationDelay ().GetMicroSeconds () * 2));
}
void
WifiMac::Configure80211p_SCH (void)
{
- SetSifs(MicroSeconds(32));
- SetSlot(MicroSeconds(16));
- SetEifsNoDifs(MicroSeconds(32+88));
- SetPifs(MicroSeconds(32+16));
- SetCtsTimeout(MicroSeconds(32+88+16+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2));
- SetAckTimeout(MicroSeconds(32+88+16+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2));
+ SetSifs (MicroSeconds (32));
+ SetSlot (MicroSeconds (16));
+ SetEifsNoDifs (MicroSeconds (32 + 88));
+ SetPifs (MicroSeconds (32 + 16));
+ SetCtsTimeout (MicroSeconds (32 + 88 + 16 + GetDefaultMaxPropagationDelay ().GetMicroSeconds () * 2));
+ SetAckTimeout (MicroSeconds (32 + 88 + 16 + GetDefaultMaxPropagationDelay ().GetMicroSeconds () * 2));
}
void
WifiMac::ConfigureDcf (Ptr<Dcf> dcf, uint32_t cwmin, uint32_t cwmax, enum AcIndex ac)
{
/* see IEE802.11 section 7.3.2.29 */
- switch (ac) {
- case AC_VO:
- dcf->SetMinCw ((cwmin+1)/4-1);
- dcf->SetMaxCw ((cwmin+1)/2-1);
- dcf->SetAifsn (2);
- break;
- case AC_VI:
- dcf->SetMinCw ((cwmin+1)/2-1);
- dcf->SetMaxCw (cwmin);
- dcf->SetAifsn (2);
- break;
- case AC_BE:
- dcf->SetMinCw (cwmin);
- dcf->SetMaxCw (cwmax);
- dcf->SetAifsn (3);
- break;
- case AC_BK:
- dcf->SetMinCw (cwmin);
- dcf->SetMaxCw (cwmax);
- dcf->SetAifsn (7);
- break;
- case AC_BE_NQOS:
- dcf->SetMinCw (cwmin);
- dcf->SetMaxCw (cwmax);
- dcf->SetAifsn (2);
- break;
- case AC_UNDEF:
- NS_FATAL_ERROR ("I don't know what to do with this");
- break;
- }
+ switch (ac)
+ {
+ case AC_VO:
+ dcf->SetMinCw ((cwmin + 1) / 4 - 1);
+ dcf->SetMaxCw ((cwmin + 1) / 2 - 1);
+ dcf->SetAifsn (2);
+ break;
+ case AC_VI:
+ dcf->SetMinCw ((cwmin + 1) / 2 - 1);
+ dcf->SetMaxCw (cwmin);
+ dcf->SetAifsn (2);
+ break;
+ case AC_BE:
+ dcf->SetMinCw (cwmin);
+ dcf->SetMaxCw (cwmax);
+ dcf->SetAifsn (3);
+ break;
+ case AC_BK:
+ dcf->SetMinCw (cwmin);
+ dcf->SetMaxCw (cwmax);
+ dcf->SetAifsn (7);
+ break;
+ case AC_BE_NQOS:
+ dcf->SetMinCw (cwmin);
+ dcf->SetMaxCw (cwmax);
+ dcf->SetAifsn (2);
+ break;
+ case AC_UNDEF:
+ NS_FATAL_ERROR ("I don't know what to do with this");
+ break;
+ }
}
void
WifiMac::ConfigureCCHDcf (Ptr<Dcf> dcf, uint32_t cwmin, uint32_t cwmax, enum AcIndex ac)
{
/* see IEEE 1609.4-2006 section 6.3.1, Table 1 */
- switch (ac) {
- case AC_VO:
- dcf->SetMinCw ((cwmin+1)/4-1);
- dcf->SetMaxCw ((cwmin+1)/2-1);
- dcf->SetAifsn (2);
- break;
- case AC_VI:
- dcf->SetMinCw ((cwmin+1)/4-1);
- dcf->SetMaxCw ((cwmin+1)/2-1);
- dcf->SetAifsn (3);
- break;
- case AC_BE:
- dcf->SetMinCw ((cwmin+1)/2-1);
- dcf->SetMaxCw (cwmin);
- dcf->SetAifsn (6);
- break;
- case AC_BK:
- dcf->SetMinCw (cwmin);
- dcf->SetMaxCw (cwmax);
- dcf->SetAifsn (9);
- break;
- case AC_BE_NQOS:
- dcf->SetMinCw (cwmin);
- dcf->SetMaxCw (cwmax);
- dcf->SetAifsn (2);
- break;
- case AC_UNDEF:
- NS_FATAL_ERROR ("I don't know what to do with this");
- break;
- }
+ switch (ac)
+ {
+ case AC_VO:
+ dcf->SetMinCw ((cwmin + 1) / 4 - 1);
+ dcf->SetMaxCw ((cwmin + 1) / 2 - 1);
+ dcf->SetAifsn (2);
+ break;
+ case AC_VI:
+ dcf->SetMinCw ((cwmin + 1) / 4 - 1);
+ dcf->SetMaxCw ((cwmin + 1) / 2 - 1);
+ dcf->SetAifsn (3);
+ break;
+ case AC_BE:
+ dcf->SetMinCw ((cwmin + 1) / 2 - 1);
+ dcf->SetMaxCw (cwmin);
+ dcf->SetAifsn (6);
+ break;
+ case AC_BK:
+ dcf->SetMinCw (cwmin);
+ dcf->SetMaxCw (cwmax);
+ dcf->SetAifsn (9);
+ break;
+ case AC_BE_NQOS:
+ dcf->SetMinCw (cwmin);
+ dcf->SetMaxCw (cwmax);
+ dcf->SetAifsn (2);
+ break;
+ case AC_UNDEF:
+ NS_FATAL_ERROR ("I don't know what to do with this");
+ break;
+ }
}
} // namespace ns3
--- a/src/wifi/model/wifi-mac.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-mac.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -45,7 +45,7 @@
{
public:
static TypeId GetTypeId (void);
-
+
/**
* \param slotTime the slot duration
*/
@@ -185,31 +185,31 @@
virtual Time GetCompressedBlockAckTimeout (void) const;
/**
- * Public method used to fire a MacTx trace. Implemented for encapsulation
+ * Public method used to fire a MacTx trace. Implemented for encapsulation
* purposes.
*/
void NotifyTx (Ptr<const Packet> packet);
/**
- * Public method used to fire a MacTxDrop trace. Implemented for encapsulation
+ * Public method used to fire a MacTxDrop trace. Implemented for encapsulation
* purposes.
*/
void NotifyTxDrop (Ptr<const Packet> packet);
/**
- * Public method used to fire a MacRx trace. Implemented for encapsulation
+ * Public method used to fire a MacRx trace. Implemented for encapsulation
* purposes.
*/
void NotifyRx (Ptr<const Packet> packet);
/**
- * Public method used to fire a MacPromiscRx trace. Implemented for encapsulation
+ * Public method used to fire a MacPromiscRx trace. Implemented for encapsulation
* purposes.
*/
void NotifyPromiscRx (Ptr<const Packet> packet);
/**
- * Public method used to fire a MacRxDrop trace. Implemented for encapsulation
+ * Public method used to fire a MacRxDrop trace. Implemented for encapsulation
* purposes.
*/
void NotifyRxDrop (Ptr<const Packet> packet);
@@ -270,7 +270,7 @@
/**
* The trace source fired for packets successfully received by the device
- * immediately before being forwarded up to higher layers (at the L2/L3
+ * immediately before being forwarded up to higher layers (at the L2/L3
* transition). This is a promiscuous trace.
*
* \see class CallBackTraceSource
@@ -279,7 +279,7 @@
/**
* The trace source fired for packets successfully received by the device
- * immediately before being forwarded up to higher layers (at the L2/L3
+ * immediately before being forwarded up to higher layers (at the L2/L3
* transition). This is a non- promiscuous trace.
*
* \see class CallBackTraceSource
--- a/src/wifi/model/wifi-mode.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-mode.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006,2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -41,37 +41,37 @@
return is;
}
-uint32_t
+uint32_t
WifiMode::GetBandwidth (void) const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->bandwidth;
}
-uint32_t
+uint32_t
WifiMode::GetPhyRate (void) const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->phyRate;
}
-uint32_t
+uint32_t
WifiMode::GetDataRate (void) const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->dataRate;
}
-enum WifiCodeRate
+enum WifiCodeRate
WifiMode::GetCodeRate (void) const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->codingRate;
}
-uint8_t
+uint8_t
WifiMode::GetConstellationSize (void) const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->constellationSize;
}
-std::string
+std::string
WifiMode::GetUniqueName (void) const
{
// needed for ostream printing of the invalid mode
@@ -84,7 +84,7 @@
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->isMandatory;
}
-uint32_t
+uint32_t
WifiMode::GetUid (void) const
{
return m_uid;
@@ -97,10 +97,12 @@
}
WifiMode::WifiMode ()
: m_uid (0)
-{}
+{
+}
WifiMode::WifiMode (uint32_t uid)
: m_uid (uid)
-{}
+{
+}
WifiMode::WifiMode (std::string name)
{
*this = WifiModeFactory::GetFactory ()->Search (name);
@@ -109,10 +111,11 @@
ATTRIBUTE_HELPER_CPP (WifiMode);
WifiModeFactory::WifiModeFactory ()
-{}
+{
+}
-WifiMode
+WifiMode
WifiModeFactory::CreateWifiMode (std::string uniqueName,
enum WifiModulationClass modClass,
bool isMandatory,
@@ -134,21 +137,22 @@
item->codingRate = codingRate;
- switch (codingRate) {
- case WIFI_CODE_RATE_3_4:
- item->phyRate = dataRate * 4 / 3;
- break;
- case WIFI_CODE_RATE_2_3:
- item->phyRate = dataRate * 3 / 2;
- break;
- case WIFI_CODE_RATE_1_2:
- item->phyRate = dataRate * 2 / 1;
- break;
- case WIFI_CODE_RATE_UNDEFINED:
- default:
- item->phyRate = dataRate;
- break;
- }
+ switch (codingRate)
+ {
+ case WIFI_CODE_RATE_3_4:
+ item->phyRate = dataRate * 4 / 3;
+ break;
+ case WIFI_CODE_RATE_2_3:
+ item->phyRate = dataRate * 3 / 2;
+ break;
+ case WIFI_CODE_RATE_1_2:
+ item->phyRate = dataRate * 2 / 1;
+ break;
+ case WIFI_CODE_RATE_UNDEFINED:
+ default:
+ item->phyRate = dataRate;
+ break;
+ }
// Check for compatibility between modulation class and coding
// rate. If modulation class is DSSS then coding rate must be
@@ -159,7 +163,7 @@
if ((codingRate == WIFI_CODE_RATE_UNDEFINED) != (modClass == WIFI_MOD_CLASS_DSSS))
{
NS_FATAL_ERROR ("Error in creation of WifiMode named " << uniqueName << std::endl
- << "Code rate must be WIFI_CODE_RATE_UNDEFINED iff Modulation Class is WIFI_MOD_CLASS_DSSS");
+ << "Code rate must be WIFI_CODE_RATE_UNDEFINED iff Modulation Class is WIFI_MOD_CLASS_DSSS");
}
item->constellationSize = constellationSize;
@@ -176,9 +180,9 @@
for (i = m_itemList.begin (); i != m_itemList.end (); i++)
{
if (i->uniqueUid == name)
- {
+ {
return WifiMode (j);
- }
+ }
j++;
}
@@ -211,9 +215,9 @@
i != m_itemList.end (); i++)
{
if (i->uniqueUid == uniqueUid)
- {
- return j;
- }
+ {
+ return j;
+ }
j++;
}
uint32_t uid = m_itemList.size ();
--- a/src/wifi/model/wifi-mode.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-mode.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006,2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -33,7 +33,8 @@
* This enumeration defines the modulation classes per IEEE
* 802.11-2007, Section 9.6.1, Table 9-2.
*/
-enum WifiModulationClass {
+enum WifiModulationClass
+{
/** Modulation class unknown or unspecified. A WifiMode with this
WifiModulationClass has not been properly initialised. */
WIFI_MOD_CLASS_UNKNOWN = 0,
@@ -63,7 +64,8 @@
* coding stage in their generation should have this parameter set to
* WIFI_CODE_RATE_UNDEFINED.
*/
-enum WifiCodeRate {
+enum WifiCodeRate
+{
/** No explicit coding (e.g., DSSS rates) */
WIFI_CODE_RATE_UNDEFINED,
/** Rate 3/4 */
@@ -85,7 +87,7 @@
*/
class WifiMode
{
- public:
+public:
/**
* \returns the number of Hz used by this signal
*/
@@ -207,9 +209,9 @@
uint8_t constellationSize);
private:
- friend class WifiMode;
+ friend class WifiMode;
friend std::istream & operator >> (std::istream &is, WifiMode &mode);
- static WifiModeFactory *GetFactory ();
+ static WifiModeFactory* GetFactory ();
WifiModeFactory ();
/**
@@ -217,7 +219,8 @@
* The integer stored in a WifiMode is in fact an index
* in an array of WifiModeItem objects.
*/
- struct WifiModeItem {
+ struct WifiModeItem
+ {
std::string uniqueUid;
uint32_t bandwidth;
uint32_t dataRate;
@@ -230,7 +233,7 @@
WifiMode Search (std::string name);
uint32_t AllocateUid (std::string uniqueName);
- WifiModeItem *Get (uint32_t uid);
+ WifiModeItem* Get (uint32_t uid);
typedef std::vector<struct WifiModeItem> WifiModeItemList;
WifiModeItemList m_itemList;
--- a/src/wifi/model/wifi-net-device.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-net-device.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -36,7 +36,7 @@
NS_OBJECT_ENSURE_REGISTERED (WifiNetDevice);
-TypeId
+TypeId
WifiNetDevice::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::WifiNetDevice")
@@ -66,7 +66,7 @@
MakePointerAccessor (&WifiNetDevice::SetRemoteStationManager,
&WifiNetDevice::GetRemoteStationManager),
MakePointerChecker<WifiRemoteStationManager> ())
- ;
+ ;
return tid;
}
@@ -107,11 +107,11 @@
void
WifiNetDevice::CompleteConfig (void)
{
- if (m_mac == 0 ||
- m_phy == 0 ||
- m_stationManager == 0 ||
- m_node == 0 ||
- m_configComplete)
+ if (m_mac == 0
+ || m_phy == 0
+ || m_stationManager == 0
+ || m_node == 0
+ || m_configComplete)
{
return;
}
@@ -123,72 +123,72 @@
m_stationManager->SetupPhy (m_phy);
m_configComplete = true;
}
-
-void
+
+void
WifiNetDevice::SetMac (Ptr<WifiMac> mac)
{
m_mac = mac;
CompleteConfig ();
}
-void
+void
WifiNetDevice::SetPhy (Ptr<WifiPhy> phy)
{
m_phy = phy;
CompleteConfig ();
}
-void
+void
WifiNetDevice::SetRemoteStationManager (Ptr<WifiRemoteStationManager> manager)
{
m_stationManager = manager;
CompleteConfig ();
}
-Ptr<WifiMac>
+Ptr<WifiMac>
WifiNetDevice::GetMac (void) const
{
return m_mac;
}
-Ptr<WifiPhy>
+Ptr<WifiPhy>
WifiNetDevice::GetPhy (void) const
{
return m_phy;
}
-Ptr<WifiRemoteStationManager>
+Ptr<WifiRemoteStationManager>
WifiNetDevice::GetRemoteStationManager (void) const
{
return m_stationManager;
}
-void
-WifiNetDevice::SetIfIndex(const uint32_t index)
+void
+WifiNetDevice::SetIfIndex (const uint32_t index)
{
m_ifIndex = index;
}
-uint32_t
-WifiNetDevice::GetIfIndex(void) const
+uint32_t
+WifiNetDevice::GetIfIndex (void) const
{
return m_ifIndex;
}
-Ptr<Channel>
+Ptr<Channel>
WifiNetDevice::GetChannel (void) const
{
return m_phy->GetChannel ();
}
-Ptr<WifiChannel>
+Ptr<WifiChannel>
WifiNetDevice::DoGetChannel (void) const
{
return m_phy->GetChannel ();
}
-void
+void
WifiNetDevice::SetAddress (Address address)
{
m_mac->SetAddress (Mac48Address::ConvertFrom (address));
}
-Address
+Address
WifiNetDevice::GetAddress (void) const
{
return m_mac->GetAddress ();
}
-bool
+bool
WifiNetDevice::SetMtu (const uint16_t mtu)
{
if (mtu > MAX_MSDU_SIZE - LLC_SNAP_HEADER_LENGTH)
@@ -198,37 +198,37 @@
m_mtu = mtu;
return true;
}
-uint16_t
+uint16_t
WifiNetDevice::GetMtu (void) const
{
return m_mtu;
}
-bool
+bool
WifiNetDevice::IsLinkUp (void) const
{
return m_phy != 0 && m_linkUp;
}
-void
+void
WifiNetDevice::AddLinkChangeCallback (Callback<void> callback)
{
m_linkChanges.ConnectWithoutContext (callback);
}
-bool
+bool
WifiNetDevice::IsBroadcast (void) const
{
return true;
}
-Address
+Address
WifiNetDevice::GetBroadcast (void) const
{
return Mac48Address::GetBroadcast ();
}
-bool
+bool
WifiNetDevice::IsMulticast (void) const
{
return true;
}
-Address
+Address
WifiNetDevice::GetMulticast (Ipv4Address multicastGroup) const
{
return Mac48Address::GetMulticast (multicastGroup);
@@ -237,17 +237,17 @@
{
return Mac48Address::GetMulticast (addr);
}
-bool
+bool
WifiNetDevice::IsPointToPoint (void) const
{
return false;
}
-bool
+bool
WifiNetDevice::IsBridge (void) const
{
return false;
}
-bool
+bool
WifiNetDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber)
{
NS_ASSERT (Mac48Address::IsMatchingType (dest));
@@ -262,23 +262,23 @@
m_mac->Enqueue (packet, realTo);
return true;
}
-Ptr<Node>
+Ptr<Node>
WifiNetDevice::GetNode (void) const
{
return m_node;
}
-void
+void
WifiNetDevice::SetNode (Ptr<Node> node)
{
m_node = node;
CompleteConfig ();
}
-bool
+bool
WifiNetDevice::NeedsArp (void) const
{
return true;
}
-void
+void
WifiNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb)
{
m_forwardUp = cb;
--- a/src/wifi/model/wifi-net-device.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-net-device.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -48,7 +48,7 @@
* This class holds together ns3::WifiChannel, ns3::WifiPhy,
* ns3::WifiMac, and, ns3::WifiRemoteStationManager.
*/
-class WifiNetDevice : public NetDevice
+class WifiNetDevice : public NetDevice
{
public:
static TypeId GetTypeId (void);
@@ -83,8 +83,8 @@
// inherited from NetDevice base class.
- virtual void SetIfIndex(const uint32_t index);
- virtual uint32_t GetIfIndex(void) const;
+ virtual void SetIfIndex (const uint32_t index);
+ virtual uint32_t GetIfIndex (void) const;
virtual Ptr<Channel> GetChannel (void) const;
virtual void SetAddress (Address address);
virtual Address GetAddress (void) const;
@@ -98,7 +98,7 @@
virtual Address GetMulticast (Ipv4Address multicastGroup) const;
virtual bool IsPointToPoint (void) const;
virtual bool IsBridge (void) const;
- virtual bool Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
+ virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
virtual Ptr<Node> GetNode (void) const;
virtual void SetNode (Ptr<Node> node);
virtual bool NeedsArp (void) const;
@@ -106,12 +106,11 @@
virtual Address GetMulticast (Ipv6Address addr) const;
- virtual bool SendFrom(Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber);
+ virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber);
virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb);
virtual bool SupportsSendFrom (void) const;
private:
-
// This value conforms to the 802.11 specification
static const uint16_t MAX_MSDU_SIZE = 2304;
--- a/src/wifi/model/wifi-phy-standard.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-phy-standard.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -27,7 +27,8 @@
* \ingroup wifi
* Identifies the PHY specification that a Wifi device is configured to use.
*/
-enum WifiPhyStandard {
+enum WifiPhyStandard
+{
/** OFDM PHY for the 5 GHz band (Clause 17) */
WIFI_PHY_STANDARD_80211a,
/** DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18) */
--- a/src/wifi/model/wifi-phy-state-helper.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-phy-state-helper.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -28,7 +28,7 @@
NS_OBJECT_ENSURE_REGISTERED (WifiPhyStateHelper);
-TypeId
+TypeId
WifiPhyStateHelper::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::WifiPhyStateHelper")
@@ -45,7 +45,7 @@
MakeTraceSourceAccessor (&WifiPhyStateHelper::m_rxErrorTrace))
.AddTraceSource ("Tx", "Packet transmission is starting.",
MakeTraceSourceAccessor (&WifiPhyStateHelper::m_txTrace))
- ;
+ ;
return tid;
}
@@ -54,58 +54,58 @@
m_endTx (Seconds (0)),
m_endRx (Seconds (0)),
m_endCcaBusy (Seconds (0)),
- m_endSwitching (Seconds (0)),
+ m_endSwitching (Seconds (0)),
m_startTx (Seconds (0)),
m_startRx (Seconds (0)),
m_startCcaBusy (Seconds (0)),
- m_startSwitching (Seconds (0)),
+ m_startSwitching (Seconds (0)),
m_previousStateChangeTime (Seconds (0))
{
NS_LOG_FUNCTION (this);
}
-void
+void
WifiPhyStateHelper::SetReceiveOkCallback (WifiPhy::RxOkCallback callback)
{
m_rxOkCallback = callback;
}
-void
+void
WifiPhyStateHelper::SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback)
{
m_rxErrorCallback = callback;
}
-void
+void
WifiPhyStateHelper::RegisterListener (WifiPhyListener *listener)
{
m_listeners.push_back (listener);
}
-bool
+bool
WifiPhyStateHelper::IsStateIdle (void)
{
return (GetState () == WifiPhy::IDLE);
}
-bool
+bool
WifiPhyStateHelper::IsStateBusy (void)
{
return (GetState () != WifiPhy::IDLE);
}
-bool
+bool
WifiPhyStateHelper::IsStateCcaBusy (void)
{
return (GetState () == WifiPhy::CCA_BUSY);
}
-bool
+bool
WifiPhyStateHelper::IsStateRx (void)
{
return (GetState () == WifiPhy::RX);
}
-bool
+bool
WifiPhyStateHelper::IsStateTx (void)
{
return (GetState () == WifiPhy::TX);
}
-bool
+bool
WifiPhyStateHelper::IsStateSwitching (void)
{
return (GetState () == WifiPhy::SWITCHING);
@@ -124,104 +124,111 @@
{
Time retval;
- switch (GetState ()) {
- case WifiPhy::RX:
- retval = m_endRx - Simulator::Now ();
- break;
- case WifiPhy::TX:
- retval = m_endTx - Simulator::Now ();
- break;
- case WifiPhy::CCA_BUSY:
- retval = m_endCcaBusy - Simulator::Now ();
- break;
- case WifiPhy::SWITCHING:
- retval = m_endSwitching - Simulator::Now ();
- break;
- case WifiPhy::IDLE:
- retval = Seconds (0);
- break;
- default:
- NS_FATAL_ERROR ("Invalid WifiPhy state.");
- retval = Seconds (0);
- break;
- }
+ switch (GetState ())
+ {
+ case WifiPhy::RX:
+ retval = m_endRx - Simulator::Now ();
+ break;
+ case WifiPhy::TX:
+ retval = m_endTx - Simulator::Now ();
+ break;
+ case WifiPhy::CCA_BUSY:
+ retval = m_endCcaBusy - Simulator::Now ();
+ break;
+ case WifiPhy::SWITCHING:
+ retval = m_endSwitching - Simulator::Now ();
+ break;
+ case WifiPhy::IDLE:
+ retval = Seconds (0);
+ break;
+ default:
+ NS_FATAL_ERROR ("Invalid WifiPhy state.");
+ retval = Seconds (0);
+ break;
+ }
retval = Max (retval, Seconds (0));
return retval;
}
-Time
+Time
WifiPhyStateHelper::GetLastRxStartTime (void) const
{
return m_startRx;
}
-enum WifiPhy::State
+enum WifiPhy::State
WifiPhyStateHelper::GetState (void)
{
- if (m_endTx > Simulator::Now ())
+ if (m_endTx > Simulator::Now ())
{
return WifiPhy::TX;
- }
- else if (m_rxing)
+ }
+ else if (m_rxing)
{
return WifiPhy::RX;
- }
- else if (m_endSwitching > Simulator::Now ())
- {
+ }
+ else if (m_endSwitching > Simulator::Now ())
+ {
return WifiPhy::SWITCHING;
}
- else if (m_endCcaBusy > Simulator::Now ())
+ else if (m_endCcaBusy > Simulator::Now ())
{
return WifiPhy::CCA_BUSY;
- }
- else
+ }
+ else
{
return WifiPhy::IDLE;
}
}
-void
+void
WifiPhyStateHelper::NotifyTxStart (Time duration)
{
- for (Listeners::const_iterator i = m_listeners.begin (); i != m_listeners.end (); i++) {
- (*i)->NotifyTxStart (duration);
- }
+ for (Listeners::const_iterator i = m_listeners.begin (); i != m_listeners.end (); i++)
+ {
+ (*i)->NotifyTxStart (duration);
+ }
}
-void
+void
WifiPhyStateHelper::NotifyRxStart (Time duration)
{
- for (Listeners::const_iterator i = m_listeners.begin (); i != m_listeners.end (); i++) {
- (*i)->NotifyRxStart (duration);
- }
+ for (Listeners::const_iterator i = m_listeners.begin (); i != m_listeners.end (); i++)
+ {
+ (*i)->NotifyRxStart (duration);
+ }
}
-void
+void
WifiPhyStateHelper::NotifyRxEndOk (void)
{
- for (Listeners::const_iterator i = m_listeners.begin (); i != m_listeners.end (); i++) {
- (*i)->NotifyRxEndOk ();
- }
+ for (Listeners::const_iterator i = m_listeners.begin (); i != m_listeners.end (); i++)
+ {
+ (*i)->NotifyRxEndOk ();
+ }
}
-void
+void
WifiPhyStateHelper::NotifyRxEndError (void)
{
- for (Listeners::const_iterator i = m_listeners.begin (); i != m_listeners.end (); i++) {
- (*i)->NotifyRxEndError ();
- }
+ for (Listeners::const_iterator i = m_listeners.begin (); i != m_listeners.end (); i++)
+ {
+ (*i)->NotifyRxEndError ();
+ }
}
-void
+void
WifiPhyStateHelper::NotifyMaybeCcaBusyStart (Time duration)
{
- for (Listeners::const_iterator i = m_listeners.begin (); i != m_listeners.end (); i++) {
- (*i)->NotifyMaybeCcaBusyStart (duration);
- }
+ for (Listeners::const_iterator i = m_listeners.begin (); i != m_listeners.end (); i++)
+ {
+ (*i)->NotifyMaybeCcaBusyStart (duration);
+ }
}
-void
+void
WifiPhyStateHelper::NotifySwitchingStart (Time duration)
{
- for (Listeners::const_iterator i = m_listeners.begin (); i != m_listeners.end (); i++) {
- (*i)->NotifySwitchingStart (duration);
- }
+ for (Listeners::const_iterator i = m_listeners.begin (); i != m_listeners.end (); i++)
+ {
+ (*i)->NotifySwitchingStart (duration);
+ }
}
void
@@ -230,49 +237,52 @@
Time now = Simulator::Now ();
Time idleStart = Max (m_endCcaBusy, m_endRx);
idleStart = Max (idleStart, m_endTx);
- idleStart = Max (idleStart, m_endSwitching);
+ idleStart = Max (idleStart, m_endSwitching);
NS_ASSERT (idleStart <= now);
- if (m_endCcaBusy > m_endRx &&
- m_endCcaBusy > m_endSwitching &&
- m_endCcaBusy > m_endTx) {
- Time ccaBusyStart = Max (m_endTx, m_endRx);
- ccaBusyStart = Max (ccaBusyStart, m_startCcaBusy);
- ccaBusyStart = Max (ccaBusyStart, m_endSwitching);
- m_stateLogger (ccaBusyStart, idleStart - ccaBusyStart, WifiPhy::CCA_BUSY);
- }
+ if (m_endCcaBusy > m_endRx
+ && m_endCcaBusy > m_endSwitching
+ && m_endCcaBusy > m_endTx)
+ {
+ Time ccaBusyStart = Max (m_endTx, m_endRx);
+ ccaBusyStart = Max (ccaBusyStart, m_startCcaBusy);
+ ccaBusyStart = Max (ccaBusyStart, m_endSwitching);
+ m_stateLogger (ccaBusyStart, idleStart - ccaBusyStart, WifiPhy::CCA_BUSY);
+ }
m_stateLogger (idleStart, now - idleStart, WifiPhy::IDLE);
}
void
-WifiPhyStateHelper::SwitchToTx (Time txDuration, Ptr<const Packet> packet, WifiMode txMode,
- WifiPreamble preamble, uint8_t txPower)
+WifiPhyStateHelper::SwitchToTx (Time txDuration, Ptr<const Packet> packet, WifiMode txMode,
+ WifiPreamble preamble, uint8_t txPower)
{
m_txTrace (packet, txMode, preamble, txPower);
NotifyTxStart (txDuration);
Time now = Simulator::Now ();
- switch (GetState ()) {
- case WifiPhy::RX:
- /* The packet which is being received as well
- * as its endRx event are cancelled by the caller.
- */
- m_rxing = false;
- m_stateLogger (m_startRx, now - m_startRx, WifiPhy::RX);
- m_endRx = now;
- break;
- case WifiPhy::CCA_BUSY: {
- Time ccaStart = Max (m_endRx, m_endTx);
- ccaStart = Max (ccaStart, m_startCcaBusy);
- ccaStart = Max (ccaStart, m_endSwitching);
- m_stateLogger (ccaStart, now - ccaStart, WifiPhy::CCA_BUSY);
- } break;
- case WifiPhy::IDLE:
- LogPreviousIdleAndCcaBusyStates ();
- break;
- case WifiPhy::SWITCHING:
- default:
- NS_FATAL_ERROR ("Invalid WifiPhy state.");
- break;
- }
+ switch (GetState ())
+ {
+ case WifiPhy::RX:
+ /* The packet which is being received as well
+ * as its endRx event are cancelled by the caller.
+ */
+ m_rxing = false;
+ m_stateLogger (m_startRx, now - m_startRx, WifiPhy::RX);
+ m_endRx = now;
+ break;
+ case WifiPhy::CCA_BUSY:
+ {
+ Time ccaStart = Max (m_endRx, m_endTx);
+ ccaStart = Max (ccaStart, m_startCcaBusy);
+ ccaStart = Max (ccaStart, m_endSwitching);
+ m_stateLogger (ccaStart, now - ccaStart, WifiPhy::CCA_BUSY);
+ } break;
+ case WifiPhy::IDLE:
+ LogPreviousIdleAndCcaBusyStates ();
+ break;
+ case WifiPhy::SWITCHING:
+ default:
+ NS_FATAL_ERROR ("Invalid WifiPhy state.");
+ break;
+ }
m_stateLogger (now, txDuration, WifiPhy::TX);
m_previousStateChangeTime = now;
m_endTx = now + txDuration;
@@ -285,22 +295,24 @@
NS_ASSERT (!m_rxing);
NotifyRxStart (rxDuration);
Time now = Simulator::Now ();
- switch (GetState ()) {
- case WifiPhy::IDLE:
- LogPreviousIdleAndCcaBusyStates ();
- break;
- case WifiPhy::CCA_BUSY: {
- Time ccaStart = Max (m_endRx, m_endTx);
- ccaStart = Max (ccaStart, m_startCcaBusy);
- ccaStart = Max (ccaStart, m_endSwitching);
- m_stateLogger (ccaStart, now - ccaStart, WifiPhy::CCA_BUSY);
- } break;
- case WifiPhy::SWITCHING:
- case WifiPhy::RX:
- case WifiPhy::TX:
- NS_FATAL_ERROR ("Invalid WifiPhy state.");
- break;
- }
+ switch (GetState ())
+ {
+ case WifiPhy::IDLE:
+ LogPreviousIdleAndCcaBusyStates ();
+ break;
+ case WifiPhy::CCA_BUSY:
+ {
+ Time ccaStart = Max (m_endRx, m_endTx);
+ ccaStart = Max (ccaStart, m_startCcaBusy);
+ ccaStart = Max (ccaStart, m_endSwitching);
+ m_stateLogger (ccaStart, now - ccaStart, WifiPhy::CCA_BUSY);
+ } break;
+ case WifiPhy::SWITCHING:
+ case WifiPhy::RX:
+ case WifiPhy::TX:
+ NS_FATAL_ERROR ("Invalid WifiPhy state.");
+ break;
+ }
m_previousStateChangeTime = now;
m_rxing = true;
m_startRx = now;
@@ -308,39 +320,41 @@
NS_ASSERT (IsStateRx ());
}
-void
+void
WifiPhyStateHelper::SwitchToChannelSwitching (Time switchingDuration)
-{
- NotifySwitchingStart (switchingDuration);
+{
+ NotifySwitchingStart (switchingDuration);
Time now = Simulator::Now ();
- switch (GetState ()) {
- case WifiPhy::RX:
- /* The packet which is being received as well
- * as its endRx event are cancelled by the caller.
- */
- m_rxing = false;
- m_stateLogger (m_startRx, now - m_startRx, WifiPhy::RX);
- m_endRx = now;
- break;
- case WifiPhy::CCA_BUSY: {
- Time ccaStart = Max (m_endRx, m_endTx);
- ccaStart = Max (ccaStart, m_startCcaBusy);
- ccaStart = Max (ccaStart, m_endSwitching);
- m_stateLogger (ccaStart, now - ccaStart, WifiPhy::CCA_BUSY);
- } break;
- case WifiPhy::IDLE:
- LogPreviousIdleAndCcaBusyStates ();
- break;
- case WifiPhy::TX:
- case WifiPhy::SWITCHING:
- default:
- NS_FATAL_ERROR ("Invalid WifiPhy state.");
- break;
- }
-
+ switch (GetState ())
+ {
+ case WifiPhy::RX:
+ /* The packet which is being received as well
+ * as its endRx event are cancelled by the caller.
+ */
+ m_rxing = false;
+ m_stateLogger (m_startRx, now - m_startRx, WifiPhy::RX);
+ m_endRx = now;
+ break;
+ case WifiPhy::CCA_BUSY:
+ {
+ Time ccaStart = Max (m_endRx, m_endTx);
+ ccaStart = Max (ccaStart, m_startCcaBusy);
+ ccaStart = Max (ccaStart, m_endSwitching);
+ m_stateLogger (ccaStart, now - ccaStart, WifiPhy::CCA_BUSY);
+ } break;
+ case WifiPhy::IDLE:
+ LogPreviousIdleAndCcaBusyStates ();
+ break;
+ case WifiPhy::TX:
+ case WifiPhy::SWITCHING:
+ default:
+ NS_FATAL_ERROR ("Invalid WifiPhy state.");
+ break;
+ }
+
if (now < m_endCcaBusy)
{
- m_endCcaBusy = now;
+ m_endCcaBusy = now;
}
m_stateLogger (now, switchingDuration, WifiPhy::SWITCHING);
@@ -350,7 +364,7 @@
NS_ASSERT (IsStateSwitching ());
}
-void
+void
WifiPhyStateHelper::SwitchFromRxEndOk (Ptr<Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble)
{
m_rxOkTrace (packet, snr, mode, preamble);
@@ -362,7 +376,7 @@
}
}
-void
+void
WifiPhyStateHelper::SwitchFromRxEndError (Ptr<const Packet> packet, double snr)
{
m_rxErrorTrace (packet, snr);
@@ -392,19 +406,20 @@
{
NotifyMaybeCcaBusyStart (duration);
Time now = Simulator::Now ();
- switch (GetState ()) {
- case WifiPhy::SWITCHING:
- break;
- case WifiPhy::IDLE:
- LogPreviousIdleAndCcaBusyStates ();
- break;
- case WifiPhy::CCA_BUSY:
- break;
- case WifiPhy::RX:
- break;
- case WifiPhy::TX:
- break;
- }
+ switch (GetState ())
+ {
+ case WifiPhy::SWITCHING:
+ break;
+ case WifiPhy::IDLE:
+ LogPreviousIdleAndCcaBusyStates ();
+ break;
+ case WifiPhy::CCA_BUSY:
+ break;
+ case WifiPhy::RX:
+ break;
+ case WifiPhy::TX:
+ break;
+ }
m_startCcaBusy = now;
m_endCcaBusy = std::max (m_endCcaBusy, now + duration);
}
--- a/src/wifi/model/wifi-phy-state-helper.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-phy-state-helper.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -29,7 +29,7 @@
/**
* \ingroup wifi
- *
+ *
* This objects implements the PHY state machine of the Wifi device.
*/
class WifiPhyStateHelper : public Object
@@ -55,7 +55,7 @@
void SwitchToTx (Time txDuration, Ptr<const Packet> packet, WifiMode txMode, WifiPreamble preamble, uint8_t txPower);
void SwitchToRx (Time rxDuration);
- void SwitchToChannelSwitching (Time switchingDuration);
+ void SwitchToChannelSwitching (Time switchingDuration);
void SwitchFromRxEndOk (Ptr<Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble);
void SwitchFromRxEndError (Ptr<const Packet> packet, double snr);
void SwitchMaybeToCcaBusy (Time duration);
@@ -72,18 +72,18 @@
void NotifyRxEndOk (void);
void NotifyRxEndError (void);
void NotifyMaybeCcaBusyStart (Time duration);
- void NotifySwitchingStart (Time duration);
+ void NotifySwitchingStart (Time duration);
void DoSwitchFromRx (void);
bool m_rxing;
Time m_endTx;
Time m_endRx;
Time m_endCcaBusy;
- Time m_endSwitching;
+ Time m_endSwitching;
Time m_startTx;
Time m_startRx;
Time m_startCcaBusy;
- Time m_startSwitching;
+ Time m_startSwitching;
Time m_previousStateChangeTime;
Listeners m_listeners;
--- a/src/wifi/model/wifi-phy.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-phy.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -42,7 +42,8 @@
****************************************************************/
WifiPhyListener::~WifiPhyListener ()
-{}
+{
+}
/****************************************************************
* The actual WifiPhy class
@@ -50,36 +51,36 @@
NS_OBJECT_ENSURE_REGISTERED (WifiPhy);
-TypeId
+TypeId
WifiPhy::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::WifiPhy")
.SetParent<Object> ()
- .AddTraceSource ("PhyTxBegin",
+ .AddTraceSource ("PhyTxBegin",
"Trace source indicating a packet has begun transmitting over the channel medium",
MakeTraceSourceAccessor (&WifiPhy::m_phyTxBeginTrace))
- .AddTraceSource ("PhyTxEnd",
+ .AddTraceSource ("PhyTxEnd",
"Trace source indicating a packet has been completely transmitted over the channel. NOTE: the only official WifiPhy implementation available to this date (YansWifiPhy) never fires this trace source.",
MakeTraceSourceAccessor (&WifiPhy::m_phyTxEndTrace))
- .AddTraceSource ("PhyTxDrop",
+ .AddTraceSource ("PhyTxDrop",
"Trace source indicating a packet has been dropped by the device during transmission",
MakeTraceSourceAccessor (&WifiPhy::m_phyTxDropTrace))
- .AddTraceSource ("PhyRxBegin",
+ .AddTraceSource ("PhyRxBegin",
"Trace source indicating a packet has begun being received from the channel medium by the device",
MakeTraceSourceAccessor (&WifiPhy::m_phyRxBeginTrace))
- .AddTraceSource ("PhyRxEnd",
+ .AddTraceSource ("PhyRxEnd",
"Trace source indicating a packet has been completely received from the channel medium by the device",
MakeTraceSourceAccessor (&WifiPhy::m_phyRxEndTrace))
- .AddTraceSource ("PhyRxDrop",
+ .AddTraceSource ("PhyRxDrop",
"Trace source indicating a packet has been dropped by the device during reception",
MakeTraceSourceAccessor (&WifiPhy::m_phyRxDropTrace))
- .AddTraceSource ("PromiscSnifferRx",
+ .AddTraceSource ("PromiscSnifferRx",
"Trace source simulating a wifi device in monitor mode sniffing all received frames",
MakeTraceSourceAccessor (&WifiPhy::m_phyPromiscSniffRxTrace))
- .AddTraceSource ("PromiscSnifferTx",
+ .AddTraceSource ("PromiscSnifferTx",
"Trace source simulating the capability of a wifi device in monitor mode to sniff all frames being transmitted",
MakeTraceSourceAccessor (&WifiPhy::m_phyPromiscSniffTxTrace))
- ;
+ ;
return tid;
}
@@ -93,49 +94,49 @@
NS_LOG_FUNCTION (this);
}
-void
+void
WifiPhy::NotifyTxBegin (Ptr<const Packet> packet)
{
m_phyTxBeginTrace (packet);
}
-void
+void
WifiPhy::NotifyTxEnd (Ptr<const Packet> packet)
{
m_phyTxEndTrace (packet);
}
-void
-WifiPhy::NotifyTxDrop (Ptr<const Packet> packet)
+void
+WifiPhy::NotifyTxDrop (Ptr<const Packet> packet)
{
m_phyTxDropTrace (packet);
}
-void
-WifiPhy::NotifyRxBegin (Ptr<const Packet> packet)
+void
+WifiPhy::NotifyRxBegin (Ptr<const Packet> packet)
{
m_phyRxBeginTrace (packet);
}
-void
-WifiPhy::NotifyRxEnd (Ptr<const Packet> packet)
+void
+WifiPhy::NotifyRxEnd (Ptr<const Packet> packet)
{
m_phyRxEndTrace (packet);
}
-void
-WifiPhy::NotifyRxDrop (Ptr<const Packet> packet)
+void
+WifiPhy::NotifyRxDrop (Ptr<const Packet> packet)
{
m_phyRxDropTrace (packet);
}
-void
+void
WifiPhy::NotifyPromiscSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, double signalDbm, double noiseDbm)
{
m_phyPromiscSniffRxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble, signalDbm, noiseDbm);
}
-void
+void
WifiPhy::NotifyPromiscSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble)
{
m_phyPromiscSniffTxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble);
@@ -630,21 +631,22 @@
std::ostream& operator<< (std::ostream& os, enum WifiPhy::State state)
{
- switch (state) {
- case WifiPhy::IDLE:
- return (os << "IDLE");
- case WifiPhy::CCA_BUSY:
- return (os << "CCA_BUSY");
- case WifiPhy::TX:
- return (os << "TX");
- case WifiPhy::RX:
- return (os << "RX");
- case WifiPhy::SWITCHING:
- return (os << "SWITCHING");
- default:
- NS_FATAL_ERROR ("Invalid WifiPhy state");
- return (os << "INVALID");
- }
+ switch (state)
+ {
+ case WifiPhy::IDLE:
+ return (os << "IDLE");
+ case WifiPhy::CCA_BUSY:
+ return (os << "CCA_BUSY");
+ case WifiPhy::TX:
+ return (os << "TX");
+ case WifiPhy::RX:
+ return (os << "RX");
+ case WifiPhy::SWITCHING:
+ return (os << "SWITCHING");
+ default:
+ NS_FATAL_ERROR ("Invalid WifiPhy state");
+ return (os << "INVALID");
+ }
}
} // namespace ns3
@@ -654,7 +656,8 @@
static class Constructor
{
public:
- Constructor () {
+ Constructor ()
+ {
ns3::WifiPhy::GetDsssRate1Mbps ();
ns3::WifiPhy::GetDsssRate2Mbps ();
ns3::WifiPhy::GetDsssRate5_5Mbps ();
--- a/src/wifi/model/wifi-phy.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-phy.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -41,7 +41,8 @@
/**
* \brief receive notifications about phy events.
*/
-class WifiPhyListener {
+class WifiPhyListener
+{
public:
virtual ~WifiPhyListener ();
@@ -63,7 +64,7 @@
* NotifyRxStart was invoked first and, the packet has
* been successfully received.
*/
- virtual void NotifyRxEndOk (void) = 0;
+ virtual void NotifyRxEndOk (void) = 0;
/**
* We have received the last bit of a packet for which
* NotifyRxStart was invoked first and, the packet has
@@ -74,7 +75,7 @@
* \param duration the expected transmission duration.
*
* We are about to send the first bit of the packet.
- * We do not send any event to notify the end of
+ * We do not send any event to notify the end of
* transmission. Listeners should assume that the
* channel implicitely reverts to the idle state
* unless they have received a cca busy report.
@@ -87,8 +88,8 @@
* This method does not really report a real state
* change as opposed to the other methods in this class.
* It merely reports that, unless the medium is reported
- * busy through NotifyTxStart or NotifyRxStart/End,
- * it will be busy as defined by the currently selected
+ * busy through NotifyTxStart or NotifyRxStart/End,
+ * it will be busy as defined by the currently selected
* CCA mode.
*
* Typical client code which wants to have a clear picture
@@ -100,11 +101,11 @@
/**
* \param duration the expected channel switching duration.
*
- * We do not send any event to notify the end of
+ * We do not send any event to notify the end of
* channel switching. Listeners should assume that the
* channel implicitely reverts to the idle or busy states.
*/
- virtual void NotifySwitchingStart (Time duration) = 0;
+ virtual void NotifySwitchingStart (Time duration) = 0;
};
@@ -119,7 +120,8 @@
/**
* The state of the PHY layer.
*/
- enum State {
+ enum State
+ {
/**
* The PHY layer is IDLE.
*/
@@ -287,20 +289,20 @@
*/
virtual double CalculateSnr (WifiMode txMode, double ber) const = 0;
- /**
- * \brief Set channel number.
- *
+ /**
+ * \brief Set channel number.
+ *
* Channel center frequency = Channel starting frequency + 5 MHz * (nch - 1)
*
* where Starting channel frequency is standard-dependent, see SetStandard()
* as defined in IEEE 802.11-2007 17.3.8.3.2.
- */
+ */
virtual void SetChannelNumber (uint16_t id) = 0;
/// Return current channel number, see SetChannelNumber()
virtual uint16_t GetChannelNumber () const = 0;
virtual void ConfigureStandard (enum WifiPhyStandard standard) = 0;
-
+
virtual Ptr<WifiChannel> GetChannel (void) const = 0;
static WifiMode GetDsssRate1Mbps ();
@@ -342,46 +344,46 @@
/**
- * Public method used to fire a PhyTxBegin trace. Implemented for encapsulation
+ * Public method used to fire a PhyTxBegin trace. Implemented for encapsulation
* purposes.
*/
void NotifyTxBegin (Ptr<const Packet> packet);
/**
- * Public method used to fire a PhyTxEnd trace. Implemented for encapsulation
+ * Public method used to fire a PhyTxEnd trace. Implemented for encapsulation
* purposes.
*/
void NotifyTxEnd (Ptr<const Packet> packet);
/**
- * Public method used to fire a PhyTxDrop trace. Implemented for encapsulation
+ * Public method used to fire a PhyTxDrop trace. Implemented for encapsulation
* purposes.
*/
void NotifyTxDrop (Ptr<const Packet> packet);
/**
- * Public method used to fire a PhyRxBegin trace. Implemented for encapsulation
+ * Public method used to fire a PhyRxBegin trace. Implemented for encapsulation
* purposes.
*/
void NotifyRxBegin (Ptr<const Packet> packet);
/**
- * Public method used to fire a PhyRxEnd trace. Implemented for encapsulation
+ * Public method used to fire a PhyRxEnd trace. Implemented for encapsulation
* purposes.
*/
void NotifyRxEnd (Ptr<const Packet> packet);
/**
- * Public method used to fire a PhyRxDrop trace. Implemented for encapsulation
+ * Public method used to fire a PhyRxDrop trace. Implemented for encapsulation
* purposes.
*/
void NotifyRxDrop (Ptr<const Packet> packet);
- /**
- *
- * Public method used to fire a PromiscSniffer trace for a wifi packet being received. Implemented for encapsulation
+ /**
+ *
+ * Public method used to fire a PromiscSniffer trace for a wifi packet being received. Implemented for encapsulation
* purposes.
- *
+ *
* @param packet the packet being received
* @param channelFreqMhz the frequency in MHz at which the packet is
* received. Note that in real devices this is normally the
@@ -392,29 +394,29 @@
* on a nearby channel.
* @param channelNumber the channel on which the packet is received
* @param rate the PHY data rate in units of 500kbps (i.e., the same
- * units used both for the radiotap and for the prism header)
+ * units used both for the radiotap and for the prism header)
* @param isShortPreamble true if short preamble is used, false otherwise
* @param signalDbm signal power in dBm
* @param noiseDbm noise power in dBm
*/
- void NotifyPromiscSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble,
+ void NotifyPromiscSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble,
double signalDbm, double noiseDbm);
- /**
- *
- * Public method used to fire a PromiscSniffer trace for a wifi packet being transmitted. Implemented for encapsulation
+ /**
+ *
+ * Public method used to fire a PromiscSniffer trace for a wifi packet being transmitted. Implemented for encapsulation
* purposes.
- *
+ *
* @param packet the packet being transmitted
* @param channelFreqMhz the frequency in MHz at which the packet is
- * transmitted.
+ * transmitted.
* @param channelNumber the channel on which the packet is transmitted
* @param rate the PHY data rate in units of 500kbps (i.e., the same
- * units used both for the radiotap and for the prism header)
+ * units used both for the radiotap and for the prism header)
* @param isShortPreamble true if short preamble is used, false otherwise
*/
void NotifyPromiscSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble);
-
+
private:
/**
@@ -466,8 +468,8 @@
/**
* A trace source that emulates a wifi device in monitor mode
- * sniffing a packet being received.
- *
+ * sniffing a packet being received.
+ *
* As a reference with the real world, firing this trace
* corresponds in the madwifi driver to calling the function
* ieee80211_input_monitor()
@@ -478,8 +480,8 @@
/**
* A trace source that emulates a wifi device in monitor mode
- * sniffing a packet being transmitted.
- *
+ * sniffing a packet being transmitted.
+ *
* As a reference with the real world, firing this trace
* corresponds in the madwifi driver to calling the function
* ieee80211_input_monitor()
--- a/src/wifi/model/wifi-preamble.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-preamble.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006,2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -26,7 +26,8 @@
* \ingroup wifi
* The type of preamble to be used by an IEEE 802.11 transmission
*/
-enum WifiPreamble {
+enum WifiPreamble
+{
WIFI_PREAMBLE_LONG,
WIFI_PREAMBLE_SHORT
};
--- a/src/wifi/model/wifi-remote-station-manager.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-remote-station-manager.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006,2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -36,7 +36,7 @@
/***************************************************************
* Packet Mode Tagger
- ***************************************************************/
+ ***************************************************************/
namespace ns3 {
@@ -60,63 +60,65 @@
};
TxModeTag::TxModeTag ()
-{}
+{
+}
TxModeTag::TxModeTag (WifiMode rtsMode, WifiMode dataMode)
: m_rtsMode (rtsMode),
m_dataMode (dataMode)
-{}
-WifiMode
+{
+}
+WifiMode
TxModeTag::GetRtsMode (void) const
{
return m_rtsMode;
}
-WifiMode
+WifiMode
TxModeTag::GetDataMode (void) const
{
return m_dataMode;
}
-TypeId
+TypeId
TxModeTag::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::TxModeTag")
.SetParent<Tag> ()
.AddConstructor<TxModeTag> ()
- .AddAttribute ("RtsTxMode",
+ .AddAttribute ("RtsTxMode",
"Tx mode of rts to use later",
EmptyAttributeValue (),
MakeWifiModeAccessor (&TxModeTag::GetRtsMode),
MakeWifiModeChecker ())
- .AddAttribute ("DataTxMode",
+ .AddAttribute ("DataTxMode",
"Tx mode of data to use later",
EmptyAttributeValue (),
MakeWifiModeAccessor (&TxModeTag::GetDataMode),
MakeWifiModeChecker ())
- ;
+ ;
return tid;
}
-TypeId
+TypeId
TxModeTag::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
-uint32_t
+uint32_t
TxModeTag::GetSerializedSize (void) const
{
return sizeof (WifiMode) * 2;
}
-void
+void
TxModeTag::Serialize (TagBuffer i) const
{
i.Write ((uint8_t *)&m_rtsMode, sizeof (WifiMode));
i.Write ((uint8_t *)&m_dataMode, sizeof (WifiMode));
}
-void
+void
TxModeTag::Deserialize (TagBuffer i)
{
i.Read ((uint8_t *)&m_rtsMode, sizeof (WifiMode));
i.Read ((uint8_t *)&m_dataMode, sizeof (WifiMode));
}
-void
+void
TxModeTag::Print (std::ostream &os) const
{
os << "Rts=" << m_rtsMode << ", Data=" << m_dataMode;
@@ -129,7 +131,7 @@
NS_OBJECT_ENSURE_REGISTERED (WifiRemoteStationManager);
-TypeId
+TypeId
WifiRemoteStationManager::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::WifiRemoteStationManager")
@@ -169,37 +171,38 @@
WifiModeValue (),
MakeWifiModeAccessor (&WifiRemoteStationManager::m_nonUnicastMode),
MakeWifiModeChecker ())
- .AddTraceSource ("MacTxRtsFailed",
+ .AddTraceSource ("MacTxRtsFailed",
"The transmission of a RTS by the MAC layer has failed",
MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxRtsFailed))
- .AddTraceSource ("MacTxDataFailed",
+ .AddTraceSource ("MacTxDataFailed",
"The transmission of a data packet by the MAC layer has failed",
MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxDataFailed))
- .AddTraceSource ("MacTxFinalRtsFailed",
+ .AddTraceSource ("MacTxFinalRtsFailed",
"The transmission of a RTS has exceeded the maximum number of attempts",
MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxFinalRtsFailed))
- .AddTraceSource ("MacTxFinalDataFailed",
+ .AddTraceSource ("MacTxFinalDataFailed",
"The transmission of a data packet has exceeded the maximum number of attempts",
MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxFinalDataFailed))
- ;
+ ;
return tid;
}
WifiRemoteStationManager::WifiRemoteStationManager ()
-{}
+{
+}
WifiRemoteStationManager::~WifiRemoteStationManager ()
{
}
-void
+void
WifiRemoteStationManager::DoDispose (void)
{
- for (StationStates::const_iterator i = m_states.begin (); i != m_states.end (); i++)
+ for (StationStates::const_iterator i = m_states.begin (); i != m_states.end (); i++)
{
delete (*i);
}
m_states.clear ();
- for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++)
+ for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++)
{
delete (*i);
}
@@ -218,46 +221,46 @@
Reset ();
}
-uint32_t
+uint32_t
WifiRemoteStationManager::GetMaxSsrc (void) const
{
return m_maxSsrc;
}
-uint32_t
+uint32_t
WifiRemoteStationManager::GetMaxSlrc (void) const
{
return m_maxSlrc;
}
-uint32_t
+uint32_t
WifiRemoteStationManager::GetRtsCtsThreshold (void) const
{
return m_rtsCtsThreshold;
}
-uint32_t
+uint32_t
WifiRemoteStationManager::GetFragmentationThreshold (void) const
{
return m_fragmentationThreshold;
}
-void
+void
WifiRemoteStationManager::SetMaxSsrc (uint32_t maxSsrc)
{
m_maxSsrc = maxSsrc;
}
-void
+void
WifiRemoteStationManager::SetMaxSlrc (uint32_t maxSlrc)
{
m_maxSlrc = maxSlrc;
}
-void
+void
WifiRemoteStationManager::SetRtsCtsThreshold (uint32_t threshold)
{
m_rtsCtsThreshold = threshold;
}
-void
+void
WifiRemoteStationManager::SetFragmentationThreshold (uint32_t threshold)
{
m_fragmentationThreshold = threshold;
-}
+}
void
WifiRemoteStationManager::Reset (Mac48Address address)
@@ -638,7 +641,7 @@
if (!found)
{
NS_FATAL_ERROR ("Can't find response rate for " << reqMode
- << ". Check standard and selected rates match.");
+ << ". Check standard and selected rates match.");
}
return mode;
@@ -657,7 +660,7 @@
return GetControlAnswerMode (address, dataMode);
}
-WifiRemoteStationInfo
+WifiRemoteStationInfo
WifiRemoteStationManager::GetInfo (Mac48Address address)
{
WifiRemoteStationState *state = LookupState (address);
@@ -667,7 +670,7 @@
WifiRemoteStationState *
WifiRemoteStationManager::LookupState (Mac48Address address) const
{
- for (StationStates::const_iterator i = m_states.begin (); i != m_states.end (); i++)
+ for (StationStates::const_iterator i = m_states.begin (); i != m_states.end (); i++)
{
if ((*i)->m_address == address)
{
@@ -698,16 +701,16 @@
WifiRemoteStation *
WifiRemoteStationManager::Lookup (Mac48Address address, uint8_t tid) const
{
- for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++)
+ for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++)
{
- if ((*i)->m_tid == tid &&
- (*i)->m_state->m_address == address)
+ if ((*i)->m_tid == tid
+ && (*i)->m_state->m_address == address)
{
return (*i);
}
}
WifiRemoteStationState *state = LookupState (address);
-
+
WifiRemoteStation *station = DoCreateStation ();
station->m_state = state;
station->m_tid = tid;
@@ -716,10 +719,10 @@
// XXX
const_cast<WifiRemoteStationManager *> (this)->m_stations.push_back (station);
return station;
-
+
}
-WifiMode
+WifiMode
WifiRemoteStationManager::GetDefaultMode (void) const
{
return m_defaultTxMode;
@@ -736,7 +739,7 @@
m_bssBasicRateSet.push_back (m_defaultTxMode);
NS_ASSERT (m_defaultTxMode.IsMandatory ());
}
-void
+void
WifiRemoteStationManager::AddBasicMode (WifiMode mode)
{
for (uint32_t i = 0; i < GetNBasicModes (); i++)
@@ -748,12 +751,12 @@
}
m_bssBasicRateSet.push_back (mode);
}
-uint32_t
+uint32_t
WifiRemoteStationManager::GetNBasicModes (void) const
{
return m_bssBasicRateSet.size ();
}
-WifiMode
+WifiMode
WifiRemoteStationManager::GetBasicMode (uint32_t i) const
{
NS_ASSERT (i < m_bssBasicRateSet.size ());
@@ -764,7 +767,7 @@
{
if (m_nonUnicastMode == WifiMode ())
{
- return GetBasicMode(0);
+ return GetBasicMode (0);
}
else
{
@@ -772,56 +775,56 @@
}
}
-bool
-WifiRemoteStationManager::DoNeedRts (WifiRemoteStation *station,
+bool
+WifiRemoteStationManager::DoNeedRts (WifiRemoteStation *station,
Ptr<const Packet> packet, bool normally)
{
return normally;
}
-bool
-WifiRemoteStationManager::DoNeedRtsRetransmission (WifiRemoteStation *station,
+bool
+WifiRemoteStationManager::DoNeedRtsRetransmission (WifiRemoteStation *station,
Ptr<const Packet> packet, bool normally)
{
- return normally;
+ return normally;
}
bool
-WifiRemoteStationManager::DoNeedDataRetransmission (WifiRemoteStation *station,
+WifiRemoteStationManager::DoNeedDataRetransmission (WifiRemoteStation *station,
Ptr<const Packet> packet, bool normally)
{
return normally;
}
bool
-WifiRemoteStationManager::DoNeedFragmentation (WifiRemoteStation *station,
+WifiRemoteStationManager::DoNeedFragmentation (WifiRemoteStation *station,
Ptr<const Packet> packet, bool normally)
{
return normally;
}
-WifiMode
+WifiMode
WifiRemoteStationManager::GetSupported (const WifiRemoteStation *station, uint32_t i) const
{
NS_ASSERT (i < GetNSupported (station));
return station->m_state->m_operationalRateSet[i];
}
-uint32_t
+uint32_t
WifiRemoteStationManager::GetNSupported (const WifiRemoteStation *station) const
{
return station->m_state->m_operationalRateSet.size ();
}
//WifiRemoteStationInfo constructor
-WifiRemoteStationInfo::WifiRemoteStationInfo () :
- m_memoryTime (Seconds (1.0)),
- m_lastUpdate (Seconds (0.0)),
- m_failAvg (0.0)
-{}
+WifiRemoteStationInfo::WifiRemoteStationInfo ()
+ : m_memoryTime (Seconds (1.0)),
+ m_lastUpdate (Seconds (0.0)),
+ m_failAvg (0.0)
+{
+}
double
WifiRemoteStationInfo::CalculateAveragingCoefficient ()
{
- double retval = exp((double)
- (m_lastUpdate.GetMicroSeconds () - Simulator::Now ().GetMicroSeconds()) / (double)m_memoryTime.GetMicroSeconds ()
- );
+ double retval = exp ((double)(m_lastUpdate.GetMicroSeconds () - Simulator::Now ().GetMicroSeconds ())
+ / (double)m_memoryTime.GetMicroSeconds ());
m_lastUpdate = Simulator::Now ();
return retval;
}
--- a/src/wifi/model/wifi-remote-station-manager.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/wifi-remote-station-manager.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006,2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -96,12 +96,12 @@
void SetMaxSlrc (uint32_t maxSlrc);
void SetRtsCtsThreshold (uint32_t threshold);
void SetFragmentationThreshold (uint32_t threshold);
-
+
// Invoked in a STA upon dis-association
// or in an AP upon reboot
void Reset (void);
// Invoked in a STA upon association to store
- // the set of rates which belong to the
+ // the set of rates which belong to the
// BSSBasicRateSet of the associated AP
// and which are supported locally.
// Invoked in an AP to configure the BSSBasicRateSet
@@ -120,7 +120,7 @@
*/
void Reset (Mac48Address address);
/**
- * Invoked in a STA or AP to store the set of
+ * Invoked in a STA or AP to store the set of
* modes supported by a destination which is
* also supported locally.
* The set of supported modes includes
@@ -178,7 +178,7 @@
*/
void ReportDataFailed (Mac48Address address, const WifiMacHeader *header);
/**
- * Should be invoked whenever we receive the Cts associated to an RTS
+ * Should be invoked whenever we receive the Cts associated to an RTS
* we just sent.
*/
void ReportRtsOk (Mac48Address address, const WifiMacHeader *header,
@@ -190,12 +190,12 @@
void ReportDataOk (Mac48Address address, const WifiMacHeader *header,
double ackSnr, WifiMode ackMode, double dataSnr);
/**
- * Should be invoked after calling ReportRtsFailed if
+ * Should be invoked after calling ReportRtsFailed if
* NeedRtsRetransmission returns false
*/
void ReportFinalRtsFailed (Mac48Address address, const WifiMacHeader *header);
/**
- * Should be invoked after calling ReportDataFailed if
+ * Should be invoked after calling ReportDataFailed if
* NeedDataRetransmission returns false
*/
void ReportFinalDataFailed (Mac48Address address, const WifiMacHeader *header);
@@ -224,7 +224,7 @@
* \param address remote address
* \param header MAC header
* \param packet the packet to send
- * \returns true if we want to restart a failed RTS/CTS
+ * \returns true if we want to restart a failed RTS/CTS
* handshake, false otherwise.
*/
bool NeedRtsRetransmission (Mac48Address address, const WifiMacHeader *header,
@@ -233,7 +233,7 @@
* \param address remote address
* \param header MAC header
* \param packet the packet to send
- * \returns true if we want to resend a packet
+ * \returns true if we want to resend a packet
* after a failed transmission attempt, false otherwise.
*/
bool NeedDataRetransmission (Mac48Address address, const WifiMacHeader *header,
@@ -246,7 +246,7 @@
* \returns true if this packet should be fragmented, false otherwise.
*/
bool NeedFragmentation (Mac48Address address, const WifiMacHeader *header,
- Ptr<const Packet> packet);
+ Ptr<const Packet> packet);
/**
* \param address remote address
* \param header MAC header
@@ -307,33 +307,33 @@
*
* Note: This method is called before a unicast packet is sent on the medium.
*/
- virtual bool DoNeedRts (WifiRemoteStation *station,
+ virtual bool DoNeedRts (WifiRemoteStation *station,
Ptr<const Packet> packet, bool normally);
/**
* \param station the station with which we need to communicate
* \param packet the packet to send
* \param normally indicates whether the normal 802.11 rts enable mechanism would
* request that the rts is retransmitted or not.
- * \returns true if we want to restart a failed RTS/CTS
+ * \returns true if we want to restart a failed RTS/CTS
* handshake, false otherwise.
*
* Note: This method is called after an rts/cts handshake has been attempted
* and has failed.
*/
- virtual bool DoNeedRtsRetransmission (WifiRemoteStation *station,
+ virtual bool DoNeedRtsRetransmission (WifiRemoteStation *station,
Ptr<const Packet> packet, bool normally);
/**
* \param station the station with which we need to communicate
* \param packet the packet to send
* \param normally indicates whether the normal 802.11 data retransmission mechanism
* would request that the data is retransmitted or not.
- * \returns true if we want to resend a packet
+ * \returns true if we want to resend a packet
* after a failed transmission attempt, false otherwise.
*
* Note: This method is called after a unicast packet transmission has been attempted
* and has failed.
*/
- virtual bool DoNeedDataRetransmission (WifiRemoteStation *station,
+ virtual bool DoNeedDataRetransmission (WifiRemoteStation *station,
Ptr<const Packet> packet, bool normally);
/**
@@ -345,7 +345,7 @@
*
* Note: This method is called before sending a unicast packet.
*/
- virtual bool DoNeedFragmentation (WifiRemoteStation *station,
+ virtual bool DoNeedFragmentation (WifiRemoteStation *station,
Ptr<const Packet> packet, bool normally);
/**
* \returns whether this manager is a manager designed to work in low-latency
@@ -358,7 +358,7 @@
/**
* \return a new station data structure
*/
- virtual WifiRemoteStation *DoCreateStation (void) const = 0;
+ virtual WifiRemoteStation* DoCreateStation (void) const = 0;
/**
* \param station the station with which we need to communicate
* \param size size of the packet or fragment we want to send
@@ -388,10 +388,10 @@
virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode) = 0;
- WifiRemoteStationState *LookupState (Mac48Address address) const;
- WifiRemoteStation *Lookup (Mac48Address address, uint8_t tid) const;
+ WifiRemoteStationState* LookupState (Mac48Address address) const;
+ WifiRemoteStation* Lookup (Mac48Address address, uint8_t tid) const;
/// Find a remote station by its remote address and TID taken from MAC header
- WifiRemoteStation *Lookup (Mac48Address address, const WifiMacHeader *header) const;
+ WifiRemoteStation* Lookup (Mac48Address address, const WifiMacHeader *header) const;
WifiMode GetControlAnswerMode (Mac48Address address, WifiMode reqMode);
uint32_t GetNFragments (Ptr<const Packet> packet);
@@ -433,7 +433,7 @@
*/
TracedCallback<Mac48Address> m_macTxRtsFailed;
/**
- * The trace source fired when the transmission of a single data packet has failed
+ * The trace source fired when the transmission of a single data packet has failed
*/
TracedCallback<Mac48Address> m_macTxDataFailed;
/**
@@ -451,13 +451,13 @@
struct WifiRemoteStationState
{
- enum
- {
- BRAND_NEW,
- DISASSOC,
- WAIT_ASSOC_TX_OK,
- GOT_ASSOC_TX_OK
- } m_state;
+ enum
+ {
+ BRAND_NEW,
+ DISASSOC,
+ WAIT_ASSOC_TX_OK,
+ GOT_ASSOC_TX_OK
+ } m_state;
/**
* This member is the list of WifiMode objects that comprise the
@@ -491,6 +491,6 @@
};
-} // namespace ns3
+} // namespace ns3
#endif /* WIFI_REMOTE_STATION_MANAGER_H */
--- a/src/wifi/model/yans-error-rate-model.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/yans-error-rate-model.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -27,62 +27,63 @@
NS_OBJECT_ENSURE_REGISTERED (YansErrorRateModel);
-TypeId
+TypeId
YansErrorRateModel::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::YansErrorRateModel")
.SetParent<ErrorRateModel> ()
.AddConstructor<YansErrorRateModel> ()
- ;
+ ;
return tid;
}
YansErrorRateModel::YansErrorRateModel ()
-{}
+{
+}
-double
+double
YansErrorRateModel::Log2 (double val) const
{
- return log(val) / log(2.0);
+ return log (val) / log (2.0);
}
-double
+double
YansErrorRateModel::GetBpskBer (double snr, uint32_t signalSpread, uint32_t phyRate) const
{
double EbNo = snr * signalSpread / phyRate;
- double z = sqrt(EbNo);
- double ber = 0.5 * erfc(z);
- NS_LOG_INFO ("bpsk snr="<<snr<<" ber="<<ber);
+ double z = sqrt (EbNo);
+ double ber = 0.5 * erfc (z);
+ NS_LOG_INFO ("bpsk snr=" << snr << " ber=" << ber);
return ber;
}
-double
+double
YansErrorRateModel::GetQamBer (double snr, unsigned int m, uint32_t signalSpread, uint32_t phyRate) const
{
double EbNo = snr * signalSpread / phyRate;
double z = sqrt ((1.5 * Log2 (m) * EbNo) / (m - 1.0));
double z1 = ((1.0 - 1.0 / sqrt (m)) * erfc (z)) ;
- double z2 = 1 - pow ((1-z1), 2.0);
+ double z2 = 1 - pow ((1 - z1), 2.0);
double ber = z2 / Log2 (m);
- NS_LOG_INFO ("Qam m="<<m<<" rate=" << phyRate << " snr="<<snr<<" ber="<<ber);
+ NS_LOG_INFO ("Qam m=" << m << " rate=" << phyRate << " snr=" << snr << " ber=" << ber);
return ber;
}
uint32_t
YansErrorRateModel::Factorial (uint32_t k) const
{
uint32_t fact = 1;
- while (k > 0)
+ while (k > 0)
{
fact *= k;
k--;
}
return fact;
}
-double
+double
YansErrorRateModel::Binomial (uint32_t k, double p, uint32_t n) const
{
- double retval = Factorial (n) / (Factorial (k) * Factorial (n-k)) * pow (p, k) * pow (1-p, n-k);
+ double retval = Factorial (n) / (Factorial (k) * Factorial (n - k)) * pow (p, k) * pow (1 - p, n - k);
return retval;
}
-double
+double
YansErrorRateModel::CalculatePdOdd (double ber, unsigned int d) const
{
NS_ASSERT ((d % 2) == 1);
@@ -90,13 +91,13 @@
unsigned int dend = d;
double pd = 0;
- for (unsigned int i = dstart; i < dend; i++)
+ for (unsigned int i = dstart; i < dend; i++)
{
pd += Binomial (i, ber, d);
}
return pd;
}
-double
+double
YansErrorRateModel::CalculatePdEven (double ber, unsigned int d) const
{
NS_ASSERT ((d % 2) == 0);
@@ -113,15 +114,15 @@
return pd;
}
-double
+double
YansErrorRateModel::CalculatePd (double ber, unsigned int d) const
{
double pd;
- if ((d % 2) == 0)
+ if ((d % 2) == 0)
{
pd = CalculatePdEven (ber, d);
- }
- else
+ }
+ else
{
pd = CalculatePdOdd (ber, d);
}
@@ -129,12 +130,12 @@
}
double
-YansErrorRateModel::GetFecBpskBer (double snr, double nbits,
- uint32_t signalSpread, uint32_t phyRate,
- uint32_t dFree, uint32_t adFree) const
+YansErrorRateModel::GetFecBpskBer (double snr, double nbits,
+ uint32_t signalSpread, uint32_t phyRate,
+ uint32_t dFree, uint32_t adFree) const
{
double ber = GetBpskBer (snr, signalSpread, phyRate);
- if (ber == 0.0)
+ if (ber == 0.0)
{
return 1.0;
}
@@ -146,14 +147,14 @@
}
double
-YansErrorRateModel::GetFecQamBer (double snr, uint32_t nbits,
- uint32_t signalSpread,
- uint32_t phyRate,
- uint32_t m, uint32_t dFree,
- uint32_t adFree, uint32_t adFreePlusOne) const
+YansErrorRateModel::GetFecQamBer (double snr, uint32_t nbits,
+ uint32_t signalSpread,
+ uint32_t phyRate,
+ uint32_t m, uint32_t dFree,
+ uint32_t adFree, uint32_t adFreePlusOne) const
{
double ber = GetQamBer (snr, m, signalSpread, phyRate);
- if (ber == 0.0)
+ if (ber == 0.0)
{
return 1.0;
}
@@ -168,11 +169,11 @@
return pms;
}
-double
+double
YansErrorRateModel::GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const
{
- if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM ||
- mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM)
+ if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM
+ || mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM)
{
if (mode.GetConstellationSize () == 2)
{
--- a/src/wifi/model/yans-error-rate-model.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/yans-error-rate-model.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -31,25 +31,25 @@
* \brief Model the error rate for different modulations.
* \ingroup wifi
*
- * A packet of interest (e.g., a packet can potentially be received by the MAC)
- * is divided into chunks. Each chunk is related to an start/end receiving event.
- * For each chunk, it calculates the ratio (SINR) between received power of packet
- * of interest and summation of noise and interfering power of all the other incoming
- * packets. Then, it will calculate the success rate of the chunk based on
- * BER of the modulation. The success reception rate of the packet is derived from
+ * A packet of interest (e.g., a packet can potentially be received by the MAC)
+ * is divided into chunks. Each chunk is related to an start/end receiving event.
+ * For each chunk, it calculates the ratio (SINR) between received power of packet
+ * of interest and summation of noise and interfering power of all the other incoming
+ * packets. Then, it will calculate the success rate of the chunk based on
+ * BER of the modulation. The success reception rate of the packet is derived from
* the success rate of all chunks.
*
* The 802.11b modulations:
* - 1 Mbps mode is based on DBPSK. BER is from equation 5.2-69 from John G. Proakis
* Digitial Communications, 2001 edition
- * - 2 Mbps model is based on DQPSK. Equation 8 from "Tight bounds and accurate
- * approximations for dqpsk transmission bit error rate", G. Ferrari and G.E. Corazza
+ * - 2 Mbps model is based on DQPSK. Equation 8 from "Tight bounds and accurate
+ * approximations for dqpsk transmission bit error rate", G. Ferrari and G.E. Corazza
* ELECTRONICS LETTERS, 40(20):1284-1285, September 2004
- * - 5.5 Mbps and 11 Mbps are based on equations (18) and (17) from "Properties and
- * performance of the ieee 802.11b complementarycode-key signal sets",
- * Michael B. Pursley and Thomas C. Royster. IEEE TRANSACTIONS ON COMMUNICATIONS,
+ * - 5.5 Mbps and 11 Mbps are based on equations (18) and (17) from "Properties and
+ * performance of the ieee 802.11b complementarycode-key signal sets",
+ * Michael B. Pursley and Thomas C. Royster. IEEE TRANSACTIONS ON COMMUNICATIONS,
* 57(2):440-449, February 2009.
- * - More detailed description and validation can be found in
+ * - More detailed description and validation can be found in
* http://www.nsnam.org/~pei/80211b.pdf
*/
class YansErrorRateModel : public ErrorRateModel
@@ -70,10 +70,10 @@
double CalculatePdOdd (double ber, unsigned int d) const;
double CalculatePdEven (double ber, unsigned int d) const;
double CalculatePd (double ber, unsigned int d) const;
- double GetFecBpskBer (double snr, double nbits,
+ double GetFecBpskBer (double snr, double nbits,
uint32_t signalSpread, uint32_t phyRate,
uint32_t dFree, uint32_t adFree) const;
- double GetFecQamBer (double snr, uint32_t nbits,
+ double GetFecQamBer (double snr, uint32_t nbits,
uint32_t signalSpread,
uint32_t phyRate,
uint32_t m, uint32_t dfree,
--- a/src/wifi/model/yans-wifi-channel.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/yans-wifi-channel.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2006,2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -36,7 +36,7 @@
NS_OBJECT_ENSURE_REGISTERED (YansWifiChannel);
-TypeId
+TypeId
YansWifiChannel::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::YansWifiChannel")
@@ -50,30 +50,31 @@
PointerValue (),
MakePointerAccessor (&YansWifiChannel::m_delay),
MakePointerChecker<PropagationDelayModel> ())
- ;
+ ;
return tid;
}
YansWifiChannel::YansWifiChannel ()
-{}
+{
+}
YansWifiChannel::~YansWifiChannel ()
{
NS_LOG_FUNCTION_NOARGS ();
m_phyList.clear ();
}
-void
+void
YansWifiChannel::SetPropagationLossModel (Ptr<PropagationLossModel> loss)
{
m_loss = loss;
}
-void
+void
YansWifiChannel::SetPropagationDelayModel (Ptr<PropagationDelayModel> delay)
{
m_delay = delay;
}
-void
+void
YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm,
WifiMode wifiMode, WifiPreamble preamble) const
{
@@ -81,18 +82,20 @@
NS_ASSERT (senderMobility != 0);
uint32_t j = 0;
for (PhyList::const_iterator i = m_phyList.begin (); i != m_phyList.end (); i++, j++)
- {
+ {
if (sender != (*i))
{
// For now don't account for inter channel interference
- if ((*i)->GetChannelNumber() != sender->GetChannelNumber())
+ if ((*i)->GetChannelNumber () != sender->GetChannelNumber ())
+ {
continue;
-
+ }
+
Ptr<MobilityModel> receiverMobility = (*i)->GetMobility ()->GetObject<MobilityModel> ();
Time delay = m_delay->GetDelay (senderMobility, receiverMobility);
double rxPowerDbm = m_loss->CalcRxPower (txPowerDbm, senderMobility, receiverMobility);
- NS_LOG_DEBUG ("propagation: txPower="<<txPowerDbm<<"dbm, rxPower="<<rxPowerDbm<<"dbm, "<<
- "distance="<<senderMobility->GetDistanceFrom (receiverMobility)<<"m, delay="<<delay);
+ NS_LOG_DEBUG ("propagation: txPower=" << txPowerDbm << "dbm, rxPower=" << rxPowerDbm << "dbm, " <<
+ "distance=" << senderMobility->GetDistanceFrom (receiverMobility) << "m, delay=" << delay);
Ptr<Packet> copy = packet->Copy ();
Ptr<Object> dstNetDevice = m_phyList[j]->GetDevice ();
uint32_t dstNode;
@@ -105,7 +108,7 @@
dstNode = dstNetDevice->GetObject<NetDevice> ()->GetNode ()->GetId ();
}
Simulator::ScheduleWithContext (dstNode,
- delay, &YansWifiChannel::Receive, this,
+ delay, &YansWifiChannel::Receive, this,
j, copy, rxPowerDbm, wifiMode, preamble);
}
}
@@ -118,18 +121,18 @@
m_phyList[i]->StartReceivePacket (packet, rxPowerDbm, txMode, preamble);
}
-uint32_t
+uint32_t
YansWifiChannel::GetNDevices (void) const
{
return m_phyList.size ();
}
-Ptr<NetDevice>
+Ptr<NetDevice>
YansWifiChannel::GetDevice (uint32_t i) const
{
return m_phyList[i]->GetDevice ()->GetObject<NetDevice> ();
}
-void
+void
YansWifiChannel::Add (Ptr<YansWifiPhy> phy)
{
m_phyList.push_back (phy);
--- a/src/wifi/model/yans-wifi-channel.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/yans-wifi-channel.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2006,2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -41,7 +41,7 @@
* This wifi channel implements the propagation model described in
* "Yet Another Network Simulator", (http://cutebugs.net/files/wns2-yans.pdf).
*
- * This class is expected to be used in tandem with the ns3::YansWifiPhy
+ * This class is expected to be used in tandem with the ns3::YansWifiPhy
* class and contains a ns3::PropagationLossModel and a ns3::PropagationDelayModel.
* By default, no propagation models are set so, it is the caller's responsability
* to set them before using the channel.
@@ -76,8 +76,8 @@
* \param wifiMode the tx mode associated to the packet
* \param preamble the preamble associated to the packet
*
- * This method should not be invoked by normal users. It is
- * currently invoked only from WifiPhy::Send. YansWifiChannel
+ * This method should not be invoked by normal users. It is
+ * currently invoked only from WifiPhy::Send. YansWifiChannel
* delivers packets only between PHYs with the same m_channelNumber,
* e.g. PHYs that are operating on the same channel.
*/
@@ -85,7 +85,6 @@
WifiMode wifiMode, WifiPreamble preamble) const;
private:
-
YansWifiChannel& operator = (const YansWifiChannel &);
YansWifiChannel (const YansWifiChannel &);
--- a/src/wifi/model/yans-wifi-phy.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/yans-wifi-phy.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -43,7 +43,7 @@
NS_OBJECT_ENSURE_REGISTERED (YansWifiPhy);
-TypeId
+TypeId
YansWifiPhy::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::YansWifiPhy")
@@ -84,13 +84,13 @@
.AddAttribute ("TxPowerEnd",
"Maximum available transmission level (dbm).",
DoubleValue (16.0206),
- MakeDoubleAccessor (&YansWifiPhy::SetTxPowerEnd,
+ MakeDoubleAccessor (&YansWifiPhy::SetTxPowerEnd,
&YansWifiPhy::GetTxPowerEnd),
MakeDoubleChecker<double> ())
.AddAttribute ("TxPowerStart",
"Minimum available transmission level (dbm).",
DoubleValue (16.0206),
- MakeDoubleAccessor (&YansWifiPhy::SetTxPowerStart,
+ MakeDoubleAccessor (&YansWifiPhy::SetTxPowerStart,
&YansWifiPhy::GetTxPowerStart),
MakeDoubleChecker<double> ())
.AddAttribute ("RxNoiseFigure",
@@ -112,24 +112,24 @@
.AddAttribute ("ChannelSwitchDelay",
"Delay between two short frames transmitted on different frequencies. NOTE: Unused now.",
TimeValue (MicroSeconds (250)),
- MakeTimeAccessor (&YansWifiPhy::m_channelSwitchDelay),
+ MakeTimeAccessor (&YansWifiPhy::m_channelSwitchDelay),
MakeTimeChecker ())
.AddAttribute ("ChannelNumber",
"Channel center frequency = Channel starting frequency + 5 MHz * (nch - 1)",
UintegerValue (1),
- MakeUintegerAccessor (&YansWifiPhy::SetChannelNumber,
+ MakeUintegerAccessor (&YansWifiPhy::SetChannelNumber,
&YansWifiPhy::GetChannelNumber),
MakeUintegerChecker<uint16_t> ())
- ;
+ ;
return tid;
}
YansWifiPhy::YansWifiPhy ()
: m_channelNumber (1),
- m_endRxEvent (),
- m_random (0.0, 1.0),
- m_channelStartingFrequency (0)
+ m_endRxEvent (),
+ m_random (0.0, 1.0),
+ m_channelStartingFrequency (0)
{
NS_LOG_FUNCTION (this);
m_state = CreateObject<WifiPhyStateHelper> ();
@@ -155,212 +155,214 @@
YansWifiPhy::ConfigureStandard (enum WifiPhyStandard standard)
{
NS_LOG_FUNCTION (this << standard);
- switch (standard) {
- case WIFI_PHY_STANDARD_80211a:
- Configure80211a ();
- break;
- case WIFI_PHY_STANDARD_80211b:
- Configure80211b ();
- break;
- case WIFI_PHY_STANDARD_80211g:
- Configure80211g ();
- break;
- case WIFI_PHY_STANDARD_80211_10Mhz:
- Configure80211_10Mhz ();
- break;
- case WIFI_PHY_STANDARD_80211_5Mhz:
- Configure80211_5Mhz ();
- break;
- case WIFI_PHY_STANDARD_holland:
- ConfigureHolland ();
- break;
- case WIFI_PHY_STANDARD_80211p_CCH:
- Configure80211p_CCH ();
- break;
- case WIFI_PHY_STANDARD_80211p_SCH:
- Configure80211p_SCH ();
- break;
- default:
- NS_ASSERT (false);
- break;
- }
+ switch (standard)
+ {
+ case WIFI_PHY_STANDARD_80211a:
+ Configure80211a ();
+ break;
+ case WIFI_PHY_STANDARD_80211b:
+ Configure80211b ();
+ break;
+ case WIFI_PHY_STANDARD_80211g:
+ Configure80211g ();
+ break;
+ case WIFI_PHY_STANDARD_80211_10Mhz:
+ Configure80211_10Mhz ();
+ break;
+ case WIFI_PHY_STANDARD_80211_5Mhz:
+ Configure80211_5Mhz ();
+ break;
+ case WIFI_PHY_STANDARD_holland:
+ ConfigureHolland ();
+ break;
+ case WIFI_PHY_STANDARD_80211p_CCH:
+ Configure80211p_CCH ();
+ break;
+ case WIFI_PHY_STANDARD_80211p_SCH:
+ Configure80211p_SCH ();
+ break;
+ default:
+ NS_ASSERT (false);
+ break;
+ }
}
-void
+void
YansWifiPhy::SetRxNoiseFigure (double noiseFigureDb)
{
NS_LOG_FUNCTION (this << noiseFigureDb);
m_interference.SetNoiseFigure (DbToRatio (noiseFigureDb));
}
-void
+void
YansWifiPhy::SetTxPowerStart (double start)
{
NS_LOG_FUNCTION (this << start);
m_txPowerBaseDbm = start;
}
-void
+void
YansWifiPhy::SetTxPowerEnd (double end)
{
NS_LOG_FUNCTION (this << end);
m_txPowerEndDbm = end;
}
-void
+void
YansWifiPhy::SetNTxPower (uint32_t n)
{
NS_LOG_FUNCTION (this << n);
m_nTxPower = n;
}
-void
+void
YansWifiPhy::SetTxGain (double gain)
{
NS_LOG_FUNCTION (this << gain);
m_txGainDb = gain;
}
-void
+void
YansWifiPhy::SetRxGain (double gain)
{
NS_LOG_FUNCTION (this << gain);
m_rxGainDb = gain;
}
-void
+void
YansWifiPhy::SetEdThreshold (double threshold)
{
NS_LOG_FUNCTION (this << threshold);
m_edThresholdW = DbmToW (threshold);
}
-void
+void
YansWifiPhy::SetCcaMode1Threshold (double threshold)
{
NS_LOG_FUNCTION (this << threshold);
m_ccaMode1ThresholdW = DbmToW (threshold);
}
-void
+void
YansWifiPhy::SetErrorRateModel (Ptr<ErrorRateModel> rate)
{
m_interference.SetErrorRateModel (rate);
}
-void
+void
YansWifiPhy::SetDevice (Ptr<Object> device)
{
m_device = device;
}
-void
+void
YansWifiPhy::SetMobility (Ptr<Object> mobility)
{
m_mobility = mobility;
}
-double
+double
YansWifiPhy::GetRxNoiseFigure (void) const
{
return RatioToDb (m_interference.GetNoiseFigure ());
}
-double
+double
YansWifiPhy::GetTxPowerStart (void) const
{
return m_txPowerBaseDbm;
}
-double
+double
YansWifiPhy::GetTxPowerEnd (void) const
{
return m_txPowerEndDbm;
}
-double
+double
YansWifiPhy::GetTxGain (void) const
{
return m_txGainDb;
}
-double
+double
YansWifiPhy::GetRxGain (void) const
{
return m_rxGainDb;
}
-double
+double
YansWifiPhy::GetEdThreshold (void) const
{
return WToDbm (m_edThresholdW);
}
-double
+double
YansWifiPhy::GetCcaMode1Threshold (void) const
{
return WToDbm (m_ccaMode1ThresholdW);
}
-Ptr<ErrorRateModel>
+Ptr<ErrorRateModel>
YansWifiPhy::GetErrorRateModel (void) const
{
return m_interference.GetErrorRateModel ();
}
-Ptr<Object>
+Ptr<Object>
YansWifiPhy::GetDevice (void) const
{
return m_device;
}
-Ptr<Object>
+Ptr<Object>
YansWifiPhy::GetMobility (void)
{
return m_mobility;
}
-double
+double
YansWifiPhy::CalculateSnr (WifiMode txMode, double ber) const
{
return m_interference.GetErrorRateModel ()->CalculateSnr (txMode, ber);
}
-Ptr<WifiChannel>
+Ptr<WifiChannel>
YansWifiPhy::GetChannel (void) const
{
return m_channel;
}
-void
+void
YansWifiPhy::SetChannel (Ptr<YansWifiChannel> channel)
{
m_channel = channel;
m_channel->Add (this);
}
-void
+void
YansWifiPhy::SetChannelNumber (uint16_t nch)
{
if (Simulator::Now () == Seconds (0))
{
- // this is not channel switch, this is initialization
- NS_LOG_DEBUG("start at channel " << nch);
+ // this is not channel switch, this is initialization
+ NS_LOG_DEBUG ("start at channel " << nch);
m_channelNumber = nch;
return;
}
- NS_ASSERT (!IsStateSwitching());
- switch (m_state->GetState ()) {
- case YansWifiPhy::RX:
- NS_LOG_DEBUG ("drop packet because of channel switching while reception");
- m_endRxEvent.Cancel();
- goto switchChannel;
- break;
- case YansWifiPhy::TX:
+ NS_ASSERT (!IsStateSwitching ());
+ switch (m_state->GetState ())
+ {
+ case YansWifiPhy::RX:
+ NS_LOG_DEBUG ("drop packet because of channel switching while reception");
+ m_endRxEvent.Cancel ();
+ goto switchChannel;
+ break;
+ case YansWifiPhy::TX:
NS_LOG_DEBUG ("channel switching postponed until end of current transmission");
- Simulator::Schedule (GetDelayUntilIdle(), &YansWifiPhy::SetChannelNumber, this, nch);
- break;
- case YansWifiPhy::CCA_BUSY:
- case YansWifiPhy::IDLE:
- goto switchChannel;
- break;
- default:
- NS_ASSERT (false);
- break;
- }
+ Simulator::Schedule (GetDelayUntilIdle (), &YansWifiPhy::SetChannelNumber, this, nch);
+ break;
+ case YansWifiPhy::CCA_BUSY:
+ case YansWifiPhy::IDLE:
+ goto switchChannel;
+ break;
+ default:
+ NS_ASSERT (false);
+ break;
+ }
return;
- switchChannel:
+switchChannel:
- NS_LOG_DEBUG("switching channel " << m_channelNumber << " -> " << nch);
- m_state->SwitchToChannelSwitching(m_channelSwitchDelay);
- m_interference.EraseEvents();
+ NS_LOG_DEBUG ("switching channel " << m_channelNumber << " -> " << nch);
+ m_state->SwitchToChannelSwitching (m_channelSwitchDelay);
+ m_interference.EraseEvents ();
/*
* Needed here to be able to correctly sensed the medium for the first
* time after the switching. The actual switching is not performed until
@@ -371,30 +373,30 @@
m_channelNumber = nch;
}
-uint16_t
-YansWifiPhy::GetChannelNumber() const
+uint16_t
+YansWifiPhy::GetChannelNumber () const
{
return m_channelNumber;
}
double
-YansWifiPhy::GetChannelFrequencyMhz() const
+YansWifiPhy::GetChannelFrequencyMhz () const
{
- return m_channelStartingFrequency + 5 * GetChannelNumber();
+ return m_channelStartingFrequency + 5 * GetChannelNumber ();
}
-void
+void
YansWifiPhy::SetReceiveOkCallback (RxOkCallback callback)
{
m_state->SetReceiveOkCallback (callback);
}
-void
+void
YansWifiPhy::SetReceiveErrorCallback (RxErrorCallback callback)
{
m_state->SetReceiveErrorCallback (callback);
}
-void
-YansWifiPhy::StartReceivePacket (Ptr<Packet> packet,
+void
+YansWifiPhy::StartReceivePacket (Ptr<Packet> packet,
double rxPowerDbm,
WifiMode txMode,
enum WifiPreamble preamble)
@@ -406,80 +408,81 @@
Time endRx = Simulator::Now () + rxDuration;
Ptr<InterferenceHelper::Event> event;
- event = m_interference.Add (packet->GetSize (),
+ event = m_interference.Add (packet->GetSize (),
txMode,
preamble,
rxDuration,
rxPowerW);
- switch (m_state->GetState ()) {
- case YansWifiPhy::SWITCHING:
- NS_LOG_DEBUG ("drop packet because of channel switching");
- NotifyRxDrop (packet);
- /*
- * Packets received on the upcoming channel are added to the event list
- * during the switching state. This way the medium can be correctly sensed
- * when the device listens to the channel for the first time after the
- * switching e.g. after channel switching, the channel may be sensed as
- * busy due to other devices' tramissions started before the end of
- * the switching.
- */
- if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ())
- {
- // that packet will be noise _after_ the completion of the
- // channel switching.
- goto maybeCcaBusy;
- }
- break;
- case YansWifiPhy::RX:
- NS_LOG_DEBUG ("drop packet because already in Rx (power="<<
- rxPowerW<<"W)");
- NotifyRxDrop (packet);
- if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ())
- {
- // that packet will be noise _after_ the reception of the
- // currently-received packet.
- goto maybeCcaBusy;
- }
- break;
- case YansWifiPhy::TX:
- NS_LOG_DEBUG ("drop packet because already in Tx (power="<<
- rxPowerW<<"W)");
- NotifyRxDrop (packet);
- if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ())
- {
- // that packet will be noise _after_ the transmission of the
- // currently-transmitted packet.
- goto maybeCcaBusy;
- }
- break;
- case YansWifiPhy::CCA_BUSY:
- case YansWifiPhy::IDLE:
- if (rxPowerW > m_edThresholdW)
- {
- NS_LOG_DEBUG ("sync to signal (power="<<rxPowerW<<"W)");
- // sync to signal
- m_state->SwitchToRx (rxDuration);
- NS_ASSERT (m_endRxEvent.IsExpired ());
- NotifyRxBegin (packet);
- m_interference.NotifyRxStart();
- m_endRxEvent = Simulator::Schedule (rxDuration, &YansWifiPhy::EndReceive, this,
- packet,
- event);
- }
- else
- {
- NS_LOG_DEBUG ("drop packet because signal power too Small ("<<
- rxPowerW<<"<"<<m_edThresholdW<<")");
- NotifyRxDrop (packet);
- goto maybeCcaBusy;
- }
- break;
- }
+ switch (m_state->GetState ())
+ {
+ case YansWifiPhy::SWITCHING:
+ NS_LOG_DEBUG ("drop packet because of channel switching");
+ NotifyRxDrop (packet);
+ /*
+ * Packets received on the upcoming channel are added to the event list
+ * during the switching state. This way the medium can be correctly sensed
+ * when the device listens to the channel for the first time after the
+ * switching e.g. after channel switching, the channel may be sensed as
+ * busy due to other devices' tramissions started before the end of
+ * the switching.
+ */
+ if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ())
+ {
+ // that packet will be noise _after_ the completion of the
+ // channel switching.
+ goto maybeCcaBusy;
+ }
+ break;
+ case YansWifiPhy::RX:
+ NS_LOG_DEBUG ("drop packet because already in Rx (power=" <<
+ rxPowerW << "W)");
+ NotifyRxDrop (packet);
+ if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ())
+ {
+ // that packet will be noise _after_ the reception of the
+ // currently-received packet.
+ goto maybeCcaBusy;
+ }
+ break;
+ case YansWifiPhy::TX:
+ NS_LOG_DEBUG ("drop packet because already in Tx (power=" <<
+ rxPowerW << "W)");
+ NotifyRxDrop (packet);
+ if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ())
+ {
+ // that packet will be noise _after_ the transmission of the
+ // currently-transmitted packet.
+ goto maybeCcaBusy;
+ }
+ break;
+ case YansWifiPhy::CCA_BUSY:
+ case YansWifiPhy::IDLE:
+ if (rxPowerW > m_edThresholdW)
+ {
+ NS_LOG_DEBUG ("sync to signal (power=" << rxPowerW << "W)");
+ // sync to signal
+ m_state->SwitchToRx (rxDuration);
+ NS_ASSERT (m_endRxEvent.IsExpired ());
+ NotifyRxBegin (packet);
+ m_interference.NotifyRxStart ();
+ m_endRxEvent = Simulator::Schedule (rxDuration, &YansWifiPhy::EndReceive, this,
+ packet,
+ event);
+ }
+ else
+ {
+ NS_LOG_DEBUG ("drop packet because signal power too Small (" <<
+ rxPowerW << "<" << m_edThresholdW << ")");
+ NotifyRxDrop (packet);
+ goto maybeCcaBusy;
+ }
+ break;
+ }
return;
- maybeCcaBusy:
+maybeCcaBusy:
// We are here because we have received the first bit of a packet and we are
// not going to be able to synchronize on it
// In this model, CCA becomes busy when the aggregation of all signals as
@@ -492,13 +495,13 @@
}
}
-void
+void
YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiMode txMode, WifiPreamble preamble, uint8_t txPower)
{
NS_LOG_FUNCTION (this << packet << txMode << preamble << (uint32_t)txPower);
/* Transmission can happen if:
* - we are syncing on a packet. It is the responsability of the
- * MAC layer to avoid doing this but the PHY does nothing to
+ * MAC layer to avoid doing this but the PHY does nothing to
* prevent it.
* - we are idle
*/
@@ -511,24 +514,24 @@
m_interference.NotifyRxEnd ();
}
NotifyTxBegin (packet);
- uint32_t dataRate500KbpsUnits = txMode.GetDataRate () / 500000;
+ uint32_t dataRate500KbpsUnits = txMode.GetDataRate () / 500000;
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == preamble);
NotifyPromiscSniffTx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble);
m_state->SwitchToTx (txDuration, packet, txMode, preamble, txPower);
m_channel->Send (this, packet, GetPowerDbm (txPower) + m_txGainDb, txMode, preamble);
}
-uint32_t
+uint32_t
YansWifiPhy::GetNModes (void) const
{
return m_deviceRateSet.size ();
}
-WifiMode
+WifiMode
YansWifiPhy::GetMode (uint32_t mode) const
{
return m_deviceRateSet[mode];
}
-uint32_t
+uint32_t
YansWifiPhy::GetNTxPower (void) const
{
return m_nTxPower;
@@ -538,7 +541,7 @@
YansWifiPhy::Configure80211a (void)
{
NS_LOG_FUNCTION (this);
- m_channelStartingFrequency = 5e3; // 5.000 GHz
+ m_channelStartingFrequency = 5e3; // 5.000 GHz
m_deviceRateSet.push_back (WifiPhy::GetOfdmRate6Mbps ());
m_deviceRateSet.push_back (WifiPhy::GetOfdmRate9Mbps ());
@@ -555,7 +558,7 @@
YansWifiPhy::Configure80211b (void)
{
NS_LOG_FUNCTION (this);
- m_channelStartingFrequency = 2407; // 2.407 GHz
+ m_channelStartingFrequency = 2407; // 2.407 GHz
m_deviceRateSet.push_back (WifiPhy::GetDsssRate1Mbps ());
m_deviceRateSet.push_back (WifiPhy::GetDsssRate2Mbps ());
@@ -587,7 +590,7 @@
YansWifiPhy::Configure80211_10Mhz (void)
{
NS_LOG_FUNCTION (this);
- m_channelStartingFrequency = 5e3; // 5.000 GHz, suppose 802.11a
+ m_channelStartingFrequency = 5e3; // 5.000 GHz, suppose 802.11a
m_deviceRateSet.push_back (WifiPhy::GetOfdmRate3MbpsBW10MHz ());
m_deviceRateSet.push_back (WifiPhy::GetOfdmRate4_5MbpsBW10MHz ());
@@ -602,7 +605,7 @@
void
YansWifiPhy::Configure80211_5Mhz (void)
{
- NS_LOG_FUNCTION (this);
+ NS_LOG_FUNCTION (this);
m_channelStartingFrequency = 5e3; // 5.000 GHz, suppose 802.11a
m_deviceRateSet.push_back (WifiPhy::GetOfdmRate1_5MbpsBW5MHz ());
@@ -619,7 +622,7 @@
YansWifiPhy::ConfigureHolland (void)
{
NS_LOG_FUNCTION (this);
- m_channelStartingFrequency = 5e3; // 5.000 GHz
+ m_channelStartingFrequency = 5e3; // 5.000 GHz
m_deviceRateSet.push_back (WifiPhy::GetOfdmRate6Mbps ());
m_deviceRateSet.push_back (WifiPhy::GetOfdmRate12Mbps ());
m_deviceRateSet.push_back (WifiPhy::GetOfdmRate18Mbps ());
@@ -659,39 +662,39 @@
m_deviceRateSet.push_back (WifiPhy::GetOfdmRate27MbpsBW10MHz ());
}
-void
+void
YansWifiPhy::RegisterListener (WifiPhyListener *listener)
{
m_state->RegisterListener (listener);
}
-bool
+bool
YansWifiPhy::IsStateCcaBusy (void)
{
return m_state->IsStateCcaBusy ();
}
-bool
+bool
YansWifiPhy::IsStateIdle (void)
{
return m_state->IsStateIdle ();
}
-bool
+bool
YansWifiPhy::IsStateBusy (void)
{
return m_state->IsStateBusy ();
}
-bool
+bool
YansWifiPhy::IsStateRx (void)
{
return m_state->IsStateRx ();
}
-bool
+bool
YansWifiPhy::IsStateTx (void)
{
return m_state->IsStateTx ();
}
-bool
+bool
YansWifiPhy::IsStateSwitching (void)
{
return m_state->IsStateSwitching ();
@@ -708,42 +711,42 @@
return m_state->GetDelayUntilIdle ();
}
-Time
+Time
YansWifiPhy::GetLastRxStartTime (void) const
{
return m_state->GetLastRxStartTime ();
}
-Time
+Time
YansWifiPhy::CalculateTxDuration (uint32_t size, WifiMode payloadMode, enum WifiPreamble preamble) const
{
return m_interference.CalculateTxDuration (size, payloadMode, preamble);
}
-double
+double
YansWifiPhy::DbToRatio (double dB) const
{
- double ratio = pow(10.0,dB/10.0);
+ double ratio = pow (10.0,dB / 10.0);
return ratio;
}
-double
+double
YansWifiPhy::DbmToW (double dBm) const
{
- double mW = pow(10.0,dBm/10.0);
+ double mW = pow (10.0,dBm / 10.0);
return mW / 1000.0;
}
double
YansWifiPhy::WToDbm (double w) const
{
- return 10.0 * log10(w * 1000.0);
+ return 10.0 * log10 (w * 1000.0);
}
double
YansWifiPhy::RatioToDb (double ratio) const
{
- return 10.0 * log10(ratio);
+ return 10.0 * log10 (ratio);
}
double
@@ -752,7 +755,7 @@
return m_edThresholdW;
}
-double
+double
YansWifiPhy::GetPowerDbm (uint8_t power) const
{
NS_ASSERT (m_txPowerBaseDbm <= m_txPowerEndDbm);
@@ -762,7 +765,7 @@
{
dbm = m_txPowerBaseDbm + power * (m_txPowerEndDbm - m_txPowerBaseDbm) / (m_nTxPower - 1);
}
- else
+ else
{
NS_ASSERT_MSG (m_txPowerBaseDbm == m_txPowerEndDbm, "cannot have TxPowerEnd != TxPowerStart with TxPowerLevels == 1");
dbm = m_txPowerBaseDbm;
@@ -779,21 +782,21 @@
struct InterferenceHelper::SnrPer snrPer;
snrPer = m_interference.CalculateSnrPer (event);
- m_interference.NotifyRxEnd();
+ m_interference.NotifyRxEnd ();
- NS_LOG_DEBUG ("mode="<<(event->GetPayloadMode ().GetDataRate ())<<
- ", snr="<<snrPer.snr<<", per="<<snrPer.per<<", size="<<packet->GetSize ());
- if (m_random.GetValue () > snrPer.per)
+ NS_LOG_DEBUG ("mode=" << (event->GetPayloadMode ().GetDataRate ()) <<
+ ", snr=" << snrPer.snr << ", per=" << snrPer.per << ", size=" << packet->GetSize ());
+ if (m_random.GetValue () > snrPer.per)
{
- NotifyRxEnd (packet);
- uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;
- bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());
+ NotifyRxEnd (packet);
+ uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;
+ bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;
- double noiseDbm = RatioToDb(event->GetRxPowerW() / snrPer.snr) - GetRxNoiseFigure() + 30 ;
+ double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30 ;
NotifyPromiscSniffRx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType ());
- }
- else
+ }
+ else
{
/* failure. */
NotifyRxDrop (packet);
--- a/src/wifi/model/yans-wifi-phy.h Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/yans-wifi-phy.h Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -51,7 +51,7 @@
*
* This PHY implements a model of 802.11a. The model
* implemented here is based on the model described
- * in "Yet Another Network Simulator",
+ * in "Yet Another Network Simulator",
* (http://cutebugs.net/files/wns2-yans.pdf).
*
*
@@ -63,35 +63,34 @@
class YansWifiPhy : public WifiPhy
{
public:
-
static TypeId GetTypeId (void);
YansWifiPhy ();
virtual ~YansWifiPhy ();
void SetChannel (Ptr<YansWifiChannel> channel);
-
- /**
- * \brief Set channel number.
- *
+
+ /**
+ * \brief Set channel number.
+ *
* Channel center frequency = Channel starting frequency + 5 MHz * (nch - 1)
*
* where Starting channel frequency is standard-dependent, see SetStandard()
* as defined in IEEE 802.11-2007 17.3.8.3.2.
*
- * YansWifiPhy can switch among different channels. Basically, YansWifiPhy
- * has a private attribute m_channelNumber that identifies the channel the
+ * YansWifiPhy can switch among different channels. Basically, YansWifiPhy
+ * has a private attribute m_channelNumber that identifies the channel the
* PHY operates on. Channel switching cannot interrupt an ongoing transmission.
* When PHY is in TX state, the channel switching is postponed until the end
- * of the current transmission. When the PHY is in RX state, the channel
- * switching causes the drop of the synchronized packet.
- */
+ * of the current transmission. When the PHY is in RX state, the channel
+ * switching causes the drop of the synchronized packet.
+ */
void SetChannelNumber (uint16_t id);
/// Return current channel number, see SetChannelNumber()
uint16_t GetChannelNumber () const;
/// Return current center channel frequency in MHz, see SetChannelNumber()
- double GetChannelFrequencyMhz() const;
-
+ double GetChannelFrequencyMhz () const;
+
void StartReceivePacket (Ptr<Packet> packet,
double rxPowerDbm,
WifiMode mode,
@@ -116,8 +115,8 @@
Ptr<ErrorRateModel> GetErrorRateModel (void) const;
Ptr<Object> GetDevice (void) const;
Ptr<Object> GetMobility (void);
-
-
+
+
virtual double GetTxPowerStart (void) const;
@@ -132,7 +131,7 @@
virtual bool IsStateBusy (void);
virtual bool IsStateRx (void);
virtual bool IsStateTx (void);
- virtual bool IsStateSwitching (void);
+ virtual bool IsStateSwitching (void);
virtual Time GetStateDuration (void);
virtual Time GetDelayUntilIdle (void);
virtual Time GetLastRxStartTime (void) const;
@@ -216,7 +215,7 @@
EventId m_endRxEvent;
UniformVariable m_random;
- /// Standard-dependent center frequency of 0-th channel, MHz
+ /// Standard-dependent center frequency of 0-th channel, MHz
double m_channelStartingFrequency;
Ptr<WifiPhyStateHelper> m_state;
InterferenceHelper m_interference;
--- a/src/wifi/test/block-ack-test-suite.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/test/block-ack-test-suite.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009, 2010 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -39,12 +39,12 @@
/* ----- = old packets
* +++++ = new packets
- *
- * CASE A: startSeq < endSeq
+ *
+ * CASE A: startSeq < endSeq
* - - +
* initial buffer state: 0 16 56000
*
- *
+ *
* 0 4095
* |------|++++++++++++++++|-----|
* ^ ^
@@ -54,7 +54,7 @@
* second received packet's sequence control = 63984 (seqNum = 3999, fragNum = 0) +
* 4001 is older seq number so this packet should be inserted at the buffer's begin.
* 3999 is previous element of older of new packets: it should be inserted at the end of buffer.
- *
+ *
* expected buffer state: 64016 0 16 56000 63984
*
*/
@@ -79,7 +79,8 @@
}
PacketBufferingCaseA::~PacketBufferingCaseA ()
-{}
+{
+}
void
PacketBufferingCaseA::DoRun (void)
@@ -91,20 +92,26 @@
m_buffer.push_back (56000);
uint16_t endSeq = 4000;
-
+
uint16_t receivedSeq = 4001 * 16;
uint32_t mappedSeq = QosUtilsMapSeqControlToUniqueInteger (receivedSeq, endSeq);
- for (i = m_buffer.begin (); i != m_buffer.end () && QosUtilsMapSeqControlToUniqueInteger ((*i), endSeq) < mappedSeq; i++);
+ for (i = m_buffer.begin (); i != m_buffer.end () && QosUtilsMapSeqControlToUniqueInteger ((*i), endSeq) < mappedSeq; i++)
{
- m_buffer.insert (i, receivedSeq);
+ ;
}
-
+ {
+ m_buffer.insert (i, receivedSeq);
+ }
+
receivedSeq = 3999 * 16;
mappedSeq = QosUtilsMapSeqControlToUniqueInteger (receivedSeq, endSeq);
- for (i = m_buffer.begin (); i != m_buffer.end () && QosUtilsMapSeqControlToUniqueInteger ((*i), endSeq) < mappedSeq; i++);
+ for (i = m_buffer.begin (); i != m_buffer.end () && QosUtilsMapSeqControlToUniqueInteger ((*i), endSeq) < mappedSeq; i++)
{
- m_buffer.insert (i, receivedSeq);
+ ;
}
+ {
+ m_buffer.insert (i, receivedSeq);
+ }
for (i = m_buffer.begin (), j = m_expectedBuffer.begin (); i != m_buffer.end (); i++, j++)
{
@@ -114,7 +121,7 @@
/* ----- = old packets
* +++++ = new packets
- *
+ *
* CASE B: startSeq > endSeq
* - + +
* initial buffer state: 256 64000 16
@@ -131,7 +138,7 @@
* 240 is an old packet should be inserted at the buffer's begin.
* 241 is an old packet: second segment of the above packet.
* 4050 is a new packet: it should be inserted between 64000 and 16.
- *
+ *
* expected buffer state: 240 241 256 64000 64800 16
*
*/
@@ -157,7 +164,8 @@
}
PacketBufferingCaseB::~PacketBufferingCaseB ()
-{}
+{
+}
void
PacketBufferingCaseB::DoRun (void)
@@ -172,24 +180,33 @@
uint16_t receivedSeq = 15 * 16;
uint32_t mappedSeq = QosUtilsMapSeqControlToUniqueInteger (receivedSeq, endSeq);
- for (i = m_buffer.begin (); i != m_buffer.end () && QosUtilsMapSeqControlToUniqueInteger ((*i), endSeq) < mappedSeq; i++);
+ for (i = m_buffer.begin (); i != m_buffer.end () && QosUtilsMapSeqControlToUniqueInteger ((*i), endSeq) < mappedSeq; i++)
{
- m_buffer.insert (i, receivedSeq);
+ ;
}
+ {
+ m_buffer.insert (i, receivedSeq);
+ }
receivedSeq = 15 * 16 + 1;
mappedSeq = QosUtilsMapSeqControlToUniqueInteger (receivedSeq, endSeq);
- for (i = m_buffer.begin (); i != m_buffer.end () && QosUtilsMapSeqControlToUniqueInteger ((*i), endSeq) < mappedSeq; i++);
+ for (i = m_buffer.begin (); i != m_buffer.end () && QosUtilsMapSeqControlToUniqueInteger ((*i), endSeq) < mappedSeq; i++)
{
- m_buffer.insert (i, receivedSeq);
+ ;
}
+ {
+ m_buffer.insert (i, receivedSeq);
+ }
receivedSeq = 4050 * 16;
mappedSeq = QosUtilsMapSeqControlToUniqueInteger (receivedSeq, endSeq);
- for (i = m_buffer.begin (); i != m_buffer.end () && QosUtilsMapSeqControlToUniqueInteger ((*i), endSeq) < mappedSeq; i++);
+ for (i = m_buffer.begin (); i != m_buffer.end () && QosUtilsMapSeqControlToUniqueInteger ((*i), endSeq) < mappedSeq; i++)
{
- m_buffer.insert (i, receivedSeq);
+ ;
}
+ {
+ m_buffer.insert (i, receivedSeq);
+ }
for (i = m_buffer.begin (), j = m_expectedBuffer.begin (); i != m_buffer.end (); i++, j++)
{
@@ -209,13 +226,14 @@
CtrlBAckResponseHeaderTest::CtrlBAckResponseHeaderTest ()
: TestCase ("Check the correctness of block ack compressed bitmap")
-{}
+{
+}
void
CtrlBAckResponseHeaderTest::DoRun (void)
{
m_blockAckHdr.SetType (COMPRESSED_BLOCK_ACK);
-
+
//Case 1: startSeq < endSeq
// 179 242
m_blockAckHdr.SetStartingSequence (179);
@@ -235,7 +253,7 @@
NS_TEST_EXPECT_MSG_EQ (m_blockAckHdr.IsPacketReceived (1500), false, "error in compressed bitmap");
m_blockAckHdr.ResetBitmap ();
-
+
//Case 2: startSeq > endSeq
// 4090 58
m_blockAckHdr.SetStartingSequence (4090);
--- a/src/wifi/test/dcf-manager-test.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/test/dcf-manager-test.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -26,7 +26,7 @@
class DcfManagerTest;
-class DcfStateTest : public DcfState
+class DcfStateTest : public DcfState
{
public:
DcfStateTest (DcfManagerTest *test, uint32_t i);
@@ -36,11 +36,12 @@
virtual void DoNotifyAccessGranted (void);
virtual void DoNotifyInternalCollision (void);
virtual void DoNotifyCollision (void);
- virtual void DoNotifyChannelSwitching (void);
+ virtual void DoNotifyChannelSwitching (void);
typedef std::pair<uint64_t,uint64_t> ExpectedGrant;
typedef std::list<ExpectedGrant> ExpectedGrants;
- struct ExpectedCollision {
+ struct ExpectedCollision
+ {
uint64_t at;
uint32_t nSlots;
};
@@ -64,7 +65,7 @@
void NotifyAccessGranted (uint32_t i);
void NotifyInternalCollision (uint32_t i);
void NotifyCollision (uint32_t i);
- void NotifyChannelSwitching (uint32_t i);
+ void NotifyChannelSwitching (uint32_t i);
private:
@@ -80,18 +81,18 @@
void AddNavReset (uint64_t at, uint64_t duration);
void AddNavStart (uint64_t at, uint64_t duration);
void AddAckTimeoutReset (uint64_t at);
- void AddAccessRequest (uint64_t at, uint64_t txTime,
+ void AddAccessRequest (uint64_t at, uint64_t txTime,
uint64_t expectedGrantTime, uint32_t from);
- void AddAccessRequestWithAckTimeout (uint64_t at, uint64_t txTime,
- uint64_t expectedGrantTime, uint32_t from);
+ void AddAccessRequestWithAckTimeout (uint64_t at, uint64_t txTime,
+ uint64_t expectedGrantTime, uint32_t from);
///\param ackDelay is delay of the ack after txEnd
- void AddAccessRequestWithSuccessfullAck (uint64_t at, uint64_t txTime,
- uint64_t expectedGrantTime, uint32_t ackDelay, uint32_t from);
+ void AddAccessRequestWithSuccessfullAck (uint64_t at, uint64_t txTime,
+ uint64_t expectedGrantTime, uint32_t ackDelay, uint32_t from);
void DoAccessRequest (uint64_t txTime, uint64_t expectedGrantTime, DcfStateTest *state);
- void AddCcaBusyEvt (uint64_t at, uint64_t duration);
- void AddSwitchingEvt (uint64_t at, uint64_t duration);
- void AddRxStartEvt (uint64_t at, uint64_t duration);
-
+ void AddCcaBusyEvt (uint64_t at, uint64_t duration);
+ void AddSwitchingEvt (uint64_t at, uint64_t duration);
+ void AddRxStartEvt (uint64_t at, uint64_t duration);
+
typedef std::vector<DcfStateTest *> DcfStates;
DcfManager *m_dcfManager;
@@ -101,15 +102,17 @@
-DcfStateTest::DcfStateTest (DcfManagerTest *test, uint32_t i)
- : m_test (test), m_i(i)
-{}
-void
+DcfStateTest::DcfStateTest (DcfManagerTest *test, uint32_t i)
+ : m_test (test),
+ m_i (i)
+{
+}
+void
DcfStateTest::QueueTx (uint64_t txTime, uint64_t expectedGrantTime)
{
m_expectedGrants.push_back (std::make_pair (txTime, expectedGrantTime));
}
-void
+void
DcfStateTest::DoNotifyAccessGranted (void)
{
m_test->NotifyAccessGranted (m_i);
@@ -119,12 +122,12 @@
{
m_test->NotifyInternalCollision (m_i);
}
-void
+void
DcfStateTest::DoNotifyCollision (void)
{
m_test->NotifyCollision (m_i);
}
-void
+void
DcfStateTest::DoNotifyChannelSwitching (void)
{
m_test->NotifyChannelSwitching (m_i);
@@ -133,9 +136,10 @@
DcfManagerTest::DcfManagerTest ()
: TestCase ("DcfManager")
-{}
+{
+}
-void
+void
DcfManagerTest::NotifyAccessGranted (uint32_t i)
{
DcfStateTest *state = m_dcfStates[i];
@@ -149,11 +153,11 @@
void
DcfManagerTest::AddTxEvt (uint64_t at, uint64_t duration)
{
- Simulator::Schedule (MicroSeconds (at) - Now (),
- &DcfManager::NotifyTxStartNow, m_dcfManager,
+ Simulator::Schedule (MicroSeconds (at) - Now (),
+ &DcfManager::NotifyTxStartNow, m_dcfManager,
MicroSeconds (duration));
}
-void
+void
DcfManagerTest::NotifyInternalCollision (uint32_t i)
{
DcfStateTest *state = m_dcfStates[i];
@@ -163,7 +167,7 @@
NS_TEST_EXPECT_MSG_EQ (Simulator::Now (), MicroSeconds (expected.at), "Expected internal collision time is now");
state->StartBackoffNow (expected.nSlots);
}
-void
+void
DcfManagerTest::NotifyCollision (uint32_t i)
{
DcfStateTest *state = m_dcfStates[i];
@@ -173,7 +177,7 @@
NS_TEST_EXPECT_MSG_EQ (Simulator::Now (), MicroSeconds (expected.at), "Expected collision is now");
state->StartBackoffNow (expected.nSlots);
}
-void
+void
DcfManagerTest::NotifyChannelSwitching (uint32_t i)
{
DcfStateTest *state = m_dcfStates[i];
@@ -185,7 +189,7 @@
}
}
-void
+void
DcfManagerTest::ExpectInternalCollision (uint64_t time, uint32_t nSlots, uint32_t from)
{
DcfStateTest *state = m_dcfStates[from];
@@ -194,7 +198,7 @@
col.nSlots = nSlots;
state->m_expectedInternalCollision.push_back (col);
}
-void
+void
DcfManagerTest::ExpectCollision (uint64_t time, uint32_t nSlots, uint32_t from)
{
DcfStateTest *state = m_dcfStates[from];
@@ -210,7 +214,7 @@
m_dcfManager = new DcfManager ();
m_dcfManager->SetSlot (MicroSeconds (slotTime));
m_dcfManager->SetSifs (MicroSeconds (sifs));
- m_dcfManager->SetEifsNoDifs (MicroSeconds (eifsNoDifsNoSifs+sifs));
+ m_dcfManager->SetEifsNoDifs (MicroSeconds (eifsNoDifsNoSifs + sifs));
m_ackTimeoutValue = ackTimeoutValue;
}
@@ -240,72 +244,72 @@
delete m_dcfManager;
}
-void
+void
DcfManagerTest::AddRxOkEvt (uint64_t at, uint64_t duration)
{
- Simulator::Schedule (MicroSeconds (at) - Now (),
- &DcfManager::NotifyRxStartNow, m_dcfManager,
+ Simulator::Schedule (MicroSeconds (at) - Now (),
+ &DcfManager::NotifyRxStartNow, m_dcfManager,
MicroSeconds (duration));
- Simulator::Schedule (MicroSeconds (at+duration) - Now (),
+ Simulator::Schedule (MicroSeconds (at + duration) - Now (),
&DcfManager::NotifyRxEndOkNow, m_dcfManager);
}
void
DcfManagerTest::AddRxInsideSifsEvt (uint64_t at, uint64_t duration)
{
- Simulator::Schedule (MicroSeconds (at) - Now (),
- &DcfManager::NotifyRxStartNow, m_dcfManager,
+ Simulator::Schedule (MicroSeconds (at) - Now (),
+ &DcfManager::NotifyRxStartNow, m_dcfManager,
MicroSeconds (duration));
}
-void
+void
DcfManagerTest::AddRxErrorEvt (uint64_t at, uint64_t duration)
{
- Simulator::Schedule (MicroSeconds (at) - Now (),
- &DcfManager::NotifyRxStartNow, m_dcfManager,
+ Simulator::Schedule (MicroSeconds (at) - Now (),
+ &DcfManager::NotifyRxStartNow, m_dcfManager,
MicroSeconds (duration));
- Simulator::Schedule (MicroSeconds (at+duration) - Now (),
+ Simulator::Schedule (MicroSeconds (at + duration) - Now (),
&DcfManager::NotifyRxEndErrorNow, m_dcfManager);
}
-void
+void
DcfManagerTest::AddNavReset (uint64_t at, uint64_t duration)
{
- Simulator::Schedule (MicroSeconds (at) - Now (),
- &DcfManager::NotifyNavResetNow, m_dcfManager,
+ Simulator::Schedule (MicroSeconds (at) - Now (),
+ &DcfManager::NotifyNavResetNow, m_dcfManager,
MicroSeconds (duration));
}
-void
+void
DcfManagerTest::AddNavStart (uint64_t at, uint64_t duration)
{
- Simulator::Schedule (MicroSeconds (at) - Now (),
- &DcfManager::NotifyNavStartNow, m_dcfManager,
+ Simulator::Schedule (MicroSeconds (at) - Now (),
+ &DcfManager::NotifyNavStartNow, m_dcfManager,
MicroSeconds (duration));
}
-void
+void
DcfManagerTest::AddAckTimeoutReset (uint64_t at)
{
- Simulator::Schedule (MicroSeconds (at) - Now (),
+ Simulator::Schedule (MicroSeconds (at) - Now (),
&DcfManager::NotifyAckTimeoutResetNow, m_dcfManager);
}
-void
-DcfManagerTest::AddAccessRequest (uint64_t at, uint64_t txTime,
+void
+DcfManagerTest::AddAccessRequest (uint64_t at, uint64_t txTime,
uint64_t expectedGrantTime, uint32_t from)
{
AddAccessRequestWithSuccessfullAck (at, txTime, expectedGrantTime, 0, from);
}
-void
-DcfManagerTest::AddAccessRequestWithAckTimeout (uint64_t at, uint64_t txTime,
- uint64_t expectedGrantTime, uint32_t from)
+void
+DcfManagerTest::AddAccessRequestWithAckTimeout (uint64_t at, uint64_t txTime,
+ uint64_t expectedGrantTime, uint32_t from)
{
- Simulator::Schedule (MicroSeconds (at) - Now (),
+ Simulator::Schedule (MicroSeconds (at) - Now (),
&DcfManagerTest::DoAccessRequest, this,
txTime, expectedGrantTime, m_dcfStates[from]);
}
-void
-DcfManagerTest::AddAccessRequestWithSuccessfullAck (uint64_t at, uint64_t txTime,
- uint64_t expectedGrantTime, uint32_t ackDelay, uint32_t from)
+void
+DcfManagerTest::AddAccessRequestWithSuccessfullAck (uint64_t at, uint64_t txTime,
+ uint64_t expectedGrantTime, uint32_t ackDelay, uint32_t from)
{
- NS_ASSERT(ackDelay < m_ackTimeoutValue);
- Simulator::Schedule (MicroSeconds (at) - Now (),
+ NS_ASSERT (ackDelay < m_ackTimeoutValue);
+ Simulator::Schedule (MicroSeconds (at) - Now (),
&DcfManagerTest::DoAccessRequest, this,
txTime, expectedGrantTime, m_dcfStates[from]);
AddAckTimeoutReset (expectedGrantTime + txTime + ackDelay);
@@ -316,25 +320,25 @@
state->QueueTx (txTime, expectedGrantTime);
m_dcfManager->RequestAccess (state);
}
-void
+void
DcfManagerTest::AddCcaBusyEvt (uint64_t at, uint64_t duration)
{
- Simulator::Schedule (MicroSeconds (at) - Now (),
- &DcfManager::NotifyMaybeCcaBusyStartNow, m_dcfManager,
+ Simulator::Schedule (MicroSeconds (at) - Now (),
+ &DcfManager::NotifyMaybeCcaBusyStartNow, m_dcfManager,
MicroSeconds (duration));
}
void
DcfManagerTest::AddSwitchingEvt (uint64_t at, uint64_t duration)
{
- Simulator::Schedule (MicroSeconds (at) - Now (),
- &DcfManager::NotifySwitchingStartNow, m_dcfManager,
+ Simulator::Schedule (MicroSeconds (at) - Now (),
+ &DcfManager::NotifySwitchingStartNow, m_dcfManager,
MicroSeconds (duration));
}
void
DcfManagerTest::AddRxStartEvt (uint64_t at, uint64_t duration)
{
- Simulator::Schedule (MicroSeconds (at) - Now (),
- &DcfManager::NotifyRxStartNow, m_dcfManager,
+ Simulator::Schedule (MicroSeconds (at) - Now (),
+ &DcfManager::NotifyRxStartNow, m_dcfManager,
MicroSeconds (duration));
}
@@ -344,7 +348,7 @@
DcfManagerTest::DoRun (void)
{
// 0 3 4 5 8 9 10 12
- // | sifs | aifsn | tx | sifs | aifsn | | tx |
+ // | sifs | aifsn | tx | sifs | aifsn | | tx |
//
StartTest (1, 3, 10);
AddDcfState (1);
@@ -353,13 +357,13 @@
EndTest ();
// Check that receiving inside SIFS shall be cancelled properly:
// 0 3 4 5 8 9 12 13 14
- // | sifs | aifsn | tx | sifs | ack | sifs | aifsn | |tx |
+ // | sifs | aifsn | tx | sifs | ack | sifs | aifsn | |tx |
//
StartTest (1, 3, 10);
AddDcfState (1);
AddAccessRequest (1, 1, 4, 0);
AddRxInsideSifsEvt (6, 10);
- AddTxEvt(8, 1);
+ AddTxEvt (8, 1);
AddAccessRequest (14, 2, 14, 0);
EndTest ();
@@ -384,10 +388,10 @@
// Test the case where the backoff slots is zero.
//
// 20 60 66 70 72
- // | rx | sifs | aifsn | tx |
+ // | rx | sifs | aifsn | tx |
// |
// 30 request access. backoff slots: 0
- StartTest (4, 6 , 10);
+ StartTest (4, 6, 10);
AddDcfState (1);
AddRxOkEvt (20, 40);
AddAccessRequest (30, 2, 70, 0);
@@ -396,11 +400,11 @@
// Test shows when two frames are received without interval between
// them:
// 20 60 100 106 110 112
- // | rx | rx |sifs | aifsn | tx |
+ // | rx | rx |sifs | aifsn | tx |
// |
// 30 request access. backoff slots: 0
- StartTest (4, 6 , 10);
+ StartTest (4, 6, 10);
AddDcfState (1);
AddRxOkEvt (20, 40);
AddRxOkEvt (60, 40);
@@ -409,7 +413,7 @@
EndTest ();
- // The test below is subject to some discussion because I am
+ // The test below is subject to some discussion because I am
// not sure I understand the intent of the spec here.
// i.e., what happens if you make a request to get access
// to the medium during the difs idle time after a busy period ?
@@ -422,7 +426,7 @@
// |
// 62 request access.
//
- StartTest (4, 6 , 10);
+ StartTest (4, 6, 10);
AddDcfState (1);
AddRxOkEvt (20, 40);
AddAccessRequest (62, 2, 70, 0);
@@ -430,7 +434,7 @@
// Test an EIFS
- //
+ //
// 20 60 66 76 86 90 94 98 102 106
// | rx | sifs | acktxttime | sifs + aifsn | bslot0 | bslot1 | bslot2 | bslot3 | tx |
// | | <------eifs------>|
@@ -439,11 +443,11 @@
AddDcfState (1);
AddRxErrorEvt (20, 40);
AddAccessRequest (30, 2, 102, 0);
- ExpectCollision (30, 4, 0); // backoff: 4 slots
+ ExpectCollision (30, 4, 0); // backoff: 4 slots
EndTest ();
// Test an EIFS which is interupted by a successfull transmission.
- //
+ //
// 20 60 66 69 75 81 85 89 93 97 101 103
// | rx | sifs | | rx | sifs | aifsn | bslot0 | bslot1 | bslot2 | bslot3 | tx |
// | | <--eifs-->|
@@ -452,7 +456,7 @@
AddDcfState (1);
AddRxErrorEvt (20, 40);
AddAccessRequest (30, 2, 101, 0);
- ExpectCollision (30, 4, 0); // backoff: 4 slots
+ ExpectCollision (30, 4, 0); // backoff: 4 slots
AddRxOkEvt (69, 6);
EndTest ();
@@ -475,7 +479,7 @@
ExpectCollision (40, 0, 1); // backoff: 0 slot
ExpectInternalCollision (78, 1, 1); // backoff: 1 slot
EndTest ();
-
+
// Test of AckTimeout handling: First queue requests access and ack procedure fails,
// inside the ack timeout second queue with higher priority requests access.
//
@@ -490,7 +494,7 @@
AddAccessRequest (50, 10, 66, 1);
EndTest ();
- // Test of AckTimeout handling:
+ // Test of AckTimeout handling:
//
// First queue requests access and ack is 2 us delayed (got ack interval at the picture),
// inside this interval second queue with higher priority requests access.
@@ -532,7 +536,7 @@
// test simple NAV count. This scenario modelizes a simple DATA+ACK handshake
// where the data rate used for the ACK is higher than expected by the DATA source
// so, the data exchange completes before the end of nav.
- //
+ //
StartTest (4, 6, 10);
AddDcfState (1);
AddRxOkEvt (20, 40);
@@ -544,10 +548,10 @@
EndTest ();
//
- // test more complex NAV handling by a CF-poll. This scenario modelizes a
+ // test more complex NAV handling by a CF-poll. This scenario modelizes a
// simple DATA+ACK handshake interrupted by a CF-poll which resets the
// NAV counter.
- //
+ //
StartTest (4, 6, 10);
AddDcfState (1);
AddRxOkEvt (20, 40);
@@ -558,7 +562,7 @@
ExpectCollision (30, 2, 0); // backoff: 2 slot
EndTest ();
-
+
StartTest (4, 6, 10);
AddDcfState (2);
AddRxOkEvt (20, 40);
@@ -577,88 +581,88 @@
// Channel switching tests
- // 0 20 23 24 25
- // | switching | sifs | aifsn | tx |
- // |
- // 21 access request.
+ // 0 20 23 24 25
+ // | switching | sifs | aifsn | tx |
+ // |
+ // 21 access request.
StartTest (1, 3, 10);
AddDcfState (1);
- AddSwitchingEvt(0,20);
+ AddSwitchingEvt (0,20);
AddAccessRequest (21, 1, 24, 0);
EndTest ();
// 20 40 50 53 54 55
- // | switching | busy | sifs | aifsn | tx |
+ // | switching | busy | sifs | aifsn | tx |
// | |
- // 30 busy. 45 access request.
+ // 30 busy. 45 access request.
//
StartTest (1, 3, 10);
AddDcfState (1);
- AddSwitchingEvt(20,20);
- AddCcaBusyEvt(30,20);
+ AddSwitchingEvt (20,20);
+ AddCcaBusyEvt (30,20);
AddAccessRequest (45, 1, 54, 0);
EndTest ();
// 20 30 50 53 54 55
- // | rx | switching | sifs | aifsn | tx |
+ // | rx | switching | sifs | aifsn | tx |
// |
- // 51 access request.
+ // 51 access request.
//
StartTest (1, 3, 10);
AddDcfState (1);
AddRxStartEvt (20,40);
- AddSwitchingEvt(30,20);
+ AddSwitchingEvt (30,20);
AddAccessRequest (51, 1, 54, 0);
EndTest ();
// 20 30 50 53 54 55
- // | busy | switching | sifs | aifsn | tx |
+ // | busy | switching | sifs | aifsn | tx |
// |
- // 51 access request.
+ // 51 access request.
//
StartTest (1, 3, 10);
AddDcfState (1);
AddCcaBusyEvt (20,40);
- AddSwitchingEvt(30,20);
+ AddSwitchingEvt (30,20);
AddAccessRequest (51, 1, 54, 0);
EndTest ();
// 20 30 50 53 54 55
- // | nav | switching | sifs | aifsn | tx |
+ // | nav | switching | sifs | aifsn | tx |
// |
- // 51 access request.
+ // 51 access request.
//
StartTest (1, 3, 10);
AddDcfState (1);
AddNavStart (20,40);
- AddSwitchingEvt(30,20);
+ AddSwitchingEvt (30,20);
AddAccessRequest (51, 1, 54, 0);
EndTest ();
// 20 40 50 55 58 59 60
- // | tx | ack timeout | switching | sifs | aifsn | tx |
+ // | tx | ack timeout | switching | sifs | aifsn | tx |
// | |
- // 45 access request. 56 access request.
+ // 45 access request. 56 access request.
//
StartTest (1, 3, 10);
AddDcfState (1);
AddAccessRequestWithAckTimeout (20, 20, 20, 0);
AddAccessRequest (45, 1, 50, 0);
- AddSwitchingEvt(50,5);
+ AddSwitchingEvt (50,5);
AddAccessRequest (56, 1, 59, 0);
EndTest ();
// 20 60 66 70 74 78 80 100 106 110 112
- // | rx | sifs | aifsn | bslot0 | bslot1 | | switching | sifs | aifsn | tx |
+ // | rx | sifs | aifsn | bslot0 | bslot1 | | switching | sifs | aifsn | tx |
// | |
- // 30 access request. 101 access request.
+ // 30 access request. 101 access request.
//
StartTest (4, 6, 10);
AddDcfState (1);
- AddRxOkEvt(20,40);
- AddAccessRequest (30, 2, 80, 0);
- ExpectCollision(30, 4, 0); // backoff: 4 slots
- AddSwitchingEvt(80,20);
+ AddRxOkEvt (20,40);
+ AddAccessRequest (30, 2, 80, 0);
+ ExpectCollision (30, 4, 0); // backoff: 4 slots
+ AddSwitchingEvt (80,20);
AddAccessRequest (101, 2, 110, 0);
EndTest ();
}
--- a/src/wifi/test/interference-helper-tx-duration-test.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/test/interference-helper-tx-duration-test.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2009 CTTC
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -29,7 +29,7 @@
namespace ns3 {
-class InterferenceHelperTxDurationTest : public TestCase
+class InterferenceHelperTxDurationTest : public TestCase
{
public:
InterferenceHelperTxDurationTest ();
@@ -37,32 +37,31 @@
virtual void DoRun (void);
private:
-
- /**
+ /**
* Check if the payload tx duration returned by InterferenceHelper
* corresponds to a known value of the pay
- *
+ *
* @param size size of payload in octets (includes everything after the PLCP header)
- * @param payloadMode the WifiMode used
+ * @param payloadMode the WifiMode used
* @param knownPlcpLengthFieldValue the known value of the Length field in the PLCP header
- *
+ *
* @return true if values correspond, false otherwise
*/
- bool CheckPayloadDuration(uint32_t size, WifiMode payloadMode, uint32_t knownDurationMicroSeconds);
+ bool CheckPayloadDuration (uint32_t size, WifiMode payloadMode, uint32_t knownDurationMicroSeconds);
- /**
+ /**
* Check if the overall tx duration returned by InterferenceHelper
* corresponds to a known value of the pay
- *
+ *
* @param size size of payload in octets (includes everything after the PLCP header)
- * @param payloadMode the WifiMode used
+ * @param payloadMode the WifiMode used
* @param preamble the WifiPreamble used
* @param knownPlcpLengthFieldValue the known value of the Length field in the PLCP header
- *
+ *
* @return true if values correspond, false otherwise
*/
- bool CheckTxDuration(uint32_t size, WifiMode payloadMode, WifiPreamble preamble, uint32_t knownDurationMicroSeconds);
-
+ bool CheckTxDuration (uint32_t size, WifiMode payloadMode, WifiPreamble preamble, uint32_t knownDurationMicroSeconds);
+
};
@@ -77,13 +76,13 @@
}
bool
-InterferenceHelperTxDurationTest::CheckPayloadDuration(uint32_t size, WifiMode payloadMode, uint32_t knownDurationMicroSeconds)
+InterferenceHelperTxDurationTest::CheckPayloadDuration (uint32_t size, WifiMode payloadMode, uint32_t knownDurationMicroSeconds)
{
- uint32_t calculatedDurationMicroSeconds = InterferenceHelper::GetPayloadDurationMicroSeconds (size, payloadMode);
+ uint32_t calculatedDurationMicroSeconds = InterferenceHelper::GetPayloadDurationMicroSeconds (size, payloadMode);
if (calculatedDurationMicroSeconds != knownDurationMicroSeconds)
{
std::cerr << " size=" << size
- << " mode=" << payloadMode
+ << " mode=" << payloadMode
<< " known=" << knownDurationMicroSeconds
<< " calculated=" << calculatedDurationMicroSeconds
<< std::endl;
@@ -93,13 +92,13 @@
}
bool
-InterferenceHelperTxDurationTest::CheckTxDuration(uint32_t size, WifiMode payloadMode, WifiPreamble preamble, uint32_t knownDurationMicroSeconds)
+InterferenceHelperTxDurationTest::CheckTxDuration (uint32_t size, WifiMode payloadMode, WifiPreamble preamble, uint32_t knownDurationMicroSeconds)
{
- uint32_t calculatedDurationMicroSeconds = InterferenceHelper::CalculateTxDuration (size, payloadMode, preamble).GetMicroSeconds ();
+ uint32_t calculatedDurationMicroSeconds = InterferenceHelper::CalculateTxDuration (size, payloadMode, preamble).GetMicroSeconds ();
if (calculatedDurationMicroSeconds != knownDurationMicroSeconds)
{
std::cerr << " size=" << size
- << " mode=" << payloadMode
+ << " mode=" << payloadMode
<< " preamble=" << preamble
<< " known=" << knownDurationMicroSeconds
<< " calculated=" << calculatedDurationMicroSeconds
@@ -125,7 +124,7 @@
// Similar, but we add PLCP preamble and header durations
// and we test different rates.
// The payload durations for modes other than 11mbb have been
- // calculated by hand according to IEEE Std 802.11-2007 18.2.3.5
+ // calculated by hand according to IEEE Std 802.11-2007 18.2.3.5
retval = retval
&& CheckTxDuration (1023, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_SHORT, 744 + 96)
&& CheckTxDuration (1024, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_SHORT, 745 + 96)
@@ -165,7 +164,7 @@
// values from
// http://www.oreillynet.com/pub/a/wireless/2003/08/08/wireless_throughput.html
- retval = retval
+ retval = retval
&& CheckTxDuration (1536, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 1310)
&& CheckTxDuration (76, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 248)
&& CheckTxDuration (14, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 203)
@@ -193,5 +192,5 @@
}
static TxDurationTestSuite g_txDurationTestSuite;
-} //namespace ns3
+} //namespace ns3
--- a/src/wifi/test/wifi-phy-test.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/test/wifi-phy-test.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -64,7 +64,7 @@
struct Output m_output;
};
-void
+void
PsrExperiment::Send (void)
{
Ptr<Packet> p = Create<Packet> (m_input.packetSize);
@@ -72,21 +72,23 @@
m_tx->SendPacket (p, mode, WIFI_PREAMBLE_SHORT, m_input.txPowerLevel);
}
-void
+void
PsrExperiment::Receive (Ptr<Packet> p, double snr, WifiMode mode, enum WifiPreamble preamble)
{
m_output.received++;
}
PsrExperiment::PsrExperiment ()
-{}
+{
+}
PsrExperiment::Input::Input ()
: distance (5.0),
txMode ("OfdmRate6Mbps"),
txPowerLevel (0),
packetSize (2304),
nPackets (400)
-{}
+{
+}
struct PsrExperiment::Output
PsrExperiment::Run (struct PsrExperiment::Input input)
@@ -163,25 +165,25 @@
struct Output m_output;
};
-void
+void
CollisionExperiment::SendA (void) const
{
Ptr<Packet> p = Create<Packet> (m_input.packetSizeA);
p->AddByteTag (FlowIdTag (m_flowIdA));
- m_txA->SendPacket (p, WifiMode (m_input.txModeA),
- WIFI_PREAMBLE_SHORT, m_input.txPowerLevelA);
+ m_txA->SendPacket (p, WifiMode (m_input.txModeA),
+ WIFI_PREAMBLE_SHORT, m_input.txPowerLevelA);
}
-void
+void
CollisionExperiment::SendB (void) const
{
Ptr<Packet> p = Create<Packet> (m_input.packetSizeB);
p->AddByteTag (FlowIdTag (m_flowIdB));
- m_txB->SendPacket (p, WifiMode (m_input.txModeB),
- WIFI_PREAMBLE_SHORT, m_input.txPowerLevelB);
+ m_txB->SendPacket (p, WifiMode (m_input.txModeB),
+ WIFI_PREAMBLE_SHORT, m_input.txPowerLevelB);
}
-void
+void
CollisionExperiment::Receive (Ptr<Packet> p, double snr, WifiMode mode, enum WifiPreamble preamble)
{
FlowIdTag tag;
@@ -197,7 +199,8 @@
}
CollisionExperiment::CollisionExperiment ()
-{}
+{
+}
CollisionExperiment::Input::Input ()
: interval (MicroSeconds (0)),
xA (-5),
@@ -209,7 +212,8 @@
packetSizeA (2304),
packetSizeB (2304),
nPackets (400)
-{}
+{
+}
struct CollisionExperiment::Output
CollisionExperiment::Run (struct CollisionExperiment::Input input)
@@ -284,7 +288,7 @@
double psr = output.received;
psr /= input.nPackets ;
-
+
std::cout << psr << std::endl;
}
@@ -299,7 +303,7 @@
{
struct PsrExperiment::Input input;
CommandLine cmd;
- cmd.AddValue ("TxPowerLevel", "The power level index to use to send each packet", input.txPowerLevel);
+ cmd.AddValue ("TxPowerLevel", "The power level index to use to send each packet", input.txPowerLevel);
cmd.AddValue ("TxMode", "The mode to use to send each packet", input.txMode);
cmd.AddValue ("NPackets", "The number of packets to send", input.nPackets);
cmd.AddValue ("PacketSize", "The size of each packet sent", input.packetSize);
@@ -313,7 +317,7 @@
input.txMode = "OfdmRate6Mbps";
output = experiment.Run (input);
std::cout << " " << CalcPsr (output, input);
-
+
input.txMode = "OfdmRate9Mbps";
output = experiment.Run (input);
std::cout << " " << CalcPsr (output, input);
@@ -351,7 +355,7 @@
double targetPsr = 0.05;
struct PsrExperiment::Input input;
CommandLine cmd;
- cmd.AddValue ("TxPowerLevel", "The power level index to use to send each packet", input.txPowerLevel);
+ cmd.AddValue ("TxPowerLevel", "The power level index to use to send each packet", input.txPowerLevel);
cmd.AddValue ("TxMode", "The mode to use to send each packet", input.txMode);
cmd.AddValue ("NPackets", "The number of packets to send", input.nPackets);
cmd.AddValue ("TargetPsr", "The psr needed to assume that we are within range", targetPsr);
@@ -362,22 +366,22 @@
double low = 1.0;
double high = 200.0;
while (high - low > precision)
- {
- double middle = low + (high - low) / 2;
- struct PsrExperiment::Output output;
- PsrExperiment experiment;
- input.distance = middle;
- output = experiment.Run (input);
- double psr = CalcPsr (output, input);
- if (psr >= targetPsr)
- {
- low = middle;
- }
- else
- {
- high = middle;
- }
- }
+ {
+ double middle = low + (high - low) / 2;
+ struct PsrExperiment::Output output;
+ PsrExperiment experiment;
+ input.distance = middle;
+ output = experiment.Run (input);
+ double psr = CalcPsr (output, input);
+ if (psr >= targetPsr)
+ {
+ low = middle;
+ }
+ else
+ {
+ high = middle;
+ }
+ }
std::cout << input.packetSize << " " << input.distance << std::endl;
}
}
@@ -396,8 +400,8 @@
CollisionExperiment::Output output;
input.interval = MicroSeconds (i);
output = experiment.Run (input);
- double perA = (output.receivedA+0.0) / (input.nPackets+0.0);
- double perB = (output.receivedB+0.0) / (input.nPackets+0.0);
+ double perA = (output.receivedA + 0.0) / (input.nPackets + 0.0);
+ double perB = (output.receivedB + 0.0) / (input.nPackets + 0.0);
std::cout << i << " " << perA << " " << perB << std::endl;
}
for (uint32_t i = 100; i < 4000; i += 50)
@@ -406,8 +410,8 @@
CollisionExperiment::Output output;
input.interval = MicroSeconds (i);
output = experiment.Run (input);
- double perA = (output.receivedA+0.0) / (input.nPackets+0.0);
- double perB = (output.receivedB+0.0) / (input.nPackets+0.0);
+ double perA = (output.receivedA + 0.0) / (input.nPackets + 0.0);
+ double perB = (output.receivedB + 0.0) / (input.nPackets + 0.0);
std::cout << i << " " << perA << " " << perB << std::endl;
}
}
@@ -419,11 +423,11 @@
if (argc <= 1)
{
std::cout << "Available experiments: "
- << "Psr "
- << "SizeVsRange "
- << "PsrVsDistance "
- << "PsrVsCollisionInterval "
- << std::endl;
+ << "Psr "
+ << "SizeVsRange "
+ << "PsrVsDistance "
+ << "PsrVsCollisionInterval "
+ << std::endl;
return -1;
}
std::string type = argv[1];
--- a/src/wifi/test/wifi-test.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/test/wifi-test.cc Sat May 07 21:49:46 2011 +0200
@@ -4,7 +4,7 @@
* 2010 NICTA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -153,7 +153,9 @@
class QosUtilsIsOldPacketTest : public TestCase
{
public:
- QosUtilsIsOldPacketTest () : TestCase ("QosUtilsIsOldPacket") {}
+ QosUtilsIsOldPacketTest () : TestCase ("QosUtilsIsOldPacket")
+ {
+ }
virtual void DoRun (void)
{
// startingSeq=0, seqNum=2047
@@ -257,7 +259,7 @@
Ptr<Node> senderA = CreateOne (Vector (5.0, 0.0, 0.0), channel);
Ptr<Node> senderB = CreateOne (Vector (-5.0, 0.0, 0.0), channel);
- propLoss->SetLoss (senderB->GetObject<MobilityModel>(), rxOnly->GetObject<MobilityModel>(), 0, true);
+ propLoss->SetLoss (senderB->GetObject<MobilityModel> (), rxOnly->GetObject<MobilityModel> (), 0, true);
propLoss->SetDefaultLoss (999);
Simulator::Schedule (Seconds (1.0),