diff --git a/examples/mesh.cc b/examples/mesh.cc index 138d94104..c89ab9daf 100644 --- a/examples/mesh.cc +++ b/examples/mesh.cc @@ -41,15 +41,20 @@ main (int argc, char *argv[]) // Creating square topology with nNodes x nNodes grid int xSize = 6; int ySize = 6; - double step = 100.0; //Grid with one-hop edge - double randomStart = 0.1; //One beacon interval + double step = 100.0; // Grid with one-hop edge + double randomStart = 0.1; // One beacon interval + uint32_t nIfaces = 1; + bool pcap = false; - // Defining a size of our network + // Command line arguments CommandLine cmd; - cmd.AddValue ("x-size", "Number of nodes in a row grid", xSize); - cmd.AddValue ("y-size", "Number of rows in a grid", ySize); - cmd.AddValue ("step", "Size of edge in our grid", step); - cmd.AddValue ("start", "Random start parameter", randomStart); + cmd.AddValue ("x-size", "Number of nodes in a row grid. [6]", xSize); + cmd.AddValue ("y-size", "Number of rows in a grid. [6]", ySize); + 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 ("pcap", "Enable PCAP traces on interfaces. [0]", pcap); + cmd.Parse (argc, argv); NS_LOG_DEBUG ("Grid:" << xSize << "*" << ySize); @@ -64,7 +69,7 @@ main (int argc, char *argv[]) // Install mesh point devices & protocols MeshWifiHelper mesh; - NetDeviceContainer meshDevices = mesh.Install (wifiPhy, nodes); + NetDeviceContainer meshDevices = mesh.Install (wifiPhy, nodes, nIfaces); // Setup mobility MobilityHelper mobility; @@ -100,6 +105,10 @@ main (int argc, char *argv[]) clientApps.Start (Seconds (2.0)); clientApps.Stop (Seconds (10.0)); + // Enable PCAP trace + if (pcap) + wifiPhy.EnablePcapAll (std::string ("mp-") + mesh.GetSsid ().PeekString ()); + // Happy end Simulator::Stop (Seconds (10.0)); Simulator::Run (); diff --git a/src/devices/mesh/dot11s/dot11s-helper.cc b/src/devices/mesh/dot11s/dot11s-helper.cc index 73dcf99ca..bf2683c2f 100644 --- a/src/devices/mesh/dot11s/dot11s-helper.cc +++ b/src/devices/mesh/dot11s/dot11s-helper.cc @@ -33,21 +33,29 @@ namespace ns3 { namespace dot11s { -MeshWifiHelper::MeshWifiHelper () : m_ssid("Mesh"), m_randomStartDelay (Seconds (0)) +MeshWifiHelper::MeshWifiHelper () : m_ssid("mesh"), m_randomStartDelay (Seconds (0)) { } -void MeshWifiHelper::SetSsid (Ssid const & s) +void +MeshWifiHelper::SetSsid (Ssid const & s) { m_ssid = s; } -void MeshWifiHelper::SetRandomStartDelay (Time t) +Ssid MeshWifiHelper::GetSsid () const +{ + return m_ssid; +} + +void +MeshWifiHelper::SetRandomStartDelay (Time t) { m_randomStartDelay = t; } -Ptr MeshWifiHelper::CreateInterface (const WifiPhyHelper &phyHelper, Ptr node) const +Ptr +MeshWifiHelper::CreateInterface (const WifiPhyHelper &phyHelper, Ptr node) const { Ptr device = CreateObject (); diff --git a/src/devices/mesh/dot11s/dot11s-helper.h b/src/devices/mesh/dot11s/dot11s-helper.h index e28c42ecd..0066fe53e 100644 --- a/src/devices/mesh/dot11s/dot11s-helper.h +++ b/src/devices/mesh/dot11s/dot11s-helper.h @@ -45,6 +45,8 @@ public: MeshWifiHelper (); /// Set mesh SSID void SetSsid (const Ssid &); + /// Get mesh SSID + Ssid GetSsid () const; /// Set maximum random start delay void SetRandomStartDelay (Time delay); /**