Added interface helper
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "ns3/mesh-module.h"
|
||||
#include "ns3/mobility-module.h"
|
||||
#include "ns3/dot11s-helper.h"
|
||||
#include "ns3/dot11s-interface-helper.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@@ -123,9 +124,12 @@ MeshTest::CreateNodes ()
|
||||
MeshWifiHelper mesh;
|
||||
mesh.SetSpreadInterfaceChannels (chan);
|
||||
std::vector<uint32_t> roots;
|
||||
//roots.push_back(xSize-1);
|
||||
//roots.push_back(xSize*ySize-xSize);
|
||||
meshDevices = mesh.Install (wifiPhy, nodes, roots, nIfaces);
|
||||
roots.push_back(xSize-1);
|
||||
roots.push_back(xSize*ySize-xSize);
|
||||
MeshInterfaceHelper interface = MeshInterfaceHelper::Default ();
|
||||
interface.SetType ("RandomStart", TimeValue (Seconds(randomStart)));
|
||||
|
||||
meshDevices = mesh.Install (wifiPhy, interface, nodes, roots, nIfaces);
|
||||
// Setup mobility
|
||||
MobilityHelper mobility;
|
||||
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
|
||||
|
||||
@@ -18,66 +18,24 @@
|
||||
* Author: Kirill Andreev <andreev@iitp.ru>
|
||||
* Pavel Boyko <boyko@iitp.ru>
|
||||
*/
|
||||
|
||||
|
||||
#include "dot11s-helper.h"
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/mesh-point-device.h"
|
||||
#include "ns3/wifi-net-device.h"
|
||||
#include "ns3/wifi-phy.h"
|
||||
#include "ns3/wifi-channel.h"
|
||||
#include "ns3/wifi-remote-station-manager.h"
|
||||
#include "ns3/mesh-wifi-interface-mac.h"
|
||||
#include "ns3/aarf-wifi-manager.h"
|
||||
#include "airtime-metric.h"
|
||||
namespace ns3 {
|
||||
namespace dot11s {
|
||||
|
||||
MeshWifiHelper::MeshWifiHelper () :
|
||||
m_randomStartDelay (Seconds (0)),
|
||||
m_spreadInterfaceChannels (false)
|
||||
{
|
||||
}
|
||||
void
|
||||
MeshWifiHelper::SetRandomStartDelay (Time t)
|
||||
{
|
||||
m_randomStartDelay = t;
|
||||
}
|
||||
|
||||
void
|
||||
MeshWifiHelper::SetSpreadInterfaceChannels (bool s)
|
||||
{
|
||||
m_spreadInterfaceChannels = s;
|
||||
}
|
||||
|
||||
|
||||
Ptr<WifiNetDevice>
|
||||
MeshWifiHelper::CreateInterface (const WifiPhyHelper &phyHelper, Ptr<Node> node) const
|
||||
{
|
||||
Ptr<WifiNetDevice> device = CreateObject<WifiNetDevice> ();
|
||||
|
||||
// Creating MAC for this interface
|
||||
Ptr<MeshWifiInterfaceMac> mac = CreateObject<MeshWifiInterfaceMac> ();
|
||||
mac->SetSsid (Ssid ());
|
||||
if (m_randomStartDelay > Seconds (0))
|
||||
mac->SetRandomStartDelay (m_randomStartDelay);
|
||||
Ptr<WifiRemoteStationManager> manager = CreateObject<AarfWifiManager> ();
|
||||
Ptr<WifiPhy> phy = phyHelper.Create (node, device);
|
||||
mac->SetAddress (Mac48Address::Allocate ());
|
||||
device->SetMac (mac);
|
||||
device->SetPhy (phy);
|
||||
device->SetRemoteStationManager (manager);
|
||||
Ptr<AirtimeLinkMetricCalculator> metric = CreateObject <AirtimeLinkMetricCalculator> ();
|
||||
mac->SetLinkMetricCallback (MakeCallback(&AirtimeLinkMetricCalculator::CalculateMetric, metric));
|
||||
/*
|
||||
if (channel > 0)
|
||||
mac->SwitchFrequencyChannel (channel);
|
||||
*/
|
||||
return device;
|
||||
}
|
||||
|
||||
NetDeviceContainer
|
||||
MeshWifiHelper::Install (const WifiPhyHelper &phyHelper, NodeContainer c, std::vector<uint32_t> roots, uint32_t nInterfaces) const
|
||||
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;
|
||||
@@ -92,29 +50,10 @@ MeshWifiHelper::Install (const WifiPhyHelper &phyHelper, NodeContainer c, std::
|
||||
// Create wifi interfaces (single interface by default)
|
||||
for (uint32_t i = 0; i < nInterfaces; ++i)
|
||||
{
|
||||
Ptr<WifiNetDevice> iface = CreateInterface (phyHelper, node);
|
||||
|
||||
node->AddDevice (iface);
|
||||
uint32_t channel = i * 5;
|
||||
Ptr<WifiNetDevice> iface = interfaceHelper.CreateInterface (phyHelper,node, (m_spreadInterfaceChannels ? channel : 0));
|
||||
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> ();
|
||||
pmp->SetMeshId("mesh");
|
||||
@@ -139,9 +78,9 @@ MeshWifiHelper::Install (const WifiPhyHelper &phyHelper, NodeContainer c, std::
|
||||
}
|
||||
|
||||
NetDeviceContainer
|
||||
MeshWifiHelper::Install (const WifiPhyHelper &phy, Ptr<Node> node, std::vector<uint32_t> roots, uint32_t nInterfaces) const
|
||||
MeshWifiHelper::Install (const WifiPhyHelper &phy, const MeshInterfaceHelper &interfaceHelper, Ptr<Node> node, std::vector<uint32_t> roots, uint32_t nInterfaces) const
|
||||
{
|
||||
return Install (phy, NodeContainer (node), roots, nInterfaces);
|
||||
return Install (phy, interfaceHelper, NodeContainer (node), roots, nInterfaces);
|
||||
}
|
||||
void
|
||||
MeshWifiHelper::Report (const ns3::Ptr<ns3::NetDevice>& device, std::ostream& os)
|
||||
@@ -154,9 +93,7 @@ MeshWifiHelper::Report (const ns3::Ptr<ns3::NetDevice>& device, std::ostream& os
|
||||
{
|
||||
Ptr<WifiNetDevice> device = (*i)->GetObject<WifiNetDevice> ();
|
||||
NS_ASSERT (device != 0);
|
||||
Ptr<MeshWifiInterfaceMac> mac = device->GetMac()->GetObject<MeshWifiInterfaceMac> ();
|
||||
NS_ASSERT (mac != 0);
|
||||
mac->Report(os);
|
||||
MeshInterfaceHelper::Report(device, os);
|
||||
}
|
||||
Ptr <HwmpProtocol> hwmp = mp->GetObject<HwmpProtocol> ();
|
||||
NS_ASSERT(hwmp != 0);
|
||||
@@ -177,9 +114,7 @@ MeshWifiHelper::ResetStats (const ns3::Ptr<ns3::NetDevice>& device)
|
||||
{
|
||||
Ptr<WifiNetDevice> device = (*i)->GetObject<WifiNetDevice> ();
|
||||
NS_ASSERT (device != 0);
|
||||
Ptr<MeshWifiInterfaceMac> mac = device->GetMac()->GetObject<MeshWifiInterfaceMac> ();
|
||||
NS_ASSERT (mac != 0);
|
||||
mac->ResetStats ();
|
||||
MeshInterfaceHelper::ResetStats (device);
|
||||
}
|
||||
Ptr <HwmpProtocol> hwmp = mp->GetObject<HwmpProtocol> ();
|
||||
NS_ASSERT(hwmp != 0);
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "ns3/peer-management-protocol.h"
|
||||
#include "ns3/hwmp-protocol.h"
|
||||
#include "ie-dot11s-id.h"
|
||||
#include "ns3/dot11s-interface-helper.h"
|
||||
|
||||
namespace ns3 {
|
||||
namespace dot11s {
|
||||
@@ -43,8 +44,6 @@ class MeshWifiHelper
|
||||
{
|
||||
public:
|
||||
MeshWifiHelper ();
|
||||
/// Set maximum random start delay
|
||||
void SetRandomStartDelay (Time delay);
|
||||
/**
|
||||
* \brief Spread/not spread frequency channels of MP interfaces.
|
||||
*
|
||||
@@ -63,7 +62,7 @@ public:
|
||||
*
|
||||
* \return list of created mesh point devices, see MeshPointDevice
|
||||
*/
|
||||
NetDeviceContainer Install (const WifiPhyHelper &phyHelper, NodeContainer c, std::vector<uint32_t> roots = std::vector<uint32_t> (), uint32_t nInterfaces = 1) const;
|
||||
NetDeviceContainer Install (const WifiPhyHelper &phyHelper, const MeshInterfaceHelper &interfaceHelper, NodeContainer c, std::vector<uint32_t> roots = std::vector<uint32_t> (), uint32_t nInterfaces = 1) const;
|
||||
/**
|
||||
* \brief Install 802.11s mesh device & protocols on given node
|
||||
*
|
||||
@@ -74,16 +73,11 @@ public:
|
||||
*
|
||||
* \return list of created mesh point devices, see MeshPointDevice
|
||||
*/
|
||||
NetDeviceContainer Install (const WifiPhyHelper &phy, Ptr<Node> node, std::vector<uint32_t> roots = std::vector<uint32_t> (), uint32_t nInterfaces = 1) const;
|
||||
NetDeviceContainer Install (const WifiPhyHelper &phy, const MeshInterfaceHelper &interfaceHelper, Ptr<Node> node, std::vector<uint32_t> roots = std::vector<uint32_t> (), uint32_t nInterfaces = 1) const;
|
||||
static void Report (const ns3::Ptr<ns3::NetDevice>&, std::ostream&);
|
||||
static void ResetStats (const ns3::Ptr<ns3::NetDevice>&);
|
||||
private:
|
||||
Time m_randomStartDelay;
|
||||
bool m_spreadInterfaceChannels;
|
||||
|
||||
/// Create single mesh interface NIC
|
||||
Ptr<WifiNetDevice> CreateInterface (const WifiPhyHelper &phyHelper, Ptr<Node> node) const;
|
||||
|
||||
};
|
||||
} // namespace dot11s
|
||||
} //namespace ns3
|
||||
|
||||
162
src/devices/mesh/dot11s/dot11s-interface-helper.cc
Normal file
162
src/devices/mesh/dot11s/dot11s-interface-helper.cc
Normal file
@@ -0,0 +1,162 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2008,2009 IITP RAS
|
||||
*
|
||||
* 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
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Kirill Andreev <andreev@iitp.ru>
|
||||
*/
|
||||
|
||||
|
||||
#include "dot11s-interface-helper.h"
|
||||
#include "ns3/wifi-mac.h"
|
||||
#include "ns3/pointer.h"
|
||||
#include "ns3/dca-txop.h"
|
||||
#include "ns3/wifi-remote-station-manager.h"
|
||||
namespace ns3 {
|
||||
|
||||
MeshInterfaceHelper::MeshInterfaceHelper ()
|
||||
{
|
||||
m_Be.SetTypeId ("ns3::DcaTxop");
|
||||
m_Vo.SetTypeId ("ns3::DcaTxop");
|
||||
}
|
||||
|
||||
MeshInterfaceHelper::~MeshInterfaceHelper ()
|
||||
{}
|
||||
|
||||
MeshInterfaceHelper
|
||||
MeshInterfaceHelper::Default (void)
|
||||
{
|
||||
MeshInterfaceHelper helper;
|
||||
helper.SetType ();
|
||||
helper.SetBeParameters (
|
||||
"MinCw", UintegerValue (15),
|
||||
"MaxCw", UintegerValue (255),
|
||||
"Aifsn", UintegerValue (2));
|
||||
helper.SetVoParameters (
|
||||
"MinCw", UintegerValue (3),
|
||||
"MaxCw", UintegerValue (7),
|
||||
"Aifsn", UintegerValue (2));
|
||||
helper.SetRemoteStationManager ("ns3::ArfWifiManager");
|
||||
return helper;
|
||||
}
|
||||
|
||||
void
|
||||
MeshInterfaceHelper::SetType (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)
|
||||
{
|
||||
m_mac.SetTypeId ("ns3::MeshWifiInterfaceMac");
|
||||
m_mac.Set (n0, v0);
|
||||
m_mac.Set (n1, v1);
|
||||
m_mac.Set (n2, v2);
|
||||
m_mac.Set (n3, v3);
|
||||
m_mac.Set (n4, v4);
|
||||
m_mac.Set (n5, v5);
|
||||
m_mac.Set (n6, v6);
|
||||
m_mac.Set (n7, v7);
|
||||
}
|
||||
void
|
||||
MeshInterfaceHelper::SetBeParameters (std::string n0, const AttributeValue &v0,
|
||||
std::string n1, const AttributeValue &v1,
|
||||
std::string n2, const AttributeValue &v2,
|
||||
std::string n3, const AttributeValue &v3)
|
||||
{
|
||||
m_Be.Set (n0, v0);
|
||||
m_Be.Set (n1, v1);
|
||||
m_Be.Set (n2, v2);
|
||||
m_Be.Set (n3, v3);
|
||||
}
|
||||
void
|
||||
MeshInterfaceHelper::SetVoParameters (std::string n0, const AttributeValue &v0,
|
||||
std::string n1, const AttributeValue &v1,
|
||||
std::string n2, const AttributeValue &v2,
|
||||
std::string n3, const AttributeValue &v3)
|
||||
{
|
||||
m_Vo.Set (n0, v0);
|
||||
m_Vo.Set (n1, v1);
|
||||
m_Vo.Set (n2, v2);
|
||||
m_Vo.Set (n3, v3);
|
||||
}
|
||||
void
|
||||
MeshInterfaceHelper::SetRemoteStationManager (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)
|
||||
{
|
||||
m_stationManager = ObjectFactory ();
|
||||
m_stationManager.SetTypeId (type);
|
||||
m_stationManager.Set (n0, v0);
|
||||
m_stationManager.Set (n1, v1);
|
||||
m_stationManager.Set (n2, v2);
|
||||
m_stationManager.Set (n3, v3);
|
||||
m_stationManager.Set (n4, v4);
|
||||
m_stationManager.Set (n5, v5);
|
||||
m_stationManager.Set (n6, v6);
|
||||
m_stationManager.Set (n7, v7);
|
||||
}
|
||||
Ptr<WifiNetDevice>
|
||||
MeshInterfaceHelper::CreateInterface (const WifiPhyHelper &phyHelper, Ptr<Node> node, uint16_t channelId) const
|
||||
{
|
||||
Ptr<WifiNetDevice> device = CreateObject<WifiNetDevice> ();
|
||||
|
||||
Ptr<MeshWifiInterfaceMac> mac = Create ();
|
||||
mac->SetSsid (Ssid ());
|
||||
Ptr<WifiRemoteStationManager> manager = m_stationManager.Create<WifiRemoteStationManager> ();
|
||||
Ptr<WifiPhy> phy = phyHelper.Create (node, device);
|
||||
mac->SetAddress (Mac48Address::Allocate ());
|
||||
device->SetMac (mac);
|
||||
device->SetPhy (phy);
|
||||
device->SetRemoteStationManager (manager);
|
||||
node->AddDevice (device);
|
||||
mac->SwitchFrequencyChannel (channelId);
|
||||
return device;
|
||||
}
|
||||
Ptr<MeshWifiInterfaceMac>
|
||||
MeshInterfaceHelper::Create (void) const
|
||||
{
|
||||
Ptr<MeshWifiInterfaceMac> mac = m_mac.Create<MeshWifiInterfaceMac> ();
|
||||
Ptr<DcaTxop> be = m_Be.Create<DcaTxop> ();
|
||||
Ptr<DcaTxop> vo = m_Vo.Create<DcaTxop> ();
|
||||
mac->SetAttribute ("BE", PointerValue (be));
|
||||
mac->SetAttribute ("VO", PointerValue (vo));
|
||||
return mac;
|
||||
}
|
||||
void
|
||||
MeshInterfaceHelper::Report (const Ptr<WifiNetDevice>& device, std::ostream& os)
|
||||
{
|
||||
Ptr<MeshWifiInterfaceMac> mac = device->GetMac()->GetObject<MeshWifiInterfaceMac> ();
|
||||
NS_ASSERT (mac != 0);
|
||||
mac->Report(os);
|
||||
}
|
||||
void
|
||||
MeshInterfaceHelper::ResetStats (const Ptr<WifiNetDevice>& device)
|
||||
{
|
||||
Ptr<MeshWifiInterfaceMac> mac = device->GetMac()->GetObject<MeshWifiInterfaceMac> ();
|
||||
NS_ASSERT (mac != 0);
|
||||
mac->ResetStats ();
|
||||
}
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
114
src/devices/mesh/dot11s/dot11s-interface-helper.h
Normal file
114
src/devices/mesh/dot11s/dot11s-interface-helper.h
Normal file
@@ -0,0 +1,114 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2009 IITP RAS
|
||||
*
|
||||
* 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
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Kirill Andreev <andreev@iitp.ru>
|
||||
*/
|
||||
|
||||
#ifndef MESH_INTERFACE_HELPER_H
|
||||
#define MESH_INTERFACE_HELPER_H
|
||||
#include "ns3/wifi-helper.h"
|
||||
#include "ns3/wifi-net-device.h"
|
||||
#include "ns3/mesh-wifi-interface-mac.h"
|
||||
namespace ns3 {
|
||||
|
||||
class MeshInterfaceHelper
|
||||
{
|
||||
public:
|
||||
MeshInterfaceHelper ();
|
||||
virtual ~MeshInterfaceHelper ();
|
||||
/**
|
||||
* Create a mac helper in a default working state.
|
||||
*/
|
||||
static MeshInterfaceHelper Default (void);
|
||||
/**
|
||||
* \param type the type of ns3::WifiMac to create.
|
||||
* \param n%d the name of the attribute to set
|
||||
* \param v%d the value of the attribute to set
|
||||
*
|
||||
* All the attributes specified in this method should exist
|
||||
* in the requested mac.
|
||||
*/
|
||||
void SetType (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 ());
|
||||
/**
|
||||
* \param type the type of ns3::WifiMac to create.
|
||||
* \param n%d the name of the attribute to set
|
||||
* \param v%d the value of the attribute to set
|
||||
*/
|
||||
void SetBeParameters ( 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 ());
|
||||
/**
|
||||
* \param type the type of ns3::WifiMac to create.
|
||||
* \param n%d the name of the attribute to set
|
||||
* \param v%d the value of the attribute to set
|
||||
*/
|
||||
void SetVoParameters ( 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 ());
|
||||
/**
|
||||
* \param type the type of ns3::WifiRemoteStationManager to create.
|
||||
* \param n%d the name of the attribute to set
|
||||
* \param v%d the value of the attribute to set
|
||||
*
|
||||
* All the attributes specified in this method should exist
|
||||
* in the requested station manager.
|
||||
*/
|
||||
void SetRemoteStationManager (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 SetMeshId (std::string s);
|
||||
/**
|
||||
* \returns a WifiNetDevice with ready-to-use interface
|
||||
*/
|
||||
Ptr<WifiNetDevice> CreateInterface (const WifiPhyHelper &phyHelper, Ptr<Node> node, uint16_t channelId) const;
|
||||
/**
|
||||
* \brief Report statistics:
|
||||
*/
|
||||
static void Report (const Ptr<WifiNetDevice>& device, std::ostream& os);
|
||||
static void ResetStats (const Ptr<WifiNetDevice>& device);
|
||||
private:
|
||||
/**
|
||||
* \returns a newly-created MAC object.
|
||||
*
|
||||
* This method implements the pure virtual method defined in \ref ns3::WifiMacHelper.
|
||||
*/
|
||||
Ptr<MeshWifiInterfaceMac> Create (void) const;
|
||||
|
||||
ObjectFactory m_mac;
|
||||
ObjectFactory m_Be;
|
||||
ObjectFactory m_Vo;
|
||||
ObjectFactory m_stationManager;
|
||||
};
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
#endif /* MESH_INTERFACE_HELPER */
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "ns3/mesh-point-device.h"
|
||||
#include "ns3/mesh-wifi-interface-mac.h"
|
||||
#include "ns3/random-variable.h"
|
||||
#include "airtime-metric.h"
|
||||
#include "ie-dot11s-preq.h"
|
||||
#include "ie-dot11s-prep.h"
|
||||
#include "ie-dot11s-perr.h"
|
||||
@@ -613,6 +614,9 @@ HwmpProtocol::Install (Ptr<MeshPointDevice> mp)
|
||||
Ptr<HwmpMacPlugin> hwmpMac = Create<HwmpMacPlugin> (wifiNetDev->GetIfIndex (), this);
|
||||
m_interfaces[wifiNetDev->GetIfIndex ()] = hwmpMac;
|
||||
mac->InstallPlugin (hwmpMac);
|
||||
//Installing airtime link metric:
|
||||
Ptr<AirtimeLinkMetricCalculator> metric = CreateObject <AirtimeLinkMetricCalculator> ();
|
||||
mac->SetLinkMetricCallback (MakeCallback(&AirtimeLinkMetricCalculator::CalculateMetric, metric));
|
||||
}
|
||||
mp->SetRoutingProtocol (this);
|
||||
// Mesh point aggregates all installed protocols
|
||||
|
||||
@@ -23,6 +23,7 @@ def build(bld):
|
||||
'hwmp-mac-plugin.cc',
|
||||
'hwmp-protocol.cc',
|
||||
'airtime-metric.cc',
|
||||
'dot11s-interface-helper.cc',
|
||||
'dot11s-helper.cc',
|
||||
]
|
||||
headers = bld.new_task_gen('ns3header')
|
||||
@@ -35,5 +36,6 @@ def build(bld):
|
||||
'ie-dot11s-perr.h',
|
||||
'hwmp-protocol.h',
|
||||
'dot11s-helper.h',
|
||||
'dot11s-interface-helper.h',
|
||||
'dot11s-mac-header.h',
|
||||
]
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include "ns3/random-variable.h"
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/yans-wifi-phy.h"
|
||||
#include "ns3/pointer.h"
|
||||
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("MeshWifiInterfaceMac");
|
||||
|
||||
@@ -60,7 +62,18 @@ MeshWifiInterfaceMac::GetTypeId ()
|
||||
&MeshWifiInterfaceMac::GetBeaconGeneration
|
||||
),
|
||||
MakeBooleanChecker ()
|
||||
);
|
||||
)
|
||||
|
||||
.AddAttribute ("BE", "The DcaTxop object",
|
||||
PointerValue (),
|
||||
MakePointerAccessor (&MeshWifiInterfaceMac::GetBE,
|
||||
&MeshWifiInterfaceMac::SetBE),
|
||||
MakePointerChecker<DcaTxop> ())
|
||||
.AddAttribute ("VO", "The DcaTxop object",
|
||||
PointerValue (),
|
||||
MakePointerAccessor (&MeshWifiInterfaceMac::GetVO,
|
||||
&MeshWifiInterfaceMac::SetVO),
|
||||
MakePointerChecker<DcaTxop> ());
|
||||
return tid;
|
||||
}
|
||||
|
||||
@@ -83,7 +96,7 @@ MeshWifiInterfaceMac::MeshWifiInterfaceMac ()
|
||||
m_beaconDca->SetMaxCw (0);
|
||||
m_beaconDca->SetAifsn (1);
|
||||
m_beaconDca->SetManager (m_dcfManager);
|
||||
|
||||
# if 0
|
||||
m_VO = CreateObject<DcaTxop> ();
|
||||
m_VO->SetLow (m_low);
|
||||
m_VO->SetMinCw (3);
|
||||
@@ -93,6 +106,7 @@ MeshWifiInterfaceMac::MeshWifiInterfaceMac ()
|
||||
m_BE = CreateObject<DcaTxop> ();
|
||||
m_BE->SetLow (m_low);
|
||||
m_BE->SetManager (m_dcfManager);
|
||||
#endif
|
||||
}
|
||||
|
||||
MeshWifiInterfaceMac::~MeshWifiInterfaceMac ()
|
||||
@@ -198,7 +212,9 @@ MeshWifiInterfaceMac::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager>
|
||||
{
|
||||
NS_LOG_FUNCTION (this << stationManager);
|
||||
m_stationManager = stationManager;
|
||||
NS_ASSERT(m_BE != 0);
|
||||
m_BE->SetWifiRemoteStationManager (stationManager);
|
||||
NS_ASSERT(m_VO != 0);
|
||||
m_VO->SetWifiRemoteStationManager (stationManager);
|
||||
m_beaconDca->SetWifiRemoteStationManager (stationManager);
|
||||
m_low->SetWifiRemoteStationManager (stationManager);
|
||||
@@ -666,5 +682,29 @@ MeshWifiInterfaceMac::ResetStats ()
|
||||
{
|
||||
m_stats = Statistics::Statistics ();
|
||||
}
|
||||
void
|
||||
MeshWifiInterfaceMac::SetBE (Ptr<DcaTxop> dcaTxop)
|
||||
{
|
||||
m_BE = dcaTxop;
|
||||
m_BE->SetLow (m_low);
|
||||
m_BE->SetManager (m_dcfManager);
|
||||
}
|
||||
void
|
||||
MeshWifiInterfaceMac::SetVO (Ptr<DcaTxop> dcaTxop)
|
||||
{
|
||||
m_VO = dcaTxop;
|
||||
m_VO->SetLow (m_low);
|
||||
m_VO->SetManager (m_dcfManager);
|
||||
}
|
||||
Ptr<DcaTxop>
|
||||
MeshWifiInterfaceMac::GetBE () const
|
||||
{
|
||||
return m_BE;
|
||||
}
|
||||
Ptr<DcaTxop>
|
||||
MeshWifiInterfaceMac::GetVO () const
|
||||
{
|
||||
return m_VO;
|
||||
}
|
||||
} // namespace ns3
|
||||
|
||||
|
||||
@@ -159,6 +159,10 @@ public:
|
||||
void Report (std::ostream &) const;
|
||||
void ResetStats ();
|
||||
private:
|
||||
Ptr<DcaTxop> GetBE(void) const;
|
||||
void SetBE (Ptr<DcaTxop> dcaTxop);
|
||||
Ptr<DcaTxop> GetVO(void) const;
|
||||
void SetVO (Ptr<DcaTxop> dcaTxop);
|
||||
/// Frame receive handler
|
||||
void Receive (Ptr<Packet> packet, WifiMacHeader const *hdr);
|
||||
/// Forward frame to mesh point
|
||||
|
||||
Reference in New Issue
Block a user