Coding style changes: indentation (some fixes), spaces in operators, function
calls, etc.
--- a/examples/mesh.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/examples/mesh.cc Wed Mar 18 22:36:12 2009 +0300
@@ -33,7 +33,7 @@
NS_LOG_COMPONENT_DEFINE ("TestMeshScript");
int
-main(int argc, char *argv[])
+main (int argc, char *argv[])
{
// Creating square topology with nNodes x nNodes grid:
int xSize = 5;
@@ -46,12 +46,12 @@
MeshWifiHelper wifi;
NetDeviceContainer meshDevices;
// Defining a size of our network:
- cmd.AddValue("x-size", "Number of nodes in a row grid", xSize);
- cmd.AddValue("y-size", "Number of rows in a grid", ySize);
- cmd.AddValue("step", "Size of edge in our grid", step);
- cmd.AddValue("start", "Random start parameter", randomStart);
+ cmd.AddValue ("x-size", "Number of nodes in a row grid", xSize);
+ cmd.AddValue ("y-size", "Number of rows in a grid", ySize);
+ cmd.AddValue ("step", "Size of edge in our grid", step);
+ cmd.AddValue ("start", "Random start parameter", randomStart);
cmd.Parse (argc, argv);
- NS_LOG_DEBUG("Grid:"<<xSize<<"*"<<ySize);
+ NS_LOG_DEBUG ("Grid:"<<xSize<<"*"<<ySize);
// Creating nodes:
nodes.Create (ySize*xSize);
@@ -60,9 +60,9 @@
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
// Setting Wifi:
- //wifi.SetPhy("ns3::WifiPhy");
- wifi.SetRemoteStationManager("ns3::AarfWifiManager");
- Ssid ssid = Ssid("MyMeSH");
+ //wifi.SetPhy ("ns3::WifiPhy");
+ wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
+ Ssid ssid = Ssid ("MyMeSH");
wifi.SetMac ("ns3::MeshWifiMac",
"Ssid", SsidValue (ssid),
"RandomStart", TimeValue (Seconds (randomStart))
@@ -78,12 +78,12 @@
"DeltaX", DoubleValue (step),
"DeltaY", DoubleValue (step),
"GridWidth", UintegerValue (xSize),
- "LayoutType", StringValue("RowFirst"));
+ "LayoutType", StringValue ("RowFirst"));
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (nodes);
// Setting Internet Stack:
InternetStackHelper stack;
- stack.Install(nodes);
+ stack.Install (nodes);
Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer interfaces = address.Assign (meshDevices);
@@ -100,7 +100,7 @@
clientApps.Stop (Seconds (10.0));
//end
Simulator::Stop (Seconds (10.0));
- Simulator::Run();
- Simulator::Destroy();
+ Simulator::Run ();
+ Simulator::Destroy ();
return 0;
}
--- a/examples/routing-table-test.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/examples/routing-table-test.cc Wed Mar 18 22:36:12 2009 +0300
@@ -32,177 +32,262 @@
using namespace ns3;
-NS_LOG_COMPONENT_DEFINE("RoutingTableTest");
+NS_LOG_COMPONENT_DEFINE ("RoutingTableTest");
void
-aux_function(Ptr<HwmpRtable> ptr,Mac48Address addr,std::vector<bool> *results, std::vector<Time> *seconds)
+aux_function (Ptr<HwmpRtable> ptr, Mac48Address addr, std::vector<bool> *results, std::vector<Time> *seconds)
{
- if (ptr->LookupReactive(addr).retransmitter.IsBroadcast() && ptr->LookupReactive(addr).metric == 0xffffffff)
- results->push_back(false);
+ if (ptr->LookupReactive (addr).retransmitter.IsBroadcast () && ptr->LookupReactive (addr).metric == 0xffffffff)
+ results->push_back (false);
else
- results->push_back(true);
+ results->push_back (true);
- seconds->push_back(Simulator::Now());
- NS_LOG_UNCOND("Reactive retransmitter is "<<ptr->LookupReactive(addr).retransmitter << "\nport is "<<ptr->LookupReactive(addr).ifIndex << "\nmetric is " << ptr->LookupReactive(addr).metric << "\nseqnum is " << ptr->LookupReactive(addr).seqnum);
- NS_LOG_UNCOND("Checked at "<<Simulator::Now().GetSeconds()<<" seconds\n\n");
+ seconds->push_back (Simulator::Now ());
+ NS_LOG_UNCOND ("Reactive retransmitter is " << ptr->LookupReactive (addr).retransmitter <<
+ "\nport is " << ptr->LookupReactive (addr).ifIndex <<
+ "\nmetric is " << ptr->LookupReactive (addr).metric <<
+ "\nseqnum is " << ptr->LookupReactive (addr).seqnum);
+ NS_LOG_UNCOND ("Checked at " << Simulator::Now ().GetSeconds () << " seconds\n\n");
};
void
-aux_function1(Ptr<HwmpRtable> ptr,uint32_t port,std::vector<bool> *results,std::vector<Time> *seconds)
+aux_function1 (Ptr<HwmpRtable> ptr, uint32_t port, std::vector<bool> *results, std::vector<Time> *seconds)
{
- if (ptr->LookupProactive(port).retransmitter.IsBroadcast() && ptr->LookupProactive(port).metric == 0xffffffff)
- results->push_back(false);
+ if (ptr->LookupProactive (port).retransmitter.IsBroadcast () && ptr->LookupProactive (port).metric == 0xffffffff)
+ results->push_back (false);
else
- results->push_back(true);
+ results->push_back (true);
- seconds->push_back(Simulator::Now());
- NS_LOG_UNCOND("Proactive retransmitter is "<<ptr->LookupProactive(port).retransmitter<< "\nport is "<<ptr->LookupProactive(port).ifIndex << "\nmetric is " << ptr->LookupProactive(port).metric << "\nseqnum is " << ptr->LookupProactive(port).seqnum);
- NS_LOG_UNCOND("Checked at "<<Simulator::Now().GetSeconds()<<" seconds\n\n");
+ seconds->push_back (Simulator::Now ());
+ NS_LOG_UNCOND ("Proactive retransmitter is " << ptr->LookupProactive (port).retransmitter <<
+ "\nport is " << ptr->LookupProactive (port).ifIndex <<
+ "\nmetric is " << ptr->LookupProactive (port).metric <<
+ "\nseqnum is " << ptr->LookupProactive (port).seqnum);
+ NS_LOG_UNCOND ("Checked at " << Simulator::Now ().GetSeconds () << " seconds\n\n");
};
void
-print_results(std::vector<bool> *results,std::vector<Time> *seconds)
+print_results (std::vector<bool> *results, std::vector<Time> *seconds)
{
- NS_LOG_UNCOND("Fulfilled "<<results->size()<<" tests\n");
- for (unsigned int i = 0;i!=results->size();i++)
+ NS_LOG_UNCOND ("Fulfilled " << results->size () << " tests\n");
+ for (unsigned int i = 0; i != results->size (); i++)
{
- NS_LOG_UNCOND("Result: "<<results->at(i));
- NS_LOG_UNCOND("Tested at "<<seconds->at(i).GetSeconds()<<" seconds\n");
+ NS_LOG_UNCOND ("Result: " << results->at (i));
+ NS_LOG_UNCOND ("Tested at " << seconds->at (i).GetSeconds () << " seconds\n");
}
}
void
-get_conclusion(std::vector<bool> *results)
+get_conclusion (std::vector<bool> *results)
{
if (
- results->at(0)
- && results->at(1)
- && results->at(2)
- && results->at(3)
- && results->at(4)
- && results->at(5)
- && results->at(6)
- && results->at(7)
- && !results->at(8)
- && !results->at(9)
- && !results->at(10)
- && !results->at(11)
- && !results->at(12)
- && !results->at(13)
- && !results->at(14))
- NS_LOG_UNCOND("\n\n\nPASSED\n\n\n");
+ results->at (0)
+ && results->at (1)
+ && results->at (2)
+ && results->at (3)
+ && results->at (4)
+ && results->at (5)
+ && results->at (6)
+ && results->at (7)
+ && !results->at (8)
+ && !results->at (9)
+ && !results->at (10)
+ && !results->at (11)
+ && !results->at (12)
+ && !results->at (13)
+ && !results->at (14))
+ NS_LOG_UNCOND ("\n\n\nPASSED\n\n\n");
else
- NS_LOG_UNCOND("\n\n\nNOT PASSED\n\n\n");
+ NS_LOG_UNCOND ("\n\n\nNOT PASSED\n\n\n");
}
-int main(int argc,char *argv[])
+int main (int argc, char *argv[])
{
// Create Table
- Ptr<HwmpRtable> table = CreateObject<HwmpRtable>();
- std::vector<bool> test_results = std::vector<bool>();
- std::vector<Time> test_time = std::vector<Time>();
+ Ptr<HwmpRtable> table = CreateObject<HwmpRtable> ();
+ std::vector<bool> test_results = std::vector<bool> ();
+ std::vector<Time> test_time = std::vector<Time> ();
//Add reactive paths
- table->AddReactivePath(Mac48Address("01:00:00:01:00:01"),Mac48Address("01:00:00:01:00:03"),8010,10,Seconds(20),1);
- table->AddReactivePath(Mac48Address("01:00:00:02:00:01"),Mac48Address("01:00:00:02:00:03"),8020,20,Seconds(30),2);
-// table->AddReactivePath(Mac48Address("01:00:00:03:00:01"),Mac48Address("01:00:00:03:00:03"),8030,30,Seconds(30),3);
-// table->AddReactivePath(Mac48Address("01:00:00:04:00:01"),Mac48Address("01:00:00:04:00:03"),8040,40,Seconds(35),4);
+ table->AddReactivePath (Mac48Address ("01:00:00:01:00:01"), Mac48Address ("01:00:00:01:00:03"), 8010, 10, Seconds (20), 1);
+ table->AddReactivePath (Mac48Address ("01:00:00:02:00:01"), Mac48Address ("01:00:00:02:00:03"), 8020, 20, Seconds (30), 2);
+// table->AddReactivePath (Mac48Address("01:00:00:03:00:01"),Mac48Address("01:00:00:03:00:03"),8030,30,Seconds(30),3);
+// table->AddReactivePath (Mac48Address("01:00:00:04:00:01"),Mac48Address("01:00:00:04:00:03"),8040,40,Seconds(35),4);
//Add proactive paths
- table->AddProactivePath(10,Mac48Address("01:00:00:01:00:01"),Mac48Address("01:00:00:01:00:03"),8010,Seconds(20),1);
- table->AddProactivePath(20,Mac48Address("01:00:00:02:00:01"),Mac48Address("01:00:00:02:00:03"),8020,Seconds(30),2);
- table->AddProactivePath(30,Mac48Address("01:00:00:03:00:01"),Mac48Address("01:00:00:03:00:03"),8030,Seconds(20),3);
- table->AddProactivePath(40,Mac48Address("01:00:00:04:00:01"),Mac48Address("01:00:00:04:00:03"),8040,Seconds(30),4);
- Simulator::Schedule(Seconds(0.0),
+ table->AddProactivePath (10, Mac48Address ("01:00:00:01:00:01"), Mac48Address ("01:00:00:01:00:03"), 8010, Seconds (20), 1);
+ table->AddProactivePath (20, Mac48Address ("01:00:00:02:00:01"), Mac48Address ("01:00:00:02:00:03"), 8020, Seconds (30), 2);
+ table->AddProactivePath (30, Mac48Address ("01:00:00:03:00:01"), Mac48Address ("01:00:00:03:00:03"), 8030, Seconds (20), 3);
+ table->AddProactivePath (40, Mac48Address ("01:00:00:04:00:01"), Mac48Address ("01:00:00:04:00:03"), 8040, Seconds (30), 4);
+ Simulator::Schedule (Seconds (0.0),
&aux_function,
table,
- Mac48Address("01:00:00:01:00:01"),&test_results,&test_time);
- Simulator::Schedule(Seconds(0.0),
+ Mac48Address ("01:00:00:01:00:01"),
+ &test_results,
+ &test_time);
+ Simulator::Schedule (Seconds (0.0),
&aux_function1,
table,
- 8010,&test_results,&test_time);
- Simulator::Schedule(Seconds(0.0),
+ 8010,
+ &test_results,
+ &test_time);
+ Simulator::Schedule (Seconds (0.0),
&aux_function,
table,
- Mac48Address("01:00:00:02:00:01"),&test_results,&test_time);
- Simulator::Schedule(Seconds(0.0),
+ Mac48Address ("01:00:00:02:00:01"),
+ &test_results,
+ &test_time);
+ Simulator::Schedule (Seconds (0.0),
&aux_function1,
table,
- 8020,&test_results,&test_time);
- Simulator::Schedule(Seconds(1.0),
+ 8020,
+ &test_results,
+ &test_time);
+ Simulator::Schedule (Seconds (1.0),
&aux_function,
table,
- Mac48Address("01:00:00:01:00:01"),&test_results,&test_time);
- Simulator::Schedule(Seconds(1.0),
+ Mac48Address ("01:00:00:01:00:01"),
+ &test_results,
+ &test_time);
+ Simulator::Schedule (Seconds (1.0),
&aux_function1,
table,
- 8010,&test_results,&test_time);
- Simulator::Schedule(Seconds(1.0),
+ 8010,
+ &test_results,
+ &test_time);
+ Simulator::Schedule (Seconds (1.0),
&aux_function,
table,
- Mac48Address("01:00:00:02:00:01"),&test_results,&test_time);
- Simulator::Schedule(Seconds(1.0),
+ Mac48Address ("01:00:00:02:00:01"),
+ &test_results,
+ &test_time);
+ Simulator::Schedule (Seconds (1.0),
&aux_function1,
table,
- 8020,&test_results,&test_time);
+ 8020,
+ &test_results,
+ &test_time);
//Print routing info
- NS_LOG_UNCOND("Added reactive path number "<<table->LookupReactive(Mac48Address("01:00:00:01:00:01")).seqnum << " at dest " << table->LookupReactive(Mac48Address("01:00:00:01:00:01")).retransmitter << " with metric "<< table->LookupReactive(Mac48Address("01:00:00:01:00:01")).metric <<"\n");
- NS_LOG_UNCOND("Added reactive path number "<<table->LookupReactive(Mac48Address("01:00:00:02:00:01")).seqnum << " at dest " << table->LookupReactive(Mac48Address("01:00:00:02:00:01")).retransmitter << " with metric "<< table->LookupReactive(Mac48Address("01:00:00:02:00:01")).metric <<"\n");
- NS_LOG_UNCOND("Added reactive path number "<<table->LookupReactive(Mac48Address("01:00:00:03:00:01")).seqnum << " at dest " << table->LookupReactive(Mac48Address("01:00:00:03:00:01")).retransmitter << " with metric "<< table->LookupReactive(Mac48Address("01:00:00:03:00:01")).metric <<"\n");
- NS_LOG_UNCOND("Added reactive path number "<<table->LookupReactive(Mac48Address("01:00:00:04:00:01")).seqnum << " at dest " << table->LookupReactive(Mac48Address("01:00:00:04:00:01")).retransmitter << " with metric "<< table->LookupReactive(Mac48Address("01:00:00:04:00:01")).metric <<"\n");
+ NS_LOG_UNCOND ("Added reactive path number " <<
+ table->LookupReactive (Mac48Address ("01:00:00:01:00:01")).seqnum <<
+ " at dest " <<
+ table->LookupReactive (Mac48Address ("01:00:00:01:00:01")).retransmitter <<
+ " with metric " <<
+ table->LookupReactive (Mac48Address ("01:00:00:01:00:01")).metric << "\n");
+ NS_LOG_UNCOND ("Added reactive path number " <<
+ table->LookupReactive (Mac48Address ("01:00:00:02:00:01")).seqnum <<
+ " at dest " <<
+ table->LookupReactive (Mac48Address ("01:00:00:02:00:01")).retransmitter <<
+ " with metric " <<
+ table->LookupReactive (Mac48Address ("01:00:00:02:00:01")).metric << "\n");
+ NS_LOG_UNCOND ("Added reactive path number " <<
+ table->LookupReactive (Mac48Address ("01:00:00:03:00:01")).seqnum <<
+ " at dest " <<
+ table->LookupReactive (Mac48Address ("01:00:00:03:00:01")).retransmitter <<
+ " with metric " <<
+ table->LookupReactive (Mac48Address ("01:00:00:03:00:01")).metric << "\n");
+ NS_LOG_UNCOND ("Added reactive path number " <<
+ table->LookupReactive (Mac48Address ("01:00:00:04:00:01")).seqnum <<
+ " at dest " <<
+ table->LookupReactive (Mac48Address ("01:00:00:04:00:01")).retransmitter <<
+ " with metric " << table->LookupReactive (Mac48Address ("01:00:00:04:00:01")).metric <<"\n");
- NS_LOG_UNCOND("Added proactive path number " << table->LookupProactive(8010).seqnum <<" with retr "<< table->LookupProactive(8010).retransmitter<< " at port " <<table->LookupProactive(8010).ifIndex<< " with metric " <<table->LookupProactive(8010).metric<<"\n");
- NS_LOG_UNCOND("Added proactive path number " << table->LookupProactive(8020).seqnum <<" with retr "<< table->LookupProactive(8020).retransmitter<< " at port " <<table->LookupProactive(8020).ifIndex<< " with metric " <<table->LookupProactive(8020).metric<<"\n");
- NS_LOG_UNCOND("Added proactive path number " << table->LookupProactive(8030).seqnum <<" with retr "<< table->LookupProactive(8030).retransmitter<< " at port " <<table->LookupProactive(8030).ifIndex<< " with metric " <<table->LookupProactive(8030).metric<<"\n");
- NS_LOG_UNCOND("Added proactive path number " << table->LookupProactive(8040).seqnum <<" with retr "<< table->LookupProactive(8040).retransmitter<< " at port " <<table->LookupProactive(8040).ifIndex<< " with metric " <<table->LookupProactive(8040).metric<<"\n");
+ NS_LOG_UNCOND ("Added proactive path number " <<
+ table->LookupProactive (8010).seqnum <<
+ " with retr " <<
+ table->LookupProactive (8010).retransmitter <<
+ " at port " <<
+ table->LookupProactive (8010).ifIndex <<
+ " with metric " <<
+ table->LookupProactive (8010).metric << "\n");
+ NS_LOG_UNCOND ("Added proactive path number " <<
+ table->LookupProactive (8020).seqnum <<
+ " with retr " <<
+ table->LookupProactive (8020).retransmitter <<
+ " at port " <<
+ table->LookupProactive (8020).ifIndex <<
+ " with metric " <<
+ table->LookupProactive (8020).metric <<"\n");
+ NS_LOG_UNCOND ("Added proactive path number " <<
+ table->LookupProactive (8030).seqnum <<
+ " with retr " <<
+ table->LookupProactive (8030).retransmitter <<
+ " at port " <<
+ table->LookupProactive (8030).ifIndex <<
+ " with metric " <<
+ table->LookupProactive (8030).metric << "\n");
+ NS_LOG_UNCOND ("Added proactive path number " <<
+ table->LookupProactive (8040).seqnum <<
+ " with retr " <<
+ table->LookupProactive (8040).retransmitter <<
+ " at port " <<
+ table->LookupProactive (8040).ifIndex <<
+ " with metric " <<
+ table->LookupProactive (8040).metric << "\n");
- table->DeleteProactivePath(8030);
- table->DeleteProactivePath(Mac48Address("01:00:00:04:00:01"),8040);
- Simulator::Schedule(Seconds(1.0),
+ table->DeleteProactivePath (8030);
+ table->DeleteProactivePath (Mac48Address ("01:00:00:04:00:01"), 8040);
+ Simulator::Schedule (Seconds (1.0),
&aux_function1,
table,
- 8030,&test_results,&test_time);
- Simulator::Schedule(Seconds(1.0),
+ 8030,
+ &test_results,
+ &test_time);
+ Simulator::Schedule (Seconds (1.0),
&aux_function1,
table,
- 8040,&test_results,&test_time);
+ 8040,
+ &test_results,
+ &test_time);
- Simulator::Schedule(Seconds(10.0),
+ Simulator::Schedule (Seconds (10.0),
&HwmpRtable::DeleteReactivePath,
table,
- Mac48Address("01:00:00:02:00:01"),8020);
+ Mac48Address ("01:00:00:02:00:01"),
+ 8020);
- Simulator::Schedule(Seconds(15.0),
+ Simulator::Schedule (Seconds (15.0),
&aux_function,
table,
- Mac48Address("01:00:00:02:00:01"),&test_results,&test_time);
- Simulator::Schedule(Seconds(25.0),
+ Mac48Address ("01:00:00:02:00:01"),
+ &test_results,
+ &test_time);
+ Simulator::Schedule (Seconds (25.0),
&aux_function,
table,
- Mac48Address("01:00:00:01:00:01"),&test_results,&test_time);
- Simulator::Schedule(Seconds(25.0),
+ Mac48Address ("01:00:00:01:00:01"),
+ &test_results,
+ &test_time);
+ Simulator::Schedule (Seconds (25.0),
&aux_function,
table,
- Mac48Address("01:00:00:02:00:01"),&test_results,&test_time);
- Simulator::Schedule(Seconds(25.0),
+ Mac48Address ("01:00:00:02:00:01"),
+ &test_results,
+ &test_time);
+ Simulator::Schedule (Seconds (25.0),
&aux_function1,
table,
- 8010,&test_results,&test_time);
- Simulator::Schedule(Seconds(30.0),
+ 8010,
+ &test_results,
+ &test_time);
+ Simulator::Schedule (Seconds (30.0),
&aux_function,
table,
- Mac48Address("01:00:00:01:00:01"),&test_results,&test_time);
+ Mac48Address ("01:00:00:01:00:01"),
+ &test_results,
+ &test_time);
- Simulator::Schedule(Seconds(40.0),
+ Simulator::Schedule (Seconds (40.0),
&print_results,
- &test_results,&test_time);
- Simulator::Schedule(Seconds(41.0),
+ &test_results,
+ &test_time);
+ Simulator::Schedule (Seconds (41.0),
&get_conclusion,
&test_results);
- Simulator::Run();
- Simulator::Destroy();
+ Simulator::Run ();
+ Simulator::Destroy ();
return 0;
}
--- a/src/devices/mesh/802.11s/ie-dot11s-beacon-timing.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-beacon-timing.cc Wed Mar 18 22:36:12 2009 +0300
@@ -25,7 +25,7 @@
/*******************************************
* IeDot11sBeaconTimingUnit
*******************************************/
-IeDot11sBeaconTimingUnit::IeDot11sBeaconTimingUnit():
+IeDot11sBeaconTimingUnit::IeDot11sBeaconTimingUnit ():
m_aid (0),
m_lastBeacon (0),
m_beaconInterval (0)
@@ -33,37 +33,37 @@
}
void
-IeDot11sBeaconTimingUnit::SetAid(uint8_t aid)
+IeDot11sBeaconTimingUnit::SetAid (uint8_t aid)
{
m_aid = aid;
}
void
-IeDot11sBeaconTimingUnit::SetLastBeacon(uint16_t lastBeacon)
+IeDot11sBeaconTimingUnit::SetLastBeacon (uint16_t lastBeacon)
{
m_lastBeacon = lastBeacon;
}
void
-IeDot11sBeaconTimingUnit::SetBeaconInterval(uint16_t beaconInterval)
+IeDot11sBeaconTimingUnit::SetBeaconInterval (uint16_t beaconInterval)
{
m_beaconInterval = beaconInterval;
}
uint8_t
-IeDot11sBeaconTimingUnit::GetAid()
+IeDot11sBeaconTimingUnit::GetAid ()
{
return m_aid;
}
uint16_t
-IeDot11sBeaconTimingUnit::GetLastBeacon()
+IeDot11sBeaconTimingUnit::GetLastBeacon ()
{
return m_lastBeacon;
}
uint16_t
-IeDot11sBeaconTimingUnit::GetBeaconInterval()
+IeDot11sBeaconTimingUnit::GetBeaconInterval ()
{
return m_beaconInterval;
}
@@ -71,76 +71,75 @@
/*******************************************
* IeDot11sBeaconTiming
*******************************************/
-IeDot11sBeaconTiming::IeDot11sBeaconTiming():
- m_numOfUnits(0)
+IeDot11sBeaconTiming::IeDot11sBeaconTiming ():
+ m_numOfUnits (0)
{
}
IeDot11sBeaconTiming::NeighboursTimingUnitsList
-IeDot11sBeaconTiming::GetNeighboursTimingElementsList()
+IeDot11sBeaconTiming::GetNeighboursTimingElementsList ()
{
return m_neighbours;
}
void
-IeDot11sBeaconTiming::AddNeighboursTimingElementUnit(
+IeDot11sBeaconTiming::AddNeighboursTimingElementUnit (
uint16_t aid,
Time last_beacon, //MicroSeconds!
Time beacon_interval //MicroSeconds!
)
{
- if(m_numOfUnits == 50)
+ if (m_numOfUnits == 50)
return;
//Firs we lookup if this element already exists
- for (NeighboursTimingUnitsList::iterator i = m_neighbours.begin(); i!= m_neighbours.end(); i++)
+ for (NeighboursTimingUnitsList::iterator i = m_neighbours.begin (); i != m_neighbours.end(); i++)
if (
- ((*i)->GetAid() == AidToU8(aid))
- && ((*i)->GetLastBeacon() == TimestampToU16(last_beacon))
- && ((*i)->GetBeaconInterval() == BeaconIntervalToU16(beacon_interval))
+ ((*i)->GetAid () == AidToU8(aid))
+ && ((*i)->GetLastBeacon () == TimestampToU16(last_beacon))
+ && ((*i)->GetBeaconInterval () == BeaconIntervalToU16(beacon_interval))
)
return;
- Ptr<IeDot11sBeaconTimingUnit>new_element = Create<IeDot11sBeaconTimingUnit>();
- new_element->SetAid(AidToU8(aid));
- new_element->SetLastBeacon(TimestampToU16(last_beacon));
- new_element->SetBeaconInterval(BeaconIntervalToU16(beacon_interval));
- m_neighbours.push_back(new_element);
+ Ptr<IeDot11sBeaconTimingUnit>new_element = Create<IeDot11sBeaconTimingUnit> ();
+ new_element->SetAid (AidToU8(aid));
+ new_element->SetLastBeacon (TimestampToU16(last_beacon));
+ new_element->SetBeaconInterval (BeaconIntervalToU16(beacon_interval));
+ m_neighbours.push_back (new_element);
m_numOfUnits++;
}
void
-IeDot11sBeaconTiming::DelNeighboursTimingElementUnit(
+IeDot11sBeaconTiming::DelNeighboursTimingElementUnit (
uint16_t aid,
Time last_beacon, //MicroSeconds!
Time beacon_interval //MicroSeconds!
)
{
- for (NeighboursTimingUnitsList::iterator i = m_neighbours.begin(); i!= m_neighbours.end(); i++)
+ for (NeighboursTimingUnitsList::iterator i = m_neighbours.begin (); i != m_neighbours.end(); i++)
if (
- ((*i)->GetAid() == AidToU8(aid))
- && ((*i)->GetLastBeacon() == TimestampToU16(last_beacon))
- && ((*i)->GetBeaconInterval() == BeaconIntervalToU16(beacon_interval))
+ ((*i)->GetAid () == AidToU8(aid))
+ && ((*i)->GetLastBeacon () == TimestampToU16(last_beacon))
+ && ((*i)->GetBeaconInterval () == BeaconIntervalToU16(beacon_interval))
)
{
- m_neighbours.erase(i);
+ m_neighbours.erase (i);
m_numOfUnits--;
break;
}
-
}
void
-IeDot11sBeaconTiming::ClearTimingElement()
+IeDot11sBeaconTiming::ClearTimingElement ()
{
uint16_t to_delete = 0;
uint16_t i;
- for (NeighboursTimingUnitsList::iterator j = m_neighbours.begin(); j!= m_neighbours.end(); j++)
+ for (NeighboursTimingUnitsList::iterator j = m_neighbours.begin (); j != m_neighbours.end(); j++)
{
to_delete++;
(*j) = 0;
}
for (i = 0; i < to_delete; i ++)
- m_neighbours.pop_back();
- m_neighbours.clear();
+ m_neighbours.pop_back ();
+ m_neighbours.clear ();
}
@@ -151,7 +150,7 @@
}
void
-IeDot11sBeaconTiming::PrintInformation(std::ostream& os) const
+IeDot11sBeaconTiming::PrintInformation (std::ostream& os) const
{
//TODO
}
@@ -159,11 +158,11 @@
void
IeDot11sBeaconTiming::SerializeInformation (Buffer::Iterator i) const
{
- for (NeighboursTimingUnitsList::const_iterator j = m_neighbours.begin(); j!= m_neighbours.end(); j++)
+ for (NeighboursTimingUnitsList::const_iterator j = m_neighbours.begin (); j != m_neighbours.end(); j++)
{
- i.WriteU8 ((*j)->GetAid());
- i.WriteHtonU16 ((*j)->GetLastBeacon());
- i.WriteHtonU16 ((*j)->GetBeaconInterval());
+ i.WriteU8 ((*j)->GetAid ());
+ i.WriteHtonU16 ((*j)->GetLastBeacon ());
+ i.WriteHtonU16 ((*j)->GetBeaconInterval ());
}
}
uint8_t
@@ -173,30 +172,30 @@
m_numOfUnits = length/5;
for (int j = 0; j < m_numOfUnits; j ++)
{
- Ptr<IeDot11sBeaconTimingUnit> new_element = Create<IeDot11sBeaconTimingUnit>();
- new_element->SetAid(i.ReadU8());
- new_element->SetLastBeacon(i.ReadNtohU16());
- new_element->SetBeaconInterval(i.ReadNtohU16());
- m_neighbours.push_back(new_element);
+ Ptr<IeDot11sBeaconTimingUnit> new_element = Create<IeDot11sBeaconTimingUnit> ();
+ new_element->SetAid (i.ReadU8());
+ new_element->SetLastBeacon (i.ReadNtohU16());
+ new_element->SetBeaconInterval (i.ReadNtohU16());
+ m_neighbours.push_back (new_element);
}
- return i.GetDistanceFrom(start);
+ return i.GetDistanceFrom (start);
};
uint16_t
-IeDot11sBeaconTiming::TimestampToU16(Time x)
+IeDot11sBeaconTiming::TimestampToU16 (Time x)
{
- return ((uint16_t)((x.GetMicroSeconds() >> 8)&0xffff));
+ return ((uint16_t) ((x.GetMicroSeconds() >> 8)&0xffff));
};
uint16_t
-IeDot11sBeaconTiming::BeaconIntervalToU16(Time x)
+IeDot11sBeaconTiming::BeaconIntervalToU16 (Time x)
{
- return ((uint16_t)(x.GetMicroSeconds() >>10)&0xffff);
+ return ((uint16_t) (x.GetMicroSeconds() >>10)&0xffff);
};
uint8_t
-IeDot11sBeaconTiming::AidToU8(uint16_t x)
+IeDot11sBeaconTiming::AidToU8 (uint16_t x)
{
- return (uint8_t)(x&0xff);
+ return (uint8_t) (x&0xff);
};
} //namespace ns3
--- a/src/devices/mesh/802.11s/ie-dot11s-beacon-timing.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-beacon-timing.h Wed Mar 18 22:36:12 2009 +0300
@@ -36,14 +36,14 @@
class IeDot11sBeaconTimingUnit : public RefCountBase
{
public:
- IeDot11sBeaconTimingUnit();
- void SetAid(uint8_t aid);
- void SetLastBeacon(uint16_t last_beacon);
- void SetBeaconInterval(uint16_t beacon_interval);
+ IeDot11sBeaconTimingUnit ();
+ void SetAid (uint8_t aid);
+ void SetLastBeacon (uint16_t last_beacon);
+ void SetBeaconInterval (uint16_t beacon_interval);
- uint8_t GetAid();
- uint16_t GetLastBeacon();
- uint16_t GetBeaconInterval();
+ uint8_t GetAid ();
+ uint16_t GetLastBeacon ();
+ uint16_t GetBeaconInterval ();
/**
* \brief Least significant octet of AID:
*/
@@ -72,37 +72,37 @@
*/
typedef std::list< Ptr<IeDot11sBeaconTimingUnit> > NeighboursTimingUnitsList;
- IeDot11sBeaconTiming();
+ IeDot11sBeaconTiming ();
/**
* This methods are needed for beacon collision
* avoidance module:
*/
- NeighboursTimingUnitsList GetNeighboursTimingElementsList();
- void AddNeighboursTimingElementUnit(
+ NeighboursTimingUnitsList GetNeighboursTimingElementsList ();
+ void AddNeighboursTimingElementUnit (
uint16_t aid,
Time last_beacon,
Time beacon_interval
);
- void DelNeighboursTimingElementUnit(
+ void DelNeighboursTimingElementUnit (
uint16_t aid,
Time last_beacon,
Time beacon_interval
);
- void ClearTimingElement();
+ void ClearTimingElement ();
private:
- WifiElementId ElementId() const {
+ WifiElementId ElementId () const {
return IE11S_BEACON_TIMING;
}
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;
+ void PrintInformation (std::ostream& os) const;
/**
* Converters:
*/
- static uint16_t TimestampToU16(Time x);
- static uint16_t BeaconIntervalToU16(Time x);
- static uint8_t AidToU8(uint16_t x);
+ static uint16_t TimestampToU16 (Time x);
+ static uint16_t BeaconIntervalToU16 (Time x);
+ static uint8_t AidToU8 (uint16_t x);
NeighboursTimingUnitsList m_neighbours;
/**
--- a/src/devices/mesh/802.11s/ie-dot11s-configuration.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-configuration.cc Wed Mar 18 22:36:12 2009 +0300
@@ -24,62 +24,62 @@
namespace ns3 {
-dot11sMeshCapability::dot11sMeshCapability():
- acceptPeerLinks(true),
- MDAEnabled(false),
- forwarding(true),
- beaconTimingReport(false),
- TBTTAdjustment(false),
- powerSaveLevel(false)
+dot11sMeshCapability::dot11sMeshCapability ():
+ acceptPeerLinks (true),
+ MDAEnabled (false),
+ forwarding (true),
+ beaconTimingReport (false),
+ TBTTAdjustment (false),
+ powerSaveLevel (false)
{}
uint8_t dot11sMeshCapability::GetSerializedSize () const
- {
- return 2;
- }
+{
+ return 2;
+}
Buffer::Iterator dot11sMeshCapability::Serialize (Buffer::Iterator i) const
- {
- uint16_t result = 0;
- if (acceptPeerLinks)
- result |= 1 << 0;
- if (MDAEnabled)
- result |= 1 << 1;
- if (forwarding)
- result |= 1 << 2;
- if (beaconTimingReport)
- result |= 1 << 3;
- if (TBTTAdjustment)
- result |= 1 << 4;
- if (powerSaveLevel)
- result |= 1 << 5;
- i.WriteHtonU16(result);
- return i;
- }
+{
+ uint16_t result = 0;
+ if (acceptPeerLinks)
+ result |= 1 << 0;
+ if (MDAEnabled)
+ result |= 1 << 1;
+ if (forwarding)
+ result |= 1 << 2;
+ if (beaconTimingReport)
+ result |= 1 << 3;
+ if (TBTTAdjustment)
+ result |= 1 << 4;
+ if (powerSaveLevel)
+ result |= 1 << 5;
+ i.WriteHtonU16 (result);
+ return i;
+}
Buffer::Iterator dot11sMeshCapability::Deserialize (Buffer::Iterator i)
{
- uint16_t cap = i.ReadNtohU16();
- acceptPeerLinks = Is(cap, 0);
- MDAEnabled = Is(cap, 1);
- forwarding = Is(cap, 2);
- beaconTimingReport = Is(cap, 3);
- TBTTAdjustment = Is(cap, 4);
- powerSaveLevel = Is(cap, 5);
+ uint16_t cap = i.ReadNtohU16 ();
+ acceptPeerLinks = Is (cap, 0);
+ MDAEnabled = Is (cap, 1);
+ forwarding = Is (cap, 2);
+ beaconTimingReport = Is (cap, 3);
+ TBTTAdjustment = Is (cap, 4);
+ powerSaveLevel = Is (cap, 5);
return i;
}
-bool dot11sMeshCapability::Is(uint16_t cap, uint8_t n) const
- {
- uint16_t mask = 1<<n;
- return (cap & mask) == mask;
- }
+bool dot11sMeshCapability::Is (uint16_t cap, uint8_t n) const
+{
+ uint16_t mask = 1<<n;
+ return (cap & mask) == mask;
+}
IeDot11sConfiguration::IeDot11sConfiguration ():
- m_APSId(PROTOCOL_HWMP),
- m_APSMId(METRIC_AIRTIME),
- m_CCMId(CONGESTION_DEFAULT),
- m_CP(CHANNEL_PRECEDENCE_OFF)
+ m_APSId (PROTOCOL_HWMP),
+ m_APSMId (METRIC_AIRTIME),
+ m_CCMId (CONGESTION_DEFAULT),
+ m_CP (CHANNEL_PRECEDENCE_OFF)
{}
TypeId
@@ -93,32 +93,32 @@
TypeId
IeDot11sConfiguration::GetInstanceTypeId () const
{
- return GetTypeId();
+ return GetTypeId ();
}
uint8_t
IeDot11sConfiguration::GetInformationSize () const
{
- return 1 // Version
- + 4 // APSPId
- + 4 // APSMId
- + 4 // CCMId
- + 4 // CP
- + m_meshCap.GetSerializedSize();
+ return 1 // Version
+ + 4 // APSPId
+ + 4 // APSMId
+ + 4 // CCMId
+ + 4 // CP
+ + m_meshCap.GetSerializedSize ();
}
void
IeDot11sConfiguration::SerializeInformation (Buffer::Iterator i) const
{
- i.WriteU8 (1); //Version
- // Active Path Selection Protocol ID:
- i.WriteHtonU32 (m_APSId);
- // Active Path Metric ID:
- i.WriteHtonU32 (m_APSMId);
- // Congestion Control Mode ID:
- i.WriteU32 (m_CCMId);
- // Channel Precedence:
- i.WriteU32 (m_CP);
- m_meshCap.Serialize (i);
+ i.WriteU8 (1); //Version
+ // Active Path Selection Protocol ID:
+ i.WriteHtonU32 (m_APSId);
+ // Active Path Metric ID:
+ i.WriteHtonU32 (m_APSMId);
+ // Congestion Control Mode ID:
+ i.WriteU32 (m_CCMId);
+ // Channel Precedence:
+ i.WriteU32 (m_CP);
+ m_meshCap.Serialize (i);
}
uint8_t
@@ -136,38 +136,38 @@
// Channel Precedence:
m_CP = (dot11sChannelPrecedence)i.ReadU32 ();
i = m_meshCap.Deserialize (i);
- return i.GetDistanceFrom(start);
+ return i.GetDistanceFrom (start);
}
void
-IeDot11sConfiguration::PrintInformation(std::ostream& os) const
+IeDot11sConfiguration::PrintInformation (std::ostream& os) const
{
//TODO: print
}
void
-IeDot11sConfiguration::SetRouting(dot11sPathSelectionProtocol routingId)
+IeDot11sConfiguration::SetRouting (dot11sPathSelectionProtocol routingId)
{
m_APSId = routingId;
}
void
-IeDot11sConfiguration::SetMetric(dot11sPathSelectionMetric metricId)
+IeDot11sConfiguration::SetMetric (dot11sPathSelectionMetric metricId)
{
m_APSMId = metricId;
}
bool
-IeDot11sConfiguration::IsHWMP()
+IeDot11sConfiguration::IsHWMP ()
{
return (m_APSId == PROTOCOL_HWMP);
}
bool
-IeDot11sConfiguration::IsAirtime()
+IeDot11sConfiguration::IsAirtime ()
{
return (m_APSMId == METRIC_AIRTIME);
}
-dot11sMeshCapability const& IeDot11sConfiguration::MeshCapability()
+dot11sMeshCapability const& IeDot11sConfiguration::MeshCapability ()
{
return m_meshCap;
}
--- a/src/devices/mesh/802.11s/ie-dot11s-configuration.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-configuration.h Wed Mar 18 22:36:12 2009 +0300
@@ -69,7 +69,7 @@
class dot11sMeshCapability
{
public:
- dot11sMeshCapability();
+ dot11sMeshCapability ();
uint8_t GetSerializedSize () const;
Buffer::Iterator Serialize (Buffer::Iterator i) const;
Buffer::Iterator Deserialize (Buffer::Iterator i);
@@ -80,7 +80,7 @@
bool TBTTAdjustment;
bool powerSaveLevel;
- bool Is(uint16_t cap,uint8_t n) const;
+ bool Is (uint16_t cap,uint8_t n) const;
};
/**
@@ -94,13 +94,13 @@
static TypeId GetTypeId ();
TypeId GetInstanceTypeId () const;
- IeDot11sConfiguration();
- void SetRouting(dot11sPathSelectionProtocol routingId);
- void SetMetric(dot11sPathSelectionMetric metricId);
- bool IsHWMP();
- bool IsAirtime();
+ IeDot11sConfiguration ();
+ void SetRouting (dot11sPathSelectionProtocol routingId);
+ void SetMetric (dot11sPathSelectionMetric metricId);
+ bool IsHWMP ();
+ bool IsAirtime ();
- dot11sMeshCapability const& MeshCapability();
+ dot11sMeshCapability const& MeshCapability ();
private:
WifiElementId ElementId () const
{
@@ -109,7 +109,7 @@
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;
+ void PrintInformation (std::ostream& os) const;
/** Active Path Selection Protocol ID */
dot11sPathSelectionProtocol m_APSId;
/** Active Path Metric ID */
--- a/src/devices/mesh/802.11s/ie-dot11s-peer-management.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-peer-management.cc Wed Mar 18 22:36:12 2009 +0300
@@ -29,23 +29,23 @@
namespace ns3 {
IeDot11sPeerManagement::IeDot11sPeerManagement ():
- m_length(0),
- m_subtype(PEER_OPEN),
- m_localLinkId(0),
- m_peerLinkId(0),
- m_reasonCode(REASON11S_RESERVED)
+ m_length (0),
+ m_subtype (PEER_OPEN),
+ m_localLinkId (0),
+ m_peerLinkId (0),
+ m_reasonCode (REASON11S_RESERVED)
{}
void
-IeDot11sPeerManagement::SetPeerOpen(uint16_t localLinkId)
+IeDot11sPeerManagement::SetPeerOpen (uint16_t localLinkId)
{
m_length = 3;
m_subtype = PEER_OPEN;
m_localLinkId = localLinkId;
}
void
-IeDot11sPeerManagement::SetPeerClose(uint16_t localLinkId, uint16_t peerLinkId, dot11sReasonCode reasonCode)
+IeDot11sPeerManagement::SetPeerClose (uint16_t localLinkId, uint16_t peerLinkId, dot11sReasonCode reasonCode)
{
m_length = 7;
m_subtype = PEER_CLOSE;
@@ -55,7 +55,7 @@
}
void
-IeDot11sPeerManagement::SetPeerConfirm(uint16_t localLinkId, uint16_t peerLinkId)
+IeDot11sPeerManagement::SetPeerConfirm (uint16_t localLinkId, uint16_t peerLinkId)
{
m_length = 5;
m_subtype = PEER_CONFIRM;
@@ -64,76 +64,76 @@
}
dot11sReasonCode
-IeDot11sPeerManagement::GetReasonCode() const
- {
- return m_reasonCode;
- }
+IeDot11sPeerManagement::GetReasonCode () const
+{
+ return m_reasonCode;
+}
uint16_t
-IeDot11sPeerManagement::GetLocalLinkId() const
- {
- return m_localLinkId;
- }
+IeDot11sPeerManagement::GetLocalLinkId () const
+{
+ return m_localLinkId;
+}
uint16_t
-IeDot11sPeerManagement::GetPeerLinkId() const
- {
- return m_peerLinkId;
- }
+IeDot11sPeerManagement::GetPeerLinkId () const
+{
+ return m_peerLinkId;
+}
uint8_t
IeDot11sPeerManagement::GetInformationSize (void) const
- {
- return m_length;
- }
+{
+ return m_length;
+}
bool
-IeDot11sPeerManagement::SubtypeIsOpen() const
- {
- return (m_subtype == PEER_OPEN);
- }
+IeDot11sPeerManagement::SubtypeIsOpen () const
+{
+ return (m_subtype == PEER_OPEN);
+}
bool
-IeDot11sPeerManagement::SubtypeIsClose() const
- {
- return (m_subtype == PEER_CLOSE);
- }
+IeDot11sPeerManagement::SubtypeIsClose () const
+{
+ return (m_subtype == PEER_CLOSE);
+}
bool
-IeDot11sPeerManagement::SubtypeIsConfirm() const
- {
- return (m_subtype == PEER_CONFIRM);
- }
+IeDot11sPeerManagement::SubtypeIsConfirm () const
+{
+ return (m_subtype == PEER_CONFIRM);
+}
void
IeDot11sPeerManagement::SerializeInformation (Buffer::Iterator i) const
- {
- i.WriteU8(m_subtype);
- i.WriteHtonU16(m_localLinkId);
- if (m_length > 3)
- i.WriteHtonU16(m_peerLinkId);
- if (m_length > 5)
- i.WriteHtonU16(m_reasonCode);
- }
+{
+ i.WriteU8 (m_subtype);
+ i.WriteHtonU16 (m_localLinkId);
+ if (m_length > 3)
+ i.WriteHtonU16 (m_peerLinkId);
+ if (m_length > 5)
+ i.WriteHtonU16 (m_reasonCode);
+}
uint8_t
IeDot11sPeerManagement::DeserializeInformation (Buffer::Iterator start, uint8_t length)
{
Buffer::Iterator i = start;
- m_subtype = i.ReadU8();
+ m_subtype = i.ReadU8 ();
m_length = length;
if (m_subtype == PEER_OPEN)
- NS_ASSERT(length == 3);
+ NS_ASSERT (length == 3);
if (m_subtype == PEER_CONFIRM)
- NS_ASSERT(length == 5);
+ NS_ASSERT (length == 5);
if (m_subtype == PEER_CLOSE)
- NS_ASSERT(length == 7);
- m_localLinkId = i.ReadNtohU16();
+ NS_ASSERT (length == 7);
+ m_localLinkId = i.ReadNtohU16 ();
if (m_length > 3)
- m_peerLinkId = i.ReadNtohU16();
+ m_peerLinkId = i.ReadNtohU16 ();
if (m_length > 5)
- m_reasonCode = (dot11sReasonCode)i.ReadNtohU16();
- return i.GetDistanceFrom(start);
+ m_reasonCode = (dot11sReasonCode)i.ReadNtohU16 ();
+ return i.GetDistanceFrom (start);
}
void
-IeDot11sPeerManagement::PrintInformation(std::ostream& os) const
+IeDot11sPeerManagement::PrintInformation (std::ostream& os) const
{
//TODO
}
--- a/src/devices/mesh/802.11s/ie-dot11s-peer-management.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-peer-management.h Wed Mar 18 22:36:12 2009 +0300
@@ -41,24 +41,24 @@
};
IeDot11sPeerManagement ();
- void SetPeerOpen(uint16_t localLinkId);
- void SetPeerClose(uint16_t localLinkID, uint16_t peerLinkId, dot11sReasonCode reasonCode);
- void SetPeerConfirm(uint16_t localLinkID, uint16_t peerLinkId);
+ void SetPeerOpen (uint16_t localLinkId);
+ void SetPeerClose (uint16_t localLinkID, uint16_t peerLinkId, dot11sReasonCode reasonCode);
+ void SetPeerConfirm (uint16_t localLinkID, uint16_t peerLinkId);
- dot11sReasonCode GetReasonCode() const;
- uint16_t GetLocalLinkId() const;
- uint16_t GetPeerLinkId() const;
- bool SubtypeIsOpen() const;
- bool SubtypeIsClose() const;
- bool SubtypeIsConfirm() const ;
+ dot11sReasonCode GetReasonCode () const;
+ uint16_t GetLocalLinkId () const;
+ uint16_t GetPeerLinkId () const;
+ bool SubtypeIsOpen () const;
+ bool SubtypeIsClose () const;
+ bool SubtypeIsConfirm () const ;
private:
- WifiElementId ElementId() const{
+ WifiElementId ElementId () const{
return IE11S_PEER_LINK_MANAGEMENT;
}
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;
+ void PrintInformation (std::ostream& os) const;
uint8_t m_length;
uint8_t m_subtype;
uint16_t m_localLinkId;
--- a/src/devices/mesh/802.11s/ie-dot11s-perr.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-perr.cc Wed Mar 18 22:36:12 2009 +0300
@@ -24,109 +24,109 @@
#include "ns3/node.h"
namespace ns3 {
-IeDot11sPerr::~IeDot11sPerr()
+IeDot11sPerr::~IeDot11sPerr ()
{
}
TypeId
-IeDot11sPerr::GetTypeId()
+IeDot11sPerr::GetTypeId ()
{
static TypeId tid = TypeId ("ns3::IeDot11sPerr")
.SetParent<Object> ();
return tid;
}
void
-IeDot11sPerr::PrintInformation(std::ostream &os) const
- {
+IeDot11sPerr::PrintInformation (std::ostream &os) const
+{
// FILL
- }
+}
TypeId
-IeDot11sPerr::GetInstanceTypeId() const
- {
- return GetTypeId();
- }
-IeDot11sPerr::IeDot11sPerr():
- m_numOfDest(0)
+IeDot11sPerr::GetInstanceTypeId () const
+{
+ return GetTypeId ();
+}
+IeDot11sPerr::IeDot11sPerr ():
+ m_numOfDest (0)
{
}
uint8_t
-IeDot11sPerr::GetNumOfDest()
+IeDot11sPerr::GetNumOfDest ()
{
return m_numOfDest;
}
void
-IeDot11sPerr::SerializeInformation(Buffer::Iterator i)const
- {
- i.WriteU8 (0);
- i.WriteU8 (m_numOfDest);
- NS_ASSERT (m_numOfDest == m_addressUnits.size());
- for (unsigned int j = 0; j < m_numOfDest; j++)
- {
- WriteTo (i, m_addressUnits[j].destination);
- i.WriteHtonU32 (m_addressUnits[j].seqnum);
- }
- }
+IeDot11sPerr::SerializeInformation (Buffer::Iterator i) const
+{
+ i.WriteU8 (0);
+ i.WriteU8 (m_numOfDest);
+ NS_ASSERT (m_numOfDest == m_addressUnits.size ());
+ for (unsigned int j = 0; j < m_numOfDest; j++)
+ {
+ WriteTo (i, m_addressUnits[j].destination);
+ i.WriteHtonU32 (m_addressUnits[j].seqnum);
+ }
+}
uint8_t
-IeDot11sPerr::DeserializeInformation(Buffer::Iterator start, uint8_t length)
+IeDot11sPerr::DeserializeInformation (Buffer::Iterator start, uint8_t length)
{
Buffer::Iterator i = start;
i.Next (1); //Mode flags is not used now
- m_numOfDest = i.ReadU8();
+ m_numOfDest = i.ReadU8 ();
NS_ASSERT ((2+10*m_numOfDest) == length);
length = 0; //to avoid compiler warning in optimized builds
for (unsigned int j = 0; j < m_numOfDest; j++)
{
HwmpRtable::FailedDestination unit;
- ReadFrom(i,unit.destination);
- unit.seqnum = i.ReadNtohU32();
- m_addressUnits.push_back(unit);
+ ReadFrom (i,unit.destination);
+ unit.seqnum = i.ReadNtohU32 ();
+ m_addressUnits.push_back (unit);
}
- return i.GetDistanceFrom(start);
+ return i.GetDistanceFrom (start);
}
uint8_t
-IeDot11sPerr::GetInformationSize() const
- {
- uint8_t retval =
- 1 //ModeFlags
- +1 //NumOfDests
- +6*m_numOfDest
- +4*m_numOfDest;
- return retval;
- }
+IeDot11sPerr::GetInformationSize () const
+{
+ uint8_t retval =
+ 1 //ModeFlags
+ +1 //NumOfDests
+ +6*m_numOfDest
+ +4*m_numOfDest;
+ return retval;
+}
void
-IeDot11sPerr::AddAddressUnit(HwmpRtable::FailedDestination unit)
+IeDot11sPerr::AddAddressUnit (HwmpRtable::FailedDestination unit)
{
- for (unsigned int i = 0; i < m_addressUnits.size(); i ++)
+ for (unsigned int i = 0; i < m_addressUnits.size (); i ++)
if (m_addressUnits[i].destination == unit.destination)
return;
- m_addressUnits.push_back(unit);
+ m_addressUnits.push_back (unit);
m_numOfDest++;
}
std::vector<HwmpRtable::FailedDestination>
-IeDot11sPerr::GetAddressUnitVector()
+IeDot11sPerr::GetAddressUnitVector ()
{
return m_addressUnits;
}
void
-IeDot11sPerr::DeleteAddressUnit(Mac48Address address)
+IeDot11sPerr::DeleteAddressUnit (Mac48Address address)
{
- for (std::vector<HwmpRtable::FailedDestination>::iterator i = m_addressUnits.begin(); i != m_addressUnits.end(); i ++)
+ for (std::vector<HwmpRtable::FailedDestination>::iterator i = m_addressUnits.begin (); i != m_addressUnits.end(); i ++)
if ((*i).destination == address)
{
m_numOfDest --;
- m_addressUnits.erase(i);
+ m_addressUnits.erase (i);
break;
}
}
void
-IeDot11sPerr::ResetPerr()
+IeDot11sPerr::ResetPerr ()
{
m_numOfDest = 0;
- m_addressUnits.clear();
+ m_addressUnits.clear ();
}
}//namespace ns3
--- a/src/devices/mesh/802.11s/ie-dot11s-perr.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-perr.h Wed Mar 18 22:36:12 2009 +0300
@@ -35,30 +35,30 @@
class IeDot11sPerr : public WifiInformationElement
{
public:
- IeDot11sPerr();
- ~IeDot11sPerr();
- static TypeId GetTypeId();
- virtual TypeId GetInstanceTypeId() const;
+ IeDot11sPerr ();
+ ~IeDot11sPerr ();
+ static TypeId GetTypeId ();
+ virtual TypeId GetInstanceTypeId () const;
#if 0
//RESERVED in D2.07
- uint8_t GetModeFlags();
- void SetModeFlags(uint8_t flags);
+ uint8_t GetModeFlags ();
+ void SetModeFlags (uint8_t flags);
#endif
- uint8_t GetNumOfDest();
+ uint8_t GetNumOfDest ();
- void AddAddressUnit(struct HwmpRtable::FailedDestination unit);
+ void AddAddressUnit (struct HwmpRtable::FailedDestination unit);
std::vector<HwmpRtable::FailedDestination>
- GetAddressUnitVector();
- void DeleteAddressUnit(Mac48Address address);
- void ResetPerr();
+ GetAddressUnitVector ();
+ void DeleteAddressUnit (Mac48Address address);
+ void ResetPerr ();
private:
- WifiElementId ElementId() const{
+ WifiElementId ElementId () const{
return IE11S_PERR;
};
- 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;
+ 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;
uint8_t m_numOfDest;
std::vector<HwmpRtable::FailedDestination> m_addressUnits;
};
--- a/src/devices/mesh/802.11s/ie-dot11s-prep.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-prep.cc Wed Mar 18 22:36:12 2009 +0300
@@ -27,192 +27,191 @@
/********************************
* IeDot11sPrep
*******************************/
-IeDot11sPrep::~IeDot11sPrep()
+IeDot11sPrep::~IeDot11sPrep ()
{
}
TypeId
-IeDot11sPrep::GetTypeId()
+IeDot11sPrep::GetTypeId ()
{
static TypeId tid = TypeId ("ns3::IeDot11sPrep")
.SetParent<Object> ();
return tid;
}
void
-IeDot11sPrep::Print(std::ostream &os) const
- {
- //TODO:fill this method
- }
+IeDot11sPrep::Print (std::ostream &os) const
+{
+ //TODO:fill this method
+}
TypeId
-IeDot11sPrep::GetInstanceTypeId() const
- {
- return GetTypeId();
- }
-IeDot11sPrep::IeDot11sPrep():
- m_flags(0),
- m_hopcount(0),
- m_ttl(0),
- m_destinationAddress(Mac48Address::GetBroadcast()),
- m_destSeqNumber(0),
- m_lifetime(0),
- m_metric(0),
- m_originatorAddress(Mac48Address::GetBroadcast()),
- m_originatorSeqNumber(0)
+IeDot11sPrep::GetInstanceTypeId () const
+{
+ return GetTypeId ();
+}
+IeDot11sPrep::IeDot11sPrep ():
+ m_flags (0),
+ m_hopcount (0),
+ m_ttl (0),
+ m_destinationAddress (Mac48Address::GetBroadcast()),
+ m_destSeqNumber (0),
+ m_lifetime (0),
+ m_metric (0),
+ m_originatorAddress (Mac48Address::GetBroadcast()),
+ m_originatorSeqNumber (0)
{
}
void
-IeDot11sPrep::SetFlags(uint8_t flags)
+IeDot11sPrep::SetFlags (uint8_t flags)
{
m_flags = flags;
}
void
-IeDot11sPrep::SetHopcount(uint8_t hopcount)
+IeDot11sPrep::SetHopcount (uint8_t hopcount)
{
m_hopcount = hopcount;
}
void
-IeDot11sPrep::SetTTL(uint8_t ttl)
+IeDot11sPrep::SetTTL (uint8_t ttl)
{
m_ttl = ttl;
}
void
-IeDot11sPrep::SetDestinationSeqNumber(uint32_t dest_seq_number)
+IeDot11sPrep::SetDestinationSeqNumber (uint32_t dest_seq_number)
{
m_destSeqNumber = dest_seq_number;
}
void
-IeDot11sPrep::SetDestinationAddress(Mac48Address dest_address)
+IeDot11sPrep::SetDestinationAddress (Mac48Address dest_address)
{
m_destinationAddress = dest_address;
}
void
-IeDot11sPrep::SetMetric(uint32_t metric)
+IeDot11sPrep::SetMetric (uint32_t metric)
{
m_metric = metric;
}
void
-IeDot11sPrep::SetOriginatorAddress(Mac48Address originator_address)
+IeDot11sPrep::SetOriginatorAddress (Mac48Address originator_address)
{
m_originatorAddress = originator_address;
}
void
-IeDot11sPrep::SetOriginatorSeqNumber(uint32_t originator_seq_number)
+IeDot11sPrep::SetOriginatorSeqNumber (uint32_t originator_seq_number)
{
m_originatorSeqNumber = originator_seq_number;
}
void
-IeDot11sPrep::SetLifetime(uint32_t lifetime)
+IeDot11sPrep::SetLifetime (uint32_t lifetime)
{
m_lifetime = lifetime;
}
uint8_t
-IeDot11sPrep::GetFlags() const
- {
- return m_flags;
- }
+IeDot11sPrep::GetFlags () const
+{
+ return m_flags;
+}
uint8_t
-IeDot11sPrep::GetHopcount() const
- {
- return m_hopcount;
- }
+IeDot11sPrep::GetHopcount () const
+{
+ return m_hopcount;
+}
uint32_t
-IeDot11sPrep::GetTTL() const
- {
- return m_ttl;
- }
+IeDot11sPrep::GetTTL () const
+{
+ return m_ttl;
+}
uint32_t
-IeDot11sPrep::GetDestinationSeqNumber() const
- {
- return m_destSeqNumber;
- }
+IeDot11sPrep::GetDestinationSeqNumber () const
+{
+ return m_destSeqNumber;
+}
Mac48Address
-IeDot11sPrep::GetDestinationAddress() const
- {
- return m_destinationAddress;
- }
+IeDot11sPrep::GetDestinationAddress () const
+{
+ return m_destinationAddress;
+}
uint32_t
-IeDot11sPrep::GetMetric() const
- {
- return m_metric;
- }
+IeDot11sPrep::GetMetric () const
+{
+ return m_metric;
+}
Mac48Address
-IeDot11sPrep::GetOriginatorAddress() const
- {
- return m_originatorAddress;
- }
+IeDot11sPrep::GetOriginatorAddress () const
+{
+ return m_originatorAddress;
+}
uint32_t
-IeDot11sPrep::GetOriginatorSeqNumber() const
- {
- return m_originatorSeqNumber;
- }
+IeDot11sPrep::GetOriginatorSeqNumber () const
+{
+ return m_originatorSeqNumber;
+}
uint32_t
-IeDot11sPrep::GetLifetime() const
- {
- return m_lifetime;
- }
+IeDot11sPrep::GetLifetime () const
+{
+ return m_lifetime;
+}
void
-IeDot11sPrep::DecrementTtl()
+IeDot11sPrep::DecrementTtl ()
{
m_ttl --;
}
void
-IeDot11sPrep::IncrementMetric(uint32_t metric)
+IeDot11sPrep::IncrementMetric (uint32_t metric)
{
m_metric +=metric;
}
void
-IeDot11sPrep::SerializeInformation(Buffer::Iterator i) const
- {
- i.WriteU8 (m_flags);
- i.WriteU8 (m_hopcount);
- i.WriteU8 (m_ttl);
- WriteTo (i, m_destinationAddress);
- i.WriteHtonU32 (m_destSeqNumber);
- i.WriteHtonU32 (m_lifetime);
- i.WriteHtonU32 (m_metric);
- WriteTo (i, m_originatorAddress);
- i.WriteHtonU32 (m_originatorSeqNumber);
- }
+IeDot11sPrep::SerializeInformation (Buffer::Iterator i) const
+{
+ i.WriteU8 (m_flags);
+ i.WriteU8 (m_hopcount);
+ i.WriteU8 (m_ttl);
+ WriteTo (i, m_destinationAddress);
+ i.WriteHtonU32 (m_destSeqNumber);
+ i.WriteHtonU32 (m_lifetime);
+ i.WriteHtonU32 (m_metric);
+ WriteTo (i, m_originatorAddress);
+ i.WriteHtonU32 (m_originatorSeqNumber);
+}
uint8_t
-IeDot11sPrep::DeserializeInformation(Buffer::Iterator start, uint8_t length)
+IeDot11sPrep::DeserializeInformation (Buffer::Iterator start, uint8_t length)
{
Buffer::Iterator i = start;
- m_flags = i.ReadU8();
- m_hopcount = i.ReadU8();
- m_ttl = i.ReadU8();
+ m_flags = i.ReadU8 ();
+ m_hopcount = i.ReadU8 ();
+ m_ttl = i.ReadU8 ();
ReadFrom (i, m_destinationAddress);
- m_destSeqNumber = i.ReadNtohU32();
- m_lifetime = i.ReadNtohU32();
- m_metric = i.ReadNtohU32();
- ReadFrom(i, m_originatorAddress);
- m_originatorSeqNumber = i.ReadNtohU32();
- return i.GetDistanceFrom(start);
+ m_destSeqNumber = i.ReadNtohU32 ();
+ m_lifetime = i.ReadNtohU32 ();
+ m_metric = i.ReadNtohU32 ();
+ ReadFrom (i, m_originatorAddress);
+ m_originatorSeqNumber = i.ReadNtohU32 ();
+ return i.GetDistanceFrom (start);
}
uint8_t
-IeDot11sPrep::GetInformationSize() const
- {
- uint32_t retval =
- 1 //Element ID
- +1 //Length
- +1 //Flags
- +1 //Hopcount
- +1 //TTL
- +6 //Dest address
- +4 //Dest seqno
- +4 //Lifetime
- +4 //metric
- +6 //Originator address
- +4 //Originator seqno
- +1; //destination count
- return retval;
-
- };
+IeDot11sPrep::GetInformationSize () const
+{
+ uint32_t retval =
+ 1 //Element ID
+ +1 //Length
+ +1 //Flags
+ +1 //Hopcount
+ +1 //TTL
+ +6 //Dest address
+ +4 //Dest seqno
+ +4 //Lifetime
+ +4 //metric
+ +6 //Originator address
+ +4 //Originator seqno
+ +1; //destination count
+ return retval;
+};
void
-IeDot11sPrep::PrintInformation(std::ostream& os) const
+IeDot11sPrep::PrintInformation (std::ostream& os) const
{
//TODO
}
--- a/src/devices/mesh/802.11s/ie-dot11s-prep.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-prep.h Wed Mar 18 22:36:12 2009 +0300
@@ -35,41 +35,41 @@
class IeDot11sPrep : public WifiInformationElement
{
public:
- IeDot11sPrep();
- ~IeDot11sPrep();
- static TypeId GetTypeId();
- virtual TypeId GetInstanceTypeId() const;
- virtual void Print(std::ostream &os) const;
- void SetFlags(uint8_t flags);
- void SetHopcount(uint8_t hopcount);
- void SetTTL(uint8_t ttl);
- void SetDestinationAddress(Mac48Address dest_address);
- void SetDestinationSeqNumber(uint32_t dest_seq_number);
- void SetLifetime(uint32_t lifetime);
- void SetMetric(uint32_t metric);
- void SetOriginatorAddress(Mac48Address originator_address);
- void SetOriginatorSeqNumber(uint32_t originator_seg_number);
+ IeDot11sPrep ();
+ ~IeDot11sPrep ();
+ static TypeId GetTypeId ();
+ virtual TypeId GetInstanceTypeId () const;
+ virtual void Print (std::ostream &os) const;
+ void SetFlags (uint8_t flags);
+ void SetHopcount (uint8_t hopcount);
+ void SetTTL (uint8_t ttl);
+ void SetDestinationAddress (Mac48Address dest_address);
+ void SetDestinationSeqNumber (uint32_t dest_seq_number);
+ void SetLifetime (uint32_t lifetime);
+ void SetMetric (uint32_t metric);
+ void SetOriginatorAddress (Mac48Address originator_address);
+ void SetOriginatorSeqNumber (uint32_t originator_seg_number);
- uint8_t GetFlags() const;
- uint8_t GetHopcount() const;
- uint32_t GetTTL() const;
- Mac48Address GetDestinationAddress() const;
- uint32_t GetDestinationSeqNumber() const;
- uint32_t GetLifetime() const;
- uint32_t GetMetric() const;
- Mac48Address GetOriginatorAddress() const;
- uint32_t GetOriginatorSeqNumber()const ;
+ uint8_t GetFlags () const;
+ uint8_t GetHopcount () const;
+ uint32_t GetTTL () const;
+ Mac48Address GetDestinationAddress () const;
+ uint32_t GetDestinationSeqNumber () const;
+ uint32_t GetLifetime () const;
+ uint32_t GetMetric () const;
+ Mac48Address GetOriginatorAddress () const;
+ uint32_t GetOriginatorSeqNumber ()const ;
- void DecrementTtl();
- void IncrementMetric(uint32_t metric);
+ void DecrementTtl ();
+ void IncrementMetric (uint32_t metric);
private:
- WifiElementId ElementId() const{
+ WifiElementId ElementId () const{
return IE11S_PREP;
}
- void SerializeInformation(Buffer::Iterator i) const;
- uint8_t DeserializeInformation(Buffer::Iterator start, uint8_t length);
- uint8_t GetInformationSize() const;
- void PrintInformation(std::ostream& os) const;
+ void SerializeInformation (Buffer::Iterator i) const;
+ uint8_t DeserializeInformation (Buffer::Iterator start, uint8_t length);
+ uint8_t GetInformationSize () const;
+ void PrintInformation (std::ostream& os) const;
uint8_t m_flags;
uint8_t m_hopcount;
uint8_t m_ttl;
--- a/src/devices/mesh/802.11s/ie-dot11s-preq.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-preq.cc Wed Mar 18 22:36:12 2009 +0300
@@ -28,7 +28,7 @@
/*************************
* DestinationAddressUnit
************************/
-DestinationAddressUnit::DestinationAddressUnit()
+DestinationAddressUnit::DestinationAddressUnit ()
{
m_do = false;
m_rf = false;
@@ -38,246 +38,246 @@
{
mac_buffer[j] = 0;
}
- m_destinationAddress.CopyFrom(mac_buffer);
+ m_destinationAddress.CopyFrom (mac_buffer);
}
void
-DestinationAddressUnit::SetFlags(bool doFlag, bool rfFlag)
+DestinationAddressUnit::SetFlags (bool doFlag, bool rfFlag)
{
m_do = doFlag;
m_rf = rfFlag;
}
void
-DestinationAddressUnit::SetDestSeqNumber(uint32_t dest_seq_number)
+DestinationAddressUnit::SetDestSeqNumber (uint32_t dest_seq_number)
{
m_destSeqNumber = dest_seq_number;
}
void
-DestinationAddressUnit::SetDestinationAddress(Mac48Address dest_address)
+DestinationAddressUnit::SetDestinationAddress (Mac48Address dest_address)
{
m_destinationAddress = dest_address;
}
bool
-DestinationAddressUnit::IsDo()
+DestinationAddressUnit::IsDo ()
{
return m_do;
}
bool
-DestinationAddressUnit::IsRf()
+DestinationAddressUnit::IsRf ()
{
return m_rf;
}
uint32_t
-DestinationAddressUnit::GetDestSeqNumber() const
- {
- return m_destSeqNumber;
- }
+DestinationAddressUnit::GetDestSeqNumber () const
+{
+ return m_destSeqNumber;
+}
Mac48Address
-DestinationAddressUnit::GetDestinationAddress() const
- {
- return m_destinationAddress;
- }
+DestinationAddressUnit::GetDestinationAddress () const
+{
+ return m_destinationAddress;
+}
/********************************
* IeDot11sPreq
*******************************/
-IeDot11sPreq::~IeDot11sPreq()
+IeDot11sPreq::~IeDot11sPreq ()
{
}
TypeId
-IeDot11sPreq::GetTypeId()
+IeDot11sPreq::GetTypeId ()
{
static TypeId tid = TypeId ("ns3::IeDot11sPreq")
.SetParent<Object> ();
return tid;
}
void
-IeDot11sPreq::Print(std::ostream &os) const
- {
- //TODO:fill this method
- }
+IeDot11sPreq::Print (std::ostream &os) const
+{
+ //TODO:fill this method
+}
TypeId
-IeDot11sPreq::GetInstanceTypeId() const
- {
- return GetTypeId();
- }
+IeDot11sPreq::GetInstanceTypeId () const
+{
+ return GetTypeId ();
+}
-IeDot11sPreq::IeDot11sPreq():
- m_maxSize(32),
- m_flags(0),
- m_hopCount(0),
- m_ttl(0),
- m_preqId(0),
- m_originatorAddress(Mac48Address::GetBroadcast()),
- m_originatorSeqNumber(0),
- m_lifetime(0),
- m_metric(0),
- m_destCount(0)
+IeDot11sPreq::IeDot11sPreq ():
+ m_maxSize (32),
+ m_flags (0),
+ m_hopCount (0),
+ m_ttl (0),
+ m_preqId (0),
+ m_originatorAddress (Mac48Address::GetBroadcast()),
+ m_originatorSeqNumber (0),
+ m_lifetime (0),
+ m_metric (0),
+ m_destCount (0)
{
}
void
-IeDot11sPreq::SetUnicastPreq()
+IeDot11sPreq::SetUnicastPreq ()
{
m_flags |= 1<<1;
}
void
-IeDot11sPreq::SetNeedNotPrep()
+IeDot11sPreq::SetNeedNotPrep ()
{
m_flags |= 1<<2;
}
//void
-//IeDot11sPreq::SetFlags(uint8_t flags)
+//IeDot11sPreq::SetFlags (uint8_t flags)
//{
// m_flags = flags;
//}
void
-IeDot11sPreq::SetHopcount(uint8_t hopcount)
+IeDot11sPreq::SetHopcount (uint8_t hopcount)
{
m_hopCount = hopcount;
}
void
-IeDot11sPreq::SetTTL(uint8_t ttl)
+IeDot11sPreq::SetTTL (uint8_t ttl)
{
m_ttl = ttl;
}
void
-IeDot11sPreq::SetPreqID(uint32_t preq_id)
+IeDot11sPreq::SetPreqID (uint32_t preq_id)
{
m_preqId = preq_id;
}
void
-IeDot11sPreq::SetMetric(uint32_t metric)
+IeDot11sPreq::SetMetric (uint32_t metric)
{
m_metric = metric;
}
void
-IeDot11sPreq::SetOriginatorAddress(Mac48Address originator_address)
+IeDot11sPreq::SetOriginatorAddress (Mac48Address originator_address)
{
m_originatorAddress = originator_address;
}
void
-IeDot11sPreq::SetOriginatorSeqNumber(uint32_t originator_seq_number)
+IeDot11sPreq::SetOriginatorSeqNumber (uint32_t originator_seq_number)
{
m_originatorSeqNumber = originator_seq_number;
}
void
-IeDot11sPreq::SetLifetime(uint32_t lifetime)
+IeDot11sPreq::SetLifetime (uint32_t lifetime)
{
m_lifetime = lifetime;
}
void
-IeDot11sPreq::SetDestCount(uint8_t dest_count)
+IeDot11sPreq::SetDestCount (uint8_t dest_count)
{
m_destCount = dest_count;
}
//uint8_t
-//IeDot11sPreq::GetFlags() const
+//IeDot11sPreq::GetFlags () const
//{
// return m_flags;
//}
bool
-IeDot11sPreq::IsUnicastPreq() const
- {
- return (m_flags & (1<<1));
- }
+IeDot11sPreq::IsUnicastPreq () const
+{
+ return (m_flags & (1<<1));
+}
bool
-IeDot11sPreq::IsNeedNotPrep() const
- {
- return (m_flags & (1<<2));
- }
+IeDot11sPreq::IsNeedNotPrep () const
+{
+ return (m_flags & (1<<2));
+}
uint8_t
-IeDot11sPreq::GetHopCount() const
- {
- return m_hopCount;
- }
+IeDot11sPreq::GetHopCount () const
+{
+ return m_hopCount;
+}
uint8_t
-IeDot11sPreq::GetTtl() const
- {
- return m_ttl;
- }
+IeDot11sPreq::GetTtl () const
+{
+ return m_ttl;
+}
uint32_t
-IeDot11sPreq::GetPreqID() const
- {
- return m_preqId;
- }
+IeDot11sPreq::GetPreqID () const
+{
+ return m_preqId;
+}
uint32_t
-IeDot11sPreq::GetMetric() const
- {
- return m_metric;
- }
+IeDot11sPreq::GetMetric () const
+{
+ return m_metric;
+}
Mac48Address
-IeDot11sPreq::GetOriginatorAddress() const
- {
- return m_originatorAddress;
- }
+IeDot11sPreq::GetOriginatorAddress () const
+{
+ return m_originatorAddress;
+}
uint32_t
-IeDot11sPreq::GetOriginatorSeqNumber() const
- {
- return m_originatorSeqNumber;
- }
+IeDot11sPreq::GetOriginatorSeqNumber () const
+{
+ return m_originatorSeqNumber;
+}
uint32_t
-IeDot11sPreq::GetLifetime() const
- {
- return m_lifetime;
- }
+IeDot11sPreq::GetLifetime () const
+{
+ return m_lifetime;
+}
uint8_t
-IeDot11sPreq::GetDestCount() const
- {
- return m_destCount;
- }
+IeDot11sPreq::GetDestCount () const
+{
+ return m_destCount;
+}
void
-IeDot11sPreq::DecrementTtl()
+IeDot11sPreq::DecrementTtl ()
{
m_ttl --;
m_hopCount ++;
}
void
-IeDot11sPreq::IncrementMetric(uint32_t metric)
+IeDot11sPreq::IncrementMetric (uint32_t metric)
{
m_metric +=metric;
}
void
-IeDot11sPreq::SerializeInformation(Buffer::Iterator i) const
- {
- i.WriteU8 (m_flags);
- i.WriteU8 (m_hopCount);
- i.WriteU8 (m_ttl);
- i.WriteHtonU32 (m_preqId);
- WriteTo (i, m_originatorAddress);
- i.WriteHtonU32 (m_originatorSeqNumber);
- i.WriteHtonU32 (m_lifetime);
- i.WriteHtonU32 (m_metric);
- i.WriteU8 (m_destCount);
- int written = 0;
- for (std::vector<Ptr<DestinationAddressUnit> >::const_iterator j = m_destinations.begin(); j!= m_destinations.end(); j++)
- {
- uint8_t flags = 0;
- if ((*j)->IsDo())
- flags +=128;
- if ((*j)->IsRf())
- flags +=64;
- i.WriteU8 (flags);
- WriteTo (i,(*j)->GetDestinationAddress());
- i.WriteHtonU32 ((*j)->GetDestSeqNumber());
- written++;
- if (written > m_maxSize)
- break;
- }
- }
+IeDot11sPreq::SerializeInformation (Buffer::Iterator i) const
+{
+ i.WriteU8 (m_flags);
+ i.WriteU8 (m_hopCount);
+ i.WriteU8 (m_ttl);
+ i.WriteHtonU32 (m_preqId);
+ WriteTo (i, m_originatorAddress);
+ i.WriteHtonU32 (m_originatorSeqNumber);
+ i.WriteHtonU32 (m_lifetime);
+ i.WriteHtonU32 (m_metric);
+ i.WriteU8 (m_destCount);
+ int written = 0;
+ for (std::vector<Ptr<DestinationAddressUnit> >::const_iterator j = m_destinations.begin (); j != m_destinations.end(); j++)
+ {
+ uint8_t flags = 0;
+ if ((*j)->IsDo ())
+ flags +=128;
+ if ((*j)->IsRf ())
+ flags +=64;
+ i.WriteU8 (flags);
+ WriteTo (i, (*j)->GetDestinationAddress());
+ i.WriteHtonU32 ((*j)->GetDestSeqNumber ());
+ written++;
+ if (written > m_maxSize)
+ break;
+ }
+}
uint8_t
-IeDot11sPreq::DeserializeInformation(Buffer::Iterator start, uint8_t length)
+IeDot11sPreq::DeserializeInformation (Buffer::Iterator start, uint8_t length)
{
Buffer::Iterator i = start;
m_flags = i.ReadU8 ();
@@ -285,16 +285,16 @@
m_ttl = i.ReadU8 ();
m_preqId = i.ReadNtohU32 ();
ReadFrom (i, m_originatorAddress);
- m_originatorSeqNumber = i.ReadNtohU32();
- m_lifetime = i.ReadNtohU32();
- m_metric = i.ReadNtohU32();
- m_destCount = i.ReadU8();
+ m_originatorSeqNumber = i.ReadNtohU32 ();
+ m_lifetime = i.ReadNtohU32 ();
+ m_metric = i.ReadNtohU32 ();
+ m_destCount = i.ReadU8 ();
for (int j = 0; j < m_destCount; j++ )
{
- Ptr<DestinationAddressUnit> new_element = Create<DestinationAddressUnit>();
+ Ptr<DestinationAddressUnit> new_element = Create<DestinationAddressUnit> ();
bool doFlag = false;
bool rfFlag = false;
- uint8_t flags = i.ReadU8();
+ uint8_t flags = i.ReadU8 ();
if (flags >= 128)
{
doFlag = true;
@@ -302,21 +302,21 @@
}
if (flags >=64)
rfFlag = true;
- new_element->SetFlags(doFlag, rfFlag);
+ new_element->SetFlags (doFlag, rfFlag);
Mac48Address addr;
ReadFrom (i,addr);
- new_element->SetDestinationAddress(addr);
- new_element->SetDestSeqNumber(i.ReadNtohU32());
- m_destinations.push_back(new_element);
- NS_ASSERT(28+j*11 < length);
+ new_element->SetDestinationAddress (addr);
+ new_element->SetDestSeqNumber (i.ReadNtohU32());
+ m_destinations.push_back (new_element);
+ NS_ASSERT (28+j*11 < length);
}
- return i.GetDistanceFrom(start);
+ return i.GetDistanceFrom (start);
}
uint8_t
-IeDot11sPreq::GetInformationSize() const
+IeDot11sPreq::GetInformationSize () const
{
uint8_t retval =
- 1 //Flags
+ 1 //Flags
+1 //Hopcount
+1 //TTL
+4 //PREQ ID
@@ -326,61 +326,61 @@
+4 //metric
+1; //destination count
if (m_destCount > m_maxSize)
- retval+=(m_maxSize*11);
+ retval += (m_maxSize*11);
else
- retval +=(m_destCount*11);
+ retval += (m_destCount*11);
return retval;
}
void
-IeDot11sPreq::PrintInformation(std::ostream& os) const
+IeDot11sPreq::PrintInformation (std::ostream& os) const
{
//TODO
}
std::vector<Ptr<DestinationAddressUnit> >
-IeDot11sPreq::GetDestinationList()
+IeDot11sPreq::GetDestinationList ()
{
return m_destinations;
}
void
-IeDot11sPreq::AddDestinationAddressElement(
+IeDot11sPreq::AddDestinationAddressElement (
bool doFlag, bool rfFlag,
Mac48Address dest_address,
uint32_t dest_seq_number
)
{
- for (std::vector<Ptr<DestinationAddressUnit> >::iterator i = m_destinations.begin(); i!=m_destinations.end(); i++ )
- if ((*i)->GetDestinationAddress() == dest_address)
+ for (std::vector<Ptr<DestinationAddressUnit> >::iterator i = m_destinations.begin (); i != m_destinations.end(); i++ )
+ if ((*i)->GetDestinationAddress () == dest_address)
return;
- Ptr<DestinationAddressUnit>new_element = Create<DestinationAddressUnit>();
- new_element->SetFlags(doFlag, rfFlag);
- new_element->SetDestinationAddress(dest_address);
- new_element->SetDestSeqNumber(dest_seq_number);
- m_destinations.push_back(new_element);
+ Ptr<DestinationAddressUnit>new_element = Create<DestinationAddressUnit> ();
+ new_element->SetFlags (doFlag, rfFlag);
+ new_element->SetDestinationAddress (dest_address);
+ new_element->SetDestSeqNumber (dest_seq_number);
+ m_destinations.push_back (new_element);
m_destCount++;
}
void
-IeDot11sPreq::DelDestinationAddressElement(Mac48Address dest_address)
+IeDot11sPreq::DelDestinationAddressElement (Mac48Address dest_address)
{
- for (std::vector<Ptr<DestinationAddressUnit> >::iterator i = m_destinations.begin(); i!=m_destinations.end(); i++)
- if ((*i)->GetDestinationAddress() == dest_address)
+ for (std::vector<Ptr<DestinationAddressUnit> >::iterator i = m_destinations.begin (); i != m_destinations.end(); i++)
+ if ((*i)->GetDestinationAddress () == dest_address)
{
- m_destinations.erase(i);
+ m_destinations.erase (i);
m_destCount--;
break;
}
}
void
-IeDot11sPreq::ClearDestinationAddressElement()
+IeDot11sPreq::ClearDestinationAddressElement ()
{
int i;
- for (std::vector<Ptr<DestinationAddressUnit> >::iterator j = m_destinations.begin(); j!= m_destinations.end(); j++)
+ for (std::vector<Ptr<DestinationAddressUnit> >::iterator j = m_destinations.begin (); j != m_destinations.end(); j++)
(*j) = 0;
for (i = 0; i < m_destCount; i ++)
- m_destinations.pop_back();
- m_destinations.clear();
+ m_destinations.pop_back ();
+ m_destinations.clear ();
};
}
--- a/src/devices/mesh/802.11s/ie-dot11s-preq.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-preq.h Wed Mar 18 22:36:12 2009 +0300
@@ -37,14 +37,14 @@
class DestinationAddressUnit : public RefCountBase
{
public:
- DestinationAddressUnit();
- void SetFlags(bool doFlag, bool rfflag);
- void SetDestinationAddress(Mac48Address dest_address);
- void SetDestSeqNumber(uint32_t dest_seq_number);
- bool IsDo();
- bool IsRf();
- Mac48Address GetDestinationAddress() const;
- uint32_t GetDestSeqNumber() const;
+ DestinationAddressUnit ();
+ void SetFlags (bool doFlag, bool rfflag);
+ void SetDestinationAddress (Mac48Address dest_address);
+ void SetDestSeqNumber (uint32_t dest_seq_number);
+ bool IsDo ();
+ bool IsRf ();
+ Mac48Address GetDestinationAddress () const;
+ uint32_t GetDestSeqNumber () const;
private:
bool m_do;
@@ -59,54 +59,54 @@
class IeDot11sPreq : public WifiInformationElement
{
public:
- IeDot11sPreq();
+ IeDot11sPreq ();
~IeDot11sPreq ();
static TypeId GetTypeId ();
- virtual TypeId GetInstanceTypeId() const;
- virtual void Print(std::ostream &os) const;
- void AddDestinationAddressElement(
+ virtual TypeId GetInstanceTypeId () const;
+ virtual void Print (std::ostream &os) const;
+ void AddDestinationAddressElement (
bool doFlag,
bool rfFlag,
Mac48Address dest_address,
uint32_t dest_seq_number
);
- void DelDestinationAddressElement(Mac48Address dest_address);
- void ClearDestinationAddressElement();
+ void DelDestinationAddressElement (Mac48Address dest_address);
+ void ClearDestinationAddressElement ();
std::vector<Ptr<DestinationAddressUnit> > GetDestinationList ();
- void SetUnicastPreq();
+ void SetUnicastPreq ();
/*
* \brief In proactive case: need we send PREP
*/
- void SetNeedNotPrep();
- void SetHopcount(uint8_t hopcount);
- void SetTTL(uint8_t ttl);
- void SetPreqID(uint32_t id);
- void SetOriginatorAddress(Mac48Address originator_address);
- void SetOriginatorSeqNumber(uint32_t originator_seq_number);
- void SetLifetime(uint32_t lifetime);
- void SetMetric(uint32_t metric);
- void SetDestCount(uint8_t dest_count);
+ void SetNeedNotPrep ();
+ void SetHopcount (uint8_t hopcount);
+ void SetTTL (uint8_t ttl);
+ void SetPreqID (uint32_t id);
+ void SetOriginatorAddress (Mac48Address originator_address);
+ void SetOriginatorSeqNumber (uint32_t originator_seq_number);
+ void SetLifetime (uint32_t lifetime);
+ void SetMetric (uint32_t metric);
+ void SetDestCount (uint8_t dest_count);
- bool IsUnicastPreq() const;
- bool IsNeedNotPrep() const;
- uint8_t GetHopCount() const;
- uint8_t GetTtl()const ;
- uint32_t GetPreqID() const;
- Mac48Address GetOriginatorAddress() const;
- uint32_t GetOriginatorSeqNumber() const;
- uint32_t GetLifetime() const;
- uint32_t GetMetric() const;
- uint8_t GetDestCount() const;
- void DecrementTtl();
- void IncrementMetric(uint32_t metric);
+ bool IsUnicastPreq () const;
+ bool IsNeedNotPrep () const;
+ uint8_t GetHopCount () const;
+ uint8_t GetTtl ()const ;
+ uint32_t GetPreqID () const;
+ Mac48Address GetOriginatorAddress () const;
+ uint32_t GetOriginatorSeqNumber () const;
+ uint32_t GetLifetime () const;
+ uint32_t GetMetric () const;
+ uint8_t GetDestCount () const;
+ void DecrementTtl ();
+ void IncrementMetric (uint32_t metric);
private:
WifiElementId ElementId () const{
return IE11S_PREQ;
}
- void SerializeInformation(Buffer::Iterator i) const;
- uint8_t DeserializeInformation(Buffer::Iterator i, uint8_t length);
- uint8_t GetInformationSize() const;
- void PrintInformation(std::ostream& os) const;
+ void SerializeInformation (Buffer::Iterator i) const;
+ uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
+ uint8_t GetInformationSize () const;
+ void PrintInformation (std::ostream& os) const;
/**
* how many destinations we support
*/
--- a/src/devices/mesh/802.11s/ie-dot11s-rann.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-rann.cc Wed Mar 18 22:36:12 2009 +0300
@@ -26,129 +26,129 @@
namespace ns3 {
-IeDot11sRann::~IeDot11sRann()
+IeDot11sRann::~IeDot11sRann ()
{
}
TypeId
-IeDot11sRann::GetTypeId()
+IeDot11sRann::GetTypeId ()
{
static TypeId tid = TypeId ("ns3::IeDot11sRann").SetParent<Object> ();
return tid;
}
TypeId
-IeDot11sRann::GetInstanceTypeId() const
- {
- return GetTypeId();
- }
+IeDot11sRann::GetInstanceTypeId () const
+{
+ return GetTypeId ();
+}
void
-IeDot11sRann::Print(std::ostream &os)const
- {
- // FILL
- }
-IeDot11sRann::IeDot11sRann():
- m_flags(0),
- m_hopcount(0),
- m_ttl(0),
- m_originatorAddress(Mac48Address::GetBroadcast()),
- m_destSeqNumber(0),
- m_metric(0)
+IeDot11sRann::Print (std::ostream &os)const
+{
+ // FILL
+}
+IeDot11sRann::IeDot11sRann ():
+ m_flags (0),
+ m_hopcount (0),
+ m_ttl (0),
+ m_originatorAddress (Mac48Address::GetBroadcast()),
+ m_destSeqNumber (0),
+ m_metric (0)
{
}
void
-IeDot11sRann::SetFlags(uint8_t flags)
+IeDot11sRann::SetFlags (uint8_t flags)
{
m_flags = flags;
}
void
-IeDot11sRann::SetHopcount(uint8_t hopcount)
+IeDot11sRann::SetHopcount (uint8_t hopcount)
{
m_hopcount = hopcount;
}
void
-IeDot11sRann::SetTTL(uint8_t ttl)
+IeDot11sRann::SetTTL (uint8_t ttl)
{
m_ttl = ttl;
}
void
-IeDot11sRann::SetDestSeqNumber(uint32_t dest_seq_number)
+IeDot11sRann::SetDestSeqNumber (uint32_t dest_seq_number)
{
m_destSeqNumber = dest_seq_number;
}
void
-IeDot11sRann::SetMetric(uint32_t metric)
+IeDot11sRann::SetMetric (uint32_t metric)
{
m_metric = metric;
}
void
-IeDot11sRann::SetOriginatorAddress(Mac48Address originator_address)
+IeDot11sRann::SetOriginatorAddress (Mac48Address originator_address)
{
m_originatorAddress = originator_address;
}
uint8_t
-IeDot11sRann::GetFlags()
+IeDot11sRann::GetFlags ()
{
return m_flags;
}
uint8_t
-IeDot11sRann::GetHopcount()
+IeDot11sRann::GetHopcount ()
{
return m_hopcount;
}
uint8_t
-IeDot11sRann::GetTTL()
+IeDot11sRann::GetTTL ()
{
return m_ttl;
}
uint32_t
-IeDot11sRann::GetDestSeqNumber()
+IeDot11sRann::GetDestSeqNumber ()
{
return m_destSeqNumber;
}
uint32_t
-IeDot11sRann::GetMetric()
+IeDot11sRann::GetMetric ()
{
return m_metric;
}
Mac48Address
-IeDot11sRann::GetOriginatorAddress()
+IeDot11sRann::GetOriginatorAddress ()
{
return m_originatorAddress;
}
void
-IeDot11sRann::SerializeInformation(Buffer::Iterator i) const
- {
- i.WriteU8 (m_flags);
- i.WriteU8 (m_hopcount);
- i.WriteU8 (m_ttl);
- WriteTo (i, m_originatorAddress);
- i.WriteHtonU32 (m_destSeqNumber);
- i.WriteHtonU32 (m_metric);
- }
+IeDot11sRann::SerializeInformation (Buffer::Iterator i) const
+{
+ i.WriteU8 (m_flags);
+ i.WriteU8 (m_hopcount);
+ i.WriteU8 (m_ttl);
+ WriteTo (i, m_originatorAddress);
+ i.WriteHtonU32 (m_destSeqNumber);
+ i.WriteHtonU32 (m_metric);
+}
uint8_t
-IeDot11sRann::DeserializeInformation(Buffer::Iterator start, uint8_t length)
+IeDot11sRann::DeserializeInformation (Buffer::Iterator start, uint8_t length)
{
Buffer::Iterator i = start;
- m_flags = i.ReadU8();
- m_hopcount = i.ReadU8();
- m_ttl = i.ReadU8();
- ReadFrom(i, m_originatorAddress);
- m_destSeqNumber = i.ReadNtohU32();
- m_metric = i.ReadNtohU32();
- return i.GetDistanceFrom(start);
+ m_flags = i.ReadU8 ();
+ m_hopcount = i.ReadU8 ();
+ m_ttl = i.ReadU8 ();
+ ReadFrom (i, m_originatorAddress);
+ m_destSeqNumber = i.ReadNtohU32 ();
+ m_metric = i.ReadNtohU32 ();
+ return i.GetDistanceFrom (start);
}
uint8_t
-IeDot11sRann::GetInformationSize() const
- {
- uint8_t retval =
- 1//Flags
- +1//Hopcount
- +1//TTL
- +6//OriginatorAddress
- +4//DestSeqNumber
- +4;//Metric
- return retval;
- }
+IeDot11sRann::GetInformationSize () const
+{
+ uint8_t retval =
+ 1 //Flags
+ +1 //Hopcount
+ +1 //TTL
+ +6 //OriginatorAddress
+ +4 //DestSeqNumber
+ +4;//Metric
+ return retval;
+}
}
--- a/src/devices/mesh/802.11s/ie-dot11s-rann.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-rann.h Wed Mar 18 22:36:12 2009 +0300
@@ -34,32 +34,32 @@
class IeDot11sRann
{
public:
- IeDot11sRann();
- virtual ~IeDot11sRann();
- static TypeId GetTypeId();
- virtual TypeId GetInstanceTypeId() const;
- virtual void Print(std::ostream &os) const;
- void SetFlags(uint8_t flags);
- void SetHopcount(uint8_t hopcount);
- void SetTTL(uint8_t ttl);
- void SetOriginatorAddress(Mac48Address originator_address);
- void SetDestSeqNumber(uint32_t dest_seq_number);
- void SetMetric(uint32_t metric);
- uint8_t GetFlags();
- uint8_t GetHopcount();
- uint8_t GetTTL();
- Mac48Address GetOriginatorAddress();
- uint32_t GetDestSeqNumber();
- uint32_t GetMetric();
- void DecrementTtl();
- void IncrementMetric(uint32_t metric);
+ IeDot11sRann ();
+ virtual ~IeDot11sRann ();
+ static TypeId GetTypeId ();
+ virtual TypeId GetInstanceTypeId () const;
+ virtual void Print (std::ostream &os) const;
+ void SetFlags (uint8_t flags);
+ void SetHopcount (uint8_t hopcount);
+ void SetTTL (uint8_t ttl);
+ void SetOriginatorAddress (Mac48Address originator_address);
+ void SetDestSeqNumber (uint32_t dest_seq_number);
+ void SetMetric (uint32_t metric);
+ uint8_t GetFlags ();
+ uint8_t GetHopcount ();
+ uint8_t GetTTL ();
+ Mac48Address GetOriginatorAddress ();
+ uint32_t GetDestSeqNumber ();
+ uint32_t GetMetric ();
+ void DecrementTtl ();
+ void IncrementMetric (uint32_t metric);
private:
- WifiElementId ElementId() const{
+ WifiElementId ElementId () const{
return IE11S_RANN;
}
- void SerializeInformation(Buffer::Iterator i) const;
- uint8_t DeserializeInformation(Buffer::Iterator start, uint8_t length);
- uint8_t GetInformationSize() const;
+ void SerializeInformation (Buffer::Iterator i) const;
+ uint8_t DeserializeInformation (Buffer::Iterator start, uint8_t length);
+ uint8_t GetInformationSize () const;
uint8_t m_flags;
uint8_t m_hopcount;
uint8_t m_ttl;
--- a/src/devices/mesh/dot11s-parameters.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/dot11s-parameters.cc Wed Mar 18 22:36:12 2009 +0300
@@ -25,18 +25,18 @@
namespace ns3 {
uint8_t dot11sParameters::dot11MeshMaxRetries = 4;
-Time dot11sParameters::dot11MeshRetryTimeout = TU_TO_TIME(40);
-Time dot11sParameters::dot11MeshHoldingTimeout = TU_TO_TIME(40);
-Time dot11sParameters::dot11MeshConfirmTimeout = TU_TO_TIME(40);
+Time dot11sParameters::dot11MeshRetryTimeout = TU_TO_TIME (40);
+Time dot11sParameters::dot11MeshHoldingTimeout = TU_TO_TIME (40);
+Time dot11sParameters::dot11MeshConfirmTimeout = TU_TO_TIME (40);
uint8_t dot11sParameters::dot11MeshHWMPmaxPREQretries = 3;
-Time dot11sParameters::dot11MeshHWMPnetDiameterTraversalTime = TU_TO_TIME(10);
-Time dot11sParameters::dot11MeshHWMPpreqMinInterval = TU_TO_TIME(100);
-Time dot11sParameters::dot11MeshHWMPperrMinInterval = TU_TO_TIME(100);
-Time dot11sParameters::dot11MeshHWMPactiveRootTimeout = TU_TO_TIME(5000);
-Time dot11sParameters::dot11MeshHWMPactivePathTimeout = TU_TO_TIME(5000);
-Time dot11sParameters::dot11MeshHWMPpathToRootInterval = TU_TO_TIME(5000);
-Time dot11sParameters::dot11MeshHWMPrannInterval = TU_TO_TIME(1000);
+Time dot11sParameters::dot11MeshHWMPnetDiameterTraversalTime = TU_TO_TIME (10);
+Time dot11sParameters::dot11MeshHWMPpreqMinInterval = TU_TO_TIME (100);
+Time dot11sParameters::dot11MeshHWMPperrMinInterval = TU_TO_TIME (100);
+Time dot11sParameters::dot11MeshHWMPactiveRootTimeout = TU_TO_TIME (5000);
+Time dot11sParameters::dot11MeshHWMPactivePathTimeout = TU_TO_TIME (5000);
+Time dot11sParameters::dot11MeshHWMPpathToRootInterval = TU_TO_TIME (5000);
+Time dot11sParameters::dot11MeshHWMPrannInterval = TU_TO_TIME (1000);
}
--- a/src/devices/mesh/dot11s-parameters.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/dot11s-parameters.h Wed Mar 18 22:36:12 2009 +0300
@@ -27,8 +27,8 @@
namespace ns3 {
-#define TU_TO_TIME(x) MicroSeconds(x*1024)
-#define TIME_TO_TU(x) x.GetMicroSeconds()/1024
+#define TU_TO_TIME (x) MicroSeconds(x*1024)
+#define TIME_TO_TU (x) x.GetMicroSeconds()/1024
/**
* \ingroup mesh
--- a/src/devices/mesh/hwmp-rtable.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/hwmp-rtable.cc Wed Mar 18 22:36:12 2009 +0300
@@ -34,7 +34,7 @@
NS_OBJECT_ENSURE_REGISTERED (HwmpRtable);
TypeId
-HwmpRtable::GetTypeId()
+HwmpRtable::GetTypeId ()
{
static TypeId tid = TypeId ("ns3::HwmpRtable")
.SetParent<Object> ()
@@ -43,25 +43,25 @@
}
-HwmpRtable::HwmpRtable()
+HwmpRtable::HwmpRtable ()
{
}
-HwmpRtable::~HwmpRtable()
+HwmpRtable::~HwmpRtable ()
{
- DoDispose();
+ DoDispose ();
}
void
-HwmpRtable::DoDispose()
+HwmpRtable::DoDispose ()
{
- NS_LOG_UNCOND("RTABLE DISPOSE STARTED");
- m_routes.clear();
- m_roots.clear();
+ NS_LOG_UNCOND ("RTABLE DISPOSE STARTED");
+ m_routes.clear ();
+ m_roots.clear ();
}
void
-HwmpRtable::AddReactivePath(
+HwmpRtable::AddReactivePath (
Mac48Address destination,
Mac48Address retransmitter,
uint32_t port,
@@ -70,8 +70,8 @@
uint32_t seqnum
)
{
- std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find(destination);
- if (i == m_routes.end())
+ std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find (destination);
+ if (i == m_routes.end ())
{
ReactiveRoute newroute;
m_routes[destination] = newroute;
@@ -90,27 +90,27 @@
* The routing info is actual or it
* was received from peer
*/
- ((i->second.whenExpire > Simulator::Now())||(i->second.whenExpire == Seconds(0)))
+ ((i->second.whenExpire > Simulator::Now ())||(i->second.whenExpire == Seconds(0)))
)
return;
}
- i = m_routes.find(destination);
- NS_ASSERT(i != m_routes.end());
+ i = m_routes.find (destination);
+ NS_ASSERT (i != m_routes.end());
i->second.retransmitter = retransmitter;
i->second.port = port;
i->second.metric = metric;
- if (lifetime != Seconds(0))
- i->second.whenExpire = MilliSeconds(Simulator::Now().GetMilliSeconds() + lifetime.GetMilliSeconds());
+ if (lifetime != Seconds (0))
+ i->second.whenExpire = MilliSeconds (Simulator::Now().GetMilliSeconds() + lifetime.GetMilliSeconds());
else
/**
* Information about peer does not have lifetime
*/
- i->second.whenExpire = Seconds(0);
+ i->second.whenExpire = Seconds (0);
i->second.seqnum = seqnum;
}
void
-HwmpRtable::AddProactivePath(
+HwmpRtable::AddProactivePath (
uint32_t metric,
Mac48Address root,
Mac48Address retransmitter,
@@ -121,83 +121,83 @@
{
ProactiveRoute newroute;
m_roots[port] = newroute;
- std::map<uint32_t,ProactiveRoute>::iterator i = m_roots.find(port);
- NS_ASSERT(i != m_roots.end());
+ std::map<uint32_t,ProactiveRoute>::iterator i = m_roots.find (port);
+ NS_ASSERT (i != m_roots.end());
i->second.root = root;
i->second.retransmitter = retransmitter;
i->second.metric = metric;
- i->second.whenExpire = MilliSeconds(Simulator::Now().GetMilliSeconds() + lifetime.GetMilliSeconds());
+ i->second.whenExpire = MilliSeconds (Simulator::Now().GetMilliSeconds() + lifetime.GetMilliSeconds());
i->second.seqnum = seqnum;
}
void
-HwmpRtable::AddPrecursor(Mac48Address destination, uint32_t port, Mac48Address precursor)
+HwmpRtable::AddPrecursor (Mac48Address destination, uint32_t port, Mac48Address precursor)
{
bool should_add = true;
- std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find(destination);
- if ((i != m_routes.end()) && (i->second.port == port))
+ std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find (destination);
+ if ((i != m_routes.end ()) && (i->second.port == port))
{
- for (unsigned int j = 0 ; j < i->second.precursors.size(); j ++)
+ for (unsigned int j = 0 ; j < i->second.precursors.size (); j ++)
if (i->second.precursors[j] == precursor)
{
should_add = false;
break;
}
if (should_add)
- i->second.precursors.push_back(precursor);
+ i->second.precursors.push_back (precursor);
}
- std::map<uint32_t,ProactiveRoute>::iterator k = m_roots.find(port);
- if (k!= m_roots.end())
+ std::map<uint32_t,ProactiveRoute>::iterator k = m_roots.find (port);
+ if (k != m_roots.end ())
{
- for (unsigned int j = 0 ; j < k->second.precursors.size(); j ++)
+ for (unsigned int j = 0 ; j < k->second.precursors.size (); j ++)
if (k->second.precursors[j] == precursor)
return;
- k->second.precursors.push_back(precursor);
+ k->second.precursors.push_back (precursor);
return;
}
}
void
-HwmpRtable::DeleteProactivePath(uint32_t port)
+HwmpRtable::DeleteProactivePath (uint32_t port)
{
- std::map<uint32_t,ProactiveRoute>::iterator j = m_roots.find(port);
- if (j != m_roots.end())
- m_roots.erase(j);
+ std::map<uint32_t,ProactiveRoute>::iterator j = m_roots.find (port);
+ if (j != m_roots.end ())
+ m_roots.erase (j);
}
void
-HwmpRtable::DeleteProactivePath(Mac48Address root, uint32_t port)
+HwmpRtable::DeleteProactivePath (Mac48Address root, uint32_t port)
{
- std::map<uint32_t,ProactiveRoute>::iterator j = m_roots.find(port);
- if ((j != m_roots.end())&&(j->second.root == root))
- m_roots.erase(j);
+ std::map<uint32_t,ProactiveRoute>::iterator j = m_roots.find (port);
+ if ((j != m_roots.end ())&&(j->second.root == root))
+ m_roots.erase (j);
}
void
-HwmpRtable::DeleteReactivePath(Mac48Address destination, uint32_t port)
+HwmpRtable::DeleteReactivePath (Mac48Address destination, uint32_t port)
{
- std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find(destination);
- if (i != m_routes.end())
+ std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find (destination);
+ if (i != m_routes.end ())
if (i->second.port == port)
- m_routes.erase(i);
+ m_routes.erase (i);
}
HwmpRtable::LookupResult
-HwmpRtable::LookupReactive(Mac48Address destination)
+HwmpRtable::LookupReactive (Mac48Address destination)
{
LookupResult result;
- result.retransmitter = Mac48Address::GetBroadcast();
+ result.retransmitter = Mac48Address::GetBroadcast ();
result.metric = MAX_METRIC;
result.ifIndex = PORT_ANY;
- std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find(destination);
- if (i == m_routes.end())
+ std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find (destination);
+ if (i == m_routes.end ())
return result;
result.ifIndex = i->second.port;
- //Seconds(0) means that this is routing
- if (i->second.whenExpire < Simulator::Now())
+ //Seconds (0) means that this is routing
+ if (i->second.whenExpire < Simulator::Now ())
if (i->second.retransmitter != destination)
return result;
result.retransmitter = i->second.retransmitter;
@@ -207,17 +207,17 @@
}
HwmpRtable::LookupResult
-HwmpRtable::LookupProactive(uint32_t port)
+HwmpRtable::LookupProactive (uint32_t port)
{
LookupResult result;
- result.retransmitter = Mac48Address::GetBroadcast();
+ result.retransmitter = Mac48Address::GetBroadcast ();
result.metric = MAX_METRIC;
result.ifIndex = PORT_ANY;
- std::map<uint32_t, ProactiveRoute>::iterator i = m_roots.find(port);
- if (i == m_roots.end())
+ std::map<uint32_t, ProactiveRoute>::iterator i = m_roots.find (port);
+ if (i == m_roots.end ())
return result;
result.ifIndex = i->first;
- if (i->second.whenExpire < Simulator::Now())
+ if (i->second.whenExpire < Simulator::Now ())
return result;
result.retransmitter = i->second.retransmitter;
result.metric = i->second.metric;
@@ -226,55 +226,55 @@
}
std::vector<HwmpRtable::FailedDestination>
-HwmpRtable::GetUnreachableDestinations(Mac48Address peerAddress, uint32_t port)
+HwmpRtable::GetUnreachableDestinations (Mac48Address peerAddress, uint32_t port)
{
std::vector<FailedDestination> retval;
- for (std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.begin(); i!= m_routes.end(); i++)
- if ((i->second.retransmitter == peerAddress)&&(i->second.port == port))
+ for (std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.begin (); i != m_routes.end(); i++)
+ if ((i->second.retransmitter == peerAddress)&& (i->second.port == port))
{
FailedDestination dst;
dst.destination = i->first;
i->second.seqnum ++;
dst.seqnum = i->second.seqnum;
- retval.push_back(dst);
+ retval.push_back (dst);
}
/**
* Lookup a path to root
*/
- std::map<uint32_t, ProactiveRoute>::iterator i = m_roots.find(port);
- if ((i != m_roots.end())&&(i->second.retransmitter == peerAddress))
+ std::map<uint32_t, ProactiveRoute>::iterator i = m_roots.find (port);
+ if ((i != m_roots.end ())&&(i->second.retransmitter == peerAddress))
{
FailedDestination dst;
dst.destination = i->second.root;
dst.seqnum = i->second.seqnum;
- retval.push_back(dst);
+ retval.push_back (dst);
}
return retval;
}
uint32_t
-HwmpRtable::RequestSeqnum(Mac48Address destination)
+HwmpRtable::RequestSeqnum (Mac48Address destination)
{
- std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find(destination);
- if (i == m_routes.end())
+ std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find (destination);
+ if (i == m_routes.end ())
return 0;
return i->second.seqnum;
}
std::vector<Mac48Address>
-HwmpRtable::GetPrecursors(Mac48Address destination, uint32_t port)
+HwmpRtable::GetPrecursors (Mac48Address destination, uint32_t port)
{
std::vector<Mac48Address> retval;
- std::map<uint32_t, ProactiveRoute>::iterator root = m_roots.find(port);
- if ((root != m_roots.end()) &&(root->second.root == destination))
+ std::map<uint32_t, ProactiveRoute>::iterator root = m_roots.find (port);
+ if ((root != m_roots.end ()) &&(root->second.root == destination))
{
- for (unsigned int i = 0; i < root->second.precursors.size(); i ++)
- retval.push_back(root->second.precursors[i]);
+ for (unsigned int i = 0; i < root->second.precursors.size (); i ++)
+ retval.push_back (root->second.precursors[i]);
}
- std::map<Mac48Address, ReactiveRoute>::iterator route = m_routes.find(destination);
- if ( (route != m_routes.end()) && (route->second.port == port) )
+ std::map<Mac48Address, ReactiveRoute>::iterator route = m_routes.find (destination);
+ if ( (route != m_routes.end ()) && (route->second.port == port) )
{
- for (unsigned int i = 0; i < route->second.precursors.size(); i ++)
- retval.push_back(route->second.precursors[i]);
+ for (unsigned int i = 0; i < route->second.precursors.size (); i ++)
+ retval.push_back (route->second.precursors[i]);
}
return retval;
}
--- a/src/devices/mesh/hwmp-rtable.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/hwmp-rtable.h Wed Mar 18 22:36:12 2009 +0300
@@ -38,10 +38,10 @@
{
public:
static TypeId GetTypeId ();
- HwmpRtable();
- ~HwmpRtable();
- void DoDispose();
- void AddReactivePath(
+ HwmpRtable ();
+ ~HwmpRtable ();
+ void DoDispose ();
+ void AddReactivePath (
Mac48Address destination,
Mac48Address retransmitter,
uint32_t port,
@@ -49,7 +49,7 @@
Time lifetime,
uint32_t seqnum
);
- void AddProactivePath(
+ void AddProactivePath (
uint32_t metric,
Mac48Address root,
Mac48Address retransmitter,
@@ -57,10 +57,10 @@
Time lifetime,
uint32_t seqnum
);
- void AddPrecursor(Mac48Address destination, uint32_t port, Mac48Address precursor);
- void DeleteProactivePath(uint32_t port);
- void DeleteProactivePath(Mac48Address root, uint32_t port);
- void DeleteReactivePath(Mac48Address destination, uint32_t port);
+ void AddPrecursor (Mac48Address destination, uint32_t port, Mac48Address precursor);
+ void DeleteProactivePath (uint32_t port);
+ void DeleteProactivePath (Mac48Address root, uint32_t port);
+ void DeleteReactivePath (Mac48Address destination, uint32_t port);
struct LookupResult
{
Mac48Address retransmitter;
@@ -68,17 +68,17 @@
uint32_t metric;
uint32_t seqnum;
};
- LookupResult LookupReactive(Mac48Address destination);
- LookupResult LookupProactive(uint32_t port);
+ LookupResult LookupReactive (Mac48Address destination);
+ LookupResult LookupProactive (uint32_t port);
//path error routines:
struct FailedDestination
{
Mac48Address destination;
uint32_t seqnum;
};
- std::vector<FailedDestination> GetUnreachableDestinations(Mac48Address peerAddress, uint32_t port);
- uint32_t RequestSeqnum(Mac48Address dst);
- std::vector<Mac48Address> GetPrecursors(Mac48Address destination, uint32_t port);
+ std::vector<FailedDestination> GetUnreachableDestinations (Mac48Address peerAddress, uint32_t port);
+ uint32_t RequestSeqnum (Mac48Address dst);
+ std::vector<Mac48Address> GetPrecursors (Mac48Address destination, uint32_t port);
const static uint32_t PORT_ANY = 0xffffffff;
const static uint32_t MAX_METRIC = 0xffffffff;
private:
--- a/src/devices/mesh/hwmp-state.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/hwmp-state.cc Wed Mar 18 22:36:12 2009 +0300
@@ -37,23 +37,23 @@
return tid;
}
-HwmpState::HwmpState():
- m_myPreq(m_preqQueue.end()),
- m_preqId(1),
- m_myDsn(1),
- m_disabled(false),
- m_maxTtl(10)
+HwmpState::HwmpState ():
+ m_myPreq (m_preqQueue.end()),
+ m_preqId (1),
+ m_myDsn (1),
+ m_disabled (false),
+ m_maxTtl (10)
{
}
void
-HwmpState::SetRequestRouteCallback(
+HwmpState::SetRequestRouteCallback (
Callback<HwmpRtable::LookupResult, const Mac48Address&> cb)
{
m_requestRouteCallback = cb;
}
void
-HwmpState::SetRequestRootPathCallback(
+HwmpState::SetRequestRootPathCallback (
Callback<HwmpRtable::LookupResult, uint32_t> cb)
{
m_requestRootPathCallback = cb;
@@ -61,24 +61,24 @@
//Setting MAC
void
-HwmpState::SetMac(Ptr<MeshWifiMac> mac)
+HwmpState::SetMac (Ptr<MeshWifiMac> mac)
{
- mac->SetPeerStatusCallback(MakeCallback(&HwmpState::PeerStatus, this));
- mac->SetPreqReceivedCallback(MakeCallback(&HwmpState::ReceivePreq, this));
- mac->SetPrepReceivedCallback(MakeCallback(&HwmpState::ReceivePrep, this));
- mac->SetPerrReceivedCallback(MakeCallback(&HwmpState::ReceivePerr, this));
- m_address = mac->GetAddress();
- m_preqCallback = MakeCallback(&MeshWifiMac::SendPreq, mac);
- m_prepCallback = MakeCallback(&MeshWifiMac::SendPrep, mac);
- m_perrCallback = MakeCallback(&MeshWifiMac::SendPerr, mac);
+ mac->SetPeerStatusCallback (MakeCallback(&HwmpState::PeerStatus, this));
+ mac->SetPreqReceivedCallback (MakeCallback(&HwmpState::ReceivePreq, this));
+ mac->SetPrepReceivedCallback (MakeCallback(&HwmpState::ReceivePrep, this));
+ mac->SetPerrReceivedCallback (MakeCallback(&HwmpState::ReceivePerr, this));
+ m_address = mac->GetAddress ();
+ m_preqCallback = MakeCallback (&MeshWifiMac::SendPreq, mac);
+ m_prepCallback = MakeCallback (&MeshWifiMac::SendPrep, mac);
+ m_perrCallback = MakeCallback (&MeshWifiMac::SendPerr, mac);
}
-HwmpState::~HwmpState()
+HwmpState::~HwmpState ()
{
- m_preqQueue.clear();
+ m_preqQueue.clear ();
}
//Interaction with HWMP:
void
-HwmpState::SetRoutingInfoCallback(
+HwmpState::SetRoutingInfoCallback (
Callback<void, INFO> cb
)
{
@@ -86,308 +86,308 @@
}
void
-HwmpState::SetRetransmittersOfPerrCallback(
+HwmpState::SetRetransmittersOfPerrCallback (
Callback<std::vector<Mac48Address>, std::vector<HwmpRtable::FailedDestination>, uint32_t> cb)
{
m_retransmittersOfPerrCallback = cb;
}
void
-HwmpState::RequestDestination(Mac48Address dst)
+HwmpState::RequestDestination (Mac48Address dst)
{
- if (m_preqQueue.end() == m_myPreq)
+ if (m_preqQueue.end () == m_myPreq)
{
IeDot11sPreq preq;
//fill PREQ:
- preq.SetHopcount(0);
- preq.SetTTL(m_maxTtl);
- preq.SetPreqID(m_preqId++);
+ preq.SetHopcount (0);
+ preq.SetTTL (m_maxTtl);
+ preq.SetPreqID (m_preqId++);
if (m_preqId == MAX_PREQ_ID)
m_preqId = 0;
- preq.SetLifetime(TIME_TO_TU(dot11sParameters::dot11MeshHWMPactivePathTimeout));
- preq.SetOriginatorSeqNumber(m_myDsn++);
+ preq.SetLifetime (TIME_TO_TU(dot11sParameters::dot11MeshHWMPactivePathTimeout));
+ preq.SetOriginatorSeqNumber (m_myDsn++);
if (m_myDsn == MAX_DSN)
m_myDsn = 0;
- preq.SetOriginatorAddress(m_address);
- preq.AddDestinationAddressElement(false, false, dst, 0); //DO = 0, RF = 0
- if (m_preqTimer.IsRunning())
+ preq.SetOriginatorAddress (m_address);
+ preq.AddDestinationAddressElement (false, false, dst, 0); //DO = 0, RF = 0
+ if (m_preqTimer.IsRunning ())
{
- NS_LOG_DEBUG("No my preq");
- m_preqQueue.push_back(preq);
+ NS_LOG_DEBUG ("No my preq");
+ m_preqQueue.push_back (preq);
//set iterator position to my preq:
- m_myPreq = m_preqQueue.end() -1;
+ m_myPreq = m_preqQueue.end () -1;
}
else
{
- NS_LOG_DEBUG("Send PREQ now, "<<preq.GetPreqID()<<" destinations, now is "<<Simulator::Now());
- m_preqCallback(preq);
- NS_ASSERT(!m_preqTimer.IsRunning());
- m_preqTimer = Simulator::Schedule(dot11sParameters::dot11MeshHWMPpreqMinInterval, &HwmpState::SendOnePreq, this);
+ NS_LOG_DEBUG ("Send PREQ now, "<<preq.GetPreqID()<<" destinations, now is "<<Simulator::Now());
+ m_preqCallback (preq);
+ NS_ASSERT (!m_preqTimer.IsRunning());
+ m_preqTimer = Simulator::Schedule (dot11sParameters::dot11MeshHWMPpreqMinInterval, &HwmpState::SendOnePreq, this);
}
}
else
{
- NS_ASSERT(m_myPreq->GetOriginatorAddress() == m_address);
- NS_LOG_DEBUG("add a destination "<<dst);
- m_myPreq->AddDestinationAddressElement(false, false, dst, 0); //DO = 0, RF = 0
+ NS_ASSERT (m_myPreq->GetOriginatorAddress() == m_address);
+ NS_LOG_DEBUG ("add a destination "<<dst);
+ m_myPreq->AddDestinationAddressElement (false, false, dst, 0); //DO = 0, RF = 0
}
}
void
-HwmpState::SendPathError(std::vector<HwmpRtable::FailedDestination> destinations)
+HwmpState::SendPathError (std::vector<HwmpRtable::FailedDestination> destinations)
{
- std::vector<Mac48Address> receivers = m_retransmittersOfPerrCallback(destinations, m_ifIndex);
- NS_LOG_DEBUG("SendPathError started");
- if (receivers.size() == 0)
+ std::vector<Mac48Address> receivers = m_retransmittersOfPerrCallback (destinations, m_ifIndex);
+ NS_LOG_DEBUG ("SendPathError started");
+ if (receivers.size () == 0)
return;
- NS_LOG_DEBUG(m_address<<" Should Send PERR to");
- for (unsigned int i = 0; i < receivers.size(); i ++)
+ NS_LOG_DEBUG (m_address<<" Should Send PERR to");
+ for (unsigned int i = 0; i < receivers.size (); i ++)
{
- AddPerrReceiver(receivers[i]);
- NS_LOG_DEBUG(receivers[i]);
+ AddPerrReceiver (receivers[i]);
+ NS_LOG_DEBUG (receivers[i]);
}
- NS_LOG_DEBUG("To tel about failure with");
- for (unsigned int i = 0; i < destinations.size(); i ++)
+ NS_LOG_DEBUG ("To tel about failure with");
+ for (unsigned int i = 0; i < destinations.size (); i ++)
{
- m_myPerr.AddAddressUnit(destinations[i]);
- NS_LOG_DEBUG(destinations[i].destination);
+ m_myPerr.AddAddressUnit (destinations[i]);
+ NS_LOG_DEBUG (destinations[i].destination);
}
- if (!m_perrTimer.IsRunning())
+ if (!m_perrTimer.IsRunning ())
{
- m_perrCallback(m_myPerr,m_myPerrReceivers);
- m_myPerr.ResetPerr();
- m_perrTimer = Simulator::Schedule(dot11sParameters::dot11MeshHWMPperrMinInterval,&HwmpState::SendOnePerr,this);
+ m_perrCallback (m_myPerr,m_myPerrReceivers);
+ m_myPerr.ResetPerr ();
+ m_perrTimer = Simulator::Schedule (dot11sParameters::dot11MeshHWMPperrMinInterval,&HwmpState::SendOnePerr,this);
}
}
//needed to fill routing information structure
void
-HwmpState::SetAssociatedIfaceId(uint32_t interface)
+HwmpState::SetAssociatedIfaceId (uint32_t interface)
{
m_ifIndex = interface;
}
uint32_t
-HwmpState::GetAssociatedIfaceId()
+HwmpState::GetAssociatedIfaceId ()
{
return m_ifIndex;
}
//Interaction with MAC:
void
-HwmpState::ReceivePreq(IeDot11sPreq& preq, const Mac48Address& from, const uint32_t& metric)
+HwmpState::ReceivePreq (IeDot11sPreq& preq, const Mac48Address& from, const uint32_t& metric)
{
if (m_disabled)
return;
- if (preq.GetOriginatorAddress() == m_address)
+ if (preq.GetOriginatorAddress () == m_address)
return;
- preq.DecrementTtl();
- preq.IncrementMetric(metric);
- if (preq.GetTtl() == 0)
+ preq.DecrementTtl ();
+ preq.IncrementMetric (metric);
+ if (preq.GetTtl () == 0)
return;
//acceptance cretirea:
- std::map<Mac48Address, uint32_t>::iterator i = m_dsnDatabase.find(preq.GetOriginatorAddress());
- if (i == m_dsnDatabase.end())
+ std::map<Mac48Address, uint32_t>::iterator i = m_dsnDatabase.find (preq.GetOriginatorAddress());
+ if (i == m_dsnDatabase.end ())
{
- m_dsnDatabase[preq.GetOriginatorAddress()] = preq.GetOriginatorSeqNumber();
- m_preqMetricDatabase[preq.GetOriginatorAddress()] = preq.GetMetric();
+ m_dsnDatabase[preq.GetOriginatorAddress ()] = preq.GetOriginatorSeqNumber();
+ m_preqMetricDatabase[preq.GetOriginatorAddress ()] = preq.GetMetric();
}
else
{
- if (i->second > preq.GetOriginatorSeqNumber())
+ if (i->second > preq.GetOriginatorSeqNumber ())
return;
- if (i->second == preq.GetOriginatorSeqNumber())
+ if (i->second == preq.GetOriginatorSeqNumber ())
{
//find metric
std::map<Mac48Address, uint32_t>::iterator j =
- m_preqMetricDatabase.find(preq.GetOriginatorAddress());
- NS_ASSERT(j != m_dsnDatabase.end());
- if (j->second <= preq.GetMetric())
+ m_preqMetricDatabase.find (preq.GetOriginatorAddress());
+ NS_ASSERT (j != m_dsnDatabase.end());
+ if (j->second <= preq.GetMetric ())
return;
}
- m_dsnDatabase[preq.GetOriginatorAddress()] = preq.GetOriginatorSeqNumber();
- m_preqMetricDatabase[preq.GetOriginatorAddress()] = preq.GetMetric();
+ m_dsnDatabase[preq.GetOriginatorAddress ()] = preq.GetOriginatorSeqNumber();
+ m_preqMetricDatabase[preq.GetOriginatorAddress ()] = preq.GetMetric();
}
- NS_LOG_DEBUG(
- "PREQ from "<< preq.GetOriginatorAddress()
+ NS_LOG_DEBUG (
+ "PREQ from "<< preq.GetOriginatorAddress ()
<<", at "<< m_address
- <<", TTL ="<< (int)preq.GetTtl()
- <<", metric = "<< preq.GetMetric()
- <<", hopcount = "<< (int)preq.GetHopCount()
- <<", preqId = "<< preq.GetPreqID()
+ <<", TTL ="<< (int)preq.GetTtl ()
+ <<", metric = "<< preq.GetMetric ()
+ <<", hopcount = "<< (int)preq.GetHopCount ()
+ <<", preqId = "<< preq.GetPreqID ()
<<", transmitter is "<<from);
//fill routingTable
INFO newInfo;
newInfo.me = m_address;
- newInfo.destination = preq.GetOriginatorAddress();
+ newInfo.destination = preq.GetOriginatorAddress ();
newInfo.nextHop = from;
- newInfo.metric = preq.GetMetric();
- newInfo.lifetime = TU_TO_TIME(preq.GetLifetime());
+ newInfo.metric = preq.GetMetric ();
+ newInfo.lifetime = TU_TO_TIME (preq.GetLifetime());
newInfo.outPort = m_ifIndex;
- newInfo.dsn = preq.GetOriginatorSeqNumber();
+ newInfo.dsn = preq.GetOriginatorSeqNumber ();
newInfo.type = INFO_PREQ;
//check if can answer:
std::vector<Ptr<DestinationAddressUnit> > destinations = preq.GetDestinationList ();
- for (std::vector<Ptr<DestinationAddressUnit> >::iterator i = destinations.begin(); i != destinations.end(); i++)
+ for (std::vector<Ptr<DestinationAddressUnit> >::iterator i = destinations.begin (); i != destinations.end(); i++)
{
- if ((*i)->GetDestinationAddress() == Mac48Address::GetBroadcast())
+ if ((*i)->GetDestinationAddress () == Mac48Address::GetBroadcast())
{
//only proactive PREQ contains destination
//address as broadcast! Proactive preq MUST
//have destination count equal to 1 and
//per destination flags DO and RF
- NS_ASSERT(preq.GetDestCount() == 1);
- NS_ASSERT(((*i)->IsDo()) && ((*i)->IsRf()));
- NS_LOG_DEBUG("PROACTIVE PREQ RECEIVED");
+ NS_ASSERT (preq.GetDestCount() == 1);
+ NS_ASSERT (((*i)->IsDo()) && ((*i)->IsRf()));
+ NS_LOG_DEBUG ("PROACTIVE PREQ RECEIVED");
newInfo.type = INFO_PROACTIVE;
- m_routingInfoCallback(newInfo);
- if (!preq.IsNeedNotPrep())
+ m_routingInfoCallback (newInfo);
+ if (!preq.IsNeedNotPrep ())
{
- SendPrep(
- preq.GetOriginatorAddress(),
+ SendPrep (
+ preq.GetOriginatorAddress (),
m_address,
from,
- preq.GetMetric(),
- preq.GetOriginatorSeqNumber(),
+ preq.GetMetric (),
+ preq.GetOriginatorSeqNumber (),
m_myDsn ++,
- preq.GetLifetime()
+ preq.GetLifetime ()
);
if (m_myDsn == MAX_DSN)
m_myDsn = 0;
}
break;
}
- if ((*i)->GetDestinationAddress()==m_address)
+ if ((*i)->GetDestinationAddress () == m_address)
{
- preq.DelDestinationAddressElement((*i)->GetDestinationAddress());
- SendPrep(
- preq.GetOriginatorAddress(),
+ preq.DelDestinationAddressElement ((*i)->GetDestinationAddress());
+ SendPrep (
+ preq.GetOriginatorAddress (),
m_address,
from,
0,
- preq.GetOriginatorSeqNumber(),
+ preq.GetOriginatorSeqNumber (),
m_myDsn++,
- preq.GetLifetime()
+ preq.GetLifetime ()
);
if (m_myDsn == MAX_DSN)
m_myDsn = 0;
continue;
}
//check if can answer:
- HwmpRtable::LookupResult result = m_requestRouteCallback((*i)->GetDestinationAddress());
- if ((!((*i)->IsDo())) && (result.retransmitter!=Mac48Address::GetBroadcast()))
+ HwmpRtable::LookupResult result = m_requestRouteCallback ((*i)->GetDestinationAddress());
+ if ((! ((*i)->IsDo())) && (result.retransmitter != Mac48Address::GetBroadcast()))
{
//have a valid information and acn answer
- if ((*i)->IsRf())
- (*i)->SetFlags(true, false); //DO = 1, RF = 0 (as it was)
+ if ((*i)->IsRf ())
+ (*i)->SetFlags (true, false); //DO = 1, RF = 0 (as it was)
else
{
//send a PREP and delete destination
- preq.DelDestinationAddressElement((*i)->GetDestinationAddress());
- SendPrep(
- preq.GetOriginatorAddress(),
- (*i)->GetDestinationAddress(),
+ preq.DelDestinationAddressElement ((*i)->GetDestinationAddress());
+ SendPrep (
+ preq.GetOriginatorAddress (),
+ (*i)->GetDestinationAddress (),
result.retransmitter,
result.metric,
- preq.GetOriginatorSeqNumber(),
+ preq.GetOriginatorSeqNumber (),
result.seqnum,
- preq.GetLifetime()
+ preq.GetLifetime ()
);
continue;
}
}
}
- m_routingInfoCallback(newInfo);
+ m_routingInfoCallback (newInfo);
//chack if must retransmit:
- if (preq.GetDestCount() == 0)
+ if (preq.GetDestCount () == 0)
return;
- if (m_preqTimer.IsRunning())
+ if (m_preqTimer.IsRunning ())
{
- m_preqQueue.push_back(preq);
+ m_preqQueue.push_back (preq);
}
else
{
- m_preqCallback(preq);
- NS_ASSERT(!m_preqTimer.IsRunning());
- m_preqTimer = Simulator::Schedule(dot11sParameters::dot11MeshHWMPpreqMinInterval, &HwmpState::SendOnePreq, this);
+ m_preqCallback (preq);
+ NS_ASSERT (!m_preqTimer.IsRunning());
+ m_preqTimer = Simulator::Schedule (dot11sParameters::dot11MeshHWMPpreqMinInterval, &HwmpState::SendOnePreq, this);
}
}
void
-HwmpState::ReceivePrep(IeDot11sPrep& prep, const Mac48Address& from, const uint32_t& metric)
+HwmpState::ReceivePrep (IeDot11sPrep& prep, const Mac48Address& from, const uint32_t& metric)
{
if (m_disabled)
return;
- prep.DecrementTtl();
- prep.IncrementMetric(metric);
+ prep.DecrementTtl ();
+ prep.IncrementMetric (metric);
//acceptance cretirea:
- std::map<Mac48Address, uint32_t>::iterator i = m_dsnDatabase.find(prep.GetDestinationAddress());
- if (i == m_dsnDatabase.end())
+ std::map<Mac48Address, uint32_t>::iterator i = m_dsnDatabase.find (prep.GetDestinationAddress());
+ if (i == m_dsnDatabase.end ())
{
- m_dsnDatabase[prep.GetDestinationAddress()] = prep.GetDestinationSeqNumber();
+ m_dsnDatabase[prep.GetDestinationAddress ()] = prep.GetDestinationSeqNumber();
}
else
- if (i->second > prep.GetDestinationSeqNumber())
+ if (i->second > prep.GetDestinationSeqNumber ())
return;
//update routing info
- HwmpRtable::LookupResult result = m_requestRouteCallback(prep.GetDestinationAddress());
- if (result.retransmitter == Mac48Address::GetBroadcast())
+ HwmpRtable::LookupResult result = m_requestRouteCallback (prep.GetDestinationAddress());
+ if (result.retransmitter == Mac48Address::GetBroadcast ())
//try to look for default route
- result = m_requestRootPathCallback(m_ifIndex);
- if ((result.retransmitter == Mac48Address::GetBroadcast())&&(m_address != prep.GetDestinationAddress()))
+ result = m_requestRootPathCallback (m_ifIndex);
+ if ((result.retransmitter == Mac48Address::GetBroadcast ())&&(m_address != prep.GetDestinationAddress()))
return;
INFO newInfo;
newInfo.me = m_address;
- newInfo.destination = prep.GetOriginatorAddress();
- newInfo.source = prep.GetDestinationAddress();
+ newInfo.destination = prep.GetOriginatorAddress ();
+ newInfo.source = prep.GetDestinationAddress ();
newInfo.nextHop = from;
- newInfo.metric = prep.GetMetric();
- newInfo.lifetime = TU_TO_TIME(prep.GetLifetime());
+ newInfo.metric = prep.GetMetric ();
+ newInfo.lifetime = TU_TO_TIME (prep.GetLifetime());
newInfo.outPort = m_ifIndex;
- newInfo.dsn = prep.GetOriginatorSeqNumber();
+ newInfo.dsn = prep.GetOriginatorSeqNumber ();
newInfo.prevHop = result.retransmitter;
newInfo.type = INFO_PREP;
- NS_LOG_DEBUG("Path to "<<newInfo.source<<", i am "<<m_address<<", precursor is "<<from);
- NS_LOG_DEBUG("Path to "<<newInfo.destination<<", i am "<<m_address<<", precursor is "<<result.retransmitter);
- m_routingInfoCallback(newInfo);
- if (prep.GetDestinationAddress() == m_address)
+ NS_LOG_DEBUG ("Path to "<<newInfo.source<<", i am "<<m_address<<", precursor is "<<from);
+ NS_LOG_DEBUG ("Path to "<<newInfo.destination<<", i am "<<m_address<<", precursor is "<<result.retransmitter);
+ m_routingInfoCallback (newInfo);
+ if (prep.GetDestinationAddress () == m_address)
{
- NS_LOG_DEBUG("Destination resolved"<<newInfo.destination);
+ NS_LOG_DEBUG ("Destination resolved"<<newInfo.destination);
return;
}
- m_prepCallback(prep, result.retransmitter);
+ m_prepCallback (prep, result.retransmitter);
}
void
-HwmpState::ReceivePerr(IeDot11sPerr& perr, const Mac48Address& from)
+HwmpState::ReceivePerr (IeDot11sPerr& perr, const Mac48Address& from)
{
if (m_disabled)
return;
- NS_LOG_DEBUG(m_address<<" RECEIVED PERR from "<<from);
+ NS_LOG_DEBUG (m_address<<" RECEIVED PERR from "<<from);
/**
* Check forwarding conditions:
*/
- std::vector<HwmpRtable::FailedDestination> destinations = perr.GetAddressUnitVector();
- for (unsigned int i = 0; i < destinations.size(); i ++)
+ std::vector<HwmpRtable::FailedDestination> destinations = perr.GetAddressUnitVector ();
+ for (unsigned int i = 0; i < destinations.size (); i ++)
{
/**
* Lookup for a valid routing information
*/
- HwmpRtable::LookupResult result = m_requestRouteCallback(destinations[i].destination);
+ HwmpRtable::LookupResult result = m_requestRouteCallback (destinations[i].destination);
if (
(result.retransmitter != from)
- ||(result.seqnum >= destinations[i].seqnum)
+ || (result.seqnum >= destinations[i].seqnum)
)
- perr.DeleteAddressUnit(destinations[i].destination);
+ perr.DeleteAddressUnit (destinations[i].destination);
}
- NS_LOG_DEBUG("Retransmit "<<(int)perr.GetNumOfDest());
- if (perr.GetNumOfDest() == 0)
+ NS_LOG_DEBUG ("Retransmit "<<(int)perr.GetNumOfDest());
+ if (perr.GetNumOfDest () == 0)
return;
- destinations = perr.GetAddressUnitVector();
- SendPathError(destinations);
+ destinations = perr.GetAddressUnitVector ();
+ SendPathError (destinations);
}
void
-HwmpState::PeerStatus(const Mac48Address peerAddress, const bool status, const uint32_t metric)
+HwmpState::PeerStatus (const Mac48Address peerAddress, const bool status, const uint32_t metric)
{
INFO newInfo;
newInfo.me = m_address;
@@ -400,115 +400,115 @@
newInfo.type = INFO_NEW_PEER;
else
newInfo.type = INFO_FAILED_PEER;
- m_routingInfoCallback(newInfo);
+ m_routingInfoCallback (newInfo);
}
bool
-HwmpState::SetRoot()
+HwmpState::SetRoot ()
{
#if 0
//TODO:: delete this lines!!!!!!!
- if (m_address != Mac48Address("00:00:00:00:00:10"))
+ if (m_address != Mac48Address ("00:00:00:00:00:10"))
return false;
//TODO
#endif
- Simulator::Schedule(dot11sParameters::dot11MeshHWMPactiveRootTimeout, &HwmpState::SendProactivePreq, this);
+ Simulator::Schedule (dot11sParameters::dot11MeshHWMPactiveRootTimeout, &HwmpState::SendProactivePreq, this);
return true;
}
void
-HwmpState::SendProactivePreq()
+HwmpState::SendProactivePreq ()
{
- NS_LOG_DEBUG("Sending proactive PREQ");
+ NS_LOG_DEBUG ("Sending proactive PREQ");
IeDot11sPreq preq;
//By default: must answer
- preq.SetHopcount(0);
- preq.SetTTL(m_maxTtl);
- preq.SetPreqID(m_preqId++);
+ preq.SetHopcount (0);
+ preq.SetTTL (m_maxTtl);
+ preq.SetPreqID (m_preqId++);
if (m_preqId == MAX_PREQ_ID)
m_preqId = 0;
- preq.SetLifetime(TIME_TO_TU(dot11sParameters::dot11MeshHWMPpathToRootInterval));
- preq.SetOriginatorSeqNumber(m_myDsn++);
+ preq.SetLifetime (TIME_TO_TU(dot11sParameters::dot11MeshHWMPpathToRootInterval));
+ preq.SetOriginatorSeqNumber (m_myDsn++);
if (m_myDsn == MAX_DSN)
m_myDsn = 0;
- preq.SetOriginatorAddress(m_address);
- preq.AddDestinationAddressElement(
+ preq.SetOriginatorAddress (m_address);
+ preq.AddDestinationAddressElement (
true,
true,
- Mac48Address::GetBroadcast()
+ Mac48Address::GetBroadcast ()
,0);
- if (m_preqTimer.IsRunning())
- m_preqQueue.push_back(preq);
+ if (m_preqTimer.IsRunning ())
+ m_preqQueue.push_back (preq);
else
{
- NS_LOG_DEBUG("Send now "<<preq.GetPreqID());
- m_preqCallback(preq);
- NS_ASSERT(!m_preqTimer.IsRunning());
- m_preqTimer = Simulator::Schedule(dot11sParameters::dot11MeshHWMPpreqMinInterval, &HwmpState::SendOnePreq, this);
+ NS_LOG_DEBUG ("Send now "<<preq.GetPreqID());
+ m_preqCallback (preq);
+ NS_ASSERT (!m_preqTimer.IsRunning());
+ m_preqTimer = Simulator::Schedule (dot11sParameters::dot11MeshHWMPpreqMinInterval, &HwmpState::SendOnePreq, this);
}
- Simulator::Schedule(dot11sParameters::dot11MeshHWMPactiveRootTimeout, &HwmpState::SendProactivePreq, this);
+ Simulator::Schedule (dot11sParameters::dot11MeshHWMPactiveRootTimeout, &HwmpState::SendProactivePreq, this);
}
void
-HwmpState::AddPerrReceiver(Mac48Address receiver)
+HwmpState::AddPerrReceiver (Mac48Address receiver)
{
/**
* add new vector of addresses to m_perrReceiversand check
* duplicates
*/
- for (unsigned int j = 0; j < m_myPerrReceivers.size(); j++)
+ for (unsigned int j = 0; j < m_myPerrReceivers.size (); j++)
if (m_myPerrReceivers[j] == receiver)
return;
- m_myPerrReceivers.push_back(receiver);
+ m_myPerrReceivers.push_back (receiver);
}
void
-HwmpState::UnSetRoot()
+HwmpState::UnSetRoot ()
{
}
void
-HwmpState::Disable()
+HwmpState::Disable ()
{
m_disabled = true;
}
void
-HwmpState::Enable()
+HwmpState::Enable ()
{
m_disabled = false;
}
Mac48Address
-HwmpState::GetAddress()
+HwmpState::GetAddress ()
{
return m_address;
}
void
-HwmpState::SendOnePreq()
+HwmpState::SendOnePreq ()
{
- if (m_preqQueue.size() == 0)
+ if (m_preqQueue.size () == 0)
return;
- if (m_myPreq == m_preqQueue.begin())
- m_myPreq == m_preqQueue.end();
+ if (m_myPreq == m_preqQueue.begin ())
+ m_myPreq == m_preqQueue.end ();
IeDot11sPreq preq = m_preqQueue[0];
- NS_LOG_DEBUG(
- "Sending PREQ from "<<preq.GetOriginatorAddress() <<
- " destinations are "<<(int)preq.GetDestCount()<<
- ", at "<<Simulator::Now()<<
- ", store in queue "<<m_preqQueue.size()<<
+ NS_LOG_DEBUG (
+ "Sending PREQ from "<<preq.GetOriginatorAddress () <<
+ " destinations are "<< (int)preq.GetDestCount()<<
+ ", at "<<Simulator::Now ()<<
+ ", store in queue "<<m_preqQueue.size ()<<
" preqs"<<", I am "<<m_address);
- m_preqCallback(preq);
+ m_preqCallback (preq);
//erase first!
- m_preqQueue.erase(m_preqQueue.begin());
+ m_preqQueue.erase (m_preqQueue.begin());
//reschedule sending PREQ
- NS_ASSERT(!m_preqTimer.IsRunning());
- m_preqTimer = Simulator::Schedule(dot11sParameters::dot11MeshHWMPpreqMinInterval, &HwmpState::SendOnePreq, this);
+ NS_ASSERT (!m_preqTimer.IsRunning());
+ m_preqTimer = Simulator::Schedule (dot11sParameters::dot11MeshHWMPpreqMinInterval, &HwmpState::SendOnePreq, this);
}
void
-HwmpState::SendPrep(Mac48Address dst,
+HwmpState::SendPrep (Mac48Address dst,
Mac48Address src,
Mac48Address retransmitter,
uint32_t initMetric,
@@ -517,23 +517,23 @@
uint32_t lifetime)
{
IeDot11sPrep prep;
- prep.SetHopcount(0);
- prep.SetTTL(m_maxTtl);
- prep.SetDestinationAddress(dst);
- prep.SetDestinationSeqNumber(dsn);
- prep.SetLifetime(lifetime);
- prep.SetMetric(0);
- prep.SetOriginatorAddress(src);
- prep.SetOriginatorSeqNumber(originatorDsn);
- m_prepCallback(prep, retransmitter);
+ prep.SetHopcount (0);
+ prep.SetTTL (m_maxTtl);
+ prep.SetDestinationAddress (dst);
+ prep.SetDestinationSeqNumber (dsn);
+ prep.SetLifetime (lifetime);
+ prep.SetMetric (0);
+ prep.SetOriginatorAddress (src);
+ prep.SetOriginatorSeqNumber (originatorDsn);
+ m_prepCallback (prep, retransmitter);
}
void
-HwmpState::SendOnePerr()
+HwmpState::SendOnePerr ()
{
- if (m_myPerr.GetNumOfDest() == 0)
+ if (m_myPerr.GetNumOfDest () == 0)
return;
- m_perrCallback(m_myPerr, m_myPerrReceivers);
- m_myPerr.ResetPerr();
+ m_perrCallback (m_myPerr, m_myPerrReceivers);
+ m_myPerr.ResetPerr ();
}
}//namespace ns3
--- a/src/devices/mesh/hwmp-state.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/hwmp-state.h Wed Mar 18 22:36:12 2009 +0300
@@ -45,18 +45,18 @@
*/
class HwmpState : public Object {
public:
- static TypeId GetTypeId();
- HwmpState();
- ~HwmpState();
+ static TypeId GetTypeId ();
+ HwmpState ();
+ ~HwmpState ();
/**
* \brief Interface with HWMP - Hwmp can only
* request address and collect routing
* information
*/
- void SetRequestRouteCallback(
+ void SetRequestRouteCallback (
Callback<HwmpRtable::LookupResult, const Mac48Address&> cb);
- void SetRequestRootPathCallback(
+ void SetRequestRootPathCallback (
Callback<HwmpRtable::LookupResult, uint32_t> cb);
enum InfoType {
@@ -80,39 +80,39 @@
Time lifetime;
enum InfoType type;
} INFO;
- void SetRoutingInfoCallback(
+ void SetRoutingInfoCallback (
Callback<void, INFO> cb
);
- void SetRetransmittersOfPerrCallback(
+ void SetRetransmittersOfPerrCallback (
Callback<std::vector<Mac48Address>, std::vector<HwmpRtable::FailedDestination>, uint32_t> cb);
- void RequestDestination(Mac48Address dest);
- void SendPathError(std::vector<HwmpRtable::FailedDestination> destinations);
- void SetAssociatedIfaceId(uint32_t interface);
- uint32_t GetAssociatedIfaceId();
+ void RequestDestination (Mac48Address dest);
+ void SendPathError (std::vector<HwmpRtable::FailedDestination> destinations);
+ void SetAssociatedIfaceId (uint32_t interface);
+ uint32_t GetAssociatedIfaceId ();
//Mac interaction:
- void SetMac(Ptr<MeshWifiMac> mac);
- void SetSendPreqCallback(
+ void SetMac (Ptr<MeshWifiMac> mac);
+ void SetSendPreqCallback (
Callback<void, const IeDot11sPreq&> cb);
- void SetSendPrepCallback(
+ void SetSendPrepCallback (
Callback<void, const IeDot11sPrep&> cb);
- void SetSendPerrCallback(
+ void SetSendPerrCallback (
Callback<void, const IeDot11sPerr&, std::vector<Mac48Address> > cb);
- void ReceivePreq(IeDot11sPreq&, const Mac48Address& from, const uint32_t& metric);
- void ReceivePrep(IeDot11sPrep&, const Mac48Address& from, const uint32_t& metric);
- void ReceivePerr(IeDot11sPerr&, const Mac48Address& from);
- void PeerStatus(
+ void ReceivePreq (IeDot11sPreq&, const Mac48Address& from, const uint32_t& metric);
+ void ReceivePrep (IeDot11sPrep&, const Mac48Address& from, const uint32_t& metric);
+ void ReceivePerr (IeDot11sPerr&, const Mac48Address& from);
+ void PeerStatus (
const Mac48Address peerAddress,
const bool status,
const uint32_t metric
);
//Proactive mode routines:
- bool SetRoot();
- void UnSetRoot();
+ bool SetRoot ();
+ void UnSetRoot ();
//external handling:
- void Disable();
- void Enable();
+ void Disable ();
+ void Enable ();
//DEBUG purpose:
- Mac48Address GetAddress();
+ Mac48Address GetAddress ();
private:
static const uint32_t MAX_PREQ_ID = 0xffffffff;
static const uint32_t MAX_DSN = 0xffffffff;
@@ -122,14 +122,14 @@
uint32_t m_ifIndex;
//timers for PREQ and PREP:
EventId m_preqTimer;
- void SendOnePreq();
+ void SendOnePreq ();
std::vector<IeDot11sPreq>
m_preqQueue;
//true means that we can add a destination to
//existing PREQ element
//False means that we must send
EventId m_prepTimer;
- void SendPrep(
+ void SendPrep (
Mac48Address dst, //dst is PREQ's originator address
Mac48Address src, //src is PREQ's destination address
Mac48Address retransmitter,
@@ -165,7 +165,7 @@
bool m_disabled;
//Proactive PREQ mechanism:
EventId m_proactivePreqTimer;
- void SendProactivePreq();
+ void SendProactivePreq ();
/**
* \brief Two PERRs may not be sent closer to
* each other than
@@ -177,9 +177,9 @@
*/
IeDot11sPerr m_myPerr;
std::vector<Mac48Address> m_myPerrReceivers;
- void AddPerrReceiver(Mac48Address receiver);
+ void AddPerrReceiver (Mac48Address receiver);
EventId m_perrTimer;
- void SendOnePerr();
+ void SendOnePerr ();
//Configurable parameters:
uint8_t m_maxTtl;
};
--- a/src/devices/mesh/hwmp.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/hwmp.cc Wed Mar 18 22:36:12 2009 +0300
@@ -33,58 +33,58 @@
NS_OBJECT_ENSURE_REGISTERED (Hwmp);
NS_OBJECT_ENSURE_REGISTERED (HwmpTag);
//Class HwmpTag:
-HwmpTag::HwmpTag()
+HwmpTag::HwmpTag ()
{
}
-HwmpTag::~HwmpTag()
+HwmpTag::~HwmpTag ()
{
}
void
-HwmpTag::SetAddress(Mac48Address retransmitter)
+HwmpTag::SetAddress (Mac48Address retransmitter)
{
m_address = retransmitter;
}
Mac48Address
-HwmpTag::GetAddress()
+HwmpTag::GetAddress ()
{
return m_address;
}
void
-HwmpTag::SetTtl(uint8_t ttl)
+HwmpTag::SetTtl (uint8_t ttl)
{
m_ttl = ttl;
}
uint8_t
-HwmpTag::GetTtl()
+HwmpTag::GetTtl ()
{
return m_ttl;
}
void
-HwmpTag::SetMetric(uint32_t metric)
+HwmpTag::SetMetric (uint32_t metric)
{
m_metric = metric;
}
uint32_t
-HwmpTag::GetMetric()
+HwmpTag::GetMetric ()
{
return m_metric;
}
void
-HwmpTag::SetSeqno(uint32_t seqno)
+HwmpTag::SetSeqno (uint32_t seqno)
{
m_seqno = seqno;
}
uint32_t
-HwmpTag::GetSeqno()
+HwmpTag::GetSeqno ()
{
return m_seqno;
}
@@ -100,13 +100,13 @@
}
TypeId
-HwmpTag::GetInstanceTypeId() const
- {
- return GetTypeId();
- }
+HwmpTag::GetInstanceTypeId () const
+{
+ return GetTypeId ();
+}
uint32_t
-HwmpTag::GetSerializedSize() const
+HwmpTag::GetSerializedSize () const
{
return 6 //address
+1 //ttl
@@ -114,38 +114,38 @@
}
void
-HwmpTag::Serialize(TagBuffer i) const
- {
- uint8_t address[6];
- int j;
- m_address.CopyTo(address);
- i.WriteU8 (m_ttl);
- i.WriteU32 (m_metric);
- for (j = 0; j < 6; j ++)
- i.WriteU8 (address[j]);
- }
+HwmpTag::Serialize (TagBuffer i) const
+{
+ uint8_t address[6];
+ int j;
+ m_address.CopyTo (address);
+ i.WriteU8 (m_ttl);
+ i.WriteU32 (m_metric);
+ for (j = 0; j < 6; j ++)
+ i.WriteU8 (address[j]);
+}
void
HwmpTag::Deserialize (TagBuffer i)
{
uint8_t address[6];
int j;
- m_ttl = i.ReadU8();
- m_metric = i.ReadU32();
+ m_ttl = i.ReadU8 ();
+ m_metric = i.ReadU32 ();
for (j = 0; j < 6; j ++)
- address[j] = i.ReadU8();
- m_address.CopyFrom(address);
+ address[j] = i.ReadU8 ();
+ m_address.CopyFrom (address);
}
void
HwmpTag::Print (std::ostream &os) const
- {
- os << "address=" << m_address;
- os << "ttl=" << m_ttl;
- os << "metrc=" << m_metric;
- }
+{
+ os << "address=" << m_address;
+ os << "ttl=" << m_ttl;
+ os << "metrc=" << m_metric;
+}
void
-HwmpTag::DecrementTtl()
+HwmpTag::DecrementTtl ()
{
m_ttl --;
}
@@ -155,56 +155,56 @@
{
static TypeId tid = TypeId ("ns3::Hwmp")
.SetParent<MeshL2RoutingProtocol> ()
- .AddConstructor<Hwmp>();
+ .AddConstructor<Hwmp> ();
return tid;
}
-Hwmp::Hwmp():
- m_rtable(CreateObject<HwmpRtable> ()),
- m_maxTtl(32),
- m_broadcastPerr(false)
+Hwmp::Hwmp ():
+ m_rtable (CreateObject<HwmpRtable> ()),
+ m_maxTtl (32),
+ m_broadcastPerr (false)
{
}
-Hwmp::~Hwmp()
+Hwmp::~Hwmp ()
{
}
void
-Hwmp::DoDispose()
+Hwmp::DoDispose ()
{
- for (std::map<Mac48Address, EventId>::iterator i = m_timeoutDatabase.begin(); i != m_timeoutDatabase.end(); i ++)
- i->second.Cancel();
- m_timeoutDatabase.clear();
- m_seqnoDatabase.clear();
+ for (std::map<Mac48Address, EventId>::iterator i = m_timeoutDatabase.begin (); i != m_timeoutDatabase.end(); i ++)
+ i->second.Cancel ();
+ m_timeoutDatabase.clear ();
+ m_seqnoDatabase.clear ();
m_rtable = 0;
/**
* clear routing queue:
*/
for (
- std::map<Mac48Address, std::queue<QueuedPacket> >::iterator i = m_rqueue.begin();
- i != m_rqueue.end();
+ std::map<Mac48Address, std::queue<QueuedPacket> >::iterator i = m_rqueue.begin ();
+ i != m_rqueue.end ();
i++
)
{
while (1)
{
- if (i->second.empty())
+ if (i->second.empty ())
break;
- i->second.pop();
+ i->second.pop ();
}
}
- m_rqueue.clear();
+ m_rqueue.clear ();
/**
* clear HWMP states
*/
- for (unsigned int i = 0; i < m_hwmpStates.size(); i ++)
+ for (unsigned int i = 0; i < m_hwmpStates.size (); i ++)
m_hwmpStates[i] = 0;
- m_hwmpStates.clear();
+ m_hwmpStates.clear ();
}
bool
-Hwmp::RequestRoute(
+Hwmp::RequestRoute (
uint32_t sourceIface,
const Mac48Address source,
const Mac48Address destination,
@@ -215,46 +215,46 @@
{
HwmpRtable::LookupResult result;
HwmpTag tag;
- if (sourceIface == GetMeshPoint()->GetIfIndex())
+ if (sourceIface == GetMeshPoint ()->GetIfIndex())
// packet from level 3
{
- if (destination == Mac48Address::GetBroadcast())
+ if (destination == Mac48Address::GetBroadcast ())
{
//set seqno!
- tag.SetSeqno(m_seqno++);
+ tag.SetSeqno (m_seqno++);
if (m_seqno == MAX_SEQNO)
m_seqno = 0;
}
- tag.SetTtl(m_maxTtl);
+ tag.SetTtl (m_maxTtl);
}
else
// packet from own interface
{
- NS_ASSERT(packet->FindFirstMatchingTag(tag));
+ NS_ASSERT (packet->FindFirstMatchingTag(tag));
//check seqno!
- if (destination == Mac48Address::GetBroadcast())
+ if (destination == Mac48Address::GetBroadcast ())
{
- std::map<Mac48Address, uint32_t>::iterator i = m_seqnoDatabase.find(source);
- if (i == m_seqnoDatabase.end())
- m_seqnoDatabase[source] = tag.GetSeqno();
+ std::map<Mac48Address, uint32_t>::iterator i = m_seqnoDatabase.find (source);
+ if (i == m_seqnoDatabase.end ())
+ m_seqnoDatabase[source] = tag.GetSeqno ();
else
{
- if (i->second >= tag.GetSeqno())
+ if (i->second >= tag.GetSeqno ())
return false;
- m_seqnoDatabase[source] = tag.GetSeqno();
+ m_seqnoDatabase[source] = tag.GetSeqno ();
}
}
}
- tag.SetAddress(Mac48Address::GetBroadcast());
- if (tag.GetTtl() == 0)
+ tag.SetAddress (Mac48Address::GetBroadcast());
+ if (tag.GetTtl () == 0)
return false;
- tag.DecrementTtl();
- if (destination == Mac48Address::GetBroadcast())
+ tag.DecrementTtl ();
+ if (destination == Mac48Address::GetBroadcast ())
{
//add RA tag RA = broadcast
- packet->RemoveAllTags();
- packet->AddTag(tag);
- routeReply(
+ packet->RemoveAllTags ();
+ packet->AddTag (tag);
+ routeReply (
true,
packet,
source,
@@ -264,57 +264,57 @@
);
return true;
}
- result = m_rtable->LookupReactive(destination);
- if (result.retransmitter == Mac48Address::GetBroadcast())
+ result = m_rtable->LookupReactive (destination);
+ if (result.retransmitter == Mac48Address::GetBroadcast ())
{
//no actual route exists, queue packet and start route
//discover procedure
- if (sourceIface != GetMeshPoint()->GetIfIndex())
+ if (sourceIface != GetMeshPoint ()->GetIfIndex())
{
//Start path error procedure:
- NS_LOG_DEBUG("Must Send PERR");
+ NS_LOG_DEBUG ("Must Send PERR");
std::vector<HwmpRtable::FailedDestination> destinations;
HwmpRtable::FailedDestination dst;
- dst.seqnum = m_rtable->RequestSeqnum(destination);
+ dst.seqnum = m_rtable->RequestSeqnum (destination);
dst.destination = destination;
- destinations.push_back(dst);
- StartPathErrorProcedure(destinations, result.ifIndex);
+ destinations.push_back (dst);
+ StartPathErrorProcedure (destinations, result.ifIndex);
}
MeshL2RoutingProtocol::QueuedPacket pkt;
- packet->RemoveAllTags();
- packet->AddTag(tag);
+ packet->RemoveAllTags ();
+ packet->AddTag (tag);
pkt.pkt = packet;
pkt.dst = destination;
pkt.src = source;
pkt.protocol = protocolType;
pkt.reply = routeReply;
pkt.inPort = sourceIface;
- QueuePacket(pkt);
- for (unsigned int i = 0; i< m_requestCallback.size(); i++)
+ QueuePacket (pkt);
+ for (unsigned int i = 0; i< m_requestCallback.size (); i++)
{
if ((m_modes[i] == REACTIVE) || (m_modes[i] == ROOT))
{
- if (ShouldSendPreq(destination))
- m_requestCallback[i](destination);
+ if (ShouldSendPreq (destination))
+ m_requestCallback[i] (destination);
}
else
{
- NS_ASSERT(false);
+ NS_ASSERT (false);
//PROACTIVE mode
//lookup a default route
- result = m_rtable->LookupProactive(m_hwmpStates[i]->GetAssociatedIfaceId());
- if (result.retransmitter == Mac48Address::GetBroadcast())
+ result = m_rtable->LookupProactive (m_hwmpStates[i]->GetAssociatedIfaceId());
+ if (result.retransmitter == Mac48Address::GetBroadcast ())
{
- m_rtable->DeleteProactivePath(m_hwmpStates[i]->GetAssociatedIfaceId());
+ m_rtable->DeleteProactivePath (m_hwmpStates[i]->GetAssociatedIfaceId());
m_modes[i] = REACTIVE;
- if (ShouldSendPreq(destination))
- m_requestCallback[i](destination);
+ if (ShouldSendPreq (destination))
+ m_requestCallback[i] (destination);
continue;
}
- tag.SetAddress(result.retransmitter);
- packet->RemoveAllTags();
- packet->AddTag(tag);
- routeReply(
+ tag.SetAddress (result.retransmitter);
+ packet->RemoveAllTags ();
+ packet->AddTag (tag);
+ routeReply (
true,
packet,
source,
@@ -324,17 +324,17 @@
);
}
}
- for (unsigned int i = 0; i< m_requestCallback.size(); i++)
+ for (unsigned int i = 0; i< m_requestCallback.size (); i++)
{
- m_requestCallback[i](Mac48Address("00:00:00:00:00:19"));
+ m_requestCallback[i] (Mac48Address("00:00:00:00:00:19"));
}
}
else
{
- tag.SetAddress(result.retransmitter);
- packet->RemoveAllTags();
- packet->AddTag(tag);
- routeReply(
+ tag.SetAddress (result.retransmitter);
+ packet->RemoveAllTags ();
+ packet->AddTag (tag);
+ routeReply (
true,
packet,
source,
@@ -346,47 +346,47 @@
return true;
}
bool
-Hwmp::AttachPorts(std::vector<Ptr<NetDevice> > ports)
+Hwmp::AttachPorts (std::vector<Ptr<NetDevice> > ports)
{
- for (std::vector<Ptr<NetDevice> >::iterator i = ports.begin(); i != ports.end(); i++)
+ for (std::vector<Ptr<NetDevice> >::iterator i = ports.begin (); i != ports.end(); i++)
{
//Checking netdevice:
const WifiNetDevice * wifiNetDev = dynamic_cast<const WifiNetDevice *> (PeekPointer (*i));
if (wifiNetDev == NULL)
return false;
- MeshWifiMac * meshWifiMac = dynamic_cast<MeshWifiMac *> (PeekPointer (wifiNetDev->GetMac()));
+ MeshWifiMac * meshWifiMac = dynamic_cast<MeshWifiMac *> (PeekPointer (wifiNetDev->GetMac ()));
if (meshWifiMac == NULL)
return false;
//Adding HWMP-state
Ptr<HwmpState> hwmpState = CreateObject<HwmpState> ();
- hwmpState->SetRoutingInfoCallback(MakeCallback(&Hwmp::ObtainRoutingInformation, this));
- hwmpState->SetMac(meshWifiMac);
- hwmpState->SetRequestRouteCallback(MakeCallback(&Hwmp::RequestRouteForAddress, this));
- hwmpState->SetRequestRootPathCallback(MakeCallback(&Hwmp::RequestRootPathForPort, this));
- hwmpState->SetAssociatedIfaceId(wifiNetDev->GetIfIndex());
- hwmpState->SetRetransmittersOfPerrCallback(MakeCallback(&Hwmp::GetRetransmittersForFailedDestinations,this));
- m_hwmpStates.push_back(hwmpState);
- m_requestCallback.push_back(MakeCallback(&HwmpState::RequestDestination, hwmpState));
- m_pathErrorCallback.push_back(MakeCallback(&HwmpState::SendPathError, hwmpState));
+ hwmpState->SetRoutingInfoCallback (MakeCallback(&Hwmp::ObtainRoutingInformation, this));
+ hwmpState->SetMac (meshWifiMac);
+ hwmpState->SetRequestRouteCallback (MakeCallback(&Hwmp::RequestRouteForAddress, this));
+ hwmpState->SetRequestRootPathCallback (MakeCallback(&Hwmp::RequestRootPathForPort, this));
+ hwmpState->SetAssociatedIfaceId (wifiNetDev->GetIfIndex());
+ hwmpState->SetRetransmittersOfPerrCallback (MakeCallback(&Hwmp::GetRetransmittersForFailedDestinations,this));
+ m_hwmpStates.push_back (hwmpState);
+ m_requestCallback.push_back (MakeCallback(&HwmpState::RequestDestination, hwmpState));
+ m_pathErrorCallback.push_back (MakeCallback(&HwmpState::SendPathError, hwmpState));
//Default mode is reactive, default state is enabled
enum DeviceState state = ENABLED;
enum DeviceMode mode = REACTIVE;
- m_states.push_back(state);
- m_modes.push_back(mode);
+ m_states.push_back (state);
+ m_modes.push_back (mode);
}
return true;
}
void
-Hwmp::DisablePort(uint32_t port)
+Hwmp::DisablePort (uint32_t port)
{
int position = 0;
- for (std::vector<Ptr<HwmpState> >::iterator i = m_hwmpStates.begin(); i != m_hwmpStates.end(); i++)
+ for (std::vector<Ptr<HwmpState> >::iterator i = m_hwmpStates.begin (); i != m_hwmpStates.end(); i++)
{
- if ((*i)->GetAssociatedIfaceId() == port)
+ if ((*i)->GetAssociatedIfaceId () == port)
{
m_states[position] = DISABLED;
- m_hwmpStates[position]->Disable();
+ m_hwmpStates[position]->Disable ();
return;
}
position ++;
@@ -394,15 +394,15 @@
}
void
-Hwmp::EnablePort(uint32_t port)
+Hwmp::EnablePort (uint32_t port)
{
int position = 0;
- for (std::vector<Ptr<HwmpState> >::iterator i = m_hwmpStates.begin(); i!= m_hwmpStates.end(); i++)
+ for (std::vector<Ptr<HwmpState> >::iterator i = m_hwmpStates.begin (); i != m_hwmpStates.end(); i++)
{
- if ((*i)->GetAssociatedIfaceId() == port)
+ if ((*i)->GetAssociatedIfaceId () == port)
{
m_states[position] = ENABLED;
- m_hwmpStates[position]->Enable();
+ m_hwmpStates[position]->Enable ();
return;
}
position ++;
@@ -410,29 +410,29 @@
}
void
-Hwmp::SetRoot(uint32_t port)
+Hwmp::SetRoot (uint32_t port)
{
int position = 0;
- for (std::vector<Ptr<HwmpState> >::iterator i = m_hwmpStates.begin(); i!= m_hwmpStates.end(); i++)
+ for (std::vector<Ptr<HwmpState> >::iterator i = m_hwmpStates.begin (); i != m_hwmpStates.end(); i++)
{
- if (((*i)->GetAssociatedIfaceId() == port)||(port == HwmpRtable::PORT_ANY))
+ if (((*i)->GetAssociatedIfaceId () == port)||(port == HwmpRtable::PORT_ANY))
{
- if (m_hwmpStates[position]->SetRoot())
+ if (m_hwmpStates[position]->SetRoot ())
{
m_modes[position] = ROOT;
- NS_LOG_DEBUG("I am proactive");
+ NS_LOG_DEBUG ("I am proactive");
}
}
position ++;
}
}
void
-Hwmp::SetProactive(uint32_t port)
+Hwmp::SetProactive (uint32_t port)
{
int position = 0;
- for (std::vector<Ptr<HwmpState> >::iterator i = m_hwmpStates.begin(); i!= m_hwmpStates.end(); i++)
+ for (std::vector<Ptr<HwmpState> >::iterator i = m_hwmpStates.begin (); i != m_hwmpStates.end(); i++)
{
- if ((*i)->GetAssociatedIfaceId() == port)
+ if ((*i)->GetAssociatedIfaceId () == port)
{
m_modes[position] = PROACTIVE;
return;
@@ -441,12 +441,12 @@
}
}
bool
-Hwmp::IsRoot(uint32_t port)
+Hwmp::IsRoot (uint32_t port)
{
int position = 0;
- for (std::vector<Ptr<HwmpState> >::iterator i = m_hwmpStates.begin(); i!= m_hwmpStates.end(); i++)
+ for (std::vector<Ptr<HwmpState> >::iterator i = m_hwmpStates.begin (); i != m_hwmpStates.end(); i++)
{
- if ((*i)->GetAssociatedIfaceId() == port)
+ if ((*i)->GetAssociatedIfaceId () == port)
if (m_modes[position] == ROOT)
return true;
position ++;
@@ -454,22 +454,22 @@
return false;
}
void
-Hwmp::UnSetRoot(uint32_t port)
+Hwmp::UnSetRoot (uint32_t port)
{
int position = 0;
- for (std::vector<Ptr<HwmpState> >::iterator i = m_hwmpStates.begin(); i!= m_hwmpStates.end(); i++)
+ for (std::vector<Ptr<HwmpState> >::iterator i = m_hwmpStates.begin (); i != m_hwmpStates.end(); i++)
{
- if (((*i)->GetAssociatedIfaceId() == port)||(port == HwmpRtable::PORT_ANY))
+ if (((*i)->GetAssociatedIfaceId () == port)||(port == HwmpRtable::PORT_ANY))
{
m_modes[position] = REACTIVE;
- m_hwmpStates[position]->UnSetRoot();
+ m_hwmpStates[position]->UnSetRoot ();
}
position ++;
}
}
void
-Hwmp::ObtainRoutingInformation(
+Hwmp::ObtainRoutingInformation (
HwmpState::INFO info
)
{
@@ -478,26 +478,26 @@
case HwmpState::INFO_PREP:
if (info.me != info.source)
{
- m_rtable->AddPrecursor(info.source, info.outPort, info.nextHop);
- m_rtable->AddPrecursor(info.destination, info.outPort, info.prevHop);
- NS_LOG_DEBUG("path to "<<info.source<<" precursor is "<<info.nextHop);
- NS_LOG_DEBUG("path to "<<info.destination<<" precursor is "<<info.prevHop);
+ m_rtable->AddPrecursor (info.source, info.outPort, info.nextHop);
+ m_rtable->AddPrecursor (info.destination, info.outPort, info.prevHop);
+ NS_LOG_DEBUG ("path to "<<info.source<<" precursor is "<<info.nextHop);
+ NS_LOG_DEBUG ("path to "<<info.destination<<" precursor is "<<info.prevHop);
}
case HwmpState::INFO_PREQ:
- m_rtable->AddReactivePath(
+ m_rtable->AddReactivePath (
info.destination,
info.nextHop,
info.outPort,
info.metric,
info.lifetime,
info.dsn);
- SendAllPossiblePackets(info.destination);
+ SendAllPossiblePackets (info.destination);
break;
case HwmpState::INFO_PERR:
//delete first subentry
case HwmpState::INFO_PROACTIVE:
//add information to the root MP.
- m_rtable->AddProactivePath(
+ m_rtable->AddProactivePath (
info.metric,
info.destination,
info.nextHop,
@@ -505,16 +505,16 @@
info.lifetime,
info.dsn);
//Set mode as PROACTIVE:
- SetProactive(info.outPort);
+ SetProactive (info.outPort);
break;
case HwmpState::INFO_NEW_PEER:
#if 0
- m_rtable->AddReactivePath(
+ m_rtable->AddReactivePath (
info.destination,
info.nextHop,
info.outPort,
info.metric,
- Seconds(0),
+ Seconds (0),
0);
#endif
break;
@@ -523,17 +523,17 @@
* Conditions for generating PERR
*/
{
- NS_LOG_DEBUG("Failed peer"<<info.destination);
+ NS_LOG_DEBUG ("Failed peer"<<info.destination);
std::vector<HwmpRtable::FailedDestination> failedDestinations =
- m_rtable->GetUnreachableDestinations(info.destination, info.outPort);
+ m_rtable->GetUnreachableDestinations (info.destination, info.outPort);
/**
* Entry about peer does not contain seqnum
*/
HwmpRtable::FailedDestination peer;
peer.destination = info.destination;
peer.seqnum = 0;
- failedDestinations.push_back(peer);
- StartPathErrorProcedure(failedDestinations, info.outPort);
+ failedDestinations.push_back (peer);
+ StartPathErrorProcedure (failedDestinations, info.outPort);
}
break;
default:
@@ -542,131 +542,131 @@
}
HwmpRtable::LookupResult
-Hwmp::RequestRouteForAddress(const Mac48Address& dst)
+Hwmp::RequestRouteForAddress (const Mac48Address& dst)
{
- return m_rtable->LookupReactive(dst);
+ return m_rtable->LookupReactive (dst);
}
HwmpRtable::LookupResult
-Hwmp::RequestRootPathForPort(uint32_t port)
+Hwmp::RequestRootPathForPort (uint32_t port)
{
- return m_rtable->LookupProactive(port);
+ return m_rtable->LookupProactive (port);
}
void
-Hwmp::StartPathErrorProcedure(std::vector<HwmpRtable::FailedDestination> destinations, uint32_t port)
+Hwmp::StartPathErrorProcedure (std::vector<HwmpRtable::FailedDestination> destinations, uint32_t port)
{
- NS_LOG_DEBUG("START PERR");
- for (unsigned int i = 0; i < m_hwmpStates.size(); i++)
- if (m_hwmpStates[i]->GetAssociatedIfaceId() == port)
- m_pathErrorCallback[i](destinations);
+ NS_LOG_DEBUG ("START PERR");
+ for (unsigned int i = 0; i < m_hwmpStates.size (); i++)
+ if (m_hwmpStates[i]->GetAssociatedIfaceId () == port)
+ m_pathErrorCallback[i] (destinations);
}
std::vector<Mac48Address>
-Hwmp::GetRetransmittersForFailedDestinations(std::vector<HwmpRtable::FailedDestination> failedDest, uint32_t port)
+Hwmp::GetRetransmittersForFailedDestinations (std::vector<HwmpRtable::FailedDestination> failedDest, uint32_t port)
{
std::vector<Mac48Address> retransmitters;
if (m_broadcastPerr)
- retransmitters.push_back(Mac48Address::GetBroadcast());
+ retransmitters.push_back (Mac48Address::GetBroadcast());
else
- for (unsigned int i = 0; i < failedDest.size(); i ++)
+ for (unsigned int i = 0; i < failedDest.size (); i ++)
{
std::vector<Mac48Address> precursors =
- m_rtable->GetPrecursors(failedDest[i].destination, port);
- for (unsigned int j = 0; j < precursors.size(); j++)
+ m_rtable->GetPrecursors (failedDest[i].destination, port);
+ for (unsigned int j = 0; j < precursors.size (); j++)
{
- for (unsigned int k = 0; k < retransmitters.size(); k ++)
+ for (unsigned int k = 0; k < retransmitters.size (); k ++)
if (retransmitters[k] == precursors[j])
break;
- retransmitters.push_back(precursors[j]);
+ retransmitters.push_back (precursors[j]);
}
}
- for (unsigned int i = 0; i < failedDest.size(); i ++)
+ for (unsigned int i = 0; i < failedDest.size (); i ++)
{
- m_rtable->DeleteReactivePath(failedDest[i].destination, port);
- m_rtable->DeleteProactivePath(failedDest[i].destination, port);
+ m_rtable->DeleteReactivePath (failedDest[i].destination, port);
+ m_rtable->DeleteProactivePath (failedDest[i].destination, port);
}
return retransmitters;
}
void
-Hwmp::SetMaxQueueSize(int maxPacketsPerDestination)
+Hwmp::SetMaxQueueSize (int maxPacketsPerDestination)
{
m_maxQueueSize = maxPacketsPerDestination;
}
bool
-Hwmp::QueuePacket(MeshL2RoutingProtocol::QueuedPacket packet)
+Hwmp::QueuePacket (MeshL2RoutingProtocol::QueuedPacket packet)
{
- if ((int)m_rqueue[packet.dst].size() > m_maxQueueSize)
+ if ((int)m_rqueue[packet.dst].size () > m_maxQueueSize)
return false;
- m_rqueue[packet.dst].push(packet);
+ m_rqueue[packet.dst].push (packet);
return true;
}
MeshL2RoutingProtocol::QueuedPacket
-Hwmp::DequeuePacket(Mac48Address dst)
+Hwmp::DequeuePacket (Mac48Address dst)
{
MeshL2RoutingProtocol::QueuedPacket retval;
retval.pkt = NULL;
//Ptr<Packet> in this structure is NULL when queue is empty
- std::map<Mac48Address, std::queue<QueuedPacket> >:: iterator i = m_rqueue.find(dst);
- if (i == m_rqueue.end())
+ std::map<Mac48Address, std::queue<QueuedPacket> >:: iterator i = m_rqueue.find (dst);
+ if (i == m_rqueue.end ())
return retval;
- if ((int)m_rqueue[dst].size() == 0)
+ if ((int)m_rqueue[dst].size () == 0)
return retval;
- if ((int)i->second.size() == 0)
+ if ((int)i->second.size () == 0)
{
- m_rqueue.erase(i);
+ m_rqueue.erase (i);
return retval;
}
- retval = m_rqueue[dst].front();
- m_rqueue[dst].pop();
+ retval = m_rqueue[dst].front ();
+ m_rqueue[dst].pop ();
return retval;
}
void
-Hwmp::SendAllPossiblePackets(Mac48Address dst)
+Hwmp::SendAllPossiblePackets (Mac48Address dst)
{
- HwmpRtable::LookupResult result = m_rtable->LookupReactive(dst);
+ HwmpRtable::LookupResult result = m_rtable->LookupReactive (dst);
MeshL2RoutingProtocol::QueuedPacket packet;
while (1)
{
- packet = DequeuePacket(dst);
+ packet = DequeuePacket (dst);
if (packet.pkt == NULL)
return;
//set RA tag for retransmitter:
HwmpTag tag;
- NS_ASSERT(packet.pkt->FindFirstMatchingTag(tag));
- tag.SetAddress(result.retransmitter);
- NS_ASSERT(result.retransmitter!=Mac48Address::GetBroadcast());
- packet.pkt->RemoveAllTags();
- packet.pkt->AddTag(tag);
- packet.reply(true, packet.pkt, packet.src, packet.dst, packet.protocol, result.ifIndex);
+ NS_ASSERT (packet.pkt->FindFirstMatchingTag(tag));
+ tag.SetAddress (result.retransmitter);
+ NS_ASSERT (result.retransmitter != Mac48Address::GetBroadcast());
+ packet.pkt->RemoveAllTags ();
+ packet.pkt->AddTag (tag);
+ packet.reply (true, packet.pkt, packet.src, packet.dst, packet.protocol, result.ifIndex);
}
}
bool
-Hwmp::ShouldSendPreq(Mac48Address dst)
+Hwmp::ShouldSendPreq (Mac48Address dst)
{
- std::map<Mac48Address, EventId>::iterator i = m_timeoutDatabase.find(dst);
- if (i == m_timeoutDatabase.end())
+ std::map<Mac48Address, EventId>::iterator i = m_timeoutDatabase.find (dst);
+ if (i == m_timeoutDatabase.end ())
{
- m_timeoutDatabase[dst] = Simulator::Schedule(
- MilliSeconds(2*(dot11sParameters::dot11MeshHWMPnetDiameterTraversalTime.GetMilliSeconds())),
+ m_timeoutDatabase[dst] = Simulator::Schedule (
+ MilliSeconds (2*(dot11sParameters::dot11MeshHWMPnetDiameterTraversalTime.GetMilliSeconds())),
&Hwmp::RetryPathDiscovery, this, dst, 0);
return true;
}
return false;
}
void
-Hwmp::RetryPathDiscovery(Mac48Address dst, uint8_t numOfRetry)
+Hwmp::RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry)
{
- HwmpRtable::LookupResult result = m_rtable->LookupReactive(dst);
- if (result.retransmitter != Mac48Address::GetBroadcast())
+ HwmpRtable::LookupResult result = m_rtable->LookupReactive (dst);
+ if (result.retransmitter != Mac48Address::GetBroadcast ())
{
- std::map<Mac48Address, EventId>::iterator i = m_timeoutDatabase.find(dst);
- NS_ASSERT(i != m_timeoutDatabase.end());
- m_timeoutDatabase.erase(i);
+ std::map<Mac48Address, EventId>::iterator i = m_timeoutDatabase.find (dst);
+ NS_ASSERT (i != m_timeoutDatabase.end());
+ m_timeoutDatabase.erase (i);
return;
}
numOfRetry++;
@@ -676,21 +676,21 @@
//purge queue and delete entry from retryDatabase
while (1)
{
- packet = DequeuePacket(dst);
+ packet = DequeuePacket (dst);
if (packet.pkt == NULL)
break;
- packet.reply(false, packet.pkt, packet.src, packet.dst, packet.protocol, HwmpRtable::MAX_METRIC);
+ packet.reply (false, packet.pkt, packet.src, packet.dst, packet.protocol, HwmpRtable::MAX_METRIC);
}
- std::map<Mac48Address, EventId>::iterator i = m_timeoutDatabase.find(dst);
- NS_ASSERT(i != m_timeoutDatabase.end());
- m_timeoutDatabase.erase(i);
+ std::map<Mac48Address, EventId>::iterator i = m_timeoutDatabase.find (dst);
+ NS_ASSERT (i != m_timeoutDatabase.end());
+ m_timeoutDatabase.erase (i);
return;
}
- for (unsigned int i = 0; i < m_requestCallback.size(); i++)
+ for (unsigned int i = 0; i < m_requestCallback.size (); i++)
if ((m_modes[i] == REACTIVE) || (m_modes[i] == ROOT))
- m_requestCallback[i](dst);
- m_timeoutDatabase[dst] = Simulator::Schedule(
- MilliSeconds(2*(dot11sParameters::dot11MeshHWMPnetDiameterTraversalTime.GetMilliSeconds())),
+ m_requestCallback[i] (dst);
+ m_timeoutDatabase[dst] = Simulator::Schedule (
+ MilliSeconds (2*(dot11sParameters::dot11MeshHWMPnetDiameterTraversalTime.GetMilliSeconds())),
&Hwmp::RetryPathDiscovery, this, dst, numOfRetry);
}
} //namespace ns3
--- a/src/devices/mesh/hwmp.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/hwmp.h Wed Mar 18 22:36:12 2009 +0300
@@ -54,17 +54,17 @@
class HwmpTag : public Tag
{
public:
- HwmpTag();
- ~HwmpTag();
- void SetAddress(Mac48Address retransmitter);
- Mac48Address GetAddress();
- void SetTtl(uint8_t ttl);
- uint8_t GetTtl();
- void SetMetric(uint32_t metric);
- uint32_t GetMetric();
- void SetSeqno(uint32_t seqno);
- uint32_t GetSeqno();
- void DecrementTtl();
+ HwmpTag ();
+ ~HwmpTag ();
+ void SetAddress (Mac48Address retransmitter);
+ Mac48Address GetAddress ();
+ void SetTtl (uint8_t ttl);
+ uint8_t GetTtl ();
+ void SetMetric (uint32_t metric);
+ uint32_t GetMetric ();
+ void SetSeqno (uint32_t seqno);
+ uint32_t GetSeqno ();
+ void DecrementTtl ();
static TypeId GetTypeId ();
virtual TypeId GetInstanceTypeId () const;
@@ -84,10 +84,10 @@
class Hwmp : public MeshL2RoutingProtocol
{
public:
- static TypeId GetTypeId();
- Hwmp();
- ~Hwmp();
- void DoDispose();
+ static TypeId GetTypeId ();
+ Hwmp ();
+ ~Hwmp ();
+ void DoDispose ();
//intheritedfrom L2RoutingProtocol
/**
* \brief L2Routing protocol base class metod
@@ -106,7 +106,7 @@
* \bug Now packet is sent to the 'best root'
* rather than to the best root at each port
*/
- bool RequestRoute(
+ bool RequestRoute (
uint32_t sourceIface,
const Mac48Address source,
const Mac48Address destination,
@@ -114,17 +114,17 @@
uint16_t protocolType,
MeshL2RoutingProtocol::RouteReplyCallback routeReply
);
- bool AttachPorts(std::vector<Ptr<NetDevice> >);
+ bool AttachPorts (std::vector<Ptr<NetDevice> >);
/**
* \brief Disables port by index.
* \details Needed for external modules like
* clusterization.
*/
- void DisablePort(uint32_t port);
+ void DisablePort (uint32_t port);
/**
* \brief enables port
*/
- void EnablePort(uint32_t port);
+ void EnablePort (uint32_t port);
/**
* \brief Setting proative mode.
* \details To enable proactive mode you must
@@ -143,18 +143,18 @@
* \param port is the port where proactive
* mode should be activated
*/
- void SetRoot(uint32_t port);
+ void SetRoot (uint32_t port);
/**
* \brief Disable root functionality at a
* given port
*/
- void UnSetRoot(uint32_t port);
+ void UnSetRoot (uint32_t port);
/**
* \brief HwmpState retrns to Hwmp class all
* routing information obtained from all HWMP
* action frames
*/
- void ObtainRoutingInformation(
+ void ObtainRoutingInformation (
HwmpState::INFO info
);
/**
@@ -162,18 +162,18 @@
* is dissapeared. Hwmp state knows about peer
* failure from MAC
*/
- void PeerFailure(Mac48Address peerAddress);
- void SetMaxTtl(uint8_t ttl);
- uint8_t GetMaxTtl();
+ void PeerFailure (Mac48Address peerAddress);
+ void SetMaxTtl (uint8_t ttl);
+ uint8_t GetMaxTtl ();
private:
static const uint32_t MAX_SEQNO = 0xffffffff;
//candidate queue is implemented inside the
//protocol:
- void SetMaxQueueSize(int maxPacketsPerDestination);
+ void SetMaxQueueSize (int maxPacketsPerDestination);
int m_maxQueueSize;
- bool QueuePacket(MeshL2RoutingProtocol::QueuedPacket packet);
- MeshL2RoutingProtocol::QueuedPacket DequeuePacket(Mac48Address dst);
- void SendAllPossiblePackets(Mac48Address dst);
+ bool QueuePacket (MeshL2RoutingProtocol::QueuedPacket packet);
+ MeshL2RoutingProtocol::QueuedPacket DequeuePacket (Mac48Address dst);
+ void SendAllPossiblePackets (Mac48Address dst);
std::map<Mac48Address, std::queue<QueuedPacket> > m_rqueue;
//devices and HWMP states:
enum DeviceState {
@@ -197,13 +197,13 @@
* when proatcive PREQ with a valid
* information was received.
*/
- void SetProactive(uint32_t port);
+ void SetProactive (uint32_t port);
/**
* \brief Checks if the port is root, if true
* - no default routes must be used at this
* port
*/
- bool IsRoot(uint32_t port);
+ bool IsRoot (uint32_t port);
/**
* \brief Interaction with HwmpState class -
* request for starting routing discover
@@ -222,7 +222,7 @@
*/
std::vector<Callback<void,std::vector<HwmpRtable::FailedDestination> > >
m_pathErrorCallback;
- void StartPathErrorProcedure(
+ void StartPathErrorProcedure (
std::vector<HwmpRtable::FailedDestination> destinations,
uint32_t port);
/**
@@ -232,7 +232,7 @@
* HWMP has accessto routing table
*/
std::vector<Mac48Address>
- GetRetransmittersForFailedDestinations(
+ GetRetransmittersForFailedDestinations (
std::vector<HwmpRtable::FailedDestination> failedDest,
uint32_t port);
/**
@@ -241,8 +241,8 @@
* better route
*
*/
- HwmpRtable::LookupResult RequestRouteForAddress(const Mac48Address& destination);
- HwmpRtable::LookupResult RequestRootPathForPort(uint32_t port);
+ HwmpRtable::LookupResult RequestRouteForAddress (const Mac48Address& destination);
+ HwmpRtable::LookupResult RequestRootPathForPort (uint32_t port);
/**
* \attention mesh seqno is processed at HWMP
@@ -255,7 +255,7 @@
* /brief checks when last preq was initiated, returns
* false when retry has not expired
*/
- bool ShouldSendPreq(Mac48Address dst);
+ bool ShouldSendPreq (Mac48Address dst);
/**
* \brief Generates PREQ retry when route is
* still unresolved after first PREQ
@@ -263,7 +263,7 @@
* dot11sParameters::dot11MeshHWMPmaxPREQretries,
* we return all packets to upper layers
*/
- void RetryPathDiscovery(Mac48Address dst, uint8_t numOfRetry);
+ void RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry);
/**
* Keeps PREQ retry timers for every
* destination
--- a/src/devices/mesh/mesh-l2-routing-protocol.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/mesh-l2-routing-protocol.cc Wed Mar 18 22:36:12 2009 +0300
@@ -37,17 +37,17 @@
return tid;
}
-MeshL2RoutingProtocol::~MeshL2RoutingProtocol()
+MeshL2RoutingProtocol::~MeshL2RoutingProtocol ()
{
}
void
-MeshL2RoutingProtocol::SetMeshPoint(Ptr<MeshPointDevice> mp)
+MeshL2RoutingProtocol::SetMeshPoint (Ptr<MeshPointDevice> mp)
{
m_mp = mp;
}
-Ptr<MeshPointDevice> MeshL2RoutingProtocol::GetMeshPoint() const
+Ptr<MeshPointDevice> MeshL2RoutingProtocol::GetMeshPoint () const
{
return m_mp;
}
--- a/src/devices/mesh/mesh-l2-routing-protocol.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/mesh-l2-routing-protocol.h Wed Mar 18 22:36:12 2009 +0300
@@ -36,7 +36,7 @@
* \brief Interface for L2 mesh routing protocol and mesh point communication.
*
* Every mesh routing protocol must implement this interface. Each mesh point (MeshPointDevice) is supposed
- * to know single L2RoutingProtocol to work with, see MeshPointDevice::SetRoutingProtocol().
+ * to know single L2RoutingProtocol to work with, see MeshPointDevice::SetRoutingProtocol ().
*
* This interface is similar to ipv4 routiong protocol base class.
*/
@@ -44,9 +44,9 @@
{
public:
/// Never forget to support NS3 object model
- static TypeId GetTypeId();
+ static TypeId GetTypeId ();
/// virtual D-tor for subclasses
- virtual ~MeshL2RoutingProtocol();
+ virtual ~MeshL2RoutingProtocol ();
/**
* Callback to be invoked when route discovery procedure is completed.
*
@@ -98,13 +98,13 @@
*
* \param routeReply callback to be invoked after route discovery procedure, supposed to really send packet using routing information.
*/
- virtual bool RequestRoute(uint32_t sourceIface, const Mac48Address source, const Mac48Address destination,
+ virtual bool RequestRoute (uint32_t sourceIface, const Mac48Address source, const Mac48Address destination,
Ptr<Packet> packet, uint16_t protocolType, RouteReplyCallback routeReply ) = 0;
- /// Set host mesh point, analog of SetNode(...) methods for upper layer protocols.
- void SetMeshPoint(Ptr<MeshPointDevice> mp);
+ /// Set host mesh point, analog of SetNode (...) methods for upper layer protocols.
+ void SetMeshPoint (Ptr<MeshPointDevice> mp);
/// Each mesh protocol must be installed on the mesh point to work.
- Ptr<MeshPointDevice> GetMeshPoint() const;
+ Ptr<MeshPointDevice> GetMeshPoint () const;
protected:
@@ -128,11 +128,11 @@
*
* \param maxPacketsPerDestination Packets per destination that can be stored inside protocol.
*/
- virtual void SetMaxQueueSize(int maxPacketsPerDestination) = 0;
+ virtual void SetMaxQueueSize (int maxPacketsPerDestination) = 0;
/**
* \brief Queue route request packet with 'Ethernet header' \return false if the queue is full.
*/
- virtual bool QueuePacket(struct QueuedPacket packet) = 0;
+ virtual bool QueuePacket (struct QueuedPacket packet) = 0;
/**
* \brief Deque packet with 'Ethernet header'
*
@@ -140,7 +140,7 @@
*
* \return Ptr<packet> (0 if queue is empty), src, dst, protocol ID, incoming port ID, and reply callback
*/
- virtual struct QueuedPacket DequeuePacket(Mac48Address destination) = 0;
+ virtual struct QueuedPacket DequeuePacket (Mac48Address destination) = 0;
//\}
--- a/src/devices/mesh/mesh-mgt-headers.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/mesh-mgt-headers.cc Wed Mar 18 22:36:12 2009 +0300
@@ -29,63 +29,63 @@
* Mesh Beacon
***********************************************************/
void
-MgtMeshBeaconHeader::SetIeDot11sConfiguration(IeDot11sConfiguration mesh_config)
+MgtMeshBeaconHeader::SetIeDot11sConfiguration (IeDot11sConfiguration mesh_config)
{
m_meshConfig = mesh_config;
}
void
-MgtMeshBeaconHeader::SetIeDot11sBeaconTiming(IeDot11sBeaconTiming wifi_timing)
+MgtMeshBeaconHeader::SetIeDot11sBeaconTiming (IeDot11sBeaconTiming wifi_timing)
{
m_meshTiming = wifi_timing;
}
IeDot11sConfiguration
-MgtMeshBeaconHeader::GetIeDot11sConfiguration()
+MgtMeshBeaconHeader::GetIeDot11sConfiguration ()
{
return m_meshConfig;
}
IeDot11sBeaconTiming
-MgtMeshBeaconHeader::GetIeDot11sBeaconTiming()
+MgtMeshBeaconHeader::GetIeDot11sBeaconTiming ()
{
return m_meshTiming;
}
uint32_t
MgtMeshBeaconHeader::GetSerializedSize () const
- {
- uint32_t size = (
- MgtBeaconHeader::GetSerializedSize()
- + m_meshConfig.GetSerializedSize()
- + m_meshTiming.GetSerializedSize()
- + 9 //MSCIE
- );
- return size;
- }
+{
+ uint32_t size = (
+ MgtBeaconHeader::GetSerializedSize ()
+ + m_meshConfig.GetSerializedSize ()
+ + m_meshTiming.GetSerializedSize ()
+ + 9 //MSCIE
+ );
+ return size;
+}
void
MgtMeshBeaconHeader::Serialize (Buffer::Iterator start) const
- {
- //First we pack Beacon:
- Buffer::Iterator i = start;
- MgtBeaconHeader::Serialize(i);
- i.Next (MgtBeaconHeader::GetSerializedSize());
- m_meshConfig.Serialize(i);
- i.Next(m_meshConfig.GetSerializedSize());
- m_meshTiming.Serialize(i);
- i.Next(m_meshTiming.GetSerializedSize());
- i.Next (9); //MSCIE
- }
+{
+ //First we pack Beacon:
+ Buffer::Iterator i = start;
+ MgtBeaconHeader::Serialize (i);
+ i.Next (MgtBeaconHeader::GetSerializedSize ());
+ m_meshConfig.Serialize (i);
+ i.Next (m_meshConfig.GetSerializedSize());
+ m_meshTiming.Serialize (i);
+ i.Next (m_meshTiming.GetSerializedSize());
+ i.Next (9); //MSCIE
+}
uint32_t
MgtMeshBeaconHeader::Deserialize (Buffer::Iterator start)
{
Buffer::Iterator i = start;
- MgtBeaconHeader::Deserialize(start);
- i.Next (MgtBeaconHeader::GetSerializedSize());
- m_meshConfig.Deserialize(i);
- i.Next(m_meshConfig.GetSerializedSize());
- i.Next(m_meshTiming.Deserialize(i));
+ MgtBeaconHeader::Deserialize (start);
+ i.Next (MgtBeaconHeader::GetSerializedSize ());
+ m_meshConfig.Deserialize (i);
+ i.Next (m_meshConfig.GetSerializedSize());
+ i.Next (m_meshTiming.Deserialize(i));
i.Next (9); //MSCIE
return i.GetDistanceFrom (start);
}
@@ -96,84 +96,84 @@
************************************************************/
NS_OBJECT_ENSURE_REGISTERED (MeshMgtPeerLinkManFrame);
-MeshMgtPeerLinkManFrame::MeshMgtPeerLinkManFrame()
+MeshMgtPeerLinkManFrame::MeshMgtPeerLinkManFrame ()
{
}
void
-MeshMgtPeerLinkManFrame::SetAid(uint16_t aid)
+MeshMgtPeerLinkManFrame::SetAid (uint16_t aid)
{
Aid = aid;
}
void
-MeshMgtPeerLinkManFrame::SetSupportedRates(SupportedRates rates)
+MeshMgtPeerLinkManFrame::SetSupportedRates (SupportedRates rates)
{
Rates = rates;
}
void
-MeshMgtPeerLinkManFrame::SetQosField(uint16_t qos)
+MeshMgtPeerLinkManFrame::SetQosField (uint16_t qos)
{
QoS = qos;
}
void
-MeshMgtPeerLinkManFrame::SetMeshId(Ssid Id)
+MeshMgtPeerLinkManFrame::SetMeshId (Ssid Id)
{
MeshId = Id;
}
void
-MeshMgtPeerLinkManFrame::SetIeDot11sConfiguration(IeDot11sConfiguration MeshConf)
+MeshMgtPeerLinkManFrame::SetIeDot11sConfiguration (IeDot11sConfiguration MeshConf)
{
MeshConfig = MeshConf;
}
void
-MeshMgtPeerLinkManFrame::SetIeDot11sPeerManagement(IeDot11sPeerManagement meshPeerElement)
+MeshMgtPeerLinkManFrame::SetIeDot11sPeerManagement (IeDot11sPeerManagement meshPeerElement)
{
PeerLinkMan = meshPeerElement;
}
uint16_t
-MeshMgtPeerLinkManFrame::GetAid()
+MeshMgtPeerLinkManFrame::GetAid ()
{
return Aid;
}
SupportedRates
-MeshMgtPeerLinkManFrame::GetSupportedRates()
+MeshMgtPeerLinkManFrame::GetSupportedRates ()
{
return Rates;
}
uint16_t
-MeshMgtPeerLinkManFrame::GetQosField()
+MeshMgtPeerLinkManFrame::GetQosField ()
{
return QoS;
}
Ssid
-MeshMgtPeerLinkManFrame::GetMeshId()
+MeshMgtPeerLinkManFrame::GetMeshId ()
{
return MeshId;
}
IeDot11sConfiguration
-MeshMgtPeerLinkManFrame::GetIeDot11sConfiguration()
+MeshMgtPeerLinkManFrame::GetIeDot11sConfiguration ()
{
return MeshConfig;
}
IeDot11sPeerManagement
-MeshMgtPeerLinkManFrame::GetIeDot11sPeerManagement()
+MeshMgtPeerLinkManFrame::GetIeDot11sPeerManagement ()
{
return PeerLinkMan;
}
TypeId
-MeshMgtPeerLinkManFrame::GetTypeId()
+MeshMgtPeerLinkManFrame::GetTypeId ()
{
static TypeId tid =
TypeId ("ns3::MeshMgtPeerLinkManFrame")
@@ -184,57 +184,57 @@
}
TypeId
-MeshMgtPeerLinkManFrame::GetInstanceTypeId() const
- {
- return GetTypeId();
- }
+MeshMgtPeerLinkManFrame::GetInstanceTypeId () const
+{
+ return GetTypeId ();
+}
void
-MeshMgtPeerLinkManFrame::Print(std::ostream &os) const
- {
- //TODO:fill this method
- }
+MeshMgtPeerLinkManFrame::Print (std::ostream &os) const
+{
+ //TODO:fill this method
+}
uint32_t
-MeshMgtPeerLinkManFrame::GetSerializedSize() const
- {
- uint32_t size = 1; //Subtype
- if (MESH_MGT_HEADER_PEER_CONFIRM == Subtype)
- size += 2; //AID of remote peer
- if (MESH_MGT_HEADER_PEER_CLOSE != Subtype)
- {
- size += Rates.GetSerializedSize ();
- size += 2;
- size += MeshId.GetSerializedSize ();
- size += MeshConfig.GetSerializedSize ();
- }
- size += PeerLinkMan.GetSerializedSize ();
- return size;
- }
+MeshMgtPeerLinkManFrame::GetSerializedSize () const
+{
+ uint32_t size = 1; //Subtype
+ if (MESH_MGT_HEADER_PEER_CONFIRM == Subtype)
+ size += 2; //AID of remote peer
+ if (MESH_MGT_HEADER_PEER_CLOSE != Subtype)
+ {
+ size += Rates.GetSerializedSize ();
+ size += 2;
+ size += MeshId.GetSerializedSize ();
+ size += MeshConfig.GetSerializedSize ();
+ }
+ size += PeerLinkMan.GetSerializedSize ();
+ return size;
+}
void
-MeshMgtPeerLinkManFrame::Serialize(Buffer::Iterator start) const
- {
- Buffer::Iterator i = start;
- i.WriteU8(Subtype); //Like a Category in Standart
- if (MESH_MGT_HEADER_PEER_CONFIRM == Subtype)
+MeshMgtPeerLinkManFrame::Serialize (Buffer::Iterator start) const
+{
+ Buffer::Iterator i = start;
+ i.WriteU8 (Subtype); //Like a Category in Standart
+ if (MESH_MGT_HEADER_PEER_CONFIRM == Subtype)
- i.WriteHtonU16(Aid);
- if (MESH_MGT_HEADER_PEER_CLOSE != Subtype)
- {
- i = Rates.Serialize (i);
- //now QoS capabilities
- i.WriteHtonU16 (QoS);
- i = MeshId.Serialize (i);
- MeshConfig.Serialize (i);
- i.Next(MeshConfig.GetSerializedSize());
- }
- PeerLinkMan.Serialize (i);
- i.Next(PeerLinkMan.GetSerializedSize());
- }
+ i.WriteHtonU16 (Aid);
+ if (MESH_MGT_HEADER_PEER_CLOSE != Subtype)
+ {
+ i = Rates.Serialize (i);
+ //now QoS capabilities
+ i.WriteHtonU16 (QoS);
+ i = MeshId.Serialize (i);
+ MeshConfig.Serialize (i);
+ i.Next (MeshConfig.GetSerializedSize());
+ }
+ PeerLinkMan.Serialize (i);
+ i.Next (PeerLinkMan.GetSerializedSize());
+}
uint32_t
-MeshMgtPeerLinkManFrame::Deserialize(Buffer::Iterator start)
+MeshMgtPeerLinkManFrame::Deserialize (Buffer::Iterator start)
{
Buffer::Iterator i = start;
Subtype = i.ReadU8 ();
@@ -246,44 +246,44 @@
QoS = i.ReadNtohU16 ();
i = MeshId.Deserialize (i);
MeshConfig.Deserialize (i);
- i.Next(MeshConfig.GetSerializedSize());
+ i.Next (MeshConfig.GetSerializedSize());
}
PeerLinkMan.Deserialize (i);
- i.Next(PeerLinkMan.GetSerializedSize());
+ i.Next (PeerLinkMan.GetSerializedSize());
return i.GetDistanceFrom (start);
}
void
-MeshMgtPeerLinkManFrame::SetOpen()
+MeshMgtPeerLinkManFrame::SetOpen ()
{
Subtype = MESH_MGT_HEADER_PEER_OPEN;
}
void
-MeshMgtPeerLinkManFrame::SetConfirm()
+MeshMgtPeerLinkManFrame::SetConfirm ()
{
Subtype = MESH_MGT_HEADER_PEER_CONFIRM;
}
void
-MeshMgtPeerLinkManFrame::SetClose()
+MeshMgtPeerLinkManFrame::SetClose ()
{
Subtype = MESH_MGT_HEADER_PEER_CLOSE;
}
bool
-MeshMgtPeerLinkManFrame::IsOpen()
+MeshMgtPeerLinkManFrame::IsOpen ()
{
return (Subtype == MESH_MGT_HEADER_PEER_OPEN);
}
bool
-MeshMgtPeerLinkManFrame::IsConfirm()
+MeshMgtPeerLinkManFrame::IsConfirm ()
{
return (Subtype == MESH_MGT_HEADER_PEER_CONFIRM);
}
bool
-MeshMgtPeerLinkManFrame::IsClose()
+MeshMgtPeerLinkManFrame::IsClose ()
{
return (Subtype == MESH_MGT_HEADER_PEER_CLOSE);
}
--- a/src/devices/mesh/mesh-mgt-headers.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/mesh-mgt-headers.h Wed Mar 18 22:36:12 2009 +0300
@@ -38,10 +38,10 @@
class MgtMeshBeaconHeader : public MgtBeaconHeader
{
public:
- void SetIeDot11sConfiguration(IeDot11sConfiguration mesh_config);
- void SetIeDot11sBeaconTiming(IeDot11sBeaconTiming wifi_timing);
- IeDot11sConfiguration GetIeDot11sConfiguration();
- IeDot11sBeaconTiming GetIeDot11sBeaconTiming();
+ void SetIeDot11sConfiguration (IeDot11sConfiguration mesh_config);
+ void SetIeDot11sBeaconTiming (IeDot11sBeaconTiming wifi_timing);
+ IeDot11sConfiguration GetIeDot11sConfiguration ();
+ IeDot11sBeaconTiming GetIeDot11sBeaconTiming ();
virtual uint32_t GetSerializedSize () const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
@@ -58,34 +58,34 @@
{
public:
MeshMgtPeerLinkManFrame ();
- void SetAid(uint16_t aid);
- void SetSupportedRates(SupportedRates rates);
- void SetQosField(uint16_t qos);
- void SetMeshId(Ssid Id);
- void SetIeDot11sConfiguration(IeDot11sConfiguration MeshConf);
- void SetIeDot11sPeerManagement(IeDot11sPeerManagement meshPeerElement);
+ void SetAid (uint16_t aid);
+ void SetSupportedRates (SupportedRates rates);
+ void SetQosField (uint16_t qos);
+ void SetMeshId (Ssid Id);
+ void SetIeDot11sConfiguration (IeDot11sConfiguration MeshConf);
+ void SetIeDot11sPeerManagement (IeDot11sPeerManagement meshPeerElement);
- uint16_t GetAid();
- SupportedRates GetSupportedRates();
- uint16_t GetQosField();
- Ssid GetMeshId();
- IeDot11sConfiguration GetIeDot11sConfiguration();
- IeDot11sPeerManagement GetIeDot11sPeerManagement();
+ uint16_t GetAid ();
+ SupportedRates GetSupportedRates ();
+ uint16_t GetQosField ();
+ Ssid GetMeshId ();
+ IeDot11sConfiguration GetIeDot11sConfiguration ();
+ IeDot11sPeerManagement GetIeDot11sPeerManagement ();
- static TypeId GetTypeId();
- virtual TypeId GetInstanceTypeId() const;
- virtual void Print(std::ostream &os) const;
- virtual uint32_t GetSerializedSize() const;
- virtual void Serialize(Buffer::Iterator start) const;
- virtual uint32_t Deserialize(Buffer::Iterator start);
+ static TypeId GetTypeId ();
+ virtual TypeId GetInstanceTypeId () const;
+ virtual void Print (std::ostream &os) const;
+ virtual uint32_t GetSerializedSize () const;
+ virtual void Serialize (Buffer::Iterator start) const;
+ virtual uint32_t Deserialize (Buffer::Iterator start);
//Subtype defining methods:
- void SetOpen();
- void SetConfirm();
- void SetClose();
+ void SetOpen ();
+ void SetConfirm ();
+ void SetClose ();
- bool IsOpen();
- bool IsConfirm();
- bool IsClose();
+ bool IsOpen ();
+ bool IsConfirm ();
+ bool IsClose ();
private:
uint8_t Subtype;
--- a/src/devices/mesh/mesh-point-device.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/mesh-point-device.cc Wed Mar 18 22:36:12 2009 +0300
@@ -42,13 +42,13 @@
return tid;
}
-MeshPointDevice::MeshPointDevice () : m_ifIndex(0), m_mtu(1500)
+MeshPointDevice::MeshPointDevice () : m_ifIndex (0), m_mtu(1500)
{
NS_LOG_FUNCTION_NOARGS ();
m_channel = CreateObject<BridgeChannel> ();
}
-MeshPointDevice::~MeshPointDevice()
+MeshPointDevice::~MeshPointDevice ()
{
NS_LOG_FUNCTION_NOARGS ();
}
@@ -89,7 +89,7 @@
case PACKET_MULTICAST:
m_rxCallback (this, packet, protocol, src);
case PACKET_OTHERHOST:
- Forward (incomingPort, packet->Copy(), protocol, src48, dst48);
+ Forward (incomingPort, packet->Copy (), protocol, src48, dst48);
break;
}
}
@@ -99,32 +99,32 @@
uint16_t protocol, const Mac48Address src, const Mac48Address dst)
{
// pass through routing protocol
- m_requestRoute(inport->GetIfIndex(), src, dst, packet, protocol, m_myResponse);
+ m_requestRoute (inport->GetIfIndex(), src, dst, packet, protocol, m_myResponse);
}
void
-MeshPointDevice::SetName(const std::string name)
+MeshPointDevice::SetName (const std::string name)
{
NS_LOG_FUNCTION_NOARGS ();
m_name = name;
}
std::string
-MeshPointDevice::GetName() const
+MeshPointDevice::GetName () const
{
NS_LOG_FUNCTION_NOARGS ();
return m_name;
}
void
-MeshPointDevice::SetIfIndex(const uint32_t index)
+MeshPointDevice::SetIfIndex (const uint32_t index)
{
NS_LOG_FUNCTION_NOARGS ();
m_ifIndex = index;
}
uint32_t
-MeshPointDevice::GetIfIndex() const
+MeshPointDevice::GetIfIndex () const
{
NS_LOG_FUNCTION_NOARGS ();
return m_ifIndex;
@@ -220,7 +220,7 @@
MeshPointDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber)
{
const Mac48Address dst48 = Mac48Address::ConvertFrom (dest);
- return m_requestRoute(m_ifIndex, m_address, dst48, packet, protocolNumber, m_myResponse);
+ return m_requestRoute (m_ifIndex, m_address, dst48, packet, protocolNumber, m_myResponse);
}
bool
@@ -228,7 +228,7 @@
{
const Mac48Address src48 = Mac48Address::ConvertFrom (src);
const Mac48Address dst48 = Mac48Address::ConvertFrom (dest);
- return m_requestRoute(m_ifIndex, src48, dst48, packet, protocolNumber, m_myResponse);
+ return m_requestRoute (m_ifIndex, src48, dst48, packet, protocolNumber, m_myResponse);
}
Ptr<Node>
@@ -293,7 +293,7 @@
Ptr<NetDevice>
MeshPointDevice::GetInterface (uint32_t n) const
{
- NS_ASSERT(m_ifaces.size () > n);
+ NS_ASSERT (m_ifaces.size () > n);
return m_ifaces[n];
}
@@ -322,24 +322,24 @@
//-----------------------------------------------------------------------------
void
-MeshPointDevice::SetRoutingProtocol(Ptr<MeshL2RoutingProtocol> protocol)
+MeshPointDevice::SetRoutingProtocol (Ptr<MeshL2RoutingProtocol> protocol)
{
NS_LOG_FUNCTION_NOARGS ();
- NS_ASSERT_MSG(PeekPointer(protocol->GetMeshPoint()) == this, "Routing protocol must be installed on mesh point to be usefull.");
+ NS_ASSERT_MSG (PeekPointer(protocol->GetMeshPoint()) == this, "Routing protocol must be installed on mesh point to be usefull.");
- m_requestRoute = MakeCallback(&MeshL2RoutingProtocol::RequestRoute, protocol);
- m_myResponse = MakeCallback(&MeshPointDevice::DoSend, this);
+ m_requestRoute = MakeCallback (&MeshL2RoutingProtocol::RequestRoute, protocol);
+ m_myResponse = MakeCallback (&MeshPointDevice::DoSend, this);
return;
}
void
-MeshPointDevice::DoSend(bool success, Ptr<Packet> packet, Mac48Address src, Mac48Address dst, uint16_t protocol, uint32_t outIface)
+MeshPointDevice::DoSend (bool success, Ptr<Packet> packet, Mac48Address src, Mac48Address dst, uint16_t protocol, uint32_t outIface)
{
if (!success)
{
- NS_LOG_UNCOND("Resolve failed");
+ NS_LOG_UNCOND ("Resolve failed");
//TODO: SendError callback
return;
}
@@ -347,10 +347,10 @@
// Ok, now I know the route, just SendFrom
if (outIface != 0xffffffff)
- GetInterface(outIface)->SendFrom(packet, src, dst, protocol);
+ GetInterface (outIface)->SendFrom(packet, src, dst, protocol);
else
- for (std::vector<Ptr<NetDevice> >::iterator i = m_ifaces.begin(); i != m_ifaces.end(); i++)
- (*i) -> SendFrom(packet, src, dst, protocol);
+ for (std::vector<Ptr<NetDevice> >::iterator i = m_ifaces.begin (); i != m_ifaces.end(); i++)
+ (*i) -> SendFrom (packet, src, dst, protocol);
}
} // namespace ns3
--- a/src/devices/mesh/mesh-point-device.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/mesh-point-device.h Wed Mar 18 22:36:12 2009 +0300
@@ -81,15 +81,15 @@
/**
* \brief Register routing protocol to be used. Protocol must be alredy installed on this mesh point.
*/
- void SetRoutingProtocol(Ptr<MeshL2RoutingProtocol> protocol);
+ void SetRoutingProtocol (Ptr<MeshL2RoutingProtocol> protocol);
//\}
///\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 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;
virtual Address GetAddress () const;
virtual bool SetMtu (const uint16_t mtu);
@@ -131,7 +131,7 @@
* \param protocol Protocol ID
* \param outIface Interface to use (ID) for send (decided by routing protocol). All interfaces will be used if outIface = 0xffffffff
*/
- void DoSend(bool success, Ptr<Packet> packet, Mac48Address src, Mac48Address dst, uint16_t protocol, uint32_t iface);
+ void DoSend (bool success, Ptr<Packet> packet, Mac48Address src, Mac48Address dst, uint16_t protocol, uint32_t iface);
private:
/// Receive action
--- a/src/devices/mesh/mesh-wifi-beacon.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/mesh-wifi-beacon.cc Wed Mar 18 22:36:12 2009 +0300
@@ -23,42 +23,42 @@
namespace ns3 {
-MeshWifiBeacon::MeshWifiBeacon(Ssid ssid, SupportedRates rates, uint64_t us)
+MeshWifiBeacon::MeshWifiBeacon (Ssid ssid, SupportedRates rates, uint64_t us)
{
m_header.SetSsid (ssid);
m_header.SetSupportedRates (rates);
m_header.SetBeaconIntervalUs (us);
}
-void MeshWifiBeacon::AddInformationElement(Ptr<WifiInformationElement> ie)
+void MeshWifiBeacon::AddInformationElement (Ptr<WifiInformationElement> ie)
{
- m_elements.push_back(ie);
+ m_elements.push_back (ie);
}
namespace {
/// aux sorter for Ptr<WifiInformationElement>
struct PIEComparator
{
- bool operator() (Ptr<WifiInformationElement> a, Ptr<WifiInformationElement> b) const
+ bool operator () (Ptr<WifiInformationElement> a, Ptr<WifiInformationElement> b) const
{
- return ((*PeekPointer(a)) < (*PeekPointer(b)));
+ return ((*PeekPointer (a)) < (*PeekPointer(b)));
}
};
}
-Ptr<Packet> MeshWifiBeacon::CreatePacket()
+Ptr<Packet> MeshWifiBeacon::CreatePacket ()
{
Ptr<Packet> packet = Create<Packet> ();
- std::sort(m_elements.begin(), m_elements.end(), PIEComparator());
+ std::sort (m_elements.begin(), m_elements.end(), PIEComparator());
std::vector< Ptr<WifiInformationElement> >::const_reverse_iterator i;
- for(i = m_elements.rbegin(); i != m_elements.rend(); ++i)
+ for (i = m_elements.rbegin(); i != m_elements.rend(); ++i)
{
- packet->AddHeader(**i);
+ packet->AddHeader (**i);
}
- packet->AddHeader(BeaconHeader());
+ packet->AddHeader (BeaconHeader());
return packet;
}
@@ -76,6 +76,6 @@
return hdr;
}
-
+
} // namespace
--- a/src/devices/mesh/mesh-wifi-beacon.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/mesh-wifi-beacon.h Wed Mar 18 22:36:12 2009 +0300
@@ -47,7 +47,7 @@
* \param rates is a set of supported rates
* \param us beacon interval in microseconds
*/
- MeshWifiBeacon(Ssid ssid, SupportedRates rates, uint64_t us);
+ MeshWifiBeacon (Ssid ssid, SupportedRates rates, uint64_t us);
/// Read standard Wifi beacon header
MgtBeaconHeader BeaconHeader () const { return m_header; }
/// Add information element
@@ -55,7 +55,7 @@
/// Create wifi header for beacon frame. \param address is sender address
WifiMacHeader CreateHeader (Mac48Address address);
- /// Create frame = { beacon header + all information elements sorted by ElementId() }
+ /// Create frame = { beacon header + all information elements sorted by ElementId () }
Ptr<Packet> CreatePacket ();
private:
--- a/src/devices/mesh/mesh-wifi-helper.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/mesh-wifi-helper.cc Wed Mar 18 22:36:12 2009 +0300
@@ -95,7 +95,7 @@
}
void
-MeshWifiHelper::SetL2RoutingProtocol(std::string type,
+MeshWifiHelper::SetL2RoutingProtocol (std::string type,
std::string n0, const AttributeValue &v0,
std::string n1, const AttributeValue &v1,
std::string n2, const AttributeValue &v2,
@@ -120,7 +120,7 @@
}
void
-MeshWifiHelper::SetL2RoutingNetDevice(std::string type,
+MeshWifiHelper::SetL2RoutingNetDevice (std::string type,
std::string n0, const AttributeValue &v0,
std::string n1, const AttributeValue &v1,
std::string n2, const AttributeValue &v2,
@@ -182,7 +182,7 @@
Ptr<WifiPeerManager> pPeer = m_peerManager.Create<WifiPeerManager > ();
devices.Add (mp);
std::vector<Ptr<WifiNetDevice> > nodeDevices;
- for (uint8_t k=0; k<numOfPorts; k++)
+ for (uint8_t k = 0; k < numOfPorts; k++)
{
Ptr<WifiNetDevice> device = CreateObject<WifiNetDevice> ();
Ptr<MeshWifiMac> mac = m_meshMac.Create<MeshWifiMac> ();
@@ -193,22 +193,22 @@
device->SetPhy (phy);
device->SetRemoteStationManager (manager);
//create L2RoutingNetDevice and add WifiNetDevice to it
- node->AddDevice(device);
- nodeDevices.push_back(device);
+ node->AddDevice (device);
+ nodeDevices.push_back (device);
}
- node -> AddDevice(mp);
- for (std::vector<Ptr<WifiNetDevice> > ::iterator iter=nodeDevices.begin();iter!=nodeDevices.end(); ++iter)
- mp->AddInterface(*iter);
- // nodeDevice.pop_back()
- pPeer->AttachPorts(nodeDevices);
+ node -> AddDevice (mp);
+ for (std::vector<Ptr<WifiNetDevice> > ::iterator iter=nodeDevices.begin ();iter != nodeDevices.end(); ++iter)
+ mp->AddInterface (*iter);
+ // nodeDevice.pop_back ()
+ pPeer->AttachPorts (nodeDevices);
// Install routing protocol
- Ptr<MeshL2RoutingProtocol> routing = m_routingProtocol.Create <MeshL2RoutingProtocol>();
- routing->SetMeshPoint(mp);
- mp->SetRoutingProtocol(routing);
+ Ptr<MeshL2RoutingProtocol> routing = m_routingProtocol.Create <MeshL2RoutingProtocol> ();
+ routing->SetMeshPoint (mp);
+ mp->SetRoutingProtocol (routing);
- //hwmp->SetRoot(device->GetIfIndex(), Seconds(5));
- nodeDevices.clear();
+ //hwmp->SetRoot (device->GetIfIndex(), Seconds(5));
+ nodeDevices.clear ();
}
return devices;
}
--- a/src/devices/mesh/mesh-wifi-helper.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/mesh-wifi-helper.h Wed Mar 18 22:36:12 2009 +0300
@@ -89,7 +89,7 @@
std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue (),
std::string n8 = "", const AttributeValue &v8 = EmptyAttributeValue (),
std::string n9 = "", const AttributeValue &v9 = EmptyAttributeValue ());
- void SetL2RoutingProtocol(std::string type,
+ void SetL2RoutingProtocol (std::string type,
std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
@@ -101,7 +101,7 @@
std::string n8 = "", const AttributeValue &v8 = EmptyAttributeValue (),
std::string n9 = "", const AttributeValue &v9 = EmptyAttributeValue ());
- void SetL2RoutingNetDevice(std::string type,
+ void SetL2RoutingNetDevice (std::string type,
std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
--- a/src/devices/mesh/mesh-wifi-interface-mac-plugin.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/mesh-wifi-interface-mac-plugin.h Wed Mar 18 22:36:12 2009 +0300
@@ -42,32 +42,32 @@
{
public:
/// C-tor creates unplugged plugin
- MeshWifiInterfaceMacPlugin() { /*do nothing*/}
+ MeshWifiInterfaceMacPlugin () { /*do nothing*/}
/// This is for subclasses
- virtual ~MeshWifiInterfaceMacPlugin() { /*do nothing*/ }
+ virtual ~MeshWifiInterfaceMacPlugin () { /*do nothing*/ }
/// Each plugin must be installed on interface to work
- virtual void SetParent(MeshWifiInterfaceMac * parent) = 0;
+ virtual void SetParent (MeshWifiInterfaceMac * parent) = 0;
/**
* \brief Process received frame
*
* \return false if (and only if) frame should be dropped
* TODO define when MAC call this
*/
- virtual bool Receive(Ptr<Packet> packet, const WifiMacHeader & header) = 0;
+ virtual bool Receive (Ptr<Packet> packet, const WifiMacHeader & header) = 0;
/**
* \brief Update frame before it will be forwarded down
*
* \return false if (and only if) frame should be dropped
* TODO define when MAC call this, preconditions & postconditions
*/
- virtual bool UpdateOutcomingFrame(Ptr<Packet> packet, WifiMacHeader & header, Mac48Address from, Mac48Address to) const = 0;
+ virtual bool UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header, Mac48Address from, Mac48Address to) const = 0;
/**
* \brief Update beacon before it will be formed and sent
*
* TODO define when MAC call this
*/
- virtual void UpdateBeacon(MeshWifiBeacon & beacon) const;
+ virtual void UpdateBeacon (MeshWifiBeacon & beacon) const;
};
} // namespace ns3
--- a/src/devices/mesh/mesh-wifi-interface-mac.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/mesh-wifi-interface-mac.cc Wed Mar 18 22:36:12 2009 +0300
@@ -86,7 +86,7 @@
m_beaconDca->SetLow (m_low);
m_beaconDca->SetMinCw (0);
m_beaconDca->SetMaxCw (0);
- m_beaconDca->SetAifsn(1);
+ m_beaconDca->SetAifsn (1);
m_beaconDca->SetManager (m_dcfManager);
m_VO = CreateObject<DcaTxop> ();
@@ -151,39 +151,39 @@
Time
MeshWifiInterfaceMac::GetSlot () const
- {
- return m_slot;
- }
+{
+ return m_slot;
+}
Time
MeshWifiInterfaceMac::GetSifs () const
- {
- return m_sifs;
- }
+{
+ return m_sifs;
+}
Time
MeshWifiInterfaceMac::GetEifsNoDifs () const
- {
- return m_eifsNoDifs;
- }
+{
+ return m_eifsNoDifs;
+}
Time
MeshWifiInterfaceMac::GetAckTimeout () const
- {
- return m_low->GetAckTimeout ();
- }
+{
+ return m_low->GetAckTimeout ();
+}
Time
MeshWifiInterfaceMac::GetCtsTimeout () const
- {
- return m_low->GetCtsTimeout ();
- }
+{
+ return m_low->GetCtsTimeout ();
+}
Time
MeshWifiInterfaceMac::GetPifs () const
- {
- return m_low->GetPifs ();
- }
+{
+ return m_low->GetPifs ();
+}
void
MeshWifiInterfaceMac::SetWifiPhy (Ptr<WifiPhy> phy)
@@ -221,9 +221,9 @@
bool
MeshWifiInterfaceMac::SupportsSendFrom () const
- {
- return true;
- }
+{
+ return true;
+}
void
MeshWifiInterfaceMac::SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback)
@@ -250,26 +250,26 @@
Mac48Address
MeshWifiInterfaceMac::GetAddress () const
- {
- return m_address;
- }
+{
+ return m_address;
+}
Mac48Address
MeshWifiInterfaceMac::GetBssid () const
- {
- return m_address;
- }
+{
+ return m_address;
+}
Ssid
MeshWifiInterfaceMac::GetSsid () const
- {
- return m_MeshId;
- }
+{
+ return m_MeshId;
+}
void
MeshWifiInterfaceMac::SetAddress (Mac48Address address)
{
NS_LOG_FUNCTION (address);
- m_low->SetAddress(address);
+ m_low->SetAddress (address);
m_address = address;
}
@@ -303,10 +303,10 @@
// Plugins
//-----------------------------------------------------------------------------
void
-MeshWifiInterfaceMac::InstallPlugin( Ptr<MeshWifiInterfaceMacPlugin> plugin)
+MeshWifiInterfaceMac::InstallPlugin ( Ptr<MeshWifiInterfaceMacPlugin> plugin)
{
- plugin->SetParent(this);
- m_plugins.push_back(plugin);
+ plugin->SetParent (this);
+ m_plugins.push_back (plugin);
}
//-----------------------------------------------------------------------------
@@ -323,7 +323,7 @@
MeshWifiInterfaceMac::ForwardDown (Ptr<const Packet> const_packet, Mac48Address from, Mac48Address to)
{
// copy packet to allow modifications
- Ptr<Packet> packet = const_packet->Copy();
+ Ptr<Packet> packet = const_packet->Copy ();
WifiMacHeader hdr;
hdr.SetTypeData ();
@@ -337,14 +337,14 @@
hdr.SetAddr1 (Mac48Address ());
// Filter packet through all installed plugins
- for(PluginList::const_iterator i = m_plugins.begin(); i != m_plugins.end(); ++i)
+ for (PluginList::const_iterator i = m_plugins.begin(); i != m_plugins.end(); ++i)
{
- bool drop = !((*i)->UpdateOutcomingFrame(packet, hdr, from, to));
+ bool drop = ! ((*i)->UpdateOutcomingFrame(packet, hdr, from, to));
if (drop) return; // plugin drops frame
}
// Assert that address1 is set. Assert will fail e.g. if there is no installed routing plugin.
- NS_ASSERT(hdr.GetAddr1() != Mac48Address() );
+ NS_ASSERT (hdr.GetAddr1() != Mac48Address() );
// Queue frame
WifiRemoteStation *destination = m_stationManager->Lookup (to);
@@ -386,30 +386,30 @@
// Beacons
//-----------------------------------------------------------------------------
void
-MeshWifiInterfaceMac::SetSoftwareDelay(Time delay)
+MeshWifiInterfaceMac::SetSoftwareDelay (Time delay)
{
- NS_ASSERT(delay < m_beaconInterval);
+ NS_ASSERT (delay < m_beaconInterval);
m_softwareDelay = delay;
}
Time
-MeshWifiInterfaceMac::GetSoftwareDelay()
+MeshWifiInterfaceMac::GetSoftwareDelay ()
{
return m_softwareDelay;
}
Time
-MeshWifiInterfaceMac::CalcSwDelay()
+MeshWifiInterfaceMac::CalcSwDelay ()
{
- UniformVariable coefficient(0.0, m_softwareDelay.GetSeconds());
+ UniformVariable coefficient (0.0, m_softwareDelay.GetSeconds());
// Be sure that frames don't change order due to different software delays
- Time delay = Seconds(coefficient.GetValue());
- if (delay.GetSeconds() + Simulator::Now().GetSeconds() < m_lastMgtFrame.GetSeconds())
- delay = Seconds(m_lastMgtFrame.GetSeconds() - Simulator::Now().GetSeconds());
- m_lastMgtFrame = Seconds(Simulator::Now().GetSeconds() + delay.GetSeconds());
+ Time delay = Seconds (coefficient.GetValue());
+ if (delay.GetSeconds () + Simulator::Now().GetSeconds() < m_lastMgtFrame.GetSeconds())
+ delay = Seconds (m_lastMgtFrame.GetSeconds() - Simulator::Now().GetSeconds());
+ m_lastMgtFrame = Seconds (Simulator::Now().GetSeconds() + delay.GetSeconds());
- NS_ASSERT(delay.GetSeconds() >= 0);
+ NS_ASSERT (delay.GetSeconds() >= 0);
return delay;
}
@@ -419,11 +419,11 @@
NS_LOG_FUNCTION (this << interval);
m_beaconInterval = interval;
- NS_ASSERT(m_beaconInterval > m_softwareDelay);
+ NS_ASSERT (m_beaconInterval > m_softwareDelay);
}
Time
-MeshWifiInterfaceMac::GetBeaconInterval() const
+MeshWifiInterfaceMac::GetBeaconInterval () const
{
return m_beaconInterval;
}
@@ -435,8 +435,8 @@
if (enable)
{
// Now start sending beacons after some random delay (to avoid collisions)
- UniformVariable coefficient(0.0, m_randomStart.GetSeconds());
- Time randomStart = Seconds(coefficient.GetValue());
+ UniformVariable coefficient (0.0, m_randomStart.GetSeconds());
+ Time randomStart = Seconds (coefficient.GetValue());
m_beaconSendEvent = Simulator::Schedule (randomStart, &MeshWifiInterfaceMac::SendBeacon, this);
}
@@ -452,48 +452,48 @@
}
Time
-MeshWifiInterfaceMac::GetTBTT() const
+MeshWifiInterfaceMac::GetTBTT () const
{
return m_tbtt;
}
-void MeshWifiInterfaceMac::ShiftTBTT(Time shift)
+void MeshWifiInterfaceMac::ShiftTBTT (Time shift)
{
- // User of ShiftTBTT() must take care don't shift it to the past
- NS_ASSERT(GetTBTT() + shift > Simulator::Now());
+ // User of ShiftTBTT () must take care don't shift it to the past
+ NS_ASSERT (GetTBTT() + shift > Simulator::Now());
m_tbtt += shift;
// Shift scheduled event
Simulator::Cancel (m_beaconSendEvent);
- m_beaconSendEvent = Simulator::Schedule (GetTBTT(), &MeshWifiInterfaceMac::SendBeacon, this);
+ m_beaconSendEvent = Simulator::Schedule (GetTBTT (), &MeshWifiInterfaceMac::SendBeacon, this);
}
void
-MeshWifiInterfaceMac::ScheduleNextBeacon()
+MeshWifiInterfaceMac::ScheduleNextBeacon ()
{
- m_tbtt += GetBeaconInterval();
- m_beaconSendEvent = Simulator::Schedule (GetTBTT(), &MeshWifiInterfaceMac::SendBeacon, this);
+ m_tbtt += GetBeaconInterval ();
+ m_beaconSendEvent = Simulator::Schedule (GetTBTT (), &MeshWifiInterfaceMac::SendBeacon, this);
}
void
MeshWifiInterfaceMac::SendBeacon ()
{
NS_LOG_FUNCTION (this);
- NS_LOG_DEBUG(GetAddress() <<" is sending beacon");
+ NS_LOG_DEBUG (GetAddress() <<" is sending beacon");
- NS_ASSERT(! m_beaconSendEvent.IsRunning());
- NS_ASSERT(Simulator::Now() == GetTBTT()); // assert that beacon is just on time
+ NS_ASSERT (! m_beaconSendEvent.IsRunning());
+ NS_ASSERT (Simulator::Now() == GetTBTT()); // assert that beacon is just on time
// Form & send beacon
- MeshWifiBeacon beacon(GetSsid (), GetSupportedRates (), m_beaconInterval.GetMicroSeconds ());
+ MeshWifiBeacon beacon (GetSsid (), GetSupportedRates (), m_beaconInterval.GetMicroSeconds ());
// Ask all plugins to add their specific information elements to beacon
- for(PluginList::const_iterator i = m_plugins.begin(); i != m_plugins.end(); ++i)
- (*i)->UpdateBeacon(beacon);
+ for (PluginList::const_iterator i = m_plugins.begin(); i != m_plugins.end(); ++i)
+ (*i)->UpdateBeacon (beacon);
- m_beaconDca->Queue(beacon.CreatePacket(), beacon.CreateHeader(GetAddress()));
+ m_beaconDca->Queue (beacon.CreatePacket(), beacon.CreateHeader(GetAddress()));
- ScheduleNextBeacon();
+ ScheduleNextBeacon ();
}
void
@@ -503,17 +503,17 @@
if (hdr->IsBeacon ())
{
MgtBeaconHeader beacon_hdr;
- Mac48Address from = hdr->GetAddr2();
+ Mac48Address from = hdr->GetAddr2 ();
packet->PeekHeader (beacon_hdr);
- NS_LOG_DEBUG("Beacon received from "<<hdr->GetAddr2()<<
- " to "<<GetAddress()<<
+ NS_LOG_DEBUG ("Beacon received from "<<hdr->GetAddr2()<<
+ " to "<<GetAddress ()<<
" at "<<Simulator::Now ().GetMicroSeconds ()<<
" microseconds");
// update supported rates
- if (beacon_hdr.GetSsid().IsEqual(GetSsid()))
+ if (beacon_hdr.GetSsid ().IsEqual(GetSsid()))
{
SupportedRates rates = beacon_hdr.GetSupportedRates ();
WifiRemoteStation * peerSta = m_stationManager->Lookup (hdr->GetAddr2 ());
@@ -532,17 +532,17 @@
}
// Filter frame through all installed plugins
- for (PluginList::iterator i = m_plugins.begin(); i != m_plugins.end(); ++i)
+ for (PluginList::iterator i = m_plugins.begin (); i != m_plugins.end(); ++i)
{
- bool drop = !((*i)->Receive(packet, *hdr));
+ bool drop = ! ((*i)->Receive(packet, *hdr));
if (drop) return; // plugin drops frame
}
// Forward data up
- if (hdr->IsData())
- ForwardUp(packet, hdr->GetAddr4(), hdr->GetAddr3());
+ if (hdr->IsData ())
+ ForwardUp (packet, hdr->GetAddr4(), hdr->GetAddr3());
}
-
+
} // namespace ns3
--- a/src/devices/mesh/mesh-wifi-interface-mac.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/mesh-wifi-interface-mac.h Wed Mar 18 22:36:12 2009 +0300
@@ -61,9 +61,9 @@
/// Never forget to support typeid
static TypeId GetTypeId ();
/// C-tor
- MeshWifiInterfaceMac();
+ MeshWifiInterfaceMac ();
/// D-tor
- virtual ~MeshWifiInterfaceMac();
+ virtual ~MeshWifiInterfaceMac ();
///\name Inherited from WifiMac
//\{
@@ -106,15 +106,15 @@
*
* This is supposed to be used by any entity managing beacon collision avoidance (e.g. Peer management protocol in 802.11s)
*/
- Time GetTBTT() const;
+ Time GetTBTT () const;
/**
* \brief Shift TBTT.
*
* This is supposed to be used by any entity managing beacon collision avoidance (e.g. Peer management protocol in 802.11s)
*
- * \attention User of ShiftTBTT() must take care to not shift it to the past.
+ * \attention User of ShiftTBTT () must take care to not shift it to the past.
*/
- void ShiftTBTT(Time shift);
+ void ShiftTBTT (Time shift);
/**
* \brief Set maximum software delay. Maximum software delay must be smaller than beacon interval.
*
@@ -129,16 +129,16 @@
*
* \param delay is the maximum software delay.
*/
- void SetSoftwareDelay(Time delay);
+ void SetSoftwareDelay (Time delay);
/// \return Maximum software delay
- Time GetSoftwareDelay();
+ Time GetSoftwareDelay ();
//\}
///\name Plugins
//\{
/// Install plugin. TODO return unique ID to allow unregister plugins
- void InstallPlugin(Ptr<MeshWifiInterfaceMacPlugin> plugin);
+ void InstallPlugin (Ptr<MeshWifiInterfaceMacPlugin> plugin);
//\}
private:
@@ -147,9 +147,9 @@
/// Forward frame to mesh point
virtual void ForwardUp (Ptr<Packet> packet, Mac48Address src, Mac48Address dst);
/// Send frame. Frame is supposed to be tagged by routing information. TODO: clarify this point
- void ForwardDown(Ptr<const Packet> packet, Mac48Address from, Mac48Address to);
- /// Calc software delay value uniformely distributed between 0 and m_softwareDealy, see SetSoftwareDelay().
- Time CalcSwDelay();
+ void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to);
+ /// Calc software delay value uniformely distributed between 0 and m_softwareDealy, see SetSoftwareDelay ().
+ Time CalcSwDelay ();
/// Send beacon
void SendBeacon ();
/// Schedule next beacon
--- a/src/devices/mesh/mesh-wifi-mac-header.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/mesh-wifi-mac-header.cc Wed Mar 18 22:36:12 2009 +0300
@@ -38,20 +38,20 @@
return tid;
}
-WifiMeshHeader::WifiMeshHeader()
- :m_meshFlags(0)
+WifiMeshHeader::WifiMeshHeader ()
+ :m_meshFlags (0)
{
}
-WifiMeshHeader::~WifiMeshHeader()
+WifiMeshHeader::~WifiMeshHeader ()
{
}
TypeId
WifiMeshHeader::GetInstanceTypeId () const
- {
- return GetTypeId ();
- }
+{
+ return GetTypeId ();
+}
void
WifiMeshHeader::SetAddr5 (Mac48Address address)
@@ -130,35 +130,35 @@
uint32_t
WifiMeshHeader::GetSerializedSize () const
- {
- return 6 + ((0xc0 & m_meshFlags) >> 6)*6;
- }
+{
+ return 6 + ((0xc0 & m_meshFlags) >> 6)*6;
+}
void
WifiMeshHeader::Serialize (Buffer::Iterator start) const
- {
- Buffer::Iterator i = start;
- i.WriteU8 (m_meshFlags);
- i.WriteU8 (m_meshTtl);
- i.WriteU32 (m_meshSeqno);
- uint8_t addresses_to_add = (m_meshFlags & 0xc0) >> 6;
- //Writing Address extensions:
- if (addresses_to_add > 0)
- WriteTo (i, m_addr5);
- if (addresses_to_add > 1)
- WriteTo (i, m_addr6);
- if (addresses_to_add > 2)
- WriteTo (i, m_addr7);
- }
+{
+ Buffer::Iterator i = start;
+ i.WriteU8 (m_meshFlags);
+ i.WriteU8 (m_meshTtl);
+ i.WriteU32 (m_meshSeqno);
+ uint8_t addresses_to_add = (m_meshFlags & 0xc0) >> 6;
+ //Writing Address extensions:
+ if (addresses_to_add > 0)
+ WriteTo (i, m_addr5);
+ if (addresses_to_add > 1)
+ WriteTo (i, m_addr6);
+ if (addresses_to_add > 2)
+ WriteTo (i, m_addr7);
+}
uint32_t
WifiMeshHeader::Deserialize (Buffer::Iterator start)
{
Buffer::Iterator i = start;
uint8_t addresses_to_read = 0;
- m_meshFlags = i.ReadU8();
- m_meshTtl = i.ReadU8();
- m_meshSeqno = i.ReadU32();
+ m_meshFlags = i.ReadU8 ();
+ m_meshTtl = i.ReadU8 ();
+ m_meshSeqno = i.ReadU32 ();
addresses_to_read = (m_meshFlags & 0xc0) >> 6;
if (addresses_to_read > 0)
ReadFrom (i, m_addr5);
@@ -166,15 +166,15 @@
ReadFrom (i, m_addr6);
if (addresses_to_read > 2)
ReadFrom (i, m_addr7);
- return i.GetDistanceFrom(start);
+ return i.GetDistanceFrom (start);
}
void
WifiMeshHeader::Print (std::ostream &os) const
- {
- os << "flags" << m_meshFlags
- << "ttl" << m_meshTtl
- << "seqno" << m_meshSeqno;
- }
+{
+ os << "flags" << m_meshFlags
+ << "ttl" << m_meshTtl
+ << "seqno" << m_meshSeqno;
+}
/**********************************************************
* MultihopActionFrame
**********************************************************/
@@ -187,7 +187,7 @@
}
void
-WifiMeshMultihopActionHeader::SetAction(
+WifiMeshMultihopActionHeader::SetAction (
enum WifiMeshMultihopActionHeader::CategoryValue type,
WifiMeshMultihopActionHeader::ACTION_VALUE action)
{
@@ -239,7 +239,7 @@
}
enum WifiMeshMultihopActionHeader::CategoryValue
-WifiMeshMultihopActionHeader::GetCategory()
+WifiMeshMultihopActionHeader::GetCategory ()
{
switch (m_category)
{
@@ -254,13 +254,13 @@
case 8:
return MESH_RESOURCE_COORDINATION;
default:
- NS_ASSERT(false);
+ NS_ASSERT (false);
return MESH_PEER_LINK_MGT;
}
}
WifiMeshMultihopActionHeader::ACTION_VALUE
-WifiMeshMultihopActionHeader::GetAction()
+WifiMeshMultihopActionHeader::GetAction ()
{
ACTION_VALUE retval;
switch (m_category)
@@ -279,7 +279,7 @@
retval.peerLink = PEER_LINK_CLOSE;
return retval;
default:
- NS_ASSERT(false);
+ NS_ASSERT (false);
return retval;
}
@@ -302,7 +302,7 @@
retval.pathSelection = ROOT_ANNOUNCEMENT;
return retval;
default:
- NS_ASSERT(false);
+ NS_ASSERT (false);
return retval;
}
@@ -311,7 +311,7 @@
case 8:
//MESH_RESOURCE_COORDINATION;
default:
- NS_ASSERT(false);
+ NS_ASSERT (false);
return retval;
}
}
@@ -328,27 +328,27 @@
TypeId
WifiMeshMultihopActionHeader::GetInstanceTypeId () const
- {
- return GetTypeId();
- }
+{
+ return GetTypeId ();
+}
void
WifiMeshMultihopActionHeader::Print (std::ostream &os) const
- {
- }
+{
+}
uint32_t
WifiMeshMultihopActionHeader::GetSerializedSize () const
- {
- return 2;
- }
+{
+ return 2;
+}
void
WifiMeshMultihopActionHeader::Serialize (Buffer::Iterator start) const
- {
- start.WriteU8(m_category);
- start.WriteU8(m_actionValue);
- }
+{
+ start.WriteU8 (m_category);
+ start.WriteU8 (m_actionValue);
+}
uint32_t
WifiMeshMultihopActionHeader::Deserialize (Buffer::Iterator start)
--- a/src/devices/mesh/mesh-wifi-mac-header.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/mesh-wifi-mac-header.h Wed Mar 18 22:36:12 2009 +0300
@@ -132,9 +132,9 @@
enum InterworkActionValue interwork;
enum ResourceCoordinationActionValue resourceCoordination;
} ACTION_VALUE;
- void SetAction(enum CategoryValue type,ACTION_VALUE action);
- enum CategoryValue GetCategory();
- ACTION_VALUE GetAction();
+ void SetAction (enum CategoryValue type,ACTION_VALUE action);
+ enum CategoryValue GetCategory ();
+ ACTION_VALUE GetAction ();
static TypeId GetTypeId ();
virtual TypeId GetInstanceTypeId () const;
virtual void Print (std::ostream &os) const;
--- a/src/devices/mesh/mesh-wifi-mac.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/mesh-wifi-mac.cc Wed Mar 18 22:36:12 2009 +0300
@@ -94,7 +94,7 @@
m_beaconDca->SetLow (m_low);
m_beaconDca->SetMinCw (0);
m_beaconDca->SetMaxCw (0);
- m_beaconDca->SetAifsn(1);
+ m_beaconDca->SetAifsn (1);
m_beaconDca->SetManager (m_dcfManager);
m_VO = CreateObject<DcaTxop> ();
@@ -162,39 +162,39 @@
Time
MeshWifiMac::GetSlot () const
- {
- return m_slot;
- }
+{
+ return m_slot;
+}
Time
MeshWifiMac::GetSifs () const
- {
- return m_sifs;
- }
+{
+ return m_sifs;
+}
Time
MeshWifiMac::GetEifsNoDifs () const
- {
- return m_eifsNoDifs;
- }
+{
+ return m_eifsNoDifs;
+}
Time
MeshWifiMac::GetAckTimeout () const
- {
- return m_low->GetAckTimeout ();
- }
+{
+ return m_low->GetAckTimeout ();
+}
Time
MeshWifiMac::GetCtsTimeout () const
- {
- return m_low->GetCtsTimeout ();
- }
+{
+ return m_low->GetCtsTimeout ();
+}
Time
MeshWifiMac::GetPifs () const
- {
- return m_low->GetPifs ();
- }
+{
+ return m_low->GetPifs ();
+}
void
MeshWifiMac::SetWifiPhy (Ptr<WifiPhy> phy)
@@ -238,9 +238,9 @@
bool
MeshWifiMac::SupportsSendFrom () const
- {
- return true;
- }
+{
+ return true;
+}
void
MeshWifiMac::SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback)
@@ -267,26 +267,26 @@
Mac48Address
MeshWifiMac::GetAddress () const
- {
- return m_address;
- }
+{
+ return m_address;
+}
Mac48Address
MeshWifiMac::GetBssid () const
- {
- return m_address;
- }
+{
+ return m_address;
+}
Ssid
MeshWifiMac::GetSsid () const
- {
- return m_MeshId;
- }
+{
+ return m_MeshId;
+}
void
MeshWifiMac::SetAddress (Mac48Address address)
{
NS_LOG_FUNCTION (address);
- m_low->SetAddress(address);
+ m_low->SetAddress (address);
m_address = address;
}
@@ -336,33 +336,33 @@
{
//TODO:Classify and queue
WifiMacHeader hdr;
- Ptr<Packet> packet_to_send = packet->Copy();
+ Ptr<Packet> packet_to_send = packet->Copy ();
WifiMeshHeader meshHdr;
//Address 1 we receive from HWMP tag
HwmpTag tag;
- NS_ASSERT(packet->FindFirstMatchingTag(tag));
- meshHdr.SetMeshTtl(tag.GetTtl());
- meshHdr.SetMeshSeqno(tag.GetSeqno());
+ NS_ASSERT (packet->FindFirstMatchingTag(tag));
+ meshHdr.SetMeshTtl (tag.GetTtl());
+ meshHdr.SetMeshSeqno (tag.GetSeqno());
#if 0
- NS_LOG_DEBUG(
+ NS_LOG_DEBUG (
"TX Packet sa = "<<from<<
", da = "<<to<<
- ", ra = "<<tag.GetAddress()<<
- ", I am "<<GetAddress()<<
- ", ttl = "<<(int)meshHdr.GetMeshTtl()
+ ", ra = "<<tag.GetAddress ()<<
+ ", I am "<<GetAddress ()<<
+ ", ttl = "<< (int)meshHdr.GetMeshTtl()
);
#endif
- if (to!= Mac48Address::GetBroadcast())
- NS_ASSERT(tag.GetAddress()!=Mac48Address::GetBroadcast());
+ if (to != Mac48Address::GetBroadcast ())
+ NS_ASSERT (tag.GetAddress() != Mac48Address::GetBroadcast());
hdr.SetTypeData ();
- hdr.SetAddr1 (tag.GetAddress());
+ hdr.SetAddr1 (tag.GetAddress ());
hdr.SetAddr2 (GetAddress ());
hdr.SetAddr3 (to);
- hdr.SetAddr4(from);
+ hdr.SetAddr4 (from);
hdr.SetDsFrom ();
hdr.SetDsTo ();
//TODO: classify should be fixed!
- packet_to_send->AddHeader(meshHdr);
+ packet_to_send->AddHeader (meshHdr);
WifiRemoteStation *destination = m_stationManager->Lookup (to);
if (destination->IsBrandNew ())
@@ -380,51 +380,51 @@
SupportedRates
MeshWifiMac::GetSupportedRates () const
- {
- // send the set of supported rates and make sure that we indicate
- // the Basic Rate set in this set of supported rates.
- SupportedRates rates;
- for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
- {
- WifiMode mode = m_phy->GetMode (i);
- rates.AddSupportedRate (mode.GetDataRate ());
- }
- // set the basic rates
- for (uint32_t j = 0; j < m_stationManager->GetNBasicModes (); j++)
- {
- WifiMode mode = m_stationManager->GetBasicMode (j);
- rates.SetBasicRate (mode.GetDataRate ());
- }
- return rates;
- }
+{
+ // send the set of supported rates and make sure that we indicate
+ // the Basic Rate set in this set of supported rates.
+ SupportedRates rates;
+ for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
+ {
+ WifiMode mode = m_phy->GetMode (i);
+ rates.AddSupportedRate (mode.GetDataRate ());
+ }
+ // set the basic rates
+ for (uint32_t j = 0; j < m_stationManager->GetNBasicModes (); j++)
+ {
+ WifiMode mode = m_stationManager->GetBasicMode (j);
+ rates.SetBasicRate (mode.GetDataRate ());
+ }
+ return rates;
+}
void
MeshWifiMac::SendOneBeacon ()
{
NS_LOG_FUNCTION (this);
- NS_LOG_DEBUG(GetAddress()<<" is sending beacon");
+ NS_LOG_DEBUG (GetAddress()<<" is sending beacon");
//Software delay should never be bigger than beacon interval!
- NS_ASSERT(!m_beaconSendEvent.IsRunning());
+ NS_ASSERT (!m_beaconSendEvent.IsRunning());
Time last_software_delay = m_beaconFormingRandomDelay;
MgtMeshBeaconHeader beacon;
beacon.SetSsid (GetSsid ());
beacon.SetSupportedRates (GetSupportedRates ());
beacon.SetBeaconIntervalUs (m_beaconInterval.GetMicroSeconds ());
- beacon.SetIeDot11sBeaconTiming(m_peerManager->GetIeDot11sBeaconTimingForMyBeacon(GetAddress()));
- m_beaconSendEvent = Simulator::Schedule(
+ beacon.SetIeDot11sBeaconTiming (m_peerManager->GetIeDot11sBeaconTimingForMyBeacon(GetAddress()));
+ m_beaconSendEvent = Simulator::Schedule (
m_beaconFormingRandomDelay,
&MeshWifiMac::QueueOneBeacon,
this,
beacon);
- UniformVariable coefficient(0.0, m_beaconFormingRandomDelay.GetSeconds());
- m_beaconFormingRandomDelay = Seconds(coefficient.GetValue());
+ UniformVariable coefficient (0.0, m_beaconFormingRandomDelay.GetSeconds());
+ m_beaconFormingRandomDelay = Seconds (coefficient.GetValue());
//MBCA functionality, TODO: add the switch off/on MBCA mechanism capability
//Let's find when we send the next beacon
Time myNextTBTT = Simulator::Now ()+m_beaconInterval+last_software_delay;
//The mext function compares my TBTT with neighbor's TBTTs using timing elemnt
//and returns time shift for the next beacon if future collision is detected
- Time nextBeaconShift = m_peerManager->GetNextBeaconShift(GetAddress(), myNextTBTT);
+ Time nextBeaconShift = m_peerManager->GetNextBeaconShift (GetAddress(), myNextTBTT);
m_beaconFormEvent = Simulator::Schedule (m_beaconInterval-m_beaconFormingRandomDelay+last_software_delay+nextBeaconShift, &MeshWifiMac::SendOneBeacon, this);
}
@@ -442,11 +442,11 @@
Ptr<Packet> packet = Create<Packet> ();
packet->AddHeader (beacon_hdr);
- m_beaconDca->Queue(packet, hdr);
- m_peerManager->SetSentBeaconTimers(
- GetAddress(),
+ m_beaconDca->Queue (packet, hdr);
+ m_peerManager->SetSentBeaconTimers (
+ GetAddress (),
Simulator::Now (),
- MicroSeconds(beacon_hdr.GetBeaconIntervalUs())
+ MicroSeconds (beacon_hdr.GetBeaconIntervalUs())
);
}
@@ -456,8 +456,8 @@
NS_LOG_FUNCTION (this << enable);
if (enable)
{
- UniformVariable coefficient(0.0, m_randomStart.GetSeconds());
- Time randomStart = Seconds(coefficient.GetValue());
+ UniformVariable coefficient (0.0, m_randomStart.GetSeconds());
+ Time randomStart = Seconds (coefficient.GetValue());
// Beacons must be sent with a random delay,
// otherwise, they will all be broken
m_beaconFormEvent = Simulator::Schedule (randomStart, &MeshWifiMac::SendOneBeacon, this);
@@ -468,9 +468,9 @@
bool
MeshWifiMac::GetBeaconGeneration () const
- {
- return m_beaconFormEvent.IsRunning ();
- }
+{
+ return m_beaconFormEvent.IsRunning ();
+}
void
MeshWifiMac::TxOk (WifiMacHeader const &hdr)
@@ -488,32 +488,32 @@
if (hdr->IsBeacon ())
{
MgtMeshBeaconHeader beacon;
- Mac48Address from = hdr->GetAddr2();
+ Mac48Address from = hdr->GetAddr2 ();
packet->RemoveHeader (beacon);
- NS_LOG_DEBUG("Beacon received from "<<hdr->GetAddr2()<<
- " to "<<GetAddress()<<
+ NS_LOG_DEBUG ("Beacon received from "<<hdr->GetAddr2()<<
+ " to "<<GetAddress ()<<
" at "<<Simulator::Now ().GetMicroSeconds ()<<
" microseconds");
#if 0
NeighboursTimingUnitsList neighbours;
- neighbours = beacon.GetIeDot11sBeaconTiming().GetNeighboursTimingElementsList();
- for (NeighboursTimingUnitsList::const_iterator j = neighbours.begin(); j!= neighbours.end(); j++)
- fprintf(
+ neighbours = beacon.GetIeDot11sBeaconTiming ().GetNeighboursTimingElementsList();
+ for (NeighboursTimingUnitsList::const_iterator j = neighbours.begin (); j != neighbours.end(); j++)
+ fprintf (
stderr,
"neigbours:\nAID=%u, last_beacon=%u ,beacon_interval=%u\n",
- (*j)->GetAID(),
- (*j)->GetLastBeacon(),
- (*j)->GetBeaconInterval()
+ (*j)->GetAID (),
+ (*j)->GetLastBeacon (),
+ (*j)->GetBeaconInterval ()
);
#endif
- m_peerManager->SetReceivedBeaconTimers(
- GetAddress(),
+ m_peerManager->SetReceivedBeaconTimers (
+ GetAddress (),
from,
Simulator::Now (),
- MicroSeconds(beacon.GetBeaconIntervalUs()),
- beacon.GetIeDot11sBeaconTiming()
+ MicroSeconds (beacon.GetBeaconIntervalUs()),
+ beacon.GetIeDot11sBeaconTiming ()
);
- if (!beacon.GetSsid().IsEqual(GetSsid()))
+ if (!beacon.GetSsid ().IsEqual(GetSsid()))
return;
SupportedRates rates = beacon.GetSupportedRates ();
WifiRemoteStation *peerSta = m_stationManager->Lookup (hdr->GetAddr2 ());
@@ -529,23 +529,23 @@
}
}
}
- // TODO:Chack IeDot11sConfiguration(now is nothing
+ // TODO:Chack IeDot11sConfiguration (now is nothing
// to be checked)
- m_peerManager->AskIfOpenNeeded(GetAddress(), from);
+ m_peerManager->AskIfOpenNeeded (GetAddress(), from);
return;
}
- if (hdr->IsMultihopAction())
+ if (hdr->IsMultihopAction ())
{
WifiMeshHeader meshHdr;
//no mesh header parameters are needed here:
//TODO: check TTL
- packet->RemoveHeader(meshHdr);
+ packet->RemoveHeader (meshHdr);
WifiMeshMultihopActionHeader multihopHdr;
//parse multihop action header:
- packet->RemoveHeader(multihopHdr);
+ packet->RemoveHeader (multihopHdr);
WifiMeshMultihopActionHeader::ACTION_VALUE
- actionValue = multihopHdr.GetAction();
- switch (multihopHdr.GetCategory())
+ actionValue = multihopHdr.GetAction ();
+ switch (multihopHdr.GetCategory ())
{
case WifiMeshMultihopActionHeader::MESH_PEER_LINK_MGT:
{
@@ -553,52 +553,52 @@
MeshMgtPeerLinkManFrame peer_frame;
if (hdr->GetAddr1 () != GetAddress ())
return;
- peerAddress = hdr->GetAddr2();
+ peerAddress = hdr->GetAddr2 ();
packet->RemoveHeader (peer_frame);
if (actionValue.peerLink != WifiMeshMultihopActionHeader::PEER_LINK_CLOSE)
{
//check Supported Rates
- SupportedRates rates = peer_frame.GetSupportedRates();
+ SupportedRates rates = peer_frame.GetSupportedRates ();
for (uint32_t i = 0; i < m_stationManager->GetNBasicModes (); i++)
{
WifiMode mode = m_stationManager->GetBasicMode (i);
if (!rates.IsSupportedRate (mode.GetDataRate ()))
{
- m_peerManager->ConfigurationMismatch(GetAddress(), peerAddress);
+ m_peerManager->ConfigurationMismatch (GetAddress(), peerAddress);
return;
}
}
//Check SSID
- if (!peer_frame.GetMeshId().IsEqual(GetSsid()))
+ if (!peer_frame.GetMeshId ().IsEqual(GetSsid()))
{
- m_peerManager->ConfigurationMismatch(GetAddress(), peerAddress);
+ m_peerManager->ConfigurationMismatch (GetAddress(), peerAddress);
return;
}
}
switch (actionValue.peerLink)
{
case WifiMeshMultihopActionHeader::PEER_LINK_CONFIRM:
- m_peerManager->SetConfirmReceived(
- GetAddress(),
+ m_peerManager->SetConfirmReceived (
+ GetAddress (),
peerAddress,
- peer_frame.GetAid(),
- peer_frame.GetIeDot11sPeerManagement(),
+ peer_frame.GetAid (),
+ peer_frame.GetIeDot11sPeerManagement (),
m_meshConfig
);
return;
case WifiMeshMultihopActionHeader::PEER_LINK_OPEN:
- m_peerManager->SetOpenReceived(
- GetAddress(),
+ m_peerManager->SetOpenReceived (
+ GetAddress (),
peerAddress,
- peer_frame.GetIeDot11sPeerManagement(),
+ peer_frame.GetIeDot11sPeerManagement (),
m_meshConfig
);
return;
case WifiMeshMultihopActionHeader::PEER_LINK_CLOSE:
- m_peerManager->SetCloseReceived(
- GetAddress(),
+ m_peerManager->SetCloseReceived (
+ GetAddress (),
peerAddress,
- peer_frame.GetIeDot11sPeerManagement()
+ peer_frame.GetIeDot11sPeerManagement ()
);
return;
default:
@@ -608,31 +608,31 @@
}
case WifiMeshMultihopActionHeader::MESH_PATH_SELECTION:
{
- if (!m_peerManager->IsActiveLink(GetAddress(), hdr->GetAddr2()))
+ if (!m_peerManager->IsActiveLink (GetAddress(), hdr->GetAddr2()))
return;
switch (actionValue.pathSelection)
{
case WifiMeshMultihopActionHeader::PATH_REQUEST:
{
IeDot11sPreq preq;
- packet->RemoveHeader(preq);
+ packet->RemoveHeader (preq);
//TODO:recalculate
//metric
- m_preqReceived(preq, hdr->GetAddr2(), CalculateMetric(hdr->GetAddr2()));
+ m_preqReceived (preq, hdr->GetAddr2(), CalculateMetric(hdr->GetAddr2()));
return;
}
case WifiMeshMultihopActionHeader::PATH_REPLY:
{
IeDot11sPrep prep;
- packet->RemoveHeader(prep);
- m_prepReceived(prep, hdr->GetAddr2(), CalculateMetric(hdr->GetAddr2()));
+ packet->RemoveHeader (prep);
+ m_prepReceived (prep, hdr->GetAddr2(), CalculateMetric(hdr->GetAddr2()));
}
return;
case WifiMeshMultihopActionHeader::PATH_ERROR:
{
IeDot11sPerr perr;
- packet->RemoveHeader(perr);
- m_perrReceived(perr, hdr->GetAddr2());
+ packet->RemoveHeader (perr);
+ m_perrReceived (perr, hdr->GetAddr2());
}
return;
case WifiMeshMultihopActionHeader::ROOT_ANNOUNCEMENT:
@@ -643,319 +643,319 @@
break;
}
}
- if (hdr->IsData())
+ if (hdr->IsData ())
{
- NS_ASSERT((hdr->IsFromDs()) && (hdr->IsToDs()));
- NS_ASSERT(hdr->GetAddr4()!=Mac48Address::GetBroadcast());
+ NS_ASSERT ((hdr->IsFromDs()) && (hdr->IsToDs()));
+ NS_ASSERT (hdr->GetAddr4() != Mac48Address::GetBroadcast());
//check seqno
WifiMeshHeader meshHdr;
- packet->RemoveHeader(meshHdr);
- NS_LOG_DEBUG(
- "DATA TA="<< hdr->GetAddr2()<<
- ", da="<<hdr->GetAddr3()<<
- ", sa="<<hdr->GetAddr4()<<
- ", TTL="<<(int)meshHdr.GetMeshTtl());
+ packet->RemoveHeader (meshHdr);
+ NS_LOG_DEBUG (
+ "DATA TA="<< hdr->GetAddr2 ()<<
+ ", da="<<hdr->GetAddr3 ()<<
+ ", sa="<<hdr->GetAddr4 ()<<
+ ", TTL="<< (int)meshHdr.GetMeshTtl());
HwmpTag tag;
//mesh header is present within DATA and multihop action frames, so it must be done within MAC
- tag.SetSeqno(meshHdr.GetMeshSeqno());
- tag.SetAddress(hdr->GetAddr2());
- tag.SetTtl(meshHdr.GetMeshTtl());
+ tag.SetSeqno (meshHdr.GetMeshSeqno());
+ tag.SetAddress (hdr->GetAddr2());
+ tag.SetTtl (meshHdr.GetMeshTtl());
//metric should be later
- packet->RemoveAllTags();
- packet->AddTag(tag);
- if (m_peerManager->IsActiveLink(GetAddress(), hdr->GetAddr2()))
- ForwardUp(packet, hdr->GetAddr4(), hdr->GetAddr3());
+ packet->RemoveAllTags ();
+ packet->AddTag (tag);
+ if (m_peerManager->IsActiveLink (GetAddress(), hdr->GetAddr2()))
+ ForwardUp (packet, hdr->GetAddr4(), hdr->GetAddr3());
}
}
Time
-MeshWifiMac::CalcSwDelay()
+MeshWifiMac::CalcSwDelay ()
{
- UniformVariable coefficient(0.0, m_softwareDelay.GetSeconds());
- Time delay = Seconds(coefficient.GetValue());
- if (delay.GetSeconds() + Simulator::Now().GetSeconds() < m_lastMgtFrame.GetSeconds())
- delay = Seconds(m_lastMgtFrame.GetSeconds() - Simulator::Now().GetSeconds());
- m_lastMgtFrame = Seconds(Simulator::Now().GetSeconds()+delay.GetSeconds());
- NS_ASSERT(delay.GetSeconds() >= 0);
+ UniformVariable coefficient (0.0, m_softwareDelay.GetSeconds());
+ Time delay = Seconds (coefficient.GetValue());
+ if (delay.GetSeconds () + Simulator::Now().GetSeconds() < m_lastMgtFrame.GetSeconds())
+ delay = Seconds (m_lastMgtFrame.GetSeconds() - Simulator::Now().GetSeconds());
+ m_lastMgtFrame = Seconds (Simulator::Now().GetSeconds()+delay.GetSeconds());
+ NS_ASSERT (delay.GetSeconds() >= 0);
return delay;
}
void
-MeshWifiMac::SendPeerLinkOpen(IeDot11sPeerManagement peer_element, Mac48Address peerAddress)
+MeshWifiMac::SendPeerLinkOpen (IeDot11sPeerManagement peer_element, Mac48Address peerAddress)
{
MeshMgtPeerLinkManFrame open;
- open.SetOpen();
- open.SetIeDot11sConfiguration(m_meshConfig);
- open.SetIeDot11sPeerManagement(peer_element);
- Simulator::Schedule(CalcSwDelay() ,&MeshWifiMac::QueuePeerLinkFrame, this, open, peerAddress);
+ open.SetOpen ();
+ open.SetIeDot11sConfiguration (m_meshConfig);
+ open.SetIeDot11sPeerManagement (peer_element);
+ Simulator::Schedule (CalcSwDelay() ,&MeshWifiMac::QueuePeerLinkFrame, this, open, peerAddress);
}
void
-MeshWifiMac::SendPeerLinkConfirm(IeDot11sPeerManagement peer_element, Mac48Address peerAddress, uint16_t aid)
+MeshWifiMac::SendPeerLinkConfirm (IeDot11sPeerManagement peer_element, Mac48Address peerAddress, uint16_t aid)
{
MeshMgtPeerLinkManFrame confirm;
- confirm.SetConfirm();
- confirm.SetIeDot11sConfiguration(m_meshConfig);
- confirm.SetIeDot11sPeerManagement(peer_element);
- confirm.SetAid(aid);
- Simulator::Schedule(CalcSwDelay() ,&MeshWifiMac::QueuePeerLinkFrame, this, confirm, peerAddress);
+ confirm.SetConfirm ();
+ confirm.SetIeDot11sConfiguration (m_meshConfig);
+ confirm.SetIeDot11sPeerManagement (peer_element);
+ confirm.SetAid (aid);
+ Simulator::Schedule (CalcSwDelay() ,&MeshWifiMac::QueuePeerLinkFrame, this, confirm, peerAddress);
}
void
-MeshWifiMac::SendPeerLinkClose(IeDot11sPeerManagement peer_element, Mac48Address peerAddress)
+MeshWifiMac::SendPeerLinkClose (IeDot11sPeerManagement peer_element, Mac48Address peerAddress)
{
MeshMgtPeerLinkManFrame close;
- close.SetClose();
- close.SetIeDot11sConfiguration(m_meshConfig);
- close.SetIeDot11sPeerManagement(peer_element);
- Simulator::Schedule(CalcSwDelay() ,&MeshWifiMac::QueuePeerLinkFrame, this, close, peerAddress);
+ close.SetClose ();
+ close.SetIeDot11sConfiguration (m_meshConfig);
+ close.SetIeDot11sPeerManagement (peer_element);
+ Simulator::Schedule (CalcSwDelay() ,&MeshWifiMac::QueuePeerLinkFrame, this, close, peerAddress);
}
void
-MeshWifiMac::PeerLinkStatus(Mac48Address peerAddress, bool status)
+MeshWifiMac::PeerLinkStatus (Mac48Address peerAddress, bool status)
{
//pass information to HwmpState
- m_peerStatusCallback(peerAddress, status, CalculateMetric(peerAddress));
+ m_peerStatusCallback (peerAddress, status, CalculateMetric(peerAddress));
}
void
-MeshWifiMac::QueuePeerLinkFrame(MeshMgtPeerLinkManFrame peer_frame, Mac48Address peerAddress)
+MeshWifiMac::QueuePeerLinkFrame (MeshMgtPeerLinkManFrame peer_frame, Mac48Address peerAddress)
{
Ptr<Packet> packet = Create<Packet> ();
//Setting peer frame:
- peer_frame.SetSupportedRates(GetSupportedRates ());
- peer_frame.SetQosField(0);
- peer_frame.SetMeshId(GetSsid());
+ peer_frame.SetSupportedRates (GetSupportedRates ());
+ peer_frame.SetQosField (0);
+ peer_frame.SetMeshId (GetSsid());
packet->AddHeader (peer_frame);
//multihop header:
WifiMeshMultihopActionHeader multihopHdr;
- if (peer_frame.IsOpen())
+ if (peer_frame.IsOpen ())
{
WifiMeshMultihopActionHeader::ACTION_VALUE action;
action.peerLink = WifiMeshMultihopActionHeader::PEER_LINK_OPEN;
- multihopHdr.SetAction(WifiMeshMultihopActionHeader::MESH_PEER_LINK_MGT, action);
+ multihopHdr.SetAction (WifiMeshMultihopActionHeader::MESH_PEER_LINK_MGT, action);
}
- if (peer_frame.IsConfirm())
+ if (peer_frame.IsConfirm ())
{
WifiMeshMultihopActionHeader::ACTION_VALUE action;
action.peerLink = WifiMeshMultihopActionHeader::PEER_LINK_CONFIRM;
- multihopHdr.SetAction(WifiMeshMultihopActionHeader::MESH_PEER_LINK_MGT, action);
+ multihopHdr.SetAction (WifiMeshMultihopActionHeader::MESH_PEER_LINK_MGT, action);
}
- if (peer_frame.IsClose())
+ if (peer_frame.IsClose ())
{
WifiMeshMultihopActionHeader::ACTION_VALUE action;
action.peerLink = WifiMeshMultihopActionHeader::PEER_LINK_CLOSE;
- multihopHdr.SetAction(WifiMeshMultihopActionHeader::MESH_PEER_LINK_MGT, action);
+ multihopHdr.SetAction (WifiMeshMultihopActionHeader::MESH_PEER_LINK_MGT, action);
}
- packet->AddHeader(multihopHdr);
+ packet->AddHeader (multihopHdr);
//mesh header:
WifiMeshHeader meshHdr;
- meshHdr.SetMeshTtl(1);
- meshHdr.SetMeshSeqno(0);
- packet->AddHeader(meshHdr);
+ meshHdr.SetMeshTtl (1);
+ meshHdr.SetMeshSeqno (0);
+ packet->AddHeader (meshHdr);
//Wifi Mac header:
WifiMacHeader hdr;
- hdr.SetMultihopAction();
+ hdr.SetMultihopAction ();
hdr.SetAddr1 (peerAddress);
hdr.SetAddr2 (GetAddress ());
hdr.SetAddr3 (GetAddress ());
hdr.SetDsNotFrom ();
hdr.SetDsNotTo ();
//queue:
- m_VO->Queue(packet,hdr);
+ m_VO->Queue (packet,hdr);
}
void
-MeshWifiMac::SetSoftwareDelay(Time delay)
+MeshWifiMac::SetSoftwareDelay (Time delay)
{
m_softwareDelay = delay;
}
Time
-MeshWifiMac::GetSoftwareDelay()
+MeshWifiMac::GetSoftwareDelay ()
{
return m_softwareDelay;
}
void
-MeshWifiMac::SendPreq(const IeDot11sPreq& preq)
+MeshWifiMac::SendPreq (const IeDot11sPreq& preq)
{
//Add a PREQ
Ptr<Packet> packet = Create<Packet> ();
- packet->AddHeader(preq);
+ packet->AddHeader (preq);
//Add a Action values:
WifiMeshMultihopActionHeader multihopHdr;
WifiMeshMultihopActionHeader::ACTION_VALUE action;
action.pathSelection = WifiMeshMultihopActionHeader::PATH_REQUEST;
- multihopHdr.SetAction(WifiMeshMultihopActionHeader::MESH_PATH_SELECTION, action);
- packet->AddHeader(multihopHdr);
+ multihopHdr.SetAction (WifiMeshMultihopActionHeader::MESH_PATH_SELECTION, action);
+ packet->AddHeader (multihopHdr);
//Add a mesh Header
WifiMeshHeader meshHdr;
//TODO: normal seqno!
- meshHdr.SetMeshTtl(1);
- meshHdr.SetMeshSeqno(0);
- packet->AddHeader(meshHdr);
+ meshHdr.SetMeshTtl (1);
+ meshHdr.SetMeshSeqno (0);
+ packet->AddHeader (meshHdr);
//Add a wifi header:
WifiMacHeader hdr;
- hdr.SetMultihopAction();
+ hdr.SetMultihopAction ();
hdr.SetAddr1 (Mac48Address::GetBroadcast ());
hdr.SetAddr2 (GetAddress ());
- hdr.SetAddr3 (Mac48Address("00:00:00:00:00:00"));
+ hdr.SetAddr3 (Mac48Address ("00:00:00:00:00:00"));
hdr.SetDsNotFrom ();
hdr.SetDsNotTo ();
- Simulator::Schedule(CalcSwDelay() ,&MeshWifiMac::QueuePathSelectionFrame, this, packet, hdr);
- //m_VO->Queue(packet,hdr);
+ Simulator::Schedule (CalcSwDelay() ,&MeshWifiMac::QueuePathSelectionFrame, this, packet, hdr);
+ //m_VO->Queue (packet,hdr);
}
void
-MeshWifiMac::SendPrep(const IeDot11sPrep& prep, const Mac48Address& to)
+MeshWifiMac::SendPrep (const IeDot11sPrep& prep, const Mac48Address& to)
{
- if (!m_peerManager->IsActiveLink(GetAddress(), to))
+ if (!m_peerManager->IsActiveLink (GetAddress(), to))
return;
Ptr<Packet> packet = Create<Packet> ();
- packet->AddHeader(prep);
+ packet->AddHeader (prep);
//Add a Action values:
WifiMeshMultihopActionHeader multihopHdr;
WifiMeshMultihopActionHeader::ACTION_VALUE action;
action.pathSelection = WifiMeshMultihopActionHeader::PATH_REPLY;
- multihopHdr.SetAction(WifiMeshMultihopActionHeader::MESH_PATH_SELECTION, action);
- packet->AddHeader(multihopHdr);
+ multihopHdr.SetAction (WifiMeshMultihopActionHeader::MESH_PATH_SELECTION, action);
+ packet->AddHeader (multihopHdr);
//Add a mesh Header
WifiMeshHeader meshHdr;
//TODO: normal seqno!
- meshHdr.SetMeshTtl(1);
- meshHdr.SetMeshSeqno(0);
- packet->AddHeader(meshHdr);
+ meshHdr.SetMeshTtl (1);
+ meshHdr.SetMeshSeqno (0);
+ packet->AddHeader (meshHdr);
//Add a wifi header:
WifiMacHeader hdr;
- hdr.SetMultihopAction();
- hdr.SetDsNotTo();
- hdr.SetDsNotFrom();
- hdr.SetAddr1(to);
- hdr.SetAddr2(GetAddress());
- hdr.SetAddr3(Mac48Address("00:00:00:00:00:00"));
- //m_VO->Queue(packet,hdr);
- Simulator::Schedule(CalcSwDelay() ,&MeshWifiMac::QueuePathSelectionFrame, this, packet, hdr);
+ hdr.SetMultihopAction ();
+ hdr.SetDsNotTo ();
+ hdr.SetDsNotFrom ();
+ hdr.SetAddr1 (to);
+ hdr.SetAddr2 (GetAddress());
+ hdr.SetAddr3 (Mac48Address("00:00:00:00:00:00"));
+ //m_VO->Queue (packet,hdr);
+ Simulator::Schedule (CalcSwDelay() ,&MeshWifiMac::QueuePathSelectionFrame, this, packet, hdr);
}
void
-MeshWifiMac::SendPerr(const IeDot11sPerr& perr, std::vector<Mac48Address> receivers)
+MeshWifiMac::SendPerr (const IeDot11sPerr& perr, std::vector<Mac48Address> receivers)
{
- NS_ASSERT(receivers.size()!=0);
+ NS_ASSERT (receivers.size() != 0);
Ptr<Packet> packet = Create<Packet> ();
- packet->AddHeader(perr);
+ packet->AddHeader (perr);
//Add a Action values:
WifiMeshMultihopActionHeader multihopHdr;
WifiMeshMultihopActionHeader::ACTION_VALUE action;
action.pathSelection = WifiMeshMultihopActionHeader::PATH_ERROR;
- multihopHdr.SetAction(WifiMeshMultihopActionHeader::MESH_PATH_SELECTION, action);
- packet->AddHeader(multihopHdr);
+ multihopHdr.SetAction (WifiMeshMultihopActionHeader::MESH_PATH_SELECTION, action);
+ packet->AddHeader (multihopHdr);
//Add a mesh Header
WifiMeshHeader meshHdr;
//TODO: normal seqno!
- meshHdr.SetMeshTtl(1);
- meshHdr.SetMeshSeqno(0);
- packet->AddHeader(meshHdr);
+ meshHdr.SetMeshTtl (1);
+ meshHdr.SetMeshSeqno (0);
+ packet->AddHeader (meshHdr);
//Add a wifi header:
WifiMacHeader hdr;
- hdr.SetMultihopAction();
- hdr.SetDsNotTo();
- hdr.SetDsNotFrom();
- hdr.SetAddr2(GetAddress());
- hdr.SetAddr3(Mac48Address("00:00:00:00:00:00"));
- //m_VO->Queue(packet,hdr);
- for (unsigned int i = 0; i < receivers.size(); i ++)
+ hdr.SetMultihopAction ();
+ hdr.SetDsNotTo ();
+ hdr.SetDsNotFrom ();
+ hdr.SetAddr2 (GetAddress());
+ hdr.SetAddr3 (Mac48Address("00:00:00:00:00:00"));
+ //m_VO->Queue (packet,hdr);
+ for (unsigned int i = 0; i < receivers.size (); i ++)
{
- NS_LOG_DEBUG(GetAddress()<<" is sending PERR to "<<receivers[i]);
- hdr.SetAddr1(receivers[i]);
- Simulator::Schedule(CalcSwDelay() ,&MeshWifiMac::QueuePathSelectionFrame, this, packet, hdr);
+ NS_LOG_DEBUG (GetAddress()<<" is sending PERR to "<<receivers[i]);
+ hdr.SetAddr1 (receivers[i]);
+ Simulator::Schedule (CalcSwDelay() ,&MeshWifiMac::QueuePathSelectionFrame, this, packet, hdr);
}
}
void
-MeshWifiMac::QueuePathSelectionFrame(Ptr<Packet> packet, const WifiMacHeader hdr)
+MeshWifiMac::QueuePathSelectionFrame (Ptr<Packet> packet, const WifiMacHeader hdr)
{
- m_VO->Queue(packet, hdr);
+ m_VO->Queue (packet, hdr);
}
void
-MeshWifiMac::SetPreqReceivedCallback(
+MeshWifiMac::SetPreqReceivedCallback (
Callback<void, IeDot11sPreq&, const Mac48Address&, const uint32_t&> cb)
{
m_preqReceived = cb;
}
void
-MeshWifiMac::SetPrepReceivedCallback(
+MeshWifiMac::SetPrepReceivedCallback (
Callback<void, IeDot11sPrep&, const Mac48Address&, const uint32_t&> cb)
{
m_prepReceived = cb;
}
void
-MeshWifiMac::SetPerrReceivedCallback(
+MeshWifiMac::SetPerrReceivedCallback (
Callback<void, IeDot11sPerr&, const Mac48Address&> cb)
{
m_perrReceived = cb;
}
void
-MeshWifiMac::SetPeerStatusCallback(
+MeshWifiMac::SetPeerStatusCallback (
Callback<void, Mac48Address, bool, uint32_t> cb)
{
m_peerStatusCallback = cb;
}
uint32_t
-MeshWifiMac::CalculateMetric(Mac48Address peerAddress)
+MeshWifiMac::CalculateMetric (Mac48Address peerAddress)
{
//suppose Bt == 1000 bytes;
uint32_t testLength = 1000;
WifiRemoteStation *peerSta = m_stationManager->Lookup (peerAddress);
- WifiTxStatistics::RATE_LENGTH_STAT stats = peerSta->GetTxStat().statistics;
- Time overhead = m_sifs + MicroSeconds(32) + MicroSeconds(8);
- uint32_t metric = (uint32_t)((double)overhead.GetNanoSeconds()/102.4);
+ WifiTxStatistics::RATE_LENGTH_STAT stats = peerSta->GetTxStat ().statistics;
+ Time overhead = m_sifs + MicroSeconds (32) + MicroSeconds(8);
+ uint32_t metric = (uint32_t) ((double)overhead.GetNanoSeconds()/102.4);
uint32_t maxRate = 0;
uint32_t packet_sent = 0;
- for (WifiTxStatistics::RATE_LENGTH_STAT::iterator lengthPos = stats.begin(); lengthPos !=stats.end(); lengthPos++)
+ for (WifiTxStatistics::RATE_LENGTH_STAT::iterator lengthPos = stats.begin (); lengthPos != stats.end(); lengthPos++)
{
if (lengthPos->first > testLength)
continue;
for (
- WifiTxStatistics::RATE_STAT::iterator ratePos = lengthPos->second.begin();
- ratePos != lengthPos->second.end();
+ WifiTxStatistics::RATE_STAT::iterator ratePos = lengthPos->second.begin ();
+ ratePos != lengthPos->second.end ();
ratePos ++
)
{
#if 0
- NS_LOG_DEBUG("Rate is "<<ratePos->first
+ NS_LOG_DEBUG ("Rate is "<<ratePos->first
<<": SUCCESS = "<<ratePos->second.packetsAcked
<<", RRETRY = " <<ratePos->second.packetsRetried
<<", FAILURE = "<<ratePos->second.packetsFailed);
#endif
double coefficient =
- (double)(
+ (double) (
ratePos->second.packetsRetried
+ ratePos->second.packetsAcked
- )/((double)ratePos->second.packetsAcked);
+ )/ ((double)ratePos->second.packetsAcked);
uint16_t avgLength = 0;
if (ratePos->second.packetsAcked == 0)
avgLength = lengthPos->first;
else
avgLength = ratePos->second.bytesAcked/ratePos->second.packetsAcked;
- uint32_t payload = (uint32_t)((double)avgLength / ((double)ratePos->first)*1e9);
+ uint32_t payload = (uint32_t) ((double)avgLength / ((double)ratePos->first)*1e9);
if (packet_sent < ratePos->second.packetsAcked)
{
- metric = (uint32_t)(coefficient*((double)overhead.GetNanoSeconds() + (double)payload)/10240);
+ metric = (uint32_t) (coefficient*((double)overhead.GetNanoSeconds() + (double)payload)/10240);
packet_sent = ratePos->second.packetsAcked;
maxRate = ratePos->first;
}
}
}
- //NS_LOG_DEBUG("RATE is "<<maxRate<<" metric is "<<metric);
- //peerSta->ResetTxStat();
- NS_ASSERT(metric !=0);
+ //NS_LOG_DEBUG ("RATE is "<<maxRate<<" metric is "<<metric);
+ //peerSta->ResetTxStat ();
+ NS_ASSERT (metric != 0);
return metric;
}
--- a/src/devices/mesh/mesh-wifi-mac.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/mesh-wifi-mac.h Wed Mar 18 22:36:12 2009 +0300
@@ -106,11 +106,11 @@
* to be independent from traffic intensity.
*
*/
- void SetSoftwareDelay(Time delay);
+ void SetSoftwareDelay (Time delay);
/**
* \returns software delay parameter
*/
- Time GetSoftwareDelay();
+ Time GetSoftwareDelay ();
/**
* \param manager is pointer to the
* WifiPeerManager class, which implements
@@ -124,8 +124,8 @@
* This funcion sets all needed callbacks to
* a given peer manager
*/
- void SetPeerLinkManager(Ptr<WifiPeerManager> manager);
- void SetPreqReceivedCallback(
+ void SetPeerLinkManager (Ptr<WifiPeerManager> manager);
+ void SetPreqReceivedCallback (
Callback<void, IeDot11sPreq&, const Mac48Address&, const uint32_t&> cb);
/**
* \brief this callback is set by Hwmp routing
@@ -134,7 +134,7 @@
* \param cb is a callback to be executed when
* receiving PREP.
*/
- void SetPrepReceivedCallback(
+ void SetPrepReceivedCallback (
Callback<void, IeDot11sPrep&, const Mac48Address&, const uint32_t&> cb);
/**
* \brief this callback is set by Hwmp routing
@@ -143,7 +143,7 @@
* \param cb is a callback to be executed when
* receiving PERR.
*/
- void SetPerrReceivedCallback(
+ void SetPerrReceivedCallback (
Callback<void, IeDot11sPerr&, const Mac48Address&> cb);
/**
@@ -153,7 +153,7 @@
* \param cb is a callback to be executed when
* peer failure has ben detected
*/
- void SetPeerStatusCallback(
+ void SetPeerStatusCallback (
Callback<void, Mac48Address, bool, uint32_t> cb);
/**
* \brief Sends a PREQ frame.
@@ -163,7 +163,7 @@
* \attention This method is public, because
* HWMP makes a callback using this method
*/
- void SendPreq(const IeDot11sPreq& preq);
+ void SendPreq (const IeDot11sPreq& preq);
/**
* \brief Sends a PREP frame.
* \param prep is prep information element
@@ -175,7 +175,7 @@
* HWMP makes a callback using this method
*/
- void SendPrep(const IeDot11sPrep& prep, const Mac48Address& to);
+ void SendPrep (const IeDot11sPrep& prep, const Mac48Address& to);
/**
* \brief Sends a PERR frame.
* \param perr is perr information element
@@ -186,7 +186,7 @@
* \attention This method is public, because
* HWMP makes a callback using this method
*/
- void SendPerr(const IeDot11sPerr& perr, std::vector<Mac48Address> receivers);
+ void SendPerr (const IeDot11sPerr& perr, std::vector<Mac48Address> receivers);
/**
* \brief Sends PeerLinkOpen frame to a given
* address. Mac only forms a proper
@@ -196,7 +196,7 @@
* \param peerAddress is the address of
* destination of given frame
*/
- void SendPeerLinkOpen(
+ void SendPeerLinkOpen (
IeDot11sPeerManagement peer_element,
Mac48Address peerAddress
);
@@ -211,7 +211,7 @@
* \param aid is the assocciation ID stored in
* peer manager
*/
- void SendPeerLinkConfirm(
+ void SendPeerLinkConfirm (
IeDot11sPeerManagement peer_element,
Mac48Address peerAddress,
uint16_t aid
@@ -225,7 +225,7 @@
* \param peerAddress is the address of
* destination of given frame
*/
- void SendPeerLinkClose(
+ void SendPeerLinkClose (
IeDot11sPeerManagement peer_element,
Mac48Address peerAddress
);
@@ -237,7 +237,7 @@
* \param peerAddress is the address of
* destination of given frame
*/
- void PeerLinkStatus(Mac48Address peerAddress, bool status);
+ void PeerLinkStatus (Mac48Address peerAddress, bool status);
/**
* \brief Peer Manager notifyes MAC about new
@@ -250,14 +250,14 @@
* \param status If true - new peer link, perr
* link failure otherwise
*/
- void PeerEvent(
+ void PeerEvent (
Mac48Address peerAddress,
bool status
);
private:
void Receive (Ptr<Packet> packet, WifiMacHeader const *hdr);
void ForwardUp (Ptr<Packet> packet, Mac48Address src, Mac48Address dst);
- void ForwardDown(
+ void ForwardDown (
Ptr<const Packet> packet,
Mac48Address from,
Mac48Address to
@@ -288,7 +288,7 @@
* \param peerAddress the address of
* destination.
*/
- void QueuePeerLinkFrame(MeshMgtPeerLinkManFrame peer_frame, Mac48Address peerAddress);
+ void QueuePeerLinkFrame (MeshMgtPeerLinkManFrame peer_frame, Mac48Address peerAddress);
/**
* \brief Executed after software delay by
* SendPreq/Prep/Perr frames and
@@ -296,7 +296,7 @@
* \param packet is packet body,
* \param hdr is WifiMacHeader
*/
- void QueuePathSelectionFrame(Ptr<Packet> packet, const WifiMacHeader hdr);
+ void QueuePathSelectionFrame (Ptr<Packet> packet, const WifiMacHeader hdr);
void SetBeaconGeneration (bool enable);
bool GetBeaconGeneration () const;
SupportedRates GetSupportedRates () const;
@@ -345,7 +345,7 @@
* m_softwareDealy (initiated by
* SetSoftwareDelay method).
*/
- Time CalcSwDelay();
+ Time CalcSwDelay ();
/**
* \brief keeps delay for sending first
* beacon. this delay is uniformely
@@ -363,7 +363,7 @@
/**
* \brief metric calculation parameters
*/
- uint32_t CalculateMetric(Mac48Address peerAddress);
+ uint32_t CalculateMetric (Mac48Address peerAddress);
std::map<Mac48Address, uint32_t>
m_metricDatabase;
};
--- a/src/devices/mesh/mesh-wifi-peer-manager.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/mesh-wifi-peer-manager.cc Wed Mar 18 22:36:12 2009 +0300
@@ -31,143 +31,143 @@
/***************************************************
* PeerLinkDescriptor
***************************************************/
-WifiPeerLinkDescriptor::WifiPeerLinkDescriptor():
- m_localLinkId(0),
- m_peerLinkId(0),
- m_state(IDLE),
- m_retryCounter(0),
- m_maxBeaconLoss(3)
+WifiPeerLinkDescriptor::WifiPeerLinkDescriptor ():
+ m_localLinkId (0),
+ m_peerLinkId (0),
+ m_state (IDLE),
+ m_retryCounter (0),
+ m_maxBeaconLoss (3)
{}
void
-WifiPeerLinkDescriptor::SetPeerAddress(Mac48Address macaddr)
+WifiPeerLinkDescriptor::SetPeerAddress (Mac48Address macaddr)
{
m_peerAddress = macaddr;
}
void
-WifiPeerLinkDescriptor::SetLocalAddress(Mac48Address macaddr)
+WifiPeerLinkDescriptor::SetLocalAddress (Mac48Address macaddr)
{
m_localAddress = macaddr;
}
void
-WifiPeerLinkDescriptor::SetLocalLinkId(uint16_t id)
+WifiPeerLinkDescriptor::SetLocalLinkId (uint16_t id)
{
m_localLinkId = id;
}
void
-WifiPeerLinkDescriptor::SetLocalAid(uint16_t aid)
+WifiPeerLinkDescriptor::SetLocalAid (uint16_t aid)
{
m_assocId = aid;
}
void
-WifiPeerLinkDescriptor::SetBeaconInformation(Time lastBeacon, Time beaconInterval)
+WifiPeerLinkDescriptor::SetBeaconInformation (Time lastBeacon, Time beaconInterval)
{
m_lastBeacon = lastBeacon;
m_beaconInterval = beaconInterval;
- m_beaconLossTimer.Cancel();
- Time delay = Seconds(beaconInterval.GetSeconds()*m_maxBeaconLoss);
- NS_ASSERT(delay.GetMicroSeconds()!= 0);
- m_beaconLossTimer = Simulator::Schedule(delay, &WifiPeerLinkDescriptor::BeaconLoss, this);
+ m_beaconLossTimer.Cancel ();
+ Time delay = Seconds (beaconInterval.GetSeconds()*m_maxBeaconLoss);
+ NS_ASSERT (delay.GetMicroSeconds() != 0);
+ m_beaconLossTimer = Simulator::Schedule (delay, &WifiPeerLinkDescriptor::BeaconLoss, this);
}
void
-WifiPeerLinkDescriptor::SetMaxBeaconLoss(uint8_t maxBeaconLoss)
+WifiPeerLinkDescriptor::SetMaxBeaconLoss (uint8_t maxBeaconLoss)
{
m_maxBeaconLoss = maxBeaconLoss;
}
void
-WifiPeerLinkDescriptor::SetLinkStatusCallback(Callback<void, Mac48Address, Mac48Address, bool> cb)
+WifiPeerLinkDescriptor::SetLinkStatusCallback (Callback<void, Mac48Address, Mac48Address, bool> cb)
{
m_linkStatusCallback = cb;
}
void
-WifiPeerLinkDescriptor::BeaconLoss()
+WifiPeerLinkDescriptor::BeaconLoss ()
{
- StateMachine(CNCL);
+ StateMachine (CNCL);
}
void
-WifiPeerLinkDescriptor::SetBeaconTimingElement(IeDot11sBeaconTiming beaconTiming)
+WifiPeerLinkDescriptor::SetBeaconTimingElement (IeDot11sBeaconTiming beaconTiming)
{
m_beaconTiming = beaconTiming;
}
Mac48Address
-WifiPeerLinkDescriptor::GetPeerAddress() const
- {
- return m_peerAddress;
- }
+WifiPeerLinkDescriptor::GetPeerAddress () const
+{
+ return m_peerAddress;
+}
Mac48Address
-WifiPeerLinkDescriptor::GetLocalAddress() const
- {
- return m_localAddress;
- }
+WifiPeerLinkDescriptor::GetLocalAddress () const
+{
+ return m_localAddress;
+}
uint16_t
-WifiPeerLinkDescriptor::GetLocalAid()const
- {
- return m_assocId;
- }
+WifiPeerLinkDescriptor::GetLocalAid () const
+{
+ return m_assocId;
+}
Time
-WifiPeerLinkDescriptor::GetLastBeacon() const
- {
- return m_lastBeacon;
- }
+WifiPeerLinkDescriptor::GetLastBeacon () const
+{
+ return m_lastBeacon;
+}
Time
-WifiPeerLinkDescriptor::GetBeaconInterval() const
- {
- return m_beaconInterval;
- }
+WifiPeerLinkDescriptor::GetBeaconInterval () const
+{
+ return m_beaconInterval;
+}
IeDot11sBeaconTiming
-WifiPeerLinkDescriptor::GetBeaconTimingElement() const
- {
- return m_beaconTiming;
- }
+WifiPeerLinkDescriptor::GetBeaconTimingElement () const
+{
+ return m_beaconTiming;
+}
void
-WifiPeerLinkDescriptor::ClearTimingElement()
+WifiPeerLinkDescriptor::ClearTimingElement ()
{
- m_beaconTiming.ClearTimingElement();
+ m_beaconTiming.ClearTimingElement ();
}
-void WifiPeerLinkDescriptor::MLMECancelPeerLink(dot11sReasonCode reason)
+void WifiPeerLinkDescriptor::MLMECancelPeerLink (dot11sReasonCode reason)
{
- StateMachine(CNCL,reason);
+ StateMachine (CNCL,reason);
}
-void WifiPeerLinkDescriptor::MLMEPassivePeerLinkOpen()
+void WifiPeerLinkDescriptor::MLMEPassivePeerLinkOpen ()
{
- StateMachine(PASOPN);
+ StateMachine (PASOPN);
}
-void WifiPeerLinkDescriptor::MLMEActivePeerLinkOpen()
+void WifiPeerLinkDescriptor::MLMEActivePeerLinkOpen ()
{
- StateMachine(ACTOPN);
+ StateMachine (ACTOPN);
}
-void WifiPeerLinkDescriptor::MLMEPeeringRequestReject()
+void WifiPeerLinkDescriptor::MLMEPeeringRequestReject ()
{
- StateMachine(REQ_RJCT, REASON11S_PEER_LINK_CANCELLED);
+ StateMachine (REQ_RJCT, REASON11S_PEER_LINK_CANCELLED);
}
#if 0
-void WifiPeerLinkDescriptor::MLMEBindSecurityAssociation()
+void WifiPeerLinkDescriptor::MLMEBindSecurityAssociation ()
{
- StateMachine(BNDSA);
+ StateMachine (BNDSA);
}
#endif
void
-WifiPeerLinkDescriptor::SetMac(Ptr<MeshWifiMac> mac)
+WifiPeerLinkDescriptor::SetMac (Ptr<MeshWifiMac> mac)
{
m_mac = mac;
}
-void WifiPeerLinkDescriptor::PeerLinkClose(uint16_t localLinkId,uint16_t peerLinkId, dot11sReasonCode reason)
+void WifiPeerLinkDescriptor::PeerLinkClose (uint16_t localLinkId,uint16_t peerLinkId, dot11sReasonCode reason)
{
if (peerLinkId != 0 && m_localLinkId != peerLinkId)
return;
@@ -175,27 +175,27 @@
m_peerLinkId = localLinkId;
else if (m_peerLinkId != localLinkId)
return;
- StateMachine(CLS_ACPT, reason);
+ StateMachine (CLS_ACPT, reason);
}
-void WifiPeerLinkDescriptor::PeerLinkOpenAccept(uint16_t localLinkId, IeDot11sConfiguration conf)
+void WifiPeerLinkDescriptor::PeerLinkOpenAccept (uint16_t localLinkId, IeDot11sConfiguration conf)
{
if (m_peerLinkId == 0)
m_peerLinkId = localLinkId;
m_configuration = conf;
- StateMachine(OPN_ACPT);
+ StateMachine (OPN_ACPT);
}
-void WifiPeerLinkDescriptor::PeerLinkOpenReject(uint16_t localLinkId, IeDot11sConfiguration conf,dot11sReasonCode reason)
+void WifiPeerLinkDescriptor::PeerLinkOpenReject (uint16_t localLinkId, IeDot11sConfiguration conf,dot11sReasonCode reason)
{
if ( m_peerLinkId == 0)
m_peerLinkId = localLinkId;
m_configuration = conf;
- StateMachine(OPN_RJCT, reason);
+ StateMachine (OPN_RJCT, reason);
}
void
-WifiPeerLinkDescriptor::PeerLinkConfirmAccept(uint16_t localLinkId,uint16_t peerLinkId, uint16_t peerAid, IeDot11sConfiguration conf)
+WifiPeerLinkDescriptor::PeerLinkConfirmAccept (uint16_t localLinkId,uint16_t peerLinkId, uint16_t peerAid, IeDot11sConfiguration conf)
{
if ( m_localLinkId != peerLinkId)
return;
@@ -205,10 +205,10 @@
return;
m_configuration = conf;
m_peerAssocId = peerAid;
- StateMachine(CNF_ACPT);
+ StateMachine (CNF_ACPT);
}
-void WifiPeerLinkDescriptor:: PeerLinkConfirmReject(uint16_t localLinkId, uint16_t peerLinkId,
+void WifiPeerLinkDescriptor:: PeerLinkConfirmReject (uint16_t localLinkId, uint16_t peerLinkId,
IeDot11sConfiguration conf,dot11sReasonCode reason)
{
if (m_localLinkId != peerLinkId)
@@ -218,27 +218,27 @@
else if (m_peerLinkId != localLinkId)
return;
m_configuration = conf;
- StateMachine(CNF_RJCT, reason);
+ StateMachine (CNF_RJCT, reason);
}
bool
-WifiPeerLinkDescriptor::LinkIsEstab() const
- {
- if (m_state == ESTAB)
- return true;
- return false;
- }
+WifiPeerLinkDescriptor::LinkIsEstab () const
+{
+ if (m_state == ESTAB)
+ return true;
+ return false;
+}
bool
-WifiPeerLinkDescriptor::LinkIsIdle() const
- {
- if (m_state == IDLE)
- return true;
- return false;
- }
+WifiPeerLinkDescriptor::LinkIsIdle () const
+{
+ if (m_state == IDLE)
+ return true;
+ return false;
+}
void
-WifiPeerLinkDescriptor::StateMachine(PeerEvent event,dot11sReasonCode reasoncode)
+WifiPeerLinkDescriptor::StateMachine (PeerEvent event,dot11sReasonCode reasoncode)
{
switch (m_state)
{
@@ -250,8 +250,8 @@
break;
case ACTOPN:
m_state = OPN_SNT;
- SendPeerLinkOpen();
- SetRetryTimer();
+ SendPeerLinkOpen ();
+ SetRetryTimer ();
break;
default:
{}
@@ -262,22 +262,22 @@
{
case CNCL:
case CLS_ACPT:
- m_state=IDLE;
+ m_state = IDLE;
// TODO Callback MLME-SignalPeerLinkStatus
break;
case REQ_RJCT:
- SendPeerLinkClose(reasoncode);
+ SendPeerLinkClose (reasoncode);
break;
case ACTOPN:
- m_state=OPN_SNT;
- SendPeerLinkOpen();
- SetRetryTimer();
+ m_state = OPN_SNT;
+ SendPeerLinkOpen ();
+ SetRetryTimer ();
break;
case OPN_ACPT:
m_state = OPN_RCVD;
- SendPeerLinkConfirm();
- SendPeerLinkOpen();
- SetRetryTimer();
+ SendPeerLinkConfirm ();
+ SendPeerLinkOpen ();
+ SetRetryTimer ();
break;
default:
{}
@@ -287,43 +287,43 @@
switch (event)
{
case TOR1:
- SendPeerLinkOpen();
+ SendPeerLinkOpen ();
m_retryCounter++;
- SetRetryTimer();
+ SetRetryTimer ();
break;
case CNF_ACPT:
m_state = CNF_RCVD;
- ClearRetryTimer();
- SetConfirmTimer();
+ ClearRetryTimer ();
+ SetConfirmTimer ();
break;
case OPN_ACPT:
m_state = OPN_RCVD;
- SendPeerLinkConfirm();
+ SendPeerLinkConfirm ();
break;
case CLS_ACPT:
m_state = HOLDING;
- ClearRetryTimer();
- SendPeerLinkClose(REASON11S_MESH_CLOSE_RCVD);
- SetHoldingTimer();
+ ClearRetryTimer ();
+ SendPeerLinkClose (REASON11S_MESH_CLOSE_RCVD);
+ SetHoldingTimer ();
break;
case OPN_RJCT:
case CNF_RJCT:
m_state = HOLDING;
- ClearRetryTimer();
- SendPeerLinkClose(reasoncode);
- SetHoldingTimer();
+ ClearRetryTimer ();
+ SendPeerLinkClose (reasoncode);
+ SetHoldingTimer ();
break;
case TOR2:
m_state = HOLDING;
- ClearRetryTimer();
- SendPeerLinkClose(REASON11S_MESH_MAX_RETRIES);
- SetHoldingTimer();
+ ClearRetryTimer ();
+ SendPeerLinkClose (REASON11S_MESH_MAX_RETRIES);
+ SetHoldingTimer ();
break;
case CNCL:
m_state = HOLDING;
- ClearRetryTimer();
- SendPeerLinkClose(REASON11S_PEER_LINK_CANCELLED);
- SetHoldingTimer();
+ ClearRetryTimer ();
+ SendPeerLinkClose (REASON11S_PEER_LINK_CANCELLED);
+ SetHoldingTimer ();
break;
default:
{}
@@ -336,35 +336,35 @@
break;
case OPN_ACPT:
m_state = ESTAB;
- NS_LOG_DEBUG("I am "<<m_localAddress<<", established link with "<<m_peerAddress<<", at "<<Simulator::Now());
- ClearConfirmTimer();
- SendPeerLinkConfirm();
- m_linkStatusCallback(m_localAddress, m_peerAddress, true);
+ NS_LOG_DEBUG ("I am "<<m_localAddress<<", established link with "<<m_peerAddress<<", at "<<Simulator::Now());
+ ClearConfirmTimer ();
+ SendPeerLinkConfirm ();
+ m_linkStatusCallback (m_localAddress, m_peerAddress, true);
// TODO Callback MLME-SignalPeerLinkStatus
break;
case CLS_ACPT:
m_state = HOLDING;
- ClearConfirmTimer();
- SendPeerLinkClose(REASON11S_MESH_CLOSE_RCVD);
- SetHoldingTimer();
+ ClearConfirmTimer ();
+ SendPeerLinkClose (REASON11S_MESH_CLOSE_RCVD);
+ SetHoldingTimer ();
break;
case CNF_RJCT:
case OPN_RJCT:
m_state = HOLDING;
- ClearConfirmTimer();
- SendPeerLinkClose(reasoncode);
- SetHoldingTimer();
+ ClearConfirmTimer ();
+ SendPeerLinkClose (reasoncode);
+ SetHoldingTimer ();
break;
case CNCL:
m_state = HOLDING;
- ClearConfirmTimer();
- SendPeerLinkClose(REASON11S_PEER_LINK_CANCELLED);
- SetHoldingTimer();
+ ClearConfirmTimer ();
+ SendPeerLinkClose (REASON11S_PEER_LINK_CANCELLED);
+ SetHoldingTimer ();
break;
case TOC:
m_state = HOLDING;
- SendPeerLinkClose(REASON11S_MESH_CONFIRM_TIMEOUT);
- SetHoldingTimer();
+ SendPeerLinkClose (REASON11S_MESH_CONFIRM_TIMEOUT);
+ SetHoldingTimer ();
break;
default:
{}
@@ -374,41 +374,41 @@
switch (event)
{
case TOR1:
- SendPeerLinkOpen();
+ SendPeerLinkOpen ();
m_retryCounter++;
- SetRetryTimer();
+ SetRetryTimer ();
break;
case CNF_ACPT:
- NS_LOG_DEBUG("I am "<<m_localAddress<<", established link with "<<m_peerAddress<<", at "<<Simulator::Now());
+ NS_LOG_DEBUG ("I am "<<m_localAddress<<", established link with "<<m_peerAddress<<", at "<<Simulator::Now());
m_state = ESTAB;
- ClearRetryTimer();
- m_linkStatusCallback(m_localAddress, m_peerAddress, true);
+ ClearRetryTimer ();
+ m_linkStatusCallback (m_localAddress, m_peerAddress, true);
// TODO Callback MLME-SignalPeerLinkStatus
break;
case CLS_ACPT:
m_state = HOLDING;
- ClearRetryTimer();
- SendPeerLinkClose(REASON11S_MESH_CLOSE_RCVD);
- SetHoldingTimer();
+ ClearRetryTimer ();
+ SendPeerLinkClose (REASON11S_MESH_CLOSE_RCVD);
+ SetHoldingTimer ();
break;
case OPN_RJCT:
case CNF_RJCT:
m_state = HOLDING;
- ClearRetryTimer();
- SendPeerLinkClose(reasoncode);
- SetHoldingTimer();
+ ClearRetryTimer ();
+ SendPeerLinkClose (reasoncode);
+ SetHoldingTimer ();
break;
case TOR2:
m_state = HOLDING;
- ClearRetryTimer();
- SendPeerLinkClose(REASON11S_MESH_MAX_RETRIES);
- SetHoldingTimer();
+ ClearRetryTimer ();
+ SendPeerLinkClose (REASON11S_MESH_MAX_RETRIES);
+ SetHoldingTimer ();
break;
case CNCL:
m_state = HOLDING;
- ClearRetryTimer();
- SendPeerLinkClose(REASON11S_PEER_LINK_CANCELLED);
- SetHoldingTimer();
+ ClearRetryTimer ();
+ SendPeerLinkClose (REASON11S_PEER_LINK_CANCELLED);
+ SetHoldingTimer ();
break;
default:
{}
@@ -425,30 +425,30 @@
break;
#endif
case OPN_ACPT:
- SendPeerLinkConfirm();
+ SendPeerLinkConfirm ();
break;
case CLS_ACPT:
- NS_LOG_DEBUG("I am "<<m_localAddress<<", CLOSED link with "<<m_peerAddress<<", at "<<Simulator::Now()<<" Close received");
+ NS_LOG_DEBUG ("I am "<<m_localAddress<<", CLOSED link with "<<m_peerAddress<<", at "<<Simulator::Now()<<" Close received");
m_state = HOLDING;
- SendPeerLinkClose(REASON11S_MESH_CLOSE_RCVD);
- SetHoldingTimer();
- m_linkStatusCallback(m_localAddress, m_peerAddress, false);
+ SendPeerLinkClose (REASON11S_MESH_CLOSE_RCVD);
+ SetHoldingTimer ();
+ m_linkStatusCallback (m_localAddress, m_peerAddress, false);
break;
case OPN_RJCT:
case CNF_RJCT:
- NS_LOG_DEBUG("I am "<<m_localAddress<<", CLOSED link with "<<m_peerAddress<<", at "<<Simulator::Now()<<" Rejected open or confirm");
+ NS_LOG_DEBUG ("I am "<<m_localAddress<<", CLOSED link with "<<m_peerAddress<<", at "<<Simulator::Now()<<" Rejected open or confirm");
m_state = HOLDING;
- ClearRetryTimer();
- SendPeerLinkClose(reasoncode);
- SetHoldingTimer();
- m_linkStatusCallback(m_localAddress, m_peerAddress, false);
+ ClearRetryTimer ();
+ SendPeerLinkClose (reasoncode);
+ SetHoldingTimer ();
+ m_linkStatusCallback (m_localAddress, m_peerAddress, false);
break;
case CNCL:
- NS_LOG_DEBUG("I am "<<m_localAddress<<", CLOSED link with "<<m_peerAddress<<", at "<<Simulator::Now()<<" Link cancelled");
+ NS_LOG_DEBUG ("I am "<<m_localAddress<<", CLOSED link with "<<m_peerAddress<<", at "<<Simulator::Now()<<" Link cancelled");
m_state = HOLDING;
- SendPeerLinkClose(REASON11S_PEER_LINK_CANCELLED);
- SetHoldingTimer();
- m_linkStatusCallback(m_localAddress, m_peerAddress, false);
+ SendPeerLinkClose (REASON11S_PEER_LINK_CANCELLED);
+ SetHoldingTimer ();
+ m_linkStatusCallback (m_localAddress, m_peerAddress, false);
break;
default:
{}
@@ -458,7 +458,7 @@
switch (event)
{
case CLS_ACPT:
- ClearHoldingTimer();
+ ClearHoldingTimer ();
case TOH:
m_state = IDLE;
// TODO Callback MLME-SignalPeerLinkStatus
@@ -467,12 +467,12 @@
case CNF_ACPT:
m_state = HOLDING;
// reason not spec in D2.0
- SendPeerLinkClose(REASON11S_PEER_LINK_CANCELLED);
+ SendPeerLinkClose (REASON11S_PEER_LINK_CANCELLED);
break;
case OPN_RJCT:
case CNF_RJCT:
m_state = HOLDING;
- SendPeerLinkClose(reasoncode);
+ SendPeerLinkClose (reasoncode);
break;
default:
{}
@@ -481,74 +481,74 @@
}
}
-void WifiPeerLinkDescriptor::ClearRetryTimer()
+void WifiPeerLinkDescriptor::ClearRetryTimer ()
{
- m_retryTimer.Cancel();
+ m_retryTimer.Cancel ();
}
-void WifiPeerLinkDescriptor::ClearConfirmTimer()
+void WifiPeerLinkDescriptor::ClearConfirmTimer ()
{
- m_confirmTimer.Cancel();
+ m_confirmTimer.Cancel ();
}
-void WifiPeerLinkDescriptor::ClearHoldingTimer()
+void WifiPeerLinkDescriptor::ClearHoldingTimer ()
{
- m_holdingTimer.Cancel();
+ m_holdingTimer.Cancel ();
}
-void WifiPeerLinkDescriptor::SendPeerLinkClose(dot11sReasonCode reasoncode)
+void WifiPeerLinkDescriptor::SendPeerLinkClose (dot11sReasonCode reasoncode)
{
IeDot11sPeerManagement peerElement;
- peerElement.SetPeerClose(m_localLinkId, m_peerLinkId, reasoncode);
- m_mac->SendPeerLinkClose(peerElement,m_peerAddress);
+ peerElement.SetPeerClose (m_localLinkId, m_peerLinkId, reasoncode);
+ m_mac->SendPeerLinkClose (peerElement,m_peerAddress);
}
-void WifiPeerLinkDescriptor::SendPeerLinkOpen()
+void WifiPeerLinkDescriptor::SendPeerLinkOpen ()
{
IeDot11sPeerManagement peerElement;
- peerElement.SetPeerOpen(m_localLinkId);
- NS_ASSERT(m_mac != NULL);
- m_mac->SendPeerLinkOpen(peerElement, m_peerAddress);
+ peerElement.SetPeerOpen (m_localLinkId);
+ NS_ASSERT (m_mac != NULL);
+ m_mac->SendPeerLinkOpen (peerElement, m_peerAddress);
}
-void WifiPeerLinkDescriptor::SendPeerLinkConfirm()
+void WifiPeerLinkDescriptor::SendPeerLinkConfirm ()
{
IeDot11sPeerManagement peerElement;
- peerElement.SetPeerConfirm(m_localLinkId, m_peerLinkId);
- m_mac->SendPeerLinkConfirm(peerElement, m_peerAddress, m_assocId);
+ peerElement.SetPeerConfirm (m_localLinkId, m_peerLinkId);
+ m_mac->SendPeerLinkConfirm (peerElement, m_peerAddress, m_assocId);
}
-void WifiPeerLinkDescriptor::SetHoldingTimer()
+void WifiPeerLinkDescriptor::SetHoldingTimer ()
{
- m_holdingTimer = Simulator::Schedule(dot11sParameters::dot11MeshHoldingTimeout, &WifiPeerLinkDescriptor::HoldingTimeout, this);
+ m_holdingTimer = Simulator::Schedule (dot11sParameters::dot11MeshHoldingTimeout, &WifiPeerLinkDescriptor::HoldingTimeout, this);
}
-void WifiPeerLinkDescriptor::HoldingTimeout()
+void WifiPeerLinkDescriptor::HoldingTimeout ()
{
- StateMachine(TOH);
+ StateMachine (TOH);
}
-void WifiPeerLinkDescriptor::SetRetryTimer()
+void WifiPeerLinkDescriptor::SetRetryTimer ()
{
- m_retryTimer = Simulator::Schedule(dot11sParameters::dot11MeshRetryTimeout, &WifiPeerLinkDescriptor::RetryTimeout, this);
+ m_retryTimer = Simulator::Schedule (dot11sParameters::dot11MeshRetryTimeout, &WifiPeerLinkDescriptor::RetryTimeout, this);
}
-void WifiPeerLinkDescriptor::RetryTimeout()
+void WifiPeerLinkDescriptor::RetryTimeout ()
{
if ( m_retryCounter < dot11sParameters::dot11MeshMaxRetries)
- StateMachine(TOR1);
+ StateMachine (TOR1);
else
- StateMachine(TOR2);
+ StateMachine (TOR2);
}
-void WifiPeerLinkDescriptor::SetConfirmTimer()
+void WifiPeerLinkDescriptor::SetConfirmTimer ()
{
- m_confirmTimer = Simulator::Schedule(dot11sParameters::dot11MeshConfirmTimeout, &WifiPeerLinkDescriptor::ConfirmTimeout, this);
+ m_confirmTimer = Simulator::Schedule (dot11sParameters::dot11MeshConfirmTimeout, &WifiPeerLinkDescriptor::ConfirmTimeout, this);
}
-void WifiPeerLinkDescriptor::ConfirmTimeout()
+void WifiPeerLinkDescriptor::ConfirmTimeout ()
{
- StateMachine(TOC);
+ StateMachine (TOC);
}
@@ -586,7 +586,7 @@
return tid;
}
-WifiPeerManager::WifiPeerManager()
+WifiPeerManager::WifiPeerManager ()
{
m_assocId = 0;
m_numberOfActivePeers = 0;
@@ -594,44 +594,44 @@
m_localLinkId = 1;
m_cleanupEvent = Simulator::Schedule (m_peerLinkCleanupPeriod, &WifiPeerManager::PeerCleanup, this);
}
-WifiPeerManager::~WifiPeerManager()
+WifiPeerManager::~WifiPeerManager ()
{
- m_cleanupEvent.Cancel();
+ m_cleanupEvent.Cancel ();
//TODO: delete a list of descriptors
for (
- PeerDescriptorsMap::iterator j = m_peerDescriptors.begin();
- j != m_peerDescriptors.end();
+ PeerDescriptorsMap::iterator j = m_peerDescriptors.begin ();
+ j != m_peerDescriptors.end ();
j++)
{
int to_delete = 0;
- for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = j->second.begin(); i!= j->second.end(); i++)
+ for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = j->second.begin (); i != j->second.end(); i++)
{
to_delete ++;
- (*i)->ClearTimingElement();
+ (*i)->ClearTimingElement ();
(*i) = 0;
}
for (int i = 0; i < to_delete; i ++)
- j->second.pop_back();
- j->second.clear();
+ j->second.pop_back ();
+ j->second.clear ();
}
- m_peerDescriptors.clear();
+ m_peerDescriptors.clear ();
}
void
-WifiPeerManager::SetSentBeaconTimers(
+WifiPeerManager::SetSentBeaconTimers (
Mac48Address portAddress,
Time ReferenceTbtt,
Time BeaconInterval
)
{
- BeaconInfoMap::iterator myBeacon = m_myBeaconInfo.find(portAddress);
- NS_ASSERT(myBeacon != m_myBeaconInfo.end());
+ BeaconInfoMap::iterator myBeacon = m_myBeaconInfo.find (portAddress);
+ NS_ASSERT (myBeacon != m_myBeaconInfo.end());
myBeacon->second.referenceTbtt = ReferenceTbtt;
myBeacon->second.beaconInterval = BeaconInterval;
}
void
-WifiPeerManager::SetReceivedBeaconTimers(
+WifiPeerManager::SetReceivedBeaconTimers (
Mac48Address portAddress,
Mac48Address peerAddress,
Time lastBeacon,
@@ -639,59 +639,59 @@
IeDot11sBeaconTiming beaconTiming
)
{
- PeerDescriptorsMap::iterator port = m_peerDescriptors.find(portAddress);
- NS_ASSERT(port!=m_peerDescriptors.end());
- for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin(); i!= port->second.end(); i++)
+ PeerDescriptorsMap::iterator port = m_peerDescriptors.find (portAddress);
+ NS_ASSERT (port != m_peerDescriptors.end());
+ for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin (); i != port->second.end(); i++)
{
- if ((*i)->GetPeerAddress() == peerAddress)
+ if ((*i)->GetPeerAddress () == peerAddress)
{
- (*i)->SetBeaconTimingElement(beaconTiming);
- (*i)->SetBeaconInformation(lastBeacon, beaconInterval);
+ (*i)->SetBeaconTimingElement (beaconTiming);
+ (*i)->SetBeaconInformation (lastBeacon, beaconInterval);
return;
}
}
Ptr<WifiPeerLinkDescriptor> new_descriptor =
- AddDescriptor(portAddress, peerAddress, Simulator::Now(), beaconInterval);
- new_descriptor->SetBeaconTimingElement(beaconTiming);
+ AddDescriptor (portAddress, peerAddress, Simulator::Now(), beaconInterval);
+ new_descriptor->SetBeaconTimingElement (beaconTiming);
}
bool
-WifiPeerManager::AttachPorts(std::vector<Ptr<WifiNetDevice> > ports)
+WifiPeerManager::AttachPorts (std::vector<Ptr<WifiNetDevice> > ports)
{
- NS_ASSERT(ports.size()!=0);
- for (std::vector<Ptr<WifiNetDevice> >::iterator i = ports.begin(); i != ports.end(); i++)
+ NS_ASSERT (ports.size() != 0);
+ for (std::vector<Ptr<WifiNetDevice> >::iterator i = ports.begin (); i != ports.end(); i++)
{
- MeshWifiMac * meshWifiMac = dynamic_cast<MeshWifiMac *> (PeekPointer ((*i)->GetMac()));
+ MeshWifiMac * meshWifiMac = dynamic_cast<MeshWifiMac *> (PeekPointer ((*i)->GetMac ()));
if (meshWifiMac == NULL)
return false;
- meshWifiMac->SetPeerLinkManager(this);
+ meshWifiMac->SetPeerLinkManager (this);
//Add a mac pointer:
- m_macPointers[meshWifiMac->GetAddress()] = meshWifiMac;
+ m_macPointers[meshWifiMac->GetAddress ()] = meshWifiMac;
//Add descriptor array:
std::vector<Ptr<WifiPeerLinkDescriptor> > descriptors;
- m_peerDescriptors[meshWifiMac->GetAddress()] = descriptors;
+ m_peerDescriptors[meshWifiMac->GetAddress ()] = descriptors;
//Add beacon timers:
struct BeaconInfo myBeacon;
- m_myBeaconInfo[meshWifiMac->GetAddress()] = myBeacon;
+ m_myBeaconInfo[meshWifiMac->GetAddress ()] = myBeacon;
}
return true;
}
void
-WifiPeerManager::AskIfOpenNeeded(Mac48Address portAddress, Mac48Address peerAddress)
+WifiPeerManager::AskIfOpenNeeded (Mac48Address portAddress, Mac48Address peerAddress)
{
- PeerDescriptorsMap::iterator port = m_peerDescriptors.find(portAddress);
- NS_ASSERT(port != m_peerDescriptors.end());
- for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin(); i!= port->second.end(); i++)
- if ((*i)->GetPeerAddress() == peerAddress)
+ PeerDescriptorsMap::iterator port = m_peerDescriptors.find (portAddress);
+ NS_ASSERT (port != m_peerDescriptors.end());
+ for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin (); i != port->second.end(); i++)
+ if ((*i)->GetPeerAddress () == peerAddress)
{
- if (ShouldSendOpen(portAddress, peerAddress))
- (*i)->MLMEActivePeerLinkOpen();
+ if (ShouldSendOpen (portAddress, peerAddress))
+ (*i)->MLMEActivePeerLinkOpen ();
break;
}
}
void
-WifiPeerManager::SetOpenReceived(
+WifiPeerManager::SetOpenReceived (
Mac48Address portAddress,
Mac48Address peerAddress,
IeDot11sPeerManagement peerMan,
@@ -699,28 +699,28 @@
)
{
dot11sReasonCode reasonCode;
- if (!ShouldAcceptOpen(portAddress, peerAddress,reasonCode))
+ if (!ShouldAcceptOpen (portAddress, peerAddress,reasonCode))
return;
- PeerDescriptorsMap::iterator port = m_peerDescriptors.find(portAddress);
- NS_ASSERT(port!=m_peerDescriptors.end());
- for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin(); i!= port->second.end(); i++)
- if ((*i)->GetPeerAddress() == peerAddress)
+ PeerDescriptorsMap::iterator port = m_peerDescriptors.find (portAddress);
+ NS_ASSERT (port != m_peerDescriptors.end());
+ for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin (); i != port->second.end(); i++)
+ if ((*i)->GetPeerAddress () == peerAddress)
{
- (*i)->PeerLinkOpenAccept(peerMan.GetLocalLinkId(), conf);
+ (*i)->PeerLinkOpenAccept (peerMan.GetLocalLinkId(), conf);
return;
}
- BeaconInfoMap::iterator myBeacon = m_myBeaconInfo.find(portAddress);
- NS_ASSERT(myBeacon!=m_myBeaconInfo.end());
- Ptr<WifiPeerLinkDescriptor>new_descriptor = AddDescriptor(
+ BeaconInfoMap::iterator myBeacon = m_myBeaconInfo.find (portAddress);
+ NS_ASSERT (myBeacon != m_myBeaconInfo.end());
+ Ptr<WifiPeerLinkDescriptor>new_descriptor = AddDescriptor (
portAddress,
peerAddress,
- Simulator::Now(),
+ Simulator::Now (),
myBeacon->second.beaconInterval
);
- new_descriptor->PeerLinkOpenAccept(peerMan.GetLocalLinkId(), conf);
+ new_descriptor->PeerLinkOpenAccept (peerMan.GetLocalLinkId(), conf);
}
void
-WifiPeerManager::SetConfirmReceived(
+WifiPeerManager::SetConfirmReceived (
Mac48Address portAddress,
Mac48Address peerAddress,
uint16_t peerAid,
@@ -728,159 +728,159 @@
IeDot11sConfiguration meshConfig
)
{
- PeerDescriptorsMap::iterator port = m_peerDescriptors.find(portAddress);
- NS_ASSERT(port!= m_peerDescriptors.end());
- for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin(); i!= port->second.end(); i++)
- if ((*i)->GetPeerAddress() == peerAddress)
- (*i)->PeerLinkConfirmAccept(peerMan.GetLocalLinkId(), peerMan.GetPeerLinkId(), peerAid, meshConfig);
+ PeerDescriptorsMap::iterator port = m_peerDescriptors.find (portAddress);
+ NS_ASSERT (port != m_peerDescriptors.end());
+ for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin (); i != port->second.end(); i++)
+ if ((*i)->GetPeerAddress () == peerAddress)
+ (*i)->PeerLinkConfirmAccept (peerMan.GetLocalLinkId(), peerMan.GetPeerLinkId(), peerAid, meshConfig);
}
void
-WifiPeerManager::SetCloseReceived(
+WifiPeerManager::SetCloseReceived (
Mac48Address portAddress,
Mac48Address peerAddress,
IeDot11sPeerManagement peerMan
)
{
- PeerDescriptorsMap::iterator port = m_peerDescriptors.find(portAddress);
- NS_ASSERT(port!= m_peerDescriptors.end());
- for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin(); i!= port->second.end(); i++)
- if ((*i)->GetPeerAddress() == peerAddress)
+ PeerDescriptorsMap::iterator port = m_peerDescriptors.find (portAddress);
+ NS_ASSERT (port != m_peerDescriptors.end());
+ for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin (); i != port->second.end(); i++)
+ if ((*i)->GetPeerAddress () == peerAddress)
{
- (*i)->PeerLinkClose(peerMan.GetLocalLinkId(), peerMan.GetPeerLinkId(), peerMan.GetReasonCode());
+ (*i)->PeerLinkClose (peerMan.GetLocalLinkId(), peerMan.GetPeerLinkId(), peerMan.GetReasonCode());
return;
}
}
void
-WifiPeerManager::ConfigurationMismatch(
+WifiPeerManager::ConfigurationMismatch (
Mac48Address portAddress,
Mac48Address peerAddress
)
{
- PeerDescriptorsMap::iterator port = m_peerDescriptors.find(portAddress);
- NS_ASSERT(port!= m_peerDescriptors.end());
- for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin(); i!= port->second.end(); i++)
- if ((*i)->GetPeerAddress() == peerAddress)
+ PeerDescriptorsMap::iterator port = m_peerDescriptors.find (portAddress);
+ NS_ASSERT (port != m_peerDescriptors.end());
+ for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin (); i != port->second.end(); i++)
+ if ((*i)->GetPeerAddress () == peerAddress)
{
- (*i)->MLMECancelPeerLink(REASON11S_MESH_CONFIGURATION_POLICY_VIOLATION);
+ (*i)->MLMECancelPeerLink (REASON11S_MESH_CONFIGURATION_POLICY_VIOLATION);
return;
}
}
IeDot11sBeaconTiming
-WifiPeerManager::GetIeDot11sBeaconTimingForMyBeacon(Mac48Address portAddress)
+WifiPeerManager::GetIeDot11sBeaconTimingForMyBeacon (Mac48Address portAddress)
{
- PeerDescriptorsMap::iterator port = m_peerDescriptors.find(portAddress);
- NS_ASSERT(port!= m_peerDescriptors.end());
+ PeerDescriptorsMap::iterator port = m_peerDescriptors.find (portAddress);
+ NS_ASSERT (port != m_peerDescriptors.end());
IeDot11sBeaconTiming return_val;
- for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin(); i!= port->second.end(); i++)
+ for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin (); i != port->second.end(); i++)
{
//Just go through all neighbor entries and add it to timing element:
- return_val.AddNeighboursTimingElementUnit(
- (*i)->GetLocalAid(),
- (*i)->GetLastBeacon(),
- (*i)->GetBeaconInterval()
+ return_val.AddNeighboursTimingElementUnit (
+ (*i)->GetLocalAid (),
+ (*i)->GetLastBeacon (),
+ (*i)->GetBeaconInterval ()
);
}
return return_val;
}
IeDot11sBeaconTiming
-WifiPeerManager::GetIeDot11sBeaconTimingForAddress(
+WifiPeerManager::GetIeDot11sBeaconTimingForAddress (
Mac48Address portAddress,
Mac48Address addr)
{
- PeerDescriptorsMap::iterator port = m_peerDescriptors.find(portAddress);
- NS_ASSERT(port != m_peerDescriptors.end());
+ PeerDescriptorsMap::iterator port = m_peerDescriptors.find (portAddress);
+ NS_ASSERT (port != m_peerDescriptors.end());
IeDot11sBeaconTiming return_val;
- for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin(); i != port->second.end(); i++)
- if ((*i)->GetPeerAddress() == addr)
- return_val = (*i)->GetBeaconTimingElement();
+ for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin (); i != port->second.end(); i++)
+ if ((*i)->GetPeerAddress () == addr)
+ return_val = (*i)->GetBeaconTimingElement ();
return return_val;
}
Ptr<WifiPeerLinkDescriptor>
-WifiPeerManager::AddDescriptor(
+WifiPeerManager::AddDescriptor (
Mac48Address portAddress,
Mac48Address peerAddress,
Time lastBeacon,
Time beaconInterval)
{
- Ptr<WifiPeerLinkDescriptor> new_descriptor = Create<WifiPeerLinkDescriptor>();
- if (m_assocId ==0xff)
+ Ptr<WifiPeerLinkDescriptor> new_descriptor = Create<WifiPeerLinkDescriptor> ();
+ if (m_assocId == 0xff)
m_assocId = 0;
if (m_localLinkId == 0xff)
m_localLinkId = 0;
- new_descriptor->SetLocalAid(m_assocId++);
- new_descriptor->SetLocalLinkId(m_localLinkId++);
- new_descriptor->SetPeerAddress(peerAddress);
- new_descriptor->SetBeaconInformation(lastBeacon, beaconInterval);
+ new_descriptor->SetLocalAid (m_assocId++);
+ new_descriptor->SetLocalLinkId (m_localLinkId++);
+ new_descriptor->SetPeerAddress (peerAddress);
+ new_descriptor->SetBeaconInformation (lastBeacon, beaconInterval);
//DEBUG ONLY:
- new_descriptor->SetLocalAddress(portAddress);
+ new_descriptor->SetLocalAddress (portAddress);
//check if port address is wrong
- MeshMacMap::iterator pos = m_macPointers.find(portAddress);
- NS_ASSERT(pos != m_macPointers.end());
+ MeshMacMap::iterator pos = m_macPointers.find (portAddress);
+ NS_ASSERT (pos != m_macPointers.end());
//check if descriptors array exist
- PeerDescriptorsMap::iterator port = m_peerDescriptors.find(portAddress);
- NS_ASSERT(port !=m_peerDescriptors.end());
- new_descriptor->SetMac(pos->second);
- new_descriptor->SetMaxBeaconLoss(m_maxBeaconLoss);
- new_descriptor->SetLinkStatusCallback(MakeCallback(&WifiPeerManager::PeerLinkStatus, this));
- NS_ASSERT(port != m_peerDescriptors.end());
- m_peerDescriptors[portAddress].push_back(new_descriptor);
+ PeerDescriptorsMap::iterator port = m_peerDescriptors.find (portAddress);
+ NS_ASSERT (port != m_peerDescriptors.end());
+ new_descriptor->SetMac (pos->second);
+ new_descriptor->SetMaxBeaconLoss (m_maxBeaconLoss);
+ new_descriptor->SetLinkStatusCallback (MakeCallback(&WifiPeerManager::PeerLinkStatus, this));
+ NS_ASSERT (port != m_peerDescriptors.end());
+ m_peerDescriptors[portAddress].push_back (new_descriptor);
return new_descriptor;
}
void
-WifiPeerManager::PeerCleanup()
+WifiPeerManager::PeerCleanup ()
{
for (
- PeerDescriptorsMap::iterator j = m_peerDescriptors.begin();
- j!= m_peerDescriptors.end();
+ PeerDescriptorsMap::iterator j = m_peerDescriptors.begin ();
+ j != m_peerDescriptors.end ();
j++)
{
std::vector<unsigned int> to_erase;
- for (unsigned int i = 0; i< j->second.size(); i++)
- if (j->second[i]->LinkIsIdle())
+ for (unsigned int i = 0; i< j->second.size (); i++)
+ if (j->second[i]->LinkIsIdle ())
{
- j->second[i]->ClearTimingElement();
+ j->second[i]->ClearTimingElement ();
j->second[i] = 0;
- to_erase.push_back(i);
+ to_erase.push_back (i);
}
- if (to_erase.size() == 0)
+ if (to_erase.size () == 0)
return;
- for (unsigned int i = to_erase.size()-1 ; i >= 0; i--)
- j->second.erase(j->second.begin() + to_erase[i]);
- to_erase.clear();
+ for (unsigned int i = to_erase.size ()-1 ; i >= 0; i--)
+ j->second.erase (j->second.begin() + to_erase[i]);
+ to_erase.clear ();
}
m_cleanupEvent = Simulator::Schedule (m_peerLinkCleanupPeriod, &WifiPeerManager::PeerCleanup, this);
}
std::vector<Mac48Address>
-WifiPeerManager::GetNeighbourAddressList(Mac48Address portAddress, Mac48Address peerAddress)
+WifiPeerManager::GetNeighbourAddressList (Mac48Address portAddress, Mac48Address peerAddress)
{
- PeerDescriptorsMap::iterator port = m_peerDescriptors.find(portAddress);
- NS_ASSERT(port!= m_peerDescriptors.end());
+ PeerDescriptorsMap::iterator port = m_peerDescriptors.find (portAddress);
+ NS_ASSERT (port != m_peerDescriptors.end());
std::vector<Mac48Address> return_value;
- for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin(); i!= port->second.end(); i++)
- return_value.push_back((*i)->GetPeerAddress());
+ for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin (); i != port->second.end(); i++)
+ return_value.push_back ((*i)->GetPeerAddress());
return return_value;
}
bool
-WifiPeerManager::IsActiveLink(Mac48Address portAddress, Mac48Address peerAddress)
+WifiPeerManager::IsActiveLink (Mac48Address portAddress, Mac48Address peerAddress)
{
- PeerDescriptorsMap::iterator port = m_peerDescriptors.find(portAddress);
- NS_ASSERT(port!= m_peerDescriptors.end());
- for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin(); i!= port->second.end(); i++)
- if ((*i)->GetPeerAddress() == peerAddress)
- return ((*i)->LinkIsEstab());
+ PeerDescriptorsMap::iterator port = m_peerDescriptors.find (portAddress);
+ NS_ASSERT (port != m_peerDescriptors.end());
+ for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin (); i != port->second.end(); i++)
+ if ((*i)->GetPeerAddress () == peerAddress)
+ return ((*i)->LinkIsEstab ());
return false;
}
bool
-WifiPeerManager::ShouldSendOpen(Mac48Address portAddress, Mac48Address peerAddress)
+WifiPeerManager::ShouldSendOpen (Mac48Address portAddress, Mac48Address peerAddress)
{
if (m_numberOfActivePeers > m_maxNumberOfPeerLinks)
return false;
@@ -888,7 +888,7 @@
}
bool
-WifiPeerManager::ShouldAcceptOpen(Mac48Address portAddress, Mac48Address peerAddress,dot11sReasonCode & reasonCode)
+WifiPeerManager::ShouldAcceptOpen (Mac48Address portAddress, Mac48Address peerAddress,dot11sReasonCode & reasonCode)
{
if (m_numberOfActivePeers > m_maxNumberOfPeerLinks)
{
@@ -899,7 +899,7 @@
}
Time
-WifiPeerManager::GetNextBeaconShift(
+WifiPeerManager::GetNextBeaconShift (
Mac48Address portAddress,
Time myNextTBTT
)
@@ -912,30 +912,30 @@
uint32_t myNextTBTTInTimeUnits = 0;
uint32_t futureBeaconInTimeUnits = 0;
//Going through all my timing elements and detecting future beacon collisions
- PeerDescriptorsMap::iterator port = m_peerDescriptors.find(portAddress);
- NS_ASSERT(port!= m_peerDescriptors.end());
- BeaconInfoMap::iterator myBeacon = m_myBeaconInfo.find(portAddress);
- NS_ASSERT(myBeacon!=m_myBeaconInfo.end());
- for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin(); i!= port->second.end(); i++)
+ PeerDescriptorsMap::iterator port = m_peerDescriptors.find (portAddress);
+ NS_ASSERT (port != m_peerDescriptors.end());
+ BeaconInfoMap::iterator myBeacon = m_myBeaconInfo.find (portAddress);
+ NS_ASSERT (myBeacon != m_myBeaconInfo.end());
+ for (std::vector<Ptr<WifiPeerLinkDescriptor> >::iterator i = port->second.begin (); i != port->second.end(); i++)
{
IeDot11sBeaconTiming::NeighboursTimingUnitsList neighbours;
- neighbours = (*i)->GetBeaconTimingElement().GetNeighboursTimingElementsList();
+ neighbours = (*i)->GetBeaconTimingElement ().GetNeighboursTimingElementsList();
//first let's form the list of all kown TBTTs
- for (IeDot11sBeaconTiming::NeighboursTimingUnitsList::const_iterator j = neighbours.begin(); j!= neighbours.end(); j++)
+ for (IeDot11sBeaconTiming::NeighboursTimingUnitsList::const_iterator j = neighbours.begin (); j != neighbours.end(); j++)
{
uint16_t beaconIntervalTimeUnits;
- beaconIntervalTimeUnits = (*j)->GetBeaconInterval();
+ beaconIntervalTimeUnits = (*j)->GetBeaconInterval ();
//The last beacon time in timing elememt in Time Units
uint32_t lastBeaconInTimeUnits;
- lastBeaconInTimeUnits = (*j)->GetLastBeacon()/4;
+ lastBeaconInTimeUnits = (*j)->GetLastBeacon ()/4;
//The time of my next beacon sending in Time Units
- myNextTBTTInTimeUnits = myNextTBTT.GetMicroSeconds()/1024;
+ myNextTBTTInTimeUnits = myNextTBTT.GetMicroSeconds ()/1024;
//My beacon interval in Time Units
uint32_t myBeaconIntervalInTimeUnits;
- myBeaconIntervalInTimeUnits = myBeacon->second.beaconInterval.GetMicroSeconds()/1024;
+ myBeaconIntervalInTimeUnits = myBeacon->second.beaconInterval.GetMicroSeconds ()/1024;
//The time the beacon of other station will be sent
//we need the time just after my next TBTT (or equal to my TBTT)
@@ -963,28 +963,28 @@
//TBTTs coincide, so let's calculate the shift
if (myNextTBTTInTimeUnits == futureBeaconInTimeUnits)
{
- NS_LOG_DEBUG("MBCA: Future beacon collision is detected, applying avoidance mechanism");
- UniformVariable randomSign(-1, 1);
+ NS_LOG_DEBUG ("MBCA: Future beacon collision is detected, applying avoidance mechanism");
+ UniformVariable randomSign (-1, 1);
int coefficientSign = -1;
- if (randomSign.GetValue() >= 0)
+ if (randomSign.GetValue () >= 0)
coefficientSign = 1;
- UniformVariable randomShift(1, 15);
+ UniformVariable randomShift (1, 15);
//So, the shift is a random integer variable uniformly distributed in [-15;-1] U [1;15]
- int beaconShift = randomShift.GetInteger(1,15) * coefficientSign;
- NS_LOG_DEBUG("Shift value = " << beaconShift << " beacon TUs");
+ int beaconShift = randomShift.GetInteger (1,15) * coefficientSign;
+ NS_LOG_DEBUG ("Shift value = " << beaconShift << " beacon TUs");
//We need the result not in Time Units, but in microseconds
- return MicroSeconds(beaconShift * 1024);
+ return MicroSeconds (beaconShift * 1024);
}
//No collision detecterf, hence no shift is needed
else
- return MicroSeconds(0);
+ return MicroSeconds (0);
}
void
-WifiPeerManager::PeerLinkStatus(Mac48Address portAddress, Mac48Address peerAddress, bool status)
+WifiPeerManager::PeerLinkStatus (Mac48Address portAddress, Mac48Address peerAddress, bool status)
{
- MeshMacMap::iterator pos = m_macPointers.find(portAddress);
- NS_ASSERT(pos!= m_macPointers.end());
- pos->second->PeerLinkStatus(peerAddress, status);
+ MeshMacMap::iterator pos = m_macPointers.find (portAddress);
+ NS_ASSERT (pos != m_macPointers.end());
+ pos->second->PeerLinkStatus (peerAddress, status);
}
} //namespace NS3
--- a/src/devices/mesh/mesh-wifi-peer-manager.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/mesh-wifi-peer-manager.h Wed Mar 18 22:36:12 2009 +0300
@@ -39,73 +39,73 @@
class WifiPeerLinkDescriptor : public RefCountBase
{
public:
- WifiPeerLinkDescriptor();
+ WifiPeerLinkDescriptor ();
/**
* Beacon loss processing:
*/
- void SetBeaconInformation(Time lastBeacon, Time BeaconInterval);
- void SetMaxBeaconLoss(uint8_t maxBeaconLoss);
+ void SetBeaconInformation (Time lastBeacon, Time BeaconInterval);
+ void SetMaxBeaconLoss (uint8_t maxBeaconLoss);
/**
* \brief Methods used to detecet peer link changes
* \param bool if true - opened new link, if
* false - link closed
*/
- void SetLinkStatusCallback(Callback<void, Mac48Address, Mac48Address, bool> cb);
+ void SetLinkStatusCallback (Callback<void, Mac48Address, Mac48Address, bool> cb);
/**
* Peer link geeters/setters
*/
- void SetPeerAddress(Mac48Address macaddr);
+ void SetPeerAddress (Mac48Address macaddr);
/**
* Debug purpose
*/
- void SetLocalAddress(Mac48Address macaddr);
- void SetLocalLinkId(uint16_t id);
- void SetPeerLinkId(uint16_t id);
- void SetLocalAid(uint16_t aid);
- void SetPeerAid(uint16_t aid);
- void SetBeaconTimingElement(IeDot11sBeaconTiming beaconTiming);
- void SetPeerLinkDescriptorElement(
+ void SetLocalAddress (Mac48Address macaddr);
+ void SetLocalLinkId (uint16_t id);
+ void SetPeerLinkId (uint16_t id);
+ void SetLocalAid (uint16_t aid);
+ void SetPeerAid (uint16_t aid);
+ void SetBeaconTimingElement (IeDot11sBeaconTiming beaconTiming);
+ void SetPeerLinkDescriptorElement (
IeDot11sPeerManagement peerLinkElement
);
- Mac48Address GetPeerAddress()const;
+ Mac48Address GetPeerAddress ()const;
/**
* Debug purpose
*/
- Mac48Address GetLocalAddress()const;
- uint16_t GetLocalAid()const;
- Time GetLastBeacon()const;
- Time GetBeaconInterval()const;
+ Mac48Address GetLocalAddress ()const;
+ uint16_t GetLocalAid ()const;
+ Time GetLastBeacon ()const;
+ Time GetBeaconInterval ()const;
IeDot11sBeaconTiming
- GetBeaconTimingElement()const;
+ GetBeaconTimingElement ()const;
IeDot11sPeerManagement
- GetPeerLinkDescriptorElement()const;
- void ClearTimingElement();
+ GetPeerLinkDescriptorElement ()const;
+ void ClearTimingElement ();
/* MLME */
- void MLMECancelPeerLink(dot11sReasonCode reason);
- void MLMEPassivePeerLinkOpen();
- void MLMEActivePeerLinkOpen();
- void MLMEPeeringRequestReject();
+ void MLMECancelPeerLink (dot11sReasonCode reason);
+ void MLMEPassivePeerLinkOpen ();
+ void MLMEActivePeerLinkOpen ();
+ void MLMEPeeringRequestReject ();
#if 0
- void MLMEBindSecurityAssociation();
+ void MLMEBindSecurityAssociation ();
#endif
- void SetMac(Ptr<MeshWifiMac> mac);
- void PeerLinkClose(uint16_t localLinkID,uint16_t peerLinkID, dot11sReasonCode reason);
- void PeerLinkOpenAccept(uint16_t localLinkId, IeDot11sConfiguration conf);
- void PeerLinkOpenReject(uint16_t localLinkId, IeDot11sConfiguration conf,dot11sReasonCode reason);
- void PeerLinkConfirmAccept(
+ void SetMac (Ptr<MeshWifiMac> mac);
+ void PeerLinkClose (uint16_t localLinkID,uint16_t peerLinkID, dot11sReasonCode reason);
+ void PeerLinkOpenAccept (uint16_t localLinkId, IeDot11sConfiguration conf);
+ void PeerLinkOpenReject (uint16_t localLinkId, IeDot11sConfiguration conf,dot11sReasonCode reason);
+ void PeerLinkConfirmAccept (
uint16_t localLinkId,
uint16_t peerLinkId,
uint16_t peerAid,
IeDot11sConfiguration conf
);
- void PeerLinkConfirmReject(
+ void PeerLinkConfirmReject (
uint16_t localLinkId,
uint16_t peerLinkId,
IeDot11sConfiguration conf,
dot11sReasonCode reason
);
- bool LinkIsEstab() const;
- bool LinkIsIdle() const;
+ bool LinkIsEstab () const;
+ bool LinkIsIdle () const;
private:
enum PeerState {
IDLE,
@@ -137,22 +137,22 @@
TOH,
};
private:
- void StateMachine(PeerEvent event,dot11sReasonCode = REASON11S_RESERVED);
+ void StateMachine (PeerEvent event,dot11sReasonCode = REASON11S_RESERVED);
/** Events handlers */
- void ClearRetryTimer();
- void ClearConfirmTimer();
- void ClearHoldingTimer();
- void SetHoldingTimer();
- void SetRetryTimer();
- void SetConfirmTimer();
+ void ClearRetryTimer ();
+ void ClearConfirmTimer ();
+ void ClearHoldingTimer ();
+ void SetHoldingTimer ();
+ void SetRetryTimer ();
+ void SetConfirmTimer ();
- void SendPeerLinkClose(dot11sReasonCode reasoncode );
- void SendPeerLinkOpen();
- void SendPeerLinkConfirm();
+ void SendPeerLinkClose (dot11sReasonCode reasoncode );
+ void SendPeerLinkOpen ();
+ void SendPeerLinkConfirm ();
/** Private Event */
- void HoldingTimeout();
- void RetryTimeout();
- void ConfirmTimeout();
+ void HoldingTimeout ();
+ void RetryTimeout ();
+ void ConfirmTimeout ();
private:
Mac48Address m_peerAddress;
Mac48Address m_localAddress;
@@ -183,7 +183,7 @@
*/
EventId m_beaconLossTimer;
uint8_t m_maxBeaconLoss;
- void BeaconLoss();
+ void BeaconLoss ();
Ptr<MeshWifiMac> m_mac;
Callback<void, Mac48Address, Mac48Address, bool>
m_linkStatusCallback;
@@ -194,30 +194,30 @@
class WifiPeerManager : public Object
{
public:
- WifiPeerManager();
- WifiPeerManager(Ptr<MeshWifiMac> mac_pointer);
- ~WifiPeerManager();
+ WifiPeerManager ();
+ WifiPeerManager (Ptr<MeshWifiMac> mac_pointer);
+ ~WifiPeerManager ();
static TypeId GetTypeId ();
//Returns a beacon timing element stored for remote station:
IeDot11sBeaconTiming
- GetIeDot11sBeaconTimingForAddress(Mac48Address portAddress, Mac48Address addr);
+ GetIeDot11sBeaconTimingForAddress (Mac48Address portAddress, Mac48Address addr);
//Returns a list of all addresses, which beacons can be decoded:
std::vector<Mac48Address>
- GetNeighbourAddressList(Mac48Address portAddress, Mac48Address peerAddress);
- bool AttachPorts(std::vector<Ptr<WifiNetDevice> >);
- //void SetMac(Ptr<MeshWifiMac> mac);
- Time GetNextBeaconShift(Mac48Address portAddress, Time myNextTBTT);
+ GetNeighbourAddressList (Mac48Address portAddress, Mac48Address peerAddress);
+ bool AttachPorts (std::vector<Ptr<WifiNetDevice> >);
+ //void SetMac (Ptr<MeshWifiMac> mac);
+ Time GetNextBeaconShift (Mac48Address portAddress, Time myNextTBTT);
- void SetSentBeaconTimers(
+ void SetSentBeaconTimers (
Mac48Address portAddress,
Time ReferenceTBTT,
Time BeaconInterval
);
- void AskIfOpenNeeded(
+ void AskIfOpenNeeded (
Mac48Address portAddress,
Mac48Address peerAddress
);
- void SetReceivedBeaconTimers(
+ void SetReceivedBeaconTimers (
Mac48Address portAddress,
Mac48Address peerAddress,
Time lastBeacon,
@@ -225,14 +225,14 @@
IeDot11sBeaconTiming
beaconTiming
);
- void SetOpenReceived(
+ void SetOpenReceived (
Mac48Address portAddress,
Mac48Address peerAddress,
IeDot11sPeerManagement
peerMan,
IeDot11sConfiguration conf
);
- void SetConfirmReceived(
+ void SetConfirmReceived (
Mac48Address portAddress,
Mac48Address peerAddress,
uint16_t peerAid,
@@ -240,22 +240,22 @@
peerMan,
IeDot11sConfiguration meshConfig
);
- void SetCloseReceived(
+ void SetCloseReceived (
Mac48Address portAddress,
Mac48Address peerAddress,
IeDot11sPeerManagement peerMan
);
//Using this function MAC
- void ConfigurationMismatch(
+ void ConfigurationMismatch (
Mac48Address portAddress,
Mac48Address peerAddress
);
//Returns a beacon timing element to added into my beacon:
IeDot11sBeaconTiming
- GetIeDot11sBeaconTimingForMyBeacon(
+ GetIeDot11sBeaconTimingForMyBeacon (
Mac48Address portAddress
);
- bool IsActiveLink(
+ bool IsActiveLink (
Mac48Address portAddress,
Mac48Address peerAddress
);
@@ -296,16 +296,16 @@
Time m_peerLinkCleanupPeriod;
EventId m_cleanupEvent;
Ptr<WifiPeerLinkDescriptor>
- AddDescriptor(
+ AddDescriptor (
Mac48Address portAddress,
Mac48Address peerAddress,
Time lastBeacon,
Time beaconInterval
);
- void PeerCleanup();
+ void PeerCleanup ();
//Mechanism of choosing PEERs:
- bool ShouldSendOpen(Mac48Address portAddress, Mac48Address peerAddress);
- bool ShouldAcceptOpen(
+ bool ShouldSendOpen (Mac48Address portAddress, Mac48Address peerAddress);
+ bool ShouldAcceptOpen (
Mac48Address portAddress,
Mac48Address peerAddress,
dot11sReasonCode & reasonCode
@@ -321,7 +321,7 @@
* \param status true - peer link opened, peer
* link closed otherwise
*/
- void PeerLinkStatus(Mac48Address portAddress, Mac48Address peerAddress, bool status);
+ void PeerLinkStatus (Mac48Address portAddress, Mac48Address peerAddress, bool status);
};
} //namespace ns3
--- a/src/devices/mesh/mesh.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/mesh.h Wed Mar 18 22:36:12 2009 +0300
@@ -27,4 +27,4 @@
* \brief Level 2 mobile ad hoc wireless networking
*
* TODO module documentation here
- */
\ No newline at end of file
+ */
--- a/src/devices/mesh/tx-statistics.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/tx-statistics.cc Wed Mar 18 22:36:12 2009 +0300
@@ -28,51 +28,51 @@
namespace ns3 {
TypeId
-WifiTxStatistics::GetTypeId(void)
+WifiTxStatistics::GetTypeId (void)
{
- static TypeId tid = TypeId("ns3::WifiTxStatistics")
+ static TypeId tid = TypeId ("ns3::WifiTxStatistics")
.SetParent<Object> ()
.AddConstructor<WifiTxStatistics> ();
return tid;
}
-WifiTxStatistics::WifiTxStatistics():
- m_numOfGroups(10),
- m_maxLength(2500)
+WifiTxStatistics::WifiTxStatistics ():
+ m_numOfGroups (10),
+ m_maxLength (2500)
{
}
-WifiTxStatistics::~WifiTxStatistics()
+WifiTxStatistics::~WifiTxStatistics ()
{
}
void
-WifiTxStatistics::SetLengthDivisionParams(uint16_t maxLength, uint8_t numOfGroups)
+WifiTxStatistics::SetLengthDivisionParams (uint16_t maxLength, uint8_t numOfGroups)
{
}
void
-WifiTxStatistics::NotifyDataSent(uint16_t length, uint32_t dataRate)
+WifiTxStatistics::NotifyDataSent (uint16_t length, uint32_t dataRate)
{
m_currentSize = length;
m_currentRate = dataRate;
}
WifiTxStatistics::RATE_STAT::iterator
-WifiTxStatistics::FillCurrentStatPosition(uint16_t length, uint32_t dataRate)
+WifiTxStatistics::FillCurrentStatPosition (uint16_t length, uint32_t dataRate)
{
- uint16_t group = (length/(m_maxLength/m_numOfGroups)+1)* (m_maxLength/m_numOfGroups);
+ uint16_t group = (length/ (m_maxLength/m_numOfGroups)+1)* (m_maxLength/m_numOfGroups);
#if 0
- for (RATE_LENGTH_STAT::iterator i = m_stats.begin(); i != m_stats.end(); i ++)
+ for (RATE_LENGTH_STAT::iterator i = m_stats.begin (); i != m_stats.end(); i ++)
if (i->first == )
#endif
- RATE_LENGTH_STAT::iterator lengthPos = m_stats.find(group);
- if (lengthPos == m_stats.end())
+ RATE_LENGTH_STAT::iterator lengthPos = m_stats.find (group);
+ if (lengthPos == m_stats.end ())
{
RATE_STAT newStat;
m_stats[group] = newStat;
}
- lengthPos = m_stats.find(group);
- NS_ASSERT(lengthPos != m_stats.end());
- RATE_STAT::iterator ratePos = lengthPos->second.find(dataRate);
- if (ratePos == lengthPos->second.end())
+ lengthPos = m_stats.find (group);
+ NS_ASSERT (lengthPos != m_stats.end());
+ RATE_STAT::iterator ratePos = lengthPos->second.find (dataRate);
+ if (ratePos == lengthPos->second.end ())
{
SIMPLE_STAT newStat;
newStat.packetsFailed =0;
@@ -86,23 +86,23 @@
newStat.bytesAcked = 0;
lengthPos->second[dataRate] = newStat;
}
- ratePos = lengthPos->second.find(dataRate);
- NS_ASSERT(ratePos != lengthPos->second.end());
+ ratePos = lengthPos->second.find (dataRate);
+ NS_ASSERT (ratePos != lengthPos->second.end());
return ratePos;
}
void
-WifiTxStatistics::NotifyDataFailed()
+WifiTxStatistics::NotifyDataFailed ()
{
- RATE_STAT::iterator ratePos = FillCurrentStatPosition(m_currentSize, m_currentRate);
+ RATE_STAT::iterator ratePos = FillCurrentStatPosition (m_currentSize, m_currentRate);
ratePos->second.packetsFailed++;
ratePos->second.bytesFailed += m_currentSize;
}
void
-WifiTxStatistics::NotifyGotAck(uint32_t retryCounter)
+WifiTxStatistics::NotifyGotAck (uint32_t retryCounter)
{
- RATE_STAT::iterator ratePos = FillCurrentStatPosition(m_currentSize, m_currentRate);
+ RATE_STAT::iterator ratePos = FillCurrentStatPosition (m_currentSize, m_currentRate);
ratePos->second.packetsAcked++;
ratePos->second.packetsRetried += retryCounter;
ratePos->second.bytesAcked+= m_currentSize;
@@ -110,24 +110,24 @@
}
void
-WifiTxStatistics::NotifyRtsSend(uint32_t rtsRate, uint32_t dataLength)
+WifiTxStatistics::NotifyRtsSend (uint32_t rtsRate, uint32_t dataLength)
{
m_currentSize = dataLength;
m_currentRate = rtsRate;
}
void
-WifiTxStatistics::NotifyRtsFailed()
+WifiTxStatistics::NotifyRtsFailed ()
{
- RATE_STAT::iterator ratePos = FillCurrentStatPosition(m_currentSize, m_currentRate);
+ RATE_STAT::iterator ratePos = FillCurrentStatPosition (m_currentSize, m_currentRate);
ratePos->second.rtsFailed++;
ratePos->second.bytesFailed += m_currentSize;
}
void
-WifiTxStatistics::NotifyRtsSuccess(uint32_t retryCounter)
+WifiTxStatistics::NotifyRtsSuccess (uint32_t retryCounter)
{
- RATE_STAT::iterator ratePos = FillCurrentStatPosition(m_currentSize, m_currentRate);
+ RATE_STAT::iterator ratePos = FillCurrentStatPosition (m_currentSize, m_currentRate);
ratePos->second.rtsAcked++;
ratePos->second.rtsRetried += retryCounter;
ratePos->second.bytesAcked += m_currentSize;
@@ -135,29 +135,29 @@
}
void
-WifiTxStatistics::ResetStatistics()
+WifiTxStatistics::ResetStatistics ()
{
- for (RATE_LENGTH_STAT::iterator lengthPos = m_stats.begin(); lengthPos != m_stats.end(); lengthPos++)
- lengthPos->second.clear();
+ for (RATE_LENGTH_STAT::iterator lengthPos = m_stats.begin (); lengthPos != m_stats.end(); lengthPos++)
+ lengthPos->second.clear ();
}
#if 0
WifiTxStatistics::SIMPLE_STAT
-WifiTxStatistics::GetTxStatCommon()
+WifiTxStatistics::GetTxStatCommon ()
{
}
WifiTxStatistics::RATE_STAT
-WifiTxStatistics::GetTxStatRate()
+WifiTxStatistics::GetTxStatRate ()
{
}
WifiTxStatistics::LENGTH_STAT
-WifiTxStatistics::GetTxStatLength()
+WifiTxStatistics::GetTxStatLength ()
{
}
#endif
WifiTxStatistics::TX_STATISTICS
-WifiTxStatistics::GetTxStatRateLength()
+WifiTxStatistics::GetTxStatRateLength ()
{
TX_STATISTICS retval;
retval.statistics = m_stats;
@@ -167,14 +167,14 @@
}
#if 0
void
-WifiTxStatistics::Print()
+WifiTxStatistics::Print ()
{
- for (RATE_LENGTH_STAT::iterator lengthPos = m_stats.begin(); lengthPos != m_stats.end(); lengthPos++)
+ for (RATE_LENGTH_STAT::iterator lengthPos = m_stats.begin (); lengthPos != m_stats.end(); lengthPos++)
{
- NS_LOG_UNCOND("\tGROUP = " <<lengthPos->first);
- for (RATE_STAT::iterator ratePos = lengthPos->second.begin(); ratePos != lengthPos->second.end(); ratePos ++)
+ NS_LOG_UNCOND ("\tGROUP = " <<lengthPos->first);
+ for (RATE_STAT::iterator ratePos = lengthPos->second.begin (); ratePos != lengthPos->second.end(); ratePos ++)
{
- NS_LOG_UNCOND("Rate is "<<ratePos->first
+ NS_LOG_UNCOND ("Rate is "<<ratePos->first
<<": SUCCESS = "<<ratePos->second.packetsAcked
<<", RRETRY = " <<ratePos->second.packetsRetried
<<", FAILURE = "<<ratePos->second.packetsFailed);
--- a/src/devices/mesh/tx-statistics.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/tx-statistics.h Wed Mar 18 22:36:12 2009 +0300
@@ -35,9 +35,9 @@
class WifiTxStatistics : public Object
{
public:
- static TypeId GetTypeId(void);
- WifiTxStatistics();
- ~WifiTxStatistics();
+ static TypeId GetTypeId (void);
+ WifiTxStatistics ();
+ ~WifiTxStatistics ();
struct TxStat
{
@@ -67,33 +67,33 @@
#endif
typedef std::map<uint16_t, RATE_STAT> RATE_LENGTH_STAT;
- void SetLengthDivisionParams(uint16_t maxLength, uint8_t numOfGroups);
+ void SetLengthDivisionParams (uint16_t maxLength, uint8_t numOfGroups);
- void NotifyDataSent(uint16_t length, uint32_t dataRate);
- void NotifyDataFailed();
- void NotifyGotAck(uint32_t retryCounter);
+ void NotifyDataSent (uint16_t length, uint32_t dataRate);
+ void NotifyDataFailed ();
+ void NotifyGotAck (uint32_t retryCounter);
- void NotifyRtsSend(uint32_t rtsRate, uint32_t dataLength);
- void NotifyRtsRetried();
- void NotifyRtsFailed();
- void NotifyRtsSuccess(uint32_t retryCounter);
+ void NotifyRtsSend (uint32_t rtsRate, uint32_t dataLength);
+ void NotifyRtsRetried ();
+ void NotifyRtsFailed ();
+ void NotifyRtsSuccess (uint32_t retryCounter);
- void ResetStatistics();
+ void ResetStatistics ();
#if 0
- SIMPLE_STAT GetTxStatCommon();
- RATE_STAT GetTxStatRate();
- LENGTH_STAT GetTxStatLength();
+ SIMPLE_STAT GetTxStatCommon ();
+ RATE_STAT GetTxStatRate ();
+ LENGTH_STAT GetTxStatLength ();
#endif
typedef struct {
RATE_LENGTH_STAT statistics;
uint16_t lengthInterval;
uint16_t maxLength;
} TX_STATISTICS;
- TX_STATISTICS GetTxStatRateLength();
+ TX_STATISTICS GetTxStatRateLength ();
private:
- RATE_STAT::iterator FillCurrentStatPosition(uint16_t length, uint32_t dataRate);
+ RATE_STAT::iterator FillCurrentStatPosition (uint16_t length, uint32_t dataRate);
//DEBUG PURPOSE
- //void Print();
+ //void Print ();
RATE_LENGTH_STAT m_stats;
bool m_isTx;
uint8_t m_numOfGroups;
--- a/src/devices/mesh/wifi-information-element.cc Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/wifi-information-element.cc Wed Mar 18 22:36:12 2009 +0300
@@ -23,7 +23,7 @@
namespace ns3 {
TypeId
-WifiInformationElement::GetTypeId()
+WifiInformationElement::GetTypeId ()
{
static TypeId tid = TypeId ("ns3::WifiInformationElement")
.SetParent<Header> ();
@@ -37,37 +37,37 @@
}
uint32_t WifiInformationElement::GetSerializedSize () const
{
- return (GetInformationSize() + 2);
+ return (GetInformationSize () + 2);
}
void WifiInformationElement::Serialize (Buffer::Iterator i) const
{
- i.WriteU8 (ElementId());
- i.WriteU8 (GetInformationSize());
- SerializeInformation(i);
+ i.WriteU8 (ElementId ());
+ i.WriteU8 (GetInformationSize ());
+ SerializeInformation (i);
}
uint32_t WifiInformationElement::Deserialize (Buffer::Iterator i)
{
- NS_ASSERT (i.ReadU8() == ElementId());
+ NS_ASSERT (i.ReadU8 () == ElementId());
uint8_t length = i.ReadU8 ();
- return (DeserializeInformation(i, length) + 2);
+ return (DeserializeInformation (i, length) + 2);
}
void WifiInformationElement::Print (std::ostream &os) const
{
- os << "<information_element id=" << ElementId() << ">\n";
- PrintInformation(os);
+ os << "<information_element id=" << ElementId () << ">\n";
+ PrintInformation (os);
os << "</information_element>\n";
}
-bool operator<(WifiInformationElement const & a, WifiInformationElement const & b)
+bool operator< (WifiInformationElement const & a, WifiInformationElement const & b)
{
- return (a.ElementId() < b.ElementId());
-}
-
-
+ return (a.ElementId () < b.ElementId());
}
+}
+
+
--- a/src/devices/mesh/wifi-information-element.h Wed Mar 18 20:37:54 2009 +0300
+++ b/src/devices/mesh/wifi-information-element.h Wed Mar 18 22:36:12 2009 +0300
@@ -77,10 +77,10 @@
public:
/// Support object system
static TypeId GetTypeId ();
- TypeId GetInstanceTypeId() const;
+ TypeId GetInstanceTypeId () const;
/// virtual d-tor for subclasses
- virtual ~WifiInformationElement() {}
+ virtual ~WifiInformationElement () {}
///\name Inherited from Header
//\{
@@ -146,11 +146,11 @@
//\}
/// Compare information elements using Element ID
- friend bool operator<(WifiInformationElement const & a, WifiInformationElement const & b);
+ friend bool operator< (WifiInformationElement const & a, WifiInformationElement const & b);
};
/// Compare information elements using Element ID
-bool operator<(WifiInformationElement const & a, WifiInformationElement const & b);
+bool operator< (WifiInformationElement const & a, WifiInformationElement const & b);
} // namespace ns3
#endif /* WIFIINFORMATIONELEMENT_H_ */