Review fixes

This commit is contained in:
Kirill Andreev
2009-08-21 23:33:52 +04:00
parent 3e86ad365c
commit 9e65a76f58
20 changed files with 245 additions and 271 deletions

View File

@@ -47,19 +47,18 @@ class MeshTest
/// Run test
int Run ();
private:
int xSize;
int ySize;
double step;
double randomStart;
double totalTime;
double packetInterval;
uint16_t packetSize;
uint32_t nIfaces;
bool chan;
bool pcap;
uint64_t seed;
std::string stack;
std::string root;
int m_xSize;
int m_ySize;
double m_step;
double m_randomStart;
double m_totalTime;
double m_packetInterval;
uint16_t m_packetSize;
uint32_t m_nIfaces;
bool m_chan;
bool m_pcap;
std::string m_stack;
std::string m_root;
/// List of network nodes
NodeContainer nodes;
/// List of all mesh point devices
@@ -71,7 +70,7 @@ class MeshTest
private:
/// Create nodes and setup their mobility
void CreateNodes ();
/// Install internet stack on nodes
/// Install internet m_stack on nodes
void InstallInternetStack ();
/// Install applications
void InstallApplication ();
@@ -79,78 +78,75 @@ class MeshTest
void Report ();
};
MeshTest::MeshTest () :
xSize (3),
ySize (3),
step (100.0),
randomStart (0.1),
totalTime (100.0),
packetInterval (0.1),
packetSize (1024),
nIfaces (1),
chan (true),
pcap (false),
seed (1),
stack ("ns3::Dot11sStack"),
root ("ff:ff:ff:ff:ff:ff")
m_xSize (3),
m_ySize (3),
m_step (100.0),
m_randomStart (0.1),
m_totalTime (100.0),
m_packetInterval (0.1),
m_packetSize (1024),
m_nIfaces (1),
m_chan (true),
m_pcap (false),
m_stack ("ns3::Dot11sStack"),
m_root ("ff:ff:ff:ff:ff:ff")
{
}
void
MeshTest::Configure (int argc, char *argv[])
{
CommandLine cmd;
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 ("time", "Simulation time, seconds [100 s]", totalTime);
cmd.AddValue ("packet-interval", "Interval between packets, seconds [0.001 s]", packetInterval);
cmd.AddValue ("packet-size", "Size of packets", packetSize);
cmd.AddValue ("interfaces", "Number of radio interfaces used by each mesh point. [1]", nIfaces);
cmd.AddValue ("channels", "Use different frequency channels for different interfaces. [0]", chan);
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.AddValue ("x-size", "Number of nodes in a row grid. [6]", m_xSize);
cmd.AddValue ("y-size", "Number of rows in a grid. [6]", m_ySize);
cmd.AddValue ("m_step", "Size of edge in our grid, meters. [100 m]", m_step);
cmd.AddValue ("start", "Maximum random start delay, seconds. [0.1 s]", m_randomStart);
cmd.AddValue ("time", "Simulation time, seconds [100 s]", m_totalTime);
cmd.AddValue ("packet-interval", "Interval between packets, seconds [0.001 s]", m_packetInterval);
cmd.AddValue ("packet-size", "Size of packets", m_packetSize);
cmd.AddValue ("interfaces", "Number of radio interfaces used by each mesh point. [1]", m_nIfaces);
cmd.AddValue ("m_channels", "Use different frequency m_channels for different interfaces. [0]", m_chan);
cmd.AddValue ("m_pcap", "Enable PCAP traces on interfaces. [0]", m_pcap);
cmd.AddValue ("m_stack", "Type of protocol m_stack. ns3::Dot11sStack by default", m_stack);
cmd.AddValue ("m_root", "Mac address of m_root mesh point", m_root);
cmd.Parse (argc, argv);
NS_LOG_DEBUG ("Grid:" << xSize << "*" << ySize);
NS_LOG_DEBUG ("Simulation time: " << totalTime << " s");
SeedManager::SetSeed(seed);
NS_LOG_DEBUG ("Grid:" << m_xSize << "*" << m_ySize);
NS_LOG_DEBUG ("Simulation time: " << m_totalTime << " s");
}
void
MeshTest::CreateNodes ()
{
nodes.Create (ySize*xSize);
// Setting channel
nodes.Create (m_ySize*m_xSize);
// Setting m_channel
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
// Install mesh point devices & protocols
mesh.SetStackInstaller (stack, "Root", Mac48AddressValue (Mac48Address (root.c_str ())));
mesh.SetSpreadInterfaceChannels (chan);
mesh.SetStackInstaller (m_stack, "Root", Mac48AddressValue (Mac48Address (m_root.c_str ())));
mesh.SetSpreadInterfaceChannels (m_chan);
MeshInterfaceHelper interface = MeshInterfaceHelper::Default ();
interface.SetType ("RandomStart", TimeValue (Seconds(randomStart)));
interface.SetType ("RandomStart", TimeValue (Seconds(m_randomStart)));
meshDevices = mesh.Install (wifiPhy, interface, nodes, nIfaces);
meshDevices = mesh.Install (wifiPhy, interface, nodes, m_nIfaces);
// Setup mobility
MobilityHelper mobility;
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
"MinX", DoubleValue (0.0),
"MinY", DoubleValue (0.0),
"DeltaX", DoubleValue (step),
"DeltaY", DoubleValue (step),
"GridWidth", UintegerValue (xSize),
"DeltaX", DoubleValue (m_step),
"DeltaY", DoubleValue (m_step),
"GridWidth", UintegerValue (m_xSize),
"LayoutType", StringValue ("RowFirst"));
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (nodes);
if (pcap)
if (m_pcap)
wifiPhy.EnablePcapAll (std::string ("mp-"));
}
void
MeshTest::InstallInternetStack ()
{
InternetStackHelper stack;
stack.Install (nodes);
InternetStackHelper m_stack;
m_stack.Install (nodes);
Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.0");
interfaces = address.Assign (meshDevices);
@@ -161,14 +157,14 @@ MeshTest::InstallApplication ()
UdpEchoServerHelper echoServer (9);
ApplicationContainer serverApps = echoServer.Install (nodes.Get (0));
serverApps.Start (Seconds (0.0));
serverApps.Stop (Seconds (totalTime));
serverApps.Stop (Seconds (m_totalTime));
UdpEchoClientHelper echoClient (interfaces.GetAddress (0), 9);
echoClient.SetAttribute ("MaxPackets", UintegerValue ((uint32_t)(totalTime*(1/packetInterval))));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (packetInterval)));
echoClient.SetAttribute ("PacketSize", UintegerValue (packetSize));
ApplicationContainer clientApps = echoClient.Install (nodes.Get (xSize*ySize-1));
echoClient.SetAttribute ("MaxPackets", UintegerValue ((uint32_t)(m_totalTime*(1/m_packetInterval))));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (m_packetInterval)));
echoClient.SetAttribute ("PacketSize", UintegerValue (m_packetSize));
ApplicationContainer clientApps = echoClient.Install (nodes.Get (m_xSize*m_ySize-1));
clientApps.Start (Seconds (0.0));
clientApps.Stop (Seconds (totalTime));
clientApps.Stop (Seconds (m_totalTime));
}
int
MeshTest::Run ()
@@ -176,8 +172,8 @@ MeshTest::Run ()
CreateNodes ();
InstallInternetStack ();
InstallApplication ();
Simulator::Schedule (Seconds(totalTime), & MeshTest::Report, this);
Simulator::Stop (Seconds (totalTime));
Simulator::Schedule (Seconds(m_totalTime), & MeshTest::Report, this);
Simulator::Stop (Seconds (m_totalTime));
Simulator::Run ();
Simulator::Destroy ();
return 0;

