From 946e71af06818d34de992e895df77fab22d6a26a Mon Sep 17 00:00:00 2001 From: Josh Pelkey Date: Fri, 13 May 2011 15:35:31 -0400 Subject: [PATCH] general examples coding style changes --- examples/energy/energy-model-example.cc | 6 +- examples/error-model/simple-error-model.cc | 16 ++-- examples/ipv6/fragmentation-ipv6.cc | 8 +- examples/ipv6/icmpv6-redirect.cc | 8 +- examples/ipv6/loose-routing-ipv6.cc | 4 +- examples/ipv6/ping6.cc | 2 +- examples/ipv6/radvd-two-prefix.cc | 8 +- examples/matrix-topology/matrix-topology.cc | 2 +- examples/realtime/realtime-udp-echo.cc | 2 +- examples/routing/dynamic-global-routing.cc | 14 ++-- examples/routing/global-injection-slash32.cc | 18 ++--- examples/routing/global-routing-slash32.cc | 12 +-- examples/routing/mixed-global-routing.cc | 4 +- examples/routing/simple-alternate-routing.cc | 12 +-- examples/routing/simple-global-routing.cc | 18 ++--- examples/routing/simple-routing-ping6.cc | 8 +- examples/routing/static-routing-slash32.cc | 12 +-- .../socket/socket-bound-static-routing.cc | 28 +++---- .../socket/socket-bound-tcp-static-routing.cc | 30 ++++---- examples/stats/wifi-example-apps.cc | 68 ++++++++--------- examples/stats/wifi-example-apps.h | 6 +- examples/stats/wifi-example-sim.cc | 38 +++++----- examples/tcp/star.cc | 4 +- examples/tcp/tcp-large-transfer.cc | 4 +- examples/tcp/tcp-nsc-lfn.cc | 6 +- examples/tcp/tcp-nsc-zoo.cc | 16 ++-- examples/tcp/tcp-star-server.cc | 44 +++++------ examples/tutorial/fifth.cc | 6 +- examples/tutorial/first.cc | 2 +- examples/tutorial/fourth.cc | 6 +- examples/tutorial/hello-simulator.cc | 2 +- examples/tutorial/sixth.cc | 6 +- examples/udp/udp-echo.cc | 2 +- examples/wireless/ofdm-validation.cc | 4 +- examples/wireless/wifi-adhoc.cc | 3 +- examples/wireless/wifi-clear-channel-cmu.cc | 73 ++++++++++--------- examples/wireless/wifi-hidden-terminal.cc | 26 +++---- examples/wireless/wifi-simple-adhoc-grid.cc | 20 ++--- examples/wireless/wifi-simple-adhoc.cc | 6 +- examples/wireless/wifi-simple-interference.cc | 6 +- 40 files changed, 281 insertions(+), 279 deletions(-) diff --git a/examples/energy/energy-model-example.cc b/examples/energy/energy-model-example.cc index bb262c765..6695c42ad 100644 --- a/examples/energy/energy-model-example.cc +++ b/examples/energy/energy-model-example.cc @@ -51,7 +51,7 @@ ReceivePacket (Ptr socket) { InetSocketAddress iaddr = InetSocketAddress::ConvertFrom (from); NS_LOG_UNCOND ("--\nReceived one packet! Socket: "<< iaddr.GetIpv4 () - << " port: " << iaddr.GetPort () << " at time = " << + << " port: " << iaddr.GetPort () << " at time = " << Simulator::Now ().GetSeconds () << "\n--"); } } @@ -68,13 +68,13 @@ ReceivePacket (Ptr socket) */ static void GenerateTraffic (Ptr socket, uint32_t pktSize, Ptr n, - uint32_t pktCount, Time pktInterval) + uint32_t pktCount, Time pktInterval) { if (pktCount > 0) { socket->Send (Create (pktSize)); Simulator::Schedule (pktInterval, &GenerateTraffic, socket, pktSize, n, - pktCount - 1, pktInterval); + pktCount - 1, pktInterval); } else { diff --git a/examples/error-model/simple-error-model.cc b/examples/error-model/simple-error-model.cc index 4ba61d96e..3f5afaf3b 100644 --- a/examples/error-model/simple-error-model.cc +++ b/examples/error-model/simple-error-model.cc @@ -59,7 +59,7 @@ main (int argc, char *argv[]) // Set a few attributes Config::SetDefault ("ns3::RateErrorModel::ErrorRate", DoubleValue (0.01)); Config::SetDefault ("ns3::RateErrorModel::ErrorUnit", StringValue ("EU_PKT")); - + Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (210)); Config::SetDefault ("ns3::OnOffApplication::DataRate", DataRateValue (DataRate ("448kb/s"))); @@ -93,13 +93,13 @@ main (int argc, char *argv[]) p2p.SetDeviceAttribute ("DataRate", DataRateValue (DataRate (1500000))); p2p.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (10))); NetDeviceContainer d3d2 = p2p.Install (n3n2); - - // Later, we add IP addresses. + + // Later, we add IP addresses. NS_LOG_INFO ("Assign IP Addresses."); Ipv4AddressHelper ipv4; ipv4.SetBase ("10.1.1.0", "255.255.255.0"); ipv4.Assign (d0d2); - + ipv4.SetBase ("10.1.2.0", "255.255.255.0"); Ipv4InterfaceContainer i1i2 = ipv4.Assign (d1d2); @@ -115,7 +115,7 @@ main (int argc, char *argv[]) uint16_t port = 9; // Discard port (RFC 863) OnOffHelper onoff ("ns3::UdpSocketFactory", - Address (InetSocketAddress (i3i2.GetAddress (1), port))); + Address (InetSocketAddress (i3i2.GetAddress (1), port))); onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable(1))); onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable(0))); @@ -125,7 +125,7 @@ main (int argc, char *argv[]) // Create an optional packet sink to receive these packets PacketSinkHelper sink ("ns3::UdpSocketFactory", - Address (InetSocketAddress (Ipv4Address::GetAny (), port))); + Address (InetSocketAddress (Ipv4Address::GetAny (), port))); apps = sink.Install (c.Get (2)); apps.Start (Seconds (1.0)); apps.Stop (Seconds (10.0)); @@ -150,7 +150,7 @@ main (int argc, char *argv[]) // Create an ErrorModel based on the implementation (constructor) // specified by the default classId Ptr em = CreateObjectWithAttributes ("RanVar", RandomVariableValue (UniformVariable (0.0, 1.0)), - "ErrorRate", DoubleValue (0.001)); + "ErrorRate", DoubleValue (0.001)); d3d2.Get (0)->SetAttribute ("ReceiveErrorModel", PointerValue (em)); // Now, let's use the ListErrorModel and explicitly force a loss @@ -168,7 +168,7 @@ main (int argc, char *argv[]) p2p.EnablePcapAll ("simple-error-model"); NS_LOG_INFO ("Run Simulation."); - Simulator::Run (); + Simulator::Run (); Simulator::Destroy (); NS_LOG_INFO ("Done."); } diff --git a/examples/ipv6/fragmentation-ipv6.cc b/examples/ipv6/fragmentation-ipv6.cc index ad448efee..b80fc449e 100644 --- a/examples/ipv6/fragmentation-ipv6.cc +++ b/examples/ipv6/fragmentation-ipv6.cc @@ -82,10 +82,10 @@ public: { route = routing->GetRoute (i); std::cout << route.GetDest () << "\t" - << route.GetGateway () << "\t" - << route.GetInterface () << "\t" - << route.GetPrefixToUse () << "\t" - << std::endl; + << route.GetGateway () << "\t" + << route.GetInterface () << "\t" + << route.GetPrefixToUse () << "\t" + << std::endl; } } }; diff --git a/examples/ipv6/icmpv6-redirect.cc b/examples/ipv6/icmpv6-redirect.cc index b8ea39190..7d9aaf4f5 100644 --- a/examples/ipv6/icmpv6-redirect.cc +++ b/examples/ipv6/icmpv6-redirect.cc @@ -82,10 +82,10 @@ public: { route = routing->GetRoute (i); std::cout << route.GetDest () << "\t" - << route.GetGateway () << "\t" - << route.GetInterface () << "\t" - << route.GetPrefixToUse () << "\t" - << std::endl; + << route.GetGateway () << "\t" + << route.GetInterface () << "\t" + << route.GetPrefixToUse () << "\t" + << std::endl; } } diff --git a/examples/ipv6/loose-routing-ipv6.cc b/examples/ipv6/loose-routing-ipv6.cc index 9b636fdaa..0e1c79cf6 100644 --- a/examples/ipv6/loose-routing-ipv6.cc +++ b/examples/ipv6/loose-routing-ipv6.cc @@ -33,8 +33,8 @@ // // +------------+ | | | // // | Host 1 |--| | +------------+ | // // [------------] |---| Router 3 |---| -// // [------------] -// // +// // [------------] +// // // // // // - Tracing of queues and packet receptions to file "loose-routing-ipv6.tr" diff --git a/examples/ipv6/ping6.cc b/examples/ipv6/ping6.cc index 91c967772..7e3425b17 100644 --- a/examples/ipv6/ping6.cc +++ b/examples/ipv6/ping6.cc @@ -20,7 +20,7 @@ // Network topology // -// n0 n1 +// n0 n1 // | | // ================= // LAN diff --git a/examples/ipv6/radvd-two-prefix.cc b/examples/ipv6/radvd-two-prefix.cc index 42bf13ce8..669c37835 100644 --- a/examples/ipv6/radvd-two-prefix.cc +++ b/examples/ipv6/radvd-two-prefix.cc @@ -89,10 +89,10 @@ public: { route = routing->GetRoute (i); std::cout << route.GetDest () << "\t" - << route.GetGateway () << "\t" - << route.GetInterface () << "\t" - << route.GetPrefixToUse () << "\t" - << std::endl; + << route.GetGateway () << "\t" + << route.GetInterface () << "\t" + << route.GetPrefixToUse () << "\t" + << std::endl; } } }; diff --git a/examples/matrix-topology/matrix-topology.cc b/examples/matrix-topology/matrix-topology.cc index d61b03c2d..d82a2bf31 100644 --- a/examples/matrix-topology/matrix-topology.cc +++ b/examples/matrix-topology/matrix-topology.cc @@ -278,7 +278,7 @@ int main (int argc, char *argv[]) bool animEnabled = false; AnimationInterface anim; if (anim.SetServerPort (9) && anim.SetOutputFile (anim_name.c_str ())) - { + { NS_LOG_INFO ("Animation Interface Enabled."); animEnabled = true; anim.StartAnimation (); diff --git a/examples/realtime/realtime-udp-echo.cc b/examples/realtime/realtime-udp-echo.cc index d47aeab91..08ac9be61 100644 --- a/examples/realtime/realtime-udp-echo.cc +++ b/examples/realtime/realtime-udp-echo.cc @@ -50,7 +50,7 @@ main (int argc, char *argv[]) // that. // GlobalValue::Bind ("SimulatorImplementationType", - StringValue ("ns3::RealtimeSimulatorImpl")); + StringValue ("ns3::RealtimeSimulatorImpl")); // // Explicitly create the nodes required by the topology (shown above). diff --git a/examples/routing/dynamic-global-routing.cc b/examples/routing/dynamic-global-routing.cc index 23fbea7ba..84d560ec7 100644 --- a/examples/routing/dynamic-global-routing.cc +++ b/examples/routing/dynamic-global-routing.cc @@ -50,7 +50,7 @@ // keeps the point-to-point link "up" from n1's perspective). Traffic will // flow through the path n1-n2-n5-n6 // At time 8s, bring the interface back up. Path n1-n6 is restored -// At time 10s, stop the first flow. +// At time 10s, stop the first flow. // At time 11s, start a new flow, but to n6's other IP address (the one // on the n1/n6 p2p link) // At time 12s, bring the n1 interface down between n1 and n6. Packets @@ -58,7 +58,7 @@ // At time 14s, re-enable the n1/n6 interface to up. This will change // routing back to n1-n6 since the interface up notification will cause // a new local interface route, at higher priority than global routing -// At time 16s, stop the second flow. +// At time 16s, stop the second flow. // - Tracing of queues and packet receptions to file "dynamic-global-routing.tr" @@ -122,8 +122,8 @@ main (int argc, char *argv[]) csma.SetChannelAttribute ("DataRate", StringValue ("5Mbps")); csma.SetChannelAttribute ("Delay", StringValue ("2ms")); NetDeviceContainer d2345 = csma.Install (n2345); - - // Later, we add IP addresses. + + // Later, we add IP addresses. NS_LOG_INFO ("Assign IP Addresses."); Ipv4AddressHelper ipv4; ipv4.SetBase ("10.1.1.0", "255.255.255.0"); @@ -163,7 +163,7 @@ main (int argc, char *argv[]) // Create a second OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s OnOffHelper onoff2 ("ns3::UdpSocketFactory", - InetSocketAddress (i1i6.GetAddress (1), port)); + InetSocketAddress (i1i6.GetAddress (1), port)); onoff2.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); onoff2.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); onoff2.SetAttribute ("DataRate", StringValue ("2kbps")); @@ -175,13 +175,13 @@ main (int argc, char *argv[]) // Create an optional packet sink to receive these packets PacketSinkHelper sink ("ns3::UdpSocketFactory", - Address (InetSocketAddress (Ipv4Address::GetAny (), port))); + Address (InetSocketAddress (Ipv4Address::GetAny (), port))); apps = sink.Install (c.Get (6)); apps.Start (Seconds (1.0)); apps.Stop (Seconds (10.0)); PacketSinkHelper sink2 ("ns3::UdpSocketFactory", - Address (InetSocketAddress (Ipv4Address::GetAny (), port))); + Address (InetSocketAddress (Ipv4Address::GetAny (), port))); apps2 = sink2.Install (c.Get (6)); apps2.Start (Seconds (11.0)); apps2.Stop (Seconds (16.0)); diff --git a/examples/routing/global-injection-slash32.cc b/examples/routing/global-injection-slash32.cc index 5fcc0a6d2..87e8e0174 100644 --- a/examples/routing/global-injection-slash32.cc +++ b/examples/routing/global-injection-slash32.cc @@ -79,7 +79,7 @@ main (int argc, char *argv[]) NetDeviceContainer dAdB = p2p.Install (nAnB); NetDeviceContainer dBdC = p2p.Install (nBnC);; - + Ptr deviceA = CreateObject (); deviceA->SetAddress (Mac48Address::Allocate ()); nA->AddDevice (deviceA); @@ -88,7 +88,7 @@ main (int argc, char *argv[]) deviceC->SetAddress (Mac48Address::Allocate ()); nC->AddDevice (deviceC); - // Later, we add IP addresses. + // Later, we add IP addresses. Ipv4AddressHelper ipv4; ipv4.SetBase ("10.1.1.0", "255.255.255.252"); Ipv4InterfaceContainer iAiB = ipv4.Assign (dAdB); @@ -99,10 +99,10 @@ main (int argc, char *argv[]) Ptr ipv4A = nA->GetObject (); Ptr ipv4B = nB->GetObject (); Ptr ipv4C = nC->GetObject (); - + int32_t ifIndexA = ipv4A->AddInterface (deviceA); int32_t ifIndexC = ipv4C->AddInterface (deviceC); - + Ipv4InterfaceAddress ifInAddrA = Ipv4InterfaceAddress (Ipv4Address ("172.16.1.1"), Ipv4Mask ("255.255.255.255")); ipv4A->AddAddress (ifIndexA, ifInAddrA); ipv4A->SetMetric (ifIndexA, 1); @@ -115,7 +115,7 @@ main (int argc, char *argv[]) // Create router nodes, initialize routing database and set up the routing // tables in the nodes. - + // Populate routing tables for nodes nA and nB Ipv4GlobalRoutingHelper::PopulateRoutingTables (); // Inject global routes from Node B, including transit network... @@ -123,19 +123,19 @@ main (int argc, char *argv[]) globalRouterB->InjectRoute ("10.1.1.4", "255.255.255.252"); // ...and the host in network "C" globalRouterB->InjectRoute ("192.168.1.1", "255.255.255.255"); - + Ipv4GlobalRoutingHelper::RecomputeRoutingTables(); // In addition, nB needs a static route to nC so it knows what to do with stuff // going to 192.168.1.1 Ipv4StaticRoutingHelper ipv4RoutingHelper; Ptr staticRoutingB = ipv4RoutingHelper.GetStaticRouting(ipv4B); staticRoutingB->AddHostRouteTo (Ipv4Address ("192.168.1.1"), Ipv4Address ("10.1.1.6"),2); - + // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s uint16_t port = 9; // Discard port (RFC 863) OnOffHelper onoff ("ns3::UdpSocketFactory", - Address (InetSocketAddress (ifInAddrC.GetLocal(), port))); + Address (InetSocketAddress (ifInAddrC.GetLocal(), port))); onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000))); @@ -145,7 +145,7 @@ main (int argc, char *argv[]) // Create a packet sink to receive these packets PacketSinkHelper sink ("ns3::UdpSocketFactory", - Address (InetSocketAddress (Ipv4Address::GetAny (), port))); + Address (InetSocketAddress (Ipv4Address::GetAny (), port))); apps = sink.Install (nC); apps.Start (Seconds (1.0)); apps.Stop (Seconds (10.0)); diff --git a/examples/routing/global-routing-slash32.cc b/examples/routing/global-routing-slash32.cc index 7b7b90cea..c237dfe4f 100644 --- a/examples/routing/global-routing-slash32.cc +++ b/examples/routing/global-routing-slash32.cc @@ -65,7 +65,7 @@ main (int argc, char *argv[]) NetDeviceContainer dAdB = p2p.Install (nAnB); NetDeviceContainer dBdC = p2p.Install (nBnC);; - + Ptr deviceA = CreateObject (); deviceA->SetAddress (Mac48Address::Allocate ()); nA->AddDevice (deviceA); @@ -74,7 +74,7 @@ main (int argc, char *argv[]) deviceC->SetAddress (Mac48Address::Allocate ()); nC->AddDevice (deviceC); - // Later, we add IP addresses. + // Later, we add IP addresses. Ipv4AddressHelper ipv4; ipv4.SetBase ("10.1.1.0", "255.255.255.252"); Ipv4InterfaceContainer iAiB = ipv4.Assign (dAdB); @@ -84,10 +84,10 @@ main (int argc, char *argv[]) Ptr ipv4A = nA->GetObject (); Ptr ipv4C = nC->GetObject (); - + int32_t ifIndexA = ipv4A->AddInterface (deviceA); int32_t ifIndexC = ipv4C->AddInterface (deviceC); - + Ipv4InterfaceAddress ifInAddrA = Ipv4InterfaceAddress (Ipv4Address ("172.16.1.1"), Ipv4Mask ("255.255.255.255")); ipv4A->AddAddress (ifIndexA, ifInAddrA); ipv4A->SetMetric (ifIndexA, 1); @@ -106,7 +106,7 @@ main (int argc, char *argv[]) // 210 bytes at a rate of 448 Kb/s uint16_t port = 9; // Discard port (RFC 863) OnOffHelper onoff ("ns3::UdpSocketFactory", - Address (InetSocketAddress (ifInAddrC.GetLocal(), port))); + Address (InetSocketAddress (ifInAddrC.GetLocal(), port))); onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000))); @@ -116,7 +116,7 @@ main (int argc, char *argv[]) // Create a packet sink to receive these packets PacketSinkHelper sink ("ns3::UdpSocketFactory", - Address (InetSocketAddress (Ipv4Address::GetAny (), port))); + Address (InetSocketAddress (Ipv4Address::GetAny (), port))); apps = sink.Install (nC); apps.Start (Seconds (1.0)); apps.Stop (Seconds (10.0)); diff --git a/examples/routing/mixed-global-routing.cc b/examples/routing/mixed-global-routing.cc index 02f7bb50f..99cf8e35a 100644 --- a/examples/routing/mixed-global-routing.cc +++ b/examples/routing/mixed-global-routing.cc @@ -87,8 +87,8 @@ main (int argc, char *argv[]) csma.SetChannelAttribute ("DataRate", StringValue ("5Mbps")); csma.SetChannelAttribute ("Delay", StringValue ("2ms")); NetDeviceContainer d2345 = csma.Install (n2345); - - // Later, we add IP addresses. + + // Later, we add IP addresses. NS_LOG_INFO ("Assign IP Addresses."); Ipv4AddressHelper ipv4; ipv4.SetBase ("10.1.1.0", "255.255.255.0"); diff --git a/examples/routing/simple-alternate-routing.cc b/examples/routing/simple-alternate-routing.cc index 19b68add8..2c0b185e3 100644 --- a/examples/routing/simple-alternate-routing.cc +++ b/examples/routing/simple-alternate-routing.cc @@ -109,17 +109,17 @@ main (int argc, char *argv[]) InternetStackHelper internet; internet.Install (c); - + // Later, we add IP addresses. The middle two octets correspond to - // the channel number. + // the channel number. NS_LOG_INFO ("Assign IP Addresses."); Ipv4AddressHelper ipv4; ipv4.SetBase ("10.0.0.0", "255.255.255.0"); ipv4.Assign (d0d2); - + ipv4.SetBase ("10.1.1.0", "255.255.255.0"); Ipv4InterfaceContainer i1i2 = ipv4.Assign (d1d2); - + ipv4.SetBase ("10.2.2.0", "255.255.255.0"); ipv4.Assign (d3d2); @@ -139,7 +139,7 @@ main (int argc, char *argv[]) // Create a flow from n3 to n1, starting at time 1.1 seconds OnOffHelper onoff ("ns3::UdpSocketFactory", - Address (InetSocketAddress (i1i2.GetAddress (0), port))); + Address (InetSocketAddress (i1i2.GetAddress (0), port))); onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); @@ -149,7 +149,7 @@ main (int argc, char *argv[]) // Create a packet sink to receive these packets PacketSinkHelper sink ("ns3::UdpSocketFactory", - Address (InetSocketAddress (Ipv4Address::GetAny (), port))); + Address (InetSocketAddress (Ipv4Address::GetAny (), port))); apps = sink.Install (c.Get (1)); apps.Start (Seconds (1.1)); apps.Stop (Seconds (10.0)); diff --git a/examples/routing/simple-global-routing.cc b/examples/routing/simple-global-routing.cc index 664f1400c..915e60f30 100644 --- a/examples/routing/simple-global-routing.cc +++ b/examples/routing/simple-global-routing.cc @@ -64,7 +64,7 @@ main (int argc, char *argv[]) Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (210)); Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue ("448kb/s")); - //DefaultValue::Bind ("DropTailQueue::m_maxPackets", 30); + //DefaultValue::Bind ("DropTailQueue::m_maxPackets", 30); // Allow the user to override any of the defaults and the above // DefaultValue::Bind ()s at run-time, via command-line arguments @@ -93,12 +93,12 @@ main (int argc, char *argv[]) NetDeviceContainer d0d2 = p2p.Install (n0n2); NetDeviceContainer d1d2 = p2p.Install (n1n2); - + p2p.SetDeviceAttribute ("DataRate", StringValue ("1500kbps")); p2p.SetChannelAttribute ("Delay", StringValue ("10ms")); NetDeviceContainer d3d2 = p2p.Install (n3n2); - - // Later, we add IP addresses. + + // Later, we add IP addresses. NS_LOG_INFO ("Assign IP Addresses."); Ipv4AddressHelper ipv4; ipv4.SetBase ("10.1.1.0", "255.255.255.0"); @@ -106,7 +106,7 @@ main (int argc, char *argv[]) ipv4.SetBase ("10.1.2.0", "255.255.255.0"); Ipv4InterfaceContainer i1i2 = ipv4.Assign (d1d2); - + ipv4.SetBase ("10.1.3.0", "255.255.255.0"); Ipv4InterfaceContainer i3i2 = ipv4.Assign (d3d2); @@ -119,7 +119,7 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Create Applications."); uint16_t port = 9; // Discard port (RFC 863) OnOffHelper onoff ("ns3::UdpSocketFactory", - Address (InetSocketAddress (i3i2.GetAddress (0), port))); + Address (InetSocketAddress (i3i2.GetAddress (0), port))); onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); ApplicationContainer apps = onoff.Install (c.Get (0)); @@ -128,14 +128,14 @@ main (int argc, char *argv[]) // Create a packet sink to receive these packets PacketSinkHelper sink ("ns3::UdpSocketFactory", - Address (InetSocketAddress (Ipv4Address::GetAny (), port))); + Address (InetSocketAddress (Ipv4Address::GetAny (), port))); apps = sink.Install (c.Get (3)); apps.Start (Seconds (1.0)); apps.Stop (Seconds (10.0)); // Create a similar flow from n3 to n1, starting at time 1.1 seconds onoff.SetAttribute ("Remote", - AddressValue (InetSocketAddress (i1i2.GetAddress (0), port))); + AddressValue (InetSocketAddress (i1i2.GetAddress (0), port))); apps = onoff.Install (c.Get (3)); apps.Start (Seconds (1.1)); apps.Stop (Seconds (10.0)); @@ -155,7 +155,7 @@ main (int argc, char *argv[]) { FlowMonitorHelper flowmonHelper; flowmon = flowmonHelper.InstallAll (); - } + } NS_LOG_INFO ("Run Simulation."); Simulator::Stop (Seconds (11)); diff --git a/examples/routing/simple-routing-ping6.cc b/examples/routing/simple-routing-ping6.cc index ed338253b..0a707fe1c 100644 --- a/examples/routing/simple-routing-ping6.cc +++ b/examples/routing/simple-routing-ping6.cc @@ -83,10 +83,10 @@ public: { route = routing->GetRoute (i); std::cout << route.GetDest () << "\t" - << route.GetGateway () << "\t" - << route.GetInterface () << "\t" - << route.GetPrefixToUse () << "\t" - << std::endl; + << route.GetGateway () << "\t" + << route.GetInterface () << "\t" + << route.GetPrefixToUse () << "\t" + << std::endl; } } }; diff --git a/examples/routing/static-routing-slash32.cc b/examples/routing/static-routing-slash32.cc index 13455432f..d78d2ddf4 100644 --- a/examples/routing/static-routing-slash32.cc +++ b/examples/routing/static-routing-slash32.cc @@ -65,7 +65,7 @@ main (int argc, char *argv[]) NetDeviceContainer dAdB = p2p.Install (nAnB); NetDeviceContainer dBdC = p2p.Install (nBnC);; - + Ptr deviceA = CreateObject (); deviceA->SetAddress (Mac48Address::Allocate ()); nA->AddDevice (deviceA); @@ -74,7 +74,7 @@ main (int argc, char *argv[]) deviceC->SetAddress (Mac48Address::Allocate ()); nC->AddDevice (deviceC); - // Later, we add IP addresses. + // Later, we add IP addresses. Ipv4AddressHelper ipv4; ipv4.SetBase ("10.1.1.0", "255.255.255.252"); Ipv4InterfaceContainer iAiB = ipv4.Assign (dAdB); @@ -85,10 +85,10 @@ main (int argc, char *argv[]) Ptr ipv4A = nA->GetObject (); Ptr ipv4B = nB->GetObject (); Ptr ipv4C = nC->GetObject (); - + int32_t ifIndexA = ipv4A->AddInterface (deviceA); int32_t ifIndexC = ipv4C->AddInterface (deviceC); - + Ipv4InterfaceAddress ifInAddrA = Ipv4InterfaceAddress (Ipv4Address ("172.16.1.1"), Ipv4Mask ("/32")); ipv4A->AddAddress (ifIndexA, ifInAddrA); ipv4A->SetMetric (ifIndexA, 1); @@ -111,7 +111,7 @@ main (int argc, char *argv[]) // 210 bytes at a rate of 448 Kb/s uint16_t port = 9; // Discard port (RFC 863) OnOffHelper onoff ("ns3::UdpSocketFactory", - Address (InetSocketAddress (ifInAddrC.GetLocal (), port))); + Address (InetSocketAddress (ifInAddrC.GetLocal (), port))); onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000))); @@ -121,7 +121,7 @@ main (int argc, char *argv[]) // Create a packet sink to receive these packets PacketSinkHelper sink ("ns3::UdpSocketFactory", - Address (InetSocketAddress (Ipv4Address::GetAny (), port))); + Address (InetSocketAddress (Ipv4Address::GetAny (), port))); apps = sink.Install (nC); apps.Start (Seconds (1.0)); apps.Stop (Seconds (10.0)); diff --git a/examples/socket/socket-bound-static-routing.cc b/examples/socket/socket-bound-static-routing.cc index 037a38e02..0efa9d446 100644 --- a/examples/socket/socket-bound-static-routing.cc +++ b/examples/socket/socket-bound-static-routing.cc @@ -22,7 +22,7 @@ | 10.20.1.0/24 DSTRTR 10.10.1.0/24 / \ 10.10.2.0/24 - / \ + / \ Rtr1 Rtr2 10.1.1.0/24 | | 10.1.2.0/24 | / @@ -65,7 +65,7 @@ main (int argc, char *argv[]) Ptr nRtr1 = CreateObject (); Ptr nRtr2 = CreateObject (); Ptr nDstRtr = CreateObject (); - + NodeContainer c = NodeContainer (nSrc, nDst, nRtr1, nRtr2, nDstRtr); InternetStackHelper internet; @@ -77,7 +77,7 @@ main (int argc, char *argv[]) NodeContainer nRtr1nDstRtr = NodeContainer (nRtr1, nDstRtr); NodeContainer nRtr2nDstRtr = NodeContainer (nRtr2, nDstRtr); NodeContainer nDstRtrnDst = NodeContainer (nDstRtr, nDst); - + // We create the channels first without any IP addressing information PointToPointHelper p2p; p2p.SetDeviceAttribute ("DataRate", StringValue ("5Mbps")); @@ -87,11 +87,11 @@ main (int argc, char *argv[]) NetDeviceContainer dRtr1dDstRtr = p2p.Install (nRtr1nDstRtr); NetDeviceContainer dRtr2dDstRtr = p2p.Install (nRtr2nDstRtr); NetDeviceContainer dDstRtrdDst = p2p.Install (nDstRtrnDst); - + Ptr SrcToRtr1=dSrcdRtr1.Get (0); Ptr SrcToRtr2=dSrcdRtr2.Get (0); - - // Later, we add IP addresses. + + // Later, we add IP addresses. Ipv4AddressHelper ipv4; ipv4.SetBase ("10.1.1.0", "255.255.255.0"); Ipv4InterfaceContainer iSrciRtr1 = ipv4.Assign (dSrcdRtr1); @@ -109,7 +109,7 @@ main (int argc, char *argv[]) Ptr ipv4Rtr2 = nRtr2->GetObject (); Ptr ipv4DstRtr = nDstRtr->GetObject (); Ptr ipv4Dst = nDst->GetObject (); - + Ipv4StaticRoutingHelper ipv4RoutingHelper; Ptr staticRoutingSrc = ipv4RoutingHelper.GetStaticRouting (ipv4Src); Ptr staticRoutingRtr1 = ipv4RoutingHelper.GetStaticRouting (ipv4Rtr1); @@ -120,33 +120,33 @@ main (int argc, char *argv[]) // Create static routes from Src to Dst staticRoutingRtr1->AddHostRouteTo (Ipv4Address ("10.20.1.2"), Ipv4Address ("10.10.1.2"), 2); staticRoutingRtr2->AddHostRouteTo (Ipv4Address ("10.20.1.2"), Ipv4Address ("10.10.2.2"), 2); - + // Two routes to same destination - setting separate metrics. // You can switch these to see how traffic gets diverted via different routes staticRoutingSrc->AddHostRouteTo (Ipv4Address ("10.20.1.2"), Ipv4Address ("10.1.1.2"), 1,5); staticRoutingSrc->AddHostRouteTo (Ipv4Address ("10.20.1.2"), Ipv4Address ("10.1.2.2"), 2,10); - + // Creating static routes from DST to Source pointing to Rtr1 VIA Rtr2(!) staticRoutingDst->AddHostRouteTo (Ipv4Address ("10.1.1.1"), Ipv4Address ("10.20.1.1"), 1); staticRoutingDstRtr->AddHostRouteTo (Ipv4Address ("10.1.1.1"), Ipv4Address ("10.10.2.1"), 2); staticRoutingRtr2->AddHostRouteTo (Ipv4Address ("10.1.1.1"), Ipv4Address ("10.1.2.1"), 1); - + Ipv4InterfaceAddress ifInAddrSrc=ipv4Src->GetAddress (1,0); - + // There are no apps that can utilize the Socket Option so doing the work directly.. // Taken from tcp-large-transfer example Ptr srcSocket = Socket::CreateSocket (nSrc, TypeId::LookupByName ("ns3::UdpSocketFactory")); srcSocket->Bind (); srcSocket->SetRecvCallback (MakeCallback (&srcSocketRecv)); - + Ptr dstSocket = Socket::CreateSocket (nDst, TypeId::LookupByName ("ns3::UdpSocketFactory")); uint16_t dstport = 12345; Ipv4Address dstaddr ("10.20.1.2"); InetSocketAddress dst = InetSocketAddress (dstaddr, dstport); dstSocket->Bind (dst); dstSocket->SetRecvCallback (MakeCallback (&dstSocketRecv)); - + AsciiTraceHelper ascii; p2p.EnableAsciiAll (ascii.CreateFileStream ("socket-bound-static-routing.tr")); p2p.EnablePcapAll ("socket-bound-static-routing"); @@ -201,7 +201,7 @@ srcSocketRecv (Ptr socket) { NS_LOG_INFO ("Socket was bound"); } - else + else { NS_LOG_INFO ("Socket was not bound"); } diff --git a/examples/socket/socket-bound-tcp-static-routing.cc b/examples/socket/socket-bound-tcp-static-routing.cc index 2d588314b..ccae31067 100644 --- a/examples/socket/socket-bound-tcp-static-routing.cc +++ b/examples/socket/socket-bound-tcp-static-routing.cc @@ -22,7 +22,7 @@ | 10.20.1.0/24 DSTRTR 10.10.1.0/24 / \ 10.10.2.0/24 - / \ + / \ Rtr1 Rtr2 10.1.1.0/24 | | 10.1.2.0/24 | / @@ -75,7 +75,7 @@ main (int argc, char *argv[]) Ptr nRtr1 = CreateObject (); Ptr nRtr2 = CreateObject (); Ptr nDstRtr = CreateObject (); - + NodeContainer c = NodeContainer (nSrc, nDst, nRtr1, nRtr2, nDstRtr); InternetStackHelper internet; @@ -87,7 +87,7 @@ main (int argc, char *argv[]) NodeContainer nRtr1nDstRtr = NodeContainer (nRtr1, nDstRtr); NodeContainer nRtr2nDstRtr = NodeContainer (nRtr2, nDstRtr); NodeContainer nDstRtrnDst = NodeContainer (nDstRtr, nDst); - + // We create the channels first without any IP addressing information PointToPointHelper p2p; p2p.SetDeviceAttribute ("DataRate", StringValue ("5Mbps")); @@ -97,11 +97,11 @@ main (int argc, char *argv[]) NetDeviceContainer dRtr1dDstRtr = p2p.Install (nRtr1nDstRtr); NetDeviceContainer dRtr2dDstRtr = p2p.Install (nRtr2nDstRtr); NetDeviceContainer dDstRtrdDst = p2p.Install (nDstRtrnDst); - + Ptr SrcToRtr1=dSrcdRtr1.Get (0); Ptr SrcToRtr2=dSrcdRtr2.Get (0); - - // Later, we add IP addresses. + + // Later, we add IP addresses. Ipv4AddressHelper ipv4; ipv4.SetBase ("10.1.1.0", "255.255.255.0"); Ipv4InterfaceContainer iSrciRtr1 = ipv4.Assign (dSrcdRtr1); @@ -119,7 +119,7 @@ main (int argc, char *argv[]) Ptr ipv4Rtr2 = nRtr2->GetObject (); Ptr ipv4DstRtr = nDstRtr->GetObject (); Ptr ipv4Dst = nDst->GetObject (); - + Ipv4StaticRoutingHelper ipv4RoutingHelper; Ptr staticRoutingSrc = ipv4RoutingHelper.GetStaticRouting (ipv4Src); Ptr staticRoutingRtr1 = ipv4RoutingHelper.GetStaticRouting (ipv4Rtr1); @@ -130,23 +130,23 @@ main (int argc, char *argv[]) // Create static routes from Src to Dst staticRoutingRtr1->AddHostRouteTo (Ipv4Address ("10.20.1.2"), Ipv4Address ("10.10.1.2"), 2); staticRoutingRtr2->AddHostRouteTo (Ipv4Address ("10.20.1.2"), Ipv4Address ("10.10.2.2"), 2); - + // Two routes to same destination - setting separate metrics. // You can switch these to see how traffic gets diverted via different routes staticRoutingSrc->AddHostRouteTo (Ipv4Address ("10.20.1.2"), Ipv4Address ("10.1.1.2"), 1,5); staticRoutingSrc->AddHostRouteTo (Ipv4Address ("10.20.1.2"), Ipv4Address ("10.1.2.2"), 2,10); - + // Creating static routes from DST to Source pointing to Rtr1 VIA Rtr2(!) staticRoutingDst->AddHostRouteTo (Ipv4Address ("10.1.1.1"), Ipv4Address ("10.20.1.1"), 1); staticRoutingDstRtr->AddHostRouteTo (Ipv4Address ("10.1.1.1"), Ipv4Address ("10.10.2.1"), 2); staticRoutingRtr2->AddHostRouteTo (Ipv4Address ("10.1.1.1"), Ipv4Address ("10.1.2.1"), 1); - + staticRoutingDst->AddHostRouteTo (Ipv4Address ("10.1.2.1"), Ipv4Address ("10.20.1.1"), 1); staticRoutingDstRtr->AddHostRouteTo (Ipv4Address ("10.1.2.1"), Ipv4Address ("10.10.2.1"), 2); staticRoutingRtr2->AddHostRouteTo (Ipv4Address ("10.1.2.1"), Ipv4Address ("10.1.2.1"), 1); Ipv4InterfaceAddress ifInAddrSrc=ipv4Src->GetAddress (1,0); - + // There are no apps that can utilize the Socket Option so doing the work directly.. // Taken from tcp-large-transfer example @@ -155,15 +155,15 @@ main (int argc, char *argv[]) Ptr srcSocket3 = Socket::CreateSocket (nSrc, TypeId::LookupByName ("ns3::TcpSocketFactory")); Ptr srcSocket4 = Socket::CreateSocket (nSrc, TypeId::LookupByName ("ns3::TcpSocketFactory")); - + uint16_t dstport = 12345; Ipv4Address dstaddr ("10.20.1.2"); - + PacketSinkHelper sink ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny(), dstport)); ApplicationContainer apps = sink.Install (nDst); apps.Start (Seconds (0.0)); apps.Stop (Seconds (10.0)); - + AsciiTraceHelper ascii; p2p.EnableAsciiAll (ascii.CreateFileStream ("socket-bound-tcp-static-routing.tr")); p2p.EnablePcapAll ("socket-bound-tcp-static-routing"); @@ -204,7 +204,7 @@ void StartFlow(Ptr localSocket, NS_LOG_INFO ("Starting flow at time " << Simulator::Now ().GetSeconds ()); currentTxBytes = 0; localSocket->Bind (); - localSocket->Connect (InetSocketAddress (servAddress, servPort));//connect + localSocket->Connect (InetSocketAddress (servAddress, servPort)); //connect // tell the tcp implementation to call WriteUntilBufferFull again // if we blocked and new tx buffer space becomes available diff --git a/examples/stats/wifi-example-apps.cc b/examples/stats/wifi-example-apps.cc index c52830824..6f3158c0d 100644 --- a/examples/stats/wifi-example-apps.cc +++ b/examples/stats/wifi-example-apps.cc @@ -67,7 +67,7 @@ Sender::GetTypeId(void) MakeRandomVariableChecker()) .AddTraceSource ("Tx", "A new packet is created and is sent", MakeTraceSourceAccessor (&Sender::m_txTrace)) - ; + ; return tid; } @@ -99,10 +99,10 @@ void Sender::StartApplication() if (m_socket == 0) { Ptr socketFactory = GetNode()->GetObject - (UdpSocketFactory::GetTypeId()); + (UdpSocketFactory::GetTypeId()); m_socket = socketFactory->CreateSocket (); m_socket->Bind (); - } + } m_count = 0; @@ -118,7 +118,7 @@ void Sender::StopApplication() Simulator::Cancel(m_sendEvent); // end Sender::StopApplication } - + void Sender::SendPacket() { // NS_LOG_FUNCTION_NOARGS (); @@ -139,9 +139,9 @@ void Sender::SendPacket() m_txTrace(packet); if (++m_count < m_numPkts) { - m_sendEvent = Simulator::Schedule(Seconds(m_interval.GetValue()), - &Sender::SendPacket, this); - } + m_sendEvent = Simulator::Schedule(Seconds(m_interval.GetValue()), + &Sender::SendPacket, this); + } // end Sender::SendPacket } @@ -162,7 +162,7 @@ Receiver::GetTypeId(void) UintegerValue(1603), MakeUintegerAccessor(&Receiver::m_port), MakeUintegerChecker()) - ; + ; return tid; } @@ -196,12 +196,12 @@ Receiver::StartApplication() if (m_socket == 0) { Ptr socketFactory = GetNode()->GetObject - (UdpSocketFactory::GetTypeId()); + (UdpSocketFactory::GetTypeId()); m_socket = socketFactory->CreateSocket(); InetSocketAddress local = InetSocketAddress(Ipv4Address::GetAny(), m_port); m_socket->Bind(local); - } + } m_socket->SetRecvCallback(MakeCallback(&Receiver::Receive, this)); @@ -215,7 +215,7 @@ Receiver::StopApplication() if (m_socket != 0) { m_socket->SetRecvCallback(MakeNullCallback > ()); - } + } // end Receiver::StopApplication } @@ -241,30 +241,30 @@ Receiver::Receive(Ptr socket) Ptr packet; Address from; while (packet = socket->RecvFrom(from)) { - if (InetSocketAddress::IsMatchingType (from)) { - InetSocketAddress address = InetSocketAddress::ConvertFrom (from); - NS_LOG_INFO ("Received " << packet->GetSize() << " bytes from " << - address.GetIpv4()); + if (InetSocketAddress::IsMatchingType (from)) { + InetSocketAddress address = InetSocketAddress::ConvertFrom (from); + NS_LOG_INFO ("Received " << packet->GetSize() << " bytes from " << + address.GetIpv4()); + } + + TimestampTag timestamp; + // Should never not be found since the sender is adding it, but + // you never know. + if (packet->FindFirstMatchingByteTag(timestamp)) { + Time tx = timestamp.GetTimestamp(); + + if (m_delay != 0) { + m_delay->Update(Simulator::Now() - tx); + } + } + + if (m_calc != 0) { + m_calc->Update(); + } + + // end receiving packets } - TimestampTag timestamp; - // Should never not be found since the sender is adding it, but - // you never know. - if (packet->FindFirstMatchingByteTag(timestamp)) { - Time tx = timestamp.GetTimestamp(); - - if (m_delay != 0) { - m_delay->Update(Simulator::Now() - tx); - } - } - - if (m_calc != 0) { - m_calc->Update(); - } - - // end receiving packets - } - // end Receiver::Receive } @@ -285,7 +285,7 @@ TimestampTag::GetTypeId(void) EmptyAttributeValue(), MakeTimeAccessor(&TimestampTag::GetTimestamp), MakeTimeChecker()) - ; + ; return tid; } TypeId diff --git a/examples/stats/wifi-example-apps.h b/examples/stats/wifi-example-apps.h index 8dc70c600..564a952a8 100644 --- a/examples/stats/wifi-example-apps.h +++ b/examples/stats/wifi-example-apps.h @@ -37,7 +37,7 @@ using namespace ns3; //---------------------------------------------------------------------- //------------------------------------------------------ -class Sender: public Application { +class Sender : public Application { public: static TypeId GetTypeId(void); Sender(); @@ -72,7 +72,7 @@ private: //------------------------------------------------------ -class Receiver: public Application { +class Receiver : public Application { public: static TypeId GetTypeId(void); Receiver(); @@ -112,7 +112,7 @@ public: virtual uint32_t GetSerializedSize (void) const; virtual void Serialize (TagBuffer i) const; virtual void Deserialize (TagBuffer i); - + // these are our accessors to our tag structure void SetTimestamp(Time time); Time GetTimestamp(void) const; diff --git a/examples/stats/wifi-example-sim.cc b/examples/stats/wifi-example-sim.cc index 48f0f7239..aad5709d2 100644 --- a/examples/stats/wifi-example-sim.cc +++ b/examples/stats/wifi-example-sim.cc @@ -99,21 +99,21 @@ int main(int argc, char *argv[]) { cmd.Parse (argc, argv); if (format != "omnet" && format != "db") { - NS_LOG_ERROR("Unknown output format '" << format << "'"); - return -1; - } + NS_LOG_ERROR("Unknown output format '" << format << "'"); + return -1; + } #ifndef STATS_HAS_SQLITE3 if (format == "db") { NS_LOG_ERROR("sqlite support not compiled in."); return -1; - } + } #endif { - stringstream sstr(""); - sstr << distance; - input = sstr.str(); + stringstream sstr(""); + sstr << distance; + input = sstr.str(); } @@ -163,12 +163,12 @@ int main(int argc, char *argv[]) { //-- Create a custom traffic source and sink //-------------------------------------------- NS_LOG_INFO ("Create traffic source & sink."); - Ptr appSource = NodeList::GetNode(0); + Ptr appSource = NodeList::GetNode(0); Ptr sender = CreateObject(); appSource->AddApplication(sender); sender->SetStartTime(Seconds(1)); - Ptr appSink = NodeList::GetNode(1); + Ptr appSink = NodeList::GetNode(1); Ptr receiver = CreateObject(); appSink->AddApplication(receiver); receiver->SetStartTime(Seconds(0)); @@ -231,7 +231,7 @@ int main(int argc, char *argv[]) { appTx->SetContext("node[0]"); Config::Connect("/NodeList/0/ApplicationList/*/$Sender/Tx", MakeCallback(&PacketCounterCalculator::PacketUpdate, - appTx)); + appTx)); data.AddDataCalculator(appTx); // Here a counter for received packets is directly manipulated by @@ -271,8 +271,8 @@ int main(int argc, char *argv[]) { appTxPkts->SetContext("node[0]"); Config::Connect("/NodeList/0/ApplicationList/*/$Sender/Tx", MakeCallback - (&PacketSizeMinMaxAvgTotalCalculator::PacketUpdate, - appTxPkts)); + (&PacketSizeMinMaxAvgTotalCalculator::PacketUpdate, + appTxPkts)); data.AddDataCalculator(appTxPkts); @@ -294,7 +294,7 @@ int main(int argc, char *argv[]) { //-- Run the simulation //-------------------------------------------- NS_LOG_INFO("Run Simulation."); - Simulator::Run(); + Simulator::Run(); Simulator::Destroy(); @@ -307,16 +307,16 @@ int main(int argc, char *argv[]) { // Pick an output writer based in the requested format. Ptr output = 0; if (format == "omnet") { - NS_LOG_INFO("Creating omnet formatted data output."); - output = CreateObject(); - } else if (format == "db") { + NS_LOG_INFO("Creating omnet formatted data output."); + output = CreateObject(); + } else if (format == "db") { #ifdef STATS_HAS_SQLITE3 NS_LOG_INFO("Creating sqlite formatted data output."); output = CreateObject(); #endif - } else { - NS_LOG_ERROR("Unknown output format " << format); - } + } else { + NS_LOG_ERROR("Unknown output format " << format); + } // Finally, have that writer interrogate the DataCollector and save // the results. diff --git a/examples/tcp/star.cc b/examples/tcp/star.cc index a167e0de3..b85bb15a5 100644 --- a/examples/tcp/star.cc +++ b/examples/tcp/star.cc @@ -75,7 +75,7 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Create applications."); // - // Create a packet sink on the star "hub" to receive packets. + // Create a packet sink on the star "hub" to receive packets. // uint16_t port = 50000; Address hubLocalAddress (InetSocketAddress (Ipv4Address::GetAny (), port)); @@ -98,7 +98,7 @@ main (int argc, char *argv[]) AddressValue remoteAddress (InetSocketAddress (star.GetHubIpv4Address (i), port)); onOffHelper.SetAttribute ("Remote", remoteAddress); spokeApps.Add (onOffHelper.Install (star.GetSpokeNode (i))); - } + } spokeApps.Start (Seconds (1.0)); spokeApps.Stop (Seconds (10.0)); diff --git a/examples/tcp/tcp-large-transfer.cc b/examples/tcp/tcp-large-transfer.cc index ff5e76a2f..37e7030dc 100644 --- a/examples/tcp/tcp-large-transfer.cc +++ b/examples/tcp/tcp-large-transfer.cc @@ -152,7 +152,7 @@ int main (int argc, char *argv[]) // Create and bind the socket... Ptr localSocket = - Socket::CreateSocket (n0n1.Get (0), TcpSocketFactory::GetTypeId ()); + Socket::CreateSocket (n0n1.Get (0), TcpSocketFactory::GetTypeId ()); localSocket->Bind (); // Trace changes to the congestion window @@ -191,7 +191,7 @@ void StartFlow(Ptr localSocket, uint16_t servPort) { NS_LOG_LOGIC("Starting flow at time " << Simulator::Now ().GetSeconds ()); - localSocket->Connect (InetSocketAddress (servAddress, servPort));//connect + localSocket->Connect (InetSocketAddress (servAddress, servPort)); //connect // tell the tcp implementation to call WriteUntilBufferFull again // if we blocked and new tx buffer space becomes available diff --git a/examples/tcp/tcp-nsc-lfn.cc b/examples/tcp/tcp-nsc-lfn.cc index 54d54ecc4..453994c62 100644 --- a/examples/tcp/tcp-nsc-lfn.cc +++ b/examples/tcp/tcp-nsc-lfn.cc @@ -103,9 +103,9 @@ int main (int argc, char *argv[]) DoubleValue rate(errRate); RandomVariableValue u01(UniformVariable (0.0, 1.0)); Ptr em1 = - CreateObjectWithAttributes ("RanVar", u01, "ErrorRate", rate); + CreateObjectWithAttributes ("RanVar", u01, "ErrorRate", rate); Ptr em2 = - CreateObjectWithAttributes ("RanVar", u01, "ErrorRate", rate); + CreateObjectWithAttributes ("RanVar", u01, "ErrorRate", rate); // This enables the specified errRate on both link endpoints. p2pInterfaces.Get(0)->SetAttribute("ReceiveErrorModel", PointerValue (em1)); @@ -122,7 +122,7 @@ int main (int argc, char *argv[]) // This sets up two TCP flows, one from A -> B, one from B -> A. for (int i = 0, j = 1; i < 2; j--, i++) - { + { Address remoteAddress(InetSocketAddress(ipv4Interfaces.GetAddress (i), servPort)); OnOffHelper clientHelper ("ns3::TcpSocketFactory", remoteAddress); clientHelper.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); diff --git a/examples/tcp/tcp-nsc-zoo.cc b/examples/tcp/tcp-nsc-zoo.cc index ed912e22c..2fef085a3 100644 --- a/examples/tcp/tcp-nsc-zoo.cc +++ b/examples/tcp/tcp-nsc-zoo.cc @@ -57,8 +57,8 @@ int main(int argc, char *argv[]) if (MaxNodes < 2) { - std::cerr << "--nodes: must be >= 2" << std::endl; - return 1; + std::cerr << "--nodes: must be >= 2" << std::endl; + return 1; } csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate(100 * 1000 * 1000))); csma.SetChannelAttribute ("Delay", TimeValue (MicroSeconds (200))); @@ -115,24 +115,24 @@ int main(int argc, char *argv[]) sinkApp.Stop (Seconds (30.0)); // This tells every node on the network to start a flow to all other nodes on the network ... - for (unsigned int i = 0 ; i < MaxNodes;i++) + for (unsigned int i = 0 ; i < MaxNodes; i++) { - for (unsigned int j = 0 ; j < MaxNodes;j++) + for (unsigned int j = 0 ; j < MaxNodes; j++) { if (i == j) { // ...but we don't want a node to talk to itself. - continue; + continue; } Address remoteAddress(InetSocketAddress(ipv4Interfaces.GetAddress (j), servPort)); OnOffHelper clientHelper ("ns3::TcpSocketFactory", remoteAddress); clientHelper.SetAttribute - ("OnTime", RandomVariableValue (ConstantVariable (1))); + ("OnTime", RandomVariableValue (ConstantVariable (1))); clientHelper.SetAttribute - ("OffTime", RandomVariableValue (ConstantVariable (0))); + ("OffTime", RandomVariableValue (ConstantVariable (0))); ApplicationContainer clientApp = clientHelper.Install(n.Get(i)); clientApp.Start (Seconds (j)); /* delay startup depending on node number */ clientApp.Stop (Seconds (j + runtime)); - } + } } csma.EnablePcapAll ("tcp-nsc-zoo", false); diff --git a/examples/tcp/tcp-star-server.cc b/examples/tcp/tcp-star-server.cc index 8ffff68d6..879d28da1 100644 --- a/examples/tcp/tcp-star-server.cc +++ b/examples/tcp/tcp-star-server.cc @@ -22,7 +22,7 @@ \ | / \|/ n1---n0---n5 - /|\ + /| \ / | \ n8 n7 n6 */ @@ -96,9 +96,9 @@ main (int argc, char *argv[]) //Collect an adjacency list of nodes for the p2p topology std::vector nodeAdjacencyList(N-1); for(uint32_t i=0; i deviceAdjacencyList(N-1); for(uint32_t i=0; i interfaceAdjacencyList(N-1); for(uint32_t i=0; i socket, Address address, uint32_t packetSize, uint32_t nPackets, DataRate dataRate); private: - virtual void StartApplication (void); + virtual void StartApplication (void); virtual void StopApplication (void); void ScheduleTx (void); @@ -186,8 +186,8 @@ main (int argc, char *argv[]) devices = pointToPoint.Install (nodes); Ptr em = CreateObjectWithAttributes ( - "RanVar", RandomVariableValue (UniformVariable (0., 1.)), - "ErrorRate", DoubleValue (0.00001)); + "RanVar", RandomVariableValue (UniformVariable (0., 1.)), + "ErrorRate", DoubleValue (0.00001)); devices.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (em)); InternetStackHelper stack; diff --git a/examples/tutorial/first.cc b/examples/tutorial/first.cc index 8e8479c54..cb1481028 100644 --- a/examples/tutorial/first.cc +++ b/examples/tutorial/first.cc @@ -24,7 +24,7 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("FirstScriptExample"); - int +int main (int argc, char *argv[]) { LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO); diff --git a/examples/tutorial/fourth.cc b/examples/tutorial/fourth.cc index 800ae9e48..f1284ce6f 100644 --- a/examples/tutorial/fourth.cc +++ b/examples/tutorial/fourth.cc @@ -20,7 +20,7 @@ #include "ns3/trace-source-accessor.h" #include - + using namespace ns3; class MyObject : public Object @@ -34,10 +34,10 @@ public: .AddTraceSource ("MyInteger", "An integer value to trace.", MakeTraceSourceAccessor (&MyObject::m_myInt)) - ; + ; return tid; } - + MyObject () {} TracedValue m_myInt; }; diff --git a/examples/tutorial/hello-simulator.cc b/examples/tutorial/hello-simulator.cc index 37f99ccd5..70a43a62f 100644 --- a/examples/tutorial/hello-simulator.cc +++ b/examples/tutorial/hello-simulator.cc @@ -20,7 +20,7 @@ NS_LOG_COMPONENT_DEFINE ("HelloSimulator"); using namespace ns3; - int +int main (int argc, char *argv[]) { NS_LOG_UNCOND ("Hello Simulator"); diff --git a/examples/tutorial/sixth.cc b/examples/tutorial/sixth.cc index 70c00a4b0..c0822b83d 100644 --- a/examples/tutorial/sixth.cc +++ b/examples/tutorial/sixth.cc @@ -69,7 +69,7 @@ public: void Setup (Ptr socket, Address address, uint32_t packetSize, uint32_t nPackets, DataRate dataRate); private: - virtual void StartApplication (void); + virtual void StartApplication (void); virtual void StopApplication (void); void ScheduleTx (void); @@ -188,8 +188,8 @@ main (int argc, char *argv[]) devices = pointToPoint.Install (nodes); Ptr em = CreateObjectWithAttributes ( - "RanVar", RandomVariableValue (UniformVariable (0., 1.)), - "ErrorRate", DoubleValue (0.00001)); + "RanVar", RandomVariableValue (UniformVariable (0., 1.)), + "ErrorRate", DoubleValue (0.00001)); devices.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (em)); InternetStackHelper stack; diff --git a/examples/udp/udp-echo.cc b/examples/udp/udp-echo.cc index fd6b07837..8e0c071f7 100644 --- a/examples/udp/udp-echo.cc +++ b/examples/udp/udp-echo.cc @@ -115,7 +115,7 @@ main (int argc, char *argv[]) client.SetFill(apps.Get (0), 0xa5, 1024); - uint8_t fill[] = {0, 1, 2, 3, 4, 5, 6}; + uint8_t fill[] = { 0, 1, 2, 3, 4, 5, 6}; client.SetFill(apps.Get (0), fill, sizeof(fill), 1024); #endif diff --git a/examples/wireless/ofdm-validation.cc b/examples/wireless/ofdm-validation.cc index 87959faa4..9cc417ddb 100644 --- a/examples/wireless/ofdm-validation.cc +++ b/examples/wireless/ofdm-validation.cc @@ -84,7 +84,7 @@ set style line 5 linewidth 5\n\ set style line 6 linewidth 5\n\ set style line 7 linewidth 5\n\ set style line 8 linewidth 5\n\ -set style increment user"); +set style increment user" ); yansplot.GenerateOutput (yansfile); yansfile.close (); @@ -100,7 +100,7 @@ set style line 5 linewidth 5\n\ set style line 6 linewidth 5\n\ set style line 7 linewidth 5\n\ set style line 8 linewidth 5\n\ -set style increment user"); +set style increment user" ); nistplot.GenerateOutput (nistfile); nistfile.close (); diff --git a/examples/wireless/wifi-adhoc.cc b/examples/wireless/wifi-adhoc.cc index 22be0208c..1caf2d906 100644 --- a/examples/wireless/wifi-adhoc.cc +++ b/examples/wireless/wifi-adhoc.cc @@ -50,7 +50,8 @@ private: }; Experiment::Experiment () -{} +{ +} Experiment::Experiment (std::string name) : m_output (name) diff --git a/examples/wireless/wifi-clear-channel-cmu.cc b/examples/wireless/wifi-clear-channel-cmu.cc index 8cf20b26e..881572bdc 100644 --- a/examples/wireless/wifi-clear-channel-cmu.cc +++ b/examples/wireless/wifi-clear-channel-cmu.cc @@ -47,14 +47,15 @@ private: Vector GetPosition (Ptr node); Ptr SetupPacketReceive (Ptr node); void GenerateTraffic (Ptr socket, uint32_t pktSize, - uint32_t pktCount, Time pktInterval ); + uint32_t pktCount, Time pktInterval ); uint32_t m_pktsTotal; Gnuplot2dDataset m_output; }; Experiment::Experiment () -{} +{ +} Experiment::Experiment (std::string name) : m_output (name) @@ -82,7 +83,7 @@ Experiment::ReceivePacket (Ptr socket) Ptr packet; while (packet = socket->Recv ()) { - m_pktsTotal ++; + m_pktsTotal++; } } @@ -179,46 +180,46 @@ int main (int argc, char *argv[]) cmd.Parse (argc, argv); Gnuplot gnuplot = Gnuplot ("clear-channel.eps"); - + for (uint32_t i = 0; i < modes.size(); i++) - { - std::cout << modes[i] << std::endl; - Gnuplot2dDataset dataset (modes[i]); + { + std::cout << modes[i] << std::endl; + Gnuplot2dDataset dataset (modes[i]); - for (double rss = -102.0; rss <= -80.0; rss += 0.5) - { - Experiment experiment; - dataset.SetStyle (Gnuplot2dDataset::LINES); + for (double rss = -102.0; rss <= -80.0; rss += 0.5) + { + Experiment experiment; + dataset.SetStyle (Gnuplot2dDataset::LINES); - WifiHelper wifi; - wifi.SetStandard (WIFI_PHY_STANDARD_80211b); - NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); - Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode", - StringValue (modes[i])); - wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", - "DataMode",StringValue(modes[i]), - "ControlMode",StringValue(modes[i])); - wifiMac.SetType ("ns3::AdhocWifiMac"); + WifiHelper wifi; + wifi.SetStandard (WIFI_PHY_STANDARD_80211b); + NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); + Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode", + StringValue (modes[i])); + wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", + "DataMode",StringValue(modes[i]), + "ControlMode",StringValue(modes[i])); + wifiMac.SetType ("ns3::AdhocWifiMac"); - YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); - YansWifiChannelHelper wifiChannel ; - wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel"); - wifiChannel.AddPropagationLoss ("ns3::FixedRssLossModel","Rss",DoubleValue(rss)); + YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); + YansWifiChannelHelper wifiChannel ; + wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel"); + wifiChannel.AddPropagationLoss ("ns3::FixedRssLossModel","Rss",DoubleValue(rss)); - NS_LOG_DEBUG (modes[i]); - experiment = Experiment (modes[i]); - wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (-110.0) ); - wifiPhy.Set ("CcaMode1Threshold", DoubleValue (-110.0) ); - wifiPhy.Set ("TxPowerStart", DoubleValue (15.0) ); - wifiPhy.Set ("RxGain", DoubleValue (0) ); - wifiPhy.Set ("RxNoiseFigure", DoubleValue (7) ); - uint32_t pktsRecvd = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel); - dataset.Add (rss, pktsRecvd); - } + NS_LOG_DEBUG (modes[i]); + experiment = Experiment (modes[i]); + wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (-110.0) ); + wifiPhy.Set ("CcaMode1Threshold", DoubleValue (-110.0) ); + wifiPhy.Set ("TxPowerStart", DoubleValue (15.0) ); + wifiPhy.Set ("RxGain", DoubleValue (0) ); + wifiPhy.Set ("RxNoiseFigure", DoubleValue (7) ); + uint32_t pktsRecvd = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel); + dataset.Add (rss, pktsRecvd); + } - gnuplot.AddDataset (dataset); - } + gnuplot.AddDataset (dataset); + } gnuplot.SetTerminal ("postscript eps color enh \"Times-BoldItalic\""); gnuplot.SetLegend ("RSS(dBm)", "Number of packets received"); gnuplot.SetExtra ("set xrange [-102:-83]"); diff --git a/examples/wireless/wifi-hidden-terminal.cc b/examples/wireless/wifi-hidden-terminal.cc index 6de5f68f5..56d6ee490 100644 --- a/examples/wireless/wifi-hidden-terminal.cc +++ b/examples/wireless/wifi-hidden-terminal.cc @@ -46,17 +46,17 @@ void experiment (bool enableCtsRts) // 0. Enable or disable CTS/RTS UintegerValue ctsThr = (enableCtsRts ? UintegerValue (100) : UintegerValue (2200)); Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", ctsThr); - + // 1. Create 3 nodes NodeContainer nodes; nodes.Create (3); - + // 2. Place nodes somehow, this is required by every wireless simulation for (size_t i = 0; i < 3; ++i) { nodes.Get(i)->AggregateObject (CreateObject ()); } - + // 3. Create propagation loss matrix Ptr lossModel = CreateObject (); lossModel->SetDefaultLoss (200); // set default loss to 200 dB (no link) @@ -67,7 +67,7 @@ void experiment (bool enableCtsRts) Ptr wifiChannel = CreateObject (); wifiChannel->SetPropagationLossModel (lossModel); wifiChannel->SetPropagationDelayModel (CreateObject ()); - + // 5. Install wireless devices WifiHelper wifi; wifi.SetStandard (WIFI_PHY_STANDARD_80211b); @@ -94,7 +94,7 @@ void experiment (bool enableCtsRts) Ipv4AddressHelper ipv4; ipv4.SetBase ("10.0.0.0", "255.0.0.0"); ipv4.Assign (devices); - + // 7. Install applications: two CBR streams each saturating the channel ApplicationContainer cbrApps; uint16_t cbrPort = 12345; @@ -120,7 +120,7 @@ void experiment (bool enableCtsRts) // we also use separate UDP applications that will send a single // packet before the CBR flows start. // This is a workround for the lack of perfect ARP, see Bug 187 - // http://www.nsnam.org/bugzilla/show_bug.cgi?id=187 + // http://www.nsnam.org/bugzilla/show_bug.cgi?id=187 uint16_t echoPort = 9; UdpEchoClientHelper echoClientHelper (Ipv4Address ("10.0.0.2"), echoPort); @@ -128,24 +128,24 @@ void experiment (bool enableCtsRts) echoClientHelper.SetAttribute ("Interval", TimeValue (Seconds (0.1))); echoClientHelper.SetAttribute ("PacketSize", UintegerValue (10)); ApplicationContainer pingApps; - + // again using different start times to workaround Bug 388 and Bug 912 echoClientHelper.SetAttribute ("StartTime", TimeValue (Seconds (0.001))); pingApps.Add (echoClientHelper.Install (nodes.Get (0))); echoClientHelper.SetAttribute ("StartTime", TimeValue (Seconds (0.006))); - pingApps.Add (echoClientHelper.Install (nodes.Get (2))); + pingApps.Add (echoClientHelper.Install (nodes.Get (2))); + - // 8. Install FlowMonitor on all nodes FlowMonitorHelper flowmon; Ptr monitor = flowmon.InstallAll(); - + // 9. Run simulation for 10 seconds Simulator::Stop (Seconds (10)); Simulator::Run (); - + // 10. Print per flow statistics monitor->CheckForLostPackets (); Ptr classifier = DynamicCast (flowmon.GetClassifier ()); @@ -161,7 +161,7 @@ void experiment (bool enableCtsRts) std::cout << " Throughput: " << i->second.rxBytes * 8.0 / 10.0 / 1024 / 1024 << " Mbps\n"; } } - + // 11. Cleanup Simulator::Destroy (); } @@ -173,6 +173,6 @@ int main (int argc, char **argv) std::cout << "------------------------------------------------\n"; std::cout << "Hidden station experiment with RTS/CTS enabled:\n"; experiment (true); - + return 0; } diff --git a/examples/wireless/wifi-simple-adhoc-grid.cc b/examples/wireless/wifi-simple-adhoc-grid.cc index 282b865fa..4357a2051 100644 --- a/examples/wireless/wifi-simple-adhoc-grid.cc +++ b/examples/wireless/wifi-simple-adhoc-grid.cc @@ -21,7 +21,7 @@ // This program configures a grid (default 5x5) of nodes on an // 802.11b physical layer, with // 802.11b NICs in adhoc mode, and by default, sends one packet of 1000 -// (application) bytes to node 1. +// (application) bytes to node 1. // // The default layout is like this, on a 2-D grid. // @@ -134,7 +134,7 @@ int main (int argc, char *argv[]) cmd.AddValue ("numNodes", "number of nodes", numNodes); cmd.AddValue ("sinkNode", "Receiver node number", sinkNode); cmd.AddValue ("sourceNode", "Sender node number", sourceNode); - + cmd.Parse (argc, argv); // Convert to time object Time interPacketInterval = Seconds (interval); @@ -173,19 +173,19 @@ int main (int argc, char *argv[]) wifi.SetStandard (WIFI_PHY_STANDARD_80211b); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode",StringValue(phyMode), - "ControlMode",StringValue(phyMode)); + "ControlMode",StringValue(phyMode)); // Set it to adhoc mode wifiMac.SetType ("ns3::AdhocWifiMac"); NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c); MobilityHelper mobility; mobility.SetPositionAllocator ("ns3::GridPositionAllocator", - "MinX", DoubleValue (0.0), - "MinY", DoubleValue (0.0), - "DeltaX", DoubleValue (distance), - "DeltaY", DoubleValue (distance), - "GridWidth", UintegerValue (5), - "LayoutType", StringValue ("RowFirst")); + "MinX", DoubleValue (0.0), + "MinY", DoubleValue (0.0), + "DeltaX", DoubleValue (distance), + "DeltaY", DoubleValue (distance), + "GridWidth", UintegerValue (5), + "LayoutType", StringValue ("RowFirst")); mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (c); @@ -227,7 +227,7 @@ int main (int argc, char *argv[]) // To do-- enable an IP-level trace that shows forwarding events only } - + // Give OLSR time to converge-- 30 seconds perhaps Simulator::Schedule (Seconds (30.0), &GenerateTraffic, source, packetSize, numPackets, interPacketInterval); diff --git a/examples/wireless/wifi-simple-adhoc.cc b/examples/wireless/wifi-simple-adhoc.cc index e61ada48f..fb124351b 100644 --- a/examples/wireless/wifi-simple-adhoc.cc +++ b/examples/wireless/wifi-simple-adhoc.cc @@ -79,7 +79,7 @@ static void GenerateTraffic (Ptr socket, uint32_t pktSize, { socket->Send (Create (pktSize)); Simulator::Schedule (pktInterval, &GenerateTraffic, - socket, pktSize,pktCount-1, pktInterval); + socket, pktSize,pktCount-1, pktInterval); } else { @@ -105,7 +105,7 @@ int main (int argc, char *argv[]) cmd.AddValue ("numPackets", "number of packets generated", numPackets); cmd.AddValue ("interval", "interval (seconds) between packets", interval); cmd.AddValue ("verbose", "turn on all WifiNetDevice log components", verbose); - + cmd.Parse (argc, argv); // Convert to time object Time interPacketInterval = Seconds (interval); @@ -147,7 +147,7 @@ int main (int argc, char *argv[]) NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode",StringValue(phyMode), - "ControlMode",StringValue(phyMode)); + "ControlMode",StringValue(phyMode)); // Set it to adhoc mode wifiMac.SetType ("ns3::AdhocWifiMac"); NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c); diff --git a/examples/wireless/wifi-simple-interference.cc b/examples/wireless/wifi-simple-interference.cc index cc949b94b..e9c8a3a5f 100644 --- a/examples/wireless/wifi-simple-interference.cc +++ b/examples/wireless/wifi-simple-interference.cc @@ -149,7 +149,7 @@ int main (int argc, char *argv[]) cmd.AddValue ("PpacketSize", "size of application packet sent", PpacketSize); cmd.AddValue ("IpacketSize", "size of interfering packet sent", IpacketSize); cmd.AddValue ("verbose", "turn on all WifiNetDevice log components", verbose); - + cmd.Parse (argc, argv); // Convert to time object Time interPacketInterval = Seconds (interval); @@ -190,7 +190,7 @@ int main (int argc, char *argv[]) NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode",StringValue(phyMode), - "ControlMode",StringValue(phyMode)); + "ControlMode",StringValue(phyMode)); // Set it to adhoc mode wifiMac.SetType ("ns3::AdhocWifiMac"); NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c.Get (0)); @@ -241,7 +241,7 @@ int main (int argc, char *argv[]) // Tracing wifiPhy.EnablePcap ("wifi-simple-interference", devices.Get (0)); - + // Output what we are doing NS_LOG_UNCOND ("Primary packet RSS=" << Prss << " dBm and interferer RSS=" << Irss << " dBm at time offset=" << delta << " ms");