--- a/src/network/examples/droptail_vs_red.cc Mon Dec 05 19:05:39 2011 -0500
+++ b/src/network/examples/droptail_vs_red.cc Mon Dec 05 19:11:11 2011 -0500
@@ -132,8 +132,8 @@
clientHelper.SetAttribute ("Remote", remoteAddress);
clientApps.Add (clientHelper.Install (d.GetRight (i)));
}
- clientApps.Start (Seconds (1.0));// Start 1 second after sink
- clientApps.Stop (Seconds (15.0));// Stop before the sink
+ clientApps.Start (Seconds (1.0)); // Start 1 second after sink
+ clientApps.Stop (Seconds (15.0)); // Stop before the sink
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
--- a/src/network/examples/red-tests.cc Mon Dec 05 19:05:39 2011 -0500
+++ b/src/network/examples/red-tests.cc Mon Dec 05 19:11:11 2011 -0500
@@ -87,11 +87,11 @@
std::ofstream fPlotQueue (filePlotQueue.str ().c_str (), std::ios::out|std::ios::app);
fPlotQueue << Simulator::Now ().GetSeconds () << " " << qSize << std::endl;
- fPlotQueue.close();
+ fPlotQueue.close ();
std::ofstream fPlotQueueAvg (filePlotQueueAvg.str ().c_str (), std::ios::out|std::ios::app);
fPlotQueueAvg << Simulator::Now ().GetSeconds () << " " << avgQueueSize / checkTimes << std::endl;
- fPlotQueueAvg.close();
+ fPlotQueueAvg.close ();
}
void
@@ -103,7 +103,7 @@
uint16_t port = 50000;
Address sinkLocalAddress (InetSocketAddress (Ipv4Address::GetAny (), port));
PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory", sinkLocalAddress);
- ApplicationContainer sinkApp = sinkHelper.Install (n3n4.Get(1));
+ ApplicationContainer sinkApp = sinkHelper.Install (n3n4.Get (1));
sinkApp.Start (Seconds (sink_start_time));
sinkApp.Stop (Seconds (sink_stop_time));
@@ -127,7 +127,7 @@
AddressValue remoteAddress
(InetSocketAddress (i3i4.GetAddress (1), port));
clientHelper1.SetAttribute ("Remote", remoteAddress);
- clientApps1.Add(clientHelper1.Install (n0n2.Get(0)));
+ clientApps1.Add (clientHelper1.Install (n0n2.Get (0)));
clientApps1.Start (Seconds (client_start_time));
clientApps1.Stop (Seconds (client_stop_time));
@@ -144,7 +144,7 @@
ApplicationContainer clientApps2;
clientHelper2.SetAttribute ("Remote", remoteAddress);
- clientApps2.Add(clientHelper2.Install (n1n2.Get(0)));
+ clientApps2.Add (clientHelper2.Install (n1n2.Get (0)));
clientApps2.Start (Seconds (3.0));
clientApps2.Stop (Seconds (client_stop_time));
}
@@ -155,28 +155,28 @@
uint16_t port1 = 50001;
Address sinkLocalAddress1 (InetSocketAddress (Ipv4Address::GetAny (), port1));
PacketSinkHelper sinkHelper1 ("ns3::TcpSocketFactory", sinkLocalAddress1);
- ApplicationContainer sinkApp1 = sinkHelper1.Install (n3n4.Get(1));
+ ApplicationContainer sinkApp1 = sinkHelper1.Install (n3n4.Get (1));
sinkApp1.Start (Seconds (sink_start_time));
sinkApp1.Stop (Seconds (sink_stop_time));
// #2
uint16_t port2 = 50002;
Address sinkLocalAddress2 (InetSocketAddress (Ipv4Address::GetAny (), port2));
PacketSinkHelper sinkHelper2 ("ns3::TcpSocketFactory", sinkLocalAddress2);
- ApplicationContainer sinkApp2 = sinkHelper2.Install (n3n5.Get(1));
+ ApplicationContainer sinkApp2 = sinkHelper2.Install (n3n5.Get (1));
sinkApp2.Start (Seconds (sink_start_time));
sinkApp2.Stop (Seconds (sink_stop_time));
// #3
uint16_t port3 = 50003;
Address sinkLocalAddress3 (InetSocketAddress (Ipv4Address::GetAny (), port3));
PacketSinkHelper sinkHelper3 ("ns3::TcpSocketFactory", sinkLocalAddress3);
- ApplicationContainer sinkApp3 = sinkHelper3.Install (n0n2.Get(0));
+ ApplicationContainer sinkApp3 = sinkHelper3.Install (n0n2.Get (0));
sinkApp3.Start (Seconds (sink_start_time));
sinkApp3.Stop (Seconds (sink_stop_time));
// #4
uint16_t port4 = 50004;
Address sinkLocalAddress4 (InetSocketAddress (Ipv4Address::GetAny (), port4));
PacketSinkHelper sinkHelper4 ("ns3::TcpSocketFactory", sinkLocalAddress4);
- ApplicationContainer sinkApp4 = sinkHelper4.Install (n1n2.Get(0));
+ ApplicationContainer sinkApp4 = sinkHelper4.Install (n1n2.Get (0));
sinkApp4.Start (Seconds (sink_start_time));
sinkApp4.Stop (Seconds (sink_stop_time));
@@ -199,7 +199,7 @@
AddressValue remoteAddress1
(InetSocketAddress (i3i4.GetAddress (1), port1));
clientHelper1.SetAttribute ("Remote", remoteAddress1);
- clientApps1.Add(clientHelper1.Install (n0n2.Get(0)));
+ clientApps1.Add (clientHelper1.Install (n0n2.Get (0)));
clientApps1.Start (Seconds (client_start_time));
clientApps1.Stop (Seconds (client_stop_time));
@@ -218,7 +218,7 @@
AddressValue remoteAddress2
(InetSocketAddress (i3i5.GetAddress (1), port2));
clientHelper2.SetAttribute ("Remote", remoteAddress2);
- clientApps2.Add(clientHelper2.Install (n1n2.Get(0)));
+ clientApps2.Add (clientHelper2.Install (n1n2.Get (0)));
clientApps2.Start (Seconds (2.0));
clientApps2.Stop (Seconds (client_stop_time));
@@ -237,7 +237,7 @@
AddressValue remoteAddress3
(InetSocketAddress (i0i2.GetAddress (0), port3));
clientHelper3.SetAttribute ("Remote", remoteAddress3);
- clientApps3.Add (clientHelper3.Install (n3n4.Get(1)));
+ clientApps3.Add (clientHelper3.Install (n3n4.Get (1)));
clientApps3.Start (Seconds (3.5));
clientApps3.Stop (Seconds (client_stop_time));
@@ -256,7 +256,7 @@
AddressValue remoteAddress4
(InetSocketAddress (i1i2.GetAddress (0), port4));
clientHelper4.SetAttribute ("Remote", remoteAddress4);
- clientApps4.Add (clientHelper4.Install (n3n5.Get(1)));
+ clientApps4.Add (clientHelper4.Install (n3n5.Get (1)));
clientApps4.Start (Seconds (1.0));
clientApps4.Stop (Seconds (client_stop_time));
}
@@ -330,7 +330,7 @@
// RED params
NS_LOG_INFO ("Set RED params");
- Config::SetDefault ("ns3::RedQueue::Mode", StringValue("Packets"));
+ Config::SetDefault ("ns3::RedQueue::Mode", StringValue ("Packets"));
Config::SetDefault ("ns3::RedQueue::MeanPktSize", UintegerValue (meanPktSize));
Config::SetDefault ("ns3::RedQueue::Wait", BooleanValue (true));
Config::SetDefault ("ns3::RedQueue::Gentle", BooleanValue (true));
@@ -419,7 +419,7 @@
StaticCast<RedQueue> (queue)->SetQueueLimit (25);
}
- BuildAppsTest(redTest);
+ BuildAppsTest (redTest);
if (writePcap)
{
--- a/src/network/test/red-queue-test-suite.cc Mon Dec 05 19:05:39 2011 -0500
+++ b/src/network/test/red-queue-test-suite.cc Mon Dec 05 19:11:11 2011 -0500
@@ -34,9 +34,9 @@
public:
RedQueueTestCase ();
virtual void DoRun (void);
-private:
- void Enqueue(Ptr<RedQueue> queue, uint32_t size, uint32_t nPkt);
- void RunRedTest(StringValue mode);
+private:
+ void Enqueue (Ptr<RedQueue> queue, uint32_t size, uint32_t nPkt);
+ void RunRedTest (StringValue mode);
};
RedQueueTestCase::RedQueueTestCase ()
@@ -45,7 +45,7 @@
}
void
-RedQueueTestCase::RunRedTest(StringValue mode)
+RedQueueTestCase::RunRedTest (StringValue mode)
{
uint32_t pktSize = 0;
// 1 for packets; pktSize for bytes
@@ -138,7 +138,7 @@
"Verify that we can actually set the attribute MaxTh");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QueueLimit", UintegerValue (qSize)), true,
"Verify that we can actually set the attribute QueueLimit");
- Enqueue(queue, pktSize, 300);
+ Enqueue (queue, pktSize, 300);
RedQueue::Stats st = StaticCast<RedQueue> (queue)->GetStats ();
NS_TEST_EXPECT_MSG_EQ (st.unforcedDrop, 0, "There should zero dropped packets due probability mark");
NS_TEST_EXPECT_MSG_EQ (st.forcedDrop, 0, "There should zero dropped packets due hardmark mark");
@@ -166,7 +166,7 @@
"Verify that we can actually set the attribute QueueLimit");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.020)), true,
"Verify that we can actually set the attribute QW");
- Enqueue(queue, pktSize, 300);
+ Enqueue (queue, pktSize, 300);
st = StaticCast<RedQueue> (queue)->GetStats ();
drop.test3 = st.unforcedDrop + st.forcedDrop + st.qLimDrop;
NS_TEST_EXPECT_MSG_NE (drop.test3, 0, "There should be some dropped packets");
@@ -185,7 +185,7 @@
"Verify that we can actually set the attribute QueueLimit");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("QW", DoubleValue (0.020)), true,
"Verify that we can actually set the attribute QW");
- Enqueue(queue, pktSize, 300);
+ Enqueue (queue, pktSize, 300);
st = StaticCast<RedQueue> (queue)->GetStats ();
drop.test4 = st.unforcedDrop + st.forcedDrop + st.qLimDrop;
NS_TEST_EXPECT_MSG_GT (drop.test4, drop.test3, "Test 4 should have more drops than test 3");
@@ -206,7 +206,7 @@
"Verify that we can actually set the attribute QW");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("LInterm", DoubleValue (5)), true,
"Verify that we can actually set the attribute LInterm");
- Enqueue(queue, pktSize, 300);
+ Enqueue (queue, pktSize, 300);
st = StaticCast<RedQueue> (queue)->GetStats ();
drop.test5 = st.unforcedDrop + st.forcedDrop + st.qLimDrop;
NS_TEST_EXPECT_MSG_GT (drop.test5, drop.test3, "Test 5 should have more drops than test 3");
@@ -226,7 +226,7 @@
"Verify that we can actually set the attribute QW");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Gentle", BooleanValue (false)), true,
"Verify that we can actually set the attribute Gentle");
- Enqueue(queue, pktSize, 300);
+ Enqueue (queue, pktSize, 300);
st = StaticCast<RedQueue> (queue)->GetStats ();
drop.test6 = st.unforcedDrop + st.forcedDrop + st.qLimDrop;
NS_TEST_EXPECT_MSG_GT (drop.test6, drop.test3, "Test 6 should have more drops than test 3");
@@ -246,14 +246,14 @@
"Verify that we can actually set the attribute QW");
NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Wait", BooleanValue (false)), true,
"Verify that we can actually set the attribute Wait");
- Enqueue(queue, pktSize, 300);
+ Enqueue (queue, pktSize, 300);
st = StaticCast<RedQueue> (queue)->GetStats ();
drop.test7 = st.unforcedDrop + st.forcedDrop + st.qLimDrop;
NS_TEST_EXPECT_MSG_GT (drop.test7, drop.test3, "Test 7 should have more drops than test 3");
}
void
-RedQueueTestCase::Enqueue(Ptr<RedQueue> queue, uint32_t size, uint32_t nPkt)
+RedQueueTestCase::Enqueue (Ptr<RedQueue> queue, uint32_t size, uint32_t nPkt)
{
for (uint32_t i = 0; i < nPkt; i++)
{
@@ -264,8 +264,8 @@
void
RedQueueTestCase::DoRun (void)
{
- RunRedTest (StringValue("Packets"));
- RunRedTest (StringValue("Bytes"));
+ RunRedTest (StringValue ("Packets"));
+ RunRedTest (StringValue ("Bytes"));
Simulator::Destroy ();
}
--- a/src/network/utils/red-queue.cc Mon Dec 05 19:05:39 2011 -0500
+++ b/src/network/utils/red-queue.cc Mon Dec 05 19:11:11 2011 -0500
@@ -206,7 +206,7 @@
{
NS_LOG_FUNCTION (this << p);
- if (! m_hasRedStarted )
+ if (!m_hasRedStarted )
{
NS_LOG_INFO ("Initializing RED params.");
InitializeParams ();
@@ -258,12 +258,12 @@
uint32_t dropType = DTYPE_NONE;
if (m_qAvg >= m_minTh && nQueued > 1)
{
- if ((! m_isGentle && m_qAvg >= m_maxTh) ||
+ if ((!m_isGentle && m_qAvg >= m_maxTh) ||
(m_isGentle && m_qAvg >= 2 * m_maxTh))
- {
- NS_LOG_DEBUG ("adding DROP FORCED MARK");
- dropType = DTYPE_FORCED;
- }
+ {
+ NS_LOG_DEBUG ("adding DROP FORCED MARK");
+ dropType = DTYPE_FORCED;
+ }
else if (m_old == 0)
{
/*
@@ -321,7 +321,7 @@
NS_LOG_LOGIC ("Number packets " << m_packets.size ());
NS_LOG_LOGIC ("Number bytes " << m_bytesInQueue);
-
+
return true;
}
@@ -343,7 +343,7 @@
m_cautious = 0;
m_ptc = m_linkBandwidth.GetBitRate () / (8.0 * m_meanPktSize);
-
+
m_qAvg = 0.0;
m_count = 0;
m_countBytes = 0;
@@ -357,8 +357,8 @@
}
m_vA = 1.0 / th_diff;
m_curMaxP = 1.0 / m_lInterm;
- m_vB = - m_minTh / th_diff;
-
+ m_vB = -m_minTh / th_diff;
+
if (m_isGentle)
{
m_vC = (1.0 - m_curMaxP) / m_maxTh;
@@ -381,7 +381,7 @@
*/
if (m_qW == 0.0)
{
- m_qW = 1.0 - exp(-1.0 / m_ptc);
+ m_qW = 1.0 - exp (-1.0 / m_ptc);
}
else if (m_qW == -1.0)
{
@@ -391,22 +391,22 @@
{
rtt = 0.1;
}
- m_qW = 1.0 - exp(-1.0 / (10 * rtt * m_ptc));
+ m_qW = 1.0 - exp (-1.0 / (10 * rtt * m_ptc));
}
else if (m_qW == -2.0)
{
- m_qW = 1.0 - exp(-10.0 / m_ptc);
+ m_qW = 1.0 - exp (-10.0 / m_ptc);
}
// TODO: implement adaptive RED
NS_LOG_DEBUG ("\tm_delay " << m_linkDelay.GetSeconds () << "; m_isWait "
- << m_isWait << "; m_qW " << m_qW << "; m_ptc " << m_ptc
- << "; m_minTh " << m_minTh << "; m_maxTh " << m_maxTh
- << "; m_isGentle " << m_isGentle << "; th_diff " << th_diff
- << "; lInterm " << m_lInterm << "; va " << m_vA << "; cur_max_p "
- << m_curMaxP << "; v_b " << m_vB << "; m_vC "
- << m_vC << "; m_vD " << m_vD);
+ << m_isWait << "; m_qW " << m_qW << "; m_ptc " << m_ptc
+ << "; m_minTh " << m_minTh << "; m_maxTh " << m_maxTh
+ << "; m_isGentle " << m_isGentle << "; th_diff " << th_diff
+ << "; lInterm " << m_lInterm << "; va " << m_vA << "; cur_max_p "
+ << m_curMaxP << "; v_b " << m_vB << "; m_vC "
+ << m_vC << "; m_vD " << m_vD);
}
// Compute the average queue size
@@ -535,7 +535,7 @@
// Returns a probability using these function parameters for the DropEarly funtion
double
RedQueue::ModifyP (double p, uint32_t count, uint32_t countBytes,
- uint32_t meanPktSize, bool isWait, uint32_t size)
+ uint32_t meanPktSize, bool isWait, uint32_t size)
{
NS_LOG_FUNCTION (this << p << count << countBytes << meanPktSize << isWait << size);
double count1 = (double) count;
--- a/src/network/utils/red-queue.h Mon Dec 05 19:05:39 2011 -0500
+++ b/src/network/utils/red-queue.h Mon Dec 05 19:11:11 2011 -0500
@@ -107,11 +107,11 @@
// Drop types
enum
- {
- DTYPE_NONE, // Ok, no drop
- DTYPE_FORCED, // A "forced" drop
- DTYPE_UNFORCED, // An "unforced" (random) drop
- };
+ {
+ DTYPE_NONE, // Ok, no drop
+ DTYPE_FORCED, // A "forced" drop
+ DTYPE_UNFORCED, // An "unforced" (random) drop
+ };
/*
* Enumeration of the modes supported in the class.
@@ -150,7 +150,7 @@
*
* \param lim The limit in bytes or packets.
*/
- void SetQueueLimit(uint32_t lim);
+ void SetQueueLimit (uint32_t lim);
/*
* Set the thresh limits of RED.
@@ -158,14 +158,14 @@
* \param min Minimum thresh in bytes or packets.
* \param max Maximum thresh in bytes or packets.
*/
- void SetTh(double minTh, double maxTh);
+ void SetTh (double minTh, double maxTh);
/*
* Get the RED statistics after running.
*
* \returns The drop statistics.
*/
- Stats GetStats();
+ Stats GetStats ();
private:
virtual bool DoEnqueue (Ptr<Packet> p);
@@ -182,8 +182,8 @@
double CalculatePNew (double qAvg, double maxTh, bool gentle, double vA,
double vB, double vC, double vD, double maxP);
// Returns a probability using these function parameters for the DropEarly funtion
- double ModifyP(double p, uint32_t count, uint32_t countBytes,
- uint32_t meanPktSize, bool wait, uint32_t size);
+ double ModifyP (double p, uint32_t count, uint32_t countBytes,
+ uint32_t meanPktSize, bool wait, uint32_t size);
std::list<Ptr<Packet> > m_packets;