View File

@@ -30,27 +30,27 @@ AirtimeLinkMetricCalculator::GetTypeId ()
static TypeId tid = TypeId ("ns3::dot11s::AirtimeLinkMetricCalculator")
.SetParent<Object> ()
.AddConstructor<AirtimeLinkMetricCalculator> ()
.AddAttribute ( "overheadNanosec",
.AddAttribute ( "OverheadNanosec",
"Overhead expressed in nanoseconds:DIFS+ 2* SIFS + 2* PREAMBLE + 2* ACK",
UintegerValue (108000),
MakeUintegerAccessor (&AirtimeLinkMetricCalculator::m_overheadNanosec),
MakeUintegerChecker<uint32_t> (1)
)
.AddAttribute ( "testLengt",
.AddAttribute ( "TestLengt",
"Rate should be estimated using test length.",
UintegerValue (1024),
MakeUintegerAccessor (
&AirtimeLinkMetricCalculator::m_testLength),
MakeUintegerChecker<uint16_t> (1)
)
.AddAttribute ( "dot11HeaderLengt",
.AddAttribute ( "Dot11HeaderLengt",
"Length of the 802.11 header",
UintegerValue (36),
MakeUintegerAccessor (
&AirtimeLinkMetricCalculator::m_headerLength),
MakeUintegerChecker<uint16_t> (0)
)
.AddAttribute ( "dot11sHeaderLength",
.AddAttribute ( "Dot11sHeaderLength",
"Length of the mesh header",
UintegerValue (6),
MakeUintegerAccessor (

View File

@@ -41,10 +41,10 @@ namespace dot11s {
*/
class AirtimeLinkMetricCalculator : public Object
{
public:
static TypeId GetTypeId ();
uint32_t CalculateMetric (Mac48Address peerAddress, Ptr<MeshWifiInterfaceMac> mac);
private:
public:
static TypeId GetTypeId ();
uint32_t CalculateMetric (Mac48Address peerAddress, Ptr<MeshWifiInterfaceMac> mac);
private:
//\brief Overhead expressed in nanoseconds:DIFS+ 2* SIFS + 2*PREAMBLE + 2* ACK
uint32_t m_overheadNanosec;
///\brief Bt value

View File

@@ -430,20 +430,20 @@ void
HwmpProtocolMac::Statistics::Print (std::ostream & os) const
{
os << "<Statistics "
"txPreq= \"" << txPreq << "\"\n"
"txPrep=\"" << txPrep << "\"\n"
"txPerr=\"" << txPerr << "\"\n"
"rxPreq=\"" << rxPreq << "\"\n"
"rxPrep=\"" << rxPrep << "\"\n"
"rxPerr=\"" << rxPerr << "\"\n"
"txMgt=\"" << txMgt << "\"\n"
"txMgtBytes=\"" << txMgtBytes << "\"\n"
"rxMgt=\"" << rxMgt << "\"\n"
"rxMgtBytes=\"" << rxMgtBytes << "\"\n"
"txData=\"" << txData << "\"\n"
"txDataBytes=\"" << txDataBytes << "\"\n"
"rxData=\"" << rxData << "\"\n"
"rxDataBytes=\"" << rxDataBytes << "\"/>\n";
"txPreq= \"" << txPreq << "\"" << std::endl <<
"txPrep=\"" << txPrep << "\"" << std::endl <<
"txPerr=\"" << txPerr << "\"" << std::endl <<
"rxPreq=\"" << rxPreq << "\"" << std::endl <<
"rxPrep=\"" << rxPrep << "\"" << std::endl <<
"rxPerr=\"" << rxPerr << "\"" << std::endl <<
"txMgt=\"" << txMgt << "\"" << std::endl <<
"txMgtBytes=\"" << txMgtBytes << "\"" << std::endl <<
"rxMgt=\"" << rxMgt << "\"" << std::endl <<
"rxMgtBytes=\"" << rxMgtBytes << "\"" << std::endl <<
"txData=\"" << txData << "\"" << std::endl <<
"txDataBytes=\"" << txDataBytes << "\"" << std::endl <<
"rxData=\"" << rxData << "\"" << std::endl <<
"rxDataBytes=\"" << rxDataBytes << "\"/>" << std::endl;
}
void
HwmpProtocolMac::Report (std::ostream & os) const

View File

@@ -60,55 +60,55 @@ HwmpProtocol::GetTypeId ()
&HwmpProtocol::m_maxQueueSize),
MakeUintegerChecker<uint16_t> (1)
)
.AddAttribute ( "dot11MeshHWMPmaxPREQretries",
.AddAttribute ( "Dot11MeshHWMPmaxPREQretries",
"Maximum number of retries before we suppose the destination to be unreachable",
UintegerValue (3),
MakeUintegerAccessor (
&HwmpProtocol::m_dot11MeshHWMPmaxPREQretries),
MakeUintegerChecker<uint8_t> (1)
)
.AddAttribute ( "dot11MeshHWMPnetDiameterTraversalTime",
.AddAttribute ( "Dot11MeshHWMPnetDiameterTraversalTime",
"Time we suppose the packet to go from one edge of the network to another",
TimeValue (MicroSeconds (1024*100)),
MakeTimeAccessor (
&HwmpProtocol::m_dot11MeshHWMPnetDiameterTraversalTime),
MakeTimeChecker ()
)
.AddAttribute ( "dot11MeshHWMPpreqMinInterval",
.AddAttribute ( "Dot11MeshHWMPpreqMinInterval",
"Minimal interval between to successive PREQs",
TimeValue (MicroSeconds (1024*100)),
MakeTimeAccessor (
&HwmpProtocol::m_dot11MeshHWMPpreqMinInterval),
MakeTimeChecker ()
)
.AddAttribute ( "dot11MeshHWMPperrMinInterval",
.AddAttribute ( "Dot11MeshHWMPperrMinInterval",
"Minimal interval between to successive PREQs",
TimeValue (MicroSeconds (1024*100)),
MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPperrMinInterval),
MakeTimeChecker ()
)
.AddAttribute ( "dot11MeshHWMPactiveRootTimeout",
.AddAttribute ( "Dot11MeshHWMPactiveRootTimeout",
"Lifetime of poractive routing information",
TimeValue (MicroSeconds (1024*5000)),
MakeTimeAccessor (
&HwmpProtocol::m_dot11MeshHWMPactiveRootTimeout),
MakeTimeChecker ()
)
.AddAttribute ( "dot11MeshHWMPactivePathTimeout",
.AddAttribute ( "Dot11MeshHWMPactivePathTimeout",
"Lifetime of reactive routing information",
TimeValue (MicroSeconds (1024*5000)),
MakeTimeAccessor (
&HwmpProtocol::m_dot11MeshHWMPactivePathTimeout),
MakeTimeChecker ()
)
.AddAttribute ( "dot11MeshHWMPpathToRootInterval",
.AddAttribute ( "Dot11MeshHWMPpathToRootInterval",
"Interval between two successive proactive PREQs",
TimeValue (MicroSeconds (1024*2000)),
MakeTimeAccessor (
&HwmpProtocol::m_dot11MeshHWMPpathToRootInterval),
MakeTimeChecker ()
)
.AddAttribute ( "dot11MeshHWMPrannInterval",
.AddAttribute ( "Dot11MeshHWMPrannInterval",
"Lifetime of poractive routing information",
TimeValue (MicroSeconds (1024*5000)),
MakeTimeAccessor (
@@ -898,18 +898,18 @@ HwmpProtocol::ReactivePathResolved (Mac48Address dst)
//Send all packets stored for this destination
QueuedPacket packet = DequeueFirstPacketByDst (dst);
while (packet.pkt != 0)
{
//set RA tag for retransmitter:
HwmpTag tag;
packet.pkt->RemovePacketTag (tag);
tag.SetAddress (result.retransmitter);
packet.pkt->AddPacketTag (tag);
m_stats.txUnicast ++;
m_stats.txBytes += packet.pkt->GetSize ();
packet.reply (true, packet.pkt, packet.src, packet.dst, packet.protocol, result.ifIndex);
{
//set RA tag for retransmitter:
HwmpTag tag;
packet.pkt->RemovePacketTag (tag);
tag.SetAddress (result.retransmitter);
packet.pkt->AddPacketTag (tag);
m_stats.txUnicast ++;
m_stats.txBytes += packet.pkt->GetSize ();
packet.reply (true, packet.pkt, packet.src, packet.dst, packet.protocol, result.ifIndex);
packet = DequeueFirstPacketByDst (dst);
}
packet = DequeueFirstPacketByDst (dst);
}
}
void
HwmpProtocol::ProactivePathResolved ()
@@ -919,21 +919,21 @@ HwmpProtocol::ProactivePathResolved ()
NS_ASSERT (result.retransmitter != Mac48Address::GetBroadcast ());
QueuedPacket packet = DequeueFirstPacket ();
while (packet.pkt != 0)
{
//set RA tag for retransmitter:
HwmpTag tag;
if (!packet.pkt->RemovePacketTag (tag))
{
NS_FATAL_ERROR ("HWMP tag must be present at this point");
}
tag.SetAddress (result.retransmitter);
packet.pkt->AddPacketTag (tag);
m_stats.txUnicast ++;
m_stats.txBytes += packet.pkt->GetSize ();
packet.reply (true, packet.pkt, packet.src, packet.dst, packet.protocol, result.ifIndex);
{
//set RA tag for retransmitter:
HwmpTag tag;
if (!packet.pkt->RemovePacketTag (tag))
{
NS_FATAL_ERROR ("HWMP tag must be present at this point");
}
tag.SetAddress (result.retransmitter);
packet.pkt->AddPacketTag (tag);
m_stats.txUnicast ++;
m_stats.txBytes += packet.pkt->GetSize ();
packet.reply (true, packet.pkt, packet.src, packet.dst, packet.protocol, result.ifIndex);
packet = DequeueFirstPacket ();
}
packet = DequeueFirstPacket ();
}
}
bool
@@ -1107,28 +1107,28 @@ void
HwmpProtocol::Report (std::ostream & os) const
{
os << "<Hwmp "
"address=\"" << m_address << "\"\n"
"maxQueueSize=\"" << m_maxQueueSize << "\"\n"
"dot11MeshHWMPmaxPREQretries=\"" << (uint16_t)m_dot11MeshHWMPmaxPREQretries << "\"\n"
"dot11MeshHWMPnetDiameterTraversalTime=\"" << m_dot11MeshHWMPnetDiameterTraversalTime.GetSeconds () << "\"\n"
"dot11MeshHWMPpreqMinInterval=\"" << m_dot11MeshHWMPpreqMinInterval.GetSeconds () << "\"\n"
"dot11MeshHWMPperrMinInterval=\"" << m_dot11MeshHWMPperrMinInterval.GetSeconds () << "\"\n"
"dot11MeshHWMPactiveRootTimeout=\"" << m_dot11MeshHWMPactiveRootTimeout.GetSeconds () << "\"\n"
"dot11MeshHWMPactivePathTimeout=\"" << m_dot11MeshHWMPactivePathTimeout.GetSeconds () << "\"\n"
"dot11MeshHWMPpathToRootInterval=\"" << m_dot11MeshHWMPpathToRootInterval.GetSeconds () << "\"\n"
"dot11MeshHWMPrannInterval=\"" << m_dot11MeshHWMPrannInterval.GetSeconds () << "\"\n"
"isRoot=\"" << m_isRoot << "\"\n"
"maxTtl=\"" << (uint16_t)m_maxTtl << "\"\n"
"unicastPerrThreshold=\"" << (uint16_t)m_unicastPerrThreshold << "\"\n"
"unicastPreqThreshold=\"" << (uint16_t)m_unicastPreqThreshold << "\"\n"
"unicastDataThreshold=\"" << (uint16_t)m_unicastDataThreshold << "\"\n"
"doFlag=\"" << m_doFlag << "\"\n"
"rfFlag=\"" << m_rfFlag << "\">\n";
"address=\"" << m_address << "\"" << std::endl <<
"maxQueueSize=\"" << m_maxQueueSize << "\"" << std::endl <<
"Dot11MeshHWMPmaxPREQretries=\"" << (uint16_t)m_dot11MeshHWMPmaxPREQretries << "\"" << std::endl <<
"Dot11MeshHWMPnetDiameterTraversalTime=\"" << m_dot11MeshHWMPnetDiameterTraversalTime.GetSeconds () << "\"" << std::endl <<
"Dot11MeshHWMPpreqMinInterval=\"" << m_dot11MeshHWMPpreqMinInterval.GetSeconds () << "\"" << std::endl <<
"Dot11MeshHWMPperrMinInterval=\"" << m_dot11MeshHWMPperrMinInterval.GetSeconds () << "\"" << std::endl <<
"Dot11MeshHWMPactiveRootTimeout=\"" << m_dot11MeshHWMPactiveRootTimeout.GetSeconds () << "\"" << std::endl <<
"Dot11MeshHWMPactivePathTimeout=\"" << m_dot11MeshHWMPactivePathTimeout.GetSeconds () << "\"" << std::endl <<
"Dot11MeshHWMPpathToRootInterval=\"" << m_dot11MeshHWMPpathToRootInterval.GetSeconds () << "\"" << std::endl <<
"Dot11MeshHWMPrannInterval=\"" << m_dot11MeshHWMPrannInterval.GetSeconds () << "\"" << std::endl <<
"isRoot=\"" << m_isRoot << "\"" << std::endl <<
"maxTtl=\"" << (uint16_t)m_maxTtl << "\"" << std::endl <<
"unicastPerrThreshold=\"" << (uint16_t)m_unicastPerrThreshold << "\"" << std::endl <<
"unicastPreqThreshold=\"" << (uint16_t)m_unicastPreqThreshold << "\"" << std::endl <<
"unicastDataThreshold=\"" << (uint16_t)m_unicastDataThreshold << "\"" << std::endl <<
"doFlag=\"" << m_doFlag << "\"" << std::endl <<
"rfFlag=\"" << m_rfFlag << "\">" << std::endl;
m_stats.Print (os);
for (HwmpProtocolMacMap::const_iterator plugin = m_interfaces.begin (); plugin != m_interfaces.end (); plugin ++)
{
plugin->second->Report (os);
}
{
plugin->second->Report (os);
}
os << "</Hwmp>\n";
}
void
@@ -1137,7 +1137,7 @@ HwmpProtocol::ResetStats ()
m_stats = Statistics::Statistics ();
for (HwmpProtocolMacMap::const_iterator plugin = m_interfaces.begin (); plugin != m_interfaces.end (); plugin ++)
{
plugin->second->ResetStats ();
plugin->second->ResetStats ();
}
}
HwmpProtocol::QueuedPacket::QueuedPacket () :

View File

@@ -149,13 +149,39 @@ private:
};
///\name Methods related to Queue/Dequeue procedures
//\{
///\{
bool QueuePacket (QueuedPacket packet);
QueuedPacket DequeueFirstPacketByDst (Mac48Address dst);
QueuedPacket DequeueFirstPacket ();
void ReactivePathResolved (Mac48Address dst);
void ProactivePathResolved ();
//\}
///\}
///\name Methods responsible for path discovery retry procedure:
///\{
/**
* \brief checks when the last path discovery procedure was started for a given destination.
*
* If the retry counter has not achieved the maximum level - preq should not be sent
*/
bool ShouldSendPreq (Mac48Address dst);
/**
* \brief Generates PREQ retry when retry timeout has expired and route is still unresolved.
*
* When PREQ retry has achieved the maximum level - retry mechanish should be cancelled
*/
void RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry);
///\}
///\name Proactive Preq routines:
///\{
void SendProactivePreq ();
///\}
///\return address of MeshPointDevice
Mac48Address GetAddress ();
private:
typedef std::map<uint32_t, Ptr<HwmpProtocolMac> > HwmpProtocolMacMap;
HwmpProtocolMacMap m_interfaces;
///\name Statistics:
///\{
struct Statistics
@@ -175,62 +201,36 @@ private:
};
Statistics m_stats;
///\}
///\name Methods responsible for path discovery retry procedure:
//\{
/**
* \brief checks when the last path discovery procedure was started for a given destination.
*
* If the retry counter has not achieved the maximum level - preq should not be sent
*/
bool ShouldSendPreq (Mac48Address dst);
/**
* \brief Generates PREQ retry when retry timeout has expired and route is still unresolved.
*
* When PREQ retry has achieved the maximum level - retry mechanish should be cancelled
*/
void RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry);
//\}
///\name Proactive Preq routines:
//\{
void SendProactivePreq ();
//\}
///\return address of MeshPointDevice
Mac48Address GetAddress ();
private:
typedef std::map<uint32_t, Ptr<HwmpProtocolMac> > HwmpProtocolMacMap;
HwmpProtocolMacMap m_interfaces;
Mac48Address m_address;
uint32_t m_dataSeqno;
uint32_t m_hwmpSeqno;
uint32_t m_preqId;
///\name Sequence number filters
//\{
///\{
/// Data sequence number database
std::map<Mac48Address, uint32_t> m_lastDataSeqno;
/// DSN databse
std::map<Mac48Address, uint32_t> m_lastHwmpSeqno;
/// Metric database
std::map<Mac48Address, uint32_t> m_lastHwmpMetric;
//\}
///\}
/// Routing table
Ptr<HwmpRtable> m_rtable;
///\name Timers:
//\{
///\{
std::map<Mac48Address, EventId> m_preqTimeouts;
EventId m_proactivePreqTimer;
//Random start in Proactive PREQ propagation
Time m_randomStart;
//\}
///\}
/// Packet Queue
std::vector<QueuedPacket> m_rqueue;
private:
///\name HWMP-protocol parameters (attributes of GetTypeId)
//\{
///\{
uint16_t m_maxQueueSize;
uint8_t m_dot11MeshHWMPmaxPREQretries;
Time m_dot11MeshHWMPnetDiameterTraversalTime;
@@ -247,10 +247,10 @@ private:
uint8_t m_unicastDataThreshold;
bool m_doFlag;
bool m_rfFlag;
//\}
///\}
///\name Methods needed by HwmpMacLugin to access protocol parameters:
//\{
///\{
bool GetDoFlag ();
bool GetRfFlag ();
Time GetPreqMinInterval ();
@@ -260,7 +260,7 @@ private:
uint32_t GetNextHwmpSeqno ();
uint32_t GetActivePathLifetime ();
uint8_t GetUnicastPerrThreshold ();
//\}
///\}
Callback <std::vector<Mac48Address>, uint32_t> m_neighboursCallback;
};
} //namespace dot11s

View File

@@ -110,9 +110,7 @@ IeBeaconTiming::AddNeighboursTimingElementUnit (uint16_t aid, Time last_beacon,
m_numOfUnits++;
}
void
IeBeaconTiming::DelNeighboursTimingElementUnit (uint16_t aid, Time last_beacon, //MicroSeconds!
Time beacon_interval //MicroSeconds!
)
IeBeaconTiming::DelNeighboursTimingElementUnit (uint16_t aid, Time last_beacon, Time beacon_interval)
{
for (NeighboursTimingUnitsList::iterator i = m_neighbours.begin (); i != m_neighbours.end (); i++)
{
@@ -200,8 +198,6 @@ IeBeaconTiming::AidToU8 (uint16_t x)
{
return (uint8_t) (x & 0xff);
}
;
bool
operator== (const IeBeaconTimingUnit & a, const IeBeaconTimingUnit & b)
{

View File

@@ -84,11 +84,11 @@ public:
);
void ClearTimingElement ();
private:
WifiElementId ElementId () const;
uint8_t GetInformationSize () const;
void SerializeInformation (Buffer::Iterator i) const;
uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
void PrintInformation (std::ostream& os) const;
virtual WifiElementId ElementId () const;
virtual uint8_t GetInformationSize () const;
virtual void SerializeInformation (Buffer::Iterator i) const;
virtual uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
virtual void PrintInformation (std::ostream& os) const;
/**
* Converters:
*/

View File

@@ -25,18 +25,18 @@
namespace ns3 {
namespace dot11s {
dot11sMeshCapability::dot11sMeshCapability () :
Dot11sMeshCapability::Dot11sMeshCapability () :
acceptPeerLinks (true), MCCASupported (false), MCCAEnabled (false), forwarding (true), beaconTimingReport (
true), TBTTAdjustment (true), powerSaveLevel (false)
{
}
uint8_t
dot11sMeshCapability::GetSerializedSize () const
Dot11sMeshCapability::GetSerializedSize () const
{
return 2;
}
uint16_t
dot11sMeshCapability::GetUint16 () const
Dot11sMeshCapability::GetUint16 () const
{
uint16_t result = 0;
if (acceptPeerLinks)
@@ -70,13 +70,13 @@ dot11sMeshCapability::GetUint16 () const
return result;
}
Buffer::Iterator
dot11sMeshCapability::Serialize (Buffer::Iterator i) const
Dot11sMeshCapability::Serialize (Buffer::Iterator i) const
{
i.WriteHtolsbU16 (GetUint16 ());
return i;
}
Buffer::Iterator
dot11sMeshCapability::Deserialize (Buffer::Iterator i)
Dot11sMeshCapability::Deserialize (Buffer::Iterator i)
{
uint16_t cap = i.ReadLsbtohU16 ();
acceptPeerLinks = Is (cap, 0);
@@ -89,7 +89,7 @@ dot11sMeshCapability::Deserialize (Buffer::Iterator i)
return i;
}
bool
dot11sMeshCapability::Is (uint16_t cap, uint8_t n) const
Dot11sMeshCapability::Is (uint16_t cap, uint8_t n) const
{
uint16_t mask = 1 << n;
return (cap & mask);
@@ -193,13 +193,13 @@ IeConfiguration::GetNeighborCount ()
{
return m_neighbors;
}
dot11sMeshCapability const&
Dot11sMeshCapability const&
IeConfiguration::MeshCapability ()
{
return m_meshCap;
}
bool
operator== (const dot11sMeshCapability & a, const dot11sMeshCapability & b)
operator== (const Dot11sMeshCapability & a, const Dot11sMeshCapability & b)
{
return ((a.acceptPeerLinks == b.acceptPeerLinks) && (a.MCCASupported == b.MCCASupported) && (a.MCCAEnabled
== b.MCCAEnabled) && (a.forwarding == b.forwarding) && (a.beaconTimingReport == b.beaconTimingReport)

View File

@@ -74,10 +74,10 @@ enum dot11sAuthenticationProtocol
* \ingroup dot11s
* \brief See 7.3.2.86.7 in 802.11s draft 3.0
*/
class dot11sMeshCapability
class Dot11sMeshCapability
{
public:
dot11sMeshCapability ();
Dot11sMeshCapability ();
uint8_t GetSerializedSize () const;
Buffer::Iterator Serialize (Buffer::Iterator i) const;
Buffer::Iterator Deserialize (Buffer::Iterator i);
@@ -90,7 +90,7 @@ public:
bool TBTTAdjustment;
bool powerSaveLevel;
bool Is (uint16_t cap,uint8_t n) const;
friend bool operator== (const dot11sMeshCapability & a, const dot11sMeshCapability & b);
friend bool operator== (const Dot11sMeshCapability & a, const Dot11sMeshCapability & b);
};
/**
@@ -109,13 +109,13 @@ public:
void SetNeighborCount (uint8_t neighbors);
uint8_t GetNeighborCount ();
dot11sMeshCapability const& MeshCapability ();
Dot11sMeshCapability const& MeshCapability ();
private:
WifiElementId ElementId () const;
uint8_t GetInformationSize () const;
void SerializeInformation (Buffer::Iterator i) const;
uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
void PrintInformation (std::ostream& os) const;
virtual WifiElementId ElementId () const;
virtual uint8_t GetInformationSize () const;
virtual void SerializeInformation (Buffer::Iterator i) const;
virtual uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
virtual void PrintInformation (std::ostream& os) const;
private:
/** Active Path Selection Protocol ID */
dot11sPathSelectionProtocol m_APSPId;
@@ -127,12 +127,12 @@ private:
dot11sSynchronizationProtocolIdentifier m_SPId;
/** Auth protocol ID */
dot11sAuthenticationProtocol m_APId;
dot11sMeshCapability m_meshCap;
Dot11sMeshCapability m_meshCap;
uint8_t m_neighbors;
friend bool operator== (const IeConfiguration & a, const IeConfiguration & b);
};
bool operator== (const IeConfiguration & a, const IeConfiguration & b);
bool operator== (const dot11sMeshCapability & a, const dot11sMeshCapability & b);
bool operator== (const Dot11sMeshCapability & a, const Dot11sMeshCapability & b);
} // namespace dot11s
} //namespace ns3
#endif

View File

@@ -44,11 +44,11 @@ public:
uint32_t GetLength (void) const;
char *PeekString (void) const;
private:
WifiElementId ElementId () const;
void SerializeInformation (Buffer::Iterator i) const;
uint8_t DeserializeInformation (Buffer::Iterator start, uint8_t length);
void PrintInformation (std::ostream& os) const;
uint8_t GetInformationSize () const;
virtual WifiElementId ElementId () const;
virtual void SerializeInformation (Buffer::Iterator i) const;
virtual uint8_t DeserializeInformation (Buffer::Iterator start, uint8_t length);
virtual void PrintInformation (std::ostream& os) const;
virtual uint8_t GetInformationSize () const;
private:
uint8_t m_meshId[33];
friend bool operator== (const IeMeshId & a, const IeMeshId & b);

View File

@@ -39,11 +39,11 @@ public:
void SetMetric (uint32_t metric);
uint32_t GetMetric ();
private:
WifiElementId ElementId () const;
void SerializeInformation (Buffer::Iterator i) const;
uint8_t DeserializeInformation (Buffer::Iterator start, uint8_t length);
void PrintInformation (std::ostream& os) const;
uint8_t GetInformationSize () const;
virtual WifiElementId ElementId () const;
virtual void SerializeInformation (Buffer::Iterator i) const;
virtual uint8_t DeserializeInformation (Buffer::Iterator start, uint8_t length);
virtual void PrintInformation (std::ostream& os) const;
virtual uint8_t GetInformationSize () const;
private:
uint32_t m_metric;
friend bool operator== (const IeLinkMetricReport & a, const IeLinkMetricReport & b);

View File

@@ -71,11 +71,11 @@ public:
bool SubtypeIsConfirm () const ;
uint8_t GetSubtype () const { return m_subtype;};
private:
WifiElementId ElementId () const;
uint8_t GetInformationSize (void) const;
void SerializeInformation (Buffer::Iterator i) const;
uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
void PrintInformation (std::ostream& os) const;
virtual WifiElementId ElementId () const;
virtual uint8_t GetInformationSize (void) const;
virtual void SerializeInformation (Buffer::Iterator i) const;
virtual uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
virtual void PrintInformation (std::ostream& os) const;
private:
uint8_t m_length;
uint8_t m_subtype;

View File

@@ -32,11 +32,11 @@ class IePeeringProtocol : public WifiInformationElement
public:
IePeeringProtocol ();
private:
WifiElementId ElementId () const;
uint8_t GetInformationSize () const;
void SerializeInformation (Buffer::Iterator i) const;
uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
void PrintInformation (std::ostream& os) const;
virtual WifiElementId ElementId () const;
virtual uint8_t GetInformationSize () const;
virtual void SerializeInformation (Buffer::Iterator i) const;
virtual uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
virtual void PrintInformation (std::ostream& os) const;
private:
uint8_t m_protocol;
};

View File

@@ -676,16 +676,16 @@ PeerLink::Report (std::ostream & os) const
{
return;
}
os << "<PeerLink\n"
"localAddress=\"" << m_macPlugin->GetAddress () << "\"\n"
"peerInterfaceAddress=\"" << m_peerAddress << "\"\n"
"peerMeshPointAddress=\"" << m_peerMeshPointAddress << "\"\n"
"metric=\"" << m_macPlugin->GetLinkMetric (m_peerAddress) << "\"\n"
"lastBeacon=\"" << m_lastBeacon.GetSeconds () << "\"\n"
"localLinkId=\"" << m_localLinkId << "\"\n"
"peerLinkId=\"" << m_peerLinkId << "\"\n"
"assocId=\"" << m_assocId << "\"\n"
"/>\n";
os << "<PeerLink" << std::endl <<
"localAddress=\"" << m_macPlugin->GetAddress () << "\"" << std::endl <<
"peerInterfaceAddress=\"" << m_peerAddress << "\"" << std::endl <<
"peerMeshPointAddress=\"" << m_peerMeshPointAddress << "\"" << std::endl <<
"metric=\"" << m_macPlugin->GetLinkMetric (m_peerAddress) << "\"" << std::endl <<
"lastBeacon=\"" << m_lastBeacon.GetSeconds () << "\"" << std::endl <<
"localLinkId=\"" << m_localLinkId << "\"" << std::endl <<
"peerLinkId=\"" << m_peerLinkId << "\"" << std::endl <<
"assocId=\"" << m_assocId << "\"" << std::endl <<
"/>" << std::endl;
}
} // namespace dot11s
} //namespace ns3

View File

@@ -542,7 +542,7 @@ PeerManagementProtocol::Statistics::Print (std::ostream & os) const
os << "<Statistics "
"linksTotal=\"" << linksTotal << "\" "
"linksOpened=\"" << linksOpened << "\" "
"linksClosed=\"" << linksClosed << "\"/>\n";
"linksClosed=\"" << linksClosed << "\"/>" << std::endl;
}
void
PeerManagementProtocol::Report (std::ostream & os) const

View File

@@ -130,20 +130,6 @@ MeshPointDevice::Forward (Ptr<NetDevice> inport, Ptr<const Packet> packet, uint1
m_requestRoute (inport->GetIfIndex (), src, dst, packet, protocol, m_myResponse);
}
void
MeshPointDevice::SetName (const std::string name)
{
NS_LOG_FUNCTION_NOARGS ();
m_name = name;
}
std::string
MeshPointDevice::GetName () const
{
NS_LOG_FUNCTION_NOARGS ();
return m_name;
}
void
MeshPointDevice::SetIfIndex (const uint32_t index)
{
@@ -452,20 +438,20 @@ MeshPointDevice::Statistics::Statistics () :
void
MeshPointDevice::Report (std::ostream & os) const
{
os << "<Statistics \n"
"txUnicastData=\"" << m_txStats.unicastData << "\"\n"
"txUnicastDataBytes=\"" << m_txStats.unicastDataBytes << "\"\n"
"txBroadcastData=\"" << m_txStats.broadcastData << "\"\n"
"txBroadcastDataBytes=\"" << m_txStats.broadcastDataBytes << "\"\n"
"rxUnicastData=\"" << m_rxStats.unicastData << "\"\n"
"rxUnicastDataBytes=\"" << m_rxStats.unicastDataBytes << "\"\n"
"rxBroadcastData=\"" << m_rxStats.broadcastData << "\"\n"
"rxBroadcastDataBytes=\"" << m_rxStats.broadcastDataBytes << "\"\n"
"fwdUnicastData=\"" << m_fwdStats.unicastData << "\"\n"
"fwdUnicastDataBytes=\"" << m_fwdStats.unicastDataBytes << "\"\n"
"fwdBroadcastData=\"" << m_fwdStats.broadcastData << "\"\n"
"fwdBroadcastDataBytes=\"" << m_fwdStats.broadcastDataBytes << "\"\n"
"/>\n";
os << "<Statistics" << std::endl <<
"txUnicastData=\"" << m_txStats.unicastData << "\"" << std::endl <<
"txUnicastDataBytes=\"" << m_txStats.unicastDataBytes << "\"" << std::endl <<
"txBroadcastData=\"" << m_txStats.broadcastData << "\"" << std::endl <<
"txBroadcastDataBytes=\"" << m_txStats.broadcastDataBytes << "\"" << std::endl <<
"rxUnicastData=\"" << m_rxStats.unicastData << "\"" << std::endl <<
"rxUnicastDataBytes=\"" << m_rxStats.unicastDataBytes << "\"" << std::endl <<
"rxBroadcastData=\"" << m_rxStats.broadcastData << "\"" << std::endl <<
"rxBroadcastDataBytes=\"" << m_rxStats.broadcastDataBytes << "\"" << std::endl <<
"fwdUnicastData=\"" << m_fwdStats.unicastData << "\"" << std::endl <<
"fwdUnicastDataBytes=\"" << m_fwdStats.unicastDataBytes << "\"" << std::endl <<
"fwdBroadcastData=\"" << m_fwdStats.broadcastData << "\"" << std::endl <<
"fwdBroadcastDataBytes=\"" << m_fwdStats.broadcastDataBytes << "\"" << std::endl <<
"/>" << std::endl;
}
void

View File

@@ -89,8 +89,6 @@ public:
///\name NetDevice interface for upper layers
//\{
virtual void SetName (const std::string name);
virtual std::string GetName () const;
virtual void SetIfIndex (const uint32_t index);
virtual uint32_t GetIfIndex () const;
virtual Ptr<Channel> GetChannel () const;
@@ -157,8 +155,6 @@ private:
Mac48Address m_address;
/// Parent node
Ptr<Node> m_node;
/// Station name
std::string m_name;
/// List of interfaces
std::vector< Ptr<NetDevice> > m_ifaces;
/// If index

View File

@@ -665,7 +665,7 @@ MeshWifiInterfaceMac::Statistics::Print (std::ostream & os) const
"txFrames=\"" << sentFrames << "\" "
"txBytes=\"" << sentBytes << "\" "
"rxFrames=\"" << recvFrames << "\" "
"rxBytes=\"" << recvBytes << "\"/>\n";
"rxBytes=\"" << recvBytes << "\"/>" << std::endl;
}
void
MeshWifiInterfaceMac::Report (std::ostream & os) const
@@ -673,9 +673,9 @@ MeshWifiInterfaceMac::Report (std::ostream & os) const
os << "<Interface "
"BeaconInterval=\"" << GetBeaconInterval ().GetSeconds () << "\" "
"Channel=\"" << GetFrequencyChannel () << "\" "
"Address = \"" << GetAddress () << "\">\n";
"Address = \"" << GetAddress () << "\">" << std::endl;
m_stats.Print (os);
os << "</Interface>\n";
os << "</Interface>" << std::endl;
}
void
MeshWifiInterfaceMac::ResetStats ()

View File

@@ -144,7 +144,7 @@ public:
/// Own unique Element ID
virtual WifiElementId ElementId () const = 0;
/// Length of serialized information
protected:
private:
virtual uint8_t GetInformationSize () const = 0;
/// Serialize information
virtual void SerializeInformation (Buffer::Iterator start) const = 0;