--- a/examples/mesh.cc Thu Apr 02 14:33:38 2009 +0400
+++ b/examples/mesh.cc Thu Apr 02 17:26:20 2009 +0400
@@ -44,6 +44,7 @@
double step = 100.0; // Grid with one-hop edge
double randomStart = 0.1; // One beacon interval
uint32_t nIfaces = 1;
+ bool chan = false;
bool pcap = false;
// Command line arguments
@@ -53,6 +54,7 @@
cmd.AddValue ("step", "Size of edge in our grid, meters. [100 m]", step);
cmd.AddValue ("start", "Maximum random start delay, seconds. [0.1 s]", randomStart);
cmd.AddValue ("interfaces", "Number of radio interfaces used by each mesh point. [1]", nIfaces);
+ cmd.AddValue ("channels", "Use different frequency channels for different interfaces. [0]", chan);
cmd.AddValue ("pcap", "Enable PCAP traces on interfaces. [0]", pcap);
cmd.Parse (argc, argv);
@@ -69,6 +71,7 @@
// Install mesh point devices & protocols
MeshWifiHelper mesh;
+ mesh.SetSpreadInterfaceChannels (chan);
NetDeviceContainer meshDevices = mesh.Install (wifiPhy, nodes, nIfaces);
// Setup mobility
--- a/src/devices/mesh/dot11s/dot11s-helper.cc Thu Apr 02 14:33:38 2009 +0400
+++ b/src/devices/mesh/dot11s/dot11s-helper.cc Thu Apr 02 17:26:20 2009 +0400
@@ -33,7 +33,10 @@
namespace ns3 {
namespace dot11s {
-MeshWifiHelper::MeshWifiHelper () : m_ssid("mesh"), m_randomStartDelay (Seconds (0))
+MeshWifiHelper::MeshWifiHelper () :
+ m_ssid("mesh"),
+ m_randomStartDelay (Seconds (0)),
+ m_spreadInterfaceChannels (false)
{
}
@@ -54,6 +57,13 @@
m_randomStartDelay = t;
}
+void
+MeshWifiHelper::SetSpreadInterfaceChannels (bool s)
+{
+ m_spreadInterfaceChannels = s;
+}
+
+
Ptr<WifiNetDevice>
MeshWifiHelper::CreateInterface (const WifiPhyHelper &phyHelper, Ptr<Node> node) const
{
@@ -70,7 +80,10 @@
device->SetMac (mac);
device->SetPhy (phy);
device->SetRemoteStationManager (manager);
-
+ /*
+ if (channel > 0)
+ mac->SwitchFrequencyChannel (channel);
+ */
return device;
}
@@ -96,6 +109,23 @@
mp->AddInterface (iface);
}
+ // Set different channels on different ifaces
+ if (m_spreadInterfaceChannels)
+ {
+ std::vector<Ptr<NetDevice> > ifaces = mp->GetInterfaces ();
+ for (size_t i = 0; i < ifaces.size(); ++i)
+ {
+ uint32_t channel = i * 5;
+
+ Ptr<WifiNetDevice> iface = ifaces[i]->GetObject<WifiNetDevice> ();
+ NS_ASSERT (iface);
+ Ptr<MeshWifiInterfaceMac> mac = iface->GetMac ()->GetObject<MeshWifiInterfaceMac> ();
+ NS_ASSERT (mac);
+
+ mac->SwitchFrequencyChannel (channel);
+ }
+ }
+
// Install 802.11s protocols
Ptr<PeerManagementProtocol> pmp = CreateObject<PeerManagementProtocol> ();
bool pmp_ok = pmp->Install (mp);
--- a/src/devices/mesh/dot11s/dot11s-helper.h Thu Apr 02 14:33:38 2009 +0400
+++ b/src/devices/mesh/dot11s/dot11s-helper.h Thu Apr 02 17:26:20 2009 +0400
@@ -50,6 +50,14 @@
/// Set maximum random start delay
void SetRandomStartDelay (Time delay);
/**
+ * \brief Spread/not spread frequency channels of MP interfaces.
+ *
+ * If set to true different non-overlaping 20MHz frequency
+ * channels will be assigned to different mesh point interfaces.
+ */
+ void SetSpreadInterfaceChannels (bool);
+
+ /**
* \brief Install 802.11s mesh device & protocols on given node
*
* \param phy Wifi PHY helper
@@ -73,6 +81,7 @@
private:
Ssid m_ssid;
Time m_randomStartDelay;
+ bool m_spreadInterfaceChannels;
/// Create single mesh interface NIC
Ptr<WifiNetDevice> CreateInterface (const WifiPhyHelper &phyHelper, Ptr<Node> node) const;