--- a/src/wifi/examples/wifi-phy-test.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/examples/wifi-phy-test.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#include "ns3/wifi-net-device.h"
#include "ns3/yans-wifi-channel.h"
#include "ns3/yans-wifi-phy.h"
@@ -119,9 +120,9 @@
rx->SetChannel (channel);
tx->SetMobility (posTx);
rx->SetMobility (posRx);
-
- tx->ConfigureStandard(WIFI_PHY_STANDARD_80211a);
- rx->ConfigureStandard(WIFI_PHY_STANDARD_80211a);
+
+ tx->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
+ rx->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
rx->SetReceiveOkCallback (MakeCallback (&PsrExperiment::Receive, this));
@@ -131,7 +132,7 @@
}
m_tx = tx;
Simulator::Run ();
- Simulator::Destroy();
+ Simulator::Destroy ();
return m_output;
}
@@ -266,9 +267,9 @@
txB->SetMobility (posTxB);
rx->SetMobility (posRx);
- txA->ConfigureStandard(WIFI_PHY_STANDARD_80211a);
- txB->ConfigureStandard(WIFI_PHY_STANDARD_80211a);
- rx->ConfigureStandard(WIFI_PHY_STANDARD_80211a);
+ txA->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
+ txB->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
+ rx->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
rx->SetReceiveOkCallback (MakeCallback (&CollisionExperiment::Receive, this));
@@ -283,7 +284,7 @@
m_txA = txA;
m_txB = txB;
Simulator::Run ();
- Simulator::Destroy();
+ Simulator::Destroy ();
return m_output;
}
@@ -326,7 +327,7 @@
cmd.AddValue ("NPackets", "The number of packets to send", input.nPackets);
cmd.AddValue ("PacketSize", "The size of each packet sent", input.packetSize);
cmd.Parse (argc, argv);
-
+
for (input.distance = 1.0; input.distance < 165; input.distance += 2.0)
{
std::cout << input.distance;
@@ -413,7 +414,7 @@
cmd.AddValue ("NPackets", "The number of packets to send for each transmitter", input.nPackets);
cmd.AddValue ("xA", "the position of transmitter A", input.xA);
cmd.AddValue ("xB", "the position of transmitter B", input.xB);
-
+
for (uint32_t i = 0; i < 100; i += 1)
{
CollisionExperiment experiment;
@@ -437,7 +438,6 @@
}
-
int main (int argc, char *argv[])
{
if (argc <= 1)
--- a/src/wifi/helper/athstats-helper.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/helper/athstats-helper.cc Sun Jun 21 00:23:45 2015 +0200
@@ -29,7 +29,6 @@
#include <iostream>
#include <fstream>
-
namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("Athstats");
@@ -73,7 +72,6 @@
EnableAthstats (filename, nd->GetNode ()->GetId (), nd->GetIfIndex ());
}
-
void
AthstatsHelper::EnableAthstats (std::string filename, NetDeviceContainer d)
{
@@ -84,7 +82,6 @@
}
}
-
void
AthstatsHelper::EnableAthstats (std::string filename, NodeContainer n)
{
@@ -100,10 +97,6 @@
EnableAthstats (filename, devs);
}
-
-
-
-
NS_OBJECT_ENSURE_REGISTERED (AthstatsWifiTraceSink);
TypeId
@@ -188,7 +181,6 @@
++m_rxCount;
}
-
void
AthstatsWifiTraceSink::TxRtsFailedTrace (std::string context, Mac48Address address)
{
@@ -217,8 +209,6 @@
++m_exceededRetryCount;
}
-
-
void
AthstatsWifiTraceSink::PhyRxOkTrace (std::string context, Ptr<const Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble)
{
@@ -240,7 +230,6 @@
++m_phyTxCount;
}
-
void
AthstatsWifiTraceSink::PhyStateTrace (std::string context, Time start, Time duration, enum WifiPhy::State state)
{
@@ -248,8 +237,6 @@
}
-
-
void
AthstatsWifiTraceSink::Open (std::string const &name)
{
@@ -269,26 +256,25 @@
NS_LOG_LOGIC ("Writer opened successfully");
}
-
void
AthstatsWifiTraceSink::WriteStats ()
{
NS_ABORT_MSG_UNLESS (this, "function called with null this pointer, now=" << Now () );
- // the comments below refer to how each value maps to madwifi's athstats
- // I know C strings are ugly but that's the quickest way to use exactly the same format as in madwifi
+ //The comments below refer to how each value maps to madwifi's athstats
+ //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) 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)
@@ -301,9 +287,4 @@
}
}
-
-
-
-} // namespace ns3
-
-
+} //namespace ns3
--- a/src/wifi/helper/athstats-helper.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/helper/athstats-helper.h Sun Jun 21 00:23:45 2015 +0200
@@ -34,7 +34,6 @@
namespace ns3 {
-
class NetDevice;
/**
@@ -56,8 +55,6 @@
};
-
-
/**
* @brief trace sink for wifi device that mimics madwifi's athstats tool.
*
@@ -86,7 +83,6 @@
AthstatsWifiTraceSink ();
virtual ~AthstatsWifiTraceSink ();
-
/**
* function to be called when the net device transmits a packet
*
@@ -192,8 +188,8 @@
*/
void Open (std::string const& name);
+
private:
-
void WriteStats ();
void ResetCounters ();
@@ -210,14 +206,8 @@
Time m_interval;
-}; // class AthstatsWifiTraceSink
-
-
-
+}; //class AthstatsWifiTraceSink
} // namespace ns3
-
-
-
#endif /* ATHSTATS_HELPER_H */
--- a/src/wifi/helper/ht-wifi-mac-helper.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/helper/ht-wifi-mac-helper.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Ghada Badawy <gbadawy@gmail.com>
*/
+
#include "ht-wifi-mac-helper.h"
#include "ns3/wifi-mac.h"
#include "ns3/edca-txop-n.h"
@@ -39,10 +40,9 @@
{
HtWifiMacHelper helper;
- // We're making Ht-enabled Wi-Fi MACs here, so we set the necessary
- // attribute. I've carefully positioned this here so that someone
- // who knows what they're doing can override with explicit
- // attributes.
+ //We're making Ht-enabled Wi-Fi MACs here, so we set the necessary
+ //attribute. I've carefully positioned this here so that someone
+ //who knows what they're doing can override with explicit attributes.
helper.SetType ("ns3::StaWifiMac",
"QosSupported", BooleanValue (true),
"HtSupported", BooleanValue (true));
@@ -50,6 +50,4 @@
return helper;
}
-
-} // namespace ns3
-
+} //namespace ns3
--- a/src/wifi/helper/ht-wifi-mac-helper.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/helper/ht-wifi-mac-helper.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Ghada Badawy <gbadawy@gmail.com>
*/
+
#ifndef HT_WIFI_MAC_HELPER_H
#define HT_WIFI_MAC_HELPER_H
@@ -52,8 +53,8 @@
*/
static HtWifiMacHelper Default (void);
- };
+};
-} // namespace ns3
+} //namespace ns3
#endif /* HT_WIFI_MAC_HELPER_H */
--- a/src/wifi/helper/nqos-wifi-mac-helper.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/helper/nqos-wifi-mac-helper.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#include "nqos-wifi-mac-helper.h"
#include "ns3/wifi-mac.h"
#include "ns3/pointer.h"
@@ -37,10 +38,9 @@
NqosWifiMacHelper::Default (void)
{
NqosWifiMacHelper helper;
- // We're making non QoS-enabled Wi-Fi MACs here, so we set the
- // necessary attribute. I've carefully positioned this here so that
- // someone who knows what they're doing can override with explicit
- // attributes.
+ //We're making non QoS-enabled Wi-Fi MACs here, so we set the
+ //necessary attribute. I've carefully positioned this here so that
+ //someone who knows what they're doing can override with explicit attributes.
helper.SetType ("ns3::AdhocWifiMac",
"QosSupported", BooleanValue (false));
return helper;
@@ -75,4 +75,4 @@
return mac;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/helper/nqos-wifi-mac-helper.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/helper/nqos-wifi-mac-helper.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#ifndef NQOS_WIFI_MAC_HELPER_H
#define NQOS_WIFI_MAC_HELPER_H
@@ -72,14 +73,14 @@
* in the requested mac.
*/
virtual void SetType (std::string type,
- 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 ());
protected:
ObjectFactory m_mac;
private:
--- a/src/wifi/helper/qos-wifi-mac-helper.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/helper/qos-wifi-mac-helper.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#include "qos-wifi-mac-helper.h"
#include "ns3/msdu-aggregator.h"
#include "ns3/wifi-mac.h"
@@ -42,10 +43,9 @@
{
QosWifiMacHelper helper;
- // We're making QoS-enabled Wi-Fi MACs here, so we set the necessary
- // attribute. I've carefully positioned this here so that someone
- // who knows what they're doing can override with explicit
- // attributes.
+ //We're making QoS-enabled Wi-Fi MACs here, so we set the necessary
+ //attribute. I've carefully positioned this here so that someone
+ //who knows what they're doing can override with explicit attributes.
helper.SetType ("ns3::StaWifiMac",
"QosSupported", BooleanValue (true));
@@ -114,7 +114,7 @@
m_mpduAggregator.Set (n0, v0);
m_mpduAggregator.Set (n1, v1);
m_mpduAggregator.Set (n2, v2);
- m_mpduAggregator.Set (n3, v3);
+ m_mpduAggregator.Set (n3, v3);
}
void
@@ -137,10 +137,10 @@
mac->GetAttribute (dcaAttrName, ptr);
Ptr<EdcaTxopN> edca = ptr.Get<EdcaTxopN> ();
- if (m_mpduAggregator.GetTypeId().GetUid() != 0)
+ if (m_mpduAggregator.GetTypeId ().GetUid () != 0)
{
Ptr<MpduAggregator> mpduaggregator = m_mpduAggregator.Create<MpduAggregator> ();
- Ptr<MacLow> low = edca->Low();
+ Ptr<MacLow> low = edca->Low ();
low->SetMpduAggregator (mpduaggregator);
}
if (it != m_aggregators.end ())
@@ -172,4 +172,4 @@
return mac;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/helper/qos-wifi-mac-helper.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/helper/qos-wifi-mac-helper.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#ifndef QOS_WIFI_MAC_HELPER_H
#define QOS_WIFI_MAC_HELPER_H
@@ -77,19 +78,19 @@
* in the requested mac.
*/
virtual void SetType (std::string type,
- 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 ());
/**
* Set the class, type and attributes for the Msdu aggregator
*
- * \param ac access category for which we are setting aggregator. Possibilities
- * are: AC_BK, AC_BE, AC_VI, AC_VO.
+ * \param ac access category for which we are setting aggregator.
+ * Possibilities are: AC_BK, AC_BE, AC_VI, AC_VO.
* \param type the type of ns3::MsduAggregator to create.
* \param n0 the name of the attribute to set
* \param v0 the value of the attribute to set
@@ -108,36 +109,36 @@
std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue ());
- /**
- * Set the class, type and attributes for the Mpdu aggregator
- *
- * \param ac access category for which we are setting aggregator. Possibilities
- * are: AC_BK, AC_BE, AC_VI, AC_VO.
- * \param type the type of ns3::MsduAggregator to create.
- * \param n0 the name of the attribute to set
- * \param v0 the value of the attribute to set
- * \param n1 the name of the attribute to set
- * \param v1 the value of the attribute to set
- * \param n2 the name of the attribute to set
- * \param v2 the value of the attribute to set
- * \param n3 the name of the attribute to set
- * \param v3 the value of the attribute to set
- *
- * All the attributes specified in this method should exist
- * in the requested aggregator.
- */
+ /**
+ * Set the class, type and attributes for the Mpdu aggregator
+ *
+ * \param ac access category for which we are setting aggregator.
+ * Possibilities are: AC_BK, AC_BE, AC_VI, AC_VO.
+ * \param type the type of ns3::MsduAggregator to create.
+ * \param n0 the name of the attribute to set
+ * \param v0 the value of the attribute to set
+ * \param n1 the name of the attribute to set
+ * \param v1 the value of the attribute to set
+ * \param n2 the name of the attribute to set
+ * \param v2 the value of the attribute to set
+ * \param n3 the name of the attribute to set
+ * \param v3 the value of the attribute to set
+ *
+ * All the attributes specified in this method should exist
+ * in the requested aggregator.
+ */
void SetMpduAggregatorForAc (enum AcIndex ac, std::string type,
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 ()); //A-MPDU
+ std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue ());
/**
* This method sets value of block ack threshold for a specific access class.
* If number of packets in the respective queue reaches this value block ack mechanism
* is used.
*
- * \param ac access category for which we are setting block ack threshold. Possibilities
- * are: AC_BK, AC_BE, AC_VI, AC_VO.
+ * \param ac access category for which we are setting block ack threshold.
+ * Possibilities are: AC_BK, AC_BE, AC_VI, AC_VO.
* \param threshold the threshold (number of packets)
*/
void SetBlockAckThresholdForAc (enum AcIndex ac, uint8_t threshold);
@@ -148,13 +149,17 @@
* 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 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.
*/
void SetBlockAckInactivityTimeoutForAc (enum AcIndex ac, uint16_t timeout);
+
+
protected:
ObjectFactory m_mac;
+
+
private:
/**
* \returns a newly-created MAC object.
@@ -164,8 +169,8 @@
virtual Ptr<WifiMac> Create (void) const;
void Setup (Ptr<WifiMac> mac, enum AcIndex ac, std::string dcaAttrName) const;
- std::map<AcIndex, ObjectFactory> m_aggregators; //!<
- ObjectFactory m_mpduAggregator; //!<
+ std::map<AcIndex, ObjectFactory> m_aggregators;
+ ObjectFactory m_mpduAggregator;
/*
* Next maps contain, for every access category, the values for
* block ack threshold and block ack inactivity timeout.
@@ -174,6 +179,6 @@
std::map<AcIndex, uint16_t> m_bAckInactivityTimeouts;
};
-} // namespace ns3
+} //namespace ns3
#endif /* QOS_WIFI_MAC_HELPER_H */
--- a/src/wifi/helper/wifi-helper.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/helper/wifi-helper.cc Sun Jun 21 00:23:45 2015 +0200
@@ -16,9 +16,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
+ * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Mirko Banchi <mk.banchi@gmail.com>
*/
+
#include "wifi-helper.h"
#include "ns3/wifi-net-device.h"
#include "ns3/wifi-mac.h"
@@ -184,10 +185,10 @@
Ptr<WifiNetDevice> wifi = DynamicCast<WifiNetDevice> (netDevice);
if (wifi)
{
- // Handle any random numbers in the PHY objects.
+ //Handle any random numbers in the PHY objects.
currentStream += wifi->GetPhy ()->AssignStreams (currentStream);
- // Handle any random numbers in the station managers.
+ //Handle any random numbers in the station managers.
Ptr<WifiRemoteStationManager> manager = wifi->GetRemoteStationManager ();
Ptr<MinstrelWifiManager> minstrel = DynamicCast<MinstrelWifiManager> (manager);
if (minstrel)
@@ -195,7 +196,7 @@
currentStream += minstrel->AssignStreams (currentStream);
}
- // Handle any random numbers in the MAC objects.
+ //Handle any random numbers in the MAC objects.
Ptr<WifiMac> mac = wifi->GetMac ();
Ptr<RegularWifiMac> rmac = DynamicCast<RegularWifiMac> (mac);
if (rmac)
@@ -221,7 +222,7 @@
Ptr<EdcaTxopN> bk_edcaTxopN = ptr.Get<EdcaTxopN> ();
currentStream += bk_edcaTxopN->AssignStreams (currentStream);
- // if an AP, handle any beacon jitter
+ //if an AP, handle any beacon jitter
Ptr<ApWifiMac> apmac = DynamicCast<ApWifiMac> (rmac);
if (apmac)
{
@@ -233,4 +234,4 @@
return (currentStream - stream);
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/helper/wifi-helper.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/helper/wifi-helper.h Sun Jun 21 00:23:45 2015 +0200
@@ -16,9 +16,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
+ * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Mirko Banchi <mk.banchi@gmail.com>
*/
+
#ifndef WIFI_HELPER_H
#define WIFI_HELPER_H
@@ -51,6 +52,7 @@
/**
* \param node the node on which the PHY object will reside
* \param device the device within which the PHY object will reside
+ *
* \returns a new PHY object.
*
* Subclasses must implement this method to allow the ns3::WifiHelper class
@@ -63,6 +65,7 @@
virtual Ptr<WifiPhy> Create (Ptr<Node> node, Ptr<NetDevice> device) const = 0;
};
+
/**
* \brief create MAC objects
*
@@ -82,6 +85,7 @@
virtual Ptr<WifiMac> Create (void) const = 0;
};
+
/**
* \brief helps to create WifiNetDevice objects
*
@@ -147,7 +151,7 @@
* \returns a device container which contains all the devices created by this method.
*/
virtual NetDeviceContainer Install (const WifiPhyHelper &phy,
- const WifiMacHelper &mac, NodeContainer c) const;
+ const WifiMacHelper &mac, NodeContainer c) const;
/**
* \param phy the PHY helper to create PHY objects
* \param mac the MAC helper to create MAC objects
@@ -155,7 +159,7 @@
* \returns a device container which contains all the devices created by this method.
*/
virtual NetDeviceContainer Install (const WifiPhyHelper &phy,
- const WifiMacHelper &mac, Ptr<Node> node) const;
+ const WifiMacHelper &mac, Ptr<Node> node) const;
/**
* \param phy the PHY helper to create PHY objects
* \param mac the MAC helper to create MAC objects
@@ -163,7 +167,7 @@
* \returns a device container which contains all the devices created by this method.
*/
virtual NetDeviceContainer Install (const WifiPhyHelper &phy,
- const WifiMacHelper &mac, std::string nodeName) const;
+ const WifiMacHelper &mac, std::string nodeName) const;
/**
* \param standard the phy standard to configure during installation
*
@@ -204,18 +208,19 @@
* have been assigned. The Install() method should have previously been
* called by the user.
*
- * \param c NetDeviceContainer of the set of net devices for which the
+ * \param c NetDeviceContainer of the set of net devices for which the
* WifiNetDevice should be modified to use fixed streams
* \param stream first stream index to use
* \return the number of stream indices assigned by this helper
*/
int64_t AssignStreams (NetDeviceContainer c, int64_t stream);
+
protected:
ObjectFactory m_stationManager;
enum WifiPhyStandard m_standard;
};
-} // namespace ns3
+} //namespace ns3
#endif /* WIFI_HELPER_H */
--- a/src/wifi/helper/yans-wifi-helper.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/helper/yans-wifi-helper.cc Sun Jun 21 00:23:45 2015 +0200
@@ -172,7 +172,7 @@
return channel;
}
-int64_t
+int64_t
YansWifiChannelHelper::AssignStreams (Ptr<YansWifiChannel> c, int64_t stream)
{
return c->AssignStreams (stream);
@@ -198,12 +198,14 @@
{
m_channel = channel;
}
+
void
YansWifiPhyHelper::SetChannel (std::string channelName)
{
Ptr<YansWifiChannel> channel = Names::Find<YansWifiChannel> (channelName);
m_channel = channel;
}
+
void
YansWifiPhyHelper::Set (std::string name, const AttributeValue &v)
{
@@ -274,14 +276,14 @@
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;
header.SetTsft (Simulator::Now ().GetMicroSeconds ());
- // Our capture includes the FCS, so we set the flag to say so.
+ //Our capture includes the FCS, so we set the flag to say so.
frameFlags |= RadiotapHeader::FRAME_FLAG_FCS_INCLUDED;
if (isShortPreamble)
{
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;
}
-
+
if (txvector.IsShortGuardInterval ())
{
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_GUARD;
@@ -293,10 +295,10 @@
uint16_t channelFlags = 0;
switch (rate)
{
- case 2: // 1Mbps
- case 4: // 2Mbps
- case 10: // 5Mbps
- case 22: // 11Mbps
+ case 2: //1Mbps
+ case 4: //2Mbps
+ case 10: //5Mbps
+ case 22: //11Mbps
channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;
break;
@@ -356,14 +358,14 @@
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;
header.SetTsft (Simulator::Now ().GetMicroSeconds ());
- // Our capture includes the FCS, so we set the flag to say so.
+ //Our capture includes the FCS, so we set the flag to say so.
frameFlags |= RadiotapHeader::FRAME_FLAG_FCS_INCLUDED;
if (isShortPreamble)
{
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;
}
-
+
if (txvector.IsShortGuardInterval ())
{
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_GUARD;
@@ -375,10 +377,10 @@
uint16_t channelFlags = 0;
switch (rate)
{
- case 2: // 1Mbps
- case 4: // 2Mbps
- case 10: // 5Mbps
- case 22: // 11Mbps
+ case 2: //1Mbps
+ case 4: //2Mbps
+ case 10: //5Mbps
+ case 22: //11Mbps
channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;
break;
@@ -438,11 +440,9 @@
void
YansWifiPhyHelper::EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool promiscuous, bool explicitFilename)
{
- //
- // All of the Pcap enable functions vector through here including the ones
- // that are wandering through all of devices on perhaps all of the nodes in
- // the system. We can only deal with devices of type WifiNetDevice.
- //
+ //All of the Pcap enable functions vector through here including the ones
+ //that are wandering through all of devices on perhaps all of the nodes in
+ //the system. We can only deal with devices of type WifiNetDevice.
Ptr<WifiNetDevice> device = nd->GetObject<WifiNetDevice> ();
if (device == 0)
{
@@ -478,11 +478,9 @@
Ptr<NetDevice> nd,
bool explicitFilename)
{
- //
- // All of the ascii enable functions vector through here including the ones
- // that are wandering through all of devices on perhaps all of the nodes in
- // the system. We can only deal with devices of type WifiNetDevice.
- //
+ //All of the ascii enable functions vector through here including the ones
+ //that are wandering through all of devices on perhaps all of the nodes in
+ //the system. We can only deal with devices of type WifiNetDevice.
Ptr<WifiNetDevice> device = nd->GetObject<WifiNetDevice> ();
if (device == 0)
{
@@ -490,29 +488,23 @@
return;
}
- //
- // Our trace sinks are going to use packet printing, so we have to make sure
- // that is turned on.
- //
+ //Our trace sinks are going to use packet printing, so we have to make sure
+ //that is turned on.
Packet::EnablePrinting ();
uint32_t nodeid = nd->GetNode ()->GetId ();
uint32_t deviceid = nd->GetIfIndex ();
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
- // without a context since there will be one file per context and therefore
- // the context would be redundant.
- //
+ //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
- // constructor and lifetime issues. Let the helper decide the actual
- // name of the file given the prefix.
- //
+ //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.
AsciiTraceHelper asciiTraceHelper;
std::string filename;
@@ -526,12 +518,10 @@
}
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
- // some search cost. Since this is presumably happening at topology
- // creation time, it doesn't seem much of a price to pay.
- //
+ //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.
oss.str ("");
oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/RxOk";
Config::ConnectWithoutContext (oss.str (), MakeBoundCallback (&AsciiPhyReceiveSinkWithoutContext, theStream));
@@ -543,13 +533,11 @@
return;
}
- //
- // 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
- // compatibility and simplicity, we just use Config::Connect and let it deal
- // with coming up with a context.
- //
+ //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
+ //compatibility and simplicity, we just use Config::Connect and let it deal
+ //with coming up with a context.
oss.str ("");
oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/RxOk";
Config::Connect (oss.str (), MakeBoundCallback (&AsciiPhyReceiveSinkWithContext, stream));
@@ -559,4 +547,4 @@
Config::Connect (oss.str (), MakeBoundCallback (&AsciiPhyTransmitSinkWithContext, stream));
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/helper/yans-wifi-helper.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/helper/yans-wifi-helper.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef YANS_WIFI_HELPER_H
#define YANS_WIFI_HELPER_H
@@ -128,12 +129,13 @@
/**
* Assign a fixed random variable stream number to the random variables
* used by the channel. Typically this corresponds to random variables
- * used in the propagation loss models. Return the number of streams
- * (possibly zero) that have been assigned.
+ * used in the propagation loss models. Return the number of streams
+ * (possibly zero) that have been assigned.
*
- * \param c NetDeviceContainer of the set of net devices for which the
+ * \param c NetDeviceContainer of the set of net devices for which the
* WifiNetDevice should be modified to use fixed streams
* \param stream first stream index to use
+ *
* \return the number of stream indices assigned by this helper
*/
int64_t AssignStreams (Ptr<YansWifiChannel> c, int64_t stream);
@@ -144,6 +146,7 @@
ObjectFactory m_propagationDelay;
};
+
/**
* \brief Make it easy to create and manage PHY objects for the yans model.
*
@@ -244,7 +247,7 @@
void SetPcapDataLinkType (enum SupportedPcapDataLinkTypes dlt);
/**
- * Get the data link type of PCAP traces to be used.
+ * Get the data link type of PCAP traces to be used.
*
* @see SupportedPcapDataLinkTypes
*
@@ -300,6 +303,6 @@
uint32_t m_pcapDlt;
};
-} // namespace ns3
+} //namespace ns3
#endif /* YANS_WIFI_HELPER_H */
--- a/src/wifi/model/aarf-wifi-manager.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/aarf-wifi-manager.cc Sun Jun 21 00:23:45 2015 +0200
@@ -19,7 +19,6 @@
*/
#include "aarf-wifi-manager.h"
-
#include "ns3/double.h"
#include "ns3/uinteger.h"
#include "ns3/log.h"
@@ -44,14 +43,11 @@
uint32_t m_failed;
bool m_recovery;
uint32_t m_retry;
-
uint32_t m_timerTimeout;
uint32_t m_successThreshold;
-
uint32_t m_rate;
};
-
NS_OBJECT_ENSURE_REGISTERED (AarfWifiManager);
TypeId
@@ -93,6 +89,7 @@
{
NS_LOG_FUNCTION (this);
}
+
AarfWifiManager::~AarfWifiManager ()
{
NS_LOG_FUNCTION (this);
@@ -147,7 +144,7 @@
NS_ASSERT (station->m_retry >= 1);
if (station->m_retry == 1)
{
- // need recovery fallback
+ //need recovery fallback
station->m_successThreshold = (int)(Min (station->m_successThreshold * m_successK,
m_maxSuccessThreshold));
station->m_timerTimeout = (int)(Max (station->m_timerTimeout * m_timerK,
@@ -164,7 +161,7 @@
NS_ASSERT (station->m_retry >= 1);
if (((station->m_retry - 1) % 2) == 1)
{
- // need normal fallback
+ //need normal fallback
station->m_timerTimeout = m_minTimerThreshold;
station->m_successThreshold = m_minSuccessThreshold;
if (station->m_rate != 0)
@@ -178,12 +175,14 @@
}
}
}
+
void
AarfWifiManager::DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode)
{
NS_LOG_FUNCTION (this << station << rxSnr << txMode);
}
+
void
AarfWifiManager::DoReportRtsOk (WifiRemoteStation *station,
double ctsSnr, WifiMode ctsMode, double rtsSnr)
@@ -191,6 +190,7 @@
NS_LOG_FUNCTION (this << station << ctsSnr << ctsMode << rtsSnr);
NS_LOG_DEBUG ("station=" << station << " rts ok");
}
+
void
AarfWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
@@ -214,11 +214,13 @@
station->m_recovery = true;
}
}
+
void
AarfWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
{
NS_LOG_FUNCTION (this << station);
}
+
void
AarfWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
{
@@ -230,8 +232,9 @@
{
NS_LOG_FUNCTION (this << st << size);
AarfWifiRemoteStation *station = (AarfWifiRemoteStation *) st;
- return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station));
+ return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
}
+
WifiTxVector
AarfWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
{
@@ -239,7 +242,7 @@
/// \todo we could/should implement the Aarf algorithm for
/// RTS only by picking a single rate within the BasicRateSet.
AarfWifiRemoteStation *station = (AarfWifiRemoteStation *) st;
- return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station));
+ return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
}
bool
@@ -249,4 +252,4 @@
return true;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/aarf-wifi-manager.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/aarf-wifi-manager.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef AARF_WIFI_MANAGER_H
#define AARF_WIFI_MANAGER_H
@@ -40,7 +41,7 @@
AarfWifiManager ();
virtual ~AarfWifiManager ();
private:
- // overriden from base class
+ //overriden from base class
virtual WifiRemoteStation * DoCreateStation (void) const;
virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
@@ -63,7 +64,6 @@
double m_timerK;
};
-} // namespace ns3
-
+} //namespace ns3
#endif /* AARF_WIFI_MANAGER_H */
--- a/src/wifi/model/aarfcd-wifi-manager.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/aarfcd-wifi-manager.cc Sun Jun 21 00:23:45 2015 +0200
@@ -48,10 +48,8 @@
bool m_recovery;
bool m_justModifyRate;
uint32_t m_retry;
-
uint32_t m_successThreshold;
uint32_t m_timerTimeout;
-
uint32_t m_rate;
bool m_rtsOn;
uint32_t m_rtsWnd;
@@ -115,22 +113,25 @@
;
return tid;
}
+
AarfcdWifiManager::AarfcdWifiManager ()
: WifiRemoteStationManager ()
{
NS_LOG_FUNCTION (this);
}
+
AarfcdWifiManager::~AarfcdWifiManager ()
{
NS_LOG_FUNCTION (this);
}
+
WifiRemoteStation *
AarfcdWifiManager::DoCreateStation (void) const
{
NS_LOG_FUNCTION (this);
AarfcdWifiRemoteStation *station = new AarfcdWifiRemoteStation ();
- // aarf fields below
+ //aarf fields below
station->m_successThreshold = m_minSuccessThreshold;
station->m_timerTimeout = m_minTimerThreshold;
station->m_rate = 0;
@@ -140,7 +141,7 @@
station->m_retry = 0;
station->m_timer = 0;
- // aarf-cd specific fields below
+ //aarf-cd specific fields below
station->m_rtsOn = false;
station->m_rtsWnd = m_minRtsWnd;
station->m_rtsCounter = 0;
@@ -190,7 +191,7 @@
station->m_rtsCounter = station->m_rtsWnd;
if (station->m_retry == 1)
{
- // need recovery fallback
+ //need recovery fallback
if (m_turnOffRtsAfterRateDecrease)
{
TurnOffRts (station);
@@ -214,7 +215,7 @@
station->m_rtsCounter = station->m_rtsWnd;
if (((station->m_retry - 1) % 2) == 1)
{
- // need normal fallback
+ //need normal fallback
if (m_turnOffRtsAfterRateDecrease)
{
TurnOffRts (station);
@@ -234,12 +235,14 @@
}
CheckRts (station);
}
+
void
AarfcdWifiManager::DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode)
{
NS_LOG_FUNCTION (this << station << rxSnr << txMode);
}
+
void
AarfcdWifiManager::DoReportRtsOk (WifiRemoteStation *st,
double ctsSnr, WifiMode ctsMode, double rtsSnr)
@@ -249,6 +252,7 @@
NS_LOG_DEBUG ("station=" << station << " rts ok");
station->m_rtsCounter--;
}
+
void
AarfcdWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
@@ -282,11 +286,13 @@
}
CheckRts (station);
}
+
void
AarfcdWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
{
NS_LOG_FUNCTION (this << station);
}
+
void
AarfcdWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
{
@@ -298,7 +304,7 @@
{
NS_LOG_FUNCTION (this << st << size);
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
- return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station));
+ return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
}
WifiTxVector
AarfcdWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
@@ -307,7 +313,7 @@
/// \todo we could/should implement the Aarf algorithm for
/// RTS only by picking a single rate within the BasicRateSet.
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
- return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station));
+ return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
}
bool
@@ -377,4 +383,4 @@
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/aarfcd-wifi-manager.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/aarfcd-wifi-manager.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Federico Maguolo <maguolof@dei.unipd.it>
*/
+
#ifndef AARFCD_WIFI_MANAGER_H
#define AARFCD_WIFI_MANAGER_H
@@ -104,20 +105,20 @@
*/
void TurnOnRts (AarfcdWifiRemoteStation *station);
- // aarf fields below
+ //aarf fields below
uint32_t m_minTimerThreshold;
uint32_t m_minSuccessThreshold;
double m_successK;
uint32_t m_maxSuccessThreshold;
double m_timerK;
- // aarf-cd fields below
+ //aarf-cd fields below
uint32_t m_minRtsWnd;
uint32_t m_maxRtsWnd;
bool m_turnOffRtsAfterRateDecrease;
bool m_turnOnRtsAfterRateIncrease;
};
-} // namespace ns3
+} //namespace ns3
#endif /* AARFCD_WIFI_MANAGER_H */
--- a/src/wifi/model/adhoc-wifi-mac.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/adhoc-wifi-mac.cc Sun Jun 21 00:23:45 2015 +0200
@@ -16,17 +16,16 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
+ * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Mirko Banchi <mk.banchi@gmail.com>
*/
+
#include "adhoc-wifi-mac.h"
-
#include "ns3/pointer.h"
#include "ns3/log.h"
#include "ns3/string.h"
#include "ns3/boolean.h"
#include "ns3/trace-source-accessor.h"
-
#include "qos-tag.h"
#include "mac-low.h"
#include "dcf-manager.h"
@@ -56,8 +55,7 @@
AdhocWifiMac::AdhocWifiMac ()
{
NS_LOG_FUNCTION (this);
-
- // Let the lower layers know that we are acting in an IBSS
+ //Let the lower layers know that we are acting in an IBSS
SetTypeOfStation (ADHOC_STA);
}
@@ -70,12 +68,12 @@
AdhocWifiMac::SetAddress (Mac48Address address)
{
NS_LOG_FUNCTION (this << address);
- // In an IBSS, the BSSID is supposed to be generated per Section
- // 11.1.3 of IEEE 802.11. We don't currently do this - instead we
- // make an IBSS STA a bit like an AP, with the BSSID for frames
- // transmitted by each STA set to that STA's address.
+ //In an IBSS, the BSSID is supposed to be generated per Section
+ //11.1.3 of IEEE 802.11. We don't currently do this - instead we
+ //make an IBSS STA a bit like an AP, with the BSSID for frames
+ //transmitted by each STA set to that STA's address.
//
- // This is why we're overriding this method.
+ //This is why we're overriding this method.
RegularWifiMac::SetAddress (address);
RegularWifiMac::SetBssid (address);
}
@@ -86,39 +84,39 @@
NS_LOG_FUNCTION (this << packet << to);
if (m_stationManager->IsBrandNew (to))
{
- // In ad hoc mode, we assume that every destination supports all
- // the rates we support.
+ //In ad hoc mode, we assume that every destination supports all
+ //the rates we support.
m_stationManager->AddAllSupportedModes (to);
m_stationManager->RecordDisassociated (to);
}
WifiMacHeader hdr;
- // If we are not a QoS STA then we definitely want to use AC_BE to
- // transmit the packet. A TID of zero will map to AC_BE (through \c
- // QosUtilsMapTidToAc()), so we use that as our default here.
+ //If we are not a QoS STA then we definitely want to use AC_BE to
+ //transmit the packet. A TID of zero will map to AC_BE (through \c
+ //QosUtilsMapTidToAc()), so we use that as our default here.
uint8_t tid = 0;
- // For now, a STA that supports QoS does not support non-QoS
- // associations, and vice versa. In future the STA model should fall
- // back to non-QoS if talking to a peer that is also non-QoS. At
- // that point there will need to be per-station QoS state maintained
- // by the association state machine, and consulted here.
+ //For now, a STA that supports QoS does not support non-QoS
+ //associations, and vice versa. In future the STA model should fall
+ //back to non-QoS if talking to a peer that is also non-QoS. At
+ //that point there will need to be per-station QoS state maintained
+ //by the association state machine, and consulted here.
if (m_qosSupported)
{
hdr.SetType (WIFI_MAC_QOSDATA);
hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
hdr.SetQosNoEosp ();
hdr.SetQosNoAmsdu ();
- // Transmission of multiple frames in the same TXOP is not
- // supported for now
+ //Transmission of multiple frames in the same TXOP is not
+ //supported for now
hdr.SetQosTxopLimit (0);
- // Fill in the QoS control field in the MAC header
+ //Fill in the QoS control field in the MAC header
tid = QosUtilsGetTidForPacket (packet);
- // Any value greater than 7 is invalid and likely indicates that
- // the packet had no QoS tag, so we revert to zero, which'll
- // mean that AC_BE is used.
+ //Any value greater than 7 is invalid and likely indicates that
+ //the packet had no QoS tag, so we revert to zero, which will
+ //mean that AC_BE is used.
if (tid > 7)
{
tid = 0;
@@ -138,7 +136,7 @@
if (m_qosSupported)
{
- // Sanity check that the TID is valid
+ //Sanity check that the TID is valid
NS_ASSERT (tid < 8);
m_edca[QosUtilsMapTidToAc (tid)]->Queue (packet, hdr);
}
@@ -154,9 +152,9 @@
NS_LOG_FUNCTION (this << &linkUp);
RegularWifiMac::SetLinkUpCallback (linkUp);
- // The approach taken here is that, from the point of view of a STA
- // in IBSS mode, the link is always up, so we immediately invoke the
- // callback if one is set
+ //The approach taken here is that, from the point of view of a STA
+ //in IBSS mode, the link is always up, so we immediately invoke the
+ //callback if one is set
linkUp ();
}
@@ -181,10 +179,10 @@
return;
}
- // Invoke the receive handler of our parent class to deal with any
- // other frames. Specifically, this will handle Block Ack-related
- // Management Action frames.
+ //Invoke the receive handler of our parent class to deal with any
+ //other frames. Specifically, this will handle Block Ack-related
+ //Management Action frames.
RegularWifiMac::Receive (packet, hdr);
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/adhoc-wifi-mac.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/adhoc-wifi-mac.h Sun Jun 21 00:23:45 2015 +0200
@@ -16,14 +16,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
+ * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Mirko Banchi <mk.banchi@gmail.com>
*/
#ifndef ADHOC_WIFI_MAC_H
#define ADHOC_WIFI_MAC_H
#include "regular-wifi-mac.h"
-
#include "amsdu-subframe-header.h"
namespace ns3 {
@@ -61,10 +60,11 @@
*/
virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to);
+
private:
virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
};
-} // namespace ns3
+} //namespace ns3
#endif /* ADHOC_WIFI_MAC_H */
--- a/src/wifi/model/ampdu-subframe-header.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/ampdu-subframe-header.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Ghada Badawy <gbadawy@gmail.com>
*/
+
#include "ampdu-subframe-header.h"
#include "ns3/address-utils.h"
@@ -116,4 +117,4 @@
return m_length;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/ampdu-subframe-header.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/ampdu-subframe-header.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Ghada Badawy <gbadawy@gmail.com>
*/
+
#ifndef AMPDU_SUBFRAME_HEADER_H
#define AMPDU_SUBFRAME_HEADER_H
@@ -86,6 +87,6 @@
uint16_t m_length; //!< length field
};
-} // namespace ns3
+} //namespace ns3
#endif /* AMPDU_SUBFRAME_HEADER_H */
--- a/src/wifi/model/ampdu-tag.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/ampdu-tag.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Ghada Badawy <gbadawy@gmail.com>
*/
+
#include "ampdu-tag.h"
#include "ns3/tag.h"
#include "ns3/uinteger.h"
@@ -102,4 +103,4 @@
os << "A-MPDU exists=" << m_ampdu;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/ampdu-tag.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/ampdu-tag.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Ghada Badawy <gbadawy@gmail.com>
*/
+
#ifndef AMPDU_TAG_H
#define AMPDU_TAG_H
@@ -77,6 +78,7 @@
uint8_t m_noOfMpdus; //!< number of MPDUs in the A-MPDU
};
-} // namespace ns3
+} //namespace ns3
#endif /* AMPDU_TAG_H */
+
--- a/src/wifi/model/amrr-wifi-manager.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/amrr-wifi-manager.cc Sun Jun 21 00:23:45 2015 +0200
@@ -110,18 +110,19 @@
return station;
}
-
void
AmrrWifiManager::DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode)
{
NS_LOG_FUNCTION (this << station << rxSnr << txMode);
}
+
void
AmrrWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
{
NS_LOG_FUNCTION (this << station);
}
+
void
AmrrWifiManager::DoReportDataFailed (WifiRemoteStation *st)
{
@@ -130,12 +131,14 @@
station->m_retry++;
station->m_tx_retr++;
}
+
void
AmrrWifiManager::DoReportRtsOk (WifiRemoteStation *st,
double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
NS_LOG_FUNCTION (this << st << ctsSnr << ctsMode << rtsSnr);
}
+
void
AmrrWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
@@ -145,11 +148,13 @@
station->m_retry = 0;
station->m_tx_ok++;
}
+
void
AmrrWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
{
NS_LOG_FUNCTION (this << station);
}
+
void
AmrrWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
{
@@ -158,12 +163,14 @@
station->m_retry = 0;
station->m_tx_err++;
}
+
bool
AmrrWifiManager::IsMinRate (AmrrWifiRemoteStation *station) const
{
NS_LOG_FUNCTION (this << station);
return (station->m_txrate == 0);
}
+
bool
AmrrWifiManager::IsMaxRate (AmrrWifiRemoteStation *station) const
{
@@ -171,24 +178,28 @@
NS_ASSERT (station->m_txrate + 1 <= GetNSupported (station));
return (station->m_txrate + 1 == GetNSupported (station));
}
+
bool
AmrrWifiManager::IsSuccess (AmrrWifiRemoteStation *station) const
{
NS_LOG_FUNCTION (this << station);
return (station->m_tx_retr + station->m_tx_err) < station->m_tx_ok * m_successRatio;
}
+
bool
AmrrWifiManager::IsFailure (AmrrWifiRemoteStation *station) const
{
NS_LOG_FUNCTION (this << station);
return (station->m_tx_retr + station->m_tx_err) > station->m_tx_ok * m_failureRatio;
}
+
bool
AmrrWifiManager::IsEnough (AmrrWifiRemoteStation *station) const
{
NS_LOG_FUNCTION (this << station);
return (station->m_tx_retr + station->m_tx_err + station->m_tx_ok) > 10;
}
+
void
AmrrWifiManager::ResetCnt (AmrrWifiRemoteStation *station)
{
@@ -197,6 +208,7 @@
station->m_tx_err = 0;
station->m_tx_retr = 0;
}
+
void
AmrrWifiManager::IncreaseRate (AmrrWifiRemoteStation *station)
{
@@ -204,6 +216,7 @@
station->m_txrate++;
NS_ASSERT (station->m_txrate < GetNSupported (station));
}
+
void
AmrrWifiManager::DecreaseRate (AmrrWifiRemoteStation *station)
{
@@ -276,6 +289,7 @@
ResetCnt (station);
}
}
+
WifiTxVector
AmrrWifiManager::DoGetDataTxVector (WifiRemoteStation *st, uint32_t size)
{
@@ -322,8 +336,9 @@
}
}
- return WifiTxVector (GetSupported (station, rateIndex), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station));
+ return WifiTxVector (GetSupported (station, rateIndex), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
}
+
WifiTxVector
AmrrWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
{
@@ -331,10 +346,9 @@
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
UpdateMode (station);
/// \todo can we implement something smarter ?
- return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station));
+ return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
}
-
bool
AmrrWifiManager::IsLowLatency (void) const
{
@@ -342,4 +356,4 @@
return true;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/amrr-wifi-manager.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/amrr-wifi-manager.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef AMRR_WIFI_MANAGER_H
#define AMRR_WIFI_MANAGER_H
@@ -43,8 +44,9 @@
AmrrWifiManager ();
+
private:
- // overriden from base class
+ //overriden from base class
virtual WifiRemoteStation * DoCreateStation (void) const;
virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
@@ -90,6 +92,7 @@
* minimum rate.
*
* \param station
+ *
* \return true if the current rate is the minimum rate,
* false otherwise
*/
@@ -99,6 +102,7 @@
* maximum rate.
*
* \param station
+ *
* \return true if the current rate is the maximum rate,
* false otherwise
*/
@@ -108,6 +112,7 @@
* is less than the number of successful transmission (times ratio).
*
* \param station
+ *
* \return true if the number of retransmission and transmission error
* is less than the number of successful transmission
* (times ratio), false otherwise
@@ -118,6 +123,7 @@
* is greater than the number of successful transmission (times ratio).
*
* \param station
+ *
* \return true if the number of retransmission and transmission error
* is less than the number of successful transmission
* (times ratio), false otherwise
@@ -141,6 +147,6 @@
uint32_t m_minSuccessThreshold;
};
-} // namespace ns3
+} //namespace ns3
#endif /* AMRR_WIFI_MANAGER_H */
--- a/src/wifi/model/amsdu-subframe-header.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/amsdu-subframe-header.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#include "amsdu-subframe-header.h"
#include "ns3/address-utils.h"
#include "ns3/log.h"
@@ -131,4 +132,4 @@
return m_length;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/amsdu-subframe-header.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/amsdu-subframe-header.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#ifndef AMSDU_SUBFRAME_HEADER_H
#define AMSDU_SUBFRAME_HEADER_H
@@ -56,6 +57,6 @@
uint16_t m_length;
};
-} // namespace ns3
+} //namespace ns3
#endif /* AMSDU_SUBFRAME_HEADER_H */
--- a/src/wifi/model/ap-wifi-mac.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/ap-wifi-mac.cc Sun Jun 21 00:23:45 2015 +0200
@@ -16,18 +16,17 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
+ * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Mirko Banchi <mk.banchi@gmail.com>
*/
+
#include "ap-wifi-mac.h"
-
#include "ns3/assert.h"
#include "ns3/log.h"
#include "ns3/simulator.h"
#include "ns3/string.h"
#include "ns3/pointer.h"
#include "ns3/boolean.h"
-
#include "qos-tag.h"
#include "wifi-phy.h"
#include "dcf-manager.h"
@@ -56,7 +55,8 @@
MakeTimeAccessor (&ApWifiMac::GetBeaconInterval,
&ApWifiMac::SetBeaconInterval),
MakeTimeChecker ())
- .AddAttribute ("BeaconJitter", "A uniform random variable to cause the initial beacon starting time (after simulation time 0) to be distributed between 0 and the BeaconInterval.",
+ .AddAttribute ("BeaconJitter", "A uniform random variable to cause the initial beacon starting time (after simulation time 0) "
+ "to be distributed between 0 and the BeaconInterval.",
StringValue ("ns3::UniformRandomVariable"),
MakePointerAccessor (&ApWifiMac::m_beaconJitter),
MakePointerChecker<UniformRandomVariable> ())
@@ -84,7 +84,7 @@
m_beaconDca->SetManager (m_dcfManager);
m_beaconDca->SetTxMiddle (m_txMiddle);
- // Let the lower layers know that we are acting as an AP.
+ //Let the lower layers know that we are acting as an AP.
SetTypeOfStation (AP);
m_enableBeaconGeneration = false;
@@ -109,8 +109,8 @@
ApWifiMac::SetAddress (Mac48Address address)
{
NS_LOG_FUNCTION (this << address);
- // As an AP, our MAC address is also the BSSID. Hence we are
- // overriding this function and setting both in our parent class.
+ //As an AP, our MAC address is also the BSSID. Hence we are
+ //overriding this function and setting both in our parent class.
RegularWifiMac::SetAddress (address);
RegularWifiMac::SetBssid (address);
}
@@ -158,9 +158,9 @@
NS_LOG_FUNCTION (this << &linkUp);
RegularWifiMac::SetLinkUpCallback (linkUp);
- // The approach taken here is that, from the point of view of an AP,
- // the link is always up, so we immediately invoke the callback if
- // one is set
+ //The approach taken here is that, from the point of view of an AP,
+ //the link is always up, so we immediately invoke the callback if
+ //one is set
linkUp ();
}
@@ -195,18 +195,18 @@
Mac48Address to)
{
NS_LOG_FUNCTION (this << packet << from << to);
- // If we are not a QoS AP then we definitely want to use AC_BE to
- // transmit the packet. A TID of zero will map to AC_BE (through \c
- // QosUtilsMapTidToAc()), so we use that as our default here.
+ //If we are not a QoS AP then we definitely want to use AC_BE to
+ //transmit the packet. A TID of zero will map to AC_BE (through \c
+ //QosUtilsMapTidToAc()), so we use that as our default here.
uint8_t tid = 0;
- // If we are a QoS AP then we attempt to get a TID for this packet
+ //If we are a QoS AP then we attempt to get a TID for this packet
if (m_qosSupported)
{
tid = QosUtilsGetTidForPacket (packet);
- // Any value greater than 7 is invalid and likely indicates that
- // the packet had no QoS tag, so we revert to zero, which'll
- // mean that AC_BE is used.
+ //Any value greater than 7 is invalid and likely indicates that
+ //the packet had no QoS tag, so we revert to zero, which'll
+ //mean that AC_BE is used.
if (tid > 7)
{
tid = 0;
@@ -223,21 +223,21 @@
NS_LOG_FUNCTION (this << packet << from << to << static_cast<uint32_t> (tid));
WifiMacHeader hdr;
- // For now, an AP that supports QoS does not support non-QoS
- // associations, and vice versa. In future the AP model should
- // support simultaneously associated QoS and non-QoS STAs, at which
- // point there will need to be per-association QoS state maintained
- // by the association state machine, and consulted here.
+ //For now, an AP that supports QoS does not support non-QoS
+ //associations, and vice versa. In future the AP model should
+ //support simultaneously associated QoS and non-QoS STAs, at which
+ //point there will need to be per-association QoS state maintained
+ //by the association state machine, and consulted here.
if (m_qosSupported)
{
hdr.SetType (WIFI_MAC_QOSDATA);
hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
hdr.SetQosNoEosp ();
hdr.SetQosNoAmsdu ();
- // Transmission of multiple frames in the same TXOP is not
- // supported for now
+ //Transmission of multiple frames in the same TXOP is not
+ //supported for now
hdr.SetQosTxopLimit (0);
- // Fill in the QoS control field in the MAC header
+ //Fill in the QoS control field in the MAC header
hdr.SetQosTid (tid);
}
else
@@ -246,7 +246,9 @@
}
if (m_htSupported)
- hdr.SetNoOrder();
+ {
+ hdr.SetNoOrder ();
+ }
hdr.SetAddr1 (to);
hdr.SetAddr2 (GetAddress ());
hdr.SetAddr3 (from);
@@ -255,7 +257,7 @@
if (m_qosSupported)
{
- // Sanity check that the TID is valid
+ //Sanity check that the TID is valid
NS_ASSERT (tid < 8);
m_edca[QosUtilsMapTidToAc (tid)]->Queue (packet, hdr);
}
@@ -279,9 +281,9 @@
ApWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to)
{
NS_LOG_FUNCTION (this << packet << to);
- // We're sending this packet with a from address that is our own. We
- // get that address from the lower MAC and make use of the
- // from-spoofing Enqueue() method to avoid duplicated code.
+ //We're sending this packet with a from address that is our own. We
+ //get that address from the lower MAC and make use of the
+ //from-spoofing Enqueue() method to avoid duplicated code.
Enqueue (packet, to, m_low->GetAddress ());
}
@@ -297,55 +299,57 @@
{
NS_LOG_FUNCTION (this);
SupportedRates rates;
- // If it is an HT-AP then add the BSSMembershipSelectorSet
- // which only includes 127 for HT now. The standard says that the BSSMembershipSelectorSet
- // must have its MSB set to 1 (must be treated as a Basic Rate)
- // Also the standard mentioned that at leat 1 element should be included in the SupportedRates the rest can be in the ExtendedSupportedRates
+ //If it is an HT-AP then add the BSSMembershipSelectorSet
+ //which only includes 127 for HT now. The standard says that the BSSMembershipSelectorSet
+ //must have its MSB set to 1 (must be treated as a Basic Rate)
+ //Also the standard mentioned that at leat 1 element should be included in the SupportedRates the rest can be in the ExtendedSupportedRates
if (m_htSupported)
{
- for (uint32_t i = 0; i < m_phy->GetNBssMembershipSelectors(); i++)
+ for (uint32_t i = 0; i < m_phy->GetNBssMembershipSelectors (); i++)
{
- rates.SetBasicRate(m_phy->GetBssMembershipSelector(i));
+ rates.SetBasicRate (m_phy->GetBssMembershipSelector (i));
}
}
- // send the set of supported rates and make sure that we indicate
- // the Basic Rate set in this set of supported rates.
+ //Send the set of supported rates and make sure that we indicate
+ //the Basic Rate set in this set of supported rates.
for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
{
WifiMode mode = m_phy->GetMode (i);
rates.AddSupportedRate (mode.GetDataRate ());
- // add rates that are part of the BSSBasicRateSet (manufacturer dependent!)
- // here we choose to add the mandatory rates to the BSSBasicRateSet,
- // exept for 802.11b where we assume that only the two lowest mandatory rates are part of the BSSBasicRateSet
- if (mode.IsMandatory() &&
- ((mode.GetModulationClass () != WIFI_MOD_CLASS_DSSS) || mode == WifiPhy::GetDsssRate1Mbps () || mode == WifiPhy::GetDsssRate2Mbps ()))
- {
- m_stationManager->AddBasicMode (mode);
- }
+ //Add rates that are part of the BSSBasicRateSet (manufacturer dependent!)
+ //here we choose to add the mandatory rates to the BSSBasicRateSet,
+ //exept for 802.11b where we assume that only the two lowest mandatory rates are part of the BSSBasicRateSet
+ if (mode.IsMandatory ()
+ && ((mode.GetModulationClass () != WIFI_MOD_CLASS_DSSS) || mode == WifiPhy::GetDsssRate1Mbps () || mode == WifiPhy::GetDsssRate2Mbps ()))
+ {
+ m_stationManager->AddBasicMode (mode);
+ }
}
- // set the basic rates
+ //set the basic rates
for (uint32_t j = 0; j < m_stationManager->GetNBasicModes (); j++)
{
WifiMode mode = m_stationManager->GetBasicMode (j);
rates.SetBasicRate (mode.GetDataRate ());
}
-
+
return rates;
}
+
HtCapabilities
ApWifiMac::GetHtCapabilities (void) const
{
- HtCapabilities capabilities;
- capabilities.SetHtSupported(1);
- capabilities.SetLdpc (m_phy->GetLdpc());
- capabilities.SetShortGuardInterval20 (m_phy->GetGuardInterval());
- capabilities.SetGreenfield (m_phy->GetGreenfield());
- for (uint8_t i =0 ; i < m_phy->GetNMcs();i++)
- {
- capabilities.SetRxMcsBitmask(m_phy->GetMcs(i));
- }
- return capabilities;
+ HtCapabilities capabilities;
+ capabilities.SetHtSupported (1);
+ capabilities.SetLdpc (m_phy->GetLdpc ());
+ capabilities.SetShortGuardInterval20 (m_phy->GetGuardInterval ());
+ capabilities.SetGreenfield (m_phy->GetGreenfield ());
+ for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
+ {
+ capabilities.SetRxMcsBitmask (m_phy->GetMcs (i));
+ }
+ return capabilities;
}
+
void
ApWifiMac::SendProbeResp (Mac48Address to)
{
@@ -362,17 +366,17 @@
probe.SetSsid (GetSsid ());
probe.SetSupportedRates (GetSupportedRates ());
probe.SetBeaconIntervalUs (m_beaconInterval.GetMicroSeconds ());
-if (m_htSupported)
+ if (m_htSupported)
{
- probe.SetHtCapabilities (GetHtCapabilities());
- hdr.SetNoOrder();
+ probe.SetHtCapabilities (GetHtCapabilities ());
+ hdr.SetNoOrder ();
}
packet->AddHeader (probe);
- // The standard is not clear on the correct queue for management
- // frames if we are a QoS AP. The approach taken here is to always
- // use the DCF for these regardless of whether we have a QoS
- // association or not.
+ //The standard is not clear on the correct queue for management
+ //frames if we are a QoS AP. The approach taken here is to always
+ //use the DCF for these regardless of whether we have a QoS
+ //association or not.
m_dca->Queue (packet, hdr);
}
@@ -401,17 +405,17 @@
assoc.SetSupportedRates (GetSupportedRates ());
assoc.SetStatusCode (code);
- if (m_htSupported)
+ if (m_htSupported)
{
- assoc.SetHtCapabilities (GetHtCapabilities());
- hdr.SetNoOrder();
+ assoc.SetHtCapabilities (GetHtCapabilities ());
+ hdr.SetNoOrder ();
}
packet->AddHeader (assoc);
- // The standard is not clear on the correct queue for management
- // frames if we are a QoS AP. The approach taken here is to always
- // use the DCF for these regardless of whether we have a QoS
- // association or not.
+ //The standard is not clear on the correct queue for management
+ //frames if we are a QoS AP. The approach taken here is to always
+ //use the DCF for these regardless of whether we have a QoS
+ //association or not.
m_dca->Queue (packet, hdr);
}
@@ -433,12 +437,12 @@
beacon.SetBeaconIntervalUs (m_beaconInterval.GetMicroSeconds ());
if (m_htSupported)
{
- beacon.SetHtCapabilities (GetHtCapabilities());
- hdr.SetNoOrder();
+ beacon.SetHtCapabilities (GetHtCapabilities ());
+ hdr.SetNoOrder ();
}
packet->AddHeader (beacon);
- // The beacon has it's own special queue, so we load it in there
+ //The beacon has it's own special queue, so we load it in there
m_beaconDca->Queue (packet, hdr);
m_beaconEvent = Simulator::Schedule (m_beaconInterval, &ApWifiMac::SendOneBeacon, this);
}
@@ -514,9 +518,9 @@
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,
- // then we need to preserve the UP in the QoS control
- // header...
+ //If the frame we are forwarding is of type QoS Data,
+ //then we need to preserve the UP in the QoS control
+ //header...
if (hdr->IsQosData ())
{
ForwardDown (packet, from, to, hdr->GetQosTid ());
@@ -535,14 +539,14 @@
else if (hdr->IsFromDs ()
&& hdr->IsToDs ())
{
- // this is an AP-to-AP frame
- // we ignore for now.
+ //this is an AP-to-AP frame
+ //we ignore for now.
NotifyRxDrop (packet);
}
else
{
- // we can ignore these frames since
- // they are not targeted at the AP
+ //we can ignore these frames since
+ //they are not targeted at the AP
NotifyRxDrop (packet);
}
return;
@@ -559,8 +563,8 @@
{
if (hdr->IsAssocReq ())
{
- // first, verify that the the station's supported
- // rate set is compatible with our Basic Rate set
+ //first, verify that the the station's supported
+ //rate set is compatible with our Basic Rate set
MgtAssocRequestHeader assocReq;
packet->RemoveHeader (assocReq);
SupportedRates rates = assocReq.GetSupportedRates ();
@@ -574,31 +578,32 @@
break;
}
}
- if (m_htSupported)
- {//check that the STA supports all MCSs in Basic MCS Set
- HtCapabilities htcapabilities = assocReq.GetHtCapabilities ();
- for (uint32_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
+ if (m_htSupported)
+ {
+ //check that the STA supports all MCSs in Basic MCS Set
+ HtCapabilities htcapabilities = assocReq.GetHtCapabilities ();
+ for (uint32_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
+ {
+ uint8_t mcs = m_stationManager->GetBasicMcs (i);
+ if (!htcapabilities.IsSupportedMcs (mcs))
{
- uint8_t mcs = m_stationManager->GetBasicMcs (i);
- if (!htcapabilities.IsSupportedMcs (mcs))
- {
- problem = true;
- break;
- }
- }
-
- }
+ problem = true;
+ break;
+ }
+ }
+
+ }
if (problem)
{
- // one of the Basic Rate set mode is not
- // supported by the station. So, we return an assoc
- // response with an error status.
+ //One of the Basic Rate set mode is not
+ //supported by the station. So, we return an assoc
+ //response with an error status.
SendAssocResp (hdr->GetAddr2 (), false);
}
else
{
- // station supports all rates in Basic Rate Set.
- // record all its supported modes in its associated WifiRemoteStation
+ //station supports all rates in Basic Rate Set.
+ //record all its supported modes in its associated WifiRemoteStation
for (uint32_t j = 0; j < m_phy->GetNModes (); j++)
{
WifiMode mode = m_phy->GetMode (j);
@@ -607,21 +612,21 @@
m_stationManager->AddSupportedMode (from, mode);
}
}
- if (m_htSupported)
+ if (m_htSupported)
{
HtCapabilities htcapabilities = assocReq.GetHtCapabilities ();
m_stationManager->AddStationHtCapabilities (from,htcapabilities);
for (uint32_t j = 0; j < m_phy->GetNMcs (); j++)
- {
- uint8_t mcs = m_phy->GetMcs (j);
- if (htcapabilities.IsSupportedMcs (mcs))
- {
- m_stationManager->AddSupportedMcs (from, mcs);
- }
+ {
+ uint8_t mcs = m_phy->GetMcs (j);
+ if (htcapabilities.IsSupportedMcs (mcs))
+ {
+ m_stationManager->AddSupportedMcs (from, mcs);
+ }
}
- }
+ }
m_stationManager->RecordWaitAssocTxOk (from);
- // send assoc response with success status.
+ //send assoc response with success status.
SendAssocResp (hdr->GetAddr2 (), true);
}
return;
@@ -634,9 +639,9 @@
}
}
- // Invoke the receive handler of our parent class to deal with any
- // other frames. Specifically, this will handle Block Ack-related
- // Management Action frames.
+ //Invoke the receive handler of our parent class to deal with any
+ //other frames. Specifically, this will handle Block Ack-related
+ //Management Action frames.
RegularWifiMac::Receive (packet, hdr);
}
@@ -677,16 +682,16 @@
if (m_enableBeaconJitter)
{
int64_t jitter = m_beaconJitter->GetValue (0, m_beaconInterval.GetMicroSeconds ());
- NS_LOG_DEBUG ("Scheduling initial beacon for access point " << GetAddress() << " at time " << jitter << " microseconds");
+ NS_LOG_DEBUG ("Scheduling initial beacon for access point " << GetAddress () << " at time " << jitter << " microseconds");
m_beaconEvent = Simulator::Schedule (MicroSeconds (jitter), &ApWifiMac::SendOneBeacon, this);
}
else
{
- NS_LOG_DEBUG ("Scheduling initial beacon for access point " << GetAddress() << " at time 0");
+ NS_LOG_DEBUG ("Scheduling initial beacon for access point " << GetAddress () << " at time 0");
m_beaconEvent = Simulator::ScheduleNow (&ApWifiMac::SendOneBeacon, this);
}
}
RegularWifiMac::DoInitialize ();
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/ap-wifi-mac.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/ap-wifi-mac.h Sun Jun 21 00:23:45 2015 +0200
@@ -16,9 +16,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
+ * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Mirko Banchi <mk.banchi@gmail.com>
*/
+
#ifndef AP_WIFI_MAC_H
#define AP_WIFI_MAC_H
@@ -77,6 +78,7 @@
* frames without altering the source address.
*/
virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
+
virtual bool SupportsSendFrom (void) const;
/**
@@ -96,16 +98,18 @@
*/
void StartBeaconing (void);
- /**
- * Assign a fixed random variable stream number to the random variables
- * used by this model. Return the number of streams (possibly zero) that
- * have been assigned.
- *
- * \param stream first stream index to use
- * \return the number of stream indices assigned by this model
- */
+ /**
+ * Assign a fixed random variable stream number to the random variables
+ * used by this model. Return the number of streams (possibly zero) that
+ * have been assigned.
+ *
+ * \param stream first stream index to use
+ *
+ * \return the number of stream indices assigned by this model
+ */
int64_t AssignStreams (int64_t stream);
+
private:
virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
/**
@@ -113,7 +117,7 @@
* (i.e. we received an ACK from the receiver). If the packet
* was an association response to the receiver, we record that
* the receiver is now associated with us.
- *
+ *
* \param hdr the header of the packet that we successfully sent
*/
virtual void TxOk (const WifiMacHeader &hdr);
@@ -138,7 +142,6 @@
*/
virtual void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
const WifiMacHeader *hdr);
-
/**
* Forward the packet down to DCF/EDCAF (enqueue the packet). This method
* is a wrapper for ForwardDown with traffic id.
@@ -178,7 +181,7 @@
void SendOneBeacon (void);
/**
* Return the HT capability of the current AP.
- *
+ *
* \return the HT capability that we support
*/
HtCapabilities GetHtCapabilities (void) const;
@@ -201,17 +204,18 @@
* \return true if beacons are periodically generated, false otherwise
*/
bool GetBeaconGeneration (void) const;
+
virtual void DoDispose (void);
virtual void DoInitialize (void);
- Ptr<DcaTxop> m_beaconDca; //!< Dedicated DcaTxop for beacons
- Time m_beaconInterval; //!< Interval between beacons
- bool m_enableBeaconGeneration; //!< Flag if beacons are being generated
- EventId m_beaconEvent; //!< Event to generate one beacon
+ Ptr<DcaTxop> m_beaconDca; //!< Dedicated DcaTxop for beacons
+ Time m_beaconInterval; //!< Interval between beacons
+ bool m_enableBeaconGeneration; //!< Flag if beacons are being generated
+ EventId m_beaconEvent; //!< Event to generate one beacon
Ptr<UniformRandomVariable> m_beaconJitter; //!< UniformRandomVariable used to randomize the time of the first beacon
- bool m_enableBeaconJitter; //!< Flag if the first beacon should be generated at random time
+ bool m_enableBeaconJitter; //!< Flag if the first beacon should be generated at random time
};
-} // namespace ns3
+} //namespace ns3
#endif /* AP_WIFI_MAC_H */
--- a/src/wifi/model/aparf-wifi-manager.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/aparf-wifi-manager.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,13 +17,16 @@
*
* Author: Matias Richart <mrichart@fing.edu.uy>
*/
+
#include "aparf-wifi-manager.h"
#include "wifi-phy.h"
#include "ns3/assert.h"
#include "ns3/log.h"
#include "ns3/uinteger.h"
#include "ns3/trace-source-accessor.h"
+
#define Min(a,b) ((a < b) ? a : b)
+
NS_LOG_COMPONENT_DEFINE ("ns3::AparfWifiManager");
namespace ns3 {
@@ -37,20 +40,16 @@
struct
AparfWifiRemoteStation : public WifiRemoteStation
{
- uint32_t m_nSuccess; //!< Number of successful transmission attempts.
- uint32_t m_nFailed; //!< Number of failed transmission attempts.
- uint32_t m_pCount; //!< Number of power changes.
-
- uint32_t m_successThreshold; //!< The minimum number of successful transmissions to try a new power or rate.
- uint32_t m_failThreshold; //!< The minimum number of failed transmissions to try a new power or rate.
-
- uint32_t m_rate; //!< Current rate.
- uint32_t m_rateCrit; //!< Critical rate.
- uint8_t m_power; //!< Current power.
-
- uint32_t m_nSupported; //!< Number of supported rates by the remote station.
- bool m_initialized; //!< For initializing variables.
-
+ uint32_t m_nSuccess; //!< Number of successful transmission attempts.
+ uint32_t m_nFailed; //!< Number of failed transmission attempts.
+ uint32_t m_pCount; //!< Number of power changes.
+ uint32_t m_successThreshold; //!< The minimum number of successful transmissions to try a new power or rate.
+ uint32_t m_failThreshold; //!< The minimum number of failed transmissions to try a new power or rate.
+ uint32_t m_rate; //!< Current rate.
+ uint32_t m_rateCrit; //!< Critical rate.
+ uint8_t m_power; //!< Current power.
+ uint32_t m_nSupported; //!< Number of supported rates by the remote station.
+ bool m_initialized; //!< For initializing variables.
AparfWifiManager::State m_aparfState; //!< The estimated state of the channel.
};
@@ -119,6 +118,7 @@
{
NS_LOG_FUNCTION (this);
}
+
AparfWifiManager::~AparfWifiManager ()
{
NS_LOG_FUNCTION (this);
@@ -215,11 +215,13 @@
}
}
}
+
void
AparfWifiManager::DoReportRxOk (WifiRemoteStation *station, double rxSnr, WifiMode txMode)
{
NS_LOG_FUNCTION (this << station << rxSnr << txMode);
}
+
void
AparfWifiManager::DoReportRtsOk (WifiRemoteStation *station, double ctsSnr,
WifiMode ctsMode, double rtsSnr)
@@ -227,6 +229,7 @@
NS_LOG_FUNCTION (this << station << ctsSnr << ctsMode << rtsSnr);
NS_LOG_DEBUG ("station=" << station << " rts ok");
}
+
void
AparfWifiManager::DoReportDataOk (WifiRemoteStation *st, double ackSnr,
WifiMode ackMode, double dataSnr)
@@ -300,11 +303,13 @@
}
}
}
+
void
AparfWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
{
NS_LOG_FUNCTION (this << station);
}
+
void
AparfWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
{
@@ -319,6 +324,7 @@
CheckInit (station);
return WifiTxVector (GetSupported (station, station->m_rate), station->m_power, GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas ()), GetNumberOfTransmitAntennas (station), GetStbc (station));
}
+
WifiTxVector
AparfWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
{
@@ -336,4 +342,4 @@
return true;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/aparf-wifi-manager.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/aparf-wifi-manager.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Matias Richart <mrichart@fing.edu.uy>
*/
+
#ifndef APARF_WIFI_MANAGER_H
#define APARF_WIFI_MANAGER_H
@@ -77,8 +78,9 @@
*/
typedef void (*RateChangeTracedCallback)(const uint32_t rate, const Mac48Address remoteAddress);
+
private:
- // overriden from base class
+ //overriden from base class
virtual WifiRemoteStation * DoCreateStation (void) const;
virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
@@ -102,12 +104,12 @@
uint32_t m_succesMax1; //!< The minimum number of successful transmissions in \"High\" state to try a new power or rate.
uint32_t m_succesMax2; //!< The minimum number of successful transmissions in \"Low\" state to try a new power or rate.
- uint32_t m_failMax; //!< The minimum number of failed transmissions to try a new power or rate.
- uint32_t m_powerMax; //!< The maximum number of power changes.
- uint32_t m_powerInc; //!< Step size for increment the power.
- uint32_t m_powerDec; //!< Step size for decrement the power.
- uint32_t m_rateInc; //!< Step size for increment the rate.
- uint32_t m_rateDec; //!< Step size for decrement the rate.
+ uint32_t m_failMax; //!< The minimum number of failed transmissions to try a new power or rate.
+ uint32_t m_powerMax; //!< The maximum number of power changes.
+ uint32_t m_powerInc; //!< Step size for increment the power.
+ uint32_t m_powerDec; //!< Step size for decrement the power.
+ uint32_t m_rateInc; //!< Step size for increment the rate.
+ uint32_t m_rateDec; //!< Step size for decrement the rate.
/**
* Number of power levels.
* Differently form rate, power levels do not depend on the remote station.
@@ -126,6 +128,6 @@
};
-} // namespace ns3
+} //namespace ns3
#endif /* APARF_WIFI_MANAGER_H */
--- a/src/wifi/model/arf-wifi-manager.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/arf-wifi-manager.cc Sun Jun 21 00:23:45 2015 +0200
@@ -42,10 +42,8 @@
uint32_t m_failed;
bool m_recovery;
uint32_t m_retry;
-
uint32_t m_timerTimeout;
uint32_t m_successThreshold;
-
uint32_t m_rate;
};
@@ -75,10 +73,12 @@
{
NS_LOG_FUNCTION (this);
}
+
ArfWifiManager::~ArfWifiManager ()
{
NS_LOG_FUNCTION (this);
}
+
WifiRemoteStation *
ArfWifiManager::DoCreateStation (void) const
{
@@ -128,7 +128,7 @@
NS_ASSERT (station->m_retry >= 1);
if (station->m_retry == 1)
{
- // need recovery fallback
+ //need recovery fallback
if (station->m_rate != 0)
{
station->m_rate--;
@@ -141,7 +141,7 @@
NS_ASSERT (station->m_retry >= 1);
if (((station->m_retry - 1) % 2) == 1)
{
- // need normal fallback
+ //need normal fallback
if (station->m_rate != 0)
{
station->m_rate--;
@@ -153,18 +153,21 @@
}
}
}
+
void
ArfWifiManager::DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode)
{
NS_LOG_FUNCTION (this << station << rxSnr << txMode);
}
+
void ArfWifiManager::DoReportRtsOk (WifiRemoteStation *station,
double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
NS_LOG_FUNCTION (this << station << ctsSnr << ctsMode << rtsSnr);
NS_LOG_DEBUG ("station=" << station << " rts ok");
}
+
void ArfWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
{
@@ -187,11 +190,13 @@
station->m_recovery = true;
}
}
+
void
ArfWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
{
NS_LOG_FUNCTION (this << station);
}
+
void
ArfWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
{
@@ -203,8 +208,9 @@
{
NS_LOG_FUNCTION (this << st << size);
ArfWifiRemoteStation *station = (ArfWifiRemoteStation *) st;
- return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station));
+ return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
}
+
WifiTxVector
ArfWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
{
@@ -212,7 +218,7 @@
/// \todo we could/should implement the Arf algorithm for
/// RTS only by picking a single rate within the BasicRateSet.
ArfWifiRemoteStation *station = (ArfWifiRemoteStation *) st;
- return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station));
+ return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
}
bool
@@ -222,4 +228,4 @@
return true;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/arf-wifi-manager.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/arf-wifi-manager.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef ARF_WIFI_MANAGER_H
#define ARF_WIFI_MANAGER_H
@@ -46,8 +47,9 @@
ArfWifiManager ();
virtual ~ArfWifiManager ();
+
private:
- // overriden from base class
+ //overriden from base class
virtual WifiRemoteStation * DoCreateStation (void) const;
virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
@@ -67,6 +69,6 @@
uint32_t m_successThreshold;
};
-} // namespace ns3
+} //namespace ns3
#endif /* ARF_WIFI_MANAGER_H */
--- a/src/wifi/model/block-ack-agreement.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/block-ack-agreement.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#include "block-ack-agreement.h"
#include "ns3/log.h"
@@ -58,12 +59,14 @@
NS_ASSERT (bufferSize % 16 == 0);
m_bufferSize = bufferSize;
}
+
void
BlockAckAgreement::SetTimeout (uint16_t timeout)
{
NS_LOG_FUNCTION (this << timeout);
m_timeout = timeout;
}
+
void
BlockAckAgreement::SetStartingSequence (uint16_t seq)
{
@@ -71,18 +74,21 @@
NS_ASSERT (seq < 4096);
m_startingSeq = seq;
}
+
void
BlockAckAgreement::SetImmediateBlockAck (void)
{
NS_LOG_FUNCTION (this);
m_blockAckPolicy = 1;
}
+
void
BlockAckAgreement::SetDelayedBlockAck (void)
{
NS_LOG_FUNCTION (this);
m_blockAckPolicy = 0;
}
+
void
BlockAckAgreement::SetAmsduSupport (bool supported)
{
@@ -96,30 +102,35 @@
NS_LOG_FUNCTION (this);
return m_tid;
}
+
Mac48Address
BlockAckAgreement::GetPeer (void) const
{
NS_LOG_FUNCTION (this);
return m_peer;
}
+
uint16_t
BlockAckAgreement::GetBufferSize (void) const
{
NS_LOG_FUNCTION (this);
return m_bufferSize;
}
+
uint16_t
BlockAckAgreement::GetTimeout (void) const
{
NS_LOG_FUNCTION (this);
return m_timeout;
}
+
uint16_t
BlockAckAgreement::GetStartingSequence (void) const
{
NS_LOG_FUNCTION (this);
return m_startingSeq;
}
+
uint16_t
BlockAckAgreement::GetStartingSequenceControl (void) const
{
@@ -127,39 +138,45 @@
uint16_t seqControl = (m_startingSeq << 4) | 0xfff0;
return seqControl;
}
+
bool
BlockAckAgreement::IsImmediateBlockAck (void) const
{
NS_LOG_FUNCTION (this);
return (m_blockAckPolicy == 1);
}
+
bool
BlockAckAgreement::IsAmsduSupported (void) const
{
NS_LOG_FUNCTION (this);
return (m_amsduSupported == 1) ? true : false;
}
+
uint16_t
BlockAckAgreement::GetWinEnd (void) const
{
return m_winEnd;
}
+
void
BlockAckAgreement::SetWinEnd (uint16_t seq)
{
m_winEnd = seq;
}
+
void
BlockAckAgreement::SetHtSupported (bool htSupported)
{
NS_LOG_FUNCTION (this << htSupported);
m_htSupported = htSupported;
}
+
bool
BlockAckAgreement::IsHtSupported (void) const
{
- NS_LOG_FUNCTION (this);
- return (m_htSupported == 1) ? true : false;
+ NS_LOG_FUNCTION (this);
+ return (m_htSupported == 1) ? true : false;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/block-ack-agreement.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/block-ack-agreement.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#ifndef BLOCK_ACK_AGREEMENT_H
#define BLOCK_ACK_AGREEMENT_H
@@ -31,6 +32,8 @@
class BlockAckAgreement
{
friend class MacLow;
+
+
public:
BlockAckAgreement ();
/**
@@ -149,6 +152,7 @@
*/
bool IsHtSupported (void) const;
+
protected:
Mac48Address m_peer; //!< Peer address
uint8_t m_amsduSupported; //!< Flag whether MSDU aggregation is supported
@@ -159,9 +163,9 @@
uint16_t m_startingSeq; //!< Starting squence control
uint16_t m_winEnd; //!< Ending sequence number
uint8_t m_htSupported; //!< Flag whether HT is supported
- EventId m_inactivityEvent; //!<
+ EventId m_inactivityEvent;
};
-} // namespace ns3
+} //namespace ns3
#endif /* BLOCK_ACK_AGREEMENT_H */
--- a/src/wifi/model/block-ack-cache.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/block-ack-cache.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#include "block-ack-cache.h"
#include "ctrl-headers.h"
#include "wifi-mac-header.h"
@@ -146,4 +147,4 @@
}
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/block-ack-cache.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/block-ack-cache.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#ifndef BLOCK_ACK_CACHE_H
#define BLOCK_ACK_CACHE_H
@@ -38,15 +39,17 @@
void Init (uint16_t winStart, uint16_t winSize);
void UpdateWithMpdu (const WifiMacHeader *hdr);
- void UpdateWithBlockAckReq (uint16_t startingSeq);
- /**
- * When an A-MPDU is received, the window start may change to a new value
- * depending on the sequence number of the received MPDU (standard11n page 134).
- * This function is used to retrieve this value in order to add it to the BlockAck.
- */
+ void UpdateWithBlockAckReq (uint16_t startingSeq);
+ /**
+ * When an A-MPDU is received, the window start may change to a new value
+ * depending on the sequence number of the received MPDU (standard11n page 134).
+ * This function is used to retrieve this value in order to add it to the BlockAck.
+ */
uint16_t GetWinStart (void);
void FillBlockAckBitmap (CtrlBAckResponseHeader *blockAckHeader);
+
+
private:
void ResetPortionOfBitmap (uint16_t start, uint16_t end);
bool IsInWindow (uint16_t seq);
@@ -58,6 +61,6 @@
uint16_t m_bitmap[4096];
};
-} // namespace ns3
+} //namespace ns3
#endif /* BLOCK_ACK_CACHE_H */
--- a/src/wifi/model/block-ack-manager.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/block-ack-manager.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,11 +17,11 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#include "ns3/log.h"
#include "ns3/assert.h"
#include "ns3/simulator.h"
#include "ns3/fatal-error.h"
-
#include "block-ack-manager.h"
#include "mgt-headers.h"
#include "ctrl-headers.h"
@@ -116,10 +116,10 @@
std::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 (64);
- agreement.SetWinEnd ((agreement.GetStartingSequence()+ agreement.GetBufferSize()-1) % 4096);
+ agreement.SetWinEnd ((agreement.GetStartingSequence () + agreement.GetBufferSize () - 1) % 4096);
agreement.SetTimeout (reqHdr->GetTimeout ());
agreement.SetAmsduSupport (reqHdr->IsAmsduSupported ());
agreement.SetHtSupported (m_stationManager->HasHtSupported ());
@@ -145,7 +145,7 @@
AgreementsI it = m_agreements.find (std::make_pair (recipient, tid));
if (it != m_agreements.end ())
{
- for (std::list<PacketQueueI>::iterator i = m_retryPackets.begin (); i != m_retryPackets.end ();)
+ for (std::list<PacketQueueI>::iterator i = m_retryPackets.begin (); i != m_retryPackets.end (); )
{
if ((*i)->hdr.GetAddr1 () == recipient && (*i)->hdr.GetQosTid () == tid)
{
@@ -158,7 +158,7 @@
}
m_agreements.erase (it);
//remove scheduled bar
- for (std::list<Bar>::iterator i = m_bars.begin (); i != m_bars.end ();)
+ for (std::list<Bar>::iterator i = m_bars.begin (); i != m_bars.end (); )
{
if (i->recipient == recipient && i->tid == tid)
{
@@ -218,26 +218,26 @@
AgreementsI it = m_agreements.find (std::make_pair (recipient, tid));
NS_ASSERT (it != m_agreements.end ());
PacketQueueI queueIt = it->second.second.begin ();
- for (; queueIt != it->second.second.end ();)
- {
- if(((hdr.GetSequenceNumber () - queueIt->hdr.GetSequenceNumber () + 4096) % 4096) > 2047)
- {
+ for (; queueIt != it->second.second.end (); )
+ {
+ if (((hdr.GetSequenceNumber () - queueIt->hdr.GetSequenceNumber () + 4096) % 4096) > 2047)
+ {
queueIt = it->second.second.insert (queueIt, item);
break;
- }
+ }
else
- {
+ {
queueIt++;
- }
- }
- if(queueIt == it->second.second.end ())
- {
- it->second.second.push_back (item);
- }
+ }
+ }
+ if (queueIt == it->second.second.end ())
+ {
+ it->second.second.push_back (item);
+ }
}
void
-BlockAckManager::CompleteAmpduExchange(Mac48Address recipient, uint8_t tid)
+BlockAckManager::CompleteAmpduExchange (Mac48Address recipient, uint8_t tid)
{
AgreementsI it = m_agreements.find (std::make_pair (recipient, tid));
NS_ASSERT (it != m_agreements.end ());
@@ -247,70 +247,78 @@
Ptr<const Packet>
BlockAckManager::GetNextPacket (WifiMacHeader &hdr)
- {
- NS_LOG_FUNCTION (this << &hdr);
- Ptr<const Packet> packet = 0;
- uint8_t tid;
- Mac48Address recipient;
- CleanupBuffers ();
- if (!m_retryPackets.empty())
- {
- NS_LOG_DEBUG("Retry buffer size is " << m_retryPackets.size ());
- std::list<PacketQueueI>::iterator it = m_retryPackets.begin ();
- while (it != m_retryPackets.end ())
- {
- if ((*it)->hdr.IsQosData ())
- tid = (*it)->hdr.GetQosTid ();
- else
- NS_FATAL_ERROR("Packet in blockAck manager retry queue is not Qos Data");
- recipient = (*it)->hdr.GetAddr1 ();
- AgreementsI agreement = m_agreements.find (std::make_pair (recipient, tid));
- NS_ASSERT (agreement != m_agreements.end());
- if (QosUtilsIsOldPacket (agreement->second.first.GetStartingSequence (),(*it)->hdr.GetSequenceNumber ()))
- {
- //standard says the originator should not send a packet with seqnum < winstart
- NS_LOG_DEBUG("The Retry packet have sequence number < WinStartO --> Discard " << (*it)->hdr.GetSequenceNumber () << " " << agreement->second.first.GetStartingSequence ());
- agreement->second.second.erase ((*it));
- it = m_retryPackets.erase (it);
- continue;
- }
- else if ((*it)->hdr.GetSequenceNumber () > (agreement->second.first.GetStartingSequence ()+63) %4096)
- {
- agreement->second.first.SetStartingSequence ((*it)->hdr.GetSequenceNumber ());
- }
- packet = (*it)->packet->Copy();
- hdr = (*it)->hdr;
- hdr.SetRetry ();
- NS_LOG_INFO ("Retry packet seq = " << hdr.GetSequenceNumber ());
- if (hdr.IsQosData ())
- tid = hdr.GetQosTid ();
- else
- NS_FATAL_ERROR("Packet in blockAck manager retry queue is not Qos Data");
- recipient = hdr.GetAddr1 ();
- if (!agreement->second.first.IsHtSupported ()
- && (ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::ESTABLISHED)
+{
+ NS_LOG_FUNCTION (this << &hdr);
+ Ptr<const Packet> packet = 0;
+ uint8_t tid;
+ Mac48Address recipient;
+ CleanupBuffers ();
+ if (!m_retryPackets.empty ())
+ {
+ NS_LOG_DEBUG ("Retry buffer size is " << m_retryPackets.size ());
+ std::list<PacketQueueI>::iterator it = m_retryPackets.begin ();
+ while (it != m_retryPackets.end ())
+ {
+ if ((*it)->hdr.IsQosData ())
+ {
+ tid = (*it)->hdr.GetQosTid ();
+ }
+ else
+ {
+ NS_FATAL_ERROR ("Packet in blockAck manager retry queue is not Qos Data");
+ }
+ recipient = (*it)->hdr.GetAddr1 ();
+ AgreementsI agreement = m_agreements.find (std::make_pair (recipient, tid));
+ NS_ASSERT (agreement != m_agreements.end ());
+ if (QosUtilsIsOldPacket (agreement->second.first.GetStartingSequence (),(*it)->hdr.GetSequenceNumber ()))
+ {
+ //Standard says the originator should not send a packet with seqnum < winstart
+ NS_LOG_DEBUG ("The Retry packet have sequence number < WinStartO --> Discard " << (*it)->hdr.GetSequenceNumber () << " " << agreement->second.first.GetStartingSequence ());
+ agreement->second.second.erase ((*it));
+ it = m_retryPackets.erase (it);
+ continue;
+ }
+ else if ((*it)->hdr.GetSequenceNumber () > (agreement->second.first.GetStartingSequence () + 63) % 4096)
+ {
+ agreement->second.first.SetStartingSequence ((*it)->hdr.GetSequenceNumber ());
+ }
+ packet = (*it)->packet->Copy ();
+ hdr = (*it)->hdr;
+ hdr.SetRetry ();
+ NS_LOG_INFO ("Retry packet seq = " << hdr.GetSequenceNumber ());
+ if (hdr.IsQosData ())
+ {
+ tid = hdr.GetQosTid ();
+ }
+ else
+ {
+ NS_FATAL_ERROR ("Packet in blockAck manager retry queue is not Qos Data");
+ }
+ recipient = hdr.GetAddr1 ();
+ if (!agreement->second.first.IsHtSupported ()
+ && (ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::ESTABLISHED)
|| SwitchToBlockAckIfNeeded (recipient, tid, hdr.GetSequenceNumber ())))
- {
- hdr.SetQosAckPolicy (WifiMacHeader::BLOCK_ACK);
- }
- else
+ {
+ hdr.SetQosAckPolicy (WifiMacHeader::BLOCK_ACK);
+ }
+ else
{
- /* From section 9.10.3 in IEEE802.11e standard:
- * 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
- * the use of Block Ack.
- */
- hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
- AgreementsI i = m_agreements.find (std::make_pair (recipient, tid));
- i->second.second.erase (*it);
- }
- it = m_retryPackets.erase (it);
- NS_LOG_DEBUG("Removed one packet retry buffer size = " <<m_retryPackets.size () );
- break;
- }
- }
+ /* From section 9.10.3 in IEEE802.11e standard:
+ * 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
+ * the use of Block Ack.
+ */
+ hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
+ AgreementsI i = m_agreements.find (std::make_pair (recipient, tid));
+ i->second.second.erase (*it);
+ }
+ it = m_retryPackets.erase (it);
+ NS_LOG_DEBUG ("Removed one packet, retry buffer size = " << m_retryPackets.size () );
+ break;
+ }
+ }
return packet;
}
@@ -322,51 +330,51 @@
Ptr<const Packet> packet = 0;
CleanupBuffers ();
AgreementsI agreement = m_agreements.find (std::make_pair (recipient, tid));
- NS_ASSERT (agreement != m_agreements.end());
- std::list<PacketQueueI>::iterator it = m_retryPackets.begin ();
- for (; it != m_retryPackets.end();it++)
+ NS_ASSERT (agreement != m_agreements.end ());
+ std::list<PacketQueueI>::iterator it = m_retryPackets.begin ();
+ for (; it != m_retryPackets.end (); it++)
{
- if ((*it)->hdr.GetAddr1 () == recipient && (*it)->hdr.GetQosTid () == tid)
- {
- if (QosUtilsIsOldPacket (agreement->second.first.GetStartingSequence (),(*it)->hdr.GetSequenceNumber ()))
- {
- //standard says the originator should not send a packet with seqnum < winstart
- NS_LOG_DEBUG("The Retry packet have sequence number < WinStartO --> Discard " << (*it)->hdr.GetSequenceNumber () << " " << agreement->second.first.GetStartingSequence ());
- agreement->second.second.erase ((*it));
- it = m_retryPackets.erase (it);
- it--;
- continue;
- }
+ if ((*it)->hdr.GetAddr1 () == recipient && (*it)->hdr.GetQosTid () == tid)
+ {
+ if (QosUtilsIsOldPacket (agreement->second.first.GetStartingSequence (),(*it)->hdr.GetSequenceNumber ()))
+ {
+ //standard says the originator should not send a packet with seqnum < winstart
+ NS_LOG_DEBUG ("The Retry packet have sequence number < WinStartO --> Discard " << (*it)->hdr.GetSequenceNumber () << " " << agreement->second.first.GetStartingSequence ());
+ agreement->second.second.erase ((*it));
+ it = m_retryPackets.erase (it);
+ it--;
+ continue;
+ }
else if ((*it)->hdr.GetSequenceNumber () > (agreement->second.first.GetStartingSequence () + 63) % 4096)
{
- agreement->second.first.SetStartingSequence ((*it)->hdr.GetSequenceNumber ());
+ agreement->second.first.SetStartingSequence ((*it)->hdr.GetSequenceNumber ());
}
- packet = (*it)->packet->Copy();
- hdr = (*it)->hdr;
- hdr.SetRetry ();
- *tstamp = (*it)->timestamp;
- NS_LOG_INFO ("Retry packet seq = " << hdr.GetSequenceNumber ());
- Mac48Address recipient = hdr.GetAddr1 ();
- if (!agreement->second.first.IsHtSupported ()
- && (ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::ESTABLISHED)
+ packet = (*it)->packet->Copy ();
+ hdr = (*it)->hdr;
+ hdr.SetRetry ();
+ *tstamp = (*it)->timestamp;
+ NS_LOG_INFO ("Retry packet seq = " << hdr.GetSequenceNumber ());
+ Mac48Address recipient = hdr.GetAddr1 ();
+ if (!agreement->second.first.IsHtSupported ()
+ && (ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::ESTABLISHED)
|| SwitchToBlockAckIfNeeded (recipient, tid, hdr.GetSequenceNumber ())))
- {
- hdr.SetQosAckPolicy (WifiMacHeader::BLOCK_ACK);
- }
+ {
+ hdr.SetQosAckPolicy (WifiMacHeader::BLOCK_ACK);
+ }
else
{
- /* From section 9.10.3 in IEEE802.11e standard:
- * 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
- * the use of Block Ack.
- */
- hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
- }
- NS_LOG_DEBUG("Peeked one packet from retry buffer size = " << m_retryPackets.size () );
- return packet;
- }
+ /* From section 9.10.3 in IEEE802.11e standard:
+ * 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
+ * the use of Block Ack.
+ */
+ hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
+ }
+ NS_LOG_DEBUG ("Peeked one packet from retry buffer size = " << m_retryPackets.size () );
+ return packet;
+ }
}
return packet;
}
@@ -375,7 +383,7 @@
BlockAckManager::RemovePacket (uint8_t tid, Mac48Address recipient, uint16_t seqnumber)
{
- std::list<PacketQueueI>::iterator it = m_retryPackets.begin ();
+ std::list<PacketQueueI>::iterator it = m_retryPackets.begin ();
for (; it != m_retryPackets.end (); it++)
{
if ((*it)->hdr.GetAddr1 () == recipient && (*it)->hdr.GetQosTid () == tid && (*it)->hdr.GetSequenceNumber () == seqnumber)
@@ -386,9 +394,9 @@
AgreementsI i = m_agreements.find (std::make_pair (recipient, tid));
i->second.second.erase ((*it));
-
- m_retryPackets.erase (it);
- NS_LOG_DEBUG("Removed Packet from retry queue = " << hdr.GetSequenceNumber () << " " << (uint32_t) tid << " " << recipient << " Buffer Size = " << m_retryPackets.size ());
+
+ m_retryPackets.erase (it);
+ NS_LOG_DEBUG ("Removed Packet from retry queue = " << hdr.GetSequenceNumber () << " " << (uint32_t) tid << " " << recipient << " Buffer Size = " << m_retryPackets.size ());
return true;
}
}
@@ -477,7 +485,7 @@
NS_LOG_FUNCTION (this << static_cast<uint32_t> (nPackets));
m_blockAckThreshold = nPackets;
}
-
+
void
BlockAckManager::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> manager)
{
@@ -486,16 +494,18 @@
}
bool
-BlockAckManager::AlreadyExists(uint16_t currentSeq, Mac48Address recipient, uint8_t tid)
+BlockAckManager::AlreadyExists (uint16_t currentSeq, Mac48Address recipient, uint8_t tid)
{
std::list<PacketQueueI>::const_iterator it = m_retryPackets.begin ();
while (it != m_retryPackets.end ())
{
- NS_LOG_FUNCTION (this<<(*it)->hdr.GetType());
- if ((*it)->hdr.GetAddr1 () == recipient && (*it)->hdr.GetQosTid () == tid && currentSeq == (*it)->hdr.GetSequenceNumber ())
- return true;
- it++;
- }
+ NS_LOG_FUNCTION (this << (*it)->hdr.GetType ());
+ if ((*it)->hdr.GetAddr1 () == recipient && (*it)->hdr.GetQosTid () == tid && currentSeq == (*it)->hdr.GetSequenceNumber ())
+ {
+ return true;
+ }
+ it++;
+ }
return false;
}
@@ -527,7 +537,7 @@
}
if (blockAck->IsBasic ())
{
- for (PacketQueueI queueIt = it->second.second.begin (); queueIt != queueEnd;)
+ for (PacketQueueI queueIt = it->second.second.begin (); queueIt != queueEnd; )
{
if (blockAck->IsFragmentReceived ((*queueIt).hdr.GetSequenceNumber (),
(*queueIt).hdr.GetFragmentNumber ()))
@@ -543,8 +553,10 @@
(*it).second.first.SetStartingSequence (sequenceFirstLost);
}
- if (!AlreadyExists((*queueIt).hdr.GetSequenceNumber (),recipient,tid))
- InsertInRetryQueue(queueIt);
+ if (!AlreadyExists ((*queueIt).hdr.GetSequenceNumber (),recipient,tid))
+ {
+ InsertInRetryQueue (queueIt);
+ }
queueIt++;
}
@@ -552,7 +564,7 @@
}
else if (blockAck->IsCompressed ())
{
- for (PacketQueueI queueIt = it->second.second.begin (); queueIt != queueEnd;)
+ for (PacketQueueI queueIt = it->second.second.begin (); queueIt != queueEnd; )
{
if (blockAck->IsPacketReceived ((*queueIt).hdr.GetSequenceNumber ()))
{
@@ -583,9 +595,9 @@
{
m_txFailedCallback ((*queueIt).hdr);
}
- if (!AlreadyExists((*queueIt).hdr.GetSequenceNumber (),recipient,tid))
+ if (!AlreadyExists ((*queueIt).hdr.GetSequenceNumber (),recipient,tid))
{
- InsertInRetryQueue(queueIt);
+ InsertInRetryQueue (queueIt);
}
queueIt++;
}
@@ -595,7 +607,7 @@
if ((foundFirstLost && !SwitchToBlockAckIfNeeded (recipient, tid, sequenceFirstLost))
|| (!foundFirstLost && !SwitchToBlockAckIfNeeded (recipient, tid, newSeq)))
{
- it->second.first.CompleteExchange();
+ it->second.first.CompleteExchange ();
}
}
}
@@ -707,8 +719,8 @@
bar = ScheduleBlockAckReqIfNeeded (recipient, tid);
if (bar != 0)
{
- Bar request (bar, recipient, tid, it->second.first.IsImmediateBlockAck ());
- m_bars.push_back (request);
+ Bar request (bar, recipient, tid, it->second.first.IsImmediateBlockAck ());
+ m_bars.push_back (request);
}
}
}
@@ -776,14 +788,18 @@
bool BlockAckManager::NeedBarRetransmission (uint8_t tid, uint16_t seqNumber, Mac48Address recipient)
{
- //the standard says the BAR gets discarded when all MSDUs lifetime expires
+ //The standard says the BAR gets discarded when all MSDUs lifetime expires
AgreementsI it = m_agreements.find (std::make_pair (recipient, tid));
- NS_ASSERT (it != m_agreements.end());
- CleanupBuffers();
- if ((seqNumber+63) < it->second.first.GetStartingSequence())
- return false;
+ NS_ASSERT (it != m_agreements.end ());
+ CleanupBuffers ();
+ if ((seqNumber + 63) < it->second.first.GetStartingSequence ())
+ {
+ return false;
+ }
else
- return true;
+ {
+ return true;
+ }
}
void
@@ -808,13 +824,13 @@
else
{
/* remove retry packet iterator if it's present in retry queue */
- for (std::list<PacketQueueI>::iterator it = m_retryPackets.begin (); it != m_retryPackets.end ();)
+ for (std::list<PacketQueueI>::iterator it = m_retryPackets.begin (); it != m_retryPackets.end (); )
{
if ((*it)->hdr.GetAddr1 () == j->second.first.GetPeer ()
&& (*it)->hdr.GetQosTid () == j->second.first.GetTid ()
&& (*it)->hdr.GetSequenceNumber () == i->hdr.GetSequenceNumber ())
{
- it = m_retryPackets.erase (it);
+ it = m_retryPackets.erase (it);
}
else
{
@@ -894,28 +910,30 @@
void
BlockAckManager::InsertInRetryQueue (PacketQueueI item)
{
- NS_LOG_INFO ("Adding to retry queue " <<(*item).hdr.GetSequenceNumber ());
+ NS_LOG_INFO ("Adding to retry queue " << (*item).hdr.GetSequenceNumber ());
if (m_retryPackets.size () == 0)
{
m_retryPackets.push_back (item);
}
else
{
- for (std::list<PacketQueueI>::iterator it = m_retryPackets.begin (); it != m_retryPackets.end ();)
+ for (std::list<PacketQueueI>::iterator it = m_retryPackets.begin (); it != m_retryPackets.end (); )
{
- if(((item->hdr.GetSequenceNumber () - (*it)->hdr.GetSequenceNumber () + 4096) % 4096) > 2047)
+ if (((item->hdr.GetSequenceNumber () - (*it)->hdr.GetSequenceNumber () + 4096) % 4096) > 2047)
{
it = m_retryPackets.insert (it, item);
break;
}
- else
+ else
{
it++;
- if(it == m_retryPackets.end ())
- m_retryPackets.push_back (item);
+ if (it == m_retryPackets.end ())
+ {
+ m_retryPackets.push_back (item);
+ }
}
}
}
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/block-ack-manager.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/block-ack-manager.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,15 +17,14 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#ifndef BLOCK_ACK_MANAGER_H
#define BLOCK_ACK_MANAGER_H
#include <map>
#include <list>
#include <deque>
-
#include "ns3/packet.h"
-
#include "wifi-mac-header.h"
#include "originator-block-ack-agreement.h"
#include "ctrl-headers.h"
@@ -68,6 +67,7 @@
bool immediate;
};
+
/**
* \brief Manages all block ack agreements for an originator station.
* \ingroup wifi
@@ -78,10 +78,11 @@
BlockAckManager (const BlockAckManager&);
BlockAckManager& operator= (const BlockAckManager&);
+
public:
BlockAckManager ();
~BlockAckManager ();
-
+
/**
* Set up WifiRemoteStationManager associated with this BlockAckManager.
*
@@ -91,6 +92,7 @@
/**
* \param recipient Address of peer station involved in block ack mechanism.
* \param tid Traffic ID.
+ *
* \return true if a block ack agreement exists, false otherwise
*
* Checks if a block ack agreement exists with station addressed by
@@ -101,6 +103,7 @@
* \param recipient Address of peer station involved in block ack mechanism.
* \param tid Traffic ID.
* \param state The state for block ack agreement
+ *
* \return true if a block ack agreement exists, false otherwise
*
* Checks if a block ack agreement with a state equals to <i>state</i> exists with
@@ -142,6 +145,7 @@
void StorePacket (Ptr<const Packet> packet, const WifiMacHeader &hdr, Time tStamp);
/**
* \param hdr 802.11 header of returned packet (if exists).
+ *
* \return the packet
*
* This methods returns a packet (if exists) indicated as not received in
@@ -153,8 +157,8 @@
* Returns true if there are packets that need of retransmission or at least a
* BAR is scheduled. Returns false otherwise.
*
- * \return true if there are packets that need of retransmission or at least a
- * BAR is scheduled, false otherwise
+ * \return true if there are packets that need of retransmission or at least a BAR is scheduled,
+ * false otherwise
*/
bool HasPackets (void) const;
/**
@@ -171,6 +175,7 @@
/**
* \param recipient Address of peer station involved in block ack mechanism.
* \param tid Traffic ID.
+ *
* \return the number of packets buffered for a specified agreement
*
* Returns number of packets buffered for a specified agreement. This methods doesn't return
@@ -180,6 +185,7 @@
/**
* \param recipient Address of peer station involved in block ack mechanism.
* \param tid Traffic ID.
+ *
* \return the number of packets for a specific agreement that need retransmission
*
* Returns number of packets for a specific agreement that need retransmission.
@@ -220,8 +226,8 @@
* \param tid Traffic ID of transmitted packet.
*
* This method to set the number of packets waitin for blockAck = 0 since the receiver will send the blockAck right away
- */
- void CompleteAmpduExchange(Mac48Address recipient, uint8_t tid);
+ */
+ void CompleteAmpduExchange (Mac48Address recipient, uint8_t tid);
/**
* \param nPackets Minimum number of packets for use of block ack.
*
@@ -229,11 +235,13 @@
* and buffered packets) is greater of <i>nPackets</i>, they are transmitted using block ack mechanism.
*/
void SetBlockAckThreshold (uint8_t nPackets);
+
/**
* \param queue The WifiMacQueue object.
*/
void SetQueue (Ptr<WifiMacQueue> queue);
void SetTxMiddle (MacTxMiddle* txMiddle);
+
/**
* \param bAckType Type of block ack
*
@@ -271,15 +279,16 @@
* to ns3:WifiMacQueue delay value.
*/
void SetMaxPacketDelay (Time maxDelay);
- /**
- */
+
void SetBlockAckInactivityCallback (Callback<void, Mac48Address, uint8_t, bool> callback);
void SetBlockDestinationCallback (Callback<void, Mac48Address, uint8_t> callback);
void SetUnblockDestinationCallback (Callback<void, Mac48Address, uint8_t> callback);
+
/**
* \param recipient
* \param tid
* \param startingSeq
+ *
* \return true if there are packets in the queue that could be sent under block ACK,
* false otherwise
*
@@ -292,6 +301,7 @@
/**
* \param recipient
* \param tid
+ *
* \return the sequence number of the next retry packet for a specific agreement
*
* Returns the sequence number of the next retry packet for a specific agreement.
@@ -302,7 +312,7 @@
/**
* Checks if the packet already exists in the retransmit queue or not if it does then it doesn't add it again
*/
- bool AlreadyExists(uint16_t currentSeq, Mac48Address recipient, uint8_t tid);
+ bool AlreadyExists (uint16_t currentSeq, Mac48Address recipient, uint8_t tid);
/**
* Remove a packet after you peek in the queue and get it
*/
@@ -337,11 +347,13 @@
* packet transmission was completed unsuccessfully.
*/
void SetTxFailedCallback (TxFailed callback);
-
+
+
private:
/**
* \param recipient
* \param tid
+ *
* \return a packet
*
* Checks if all packets, for which a block ack agreement was established or refreshed,
@@ -350,6 +362,7 @@
* <i>recipient</i>,<i>tid</i>) is needed.
*/
Ptr<Packet> ScheduleBlockAckReqIfNeeded (Mac48Address recipient, uint8_t tid);
+
/**
* This method removes packets whose lifetime was exceeded.
*/
@@ -369,7 +382,6 @@
* typedef for a const iterator for PacketQueue.
*/
typedef std::list<Item>::const_iterator PacketQueueCI;
-
/**
* typedef for a map between MAC address and block ACK agreement.
*/
@@ -415,6 +427,7 @@
* erased from this data structure. Pushed back in retransmission queue otherwise.
*/
Agreements m_agreements;
+
/**
* This list contains all iterators to stored packets that need to be retransmitted.
* A packet needs retransmission if it's indicated as not correctly received in a block ack
@@ -434,9 +447,9 @@
Callback<void, Mac48Address, uint8_t> m_unblockPackets;
TxOk m_txOkCallback;
TxFailed m_txFailedCallback;
- Ptr<WifiRemoteStationManager> m_stationManager; //!<
+ Ptr<WifiRemoteStationManager> m_stationManager;
};
-} // namespace ns3
+} //namespace ns3
#endif /* BLOCK_ACK_MANAGER_H */
--- a/src/wifi/model/capability-information.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/capability-information.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#include "capability-information.h"
#include "ns3/log.h"
@@ -37,6 +38,7 @@
Set (0);
Clear (1);
}
+
void
CapabilityInformation::SetIbss (void)
{
@@ -51,6 +53,7 @@
NS_LOG_FUNCTION (this);
return Is (0);
}
+
bool
CapabilityInformation::IsIbss (void) const
{
@@ -82,13 +85,13 @@
return (m_capability & mask) == mask;
}
-
uint32_t
CapabilityInformation::GetSerializedSize (void) const
{
NS_LOG_FUNCTION (this);
return 2;
}
+
Buffer::Iterator
CapabilityInformation::Serialize (Buffer::Iterator start) const
{
@@ -96,6 +99,7 @@
start.WriteHtolsbU16 (m_capability);
return start;
}
+
Buffer::Iterator
CapabilityInformation::Deserialize (Buffer::Iterator start)
{
@@ -104,5 +108,4 @@
return start;
}
-
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/capability-information.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/capability-information.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef CAPABILITY_INFORMATION_H
#define CAPABILITY_INFORMATION_H
@@ -64,7 +65,7 @@
bool IsIbss (void) const;
/**
- * Return the serialized size of capability
+ * Return the serialized size of capability
* information.
*
* \return the serialized size
@@ -86,11 +87,14 @@
* was deserialized
*/
Buffer::Iterator Deserialize (Buffer::Iterator start);
+
+
private:
/**
* Check if bit n is set to 1.
*
* \param n the bit position
+ *
* \return true if bit n is set to 1,
* false otherwise
*/
@@ -110,6 +114,6 @@
uint16_t m_capability;
};
-} // namespace ns3
+} //namespace ns3
#endif /* CAPABILITY_INFORMATION_H */
--- a/src/wifi/model/cara-wifi-manager.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/cara-wifi-manager.cc Sun Jun 21 00:23:45 2015 +0200
@@ -83,6 +83,7 @@
{
NS_LOG_FUNCTION (this);
}
+
CaraWifiManager::~CaraWifiManager ()
{
NS_LOG_FUNCTION (this);
@@ -125,12 +126,14 @@
station->m_timer = 0;
}
}
+
void
CaraWifiManager::DoReportRxOk (WifiRemoteStation *st,
double rxSnr, WifiMode txMode)
{
NS_LOG_FUNCTION (this << st << rxSnr << txMode);
}
+
void
CaraWifiManager::DoReportRtsOk (WifiRemoteStation *st,
double ctsSnr, WifiMode ctsMode, double rtsSnr)
@@ -138,6 +141,7 @@
NS_LOG_FUNCTION (this << st << ctsSnr << ctsMode << rtsSnr);
NS_LOG_DEBUG ("self=" << st << " rts ok");
}
+
void
CaraWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
@@ -160,11 +164,13 @@
station->m_success = 0;
}
}
+
void
CaraWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *st)
{
NS_LOG_FUNCTION (this << st);
}
+
void
CaraWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
{
@@ -177,15 +183,16 @@
{
NS_LOG_FUNCTION (this << st << size);
CaraWifiRemoteStation *station = (CaraWifiRemoteStation *) st;
- return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station));
+ return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
}
+
WifiTxVector
CaraWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
{
NS_LOG_FUNCTION (this << st);
/// \todo we could/should implement the Arf algorithm for
/// RTS only by picking a single rate within the BasicRateSet.
- return WifiTxVector (GetSupported (st, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (st), GetShortGuardInterval (st), Min (GetNumberOfReceiveAntennas (st),GetNumberOfTransmitAntennas()), GetNess (st), GetStbc (st));
+ return WifiTxVector (GetSupported (st, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (st), GetShortGuardInterval (st), Min (GetNumberOfReceiveAntennas (st), GetNumberOfTransmitAntennas ()), GetNess (st), GetStbc (st));
}
bool
@@ -204,4 +211,4 @@
return true;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/cara-wifi-manager.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/cara-wifi-manager.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Federico Maguolo <maguolof@dei.unipd.it>
*/
+
#ifndef CARA_WIFI_MANAGER_H
#define CARA_WIFI_MANAGER_H
@@ -42,8 +43,9 @@
CaraWifiManager ();
virtual ~CaraWifiManager ();
+
private:
- // overriden from base class
+ //overriden from base class
virtual WifiRemoteStation * DoCreateStation (void) const;
virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
@@ -67,6 +69,6 @@
uint32_t m_probeThreshold;
};
-} // namespace ns3
+} //namespace ns3
#endif /* CARA_WIFI_MANAGER_H */
--- a/src/wifi/model/constant-rate-wifi-manager.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/constant-rate-wifi-manager.cc Sun Jun 21 00:23:45 2015 +0200
@@ -19,7 +19,6 @@
*/
#include "constant-rate-wifi-manager.h"
-
#include "ns3/string.h"
#include "ns3/assert.h"
#include "ns3/log.h"
@@ -55,12 +54,12 @@
{
NS_LOG_FUNCTION (this);
}
+
ConstantRateWifiManager::~ConstantRateWifiManager ()
{
NS_LOG_FUNCTION (this);
}
-
WifiRemoteStation *
ConstantRateWifiManager::DoCreateStation (void) const
{
@@ -69,40 +68,45 @@
return station;
}
-
void
ConstantRateWifiManager::DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode)
{
NS_LOG_FUNCTION (this << station << rxSnr << txMode);
}
+
void
ConstantRateWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
{
NS_LOG_FUNCTION (this << station);
}
+
void
ConstantRateWifiManager::DoReportDataFailed (WifiRemoteStation *station)
{
NS_LOG_FUNCTION (this << station);
}
+
void
ConstantRateWifiManager::DoReportRtsOk (WifiRemoteStation *st,
double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
NS_LOG_FUNCTION (this << st << ctsSnr << ctsMode << rtsSnr);
}
+
void
ConstantRateWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
{
NS_LOG_FUNCTION (this << st << ackSnr << ackMode << dataSnr);
}
+
void
ConstantRateWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
{
NS_LOG_FUNCTION (this << station);
}
+
void
ConstantRateWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
{
@@ -113,13 +117,14 @@
ConstantRateWifiManager::DoGetDataTxVector (WifiRemoteStation *st, uint32_t size)
{
NS_LOG_FUNCTION (this << st << size);
- return WifiTxVector (m_dataMode, GetDefaultTxPowerLevel (), GetLongRetryCount (st), GetShortGuardInterval (st), Min (GetNumberOfReceiveAntennas (st),GetNumberOfTransmitAntennas()), GetNess (st), GetStbc (st));
+ return WifiTxVector (m_dataMode, GetDefaultTxPowerLevel (), GetLongRetryCount (st), GetShortGuardInterval (st), Min (GetNumberOfReceiveAntennas (st), GetNumberOfTransmitAntennas ()), GetNess (st), GetStbc (st));
}
+
WifiTxVector
ConstantRateWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
{
NS_LOG_FUNCTION (this << st);
- return WifiTxVector (m_ctlMode, GetDefaultTxPowerLevel (), GetShortRetryCount (st), GetShortGuardInterval (st), Min (GetNumberOfReceiveAntennas (st),GetNumberOfTransmitAntennas()), GetNess (st), GetStbc (st));
+ return WifiTxVector (m_ctlMode, GetDefaultTxPowerLevel (), GetShortRetryCount (st), GetShortGuardInterval (st), Min (GetNumberOfReceiveAntennas (st), GetNumberOfTransmitAntennas ()), GetNess (st), GetStbc (st));
}
bool
@@ -129,4 +134,4 @@
return true;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/constant-rate-wifi-manager.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/constant-rate-wifi-manager.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,11 +17,11 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef CONSTANT_RATE_WIFI_MANAGER_H
#define CONSTANT_RATE_WIFI_MANAGER_H
#include <stdint.h>
-
#include "wifi-remote-station-manager.h"
namespace ns3 {
@@ -40,8 +40,9 @@
ConstantRateWifiManager ();
virtual ~ConstantRateWifiManager ();
+
private:
- // overriden from base class
+ //overriden from base class
virtual WifiRemoteStation* DoCreateStation (void) const;
virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
@@ -58,11 +59,9 @@
virtual bool IsLowLatency (void) const;
WifiMode m_dataMode; //!< Wifi mode for unicast DATA frames
- WifiMode m_ctlMode; //!< Wifi mode for RTS frames
+ WifiMode m_ctlMode; //!< Wifi mode for RTS frames
};
-} // namespace ns3
-
-
+} //namespace ns3
#endif /* CONSTANT_RATE_WIFI_MANAGER_H */
--- a/src/wifi/model/ctrl-headers.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/ctrl-headers.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,9 +17,9 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#include "ns3/fatal-error.h"
#include "ns3/log.h"
-
#include "ctrl-headers.h"
namespace ns3 {
@@ -275,6 +275,7 @@
return (m_multiTid && m_compressed) ? true : false;
}
+
/***********************************
* Block ack response
***********************************/
@@ -784,4 +785,4 @@
memset (&bitmap, 0, sizeof (bitmap));
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/ctrl-headers.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/ctrl-headers.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#ifndef CTRL_HEADERS_H
#define CTRL_HEADERS_H
@@ -77,10 +78,10 @@
*/
void SetTidInfo (uint8_t tid);
/**
- * Set the starting sequence number from the given
+ * Set the starting sequence number from the given
* raw sequence control field.
*
- * \param seq the raw sequence control
+ * \param seq the raw sequence control
*/
void SetStartingSequence (uint16_t seq);
@@ -134,6 +135,7 @@
*/
uint16_t GetStartingSequenceControl (void) const;
+
private:
/**
* Set the starting sequence control with the given
@@ -168,6 +170,7 @@
uint16_t m_startingSeq;
};
+
/**
* \ingroup wifi
* \brief Headers for Block ack response.
@@ -211,10 +214,10 @@
*/
void SetTidInfo (uint8_t tid);
/**
- * Set the starting sequence number from the given
+ * Set the starting sequence number from the given
* raw sequence control field.
*
- * \param seq the raw sequence control
+ * \param seq the raw sequence control
*/
void SetStartingSequence (uint16_t seq);
@@ -328,6 +331,7 @@
*/
void ResetBitmap (void);
+
private:
/**
* Return the block ACK control.
@@ -401,6 +405,6 @@
} bitmap;
};
-} // namespace ns3
+} //namespace ns3
#endif /* CTRL_HEADERS_H */
--- a/src/wifi/model/dca-txop.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/dca-txop.cc Sun Jun 21 00:23:45 2015 +0200
@@ -25,7 +25,6 @@
#include "ns3/node.h"
#include "ns3/uinteger.h"
#include "ns3/pointer.h"
-
#include "dca-txop.h"
#include "dcf-manager.h"
#include "mac-low.h"
@@ -49,6 +48,7 @@
: m_txop (txop)
{
}
+
private:
virtual void DoNotifyAccessGranted (void)
{
@@ -74,9 +74,11 @@
{
m_txop->NotifyWakeUp ();
}
+
DcaTxop *m_txop;
};
+
/**
* Listener for MacLow events. Forwards to DcaTxop.
*/
@@ -90,10 +92,13 @@
*/
TransmissionListener (DcaTxop * txop)
: MacLowTransmissionListener (),
- m_txop (txop) {
+ m_txop (txop)
+ {
}
- virtual ~TransmissionListener () {}
+ virtual ~TransmissionListener ()
+ {
+ }
virtual void GotCts (double snr, WifiMode txMode)
{
@@ -196,18 +201,21 @@
NS_LOG_FUNCTION (this << low);
m_low = low;
}
+
void
DcaTxop::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> remoteManager)
{
NS_LOG_FUNCTION (this << remoteManager);
m_stationManager = remoteManager;
}
+
void
DcaTxop::SetTxOkCallback (TxOk callback)
{
NS_LOG_FUNCTION (this << &callback);
m_txOkCallback = callback;
}
+
void
DcaTxop::SetTxFailedCallback (TxFailed callback)
{
@@ -228,30 +236,35 @@
NS_LOG_FUNCTION (this << minCw);
m_dcf->SetCwMin (minCw);
}
+
void
DcaTxop::SetMaxCw (uint32_t maxCw)
{
NS_LOG_FUNCTION (this << maxCw);
m_dcf->SetCwMax (maxCw);
}
+
void
DcaTxop::SetAifsn (uint32_t aifsn)
{
NS_LOG_FUNCTION (this << aifsn);
m_dcf->SetAifsn (aifsn);
}
+
uint32_t
DcaTxop::GetMinCw (void) const
{
NS_LOG_FUNCTION (this);
return m_dcf->GetCwMin ();
}
+
uint32_t
DcaTxop::GetMaxCw (void) const
{
NS_LOG_FUNCTION (this);
return m_dcf->GetCwMax ();
}
+
uint32_t
DcaTxop::GetAifsn (void) const
{
@@ -303,7 +316,6 @@
}
}
-
Ptr<MacLow>
DcaTxop::Low (void)
{
@@ -327,6 +339,7 @@
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
ns3::Dcf::DoInitialize ();
}
+
bool
DcaTxop::NeedRtsRetransmission (void)
{
@@ -342,6 +355,7 @@
return m_stationManager->NeedDataRetransmission (m_currentHdr.GetAddr1 (), &m_currentHdr,
m_currentPacket);
}
+
bool
DcaTxop::NeedFragmentation (void)
{
@@ -364,6 +378,7 @@
return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr,
m_currentPacket, m_fragmentNumber);
}
+
bool
DcaTxop::IsLastFragment (void)
{
@@ -505,6 +520,7 @@
NS_LOG_FUNCTION (this);
NotifyCollision ();
}
+
void
DcaTxop::NotifyCollision (void)
{
@@ -521,6 +537,7 @@
m_queue->Flush ();
m_currentPacket = 0;
}
+
void
DcaTxop::NotifySleep (void)
{
@@ -531,6 +548,7 @@
m_currentPacket = 0;
}
}
+
void
DcaTxop::NotifyWakeUp (void)
{
@@ -544,6 +562,7 @@
NS_LOG_FUNCTION (this << snr << txMode);
NS_LOG_DEBUG ("got cts");
}
+
void
DcaTxop::MissedCts (void)
{
@@ -557,7 +576,7 @@
{
m_txFailedCallback (m_currentHdr);
}
- // to reset the dcf.
+ //to reset the dcf.
m_currentPacket = 0;
m_dcf->ResetCw ();
}
@@ -568,6 +587,7 @@
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
RestartAccessIfNeeded ();
}
+
void
DcaTxop::GotAck (double snr, WifiMode txMode)
{
@@ -594,6 +614,7 @@
NS_LOG_DEBUG ("got ack. tx not done, size=" << m_currentPacket->GetSize ());
}
}
+
void
DcaTxop::MissedAck (void)
{
@@ -607,7 +628,7 @@
{
m_txFailedCallback (m_currentHdr);
}
- // to reset the dcf.
+ //to reset the dcf.
m_currentPacket = 0;
m_dcf->ResetCw ();
}
@@ -620,6 +641,7 @@
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
RestartAccessIfNeeded ();
}
+
void
DcaTxop::StartNext (void)
{
@@ -687,4 +709,4 @@
StartAccessIfNeeded ();
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/dca-txop.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/dca-txop.h Sun Jun 21 00:23:45 2015 +0200
@@ -125,6 +125,7 @@
* \return WifiMacQueue
*/
Ptr<WifiMacQueue > GetQueue () const;
+
virtual void SetMinCw (uint32_t minCw);
virtual void SetMaxCw (uint32_t maxCw);
virtual void SetAifsn (uint32_t aifsn);
@@ -141,16 +142,18 @@
*/
void Queue (Ptr<const Packet> packet, const WifiMacHeader &hdr);
- /**
- * Assign a fixed random variable stream number to the random variables
- * used by this model. Return the number of streams (possibly zero) that
- * have been assigned.
- *
- * \param stream first stream index to use
- * \return the number of stream indices assigned by this model
- */
+ /**
+ * Assign a fixed random variable stream number to the random variables
+ * used by this model. Return the number of streams (possibly zero) that
+ * have been assigned.
+ *
+ * \param stream first stream index to use
+ *
+ * \return the number of stream indices assigned by this model
+ */
int64_t AssignStreams (int64_t stream);
+
private:
class TransmissionListener;
class NavListener;
@@ -162,7 +165,7 @@
DcaTxop &operator = (const DcaTxop &);
DcaTxop (const DcaTxop &o);
- // Inherited from ns3::Object
+ //Inherited from ns3::Object
/**
* Return the MacLow associated with this DcaTxop.
*
@@ -178,6 +181,7 @@
* false otherwise
*/
bool NeedsAccess (void) const;
+
/**
* Notify the DCF that access has been granted.
*/
@@ -250,24 +254,29 @@
* Request access from DCF manager if needed.
*/
void StartAccessIfNeeded (void);
+
/**
* Check if the current packet should be sent with a RTS protection.
*
* \param packet
* \param header
- * \return true if RTS protection should be used, false otherwise
+ *
+ * \return true if RTS protection should be used,
+ * false otherwise
*/
bool NeedRts (Ptr<const Packet> packet, const WifiMacHeader *header);
/**
* Check if RTS should be re-transmitted if CTS was missed.
*
- * \return true if RTS should be re-transmitted, false otherwise
+ * \return true if RTS should be re-transmitted,
+ * false otherwise
*/
bool NeedRtsRetransmission (void);
/**
* Check if DATA should be re-transmitted if ACK was missed.
*
- * \return true if DATA should be re-transmitted, false otherwise
+ * \return true if DATA should be re-transmitted,
+ * false otherwise
*/
bool NeedDataRetransmission (void);
/**
@@ -313,9 +322,11 @@
* appropriate Wifi header for the fragment.
*
* \param hdr
+ *
* \return the fragment with the current fragment number
*/
Ptr<Packet> GetFragmentPacket (WifiMacHeader *hdr);
+
virtual void DoDispose (void);
Dcf *m_dcf;
@@ -335,8 +346,6 @@
uint8_t m_fragmentNumber;
};
-} // namespace ns3
-
-
+} //namespace ns3
#endif /* DCA_TXOP_H */
--- a/src/wifi/model/dcf-manager.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/dcf-manager.cc Sun Jun 21 00:23:45 2015 +0200
@@ -22,7 +22,6 @@
#include "ns3/log.h"
#include "ns3/simulator.h"
#include <cmath>
-
#include "dcf-manager.h"
#include "wifi-phy.h"
#include "wifi-mac.h"
@@ -58,28 +57,33 @@
{
m_aifsn = aifsn;
}
+
void
DcfState::SetCwMin (uint32_t minCw)
{
m_cwMin = minCw;
ResetCw ();
}
+
void
DcfState::SetCwMax (uint32_t maxCw)
{
m_cwMax = maxCw;
ResetCw ();
}
+
uint32_t
DcfState::GetAifsn (void) const
{
return m_aifsn;
}
+
uint32_t
DcfState::GetCwMin (void) const
{
return m_cwMin;
}
+
uint32_t
DcfState::GetCwMax (void) const
{
@@ -91,12 +95,14 @@
{
m_cw = m_cwMin;
}
+
void
DcfState::UpdateFailedCw (void)
{
- // see 802.11-2012, section 9.19.2.5
+ //see 802.11-2012, section 9.19.2.5
m_cw = std::min ( 2 * (m_cw + 1) - 1, m_cwMax);
}
+
void
DcfState::UpdateBackoffSlotsNow (uint32_t nSlots, Time backoffUpdateBound)
{
@@ -119,16 +125,19 @@
{
return m_cw;
}
+
uint32_t
DcfState::GetBackoffSlots (void) const
{
return m_backoffSlots;
}
+
Time
DcfState::GetBackoffStart (void) const
{
return m_backoffStart;
}
+
bool
DcfState::IsAccessRequested (void) const
{
@@ -139,6 +148,7 @@
{
m_accessRequested = true;
}
+
void
DcfState::NotifyAccessGranted (void)
{
@@ -146,26 +156,31 @@
m_accessRequested = false;
DoNotifyAccessGranted ();
}
+
void
DcfState::NotifyCollision (void)
{
DoNotifyCollision ();
}
+
void
DcfState::NotifyInternalCollision (void)
{
DoNotifyInternalCollision ();
}
+
void
DcfState::NotifyChannelSwitching (void)
{
DoNotifyChannelSwitching ();
}
+
void
DcfState::NotifySleep (void)
{
DoNotifySleep ();
}
+
void
DcfState::NotifyWakeUp (void)
{
@@ -215,10 +230,12 @@
{
m_dcf->NotifyCtsTimeoutResetNow ();
}
+
private:
ns3::DcfManager *m_dcf; //!< DcfManager to forward events to
};
+
/**
* Listener for PHY events. Forwards to DcfManager
*/
@@ -269,10 +286,12 @@
{
m_dcf->NotifyWakeupNow ();
}
+
private:
ns3::DcfManager *m_dcf; //!< DcfManager to forward events to
};
+
/****************************************************************
* Implement the DCF manager of all DCF state holders
****************************************************************/
@@ -352,18 +371,21 @@
NS_LOG_FUNCTION (this << slotTime);
m_slotTimeUs = slotTime.GetMicroSeconds ();
}
+
void
DcfManager::SetSifs (Time sifs)
{
NS_LOG_FUNCTION (this << sifs);
m_sifs = sifs;
}
+
void
DcfManager::SetEifsNoDifs (Time eifsNoDifs)
{
NS_LOG_FUNCTION (this << eifsNoDifs);
m_eifsNoDifs = eifsNoDifs;
}
+
Time
DcfManager::GetEifsNoDifs () const
{
@@ -384,6 +406,7 @@
NS_LOG_FUNCTION (this << a << b);
return Max (a, b);
}
+
Time
DcfManager::MostRecent (Time a, Time b, Time c) const
{
@@ -393,6 +416,7 @@
retval = Max (retval, c);
return retval;
}
+
Time
DcfManager::MostRecent (Time a, Time b, Time c, Time d) const
{
@@ -402,6 +426,7 @@
Time retval = Max (e, f);
return retval;
}
+
Time
DcfManager::MostRecent (Time a, Time b, Time c, Time d, Time e, Time f) const
{
@@ -450,14 +475,15 @@
return false;
}
-
void
DcfManager::RequestAccess (DcfState *state)
{
NS_LOG_FUNCTION (this << state);
- // Deny access if in sleep mode
+ //Deny access if in sleep mode
if (m_sleeping)
- return;
+ {
+ return;
+ }
UpdateBackoff ();
NS_ASSERT (!state->IsAccessRequested ());
state->NotifyAccessRequested ();
@@ -494,7 +520,7 @@
* 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 ());
- i++; // go to the next item in the list.
+ 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++)
@@ -669,6 +695,7 @@
m_lastRxDuration = duration;
m_rxing = true;
}
+
void
DcfManager::NotifyRxEndOkNow (void)
{
@@ -678,6 +705,7 @@
m_lastRxReceivedOk = true;
m_rxing = false;
}
+
void
DcfManager::NotifyRxEndErrorNow (void)
{
@@ -687,6 +715,7 @@
m_lastRxReceivedOk = false;
m_rxing = false;
}
+
void
DcfManager::NotifyTxStartNow (Time duration)
{
@@ -694,8 +723,7 @@
if (m_rxing)
{
//this may be caused only if PHY has started to receive a packet
- //inside SIFS, so, we check that lastRxStart was maximum a SIFS
- //ago
+ //inside SIFS, so, we check that lastRxStart was maximum a SIFS ago
NS_ASSERT (Simulator::Now () - m_lastRxStart <= m_sifs);
m_lastRxEnd = Simulator::Now ();
m_lastRxDuration = m_lastRxEnd - m_lastRxStart;
@@ -707,6 +735,7 @@
m_lastTxStart = Simulator::Now ();
m_lastTxDuration = duration;
}
+
void
DcfManager::NotifyMaybeCcaBusyStartNow (Time duration)
{
@@ -717,7 +746,6 @@
m_lastBusyDuration = duration;
}
-
void
DcfManager::NotifySwitchingStartNow (Time duration)
{
@@ -728,7 +756,7 @@
if (m_rxing)
{
- // channel switching during packet reception
+ //channel switching during packet reception
m_lastRxEnd = Simulator::Now ();
m_lastRxDuration = m_lastRxEnd - m_lastRxStart;
m_lastRxReceivedOk = true;
@@ -751,13 +779,13 @@
m_lastCtsTimeoutEnd = now;
}
- // Cancel timeout
+ //Cancel timeout
if (m_accessTimeout.IsRunning ())
{
m_accessTimeout.Cancel ();
}
- // Reset backoffs
+ //Reset backoffs
for (States::iterator i = m_states.begin (); i != m_states.end (); i++)
{
DcfState *state = *i;
@@ -783,13 +811,13 @@
{
NS_LOG_FUNCTION (this);
m_sleeping = true;
- // Cancel timeout
+ //Cancel timeout
if (m_accessTimeout.IsRunning ())
{
m_accessTimeout.Cancel ();
}
- // Reset backoffs
+ //Reset backoffs
for (States::iterator i = m_states.begin (); i != m_states.end (); i++)
{
DcfState *state = *i;
@@ -834,6 +862,7 @@
*/
DoRestartAccessTimeoutIfNeeded ();
}
+
void
DcfManager::NotifyNavStartNow (Time duration)
{
@@ -849,6 +878,7 @@
m_lastNavDuration = duration;
}
}
+
void
DcfManager::NotifyAckTimeoutStartNow (Time duration)
{
@@ -856,6 +886,7 @@
NS_ASSERT (m_lastAckTimeoutEnd < Simulator::Now ());
m_lastAckTimeoutEnd = Simulator::Now () + duration;
}
+
void
DcfManager::NotifyAckTimeoutResetNow ()
{
@@ -863,12 +894,14 @@
m_lastAckTimeoutEnd = Simulator::Now ();
DoRestartAccessTimeoutIfNeeded ();
}
+
void
DcfManager::NotifyCtsTimeoutStartNow (Time duration)
{
NS_LOG_FUNCTION (this << duration);
m_lastCtsTimeoutEnd = Simulator::Now () + duration;
}
+
void
DcfManager::NotifyCtsTimeoutResetNow ()
{
@@ -876,4 +909,4 @@
m_lastCtsTimeoutEnd = Simulator::Now ();
DoRestartAccessTimeoutIfNeeded ();
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/dcf-manager.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/dcf-manager.h Sun Jun 21 00:23:45 2015 +0200
@@ -47,7 +47,6 @@
{
public:
DcfState ();
-
virtual ~DcfState ();
/**
@@ -118,6 +117,7 @@
*/
bool IsAccessRequested (void) const;
+
private:
friend class DcfManager;
@@ -169,7 +169,6 @@
*/
void NotifyWakeUp (void);
-
/**
* Called by DcfManager to notify a DcfState subclass
* that access to the medium is granted and can
@@ -213,7 +212,7 @@
*/
virtual void DoNotifySleep (void) = 0;
/**
- * Called by DcfManager to notify a DcfState subclass that the device
+ * Called by DcfManager to notify a DcfState subclass that the device
* has begun to wake up.
*
* The subclass is expected to restart a new backoff by
@@ -224,9 +223,9 @@
uint32_t m_aifsn;
uint32_t m_backoffSlots;
- // the backoffStart variable is used to keep track of the
- // time at which a backoff was started or the time at which
- // the backoff counter was last updated.
+ //the backoffStart variable is used to keep track of the
+ //time at which a backoff was started or the time at which
+ //the backoff counter was last updated.
Time m_backoffStart;
uint32_t m_cwMin;
uint32_t m_cwMax;
@@ -234,6 +233,7 @@
bool m_accessRequested;
};
+
/**
* \brief Manage a set of ns3::DcfState
* \ingroup wifi
@@ -288,7 +288,6 @@
* one of the Notify methods has been invoked.
*/
void SetSifs (Time sifs);
-
/**
* \param eifsNoDifs the duration of a EIFS minus the duration of DIFS.
*
@@ -403,6 +402,8 @@
* Notify that CTS timer has resetted.
*/
void NotifyCtsTimeoutResetNow ();
+
+
private:
/**
* Update backoff slots for all DcfStates.
@@ -413,6 +414,7 @@
*
* \param a
* \param b
+ *
* \return the most recent time
*/
Time MostRecent (Time a, Time b) const;
@@ -422,6 +424,7 @@
* \param a
* \param b
* \param c
+ *
* \return the most recent time
*/
Time MostRecent (Time a, Time b, Time c) const;
@@ -432,6 +435,7 @@
* \param b
* \param c
* \param d
+ *
* \return the most recent time
*/
Time MostRecent (Time a, Time b, Time c, Time d) const;
@@ -444,6 +448,7 @@
* \param d
* \param e
* \param f
+ *
* \return the most recent time
*/
Time MostRecent (Time a, Time b, Time c, Time d, Time e, Time f) const;
@@ -457,6 +462,7 @@
* \param e
* \param f
* \param g
+ *
* \return the most recent time
*/
Time MostRecent (Time a, Time b, Time c, Time d, Time e, Time f, Time g) const;
@@ -464,8 +470,7 @@
* 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
- * be granted
+ * \returns the absolute time at which access could start to be granted
*/
Time GetAccessGrantStart (void) const;
/**
@@ -473,6 +478,7 @@
* started for the given DcfState.
*
* \param state
+ *
* \return the time when the backoff procedure started
*/
Time GetBackoffStartFor (DcfState *state);
@@ -481,10 +487,13 @@
* ended (or will ended) for the given DcfState.
*
* \param state
+ *
* \return the time when the backoff procedure ended (or will ended)
*/
Time GetBackoffEndFor (DcfState *state);
+
void DoRestartAccessTimeoutIfNeeded (void);
+
/**
* Called when access timeout should occur
* (e.g. backoff procedure expired).
@@ -533,6 +542,6 @@
LowDcfListener* m_lowListener;
};
-} // namespace ns3
+} //namespace ns3
#endif /* DCF_MANAGER_H */
--- a/src/wifi/model/dcf.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/dcf.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#include "dcf.h"
#include "ns3/uinteger.h"
#include "ns3/log.h"
@@ -51,4 +52,4 @@
return tid;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/dcf.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/dcf.h Sun Jun 21 00:23:45 2015 +0200
@@ -73,6 +73,6 @@
virtual uint32_t GetAifsn (void) const = 0;
};
-} // namespace ns3
+} //namespace ns3
#endif /* DCF_H */
--- a/src/wifi/model/dsss-error-rate-model.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/dsss-error-rate-model.cc Sun Jun 21 00:23:45 2015 +0200
@@ -36,14 +36,14 @@
{
NS_LOG_FUNCTION_NOARGS ();
return ((std::sqrt (2.0) + 1.0) / std::sqrt (8.0 * M_PI * std::sqrt (2.0)))
- * (1.0 / std::sqrt (x)) * std::exp ( -(2.0 - std::sqrt (2.0)) * x);
+ * (1.0 / std::sqrt (x)) * std::exp ( -(2.0 - std::sqrt (2.0)) * x);
}
double
DsssErrorRateModel::GetDsssDbpskSuccessRate (double sinr, uint32_t nbits)
{
NS_LOG_FUNCTION_NOARGS ();
- double EbN0 = sinr * 22000000.0 / 1000000.0; // 1 bit per symbol with 1 MSPS
+ double EbN0 = sinr * 22000000.0 / 1000000.0; //1 bit per symbol with 1 MSPS
double ber = 0.5 * std::exp (-EbN0);
return std::pow ((1.0 - ber), static_cast<double> (nbits));
}
@@ -52,7 +52,7 @@
DsssErrorRateModel::GetDsssDqpskSuccessRate (double sinr,uint32_t nbits)
{
NS_LOG_FUNCTION_NOARGS ();
- double EbN0 = sinr * 22000000.0 / 1000000.0 / 2.0; // 2 bits per symbol, 1 MSPS
+ double EbN0 = sinr * 22000000.0 / 1000000.0 / 2.0; //2 bits per symbol, 1 MSPS
double ber = DqpskFunction (EbN0);
return std::pow ((1.0 - ber), static_cast<double> (nbits));
}
@@ -62,13 +62,13 @@
{
NS_LOG_FUNCTION_NOARGS ();
#ifdef ENABLE_GSL
- // symbol error probability
+ //symbol error probability
double EbN0 = sinr * 22000000.0 / 1375000.0 / 4.0;
double sep = SymbolErrorProb16Cck (4.0 * EbN0 / 2.0);
- return std::pow (1.0 - sep,nbits / 4.0);
+ return std::pow (1.0 - sep, nbits / 4.0);
#else
NS_LOG_WARN ("Running a 802.11b CCK Matlab model less accurate than GSL model");
- // The matlab model
+ //The matlab model
double ber;
if (sinr > WLAN_SIR_PERFECT)
{
@@ -80,11 +80,11 @@
}
else
{
- // 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;
+ //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 * std::exp (-std::pow ((sinr - a2) / a3, a4));
}
return std::pow ((1.0 - ber), static_cast<double> (nbits));
@@ -96,13 +96,13 @@
{
NS_LOG_FUNCTION_NOARGS ();
#ifdef ENABLE_GSL
- // symbol error probability
+ //symbol error probability
double EbN0 = sinr * 22000000.0 / 1375000.0 / 8.0;
double sep = SymbolErrorProb256Cck (8.0 * EbN0 / 2.0);
return std::pow (1.0 - sep, nbits / 8.0);
#else
NS_LOG_WARN ("Running a 802.11b CCK Matlab model less accurate than GSL model");
- // The matlab model
+ //The matlab model
double ber;
if (sinr > WLAN_SIR_PERFECT)
{
@@ -114,13 +114,13 @@
}
else
{
- // fitprops.coeff from matlab berfit
- double a1 = 7.9056742265333456e-003;
+ //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;
+ 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);
}
return std::pow ((1.0 - ber), static_cast<double> (nbits));
@@ -171,4 +171,4 @@
#endif
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/dsss-error-rate-model.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/dsss-error-rate-model.h Sun Jun 21 00:23:45 2015 +0200
@@ -20,8 +20,8 @@
#ifndef DSS_ERROR_RATE_MODEL_H
#define DSS_ERROR_RATE_MODEL_H
+
#include <stdint.h>
-
#ifdef ENABLE_GSL
#include <gsl/gsl_math.h>
#include <gsl/gsl_integration.h>
@@ -71,7 +71,8 @@
* A function DQPSK
*
* \param x x
- * \return DQPSK(x)
+ *
+ * \return DQPSK (x)
*/
static double DqpskFunction (double x);
/**
@@ -79,6 +80,7 @@
*
* \param sinr the SINR of the chunk
* \param nbits the size of the chunk
+ *
* \return the chunk success rate of the differential BPSK
*/
static double GetDsssDbpskSuccessRate (double sinr, uint32_t nbits);
@@ -87,6 +89,7 @@
*
* \param sinr the SINR of the chunk
* \param nbits the size of the chunk
+ *
* \return the chunk success rate of the differential encoded QPSK.
*/
static double GetDsssDqpskSuccessRate (double sinr,uint32_t nbits);
@@ -96,6 +99,7 @@
*
* \param sinr the SINR of the chunk
* \param nbits the size of the chunk
+ *
* \return the chunk success rate of the differential encoded QPSK for
*/
static double GetDsssDqpskCck5_5SuccessRate (double sinr,uint32_t nbits);
@@ -105,19 +109,23 @@
*
* \param sinr the SINR of the chunk
* \param nbits the size of the chunk
+ *
* \return the chunk success rate of the differential encoded QPSK for
*/
static double GetDsssDqpskCck11SuccessRate (double sinr,uint32_t nbits);
#ifdef ENABLE_GSL
- static double SymbolErrorProb16Cck (double e2); /// equation (18) in Pursley's paper
- static double SymbolErrorProb256Cck (double e1); /// equation (17) in Pursley's paper
+ static double SymbolErrorProb16Cck (double e2); /// equation (18) in Pursley's paper
+ static double SymbolErrorProb256Cck (double e1); /// equation (17) in Pursley's paper
#else
+
+
protected:
static const double WLAN_SIR_PERFECT;
static const double WLAN_SIR_IMPOSSIBLE;
#endif
};
-} // namespace ns3
+} //namespace ns3
#endif /* DSSS_ERROR_RATE_MODEL_H */
+
--- a/src/wifi/model/edca-txop-n.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/edca-txop-n.cc Sun Jun 21 00:23:45 2015 +0200
@@ -16,13 +16,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
+ * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Mirko Banchi <mk.banchi@gmail.com>
*/
+
#include "ns3/log.h"
#include "ns3/assert.h"
#include "ns3/pointer.h"
-
#include "edca-txop-n.h"
#include "mac-low.h"
#include "dcf-manager.h"
@@ -49,6 +49,7 @@
: m_txop (txop)
{
}
+
private:
virtual void DoNotifyAccessGranted (void)
{
@@ -74,18 +75,23 @@
{
m_txop->NotifyWakeUp ();
}
+
EdcaTxopN *m_txop;
};
+
class EdcaTxopN::TransmissionListener : public MacLowTransmissionListener
{
public:
TransmissionListener (EdcaTxopN * txop)
: MacLowTransmissionListener (),
- m_txop (txop) {
+ m_txop (txop)
+ {
}
- virtual ~TransmissionListener () {}
+ virtual ~TransmissionListener ()
+ {
+ }
virtual void GotCts (double snr, WifiMode txMode)
{
@@ -124,7 +130,7 @@
m_txop->EndTxNoAck ();
}
virtual Ptr<WifiMacQueue> GetQueue (void)
- {
+ {
return m_txop->GetEdcaQueue ();
}
@@ -132,32 +138,36 @@
EdcaTxopN *m_txop;
};
+
class EdcaTxopN::AggregationCapableTransmissionListener : public MacLowAggregationCapableTransmissionListener
{
public:
AggregationCapableTransmissionListener (EdcaTxopN * txop)
: MacLowAggregationCapableTransmissionListener (),
- m_txop (txop) {
+ m_txop (txop)
+ {
}
- virtual ~AggregationCapableTransmissionListener () {}
+ virtual ~AggregationCapableTransmissionListener ()
+ {
+ }
virtual void BlockAckInactivityTimeout (Mac48Address address, uint8_t tid)
{
m_txop->SendDelbaFrame (address, tid, false);
}
virtual Ptr<WifiMacQueue> GetQueue (void)
- {
+ {
return m_txop->GetEdcaQueue ();
}
virtual void CompleteTransfer (Mac48Address recipient, uint8_t tid)
{
m_txop->CompleteAmpduTransfer (recipient, tid);
}
- virtual void SetAmpdu(bool ampdu)
+ virtual void SetAmpdu (bool ampdu)
{
return m_txop->SetAmpduExist (ampdu);
}
- virtual void CompleteMpduTx(Ptr<const Packet> packet, WifiMacHeader hdr, Time tstamp)
+ virtual void CompleteMpduTx (Ptr<const Packet> packet, WifiMacHeader hdr, Time tstamp)
{
m_txop->CompleteMpduTx (packet, hdr, tstamp);
}
@@ -175,7 +185,7 @@
}
virtual void RemoveFromBaQueue (uint8_t tid, Mac48Address recipient, uint16_t seqnumber)
{
- m_txop->RemoveRetransmitPacket(tid, recipient, seqnumber);
+ m_txop->RemoveRetransmitPacket (tid, recipient, seqnumber);
}
virtual bool GetBlockAckAgreementExists (Mac48Address address, uint8_t tid)
{
@@ -190,7 +200,7 @@
return m_txop->GetNRetryNeededPackets (recipient, tid);
}
virtual Ptr<MsduAggregator> GetMsduAggregator (void) const
- {
+ {
return m_txop->GetMsduAggregator ();
}
virtual Mac48Address GetSrcAddressForAggregation (const WifiMacHeader &hdr)
@@ -215,20 +225,23 @@
.SetParent<ns3::Dcf> ()
.SetGroupName ("Wifi")
.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.",
+ .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),
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.",
+ .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),
MakeUintegerAccessor (&EdcaTxopN::SetBlockAckInactivityTimeout),
MakeUintegerChecker<uint16_t> ())
- .AddAttribute ("Queue", "The WifiMacQueue object",
+ .AddAttribute ("Queue",
+ "The WifiMacQueue object",
PointerValue (),
MakePointerAccessor (&EdcaTxopN::GetEdcaQueue),
MakePointerChecker<WifiMacQueue> ())
@@ -292,19 +305,19 @@
bool
EdcaTxopN::GetBaAgreementExists (Mac48Address address, uint8_t tid)
{
- return m_baManager->ExistsAgreement (address, tid);
+ return m_baManager->ExistsAgreement (address, tid);
}
uint32_t
EdcaTxopN::GetNOutstandingPacketsInBa (Mac48Address address, uint8_t tid)
{
- return m_baManager->GetNBufferedPackets (address, tid);
+ return m_baManager->GetNBufferedPackets (address, tid);
}
uint32_t
EdcaTxopN::GetNRetryNeededPackets (Mac48Address recipient, uint8_t tid) const
{
- return m_baManager->GetNRetryNeededPackets (recipient, tid);
+ return m_baManager->GetNRetryNeededPackets (recipient, tid);
}
void
@@ -340,8 +353,9 @@
{
NS_LOG_FUNCTION (this << remoteManager);
m_stationManager = remoteManager;
- m_baManager->SetWifiRemoteStationManager(m_stationManager);
+ m_baManager->SetWifiRemoteStationManager (m_stationManager);
}
+
void
EdcaTxopN::SetTypeOfStation (enum TypeOfStation type)
{
@@ -452,7 +466,7 @@
void
EdcaTxopN::RemoveRetransmitPacket (uint8_t tid, Mac48Address recipient, uint16_t seqnumber)
{
- m_baManager->RemovePacket (tid, recipient, seqnumber);
+ m_baManager->RemovePacket (tid, recipient, seqnumber);
}
void
@@ -525,7 +539,7 @@
}
else
{
- if (m_currentHdr.IsQosData () && m_currentHdr.IsQosBlockAck ())
+ if (m_currentHdr.IsQosData () && m_currentHdr.IsQosBlockAck ())
{
params.DisableAck ();
}
@@ -535,7 +549,7 @@
}
if (NeedFragmentation () && ((m_currentHdr.IsQosData ()
&& !m_currentHdr.IsQosAmsdu ())
- ||
+ ||
(m_currentHdr.IsData ()
&& !m_currentHdr.IsQosData () && m_currentHdr.IsQosAmsdu ()))
&& (m_blockAckThreshold == 0
@@ -617,8 +631,10 @@
params.DisableNextData ();
m_low->StartTransmission (m_currentPacket, &m_currentHdr,
params, m_transmissionListener);
- if(!GetAmpduExist())
- CompleteTx ();
+ if (!GetAmpduExist ())
+ {
+ CompleteTx ();
+ }
}
}
}
@@ -657,20 +673,20 @@
{
m_txFailedCallback (m_currentHdr);
}
- if (GetAmpduExist())
+ if (GetAmpduExist ())
{
m_low->FlushAggregateQueue ();
-
+
NS_LOG_DEBUG ("Transmit Block Ack Request");
CtrlBAckRequestHeader reqHdr;
reqHdr.SetType (COMPRESSED_BLOCK_ACK);
uint8_t tid = m_currentHdr.GetQosTid ();
reqHdr.SetStartingSequence (m_txMiddle->PeekNextSequenceNumberfor (&m_currentHdr));
reqHdr.SetTidInfo (tid);
- reqHdr.SetHtImmediateAck(true);
+ reqHdr.SetHtImmediateAck (true);
Ptr<Packet> bar = Create<Packet> ();
bar->AddHeader (reqHdr);
- Bar request (bar, m_currentHdr.GetAddr1 (), tid, reqHdr.MustSendHtImmediateAck());
+ Bar request (bar, m_currentHdr.GetAddr1 (), tid, reqHdr.MustSendHtImmediateAck ());
m_currentBar = request;
WifiMacHeader hdr;
hdr.SetType (WIFI_MAC_CTL_BACKREQ);
@@ -688,7 +704,7 @@
{
m_currentPacket = 0;
}
- // to reset the dcf.
+ //to reset the dcf.
m_dcf->ResetCw ();
}
else
@@ -706,6 +722,7 @@
m_queue->Flush ();
m_currentPacket = 0;
}
+
void
EdcaTxopN::NotifySleep (void)
{
@@ -716,6 +733,7 @@
m_currentPacket = 0;
}
}
+
void
EdcaTxopN::NotifyWakeUp (void)
{
@@ -794,10 +812,10 @@
{
m_txFailedCallback (m_currentHdr);
}
- if (!GetAmpduExist())
+ if (!GetAmpduExist ())
{
- // to reset the dcf.
- m_currentPacket = 0;
+ //to reset the dcf.
+ m_currentPacket = 0;
}
else
{
@@ -807,10 +825,10 @@
uint8_t tid = m_currentHdr.GetQosTid ();
reqHdr.SetStartingSequence (m_txMiddle->PeekNextSequenceNumberfor (&m_currentHdr));
reqHdr.SetTidInfo (tid);
- reqHdr.SetHtImmediateAck(true);
+ reqHdr.SetHtImmediateAck (true);
Ptr<Packet> bar = Create<Packet> ();
bar->AddHeader (reqHdr);
- Bar request (bar, m_currentHdr.GetAddr1 (), tid, reqHdr.MustSendHtImmediateAck());
+ Bar request (bar, m_currentHdr.GetAddr1 (), tid, reqHdr.MustSendHtImmediateAck ());
m_currentBar = request;
WifiMacHeader hdr;
hdr.SetType (WIFI_MAC_CTL_BACKREQ);
@@ -841,68 +859,68 @@
{
NS_LOG_FUNCTION (this);
NS_LOG_DEBUG ("missed block ack");
- if (NeedBarRetransmission())
- {
- if (!GetAmpduExist())
+ if (NeedBarRetransmission ())
{
- //should i report this to station addressed by ADDR1?
- NS_LOG_DEBUG ("Retransmit block ack request");
- m_currentHdr.SetRetry ();
- }
- else
- {
+ if (!GetAmpduExist ())
+ {
+ //should i report this to station addressed by ADDR1?
+ NS_LOG_DEBUG ("Retransmit block ack request");
+ m_currentHdr.SetRetry ();
+ }
+ else
+ {
//standard says when loosing a BlockAck originator may send a BAR page 139
- NS_LOG_DEBUG ("Transmit Block Ack Request");
+ NS_LOG_DEBUG ("Transmit Block Ack Request");
CtrlBAckRequestHeader reqHdr;
reqHdr.SetType (COMPRESSED_BLOCK_ACK);
uint8_t tid = 0;
- if (m_currentHdr.IsQosData())
+ if (m_currentHdr.IsQosData ())
{
- tid = m_currentHdr.GetQosTid ();
- reqHdr.SetStartingSequence (m_currentHdr.GetSequenceNumber ());
+ tid = m_currentHdr.GetQosTid ();
+ reqHdr.SetStartingSequence (m_currentHdr.GetSequenceNumber ());
}
- else if (m_currentHdr.IsBlockAckReq())
+ else if (m_currentHdr.IsBlockAckReq ())
{
CtrlBAckRequestHeader baReqHdr;
m_currentPacket->PeekHeader (baReqHdr);
tid = baReqHdr.GetTidInfo ();
reqHdr.SetStartingSequence (baReqHdr.GetStartingSequence ());
}
- else if (m_currentHdr.IsBlockAck())
- {
- CtrlBAckResponseHeader baRespHdr;
- m_currentPacket->PeekHeader (baRespHdr);
- tid = baRespHdr.GetTidInfo();
- reqHdr.SetStartingSequence (m_currentHdr.GetSequenceNumber ());
- }
- reqHdr.SetTidInfo (tid);
- reqHdr.SetHtImmediateAck (true);
- Ptr<Packet> bar = Create<Packet> ();
- bar->AddHeader (reqHdr);
- Bar request (bar, m_currentHdr.GetAddr1 (), tid, reqHdr.MustSendHtImmediateAck ());
- m_currentBar = request;
- WifiMacHeader hdr;
- hdr.SetType (WIFI_MAC_CTL_BACKREQ);
- hdr.SetAddr1 (request.recipient);
- hdr.SetAddr2 (m_low->GetAddress ());
- hdr.SetAddr3 (m_low->GetBssid ());
- hdr.SetDsNotTo ();
- hdr.SetDsNotFrom ();
- hdr.SetNoRetry ();
- hdr.SetNoMoreFragments ();
+ else if (m_currentHdr.IsBlockAck ())
+ {
+ CtrlBAckResponseHeader baRespHdr;
+ m_currentPacket->PeekHeader (baRespHdr);
+ tid = baRespHdr.GetTidInfo ();
+ reqHdr.SetStartingSequence (m_currentHdr.GetSequenceNumber ());
+ }
+ reqHdr.SetTidInfo (tid);
+ reqHdr.SetHtImmediateAck (true);
+ Ptr<Packet> bar = Create<Packet> ();
+ bar->AddHeader (reqHdr);
+ Bar request (bar, m_currentHdr.GetAddr1 (), tid, reqHdr.MustSendHtImmediateAck ());
+ m_currentBar = request;
+ WifiMacHeader hdr;
+ hdr.SetType (WIFI_MAC_CTL_BACKREQ);
+ hdr.SetAddr1 (request.recipient);
+ hdr.SetAddr2 (m_low->GetAddress ());
+ hdr.SetAddr3 (m_low->GetBssid ());
+ hdr.SetDsNotTo ();
+ hdr.SetDsNotFrom ();
+ hdr.SetNoRetry ();
+ hdr.SetNoMoreFragments ();
- m_currentPacket = request.bar;
- m_currentHdr = hdr;
- }
- m_dcf->UpdateFailedCw ();
- }
+ m_currentPacket = request.bar;
+ m_currentHdr = hdr;
+ }
+ m_dcf->UpdateFailedCw ();
+ }
else
- {
+ {
NS_LOG_DEBUG ("Block Ack Request Fail");
- // to reset the dcf.
+ //to reset the dcf.
m_currentPacket = 0;
m_dcf->ResetCw ();
- }
+ }
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
RestartAccessIfNeeded ();
}
@@ -964,27 +982,27 @@
bool
EdcaTxopN::NeedBarRetransmission (void)
{
- uint8_t tid = 0;
- uint16_t seqNumber = 0;
- if (m_currentHdr.IsQosData ())
- {
- tid = m_currentHdr.GetQosTid ();
- seqNumber = m_currentHdr.GetSequenceNumber ();
- }
+ uint8_t tid = 0;
+ uint16_t seqNumber = 0;
+ if (m_currentHdr.IsQosData ())
+ {
+ tid = m_currentHdr.GetQosTid ();
+ seqNumber = m_currentHdr.GetSequenceNumber ();
+ }
else if (m_currentHdr.IsBlockAckReq ())
{
CtrlBAckRequestHeader baReqHdr;
m_currentPacket->PeekHeader (baReqHdr);
tid = baReqHdr.GetTidInfo ();
seqNumber = baReqHdr.GetStartingSequence ();
- }
+ }
else if (m_currentHdr.IsBlockAck ())
- {
- CtrlBAckResponseHeader baRespHdr;
- m_currentPacket->PeekHeader (baRespHdr);
- tid = baRespHdr.GetTidInfo ();
- seqNumber = m_currentHdr.GetSequenceNumber ();
- }
+ {
+ CtrlBAckResponseHeader baRespHdr;
+ m_currentPacket->PeekHeader (baRespHdr);
+ tid = baRespHdr.GetTidInfo ();
+ seqNumber = m_currentHdr.GetSequenceNumber ();
+ }
return m_baManager->NeedBarRetransmission (tid, seqNumber, m_currentHdr.GetAddr1 ());
}
@@ -1216,16 +1234,16 @@
}
if (m_baManager->ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::ESTABLISHED))
{
- m_currentHdr.SetQosAckPolicy (WifiMacHeader::BLOCK_ACK);
+ m_currentHdr.SetQosAckPolicy (WifiMacHeader::BLOCK_ACK);
}
}
-bool EdcaTxopN::GetAmpduExist(void)
+bool EdcaTxopN::GetAmpduExist (void)
{
return m_ampduExist;
}
-
-void EdcaTxopN::SetAmpduExist(bool ampdu)
+
+void EdcaTxopN::SetAmpduExist (bool ampdu)
{
m_ampduExist = ampdu;
}
@@ -1249,10 +1267,10 @@
void
EdcaTxopN::CompleteMpduTx (Ptr<const Packet> packet, WifiMacHeader hdr, Time tstamp)
{
- m_baManager->StorePacket (packet, hdr, tstamp);
- m_baManager->NotifyMpduTransmission (hdr.GetAddr1 (), hdr.GetQosTid (),
- m_txMiddle->GetNextSeqNumberByTidAndAddress (hdr.GetQosTid (),
- hdr.GetAddr1 ()), WifiMacHeader::NORMAL_ACK);
+ m_baManager->StorePacket (packet, hdr, tstamp);
+ m_baManager->NotifyMpduTransmission (hdr.GetAddr1 (), hdr.GetQosTid (),
+ m_txMiddle->GetNextSeqNumberByTidAndAddress (hdr.GetQosTid (),
+ hdr.GetAddr1 ()), WifiMacHeader::NORMAL_ACK);
}
bool
@@ -1484,4 +1502,4 @@
}
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/edca-txop-n.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/edca-txop-n.h Sun Jun 21 00:23:45 2015 +0200
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
+ * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Mirko Banchi <mk.banchi@gmail.com>
*/
#ifndef EDCA_TXOP_N_H
#define EDCA_TXOP_N_H
@@ -25,7 +25,6 @@
#include "ns3/object.h"
#include "ns3/mac48-address.h"
#include "ns3/packet.h"
-
#include "wifi-mode.h"
#include "wifi-mac-header.h"
#include "wifi-remote-station-manager.h"
@@ -33,7 +32,6 @@
#include "dcf.h"
#include "ctrl-headers.h"
#include "block-ack-manager.h"
-
#include <map>
#include <list>
@@ -147,6 +145,7 @@
* \return WifiMacQueue
*/
Ptr<WifiMacQueue > GetEdcaQueue () const;
+
virtual void SetMinCw (uint32_t minCw);
virtual void SetMaxCw (uint32_t maxCw);
virtual void SetAifsn (uint32_t aifsn);
@@ -160,6 +159,7 @@
* \return MacLow
*/
Ptr<MacLow> Low (void);
+
Ptr<MsduAggregator> GetMsduAggregator (void) const;
/**
* \param recipient address of the peer station
@@ -175,7 +175,7 @@
* \param tid traffic ID.
* \return the number of packets buffered for a specified agreement
*
- * Returns number of packets buffered for a specified agreement.
+ * Returns number of packets buffered for a specified agreement.
*/
uint32_t GetNOutstandingPacketsInBa (Mac48Address address, uint8_t tid);
/**
@@ -193,7 +193,7 @@
* This function resets the status of OriginatorBlockAckAgreement after the transfer
* of an A-MPDU with ImmediateBlockAck policy (i.e. no BAR is scheduled)
*/
- void CompleteAmpduTransfer(Mac48Address recipient, uint8_t tid);
+ void CompleteAmpduTransfer (Mac48Address recipient, uint8_t tid);
/* dcf notifications forwarded here */
/**
@@ -290,25 +290,29 @@
/**
* Check if the current packet should be sent with a RTS protection.
*
- * \return true if RTS protection should be used, false otherwise
+ * \return true if RTS protection should be used,
+ * false otherwise
*/
bool NeedRts (void);
/**
* Check if RTS should be re-transmitted if CTS was missed.
*
- * \return true if RTS should be re-transmitted, false otherwise
+ * \return true if RTS should be re-transmitted,
+ * false otherwise
*/
bool NeedRtsRetransmission (void);
/**
* Check if DATA should be re-transmitted if ACK was missed.
*
- * \return true if DATA should be re-transmitted, false otherwise
+ * \return true if DATA should be re-transmitted,
+ * false otherwise
*/
bool NeedDataRetransmission (void);
/**
* Check if Block ACK Request should be re-transmitted.
*
- * \return true if BAR should be re-transmitted, false otherwise
+ * \return true if BAR should be re-transmitted,
+ * false otherwise
*/
bool NeedBarRetransmission (void);
/**
@@ -357,12 +361,14 @@
* \return the fragment with the current fragment number
*/
Ptr<Packet> GetFragmentPacket (WifiMacHeader *hdr);
+
/**
* Set the access category of this EDCAF.
*
* \param ac
*/
void SetAccessCategory (enum AcIndex ac);
+
/**
* \param packet packet to send
* \param hdr header of packet to send.
@@ -371,7 +377,9 @@
* can be sent safely.
*/
void Queue (Ptr<const Packet> packet, const WifiMacHeader &hdr);
+
void SetMsduAggregator (Ptr<MsduAggregator> aggr);
+
/**
* \param packet packet to send
* \param hdr header of packet to send.
@@ -380,10 +388,12 @@
* can be sent safely.
*/
void PushFront (Ptr<const Packet> packet, const WifiMacHeader &hdr);
+
/**
* Complete block ACK configuration.
*/
void CompleteConfig (void);
+
/**
* Set threshold for block ACK mechanism. If number of packets in the
* queue reaches the threshold, block ACK mechanism is used.
@@ -397,16 +407,18 @@
* \return the current threshold for block ACK mechanism
*/
uint8_t GetBlockAckThreshold (void) const;
-
+
void SetBlockAckInactivityTimeout (uint16_t timeout);
void SendDelbaFrame (Mac48Address addr, uint8_t tid, bool byOriginator);
void CompleteMpduTx (Ptr<const Packet> packet, WifiMacHeader hdr, Time tstamp);
bool GetAmpduExist (void);
void SetAmpduExist (bool ampdu);
+
/**
* Return the next sequence number for the given header.
*
* \param hdr Wi-Fi header
+ *
* \return the next sequence number
*/
uint16_t GetNextSequenceNumberfor (WifiMacHeader *hdr);
@@ -414,6 +426,7 @@
* Return the next sequence number for the Traffic ID and destination, but do not pick it (i.e. the current sequence number remains unchanged).
*
* \param hdr Wi-Fi header
+ *
* \return the next sequence number
*/
uint16_t PeekNextSequenceNumberfor (WifiMacHeader *hdr);
@@ -438,16 +451,17 @@
*/
void BaTxFailed (const WifiMacHeader &hdr);
- /**
- * Assign a fixed random variable stream number to the random variables
- * used by this model. Return the number of streams (possibly zero) that
- * have been assigned.
- *
- * \param stream first stream index to use
- * \return the number of stream indices assigned by this model
- */
+ /**
+ * Assign a fixed random variable stream number to the random variables
+ * used by this model. Return the number of streams (possibly zero) that
+ * have been assigned.
+ *
+ * \param stream first stream index to use
+ * \return the number of stream indices assigned by this model
+ */
int64_t AssignStreams (int64_t stream);
+
private:
void DoInitialize ();
/**
@@ -544,6 +558,6 @@
bool m_ampduExist;
};
-} // namespace ns3
+} //namespace ns3
#endif /* EDCA_TXOP_N_H */
--- a/src/wifi/model/error-rate-model.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/error-rate-model.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#include "error-rate-model.h"
namespace ns3 {
@@ -35,7 +36,7 @@
double
ErrorRateModel::CalculateSnr (WifiMode txMode, double ber) const
{
- // This is a very simple binary search.
+ //This is a very simple binary search.
double low, high, precision;
low = 1e-25;
high = 1e25;
@@ -56,4 +57,4 @@
return low;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/error-rate-model.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/error-rate-model.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef ERROR_RATE_MODEL_H
#define ERROR_RATE_MODEL_H
@@ -38,8 +39,8 @@
/**
* \param txMode a specific transmission mode
* \param ber a target ber
- * \returns the snr which corresponds to the requested
- * ber.
+ *
+ * \return the snr which corresponds to the requested ber
*/
double CalculateSnr (WifiMode txMode, double ber) const;
@@ -55,11 +56,13 @@
* \param mode the Wi-Fi mode the chunk is sent
* \param snr the SNR of the chunk
* \param nbits the number of bits in this chunk
+ *
* \return probability of successfully receiving the chunk
*/
virtual double GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const = 0;
};
-} // namespace ns3
+} //namespace ns3
#endif /* ERROR_RATE_MODEL_H */
+
--- a/src/wifi/model/ht-capabilities.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/ht-capabilities.cc Sun Jun 21 00:23:45 2015 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2013
*
* 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,103 +22,103 @@
#include "ns3/assert.h"
#include "ns3/log.h"
-
namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("HtCapabilities");
HtCapabilities::HtCapabilities ()
- : m_ldpc(0),
- m_supportedChannelWidth(0),
- m_smPowerSave(0),
- m_greenField(0),
- m_shortGuardInterval20(0),
- m_shortGuardInterval40(0),
- m_txStbc(0),
- m_rxStbc(0),
- m_htDelayedBlockAck(0),
- m_maxAmsduLength(0),
- m_dssMode40(0),
- m_reserved(0),
- m_fortyMhzIntolerant(0),
- m_lsigProtectionSupport(0),
- m_maxAmpduLength(0),
- m_minMpduStartSpace(0),
- m_ampduReserved(0),
- m_reservedMcsSet1(0),
- m_rxHighestSupportedDataRate(0),
- m_reservedMcsSet2(0),
- m_txMcsSetDefined(0),
- m_txRxMcsSetUnequal(0),
- m_txMaxNSpatialStreams(0),
- m_txUnequalModulation(0),
- m_reservedMcsSet3(7),
- m_htSupported(0)
+ : m_ldpc (0),
+ m_supportedChannelWidth (0),
+ m_smPowerSave (0),
+ m_greenField (0),
+ m_shortGuardInterval20 (0),
+ m_shortGuardInterval40 (0),
+ m_txStbc (0),
+ m_rxStbc (0),
+ m_htDelayedBlockAck (0),
+ m_maxAmsduLength (0),
+ m_dssMode40 (0),
+ m_reserved (0),
+ m_fortyMhzIntolerant (0),
+ m_lsigProtectionSupport (0),
+ m_maxAmpduLength (0),
+ m_minMpduStartSpace (0),
+ m_ampduReserved (0),
+ m_reservedMcsSet1 (0),
+ m_rxHighestSupportedDataRate (0),
+ m_reservedMcsSet2 (0),
+ m_txMcsSetDefined (0),
+ m_txRxMcsSetUnequal (0),
+ m_txMaxNSpatialStreams (0),
+ m_txUnequalModulation (0),
+ m_reservedMcsSet3 (7),
+ m_htSupported (0)
{
- for (uint32_t k=0; k < MAX_SUPPORTED_MCS ;k++)
- {
- m_rxMcsBitmask[k]=0;
- }
+ for (uint32_t k = 0; k < MAX_SUPPORTED_MCS; k++)
+ {
+ m_rxMcsBitmask[k] = 0;
+ }
}
-
WifiInformationElementId
HtCapabilities::ElementId () const
{
return IE_HT_CAPABILITIES;
}
-void
-HtCapabilities::SetHtSupported(uint8_t htsupported)
+void
+HtCapabilities::SetHtSupported (uint8_t htsupported)
{
m_htSupported = htsupported;
}
+
void
HtCapabilities::SetLdpc (uint8_t ldpc)
{
- m_ldpc=ldpc;
+ m_ldpc = ldpc;
}
void
HtCapabilities::SetSupportedChannelWidth (uint8_t supportedchannelwidth)
{
- m_supportedChannelWidth=supportedchannelwidth;
+ m_supportedChannelWidth = supportedchannelwidth;
}
void
HtCapabilities::SetGreenfield (uint8_t greenfield)
{
- m_greenField=greenfield;
+ m_greenField = greenfield;
}
void
HtCapabilities::SetShortGuardInterval20 (uint8_t shortguardinterval)
{
- m_shortGuardInterval20=shortguardinterval;
+ m_shortGuardInterval20 = shortguardinterval;
}
+
void
-HtCapabilities::SetRxMcsBitmask(uint8_t index)
+HtCapabilities::SetRxMcsBitmask (uint8_t index)
{
- m_rxMcsBitmask[index]=1;
+ m_rxMcsBitmask[index] = 1;
}
uint8_t*
-HtCapabilities::GetRxMcsBitmask()
+HtCapabilities::GetRxMcsBitmask ()
{
uint8_t* p;
- p= m_rxMcsBitmask;
+ p = m_rxMcsBitmask;
return p;
}
-bool
+bool
HtCapabilities::IsSupportedMcs (uint8_t mcs)
{
if (m_rxMcsBitmask[mcs] == 1)
- {
+ {
return true;
- }
+ }
return false;
-
+
}
uint8_t
HtCapabilities::GetLdpc (void) const
@@ -137,8 +137,9 @@
{
return m_greenField;
}
+
uint8_t
-HtCapabilities::GetShortGuardInterval20(void) const
+HtCapabilities::GetShortGuardInterval20 (void) const
{
return m_shortGuardInterval20;
}
@@ -146,19 +147,21 @@
uint8_t
HtCapabilities::GetInformationFieldSize () const
{
- // we should not be here if ht is not supported
+ //we should not be here if ht is not supported
NS_ASSERT (m_htSupported > 0);
return 19;
}
+
Buffer::Iterator
HtCapabilities::Serialize (Buffer::Iterator i) const
{
- if (m_htSupported< 1)
+ if (m_htSupported < 1)
{
- return i;
+ return i;
}
return WifiInformationElement::Serialize (i);
}
+
uint16_t
HtCapabilities::GetSerializedSize () const
{
@@ -174,47 +177,48 @@
{
uint16_t val = 0;
val |= m_ldpc;
- val |= (m_supportedChannelWidth << 1)& (0x1 << 1);
- val |= (m_smPowerSave << 2)& (0x3 << 2) ;
- val |= (m_greenField << 4)& (0x1 << 4) ;
- val |= (m_shortGuardInterval20 << 5)& (0x1 << 5);
- val |= (m_shortGuardInterval40 << 6)& (0x1 << 6);
- val |= (m_txStbc << 7)& (0x1 << 7);
- val |= (m_rxStbc << 8)& (0x3 << 8);
- val |= (m_htDelayedBlockAck << 10)& (0x1 << 10);
- val |= (m_maxAmsduLength << 11)& (0x1 << 11);
- val |= (m_dssMode40 << 12)& (0x1 << 12);
- val |= (m_reserved<< 13)& (0x1 << 13);
- val |= (m_fortyMhzIntolerant << 14)& (0x1 << 14);
- val |= (m_lsigProtectionSupport << 15)& (0x1 << 15);
+ val |= (m_supportedChannelWidth << 1) & (0x1 << 1);
+ val |= (m_smPowerSave << 2) & (0x3 << 2);
+ val |= (m_greenField << 4) & (0x1 << 4);
+ val |= (m_shortGuardInterval20 << 5) & (0x1 << 5);
+ val |= (m_shortGuardInterval40 << 6) & (0x1 << 6);
+ val |= (m_txStbc << 7) & (0x1 << 7);
+ val |= (m_rxStbc << 8) & (0x3 << 8);
+ val |= (m_htDelayedBlockAck << 10) & (0x1 << 10);
+ val |= (m_maxAmsduLength << 11) & (0x1 << 11);
+ val |= (m_dssMode40 << 12) & (0x1 << 12);
+ val |= (m_reserved << 13) & (0x1 << 13);
+ val |= (m_fortyMhzIntolerant << 14) & (0x1 << 14);
+ val |= (m_lsigProtectionSupport << 15) & (0x1 << 15);
return val;
}
void
-HtCapabilities::SetHtCapabilitiesInfo(uint16_t ctrl)
+HtCapabilities::SetHtCapabilitiesInfo (uint16_t ctrl)
{
m_ldpc = ctrl & 0x01;
m_supportedChannelWidth = (ctrl >> 1) & 0x01;
m_smPowerSave = (ctrl >> 2) & 0x03;
m_greenField = (ctrl >> 4) & 0x01;
- m_shortGuardInterval20 = (ctrl >> 5) & 0x01;
- m_shortGuardInterval40 = (ctrl >> 6) & 0x01;
+ m_shortGuardInterval20 = (ctrl >> 5) & 0x01;
+ m_shortGuardInterval40 = (ctrl >> 6) & 0x01;
m_txStbc = (ctrl >> 7) & 0x01;
m_rxStbc = (ctrl >> 8) & 0x03;
m_htDelayedBlockAck = (ctrl >> 10) & 0x01;
m_maxAmsduLength = (ctrl >> 11) & 0x01;
- m_dssMode40= (ctrl >> 12) & 0x01;
- m_reserved= (ctrl >> 13) & 0x01;
- m_fortyMhzIntolerant= (ctrl >> 14) & 0x01;
- m_lsigProtectionSupport= (ctrl >> 15) & 0x01;
+ m_dssMode40 = (ctrl >> 12) & 0x01;
+ m_reserved = (ctrl >> 13) & 0x01;
+ m_fortyMhzIntolerant = (ctrl >> 14) & 0x01;
+ m_lsigProtectionSupport = (ctrl >> 15) & 0x01;
}
+
uint8_t
HtCapabilities::GetAmpduParameters (void) const
{
uint8_t val = 0;
val |= m_maxAmpduLength & 0x3;
- val |= ( m_minMpduStartSpace << 2)& (0x7 << 2);
- val |= (m_ampduReserved << 5)& (0x7 << 5) ;
+ val |= ( m_minMpduStartSpace << 2) & (0x7 << 2);
+ val |= (m_ampduReserved << 5) & (0x7 << 5);
return val;
}
@@ -223,59 +227,61 @@
{
m_maxAmpduLength = ctrl & 0x03;
m_minMpduStartSpace = (ctrl >> 2) & 0x07;
- m_ampduReserved =(ctrl >> 5) & 0x07;
+ m_ampduReserved = (ctrl >> 5) & 0x07;
}
void
HtCapabilities::SetSupportedMcsSet (uint64_t ctrl2, uint64_t ctrl1)
{
- for(uint64_t i=0 ; i < 77;i++)
+ for (uint64_t i = 0; i < 77; i++)
{
if (i < 64)
{
- m_rxMcsBitmask[i]=(ctrl1 >> i) & 0x01;
+ m_rxMcsBitmask[i] = (ctrl1 >> i) & 0x01;
}
else
{
- m_rxMcsBitmask[i]=( ctrl2 >> (i-64))& 0x01 ;
+ m_rxMcsBitmask[i] = (ctrl2 >> (i - 64)) & 0x01;
}
}
m_reservedMcsSet1 = (ctrl2 >> 12) & 0x07;
m_rxHighestSupportedDataRate = (ctrl2 >> 15) & 0x03ff;
m_reservedMcsSet2 = (ctrl2 >> 25) & 0x3f;
- m_txMcsSetDefined = (ctrl2 >> 31) & 0x01;
- m_txRxMcsSetUnequal = (ctrl2 >> 32) & 0x01;
+ m_txMcsSetDefined = (ctrl2 >> 31) & 0x01;
+ m_txRxMcsSetUnequal = (ctrl2 >> 32) & 0x01;
m_txMaxNSpatialStreams = (ctrl2 >> 33) & 0x03;
m_txUnequalModulation = (ctrl2 >> 35) & 0x01;
m_reservedMcsSet3 = (ctrl2 >> 36) & 0x07ffffff;
}
+
uint64_t
HtCapabilities::GetSupportedMcsSet1 (void) const
{
- uint64_t val=0;
- for(uint64_t i=63 ; i >0 ;i--)
+ uint64_t val = 0;
+ for (uint64_t i = 63; i > 0; i--)
{
- val = (val << 1) | (m_rxMcsBitmask[i] & 0x01);
+ val = (val << 1) | (m_rxMcsBitmask[i] & 0x01);
}
val = (val << 1) | (m_rxMcsBitmask[0] & 0x01);
return val;
}
+
uint64_t
HtCapabilities::GetSupportedMcsSet2 (void) const
{
- uint64_t val=0;
+ uint64_t val = 0;
val = val | (m_reservedMcsSet3 & 0x07ffffff);
val = (val << 1) | (m_txUnequalModulation & 0x01);
val = (val << 2) | (m_txMaxNSpatialStreams & 0x03);
val = (val << 1) | (m_txRxMcsSetUnequal & 0x01);
val = (val << 1) | (m_txMcsSetDefined & 0x01);
val = (val << 6) | (m_reservedMcsSet2 & 0x3f);
- val = (val << 10) |(m_rxHighestSupportedDataRate & 0x3ff);
- val = (val << 3) |(m_reservedMcsSet1 & 0x07);
+ val = (val << 10) | (m_rxHighestSupportedDataRate & 0x3ff);
+ val = (val << 3) | (m_reservedMcsSet1 & 0x07);
- for (uint64_t i=12; i>0;i--)
+ for (uint64_t i = 12; i > 0; i--)
{
- val = (val << 1)|( m_rxMcsBitmask[i+64] & 0x01);
+ val = (val << 1) | ( m_rxMcsBitmask[i + 64] & 0x01);
}
return val;
}
@@ -283,28 +289,28 @@
void
HtCapabilities::SerializeInformationField (Buffer::Iterator start) const
{
- if (m_htSupported == 1)
+ if (m_htSupported == 1)
{
- // write the corresponding value for each bit
- start. WriteHtolsbU16 (GetHtCapabilitiesInfo());
- start. WriteU8 (GetAmpduParameters());
- start. WriteHtolsbU64 (GetSupportedMcsSet2());
- start. WriteHtolsbU64 (GetSupportedMcsSet1());
+ //write the corresponding value for each bit
+ start.WriteHtolsbU16 (GetHtCapabilitiesInfo ());
+ start.WriteU8 (GetAmpduParameters ());
+ start.WriteHtolsbU64 (GetSupportedMcsSet2 ());
+ start.WriteHtolsbU64 (GetSupportedMcsSet1 ());
}
}
uint8_t
HtCapabilities::DeserializeInformationField (Buffer::Iterator start,
uint8_t length)
-{
+{
Buffer::Iterator i = start;
uint16_t htinfo = i.ReadLsbtohU16 ();
uint8_t ampduparam = i.ReadU8 ();
- uint64_t mcsset1=i.ReadLsbtohU64 ();
+ uint64_t mcsset1 = i.ReadLsbtohU64 ();
uint64_t mcsset2 = i.ReadLsbtohU64 ();
- SetHtCapabilitiesInfo(htinfo);
- SetAmpduParameters(ampduparam);
- SetSupportedMcsSet(mcsset1,mcsset2);
+ SetHtCapabilitiesInfo (htinfo);
+ SetAmpduParameters (ampduparam);
+ SetSupportedMcsSet (mcsset1, mcsset2);
return length;
}
@@ -323,8 +329,8 @@
std::istream &operator >> (std::istream &is,HtCapabilities &htcapabilities)
{
- bool c1, c2, c3,c4;
- is >> c1 >> c2 >> c3 >>c4;
+ bool c1, c2, c3, c4;
+ is >> c1 >> c2 >> c3 >> c4;
htcapabilities.SetLdpc (c1);
htcapabilities.SetSupportedChannelWidth (c2);
htcapabilities.SetGreenfield (c3);
@@ -333,4 +339,4 @@
return is;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/ht-capabilities.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/ht-capabilities.h Sun Jun 21 00:23:45 2015 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2013
*
* 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,
@@ -17,6 +17,7 @@
*
* Author: Ghada Badawy <gbadawy@gmail.com>
*/
+
#ifndef HT_CAPABILITIES_H
#define HT_CAPABILITIES_H
@@ -41,19 +42,19 @@
*
* \see attribute_HtCapabilities
*/
-class HtCapabilities: public WifiInformationElement
+class HtCapabilities : public WifiInformationElement
{
public:
- HtCapabilities ();
+ HtCapabilities ();
void SetLdpc (uint8_t ldpc);
void SetSupportedChannelWidth (uint8_t supportedchannelwidth);
void SetGreenfield (uint8_t greenfield);
- void SetShortGuardInterval20(uint8_t shortguardinterval);
- void SetHtCapabilitiesInfo(uint16_t ctrl);
+ void SetShortGuardInterval20 (uint8_t shortguardinterval);
+ void SetHtCapabilitiesInfo (uint16_t ctrl);
void SetAmpduParameters (uint8_t ctrl);
void SetSupportedMcsSet (uint64_t ctrl1, uint64_t ctrl2);
- void SetHtSupported(uint8_t htsupported);
- void SetRxMcsBitmask(uint8_t index);
+ void SetHtSupported (uint8_t htsupported);
+ void SetRxMcsBitmask (uint8_t index);
bool IsSupportedMcs (uint8_t mcs);
//returns the HT Capabilties info field in the HT Capabilities information element
uint16_t GetHtCapabilitiesInfo (void) const;
@@ -67,8 +68,8 @@
uint8_t GetGreenfield (void) const;
uint8_t GetShortGuardInterval20 (void) const;
uint8_t GetSupportedChannelWidth (void) const;
- uint8_t* GetRxMcsBitmask();
-
+ uint8_t* GetRxMcsBitmask ();
+
WifiInformationElementId ElementId () const;
uint8_t GetInformationFieldSize () const;
void SerializeInformationField (Buffer::Iterator start) const;
@@ -81,24 +82,25 @@
* WifiInformationElement.
*
* \param start
+ *
* \return an iterator
*/
Buffer::Iterator Serialize (Buffer::Iterator start) const;
/**
- * Return the serialized size of this HT capability
+ * Return the serialized size of this HT capability
* information element.
- *
- * \return the serialized size of this HT capability
- * information element
+ *
+ * \return the serialized size of this HT capability information element
*/
uint16_t GetSerializedSize () const;
-
+
+
private:
uint8_t m_ldpc;
uint8_t m_supportedChannelWidth;
uint8_t m_smPowerSave;
uint8_t m_greenField;
- uint8_t m_shortGuardInterval20;
+ uint8_t m_shortGuardInterval20;
uint8_t m_shortGuardInterval40;
uint8_t m_txStbc;
uint8_t m_rxStbc;
@@ -118,7 +120,7 @@
uint8_t m_txRxMcsSetUnequal;
uint8_t m_txMaxNSpatialStreams;
uint8_t m_txUnequalModulation;
- uint32_t m_reservedMcsSet3;
+ uint32_t m_reservedMcsSet3;
uint8_t m_rxMcsBitmask[MAX_SUPPORTED_MCS];
//this is used to decide if this element should be added to the frame or not
uint8_t m_htSupported;
@@ -129,6 +131,6 @@
ATTRIBUTE_HELPER_HEADER (HtCapabilities);
-} // namespace ns3
+} //namespace ns3
#endif /* HT_CAPABILITY_H */
--- a/src/wifi/model/ideal-wifi-manager.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/ideal-wifi-manager.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#include "ideal-wifi-manager.h"
#include "wifi-phy.h"
#include "ns3/assert.h"
@@ -59,6 +60,7 @@
IdealWifiManager::IdealWifiManager ()
{
}
+
IdealWifiManager::~IdealWifiManager ()
{
}
@@ -110,14 +112,17 @@
double rxSnr, WifiMode txMode)
{
}
+
void
IdealWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
{
}
+
void
IdealWifiManager::DoReportDataFailed (WifiRemoteStation *station)
{
}
+
void
IdealWifiManager::DoReportRtsOk (WifiRemoteStation *st,
double ctsSnr, WifiMode ctsMode, double rtsSnr)
@@ -125,6 +130,7 @@
IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st;
station->m_lastSnr = rtsSnr;
}
+
void
IdealWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
@@ -132,10 +138,12 @@
IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st;
station->m_lastSnr = dataSnr;
}
+
void
IdealWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
{
}
+
void
IdealWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
{
@@ -145,9 +153,9 @@
IdealWifiManager::DoGetDataTxVector (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
- // to ensure correct packet delivery.
+ //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 ();
for (uint32_t i = 0; i < GetNSupported (station); i++)
@@ -161,15 +169,16 @@
maxMode = mode;
}
}
- return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station));
+ return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
}
+
WifiTxVector
IdealWifiManager::DoGetRtsTxVector (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
- // ensure correct packet delivery.
+ //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 ();
for (uint32_t i = 0; i < GetNBasicModes (); i++)
@@ -183,7 +192,7 @@
maxMode = mode;
}
}
- return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station));
+ return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
}
bool
@@ -192,4 +201,4 @@
return true;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/ideal-wifi-manager.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/ideal-wifi-manager.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef IDEAL_WIFI_MANAGER_H
#define IDEAL_WIFI_MANAGER_H
@@ -51,8 +52,9 @@
virtual void SetupPhy (Ptr<WifiPhy> phy);
+
private:
- // overriden from base class
+ //overriden from base class
virtual WifiRemoteStation* DoCreateStation (void) const;
virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
@@ -73,6 +75,7 @@
* data with this mode at the specified BER.
*
* \param mode WifiMode
+ *
* \return the minimum SNR for the given mode
*/
double GetSnrThreshold (WifiMode mode) const;
@@ -90,10 +93,10 @@
*/
typedef std::vector<std::pair<double,WifiMode> > Thresholds;
- double m_ber; //!< The maximum Bit Error Rate acceptable at any transmission mode
+ double m_ber; //!< The maximum Bit Error Rate acceptable at any transmission mode
Thresholds m_thresholds; //!< List of WifiMode and the minimum SNR pair
};
-} // namespace ns3
+} //namespace ns3
#endif /* IDEAL_WIFI_MANAGER_H */
--- a/src/wifi/model/interference-helper.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/interference-helper.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#include "interference-helper.h"
#include "wifi-phy.h"
#include "error-rate-model.h"
@@ -43,6 +44,7 @@
m_rxPowerW (rxPower)
{
}
+
InterferenceHelper::Event::~Event ()
{
}
@@ -52,36 +54,43 @@
{
return m_endTime - m_startTime;
}
+
Time
InterferenceHelper::Event::GetStartTime (void) const
{
return m_startTime;
}
+
Time
InterferenceHelper::Event::GetEndTime (void) const
{
return m_endTime;
}
+
double
InterferenceHelper::Event::GetRxPowerW (void) const
{
return m_rxPowerW;
}
+
uint32_t
InterferenceHelper::Event::GetSize (void) const
{
return m_size;
}
+
WifiTxVector
InterferenceHelper::Event::GetTxVector (void) const
{
return m_txVector;
}
+
WifiMode
InterferenceHelper::Event::GetPayloadMode (void) const
{
- return m_txVector.GetMode();
+ return m_txVector.GetMode ();
}
+
enum WifiPreamble
InterferenceHelper::Event::GetPreambleType (void) const
{
@@ -99,22 +108,26 @@
m_delta (delta)
{
}
+
Time
InterferenceHelper::NiChange::GetTime (void) const
{
return m_time;
}
+
double
InterferenceHelper::NiChange::GetDelta (void) const
{
return m_delta;
}
+
bool
InterferenceHelper::NiChange::operator < (const InterferenceHelper::NiChange& o) const
{
return (m_time < o.m_time);
}
+
/****************************************************************
* The actual InterferenceHelper
****************************************************************/
@@ -125,6 +138,7 @@
m_rxing (false)
{
}
+
InterferenceHelper::~InterferenceHelper ()
{
EraseEvents ();
@@ -221,11 +235,11 @@
double
InterferenceHelper::CalculateSnr (double signal, double noiseInterference, WifiMode mode) const
{
- // thermal noise at 290K in J/s = W
+ //thermal noise at 290K in J/s = W
static const double BOLTZMANN = 1.3803e-23;
- // Nt is the power of thermal noise in W
+ //Nt is the power of thermal noise in W
double Nt = BOLTZMANN * 290.0 * mode.GetBandwidth ();
- // receiver noise Floor (W) which accounts for thermal noise and non-idealities of the receiver
+ //receiver noise Floor (W) which accounts for thermal noise and non-idealities of the receiver
double noiseFloor = m_noiseFigure * Nt;
double noise = noiseFloor + noiseInterference;
double snr = signal / noise;
@@ -271,18 +285,18 @@
Time previous = (*j).GetTime ();
WifiMode payloadMode = event->GetPayloadMode ();
WifiPreamble preamble = event->GetPreambleType ();
- Time plcpHeaderStart = (*j).GetTime () + WifiPhy::GetPlcpPreambleDuration (payloadMode, preamble); //packet start time+ preamble
- Time plcpHsigHeaderStart = plcpHeaderStart + WifiPhy::GetPlcpHeaderDuration (payloadMode, preamble);//packet start time+ preamble+L SIG
- Time plcpHtTrainingSymbolsStart = plcpHsigHeaderStart + WifiPhy::GetPlcpHtSigHeaderDuration (preamble);//packet start time+ preamble+L SIG+HT SIG
- Time plcpPayloadStart =plcpHtTrainingSymbolsStart + WifiPhy::GetPlcpHtTrainingSymbolDuration (preamble,event->GetTxVector()); //packet start time+ preamble+L SIG+HT SIG+Training
+ Time plcpHeaderStart = (*j).GetTime () + WifiPhy::GetPlcpPreambleDuration (payloadMode, preamble); //packet start time + preamble
+ Time plcpHsigHeaderStart = plcpHeaderStart + WifiPhy::GetPlcpHeaderDuration (payloadMode, preamble); //packet start time + preamble + L-SIG
+ Time plcpHtTrainingSymbolsStart = plcpHsigHeaderStart + WifiPhy::GetPlcpHtSigHeaderDuration (preamble); //packet start time + preamble + L-SIG + HT-SIG
+ Time plcpPayloadStart = plcpHtTrainingSymbolsStart + WifiPhy::GetPlcpHtTrainingSymbolDuration (preamble,event->GetTxVector ()); //packet start time + preamble + L-SIG + HT-SIG + HT Training
double noiseInterferenceW = (*j).GetDelta ();
double powerW = event->GetRxPowerW ();
- j++;
+ j++;
while (ni->end () != j)
{
Time current = (*j).GetTime ();
NS_ASSERT (current >= previous);
- //Case 1: Both prev and curr point to the payload
+ //Case 1: Both previous and current point to the payload
if (previous >= plcpPayloadStart)
{
psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
@@ -296,14 +310,13 @@
{
//Case 2a: current is after payload
if (current >= plcpPayloadStart)
- {
- //Case 2ai and 2aii: All formats
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- payloadMode),
- current - plcpPayloadStart,
- payloadMode);
-
+ {
+ //Case 2ai and 2aii: All formats
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ payloadMode),
+ current - plcpPayloadStart,
+ payloadMode);
}
}
//Case 3: previous is in HT-SIG: Non HT will not enter here since it didn't enter in the last two and they are all the same for non HT
@@ -311,29 +324,28 @@
{
//Case 3a: cuurent after payload start
if (current >= plcpPayloadStart)
- {
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- payloadMode),
- current - plcpPayloadStart,
- payloadMode);
-
- }
+ {
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ payloadMode),
+ current - plcpPayloadStart,
+ payloadMode);
+ }
}
//Case 4: previous in L-SIG: GF will not reach here because it will execute the previous if and exit
else if (previous >= plcpHeaderStart)
{
- //Case 4a: current after payload start
+ //Case 4a: current after payload start
if (current >= plcpPayloadStart)
- {
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- payloadMode),
- current - plcpPayloadStart,
- payloadMode);
+ {
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ payloadMode),
+ current - plcpPayloadStart,
+ payloadMode);
- }
+ }
}
//Case 5: previous is in the preamble works for all cases
else
@@ -345,8 +357,7 @@
noiseInterferenceW,
payloadMode),
current - plcpPayloadStart,
- payloadMode);
-
+ payloadMode);
}
}
@@ -367,19 +378,19 @@
Time previous = (*j).GetTime ();
WifiMode payloadMode = event->GetPayloadMode ();
WifiPreamble preamble = event->GetPreambleType ();
- WifiMode MfHeaderMode ;
+ WifiMode MfHeaderMode;
if (preamble == WIFI_PREAMBLE_HT_MF)
{
- MfHeaderMode = WifiPhy::GetMFPlcpHeaderMode (payloadMode, preamble); //return L-SIG mode
+ MfHeaderMode = WifiPhy::GetMFPlcpHeaderMode (payloadMode, preamble);
}
WifiMode headerMode = WifiPhy::GetPlcpHeaderMode (payloadMode, preamble);
- Time plcpHeaderStart = (*j).GetTime () + WifiPhy::GetPlcpPreambleDuration (payloadMode, preamble); // packet start time + preamble
- Time plcpHsigHeaderStart = plcpHeaderStart + WifiPhy::GetPlcpHeaderDuration (payloadMode, preamble); // packet start time + preamble+L SIG
- Time plcpHtTrainingSymbolsStart = plcpHsigHeaderStart + WifiPhy::GetPlcpHtSigHeaderDuration (preamble); // packet start time + preamble + L SIG + HT SIG
- Time plcpPayloadStart = plcpHtTrainingSymbolsStart + WifiPhy::GetPlcpHtTrainingSymbolDuration (preamble, event->GetTxVector()); // packet start time + preamble + L SIG + HT SIG + Training
+ Time plcpHeaderStart = (*j).GetTime () + WifiPhy::GetPlcpPreambleDuration (payloadMode, preamble); //packet start time + preamble
+ Time plcpHsigHeaderStart = plcpHeaderStart + WifiPhy::GetPlcpHeaderDuration (payloadMode, preamble); //packet start time + preamble + L-SIG
+ Time plcpHtTrainingSymbolsStart = plcpHsigHeaderStart + WifiPhy::GetPlcpHtSigHeaderDuration (preamble); //packet start time + preamble + L-SIG + HT-SIG
+ Time plcpPayloadStart = plcpHtTrainingSymbolsStart + WifiPhy::GetPlcpHtTrainingSymbolDuration (preamble, event->GetTxVector ()); //packet start time + preamble + L-SIG + HT-SIG + HT Training
double noiseInterferenceW = (*j).GetDelta ();
double powerW = event->GetRxPowerW ();
- j++;
+ j++;
while (ni->end () != j)
{
Time current = (*j).GetTime ();
@@ -387,199 +398,204 @@
//Case 1: previous is in HT-SIG: Non HT will not enter here since it didn't enter in the last two and they are all the same for non HT
if (previous >= plcpHsigHeaderStart)
{
- //Case 1a: cuurent after payload start
+ //Case 1a: current after payload start
if (current >= plcpPayloadStart)
- {
+ {
+
-
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- headerMode),
- plcpHtTrainingSymbolsStart - previous,
- headerMode);
- }
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ headerMode),
+ plcpHtTrainingSymbolsStart - previous,
+ headerMode);
+ }
//case 1b: current after HT training symbols start
- else if (current >=plcpHtTrainingSymbolsStart)
- {
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- headerMode),
- plcpHtTrainingSymbolsStart - previous,
- headerMode);
-
- }
- //Case 1c: current is with previous in HT sig
- else
+ else if (current >= plcpHtTrainingSymbolsStart)
{
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- headerMode),
- current - previous,
- headerMode);
-
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ headerMode),
+ plcpHtTrainingSymbolsStart - previous,
+ headerMode);
+
}
- }
- // Case 2: previous in L-SIG: GF will not reach here because it will execute the previous if and exit
+ //Case 1c: current is with previous in HT sig
+ else
+ {
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ headerMode),
+ current - previous,
+ headerMode);
+ }
+ }
+ //Case 2: previous in L-SIG: GF will not reach here because it will execute the previous if and exit
else if (previous >= plcpHeaderStart)
{
- // Case 2a: current after payload start
+ //Case 2a: current after payload start
if (current >= plcpPayloadStart)
- {
- // Case 2ai: Non HT format (No HT-SIG or Training Symbols)
- if (preamble == WIFI_PREAMBLE_LONG || preamble == WIFI_PREAMBLE_SHORT) //plcpHtTrainingSymbolsStart==plcpHeaderStart)
+ {
+ //Case 2ai: Non HT format (No HT-SIG or Training Symbols)
+ if (preamble == WIFI_PREAMBLE_LONG || preamble == WIFI_PREAMBLE_SHORT)
{
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- headerMode),
- plcpPayloadStart - previous,
- headerMode);
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ headerMode),
+ plcpPayloadStart - previous,
+ headerMode);
}
else
{
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- headerMode),
- plcpHtTrainingSymbolsStart - plcpHsigHeaderStart,
- headerMode);
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- MfHeaderMode),
- plcpHsigHeaderStart - previous,
- MfHeaderMode);
- }
- }
- // Case 2b: current in HT training symbol. non HT will not come here since it went in previous if or if the previous ifis not true this will be not true
- else if (current >= plcpHtTrainingSymbolsStart)
- {
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- headerMode),
- plcpHtTrainingSymbolsStart - plcpHsigHeaderStart,
- headerMode);
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- MfHeaderMode),
- plcpHsigHeaderStart - previous,
- MfHeaderMode);
- }
- // Case 2c: current in H sig. non HT will not come here since it went in previous if or if the previous ifis not true this will be not true
- else if (current >= plcpHsigHeaderStart)
- {
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- headerMode),
- current - plcpHsigHeaderStart,
- headerMode);
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- MfHeaderMode),
- plcpHsigHeaderStart - previous,
- MfHeaderMode);
-
- }
- // Case 2d: Current with prev in L SIG
- else
- {
- // Case 4di: Non HT format (No HT-SIG or Training Symbols)
- if (preamble == WIFI_PREAMBLE_LONG || preamble == WIFI_PREAMBLE_SHORT) //plcpHtTrainingSymbolsStart==plcpHeaderStart)
- {
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- headerMode),
- current - previous,
- headerMode);
- }
- else
- {
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- MfHeaderMode),
- current - previous,
- MfHeaderMode);
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ headerMode),
+ plcpHtTrainingSymbolsStart - plcpHsigHeaderStart,
+ headerMode);
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ MfHeaderMode),
+ plcpHsigHeaderStart - previous,
+ MfHeaderMode);
}
}
- }
- // Case 3: previous is in the preamble works for all cases
- else
- {
- if (current >= plcpPayloadStart)
+ //Case 2b: current in HT training symbol. non HT will not come here since it went in previous if or if the previous if is not true this will be not true
+ else if (current >= plcpHtTrainingSymbolsStart)
{
- // Non HT format (No HT-SIG or Training Symbols)
- if (preamble == WIFI_PREAMBLE_LONG || preamble == WIFI_PREAMBLE_SHORT)
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- headerMode),
- plcpPayloadStart - plcpHeaderStart,
- headerMode);
- else
- // Greenfield or Mixed format
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- headerMode),
- plcpHtTrainingSymbolsStart - plcpHsigHeaderStart,
- headerMode);
- if (preamble == WIFI_PREAMBLE_HT_MF)
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- MfHeaderMode),
- plcpHsigHeaderStart-plcpHeaderStart,
- MfHeaderMode);
- }
- else if (current >= plcpHtTrainingSymbolsStart )
- {
- // Non HT format will not come here since it will execute prev if
- // Greenfield or Mixed format
psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
noiseInterferenceW,
headerMode),
plcpHtTrainingSymbolsStart - plcpHsigHeaderStart,
headerMode);
- // Greenfield
- if (preamble == WIFI_PREAMBLE_HT_MF)
- {
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- MfHeaderMode),
- plcpHsigHeaderStart-plcpHeaderStart,
- MfHeaderMode);
- }
- }
- // non HT will not come here
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ MfHeaderMode),
+ plcpHsigHeaderStart - previous,
+ MfHeaderMode);
+ }
+ //Case 2c: current in HT-SIG. non HT will not come here since it went in previous if or if the previous if is not true this will be not true
else if (current >= plcpHsigHeaderStart)
- {
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- headerMode),
- current- plcpHsigHeaderStart,
- headerMode);
- if (preamble != WIFI_PREAMBLE_HT_GF)
- {
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- MfHeaderMode),
- plcpHsigHeaderStart-plcpHeaderStart,
- MfHeaderMode);
- }
- }
- // GF will not come here
- else if (current >= plcpHeaderStart)
{
- if (preamble == WIFI_PREAMBLE_LONG || preamble == WIFI_PREAMBLE_SHORT)
- {
- psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
- noiseInterferenceW,
- headerMode),
- current - plcpHeaderStart,
- headerMode);
- }
- else
- {
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ headerMode),
+ current - plcpHsigHeaderStart,
+ headerMode);
psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
noiseInterferenceW,
MfHeaderMode),
- current - plcpHeaderStart,
+ plcpHsigHeaderStart - previous,
MfHeaderMode);
- }
+
+ }
+ //Case 2d: Current with previous in L-SIG
+ else
+ {
+ // Case 4di: Non HT format (No HT-SIG or Training Symbols)
+ if (preamble == WIFI_PREAMBLE_LONG || preamble == WIFI_PREAMBLE_SHORT)
+ {
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ headerMode),
+ current - previous,
+ headerMode);
+ }
+ else
+ {
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ MfHeaderMode),
+ current - previous,
+ MfHeaderMode);
+ }
+ }
+ }
+ //Case 3: previous is in the preamble works for all cases
+ else
+ {
+ if (current >= plcpPayloadStart)
+ {
+ //Non HT format (No HT-SIG or Training Symbols)
+ if (preamble == WIFI_PREAMBLE_LONG || preamble == WIFI_PREAMBLE_SHORT)
+ {
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ headerMode),
+ plcpPayloadStart - plcpHeaderStart,
+ headerMode);
+ }
+ else
+ {
+ //Greenfield or Mixed format
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ headerMode),
+ plcpHtTrainingSymbolsStart - plcpHsigHeaderStart,
+ headerMode);
+ }
+ if (preamble == WIFI_PREAMBLE_HT_MF)
+ {
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ MfHeaderMode),
+ plcpHsigHeaderStart - plcpHeaderStart,
+ MfHeaderMode);
+ }
+ }
+ else if (current >= plcpHtTrainingSymbolsStart )
+ {
+ //Non HT format will not come here since it will execute prev if
+ //Greenfield or Mixed format
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ headerMode),
+ plcpHtTrainingSymbolsStart - plcpHsigHeaderStart,
+ headerMode);
+ //Greenfield
+ if (preamble == WIFI_PREAMBLE_HT_MF)
+ {
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ MfHeaderMode),
+ plcpHsigHeaderStart - plcpHeaderStart,
+ MfHeaderMode);
+ }
+ }
+ //non HT will not come here
+ else if (current >= plcpHsigHeaderStart)
+ {
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ headerMode),
+ current - plcpHsigHeaderStart,
+ headerMode);
+ if (preamble != WIFI_PREAMBLE_HT_GF)
+ {
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ MfHeaderMode),
+ plcpHsigHeaderStart - plcpHeaderStart,
+ MfHeaderMode);
+ }
+ }
+ //GF will not come here
+ else if (current >= plcpHeaderStart)
+ {
+ if (preamble == WIFI_PREAMBLE_LONG || preamble == WIFI_PREAMBLE_SHORT)
+ {
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ headerMode),
+ current - plcpHeaderStart,
+ headerMode);
+ }
+ else
+ {
+ psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
+ noiseInterferenceW,
+ MfHeaderMode),
+ current - plcpHeaderStart,
+ MfHeaderMode);
+ }
}
}
@@ -639,25 +655,29 @@
m_rxing = false;
m_firstPower = 0.0;
}
+
InterferenceHelper::NiChanges::iterator
InterferenceHelper::GetPosition (Time moment)
{
return std::upper_bound (m_niChanges.begin (), m_niChanges.end (), NiChange (moment, 0));
+}
-}
void
InterferenceHelper::AddNiChangeEvent (NiChange change)
{
m_niChanges.insert (GetPosition (change.GetTime ()), change);
}
+
void
InterferenceHelper::NotifyRxStart ()
{
m_rxing = true;
}
+
void
InterferenceHelper::NotifyRxEnd ()
{
m_rxing = false;
}
-} // namespace ns3
+
+} //namespace ns3
--- a/src/wifi/model/interference-helper.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/interference-helper.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef INTERFERENCE_HELPER_H
#define INTERFERENCE_HELPER_H
@@ -111,6 +112,7 @@
*/
enum WifiPreamble GetPreambleType (void) const;
+
private:
uint32_t m_size;
WifiTxVector m_txVector;
@@ -119,6 +121,7 @@
Time m_endTime;
double m_rxPowerW;
};
+
/**
* A struct for both SNR and PER
*/
@@ -157,9 +160,9 @@
*/
Ptr<ErrorRateModel> GetErrorRateModel (void) const;
-
/**
* \param energyW the minimum energy (W) requested
+ *
* \returns the expected amount of time the observed
* energy on the medium will be higher than
* the requested threshold.
@@ -173,7 +176,8 @@
* \param txvector TXVECTOR of the packet
* \param preamble Wi-Fi preamble for the packet
* \param duration the duration of the signal
- * \param rxPower receive power (w)
+ * \param rxPower receive power (W)
+ *
* \return InterferenceHelper::Event
*/
Ptr<InterferenceHelper::Event> Add (uint32_t size, WifiTxVector txvector,
@@ -185,6 +189,7 @@
* all SNIR changes in the snir vector.
*
* \param event the event corresponding to the first time the corresponding packet arrives
+ *
* \return struct of SNR and PER
*/
struct InterferenceHelper::SnrPer CalculatePlcpPayloadSnrPer (Ptr<InterferenceHelper::Event> event);
@@ -193,9 +198,11 @@
* all SNIR changes in the snir vector.
*
* \param event the event corresponding to the first time the corresponding packet arrives
+ *
* \return struct of SNR and PER
*/
struct InterferenceHelper::SnrPer CalculatePlcpHeaderSnrPer (Ptr<InterferenceHelper::Event> event);
+
/**
* Notify that RX has started.
*/
@@ -208,6 +215,8 @@
* Erase all events.
*/
void EraseEvents (void);
+
+
private:
/**
* Noise and Interference (thus Ni) event.
@@ -241,6 +250,8 @@
* \return true if a < o.time, false otherwise
*/
bool operator < (const NiChange& o) const;
+
+
private:
Time m_time;
double m_delta;
@@ -254,8 +265,6 @@
*/
typedef std::list<Ptr<Event> > Events;
- //InterferenceHelper (const InterferenceHelper &o);
- //InterferenceHelper &operator = (const InterferenceHelper &o);
/**
* Append the given Event.
*
@@ -267,6 +276,7 @@
*
* \param event
* \param ni
+ *
* \return noise and interference power
*/
double CalculateNoiseInterferenceW (Ptr<Event> event, NiChanges *ni) const;
@@ -277,6 +287,7 @@
* \param signal
* \param noiseInterference
* \param mode
+ *
* \return SNR in liear ratio
*/
double CalculateSnr (double signal, double noiseInterference, WifiMode mode) const;
@@ -287,6 +298,7 @@
* \param snir SINR
* \param duration
* \param mode
+ *
* \return the success rate
*/
double CalculateChunkSuccessRate (double snir, Time duration, WifiMode mode) const;
@@ -296,6 +308,7 @@
*
* \param event
* \param ni
+ *
* \return the error rate of the packet
*/
double CalculatePlcpPayloadPer (Ptr<const Event> event, NiChanges *ni) const;
@@ -305,6 +318,7 @@
*
* \param event
* \param ni
+ *
* \return the error rate of the packet
*/
double CalculatePlcpHeaderPer (Ptr<const Event> event, NiChanges *ni) const;
@@ -325,6 +339,6 @@
void AddNiChangeEvent (NiChange change);
};
-} // namespace ns3
+} //namespace ns3
#endif /* INTERFERENCE_HELPER_H */
--- a/src/wifi/model/mac-low.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/mac-low.cc Sun Jun 21 00:23:45 2015 +0200
@@ -77,38 +77,38 @@
void MacLowAggregationCapableTransmissionListener::SetAmpdu (bool ampdu)
{
}
-void MacLowAggregationCapableTransmissionListener::CompleteTransfer(Mac48Address address, uint8_t tid)
+void MacLowAggregationCapableTransmissionListener::CompleteTransfer (Mac48Address address, uint8_t tid)
{
}
void
MacLowAggregationCapableTransmissionListener::CompleteMpduTx (Ptr<const Packet> packet, WifiMacHeader hdr, Time tstamp)
{
}
-uint16_t
+uint16_t
MacLowAggregationCapableTransmissionListener::GetNextSequenceNumberfor (WifiMacHeader *hdr)
{
- return 0;
+ return 0;
}
-uint16_t
+uint16_t
MacLowAggregationCapableTransmissionListener::PeekNextSequenceNumberfor (WifiMacHeader *hdr)
{
- return 0;
+ return 0;
}
-Ptr<const Packet>
+Ptr<const Packet>
MacLowAggregationCapableTransmissionListener::PeekNextPacketInBaQueue (WifiMacHeader &header, Mac48Address recipient, uint8_t tid, Time *timestamp)
{
- return 0;
+ return 0;
}
-void
+void
MacLowAggregationCapableTransmissionListener::RemoveFromBaQueue (uint8_t tid, Mac48Address recipient, uint16_t seqnumber)
{
}
-uint32_t
+uint32_t
MacLowAggregationCapableTransmissionListener::GetNOutstandingPackets (Mac48Address recipient, uint8_t tid)
{
return 0;
}
-uint32_t
+uint32_t
MacLowAggregationCapableTransmissionListener::GetNRetryNeededPackets (Mac48Address recipient, uint8_t tid) const
{
return 0;
@@ -267,10 +267,10 @@
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=";
+ << "send rts=" << params.m_sendRts << ", "
+ << "next size=" << params.m_nextSize << ", "
+ << "dur=" << params.m_overrideDurationId << ", "
+ << "ack=";
switch (params.m_waitAck)
{
case MacLowTransmissionParameters::ACK_NONE:
@@ -390,7 +390,7 @@
.SetParent<Object> ()
.SetGroupName ("Wifi")
.AddConstructor<MacLow> ()
- ;
+ ;
return tid;
}
@@ -427,13 +427,13 @@
m_sendDataEvent.Cancel ();
m_waitSifsEvent.Cancel ();
m_endTxNoAckEvent.Cancel ();
- m_waitRifsEvent.Cancel();
+ m_waitRifsEvent.Cancel ();
m_phy = 0;
m_stationManager = 0;
if (m_phyMacLowListener != 0)
{
- delete m_phyMacLowListener;
- m_phyMacLowListener = 0;
+ delete m_phyMacLowListener;
+ m_phyMacLowListener = 0;
}
m_mpduAggregator = 0;
m_sentMpdus = 0;
@@ -501,7 +501,7 @@
m_waitRifsEvent.Cancel ();
oneRunning = true;
}
- if (m_endTxNoAckEvent.IsRunning ())
+ if (m_endTxNoAckEvent.IsRunning ())
{
m_endTxNoAckEvent.Cancel ();
oneRunning = true;
@@ -706,14 +706,16 @@
WifiMacTrailer fcs;
size = packet->GetSize () + hdr.GetSize () + fcs.GetSerializedSize ();
Ptr<Packet> p = AggregateToAmpdu (packet, hdr);
- actualSize = p->GetSize();
+ actualSize = p->GetSize ();
if (actualSize > size)
{
m_currentPacket = p;
return true;
}
else
+ {
return false;
+ }
}
void
@@ -742,25 +744,27 @@
m_listener = listener;
m_txParams = params;
- if(m_aggregateQueue->GetSize () == 0)
- {
- m_currentPacket = packet->Copy ();
- m_ampdu = IsAmpdu (m_currentPacket, m_currentHdr);
- }
+ if (m_aggregateQueue->GetSize () == 0)
+ {
+ m_currentPacket = packet->Copy ();
+ m_ampdu = IsAmpdu (m_currentPacket, m_currentHdr);
+ }
else
- {
- /*m_aggregateQueue > 0 occurs when a RTS/CTS exchange failed before an A-MPDU transmission.
- *In that case, we transmit the same A-MPDU as previously.
- */
- m_sentMpdus = m_aggregateQueue->GetSize ();
- m_ampdu = true;
- }
+ {
+ /*m_aggregateQueue > 0 occurs when a RTS/CTS exchange failed before an A-MPDU transmission.
+ *In that case, we transmit the same A-MPDU as previously.
+ */
+ m_sentMpdus = m_aggregateQueue->GetSize ();
+ m_ampdu = true;
+ }
NS_LOG_DEBUG ("startTx size=" << GetSize (m_currentPacket, &m_currentHdr) <<
", to=" << m_currentHdr.GetAddr1 () << ", listener=" << m_listener);
if (m_ampdu)
+ {
m_txParams.EnableCompressedBlockAck ();
+ }
if (m_txParams.MustSendRts ())
{
@@ -768,14 +772,14 @@
}
else
{
- if (NeedCtsToSelf() && m_ctsToSelfSupported)
+ if (NeedCtsToSelf () && m_ctsToSelfSupported)
{
- SendCtsToSelf();
+ SendCtsToSelf ();
}
else
{
SendDataPacket ();
- }
+ }
}
/* When this method completes, we have taken ownership of the medium. */
@@ -795,16 +799,16 @@
NS_LOG_FUNCTION (this << packet << rxSnr);
NS_LOG_DEBUG ("rx failed ");
AmpduTag ampdu;
- Ptr<Packet> pkt = packet->Copy();
- bool isInAmpdu = pkt->RemovePacketTag(ampdu);
+ Ptr<Packet> pkt = packet->Copy ();
+ bool isInAmpdu = pkt->RemovePacketTag (ampdu);
- if(isInAmpdu && m_receivedAtLeastOneMpdu && (ampdu.GetNoOfMpdus() == 1))
+ if (isInAmpdu && m_receivedAtLeastOneMpdu && (ampdu.GetNoOfMpdus () == 1))
{
MpduAggregator::DeaggregatedMpdus packets = MpduAggregator::Deaggregate (pkt);
MpduAggregator::DeaggregatedMpdusCI n = packets.begin ();
WifiMacHeader hdr;
- (*n).first->PeekHeader(hdr);
- if(hdr.IsQosData())
+ (*n).first->PeekHeader (hdr);
+ if (hdr.IsQosData ())
{
NS_LOG_DEBUG ("last a-mpdu subframe detected/sendImmediateBlockAck from=" << hdr.GetAddr2 ());
m_sendAckEvent = Simulator::Schedule (GetSifs (),
@@ -814,10 +818,10 @@
hdr.GetDuration (),
m_currentTxVector);
}
- else if (hdr.IsBlockAckReq())
+ else if (hdr.IsBlockAckReq ())
{
- NS_LOG_DEBUG("last a-mpdu subframe is BAR");
- }
+ NS_LOG_DEBUG ("last a-mpdu subframe is BAR");
+ }
m_receivedAtLeastOneMpdu = false;
}
else if (m_txParams.MustWaitFastAck ())
@@ -918,9 +922,9 @@
{
NS_FATAL_ERROR ("Received CTS as part of an A-MPDU");
}
-
+
NS_LOG_DEBUG ("receive cts from=" << m_currentHdr.GetAddr1 ());
-
+
SnrTag tag;
packet->RemovePacketTag (tag);
m_stationManager->ReportRxOk (m_currentHdr.GetAddr1 (), &m_currentHdr,
@@ -954,7 +958,7 @@
FlushAggregateQueue ();
bool gotAck = false;
-
+
if (m_txParams.MustWaitNormalAck ()
&& m_normalAckTimeoutEvent.IsRunning ())
{
@@ -1052,7 +1056,7 @@
Upon the receipt of a QoS data frame from the originator for which
the Block Ack agreement exists, the recipient shall buffer the MSDU
regardless of the value of the Ack Policy subfield within the
- QoS Control field of the QoS data frame. */;
+ QoS Control field of the QoS data frame. */
if (hdr.IsQosAck () && !ampduSubframe)
{
NS_LOG_DEBUG ("rx QoS unicast/sendAck from=" << hdr.GetAddr2 ());
@@ -1094,14 +1098,14 @@
}
else if (hdr.IsQosData () && hdr.IsQosNoAck ())
{
- if (ampduSubframe)
- {
- NS_LOG_DEBUG ("rx Ampdu with No Ack Policy from=" << hdr.GetAddr2 ());
- }
- else
- {
- NS_LOG_DEBUG ("rx unicast/noAck from=" << hdr.GetAddr2 ());
- }
+ if (ampduSubframe)
+ {
+ NS_LOG_DEBUG ("rx Ampdu with No Ack Policy from=" << hdr.GetAddr2 ());
+ }
+ else
+ {
+ NS_LOG_DEBUG ("rx unicast/noAck from=" << hdr.GetAddr2 ());
+ }
}
else if (hdr.IsData () || hdr.IsMgt ())
{
@@ -1167,20 +1171,22 @@
MacLow::GetTid (Ptr<const Packet> packet, const WifiMacHeader hdr) const
{
uint8_t tid = 0;
- if (hdr.IsQosData ())
- tid = hdr.GetQosTid ();
+ if (hdr.IsQosData ())
+ {
+ tid = hdr.GetQosTid ();
+ }
else if (hdr.IsBlockAckReq ())
{
CtrlBAckRequestHeader baReqHdr;
packet->PeekHeader (baReqHdr);
tid = baReqHdr.GetTidInfo ();
- }
+ }
else if (hdr.IsBlockAck ())
{
CtrlBAckResponseHeader baRespHdr;
packet->PeekHeader (baRespHdr);
tid = baRespHdr.GetTidInfo ();
- }
+ }
return tid;
}
@@ -1233,7 +1239,7 @@
MacLow::GetAckDuration (WifiTxVector ackTxVector) const
{
NS_ASSERT (ackTxVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT); // ACK should always use non-HT PPDU (HT PPDU cases not supported yet)
- return m_phy->CalculateTxDuration (GetAckSize (), ackTxVector, WIFI_PREAMBLE_LONG, m_phy->GetFrequency(), 0, 0);
+ return m_phy->CalculateTxDuration (GetAckSize (), ackTxVector, WIFI_PREAMBLE_LONG, m_phy->GetFrequency (), 0, 0);
}
Time
@@ -1245,9 +1251,13 @@
*/
WifiPreamble preamble;
if (blockAckReqTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && type == BASIC_BLOCK_ACK)
- preamble = WIFI_PREAMBLE_HT_MF;
+ {
+ preamble = WIFI_PREAMBLE_HT_MF;
+ }
else
- preamble = WIFI_PREAMBLE_LONG;
+ {
+ preamble = WIFI_PREAMBLE_LONG;
+ }
return m_phy->CalculateTxDuration (GetBlockAckSize (type), blockAckReqTxVector, preamble, m_phy->GetFrequency (), 0, 0);
}
@@ -1279,9 +1289,13 @@
uint32_t size;
WifiMacTrailer fcs;
if (m_ampdu)
- size = packet->GetSize ();
+ {
+ size = packet->GetSize ();
+ }
else
- size= packet->GetSize () + hdr->GetSize () + fcs.GetSerializedSize ();
+ {
+ size = packet->GetSize () + hdr->GetSize () + fcs.GetSerializedSize ();
+ }
return size;
}
@@ -1303,7 +1317,7 @@
{
Mac48Address to = hdr->GetAddr1 ();
WifiMacTrailer fcs;
- uint32_t size = packet->GetSize ()+ hdr->GetSize () + fcs.GetSerializedSize ();
+ uint32_t size = packet->GetSize () + hdr->GetSize () + fcs.GetSerializedSize ();
//size is not used in anything!! will not worry about aggregation
return m_stationManager->GetDataTxVector (to, hdr, packet, size);
}
@@ -1364,11 +1378,17 @@
}
WifiTxVector dataTxVector = GetDataTxVector (packet, hdr);
if (m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
- preamble = WIFI_PREAMBLE_HT_GF;
+ {
+ preamble = WIFI_PREAMBLE_HT_GF;
+ }
else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
- preamble = WIFI_PREAMBLE_HT_MF;
+ {
+ preamble = WIFI_PREAMBLE_HT_MF;
+ }
else
- preamble = WIFI_PREAMBLE_LONG;
+ {
+ preamble = WIFI_PREAMBLE_LONG;
+ }
uint32_t dataSize = GetSize (packet, hdr);
txTime += m_phy->CalculateTxDuration (dataSize, dataTxVector, preamble, m_phy->GetFrequency (), 0, 0);
if (params.MustWaitAck ())
@@ -1390,11 +1410,17 @@
WifiTxVector dataTxVector = GetDataTxVector (packet, hdr);
WifiPreamble preamble;
if (m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
- preamble = WIFI_PREAMBLE_HT_GF;
- else if (dataTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT)
- preamble = WIFI_PREAMBLE_HT_MF;
+ {
+ preamble = WIFI_PREAMBLE_HT_GF;
+ }
+ else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
+ {
+ preamble = WIFI_PREAMBLE_HT_MF;
+ }
else
- preamble = WIFI_PREAMBLE_LONG;
+ {
+ preamble = WIFI_PREAMBLE_LONG;
+ }
txTime += GetSifs ();
txTime += m_phy->CalculateTxDuration (params.GetNextPacketSize (), dataTxVector, preamble, m_phy->GetFrequency (), 0, 0);
}
@@ -1432,7 +1458,7 @@
*/
WifiMacHeader cts;
cts.SetType (WIFI_MAC_CTL_CTS);
- WifiTxVector txVector=GetRtsTxVector (packet, &hdr);
+ WifiTxVector txVector = GetRtsTxVector (packet, &hdr);
Time navCounterResetCtsMissedDelay =
m_phy->CalculateTxDuration (cts.GetSerializedSize (), txVector, preamble, m_phy->GetFrequency (), 0, 0) +
Time (2 * GetSifs ()) + Time (2 * GetSlotTime ());
@@ -1545,7 +1571,7 @@
AmpduTag ampdutag;
ampdutag.SetAmpdu (true);
Time delay = Seconds (0);
- for ( ; queueSize > 0; queueSize--)
+ for (; queueSize > 0; queueSize--)
{
dequeuedPacket = m_aggregateQueue->Dequeue (&newHdr);
newPacket = dequeuedPacket->Copy ();
@@ -1559,11 +1585,11 @@
}
m_mpduAggregator->AddHeaderAndPad (newPacket, last);
- ampdutag.SetNoOfMpdus(queueSize);
- newPacket->AddPacketTag(ampdutag);
+ ampdutag.SetNoOfMpdus (queueSize);
+ newPacket->AddPacketTag (ampdutag);
if (delay == Seconds (0))
{
- NS_LOG_DEBUG("Sending MPDU as part of A-MPDU");
+ NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU");
packetType = 1;
m_phy->SendPacket (newPacket, txVector, preamble, packetType);
}
@@ -1571,8 +1597,10 @@
{
Simulator::Schedule (delay, &MacLow::SendPacket, this, newPacket, txVector, preamble, packetType);
}
- if(queueSize > 1)
- delay = delay + m_phy->CalculateTxDuration (GetSize (newPacket, &newHdr), txVector, preamble, m_phy->GetFrequency (), packetType, 0);
+ if (queueSize > 1)
+ {
+ delay = delay + m_phy->CalculateTxDuration (GetSize (newPacket, &newHdr), txVector, preamble, m_phy->GetFrequency (), packetType, 0);
+ }
preamble = WIFI_PREAMBLE_NONE;
}
}
@@ -1581,8 +1609,8 @@
void
MacLow::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType)
{
- NS_LOG_DEBUG("Sending MPDU as part of A-MPDU");
- m_phy->SendPacket (packet, txVector, preamble, packetType);
+ NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU");
+ m_phy->SendPacket (packet, txVector, preamble, packetType);
}
void
@@ -1594,7 +1622,7 @@
/// we should restart a new cts timeout now until the expected
/// end of rx if there was a rx start before now.
m_stationManager->ReportRtsFailed (m_currentHdr.GetAddr1 (), &m_currentHdr);
- if(m_sentMpdus == 0)
+ if (m_sentMpdus == 0)
{
m_currentPacket = 0;
}
@@ -1651,7 +1679,7 @@
m_listener = 0;
m_sentMpdus = 0;
m_ampdu = false;
- FlushAggregateQueue();
+ FlushAggregateQueue ();
listener->MissedBlockAck ();
}
@@ -1693,9 +1721,13 @@
WifiPreamble preamble;
//standard says RTS packets can have GF format sec 9.6.0e.1 page 110 bullet b 2
if (m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
- preamble = WIFI_PREAMBLE_HT_GF;
+ {
+ preamble = WIFI_PREAMBLE_HT_GF;
+ }
else //Otherwise, RTS should always use non-HT PPDU (HT PPDU cases not supported yet)
- preamble = WIFI_PREAMBLE_LONG;
+ {
+ preamble = WIFI_PREAMBLE_LONG;
+ }
if (m_txParams.HasDurationId ())
{
@@ -1756,15 +1788,21 @@
MacLow::StartDataTxTimers (WifiTxVector dataTxVector)
{
WifiPreamble preamble;
-
+
//Since it is data then it can have format = GF
if (m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
- preamble = WIFI_PREAMBLE_HT_GF;
+ {
+ preamble = WIFI_PREAMBLE_HT_GF;
+ }
else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
- preamble = WIFI_PREAMBLE_HT_MF;
+ {
+ preamble = WIFI_PREAMBLE_HT_MF;
+ }
else
- preamble = WIFI_PREAMBLE_LONG;
-
+ {
+ preamble = WIFI_PREAMBLE_LONG;
+ }
+
Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), dataTxVector, preamble, m_phy->GetFrequency (), 0, 0);
if (m_txParams.MustWaitNormalAck ())
{
@@ -1804,23 +1842,23 @@
}
else if (m_txParams.HasNextPacket ())
{
- if (m_stationManager->HasHtSupported())
- {
+ if (m_stationManager->HasHtSupported ())
+ {
Time delay = txDuration + GetRifs ();
NS_ASSERT (m_waitRifsEvent.IsExpired ());
- m_waitRifsEvent = Simulator::Schedule (delay, &MacLow::WaitSifsAfterEndTx, this);
- }
- else
- {
+ m_waitRifsEvent = Simulator::Schedule (delay, &MacLow::WaitSifsAfterEndTx, this);
+ }
+ else
+ {
Time delay = txDuration + GetSifs ();
NS_ASSERT (m_waitSifsEvent.IsExpired ());
m_waitSifsEvent = Simulator::Schedule (delay, &MacLow::WaitSifsAfterEndTx, this);
- }
+ }
}
else
{
// since we do not expect any timer to be triggered.
- Simulator::Schedule(txDuration, &MacLow::EndTxNoAck, this);
+ Simulator::Schedule (txDuration, &MacLow::EndTxNoAck, this);
}
}
@@ -1831,15 +1869,21 @@
/* send this packet directly. No RTS is needed. */
WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr);
WifiPreamble preamble;
-
+
if (m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
- //In the future has to make sure that receiver has greenfield enabled
- preamble = WIFI_PREAMBLE_HT_GF;
+ {
+ //In the future has to make sure that receiver has greenfield enabled
+ preamble = WIFI_PREAMBLE_HT_GF;
+ }
else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
- preamble = WIFI_PREAMBLE_HT_MF;
+ {
+ preamble = WIFI_PREAMBLE_HT_MF;
+ }
else
- preamble = WIFI_PREAMBLE_LONG;
-
+ {
+ preamble = WIFI_PREAMBLE_LONG;
+ }
+
StartDataTxTimers (dataTxVector);
Time duration = Seconds (0.0);
@@ -1914,15 +1958,19 @@
cts.SetNoMoreFragments ();
cts.SetNoRetry ();
cts.SetAddr1 (m_self);
-
+
WifiTxVector ctsTxVector = GetCtsToSelfTxVector (m_currentPacket, &m_currentHdr);
WifiPreamble preamble;
if (ctsTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
- preamble = WIFI_PREAMBLE_HT_MF;
+ {
+ preamble = WIFI_PREAMBLE_HT_MF;
+ }
else
- preamble = WIFI_PREAMBLE_LONG;
-
+ {
+ preamble = WIFI_PREAMBLE_LONG;
+ }
+
Time duration = Seconds (0);
if (m_txParams.HasDurationId ())
@@ -1937,7 +1985,7 @@
dataTxVector, preamble, m_phy->GetFrequency (), 0, 0);
if (m_txParams.MustWaitBasicBlockAck ())
{
-
+
duration += GetSifs ();
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode ());
duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK);
@@ -1984,7 +2032,7 @@
Time txDuration = m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, preamble, m_phy->GetFrequency (), 0, 0);
txDuration += GetSifs ();
NS_ASSERT (m_sendDataEvent.IsExpired ());
-
+
m_sendDataEvent = Simulator::Schedule (txDuration,
&MacLow::SendDataAfterCts, this,
cts.GetAddr1 (),
@@ -2033,29 +2081,35 @@
*/
NS_ASSERT (m_currentPacket != 0);
WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr);
-
+
if (m_aggregateQueue->GetSize () != 0)
- {
- for (std::vector<Item>::size_type i = 0; i != m_txPackets.size(); i++)
{
- uint8_t tid = GetTid (m_txPackets.at(i).packet, m_txPackets.at(i).hdr);
- AcIndex ac = QosUtilsMapTidToAc (tid);
- std::map<AcIndex, MacLowAggregationCapableTransmissionListener*>::const_iterator listenerIt = m_edcaListeners.find (ac);
-
- listenerIt->second->CompleteMpduTx (m_txPackets.at(i).packet, m_txPackets.at(i).hdr, m_txPackets.at(i).timestamp);
+ for (std::vector<Item>::size_type i = 0; i != m_txPackets.size (); i++)
+ {
+ uint8_t tid = GetTid (m_txPackets.at (i).packet, m_txPackets.at (i).hdr);
+ AcIndex ac = QosUtilsMapTidToAc (tid);
+ std::map<AcIndex, MacLowAggregationCapableTransmissionListener*>::const_iterator listenerIt = m_edcaListeners.find (ac);
+
+ listenerIt->second->CompleteMpduTx (m_txPackets.at (i).packet, m_txPackets.at (i).hdr, m_txPackets.at (i).timestamp);
+ }
+ m_txPackets.clear ();
}
- m_txPackets.clear ();
- }
-
- WifiPreamble preamble;
+
+ WifiPreamble preamble;
if (m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
- //In the future has to make sure that receiver has greenfield enabled
- preamble = WIFI_PREAMBLE_HT_GF;
+ {
+ //In the future has to make sure that receiver has greenfield enabled
+ preamble = WIFI_PREAMBLE_HT_GF;
+ }
else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
- preamble = WIFI_PREAMBLE_HT_MF;
+ {
+ preamble = WIFI_PREAMBLE_HT_MF;
+ }
else
- preamble = WIFI_PREAMBLE_LONG;
-
+ {
+ preamble = WIFI_PREAMBLE_LONG;
+ }
+
StartDataTxTimers (dataTxVector);
Time newDuration = Seconds (0);
if (m_txParams.MustWaitBasicBlockAck ())
@@ -2081,14 +2135,14 @@
newDuration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), dataTxVector, preamble, m_phy->GetFrequency (), 0, 0);
if (m_txParams.MustWaitCompressedBlockAck ())
{
- newDuration += GetSifs ();
- WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode ());
- newDuration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
+ newDuration += GetSifs ();
+ WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), dataTxVector.GetMode ());
+ newDuration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
}
else if (m_txParams.MustWaitAck ())
{
- newDuration += GetSifs ();
- newDuration += GetAckDuration (m_currentHdr.GetAddr1 (), dataTxVector);
+ newDuration += GetSifs ();
+ newDuration += GetAckDuration (m_currentHdr.GetAddr1 (), dataTxVector);
}
}
@@ -2101,11 +2155,11 @@
m_currentHdr.SetDuration (duration);
if (!m_ampdu)
- {
- m_currentPacket->AddHeader (m_currentHdr);
- WifiMacTrailer fcs;
- m_currentPacket->AddTrailer (fcs);
- }
+ {
+ m_currentPacket->AddHeader (m_currentHdr);
+ WifiMacTrailer fcs;
+ m_currentPacket->AddTrailer (fcs);
+ }
ForwardDown (m_currentPacket, &m_currentHdr, dataTxVector, preamble);
m_currentPacket = 0;
@@ -2117,7 +2171,7 @@
m_listener->StartNext ();
}
-void
+void
MacLow::EndTxNoAck (void)
{
MacLowTransmissionListener *listener = m_listener;
@@ -2174,45 +2228,49 @@
return ((seq - winstart + 4096) % 4096) < winsize;
}
-bool
+bool
MacLow::ReceiveMpdu (Ptr<Packet> packet, WifiMacHeader hdr)
- {
+{
if (m_stationManager->HasHtSupported ())
{
Mac48Address originator = hdr.GetAddr2 ();
uint8_t tid = 0;
if (hdr.IsQosData ())
- tid = hdr.GetQosTid ();
+ {
+ tid = hdr.GetQosTid ();
+ }
uint16_t seqNumber = hdr.GetSequenceNumber ();
AgreementsI it = m_bAckAgreements.find (std::make_pair (originator, tid));
if (it != m_bAckAgreements.end ())
{
//Implement HT immediate Block Ack support for HT Delayed Block Ack is not added yet
if (!QosUtilsIsOldPacket ((*it).second.first.GetStartingSequence (), seqNumber))
- {
+ {
StoreMpduIfNeeded (packet, hdr);
- if (!IsInWindow(hdr.GetSequenceNumber (), (*it).second.first.GetStartingSequence (), (*it).second.first.GetBufferSize ()))
+ if (!IsInWindow (hdr.GetSequenceNumber (), (*it).second.first.GetStartingSequence (), (*it).second.first.GetBufferSize ()))
{
- uint16_t delta = (seqNumber - (*it).second.first.GetWinEnd() + 4096) % 4096;
+ uint16_t delta = (seqNumber - (*it).second.first.GetWinEnd () + 4096) % 4096;
if (delta > 1)
{
- (*it).second.first.SetWinEnd (seqNumber);
- int16_t winEnd = (*it).second.first.GetWinEnd ();
- int16_t bufferSize = (*it).second.first.GetBufferSize ();
- uint16_t sum = ((uint16_t)(std::abs(winEnd - bufferSize + 1))) % 4096;
- (*it).second.first.SetStartingSequence (sum);
- RxCompleteBufferedPacketsWithSmallerSequence ((*it).second.first.GetStartingSequence (), originator, tid);
- }
- }
+ (*it).second.first.SetWinEnd (seqNumber);
+ int16_t winEnd = (*it).second.first.GetWinEnd ();
+ int16_t bufferSize = (*it).second.first.GetBufferSize ();
+ uint16_t sum = ((uint16_t)(std::abs (winEnd - bufferSize + 1))) % 4096;
+ (*it).second.first.SetStartingSequence (sum);
+ RxCompleteBufferedPacketsWithSmallerSequence ((*it).second.first.GetStartingSequence (), originator, tid);
+ }
+ }
RxCompleteBufferedPacketsUntilFirstLost (originator, tid); //forwards up packets starting from winstart and set winstart to last +1
- (*it).second.first.SetWinEnd (((*it).second.first.GetStartingSequence()+(*it).second.first.GetBufferSize() - 1) % 4096);
- }
+ (*it).second.first.SetWinEnd (((*it).second.first.GetStartingSequence () + (*it).second.first.GetBufferSize () - 1) % 4096);
+ }
return true;
- }
+ }
return false;
}
- else
- return StoreMpduIfNeeded (packet, hdr);
+ else
+ {
+ return StoreMpduIfNeeded (packet, hdr);
+ }
}
bool
@@ -2232,7 +2290,6 @@
for (; i != (*it).second.second.end ()
&& QosUtilsMapSeqControlToUniqueInteger ((*i).second.GetSequenceControl (), endSequence) < mappedSeqControl; i++)
{
- ;
}
(*it).second.second.insert (i, bufferedPacket);
@@ -2456,14 +2513,18 @@
packet->AddTrailer (fcs);
WifiPreamble preamble;
if (blockAckReqTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
- preamble = WIFI_PREAMBLE_HT_MF;
+ {
+ preamble = WIFI_PREAMBLE_HT_MF;
+ }
else
- preamble = WIFI_PREAMBLE_LONG;
+ {
+ preamble = WIFI_PREAMBLE_LONG;
+ }
ForwardDown (packet, &hdr, blockAckReqTxVector, preamble);
m_currentPacket = 0;
}
-void
+void
MacLow::SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator, Time duration, WifiTxVector blockAckReqTxVector)
{
NS_LOG_FUNCTION (this);
@@ -2480,7 +2541,7 @@
immediate = (*it).second.first.IsImmediateBlockAck ();
blockAck.SetType (COMPRESSED_BLOCK_ACK);
NS_LOG_DEBUG ("Got Implicit block Ack Req with seq " << seqNumber);
- (*i).second.FillBlockAckBitmap (&blockAck);
+ (*i).second.FillBlockAckBitmap (&blockAck);
SendBlockAckResponse (&blockAck, originator, immediate, duration, blockAckReqTxVector.GetMode ());
}
@@ -2515,7 +2576,7 @@
(*i).second.FillBlockAckBitmap (&blockAck);
NS_LOG_DEBUG ("Got block Ack Req with seq " << reqHdr.GetStartingSequence ());
- if (!m_stationManager->HasHtSupported())
+ if (!m_stationManager->HasHtSupported ())
{
/* All packets with smaller sequence than starting sequence control must be passed up to Wifimac
* See 9.10.3 in IEEE 802.11e standard.
@@ -2525,13 +2586,13 @@
}
else
{
- if (!QosUtilsIsOldPacket ((*it).second.first.GetStartingSequence(), reqHdr.GetStartingSequence ()))
- {
+ if (!QosUtilsIsOldPacket ((*it).second.first.GetStartingSequence (), reqHdr.GetStartingSequence ()))
+ {
(*it).second.first.SetStartingSequence (reqHdr.GetStartingSequence ());
- (*it).second.first.SetWinEnd (((*it).second.first.GetStartingSequence()+(*it).second.first.GetBufferSize() - 1) % 4096);
+ (*it).second.first.SetWinEnd (((*it).second.first.GetStartingSequence () + (*it).second.first.GetBufferSize () - 1) % 4096);
RxCompleteBufferedPacketsWithSmallerSequence (reqHdr.GetStartingSequence (), originator, tid);
RxCompleteBufferedPacketsUntilFirstLost (originator, tid);
- (*it).second.first.SetWinEnd (((*it).second.first.GetStartingSequence()+(*it).second.first.GetBufferSize() - 1) % 4096);
+ (*it).second.first.SetWinEnd (((*it).second.first.GetStartingSequence () + (*it).second.first.GetBufferSize () - 1) % 4096);
}
}
}
@@ -2584,7 +2645,7 @@
AmpduTag ampdu;
bool normalAck = false;
bool ampduSubframe = false;
- if (aggregatedPacket->RemovePacketTag(ampdu))
+ if (aggregatedPacket->RemovePacketTag (ampdu))
{
ampduSubframe = true;
MpduAggregator::DeaggregatedMpdus packets = MpduAggregator::Deaggregate (aggregatedPacket);
@@ -2594,12 +2655,14 @@
(*n).first->PeekHeader (firsthdr);
NS_LOG_DEBUG ("duration/id=" << firsthdr.GetDuration ());
NotifyNav ((*n).first, firsthdr, preamble);
-
+
if (firsthdr.GetAddr1 () == m_self)
{
m_receivedAtLeastOneMpdu = true;
if (firsthdr.IsAck () || firsthdr.IsBlockAck () || firsthdr.IsBlockAckReq ())
+ {
ReceiveOk ((*n).first, rxSnr, txVector, preamble, ampduSubframe);
+ }
else if (firsthdr.IsData () || firsthdr.IsQosData ())
{
NS_LOG_DEBUG ("Deaggregate packet with sequence=" << firsthdr.GetSequenceNumber ());
@@ -2609,13 +2672,15 @@
NS_LOG_DEBUG ("Normal Ack");
normalAck = true;
}
- }
+ }
else
+ {
NS_FATAL_ERROR ("Received A-MPDU with invalid first MPDU type");
+ }
}
if (normalAck && (ampdu.GetNoOfMpdus () == 1))
- {
+ {
//send block Ack
if (firsthdr.IsBlockAckReq ())
{
@@ -2624,7 +2689,7 @@
uint8_t tid = firsthdr.GetQosTid ();
AgreementsI it = m_bAckAgreements.find (std::make_pair (firsthdr.GetAddr2 (), tid));
if (it != m_bAckAgreements.end ())
- {
+ {
NS_ASSERT (m_sendAckEvent.IsExpired ());
/* See section 11.5.3 in IEEE 802.11 for mean of this timer */
ResetBlockAckInactivityTimerIfNeeded (it->second.first);
@@ -2635,43 +2700,55 @@
firsthdr.GetAddr2 (),
firsthdr.GetDuration (),
txVector);
- }
+ }
else
- {
+ {
NS_LOG_DEBUG ("There's not a valid agreement for this block ack request.");
}
m_receivedAtLeastOneMpdu = false;
}
}
else
- {
- ReceiveOk (aggregatedPacket, rxSnr, txVector, preamble, ampduSubframe);
+ {
+ ReceiveOk (aggregatedPacket, rxSnr, txVector, preamble, ampduSubframe);
}
}
-bool
-MacLow::StopMpduAggregation(Ptr<const Packet> peekedPacket, WifiMacHeader peekedHdr, Ptr<Packet> aggregatedPacket, uint16_t size) const
+bool
+MacLow::StopMpduAggregation (Ptr<const Packet> peekedPacket, WifiMacHeader peekedHdr, Ptr<Packet> aggregatedPacket, uint16_t size) const
{
- WifiPreamble preamble;
- WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr);
- if (m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
- preamble = WIFI_PREAMBLE_HT_GF;
- else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
- preamble = WIFI_PREAMBLE_HT_MF;
- else
- preamble = WIFI_PREAMBLE_LONG;
-
- if (peekedPacket == 0)
- return true;
-
- //An HT STA shall not transmit a PPDU that has a duration that is greater than aPPDUMaxTime (10 milliseconds)
- if(m_phy->CalculateTxDuration (aggregatedPacket->GetSize () + peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, dataTxVector, preamble, m_phy->GetFrequency (), 0, 0) > MilliSeconds(10))
- return true;
-
- if (!m_mpduAggregator->CanBeAggregated (peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, aggregatedPacket, size))
- return true;
-
- return false;
+ WifiPreamble preamble;
+ WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr);
+ if (m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ()))
+ {
+ preamble = WIFI_PREAMBLE_HT_GF;
+ }
+ else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
+ {
+ preamble = WIFI_PREAMBLE_HT_MF;
+ }
+ else
+ {
+ preamble = WIFI_PREAMBLE_LONG;
+ }
+
+ if (peekedPacket == 0)
+ {
+ return true;
+ }
+
+ //An HT STA shall not transmit a PPDU that has a duration that is greater than aPPDUMaxTime (10 milliseconds)
+ if (m_phy->CalculateTxDuration (aggregatedPacket->GetSize () + peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, dataTxVector, preamble, m_phy->GetFrequency (), 0, 0) > MilliSeconds (10))
+ {
+ return true;
+ }
+
+ if (!m_mpduAggregator->CanBeAggregated (peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, aggregatedPacket, size))
+ {
+ return true;
+ }
+
+ return false;
}
Ptr<Packet>
@@ -2681,23 +2758,23 @@
bool isAmpdu = false;
Ptr<Packet> newPacket, tempPacket;
WifiMacHeader peekedHdr;
- newPacket = packet->Copy();
+ newPacket = packet->Copy ();
//missing hdr.IsAck() since we have no means of knowing the Tid of the Ack yet
- if (hdr.IsQosData() || hdr.IsBlockAck()|| hdr.IsBlockAckReq())
+ if (hdr.IsQosData () || hdr.IsBlockAck ()|| hdr.IsBlockAckReq ())
{
Time tstamp;
uint8_t tid = GetTid (packet, hdr);
Ptr<WifiMacQueue> queue;
AcIndex ac = QosUtilsMapTidToAc (tid);
//since a blockack agreement always preceeds mpdu aggregation there should always exist blockAck listener
- std::map<AcIndex, MacLowAggregationCapableTransmissionListener*>::const_iterator listenerIt= m_edcaListeners.find(ac);
+ std::map<AcIndex, MacLowAggregationCapableTransmissionListener*>::const_iterator listenerIt = m_edcaListeners.find (ac);
NS_ASSERT (listenerIt != m_edcaListeners.end ());
- queue = listenerIt->second->GetQueue();
-
- if (!hdr.GetAddr1 ().IsBroadcast () && m_mpduAggregator!= 0)
+ queue = listenerIt->second->GetQueue ();
+
+ if (!hdr.GetAddr1 ().IsBroadcast () && m_mpduAggregator != 0)
{
//Have to make sure that their exist a block Ack agreement before sending an AMPDU (BlockAck Manager)
- if (listenerIt->second->GetBlockAckAgreementExists (hdr.GetAddr1(), tid))
+ if (listenerIt->second->GetBlockAckAgreementExists (hdr.GetAddr1 (), tid))
{
/* here is performed mpdu aggregation */
/* MSDU aggregation happened in edca if the user asked for it so m_currentPacket may contains a normal packet or a A-MSDU*/
@@ -2711,31 +2788,31 @@
int i = 0;
Ptr<Packet> aggPacket = newPacket->Copy ();
- if (!hdr.IsBlockAckReq())
+ if (!hdr.IsBlockAckReq ())
{
- if (!hdr.IsBlockAck())
+ if (!hdr.IsBlockAck ())
{
- startingSequenceNumber = peekedHdr.GetSequenceNumber();
- peekedHdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
+ startingSequenceNumber = peekedHdr.GetSequenceNumber ();
+ peekedHdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
}
- currentSequenceNumber = peekedHdr.GetSequenceNumber();
+ currentSequenceNumber = peekedHdr.GetSequenceNumber ();
newPacket->AddHeader (peekedHdr);
WifiMacTrailer fcs;
newPacket->AddTrailer (fcs);
- aggregated=m_mpduAggregator->Aggregate (newPacket, currentAggregatedPacket);
+ aggregated = m_mpduAggregator->Aggregate (newPacket, currentAggregatedPacket);
if (aggregated)
{
- NS_LOG_DEBUG ("Adding packet with Sequence number " << peekedHdr.GetSequenceNumber()<<" to A-MPDU, packet size = " << newPacket->GetSize ()<< ", A-MPDU size = " << currentAggregatedPacket->GetSize ());
+ NS_LOG_DEBUG ("Adding packet with Sequence number " << peekedHdr.GetSequenceNumber () << " to A-MPDU, packet size = " << newPacket->GetSize () << ", A-MPDU size = " << currentAggregatedPacket->GetSize ());
i++;
m_sentMpdus++;
m_aggregateQueue->Enqueue (aggPacket, peekedHdr);
}
- }
- else if (hdr.IsBlockAckReq())
+ }
+ else if (hdr.IsBlockAckReq ())
{
- blockAckSize = packet->GetSize() + hdr.GetSize() + WIFI_MAC_FCS_LENGTH;
+ blockAckSize = packet->GetSize () + hdr.GetSize () + WIFI_MAC_FCS_LENGTH;
qosPolicy = 3; //if the last subrame is block ack req then set ack policy of all frames to blockack
CtrlBAckRequestHeader blockAckReq;
packet->PeekHeader (blockAckReq);
@@ -2751,22 +2828,24 @@
WifiMacHeader::ADDR1,
hdr.GetAddr1 (), &tstamp);
currentSequenceNumber = listenerIt->second->PeekNextSequenceNumberfor (&peekedHdr);
-
+
/* here is performed MSDU aggregation (two-level aggregation) */
if (peekedPacket != 0 && listenerIt->second->GetMsduAggregator () != 0)
{
- tempPacket = PerformMsduAggregation(peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, blockAckSize);
- if (tempPacket != 0) //MSDU aggregation
- peekedPacket = tempPacket->Copy();
+ tempPacket = PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, blockAckSize);
+ if (tempPacket != 0) //MSDU aggregation
+ {
+ peekedPacket = tempPacket->Copy ();
+ }
}
}
else
{
retry = true;
- currentSequenceNumber = peekedHdr.GetSequenceNumber();
+ currentSequenceNumber = peekedHdr.GetSequenceNumber ();
}
- while (IsInWindow (currentSequenceNumber, startingSequenceNumber, 64) && !StopMpduAggregation (peekedPacket, peekedHdr, currentAggregatedPacket, blockAckSize))
+ while (IsInWindow (currentSequenceNumber, startingSequenceNumber, 64) && !StopMpduAggregation (peekedPacket, peekedHdr, currentAggregatedPacket, blockAckSize))
{
//for now always send AMPDU with normal ACK
if (retry == false)
@@ -2776,15 +2855,19 @@
peekedHdr.SetFragmentNumber (0);
peekedHdr.SetNoMoreFragments ();
peekedHdr.SetNoRetry ();
- }
+ }
if (qosPolicy == 0)
+ {
peekedHdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
+ }
else
+ {
peekedHdr.SetQosAckPolicy (WifiMacHeader::BLOCK_ACK);
+ }
newPacket = peekedPacket->Copy ();
Ptr<Packet> aggPacket = newPacket->Copy ();
-
+
newPacket->AddHeader (peekedHdr);
WifiMacTrailer fcs;
newPacket->AddTrailer (fcs);
@@ -2793,39 +2876,45 @@
{
m_aggregateQueue->Enqueue (aggPacket, peekedHdr);
if (i == 1 && hdr.IsQosData ())
- {
- if (!m_txParams.MustSendRts ())
{
- listenerIt->second->CompleteMpduTx (packet, hdr, tstamp);
+ if (!m_txParams.MustSendRts ())
+ {
+ listenerIt->second->CompleteMpduTx (packet, hdr, tstamp);
+ }
+ else
+ {
+ InsertInTxQueue (packet, hdr, tstamp);
+ }
}
- else
- {
- InsertInTxQueue (packet, hdr, tstamp);
- }
- }
- NS_LOG_DEBUG ("Adding packet with Sequence number " << peekedHdr.GetSequenceNumber () <<" to A-MPDU, packet size = " << newPacket->GetSize ()<< ", A-MPDU size = " << currentAggregatedPacket->GetSize ());
+ NS_LOG_DEBUG ("Adding packet with Sequence number " << peekedHdr.GetSequenceNumber () << " to A-MPDU, packet size = " << newPacket->GetSize () << ", A-MPDU size = " << currentAggregatedPacket->GetSize ());
i++;
isAmpdu = true;
m_sentMpdus++;
if (!m_txParams.MustSendRts ())
- {
- listenerIt->second->CompleteMpduTx (peekedPacket, peekedHdr, tstamp);
- }
+ {
+ listenerIt->second->CompleteMpduTx (peekedPacket, peekedHdr, tstamp);
+ }
else
- {
- InsertInTxQueue (peekedPacket, peekedHdr, tstamp);
- }
+ {
+ InsertInTxQueue (peekedPacket, peekedHdr, tstamp);
+ }
if (retry)
+ {
listenerIt->second->RemoveFromBaQueue (tid, hdr.GetAddr1 (), peekedHdr.GetSequenceNumber ());
+ }
else
+ {
queue->Remove (peekedPacket);
+ }
newPacket = 0;
}
else
+ {
break;
+ }
if (retry == true)
{
- peekedPacket = listenerIt->second->PeekNextPacketInBaQueue(peekedHdr, hdr.GetAddr1(), tid, &tstamp);
+ peekedPacket = listenerIt->second->PeekNextPacketInBaQueue (peekedHdr, hdr.GetAddr1 (), tid, &tstamp);
if (peekedPacket == 0)
{
//I reached the first packet that I added to this A-MPDU
@@ -2836,17 +2925,21 @@
{
//find what will the sequence number be so that we don't send more than 64 packets apart
currentSequenceNumber = listenerIt->second->PeekNextSequenceNumberfor (&peekedHdr);
-
+
if (listenerIt->second->GetMsduAggregator () != 0)
- {
- tempPacket = PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, blockAckSize);
- if (tempPacket != 0) //MSDU aggregation
- peekedPacket = tempPacket->Copy();
- }
- }
+ {
+ tempPacket = PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, blockAckSize);
+ if (tempPacket != 0) //MSDU aggregation
+ {
+ peekedPacket = tempPacket->Copy ();
+ }
+ }
+ }
}
else
- currentSequenceNumber = peekedHdr.GetSequenceNumber();
+ {
+ currentSequenceNumber = peekedHdr.GetSequenceNumber ();
+ }
}
else
{
@@ -2856,42 +2949,44 @@
{
//find what will the sequence number be so that we don't send more than 64 packets apart
currentSequenceNumber = listenerIt->second->PeekNextSequenceNumberfor (&peekedHdr);
-
+
if (listenerIt->second->GetMsduAggregator () != 0 && IsInWindow (currentSequenceNumber, startingSequenceNumber, 64))
- {
- tempPacket = PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, blockAckSize);
- if (tempPacket != 0) //MSDU aggregation
- peekedPacket = tempPacket->Copy();
- }
- }
+ {
+ tempPacket = PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, blockAckSize);
+ if (tempPacket != 0) //MSDU aggregation
+ {
+ peekedPacket = tempPacket->Copy ();
+ }
+ }
+ }
}
}
if (isAmpdu)
{
- if (hdr.IsBlockAckReq())
+ if (hdr.IsBlockAckReq ())
{
- newPacket = packet->Copy();
+ newPacket = packet->Copy ();
peekedHdr = hdr;
- Ptr<Packet> aggPacket = newPacket->Copy();
+ Ptr<Packet> aggPacket = newPacket->Copy ();
m_aggregateQueue->Enqueue (aggPacket, peekedHdr);
newPacket->AddHeader (peekedHdr);
WifiMacTrailer fcs;
newPacket->AddTrailer (fcs);
m_mpduAggregator->Aggregate (newPacket, currentAggregatedPacket);
}
- if (qosPolicy==0)
+ if (qosPolicy == 0)
{
- listenerIt->second->CompleteTransfer (hdr.GetAddr1 (), tid);
+ listenerIt->second->CompleteTransfer (hdr.GetAddr1 (), tid);
}
//Add packet tag
AmpduTag ampdutag;
ampdutag.SetAmpdu (true);
- ampdutag.SetNoOfMpdus(i);
+ ampdutag.SetNoOfMpdus (i);
newPacket = currentAggregatedPacket;
- newPacket->AddPacketTag(ampdutag);
+ newPacket->AddPacketTag (ampdutag);
currentAggregatedPacket = 0;
NS_LOG_DEBUG ("tx unicast A-MPDU");
- listenerIt->second->SetAmpdu(true);
+ listenerIt->second->SetAmpdu (true);
}
else
{
@@ -2913,10 +3008,10 @@
MacLow::FlushAggregateQueue (void)
{
if (m_aggregateQueue->GetSize () > 0)
- {
- NS_LOG_DEBUG("Flush aggregate queue");
- m_aggregateQueue->Flush ();
- }
+ {
+ NS_LOG_DEBUG ("Flush aggregate queue");
+ m_aggregateQueue->Flush ();
+ }
m_txPackets.clear ();
}
@@ -2924,7 +3019,7 @@
MacLow::InsertInTxQueue (Ptr<const Packet> packet, const WifiMacHeader &hdr, Time tStamp)
{
Item item;
-
+
item.packet = packet;
item.hdr = hdr;
item.timestamp = tStamp;
@@ -2933,7 +3028,7 @@
}
Ptr<Packet>
-MacLow::PerformMsduAggregation(Ptr<const Packet> packet, WifiMacHeader *hdr, Time *tstamp, Ptr<Packet> currentAmpduPacket, uint16_t blockAckSize)
+MacLow::PerformMsduAggregation (Ptr<const Packet> packet, WifiMacHeader *hdr, Time *tstamp, Ptr<Packet> currentAmpduPacket, uint16_t blockAckSize)
{
bool msduAggregation = false;
bool isAmsdu = false;
@@ -2944,46 +3039,46 @@
AcIndex ac = QosUtilsMapTidToAc (GetTid (packet, *hdr));
std::map<AcIndex, MacLowAggregationCapableTransmissionListener*>::const_iterator listenerIt = m_edcaListeners.find (ac);
NS_ASSERT (listenerIt != m_edcaListeners.end ());
- queue = listenerIt->second->GetQueue();
-
+ queue = listenerIt->second->GetQueue ();
+
listenerIt->second->GetMsduAggregator ()->Aggregate (packet, currentAmsduPacket,
- listenerIt->second->GetSrcAddressForAggregation (*hdr),
- listenerIt->second->GetDestAddressForAggregation (*hdr));
+ listenerIt->second->GetSrcAddressForAggregation (*hdr),
+ listenerIt->second->GetDestAddressForAggregation (*hdr));
Ptr<const Packet> peekedPacket = queue->PeekByTidAndAddress (hdr, hdr->GetQosTid (),
WifiMacHeader::ADDR1, hdr->GetAddr1 (), tstamp);
while (peekedPacket != 0)
- {
- tempPacket = currentAmsduPacket;
-
- msduAggregation = listenerIt->second->GetMsduAggregator ()->Aggregate (peekedPacket, tempPacket,
- listenerIt->second->GetSrcAddressForAggregation (*hdr),
- listenerIt->second->GetDestAddressForAggregation (*hdr));
-
- if (msduAggregation && !StopMpduAggregation (tempPacket, *hdr, currentAmpduPacket, blockAckSize))
- {
- isAmsdu = true;
- currentAmsduPacket = tempPacket;
- queue->Remove (peekedPacket);
- }
- else
{
- break;
+ tempPacket = currentAmsduPacket;
+
+ msduAggregation = listenerIt->second->GetMsduAggregator ()->Aggregate (peekedPacket, tempPacket,
+ listenerIt->second->GetSrcAddressForAggregation (*hdr),
+ listenerIt->second->GetDestAddressForAggregation (*hdr));
+
+ if (msduAggregation && !StopMpduAggregation (tempPacket, *hdr, currentAmpduPacket, blockAckSize))
+ {
+ isAmsdu = true;
+ currentAmsduPacket = tempPacket;
+ queue->Remove (peekedPacket);
+ }
+ else
+ {
+ break;
+ }
+ peekedPacket = queue->PeekByTidAndAddress (hdr, hdr->GetQosTid (), WifiMacHeader::ADDR1, hdr->GetAddr1 (), tstamp);
}
- peekedPacket = queue->PeekByTidAndAddress (hdr, hdr->GetQosTid (), WifiMacHeader::ADDR1, hdr->GetAddr1 (), tstamp);
- }
-
+
if (isAmsdu)
- {
- NS_LOG_DEBUG ("A-MSDU with size = " << currentAmsduPacket->GetSize ());
- hdr->SetQosAmsdu ();
- hdr->SetAddr3 (GetBssid ());
- return currentAmsduPacket;
- }
+ {
+ NS_LOG_DEBUG ("A-MSDU with size = " << currentAmsduPacket->GetSize ());
+ hdr->SetQosAmsdu ();
+ hdr->SetAddr3 (GetBssid ());
+ return currentAmsduPacket;
+ }
else
- {
- return 0;
- }
+ {
+ return 0;
+ }
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/mac-low.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/mac-low.h Sun Jun 21 00:23:45 2015 +0200
@@ -130,10 +130,10 @@
* down the stack to the PHY.
*/
virtual void Cancel (void) = 0;
- /**
+ /**
* Invoked upon the end of the transmission of a frame that does not
* require an ACK (e.g., broadcast and multicast frames).
- *
+ *
*/
virtual void EndTxNoAck (void) = 0;
};
@@ -216,14 +216,14 @@
* \param address address of peer station involved in block ack mechanism.
* \param tid traffic ID of transmitted packet.
*
- * Calls CompleteAmpduTransfer that resets the status of OriginatorBlockAckAgreement after the transfer
+ * Calls CompleteAmpduTransfer that resets the status of OriginatorBlockAckAgreement after the transfer
* of an A-MPDU with ImmediateBlockAck policy (i.e. no BAR is scheduled)
*/
virtual void CompleteTransfer (Mac48Address address, uint8_t tid);
virtual void SetAmpdu (bool ampdu);
/**
- * This function stores an MPDU (part of an A-MPDU) in blockackagreement (i.e. the sender is waiting
- * for a blockack containing the sequence number of this MPDU).
+ * This function stores an MPDU (part of an A-MPDU) in blockackagreement (i.e. the sender is waiting
+ * for a blockack containing the sequence number of this MPDU).
* It also calls NotifyMpdu transmission that updates the status of OriginatorBlockAckAgreement.
*/
virtual void CompleteMpduTx (Ptr<const Packet> packet, WifiMacHeader hdr, Time tstamp);
@@ -241,7 +241,7 @@
* \return the next sequence number
*/
virtual uint16_t PeekNextSequenceNumberfor (WifiMacHeader *hdr);
- /*
+ /*
* Peek in retransmit queue and get the next packet without removing it from the queue
*/
virtual Ptr<const Packet> PeekNextPacketInBaQueue (WifiMacHeader &header, Mac48Address recipient, uint8_t tid, Time *timestamp);
@@ -452,7 +452,6 @@
uint32_t GetNextPacketSize (void) const;
private:
-
friend std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters ¶ms);
uint32_t m_nextSize;
enum
@@ -710,9 +709,9 @@
* of transmission events.
*/
virtual void StartTransmission (Ptr<const Packet> packet,
- const WifiMacHeader* hdr,
- MacLowTransmissionParameters parameters,
- MacLowTransmissionListener *listener);
+ const WifiMacHeader* hdr,
+ MacLowTransmissionParameters parameters,
+ MacLowTransmissionListener *listener);
/**
* \param packet packet received
@@ -788,7 +787,7 @@
* \return the A-MPDU packet if aggregation is successfull, the input packet otherwise
*
* This function adds the packets that will be added to an A-MPDU to an aggregate queue
- *
+ *
*/
Ptr<Packet> AggregateToAmpdu (Ptr<const Packet> packet, const WifiMacHeader hdr);
/**
@@ -798,7 +797,7 @@
* \param preamble type of preamble used for the packet received
*
* This function de-aggregates an A-MPDU and decide if each MPDU is received correctly or not
- *
+ *
*/
void DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, WifiTxVector txVector, WifiPreamble preamble);
/**
@@ -809,7 +808,7 @@
* \return false if the given packet can be added to an A-MPDU, true otherwise
*
* This function decides if a given packet can be added to an A-MPDU or not
- *
+ *
*/
bool StopMpduAggregation (Ptr<const Packet> peekedPacket, WifiMacHeader peekedHdr, Ptr<Packet> aggregatedPacket, uint16_t size) const;
/**
@@ -1013,7 +1012,7 @@
* false otherwise
*/
bool NeedCtsToSelf (void);
-
+
Time CalculateOverallTxTime (Ptr<const Packet> packet,
const WifiMacHeader* hdr,
const MacLowTransmissionParameters ¶ms) const;
@@ -1150,16 +1149,16 @@
* \param dataTxVector
*/
void StartDataTxTimers (WifiTxVector dataTxVector);
-
+
virtual void DoDispose (void);
-
+
/**
* \param packet packet to check
* \param hdr 802.11 header for packet to check
*
* Returns Tid of different packet types
*/
- uint8_t GetTid(Ptr<const Packet> packet, const WifiMacHeader hdr) const;
+ uint8_t GetTid (Ptr<const Packet> packet, const WifiMacHeader hdr) const;
/**
* \param originator Address of peer participating in Block Ack mechanism.
* \param tid TID for which Block Ack was created.
@@ -1218,7 +1217,7 @@
* block ack agreement and creates block ack bitmap on a received packets basis.
*/
void SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator,
- Time duration, WifiTxVector blockAckReqTxVector);
+ Time duration, WifiTxVector blockAckReqTxVector);
/**
* This method creates block ack frame with header equals to <i>blockAck</i> and start its transmission.
*
@@ -1276,13 +1275,13 @@
*
* \return the aggregate if MSDU aggregation succeeded, 0 otherwise
*/
- Ptr<Packet> PerformMsduAggregation(Ptr<const Packet> packet, WifiMacHeader *hdr, Time *tstamp, Ptr<Packet> currentAmpduPacket, uint16_t blockAckSize);
+ Ptr<Packet> PerformMsduAggregation (Ptr<const Packet> packet, WifiMacHeader *hdr, Time *tstamp, Ptr<Packet> currentAmpduPacket, uint16_t blockAckSize);
Ptr<WifiPhy> m_phy; //!< Pointer to WifiPhy (actually send/receives frames)
Ptr<WifiRemoteStationManager> m_stationManager; //!< Pointer to WifiRemoteStationManager (rate control)
MacLowRxCallback m_rxCallback; //!< Callback to pass packet up
-
+
/**
* A struct for packet, Wifi header, and timestamp.
*/
@@ -1370,6 +1369,6 @@
std::vector<Item> m_txPackets; //!< Contain temporary items to be sent with the next A-MPDU transmission, once RTS/CTS exchange has succeeded. It is not used in other cases.
};
-} // namespace ns3
+} //namespace ns3
#endif /* MAC_LOW_H */
--- a/src/wifi/model/mac-rx-middle.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/mac-rx-middle.cc Sun Jun 21 00:23:45 2015 +0200
@@ -20,7 +20,6 @@
#include "mac-rx-middle.h"
#include "wifi-mac-header.h"
-
#include "ns3/assert.h"
#include "ns3/log.h"
#include "ns3/packet.h"
@@ -51,6 +50,8 @@
bool m_defragmenting;
uint16_t m_lastSequenceControl;
Fragments m_fragments;
+
+
public:
OriginatorRxStatus ()
{
@@ -91,6 +92,7 @@
* and return the full packet.
*
* \param packet the last fragment
+ *
* \return the fully reconstructed packet
*/
Ptr<Packet> AccumulateLastFragment (Ptr<const Packet> packet)
@@ -122,6 +124,7 @@
* in order.
*
* \param sequenceControl the raw sequence control
+ *
* \return true if the sequence control is in order,
* false otherwise
*/
@@ -150,12 +153,11 @@
* Set the last sequence control we received.
*
* \param sequenceControl the last sequence control we received
- */
+ */
void SetSequenceControl (uint16_t sequenceControl)
{
m_lastSequenceControl = sequenceControl;
}
-
};
@@ -316,7 +318,7 @@
NS_LOG_DEBUG ("Sequence numbers have looped back. last recorded=" << originator->GetLastSequenceControl () <<
" currently seen=" << hdr->GetSequenceControl ());
}
- // filter duplicates.
+ //filter duplicates.
if (IsDuplicate (hdr, originator))
{
NS_LOG_DEBUG ("duplicate from=" << hdr->GetAddr2 () <<
@@ -339,4 +341,4 @@
m_callback (agregate, hdr);
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/mac-rx-middle.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/mac-rx-middle.h Sun Jun 21 00:23:45 2015 +0200
@@ -56,6 +56,8 @@
void SetForwardCallback (ForwardUpCallback callback);
void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
+
+
private:
friend class MacRxMiddleTest;
/**
@@ -64,6 +66,7 @@
* The method creates a new OriginatorRxStatus if one is not already presented.
*
* \param hdr
+ *
* \return OriginatorRxStatus
*/
OriginatorRxStatus* Lookup (const WifiMacHeader* hdr);
@@ -73,6 +76,7 @@
*
* \param hdr
* \param originator
+ *
* \return true if we already received the packet previously,
* false otherwise
*/
@@ -88,6 +92,7 @@
* \param packet
* \param hdr
* \param originator
+ *
* \return a packet if the packet is successfully reassembled (or not a fragment),
* 0 if we failed to reassemble the packet (e.g. missing fragments/out-of-order).
*/
@@ -110,12 +115,12 @@
* typedef for an interator for QosOriginators
*/
typedef std::map <std::pair<Mac48Address, uint8_t>, OriginatorRxStatus *, std::less<std::pair<Mac48Address,uint8_t> > >::iterator QosOriginatorsI;
+
Originators m_originatorStatus;
QosOriginators m_qosOriginatorStatus;
ForwardUpCallback m_callback;
};
-} // namespace ns3
-
+} //namespace ns3
#endif /* MAC_RX_MIDDLE_H */
--- a/src/wifi/model/mac-tx-middle.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/mac-tx-middle.cc Sun Jun 21 00:23:45 2015 +0200
@@ -16,13 +16,12 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
- * Author: Ghada Badawy <gbadawy@gmail.com>
+ * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Mirko Banchi <mk.banchi@gmail.com>
+ * Ghada Badawy <gbadawy@gmail.com>
*/
#include "ns3/assert.h"
-
#include "mac-tx-middle.h"
#include "wifi-mac-header.h"
@@ -78,6 +77,7 @@
}
return retval;
}
+
uint16_t
MacTxMiddle::PeekNextSequenceNumberfor (const WifiMacHeader *hdr)
{
@@ -117,4 +117,4 @@
return seq;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/mac-tx-middle.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/mac-tx-middle.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
+ * Mirko Banchi <mk.banchi@gmail.com>
*/
#ifndef MAC_TX_MIDDLE_H
@@ -50,7 +50,7 @@
*/
uint16_t GetNextSequenceNumberfor (const WifiMacHeader *hdr);
/**
- * Return the next sequence number for the Traffic ID and destination, but do not pick it (i.e. the current sequence number remains unchanged).
+ * Return the next sequence number for the Traffic ID and destination, but do not pick it (i.e. the current sequence number remains unchanged).
* This functions is used for A-MPDU aggregation.
*
* \param hdr Wi-Fi header
@@ -66,11 +66,12 @@
*/
uint16_t GetNextSeqNumberByTidAndAddress (uint8_t tid, Mac48Address addr) const;
+
private:
std::map <Mac48Address,uint16_t*> m_qosSequences;
uint16_t m_sequence;
};
-} // namespace ns3
+} //namespace ns3
#endif /* MAC_TX_MIDDLE_H */
--- a/src/wifi/model/mgt-headers.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/mgt-headers.cc Sun Jun 21 00:23:45 2015 +0200
@@ -19,6 +19,7 @@
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#include "mgt-headers.h"
#include "ns3/simulator.h"
#include "ns3/assert.h"
@@ -40,32 +41,37 @@
{
m_ssid = ssid;
}
+
Ssid
MgtProbeRequestHeader::GetSsid (void) const
{
return m_ssid;
}
+
void
MgtProbeRequestHeader::SetSupportedRates (SupportedRates rates)
{
m_rates = rates;
}
-void
-MgtProbeRequestHeader::SetHtCapabilities(HtCapabilities htcapabilities)
+
+void
+MgtProbeRequestHeader::SetHtCapabilities (HtCapabilities htcapabilities)
{
- m_htCapability=htcapabilities;
+ m_htCapability = htcapabilities;
}
-HtCapabilities
+HtCapabilities
MgtProbeRequestHeader::GetHtCapabilities (void) const
{
- return m_htCapability;
+ return m_htCapability;
}
+
SupportedRates
MgtProbeRequestHeader::GetSupportedRates (void) const
{
return m_rates;
}
+
uint32_t
MgtProbeRequestHeader::GetSerializedSize (void) const
{
@@ -73,9 +79,10 @@
size += m_ssid.GetSerializedSize ();
size += m_rates.GetSerializedSize ();
size += m_rates.extended.GetSerializedSize ();
- size += m_htCapability.GetSerializedSize();
+ size += m_htCapability.GetSerializedSize ();
return size;
}
+
TypeId
MgtProbeRequestHeader::GetTypeId (void)
{
@@ -86,11 +93,13 @@
;
return tid;
}
+
TypeId
MgtProbeRequestHeader::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
+
void
MgtProbeRequestHeader::Print (std::ostream &os) const
{
@@ -98,6 +107,7 @@
<< "rates=" << m_rates << ", "
<< "HT Capabilities=" << m_htCapability;
}
+
void
MgtProbeRequestHeader::Serialize (Buffer::Iterator start) const
{
@@ -105,8 +115,9 @@
i = m_ssid.Serialize (i);
i = m_rates.Serialize (i);
i = m_rates.extended.Serialize (i);
- i = m_htCapability.Serialize(i);
+ i = m_htCapability.Serialize (i);
}
+
uint32_t
MgtProbeRequestHeader::Deserialize (Buffer::Iterator start)
{
@@ -128,55 +139,65 @@
MgtProbeResponseHeader::MgtProbeResponseHeader ()
{
}
+
MgtProbeResponseHeader::~MgtProbeResponseHeader ()
{
}
+
uint64_t
MgtProbeResponseHeader::GetTimestamp ()
{
return m_timestamp;
}
+
Ssid
MgtProbeResponseHeader::GetSsid (void) const
{
return m_ssid;
}
+
uint64_t
MgtProbeResponseHeader::GetBeaconIntervalUs (void) const
{
return m_beaconInterval;
}
+
SupportedRates
MgtProbeResponseHeader::GetSupportedRates (void) const
{
return m_rates;
}
-void
-MgtProbeResponseHeader::SetHtCapabilities(HtCapabilities htcapabilities)
+
+void
+MgtProbeResponseHeader::SetHtCapabilities (HtCapabilities htcapabilities)
{
- m_htCapability=htcapabilities;
+ m_htCapability = htcapabilities;
}
-HtCapabilities
+HtCapabilities
MgtProbeResponseHeader::GetHtCapabilities (void) const
{
- return m_htCapability;
+ return m_htCapability;
}
+
void
MgtProbeResponseHeader::SetSsid (Ssid ssid)
{
m_ssid = ssid;
}
+
void
MgtProbeResponseHeader::SetBeaconIntervalUs (uint64_t us)
{
m_beaconInterval = us;
}
+
void
MgtProbeResponseHeader::SetSupportedRates (SupportedRates rates)
{
m_rates = rates;
}
+
TypeId
MgtProbeResponseHeader::GetTypeId (void)
{
@@ -187,24 +208,25 @@
;
return tid;
}
+
TypeId
MgtProbeResponseHeader::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
+
uint32_t
MgtProbeResponseHeader::GetSerializedSize (void) const
{
uint32_t size = 0;
- size += 8; // timestamp
- size += 2; // beacon interval
+ size += 8; //timestamp
+ size += 2; //beacon interval
size += m_capability.GetSerializedSize ();
size += m_ssid.GetSerializedSize ();
size += m_rates.GetSerializedSize ();
- //size += 3; // ds parameter set
+ //size += 3; //ds parameter set
size += m_rates.extended.GetSerializedSize ();
- size += m_htCapability.GetSerializedSize();
- // xxx
+ size += m_htCapability.GetSerializedSize ();
return size;
}
void
@@ -217,26 +239,26 @@
void
MgtProbeResponseHeader::Serialize (Buffer::Iterator start) const
{
- // timestamp
- // beacon interval
- // capability information
- // ssid
- // supported rates
- // fh parameter set
- // ds parameter set
- // cf parameter set
- // ibss parameter set
- //XXX
+ //timestamp
+ //beacon interval
+ //capability information
+ //ssid
+ //supported rates
+ //fh parameter set
+ //ds parameter set
+ //cf parameter set
+ //ibss parameter set
Buffer::Iterator i = start;
i.WriteHtolsbU64 (Simulator::Now ().GetMicroSeconds ());
i.WriteHtolsbU16 (m_beaconInterval / 1024);
i = m_capability.Serialize (i);
i = m_ssid.Serialize (i);
i = m_rates.Serialize (i);
- //i.WriteU8 (0, 3); // ds parameter set.
+ //i.WriteU8 (0, 3); //ds parameter set.
i = m_rates.extended.Serialize (i);
- i = m_htCapability.Serialize(i);
+ i = m_htCapability.Serialize (i);
}
+
uint32_t
MgtProbeResponseHeader::Deserialize (Buffer::Iterator start)
{
@@ -247,12 +269,13 @@
i = m_capability.Deserialize (i);
i = m_ssid.Deserialize (i);
i = m_rates.Deserialize (i);
- //i.Next (3); // ds parameter set
+ //i.Next (3); //ds parameter set
i = m_rates.extended.DeserializeIfPresent (i);
i = m_htCapability.DeserializeIfPresent (i);
return i.GetDistanceFrom (start);
}
+
/***********************************************************
* Beacons
***********************************************************/
@@ -267,10 +290,11 @@
.SetParent<MgtProbeResponseHeader> ()
.SetGroupName ("Wifi")
.AddConstructor<MgtBeaconHeader> ()
- ;
+ ;
return tid;
}
+
/***********************************************************
* Assoc Request
***********************************************************/
@@ -281,6 +305,7 @@
: m_listenInterval (0)
{
}
+
MgtAssocRequestHeader::~MgtAssocRequestHeader ()
{
}
@@ -290,36 +315,43 @@
{
m_ssid = ssid;
}
+
void
MgtAssocRequestHeader::SetSupportedRates (SupportedRates rates)
{
m_rates = rates;
}
-void
-MgtAssocRequestHeader::SetHtCapabilities(HtCapabilities htcapabilities)
+
+void
+MgtAssocRequestHeader::SetHtCapabilities (HtCapabilities htcapabilities)
{
m_htCapability = htcapabilities;
}
+
void
MgtAssocRequestHeader::SetListenInterval (uint16_t interval)
{
m_listenInterval = interval;
}
-HtCapabilities
+
+HtCapabilities
MgtAssocRequestHeader::GetHtCapabilities (void) const
{
- return m_htCapability;
+ return m_htCapability;
}
+
Ssid
MgtAssocRequestHeader::GetSsid (void) const
{
return m_ssid;
}
+
SupportedRates
MgtAssocRequestHeader::GetSupportedRates (void) const
{
return m_rates;
}
+
uint16_t
MgtAssocRequestHeader::GetListenInterval (void) const
{
@@ -336,11 +368,13 @@
;
return tid;
}
+
TypeId
MgtAssocRequestHeader::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
+
uint32_t
MgtAssocRequestHeader::GetSerializedSize (void) const
{
@@ -349,17 +383,19 @@
size += 2;
size += m_ssid.GetSerializedSize ();
size += m_rates.GetSerializedSize ();
- size += m_htCapability.GetSerializedSize();
+ size += m_htCapability.GetSerializedSize ();
size += m_rates.extended.GetSerializedSize ();
return size;
}
+
void
MgtAssocRequestHeader::Print (std::ostream &os) const
{
os << "ssid=" << m_ssid << ", "
- << "rates=" << m_rates<< ", "
+ << "rates=" << m_rates << ", "
<< "HT Capabilities=" << m_htCapability;
}
+
void
MgtAssocRequestHeader::Serialize (Buffer::Iterator start) const
{
@@ -369,8 +405,9 @@
i = m_ssid.Serialize (i);
i = m_rates.Serialize (i);
i = m_rates.extended.Serialize (i);
- i = m_htCapability.Serialize(i);
+ i = m_htCapability.Serialize (i);
}
+
uint32_t
MgtAssocRequestHeader::Deserialize (Buffer::Iterator start)
{
@@ -384,6 +421,7 @@
return i.GetDistanceFrom (start);
}
+
/***********************************************************
* Assoc Response
***********************************************************/
@@ -394,6 +432,7 @@
: m_aid (0)
{
}
+
MgtAssocResponseHeader::~MgtAssocResponseHeader ()
{
}
@@ -403,32 +442,37 @@
{
return m_code;
}
+
SupportedRates
MgtAssocResponseHeader::GetSupportedRates (void)
{
return m_rates;
}
+
void
MgtAssocResponseHeader::SetStatusCode (StatusCode code)
{
m_code = code;
}
+
void
MgtAssocResponseHeader::SetSupportedRates (SupportedRates rates)
{
m_rates = rates;
}
-void
-MgtAssocResponseHeader::SetHtCapabilities(HtCapabilities htcapabilities)
+
+void
+MgtAssocResponseHeader::SetHtCapabilities (HtCapabilities htcapabilities)
{
- m_htCapability=htcapabilities;
+ m_htCapability = htcapabilities;
}
-HtCapabilities
+HtCapabilities
MgtAssocResponseHeader::GetHtCapabilities (void) const
{
- return m_htCapability;
+ return m_htCapability;
}
+
TypeId
MgtAssocResponseHeader::GetTypeId (void)
{
@@ -439,21 +483,23 @@
;
return tid;
}
+
TypeId
MgtAssocResponseHeader::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
+
uint32_t
MgtAssocResponseHeader::GetSerializedSize (void) const
{
uint32_t size = 0;
size += m_capability.GetSerializedSize ();
size += m_code.GetSerializedSize ();
- size += 2; // aid
+ size += 2; //aid
size += m_rates.GetSerializedSize ();
size += m_rates.extended.GetSerializedSize ();
- size += m_htCapability.GetSerializedSize();
+ size += m_htCapability.GetSerializedSize ();
return size;
}
@@ -462,8 +508,9 @@
{
os << "status code=" << m_code << ", "
<< "rates=" << m_rates << ", "
- << "HT Capabilities=" << m_htCapability;
+ << "HT Capabilities=" << m_htCapability;
}
+
void
MgtAssocResponseHeader::Serialize (Buffer::Iterator start) const
{
@@ -473,8 +520,9 @@
i.WriteHtolsbU16 (m_aid);
i = m_rates.Serialize (i);
i = m_rates.extended.Serialize (i);
- i = m_htCapability.Serialize(i);
+ i = m_htCapability.Serialize (i);
}
+
uint32_t
MgtAssocResponseHeader::Deserialize (Buffer::Iterator start)
{
@@ -487,15 +535,19 @@
i = m_htCapability.DeserializeIfPresent (i);
return i.GetDistanceFrom (start);
}
+
+
/**********************************************************
* ActionFrame
**********************************************************/
WifiActionHeader::WifiActionHeader ()
{
}
+
WifiActionHeader::~WifiActionHeader ()
{
}
+
void
WifiActionHeader::SetAction (WifiActionHeader::CategoryValue type,
WifiActionHeader::ActionValue action)
@@ -508,12 +560,12 @@
m_actionValue = action.blockAck;
break;
}
- case MESH:
+ case MESH:
{
m_actionValue = action.meshAction;
break;
}
- case MULTIHOP:
+ case MULTIHOP:
{
m_actionValue = action.multihopAction;
break;
@@ -522,13 +574,14 @@
{
m_actionValue = action.selfProtectedAction;
break;
- }
+ }
case VENDOR_SPECIFIC_ACTION:
{
break;
- }
+ }
}
}
+
WifiActionHeader::CategoryValue
WifiActionHeader::GetCategory ()
{
@@ -549,12 +602,13 @@
return SELF_PROTECTED;
}
}
+
WifiActionHeader::ActionValue
WifiActionHeader::GetAction ()
{
ActionValue retval;
- retval.selfProtectedAction = PEER_LINK_OPEN; // Needs to be initialized to something to quiet valgrind in default cases
-
+ retval.selfProtectedAction = PEER_LINK_OPEN; //Needs to be initialized to something to quiet valgrind in default cases
+
switch (m_category)
{
case BLOCK_ACK:
@@ -562,15 +616,15 @@
{
case BLOCK_ACK_ADDBA_REQUEST:
retval.blockAck = BLOCK_ACK_ADDBA_REQUEST;
- break ;
+ break;
case BLOCK_ACK_ADDBA_RESPONSE:
retval.blockAck = BLOCK_ACK_ADDBA_RESPONSE;
- break ;
+ break;
case BLOCK_ACK_DELBA:
retval.blockAck = BLOCK_ACK_DELBA;
- break ;
- }
- break ;
+ break;
+ }
+ break;
case SELF_PROTECTED:
switch (m_actionValue)
{
@@ -593,8 +647,8 @@
NS_FATAL_ERROR ("Unknown mesh peering management action code");
retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */
}
- break ;
-
+ break;
+
case MESH:
switch (m_actionValue)
{
@@ -609,10 +663,10 @@
break;
case CONGESTION_CONTROL_NOTIFICATION:
retval.meshAction = CONGESTION_CONTROL_NOTIFICATION;
- break;
+ break;
case MDA_SETUP_REQUEST:
retval.meshAction = MDA_SETUP_REQUEST;
- break;
+ break;
case MDA_SETUP_REPLY:
retval.meshAction = MDA_SETUP_REPLY;
break;
@@ -636,14 +690,14 @@
retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */
}
break;
-
+
case MULTIHOP: //not yet supported
switch (m_actionValue)
{
- case PROXY_UPDATE: //(not used so far)
+ case PROXY_UPDATE: //not used so far
retval.multihopAction = PROXY_UPDATE;
break;
- case PROXY_UPDATE_CONFIRMATION: //(not used so far)
+ case PROXY_UPDATE_CONFIRMATION: //not used so far
retval.multihopAction = PROXY_UPDATE;
break;
default:
@@ -651,12 +705,13 @@
retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */
}
break;
- default:
+ default:
NS_FATAL_ERROR ("Unsupported mesh action");
retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */
- }
+ }
return retval;
}
+
TypeId
WifiActionHeader::GetTypeId ()
{
@@ -664,29 +719,34 @@
.SetParent<Header> ()
.SetGroupName ("Wifi")
.AddConstructor<WifiActionHeader> ()
- ;
+ ;
return tid;
}
+
TypeId
WifiActionHeader::GetInstanceTypeId () const
{
return GetTypeId ();
}
+
void
WifiActionHeader::Print (std::ostream &os) const
{
}
+
uint32_t
WifiActionHeader::GetSerializedSize () const
{
return 2;
}
+
void
WifiActionHeader::Serialize (Buffer::Iterator start) const
{
start.WriteU8 (m_category);
start.WriteU8 (m_actionValue);
}
+
uint32_t
WifiActionHeader::Deserialize (Buffer::Iterator start)
{
@@ -696,6 +756,7 @@
return i.GetDistanceFrom (start);
}
+
/***************************************************
* ADDBARequest
****************************************************/
@@ -716,7 +777,7 @@
.SetParent<Header> ()
.SetGroupName ("Wifi")
.AddConstructor<MgtAddBaRequestHeader> ()
- ;
+ ;
return tid;
}
@@ -874,6 +935,7 @@
m_bufferSize = (params >> 6) & 0x03ff;
}
+
/***************************************************
* ADDBAResponse
****************************************************/
@@ -1041,6 +1103,7 @@
m_bufferSize = (params >> 6) & 0x03ff;
}
+
/***************************************************
* DelBa
****************************************************/
@@ -1149,4 +1212,4 @@
m_tid = (params >> 12) & 0x0f;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/mgt-headers.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/mgt-headers.h Sun Jun 21 00:23:45 2015 +0200
@@ -19,6 +19,7 @@
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#ifndef MGT_HEADERS_H
#define MGT_HEADERS_H
@@ -66,8 +67,8 @@
*
* \param htcapabilities HT capabilities
*/
- void SetHtCapabilities(HtCapabilities htcapabilities);
-
+ void SetHtCapabilities (HtCapabilities htcapabilities);
+
/**
* Return the HT capabilities.
*
@@ -104,11 +105,12 @@
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
+
private:
- Ssid m_ssid; //!< Service Set ID (SSID)
- SupportedRates m_rates; //!< List of supported rates
+ Ssid m_ssid; //!< Service Set ID (SSID)
+ SupportedRates m_rates; //!< List of supported rates
CapabilityInformation m_capability; //!< Capability information
- HtCapabilities m_htCapability; //!< HT capabilities
+ HtCapabilities m_htCapability; //!< HT capabilities
uint16_t m_listenInterval;
};
@@ -147,7 +149,7 @@
*
* \param htcapabilities HT capabilities
*/
- void SetHtCapabilities(HtCapabilities htcapabilities);
+ void SetHtCapabilities (HtCapabilities htcapabilities);
/**
* Set the supported rates.
*
@@ -172,12 +174,13 @@
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
+
private:
- SupportedRates m_rates; //!< List of supported rates
+ SupportedRates m_rates; //!< List of supported rates
CapabilityInformation m_capability; //!< Capability information
- StatusCode m_code; //!< Status code
+ StatusCode m_code; //!< Status code
uint16_t m_aid;
- HtCapabilities m_htCapability; //!< HT capabilities
+ HtCapabilities m_htCapability; //!< HT capabilities
};
@@ -226,8 +229,8 @@
*
* \param htcapabilities HT capabilities
*/
- void SetHtCapabilities(HtCapabilities htcapabilities);
-
+ void SetHtCapabilities (HtCapabilities htcapabilities);
+
/**
* Register this type.
* \return The TypeId.
@@ -238,9 +241,11 @@
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
+
+
private:
- Ssid m_ssid; //!< Service Set ID (SSID)
- SupportedRates m_rates; //!< List of supported rates
+ Ssid m_ssid; //!< Service Set ID (SSID)
+ SupportedRates m_rates; //!< List of supported rates
HtCapabilities m_htCapability; //!< HT capabilities
};
@@ -285,7 +290,7 @@
*
* \param htcapabilities HT capabilities
*/
- void SetHtCapabilities(HtCapabilities htcapabilities);
+ void SetHtCapabilities (HtCapabilities htcapabilities);
/**
* Set the Service Set Identifier (SSID).
*
@@ -310,7 +315,7 @@
* \return time stamp
*/
uint64_t GetTimestamp ();
-
+
/**
* Register this type.
* \return The TypeId.
@@ -322,13 +327,14 @@
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
+
private:
- uint64_t m_timestamp; //!< Timestamp
- Ssid m_ssid; //!< Service set ID (SSID)
- uint64_t m_beaconInterval; //!< Beacon interval
- SupportedRates m_rates; //!< List of supported rates
+ uint64_t m_timestamp; //!< Timestamp
+ Ssid m_ssid; //!< Service set ID (SSID)
+ uint64_t m_beaconInterval; //!< Beacon interval
+ SupportedRates m_rates; //!< List of supported rates
CapabilityInformation m_capability; //!< Capability information
- HtCapabilities m_htCapability; //!< HT capabilities
+ HtCapabilities m_htCapability; //!< HT capabilities
};
@@ -347,6 +353,7 @@
static TypeId GetTypeId (void);
};
+
/****************************
* Action frames
*****************************/
@@ -366,19 +373,20 @@
/*
* Compatible with table 8-38 IEEE 802.11, Part11, (Year 2012)
- * Category values - see 802.11-2012 Table 8-38 */
-
+ * Category values - see 802.11-2012 Table 8-38
+ */
+
enum CategoryValue //table 8-38 staring from IEEE 802.11, Part11, (Year 2012)
{
BLOCK_ACK = 3,
MESH = 13, //Category: Mesh
- MULTIHOP = 14, //(not used so far)
+ MULTIHOP = 14, //not used so far
SELF_PROTECTED = 15, //Category: Self Protected
- // since vendor specific action has no stationary Action value,the parse process is not here.
- // refer to vendor-specific-action in wave module.
+ //Since vendor specific action has no stationary Action value,the parse process is not here.
+ //Refer to vendor-specific-action in wave module.
VENDOR_SPECIFIC_ACTION = 127,
};
-
+
enum SelfProtectedActionValue //Category: 15 (Self Protected)
{
PEER_LINK_OPEN = 1, //Mesh Peering Open
@@ -390,23 +398,23 @@
enum MultihopActionValue
{
- PROXY_UPDATE = 0, //(not used so far)
- PROXY_UPDATE_CONFIRMATION = 1, //(not used so far)
+ PROXY_UPDATE = 0, //not used so far
+ PROXY_UPDATE_CONFIRMATION = 1, //not used so far
};
enum MeshActionValue
{
- LINK_METRIC_REPORT=0, //Action Value:0 in Category 13: Mesh
- PATH_SELECTION = 1, //Action Value:1 in Category 13: Mesh
- PORTAL_ANNOUNCEMENT = 2, //Action Value:2 in Category 13: Mesh
- CONGESTION_CONTROL_NOTIFICATION = 3,//Action Value:3 in Category 13: Mesh
- MDA_SETUP_REQUEST=4, //Action Value:4 in Category 13: Mesh MCCA-Setup-Request (not used so far)
- MDA_SETUP_REPLY=5, //Action Value:5 in Category 13: Mesh MCCA-Setup-Reply (not used so far)
- MDAOP_ADVERTISMENT_REQUEST=6, //Action Value:6 in Category 13: Mesh MCCA-Advertisement-Request (not used so far)
- MDAOP_ADVERTISMENTS=7, //Action Value:7 in Category 13: Mesh (not used so far)
- MDAOP_SET_TEARDOWN=8, //Action Value:8 in Category 13: Mesh (not used so far)
- TBTT_ADJUSTMENT_REQUEST=9, //Action Value:9 in Category 13: Mesh (not used so far)
- TBTT_ADJUSTMENT_RESPONSE=10, //Action Value:10 in Category 13: Mesh (not used so far)
+ LINK_METRIC_REPORT = 0, //Action Value:0 in Category 13: Mesh
+ PATH_SELECTION = 1, //Action Value:1 in Category 13: Mesh
+ PORTAL_ANNOUNCEMENT = 2, //Action Value:2 in Category 13: Mesh
+ CONGESTION_CONTROL_NOTIFICATION = 3, //Action Value:3 in Category 13: Mesh
+ MDA_SETUP_REQUEST = 4, //Action Value:4 in Category 13: Mesh MCCA-Setup-Request (not used so far)
+ MDA_SETUP_REPLY = 5, //Action Value:5 in Category 13: Mesh MCCA-Setup-Reply (not used so far)
+ MDAOP_ADVERTISMENT_REQUEST = 6, //Action Value:6 in Category 13: Mesh MCCA-Advertisement-Request (not used so far)
+ MDAOP_ADVERTISMENTS = 7, //Action Value:7 in Category 13: Mesh (not used so far)
+ MDAOP_SET_TEARDOWN = 8, //Action Value:8 in Category 13: Mesh (not used so far)
+ TBTT_ADJUSTMENT_REQUEST = 9, //Action Value:9 in Category 13: Mesh (not used so far)
+ TBTT_ADJUSTMENT_RESPONSE = 10, //Action Value:10 in Category 13: Mesh (not used so far)
};
/**
@@ -428,7 +436,7 @@
{
enum MeshActionValue meshAction;
enum MultihopActionValue multihopAction;
- enum SelfProtectedActionValue selfProtectedAction;
+ enum SelfProtectedActionValue selfProtectedAction;
enum BlockAckActionValue blockAck;
} ActionValue;
/**
@@ -451,7 +459,7 @@
* \return ActionValue
*/
ActionValue GetAction ();
-
+
/**
* Register this type.
* \return The TypeId.
@@ -462,11 +470,14 @@
virtual uint32_t GetSerializedSize () const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
+
+
private:
uint8_t m_category; //!< Category of the action
uint8_t m_actionValue; //!< Action value
};
+
/**
* \ingroup wifi
* Implement the header for management frames of type add block ack request.
@@ -589,13 +600,13 @@
*/
void SetStartingSequenceControl (uint16_t seqControl);
- uint8_t m_dialogToken; /* Not used for now */
- uint8_t m_amsduSupport; //!< Flag if A-MSDU is supported
- uint8_t m_policy; //!< Block ACK policy
- uint8_t m_tid; //!< Traffic ID
- uint16_t m_bufferSize; //!< Buffer size
+ uint8_t m_dialogToken; /* Not used for now */
+ uint8_t m_amsduSupport; //!< Flag if A-MSDU is supported
+ uint8_t m_policy; //!< Block ACK policy
+ uint8_t m_tid; //!< Traffic ID
+ uint16_t m_bufferSize; //!< Buffer size
uint16_t m_timeoutValue; //!< Timeout
- uint16_t m_startingSeq; //!< Starting sequence number
+ uint16_t m_startingSeq; //!< Starting sequence number
};
@@ -695,6 +706,7 @@
*/
bool IsAmsduSupported (void) const;
+
private:
/**
* Return the raw parameter set.
@@ -709,12 +721,12 @@
*/
void SetParameterSet (uint16_t params);
- uint8_t m_dialogToken; /* Not used for now */
- StatusCode m_code; //!< Status code
- uint8_t m_amsduSupport; //!< Flag if A-MSDU is supported
- uint8_t m_policy; //!< Block ACK policy
- uint8_t m_tid; //!< Traffic ID
- uint16_t m_bufferSize; //!< Buffer size
+ uint8_t m_dialogToken; /* Not used for now */
+ StatusCode m_code; //!< Status code
+ uint8_t m_amsduSupport; //!< Flag if A-MSDU is supported
+ uint8_t m_policy; //!< Block ACK policy
+ uint8_t m_tid; //!< Traffic ID
+ uint16_t m_bufferSize; //!< Buffer size
uint16_t m_timeoutValue; //!< Timeout
};
@@ -784,11 +796,9 @@
uint16_t m_initiator;
uint16_t m_tid; //!< Traffic ID
- /* Not used for now.
- Always set to 1: "Unspecified reason" */
- uint16_t m_reasonCode;
+ uint16_t m_reasonCode; /* Not used for now. Always set to 1: "Unspecified reason" */
};
-} // namespace ns3
+} //namespace ns3
#endif /* MGT_HEADERS_H */
--- a/src/wifi/model/minstrel-wifi-manager.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/minstrel-wifi-manager.cc Sun Jun 21 00:23:45 2015 +0200
@@ -61,27 +61,22 @@
* 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_maxTpRate2; ///< second highest throughput rate
- uint32_t m_maxProbRate; ///< rate with highest prob of success
-
- int m_packetCount; ///< total number of packets as of now
- int m_sampleCount; ///< how many packets we have sample so far
-
- 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
-
- uint32_t m_shortRetry; ///< short retries such as control packts
- uint32_t m_longRetry; ///< long retries such as data packets
- uint32_t m_retry; ///< total retries short + long
- uint32_t m_err; ///< retry errors
- uint32_t m_txrate; ///< current transmit rate
-
- bool m_initialized; ///< for initializing tables
-
+ 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
+ int m_packetCount; ///< total number of packets as of now
+ int m_sampleCount; ///< how many packets we have sample so far
+ 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
+ uint32_t m_shortRetry; ///< short retries such as control packts
+ uint32_t m_longRetry; ///< long retries such as data packets
+ uint32_t m_retry; ///< total retries short + long
+ uint32_t m_err; ///< retry errors
+ uint32_t m_txrate; ///< current transmit rate
+ bool m_initialized; ///< for initializing tables
MinstrelRate m_minstrelTable; ///< minstrel table
- SampleRate m_sampleTable; ///< sample table
+ SampleRate m_sampleTable; ///< sample table
};
NS_OBJECT_ENSURE_REGISTERED (MinstrelWifiManager);
@@ -136,14 +131,14 @@
void
MinstrelWifiManager::SetupPhy (Ptr<WifiPhy> phy)
{
- NS_LOG_FUNCTION(this << phy);
+ NS_LOG_FUNCTION (this << phy);
uint32_t nModes = phy->GetNModes ();
for (uint32_t i = 0; i < nModes; i++)
{
WifiMode mode = phy->GetMode (i);
WifiTxVector txVector;
- txVector.SetMode(mode);
- AddCalcTxTime (mode, phy->CalculateTxDuration (m_pktLen, txVector, WIFI_PREAMBLE_LONG, phy->GetFrequency(), 0, 0));
+ txVector.SetMode (mode);
+ AddCalcTxTime (mode, phy->CalculateTxDuration (m_pktLen, txVector, WIFI_PREAMBLE_LONG, phy->GetFrequency (), 0, 0));
}
WifiRemoteStationManager::SetupPhy (phy);
}
@@ -208,9 +203,9 @@
{
if (!station->m_initialized && GetNSupported (station) > 1)
{
- // 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.
+ //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);
station->m_minstrelTable = MinstrelRate (m_nsupported);
station->m_sampleTable = SampleRate (m_nsupported, std::vector<uint32_t> (m_sampleCol));
@@ -286,18 +281,18 @@
NS_LOG_DEBUG ("DoReportDataFailed " << station << " rate " << station->m_txrate << " longRetry " << station->m_longRetry);
- /// for normal rate, we're not currently sampling random rates
+ //for normal rate, we're not currently sampling random rates
if (!station->m_isSampling)
{
NS_LOG_DEBUG ("Failed with normal rate: current=" << station->m_txrate << ", sample=" << station->m_sampleRate << ", maxTp=" << station->m_maxTpRate << ", maxTp2=" << station->m_maxTpRate2 << ", maxProb=" << station->m_maxProbRate);
- /// use best throughput rate
+ //use best throughput rate
if (station->m_longRetry < station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount)
{
NS_LOG_DEBUG (" More retries left for the maximum throughput rate.");
station->m_txrate = station->m_maxTpRate;
}
- /// use second best throughput rate
+ //use second best throughput rate
else if (station->m_longRetry <= (station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount +
station->m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount))
{
@@ -305,7 +300,7 @@
station->m_txrate = station->m_maxTpRate2;
}
- /// use best probability rate
+ //use best probability rate
else if (station->m_longRetry <= (station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount +
station->m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount +
station->m_minstrelTable[station->m_maxProbRate].adjustedRetryCount))
@@ -314,7 +309,7 @@
station->m_txrate = station->m_maxProbRate;
}
- /// use lowest base rate
+ //use lowest base rate
else if (station->m_longRetry > (station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount +
station->m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount +
station->m_minstrelTable[station->m_maxProbRate].adjustedRetryCount))
@@ -324,22 +319,22 @@
}
}
- /// for look-around rate, we're currently sampling random rates
+ //for look-around rate, we're currently sampling random rates
else
{
NS_LOG_DEBUG ("Failed with look around rate: current=" << station->m_txrate << ", sample=" << station->m_sampleRate << ", maxTp=" << station->m_maxTpRate << ", maxTp2=" << station->m_maxTpRate2 << ", maxProb=" << station->m_maxProbRate);
- /// current sampling rate is slower than the current best rate
+ //current sampling rate is slower than the current best rate
if (station->m_sampleRateSlower)
{
NS_LOG_DEBUG ("Look around rate is slower than the maximum throughput rate.");
- /// use best throughput rate
+ //use best throughput rate
if (station->m_longRetry < station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount)
{
NS_LOG_DEBUG (" More retries left for the maximum throughput rate.");
station->m_txrate = station->m_maxTpRate;
}
- /// use random rate
+ //use random rate
else if (station->m_longRetry <= (station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount +
station->m_minstrelTable[station->m_sampleRate].adjustedRetryCount))
{
@@ -347,7 +342,7 @@
station->m_txrate = station->m_sampleRate;
}
- /// use max probability rate
+ //use max probability rate
else if (station->m_longRetry <= (station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount +
station->m_minstrelTable[station->m_sampleRate].adjustedRetryCount +
station->m_minstrelTable[station->m_maxProbRate].adjustedRetryCount ))
@@ -356,7 +351,7 @@
station->m_txrate = station->m_maxProbRate;
}
- /// use lowest base rate
+ //use lowest base rate
else if (station->m_longRetry > (station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount +
station->m_minstrelTable[station->m_sampleRate].adjustedRetryCount +
station->m_minstrelTable[station->m_maxProbRate].adjustedRetryCount))
@@ -365,19 +360,18 @@
station->m_txrate = 0;
}
}
-
- /// current sampling rate is better than current best rate
+ //current sampling rate is better than current best rate
else
{
NS_LOG_DEBUG ("Look around rate is faster than the maximum throughput rate.");
- /// use random rate
+ //use random rate
if (station->m_longRetry < station->m_minstrelTable[station->m_sampleRate].adjustedRetryCount)
{
NS_LOG_DEBUG (" More retries left for the sampling rate.");
station->m_txrate = station->m_sampleRate;
}
- /// use the best throughput rate
+ //use the best throughput rate
else if (station->m_longRetry <= (station->m_minstrelTable[station->m_sampleRate].adjustedRetryCount +
station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
{
@@ -385,7 +379,7 @@
station->m_txrate = station->m_maxTpRate;
}
- /// use the best probability rate
+ //use the best probability rate
else if (station->m_longRetry <= (station->m_minstrelTable[station->m_sampleRate].adjustedRetryCount +
station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount +
station->m_minstrelTable[station->m_maxProbRate].adjustedRetryCount))
@@ -394,7 +388,7 @@
station->m_txrate = station->m_maxProbRate;
}
- /// use the lowest base rate
+ //use the lowest base rate
else if (station->m_longRetry > (station->m_minstrelTable[station->m_sampleRate].adjustedRetryCount +
station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount +
station->m_minstrelTable[station->m_maxProbRate].adjustedRetryCount))
@@ -477,18 +471,18 @@
WifiTxVector
MinstrelWifiManager::DoGetDataTxVector (WifiRemoteStation *st,
- uint32_t size)
+ uint32_t size)
{
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st;
if (!station->m_initialized)
{
CheckInit (station);
- /// start the rate at half way
+ //start the rate at half way
station->m_txrate = m_nsupported / 2;
}
UpdateStats (station);
- return WifiTxVector (GetSupported (station, station->m_txrate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station));
+ return WifiTxVector (GetSupported (station, station->m_txrate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
}
WifiTxVector
@@ -497,7 +491,7 @@
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st;
NS_LOG_DEBUG ("DoGetRtsMode m_txrate=" << station->m_txrate);
- return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station));
+ return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
}
bool
@@ -546,6 +540,7 @@
{
return true;
}
+
uint32_t
MinstrelWifiManager::GetNextSample (MinstrelWifiRemoteStation *station)
{
@@ -553,7 +548,7 @@
bitrate = station->m_sampleTable[station->m_index][station->m_col];
station->m_index++;
- /// bookeeping for m_index and m_col variables
+ //bookeeping for m_index and m_col variables
if (station->m_index > (m_nsupported - 2))
{
station->m_index = 0;
@@ -579,7 +574,7 @@
uint32_t idx;
- /// for determining when to try a sample rate
+ //for determining when to try a sample rate
int coinFlip = m_uniformRandomVariable->GetInteger (0, 100) % 2;
/**
@@ -591,10 +586,9 @@
&& (coinFlip == 1) )
{
NS_LOG_DEBUG ("Using look around rate");
- /// now go through the table and find an index rate
+ //now go through the table and find an index rate
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
@@ -602,26 +596,26 @@
if (idx != station->m_maxTpRate && idx != station->m_txrate)
{
- /// start sample count
+ //start sample count
station->m_sampleCount++;
- /// set flag that we are currently sampling
+ //set flag that we are currently sampling
station->m_isSampling = true;
- /// bookeeping for resetting stuff
+ //bookeeping for resetting stuff
if (station->m_packetCount >= 10000)
{
station->m_sampleCount = 0;
station->m_packetCount = 0;
}
- /// error check
+ //error check
if (idx >= m_nsupported)
{
NS_LOG_DEBUG ("ALERT!!! ERROR");
}
- /// set the rate that we're currently sampling
+ //set the rate that we're currently sampling
station->m_sampleRate = idx;
if (station->m_sampleRate == station->m_maxTpRate)
@@ -629,11 +623,11 @@
station->m_sampleRate = station->m_maxTpRate2;
}
- /// is this rate slower than the current best rate
+ //is this rate slower than the current best rate
station->m_sampleRateSlower =
(station->m_minstrelTable[idx].perfectTxTime > station->m_minstrelTable[station->m_maxTpRate].perfectTxTime);
- /// using the best rate instead
+ //using the best rate instead
if (station->m_sampleRateSlower)
{
NS_LOG_DEBUG ("The next look around rate is slower than the maximum throughput rate, continue with the maximum throughput rate: " << station->m_maxTpRate << "(" << GetSupported (station, station->m_maxTpRate) << ")");
@@ -641,15 +635,13 @@
}
}
}
-
- /// continue using the best rate
+ //continue using the best rate
else
{
NS_LOG_DEBUG ("Continue using the maximum throughput rate: " << station->m_maxTpRate << "(" << GetSupported (station, station->m_maxTpRate) << ")");
idx = station->m_maxTpRate;
}
-
NS_LOG_DEBUG ("Rate = " << idx << "(" << GetSupported (station, idx) << ")");
return idx;
@@ -679,10 +671,10 @@
for (uint32_t i = 0; i < m_nsupported; i++)
{
- /// calculate the perfect tx time for this rate
+ //calculate the perfect tx time for this rate
txTime = station->m_minstrelTable[i].perfectTxTime;
- /// just for initialization
+ //just for initialization
if (txTime.GetMicroSeconds () == 0)
{
txTime = Seconds (1);
@@ -692,7 +684,7 @@
"\t" << station->m_minstrelTable[i].numRateAttempt <<
"\t" << station->m_minstrelTable[i].numRateSuccess);
- /// if we've attempted something
+ //if we've attempted something
if (station->m_minstrelTable[i].numRateAttempt)
{
/**
@@ -701,24 +693,24 @@
*/
tempProb = (station->m_minstrelTable[i].numRateSuccess * 18000) / station->m_minstrelTable[i].numRateAttempt;
- /// bookeeping
+ //bookeeping
station->m_minstrelTable[i].prob = tempProb;
- /// ewma probability (cast for gcc 3.4 compatibility)
+ //ewma probability (cast for gcc 3.4 compatibility)
tempProb = static_cast<uint32_t> (((tempProb * (100 - m_ewmaLevel)) + (station->m_minstrelTable[i].ewmaProb * m_ewmaLevel) ) / 100);
station->m_minstrelTable[i].ewmaProb = tempProb;
- /// calculating throughput
+ //calculating throughput
station->m_minstrelTable[i].throughput = tempProb * (1000000 / txTime.GetMicroSeconds ());
}
- /// bookeeping
+ //bookeeping
station->m_minstrelTable[i].numRateSuccess = 0;
station->m_minstrelTable[i].numRateAttempt = 0;
- /// Sample less often below 10% and above 95% of success
+ //Sample less often below 10% and above 95% of success
if ((station->m_minstrelTable[i].ewmaProb > 17100) || (station->m_minstrelTable[i].ewmaProb < 1800))
{
/**
@@ -726,7 +718,7 @@
*
* Analysis of information showed that the system was sampling too hard at some rates.
* For those rates that never work (54mb, 500m range) there is no point in sending 10 sample packets (< 6 ms time).
- * Consequently, for the very very low probability rates, we sample at most twice.
+ * Consequently, for the very very low probability rates, we sample at most twice.
*/
if (station->m_minstrelTable[i].retryCount > 2)
{
@@ -742,18 +734,18 @@
station->m_minstrelTable[i].adjustedRetryCount = station->m_minstrelTable[i].retryCount;
}
- /// if it's 0 allow one retry limit
+ //if it's 0 allow one retry limit
if (station->m_minstrelTable[i].adjustedRetryCount == 0)
{
station->m_minstrelTable[i].adjustedRetryCount = 1;
}
}
+
NS_LOG_DEBUG ("Attempt/success resetted to 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
+ //go find max throughput, second maximum throughput, high probability succ
NS_LOG_DEBUG ("Finding the maximum throughput, second maximum throughput, and highest probability");
NS_LOG_DEBUG ("Index-Rate\t\tT-put\tEWMA");
for (uint32_t i = 0; i < m_nsupported; i++)
@@ -777,7 +769,7 @@
max_tp = 0;
- /// find the second highest max
+ //find the second highest max
for (uint32_t i = 0; i < m_nsupported; i++)
{
if ((i != index_max_tp) && (max_tp < station->m_minstrelTable[i].throughput))
@@ -818,10 +810,10 @@
NS_LOG_DEBUG (" perfectTxTime = " << station->m_minstrelTable[i].perfectTxTime);
station->m_minstrelTable[i].retryCount = 1;
station->m_minstrelTable[i].adjustedRetryCount = 1;
- // Emulating minstrel.c::ath_rate_ctl_reset
- // We only check from 2 to 10 retries. This guarantee that
- // at least one retry is permitter.
- Time totalTxTimeWithGivenRetries = Seconds (0.0); // tx_time in minstrel.c
+ //Emulating minstrel.c::ath_rate_ctl_reset
+ //We only check from 2 to 10 retries. This guarantee that
+ //at least one retry is permitter.
+ Time totalTxTimeWithGivenRetries = Seconds (0.0); //tx_time in minstrel.c
NS_LOG_DEBUG (" Calculating the number of retries");
for (uint32_t retries = 2; retries < 11; retries++)
{
@@ -842,8 +834,8 @@
MinstrelWifiManager::CalculateTimeUnicastPacket (Time dataTransmissionTime, uint32_t shortRetries, uint32_t longRetries)
{
NS_LOG_FUNCTION (this << dataTransmissionTime << shortRetries << longRetries);
- // See rc80211_minstrel.c
-
+ //See rc80211_minstrel.c
+
//First transmission (DATA + ACK timeout)
Time tt = dataTransmissionTime + GetMac ()->GetAckTimeout ();
@@ -851,13 +843,13 @@
uint32_t cw = 31;
for (uint32_t retry = 0; retry < longRetries; retry++)
{
- // Add one re-transmission (DATA + ACK timeout)
+ //Add one re-transmission (DATA + ACK timeout)
tt += dataTransmissionTime + GetMac ()->GetAckTimeout ();
- // Add average back off (half the current contention window)
+ //Add average back off (half the current contention window)
tt += NanoSeconds ((cw / 2) * GetMac ()->GetSlot ());
- // Update contention window
+ //Update contention window
cw = std::min (cwMax, (cw + 1) * 2);
}
@@ -871,7 +863,7 @@
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;
@@ -879,7 +871,6 @@
{
for (uint32_t i = 0; i < numSampleRates; i++ )
{
-
/**
* The next two lines basically tries to generate a random number
* between 0 and the number of available rates
@@ -887,13 +878,12 @@
int uv = m_uniformRandomVariable->GetInteger (0, numSampleRates);
newIndex = (i + uv) % numSampleRates;
- /// this loop is used for filling in other uninitilized places
+ //this loop is used for filling in other uninitilized places
while (station->m_sampleTable[newIndex][col] != 0)
{
newIndex = (newIndex + 1) % m_nsupported;
}
station->m_sampleTable[newIndex][col] = i;
-
}
}
}
@@ -913,7 +903,7 @@
}
table << std::endl;
}
- NS_LOG_DEBUG (table.str());
+ NS_LOG_DEBUG (table.str ());
}
void
@@ -927,9 +917,4 @@
}
}
-} // namespace ns3
-
-
-
-
-
+} //namespace ns3
--- a/src/wifi/model/minstrel-wifi-manager.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/minstrel-wifi-manager.h Sun Jun 21 00:23:45 2015 +0200
@@ -18,8 +18,6 @@
* Author: Duy Nguyen <duy@soe.ucsc.edu>
*/
-
-
#ifndef MINSTREL_WIFI_MANAGER_H
#define MINSTREL_WIFI_MANAGER_H
@@ -43,12 +41,11 @@
*/
Time perfectTxTime;
-
- uint32_t retryCount; ///< retry limit
+ 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 prob; ///< (# pkts success )/(# total pkts)
+ uint32_t numRateAttempt; ///< how many number of attempts so far
+ uint32_t numRateSuccess; ///< number of successful pkts
+ uint32_t prob; ///< (# pkts success )/(# total pkts)
/**
* EWMA calculation
@@ -64,7 +61,6 @@
* A vector of a struct RateInfo
*/
typedef std::vector<struct RateInfo> MinstrelRate;
-
/**
* Data structure for a Sample Rate table
* A vector of a vector uint32_t
@@ -90,18 +86,20 @@
virtual void SetupPhy (Ptr<WifiPhy> phy);
- /**
- * Assign a fixed random variable stream number to the random variables
- * used by this model. Return the number of streams (possibly zero) that
- * have been assigned.
- *
- * \param stream first stream index to use
- * \return the number of stream indices assigned by this model
- */
+ /**
+ * Assign a fixed random variable stream number to the random variables
+ * used by this model. Return the number of streams (possibly zero) that
+ * have been assigned.
+ *
+ * \param stream first stream index to use
+ *
+ * \return the number of stream indices assigned by this model
+ */
int64_t AssignStreams (int64_t stream);
+
private:
- // overriden from base class
+ //overriden from base class
virtual WifiRemoteStation * DoCreateStation (void) const;
virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
@@ -120,7 +118,7 @@
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;
/**
* Add transmission time for the given mode to an internal list.
@@ -130,19 +128,19 @@
*/
void AddCalcTxTime (WifiMode mode, Time t);
- /// update the number of retries and reset accordingly
+ //update the number of retries and reset accordingly
void UpdateRetry (MinstrelWifiRemoteStation *station);
- /// getting the next sample from Sample Table
+ //getting the next sample from Sample Table
uint32_t GetNextSample (MinstrelWifiRemoteStation *station);
- /// find a rate to use from Minstrel Table
+ //find a rate to use from Minstrel Table
uint32_t FindRate (MinstrelWifiRemoteStation *station);
- /// updating the Minstrel Table every 1/10 seconds
+ //updating the Minstrel Table every 1/10 seconds
void UpdateStats (MinstrelWifiRemoteStation *station);
- /// initialize Minstrel Table
+ //initialize Minstrel Table
void RateInit (MinstrelWifiRemoteStation *station);
/**
@@ -163,13 +161,13 @@
*/
Time CalculateTimeUnicastPacket (Time dataTransmissionTime, uint32_t shortRetries, uint32_t longRetries);
- /// initialize Sample Table
+ //initialize Sample Table
void InitSampleTable (MinstrelWifiRemoteStation *station);
- /// printing Sample Table
+ //printing Sample Table
void PrintSampleTable (MinstrelWifiRemoteStation *station);
- /// printing Minstrel Table
+ //printing Minstrel Table
void PrintTable (MinstrelWifiRemoteStation *station);
void CheckInit (MinstrelWifiRemoteStation *station); ///< check for initializations
@@ -181,18 +179,18 @@
*/
typedef std::vector<std::pair<Time,WifiMode> > TxTime;
- 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)
+ 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_ewmaLevel; ///< exponential weighted moving average
- uint32_t m_sampleCol; ///< number of sample columns
- uint32_t m_pktLen; ///< packet length used for calculate mode TxTime
- uint32_t m_nsupported; ///< modes supported
+ double m_ewmaLevel; ///< exponential weighted moving average
+ uint32_t m_sampleCol; ///< number of sample columns
+ uint32_t m_pktLen; ///< packet length used for calculate mode TxTime
+ uint32_t m_nsupported; ///< modes supported
- /// Provides uniform random variables.
+ //Provides uniform random variables.
Ptr<UniformRandomVariable> m_uniformRandomVariable;
};
-} // namespace ns3
+} //namespace ns3
#endif /* MINSTREL_WIFI_MANAGER_H */
--- a/src/wifi/model/mpdu-aggregator.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/mpdu-aggregator.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,8 +17,8 @@
*
* Author: Ghada Badawy <gbadawy@gmail.com>
*/
+
#include "ns3/log.h"
-
#include "mpdu-aggregator.h"
#include "wifi-mac-header.h"
@@ -34,7 +34,7 @@
static TypeId tid = TypeId ("ns3::MpduAggregator")
.SetParent<Object> ()
.SetGroupName ("Wifi")
- // No AddConstructor because this is an abstract class.
+ //No AddConstructor because this is an abstract class.
;
return tid;
}
@@ -75,5 +75,4 @@
return set;
}
-
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/mpdu-aggregator.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/mpdu-aggregator.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,15 +17,14 @@
*
* Author: Ghada Badawy <gbadawy@gmail.com>
*/
+
#ifndef MPDU_AGGREGATOR_H
#define MPDU_AGGREGATOR_H
#include "ns3/ptr.h"
#include "ns3/packet.h"
#include "ns3/object.h"
-
#include "ampdu-subframe-header.h"
-
#include <list>
namespace ns3 {
@@ -52,6 +51,7 @@
/**
* \param packet Packet we have to insert into <i>aggregatedPacket</i>.
* \param aggregatedPacket Packet that will contain <i>packet</i>, if aggregation is possible.
+ *
* \return true if <i>packet</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
*
* Adds <i>packet</i> to <i>aggregatedPacket</i>. In concrete aggregator's implementation is
@@ -61,11 +61,12 @@
/**
* Adds A-MPDU subframe header and padding to each MPDU that is part of an A-MPDU before it is sent.
*/
- virtual void AddHeaderAndPad (Ptr<Packet> packet,bool last) = 0;
+ virtual void AddHeaderAndPad (Ptr<Packet> packet, bool last) = 0;
/**
* \param packetSize size of the packet we want to insert into <i>aggregatedPacket</i>.
* \param aggregatedPacket packet that will contain the packet of size <i>packetSize</i>, if aggregation is possible.
* \param blockAckSize size of the piggybacked block ack request
+ *
* \return true if the packet of size <i>packetSize</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
*
* This method is used to determine if a packet could be aggregated to an A-MPDU without exceeding the maximum packet size.
@@ -86,6 +87,6 @@
static DeaggregatedMpdus Deaggregate (Ptr<Packet> aggregatedPacket);
};
-} // namespace ns3
+} //namespace ns3
#endif /* MPDU_AGGREGATOR_H */
--- a/src/wifi/model/mpdu-standard-aggregator.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/mpdu-standard-aggregator.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,9 +17,9 @@
*
* Author: Ghada Badawy <gbadawy@gmail.com>
*/
+
#include "ns3/log.h"
#include "ns3/uinteger.h"
-
#include "ampdu-subframe-header.h"
#include "mpdu-standard-aggregator.h"
@@ -86,7 +86,7 @@
{
NS_LOG_FUNCTION (this);
AmpduSubframeHeader currentHdr;
- //This is called to prepare packets from the aggregte queue to be sent so no need to check total size since it has already been
+ //This is called to prepare packets from the aggregate queue to be sent so no need to check total size since it has already been
//done before when deciding how many packets to add to the queue
currentHdr.SetCrc (1);
currentHdr.SetSig ();
@@ -126,4 +126,4 @@
return (4 - (packet->GetSize () % 4 )) % 4;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/mpdu-standard-aggregator.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/mpdu-standard-aggregator.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Ghada Badawy <gbadawy@gmail.com>
*/
+
#ifndef MPDU_STANDARD_AGGREGATOR_H
#define MPDU_STANDARD_AGGREGATOR_H
@@ -38,7 +39,9 @@
/**
* \param packet packet we have to insert into <i>aggregatedPacket</i>.
* \param aggregatedPacket packet that will contain <i>packet</i>, if aggregation is possible.
- * \return true if <i>packet</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
+ *
+ * \return true if <i>packet</i> can be aggregated to <i>aggregatedPacket</i>,
+ * false otherwise.
*
* This method performs an MPDU aggregation.
* Returns true if <i>packet</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
@@ -52,7 +55,9 @@
* \param packetSize size of the packet we want to insert into <i>aggregatedPacket</i>.
* \param aggregatedPacket packet that will contain the packet of size <i>packetSize</i>, if aggregation is possible.
* \param blockAckSize size of the piggybacked block ack request
- * \return true if the packet of size <i>packetSize</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
+ *
+ * \return true if the packet of size <i>packetSize</i> can be aggregated to <i>aggregatedPacket</i>,
+ * false otherwise.
*
* This method is used to determine if a packet could be aggregated to an A-MPDU without exceeding the maximum packet size.
*/
@@ -65,10 +70,11 @@
*/
virtual uint32_t CalculatePadding (Ptr<const Packet> packet);
+
private:
uint32_t m_maxAmpduLength; //!< Maximum length in bytes of A-MPDUs
};
-} // namespace ns3
+} //namespace ns3
#endif /* MPDU_STANDARD_AGGREGATOR_H */
--- a/src/wifi/model/msdu-aggregator.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/msdu-aggregator.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#include "ns3/log.h"
#include "msdu-aggregator.h"
@@ -74,4 +75,4 @@
return set;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/msdu-aggregator.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/msdu-aggregator.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,15 +17,14 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#ifndef MSDU_AGGREGATOR_H
#define MSDU_AGGREGATOR_H
#include "ns3/ptr.h"
#include "ns3/packet.h"
#include "ns3/object.h"
-
#include "amsdu-subframe-header.h"
-
#include <list>
namespace ns3 {
@@ -53,6 +52,6 @@
static DeaggregatedMsdus Deaggregate (Ptr<Packet> aggregatedPacket);
};
-} // namespace ns3
+} //namespace ns3
#endif /* MSDU_AGGREGATOR_H */
--- a/src/wifi/model/msdu-standard-aggregator.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/msdu-standard-aggregator.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,9 +17,9 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#include "ns3/log.h"
#include "ns3/uinteger.h"
-
#include "amsdu-subframe-header.h"
#include "msdu-standard-aggregator.h"
@@ -88,4 +88,4 @@
return (4 - (packet->GetSize () % 4 )) % 4;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/msdu-standard-aggregator.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/msdu-standard-aggregator.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#ifndef MSDU_STANDARD_AGGREGATOR_H
#define MSDU_STANDARD_AGGREGATOR_H
@@ -40,7 +41,9 @@
* \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>.
- * \return true if the packet can be aggregated, false otherwise
+ *
+ * \return true if the packet can be aggregated,
+ * false otherwise
*
* This method performs an MSDU aggregation.
* Returns true if <i>packet</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
@@ -48,12 +51,13 @@
virtual bool Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket,
Mac48Address src, Mac48Address dest);
private:
- /**
+ /**
* Calculates how much padding must be added to the end of aggregated packet,
* after that a new packet is added.
* Each A-MSDU subframe is padded so that its length is multiple of 4 octets.
*
* \param packet
+ *
* \return the number of octets required for padding
*/
uint32_t CalculatePadding (Ptr<const Packet> packet);
@@ -61,6 +65,6 @@
uint32_t m_maxAmsduLength;
};
-} // namespace ns3
+} //namespace ns3
#endif /* MSDU_STANDARD_AGGREGATOR_H */
--- a/src/wifi/model/nist-error-rate-model.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/nist-error-rate-model.cc Sun Jun 21 00:23:45 2015 +0200
@@ -120,60 +120,60 @@
{
//code rate 1/2, use table 3.1.1
pe = 0.5 * (36.0 * std::pow (D, 10)
- + 211.0 * std::pow (D, 12)
- + 1404.0 * std::pow (D, 14)
- + 11633.0 * std::pow (D, 16)
- + 77433.0 * std::pow (D, 18)
- + 502690.0 * std::pow (D, 20)
- + 3322763.0 * std::pow (D, 22)
- + 21292910.0 * std::pow (D, 24)
- + 134365911.0 * std::pow (D, 26));
+ + 211.0 * std::pow (D, 12)
+ + 1404.0 * std::pow (D, 14)
+ + 11633.0 * std::pow (D, 16)
+ + 77433.0 * std::pow (D, 18)
+ + 502690.0 * std::pow (D, 20)
+ + 3322763.0 * std::pow (D, 22)
+ + 21292910.0 * std::pow (D, 24)
+ + 134365911.0 * std::pow (D, 26));
}
else if (bValue == 2)
{
//code rate 2/3, use table 3.1.2
pe = 1.0 / (2.0 * bValue) *
- (3.0 * std::pow (D, 6)
- + 70.0 * std::pow (D, 7)
- + 285.0 * std::pow (D, 8)
- + 1276.0 * std::pow (D, 9)
- + 6160.0 * std::pow (D, 10)
- + 27128.0 * std::pow (D, 11)
- + 117019.0 * std::pow (D, 12)
- + 498860.0 * std::pow (D, 13)
- + 2103891.0 * std::pow (D, 14)
- + 8784123.0 * std::pow (D, 15));
+ (3.0 * std::pow (D, 6)
+ + 70.0 * std::pow (D, 7)
+ + 285.0 * std::pow (D, 8)
+ + 1276.0 * std::pow (D, 9)
+ + 6160.0 * std::pow (D, 10)
+ + 27128.0 * std::pow (D, 11)
+ + 117019.0 * std::pow (D, 12)
+ + 498860.0 * std::pow (D, 13)
+ + 2103891.0 * std::pow (D, 14)
+ + 8784123.0 * std::pow (D, 15));
}
else if (bValue == 3)
{
//code rate 3/4, use table 3.1.2
pe = 1.0 / (2.0 * bValue) *
- (42.0 * std::pow (D, 5)
- + 201.0 * std::pow (D, 6)
- + 1492.0 * std::pow (D, 7)
- + 10469.0 * std::pow (D, 8)
- + 62935.0 * std::pow (D, 9)
- + 379644.0 * std::pow (D, 10)
- + 2253373.0 * std::pow (D, 11)
- + 13073811.0 * std::pow (D, 12)
- + 75152755.0 * std::pow (D, 13)
- + 428005675.0 * std::pow (D, 14));
+ (42.0 * std::pow (D, 5)
+ + 201.0 * std::pow (D, 6)
+ + 1492.0 * std::pow (D, 7)
+ + 10469.0 * std::pow (D, 8)
+ + 62935.0 * std::pow (D, 9)
+ + 379644.0 * std::pow (D, 10)
+ + 2253373.0 * std::pow (D, 11)
+ + 13073811.0 * std::pow (D, 12)
+ + 75152755.0 * std::pow (D, 13)
+ + 428005675.0 * std::pow (D, 14));
}
else if (bValue == 5)
{
//code rate 5/6, use table V from D. Haccoun and G. Begin, "High-Rate Punctured Convolutional Codes
//for Viterbi Sequential Decoding", IEEE Transactions on Communications, Vol. 32, Issue 3, pp.315-319.
pe = 1.0 / (2.0 * bValue) *
- (92.0 * std::pow (D, 4.0)
- + 528.0 * std::pow (D, 5.0)
- + 8694.0 * std::pow (D, 6.0)
- + 79453.0 * std::pow (D, 7.0)
- + 792114.0 * std::pow (D, 8.0)
- + 7375573.0 * std::pow (D, 9.0)
- + 67884974.0 * std::pow (D, 10.0)
- + 610875423.0 * std::pow (D, 11.0)
- + 5427275376.0 * std::pow (D, 12.0)
- + 47664215639.0 * std::pow (D, 13.0));
+ (92.0 * std::pow (D, 4.0)
+ + 528.0 * std::pow (D, 5.0)
+ + 8694.0 * std::pow (D, 6.0)
+ + 79453.0 * std::pow (D, 7.0)
+ + 792114.0 * std::pow (D, 8.0)
+ + 7375573.0 * std::pow (D, 9.0)
+ + 67884974.0 * std::pow (D, 10.0)
+ + 610875423.0 * std::pow (D, 11.0)
+ + 5427275376.0 * std::pow (D, 12.0)
+ + 47664215639.0 * std::pow (D, 13.0));
}
else
{
@@ -217,7 +217,7 @@
{
if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM
|| mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM
- || mode.GetModulationClass ()== WIFI_MOD_CLASS_HT)
+ || mode.GetModulationClass () == WIFI_MOD_CLASS_HT)
{
if (mode.GetConstellationSize () == 2)
{
@@ -303,4 +303,4 @@
return 0;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/nist-error-rate-model.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/nist-error-rate-model.h Sun Jun 21 00:23:45 2015 +0200
@@ -47,7 +47,6 @@
private:
-
/**
* Return the coded BER for the given p and b.
*
@@ -135,6 +134,6 @@
uint32_t bValue) const;
};
-} // namespace ns3
+} //namespace ns3
#endif /* NIST_ERROR_RATE_MODEL_H */
--- a/src/wifi/model/onoe-wifi-manager.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/onoe-wifi-manager.cc Sun Jun 21 00:23:45 2015 +0200
@@ -47,7 +47,6 @@
uint32_t m_txrate;
};
-
NS_OBJECT_ENSURE_REGISTERED (OnoeWifiManager);
TypeId
@@ -77,6 +76,7 @@
OnoeWifiManager::OnoeWifiManager ()
{
}
+
WifiRemoteStation *
OnoeWifiManager::DoCreateStation (void) const
{
@@ -91,28 +91,33 @@
station->m_txrate = 0;
return station;
}
+
void
OnoeWifiManager::DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode)
{
}
+
void
OnoeWifiManager::DoReportRtsFailed (WifiRemoteStation *st)
{
OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
station->m_shortRetry++;
}
+
void
OnoeWifiManager::DoReportDataFailed (WifiRemoteStation *st)
{
OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
station->m_longRetry++;
}
+
void
OnoeWifiManager::DoReportRtsOk (WifiRemoteStation *station,
double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
}
+
void
OnoeWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
@@ -121,6 +126,7 @@
UpdateRetry (station);
station->m_tx_ok++;
}
+
void
OnoeWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *st)
{
@@ -128,6 +134,7 @@
UpdateRetry (station);
station->m_tx_err++;
}
+
void
OnoeWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
{
@@ -135,6 +142,7 @@
UpdateRetry (station);
station->m_tx_err++;
}
+
void
OnoeWifiManager::UpdateRetry (OnoeWifiRemoteStation *station)
{
@@ -142,6 +150,7 @@
station->m_shortRetry = 0;
station->m_longRetry = 0;
}
+
void
OnoeWifiManager::UpdateMode (OnoeWifiRemoteStation *station)
{
@@ -226,7 +235,7 @@
WifiTxVector
OnoeWifiManager::DoGetDataTxVector (WifiRemoteStation *st,
- uint32_t size)
+ uint32_t size)
{
OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
UpdateMode (station);
@@ -269,15 +278,16 @@
rateIndex = station->m_txrate;
}
}
- return WifiTxVector (GetSupported (station, rateIndex), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station));
+ return WifiTxVector (GetSupported (station, rateIndex), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
}
+
WifiTxVector
OnoeWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
{
OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
UpdateMode (station);
/// \todo can we implement something smarter ?
- return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station));
+ return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
}
bool
@@ -286,4 +296,4 @@
return false;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/onoe-wifi-manager.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/onoe-wifi-manager.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef ONOE_WIFI_MANAGER_H
#define ONOE_WIFI_MANAGER_H
@@ -45,8 +46,9 @@
OnoeWifiManager ();
+
private:
- // overriden from base class
+ //overriden from base class
virtual WifiRemoteStation * DoCreateStation (void) const;
virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
@@ -75,6 +77,6 @@
uint32_t m_raiseThreshold;
};
-} // namespace ns3
+} //namespace ns3
#endif /* ONOE_WIFI_MANAGER_H */
--- a/src/wifi/model/originator-block-ack-agreement.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/originator-block-ack-agreement.cc Sun Jun 21 00:23:45 2015 +0200
@@ -15,9 +15,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Mirko Banchi <mk.banchi@gmail.com>
- * Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
+ * Authors: Mirko Banchi <mk.banchi@gmail.com>
+ * Tommaso Pecorella <tommaso.pecorella@unifi.it>
*/
+
#include "originator-block-ack-agreement.h"
namespace ns3 {
@@ -29,6 +30,7 @@
m_needBlockAckReq (false)
{
}
+
OriginatorBlockAckAgreement::OriginatorBlockAckAgreement (Mac48Address recipient, uint8_t tid)
: BlockAckAgreement (recipient, tid),
m_state (PENDING),
@@ -36,9 +38,11 @@
m_needBlockAckReq (false)
{
}
+
OriginatorBlockAckAgreement::~OriginatorBlockAckAgreement ()
{
}
+
void
OriginatorBlockAckAgreement::SetState (enum State state)
{
@@ -49,26 +53,31 @@
m_sentMpdus = 0;
}
}
+
bool
OriginatorBlockAckAgreement::IsPending (void) const
{
return (m_state == PENDING) ? true : false;
}
+
bool
OriginatorBlockAckAgreement::IsEstablished (void) const
{
return (m_state == ESTABLISHED) ? true : false;
}
+
bool
OriginatorBlockAckAgreement::IsInactive (void) const
{
return (m_state == INACTIVE) ? true : false;
}
+
bool
OriginatorBlockAckAgreement::IsUnsuccessful (void) const
{
return (m_state == UNSUCCESSFUL) ? true : false;
}
+
void
OriginatorBlockAckAgreement::NotifyMpduTransmission (uint16_t nextSeqNumber)
{
@@ -81,11 +90,13 @@
m_needBlockAckReq = true;
}
}
+
bool
OriginatorBlockAckAgreement::IsBlockAckRequestNeeded (void) const
{
return m_needBlockAckReq;
}
+
void
OriginatorBlockAckAgreement::CompleteExchange (void)
{
@@ -93,4 +104,4 @@
m_sentMpdus = 0;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/originator-block-ack-agreement.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/originator-block-ack-agreement.h Sun Jun 21 00:23:45 2015 +0200
@@ -33,6 +33,8 @@
class OriginatorBlockAckAgreement : public BlockAckAgreement
{
friend class BlockAckManager;
+
+
public:
OriginatorBlockAckAgreement ();
OriginatorBlockAckAgreement (Mac48Address recipient, uint8_t tid);
@@ -138,12 +140,13 @@
bool IsBlockAckRequestNeeded (void) const;
void CompleteExchange (void);
+
private:
enum State m_state;
uint16_t m_sentMpdus;
bool m_needBlockAckReq;
};
-} // namespace ns3
+} //namespace ns3
#endif /* ORIGINATOR_BLOCK_ACK_AGREEMENT_H */
--- a/src/wifi/model/parf-wifi-manager.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/parf-wifi-manager.cc Sun Jun 21 00:23:45 2015 +0200
@@ -29,7 +29,6 @@
NS_LOG_COMPONENT_DEFINE ("ns3::ParfWifiManager");
-
namespace ns3 {
/**
@@ -40,19 +39,16 @@
*/
struct ParfWifiRemoteStation : public WifiRemoteStation
{
- uint32_t m_nAttempt; //!< Number of transmission attempts.
- uint32_t m_nSuccess; //!< Number of successful transmission attempts.
- uint32_t m_nFail; //!< Number of failed transmission attempts.
- bool m_usingRecoveryRate; //!< If using recovery rate.
+ uint32_t m_nAttempt; //!< Number of transmission attempts.
+ uint32_t m_nSuccess; //!< Number of successful transmission attempts.
+ uint32_t m_nFail; //!< Number of failed transmission attempts.
+ bool m_usingRecoveryRate; //!< If using recovery rate.
bool m_usingRecoveryPower; //!< If using recovery power.
- uint32_t m_nRetry; //!< Number of transmission retries.
-
- uint32_t m_currentRate; //!< Current rate used by the remote station.
-
- uint8_t m_currentPower; //!< Current power used by the remote station.
-
- uint32_t m_nSupported; //!< Number of supported rates by the remote station.
- bool m_initialized; //!< For initializing variables.
+ uint32_t m_nRetry; //!< Number of transmission retries.
+ uint32_t m_currentRate; //!< Current rate used by the remote station.
+ uint8_t m_currentPower; //!< Current power used by the remote station.
+ uint32_t m_nSupported; //!< Number of supported rates by the remote station.
+ bool m_initialized; //!< For initializing variables.
};
NS_OBJECT_ENSURE_REGISTERED (ParfWifiManager);
@@ -90,6 +86,7 @@
{
NS_LOG_FUNCTION (this);
}
+
ParfWifiManager::~ParfWifiManager ()
{
NS_LOG_FUNCTION (this);
@@ -141,6 +138,7 @@
{
NS_LOG_FUNCTION (this << station);
}
+
/**
* \internal
* It is important to realize that "recovery" mode starts after failure of
@@ -169,7 +167,7 @@
NS_ASSERT (station->m_nRetry >= 1);
if (station->m_nRetry == 1)
{
- // need recovery fallback
+ //need recovery fallback
if (station->m_currentRate != 0)
{
NS_LOG_DEBUG ("station=" << station << " dec rate");
@@ -185,7 +183,7 @@
NS_ASSERT (station->m_nRetry >= 1);
if (station->m_nRetry == 1)
{
- // need recovery fallback
+ //need recovery fallback
if (station->m_currentPower < m_nPower - 1)
{
NS_LOG_DEBUG ("station=" << station << " inc power");
@@ -201,7 +199,7 @@
NS_ASSERT (station->m_nRetry >= 1);
if (((station->m_nRetry - 1) % 2) == 1)
{
- // need normal fallback
+ //need normal fallback
if (station->m_currentPower == m_nPower - 1)
{
if (station->m_currentRate != 0)
@@ -224,18 +222,21 @@
}
}
}
+
void
ParfWifiManager::DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode)
{
NS_LOG_FUNCTION (this << station << rxSnr << txMode);
}
+
void ParfWifiManager::DoReportRtsOk (WifiRemoteStation *station,
double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
NS_LOG_FUNCTION (this << station << ctsSnr << ctsMode << rtsSnr);
NS_LOG_DEBUG ("station=" << station << " rts ok");
}
+
void ParfWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
{
@@ -274,11 +275,13 @@
station->m_usingRecoveryPower = true;
}
}
+
void
ParfWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
{
NS_LOG_FUNCTION (this << station);
}
+
void
ParfWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
{
@@ -291,8 +294,9 @@
NS_LOG_FUNCTION (this << st << size);
ParfWifiRemoteStation *station = (ParfWifiRemoteStation *) st;
CheckInit (station);
- return WifiTxVector (GetSupported (station, station->m_currentRate), station->m_currentPower, GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas ()), GetNumberOfTransmitAntennas (station), GetStbc (station));
+ return WifiTxVector (GetSupported (station, station->m_currentRate), station->m_currentPower, GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNumberOfTransmitAntennas (station), GetStbc (station));
}
+
WifiTxVector
ParfWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
{
@@ -300,7 +304,7 @@
/// \todo we could/should implement the Arf algorithm for
/// RTS only by picking a single rate within the BasicRateSet.
ParfWifiRemoteStation *station = (ParfWifiRemoteStation *) st;
- return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas ()), GetNumberOfTransmitAntennas (station), GetStbc (station));
+ return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNumberOfTransmitAntennas (station), GetStbc (station));
}
bool
@@ -309,4 +313,5 @@
NS_LOG_FUNCTION (this);
return true;
}
-} // namespace ns3
+
+} //namespace ns3
--- a/src/wifi/model/parf-wifi-manager.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/parf-wifi-manager.h Sun Jun 21 00:23:45 2015 +0200
@@ -57,7 +57,6 @@
* \param [in] address The remote station MAC address.
*/
typedef void (*PowerChangeTracedCallback)(const uint8_t power, const Mac48Address remoteAddress);
-
/**
* TracedCallback signature for rate change events.
*
@@ -66,8 +65,9 @@
*/
typedef void (*RateChangeTracedCallback)(const uint32_t rate, const Mac48Address remoteAddress);
+
private:
- // overriden from base class
+ //overriden from base class
virtual WifiRemoteStation * DoCreateStation (void) const;
virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
@@ -89,7 +89,6 @@
*/
void CheckInit (ParfWifiRemoteStation *station);
-
uint32_t m_attemptThreshold; //!< The minimum number of transmission attempts to try a new power or rate. The 'timer' threshold in the ARF algorithm.
uint32_t m_successThreshold; //!< The minimum number of successful transmissions to try a new power or rate.
/**
@@ -110,6 +109,6 @@
};
-} // namespace ns3
+} //namespace ns3
#endif /* PARF_WIFI_MANAGER_H */
--- a/src/wifi/model/qos-blocked-destinations.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/qos-blocked-destinations.cc Sun Jun 21 00:23:45 2015 +0200
@@ -18,6 +18,7 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#include "qos-blocked-destinations.h"
namespace ns3 {
@@ -65,4 +66,4 @@
}
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/qos-blocked-destinations.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/qos-blocked-destinations.h Sun Jun 21 00:23:45 2015 +0200
@@ -18,6 +18,7 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#ifndef QOS_BLOCKED_DESTINATIONS_H
#define QOS_BLOCKED_DESTINATIONS_H
@@ -58,11 +59,13 @@
*
* \param dest
* \param tid
- * \return true if the given destination address and TID are blocked
- * from sending, false otherwise
+ *
+ * \return true if the given destination address and TID are blocked from sending,
+ * false otherwise
*/
bool IsBlocked (Mac48Address dest, uint8_t tid) const;
+
private:
/**
* typedef for a list of <Mac48Address, TID> pair.
@@ -79,6 +82,6 @@
BlockedPackets m_blockedQosPackets;
};
-} // namespace ns3
+} //namespace ns3
#endif /* QOS_BLOCKED_DESTINATIONS_H */
--- a/src/wifi/model/qos-tag.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/qos-tag.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#include "qos-tag.h"
#include "ns3/tag.h"
#include "ns3/uinteger.h"
--- a/src/wifi/model/qos-tag.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/qos-tag.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#ifndef QOS_TAG_H
#define QOS_TAG_H
@@ -48,7 +49,6 @@
};
-
/**
* \ingroup wifi
*
@@ -81,7 +81,7 @@
* application is aware of the QoS support provided by the MAC
* layer, and is therefore able to set the correct TID.
*
- * @param tid the value of the TID to set
+ * \param tid the value of the TID to set
*/
void SetTid (uint8_t tid);
@@ -92,7 +92,7 @@
* EDCA is used. When using HDCA, QosTag(uint8_t tid) should be used
* instead.
*
- * @param up the requested UserPriority
+ * \param up the requested UserPriority
*
*/
void SetUserPriority (UserPriority up);
@@ -113,6 +113,6 @@
uint8_t m_tid; //!< Traffic ID
};
-} // namespace ns3
+} //namespace ns3
#endif /* QOS_TAG_H */
--- a/src/wifi/model/qos-utils.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/qos-utils.cc Sun Jun 21 00:23:45 2015 +0200
@@ -15,9 +15,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Mirko Banchi <mk.banchi@gmail.com>
- * Author: Cecchi Niccolò <insa@igeek.it>
+ * Authors: Mirko Banchi <mk.banchi@gmail.com>
+ * Cecchi Niccolò <insa@igeek.it>
*/
+
#include "qos-utils.h"
#include "qos-tag.h"
@@ -91,4 +92,4 @@
return (distance >= 2048);
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/qos-utils.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/qos-utils.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#ifndef QOS_UTILS_H
#define QOS_UTILS_H
@@ -42,7 +43,6 @@
AC_VI = 2,
/** Voice */
AC_VO = 3,
-
/** Total number of ACs */
AC_BE_NQOS = 4,
AC_UNDEF
@@ -64,6 +64,7 @@
* A value >= 8 is returned otherwise.
*
* \param packet the packet to checked for a QoS tag
+ *
* \return a value less than 8 if QoS tag was present, a value >= 8
* is returned if no QoS tag was present
*/
@@ -77,6 +78,7 @@
*
* \param seqControl the sequence control field
* \param endSequence
+ *
* \return a unique integer for the given sequence control and end sequence
*/
uint32_t QosUtilsMapSeqControlToUniqueInteger (uint16_t seqControl, uint16_t endSequence);
@@ -115,10 +117,11 @@
*
* \param startingSeq the starting sequence number
* \param seqNumber the sequence number to be checked
+ *
* \return true if the packet is old, false otherwise
*/
bool QosUtilsIsOldPacket (uint16_t startingSeq, uint16_t seqNumber);
-} // namespace ns3
+} //namespace ns3
#endif /* QOS_UTILS_H */
--- a/src/wifi/model/random-stream.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/random-stream.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,9 +17,9 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#include "random-stream.h"
#include "ns3/assert.h"
-
#include <cmath>
namespace ns3 {
@@ -68,4 +68,4 @@
return 0;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/random-stream.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/random-stream.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef RANDOM_STREAM_H
#define RANDOM_STREAM_H
@@ -39,42 +40,48 @@
*
* \param min lower bound (inclusive)
* \param max upper bound (inclusive)
+ *
* \return a random number between min and max (including min and max)
*/
virtual uint32_t GetNext (uint32_t min, uint32_t max) = 0;
- /**
- * Assign a fixed random variable stream number to the random variables
- * used by this model. Return the number of streams (possibly zero) that
- * have been assigned.
- *
- * \param stream first stream index to use
- * \return the number of stream indices assigned by this model
- */
+ /**
+ * Assign a fixed random variable stream number to the random variables
+ * used by this model. Return the number of streams (possibly zero) that
+ * have been assigned.
+ *
+ * \param stream first stream index to use
+ *
+ * \return the number of stream indices assigned by this model
+ */
virtual int64_t AssignStreams (int64_t stream) = 0;
};
+
class RealRandomStream : public RandomStream
{
public:
RealRandomStream ();
virtual uint32_t GetNext (uint32_t min, uint32_t max);
- /**
- * Assign a fixed random variable stream number to the random variables
- * used by this model. Return the number of streams (possibly zero) that
- * have been assigned.
- *
- * \param stream first stream index to use
- * \return the number of stream indices assigned by this model
- */
+ /**
+ * Assign a fixed random variable stream number to the random variables
+ * used by this model. Return the number of streams (possibly zero) that
+ * have been assigned.
+ *
+ * \param stream first stream index to use
+ *
+ * \return the number of stream indices assigned by this model
+ */
virtual int64_t AssignStreams (int64_t stream);
+
private:
/// Provides uniform random variables.
Ptr<UniformRandomVariable> m_stream;
};
+
class TestRandomStream : public RandomStream
{
public:
@@ -86,20 +93,22 @@
void AddNext (uint32_t v);
virtual uint32_t GetNext (uint32_t min, uint32_t max);
- /**
- * Assign a fixed random variable stream number to the random variables
- * used by this model. Return the number of streams (possibly zero) that
- * have been assigned.
- *
- * \param stream first stream index to use
- * \return the number of stream indices assigned by this model
- */
+ /**
+ * Assign a fixed random variable stream number to the random variables
+ * used by this model. Return the number of streams (possibly zero) that
+ * have been assigned.
+ *
+ * \param stream first stream index to use
+ *
+ * \return the number of stream indices assigned by this model
+ */
virtual int64_t AssignStreams (int64_t stream);
+
private:
std::list<uint32_t> m_nexts;
};
-} // namespace ns3
+} //namespace ns3
#endif /* RANDOM_STREAM_H */
--- a/src/wifi/model/regular-wifi-mac.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/regular-wifi-mac.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,21 +17,19 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#include "regular-wifi-mac.h"
-
#include "ns3/log.h"
#include "ns3/boolean.h"
#include "ns3/pointer.h"
#include "ns3/uinteger.h"
#include "ns3/trace-source-accessor.h"
-
#include "mac-rx-middle.h"
#include "mac-tx-middle.h"
#include "mac-low.h"
#include "dcf.h"
#include "dcf-manager.h"
#include "wifi-phy.h"
-
#include "msdu-aggregator.h"
namespace ns3 {
@@ -57,13 +55,13 @@
m_dca = CreateObject<DcaTxop> ();
m_dca->SetLow (m_low);
m_dca->SetManager (m_dcfManager);
- m_dca->SetTxMiddle(m_txMiddle);
+ m_dca->SetTxMiddle (m_txMiddle);
m_dca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this));
m_dca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this));
- // Construct the EDCAFs. The ordering is important - highest
- // priority (Table 9-1 UP-to-AC mapping; IEEE 802.11-2012) must be created
- // first.
+ //Construct the EDCAFs. The ordering is important - highest
+ //priority (Table 9-1 UP-to-AC mapping; IEEE 802.11-2012) must be created
+ //first.
SetupEdcaQueue (AC_VO);
SetupEdcaQueue (AC_VI);
SetupEdcaQueue (AC_BE);
@@ -79,7 +77,6 @@
RegularWifiMac::DoInitialize ()
{
NS_LOG_FUNCTION (this);
-
m_dca->Initialize ();
for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i)
@@ -121,7 +118,7 @@
{
NS_LOG_FUNCTION (this << stationManager);
m_stationManager = stationManager;
- m_stationManager->SetHtSupported (GetHtSupported());
+ m_stationManager->SetHtSupported (GetHtSupported ());
m_low->SetWifiRemoteStationManager (stationManager);
m_dca->SetWifiRemoteStationManager (stationManager);
@@ -143,8 +140,8 @@
{
NS_LOG_FUNCTION (this << ac);
- // Our caller shouldn't be attempting to setup a queue that is
- // already configured.
+ //Our caller shouldn't be attempting to setup a queue that is
+ //already configured.
NS_ASSERT (m_edca.find (ac) == m_edca.end ());
Ptr<EdcaTxopN> edca = CreateObject<EdcaTxopN> ();
@@ -256,6 +253,7 @@
{
return m_qosSupported;
}
+
void
RegularWifiMac::SetHtSupported (bool enable)
{
@@ -268,8 +266,9 @@
{
return m_htSupported;
}
+
void
-RegularWifiMac::SetCtsToSelfSupported(bool enable)
+RegularWifiMac::SetCtsToSelfSupported (bool enable)
{
NS_LOG_FUNCTION (this);
m_low->SetCtsToSelfSupported (enable);
@@ -278,7 +277,7 @@
bool
RegularWifiMac::GetCtsToSelfSupported () const
{
- return m_low->GetCtsToSelfSupported ();
+ return m_low->GetCtsToSelfSupported ();
}
void
@@ -321,6 +320,7 @@
{
return m_dcfManager->GetEifsNoDifs ();
}
+
void
RegularWifiMac::SetRifs (Time rifs)
{
@@ -331,7 +331,7 @@
Time
RegularWifiMac::GetRifs (void) const
{
- return m_low->GetRifs();
+ return m_low->GetRifs ();
}
void
@@ -448,10 +448,10 @@
RegularWifiMac::Enqueue (Ptr<const Packet> packet,
Mac48Address to, Mac48Address from)
{
- // We expect RegularWifiMac subclasses which do support forwarding (e.g.,
- // AP) to override this method. Therefore, we throw a fatal error if
- // someone tries to invoke this method on a class which has not done
- // this.
+ //We expect RegularWifiMac subclasses which do support forwarding (e.g.,
+ //AP) to override this method. Therefore, we throw a fatal error if
+ //someone tries to invoke this method on a class which has not done
+ //this.
NS_FATAL_ERROR ("This MAC entity (" << this << ", " << GetAddress ()
<< ") does not support Enqueue() with from address");
}
@@ -477,12 +477,12 @@
Mac48Address to = hdr->GetAddr1 ();
Mac48Address from = hdr->GetAddr2 ();
- // We don't know how to deal with any frame that is not addressed to
- // us (and odds are there is nothing sensible we could do anyway),
- // so we ignore such frames.
+ //We don't know how to deal with any frame that is not addressed to
+ //us (and odds are there is nothing sensible we could do anyway),
+ //so we ignore such frames.
//
- // The derived class may also do some such filtering, but it doesn't
- // hurt to have it here too as a backstop.
+ //The derived class may also do some such filtering, but it doesn't
+ //hurt to have it here too as a backstop.
if (to != GetAddress ())
{
return;
@@ -490,8 +490,8 @@
if (hdr->IsMgt () && hdr->IsAction ())
{
- // There is currently only any reason for Management Action
- // frames to be flying about if we are a QoS STA.
+ //There is currently only any reason for Management Action
+ //frames to be flying about if we are a QoS STA.
NS_ASSERT (m_qosSupported);
WifiActionHeader actionHdr;
@@ -508,31 +508,29 @@
MgtAddBaRequestHeader reqHdr;
packet->RemoveHeader (reqHdr);
- // We've received an ADDBA Request. Our policy here is
- // to automatically accept it, so we get the ADDBA
- // Response on it's way immediately.
+ //We've received an ADDBA Request. Our policy here is
+ //to automatically accept it, so we get the ADDBA
+ //Response on it's way immediately.
SendAddBaResponse (&reqHdr, from);
- // This frame is now completely dealt with, so we're done.
+ //This frame is now completely dealt with, so we're done.
return;
}
-
case WifiActionHeader::BLOCK_ACK_ADDBA_RESPONSE:
{
MgtAddBaResponseHeader respHdr;
packet->RemoveHeader (respHdr);
- // We've received an ADDBA Response. We assume that it
- // indicates success after an ADDBA Request we have
- // sent (we could, in principle, check this, but it
- // seems a waste given the level of the current model)
- // and act by locally establishing the agreement on
- // the appropriate queue.
+ //We've received an ADDBA Response. We assume that it
+ //indicates success after an ADDBA Request we have
+ //sent (we could, in principle, check this, but it
+ //seems a waste given the level of the current model)
+ //and act by locally establishing the agreement on
+ //the appropriate queue.
AcIndex ac = QosUtilsMapTidToAc (respHdr.GetTid ());
m_edca[ac]->GotAddBaResponse (&respHdr, from);
- // This frame is now completely dealt with, so we're done.
+ //This frame is now completely dealt with, so we're done.
return;
}
-
case WifiActionHeader::BLOCK_ACK_DELBA:
{
MgtDelBaHeader delBaHdr;
@@ -540,30 +538,27 @@
if (delBaHdr.IsByOriginator ())
{
- // This DELBA frame was sent by the originator, so
- // this means that an ingoing established
- // agreement exists in MacLow and we need to
- // destroy it.
+ //This DELBA frame was sent by the originator, so
+ //this means that an ingoing established
+ //agreement exists in MacLow and we need to
+ //destroy it.
m_low->DestroyBlockAckAgreement (from, delBaHdr.GetTid ());
}
else
{
- // We must have been the originator. We need to
- // tell the correct queue that the agreement has
- // been torn down
+ //We must have been the originator. We need to
+ //tell the correct queue that the agreement has
+ //been torn down
AcIndex ac = QosUtilsMapTidToAc (delBaHdr.GetTid ());
m_edca[ac]->GotDelBaFrame (&delBaHdr, from);
}
- // This frame is now completely dealt with, so we're done.
+ //This frame is now completely dealt with, so we're done.
return;
}
-
default:
NS_FATAL_ERROR ("Unsupported Action field in Block Ack Action frame");
return;
}
-
-
default:
NS_FATAL_ERROR ("Unsupported Action frame received");
return;
@@ -616,13 +611,12 @@
respHdr.SetDelayedBlockAck ();
}
respHdr.SetTid (reqHdr->GetTid ());
- // For now there's not no control about limit of reception. We
- // assume that receiver has no limit on reception. However we assume
- // that a receiver sets a bufferSize in order to satisfy next
- // equation: (bufferSize + 1) % 16 = 0 So if a recipient is able to
- // buffer a packet, it should be also able to buffer all possible
- // packet's fragments. See section 7.3.1.14 in IEEE802.11e for more
- // details.
+ //For now there's not no control about limit of reception. We
+ //assume that receiver has no limit on reception. However we assume
+ //that a receiver sets a bufferSize in order to satisfy next
+ //equation: (bufferSize + 1) % 16 = 0 So if a recipient is able to
+ //buffer a packet, it should be also able to buffer all possible
+ //packet's fragments. See section 7.3.1.14 in IEEE802.11e for more details.
respHdr.SetBufferSize (1023);
respHdr.SetTimeout (reqHdr->GetTimeout ());
@@ -635,14 +629,14 @@
packet->AddHeader (respHdr);
packet->AddHeader (actionHdr);
- // We need to notify our MacLow object as it will have to buffer all
- // correctly received packets for this Block Ack session
+ //We need to notify our MacLow object as it will have to buffer all
+ //correctly received packets for this Block Ack session
m_low->CreateBlockAckAgreement (&respHdr, originator,
reqHdr->GetStartingSequence ());
- // It is unclear which queue this frame should go into. For now we
- // bung it into the queue corresponding to the TID for which we are
- // establishing an agreement, and push it to the head.
+ //It is unclear which queue this frame should go into. For now we
+ //bung it into the queue corresponding to the TID for which we are
+ //establishing an agreement, and push it to the head.
m_edca[QosUtilsMapTidToAc (reqHdr->GetTid ())]->PushFront (packet, hdr);
}
@@ -664,12 +658,12 @@
MakeBooleanAccessor (&RegularWifiMac::SetHtSupported,
&RegularWifiMac::GetHtSupported),
MakeBooleanChecker ())
- .AddAttribute ("CtsToSelfSupported",
+ .AddAttribute ("CtsToSelfSupported",
"Use CTS to Self when using a rate that is not in the basic set rate",
BooleanValue (false),
MakeBooleanAccessor (&RegularWifiMac::SetCtsToSelfSupported,
&RegularWifiMac::GetCtsToSelfSupported),
- MakeBooleanChecker ())
+ MakeBooleanChecker ())
.AddAttribute ("DcaTxop", "The DcaTxop object",
PointerValue (),
MakePointerAccessor (&RegularWifiMac::GetDcaTxop),
@@ -694,8 +688,8 @@
PointerValue (),
MakePointerAccessor (&RegularWifiMac::GetBKQueue),
MakePointerChecker<EdcaTxopN> ())
- .AddTraceSource ( "TxOkHeader",
- "The header of successfully transmitted packet",
+ .AddTraceSource ("TxOkHeader",
+ "The header of successfully transmitted packet",
MakeTraceSourceAccessor (&RegularWifiMac::m_txOkCallback),
"ns3::WifiMacHeader::TracedCallback")
.AddTraceSource ("TxErrHeader",
@@ -703,7 +697,6 @@
MakeTraceSourceAccessor (&RegularWifiMac::m_txErrCallback),
"ns3::WifiMacHeader::TracedCallback")
;
-
return tid;
}
@@ -725,21 +718,19 @@
cwmin = 15;
cwmax = 1023;
break;
-
case WIFI_PHY_STANDARD_80211b:
cwmin = 31;
cwmax = 1023;
break;
-
default:
NS_FATAL_ERROR ("Unsupported WifiPhyStandard in RegularWifiMac::FinishConfigureStandard ()");
}
- // The special value of AC_BE_NQOS which exists in the Access
- // Category enumeration allows us to configure plain old DCF.
+ //The special value of AC_BE_NQOS which exists in the Access
+ //Category enumeration allows us to configure plain old DCF.
ConfigureDcf (m_dca, cwmin, cwmax, AC_BE_NQOS);
- // Now we configure the EDCA functions
+ //Now we configure the EDCA functions
for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i)
{
ConfigureDcf (i->second, cwmin, cwmax, i->first);
@@ -760,4 +751,4 @@
m_txErrCallback (hdr);
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/regular-wifi-mac.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/regular-wifi-mac.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,17 +17,16 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef REGULAR_WIFI_MAC_H
#define REGULAR_WIFI_MAC_H
#include "ns3/wifi-mac.h"
-
#include "dca-txop.h"
#include "edca-txop-n.h"
#include "wifi-remote-station-manager.h"
#include "ssid.h"
#include "qos-utils.h"
-
#include <map>
namespace ns3 {
@@ -74,7 +73,9 @@
* \param pifs the pifs duration.
*/
void SetPifs (Time pifs);
-
+ /**
+ * \param rifs the rifs duration.
+ */
void SetRifs (Time rifs);
/**
* \param ctsTimeout the duration of a CTS timeout.
@@ -115,15 +116,16 @@
* Enable or disable CTS-to-self feature.
*
* \param enable true if CTS-to-self is to be supported,
- * false otherwise
+ * false otherwise
*/
void SetCtsToSelfSupported (bool enable);
-
+
/**
* Return whether the device supports CTS-to-self
* capability.
*
- * \return true if CTS-to-self is supported, false otherwise.
+ * \return true if CTS-to-self is supported,
+ * false otherwise.
*/
bool GetCtsToSelfSupported () const;
/**
@@ -171,6 +173,7 @@
* frames without altering the source address.
*/
virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
+
virtual bool SupportsSendFrom (void) const;
/**
@@ -209,8 +212,7 @@
*
* \param packet the packet that has been received.
* \param from the MAC address of the device that sent the packet.
- * \param to the MAC address ot the device that the packet is
- * destined for.
+ * \param to the MAC address ot the device that the packet is destined for.
*/
typedef Callback<void, Ptr<Packet>, Mac48Address, Mac48Address> ForwardUpCallback;
/**
@@ -226,6 +228,7 @@
* \param linkDown the callback to invoke when the link becomes down.
*/
virtual void SetLinkDownCallback (Callback<void> linkDown);
+
/* Next functions are not pure virtual so non Qos WifiMacs are not
* forced to implement them.
*/
@@ -234,21 +237,22 @@
virtual void SetCompressedBlockAckTimeout (Time blockAckTimeout);
virtual Time GetCompressedBlockAckTimeout (void) const;
+
protected:
virtual void DoInitialize ();
virtual void DoDispose ();
- MacRxMiddle *m_rxMiddle; //!< RX middle (de-fragmentation etc.)
- MacTxMiddle *m_txMiddle; //!< TX middle (aggregation etc.)
- Ptr<MacLow> m_low; //!< MacLow (RTS, CTS, DATA, ACK etc.)
+ MacRxMiddle *m_rxMiddle; //!< RX middle (de-fragmentation etc.)
+ MacTxMiddle *m_txMiddle; //!< TX middle (aggregation etc.)
+ Ptr<MacLow> m_low; //!< MacLow (RTS, CTS, DATA, ACK etc.)
DcfManager *m_dcfManager; //!< DCF manager (access to channel)
- Ptr<WifiPhy> m_phy; //!< Wifi PHY
+ Ptr<WifiPhy> m_phy; //!< Wifi PHY
Ptr<WifiRemoteStationManager> m_stationManager; //!< Remote station manager (rate control, RTS/CTS/fragmentation thresholds etc.)
ForwardUpCallback m_forwardUp; //!< Callback to forward packet up the stack
- Callback<void> m_linkUp; //!< Callback when a link is up
- Callback<void> m_linkDown; //!< Callback when a link is down
+ Callback<void> m_linkUp; //!< Callback when a link is up
+ Callback<void> m_linkDown; //!< Callback when a link is down
Ssid m_ssid; //!< Service Set ID (SSID)
@@ -259,38 +263,39 @@
/** This type defines a mapping between an Access Category index,
and a pointer to the corresponding channel access function */
typedef std::map<AcIndex, Ptr<EdcaTxopN> > EdcaQueues;
+
/** This is a map from Access Category index to the corresponding
channel access function */
EdcaQueues m_edca;
/**
* Accessor for the DCF object
- *
+ *
* \return a smart pointer to DcaTxop
*/
Ptr<DcaTxop> GetDcaTxop (void) const;
/**
* Accessor for the AC_VO channel access function
- *
+ *
* \return a smart pointer to EdcaTxopN
*/
Ptr<EdcaTxopN> GetVOQueue (void) const;
/**
* Accessor for the AC_VI channel access function
- *
+ *
* \return a smart pointer to EdcaTxopN
*/
Ptr<EdcaTxopN> GetVIQueue (void) const;
/**
* Accessor for the AC_BE channel access function
- *
+ *
* \return a smart pointer to EdcaTxopN
*/
Ptr<EdcaTxopN> GetBEQueue (void) const;
/**
* Accessor for the AC_BK channel access function
- *
+ *
* \return a smart pointer to EdcaTxopN
*/
Ptr<EdcaTxopN> GetBKQueue (void) const;
@@ -334,10 +339,10 @@
* \param hdr a pointer to the MAC header of the received frame.
*/
virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
- /**
+ /**
* The packet we sent was successfully received by the receiver
* (i.e. we received an ACK from the receiver).
- *
+ *
* \param hdr the header of the packet that we successfully sent
*/
virtual void TxOk (const WifiMacHeader &hdr);
@@ -392,33 +397,35 @@
* however.
*/
bool m_qosSupported;
+
/**
* Enable or disable QoS support for the device.
*
* \param enable whether QoS is supported
*/
void SetQosSupported (bool enable);
- /**
+ /**
* Return whether the device supports QoS.
*
* \return true if QoS is supported, false otherwise
*/
bool GetQosSupported () const;
- /**
- * This Boolean is set \c true iff this WifiMac is to model
- * 802.11n. It is exposed through the
- * attribute system.
- *
- * At the moment, this flag is the sole selection between HT and
- * non-HT operation for the STA (whether IBSS, AP, or
- * non-AP). Ultimately, we will want a HT-enabled STA to be able to
- * fall back to non-HT operation with a non-HT peer. This'll
- * require further intelligence - i.e., per-association HT
- * state. Having a big switch seems like a good intermediate stage,
- * however.
- */
+ /**
+ * This Boolean is set \c true iff this WifiMac is to model
+ * 802.11n. It is exposed through the
+ * attribute system.
+ *
+ * At the moment, this flag is the sole selection between HT and
+ * non-HT operation for the STA (whether IBSS, AP, or
+ * non-AP). Ultimately, we will want a HT-enabled STA to be able to
+ * fall back to non-HT operation with a non-HT peer. This'll
+ * require further intelligence - i.e., per-association HT
+ * state. Having a big switch seems like a good intermediate stage,
+ * however.
+ */
bool m_htSupported;
+
/**
* Enable or disable HT support for the device.
*
@@ -432,6 +439,7 @@
*/
bool GetHtSupported () const;
+
private:
RegularWifiMac (const RegularWifiMac &);
RegularWifiMac & operator= (const RegularWifiMac &);
@@ -448,6 +456,6 @@
TracedCallback<const WifiMacHeader &> m_txErrCallback;
};
-} // namespace ns3
+} //namespace ns3
#endif /* REGULAR_WIFI_MAC_H */
--- a/src/wifi/model/rraa-wifi-manager.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/rraa-wifi-manager.cc Sun Jun 21 00:23:45 2015 +0200
@@ -189,11 +189,11 @@
RraaWifiManager::RraaWifiManager ()
{
}
+
RraaWifiManager::~RraaWifiManager ()
{
}
-
WifiRemoteStation *
RraaWifiManager::DoCreateStation (void) const
{
@@ -224,13 +224,13 @@
{
return GetNSupported (station) - 1;
}
+
uint32_t
RraaWifiManager::GetMinRate (RraaWifiRemoteStation *station)
{
return 0;
}
-
void
RraaWifiManager::DoReportRtsFailed (WifiRemoteStation *st)
{
@@ -246,17 +246,20 @@
station->m_failed++;
RunBasicAlgorithm (station);
}
+
void
RraaWifiManager::DoReportRxOk (WifiRemoteStation *st,
double rxSnr, WifiMode txMode)
{
}
+
void
RraaWifiManager::DoReportRtsOk (WifiRemoteStation *st,
double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
NS_LOG_DEBUG ("self=" << st << " rts ok");
}
+
void
RraaWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
@@ -267,10 +270,12 @@
station->m_counter--;
RunBasicAlgorithm (station);
}
+
void
RraaWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *st)
{
}
+
void
RraaWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
{
@@ -278,19 +283,20 @@
WifiTxVector
RraaWifiManager::DoGetDataTxVector (WifiRemoteStation *st,
- uint32_t size)
+ uint32_t size)
{
RraaWifiRemoteStation *station = (RraaWifiRemoteStation *) st;
if (!station->m_initialized)
{
ResetCountersBasic (station);
}
- return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station));
+ return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
}
+
WifiTxVector
RraaWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
{
- return WifiTxVector (GetSupported (st, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (st), GetShortGuardInterval (st), Min (GetNumberOfReceiveAntennas (st),GetNumberOfTransmitAntennas()), GetNess (st), GetStbc (st));
+ return WifiTxVector (GetSupported (st, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (st), GetShortGuardInterval (st), Min (GetNumberOfReceiveAntennas (st), GetNumberOfTransmitAntennas ()), GetNess (st), GetStbc (st));
}
bool
@@ -468,4 +474,4 @@
return true;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/rraa-wifi-manager.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/rraa-wifi-manager.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Federico Maguolo <maguolof@dei.unipd.it>
*/
+
#ifndef RRAA_WIFI_MANAGER_H
#define RRAA_WIFI_MANAGER_H
@@ -44,6 +45,7 @@
RraaWifiManager ();
virtual ~RraaWifiManager ();
+
private:
struct ThresholdsItem
{
@@ -53,7 +55,7 @@
uint32_t ewnd;
};
- // overriden from base class
+ //overriden from base class
virtual WifiRemoteStation * DoCreateStation (void) const;
virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
@@ -76,6 +78,7 @@
* the given station.
*
* \param station
+ *
* \return the index for the maximum transmission rate
*/
uint32_t GetMaxRate (RraaWifiRemoteStation *station);
@@ -84,6 +87,7 @@
* the given station.
*
* \param station
+ *
* \return the index for the minimum transmission rate
*/
uint32_t GetMinRate (RraaWifiRemoteStation *station);
@@ -116,6 +120,7 @@
* Get a threshold for the given mode.
*
* \param mode
+ *
* \return threshold
*/
struct ThresholdsItem GetThresholds (WifiMode mode) const;
@@ -124,6 +129,7 @@
*
* \param station
* \param rate
+ *
* \return threshold
*/
struct ThresholdsItem GetThresholds (RraaWifiRemoteStation *station, uint32_t rate) const;
@@ -154,6 +160,6 @@
double m_pmtlfor9;
};
-} // namespace ns3
+} //namespace ns3
#endif /* RRAA_WIFI_MANAGER_H */
--- a/src/wifi/model/snr-tag.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/snr-tag.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,9 +17,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
- * Author: Konstantinos Katsaros <dinos.katsaros@gmail.com>
+ * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Mirko Banchi <mk.banchi@gmail.com>
+ * Konstantinos Katsaros <dinos.katsaros@gmail.com>
*/
#include "snr-tag.h"
@@ -44,6 +44,7 @@
;
return tid;
}
+
TypeId
SnrTag::GetInstanceTypeId (void) const
{
@@ -54,42 +55,46 @@
: m_snr (0)
{
}
+
SnrTag::SnrTag (double snr)
: m_snr (snr)
{
}
-
uint32_t
SnrTag::GetSerializedSize (void) const
{
return sizeof (double);
}
+
void
SnrTag::Serialize (TagBuffer i) const
{
i.WriteDouble (m_snr);
}
+
void
SnrTag::Deserialize (TagBuffer i)
{
m_snr = i.ReadDouble ();
}
+
void
SnrTag::Print (std::ostream &os) const
{
os << "Snr=" << m_snr;
}
+
void
SnrTag::Set (double snr)
{
m_snr = snr;
}
+
double
SnrTag::Get (void) const
{
return m_snr;
}
-
}
--- a/src/wifi/model/snr-tag.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/snr-tag.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,9 +17,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
- * Author: Konstantinos Katsaros <dinos.katsaros@gmail.com>
+ * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Mirko Banchi <mk.banchi@gmail.com>
+ * Konstantinos Katsaros <dinos.katsaros@gmail.com>
*/
#ifndef SNR_TAG_H
@@ -38,15 +38,15 @@
virtual TypeId GetInstanceTypeId (void) const;
/**
- * Create a SnrTag with the default snr 0
+ * Create a SnrTag with the default snr 0
*/
- SnrTag();
+ SnrTag ();
/**
* Create a SnrTag with the given snr value
* \param snr the given SNR value
*/
- SnrTag(double snr);
+ SnrTag (double snr);
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (TagBuffer i) const;
@@ -65,10 +65,11 @@
* \return the SNR value
*/
double Get (void) const;
+
+
private:
double m_snr; //!< SNR value
};
-
}
#endif /* SNR_TAG_H */
--- a/src/wifi/model/ssid.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/ssid.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#include "ssid.h"
#include "ns3/assert.h"
@@ -30,6 +31,7 @@
m_ssid[i] = 0;
}
}
+
Ssid::Ssid (std::string s)
{
NS_ASSERT (s.size () < 32);
@@ -49,6 +51,7 @@
len++;
}
}
+
Ssid::Ssid (char const ssid[32], uint8_t length)
{
NS_ASSERT (length <= 32);
@@ -65,6 +68,7 @@
len++;
}
}
+
bool
Ssid::IsEqual (const Ssid& o) const
{
@@ -81,6 +85,7 @@
}
return true;
}
+
bool
Ssid::IsBroadcast (void) const
{
@@ -94,8 +99,8 @@
char *
Ssid::PeekString (void) const
{
- // it is safe to return a pointer to the buffer because it is
- // guaranteed to be zero-terminated.
+ //It is safe to return a pointer to the buffer because it is
+ //guaranteed to be zero-terminated.
return (char *)m_ssid;
}
@@ -117,6 +122,7 @@
NS_ASSERT (m_length <= 32);
start.Write (m_ssid, m_length);
}
+
uint8_t
Ssid::DeserializeInformationField (Buffer::Iterator start,
uint8_t length)
@@ -134,6 +140,7 @@
*
* \param os
* \param ssid
+ *
* \return std::ostream
*/
std::ostream &
@@ -148,6 +155,7 @@
*
* \param is
* \param ssid
+ *
* \return std::istream
*/
std::istream &operator >> (std::istream &is, Ssid &ssid)
@@ -158,5 +166,4 @@
return is;
}
-
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/ssid.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/ssid.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef SSID_H
#define SSID_H
@@ -57,6 +58,7 @@
* Check if the two SSIDs are equal.
*
* \param o SSID to compare to
+ *
* \return true if the two SSIDs are equal,
* false otherwise
*/
@@ -92,6 +94,6 @@
ATTRIBUTE_HELPER_HEADER (Ssid);
-} // namespace ns3
+} //namespace ns3
#endif /* SSID_H */
--- a/src/wifi/model/sta-wifi-mac.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/sta-wifi-mac.cc Sun Jun 21 00:23:45 2015 +0200
@@ -16,18 +16,17 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
+ * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Mirko Banchi <mk.banchi@gmail.com>
*/
+
#include "sta-wifi-mac.h"
-
#include "ns3/log.h"
#include "ns3/simulator.h"
#include "ns3/string.h"
#include "ns3/pointer.h"
#include "ns3/boolean.h"
#include "ns3/trace-source-accessor.h"
-
#include "qos-tag.h"
#include "mac-low.h"
#include "dcf-manager.h"
@@ -82,7 +81,12 @@
UintegerValue (10),
MakeUintegerAccessor (&StaWifiMac::m_maxMissedBeacons),
MakeUintegerChecker<uint32_t> ())
- .AddAttribute ("ActiveProbing", "If true, we send probe requests. If false, we don't. NOTE: if more than one STA in your simulation is using active probing, you should enable it at a different simulation time for each STA, otherwise all the STAs will start sending probes at the same time resulting in collisions. See bug 1060 for more info.",
+ .AddAttribute ("ActiveProbing",
+ "If true, we send probe requests. If false, we don't."
+ "NOTE: if more than one STA in your simulation is using active probing, "
+ "you should enable it at a different simulation time for each STA, "
+ "otherwise all the STAs will start sending probes at the same time resulting in collisions. "
+ "See bug 1060 for more info.",
BooleanValue (false),
MakeBooleanAccessor (&StaWifiMac::SetActiveProbing, &StaWifiMac::GetActiveProbing),
MakeBooleanChecker ())
@@ -104,8 +108,8 @@
{
NS_LOG_FUNCTION (this);
- // Let the lower layers know that we are acting as a non-AP STA in
- // an infrastructure BSS.
+ //Let the lower layers know that we are acting as a non-AP STA in
+ //an infrastructure BSS.
SetTypeOfStation (STA);
}
@@ -156,7 +160,7 @@
}
m_activeProbing = enable;
}
-
+
bool StaWifiMac::GetActiveProbing (void) const
{
return m_activeProbing;
@@ -179,16 +183,16 @@
probe.SetSupportedRates (GetSupportedRates ());
if (m_htSupported)
{
- probe.SetHtCapabilities (GetHtCapabilities());
- hdr.SetNoOrder();
+ probe.SetHtCapabilities (GetHtCapabilities ());
+ hdr.SetNoOrder ();
}
packet->AddHeader (probe);
- // The standard is not clear on the correct queue for management
- // frames if we are a QoS AP. The approach taken here is to always
- // use the DCF for these regardless of whether we have a QoS
- // association or not.
+ //The standard is not clear on the correct queue for management
+ //frames if we are a QoS AP. The approach taken here is to always
+ //use the DCF for these regardless of whether we have a QoS
+ //association or not.
m_dca->Queue (packet, hdr);
if (m_probeRequestEvent.IsRunning ())
@@ -216,16 +220,16 @@
assoc.SetSupportedRates (GetSupportedRates ());
if (m_htSupported)
{
- assoc.SetHtCapabilities (GetHtCapabilities());
- hdr.SetNoOrder();
+ assoc.SetHtCapabilities (GetHtCapabilities ());
+ hdr.SetNoOrder ();
}
packet->AddHeader (assoc);
- // The standard is not clear on the correct queue for management
- // frames if we are a QoS AP. The approach taken here is to always
- // use the DCF for these regardless of whether we have a QoS
- // association or not.
+ //The standard is not clear on the correct queue for management
+ //frames if we are a QoS AP. The approach taken here is to always
+ //use the DCF for these regardless of whether we have a QoS
+ //association or not.
m_dca->Queue (packet, hdr);
if (m_assocRequestEvent.IsRunning ())
@@ -258,10 +262,10 @@
* We try to initiate a probe request now.
*/
m_linkDown ();
- if (m_activeProbing)
+ if (m_activeProbing)
{
- SetState (WAIT_PROBE_RESP);
- SendProbeRequest ();
+ SetState (WAIT_PROBE_RESP);
+ SendProbeRequest ();
}
break;
case WAIT_ASSOC_RESP:
@@ -352,31 +356,31 @@
}
WifiMacHeader hdr;
- // If we are not a QoS AP then we definitely want to use AC_BE to
- // transmit the packet. A TID of zero will map to AC_BE (through \c
- // QosUtilsMapTidToAc()), so we use that as our default here.
+ //If we are not a QoS AP then we definitely want to use AC_BE to
+ //transmit the packet. A TID of zero will map to AC_BE (through \c
+ //QosUtilsMapTidToAc()), so we use that as our default here.
uint8_t tid = 0;
- // For now, an AP that supports QoS does not support non-QoS
- // associations, and vice versa. In future the AP model should
- // support simultaneously associated QoS and non-QoS STAs, at which
- // point there will need to be per-association QoS state maintained
- // by the association state machine, and consulted here.
+ //For now, an AP that supports QoS does not support non-QoS
+ //associations, and vice versa. In future the AP model should
+ //support simultaneously associated QoS and non-QoS STAs, at which
+ //point there will need to be per-association QoS state maintained
+ //by the association state machine, and consulted here.
if (m_qosSupported)
{
hdr.SetType (WIFI_MAC_QOSDATA);
hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
hdr.SetQosNoEosp ();
hdr.SetQosNoAmsdu ();
- // Transmission of multiple frames in the same TXOP is not
- // supported for now
+ //Transmission of multiple frames in the same TXOP is not
+ //supported for now
hdr.SetQosTxopLimit (0);
- // Fill in the QoS control field in the MAC header
+ //Fill in the QoS control field in the MAC header
tid = QosUtilsGetTidForPacket (packet);
- // Any value greater than 7 is invalid and likely indicates that
- // the packet had no QoS tag, so we revert to zero, which'll
- // mean that AC_BE is used.
+ //Any value greater than 7 is invalid and likely indicates that
+ //the packet had no QoS tag, so we revert to zero, which'll
+ //mean that AC_BE is used.
if (tid > 7)
{
tid = 0;
@@ -387,9 +391,9 @@
{
hdr.SetTypeData ();
}
-if (m_htSupported)
+ if (m_htSupported)
{
- hdr.SetNoOrder();
+ hdr.SetNoOrder ();
}
hdr.SetAddr1 (GetBssid ());
@@ -400,7 +404,7 @@
if (m_qosSupported)
{
- // Sanity check that the TID is valid
+ //Sanity check that the TID is valid
NS_ASSERT (tid < 8);
m_edca[QosUtilsMapTidToAc (tid)]->Queue (packet, hdr);
}
@@ -447,7 +451,6 @@
NotifyRxDrop (packet);
return;
}
-
if (hdr->IsQosData ())
{
if (hdr->IsQosAmsdu ())
@@ -470,7 +473,7 @@
else if (hdr->IsProbeReq ()
|| hdr->IsAssocReq ())
{
- // This is a frame aimed at an AP, so we can safely ignore it.
+ //This is a frame aimed at an AP, so we can safely ignore it.
NotifyRxDrop (packet);
return;
}
@@ -487,12 +490,12 @@
SupportedRates rates = beacon.GetSupportedRates ();
for (uint32_t i = 0; i < m_phy->GetNBssMembershipSelectors (); i++)
{
- uint32_t selector = m_phy->GetBssMembershipSelector (i);
- if (!rates.IsSupportedRate (selector))
- {
- goodBeacon = false;
- }
- }
+ uint32_t selector = m_phy->GetBssMembershipSelector (i);
+ if (!rates.IsSupportedRate (selector))
+ {
+ goodBeacon = false;
+ }
+ }
if ((IsWaitAssocResp () || IsAssociated ()) && hdr->GetAddr3 () != GetBssid ())
{
goodBeacon = false;
@@ -524,11 +527,11 @@
SupportedRates rates = probeResp.GetSupportedRates ();
for (uint32_t i = 0; i < m_phy->GetNBssMembershipSelectors (); i++)
{
- uint32_t selector = m_phy->GetBssMembershipSelector (i);
- if (!rates.IsSupportedRate (selector))
- {
- return;
- }
+ uint32_t selector = m_phy->GetBssMembershipSelector (i);
+ if (!rates.IsSupportedRate (selector))
+ {
+ return;
+ }
}
SetBssid (hdr->GetAddr3 ());
Time delay = MicroSeconds (probeResp.GetBeaconIntervalUs () * m_maxMissedBeacons);
@@ -575,17 +578,17 @@
}
}
}
- if(m_htSupported)
+ if (m_htSupported)
{
HtCapabilities htcapabilities = assocResp.GetHtCapabilities ();
- for (uint32_t i = 0; i < m_phy->GetNMcs(); i++)
+ for (uint32_t i = 0; i < m_phy->GetNMcs (); i++)
{
- uint8_t mcs=m_phy->GetMcs(i);
- if (htcapabilities.IsSupportedMcs (mcs))
- {
- m_stationManager->AddSupportedMcs (hdr->GetAddr2 (), mcs);
+ uint8_t mcs = m_phy->GetMcs (i);
+ if (htcapabilities.IsSupportedMcs (mcs))
+ {
+ m_stationManager->AddSupportedMcs (hdr->GetAddr2 (), mcs);
//here should add a control to add basic MCS when it is implemented
- }
+ }
}
}
if (!m_linkUp.IsNull ())
@@ -602,9 +605,9 @@
return;
}
- // Invoke the receive handler of our parent class to deal with any
- // other frames. Specifically, this will handle Block Ack-related
- // Management Action frames.
+ //Invoke the receive handler of our parent class to deal with any
+ //other frames. Specifically, this will handle Block Ack-related
+ //Management Action frames.
RegularWifiMac::Receive (packet, hdr);
}
@@ -612,11 +615,11 @@
StaWifiMac::GetSupportedRates (void) const
{
SupportedRates rates;
- if(m_htSupported)
+ if (m_htSupported)
{
- for (uint32_t i = 0; i < m_phy->GetNBssMembershipSelectors(); i++)
+ for (uint32_t i = 0; i < m_phy->GetNBssMembershipSelectors (); i++)
{
- rates.SetBasicRate(m_phy->GetBssMembershipSelector(i));
+ rates.SetBasicRate (m_phy->GetBssMembershipSelector (i));
}
}
for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
@@ -626,20 +629,22 @@
}
return rates;
}
+
HtCapabilities
StaWifiMac::GetHtCapabilities (void) const
{
- HtCapabilities capabilities;
- capabilities.SetHtSupported(1);
- capabilities.SetLdpc (m_phy->GetLdpc());
- capabilities.SetShortGuardInterval20 (m_phy->GetGuardInterval());
- capabilities.SetGreenfield (m_phy->GetGreenfield());
-for (uint8_t i =0 ; i < m_phy->GetNMcs();i++)
- {
- capabilities.SetRxMcsBitmask(m_phy->GetMcs(i));
- }
- return capabilities;
+ HtCapabilities capabilities;
+ capabilities.SetHtSupported (1);
+ capabilities.SetLdpc (m_phy->GetLdpc ());
+ capabilities.SetShortGuardInterval20 (m_phy->GetGuardInterval ());
+ capabilities.SetGreenfield (m_phy->GetGreenfield ());
+ for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
+ {
+ capabilities.SetRxMcsBitmask (m_phy->GetMcs (i));
+ }
+ return capabilities;
}
+
void
StaWifiMac::SetState (MacState value)
{
@@ -656,4 +661,4 @@
m_state = value;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/sta-wifi-mac.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/sta-wifi-mac.h Sun Jun 21 00:23:45 2015 +0200
@@ -16,18 +16,16 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
+ * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Mirko Banchi <mk.banchi@gmail.com>
*/
#ifndef STA_WIFI_MAC_H
#define STA_WIFI_MAC_H
#include "regular-wifi-mac.h"
-
#include "ns3/event-id.h"
#include "ns3/packet.h"
#include "ns3/traced-callback.h"
-
#include "supported-rates.h"
#include "amsdu-subframe-header.h"
@@ -83,6 +81,7 @@
*/
void StartActiveAssociation (void);
+
private:
/**
* The current MAC state of the STA.
@@ -108,6 +107,7 @@
* \return true if active probing is enabled, false otherwise
*/
bool GetActiveProbing (void) const;
+
virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
/**
@@ -126,12 +126,12 @@
*/
void TryToEnsureAssociated (void);
/**
- * This method is called after the association timeout occurred. We switch the state to
+ * This method is called after the association timeout occurred. We switch the state to
* WAIT_ASSOC_RESP and re-send an association request.
*/
void AssocRequestTimeout (void);
/**
- * This method is called after the probe request timeout occurred. We switch the state to
+ * This method is called after the probe request timeout occurred. We switch the state to
* WAIT_PROBE_RESP and re-send a probe request.
*/
void ProbeRequestTimeout (void);
@@ -148,11 +148,11 @@
*/
bool IsWaitAssocResp (void) const;
/**
- * This method is called after we have not received a beacon from the AP
+ * This method is called after we have not received a beacon from the AP
*/
void MissedBeacons (void);
/**
- * Restarts the beacon timer.
+ * Restarts the beacon timer.
*
* \param delay the delay before the watchdog fires
*/
@@ -170,15 +170,13 @@
* \param value the new state
*/
void SetState (enum MacState value);
-
/**
* Return the HT capability of the current AP.
- *
+ *
* \return the HT capability that we support
*/
HtCapabilities GetHtCapabilities (void) const;
-
enum MacState m_state;
Time m_probeRequestTimeout;
Time m_assocRequestTimeout;
@@ -193,6 +191,6 @@
TracedCallback<Mac48Address> m_deAssocLogger;
};
-} // namespace ns3
+} //namespace ns3
#endif /* STA_WIFI_MAC_H */
--- a/src/wifi/model/status-code.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/status-code.cc Sun Jun 21 00:23:45 2015 +0200
@@ -27,11 +27,13 @@
StatusCode::StatusCode ()
{
}
+
void
StatusCode::SetSuccess (void)
{
m_code = 0;
}
+
void
StatusCode::SetFailure (void)
{
@@ -43,17 +45,20 @@
{
return (m_code == 0);
}
+
uint32_t
StatusCode::GetSerializedSize (void) const
{
return 2;
}
+
Buffer::Iterator
StatusCode::Serialize (Buffer::Iterator start) const
{
start.WriteHtolsbU16 (m_code);
return start;
}
+
Buffer::Iterator
StatusCode::Deserialize (Buffer::Iterator start)
{
@@ -66,6 +71,7 @@
*
* \param os
* \param code
+ *
* \return std::ostream
*/
std::ostream &
@@ -82,4 +88,4 @@
return os;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/status-code.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/status-code.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef STATUS_CODE_H
#define STATUS_CODE_H
@@ -38,14 +39,15 @@
*/
void SetSuccess (void);
/**
- * Set success bit to 1 (failure.
+ * Set success bit to 1 (failure).
*/
void SetFailure (void);
/**
* Return whether the status code is success.
*
- * \return true if success, false otherwise
+ * \return true if success,
+ * false otherwise
*/
bool IsSuccess (void) const;
@@ -57,8 +59,8 @@
*/
uint32_t GetSerializedSize (void) const;
/**
- * \param start an iterator which points to where the status code should
- * be written.
+ * \param start an iterator which points to where the status code should be written
+ *
* \return Buffer::Iterator
*
* This method is used to store a status code into the byte buffer.
@@ -68,19 +70,22 @@
Buffer::Iterator Serialize (Buffer::Iterator start) const;
/**
* \param start an iterator which points to where the status code should be read.
+ *
* \returns the number of bytes read.
*
- * This method is used to re-create a status code from the byte buffer.
+ * This method is used to re-create a status code from the byte buffer.
* The data read is expected to match bit-for-bit the representation of this
* header in real networks.
*/
Buffer::Iterator Deserialize (Buffer::Iterator start);
+
+
private:
uint16_t m_code;
};
std::ostream &operator << (std::ostream &os, const StatusCode &code);
-} // namespace ns3
+} //namespace ns3
#endif /* STATUS_CODE_H */
--- a/src/wifi/model/supported-rates.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/supported-rates.cc Sun Jun 21 00:23:45 2015 +0200
@@ -36,9 +36,8 @@
{
m_nRates = rates.m_nRates;
memcpy (m_rates, rates.m_rates, MAX_SUPPORTED_RATES);
- // reset the back pointer to this object
+ //reset the back pointer to this object
extended.SetSupportedRates (this);
-
}
SupportedRates&
@@ -46,7 +45,7 @@
{
this->m_nRates = rates.m_nRates;
memcpy (this->m_rates, rates.m_rates, MAX_SUPPORTED_RATES);
- // reset the back pointer to this object
+ //reset the back pointer to this object
this->extended.SetSupportedRates (this);
return (*this);
}
@@ -63,6 +62,7 @@
m_nRates++;
NS_LOG_DEBUG ("add rate=" << bs << ", n rates=" << (uint32_t)m_nRates);
}
+
void
SupportedRates::SetBasicRate (uint32_t bs)
{
@@ -83,6 +83,7 @@
AddSupportedRate (bs);
SetBasicRate (bs);
}
+
bool
SupportedRates::IsBasicRate (uint32_t bs) const
{
@@ -96,6 +97,7 @@
}
return false;
}
+
bool
SupportedRates::IsSupportedRate (uint32_t bs) const
{
@@ -110,11 +112,13 @@
}
return false;
}
+
uint8_t
SupportedRates::GetNRates (void) const
{
return m_nRates;
}
+
uint32_t
SupportedRates::GetRate (uint8_t i) const
{
@@ -126,22 +130,25 @@
{
return IE_SUPPORTED_RATES;
}
+
uint8_t
SupportedRates::GetInformationFieldSize () const
{
- // The Supported Rates Information Element contains only the first 8
- // supported rates - the remainder appear in the Extended Supported
- // Rates Information Element.
+ //The Supported Rates Information Element contains only the first 8
+ //supported rates - the remainder appear in the Extended Supported
+ //Rates Information Element.
return m_nRates > 8 ? 8 : m_nRates;
}
+
void
SupportedRates::SerializeInformationField (Buffer::Iterator start) const
{
- // The Supported Rates Information Element contains only the first 8
- // supported rates - the remainder appear in the Extended Supported
- // Rates Information Element.
+ //The Supported Rates Information Element contains only the first 8
+ //supported rates - the remainder appear in the Extended Supported
+ //Rates Information Element.
start.Write (m_rates, m_nRates > 8 ? 8 : m_nRates);
}
+
uint8_t
SupportedRates::DeserializeInformationField (Buffer::Iterator start,
uint8_t length)
@@ -176,28 +183,28 @@
uint8_t
ExtendedSupportedRatesIE::GetInformationFieldSize () const
{
- // If there are 8 or fewer rates then we don't need an Extended
- // Supported Rates IE and so could return zero here, but we're
- // 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.
+ //If there are 8 or fewer rates then we don't need an Extended
+ //Supported Rates IE and so could return zero here, but we're
+ //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);
- // The number of rates we have beyond the initial 8 is the size of
- // the information field.
+ //The number of rates we have beyond the initial 8 is the size of
+ //the information field.
return (m_supportedRates->m_nRates - 8);
}
void
ExtendedSupportedRatesIE::SerializeInformationField (Buffer::Iterator start) const
{
- // If there are 8 or fewer rates then there should be no Extended
- // Supported Rates Information Element at all so being here would
- // seemingly indicate a programming error.
+ //If there are 8 or fewer rates then there should be no Extended
+ //Supported Rates Information Element at all so being here would
+ //seemingly indicate a programming error.
//
- // 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).
+ //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);
start.Write (m_supportedRates->m_rates + 8, m_supportedRates->m_nRates - 8);
}
@@ -205,29 +212,29 @@
Buffer::Iterator
ExtendedSupportedRatesIE::Serialize (Buffer::Iterator start) const
{
- // If there are 8 or fewer rates then we don't need an Extended
- // Supported Rates IE, so we don't serialise anything.
+ //If there are 8 or fewer rates then we don't need an Extended
+ //Supported Rates IE, so we don't serialise anything.
if (m_supportedRates->m_nRates <= 8)
{
return start;
}
- // If there are more than 8 rates then we serialise as per normal.
+ //If there are more than 8 rates then we serialise as per normal.
return WifiInformationElement::Serialize (start);
}
uint16_t
ExtendedSupportedRatesIE::GetSerializedSize () const
{
- // If there are 8 or fewer rates then we don't need an Extended
- // Supported Rates IE, so it's serialised length will be zero.
+ //If there are 8 or fewer rates then we don't need an Extended
+ //Supported Rates IE, so it's serialised length will be zero.
if (m_supportedRates->m_nRates <= 8)
{
return 0;
}
- // Otherwise, the size of it will be the number of supported rates
- // beyond 8, plus 2 for the Element ID and Length.
+ //Otherwise, the size of it will be the number of supported rates
+ //beyond 8, plus 2 for the Element ID and Length.
return WifiInformationElement::GetSerializedSize ();
}
@@ -247,6 +254,7 @@
*
* \param os
* \param rates
+ *
* \return std::ostream
*/
std::ostream &operator << (std::ostream &os, const SupportedRates &rates)
@@ -269,4 +277,4 @@
return os;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/supported-rates.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/supported-rates.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef SUPPORTED_RATES_H
#define SUPPORTED_RATES_H
@@ -68,15 +69,16 @@
* WifiInformationElement.
*
* \param start
+ *
* \return an iterator
*/
Buffer::Iterator Serialize (Buffer::Iterator start) const;
/**
- * Return the serialized size of this supported rates
+ * Return the serialized size of this supported rates
* information element.
- *
- * \return the serialized size of this supported rates
- * information element
+ *
+ * \return the serialized size of this supported rates
+ * information element
*/
uint16_t GetSerializedSize () const;
private:
@@ -132,6 +134,7 @@
* Check if the given rate is supported.
*
* \param bs the rate to be checked
+ *
* \return true if the rate is supported, false otherwise
*/
bool IsSupportedRate (uint32_t bs) const;
@@ -139,6 +142,7 @@
* Check if the given rate is a basic rate.
*
* \param bs the rate to be checked
+ *
* \return true if the rate is a basic rate, false otherwise
*/
bool IsBasicRate (uint32_t bs) const;
@@ -172,13 +176,15 @@
*/
friend class ExtendedSupportedRatesIE;
ExtendedSupportedRatesIE extended;
+
+
private:
- uint8_t m_nRates; //!< Number of supported rates
+ uint8_t m_nRates; //!< Number of supported rates
uint8_t m_rates[MAX_SUPPORTED_RATES]; //!< List of supported bitrate (divided by 500000)
};
std::ostream &operator << (std::ostream &os, const SupportedRates &rates);
-} // namespace ns3
+} //namespace ns3
#endif /* SUPPORTED_RATES_H */
--- a/src/wifi/model/wifi-channel.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-channel.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage, <mathieu.lacage@sophia.inria.fr>
*/
+
#include "ns3/packet.h"
#include "ns3/simulator.h"
#include "ns3/mobility-model.h"
@@ -47,4 +48,4 @@
return tid;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/wifi-channel.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-channel.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage, <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef WIFI_CHANNEL_H
#define WIFI_CHANNEL_H
@@ -45,7 +46,7 @@
static TypeId GetTypeId (void);
};
-} // namespace ns3
+} //namespace ns3
#endif /* WIFI_CHANNEL_H */
--- a/src/wifi/model/wifi-information-element-vector.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-information-element-vector.cc Sun Jun 21 00:23:45 2015 +0200
@@ -30,6 +30,7 @@
: m_maxSize (1500)
{
}
+
WifiInformationElementVector::~WifiInformationElementVector ()
{
for (IE_VECTOR::iterator i = m_elements.begin (); i != m_elements.end (); i++)
@@ -38,6 +39,7 @@
}
m_elements.clear ();
}
+
TypeId
WifiInformationElementVector::GetTypeId ()
{
@@ -47,16 +49,19 @@
.AddConstructor<WifiInformationElementVector> ();
return tid;
}
+
TypeId
WifiInformationElementVector::GetInstanceTypeId () const
{
return GetTypeId ();
}
+
uint32_t
WifiInformationElementVector::GetSerializedSize () const
{
return GetSize ();
}
+
void
WifiInformationElementVector::Serialize (Buffer::Iterator start) const
{
@@ -65,6 +70,7 @@
start = (*i)->Serialize (start);
}
}
+
uint32_t
WifiInformationElementVector::Deserialize (Buffer::Iterator start)
{
@@ -78,6 +84,7 @@
}
return i.GetDistanceFrom (start);
}
+
uint32_t
WifiInformationElementVector::DeserializeSingleIe (Buffer::Iterator start)
{
@@ -85,7 +92,7 @@
uint8_t id = i.ReadU8 ();
//unused: uint8_t length = i.ReadU8 ();
//but need side effects of read:
- i.ReadU8 ();
+ i.ReadU8 ();
Ptr<WifiInformationElement> newElement;
switch (id)
{
@@ -104,26 +111,31 @@
return i.GetDistanceFrom (start);
*/
}
+
void
WifiInformationElementVector::Print (std::ostream & os) const
{
/// \todo
}
+
void
WifiInformationElementVector::SetMaxSize (uint16_t size)
{
m_maxSize = size;
}
+
WifiInformationElementVector::Iterator
WifiInformationElementVector::Begin ()
{
return m_elements.begin ();
}
+
WifiInformationElementVector::Iterator
WifiInformationElementVector::End ()
{
return m_elements.end ();
}
+
bool
WifiInformationElementVector::AddInformationElement (Ptr<WifiInformationElement> element)
{
@@ -134,6 +146,7 @@
m_elements.push_back (element);
return true;
}
+
Ptr<WifiInformationElement>
WifiInformationElementVector::FindFirst (WifiInformationElementId id) const
{
@@ -146,7 +159,10 @@
}
return 0;
}
+
+
namespace {
+
struct PIEComparator
{
bool
@@ -155,7 +171,10 @@
return ((*PeekPointer (a)) < (*PeekPointer (b)));
}
};
+
}
+
+
uint32_t
WifiInformationElementVector::GetSize () const
{
@@ -175,13 +194,13 @@
NS_ASSERT (false);
return false;
}
- // In principle we could bypass some of the faffing about (and speed
- // the comparison) by simply serialising each IE vector into a
- // buffer and memcmp'ing the two.
+ //In principle we could bypass some of the faffing about (and speed
+ //the comparison) by simply serialising each IE vector into a
+ //buffer and memcmp'ing the two.
//
- // I'm leaving it like this, however, so that there is the option of
- // having individual Information Elements implement slightly more
- // flexible equality operators.
+ //I'm leaving it like this, however, so that there is the option of
+ //having individual Information Elements implement slightly more
+ //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++)
@@ -195,4 +214,4 @@
return true;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/wifi-information-element-vector.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-information-element-vector.h Sun Jun 21 00:23:45 2015 +0200
@@ -24,10 +24,8 @@
#include "ns3/header.h"
#include "ns3/simple-ref-count.h"
-
#include "ns3/wifi-information-element.h"
-
namespace ns3 {
/**
@@ -53,15 +51,17 @@
/**
* \attention When you use RemoveHeader, WifiInformationElementVector supposes, that
* all buffer consists of information elements
- * @param start
- * @return
+ *
+ * \param start
*/
virtual uint32_t Deserialize (Buffer::Iterator start);
virtual void Print (std::ostream &os) const;
/**
* \brief Needed when you try to deserialize a lonely IE inside other header
+ *
* \param start is the start of the buffer
+ *
* \return deserialized bytes
*/
virtual uint32_t DeserializeSingleIe (Buffer::Iterator start);
@@ -80,12 +80,15 @@
/**
* Check if the given WifiInformationElementVectors are equivalent.
- *
+ *
* \param a another WifiInformationElementVector
+ *
* \return true if the given WifiInformationElementVectors are equivalent,
* false otherwise
*/
virtual bool operator== (const WifiInformationElementVector & a) const;
+
+
protected:
/**
* typedef for a vector of WifiInformationElements.
@@ -98,5 +101,6 @@
uint16_t m_maxSize;
};
-}
+} //namespace ns3
+
#endif /* WIFI_INFORMATION_ELEMENT_VECTOR_H */
--- a/src/wifi/model/wifi-information-element.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-information-element.cc Sun Jun 21 00:23:45 2015 +0200
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Authors: Dean Armstrong <deanarm@gmail.com>
+ * Author: Dean Armstrong <deanarm@gmail.com>
*/
#include "ns3/wifi-information-element.h"
@@ -52,8 +52,8 @@
{
Buffer::Iterator start = i;
i = DeserializeIfPresent (i);
- // This IE was not optional, so confirm that we did actually
- // deserialise something.
+ //This IE was not optional, so confirm that we did actually
+ //deserialise something.
NS_ASSERT (i.GetDistanceFrom (start) != 0);
return i;
}
@@ -64,9 +64,9 @@
Buffer::Iterator start = i;
uint8_t elementId = i.ReadU8 ();
- // If the element here isn't the one we're after then we immediately
- // return the iterator we were passed indicating that we haven't
- // taken anything from the buffer.
+ //If the element here isn't the one we're after then we immediately
+ //return the iterator we were passed indicating that we haven't
+ //taken anything from the buffer.
if (elementId != ElementId ())
{
return start;
@@ -80,7 +80,6 @@
return i;
}
-
bool
WifiInformationElement::operator< (WifiInformationElement const & a) const
{
@@ -112,4 +111,4 @@
return (memcmp (myIe.PeekData (), hisIe.PeekData (), ieSize) == 0);
}
-}
+} //namespace ns3
--- a/src/wifi/model/wifi-information-element.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-information-element.h Sun Jun 21 00:23:45 2015 +0200
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Authors: Dean Armstrong <deanarm@gmail.com>
+ * Author: Dean Armstrong <deanarm@gmail.com>
*/
#ifndef WIFI_INFORMATION_ELEMENT_H
@@ -134,8 +134,8 @@
/**
* Serialize entire IE including Element ID and length fields
*
- * \param i an iterator which points to where the IE should
- * be written.
+ * \param i an iterator which points to where the IE should be written.
+ *
* \return an iterator
*/
Buffer::Iterator Serialize (Buffer::Iterator i) const;
@@ -146,6 +146,7 @@
* otherwise this method will generate a fatal error.
*
* \param i an iterator which points to where the IE should be read.
+ *
* \return an iterator
*/
Buffer::Iterator Deserialize (Buffer::Iterator i);
@@ -156,6 +157,7 @@
* in then it will return the same iterator.
*
* \param i an iterator which points to where the IE should be read.
+ *
* \return an iterator
*/
Buffer::Iterator DeserializeIfPresent (Buffer::Iterator i);
@@ -191,15 +193,15 @@
* Deserialize information (i.e., the body of the IE, not including
* the Element ID and length octets)
*
- * \param start an iterator which points to where the information should
- * be written.
+ * \param start an iterator which points to where the information should be written.
* \param length
+ *
* \return the number of bytes read
*/
virtual uint8_t DeserializeInformationField (Buffer::Iterator start,
uint8_t length) = 0;
- // In addition, a subclass my optionally override the following...
+ // In addition, a subclass may optionally override the following...
/**
* Generate human-readable form of IE
*
@@ -210,6 +212,7 @@
* Compare information elements using Element ID
*
* \param a another information element to compare with
+ *
* \return true if the Element ID is less than the other IE Element ID,
* false otherwise
*/
@@ -219,11 +222,14 @@
* memcmp of serialised version
*
* \param a another information element to compare with
- * \return true if the two IEs are equal, false otherwise
+ *
+ * \return true if the two IEs are equal,
+ * false otherwise
*/
virtual bool operator== (WifiInformationElement const & a) const;
};
-}
+} //namespace ns3
+
#endif /* WIFI_INFORMATION_ELEMENT_H */
--- a/src/wifi/model/wifi-mac-header.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-mac-header.cc Sun Jun 21 00:23:45 2015 +0200
@@ -46,8 +46,7 @@
};
WifiMacHeader::WifiMacHeader ()
- :
- m_ctrlMoreData (0),
+ : m_ctrlMoreData (0),
m_ctrlWep (0),
m_ctrlOrder (1),
m_amsduPresent (0)
@@ -200,7 +199,7 @@
m_ctrlType = TYPE_CTL;
m_ctrlSubtype = SUBTYPE_CTL_ACK;
break;
- case WIFI_MAC_CTL_CTLWRAPPER:
+ case WIFI_MAC_CTL_CTLWRAPPER:
m_ctrlType = TYPE_CTL;
m_ctrlSubtype = SUBTYPE_CTL_CTLWRAPPER;
break;
@@ -594,7 +593,7 @@
}
// NOTREACHED
NS_ASSERT (false);
- return (enum WifiMacType) - 1;
+ return (enum WifiMacType) -1;
}
bool
@@ -861,7 +860,7 @@
}
// NOTREACHED
NS_ASSERT (false);
- return (enum QosAckPolicy) - 1;
+ return (enum QosAckPolicy) -1;
}
uint8_t
@@ -1250,4 +1249,4 @@
return i.GetDistanceFrom (start);
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/wifi-mac-header.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-mac-header.h Sun Jun 21 00:23:45 2015 +0200
@@ -584,10 +584,10 @@
/**
* TracedCallback signature for WifiMacHeader
*
- * \param [in] header The header
+ * \param [in] header The header
*/
typedef void (* TracedCallback)(const WifiMacHeader &header);
-
+
private:
/**
@@ -650,6 +650,6 @@
uint16_t m_qosStuff;
};
-} // namespace ns3
+} //namespace ns3
#endif /* WIFI_MAC_HEADER_H */
--- a/src/wifi/model/wifi-mac-queue.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-mac-queue.cc Sun Jun 21 00:23:45 2015 +0200
@@ -16,14 +16,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
+ * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Mirko Banchi <mk.banchi@gmail.com>
*/
#include "ns3/simulator.h"
#include "ns3/packet.h"
#include "ns3/uinteger.h"
-
#include "wifi-mac-queue.h"
#include "qos-blocked-destinations.h"
@@ -116,7 +115,7 @@
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)
{
@@ -203,7 +202,7 @@
&& it->hdr.GetQosTid () == tid)
{
*hdr = it->hdr;
- *timestamp=it->tstamp;
+ *timestamp = it->tstamp;
return it->packet;
}
}
@@ -342,4 +341,4 @@
return 0;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/wifi-mac-queue.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-mac-queue.h Sun Jun 21 00:23:45 2015 +0200
@@ -16,9 +16,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Author: Mirko Banchi <mk.banchi@gmail.com>
+ * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Mirko Banchi <mk.banchi@gmail.com>
*/
+
#ifndef WIFI_MAC_QUEUE_H
#define WIFI_MAC_QUEUE_H
@@ -97,6 +98,7 @@
* Dequeue the packet in the front of the queue.
*
* \param hdr the WifiMacHeader of the packet
+ *
* \return the packet
*/
Ptr<const Packet> Dequeue (WifiMacHeader *hdr);
@@ -104,6 +106,7 @@
* Peek the packet in the front of the queue. The packet is not removed.
*
* \param hdr the WifiMacHeader of the packet
+ *
* \return the packet
*/
Ptr<const Packet> Peek (WifiMacHeader *hdr);
@@ -118,6 +121,7 @@
* \param tid the given TID
* \param type the given address type
* \param addr the given destination
+ *
* \return packet
*/
Ptr<const Packet> DequeueByTidAndAddress (WifiMacHeader *hdr,
@@ -136,6 +140,7 @@
* \param type the given address type
* \param addr the given destination
* \param timestamp
+ *
* \return packet
*/
Ptr<const Packet> PeekByTidAndAddress (WifiMacHeader *hdr,
@@ -149,6 +154,7 @@
* performed in linear time (O(n)).
*
* \param packet the packet to be removed
+ *
* \return true if the packet was removed, false otherwise
*/
bool Remove (Ptr<const Packet> packet);
@@ -159,6 +165,7 @@
* \param tid the given TID
* \param type the given address type
* \param addr the given destination
+ *
* \return the number of QoS packets
*/
uint32_t GetNPacketsByTidAndAddress (uint8_t tid,
@@ -174,17 +181,19 @@
* \param hdr the header of the dequeued packet
* \param tStamp
* \param blockedPackets
+ *
* \return packet
*/
Ptr<const Packet> DequeueFirstAvailable (WifiMacHeader *hdr,
Time &tStamp,
const QosBlockedDestinations *blockedPackets);
/**
- * Returns first available packet for transmission. The packet isn't removed from queue.
+ * Returns first available packet for transmission. The packet isn't removed from queue.
*
* \param hdr the header of the dequeued packet
* \param tStamp
* \param blockedPackets
+ *
* \return packet
*/
Ptr<const Packet> PeekFirstAvailable (WifiMacHeader *hdr,
@@ -208,6 +217,7 @@
*/
uint32_t GetSize (void);
+
protected:
/**
* Clean up the queue by removing packets that exceeded the maximum delay.
@@ -231,8 +241,8 @@
const WifiMacHeader &hdr,
Time tstamp);
Ptr<const Packet> packet; //!< Actual packet
- WifiMacHeader hdr; //!< Wifi MAC header associated with the packet
- Time tstamp; //!< timestamp when the packet arrived at the queue
+ WifiMacHeader hdr; //!< Wifi MAC header associated with the packet
+ Time tstamp; //!< timestamp when the packet arrived at the queue
};
/**
@@ -252,16 +262,17 @@
*
* \param type
* \param it
+ *
* \return the address
*/
Mac48Address GetAddressForPacket (enum WifiMacHeader::AddressType type, PacketQueueI it);
PacketQueue m_queue; //!< Packet (struct Item) queue
- uint32_t m_size; //!< Current queue size
- uint32_t m_maxSize; //!< Queue capacity
- Time m_maxDelay; //!< Time to live for packets in the queue
+ uint32_t m_size; //!< Current queue size
+ uint32_t m_maxSize; //!< Queue capacity
+ Time m_maxDelay; //!< Time to live for packets in the queue
};
-} // namespace ns3
+} //namespace ns3
#endif /* WIFI_MAC_QUEUE_H */
--- a/src/wifi/model/wifi-mac-trailer.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-mac-trailer.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#include "wifi-mac-trailer.h"
#include "ns3/assert.h"
@@ -42,6 +43,7 @@
;
return tid;
}
+
TypeId
WifiMacTrailer::GetInstanceTypeId (void) const
{
@@ -52,21 +54,24 @@
WifiMacTrailer::Print (std::ostream &os) const
{
}
+
uint32_t
WifiMacTrailer::GetSerializedSize (void) const
{
return WIFI_MAC_FCS_LENGTH;
}
+
void
WifiMacTrailer::Serialize (Buffer::Iterator start) const
{
start.Prev (WIFI_MAC_FCS_LENGTH);
start.WriteU32 (0);
}
+
uint32_t
WifiMacTrailer::Deserialize (Buffer::Iterator start)
{
return WIFI_MAC_FCS_LENGTH;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/wifi-mac-trailer.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-mac-trailer.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef WIFI_MAC_TRAILER_H
#define WIFI_MAC_TRAILER_H
@@ -25,8 +26,6 @@
namespace ns3 {
-
-
/**
* The length in octects of the IEEE 802.11 MAC FCS field
*/
@@ -51,6 +50,6 @@
virtual uint32_t Deserialize (Buffer::Iterator start);
};
-} // namespace ns3
+} //namespace ns3
#endif /* WIFI_MAC_TRAILER_H */
--- a/src/wifi/model/wifi-mac.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-mac.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#include "wifi-mac.h"
#include "dcf.h"
#include "ns3/uinteger.h"
@@ -25,43 +26,49 @@
namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (WifiMac);
-
+
Time
WifiMac::GetDefaultMaxPropagationDelay (void)
{
- // 1000m
+ //1000m
return Seconds (1000.0 / 300000000.0);
}
+
Time
WifiMac::GetDefaultSlot (void)
{
- // 802.11-a specific
+ //802.11-a specific
return MicroSeconds (9);
}
+
Time
WifiMac::GetDefaultSifs (void)
{
- // 802.11-a specific
+ //802.11-a specific
return MicroSeconds (16);
}
-Time
+
+Time
WifiMac::GetDefaultRifs (void)
{
//802.11n specific
return MicroSeconds (2);
}
+
Time
WifiMac::GetDefaultEifsNoDifs (void)
{
return GetDefaultSifs () + GetDefaultCtsAckDelay ();
}
+
Time
WifiMac::GetDefaultCtsAckDelay (void)
{
- // 802.11-a specific: 6mb/s
+ //802.11-a specific: at 6 Mbit/s
return MicroSeconds (44);
}
+
Time
WifiMac::GetDefaultCtsAckTimeout (void)
{
@@ -79,16 +86,18 @@
Time
WifiMac::GetDefaultBasicBlockAckDelay (void)
{
- // This value must be rivisited
+ //This value must be rivisited
return MicroSeconds (250);
}
+
Time
WifiMac::GetDefaultCompressedBlockAckDelay (void)
{
- // This value must be rivisited was 68.
- //CompressedBlockAckSize 32* 8*time it takes to transfer at the lowest rate (6Mb/s)+ aPhy-StartDelay(33)
+ //This value must be rivisited
+ //CompressedBlockAckSize 32 * 8 * time it takes to transfer at the lowest rate (at 6 Mbit/s) + aPhy-StartDelay (33)
return MicroSeconds (76);
}
+
Time
WifiMac::GetDefaultBasicBlockAckTimeout (void)
{
@@ -98,6 +107,7 @@
blockAckTimeout += GetDefaultSlot ();
return blockAckTimeout;
}
+
Time
WifiMac::GetDefaultCompressedBlockAckTimeout (void)
{
@@ -165,7 +175,7 @@
MakeTimeAccessor (&WifiMac::SetSifs,
&WifiMac::GetSifs),
MakeTimeChecker ())
- .AddAttribute ("EifsNoDifs", "The value of EIFS-DIFS",
+ .AddAttribute ("EifsNoDifs", "The value of EIFS-DIFS.",
TimeValue (GetDefaultEifsNoDifs ()),
MakeTimeAccessor (&WifiMac::SetEifsNoDifs,
&WifiMac::GetEifsNoDifs),
@@ -180,12 +190,11 @@
MakeTimeAccessor (&WifiMac::SetPifs,
&WifiMac::GetPifs),
MakeTimeChecker ())
-.AddAttribute ("Rifs", "The value of the RIFS constant.",
+ .AddAttribute ("Rifs", "The value of the RIFS constant.",
TimeValue (GetDefaultRifs ()),
MakeTimeAccessor (&WifiMac::SetRifs,
&WifiMac::GetRifs),
MakeTimeChecker ())
-
.AddAttribute ("MaxPropagationDelay", "The maximum propagation delay. Unused for now.",
TimeValue (GetDefaultMaxPropagationDelay ()),
MakeTimeAccessor (&WifiMac::m_maxPropagationDelay),
@@ -206,27 +215,25 @@
"ns3::Packet::TracedCallback")
.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,",
+ "and is being forwarded up the local protocol stack. This is a promiscuous trace.",
MakeTraceSourceAccessor (&WifiMac::m_macPromiscRxTrace),
"ns3::Packet::TracedCallback")
.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,",
+ "and is being forwarded up the local protocol stack. This is a non-promiscuous trace.",
MakeTraceSourceAccessor (&WifiMac::m_macRxTrace),
"ns3::Packet::TracedCallback")
.AddTraceSource ("MacRxDrop",
- "A packet has been dropped in the MAC layer after it has been passed up from the physical "
- "layer.",
+ "A packet has been dropped in the MAC layer after it has been passed up from the physical layer.",
MakeTraceSourceAccessor (&WifiMac::m_macRxDropTrace),
"ns3::Packet::TracedCallback")
-#if 0
- // Not currently implemented in this device
+ //Not currently implemented in this device
+ /*
.AddTraceSource ("Sniffer",
"Trace source simulating a non-promiscuous packet sniffer attached to the device",
MakeTraceSourceAccessor (&WifiMac::m_snifferTrace))
-#endif
+ */
;
-
return tid;
}
@@ -241,6 +248,7 @@
{
return Seconds (10);
}
+
Time
WifiMac::GetMaxPropagationDelay (void) const
{
@@ -339,7 +347,7 @@
WifiMac::Configure80211g (void)
{
SetSifs (MicroSeconds (10));
- // Note no support for Short Slot Time as yet
+ //Note: no support for Short Slot Time yet
SetSlot (MicroSeconds (20));
SetEifsNoDifs (MicroSeconds (10 + 304));
SetPifs (MicroSeconds (10 + 20));
@@ -373,7 +381,7 @@
WifiMac::Configure80211n_2_4Ghz (void)
{
Configure80211g ();
- SetRifs(MicroSeconds (2));
+ SetRifs (MicroSeconds (2));
SetBasicBlockAckTimeout (GetSifs () + GetSlot () + GetDefaultBasicBlockAckDelay () + GetDefaultMaxPropagationDelay () * 2);
SetCompressedBlockAckTimeout (GetSifs () + GetSlot () + GetDefaultCompressedBlockAckDelay () + GetDefaultMaxPropagationDelay () * 2);
}
@@ -381,7 +389,7 @@
WifiMac::Configure80211n_5Ghz (void)
{
Configure80211a ();
- SetRifs(MicroSeconds (2));
+ SetRifs (MicroSeconds (2));
SetBasicBlockAckTimeout (GetSifs () + GetSlot () + GetDefaultBasicBlockAckDelay () + GetDefaultMaxPropagationDelay () * 2);
SetCompressedBlockAckTimeout (GetSifs () + GetSlot () + GetDefaultCompressedBlockAckDelay () + GetDefaultMaxPropagationDelay () * 2);
}
@@ -422,4 +430,6 @@
break;
}
}
-} // namespace ns3
+
+} //namespace ns3
+
--- a/src/wifi/model/wifi-mac.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-mac.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,12 +17,12 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef WIFI_MAC_H
#define WIFI_MAC_H
#include "ns3/packet.h"
#include "ns3/mac48-address.h"
-
#include "wifi-phy.h"
#include "wifi-remote-station-manager.h"
#include "ssid.h"
@@ -84,12 +84,11 @@
* Unused for now.
*/
void SetMaxPropagationDelay (Time delay);
-/**
+
+ /**
* \return the current RIFS duration.
*/
-
virtual Time GetRifs (void) const = 0;
-
/**
* \return the current PIFS duration.
*/
@@ -122,11 +121,10 @@
Time GetMsduLifetime (void) const;
/**
* \return the maximum propagation delay.
- *
+ *
* Unused for now.
*/
Time GetMaxPropagationDelay (void) const;
-
/**
* \return the MAC address associated to this MAC layer.
*/
@@ -163,7 +161,7 @@
*
* The packet should be enqueued in a tx queue, and should be
* dequeued as soon as the DCF function determines that
- * access it granted to this MAC. The extra parameter "from" allows
+ * access it granted to this MAC. The extra parameter "from" allows
* this device to operate in a bridged mode, forwarding received
* frames without altering the source address.
*/
@@ -246,50 +244,45 @@
/**
* \param packet the packet being enqueued
*
- * Public method used to fire a MacTx trace. Implemented for encapsulation
- * purposes. Note this trace indicates that the packet was accepted by the
- * device only. The packet may be dropped later (e.g. if the queue is full).
+ * Public method used to fire a MacTx trace. Implemented for encapsulation purposes.
+ * Note this trace indicates that the packet was accepted by the device only.
+ * The packet may be dropped later (e.g. if the queue is full).
*/
void NotifyTx (Ptr<const Packet> packet);
-
/**
* \param packet the packet being dropped
- *
- * Public method used to fire a MacTxDrop trace. Implemented for encapsulation
- * purposes. This trace indicates that the packet was dropped before it was
- * transmitted (e.g. when a STA is not associated with an AP).
+ *
+ * Public method used to fire a MacTxDrop trace. Implemented for encapsulation purposes.
+ * This trace indicates that the packet was dropped before it was transmitted
+ * (e.g. when a STA is not associated with an AP).
*/
void NotifyTxDrop (Ptr<const Packet> packet);
-
/**
* \param packet the packet we received
- *
- * Public method used to fire a MacRx trace. Implemented for encapsulation
- * purposes.
+ *
+ * Public method used to fire a MacRx trace. Implemented for encapsulation purposes.
*/
void NotifyRx (Ptr<const Packet> packet);
-
/**
* \param packet the packet we received promiscuously
*
- * Public method used to fire a MacPromiscRx trace. Implemented for encapsulation
- * purposes.
+ * Public method used to fire a MacPromiscRx trace. Implemented for encapsulation purposes.
*/
void NotifyPromiscRx (Ptr<const Packet> packet);
-
/**
* \param packet the packet we received but is not destined for us
- *
- * Public method used to fire a MacRxDrop trace. Implemented for encapsulation
- * purposes.
+ *
+ * Public method used to fire a MacRxDrop trace. Implemented for encapsulation purposes.
*/
void NotifyRxDrop (Ptr<const Packet> packet);
+
/**
* \param standard the wifi standard to be configured
*
* This method sets standards-compliant defaults for WifiMac
* parameters such as sifs time, slot time, timeout values, etc.,
* based on the standard selected.
+ *
* \sa WifiMac::Configure80211a
* \sa WifiMac::Configure80211b
* \sa WifiMac::Configure80211g
@@ -300,6 +293,7 @@
*/
void ConfigureStandard (enum WifiPhyStandard standard);
+
protected:
/**
* \param dcf the DCF to be configured
@@ -310,6 +304,8 @@
* Configure the DCF with appropriate values depending on the given access category.
*/
void ConfigureDcf (Ptr<Dcf> dcf, uint32_t cwmin, uint32_t cwmax, enum AcIndex ac);
+
+
private:
/**
* \return the default maximum propagation delay
@@ -320,38 +316,38 @@
static Time GetDefaultMaxPropagationDelay (void);
/**
* \return the default slot duration
- *
+ *
* Return a default slot value for 802.11a (9 microseconds).
*/
static Time GetDefaultSlot (void);
/**
* \return the default short interframe space (SIFS)
- *
+ *
* Return a default SIFS value for 802.11a (16 microseconds).
*/
static Time GetDefaultSifs (void);
/**
* \return the default reduced interframe space (RIFS)
- *
+ *
* Return a default RIFS value for 802.11n (2 microseconds).
*/
static Time GetDefaultRifs (void);
/**
* \return the default extended interframe space (EIFS) without
- * DCF interframe space (DIFS)
- *
+ * DCF interframe space (DIFS)
+ *
* Return default SIFS + default CTS-ACK delay
*/
static Time GetDefaultEifsNoDifs (void);
/**
* \return the default CTS-ACK delay
- *
+ *
* Return a default value for 802.11a at 6Mbps (44 microseconds)
*/
static Time GetDefaultCtsAckDelay (void);
/**
* \return the default CTS and ACK timeout
- *
+ *
* Return the default CTS and ACK timeout.
* Cts_Timeout and Ack_Timeout are specified in the Annex C
* (Formal description of MAC operation, see details on the
@@ -384,6 +380,7 @@
* \return the default compressed block ACK timeout
*/
static Time GetDefaultCompressedBlockAckTimeout (void);
+
/**
* \param standard the phy standard to be used
*
@@ -407,7 +404,7 @@
*/
void Configure80211b (void);
/**
- * This method sets 802.11g standards-compliant defaults for following attributes:
+ * This method sets 802.11g standards-compliant defaults for following attributes:
* Sifs, Slot, EifsNoDifs, Pifs, CtsTimeout, and AckTimeout.
* There is no support for short slot time.
*/
@@ -441,7 +438,6 @@
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet> > m_macTxTrace;
-
/**
* The trace source fired when packets coming into the "top" of the device
* are dropped at the MAC layer during transmission.
@@ -449,7 +445,6 @@
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet> > m_macTxDropTrace;
-
/**
* The trace source fired for packets successfully received by the device
* immediately before being forwarded up to higher layers (at the L2/L3
@@ -458,7 +453,6 @@
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet> > m_macPromiscRxTrace;
-
/**
* The trace source fired for packets successfully received by the device
* immediately before being forwarded up to higher layers (at the L2/L3
@@ -467,7 +461,6 @@
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet> > m_macRxTrace;
-
/**
* The trace source fired when packets coming into the "top" of the device
* are dropped at the MAC layer during reception.
@@ -475,9 +468,9 @@
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet> > m_macRxDropTrace;
-
};
-} // namespace ns3
+} //namespace ns3
#endif /* WIFI_MAC_H */
+
--- a/src/wifi/model/wifi-mode.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-mode.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#include "wifi-mode.h"
#include "ns3/simulator.h"
#include "ns3/assert.h"
@@ -29,6 +30,7 @@
*
* \param a WifiMode
* \param b WifiMode
+ *
* \return true if the two WifiModes are identical,
* false otherwise
*/
@@ -41,6 +43,7 @@
*
* \param os std::ostream
* \param mode
+ *
* \return std::ostream
*/
std::ostream & operator << (std::ostream & os, const WifiMode &mode)
@@ -53,6 +56,7 @@
*
* \param is std::istream
* \param mode
+ *
* \return std::istream
*/
std::istream & operator >> (std::istream &is, WifiMode &mode)
@@ -69,54 +73,63 @@
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->bandwidth;
}
+
uint64_t
WifiMode::GetPhyRate (void) const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->phyRate;
}
+
uint64_t
WifiMode::GetDataRate (void) const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->dataRate;
}
+
enum WifiCodeRate
WifiMode::GetCodeRate (void) const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->codingRate;
}
+
uint8_t
WifiMode::GetConstellationSize (void) const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->constellationSize;
}
+
std::string
WifiMode::GetUniqueName (void) const
{
- // needed for ostream printing of the invalid mode
+ //needed for ostream printing of the invalid mode
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->uniqueUid;
}
+
bool
WifiMode::IsMandatory (void) const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->isMandatory;
}
+
uint32_t
WifiMode::GetUid (void) const
{
return m_uid;
}
+
enum WifiModulationClass
WifiMode::GetModulationClass () const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->modClass;
}
+
WifiMode::WifiMode ()
: m_uid (0)
{
@@ -125,6 +138,7 @@
: m_uid (uid)
{
}
+
WifiMode::WifiMode (std::string name)
{
*this = WifiModeFactory::GetFactory ()->Search (name);
@@ -136,7 +150,6 @@
{
}
-
WifiMode
WifiModeFactory::CreateWifiMode (std::string uniqueName,
enum WifiModulationClass modClass,
@@ -151,12 +164,10 @@
WifiModeItem *item = factory->Get (uid);
item->uniqueUid = uniqueName;
item->modClass = modClass;
- // The modulation class for this WifiMode must be valid.
+ //The modulation class for this WifiMode must be valid.
NS_ASSERT (modClass != WIFI_MOD_CLASS_UNKNOWN);
-
item->bandwidth = bandwidth;
item->dataRate = dataRate;
-
item->codingRate = codingRate;
switch (codingRate)
@@ -179,12 +190,12 @@
break;
}
- // Check for compatibility between modulation class and coding
- // rate. If modulation class is DSSS then coding rate must be
- // undefined, and vice versa. I could have done this with an
- // assertion, but it seems better to always give the error (i.e.,
- // not only in non-optimised builds) and the cycles that extra test
- // here costs are only suffered at simulation setup.
+ //Check for compatibility between modulation class and coding
+ //rate. If modulation class is DSSS then coding rate must be
+ //undefined, and vice versa. I could have done this with an
+ //assertion, but it seems better to always give the error (i.e.,
+ //not only in non-optimised builds) and the cycles that extra test
+ //here costs are only suffered at simulation setup.
if ((codingRate == WIFI_CODE_RATE_UNDEFINED) != (modClass == WIFI_MOD_CLASS_DSSS))
{
NS_FATAL_ERROR ("Error in creation of WifiMode named " << uniqueName << std::endl
@@ -211,24 +222,24 @@
j++;
}
- // If we get here then a matching WifiMode was not found above. This
- // is a fatal problem, but we try to be helpful by displaying the
- // list of WifiModes that are supported.
+ //If we get here then a matching WifiMode was not found above. This
+ //is a fatal problem, but we try to be helpful by displaying the
+ //list of WifiModes that are supported.
NS_LOG_UNCOND ("Could not find match for WifiMode named \""
<< name << "\". Valid options are:");
for (i = m_itemList.begin (); i != m_itemList.end (); i++)
{
NS_LOG_UNCOND (" " << i->uniqueUid);
}
- // Empty fatal error to die. We've already unconditionally logged
- // the helpful information.
+ //Empty fatal error to die. We've already unconditionally logged
+ //the helpful information.
NS_FATAL_ERROR ("");
- // This next line is unreachable because of the fatal error
- // immediately above, and that is fortunate, because we have no idea
- // what is in WifiMode (0), but we do know it is not what our caller
- // has requested by name. It's here only because it's the safest
- // thing that'll give valid code.
+ //This next line is unreachable because of the fatal error
+ //immediately above, and that is fortunate, because we have no idea
+ //what is in WifiMode (0), but we do know it is not what our caller
+ //has requested by name. It's here only because it's the safest
+ //thing that'll give valid code.
return WifiMode (0);
}
@@ -279,4 +290,4 @@
return &factory;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/wifi-mode.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-mode.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef WIFI_MODE_H
#define WIFI_MODE_H
@@ -30,7 +31,7 @@
namespace ns3 {
/**
- * This enumeration defines the modulation classes per
+ * This enumeration defines the modulation classes per
* (Table 9-4 "Modulation classes"; IEEE 802.11-2012).
*/
enum WifiModulationClass
@@ -56,7 +57,6 @@
WIFI_MOD_CLASS_HT
};
-
/**
* This enumeration defines the various convolutional coding rates
* used for the OFDM transmission modes in the IEEE 802.11
@@ -74,8 +74,8 @@
WIFI_CODE_RATE_2_3,
/** Rate 1/2 */
WIFI_CODE_RATE_1_2,
- /** Rate 5/6 */
- WIFI_CODE_RATE_5_6
+ /** Rate 5/6 */
+ WIFI_CODE_RATE_5_6
};
@@ -116,19 +116,16 @@
* \returns the size of the modulation constellation.
*/
uint8_t GetConstellationSize (void) const;
-
/**
* \returns a human-readable representation of this WifiMode
* instance.
*/
std::string GetUniqueName (void) const;
-
/**
* \returns true if this mode is a mandatory mode, false
* otherwise.
*/
bool IsMandatory (void) const;
-
/**
* \returns the uid associated to this wireless mode.
*
@@ -137,7 +134,6 @@
* should have different uids.
*/
uint32_t GetUid (void) const;
-
/**
*
* \returns the Modulation Class (Section 9.7.8 "Modulation classes"; IEEE 802.11-2012)
@@ -159,6 +155,8 @@
* \param name std::string of a valid WifiMode name
*/
WifiMode (std::string name);
+
+
private:
friend class WifiModeFactory;
/**
@@ -220,6 +218,7 @@
* for DSSS rates) then the caller should set this parameter to
* WIFI_CODE_RATE_UNCODED.
* \param constellationSize the order of the constellation used.
+ *
* \return WifiMode
*
* Create a WifiMode.
@@ -232,6 +231,7 @@
enum WifiCodeRate codingRate,
uint8_t constellationSize);
+
private:
friend class WifiMode;
friend std::istream & operator >> (std::istream &is, WifiMode &mode);
@@ -265,6 +265,7 @@
* Search and return WifiMode from a given name.
*
* \param name human-readable WifiMode
+ *
* \return WifiMode
*/
WifiMode Search (std::string name);
@@ -272,6 +273,7 @@
* Allocate a WifiModeItem from a given uniqueUid.
*
* \param uniqueUid
+ *
* \return uid
*/
uint32_t AllocateUid (std::string uniqueUid);
@@ -279,6 +281,7 @@
* Return a WifiModeItem at the given uid index.
*
* \param uid
+ *
* \return WifiModeItem at the given uid
*/
WifiModeItem* Get (uint32_t uid);
@@ -290,6 +293,7 @@
WifiModeItemList m_itemList;
};
-} // namespace ns3
+} //namespace ns3
#endif /* WIFI_MODE_H */
+
--- a/src/wifi/model/wifi-net-device.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-net-device.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#include "wifi-net-device.h"
#include "wifi-mac.h"
#include "wifi-phy.h"
@@ -76,6 +77,7 @@
{
NS_LOG_FUNCTION_NOARGS ();
}
+
WifiNetDevice::~WifiNetDevice ()
{
NS_LOG_FUNCTION_NOARGS ();
@@ -92,7 +94,6 @@
m_mac = 0;
m_phy = 0;
m_stationManager = 0;
- // chain up.
NetDevice::DoDispose ();
}
@@ -132,28 +133,33 @@
m_mac = mac;
CompleteConfig ();
}
+
void
WifiNetDevice::SetPhy (Ptr<WifiPhy> phy)
{
m_phy = phy;
CompleteConfig ();
}
+
void
WifiNetDevice::SetRemoteStationManager (Ptr<WifiRemoteStationManager> manager)
{
m_stationManager = manager;
CompleteConfig ();
}
+
Ptr<WifiMac>
WifiNetDevice::GetMac (void) const
{
return m_mac;
}
+
Ptr<WifiPhy>
WifiNetDevice::GetPhy (void) const
{
return m_phy;
}
+
Ptr<WifiRemoteStationManager>
WifiNetDevice::GetRemoteStationManager (void) const
{
@@ -165,31 +171,37 @@
{
m_ifIndex = index;
}
+
uint32_t
WifiNetDevice::GetIfIndex (void) const
{
return m_ifIndex;
}
+
Ptr<Channel>
WifiNetDevice::GetChannel (void) const
{
return m_phy->GetChannel ();
}
+
Ptr<WifiChannel>
WifiNetDevice::DoGetChannel (void) const
{
return m_phy->GetChannel ();
}
+
void
WifiNetDevice::SetAddress (Address address)
{
m_mac->SetAddress (Mac48Address::ConvertFrom (address));
}
+
Address
WifiNetDevice::GetAddress (void) const
{
return m_mac->GetAddress ();
}
+
bool
WifiNetDevice::SetMtu (const uint16_t mtu)
{
@@ -200,55 +212,66 @@
m_mtu = mtu;
return true;
}
+
uint16_t
WifiNetDevice::GetMtu (void) const
{
return m_mtu;
}
+
bool
WifiNetDevice::IsLinkUp (void) const
{
return m_phy != 0 && m_linkUp;
}
+
void
WifiNetDevice::AddLinkChangeCallback (Callback<void> callback)
{
m_linkChanges.ConnectWithoutContext (callback);
}
+
bool
WifiNetDevice::IsBroadcast (void) const
{
return true;
}
+
Address
WifiNetDevice::GetBroadcast (void) const
{
return Mac48Address::GetBroadcast ();
}
+
bool
WifiNetDevice::IsMulticast (void) const
{
return true;
}
+
Address
WifiNetDevice::GetMulticast (Ipv4Address multicastGroup) const
{
return Mac48Address::GetMulticast (multicastGroup);
}
+
Address WifiNetDevice::GetMulticast (Ipv6Address addr) const
{
return Mac48Address::GetMulticast (addr);
}
+
bool
WifiNetDevice::IsPointToPoint (void) const
{
return false;
}
+
bool
WifiNetDevice::IsBridge (void) const
{
return false;
}
+
bool
WifiNetDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber)
{
@@ -264,22 +287,26 @@
m_mac->Enqueue (packet, realTo);
return true;
}
+
Ptr<Node>
WifiNetDevice::GetNode (void) const
{
return m_node;
}
+
void
WifiNetDevice::SetNode (Ptr<Node> node)
{
m_node = node;
CompleteConfig ();
}
+
bool
WifiNetDevice::NeedsArp (void) const
{
return true;
}
+
void
WifiNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb)
{
@@ -328,6 +355,7 @@
m_linkUp = true;
m_linkChanges ();
}
+
void
WifiNetDevice::LinkDown (void)
{
@@ -358,7 +386,7 @@
WifiNetDevice::SetPromiscReceiveCallback (PromiscReceiveCallback cb)
{
m_promiscRx = cb;
- m_mac->SetPromisc();
+ m_mac->SetPromisc ();
}
bool
@@ -367,5 +395,4 @@
return m_mac->SupportsSendFrom ();
}
-} // namespace ns3
-
+} //namespace ns3
--- a/src/wifi/model/wifi-net-device.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-net-device.h Sun Jun 21 00:23:45 2015 +0200
@@ -82,7 +82,7 @@
Ptr<WifiRemoteStationManager> GetRemoteStationManager (void) const;
- // inherited from NetDevice base class.
+ //inherited from NetDevice base class.
virtual void SetIfIndex (const uint32_t index);
virtual uint32_t GetIfIndex (void) const;
virtual Ptr<Channel> GetChannel (void) const;
@@ -109,9 +109,11 @@
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;
+
+
protected:
- virtual void DoDispose (void);
- virtual void DoInitialize (void);
+ virtual void DoDispose (void);
+ virtual void DoInitialize (void);
/**
* Receive a packet from the lower layer and pass the
* packet up the stack.
@@ -120,9 +122,11 @@
* \param from
* \param to
*/
- void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
+ void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
+
+
private:
- // This value conforms to the 802.11 specification
+ //This value conforms to the 802.11 specification
static const uint16_t MAX_MSDU_SIZE = 2304;
/**
@@ -163,6 +167,6 @@
bool m_configComplete;
};
-} // namespace ns3
+} //namespace ns3
#endif /* WIFI_NET_DEVICE_H */
--- a/src/wifi/model/wifi-phy-standard.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-phy-standard.h Sun Jun 21 00:23:45 2015 +0200
@@ -45,12 +45,12 @@
* ACM MOBICOM, 2001.
*/
WIFI_PHY_STANDARD_holland,
- // 11n support
+ /** HT OFDM PHY for the 2.4 GHz band (clause 20) */
WIFI_PHY_STANDARD_80211n_2_4GHZ,
- // needed for different mac parameters
+ /** HT OFDM PHY for the 5 GHz band (clause 20) */
WIFI_PHY_STANDARD_80211n_5GHZ
};
-} // namespace ns3
+} //namespace ns3
#endif /* WIFI_PHY_STANDARD_H */
--- a/src/wifi/model/wifi-phy-state-helper.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-phy-state-helper.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#include "wifi-phy-state-helper.h"
#include "ns3/log.h"
#include "ns3/simulator.h"
@@ -77,23 +78,26 @@
{
m_rxOkCallback = callback;
}
+
void
WifiPhyStateHelper::SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback)
{
m_rxErrorCallback = callback;
}
+
void
WifiPhyStateHelper::RegisterListener (WifiPhyListener *listener)
{
m_listeners.push_back (listener);
}
+
void
WifiPhyStateHelper::UnregisterListener (WifiPhyListener *listener)
{
- ListenersI i = find (m_listeners.begin(), m_listeners.end(), listener);
- if (i != m_listeners.end())
+ ListenersI i = find (m_listeners.begin (), m_listeners.end (), listener);
+ if (i != m_listeners.end ())
{
- m_listeners.erase(i);
+ m_listeners.erase (i);
}
}
@@ -102,39 +106,43 @@
{
return (GetState () == WifiPhy::IDLE);
}
+
bool
WifiPhyStateHelper::IsStateBusy (void)
{
return (GetState () != WifiPhy::IDLE);
}
+
bool
WifiPhyStateHelper::IsStateCcaBusy (void)
{
return (GetState () == WifiPhy::CCA_BUSY);
}
+
bool
WifiPhyStateHelper::IsStateRx (void)
{
return (GetState () == WifiPhy::RX);
}
+
bool
WifiPhyStateHelper::IsStateTx (void)
{
return (GetState () == WifiPhy::TX);
}
+
bool
WifiPhyStateHelper::IsStateSwitching (void)
{
return (GetState () == WifiPhy::SWITCHING);
}
+
bool
WifiPhyStateHelper::IsStateSleep (void)
{
return (GetState () == WifiPhy::SLEEP);
}
-
-
Time
WifiPhyStateHelper::GetStateDuration (void)
{
@@ -211,7 +219,6 @@
}
}
-
void
WifiPhyStateHelper::NotifyTxStart (Time duration, double txPowerDbm)
{
@@ -220,6 +227,7 @@
(*i)->NotifyTxStart (duration, txPowerDbm);
}
}
+
void
WifiPhyStateHelper::NotifyRxStart (Time duration)
{
@@ -228,6 +236,7 @@
(*i)->NotifyRxStart (duration);
}
}
+
void
WifiPhyStateHelper::NotifyRxEndOk (void)
{
@@ -236,6 +245,7 @@
(*i)->NotifyRxEndOk ();
}
}
+
void
WifiPhyStateHelper::NotifyRxEndError (void)
{
@@ -244,6 +254,7 @@
(*i)->NotifyRxEndError ();
}
}
+
void
WifiPhyStateHelper::NotifyMaybeCcaBusyStart (Time duration)
{
@@ -252,6 +263,7 @@
(*i)->NotifyMaybeCcaBusyStart (duration);
}
}
+
void
WifiPhyStateHelper::NotifySwitchingStart (Time duration)
{
@@ -260,6 +272,7 @@
(*i)->NotifySwitchingStart (duration);
}
}
+
void
WifiPhyStateHelper::NotifySleep (void)
{
@@ -268,6 +281,7 @@
(*i)->NotifySleep ();
}
}
+
void
WifiPhyStateHelper::NotifyWakeup (void)
{
@@ -277,7 +291,6 @@
}
}
-
void
WifiPhyStateHelper::LogPreviousIdleAndCcaBusyStates (void)
{
@@ -302,7 +315,7 @@
WifiPhyStateHelper::SwitchToTx (Time txDuration, Ptr<const Packet> packet, double txPowerDbm,
WifiTxVector txVector, WifiPreamble preamble)
{
- m_txTrace (packet, txVector.GetMode(), preamble, txVector.GetTxPowerLevel());
+ m_txTrace (packet, txVector.GetMode (), preamble, txVector.GetTxPowerLevel ());
Time now = Simulator::Now ();
switch (GetState ())
{
@@ -336,6 +349,7 @@
m_startTx = now;
NotifyTxStart (txDuration, txPowerDbm);
}
+
void
WifiPhyStateHelper::SwitchToRx (Time rxDuration)
{
@@ -417,7 +431,7 @@
void
WifiPhyStateHelper::SwitchFromRxEndOk (Ptr<Packet> packet, double snr, WifiTxVector txVector, enum WifiPreamble preamble)
{
- m_rxOkTrace (packet, snr, txVector.GetMode(), preamble);
+ m_rxOkTrace (packet, snr, txVector.GetMode (), preamble);
NotifyRxEndOk ();
DoSwitchFromRx ();
if (!m_rxOkCallback.IsNull ())
@@ -426,6 +440,7 @@
}
}
+
void
WifiPhyStateHelper::SwitchFromRxEndError (Ptr<const Packet> packet, double snr)
{
@@ -451,6 +466,7 @@
NS_ASSERT (IsStateIdle () || IsStateCcaBusy ());
}
+
void
WifiPhyStateHelper::SwitchMaybeToCcaBusy (Time duration)
{
@@ -478,6 +494,7 @@
}
m_endCcaBusy = std::max (m_endCcaBusy, now + duration);
}
+
void
WifiPhyStateHelper::SwitchToSleep (void)
{
@@ -507,6 +524,7 @@
NotifySleep ();
NS_ASSERT (IsStateSleep ());
}
+
void
WifiPhyStateHelper::SwitchFromSleep (Time duration)
{
@@ -516,10 +534,12 @@
m_previousStateChangeTime = now;
m_sleeping = false;
NotifyWakeup ();
- // update m_endCcaBusy after the sleep period
+ //update m_endCcaBusy after the sleep period
m_endCcaBusy = std::max (m_endCcaBusy, now + duration);
if (m_endCcaBusy > now)
- NotifyMaybeCcaBusyStart (m_endCcaBusy - now);
+ {
+ NotifyMaybeCcaBusyStart (m_endCcaBusy - now);
+ }
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/wifi-phy-state-helper.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-phy-state-helper.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef WIFI_PHY_STATE_HELPER_H
#define WIFI_PHY_STATE_HELPER_H
@@ -196,20 +197,18 @@
* the \p state.
* \param [in] state The state.
*/
- typedef void (* StateTracedCallback)
- (const Time start, const Time duration, const WifiPhy::State state);
+ typedef void (* StateTracedCallback)(const Time start, const Time duration, const WifiPhy::State state);
/**
* TracedCallback signature for receive end ok event.
*
* \param [in] packet The received packet.
* \param [in] snr The SNR of the received packet.
- * \param [in] mode The transmission mode of the packet.
+ * \param [in] mode The transmission mode of the packet.
* \param [in] preamble The preamble of the packet.
*/
- typedef void (* RxOkTracedCallback)
- (const Ptr<const Packet> packet, const double snr,
- const WifiMode mode, const WifiPreamble preamble);
+ typedef void (* RxOkTracedCallback)(const Ptr<const Packet> packet, const double snr,
+ const WifiMode mode, const WifiPreamble preamble);
/**
* TracedCallback signature for receive end error event.
@@ -217,22 +216,20 @@
* \param [in] packet The received packet.
* \param [in] snr The SNR of the received packet.
*/
- typedef void (* RxEndErrorTracedCallback)
- (const Ptr<const Packet> packet, const double snr);
+ typedef void (* RxEndErrorTracedCallback)(const Ptr<const Packet> packet, const double snr);
/**
* TracedCallback signature for transmit event.
*
* \param [in] packet The received packet.
- * \param [in] mode The transmission mode of the packet.
+ * \param [in] mode The transmission mode of the packet.
* \param [in] preamble The preamble of the packet.
* \param [in] power The transmit power level.
*/
- typedef void (* TxTracedCallback)
- (const Ptr<const Packet> packet, const WifiMode mode,
- const WifiPreamble preamble, const uint8_t power);
-
-
+ typedef void (* TxTracedCallback)(const Ptr<const Packet> packet, const WifiMode mode,
+ const WifiPreamble preamble, const uint8_t power);
+
+
private:
/**
* typedef for a list of WifiPhyListeners
@@ -313,6 +310,6 @@
WifiPhy::RxErrorCallback m_rxErrorCallback;
};
-} // namespace ns3
+} //namespace ns3
#endif /* WIFI_PHY_STATE_HELPER_H */
--- a/src/wifi/model/wifi-phy.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-phy.cc Sun Jun 21 00:23:45 2015 +0200
@@ -122,11 +122,11 @@
{
switch (payloadMode.GetBandwidth ())
{
- case 20000000:
- default:
- return WifiPhy::GetOfdmRate6_5MbpsBW20MHz ();
- case 40000000:
- return WifiPhy::GetOfdmRate13_5MbpsBW40MHz ();
+ case 20000000:
+ default:
+ return WifiPhy::GetOfdmRate6_5MbpsBW20MHz ();
+ case 40000000:
+ return WifiPhy::GetOfdmRate13_5MbpsBW40MHz ();
}
}
@@ -134,13 +134,13 @@
WifiPhy::GetPlcpHtTrainingSymbolDuration (WifiPreamble preamble, WifiTxVector txvector)
{
uint8_t Ndltf, Neltf;
- //We suppose here that STBC = 0.
+ //We suppose here that STBC = 0.
//If STBC > 0, we need a different mapping between Nss and Nltf (IEEE 802.11n-2012 standard, page 1682).
if (txvector.GetNss () < 3)
{
Ndltf = txvector.GetNss ();
}
- else
+ else
{
Ndltf = 4;
}
@@ -148,20 +148,20 @@
{
Neltf = txvector.GetNess ();
}
- else
+ else
{
Neltf = 4;
}
switch (preamble)
{
- case WIFI_PREAMBLE_HT_MF:
- return MicroSeconds (4 + (4 * Ndltf) + (4 * Neltf));
- case WIFI_PREAMBLE_HT_GF:
- return MicroSeconds ((4 * Ndltf) + (4 * Neltf));
- default:
- //no training for non HT
- return MicroSeconds (0);
+ case WIFI_PREAMBLE_HT_MF:
+ return MicroSeconds (4 + (4 * Ndltf) + (4 * Neltf));
+ case WIFI_PREAMBLE_HT_GF:
+ return MicroSeconds ((4 * Ndltf) + (4 * Neltf));
+ default:
+ //no training for non HT
+ return MicroSeconds (0);
}
}
@@ -170,13 +170,13 @@
{
switch (preamble)
{
- case WIFI_PREAMBLE_HT_MF:
- case WIFI_PREAMBLE_HT_GF:
- //HT-SIG
- return MicroSeconds (8);
- default:
- //no HT-SIG for non HT
- return MicroSeconds (0);
+ case WIFI_PREAMBLE_HT_MF:
+ case WIFI_PREAMBLE_HT_GF:
+ //HT-SIG
+ return MicroSeconds (8);
+ default:
+ //no HT-SIG for non HT
+ return MicroSeconds (0);
}
}
@@ -185,52 +185,52 @@
{
switch (payloadMode.GetModulationClass ())
{
- case WIFI_MOD_CLASS_OFDM:
- {
- switch (payloadMode.GetBandwidth ())
- {
- case 5000000:
- return WifiPhy::GetOfdmRate1_5MbpsBW5MHz ();
- case 10000000:
- return WifiPhy::GetOfdmRate3MbpsBW10MHz ();
+ case WIFI_MOD_CLASS_OFDM:
+ {
+ switch (payloadMode.GetBandwidth ())
+ {
+ case 5000000:
+ return WifiPhy::GetOfdmRate1_5MbpsBW5MHz ();
+ case 10000000:
+ return WifiPhy::GetOfdmRate3MbpsBW10MHz ();
+ default:
+ //(Section 18.3.2 "PLCP frame format"; IEEE Std 802.11-2012)
+ //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_HT:
+ {
+ //return the HT-SIG
+ //IEEE Std 802.11n, 20.3.23
+ switch (preamble)
+ {
+ case WIFI_PREAMBLE_HT_MF:
+ switch (payloadMode.GetBandwidth ())
+ {
+ case 20000000:
+ return WifiPhy::GetOfdmRate13MbpsBW20MHz ();
+ case 40000000:
+ return WifiPhy::GetOfdmRate27MbpsBW40MHz ();
default:
- //(Section 18.3.2 "PLCP frame format"; IEEE Std 802.11-2012)
- //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_HT:
- {
- //return the HT-SIG
- //IEEE Std 802.11n, 20.3.23
- switch (preamble)
- {
- case WIFI_PREAMBLE_HT_MF:
- switch (payloadMode.GetBandwidth ())
- {
- case 20000000:
- return WifiPhy::GetOfdmRate13MbpsBW20MHz ();
- case 40000000:
- return WifiPhy::GetOfdmRate27MbpsBW40MHz ();
- default:
- return WifiPhy::GetOfdmRate13MbpsBW20MHz ();
- }
- case WIFI_PREAMBLE_HT_GF:
- switch (payloadMode.GetBandwidth ())
- {
- case 20000000:
- return WifiPhy::GetOfdmRate13MbpsBW20MHz ();
- case 40000000:
- return WifiPhy::GetOfdmRate27MbpsBW40MHz ();
- default:
- return WifiPhy::GetOfdmRate13MbpsBW20MHz ();
- }
+ return WifiPhy::GetOfdmRate13MbpsBW20MHz ();
+ }
+ case WIFI_PREAMBLE_HT_GF:
+ switch (payloadMode.GetBandwidth ())
+ {
+ case 20000000:
+ return WifiPhy::GetOfdmRate13MbpsBW20MHz ();
+ case 40000000:
+ return WifiPhy::GetOfdmRate27MbpsBW40MHz ();
default:
- return WifiPhy::GetOfdmRate6Mbps ();
- }
- }
+ return WifiPhy::GetOfdmRate13MbpsBW20MHz ();
+ }
+ default:
+ return WifiPhy::GetOfdmRate6Mbps ();
+ }
+ }
case WIFI_MOD_CLASS_ERP_OFDM:
return WifiPhy::GetErpOfdmRate6Mbps ();
case WIFI_MOD_CLASS_DSSS:
@@ -255,7 +255,7 @@
{
if (preamble == WIFI_PREAMBLE_NONE)
{
- return MicroSeconds(0);
+ return MicroSeconds (0);
}
switch (payloadMode.GetModulationClass ())
{
@@ -286,11 +286,11 @@
//IEEE 802.11n Figure 20.1
switch (preamble)
{
- case WIFI_PREAMBLE_HT_MF:
- default:
- return MicroSeconds (4);
- case WIFI_PREAMBLE_HT_GF:
- return MicroSeconds (0);
+ case WIFI_PREAMBLE_HT_MF:
+ default:
+ return MicroSeconds (4);
+ case WIFI_PREAMBLE_HT_GF:
+ return MicroSeconds (0);
}
}
case WIFI_MOD_CLASS_ERP_OFDM:
@@ -321,44 +321,44 @@
}
switch (payloadMode.GetModulationClass ())
{
- case WIFI_MOD_CLASS_OFDM:
+ case WIFI_MOD_CLASS_OFDM:
+ {
+ switch (payloadMode.GetBandwidth ())
+ {
+ case 20000000:
+ default:
+ //(Section 18.3.3 "PLCP preamble (SYNC))" Figure 18-4 "OFDM training structure"
+ //also Section 18.3.2.3 "Modulation-dependent parameters" Table 18-4 "Modulation-dependent parameters"; IEEE Std 802.11-2012)
+ return MicroSeconds (16);
+ case 10000000:
+ //(Section 18.3.3 "PLCP preamble (SYNC))" Figure 18-4 "OFDM training structure"
+ //also Section 18.3.2.3 "Modulation-dependent parameters" Table 18-4 "Modulation-dependent parameters"; IEEE Std 802.11-2012)
+ return MicroSeconds (32);
+ case 5000000:
+ //(Section 18.3.3 "PLCP preamble (SYNC))" Figure 18-4 "OFDM training structure"
+ //also Section 18.3.2.3 "Modulation-dependent parameters" Table 18-4 "Modulation-dependent parameters"; IEEE Std 802.11-2012)
+ return MicroSeconds (64);
+ }
+ }
+ case WIFI_MOD_CLASS_HT:
+ //IEEE 802.11n Figure 20.1 the training symbols before L_SIG or HT_SIG
+ return MicroSeconds (16);
+ case WIFI_MOD_CLASS_ERP_OFDM:
+ return MicroSeconds (16);
+ case WIFI_MOD_CLASS_DSSS:
+ if (preamble == WIFI_PREAMBLE_SHORT)
{
- switch (payloadMode.GetBandwidth ())
- {
- case 20000000:
- default:
- //(Section 18.3.3 "PLCP preamble (SYNC))" Figure 18-4 "OFDM training structure"
- //also Section 18.3.2.3 "Modulation-dependent parameters" Table 18-4 "Modulation-dependent parameters"; IEEE Std 802.11-2012)
- return MicroSeconds (16);
- case 10000000:
- //(Section 18.3.3 "PLCP preamble (SYNC))" Figure 18-4 "OFDM training structure"
- //also Section 18.3.2.3 "Modulation-dependent parameters" Table 18-4 "Modulation-dependent parameters"; IEEE Std 802.11-2012)
- return MicroSeconds (32);
- case 5000000:
- //(Section 18.3.3 "PLCP preamble (SYNC))" Figure 18-4 "OFDM training structure"
- //also Section 18.3.2.3 "Modulation-dependent parameters" Table 18-4 "Modulation-dependent parameters"; IEEE Std 802.11-2012)
- return MicroSeconds (64);
- }
+ //(Section 17.2.2.3 "Short PPDU format)" Figure 17-2 "Short PPDU format"; IEEE Std 802.11-2012)
+ return MicroSeconds (72);
}
- case WIFI_MOD_CLASS_HT:
- //IEEE 802.11n Figure 20.1 the training symbols before L_SIG or HT_SIG
- return MicroSeconds (16);
- case WIFI_MOD_CLASS_ERP_OFDM:
- return MicroSeconds (16);
- case WIFI_MOD_CLASS_DSSS:
- if (preamble == WIFI_PREAMBLE_SHORT)
- {
- //(Section 17.2.2.3 "Short PPDU format)" Figure 17-2 "Short PPDU format"; IEEE Std 802.11-2012)
- return MicroSeconds (72);
- }
- else //WIFI_PREAMBLE_LONG
- {
- //(Section 17.2.2.2 "Long PPDU format)" Figure 17-1 "Long PPDU format"; IEEE Std 802.11-2012)
- return MicroSeconds (144);
- }
- default:
- NS_FATAL_ERROR ("unsupported modulation class");
- return MicroSeconds (0);
+ else //WIFI_PREAMBLE_LONG
+ {
+ //(Section 17.2.2.2 "Long PPDU format)" Figure 17-1 "Long PPDU format"; IEEE Std 802.11-2012)
+ return MicroSeconds (144);
+ }
+ default:
+ NS_FATAL_ERROR ("unsupported modulation class");
+ return MicroSeconds (0);
}
}
@@ -370,24 +370,24 @@
switch (payloadMode.GetModulationClass ())
{
- case WIFI_MOD_CLASS_OFDM:
- case WIFI_MOD_CLASS_ERP_OFDM:
- {
- //(Section 18.3.2.4 "Timing related parameters" Table 18-5 "Timing-related parameters"; IEEE Std 802.11-2012
- //corresponds to T_{SYM} in the table)
- Time symbolDuration;
- switch (payloadMode.GetBandwidth ())
- {
- case 20000000:
- default:
- symbolDuration = MicroSeconds (4);
- break;
- case 10000000:
- symbolDuration = MicroSeconds (8);
- break;
- case 5000000:
- symbolDuration = MicroSeconds (16);
- break;
+ case WIFI_MOD_CLASS_OFDM:
+ case WIFI_MOD_CLASS_ERP_OFDM:
+ {
+ //(Section 18.3.2.4 "Timing related parameters" Table 18-5 "Timing-related parameters"; IEEE Std 802.11-2012
+ //corresponds to T_{SYM} in the table)
+ Time symbolDuration;
+ switch (payloadMode.GetBandwidth ())
+ {
+ case 20000000:
+ default:
+ symbolDuration = MicroSeconds (4);
+ break;
+ case 10000000:
+ symbolDuration = MicroSeconds (8);
+ break;
+ case 5000000:
+ symbolDuration = MicroSeconds (16);
+ break;
}
//(Section 18.3.2.3 "Modulation-dependent parameters" Table 18-4 "Modulation-dependent parameters"; IEEE Std 802.11-2012)
@@ -405,7 +405,7 @@
{
m_totalAmpduSize += size;
m_totalAmpduNumSymbols += numSymbols;
- }
+ }
}
else if (packetType == 1 && preamble == WIFI_PREAMBLE_NONE)
{
@@ -419,15 +419,15 @@
}
else if (packetType == 2 && preamble == WIFI_PREAMBLE_NONE)
{
- //last packet in an A-MPDU
- uint32_t totalAmpduSize = m_totalAmpduSize + size;
- numSymbols = lrint (ceil ((16 + totalAmpduSize * 8.0 + 6) / numDataBitsPerSymbol));
- numSymbols -= m_totalAmpduNumSymbols;
- if (incFlag == 1)
- {
- m_totalAmpduSize = 0;
- m_totalAmpduNumSymbols = 0;
- }
+ //last packet in an A-MPDU
+ uint32_t totalAmpduSize = m_totalAmpduSize + size;
+ numSymbols = lrint (ceil ((16 + totalAmpduSize * 8.0 + 6) / numDataBitsPerSymbol));
+ numSymbols -= m_totalAmpduNumSymbols;
+ if (incFlag == 1)
+ {
+ m_totalAmpduSize = 0;
+ m_totalAmpduNumSymbols = 0;
+ }
}
else if (packetType == 0 && preamble != WIFI_PREAMBLE_NONE)
{
@@ -435,7 +435,9 @@
numSymbols = lrint (ceil ((16 + size * 8.0 + 6.0) / numDataBitsPerSymbol));
}
else
- NS_FATAL_ERROR ("Wrong combination of preamble and packet type");
+ {
+ NS_FATAL_ERROR ("Wrong combination of preamble and packet type");
+ }
//Add signal extension for ERP PHY
if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
@@ -461,49 +463,53 @@
{
switch (payloadMode.GetDataRate () / (txvector.GetNss ()))
{
- //shortGi
- case 7200000:
- case 14400000:
- case 21700000:
- case 28900000:
- case 43300000:
- case 57800000:
- case 72200000:
- case 15000000:
- case 30000000:
- case 45000000:
- case 60000000:
- case 90000000:
- case 120000000:
- case 150000000:
- symbolDuration = NanoSeconds (3600);
- break;
- default:
- symbolDuration = MicroSeconds (4);
+ //shortGi
+ case 7200000:
+ case 14400000:
+ case 21700000:
+ case 28900000:
+ case 43300000:
+ case 57800000:
+ case 72200000:
+ case 15000000:
+ case 30000000:
+ case 45000000:
+ case 60000000:
+ case 90000000:
+ case 120000000:
+ case 150000000:
+ symbolDuration = NanoSeconds (3600);
+ break;
+ default:
+ symbolDuration = MicroSeconds (4);
}
}
-
+
if (txvector.IsStbc ())
+ {
m_Stbc = 2;
+ }
else
+ {
m_Stbc = 1;
-
+ }
+
//check tables 20-35 and 20-36 in the standard to get cases when nes =2
double Nes = 1;
-
+
//IEEE Std 802.11n, section 20.3.11, equation (20-32)
uint32_t numSymbols;
double numDataBitsPerSymbol = payloadMode.GetDataRate () * txvector.GetNss () * symbolDuration.GetNanoSeconds () / 1e9;
if (packetType == 1 && preamble != WIFI_PREAMBLE_NONE)
{
- //First packet in an A-MPDU
- numSymbols = ceil (m_Stbc * (16 + size * 8.0 + 6 * Nes) / (m_Stbc * numDataBitsPerSymbol));
- if (incFlag == 1)
- {
- m_totalAmpduSize += size;
- m_totalAmpduNumSymbols += numSymbols;
- }
+ //First packet in an A-MPDU
+ numSymbols = ceil (m_Stbc * (16 + size * 8.0 + 6 * Nes) / (m_Stbc * numDataBitsPerSymbol));
+ if (incFlag == 1)
+ {
+ m_totalAmpduSize += size;
+ m_totalAmpduNumSymbols += numSymbols;
+ }
}
else if (packetType == 1 && preamble == WIFI_PREAMBLE_NONE)
{
@@ -534,8 +540,10 @@
numSymbols = lrint (m_Stbc * ceil ((16 + size * 8.0 + 6.0 * Nes) / (m_Stbc * numDataBitsPerSymbol)));
}
else
- NS_FATAL_ERROR ("Wrong combination of preamble and packet type");
-
+ {
+ NS_FATAL_ERROR ("Wrong combination of preamble and packet type");
+ }
+
if (frequency >= 2400 && frequency <= 2500 && ((packetType == 0 && preamble != WIFI_PREAMBLE_NONE) || (packetType == 2 && preamble == WIFI_PREAMBLE_NONE))) //at 2.4 GHz
{
return Time (numSymbols * symbolDuration) + MicroSeconds (6);
@@ -562,9 +570,9 @@
{
WifiMode payloadMode = txvector.GetMode ();
Time duration = GetPlcpPreambleDuration (payloadMode, preamble)
- + GetPlcpHeaderDuration (payloadMode, preamble)
- + GetPlcpHtSigHeaderDuration (preamble)
- + GetPlcpHtTrainingSymbolDuration (preamble, txvector);
+ + GetPlcpHeaderDuration (payloadMode, preamble)
+ + GetPlcpHtSigHeaderDuration (preamble)
+ + GetPlcpHtTrainingSymbolDuration (preamble, txvector);
return duration;
}
@@ -572,7 +580,7 @@
WifiPhy::CalculateTxDuration (uint32_t size, WifiTxVector txvector, WifiPreamble preamble, double frequency, uint8_t packetType, uint8_t incFlag)
{
Time duration = CalculatePlcpPreambleAndHeaderDuration (txvector, preamble)
- + GetPayloadDuration (size, txvector, preamble, frequency, packetType, incFlag);
+ + GetPayloadDuration (size, txvector, preamble, frequency, packetType, incFlag);
return duration;
}
@@ -1117,12 +1125,12 @@
WifiPhy::GetOfdmRate6_5MbpsBW20MHz ()
{
static WifiMode mode =
- WifiModeFactory::CreateWifiMode ("OfdmRate6_5MbpsBW20MHz",
- WIFI_MOD_CLASS_HT,
- true,
- 20000000, 6500000,
- WIFI_CODE_RATE_1_2,
- 2);
+ WifiModeFactory::CreateWifiMode ("OfdmRate6_5MbpsBW20MHz",
+ WIFI_MOD_CLASS_HT,
+ true,
+ 20000000, 6500000,
+ WIFI_CODE_RATE_1_2,
+ 2);
return mode;
}
@@ -1130,12 +1138,12 @@
WifiPhy::GetOfdmRate7_2MbpsBW20MHz ()
{
static WifiMode mode =
- WifiModeFactory::CreateWifiMode ("OfdmRate7_2MbpsBW20MHz",
- WIFI_MOD_CLASS_HT,
- false,
- 20000000, 7200000,
- WIFI_CODE_RATE_1_2,
- 2);
+ WifiModeFactory::CreateWifiMode ("OfdmRate7_2MbpsBW20MHz",
+ WIFI_MOD_CLASS_HT,
+ false,
+ 20000000, 7200000,
+ WIFI_CODE_RATE_1_2,
+ 2);
return mode;
}
@@ -1552,7 +1560,7 @@
}
}
-} // namespace ns3
+} //namespace ns3
namespace {
@@ -1607,7 +1615,7 @@
ns3::WifiPhy::GetOfdmRate65MbpsBW20MHz ();
ns3::WifiPhy::GetOfdmRate13_5MbpsBW40MHz ();
ns3::WifiPhy::GetOfdmRate27MbpsBW40MHz ();
- ns3::WifiPhy::GetOfdmRate40_5MbpsBW40MHz ();
+ ns3::WifiPhy::GetOfdmRate40_5MbpsBW40MHz ();
ns3::WifiPhy::GetOfdmRate54MbpsBW40MHz ();
ns3::WifiPhy::GetOfdmRate81MbpsBW40MHz ();
ns3::WifiPhy::GetOfdmRate108MbpsBW40MHz ();
--- a/src/wifi/model/wifi-phy.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-phy.h Sun Jun 21 00:23:45 2015 +0200
@@ -289,12 +289,12 @@
* \param preamble the type of preamble to use for this packet.
* \param frequency the channel center frequency (MHz)
* \param packetType the type of the packet 0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU
- * \param incFlag this flag is used to indicate that the static variables need to be update or not. This function is called a couple of times for the same packet so static variables should not be increased each time.
+ * \param incFlag this flag is used to indicate that the static variables need to be update or not. This function is called a couple of times for the same packet so static variables should not be increased each time.
*
* \return the total amount of time this PHY will stay busy for the transmission of these bytes.
*/
Time CalculateTxDuration (uint32_t size, WifiTxVector txvector, enum WifiPreamble preamble, double frequency, uint8_t packetType, uint8_t incFlag);
-
+
/**
* \param txvector the transmission parameters used for this packet
* \param preamble the type of preamble to use for this packet.
@@ -313,45 +313,45 @@
/**
* \param payloadMode the WifiMode use for the transmission of the payload
* \param preamble the type of preamble
- *
- * \return the WifiMode used for the transmission of the HT-SIG in Mixed Format and greenfield format PLCP header
+ *
+ * \return the WifiMode used for the transmission of the HT-SIG in Mixed Format and greenfield format PLCP header
*/
static WifiMode GetMFPlcpHeaderMode (WifiMode payloadMode, WifiPreamble preamble);
- /**
+ /**
* \param preamble the type of preamble
- *
- * \return the duration of the HT-SIG in Mixed Format and greenfield format PLCP header
+ *
+ * \return the duration of the HT-SIG in Mixed Format and greenfield format PLCP header
*/
static Time GetPlcpHtSigHeaderDuration (WifiPreamble preamble);
- /**
+ /**
* \param payloadMode the WifiMode use for the transmission of the payload
* \param preamble the type of preamble
- *
- * \return the WifiMode used for the transmission of the PLCP header
+ *
+ * \return the WifiMode used for the transmission of the PLCP header
*/
static WifiMode GetPlcpHeaderMode (WifiMode payloadMode, WifiPreamble preamble);
/**
* \param payloadMode the WifiMode use for the transmission of the payload
* \param preamble the type of preamble
- *
+ *
* \return the duration of the PLCP header
*/
static Time GetPlcpHeaderDuration (WifiMode payloadMode, WifiPreamble preamble);
- /**
+ /**
* \param payloadMode the WifiMode use for the transmission of the payload
- * \param preamble the type of preamble
- *
+ * \param preamble the type of preamble
+ *
* \return the duration of the PLCP preamble
*/
static Time GetPlcpPreambleDuration (WifiMode payloadMode, WifiPreamble preamble);
- /**
+ /**
* \param size the number of bytes in the packet to send
* \param txvector the transmission parameters used for this packet
* \param preamble the type of preamble to use for this packet
* \param frequency the channel center frequency (MHz)
* \param packetType the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU)
* \param incFlag this flag is used to indicate that the static variables need to be update or not. This function is called a couple of times for the same packet so static variables should not be increased each time
- *
+ *
* \return the duration of the payload
*/
Time GetPayloadDuration (uint32_t size, WifiTxVector txvector, WifiPreamble preamble, double frequency, uint8_t packetType, uint8_t incFlag);
@@ -403,7 +403,7 @@
* false otherwise
*/
virtual bool IsModeSupported (WifiMode mode) const = 0;
-
+
/**
* \param txMode the transmission mode
* \param ber the probability of bit error rate
@@ -412,28 +412,28 @@
* the requested ber for the specified transmission mode. (W/W)
*/
virtual double CalculateSnr (WifiMode txMode, double ber) const = 0;
-
- /**
- * The WifiPhy::NBssMembershipSelectors() method is used
- * (e.g., by a WifiRemoteStationManager) to determine the set of
- * transmission/reception modes that this WifiPhy(-derived class)
- * can support - a set of WifiMode objects which we call the
- * BssMembershipSelectorSet, and which is stored as WifiPhy::m_bssMembershipSelectorSet.
- *
- * \return the memebership selector whose index is specified.
- */
+
+ /**
+ * The WifiPhy::NBssMembershipSelectors() method is used
+ * (e.g., by a WifiRemoteStationManager) to determine the set of
+ * transmission/reception modes that this WifiPhy(-derived class)
+ * can support - a set of WifiMode objects which we call the
+ * BssMembershipSelectorSet, and which is stored as WifiPhy::m_bssMembershipSelectorSet.
+ *
+ * \return the memebership selector whose index is specified.
+ */
virtual uint32_t GetNBssMembershipSelectors (void) const = 0;
- /**
- * The WifiPhy::BssMembershipSelector() method is used
- * (e.g., by a WifiRemoteStationManager) to determine the set of
- * transmission/reception modes that this WifiPhy(-derived class)
- * can support - a set of WifiMode objects which we call the
- * BssMembershipSelectorSet, and which is stored as WifiPhy::m_bssMembershipSelectorSet.
- *
- * \param selector index in array of supported memberships
- *
- * \return the memebership selector whose index is specified.
- */
+ /**
+ * The WifiPhy::BssMembershipSelector() method is used
+ * (e.g., by a WifiRemoteStationManager) to determine the set of
+ * transmission/reception modes that this WifiPhy(-derived class)
+ * can support - a set of WifiMode objects which we call the
+ * BssMembershipSelectorSet, and which is stored as WifiPhy::m_bssMembershipSelectorSet.
+ *
+ * \param selector index in array of supported memberships
+ *
+ * \return the memebership selector whose index is specified.
+ */
virtual uint32_t GetBssMembershipSelector (uint32_t selector) const = 0;
/**
* The WifiPhy::GetMembershipSelectorModes() method is used
@@ -448,7 +448,7 @@
*
* \sa WifiPhy::GetMembershipSelectorModes()
*/
- virtual WifiModeList GetMembershipSelectorModes(uint32_t selector) = 0;
+ virtual WifiModeList GetMembershipSelectorModes (uint32_t selector) = 0;
/**
* The WifiPhy::GetNMcs() method is used
* (e.g., by a WifiRemoteStationManager) to determine the set of
@@ -458,7 +458,7 @@
*
* \return the MCS index whose index is specified.
*/
- virtual uint8_t GetNMcs (void) const=0;
+ virtual uint8_t GetNMcs (void) const = 0;
/**
* The WifiPhy::GetMcs() method is used
* (e.g., by a WifiRemoteStationManager) to determine the set of
@@ -473,22 +473,22 @@
virtual uint8_t GetMcs (uint8_t mcs) const = 0;
/**
- * For a given WifiMode finds the corresponding MCS value and returns it
- * as defined in the IEEE 802.11n standard
+ * For a given WifiMode finds the corresponding MCS value and returns it
+ * as defined in the IEEE 802.11n standard
*
* \param mode the WifiMode
*
* \return the MCS number that corresponds to the given WifiMode
*/
virtual uint32_t WifiModeToMcs (WifiMode mode) = 0;
- /**
- * For a given MCS finds the corresponding WifiMode and returns it
- * as defined in the IEEE 802.11n standard.
- *
- * \param mcs the MCS number
- *
- * \return the WifiMode that corresponds to the given MCS number
- */
+ /**
+ * For a given MCS finds the corresponding WifiMode and returns it
+ * as defined in the IEEE 802.11n standard.
+ *
+ * \param mcs the MCS number
+ *
+ * \return the WifiMode that corresponds to the given MCS number
+ */
virtual WifiMode McsToWifiMode (uint8_t mcs) = 0;
/**
@@ -502,7 +502,7 @@
* \param id the channel number
*/
virtual void SetChannelNumber (uint16_t id) = 0;
- /**
+ /**
* Return current channel number.
*
* \return the current channel number
@@ -899,7 +899,7 @@
*
* \return a WifiMode for OFDM at 30Mbps with 40MHz channel spacing
*/
- static WifiMode GetOfdmRate30MbpsBW40MHz ();
+ static WifiMode GetOfdmRate30MbpsBW40MHz ();
/**
* Return a WifiMode for OFDM at 45Mbps with 40MHz channel spacing.
*
@@ -1026,11 +1026,10 @@
* \param signalDbm signal power in dBm
* \param noiseDbm noise power in dBm
*/
- typedef void (* MonitorSnifferRxCallback)
- (Ptr<const Packet> packet, uint16_t channelFreqMhz,
- uint16_t channelNumber, uint32_t rate,
- bool isShortPreamble, WifiTxVector txvector,
- double signalDbm, double noiseDbm);
+ typedef void (* MonitorSnifferRxCallback)(Ptr<const Packet> packet, uint16_t channelFreqMhz,
+ uint16_t channelNumber, uint32_t rate,
+ bool isShortPreamble, WifiTxVector txvector,
+ double signalDbm, double noiseDbm);
/**
* Public method used to fire a MonitorSniffer trace for a wifi packet being transmitted.
@@ -1061,19 +1060,18 @@
* \param isShortPreamble true if short preamble is used, false otherwise
* \param txVector the txvector that holds tx parameters
*/
- typedef void (* MonitorSnifferTxCallback)
- (const Ptr<const Packet> packet, uint16_t channelFreqMhz,
- uint16_t channelNumber, uint32_t rate,
- bool isShortPreamble, WifiTxVector txvector);
+ typedef void (* MonitorSnifferTxCallback)(const Ptr<const Packet> packet, uint16_t channelFreqMhz,
+ uint16_t channelNumber, uint32_t rate,
+ bool isShortPreamble, WifiTxVector txvector);
- /**
- * Assign a fixed random variable stream number to the random variables
- * used by this model. Return the number of streams (possibly zero) that
- * have been assigned.
- *
- * \param stream first stream index to use
- * \return the number of stream indices assigned by this model
- */
+ /**
+ * Assign a fixed random variable stream number to the random variables
+ * used by this model. Return the number of streams (possibly zero) that
+ * have been assigned.
+ *
+ * \param stream first stream index to use
+ * \return the number of stream indices assigned by this model
+ */
virtual int64_t AssignStreams (int64_t stream) = 0;
/**
@@ -1092,9 +1090,9 @@
* \return the number of transmit antenna on this device
*/
virtual uint32_t GetNumberOfTransmitAntennas (void) const = 0;
- /**
- * \param rx the number of receivers on this node.
- */
+ /**
+ * \param rx the number of receivers on this node.
+ */
virtual void SetNumberOfReceiveAntennas (uint32_t rx) = 0;
/**
* \return the number of receivers on this node.
@@ -1213,7 +1211,7 @@
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t, bool, WifiTxVector> m_phyMonitorSniffTxTrace;
-
+
uint32_t m_totalAmpduNumSymbols; //!< Number of symbols previously transmitted for the MPDUs in an A-MPDU, used for the computation of the number of symbols needed for the last MPDU in the A-MPDU
uint32_t m_totalAmpduSize; //!< Total size of the previously transmitted MPDUs in an A-MPDU, used for the computation of the number of symbols needed for the last MPDU in the A-MPDU
};
@@ -1225,6 +1223,6 @@
*/
std::ostream& operator<< (std::ostream& os, enum WifiPhy::State state);
-} // namespace ns3
+} //namespace ns3
#endif /* WIFI_PHY_H */
--- a/src/wifi/model/wifi-preamble.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-preamble.h Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef WIFI_PREAMBLE_H
#define WIFI_PREAMBLE_H
@@ -35,6 +36,6 @@
WIFI_PREAMBLE_NONE
};
-} // namespace ns3
+} //namespace ns3
#endif /* WIFI_PREAMBLE_H */
--- a/src/wifi/model/wifi-remote-station-manager.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-remote-station-manager.cc Sun Jun 21 00:23:45 2015 +0200
@@ -70,7 +70,7 @@
{
}
-WifiTxVector
+WifiTxVector
HighLatencyDataTxVectorTag::GetDataTxVector (void) const
{
return m_dataTxVector;
@@ -82,8 +82,8 @@
static TypeId tid = TypeId ("ns3::HighLatencyDataTxVectorTag")
.SetParent<Tag> ()
.SetGroupName ("Wifi")
- .AddConstructor<HighLatencyDataTxVectorTag> ()
- ;
+ .AddConstructor<HighLatencyDataTxVectorTag> ()
+ ;
return tid;
}
@@ -147,7 +147,7 @@
{
}
-WifiTxVector
+WifiTxVector
HighLatencyRtsTxVectorTag::GetRtsTxVector (void) const
{
return m_rtsTxVector;
@@ -159,8 +159,8 @@
static TypeId tid = TypeId ("ns3::HighLatencyRtsTxVectorTag")
.SetParent<Tag> ()
.SetGroupName ("Wifi")
- .AddConstructor<HighLatencyRtsTxVectorTag> ()
- ;
+ .AddConstructor<HighLatencyRtsTxVectorTag> ()
+ ;
return tid;
}
@@ -223,7 +223,7 @@
{
}
-WifiTxVector
+WifiTxVector
HighLatencyCtsToSelfTxVectorTag::GetCtsToSelfTxVector (void) const
{
return m_ctsToSelfTxVector;
@@ -235,8 +235,8 @@
static TypeId tid = TypeId ("ns3::HighLatencyCtsToSelfTxVectorTag")
.SetParent<Tag> ()
.SetGroupName ("Wifi")
- .AddConstructor<HighLatencyCtsToSelfTxVectorTag> ()
- ;
+ .AddConstructor<HighLatencyCtsToSelfTxVectorTag> ()
+ ;
return tid;
}
@@ -345,7 +345,7 @@
}
WifiRemoteStationManager::WifiRemoteStationManager ()
- : m_htSupported (false)
+ : m_htSupported (false)
{
}
@@ -378,9 +378,9 @@
//acknowledgements.
m_wifiPhy = phy;
m_defaultTxMode = phy->GetMode (0);
- if(HasHtSupported())
+ if (HasHtSupported ())
{
- m_defaultTxMcs = phy->GetMcs (0);
+ m_defaultTxMcs = phy->GetMcs (0);
}
else
{
@@ -499,7 +499,7 @@
}
}
-void
+void
WifiRemoteStationManager::AddSupportedMcs (Mac48Address address, uint8_t mcs)
{
NS_LOG_FUNCTION (this << address << (uint16_t) mcs);
@@ -585,8 +585,8 @@
}
WifiRemoteStation *station = Lookup (address, header);
WifiTxVector rts = DoGetRtsTxVector (station);
- WifiTxVector data = DoGetDataTxVector (station, fullPacketSize);
- WifiTxVector ctstoself = DoGetCtsToSelfTxVector ();
+ WifiTxVector data = DoGetDataTxVector (station, fullPacketSize);
+ WifiTxVector ctstoself = DoGetCtsToSelfTxVector ();
HighLatencyDataTxVectorTag datatag;
HighLatencyRtsTxVectorTag rtstag;
HighLatencyCtsToSelfTxVectorTag ctstoselftag;
@@ -634,8 +634,8 @@
}
WifiTxVector
-WifiRemoteStationManager::GetCtsToSelfTxVector(const WifiMacHeader *header,
- Ptr<const Packet> packet)
+WifiRemoteStationManager::GetCtsToSelfTxVector (const WifiMacHeader *header,
+ Ptr<const Packet> packet)
{
NS_LOG_FUNCTION (this << *header << packet);
if (!IsLowLatency ())
@@ -655,12 +655,12 @@
WifiTxVector
WifiRemoteStationManager::DoGetCtsToSelfTxVector (void)
{
- return WifiTxVector (GetDefaultMode (),
+ return WifiTxVector (GetDefaultMode (),
GetDefaultTxPowerLevel (),
- 0,
- m_wifiPhy->GetGuardInterval (),
- GetNumberOfTransmitAntennas (),
- GetNumberOfTransmitAntennas (),
+ 0,
+ m_wifiPhy->GetGuardInterval (),
+ GetNumberOfTransmitAntennas (),
+ GetNumberOfTransmitAntennas (),
false);
}
@@ -784,7 +784,7 @@
WifiRemoteStationManager::NeedCtsToSelf (WifiTxVector txVector)
{
NS_LOG_FUNCTION (this << txVector);
- WifiMode mode = txVector.GetMode();
+ WifiMode mode = txVector.GetMode ();
//search for the BSS Basic Rate set, if the used mode is in the basic set then there is no need for Cts To Self
for (WifiModeListIterator i = m_bssBasicRateSet.begin (); i != m_bssBasicRateSet.end (); i++)
{
@@ -872,7 +872,7 @@
if (threshold % 2 != 0)
{
NS_LOG_WARN ("Fragmentation threshold should be an even number. Setting to " << threshold - 1);
- m_fragmentationThreshold = threshold - 1;
+ m_fragmentationThreshold = threshold - 1;
}
else
{
@@ -990,27 +990,27 @@
found = true;
}
}
- if(HasHtSupported ())
+ if (HasHtSupported ())
{
if (!found)
{
uint8_t mcs = GetDefaultMcs ();
mode = m_wifiPhy->McsToWifiMode (mcs);
-
+
for (WifiMcsListIterator i = m_bssBasicMcsSet.begin (); i != m_bssBasicMcsSet.end (); i++)
- {
- WifiMode thismode= m_wifiPhy->McsToWifiMode (*i);
- if ((!found || thismode.GetPhyRate () > mode.GetPhyRate ())
- && thismode.GetPhyRate () <= reqMode.GetPhyRate ()
- && thismode.GetModulationClass () == reqMode.GetModulationClass ())
- {
- mode = thismode;
- //We've found a potentially-suitable transmit rate, but we
- //need to continue and consider all the basic rates before
- //we can be sure we've got the right one.
- found = true;
- }
- }
+ {
+ WifiMode thismode = m_wifiPhy->McsToWifiMode (*i);
+ if ((!found || thismode.GetPhyRate () > mode.GetPhyRate ())
+ && thismode.GetPhyRate () <= reqMode.GetPhyRate ()
+ && thismode.GetModulationClass () == reqMode.GetModulationClass ())
+ {
+ mode = thismode;
+ //We've found a potentially-suitable transmit rate, but we
+ //need to continue and consider all the basic rates before
+ //we can be sure we've got the right one.
+ found = true;
+ }
+ }
}
}
//If we found a suitable rate in the BSSBasicRateSet, then we are
@@ -1054,8 +1054,8 @@
if (thismode.IsMandatory ()
&& (!found || thismode.GetPhyRate () > mode.GetPhyRate ())
&& (thismode.GetPhyRate () <= reqMode.GetPhyRate ())
- && ((thismode.GetModulationClass () == reqMode.GetModulationClass ()) ||
- (reqMode.GetModulationClass () == WIFI_MOD_CLASS_HT)))
+ && ((thismode.GetModulationClass () == reqMode.GetModulationClass ())
+ || (reqMode.GetModulationClass () == WIFI_MOD_CLASS_HT)))
{
mode = thismode;
//As above; we've found a potentially-suitable transmit
@@ -1064,12 +1064,12 @@
found = true;
}
}
- if(HasHtSupported ())
+ if (HasHtSupported ())
{
for (uint32_t idx = 0; idx < m_wifiPhy->GetNMcs (); idx++)
{
uint8_t thismcs = m_wifiPhy->GetMcs (idx);
- WifiMode thismode= m_wifiPhy->McsToWifiMode (thismcs);
+ WifiMode thismode = m_wifiPhy->McsToWifiMode (thismcs);
if (thismode.IsMandatory ()
&& (!found || thismode.GetPhyRate () > mode.GetPhyRate ())
&& thismode.GetPhyRate () <= reqMode.GetPhyRate ()
@@ -1081,7 +1081,7 @@
//mandatory rates before we can be sure we've got the right one.
found = true;
}
-
+
}
}
@@ -1097,8 +1097,7 @@
*/
if (!found)
{
- NS_FATAL_ERROR ("Can't find response rate for " << reqMode
- << ". Check standard and selected rates match.");
+ NS_FATAL_ERROR ("Can't find response rate for " << reqMode);
}
NS_LOG_DEBUG ("WifiRemoteStationManager::GetControlAnswerMode returning " << mode);
@@ -1113,9 +1112,9 @@
v.SetMode (GetControlAnswerMode (address, rtsMode));
v.SetTxPowerLevel (DoGetCtsTxPowerLevel (address, v.GetMode ()));
v.SetShortGuardInterval (DoGetCtsTxGuardInterval (address, v.GetMode ()));
- v.SetNss (DoGetCtsTxNss(address, v.GetMode ()));
- v.SetNess (DoGetCtsTxNess(address, v.GetMode ()));
- v.SetStbc (DoGetCtsTxStbc(address, v.GetMode ()));
+ v.SetNss (DoGetCtsTxNss (address, v.GetMode ()));
+ v.SetNess (DoGetCtsTxNess (address, v.GetMode ()));
+ v.SetStbc (DoGetCtsTxStbc (address, v.GetMode ()));
return v;
}
@@ -1126,10 +1125,10 @@
WifiTxVector v;
v.SetMode (GetControlAnswerMode (address, dataMode));
v.SetTxPowerLevel (DoGetAckTxPowerLevel (address, v.GetMode ()));
- v.SetShortGuardInterval (DoGetAckTxGuardInterval(address, v.GetMode ()));
- v.SetNss (DoGetAckTxNss(address, v.GetMode ()));
- v.SetNess (DoGetAckTxNess(address, v.GetMode ()));
- v.SetStbc (DoGetAckTxStbc(address, v.GetMode ()));
+ v.SetShortGuardInterval (DoGetAckTxGuardInterval (address, v.GetMode ()));
+ v.SetNss (DoGetAckTxNss (address, v.GetMode ()));
+ v.SetNess (DoGetAckTxNess (address, v.GetMode ()));
+ v.SetStbc (DoGetAckTxStbc (address, v.GetMode ()));
return v;
}
@@ -1141,98 +1140,98 @@
v.SetMode (GetControlAnswerMode (address, blockAckReqMode));
v.SetTxPowerLevel (DoGetBlockAckTxPowerLevel (address, v.GetMode ()));
v.SetShortGuardInterval (DoGetBlockAckTxGuardInterval (address, v.GetMode ()));
- v.SetNss (DoGetBlockAckTxNss(address, v.GetMode ()));
- v.SetNess (DoGetBlockAckTxNess(address, v.GetMode ()));
- v.SetStbc (DoGetBlockAckTxStbc(address, v.GetMode ()));
+ v.SetNss (DoGetBlockAckTxNss (address, v.GetMode ()));
+ v.SetNess (DoGetBlockAckTxNess (address, v.GetMode ()));
+ v.SetStbc (DoGetBlockAckTxStbc (address, v.GetMode ()));
return v;
}
-uint8_t
+uint8_t
WifiRemoteStationManager::DoGetCtsTxPowerLevel (Mac48Address address, WifiMode ctsMode)
{
return m_defaultTxPowerLevel;
}
-bool
-WifiRemoteStationManager::DoGetCtsTxGuardInterval(Mac48Address address, WifiMode ctsMode)
+bool
+WifiRemoteStationManager::DoGetCtsTxGuardInterval (Mac48Address address, WifiMode ctsMode)
{
return m_wifiPhy->GetGuardInterval ();
}
uint8_t
-WifiRemoteStationManager::DoGetCtsTxNss(Mac48Address address, WifiMode ctsMode)
+WifiRemoteStationManager::DoGetCtsTxNss (Mac48Address address, WifiMode ctsMode)
{
return 1;
}
uint8_t
-WifiRemoteStationManager::DoGetCtsTxNess(Mac48Address address, WifiMode ctsMode)
+WifiRemoteStationManager::DoGetCtsTxNess (Mac48Address address, WifiMode ctsMode)
{
return 0;
}
-bool
-WifiRemoteStationManager::DoGetCtsTxStbc(Mac48Address address, WifiMode ctsMode)
+bool
+WifiRemoteStationManager::DoGetCtsTxStbc (Mac48Address address, WifiMode ctsMode)
{
- return m_wifiPhy->GetStbc();
+ return m_wifiPhy->GetStbc ();
}
-uint8_t
+uint8_t
WifiRemoteStationManager::DoGetAckTxPowerLevel (Mac48Address address, WifiMode ackMode)
{
return m_defaultTxPowerLevel;
}
-bool
-WifiRemoteStationManager::DoGetAckTxGuardInterval(Mac48Address address, WifiMode ackMode)
+bool
+WifiRemoteStationManager::DoGetAckTxGuardInterval (Mac48Address address, WifiMode ackMode)
{
- return m_wifiPhy->GetGuardInterval();
+ return m_wifiPhy->GetGuardInterval ();
}
uint8_t
-WifiRemoteStationManager::DoGetAckTxNss(Mac48Address address, WifiMode ackMode)
+WifiRemoteStationManager::DoGetAckTxNss (Mac48Address address, WifiMode ackMode)
{
return 1;
}
uint8_t
-WifiRemoteStationManager::DoGetAckTxNess(Mac48Address address, WifiMode ackMode)
+WifiRemoteStationManager::DoGetAckTxNess (Mac48Address address, WifiMode ackMode)
{
return 0;
}
-bool
-WifiRemoteStationManager::DoGetAckTxStbc(Mac48Address address, WifiMode ackMode)
+bool
+WifiRemoteStationManager::DoGetAckTxStbc (Mac48Address address, WifiMode ackMode)
{
return m_wifiPhy->GetStbc ();
}
-uint8_t
+uint8_t
WifiRemoteStationManager::DoGetBlockAckTxPowerLevel (Mac48Address address, WifiMode blockAckMode)
{
return m_defaultTxPowerLevel;
}
-bool
-WifiRemoteStationManager::DoGetBlockAckTxGuardInterval(Mac48Address address, WifiMode blockAckMode)
+bool
+WifiRemoteStationManager::DoGetBlockAckTxGuardInterval (Mac48Address address, WifiMode blockAckMode)
{
return m_wifiPhy->GetGuardInterval ();
}
uint8_t
-WifiRemoteStationManager::DoGetBlockAckTxNss(Mac48Address address, WifiMode blockAckMode)
+WifiRemoteStationManager::DoGetBlockAckTxNss (Mac48Address address, WifiMode blockAckMode)
{
return 1;
}
uint8_t
-WifiRemoteStationManager::DoGetBlockAckTxNess(Mac48Address address, WifiMode blockAckMode)
+WifiRemoteStationManager::DoGetBlockAckTxNess (Mac48Address address, WifiMode blockAckMode)
{
return 0;
}
-bool
-WifiRemoteStationManager::DoGetBlockAckTxStbc(Mac48Address address, WifiMode blockAckMode)
+bool
+WifiRemoteStationManager::DoGetBlockAckTxStbc (Mac48Address address, WifiMode blockAckMode)
{
return m_wifiPhy->GetStbc ();
}
@@ -1328,11 +1327,11 @@
state->m_greenfield = htcapabilities.GetGreenfield ();
}
-bool
+bool
WifiRemoteStationManager::GetGreenfieldSupported (Mac48Address address) const
{
//Used by mac low to choose format used GF, MF or Non HT
- return LookupState (address)->m_greenfield;
+ return LookupState (address)->m_greenfield;
}
WifiMode
@@ -1394,7 +1393,7 @@
return m_bssBasicRateSet[i];
}
-void
+void
WifiRemoteStationManager::AddBasicMcs (uint8_t mcs)
{
NS_LOG_FUNCTION (this << (uint32_t)mcs);
@@ -1414,10 +1413,10 @@
return m_bssBasicMcsSet.size ();
}
-uint8_t
+uint8_t
WifiRemoteStationManager::GetBasicMcs (uint32_t i) const
{
- NS_ASSERT (i < m_bssBasicMcsSet.size ());
+ NS_ASSERT (i < m_bssBasicMcsSet.size ());
return m_bssBasicMcsSet[i];
}
@@ -1476,43 +1475,43 @@
return station->m_state->m_operationalMcsSet[i];
}
-bool
+bool
WifiRemoteStationManager::GetShortGuardInterval (const WifiRemoteStation *station) const
{
return station->m_state->m_shortGuardInterval;
}
-bool
+bool
WifiRemoteStationManager::GetGreenfield (const WifiRemoteStation *station) const
{
return station->m_state->m_greenfield;
}
-bool
+bool
WifiRemoteStationManager::GetStbc (const WifiRemoteStation *station) const
{
return station->m_state->m_stbc;
}
-uint32_t
+uint32_t
WifiRemoteStationManager::GetNumberOfReceiveAntennas (const WifiRemoteStation *station) const
{
return station->m_state->m_rx;
}
-uint32_t
+uint32_t
WifiRemoteStationManager::GetNumberOfTransmitAntennas (const WifiRemoteStation *station) const
{
return station->m_state->m_tx;
}
-uint32_t
+uint32_t
WifiRemoteStationManager::GetNess (const WifiRemoteStation *station) const
{
return station->m_state->m_ness;
}
-uint32_t
+uint32_t
WifiRemoteStationManager::GetShortRetryCount (const WifiRemoteStation *station) const
{
return station->m_ssrc;
@@ -1530,7 +1529,7 @@
return m_wifiMac;
}
-uint32_t
+uint32_t
WifiRemoteStationManager::GetLongRetryCount (const WifiRemoteStation *station) const
{
return station->m_slrc;
--- a/src/wifi/model/wifi-remote-station-manager.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-remote-station-manager.h Sun Jun 21 00:23:45 2015 +0200
@@ -185,7 +185,7 @@
* Invoked in a STA upon association to store 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.
- *
+ *
* \param mode the WifiMode to be added to the basic mode set
*/
void AddBasicMode (WifiMode mode);
@@ -247,7 +247,7 @@
uint8_t GetBasicMcs (uint32_t i) const;
/**
* Record the MCS index supported by the station.
- *
+ *
* \param address the address of the station
* \param mcs the MCS index
*/
@@ -281,7 +281,7 @@
*/
void AddSupportedMode (Mac48Address address, WifiMode mode);
/**
- * Invoked in a STA or AP to store all of the modes supported
+ * Invoked in a STA or AP to store all of the modes supported
* by a destination which is also supported locally.
* The set of supported modes includes the BSSBasicRateSet.
*
@@ -358,7 +358,7 @@
*/
void PrepareForQueue (Mac48Address address, const WifiMacHeader *header,
Ptr<const Packet> packet, uint32_t fullPacketSize);
-
+
/**
* \param address remote address
* \param header MAC header
@@ -417,7 +417,7 @@
* Should be invoked whenever we receive the Cts associated to an RTS
* we just sent. Note that we also get the SNR of the RTS we sent since
* the receiver put a SnrTag in the CTS.
- *
+ *
* \param address the address of the receiver
* \param header MAC header of the DATA packet
* \param ctsSnr the SNR of the CTS we received
@@ -481,7 +481,7 @@
*
* \param txVector the TXVECTOR of the packet to be sent
*
- * \return true if Cts-to-self is needed,
+ * \return true if Cts-to-self is needed,
* false otherwise
*/
bool NeedCtsToSelf (WifiTxVector txVector);
@@ -491,7 +491,7 @@
* \param header MAC header
* \param packet the packet to send
*
- * \return true if we want to restart a failed RTS/CTS handshake,
+ * \return true if we want to restart a failed RTS/CTS handshake,
* false otherwise.
*/
bool NeedRtsRetransmission (Mac48Address address, const WifiMacHeader *header,
@@ -501,7 +501,7 @@
* \param header MAC header
* \param packet the packet to send
*
- * \return true if we want to resend a packet after a failed transmission attempt,
+ * \return true if we want to resend a packet after a failed transmission attempt,
* false otherwise.
*/
bool NeedDataRetransmission (Mac48Address address, const WifiMacHeader *header,
@@ -511,7 +511,7 @@
* \param header MAC header
* \param packet the packet to send
*
- * \return true if this packet should be fragmented,
+ * \return true if this packet should be fragmented,
* false otherwise.
*/
bool NeedFragmentation (Mac48Address address, const WifiMacHeader *header,
@@ -570,7 +570,7 @@
WifiTxVector GetBlockAckTxVector (Mac48Address address, WifiMode dataMode);
/**
* \return the default transmission power
- */
+ */
uint8_t GetDefaultTxPowerLevel (void) const;
/**
* \param address of the remote station
@@ -590,7 +590,7 @@
uint32_t GetNumberOfTransmitAntennas (void);
- protected:
+protected:
virtual void DoDispose (void);
/**
* Return whether mode associated with the specified station at the specified index.
@@ -640,7 +640,7 @@
*
* \param station the station being queried
*
- * \return true if the station supports STBC,
+ * \return true if the station supports STBC,
* false otherwise
*/
bool GetStbc (const WifiRemoteStation *station) const;
@@ -715,7 +715,7 @@
* \param normally indicates whether the normal 802.11 rts enable mechanism would
* request that the rts is sent or not.
*
- * \return true if we want to use an RTS/CTS handshake for this packet before sending it,
+ * \return true if we want to use an RTS/CTS handshake for this packet before sending it,
* false otherwise.
*
* Note: This method is called before a unicast packet is sent on the medium.
@@ -728,7 +728,7 @@
* \param normally indicates whether the normal 802.11 rts enable mechanism would
* request that the rts is retransmitted or not.
*
- * \return true if we want to restart a failed RTS/CTS handshake,
+ * \return 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
@@ -741,7 +741,7 @@
* \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.
- * \return true if we want to resend a packet after a failed transmission attempt,
+ * \return 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
@@ -755,7 +755,7 @@
* \param normally indicates whether the normal 802.11 data fragmentation mechanism
* would request that the data packet is fragmented or not.
*
- * \return true if this packet should be fragmented,
+ * \return true if this packet should be fragmented,
* false otherwise.
*
* Note: This method is called before sending a unicast packet.
@@ -773,15 +773,15 @@
* \return a new station data structure
*/
virtual WifiRemoteStation* DoCreateStation (void) const = 0;
- /**
- * \param station the station that we need to communicate
- * \param size size of the packet or fragment we want to send
- *
- * \return the transmission mode to use to send a packet to the station
- *
- * Note: This method is called before sending a unicast packet or a fragment
- * of a unicast packet to decide which transmission mode to use.
- */
+ /**
+ * \param station the station that we need to communicate
+ * \param size size of the packet or fragment we want to send
+ *
+ * \return the transmission mode to use to send a packet to the station
+ *
+ * Note: This method is called before sending a unicast packet or a fragment
+ * of a unicast packet to decide which transmission mode to use.
+ */
virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station, uint32_t size) = 0;
/**
* \param station the station that we need to communicate
@@ -792,41 +792,41 @@
* to decide which transmission mode to use for the rts.
*/
virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station) = 0;
- /**
+ /**
* \param address the address of the recipient of the CTS
- * \param ctsMode the mode to be used for the CTS
- *
+ * \param ctsMode the mode to be used for the CTS
+ *
* \return the power level to be used to send the CTS
*/
virtual uint8_t DoGetCtsTxPowerLevel (Mac48Address address, WifiMode ctsMode);
- /**
+ /**
* \param address the address of the recipient of the ACK
- * \param ackMode the mode to be used for the ACK
- *
+ * \param ackMode the mode to be used for the ACK
+ *
* \return the power level to be used to send the ACK
- */
+ */
virtual uint8_t DoGetAckTxPowerLevel (Mac48Address address, WifiMode ackMode);
- /**
+ /**
* \param address the address of the recipient of the Block ACK
- * \param blockAckMode the mode to be used for the Block ACK
- *
+ * \param blockAckMode the mode to be used for the Block ACK
+ *
* \return the power level to be used to send the Block ACK
- */
+ */
virtual uint8_t DoGetBlockAckTxPowerLevel (Mac48Address address, WifiMode blockAckMode);
virtual bool DoGetCtsTxGuardInterval (Mac48Address address, WifiMode ctsMode);
- virtual uint8_t DoGetCtsTxNss(Mac48Address address, WifiMode ctsMode);
- virtual uint8_t DoGetCtsTxNess(Mac48Address address, WifiMode ctsMode);
- virtual bool DoGetCtsTxStbc(Mac48Address address, WifiMode ctsMode);
- virtual bool DoGetAckTxGuardInterval(Mac48Address address, WifiMode ackMode);
- virtual uint8_t DoGetAckTxNss(Mac48Address address, WifiMode ackMode);
- virtual uint8_t DoGetAckTxNess(Mac48Address address, WifiMode ackMode);
- virtual bool DoGetAckTxStbc(Mac48Address address, WifiMode ackMode);
- virtual bool DoGetBlockAckTxGuardInterval(Mac48Address address, WifiMode blockAckMode);
- virtual uint8_t DoGetBlockAckTxNss(Mac48Address address, WifiMode blockAckMode);
- virtual uint8_t DoGetBlockAckTxNess(Mac48Address address, WifiMode blockAckMode);
- virtual bool DoGetBlockAckTxStbc(Mac48Address address, WifiMode blockAckMode);
+ virtual uint8_t DoGetCtsTxNss (Mac48Address address, WifiMode ctsMode);
+ virtual uint8_t DoGetCtsTxNess (Mac48Address address, WifiMode ctsMode);
+ virtual bool DoGetCtsTxStbc (Mac48Address address, WifiMode ctsMode);
+ virtual bool DoGetAckTxGuardInterval (Mac48Address address, WifiMode ackMode);
+ virtual uint8_t DoGetAckTxNss (Mac48Address address, WifiMode ackMode);
+ virtual uint8_t DoGetAckTxNess (Mac48Address address, WifiMode ackMode);
+ virtual bool DoGetAckTxStbc (Mac48Address address, WifiMode ackMode);
+ virtual bool DoGetBlockAckTxGuardInterval (Mac48Address address, WifiMode blockAckMode);
+ virtual uint8_t DoGetBlockAckTxNss (Mac48Address address, WifiMode blockAckMode);
+ virtual uint8_t DoGetBlockAckTxNess (Mac48Address address, WifiMode blockAckMode);
+ virtual bool DoGetBlockAckTxStbc (Mac48Address address, WifiMode blockAckMode);
/**
* This method is a pure virtual method that must be implemented by the sub-class.
@@ -916,7 +916,7 @@
* \return WifiRemoteStation corresponding to the address
*/
WifiRemoteStation* Lookup (Mac48Address address, const WifiMacHeader *header) const;
-
+
WifiMode GetControlAnswerMode (Mac48Address address, WifiMode reqMode);
/**
@@ -928,7 +928,7 @@
void DoSetFragmentationThreshold (uint32_t threshold);
/**
* Return the current fragmentation threshold
- *
+ *
* \return the fragmentation threshold
*/
uint32_t DoGetFragmentationThreshold (void) const;
@@ -1060,7 +1060,7 @@
* network and to perform the selection of tx parameters
* on a per-packet basis.
*
- * This class is typically subclassed and extended by
+ * This class is typically subclassed and extended by
* rate control implementations
*/
struct WifiRemoteStation
--- a/src/wifi/model/wifi-tx-vector.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-tx-vector.cc Sun Jun 21 00:23:45 2015 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2010 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,
@@ -15,8 +15,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Nicola Baldo <nbaldo@cttc.es>
- * : Ghada Badawy <gbadawy@gmail.com>
+ * Authors: Nicola Baldo <nbaldo@cttc.es>
+ * Ghada Badawy <gbadawy@gmail.com>
*/
#include "ns3/wifi-tx-vector.h"
@@ -40,10 +40,10 @@
: m_mode (mode),
m_txPowerLevel (powerLevel),
m_retries (retries),
- m_shortGuardInterval(shortGuardInterval),
- m_nss(nss),
- m_ness(ness),
- m_stbc(stbc),
+ m_shortGuardInterval (shortGuardInterval),
+ m_nss (nss),
+ m_ness (ness),
+ m_stbc (stbc),
m_modeInitialized (true),
m_txPowerLevelInitialized (true)
{
@@ -58,7 +58,8 @@
}
return m_mode;
}
-uint8_t
+
+uint8_t
WifiTxVector::GetTxPowerLevel (void) const
{
if (!m_txPowerLevelInitialized)
@@ -67,80 +68,91 @@
}
return m_txPowerLevel;
}
-uint8_t
+
+uint8_t
WifiTxVector::GetRetries (void) const
{
return m_retries;
}
-bool
+
+bool
WifiTxVector::IsShortGuardInterval (void) const
{
- return m_shortGuardInterval;
+ return m_shortGuardInterval;
}
-uint8_t
+
+uint8_t
WifiTxVector::GetNss (void) const
{
return m_nss;
}
-uint8_t
+
+uint8_t
WifiTxVector::GetNess (void) const
{
return m_ness;
}
-bool
+
+bool
WifiTxVector::IsStbc (void) const
{
return m_stbc;
}
-void
+void
WifiTxVector::SetMode (WifiMode mode)
{
- m_mode=mode;
+ m_mode = mode;
m_modeInitialized = true;
}
-void
+
+void
WifiTxVector::SetTxPowerLevel (uint8_t powerlevel)
{
- m_txPowerLevel=powerlevel;
+ m_txPowerLevel = powerlevel;
m_txPowerLevelInitialized = true;
}
-void
+
+void
WifiTxVector::SetRetries (uint8_t retries)
{
m_retries = retries;
}
-void
+
+void
WifiTxVector::SetShortGuardInterval (bool guardinterval)
{
- m_shortGuardInterval=guardinterval;
+ m_shortGuardInterval = guardinterval;
}
-void
+
+void
WifiTxVector::SetNss (uint8_t nss)
{
- m_nss= nss;
+ m_nss = nss;
}
-void
+
+void
WifiTxVector::SetNess (uint8_t ness)
{
- m_ness=ness;
+ m_ness = ness;
}
-void
+
+void
WifiTxVector::SetStbc (bool stbc)
{
- m_stbc=stbc;
+ m_stbc = stbc;
}
std::ostream & operator << ( std::ostream &os, const WifiTxVector &v)
-{
- os << "mode:" << v.GetMode() <<
- " txpwrlvl:" << (uint32_t)v.GetTxPowerLevel() <<
- " retries:" << (uint32_t)v.GetRetries() <<
- " Short GI: " << v.IsShortGuardInterval() <<
- " Nss: " << (uint32_t)v.GetNss() <<
- " Ness: " << (uint32_t)v.GetNess() <<
- " STBC: " << v.IsStbc();
+{
+ os << "mode:" << v.GetMode () <<
+ " txpwrlvl:" << (uint32_t)v.GetTxPowerLevel () <<
+ " retries:" << (uint32_t)v.GetRetries () <<
+ " Short GI: " << v.IsShortGuardInterval () <<
+ " Nss: " << (uint32_t)v.GetNss () <<
+ " Ness: " << (uint32_t)v.GetNess () <<
+ " STBC: " << v.IsStbc ();
return os;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/wifi-tx-vector.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/wifi-tx-vector.h Sun Jun 21 00:23:45 2015 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2010 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,
@@ -15,8 +15,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Nicola Baldo <nbaldo@cttc.es>
- * : Ghada Badawy <gbadawy@gmail.com>
+ * Authors: Nicola Baldo <nbaldo@cttc.es>
+ * Ghada Badawy <gbadawy@gmail.com>
*/
#ifndef WIFI_TX_VECTOR_H
@@ -36,17 +36,17 @@
* parameters".
*
* If this class is constructed with the constructor that takes no
- * arguments, then the client must explicitly set the mode and
+ * arguments, then the client must explicitly set the mode and
* transmit power level parameters before using them. Default
* member initializers are provided for the other parameters, to
* conform to a non-MIMO/long guard configuration, although these
* may also be explicitly set after object construction.
*
- * When used in a infrastructure context, WifiTxVector values should be
- * drawn from WifiRemoteStationManager parameters since rate adaptation
- * is responsible for picking the mode, number of streams, etc., but in
- * the case in which there is no such manager (e.g. mesh), the client
- * still needs to initialize at least the mode and transmit power level
+ * When used in a infrastructure context, WifiTxVector values should be
+ * drawn from WifiRemoteStationManager parameters since rate adaptation
+ * is responsible for picking the mode, number of streams, etc., but in
+ * the case in which there is no such manager (e.g. mesh), the client
+ * still needs to initialize at least the mode and transmit power level
* appropriately.
*
* \note the above reference is valid for the DSSS PHY only (clause
@@ -75,7 +75,7 @@
*/
WifiTxVector (WifiMode mode, uint8_t powerLevel, uint8_t retries, bool shortGuardInterval, uint8_t nss, uint8_t ness, bool stbc);
/**
- * \returns the txvector payload mode
+ * \returns the txvector payload mode
*/
WifiMode GetMode (void) const;
/**
@@ -85,7 +85,7 @@
*/
void SetMode (WifiMode mode);
/**
- * \returns the transmission power level
+ * \returns the transmission power level
*/
uint8_t GetTxPowerLevel (void) const;
/**
@@ -95,7 +95,7 @@
*/
void SetTxPowerLevel (uint8_t powerlevel);
/**
- * \returns the number of retries
+ * \returns the number of retries
*/
uint8_t GetRetries (void) const;
/**
@@ -105,17 +105,17 @@
*/
void SetRetries (uint8_t retries);
/**
- * \returns if ShortGuardInterval is used or not
+ * \returns if ShortGuardInterval is used or not
*/
bool IsShortGuardInterval (void) const;
- /**
- * Sets if short gurad interval is being used
- *
- * \param guardinterval enable or disable short guard interval
- */
+ /**
+ * Sets if short gurad interval is being used
+ *
+ * \param guardinterval enable or disable short guard interval
+ */
void SetShortGuardInterval (bool guardinterval);
/**
- * \returns the number of Nss
+ * \returns the number of Nss
*/
uint8_t GetNss (void) const;
/**
@@ -125,7 +125,7 @@
*/
void SetNss (uint8_t nss);
/**
- * \returns the number of Ness
+ * \returns the number of Ness
*/
uint8_t GetNess (void) const;
/**
@@ -136,7 +136,8 @@
void SetNess (uint8_t ness);
/**
* Check if STBC is used or not
- * \returns true if STBC is used,
+ *
+ * \returns true if STBC is used,
* false otherwise
*/
bool IsStbc (void) const;
@@ -147,23 +148,23 @@
*/
void SetStbc (bool stbc);
-
-private:
- WifiMode m_mode; /**< The DATARATE parameter in Table 15-4.
- It is the value that will be passed
- to PMD_RATE.request */
- uint8_t m_txPowerLevel; /**< The TXPWR_LEVEL parameter in Table 15-4.
- It is the value that will be passed
- to PMD_TXPWRLVL.request */
- uint8_t m_retries; /**< The DATA_RETRIES/RTS_RETRIES parameter
- for Click radiotap information */
+private:
+ WifiMode m_mode; /**< The DATARATE parameter in Table 15-4.
+ It is the value that will be passed
+ to PMD_RATE.request */
+ uint8_t m_txPowerLevel; /**< The TXPWR_LEVEL parameter in Table 15-4.
+ It is the value that will be passed
+ to PMD_TXPWRLVL.request */
+ uint8_t m_retries; /**< The DATA_RETRIES/RTS_RETRIES parameter
+ for Click radiotap information */
+
bool m_shortGuardInterval; /**< true if short GI is going to be used */
- uint8_t m_nss; /**< number of streams */
- uint8_t m_ness; /**< number of streams in beamforming */
- bool m_stbc; /**< STBC used or not */
+ uint8_t m_nss; /**< number of streams */
+ uint8_t m_ness; /**< number of streams in beamforming */
+ bool m_stbc; /**< STBC used or not */
- bool m_modeInitialized; //*< Internal initialization flag */
+ bool m_modeInitialized; //*< Internal initialization flag */
bool m_txPowerLevelInitialized; //*< Internal initialization flag */
};
@@ -173,10 +174,11 @@
*
* \param os
* \param v
+ *
* \return ostream
*/
-std::ostream & operator << (std::ostream & os,const WifiTxVector &v);
+std::ostream & operator << (std::ostream & os,const WifiTxVector &v);
-} // namespace ns3
+} //namespace ns3
-#endif // WIFI_TX_VECTOR_H
+#endif /* WIFI_TX_VECTOR_H */
--- a/src/wifi/model/yans-error-rate-model.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/yans-error-rate-model.cc Sun Jun 21 00:23:45 2015 +0200
@@ -312,4 +312,4 @@
return 0;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/yans-error-rate-model.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/yans-error-rate-model.h Sun Jun 21 00:23:45 2015 +0200
@@ -103,7 +103,7 @@
uint32_t Factorial (uint32_t k) const;
/**
* Return Binomial distribution for a given k, p, and n
- *
+ *
* \param k
* \param p
* \param n
@@ -164,6 +164,6 @@
uint32_t adFree, uint32_t adFreePlusOne) const;
};
-} // namespace ns3
+} //namespace ns3
#endif /* YANS_ERROR_RATE_MODEL_H */
--- a/src/wifi/model/yans-wifi-channel.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/yans-wifi-channel.cc Sun Jun 21 00:23:45 2015 +0200
@@ -114,8 +114,8 @@
double *atts = new double[3];
*atts = rxPowerDbm;
- *(atts+1) = packetType;
- *(atts+2) = duration.GetNanoSeconds ();
+ *(atts + 1) = packetType;
+ *(atts + 2) = duration.GetNanoSeconds ();
Simulator::ScheduleWithContext (dstNode,
delay, &YansWifiChannel::Receive, this,
@@ -128,7 +128,7 @@
YansWifiChannel::Receive (uint32_t i, Ptr<Packet> packet, double *atts,
WifiTxVector txVector, WifiPreamble preamble) const
{
- m_phyList[i]->StartReceivePreambleAndHeader (packet, *atts, txVector, preamble, *(atts+1), NanoSeconds (*(atts+2)));
+ m_phyList[i]->StartReceivePreambleAndHeader (packet, *atts, txVector, preamble, *(atts + 1), NanoSeconds (*(atts + 2)));
delete[] atts;
}
@@ -158,4 +158,4 @@
return (currentStream - stream);
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/yans-wifi-channel.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/yans-wifi-channel.h Sun Jun 21 00:23:45 2015 +0200
@@ -94,20 +94,19 @@
void Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm,
WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, Time duration) const;
- /**
- * Assign a fixed random variable stream number to the random variables
- * used by this model. Return the number of streams (possibly zero) that
- * have been assigned.
- *
- * \param stream first stream index to use
- *
- * \return the number of stream indices assigned by this model
- */
+ /**
+ * Assign a fixed random variable stream number to the random variables
+ * used by this model. Return the number of streams (possibly zero) that
+ * have been assigned.
+ *
+ * \param stream first stream index to use
+ *
+ * \return the number of stream indices assigned by this model
+ */
int64_t AssignStreams (int64_t stream);
private:
-
/**
* A vector of pointers to YansWifiPhy.
*/
@@ -132,6 +131,6 @@
Ptr<PropagationDelayModel> m_delay; //!< Propagation delay model
};
-} // namespace ns3
+} //namespace ns3
#endif /* YANS_WIFI_CHANNEL_H */
--- a/src/wifi/model/yans-wifi-phy.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/yans-wifi-phy.cc Sun Jun 21 00:23:45 2015 +0200
@@ -127,19 +127,19 @@
"The operating frequency.",
UintegerValue (2407),
MakeUintegerAccessor (&YansWifiPhy::GetFrequency,
- &YansWifiPhy::SetFrequency),
+ &YansWifiPhy::SetFrequency),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("Transmitters",
"The number of transmitters.",
UintegerValue (1),
MakeUintegerAccessor (&YansWifiPhy::GetNumberOfTransmitAntennas,
- &YansWifiPhy::SetNumberOfTransmitAntennas),
+ &YansWifiPhy::SetNumberOfTransmitAntennas),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("Receivers",
"The number of receivers.",
UintegerValue (1),
MakeUintegerAccessor (&YansWifiPhy::GetNumberOfReceiveAntennas,
- &YansWifiPhy::SetNumberOfReceiveAntennas),
+ &YansWifiPhy::SetNumberOfReceiveAntennas),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("ShortGuardEnabled",
"Whether or not short guard interval is enabled.",
@@ -481,29 +481,29 @@
NS_LOG_FUNCTION (this);
switch (m_state->GetState ())
{
- case YansWifiPhy::TX:
- NS_LOG_DEBUG ("setting sleep mode postponed until end of current transmission");
- Simulator::Schedule (GetDelayUntilIdle (), &YansWifiPhy::SetSleepMode, this);
- break;
- case YansWifiPhy::RX:
- NS_LOG_DEBUG ("setting sleep mode postponed until end of current reception");
- Simulator::Schedule (GetDelayUntilIdle (), &YansWifiPhy::SetSleepMode, this);
- break;
- case YansWifiPhy::SWITCHING:
- NS_LOG_DEBUG ("setting sleep mode postponed until end of channel switching");
- Simulator::Schedule (GetDelayUntilIdle (), &YansWifiPhy::SetSleepMode, this);
- break;
- case YansWifiPhy::CCA_BUSY:
- case YansWifiPhy::IDLE:
- NS_LOG_DEBUG ("setting sleep mode");
- m_state->SwitchToSleep ();
- break;
- case YansWifiPhy::SLEEP:
- NS_LOG_DEBUG ("already in sleep mode");
- break;
- default:
- NS_ASSERT (false);
- break;
+ case YansWifiPhy::TX:
+ NS_LOG_DEBUG ("setting sleep mode postponed until end of current transmission");
+ Simulator::Schedule (GetDelayUntilIdle (), &YansWifiPhy::SetSleepMode, this);
+ break;
+ case YansWifiPhy::RX:
+ NS_LOG_DEBUG ("setting sleep mode postponed until end of current reception");
+ Simulator::Schedule (GetDelayUntilIdle (), &YansWifiPhy::SetSleepMode, this);
+ break;
+ case YansWifiPhy::SWITCHING:
+ NS_LOG_DEBUG ("setting sleep mode postponed until end of channel switching");
+ Simulator::Schedule (GetDelayUntilIdle (), &YansWifiPhy::SetSleepMode, this);
+ break;
+ case YansWifiPhy::CCA_BUSY:
+ case YansWifiPhy::IDLE:
+ NS_LOG_DEBUG ("setting sleep mode");
+ m_state->SwitchToSleep ();
+ break;
+ case YansWifiPhy::SLEEP:
+ NS_LOG_DEBUG ("already in sleep mode");
+ break;
+ default:
+ NS_ASSERT (false);
+ break;
}
}
@@ -513,27 +513,27 @@
NS_LOG_FUNCTION (this);
switch (m_state->GetState ())
{
- case YansWifiPhy::TX:
- case YansWifiPhy::RX:
- case YansWifiPhy::IDLE:
- case YansWifiPhy::CCA_BUSY:
- case YansWifiPhy::SWITCHING:
- {
- NS_LOG_DEBUG ("not in sleep mode, there is nothing to resume");
- break;
- }
- case YansWifiPhy::SLEEP:
- {
- NS_LOG_DEBUG ("resuming from sleep mode");
- Time delayUntilCcaEnd = m_interference.GetEnergyDuration (m_ccaMode1ThresholdW);
- m_state->SwitchFromSleep (delayUntilCcaEnd);
- break;
- }
- default:
- {
- NS_ASSERT (false);
- break;
- }
+ case YansWifiPhy::TX:
+ case YansWifiPhy::RX:
+ case YansWifiPhy::IDLE:
+ case YansWifiPhy::CCA_BUSY:
+ case YansWifiPhy::SWITCHING:
+ {
+ NS_LOG_DEBUG ("not in sleep mode, there is nothing to resume");
+ break;
+ }
+ case YansWifiPhy::SLEEP:
+ {
+ NS_LOG_DEBUG ("resuming from sleep mode");
+ Time delayUntilCcaEnd = m_interference.GetEnergyDuration (m_ccaMode1ThresholdW);
+ m_state->SwitchFromSleep (delayUntilCcaEnd);
+ break;
+ }
+ default:
+ {
+ NS_ASSERT (false);
+ break;
+ }
}
}
@@ -558,7 +558,7 @@
{
//This function should be later split to check separately wether plcp preamble and plcp header can be successfully received.
//Note: plcp preamble reception is not yet modeled.
- NS_LOG_FUNCTION (this << packet << rxPowerDbm << txVector.GetMode() << preamble << (uint32_t)packetType);
+ NS_LOG_FUNCTION (this << packet << rxPowerDbm << txVector.GetMode () << preamble << (uint32_t)packetType);
AmpduTag ampduTag;
rxPowerDbm += m_rxGainDb;
double rxPowerW = DbmToW (rxPowerDbm);
@@ -571,7 +571,7 @@
preamble,
rxDuration,
rxPowerW);
-
+
switch (m_state->GetState ())
{
case YansWifiPhy::SWITCHING:
@@ -631,42 +631,44 @@
NotifyRxDrop (packet);
goto maybeCcaBusy;
}
- else if (preamble != WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum == 0)
+ else if (preamble != WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum == 0)
{
//received the first MPDU in an MPDU
m_mpdusNum = ampduTag.GetNoOfMpdus () - 1;
}
- else if (preamble == WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum > 0)
+ else if (preamble == WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum > 0)
{
//received the other MPDUs that are part of the A-MPDU
if (ampduTag.GetNoOfMpdus () < m_mpdusNum)
{
- NS_LOG_DEBUG ("Missing MPDU from the A-MPDU " << m_mpdusNum - ampduTag.GetNoOfMpdus ());
- m_mpdusNum = ampduTag.GetNoOfMpdus ();
+ NS_LOG_DEBUG ("Missing MPDU from the A-MPDU " << m_mpdusNum - ampduTag.GetNoOfMpdus ());
+ m_mpdusNum = ampduTag.GetNoOfMpdus ();
}
else
- m_mpdusNum--;
+ {
+ m_mpdusNum--;
+ }
}
else if (preamble != WIFI_PREAMBLE_NONE && m_mpdusNum > 0 )
{
NS_LOG_DEBUG ("Didn't receive the last MPDUs from an A-MPDU " << m_mpdusNum);
m_mpdusNum = 0;
}
-
+
NS_LOG_DEBUG ("sync to signal (power=" << rxPowerW << "W)");
//sync to signal
m_state->SwitchToRx (rxDuration);
NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
NotifyRxBegin (packet);
m_interference.NotifyRxStart ();
-
+
if (preamble != WIFI_PREAMBLE_NONE)
- {
- NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
- m_endPlcpRxEvent = Simulator::Schedule (preambleAndHeaderDuration, &YansWifiPhy::StartReceivePacket, this,
- packet, txVector, preamble, packetType, event);
- }
-
+ {
+ NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
+ m_endPlcpRxEvent = Simulator::Schedule (preambleAndHeaderDuration, &YansWifiPhy::StartReceivePacket, this,
+ packet, txVector, preamble, packetType, event);
+ }
+
NS_ASSERT (m_endRxEvent.IsExpired ());
m_endRxEvent = Simulator::Schedule (rxDuration, &YansWifiPhy::EndReceive, this,
packet, preamble, packetType, event);
@@ -688,8 +690,8 @@
}
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
@@ -705,7 +707,7 @@
void
YansWifiPhy::StartReceivePacket (Ptr<Packet> packet,
WifiTxVector txVector,
- enum WifiPreamble preamble,
+ enum WifiPreamble preamble,
uint8_t packetType,
Ptr<InterferenceHelper::Event> event)
{
@@ -714,32 +716,32 @@
NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
AmpduTag ampduTag;
WifiMode txMode = txVector.GetMode ();
-
+
struct InterferenceHelper::SnrPer snrPer;
snrPer = m_interference.CalculatePlcpHeaderSnrPer (event);
-
+
NS_LOG_DEBUG ("snr=" << snrPer.snr << ", per=" << snrPer.per);
- if (m_random->GetValue () > snrPer.per) //plcp reception succeeded
- {
- if (IsModeSupported (txMode) || IsMcsSupported (txMode))
- {
- NS_LOG_DEBUG ("receiving plcp payload"); //endReceive is already scheduled
- m_plcpSuccess = true;
- }
- else //mode is not allowed
- {
- NS_LOG_DEBUG ("drop packet because it was sent using an unsupported mode (" << txMode << ")");
- NotifyRxDrop (packet);
- m_plcpSuccess = false;
- }
- }
- else //plcp reception failed
- {
- NS_LOG_DEBUG ("drop packet because plcp preamble/header reception failed");
- NotifyRxDrop (packet);
- m_plcpSuccess = false;
- }
+ if (m_random->GetValue () > snrPer.per) //plcp reception succeeded
+ {
+ if (IsModeSupported (txMode) || IsMcsSupported (txMode))
+ {
+ NS_LOG_DEBUG ("receiving plcp payload"); //endReceive is already scheduled
+ m_plcpSuccess = true;
+ }
+ else //mode is not allowed
+ {
+ NS_LOG_DEBUG ("drop packet because it was sent using an unsupported mode (" << txMode << ")");
+ NotifyRxDrop (packet);
+ m_plcpSuccess = false;
+ }
+ }
+ else //plcp reception failed
+ {
+ NS_LOG_DEBUG ("drop packet because plcp preamble/header reception failed");
+ NotifyRxDrop (packet);
+ m_plcpSuccess = false;
+ }
}
void
@@ -753,14 +755,14 @@
* - we are idle
*/
NS_ASSERT (!m_state->IsStateTx () && !m_state->IsStateSwitching ());
-
+
if (m_state->IsStateSleep ())
{
NS_LOG_DEBUG ("Dropping packet because in sleep mode");
NotifyTxDrop (packet);
return;
}
-
+
Time txDuration = CalculateTxDuration (packet->GetSize (), txVector, preamble, GetFrequency (), packetType, 1);
if (m_state->IsStateRx ())
{
@@ -770,7 +772,7 @@
}
NotifyTxBegin (packet);
uint32_t dataRate500KbpsUnits;
- if (txVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT)
+ if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
{
dataRate500KbpsUnits = 128 + WifiModeToMcs (txVector.GetMode ());
}
@@ -939,10 +941,10 @@
m_deviceRateSet.push_back (WifiPhy::GetOfdmRate12Mbps ());
m_deviceRateSet.push_back (WifiPhy::GetOfdmRate24Mbps ());
}
- m_bssMembershipSelectorSet.push_back(HT_PHY);
+ m_bssMembershipSelectorSet.push_back (HT_PHY);
for (uint8_t i = 0; i < 8; i++)
{
- m_deviceMcsSet.push_back(i);
+ m_deviceMcsSet.push_back (i);
}
}
@@ -1078,12 +1080,12 @@
struct InterferenceHelper::SnrPer snrPer;
snrPer = m_interference.CalculatePlcpPayloadSnrPer (event);
m_interference.NotifyRxEnd ();
-
+
if (m_plcpSuccess == true)
{
NS_LOG_DEBUG ("mode=" << (event->GetPayloadMode ().GetDataRate ()) <<
", snr=" << snrPer.snr << ", per=" << snrPer.per << ", size=" << packet->GetSize ());
-
+
if (m_random->GetValue () > snrPer.per)
{
NotifyRxEnd (packet);
@@ -1114,7 +1116,7 @@
//notify rx end
m_state->SwitchFromRxEndError (packet, snrPer.snr);
}
-
+
if (preamble == WIFI_PREAMBLE_NONE && packetType == 2)
{
m_plcpSuccess = false;
@@ -1214,31 +1216,31 @@
}
bool
-YansWifiPhy::GetChannelBonding(void) const
+YansWifiPhy::GetChannelBonding (void) const
{
return m_channelBonding;
}
void
-YansWifiPhy::SetChannelBonding(bool channelbonding)
+YansWifiPhy::SetChannelBonding (bool channelbonding)
{
- m_channelBonding= channelbonding;
+ m_channelBonding = channelbonding;
}
uint32_t
YansWifiPhy::GetNBssMembershipSelectors (void) const
{
- return m_bssMembershipSelectorSet.size ();
+ return m_bssMembershipSelectorSet.size ();
}
uint32_t
YansWifiPhy::GetBssMembershipSelector (uint32_t selector) const
{
- return m_bssMembershipSelectorSet[selector];
+ return m_bssMembershipSelectorSet[selector];
}
WifiModeList
-YansWifiPhy::GetMembershipSelectorModes(uint32_t selector)
+YansWifiPhy::GetMembershipSelectorModes (uint32_t selector)
{
uint32_t id = GetBssMembershipSelector (selector);
WifiModeList supportedmodes;
@@ -1260,16 +1262,16 @@
uint8_t
YansWifiPhy::GetNMcs (void) const
{
- return m_deviceMcsSet.size ();
+ return m_deviceMcsSet.size ();
}
uint8_t
YansWifiPhy::GetMcs (uint8_t mcs) const
{
- return m_deviceMcsSet[mcs];
+ return m_deviceMcsSet[mcs];
}
-uint32_t
+uint32_t
YansWifiPhy::WifiModeToMcs (WifiMode mode)
{
uint32_t mcs = 0;
@@ -1281,52 +1283,52 @@
{
switch (mode.GetDataRate ())
{
- case 6500000:
- case 7200000:
- case 13500000:
- case 15000000:
- mcs = 0;
- break;
- case 13000000:
- case 14400000:
- case 27000000:
- case 30000000:
- mcs = 1;
- break;
- case 19500000:
- case 21700000:
- case 40500000:
- case 45000000:
- mcs = 2;
- break;
- case 26000000:
- case 28900000:
- case 54000000:
- case 60000000:
- mcs = 3;
- break;
- case 39000000:
- case 43300000:
- case 81000000:
- case 90000000:
- mcs = 4;
- break;
- case 52000000:
- case 57800000:
- case 108000000:
- case 120000000:
- mcs = 5;
- break;
- case 58500000:
- case 121500000:
- mcs = 6;
- break;
- case 65000000:
- case 72200000:
- case 135000000:
- case 150000000:
- mcs = 7;
- break;
+ case 6500000:
+ case 7200000:
+ case 13500000:
+ case 15000000:
+ mcs = 0;
+ break;
+ case 13000000:
+ case 14400000:
+ case 27000000:
+ case 30000000:
+ mcs = 1;
+ break;
+ case 19500000:
+ case 21700000:
+ case 40500000:
+ case 45000000:
+ mcs = 2;
+ break;
+ case 26000000:
+ case 28900000:
+ case 54000000:
+ case 60000000:
+ mcs = 3;
+ break;
+ case 39000000:
+ case 43300000:
+ case 81000000:
+ case 90000000:
+ mcs = 4;
+ break;
+ case 52000000:
+ case 57800000:
+ case 108000000:
+ case 120000000:
+ mcs = 5;
+ break;
+ case 58500000:
+ case 121500000:
+ mcs = 6;
+ break;
+ case 65000000:
+ case 72200000:
+ case 135000000:
+ case 150000000:
+ mcs = 7;
+ break;
}
}
return mcs;
@@ -1338,153 +1340,153 @@
WifiMode mode;
switch (mcs)
{
- case 7:
- if (!GetGuardInterval () && !GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate65MbpsBW20MHz ();
- }
- else if (GetGuardInterval () && !GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate72_2MbpsBW20MHz ();
- }
- else if (!GetGuardInterval () && GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate135MbpsBW40MHz ();
- }
- else
- {
- mode = WifiPhy::GetOfdmRate150MbpsBW40MHz ();
- }
- break;
- case 6:
- if (!GetGuardInterval () && !GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate58_5MbpsBW20MHz ();
- }
- else if (GetGuardInterval () && !GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate65MbpsBW20MHzShGi ();
- }
- else if (!GetGuardInterval () && GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate121_5MbpsBW40MHz ();
- }
- else
- {
- mode= WifiPhy::GetOfdmRate135MbpsBW40MHzShGi ();
- }
- break;
- case 5:
- if (!GetGuardInterval () && !GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate52MbpsBW20MHz ();
- }
- else if (GetGuardInterval() && !GetChannelBonding())
- {
- mode = WifiPhy::GetOfdmRate57_8MbpsBW20MHz ();
- }
- else if (!GetGuardInterval () && GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate108MbpsBW40MHz ();
- }
- else
- {
- mode = WifiPhy::GetOfdmRate120MbpsBW40MHz ();
- }
- break;
- case 4:
- if (!GetGuardInterval () && !GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate39MbpsBW20MHz ();
- }
- else if (GetGuardInterval () && !GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate43_3MbpsBW20MHz ();
- }
- else if (!GetGuardInterval () && GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate81MbpsBW40MHz ();
- }
- else
- {
- mode = WifiPhy::GetOfdmRate90MbpsBW40MHz ();
- }
- break;
- case 3:
- if (!GetGuardInterval () && !GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate26MbpsBW20MHz ();
- }
- else if (GetGuardInterval () && !GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate28_9MbpsBW20MHz ();
- }
- else if (!GetGuardInterval () && GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate54MbpsBW40MHz ();
- }
- else
- {
- mode = WifiPhy::GetOfdmRate60MbpsBW40MHz ();
- }
- break;
- case 2:
- if (!GetGuardInterval () && !GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate19_5MbpsBW20MHz ();
- }
- else if (GetGuardInterval () && !GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate21_7MbpsBW20MHz ();
- }
- else if (!GetGuardInterval () && GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate40_5MbpsBW40MHz ();
- }
- else
- {
- mode = WifiPhy::GetOfdmRate45MbpsBW40MHz ();
- }
- break;
- case 1:
- if (!GetGuardInterval () && !GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate13MbpsBW20MHz ();
- }
- else if (GetGuardInterval () && !GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate14_4MbpsBW20MHz ();
- }
- else if (!GetGuardInterval () && GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate27MbpsBW40MHz ();
- }
- else
- {
- mode = WifiPhy::GetOfdmRate30MbpsBW40MHz ();
- }
- break;
- case 0:
- default:
- if (!GetGuardInterval () && !GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate6_5MbpsBW20MHz ();
- }
- else if (GetGuardInterval () && !GetChannelBonding ())
- {
- mode = WifiPhy::GetOfdmRate7_2MbpsBW20MHz ();
- }
- else if (!GetGuardInterval() && GetChannelBonding())
- {
- mode = WifiPhy::GetOfdmRate13_5MbpsBW40MHz ();
- }
- else
- {
- mode = WifiPhy::GetOfdmRate15MbpsBW40MHz ();
- }
- break;
+ case 7:
+ if (!GetGuardInterval () && !GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate65MbpsBW20MHz ();
+ }
+ else if (GetGuardInterval () && !GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate72_2MbpsBW20MHz ();
+ }
+ else if (!GetGuardInterval () && GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate135MbpsBW40MHz ();
+ }
+ else
+ {
+ mode = WifiPhy::GetOfdmRate150MbpsBW40MHz ();
+ }
+ break;
+ case 6:
+ if (!GetGuardInterval () && !GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate58_5MbpsBW20MHz ();
+ }
+ else if (GetGuardInterval () && !GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate65MbpsBW20MHzShGi ();
+ }
+ else if (!GetGuardInterval () && GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate121_5MbpsBW40MHz ();
+ }
+ else
+ {
+ mode = WifiPhy::GetOfdmRate135MbpsBW40MHzShGi ();
+ }
+ break;
+ case 5:
+ if (!GetGuardInterval () && !GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate52MbpsBW20MHz ();
+ }
+ else if (GetGuardInterval () && !GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate57_8MbpsBW20MHz ();
+ }
+ else if (!GetGuardInterval () && GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate108MbpsBW40MHz ();
+ }
+ else
+ {
+ mode = WifiPhy::GetOfdmRate120MbpsBW40MHz ();
+ }
+ break;
+ case 4:
+ if (!GetGuardInterval () && !GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate39MbpsBW20MHz ();
+ }
+ else if (GetGuardInterval () && !GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate43_3MbpsBW20MHz ();
+ }
+ else if (!GetGuardInterval () && GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate81MbpsBW40MHz ();
+ }
+ else
+ {
+ mode = WifiPhy::GetOfdmRate90MbpsBW40MHz ();
+ }
+ break;
+ case 3:
+ if (!GetGuardInterval () && !GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate26MbpsBW20MHz ();
+ }
+ else if (GetGuardInterval () && !GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate28_9MbpsBW20MHz ();
+ }
+ else if (!GetGuardInterval () && GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate54MbpsBW40MHz ();
+ }
+ else
+ {
+ mode = WifiPhy::GetOfdmRate60MbpsBW40MHz ();
+ }
+ break;
+ case 2:
+ if (!GetGuardInterval () && !GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate19_5MbpsBW20MHz ();
+ }
+ else if (GetGuardInterval () && !GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate21_7MbpsBW20MHz ();
+ }
+ else if (!GetGuardInterval () && GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate40_5MbpsBW40MHz ();
+ }
+ else
+ {
+ mode = WifiPhy::GetOfdmRate45MbpsBW40MHz ();
+ }
+ break;
+ case 1:
+ if (!GetGuardInterval () && !GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate13MbpsBW20MHz ();
+ }
+ else if (GetGuardInterval () && !GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate14_4MbpsBW20MHz ();
+ }
+ else if (!GetGuardInterval () && GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate27MbpsBW40MHz ();
+ }
+ else
+ {
+ mode = WifiPhy::GetOfdmRate30MbpsBW40MHz ();
+ }
+ break;
+ case 0:
+ default:
+ if (!GetGuardInterval () && !GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate6_5MbpsBW20MHz ();
+ }
+ else if (GetGuardInterval () && !GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate7_2MbpsBW20MHz ();
+ }
+ else if (!GetGuardInterval () && GetChannelBonding ())
+ {
+ mode = WifiPhy::GetOfdmRate13_5MbpsBW40MHz ();
+ }
+ else
+ {
+ mode = WifiPhy::GetOfdmRate15MbpsBW40MHz ();
+ }
+ break;
}
return mode;
}
-} // namespace ns3
+} //namespace ns3
--- a/src/wifi/model/yans-wifi-phy.h Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/model/yans-wifi-phy.h Sun Jun 21 00:23:45 2015 +0200
@@ -94,7 +94,7 @@
* Return current center channel frequency in MHz.
*
* \return the current center channel frequency in MHz
- */
+ */
double GetChannelFrequencyMhz () const;
/**
@@ -104,7 +104,7 @@
* \param rxPowerDbm the receive power in dBm
* \param txVector the TXVECTOR of the arriving packet
* \param preamble the preamble of the arriving packet
- * \param packetType The type of the received packet (values: 0 not an A-MPDU, 1 corresponds to any packets in an A-MPDU except the last one, 2 is the last packet in an A-MPDU)
+ * \param packetType The type of the received packet (values: 0 not an A-MPDU, 1 corresponds to any packets in an A-MPDU except the last one, 2 is the last packet in an A-MPDU)
* \param rxDuration the duration needed for the reception of the packet
*/
void StartReceivePreambleAndHeader (Ptr<Packet> packet,
@@ -119,7 +119,7 @@
* \param packet the arriving packet
* \param txVector the TXVECTOR of the arriving packet
* \param preamble the preamble of the arriving packet
- * \param packetType The type of the received packet (values: 0 not an A-MPDU, 1 corresponds to any packets in an A-MPDU except the last one, 2 is the last packet in an A-MPDU)
+ * \param packetType The type of the received packet (values: 0 not an A-MPDU, 1 corresponds to any packets in an A-MPDU except the last one, 2 is the last packet in an A-MPDU)
* \param event the corresponding event of the first time the packet arrives
*/
void StartReceivePacket (Ptr<Packet> packet,
@@ -264,7 +264,7 @@
* \return the number of available transmission power levels
*/
virtual uint32_t GetNTxPower (void) const;
-
+
virtual void SetReceiveOkCallback (WifiPhy::RxOkCallback callback);
virtual void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback);
virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txvector, enum WifiPreamble preamble, uint8_t packetType);
@@ -288,17 +288,17 @@
virtual bool IsMcsSupported (WifiMode mode);
virtual double CalculateSnr (WifiMode txMode, double ber) const;
virtual Ptr<WifiChannel> GetChannel (void) const;
-
+
virtual void ConfigureStandard (enum WifiPhyStandard standard);
- /**
- * Assign a fixed random variable stream number to the random variables
- * used by this model. Return the number of streams (possibly zero) that
- * have been assigned.
- *
- * \param stream first stream index to use
- * \return the number of stream indices assigned by this model
- */
+ /**
+ * Assign a fixed random variable stream number to the random variables
+ * used by this model. Return the number of streams (possibly zero) that
+ * have been assigned.
+ *
+ * \param stream first stream index to use
+ * \return the number of stream indices assigned by this model
+ */
int64_t AssignStreams (int64_t stream);
/**
@@ -320,7 +320,7 @@
/**
* \param rx the number of receivers on this node.
*/
- virtual void SetNumberOfReceiveAntennas (uint32_t rx) ;
+ virtual void SetNumberOfReceiveAntennas (uint32_t rx);
/**
* \return the number of receivers on this node.
*/
@@ -355,7 +355,7 @@
*/
virtual void SetStbc (bool stbc);
/**
- * Return whether STBC is supported.
+ * Return whether STBC is supported.
*
* \return true if STBC is supported, false otherwise
*/
@@ -374,21 +374,21 @@
virtual bool GetGreenfield (void) const;
/**
* Return whether channel bonding is supported.
- *
+ *
* \return true if channel bonding is supported, false otherwise
*/
- virtual bool GetChannelBonding (void) const ;
+ virtual bool GetChannelBonding (void) const;
/**
* Enable or disable channel bonding support.
- *
+ *
* \param channelbonding Enable or disable channel bonding
*/
- virtual void SetChannelBonding (bool channelbonding) ;
+ virtual void SetChannelBonding (bool channelbonding);
virtual uint32_t GetNBssMembershipSelectors (void) const;
virtual uint32_t GetBssMembershipSelector (uint32_t selector) const;
- virtual WifiModeList GetMembershipSelectorModes(uint32_t selector);
-
+ virtual WifiModeList GetMembershipSelectorModes (uint32_t selector);
+
/**
* \return the number of MCS supported by this phy
*/
@@ -402,7 +402,7 @@
private:
virtual void DoInitialize (void);
virtual void DoDispose (void);
-
+
/**
* Configure YansWifiPhy with appropriate channel frequency and
* supported rates for 802.11a standard.
@@ -490,7 +490,7 @@
* \param event the corresponding event of the first time the packet arrives
*/
void EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, uint8_t packetType, Ptr<InterferenceHelper::Event> event);
-
+
bool m_initialized; //!< Flag for runtime initialization
double m_edThresholdW; //!< Energy detection threshold in watts
double m_ccaMode1ThresholdW; //!< Clear channel assessment (CCA) threshold in watts
@@ -508,7 +508,7 @@
uint32_t m_numberOfTransmitters; //!< Number of transmitters
uint32_t m_numberOfReceivers; //!< Number of receivers
bool m_ldpc; //!< Flag if LDPC is used
- bool m_stbc; //!< Flag if STBC is used
+ bool m_stbc; //!< Flag if STBC is used
bool m_greenfield; //!< Flag if GreenField format is supported
bool m_guardInterval; //!< Flag if short guard interval is used
bool m_channelBonding; //!< Flag if channel bonding is used
@@ -551,7 +551,7 @@
* mandatory rates".
*/
WifiModeList m_deviceRateSet;
-
+
std::vector<uint32_t> m_bssMembershipSelectorSet;
std::vector<uint8_t> m_deviceMcsSet;
EventId m_endRxEvent;
@@ -566,6 +566,6 @@
bool m_plcpSuccess; //!< Flag if the PLCP of the packet or the first MPDU in an A-MPDU has been received
};
-} // namespace ns3
+} //namespace ns3
#endif /* YANS_WIFI_PHY_H */
--- a/src/wifi/test/block-ack-test-suite.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/test/block-ack-test-suite.cc Sun Jun 21 00:23:45 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
+
#include "ns3/test.h"
#include "ns3/log.h"
#include "ns3/qos-utils.h"
@@ -98,7 +99,6 @@
uint32_t mappedSeq = QosUtilsMapSeqControlToUniqueInteger (receivedSeq, endSeq);
for (i = m_buffer.begin (); i != m_buffer.end () && QosUtilsMapSeqControlToUniqueInteger ((*i), endSeq) < mappedSeq; i++)
{
- ;
}
{
m_buffer.insert (i, receivedSeq);
@@ -108,7 +108,6 @@
mappedSeq = QosUtilsMapSeqControlToUniqueInteger (receivedSeq, endSeq);
for (i = m_buffer.begin (); i != m_buffer.end () && QosUtilsMapSeqControlToUniqueInteger ((*i), endSeq) < mappedSeq; i++)
{
- ;
}
{
m_buffer.insert (i, receivedSeq);
@@ -120,6 +119,7 @@
}
}
+
/* ----- = old packets
* +++++ = new packets
*
@@ -183,7 +183,6 @@
uint32_t mappedSeq = QosUtilsMapSeqControlToUniqueInteger (receivedSeq, endSeq);
for (i = m_buffer.begin (); i != m_buffer.end () && QosUtilsMapSeqControlToUniqueInteger ((*i), endSeq) < mappedSeq; i++)
{
- ;
}
{
m_buffer.insert (i, receivedSeq);
@@ -193,7 +192,6 @@
mappedSeq = QosUtilsMapSeqControlToUniqueInteger (receivedSeq, endSeq);
for (i = m_buffer.begin (); i != m_buffer.end () && QosUtilsMapSeqControlToUniqueInteger ((*i), endSeq) < mappedSeq; i++)
{
- ;
}
{
m_buffer.insert (i, receivedSeq);
@@ -203,7 +201,6 @@
mappedSeq = QosUtilsMapSeqControlToUniqueInteger (receivedSeq, endSeq);
for (i = m_buffer.begin (); i != m_buffer.end () && QosUtilsMapSeqControlToUniqueInteger ((*i), endSeq) < mappedSeq; i++)
{
- ;
}
{
m_buffer.insert (i, receivedSeq);
@@ -215,6 +212,7 @@
}
}
+
//Test for block ack header
class CtrlBAckResponseHeaderTest : public TestCase
{
@@ -276,6 +274,7 @@
NS_TEST_EXPECT_MSG_EQ (m_blockAckHdr.IsPacketReceived (80), false, "error in compressed bitmap");
}
+
class BlockAckTestSuite : public TestSuite
{
public:
--- a/src/wifi/test/dcf-manager-test.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/test/dcf-manager-test.cc Sun Jun 21 00:23:45 2015 +0200
@@ -31,6 +31,8 @@
public:
DcfStateTest (DcfManagerTest *test, uint32_t i);
void QueueTx (uint64_t txTime, uint64_t expectedGrantTime);
+
+
private:
friend class DcfManagerTest;
virtual void DoNotifyAccessGranted (void);
@@ -63,7 +65,6 @@
DcfManagerTest ();
virtual void DoRun (void);
-
void NotifyAccessGranted (uint32_t i);
void NotifyInternalCollision (uint32_t i);
void NotifyCollision (uint32_t i);
@@ -106,47 +107,50 @@
uint32_t m_ackTimeoutValue;
};
-
-
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
DcfStateTest::DoNotifyAccessGranted (void)
{
m_test->NotifyAccessGranted (m_i);
}
+
void
DcfStateTest::DoNotifyInternalCollision (void)
{
m_test->NotifyInternalCollision (m_i);
}
+
void
DcfStateTest::DoNotifyCollision (void)
{
m_test->NotifyCollision (m_i);
}
+
void
DcfStateTest::DoNotifyChannelSwitching (void)
{
m_test->NotifyChannelSwitching (m_i);
}
+
void
DcfStateTest::DoNotifySleep (void)
{
+}
-}
void
DcfStateTest::DoNotifyWakeUp (void)
{
-
}
DcfManagerTest::DcfManagerTest ()
@@ -165,6 +169,7 @@
m_dcfManager->NotifyTxStartNow (MicroSeconds (expected.first));
m_dcfManager->NotifyAckTimeoutStartNow (MicroSeconds (m_ackTimeoutValue + expected.first));
}
+
void
DcfManagerTest::AddTxEvt (uint64_t at, uint64_t duration)
{
@@ -172,6 +177,7 @@
&DcfManager::NotifyTxStartNow, m_dcfManager,
MicroSeconds (duration));
}
+
void
DcfManagerTest::NotifyInternalCollision (uint32_t i)
{
@@ -182,6 +188,7 @@
NS_TEST_EXPECT_MSG_EQ (Simulator::Now (), MicroSeconds (expected.at), "Expected internal collision time is now");
state->StartBackoffNow (expected.nSlots);
}
+
void
DcfManagerTest::NotifyCollision (uint32_t i)
{
@@ -192,6 +199,7 @@
NS_TEST_EXPECT_MSG_EQ (Simulator::Now (), MicroSeconds (expected.at), "Expected collision is now");
state->StartBackoffNow (expected.nSlots);
}
+
void
DcfManagerTest::NotifyChannelSwitching (uint32_t i)
{
@@ -213,6 +221,7 @@
col.nSlots = nSlots;
state->m_expectedInternalCollision.push_back (col);
}
+
void
DcfManagerTest::ExpectCollision (uint64_t time, uint32_t nSlots, uint32_t from)
{
@@ -268,6 +277,7 @@
Simulator::Schedule (MicroSeconds (at + duration) - Now (),
&DcfManager::NotifyRxEndOkNow, m_dcfManager);
}
+
void
DcfManagerTest::AddRxInsideSifsEvt (uint64_t at, uint64_t duration)
{
@@ -275,6 +285,7 @@
&DcfManager::NotifyRxStartNow, m_dcfManager,
MicroSeconds (duration));
}
+
void
DcfManagerTest::AddRxErrorEvt (uint64_t at, uint64_t duration)
{
@@ -292,6 +303,7 @@
&DcfManager::NotifyNavResetNow, m_dcfManager,
MicroSeconds (duration));
}
+
void
DcfManagerTest::AddNavStart (uint64_t at, uint64_t duration)
{
@@ -299,18 +311,21 @@
&DcfManager::NotifyNavStartNow, m_dcfManager,
MicroSeconds (duration));
}
+
void
DcfManagerTest::AddAckTimeoutReset (uint64_t at)
{
Simulator::Schedule (MicroSeconds (at) - Now (),
&DcfManager::NotifyAckTimeoutResetNow, m_dcfManager);
}
+
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)
@@ -319,6 +334,7 @@
&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)
@@ -329,12 +345,14 @@
txTime, expectedGrantTime, m_dcfStates[from]);
AddAckTimeoutReset (expectedGrantTime + txTime + ackDelay);
}
+
void
DcfManagerTest::DoAccessRequest (uint64_t txTime, uint64_t expectedGrantTime, DcfStateTest *state)
{
state->QueueTx (txTime, expectedGrantTime);
m_dcfManager->RequestAccess (state);
}
+
void
DcfManagerTest::AddCcaBusyEvt (uint64_t at, uint64_t duration)
{
@@ -342,6 +360,7 @@
&DcfManager::NotifyMaybeCcaBusyStartNow, m_dcfManager,
MicroSeconds (duration));
}
+
void
DcfManagerTest::AddSwitchingEvt (uint64_t at, uint64_t duration)
{
@@ -349,6 +368,7 @@
&DcfManager::NotifySwitchingStartNow, m_dcfManager,
MicroSeconds (duration));
}
+
void
DcfManagerTest::AddRxStartEvt (uint64_t at, uint64_t duration)
{
@@ -357,8 +377,6 @@
MicroSeconds (duration));
}
-
-
void
DcfManagerTest::DoRun (void)
{
@@ -374,6 +392,7 @@
// 0 3 4 5 8 9 12 13 14
// | sifs | aifsn | tx | sifs | ack | sifs | aifsn | |tx |
//
+
StartTest (1, 3, 10);
AddDcfState (1);
AddAccessRequest (1, 1, 4, 0);
@@ -381,8 +400,6 @@
AddTxEvt (8, 1);
AddAccessRequest (14, 2, 14, 0);
EndTest ();
-
-
// The test below mainly intends to test the case where the medium
// becomes busy in the middle of a backoff slot: the backoff counter
// must not be decremented for this backoff slot. This is the case
@@ -392,20 +409,21 @@
// | rx | sifs | aifsn | bslot0 | bslot1 | | rx | sifs | aifsn | bslot2 | bslot3 | tx |
// |
// 30 request access. backoff slots: 4
+
StartTest (4, 6, 10);
AddDcfState (1);
AddRxOkEvt (20, 40);
AddRxOkEvt (80, 20);
AddAccessRequest (30, 2, 118, 0);
- ExpectCollision (30, 4, 0); // backoff: 4 slots
+ ExpectCollision (30, 4, 0); //backoff: 4 slots
EndTest ();
-
// Test the case where the backoff slots is zero.
//
// 20 60 66 70 72
// | rx | sifs | aifsn | tx |
// |
// 30 request access. backoff slots: 0
+
StartTest (4, 6, 10);
AddDcfState (1);
AddRxOkEvt (20, 40);
@@ -424,10 +442,9 @@
AddRxOkEvt (20, 40);
AddRxOkEvt (60, 40);
AddAccessRequest (30, 2, 110, 0);
- ExpectCollision (30, 0, 0); // backoff: 0 slots
+ ExpectCollision (30, 0, 0); //backoff: 0 slots
EndTest ();
-
// 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
@@ -447,7 +464,6 @@
AddAccessRequest (62, 2, 70, 0);
EndTest ();
-
// Test an EIFS
//
// 20 60 66 76 86 90 94 98 102 106
@@ -458,7 +474,7 @@
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.
@@ -471,11 +487,10 @@
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 ();
-
// Test two DCFs which suffer an internal collision. the first DCF has a higher
// priority than the second DCF.
//
@@ -484,15 +499,14 @@
// DCF1 | rx | sifs | aifsn | aifsn | aifsn | | sifs | aifsn | aifsn | aifsn | bslot | tx |
// 94 98 102 106 110 112
StartTest (4, 6, 10);
- AddDcfState (1); // high priority DCF
- AddDcfState (3); // low priority DCF
+ AddDcfState (1); //high priority DCF
+ AddDcfState (3); //low priority DCF
AddRxOkEvt (20, 40);
AddAccessRequest (30, 10, 78, 0);
- ExpectCollision (30, 2, 0); // backoff: 2 slot
-
+ ExpectCollision (30, 2, 0); //backoff: 2 slot
AddAccessRequest (40, 2, 110, 1);
- ExpectCollision (40, 0, 1); // backoff: 0 slot
- ExpectInternalCollision (78, 1, 1); // backoff: 1 slot
+ 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,
@@ -503,8 +517,8 @@
// DCF1 - high | | |sifs| tx |
// ^ request access
StartTest (4, 6, 10);
- AddDcfState (2); // high priority DCF
- AddDcfState (0); // low priority DCF
+ AddDcfState (2); //high priority DCF
+ AddDcfState (0); //low priority DCF
AddAccessRequestWithAckTimeout (20, 20, 20, 0);
AddAccessRequest (50, 10, 66, 1);
EndTest ();
@@ -519,8 +533,8 @@
// DCF1 - high | | |sifs| tx |
// ^ request access
StartTest (4, 6, 10);
- AddDcfState (2); // high priority DCF
- AddDcfState (0); // low priority DCF
+ AddDcfState (2); //high priority DCF
+ AddDcfState (0); //low priority DCF
AddAccessRequestWithSuccessfullAck (20, 20, 20, 2, 0);
AddAccessRequest (41, 10, 48, 1);
EndTest ();
@@ -544,14 +558,12 @@
AddDcfState (2);
AddAccessRequestWithSuccessfullAck (20, 20, 20, 2, 0);
AddAccessRequest (39, 10, 64, 0);
- ExpectCollision (39, 2, 0); // backoff: 2 slot
+ ExpectCollision (39, 2, 0); //backoff: 2 slot
EndTest ();
- //
// 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);
@@ -559,14 +571,12 @@
AddRxOkEvt (66, 5);
AddNavStart (71, 0);
AddAccessRequest (30, 10, 93, 0);
- ExpectCollision (30, 2, 0); // backoff: 2 slot
+ ExpectCollision (30, 2, 0); //backoff: 2 slot
EndTest ();
- //
// 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);
@@ -574,7 +584,7 @@
AddRxOkEvt (66, 5);
AddNavReset (71, 2);
AddAccessRequest (30, 10, 91, 0);
- ExpectCollision (30, 2, 0); // backoff: 2 slot
+ ExpectCollision (30, 2, 0); //backoff: 2 slot
EndTest ();
@@ -590,7 +600,7 @@
AddRxOkEvt (20, 40);
AddRxOkEvt (78, 8);
AddAccessRequest (30, 50, 108, 0);
- ExpectCollision (30, 3, 0); // backoff: 3 slots
+ ExpectCollision (30, 3, 0); //backoff: 3 slots
EndTest ();
@@ -676,13 +686,12 @@
AddDcfState (1);
AddRxOkEvt (20,40);
AddAccessRequest (30, 2, 80, 0);
- ExpectCollision (30, 4, 0); // backoff: 4 slots
+ ExpectCollision (30, 4, 0); //backoff: 4 slots
AddSwitchingEvt (80,20);
AddAccessRequest (101, 2, 110, 0);
EndTest ();
}
-//-----------------------------------------------------------------------------
class DcfTestSuite : public TestSuite
{
--- a/src/wifi/test/power-rate-adaptation-test.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/test/power-rate-adaptation-test.cc Sun Jun 21 00:23:45 2015 +0200
@@ -93,9 +93,9 @@
/*
* Configure power control parameters.
*/
- phy->SetNTxPower(18);
- phy->SetTxPowerStart(0);
- phy->SetTxPowerEnd(17);
+ phy->SetNTxPower (18);
+ phy->SetTxPowerStart (0);
+ phy->SetTxPowerEnd (17);
/*
* Create manager.
@@ -119,15 +119,15 @@
PowerRateAdaptationTest::TestParf ()
{
m_manager.SetTypeId ("ns3::ParfWifiManager");
- Ptr<Node> node = ConfigureNode();
- Ptr<WifiNetDevice> dev = DynamicCast<WifiNetDevice> (node->GetDevice(0));
- Ptr<WifiRemoteStationManager> manager = dev->GetRemoteStationManager();
+ Ptr<Node> node = ConfigureNode ();
+ Ptr<WifiNetDevice> dev = DynamicCast<WifiNetDevice> (node->GetDevice (0));
+ Ptr<WifiRemoteStationManager> manager = dev->GetRemoteStationManager ();
/*
* Configure thresholds for rate and power control.
*/
- manager->SetAttribute("AttemptThreshold",UintegerValue (15));
- manager->SetAttribute("SuccessThreshold",UintegerValue(10));
+ manager->SetAttribute ("AttemptThreshold",UintegerValue (15));
+ manager->SetAttribute ("SuccessThreshold",UintegerValue (10));
/*
* Create a dummy packet to simulate transmission.
@@ -150,11 +150,11 @@
/*
* Parf initiates with maximal rate and power.
*/
- WifiTxVector txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- WifiMode mode = txVector.GetMode();
- int power = (int) txVector.GetTxPowerLevel();
+ WifiTxVector txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ WifiMode mode = txVector.GetMode ();
+ int power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 54000000, "PARF: Initial data rate wrong");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 54000000, "PARF: Initial data rate wrong");
NS_TEST_ASSERT_MSG_EQ (power, 17, "PARF: Initial power level wrong");
//-----------------------------------------------------------------------------------------------------
@@ -163,16 +163,16 @@
* After 10 consecutive successful transmissions parf increase rate or decrease power.
* As we are at maximal rate, the power should be decreased. recoveryPower=true.
*/
- for(int i = 0; i<10; i++)
+ for (int i = 0; i < 10; i++)
{
- manager->ReportDataOk(remoteAddress, &packetHeader, 0, ackMode, 0);
+ manager->ReportDataOk (remoteAddress, &packetHeader, 0, ackMode, 0);
}
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 54000000, "PARF: Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 54000000, "PARF: Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 16, "PARF: Incorrect value of power level");
//-----------------------------------------------------------------------------------------------------
@@ -181,13 +181,13 @@
* As we are using recovery power, one failure make power increase.
*
*/
- manager->ReportDataFailed(remoteAddress,&packetHeader);
+ manager->ReportDataFailed (remoteAddress,&packetHeader);
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 54000000, "PARF: Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 54000000, "PARF: Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 17, "PARF: Incorrect value of power level");
//-----------------------------------------------------------------------------------------------------
@@ -196,18 +196,18 @@
* After 15 transmissions attempts parf increase rate or decrease power.
* As we are at maximal rate, the power should be decreased. recoveryPower=true.
*/
- for(int i = 0; i<7; i++)
+ for (int i = 0; i < 7; i++)
{
- manager->ReportDataOk(remoteAddress, &packetHeader, 0, ackMode, 0);
- manager->ReportDataFailed(remoteAddress,&packetHeader);
+ manager->ReportDataOk (remoteAddress, &packetHeader, 0, ackMode, 0);
+ manager->ReportDataFailed (remoteAddress,&packetHeader);
}
- manager->ReportDataOk(remoteAddress, &packetHeader, 0, ackMode, 0);
+ manager->ReportDataOk (remoteAddress, &packetHeader, 0, ackMode, 0);
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 54000000, "PARF: Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 54000000, "PARF: Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 16, "PARF: Incorrect value of power level");
//-----------------------------------------------------------------------------------------------------
@@ -216,13 +216,13 @@
* As we are using recovery power, one failure make power increase. recoveryPower=false.
*/
- manager->ReportDataFailed(remoteAddress,&packetHeader);
+ manager->ReportDataFailed (remoteAddress,&packetHeader);
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 54000000, "PARF: Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 54000000, "PARF: Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 17, "PARF: Incorrect value of power level");
//-----------------------------------------------------------------------------------------------------
@@ -231,14 +231,14 @@
* After two consecutive fails the rate is decreased or the power increased.
* As we are at maximal power, the rate should be decreased.
*/
- manager->ReportDataFailed(remoteAddress,&packetHeader);
- manager->ReportDataFailed(remoteAddress,&packetHeader);
+ manager->ReportDataFailed (remoteAddress,&packetHeader);
+ manager->ReportDataFailed (remoteAddress,&packetHeader);
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 48000000, "PARF: Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 48000000, "PARF: Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 17, "PARF: Incorrect value of power level");
//-----------------------------------------------------------------------------------------------------
@@ -247,16 +247,16 @@
* After 10 consecutive successful transmissions parf increase rate or decrease power.
* As we are not at maximal rate, the rate is increased again. recoveryRate=true.
*/
- for(int i = 0; i<10; i++)
+ for (int i = 0; i < 10; i++)
{
- manager->ReportDataOk(remoteAddress, &packetHeader, 0, ackMode, 0);
+ manager->ReportDataOk (remoteAddress, &packetHeader, 0, ackMode, 0);
}
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 54000000, "PARF: Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 54000000, "PARF: Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 17, "PARF: Incorrect value of power level");
//-----------------------------------------------------------------------------------------------------
@@ -265,13 +265,13 @@
* As we are using recovery rate, one failure make rate decrease. recoveryRate=false.
*/
- manager->ReportDataFailed(remoteAddress,&packetHeader);
+ manager->ReportDataFailed (remoteAddress,&packetHeader);
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 48000000, "PARF: Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 48000000, "PARF: Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 17, "PARF: Incorrect value of power level");
//-----------------------------------------------------------------------------------------------------
@@ -280,16 +280,16 @@
* After 10 consecutive successful transmissions parf increase rate or decrease power.
* As we are not at maximal rate, the rate is increased again. recoveryRate=true.
*/
- for(int i = 0; i<10; i++)
+ for (int i = 0; i < 10; i++)
{
- manager->ReportDataOk(remoteAddress, &packetHeader, 0, ackMode, 0);
+ manager->ReportDataOk (remoteAddress, &packetHeader, 0, ackMode, 0);
}
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 54000000, "PARF: Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 54000000, "PARF: Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 17, "PARF: Incorrect value of power level");
//-----------------------------------------------------------------------------------------------------
@@ -298,16 +298,16 @@
* After 10 consecutive successful transmissions parf increase rate or decrease power.
* As we are at maximal rate, the power is decreased. recoveryRate=false, recoveryPower=true.
*/
- for(int i = 0; i<10; i++)
+ for (int i = 0; i < 10; i++)
{
- manager->ReportDataOk(remoteAddress, &packetHeader, 0, ackMode, 0);
+ manager->ReportDataOk (remoteAddress, &packetHeader, 0, ackMode, 0);
}
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 54000000, "PARF: Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 54000000, "PARF: Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 16, "PARF: Incorrect value of power level");
//-----------------------------------------------------------------------------------------------------
@@ -316,18 +316,18 @@
* One successful transmissions after a power decrease make recoverPower=false.
* So we need two consecutive failures to increase power again.
*/
- manager->ReportDataOk(remoteAddress, &packetHeader, 0, ackMode, 0);
+ manager->ReportDataOk (remoteAddress, &packetHeader, 0, ackMode, 0);
- for(int i = 0; i<2; i++)
+ for (int i = 0; i < 2; i++)
{
- manager->ReportDataFailed(remoteAddress,&packetHeader);
+ manager->ReportDataFailed (remoteAddress,&packetHeader);
}
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 54000000, "PARF: Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 54000000, "PARF: Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 17, "PARF: Incorrect value of power level");
Simulator::Stop (Seconds (10.0));
@@ -341,17 +341,17 @@
PowerRateAdaptationTest::TestAparf ()
{
m_manager.SetTypeId ("ns3::AparfWifiManager");
- Ptr<Node> node = ConfigureNode();
- Ptr<WifiNetDevice> dev = DynamicCast<WifiNetDevice> (node->GetDevice(0));
- Ptr<WifiRemoteStationManager> manager = dev->GetRemoteStationManager();
+ Ptr<Node> node = ConfigureNode ();
+ Ptr<WifiNetDevice> dev = DynamicCast<WifiNetDevice> (node->GetDevice (0));
+ Ptr<WifiRemoteStationManager> manager = dev->GetRemoteStationManager ();
/*
* Configure thresholds for rate and power control.
*/
- manager->SetAttribute("SuccessThreshold 1",UintegerValue (3));
- manager->SetAttribute("SuccessThreshold 2",UintegerValue(10));
- manager->SetAttribute("FailThreshold",UintegerValue (1));
- manager->SetAttribute("PowerThreshold",UintegerValue(10));
+ manager->SetAttribute ("SuccessThreshold 1",UintegerValue (3));
+ manager->SetAttribute ("SuccessThreshold 2",UintegerValue (10));
+ manager->SetAttribute ("FailThreshold",UintegerValue (1));
+ manager->SetAttribute ("PowerThreshold",UintegerValue (10));
/*
* Create a dummy packet to simulate transmission.
@@ -374,11 +374,11 @@
/*
* Aparf initiates with maximal rate and power.
*/
- WifiTxVector txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- WifiMode mode = txVector.GetMode();
- int power = (int) txVector.GetTxPowerLevel();
+ WifiTxVector txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ WifiMode mode = txVector.GetMode ();
+ int power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 54000000, "APARF: Initial data rate wrong");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 54000000, "APARF: Initial data rate wrong");
NS_TEST_ASSERT_MSG_EQ (power, 17, "APARF: Initial power level wrong");
//-----------------------------------------------------------------------------------------------------
@@ -388,16 +388,16 @@
* As we are at maximal rate, the power should be decreased.
* Change to state Spread.
*/
- for(int i = 0; i<3; i++)
+ for (int i = 0; i < 3; i++)
{
- manager->ReportDataOk(remoteAddress, &packetHeader, 0, ackMode, 0);
+ manager->ReportDataOk (remoteAddress, &packetHeader, 0, ackMode, 0);
}
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 54000000, "APARF: Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 54000000, "APARF: Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 16, "APARF: Incorrect value of power level");
//-----------------------------------------------------------------------------------------------------
@@ -406,13 +406,13 @@
* One failure make the power to be increased again.
* Change to state Low.
*/
- manager->ReportDataFailed(remoteAddress,&packetHeader);
+ manager->ReportDataFailed (remoteAddress,&packetHeader);
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 54000000, "APARF: Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 54000000, "APARF: Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 17, "APARF: Incorrect value of power level");
//-----------------------------------------------------------------------------------------------------
@@ -422,16 +422,16 @@
* As we are at maximal rate, the power should be decreased.
* Change to state Spread.
*/
- for(int i = 0; i<10; i++)
+ for (int i = 0; i < 10; i++)
{
- manager->ReportDataOk(remoteAddress, &packetHeader, 0, ackMode, 0);
+ manager->ReportDataOk (remoteAddress, &packetHeader, 0, ackMode, 0);
}
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 54000000, "APARF: Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 54000000, "APARF: Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 16, "APARF: Incorrect value of power level");
//-----------------------------------------------------------------------------------------------------
@@ -441,16 +441,16 @@
* Two more successful transmissions make power decrease.
*/
- for(int i = 0; i<3; i++)
+ for (int i = 0; i < 3; i++)
{
- manager->ReportDataOk(remoteAddress, &packetHeader, 0, ackMode, 0);
+ manager->ReportDataOk (remoteAddress, &packetHeader, 0, ackMode, 0);
}
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 54000000, "APARF: Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 54000000, "APARF: Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 15, "APARF: Incorrect value of power level");
//-----------------------------------------------------------------------------------------------------
@@ -459,16 +459,16 @@
* As we are in state High we need 3 successful transmissions to increase rate or decrease power.
* After 16*3 successful transmissions power is decreased to zero.
*/
- for(int i = 0; i<16*3; i++)
+ for (int i = 0; i < 16 * 3; i++)
{
- manager->ReportDataOk(remoteAddress, &packetHeader, 0, ackMode, 0);
+ manager->ReportDataOk (remoteAddress, &packetHeader, 0, ackMode, 0);
}
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 54000000, "APARF: Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 54000000, "APARF: Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 0, "APARF: Incorrect value of power level");
//-----------------------------------------------------------------------------------------------------
@@ -477,13 +477,13 @@
* After one fail the rate is decreased or the power increased.
* As we are at minimal power, the power should be increased.
*/
- manager->ReportDataFailed(remoteAddress,&packetHeader);
+ manager->ReportDataFailed (remoteAddress,&packetHeader);
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 54000000, "Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 54000000, "Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 1, "Incorrect value of power level");
//-----------------------------------------------------------------------------------------------------
@@ -492,16 +492,16 @@
* After one fail the rate is decreased or the power increased.
* After 16 failed transmissions power is increase to 17.
*/
- for(int i = 0; i<16; i++)
+ for (int i = 0; i < 16; i++)
{
- manager->ReportDataFailed(remoteAddress,&packetHeader);
+ manager->ReportDataFailed (remoteAddress,&packetHeader);
}
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 54000000, "APARF: Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 54000000, "APARF: Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 17, "APARF: Incorrect value of power level");
//-----------------------------------------------------------------------------------------------------
@@ -511,13 +511,13 @@
* As we are at maximal power, the rate should be decreased.
* Set critical rate to 54 Mbps.
*/
- manager->ReportDataFailed(remoteAddress,&packetHeader);
+ manager->ReportDataFailed (remoteAddress,&packetHeader);
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 48000000, "Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 48000000, "Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 17, "Incorrect value of power level");
//-----------------------------------------------------------------------------------------------------
@@ -526,16 +526,16 @@
* As we are in state High we need 3 successful transmissions to increase rate or decrease power.
* As rate critical is set, after 3 successful transmissions power is decreased.
*/
- for(int i = 0; i<3; i++)
+ for (int i = 0; i < 3; i++)
{
- manager->ReportDataOk(remoteAddress, &packetHeader, 0, ackMode, 0);
+ manager->ReportDataOk (remoteAddress, &packetHeader, 0, ackMode, 0);
}
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 48000000, "APARF: Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 48000000, "APARF: Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 16, "APARF: Incorrect value of power level");
//-----------------------------------------------------------------------------------------------------
@@ -546,28 +546,28 @@
* So after 10*3 successful transmissions critical rate is set to 0.
* And 3 successful transmissions more will make power increase to maximum and rate increase to the critical rate.
*/
- for(int i = 0; i<9*3; i++)
+ for (int i = 0; i < 9 * 3; i++)
{
- manager->ReportDataOk(remoteAddress, &packetHeader, 0, ackMode, 0);
+ manager->ReportDataOk (remoteAddress, &packetHeader, 0, ackMode, 0);
}
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 48000000, "APARF: Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 48000000, "APARF: Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 7, "APARF: Incorrect value of power level");
- for(int i = 0; i<3; i++)
+ for (int i = 0; i < 3; i++)
{
- manager->ReportDataOk(remoteAddress, &packetHeader, 0, ackMode, 0);
+ manager->ReportDataOk (remoteAddress, &packetHeader, 0, ackMode, 0);
}
- txVector = manager->GetDataTxVector(remoteAddress,&packetHeader,packet,packet->GetSize());
- mode = txVector.GetMode();
- power = (int) txVector.GetTxPowerLevel();
+ txVector = manager->GetDataTxVector (remoteAddress,&packetHeader,packet,packet->GetSize ());
+ mode = txVector.GetMode ();
+ power = (int) txVector.GetTxPowerLevel ();
- NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate(), 54000000, "APARF: Incorrect vale of data rate");
+ NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (), 54000000, "APARF: Incorrect vale of data rate");
NS_TEST_ASSERT_MSG_EQ (power, 17, "APARF: Incorrect value of power level");
Simulator::Stop (Seconds (10.0));
--- a/src/wifi/test/tx-duration-test.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/test/tx-duration-test.cc Sun Jun 21 00:23:45 2015 +0200
@@ -39,6 +39,7 @@
virtual ~TxDurationTest ();
virtual void DoRun (void);
+
private:
/**
* Check if the payload tx duration returned by InterferenceHelper
@@ -67,13 +68,11 @@
};
-
TxDurationTest::TxDurationTest ()
: TestCase ("Wifi TX Duration")
{
}
-
TxDurationTest::~TxDurationTest ()
{
}
@@ -85,12 +84,12 @@
txVector.SetMode (payloadMode);
double testedFrequency = CHANNEL_1_MHZ;
Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> ();
- if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_OFDM ||
- payloadMode.GetModulationClass () == WIFI_MOD_CLASS_HT)
+ if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_OFDM
+ || payloadMode.GetModulationClass () == WIFI_MOD_CLASS_HT)
{
testedFrequency = CHANNEL_36_MHZ;
}
- double calculatedDurationMicroSeconds = (double)phy->GetPayloadDuration (size, txVector, preamble, testedFrequency, 0, 0).GetMicroSeconds();;
+ double calculatedDurationMicroSeconds = (double)phy->GetPayloadDuration (size, txVector, preamble, testedFrequency, 0, 0).GetMicroSeconds ();
if (calculatedDurationMicroSeconds != knownDurationMicroSeconds)
{
std::cerr << " size=" << size
@@ -102,9 +101,9 @@
}
if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_HT)
{
- // Durations vary depending on frequency; test also 2.4 GHz (bug 1971)
+ //Durations vary depending on frequency; test also 2.4 GHz (bug 1971)
testedFrequency = CHANNEL_1_MHZ;
- calculatedDurationMicroSeconds = (double)phy->GetPayloadDuration (size, txVector, preamble, testedFrequency, 0, 0).GetMicroSeconds();;
+ calculatedDurationMicroSeconds = (double)phy->GetPayloadDuration (size, txVector, preamble, testedFrequency, 0, 0).GetMicroSeconds ();
if (calculatedDurationMicroSeconds != knownDurationMicroSeconds + 6)
{
std::cerr << " size=" << size
@@ -123,17 +122,17 @@
{
WifiTxVector txVector;
txVector.SetMode (payloadMode);
- txVector.SetNss(1);
- txVector.SetStbc(0);
- txVector.SetNess(0);
+ txVector.SetNss (1);
+ txVector.SetStbc (0);
+ txVector.SetNess (0);
double testedFrequency = CHANNEL_1_MHZ;
Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> ();
- if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_OFDM ||
- payloadMode.GetModulationClass () == WIFI_MOD_CLASS_HT)
+ if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_OFDM
+ || payloadMode.GetModulationClass () == WIFI_MOD_CLASS_HT)
{
testedFrequency = CHANNEL_36_MHZ;
}
- double calculatedDurationMicroSeconds = ((double)phy->CalculateTxDuration (size, txVector, preamble, testedFrequency, 0, 0).GetNanoSeconds ())/1000;
+ double calculatedDurationMicroSeconds = ((double)phy->CalculateTxDuration (size, txVector, preamble, testedFrequency, 0, 0).GetNanoSeconds ()) / 1000;
if (calculatedDurationMicroSeconds != knownDurationMicroSeconds)
{
std::cerr << " size=" << size
@@ -146,9 +145,9 @@
}
if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_HT)
{
- // Durations vary depending on frequency; test also 2.4 GHz (bug 1971)
+ //Durations vary depending on frequency; test also 2.4 GHz (bug 1971)
testedFrequency = CHANNEL_1_MHZ;
- calculatedDurationMicroSeconds = ((double)phy->CalculateTxDuration (size, txVector, preamble, testedFrequency, 0, 0).GetNanoSeconds ())/1000;
+ calculatedDurationMicroSeconds = ((double)phy->CalculateTxDuration (size, txVector, preamble, testedFrequency, 0, 0).GetNanoSeconds ()) / 1000;
if (calculatedDurationMicroSeconds != knownDurationMicroSeconds + 6)
{
std::cerr << " size=" << size
@@ -167,21 +166,21 @@
TxDurationTest::DoRun (void)
{
bool retval = true;
-
+
- // IEEE Std 802.11-2007 Table 18-2 "Example of LENGTH calculations for CCK"
+ //IEEE Std 802.11-2007 Table 18-2 "Example of LENGTH calculations for CCK"
retval = retval
&& CheckPayloadDuration (1023, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 744)
&& CheckPayloadDuration (1024, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 745)
&& CheckPayloadDuration (1025, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 746)
&& CheckPayloadDuration (1026, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 747);
- NS_TEST_EXPECT_MSG_EQ (retval, true, "an 802.11b CCK duration failed");
+ NS_TEST_EXPECT_MSG_EQ (retval, true, "an 802.11b CCK duration failed");
- // 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
+ //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
retval = retval
&& CheckTxDuration (1023, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_SHORT, 744 + 96)
&& CheckTxDuration (1024, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_SHORT, 745 + 96)
@@ -217,13 +216,13 @@
&& CheckTxDuration (1026, WifiPhy::GetDsssRate1Mbps (), WIFI_PREAMBLE_LONG, 8208 + 192);
- // values from http://mailman.isi.edu/pipermail/ns-developers/2009-July/006226.html
+ //values from http://mailman.isi.edu/pipermail/ns-developers/2009-July/006226.html
retval = retval && CheckTxDuration (14, WifiPhy::GetDsssRate1Mbps (), WIFI_PREAMBLE_LONG, 304);
- NS_TEST_EXPECT_MSG_EQ (retval, true, "an 802.11b duration failed");
+ NS_TEST_EXPECT_MSG_EQ (retval, true, "an 802.11b duration failed");
- // values from
- // http://www.oreillynet.com/pub/a/wireless/2003/08/08/wireless_throughput.html
+ //values from
+ //http://www.oreillynet.com/pub/a/wireless/2003/08/08/wireless_throughput.html
retval = retval
&& CheckTxDuration (1536, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 1310)
&& CheckTxDuration (76, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 248)
@@ -232,15 +231,15 @@
&& CheckTxDuration (76, WifiPhy::GetOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 32)
&& CheckTxDuration (14, WifiPhy::GetOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 24);
- NS_TEST_EXPECT_MSG_EQ (retval, true, "an 802.11a duration failed");
+ NS_TEST_EXPECT_MSG_EQ (retval, true, "an 802.11a duration failed");
- // 802.11g durations are same as 802.11a durations but with 6 us signal extension
+ //802.11g durations are same as 802.11a durations but with 6 us signal extension
retval = retval
&& CheckTxDuration (1536, WifiPhy::GetErpOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 254)
&& CheckTxDuration (76, WifiPhy::GetErpOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 38)
&& CheckTxDuration (14, WifiPhy::GetErpOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 30);
- NS_TEST_EXPECT_MSG_EQ (retval, true, "an 802.11g duration failed");
+ NS_TEST_EXPECT_MSG_EQ (retval, true, "an 802.11g duration failed");
//802.11n durations
retval = retval
@@ -275,9 +274,10 @@
&& CheckTxDuration (76,WifiPhy::GetOfdmRate150MbpsBW40MHz (), WIFI_PREAMBLE_HT_GF,35.2)
&& CheckTxDuration (14,WifiPhy::GetOfdmRate150MbpsBW40MHz (), WIFI_PREAMBLE_HT_GF,31.6);
- NS_TEST_EXPECT_MSG_EQ (retval, true, "an 802.11n duration failed");
+ NS_TEST_EXPECT_MSG_EQ (retval, true, "an 802.11n duration failed");
}
+
class TxDurationTestSuite : public TestSuite
{
public:
--- a/src/wifi/test/wifi-aggregation-test.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/test/wifi-aggregation-test.cc Sun Jun 21 00:23:45 2015 +0200
@@ -66,13 +66,13 @@
m_factory.SetTypeId ("ns3::ConstantRateWifiManager");
m_factory.Set ("DataMode", StringValue ("OfdmRate65MbpsBW20MHz"));
m_manager = m_factory.Create<WifiRemoteStationManager> ();
- m_manager->SetupPhy(m_phy);
+ m_manager->SetupPhy (m_phy);
/*
* Create and configure maclayer.
*/
m_low = CreateObject<MacLow> ();
- m_low->SetPhy(m_phy);
+ m_low->SetPhy (m_phy);
m_low->SetWifiRemoteStationManager (m_manager);
m_edca = CreateObject<EdcaTxopN> ();
@@ -86,16 +86,16 @@
*/
m_factory = ObjectFactory ();
m_factory.SetTypeId ("ns3::MsduStandardAggregator");
- m_factory.Set ("MaxAmsduSize", UintegerValue(4095));
+ m_factory.Set ("MaxAmsduSize", UintegerValue (4095));
m_msduAggregator = m_factory.Create<MsduAggregator> ();
m_edca->SetMsduAggregator (m_msduAggregator);
-
+
m_factory = ObjectFactory ();
m_factory.SetTypeId ("ns3::MpduStandardAggregator");
- m_factory.Set ("MaxAmpduSize", UintegerValue(65535));
+ m_factory.Set ("MaxAmpduSize", UintegerValue (65535));
m_mpduAggregator = m_factory.Create<MpduAggregator> ();
m_low->SetMpduAggregator (m_mpduAggregator);
-
+
/*
* Create dummy packets of 1500 bytes and fill mac header fields that will be used for the tests.
*/
@@ -109,33 +109,33 @@
Time tstamp;
//-----------------------------------------------------------------------------------------------------
-
+
/*
* Test MSDU aggregation of two packets using MacLow::PerformMsduAggregation.
- * It checks whether aggregation succeeded:
+ * It checks whether aggregation succeeded:
* - returned packet should be different from 0;
* - A-MSDU frame size should be 3030 bytes (= 2 packets + headers + padding);
* - one packet should be removed from the queue (the other packet is removed later in MacLow::AggregateToAmpdu) .
*/
- m_edca->GetEdcaQueue()->Enqueue(pkt, hdr);
- m_edca->GetEdcaQueue()->Enqueue(pkt, hdr);
-
- Ptr<const Packet> peekedPacket = m_edca->GetEdcaQueue()->PeekByTidAndAddress (&peekedHdr, 0,
- WifiMacHeader::ADDR1,
- hdr.GetAddr1 (),
- &tstamp);
+ m_edca->GetEdcaQueue ()->Enqueue (pkt, hdr);
+ m_edca->GetEdcaQueue ()->Enqueue (pkt, hdr);
+
+ Ptr<const Packet> peekedPacket = m_edca->GetEdcaQueue ()->PeekByTidAndAddress (&peekedHdr, 0,
+ WifiMacHeader::ADDR1,
+ hdr.GetAddr1 (),
+ &tstamp);
m_low->m_currentPacket = peekedPacket->Copy ();
m_low->m_currentHdr = peekedHdr;
-
- Ptr<Packet> packet = m_low->PerformMsduAggregation(peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, 0);
-
+
+ Ptr<Packet> packet = m_low->PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, 0);
+
bool result = (packet != 0);
NS_TEST_EXPECT_MSG_EQ (result, true, "aggregation failed");
- NS_TEST_EXPECT_MSG_EQ (packet->GetSize(), 3030, "wrong packet size");
- NS_TEST_EXPECT_MSG_EQ (m_edca->GetEdcaQueue()->GetSize(), 1, "removing packet from EDCA queue failed");
+ NS_TEST_EXPECT_MSG_EQ (packet->GetSize (), 3030, "wrong packet size");
+ NS_TEST_EXPECT_MSG_EQ (m_edca->GetEdcaQueue ()->GetSize (), 1, "removing packet from EDCA queue failed");
//-----------------------------------------------------------------------------------------------------
-
+
/*
* Aggregation is refused when the maximum size is reached.
* It checks whether MSDU aggregation has been rejected because the maximum MPDU size is set to 0 (returned packet should be equal to 0).
@@ -143,18 +143,18 @@
*/
m_factory = ObjectFactory ();
m_factory.SetTypeId ("ns3::MpduStandardAggregator");
- m_factory.Set ("MaxAmpduSize", UintegerValue(0));
+ m_factory.Set ("MaxAmpduSize", UintegerValue (0));
m_mpduAggregator = m_factory.Create<MpduAggregator> ();
m_low->SetMpduAggregator (m_mpduAggregator);
-
- m_edca->GetEdcaQueue()->Enqueue(pkt, hdr);
- packet = m_low->PerformMsduAggregation(peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, 0);
-
+
+ m_edca->GetEdcaQueue ()->Enqueue (pkt, hdr);
+ packet = m_low->PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, 0);
+
result = (packet != 0);
NS_TEST_EXPECT_MSG_EQ (result, false, "maximum aggregated frame size check failed");
//-----------------------------------------------------------------------------------------------------
-
+
/*
* Aggregation does not occur zhen there is no more packets in the queue.
* It checks whether MSDU aggregation has been rejected because there is no packets ready in the queue (returned packet should be equal to 0).
@@ -162,19 +162,20 @@
*/
m_factory = ObjectFactory ();
m_factory.SetTypeId ("ns3::MpduStandardAggregator");
- m_factory.Set ("MaxAmpduSize", UintegerValue(4095));
+ m_factory.Set ("MaxAmpduSize", UintegerValue (4095));
m_mpduAggregator = m_factory.Create<MpduAggregator> ();
m_low->SetMpduAggregator (m_mpduAggregator);
-
- m_edca->GetEdcaQueue()->Remove(pkt);
- m_edca->GetEdcaQueue()->Remove(pkt);
- packet = m_low->PerformMsduAggregation(peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, 0);
-
+
+ m_edca->GetEdcaQueue ()->Remove (pkt);
+ m_edca->GetEdcaQueue ()->Remove (pkt);
+ packet = m_low->PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, 0);
+
result = (packet != 0);
NS_TEST_EXPECT_MSG_EQ (result, false, "aggregation failed to stop as queue is empty");
Simulator::Destroy ();
}
+
//-----------------------------------------------------------------------------
class WifiAggregationTestSuite : public TestSuite
{
--- a/src/wifi/test/wifi-test.cc Tue Jun 16 13:13:06 2015 -0700
+++ b/src/wifi/test/wifi-test.cc Sun Jun 21 00:23:45 2015 +0200
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- * Quincy Tse <quincy.tse@nicta.com.au> (Case for Bug 991)
+ * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Quincy Tse <quincy.tse@nicta.com.au> (Case for Bug 991)
*/
#include "ns3/wifi-net-device.h"
@@ -44,8 +44,8 @@
using namespace ns3;
-// helper function to assign streams to random variables, to control
-// randomness in the tests
+//Helper function to assign streams to random variables, to control
+//randomness in the tests
static void
AssignWifiRandomStreams (Ptr<WifiMac> mac, int64_t stream)
{
@@ -76,12 +76,15 @@
}
}
+
class WifiTest : public TestCase
{
public:
WifiTest ();
virtual void DoRun (void);
+
+
private:
void RunOne (void);
void CreateOne (Vector pos, Ptr<YansWifiChannel> channel);
@@ -193,25 +196,26 @@
}
virtual void DoRun (void)
{
- // startingSeq=0, seqNum=2047
+ //startingSeq=0, seqNum=2047
NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (0, 2047), false, "2047 is new in comparison to 0");
- // startingSeq=0, seqNum=2048
+ //startingSeq=0, seqNum=2048
NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (0, 2048), true, "2048 is old in comparison to 0");
- // startingSeq=2048, seqNum=0
+ //startingSeq=2048, seqNum=0
NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (2048, 0), true, "0 is old in comparison to 2048");
- // startingSeq=4095, seqNum=0
+ //startingSeq=4095, seqNum=0
NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (4095, 0), false, "0 is new in comparison to 4095");
- // startingSeq=0, seqNum=4095
+ //startingSeq=0, seqNum=4095
NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (0, 4095), true, "4095 is old in comparison to 0");
- // startingSeq=4095 seqNum=2047
+ //startingSeq=4095 seqNum=2047
NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (4095, 2047), true, "2047 is old in comparison to 4095");
- // startingSeq=2048 seqNum=4095
+ //startingSeq=2048 seqNum=4095
NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (2048, 4095), false, "4095 is new in comparison to 2048");
- // startingSeq=2049 seqNum=0
+ //startingSeq=2049 seqNum=0
NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (2049, 0), false, "0 is new in comparison to 2049");
}
};
+
//-----------------------------------------------------------------------------
/**
* See \bugid{991}
@@ -222,6 +226,8 @@
InterferenceHelperSequenceTest ();
virtual void DoRun (void);
+
+
private:
Ptr<Node> CreateOne (Vector pos, Ptr<YansWifiChannel> channel);
void SendOnePacket (Ptr<WifiNetDevice> dev);
@@ -322,21 +328,22 @@
Simulator::Destroy ();
}
+
//-----------------------------------------------------------------------------
/**
* Make sure that when multiple broadcast packets are queued on the same
- * device in a short succession no virtual collision occurs
+ * device in a short succession no virtual collision occurs
*
* The observed behavior is that the first frame will be sent immediately,
* and the frames are spaced by (backoff + SIFS + AIFS) time intervals
* (where backoff is a random number of slot sizes up to maximum CW)
- *
+ *
* The following test case should _not_ generate virtual collision for the second frame.
* The seed and run numbers were pick such that the second frame gets backoff = 0.
*
* frame 1, frame 2
* arrive SIFS + AIFS
- * V <----------->
+ * V <----------->
* time |--------------|-------------------|-------------|----------->
* 0 1s 1.001408s 1.001442s
* ^ ^ ^
@@ -357,17 +364,16 @@
class Bug555TestCase : public TestCase
{
public:
-
Bug555TestCase ();
virtual void DoRun (void);
+
private:
-
void SendOnePacket (Ptr<WifiNetDevice> dev);
ObjectFactory m_manager;
- ObjectFactory m_mac;
+ ObjectFactory m_mac;
ObjectFactory m_propDelay;
Time m_firstTransmissionTime;
@@ -382,12 +388,12 @@
{
}
-void
+void
Bug555TestCase::NotifyPhyTxBegin (Ptr<const Packet> p)
{
if (m_numSentPackets == 0)
{
- NS_ASSERT_MSG (Simulator::Now() == Time (Seconds (1)), "Packet 0 not transmitted at 1 second");
+ NS_ASSERT_MSG (Simulator::Now () == Time (Seconds (1)), "Packet 0 not transmitted at 1 second");
m_numSentPackets++;
m_firstTransmissionTime = Simulator::Now ();
}
@@ -411,13 +417,13 @@
m_propDelay.SetTypeId ("ns3::ConstantSpeedPropagationDelayModel");
m_manager.SetTypeId ("ns3::ConstantRateWifiManager");
- // Assign a seed and run number, and later fix the assignment of streams to
- // WiFi random variables, so that the first backoff used is zero slots
+ //Assign a seed and run number, and later fix the assignment of streams to
+ //WiFi random variables, so that the first backoff used is zero slots
RngSeedManager::SetSeed (1);
RngSeedManager::SetRun (17);
- // Disable the initial jitter of AP beacons (test case was written before
- // beacon jitter was added)
+ //Disable the initial jitter of AP beacons (test case was written before
+ //beacon jitter was added)
Config::SetDefault ("ns3::ApWifiMac::EnableBeaconJitter", BooleanValue (false));
Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> ();
@@ -430,10 +436,10 @@
Ptr<WifiNetDevice> txDev = CreateObject<WifiNetDevice> ();
Ptr<WifiMac> txMac = m_mac.Create<WifiMac> ();
txMac->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
- // Fix the stream assignment to the Dcf Txop objects (backoffs)
- // The below stream assignment will result in the DcaTxop object
- // using a backoff value of zero for this test when the
- // DcaTxop::EndTxNoAck() calls to StartBackoffNow()
+ //Fix the stream assignment to the Dcf Txop objects (backoffs)
+ //The below stream assignment will result in the DcaTxop object
+ //using a backoff value of zero for this test when the
+ //DcaTxop::EndTxNoAck() calls to StartBackoffNow()
AssignWifiRandomStreams (txMac, 23);
Ptr<ConstantPositionMobilityModel> txMobility = CreateObject<ConstantPositionMobilityModel> ();
@@ -458,7 +464,7 @@
m_firstTransmissionTime = Seconds (0.0);
m_secondTransmissionTime = Seconds (0.0);
m_numSentPackets = 0;
-
+
Simulator::Schedule (Seconds (1.0), &Bug555TestCase::SendOnePacket, this, txDev);
Simulator::Schedule (Seconds (1.0), &Bug555TestCase::SendOnePacket, this, txDev);
@@ -466,16 +472,17 @@
Simulator::Run ();
Simulator::Destroy ();
- // First packet has 1408 us of transmit time. Slot time is 9 us.
- // Backoff is 0 slots. SIFS is 16 us. AIFS is 2 slots = 18 us.
- // Should send next packet at 1408 us + (0 * 9 us) + 16 us + 18 us
- // 1442 us after the first one.
+ //First packet has 1408 us of transmit time. Slot time is 9 us.
+ //Backoff is 0 slots. SIFS is 16 us. AIFS is 2 slots = 18 us.
+ //Should send next packet at 1408 us + (0 * 9 us) + 16 us + 18 us
+ //1442 us after the first one.
uint32_t expectedWait1 = 1408 + (0 * 9) + 16 + 18;
Time expectedSecondTransmissionTime = MicroSeconds (expectedWait1) + Seconds (1.0);
NS_TEST_ASSERT_MSG_EQ (m_secondTransmissionTime, expectedSecondTransmissionTime, "The second transmission time not correct!");
}
+
//-----------------------------------------------------------------------------
class WifiTestSuite : public TestSuite
{
@@ -488,8 +495,8 @@
{
AddTestCase (new WifiTest, TestCase::QUICK);
AddTestCase (new QosUtilsIsOldPacketTest, TestCase::QUICK);
- AddTestCase (new InterferenceHelperSequenceTest, TestCase::QUICK); // Bug 991
- AddTestCase (new Bug555TestCase, TestCase::QUICK); // Bug 555
+ AddTestCase (new InterferenceHelperSequenceTest, TestCase::QUICK); //Bug 991
+ AddTestCase (new Bug555TestCase, TestCase::QUICK); //Bug 555
}
static WifiTestSuite g_wifiTestSuite;