Added root mesh point as argument of command line
This commit is contained in:
@@ -59,6 +59,7 @@ class MeshTest
|
||||
bool pcap;
|
||||
uint64_t seed;
|
||||
std::string stack;
|
||||
std::string root;
|
||||
/// List of network nodes
|
||||
NodeContainer nodes;
|
||||
/// List of all mesh point devices
|
||||
@@ -89,7 +90,8 @@ MeshTest::MeshTest () :
|
||||
chan (true),
|
||||
pcap (false),
|
||||
seed (1),
|
||||
stack ("ns3::Dot11sStack")
|
||||
stack ("ns3::Dot11sStack"),
|
||||
root ("ff:ff:ff:ff:ff:ff")
|
||||
{
|
||||
}
|
||||
void
|
||||
@@ -108,6 +110,7 @@ MeshTest::Configure (int argc, char *argv[])
|
||||
cmd.AddValue ("pcap", "Enable PCAP traces on interfaces. [0]", pcap);
|
||||
cmd.AddValue ("seed", "Seed value", seed);
|
||||
cmd.AddValue ("stack", "Type of protocol stack. ns3::Dot11sStack by default", stack);
|
||||
cmd.AddValue ("root", "Mac address of root mesh point", root);
|
||||
|
||||
cmd.Parse (argc, argv);
|
||||
NS_LOG_DEBUG ("Grid:" << xSize << "*" << ySize);
|
||||
@@ -123,7 +126,7 @@ MeshTest::CreateNodes ()
|
||||
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
|
||||
wifiPhy.SetChannel (wifiChannel.Create ());
|
||||
// Install mesh point devices & protocols
|
||||
mesh.SetStackInstaller (stack);
|
||||
mesh.SetStackInstaller (stack, "Root", Mac48AddressValue (Mac48Address (root.c_str ())));
|
||||
mesh.SetSpreadInterfaceChannels (chan);
|
||||
MeshInterfaceHelper interface = MeshInterfaceHelper::Default ();
|
||||
interface.SetType ("RandomStart", TimeValue (Seconds(randomStart)));
|
||||
|
||||
@@ -30,10 +30,16 @@ Dot11sStack::GetTypeId ()
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::Dot11sStack")
|
||||
.SetParent<Object> ()
|
||||
.AddConstructor<Dot11sStack> ();
|
||||
.AddConstructor<Dot11sStack> ()
|
||||
.AddAttribute ("Root",
|
||||
"The MAC address of root mesh point.",
|
||||
Mac48AddressValue (Mac48Address ("ff:ff:ff:ff:ff:ff")),
|
||||
MakeMac48AddressAccessor (&Dot11sStack::m_root),
|
||||
MakeMac48AddressChecker ());
|
||||
return tid;
|
||||
}
|
||||
Dot11sStack::Dot11sStack ()
|
||||
Dot11sStack::Dot11sStack () :
|
||||
m_root (Mac48Address ("ff:ff:ff:ff:ff:ff"))
|
||||
{
|
||||
}
|
||||
Dot11sStack::~Dot11sStack ()
|
||||
@@ -43,13 +49,6 @@ void
|
||||
Dot11sStack::DoDispose ()
|
||||
{
|
||||
}
|
||||
void
|
||||
Dot11sStack::SetRoot (Ptr<MeshPointDevice> mp)
|
||||
{
|
||||
Ptr<HwmpProtocol> hwmp = mp->GetObject<HwmpProtocol> ();
|
||||
NS_ASSERT (hwmp != 0);
|
||||
hwmp->SetRoot ();
|
||||
}
|
||||
bool
|
||||
Dot11sStack::InstallStack (Ptr<MeshPointDevice> mp)
|
||||
{
|
||||
@@ -68,6 +67,11 @@ Dot11sStack::InstallStack (Ptr<MeshPointDevice> mp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
NS_LOG_UNCOND(m_root);
|
||||
if (mp->GetAddress() == m_root)
|
||||
{
|
||||
hwmp->SetRoot ();
|
||||
}
|
||||
//Install interaction between HWMP and Peer management protocol:
|
||||
pmp->SetPeerLinkStatusCallback (MakeCallback (&HwmpProtocol::PeerLinkStatus, hwmp));
|
||||
hwmp->SetNeighboursCallback (MakeCallback (&PeerManagementProtocol::GetActiveLinks, pmp));
|
||||
|
||||
@@ -33,9 +33,10 @@ class Dot11sStack : public MeshStack
|
||||
|
||||
///\brief Installs 802.11s stack. needed by helper only
|
||||
bool InstallStack (Ptr<MeshPointDevice> mp);
|
||||
void SetRoot (Ptr<MeshPointDevice> mp);
|
||||
void Report (const Ptr<MeshPointDevice> mp, std::ostream&);
|
||||
void ResetStats (const Ptr<MeshPointDevice> mp);
|
||||
private:
|
||||
Mac48Address m_root;
|
||||
};
|
||||
} //namespace ns3
|
||||
#endif
|
||||
|
||||
@@ -36,10 +36,27 @@ MeshHelper::SetSpreadInterfaceChannels (bool s)
|
||||
m_spreadInterfaceChannels = s;
|
||||
}
|
||||
void
|
||||
MeshHelper::SetStackInstaller (std::string type)
|
||||
MeshHelper::SetStackInstaller (std::string type,
|
||||
std::string n0, const AttributeValue &v0,
|
||||
std::string n1, const AttributeValue &v1,
|
||||
std::string n2, const AttributeValue &v2,
|
||||
std::string n3, const AttributeValue &v3,
|
||||
std::string n4, const AttributeValue &v4,
|
||||
std::string n5, const AttributeValue &v5,
|
||||
std::string n6, const AttributeValue &v6,
|
||||
std::string n7, const AttributeValue &v7)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << type);
|
||||
m_stackFactory.SetTypeId (type);
|
||||
m_stackFactory.Set (n0, v0);
|
||||
m_stackFactory.Set (n1, v1);
|
||||
m_stackFactory.Set (n2, v2);
|
||||
m_stackFactory.Set (n3, v3);
|
||||
m_stackFactory.Set (n4, v4);
|
||||
m_stackFactory.Set (n5, v5);
|
||||
m_stackFactory.Set (n6, v6);
|
||||
m_stackFactory.Set (n7, v7);
|
||||
|
||||
m_stack = m_stackFactory.Create<MeshStack> ();
|
||||
if (m_stack == 0)
|
||||
{
|
||||
|
||||
@@ -77,7 +77,15 @@ public:
|
||||
* All the attributes specified in this method should exist
|
||||
* in the requested station manager.
|
||||
*/
|
||||
void SetStackInstaller (std::string type);
|
||||
void SetStackInstaller (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 ());
|
||||
void Report (const ns3::Ptr<ns3::NetDevice>&, std::ostream&);
|
||||
void ResetStats (const ns3::Ptr<ns3::NetDevice>&);
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user