Restructured mesh - helper
This commit is contained in:
@@ -124,8 +124,8 @@ MeshTest::CreateNodes ()
|
||||
MeshWifiHelper mesh;
|
||||
mesh.SetSpreadInterfaceChannels (chan);
|
||||
std::vector<uint32_t> roots;
|
||||
roots.push_back(xSize-1);
|
||||
roots.push_back(xSize*ySize-xSize);
|
||||
//roots.push_back(xSize-1);
|
||||
//roots.push_back(xSize*ySize-xSize);
|
||||
MeshInterfaceHelper interface = MeshInterfaceHelper::Default ();
|
||||
interface.SetType ("RandomStart", TimeValue (Seconds(randomStart)));
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* Pavel Boyko <boyko@iitp.ru>
|
||||
*/
|
||||
#include "dot11s-helper.h"
|
||||
#include "ns3/dot11s-installator.h"
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/mesh-point-device.h"
|
||||
#include "ns3/wifi-net-device.h"
|
||||
@@ -38,7 +39,6 @@ NetDeviceContainer
|
||||
MeshWifiHelper::Install (const WifiPhyHelper &phyHelper, const MeshInterfaceHelper &interfaceHelper, NodeContainer c, std::vector<uint32_t> roots, uint32_t nInterfaces) const
|
||||
{
|
||||
NetDeviceContainer devices;
|
||||
uint32_t node_index = 0;
|
||||
for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
|
||||
{
|
||||
Ptr<Node> node = *i;
|
||||
@@ -54,25 +54,11 @@ MeshWifiHelper::Install (const WifiPhyHelper &phyHelper, const MeshInterfaceHelp
|
||||
Ptr<WifiNetDevice> iface = interfaceHelper.CreateInterface (phyHelper,node, (m_spreadInterfaceChannels ? channel : 0));
|
||||
mp->AddInterface (iface);
|
||||
}
|
||||
// Install 802.11s protocols
|
||||
Ptr<PeerManagementProtocol> pmp = CreateObject<PeerManagementProtocol> ();
|
||||
pmp->SetMeshId("mesh");
|
||||
bool install_ok = pmp->Install (mp);
|
||||
NS_ASSERT (install_ok);
|
||||
|
||||
Ptr<HwmpProtocol> hwmp = CreateObject<HwmpProtocol> ();
|
||||
install_ok = hwmp->Install (mp);
|
||||
NS_ASSERT (install_ok);
|
||||
|
||||
pmp->SetPeerLinkStatusCallback(MakeCallback(&HwmpProtocol::PeerLinkStatus, hwmp));
|
||||
hwmp->SetNeighboursCallback(MakeCallback(&PeerManagementProtocol::GetActiveLinks, pmp));
|
||||
// Setting root mesh point
|
||||
for(std::vector<uint32_t>::const_iterator root_iterator = roots.begin (); root_iterator != roots.end (); root_iterator ++)
|
||||
//if(*root_iterator == i.GetDistanceFrom(c.Begin ()))
|
||||
if(*root_iterator == node_index)
|
||||
hwmp->SetRoot ();
|
||||
if(!Dot11sStackInstallator::InstallDot11sStack (mp, false))
|
||||
{
|
||||
NS_ASSERT(false);
|
||||
}
|
||||
devices.Add (mp);
|
||||
node_index ++;
|
||||
}
|
||||
return devices;
|
||||
}
|
||||
@@ -89,40 +75,13 @@ MeshWifiHelper::Report (const ns3::Ptr<ns3::NetDevice>& device, std::ostream& os
|
||||
NS_ASSERT (mp != 0);
|
||||
std::vector<Ptr<NetDevice> > ifaces = mp->GetInterfaces ();
|
||||
os << "<MeshPointDevice ReportTime=\"" << Simulator::Now().GetSeconds() << "s\" MpAddress=\"" << mp->GetAddress () << "\">\n";
|
||||
for (std::vector<Ptr<NetDevice> >::const_iterator i = ifaces.begin(); i != ifaces.end(); ++i)
|
||||
{
|
||||
Ptr<WifiNetDevice> device = (*i)->GetObject<WifiNetDevice> ();
|
||||
NS_ASSERT (device != 0);
|
||||
MeshInterfaceHelper::Report(device, os);
|
||||
}
|
||||
Ptr <HwmpProtocol> hwmp = mp->GetObject<HwmpProtocol> ();
|
||||
NS_ASSERT(hwmp != 0);
|
||||
hwmp->Report (os);
|
||||
|
||||
Ptr <PeerManagementProtocol> pmp = mp->GetObject<PeerManagementProtocol> ();
|
||||
NS_ASSERT(pmp != 0);
|
||||
pmp->Report (os);
|
||||
Dot11sStackInstallator::Report (device, os);
|
||||
os << "</MeshPointDevice>\n";
|
||||
}
|
||||
void
|
||||
MeshWifiHelper::ResetStats (const ns3::Ptr<ns3::NetDevice>& device)
|
||||
{
|
||||
Ptr <MeshPointDevice> mp = device->GetObject<MeshPointDevice> ();
|
||||
NS_ASSERT (mp != 0);
|
||||
std::vector<Ptr<NetDevice> > ifaces = mp->GetInterfaces ();
|
||||
for (std::vector<Ptr<NetDevice> >::const_iterator i = ifaces.begin(); i != ifaces.end(); ++i)
|
||||
{
|
||||
Ptr<WifiNetDevice> device = (*i)->GetObject<WifiNetDevice> ();
|
||||
NS_ASSERT (device != 0);
|
||||
MeshInterfaceHelper::ResetStats (device);
|
||||
}
|
||||
Ptr <HwmpProtocol> hwmp = mp->GetObject<HwmpProtocol> ();
|
||||
NS_ASSERT(hwmp != 0);
|
||||
hwmp->ResetStats ();
|
||||
|
||||
Ptr <PeerManagementProtocol> pmp = mp->GetObject<PeerManagementProtocol> ();
|
||||
NS_ASSERT(pmp != 0);
|
||||
pmp->ResetStats ();
|
||||
Dot11sStackInstallator::ResetStats (device);
|
||||
}
|
||||
} // namespace dot11s
|
||||
} //namespace ns3
|
||||
|
||||
@@ -25,10 +25,7 @@
|
||||
|
||||
#include "ns3/wifi-helper.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/peer-management-protocol.h"
|
||||
#include "ns3/hwmp-protocol.h"
|
||||
#include "ie-dot11s-id.h"
|
||||
#include "ns3/dot11s-interface-helper.h"
|
||||
#include "ns3/mesh-interface-helper.h"
|
||||
|
||||
namespace ns3 {
|
||||
namespace dot11s {
|
||||
|
||||
@@ -23,19 +23,12 @@ def build(bld):
|
||||
'hwmp-mac-plugin.cc',
|
||||
'hwmp-protocol.cc',
|
||||
'airtime-metric.cc',
|
||||
'dot11s-interface-helper.cc',
|
||||
'dot11s-helper.cc',
|
||||
'dot11s-installator.cc',
|
||||
]
|
||||
headers = bld.new_task_gen('ns3header')
|
||||
headers.module = 'dot11s'
|
||||
headers.source = [
|
||||
'peer-management-protocol.h',
|
||||
'ie-dot11s-beacon-timing.h',
|
||||
'ie-dot11s-id.h',
|
||||
'ie-dot11s-peer-management.h',
|
||||
'ie-dot11s-perr.h',
|
||||
'hwmp-protocol.h',
|
||||
'dot11s-helper.h',
|
||||
'dot11s-interface-helper.h',
|
||||
'dot11s-mac-header.h',
|
||||
'dot11s-installator.h',
|
||||
]
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "dot11s-interface-helper.h"
|
||||
#include "mesh-interface-helper.h"
|
||||
#include "ns3/wifi-mac.h"
|
||||
#include "ns3/pointer.h"
|
||||
#include "ns3/dca-txop.h"
|
||||
@@ -25,6 +25,7 @@ def build(bld):
|
||||
'v4ping-helper.cc',
|
||||
'nqos-wifi-mac-helper.cc',
|
||||
'qos-wifi-mac-helper.cc',
|
||||
'mesh-interface-helper.cc',
|
||||
]
|
||||
|
||||
headers = bld.new_task_gen('ns3header')
|
||||
@@ -52,6 +53,7 @@ def build(bld):
|
||||
'v4ping-helper.h',
|
||||
'nqos-wifi-mac-helper.h',
|
||||
'qos-wifi-mac-helper.h',
|
||||
'mesh-interface-helper.h',
|
||||
]
|
||||
|
||||
env = bld.env_of_name('default')
|
||||
|
||||
Reference in New Issue
Block a user