Broadcast is not forwarded twice into the same channel

This commit is contained in:
Kirill Andreev
2009-04-08 18:17:33 +04:00
parent b349a7045c
commit 79b01d701e
4 changed files with 18 additions and 4 deletions

View File

@@ -309,9 +309,14 @@ HwmpMacPlugin::SendPerr(IePerr perr, std::vector<Mac48Address> receivers)
SendOnePerr ();
}
uint32_t
HwmpMacPlugin::GetLinkMetric(Mac48Address peerAddress)
HwmpMacPlugin::GetLinkMetric(Mac48Address peerAddress) const
{
return m_parent->GetLinkMetric(peerAddress);
}
uint16_t
HwmpMacPlugin::GetChannelId () const
{
return m_parent->GetFrequencyChannel ();
}
} //namespace dot11s
}//namespace ns3

View File

@@ -69,9 +69,10 @@ private:
/// Sends one PREQ when PreqMinInterval after last PREQ expires (if any PREQ exists in rhe queue)
void SendOnePreq ();
void SendOnePerr ();
/// Returns metric to HWMP protocol, needed only by metrics to add
/// \return metric to HWMP protocol, needed only by metrics to add
//peer as routing entry
uint32_t GetLinkMetric (Mac48Address peerAddress);
uint32_t GetLinkMetric (Mac48Address peerAddress) const;
uint16_t GetChannelId () const;
private:
Ptr<MeshWifiInterfaceMac> m_parent;
uint32_t m_ifIndex;

View File

@@ -209,8 +209,17 @@ HwmpProtocol::RequestRoute (
}
if (destination == Mac48Address::GetBroadcast ())
{
//channel IDs where we have already sent broadcast:
std::vector<uint16_t> channels;
for(HwmpPluginMap::const_iterator plugin = m_interfaces.begin (); plugin != m_interfaces.end (); plugin ++)
{
bool should_send = true;
for(std::vector<uint16_t>::const_iterator chan = channels.begin(); chan != channels.end(); chan ++)
if(*chan == plugin->second->GetChannelId ())
should_send = false;
if(!should_send)
continue;
channels.push_back(plugin->second->GetChannelId ());
std::vector<Mac48Address> receivers = GetBroadcastReceivers (plugin->first);
for (std::vector<Mac48Address>::const_iterator i = receivers.begin (); i != receivers.end(); i ++)
{

View File

@@ -27,7 +27,6 @@
#include "ns3/mac-rx-middle.h"
#include "ns3/mac-low.h"
#include "ns3/dca-txop.h"
//#include "ns3/mesh-wifi-mac-header.h"
#include "ns3/random-variable.h"
#include "ns3/simulator.h"
#include "ns3/yans-wifi-phy.h"