From 2a2690a0030270bbfe4be843a3c43a5f83f8372f Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Sun, 22 May 2011 23:18:47 -0700 Subject: [PATCH] rerun check-style.py at default level to enforce space after function name --- examples/error-model/simple-error-model.cc | 12 +- examples/ipv6/fragmentation-ipv6.cc | 2 +- examples/ipv6/icmpv6-redirect.cc | 30 +- examples/ipv6/loose-routing-ipv6.cc | 22 +- examples/naming/object-names.cc | 2 +- examples/realtime/realtime-udp-echo.cc | 4 +- examples/routing/global-injection-slash32.cc | 12 +- examples/routing/global-routing-slash32.cc | 2 +- examples/routing/simple-alternate-routing.cc | 4 +- examples/routing/simple-global-routing.cc | 8 +- examples/routing/simple-routing-ping6.cc | 2 +- .../socket/socket-bound-static-routing.cc | 10 +- .../socket/socket-bound-tcp-static-routing.cc | 12 +- examples/stats/wifi-example-apps.cc | 142 +++---- examples/stats/wifi-example-apps.h | 30 +- examples/stats/wifi-example-sim.cc | 174 ++++----- examples/tcp/star.cc | 2 +- examples/tcp/tcp-large-transfer.cc | 16 +- examples/tcp/tcp-nsc-lfn.cc | 32 +- examples/tcp/tcp-nsc-zoo.cc | 30 +- examples/tcp/tcp-star-server.cc | 28 +- examples/tutorial/fifth.cc | 6 +- examples/tutorial/first.cc | 4 +- examples/tutorial/fourth.cc | 2 +- examples/tutorial/second.cc | 4 +- examples/tutorial/sixth.cc | 8 +- examples/tutorial/third.cc | 4 +- .../udp-client-server/udp-client-server.cc | 4 +- .../udp-trace-client-server.cc | 4 +- examples/udp/udp-echo.cc | 14 +- examples/wireless/mixed-wireless.cc | 16 +- examples/wireless/multirate.cc | 154 ++++---- examples/wireless/ofdm-validation.cc | 6 +- examples/wireless/wifi-adhoc.cc | 2 +- examples/wireless/wifi-ap.cc | 6 +- examples/wireless/wifi-clear-channel-cmu.cc | 8 +- examples/wireless/wifi-hidden-terminal.cc | 4 +- examples/wireless/wifi-simple-adhoc-grid.cc | 4 +- examples/wireless/wifi-simple-adhoc.cc | 6 +- examples/wireless/wifi-simple-infra.cc | 10 +- examples/wireless/wifi-simple-interference.cc | 6 +- src/aodv/examples/aodv.cc | 6 +- src/aodv/model/aodv-dpd.cc | 6 +- src/aodv/model/aodv-dpd.h | 2 +- src/aodv/model/aodv-neighbor.cc | 4 +- src/aodv/model/aodv-packet.cc | 6 +- src/aodv/model/aodv-packet.h | 4 +- src/aodv/model/aodv-routing-protocol.cc | 76 ++-- src/aodv/model/aodv-routing-protocol.h | 2 +- src/aodv/model/aodv-rqueue.h | 6 +- src/aodv/model/aodv-rtable.cc | 2 +- src/aodv/model/aodv-rtable.h | 26 +- src/aodv/test/aodv-id-cache-test-suite.cc | 16 +- src/aodv/test/aodv-regression.cc | 8 +- src/aodv/test/aodv-test-suite.cc | 58 +-- src/aodv/test/bug-772.cc | 8 +- src/aodv/test/loopback.cc | 4 +- src/applications/helper/ping6-helper.h | 2 +- .../helper/udp-client-server-helper.h | 2 +- src/applications/helper/udp-echo-helper.cc | 2 +- src/applications/model/onoff-application.cc | 72 ++-- src/applications/model/onoff-application.h | 12 +- src/applications/model/packet-loss-counter.cc | 12 +- src/applications/model/packet-sink.cc | 38 +- src/applications/model/packet-sink.h | 4 +- src/applications/model/ping6.h | 2 +- src/applications/model/radvd.cc | 4 +- src/applications/model/udp-echo-client.cc | 18 +- src/applications/model/udp-echo-server.cc | 10 +- src/applications/model/udp-server.cc | 2 +- src/applications/model/udp-trace-client.h | 4 +- src/applications/model/v4ping.cc | 18 +- .../test/udp-client-server-test.cc | 52 +-- src/bridge/model/bridge-net-device.cc | 4 +- src/bridge/model/bridge-net-device.h | 4 +- src/config-store/model/raw-text-config.cc | 6 +- src/config-store/model/xml-config.cc | 58 +-- src/core/bindings/module_helpers.cc | 212 +++++----- src/core/examples/main-random-variable.cc | 366 +++++++++--------- src/core/examples/main-test-sync.cc | 2 +- src/core/model/abort.h | 4 +- src/core/model/assert.h | 2 +- src/core/model/attribute-helper.h | 2 +- src/core/model/cairo-wideint-private.h | 64 +-- src/core/model/callback.cc | 20 +- src/core/model/callback.h | 6 +- src/core/model/default-simulator-impl.cc | 2 +- src/core/model/fatal-error.h | 2 +- src/core/model/fatal-impl.cc | 2 +- src/core/model/int64x64-cairo.cc | 4 +- src/core/model/int64x64-cairo.h | 2 +- src/core/model/int64x64.cc | 4 +- src/core/model/int64x64.h | 56 +-- src/core/model/integer.h | 4 +- src/core/model/log.cc | 8 +- src/core/model/log.h | 14 +- src/core/model/names.cc | 4 +- src/core/model/nstime.h | 2 +- src/core/model/object.h | 2 +- src/core/model/ptr.h | 4 +- src/core/model/rng-stream.cc | 22 +- src/core/model/rng-stream.h | 8 +- src/core/model/traced-value.h | 2 +- src/core/model/uinteger.cc | 2 +- src/core/model/unix-fd-reader.cc | 4 +- src/core/model/unix-system-condition.cc | 2 +- src/core/model/unix-system-mutex.cc | 10 +- src/core/model/unix-system-thread.cc | 4 +- src/core/model/vector.h | 2 +- src/core/test/attribute-test-suite.cc | 76 ++-- src/core/test/int64x64-test-suite.cc | 106 ++--- src/core/test/simulator-test-suite.cc | 4 +- src/csma-layout/examples/csma-star.cc | 2 +- src/csma-layout/model/csma-star-helper.cc | 2 +- src/csma/examples/csma-broadcast.cc | 4 +- src/csma/examples/csma-multicast.cc | 8 +- src/csma/examples/csma-one-subnet.cc | 2 +- src/csma/examples/csma-packet-socket.cc | 6 +- src/csma/model/backoff.cc | 6 +- src/csma/model/backoff.h | 2 +- src/csma/model/csma-channel.cc | 14 +- src/csma/model/csma-channel.h | 6 +- src/csma/model/csma-net-device.cc | 4 +- src/dsdv/model/dsdv-routing-protocol.cc | 4 +- src/emu/examples/emu-ping.cc | 4 +- src/emu/examples/emu-udp-echo.cc | 8 +- src/emu/model/emu-encode-decode.cc | 2 +- src/emu/model/emu-net-device.cc | 36 +- src/emu/model/emu-net-device.h | 12 +- src/emu/model/emu-sock-creator.cc | 14 +- src/energy/model/rv-battery-model.cc | 2 +- src/energy/test/basic-energy-model-test.cc | 4 +- src/energy/test/rv-battery-model-test.cc | 8 +- src/flow-monitor/model/flow-monitor.cc | 48 +-- src/flow-monitor/model/flow-probe.cc | 12 +- src/flow-monitor/model/histogram.cc | 12 +- .../model/ipv4-flow-classifier.cc | 6 +- src/flow-monitor/test/histogram-test-suite.cc | 2 +- src/internet/helper/internet-stack-helper.cc | 4 +- src/internet/helper/internet-stack-helper.h | 2 +- src/internet/helper/internet-trace-helper.cc | 2 +- src/internet/helper/ipv4-address-helper.cc | 12 +- .../helper/ipv4-global-routing-helper.cc | 2 +- .../helper/ipv4-interface-container.cc | 2 +- .../helper/ipv4-static-routing-helper.cc | 22 +- src/internet/model/arp-cache.cc | 4 +- src/internet/model/arp-l3-protocol.cc | 14 +- src/internet/model/arp-l3-protocol.h | 4 +- src/internet/model/candidate-queue.cc | 2 +- .../model/global-route-manager-impl.cc | 6 +- .../model/global-route-manager-impl.h | 4 +- src/internet/model/global-router-interface.cc | 154 ++++---- src/internet/model/global-router-interface.h | 24 +- src/internet/model/icmpv4-l4-protocol.cc | 8 +- src/internet/model/icmpv4-l4-protocol.h | 6 +- src/internet/model/ipv4-address-generator.cc | 6 +- src/internet/model/ipv4-end-point-demux.cc | 26 +- src/internet/model/ipv4-global-routing.cc | 46 +-- src/internet/model/ipv4-header.cc | 8 +- src/internet/model/ipv4-interface-address.cc | 4 +- src/internet/model/ipv4-interface.cc | 12 +- src/internet/model/ipv4-interface.h | 2 +- src/internet/model/ipv4-l3-protocol.cc | 22 +- src/internet/model/ipv4-l3-protocol.h | 8 +- src/internet/model/ipv4-l4-protocol.h | 6 +- src/internet/model/ipv4-list-routing.cc | 10 +- src/internet/model/ipv4-raw-socket-impl.cc | 2 +- src/internet/model/ipv4-route.cc | 14 +- src/internet/model/ipv4-route.h | 2 +- .../model/ipv4-routing-table-entry.cc | 4 +- src/internet/model/ipv4-static-routing.cc | 50 +-- src/internet/model/ipv4.h | 2 +- src/internet/model/ipv6-extension.cc | 4 +- src/internet/model/ipv6-header.cc | 16 +- src/internet/model/ipv6-l3-protocol.cc | 22 +- src/internet/model/ipv6-option-demux.h | 2 +- src/internet/model/ipv6-route.cc | 14 +- src/internet/model/ipv6-route.h | 2 +- src/internet/model/loopback-net-device.cc | 6 +- src/internet/model/loopback-net-device.h | 8 +- src/internet/model/ndisc-cache.cc | 8 +- src/internet/model/nsc-sysctl.cc | 8 +- src/internet/model/nsc-tcp-l4-protocol.cc | 96 ++--- src/internet/model/nsc-tcp-l4-protocol.h | 6 +- src/internet/model/nsc-tcp-socket-impl.cc | 96 ++--- src/internet/model/nsc-tcp-socket-impl.h | 20 +- src/internet/model/pending-data.cc | 34 +- src/internet/model/rtt-estimator.cc | 16 +- src/internet/model/rtt-estimator.h | 20 +- src/internet/model/sim_interface.h | 90 ++--- src/internet/model/tcp-header.cc | 12 +- src/internet/model/tcp-l4-protocol.cc | 46 +-- src/internet/model/tcp-newreno.cc | 2 +- src/internet/model/tcp-rfc793.cc | 2 +- src/internet/model/tcp-rx-buffer.cc | 8 +- src/internet/model/tcp-socket-base.cc | 4 +- src/internet/model/tcp-tx-buffer.cc | 2 +- src/internet/model/udp-header.cc | 8 +- src/internet/model/udp-l4-protocol.cc | 16 +- src/internet/model/udp-l4-protocol.h | 6 +- src/internet/model/udp-socket-impl.cc | 24 +- src/internet/model/udp-socket-impl.h | 2 +- .../global-route-manager-impl-test-suite.cc | 10 +- .../test/ipv4-address-helper-test-suite.cc | 48 +-- .../test/ipv4-list-routing-test-suite.cc | 10 +- .../test/ipv4-packet-info-tag-test-suite.cc | 12 +- src/internet/test/ipv4-raw-test.cc | 14 +- .../test/ipv6-extension-header-test-suite.cc | 88 ++--- .../test/ipv6-list-routing-test-suite.cc | 10 +- .../test/ipv6-packet-info-tag-test-suite.cc | 12 +- src/internet/test/tcp-test.cc | 28 +- src/internet/test/udp-test.cc | 20 +- src/lte/helper/lte-helper.cc | 4 +- src/lte/model/simple-packet-scheduler.cc | 4 +- src/mesh/examples/mesh.cc | 10 +- src/mesh/helper/dot11s/dot11s-installer.cc | 2 +- src/mesh/model/dot11s/hwmp-protocol-mac.cc | 12 +- src/mesh/model/dot11s/hwmp-protocol.cc | 36 +- src/mesh/model/dot11s/hwmp-rtable.cc | 2 +- src/mesh/model/dot11s/hwmp-rtable.h | 2 +- src/mesh/model/dot11s/peer-link.cc | 2 +- .../dot11s/peer-management-protocol-mac.cc | 6 +- .../model/dot11s/peer-management-protocol.cc | 8 +- src/mesh/model/flame/flame-rtable.h | 2 +- .../model/mesh-information-element-vector.cc | 4 +- .../test/dot11s/hwmp-proactive-regression.cc | 14 +- .../test/dot11s/hwmp-reactive-regression.cc | 34 +- .../test/dot11s/hwmp-simplest-regression.cc | 20 +- .../dot11s/hwmp-target-flags-regression.cc | 16 +- src/mesh/test/dot11s/pmp-regression.cc | 12 +- src/mesh/test/flame/flame-regression.cc | 12 +- src/mobility/model/mobility-model.cc | 2 +- src/mobility/model/position-allocator.cc | 4 +- ...dy-state-random-waypoint-mobility-model.cc | 12 +- ...ate-random-waypoint-mobility-model-test.cc | 14 +- src/mpi/examples/third-distributed.cc | 4 +- src/netanim/examples/dumbbell-animation.cc | 10 +- src/netanim/examples/grid-animation.cc | 2 +- src/netanim/examples/star-animation.cc | 2 +- src/netanim/model/animation-interface.cc | 4 +- src/network/helper/trace-helper.cc | 4 +- src/network/model/address.cc | 14 +- src/network/model/application.cc | 6 +- src/network/model/buffer.cc | 28 +- src/network/model/buffer.h | 4 +- src/network/model/channel.cc | 2 +- src/network/model/net-device.h | 8 +- src/network/model/nix-vector.cc | 4 +- src/network/model/nix-vector.h | 2 +- src/network/model/node.cc | 24 +- src/network/model/packet-metadata.cc | 8 +- src/network/model/packet.cc | 2 +- src/network/model/packet.h | 2 +- src/network/model/socket.cc | 8 +- src/network/model/socket.h | 4 +- src/network/test/buffer-test.cc | 24 +- src/network/test/packet-metadata-test.cc | 38 +- src/network/test/packet-test-suite.cc | 18 +- src/network/test/packetbb-test-suite.cc | 46 +-- src/network/test/pcap-file-test-suite.cc | 18 +- .../test/sequence-number-test-suite.cc | 6 +- src/network/utils/address-utils.cc | 6 +- src/network/utils/data-rate.cc | 20 +- src/network/utils/data-rate.h | 10 +- src/network/utils/drop-tail-queue.cc | 6 +- src/network/utils/error-model.cc | 6 +- src/network/utils/ethernet-header.cc | 4 +- src/network/utils/ethernet-header.h | 2 +- src/network/utils/ethernet-trailer.cc | 8 +- src/network/utils/ethernet-trailer.h | 2 +- src/network/utils/inet6-socket-address.cc | 38 +- src/network/utils/ipv4-address.cc | 4 +- src/network/utils/ipv4-address.h | 2 +- src/network/utils/ipv6-address.cc | 4 +- src/network/utils/mac48-address.cc | 12 +- src/network/utils/mac64-address.cc | 8 +- src/network/utils/packet-socket.cc | 16 +- src/network/utils/packet-socket.h | 6 +- src/network/utils/packetbb.cc | 182 ++++----- src/network/utils/pcap-file.cc | 4 +- src/network/utils/queue.cc | 18 +- src/network/utils/radiotap-header.cc | 38 +- src/network/utils/radiotap-header.h | 2 +- src/network/utils/simple-net-device.cc | 10 +- src/network/utils/simple-net-device.h | 10 +- src/nix-vector-routing/examples/nix-simple.cc | 6 +- .../examples/nms-p2p-nix.cc | 14 +- .../helper/ipv4-nix-vector-helper.cc | 2 +- .../model/ipv4-nix-vector-routing.cc | 58 +-- src/olsr/examples/olsr-hna.cc | 12 +- .../examples/simple-point-to-point-olsr.cc | 6 +- src/olsr/model/olsr-header.cc | 4 +- src/olsr/model/olsr-routing-protocol.cc | 102 ++--- src/olsr/model/olsr-state.cc | 12 +- src/olsr/test/bug780-test.cc | 28 +- src/olsr/test/hello-regression-test.cc | 8 +- src/olsr/test/olsr-header-test-suite.cc | 18 +- .../test/olsr-routing-protocol-test-suite.cc | 2 +- src/olsr/test/tc-regression-test.cc | 8 +- src/openflow/examples/openflow-switch.cc | 4 +- src/openflow/model/openflow-interface.cc | 6 +- .../model/openflow-switch-net-device.cc | 2 +- .../model/point-to-point-dumbbell.cc | 6 +- .../model/point-to-point-grid.cc | 6 +- .../model/point-to-point-star.cc | 2 +- .../examples/main-attribute-value.cc | 4 +- .../helper/point-to-point-helper.cc | 2 +- .../model/point-to-point-channel.cc | 14 +- .../model/point-to-point-net-device.cc | 50 +-- .../model/point-to-point-net-device.h | 22 +- src/point-to-point/model/ppp-header.cc | 4 +- src/point-to-point/model/ppp-header.h | 4 +- .../examples/main-propagation-loss.cc | 158 ++++---- .../model/jakes-propagation-loss-model.cc | 10 +- .../model/propagation-loss-model.cc | 30 +- src/stats/model/basic-data-calculators.h | 58 +-- src/stats/model/data-calculator.cc | 44 +-- src/stats/model/data-calculator.h | 40 +- src/stats/model/data-collector.cc | 64 +-- src/stats/model/data-collector.h | 38 +- src/stats/model/data-output-interface.cc | 16 +- src/stats/model/data-output-interface.h | 44 +-- src/stats/model/omnet-data-output.cc | 122 +++--- src/stats/model/omnet-data-output.h | 40 +- src/stats/model/packet-data-calculators.cc | 58 +-- src/stats/model/packet-data-calculators.h | 16 +- src/stats/model/sqlite-data-output.cc | 158 ++++---- src/stats/model/sqlite-data-output.h | 42 +- src/stats/model/time-data-calculators.cc | 20 +- src/stats/model/time-data-calculators.h | 6 +- src/tap-bridge/examples/tap-csma.cc | 4 +- src/tap-bridge/examples/tap-wifi-dumbbell.cc | 6 +- src/tap-bridge/helper/tap-bridge-helper.cc | 2 +- src/tap-bridge/model/tap-bridge.cc | 10 +- src/tap-bridge/model/tap-bridge.h | 4 +- src/tap-bridge/model/tap-creator.cc | 12 +- src/tap-bridge/model/tap-encode-decode.cc | 2 +- src/template/test/sample-test-suite.cc | 2 +- src/test/csma-system-test-suite.cc | 20 +- src/test/error-model-test-suite.cc | 2 +- src/test/global-routing-test-suite.cc | 6 +- src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc | 18 +- src/test/ns3tcp/ns3tcp-interop-test-suite.cc | 14 +- src/test/ns3tcp/ns3tcp-loss-test-suite.cc | 4 +- src/test/ns3tcp/ns3tcp-socket-test-suite.cc | 26 +- src/test/ns3tcp/ns3tcp-state-test-suite.cc | 8 +- src/test/ns3tcp/nsctcp-loss-test-suite.cc | 16 +- .../ns3wifi/wifi-interference-test-suite.cc | 6 +- .../wifi-msdu-aggregator-test-suite.cc | 14 +- src/tools/model/average.h | 8 +- src/tools/model/gnuplot.cc | 162 ++++---- src/tools/model/gnuplot.h | 8 +- src/uan/examples/uan-cw-example.cc | 8 +- src/uan/examples/uan-rc-example.cc | 26 +- .../examples/virtual-net-device.cc | 6 +- .../model/virtual-net-device.cc | 2 +- .../model/virtual-net-device.h | 4 +- src/visualizer/model/pyviz.cc | 34 +- src/visualizer/model/visual-simulator-impl.cc | 6 +- src/wimax/model/bs-net-device.cc | 4 +- src/wimax/model/bs-uplink-scheduler-mbqos.cc | 2 +- src/wimax/model/simple-ofdm-send-param.h | 2 +- src/wimax/model/simple-ofdm-wimax-channel.cc | 6 +- src/wimax/model/simple-ofdm-wimax-phy.cc | 8 +- src/wimax/model/ul-job.cc | 2 +- src/wimax/test/phy-test.cc | 2 +- 366 files changed, 3398 insertions(+), 3398 deletions(-) diff --git a/examples/error-model/simple-error-model.cc b/examples/error-model/simple-error-model.cc index 3f5afaf3b..f4c4ad873 100644 --- a/examples/error-model/simple-error-model.cc +++ b/examples/error-model/simple-error-model.cc @@ -116,12 +116,12 @@ main (int argc, char *argv[]) OnOffHelper onoff ("ns3::UdpSocketFactory", Address (InetSocketAddress (i3i2.GetAddress (1), port))); - onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable(1))); - onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable(0))); + onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); + onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); ApplicationContainer apps = onoff.Install (c.Get (0)); - apps.Start(Seconds(1.0)); - apps.Stop (Seconds(10.0)); + apps.Start (Seconds (1.0)); + apps.Stop (Seconds (10.0)); // Create an optional packet sink to receive these packets PacketSinkHelper sink ("ns3::UdpSocketFactory", @@ -134,8 +134,8 @@ main (int argc, char *argv[]) onoff.SetAttribute ("Remote", AddressValue (InetSocketAddress (i1i2.GetAddress (0), port))); apps = onoff.Install (c.Get (3)); - apps.Start(Seconds(1.1)); - apps.Stop (Seconds(10.0)); + apps.Start (Seconds (1.1)); + apps.Stop (Seconds (10.0)); // Create a packet sink to receive these packets sink.SetAttribute ("Local", diff --git a/examples/ipv6/fragmentation-ipv6.cc b/examples/ipv6/fragmentation-ipv6.cc index b00716824..dd0ad41b8 100644 --- a/examples/ipv6/fragmentation-ipv6.cc +++ b/examples/ipv6/fragmentation-ipv6.cc @@ -134,7 +134,7 @@ int main (int argc, char** argv) Ipv6InterfaceContainer i2 = ipv6.Assign (d2); i2.SetRouter (0, true); - stackHelper.PrintRoutingTable(n0); + stackHelper.PrintRoutingTable (n0); /* Create a Ping6 application to send ICMPv6 echo request from n0 to n1 via r */ uint32_t packetSize = 4096; diff --git a/examples/ipv6/icmpv6-redirect.cc b/examples/ipv6/icmpv6-redirect.cc index 612a6cdfc..1ac5e4bc0 100644 --- a/examples/ipv6/icmpv6-redirect.cc +++ b/examples/ipv6/icmpv6-redirect.cc @@ -112,11 +112,11 @@ int main (int argc, char **argv) #if 0 LogComponentEnable ("Icmpv6RedirectExample", LOG_LEVEL_INFO); LogComponentEnable ("Icmpv6L4Protocol", LOG_LEVEL_INFO); - LogComponentEnable("Ipv6L3Protocol", LOG_LEVEL_ALL); - LogComponentEnable("Ipv6StaticRouting", LOG_LEVEL_ALL); - LogComponentEnable("Ipv6Interface", LOG_LEVEL_ALL); - LogComponentEnable("Icmpv6L4Protocol", LOG_LEVEL_ALL); - LogComponentEnable("NdiscCache", LOG_LEVEL_ALL); + LogComponentEnable ("Ipv6L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable ("Ipv6StaticRouting", LOG_LEVEL_ALL); + LogComponentEnable ("Ipv6Interface", LOG_LEVEL_ALL); + LogComponentEnable ("Icmpv6L4Protocol", LOG_LEVEL_ALL); + LogComponentEnable ("NdiscCache", LOG_LEVEL_ALL); #endif CommandLine cmd; @@ -127,9 +127,9 @@ int main (int argc, char **argv) Ptr r1 = CreateObject (); Ptr r2 = CreateObject (); Ptr sta2 = CreateObject (); - NodeContainer net1(sta1, r1, r2); - NodeContainer net2(r2, sta2); - NodeContainer all(sta1, r1, r2, sta2); + NodeContainer net1 (sta1, r1, r2); + NodeContainer net2 (r2, sta2); + NodeContainer all (sta1, r1, r2, sta2); StackHelper stackHelper; @@ -138,8 +138,8 @@ int main (int argc, char **argv) NS_LOG_INFO ("Create channels."); CsmaHelper csma; - csma.SetChannelAttribute ("DataRate", DataRateValue(5000000)); - csma.SetChannelAttribute ("Delay", TimeValue(MilliSeconds (2))); + csma.SetChannelAttribute ("DataRate", DataRateValue (5000000)); + csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); NetDeviceContainer ndc1 = csma.Install (net1); NetDeviceContainer ndc2 = csma.Install (net2); @@ -157,8 +157,8 @@ int main (int argc, char **argv) stackHelper.AddHostRouteTo (r1, iic2.GetAddress (1, 1), iic1.GetAddress (2, 1), iic1.GetInterfaceIndex (1)); - Simulator::Schedule(Seconds(0.0), &StackHelper::PrintRoutingTable, &stackHelper, r1); - Simulator::Schedule(Seconds(3.0), &StackHelper::PrintRoutingTable, &stackHelper, sta1); + Simulator::Schedule (Seconds (0.0), &StackHelper::PrintRoutingTable, &stackHelper, r1); + Simulator::Schedule (Seconds (3.0), &StackHelper::PrintRoutingTable, &stackHelper, sta1); NS_LOG_INFO ("Create Applications."); uint32_t packetSize = 1024; @@ -166,10 +166,10 @@ int main (int argc, char **argv) Time interPacketInterval = Seconds (1.); Ping6Helper ping6; - ping6.SetLocal (iic1.GetAddress(0, 1)); - ping6.SetRemote (iic2.GetAddress(1, 1)); + ping6.SetLocal (iic1.GetAddress (0, 1)); + ping6.SetRemote (iic2.GetAddress (1, 1)); ping6.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount)); - ping6.SetAttribute ("Interval", TimeValue(interPacketInterval)); + ping6.SetAttribute ("Interval", TimeValue (interPacketInterval)); ping6.SetAttribute ("PacketSize", UintegerValue (packetSize)); ApplicationContainer apps = ping6.Install (sta1); apps.Start (Seconds (2.0)); diff --git a/examples/ipv6/loose-routing-ipv6.cc b/examples/ipv6/loose-routing-ipv6.cc index 0e1c79cf6..1cdb88b31 100644 --- a/examples/ipv6/loose-routing-ipv6.cc +++ b/examples/ipv6/loose-routing-ipv6.cc @@ -51,13 +51,13 @@ NS_LOG_COMPONENT_DEFINE ("LooseRoutingIpv6Example"); int main (int argc, char **argv) { #if 0 - LogComponentEnable("Ipv6ExtensionLooseRouting", LOG_LEVEL_ALL); - LogComponentEnable("Ipv6Extension", LOG_LEVEL_ALL); - LogComponentEnable("Ipv6L3Protocol", LOG_LEVEL_ALL); - LogComponentEnable("Ipv6StaticRouting", LOG_LEVEL_ALL); - LogComponentEnable("Ipv6Interface", LOG_LEVEL_ALL); - LogComponentEnable("Ipv6Interface", LOG_LEVEL_ALL); - LogComponentEnable("NdiscCache", LOG_LEVEL_ALL); + LogComponentEnable ("Ipv6ExtensionLooseRouting", LOG_LEVEL_ALL); + LogComponentEnable ("Ipv6Extension", LOG_LEVEL_ALL); + LogComponentEnable ("Ipv6L3Protocol", LOG_LEVEL_ALL); + LogComponentEnable ("Ipv6StaticRouting", LOG_LEVEL_ALL); + LogComponentEnable ("Ipv6Interface", LOG_LEVEL_ALL); + LogComponentEnable ("Ipv6Interface", LOG_LEVEL_ALL); + LogComponentEnable ("NdiscCache", LOG_LEVEL_ALL); #endif CommandLine cmd; @@ -91,9 +91,9 @@ int main (int argc, char **argv) NS_LOG_INFO ("Create channels."); CsmaHelper csma; - csma.SetDeviceAttribute ("Mtu", UintegerValue(1500)); - csma.SetChannelAttribute ("DataRate", DataRateValue(5000000)); - csma.SetChannelAttribute ("Delay", TimeValue(MilliSeconds (2))); + csma.SetDeviceAttribute ("Mtu", UintegerValue (1500)); + csma.SetChannelAttribute ("DataRate", DataRateValue (5000000)); + csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); NetDeviceContainer d1 = csma.Install (net1); NetDeviceContainer d2 = csma.Install (net2); NetDeviceContainer d3 = csma.Install (net3); @@ -152,7 +152,7 @@ int main (int argc, char **argv) /* remote address is first routers in RH0 => source routing */ client.SetRemote (i1.GetAddress (1, 1)); client.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount)); - client.SetAttribute ("Interval", TimeValue(interPacketInterval)); + client.SetAttribute ("Interval", TimeValue (interPacketInterval)); client.SetAttribute ("PacketSize", UintegerValue (packetSize)); client.SetRoutersAddress (routersAddress); ApplicationContainer apps = client.Install (h0); diff --git a/examples/naming/object-names.cc b/examples/naming/object-names.cc index d4e8bd03f..eab56ee25 100644 --- a/examples/naming/object-names.cc +++ b/examples/naming/object-names.cc @@ -81,7 +81,7 @@ main (int argc, char *argv[]) internet.Install (n); CsmaHelper csma; - csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate(5000000))); + csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000))); csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); csma.SetDeviceAttribute ("Mtu", UintegerValue (1400)); NetDeviceContainer d = csma.Install (n); diff --git a/examples/realtime/realtime-udp-echo.cc b/examples/realtime/realtime-udp-echo.cc index 08ac9be61..3693aa8f5 100644 --- a/examples/realtime/realtime-udp-echo.cc +++ b/examples/realtime/realtime-udp-echo.cc @@ -67,7 +67,7 @@ main (int argc, char *argv[]) // NS_LOG_INFO ("Create channels."); CsmaHelper csma; - csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate(5000000))); + csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000))); csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); csma.SetDeviceAttribute ("Mtu", UintegerValue (1400)); NetDeviceContainer d = csma.Install (n); @@ -87,7 +87,7 @@ main (int argc, char *argv[]) // uint16_t port = 9; // well-known echo port number UdpEchoServerHelper server (port); - ApplicationContainer apps = server.Install (n.Get(1)); + ApplicationContainer apps = server.Install (n.Get (1)); apps.Start (Seconds (1.0)); apps.Stop (Seconds (10.0)); diff --git a/examples/routing/global-injection-slash32.cc b/examples/routing/global-injection-slash32.cc index 87e8e0174..ca689dae9 100644 --- a/examples/routing/global-injection-slash32.cc +++ b/examples/routing/global-injection-slash32.cc @@ -68,9 +68,9 @@ main (int argc, char *argv[]) internet.Install (nAnB); Ipv4ListRoutingHelper staticonly; Ipv4ListRoutingHelper staticRouting; - staticonly.Add(staticRouting, 0); - internet.SetRoutingHelper(staticonly); // has effect on the next Install () - internet.Install(NodeContainer(nC)); + staticonly.Add (staticRouting, 0); + internet.SetRoutingHelper (staticonly); // has effect on the next Install () + internet.Install (NodeContainer (nC)); // We create the channels first without any IP addressing information PointToPointHelper p2p; @@ -124,18 +124,18 @@ main (int argc, char *argv[]) // ...and the host in network "C" globalRouterB->InjectRoute ("192.168.1.1", "255.255.255.255"); - Ipv4GlobalRoutingHelper::RecomputeRoutingTables(); + 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); + 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))); diff --git a/examples/routing/global-routing-slash32.cc b/examples/routing/global-routing-slash32.cc index c237dfe4f..798f75e0e 100644 --- a/examples/routing/global-routing-slash32.cc +++ b/examples/routing/global-routing-slash32.cc @@ -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))); diff --git a/examples/routing/simple-alternate-routing.cc b/examples/routing/simple-alternate-routing.cc index 2c0b185e3..78fd63e17 100644 --- a/examples/routing/simple-alternate-routing.cc +++ b/examples/routing/simple-alternate-routing.cc @@ -54,8 +54,8 @@ main (int argc, char *argv[]) // Users may find it convenient to turn on explicit debugging // for selected modules; the below lines suggest how to do this #if 0 - LogComponentEnable("GlobalRoutingHelper", LOG_LOGIC); - LogComponentEnable("GlobalRouter", LOG_LOGIC); + LogComponentEnable ("GlobalRoutingHelper", LOG_LOGIC); + LogComponentEnable ("GlobalRouter", LOG_LOGIC); #endif diff --git a/examples/routing/simple-global-routing.cc b/examples/routing/simple-global-routing.cc index 915e60f30..91c57b1c3 100644 --- a/examples/routing/simple-global-routing.cc +++ b/examples/routing/simple-global-routing.cc @@ -70,7 +70,7 @@ main (int argc, char *argv[]) // DefaultValue::Bind ()s at run-time, via command-line arguments CommandLine cmd; bool enableFlowMonitor = false; - cmd.AddValue("EnableMonitor", "Enable Flow Monitor", enableFlowMonitor); + cmd.AddValue ("EnableMonitor", "Enable Flow Monitor", enableFlowMonitor); cmd.Parse (argc, argv); // Here, we will explicitly create four nodes. In more sophisticated @@ -78,9 +78,9 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Create nodes."); NodeContainer c; c.Create (4); - NodeContainer n0n2 = NodeContainer (c.Get(0), c.Get (2)); - NodeContainer n1n2 = NodeContainer (c.Get(1), c.Get (2)); - NodeContainer n3n2 = NodeContainer (c.Get(3), c.Get (2)); + NodeContainer n0n2 = NodeContainer (c.Get (0), c.Get (2)); + NodeContainer n1n2 = NodeContainer (c.Get (1), c.Get (2)); + NodeContainer n3n2 = NodeContainer (c.Get (3), c.Get (2)); InternetStackHelper internet; internet.Install (c); diff --git a/examples/routing/simple-routing-ping6.cc b/examples/routing/simple-routing-ping6.cc index 2f13bfc83..5eb7158e0 100644 --- a/examples/routing/simple-routing-ping6.cc +++ b/examples/routing/simple-routing-ping6.cc @@ -135,7 +135,7 @@ int main (int argc, char** argv) Ipv6InterfaceContainer i2 = ipv6.Assign (d2); i2.SetRouter (0, true); - stackHelper.PrintRoutingTable(n0); + stackHelper.PrintRoutingTable (n0); /* Create a Ping6 application to send ICMPv6 echo request from n0 to n1 via r */ uint32_t packetSize = 1024; diff --git a/examples/socket/socket-bound-static-routing.cc b/examples/socket/socket-bound-static-routing.cc index 9226402c8..0eba0b2f1 100644 --- a/examples/socket/socket-bound-static-routing.cc +++ b/examples/socket/socket-bound-static-routing.cc @@ -156,7 +156,7 @@ main (int argc, char *argv[]) Simulator::Schedule (Seconds (0.1),&SendStuff, srcSocket, dstaddr, dstport); // Second via Rtr1 explicitly Simulator::Schedule (Seconds (1.0),&BindSock, srcSocket, SrcToRtr1); - Simulator::Schedule (Seconds( 1.1),&SendStuff, srcSocket, dstaddr, dstport); + Simulator::Schedule (Seconds ( 1.1),&SendStuff, srcSocket, dstaddr, dstport); // Third via Rtr2 explicitly Simulator::Schedule (Seconds (2.0),&BindSock, srcSocket, SrcToRtr2); Simulator::Schedule (Seconds (2.1),&SendStuff, srcSocket, dstaddr, dstport); @@ -172,7 +172,7 @@ main (int argc, char *argv[]) return 0; } -void SendStuff(Ptr sock, Ipv4Address dstaddr, uint16_t port) +void SendStuff (Ptr sock, Ipv4Address dstaddr, uint16_t port) { Ptr p = Create (); p->AddPaddingAtEnd (100); @@ -180,7 +180,7 @@ void SendStuff(Ptr sock, Ipv4Address dstaddr, uint16_t port) return; } -void BindSock(Ptr sock, Ptr netdev) +void BindSock (Ptr sock, Ptr netdev) { sock->BindToNetDevice (netdev); return; @@ -193,7 +193,7 @@ srcSocketRecv (Ptr socket) Ptr packet = socket->RecvFrom (from); packet->RemoveAllPacketTags (); packet->RemoveAllByteTags (); - NS_LOG_INFO ("Source Received " << packet->GetSize () << " bytes from " << InetSocketAddress::ConvertFrom (from).GetIpv4()); + NS_LOG_INFO ("Source Received " << packet->GetSize () << " bytes from " << InetSocketAddress::ConvertFrom (from).GetIpv4 ()); if (socket->GetBoundNetDevice ()) { NS_LOG_INFO ("Socket was bound"); @@ -214,5 +214,5 @@ dstSocketRecv (Ptr socket) InetSocketAddress address = InetSocketAddress::ConvertFrom (from); NS_LOG_INFO ("Destination Received " << packet->GetSize () << " bytes from " << address.GetIpv4 ()); NS_LOG_INFO ("Triggering packet back to source node's interface 1"); - SendStuff(socket, Ipv4Address ("10.1.1.1"), address.GetPort ()); + SendStuff (socket, Ipv4Address ("10.1.1.1"), address.GetPort ()); } diff --git a/examples/socket/socket-bound-tcp-static-routing.cc b/examples/socket/socket-bound-tcp-static-routing.cc index 95baaaa11..e262fd514 100644 --- a/examples/socket/socket-bound-tcp-static-routing.cc +++ b/examples/socket/socket-bound-tcp-static-routing.cc @@ -157,7 +157,7 @@ main (int argc, char *argv[]) uint16_t dstport = 12345; Ipv4Address dstaddr ("10.20.1.2"); - PacketSinkHelper sink ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny(), dstport)); + PacketSinkHelper sink ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), dstport)); ApplicationContainer apps = sink.Install (nDst); apps.Start (Seconds (0.0)); apps.Stop (Seconds (10.0)); @@ -189,15 +189,15 @@ main (int argc, char *argv[]) return 0; } -void BindSock(Ptr sock, Ptr netdev) +void BindSock (Ptr sock, Ptr netdev) { - sock->BindToNetDevice(netdev); + sock->BindToNetDevice (netdev); return; } -void StartFlow(Ptr localSocket, - Ipv4Address servAddress, - uint16_t servPort) +void StartFlow (Ptr localSocket, + Ipv4Address servAddress, + uint16_t servPort) { NS_LOG_INFO ("Starting flow at time " << Simulator::Now ().GetSeconds ()); currentTxBytes = 0; diff --git a/examples/stats/wifi-example-apps.cc b/examples/stats/wifi-example-apps.cc index 468aa1a39..56220ea01 100644 --- a/examples/stats/wifi-example-apps.cc +++ b/examples/stats/wifi-example-apps.cc @@ -40,31 +40,31 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("WiFiDistanceApps"); TypeId -Sender::GetTypeId(void) +Sender::GetTypeId (void) { static TypeId tid = TypeId ("Sender") .SetParent () .AddConstructor () .AddAttribute ("PacketSize", "The size of packets transmitted.", - UintegerValue(64), - MakeUintegerAccessor(&Sender::m_pktSize), + UintegerValue (64), + MakeUintegerAccessor (&Sender::m_pktSize), + MakeUintegerChecker(1)) + .AddAttribute ("Destination", "Target host address.", + Ipv4AddressValue ("255.255.255.255"), + MakeIpv4AddressAccessor (&Sender::m_destAddr), + MakeIpv4AddressChecker ()) + .AddAttribute ("Port", "Destination app port.", + UintegerValue (1603), + MakeUintegerAccessor (&Sender::m_destPort), + MakeUintegerChecker()) + .AddAttribute ("NumPackets", "Total number of packets to send.", + UintegerValue (30), + MakeUintegerAccessor (&Sender::m_numPkts), MakeUintegerChecker(1)) - .AddAttribute("Destination", "Target host address.", - Ipv4AddressValue("255.255.255.255"), - MakeIpv4AddressAccessor(&Sender::m_destAddr), - MakeIpv4AddressChecker()) - .AddAttribute("Port", "Destination app port.", - UintegerValue(1603), - MakeUintegerAccessor(&Sender::m_destPort), - MakeUintegerChecker()) - .AddAttribute("NumPackets", "Total number of packets to send.", - UintegerValue(30), - MakeUintegerAccessor(&Sender::m_numPkts), - MakeUintegerChecker(1)) .AddAttribute ("Interval", "Delay between transmissions.", - RandomVariableValue(ConstantVariable(0.5)), - MakeRandomVariableAccessor(&Sender::m_interval), - MakeRandomVariableChecker()) + RandomVariableValue (ConstantVariable (0.5)), + MakeRandomVariableAccessor (&Sender::m_interval), + MakeRandomVariableChecker ()) .AddTraceSource ("Tx", "A new packet is created and is sent", MakeTraceSourceAccessor (&Sender::m_txTrace)) ; @@ -93,54 +93,54 @@ Sender::DoDispose (void) Application::DoDispose (); } -void Sender::StartApplication() +void Sender::StartApplication () { NS_LOG_FUNCTION_NOARGS (); if (m_socket == 0) { - Ptr socketFactory = GetNode()->GetObject - (UdpSocketFactory::GetTypeId()); + Ptr socketFactory = GetNode ()->GetObject + (UdpSocketFactory::GetTypeId ()); m_socket = socketFactory->CreateSocket (); m_socket->Bind (); } m_count = 0; - Simulator::Cancel(m_sendEvent); - m_sendEvent = Simulator::ScheduleNow(&Sender::SendPacket, this); + Simulator::Cancel (m_sendEvent); + m_sendEvent = Simulator::ScheduleNow (&Sender::SendPacket, this); // end Sender::StartApplication } -void Sender::StopApplication() +void Sender::StopApplication () { NS_LOG_FUNCTION_NOARGS (); - Simulator::Cancel(m_sendEvent); + Simulator::Cancel (m_sendEvent); // end Sender::StopApplication } -void Sender::SendPacket() +void Sender::SendPacket () { // NS_LOG_FUNCTION_NOARGS (); - NS_LOG_INFO("Sending packet at " << Simulator::Now() << " to " << - m_destAddr); + NS_LOG_INFO ("Sending packet at " << Simulator::Now () << " to " << + m_destAddr); Ptr packet = Create(m_pktSize); TimestampTag timestamp; - timestamp.SetTimestamp(Simulator::Now()); + timestamp.SetTimestamp (Simulator::Now ()); packet->AddByteTag (timestamp); // Could connect the socket since the address never changes; using SendTo // here simply because all of the standard apps do not. - m_socket->SendTo(packet, 0, InetSocketAddress(m_destAddr, m_destPort)); + m_socket->SendTo (packet, 0, InetSocketAddress (m_destAddr, m_destPort)); // Report the event to the trace. - m_txTrace(packet); + 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 @@ -153,22 +153,22 @@ void Sender::SendPacket() //-- Receiver //------------------------------------------------------ TypeId -Receiver::GetTypeId(void) +Receiver::GetTypeId (void) { static TypeId tid = TypeId ("Receiver") .SetParent () .AddConstructor () - .AddAttribute("Port", "Listening port.", - UintegerValue(1603), - MakeUintegerAccessor(&Receiver::m_port), - MakeUintegerChecker()) + .AddAttribute ("Port", "Listening port.", + UintegerValue (1603), + MakeUintegerAccessor (&Receiver::m_port), + MakeUintegerChecker()) ; return tid; } Receiver::Receiver() : - m_calc(0), - m_delay(0) + m_calc (0), + m_delay (0) { NS_LOG_FUNCTION_NOARGS (); m_socket = 0; @@ -190,75 +190,75 @@ Receiver::DoDispose (void) } void -Receiver::StartApplication() +Receiver::StartApplication () { NS_LOG_FUNCTION_NOARGS (); if (m_socket == 0) { - Ptr socketFactory = GetNode()->GetObject - (UdpSocketFactory::GetTypeId()); - m_socket = socketFactory->CreateSocket(); + Ptr socketFactory = GetNode ()->GetObject + (UdpSocketFactory::GetTypeId ()); + m_socket = socketFactory->CreateSocket (); InetSocketAddress local = - InetSocketAddress(Ipv4Address::GetAny(), m_port); - m_socket->Bind(local); + InetSocketAddress (Ipv4Address::GetAny (), m_port); + m_socket->Bind (local); } - m_socket->SetRecvCallback(MakeCallback(&Receiver::Receive, this)); + m_socket->SetRecvCallback (MakeCallback (&Receiver::Receive, this)); // end Receiver::StartApplication } void -Receiver::StopApplication() +Receiver::StopApplication () { NS_LOG_FUNCTION_NOARGS (); if (m_socket != 0) { - m_socket->SetRecvCallback(MakeNullCallback > ()); + m_socket->SetRecvCallback (MakeNullCallback > ()); } // end Receiver::StopApplication } void -Receiver::SetCounter(Ptr > calc) +Receiver::SetCounter (Ptr > calc) { m_calc = calc; // end Receiver::SetCounter } void -Receiver::SetDelayTracker(Ptr delay) +Receiver::SetDelayTracker (Ptr delay) { m_delay = delay; // end Receiver::SetDelayTracker } void -Receiver::Receive(Ptr socket) +Receiver::Receive (Ptr socket) { // NS_LOG_FUNCTION (this << socket << packet << from); Ptr packet; Address from; - while (packet = socket->RecvFrom(from)) { + while (packet = socket->RecvFrom (from)) { if (InetSocketAddress::IsMatchingType (from)) { - NS_LOG_INFO ("Received " << packet->GetSize() << " bytes from " << - InetSocketAddress::ConvertFrom (from).GetIpv4()); + NS_LOG_INFO ("Received " << packet->GetSize () << " bytes from " << + InetSocketAddress::ConvertFrom (from).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 (packet->FindFirstMatchingByteTag (timestamp)) { + Time tx = timestamp.GetTimestamp (); if (m_delay != 0) { - m_delay->Update(Simulator::Now() - tx); + m_delay->Update (Simulator::Now () - tx); } } if (m_calc != 0) { - m_calc->Update(); + m_calc->Update (); } // end receiving packets @@ -274,21 +274,21 @@ Receiver::Receive(Ptr socket) //-- TimestampTag //------------------------------------------------------ TypeId -TimestampTag::GetTypeId(void) +TimestampTag::GetTypeId (void) { static TypeId tid = TypeId ("TimestampTag") .SetParent () .AddConstructor () .AddAttribute ("Timestamp", "Some momentous point in time!", - EmptyAttributeValue(), - MakeTimeAccessor(&TimestampTag::GetTimestamp), - MakeTimeChecker()) + EmptyAttributeValue (), + MakeTimeAccessor (&TimestampTag::GetTimestamp), + MakeTimeChecker ()) ; return tid; } TypeId -TimestampTag::GetInstanceTypeId(void) const +TimestampTag::GetInstanceTypeId (void) const { return GetTypeId (); } @@ -301,30 +301,30 @@ TimestampTag::GetSerializedSize (void) const void TimestampTag::Serialize (TagBuffer i) const { - int64_t t = m_timestamp.GetNanoSeconds(); - i.Write((const uint8_t *)&t, 8); + int64_t t = m_timestamp.GetNanoSeconds (); + i.Write ((const uint8_t *)&t, 8); } void TimestampTag::Deserialize (TagBuffer i) { int64_t t; - i.Read((uint8_t *)&t, 8); - m_timestamp = NanoSeconds(t); + i.Read ((uint8_t *)&t, 8); + m_timestamp = NanoSeconds (t); } void -TimestampTag::SetTimestamp(Time time) +TimestampTag::SetTimestamp (Time time) { m_timestamp = time; } Time -TimestampTag::GetTimestamp(void) const +TimestampTag::GetTimestamp (void) const { return m_timestamp; } void -TimestampTag::Print(std::ostream &os) const +TimestampTag::Print (std::ostream &os) const { os << "t=" << m_timestamp; } diff --git a/examples/stats/wifi-example-apps.h b/examples/stats/wifi-example-apps.h index 564a952a8..862efac93 100644 --- a/examples/stats/wifi-example-apps.h +++ b/examples/stats/wifi-example-apps.h @@ -39,18 +39,18 @@ using namespace ns3; //------------------------------------------------------ class Sender : public Application { public: - static TypeId GetTypeId(void); + static TypeId GetTypeId (void); Sender(); virtual ~Sender(); protected: - virtual void DoDispose(void); + virtual void DoDispose (void); private: - virtual void StartApplication(void); - virtual void StopApplication(void); + virtual void StartApplication (void); + virtual void StopApplication (void); - void SendPacket(); + void SendPacket (); uint32_t m_pktSize; Ipv4Address m_destAddr; @@ -74,21 +74,21 @@ private: //------------------------------------------------------ class Receiver : public Application { public: - static TypeId GetTypeId(void); + static TypeId GetTypeId (void); Receiver(); virtual ~Receiver(); - void SetCounter(Ptr > calc); - void SetDelayTracker(Ptr delay); + void SetCounter (Ptr > calc); + void SetDelayTracker (Ptr delay); protected: - virtual void DoDispose(void); + virtual void DoDispose (void); private: - virtual void StartApplication(void); - virtual void StopApplication(void); + virtual void StartApplication (void); + virtual void StopApplication (void); - void Receive(Ptr socket); + void Receive (Ptr socket); Ptr m_socket; @@ -114,10 +114,10 @@ public: virtual void Deserialize (TagBuffer i); // these are our accessors to our tag structure - void SetTimestamp(Time time); - Time GetTimestamp(void) const; + void SetTimestamp (Time time); + Time GetTimestamp (void) const; - void Print(std::ostream &os) const; + void Print (std::ostream &os) const; private: Time m_timestamp; diff --git a/examples/stats/wifi-example-sim.cc b/examples/stats/wifi-example-sim.cc index d0152e819..603b2e3a2 100644 --- a/examples/stats/wifi-example-sim.cc +++ b/examples/stats/wifi-example-sim.cc @@ -54,11 +54,11 @@ NS_LOG_COMPONENT_DEFINE ("WiFiDistanceExperiment"); -void TxCallback(Ptr > datac, - std::string path, Ptr packet) { - NS_LOG_INFO("Sent frame counted in " << - datac->GetKey()); - datac->Update(); +void TxCallback (Ptr > datac, + std::string path, Ptr packet) { + NS_LOG_INFO ("Sent frame counted in " << + datac->GetKey ()); + datac->Update (); // end TxCallback } @@ -68,52 +68,52 @@ void TxCallback(Ptr > datac, //---------------------------------------------------------------------- //-- main //---------------------------------------------- -int main(int argc, char *argv[]) { +int main (int argc, char *argv[]) { double distance = 50.0; - string format("omnet"); + string format ("omnet"); - string experiment("wifi-distance-test"); - string strategy("wifi-default"); + string experiment ("wifi-distance-test"); + string strategy ("wifi-default"); string input; string runID; { stringstream sstr; - sstr << "run-" << time(NULL); - runID = sstr.str(); + sstr << "run-" << time (NULL); + runID = sstr.str (); } // Set up command line parameters used to control the experiment. CommandLine cmd; - cmd.AddValue("distance", "Distance apart to place nodes (in meters).", - distance); - cmd.AddValue("format", "Format to use for data output.", - format); - cmd.AddValue("experiment", "Identifier for experiment.", - experiment); - cmd.AddValue("strategy", "Identifier for strategy.", - strategy); - cmd.AddValue("run", "Identifier for run.", - runID); + cmd.AddValue ("distance", "Distance apart to place nodes (in meters).", + distance); + cmd.AddValue ("format", "Format to use for data output.", + format); + cmd.AddValue ("experiment", "Identifier for experiment.", + experiment); + cmd.AddValue ("strategy", "Identifier for strategy.", + strategy); + cmd.AddValue ("run", "Identifier for run.", + runID); cmd.Parse (argc, argv); if (format != "omnet" && format != "db") { - NS_LOG_ERROR("Unknown output format '" << format << "'"); + NS_LOG_ERROR ("Unknown output format '" << format << "'"); return -1; } #ifndef STATS_HAS_SQLITE3 if (format == "db") { - NS_LOG_ERROR("sqlite support not compiled in."); + NS_LOG_ERROR ("sqlite support not compiled in."); return -1; } #endif { - stringstream sstr(""); + stringstream sstr (""); sstr << distance; - input = sstr.str(); + input = sstr.str (); } @@ -122,24 +122,24 @@ int main(int argc, char *argv[]) { //------------------------------------------------------------ //-- Create nodes and network stacks //-------------------------------------------- - NS_LOG_INFO("Creating nodes."); + NS_LOG_INFO ("Creating nodes."); NodeContainer nodes; - nodes.Create(2); + nodes.Create (2); - NS_LOG_INFO("Installing WiFi and Internet stack."); + NS_LOG_INFO ("Installing WiFi and Internet stack."); WifiHelper wifi = WifiHelper::Default (); NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); wifiMac.SetType ("ns3::AdhocWifiMac"); YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default (); wifiPhy.SetChannel (wifiChannel.Create ()); - NetDeviceContainer nodeDevices = wifi.Install(wifiPhy, wifiMac, nodes); + NetDeviceContainer nodeDevices = wifi.Install (wifiPhy, wifiMac, nodes); InternetStackHelper internet; - internet.Install(nodes); + internet.Install (nodes); Ipv4AddressHelper ipAddrs; - ipAddrs.SetBase("192.168.0.0", "255.255.255.0"); - ipAddrs.Assign(nodeDevices); + ipAddrs.SetBase ("192.168.0.0", "255.255.255.0"); + ipAddrs.Assign (nodeDevices); @@ -147,14 +147,14 @@ int main(int argc, char *argv[]) { //------------------------------------------------------------ //-- Setup physical layout //-------------------------------------------- - NS_LOG_INFO("Installing static mobility; distance " << distance << " ."); + NS_LOG_INFO ("Installing static mobility; distance " << distance << " ."); MobilityHelper mobility; Ptr positionAlloc = CreateObject(); - positionAlloc->Add(Vector(0.0, 0.0, 0.0)); - positionAlloc->Add(Vector(0.0, distance, 0.0)); - mobility.SetPositionAllocator(positionAlloc); - mobility.Install(nodes); + positionAlloc->Add (Vector (0.0, 0.0, 0.0)); + positionAlloc->Add (Vector (0.0, distance, 0.0)); + mobility.SetPositionAllocator (positionAlloc); + mobility.Install (nodes); @@ -163,15 +163,15 @@ 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)); + 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)); + appSink->AddApplication (receiver); + receiver->SetStartTime (Seconds (0)); // Config::Set("/NodeList/*/ApplicationList/*/$Sender/Destination", // Ipv4AddressValue("192.168.0.2")); @@ -185,13 +185,13 @@ int main(int argc, char *argv[]) { // Create a DataCollector object to hold information about this run. DataCollector data; - data.DescribeRun(experiment, - strategy, - input, - runID); + data.DescribeRun (experiment, + strategy, + input, + runID); // Add any information we wish to record about this run. - data.AddMetadata("author", "tjkopena"); + data.AddMetadata ("author", "tjkopena"); // Create a counter to track how many frames are generated. Updates @@ -200,11 +200,11 @@ int main(int argc, char *argv[]) { // TxCallback() glue function defined above. Ptr > totalTx = CreateObject >(); - totalTx->SetKey("wifi-tx-frames"); - totalTx->SetContext("node[0]"); - Config::Connect("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Mac/MacTx", - MakeBoundCallback(&TxCallback, totalTx)); - data.AddDataCalculator(totalTx); + totalTx->SetKey ("wifi-tx-frames"); + totalTx->SetContext ("node[0]"); + Config::Connect ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Mac/MacTx", + MakeBoundCallback (&TxCallback, totalTx)); + data.AddDataCalculator (totalTx); // This is similar, but creates a counter to track how many frames // are received. Instead of our own glue function, this uses a @@ -212,12 +212,12 @@ int main(int argc, char *argv[]) { // trace signal generated by the WiFi MAC. Ptr totalRx = CreateObject(); - totalRx->SetKey("wifi-rx-frames"); - totalRx->SetContext("node[1]"); - Config::Connect("/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Mac/MacRx", - MakeCallback(&PacketCounterCalculator::PacketUpdate, - totalRx)); - data.AddDataCalculator(totalRx); + totalRx->SetKey ("wifi-rx-frames"); + totalRx->SetContext ("node[1]"); + Config::Connect ("/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Mac/MacRx", + MakeCallback (&PacketCounterCalculator::PacketUpdate, + totalRx)); + data.AddDataCalculator (totalRx); @@ -227,12 +227,12 @@ int main(int argc, char *argv[]) { // by our Sender class. Ptr appTx = CreateObject(); - appTx->SetKey("sender-tx-packets"); - appTx->SetContext("node[0]"); - Config::Connect("/NodeList/0/ApplicationList/*/$Sender/Tx", - MakeCallback(&PacketCounterCalculator::PacketUpdate, - appTx)); - data.AddDataCalculator(appTx); + appTx->SetKey ("sender-tx-packets"); + appTx->SetContext ("node[0]"); + Config::Connect ("/NodeList/0/ApplicationList/*/$Sender/Tx", + MakeCallback (&PacketCounterCalculator::PacketUpdate, + appTx)); + data.AddDataCalculator (appTx); // Here a counter for received packets is directly manipulated by // one of the custom objects in our simulation, the Receiver @@ -240,10 +240,10 @@ int main(int argc, char *argv[]) { // counter and calls its Update() method whenever a packet arrives. Ptr > appRx = CreateObject >(); - appRx->SetKey("receiver-rx-packets"); - appRx->SetContext("node[1]"); - receiver->SetCounter(appRx); - data.AddDataCalculator(appRx); + appRx->SetKey ("receiver-rx-packets"); + appRx->SetContext ("node[1]"); + receiver->SetCounter (appRx); + data.AddDataCalculator (appRx); @@ -267,13 +267,13 @@ int main(int argc, char *argv[]) { // avg, total # bytes), although in this scenaro they're fixed. Ptr appTxPkts = CreateObject(); - appTxPkts->SetKey("tx-pkt-size"); - appTxPkts->SetContext("node[0]"); - Config::Connect("/NodeList/0/ApplicationList/*/$Sender/Tx", - MakeCallback - (&PacketSizeMinMaxAvgTotalCalculator::PacketUpdate, - appTxPkts)); - data.AddDataCalculator(appTxPkts); + appTxPkts->SetKey ("tx-pkt-size"); + appTxPkts->SetContext ("node[0]"); + Config::Connect ("/NodeList/0/ApplicationList/*/$Sender/Tx", + MakeCallback + (&PacketSizeMinMaxAvgTotalCalculator::PacketUpdate, + appTxPkts)); + data.AddDataCalculator (appTxPkts); // Here we directly manipulate another DataCollector tracking min, @@ -282,10 +282,10 @@ int main(int argc, char *argv[]) { // timestamps to do this. Ptr delayStat = CreateObject(); - delayStat->SetKey("delay"); - delayStat->SetContext("."); - receiver->SetDelayTracker(delayStat); - data.AddDataCalculator(delayStat); + delayStat->SetKey ("delay"); + delayStat->SetContext ("."); + receiver->SetDelayTracker (delayStat); + data.AddDataCalculator (delayStat); @@ -293,9 +293,9 @@ int main(int argc, char *argv[]) { //------------------------------------------------------------ //-- Run the simulation //-------------------------------------------- - NS_LOG_INFO("Run Simulation."); - Simulator::Run(); - Simulator::Destroy(); + NS_LOG_INFO ("Run Simulation."); + Simulator::Run (); + Simulator::Destroy (); @@ -307,21 +307,21 @@ 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."); + 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."); + NS_LOG_INFO ("Creating sqlite formatted data output."); output = CreateObject(); #endif } else { - NS_LOG_ERROR("Unknown output format " << format); + NS_LOG_ERROR ("Unknown output format " << format); } // Finally, have that writer interrogate the DataCollector and save // the results. if (output != 0) - output->Output(data); + output->Output (data); // end main } diff --git a/examples/tcp/star.cc b/examples/tcp/star.cc index b85bb15a5..68aee3b75 100644 --- a/examples/tcp/star.cc +++ b/examples/tcp/star.cc @@ -57,7 +57,7 @@ main (int argc, char *argv[]) uint32_t nSpokes = 8; CommandLine cmd; - cmd.AddValue("nSpokes", "Number of nodes to place in the star", nSpokes); + cmd.AddValue ("nSpokes", "Number of nodes to place in the star", nSpokes); cmd.Parse (argc, argv); NS_LOG_INFO ("Build star topology."); diff --git a/examples/tcp/tcp-large-transfer.cc b/examples/tcp/tcp-large-transfer.cc index 37e7030dc..8e5378acd 100644 --- a/examples/tcp/tcp-large-transfer.cc +++ b/examples/tcp/tcp-large-transfer.cc @@ -61,7 +61,7 @@ uint8_t data[writeSize]; // implement a sending "Application", although not a proper ns3::Application // subclass. -void StartFlow(Ptr, Ipv4Address, uint16_t); +void StartFlow (Ptr, Ipv4Address, uint16_t); void WriteUntilBufferFull (Ptr, uint32_t); static void @@ -104,8 +104,8 @@ int main (int argc, char *argv[]) // First make and configure the helper, so that it will put the appropriate // attributes on the network interfaces and channels we are about to install. PointToPointHelper p2p; - p2p.SetDeviceAttribute ("DataRate", DataRateValue (DataRate(10000000))); - p2p.SetChannelAttribute ("Delay", TimeValue (MilliSeconds(10))); + p2p.SetDeviceAttribute ("DataRate", DataRateValue (DataRate (10000000))); + p2p.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (10))); // And then install devices and channels connecting our topology. NetDeviceContainer dev0 = p2p.Install (n0n1); @@ -176,7 +176,7 @@ int main (int argc, char *argv[]) // Finally, set up the simulator to run. The 1000 second hard limit is a // failsafe in case some change above causes the simulation to never end - Simulator::Stop (Seconds(1000)); + Simulator::Stop (Seconds (1000)); Simulator::Run (); Simulator::Destroy (); } @@ -186,11 +186,11 @@ int main (int argc, char *argv[]) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //begin implementation of sending "Application" -void StartFlow(Ptr localSocket, - Ipv4Address servAddress, - uint16_t servPort) +void StartFlow (Ptr localSocket, + Ipv4Address servAddress, + uint16_t servPort) { - NS_LOG_LOGIC("Starting flow at time " << Simulator::Now ().GetSeconds ()); + NS_LOG_LOGIC ("Starting flow at time " << Simulator::Now ().GetSeconds ()); localSocket->Connect (InetSocketAddress (servAddress, servPort)); //connect // tell the tcp implementation to call WriteUntilBufferFull again diff --git a/examples/tcp/tcp-nsc-lfn.cc b/examples/tcp/tcp-nsc-lfn.cc index 453994c62..168adff4c 100644 --- a/examples/tcp/tcp-nsc-lfn.cc +++ b/examples/tcp/tcp-nsc-lfn.cc @@ -62,10 +62,10 @@ int main (int argc, char *argv[]) CommandLine cmd; // Here, we define additional command line options. // This allows a user to override the defaults set above from the command line. - cmd.AddValue("TCP_CONGESTION", "Linux 2.6.26 Tcp Congestion control algorithm to use", tcpCong); - cmd.AddValue("error-rate", "Error rate to apply to link", errRate); - cmd.AddValue("runtime", "How long the applications should send data (default 120 seconds)", runtime); - cmd.AddValue("nscstack", "Set name of NSC stack (shared library) to use (default liblinux2.6.26.so)", nscStack); + cmd.AddValue ("TCP_CONGESTION", "Linux 2.6.26 Tcp Congestion control algorithm to use", tcpCong); + cmd.AddValue ("error-rate", "Error rate to apply to link", errRate); + cmd.AddValue ("runtime", "How long the applications should send data (default 120 seconds)", runtime); + cmd.AddValue ("nscstack", "Set name of NSC stack (shared library) to use (default liblinux2.6.26.so)", nscStack); cmd.Parse (argc, argv); NodeContainer n; @@ -73,19 +73,19 @@ int main (int argc, char *argv[]) PointToPointHelper p2p; // create point-to-point link with a bandwidth of 6MBit/s and a large delay (0.5 seconds) - p2p.SetDeviceAttribute ("DataRate", DataRateValue (DataRate(6 * 1000 * 1000))); - p2p.SetChannelAttribute ("Delay", TimeValue (MilliSeconds(500))); + p2p.SetDeviceAttribute ("DataRate", DataRateValue (DataRate (6 * 1000 * 1000))); + p2p.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (500))); NetDeviceContainer p2pInterfaces = p2p.Install (n); // The default MTU of the p2p link would be 65535, which doesn't work // well with our default errRate (most packets would arrive corrupted). - p2pInterfaces.Get(0)->SetMtu(1500); - p2pInterfaces.Get(1)->SetMtu(1500); + p2pInterfaces.Get (0)->SetMtu (1500); + p2pInterfaces.Get (1)->SetMtu (1500); InternetStackHelper internet; // The next statement switches the nodes to 'NSC'-Mode. // It disables the native ns-3 TCP model and loads the NSC library. - internet.SetTcp ("ns3::NscTcpL4Protocol","Library",StringValue(nscStack)); + internet.SetTcp ("ns3::NscTcpL4Protocol","Library",StringValue (nscStack)); internet.Install (n); if (tcpCong != "cubic") // make sure we only fail if both --nscstack and --TCP_CONGESTION are used @@ -100,16 +100,16 @@ int main (int argc, char *argv[]) ipv4.SetBase ("10.0.0.0", "255.255.255.0"); Ipv4InterfaceContainer ipv4Interfaces = ipv4.Assign (p2pInterfaces); - DoubleValue rate(errRate); - RandomVariableValue u01(UniformVariable (0.0, 1.0)); + DoubleValue rate (errRate); + RandomVariableValue u01 (UniformVariable (0.0, 1.0)); Ptr em1 = CreateObjectWithAttributes ("RanVar", u01, "ErrorRate", rate); Ptr em2 = CreateObjectWithAttributes ("RanVar", u01, "ErrorRate", rate); // This enables the specified errRate on both link endpoints. - p2pInterfaces.Get(0)->SetAttribute("ReceiveErrorModel", PointerValue (em1)); - p2pInterfaces.Get(1)->SetAttribute("ReceiveErrorModel", PointerValue (em2)); + p2pInterfaces.Get (0)->SetAttribute ("ReceiveErrorModel", PointerValue (em1)); + p2pInterfaces.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (em2)); Ipv4GlobalRoutingHelper::PopulateRoutingTables (); @@ -123,11 +123,11 @@ 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)); + Address remoteAddress (InetSocketAddress (ipv4Interfaces.GetAddress (i), servPort)); OnOffHelper clientHelper ("ns3::TcpSocketFactory", remoteAddress); clientHelper.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); clientHelper.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); - ApplicationContainer clientApp = clientHelper.Install(n.Get(j)); + ApplicationContainer clientApp = clientHelper.Install (n.Get (j)); clientApp.Start (Seconds (1.0 + i)); clientApp.Stop (Seconds (runtime + 1.0 + i)); } @@ -135,7 +135,7 @@ int main (int argc, char *argv[]) // This tells ns-3 to generate pcap traces. p2p.EnablePcapAll ("tcp-nsc-lfn"); - Simulator::Stop (Seconds(900)); + Simulator::Stop (Seconds (900)); Simulator::Run (); Simulator::Destroy (); diff --git a/examples/tcp/tcp-nsc-zoo.cc b/examples/tcp/tcp-nsc-zoo.cc index cacbb5d06..c8c958b63 100644 --- a/examples/tcp/tcp-nsc-zoo.cc +++ b/examples/tcp/tcp-nsc-zoo.cc @@ -41,7 +41,7 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("TcpNscZoo"); // Simulates a diverse network with various stacks supported by NSC. -int main(int argc, char *argv[]) +int main (int argc, char *argv[]) { CsmaHelper csma; unsigned int MaxNodes = 4; @@ -51,8 +51,8 @@ int main(int argc, char *argv[]) Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue ("8kbps")); CommandLine cmd; // this allows the user to raise the number of nodes using --nodes=X command-line argument. - cmd.AddValue("nodes", "Number of nodes in the network (must be > 1)", MaxNodes); - cmd.AddValue("runtime", "How long the applications should send data (default 3 seconds)", runtime); + cmd.AddValue ("nodes", "Number of nodes in the network (must be > 1)", MaxNodes); + cmd.AddValue ("runtime", "How long the applications should send data (default 3 seconds)", runtime); cmd.Parse (argc, argv); if (MaxNodes < 2) @@ -60,18 +60,18 @@ int main(int argc, char *argv[]) std::cerr << "--nodes: must be >= 2" << std::endl; return 1; } - csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate(100 * 1000 * 1000))); + csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (100 * 1000 * 1000))); csma.SetChannelAttribute ("Delay", TimeValue (MicroSeconds (200))); NodeContainer n; - n.Create(MaxNodes); + n.Create (MaxNodes); NetDeviceContainer ethInterfaces = csma.Install (n); InternetStackHelper internetStack; - internetStack.SetTcp ("ns3::NscTcpL4Protocol","Library",StringValue("liblinux2.6.26.so")); + internetStack.SetTcp ("ns3::NscTcpL4Protocol","Library",StringValue ("liblinux2.6.26.so")); // this switches nodes 0 and 1 to NSCs Linux 2.6.26 stack. - internetStack.Install (n.Get(0)); - internetStack.Install (n.Get(1)); + internetStack.Install (n.Get (0)); + internetStack.Install (n.Get (1)); // this disables TCP SACK, wscale and timestamps on node 1 (the attributes represent sysctl-values). Config::Set ("/NodeList/1/$ns3::Ns3NscStack/net.ipv4.tcp_sack", StringValue ("0")); Config::Set ("/NodeList/1/$ns3::Ns3NscStack/net.ipv4.tcp_timestamps", StringValue ("0")); @@ -79,16 +79,16 @@ int main(int argc, char *argv[]) if (MaxNodes > 2) { - internetStack.Install (n.Get(2)); + internetStack.Install (n.Get (2)); } if (MaxNodes > 3) { // the next statement doesn't change anything for the nodes 0, 1, and 2; since they // already have a stack assigned. - internetStack.SetTcp ("ns3::NscTcpL4Protocol","Library",StringValue("liblinux2.6.26.so")); + internetStack.SetTcp ("ns3::NscTcpL4Protocol","Library",StringValue ("liblinux2.6.26.so")); // this switches node 3 to NSCs Linux 2.6.26 stack. - internetStack.Install (n.Get(3)); + internetStack.Install (n.Get (3)); // and then agains disables sack/timestamps/wscale on node 3. Config::Set ("/NodeList/3/$ns3::Ns3NscStack/net.ipv4.tcp_sack", StringValue ("0")); Config::Set ("/NodeList/3/$ns3::Ns3NscStack/net.ipv4.tcp_timestamps", StringValue ("0")); @@ -98,7 +98,7 @@ int main(int argc, char *argv[]) // internetStack.SetNscStack ("libfreebsd5.so"); for (unsigned int i =4; i < MaxNodes; i++) { - internetStack.Install (n.Get(i)); + internetStack.Install (n.Get (i)); } Ipv4AddressHelper ipv4; @@ -123,13 +123,13 @@ int main(int argc, char *argv[]) { // ...but we don't want a node to talk to itself. continue; } - Address remoteAddress(InetSocketAddress(ipv4Interfaces.GetAddress (j), servPort)); + Address remoteAddress (InetSocketAddress (ipv4Interfaces.GetAddress (j), servPort)); OnOffHelper clientHelper ("ns3::TcpSocketFactory", remoteAddress); clientHelper.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); clientHelper.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); - ApplicationContainer clientApp = clientHelper.Install(n.Get(i)); + ApplicationContainer clientApp = clientHelper.Install (n.Get (i)); clientApp.Start (Seconds (j)); /* delay startup depending on node number */ clientApp.Stop (Seconds (j + runtime)); } @@ -137,7 +137,7 @@ int main(int argc, char *argv[]) csma.EnablePcapAll ("tcp-nsc-zoo", false); - Simulator::Stop (Seconds(100)); + Simulator::Stop (Seconds (100)); Simulator::Run (); Simulator::Destroy (); diff --git a/examples/tcp/tcp-star-server.cc b/examples/tcp/tcp-star-server.cc index cb2d31e42..f0157d45e 100644 --- a/examples/tcp/tcp-star-server.cc +++ b/examples/tcp/tcp-star-server.cc @@ -78,24 +78,24 @@ main (int argc, char *argv[]) // Allow the user to override any of the defaults and the above // Config::SetDefault()s at run-time, via command-line arguments CommandLine cmd; - cmd.AddValue("nNodes", "Number of nodes to place in the star", N); + cmd.AddValue ("nNodes", "Number of nodes to place in the star", N); cmd.Parse (argc, argv); // Here, we will create N nodes in a star. NS_LOG_INFO ("Create nodes."); NodeContainer serverNode; NodeContainer clientNodes; - serverNode.Create(1); - clientNodes.Create(N-1); - NodeContainer allNodes = NodeContainer(serverNode, clientNodes); + serverNode.Create (1); + clientNodes.Create (N-1); + NodeContainer allNodes = NodeContainer (serverNode, clientNodes); // Install network stacks on the nodes InternetStackHelper internet; internet.Install (allNodes); //Collect an adjacency list of nodes for the p2p topology - std::vector nodeAdjacencyList(N-1); - for(uint32_t i=0; i nodeAdjacencyList (N-1); + for(uint32_t i=0; i deviceAdjacencyList(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 interfaceAdjacencyList (N-1); + for(uint32_t i=0; iSetStartTime (Seconds (1.)); app->SetStopTime (Seconds (20.)); - devices.Get (1)->TraceConnectWithoutContext("PhyRxDrop", MakeCallback (&RxDrop)); + devices.Get (1)->TraceConnectWithoutContext ("PhyRxDrop", MakeCallback (&RxDrop)); - Simulator::Stop (Seconds(20)); + Simulator::Stop (Seconds (20)); Simulator::Run (); Simulator::Destroy (); diff --git a/examples/tutorial/first.cc b/examples/tutorial/first.cc index cb1481028..36a05b403 100644 --- a/examples/tutorial/first.cc +++ b/examples/tutorial/first.cc @@ -27,8 +27,8 @@ NS_LOG_COMPONENT_DEFINE ("FirstScriptExample"); int main (int argc, char *argv[]) { - LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO); - LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO); + LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO); + LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO); NodeContainer nodes; nodes.Create (2); diff --git a/examples/tutorial/fourth.cc b/examples/tutorial/fourth.cc index f1284ce6f..01787da67 100644 --- a/examples/tutorial/fourth.cc +++ b/examples/tutorial/fourth.cc @@ -52,7 +52,7 @@ int main (int argc, char *argv[]) { Ptr myObject = CreateObject (); - myObject->TraceConnectWithoutContext ("MyInteger", MakeCallback(&IntTrace)); + myObject->TraceConnectWithoutContext ("MyInteger", MakeCallback (&IntTrace)); myObject->m_myInt = 1234; } diff --git a/examples/tutorial/second.cc b/examples/tutorial/second.cc index 7c85f5c58..a486f5141 100644 --- a/examples/tutorial/second.cc +++ b/examples/tutorial/second.cc @@ -49,8 +49,8 @@ main (int argc, char *argv[]) if (verbose) { - LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO); - LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO); + LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO); + LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO); } nCsma = nCsma == 0 ? 1 : nCsma; diff --git a/examples/tutorial/sixth.cc b/examples/tutorial/sixth.cc index c0822b83d..915f2dc13 100644 --- a/examples/tutorial/sixth.cc +++ b/examples/tutorial/sixth.cc @@ -171,7 +171,7 @@ static void RxDrop (Ptr file, Ptr p) { NS_LOG_UNCOND ("RxDrop at " << Simulator::Now ().GetSeconds ()); - file->Write(Simulator::Now(), p); + file->Write (Simulator::Now (), p); } int @@ -200,7 +200,7 @@ main (int argc, char *argv[]) Ipv4InterfaceContainer interfaces = address.Assign (devices); uint16_t sinkPort = 8080; - Address sinkAddress (InetSocketAddress(interfaces.GetAddress (1), sinkPort)); + Address sinkAddress (InetSocketAddress (interfaces.GetAddress (1), sinkPort)); PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), sinkPort)); ApplicationContainer sinkApps = packetSinkHelper.Install (nodes.Get (1)); sinkApps.Start (Seconds (0.)); @@ -220,9 +220,9 @@ main (int argc, char *argv[]) PcapHelper pcapHelper; Ptr file = pcapHelper.CreateFile ("sixth.pcap", std::ios::out, PcapHelper::DLT_PPP); - devices.Get (1)->TraceConnectWithoutContext("PhyRxDrop", MakeBoundCallback (&RxDrop, file)); + devices.Get (1)->TraceConnectWithoutContext ("PhyRxDrop", MakeBoundCallback (&RxDrop, file)); - Simulator::Stop (Seconds(20)); + Simulator::Stop (Seconds (20)); Simulator::Run (); Simulator::Destroy (); diff --git a/examples/tutorial/third.cc b/examples/tutorial/third.cc index c63da3327..29b2671ae 100644 --- a/examples/tutorial/third.cc +++ b/examples/tutorial/third.cc @@ -54,8 +54,8 @@ main (int argc, char *argv[]) if (verbose) { - LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO); - LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO); + LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO); + LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO); } NodeContainer p2pNodes; diff --git a/examples/udp-client-server/udp-client-server.cc b/examples/udp-client-server/udp-client-server.cc index 3ab40991c..64f38fd0a 100644 --- a/examples/udp-client-server/udp-client-server.cc +++ b/examples/udp-client-server/udp-client-server.cc @@ -58,7 +58,7 @@ main (int argc, char *argv[]) // Explicitly create the channels required by the topology (shown above). // CsmaHelper csma; - csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate(5000000))); + csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000))); csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); csma.SetDeviceAttribute ("Mtu", UintegerValue (1400)); NetDeviceContainer d = csma.Install (n); @@ -77,7 +77,7 @@ main (int argc, char *argv[]) // uint16_t port = 4000; UdpServerHelper server (port); - ApplicationContainer apps = server.Install (n.Get(1)); + ApplicationContainer apps = server.Install (n.Get (1)); apps.Start (Seconds (1.0)); apps.Stop (Seconds (10.0)); diff --git a/examples/udp-client-server/udp-trace-client-server.cc b/examples/udp-client-server/udp-trace-client-server.cc index bbb9222a4..0aa9b9502 100644 --- a/examples/udp-client-server/udp-trace-client-server.cc +++ b/examples/udp-client-server/udp-trace-client-server.cc @@ -57,7 +57,7 @@ main (int argc, char *argv[]) // Explicitly create the channels required by the topology (shown above). // CsmaHelper csma; - csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate(5000000))); + csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000))); csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); csma.SetDeviceAttribute ("Mtu", UintegerValue (1500)); NetDeviceContainer d = csma.Install (n); @@ -76,7 +76,7 @@ main (int argc, char *argv[]) // uint16_t port = 4000; UdpServerHelper server (port); - ApplicationContainer apps = server.Install (n.Get(1)); + ApplicationContainer apps = server.Install (n.Get (1)); apps.Start (Seconds (1.0)); apps.Stop (Seconds (10.0)); diff --git a/examples/udp/udp-echo.cc b/examples/udp/udp-echo.cc index 8e0c071f7..e6d214921 100644 --- a/examples/udp/udp-echo.cc +++ b/examples/udp/udp-echo.cc @@ -44,8 +44,8 @@ main (int argc, char *argv[]) // #if 0 LogComponentEnable ("UdpEchoExample", LOG_LEVEL_INFO); - LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL); - LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL); + LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_ALL); + LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_ALL); #endif // // Allow the user to override any of the defaults and the above Bind() at @@ -68,7 +68,7 @@ main (int argc, char *argv[]) // Explicitly create the channels required by the topology (shown above). // CsmaHelper csma; - csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate(5000000))); + csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000))); csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); csma.SetDeviceAttribute ("Mtu", UintegerValue (1400)); NetDeviceContainer d = csma.Install (n); @@ -87,7 +87,7 @@ main (int argc, char *argv[]) // uint16_t port = 9; // well-known echo port number UdpEchoServerHelper server (port); - ApplicationContainer apps = server.Install (n.Get(1)); + ApplicationContainer apps = server.Install (n.Get (1)); apps.Start (Seconds (1.0)); apps.Stop (Seconds (10.0)); @@ -111,12 +111,12 @@ main (int argc, char *argv[]) // Users may find it convenient to initialize echo packets with actual data; // the below lines suggest how to do this // - client.SetFill(apps.Get (0), "Hello World"); + client.SetFill (apps.Get (0), "Hello World"); - client.SetFill(apps.Get (0), 0xa5, 1024); + client.SetFill (apps.Get (0), 0xa5, 1024); uint8_t fill[] = { 0, 1, 2, 3, 4, 5, 6}; - client.SetFill(apps.Get (0), fill, sizeof(fill), 1024); + client.SetFill (apps.Get (0), fill, sizeof(fill), 1024); #endif AsciiTraceHelper ascii; diff --git a/examples/wireless/mixed-wireless.cc b/examples/wireless/mixed-wireless.cc index 1c7acdc20..a565f31aa 100644 --- a/examples/wireless/mixed-wireless.cc +++ b/examples/wireless/mixed-wireless.cc @@ -115,12 +115,12 @@ main (int argc, char *argv[]) // "--backboneNodes=20" // CommandLine cmd; - cmd.AddValue("backboneNodes", "number of backbone nodes", backboneNodes); + cmd.AddValue ("backboneNodes", "number of backbone nodes", backboneNodes); cmd.AddValue ("infraNodes", "number of leaf nodes", infraNodes); - cmd.AddValue("lanNodes", "number of LAN nodes", lanNodes); - cmd.AddValue("stopTime", "simulation stop time (seconds)", stopTime); - cmd.AddValue("useCourseChangeCallback", "whether to enable course change tracing", useCourseChangeCallback); - cmd.AddValue("enableTracing", "enable tracing", enableTracing); + cmd.AddValue ("lanNodes", "number of LAN nodes", lanNodes); + cmd.AddValue ("stopTime", "simulation stop time (seconds)", stopTime); + cmd.AddValue ("useCourseChangeCallback", "whether to enable course change tracing", useCourseChangeCallback); + cmd.AddValue ("enableTracing", "enable tracing", enableTracing); // // The system global variables and the local values added to the argument @@ -273,10 +273,10 @@ main (int argc, char *argv[]) NqosWifiMacHelper macInfra = NqosWifiMacHelper::Default (); wifiPhy.SetChannel (wifiChannel.Create ()); // Create unique ssids for these networks - std::string ssidString("wifi-infra"); + std::string ssidString ("wifi-infra"); std::stringstream ss; ss << i; - ssidString += ss.str(); + ssidString += ss.str (); Ssid ssid = Ssid (ssidString); wifiInfra.SetRemoteStationManager ("ns3::ArfWifiManager"); // setup stas @@ -359,7 +359,7 @@ main (int argc, char *argv[]) uint32_t lastNodeIndex = backboneNodes + backboneNodes*(lanNodes - 1) + backboneNodes*(infraNodes - 1) - 1; Ptr appSink = NodeList::GetNode (lastNodeIndex); // Let's fetch the IP address of the last node, which is on Ipv4Interface 1 - Ipv4Address remoteAddr = appSink->GetObject ()->GetAddress(1, 0).GetLocal (); + Ipv4Address remoteAddr = appSink->GetObject ()->GetAddress (1, 0).GetLocal (); OnOffHelper onoff ("ns3::UdpSocketFactory", Address (InetSocketAddress (remoteAddr, port))); diff --git a/examples/wireless/multirate.cc b/examples/wireless/multirate.cc index e2a4e2020..65a643f43 100644 --- a/examples/wireless/multirate.cc +++ b/examples/wireless/multirate.cc @@ -91,7 +91,7 @@ private: Vector GetPosition (Ptr node); Ptr SetupPacketReceive (Ptr node); - NodeContainer GenerateNeighbors(NodeContainer c, uint32_t senderId); + NodeContainer GenerateNeighbors (NodeContainer c, uint32_t senderId); void ApplicationSetup (Ptr client, Ptr server, double start, double stop); void AssignNeighbors (NodeContainer c); @@ -130,7 +130,7 @@ Experiment::Experiment (std::string name) : m_output (name), totalTime (0.3), expMean (0.1), //flows being exponentially distributed - bytesTotal(0), + bytesTotal (0), packetSize (2000), gridSize (10), //10x10 grid for a total of 100 nodes nodeDistance (30), @@ -166,12 +166,12 @@ Experiment::ReceivePacket (Ptr socket) Ptr packet; while (packet = socket->Recv ()) { - bytesTotal += packet->GetSize(); + bytesTotal += packet->GetSize (); } } void -Experiment::CheckThroughput() +Experiment::CheckThroughput () { double mbs = ((bytesTotal * 8.0) /1000000); bytesTotal = 0; @@ -205,13 +205,13 @@ Experiment::AssignNeighbors (NodeContainer c) //lower left quadrant if ( i < totalNodes/2 ) { - containerA.Add(c.Get(i)); + containerA.Add (c.Get (i)); } //upper left quadrant if ( i >= (uint32_t)(4*totalNodes)/10 ) { - containerC.Add(c.Get(i)); + containerC.Add (c.Get (i)); } } if ( (i % gridSize) >= (gridSize/2 - 1)) @@ -219,13 +219,13 @@ Experiment::AssignNeighbors (NodeContainer c) //lower right quadrant if ( i < totalNodes/2 ) { - containerB.Add(c.Get(i)); + containerB.Add (c.Get (i)); } //upper right quadrant if ( i >= (uint32_t)(4*totalNodes)/10 ) { - containerD.Add(c.Get(i)); + containerD.Add (c.Get (i)); } } } @@ -243,11 +243,11 @@ Experiment::GenerateNeighbors (NodeContainer c, uint32_t senderId) for (uint32_t i= senderId - 2; i <= limit; i++) { //must ensure the boundaries for other topologies - nc.Add(c.Get(i)); - nc.Add(c.Get(i + 10)); - nc.Add(c.Get(i + 20)); - nc.Add(c.Get(i - 10)); - nc.Add(c.Get(i - 20)); + nc.Add (c.Get (i)); + nc.Add (c.Get (i + 10)); + nc.Add (c.Get (i + 20)); + nc.Add (c.Get (i - 10)); + nc.Add (c.Get (i - 20)); } return nc; } @@ -260,13 +260,13 @@ Experiment::GenerateNeighbors (NodeContainer c, uint32_t senderId) void Experiment::SelectSrcDest (NodeContainer c) { - uint32_t totalNodes = c.GetN(); + uint32_t totalNodes = c.GetN (); UniformVariable uvSrc (0, totalNodes/2 -1); UniformVariable uvDest (totalNodes/2, totalNodes); for (uint32_t i=0; i < totalNodes/3; i++) { - ApplicationSetup (c.Get(uvSrc.RandomVariable::GetInteger()), c.Get(uvDest.RandomVariable::GetInteger()), 0, totalTime); + ApplicationSetup (c.Get (uvSrc.RandomVariable::GetInteger ()), c.Get (uvDest.RandomVariable::GetInteger ()), 0, totalTime); } } @@ -277,28 +277,28 @@ Experiment::SelectSrcDest (NodeContainer c) * */ void -Experiment::SendMultiDestinations(Ptr sender, NodeContainer c) +Experiment::SendMultiDestinations (Ptr sender, NodeContainer c) { // UniformVariable params: (Xrange, Yrange) - UniformVariable uv(0, c.GetN ()); + UniformVariable uv (0, c.GetN ()); // ExponentialVariable params: (mean, upperbound) - ExponentialVariable ev(expMean, totalTime); + ExponentialVariable ev (expMean, totalTime); double start=0.0, stop=totalTime; uint32_t destIndex; for (uint32_t i=0; i < c.GetN (); i++) { - stop = start + ev.GetValue(); - NS_LOG_DEBUG("Start=" << start << " Stop=" << stop); + stop = start + ev.GetValue (); + NS_LOG_DEBUG ("Start=" << start << " Stop=" << stop); do { - destIndex = (uint32_t) uv.GetValue(); - } while ( (c.Get(destIndex))->GetId () == sender->GetId ()); + destIndex = (uint32_t) uv.GetValue (); + } while ( (c.Get (destIndex))->GetId () == sender->GetId ()); - ApplicationSetup (sender, c.Get(destIndex), start, stop); + ApplicationSetup (sender, c.Get (destIndex), start, stop); start = stop; @@ -319,20 +319,20 @@ Experiment::ApplicationSetup (Ptr client, Ptr server, double start, Ptr ipv4Server = server->GetObject(); Ptr ipv4Client = client->GetObject(); - Ipv4InterfaceAddress iaddrServer = ipv4Server->GetAddress(1,0); - Ipv4InterfaceAddress iaddrClient = ipv4Client->GetAddress(1,0); + Ipv4InterfaceAddress iaddrServer = ipv4Server->GetAddress (1,0); + Ipv4InterfaceAddress iaddrClient = ipv4Client->GetAddress (1,0); Ipv4Address ipv4AddrServer = iaddrServer.GetLocal (); Ipv4Address ipv4AddrClient = iaddrClient.GetLocal (); - NS_LOG_DEBUG("Set up Server Device " << (server->GetDevice(0))->GetAddress () - << " with ip " << ipv4AddrServer - << " position (" << serverPos.x << "," << serverPos.y << "," << serverPos.z << ")"); + NS_LOG_DEBUG ("Set up Server Device " << (server->GetDevice (0))->GetAddress () + << " with ip " << ipv4AddrServer + << " position (" << serverPos.x << "," << serverPos.y << "," << serverPos.z << ")"); - NS_LOG_DEBUG("Set up Client Device " << (client->GetDevice(0))->GetAddress () - << " with ip " << ipv4AddrClient - << " position (" << clientPos.x << "," << clientPos.y << "," << clientPos.z << ")" - << "\n"); + NS_LOG_DEBUG ("Set up Client Device " << (client->GetDevice (0))->GetAddress () + << " with ip " << ipv4AddrClient + << " position (" << clientPos.x << "," << clientPos.y << "," << clientPos.z << ")" + << "\n"); //cast serverPos,clientPos,iaddrClient to void, to suppress variable set but not //used compiler warning in optimized builds @@ -341,12 +341,12 @@ Experiment::ApplicationSetup (Ptr client, Ptr server, double start, (void) ipv4AddrClient; // Equipping the source node with OnOff Application used for sending - OnOffHelper onoff ("ns3::UdpSocketFactory", Address(InetSocketAddress(Ipv4Address("10.0.0.1"), port))); + OnOffHelper onoff ("ns3::UdpSocketFactory", Address (InetSocketAddress (Ipv4Address ("10.0.0.1"), port))); onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); onoff.SetAttribute ("DataRate", DataRateValue (DataRate (60000000))); onoff.SetAttribute ("PacketSize", UintegerValue (packetSize)); - onoff.SetAttribute ("Remote", AddressValue(InetSocketAddress (ipv4AddrServer, port))); + onoff.SetAttribute ("Remote", AddressValue (InetSocketAddress (ipv4AddrServer, port))); ApplicationContainer apps = onoff.Install (client); apps.Start (Seconds (start)); @@ -388,7 +388,7 @@ Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, if (enableRouting) { - internet.SetRoutingHelper(list); // has effect on the next Install () + internet.SetRoutingHelper (list); // has effect on the next Install () } internet.Install (c); @@ -397,7 +397,7 @@ Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, address.SetBase ("10.0.0.0", "255.255.255.0"); Ipv4InterfaceContainer ipInterfaces; - ipInterfaces = address.Assign(devices); + ipInterfaces = address.Assign (devices); MobilityHelper mobil= mobility; mobil.SetPositionAllocator ("ns3::GridPositionAllocator", @@ -426,7 +426,7 @@ Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, if ( scenario == 1 && enableRouting) { - SelectSrcDest(c); + SelectSrcDest (c); } else if ( scenario == 2) { @@ -438,21 +438,21 @@ Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, } else if ( scenario == 3) { - AssignNeighbors(c); + AssignNeighbors (c); //Note: these senders are hand-picked in order to ensure good coverage //for 10x10 grid, basically one sender for each quadrant //you might have to change these values for other grids - NS_LOG_DEBUG(">>>>>>>>>region A<<<<<<<<<"); - SendMultiDestinations(c.Get(22), containerA); + NS_LOG_DEBUG (">>>>>>>>>region A<<<<<<<<<"); + SendMultiDestinations (c.Get (22), containerA); - NS_LOG_DEBUG(">>>>>>>>>region B<<<<<<<<<"); - SendMultiDestinations(c.Get(26), containerB); + NS_LOG_DEBUG (">>>>>>>>>region B<<<<<<<<<"); + SendMultiDestinations (c.Get (26), containerB); - NS_LOG_DEBUG(">>>>>>>>>region C<<<<<<<<<"); - SendMultiDestinations(c.Get(72), containerC); + NS_LOG_DEBUG (">>>>>>>>>region C<<<<<<<<<"); + SendMultiDestinations (c.Get (72), containerC); - NS_LOG_DEBUG(">>>>>>>>>region D<<<<<<<<<"); - SendMultiDestinations(c.Get(76), containerD); + NS_LOG_DEBUG (">>>>>>>>>region D<<<<<<<<<"); + SendMultiDestinations (c.Get (76), containerD); } else if ( scenario == 4) { @@ -461,38 +461,38 @@ Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, //you might have to change these values for other grids NodeContainer c1, c2, c3, c4, c5, c6, c7, c8, c9; - c1 = GenerateNeighbors(c, 22); - c2 = GenerateNeighbors(c, 24);; - c3 = GenerateNeighbors(c, 26);; - c4 = GenerateNeighbors(c, 42);; - c5 = GenerateNeighbors(c, 44);; - c6 = GenerateNeighbors(c, 46);; - c7 = GenerateNeighbors(c, 62);; - c8 = GenerateNeighbors(c, 64);; - c9 = GenerateNeighbors(c, 66);; + c1 = GenerateNeighbors (c, 22); + c2 = GenerateNeighbors (c, 24);; + c3 = GenerateNeighbors (c, 26);; + c4 = GenerateNeighbors (c, 42);; + c5 = GenerateNeighbors (c, 44);; + c6 = GenerateNeighbors (c, 46);; + c7 = GenerateNeighbors (c, 62);; + c8 = GenerateNeighbors (c, 64);; + c9 = GenerateNeighbors (c, 66);; - SendMultiDestinations(c.Get(22), c1); - SendMultiDestinations(c.Get(24), c2); - SendMultiDestinations(c.Get(26), c3); - SendMultiDestinations(c.Get(42), c4); - SendMultiDestinations(c.Get(44), c5); - SendMultiDestinations(c.Get(46), c6); - SendMultiDestinations(c.Get(62), c7); - SendMultiDestinations(c.Get(64), c8); - SendMultiDestinations(c.Get(66), c9); + SendMultiDestinations (c.Get (22), c1); + SendMultiDestinations (c.Get (24), c2); + SendMultiDestinations (c.Get (26), c3); + SendMultiDestinations (c.Get (42), c4); + SendMultiDestinations (c.Get (44), c5); + SendMultiDestinations (c.Get (46), c6); + SendMultiDestinations (c.Get (62), c7); + SendMultiDestinations (c.Get (64), c8); + SendMultiDestinations (c.Get (66), c9); } CheckThroughput (); if (enablePcap) { - phy.EnablePcapAll(GetOutputFileName()); + phy.EnablePcapAll (GetOutputFileName ()); } if (enableTracing) { AsciiTraceHelper ascii; - phy.EnableAsciiAll (ascii.CreateFileStream (GetOutputFileName() + ".tr")); + phy.EnableAsciiAll (ascii.CreateFileStream (GetOutputFileName () + ".tr")); } Ptr flowmon; @@ -508,7 +508,7 @@ Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, if (enableFlowMon) { - flowmon->SerializeToXmlFile ((GetOutputFileName() + ".flomon"), false, false); + flowmon->SerializeToXmlFile ((GetOutputFileName () + ".flomon"), false, false); } Simulator::Destroy (); @@ -541,13 +541,13 @@ int main (int argc, char *argv[]) experiment = Experiment ("multirate"); //for commandline input - experiment.CommandSetup(argc, argv); + experiment.CommandSetup (argc, argv); // set value to 0 for enabling fragmentation Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200")); - Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue (experiment.GetRtsThreshold())); + Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue (experiment.GetRtsThreshold ())); - std::ofstream outfile ((experiment.GetOutputFileName()+ ".plt").c_str()); + std::ofstream outfile ((experiment.GetOutputFileName ()+ ".plt").c_str ()); MobilityHelper mobility; Gnuplot gnuplot; @@ -560,16 +560,16 @@ int main (int argc, char *argv[]) Ssid ssid = Ssid ("Testbed"); wifiMac.SetType ("ns3::AdhocWifiMac", - "Ssid", SsidValue(ssid)); + "Ssid", SsidValue (ssid)); wifi.SetStandard (WIFI_PHY_STANDARD_holland); - wifi.SetRemoteStationManager (experiment.GetRateManager()); + wifi.SetRemoteStationManager (experiment.GetRateManager ()); NS_LOG_INFO ("Scenario: " << experiment.GetScenario ()); - NS_LOG_INFO ("Rts Threshold: " << experiment.GetRtsThreshold()); - NS_LOG_INFO ("Name: " << experiment.GetOutputFileName()); - NS_LOG_INFO ("Rate: " << experiment.GetRateManager()); - NS_LOG_INFO ("Routing: " << experiment.IsRouting()); - NS_LOG_INFO ("Mobility: " << experiment.IsMobility()); + NS_LOG_INFO ("Rts Threshold: " << experiment.GetRtsThreshold ()); + NS_LOG_INFO ("Name: " << experiment.GetOutputFileName ()); + NS_LOG_INFO ("Rate: " << experiment.GetRateManager ()); + NS_LOG_INFO ("Routing: " << experiment.IsRouting ()); + NS_LOG_INFO ("Mobility: " << experiment.IsMobility ()); dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel, mobility); diff --git a/examples/wireless/ofdm-validation.cc b/examples/wireless/ofdm-validation.cc index 9cc417ddb..02c22c289 100644 --- a/examples/wireless/ofdm-validation.cc +++ b/examples/wireless/ofdm-validation.cc @@ -54,7 +54,7 @@ int main (int argc, char *argv[]) Ptr yans = CreateObject (); Ptr nist = CreateObject (); - for (uint32_t i = 0; i < modes.size(); i++) + for (uint32_t i = 0; i < modes.size (); i++) { std::cout << modes[i] << std::endl; Gnuplot2dDataset yansdataset (modes[i]); @@ -62,9 +62,9 @@ int main (int argc, char *argv[]) for (double snr = -5.0; snr <= 30.0; snr += 0.1) { - double ps = yans->GetChunkSuccessRate(WifiMode(modes[i]), pow(10.0,snr/10.0), FrameSize*8); + double ps = yans->GetChunkSuccessRate (WifiMode (modes[i]), pow (10.0,snr/10.0), FrameSize*8); yansdataset.Add (snr, ps); - ps = nist->GetChunkSuccessRate(WifiMode(modes[i]), pow(10.0,snr/10.0), FrameSize*8); + ps = nist->GetChunkSuccessRate (WifiMode (modes[i]), pow (10.0,snr/10.0), FrameSize*8); nistdataset.Add (snr, ps); } diff --git a/examples/wireless/wifi-adhoc.cc b/examples/wireless/wifi-adhoc.cc index 1caf2d906..1c15aa97a 100644 --- a/examples/wireless/wifi-adhoc.cc +++ b/examples/wireless/wifi-adhoc.cc @@ -138,7 +138,7 @@ Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, mobility.Install (c); PacketSocketAddress socket; - socket.SetSingleDevice(devices.Get (0)->GetIfIndex ()); + socket.SetSingleDevice (devices.Get (0)->GetIfIndex ()); socket.SetPhysicalAddress (devices.Get (1)->GetAddress ()); socket.SetProtocol (1); diff --git a/examples/wireless/wifi-ap.cc b/examples/wireless/wifi-ap.cc index a685e1dee..ae3443488 100644 --- a/examples/wireless/wifi-ap.cc +++ b/examples/wireless/wifi-ap.cc @@ -165,7 +165,7 @@ int main (int argc, char *argv[]) Simulator::Schedule (Seconds (1.0), &AdvancePosition, ap.Get (0)); PacketSocketAddress socket; - socket.SetSingleDevice(staDevs.Get (0)->GetIfIndex ()); + socket.SetSingleDevice (staDevs.Get (0)->GetIfIndex ()); socket.SetPhysicalAddress (staDevs.Get (1)->GetAddress ()); socket.SetProtocol (1); @@ -187,8 +187,8 @@ int main (int argc, char *argv[]) Config::Connect ("/NodeList/*/DeviceList/*/Phy/State/State", MakeCallback (&PhyStateTrace)); AthstatsHelper athstats; - athstats.EnableAthstats("athstats-sta", stas); - athstats.EnableAthstats("athstats-ap", ap); + athstats.EnableAthstats ("athstats-sta", stas); + athstats.EnableAthstats ("athstats-ap", ap); Simulator::Run (); diff --git a/examples/wireless/wifi-clear-channel-cmu.cc b/examples/wireless/wifi-clear-channel-cmu.cc index 8b2e5ad33..c5306a0c8 100644 --- a/examples/wireless/wifi-clear-channel-cmu.cc +++ b/examples/wireless/wifi-clear-channel-cmu.cc @@ -181,7 +181,7 @@ int main (int argc, char *argv[]) Gnuplot gnuplot = Gnuplot ("clear-channel.eps"); - for (uint32_t i = 0; i < modes.size(); i++) + for (uint32_t i = 0; i < modes.size (); i++) { std::cout << modes[i] << std::endl; Gnuplot2dDataset dataset (modes[i]); @@ -197,14 +197,14 @@ int main (int argc, char *argv[]) Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode", StringValue (modes[i])); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", - "DataMode",StringValue(modes[i]), - "ControlMode",StringValue(modes[i])); + "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)); + wifiChannel.AddPropagationLoss ("ns3::FixedRssLossModel","Rss",DoubleValue (rss)); NS_LOG_DEBUG (modes[i]); diff --git a/examples/wireless/wifi-hidden-terminal.cc b/examples/wireless/wifi-hidden-terminal.cc index 56d6ee490..f03443d4c 100644 --- a/examples/wireless/wifi-hidden-terminal.cc +++ b/examples/wireless/wifi-hidden-terminal.cc @@ -54,7 +54,7 @@ void experiment (bool enableCtsRts) // 2. Place nodes somehow, this is required by every wireless simulation for (size_t i = 0; i < 3; ++i) { - nodes.Get(i)->AggregateObject (CreateObject ()); + nodes.Get (i)->AggregateObject (CreateObject ()); } // 3. Create propagation loss matrix @@ -140,7 +140,7 @@ void experiment (bool enableCtsRts) // 8. Install FlowMonitor on all nodes FlowMonitorHelper flowmon; - Ptr monitor = flowmon.InstallAll(); + Ptr monitor = flowmon.InstallAll (); // 9. Run simulation for 10 seconds Simulator::Stop (Seconds (10)); diff --git a/examples/wireless/wifi-simple-adhoc-grid.cc b/examples/wireless/wifi-simple-adhoc-grid.cc index 6b1073383..5e5bb6a49 100644 --- a/examples/wireless/wifi-simple-adhoc-grid.cc +++ b/examples/wireless/wifi-simple-adhoc-grid.cc @@ -172,8 +172,8 @@ int main (int argc, char *argv[]) NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); wifi.SetStandard (WIFI_PHY_STANDARD_80211b); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", - "DataMode",StringValue(phyMode), - "ControlMode",StringValue(phyMode)); + "DataMode",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-adhoc.cc b/examples/wireless/wifi-simple-adhoc.cc index fe725506e..a898aa966 100644 --- a/examples/wireless/wifi-simple-adhoc.cc +++ b/examples/wireless/wifi-simple-adhoc.cc @@ -140,14 +140,14 @@ int main (int argc, char *argv[]) wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel"); // The below FixedRssLossModel will cause the rss to be fixed regardless // of the distance between the two stations, and the transmit power - wifiChannel.AddPropagationLoss ("ns3::FixedRssLossModel","Rss",DoubleValue(rss)); + wifiChannel.AddPropagationLoss ("ns3::FixedRssLossModel","Rss",DoubleValue (rss)); wifiPhy.SetChannel (wifiChannel.Create ()); // Add a non-QoS upper mac, and disable rate control NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", - "DataMode",StringValue(phyMode), - "ControlMode",StringValue(phyMode)); + "DataMode",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-infra.cc b/examples/wireless/wifi-simple-infra.cc index 62e394959..44ee4b52e 100644 --- a/examples/wireless/wifi-simple-infra.cc +++ b/examples/wireless/wifi-simple-infra.cc @@ -141,14 +141,14 @@ int main (int argc, char *argv[]) wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel"); // The below FixedRssLossModel will cause the rss to be fixed regardless // of the distance between the two stations, and the transmit power - wifiChannel.AddPropagationLoss ("ns3::FixedRssLossModel","Rss",DoubleValue(rss)); + wifiChannel.AddPropagationLoss ("ns3::FixedRssLossModel","Rss",DoubleValue (rss)); wifiPhy.SetChannel (wifiChannel.Create ()); // Add a non-QoS upper mac, and disable rate control NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", - "DataMode",StringValue(phyMode), - "ControlMode",StringValue(phyMode)); + "DataMode",StringValue (phyMode), + "ControlMode",StringValue (phyMode)); // Setup the rest of the upper mac Ssid ssid = Ssid ("wifi-default"); @@ -156,12 +156,12 @@ int main (int argc, char *argv[]) wifiMac.SetType ("ns3::StaWifiMac", "Ssid", SsidValue (ssid), "ActiveProbing", BooleanValue (false)); - NetDeviceContainer staDevice = wifi.Install (wifiPhy, wifiMac, c.Get(0)); + NetDeviceContainer staDevice = wifi.Install (wifiPhy, wifiMac, c.Get (0)); NetDeviceContainer devices = staDevice; // setup ap. wifiMac.SetType ("ns3::ApWifiMac", "Ssid", SsidValue (ssid)); - NetDeviceContainer apDevice = wifi.Install (wifiPhy, wifiMac, c.Get(1)); + NetDeviceContainer apDevice = wifi.Install (wifiPhy, wifiMac, c.Get (1)); devices.Add (apDevice); // Note that with FixedRssLossModel, the positions below are not diff --git a/examples/wireless/wifi-simple-interference.cc b/examples/wireless/wifi-simple-interference.cc index 82830a058..fab85ba36 100644 --- a/examples/wireless/wifi-simple-interference.cc +++ b/examples/wireless/wifi-simple-interference.cc @@ -192,8 +192,8 @@ int main (int argc, char *argv[]) // Add a non-QoS upper mac, and disable rate control NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", - "DataMode",StringValue(phyMode), - "ControlMode",StringValue(phyMode)); + "DataMode",StringValue (phyMode), + "ControlMode",StringValue (phyMode)); // Set it to adhoc mode wifiMac.SetType ("ns3::AdhocWifiMac"); NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c.Get (0)); @@ -226,7 +226,7 @@ int main (int argc, char *argv[]) TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory"); Ptr recvSink = Socket::CreateSocket (c.Get (0), tid); - InetSocketAddress local = InetSocketAddress (Ipv4Address("10.1.1.1"), 80); + InetSocketAddress local = InetSocketAddress (Ipv4Address ("10.1.1.1"), 80); recvSink->Bind (local); recvSink->SetRecvCallback (MakeCallback (&ReceivePacket)); diff --git a/src/aodv/examples/aodv.cc b/src/aodv/examples/aodv.cc index 0fcd5ec63..3e8c56973 100644 --- a/src/aodv/examples/aodv.cc +++ b/src/aodv/examples/aodv.cc @@ -85,7 +85,7 @@ private: int main (int argc, char **argv) { AodvExample test; - if (!test.Configure(argc, argv)) + if (!test.Configure (argc, argv)) NS_FATAL_ERROR ("Configuration failed. Aborted."); test.Run (); @@ -109,7 +109,7 @@ AodvExample::Configure (int argc, char **argv) // Enable AODV logs by default. Comment this if too noisy // LogComponentEnable("AodvRoutingProtocol", LOG_LEVEL_ALL); - SeedManager::SetSeed(12345); + SeedManager::SetSeed (12345); CommandLine cmd; cmd.AddValue ("pcap", "Write PCAP traces.", pcap); @@ -213,7 +213,7 @@ AodvExample::InstallApplications () ApplicationContainer p = ping.Install (nodes.Get (0)); p.Start (Seconds (0)); - p.Stop (Seconds (totalTime) - Seconds(0.001)); + p.Stop (Seconds (totalTime) - Seconds (0.001)); // move node away Ptr node = nodes.Get (size/2); diff --git a/src/aodv/model/aodv-dpd.cc b/src/aodv/model/aodv-dpd.cc index 58d8ca898..73ca2c071 100644 --- a/src/aodv/model/aodv-dpd.cc +++ b/src/aodv/model/aodv-dpd.cc @@ -30,18 +30,18 @@ namespace aodv bool DuplicatePacketDetection::IsDuplicate (Ptr p, const Ipv4Header & header) { - return m_idCache.IsDuplicate (header.GetSource (), p->GetUid() ); + return m_idCache.IsDuplicate (header.GetSource (), p->GetUid () ); } void DuplicatePacketDetection::SetLifetime (Time lifetime) { - m_idCache.SetLifetime(lifetime); + m_idCache.SetLifetime (lifetime); } Time DuplicatePacketDetection::GetLifetime () const { - return m_idCache.GetLifeTime(); + return m_idCache.GetLifeTime (); } diff --git a/src/aodv/model/aodv-dpd.h b/src/aodv/model/aodv-dpd.h index 97722b056..b0b9461c1 100644 --- a/src/aodv/model/aodv-dpd.h +++ b/src/aodv/model/aodv-dpd.h @@ -44,7 +44,7 @@ class DuplicatePacketDetection { public: /// C-tor - DuplicatePacketDetection (Time lifetime) : m_idCache(lifetime) {} + DuplicatePacketDetection (Time lifetime) : m_idCache (lifetime) {} /// Check that the packet is duplicated. If not, save information about this packet. bool IsDuplicate (Ptr p, const Ipv4Header & header); /// Set duplicate records lifetimes diff --git a/src/aodv/model/aodv-neighbor.cc b/src/aodv/model/aodv-neighbor.cc index a9320b907..4c94ec957 100644 --- a/src/aodv/model/aodv-neighbor.cc +++ b/src/aodv/model/aodv-neighbor.cc @@ -39,8 +39,8 @@ namespace aodv Neighbors::Neighbors (Time delay) : m_ntimer (Timer::CANCEL_ON_DESTROY) { - m_ntimer.SetDelay(delay); - m_ntimer.SetFunction(&Neighbors::Purge, this); + m_ntimer.SetDelay (delay); + m_ntimer.SetFunction (&Neighbors::Purge, this); m_txErrorCallback = MakeCallback (&Neighbors::ProcessTxError, this); } diff --git a/src/aodv/model/aodv-packet.cc b/src/aodv/model/aodv-packet.cc index d752d3b1f..263ba059b 100644 --- a/src/aodv/model/aodv-packet.cc +++ b/src/aodv/model/aodv-packet.cc @@ -141,8 +141,8 @@ operator<< (std::ostream & os, TypeHeader const & h) //----------------------------------------------------------------------------- RreqHeader::RreqHeader (uint8_t flags, uint8_t reserved, uint8_t hopCount, uint32_t requestID, Ipv4Address dst, uint32_t dstSeqNo, Ipv4Address origin, uint32_t originSeqNo) : - m_flags (flags), m_reserved (reserved), m_hopCount (hopCount), m_requestID (requestID), m_dst(dst), - m_dstSeqNo (dstSeqNo), m_origin(origin), m_originSeqNo (originSeqNo) + m_flags (flags), m_reserved (reserved), m_hopCount (hopCount), m_requestID (requestID), m_dst (dst), + m_dstSeqNo (dstSeqNo), m_origin (origin), m_originSeqNo (originSeqNo) { } @@ -585,7 +585,7 @@ RerrHeader::AddUnDestination (Ipv4Address dst, uint32_t seqNo ) if (m_unreachableDstSeqNo.find (dst) != m_unreachableDstSeqNo.end ()) return true; - NS_ASSERT (GetDestCount() < 255); // can't support more than 255 destinations in single RERR + NS_ASSERT (GetDestCount () < 255); // can't support more than 255 destinations in single RERR m_unreachableDstSeqNo.insert (std::make_pair (dst, seqNo)); return true; } diff --git a/src/aodv/model/aodv-packet.h b/src/aodv/model/aodv-packet.h index 5cc181a6a..9ffacfdf3 100644 --- a/src/aodv/model/aodv-packet.h +++ b/src/aodv/model/aodv-packet.h @@ -317,9 +317,9 @@ public: */ bool RemoveUnDestination (std::pair & un); /// Clear header - void Clear(); + void Clear (); /// Return number of unreachable destinations in RERR message - uint8_t GetDestCount () const { return (uint8_t)m_unreachableDstSeqNo.size(); } + uint8_t GetDestCount () const { return (uint8_t)m_unreachableDstSeqNo.size (); } bool operator== (RerrHeader const & o) const; private: uint8_t m_flag; ///< No delete flag diff --git a/src/aodv/model/aodv-routing-protocol.cc b/src/aodv/model/aodv-routing-protocol.cc index c80b09ecb..23a952921 100644 --- a/src/aodv/model/aodv-routing-protocol.cc +++ b/src/aodv/model/aodv-routing-protocol.cc @@ -58,7 +58,7 @@ struct DeferredRouteOutputTag : public Tag /// Positive if output device is fixed in RouteOutput int32_t oif; - DeferredRouteOutputTag (int32_t o = -1) : Tag(), oif (o) {} + DeferredRouteOutputTag (int32_t o = -1) : Tag (), oif (o) {} static TypeId GetTypeId () { @@ -103,14 +103,14 @@ RoutingProtocol::RoutingProtocol () : NetTraversalTime (Time ((2 * NetDiameter) * NodeTraversalTime)), PathDiscoveryTime ( Time (2 * NetTraversalTime)), MyRouteTimeout (Time (2 * std::max (PathDiscoveryTime, ActiveRouteTimeout))), - HelloInterval(Seconds (1)), + HelloInterval (Seconds (1)), AllowedHelloLoss (2), - DeletePeriod (Time(5 * std::max(ActiveRouteTimeout, HelloInterval))), + DeletePeriod (Time (5 * std::max (ActiveRouteTimeout, HelloInterval))), NextHopWait (NodeTraversalTime + MilliSeconds (10)), TimeoutBuffer (2), - BlackListTimeout(Time (RreqRetries * NetTraversalTime)), + BlackListTimeout (Time (RreqRetries * NetTraversalTime)), MaxQueueLen (64), - MaxQueueTime (Seconds(30)), + MaxQueueTime (Seconds (30)), DestinationOnly (false), GratuitousReply (true), EnableHello (true), @@ -120,7 +120,7 @@ RoutingProtocol::RoutingProtocol () : m_seqNo (0), m_rreqIdCache (PathDiscoveryTime), m_dpd (PathDiscoveryTime), - m_nb(HelloInterval), + m_nb (HelloInterval), m_rreqCount (0), m_rerrCount (0), m_htimer (Timer::CANCEL_ON_DESTROY), @@ -270,7 +270,7 @@ RoutingProtocol::DoDispose () void RoutingProtocol::PrintRoutingTable (Ptr stream) const { - *stream->GetStream () << "Node: " << m_ipv4->GetObject ()->GetId () << " Time: " << Simulator::Now().GetSeconds () << "s "; + *stream->GetStream () << "Node: " << m_ipv4->GetObject ()->GetId () << " Time: " << Simulator::Now ().GetSeconds () << "s "; m_routingTable.Print (stream); } @@ -316,7 +316,7 @@ RoutingProtocol::RouteOutput (Ptr p, const Ipv4Header &header, { route = rt.GetRoute (); NS_ASSERT (route != 0); - NS_LOG_DEBUG ("Exist route to " << route->GetDestination() << " from interface " << route->GetSource()); + NS_LOG_DEBUG ("Exist route to " << route->GetDestination () << " from interface " << route->GetSource ()); if (oif != 0 && route->GetOutputDevice () != oif) { NS_LOG_DEBUG ("Output device doesn't match. Dropped."); @@ -351,10 +351,10 @@ RoutingProtocol::DeferredRouteOutput (Ptr p, const Ipv4Header & he bool result = m_queue.Enqueue (newEntry); if (result) { - NS_LOG_LOGIC ("Add packet " << p->GetUid() << " to queue. Protocol " << (uint16_t) header.GetProtocol ()); + NS_LOG_LOGIC ("Add packet " << p->GetUid () << " to queue. Protocol " << (uint16_t) header.GetProtocol ()); RoutingTableEntry rt; - bool result = m_routingTable.LookupRoute(header.GetDestination (), rt); - if(!result || ((rt.GetFlag() != IN_SEARCH) && result)) + bool result = m_routingTable.LookupRoute (header.GetDestination (), rt); + if(!result || ((rt.GetFlag () != IN_SEARCH) && result)) { NS_LOG_LOGIC ("Send new RREQ for outbound packet to " < p, const Ipv4Header &header, Ptr idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb) { - NS_LOG_FUNCTION (this << p->GetUid() << header.GetDestination() << idev->GetAddress()); + NS_LOG_FUNCTION (this << p->GetUid () << header.GetDestination () << idev->GetAddress ()); if (m_socketAddresses.empty ()) { NS_LOG_LOGIC ("No aodv interfaces"); @@ -496,7 +496,7 @@ RoutingProtocol::Forwarding (Ptr p, const Ipv4Header & header, if (toDst.GetFlag () == VALID) { Ptr route = toDst.GetRoute (); - NS_LOG_LOGIC (route->GetSource()<<" forwarding to " << dst << " from " << origin << " packet " << p->GetUid ()); + NS_LOG_LOGIC (route->GetSource ()<<" forwarding to " << dst << " from " << origin << " packet " << p->GetUid ()); /* * Each time a route is used to forward a data packet, its Active Route @@ -666,7 +666,7 @@ RoutingProtocol::NotifyAddAddress (uint32_t i, Ipv4InterfaceAddress address) socket->SetRecvCallback (MakeCallback (&RoutingProtocol::RecvAodv,this)); socket->BindToNetDevice (l3->GetNetDevice (i)); // Bind to any IP address so that broadcasts can be received - socket->Bind (InetSocketAddress (Ipv4Address::GetAny(), AODV_PORT)); + socket->Bind (InetSocketAddress (Ipv4Address::GetAny (), AODV_PORT)); socket->SetAllowBroadcast (true); m_socketAddresses.insert (std::make_pair (socket, iface)); @@ -704,7 +704,7 @@ RoutingProtocol::NotifyRemoveAddress (uint32_t i, Ipv4InterfaceAddress address) NS_ASSERT (socket != 0); socket->SetRecvCallback (MakeCallback (&RoutingProtocol::RecvAodv, this)); // Bind to any IP address so that broadcasts can be received - socket->Bind (InetSocketAddress (Ipv4Address::GetAny(), AODV_PORT)); + socket->Bind (InetSocketAddress (Ipv4Address::GetAny (), AODV_PORT)); socket->SetAllowBroadcast (true); m_socketAddresses.insert (std::make_pair (socket, iface)); @@ -787,7 +787,7 @@ RoutingProtocol::LoopbackRoute (const Ipv4Header & hdr, Ptr oif) cons { rt->SetSource (j->second.GetLocal ()); } - NS_ASSERT_MSG (rt->GetSource() != Ipv4Address (), "Valid AODV source address not found"); + NS_ASSERT_MSG (rt->GetSource () != Ipv4Address (), "Valid AODV source address not found"); rt->SetGateway (Ipv4Address ("127.0.0.1")); rt->SetOutputDevice (m_lo); return rt; @@ -826,8 +826,8 @@ RoutingProtocol::SendRequest (Ipv4Address dst) rreqHeader.SetUnknownSeqno (true); Ptr dev = 0; RoutingTableEntry newEntry (/*device=*/ dev, /*dst=*/ dst, /*validSeqNo=*/ false, /*seqno=*/ 0, - /*iface=*/ Ipv4InterfaceAddress(),/*hop=*/ 0, - /*nextHop=*/ Ipv4Address(), /*lifeTime=*/ Seconds(0)); + /*iface=*/ Ipv4InterfaceAddress (),/*hop=*/ 0, + /*nextHop=*/ Ipv4Address (), /*lifeTime=*/ Seconds (0)); newEntry.SetFlag (IN_SEARCH); m_routingTable.AddRoute (newEntry); } @@ -914,7 +914,7 @@ RoutingProtocol::RecvAodv (Ptr socket) packet->RemoveHeader (tHeader); if (!tHeader.IsValid ()) { - NS_LOG_DEBUG ("AODV message " << packet->GetUid() << " with unknown type received: " << tHeader.Get() << ". Drop"); + NS_LOG_DEBUG ("AODV message " << packet->GetUid () << " with unknown type received: " << tHeader.Get () << ". Drop"); return; // drop } switch (tHeader.Get ()) @@ -1060,7 +1060,7 @@ RoutingProtocol::RecvRequest (Ptr p, Ipv4Address receiver, Ipv4Address s toOrigin.SetOutputDevice (m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (receiver))); toOrigin.SetInterface (m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0)); toOrigin.SetHop (hop); - toOrigin.SetLifeTime (std::max (Time(2 * NetTraversalTime - 2 * hop * NodeTraversalTime), + toOrigin.SetLifeTime (std::max (Time (2 * NetTraversalTime - 2 * hop * NodeTraversalTime), toOrigin.GetLifeTime ())); m_routingTable.Update (toOrigin); } @@ -1102,7 +1102,7 @@ RoutingProtocol::RecvRequest (Ptr p, Ipv4Address receiver, Ipv4Address s if ((rreqHeader.GetUnknownSeqno () || (int32_t (toDst.GetSeqNo ()) - int32_t (rreqHeader.GetDstSeqno ()) >= 0)) && toDst.GetValidSeqNo () ) { - if (!rreqHeader.GetDestinationOnly () && toDst.GetFlag() == VALID) + if (!rreqHeader.GetDestinationOnly () && toDst.GetFlag () == VALID) { m_routingTable.LookupRoute (origin, toOrigin); SendReplyByIntermediateNode (toDst, toOrigin, rreqHeader.GetGratiousRrep ()); @@ -1138,7 +1138,7 @@ RoutingProtocol::RecvRequest (Ptr p, Ipv4Address receiver, Ipv4Address s if (EnableHello) { m_htimer.Cancel (); - m_htimer.Schedule (HelloInterval - Time (0.1 * MilliSeconds(UniformVariable().GetInteger (0, 10)))); + m_htimer.Schedule (HelloInterval - Time (0.1 * MilliSeconds (UniformVariable ().GetInteger (0, 10)))); } } @@ -1206,7 +1206,7 @@ RoutingProtocol::SendReplyByIntermediateNode (RoutingTableEntry & toDst, Routing packetToDst->AddHeader (type); Ptr socket = FindSocketWithInterfaceAddress (toDst.GetInterface ()); NS_ASSERT (socket); - NS_LOG_LOGIC ("Send gratuitous RREP " << packet->GetUid()); + NS_LOG_LOGIC ("Send gratuitous RREP " << packet->GetUid ()); socket->SendTo (packetToDst, 0, InetSocketAddress (toDst.GetNextHop (), AODV_PORT)); } } @@ -1230,11 +1230,11 @@ RoutingProtocol::SendReplyAck (Ipv4Address neighbor) void RoutingProtocol::RecvReply (Ptr p, Ipv4Address receiver, Ipv4Address sender) { - NS_LOG_FUNCTION(this << " src " << sender); + NS_LOG_FUNCTION (this << " src " << sender); RrepHeader rrepHeader; p->RemoveHeader (rrepHeader); Ipv4Address dst = rrepHeader.GetDst (); - NS_LOG_LOGIC("RREP destination " << dst << " RREP origin " << rrepHeader.GetOrigin()); + NS_LOG_LOGIC ("RREP destination " << dst << " RREP origin " << rrepHeader.GetOrigin ()); uint8_t hop = rrepHeader.GetHopCount () + 1; rrepHeader.SetHopCount (hop); @@ -1358,18 +1358,18 @@ RoutingProtocol::RecvReplyAck (Ipv4Address neighbor) { NS_LOG_FUNCTION (this); RoutingTableEntry rt; - if(m_routingTable.LookupRoute(neighbor, rt)) + if(m_routingTable.LookupRoute (neighbor, rt)) { rt.m_ackTimer.Cancel (); rt.SetFlag (VALID); - m_routingTable.Update(rt); + m_routingTable.Update (rt); } } void RoutingProtocol::ProcessHello (RrepHeader const & rrepHeader, Ipv4Address receiver ) { - NS_LOG_FUNCTION(this << "from " << rrepHeader.GetDst ()); + NS_LOG_FUNCTION (this << "from " << rrepHeader.GetDst ()); /* * Whenever a node receives a Hello message from a neighbor, the node * SHOULD make sure that it has an active route to the neighbor, and @@ -1462,7 +1462,7 @@ RoutingProtocol::RecvError (Ptr p, Ipv4Address src ) void RoutingProtocol::RouteRequestTimerExpire (Ipv4Address dst) { - NS_LOG_LOGIC(this); + NS_LOG_LOGIC (this); RoutingTableEntry toDst; if (m_routingTable.LookupValidRoute (dst, toDst)) { @@ -1477,7 +1477,7 @@ RoutingProtocol::RouteRequestTimerExpire (Ipv4Address dst) */ if (toDst.GetRreqCnt () == RreqRetries) { - NS_LOG_LOGIC("route discovery to " << dst << " has been attempted RreqRetries (" << RreqRetries << ") times"); + NS_LOG_LOGIC ("route discovery to " << dst << " has been attempted RreqRetries (" << RreqRetries << ") times"); m_addressReqTimer.erase (dst); m_routingTable.DeleteRoute (dst); NS_LOG_DEBUG ("Route not found. Drop all packets with dst " << dst); @@ -1493,9 +1493,9 @@ RoutingProtocol::RouteRequestTimerExpire (Ipv4Address dst) else { NS_LOG_DEBUG ("Route down. Stop search. Drop packet with destination " << dst); - m_addressReqTimer.erase(dst); - m_routingTable.DeleteRoute(dst); - m_queue.DropPacketWithDst(dst); + m_addressReqTimer.erase (dst); + m_routingTable.DeleteRoute (dst); + m_queue.DropPacketWithDst (dst); } } @@ -1505,7 +1505,7 @@ RoutingProtocol::HelloTimerExpire () NS_LOG_FUNCTION (this); SendHello (); m_htimer.Cancel (); - Time t = Time (0.01 * MilliSeconds(UniformVariable().GetInteger (0, 100))); + Time t = Time (0.01 * MilliSeconds (UniformVariable ().GetInteger (0, 100))); m_htimer.Schedule (HelloInterval - t); } @@ -1585,7 +1585,7 @@ RoutingProtocol::SendPacketFromQueue (Ipv4Address dst, Ptr route) UnicastForwardCallback ucb = queueEntry.GetUnicastForwardCallback (); Ipv4Header header = queueEntry.GetIpv4Header (); header.SetSource (route->GetSource ()); - header.SetTtl (header.GetTtl() + 1); // compensate extra TTL decrement by fake loopback routing + header.SetTtl (header.GetTtl () + 1); // compensate extra TTL decrement by fake loopback routing ucb (route, p, header); } } @@ -1675,7 +1675,7 @@ RoutingProtocol::SendRerrWhenNoRouteToForward (Ipv4Address dst, Ptr socket = i->first; Ipv4InterfaceAddress iface = i->second; NS_ASSERT (socket); - NS_LOG_LOGIC ("Broadcast RERR message from interface " << iface.GetLocal()); + NS_LOG_LOGIC ("Broadcast RERR message from interface " << iface.GetLocal ()); // Send to all-hosts broadcast if on /32 addr, subnet-directed otherwise Ipv4Address destination; if (iface.GetMask () == Ipv4Mask::GetOnes ()) @@ -1720,7 +1720,7 @@ RoutingProtocol::SendRerrMessage (Ptr packet, std::vector p { Ptr socket = FindSocketWithInterfaceAddress (toPrecursor.GetInterface ()); NS_ASSERT (socket); - NS_LOG_LOGIC ("one precursor => unicast RERR to " << toPrecursor.GetDestination() << " from " << toPrecursor.GetInterface ().GetLocal ()); + NS_LOG_LOGIC ("one precursor => unicast RERR to " << toPrecursor.GetDestination () << " from " << toPrecursor.GetInterface ().GetLocal ()); socket->SendTo (packet, 0, InetSocketAddress (precursors.front (), AODV_PORT)); m_rerrCount++; } @@ -1743,7 +1743,7 @@ RoutingProtocol::SendRerrMessage (Ptr packet, std::vector p { Ptr socket = FindSocketWithInterfaceAddress (*i); NS_ASSERT (socket); - NS_LOG_LOGIC ("Broadcast RERR message from interface " << i->GetLocal()); + NS_LOG_LOGIC ("Broadcast RERR message from interface " << i->GetLocal ()); // Send to all-hosts broadcast if on /32 addr, subnet-directed otherwise Ipv4Address destination; if (i->GetMask () == Ipv4Mask::GetOnes ()) diff --git a/src/aodv/model/aodv-routing-protocol.h b/src/aodv/model/aodv-routing-protocol.h index f9ba43a08..edaf275d5 100644 --- a/src/aodv/model/aodv-routing-protocol.h +++ b/src/aodv/model/aodv-routing-protocol.h @@ -226,7 +226,7 @@ private: /// Initiate RERR void SendRerrWhenBreaksLinkToNextHop (Ipv4Address nextHop); /// Forward RERR - void SendRerrMessage(Ptr packet, std::vector precursors); + void SendRerrMessage (Ptr packet, std::vector precursors); /** * Send RERR message when no route to forward input packet. Unicast if there is reverse route to originating node, broadcast otherwise. * \param dst - destination node IP address diff --git a/src/aodv/model/aodv-rqueue.h b/src/aodv/model/aodv-rqueue.h index a7e165a04..7c3199e6b 100644 --- a/src/aodv/model/aodv-rqueue.h +++ b/src/aodv/model/aodv-rqueue.h @@ -69,10 +69,10 @@ public: void SetErrorCallback (ErrorCallback ecb) { m_ecb = ecb; } Ptr GetPacket () const { return m_packet; } void SetPacket (Ptr p) { m_packet = p; } - Ipv4Header GetIpv4Header() const { return m_header; } + Ipv4Header GetIpv4Header () const { return m_header; } void SetIpv4Header (Ipv4Header h) { m_header = h; } - void SetExpireTime (Time exp) { m_expire = exp + Simulator::Now(); } - Time GetExpireTime () const { return m_expire - Simulator::Now(); } + void SetExpireTime (Time exp) { m_expire = exp + Simulator::Now (); } + Time GetExpireTime () const { return m_expire - Simulator::Now (); } //\} private: /// Data packet diff --git a/src/aodv/model/aodv-rtable.cc b/src/aodv/model/aodv-rtable.cc index a10e0ca5b..0105a05ff 100644 --- a/src/aodv/model/aodv-rtable.cc +++ b/src/aodv/model/aodv-rtable.cc @@ -158,7 +158,7 @@ RoutingTableEntry::Invalidate (Time badLinkLifetime) void RoutingTableEntry::Print (Ptr stream) const { - std::ostream* os = stream->GetStream(); + std::ostream* os = stream->GetStream (); *os << m_ipv4Route->GetDestination () << "\t" << m_ipv4Route->GetGateway () << "\t" << m_iface.GetLocal () << "\t"; switch (m_flag) diff --git a/src/aodv/model/aodv-rtable.h b/src/aodv/model/aodv-rtable.h index 1f3cbe0db..02fb661b0 100644 --- a/src/aodv/model/aodv-rtable.h +++ b/src/aodv/model/aodv-rtable.h @@ -60,9 +60,9 @@ class RoutingTableEntry { public: /// c-to - RoutingTableEntry (Ptr dev = 0,Ipv4Address dst = Ipv4Address(), bool vSeqNo = false, uint32_t m_seqNo = 0, - Ipv4InterfaceAddress iface = Ipv4InterfaceAddress(), uint16_t hops = 0, - Ipv4Address nextHop = Ipv4Address(), Time lifetime = Simulator::Now()); + RoutingTableEntry (Ptr dev = 0,Ipv4Address dst = Ipv4Address (), bool vSeqNo = false, uint32_t m_seqNo = 0, + Ipv4InterfaceAddress iface = Ipv4InterfaceAddress (), uint16_t hops = 0, + Ipv4Address nextHop = Ipv4Address (), Time lifetime = Simulator::Now ()); ~RoutingTableEntry (); @@ -103,13 +103,13 @@ public: void Invalidate (Time badLinkLifetime); ///\name Fields //\{ - Ipv4Address GetDestination () const { return m_ipv4Route->GetDestination(); } + Ipv4Address GetDestination () const { return m_ipv4Route->GetDestination (); } Ptr GetRoute () const { return m_ipv4Route; } void SetRoute (Ptr r) { m_ipv4Route = r; } - void SetNextHop (Ipv4Address nextHop) { m_ipv4Route->SetGateway(nextHop); } - Ipv4Address GetNextHop () const { return m_ipv4Route->GetGateway(); } - void SetOutputDevice (Ptr dev) { m_ipv4Route->SetOutputDevice(dev); } - Ptr GetOutputDevice () const { return m_ipv4Route->GetOutputDevice(); } + void SetNextHop (Ipv4Address nextHop) { m_ipv4Route->SetGateway (nextHop); } + Ipv4Address GetNextHop () const { return m_ipv4Route->GetGateway (); } + void SetOutputDevice (Ptr dev) { m_ipv4Route->SetOutputDevice (dev); } + Ptr GetOutputDevice () const { return m_ipv4Route->GetOutputDevice (); } Ipv4InterfaceAddress GetInterface () const { return m_iface; } void SetInterface (Ipv4InterfaceAddress iface) { m_iface = iface; } void SetValidSeqNo (bool s) { m_validSeqNo = s; } @@ -118,8 +118,8 @@ public: uint32_t GetSeqNo () const { return m_seqNo; } void SetHop (uint16_t hop) { m_hops = hop; } uint16_t GetHop () const { return m_hops; } - void SetLifeTime (Time lt) { m_lifeTime = lt + Simulator::Now(); } - Time GetLifeTime () const { return m_lifeTime - Simulator::Now(); } + void SetLifeTime (Time lt) { m_lifeTime = lt + Simulator::Now (); } + Time GetLifeTime () const { return m_lifeTime - Simulator::Now (); } void SetFlag (RouteFlags flag) { m_flag = flag; } RouteFlags GetFlag () const { return m_flag; } void SetRreqCnt (uint8_t n) { m_reqCount = n; } @@ -141,7 +141,7 @@ public: { return (m_ipv4Route->GetDestination () == dst); } - void Print(Ptr stream) const; + void Print (Ptr stream) const; private: /// Valid Destination Sequence Number flag @@ -241,9 +241,9 @@ public: * \param blacklistTimeout - time for which the neighboring node is put into the blacklist * \return true on success */ - bool MarkLinkAsUnidirectional(Ipv4Address neighbor, Time blacklistTimeout); + bool MarkLinkAsUnidirectional (Ipv4Address neighbor, Time blacklistTimeout); /// Print routing table - void Print(Ptr stream) const; + void Print (Ptr stream) const; private: std::map m_ipv4AddressEntry; diff --git a/src/aodv/test/aodv-id-cache-test-suite.cc b/src/aodv/test/aodv-id-cache-test-suite.cc index b0fd2da15..466352bfb 100644 --- a/src/aodv/test/aodv-id-cache-test-suite.cc +++ b/src/aodv/test/aodv-id-cache-test-suite.cc @@ -39,9 +39,9 @@ namespace aodv /// Unit test for id cache struct IdCacheTest : public TestCase { - IdCacheTest () : TestCase ("Id Cache"), cache (Seconds(10)) + IdCacheTest () : TestCase ("Id Cache"), cache (Seconds (10)) {} - virtual void DoRun(); + virtual void DoRun (); void CheckTimeout1 (); void CheckTimeout2 (); void CheckTimeout3 (); @@ -52,22 +52,22 @@ struct IdCacheTest : public TestCase void IdCacheTest::DoRun () { - NS_TEST_EXPECT_MSG_EQ (cache.GetLifeTime(), Seconds(10), "Lifetime"); + NS_TEST_EXPECT_MSG_EQ (cache.GetLifeTime (), Seconds (10), "Lifetime"); NS_TEST_EXPECT_MSG_EQ (cache.IsDuplicate (Ipv4Address ("1.2.3.4"), 3), false, "Unknown ID & address"); NS_TEST_EXPECT_MSG_EQ (cache.IsDuplicate (Ipv4Address ("1.2.3.4"), 4), false, "Unknown ID"); NS_TEST_EXPECT_MSG_EQ (cache.IsDuplicate (Ipv4Address ("4.3.2.1"), 3), false, "Unknown address"); NS_TEST_EXPECT_MSG_EQ (cache.IsDuplicate (Ipv4Address ("1.2.3.4"), 3), true, "Known address & ID"); - cache.SetLifetime(Seconds(15)); - NS_TEST_EXPECT_MSG_EQ (cache.GetLifeTime(), Seconds(15), "New lifetime"); + cache.SetLifetime (Seconds (15)); + NS_TEST_EXPECT_MSG_EQ (cache.GetLifeTime (), Seconds (15), "New lifetime"); cache.IsDuplicate (Ipv4Address ("1.1.1.1"), 4); cache.IsDuplicate (Ipv4Address ("1.1.1.1"), 4); cache.IsDuplicate (Ipv4Address ("2.2.2.2"), 5); cache.IsDuplicate (Ipv4Address ("3.3.3.3"), 6); NS_TEST_EXPECT_MSG_EQ (cache.GetSize (), 6, "trivial"); - Simulator::Schedule (Seconds(5), &IdCacheTest::CheckTimeout1, this); - Simulator::Schedule (Seconds(11), &IdCacheTest::CheckTimeout2, this); - Simulator::Schedule (Seconds(30), &IdCacheTest::CheckTimeout3, this); + Simulator::Schedule (Seconds (5), &IdCacheTest::CheckTimeout1, this); + Simulator::Schedule (Seconds (11), &IdCacheTest::CheckTimeout2, this); + Simulator::Schedule (Seconds (30), &IdCacheTest::CheckTimeout3, this); Simulator::Run (); Simulator::Destroy (); } diff --git a/src/aodv/test/aodv-regression.cc b/src/aodv/test/aodv-regression.cc index ee620dd1c..285225898 100644 --- a/src/aodv/test/aodv-regression.cc +++ b/src/aodv/test/aodv-regression.cc @@ -92,7 +92,7 @@ ChainRegressionTest::~ChainRegressionTest () void ChainRegressionTest::DoRun () { - SeedManager::SetSeed(12345); + SeedManager::SetSeed (12345); Config::SetDefault ("ns3::ArpCache::AliveTimeout", TimeValue (m_arpAliveTimeout)); CreateNodes (); @@ -175,9 +175,9 @@ ChainRegressionTest::CheckResults () os1 << NS_TEST_SOURCEDIR << m_prefix << "-" << i << "-0.pcap"; os2 << GetTempDir () << m_prefix << "-" << i << "-0.pcap"; - uint32_t sec(0), usec(0); - bool diff = PcapFile::Diff (os1.str(), os2.str(), sec, usec); - NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str() + uint32_t sec (0), usec (0); + bool diff = PcapFile::Diff (os1.str (), os2.str (), sec, usec); + NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str () << " and " << os2.str () << " differ starting from " << sec << " s " << usec << " us"); } } diff --git a/src/aodv/test/aodv-test-suite.cc b/src/aodv/test/aodv-test-suite.cc index 997382836..da8c2b1e7 100644 --- a/src/aodv/test/aodv-test-suite.cc +++ b/src/aodv/test/aodv-test-suite.cc @@ -214,13 +214,13 @@ struct RrepAckHeaderTest : public TestCase RrepAckHeaderTest () : TestCase ("AODV RREP-ACK") { } - virtual void DoRun() + virtual void DoRun () { RrepAckHeader h; Ptr p = Create (); p->AddHeader (h); RrepAckHeader h2; - uint32_t bytes = p->RemoveHeader(h2); + uint32_t bytes = p->RemoveHeader (h2); NS_TEST_EXPECT_MSG_EQ (bytes, 1, "ACK is 1 byte long"); NS_TEST_EXPECT_MSG_EQ (h, h2, "Round trip serialization works"); } @@ -232,24 +232,24 @@ struct RerrHeaderTest : public TestCase RerrHeaderTest () : TestCase ("AODV RERR") { } - virtual void DoRun() + virtual void DoRun () { RerrHeader h; - h.SetNoDelete(true); - NS_TEST_EXPECT_MSG_EQ(h.GetNoDelete(), true, "trivial"); - Ipv4Address dst = Ipv4Address("1.2.3.4"); - NS_TEST_EXPECT_MSG_EQ(h.AddUnDestination(dst, 12), true, "trivial"); - NS_TEST_EXPECT_MSG_EQ(h.GetDestCount(), 1, "trivial"); - NS_TEST_EXPECT_MSG_EQ(h.AddUnDestination(dst, 13), true, "trivial"); - Ipv4Address dst2 = Ipv4Address("4.3.2.1"); - NS_TEST_EXPECT_MSG_EQ(h.AddUnDestination(dst2, 12), true, "trivial"); - NS_TEST_EXPECT_MSG_EQ(h.GetDestCount(), 2, "trivial"); + h.SetNoDelete (true); + NS_TEST_EXPECT_MSG_EQ (h.GetNoDelete (), true, "trivial"); + Ipv4Address dst = Ipv4Address ("1.2.3.4"); + NS_TEST_EXPECT_MSG_EQ (h.AddUnDestination (dst, 12), true, "trivial"); + NS_TEST_EXPECT_MSG_EQ (h.GetDestCount (), 1, "trivial"); + NS_TEST_EXPECT_MSG_EQ (h.AddUnDestination (dst, 13), true, "trivial"); + Ipv4Address dst2 = Ipv4Address ("4.3.2.1"); + NS_TEST_EXPECT_MSG_EQ (h.AddUnDestination (dst2, 12), true, "trivial"); + NS_TEST_EXPECT_MSG_EQ (h.GetDestCount (), 2, "trivial"); Ptr p = Create (); p->AddHeader (h); RerrHeader h2; - uint32_t bytes = p->RemoveHeader(h2); - NS_TEST_EXPECT_MSG_EQ (bytes, h.GetSerializedSize(), "(De)Serialized size match"); + uint32_t bytes = p->RemoveHeader (h2); + NS_TEST_EXPECT_MSG_EQ (bytes, h.GetSerializedSize (), "(De)Serialized size match"); NS_TEST_EXPECT_MSG_EQ (h, h2, "Round trip serialization works"); } }; @@ -262,7 +262,7 @@ struct QueueEntryTest : public TestCase void Error (Ptr, const Ipv4Header &, Socket::SocketErrno) {} void Unicast2 (Ptr route, Ptr packet, const Ipv4Header & header) {} void Error2 (Ptr, const Ipv4Header &, Socket::SocketErrno) {} - virtual void DoRun() + virtual void DoRun () { Ptr packet = Create (); Ipv4Header h; @@ -273,14 +273,14 @@ struct QueueEntryTest : public TestCase QueueEntry entry (packet, h, ucb, ecb, Seconds (1)); NS_TEST_EXPECT_MSG_EQ (h.GetDestination (), entry.GetIpv4Header ().GetDestination (), "trivial"); NS_TEST_EXPECT_MSG_EQ (h.GetSource (), entry.GetIpv4Header ().GetSource (), "trivial"); - NS_TEST_EXPECT_MSG_EQ (ucb.IsEqual(entry.GetUnicastForwardCallback ()), true, "trivial"); - NS_TEST_EXPECT_MSG_EQ (ecb.IsEqual(entry.GetErrorCallback ()), true, "trivial"); + NS_TEST_EXPECT_MSG_EQ (ucb.IsEqual (entry.GetUnicastForwardCallback ()), true, "trivial"); + NS_TEST_EXPECT_MSG_EQ (ecb.IsEqual (entry.GetErrorCallback ()), true, "trivial"); NS_TEST_EXPECT_MSG_EQ (entry.GetExpireTime (), Seconds (1), "trivial"); NS_TEST_EXPECT_MSG_EQ (entry.GetPacket (), packet, "trivial"); entry.SetExpireTime (Seconds (3)); NS_TEST_EXPECT_MSG_EQ (entry.GetExpireTime (), Seconds (3), "trivial"); Ipv4Header h2; - h2.SetDestination(Ipv4Address ("1.1.1.1")); + h2.SetDestination (Ipv4Address ("1.1.1.1")); entry.SetIpv4Header (h2); NS_TEST_EXPECT_MSG_EQ (entry.GetIpv4Header ().GetDestination (), Ipv4Address ("1.1.1.1"), "trivial"); Ipv4RoutingProtocol::UnicastForwardCallback ucb2 = MakeCallback (&QueueEntryTest::Unicast2, this); @@ -312,7 +312,7 @@ AodvRqueueTest::DoRun () q.SetMaxQueueLen (32); NS_TEST_EXPECT_MSG_EQ (q.GetMaxQueueLen (), 32, "trivial"); NS_TEST_EXPECT_MSG_EQ (q.GetQueueTimeout (), Seconds (30), "trivial"); - q.SetQueueTimeout (Seconds(10)); + q.SetQueueTimeout (Seconds (10)); NS_TEST_EXPECT_MSG_EQ (q.GetQueueTimeout (), Seconds (10), "trivial"); Ptr packet = Create (); @@ -338,7 +338,7 @@ AodvRqueueTest::DoRun () q.Enqueue (e2); Ptr packet2 = Create (); QueueEntry e3 (packet2, h, ucb, ecb, Seconds (1)); - NS_TEST_EXPECT_MSG_EQ (q.Dequeue (Ipv4Address("3.3.3.3"), e3), false, "trivial"); + NS_TEST_EXPECT_MSG_EQ (q.Dequeue (Ipv4Address ("3.3.3.3"), e3), false, "trivial"); NS_TEST_EXPECT_MSG_EQ (q.Dequeue (Ipv4Address ("2.2.2.2"), e3), true, "trivial"); NS_TEST_EXPECT_MSG_EQ (q.Find (Ipv4Address ("2.2.2.2")), false, "trivial"); q.Enqueue (e2); @@ -350,7 +350,7 @@ AodvRqueueTest::DoRun () q.Enqueue (e4); NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 3, "trivial"); q.DropPacketWithDst (Ipv4Address ("1.2.3.4")); - NS_TEST_EXPECT_MSG_EQ (q.GetSize(), 1, "trivial"); + NS_TEST_EXPECT_MSG_EQ (q.GetSize (), 1, "trivial"); CheckSizeLimit (); @@ -392,12 +392,12 @@ AodvRqueueTest::CheckTimeout () struct AodvRtableEntryTest : public TestCase { AodvRtableEntryTest () : TestCase ("RtableEntry") {} - virtual void DoRun() + virtual void DoRun () { Ptr dev; Ipv4InterfaceAddress iface; - RoutingTableEntry rt (/*output device*/ dev, /*dst*/ Ipv4Address("1.2.3.4"), /*validSeqNo*/ true, /*seqNo*/ 10, - /*interface*/ iface, /*hop*/ 5, /*next hop*/ Ipv4Address("3.3.3.3"), /*lifetime*/ Seconds(10)); + RoutingTableEntry rt (/*output device*/ dev, /*dst*/ Ipv4Address ("1.2.3.4"), /*validSeqNo*/ true, /*seqNo*/ 10, + /*interface*/ iface, /*hop*/ 5, /*next hop*/ Ipv4Address ("3.3.3.3"), /*lifetime*/ Seconds (10)); NS_TEST_EXPECT_MSG_EQ (rt.GetOutputDevice (), dev, "trivial"); NS_TEST_EXPECT_MSG_EQ (rt.GetDestination (), Ipv4Address ("1.2.3.4"), "trivial"); NS_TEST_EXPECT_MSG_EQ (rt.GetValidSeqNo (), true, "trivial"); @@ -471,7 +471,7 @@ struct AodvRtableEntryTest : public TestCase struct AodvRtableTest : public TestCase { AodvRtableTest () : TestCase ("Rtable") {} - virtual void DoRun() + virtual void DoRun () { RoutingTable rtable (Seconds (2)); NS_TEST_EXPECT_MSG_EQ (rtable.GetBadLinkLifetime (), Seconds (2), "trivial"); @@ -479,12 +479,12 @@ struct AodvRtableTest : public TestCase NS_TEST_EXPECT_MSG_EQ (rtable.GetBadLinkLifetime (), Seconds (1), "trivial"); Ptr dev; Ipv4InterfaceAddress iface; - RoutingTableEntry rt (/*output device*/ dev, /*dst*/ Ipv4Address("1.2.3.4"), /*validSeqNo*/ true, /*seqNo*/ 10, - /*interface*/ iface, /*hop*/ 5, /*next hop*/ Ipv4Address("1.1.1.1"), /*lifetime*/ Seconds(10)); + RoutingTableEntry rt (/*output device*/ dev, /*dst*/ Ipv4Address ("1.2.3.4"), /*validSeqNo*/ true, /*seqNo*/ 10, + /*interface*/ iface, /*hop*/ 5, /*next hop*/ Ipv4Address ("1.1.1.1"), /*lifetime*/ Seconds (10)); NS_TEST_EXPECT_MSG_EQ (rtable.AddRoute (rt), true, "trivial"); NS_TEST_EXPECT_MSG_EQ (rtable.AddRoute (rt), false, "trivial"); - RoutingTableEntry rt2 (/*output device*/ dev, /*dst*/ Ipv4Address("4.3.2.1"), /*validSeqNo*/ false, /*seqNo*/ 0, - /*interface*/ iface, /*hop*/ 15, /*next hop*/ Ipv4Address("1.1.1.1"), /*lifetime*/ Seconds(1)); + RoutingTableEntry rt2 (/*output device*/ dev, /*dst*/ Ipv4Address ("4.3.2.1"), /*validSeqNo*/ false, /*seqNo*/ 0, + /*interface*/ iface, /*hop*/ 15, /*next hop*/ Ipv4Address ("1.1.1.1"), /*lifetime*/ Seconds (1)); NS_TEST_EXPECT_MSG_EQ (rtable.AddRoute (rt2), true, "trivial"); NS_TEST_EXPECT_MSG_EQ (rtable.LookupRoute (rt2.GetDestination (), rt), true, "trivial"); NS_TEST_EXPECT_MSG_EQ (rt2.GetDestination (), rt.GetDestination (), "trivial"); diff --git a/src/aodv/test/bug-772.cc b/src/aodv/test/bug-772.cc index de274b81d..a6a12d11a 100644 --- a/src/aodv/test/bug-772.cc +++ b/src/aodv/test/bug-772.cc @@ -73,7 +73,7 @@ Bug772ChainTest::~Bug772ChainTest () void Bug772ChainTest::DoRun () { - SeedManager::SetSeed(12345); + SeedManager::SetSeed (12345); CreateNodes (); CreateDevices (); @@ -158,9 +158,9 @@ Bug772ChainTest::CheckResults () os1 << NS_TEST_SOURCEDIR << m_prefix << "-" << i << "-0.pcap"; os2 << GetTempDir () << m_prefix << "-" << i << "-0.pcap"; - uint32_t sec(0), usec(0); - bool diff = PcapFile::Diff (os1.str(), os2.str(), sec, usec); - NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str() + uint32_t sec (0), usec (0); + bool diff = PcapFile::Diff (os1.str (), os2.str (), sec, usec); + NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str () << " and " << os2.str () << " differ starting from " << sec << " s " << usec << " us"); } } diff --git a/src/aodv/test/loopback.cc b/src/aodv/test/loopback.cc index b07755890..ccba734f6 100644 --- a/src/aodv/test/loopback.cc +++ b/src/aodv/test/loopback.cc @@ -61,7 +61,7 @@ LoopbackTestCase::DoRun () nodes.Create (1); Ptr m = CreateObject (); m->SetPosition (Vector (0, 0, 0)); - nodes.Get(0)->AggregateObject (m); + nodes.Get (0)->AggregateObject (m); // Setup WiFi NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); wifiMac.SetType ("ns3::AdhocWifiMac"); @@ -84,7 +84,7 @@ LoopbackTestCase::DoRun () // Setup ping Ptr ping = CreateObject (); ping->SetAttribute ("Remote", Ipv4AddressValue (Ipv4Address::GetLoopback ())); - nodes.Get(0)->AddApplication (ping); + nodes.Get (0)->AddApplication (ping); ping->SetStartTime (Seconds (0)); ping->SetStopTime (Seconds (4)); Names::Add ("ping", ping); diff --git a/src/applications/helper/ping6-helper.h b/src/applications/helper/ping6-helper.h index c71080e7a..c4a0bdd20 100644 --- a/src/applications/helper/ping6-helper.h +++ b/src/applications/helper/ping6-helper.h @@ -82,7 +82,7 @@ public: * \brief Set routers addresses for routing type 0. * \param routers routers addresses */ - void SetRoutersAddress(std::vector routers); + void SetRoutersAddress (std::vector routers); private: /** diff --git a/src/applications/helper/udp-client-server-helper.h b/src/applications/helper/udp-client-server-helper.h index e65832e09..2f71c70e2 100644 --- a/src/applications/helper/udp-client-server-helper.h +++ b/src/applications/helper/udp-client-server-helper.h @@ -69,7 +69,7 @@ public: * NodeContainer. */ ApplicationContainer Install (NodeContainer c); - Ptr GetServer(void); + Ptr GetServer (void); private: ObjectFactory m_factory; Ptr m_server; diff --git a/src/applications/helper/udp-echo-helper.cc b/src/applications/helper/udp-echo-helper.cc index e4d471848..acb13cb60 100644 --- a/src/applications/helper/udp-echo-helper.cc +++ b/src/applications/helper/udp-echo-helper.cc @@ -28,7 +28,7 @@ namespace ns3 { UdpEchoServerHelper::UdpEchoServerHelper (uint16_t port) { m_factory.SetTypeId (UdpEchoServer::GetTypeId ()); - SetAttribute ("Port", UintegerValue(port)); + SetAttribute ("Port", UintegerValue (port)); } void diff --git a/src/applications/model/onoff-application.cc b/src/applications/model/onoff-application.cc index 69aa76d14..32aed33e6 100644 --- a/src/applications/model/onoff-application.cc +++ b/src/applications/model/onoff-application.cc @@ -105,7 +105,7 @@ OnOffApplication::~OnOffApplication() } void -OnOffApplication::SetMaxBytes(uint32_t maxBytes) +OnOffApplication::SetMaxBytes (uint32_t maxBytes) { NS_LOG_FUNCTION (this << maxBytes); m_maxBytes = maxBytes; @@ -129,14 +129,14 @@ OnOffApplication::DoDispose (void) } // Application Methods -void OnOffApplication::StartApplication() // Called at time specified by Start +void OnOffApplication::StartApplication () // Called at time specified by Start { NS_LOG_FUNCTION_NOARGS (); // Create the socket if not already if (!m_socket) { - m_socket = Socket::CreateSocket (GetNode(), m_tid); + m_socket = Socket::CreateSocket (GetNode (), m_tid); m_socket->Bind (); m_socket->Connect (m_peer); m_socket->SetAllowBroadcast (true); @@ -147,10 +147,10 @@ void OnOffApplication::StartApplication() // Called at time specified by Start // If we are not yet connected, there is nothing to do here // The ConnectionComplete upcall will start timers at that time //if (!m_connected) return; - ScheduleStartEvent(); + ScheduleStartEvent (); } -void OnOffApplication::StopApplication() // Called at time specified by Stop +void OnOffApplication::StopApplication () // Called at time specified by Stop { NS_LOG_FUNCTION_NOARGS (); @@ -161,7 +161,7 @@ void OnOffApplication::StopApplication() // Called at time specified by Stop } else { - NS_LOG_WARN("OnOffApplication found null socket to close in StopApplication"); + NS_LOG_WARN ("OnOffApplication found null socket to close in StopApplication"); } } @@ -172,33 +172,33 @@ void OnOffApplication::CancelEvents () if (m_sendEvent.IsRunning ()) { // Cancel the pending send packet event // Calculate residual bits since last packet sent - Time delta(Simulator::Now() - m_lastStartTime); - int64x64_t bits = delta.To(Time::S) * m_cbrRate.GetBitRate (); + Time delta (Simulator::Now () - m_lastStartTime); + int64x64_t bits = delta.To (Time::S) * m_cbrRate.GetBitRate (); m_residualBits += bits.GetHigh (); } - Simulator::Cancel(m_sendEvent); - Simulator::Cancel(m_startStopEvent); + Simulator::Cancel (m_sendEvent); + Simulator::Cancel (m_startStopEvent); } // Event handlers -void OnOffApplication::StartSending() +void OnOffApplication::StartSending () { NS_LOG_FUNCTION_NOARGS (); - m_lastStartTime = Simulator::Now(); - ScheduleNextTx(); // Schedule the send packet event - ScheduleStopEvent(); + m_lastStartTime = Simulator::Now (); + ScheduleNextTx (); // Schedule the send packet event + ScheduleStopEvent (); } -void OnOffApplication::StopSending() +void OnOffApplication::StopSending () { NS_LOG_FUNCTION_NOARGS (); - CancelEvents(); + CancelEvents (); - ScheduleStartEvent(); + ScheduleStartEvent (); } // Private helpers -void OnOffApplication::ScheduleNextTx() +void OnOffApplication::ScheduleNextTx () { NS_LOG_FUNCTION_NOARGS (); @@ -206,60 +206,60 @@ void OnOffApplication::ScheduleNextTx() { uint32_t bits = m_pktSize * 8 - m_residualBits; NS_LOG_LOGIC ("bits = " << bits); - Time nextTime(Seconds (bits / - static_cast(m_cbrRate.GetBitRate()))); // Time till next packet + Time nextTime (Seconds (bits / + static_cast(m_cbrRate.GetBitRate ()))); // Time till next packet NS_LOG_LOGIC ("nextTime = " << nextTime); - m_sendEvent = Simulator::Schedule(nextTime, - &OnOffApplication::SendPacket, this); + m_sendEvent = Simulator::Schedule (nextTime, + &OnOffApplication::SendPacket, this); } else { // All done, cancel any pending events - StopApplication(); + StopApplication (); } } -void OnOffApplication::ScheduleStartEvent() +void OnOffApplication::ScheduleStartEvent () { // Schedules the event to start sending data (switch to the "On" state) NS_LOG_FUNCTION_NOARGS (); - Time offInterval = Seconds(m_offTime.GetValue()); + Time offInterval = Seconds (m_offTime.GetValue ()); NS_LOG_LOGIC ("start at " << offInterval); - m_startStopEvent = Simulator::Schedule(offInterval, &OnOffApplication::StartSending, this); + m_startStopEvent = Simulator::Schedule (offInterval, &OnOffApplication::StartSending, this); } -void OnOffApplication::ScheduleStopEvent() +void OnOffApplication::ScheduleStopEvent () { // Schedules the event to stop sending data (switch to "Off" state) NS_LOG_FUNCTION_NOARGS (); - Time onInterval = Seconds(m_onTime.GetValue()); + Time onInterval = Seconds (m_onTime.GetValue ()); NS_LOG_LOGIC ("stop at " << onInterval); - m_startStopEvent = Simulator::Schedule(onInterval, &OnOffApplication::StopSending, this); + m_startStopEvent = Simulator::Schedule (onInterval, &OnOffApplication::StopSending, this); } -void OnOffApplication::SendPacket() +void OnOffApplication::SendPacket () { NS_LOG_FUNCTION_NOARGS (); - NS_LOG_LOGIC ("sending packet at " << Simulator::Now()); + NS_LOG_LOGIC ("sending packet at " << Simulator::Now ()); NS_ASSERT (m_sendEvent.IsExpired ()); Ptr packet = Create (m_pktSize); m_txTrace (packet); m_socket->Send (packet); m_totBytes += m_pktSize; - m_lastStartTime = Simulator::Now(); + m_lastStartTime = Simulator::Now (); m_residualBits = 0; - ScheduleNextTx(); + ScheduleNextTx (); } -void OnOffApplication::ConnectionSucceeded(Ptr) +void OnOffApplication::ConnectionSucceeded (Ptr) { NS_LOG_FUNCTION_NOARGS (); m_connected = true; - ScheduleStartEvent(); + ScheduleStartEvent (); } -void OnOffApplication::ConnectionFailed(Ptr) +void OnOffApplication::ConnectionFailed (Ptr) { NS_LOG_FUNCTION_NOARGS (); cout << "OnOffApplication, Connection Failed" << endl; diff --git a/src/applications/model/onoff-application.h b/src/applications/model/onoff-application.h index 3df52593b..8cfc0c5d2 100644 --- a/src/applications/model/onoff-application.h +++ b/src/applications/model/onoff-application.h @@ -148,12 +148,12 @@ private: TracedCallback > m_txTrace; private: - void ScheduleNextTx(); - void ScheduleStartEvent(); - void ScheduleStopEvent(); - void ConnectionSucceeded(Ptr); - void ConnectionFailed(Ptr); - void Ignore(Ptr); + void ScheduleNextTx (); + void ScheduleStartEvent (); + void ScheduleStopEvent (); + void ConnectionSucceeded (Ptr); + void ConnectionFailed (Ptr); + void Ignore (Ptr); }; } // namespace ns3 diff --git a/src/applications/model/packet-loss-counter.cc b/src/applications/model/packet-loss-counter.cc index 9983d6566..357cadb40 100644 --- a/src/applications/model/packet-loss-counter.cc +++ b/src/applications/model/packet-loss-counter.cc @@ -53,7 +53,7 @@ void PacketLossCounter::SetBitMapSize (uint16_t winSize) { - NS_ASSERT_MSG(winSize%8==0,"The packet window size should be a multiple of 8"); + NS_ASSERT_MSG (winSize%8==0,"The packet window size should be a multiple of 8"); m_bitMapSize = winSize/8; if (m_receiveBitMap!=0) { @@ -70,13 +70,13 @@ PacketLossCounter::GetLost () const } bool -PacketLossCounter::GetBit(uint32_t seqNum) +PacketLossCounter::GetBit (uint32_t seqNum) { return ((m_receiveBitMap[(seqNum%(m_bitMapSize*8))/8] >> (7-(seqNum%8)))&0x01); } void -PacketLossCounter::SetBit(uint32_t seqNum, bool val) +PacketLossCounter::SetBit (uint32_t seqNum, bool val) { if (val) { @@ -105,14 +105,14 @@ PacketLossCounter::NotifyReceived (uint32_t seqNum) { for (uint32_t i=m_lastMaxSeqNum+1; i<=seqNum; i++) { - if (GetBit(i)!=1) + if (GetBit (i)!=1) { NS_LOG_INFO ("Packet lost: " << i-(m_bitMapSize*8)); m_lost++; } - SetBit(i, 0); + SetBit (i, 0); } - SetBit(seqNum, 1); + SetBit (seqNum, 1); if (seqNum>m_lastMaxSeqNum) { m_lastMaxSeqNum = seqNum; diff --git a/src/applications/model/packet-sink.cc b/src/applications/model/packet-sink.cc index 0e966768c..57b817727 100644 --- a/src/applications/model/packet-sink.cc +++ b/src/applications/model/packet-sink.cc @@ -70,7 +70,7 @@ PacketSink::~PacketSink() NS_LOG_FUNCTION (this); } -uint32_t PacketSink::GetTotalRx() const +uint32_t PacketSink::GetTotalRx () const { return m_totalRx; } @@ -101,13 +101,13 @@ void PacketSink::DoDispose (void) // Application Methods -void PacketSink::StartApplication() // Called at time specified by Start +void PacketSink::StartApplication () // Called at time specified by Start { NS_LOG_FUNCTION (this); // Create the socket if not already if (!m_socket) { - m_socket = Socket::CreateSocket (GetNode(), m_tid); + m_socket = Socket::CreateSocket (GetNode (), m_tid); m_socket->Bind (m_local); m_socket->Listen (); m_socket->ShutdownSend (); @@ -126,23 +126,23 @@ void PacketSink::StartApplication() // Called at time specified by Start } } - m_socket->SetRecvCallback (MakeCallback(&PacketSink::HandleRead, this)); + m_socket->SetRecvCallback (MakeCallback (&PacketSink::HandleRead, this)); m_socket->SetAcceptCallback ( MakeNullCallback, const Address &> (), - MakeCallback(&PacketSink::HandleAccept, this)); + MakeCallback (&PacketSink::HandleAccept, this)); m_socket->SetCloseCallbacks ( - MakeCallback(&PacketSink::HandlePeerClose, this), - MakeCallback(&PacketSink::HandlePeerError, this)); + MakeCallback (&PacketSink::HandlePeerClose, this), + MakeCallback (&PacketSink::HandlePeerError, this)); } -void PacketSink::StopApplication() // Called at time specified by Stop +void PacketSink::StopApplication () // Called at time specified by Stop { NS_LOG_FUNCTION (this); - while(!m_socketList.empty()) //these are accepted sockets, close them + while(!m_socketList.empty ()) //these are accepted sockets, close them { - Ptr acceptedSocket = m_socketList.front(); - m_socketList.pop_front(); - acceptedSocket->Close(); + Ptr acceptedSocket = m_socketList.front (); + m_socketList.pop_front (); + acceptedSocket->Close (); } if (m_socket) { @@ -158,16 +158,16 @@ void PacketSink::HandleRead (Ptr socket) Address from; while (packet = socket->RecvFrom (from)) { - if (packet->GetSize() == 0) + if (packet->GetSize () == 0) { //EOF break; } if (InetSocketAddress::IsMatchingType (from)) { - m_totalRx += packet->GetSize(); + m_totalRx += packet->GetSize (); InetSocketAddress address = InetSocketAddress::ConvertFrom (from); - NS_LOG_INFO ("Received " << packet->GetSize() << " bytes from " << - address.GetIpv4() << " [" << address << "]" + NS_LOG_INFO ("Received " << packet->GetSize () << " bytes from " << + address.GetIpv4 () << " [" << address << "]" << " total Rx " << m_totalRx); //cast address to void , to suppress 'address' set but not used //compiler warning in optimized builds @@ -179,19 +179,19 @@ void PacketSink::HandleRead (Ptr socket) void PacketSink::HandlePeerClose (Ptr socket) { - NS_LOG_INFO("PktSink, peerClose"); + NS_LOG_INFO ("PktSink, peerClose"); } void PacketSink::HandlePeerError (Ptr socket) { - NS_LOG_INFO("PktSink, peerError"); + NS_LOG_INFO ("PktSink, peerError"); } void PacketSink::HandleAccept (Ptr s, const Address& from) { NS_LOG_FUNCTION (this << s << from); - s->SetRecvCallback (MakeCallback(&PacketSink::HandleRead, this)); + s->SetRecvCallback (MakeCallback (&PacketSink::HandleRead, this)); m_socketList.push_back (s); } diff --git a/src/applications/model/packet-sink.h b/src/applications/model/packet-sink.h index 78c7b23f5..d3b32f1af 100644 --- a/src/applications/model/packet-sink.h +++ b/src/applications/model/packet-sink.h @@ -97,8 +97,8 @@ private: void HandleRead (Ptr); void HandleAccept (Ptr, const Address& from); - void HandlePeerClose(Ptr); - void HandlePeerError(Ptr); + void HandlePeerClose (Ptr); + void HandlePeerError (Ptr); // In the case of TCP, each socket accept returns a new socket, so the // listening socket is stored seperately from the accepted sockets diff --git a/src/applications/model/ping6.h b/src/applications/model/ping6.h index 52107106a..84662d8e4 100644 --- a/src/applications/model/ping6.h +++ b/src/applications/model/ping6.h @@ -85,7 +85,7 @@ public: * \brief Set routers for routing type 0 (loose routing). * \param routers routers addresses */ - void SetRouters(std::vector routers); + void SetRouters (std::vector routers); protected: /** diff --git a/src/applications/model/radvd.cc b/src/applications/model/radvd.cc index 319f07142..22e446a70 100644 --- a/src/applications/model/radvd.cc +++ b/src/applications/model/radvd.cc @@ -212,8 +212,8 @@ void Radvd::Send (Ptr config, Ipv6Address dst, bool reschedule) * The ttl value should be set as a socket option, but this is not yet implemented */ SocketIpTtlTag ttl; - ttl.SetTtl(255); - p->AddPacketTag(ttl); + ttl.SetTtl (255); + p->AddPacketTag (ttl); /* send RA */ NS_LOG_LOGIC ("Send RA"); diff --git a/src/applications/model/udp-echo-client.cc b/src/applications/model/udp-echo-client.cc index 34f0e7d56..c5676aacc 100644 --- a/src/applications/model/udp-echo-client.cc +++ b/src/applications/model/udp-echo-client.cc @@ -111,14 +111,14 @@ UdpEchoClient::StartApplication (void) if (m_socket == 0) { TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory"); - m_socket = Socket::CreateSocket (GetNode(), tid); + m_socket = Socket::CreateSocket (GetNode (), tid); m_socket->Bind (); m_socket->Connect (InetSocketAddress (m_peerAddress, m_peerPort)); } - m_socket->SetRecvCallback(MakeCallback(&UdpEchoClient::HandleRead, this)); + m_socket->SetRecvCallback (MakeCallback (&UdpEchoClient::HandleRead, this)); - ScheduleTransmit (Seconds(0.)); + ScheduleTransmit (Seconds (0.)); } void @@ -129,11 +129,11 @@ UdpEchoClient::StopApplication () if (m_socket != 0) { m_socket->Close (); - m_socket->SetRecvCallback(MakeNullCallback > ()); + m_socket->SetRecvCallback (MakeNullCallback > ()); m_socket = 0; } - Simulator::Cancel(m_sendEvent); + Simulator::Cancel (m_sendEvent); } void @@ -228,7 +228,7 @@ UdpEchoClient::SetFill (uint8_t *fill, uint32_t fillSize, uint32_t dataSize) // // Last fill may be partial // - memcpy(&m_data[filled], fill, dataSize - filled); + memcpy (&m_data[filled], fill, dataSize - filled); // // Overwrite packet size attribute. @@ -240,7 +240,7 @@ void UdpEchoClient::ScheduleTransmit (Time dt) { NS_LOG_FUNCTION_NOARGS (); - m_sendEvent = Simulator::Schedule(dt, &UdpEchoClient::Send, this); + m_sendEvent = Simulator::Schedule (dt, &UdpEchoClient::Send, this); } void @@ -299,8 +299,8 @@ UdpEchoClient::HandleRead (Ptr socket) { if (InetSocketAddress::IsMatchingType (from)) { - NS_LOG_INFO ("Received " << packet->GetSize() << " bytes from " << - InetSocketAddress::ConvertFrom (from).GetIpv4()); + NS_LOG_INFO ("Received " << packet->GetSize () << " bytes from " << + InetSocketAddress::ConvertFrom (from).GetIpv4 ()); } } } diff --git a/src/applications/model/udp-echo-server.cc b/src/applications/model/udp-echo-server.cc index a55214bbf..a5715d3ac 100644 --- a/src/applications/model/udp-echo-server.cc +++ b/src/applications/model/udp-echo-server.cc @@ -75,7 +75,7 @@ UdpEchoServer::StartApplication (void) if (m_socket == 0) { TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory"); - m_socket = Socket::CreateSocket (GetNode(), tid); + m_socket = Socket::CreateSocket (GetNode (), tid); InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), m_port); m_socket->Bind (local); if (addressUtils::IsMulticast (m_local)) @@ -93,7 +93,7 @@ UdpEchoServer::StartApplication (void) } } - m_socket->SetRecvCallback(MakeCallback(&UdpEchoServer::HandleRead, this)); + m_socket->SetRecvCallback (MakeCallback (&UdpEchoServer::HandleRead, this)); } void @@ -104,7 +104,7 @@ UdpEchoServer::StopApplication () if (m_socket != 0) { m_socket->Close (); - m_socket->SetRecvCallback(MakeNullCallback > ()); + m_socket->SetRecvCallback (MakeNullCallback > ()); } } @@ -117,8 +117,8 @@ UdpEchoServer::HandleRead (Ptr socket) { if (InetSocketAddress::IsMatchingType (from)) { - NS_LOG_INFO ("Received " << packet->GetSize() << " bytes from " << - InetSocketAddress::ConvertFrom (from).GetIpv4()); + NS_LOG_INFO ("Received " << packet->GetSize () << " bytes from " << + InetSocketAddress::ConvertFrom (from).GetIpv4 ()); packet->RemoveAllPacketTags (); packet->RemoveAllByteTags (); diff --git a/src/applications/model/udp-server.cc b/src/applications/model/udp-server.cc index 38d84ca86..264281c5c 100644 --- a/src/applications/model/udp-server.cc +++ b/src/applications/model/udp-server.cc @@ -148,7 +148,7 @@ UdpServer::HandleRead (Ptr socket) packet->RemoveHeader (seqTs); uint32_t currentSequenceNumber = seqTs.GetSeq (); NS_LOG_INFO ("TraceDelay: RX " << packet->GetSize () << - " bytes from "<< InetSocketAddress::ConvertFrom(from).GetIpv4 () << + " bytes from "<< InetSocketAddress::ConvertFrom (from).GetIpv4 () << " Sequence Number: " << currentSequenceNumber << " Uid: " << packet->GetUid () << " TXtime: " << seqTs.GetTs () << diff --git a/src/applications/model/udp-trace-client.h b/src/applications/model/udp-trace-client.h index 728a736f2..705953e65 100644 --- a/src/applications/model/udp-trace-client.h +++ b/src/applications/model/udp-trace-client.h @@ -93,12 +93,12 @@ public: /** * \return the maximum packet size */ - uint16_t GetMaxPacketSize(void); + uint16_t GetMaxPacketSize (void); /** * \param maxPacketSize The maximum packet size */ - void SetMaxPacketSize(uint16_t maxPacketSize); + void SetMaxPacketSize (uint16_t maxPacketSize); protected: virtual void DoDispose (void); diff --git a/src/applications/model/v4ping.cc b/src/applications/model/v4ping.cc index fbfc3700a..93c6fdad0 100644 --- a/src/applications/model/v4ping.cc +++ b/src/applications/model/v4ping.cc @@ -119,7 +119,7 @@ V4Ping::Receive (Ptr socket) { Icmpv4Echo echo; p->RemoveHeader (echo); - std::map::iterator i = m_sent.find(echo.GetSequenceNumber()); + std::map::iterator i = m_sent.find (echo.GetSequenceNumber ()); if (i != m_sent.end () && echo.GetIdentifier () == 0) { @@ -141,16 +141,16 @@ V4Ping::Receive (Ptr socket) Time delta = Simulator::Now () - sendTime; m_sent.erase (i); - m_avgRtt.Update (delta.GetMilliSeconds()); + m_avgRtt.Update (delta.GetMilliSeconds ()); m_recv++; m_traceRtt (delta); if (m_verbose) { - std::cout << recvSize << " bytes from " << realFrom.GetIpv4() << ":" + std::cout << recvSize << " bytes from " << realFrom.GetIpv4 () << ":" << " icmp_seq=" << echo.GetSequenceNumber () << " ttl=" << (unsigned)ipv4.GetTtl () - << " time=" << delta.GetMilliSeconds() << " ms\n"; + << " time=" << delta.GetMilliSeconds () << " ms\n"; } } } @@ -214,7 +214,7 @@ V4Ping::Send () header.EnableChecksum (); } p->AddHeader (header); - m_sent.insert (std::make_pair (m_seq - 1, Simulator::Now())); + m_sent.insert (std::make_pair (m_seq - 1, Simulator::Now ())); m_socket->Send (p, 0); m_next = Simulator::Schedule (m_interval, &V4Ping::Send, this); } @@ -251,7 +251,7 @@ void V4Ping::StopApplication (void) { NS_LOG_FUNCTION (this); - m_next.Cancel(); + m_next.Cancel (); m_socket->Close (); if (m_verbose) @@ -264,10 +264,10 @@ V4Ping::StopApplication (void) << "time " << (Simulator::Now () - m_started).GetMilliSeconds () << "ms\n"; if (m_avgRtt.Count () > 0) - os << "rtt min/avg/max/mdev = " << m_avgRtt.Min() << "/" << m_avgRtt.Avg() << "/" - << m_avgRtt.Max() << "/" << m_avgRtt.Stddev() + os << "rtt min/avg/max/mdev = " << m_avgRtt.Min () << "/" << m_avgRtt.Avg () << "/" + << m_avgRtt.Max () << "/" << m_avgRtt.Stddev () << " ms\n"; - std::cout << os.str(); + std::cout << os.str (); } } diff --git a/src/applications/test/udp-client-server-test.cc b/src/applications/test/udp-client-server-test.cc index 3123c8d45..0d58c1a4b 100644 --- a/src/applications/test/udp-client-server-test.cc +++ b/src/applications/test/udp-client-server-test.cc @@ -88,7 +88,7 @@ void UdpClientServerTestCase::DoRun (void) uint16_t port = 4000; UdpServerHelper server (port); - ApplicationContainer apps = server.Install (n.Get(1)); + ApplicationContainer apps = server.Install (n.Get (1)); apps.Start (Seconds (1.0)); apps.Stop (Seconds (10.0)); @@ -161,7 +161,7 @@ void UdpTraceClientServerTestCase::DoRun (void) uint16_t port = 4000; UdpServerHelper server (port); - ApplicationContainer apps = server.Install (n.Get(1)); + ApplicationContainer apps = server.Install (n.Get (1)); apps.Start (Seconds (1.0)); apps.Stop (Seconds (10.0)); @@ -206,53 +206,53 @@ PacketLossCounterTestCase::~PacketLossCounterTestCase () void PacketLossCounterTestCase::DoRun (void) { - PacketLossCounter lossCounter(32); - lossCounter.NotifyReceived(32); //out of order + PacketLossCounter lossCounter (32); + lossCounter.NotifyReceived (32); //out of order for (uint32_t i=0; i<64; i++) { - lossCounter.NotifyReceived(i); + lossCounter.NotifyReceived (i); } - NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost(), 0, "Check that 0 packets are lost"); + NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost (), 0, "Check that 0 packets are lost"); for (uint32_t i=65; i<128; i++) // drop (1) seqNum 64 { - lossCounter.NotifyReceived(i); + lossCounter.NotifyReceived (i); } - NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost(), 1, "Check that 1 packet is lost"); + NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost (), 1, "Check that 1 packet is lost"); for (uint32_t i=134; i<200; i++) // drop seqNum 128,129,130,131,132,133 { - lossCounter.NotifyReceived(i); + lossCounter.NotifyReceived (i); } - NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost(), 7, "Check that 7 (6+1) packets are lost"); + NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost (), 7, "Check that 7 (6+1) packets are lost"); // reordering without loss - lossCounter.NotifyReceived(205); - lossCounter.NotifyReceived(206); - lossCounter.NotifyReceived(207); - lossCounter.NotifyReceived(200); - lossCounter.NotifyReceived(201); - lossCounter.NotifyReceived(202); - lossCounter.NotifyReceived(203); - lossCounter.NotifyReceived(204); + lossCounter.NotifyReceived (205); + lossCounter.NotifyReceived (206); + lossCounter.NotifyReceived (207); + lossCounter.NotifyReceived (200); + lossCounter.NotifyReceived (201); + lossCounter.NotifyReceived (202); + lossCounter.NotifyReceived (203); + lossCounter.NotifyReceived (204); for (uint32_t i=205; i<250; i++) { - lossCounter.NotifyReceived(i); + lossCounter.NotifyReceived (i); } - NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost(), 7, "Check that 7 (6+1) packets are lost even when reordering happens"); + NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost (), 7, "Check that 7 (6+1) packets are lost even when reordering happens"); // reordering with loss - lossCounter.NotifyReceived(255); + lossCounter.NotifyReceived (255); // drop (2) seqNum 250, 251 - lossCounter.NotifyReceived(252); - lossCounter.NotifyReceived(253); - lossCounter.NotifyReceived(254); + lossCounter.NotifyReceived (252); + lossCounter.NotifyReceived (253); + lossCounter.NotifyReceived (254); for (uint32_t i=256; i<300; i++) { - lossCounter.NotifyReceived(i); + lossCounter.NotifyReceived (i); } - NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost(), 9, "Check that 9 (6+1+2) packet are lost"); + NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost (), 9, "Check that 9 (6+1+2) packet are lost"); } class UdpClientServerTestSuite : public TestSuite { diff --git a/src/bridge/model/bridge-net-device.cc b/src/bridge/model/bridge-net-device.cc index 715e20ee1..c5343f450 100644 --- a/src/bridge/model/bridge-net-device.cc +++ b/src/bridge/model/bridge-net-device.cc @@ -263,14 +263,14 @@ BridgeNetDevice::AddBridgePort (Ptr bridgePort) } void -BridgeNetDevice::SetIfIndex(const uint32_t index) +BridgeNetDevice::SetIfIndex (const uint32_t index) { NS_LOG_FUNCTION_NOARGS (); m_ifIndex = index; } uint32_t -BridgeNetDevice::GetIfIndex(void) const +BridgeNetDevice::GetIfIndex (void) const { NS_LOG_FUNCTION_NOARGS (); return m_ifIndex; diff --git a/src/bridge/model/bridge-net-device.h b/src/bridge/model/bridge-net-device.h index e880d1a88..1be99e41c 100644 --- a/src/bridge/model/bridge-net-device.h +++ b/src/bridge/model/bridge-net-device.h @@ -89,8 +89,8 @@ public: Ptr GetBridgePort (uint32_t n) const; // inherited from NetDevice base class. - virtual void SetIfIndex(const uint32_t index); - virtual uint32_t GetIfIndex(void) const; + virtual void SetIfIndex (const uint32_t index); + virtual uint32_t GetIfIndex (void) const; virtual Ptr GetChannel (void) const; virtual void SetAddress (Address address); virtual Address GetAddress (void) const; diff --git a/src/config-store/model/raw-text-config.cc b/src/config-store/model/raw-text-config.cc index 5c0109699..f73659a60 100644 --- a/src/config-store/model/raw-text-config.cc +++ b/src/config-store/model/raw-text-config.cc @@ -118,7 +118,7 @@ RawTextConfigLoad::Default (void) m_is->seekg (0); std::string type, name, value; *m_is >> type >> name >> value; - while (m_is->good()) + while (m_is->good ()) { NS_LOG_DEBUG ("type=" << type << ", name=" << name << ", value=" << value); value = Strip (value); @@ -135,7 +135,7 @@ RawTextConfigLoad::Global (void) m_is->seekg (0); std::string type, name, value; *m_is >> type >> name >> value; - while (m_is->good()) + while (m_is->good ()) { NS_LOG_DEBUG ("type=" << type << ", name=" << name << ", value=" << value); value = Strip (value); @@ -152,7 +152,7 @@ RawTextConfigLoad::Attributes (void) m_is->seekg (0); std::string type, path, value; *m_is >> type >> path >> value; - while (m_is->good()) + while (m_is->good ()) { NS_LOG_DEBUG ("type=" << type << ", path=" << path << ", value=" << value); value = Strip (value); diff --git a/src/config-store/model/xml-config.cc b/src/config-store/model/xml-config.cc index 833fc0d86..098ccc49c 100644 --- a/src/config-store/model/xml-config.cc +++ b/src/config-store/model/xml-config.cc @@ -29,7 +29,7 @@ XmlConfigSave::SetFilename (std::string filename) int rc; /* Create a new XmlWriter for uri, with no compression. */ - m_writer = xmlNewTextWriterFilename(filename.c_str (), 0); + m_writer = xmlNewTextWriterFilename (filename.c_str (), 0); if (m_writer == NULL) { NS_FATAL_ERROR ("Error creating the xml writer"); @@ -42,7 +42,7 @@ XmlConfigSave::SetFilename (std::string filename) /* Start the document with the xml default for the version, * encoding utf-8 and the default for the standalone * declaration. */ - rc = xmlTextWriterStartDocument(m_writer, NULL, "utf-8", NULL); + rc = xmlTextWriterStartDocument (m_writer, NULL, "utf-8", NULL); if (rc < 0) { NS_FATAL_ERROR ("Error at xmlTextWriterStartDocument"); @@ -50,7 +50,7 @@ XmlConfigSave::SetFilename (std::string filename) /* Start an element named "ns3". Since thist is the first * element, this will be the root element of the document. */ - rc = xmlTextWriterStartElement(m_writer, BAD_CAST "ns3"); + rc = xmlTextWriterStartElement (m_writer, BAD_CAST "ns3"); if (rc < 0) { NS_FATAL_ERROR ("Error at xmlTextWriterStartElement\n"); @@ -68,13 +68,13 @@ XmlConfigSave::~XmlConfigSave () * function xmlTextWriterEndElement, but since we do not want to * write any other elements, we simply call xmlTextWriterEndDocument, * which will do all the work. */ - rc = xmlTextWriterEndDocument(m_writer); + rc = xmlTextWriterEndDocument (m_writer); if (rc < 0) { NS_FATAL_ERROR ("Error at xmlTextWriterEndDocument\n"); } - xmlFreeTextWriter(m_writer); + xmlFreeTextWriter (m_writer); m_writer = 0; } void @@ -92,25 +92,25 @@ private: } virtual void DoVisitAttribute (std::string name, std::string defaultValue) { int rc; - rc = xmlTextWriterStartElement(m_writer, BAD_CAST "default"); + rc = xmlTextWriterStartElement (m_writer, BAD_CAST "default"); if (rc < 0) { NS_FATAL_ERROR ("Error at xmlTextWriterStartElement"); } std::string fullname = m_typeid + "::" + name; - rc = xmlTextWriterWriteAttribute(m_writer, BAD_CAST "name", - BAD_CAST fullname.c_str ()); + rc = xmlTextWriterWriteAttribute (m_writer, BAD_CAST "name", + BAD_CAST fullname.c_str ()); if (rc < 0) { NS_FATAL_ERROR ("Error at xmlTextWriterWriteAttribute"); } - rc = xmlTextWriterWriteAttribute(m_writer, BAD_CAST "value", - BAD_CAST defaultValue.c_str ()); + rc = xmlTextWriterWriteAttribute (m_writer, BAD_CAST "value", + BAD_CAST defaultValue.c_str ()); if (rc < 0) { NS_FATAL_ERROR ("Error at xmlTextWriterWriteAttribute"); } - rc = xmlTextWriterEndElement(m_writer); + rc = xmlTextWriterEndElement (m_writer); if (rc < 0) { NS_FATAL_ERROR ("Error at xmlTextWriterEndElement"); @@ -136,24 +136,24 @@ private: StringValue str; object->GetAttribute (name, str); int rc; - rc = xmlTextWriterStartElement(m_writer, BAD_CAST "value"); + rc = xmlTextWriterStartElement (m_writer, BAD_CAST "value"); if (rc < 0) { NS_FATAL_ERROR ("Error at xmlTextWriterStartElement"); } - rc = xmlTextWriterWriteAttribute(m_writer, BAD_CAST "path", - BAD_CAST GetCurrentPath ().c_str ()); + rc = xmlTextWriterWriteAttribute (m_writer, BAD_CAST "path", + BAD_CAST GetCurrentPath ().c_str ()); if (rc < 0) { NS_FATAL_ERROR ("Error at xmlTextWriterWriteAttribute"); } - rc = xmlTextWriterWriteAttribute(m_writer, BAD_CAST "value", - BAD_CAST str.Get ().c_str ()); + rc = xmlTextWriterWriteAttribute (m_writer, BAD_CAST "value", + BAD_CAST str.Get ().c_str ()); if (rc < 0) { NS_FATAL_ERROR ("Error at xmlTextWriterWriteAttribute"); } - rc = xmlTextWriterEndElement(m_writer); + rc = xmlTextWriterEndElement (m_writer); if (rc < 0) { NS_FATAL_ERROR ("Error at xmlTextWriterEndElement"); @@ -175,24 +175,24 @@ XmlConfigSave::Global (void) StringValue value; (*i)->GetValue (value); - rc = xmlTextWriterStartElement(m_writer, BAD_CAST "global"); + rc = xmlTextWriterStartElement (m_writer, BAD_CAST "global"); if (rc < 0) { NS_FATAL_ERROR ("Error at xmlTextWriterStartElement"); } - rc = xmlTextWriterWriteAttribute(m_writer, BAD_CAST "name", - BAD_CAST (*i)->GetName ().c_str ()); + rc = xmlTextWriterWriteAttribute (m_writer, BAD_CAST "name", + BAD_CAST (*i)->GetName ().c_str ()); if (rc < 0) { NS_FATAL_ERROR ("Error at xmlTextWriterWriteAttribute"); } - rc = xmlTextWriterWriteAttribute(m_writer, BAD_CAST "value", - BAD_CAST value.Get ().c_str ()); + rc = xmlTextWriterWriteAttribute (m_writer, BAD_CAST "value", + BAD_CAST value.Get ().c_str ()); if (rc < 0) { NS_FATAL_ERROR ("Error at xmlTextWriterWriteAttribute"); } - rc = xmlTextWriterEndElement(m_writer); + rc = xmlTextWriterEndElement (m_writer); if (rc < 0) { NS_FATAL_ERROR ("Error at xmlTextWriterEndElement"); @@ -218,7 +218,7 @@ XmlConfigLoad::SetFilename (std::string filename) void XmlConfigLoad::Default (void) { - xmlTextReaderPtr reader = xmlNewTextReaderFilename(m_filename.c_str ()); + xmlTextReaderPtr reader = xmlNewTextReaderFilename (m_filename.c_str ()); if (reader == NULL) { NS_FATAL_ERROR ("Error at xmlReaderForFile"); @@ -227,7 +227,7 @@ XmlConfigLoad::Default (void) rc = xmlTextReaderRead (reader); while (rc > 0) { - const xmlChar *type = xmlTextReaderConstName(reader); + const xmlChar *type = xmlTextReaderConstName (reader); if (type == 0) { NS_FATAL_ERROR ("Invalid value"); @@ -256,7 +256,7 @@ XmlConfigLoad::Default (void) void XmlConfigLoad::Global (void) { - xmlTextReaderPtr reader = xmlNewTextReaderFilename(m_filename.c_str ()); + xmlTextReaderPtr reader = xmlNewTextReaderFilename (m_filename.c_str ()); if (reader == NULL) { NS_FATAL_ERROR ("Error at xmlReaderForFile"); @@ -265,7 +265,7 @@ XmlConfigLoad::Global (void) rc = xmlTextReaderRead (reader); while (rc > 0) { - const xmlChar *type = xmlTextReaderConstName(reader); + const xmlChar *type = xmlTextReaderConstName (reader); if (type == 0) { NS_FATAL_ERROR ("Invalid value"); @@ -294,7 +294,7 @@ XmlConfigLoad::Global (void) void XmlConfigLoad::Attributes (void) { - xmlTextReaderPtr reader = xmlNewTextReaderFilename(m_filename.c_str ()); + xmlTextReaderPtr reader = xmlNewTextReaderFilename (m_filename.c_str ()); if (reader == NULL) { NS_FATAL_ERROR ("Error at xmlReaderForFile"); @@ -303,7 +303,7 @@ XmlConfigLoad::Attributes (void) rc = xmlTextReaderRead (reader); while (rc > 0) { - const xmlChar *type = xmlTextReaderConstName(reader); + const xmlChar *type = xmlTextReaderConstName (reader); if (type == 0) { NS_FATAL_ERROR ("Invalid value"); diff --git a/src/core/bindings/module_helpers.cc b/src/core/bindings/module_helpers.cc index 17a389885..996bfece8 100644 --- a/src/core/bindings/module_helpers.cc +++ b/src/core/bindings/module_helpers.cc @@ -23,46 +23,46 @@ public: PythonEventImpl (PyObject *callback, PyObject *args) { m_callback = callback; - Py_INCREF(m_callback); + Py_INCREF (m_callback); m_args = args; - Py_INCREF(m_args); + Py_INCREF (m_args); } virtual ~PythonEventImpl () { PyGILState_STATE __py_gil_state; - __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0); + __py_gil_state = (PyEval_ThreadsInitialized () ? PyGILState_Ensure () : (PyGILState_STATE) 0); - Py_DECREF(m_callback); - Py_DECREF(m_args); + Py_DECREF (m_callback); + Py_DECREF (m_args); - if (PyEval_ThreadsInitialized()) - PyGILState_Release(__py_gil_state); + if (PyEval_ThreadsInitialized ()) + PyGILState_Release (__py_gil_state); } virtual void Notify () { PyGILState_STATE __py_gil_state; - __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0); + __py_gil_state = (PyEval_ThreadsInitialized () ? PyGILState_Ensure () : (PyGILState_STATE) 0); - PyObject *retval = PyObject_CallObject(m_callback, m_args); + PyObject *retval = PyObject_CallObject (m_callback, m_args); if (retval) { if (retval != Py_None) { - PyErr_SetString(PyExc_TypeError, "event callback should return None"); - PyErr_Print(); + PyErr_SetString (PyExc_TypeError, "event callback should return None"); + PyErr_Print (); } - Py_DECREF(retval); + Py_DECREF (retval); } else { - PyErr_Print(); + PyErr_Print (); } - if (PyEval_ThreadsInitialized()) - PyGILState_Release(__py_gil_state); + if (PyEval_ThreadsInitialized ()) + PyGILState_Release (__py_gil_state); } }; PyObject * -_wrap_Simulator_Schedule(PyNs3Simulator *PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs, - PyObject **return_exception) +_wrap_Simulator_Schedule (PyNs3Simulator *PYBINDGEN_UNUSED (dummy), PyObject *args, PyObject *kwargs, + PyObject **return_exception) { PyObject *exc_type, *traceback; PyObject *py_time; @@ -71,47 +71,47 @@ _wrap_Simulator_Schedule(PyNs3Simulator *PYBINDGEN_UNUSED(dummy), PyObject *args ns3::Ptr py_event_impl; PyNs3EventId *py_EventId; - if (kwargs && PyObject_Length(kwargs) > 0) { - PyErr_SetString(PyExc_TypeError, "keyword arguments not supported"); + if (kwargs && PyObject_Length (kwargs) > 0) { + PyErr_SetString (PyExc_TypeError, "keyword arguments not supported"); goto error; } - if (PyTuple_GET_SIZE(args) < 2) { - PyErr_SetString(PyExc_TypeError, "ns3.Simulator.Schedule needs at least 2 arguments"); + if (PyTuple_GET_SIZE (args) < 2) { + PyErr_SetString (PyExc_TypeError, "ns3.Simulator.Schedule needs at least 2 arguments"); goto error; } - py_time = PyTuple_GET_ITEM(args, 0); - py_callback = PyTuple_GET_ITEM(args, 1); + py_time = PyTuple_GET_ITEM (args, 0); + py_callback = PyTuple_GET_ITEM (args, 1); - if (!PyObject_IsInstance(py_time, (PyObject*) &PyNs3Time_Type)) { - PyErr_SetString(PyExc_TypeError, "Parameter 1 should be a ns3.Time instance"); + if (!PyObject_IsInstance (py_time, (PyObject*) &PyNs3Time_Type)) { + PyErr_SetString (PyExc_TypeError, "Parameter 1 should be a ns3.Time instance"); goto error; } - if (!PyCallable_Check(py_callback)) { - PyErr_SetString(PyExc_TypeError, "Parameter 2 should be callable"); + if (!PyCallable_Check (py_callback)) { + PyErr_SetString (PyExc_TypeError, "Parameter 2 should be callable"); goto error; } - user_args = PyTuple_GetSlice(args, 2, PyTuple_GET_SIZE(args)); + user_args = PyTuple_GetSlice (args, 2, PyTuple_GET_SIZE (args)); py_event_impl = ns3::Create(py_callback, user_args); - Py_DECREF(user_args); + Py_DECREF (user_args); - py_EventId = PyObject_New(PyNs3EventId, &PyNs3EventId_Type); - py_EventId->obj = new ns3::EventId( - ns3::Simulator::Schedule(*((PyNs3Time *) py_time)->obj, py_event_impl)); + py_EventId = PyObject_New (PyNs3EventId, &PyNs3EventId_Type); + py_EventId->obj = new ns3::EventId ( + ns3::Simulator::Schedule (*((PyNs3Time *) py_time)->obj, py_event_impl)); py_EventId->flags = PYBINDGEN_WRAPPER_FLAG_NONE; return (PyObject *) py_EventId; error: - PyErr_Fetch(&exc_type, return_exception, &traceback); - Py_XDECREF(exc_type); - Py_XDECREF(traceback); + PyErr_Fetch (&exc_type, return_exception, &traceback); + Py_XDECREF (exc_type); + Py_XDECREF (traceback); return NULL; } PyObject * -_wrap_Simulator_ScheduleNow(PyNs3Simulator *PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs, - PyObject **return_exception) +_wrap_Simulator_ScheduleNow (PyNs3Simulator *PYBINDGEN_UNUSED (dummy), PyObject *args, PyObject *kwargs, + PyObject **return_exception) { PyObject *exc_type, *traceback; PyObject *py_callback; @@ -119,41 +119,41 @@ _wrap_Simulator_ScheduleNow(PyNs3Simulator *PYBINDGEN_UNUSED(dummy), PyObject *a ns3::Ptr py_event_impl; PyNs3EventId *py_EventId; - if (kwargs && PyObject_Length(kwargs) > 0) { - PyErr_SetString(PyExc_TypeError, "keyword arguments not supported"); + if (kwargs && PyObject_Length (kwargs) > 0) { + PyErr_SetString (PyExc_TypeError, "keyword arguments not supported"); goto error; } - if (PyTuple_GET_SIZE(args) < 1) { - PyErr_SetString(PyExc_TypeError, "ns3.Simulator.Schedule needs at least 1 argument"); + if (PyTuple_GET_SIZE (args) < 1) { + PyErr_SetString (PyExc_TypeError, "ns3.Simulator.Schedule needs at least 1 argument"); goto error; } - py_callback = PyTuple_GET_ITEM(args, 0); + py_callback = PyTuple_GET_ITEM (args, 0); - if (!PyCallable_Check(py_callback)) { - PyErr_SetString(PyExc_TypeError, "Parameter 2 should be callable"); + if (!PyCallable_Check (py_callback)) { + PyErr_SetString (PyExc_TypeError, "Parameter 2 should be callable"); goto error; } - user_args = PyTuple_GetSlice(args, 1, PyTuple_GET_SIZE(args)); + user_args = PyTuple_GetSlice (args, 1, PyTuple_GET_SIZE (args)); py_event_impl = ns3::Create(py_callback, user_args); - Py_DECREF(user_args); + Py_DECREF (user_args); - py_EventId = PyObject_New(PyNs3EventId, &PyNs3EventId_Type); - py_EventId->obj = new ns3::EventId(ns3::Simulator::ScheduleNow(py_event_impl)); + py_EventId = PyObject_New (PyNs3EventId, &PyNs3EventId_Type); + py_EventId->obj = new ns3::EventId (ns3::Simulator::ScheduleNow (py_event_impl)); py_EventId->flags = PYBINDGEN_WRAPPER_FLAG_NONE; return (PyObject *) py_EventId; error: - PyErr_Fetch(&exc_type, return_exception, &traceback); - Py_XDECREF(exc_type); - Py_XDECREF(traceback); + PyErr_Fetch (&exc_type, return_exception, &traceback); + Py_XDECREF (exc_type); + Py_XDECREF (traceback); return NULL; } PyObject * -_wrap_Simulator_ScheduleDestroy(PyNs3Simulator *PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs, - PyObject **return_exception) +_wrap_Simulator_ScheduleDestroy (PyNs3Simulator *PYBINDGEN_UNUSED (dummy), PyObject *args, PyObject *kwargs, + PyObject **return_exception) { PyObject *exc_type, *traceback; PyObject *py_callback; @@ -161,41 +161,41 @@ _wrap_Simulator_ScheduleDestroy(PyNs3Simulator *PYBINDGEN_UNUSED(dummy), PyObjec ns3::Ptr py_event_impl; PyNs3EventId *py_EventId; - if (kwargs && PyObject_Length(kwargs) > 0) { - PyErr_SetString(PyExc_TypeError, "keyword arguments not supported"); + if (kwargs && PyObject_Length (kwargs) > 0) { + PyErr_SetString (PyExc_TypeError, "keyword arguments not supported"); goto error; } - if (PyTuple_GET_SIZE(args) < 1) { - PyErr_SetString(PyExc_TypeError, "ns3.Simulator.Schedule needs at least 1 argument"); + if (PyTuple_GET_SIZE (args) < 1) { + PyErr_SetString (PyExc_TypeError, "ns3.Simulator.Schedule needs at least 1 argument"); goto error; } - py_callback = PyTuple_GET_ITEM(args, 0); + py_callback = PyTuple_GET_ITEM (args, 0); - if (!PyCallable_Check(py_callback)) { - PyErr_SetString(PyExc_TypeError, "Parameter 2 should be callable"); + if (!PyCallable_Check (py_callback)) { + PyErr_SetString (PyExc_TypeError, "Parameter 2 should be callable"); goto error; } - user_args = PyTuple_GetSlice(args, 1, PyTuple_GET_SIZE(args)); + user_args = PyTuple_GetSlice (args, 1, PyTuple_GET_SIZE (args)); py_event_impl = ns3::Create(py_callback, user_args); - Py_DECREF(user_args); + Py_DECREF (user_args); - py_EventId = PyObject_New(PyNs3EventId, &PyNs3EventId_Type); - py_EventId->obj = new ns3::EventId(ns3::Simulator::ScheduleDestroy(py_event_impl)); + py_EventId = PyObject_New (PyNs3EventId, &PyNs3EventId_Type); + py_EventId->obj = new ns3::EventId (ns3::Simulator::ScheduleDestroy (py_event_impl)); py_EventId->flags = PYBINDGEN_WRAPPER_FLAG_NONE; return (PyObject *) py_EventId; error: - PyErr_Fetch(&exc_type, return_exception, &traceback); - Py_XDECREF(exc_type); - Py_XDECREF(traceback); + PyErr_Fetch (&exc_type, return_exception, &traceback); + Py_XDECREF (exc_type); + Py_XDECREF (traceback); return NULL; } PyObject * -_wrap_TypeId_LookupByNameFailSafe(PyNs3TypeId *PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs, - PyObject **return_exception) +_wrap_TypeId_LookupByNameFailSafe (PyNs3TypeId *PYBINDGEN_UNUSED (dummy), PyObject *args, PyObject *kwargs, + PyObject **return_exception) { bool ok; const char *name; @@ -204,21 +204,21 @@ _wrap_TypeId_LookupByNameFailSafe(PyNs3TypeId *PYBINDGEN_UNUSED(dummy), PyObject PyNs3TypeId *py_tid; const char *keywords[] = { "name", NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s#", (char **) keywords, &name, &name_len)) { + if (!PyArg_ParseTupleAndKeywords (args, kwargs, (char *) "s#", (char **) keywords, &name, &name_len)) { PyObject *exc_type, *traceback; - PyErr_Fetch(&exc_type, return_exception, &traceback); - Py_XDECREF(exc_type); - Py_XDECREF(traceback); + PyErr_Fetch (&exc_type, return_exception, &traceback); + Py_XDECREF (exc_type); + Py_XDECREF (traceback); return NULL; } - ok = ns3::TypeId::LookupByNameFailSafe(std::string(name, name_len), &tid); + ok = ns3::TypeId::LookupByNameFailSafe (std::string (name, name_len), &tid); if (!ok) { - PyErr_Format(PyExc_KeyError, "The ns3 type with name `%s' is not registered", name); + PyErr_Format (PyExc_KeyError, "The ns3 type with name `%s' is not registered", name); return NULL; } - py_tid = PyObject_New(PyNs3TypeId, &PyNs3TypeId_Type); + py_tid = PyObject_New (PyNs3TypeId, &PyNs3TypeId_Type); py_tid->obj = new ns3::TypeId (tid); PyNs3TypeId_wrapper_registry[(void *) py_tid->obj] = (PyObject *) py_tid; @@ -232,15 +232,15 @@ class CommandLinePythonValueSetter : public ns3::RefCountBase std::string m_variable; public: CommandLinePythonValueSetter (PyObject *ns, std::string const &variable) { - Py_INCREF(ns); + Py_INCREF (ns); m_namespace = ns; m_variable = variable; } bool Parse (std::string value) { - PyObject *pyvalue = PyString_FromStringAndSize (value.data(), value.size()); - PyObject_SetAttrString (m_namespace, (char *) m_variable.c_str(), pyvalue); - if (PyErr_Occurred()) { - PyErr_Print(); + PyObject *pyvalue = PyString_FromStringAndSize (value.data (), value.size ()); + PyObject_SetAttrString (m_namespace, (char *) m_variable.c_str (), pyvalue); + if (PyErr_Occurred ()) { + PyErr_Print (); return false; } return true; @@ -253,18 +253,18 @@ public: }; PyObject * -_wrap_CommandLine_AddValue(PyNs3CommandLine *self, PyObject *args, PyObject *kwargs, - PyObject **return_exception) +_wrap_CommandLine_AddValue (PyNs3CommandLine *self, PyObject *args, PyObject *kwargs, + PyObject **return_exception) { const char *name, *help, *variable = NULL; PyObject *py_namespace = NULL; const char *keywords[] = { "name", "help", "variable", "namespace", NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "ss|sO", (char **) keywords, &name, &help, &variable, &py_namespace)) { + if (!PyArg_ParseTupleAndKeywords (args, kwargs, (char *) "ss|sO", (char **) keywords, &name, &help, &variable, &py_namespace)) { PyObject *exc_type, *traceback; - PyErr_Fetch(&exc_type, return_exception, &traceback); - Py_XDECREF(exc_type); - Py_XDECREF(traceback); + PyErr_Fetch (&exc_type, return_exception, &traceback); + Py_XDECREF (exc_type); + Py_XDECREF (traceback); return NULL; } @@ -278,14 +278,14 @@ _wrap_CommandLine_AddValue(PyNs3CommandLine *self, PyObject *args, PyObject *kwa ns3::Ptr setter = ns3::Create (py_namespace, variable); self->obj->AddValue (name, help, ns3::MakeCallback (&CommandLinePythonValueSetter::Parse, setter)); - Py_INCREF(Py_None); + Py_INCREF (Py_None); return Py_None; } PyObject * -_wrap_Simulator_Run(PyNs3Simulator *PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs, - PyObject **return_exception) +_wrap_Simulator_Run (PyNs3Simulator *PYBINDGEN_UNUSED (dummy), PyObject *args, PyObject *kwargs, + PyObject **return_exception) { const char *keywords[] = { "signal_check_frequency", NULL}; int signal_check_frequency; @@ -298,11 +298,11 @@ _wrap_Simulator_Run(PyNs3Simulator *PYBINDGEN_UNUSED(dummy), PyObject *args, PyO signal_check_frequency = -1; } - if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "|i", (char **) keywords, &signal_check_frequency)) { + if (!PyArg_ParseTupleAndKeywords (args, kwargs, (char *) "|i", (char **) keywords, &signal_check_frequency)) { PyObject *exc_type, *traceback; - PyErr_Fetch(&exc_type, return_exception, &traceback); - Py_XDECREF(exc_type); - Py_XDECREF(traceback); + PyErr_Fetch (&exc_type, return_exception, &traceback); + Py_XDECREF (exc_type); + Py_XDECREF (traceback); return NULL; } @@ -311,29 +311,29 @@ _wrap_Simulator_Run(PyNs3Simulator *PYBINDGEN_UNUSED(dummy), PyObject *args, PyO if (signal_check_frequency == -1) { if (PyEval_ThreadsInitialized ()) - py_thread_state = PyEval_SaveThread(); - ns3::Simulator::Run(); + py_thread_state = PyEval_SaveThread (); + ns3::Simulator::Run (); if (py_thread_state) - PyEval_RestoreThread(py_thread_state); + PyEval_RestoreThread (py_thread_state); } else { - while (!ns3::Simulator::IsFinished()) + while (!ns3::Simulator::IsFinished ()) { - if (PyEval_ThreadsInitialized()) - py_thread_state = PyEval_SaveThread(); + if (PyEval_ThreadsInitialized ()) + py_thread_state = PyEval_SaveThread (); - for (int n = signal_check_frequency; n > 0 && !ns3::Simulator::IsFinished(); --n) + for (int n = signal_check_frequency; n > 0 && !ns3::Simulator::IsFinished (); --n) { - ns3::Simulator::RunOneEvent(); + ns3::Simulator::RunOneEvent (); } if (py_thread_state) - PyEval_RestoreThread(py_thread_state); - PyErr_CheckSignals(); - if (PyErr_Occurred()) + PyEval_RestoreThread (py_thread_state); + PyErr_CheckSignals (); + if (PyErr_Occurred ()) return NULL; } } - Py_INCREF(Py_None); + Py_INCREF (Py_None); return Py_None; } diff --git a/src/core/examples/main-random-variable.cc b/src/core/examples/main-random-variable.cc index de16cd6da..cca00e641 100644 --- a/src/core/examples/main-random-variable.cc +++ b/src/core/examples/main-random-variable.cc @@ -26,13 +26,13 @@ using namespace ns3; /// Round a double number to the given precision. e.g. dround(0.234, 0.1) = 0.2 /// and dround(0.257, 0.1) = 0.3 -double dround(double number, double precision) +double dround (double number, double precision) { number /= precision; if (number >= 0) - number = std::floor(number + 0.5); + number = std::floor (number + 0.5); else - number = std::ceil(number - 0.5); + number = std::ceil (number - 0.5); number *= precision; return number; } @@ -45,23 +45,23 @@ Histogramm (RandomVariable rndvar, unsigned int probes, double precision, const for(unsigned int i = 0; i < probes; ++i) { - double val = dround( rndvar.GetValue(), precision ); + double val = dround ( rndvar.GetValue (), precision ); ++histogramm[val]; } Gnuplot2dDataset data; - data.SetTitle(title); + data.SetTitle (title); if (notcontinous) { - data.SetStyle(Gnuplot2dDataset::IMPULSES); + data.SetStyle (Gnuplot2dDataset::IMPULSES); } - for(histogramm_maptype::const_iterator hi = histogramm.begin(); - hi != histogramm.end(); ++hi) + for(histogramm_maptype::const_iterator hi = histogramm.begin (); + hi != histogramm.end (); ++hi) { - data.Add(hi->first, (double)hi->second / (double)probes / precision); + data.Add (hi->first, (double)hi->second / (double)probes / precision); } return data; @@ -72,306 +72,306 @@ int main (int argc, char *argv[]) unsigned int probes = 1000000; double precision = 0.01; - GnuplotCollection gnuplots("main-random-variables.pdf"); - gnuplots.SetTerminal("pdf enhanced"); + GnuplotCollection gnuplots ("main-random-variables.pdf"); + gnuplots.SetTerminal ("pdf enhanced"); { Gnuplot plot; - plot.SetTitle("UniformVariable"); - plot.AppendExtra("set yrange [0:]"); + plot.SetTitle ("UniformVariable"); + plot.AppendExtra ("set yrange [0:]"); - plot.AddDataset( Histogramm(UniformVariable(0.0, 1.0), probes, precision, - "UniformVariable [0.0 .. 1.0)") ); + plot.AddDataset ( Histogramm (UniformVariable (0.0, 1.0), probes, precision, + "UniformVariable [0.0 .. 1.0)") ); - plot.AddDataset( Gnuplot2dFunction("0.1", - "0 <= x && x <= 1 ? 1.0 : 0") ); + plot.AddDataset ( Gnuplot2dFunction ("0.1", + "0 <= x && x <= 1 ? 1.0 : 0") ); - gnuplots.AddPlot(plot); + gnuplots.AddPlot (plot); } { Gnuplot plot; - plot.SetTitle("ExponentialVariable"); - plot.AppendExtra("set xrange [0:8]"); - plot.AppendExtra("ExpDist(x,l) = 1/l * exp(-1/l * x)"); + plot.SetTitle ("ExponentialVariable"); + plot.AppendExtra ("set xrange [0:8]"); + plot.AppendExtra ("ExpDist(x,l) = 1/l * exp(-1/l * x)"); - plot.AddDataset( Histogramm(ExponentialVariable(0.5), probes, precision, - "ExponentialVariable m=0.5") ); + plot.AddDataset ( Histogramm (ExponentialVariable (0.5), probes, precision, + "ExponentialVariable m=0.5") ); - plot.AddDataset( Gnuplot2dFunction("ExponentialDistribution mean 0.5", - "ExpDist(x, 0.5)") ); + plot.AddDataset ( Gnuplot2dFunction ("ExponentialDistribution mean 0.5", + "ExpDist(x, 0.5)") ); - plot.AddDataset( Histogramm(ExponentialVariable(1.0), probes, precision, - "ExponentialVariable m=1") ); + plot.AddDataset ( Histogramm (ExponentialVariable (1.0), probes, precision, + "ExponentialVariable m=1") ); - plot.AddDataset( Gnuplot2dFunction("ExponentialDistribution mean 1.0", - "ExpDist(x, 1.0)") ); + plot.AddDataset ( Gnuplot2dFunction ("ExponentialDistribution mean 1.0", + "ExpDist(x, 1.0)") ); - plot.AddDataset( Histogramm(ExponentialVariable(1.5), probes, precision, - "ExponentialVariable m=1.5") ); + plot.AddDataset ( Histogramm (ExponentialVariable (1.5), probes, precision, + "ExponentialVariable m=1.5") ); - plot.AddDataset( Gnuplot2dFunction("ExponentialDistribution mean 1.5", - "ExpDist(x, 1.5)") ); + plot.AddDataset ( Gnuplot2dFunction ("ExponentialDistribution mean 1.5", + "ExpDist(x, 1.5)") ); - gnuplots.AddPlot(plot); + gnuplots.AddPlot (plot); } { Gnuplot plot; - plot.SetTitle("ParetoVariable"); - plot.AppendExtra("set xrange [0:2]"); + plot.SetTitle ("ParetoVariable"); + plot.AppendExtra ("set xrange [0:2]"); - plot.AddDataset( Histogramm(ParetoVariable(1.0, 1.5), probes, precision, - "ParetoVariable m=1.0 s=1.5") ); + plot.AddDataset ( Histogramm (ParetoVariable (1.0, 1.5), probes, precision, + "ParetoVariable m=1.0 s=1.5") ); - plot.AddDataset( Histogramm(ParetoVariable(1.0, 2.0), probes, precision, - "ParetoVariable m=1.0 s=2.0") ); + plot.AddDataset ( Histogramm (ParetoVariable (1.0, 2.0), probes, precision, + "ParetoVariable m=1.0 s=2.0") ); - plot.AddDataset( Histogramm(ParetoVariable(1.0, 2.5), probes, precision, - "ParetoVariable m=1.0 s=2.5") ); + plot.AddDataset ( Histogramm (ParetoVariable (1.0, 2.5), probes, precision, + "ParetoVariable m=1.0 s=2.5") ); - gnuplots.AddPlot(plot); + gnuplots.AddPlot (plot); } { Gnuplot plot; - plot.SetTitle("WeibullVariable"); - plot.AppendExtra("set xrange [0:3]"); + plot.SetTitle ("WeibullVariable"); + plot.AppendExtra ("set xrange [0:3]"); - plot.AddDataset( Histogramm(WeibullVariable(1.0, 1.0), probes, precision, - "WeibullVariable m=1.0 s=1.0") ); + plot.AddDataset ( Histogramm (WeibullVariable (1.0, 1.0), probes, precision, + "WeibullVariable m=1.0 s=1.0") ); - plot.AddDataset( Histogramm(WeibullVariable(1.0, 2.0), probes, precision, - "WeibullVariable m=1.0 s=2.0") ); + plot.AddDataset ( Histogramm (WeibullVariable (1.0, 2.0), probes, precision, + "WeibullVariable m=1.0 s=2.0") ); - plot.AddDataset( Histogramm(WeibullVariable(1.0, 3.0), probes, precision, - "WeibullVariable m=1.0 s=3.0") ); + plot.AddDataset ( Histogramm (WeibullVariable (1.0, 3.0), probes, precision, + "WeibullVariable m=1.0 s=3.0") ); - gnuplots.AddPlot(plot); + gnuplots.AddPlot (plot); } { Gnuplot plot; - plot.SetTitle("NormalVariable"); - plot.AppendExtra("set xrange [-3:3]"); - plot.AppendExtra("NormalDist(x,m,s) = 1 / (s * sqrt(2*pi)) * exp(-1.0 / 2.0 * ((x-m) / s)**2)"); + plot.SetTitle ("NormalVariable"); + plot.AppendExtra ("set xrange [-3:3]"); + plot.AppendExtra ("NormalDist(x,m,s) = 1 / (s * sqrt(2*pi)) * exp(-1.0 / 2.0 * ((x-m) / s)**2)"); - plot.AddDataset( Histogramm(NormalVariable(0.0, 1.0), probes, precision, - "NormalVariable m=0.0 v=1.0") ); + plot.AddDataset ( Histogramm (NormalVariable (0.0, 1.0), probes, precision, + "NormalVariable m=0.0 v=1.0") ); - plot.AddDataset( Gnuplot2dFunction("NormalDist {/Symbol m}=0.0 {/Symbol s}=1.0", - "NormalDist(x,0.0,1.0)") ); + plot.AddDataset ( Gnuplot2dFunction ("NormalDist {/Symbol m}=0.0 {/Symbol s}=1.0", + "NormalDist(x,0.0,1.0)") ); - plot.AddDataset( Histogramm(NormalVariable(0.0, 2.0), probes, precision, - "NormalVariable m=0.0 v=2.0") ); + plot.AddDataset ( Histogramm (NormalVariable (0.0, 2.0), probes, precision, + "NormalVariable m=0.0 v=2.0") ); - plot.AddDataset( Gnuplot2dFunction("NormalDist {/Symbol m}=0.0 {/Symbol s}=sqrt(2.0)", - "NormalDist(x,0.0,sqrt(2.0))") ); + plot.AddDataset ( Gnuplot2dFunction ("NormalDist {/Symbol m}=0.0 {/Symbol s}=sqrt(2.0)", + "NormalDist(x,0.0,sqrt(2.0))") ); - plot.AddDataset( Histogramm(NormalVariable(0.0, 3.0), probes, precision, - "NormalVariable m=0.0 v=3.0") ); + plot.AddDataset ( Histogramm (NormalVariable (0.0, 3.0), probes, precision, + "NormalVariable m=0.0 v=3.0") ); - plot.AddDataset( Gnuplot2dFunction("NormalDist {/Symbol m}=0.0 {/Symbol s}=sqrt(3.0)", - "NormalDist(x,0.0,sqrt(3.0))") ); + plot.AddDataset ( Gnuplot2dFunction ("NormalDist {/Symbol m}=0.0 {/Symbol s}=sqrt(3.0)", + "NormalDist(x,0.0,sqrt(3.0))") ); - gnuplots.AddPlot(plot); + gnuplots.AddPlot (plot); } { Gnuplot plot; - plot.SetTitle("EmpiricalVariable"); - plot.AppendExtra("set xrange [*:*]"); + plot.SetTitle ("EmpiricalVariable"); + plot.AppendExtra ("set xrange [*:*]"); EmpiricalVariable emp1; - emp1.CDF(0.0, 0.0 / 15.0); - emp1.CDF(0.2, 1.0 / 15.0); - emp1.CDF(0.4, 3.0 / 15.0); - emp1.CDF(0.6, 6.0 / 15.0); - emp1.CDF(0.8, 10.0 / 15.0); - emp1.CDF(1.0, 15.0 / 15.0); + emp1.CDF (0.0, 0.0 / 15.0); + emp1.CDF (0.2, 1.0 / 15.0); + emp1.CDF (0.4, 3.0 / 15.0); + emp1.CDF (0.6, 6.0 / 15.0); + emp1.CDF (0.8, 10.0 / 15.0); + emp1.CDF (1.0, 15.0 / 15.0); - plot.AddDataset( Histogramm(emp1, probes, precision, - "EmpiricalVariable (Stairs)") ); + plot.AddDataset ( Histogramm (emp1, probes, precision, + "EmpiricalVariable (Stairs)") ); - gnuplots.AddPlot(plot); + gnuplots.AddPlot (plot); } { Gnuplot plot; - plot.SetTitle("DeterministicVariable"); - plot.AppendExtra("set xrange [*:*]"); + plot.SetTitle ("DeterministicVariable"); + plot.AppendExtra ("set xrange [*:*]"); double values[] = { 0.0, 0.2, 0.2, 0.4, 0.2, 0.6, 0.8, 0.8, 1.0 }; DeterministicVariable det1 (values, sizeof(values) / sizeof(values[0])); - plot.AddDataset( Histogramm(det1, probes, precision, - "DeterministicVariable", true) ); + plot.AddDataset ( Histogramm (det1, probes, precision, + "DeterministicVariable", true) ); - gnuplots.AddPlot(plot); + gnuplots.AddPlot (plot); } { Gnuplot plot; - plot.SetTitle("LogNormalVariable"); - plot.AppendExtra("set xrange [0:3]"); + plot.SetTitle ("LogNormalVariable"); + plot.AppendExtra ("set xrange [0:3]"); - plot.AppendExtra("LogNormalDist(x,m,s) = 1.0/x * NormalDist(log(x), m, s)"); + plot.AppendExtra ("LogNormalDist(x,m,s) = 1.0/x * NormalDist(log(x), m, s)"); - plot.AddDataset( Histogramm(LogNormalVariable(0.0, 1.0), probes, precision, - "LogNormalVariable m=0.0 s=1.0") ); + plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 1.0), probes, precision, + "LogNormalVariable m=0.0 s=1.0") ); - plot.AddDataset( Gnuplot2dFunction("LogNormalDist(x, 0.0, 1.0)", - "LogNormalDist(x, 0.0, 1.0)") ); + plot.AddDataset ( Gnuplot2dFunction ("LogNormalDist(x, 0.0, 1.0)", + "LogNormalDist(x, 0.0, 1.0)") ); - plot.AddDataset( Histogramm(LogNormalVariable(0.0, 0.5), probes, precision, - "LogNormalVariable m=0.0 s=0.5") ); + plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 0.5), probes, precision, + "LogNormalVariable m=0.0 s=0.5") ); - plot.AddDataset( Histogramm(LogNormalVariable(0.0, 0.25), probes, precision, - "LogNormalVariable m=0.0 s=0.25") ); + plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 0.25), probes, precision, + "LogNormalVariable m=0.0 s=0.25") ); - plot.AddDataset( Gnuplot2dFunction("LogNormalDist(x, 0.0, 0.25)", - "LogNormalDist(x, 0.0, 0.25)") ); + plot.AddDataset ( Gnuplot2dFunction ("LogNormalDist(x, 0.0, 0.25)", + "LogNormalDist(x, 0.0, 0.25)") ); - plot.AddDataset( Histogramm(LogNormalVariable(0.0, 0.125), probes, precision, - "LogNormalVariable m=0.0 s=0.125") ); + plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 0.125), probes, precision, + "LogNormalVariable m=0.0 s=0.125") ); - plot.AddDataset( Histogramm(LogNormalVariable(0.0, 2.0), probes, precision, - "LogNormalVariable m=0.0 s=2.0") ); + plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 2.0), probes, precision, + "LogNormalVariable m=0.0 s=2.0") ); - plot.AddDataset( Gnuplot2dFunction("LogNormalDist(x, 0.0, 2.0)", - "LogNormalDist(x, 0.0, 2.0)") ); + plot.AddDataset ( Gnuplot2dFunction ("LogNormalDist(x, 0.0, 2.0)", + "LogNormalDist(x, 0.0, 2.0)") ); - plot.AddDataset( Histogramm(LogNormalVariable(0.0, 2.5), probes, precision, - "LogNormalVariable m=0.0 s=2.5") ); + plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 2.5), probes, precision, + "LogNormalVariable m=0.0 s=2.5") ); - gnuplots.AddPlot(plot); + gnuplots.AddPlot (plot); } { Gnuplot plot; - plot.SetTitle("TriangularVariable"); - plot.AppendExtra("set xrange [*:*]"); + plot.SetTitle ("TriangularVariable"); + plot.AppendExtra ("set xrange [*:*]"); - plot.AddDataset( Histogramm(TriangularVariable(0.0, 1.0, 0.5), probes, precision, - "TriangularVariable [0.0 .. 1.0) m=0.5") ); + plot.AddDataset ( Histogramm (TriangularVariable (0.0, 1.0, 0.5), probes, precision, + "TriangularVariable [0.0 .. 1.0) m=0.5") ); - plot.AddDataset( Histogramm(TriangularVariable(0.0, 1.0, 0.4), probes, precision, - "TriangularVariable [0.0 .. 1.0) m=0.4") ); + plot.AddDataset ( Histogramm (TriangularVariable (0.0, 1.0, 0.4), probes, precision, + "TriangularVariable [0.0 .. 1.0) m=0.4") ); - plot.AddDataset( Histogramm(TriangularVariable(0.0, 1.0, 0.65), probes, precision, - "TriangularVariable [0.0 .. 1.0) m=0.65") ); + plot.AddDataset ( Histogramm (TriangularVariable (0.0, 1.0, 0.65), probes, precision, + "TriangularVariable [0.0 .. 1.0) m=0.65") ); - gnuplots.AddPlot(plot); + gnuplots.AddPlot (plot); } { Gnuplot plot; - plot.SetTitle("GammaVariable"); - plot.AppendExtra("set xrange [0:10]"); - plot.AppendExtra("set yrange [0:1]"); - plot.AppendExtra("GammaDist(x,a,b) = x**(a-1) * 1/b**a * exp(-x/b) / gamma(a)"); + plot.SetTitle ("GammaVariable"); + plot.AppendExtra ("set xrange [0:10]"); + plot.AppendExtra ("set yrange [0:1]"); + plot.AppendExtra ("GammaDist(x,a,b) = x**(a-1) * 1/b**a * exp(-x/b) / gamma(a)"); - plot.AppendExtra("set label 1 '{/Symbol g}(x,{/Symbol a},{/Symbol b}) = x^{/Symbol a-1} e^{-x {/Symbol b}^{-1}} ( {/Symbol b}^{/Symbol a} {/Symbol G}({/Symbol a}) )^{-1}' at 0.7, 0.9"); + plot.AppendExtra ("set label 1 '{/Symbol g}(x,{/Symbol a},{/Symbol b}) = x^{/Symbol a-1} e^{-x {/Symbol b}^{-1}} ( {/Symbol b}^{/Symbol a} {/Symbol G}({/Symbol a}) )^{-1}' at 0.7, 0.9"); - plot.AddDataset( Histogramm(GammaVariable(1.0, 1.0), probes, precision, - "GammaVariable a=1.0 b=1.0") ); + plot.AddDataset ( Histogramm (GammaVariable (1.0, 1.0), probes, precision, + "GammaVariable a=1.0 b=1.0") ); - plot.AddDataset( Gnuplot2dFunction("{/Symbol g}(x, 1.0, 1.0)", - "GammaDist(x, 1.0, 1.0)") ); + plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 1.0, 1.0)", + "GammaDist(x, 1.0, 1.0)") ); - plot.AddDataset( Histogramm(GammaVariable(1.5, 1.0), probes, precision, - "GammaVariable a=1.5 b=1.0") ); + plot.AddDataset ( Histogramm (GammaVariable (1.5, 1.0), probes, precision, + "GammaVariable a=1.5 b=1.0") ); - plot.AddDataset( Gnuplot2dFunction("{/Symbol g}(x, 1.5, 1.0)", - "GammaDist(x, 1.5, 1.0)") ); + plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 1.5, 1.0)", + "GammaDist(x, 1.5, 1.0)") ); - plot.AddDataset( Histogramm(GammaVariable(2.0, 1.0), probes, precision, - "GammaVariable a=2.0 b=1.0") ); + plot.AddDataset ( Histogramm (GammaVariable (2.0, 1.0), probes, precision, + "GammaVariable a=2.0 b=1.0") ); - plot.AddDataset( Gnuplot2dFunction("{/Symbol g}(x, 2.0, 1.0)", - "GammaDist(x, 2.0, 1.0)") ); + plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.0, 1.0)", + "GammaDist(x, 2.0, 1.0)") ); - plot.AddDataset( Histogramm(GammaVariable(4.0, 1.0), probes, precision, - "GammaVariable a=4.0 b=1.0") ); + plot.AddDataset ( Histogramm (GammaVariable (4.0, 1.0), probes, precision, + "GammaVariable a=4.0 b=1.0") ); - plot.AddDataset( Gnuplot2dFunction("{/Symbol g}(x, 4.0, 1.0)", - "GammaDist(x, 4.0, 1.0)") ); + plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 4.0, 1.0)", + "GammaDist(x, 4.0, 1.0)") ); - plot.AddDataset( Histogramm(GammaVariable(2.0, 2.0), probes, precision, - "GammaVariable a=2.0 b=2.0") ); + plot.AddDataset ( Histogramm (GammaVariable (2.0, 2.0), probes, precision, + "GammaVariable a=2.0 b=2.0") ); - plot.AddDataset( Gnuplot2dFunction("{/Symbol g}(x, 2.0, 2.0)", - "GammaDist(x, 2.0, 2.0)") ); + plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.0, 2.0)", + "GammaDist(x, 2.0, 2.0)") ); - plot.AddDataset( Histogramm(GammaVariable(2.5, 3.0), probes, precision, - "GammaVariable a=2.5 b=3.0") ); + plot.AddDataset ( Histogramm (GammaVariable (2.5, 3.0), probes, precision, + "GammaVariable a=2.5 b=3.0") ); - plot.AddDataset( Gnuplot2dFunction("{/Symbol g}(x, 2.5, 3.0)", - "GammaDist(x, 2.5, 3.0)") ); + plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.5, 3.0)", + "GammaDist(x, 2.5, 3.0)") ); - plot.AddDataset( Histogramm(GammaVariable(2.5, 4.5), probes, precision, - "GammaVariable a=2.5 b=4.5") ); + plot.AddDataset ( Histogramm (GammaVariable (2.5, 4.5), probes, precision, + "GammaVariable a=2.5 b=4.5") ); - plot.AddDataset( Gnuplot2dFunction("{/Symbol g}(x, 2.5, 4.5)", - "GammaDist(x, 2.5, 4.5)") ); + plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.5, 4.5)", + "GammaDist(x, 2.5, 4.5)") ); - gnuplots.AddPlot(plot); + gnuplots.AddPlot (plot); } { Gnuplot plot; - plot.SetTitle("ErlangVariable"); - plot.AppendExtra("set xrange [0:10]"); - plot.AppendExtra("ErlangDist(x,k,l) = x**(k-1) * 1/l**k * exp(-x/l) / (k-1)!"); + plot.SetTitle ("ErlangVariable"); + plot.AppendExtra ("set xrange [0:10]"); + plot.AppendExtra ("ErlangDist(x,k,l) = x**(k-1) * 1/l**k * exp(-x/l) / (k-1)!"); - plot.AppendExtra("set label 1 'Erlang(x,k,{/Symbol l}) = x^{k-1} e^{-x {/Symbol l}^{-1}} ( {/Symbol l}^k (k-1)! )^{-1}' at 0.7, 0.9"); + plot.AppendExtra ("set label 1 'Erlang(x,k,{/Symbol l}) = x^{k-1} e^{-x {/Symbol l}^{-1}} ( {/Symbol l}^k (k-1)! )^{-1}' at 0.7, 0.9"); - plot.AddDataset( Histogramm(ErlangVariable(1, 1.0), probes, precision, - "ErlangVariable k=1 {/Symbol l}=1.0") ); + plot.AddDataset ( Histogramm (ErlangVariable (1, 1.0), probes, precision, + "ErlangVariable k=1 {/Symbol l}=1.0") ); - plot.AddDataset( Gnuplot2dFunction("Erlang(x, 1, 1.0)", - "ErlangDist(x, 1, 1.0)") ); + plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 1, 1.0)", + "ErlangDist(x, 1, 1.0)") ); - plot.AddDataset( Histogramm(ErlangVariable(2, 1.0), probes, precision, - "ErlangVariable k=2 {/Symbol l}=1.0") ); + plot.AddDataset ( Histogramm (ErlangVariable (2, 1.0), probes, precision, + "ErlangVariable k=2 {/Symbol l}=1.0") ); - plot.AddDataset( Gnuplot2dFunction("Erlang(x, 2, 1.0)", - "ErlangDist(x, 2, 1.0)") ); + plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 1.0)", + "ErlangDist(x, 2, 1.0)") ); - plot.AddDataset( Histogramm(ErlangVariable(3, 1.0), probes, precision, - "ErlangVariable k=3 {/Symbol l}=1.0") ); + plot.AddDataset ( Histogramm (ErlangVariable (3, 1.0), probes, precision, + "ErlangVariable k=3 {/Symbol l}=1.0") ); - plot.AddDataset( Gnuplot2dFunction("Erlang(x, 3, 1.0)", - "ErlangDist(x, 3, 1.0)") ); + plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 3, 1.0)", + "ErlangDist(x, 3, 1.0)") ); - plot.AddDataset( Histogramm(ErlangVariable(5, 1.0), probes, precision, - "ErlangVariable k=5 {/Symbol l}=1.0") ); + plot.AddDataset ( Histogramm (ErlangVariable (5, 1.0), probes, precision, + "ErlangVariable k=5 {/Symbol l}=1.0") ); - plot.AddDataset( Gnuplot2dFunction("Erlang(x, 5, 1.0)", - "ErlangDist(x, 5, 1.0)") ); + plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 5, 1.0)", + "ErlangDist(x, 5, 1.0)") ); - plot.AddDataset( Histogramm(ErlangVariable(2, 2.0), probes, precision, - "ErlangVariable k=2 {/Symbol l}=2.0") ); + plot.AddDataset ( Histogramm (ErlangVariable (2, 2.0), probes, precision, + "ErlangVariable k=2 {/Symbol l}=2.0") ); - plot.AddDataset( Gnuplot2dFunction("Erlang(x, 2, 2.0)", - "ErlangDist(x, 2, 2.0)") ); + plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 2.0)", + "ErlangDist(x, 2, 2.0)") ); - plot.AddDataset( Histogramm(ErlangVariable(2, 3.0), probes, precision, - "ErlangVariable k=2 {/Symbol l}=3.0") ); + plot.AddDataset ( Histogramm (ErlangVariable (2, 3.0), probes, precision, + "ErlangVariable k=2 {/Symbol l}=3.0") ); - plot.AddDataset( Gnuplot2dFunction("Erlang(x, 2, 3.0)", - "ErlangDist(x, 2, 3.0)") ); + plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 3.0)", + "ErlangDist(x, 2, 3.0)") ); - plot.AddDataset( Histogramm(ErlangVariable(2, 5.0), probes, precision, - "ErlangVariable k=2 {/Symbol l}=5.0") ); + plot.AddDataset ( Histogramm (ErlangVariable (2, 5.0), probes, precision, + "ErlangVariable k=2 {/Symbol l}=5.0") ); - plot.AddDataset( Gnuplot2dFunction("Erlang(x, 2, 5.0)", - "ErlangDist(x, 2, 5.0)") ); + plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 5.0)", + "ErlangDist(x, 2, 5.0)") ); - gnuplots.AddPlot(plot); + gnuplots.AddPlot (plot); } - gnuplots.GenerateOutput(std::cout); + gnuplots.GenerateOutput (std::cout); return 0; } diff --git a/src/core/examples/main-test-sync.cc b/src/core/examples/main-test-sync.cc index dac2c8418..e7b2aec6a 100644 --- a/src/core/examples/main-test-sync.cc +++ b/src/core/examples/main-test-sync.cc @@ -97,7 +97,7 @@ test (void) // // Make sure ScheduleNow works when the system isn't running // - DynamicCast (Simulator::GetImplementation ())->ScheduleRealtimeNow(MakeEvent (&first_function)); + DynamicCast (Simulator::GetImplementation ())->ScheduleRealtimeNow (MakeEvent (&first_function)); // // drive the progression of m_currentTs at a ten millisecond rate from the main thread diff --git a/src/core/model/abort.h b/src/core/model/abort.h index 7061ef971..6796aa17a 100644 --- a/src/core/model/abort.h +++ b/src/core/model/abort.h @@ -115,7 +115,7 @@ * \see NS_ABORT_IF */ #define NS_ABORT_UNLESS(cond) \ - NS_ABORT_IF(!(cond)) + NS_ABORT_IF (!(cond)) /** * \ingroup debugging @@ -129,6 +129,6 @@ * \see NS_ABORT_MSG_IF */ #define NS_ABORT_MSG_UNLESS(cond, msg) \ - NS_ABORT_MSG_IF(!(cond),msg) + NS_ABORT_MSG_IF (!(cond),msg) #endif /* NS3_ABORT_H */ diff --git a/src/core/model/assert.h b/src/core/model/assert.h index 12f7ec0f5..34e38c27c 100644 --- a/src/core/model/assert.h +++ b/src/core/model/assert.h @@ -68,7 +68,7 @@ { \ std::cerr << "assert failed. cond=\"" << \ # condition << "\", "; \ - NS_FATAL_ERROR_NO_MSG(); \ + NS_FATAL_ERROR_NO_MSG (); \ } \ } \ while (false) diff --git a/src/core/model/attribute-helper.h b/src/core/model/attribute-helper.h index b69d5ab93..a5b353275 100644 --- a/src/core/model/attribute-helper.h +++ b/src/core/model/attribute-helper.h @@ -203,7 +203,7 @@ private: \ * Typically invoked from xxx.cc. */ #define ATTRIBUTE_VALUE_IMPLEMENT(type) \ - ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME(type,type) + ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME (type,type) /** diff --git a/src/core/model/cairo-wideint-private.h b/src/core/model/cairo-wideint-private.h index ccb8e85de..27252c1fa 100644 --- a/src/core/model/cairo-wideint-private.h +++ b/src/core/model/cairo-wideint-private.h @@ -112,8 +112,8 @@ cairo_uint64_t I _cairo_uint64_not (cairo_uint64_t a); #define _cairo_uint64_to_int64(i) (i) #define _cairo_int64_to_uint64(i) (i) -cairo_int64_t I _cairo_int32_to_int64(int32_t i); -#define _cairo_int64_to_int32(a) ((int32_t) _cairo_uint64_to_uint32(a)) +cairo_int64_t I _cairo_int32_to_int64 (int32_t i); +#define _cairo_int64_to_int32(a) ((int32_t) _cairo_uint64_to_uint32 (a)) #define _cairo_int64_add(a,b) _cairo_uint64_add (a,b) #define _cairo_int64_sub(a,b) _cairo_uint64_sub (a,b) #define _cairo_int64_mul(a,b) _cairo_uint64_mul (a,b) @@ -123,9 +123,9 @@ int I _cairo_int64_lt (cairo_uint64_t a, cairo_uint64_t b); #define _cairo_int64_lsl(a,b) _cairo_uint64_lsl (a,b) #define _cairo_int64_rsl(a,b) _cairo_uint64_rsl (a,b) #define _cairo_int64_rsa(a,b) _cairo_uint64_rsa (a,b) -#define _cairo_int64_negate(a) _cairo_uint64_negate(a) +#define _cairo_int64_negate(a) _cairo_uint64_negate (a) #define _cairo_int64_negative(a) (((int32_t)((a).hi)) < 0) -#define _cairo_int64_not(a) _cairo_uint64_not(a) +#define _cairo_int64_not(a) _cairo_uint64_not (a) #else @@ -170,15 +170,15 @@ typedef int64_t cairo_int64_t; /* * 64-bit comparisions derived from lt or eq */ -#define _cairo_uint64_le(a,b) (!_cairo_uint64_gt(a,b)) -#define _cairo_uint64_ne(a,b) (!_cairo_uint64_eq(a,b)) -#define _cairo_uint64_ge(a,b) (!_cairo_uint64_lt(a,b)) -#define _cairo_uint64_gt(a,b) _cairo_uint64_lt(b,a) +#define _cairo_uint64_le(a,b) (!_cairo_uint64_gt (a,b)) +#define _cairo_uint64_ne(a,b) (!_cairo_uint64_eq (a,b)) +#define _cairo_uint64_ge(a,b) (!_cairo_uint64_lt (a,b)) +#define _cairo_uint64_gt(a,b) _cairo_uint64_lt (b,a) -#define _cairo_int64_le(a,b) (!_cairo_int64_gt(a,b)) -#define _cairo_int64_ne(a,b) (!_cairo_int64_eq(a,b)) -#define _cairo_int64_ge(a,b) (!_cairo_int64_lt(a,b)) -#define _cairo_int64_gt(a,b) _cairo_int64_lt(b,a) +#define _cairo_int64_le(a,b) (!_cairo_int64_gt (a,b)) +#define _cairo_int64_ne(a,b) (!_cairo_int64_eq (a,b)) +#define _cairo_int64_ge(a,b) (!_cairo_int64_lt (a,b)) +#define _cairo_int64_gt(a,b) _cairo_int64_lt (b,a) /* * As the C implementation always computes both, create @@ -216,7 +216,7 @@ typedef struct cairo_uint128 { cairo_uint128_t I _cairo_uint32_to_uint128 (uint32_t i); cairo_uint128_t I _cairo_uint64_to_uint128 (cairo_uint64_t i); #define _cairo_uint128_to_uint64(a) ((a).lo) -#define _cairo_uint128_to_uint32(a) _cairo_uint64_to_uint32(_cairo_uint128_to_uint64(a)) +#define _cairo_uint128_to_uint32(a) _cairo_uint64_to_uint32 (_cairo_uint128_to_uint64 (a)) cairo_uint128_t I _cairo_uint128_add (cairo_uint128_t a, cairo_uint128_t b); cairo_uint128_t I _cairo_uint128_sub (cairo_uint128_t a, cairo_uint128_t b); cairo_uint128_t I _cairo_uint128_mul (cairo_uint128_t a, cairo_uint128_t b); @@ -227,7 +227,7 @@ cairo_uint128_t I _cairo_uint128_rsa (cairo_uint128_t a, int shift); int I _cairo_uint128_lt (cairo_uint128_t a, cairo_uint128_t b); int I _cairo_uint128_eq (cairo_uint128_t a, cairo_uint128_t b); cairo_uint128_t I _cairo_uint128_negate (cairo_uint128_t a); -#define _cairo_uint128_negative(a) (_cairo_uint64_negative(a.hi)) +#define _cairo_uint128_negative(a) (_cairo_uint64_negative (a.hi)) cairo_uint128_t I _cairo_uint128_not (cairo_uint128_t a); #define _cairo_uint128_to_int128(i) (i) @@ -236,19 +236,19 @@ cairo_uint128_t I _cairo_uint128_not (cairo_uint128_t a); cairo_int128_t I _cairo_int32_to_int128 (int32_t i); cairo_int128_t I _cairo_int64_to_int128 (cairo_int64_t i); #define _cairo_int128_to_int64(a) ((cairo_int64_t)(a).lo) -#define _cairo_int128_to_int32(a) _cairo_int64_to_int32(_cairo_int128_to_int64(a)) -#define _cairo_int128_add(a,b) _cairo_uint128_add(a,b) -#define _cairo_int128_sub(a,b) _cairo_uint128_sub(a,b) -#define _cairo_int128_mul(a,b) _cairo_uint128_mul(a,b) +#define _cairo_int128_to_int32(a) _cairo_int64_to_int32 (_cairo_int128_to_int64 (a)) +#define _cairo_int128_add(a,b) _cairo_uint128_add (a,b) +#define _cairo_int128_sub(a,b) _cairo_uint128_sub (a,b) +#define _cairo_int128_mul(a,b) _cairo_uint128_mul (a,b) cairo_int128_t I _cairo_int64x64_128_mul (cairo_int64_t a, cairo_int64_t b); -#define _cairo_int128_lsl(a,b) _cairo_uint128_lsl(a,b) -#define _cairo_int128_rsl(a,b) _cairo_uint128_rsl(a,b) -#define _cairo_int128_rsa(a,b) _cairo_uint128_rsa(a,b) +#define _cairo_int128_lsl(a,b) _cairo_uint128_lsl (a,b) +#define _cairo_int128_rsl(a,b) _cairo_uint128_rsl (a,b) +#define _cairo_int128_rsa(a,b) _cairo_uint128_rsa (a,b) int I _cairo_int128_lt (cairo_int128_t a, cairo_int128_t b); #define _cairo_int128_eq(a,b) _cairo_uint128_eq (a,b) -#define _cairo_int128_negate(a) _cairo_uint128_negate(a) -#define _cairo_int128_negative(a) (_cairo_uint128_negative(a)) -#define _cairo_int128_not(a) _cairo_uint128_not(a) +#define _cairo_int128_negate(a) _cairo_uint128_negate (a) +#define _cairo_int128_negative(a) (_cairo_uint128_negative (a)) +#define _cairo_int128_not(a) _cairo_uint128_not (a) #else /* !HAVE_UINT128_T */ @@ -318,15 +318,15 @@ cairo_quorem64_t I _cairo_int_96by64_32x64_divrem (cairo_int128_t num, cairo_int64_t den); -#define _cairo_uint128_le(a,b) (!_cairo_uint128_gt(a,b)) -#define _cairo_uint128_ne(a,b) (!_cairo_uint128_eq(a,b)) -#define _cairo_uint128_ge(a,b) (!_cairo_uint128_lt(a,b)) -#define _cairo_uint128_gt(a,b) _cairo_uint128_lt(b,a) +#define _cairo_uint128_le(a,b) (!_cairo_uint128_gt (a,b)) +#define _cairo_uint128_ne(a,b) (!_cairo_uint128_eq (a,b)) +#define _cairo_uint128_ge(a,b) (!_cairo_uint128_lt (a,b)) +#define _cairo_uint128_gt(a,b) _cairo_uint128_lt (b,a) -#define _cairo_int128_le(a,b) (!_cairo_int128_gt(a,b)) -#define _cairo_int128_ne(a,b) (!_cairo_int128_eq(a,b)) -#define _cairo_int128_ge(a,b) (!_cairo_int128_lt(a,b)) -#define _cairo_int128_gt(a,b) _cairo_int128_lt(b,a) +#define _cairo_int128_le(a,b) (!_cairo_int128_gt (a,b)) +#define _cairo_int128_ne(a,b) (!_cairo_int128_eq (a,b)) +#define _cairo_int128_ge(a,b) (!_cairo_int128_lt (a,b)) +#define _cairo_int128_gt(a,b) _cairo_int128_lt (b,a) #undef I diff --git a/src/core/model/callback.cc b/src/core/model/callback.cc index 30ed261c3..0998ef076 100644 --- a/src/core/model/callback.cc +++ b/src/core/model/callback.cc @@ -49,36 +49,36 @@ ATTRIBUTE_CHECKER_IMPLEMENT (Callback); namespace ns3 { std::string -CallbackBase::Demangle(const std::string& mangled) +CallbackBase::Demangle (const std::string& mangled) { int status; - char* demangled = abi::__cxa_demangle(mangled.c_str(), - NULL, NULL, &status); + char* demangled = abi::__cxa_demangle (mangled.c_str (), + NULL, NULL, &status); std::string ret; if (status == 0) { - NS_ASSERT(demangled); + NS_ASSERT (demangled); ret = demangled; } else if (status == -1) { - NS_LOG_UNCOND("Callback demangling failed: Memory allocation failure occured."); + NS_LOG_UNCOND ("Callback demangling failed: Memory allocation failure occured."); ret = mangled; } else if (status == -2) { - NS_LOG_UNCOND("Callback demangling failed: Mangled name is not a valid under the C++ ABI mangling rules."); + NS_LOG_UNCOND ("Callback demangling failed: Mangled name is not a valid under the C++ ABI mangling rules."); ret = mangled; } else if (status == -3) { - NS_LOG_UNCOND("Callback demangling failed: One of the arguments is invalid."); + NS_LOG_UNCOND ("Callback demangling failed: One of the arguments is invalid."); ret = mangled; } else { - NS_LOG_UNCOND("Callback demangling failed: status " << status); + NS_LOG_UNCOND ("Callback demangling failed: status " << status); ret = mangled; } if (demangled) { - free(demangled); + free (demangled); } return ret; } @@ -88,7 +88,7 @@ CallbackBase::Demangle(const std::string& mangled) #else std::string -ns3::CallbackBase::Demangle(const std::string& mangled) +ns3::CallbackBase::Demangle (const std::string& mangled) { return mangled; } diff --git a/src/core/model/callback.h b/src/core/model/callback.h index 42ea694fd..67546e3fd 100644 --- a/src/core/model/callback.h +++ b/src/core/model/callback.h @@ -194,7 +194,7 @@ public: } virtual bool IsEqual (Ptr other) const { FunctorCallbackImpl const *otherDerived = - dynamic_cast const *> (PeekPointer(other)); + dynamic_cast const *> (PeekPointer (other)); if (otherDerived == 0) { return false; @@ -328,7 +328,7 @@ protected: CallbackBase (Ptr impl) : m_impl (impl) {} Ptr m_impl; - static std::string Demangle(const std::string& mangled); + static std::string Demangle (const std::string& mangled); }; /** @@ -974,7 +974,7 @@ private: CallbackBase m_value; }; -ATTRIBUTE_ACCESSOR_DEFINE(Callback); +ATTRIBUTE_ACCESSOR_DEFINE (Callback); ATTRIBUTE_CHECKER_DEFINE (Callback); } // namespace ns3 diff --git a/src/core/model/default-simulator-impl.cc b/src/core/model/default-simulator-impl.cc index 3f0db0066..b3793da42 100644 --- a/src/core/model/default-simulator-impl.cc +++ b/src/core/model/default-simulator-impl.cc @@ -161,7 +161,7 @@ DefaultSimulatorImpl::Run (void) // If the simulator stopped naturally by lack of events, make a // consistency test to check that we didn't lose any events along the way. - NS_ASSERT(!m_events->IsEmpty () || m_unscheduledEvents == 0); + NS_ASSERT (!m_events->IsEmpty () || m_unscheduledEvents == 0); } void diff --git a/src/core/model/fatal-error.h b/src/core/model/fatal-error.h index 296e12b34..1f3fb6b84 100644 --- a/src/core/model/fatal-error.h +++ b/src/core/model/fatal-error.h @@ -73,7 +73,7 @@ do \ { \ std::cerr << "msg=\"" << msg << "\", "; \ - NS_FATAL_ERROR_NO_MSG(); \ + NS_FATAL_ERROR_NO_MSG (); \ } \ while (false) diff --git a/src/core/model/fatal-impl.cc b/src/core/model/fatal-impl.cc index 40ea58f01..1099e3e09 100644 --- a/src/core/model/fatal-impl.cc +++ b/src/core/model/fatal-impl.cc @@ -96,7 +96,7 @@ UnregisterStream (std::ostream* stream) namespace { /* Overrides normal SIGSEGV handler once the * HandleTerminate function is run. */ -void sigHandler(int sig) +void sigHandler (int sig) { FlushStreams (); std::abort (); diff --git a/src/core/model/int64x64-cairo.cc b/src/core/model/int64x64-cairo.cc index e679bfd67..4c05da45b 100644 --- a/src/core/model/int64x64-cairo.cc +++ b/src/core/model/int64x64-cairo.cc @@ -114,10 +114,10 @@ void int64x64_t::MulByInvert (const int64x64_t &o) { bool negResult = _cairo_int128_negative (_v); - cairo_uint128_t a = negResult ? _cairo_int128_negate(_v) : _v; + cairo_uint128_t a = negResult ? _cairo_int128_negate (_v) : _v; cairo_uint128_t result = UmulByInvert (a, o._v); - _v = negResult ? _cairo_int128_negate(result) : result; + _v = negResult ? _cairo_int128_negate (result) : result; } cairo_uint128_t int64x64_t::UmulByInvert (cairo_uint128_t a, cairo_uint128_t b) diff --git a/src/core/model/int64x64-cairo.h b/src/core/model/int64x64-cairo.h index 4af474b2b..769a6fbca 100644 --- a/src/core/model/int64x64-cairo.h +++ b/src/core/model/int64x64-cairo.h @@ -25,7 +25,7 @@ public: { #define HPCAIRO_MAX_64 18446744073709551615.0 double fhi = floor (value); - int64_t hi = lround(fhi); + int64_t hi = lround (fhi); uint64_t lo = (uint64_t)((value - fhi) * HPCAIRO_MAX_64); _v.hi = hi; _v.lo = lo; diff --git a/src/core/model/int64x64.cc b/src/core/model/int64x64.cc index b90becbc1..99840e37b 100644 --- a/src/core/model/int64x64.cc +++ b/src/core/model/int64x64.cc @@ -92,11 +92,11 @@ std::istream &operator >> (std::istream &is, int64x64_t &value) cur = next; int64_t hi; uint64_t lo; - next = str.find(".", cur); + next = str.find (".", cur); if (next != std::string::npos) { hi = ReadDigits (str.substr (cur, next-cur)); - lo = ReadDigits (str.substr (next+1, str.size()-(next+1))); + lo = ReadDigits (str.substr (next+1, str.size ()-(next+1))); } else { diff --git a/src/core/model/int64x64.h b/src/core/model/int64x64.h index d900d6912..270cae9d8 100644 --- a/src/core/model/int64x64.h +++ b/src/core/model/int64x64.h @@ -36,17 +36,17 @@ namespace ns3 { tmp op ## = rhs; \ return tmp; \ } \ - INT64X64_OP_ARITH_TYPE(op,double) \ - INT64X64_OP_ARITH_TYPE(op,signed char) \ - INT64X64_OP_ARITH_TYPE(op,signed short) \ - INT64X64_OP_ARITH_TYPE(op,signed int) \ - INT64X64_OP_ARITH_TYPE(op,signed long int) \ - INT64X64_OP_ARITH_TYPE(op,signed long long int) \ - INT64X64_OP_ARITH_TYPE(op,unsigned char) \ - INT64X64_OP_ARITH_TYPE(op,unsigned short) \ - INT64X64_OP_ARITH_TYPE(op,unsigned int) \ - INT64X64_OP_ARITH_TYPE(op,unsigned long int) \ - INT64X64_OP_ARITH_TYPE(op,unsigned long long int) + INT64X64_OP_ARITH_TYPE (op,double) \ + INT64X64_OP_ARITH_TYPE (op,signed char) \ + INT64X64_OP_ARITH_TYPE (op,signed short) \ + INT64X64_OP_ARITH_TYPE (op,signed int) \ + INT64X64_OP_ARITH_TYPE (op,signed long int) \ + INT64X64_OP_ARITH_TYPE (op,signed long long int) \ + INT64X64_OP_ARITH_TYPE (op,unsigned char) \ + INT64X64_OP_ARITH_TYPE (op,unsigned short) \ + INT64X64_OP_ARITH_TYPE (op,unsigned int) \ + INT64X64_OP_ARITH_TYPE (op,unsigned long int) \ + INT64X64_OP_ARITH_TYPE (op,unsigned long long int) #define INT64X64_OP_CMP_TYPE(op,type) \ inline bool operator op (const int64x64_t &lhs, const type &rhs) \ @@ -59,25 +59,25 @@ namespace ns3 { } #define INT64X64_OP_CMP(op) \ - INT64X64_OP_CMP_TYPE(op,double) \ - INT64X64_OP_CMP_TYPE(op,signed int) \ - INT64X64_OP_CMP_TYPE(op,signed long int) \ - INT64X64_OP_CMP_TYPE(op,signed long long int) \ - INT64X64_OP_CMP_TYPE(op,unsigned int) \ - INT64X64_OP_CMP_TYPE(op,unsigned long int) \ - INT64X64_OP_CMP_TYPE(op,unsigned long long int) + INT64X64_OP_CMP_TYPE (op,double) \ + INT64X64_OP_CMP_TYPE (op,signed int) \ + INT64X64_OP_CMP_TYPE (op,signed long int) \ + INT64X64_OP_CMP_TYPE (op,signed long long int) \ + INT64X64_OP_CMP_TYPE (op,unsigned int) \ + INT64X64_OP_CMP_TYPE (op,unsigned long int) \ + INT64X64_OP_CMP_TYPE (op,unsigned long long int) -INT64X64_OP_ARITH(+) -INT64X64_OP_ARITH(-) -INT64X64_OP_ARITH(*) -INT64X64_OP_ARITH(/) -INT64X64_OP_CMP(==) -INT64X64_OP_CMP(!=) -INT64X64_OP_CMP(<) -INT64X64_OP_CMP(<=) -INT64X64_OP_CMP(>) -INT64X64_OP_CMP(>=) +INT64X64_OP_ARITH (+) +INT64X64_OP_ARITH (-) +INT64X64_OP_ARITH (*) +INT64X64_OP_ARITH (/) +INT64X64_OP_CMP (==) +INT64X64_OP_CMP (!=) +INT64X64_OP_CMP (<) +INT64X64_OP_CMP (<=) +INT64X64_OP_CMP (>) +INT64X64_OP_CMP (>=) std::ostream &operator << (std::ostream &os, const int64x64_t &val); std::istream &operator >> (std::istream &is, int64x64_t &val); diff --git a/src/core/model/integer.h b/src/core/model/integer.h index 2bb8125a9..98ddb63ec 100644 --- a/src/core/model/integer.h +++ b/src/core/model/integer.h @@ -42,8 +42,8 @@ namespace ns3 { * int, etc. */ -ATTRIBUTE_VALUE_DEFINE_WITH_NAME(int64_t, Integer); -ATTRIBUTE_ACCESSOR_DEFINE(Integer); +ATTRIBUTE_VALUE_DEFINE_WITH_NAME (int64_t, Integer); +ATTRIBUTE_ACCESSOR_DEFINE (Integer); template Ptr MakeIntegerChecker (void); diff --git a/src/core/model/log.cc b/src/core/model/log.cc index 828318396..5dffa822a 100644 --- a/src/core/model/log.cc +++ b/src/core/model/log.cc @@ -56,7 +56,7 @@ ComponentList *GetComponentList (void) PrintList::PrintList () { #ifdef HAVE_GETENV - char *envVar = getenv("NS_LOG"); + char *envVar = getenv ("NS_LOG"); if (envVar == 0) { return; @@ -102,7 +102,7 @@ void LogComponent::EnvVarCheck (char const * name) { #ifdef HAVE_GETENV - char *envVar = getenv("NS_LOG"); + char *envVar = getenv ("NS_LOG"); if (envVar == 0) { return; @@ -358,7 +358,7 @@ void LogSetTimePrinter (LogTimePrinter printer) { g_logTimePrinter = printer; } -LogTimePrinter LogGetTimePrinter(void) +LogTimePrinter LogGetTimePrinter (void) { return g_logTimePrinter; } @@ -367,7 +367,7 @@ void LogSetNodePrinter (LogNodePrinter printer) { g_logNodePrinter = printer; } -LogNodePrinter LogGetNodePrinter(void) +LogNodePrinter LogGetNodePrinter (void) { return g_logNodePrinter; } diff --git a/src/core/model/log.h b/src/core/model/log.h index f0184735c..944f76fec 100644 --- a/src/core/model/log.h +++ b/src/core/model/log.h @@ -219,7 +219,7 @@ void LogComponentDisableAll (enum LogLevel level); * Use \ref NS_LOG to output a message of level LOG_ERROR. */ #define NS_LOG_ERROR(msg) \ - NS_LOG(ns3::LOG_ERROR, msg) + NS_LOG (ns3::LOG_ERROR, msg) /** * \ingroup logging @@ -228,7 +228,7 @@ void LogComponentDisableAll (enum LogLevel level); * Use \ref NS_LOG to output a message of level LOG_WARN. */ #define NS_LOG_WARN(msg) \ - NS_LOG(ns3::LOG_WARN, msg) + NS_LOG (ns3::LOG_WARN, msg) /** * \ingroup logging @@ -237,7 +237,7 @@ void LogComponentDisableAll (enum LogLevel level); * Use \ref NS_LOG to output a message of level LOG_DEBUG. */ #define NS_LOG_DEBUG(msg) \ - NS_LOG(ns3::LOG_DEBUG, msg) + NS_LOG (ns3::LOG_DEBUG, msg) /** * \ingroup logging @@ -246,7 +246,7 @@ void LogComponentDisableAll (enum LogLevel level); * Use \ref NS_LOG to output a message of level LOG_INFO. */ #define NS_LOG_INFO(msg) \ - NS_LOG(ns3::LOG_INFO, msg) + NS_LOG (ns3::LOG_INFO, msg) /** * \ingroup logging @@ -308,7 +308,7 @@ void LogComponentDisableAll (enum LogLevel level); * Use \ref NS_LOG to output a message of level LOG_LOGIC */ #define NS_LOG_LOGIC(msg) \ - NS_LOG(ns3::LOG_LOGIC, msg) + NS_LOG (ns3::LOG_LOGIC, msg) /** * \ingroup logging @@ -353,10 +353,10 @@ typedef void (*LogTimePrinter)(std::ostream &os); typedef void (*LogNodePrinter)(std::ostream &os); void LogSetTimePrinter (LogTimePrinter); -LogTimePrinter LogGetTimePrinter(void); +LogTimePrinter LogGetTimePrinter (void); void LogSetNodePrinter (LogNodePrinter); -LogNodePrinter LogGetNodePrinter(void); +LogNodePrinter LogGetNodePrinter (void); class LogComponent { diff --git a/src/core/model/names.cc b/src/core/model/names.cc index ed901464c..8fc59627a 100644 --- a/src/core/model/names.cc +++ b/src/core/model/names.cc @@ -254,7 +254,7 @@ NamesPriv::Add (Ptr context, std::string name, Ptr object) return false; } - NameNode *newNode = new NameNode(node, name, object); + NameNode *newNode = new NameNode (node, name, object); node->m_nameMap[name] = newNode; m_objectMap[object] = newNode; @@ -498,7 +498,7 @@ NamesPriv::Find (std::string path) // specified name. We need to "recurse" when we find this segment. // offset = remaining.find ("/"); - std::string segment = remaining.substr(0, offset); + std::string segment = remaining.substr (0, offset); std::map::iterator i = node->m_nameMap.find (segment); if (i == node->m_nameMap.end ()) diff --git a/src/core/model/nstime.h b/src/core/model/nstime.h index 61125d6d1..7979226a6 100644 --- a/src/core/model/nstime.h +++ b/src/core/model/nstime.h @@ -175,7 +175,7 @@ public: : m_data (o.m_data) {} explicit inline Time (double v) - : m_data (lround(v)) + : m_data (lround (v)) {} explicit inline Time (int v) : m_data (v) diff --git a/src/core/model/object.h b/src/core/model/object.h index f168872ed..f6b38abae 100644 --- a/src/core/model/object.h +++ b/src/core/model/object.h @@ -440,7 +440,7 @@ template Ptr CompleteConstruct (T *p) { p->SetTypeId (T::GetTypeId ()); - p->Object::Construct (AttributeList()); + p->Object::Construct (AttributeList ()); return Ptr (p, false); } template diff --git a/src/core/model/ptr.h b/src/core/model/ptr.h index e47beb062..0dbbef776 100644 --- a/src/core/model/ptr.h +++ b/src/core/model/ptr.h @@ -453,7 +453,7 @@ Ptr::~Ptr () { if (m_ptr != 0) { - m_ptr->Unref(); + m_ptr->Unref (); } } @@ -467,7 +467,7 @@ Ptr::operator = (Ptr const& o) } if (m_ptr != 0) { - m_ptr->Unref(); + m_ptr->Unref (); } m_ptr = o.m_ptr; Acquire (); diff --git a/src/core/model/rng-stream.cc b/src/core/model/rng-stream.cc index 1afe972ca..96f7287bb 100644 --- a/src/core/model/rng-stream.cc +++ b/src/core/model/rng-stream.cc @@ -250,13 +250,13 @@ double RngStream::U01 () double RngStream::U01d () { double u; - u = U01(); + u = U01 (); if (anti) { // Don't forget that U01() returns 1 - u in the antithetic case - u += (U01() - 1.0) * fact; + u += (U01 () - 1.0) * fact; return (u < 0.0) ? u + 1.0 : u; } else { - u += U01() * fact; + u += U01 () * fact; return (u < 1.0) ? u : (u - 1.0); } } @@ -361,7 +361,7 @@ RngStream::RngStream(const RngStream& r) } -void RngStream::InitializeStream() +void RngStream::InitializeStream () { // Moved from the RngStream constructor above to allow seeding // AFTER the global package seed has been set in the Random // object constructor. @@ -405,8 +405,8 @@ void RngStream::ResetStartSubstream () // void RngStream::ResetNextSubstream () { - MatVecModM(A1p76, Bg, Bg, m1); - MatVecModM(A2p76, &Bg[3], &Bg[3], m2); + MatVecModM (A1p76, Bg, Bg, m1); + MatVecModM (A2p76, &Bg[3], &Bg[3], m2); for (int i = 0; i < 6; ++i) Cg[i] = Bg[i]; } @@ -418,8 +418,8 @@ void RngStream::ResetNthSubstream (uint32_t N) { if(N==0) return; for(uint32_t i=0; i std::ostream& operator << (std::ostream& os, const TracedValue& rhs) { - return os< diff --git a/src/core/model/uinteger.cc b/src/core/model/uinteger.cc index 86eba69a4..7d4548a61 100644 --- a/src/core/model/uinteger.cc +++ b/src/core/model/uinteger.cc @@ -23,7 +23,7 @@ namespace ns3 { -ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME(uint64_t,Uinteger); +ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME (uint64_t,Uinteger); namespace internal { diff --git a/src/core/model/unix-fd-reader.cc b/src/core/model/unix-fd-reader.cc index f992b2ebc..e5a6ae413 100644 --- a/src/core/model/unix-fd-reader.cc +++ b/src/core/model/unix-fd-reader.cc @@ -63,12 +63,12 @@ void FdReader::Start (int fd, Callback readCallback) } // make the read end non-blocking - tmp = fcntl(m_evpipe[0], F_GETFL); + tmp = fcntl (m_evpipe[0], F_GETFL); if (tmp == -1) { NS_FATAL_ERROR ("fcntl() failed: " << strerror (errno)); } - if (fcntl(m_evpipe[0], F_SETFL, tmp | O_NONBLOCK) == -1) + if (fcntl (m_evpipe[0], F_SETFL, tmp | O_NONBLOCK) == -1) { NS_FATAL_ERROR ("fcntl() failed: " << strerror (errno)); } diff --git a/src/core/model/unix-system-condition.cc b/src/core/model/unix-system-condition.cc index 70ace4583..3f5c40791 100644 --- a/src/core/model/unix-system-condition.cc +++ b/src/core/model/unix-system-condition.cc @@ -137,7 +137,7 @@ SystemConditionPrivate::TimedWait (uint64_t ns) ts.tv_nsec = ns % NS_PER_SEC; struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday (&tv, NULL); ts.tv_sec += tv.tv_sec; ts.tv_nsec += tv.tv_usec * 1000; diff --git a/src/core/model/unix-system-mutex.cc b/src/core/model/unix-system-mutex.cc index e088b4a47..d99187101 100644 --- a/src/core/model/unix-system-mutex.cc +++ b/src/core/model/unix-system-mutex.cc @@ -79,7 +79,7 @@ SystemMutexPrivate::Lock (void) { NS_FATAL_ERROR ("SystemMutexPrivate::Lock()" "pthread_mutex_lock failed: " << rc << " = \"" << - strerror(rc) << "\""); + strerror (rc) << "\""); } } @@ -93,7 +93,7 @@ SystemMutexPrivate::Unlock (void) { NS_FATAL_ERROR ("SystemMutexPrivate::Unlock()" "pthread_mutex_unlock failed: " << rc << " = \"" << - strerror(rc) << "\""); + strerror (rc) << "\""); } } @@ -110,21 +110,21 @@ SystemMutex::~SystemMutex() } void -SystemMutex::Lock() +SystemMutex::Lock () { NS_LOG_FUNCTION_NOARGS (); m_priv->Lock (); } void -SystemMutex::Unlock() +SystemMutex::Unlock () { NS_LOG_FUNCTION_NOARGS (); m_priv->Unlock (); } CriticalSection::CriticalSection (SystemMutex &mutex) - : m_mutex(mutex) + : m_mutex (mutex) { NS_LOG_FUNCTION_NOARGS (); m_mutex.Lock (); diff --git a/src/core/model/unix-system-thread.cc b/src/core/model/unix-system-thread.cc index e792125f5..0c7a8ffdf 100644 --- a/src/core/model/unix-system-thread.cc +++ b/src/core/model/unix-system-thread.cc @@ -85,7 +85,7 @@ SystemThreadImpl::Start (void) if (rc) { NS_FATAL_ERROR ("pthread_create failed: " << rc << "=\"" << - strerror(rc) << "\"."); + strerror (rc) << "\"."); } } @@ -99,7 +99,7 @@ SystemThreadImpl::Join (void) if (rc) { NS_FATAL_ERROR ("pthread_join failed: " << rc << "=\"" << - strerror(rc) << "\"."); + strerror (rc) << "\"."); } } diff --git a/src/core/model/vector.h b/src/core/model/vector.h index 434765e9e..1d5851dc9 100644 --- a/src/core/model/vector.h +++ b/src/core/model/vector.h @@ -118,7 +118,7 @@ std::istream &operator >> (std::istream &is, Vector2D &vector); typedef Vector3D Vector; typedef Vector3DValue VectorValue; typedef Vector3DChecker VectorChecker; -ATTRIBUTE_ACCESSOR_DEFINE(Vector); +ATTRIBUTE_ACCESSOR_DEFINE (Vector); Ptr MakeVectorChecker (void); } // namespace ns3 diff --git a/src/core/test/attribute-test-suite.cc b/src/core/test/attribute-test-suite.cc index 2adda8837..fb12c378e 100644 --- a/src/core/test/attribute-test-suite.cc +++ b/src/core/test/attribute-test-suite.cc @@ -326,7 +326,7 @@ AttributeTestCase::DoRun (void) // // Set the BooleanValue Attribute to true via SetAttributeFailSafe path. // - ok = p->SetAttributeFailSafe("TestBoolName", StringValue ("true")); + ok = p->SetAttributeFailSafe ("TestBoolName", StringValue ("true")); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() \"TestBoolName\" to true"); ok = CheckGetCodePaths (p, "TestBoolName", "true", BooleanValue (true)); @@ -335,7 +335,7 @@ AttributeTestCase::DoRun (void) // // Set the BooleanValue to false via SetAttributeFailSafe path. // - ok = p->SetAttributeFailSafe("TestBoolName", StringValue ("false")); + ok = p->SetAttributeFailSafe ("TestBoolName", StringValue ("false")); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() \"TestBoolName\" to false"); ok = CheckGetCodePaths (p, "TestBoolName", "false", BooleanValue (false)); @@ -365,7 +365,7 @@ AttributeTestCase::DoRun (void) // attribute is declared differently in the object. First make sure we can set // to true. // - ok = p->SetAttributeFailSafe("TestBoolA", StringValue ("true")); + ok = p->SetAttributeFailSafe ("TestBoolA", StringValue ("true")); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() a boolean value to true"); ok = CheckGetCodePaths (p, "TestBoolA", "true", BooleanValue (true)); @@ -374,7 +374,7 @@ AttributeTestCase::DoRun (void) // // Now Set the BooleanValue to false via the setter. // - ok = p->SetAttributeFailSafe("TestBoolA", StringValue ("false")); + ok = p->SetAttributeFailSafe ("TestBoolA", StringValue ("false")); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() a boolean value to false"); ok = CheckGetCodePaths (p, "TestBoolA", "false", BooleanValue (false)); @@ -400,7 +400,7 @@ AttributeTestCase::DoRun (void) // // Set the Attribute to a negative value through a StringValue. // - ok = p->SetAttributeFailSafe("TestInt16", StringValue ("-5")); + ok = p->SetAttributeFailSafe ("TestInt16", StringValue ("-5")); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via StringValue to -5"); ok = CheckGetCodePaths (p, "TestInt16", "-5", IntegerValue (-5)); @@ -409,7 +409,7 @@ AttributeTestCase::DoRun (void) // // Set the Attribute to a positive value through a StringValue. // - ok = p->SetAttributeFailSafe("TestInt16", StringValue ("+2")); + ok = p->SetAttributeFailSafe ("TestInt16", StringValue ("+2")); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via StringValue to +2"); ok = CheckGetCodePaths (p, "TestInt16", "2", IntegerValue (2)); @@ -418,7 +418,7 @@ AttributeTestCase::DoRun (void) // // Set the Attribute to the most negative value of the signed 16-bit range. // - ok = p->SetAttributeFailSafe("TestInt16", StringValue ("-32768")); + ok = p->SetAttributeFailSafe ("TestInt16", StringValue ("-32768")); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via StringValue to -32768"); ok = CheckGetCodePaths (p, "TestInt16", "-32768", IntegerValue (-32768)); @@ -428,7 +428,7 @@ AttributeTestCase::DoRun (void) // Try to set the Attribute past the most negative value of the signed 16-bit // range and make sure the underlying attribute is unchanged. // - ok = p->SetAttributeFailSafe("TestInt16", StringValue ("-32769")); + ok = p->SetAttributeFailSafe ("TestInt16", StringValue ("-32769")); NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via StringValue to -32769"); ok = CheckGetCodePaths (p, "TestInt16", "-32768", IntegerValue (-32768)); @@ -437,7 +437,7 @@ AttributeTestCase::DoRun (void) // // Set the Attribute to the most positive value of the signed 16-bit range. // - ok = p->SetAttributeFailSafe("TestInt16", StringValue ("32767")); + ok = p->SetAttributeFailSafe ("TestInt16", StringValue ("32767")); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via StringValue to 32767"); ok = CheckGetCodePaths (p, "TestInt16", "32767", IntegerValue (32767)); @@ -447,7 +447,7 @@ AttributeTestCase::DoRun (void) // Try to set the Attribute past the most positive value of the signed 16-bit // range and make sure the underlying attribute is unchanged. // - ok = p->SetAttributeFailSafe("TestInt16", StringValue ("32768")); + ok = p->SetAttributeFailSafe ("TestInt16", StringValue ("32768")); NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via StringValue to 32768"); ok = CheckGetCodePaths (p, "TestInt16", "32767", IntegerValue (32767)); @@ -457,7 +457,7 @@ AttributeTestCase::DoRun (void) // Attributes can have limits other than the intrinsic limits of the // underlying data types. These limits are specified in the Object. // - ok = p->SetAttributeFailSafe("TestInt16WithBounds", IntegerValue (10)); + ok = p->SetAttributeFailSafe ("TestInt16WithBounds", IntegerValue (10)); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via IntegerValue to 10"); ok = CheckGetCodePaths (p, "TestInt16WithBounds", "10", IntegerValue (10)); @@ -466,7 +466,7 @@ AttributeTestCase::DoRun (void) // // Set the Attribute past the positive limit. // - ok = p->SetAttributeFailSafe("TestInt16WithBounds", IntegerValue (11)); + ok = p->SetAttributeFailSafe ("TestInt16WithBounds", IntegerValue (11)); NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via IntegerValue to 11"); ok = CheckGetCodePaths (p, "TestInt16WithBounds", "10", IntegerValue (10)); @@ -475,7 +475,7 @@ AttributeTestCase::DoRun (void) // // Set the Attribute at the negative limit. // - ok = p->SetAttributeFailSafe("TestInt16WithBounds", IntegerValue (-5)); + ok = p->SetAttributeFailSafe ("TestInt16WithBounds", IntegerValue (-5)); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via IntegerValue to -5"); ok = CheckGetCodePaths (p, "TestInt16WithBounds", "-5", IntegerValue (-5)); @@ -484,7 +484,7 @@ AttributeTestCase::DoRun (void) // // Set the Attribute past the negative limit. // - ok = p->SetAttributeFailSafe("TestInt16WithBounds", IntegerValue (-6)); + ok = p->SetAttributeFailSafe ("TestInt16WithBounds", IntegerValue (-6)); NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via IntegerValue to -6"); ok = CheckGetCodePaths (p, "TestInt16WithBounds", "-5", IntegerValue (-5)); @@ -510,7 +510,7 @@ AttributeTestCase::DoRun (void) // // Set the Attribute to zero. // - ok = p->SetAttributeFailSafe("TestUint8", UintegerValue (0)); + ok = p->SetAttributeFailSafe ("TestUint8", UintegerValue (0)); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() to 0"); ok = CheckGetCodePaths (p, "TestUint8", "0", UintegerValue (0)); @@ -519,7 +519,7 @@ AttributeTestCase::DoRun (void) // // Set the Attribute to the most positive value of the unsigned 8-bit range. // - ok = p->SetAttributeFailSafe("TestUint8", UintegerValue (255)); + ok = p->SetAttributeFailSafe ("TestUint8", UintegerValue (255)); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() to 255"); ok = CheckGetCodePaths (p, "TestUint8", "255", UintegerValue (255)); @@ -529,7 +529,7 @@ AttributeTestCase::DoRun (void) // Try and set the Attribute past the most positive value of the unsigned // 8-bit range. // - ok = p->SetAttributeFailSafe("TestUint8", UintegerValue (256)); + ok = p->SetAttributeFailSafe ("TestUint8", UintegerValue (256)); NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() to 256"); ok = CheckGetCodePaths (p, "TestUint8", "255", UintegerValue (255)); @@ -539,7 +539,7 @@ AttributeTestCase::DoRun (void) // Set the Attribute to the most positive value of the unsigned 8-bit range // through a StringValue. // - ok = p->SetAttributeFailSafe("TestUint8", StringValue ("255")); + ok = p->SetAttributeFailSafe ("TestUint8", StringValue ("255")); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via StringValue to 255"); ok = CheckGetCodePaths (p, "TestUint8", "255", UintegerValue (255)); @@ -549,7 +549,7 @@ AttributeTestCase::DoRun (void) // Try and set the Attribute past the most positive value of the unsigned // 8-bit range through a StringValue. // - ok = p->SetAttributeFailSafe("TestUint8", StringValue ("256")); + ok = p->SetAttributeFailSafe ("TestUint8", StringValue ("256")); NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via StringValue to 256"); ok = CheckGetCodePaths (p, "TestUint8", "255", UintegerValue (255)); @@ -558,7 +558,7 @@ AttributeTestCase::DoRun (void) // // Try to set the Attribute to a negative StringValue. // - ok = p->SetAttributeFailSafe("TestUint8", StringValue ("-1")); + ok = p->SetAttributeFailSafe ("TestUint8", StringValue ("-1")); NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via StringValue to -1"); } @@ -581,7 +581,7 @@ AttributeTestCase::DoRun (void) // // Set the Attribute. // - ok = p->SetAttributeFailSafe("TestFloat", DoubleValue ((float)2.3)); + ok = p->SetAttributeFailSafe ("TestFloat", DoubleValue ((float)2.3)); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() to 2.3"); ok = CheckGetCodePaths (p, "TestFloat", "2.3", DoubleValue ((float)2.3)); @@ -607,7 +607,7 @@ AttributeTestCase::DoRun (void) // // Set the Attribute using the EnumValue type. // - ok = p->SetAttributeFailSafe("TestEnum", EnumValue (AttributeObjectTest::TEST_C)); + ok = p->SetAttributeFailSafe ("TestEnum", EnumValue (AttributeObjectTest::TEST_C)); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() to TEST_C"); ok = CheckGetCodePaths (p, "TestEnum", "TestC", EnumValue (AttributeObjectTest::TEST_C)); @@ -616,7 +616,7 @@ AttributeTestCase::DoRun (void) // // Set the Attribute using the StringValue type. // - ok = p->SetAttributeFailSafe("TestEnum", StringValue ("TestB")); + ok = p->SetAttributeFailSafe ("TestEnum", StringValue ("TestB")); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() to TEST_B"); ok = CheckGetCodePaths (p, "TestEnum", "TestB", EnumValue (AttributeObjectTest::TEST_B)); @@ -626,7 +626,7 @@ AttributeTestCase::DoRun (void) // Try to set the Attribute to a bogus enum using the StringValue type and // make sure the underlying value doesn't change. // - ok = p->SetAttributeFailSafe("TestEnum", StringValue ("TestD")); + ok = p->SetAttributeFailSafe ("TestEnum", StringValue ("TestD")); NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() to TEST_D"); // ok = CheckGetCodePaths (p, "TestEnum", "TestB", EnumValue (AttributeObjectTest::TEST_B)); @@ -636,7 +636,7 @@ AttributeTestCase::DoRun (void) // Try to set the Attribute to a bogus enum using an integer implicit conversion // and make sure the underlying value doesn't change. // - ok = p->SetAttributeFailSafe("TestEnum", EnumValue (5)); + ok = p->SetAttributeFailSafe ("TestEnum", EnumValue (5)); NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() to 5"); ok = CheckGetCodePaths (p, "TestEnum", "TestB", EnumValue (AttributeObjectTest::TEST_B)); @@ -655,13 +655,13 @@ AttributeTestCase::DoRun (void) // // Try to set a UniformVariable // - ok = p->SetAttributeFailSafe("TestRandom", RandomVariableValue (UniformVariable (0., 1.))); + ok = p->SetAttributeFailSafe ("TestRandom", RandomVariableValue (UniformVariable (0., 1.))); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() a UniformVariable"); // // Try to set a ConstantVariable // - ok = p->SetAttributeFailSafe("TestRandom", RandomVariableValue (ConstantVariable (10.))); + ok = p->SetAttributeFailSafe ("TestRandom", RandomVariableValue (ConstantVariable (10.))); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() a UniformVariable"); } @@ -770,7 +770,7 @@ IntegerTraceSourceAttributeTestCase::DoRun (void) // // Set the Attribute to a positive value through an IntegerValue. // - ok = p->SetAttributeFailSafe("IntegerTraceSource1", IntegerValue (5)); + ok = p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (5)); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via IntegerValue to 5"); p->GetAttribute ("IntegerTraceSource1", iv); @@ -779,16 +779,16 @@ IntegerTraceSourceAttributeTestCase::DoRun (void) // // Limits should work. // - ok = p->SetAttributeFailSafe("IntegerTraceSource1", IntegerValue (127)); + ok = p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (127)); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via IntegerValue to 127"); - ok = p->SetAttributeFailSafe("IntegerTraceSource1", IntegerValue (128)); + ok = p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (128)); NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via IntegerValue to 128"); - ok = p->SetAttributeFailSafe("IntegerTraceSource1", IntegerValue (-128)); + ok = p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (-128)); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via IntegerValue to -128"); - ok = p->SetAttributeFailSafe("IntegerTraceSource1", IntegerValue (-129)); + ok = p->SetAttributeFailSafe ("IntegerTraceSource1", IntegerValue (-129)); NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via IntegerValue to -129"); // @@ -801,7 +801,7 @@ IntegerTraceSourceAttributeTestCase::DoRun (void) // // Set the Attribute to a positive value through an IntegerValue. // - ok = p->SetAttributeFailSafe("IntegerTraceSource2", IntegerValue (5)); + ok = p->SetAttributeFailSafe ("IntegerTraceSource2", IntegerValue (5)); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via IntegerValue to 5"); p->GetAttribute ("IntegerTraceSource2", iv); @@ -810,16 +810,16 @@ IntegerTraceSourceAttributeTestCase::DoRun (void) // // Limits should work. // - ok = p->SetAttributeFailSafe("IntegerTraceSource2", IntegerValue (127)); + ok = p->SetAttributeFailSafe ("IntegerTraceSource2", IntegerValue (127)); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via IntegerValue to 127"); - ok = p->SetAttributeFailSafe("IntegerTraceSource2", IntegerValue (128)); + ok = p->SetAttributeFailSafe ("IntegerTraceSource2", IntegerValue (128)); NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via IntegerValue to 128"); - ok = p->SetAttributeFailSafe("IntegerTraceSource2", IntegerValue (-128)); + ok = p->SetAttributeFailSafe ("IntegerTraceSource2", IntegerValue (-128)); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() via IntegerValue to -128"); - ok = p->SetAttributeFailSafe("IntegerTraceSource2", IntegerValue (-129)); + ok = p->SetAttributeFailSafe ("IntegerTraceSource2", IntegerValue (-129)); NS_TEST_ASSERT_MSG_EQ (ok, false, "Unexpectedly could SetAttributeFailSafe() via IntegerValue to -129"); } @@ -1016,7 +1016,7 @@ PointerAttributeTestCase::DoRun (void) // to that object. We can then set the PointerValue Attribute to that Ptr. // derived = Create (); - ok = p->SetAttributeFailSafe("Pointer", PointerValue (derived)); + ok = p->SetAttributeFailSafe ("Pointer", PointerValue (derived)); NS_TEST_ASSERT_MSG_EQ (ok, true, "Could not SetAttributeFailSafe() a PointerValue of the correct type"); // diff --git a/src/core/test/int64x64-test-suite.cc b/src/core/test/int64x64-test-suite.cc index 8bfacb4ca..a724f7748 100644 --- a/src/core/test/int64x64-test-suite.cc +++ b/src/core/test/int64x64-test-suite.cc @@ -132,43 +132,43 @@ Int64x64ArithmeticTestCase::DoRun (void) { int64x64_t a, b; - CHECK_EXPECTED (V(1) - V(1), 0); - CHECK_EXPECTED (V(1) - V(2), -1); - CHECK_EXPECTED (V(1) - V(3), -2); - CHECK_EXPECTED (V(1) - V(-1), 2); - CHECK_EXPECTED (V(1) - V(-2), 3); - CHECK_EXPECTED (V(-3) - V(-4), 1); - CHECK_EXPECTED (V(-2) - V(3), -5); - CHECK_EXPECTED (V(1) + V(2), 3); - CHECK_EXPECTED (V(1) + V(-3), -2); - CHECK_EXPECTED (V(0) + V(0), 0); - CHECK_EXPECTED (V(0) * V(0), 0); - CHECK_EXPECTED (V(0) * V(1), 0); - CHECK_EXPECTED (V(0) * V(-1), 0); - CHECK_EXPECTED (V(1) * V(0), 0); - CHECK_EXPECTED (V(1) * V(1), 1); - CHECK_EXPECTED (V(1) * V(-1), -1); - CHECK_EXPECTED (V(-1) * V(-1), 1); - CHECK_EXPECTED (V(0) * V(1), 0); - CHECK_EXPECTED (V(0) * V(-1), 0); - CHECK_EXPECTED (V(-1) * V(1), -1); + CHECK_EXPECTED (V (1) - V (1), 0); + CHECK_EXPECTED (V (1) - V (2), -1); + CHECK_EXPECTED (V (1) - V (3), -2); + CHECK_EXPECTED (V (1) - V (-1), 2); + CHECK_EXPECTED (V (1) - V (-2), 3); + CHECK_EXPECTED (V (-3) - V (-4), 1); + CHECK_EXPECTED (V (-2) - V (3), -5); + CHECK_EXPECTED (V (1) + V (2), 3); + CHECK_EXPECTED (V (1) + V (-3), -2); + CHECK_EXPECTED (V (0) + V (0), 0); + CHECK_EXPECTED (V (0) * V (0), 0); + CHECK_EXPECTED (V (0) * V (1), 0); + CHECK_EXPECTED (V (0) * V (-1), 0); + CHECK_EXPECTED (V (1) * V (0), 0); + CHECK_EXPECTED (V (1) * V (1), 1); + CHECK_EXPECTED (V (1) * V (-1), -1); + CHECK_EXPECTED (V (-1) * V (-1), 1); + CHECK_EXPECTED (V (0) * V (1), 0); + CHECK_EXPECTED (V (0) * V (-1), 0); + CHECK_EXPECTED (V (-1) * V (1), -1); - CHECK_EXPECTED (V (2) * V(3) / V(3), 2); + CHECK_EXPECTED (V (2) * V (3) / V (3), 2); // Below, the division loses precision because 2/3 is not // representable exactly in 64.64 integers. So, we got // something super close but the final rounding kills us. - a = V(2); - b = V(3); + a = V (2); + b = V (3); a /= b; a *= b; - CHECK_EXPECTED (V(2) / V(3) * V(3), 1); + CHECK_EXPECTED (V (2) / V (3) * V (3), 1); // The example below shows that we really do not lose // much precision internally: it is almost always the // final conversion which loses precision. - CHECK_EXPECTED (V (2000000000) / V(3) * V(3), 1999999999); + CHECK_EXPECTED (V (2000000000) / V (3) * V (3), 1999999999); } class Int64x64Bug455TestCase : public TestCase @@ -248,12 +248,12 @@ void Int64x64CompareTestCase::DoRun (void) { - NS_TEST_ASSERT_MSG_EQ ((V(-1) < V(1)), true, "a is smaller than b"); - NS_TEST_ASSERT_MSG_EQ ((V(-1) > V(-2)), true, "a is bigger than b"); - NS_TEST_ASSERT_MSG_EQ ((V(-1) == V(-1)), true, "a is equal to b"); + NS_TEST_ASSERT_MSG_EQ ((V (-1) < V (1)), true, "a is smaller than b"); + NS_TEST_ASSERT_MSG_EQ ((V (-1) > V (-2)), true, "a is bigger than b"); + NS_TEST_ASSERT_MSG_EQ ((V (-1) == V (-1)), true, "a is equal to b"); - NS_TEST_ASSERT_MSG_EQ ((V(1) > V(-1)), true, "a is bigger than b"); - NS_TEST_ASSERT_MSG_EQ ((V(1) < V(2)), true, "a is smaller than b"); + NS_TEST_ASSERT_MSG_EQ ((V (1) > V (-1)), true, "a is bigger than b"); + NS_TEST_ASSERT_MSG_EQ ((V (1) < V (2)), true, "a is smaller than b"); } class Int64x64InvertTestCase : public TestCase @@ -284,7 +284,7 @@ Int64x64InvertTestCase::DoRun (void) NS_TEST_ASSERT_MSG_EQ (c.GetHigh (), 0, \ "1 * 1/x should be 0 for x=" << factor); \ int64x64_t d = V (1); \ - d /= (V(factor)); \ + d /= (V (factor)); \ NS_TEST_ASSERT_MSG_EQ (d.GetDouble (), c.GetDouble (), \ "1 * 1/x should be equal to 1/x for x=" << factor); \ int64x64_t e = V (-factor); \ @@ -293,28 +293,28 @@ Int64x64InvertTestCase::DoRun (void) "-x * 1/x should be -1 for x=" << factor); \ } \ while(false) - TEST(2); - TEST(3); - TEST(4); - TEST(5); - TEST(6); - TEST(10); - TEST(99); - TEST(100); - TEST(1000); - TEST(10000); - TEST(100000); - TEST(100000); - TEST(1000000); - TEST(10000000); - TEST(100000000); - TEST(1000000000); - TEST(10000000000LL); - TEST(100000000000LL); - TEST(1000000000000LL); - TEST(10000000000000LL); - TEST(100000000000000LL); - TEST(1000000000000000LL); + TEST (2); + TEST (3); + TEST (4); + TEST (5); + TEST (6); + TEST (10); + TEST (99); + TEST (100); + TEST (1000); + TEST (10000); + TEST (100000); + TEST (100000); + TEST (1000000); + TEST (10000000); + TEST (100000000); + TEST (1000000000); + TEST (10000000000LL); + TEST (100000000000LL); + TEST (1000000000000LL); + TEST (10000000000000LL); + TEST (100000000000000LL); + TEST (1000000000000000LL); #undef TEST } diff --git a/src/core/test/simulator-test-suite.cc b/src/core/test/simulator-test-suite.cc index 0206c6477..ae4da46ff 100644 --- a/src/core/test/simulator-test-suite.cc +++ b/src/core/test/simulator-test-suite.cc @@ -38,7 +38,7 @@ public: void D (int d); void foo0 (void); uint64_t NowUs (void); - void destroy(void); + void destroy (void); bool m_b; bool m_a; bool m_c; @@ -103,7 +103,7 @@ SimulatorEventsTestCase::D (int d) } void -SimulatorEventsTestCase::foo0(void) +SimulatorEventsTestCase::foo0 (void) {} void diff --git a/src/csma-layout/examples/csma-star.cc b/src/csma-layout/examples/csma-star.cc index 1b0e6a280..b92271589 100644 --- a/src/csma-layout/examples/csma-star.cc +++ b/src/csma-layout/examples/csma-star.cc @@ -63,7 +63,7 @@ main (int argc, char *argv[]) uint32_t nSpokes = 7; CommandLine cmd; - cmd.AddValue("nSpokes", "Number of spoke nodes to place in the star", nSpokes); + cmd.AddValue ("nSpokes", "Number of spoke nodes to place in the star", nSpokes); cmd.Parse (argc, argv); NS_LOG_INFO ("Build star topology."); diff --git a/src/csma-layout/model/csma-star-helper.cc b/src/csma-layout/model/csma-star-helper.cc index b4089f3a1..dff12299a 100644 --- a/src/csma-layout/model/csma-star-helper.cc +++ b/src/csma-layout/model/csma-star-helper.cc @@ -24,7 +24,7 @@ #include "ns3/point-to-point-net-device.h" #include "ns3/vector.h" -NS_LOG_COMPONENT_DEFINE("CsmaStarHelper"); +NS_LOG_COMPONENT_DEFINE ("CsmaStarHelper"); namespace ns3 { diff --git a/src/csma/examples/csma-broadcast.cc b/src/csma/examples/csma-broadcast.cc index 42aef40a2..8ca3bfd96 100644 --- a/src/csma/examples/csma-broadcast.cc +++ b/src/csma/examples/csma-broadcast.cc @@ -65,8 +65,8 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Build Topology."); CsmaHelper csma; - csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate(5000000))); - csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds(2))); + csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000))); + csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); NetDeviceContainer n0 = csma.Install (c0); NetDeviceContainer n1 = csma.Install (c1); diff --git a/src/csma/examples/csma-multicast.cc b/src/csma/examples/csma-multicast.cc index 9f11636fb..e2ef4f3ec 100644 --- a/src/csma/examples/csma-multicast.cc +++ b/src/csma/examples/csma-multicast.cc @@ -119,7 +119,7 @@ main (int argc, char *argv[]) // 2) Set up a default multicast route on the sender n0 Ptr sender = c.Get (0); - Ptr senderIf = nd0.Get(0); + Ptr senderIf = nd0.Get (0); multicast.SetDefaultMulticastRoute (sender, senderIf); // @@ -144,12 +144,12 @@ main (int argc, char *argv[]) // // Tell the application when to start and stop. // - srcC.Start(Seconds(1.)); - srcC.Stop (Seconds(10.)); + srcC.Start (Seconds (1.)); + srcC.Stop (Seconds (10.)); // Create an optional packet sink to receive these packets PacketSinkHelper sink ("ns3::UdpSocketFactory", - InetSocketAddress (Ipv4Address::GetAny(), multicastPort)); + InetSocketAddress (Ipv4Address::GetAny (), multicastPort)); ApplicationContainer sinkC = sink.Install (c1.Get (2)); // Node n4 // Start the sink diff --git a/src/csma/examples/csma-one-subnet.cc b/src/csma/examples/csma-one-subnet.cc index 55efcc6f5..511e450e2 100644 --- a/src/csma/examples/csma-one-subnet.cc +++ b/src/csma/examples/csma-one-subnet.cc @@ -109,7 +109,7 @@ main (int argc, char *argv[]) onoff.SetAttribute ("Remote", AddressValue (InetSocketAddress (interfaces.GetAddress (0), port))); app = onoff.Install (nodes.Get (3)); - app.Start(Seconds (1.1)); + app.Start (Seconds (1.1)); app.Stop (Seconds (10.0)); app = sink.Install (nodes.Get (0)); diff --git a/src/csma/examples/csma-packet-socket.cc b/src/csma/examples/csma-packet-socket.cc index 2e8b4ba76..de2ba371a 100644 --- a/src/csma/examples/csma-packet-socket.cc +++ b/src/csma/examples/csma-packet-socket.cc @@ -72,8 +72,8 @@ main (int argc, char *argv[]) // create the shared medium used by all csma devices. NS_LOG_INFO ("Create channels."); Ptr channel = CreateObjectWithAttributes ( - "DataRate", DataRateValue (DataRate(5000000)), - "Delay", TimeValue (MilliSeconds(2))); + "DataRate", DataRateValue (DataRate (5000000)), + "Delay", TimeValue (MilliSeconds (2))); // use a helper function to connect our nodes to the shared channel. NS_LOG_INFO ("Build Topology."); @@ -84,7 +84,7 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Create Applications."); // Create the OnOff application to send raw datagrams PacketSocketAddress socket; - socket.SetSingleDevice(devs.Get (0)->GetIfIndex ()); + socket.SetSingleDevice (devs.Get (0)->GetIfIndex ()); socket.SetPhysicalAddress (devs.Get (1)->GetAddress ()); socket.SetProtocol (2); OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket)); diff --git a/src/csma/model/backoff.cc b/src/csma/model/backoff.cc index 00939bf48..a6f8d4331 100644 --- a/src/csma/model/backoff.cc +++ b/src/csma/model/backoff.cc @@ -24,13 +24,13 @@ namespace ns3 { Backoff::Backoff () { - m_slotTime = MicroSeconds(1); + m_slotTime = MicroSeconds (1); m_minSlots = 1; m_maxSlots = 1000; m_ceiling = 10; m_maxRetries = 1000; - ResetBackoffTime(); + ResetBackoffTime (); } Backoff::Backoff(Time slotTime, uint32_t minSlots, uint32_t maxSlots, uint32_t ceiling, uint32_t maxRetries) @@ -64,7 +64,7 @@ Backoff::GetBackoffTime (void) maxSlot = m_maxSlots; } - uint32_t backoffSlots = (uint32_t)m_rng.GetValue(minSlot, maxSlot); + uint32_t backoffSlots = (uint32_t)m_rng.GetValue (minSlot, maxSlot); Time backoff = Time (backoffSlots * m_slotTime); return backoff; diff --git a/src/csma/model/backoff.h b/src/csma/model/backoff.h index 88528142a..8639b910a 100644 --- a/src/csma/model/backoff.h +++ b/src/csma/model/backoff.h @@ -68,7 +68,7 @@ public: * \return The amount of time that the net device should wait before * trying to retransmit the packet */ - Time GetBackoffTime(); + Time GetBackoffTime (); /** * Indicates to the backoff object that the last packet was diff --git a/src/csma/model/csma-channel.cc b/src/csma/model/csma-channel.cc index b59359036..8291f2360 100644 --- a/src/csma/model/csma-channel.cc +++ b/src/csma/model/csma-channel.cc @@ -55,7 +55,7 @@ CsmaChannel::CsmaChannel () { NS_LOG_FUNCTION_NOARGS (); m_state = IDLE; - m_deviceList.clear(); + m_deviceList.clear (); } int32_t @@ -77,7 +77,7 @@ CsmaChannel::Reattach (Ptr device) NS_ASSERT (device != 0); std::vector::iterator it; - for (it = m_deviceList.begin (); it < m_deviceList.end( ); it++) + for (it = m_deviceList.begin (); it < m_deviceList.end ( ); it++) { if (it->devicePtr == device) { @@ -174,7 +174,7 @@ CsmaChannel::TransmitStart (Ptr p, uint32_t srcId) return false; } - if (!IsActive(srcId)) + if (!IsActive (srcId)) { NS_LOG_ERROR ("CsmaChannel::TransmitStart(): Seclected source is not currently attached to network"); return false; @@ -188,13 +188,13 @@ CsmaChannel::TransmitStart (Ptr p, uint32_t srcId) } bool -CsmaChannel::IsActive(uint32_t deviceId) +CsmaChannel::IsActive (uint32_t deviceId) { return (m_deviceList[deviceId].active); } bool -CsmaChannel::TransmitEnd() +CsmaChannel::TransmitEnd () { NS_LOG_FUNCTION (this << m_currentPkt << m_currentSrc); NS_LOG_INFO ("UID is " << m_currentPkt->GetUid () << ")"); @@ -217,7 +217,7 @@ CsmaChannel::TransmitEnd() std::vector::iterator it; uint32_t devId = 0; - for (it = m_deviceList.begin (); it < m_deviceList.end(); it++) + for (it = m_deviceList.begin (); it < m_deviceList.end (); it++) { if (it->IsActive ()) { @@ -237,7 +237,7 @@ CsmaChannel::TransmitEnd() } void -CsmaChannel::PropagationCompleteEvent() +CsmaChannel::PropagationCompleteEvent () { NS_LOG_FUNCTION (this << m_currentPkt); NS_LOG_INFO ("UID is " << m_currentPkt->GetUid () << ")"); diff --git a/src/csma/model/csma-channel.h b/src/csma/model/csma-channel.h index 2c5131063..7e0f2c9bf 100644 --- a/src/csma/model/csma-channel.h +++ b/src/csma/model/csma-channel.h @@ -50,7 +50,7 @@ public: * \return If the net device pointed to by the devicePtr is active * and ready to RX/TX. */ - bool IsActive(); + bool IsActive (); }; /** @@ -130,7 +130,7 @@ public: * channel, false if the device is currently connected to the * channel or can't be found. */ - bool Reattach(uint32_t deviceId); + bool Reattach (uint32_t deviceId); /** * \brief Reattach a previously detached net device to the channel @@ -144,7 +144,7 @@ public: * channel, false if the device is currently connected to the * channel or can't be found. */ - bool Reattach(Ptr device); + bool Reattach (Ptr device); /** * \brief Start transmitting a packet over the channel diff --git a/src/csma/model/csma-net-device.cc b/src/csma/model/csma-net-device.cc index 3c26414aa..3d935f385 100644 --- a/src/csma/model/csma-net-device.cc +++ b/src/csma/model/csma-net-device.cc @@ -938,7 +938,7 @@ CsmaNetDevice::SendFrom (Ptr packet, const Address& src, const Address& // Place the packet to be sent on the send queue. Note that the // queue may fire a drop trace, but we will too. // - if (m_queue->Enqueue(packet) == false) + if (m_queue->Enqueue (packet) == false) { m_macTxDropTrace (packet); return false; @@ -996,7 +996,7 @@ Address CsmaNetDevice::GetMulticast (Ipv6Address addr) const { Mac48Address ad = Mac48Address::GetMulticast (addr); - NS_LOG_LOGIC("MAC IPv6 multicast address is " << ad); + NS_LOG_LOGIC ("MAC IPv6 multicast address is " << ad); return ad; } diff --git a/src/dsdv/model/dsdv-routing-protocol.cc b/src/dsdv/model/dsdv-routing-protocol.cc index aa5d424b5..99cbf593f 100644 --- a/src/dsdv/model/dsdv-routing-protocol.cc +++ b/src/dsdv/model/dsdv-routing-protocol.cc @@ -1138,8 +1138,8 @@ RoutingProtocol::GetSettlingTime (Ipv4Address address) { NS_LOG_DEBUG ("Route SettlingTime: " << mainrt.GetSettlingTime ().GetSeconds () << " and LifeTime:" << mainrt.GetLifeTime ().GetSeconds ()); - weightedTime = Time (m_weightedFactor * mainrt.GetSettlingTime ().GetSeconds() + (1.0 - m_weightedFactor) - * mainrt.GetLifeTime ().GetSeconds()); + weightedTime = Time (m_weightedFactor * mainrt.GetSettlingTime ().GetSeconds () + (1.0 - m_weightedFactor) + * mainrt.GetLifeTime ().GetSeconds ()); NS_LOG_DEBUG ("Calculated weightedTime:" << weightedTime.GetSeconds ()); return weightedTime; } diff --git a/src/emu/examples/emu-ping.cc b/src/emu/examples/emu-ping.cc index 66b7552f5..0dc54d699 100644 --- a/src/emu/examples/emu-ping.cc +++ b/src/emu/examples/emu-ping.cc @@ -83,8 +83,8 @@ main (int argc, char *argv[]) // command-line arguments // CommandLine cmd; - cmd.AddValue("deviceName", "Device name", deviceName); - cmd.AddValue("remote", "Remote IP address (dotted decimal only please)", remote); + cmd.AddValue ("deviceName", "Device name", deviceName); + cmd.AddValue ("remote", "Remote IP address (dotted decimal only please)", remote); cmd.Parse (argc, argv); Ipv4Address remoteIp (remote.c_str ()); diff --git a/src/emu/examples/emu-udp-echo.cc b/src/emu/examples/emu-udp-echo.cc index 71cfce218..b5fb08eec 100644 --- a/src/emu/examples/emu-udp-echo.cc +++ b/src/emu/examples/emu-udp-echo.cc @@ -83,9 +83,9 @@ main (int argc, char *argv[]) // arguments // CommandLine cmd; - cmd.AddValue("deviceName", "device name", deviceName); - cmd.AddValue("encapsulationMode", "encapsulation mode of emu device (\"Dix\" [default] or \"Llc\")", encapMode); - cmd.AddValue("nNodes", "number of nodes to create (>= 2)", nNodes); + cmd.AddValue ("deviceName", "device name", deviceName); + cmd.AddValue ("encapsulationMode", "encapsulation mode of emu device (\"Dix\" [default] or \"Llc\")", encapMode); + cmd.AddValue ("nNodes", "number of nodes to create (>= 2)", nNodes); cmd.Parse (argc, argv); @@ -130,7 +130,7 @@ main (int argc, char *argv[]) // NS_LOG_INFO ("Create Applications."); UdpEchoServerHelper server (9); - ApplicationContainer apps = server.Install (n.Get(1)); + ApplicationContainer apps = server.Install (n.Get (1)); apps.Start (Seconds (1.0)); apps.Stop (Seconds (10.0)); diff --git a/src/emu/model/emu-encode-decode.cc b/src/emu/model/emu-encode-decode.cc index d558f88d6..e79faac16 100644 --- a/src/emu/model/emu-encode-decode.cc +++ b/src/emu/model/emu-encode-decode.cc @@ -41,7 +41,7 @@ EmuBufferToString (uint8_t *buffer, uint32_t len) // Tell the stream to make hex characters, zero-filled // oss.setf (std::ios::hex, std::ios::basefield); - oss.fill('0'); + oss.fill ('0'); // // Loop through the buffer, separating the two-digit-wide hex bytes diff --git a/src/emu/model/emu-net-device.cc b/src/emu/model/emu-net-device.cc index de59412d5..ef4dd217d 100644 --- a/src/emu/model/emu-net-device.cc +++ b/src/emu/model/emu-net-device.cc @@ -208,7 +208,7 @@ EmuNetDevice::~EmuNetDevice () } void -EmuNetDevice::DoDispose() +EmuNetDevice::DoDispose () { NS_LOG_FUNCTION_NOARGS (); if (m_readThread != 0) @@ -334,7 +334,7 @@ EmuNetDevice::StartDevice (void) ll.sll_family = AF_PACKET; ll.sll_ifindex = m_sll_ifindex; - ll.sll_protocol = htons(ETH_P_ALL); + ll.sll_protocol = htons (ETH_P_ALL); NS_LOG_LOGIC ("Binding socket to interface"); @@ -344,7 +344,7 @@ EmuNetDevice::StartDevice (void) NS_FATAL_ERROR ("EmuNetDevice::StartDevice(): Can't bind to specified interface"); } - rc = ioctl(m_sock, SIOCGIFFLAGS, &ifr); + rc = ioctl (m_sock, SIOCGIFFLAGS, &ifr); if (rc == -1) { NS_FATAL_ERROR ("EmuNetDevice::StartDevice(): Can't get interface flags"); @@ -446,7 +446,7 @@ EmuNetDevice::CreateSocket (void) // // Now encode that socket name (family and path) as a string of hex digits // - std::string path = EmuBufferToString((uint8_t *)&un, len); + std::string path = EmuBufferToString ((uint8_t *)&un, len); NS_LOG_INFO ("Encoded Unix socket as \"" << path << "\""); // // Fork and exec the process to create our socket. If we're us (the parent) @@ -548,7 +548,7 @@ EmuNetDevice::CreateSocket (void) // so we call it "control." // size_t msg_size = sizeof(int); - char control[CMSG_SPACE(msg_size)]; + char control[CMSG_SPACE (msg_size)]; // // There is a msghdr that is used to minimize the number of parameters @@ -585,7 +585,7 @@ EmuNetDevice::CreateSocket (void) // one we're interested in. // struct cmsghdr *cmsg; - for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) + for (cmsg = CMSG_FIRSTHDR (&msg); cmsg != NULL; cmsg = CMSG_NXTHDR (&msg, cmsg)) { if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) @@ -660,7 +660,7 @@ EmuNetDevice::ForwardUp (uint8_t *buf, uint32_t len) // filter out packets we think are completely bogus, so we always check to see // that the packet is long enough to contain the header we want to remove. // - if (packet->GetSize() < header.GetSerializedSize()) + if (packet->GetSize () < header.GetSerializedSize ()) { m_phyRxDropTrace (originalPacket); return; @@ -689,7 +689,7 @@ EmuNetDevice::ForwardUp (uint8_t *buf, uint32_t len) // Check to see that the packet is long enough to possibly contain the // header we want to remove before just naively calling. // - if (packet->GetSize() < llc.GetSerializedSize()) + if (packet->GetSize () < llc.GetSerializedSize ()) { m_phyRxDropTrace (originalPacket); return; @@ -922,7 +922,7 @@ EmuNetDevice::SendFrom (Ptr packet, const Address &src, const Address &d ll.sll_family = AF_PACKET; ll.sll_ifindex = m_sll_ifindex; - ll.sll_protocol = htons(ETH_P_ALL); + ll.sll_protocol = htons (ETH_P_ALL); NS_LOG_LOGIC ("calling sendto"); @@ -936,7 +936,7 @@ EmuNetDevice::SendFrom (Ptr packet, const Address &src, const Address &d } void -EmuNetDevice::SetDataRate(DataRate bps) +EmuNetDevice::SetDataRate (DataRate bps) { NS_LOG_FUNCTION (this << bps); NS_FATAL_ERROR ("EmuNetDevice::SetDataRate(): Unable."); @@ -950,7 +950,7 @@ EmuNetDevice::SetQueue (Ptr q) } Ptr -EmuNetDevice::GetQueue(void) const +EmuNetDevice::GetQueue (void) const { NS_LOG_FUNCTION_NOARGS (); return m_queue; @@ -964,13 +964,13 @@ EmuNetDevice::NotifyLinkUp (void) } void -EmuNetDevice::SetIfIndex(const uint32_t index) +EmuNetDevice::SetIfIndex (const uint32_t index) { m_ifIndex = index; } uint32_t -EmuNetDevice::GetIfIndex(void) const +EmuNetDevice::GetIfIndex (void) const { return m_ifIndex; } @@ -1008,12 +1008,12 @@ EmuNetDevice::GetMtu (void) const { struct ifreq ifr; bzero (&ifr, sizeof (ifr)); - strcpy(ifr.ifr_name, m_deviceName.c_str ()); + strcpy (ifr.ifr_name, m_deviceName.c_str ()); - int32_t fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); + int32_t fd = socket (PF_INET, SOCK_DGRAM, IPPROTO_IP); - int32_t rc = ioctl(fd, SIOCGIFMTU, &ifr); + int32_t rc = ioctl (fd, SIOCGIFMTU, &ifr); if (rc == -1) { NS_FATAL_ERROR ("EmuNetDevice::GetMtu(): Can't ioctl SIOCGIFMTU"); @@ -1074,10 +1074,10 @@ EmuNetDevice::GetMulticast (Ipv4Address multicastGroup) const Address EmuNetDevice::GetMulticast (Ipv6Address addr) const { - NS_LOG_FUNCTION(this << addr); + NS_LOG_FUNCTION (this << addr); Mac48Address ad = Mac48Address::GetMulticast (addr); - NS_LOG_LOGIC("MAC IPv6 multicast address is " << ad); + NS_LOG_LOGIC ("MAC IPv6 multicast address is " << ad); return ad; } diff --git a/src/emu/model/emu-net-device.h b/src/emu/model/emu-net-device.h index f329894a6..15eb57592 100644 --- a/src/emu/model/emu-net-device.h +++ b/src/emu/model/emu-net-device.h @@ -110,14 +110,14 @@ public: * * @returns Ptr to the queue. */ - Ptr GetQueue(void) const; + Ptr GetQueue (void) const; // // Pure virtual methods inherited from NetDevice we must implement. // - virtual void SetIfIndex(const uint32_t index); - virtual uint32_t GetIfIndex(void) const; + virtual void SetIfIndex (const uint32_t index); + virtual uint32_t GetIfIndex (void) const; virtual Ptr GetChannel (void) const; @@ -181,9 +181,9 @@ public: */ virtual bool IsBridge (void) const; - virtual bool Send(Ptr packet, const Address &dest, uint16_t protocolNumber); + virtual bool Send (Ptr packet, const Address &dest, uint16_t protocolNumber); - virtual bool SendFrom(Ptr packet, const Address& source, const Address& dest, uint16_t protocolNumber); + virtual bool SendFrom (Ptr packet, const Address& source, const Address& dest, uint16_t protocolNumber); virtual Ptr GetNode (void) const; virtual void SetNode (Ptr node); @@ -265,7 +265,7 @@ private: * \return Returns true if the packet should be forwarded up the * protocol stack. */ - bool ProcessHeader(Ptr p, uint16_t& param); + bool ProcessHeader (Ptr p, uint16_t& param); /** * Start Sending a Packet Down the Wire. diff --git a/src/emu/model/emu-sock-creator.cc b/src/emu/model/emu-sock-creator.cc index b24f5d39d..f380c3145 100644 --- a/src/emu/model/emu-sock-creator.cc +++ b/src/emu/model/emu-sock-creator.cc @@ -56,7 +56,7 @@ static int gVerbose = 0; #define ABORT_IF(cond, msg, printErrno) \ if (cond) \ { \ - ABORT(msg, printErrno); \ + ABORT (msg, printErrno); \ } /** @@ -131,7 +131,7 @@ SendSocket (const char *path, int fd) // so we call it "control." // size_t msg_size = sizeof(int); - char control[CMSG_SPACE(msg_size)]; + char control[CMSG_SPACE (msg_size)]; // // There is a msghdr that is used to minimize the number of parameters @@ -165,10 +165,10 @@ SendSocket (const char *path, int fd) // the whole package we're sending. // struct cmsghdr *cmsg; - cmsg = CMSG_FIRSTHDR(&msg); + cmsg = CMSG_FIRSTHDR (&msg); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; - cmsg->cmsg_len = CMSG_LEN(msg_size); + cmsg->cmsg_len = CMSG_LEN (msg_size); // // We also have to update the controllen in case other stuff is actually // in there we may not be aware of (due to macros). @@ -179,13 +179,13 @@ SendSocket (const char *path, int fd) // Finally, we get a pointer to the start of the ancillary data array and // put our file descriptor in. // - int *fdptr = (int*)(CMSG_DATA(cmsg)); + int *fdptr = (int*)(CMSG_DATA (cmsg)); *fdptr = fd; // // // Actually send the file descriptor back to the emulated net device. // - ssize_t len = sendmsg(sock, &msg, 0); + ssize_t len = sendmsg (sock, &msg, 0); ABORT_IF (len == -1, "Could not send socket back to emu net device", 1); LOG ("sendmsg complete"); @@ -234,7 +234,7 @@ main (int argc, char *argv[]) // single line of code: // LOG ("Creating raw socket"); - int sock = socket (PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); + int sock = socket (PF_PACKET, SOCK_RAW, htons (ETH_P_ALL)); ABORT_IF (sock == -1, "CreateSocket(): Unable to open raw socket", 1); // diff --git a/src/energy/model/rv-battery-model.cc b/src/energy/model/rv-battery-model.cc index 8c5111a23..f9d1dfba0 100644 --- a/src/energy/model/rv-battery-model.cc +++ b/src/energy/model/rv-battery-model.cc @@ -328,7 +328,7 @@ RvBatteryModel::Discharge (double load, Time t) if (m_timeStamps.size () == 1) { // constant load - calculatedAlpha = m_load[0] * RvModelAFunction (t, t, Seconds(0.0), + calculatedAlpha = m_load[0] * RvModelAFunction (t, t, Seconds (0.0), m_beta); } else diff --git a/src/energy/test/basic-energy-model-test.cc b/src/energy/test/basic-energy-model-test.cc index e21e65747..64c2aae5f 100644 --- a/src/energy/test/basic-energy-model-test.cc +++ b/src/energy/test/basic-energy-model-test.cc @@ -319,8 +319,8 @@ BasicEnergyDepletionTest::DepletionTestCase (double simTimeS, // Add a non-QoS upper MAC, and disable rate control NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", - "DataMode", StringValue(phyMode), - "ControlMode", StringValue(phyMode)); + "DataMode", StringValue (phyMode), + "ControlMode", StringValue (phyMode)); // Set it to ad-hoc mode wifiMac.SetType ("ns3::AdhocWifiMac"); NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c); diff --git a/src/energy/test/rv-battery-model-test.cc b/src/energy/test/rv-battery-model-test.cc index 481baf078..639a7eb14 100644 --- a/src/energy/test/rv-battery-model-test.cc +++ b/src/energy/test/rv-battery-model-test.cc @@ -728,8 +728,8 @@ BatteryLifetimeTest::ConstantLoadTest (double load, Time expLifetime) // Add a non-QoS upper MAC, and disable rate control NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", - "DataMode", StringValue(phyMode), - "ControlMode", StringValue(phyMode)); + "DataMode", StringValue (phyMode), + "ControlMode", StringValue (phyMode)); // Set it to ad-hoc mode wifiMac.SetType ("ns3::AdhocWifiMac"); NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c); @@ -815,8 +815,8 @@ BatteryLifetimeTest::VariableLoadTest (std::vector loads, // Add a non-QoS upper MAC, and disable rate control NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", - "DataMode", StringValue(phyMode), - "ControlMode", StringValue(phyMode)); + "DataMode", StringValue (phyMode), + "ControlMode", StringValue (phyMode)); // Set it to ad-hoc mode wifiMac.SetType ("ns3::AdhocWifiMac"); NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c); diff --git a/src/flow-monitor/model/flow-monitor.cc b/src/flow-monitor/model/flow-monitor.cc index a14630192..0a1c2c2ad 100644 --- a/src/flow-monitor/model/flow-monitor.cc +++ b/src/flow-monitor/model/flow-monitor.cc @@ -203,7 +203,7 @@ FlowMonitor::ReportLastRx (Ptr probe, uint32_t flowId, uint32_t packe else { stats.jitterSum -= jitter; - stats.jitterHistogram.AddValue (-jitter.GetSeconds()); + stats.jitterHistogram.AddValue (-jitter.GetSeconds ()); } } stats.lastDelay = delay; @@ -388,30 +388,30 @@ FlowMonitor::SerializeToXmlStream (std::ostream &os, int indent, bool enableHist { CheckForLostPackets (); - INDENT(indent); os << "\n"; + INDENT (indent); os << "\n"; indent += 2; - INDENT(indent); os << "\n"; + INDENT (indent); os << "\n"; indent += 2; for (std::map::const_iterator flowI = m_flowStats.begin (); flowI != m_flowStats.end (); flowI++) { - INDENT(indent); + INDENT (indent); #define ATTRIB(name) << " " # name "=\"" << flowI->second.name << "\"" os << "first << "\"" - ATTRIB(timeFirstTxPacket) - ATTRIB(timeFirstRxPacket) - ATTRIB(timeLastTxPacket) - ATTRIB(timeLastRxPacket) - ATTRIB(delaySum) - ATTRIB(jitterSum) - ATTRIB(lastDelay) - ATTRIB(txBytes) - ATTRIB(rxBytes) - ATTRIB(txPackets) - ATTRIB(rxPackets) - ATTRIB(lostPackets) - ATTRIB(timesForwarded) + ATTRIB (timeFirstTxPacket) + ATTRIB (timeFirstRxPacket) + ATTRIB (timeLastTxPacket) + ATTRIB (timeLastRxPacket) + ATTRIB (delaySum) + ATTRIB (jitterSum) + ATTRIB (lastDelay) + ATTRIB (txBytes) + ATTRIB (rxBytes) + ATTRIB (txPackets) + ATTRIB (rxPackets) + ATTRIB (lostPackets) + ATTRIB (timesForwarded) << ">\n"; #undef ATTRIB @@ -419,14 +419,14 @@ FlowMonitor::SerializeToXmlStream (std::ostream &os, int indent, bool enableHist indent += 2; for (uint32_t reasonCode = 0; reasonCode < flowI->second.packetsDropped.size (); reasonCode++) { - INDENT(indent); + INDENT (indent); os << "second.packetsDropped[reasonCode] << "\" />\n"; } for (uint32_t reasonCode = 0; reasonCode < flowI->second.bytesDropped.size (); reasonCode++) { - INDENT(indent); + INDENT (indent); os << "second.bytesDropped[reasonCode] << "\" />\n"; @@ -440,27 +440,27 @@ FlowMonitor::SerializeToXmlStream (std::ostream &os, int indent, bool enableHist } indent -= 2; - INDENT(indent); os << "\n"; + INDENT (indent); os << "\n"; } indent -= 2; - INDENT(indent); os << "\n"; + INDENT (indent); os << "\n"; m_classifier->SerializeToXmlStream (os, indent); if (enableProbes) { - INDENT(indent); os << "\n"; + INDENT (indent); os << "\n"; indent += 2; for (uint32_t i = 0; i < m_flowProbes.size (); i++) { m_flowProbes[i]->SerializeToXmlStream (os, indent, i); } indent -= 2; - INDENT(indent); os << "\n"; + INDENT (indent); os << "\n"; } indent -= 2; - INDENT(indent); os << "\n"; + INDENT (indent); os << "\n"; } diff --git a/src/flow-monitor/model/flow-probe.cc b/src/flow-monitor/model/flow-probe.cc index d059aec14..a795680c8 100644 --- a/src/flow-monitor/model/flow-probe.cc +++ b/src/flow-monitor/model/flow-probe.cc @@ -69,13 +69,13 @@ FlowProbe::SerializeToXmlStream (std::ostream &os, int indent, uint32_t index) c { #define INDENT(level) for (int __xpto = 0; __xpto < level; __xpto++) os << ' '; - INDENT(indent); os << "\n"; + INDENT (indent); os << "\n"; indent += 2; for (Stats::const_iterator iter = m_stats.begin (); iter != m_stats.end (); iter++) { - INDENT(indent); + INDENT (indent); os << "first << "\"" << " packets=\"" << iter->second.packets << "\"" @@ -85,23 +85,23 @@ FlowProbe::SerializeToXmlStream (std::ostream &os, int indent, uint32_t index) c indent += 2; for (uint32_t reasonCode = 0; reasonCode < iter->second.packetsDropped.size (); reasonCode++) { - INDENT(indent); + INDENT (indent); os << "second.packetsDropped[reasonCode] << "\" />\n"; } for (uint32_t reasonCode = 0; reasonCode < iter->second.bytesDropped.size (); reasonCode++) { - INDENT(indent); + INDENT (indent); os << "second.bytesDropped[reasonCode] << "\" />\n"; } indent -= 2; - INDENT(indent); os << "\n"; + INDENT (indent); os << "\n"; } indent -= 2; - INDENT(indent); os << "\n"; + INDENT (indent); os << "\n"; } diff --git a/src/flow-monitor/model/histogram.cc b/src/flow-monitor/model/histogram.cc index 0927c1025..26c154c9e 100644 --- a/src/flow-monitor/model/histogram.cc +++ b/src/flow-monitor/model/histogram.cc @@ -106,9 +106,9 @@ Histogram::SerializeToXmlStream (std::ostream &os, int indent, std::string eleme { #define INDENT(level) for (int __xpto = 0; __xpto < level; __xpto++) os << ' '; - INDENT(indent); os << "<" << elementName // << " binWidth=\"" << m_binWidth << "\"" - << " nBins=\"" << m_histogram.size () << "\"" - << " >\n"; + INDENT (indent); os << "<" << elementName // << " binWidth=\"" << m_binWidth << "\"" + << " nBins=\"" << m_histogram.size () << "\"" + << " >\n"; indent += 2; #if 1 // two alternative forms of representing bin data, one more verbose than the other one @@ -116,7 +116,7 @@ Histogram::SerializeToXmlStream (std::ostream &os, int indent, std::string eleme { if (m_histogram[index]) { - INDENT(indent); + INDENT (indent); os << " 0) @@ -138,7 +138,7 @@ Histogram::SerializeToXmlStream (std::ostream &os, int indent, std::string eleme os << "\n"; #endif indent -= 2; - INDENT(indent); os << "\n"; + INDENT (indent); os << "\n"; #undef INDENT } diff --git a/src/flow-monitor/model/ipv4-flow-classifier.cc b/src/flow-monitor/model/ipv4-flow-classifier.cc index 7f40a862c..be5a7784b 100644 --- a/src/flow-monitor/model/ipv4-flow-classifier.cc +++ b/src/flow-monitor/model/ipv4-flow-classifier.cc @@ -176,13 +176,13 @@ Ipv4FlowClassifier::SerializeToXmlStream (std::ostream &os, int indent) const { #define INDENT(level) for (int __xpto = 0; __xpto < level; __xpto++) os << ' '; - INDENT(indent); os << "\n"; + INDENT (indent); os << "\n"; indent += 2; for (std::map::const_iterator iter = m_flowMap.begin (); iter != m_flowMap.end (); iter++) { - INDENT(indent); + INDENT (indent); os << "second << "\"" << " sourceAddress=\"" << iter->first.sourceAddress << "\"" << " destinationAddress=\"" << iter->first.destinationAddress << "\"" @@ -193,7 +193,7 @@ Ipv4FlowClassifier::SerializeToXmlStream (std::ostream &os, int indent) const } indent -= 2; - INDENT(indent); os << "\n"; + INDENT (indent); os << "\n"; #undef INDENT } diff --git a/src/flow-monitor/test/histogram-test-suite.cc b/src/flow-monitor/test/histogram-test-suite.cc index eedfeb4e7..559af7cb9 100644 --- a/src/flow-monitor/test/histogram-test-suite.cc +++ b/src/flow-monitor/test/histogram-test-suite.cc @@ -41,7 +41,7 @@ HistogramTestCase::HistogramTestCase () void HistogramTestCase::DoRun (void) { - Histogram h0(3.5); + Histogram h0 (3.5); // Testing floating-point bin widths { for (int i=1; i <= 10; i++) diff --git a/src/internet/helper/internet-stack-helper.cc b/src/internet/helper/internet-stack-helper.cc index 93c220bdb..152a640b6 100644 --- a/src/internet/helper/internet-stack-helper.cc +++ b/src/internet/helper/internet-stack-helper.cc @@ -424,7 +424,7 @@ Ipv4L3ProtocolRxTxSink (Ptr p, Ptr ipv4, uint32_t interface) } Ptr file = g_interfaceFileMapIpv4[pair]; - file->Write(Simulator::Now(), p); + file->Write (Simulator::Now (), p); } bool @@ -519,7 +519,7 @@ Ipv6L3ProtocolRxTxSink (Ptr p, Ptr ipv6, uint32_t interface) } Ptr file = g_interfaceFileMapIpv6[pair]; - file->Write(Simulator::Now(), p); + file->Write (Simulator::Now (), p); } bool diff --git a/src/internet/helper/internet-stack-helper.h b/src/internet/helper/internet-stack-helper.h index 4a43e650b..eb63dcdc3 100644 --- a/src/internet/helper/internet-stack-helper.h +++ b/src/internet/helper/internet-stack-helper.h @@ -141,7 +141,7 @@ public: * * \param tid the type id, typically it is set to "ns3::TcpL4Protocol" */ - void SetTcp(std::string tid); + void SetTcp (std::string tid); /** * \brief This function is used to setup the Network Simulation Cradle stack with library value. diff --git a/src/internet/helper/internet-trace-helper.cc b/src/internet/helper/internet-trace-helper.cc index 0e5ec7b74..f56d6a7a0 100644 --- a/src/internet/helper/internet-trace-helper.cc +++ b/src/internet/helper/internet-trace-helper.cc @@ -31,7 +31,7 @@ #include "internet-trace-helper.h" -NS_LOG_COMPONENT_DEFINE("InternetTraceHelper"); +NS_LOG_COMPONENT_DEFINE ("InternetTraceHelper"); namespace ns3 { diff --git a/src/internet/helper/ipv4-address-helper.cc b/src/internet/helper/ipv4-address-helper.cc index de273203b..7228f7057 100644 --- a/src/internet/helper/ipv4-address-helper.cc +++ b/src/internet/helper/ipv4-address-helper.cc @@ -26,7 +26,7 @@ #include "ns3/simulator.h" #include "ipv4-address-helper.h" -NS_LOG_COMPONENT_DEFINE("Ipv4AddressHelper"); +NS_LOG_COMPONENT_DEFINE ("Ipv4AddressHelper"); namespace ns3 { @@ -71,8 +71,8 @@ Ipv4AddressHelper::SetBase ( // // Some quick reasonableness testing. // - NS_ASSERT_MSG((m_network & ~m_mask) == 0, - "Ipv4AddressHelper::SetBase(): Inconsistent network and mask"); + NS_ASSERT_MSG ((m_network & ~m_mask) == 0, + "Ipv4AddressHelper::SetBase(): Inconsistent network and mask"); // // Figure out how much to shift network numbers to get them aligned, and what @@ -81,8 +81,8 @@ Ipv4AddressHelper::SetBase ( m_shift = NumAddressBits (m_mask); m_max = (1 << m_shift) - 2; - NS_ASSERT_MSG(m_shift <= 32, - "Ipv4AddressHelper::SetBase(): Unreasonable address length"); + NS_ASSERT_MSG (m_shift <= 32, + "Ipv4AddressHelper::SetBase(): Unreasonable address length"); // // Shift the network down into the normalized position. @@ -177,7 +177,7 @@ Ipv4AddressHelper::NumAddressBits (uint32_t maskbits) const maskbits >>= 1; } - NS_ASSERT_MSG(false, "Ipv4AddressHelper::NumAddressBits(): Bad Mask"); + NS_ASSERT_MSG (false, "Ipv4AddressHelper::NumAddressBits(): Bad Mask"); return 0; } diff --git a/src/internet/helper/ipv4-global-routing-helper.cc b/src/internet/helper/ipv4-global-routing-helper.cc index 1aa64d332..bb95737d5 100644 --- a/src/internet/helper/ipv4-global-routing-helper.cc +++ b/src/internet/helper/ipv4-global-routing-helper.cc @@ -23,7 +23,7 @@ #include "ns3/ipv4-list-routing.h" #include "ns3/log.h" -NS_LOG_COMPONENT_DEFINE("GlobalRoutingHelper"); +NS_LOG_COMPONENT_DEFINE ("GlobalRoutingHelper"); namespace ns3 { diff --git a/src/internet/helper/ipv4-interface-container.cc b/src/internet/helper/ipv4-interface-container.cc index 8df525cc0..fbc184368 100644 --- a/src/internet/helper/ipv4-interface-container.cc +++ b/src/internet/helper/ipv4-interface-container.cc @@ -67,7 +67,7 @@ Ipv4InterfaceContainer::Add (std::string ipv4Name, uint32_t interface) } std::pair, uint32_t> -Ipv4InterfaceContainer::Get(uint32_t i) const +Ipv4InterfaceContainer::Get (uint32_t i) const { return m_interfaces[i]; } diff --git a/src/internet/helper/ipv4-static-routing-helper.cc b/src/internet/helper/ipv4-static-routing-helper.cc index 6c985675a..b0f6ec47a 100644 --- a/src/internet/helper/ipv4-static-routing-helper.cc +++ b/src/internet/helper/ipv4-static-routing-helper.cc @@ -29,7 +29,7 @@ #include "ns3/ipv4-routing-protocol.h" #include "ipv4-static-routing-helper.h" -NS_LOG_COMPONENT_DEFINE("Ipv4StaticRoutingHelper"); +NS_LOG_COMPONENT_DEFINE ("Ipv4StaticRoutingHelper"); namespace ns3 { @@ -101,16 +101,16 @@ Ipv4StaticRoutingHelper::AddMulticastRoute ( { Ptr nd = *i; int32_t interface = ipv4->GetInterfaceForDevice (nd); - NS_ASSERT_MSG(interface >= 0, - "Ipv4StaticRoutingHelper::AddMulticastRoute(): " - "Expected an interface associated with the device nd"); - outputInterfaces.push_back(interface); + NS_ASSERT_MSG (interface >= 0, + "Ipv4StaticRoutingHelper::AddMulticastRoute(): " + "Expected an interface associated with the device nd"); + outputInterfaces.push_back (interface); } int32_t inputInterface = ipv4->GetInterfaceForDevice (input); - NS_ASSERT_MSG(inputInterface >= 0, - "Ipv4StaticRoutingHelper::AddMulticastRoute(): " - "Expected an interface associated with the device input"); + NS_ASSERT_MSG (inputInterface >= 0, + "Ipv4StaticRoutingHelper::AddMulticastRoute(): " + "Expected an interface associated with the device input"); Ipv4StaticRoutingHelper helper; Ptr ipv4StaticRouting = helper.GetStaticRouting (ipv4); if (!ipv4StaticRouting) @@ -166,9 +166,9 @@ Ipv4StaticRoutingHelper::SetDefaultMulticastRoute ( { Ptr ipv4 = n->GetObject (); int32_t interfaceSrc = ipv4->GetInterfaceForDevice (nd); - NS_ASSERT_MSG(interfaceSrc >= 0, - "Ipv4StaticRoutingHelper::SetDefaultMulticastRoute(): " - "Expected an interface associated with the device"); + NS_ASSERT_MSG (interfaceSrc >= 0, + "Ipv4StaticRoutingHelper::SetDefaultMulticastRoute(): " + "Expected an interface associated with the device"); Ipv4StaticRoutingHelper helper; Ptr ipv4StaticRouting = helper.GetStaticRouting (ipv4); if (!ipv4StaticRouting) diff --git a/src/internet/model/arp-cache.cc b/src/internet/model/arp-cache.cc index b84401208..44d7f0093 100644 --- a/src/internet/model/arp-cache.cc +++ b/src/internet/model/arp-cache.cc @@ -203,11 +203,11 @@ ArpCache::HandleWaitReplyTimeout (void) entry->GetRetries ()); entry->MarkDead (); entry->ClearRetries (); - Ptr pending = entry->DequeuePending(); + Ptr pending = entry->DequeuePending (); while (pending != 0) { m_dropTrace (pending); - pending = entry->DequeuePending(); + pending = entry->DequeuePending (); } } } diff --git a/src/internet/model/arp-l3-protocol.cc b/src/internet/model/arp-l3-protocol.cc index 29f866814..f780c760e 100644 --- a/src/internet/model/arp-l3-protocol.cc +++ b/src/internet/model/arp-l3-protocol.cc @@ -138,8 +138,8 @@ ArpL3Protocol::FindCache (Ptr device) } void -ArpL3Protocol::Receive(Ptr device, Ptr p, uint16_t protocol, const Address &from, - const Address &to, NetDevice::PacketType packetType) +ArpL3Protocol::Receive (Ptr device, Ptr p, uint16_t protocol, const Address &from, + const Address &to, NetDevice::PacketType packetType) { NS_LOG_FUNCTION (this << device << p->GetSize () << protocol << from << to << packetType); @@ -205,21 +205,21 @@ ArpL3Protocol::Receive(Ptr device, Ptr p, uint16_t prot << " for waiting entry -- flush"); Address from_mac = arp.GetSourceHardwareAddress (); entry->MarkAlive (from_mac); - Ptr pending = entry->DequeuePending(); + Ptr pending = entry->DequeuePending (); while (pending != 0) { cache->GetInterface ()->Send (pending, arp.GetSourceIpv4Address ()); - pending = entry->DequeuePending(); + pending = entry->DequeuePending (); } } else { // ignore this reply which might well be an attempt // at poisening my arp cache. - NS_LOG_LOGIC("node="<GetId ()<<", got reply from " << - arp.GetSourceIpv4Address () << - " for non-waiting entry -- drop"); + NS_LOG_LOGIC ("node="<GetId ()<<", got reply from " << + arp.GetSourceIpv4Address () << + " for non-waiting entry -- drop"); m_dropTrace (packet); } } diff --git a/src/internet/model/arp-l3-protocol.h b/src/internet/model/arp-l3-protocol.h index 0353b5b9d..ebf7fcc00 100644 --- a/src/internet/model/arp-l3-protocol.h +++ b/src/internet/model/arp-l3-protocol.h @@ -61,8 +61,8 @@ public: /** * \brief Receive a packet */ - void Receive(Ptr device, Ptr p, uint16_t protocol, const Address &from, const Address &to, - NetDevice::PacketType packetType); + void Receive (Ptr device, Ptr p, uint16_t protocol, const Address &from, const Address &to, + NetDevice::PacketType packetType); /** * \brief Perform an ARP lookup * \param p diff --git a/src/internet/model/candidate-queue.cc b/src/internet/model/candidate-queue.cc index 19edeb3be..c12bbbec5 100644 --- a/src/internet/model/candidate-queue.cc +++ b/src/internet/model/candidate-queue.cc @@ -143,7 +143,7 @@ CandidateQueue::Find (const Ipv4Address addr) const for (; i != m_candidates.end (); i++) { SPFVertex *v = *i; - if (v->GetVertexId() == addr) + if (v->GetVertexId () == addr) { return v; } diff --git a/src/internet/model/global-route-manager-impl.cc b/src/internet/model/global-route-manager-impl.cc index 0ca01472f..68b3bb3b0 100644 --- a/src/internet/model/global-route-manager-impl.cc +++ b/src/internet/model/global-route-manager-impl.cc @@ -320,7 +320,7 @@ SPFVertex::MergeRootExitDirections (const SPFVertex* vertex) // Append the external list into 'this' and remove duplication afterward const ListOfNodeExit_t& extList = vertex->m_ecmpRootExits; m_ecmpRootExits.insert (m_ecmpRootExits.end (), - extList.begin(), extList.end ()); + extList.begin (), extList.end ()); m_ecmpRootExits.sort (); m_ecmpRootExits.unique (); } @@ -1313,7 +1313,7 @@ GlobalRouteManagerImpl::CheckForStubNode (Ipv4Address root) FindOutgoingInterfaceId (transitLink->GetLinkData ())); NS_LOG_LOGIC ("Inserting default route for node " << myRouterId << " to next hop " << lr->GetLinkData () << " via interface " << - FindOutgoingInterfaceId(transitLink->GetLinkData())); + FindOutgoingInterfaceId (transitLink->GetLinkData ())); return true; } } @@ -1504,7 +1504,7 @@ GlobalRouteManagerImpl::ProcessASExternals (SPFVertex* v, GlobalRoutingLSA* extl if ((rlsa->GetLinkStateId ()) == (extlsa->GetAdvertisingRouter ())) { NS_LOG_LOGIC ("Found advertising router to destination"); - SPFAddASExternal(extlsa,v); + SPFAddASExternal (extlsa,v); } } for (uint32_t i = 0; i < v->GetNChildren (); i++) diff --git a/src/internet/model/global-route-manager-impl.h b/src/internet/model/global-route-manager-impl.h index 1ea6114b4..df8da67ae 100644 --- a/src/internet/model/global-route-manager-impl.h +++ b/src/internet/model/global-route-manager-impl.h @@ -617,7 +617,7 @@ public: * ID. * @param lsa A pointer to the Link State Advertisement for the router. */ - void Insert(Ipv4Address addr, GlobalRoutingLSA* lsa); + void Insert (Ipv4Address addr, GlobalRoutingLSA* lsa); /** * @brief Look up the Link State Advertisement associated with the given @@ -773,7 +773,7 @@ private: void SPFIntraAddStub (GlobalRoutingLinkRecord *l, SPFVertex* v); void SPFAddASExternal (GlobalRoutingLSA *extlsa, SPFVertex *v); int32_t FindOutgoingInterfaceId (Ipv4Address a, - Ipv4Mask amask = Ipv4Mask("255.255.255.255")); + Ipv4Mask amask = Ipv4Mask ("255.255.255.255")); }; } // namespace ns3 diff --git a/src/internet/model/global-router-interface.cc b/src/internet/model/global-router-interface.cc index cc770b4d4..1c8160b5b 100644 --- a/src/internet/model/global-router-interface.cc +++ b/src/internet/model/global-router-interface.cc @@ -136,13 +136,13 @@ GlobalRoutingLinkRecord::SetMetric (uint16_t metric) GlobalRoutingLSA::GlobalRoutingLSA() : m_lsType (GlobalRoutingLSA::Unknown), - m_linkStateId("0.0.0.0"), - m_advertisingRtr("0.0.0.0"), - m_linkRecords(), - m_networkLSANetworkMask("0.0.0.0"), - m_attachedRouters(), - m_status(GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED), - m_node_id(0) + m_linkStateId ("0.0.0.0"), + m_advertisingRtr ("0.0.0.0"), + m_linkRecords (), + m_networkLSANetworkMask ("0.0.0.0"), + m_attachedRouters (), + m_status (GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED), + m_node_id (0) { NS_LOG_FUNCTION_NOARGS (); } @@ -153,27 +153,27 @@ GlobalRoutingLSA::GlobalRoutingLSA ( Ipv4Address advertisingRtr) : m_lsType (GlobalRoutingLSA::Unknown), - m_linkStateId(linkStateId), - m_advertisingRtr(advertisingRtr), - m_linkRecords(), - m_networkLSANetworkMask("0.0.0.0"), - m_attachedRouters(), - m_status(status), - m_node_id(0) + m_linkStateId (linkStateId), + m_advertisingRtr (advertisingRtr), + m_linkRecords (), + m_networkLSANetworkMask ("0.0.0.0"), + m_attachedRouters (), + m_status (status), + m_node_id (0) { NS_LOG_FUNCTION (this << status << linkStateId << advertisingRtr); } GlobalRoutingLSA::GlobalRoutingLSA (GlobalRoutingLSA& lsa) - : m_lsType(lsa.m_lsType), m_linkStateId(lsa.m_linkStateId), - m_advertisingRtr(lsa.m_advertisingRtr), - m_networkLSANetworkMask(lsa.m_networkLSANetworkMask), - m_status(lsa.m_status), - m_node_id(lsa.m_node_id) + : m_lsType (lsa.m_lsType), m_linkStateId (lsa.m_linkStateId), + m_advertisingRtr (lsa.m_advertisingRtr), + m_networkLSANetworkMask (lsa.m_networkLSANetworkMask), + m_status (lsa.m_status), + m_node_id (lsa.m_node_id) { NS_LOG_FUNCTION_NOARGS (); - NS_ASSERT_MSG(IsEmpty(), - "GlobalRoutingLSA::GlobalRoutingLSA (): Non-empty LSA in constructor"); + NS_ASSERT_MSG (IsEmpty (), + "GlobalRoutingLSA::GlobalRoutingLSA (): Non-empty LSA in constructor"); CopyLinkRecords (lsa); } @@ -209,7 +209,7 @@ GlobalRoutingLSA::CopyLinkRecords (const GlobalRoutingLSA& lsa) pDst->SetLinkData (pSrc->GetLinkData ()); pDst->SetMetric (pSrc->GetMetric ()); - m_linkRecords.push_back(pDst); + m_linkRecords.push_back (pDst); pDst = 0; } @@ -223,7 +223,7 @@ GlobalRoutingLSA::~GlobalRoutingLSA() } void -GlobalRoutingLSA::ClearLinkRecords(void) +GlobalRoutingLSA::ClearLinkRecords (void) { NS_LOG_FUNCTION_NOARGS (); for ( ListOfLinkRecords_t::iterator i = m_linkRecords.begin (); @@ -239,7 +239,7 @@ GlobalRoutingLSA::ClearLinkRecords(void) *i = 0; } NS_LOG_LOGIC ("Clear list"); - m_linkRecords.clear(); + m_linkRecords.clear (); } uint32_t @@ -271,7 +271,7 @@ GlobalRoutingLSA::GetLinkRecord (uint32_t n) const return *i; } } - NS_ASSERT_MSG(false, "GlobalRoutingLSA::GetLinkRecord (): invalid index"); + NS_ASSERT_MSG (false, "GlobalRoutingLSA::GetLinkRecord (): invalid index"); return 0; } @@ -374,8 +374,8 @@ GlobalRoutingLSA::GetAttachedRouter (uint32_t n) const return *i; } } - NS_ASSERT_MSG(false, "GlobalRoutingLSA::GetAttachedRouter (): invalid index"); - return Ipv4Address("0.0.0.0"); + NS_ASSERT_MSG (false, "GlobalRoutingLSA::GetAttachedRouter (): invalid index"); + return Ipv4Address ("0.0.0.0"); } void @@ -486,7 +486,7 @@ GlobalRoutingLSA::Print (std::ostream &os) const } else { - NS_ASSERT_MSG(0, "Illegal LSA LSType: " << m_lsType); + NS_ASSERT_MSG (0, "Illegal LSA LSType: " << m_lsType); } os << "========== End Global Routing LSA ==========" << std::endl; } @@ -514,16 +514,16 @@ GlobalRouter::GetTypeId (void) } GlobalRouter::GlobalRouter () - : m_LSAs() + : m_LSAs () { NS_LOG_FUNCTION_NOARGS (); - m_routerId.Set(GlobalRouteManager::AllocateRouterId ()); + m_routerId.Set (GlobalRouteManager::AllocateRouterId ()); } GlobalRouter::~GlobalRouter () { NS_LOG_FUNCTION_NOARGS (); - ClearLSAs(); + ClearLSAs (); } void @@ -568,7 +568,7 @@ GlobalRouter::ClearLSAs () *i = 0; } NS_LOG_LOGIC ("Clear list of LSAs"); - m_LSAs.clear(); + m_LSAs.clear (); } Ipv4Address @@ -625,7 +625,7 @@ GlobalRouter::DiscoverLSAs () // of devices may include those for stub networks (e.g., ethernets, etc.) and // bridge devices also take up an "extra" net device. // - uint32_t numDevices = node->GetNDevices(); + uint32_t numDevices = node->GetNDevices (); // // Iterate through the devices on the node and walk the channel to see what's @@ -633,7 +633,7 @@ GlobalRouter::DiscoverLSAs () // for (uint32_t i = 0; i < numDevices; ++i) { - Ptr ndLocal = node->GetDevice(i); + Ptr ndLocal = node->GetDevice (i); // // There is an assumption that bridge ports must never have an IP address @@ -644,7 +644,7 @@ GlobalRouter::DiscoverLSAs () { // Initialize to value out of bounds to silence compiler uint32_t interfaceBridge = ipv4Local->GetNInterfaces () + 1; - bool rc = FindInterfaceForDevice(node, ndLocal, interfaceBridge); + bool rc = FindInterfaceForDevice (node, ndLocal, interfaceBridge); NS_ABORT_MSG_IF (rc, "GlobalRouter::DiscoverLSAs(): Bridge ports must not have an IPv4 interface index"); } @@ -693,7 +693,7 @@ GlobalRouter::DiscoverLSAs () } else { - NS_ASSERT_MSG(0, "GlobalRouter::DiscoverLSAs (): unknown link type"); + NS_ASSERT_MSG (0, "GlobalRouter::DiscoverLSAs (): unknown link type"); } } @@ -717,8 +717,8 @@ GlobalRouter::DiscoverLSAs () // Build injected route LSAs as external routes // RFC 2328, section 12.4.4 // - for (InjectedRoutesCI i = m_injectedRoutes.begin(); - i != m_injectedRoutes.end(); + for (InjectedRoutesCI i = m_injectedRoutes.begin (); + i != m_injectedRoutes.end (); i++) { GlobalRoutingLSA *pLSA = new GlobalRoutingLSA; @@ -769,7 +769,7 @@ GlobalRouter::ProcessSingleBroadcastLink (Ptr nd, GlobalRoutingLSA *p // Initialize to value out of bounds to silence compiler uint32_t interfaceLocal = ipv4Local->GetNInterfaces () + 1; - bool rc = FindInterfaceForDevice(node, nd, interfaceLocal); + bool rc = FindInterfaceForDevice (node, nd, interfaceLocal); NS_ABORT_MSG_IF (rc == false, "GlobalRouter::ProcessSingleBroadcastLink(): No interface index associated with device"); if (ipv4Local->GetNAddresses (interfaceLocal) > 1) @@ -792,23 +792,23 @@ GlobalRouter::ProcessSingleBroadcastLink (Ptr nd, GlobalRoutingLSA *p // // This is a net device connected to a stub network // - NS_LOG_LOGIC("Router-LSA Stub Network"); + NS_LOG_LOGIC ("Router-LSA Stub Network"); plr->SetLinkType (GlobalRoutingLinkRecord::StubNetwork); // // According to OSPF, the Link ID is the IP network number of // the attached network. // - plr->SetLinkId (addrLocal.CombineMask(maskLocal)); + plr->SetLinkId (addrLocal.CombineMask (maskLocal)); // // and the Link Data is the network mask; converted to Ipv4Address // Ipv4Address maskLocalAddr; - maskLocalAddr.Set(maskLocal.Get ()); + maskLocalAddr.Set (maskLocal.Get ()); plr->SetLinkData (maskLocalAddr); plr->SetMetric (metricLocal); - pLSA->AddLinkRecord(plr); + pLSA->AddLinkRecord (plr); plr = 0; } else @@ -889,7 +889,7 @@ GlobalRouter::ProcessBridgedBroadcastLink (Ptr nd, GlobalRoutingLSA * // Initialize to value out of bounds to silence compiler uint32_t interfaceLocal = ipv4Local->GetNInterfaces () + 1; - bool rc = FindInterfaceForDevice(node, nd, interfaceLocal); + bool rc = FindInterfaceForDevice (node, nd, interfaceLocal); NS_ABORT_MSG_IF (rc == false, "GlobalRouter::ProcessBridgedBroadcastLink(): No interface index associated with device"); if (ipv4Local->GetNAddresses (interfaceLocal) > 1) @@ -965,23 +965,23 @@ GlobalRouter::ProcessBridgedBroadcastLink (Ptr nd, GlobalRoutingLSA * // // This is a net device connected to a bridge of stub networks // - NS_LOG_LOGIC("Router-LSA Stub Network"); + NS_LOG_LOGIC ("Router-LSA Stub Network"); plr->SetLinkType (GlobalRoutingLinkRecord::StubNetwork); // // According to OSPF, the Link ID is the IP network number of // the attached network. // - plr->SetLinkId (addrLocal.CombineMask(maskLocal)); + plr->SetLinkId (addrLocal.CombineMask (maskLocal)); // // and the Link Data is the network mask; converted to Ipv4Address // Ipv4Address maskLocalAddr; - maskLocalAddr.Set(maskLocal.Get ()); + maskLocalAddr.Set (maskLocal.Get ()); plr->SetLinkData (maskLocalAddr); plr->SetMetric (metricLocal); - pLSA->AddLinkRecord(plr); + pLSA->AddLinkRecord (plr); plr = 0; } else @@ -1035,7 +1035,7 @@ GlobalRouter::ProcessPointToPointLink (Ptr ndLocal, GlobalRoutingLSA NS_ABORT_MSG_UNLESS (ipv4Local, "GlobalRouter::ProcessPointToPointLink (): GetObject for interface failed"); uint32_t interfaceLocal = ipv4Local->GetNInterfaces () + 1; - bool rc = FindInterfaceForDevice(nodeLocal, ndLocal, interfaceLocal); + bool rc = FindInterfaceForDevice (nodeLocal, ndLocal, interfaceLocal); NS_ABORT_MSG_IF (rc == false, "GlobalRouter::ProcessPointToPointLink (): No interface index associated with device"); if (ipv4Local->GetNAddresses (interfaceLocal) > 1) @@ -1051,12 +1051,12 @@ GlobalRouter::ProcessPointToPointLink (Ptr ndLocal, GlobalRoutingLSA // the point-to-point channel we know we have. This is where our adjacent // router (to use OSPF lingo) is running. // - Ptr ch = ndLocal->GetChannel(); + Ptr ch = ndLocal->GetChannel (); // // Get the net device on the other side of the point-to-point channel. // - Ptr ndRemote = GetAdjacent(ndLocal, ch); + Ptr ndRemote = GetAdjacent (ndLocal, ch); // // The adjacent net device is aggregated to a node. We need to ask that net @@ -1065,7 +1065,7 @@ GlobalRouter::ProcessPointToPointLink (Ptr ndLocal, GlobalRoutingLSA // internet stacks; and an assumption that point-to-point links are incompatible // with bridging. // - Ptr nodeRemote = ndRemote->GetNode(); + Ptr nodeRemote = ndRemote->GetNode (); Ptr ipv4Remote = nodeRemote->GetObject (); NS_ABORT_MSG_UNLESS (ipv4Remote, "GlobalRouter::ProcessPointToPointLink(): GetObject for remote failed"); @@ -1084,7 +1084,7 @@ GlobalRouter::ProcessPointToPointLink (Ptr ndLocal, GlobalRoutingLSA // // We're going to need the remote router ID, so we might as well get it now. // - Ipv4Address rtrIdRemote = rtrRemote->GetRouterId(); + Ipv4Address rtrIdRemote = rtrRemote->GetRouterId (); NS_LOG_LOGIC ("Working with remote router " << rtrIdRemote); // @@ -1092,7 +1092,7 @@ GlobalRouter::ProcessPointToPointLink (Ptr ndLocal, GlobalRoutingLSA // net device on the other end of the point-to-point channel. // uint32_t interfaceRemote = ipv4Remote->GetNInterfaces () + 1; - rc = FindInterfaceForDevice(nodeRemote, ndRemote, interfaceRemote); + rc = FindInterfaceForDevice (nodeRemote, ndRemote, interfaceRemote); NS_ABORT_MSG_IF (rc == false, "GlobalRouter::ProcessPointToPointLinks(): No interface index associated with remote device"); // @@ -1132,7 +1132,7 @@ GlobalRouter::ProcessPointToPointLink (Ptr ndLocal, GlobalRoutingLSA NS_ABORT_MSG_IF (plr == 0, "GlobalRouter::ProcessPointToPointLink(): Can't alloc link record"); plr->SetLinkType (GlobalRoutingLinkRecord::StubNetwork); plr->SetLinkId (addrRemote); - plr->SetLinkData (Ipv4Address(maskRemote.Get())); // Frown + plr->SetLinkData (Ipv4Address (maskRemote.Get ())); // Frown plr->SetMetric (metricLocal); pLSA->AddLinkRecord (plr); plr = 0; @@ -1158,7 +1158,7 @@ GlobalRouter::BuildNetworkLSAs (NetDeviceContainer c) NS_ABORT_MSG_UNLESS (ipv4Local, "GlobalRouter::ProcessPointToPointLink (): GetObject for interface failed"); uint32_t interfaceLocal = ipv4Local->GetNInterfaces () + 1; - bool rc = FindInterfaceForDevice(node, ndLocal, interfaceLocal); + bool rc = FindInterfaceForDevice (node, ndLocal, interfaceLocal); NS_ABORT_MSG_IF (rc == false, "GlobalRouter::BuildNetworkLSAs (): No interface index associated with device"); if (ipv4Local->GetNAddresses (interfaceLocal) > 1) @@ -1183,8 +1183,8 @@ GlobalRouter::BuildNetworkLSAs (NetDeviceContainer c) // and, if we find a node with a GlobalRouter interface and an IPv4 // interface associated with that device, we call it an attached router. // - Ptr ch = ndLocal->GetChannel(); - uint32_t nDevices = ch->GetNDevices(); + Ptr ch = ndLocal->GetChannel (); + uint32_t nDevices = ch->GetNDevices (); NS_ASSERT (nDevices); for (uint32_t i = 0; i < nDevices; i++) @@ -1222,7 +1222,7 @@ GlobalRouter::BuildNetworkLSAs (NetDeviceContainer c) { NS_LOG_WARN ("Warning, interface has multiple IP addresses; using only the primary one"); } - Ipv4Address tempAddr = tempIpv4->GetAddress(tempInterface, 0).GetLocal (); + Ipv4Address tempAddr = tempIpv4->GetAddress (tempInterface, 0).GetLocal (); pLSA->AddAttachedRouter (tempAddr); } } @@ -1243,8 +1243,8 @@ GlobalRouter::FindDesignatedRouterForLink (Ptr ndLocal, bool allowRec { NS_LOG_FUNCTION (ndLocal << allowRecursion); - Ptr ch = ndLocal->GetChannel(); - uint32_t nDevices = ch->GetNDevices(); + Ptr ch = ndLocal->GetChannel (); + uint32_t nDevices = ch->GetNDevices (); NS_ASSERT (nDevices); NS_LOG_LOGIC ("Looking for designated router off of net device " << ndLocal << " on node " << @@ -1293,7 +1293,7 @@ GlobalRouter::FindDesignatedRouterForLink (Ptr ndLocal, bool allowRec { // Initialize to value out of bounds to silence compiler uint32_t interfaceOther = ipv4->GetNInterfaces () + 1; - if (FindInterfaceForDevice(nodeOther, bnd, interfaceOther)) + if (FindInterfaceForDevice (nodeOther, bnd, interfaceOther)) { NS_LOG_LOGIC ("Found router on bridge net device " << bnd); if (!ipv4->IsUp (interfaceOther)) @@ -1347,7 +1347,7 @@ GlobalRouter::FindDesignatedRouterForLink (Ptr ndLocal, bool allowRec { // Initialize to value out of bounds to silence compiler uint32_t interfaceOther = ipv4->GetNInterfaces () + 1; - if (FindInterfaceForDevice(nodeOther, ndOther, interfaceOther)) + if (FindInterfaceForDevice (nodeOther, ndOther, interfaceOther)) { if (!ipv4->IsUp (interfaceOther)) { @@ -1380,13 +1380,13 @@ GlobalRouter::AnotherRouterOnLink (Ptr nd, bool allowRecursion) const { NS_LOG_FUNCTION (nd << allowRecursion); - Ptr ch = nd->GetChannel(); + Ptr ch = nd->GetChannel (); if (!ch) { // It may be that this net device is a stub device, without a channel return false; } - uint32_t nDevices = ch->GetNDevices(); + uint32_t nDevices = ch->GetNDevices (); NS_ASSERT (nDevices); NS_LOG_LOGIC ("Looking for routers off of net device " << nd << " on node " << nd->GetNode ()->GetId ()); @@ -1480,7 +1480,7 @@ bool GlobalRouter::GetLSA (uint32_t n, GlobalRoutingLSA &lsa) const { NS_LOG_FUNCTION_NOARGS (); - NS_ASSERT_MSG(lsa.IsEmpty(), "GlobalRouter::GetLSA (): Must pass empty LSA"); + NS_ASSERT_MSG (lsa.IsEmpty (), "GlobalRouter::GetLSA (): Must pass empty LSA"); // // All of the work was done in GetNumLSAs. All we have to do here is to // walk the list of link state advertisements created there and return the @@ -1555,7 +1555,7 @@ GlobalRouter::RemoveInjectedRoute (uint32_t index) { if (tmp == index) { - NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_injectedRoutes.size()); + NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_injectedRoutes.size ()); delete *i; m_injectedRoutes.erase (i); return; @@ -1590,12 +1590,12 @@ Ptr GlobalRouter::GetAdjacent (Ptr nd, Ptr ch) const { NS_LOG_FUNCTION_NOARGS (); - NS_ASSERT_MSG(ch->GetNDevices() == 2, "GlobalRouter::GetAdjacent (): Channel with other than two devices"); + NS_ASSERT_MSG (ch->GetNDevices () == 2, "GlobalRouter::GetAdjacent (): Channel with other than two devices"); // // This is a point to point channel with two endpoints. Get both of them. // - Ptr nd1 = ch->GetDevice(0); - Ptr nd2 = ch->GetDevice(1); + Ptr nd1 = ch->GetDevice (0); + Ptr nd2 = ch->GetDevice (1); // // One of the endpoints is going to be "us" -- that is the net device attached // to the node on which we're running -- i.e., "nd". The other endpoint (the @@ -1611,8 +1611,8 @@ GlobalRouter::GetAdjacent (Ptr nd, Ptr ch) const } else { - NS_ASSERT_MSG(false, - "GlobalRouter::GetAdjacent (): Wrong or confused channel?"); + NS_ASSERT_MSG (false, + "GlobalRouter::GetAdjacent (): Wrong or confused channel?"); return 0; } } @@ -1628,7 +1628,7 @@ bool GlobalRouter::FindInterfaceForDevice (Ptr node, Ptr nd, uint32_t &index) const { NS_LOG_FUNCTION_NOARGS (); - NS_LOG_LOGIC("For node " << node->GetId () << " for net device " << nd ); + NS_LOG_LOGIC ("For node " << node->GetId () << " for net device " << nd ); Ptr ipv4 = node->GetObject (); if (ipv4 == 0) @@ -1637,9 +1637,9 @@ GlobalRouter::FindInterfaceForDevice (Ptr node, Ptr nd, uint32_ return false; } - for (uint32_t i = 0; i < ipv4->GetNInterfaces(); ++i ) + for (uint32_t i = 0; i < ipv4->GetNInterfaces (); ++i ) { - if (ipv4->GetNetDevice(i) == nd) + if (ipv4->GetNetDevice (i) == nd) { NS_LOG_LOGIC ("Device " << nd << " has associated ipv4 index " << i); index = i; @@ -1660,7 +1660,7 @@ GlobalRouter::NetDeviceIsBridged (Ptr nd) const NS_LOG_FUNCTION (nd); Ptr node = nd->GetNode (); - uint32_t nDevices = node->GetNDevices(); + uint32_t nDevices = node->GetNDevices (); // // There is no bit on a net device that says it is being bridged, so we have @@ -1670,7 +1670,7 @@ GlobalRouter::NetDeviceIsBridged (Ptr nd) const // for (uint32_t i = 0; i < nDevices; ++i) { - Ptr ndTest = node->GetDevice(i); + Ptr ndTest = node->GetDevice (i); NS_LOG_LOGIC ("Examine device " << i << " " << ndTest); if (ndTest->IsBridge ()) diff --git a/src/internet/model/global-router-interface.h b/src/internet/model/global-router-interface.h index 75224f115..cad0b37c3 100644 --- a/src/internet/model/global-router-interface.h +++ b/src/internet/model/global-router-interface.h @@ -109,7 +109,7 @@ public: * * @returns The Ipv4Address corresponding to the Link ID field of the record. */ - Ipv4Address GetLinkId(void) const; + Ipv4Address GetLinkId (void) const; /** * @brief Set the Link ID field of the Global Routing Link Record. @@ -122,7 +122,7 @@ public: * * @param addr An Ipv4Address to store in the Link ID field of the record. */ - void SetLinkId(Ipv4Address addr); + void SetLinkId (Ipv4Address addr); /** * @brief Get the Link Data field of the Global Routing Link Record. @@ -135,7 +135,7 @@ public: * * @returns The Ipv4Address corresponding to the Link Data field of the record. */ - Ipv4Address GetLinkData(void) const; + Ipv4Address GetLinkData (void) const; /** * @brief Set the Link Data field of the Global Routing Link Record. @@ -148,7 +148,7 @@ public: * * @param addr An Ipv4Address to store in the Link Data field of the record. */ - void SetLinkData(Ipv4Address addr); + void SetLinkData (Ipv4Address addr); /** * @brief Get the Link Type field of the Global Routing Link Record. @@ -159,7 +159,7 @@ public: * @see LinkType * @returns The LinkType of the current Global Routing Link Record. */ - LinkType GetLinkType(void) const; + LinkType GetLinkType (void) const; /** * @brief Set the Link Type field of the Global Routing Link Record. @@ -170,7 +170,7 @@ public: * @see LinkType * @param linkType The new LinkType for the current Global Routing Link Record. */ - void SetLinkType(LinkType linkType); + void SetLinkType (LinkType linkType); /** * @brief Get the Metric Data field of the Global Routing Link Record. @@ -183,7 +183,7 @@ public: * * @returns The metric field of the Global Routing Link Record. */ - uint16_t GetMetric(void) const; + uint16_t GetMetric (void) const; /** * @brief Set the Metric Data field of the Global Routing Link Record. @@ -196,7 +196,7 @@ public: * * @param metric The new metric for the current Global Routing Link Record. */ - void SetMetric(uint16_t metric); + void SetMetric (uint16_t metric); private: /** @@ -363,7 +363,7 @@ public: * @brief Release all of the Global Routing Link Records present in the Global * Routing Link State Advertisement and make the list of link records empty. */ - void ClearLinkRecords(void); + void ClearLinkRecords (void); /** * @brief Check to see if the list of Global Routing Link Records present in the @@ -371,7 +371,7 @@ public: * * @returns True if the list is empty, false otherwise. */ - bool IsEmpty(void) const; + bool IsEmpty (void) const; /** * @brief Print the contents of the Global Routing Link State Advertisement and @@ -711,8 +711,8 @@ private: virtual ~GlobalRouter (); void ClearLSAs (void); - Ptr GetAdjacent(Ptr nd, Ptr ch) const; - bool FindInterfaceForDevice(Ptr node, Ptr nd, uint32_t &index) const; + Ptr GetAdjacent (Ptr nd, Ptr ch) const; + bool FindInterfaceForDevice (Ptr node, Ptr nd, uint32_t &index) const; Ipv4Address FindDesignatedRouterForLink (Ptr ndLocal, bool allowRecursion) const; bool AnotherRouterOnLink (Ptr nd, bool allowRecursion) const; void ProcessBroadcastLink (Ptr nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c); diff --git a/src/internet/model/icmpv4-l4-protocol.cc b/src/internet/model/icmpv4-l4-protocol.cc index e9272a2f9..948814f4b 100644 --- a/src/internet/model/icmpv4-l4-protocol.cc +++ b/src/internet/model/icmpv4-l4-protocol.cc @@ -63,7 +63,7 @@ Icmpv4L4Protocol::NotifyNewAggregate () ipv4->Insert (this); Ptr rawFactory = CreateObject (); ipv4->AggregateObject (rawFactory); - this->SetDownTarget (MakeCallback(&Ipv4L3Protocol::Send, ipv4)); + this->SetDownTarget (MakeCallback (&Ipv4L3Protocol::Send, ipv4)); } } } @@ -220,9 +220,9 @@ Icmpv4L4Protocol::HandleTimeExceeded (Ptr p, } enum Ipv4L4Protocol::RxStatus -Icmpv4L4Protocol::Receive(Ptr p, - Ipv4Header const &header, - Ptr incomingInterface) +Icmpv4L4Protocol::Receive (Ptr p, + Ipv4Header const &header, + Ptr incomingInterface) { NS_LOG_FUNCTION (this << p << header << incomingInterface); diff --git a/src/internet/model/icmpv4-l4-protocol.h b/src/internet/model/icmpv4-l4-protocol.h index 9571cd7f2..e1976a020 100644 --- a/src/internet/model/icmpv4-l4-protocol.h +++ b/src/internet/model/icmpv4-l4-protocol.h @@ -24,9 +24,9 @@ public: static uint16_t GetStaticProtocolNumber (void); virtual int GetProtocolNumber (void) const; - virtual enum Ipv4L4Protocol::RxStatus Receive(Ptr p, - Ipv4Header const &header, - Ptr incomingInterface); + virtual enum Ipv4L4Protocol::RxStatus Receive (Ptr p, + Ipv4Header const &header, + Ptr incomingInterface); void SendDestUnreachFragNeeded (Ipv4Header header, Ptr orgData, uint16_t nextHopMtu); void SendTimeExceededTtl (Ipv4Header header, Ptr orgData); diff --git a/src/internet/model/ipv4-address-generator.cc b/src/internet/model/ipv4-address-generator.cc index c6dbfa858..4703167d1 100644 --- a/src/internet/model/ipv4-address-generator.cc +++ b/src/internet/model/ipv4-address-generator.cc @@ -23,7 +23,7 @@ #include "ns3/simulation-singleton.h" #include "ipv4-address-generator.h" -NS_LOG_COMPONENT_DEFINE("Ipv4AddressGenerator"); +NS_LOG_COMPONENT_DEFINE ("Ipv4AddressGenerator"); namespace ns3 { @@ -330,7 +330,7 @@ Ipv4AddressGeneratorImpl::AddAllocated (const Ipv4Address address) Entry entry; entry.addrLow = entry.addrHigh = addr; - m_entries.insert(i, entry); + m_entries.insert (i, entry); return true; } @@ -367,7 +367,7 @@ Ipv4AddressGeneratorImpl::MaskToIndex (Ipv4Mask mask) const } maskBits >>= 1; } - NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible"); + NS_ASSERT_MSG (false, "Ipv4AddressGenerator::MaskToIndex(): Impossible"); return 0; } diff --git a/src/internet/model/ipv4-end-point-demux.cc b/src/internet/model/ipv4-end-point-demux.cc index 99a94bb66..0ae869f0f 100644 --- a/src/internet/model/ipv4-end-point-demux.cc +++ b/src/internet/model/ipv4-end-point-demux.cc @@ -180,7 +180,7 @@ Ipv4EndPointDemux::GetAllEndPoints (void) for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++) { Ipv4EndPoint* endP = *i; - ret.push_back(endP); + ret.push_back (endP); } return ret; } @@ -245,15 +245,15 @@ Ipv4EndPointDemux::Lookup (Ipv4Address daddr, uint16_t dport, bool isBroadcast = (daddr.IsBroadcast () || subnetDirected == true); NS_LOG_DEBUG ("dest addr " << daddr << " broadcast? " << isBroadcast); bool localAddressMatchesWildCard = - endP->GetLocalAddress() == Ipv4Address::GetAny(); + endP->GetLocalAddress () == Ipv4Address::GetAny (); bool localAddressMatchesExact = endP->GetLocalAddress () == daddr; if (isBroadcast) { - NS_LOG_DEBUG("Found bcast, localaddr " << endP->GetLocalAddress()); + NS_LOG_DEBUG ("Found bcast, localaddr " << endP->GetLocalAddress ()); } - if (isBroadcast && (endP->GetLocalAddress() != Ipv4Address::GetAny())) + if (isBroadcast && (endP->GetLocalAddress () != Ipv4Address::GetAny ())) { localAddressMatchesExact = (endP->GetLocalAddress () == incomingInterfaceAddr); @@ -262,10 +262,10 @@ Ipv4EndPointDemux::Lookup (Ipv4Address daddr, uint16_t dport, if (!(localAddressMatchesExact || localAddressMatchesWildCard)) continue; bool remotePeerMatchesExact = endP->GetPeerPort () == sport; - bool remotePeerMatchesWildCard = endP->GetPeerPort() == 0; + bool remotePeerMatchesWildCard = endP->GetPeerPort () == 0; bool remoteAddressMatchesExact = endP->GetPeerAddress () == saddr; bool remoteAddressMatchesWildCard = endP->GetPeerAddress () == - Ipv4Address::GetAny(); + Ipv4Address::GetAny (); // If remote does not match either with exact or wildcard, // skip this one if (!(remotePeerMatchesExact || remotePeerMatchesWildCard)) @@ -278,32 +278,32 @@ Ipv4EndPointDemux::Lookup (Ipv4Address daddr, uint16_t dport, remotePeerMatchesWildCard && remoteAddressMatchesWildCard) { // Only local port matches exactly - retval1.push_back(endP); + retval1.push_back (endP); } if ((localAddressMatchesExact || (isBroadcast && localAddressMatchesWildCard))&& remotePeerMatchesWildCard && remoteAddressMatchesWildCard) { // Only local port and local address matches exactly - retval2.push_back(endP); + retval2.push_back (endP); } if (localAddressMatchesWildCard && remotePeerMatchesExact && remoteAddressMatchesExact) { // All but local address - retval3.push_back(endP); + retval3.push_back (endP); } if (localAddressMatchesExact && remotePeerMatchesExact && remoteAddressMatchesExact) { // All 4 match - retval4.push_back(endP); + retval4.push_back (endP); } } // Here we find the most exact match - if (!retval4.empty()) return retval4; - if (!retval3.empty()) return retval3; - if (!retval2.empty()) return retval2; + if (!retval4.empty ()) return retval4; + if (!retval3.empty ()) return retval3; + if (!retval2.empty ()) return retval2; return retval1; // might be empty if no matches } diff --git a/src/internet/model/ipv4-global-routing.cc b/src/internet/model/ipv4-global-routing.cc index d300ecb1e..e35d93e58 100644 --- a/src/internet/model/ipv4-global-routing.cc +++ b/src/internet/model/ipv4-global-routing.cc @@ -43,12 +43,12 @@ Ipv4GlobalRouting::GetTypeId (void) .SetParent () .AddAttribute ("RandomEcmpRouting", "Set to true if packets are randomly routed among ECMP; set to false for using only one route consistently", - BooleanValue(false), + BooleanValue (false), MakeBooleanAccessor (&Ipv4GlobalRouting::m_randomEcmpRouting), MakeBooleanChecker ()) .AddAttribute ("RespondToInterfaceEvents", "Set to true if you want to dynamically recompute the global routes upon Interface notification events (up/down, or add/remove address)", - BooleanValue(false), + BooleanValue (false), MakeBooleanAccessor (&Ipv4GlobalRouting::m_respondToInterfaceEvents), MakeBooleanChecker ()) ; @@ -152,7 +152,7 @@ Ipv4GlobalRouting::LookupGlobal (Ipv4Address dest, Ptr oif) { if (oif != 0) { - if (oif != m_ipv4->GetNetDevice((*i)->GetInterface ())) + if (oif != m_ipv4->GetNetDevice ((*i)->GetInterface ())) { NS_LOG_LOGIC ("Not on requested interface, skipping"); continue; @@ -175,7 +175,7 @@ Ipv4GlobalRouting::LookupGlobal (Ipv4Address dest, Ptr oif) { if (oif != 0) { - if (oif != m_ipv4->GetNetDevice((*j)->GetInterface ())) + if (oif != m_ipv4->GetNetDevice ((*j)->GetInterface ())) { NS_LOG_LOGIC ("Not on requested interface, skipping"); continue; @@ -199,7 +199,7 @@ Ipv4GlobalRouting::LookupGlobal (Ipv4Address dest, Ptr oif) NS_LOG_LOGIC ("Found external route" << *k); if (oif != 0) { - if (oif != m_ipv4->GetNetDevice((*k)->GetInterface ())) + if (oif != m_ipv4->GetNetDevice ((*k)->GetInterface ())) { NS_LOG_LOGIC ("Not on requested interface, skipping"); continue; @@ -229,7 +229,7 @@ Ipv4GlobalRouting::LookupGlobal (Ipv4Address dest, Ptr oif) rtentry = Create (); rtentry->SetDestination (route->GetDest ()); // XXX handle multi-address case - rtentry->SetSource (m_ipv4->GetAddress (route->GetInterface(), 0).GetLocal ()); + rtentry->SetSource (m_ipv4->GetAddress (route->GetInterface (), 0).GetLocal ()); rtentry->SetGateway (route->GetGateway ()); uint32_t interfaceIdx = route->GetInterface (); rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx)); @@ -272,7 +272,7 @@ Ipv4GlobalRouting::GetRoute (uint32_t index) const } index -= m_hostRoutes.size (); uint32_t tmp = 0; - if (index < m_networkRoutes.size()) + if (index < m_networkRoutes.size ()) { for (NetworkRoutesCI j = m_networkRoutes.begin (); j != m_networkRoutes.end (); @@ -285,7 +285,7 @@ Ipv4GlobalRouting::GetRoute (uint32_t index) const tmp++; } } - index -= m_networkRoutes.size(); + index -= m_networkRoutes.size (); tmp = 0; for (ASExternalRoutesCI k = m_ASexternalRoutes.begin (); k != m_ASexternalRoutes.end (); @@ -314,10 +314,10 @@ Ipv4GlobalRouting::RemoveRoute (uint32_t index) { if (tmp == index) { - NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_hostRoutes.size()); + NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_hostRoutes.size ()); delete *i; m_hostRoutes.erase (i); - NS_LOG_LOGIC ("Done removing host route " << index << "; host route remaining size = " << m_hostRoutes.size()); + NS_LOG_LOGIC ("Done removing host route " << index << "; host route remaining size = " << m_hostRoutes.size ()); return; } tmp++; @@ -331,10 +331,10 @@ Ipv4GlobalRouting::RemoveRoute (uint32_t index) { if (tmp == index) { - NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_networkRoutes.size()); + NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_networkRoutes.size ()); delete *j; m_networkRoutes.erase (j); - NS_LOG_LOGIC ("Done removing network route " << index << "; network route remaining size = " << m_networkRoutes.size()); + NS_LOG_LOGIC ("Done removing network route " << index << "; network route remaining size = " << m_networkRoutes.size ()); return; } tmp++; @@ -347,10 +347,10 @@ Ipv4GlobalRouting::RemoveRoute (uint32_t index) { if (tmp == index) { - NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_ASexternalRoutes.size()); + NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_ASexternalRoutes.size ()); delete *k; m_ASexternalRoutes.erase (k); - NS_LOG_LOGIC ("Done removing network route " << index << "; network route remaining size = " << m_networkRoutes.size()); + NS_LOG_LOGIC ("Done removing network route " << index << "; network route remaining size = " << m_networkRoutes.size ()); return; } tmp++; @@ -386,9 +386,9 @@ Ipv4GlobalRouting::DoDispose (void) // Formatted like output of "route -n" command void -Ipv4GlobalRouting::PrintRoutingTable(Ptr stream) const +Ipv4GlobalRouting::PrintRoutingTable (Ptr stream) const { - std::ostream* os = stream->GetStream(); + std::ostream* os = stream->GetStream (); if (GetNRoutes () > 0) { *os << "Destination Gateway Genmask Flags Metric Ref Use Iface" << std::endl; @@ -397,11 +397,11 @@ Ipv4GlobalRouting::PrintRoutingTable(Ptr stream) const std::ostringstream dest, gw, mask, flags; Ipv4RoutingTableEntry route = GetRoute (j); dest << route.GetDest (); - *os << std::setiosflags (std::ios::left) << std::setw (16) << dest.str(); + *os << std::setiosflags (std::ios::left) << std::setw (16) << dest.str (); gw << route.GetGateway (); - *os << std::setiosflags (std::ios::left) << std::setw (16) << gw.str(); + *os << std::setiosflags (std::ios::left) << std::setw (16) << gw.str (); mask << route.GetDestNetworkMask (); - *os << std::setiosflags (std::ios::left) << std::setw (16) << mask.str(); + *os << std::setiosflags (std::ios::left) << std::setw (16) << mask.str (); flags << "U"; if (route.IsHost ()) { @@ -411,7 +411,7 @@ Ipv4GlobalRouting::PrintRoutingTable(Ptr stream) const { flags << "G"; } - *os << std::setiosflags (std::ios::left) << std::setw (6) << flags.str(); + *os << std::setiosflags (std::ios::left) << std::setw (6) << flags.str (); // Metric not implemented *os << "-" << " "; // Ref ct not implemented @@ -424,7 +424,7 @@ Ipv4GlobalRouting::PrintRoutingTable(Ptr stream) const } else { - *os << route.GetInterface(); + *os << route.GetInterface (); } *os << std::endl; } @@ -439,7 +439,7 @@ Ipv4GlobalRouting::RouteOutput (Ptr p, const Ipv4Header &header, Ptr ipv4) { - NS_LOG_FUNCTION(this << ipv4); + NS_LOG_FUNCTION (this << ipv4); NS_ASSERT (m_ipv4 == 0 && ipv4 != 0); m_ipv4 = ipv4; } diff --git a/src/internet/model/ipv4-header.cc b/src/internet/model/ipv4-header.cc index 9ac20b492..5b70d3297 100644 --- a/src/internet/model/ipv4-header.cc +++ b/src/internet/model/ipv4-header.cc @@ -38,7 +38,7 @@ Ipv4Header::Ipv4Header () m_protocol (0), m_flags (0), m_fragmentOffset (0), - m_checksum(0), + m_checksum (0), m_goodChecksum (true) { } @@ -268,7 +268,7 @@ Ipv4Header::Serialize (Buffer::Iterator start) const if (m_calcChecksum) { i = start; - uint16_t checksum = i.CalculateIpChecksum(20); + uint16_t checksum = i.CalculateIpChecksum (20); NS_LOG_LOGIC ("checksum=" <IsMulticast (), - "ArpIpv4Interface::SendTo (): Sending multicast packet over " - "non-multicast device"); + NS_ASSERT_MSG (m_device->IsMulticast (), + "ArpIpv4Interface::SendTo (): Sending multicast packet over " + "non-multicast device"); - hardwareDestination = m_device->GetMulticast(dest); + hardwareDestination = m_device->GetMulticast (dest); found = true; } else @@ -282,7 +282,7 @@ uint32_t Ipv4Interface::GetNAddresses (void) const { NS_LOG_FUNCTION_NOARGS (); - return m_ifaddrs.size(); + return m_ifaddrs.size (); } bool diff --git a/src/internet/model/ipv4-interface.h b/src/internet/model/ipv4-interface.h index 7e9e1646c..3a49e05ec 100644 --- a/src/internet/model/ipv4-interface.h +++ b/src/internet/model/ipv4-interface.h @@ -127,7 +127,7 @@ public: * This method will eventually call the private * SendTo method which must be implemented by subclasses. */ - void Send(Ptr p, Ipv4Address dest); + void Send (Ptr p, Ipv4Address dest); /** * \param address The Ipv4InterfaceAddress to add to the interface diff --git a/src/internet/model/ipv4-l3-protocol.cc b/src/internet/model/ipv4-l3-protocol.cc index 92d6c1e5c..d29b387c9 100644 --- a/src/internet/model/ipv4-l3-protocol.cc +++ b/src/internet/model/ipv4-l3-protocol.cc @@ -93,14 +93,14 @@ Ipv4L3Protocol::~Ipv4L3Protocol () } void -Ipv4L3Protocol::Insert(Ptr protocol) +Ipv4L3Protocol::Insert (Ptr protocol) { m_protocols.push_back (protocol); } Ptr -Ipv4L3Protocol::GetProtocol(int protocolNumber) const +Ipv4L3Protocol::GetProtocol (int protocolNumber) const { - for (L4List_t::const_iterator i = m_protocols.begin(); i != m_protocols.end(); ++i) + for (L4List_t::const_iterator i = m_protocols.begin (); i != m_protocols.end (); ++i) { if ((*i)->GetProtocolNumber () == protocolNumber) { @@ -185,7 +185,7 @@ void Ipv4L3Protocol::DoDispose (void) { NS_LOG_FUNCTION (this); - for (L4List_t::iterator i = m_protocols.begin(); i != m_protocols.end(); ++i) + for (L4List_t::iterator i = m_protocols.begin (); i != m_protocols.end (); ++i) { *i = 0; } @@ -410,8 +410,8 @@ Ipv4L3Protocol::IsDestinationAddress (Ipv4Address address, uint32_t iif) const } void -Ipv4L3Protocol::Receive( Ptr device, Ptr p, uint16_t protocol, const Address &from, - const Address &to, NetDevice::PacketType packetType) +Ipv4L3Protocol::Receive ( Ptr device, Ptr p, uint16_t protocol, const Address &from, + const Address &to, NetDevice::PacketType packetType) { NS_LOG_FUNCTION (this << &device << p << protocol << from); @@ -523,7 +523,7 @@ Ipv4L3Protocol::Send (Ptr packet, uint8_t protocol, Ptr route) { - NS_LOG_FUNCTION (this << packet << source << destination << uint32_t(protocol) << route); + NS_LOG_FUNCTION (this << packet << source << destination << uint32_t (protocol) << route); Ipv4Header ipHeader; bool mayFragment = true; @@ -554,7 +554,7 @@ Ipv4L3Protocol::Send (Ptr packet, Ptr outInterface = *ifaceIter; Ptr packetCopy = packet->Copy (); - NS_ASSERT (packetCopy->GetSize () <= outInterface->GetDevice()->GetMtu ()); + NS_ASSERT (packetCopy->GetSize () <= outInterface->GetDevice ()->GetMtu ()); m_sendOutgoingTrace (ipHeader, packetCopy, ifaceIndex); packetCopy->AddHeader (ipHeader); @@ -740,10 +740,10 @@ Ipv4L3Protocol::IpMulticastForward (Ptr mrtentry, PtrGetId ()); - std::map ttlMap = mrtentry->GetOutputTtlMap(); + std::map ttlMap = mrtentry->GetOutputTtlMap (); std::map::iterator mapIter; - for (mapIter = ttlMap.begin(); mapIter != ttlMap.end(); mapIter++) + for (mapIter = ttlMap.begin (); mapIter != ttlMap.end (); mapIter++) { uint32_t interfaceId = mapIter->first; //uint32_t outputTtl = mapIter->second; // Unused for now @@ -831,7 +831,7 @@ Ipv4L3Protocol::LocalDeliver (Ptr packet, Ipv4Header const&ip, uin for (uint32_t i = 0; i < GetNAddresses (iif); i++) { Ipv4InterfaceAddress addr = GetAddress (iif, i); - if (addr.GetLocal ().CombineMask (addr.GetMask ()) == ip.GetDestination().CombineMask (addr.GetMask ()) && + if (addr.GetLocal ().CombineMask (addr.GetMask ()) == ip.GetDestination ().CombineMask (addr.GetMask ()) && ip.GetDestination ().IsSubnetDirectedBroadcast (addr.GetMask ())) { subnetDirected = true; diff --git a/src/internet/model/ipv4-l3-protocol.h b/src/internet/model/ipv4-l3-protocol.h index 6add4354b..4d9466624 100644 --- a/src/internet/model/ipv4-l3-protocol.h +++ b/src/internet/model/ipv4-l3-protocol.h @@ -106,7 +106,7 @@ public: * a working L4 Protocol and returned from this method. * The caller does not get ownership of the returned pointer. */ - void Insert(Ptr protocol); + void Insert (Ptr protocol); /** * \param protocolNumber number of protocol to lookup * in this L4 Demux @@ -116,7 +116,7 @@ public: * to forward packets up the stack to the right protocol. * It is also called from NodeImpl::GetUdp for example. */ - Ptr GetProtocol(int protocolNumber) const; + Ptr GetProtocol (int protocolNumber) const; /** * \param protocol protocol to remove from this demux. * @@ -146,8 +146,8 @@ public: * \param to address of the destination * \param packetType type of the packet */ - void Receive( Ptr device, Ptr p, uint16_t protocol, const Address &from, - const Address &to, NetDevice::PacketType packetType); + void Receive ( Ptr device, Ptr p, uint16_t protocol, const Address &from, + const Address &to, NetDevice::PacketType packetType); /** * \param packet packet to send diff --git a/src/internet/model/ipv4-l4-protocol.h b/src/internet/model/ipv4-l4-protocol.h index b2cde5efc..0ebdab8de 100644 --- a/src/internet/model/ipv4-l4-protocol.h +++ b/src/internet/model/ipv4-l4-protocol.h @@ -68,9 +68,9 @@ public: * Called from lower-level layers to send the packet up * in the stack. */ - virtual enum RxStatus Receive(Ptr p, - Ipv4Header const &header, - Ptr incomingInterface) = 0; + virtual enum RxStatus Receive (Ptr p, + Ipv4Header const &header, + Ptr incomingInterface) = 0; /** * \param icmpSource the source address of the icmp message diff --git a/src/internet/model/ipv4-list-routing.cc b/src/internet/model/ipv4-list-routing.cc index 151de9b45..1b7516505 100644 --- a/src/internet/model/ipv4-list-routing.cc +++ b/src/internet/model/ipv4-list-routing.cc @@ -72,7 +72,7 @@ void Ipv4ListRouting::PrintRoutingTable (Ptr stream) const { *stream->GetStream () << "Node: " << m_ipv4->GetObject ()->GetId () - << " Time: " << Simulator::Now().GetSeconds () << "s " + << " Time: " << Simulator::Now ().GetSeconds () << "s " << "Ipv4ListRouting table" << std::endl; for (Ipv4RoutingProtocolList::const_iterator i = m_routingProtocols.begin (); i != m_routingProtocols.end (); i++) @@ -142,7 +142,7 @@ Ipv4ListRouting::RouteInput (Ptr p, const Ipv4Header &header, Ptr< NS_LOG_LOGIC ("Address "<< header.GetDestination () << " is a match for local delivery"); if (header.GetDestination ().IsMulticast ()) { - Ptr packetCopy = p->Copy(); + Ptr packetCopy = p->Copy (); lcb (packetCopy, header, iif); retVal = true; // Fall through @@ -210,7 +210,7 @@ Ipv4ListRouting::NotifyInterfaceDown (uint32_t interface) void Ipv4ListRouting::NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address) { - NS_LOG_FUNCTION(this << interface << address); + NS_LOG_FUNCTION (this << interface << address); for (Ipv4RoutingProtocolList::const_iterator rprotoIter = m_routingProtocols.begin (); rprotoIter != m_routingProtocols.end (); @@ -222,7 +222,7 @@ Ipv4ListRouting::NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress addr void Ipv4ListRouting::NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address) { - NS_LOG_FUNCTION(this << interface << address); + NS_LOG_FUNCTION (this << interface << address); for (Ipv4RoutingProtocolList::const_iterator rprotoIter = m_routingProtocols.begin (); rprotoIter != m_routingProtocols.end (); @@ -234,7 +234,7 @@ Ipv4ListRouting::NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress a void Ipv4ListRouting::SetIpv4 (Ptr ipv4) { - NS_LOG_FUNCTION(this << ipv4); + NS_LOG_FUNCTION (this << ipv4); NS_ASSERT (m_ipv4 == 0); for (Ipv4RoutingProtocolList::const_iterator rprotoIter = m_routingProtocols.begin (); diff --git a/src/internet/model/ipv4-raw-socket-impl.cc b/src/internet/model/ipv4-raw-socket-impl.cc index 955ba6290..043c39523 100644 --- a/src/internet/model/ipv4-raw-socket-impl.cc +++ b/src/internet/model/ipv4-raw-socket-impl.cc @@ -235,7 +235,7 @@ Ipv4RawSocketImpl::SendTo (Ptr p, uint32_t flags, } NotifyDataSent (p->GetSize ()); NotifySend (GetTxAvailable ()); - return p->GetSize(); + return p->GetSize (); } else { diff --git a/src/internet/model/ipv4-route.cc b/src/internet/model/ipv4-route.cc index 7a6c0c867..278b1d08c 100644 --- a/src/internet/model/ipv4-route.cc +++ b/src/internet/model/ipv4-route.cc @@ -83,7 +83,7 @@ std::ostream& operator<< (std::ostream& os, Ipv4Route const& route) Ipv4MulticastRoute::Ipv4MulticastRoute () { - m_ttls.clear(); + m_ttls.clear (); } void @@ -129,10 +129,10 @@ Ipv4MulticastRoute::SetOutputTtl (uint32_t oif, uint32_t ttl) { // This TTL value effectively disables the interface std::map::iterator iter; - iter = m_ttls.find(oif); - if (iter != m_ttls.end()) + iter = m_ttls.find (oif); + if (iter != m_ttls.end ()) { - m_ttls.erase(iter); + m_ttls.erase (iter); } } else @@ -145,14 +145,14 @@ uint32_t Ipv4MulticastRoute::GetOutputTtl (uint32_t oif) { // We keep this interface around for compatibility (for now) - std::map::const_iterator iter = m_ttls.find(oif); - if (iter == m_ttls.end()) + std::map::const_iterator iter = m_ttls.find (oif); + if (iter == m_ttls.end ()) return((uint32_t)MAX_TTL); return(iter->second); } std::map -Ipv4MulticastRoute::GetOutputTtlMap() const +Ipv4MulticastRoute::GetOutputTtlMap () const { return(m_ttls); } diff --git a/src/internet/model/ipv4-route.h b/src/internet/model/ipv4-route.h index 954040837..f87b113a0 100644 --- a/src/internet/model/ipv4-route.h +++ b/src/internet/model/ipv4-route.h @@ -151,7 +151,7 @@ public: /** * \return map of output interface Ids and TTLs for this route */ - std::map GetOutputTtlMap() const; + std::map GetOutputTtlMap () const; static const uint32_t MAX_INTERFACES = 16; // Maximum number of multicast interfaces on a router static const uint32_t MAX_TTL = 255; // Maximum time-to-live (TTL) diff --git a/src/internet/model/ipv4-routing-table-entry.cc b/src/internet/model/ipv4-routing-table-entry.cc index a2abcfde6..f74047c84 100644 --- a/src/internet/model/ipv4-routing-table-entry.cc +++ b/src/internet/model/ipv4-routing-table-entry.cc @@ -298,8 +298,8 @@ Ipv4MulticastRoutingTableEntry::GetNOutputInterfaces (void) const uint32_t Ipv4MulticastRoutingTableEntry::GetOutputInterface (uint32_t n) const { - NS_ASSERT_MSG(n < m_outputInterfaces.size (), - "Ipv4MulticastRoutingTableEntry::GetOutputInterface (): index out of bounds"); + NS_ASSERT_MSG (n < m_outputInterfaces.size (), + "Ipv4MulticastRoutingTableEntry::GetOutputInterface (): index out of bounds"); return m_outputInterfaces[n]; } diff --git a/src/internet/model/ipv4-static-routing.cc b/src/internet/model/ipv4-static-routing.cc index a0738a0c8..ab11b7b45 100644 --- a/src/internet/model/ipv4-static-routing.cc +++ b/src/internet/model/ipv4-static-routing.cc @@ -71,7 +71,7 @@ Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network, networkMask, nextHop, interface); - m_networkRoutes.push_back (make_pair(route,metric)); + m_networkRoutes.push_back (make_pair (route,metric)); } void @@ -117,10 +117,10 @@ Ipv4StaticRouting::SetDefaultRoute (Ipv4Address nextHop, } void -Ipv4StaticRouting::AddMulticastRoute(Ipv4Address origin, - Ipv4Address group, - uint32_t inputInterface, - std::vector outputInterfaces) +Ipv4StaticRouting::AddMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface, + std::vector outputInterfaces) { NS_LOG_FUNCTION (this << origin << " " << group << " " << inputInterface); Ipv4MulticastRoutingTableEntry *route = new Ipv4MulticastRoutingTableEntry (); @@ -133,7 +133,7 @@ Ipv4StaticRouting::AddMulticastRoute(Ipv4Address origin, // these routes are _not_ consulted in the forwarding process-- only // for originating packets void -Ipv4StaticRouting::SetDefaultMulticastRoute(uint32_t outputInterface) +Ipv4StaticRouting::SetDefaultMulticastRoute (uint32_t outputInterface) { NS_LOG_FUNCTION (this << outputInterface); Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry (); @@ -142,7 +142,7 @@ Ipv4StaticRouting::SetDefaultMulticastRoute(uint32_t outputInterface) *route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network, networkMask, outputInterface); - m_networkRoutes.push_back (make_pair(route,0)); + m_networkRoutes.push_back (make_pair (route,0)); } uint32_t @@ -156,8 +156,8 @@ Ipv4MulticastRoutingTableEntry Ipv4StaticRouting::GetMulticastRoute (uint32_t index) const { NS_LOG_FUNCTION (this << index); - NS_ASSERT_MSG(index < m_multicastRoutes.size (), - "Ipv4StaticRouting::GetMulticastRoute (): Index out of range"); + NS_ASSERT_MSG (index < m_multicastRoutes.size (), + "Ipv4StaticRouting::GetMulticastRoute (): Index out of range"); if (index < m_multicastRoutes.size ()) { @@ -177,9 +177,9 @@ Ipv4StaticRouting::GetMulticastRoute (uint32_t index) const } bool -Ipv4StaticRouting::RemoveMulticastRoute(Ipv4Address origin, - Ipv4Address group, - uint32_t inputInterface) +Ipv4StaticRouting::RemoveMulticastRoute (Ipv4Address origin, + Ipv4Address group, + uint32_t inputInterface) { NS_LOG_FUNCTION (this << origin << " " << group << " " << inputInterface); for (MulticastRoutesI i = m_multicastRoutes.begin (); @@ -200,7 +200,7 @@ Ipv4StaticRouting::RemoveMulticastRoute(Ipv4Address origin, } void -Ipv4StaticRouting::RemoveMulticastRoute(uint32_t index) +Ipv4StaticRouting::RemoveMulticastRoute (uint32_t index) { NS_LOG_FUNCTION (this << index); uint32_t tmp = 0; @@ -498,8 +498,8 @@ Ipv4StaticRouting::RouteInput (Ptr p, const Ipv4Header &ipHeader, if (ipHeader.GetDestination ().IsMulticast ()) { NS_LOG_LOGIC ("Multicast destination"); - Ptr mrtentry = LookupStatic(ipHeader.GetSource (), - ipHeader.GetDestination (), m_ipv4->GetInterfaceForDevice (idev)); + Ptr mrtentry = LookupStatic (ipHeader.GetSource (), + ipHeader.GetDestination (), m_ipv4->GetInterfaceForDevice (idev)); if (mrtentry) { @@ -611,7 +611,7 @@ Ipv4StaticRouting::NotifyInterfaceUp (uint32_t i) { if (m_ipv4->GetAddress (i,j).GetLocal () != Ipv4Address () && m_ipv4->GetAddress (i,j).GetMask () != Ipv4Mask () && - m_ipv4->GetAddress (i,j).GetMask () != Ipv4Mask::GetOnes()) + m_ipv4->GetAddress (i,j).GetMask () != Ipv4Mask::GetOnes ()) { AddNetworkRouteTo (m_ipv4->GetAddress (i,j).GetLocal ().CombineMask (m_ipv4->GetAddress (i,j).GetMask ()), m_ipv4->GetAddress (i,j).GetMask (), i); @@ -625,7 +625,7 @@ Ipv4StaticRouting::NotifyInterfaceDown (uint32_t i) NS_LOG_FUNCTION (this << i); // Remove all static routes that are going through this interface uint32_t j = 0; - while (j < GetNRoutes()) + while (j < GetNRoutes ()) { Ipv4RoutingTableEntry route = GetRoute (j); if (route.GetInterface () == i) @@ -642,7 +642,7 @@ Ipv4StaticRouting::NotifyInterfaceDown (uint32_t i) void Ipv4StaticRouting::NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address) { - NS_LOG_FUNCTION (this << interface << " " << address.GetLocal()); + NS_LOG_FUNCTION (this << interface << " " << address.GetLocal ()); if (!m_ipv4->IsUp (interface)) { return; @@ -660,7 +660,7 @@ Ipv4StaticRouting::NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress ad void Ipv4StaticRouting::NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address) { - NS_LOG_FUNCTION (this << interface << " " << address.GetLocal()); + NS_LOG_FUNCTION (this << interface << " " << address.GetLocal ()); if (!m_ipv4->IsUp (interface)) { return; @@ -705,7 +705,7 @@ Ipv4StaticRouting::SetIpv4 (Ptr ipv4) void Ipv4StaticRouting::PrintRoutingTable (Ptr stream) const { - std::ostream* os = stream->GetStream(); + std::ostream* os = stream->GetStream (); if (GetNRoutes () > 0) { *os << "Destination Gateway Genmask Flags Metric Ref Use Iface" << std::endl; @@ -714,11 +714,11 @@ Ipv4StaticRouting::PrintRoutingTable (Ptr stream) const std::ostringstream dest, gw, mask, flags; Ipv4RoutingTableEntry route = GetRoute (j); dest << route.GetDest (); - *os << std::setiosflags (std::ios::left) << std::setw (16) << dest.str(); + *os << std::setiosflags (std::ios::left) << std::setw (16) << dest.str (); gw << route.GetGateway (); - *os << std::setiosflags (std::ios::left) << std::setw (16) << gw.str(); + *os << std::setiosflags (std::ios::left) << std::setw (16) << gw.str (); mask << route.GetDestNetworkMask (); - *os << std::setiosflags (std::ios::left) << std::setw (16) << mask.str(); + *os << std::setiosflags (std::ios::left) << std::setw (16) << mask.str (); flags << "U"; if (route.IsHost ()) { @@ -728,7 +728,7 @@ Ipv4StaticRouting::PrintRoutingTable (Ptr stream) const { flags << "GS"; } - *os << std::setiosflags (std::ios::left) << std::setw (6) << flags.str(); + *os << std::setiosflags (std::ios::left) << std::setw (6) << flags.str (); // Metric not implemented *os << "-" << " "; // Ref ct not implemented @@ -741,7 +741,7 @@ Ipv4StaticRouting::PrintRoutingTable (Ptr stream) const } else { - *os << route.GetInterface(); + *os << route.GetInterface (); } *os << std::endl; } diff --git a/src/internet/model/ipv4.h b/src/internet/model/ipv4.h index b8fe9bcfb..7b0d39724 100644 --- a/src/internet/model/ipv4.h +++ b/src/internet/model/ipv4.h @@ -149,7 +149,7 @@ public: * Adds a protocol to an internal list of L4 protocols. * */ - virtual void Insert(Ptr protocol) = 0; + virtual void Insert (Ptr protocol) = 0; /** * \brief Determine whether address and interface corresponding to diff --git a/src/internet/model/ipv6-extension.cc b/src/internet/model/ipv6-extension.cc index 02b6e2bf2..7cf48e299 100644 --- a/src/internet/model/ipv6-extension.cc +++ b/src/internet/model/ipv6-extension.cc @@ -97,7 +97,7 @@ uint8_t Ipv6Extension::ProcessOptions (Ptr& packet, uint8_t offset, uint Ptr ipv6Option; uint8_t processedSize = 0; - uint32_t size = p->GetSize(); + uint32_t size = p->GetSize (); uint8_t *data = new uint8_t[size]; p->CopyData (data, size); @@ -655,7 +655,7 @@ uint8_t Ipv6ExtensionRouting::Process (Ptr& packet, uint8_t offset, Ipv6 p->RemoveAtStart (offset); uint8_t buf[4]; - packet->CopyData(buf, sizeof(buf)); + packet->CopyData (buf, sizeof(buf)); uint8_t routingNextHeader = buf[0]; uint8_t routingLength = buf[1]; diff --git a/src/internet/model/ipv6-header.cc b/src/internet/model/ipv6-header.cc index d23ffcfdf..7399b841d 100644 --- a/src/internet/model/ipv6-header.cc +++ b/src/internet/model/ipv6-header.cc @@ -152,10 +152,10 @@ void Ipv6Header::Serialize (Buffer::Iterator start) const vTcFl= (6 << 28) | (m_trafficClass << 20) | (m_flowLabel); - i.WriteHtonU32(vTcFl); - i.WriteHtonU16(m_payloadLength); - i.WriteU8(m_nextHeader); - i.WriteU8(m_hopLimit); + i.WriteHtonU32 (vTcFl); + i.WriteHtonU16 (m_payloadLength); + i.WriteU8 (m_nextHeader); + i.WriteU8 (m_hopLimit); WriteTo (i, m_sourceAddress); WriteTo (i, m_destinationAddress); @@ -166,16 +166,16 @@ uint32_t Ipv6Header::Deserialize (Buffer::Iterator start) Buffer::Iterator i = start; uint32_t vTcFl = 0; - vTcFl = i.ReadNtohU32(); + vTcFl = i.ReadNtohU32 (); m_version = vTcFl >> 28; NS_ASSERT ((m_version) == 6); m_trafficClass = (uint8_t)((vTcFl >> 20) & 0x000000ff); m_flowLabel = vTcFl & 0xfff00000; - m_payloadLength = i.ReadNtohU16(); - m_nextHeader = i.ReadU8(); - m_hopLimit = i.ReadU8(); + m_payloadLength = i.ReadNtohU16 (); + m_nextHeader = i.ReadU8 (); + m_hopLimit = i.ReadU8 (); ReadFrom (i, m_sourceAddress); ReadFrom (i, m_destinationAddress); diff --git a/src/internet/model/ipv6-l3-protocol.cc b/src/internet/model/ipv6-l3-protocol.cc index ed12a713b..3db0d9284 100644 --- a/src/internet/model/ipv6-l3-protocol.cc +++ b/src/internet/model/ipv6-l3-protocol.cc @@ -636,16 +636,16 @@ void Ipv6L3Protocol::Send (Ptr packet, Ipv6Address source, Ipv6Address d hdr = BuildHeader (source, destination, protocol, packet->GetSize (), ttl); //for link-local traffic, we need to determine the interface - if (source.IsLinkLocal() || - destination.IsLinkLocal() || - destination.IsAllNodesMulticast() || - destination.IsAllRoutersMulticast() || - destination.IsAllHostsMulticast() || - destination.IsSolicitedMulticast()) + if (source.IsLinkLocal () || + destination.IsLinkLocal () || + destination.IsAllNodesMulticast () || + destination.IsAllRoutersMulticast () || + destination.IsAllHostsMulticast () || + destination.IsSolicitedMulticast ()) { int32_t index = GetInterfaceForAddress (source); NS_ASSERT (index >= 0); - oif = GetNetDevice(index); + oif = GetNetDevice (index); } newRoute = m_routingProtocol->RouteOutput (packet, hdr, oif, err); @@ -657,7 +657,7 @@ void Ipv6L3Protocol::Send (Ptr packet, Ipv6Address source, Ipv6Address d else { NS_LOG_WARN ("No route to host, drop!"); - m_dropTrace (hdr, packet, DROP_NO_ROUTE, m_node->GetObject (), GetInterfaceForDevice(oif)); + m_dropTrace (hdr, packet, DROP_NO_ROUTE, m_node->GetObject (), GetInterfaceForDevice (oif)); } } @@ -910,10 +910,10 @@ void Ipv6L3Protocol::IpMulticastForward (Ptr mrtentry, PtrGetId ()); - std::map ttlMap = mrtentry->GetOutputTtlMap(); + std::map ttlMap = mrtentry->GetOutputTtlMap (); std::map::iterator mapIter; - for (mapIter = ttlMap.begin(); mapIter != ttlMap.end(); mapIter++) + for (mapIter = ttlMap.begin (); mapIter != ttlMap.end (); mapIter++) { uint32_t interfaceId = mapIter->first; //uint32_t outputTtl = mapIter->second; // Unused for now @@ -954,7 +954,7 @@ void Ipv6L3Protocol::LocalDeliver (Ptr packet, Ipv6Header const& i if (nextHeader == Ipv6Header::IPV6_EXT_HOP_BY_HOP) { uint8_t buf[2]; - p->CopyData(buf, sizeof(buf)); + p->CopyData (buf, sizeof(buf)); nextHeader = buf[0]; nextHeaderPosition = buf[1]; } diff --git a/src/internet/model/ipv6-option-demux.h b/src/internet/model/ipv6-option-demux.h index 3349744ce..f5a90a7ab 100644 --- a/src/internet/model/ipv6-option-demux.h +++ b/src/internet/model/ipv6-option-demux.h @@ -83,7 +83,7 @@ protected: /** * \brief Dispose this object. */ - virtual void DoDispose(); + virtual void DoDispose (); private: typedef std::list > Ipv6OptionList_t; diff --git a/src/internet/model/ipv6-route.cc b/src/internet/model/ipv6-route.cc index b39235761..9ea3994d2 100644 --- a/src/internet/model/ipv6-route.cc +++ b/src/internet/model/ipv6-route.cc @@ -82,7 +82,7 @@ std::ostream& operator<< (std::ostream& os, Ipv6Route const& route) Ipv6MulticastRoute::Ipv6MulticastRoute () { - m_ttls.clear(); + m_ttls.clear (); } Ipv6MulticastRoute::~Ipv6MulticastRoute () @@ -125,10 +125,10 @@ void Ipv6MulticastRoute::SetOutputTtl (uint32_t oif, uint32_t ttl) { // This TTL value effectively disables the interface std::map::iterator iter; - iter = m_ttls.find(oif); - if (iter != m_ttls.end()) + iter = m_ttls.find (oif); + if (iter != m_ttls.end ()) { - m_ttls.erase(iter); + m_ttls.erase (iter); } } else @@ -140,13 +140,13 @@ void Ipv6MulticastRoute::SetOutputTtl (uint32_t oif, uint32_t ttl) uint32_t Ipv6MulticastRoute::GetOutputTtl (uint32_t oif) { // We keep this interface around for compatibility (for now) - std::map::const_iterator iter = m_ttls.find(oif); - if (iter == m_ttls.end()) + std::map::const_iterator iter = m_ttls.find (oif); + if (iter == m_ttls.end ()) return((uint32_t)MAX_TTL); return(iter->second); } -std::map Ipv6MulticastRoute::GetOutputTtlMap() const +std::map Ipv6MulticastRoute::GetOutputTtlMap () const { return(m_ttls); } diff --git a/src/internet/model/ipv6-route.h b/src/internet/model/ipv6-route.h index 24997078b..1227c36b9 100644 --- a/src/internet/model/ipv6-route.h +++ b/src/internet/model/ipv6-route.h @@ -206,7 +206,7 @@ public: /** * \return map of output interface Ids and TTLs for this route */ - std::map GetOutputTtlMap() const; + std::map GetOutputTtlMap () const; private: /** diff --git a/src/internet/model/loopback-net-device.cc b/src/internet/model/loopback-net-device.cc index b68577528..69fde8fef 100644 --- a/src/internet/model/loopback-net-device.cc +++ b/src/internet/model/loopback-net-device.cc @@ -79,13 +79,13 @@ LoopbackNetDevice::Receive (Ptr packet, uint16_t protocol, } void -LoopbackNetDevice::SetIfIndex(const uint32_t index) +LoopbackNetDevice::SetIfIndex (const uint32_t index) { m_ifIndex = index; } uint32_t -LoopbackNetDevice::GetIfIndex(void) const +LoopbackNetDevice::GetIfIndex (void) const { return m_ifIndex; } @@ -186,7 +186,7 @@ LoopbackNetDevice::Send (Ptr packet, const Address& dest, uint16_t proto } bool -LoopbackNetDevice::SendFrom(Ptr packet, const Address& source, const Address& dest, uint16_t protocolNumber) +LoopbackNetDevice::SendFrom (Ptr packet, const Address& source, const Address& dest, uint16_t protocolNumber) { NS_LOG_FUNCTION (packet << " " << source << " " << dest << " " << protocolNumber); Mac48Address to = Mac48Address::ConvertFrom (dest); diff --git a/src/internet/model/loopback-net-device.h b/src/internet/model/loopback-net-device.h index 084fa5bd0..c86f08375 100644 --- a/src/internet/model/loopback-net-device.h +++ b/src/internet/model/loopback-net-device.h @@ -42,8 +42,8 @@ public: LoopbackNetDevice (); // inherited from NetDevice base class. - virtual void SetIfIndex(const uint32_t index); - virtual uint32_t GetIfIndex(void) const; + virtual void SetIfIndex (const uint32_t index); + virtual uint32_t GetIfIndex (void) const; virtual Ptr GetChannel (void) const; virtual void SetAddress (Address address); virtual Address GetAddress (void) const; @@ -57,8 +57,8 @@ public: virtual Address GetMulticast (Ipv4Address multicastGroup) const; virtual bool IsPointToPoint (void) const; virtual bool IsBridge (void) const; - virtual bool Send(Ptr packet, const Address& dest, uint16_t protocolNumber); - virtual bool SendFrom(Ptr packet, const Address& source, const Address& dest, uint16_t protocolNumber); + virtual bool Send (Ptr packet, const Address& dest, uint16_t protocolNumber); + virtual bool SendFrom (Ptr packet, const Address& source, const Address& dest, uint16_t protocolNumber); virtual Ptr GetNode (void) const; virtual void SetNode (Ptr node); virtual bool NeedsArp (void) const; diff --git a/src/internet/model/ndisc-cache.cc b/src/internet/model/ndisc-cache.cc index 87c92f5d7..78cc96b7d 100644 --- a/src/internet/model/ndisc-cache.cc +++ b/src/internet/model/ndisc-cache.cc @@ -154,10 +154,10 @@ NdiscCache::Entry::Entry (NdiscCache* nd) m_waiting (), m_router (false), m_reachableTimer (Timer::CANCEL_ON_DESTROY), - m_retransTimer(Timer::CANCEL_ON_DESTROY), - m_probeTimer(Timer::CANCEL_ON_DESTROY), - m_delayTimer(Timer::CANCEL_ON_DESTROY), - m_lastReachabilityConfirmation(Seconds (0.0)), + m_retransTimer (Timer::CANCEL_ON_DESTROY), + m_probeTimer (Timer::CANCEL_ON_DESTROY), + m_delayTimer (Timer::CANCEL_ON_DESTROY), + m_lastReachabilityConfirmation (Seconds (0.0)), m_nsRetransmit (0) { NS_LOG_FUNCTION_NOARGS (); diff --git a/src/internet/model/nsc-sysctl.cc b/src/internet/model/nsc-sysctl.cc index 3676bff68..1a9c7636a 100644 --- a/src/internet/model/nsc-sysctl.cc +++ b/src/internet/model/nsc-sysctl.cc @@ -36,12 +36,12 @@ private: std::string m_name; }; -bool NscStackStringAccessor::HasGetter(void) const +bool NscStackStringAccessor::HasGetter (void) const { return true; } -bool NscStackStringAccessor::HasSetter(void) const +bool NscStackStringAccessor::HasSetter (void) const { return true; } @@ -106,7 +106,7 @@ Ns3NscStack::GetInstanceTypeId (void) const tid = TypeId (name.c_str ()); tid.SetParent (); char buf[256]; - for (int i=0; m_stack->sysctl_getnum(i, buf, sizeof(buf)) > 0; i++) + for (int i=0; m_stack->sysctl_getnum (i, buf, sizeof(buf)) > 0; i++) { char value[256]; if (m_stack->sysctl_get (buf, value, sizeof(value)) > 0) @@ -129,7 +129,7 @@ Ns3NscStack::Get (std::string name) const { // name.c_str () is not a valid sysctl name, or internal NSC error (eg. error converting value) return NULL; } - return std::string(buf); + return std::string (buf); } void diff --git a/src/internet/model/nsc-tcp-l4-protocol.cc b/src/internet/model/nsc-tcp-l4-protocol.cc index 7e9560365..9da58dfd0 100644 --- a/src/internet/model/nsc-tcp-l4-protocol.cc +++ b/src/internet/model/nsc-tcp-l4-protocol.cc @@ -59,9 +59,9 @@ class NscInterfaceImpl : public ISendCallback, public IInterruptCallback public: NscInterfaceImpl (Ptr prot); private: - virtual void send_callback(const void *data, int datalen); - virtual void wakeup(); - virtual void gettime(unsigned int *, unsigned int *); + virtual void send_callback (const void *data, int datalen); + virtual void wakeup (); + virtual void gettime (unsigned int *, unsigned int *); private: Ptr m_prot; }; @@ -72,17 +72,17 @@ NscInterfaceImpl::NscInterfaceImpl (Ptr prot) } void -NscInterfaceImpl::send_callback(const void *data, int datalen) +NscInterfaceImpl::send_callback (const void *data, int datalen) { m_prot->send_callback (data, datalen); } void -NscInterfaceImpl::wakeup() +NscInterfaceImpl::wakeup () { m_prot->wakeup (); } void -NscInterfaceImpl::gettime(unsigned int *sec, unsigned int *usec) +NscInterfaceImpl::gettime (unsigned int *sec, unsigned int *usec) { m_prot->gettime (sec,usec); } @@ -105,14 +105,14 @@ NscTcpL4Protocol::GetTypeId (void) .AddAttribute ("Library", "Set the linux library to be used to create the stack", TypeId::ATTR_GET|TypeId::ATTR_CONSTRUCT, - StringValue("liblinux2.6.26.so"), + StringValue ("liblinux2.6.26.so"), MakeStringAccessor (&NscTcpL4Protocol::GetNscLibrary,&NscTcpL4Protocol::SetNscLibrary), MakeStringChecker ()) ; return tid; } -int external_rand() +int external_rand () { return 1; // TODO } @@ -124,25 +124,25 @@ NscTcpL4Protocol::NscTcpL4Protocol () m_softTimer (Timer::CANCEL_ON_DESTROY) { m_dlopenHandle = NULL; - NS_LOG_LOGIC("Made a NscTcpL4Protocol "< node) return; } - NS_ASSERT(m_dlopenHandle); + NS_ASSERT (m_dlopenHandle); - FCreateStack create = (FCreateStack)dlsym(m_dlopenHandle, "nsc_create_stack"); - NS_ASSERT(create); - m_nscStack = create(m_nscInterface, m_nscInterface, external_rand); - int hzval = m_nscStack->get_hz(); + FCreateStack create = (FCreateStack)dlsym (m_dlopenHandle, "nsc_create_stack"); + NS_ASSERT (create); + m_nscStack = create (m_nscInterface, m_nscInterface, external_rand); + int hzval = m_nscStack->get_hz (); - NS_ASSERT(hzval > 0); + NS_ASSERT (hzval > 0); m_softTimer.SetFunction (&NscTcpL4Protocol::SoftInterrupt, this); m_softTimer.SetDelay (MilliSeconds (1000/hzval)); - m_nscStack->init(hzval); + m_nscStack->init (hzval); // This enables stack and NSC debug messages // m_nscStack->set_diagnostic(1000); @@ -203,7 +203,7 @@ NscTcpL4Protocol::NotifyNewAggregate () Ptr tcpFactory = CreateObject (); tcpFactory->SetTcp (this); node->AggregateObject (tcpFactory); - this->SetDownTarget (MakeCallback(&Ipv4L3Protocol::Send, ipv4)); + this->SetDownTarget (MakeCallback (&Ipv4L3Protocol::Send, ipv4)); } } } @@ -308,7 +308,7 @@ NscTcpL4Protocol::Receive (Ptr packet, { NS_LOG_FUNCTION (this << packet << header << incomingInterface); Ipv4Header ipHeader; - uint32_t packetSize = packet->GetSize(); + uint32_t packetSize = packet->GetSize (); // The way things work at the moment, the IP header has been removed // by the ns-3 IPv4 processing code. However, the NSC stack expects @@ -323,15 +323,15 @@ NscTcpL4Protocol::Receive (Ptr packet, // all NSC stacks check the IP checksum ipHeader.EnableChecksum (); - packet->AddHeader(ipHeader); - packetSize = packet->GetSize(); + packet->AddHeader (ipHeader); + packetSize = packet->GetSize (); uint8_t *buf = new uint8_t[packetSize]; packet->CopyData (buf, packetSize); const uint8_t *data = const_cast(buf); // deliver complete packet to the NSC network stack - m_nscStack->if_receive_packet(0, data, packetSize); + m_nscStack->if_receive_packet (0, data, packetSize); delete[] buf; wakeup (); @@ -345,12 +345,12 @@ void NscTcpL4Protocol::SoftInterrupt (void) m_softTimer.Schedule (); } -void NscTcpL4Protocol::send_callback(const void* data, int datalen) +void NscTcpL4Protocol::send_callback (const void* data, int datalen) { Ptr p; uint32_t ipv4Saddr, ipv4Daddr; - NS_ASSERT(datalen > 20); + NS_ASSERT (datalen > 20); // create packet, without IP header. The TCP header is not touched. @@ -366,17 +366,17 @@ void NscTcpL4Protocol::send_callback(const void* data, int datalen) ipv4Saddr = *(ipheader+3); ipv4Daddr = *(ipheader+4); - Ipv4Address saddr(ntohl(ipv4Saddr)); - Ipv4Address daddr(ntohl(ipv4Daddr)); + Ipv4Address saddr (ntohl (ipv4Saddr)); + Ipv4Address daddr (ntohl (ipv4Daddr)); Ptr ipv4 = m_node->GetObject (); NS_ASSERT_MSG (ipv4, "nsc callback invoked, but node has no ipv4 object"); m_downTarget (p, saddr, daddr, PROT_NUMBER, 0); - m_nscStack->if_send_finish(0); + m_nscStack->if_send_finish (0); } -void NscTcpL4Protocol::wakeup() +void NscTcpL4Protocol::wakeup () { // TODO // this should schedule a timer to read from all tcp sockets now... this is @@ -386,11 +386,11 @@ void NscTcpL4Protocol::wakeup() for (Ipv4EndPointDemux::EndPointsI endPoint = endPoints.begin (); endPoint != endPoints.end (); endPoint++) { // NSC HACK: (ab)use TcpSocket::ForwardUp for signalling - (*endPoint)->ForwardUp (NULL, Ipv4Header(), 0, 0); + (*endPoint)->ForwardUp (NULL, Ipv4Header (), 0, 0); } } -void NscTcpL4Protocol::gettime(unsigned int* sec, unsigned int* usec) +void NscTcpL4Protocol::gettime (unsigned int* sec, unsigned int* usec) { // Only used by the Linux network stack, e.g. during ISN generation // and in the kernel rng initialization routine. Also used in Linux @@ -402,7 +402,7 @@ void NscTcpL4Protocol::gettime(unsigned int* sec, unsigned int* usec) } -void NscTcpL4Protocol::AddInterface(void) +void NscTcpL4Protocol::AddInterface (void) { Ptr ip = m_node->GetObject (); const uint32_t nInterfaces = ip->GetNInterfaces (); @@ -421,16 +421,16 @@ void NscTcpL4Protocol::AddInterface(void) std::ostringstream addrOss, maskOss; - addr.Print(addrOss); - mask.Print(maskOss); + addr.Print (addrOss); + mask.Print (maskOss); - NS_LOG_LOGIC ("if_attach " << addrOss.str().c_str() << " " << maskOss.str().c_str() << " " << mtu); + NS_LOG_LOGIC ("if_attach " << addrOss.str ().c_str () << " " << maskOss.str ().c_str () << " " << mtu); - std::string addrStr = addrOss.str(); - std::string maskStr = maskOss.str(); - const char* addrCStr = addrStr.c_str(); - const char* maskCStr = maskStr.c_str(); - m_nscStack->if_attach(addrCStr, maskCStr, mtu); + std::string addrStr = addrOss.str (); + std::string maskStr = maskOss.str (); + const char* addrCStr = addrStr.c_str (); + const char* maskCStr = maskStr.c_str (); + m_nscStack->if_attach (addrCStr, maskCStr, mtu); if (i == 1) { @@ -438,7 +438,7 @@ void NscTcpL4Protocol::AddInterface(void) // correct really... uint8_t addrBytes[4]; - addr.Serialize(addrBytes); + addr.Serialize (addrBytes); // XXX: this is all a bit of a horrible hack // @@ -448,10 +448,10 @@ void NscTcpL4Protocol::AddInterface(void) // All we need is another address on the same network as the interface. This // will force the stack to output the packet out of the network interface. addrBytes[3]++; - addr.Deserialize(addrBytes); - addrOss.str(""); - addr.Print(addrOss); - m_nscStack->add_default_gateway(addrOss.str().c_str()); + addr.Deserialize (addrBytes); + addrOss.str (""); + addr.Print (addrOss); + m_nscStack->add_default_gateway (addrOss.str ().c_str ()); } } } diff --git a/src/internet/model/nsc-tcp-l4-protocol.h b/src/internet/model/nsc-tcp-l4-protocol.h index d6c29773f..fb83541d3 100644 --- a/src/internet/model/nsc-tcp-l4-protocol.h +++ b/src/internet/model/nsc-tcp-l4-protocol.h @@ -102,15 +102,15 @@ private: // send_callback is invoked by NSCs 'ethernet driver' to re-inject // a packet (i.e. an octet soup consisting of an IP Header, TCP Header // and user payload, if any), into ns-3. - void send_callback(const void *data, int datalen); + void send_callback (const void *data, int datalen); // This is called by the NSC stack whenever something of interest // has happened, e.g. when data arrives on a socket, a listen socket // has a new connection pending, etc. - void wakeup(); + void wakeup (); // This is called by the Linux stack RNG initialization. // Its also used by the cradle code to add a timestamp to // printk/printf/debug output. - void gettime(unsigned int *sec, unsigned int *usec); + void gettime (unsigned int *sec, unsigned int *usec); void AddInterface (void); void SoftInterrupt (void); friend class NscInterfaceImpl; diff --git a/src/internet/model/nsc-tcp-socket-impl.cc b/src/internet/model/nsc-tcp-socket-impl.cc index d982b8b00..6d8d67d20 100644 --- a/src/internet/model/nsc-tcp-socket-impl.cc +++ b/src/internet/model/nsc-tcp-socket-impl.cc @@ -53,7 +53,7 @@ NS_OBJECT_ENSURE_REGISTERED (NscTcpSocketImpl); TypeId NscTcpSocketImpl::GetTypeId () { - static TypeId tid = TypeId("ns3::NscTcpSocketImpl") + static TypeId tid = TypeId ("ns3::NscTcpSocketImpl") .SetParent () .AddTraceSource ("CongestionWindow", "The TCP connection's congestion window", @@ -76,13 +76,13 @@ NscTcpSocketImpl::NscTcpSocketImpl () m_state (CLOSED), m_closeOnEmpty (false), m_txBufferSize (0), - m_lastMeasuredRtt (Seconds(0.0)) + m_lastMeasuredRtt (Seconds (0.0)) { NS_LOG_FUNCTION (this); } NscTcpSocketImpl::NscTcpSocketImpl(const NscTcpSocketImpl& sock) - : TcpSocket(sock), //copy the base class callbacks + : TcpSocket (sock), //copy the base class callbacks m_delAckMaxCount (sock.m_delAckMaxCount), m_delAckTimeout (sock.m_delAckTimeout), m_endPoint (0), @@ -106,7 +106,7 @@ NscTcpSocketImpl::NscTcpSocketImpl(const NscTcpSocketImpl& sock) m_cWnd (sock.m_cWnd), m_ssThresh (sock.m_ssThresh), m_initialCWnd (sock.m_initialCWnd), - m_lastMeasuredRtt (Seconds(0.0)), + m_lastMeasuredRtt (Seconds (0.0)), m_cnTimeout (sock.m_cnTimeout), m_cnCount (sock.m_cnCount), m_rxAvailable (0), @@ -114,7 +114,7 @@ NscTcpSocketImpl::NscTcpSocketImpl(const NscTcpSocketImpl& sock) m_sndBufSize (sock.m_sndBufSize) { NS_LOG_FUNCTION_NOARGS (); - NS_LOG_LOGIC("Invoked the copy constructor"); + NS_LOG_LOGIC ("Invoked the copy constructor"); //copy the pending data if necessary if(!sock.m_txBuffer.empty () ) { @@ -126,7 +126,7 @@ NscTcpSocketImpl::NscTcpSocketImpl(const NscTcpSocketImpl& sock) NscTcpSocketImpl::~NscTcpSocketImpl () { - NS_LOG_FUNCTION(this); + NS_LOG_FUNCTION (this); m_node = 0; if (m_endPoint != 0) { @@ -158,7 +158,7 @@ NscTcpSocketImpl::SetNode (Ptr node) void NscTcpSocketImpl::SetTcp (Ptr tcp) { - m_nscTcpSocket = tcp->m_nscStack->new_tcp_socket(); + m_nscTcpSocket = tcp->m_nscStack->new_tcp_socket (); m_tcp = tcp; } @@ -276,13 +276,13 @@ NscTcpSocketImpl::Close (void) if (!m_txBuffer.empty ()) { // App close with pending data must wait until all data transmitted m_closeOnEmpty = true; - NS_LOG_LOGIC("Socket " << this << - " deferring close, state " << m_state); + NS_LOG_LOGIC ("Socket " << this << + " deferring close, state " << m_state); return 0; } - NS_LOG_LOGIC("NscTcp socket " << this << " calling disconnect(); moving to CLOSED"); - m_nscTcpSocket->disconnect(); + NS_LOG_LOGIC ("NscTcp socket " << this << " calling disconnect(); moving to CLOSED"); + m_nscTcpSocket->disconnect (); m_state = CLOSED; ShutdownSend (); return 0; @@ -306,10 +306,10 @@ NscTcpSocketImpl::Connect (const Address & address) m_remotePort = transport.GetPort (); std::ostringstream ss; - m_remoteAddress.Print(ss); + m_remoteAddress.Print (ss); std::string ipstring = ss.str (); - m_nscTcpSocket->connect(ipstring.c_str (), m_remotePort); + m_nscTcpSocket->connect (ipstring.c_str (), m_remotePort); m_state = SYN_SENT; return 0; } @@ -331,13 +331,13 @@ NscTcpSocketImpl::Send (const Ptr p, uint32_t flags) uint32_t sent = p->GetSize (); if (m_state == ESTABLISHED) { - m_txBuffer.push(p); + m_txBuffer.push (p); m_txBufferSize += sent; - SendPendingData(); + SendPendingData (); } else { // SYN_SET -- Queue Data - m_txBuffer.push(p); + m_txBuffer.push (p); m_txBufferSize += sent; } return sent; @@ -383,7 +383,7 @@ int NscTcpSocketImpl::Listen (void) { NS_LOG_FUNCTION (this); - m_nscTcpSocket->listen(m_localPort); + m_nscTcpSocket->listen (m_localPort); m_state = LISTEN; return 0; } @@ -394,18 +394,18 @@ NscTcpSocketImpl::NSCWakeup () { switch (m_state) { case SYN_SENT: - if (!m_nscTcpSocket->is_connected()) + if (!m_nscTcpSocket->is_connected ()) break; m_state = ESTABLISHED; - Simulator::ScheduleNow(&NscTcpSocketImpl::ConnectionSucceeded, this); + Simulator::ScheduleNow (&NscTcpSocketImpl::ConnectionSucceeded, this); // fall through to schedule read/write events case ESTABLISHED: if (!m_txBuffer.empty ()) - Simulator::ScheduleNow(&NscTcpSocketImpl::SendPendingData, this); - Simulator::ScheduleNow(&NscTcpSocketImpl::ReadPendingData, this); + Simulator::ScheduleNow (&NscTcpSocketImpl::SendPendingData, this); + Simulator::ScheduleNow (&NscTcpSocketImpl::ReadPendingData, this); break; case LISTEN: - Simulator::ScheduleNow(&NscTcpSocketImpl::Accept, this); + Simulator::ScheduleNow (&NscTcpSocketImpl::Accept, this); break; case CLOSED: break; default: @@ -417,7 +417,7 @@ Ptr NscTcpSocketImpl::Recv (uint32_t maxSize, uint32_t flags) { NS_LOG_FUNCTION_NOARGS (); - if (m_deliveryQueue.empty() ) + if (m_deliveryQueue.empty () ) { m_errno = ERROR_AGAIN; return 0; @@ -457,7 +457,7 @@ int NscTcpSocketImpl::GetSockName (Address &address) const { NS_LOG_FUNCTION_NOARGS (); - address = InetSocketAddress(m_localAddress, m_localPort); + address = InetSocketAddress (m_localAddress, m_localPort); return 0; } @@ -474,10 +474,10 @@ void NscTcpSocketImpl::ForwardUp (Ptr packet, Ipv4Header header, uint16_t port, Ptr incomingInterface) { - NSCWakeup(); + NSCWakeup (); } -void NscTcpSocketImpl::CompleteFork(void) +void NscTcpSocketImpl::CompleteFork (void) { // The address pairs (m_localAddress, m_localPort, m_remoteAddress, m_remotePort) // are bogus, but this isn't important at the moment, because @@ -487,22 +487,22 @@ void NscTcpSocketImpl::CompleteFork(void) struct sockaddr_in sin; size_t sin_len = sizeof(sin); - if (0 == m_nscTcpSocket->getpeername((struct sockaddr*) &sin, &sin_len)) { - m_remotePort = ntohs(sin.sin_port); - m_remoteAddress = m_remoteAddress.Deserialize((const uint8_t*) &sin.sin_addr); - m_peerAddress = InetSocketAddress(m_remoteAddress, m_remotePort); + if (0 == m_nscTcpSocket->getpeername ((struct sockaddr*) &sin, &sin_len)) { + m_remotePort = ntohs (sin.sin_port); + m_remoteAddress = m_remoteAddress.Deserialize ((const uint8_t*) &sin.sin_addr); + m_peerAddress = InetSocketAddress (m_remoteAddress, m_remotePort); } m_endPoint = m_tcp->Allocate (); //the cloned socket with be in listen state, so manually change state - NS_ASSERT(m_state == LISTEN); + NS_ASSERT (m_state == LISTEN); m_state = ESTABLISHED; sin_len = sizeof(sin); - if (0 == m_nscTcpSocket->getsockname((struct sockaddr *) &sin, &sin_len)) - m_localAddress = m_localAddress.Deserialize((const uint8_t*) &sin.sin_addr); + if (0 == m_nscTcpSocket->getsockname ((struct sockaddr *) &sin, &sin_len)) + m_localAddress = m_localAddress.Deserialize ((const uint8_t*) &sin.sin_addr); NS_LOG_LOGIC ("NscTcpSocketImpl " << this << " accepted connection from " << m_remoteAddress << ":" << m_remotePort @@ -514,21 +514,21 @@ void NscTcpSocketImpl::CompleteFork(void) NotifyNewConnectionCreated (this, m_peerAddress); } -void NscTcpSocketImpl::ConnectionSucceeded() +void NscTcpSocketImpl::ConnectionSucceeded () { // We would preferred to have scheduled an event directly to // NotifyConnectionSucceeded, but (sigh) these are protected // and we can get the address of it :( struct sockaddr_in sin; size_t sin_len = sizeof(sin); - if (0 == m_nscTcpSocket->getsockname((struct sockaddr *) &sin, &sin_len)) { - m_localAddress = m_localAddress.Deserialize((const uint8_t*)&sin.sin_addr); - m_localPort = ntohs(sin.sin_port); + if (0 == m_nscTcpSocket->getsockname ((struct sockaddr *) &sin, &sin_len)) { + m_localAddress = m_localAddress.Deserialize ((const uint8_t*)&sin.sin_addr); + m_localPort = ntohs (sin.sin_port); } NS_LOG_LOGIC ("NscTcpSocketImpl " << this << " connected to " << m_remoteAddress << ":" << m_remotePort << " from " << m_localAddress << ":" << m_localPort); - NotifyConnectionSucceeded(); + NotifyConnectionSucceeded (); } @@ -540,12 +540,12 @@ bool NscTcpSocketImpl::Accept (void) } NS_ASSERT (m_state == LISTEN); - if (!m_nscTcpSocket->is_listening()) + if (!m_nscTcpSocket->is_listening ()) { return false; } INetStreamSocket *newsock; - int res = m_nscTcpSocket->accept(&newsock); + int res = m_nscTcpSocket->accept (&newsock); if (res != 0) { return false; @@ -575,14 +575,14 @@ bool NscTcpSocketImpl::ReadPendingData (void) uint8_t buffer[8192]; len = sizeof(buffer); m_errno = ERROR_NOTERROR; - err = m_nscTcpSocket->read_data(buffer, &len); + err = m_nscTcpSocket->read_data (buffer, &len); if (err == 0 && len == 0) { NS_LOG_LOGIC ("ReadPendingData got EOF from socket"); m_state = CLOSE_WAIT; return false; } - m_errno = GetNativeNs3Errno(err); + m_errno = GetNativeNs3Errno (err); switch (m_errno) { case ERROR_NOTERROR: break; // some data was sent @@ -630,7 +630,7 @@ bool NscTcpSocketImpl::SendPendingData (void) uint8_t *buf = new uint8_t[size]; p->CopyData (buf, size); - ret = m_nscTcpSocket->send_data((const char *)buf, size); + ret = m_nscTcpSocket->send_data ((const char *)buf, size); delete[] buf; if (ret <= 0) @@ -644,7 +644,7 @@ bool NscTcpSocketImpl::SendPendingData (void) if ((size_t)ret < size) { - p->RemoveAtStart(ret); + p->RemoveAtStart (ret); break; } @@ -654,7 +654,7 @@ bool NscTcpSocketImpl::SendPendingData (void) { if (m_closeOnEmpty) { - m_nscTcpSocket->disconnect(); + m_nscTcpSocket->disconnect (); m_state = CLOSED; } break; @@ -663,7 +663,7 @@ bool NscTcpSocketImpl::SendPendingData (void) if (written > 0) { - Simulator::ScheduleNow(&NscTcpSocketImpl::NotifyDataSent, this, ret); + Simulator::ScheduleNow (&NscTcpSocketImpl::NotifyDataSent, this, ret); return true; } return false; @@ -807,7 +807,7 @@ NscTcpSocketImpl::GetPersistTimeout (void) const } enum Socket::SocketErrno -NscTcpSocketImpl::GetNativeNs3Errno(int error) const +NscTcpSocketImpl::GetNativeNs3Errno (int error) const { enum nsc_errno err; @@ -837,7 +837,7 @@ NscTcpSocketImpl::GetNativeNs3Errno(int error) const // but is triggered by e.g. show_config(). case NSC_EUNKNOWN: return ERROR_INVAL; // Catches stacks that 'return -1' without real mapping } - NS_ASSERT_MSG(0, "Unknown NSC error"); + NS_ASSERT_MSG (0, "Unknown NSC error"); return ERROR_INVAL; } diff --git a/src/internet/model/nsc-tcp-socket-impl.h b/src/internet/model/nsc-tcp-socket-impl.h index 64a08dee3..45de1c6d5 100644 --- a/src/internet/model/nsc-tcp-socket-impl.h +++ b/src/internet/model/nsc-tcp-socket-impl.h @@ -72,11 +72,11 @@ public: virtual int Close (void); virtual int ShutdownSend (void); virtual int ShutdownRecv (void); - virtual int Connect(const Address &address); - virtual int Listen(void); + virtual int Connect (const Address &address); + virtual int Listen (void); virtual uint32_t GetTxAvailable (void) const; virtual int Send (Ptr p, uint32_t flags); - virtual int SendTo(Ptr p, uint32_t flags, const Address &toAddress); + virtual int SendTo (Ptr p, uint32_t flags, const Address &toAddress); virtual uint32_t GetRxAvailable (void) const; virtual Ptr Recv (uint32_t maxSize, uint32_t flags); virtual Ptr RecvFrom (uint32_t maxSize, uint32_t flags, @@ -86,7 +86,7 @@ public: virtual bool GetAllowBroadcast () const; private: - void NSCWakeup(void); + void NSCWakeup (void); friend class Tcp; // invoked by Tcp class int FinishBind (void); @@ -94,11 +94,11 @@ private: Ptr incomingInterface); void Destroy (void); //methods for state - bool SendPendingData(void); - bool ReadPendingData(void); - bool Accept(void); - void CompleteFork(void); - void ConnectionSucceeded(); + bool SendPendingData (void); + bool ReadPendingData (void); + bool Accept (void); + void CompleteFork (void); + void ConnectionSucceeded (); // Manage data tx/rx // XXX This should be virtual and overridden @@ -128,7 +128,7 @@ private: virtual void SetPersistTimeout (Time timeout); virtual Time GetPersistTimeout (void) const; - enum Socket::SocketErrno GetNativeNs3Errno(int err) const; + enum Socket::SocketErrno GetNativeNs3Errno (int err) const; uint32_t m_delAckMaxCount; Time m_delAckTimeout; diff --git a/src/internet/model/pending-data.cc b/src/internet/model/pending-data.cc index 429f16621..2dd4af31f 100644 --- a/src/internet/model/pending-data.cc +++ b/src/internet/model/pending-data.cc @@ -57,8 +57,8 @@ PendingData::PendingData(const std::string& s) : size (s.length () + 1), data (0), msgSize (0), responseSize (0) { - NS_LOG_FUNCTION (this << s.length() + 1); - data.push_back (Create ((uint8_t*)s.c_str(), size)); + NS_LOG_FUNCTION (this << s.length () + 1); + data.push_back (Create ((uint8_t*)s.c_str (), size)); } PendingData::PendingData(const PendingData& c) @@ -94,7 +94,7 @@ PendingData* PendingData::CopySD (uint32_t s, uint8_t* d) void PendingData::Clear () { // Remove all pending data NS_LOG_FUNCTION (this); - data.clear(); + data.clear (); size = 0; } @@ -103,11 +103,11 @@ void PendingData::Add (uint32_t s, const uint8_t* d) NS_LOG_FUNCTION (this << s); if (d == 0) { - data.push_back(Create (d,s)); + data.push_back (Create (d,s)); } else { - data.push_back(Create (s)); + data.push_back (Create (s)); } size += s; } @@ -115,8 +115,8 @@ void PendingData::Add (uint32_t s, const uint8_t* d) void PendingData::Add (Ptr p) { NS_LOG_FUNCTION (this); - data.push_back(p); - size += p->GetSize(); + data.push_back (p); + size += p->GetSize (); } uint32_t PendingData::SizeFromSeq (const SequenceNumber32& seqFront, const SequenceNumber32& seqOffset) @@ -153,7 +153,7 @@ Ptr PendingData::CopyFromOffset (uint32_t s, uint32_t o) { return Create (); // No data requested } - if (data.size() != 0) + if (data.size () != 0) { // Actual data exists, make copy and return it uint32_t count = 0; std::vector >::size_type begin = 0; @@ -161,9 +161,9 @@ Ptr PendingData::CopyFromOffset (uint32_t s, uint32_t o) std::vector >::size_type end = 0; Ptr outPacket; Ptr endFragment; - for (std::vector >::size_type i=0; i >::size_type i=0; iGetSize(); + count+=data[i]->GetSize (); if (!beginFound) { if (count > o) @@ -171,7 +171,7 @@ Ptr PendingData::CopyFromOffset (uint32_t s, uint32_t o) if (count >= o + s1) //then just copy within this packet { Ptr toFragment = data[i]; - uint32_t packetStart = count - toFragment->GetSize(); + uint32_t packetStart = count - toFragment->GetSize (); uint32_t packetOffset = o - packetStart; outPacket = toFragment->CreateFragment (packetOffset, s1); return outPacket; @@ -179,7 +179,7 @@ Ptr PendingData::CopyFromOffset (uint32_t s, uint32_t o) begin = i; beginFound = true; Ptr toFragment = data[begin]; - uint32_t packetStart = count - toFragment->GetSize(); + uint32_t packetStart = count - toFragment->GetSize (); uint32_t packetOffset = o - packetStart; uint32_t fragmentLength = count - o; outPacket = toFragment->CreateFragment (packetOffset, fragmentLength); @@ -191,9 +191,9 @@ Ptr PendingData::CopyFromOffset (uint32_t s, uint32_t o) { end = i; Ptr toFragment = data[end]; - uint32_t packetStart = count - toFragment->GetSize(); + uint32_t packetStart = count - toFragment->GetSize (); uint32_t fragmentLength = o + s1 - packetStart; - endFragment = toFragment->CreateFragment(0, fragmentLength); + endFragment = toFragment->CreateFragment (0, fragmentLength); break; } } @@ -204,9 +204,9 @@ Ptr PendingData::CopyFromOffset (uint32_t s, uint32_t o) } if (endFragment) { - outPacket->AddAtEnd(endFragment); + outPacket->AddAtEnd (endFragment); } - NS_ASSERT(outPacket->GetSize() == s1); + NS_ASSERT (outPacket->GetSize () == s1); return outPacket; } else @@ -218,7 +218,7 @@ Ptr PendingData::CopyFromOffset (uint32_t s, uint32_t o) Ptr PendingData::CopyFromSeq (uint32_t s, const SequenceNumber32& f, const SequenceNumber32& o) { NS_LOG_FUNCTION (this << s << f << o); - return CopyFromOffset (s, OffsetFromSeq(f,o)); + return CopyFromOffset (s, OffsetFromSeq (f,o)); } uint32_t diff --git a/src/internet/model/rtt-estimator.cc b/src/internet/model/rtt-estimator.cc index f2bbc7cd9..542451c06 100644 --- a/src/internet/model/rtt-estimator.cc +++ b/src/internet/model/rtt-estimator.cc @@ -104,10 +104,10 @@ RttEstimator::RttEstimator () : next (1), history (), } RttEstimator::RttEstimator(const RttEstimator& c) - : Object (c), next(c.next), history(c.history), - m_maxMultiplier (c.m_maxMultiplier), est(c.est), - minrto(c.minrto), nSamples(c.nSamples), - multiplier(c.multiplier) + : Object (c), next (c.next), history (c.history), + m_maxMultiplier (c.m_maxMultiplier), est (c.est), + minrto (c.minrto), nSamples (c.nSamples), + multiplier (c.multiplier) { } @@ -151,14 +151,14 @@ Time RttEstimator::AckSeq (SequenceNumber32 a) if (!h.retx && a >= (h.seq + SequenceNumber32 (h.count))) { // Ok to use this sample m = Simulator::Now () - h.time; // Elapsed time - Measurement(m); // Log the measurement - ResetMultiplier(); // Reset multiplier on valid measurement + Measurement (m); // Log the measurement + ResetMultiplier (); // Reset multiplier on valid measurement } // Now delete all ack history with seq <= ack - while(history.size() > 0) + while(history.size () > 0) { RttHistory& h = history.front (); - if ((h.seq + SequenceNumber32(h.count)) > a) break; // Done removing + if ((h.seq + SequenceNumber32 (h.count)) > a) break; // Done removing history.pop_front (); // Remove } return m; diff --git a/src/internet/model/rtt-estimator.h b/src/internet/model/rtt-estimator.h index 2c7330ff1..24dac25a3 100644 --- a/src/internet/model/rtt-estimator.h +++ b/src/internet/model/rtt-estimator.h @@ -58,16 +58,16 @@ public: RttEstimator(const RttEstimator&); // Copy constructor virtual ~RttEstimator(); - virtual void SentSeq(SequenceNumber32, uint32_t); - virtual Time AckSeq(SequenceNumber32); - virtual void ClearSent(); - virtual void Measurement(Time t) = 0; - virtual Time RetransmitTimeout() = 0; - void Init(SequenceNumber32 s) { next = s; } - virtual Ptr Copy() const = 0; - virtual void IncreaseMultiplier(); - virtual void ResetMultiplier(); - virtual void Reset(); + virtual void SentSeq (SequenceNumber32, uint32_t); + virtual Time AckSeq (SequenceNumber32); + virtual void ClearSent (); + virtual void Measurement (Time t) = 0; + virtual Time RetransmitTimeout () = 0; + void Init (SequenceNumber32 s) { next = s; } + virtual Ptr Copy () const = 0; + virtual void IncreaseMultiplier (); + virtual void ResetMultiplier (); + virtual void Reset (); void SetMinRto (Time minRto); Time GetMinRto (void) const; diff --git a/src/internet/model/sim_interface.h b/src/internet/model/sim_interface.h index 75d41dd88..271360bb5 100644 --- a/src/internet/model/sim_interface.h +++ b/src/internet/model/sim_interface.h @@ -26,25 +26,25 @@ struct INetStack { virtual ~INetStack() {} - virtual void init(int hz) = 0; + virtual void init (int hz) = 0; - virtual void if_receive_packet(int if_id, const void *data, int datalen) = 0; + virtual void if_receive_packet (int if_id, const void *data, int datalen) = 0; - virtual void if_send_packet(const void *data, int datalen) = 0; - virtual void if_send_finish(int if_id) = 0; + virtual void if_send_packet (const void *data, int datalen) = 0; + virtual void if_send_finish (int if_id) = 0; - virtual void if_attach(const char *addr, const char *mask, int mtu) = 0; - virtual void add_default_gateway(const char *addr) = 0; + virtual void if_attach (const char *addr, const char *mask, int mtu) = 0; + virtual void add_default_gateway (const char *addr) = 0; /** Purely for debugging/diagnostic purposes. This returns the internal id * of the stack instance. */ - virtual int get_id() = 0; + virtual int get_id () = 0; /** Should return a short one-word name of the stack. Eg. Linux 2.4.x -> * linux24, FreeBSD 5.x -> freebsd5. This can be used to identify output * from a stack, for example a packet trace file. */ - virtual const char *get_name() = 0; + virtual const char *get_name () = 0; /** This is used so the simulator can call the stack timer_interrupt function * the correct amount of times per second. For example, lwip has a hz of 10, @@ -52,21 +52,21 @@ struct INetStack * 10 times a second. FreeBSD uses 100, as does Linux 2.4, while Linux 2.6 * uses 1000. (This is often configurable in the kernel in question, also.) */ - virtual int get_hz() = 0; + virtual int get_hz () = 0; - virtual void timer_interrupt() = 0; - virtual void increment_ticks() = 0; + virtual void timer_interrupt () = 0; + virtual void increment_ticks () = 0; - virtual void buffer_size(int size) = 0; + virtual void buffer_size (int size) = 0; - virtual struct INetDatagramSocket *new_udp_socket() { return NULL; } - virtual struct INetStreamSocket *new_tcp_socket() { return NULL; } - virtual struct INetStreamSocket *new_sctp_socket() { return NULL; } + virtual struct INetDatagramSocket *new_udp_socket () { return NULL; } + virtual struct INetStreamSocket *new_tcp_socket () { return NULL; } + virtual struct INetStreamSocket *new_sctp_socket () { return NULL; } // The following I've made optional to implement for now. Eases // integration of new features. - virtual int sysctl(const char *sysctl_name, void *oldval, size_t *oldlenp, - void *newval, size_t newlen) + virtual int sysctl (const char *sysctl_name, void *oldval, size_t *oldlenp, + void *newval, size_t newlen) { return -1; } @@ -75,7 +75,7 @@ struct INetStack // to convert the string-value to something that the stack can handle. // The idea here is that this is a front-end to the sysctl(2) call, // much like the sysctl(8) program. - virtual int sysctl_set(const char *name, const char *value) + virtual int sysctl_set (const char *name, const char *value) { return -1; } @@ -83,7 +83,7 @@ struct INetStack // same as above, cradle code is expected to convert the sysctl value // into a string. // returns length of the string in value, i.e. retval > len: 'output truncated'. - virtual int sysctl_get(const char *name, char *value, size_t len) + virtual int sysctl_get (const char *name, char *value, size_t len) { return -1; } @@ -95,23 +95,23 @@ struct INetStack // for (i=0; sysctl_getnum(i, buf, sizeof(buf)) > 0 ;i++) // puts(buf); // returns -1 if idx is out of range and the length of the sysctl name otherwise. - virtual int sysctl_getnum(size_t idx, char *name, size_t len) + virtual int sysctl_getnum (size_t idx, char *name, size_t len) { return -1; } - virtual void show_config() + virtual void show_config () { ; } /* Optional functions used to get and set variables for this stack */ - virtual bool get_var(const char *var, char *result, int result_len) + virtual bool get_var (const char *var, char *result, int result_len) { return false; } - virtual bool set_var(const char *var, const char *val) + virtual bool set_var (const char *var, const char *val) { return false; } @@ -119,13 +119,13 @@ struct INetStack /** The level of debugging or diagnostic information to print out. This * normally means kernel messages printed out during initialisation but * may also include extra debugging messages that are part of NSC. */ - virtual void set_diagnostic(int level) {} + virtual void set_diagnostic (int level) {} /** Simple interface to support sending any textual command to a stack * * @returns 0 on success */ - virtual int cmd(const char *) + virtual int cmd (const char *) { return 1; } @@ -135,34 +135,34 @@ struct INetStreamSocket { virtual ~INetStreamSocket() {} - virtual void connect(const char *, int) = 0; - virtual void disconnect() = 0; - virtual void listen(int) = 0; - virtual int accept(INetStreamSocket **) = 0; - virtual int send_data(const void *data, int datalen) = 0; - virtual int read_data(void *buf, int *buflen) = 0; + virtual void connect (const char *, int) = 0; + virtual void disconnect () = 0; + virtual void listen (int) = 0; + virtual int accept (INetStreamSocket **) = 0; + virtual int send_data (const void *data, int datalen) = 0; + virtual int read_data (void *buf, int *buflen) = 0; /* We need to pass the option name in as a string here. The reason for * this is that different operating systems you compile on will have * different numbers defined for the constants SO_SNDBUF and so on. */ - virtual int setsockopt(char *optname, void *val, size_t valsize) = 0; - virtual void print_state(FILE *) = 0; - virtual bool is_connected() = 0; - virtual bool is_listening() = 0; + virtual int setsockopt (char *optname, void *val, size_t valsize) = 0; + virtual void print_state (FILE *) = 0; + virtual bool is_connected () = 0; + virtual bool is_listening () = 0; - virtual int getpeername(struct sockaddr *sa, size_t *salen) { + virtual int getpeername (struct sockaddr *sa, size_t *salen) { return -1; } - virtual int getsockname(struct sockaddr *sa, size_t *salen) { + virtual int getsockname (struct sockaddr *sa, size_t *salen) { return -1; } /* Optional functions used to get and set variables for this TCP * connection. */ - virtual bool get_var(const char *var, char *result, int result_len) + virtual bool get_var (const char *var, char *result, int result_len) { return false; } - virtual bool set_var(const char *var, const char *val) + virtual bool set_var (const char *var, const char *val) { return false; } @@ -172,29 +172,29 @@ struct INetDatagramSocket { virtual ~INetDatagramSocket() {} - virtual void set_destination(const char *, int) = 0; - virtual void send_data(const void *data, int datalen) = 0; + virtual void set_destination (const char *, int) = 0; + virtual void send_data (const void *data, int datalen) = 0; }; struct ISendCallback { virtual ~ISendCallback() {} - virtual void send_callback(const void *data, int datalen) = 0; + virtual void send_callback (const void *data, int datalen) = 0; }; struct IInterruptCallback { virtual ~IInterruptCallback() {} - virtual void wakeup() = 0; - virtual void gettime(unsigned int *, unsigned int *) = 0; + virtual void wakeup () = 0; + virtual void gettime (unsigned int *, unsigned int *) = 0; }; typedef int (*FRandom)(); typedef INetStack *(*FCreateStack)(ISendCallback *, IInterruptCallback *, FRandom); -#define CREATE_STACK_FUNC(a,b,c) extern "C" INetStack *nsc_create_stack( \ +#define CREATE_STACK_FUNC(a,b,c) extern "C" INetStack *nsc_create_stack ( \ ISendCallback *a, IInterruptCallback *b, FRandom c) #endif diff --git a/src/internet/model/tcp-header.cc b/src/internet/model/tcp-header.cc index e2670f0b0..0875399ec 100644 --- a/src/internet/model/tcp-header.cc +++ b/src/internet/model/tcp-header.cc @@ -37,8 +37,8 @@ TcpHeader::TcpHeader () m_flags (0), m_windowSize (0xffff), m_urgentPointer (0), - m_calcChecksum(false), - m_goodChecksum(true) + m_calcChecksum (false), + m_goodChecksum (true) { } @@ -221,11 +221,11 @@ void TcpHeader::Serialize (Buffer::Iterator start) const { uint16_t headerChecksum = CalculateHeaderChecksum (start.GetSize ()); i = start; - uint16_t checksum = i.CalculateIpChecksum(start.GetSize (), headerChecksum); + uint16_t checksum = i.CalculateIpChecksum (start.GetSize (), headerChecksum); i = start; - i.Next(16); - i.WriteU16(checksum); + i.Next (16); + i.WriteU16 (checksum); } } uint32_t TcpHeader::Deserialize (Buffer::Iterator start) @@ -246,7 +246,7 @@ uint32_t TcpHeader::Deserialize (Buffer::Iterator start) { uint16_t headerChecksum = CalculateHeaderChecksum (start.GetSize ()); i = start; - uint16_t checksum = i.CalculateIpChecksum(start.GetSize (), headerChecksum); + uint16_t checksum = i.CalculateIpChecksum (start.GetSize (), headerChecksum); m_goodChecksum = (checksum == 0); } diff --git a/src/internet/model/tcp-l4-protocol.cc b/src/internet/model/tcp-l4-protocol.cc index 1ef85dda5..e275a5376 100644 --- a/src/internet/model/tcp-l4-protocol.cc +++ b/src/internet/model/tcp-l4-protocol.cc @@ -65,12 +65,12 @@ TcpL4Protocol::GetTypeId (void) .AddConstructor () .AddAttribute ("RttEstimatorType", "Type of RttEstimator objects.", - TypeIdValue (RttMeanDeviation::GetTypeId()), + TypeIdValue (RttMeanDeviation::GetTypeId ()), MakeTypeIdAccessor (&TcpL4Protocol::m_rttTypeId), MakeTypeIdChecker ()) .AddAttribute ("SocketType", "Socket type of TCP objects.", - TypeIdValue (TcpNewReno::GetTypeId()), + TypeIdValue (TcpNewReno::GetTypeId ()), MakeTypeIdAccessor (&TcpL4Protocol::m_socketTypeId), MakeTypeIdChecker ()) .AddAttribute ("SocketList", "The list of sockets associated to this protocol.", @@ -85,7 +85,7 @@ TcpL4Protocol::TcpL4Protocol () : m_endPoints (new Ipv4EndPointDemux ()) { NS_LOG_FUNCTION_NOARGS (); - NS_LOG_LOGIC("Made a TcpL4Protocol "< tcpFactory = CreateObject (); tcpFactory->SetTcp (this); node->AggregateObject (tcpFactory); - this->SetDownTarget (MakeCallback(&Ipv4::Send, ipv4)); + this->SetDownTarget (MakeCallback (&Ipv4::Send, ipv4)); } } } @@ -160,8 +160,8 @@ TcpL4Protocol::CreateSocket (TypeId socketTypeId) NS_LOG_FUNCTION_NOARGS (); ObjectFactory rttFactory; ObjectFactory socketFactory; - rttFactory.SetTypeId(m_rttTypeId); - socketFactory.SetTypeId(socketTypeId); + rttFactory.SetTypeId (m_rttTypeId); + socketFactory.SetTypeId (socketTypeId); Ptr rtt = rttFactory.Create (); Ptr socket = socketFactory.Create (); socket->SetNode (m_node); @@ -231,21 +231,21 @@ TcpL4Protocol::Receive (Ptr packet, TcpHeader tcpHeader; if(Node::ChecksumEnabled ()) { - tcpHeader.EnableChecksums(); + tcpHeader.EnableChecksums (); tcpHeader.InitializeChecksum (ipHeader.GetSource (), ipHeader.GetDestination (), PROT_NUMBER); } packet->PeekHeader (tcpHeader); - NS_LOG_LOGIC("TcpL4Protocol " << this - << " receiving seq " << tcpHeader.GetSequenceNumber() - << " ack " << tcpHeader.GetAckNumber() - << " flags "<< std::hex << (int)tcpHeader.GetFlags() << std::dec - << " data size " << packet->GetSize()); + NS_LOG_LOGIC ("TcpL4Protocol " << this + << " receiving seq " << tcpHeader.GetSequenceNumber () + << " ack " << tcpHeader.GetAckNumber () + << " flags "<< std::hex << (int)tcpHeader.GetFlags () << std::dec + << " data size " << packet->GetSize ()); if(!tcpHeader.IsChecksumOk ()) { - NS_LOG_INFO("Bad checksum, dropping packet!"); + NS_LOG_INFO ("Bad checksum, dropping packet!"); return Ipv4L4Protocol::RX_CSUM_FAILED; } @@ -291,7 +291,7 @@ TcpL4Protocol::Receive (Ptr packet, return Ipv4L4Protocol::RX_ENDPOINT_CLOSED; } } - NS_ASSERT_MSG (endPoints.size() == 1, "Demux returned more than one endpoint"); + NS_ASSERT_MSG (endPoints.size () == 1, "Demux returned more than one endpoint"); NS_LOG_LOGIC ("TcpL4Protocol "<ForwardUp (packet, ipHeader, tcpHeader.GetSourcePort (), incomingInterface); @@ -310,7 +310,7 @@ TcpL4Protocol::Send (Ptr packet, tcpHeader.SetSourcePort (sport); if(Node::ChecksumEnabled ()) { - tcpHeader.EnableChecksums(); + tcpHeader.EnableChecksums (); } tcpHeader.InitializeChecksum (saddr, daddr, @@ -346,11 +346,11 @@ void TcpL4Protocol::SendPacket (Ptr packet, const TcpHeader &outgoing, Ipv4Address saddr, Ipv4Address daddr, Ptr oif) { - NS_LOG_LOGIC("TcpL4Protocol " << this - << " sending seq " << outgoing.GetSequenceNumber() - << " ack " << outgoing.GetAckNumber() - << " flags " << std::hex << (int)outgoing.GetFlags() << std::dec - << " data size " << packet->GetSize()); + NS_LOG_LOGIC ("TcpL4Protocol " << this + << " sending seq " << outgoing.GetSequenceNumber () + << " ack " << outgoing.GetAckNumber () + << " flags " << std::hex << (int)outgoing.GetFlags () << std::dec + << " data size " << packet->GetSize ()); NS_LOG_FUNCTION (this << packet << saddr << daddr << oif); // XXX outgoingHeader cannot be logged @@ -359,9 +359,9 @@ TcpL4Protocol::SendPacket (Ptr packet, const TcpHeader &outgoing, /* outgoingHeader.SetUrgentPointer (0); //XXX */ if(Node::ChecksumEnabled ()) { - outgoingHeader.EnableChecksums(); + outgoingHeader.EnableChecksums (); } - outgoingHeader.InitializeChecksum(saddr, daddr, PROT_NUMBER); + outgoingHeader.InitializeChecksum (saddr, daddr, PROT_NUMBER); packet->AddHeader (outgoingHeader); @@ -386,7 +386,7 @@ TcpL4Protocol::SendPacket (Ptr packet, const TcpHeader &outgoing, m_downTarget (packet, saddr, daddr, PROT_NUMBER, route); } else - NS_FATAL_ERROR("Trying to use Tcp on a node without an Ipv4 interface"); + NS_FATAL_ERROR ("Trying to use Tcp on a node without an Ipv4 interface"); } void diff --git a/src/internet/model/tcp-newreno.cc b/src/internet/model/tcp-newreno.cc index ebd38cadb..fd7d14b0f 100644 --- a/src/internet/model/tcp-newreno.cc +++ b/src/internet/model/tcp-newreno.cc @@ -113,7 +113,7 @@ TcpNewReno::NewAck (const SequenceNumber32& seq) { // Partial ACK, partial window deflation (RFC2582 sec.3 bullet #5 paragraph 3) m_cWnd += m_segmentSize; // increase cwnd NS_LOG_INFO ("Partial ACK in fast recovery: cwnd set to " << m_cWnd); - TcpSocketBase::NewAck(seq); // update m_nextTxSequence and send new data if allowed by window + TcpSocketBase::NewAck (seq); // update m_nextTxSequence and send new data if allowed by window DoRetransmit (); // Assume the next seq is lost. Retransmit lost packet return; } diff --git a/src/internet/model/tcp-rfc793.cc b/src/internet/model/tcp-rfc793.cc index 4c725f644..fcde5e315 100644 --- a/src/internet/model/tcp-rfc793.cc +++ b/src/internet/model/tcp-rfc793.cc @@ -40,7 +40,7 @@ TcpRfc793::GetTypeId (void) TcpRfc793::TcpRfc793 (void) { NS_LOG_FUNCTION (this); - SetDelAckMaxCount(0); // Delayed ACK is not in RFC793 + SetDelAckMaxCount (0); // Delayed ACK is not in RFC793 } TcpRfc793::TcpRfc793 (const TcpRfc793& sock) : TcpSocketBase (sock) diff --git a/src/internet/model/tcp-rx-buffer.cc b/src/internet/model/tcp-rx-buffer.cc index 8a2a5e350..fae478220 100644 --- a/src/internet/model/tcp-rx-buffer.cc +++ b/src/internet/model/tcp-rx-buffer.cc @@ -48,7 +48,7 @@ TcpRxBuffer::GetTypeId (void) * initialized below is insignificant. */ TcpRxBuffer::TcpRxBuffer (uint32_t n) - : m_nextRxSeq(n), m_gotFin(false), m_size(0), m_maxBuffer(32768), m_availBytes(0) + : m_nextRxSeq (n), m_gotFin (false), m_size (0), m_maxBuffer (32768), m_availBytes (0) { } @@ -112,7 +112,7 @@ TcpRxBuffer::MaxRxSequence (void) const } else if (m_data.size ()) { // No data allowed beyond Rx window allowed - return m_data.begin()->first + SequenceNumber32 (m_maxBuffer); + return m_data.begin ()->first + SequenceNumber32 (m_maxBuffer); } return m_nextRxSeq + SequenceNumber32 (m_maxBuffer); } @@ -161,7 +161,7 @@ TcpRxBuffer::Add (Ptr p, TcpHeader const& tcph) { if (i->first > headSeq && lastByteSeq < tailSeq) { // Rare case: Existing packet is embedded fully in the new packet - m_size -= i->second->GetSize(); + m_size -= i->second->GetSize (); m_data.erase (i++); continue; } @@ -256,7 +256,7 @@ TcpRxBuffer::Extract (uint32_t maxSize) NS_LOG_LOGIC ("Nothing extracted."); return 0; } - NS_LOG_LOGIC ("Extracted " << outPkt->GetSize( ) << " bytes, bufsize=" << m_size + NS_LOG_LOGIC ("Extracted " << outPkt->GetSize ( ) << " bytes, bufsize=" << m_size << ", num pkts in buffer=" << m_data.size ()); return outPkt; } diff --git a/src/internet/model/tcp-socket-base.cc b/src/internet/model/tcp-socket-base.cc index 42fd500f0..0fa2e1f82 100644 --- a/src/internet/model/tcp-socket-base.cc +++ b/src/internet/model/tcp-socket-base.cc @@ -1099,7 +1099,7 @@ TcpSocketBase::DoPeerClose (void) } if (m_shutdownSend) { // The application declares that it would not sent any more, close this socket - Close(); + Close (); } else { // Need to ack, the application will close later @@ -1439,7 +1439,7 @@ TcpSocketBase::ReceivedData (Ptr p, const TcpHeader& tcpHeader) } // If we received FIN before and now completed all "holes" in rx buffer, // invoke peer close procedure - if (m_rxBuffer.Finished () && (tcpHeader.GetFlags() & TcpHeader::FIN) == 0) + if (m_rxBuffer.Finished () && (tcpHeader.GetFlags () & TcpHeader::FIN) == 0) { DoPeerClose (); } diff --git a/src/internet/model/tcp-tx-buffer.cc b/src/internet/model/tcp-tx-buffer.cc index e56405116..997fa4c7f 100644 --- a/src/internet/model/tcp-tx-buffer.cc +++ b/src/internet/model/tcp-tx-buffer.cc @@ -51,7 +51,7 @@ TcpTxBuffer::GetTypeId (void) * initialized below is insignificant. */ TcpTxBuffer::TcpTxBuffer (uint32_t n) - : m_firstByteSeq(n), m_size (0), m_maxBuffer(32768), m_data (0) + : m_firstByteSeq (n), m_size (0), m_maxBuffer (32768), m_data (0) { } diff --git a/src/internet/model/udp-header.cc b/src/internet/model/udp-header.cc index 95176dc71..999eae0e3 100644 --- a/src/internet/model/udp-header.cc +++ b/src/internet/model/udp-header.cc @@ -33,8 +33,8 @@ UdpHeader::UdpHeader () : m_sourcePort (0xfffd), m_destinationPort (0xfffd), m_payloadSize (0xfffd), - m_calcChecksum(false), - m_goodChecksum(true) + m_calcChecksum (false), + m_goodChecksum (true) { } UdpHeader::~UdpHeader () @@ -151,8 +151,8 @@ UdpHeader::Serialize (Buffer::Iterator start) const uint16_t checksum = i.CalculateIpChecksum (start.GetSize (), headerChecksum); i = start; - i.Next(6); - i.WriteU16(checksum); + i.Next (6); + i.WriteU16 (checksum); } } uint32_t diff --git a/src/internet/model/udp-l4-protocol.cc b/src/internet/model/udp-l4-protocol.cc index f971e5572..c7db24749 100644 --- a/src/internet/model/udp-l4-protocol.cc +++ b/src/internet/model/udp-l4-protocol.cc @@ -95,7 +95,7 @@ UdpL4Protocol::NotifyNewAggregate () Ptr udpFactory = CreateObject (); udpFactory->SetUdp (this); node->AggregateObject (udpFactory); - this->SetDownTarget (MakeCallback(&Ipv4::Send, ipv4)); + this->SetDownTarget (MakeCallback (&Ipv4::Send, ipv4)); } } } @@ -214,15 +214,15 @@ UdpL4Protocol::ReceiveIcmp (Ipv4Address icmpSource, uint8_t icmpTtl, } enum Ipv4L4Protocol::RxStatus -UdpL4Protocol::Receive(Ptr packet, - Ipv4Header const &header, - Ptr interface) +UdpL4Protocol::Receive (Ptr packet, + Ipv4Header const &header, + Ptr interface) { NS_LOG_FUNCTION (this << packet << header); UdpHeader udpHeader; if(Node::ChecksumEnabled ()) { - udpHeader.EnableChecksums(); + udpHeader.EnableChecksums (); } udpHeader.InitializeChecksum (header.GetSource (), header.GetDestination (), PROT_NUMBER); @@ -231,7 +231,7 @@ UdpL4Protocol::Receive(Ptr packet, if(!udpHeader.IsChecksumOk ()) { - NS_LOG_INFO("Bad checksum : dropping packet!"); + NS_LOG_INFO ("Bad checksum : dropping packet!"); return Ipv4L4Protocol::RX_CSUM_FAILED; } @@ -263,7 +263,7 @@ UdpL4Protocol::Send (Ptr packet, UdpHeader udpHeader; if(Node::ChecksumEnabled ()) { - udpHeader.EnableChecksums(); + udpHeader.EnableChecksums (); udpHeader.InitializeChecksum (saddr, daddr, PROT_NUMBER); @@ -286,7 +286,7 @@ UdpL4Protocol::Send (Ptr packet, UdpHeader udpHeader; if(Node::ChecksumEnabled ()) { - udpHeader.EnableChecksums(); + udpHeader.EnableChecksums (); udpHeader.InitializeChecksum (saddr, daddr, PROT_NUMBER); diff --git a/src/internet/model/udp-l4-protocol.h b/src/internet/model/udp-l4-protocol.h index ec665a453..8f5dc6cbd 100644 --- a/src/internet/model/udp-l4-protocol.h +++ b/src/internet/model/udp-l4-protocol.h @@ -89,9 +89,9 @@ public: * \param interface the interface from which the packet is coming. */ // inherited from Ipv4L4Protocol - virtual enum Ipv4L4Protocol::RxStatus Receive(Ptr p, - Ipv4Header const &header, - Ptr interface); + virtual enum Ipv4L4Protocol::RxStatus Receive (Ptr p, + Ipv4Header const &header, + Ptr interface); /** * \brief Receive an ICMP packet diff --git a/src/internet/model/udp-socket-impl.cc b/src/internet/model/udp-socket-impl.cc index 8a5eb225a..14571ef4a 100644 --- a/src/internet/model/udp-socket-impl.cc +++ b/src/internet/model/udp-socket-impl.cc @@ -225,7 +225,7 @@ UdpSocketImpl::Close (void) } int -UdpSocketImpl::Connect(const Address & address) +UdpSocketImpl::Connect (const Address & address) { NS_LOG_FUNCTION (this << address); InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); @@ -306,7 +306,7 @@ UdpSocketImpl::DoSendTo (Ptr p, Ipv4Address dest, uint16_t port) NS_LOG_FUNCTION (this << p << dest << port); if (m_boundnetdevice) { - NS_LOG_LOGIC("Bound interface number " << m_boundnetdevice->GetIfIndex()); + NS_LOG_LOGIC ("Bound interface number " << m_boundnetdevice->GetIfIndex ()); } if (m_endPoint == 0) { @@ -394,7 +394,7 @@ UdpSocketImpl::DoSendTo (Ptr p, Ipv4Address dest, uint16_t port) // Check if interface-bound socket if (m_boundnetdevice) { - if (ipv4->GetNetDevice(i) != m_boundnetdevice) + if (ipv4->GetNetDevice (i) != m_boundnetdevice) continue; } Ipv4Mask maski = iaddr.GetMask (); @@ -421,15 +421,15 @@ UdpSocketImpl::DoSendTo (Ptr p, Ipv4Address dest, uint16_t port) } } NS_LOG_LOGIC ("Limited broadcast end."); - return p->GetSize(); + return p->GetSize (); } - else if (m_endPoint->GetLocalAddress() != Ipv4Address::GetAny()) + else if (m_endPoint->GetLocalAddress () != Ipv4Address::GetAny ()) { - m_udp->Send(p->Copy (), m_endPoint->GetLocalAddress(), dest, - m_endPoint->GetLocalPort(), port, 0); + m_udp->Send (p->Copy (), m_endPoint->GetLocalAddress (), dest, + m_endPoint->GetLocalPort (), port, 0); NotifyDataSent (p->GetSize ()); NotifySend (GetTxAvailable ()); - return p->GetSize(); + return p->GetSize (); } else if (ipv4->GetRoutingProtocol () != 0) { @@ -463,7 +463,7 @@ UdpSocketImpl::DoSendTo (Ptr p, Ipv4Address dest, uint16_t port) m_udp->Send (p->Copy (), header.GetSource (), header.GetDestination (), m_endPoint->GetLocalPort (), port, route); NotifyDataSent (p->GetSize ()); - return p->GetSize(); + return p->GetSize (); } else { @@ -517,7 +517,7 @@ Ptr UdpSocketImpl::Recv (uint32_t maxSize, uint32_t flags) { NS_LOG_FUNCTION (this << maxSize << flags); - if (m_deliveryQueue.empty() ) + if (m_deliveryQueue.empty () ) { m_errno = ERROR_AGAIN; return 0; @@ -561,13 +561,13 @@ UdpSocketImpl::GetSockName (Address &address) const NS_LOG_FUNCTION_NOARGS (); if (m_endPoint != 0) { - address = InetSocketAddress (m_endPoint->GetLocalAddress (), m_endPoint->GetLocalPort()); + address = InetSocketAddress (m_endPoint->GetLocalAddress (), m_endPoint->GetLocalPort ()); } else { // It is possible to call this method on a socket without a name // in which case, behavior is unspecified - address = InetSocketAddress(Ipv4Address::GetZero(), 0); + address = InetSocketAddress (Ipv4Address::GetZero (), 0); } return 0; } diff --git a/src/internet/model/udp-socket-impl.h b/src/internet/model/udp-socket-impl.h index 703b05bcb..c1709443a 100644 --- a/src/internet/model/udp-socket-impl.h +++ b/src/internet/model/udp-socket-impl.h @@ -67,7 +67,7 @@ public: virtual int Close (void); virtual int ShutdownSend (void); virtual int ShutdownRecv (void); - virtual int Connect(const Address &address); + virtual int Connect (const Address &address); virtual int Listen (void); virtual uint32_t GetTxAvailable (void) const; virtual int Send (Ptr p, uint32_t flags); diff --git a/src/internet/test/global-route-manager-impl-test-suite.cc b/src/internet/test/global-route-manager-impl-test-suite.cc index 6b7343365..450ceef6b 100644 --- a/src/internet/test/global-route-manager-impl-test-suite.cc +++ b/src/internet/test/global-route-manager-impl-test-suite.cc @@ -34,15 +34,15 @@ class GlobalRouteManagerImplTestCase : public TestCase { public: GlobalRouteManagerImplTestCase(); - virtual void DoRun(void); + virtual void DoRun (void); }; GlobalRouteManagerImplTestCase::GlobalRouteManagerImplTestCase() - : TestCase("GlobalRouteManagerImplTestCase") + : TestCase ("GlobalRouteManagerImplTestCase") { } void -GlobalRouteManagerImplTestCase::DoRun(void) +GlobalRouteManagerImplTestCase::DoRun (void) { CandidateQueue candidate; @@ -218,9 +218,9 @@ static class GlobalRouteManagerImplTestSuite : public TestSuite { public: GlobalRouteManagerImplTestSuite() - : TestSuite("global-route-manager-impl", UNIT) + : TestSuite ("global-route-manager-impl", UNIT) { - AddTestCase(new GlobalRouteManagerImplTestCase()); + AddTestCase (new GlobalRouteManagerImplTestCase ()); } } g_globalRoutingManagerImplTestSuite; diff --git a/src/internet/test/ipv4-address-helper-test-suite.cc b/src/internet/test/ipv4-address-helper-test-suite.cc index 55f370e3e..10f50a346 100644 --- a/src/internet/test/ipv4-address-helper-test-suite.cc +++ b/src/internet/test/ipv4-address-helper-test-suite.cc @@ -51,21 +51,21 @@ NetworkAllocatorHelperTestCase::DoRun (void) Ipv4AddressHelper h; h.SetBase ("1.0.0.0", "255.0.0.0"); - network = h.NewNetwork(); + network = h.NewNetwork (); NS_TEST_EXPECT_MSG_EQ (network, Ipv4Address ("2.0.0.0"), "XXX"); - address = h.NewAddress(); + address = h.NewAddress (); NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("2.0.0.1"), "XXX"); h.SetBase ("0.1.0.0", "255.255.0.0"); - network = h.NewNetwork(); + network = h.NewNetwork (); NS_TEST_EXPECT_MSG_EQ (network, Ipv4Address ("0.2.0.0"), "XXX"); - address = h.NewAddress(); + address = h.NewAddress (); NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("0.2.0.1"), "XXX"); h.SetBase ("0.0.1.0", "255.255.255.0"); - network = h.NewNetwork(); + network = h.NewNetwork (); NS_TEST_EXPECT_MSG_EQ (network, Ipv4Address ("0.0.2.0"), "XXX"); - address = h.NewAddress(); + address = h.NewAddress (); NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("0.0.2.1"), "XXX"); } @@ -98,21 +98,21 @@ AddressAllocatorHelperTestCase::DoRun (void) Ipv4AddressHelper h; h.SetBase ("1.0.0.0", "255.0.0.0", "0.0.0.3"); - address = h.NewAddress(); + address = h.NewAddress (); NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("1.0.0.3"), "XXX"); - address = h.NewAddress(); + address = h.NewAddress (); NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("1.0.0.4"), "XXX"); h.SetBase ("0.1.0.0", "255.255.0.0", "0.0.0.3"); - address = h.NewAddress(); + address = h.NewAddress (); NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("0.1.0.3"), "XXX"); - address = h.NewAddress(); + address = h.NewAddress (); NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("0.1.0.4"), "XXX"); h.SetBase ("0.0.1.0", "255.255.255.0", "0.0.0.3"); - address = h.NewAddress(); + address = h.NewAddress (); NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("0.0.1.3"), "XXX"); - address = h.NewAddress(); + address = h.NewAddress (); NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("0.0.1.4"), "XXX"); } @@ -142,33 +142,33 @@ ResetAllocatorHelperTestCase::DoRun (void) // h.SetBase ("1.0.0.0", "255.0.0.0", "0.0.0.3"); - address = h.NewAddress(); + address = h.NewAddress (); NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("1.0.0.3"), "XXX"); - address = h.NewAddress(); + address = h.NewAddress (); NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("1.0.0.4"), "XXX"); - network = h.NewNetwork(); + network = h.NewNetwork (); NS_TEST_EXPECT_MSG_EQ (network, Ipv4Address ("2.0.0.0"), "XXX"); - address = h.NewAddress(); + address = h.NewAddress (); NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("2.0.0.3"), "XXX"); h.SetBase ("0.1.0.0", "255.255.0.0", "0.0.0.3"); - address = h.NewAddress(); + address = h.NewAddress (); NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("0.1.0.3"), "XXX"); - address = h.NewAddress(); + address = h.NewAddress (); NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("0.1.0.4"), "XXX"); - network = h.NewNetwork(); + network = h.NewNetwork (); NS_TEST_EXPECT_MSG_EQ (network, Ipv4Address ("0.2.0.0"), "XXX"); - address = h.NewAddress(); + address = h.NewAddress (); NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("0.2.0.3"), "XXX"); h.SetBase ("0.0.1.0", "255.255.255.0", "0.0.0.3"); - address = h.NewAddress(); + address = h.NewAddress (); NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("0.0.1.3"), "XXX"); - address = h.NewAddress(); + address = h.NewAddress (); NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("0.0.1.4"), "XXX"); - network = h.NewNetwork(); + network = h.NewNetwork (); NS_TEST_EXPECT_MSG_EQ (network, Ipv4Address ("0.0.2.0"), "XXX"); - address = h.NewAddress(); + address = h.NewAddress (); NS_TEST_EXPECT_MSG_EQ (address, Ipv4Address ("0.0.2.3"), "XXX"); } diff --git a/src/internet/test/ipv4-list-routing-test-suite.cc b/src/internet/test/ipv4-list-routing-test-suite.cc index 42dd4c536..b0627124a 100644 --- a/src/internet/test/ipv4-list-routing-test-suite.cc +++ b/src/internet/test/ipv4-list-routing-test-suite.cc @@ -59,7 +59,7 @@ public: }; Ipv4ListRoutingNegativeTestCase::Ipv4ListRoutingNegativeTestCase() - : TestCase("Check negative priorities") + : TestCase ("Check negative priorities") { } void @@ -87,7 +87,7 @@ public: }; Ipv4ListRoutingPositiveTestCase::Ipv4ListRoutingPositiveTestCase() - : TestCase("Check positive priorities") + : TestCase ("Check positive priorities") { } void @@ -116,10 +116,10 @@ static class Ipv4ListRoutingTestSuite : public TestSuite { public: Ipv4ListRoutingTestSuite() - : TestSuite("ipv4-list-routing", UNIT) + : TestSuite ("ipv4-list-routing", UNIT) { - AddTestCase(new Ipv4ListRoutingPositiveTestCase()); - AddTestCase(new Ipv4ListRoutingNegativeTestCase()); + AddTestCase (new Ipv4ListRoutingPositiveTestCase ()); + AddTestCase (new Ipv4ListRoutingNegativeTestCase ()); } } g_ipv4ListRoutingTestSuite; diff --git a/src/internet/test/ipv4-packet-info-tag-test-suite.cc b/src/internet/test/ipv4-packet-info-tag-test-suite.cc index 19e3164fb..ca7808f74 100644 --- a/src/internet/test/ipv4-packet-info-tag-test-suite.cc +++ b/src/internet/test/ipv4-packet-info-tag-test-suite.cc @@ -55,7 +55,7 @@ AddInternetStack (Ptr node) { //ARP Ptr arp = CreateObject (); - node->AggregateObject(arp); + node->AggregateObject (arp); //IPV4 Ptr ipv4 = CreateObject (); //Routing for Ipv4 @@ -63,13 +63,13 @@ AddInternetStack (Ptr node) ipv4->SetRoutingProtocol (ipv4Routing); Ptr ipv4staticRouting = CreateObject (); ipv4Routing->AddRoutingProtocol (ipv4staticRouting, 0); - node->AggregateObject(ipv4); + node->AggregateObject (ipv4); //ICMP Ptr icmp = CreateObject (); - node->AggregateObject(icmp); + node->AggregateObject (icmp); //UDP Ptr udp = CreateObject (); - node->AggregateObject(udp); + node->AggregateObject (udp); } class Ipv4PacketInfoTagTest : public TestCase @@ -94,7 +94,7 @@ Ipv4PacketInfoTagTest::RxCb (Ptr socket) Ptr m_receivedPacket; availableData = socket->GetRxAvailable (); - m_receivedPacket = socket->Recv (std::numeric_limits::max(), 0); + m_receivedPacket = socket->Recv (std::numeric_limits::max (), 0); NS_TEST_ASSERT_MSG_EQ (availableData, m_receivedPacket->GetSize (), "Did not read expected data"); Ipv4PacketInfoTag tag; @@ -106,7 +106,7 @@ Ipv4PacketInfoTagTest::RxCb (Ptr socket) void Ipv4PacketInfoTagTest::DoSendData (Ptr socket, std::string to) { - Address realTo = InetSocketAddress (Ipv4Address (to.c_str()), 200); + Address realTo = InetSocketAddress (Ipv4Address (to.c_str ()), 200); if (DynamicCast (socket) != 0) { NS_TEST_EXPECT_MSG_EQ (socket->SendTo (Create (123), 0, realTo), diff --git a/src/internet/test/ipv4-raw-test.cc b/src/internet/test/ipv4-raw-test.cc index e6ca8dda0..39a6f539a 100644 --- a/src/internet/test/ipv4-raw-test.cc +++ b/src/internet/test/ipv4-raw-test.cc @@ -51,7 +51,7 @@ AddInternetStack (Ptr node) { //ARP Ptr arp = CreateObject (); - node->AggregateObject(arp); + node->AggregateObject (arp); //IPV4 Ptr ipv4 = CreateObject (); //Routing for Ipv4 @@ -59,10 +59,10 @@ AddInternetStack (Ptr node) ipv4->SetRoutingProtocol (ipv4Routing); Ptr ipv4staticRouting = CreateObject (); ipv4Routing->AddRoutingProtocol (ipv4staticRouting, 0); - node->AggregateObject(ipv4); + node->AggregateObject (ipv4); //ICMP Ptr icmp = CreateObject (); - node->AggregateObject(icmp); + node->AggregateObject (icmp); // //Ipv4Raw // Ptr udp = CreateObject (); // node->AggregateObject(udp); @@ -110,7 +110,7 @@ void Ipv4RawSocketImplTest::ReceivePkt (Ptr socket) availableData = socket->GetRxAvailable (); m_receivedPacket = socket->Recv (2, MSG_PEEK); NS_ASSERT (m_receivedPacket->GetSize () == 2); - m_receivedPacket = socket->Recv (std::numeric_limits::max(), 0); + m_receivedPacket = socket->Recv (std::numeric_limits::max (), 0); NS_ASSERT (availableData == m_receivedPacket->GetSize ()); //cast availableData to void, to suppress 'availableData' set but not used //compiler warning @@ -123,7 +123,7 @@ void Ipv4RawSocketImplTest::ReceivePkt2 (Ptr socket) availableData = socket->GetRxAvailable (); m_receivedPacket2 = socket->Recv (2, MSG_PEEK); NS_ASSERT (m_receivedPacket2->GetSize () == 2); - m_receivedPacket2 = socket->Recv (std::numeric_limits::max(), 0); + m_receivedPacket2 = socket->Recv (std::numeric_limits::max (), 0); NS_ASSERT (availableData == m_receivedPacket2->GetSize ()); //cast availableData to void, to suppress 'availableData' set but not used //compiler warning @@ -133,7 +133,7 @@ void Ipv4RawSocketImplTest::ReceivePkt2 (Ptr socket) void Ipv4RawSocketImplTest::DoSendData (Ptr socket, std::string to) { - Address realTo = InetSocketAddress (Ipv4Address(to.c_str()), 0); + Address realTo = InetSocketAddress (Ipv4Address (to.c_str ()), 0); NS_TEST_EXPECT_MSG_EQ (socket->SendTo (Create (123), 0, realTo), 123, to); } @@ -151,7 +151,7 @@ Ipv4RawSocketImplTest::SendData (Ptr socket, std::string to) void Ipv4RawSocketImplTest::DoSendData_IpHdr (Ptr socket, std::string to) { - Address realTo = InetSocketAddress (Ipv4Address(to.c_str()), 0); + Address realTo = InetSocketAddress (Ipv4Address (to.c_str ()), 0); socket->SetAttribute ("IpHeaderInclude", BooleanValue (true)); Ptr p = Create (123); Ipv4Header ipHeader; diff --git a/src/internet/test/ipv6-extension-header-test-suite.cc b/src/internet/test/ipv6-extension-header-test-suite.cc index 01c107670..b7105f736 100644 --- a/src/internet/test/ipv6-extension-header-test-suite.cc +++ b/src/internet/test/ipv6-extension-header-test-suite.cc @@ -36,19 +36,19 @@ using namespace ns3; class TestEmptyOptionField : public TestCase { public: - TestEmptyOptionField () : TestCase("TestEmptyOptionField") {} + TestEmptyOptionField () : TestCase ("TestEmptyOptionField") {} - virtual void DoRun() + virtual void DoRun () { Ipv6ExtensionDestinationHeader header; - NS_TEST_EXPECT_MSG_EQ(header.GetSerializedSize() % 8, 0, "length of extension header is not a multiple of 8"); + NS_TEST_EXPECT_MSG_EQ (header.GetSerializedSize () % 8, 0, "length of extension header is not a multiple of 8"); Buffer buf; - buf.AddAtStart(header.GetSerializedSize()); - header.Serialize(buf.Begin()); + buf.AddAtStart (header.GetSerializedSize ()); + header.Serialize (buf.Begin ()); - const uint8_t* data = buf.PeekData(); - NS_TEST_EXPECT_MSG_EQ(*(data+2), 1, "padding is missing"); //expecting a padN header + const uint8_t* data = buf.PeekData (); + NS_TEST_EXPECT_MSG_EQ (*(data+2), 1, "padding is missing"); //expecting a padN header } }; @@ -73,9 +73,9 @@ public: virtual void Serialize (Buffer::Iterator start) const { - start.WriteU8(TYPE); - start.WriteU8(GetSerializedSize()-2); - start.WriteU16(0); + start.WriteU8 (TYPE); + start.WriteU8 (GetSerializedSize ()-2); + start.WriteU16 (0); } }; @@ -83,23 +83,23 @@ public: class TestOptionWithoutAlignment : public TestCase { public: - TestOptionWithoutAlignment () : TestCase("TestOptionWithoutAlignment") {} + TestOptionWithoutAlignment () : TestCase ("TestOptionWithoutAlignment") {} - virtual void DoRun() + virtual void DoRun () { Ipv6ExtensionDestinationHeader header; OptionWithoutAlignmentHeader optionHeader; - header.AddOption(optionHeader); + header.AddOption (optionHeader); - NS_TEST_EXPECT_MSG_EQ(header.GetSerializedSize() % 8, 0, "length of extension header is not a multiple of 8"); + NS_TEST_EXPECT_MSG_EQ (header.GetSerializedSize () % 8, 0, "length of extension header is not a multiple of 8"); Buffer buf; - buf.AddAtStart(header.GetSerializedSize()); - header.Serialize(buf.Begin()); + buf.AddAtStart (header.GetSerializedSize ()); + header.Serialize (buf.Begin ()); - const uint8_t* data = buf.PeekData(); - NS_TEST_EXPECT_MSG_EQ(*(data+2), OptionWithoutAlignmentHeader::TYPE, "option without alignment is not first in header field"); + const uint8_t* data = buf.PeekData (); + NS_TEST_EXPECT_MSG_EQ (*(data+2), OptionWithoutAlignmentHeader::TYPE, "option without alignment is not first in header field"); } }; @@ -129,12 +129,12 @@ public: virtual void Serialize (Buffer::Iterator start) const { - start.WriteU8(TYPE); - start.WriteU8(GetSerializedSize()-2); - start.WriteU16(0); + start.WriteU8 (TYPE); + start.WriteU8 (GetSerializedSize ()-2); + start.WriteU16 (0); } - virtual Alignment GetAlignment() const + virtual Alignment GetAlignment () const { return (Alignment){ 4,0}; } @@ -144,27 +144,27 @@ public: class TestOptionWithAlignment : public TestCase { public: - TestOptionWithAlignment () : TestCase("TestOptionWithAlignment") {} + TestOptionWithAlignment () : TestCase ("TestOptionWithAlignment") {} - virtual void DoRun() + virtual void DoRun () { Ipv6ExtensionDestinationHeader header; OptionWithAlignmentHeader optionHeader; - header.AddOption(optionHeader); + header.AddOption (optionHeader); Ipv6OptionJumbogramHeader jumboHeader; //has an alignment of 4n+2 - header.AddOption(jumboHeader); + header.AddOption (jumboHeader); - NS_TEST_EXPECT_MSG_EQ(header.GetSerializedSize() % 8, 0, "length of extension header is not a multiple of 8"); + NS_TEST_EXPECT_MSG_EQ (header.GetSerializedSize () % 8, 0, "length of extension header is not a multiple of 8"); Buffer buf; - buf.AddAtStart(header.GetSerializedSize()); - header.Serialize(buf.Begin()); + buf.AddAtStart (header.GetSerializedSize ()); + header.Serialize (buf.Begin ()); - const uint8_t* data = buf.PeekData(); - NS_TEST_EXPECT_MSG_EQ(*(data+2), 1, "padding is missing"); //expecting a padN header - NS_TEST_EXPECT_MSG_EQ(*(data+4), OptionWithAlignmentHeader::TYPE, "option with alignment is not padded correctly"); - NS_TEST_EXPECT_MSG_EQ(*(data+8), 1, "padding is missing"); //expecting a padN header - NS_TEST_EXPECT_MSG_EQ(*(data+10), jumboHeader.GetType(), "option with alignment is not padded correctly"); + const uint8_t* data = buf.PeekData (); + NS_TEST_EXPECT_MSG_EQ (*(data+2), 1, "padding is missing"); //expecting a padN header + NS_TEST_EXPECT_MSG_EQ (*(data+4), OptionWithAlignmentHeader::TYPE, "option with alignment is not padded correctly"); + NS_TEST_EXPECT_MSG_EQ (*(data+8), 1, "padding is missing"); //expecting a padN header + NS_TEST_EXPECT_MSG_EQ (*(data+10), jumboHeader.GetType (), "option with alignment is not padded correctly"); } }; @@ -187,25 +187,25 @@ public: class TestFulfilledAlignment : public TestCase { public: - TestFulfilledAlignment () : TestCase("TestCorrectAlignment") {} + TestFulfilledAlignment () : TestCase ("TestCorrectAlignment") {} - virtual void DoRun() + virtual void DoRun () { Ipv6ExtensionDestinationHeader header; Ipv6OptionJumbogramHeader jumboHeader; //has an alignment of 4n+2 - header.AddOption(jumboHeader); + header.AddOption (jumboHeader); OptionWithAlignmentHeader optionHeader; - header.AddOption(optionHeader); + header.AddOption (optionHeader); - NS_TEST_EXPECT_MSG_EQ(header.GetSerializedSize() % 8, 0, "length of extension header is not a multiple of 8"); + NS_TEST_EXPECT_MSG_EQ (header.GetSerializedSize () % 8, 0, "length of extension header is not a multiple of 8"); Buffer buf; - buf.AddAtStart(header.GetSerializedSize()); - header.Serialize(buf.Begin()); + buf.AddAtStart (header.GetSerializedSize ()); + header.Serialize (buf.Begin ()); - const uint8_t* data = buf.PeekData(); - NS_TEST_EXPECT_MSG_EQ(*(data+2), jumboHeader.GetType(), "option with fulfilled alignment is padded anyway"); - NS_TEST_EXPECT_MSG_EQ(*(data+8), OptionWithAlignmentHeader::TYPE, "option with fulfilled alignment is padded anyway"); + const uint8_t* data = buf.PeekData (); + NS_TEST_EXPECT_MSG_EQ (*(data+2), jumboHeader.GetType (), "option with fulfilled alignment is padded anyway"); + NS_TEST_EXPECT_MSG_EQ (*(data+8), OptionWithAlignmentHeader::TYPE, "option with fulfilled alignment is padded anyway"); } }; diff --git a/src/internet/test/ipv6-list-routing-test-suite.cc b/src/internet/test/ipv6-list-routing-test-suite.cc index ffef32799..38467988b 100644 --- a/src/internet/test/ipv6-list-routing-test-suite.cc +++ b/src/internet/test/ipv6-list-routing-test-suite.cc @@ -64,7 +64,7 @@ public: }; Ipv6ListRoutingNegativeTestCase::Ipv6ListRoutingNegativeTestCase() - : TestCase("Check negative priorities") + : TestCase ("Check negative priorities") { } void @@ -92,7 +92,7 @@ public: }; Ipv6ListRoutingPositiveTestCase::Ipv6ListRoutingPositiveTestCase() - : TestCase("Check positive priorities") + : TestCase ("Check positive priorities") { } void @@ -121,10 +121,10 @@ static class Ipv6ListRoutingTestSuite : public TestSuite { public: Ipv6ListRoutingTestSuite() - : TestSuite("ipv6-list-routing", UNIT) + : TestSuite ("ipv6-list-routing", UNIT) { - AddTestCase(new Ipv6ListRoutingPositiveTestCase()); - AddTestCase(new Ipv6ListRoutingNegativeTestCase()); + AddTestCase (new Ipv6ListRoutingPositiveTestCase ()); + AddTestCase (new Ipv6ListRoutingNegativeTestCase ()); } } g_ipv6ListRoutingTestSuite; diff --git a/src/internet/test/ipv6-packet-info-tag-test-suite.cc b/src/internet/test/ipv6-packet-info-tag-test-suite.cc index 48e4ea4f6..e52985e1b 100644 --- a/src/internet/test/ipv6-packet-info-tag-test-suite.cc +++ b/src/internet/test/ipv6-packet-info-tag-test-suite.cc @@ -90,7 +90,7 @@ Ipv6PacketInfoTagTest::RxCb (Ptr socket) Ptr m_receivedPacket; availableData = socket->GetRxAvailable (); - m_receivedPacket = socket->Recv (std::numeric_limits::max(), 0); + m_receivedPacket = socket->Recv (std::numeric_limits::max (), 0); NS_TEST_ASSERT_MSG_EQ (availableData, m_receivedPacket->GetSize (), "Did not read expected data"); Ipv6PacketInfoTag tag; @@ -102,7 +102,7 @@ Ipv6PacketInfoTagTest::RxCb (Ptr socket) void Ipv6PacketInfoTagTest::DoSendData (Ptr socket, std::string to) { - Address realTo = Inet6SocketAddress (Ipv6Address (to.c_str()), 200); + Address realTo = Inet6SocketAddress (Ipv6Address (to.c_str ()), 200); if (DynamicCast (socket) != 0) { NS_TEST_EXPECT_MSG_EQ (socket->SendTo (Create (123), 0, realTo), @@ -130,8 +130,8 @@ Ipv6PacketInfoTagTest::DoRun (void) Ptr ipv6 = node0->GetObject (); uint32_t index = ipv6->AddInterface (device); - Ipv6InterfaceAddress ifaceAddr1 = Ipv6InterfaceAddress (Ipv6Address("2000:1000:0:2000::1"), - Ipv6Prefix(64)); + Ipv6InterfaceAddress ifaceAddr1 = Ipv6InterfaceAddress (Ipv6Address ("2000:1000:0:2000::1"), + Ipv6Prefix (64)); ipv6->AddAddress (index, ifaceAddr1); ipv6->SetMetric (index, 1); ipv6->SetUp (index); @@ -142,8 +142,8 @@ Ipv6PacketInfoTagTest::DoRun (void) ipv6 = node1->GetObject (); index = ipv6->AddInterface (device2); - Ipv6InterfaceAddress ifaceAddr2 = Ipv6InterfaceAddress (Ipv6Address("2000:1000:0:2000::2"), - Ipv6Prefix(64)); + Ipv6InterfaceAddress ifaceAddr2 = Ipv6InterfaceAddress (Ipv6Address ("2000:1000:0:2000::2"), + Ipv6Prefix (64)); ipv6->AddAddress (index, ifaceAddr2); ipv6->SetMetric (index, 1); ipv6->SetUp (index); diff --git a/src/internet/test/tcp-test.cc b/src/internet/test/tcp-test.cc index 818c771d4..6fe72989b 100644 --- a/src/internet/test/tcp-test.cc +++ b/src/internet/test/tcp-test.cc @@ -44,7 +44,7 @@ #include -NS_LOG_COMPONENT_DEFINE("TcpTestSuite"); +NS_LOG_COMPONENT_DEFINE ("TcpTestSuite"); namespace ns3 { @@ -255,7 +255,7 @@ TcpTestCase::CreateInternetNode () Ptr node = CreateObject (); //ARP Ptr arp = CreateObject (); - node->AggregateObject(arp); + node->AggregateObject (arp); //IPV4 Ptr ipv4 = CreateObject (); //Routing for Ipv4 @@ -263,16 +263,16 @@ TcpTestCase::CreateInternetNode () ipv4->SetRoutingProtocol (ipv4Routing); Ptr ipv4staticRouting = CreateObject (); ipv4Routing->AddRoutingProtocol (ipv4staticRouting, 0); - node->AggregateObject(ipv4); + node->AggregateObject (ipv4); //ICMP Ptr icmp = CreateObject (); - node->AggregateObject(icmp); + node->AggregateObject (icmp); //UDP Ptr udp = CreateObject (); - node->AggregateObject(udp); + node->AggregateObject (udp); //TCP Ptr tcp = CreateObject (); - node->AggregateObject(tcp); + node->AggregateObject (tcp); return node; } @@ -308,22 +308,22 @@ TcpTestCase::SetupDefaultSim (void) Ptr sockFactory0 = node0->GetObject (); Ptr sockFactory1 = node1->GetObject (); - Ptr server = sockFactory0->CreateSocket(); - Ptr source = sockFactory1->CreateSocket(); + Ptr server = sockFactory0->CreateSocket (); + Ptr source = sockFactory1->CreateSocket (); uint16_t port = 50000; - InetSocketAddress serverlocaladdr (Ipv4Address::GetAny(), port); - InetSocketAddress serverremoteaddr (Ipv4Address(ipaddr0), port); + InetSocketAddress serverlocaladdr (Ipv4Address::GetAny (), port); + InetSocketAddress serverremoteaddr (Ipv4Address (ipaddr0), port); - server->Bind(serverlocaladdr); + server->Bind (serverlocaladdr); server->Listen (); server->SetAcceptCallback (MakeNullCallback, const Address &> (), - MakeCallback(&TcpTestCase::ServerHandleConnectionCreated,this)); + MakeCallback (&TcpTestCase::ServerHandleConnectionCreated,this)); - source->SetRecvCallback (MakeCallback(&TcpTestCase::SourceHandleRecv, this)); + source->SetRecvCallback (MakeCallback (&TcpTestCase::SourceHandleRecv, this)); source->SetSendCallback (MakeCallback (&TcpTestCase::SourceHandleSend, this)); - source->Connect(serverremoteaddr); + source->Connect (serverremoteaddr); } static class TcpTestSuite : public TestSuite diff --git a/src/internet/test/udp-test.cc b/src/internet/test/udp-test.cc index 107053af7..a00fa9267 100644 --- a/src/internet/test/udp-test.cc +++ b/src/internet/test/udp-test.cc @@ -52,7 +52,7 @@ AddInternetStack (Ptr node) { //ARP Ptr arp = CreateObject (); - node->AggregateObject(arp); + node->AggregateObject (arp); //IPV4 Ptr ipv4 = CreateObject (); //Routing for Ipv4 @@ -60,16 +60,16 @@ AddInternetStack (Ptr node) ipv4->SetRoutingProtocol (ipv4Routing); Ptr ipv4staticRouting = CreateObject (); ipv4Routing->AddRoutingProtocol (ipv4staticRouting, 0); - node->AggregateObject(ipv4); + node->AggregateObject (ipv4); //ICMP Ptr icmp = CreateObject (); - node->AggregateObject(icmp); + node->AggregateObject (icmp); //UDP Ptr udp = CreateObject (); - node->AggregateObject(udp); + node->AggregateObject (udp); //TCP Ptr tcp = CreateObject (); - node->AggregateObject(tcp); + node->AggregateObject (tcp); } @@ -92,7 +92,7 @@ void UdpSocketLoopbackTest::ReceivePkt (Ptr socket) { uint32_t availableData; availableData = socket->GetRxAvailable (); - m_receivedPacket = socket->Recv (std::numeric_limits::max(), 0); + m_receivedPacket = socket->Recv (std::numeric_limits::max (), 0); NS_ASSERT (availableData == m_receivedPacket->GetSize ()); //cast availableData to void, to suppress 'availableData' set but not used //compiler warning @@ -107,7 +107,7 @@ UdpSocketLoopbackTest::DoRun () Ptr rxSocketFactory = rxNode->GetObject (); Ptr rxSocket = rxSocketFactory->CreateSocket (); - rxSocket->Bind (InetSocketAddress (Ipv4Address::GetAny(), 80)); + rxSocket->Bind (InetSocketAddress (Ipv4Address::GetAny (), 80)); rxSocket->SetRecvCallback (MakeCallback (&UdpSocketLoopbackTest::ReceivePkt, this)); Ptr txSocket = rxSocketFactory->CreateSocket (); @@ -153,7 +153,7 @@ void UdpSocketImplTest::ReceivePkt (Ptr socket) { uint32_t availableData; availableData = socket->GetRxAvailable (); - m_receivedPacket = socket->Recv (std::numeric_limits::max(), 0); + m_receivedPacket = socket->Recv (std::numeric_limits::max (), 0); NS_ASSERT (availableData == m_receivedPacket->GetSize ()); //cast availableData to void, to suppress 'availableData' set but not used //compiler warning @@ -164,7 +164,7 @@ void UdpSocketImplTest::ReceivePkt2 (Ptr socket) { uint32_t availableData; availableData = socket->GetRxAvailable (); - m_receivedPacket2 = socket->Recv (std::numeric_limits::max(), 0); + m_receivedPacket2 = socket->Recv (std::numeric_limits::max (), 0); NS_ASSERT (availableData == m_receivedPacket2->GetSize ()); //cast availableData to void, to suppress 'availableData' set but not used //compiler warning @@ -174,7 +174,7 @@ void UdpSocketImplTest::ReceivePkt2 (Ptr socket) void UdpSocketImplTest::DoSendData (Ptr socket, std::string to) { - Address realTo = InetSocketAddress (Ipv4Address(to.c_str()), 1234); + Address realTo = InetSocketAddress (Ipv4Address (to.c_str ()), 1234); NS_TEST_EXPECT_MSG_EQ (socket->SendTo (Create (123), 0, realTo), 123, "XXX"); } diff --git a/src/lte/helper/lte-helper.cc b/src/lte/helper/lte-helper.cc index 91b7c9ecc..8be0c3cd2 100644 --- a/src/lte/helper/lte-helper.cc +++ b/src/lte/helper/lte-helper.cc @@ -201,8 +201,8 @@ LteHelper::CreateEnbPhy (void) void LteHelper::AddMobility (Ptr phy, Ptr m) { - phy->GetDownlinkSpectrumPhy ()->SetMobility(m); - phy->GetUplinkSpectrumPhy ()->SetMobility(m); + phy->GetDownlinkSpectrumPhy ()->SetMobility (m); + phy->GetUplinkSpectrumPhy ()->SetMobility (m); } diff --git a/src/lte/model/simple-packet-scheduler.cc b/src/lte/model/simple-packet-scheduler.cc index 7cee89a50..8db68c2af 100644 --- a/src/lte/model/simple-packet-scheduler.cc +++ b/src/lte/model/simple-packet-scheduler.cc @@ -100,7 +100,7 @@ SimplePacketScheduler::DoRunPacketScheduler (void) if ((*it)->GetQueue ()->IsEmpty ()) { // Get the first packet form the queue. - Ptr p = enb->GetRrcEntity ()->GetDownlinkNgbrBearers ()->at(0)->GetRlcEntity ()->Dequeue (); + Ptr p = enb->GetRrcEntity ()->GetDownlinkNgbrBearers ()->at (0)->GetRlcEntity ()->Dequeue (); pb->AddPacket (p); } } @@ -112,7 +112,7 @@ SimplePacketScheduler::DoRunPacketScheduler (void) if ((*it)->GetQueue ()->IsEmpty ()) { // Get the first packet form the queue. - Ptr p = enb->GetRrcEntity ()->GetDownlinkNgbrBearers ()->at(0)->GetRlcEntity ()->Dequeue (); + Ptr p = enb->GetRrcEntity ()->GetDownlinkNgbrBearers ()->at (0)->GetRlcEntity ()->Dequeue (); pb->AddPacket (p); } } diff --git a/src/mesh/examples/mesh.cc b/src/mesh/examples/mesh.cc index ee77d69b1..e28236f1b 100644 --- a/src/mesh/examples/mesh.cc +++ b/src/mesh/examples/mesh.cc @@ -175,7 +175,7 @@ MeshTest::CreateNodes () { mesh.SetSpreadInterfaceChannels (MeshHelper::ZERO_CHANNEL); } - mesh.SetMacType ("RandomStart", TimeValue (Seconds(m_randomStart))); + mesh.SetMacType ("RandomStart", TimeValue (Seconds (m_randomStart))); // Set number of interfaces - default is single-interface mesh point mesh.SetNumberOfInterfaces (m_nIfaces); // Install protocols and return container if MeshPointDevices @@ -224,7 +224,7 @@ MeshTest::Run () CreateNodes (); InstallInternetStack (); InstallApplication (); - Simulator::Schedule (Seconds(m_totalTime), &MeshTest::Report, this); + Simulator::Schedule (Seconds (m_totalTime), &MeshTest::Report, this); Simulator::Stop (Seconds (m_totalTime)); Simulator::Run (); Simulator::Destroy (); @@ -240,10 +240,10 @@ MeshTest::Report () os << "mp-report-" << n << ".xml"; std::cerr << "Printing mesh point device #" << n << " diagnostics to " << os.str () << "\n"; std::ofstream of; - of.open (os.str().c_str()); + of.open (os.str ().c_str ()); if (!of.is_open ()) { - std::cerr << "Error: Can't open file " << os.str() << "\n"; + std::cerr << "Error: Can't open file " << os.str () << "\n"; return; } mesh.Report (*i, of); @@ -255,5 +255,5 @@ main (int argc, char *argv[]) { MeshTest t; t.Configure (argc, argv); - return t.Run(); + return t.Run (); } diff --git a/src/mesh/helper/dot11s/dot11s-installer.cc b/src/mesh/helper/dot11s/dot11s-installer.cc index ac901a911..b82297fbc 100644 --- a/src/mesh/helper/dot11s/dot11s-installer.cc +++ b/src/mesh/helper/dot11s/dot11s-installer.cc @@ -68,7 +68,7 @@ Dot11sStack::InstallStack (Ptr mp) { return false; } - if (mp->GetAddress() == m_root) + if (mp->GetAddress () == m_root) { hwmp->SetRoot (); } diff --git a/src/mesh/model/dot11s/hwmp-protocol-mac.cc b/src/mesh/model/dot11s/hwmp-protocol-mac.cc index f9e028e59..22b043270 100644 --- a/src/mesh/model/dot11s/hwmp-protocol-mac.cc +++ b/src/mesh/model/dot11s/hwmp-protocol-mac.cc @@ -104,7 +104,7 @@ HwmpProtocolMac::ReceiveAction (Ptr packet, const WifiMacHeader & header MeshInformationElementVector elements; packet->RemoveHeader (elements); std::vector failedDestinations; - for (MeshInformationElementVector::Iterator i = elements.Begin(); i != elements.End(); i++) + for (MeshInformationElementVector::Iterator i = elements.Begin (); i != elements.End (); i++) { if ((*i)->ElementId () == IE11S_RANN) { @@ -227,9 +227,9 @@ HwmpProtocolMac::SendPreq (std::vector preq) MeshInformationElementVector elements; for (std::vector::iterator i = preq.begin (); i != preq.end (); i++) { - elements.AddInformationElement(Ptr (&(*i))); + elements.AddInformationElement (Ptr (&(*i))); } - packet->AddHeader(elements); + packet->AddHeader (elements); packet->AddHeader (GetWifiActionHeader ()); //create 802.11 header: WifiMacHeader hdr; @@ -298,7 +298,7 @@ HwmpProtocolMac::SendPrep (IePrep prep, Mac48Address receiver) //Create packet Ptr packet = Create (); MeshInformationElementVector elements; - elements.AddInformationElement(Ptr (&prep)); + elements.AddInformationElement (Ptr (&prep)); packet->AddHeader (elements); packet->AddHeader (GetWifiActionHeader ()); //create 802.11 header: @@ -332,13 +332,13 @@ HwmpProtocolMac::ForwardPerr (std::vector faile } else { - elements.AddInformationElement(perr); + elements.AddInformationElement (perr); perr->ResetPerr (); } } if (perr->GetNumOfDest () > 0) { - elements.AddInformationElement(perr); + elements.AddInformationElement (perr); } packet->AddHeader (elements); packet->AddHeader (GetWifiActionHeader ()); diff --git a/src/mesh/model/dot11s/hwmp-protocol.cc b/src/mesh/model/dot11s/hwmp-protocol.cc index 8aa4c27a1..c889262c4 100644 --- a/src/mesh/model/dot11s/hwmp-protocol.cc +++ b/src/mesh/model/dot11s/hwmp-protocol.cc @@ -173,7 +173,7 @@ HwmpProtocol::HwmpProtocol () : m_hwmpSeqno (1), m_preqId (0), m_rtable (CreateObject ()), - m_randomStart(Seconds (0.1)), + m_randomStart (Seconds (0.1)), m_maxQueueSize (255), m_dot11MeshHWMPmaxPREQretries (3), m_dot11MeshHWMPnetDiameterTraversalTime (MicroSeconds (1024*100)), @@ -212,7 +212,7 @@ HwmpProtocol::DoDispose () { i->second.preqTimeout.Cancel (); } - m_proactivePreqTimer.Cancel(); + m_proactivePreqTimer.Cancel (); m_preqTimeouts.clear (); m_lastDataSeqno.clear (); m_hwmpSeqnoMetricDatabase.clear (); @@ -234,7 +234,7 @@ HwmpProtocol::RequestRoute ( { Ptr packet = constPacket->Copy (); HwmpTag tag; - if (sourceIface == GetMeshPoint ()->GetIfIndex()) + if (sourceIface == GetMeshPoint ()->GetIfIndex ()) { // packet from level 3 if (packet->PeekPacketTag (tag)) @@ -285,7 +285,7 @@ HwmpProtocol::RequestRoute ( std::vector receivers = GetBroadcastReceivers (plugin->first); for (std::vector::const_iterator i = receivers.begin (); i != receivers.end (); i++) { - Ptr packetCopy = packet->Copy(); + Ptr packetCopy = packet->Copy (); // // 64-bit Intel valgrind complains about tag.SetAddress (*i). It // likes this just fine. @@ -318,7 +318,7 @@ bool HwmpProtocol::ForwardUnicast (uint32_t sourceIface, const Mac48Address source, const Mac48Address destination, Ptr packet, uint16_t protocolType, RouteReplyCallback routeReply, uint32_t ttl) { - NS_ASSERT(destination != Mac48Address::GetBroadcast ()); + NS_ASSERT (destination != Mac48Address::GetBroadcast ()); HwmpRtable::LookupResult result = m_rtable->LookupReactive (destination); NS_LOG_DEBUG ("Requested src = "< > destinations = preq.GetDestinationList (); //Add reactive path to originator: if ( @@ -457,13 +457,13 @@ HwmpProtocol::ReceivePreq (IePreq preq, Mac48Address from, uint32_t interface, M } for (std::vector >::const_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 (preq.GetDestCount () == 1); NS_ASSERT (((*i)->IsDo ()) && ((*i)->IsRf ())); //Add proactive path only if it is the better then existed //before @@ -509,7 +509,7 @@ HwmpProtocol::ReceivePreq (IePreq preq, Mac48Address from, uint32_t interface, M preq.GetLifetime (), interface ); - NS_ASSERT(m_rtable->LookupReactive (preq.GetOriginatorAddress ()).retransmitter != Mac48Address::GetBroadcast ()); + NS_ASSERT (m_rtable->LookupReactive (preq.GetOriginatorAddress ()).retransmitter != Mac48Address::GetBroadcast ()); preq.DelDestinationAddressElement ((*i)->GetDestinationAddress ()); continue; } @@ -551,7 +551,7 @@ HwmpProtocol::ReceivePreq (IePreq preq, Mac48Address from, uint32_t interface, M return; } //Forward PREQ to all interfaces: - NS_LOG_DEBUG("I am " << GetAddress () << "retransmitting PREQ:" << preq); + NS_LOG_DEBUG ("I am " << GetAddress () << "retransmitting PREQ:" << preq); for (HwmpProtocolMacMap::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) { i->second->SendPreq (preq); @@ -617,13 +617,13 @@ HwmpProtocol::ReceivePrep (IePrep prep, Mac48Address from, uint32_t interface, M from, interface, metric, - MicroSeconds(prep.GetLifetime () * 1024), + MicroSeconds (prep.GetLifetime () * 1024), prep.GetOriginatorSeqNumber ()); ReactivePathResolved (fromMp); } if (prep.GetDestinationAddress () == GetAddress ()) { - NS_LOG_DEBUG("I am "<second->SendPrep (prep, retransmitter); m_stats.initiatedPrep++; } @@ -718,7 +718,7 @@ HwmpProtocol::Install (Ptr mp) return true; } void -HwmpProtocol::PeerLinkStatus(Mac48Address meshPointAddress, Mac48Address peerAddress, uint32_t interface, bool status) +HwmpProtocol::PeerLinkStatus (Mac48Address meshPointAddress, Mac48Address peerAddress, uint32_t interface, bool status) { if (status) { @@ -773,7 +773,7 @@ HwmpProtocol::MakePathError (std::vector destinations) return retval; } void -HwmpProtocol::InitiatePathError(PathError perr) +HwmpProtocol::InitiatePathError (PathError perr) { for (HwmpProtocolMacMap::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) { @@ -789,7 +789,7 @@ HwmpProtocol::InitiatePathError(PathError perr) } } void -HwmpProtocol::ForwardPathError(PathError perr) +HwmpProtocol::ForwardPathError (PathError perr) { for (HwmpProtocolMacMap::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++) { @@ -914,7 +914,7 @@ HwmpProtocol::ReactivePathResolved (Mac48Address dst) } HwmpRtable::LookupResult result = m_rtable->LookupReactive (dst); - NS_ASSERT(result.retransmitter != Mac48Address::GetBroadcast ()); + NS_ASSERT (result.retransmitter != Mac48Address::GetBroadcast ()); //Send all packets stored for this destination QueuedPacket packet = DequeueFirstPacketByDst (dst); while (packet.pkt != 0) @@ -1016,7 +1016,7 @@ HwmpProtocol::RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry) void HwmpProtocol::SetRoot () { - UniformVariable coefficient (0.0, m_randomStart.GetSeconds()); + UniformVariable coefficient (0.0, m_randomStart.GetSeconds ()); Time randomStart = Seconds (coefficient.GetValue ()); m_proactivePreqTimer = Simulator::Schedule (randomStart, &HwmpProtocol::SendProactivePreq, this); NS_LOG_DEBUG ("ROOT IS: " << m_address); diff --git a/src/mesh/model/dot11s/hwmp-rtable.cc b/src/mesh/model/dot11s/hwmp-rtable.cc index a1d8e2cb1..330397c70 100644 --- a/src/mesh/model/dot11s/hwmp-rtable.cc +++ b/src/mesh/model/dot11s/hwmp-rtable.cc @@ -217,7 +217,7 @@ HwmpRtable::GetPrecursors (Mac48Address destination) { if (i->whenExpire > Simulator::Now ()) { - retval.push_back (std::make_pair(i->interface, i->address)); + retval.push_back (std::make_pair (i->interface, i->address)); } } } diff --git a/src/mesh/model/dot11s/hwmp-rtable.h b/src/mesh/model/dot11s/hwmp-rtable.h index 2e014f02f..daf7ccd84 100644 --- a/src/mesh/model/dot11s/hwmp-rtable.h +++ b/src/mesh/model/dot11s/hwmp-rtable.h @@ -56,7 +56,7 @@ public: /// True for valid route bool IsValid () const; /// Compare route lookup results, used by tests - bool operator==(const LookupResult & o) const; + bool operator== (const LookupResult & o) const; }; /// Path precursor = {MAC, interface ID} typedef std::vector > PrecursorList; diff --git a/src/mesh/model/dot11s/peer-link.cc b/src/mesh/model/dot11s/peer-link.cc index 6da0b3956..6e3d6d043 100644 --- a/src/mesh/model/dot11s/peer-link.cc +++ b/src/mesh/model/dot11s/peer-link.cc @@ -31,7 +31,7 @@ NS_LOG_COMPONENT_DEFINE ("Dot11sPeerManagementProtocol"); namespace ns3 { namespace dot11s { -NS_OBJECT_ENSURE_REGISTERED( PeerLink); +NS_OBJECT_ENSURE_REGISTERED ( PeerLink); TypeId PeerLink::GetTypeId () diff --git a/src/mesh/model/dot11s/peer-management-protocol-mac.cc b/src/mesh/model/dot11s/peer-management-protocol-mac.cc index 4d8e20565..135f04d9f 100644 --- a/src/mesh/model/dot11s/peer-management-protocol-mac.cc +++ b/src/mesh/model/dot11s/peer-management-protocol-mac.cc @@ -70,7 +70,7 @@ PeerManagementProtocolMac::Receive (Ptr const_packet, const WifiMacHeade MgtBeaconHeader beacon_hdr; packet->RemoveHeader (beacon_hdr); MeshInformationElementVector elements; - packet->RemoveHeader(elements); + packet->RemoveHeader (elements); Ptr beaconTiming = DynamicCast (elements.FindFirst (IE11S_BEACON_TIMING)); Ptr meshId = DynamicCast (elements.FindFirst (IE11S_MESH_ID)); @@ -124,7 +124,7 @@ PeerManagementProtocolMac::Receive (Ptr const_packet, const WifiMacHeade //Peer Management element is the last element in this frame - so, we can use MeshInformationElementVector MeshInformationElementVector elements; packet->RemoveHeader (elements); - peerElement = DynamicCast(elements.FindFirst(IE11S_PEERING_MANAGEMENT)); + peerElement = DynamicCast(elements.FindFirst (IE11S_PEERING_MANAGEMENT)); NS_ASSERT (peerElement != 0); //Check taht frame subtype corresponds peer link subtype if (peerElement->SubtypeIsOpen ()) @@ -200,7 +200,7 @@ PeerManagementProtocolMac::SendPeerLinkManagementFrame (Mac48Address peerAddress meshConfig.SetNeighborCount (m_protocol->GetNumberOfLinks ()); Ptr packet = Create (); MeshInformationElementVector elements; - elements.AddInformationElement(Ptr (&peerElement)); + elements.AddInformationElement (Ptr (&peerElement)); packet->AddHeader (elements); PeerLinkFrameStart::PlinkFrameStartFields fields; fields.rates = m_parent->GetSupportedRates (); diff --git a/src/mesh/model/dot11s/peer-management-protocol.cc b/src/mesh/model/dot11s/peer-management-protocol.cc index 1860a1343..a3eab778f 100644 --- a/src/mesh/model/dot11s/peer-management-protocol.cc +++ b/src/mesh/model/dot11s/peer-management-protocol.cc @@ -239,8 +239,8 @@ PeerManagementProtocol::ConfigurationMismatch (uint32_t interface, Mac48Address void PeerManagementProtocol::TransmissionFailure (uint32_t interface, Mac48Address peerAddress) { - NS_LOG_DEBUG("transmission failed between "< peerLink = FindPeerLink(interface, peerAddress); + NS_LOG_DEBUG ("transmission failed between "< peerLink = FindPeerLink (interface, peerAddress); if (peerLink != 0) { peerLink->TransmissionFailure (); @@ -249,8 +249,8 @@ PeerManagementProtocol::TransmissionFailure (uint32_t interface, Mac48Address pe void PeerManagementProtocol::TransmissionSuccess (uint32_t interface, Mac48Address peerAddress) { - NS_LOG_DEBUG("transmission success "< peerLink = FindPeerLink(interface, peerAddress); + NS_LOG_DEBUG ("transmission success "< peerLink = FindPeerLink (interface, peerAddress); if (peerLink != 0) { peerLink->TransmissionSuccess (); diff --git a/src/mesh/model/flame/flame-rtable.h b/src/mesh/model/flame/flame-rtable.h index d66d17d25..5c1378bb4 100644 --- a/src/mesh/model/flame/flame-rtable.h +++ b/src/mesh/model/flame/flame-rtable.h @@ -61,7 +61,7 @@ public: /// True for valid route bool IsValid () const; /// Compare route lookup results, used by tests - bool operator==(const LookupResult & o) const; + bool operator== (const LookupResult & o) const; }; public: static TypeId GetTypeId (); diff --git a/src/mesh/model/mesh-information-element-vector.cc b/src/mesh/model/mesh-information-element-vector.cc index 6a2a04ca6..b0eb53704 100644 --- a/src/mesh/model/mesh-information-element-vector.cc +++ b/src/mesh/model/mesh-information-element-vector.cc @@ -37,7 +37,7 @@ namespace ns3 { uint32_t -MeshInformationElementVector::DeserializeSingleIe(Buffer::Iterator start) +MeshInformationElementVector::DeserializeSingleIe (Buffer::Iterator start) { Buffer::Iterator i = start; uint8_t id = i.ReadU8 (); @@ -88,7 +88,7 @@ MeshInformationElementVector::DeserializeSingleIe(Buffer::Iterator start) newElement->DeserializeInformationField (i, length); i.Next (length); m_elements.push_back (newElement); - return i.GetDistanceFrom(start); + return i.GetDistanceFrom (start); } diff --git a/src/mesh/test/dot11s/hwmp-proactive-regression.cc b/src/mesh/test/dot11s/hwmp-proactive-regression.cc index aaf8175e6..af1302f0d 100644 --- a/src/mesh/test/dot11s/hwmp-proactive-regression.cc +++ b/src/mesh/test/dot11s/hwmp-proactive-regression.cc @@ -56,7 +56,7 @@ HwmpProactiveRegressionTest::~HwmpProactiveRegressionTest () void HwmpProactiveRegressionTest::DoRun () { - SeedManager::SetSeed(12345); + SeedManager::SetSeed (12345); CreateNodes (); CreateDevices (); InstallApplications (); @@ -94,7 +94,7 @@ HwmpProactiveRegressionTest::InstallApplications () serverApps.Stop (m_time); UdpEchoClientHelper echoClient (m_interfaces.GetAddress (0), 9); echoClient.SetAttribute ("MaxPackets", UintegerValue (300)); - echoClient.SetAttribute ("Interval", TimeValue (Seconds(0.5))); + echoClient.SetAttribute ("Interval", TimeValue (Seconds (0.5))); echoClient.SetAttribute ("PacketSize", UintegerValue (100)); ApplicationContainer clientApps = echoClient.Install (m_nodes->Get (4)); clientApps.Start (Seconds (2.5)); @@ -112,7 +112,7 @@ HwmpProactiveRegressionTest::CreateDevices () // 2. setup mesh MeshHelper mesh = MeshHelper::Default (); mesh.SetStackInstaller ("ns3::Dot11sStack", "Root", Mac48AddressValue (Mac48Address ("00:00:00:00:00:0d"))); - mesh.SetMacType ("RandomStart", TimeValue (Seconds(0.1))); + mesh.SetMacType ("RandomStart", TimeValue (Seconds (0.1))); mesh.SetNumberOfInterfaces (1); NetDeviceContainer meshDevices = mesh.Install (wifiPhy, *m_nodes); // 3. setup TCP/IP @@ -122,7 +122,7 @@ HwmpProactiveRegressionTest::CreateDevices () address.SetBase ("10.1.1.0", "255.255.255.0"); m_interfaces = address.Assign (meshDevices); // 4. write PCAP if needed - std::string prefix = (WRITE_VECTORS ? NS_TEST_SOURCEDIR : std::string(GetTempDir ())) + PREFIX; + std::string prefix = (WRITE_VECTORS ? NS_TEST_SOURCEDIR : std::string (GetTempDir ())) + PREFIX; wifiPhy.EnablePcapAll (prefix); } @@ -136,9 +136,9 @@ HwmpProactiveRegressionTest::CheckResults () os1 << NS_TEST_SOURCEDIR << PREFIX << "-" << i << "-1.pcap"; os2 << GetTempDir () << PREFIX << "-" << i << "-1.pcap"; - uint32_t sec(0), usec(0); - bool diff = PcapFile::Diff (os1.str(), os2.str(), sec, usec); // TODO support default PcapWriter snap length here - NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str() + uint32_t sec (0), usec (0); + bool diff = PcapFile::Diff (os1.str (), os2.str (), sec, usec); // TODO support default PcapWriter snap length here + NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str () << " and " << os2.str () << " differ starting from " << sec << " s " << usec << " us"); } } diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression.cc b/src/mesh/test/dot11s/hwmp-reactive-regression.cc index 7bd27e2ff..0e8190e4b 100644 --- a/src/mesh/test/dot11s/hwmp-reactive-regression.cc +++ b/src/mesh/test/dot11s/hwmp-reactive-regression.cc @@ -52,7 +52,7 @@ HwmpReactiveRegressionTest::~HwmpReactiveRegressionTest () void HwmpReactiveRegressionTest::DoRun () { - SeedManager::SetSeed(12345); + SeedManager::SetSeed (12345); CreateNodes (); CreateDevices (); InstallApplications (); @@ -71,16 +71,16 @@ HwmpReactiveRegressionTest::CreateNodes () m_nodes->Create (6); MobilityHelper mobility; Ptr positionAlloc = CreateObject(); - positionAlloc->Add(Vector( 0, 0, 0)); - positionAlloc->Add(Vector( 0, 150, 0)); - positionAlloc->Add(Vector( 0, 300, 0)); - positionAlloc->Add(Vector( 0, 450, 0)); - positionAlloc->Add(Vector( 0, 600, 0)); - positionAlloc->Add(Vector( 0, 750, 0)); - mobility.SetPositionAllocator(positionAlloc); + positionAlloc->Add (Vector ( 0, 0, 0)); + positionAlloc->Add (Vector ( 0, 150, 0)); + positionAlloc->Add (Vector ( 0, 300, 0)); + positionAlloc->Add (Vector ( 0, 450, 0)); + positionAlloc->Add (Vector ( 0, 600, 0)); + positionAlloc->Add (Vector ( 0, 750, 0)); + mobility.SetPositionAllocator (positionAlloc); mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (*m_nodes); - Simulator::Schedule (Seconds(5.0), &HwmpReactiveRegressionTest::ResetPosition, this); + Simulator::Schedule (Seconds (5.0), &HwmpReactiveRegressionTest::ResetPosition, this); } void HwmpReactiveRegressionTest::InstallApplications () @@ -91,7 +91,7 @@ HwmpReactiveRegressionTest::InstallApplications () serverApps.Stop (m_time); UdpEchoClientHelper echoClient (m_interfaces.GetAddress (0), 9); echoClient.SetAttribute ("MaxPackets", UintegerValue (300)); - echoClient.SetAttribute ("Interval", TimeValue (Seconds(0.5))); + echoClient.SetAttribute ("Interval", TimeValue (Seconds (0.5))); echoClient.SetAttribute ("PacketSize", UintegerValue (20)); ApplicationContainer clientApps = echoClient.Install (m_nodes->Get (5)); clientApps.Start (Seconds (2.0)); @@ -109,7 +109,7 @@ HwmpReactiveRegressionTest::CreateDevices () // 2. setup mesh MeshHelper mesh = MeshHelper::Default (); mesh.SetStackInstaller ("ns3::Dot11sStack"); - mesh.SetMacType ("RandomStart", TimeValue (Seconds(0.1))); + mesh.SetMacType ("RandomStart", TimeValue (Seconds (0.1))); mesh.SetNumberOfInterfaces (1); NetDeviceContainer meshDevices = mesh.Install (wifiPhy, *m_nodes); // 3. setup TCP/IP @@ -119,7 +119,7 @@ HwmpReactiveRegressionTest::CreateDevices () address.SetBase ("10.1.1.0", "255.255.255.0"); m_interfaces = address.Assign (meshDevices); // 4. write PCAP if needed - std::string prefix = (WRITE_VECTORS ? NS_TEST_SOURCEDIR : std::string(GetTempDir ())) + PREFIX; + std::string prefix = (WRITE_VECTORS ? NS_TEST_SOURCEDIR : std::string (GetTempDir ())) + PREFIX; wifiPhy.EnablePcapAll (prefix); } @@ -134,9 +134,9 @@ HwmpReactiveRegressionTest::CheckResults () os1 << NS_TEST_SOURCEDIR << PREFIX << "-" << i << "-1.pcap"; os2 << GetTempDir () << PREFIX << "-" << i << "-1.pcap"; - uint32_t sec(0), usec(0); - bool diff = PcapFile::Diff (os1.str(), os2.str(), sec, usec); // TODO support default PcapWriter snap length here - NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str() + uint32_t sec (0), usec (0); + bool diff = PcapFile::Diff (os1.str (), os2.str (), sec, usec); // TODO support default PcapWriter snap length here + NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str () << " and " << os2.str () << " differ starting from " << sec << " s " << usec << " us"); } } @@ -144,12 +144,12 @@ HwmpReactiveRegressionTest::CheckResults () void HwmpReactiveRegressionTest::ResetPosition () { - Ptr object = m_nodes->Get(3); + Ptr object = m_nodes->Get (3); Ptr model = object->GetObject (); if (model == 0) { return; } - model->SetPosition (Vector(9000, 0, 0)); + model->SetPosition (Vector (9000, 0, 0)); } diff --git a/src/mesh/test/dot11s/hwmp-simplest-regression.cc b/src/mesh/test/dot11s/hwmp-simplest-regression.cc index 472e545bc..411ad5a6e 100644 --- a/src/mesh/test/dot11s/hwmp-simplest-regression.cc +++ b/src/mesh/test/dot11s/hwmp-simplest-regression.cc @@ -55,7 +55,7 @@ HwmpSimplestRegressionTest::~HwmpSimplestRegressionTest () void HwmpSimplestRegressionTest::DoRun () { - SeedManager::SetSeed(12345); + SeedManager::SetSeed (12345); CreateNodes (); CreateDevices (); InstallApplications (); @@ -83,18 +83,18 @@ HwmpSimplestRegressionTest::CreateNodes () "LayoutType", StringValue ("RowFirst")); mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (*m_nodes); - Simulator::Schedule (Seconds(10.0), &HwmpSimplestRegressionTest::ResetPosition, this); + Simulator::Schedule (Seconds (10.0), &HwmpSimplestRegressionTest::ResetPosition, this); } void HwmpSimplestRegressionTest::ResetPosition () { - Ptr object = m_nodes->Get(1); + Ptr object = m_nodes->Get (1); Ptr model = object->GetObject (); if (model == 0) { return; } - model->SetPosition (Vector(9000, 0, 0)); + model->SetPosition (Vector (9000, 0, 0)); } void HwmpSimplestRegressionTest::InstallApplications () @@ -105,7 +105,7 @@ HwmpSimplestRegressionTest::InstallApplications () serverApps.Stop (m_time); UdpEchoClientHelper echoClient (m_interfaces.GetAddress (0), 9); echoClient.SetAttribute ("MaxPackets", UintegerValue (300)); - echoClient.SetAttribute ("Interval", TimeValue (Seconds(0.05))); + echoClient.SetAttribute ("Interval", TimeValue (Seconds (0.05))); echoClient.SetAttribute ("PacketSize", UintegerValue (100)); ApplicationContainer clientApps = echoClient.Install (m_nodes->Get (1)); clientApps.Start (Seconds (2.0)); @@ -121,7 +121,7 @@ HwmpSimplestRegressionTest::CreateDevices () // 2. setup mesh MeshHelper mesh = MeshHelper::Default (); mesh.SetStackInstaller ("ns3::Dot11sStack"); - mesh.SetMacType ("RandomStart", TimeValue (Seconds(0.1))); + mesh.SetMacType ("RandomStart", TimeValue (Seconds (0.1))); mesh.SetNumberOfInterfaces (1); NetDeviceContainer meshDevices = mesh.Install (wifiPhy, *m_nodes); // 3. setup TCP/IP @@ -131,7 +131,7 @@ HwmpSimplestRegressionTest::CreateDevices () address.SetBase ("10.1.1.0", "255.255.255.0"); m_interfaces = address.Assign (meshDevices); // 4. write PCAP if needed - std::string prefix = (WRITE_VECTORS ? NS_TEST_SOURCEDIR : std::string(GetTempDir ())) + PREFIX; + std::string prefix = (WRITE_VECTORS ? NS_TEST_SOURCEDIR : std::string (GetTempDir ())) + PREFIX; wifiPhy.EnablePcapAll (prefix); } @@ -145,9 +145,9 @@ HwmpSimplestRegressionTest::CheckResults () os1 << NS_TEST_SOURCEDIR << PREFIX << "-" << i << "-1.pcap"; os2 << GetTempDir () << PREFIX << "-" << i << "-1.pcap"; - uint32_t sec(0), usec(0); - bool diff = PcapFile::Diff (os1.str(), os2.str(), sec, usec); // TODO support default PcapWriter snap length here - NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str() + uint32_t sec (0), usec (0); + bool diff = PcapFile::Diff (os1.str (), os2.str (), sec, usec); // TODO support default PcapWriter snap length here + NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str () << " and " << os2.str () << " differ starting from " << sec << " s " << usec << " us"); } } diff --git a/src/mesh/test/dot11s/hwmp-target-flags-regression.cc b/src/mesh/test/dot11s/hwmp-target-flags-regression.cc index 3bdf3748e..2f2cdeb93 100644 --- a/src/mesh/test/dot11s/hwmp-target-flags-regression.cc +++ b/src/mesh/test/dot11s/hwmp-target-flags-regression.cc @@ -55,7 +55,7 @@ HwmpDoRfRegressionTest::~HwmpDoRfRegressionTest () void HwmpDoRfRegressionTest::DoRun () { - SeedManager::SetSeed(12345); + SeedManager::SetSeed (12345); CreateNodes (); CreateDevices (); InstallApplications (); @@ -93,7 +93,7 @@ HwmpDoRfRegressionTest::InstallApplications () serverApps.Stop (m_time); UdpEchoClientHelper echoClient (m_interfaces.GetAddress (0), 9); echoClient.SetAttribute ("MaxPackets", UintegerValue (300)); - echoClient.SetAttribute ("Interval", TimeValue (Seconds(1.0))); + echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0))); echoClient.SetAttribute ("PacketSize", UintegerValue (100)); //Install first client ApplicationContainer clientApps = echoClient.Install (m_nodes->Get (1)); @@ -110,7 +110,7 @@ HwmpDoRfRegressionTest::InstallApplications () serverApps.Stop (m_time); UdpEchoClientHelper echoClient1 (m_interfaces.GetAddress (3), 10); echoClient1.SetAttribute ("MaxPackets", UintegerValue (300)); - echoClient1.SetAttribute ("Interval", TimeValue (Seconds(1.0))); + echoClient1.SetAttribute ("Interval", TimeValue (Seconds (1.0))); echoClient1.SetAttribute ("PacketSize", UintegerValue (100)); clientApps = echoClient1.Install (m_nodes->Get (0)); clientApps.Start (Seconds (2.4)); @@ -128,7 +128,7 @@ HwmpDoRfRegressionTest::CreateDevices () // 2. setup mesh MeshHelper mesh = MeshHelper::Default (); mesh.SetStackInstaller ("ns3::Dot11sStack"); - mesh.SetMacType ("RandomStart", TimeValue (Seconds(0.1))); + mesh.SetMacType ("RandomStart", TimeValue (Seconds (0.1))); mesh.SetNumberOfInterfaces (1); NetDeviceContainer meshDevices = mesh.Install (wifiPhy, *m_nodes); // 3. setup TCP/IP @@ -138,7 +138,7 @@ HwmpDoRfRegressionTest::CreateDevices () address.SetBase ("10.1.1.0", "255.255.255.0"); m_interfaces = address.Assign (meshDevices); // 4. write PCAP if needed - std::string prefix = (WRITE_VECTORS ? NS_TEST_SOURCEDIR : std::string(GetTempDir ())) + PREFIX; + std::string prefix = (WRITE_VECTORS ? NS_TEST_SOURCEDIR : std::string (GetTempDir ())) + PREFIX; wifiPhy.EnablePcapAll (prefix); } @@ -152,9 +152,9 @@ HwmpDoRfRegressionTest::CheckResults () os1 << NS_TEST_SOURCEDIR << PREFIX << "-" << i << "-1.pcap"; os2 << GetTempDir () << PREFIX << "-" << i << "-1.pcap"; - uint32_t sec(0), usec(0); - bool diff = PcapFile::Diff (os1.str(), os2.str(), sec, usec); // TODO support default PcapWriter snap length here - NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str() + uint32_t sec (0), usec (0); + bool diff = PcapFile::Diff (os1.str (), os2.str (), sec, usec); // TODO support default PcapWriter snap length here + NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str () << " and " << os2.str () << " differ starting from " << sec << " s " << usec << " us"); } } diff --git a/src/mesh/test/dot11s/pmp-regression.cc b/src/mesh/test/dot11s/pmp-regression.cc index a772dfc10..4f5557de5 100644 --- a/src/mesh/test/dot11s/pmp-regression.cc +++ b/src/mesh/test/dot11s/pmp-regression.cc @@ -53,7 +53,7 @@ PeerManagementProtocolRegressionTest::~PeerManagementProtocolRegressionTest () void PeerManagementProtocolRegressionTest::DoRun () { - SeedManager::SetSeed(12345); + SeedManager::SetSeed (12345); CreateNodes (); CreateDevices (); @@ -93,11 +93,11 @@ PeerManagementProtocolRegressionTest::CreateDevices () // 2. setup mesh MeshHelper mesh = MeshHelper::Default (); mesh.SetStackInstaller ("ns3::Dot11sStack"); - mesh.SetMacType ("RandomStart", TimeValue (Seconds(0.1))); + mesh.SetMacType ("RandomStart", TimeValue (Seconds (0.1))); mesh.SetNumberOfInterfaces (1); NetDeviceContainer meshDevices = mesh.Install (wifiPhy, *m_nodes); // 3. write PCAP if needed - std::string prefix = (WRITE_VECTORS ? NS_TEST_SOURCEDIR : std::string(GetTempDir ())) + PREFIX; + std::string prefix = (WRITE_VECTORS ? NS_TEST_SOURCEDIR : std::string (GetTempDir ())) + PREFIX; wifiPhy.EnablePcapAll (prefix); } @@ -111,9 +111,9 @@ PeerManagementProtocolRegressionTest::CheckResults () os1 << NS_TEST_SOURCEDIR << PREFIX << "-" << i << "-1.pcap"; os2 << GetTempDir () << PREFIX << "-" << i << "-1.pcap"; - uint32_t sec(0), usec(0); - bool diff = PcapFile::Diff (os1.str(), os2.str(), sec, usec); // TODO support default PcapWriter snap length here - NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str() + uint32_t sec (0), usec (0); + bool diff = PcapFile::Diff (os1.str (), os2.str (), sec, usec); // TODO support default PcapWriter snap length here + NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str () << " and " << os2.str () << " differ starting from " << sec << " s " << usec << " us"); } } diff --git a/src/mesh/test/flame/flame-regression.cc b/src/mesh/test/flame/flame-regression.cc index 0e04a73de..f5b70074b 100644 --- a/src/mesh/test/flame/flame-regression.cc +++ b/src/mesh/test/flame/flame-regression.cc @@ -56,7 +56,7 @@ FlameRegressionTest::~FlameRegressionTest () void FlameRegressionTest::DoRun () { - SeedManager::SetSeed(12345); + SeedManager::SetSeed (12345); CreateNodes (); CreateDevices (); InstallApplications (); @@ -99,7 +99,7 @@ FlameRegressionTest::CreateDevices () // 2. setup mesh MeshHelper mesh = MeshHelper::Default (); mesh.SetStackInstaller ("ns3::FlameStack"); - mesh.SetMacType ("RandomStart", TimeValue (Seconds(0.1))); + mesh.SetMacType ("RandomStart", TimeValue (Seconds (0.1))); mesh.SetNumberOfInterfaces (1); NetDeviceContainer meshDevices = mesh.Install (wifiPhy, *m_nodes); // 3. setup TCP/IP @@ -122,7 +122,7 @@ FlameRegressionTest::InstallApplications () serverApps.Stop (m_time); UdpEchoClientHelper echoClient (m_interfaces.GetAddress (0), 9); echoClient.SetAttribute ("MaxPackets", UintegerValue (300)); - echoClient.SetAttribute ("Interval", TimeValue (Seconds(1.1))); + echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.1))); echoClient.SetAttribute ("PacketSize", UintegerValue (20)); ApplicationContainer clientApps = echoClient.Install (m_nodes->Get (2)); clientApps.Start (Seconds (1.0)); @@ -139,9 +139,9 @@ FlameRegressionTest::CheckResults () os1 << NS_TEST_SOURCEDIR << PREFIX << "-" << i << "-1.pcap"; os2 << GetTempDir () << PREFIX << "-" << i << "-1.pcap"; - uint32_t sec(0), usec(0); - bool diff = PcapFile::Diff (os1.str(), os2.str(), sec, usec); // TODO support default PcapWriter snap length here - NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str() + uint32_t sec (0), usec (0); + bool diff = PcapFile::Diff (os1.str (), os2.str (), sec, usec); // TODO support default PcapWriter snap length here + NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str () << " and " << os2.str () << " differ starting from " << sec << " s " << usec << " us"); } } diff --git a/src/mobility/model/mobility-model.cc b/src/mobility/model/mobility-model.cc index 1a976d41e..bf585db44 100644 --- a/src/mobility/model/mobility-model.cc +++ b/src/mobility/model/mobility-model.cc @@ -86,7 +86,7 @@ MobilityModel::GetDistanceFrom (Ptr other) const void MobilityModel::NotifyCourseChange (void) const { - m_courseChangeTrace(this); + m_courseChangeTrace (this); } } // namespace ns3 diff --git a/src/mobility/model/position-allocator.cc b/src/mobility/model/position-allocator.cc index 9a81fd5fd..aeccc11a7 100644 --- a/src/mobility/model/position-allocator.cc +++ b/src/mobility/model/position-allocator.cc @@ -72,7 +72,7 @@ ListPositionAllocator::GetNext (void) const { Vector v = *m_current; m_current++; - if (m_current == m_positions.end()) + if (m_current == m_positions.end ()) { m_current = m_positions.begin (); } @@ -445,7 +445,7 @@ UniformDiscPositionAllocator::GetNext (void) const x = r.GetValue (); y = r.GetValue (); } - while (sqrt(x*x + y*y) > m_rho); + while (sqrt (x*x + y*y) > m_rho); x += m_x; y += m_y; diff --git a/src/mobility/model/steady-state-random-waypoint-mobility-model.cc b/src/mobility/model/steady-state-random-waypoint-mobility-model.cc index 1d417ed2a..d95ed71ff 100644 --- a/src/mobility/model/steady-state-random-waypoint-mobility-model.cc +++ b/src/mobility/model/steady-state-random-waypoint-mobility-model.cc @@ -118,24 +118,24 @@ SteadyStateRandomWaypointMobilityModel::SteadyStateStart (void) double log2 = a*a / b*std::log (std::sqrt ((b*b)/(a*a) + 1) + b/a); double expectedTravelTime = 1.0/6.0*(log1 + log2); expectedTravelTime += 1.0/15.0*((a*a*a)/(b*b) + (b*b*b)/(a*a)) - - 1.0/15.0*std::sqrt(a*a + b*b)*((a*a)/(b*b) + (b*b)/(a*a) - 3); + 1.0/15.0*std::sqrt (a*a + b*b)*((a*a)/(b*b) + (b*b)/(a*a) - 3); if (v0 == v1) { expectedTravelTime /= v0; } else { - expectedTravelTime *= std::log(v1/v0)/(v1 - v0); + expectedTravelTime *= std::log (v1/v0)/(v1 - v0); } double probabilityPaused = expectedPauseTime/(expectedPauseTime + expectedTravelTime); NS_ASSERT (probabilityPaused >= 0 && probabilityPaused <= 1); UniformVariable u_r; - double u = u_r.GetValue(0, 1); + double u = u_r.GetValue (0, 1); if (u < probabilityPaused) // node initially paused { m_helper.SetPosition (m_position->GetNext ()); - u = u_r.GetValue(0, 1); + u = u_r.GetValue (0, 1); Time pause; if (m_minPause != m_maxPause) { @@ -154,7 +154,7 @@ SteadyStateRandomWaypointMobilityModel::SteadyStateStart (void) { pause = Seconds (u*expectedPauseTime); } - NS_ASSERT (!m_event.IsRunning()); + NS_ASSERT (!m_event.IsRunning ()); m_event = Simulator::Schedule (pause, &SteadyStateRandomWaypointMobilityModel::BeginWalk, this); } else // node initially moving @@ -175,7 +175,7 @@ SteadyStateRandomWaypointMobilityModel::SteadyStateStart (void) } double u2 = u_r.GetValue (0, 1); m_helper.SetPosition (Vector (m_minX + u2*x1 + (1 - u2)*x2, m_minY + u2*y1 + (1 - u2)*y2, 0)); - NS_ASSERT (!m_event.IsRunning()); + NS_ASSERT (!m_event.IsRunning ()); m_event = Simulator::ScheduleNow (&SteadyStateRandomWaypointMobilityModel::SteadyStateBeginWalk, this, Vector (m_minX + x2, m_minY + y2, 0)); } diff --git a/src/mobility/test/steady-state-random-waypoint-mobility-model-test.cc b/src/mobility/test/steady-state-random-waypoint-mobility-model-test.cc index d042f2c82..14a3838b0 100644 --- a/src/mobility/test/steady-state-random-waypoint-mobility-model-test.cc +++ b/src/mobility/test/steady-state-random-waypoint-mobility-model-test.cc @@ -45,7 +45,7 @@ private: void SteadyStateRandomWaypointTest::DoRun (void) { - SeedManager::SetSeed(123); + SeedManager::SetSeed (123); // Total simulation time, seconds double totalTime = 1000; @@ -92,9 +92,9 @@ SteadyStateRandomWaypointTest::DistribCompare () for (i = mobilityStack.begin (); i != mobilityStack.end (); ++i) { model = (*i); - velocity = sqrt (pow (model->GetVelocity().x, 2) + pow (model->GetVelocity().y, 2)); - sum_x += model->GetPosition().x; - sum_y += model->GetPosition().y; + velocity = sqrt (pow (model->GetVelocity ().x, 2) + pow (model->GetVelocity ().y, 2)); + sum_x += model->GetPosition ().x; + sum_y += model->GetPosition ().y; sum_v += velocity; } double mean_x = sum_x / count; @@ -112,10 +112,10 @@ SteadyStateRandomWaypointTest::DistribCompare () for (i = mobilityStack.begin (); i != mobilityStack.end (); ++i) { model = (*i); - velocity = sqrt (pow (model->GetVelocity().x, 2) + pow (model->GetVelocity().y, 2)); - tmp = model->GetPosition().x - mean_x; + velocity = sqrt (pow (model->GetVelocity ().x, 2) + pow (model->GetVelocity ().y, 2)); + tmp = model->GetPosition ().x - mean_x; sum_x += tmp * tmp; - tmp = model->GetPosition().y - mean_y; + tmp = model->GetPosition ().y - mean_y; sum_y += tmp * tmp; tmp = velocity - mean_v; sum_v += tmp * tmp; diff --git a/src/mpi/examples/third-distributed.cc b/src/mpi/examples/third-distributed.cc index 681c08bc3..e49a6d6d9 100644 --- a/src/mpi/examples/third-distributed.cc +++ b/src/mpi/examples/third-distributed.cc @@ -94,8 +94,8 @@ main (int argc, char *argv[]) if (verbose) { - LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO); - LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO); + LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO); + LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO); } NodeContainer p2pNodes; diff --git a/src/netanim/examples/dumbbell-animation.cc b/src/netanim/examples/dumbbell-animation.cc index d668a518d..b2297d2e2 100644 --- a/src/netanim/examples/dumbbell-animation.cc +++ b/src/netanim/examples/dumbbell-animation.cc @@ -61,9 +61,9 @@ int main (int argc, char *argv[]) pointToPointLeaf.SetDeviceAttribute ("DataRate", StringValue ("10Mbps")); pointToPointLeaf.SetChannelAttribute ("Delay", StringValue ("1ms")); - PointToPointDumbbellHelper d(nLeftLeaf, pointToPointLeaf, - nRightLeaf, pointToPointLeaf, - pointToPointRouter); + PointToPointDumbbellHelper d (nLeftLeaf, pointToPointLeaf, + nRightLeaf, pointToPointLeaf, + pointToPointRouter); // Install Stack InternetStackHelper stack; @@ -87,7 +87,7 @@ int main (int argc, char *argv[]) // Create an on/off app sending packets to the same leaf right side AddressValue remoteAddress (InetSocketAddress (d.GetLeftIpv4Address (i), 1000)); clientHelper.SetAttribute ("Remote", remoteAddress); - clientApps.Add(clientHelper.Install (d.GetRight (i))); + clientApps.Add (clientHelper.Install (d.GetRight (i))); } clientApps.Start (Seconds (0.0)); @@ -116,6 +116,6 @@ int main (int argc, char *argv[]) std::cout << "Destroying the simulation" << std::endl; Simulator::Destroy (); std::cout << "Stopping the animation" << std::endl; - anim.StopAnimation(); + anim.StopAnimation (); return 0; } diff --git a/src/netanim/examples/grid-animation.cc b/src/netanim/examples/grid-animation.cc index 998407b36..349061314 100644 --- a/src/netanim/examples/grid-animation.cc +++ b/src/netanim/examples/grid-animation.cc @@ -104,6 +104,6 @@ int main (int argc, char *argv[]) std::cout << "Destroying the simulation" << std::endl; Simulator::Destroy (); std::cout << "Stopping the animation" << std::endl; - anim.StopAnimation(); + anim.StopAnimation (); return 0; } diff --git a/src/netanim/examples/star-animation.cc b/src/netanim/examples/star-animation.cc index 3d73f8ee2..61d5cc91b 100644 --- a/src/netanim/examples/star-animation.cc +++ b/src/netanim/examples/star-animation.cc @@ -59,7 +59,7 @@ main (int argc, char *argv[]) std::string animFile; CommandLine cmd; - cmd.AddValue("nSpokes", "Number of spoke nodes to place in the star", nSpokes); + cmd.AddValue ("nSpokes", "Number of spoke nodes to place in the star", nSpokes); cmd.AddValue ("animPort", "Port Number for Remote Animation", animPort); cmd.AddValue ("animFile", "File Name for Animation Output", animFile); diff --git a/src/netanim/model/animation-interface.cc b/src/netanim/model/animation-interface.cc index d55efd9e3..0f94c6502 100644 --- a/src/netanim/model/animation-interface.cc +++ b/src/netanim/model/animation-interface.cc @@ -188,11 +188,11 @@ void AnimationInterface::DevTxTrace (std::string context, Ptr p, { Time now = Simulator::Now (); ostringstream oss; - oss << now.GetSeconds() << " P " + oss << now.GetSeconds () << " P " << tx->GetNode ()->GetId () << " " << rx->GetNode ()->GetId () << " " << (now + txTime).GetSeconds () << " " // last bit tx time - << (now + rxTime - txTime).GetSeconds() << " " // first bit rx time + << (now + rxTime - txTime).GetSeconds () << " " // first bit rx time << (now + rxTime).GetSeconds () << endl; // last bit rx time WriteN (m_fHandle, oss.str ().c_str (), oss.str ().length ()); } diff --git a/src/network/helper/trace-helper.cc b/src/network/helper/trace-helper.cc index 3343e9927..db52a9270 100644 --- a/src/network/helper/trace-helper.cc +++ b/src/network/helper/trace-helper.cc @@ -31,7 +31,7 @@ #include "trace-helper.h" -NS_LOG_COMPONENT_DEFINE("TraceHelper"); +NS_LOG_COMPONENT_DEFINE ("TraceHelper"); namespace ns3 { @@ -167,7 +167,7 @@ void PcapHelper::DefaultSink (Ptr file, Ptr p) { NS_LOG_FUNCTION (file << p); - file->Write(Simulator::Now(), p); + file->Write (Simulator::Now (), p); } AsciiTraceHelper::AsciiTraceHelper () diff --git a/src/network/model/address.cc b/src/network/model/address.cc index 6878fe6a7..a71abdc9d 100644 --- a/src/network/model/address.cc +++ b/src/network/model/address.cc @@ -197,8 +197,8 @@ bool operator < (const Address &a, const Address &b) { return false; } - NS_ASSERT (a.GetLength() == b.GetLength()); - for (uint8_t i = 0; i < a.GetLength(); i++) + NS_ASSERT (a.GetLength () == b.GetLength ()); + for (uint8_t i = 0; i < a.GetLength (); i++) { if (a.m_data[i] < b.m_data[i]) { @@ -215,16 +215,16 @@ bool operator < (const Address &a, const Address &b) std::ostream& operator<< (std::ostream& os, const Address & address) { os.setf (std::ios::hex, std::ios::basefield); - os.fill('0'); - os << std::setw(2) << (uint32_t) address.m_type << "-" << std::setw(2) << (uint32_t) address.m_len << "-"; + os.fill ('0'); + os << std::setw (2) << (uint32_t) address.m_type << "-" << std::setw (2) << (uint32_t) address.m_len << "-"; for (uint8_t i = 0; i < (address.m_len-1); ++i) { - os << std::setw(2) << (uint32_t)address.m_data[i] << ":"; + os << std::setw (2) << (uint32_t)address.m_data[i] << ":"; } // Final byte not suffixed by ":" - os << std::setw(2) << (uint32_t) address.m_data[address.m_len-1]; + os << std::setw (2) << (uint32_t) address.m_data[address.m_len-1]; os.setf (std::ios::dec, std::ios::basefield); - os.fill(' '); + os.fill (' '); return os; } diff --git a/src/network/model/application.cc b/src/network/model/application.cc index e77f3cb0b..69304fc13 100644 --- a/src/network/model/application.cc +++ b/src/network/model/application.cc @@ -94,7 +94,7 @@ Application::DoStart (void) Object::DoStart (); } -Ptr Application::GetNode() const +Ptr Application::GetNode () const { return m_node; } @@ -107,11 +107,11 @@ Application::SetNode (Ptr node) // Protected methods // StartApp and StopApp will likely be overridden by application subclasses -void Application::StartApplication() +void Application::StartApplication () { // Provide null functionality in case subclass is not interested } -void Application::StopApplication() +void Application::StopApplication () { // Provide null functionality in case subclass is not interested } diff --git a/src/network/model/buffer.cc b/src/network/model/buffer.cc index fc87433c6..0fd99c17c 100644 --- a/src/network/model/buffer.cc +++ b/src/network/model/buffer.cc @@ -68,7 +68,7 @@ uint32_t Buffer::g_recommendedStart = 0; #define MAGIC_DESTROYED (~(long) 0) #define IS_UNINITIALIZED(x) (x == (Buffer::FreeList*)0) #define IS_DESTROYED(x) (x == (Buffer::FreeList*)MAGIC_DESTROYED) -#define IS_INITIALIZED(x) (!IS_UNINITIALIZED(x) && !IS_DESTROYED(x)) +#define IS_INITIALIZED(x) (!IS_UNINITIALIZED (x) && !IS_DESTROYED (x)) #define DESTROYED ((Buffer::FreeList*)MAGIC_DESTROYED) #define UNINITIALIZED ((Buffer::FreeList*)0) uint32_t Buffer::g_maxSize = 0; @@ -77,7 +77,7 @@ struct Buffer::LocalStaticDestructor Buffer::g_localStaticDestructor; Buffer::LocalStaticDestructor::~LocalStaticDestructor(void) { - if (IS_INITIALIZED(g_freeList)) + if (IS_INITIALIZED (g_freeList)) { for (Buffer::FreeList::iterator i = g_freeList->begin (); i != g_freeList->end (); i++) @@ -93,18 +93,18 @@ void Buffer::Recycle (struct Buffer::Data *data) { NS_ASSERT (data->m_count == 0); - NS_ASSERT (!IS_UNINITIALIZED(g_freeList)); + NS_ASSERT (!IS_UNINITIALIZED (g_freeList)); g_maxSize = std::max (g_maxSize, data->m_size); /* feed into free list */ if (data->m_size < g_maxSize || - IS_DESTROYED(g_freeList) || + IS_DESTROYED (g_freeList) || g_freeList->size () > 1000) { Buffer::Deallocate (data); } else { - NS_ASSERT (IS_INITIALIZED(g_freeList)); + NS_ASSERT (IS_INITIALIZED (g_freeList)); g_freeList->push_back (data); } } @@ -113,11 +113,11 @@ Buffer::Data * Buffer::Create (uint32_t dataSize) { /* try to find a buffer correctly sized. */ - if (IS_UNINITIALIZED(g_freeList)) + if (IS_UNINITIALIZED (g_freeList)) { g_freeList = new Buffer::FreeList (); } - else if (IS_INITIALIZED(g_freeList)) + else if (IS_INITIALIZED (g_freeList)) { while (!g_freeList->empty ()) { @@ -611,7 +611,7 @@ Buffer::Serialize (uint8_t* buffer, uint32_t maxSize) const if (size + ((dataStartLength + 3) & (~3)) <= maxSize) { size += (dataStartLength + 3) & (~3); - memcpy(p, m_data->m_data + m_start, dataStartLength); + memcpy (p, m_data->m_data + m_start, dataStartLength); p += (((dataStartLength + 3) & (~3))/4); // Advance p, insuring 4 byte boundary } else @@ -635,7 +635,7 @@ Buffer::Serialize (uint8_t* buffer, uint32_t maxSize) const if (size + ((dataEndLength + 3) & (~3)) <= maxSize) { size += (dataEndLength + 3) & (~3); - memcpy(p, m_data->m_data+m_zeroAreaStart,dataEndLength); + memcpy (p, m_data->m_data+m_zeroAreaStart,dataEndLength); p += (((dataEndLength + 3) & (~3))/4); // Advance p, insuring 4 byte boundary } else @@ -722,12 +722,12 @@ Buffer::PeekData (void) const } void -Buffer::CopyData(std::ostream *os, uint32_t size) const +Buffer::CopyData (std::ostream *os, uint32_t size) const { if (size > 0) { uint32_t tmpsize = std::min (m_zeroAreaStart-m_start, size); - os->write((const char*)(m_data->m_data + m_start), tmpsize); + os->write ((const char*)(m_data->m_data + m_start), tmpsize); if (size > tmpsize) { size -= m_zeroAreaStart-m_start; @@ -1115,13 +1115,13 @@ Buffer::Iterator::Read (uint8_t *buffer, uint32_t size) } uint16_t -Buffer::Iterator::CalculateIpChecksum(uint16_t size) +Buffer::Iterator::CalculateIpChecksum (uint16_t size) { - return CalculateIpChecksum(size, 0); + return CalculateIpChecksum (size, 0); } uint16_t -Buffer::Iterator::CalculateIpChecksum(uint16_t size, uint32_t initialChecksum) +Buffer::Iterator::CalculateIpChecksum (uint16_t size, uint32_t initialChecksum) { /* see RFC 1071 to understand this code. */ uint32_t sum = initialChecksum; diff --git a/src/network/model/buffer.h b/src/network/model/buffer.h index 65617fb12..95b5f4eb4 100644 --- a/src/network/model/buffer.h +++ b/src/network/model/buffer.h @@ -342,7 +342,7 @@ public: * \param size size of the buffer. * \return checksum */ - uint16_t CalculateIpChecksum(uint16_t size); + uint16_t CalculateIpChecksum (uint16_t size); /** * \brief Calculate the checksum. @@ -350,7 +350,7 @@ public: * \param initialChecksum initial value * \return checksum */ - uint16_t CalculateIpChecksum(uint16_t size, uint32_t initialChecksum); + uint16_t CalculateIpChecksum (uint16_t size, uint32_t initialChecksum); /** * \returns the size of the underlying buffer we are iterating diff --git a/src/network/model/channel.cc b/src/network/model/channel.cc index be32b65bd..daee0713e 100644 --- a/src/network/model/channel.cc +++ b/src/network/model/channel.cc @@ -43,7 +43,7 @@ Channel::GetTypeId (void) } Channel::Channel () - : m_id(0) + : m_id (0) { NS_LOG_FUNCTION_NOARGS (); m_id = ChannelList::Add (this); diff --git a/src/network/model/net-device.h b/src/network/model/net-device.h index 9e6048e28..1ada158b7 100644 --- a/src/network/model/net-device.h +++ b/src/network/model/net-device.h @@ -81,11 +81,11 @@ public: /** * \param index ifIndex of the device */ - virtual void SetIfIndex(const uint32_t index) = 0; + virtual void SetIfIndex (const uint32_t index) = 0; /** * \return index ifIndex of the device */ - virtual uint32_t GetIfIndex(void) const = 0; + virtual uint32_t GetIfIndex (void) const = 0; /** @@ -219,7 +219,7 @@ public: * * \return whether the Send operation succeeded */ - virtual bool Send(Ptr packet, const Address& dest, uint16_t protocolNumber) = 0; + virtual bool Send (Ptr packet, const Address& dest, uint16_t protocolNumber) = 0; /** * \param packet packet sent from above down to Network Device * \param source source mac address (so called "MAC spoofing") @@ -233,7 +233,7 @@ public: * * \return whether the Send operation succeeded */ - virtual bool SendFrom(Ptr packet, const Address& source, const Address& dest, uint16_t protocolNumber) = 0; + virtual bool SendFrom (Ptr packet, const Address& source, const Address& dest, uint16_t protocolNumber) = 0; /** * \returns the node base class which contains this network * interface. diff --git a/src/network/model/nix-vector.cc b/src/network/model/nix-vector.cc index c0442dca0..79dc8cddb 100644 --- a/src/network/model/nix-vector.cc +++ b/src/network/model/nix-vector.cc @@ -102,7 +102,7 @@ NixVector::AddNeighborIndex (uint32_t newBits, uint32_t numberOfBits) { // can't add any more to this vector, so // start a new one - m_nixVector.push_back(newBits); + m_nixVector.push_back (newBits); // also reset number of bits in // m_currentVectorBitSize @@ -263,7 +263,7 @@ NixVector::Serialize (uint32_t* buffer, uint32_t maxSize) const if (size + 4 <= maxSize) { size += 4; - *p++ = m_nixVector.at(j); + *p++ = m_nixVector.at (j); } else { diff --git a/src/network/model/nix-vector.h b/src/network/model/nix-vector.h index 86a3cdf6a..14874a6c8 100644 --- a/src/network/model/nix-vector.h +++ b/src/network/model/nix-vector.h @@ -155,7 +155,7 @@ private: /* for printing of nix-vector */ void DumpNixVector (std::ostream &os) const; /* for printing of nix-vector */ - friend std::ostream & operator <<( std::ostream &outs, const NixVector &nix); + friend std::ostream & operator << ( std::ostream &outs, const NixVector &nix); /* the actual nix-vector */ NixBits_t m_nixVector; diff --git a/src/network/model/node.cc b/src/network/model/node.cc index ba27f8292..2aeb676a6 100644 --- a/src/network/model/node.cc +++ b/src/network/model/node.cc @@ -67,15 +67,15 @@ Node::GetTypeId (void) } Node::Node() - : m_id(0), - m_sid(0) + : m_id (0), + m_sid (0) { Construct (); } Node::Node(uint32_t sid) - : m_id(0), - m_sid(sid) + : m_id (0), + m_sid (sid) { Construct (); } @@ -108,7 +108,7 @@ Node::AddDevice (Ptr device) uint32_t index = m_devices.size (); m_devices.push_back (device); device->SetNode (this); - device->SetIfIndex(index); + device->SetIfIndex (index); device->SetReceiveCallback (MakeCallback (&Node::NonPromiscReceiveFromDevice, this)); Simulator::ScheduleWithContext (GetId (), Seconds (0.0), &NetDevice::Start, device); @@ -152,7 +152,7 @@ Node::GetNApplications (void) const } void -Node::DoDispose() +Node::DoDispose () { m_handlers.clear (); for (std::vector >::iterator i = m_devices.begin (); @@ -255,7 +255,7 @@ bool Node::PromiscReceiveFromDevice (Ptr device, Ptr packet, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType) { - NS_LOG_FUNCTION(this); + NS_LOG_FUNCTION (this); return ReceiveFromDevice (device, packet, protocol, from, to, packetType, true); } @@ -263,8 +263,8 @@ bool Node::NonPromiscReceiveFromDevice (Ptr device, Ptr packet, uint16_t protocol, const Address &from) { - NS_LOG_FUNCTION(this); - return ReceiveFromDevice (device, packet, protocol, from, device->GetAddress(), NetDevice::PacketType (0), false); + NS_LOG_FUNCTION (this); + return ReceiveFromDevice (device, packet, protocol, from, device->GetAddress (), NetDevice::PacketType (0), false); } bool @@ -274,9 +274,9 @@ Node::ReceiveFromDevice (Ptr device, Ptr packet, uint16 NS_ASSERT_MSG (Simulator::GetContext () == GetId (), "Received packet with erroneous context ; " << "make sure the channels in use are correctly updating events context " << "when transfering events from one node to another."); - NS_LOG_DEBUG("Node " << GetId () << " ReceiveFromDevice: dev " - << device->GetIfIndex () << " (type=" << device->GetInstanceTypeId ().GetName () - << ") Packet UID " << packet->GetUid ()); + NS_LOG_DEBUG ("Node " << GetId () << " ReceiveFromDevice: dev " + << device->GetIfIndex () << " (type=" << device->GetInstanceTypeId ().GetName () + << ") Packet UID " << packet->GetUid ()); bool found = false; for (ProtocolHandlerList::iterator i = m_handlers.begin (); diff --git a/src/network/model/packet-metadata.cc b/src/network/model/packet-metadata.cc index 3e74492da..fbeaa6458 100644 --- a/src/network/model/packet-metadata.cc +++ b/src/network/model/packet-metadata.cc @@ -1410,7 +1410,7 @@ PacketMetadata::ReadFromRawU8 (uint8_t& data, { return 0; } - memcpy(&data, current, sizeof (uint8_t)); + memcpy (&data, current, sizeof (uint8_t)); return const_cast (current) + sizeof (uint8_t); } @@ -1425,7 +1425,7 @@ PacketMetadata::ReadFromRawU16 (uint16_t& data, { return 0; } - memcpy(&data, current, sizeof (uint16_t)); + memcpy (&data, current, sizeof (uint16_t)); return const_cast (current) + sizeof (uint16_t); } @@ -1440,7 +1440,7 @@ PacketMetadata::ReadFromRawU32 (uint32_t& data, { return 0; } - memcpy(&data, current, sizeof (uint32_t)); + memcpy (&data, current, sizeof (uint32_t)); return const_cast (current) + sizeof (uint32_t); } @@ -1455,7 +1455,7 @@ PacketMetadata::ReadFromRawU64 (uint64_t& data, { return 0; } - memcpy(&data, current, sizeof (uint64_t)); + memcpy (&data, current, sizeof (uint64_t)); return const_cast (current) + sizeof (uint64_t); } diff --git a/src/network/model/packet.cc b/src/network/model/packet.cc index 1ab807d60..72ccc949f 100644 --- a/src/network/model/packet.cc +++ b/src/network/model/packet.cc @@ -382,7 +382,7 @@ Packet::CopyData (uint8_t *buffer, uint32_t size) const } void -Packet::CopyData(std::ostream *os, uint32_t size) const +Packet::CopyData (std::ostream *os, uint32_t size) const { return m_buffer.CopyData (os, size); } diff --git a/src/network/model/packet.h b/src/network/model/packet.h index 734ed1c79..8ddba63fb 100644 --- a/src/network/model/packet.h +++ b/src/network/model/packet.h @@ -362,7 +362,7 @@ public: * \param size the maximum number of bytes we want to write * in the output stream. */ - void CopyData(std::ostream *os, uint32_t size) const; + void CopyData (std::ostream *os, uint32_t size) const; /** * \returns a COW copy of the packet. diff --git a/src/network/model/socket.cc b/src/network/model/socket.cc index e0877c3ce..0fb41104d 100644 --- a/src/network/model/socket.cc +++ b/src/network/model/socket.cc @@ -150,7 +150,7 @@ Ptr Socket::Recv (void) { NS_LOG_FUNCTION_NOARGS (); - return Recv (std::numeric_limits::max(), 0); + return Recv (std::numeric_limits::max (), 0); } int @@ -170,7 +170,7 @@ Ptr Socket::RecvFrom (Address &fromAddress) { NS_LOG_FUNCTION_NOARGS (); - return RecvFrom (std::numeric_limits::max(), 0, fromAddress); + return RecvFrom (std::numeric_limits::max (), 0, fromAddress); } int @@ -305,9 +305,9 @@ Socket::BindToNetDevice (Ptr netdevice) if (netdevice != 0) { bool found = false; - for (uint32_t i = 0; i < GetNode()->GetNDevices (); i++) + for (uint32_t i = 0; i < GetNode ()->GetNDevices (); i++) { - if (GetNode()->GetDevice (i) == netdevice) + if (GetNode ()->GetDevice (i) == netdevice) { found = true; break; diff --git a/src/network/model/socket.h b/src/network/model/socket.h index b19f9c82c..b10fa63bf 100644 --- a/src/network/model/socket.h +++ b/src/network/model/socket.h @@ -596,8 +596,8 @@ public: protected: void NotifyConnectionSucceeded (void); void NotifyConnectionFailed (void); - void NotifyNormalClose(void); - void NotifyErrorClose(void); + void NotifyNormalClose (void); + void NotifyErrorClose (void); bool NotifyConnectionRequest (const Address &from); void NotifyNewConnectionCreated (Ptr socket, const Address &from); void NotifyDataSent (uint32_t size); diff --git a/src/network/test/buffer-test.cc b/src/network/test/buffer-test.cc index cc94cb8b3..be8db6b06 100644 --- a/src/network/test/buffer-test.cc +++ b/src/network/test/buffer-test.cc @@ -53,7 +53,7 @@ BufferTest::EnsureWrittenBytes (Buffer b, uint32_t n, uint8_t array[], const cha failure << (uint16_t)got[j] << " "; } failure << std::endl; - NS_TEST_ASSERT_MSG_EQ_INTERNAL(true, false, failure.str(), file, line); + NS_TEST_ASSERT_MSG_EQ_INTERNAL (true, false, failure.str (), file, line); } } @@ -133,22 +133,22 @@ BufferTest::DoRun (void) // test 64-bit read/write Buffer buff64; - buff64.AddAtStart(8); - i = buff64.Begin(); + buff64.AddAtStart (8); + i = buff64.Begin (); i.WriteU64 (0x0123456789ABCDEFllu); ENSURE_WRITTEN_BYTES (buff64, 8, 0xef, 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01); - i = buff64.Begin(); - NS_TEST_ASSERT_MSG_EQ(i.ReadLsbtohU64(), 0x0123456789abcdefllu, "Could not read expected value"); - i = buff64.Begin(); + i = buff64.Begin (); + NS_TEST_ASSERT_MSG_EQ (i.ReadLsbtohU64 (), 0x0123456789abcdefllu, "Could not read expected value"); + i = buff64.Begin (); i.WriteHtolsbU64 (0x0123456789ABCDEFllu); ENSURE_WRITTEN_BYTES (buff64, 8, 0xef, 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01); - i = buff64.Begin(); - NS_TEST_ASSERT_MSG_EQ (i.ReadLsbtohU64(), 0x0123456789abcdefllu, "Could not read expected value"); - i = buff64.Begin(); + i = buff64.Begin (); + NS_TEST_ASSERT_MSG_EQ (i.ReadLsbtohU64 (), 0x0123456789abcdefllu, "Could not read expected value"); + i = buff64.Begin (); i.WriteHtonU64 (0x0123456789ABCDEFllu); ENSURE_WRITTEN_BYTES (buff64, 8, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef); - i = buff64.Begin(); - NS_TEST_ASSERT_MSG_EQ (i.ReadNtohU64(), 0x0123456789abcdefllu, "could not read expected value"); + i = buff64.Begin (); + NS_TEST_ASSERT_MSG_EQ (i.ReadNtohU64 (), 0x0123456789abcdefllu, "could not read expected value"); // test self-assignment { @@ -164,7 +164,7 @@ BufferTest::DoRun (void) buffer.AddAtStart (1); buffer.Begin ().WriteU8 (0xff); ENSURE_WRITTEN_BYTES (buffer, 5, 0xff, 0, 0, 0, 0); - buffer.RemoveAtStart(3); + buffer.RemoveAtStart (3); ENSURE_WRITTEN_BYTES (buffer, 2, 0, 0); buffer.AddAtStart (4); buffer.Begin ().WriteHtonU32 (0xdeadbeaf); diff --git a/src/network/test/packet-metadata-test.cc b/src/network/test/packet-metadata-test.cc index 338935f82..655484666 100644 --- a/src/network/test/packet-metadata-test.cc +++ b/src/network/test/packet-metadata-test.cc @@ -355,7 +355,7 @@ error: failure << *j << ", "; } failure << "\""; - NS_TEST_ASSERT_MSG_EQ_INTERNAL (false, true, failure.str(), file, line); + NS_TEST_ASSERT_MSG_EQ_INTERNAL (false, true, failure.str (), file, line); } #define ADD_HEADER(p, n) \ @@ -741,8 +741,8 @@ PacketMetadataTest::DoRun (void) p = Create (200); ADD_HEADER (p, 24); - p1 = p->CreateFragment(0, 100); - p2 = p->CreateFragment(100, 100); + p1 = p->CreateFragment (0, 100); + p2 = p->CreateFragment (100, 100); p1->AddAtEnd (p2); p = Create (); @@ -778,48 +778,48 @@ PacketMetadataTest::DoRun (void) CHECK_HISTORY (p, 4, 5, 20, 10, 500); p1 = p->CreateFragment (0,6); p2 = p->CreateFragment (6,535-6); - p1->AddAtEnd(p2); + p1->AddAtEnd (p2); // bug 1072#2 p = Create (reinterpret_cast ("hello world"), 11); ADD_HEADER (p, 2); - CHECK_HISTORY(p, 2, 2, 11); + CHECK_HISTORY (p, 2, 2, 11); p1 = p->CreateFragment (0, 5); - CHECK_HISTORY(p1, 2, 2, 3); + CHECK_HISTORY (p1, 2, 2, 3); p2 = p->CreateFragment (5, 8); - CHECK_HISTORY(p2, 1, 8); + CHECK_HISTORY (p2, 1, 8); ADD_HEADER (p1, 8+2+2*6); ADD_TRAILER (p1, 4); - CHECK_HISTORY(p1, 4, 22, 2, 3, 4); + CHECK_HISTORY (p1, 4, 22, 2, 3, 4); ADD_HEADER (p2, 8+2+2*6); ADD_TRAILER (p2, 4); - CHECK_HISTORY(p2, 3, 22, 8, 4); + CHECK_HISTORY (p2, 3, 22, 8, 4); REM_TRAILER (p1, 4); REM_HEADER (p1, 8+2+2*6); - CHECK_HISTORY(p1, 2, 2, 3); + CHECK_HISTORY (p1, 2, 2, 3); REM_TRAILER (p2, 4); REM_HEADER (p2, 8+2+2*6); - CHECK_HISTORY(p2, 1, 8); + CHECK_HISTORY (p2, 1, 8); - p3 = p1->Copy(); - CHECK_HISTORY(p3, 2, 2, 3); - p3->AddAtEnd(p2); - CHECK_HISTORY(p3, 2, 2, 11); + p3 = p1->Copy (); + CHECK_HISTORY (p3, 2, 2, 3); + p3->AddAtEnd (p2); + CHECK_HISTORY (p3, 2, 2, 11); - CHECK_HISTORY(p, 2, 2, 11); + CHECK_HISTORY (p, 2, 2, 11); REM_HEADER (p, 2); - CHECK_HISTORY(p, 1, 11); + CHECK_HISTORY (p, 1, 11); REM_HEADER (p3, 2); - CHECK_HISTORY(p3, 1, 11); + CHECK_HISTORY (p3, 1, 11); uint8_t *buf = new uint8_t[p3->GetSize ()]; p3->CopyData (buf, p3->GetSize ()); std::string msg = std::string (reinterpret_cast(buf), p3->GetSize ()); delete [] buf; - NS_TEST_EXPECT_MSG_EQ(msg, std::string("hello world"), "Could not find original data in received packet"); + NS_TEST_EXPECT_MSG_EQ (msg, std::string ("hello world"), "Could not find original data in received packet"); } //----------------------------------------------------------------------------- class PacketMetadataTestSuite : public TestSuite diff --git a/src/network/test/packet-test-suite.cc b/src/network/test/packet-test-suite.cc index 59f20319c..7a65e5e71 100644 --- a/src/network/test/packet-test-suite.cc +++ b/src/network/test/packet-test-suite.cc @@ -282,7 +282,7 @@ PacketTest::DoRun (void) CHECK (copy, 1, E (1, 0, 1000)); p->AddByteTag (ATestTag<2> ()); - CHECK (p, 2, E (1, 0, 1000), E(2, 0, 1000)); + CHECK (p, 2, E (1, 0, 1000), E (2, 0, 1000)); CHECK (copy, 1, E (1, 0, 1000)); { @@ -302,21 +302,21 @@ PacketTest::DoRun (void) Ptr frag1 = p->CreateFragment (10, 90); Ptr frag2 = p->CreateFragment (100, 900); frag0->AddByteTag (ATestTag<3> ()); - CHECK (frag0, 3, E (1, 0, 10), E(2, 0, 10), E (3, 0, 10)); + CHECK (frag0, 3, E (1, 0, 10), E (2, 0, 10), E (3, 0, 10)); frag1->AddByteTag (ATestTag<4> ()); - CHECK (frag1, 3, E (1, 0, 90), E(2, 0, 90), E (4, 0, 90)); + CHECK (frag1, 3, E (1, 0, 90), E (2, 0, 90), E (4, 0, 90)); frag2->AddByteTag (ATestTag<5> ()); - CHECK (frag2, 3, E (1, 0, 900), E(2, 0, 900), E (5, 0, 900)); + CHECK (frag2, 3, E (1, 0, 900), E (2, 0, 900), E (5, 0, 900)); frag1->AddAtEnd (frag2); - CHECK (frag1, 6, E (1, 0, 90), E(2, 0, 90), E (4, 0, 90), E (1, 90, 990), E(2, 90, 990), E (5, 90, 990)); + CHECK (frag1, 6, E (1, 0, 90), E (2, 0, 90), E (4, 0, 90), E (1, 90, 990), E (2, 90, 990), E (5, 90, 990)); - CHECK (frag0, 3, E (1, 0, 10), E(2, 0, 10), E (3, 0, 10)); + CHECK (frag0, 3, E (1, 0, 10), E (2, 0, 10), E (3, 0, 10)); frag0->AddAtEnd (frag1); CHECK (frag0, 9, - E (1, 0, 10), E(2, 0, 10), E (3, 0, 10), - E (1, 10, 100), E(2, 10, 100), E (4, 10, 100), - E (1, 100, 1000), E(2, 100, 1000), E (5, 100, 1000)); + E (1, 0, 10), E (2, 0, 10), E (3, 0, 10), + E (1, 10, 100), E (2, 10, 100), E (4, 10, 100), + E (1, 100, 1000), E (2, 100, 1000), E (5, 100, 1000)); // force caching a buffer of the right size. diff --git a/src/network/test/packetbb-test-suite.cc b/src/network/test/packetbb-test-suite.cc index affd820dc..43d96d0eb 100644 --- a/src/network/test/packetbb-test-suite.cc +++ b/src/network/test/packetbb-test-suite.cc @@ -259,7 +259,7 @@ PbbTestSuite::PbbTestSuite () tlv2->SetTypeExt (100); uint8_t tlv2val[] = { 1, 2, 3, 4}; - tlv2->SetValue(tlv2val, sizeof(tlv2val)); + tlv2->SetValue (tlv2val, sizeof(tlv2val)); packet->TlvPushBack (tlv2); @@ -452,7 +452,7 @@ PbbTestSuite::PbbTestSuite () 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c }; - tlv2->SetValue(tlv2val, sizeof(tlv2val)); + tlv2->SetValue (tlv2val, sizeof(tlv2val)); packet->TlvPushBack (tlv2); @@ -622,7 +622,7 @@ PbbTestSuite::PbbTestSuite () Ptr msg2 = Create (); msg2->SetType (2); - msg2->SetOriginatorAddress(Ipv4Address("10.0.0.1")); + msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1")); packet->MessagePushBack (msg2); uint8_t buffer[] = { @@ -679,7 +679,7 @@ PbbTestSuite::PbbTestSuite () Ptr msg2 = Create (); msg2->SetType (2); - msg2->SetOriginatorAddress(Ipv4Address("10.0.0.1")); + msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1")); msg2->SetHopCount (1); packet->MessagePushBack (msg2); @@ -738,7 +738,7 @@ PbbTestSuite::PbbTestSuite () Ptr msg2 = Create (); msg2->SetType (2); - msg2->SetOriginatorAddress(Ipv4Address("10.0.0.1")); + msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1")); msg2->SetHopLimit (255); msg2->SetHopCount (1); packet->MessagePushBack (msg2); @@ -800,7 +800,7 @@ PbbTestSuite::PbbTestSuite () Ptr msg2 = Create (); msg2->SetType (2); - msg2->SetOriginatorAddress(Ipv4Address("10.0.0.1")); + msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1")); msg2->SetHopLimit (255); msg2->SetHopCount (1); msg2->SetSequenceNumber (12345); @@ -863,7 +863,7 @@ PbbTestSuite::PbbTestSuite () Ptr msg2 = Create (); msg2->SetType (2); - msg2->SetOriginatorAddress(Ipv4Address("10.0.0.1")); + msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1")); msg2->SetHopLimit (255); msg2->SetHopCount (1); msg2->SetSequenceNumber (12345); @@ -935,7 +935,7 @@ PbbTestSuite::PbbTestSuite () Ptr msg2 = Create (); msg2->SetType (2); - msg2->SetOriginatorAddress(Ipv4Address("10.0.0.1")); + msg2->SetOriginatorAddress (Ipv4Address ("10.0.0.1")); msg2->SetHopLimit (255); msg2->SetHopCount (1); msg2->SetSequenceNumber (12345); @@ -2223,7 +2223,7 @@ PbbTestSuite::PbbTestSuite () msg2a2tlv1->SetIndexStop (3); uint8_t value[] = { 1, 2, 3}; - msg2a2tlv1->SetValue(value, sizeof (value)); + msg2a2tlv1->SetValue (value, sizeof (value)); msg2a2tlv1->SetMultivalue (true); msg2a2->TlvPushBack (msg2a2tlv1); @@ -2505,7 +2505,7 @@ PbbTestSuite::PbbTestSuite () 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, }; - msg2a2tlv1->SetValue(value, sizeof (value)); + msg2a2tlv1->SetValue (value, sizeof (value)); msg2a2->TlvPushBack (msg2a2tlv1); @@ -2630,7 +2630,7 @@ PbbTestSuite::PbbTestSuite () Ptr packet = Create (); Ptr m1 = Create (); - m1->SetType(1); + m1->SetType (1); packet->MessagePushBack (m1); @@ -2661,8 +2661,8 @@ PbbTestSuite::PbbTestSuite () Ptr packet = Create (); Ptr m1 = Create (); - m1->SetType(1); - m1->SetOriginatorAddress (Ipv6Address("abcd::1")); + m1->SetType (1); + m1->SetOriginatorAddress (Ipv6Address ("abcd::1")); packet->MessagePushBack (m1); @@ -2701,8 +2701,8 @@ PbbTestSuite::PbbTestSuite () Ptr packet = Create (); Ptr m1 = Create (); - m1->SetType(1); - m1->SetOriginatorAddress (Ipv6Address("abcd::1")); + m1->SetType (1); + m1->SetOriginatorAddress (Ipv6Address ("abcd::1")); Ptr m1a1 = Create (); m1a1->AddressPushBack (Ipv6Address ("10::1")); @@ -2751,8 +2751,8 @@ PbbTestSuite::PbbTestSuite () Ptr packet = Create (); Ptr m1 = Create (); - m1->SetType(1); - m1->SetOriginatorAddress (Ipv6Address("abcd::1")); + m1->SetType (1); + m1->SetOriginatorAddress (Ipv6Address ("abcd::1")); Ptr m1a1 = Create (); m1a1->AddressPushBack (Ipv6Address ("10::1")); @@ -2803,8 +2803,8 @@ PbbTestSuite::PbbTestSuite () Ptr packet = Create (); Ptr m1 = Create (); - m1->SetType(1); - m1->SetOriginatorAddress (Ipv6Address("abcd::1")); + m1->SetType (1); + m1->SetOriginatorAddress (Ipv6Address ("abcd::1")); Ptr m1a1 = Create (); m1a1->AddressPushBack (Ipv6Address ("10::2")); @@ -2860,8 +2860,8 @@ PbbTestSuite::PbbTestSuite () Ptr packet = Create (); Ptr m1 = Create (); - m1->SetType(1); - m1->SetOriginatorAddress (Ipv6Address("abcd::1")); + m1->SetType (1); + m1->SetOriginatorAddress (Ipv6Address ("abcd::1")); Ptr m1a1 = Create (); m1a1->AddressPushBack (Ipv6Address ("10::2")); @@ -2926,8 +2926,8 @@ PbbTestSuite::PbbTestSuite () Ptr packet = Create (); Ptr m1 = Create (); - m1->SetType(1); - m1->SetOriginatorAddress (Ipv6Address("abcd::1")); + m1->SetType (1); + m1->SetOriginatorAddress (Ipv6Address ("abcd::1")); Ptr m1a1 = Create (); m1a1->AddressPushBack (Ipv6Address ("10::2")); diff --git a/src/network/test/pcap-file-test-suite.cc b/src/network/test/pcap-file-test-suite.cc index c90ba904f..f78942226 100644 --- a/src/network/test/pcap-file-test-suite.cc +++ b/src/network/test/pcap-file-test-suite.cc @@ -180,7 +180,7 @@ WriteModeCreateTestCase::DoRun (void) // data. // uint8_t buffer[128]; - memset(buffer, 0, sizeof(buffer)); + memset (buffer, 0, sizeof(buffer)); f.Write (0, 0, buffer, 128); NS_TEST_ASSERT_MSG_EQ (f.Fail (), false, "Write (write-only-file " << m_testFilename << ") returns error"); @@ -390,7 +390,7 @@ AppendModeCreateTestCase::DoRun (void) // We should be able to write to it since it was opened in "std::ios::app" mode. // uint8_t buffer[128]; - memset(buffer, 0, sizeof(buffer)); + memset (buffer, 0, sizeof(buffer)); f.Write (0, 0, buffer, 128); NS_TEST_ASSERT_MSG_EQ (f.Fail (), false, "Write (append-mode-file " << m_testFilename << ") returns error"); @@ -582,19 +582,19 @@ FileHeaderTestCase::DoRun (void) result = fread (&val32, sizeof(val32), 1, p); NS_TEST_ASSERT_MSG_EQ (result, 1, "Unable to fread() magic number"); - NS_TEST_ASSERT_MSG_EQ (val32, Swap(uint32_t (0xa1b2c3d4)), "Magic number written incorrectly"); + NS_TEST_ASSERT_MSG_EQ (val32, Swap (uint32_t (0xa1b2c3d4)), "Magic number written incorrectly"); result = fread (&val16, sizeof(val16), 1, p); NS_TEST_ASSERT_MSG_EQ (result, 1, "Unable to fread() version major"); - NS_TEST_ASSERT_MSG_EQ (val16, Swap(uint16_t (2)), "Version major written incorrectly"); + NS_TEST_ASSERT_MSG_EQ (val16, Swap (uint16_t (2)), "Version major written incorrectly"); result = fread (&val16, sizeof(val16), 1, p); NS_TEST_ASSERT_MSG_EQ (result, 1, "Unable to fread() version minor"); - NS_TEST_ASSERT_MSG_EQ (val16, Swap(uint16_t (4)), "Version minor written incorrectly"); + NS_TEST_ASSERT_MSG_EQ (val16, Swap (uint16_t (4)), "Version minor written incorrectly"); result = fread (&val32, sizeof(val32), 1, p); NS_TEST_ASSERT_MSG_EQ (result, 1, "Unable to fread() time zone correction"); - NS_TEST_ASSERT_MSG_EQ (val32, Swap(uint32_t (7)), "Version minor written incorrectly"); + NS_TEST_ASSERT_MSG_EQ (val32, Swap (uint32_t (7)), "Version minor written incorrectly"); result = fread (&val32, sizeof(val32), 1, p); NS_TEST_ASSERT_MSG_EQ (result, 1, "Unable to fread() sig figs"); @@ -602,11 +602,11 @@ FileHeaderTestCase::DoRun (void) result = fread (&val32, sizeof(val32), 1, p); NS_TEST_ASSERT_MSG_EQ (result, 1, "Unable to fread() snap length"); - NS_TEST_ASSERT_MSG_EQ (val32, Swap(uint32_t (5678)), "Snap length written incorrectly"); + NS_TEST_ASSERT_MSG_EQ (val32, Swap (uint32_t (5678)), "Snap length written incorrectly"); result = fread (&val32, sizeof(val32), 1, p); NS_TEST_ASSERT_MSG_EQ (result, 1, "Unable to fread() data link type"); - NS_TEST_ASSERT_MSG_EQ (val32, Swap(uint32_t (1234)), "Data length type written incorrectly"); + NS_TEST_ASSERT_MSG_EQ (val32, Swap (uint32_t (1234)), "Data length type written incorrectly"); fclose (p); p = 0; @@ -1071,7 +1071,7 @@ DiffTestCase::DoRun (void) // Check that PcapDiff(file, file) is false // std::string filename = NS_TEST_SOURCEDIR + "known.pcap"; - uint32_t sec(0), usec(0); + uint32_t sec (0), usec (0); bool diff = PcapFile::Diff (filename, filename, sec, usec); NS_TEST_EXPECT_MSG_EQ (diff, false, "PcapDiff(file, file) must always be false"); diff --git a/src/network/test/sequence-number-test-suite.cc b/src/network/test/sequence-number-test-suite.cc index 601c1c9e5..2ee9c887d 100644 --- a/src/network/test/sequence-number-test-suite.cc +++ b/src/network/test/sequence-number-test-suite.cc @@ -40,7 +40,7 @@ public: static TypeId GetTypeId (void) { - static TypeId tid = TypeId("ns3::SequenceNumberTestObj") + static TypeId tid = TypeId ("ns3::SequenceNumberTestObj") .SetParent () .AddTraceSource ("TestTracedSequenceNumber", "A traceable sequence number", @@ -97,8 +97,8 @@ SequenceNumberTestCase::SequenceNumberTracer (SequenceNumber32 oldval, SequenceN void SequenceNumberTestCase::DoRun (void) { -#define NS_TEST_ASSERT_EQUAL(a,b) NS_TEST_ASSERT_MSG_EQ(a,b, "foo") -#define NS_TEST_ASSERT(a) NS_TEST_ASSERT_MSG_EQ(bool(a), true, "foo") +#define NS_TEST_ASSERT_EQUAL(a,b) NS_TEST_ASSERT_MSG_EQ (a,b, "foo") +#define NS_TEST_ASSERT(a) NS_TEST_ASSERT_MSG_EQ (bool(a), true, "foo") { SequenceNumber32 num1 (3), num2 (5); diff --git a/src/network/utils/address-utils.cc b/src/network/utils/address-utils.cc index 500d74322..078da244c 100644 --- a/src/network/utils/address-utils.cc +++ b/src/network/utils/address-utils.cc @@ -29,8 +29,8 @@ void WriteTo (Buffer::Iterator &i, Ipv4Address ad) void WriteTo (Buffer::Iterator &i, Ipv6Address ad) { uint8_t buf[16]; - ad.GetBytes(buf); - i.Write(buf, 16); + ad.GetBytes (buf); + i.Write (buf, 16); } void WriteTo (Buffer::Iterator &i, const Address &ad) { @@ -52,7 +52,7 @@ void ReadFrom (Buffer::Iterator &i, Ipv4Address &ad) void ReadFrom (Buffer::Iterator &i, Ipv6Address &ad) { uint8_t ipv6[16]; - i.Read(ipv6, 16); + i.Read (ipv6, 16); ad.Set (ipv6); } void ReadFrom (Buffer::Iterator &i, Address &ad, uint32_t len) diff --git a/src/network/utils/data-rate.cc b/src/network/utils/data-rate.cc index a793292b0..8ecd06697 100644 --- a/src/network/utils/data-rate.cc +++ b/src/network/utils/data-rate.cc @@ -26,14 +26,14 @@ static bool DoParse (const std::string s, uint64_t *v) { - std::string::size_type n = s.find_first_not_of("0123456789."); + std::string::size_type n = s.find_first_not_of ("0123456789."); if (n != std::string::npos) { // Found non-numeric std::istringstream iss; - iss.str (s.substr(0, n)); + iss.str (s.substr (0, n)); double r; iss >> r; - std::string trailer = s.substr(n, std::string::npos); + std::string trailer = s.substr (n, std::string::npos); if (trailer == "bps") { // bit/s @@ -187,7 +187,7 @@ DataRate::DataRate () } DataRate::DataRate(uint64_t bps) - : m_bps(bps) + : m_bps (bps) { } @@ -221,12 +221,12 @@ bool DataRate::operator != (const DataRate& rhs) const return m_bps!=rhs.m_bps; } -double DataRate::CalculateTxTime(uint32_t bytes) const +double DataRate::CalculateTxTime (uint32_t bytes) const { return static_cast(bytes)*8/m_bps; } -uint64_t DataRate::GetBitRate() const +uint64_t DataRate::GetBitRate () const { return m_bps; } @@ -261,14 +261,14 @@ std::istream &operator >> (std::istream &is, DataRate &rate) -double operator*(const DataRate& lhs, const Time& rhs) +double operator* (const DataRate& lhs, const Time& rhs) { - return rhs.GetSeconds()*lhs.GetBitRate(); + return rhs.GetSeconds ()*lhs.GetBitRate (); } -double operator*(const Time& lhs, const DataRate& rhs) +double operator* (const Time& lhs, const DataRate& rhs) { - return lhs.GetSeconds()*rhs.GetBitRate(); + return lhs.GetSeconds ()*rhs.GetBitRate (); } } //namespace ns3 diff --git a/src/network/utils/data-rate.h b/src/network/utils/data-rate.h index f4777f8b6..9d980da17 100644 --- a/src/network/utils/data-rate.h +++ b/src/network/utils/data-rate.h @@ -97,17 +97,17 @@ public: * \param bytes The number of bytes (not bits) for which to calculate * \return The transmission time in seconds for the number of bytes specified */ - double CalculateTxTime(uint32_t bytes) const; + double CalculateTxTime (uint32_t bytes) const; /** * Get the underlying bitrate * \return The underlying bitrate in bits per second */ - uint64_t GetBitRate() const; + uint64_t GetBitRate () const; private: uint64_t m_bps; - static uint64_t Parse(const std::string); + static uint64_t Parse (const std::string); }; std::ostream &operator << (std::ostream &os, const DataRate &rate); @@ -125,8 +125,8 @@ ATTRIBUTE_HELPER_HEADER (DataRate); * \param rhs * \return Bits transmitted in rhs seconds at lhs b/s */ -double operator*(const DataRate& lhs, const Time& rhs); -double operator*(const Time& lhs, const DataRate& rhs); +double operator* (const DataRate& lhs, const Time& rhs); +double operator* (const Time& lhs, const DataRate& rhs); } //namespace ns3 diff --git a/src/network/utils/drop-tail-queue.cc b/src/network/utils/drop-tail-queue.cc index 73b919689..03de05210 100644 --- a/src/network/utils/drop-tail-queue.cc +++ b/src/network/utils/drop-tail-queue.cc @@ -100,7 +100,7 @@ DropTailQueue::DoEnqueue (Ptr p) } m_bytesInQueue += p->GetSize (); - m_packets.push(p); + m_packets.push (p); NS_LOG_LOGIC ("Number packets " << m_packets.size ()); NS_LOG_LOGIC ("Number bytes " << m_bytesInQueue); @@ -113,7 +113,7 @@ DropTailQueue::DoDequeue (void) { NS_LOG_FUNCTION (this); - if (m_packets.empty()) + if (m_packets.empty ()) { NS_LOG_LOGIC ("Queue empty"); return 0; @@ -136,7 +136,7 @@ DropTailQueue::DoPeek (void) const { NS_LOG_FUNCTION (this); - if (m_packets.empty()) + if (m_packets.empty ()) { NS_LOG_LOGIC ("Queue empty"); return 0; diff --git a/src/network/utils/error-model.cc b/src/network/utils/error-model.cc index 3f50690df..1c8d2d1ad 100644 --- a/src/network/utils/error-model.cc +++ b/src/network/utils/error-model.cc @@ -214,7 +214,7 @@ RateErrorModel::DoCorruptByte (Ptr p) } bool -RateErrorModel::DoCorruptBit(Ptr p) +RateErrorModel::DoCorruptBit (Ptr p) { NS_LOG_FUNCTION_NOARGS (); // compute pkt error rate, assume uniformly distributed bit error @@ -295,7 +295,7 @@ void ListErrorModel::DoReset (void) { NS_LOG_FUNCTION_NOARGS (); - m_packetList.clear(); + m_packetList.clear (); } // @@ -363,7 +363,7 @@ void ReceiveListErrorModel::DoReset (void) { NS_LOG_FUNCTION_NOARGS (); - m_packetList.clear(); + m_packetList.clear (); } diff --git a/src/network/utils/ethernet-header.cc b/src/network/utils/ethernet-header.cc index ba0715d38..9b98f1653 100644 --- a/src/network/utils/ethernet-header.cc +++ b/src/network/utils/ethernet-header.cc @@ -97,7 +97,7 @@ EthernetHeader::GetPacketType (void) const uint32_t EthernetHeader::GetHeaderSize (void) const { - return GetSerializedSize(); + return GetSerializedSize (); } @@ -148,7 +148,7 @@ EthernetHeader::Serialize (Buffer::Iterator start) const if (m_enPreambleSfd) { - i.WriteU64(m_preambleSfd); + i.WriteU64 (m_preambleSfd); } WriteTo (i, m_destination); WriteTo (i, m_source); diff --git a/src/network/utils/ethernet-header.h b/src/network/utils/ethernet-header.h index c4eb6ad60..a1dc233e6 100644 --- a/src/network/utils/ethernet-header.h +++ b/src/network/utils/ethernet-header.h @@ -101,7 +101,7 @@ public: /** * \return The size of the header */ - uint32_t GetHeaderSize() const; + uint32_t GetHeaderSize () const; static TypeId GetTypeId (void); virtual TypeId GetInstanceTypeId (void) const; diff --git a/src/network/utils/ethernet-trailer.cc b/src/network/utils/ethernet-trailer.cc index 014347d63..4b4cccb1f 100644 --- a/src/network/utils/ethernet-trailer.cc +++ b/src/network/utils/ethernet-trailer.cc @@ -92,7 +92,7 @@ EthernetTrailer::GetFcs (void) uint32_t EthernetTrailer::GetTrailerSize (void) const { - return GetSerializedSize(); + return GetSerializedSize (); } TypeId @@ -124,7 +124,7 @@ void EthernetTrailer::Serialize (Buffer::Iterator end) const { Buffer::Iterator i = end; - i.Prev(GetSerializedSize()); + i.Prev (GetSerializedSize ()); i.WriteU32 (m_fcs); } @@ -132,8 +132,8 @@ uint32_t EthernetTrailer::Deserialize (Buffer::Iterator end) { Buffer::Iterator i = end; - uint32_t size = GetSerializedSize(); - i.Prev(size); + uint32_t size = GetSerializedSize (); + i.Prev (size); m_fcs = i.ReadU32 (); diff --git a/src/network/utils/ethernet-trailer.h b/src/network/utils/ethernet-trailer.h index 22aae5458..884e6acf5 100644 --- a/src/network/utils/ethernet-trailer.h +++ b/src/network/utils/ethernet-trailer.h @@ -88,7 +88,7 @@ public: /** *\return Returns the size of the trailer */ - uint32_t GetTrailerSize() const; + uint32_t GetTrailerSize () const; static TypeId GetTypeId (void); virtual TypeId GetInstanceTypeId (void) const; diff --git a/src/network/utils/inet6-socket-address.cc b/src/network/utils/inet6-socket-address.cc index e26d2a0a2..d307f23e7 100644 --- a/src/network/utils/inet6-socket-address.cc +++ b/src/network/utils/inet6-socket-address.cc @@ -26,32 +26,32 @@ namespace ns3 { Inet6SocketAddress::Inet6SocketAddress (Ipv6Address ipv6, uint16_t port) - : m_ipv6(ipv6), - m_port(port) + : m_ipv6 (ipv6), + m_port (port) { } Inet6SocketAddress::Inet6SocketAddress (Ipv6Address ipv6) - : m_ipv6(ipv6), - m_port(0) + : m_ipv6 (ipv6), + m_port (0) { } Inet6SocketAddress::Inet6SocketAddress (const char* ipv6, uint16_t port) - : m_ipv6(Ipv6Address(ipv6)), - m_port(port) + : m_ipv6 (Ipv6Address (ipv6)), + m_port (port) { } Inet6SocketAddress::Inet6SocketAddress (const char* ipv6) - : m_ipv6(Ipv6Address(ipv6)), - m_port(0) + : m_ipv6 (Ipv6Address (ipv6)), + m_port (0) { } Inet6SocketAddress::Inet6SocketAddress (uint16_t port) - : m_ipv6(Ipv6Address::GetAny()), - m_port(port) + : m_ipv6 (Ipv6Address::GetAny ()), + m_port (port) { } @@ -77,36 +77,36 @@ void Inet6SocketAddress::SetIpv6 (Ipv6Address ipv6) bool Inet6SocketAddress::IsMatchingType (const Address &addr) { - return addr.CheckCompatible(GetType(), 18); /* 16 (address) + 2 (port) */ + return addr.CheckCompatible (GetType (), 18); /* 16 (address) + 2 (port) */ } Inet6SocketAddress::operator Address (void) const { - return ConvertTo(); + return ConvertTo (); } Address Inet6SocketAddress::ConvertTo (void) const { uint8_t buf[18]; - m_ipv6.Serialize(buf); + m_ipv6.Serialize (buf); buf[16]=m_port & 0xff; buf[17]=(m_port >> 8) &0xff; - return Address(GetType(), buf, 18); + return Address (GetType (), buf, 18); } Inet6SocketAddress Inet6SocketAddress::ConvertFrom (const Address &addr) { - NS_ASSERT(addr.CheckCompatible(GetType(), 18)); + NS_ASSERT (addr.CheckCompatible (GetType (), 18)); uint8_t buf[18]; - addr.CopyTo(buf); - Ipv6Address ipv6=Ipv6Address::Deserialize(buf); + addr.CopyTo (buf); + Ipv6Address ipv6=Ipv6Address::Deserialize (buf); uint16_t port= buf[16] | (buf[17] << 8); - return Inet6SocketAddress(ipv6, port); + return Inet6SocketAddress (ipv6, port); } uint8_t Inet6SocketAddress::GetType (void) { - static uint8_t type=Address::Register(); + static uint8_t type=Address::Register (); return type; } diff --git a/src/network/utils/ipv4-address.cc b/src/network/utils/ipv4-address.cc index 862bf3ccc..b2f070fe0 100644 --- a/src/network/utils/ipv4-address.cc +++ b/src/network/utils/ipv4-address.cc @@ -23,7 +23,7 @@ #include "ipv4-address.h" #include "ns3/assert.h" -NS_LOG_COMPONENT_DEFINE("Ipv4Address"); +NS_LOG_COMPONENT_DEFINE ("Ipv4Address"); namespace ns3 { @@ -341,7 +341,7 @@ Ipv4Address::GetLoopback (void) return loopback; } -size_t Ipv4AddressHash::operator()(Ipv4Address const &x) const +size_t Ipv4AddressHash::operator() (Ipv4Address const &x) const { return x.Get (); } diff --git a/src/network/utils/ipv4-address.h b/src/network/utils/ipv4-address.h index fab1f2b2d..86f303486 100644 --- a/src/network/utils/ipv4-address.h +++ b/src/network/utils/ipv4-address.h @@ -310,7 +310,7 @@ inline bool operator < (const Ipv4Address &a, const Ipv4Address &b) class Ipv4AddressHash : public std::unary_function { public: - size_t operator()(Ipv4Address const &x) const; + size_t operator() (Ipv4Address const &x) const; }; bool operator == (Ipv4Mask const &a, Ipv4Mask const &b); diff --git a/src/network/utils/ipv6-address.cc b/src/network/utils/ipv6-address.cc index 9ad03a08c..455183e24 100644 --- a/src/network/utils/ipv6-address.cc +++ b/src/network/utils/ipv6-address.cc @@ -195,7 +195,7 @@ static bool AsciiToIpv6Host (const char *address, uint8_t addr[16]) /* TODO Handle IPv4 mapped address (2001::192.168.0.1) */ #if 0 if (ch == '.' && ((tp + 4 /*NS_INADDRSZ*/) <= endp) && - inet_pton4(curtok, tp) > 0) + inet_pton4 (curtok, tp) > 0) { tp += 4 /*NS_INADDRSZ*/; seen_xdigits = 0; @@ -296,7 +296,7 @@ void Ipv6Address::Serialize (uint8_t buf[16]) const Ipv6Address Ipv6Address::Deserialize (const uint8_t buf[16]) { - Ipv6Address ipv6((uint8_t*)buf); + Ipv6Address ipv6 ((uint8_t*)buf); return ipv6; } diff --git a/src/network/utils/mac48-address.cc b/src/network/utils/mac48-address.cc index a3a3e4a86..22d4930f6 100644 --- a/src/network/utils/mac48-address.cc +++ b/src/network/utils/mac48-address.cc @@ -200,9 +200,9 @@ Mac48Address::GetMulticast (Ipv4Address multicastGroup) result.CopyFrom (etherBuffer); return result; } -Mac48Address Mac48Address::GetMulticast(Ipv6Address addr) +Mac48Address Mac48Address::GetMulticast (Ipv6Address addr) { - Mac48Address etherAddr = Mac48Address::GetMulticast6Prefix(); + Mac48Address etherAddr = Mac48Address::GetMulticast6Prefix (); uint8_t etherBuffer[6]; uint8_t ipBuffer[16]; @@ -227,15 +227,15 @@ std::ostream& operator<< (std::ostream& os, const Mac48Address & address) address.CopyTo (ad); os.setf (std::ios::hex, std::ios::basefield); - os.fill('0'); + os.fill ('0'); for (uint8_t i=0; i < 5; i++) { - os << std::setw(2) << (uint32_t)ad[i] << ":"; + os << std::setw (2) << (uint32_t)ad[i] << ":"; } // Final byte not suffixed by ":" - os << std::setw(2) << (uint32_t)ad[5]; + os << std::setw (2) << (uint32_t)ad[5]; os.setf (std::ios::dec, std::ios::basefield); - os.fill(' '); + os.fill (' '); return os; } diff --git a/src/network/utils/mac64-address.cc b/src/network/utils/mac64-address.cc index 10669589d..3d020676d 100644 --- a/src/network/utils/mac64-address.cc +++ b/src/network/utils/mac64-address.cc @@ -156,15 +156,15 @@ std::ostream& operator<< (std::ostream& os, const Mac64Address & address) address.CopyTo (ad); os.setf (std::ios::hex, std::ios::basefield); - os.fill('0'); + os.fill ('0'); for (uint8_t i=0; i < 7; i++) { - os << std::setw(2) << (uint32_t)ad[i] << ":"; + os << std::setw (2) << (uint32_t)ad[i] << ":"; } // Final byte not suffixed by ":" - os << std::setw(2) << (uint32_t)ad[7]; + os << std::setw (2) << (uint32_t)ad[7]; os.setf (std::ios::dec, std::ios::basefield); - os.fill(' '); + os.fill (' '); return os; } diff --git a/src/network/utils/packet-socket.cc b/src/network/utils/packet-socket.cc index fccc1f065..5308ca9fa 100644 --- a/src/network/utils/packet-socket.cc +++ b/src/network/utils/packet-socket.cc @@ -185,7 +185,7 @@ PacketSocket::ShutdownRecv (void) } int -PacketSocket::Close(void) +PacketSocket::Close (void) { NS_LOG_FUNCTION (this); if (m_state == STATE_CLOSED) @@ -204,7 +204,7 @@ PacketSocket::Close(void) } int -PacketSocket::Connect(const Address &ad) +PacketSocket::Connect (const Address &ad) { NS_LOG_FUNCTION (this << ad); PacketSocketAddress address; @@ -238,7 +238,7 @@ error: return -1; } int -PacketSocket::Listen(void) +PacketSocket::Listen (void) { m_errno = Socket::ERROR_OPNOTSUPP; return -1; @@ -385,7 +385,7 @@ PacketSocket::ForwardUp (Ptr device, Ptr packet, copy->AddPacketTag (tag); m_deliveryQueue.push (copy); m_rxAvailable += packet->GetSize (); - NS_LOG_LOGIC ("UID is " << packet->GetUid() << " PacketSocket " << this); + NS_LOG_LOGIC ("UID is " << packet->GetUid () << " PacketSocket " << this); NotifyDataRecv (); } else @@ -413,7 +413,7 @@ Ptr PacketSocket::Recv (uint32_t maxSize, uint32_t flags) { NS_LOG_FUNCTION (this << maxSize << flags); - if (m_deliveryQueue.empty() ) + if (m_deliveryQueue.empty () ) { return 0; } @@ -453,18 +453,18 @@ int PacketSocket::GetSockName (Address &address) const { NS_LOG_FUNCTION (this << address); - PacketSocketAddress ad = PacketSocketAddress::ConvertFrom(address); + PacketSocketAddress ad = PacketSocketAddress::ConvertFrom (address); ad.SetProtocol (m_protocol); if (m_isSingleDevice) { Ptr device = m_node->GetDevice (ad.GetSingleDevice ()); - ad.SetPhysicalAddress(device->GetAddress()); + ad.SetPhysicalAddress (device->GetAddress ()); ad.SetSingleDevice (m_device); } else { - ad.SetPhysicalAddress(Address()); + ad.SetPhysicalAddress (Address ()); ad.SetAllDevices (); } address = ad; diff --git a/src/network/utils/packet-socket.h b/src/network/utils/packet-socket.h index 2c753e41a..9457e94b1 100644 --- a/src/network/utils/packet-socket.h +++ b/src/network/utils/packet-socket.h @@ -93,11 +93,11 @@ public: virtual int Close (void); virtual int ShutdownSend (void); virtual int ShutdownRecv (void); - virtual int Connect(const Address &address); - virtual int Listen(void); + virtual int Connect (const Address &address); + virtual int Listen (void); virtual uint32_t GetTxAvailable (void) const; virtual int Send (Ptr p, uint32_t flags); - virtual int SendTo(Ptr p, uint32_t flags, const Address &toAddress); + virtual int SendTo (Ptr p, uint32_t flags, const Address &toAddress); virtual uint32_t GetRxAvailable (void) const; virtual Ptr Recv (uint32_t maxSize, uint32_t flags); virtual Ptr RecvFrom (uint32_t maxSize, uint32_t flags, diff --git a/src/network/utils/packetbb.cc b/src/network/utils/packetbb.cc index 5c621ad36..329af15a7 100644 --- a/src/network/utils/packetbb.cc +++ b/src/network/utils/packetbb.cc @@ -231,7 +231,7 @@ PbbTlvBlock::Print (std::ostream &os, int level) const std::string prefix = ""; for (int i = 0; i < level; i++) { - prefix.append("\t"); + prefix.append ("\t"); } os << prefix << "TLV Block {" << std::endl; @@ -449,7 +449,7 @@ PbbAddressTlvBlock::Print (std::ostream &os, int level) const std::string prefix = ""; for (int i = 0; i < level; i++) { - prefix.append("\t"); + prefix.append ("\t"); } os << prefix << "TLV Block {" << std::endl; @@ -768,7 +768,7 @@ PbbPacket::GetSerializedSize (void) const /* Version number + flags */ uint32_t size = 1; - if (HasSequenceNumber()) + if (HasSequenceNumber ()) { size += 2; } @@ -812,7 +812,7 @@ PbbPacket::Serialize (Buffer::Iterator start) const m_tlvList.Serialize (start); } - bufref.WriteU8(flags); + bufref.WriteU8 (flags); for (ConstMessageIterator iter = MessageBegin (); iter != MessageEnd (); @@ -839,7 +839,7 @@ PbbPacket::Deserialize (Buffer::Iterator start) m_tlvList.Deserialize (start); } - while (!start.IsEnd()) + while (!start.IsEnd ()) { Ptr newmsg = PbbMessage::DeserializeMessage (start); if (newmsg == 0) @@ -1047,103 +1047,103 @@ PbbMessage::HasSequenceNumber (void) const PbbMessage::TlvIterator PbbMessage::TlvBegin (void) { - return m_tlvList.Begin(); + return m_tlvList.Begin (); } PbbMessage::ConstTlvIterator PbbMessage::TlvBegin (void) const { - return m_tlvList.Begin(); + return m_tlvList.Begin (); } PbbMessage::TlvIterator PbbMessage::TlvEnd (void) { - return m_tlvList.End(); + return m_tlvList.End (); } PbbMessage::ConstTlvIterator PbbMessage::TlvEnd (void) const { - return m_tlvList.End(); + return m_tlvList.End (); } int PbbMessage::TlvSize (void) const { - return m_tlvList.Size(); + return m_tlvList.Size (); } bool PbbMessage::TlvEmpty (void) const { - return m_tlvList.Empty(); + return m_tlvList.Empty (); } Ptr PbbMessage::TlvFront (void) { - return m_tlvList.Front(); + return m_tlvList.Front (); } const Ptr PbbMessage::TlvFront (void) const { - return m_tlvList.Front(); + return m_tlvList.Front (); } Ptr PbbMessage::TlvBack (void) { - return m_tlvList.Back(); + return m_tlvList.Back (); } const Ptr PbbMessage::TlvBack (void) const { - return m_tlvList.Back(); + return m_tlvList.Back (); } void PbbMessage::TlvPushFront (Ptr tlv) { - m_tlvList.PushFront(tlv); + m_tlvList.PushFront (tlv); } void PbbMessage::TlvPopFront (void) { - m_tlvList.PopFront(); + m_tlvList.PopFront (); } void PbbMessage::TlvPushBack (Ptr tlv) { - m_tlvList.PushBack(tlv); + m_tlvList.PushBack (tlv); } void PbbMessage::TlvPopBack (void) { - m_tlvList.PopBack(); + m_tlvList.PopBack (); } PbbMessage::TlvIterator PbbMessage::TlvErase (PbbMessage::TlvIterator position) { - return m_tlvList.Erase(position); + return m_tlvList.Erase (position); } PbbMessage::TlvIterator PbbMessage::TlvErase (PbbMessage::TlvIterator first, PbbMessage::TlvIterator last) { - return m_tlvList.Erase(first, last); + return m_tlvList.Erase (first, last); } void PbbMessage::TlvClear (void) { - m_tlvList.Clear(); + m_tlvList.Clear (); } /* Manipulating Address Block and Address TLV pairs */ @@ -1151,98 +1151,98 @@ PbbMessage::TlvClear (void) PbbMessage::AddressBlockIterator PbbMessage::AddressBlockBegin (void) { - return m_addressBlockList.begin(); + return m_addressBlockList.begin (); } PbbMessage::ConstAddressBlockIterator PbbMessage::AddressBlockBegin (void) const { - return m_addressBlockList.begin(); + return m_addressBlockList.begin (); } PbbMessage::AddressBlockIterator PbbMessage::AddressBlockEnd (void) { - return m_addressBlockList.end(); + return m_addressBlockList.end (); } PbbMessage::ConstAddressBlockIterator PbbMessage::AddressBlockEnd (void) const { - return m_addressBlockList.end(); + return m_addressBlockList.end (); } int PbbMessage::AddressBlockSize (void) const { - return m_addressBlockList.size(); + return m_addressBlockList.size (); } bool PbbMessage::AddressBlockEmpty (void) const { - return m_addressBlockList.empty(); + return m_addressBlockList.empty (); } Ptr PbbMessage::AddressBlockFront (void) { - return m_addressBlockList.front(); + return m_addressBlockList.front (); } const Ptr PbbMessage::AddressBlockFront (void) const { - return m_addressBlockList.front(); + return m_addressBlockList.front (); } Ptr PbbMessage::AddressBlockBack (void) { - return m_addressBlockList.back(); + return m_addressBlockList.back (); } const Ptr PbbMessage::AddressBlockBack (void) const { - return m_addressBlockList.back(); + return m_addressBlockList.back (); } void PbbMessage::AddressBlockPushFront (Ptr tlv) { - m_addressBlockList.push_front(tlv); + m_addressBlockList.push_front (tlv); } void PbbMessage::AddressBlockPopFront (void) { - m_addressBlockList.pop_front(); + m_addressBlockList.pop_front (); } void PbbMessage::AddressBlockPushBack (Ptr tlv) { - m_addressBlockList.push_back(tlv); + m_addressBlockList.push_back (tlv); } void PbbMessage::AddressBlockPopBack (void) { - m_addressBlockList.pop_back(); + m_addressBlockList.pop_back (); } PbbMessage::AddressBlockIterator PbbMessage::AddressBlockErase (PbbMessage::AddressBlockIterator position) { - return m_addressBlockList.erase(position); + return m_addressBlockList.erase (position); } PbbMessage::AddressBlockIterator PbbMessage::AddressBlockErase (PbbMessage::AddressBlockIterator first, PbbMessage::AddressBlockIterator last) { - return m_addressBlockList.erase(first, last); + return m_addressBlockList.erase (first, last); } void @@ -1254,7 +1254,7 @@ PbbMessage::AddressBlockClear (void) { *iter = 0; } - return m_addressBlockList.clear(); + return m_addressBlockList.clear (); } uint32_t @@ -1263,22 +1263,22 @@ PbbMessage::GetSerializedSize (void) const /* msg-type + (msg-flags + msg-addr-length) + 2msg-size */ uint32_t size = 4; - if (HasOriginatorAddress()) + if (HasOriginatorAddress ()) { - size += GetAddressLength() + 1; + size += GetAddressLength () + 1; } - if (HasHopLimit()) + if (HasHopLimit ()) { size++; } - if (HasHopCount()) + if (HasHopCount ()) { size++; } - if (HasSequenceNumber()) + if (HasSequenceNumber ()) { size += 2; } @@ -1300,7 +1300,7 @@ PbbMessage::Serialize (Buffer::Iterator &start) const { Buffer::Iterator front = start; - start.WriteU8 (GetType()); + start.WriteU8 (GetType ()); /* Save a reference to the spot where we will later write the flags */ Buffer::Iterator bufref = start; @@ -1337,7 +1337,7 @@ PbbMessage::Serialize (Buffer::Iterator &start) const start.WriteHtonU16 (GetSequenceNumber ()); } - bufref.WriteU8(flags); + bufref.WriteU8 (flags); m_tlvList.Serialize (start); @@ -1416,7 +1416,7 @@ PbbMessage::Deserialize (Buffer::Iterator &start) if (size > 0) { - while (start.GetDistanceFrom(front) < size) + while (start.GetDistanceFrom (front) < size) { Ptr newab = AddressBlockDeserialize (start); AddressBlockPushBack (newab); @@ -1591,7 +1591,7 @@ void PbbMessageIpv4::SerializeOriginatorAddress (Buffer::Iterator &start) const { uint8_t buffer[GetAddressLength () + 1]; - Ipv4Address::ConvertFrom (GetOriginatorAddress ()).Serialize(buffer); + Ipv4Address::ConvertFrom (GetOriginatorAddress ()).Serialize (buffer); start.Write (buffer, GetAddressLength () + 1); } @@ -1599,7 +1599,7 @@ Address PbbMessageIpv4::DeserializeOriginatorAddress (Buffer::Iterator &start) const { uint8_t buffer[GetAddressLength () + 1]; - start.Read(buffer, GetAddressLength () + 1); + start.Read (buffer, GetAddressLength () + 1); return Ipv4Address::Deserialize (buffer); } @@ -1637,7 +1637,7 @@ void PbbMessageIpv6::SerializeOriginatorAddress (Buffer::Iterator &start) const { uint8_t buffer[GetAddressLength () + 1]; - Ipv6Address::ConvertFrom (GetOriginatorAddress ()).Serialize(buffer); + Ipv6Address::ConvertFrom (GetOriginatorAddress ()).Serialize (buffer); start.Write (buffer, GetAddressLength () + 1); } @@ -1645,7 +1645,7 @@ Address PbbMessageIpv6::DeserializeOriginatorAddress (Buffer::Iterator &start) const { uint8_t buffer[GetAddressLength () + 1]; - start.Read(buffer, GetAddressLength () + 1); + start.Read (buffer, GetAddressLength () + 1); return Ipv6Address::Deserialize (buffer); } @@ -1678,92 +1678,92 @@ PbbAddressBlock::~PbbAddressBlock () PbbAddressBlock::AddressIterator PbbAddressBlock::AddressBegin (void) { - return m_addressList.begin(); + return m_addressList.begin (); } PbbAddressBlock::ConstAddressIterator PbbAddressBlock::AddressBegin (void) const { - return m_addressList.begin(); + return m_addressList.begin (); } PbbAddressBlock::AddressIterator PbbAddressBlock::AddressEnd (void) { - return m_addressList.end(); + return m_addressList.end (); } PbbAddressBlock::ConstAddressIterator PbbAddressBlock::AddressEnd (void) const { - return m_addressList.end(); + return m_addressList.end (); } int PbbAddressBlock::AddressSize (void) const { - return m_addressList.size(); + return m_addressList.size (); } bool PbbAddressBlock::AddressEmpty (void) const { - return m_addressList.empty(); + return m_addressList.empty (); } Address PbbAddressBlock::AddressFront (void) const { - return m_addressList.front(); + return m_addressList.front (); } Address PbbAddressBlock::AddressBack (void) const { - return m_addressList.back(); + return m_addressList.back (); } void PbbAddressBlock::AddressPushFront (Address tlv) { - m_addressList.push_front(tlv); + m_addressList.push_front (tlv); } void PbbAddressBlock::AddressPopFront (void) { - m_addressList.pop_front(); + m_addressList.pop_front (); } void PbbAddressBlock::AddressPushBack (Address tlv) { - m_addressList.push_back(tlv); + m_addressList.push_back (tlv); } void PbbAddressBlock::AddressPopBack (void) { - m_addressList.pop_back(); + m_addressList.pop_back (); } PbbAddressBlock::AddressIterator PbbAddressBlock::AddressErase (PbbAddressBlock::AddressIterator position) { - return m_addressList.erase(position); + return m_addressList.erase (position); } PbbAddressBlock::AddressIterator PbbAddressBlock::AddressErase (PbbAddressBlock::AddressIterator first, PbbAddressBlock::AddressIterator last) { - return m_addressList.erase(first, last); + return m_addressList.erase (first, last); } void PbbAddressBlock::AddressClear (void) { - return m_addressList.clear(); + return m_addressList.clear (); } /* Manipulating the prefix list */ @@ -1869,104 +1869,104 @@ PbbAddressBlock::PrefixClear (void) PbbAddressBlock::TlvIterator PbbAddressBlock::TlvBegin (void) { - return m_addressTlvList.Begin(); + return m_addressTlvList.Begin (); } PbbAddressBlock::ConstTlvIterator PbbAddressBlock::TlvBegin (void) const { - return m_addressTlvList.Begin(); + return m_addressTlvList.Begin (); } PbbAddressBlock::TlvIterator PbbAddressBlock::TlvEnd (void) { - return m_addressTlvList.End(); + return m_addressTlvList.End (); } PbbAddressBlock::ConstTlvIterator PbbAddressBlock::TlvEnd (void) const { - return m_addressTlvList.End(); + return m_addressTlvList.End (); } int PbbAddressBlock::TlvSize (void) const { - return m_addressTlvList.Size(); + return m_addressTlvList.Size (); } bool PbbAddressBlock::TlvEmpty (void) const { - return m_addressTlvList.Empty(); + return m_addressTlvList.Empty (); } Ptr PbbAddressBlock::TlvFront (void) { - return m_addressTlvList.Front(); + return m_addressTlvList.Front (); } const Ptr PbbAddressBlock::TlvFront (void) const { - return m_addressTlvList.Front(); + return m_addressTlvList.Front (); } Ptr PbbAddressBlock::TlvBack (void) { - return m_addressTlvList.Back(); + return m_addressTlvList.Back (); } const Ptr PbbAddressBlock::TlvBack (void) const { - return m_addressTlvList.Back(); + return m_addressTlvList.Back (); } void PbbAddressBlock::TlvPushFront (Ptr tlv) { - m_addressTlvList.PushFront(tlv); + m_addressTlvList.PushFront (tlv); } void PbbAddressBlock::TlvPopFront (void) { - m_addressTlvList.PopFront(); + m_addressTlvList.PopFront (); } void PbbAddressBlock::TlvPushBack (Ptr tlv) { - m_addressTlvList.PushBack(tlv); + m_addressTlvList.PushBack (tlv); } void PbbAddressBlock::TlvPopBack (void) { - m_addressTlvList.PopBack(); + m_addressTlvList.PopBack (); } PbbAddressBlock::TlvIterator PbbAddressBlock::TlvErase (PbbAddressBlock::TlvIterator position) { - return m_addressTlvList.Erase(position); + return m_addressTlvList.Erase (position); } PbbAddressBlock::TlvIterator PbbAddressBlock::TlvErase (PbbAddressBlock::TlvIterator first, PbbAddressBlock::TlvIterator last) { - return m_addressTlvList.Erase(first, last); + return m_addressTlvList.Erase (first, last); } void PbbAddressBlock::TlvClear (void) { - m_addressTlvList.Clear(); + m_addressTlvList.Clear (); } uint32_t PbbAddressBlock::GetSerializedSize (void) const @@ -1976,7 +1976,7 @@ PbbAddressBlock::GetSerializedSize (void) const if (AddressSize () == 1) { - size += GetAddressLength () + PrefixSize(); + size += GetAddressLength () + PrefixSize (); } else if (AddressSize () > 0) { @@ -2101,7 +2101,7 @@ PbbAddressBlock::Deserialize (Buffer::Iterator &start) uint8_t headlen = 0; uint8_t taillen = 0; uint8_t addrtmp[GetAddressLength ()]; - memset(addrtmp, 0, GetAddressLength ()); + memset (addrtmp, 0, GetAddressLength ()); if (flags & AHAS_HEAD) { @@ -2163,7 +2163,7 @@ PbbAddressBlock::Print (std::ostream &os, int level) const iter++) { os << prefix << "\t\t"; - PrintAddress(os, iter); + PrintAddress (os, iter); os << std::endl; } @@ -2303,8 +2303,8 @@ PbbAddressBlock::GetHeadTail (uint8_t *head, uint8_t &headlen, bufcur = tmp; } - memcpy(head, bufcur, headlen); - memcpy(tail, bufcur + (GetAddressLength () - taillen), taillen); + memcpy (head, bufcur, headlen); + memcpy (tail, bufcur + (GetAddressLength () - taillen), taillen); delete[] buflast; delete[] bufcur; @@ -2564,9 +2564,9 @@ PbbTlv::Serialize (Buffer::Iterator &start) const Buffer::Iterator bufref = start; uint8_t flags = 0; - start.Next(); + start.Next (); - if (HasTypeExt()) + if (HasTypeExt ()) { flags |= THAS_TYPE_EXT; start.WriteU8 (GetTypeExt ()); @@ -2607,7 +2607,7 @@ PbbTlv::Serialize (Buffer::Iterator &start) const flags |= TIS_MULTIVALUE; } - start.Write(GetValue ().Begin (), GetValue ().End ()); + start.Write (GetValue ().Begin (), GetValue ().End ()); } bufref.WriteU8 (flags); diff --git a/src/network/utils/pcap-file.cc b/src/network/utils/pcap-file.cc index 5d6f8a742..fb3999e95 100644 --- a/src/network/utils/pcap-file.cc +++ b/src/network/utils/pcap-file.cc @@ -152,7 +152,7 @@ PcapFile::Swap (PcapFileHeader *from, PcapFileHeader *to) to->m_magicNumber = Swap (from->m_magicNumber); to->m_versionMajor = Swap (from->m_versionMajor); to->m_versionMinor = Swap (from->m_versionMinor); - to->m_zone = Swap (uint32_t(from->m_zone)); + to->m_zone = Swap (uint32_t (from->m_zone)); to->m_sigFigs = Swap (from->m_sigFigs); to->m_snapLen = Swap (from->m_snapLen); to->m_type = Swap (from->m_type); @@ -512,7 +512,7 @@ PcapFile::Diff (std::string const & f1, std::string const & f2, break; } - if (std::memcmp(data1, data2, readLen1) != 0) + if (std::memcmp (data1, data2, readLen1) != 0) { diff = true; // Packet data do not match break; diff --git a/src/network/utils/queue.cc b/src/network/utils/queue.cc index e32b61931..6788d36ca 100644 --- a/src/network/utils/queue.cc +++ b/src/network/utils/queue.cc @@ -42,12 +42,12 @@ Queue::GetTypeId (void) } Queue::Queue() : - m_nBytes(0), - m_nTotalReceivedBytes(0), - m_nPackets(0), - m_nTotalReceivedPackets(0), - m_nTotalDroppedBytes(0), - m_nTotalDroppedPackets(0) + m_nBytes (0), + m_nTotalReceivedBytes (0), + m_nPackets (0), + m_nTotalReceivedPackets (0), + m_nTotalDroppedBytes (0), + m_nTotalDroppedPackets (0) { NS_LOG_FUNCTION_NOARGS (); } @@ -97,7 +97,7 @@ Queue::Dequeue (void) m_nBytes -= packet->GetSize (); m_nPackets--; - NS_LOG_LOGIC("m_traceDequeue (packet)"); + NS_LOG_LOGIC ("m_traceDequeue (packet)"); m_traceDequeue (packet); } return packet; @@ -149,7 +149,7 @@ uint32_t Queue::GetTotalReceivedBytes (void) const { NS_LOG_FUNCTION_NOARGS (); - NS_LOG_LOGIC("returns " << m_nTotalReceivedBytes); + NS_LOG_LOGIC ("returns " << m_nTotalReceivedBytes); return m_nTotalReceivedBytes; } @@ -173,7 +173,7 @@ uint32_t Queue::GetTotalDroppedPackets (void) const { NS_LOG_FUNCTION_NOARGS (); - NS_LOG_LOGIC("returns " << m_nTotalDroppedPackets); + NS_LOG_LOGIC ("returns " << m_nTotalDroppedPackets); return m_nTotalDroppedPackets; } diff --git a/src/network/utils/radiotap-header.cc b/src/network/utils/radiotap-header.cc index d9336056b..3b7604bb6 100644 --- a/src/network/utils/radiotap-header.cc +++ b/src/network/utils/radiotap-header.cc @@ -30,15 +30,15 @@ namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (RadiotapHeader); RadiotapHeader::RadiotapHeader() - : m_length(8), - m_present(0), - m_tsft(0), - m_flags(FRAME_FLAG_NONE), - m_rate(0), - m_channelFreq(0), - m_channelFlags(CHANNEL_FLAG_NONE), - m_antennaSignal(0), - m_antennaNoise(0) + : m_length (8), + m_present (0), + m_tsft (0), + m_flags (FRAME_FLAG_NONE), + m_rate (0), + m_channelFreq (0), + m_channelFlags (CHANNEL_FLAG_NONE), + m_antennaSignal (0), + m_antennaNoise (0) { NS_LOG_FUNCTION (this); } @@ -148,7 +148,7 @@ RadiotapHeader::Deserialize (Buffer::Iterator start) // if (m_present & RADIOTAP_TSFT) // bit 0 { - m_tsft = start.ReadU64(); + m_tsft = start.ReadU64 (); bytesRead += 8; } @@ -157,7 +157,7 @@ RadiotapHeader::Deserialize (Buffer::Iterator start) // if (m_present & RADIOTAP_FLAGS) // bit 1 { - m_flags = start.ReadU8(); + m_flags = start.ReadU8 (); ++bytesRead; } @@ -166,7 +166,7 @@ RadiotapHeader::Deserialize (Buffer::Iterator start) // if (m_present & RADIOTAP_RATE) // bit 2 { - m_rate = start.ReadU8(); + m_rate = start.ReadU8 (); ++bytesRead; } @@ -175,8 +175,8 @@ RadiotapHeader::Deserialize (Buffer::Iterator start) // if (m_present & RADIOTAP_CHANNEL) // bit 3 { - m_channelFreq = start.ReadU16(); - m_channelFlags = start.ReadU16(); + m_channelFreq = start.ReadU16 (); + m_channelFlags = start.ReadU16 (); bytesRead += 4; } @@ -186,7 +186,7 @@ RadiotapHeader::Deserialize (Buffer::Iterator start) // if (m_present & RADIOTAP_FHSS) // bit 4 { - start.ReadU8(); + start.ReadU8 (); ++bytesRead; } @@ -196,7 +196,7 @@ RadiotapHeader::Deserialize (Buffer::Iterator start) // if (m_present & RADIOTAP_DBM_ANTSIGNAL) // bit 5 { - m_antennaSignal = start.ReadU8(); + m_antennaSignal = start.ReadU8 (); ++bytesRead; } @@ -206,11 +206,11 @@ RadiotapHeader::Deserialize (Buffer::Iterator start) // if (m_present & RADIOTAP_DBM_ANTNOISE) // bit 6 { - m_antennaNoise = start.ReadU8(); + m_antennaNoise = start.ReadU8 (); ++bytesRead; } - NS_ASSERT_MSG(m_length == bytesRead, "RadiotapHeader::Deserialize(): expected and actual lengths inconsistent"); + NS_ASSERT_MSG (m_length == bytesRead, "RadiotapHeader::Deserialize(): expected and actual lengths inconsistent"); return bytesRead; } @@ -343,7 +343,7 @@ RadiotapHeader::SetAntennaSignalPower (double signal) } else { - m_antennaSignal = static_cast (floor(signal + 0.5)); + m_antennaSignal = static_cast (floor (signal + 0.5)); } NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec); diff --git a/src/network/utils/radiotap-header.h b/src/network/utils/radiotap-header.h index 13be11d64..45358145f 100644 --- a/src/network/utils/radiotap-header.h +++ b/src/network/utils/radiotap-header.h @@ -242,7 +242,7 @@ private: RADIOTAP_EXT = 0x10000000 }; - void CheckAddChannelField(); + void CheckAddChannelField (); uint16_t m_length; uint32_t m_present; diff --git a/src/network/utils/simple-net-device.cc b/src/network/utils/simple-net-device.cc index eaf7b53af..ce083b289 100644 --- a/src/network/utils/simple-net-device.cc +++ b/src/network/utils/simple-net-device.cc @@ -108,12 +108,12 @@ SimpleNetDevice::SetReceiveErrorModel (Ptr em) } void -SimpleNetDevice::SetIfIndex(const uint32_t index) +SimpleNetDevice::SetIfIndex (const uint32_t index) { m_ifIndex = index; } uint32_t -SimpleNetDevice::GetIfIndex(void) const +SimpleNetDevice::GetIfIndex (void) const { return m_ifIndex; } @@ -125,7 +125,7 @@ SimpleNetDevice::GetChannel (void) const void SimpleNetDevice::SetAddress (Address address) { - m_address = Mac48Address::ConvertFrom(address); + m_address = Mac48Address::ConvertFrom (address); } Address SimpleNetDevice::GetAddress (void) const @@ -193,7 +193,7 @@ SimpleNetDevice::IsBridge (void) const } bool -SimpleNetDevice::Send(Ptr packet, const Address& dest, uint16_t protocolNumber) +SimpleNetDevice::Send (Ptr packet, const Address& dest, uint16_t protocolNumber) { NS_LOG_FUNCTION (packet << dest << protocolNumber); Mac48Address to = Mac48Address::ConvertFrom (dest); @@ -201,7 +201,7 @@ SimpleNetDevice::Send(Ptr packet, const Address& dest, uint16_t protocol return true; } bool -SimpleNetDevice::SendFrom(Ptr packet, const Address& source, const Address& dest, uint16_t protocolNumber) +SimpleNetDevice::SendFrom (Ptr packet, const Address& source, const Address& dest, uint16_t protocolNumber) { Mac48Address to = Mac48Address::ConvertFrom (dest); Mac48Address from = Mac48Address::ConvertFrom (source); diff --git a/src/network/utils/simple-net-device.h b/src/network/utils/simple-net-device.h index 68375cf35..60d193ba1 100644 --- a/src/network/utils/simple-net-device.h +++ b/src/network/utils/simple-net-device.h @@ -60,11 +60,11 @@ public: * \see ErrorModel * \param em Ptr to the ErrorModel. */ - void SetReceiveErrorModel(Ptr em); + void SetReceiveErrorModel (Ptr em); // inherited from NetDevice base class. - virtual void SetIfIndex(const uint32_t index); - virtual uint32_t GetIfIndex(void) const; + virtual void SetIfIndex (const uint32_t index); + virtual uint32_t GetIfIndex (void) const; virtual Ptr GetChannel (void) const; virtual void SetAddress (Address address); virtual Address GetAddress (void) const; @@ -78,8 +78,8 @@ public: virtual Address GetMulticast (Ipv4Address multicastGroup) const; virtual bool IsPointToPoint (void) const; virtual bool IsBridge (void) const; - virtual bool Send(Ptr packet, const Address& dest, uint16_t protocolNumber); - virtual bool SendFrom(Ptr packet, const Address& source, const Address& dest, uint16_t protocolNumber); + virtual bool Send (Ptr packet, const Address& dest, uint16_t protocolNumber); + virtual bool SendFrom (Ptr packet, const Address& source, const Address& dest, uint16_t protocolNumber); virtual Ptr GetNode (void) const; virtual void SetNode (Ptr node); virtual bool NeedsArp (void) const; diff --git a/src/nix-vector-routing/examples/nix-simple.cc b/src/nix-vector-routing/examples/nix-simple.cc index 7aabc4f89..e56f0013e 100644 --- a/src/nix-vector-routing/examples/nix-simple.cc +++ b/src/nix-vector-routing/examples/nix-simple.cc @@ -45,8 +45,8 @@ NS_LOG_COMPONENT_DEFINE ("NixSimpleExample"); int main (int argc, char *argv[]) { - LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO); - LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO); + LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO); + LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO); NodeContainer nodes12; nodes12.Create (2); @@ -56,7 +56,7 @@ main (int argc, char *argv[]) nodes23.Create (1); NodeContainer nodes34; - nodes34.Add(nodes23.Get (1)); + nodes34.Add (nodes23.Get (1)); nodes34.Create (1); PointToPointHelper pointToPoint; diff --git a/src/nix-vector-routing/examples/nms-p2p-nix.cc b/src/nix-vector-routing/examples/nms-p2p-nix.cc index c7834d71d..0426705cc 100644 --- a/src/nix-vector-routing/examples/nms-p2p-nix.cc +++ b/src/nix-vector-routing/examples/nms-p2p-nix.cc @@ -52,9 +52,9 @@ using namespace std; using namespace ns3; typedef struct timeval TIMER_TYPE; -#define TIMER_NOW(_t) gettimeofday(&_t,NULL); +#define TIMER_NOW(_t) gettimeofday (&_t,NULL); #define TIMER_SECONDS(_t) ((double)(_t).tv_sec + (_t).tv_usec*1e-6) -#define TIMER_DIFF(_t1, _t2) (TIMER_SECONDS(_t1)-TIMER_SECONDS(_t2)) +#define TIMER_DIFF(_t1, _t2) (TIMER_SECONDS (_t1)-TIMER_SECONDS (_t2)) NS_LOG_COMPONENT_DEFINE ("CampusNetworkModel"); @@ -67,7 +67,7 @@ int main (int argc, char *argv[]) { TIMER_TYPE t0, t1, t2; - TIMER_NOW(t0); + TIMER_NOW (t0); cout << " ==== DARPA NMS CAMPUS NETWORK SIMULATION ====" << endl; LogComponentEnable ("OnOffApplication", LOG_LEVEL_INFO); @@ -165,7 +165,7 @@ main (int argc, char *argv[]) net0_1.Add (nodes_net1[z][0].Get (0)); NetDeviceContainer ndc0_1; ndc0_1 = p2p_1gb5ms.Install (net0_1); - oss.str(""); + oss.str (""); oss << 10 + z << ".1.252.0"; address.SetBase (oss.str ().c_str (), "255.255.255.0"); ifs = address.Assign (ndc0_1); @@ -215,7 +215,7 @@ main (int argc, char *argv[]) for (int i = 0; i < 9; ++i) { nodes_net3[z][i].Create (1); - stack.Install(nodes_net3[z][i]); + stack.Install (nodes_net3[z][i]); } nodes_net3[z][0].Add (nodes_net3[z][1].Get (0)); nodes_net3[z][1].Add (nodes_net3[z][2].Get (0)); @@ -394,8 +394,8 @@ main (int argc, char *argv[]) r1 = 2 + (int)(4 * urng.GetValue ()); r2 = 10 * urng.GetValue (); OnOffHelper client ("ns3::TcpSocketFactory", Address ()); - AddressValue remoteAddress(InetSocketAddress ( - ifs2LAN[z][i][j].GetAddress (0), 9999)); + AddressValue remoteAddress (InetSocketAddress ( + ifs2LAN[z][i][j].GetAddress (0), 9999)); client.SetAttribute ("Remote", remoteAddress); ApplicationContainer clientApp; clientApp.Add (client.Install (nodes_net1[x][r1].Get (0))); diff --git a/src/nix-vector-routing/helper/ipv4-nix-vector-helper.cc b/src/nix-vector-routing/helper/ipv4-nix-vector-helper.cc index 5d02e0e17..46eb4369b 100644 --- a/src/nix-vector-routing/helper/ipv4-nix-vector-helper.cc +++ b/src/nix-vector-routing/helper/ipv4-nix-vector-helper.cc @@ -43,7 +43,7 @@ Ptr Ipv4NixVectorHelper::Create (Ptr node) const { Ptr agent = m_agentFactory.Create (); - agent->SetNode(node); + agent->SetNode (node); node->AggregateObject (agent); return agent; } diff --git a/src/nix-vector-routing/model/ipv4-nix-vector-routing.cc b/src/nix-vector-routing/model/ipv4-nix-vector-routing.cc index 6523d99ae..807203248 100644 --- a/src/nix-vector-routing/model/ipv4-nix-vector-routing.cc +++ b/src/nix-vector-routing/model/ipv4-nix-vector-routing.cc @@ -140,7 +140,7 @@ Ipv4NixVectorRouting::GetNixVector (Ptr source, Ipv4Address dest, Ptr nixVector) Ipv4Address loopback ("127.0.0.1"); for (uint32_t i = 0; i < numberOfDevices; i++) { - uint32_t interfaceIndex = (m_ipv4)->GetInterfaceForDevice(m_node->GetDevice(i)); + uint32_t interfaceIndex = (m_ipv4)->GetInterfaceForDevice (m_node->GetDevice (i)); Ipv4InterfaceAddress ifAddr = m_ipv4->GetAddress (interfaceIndex, 0); - if (ifAddr.GetLocal() == loopback) + if (ifAddr.GetLocal () == loopback) { NS_LOG_LOGIC ("Adding loopback to nix."); NS_LOG_LOGIC ("Adding Nix: " << i << " with " << nixVector->BitCount (numberOfDevices) - << " bits, for node " << m_node->GetId()); + << " bits, for node " << m_node->GetId ()); nixVector->AddNeighborIndex (i, nixVector->BitCount (numberOfDevices)); return true; } @@ -286,7 +286,7 @@ Ipv4NixVectorRouting::BuildNixVector (const std::vector< Ptr > & parentVec totalNeighbors += netDeviceContainer.GetN (); } NS_LOG_LOGIC ("Adding Nix: " << destId << " with " - << nixVector->BitCount (totalNeighbors) << " bits, for node " << parentNode->GetId()); + << nixVector->BitCount (totalNeighbors) << " bits, for node " << parentNode->GetId ()); nixVector->AddNeighborIndex (destId, nixVector->BitCount (totalNeighbors)); // recurse through parent vector, grabbing the path @@ -400,7 +400,7 @@ Ipv4NixVectorRouting::NetDeviceIsBridged (Ptr nd) const NS_LOG_FUNCTION (nd); Ptr node = nd->GetNode (); - uint32_t nDevices = node->GetNDevices(); + uint32_t nDevices = node->GetNDevices (); // // There is no bit on a net device that says it is being bridged, so we have @@ -410,7 +410,7 @@ Ipv4NixVectorRouting::NetDeviceIsBridged (Ptr nd) const // for (uint32_t i = 0; i < nDevices; ++i) { - Ptr ndTest = node->GetDevice(i); + Ptr ndTest = node->GetDevice (i); NS_LOG_LOGIC ("Examine device " << i << " " << ndTest); if (ndTest->IsBridge ()) @@ -469,7 +469,7 @@ Ipv4NixVectorRouting::FindNetDeviceForNixIndex (uint32_t nodeIndex, Ipv4Address Ptr gatewayNode = gatewayDevice->GetNode (); Ptr ipv4 = gatewayNode->GetObject (); - uint32_t interfaceIndex = (ipv4)->GetInterfaceForDevice(gatewayDevice); + uint32_t interfaceIndex = (ipv4)->GetInterfaceForDevice (gatewayDevice); Ipv4InterfaceAddress ifAddr = ipv4->GetAddress (interfaceIndex, 0); gatewayIp = ifAddr.GetLocal (); break; @@ -490,7 +490,7 @@ Ipv4NixVectorRouting::RouteOutput (Ptr p, const Ipv4Header &header, Ptr< NS_LOG_DEBUG ("Dest IP from header: " << header.GetDestination ()); // check if cache - nixVectorInCache = GetNixVectorInCache(header.GetDestination ()); + nixVectorInCache = GetNixVectorInCache (header.GetDestination ()); // not in cache if (!nixVectorInCache) @@ -539,7 +539,7 @@ Ipv4NixVectorRouting::RouteOutput (Ptr p, const Ipv4Header &header, Ptr< // rtentry from the map if (rtentry) { - m_ipv4RouteCache.erase(header.GetDestination ()); + m_ipv4RouteCache.erase (header.GetDestination ()); } NS_LOG_LOGIC ("Ipv4Route not in cache, build: "); @@ -549,11 +549,11 @@ Ipv4NixVectorRouting::RouteOutput (Ptr p, const Ipv4Header &header, Ptr< if (!oif) { - interfaceIndex = (m_ipv4)->GetInterfaceForDevice(m_node->GetDevice(index)); + interfaceIndex = (m_ipv4)->GetInterfaceForDevice (m_node->GetDevice (index)); } else { - interfaceIndex = (m_ipv4)->GetInterfaceForDevice(oif); + interfaceIndex = (m_ipv4)->GetInterfaceForDevice (oif); } NS_ASSERT_MSG (interfaceIndex != -1, "Interface index not found for device"); @@ -579,10 +579,10 @@ Ipv4NixVectorRouting::RouteOutput (Ptr p, const Ipv4Header &header, Ptr< sockerr = Socket::ERROR_NOTERROR; // add rtentry to cache - m_ipv4RouteCache.insert(Ipv4RouteMap_t::value_type(header.GetDestination (), rtentry)); + m_ipv4RouteCache.insert (Ipv4RouteMap_t::value_type (header.GetDestination (), rtentry)); } - NS_LOG_LOGIC ("Nix-vector contents: " << *nixVectorInCache << " : Remaining bits: " << nixVectorForPacket->GetRemainingBits()); + NS_LOG_LOGIC ("Nix-vector contents: " << *nixVectorInCache << " : Remaining bits: " << nixVectorForPacket->GetRemainingBits ()); // Add nix-vector in the packet class // make sure the packet exists first @@ -611,7 +611,7 @@ Ipv4NixVectorRouting::RouteInput (Ptr p, const Ipv4Header &header, Ptr rtentry; // Get the nix-vector from the packet - Ptr nixVector = p->GetNixVector(); + Ptr nixVector = p->GetNixVector (); // If nixVector isn't in packet, something went wrong NS_ASSERT (nixVector); @@ -632,7 +632,7 @@ Ipv4NixVectorRouting::RouteInput (Ptr p, const Ipv4Header &header, NS_LOG_LOGIC ("Ipv4Route not in cache, build: "); Ipv4Address gatewayIp; uint32_t index = FindNetDeviceForNixIndex (nodeIndex, gatewayIp); - uint32_t interfaceIndex = (m_ipv4)->GetInterfaceForDevice(m_node->GetDevice(index)); + uint32_t interfaceIndex = (m_ipv4)->GetInterfaceForDevice (m_node->GetDevice (index)); Ipv4InterfaceAddress ifAddr = m_ipv4->GetAddress (interfaceIndex, 0); // start filling in the Ipv4Route info @@ -644,10 +644,10 @@ Ipv4NixVectorRouting::RouteInput (Ptr p, const Ipv4Header &header, rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIndex)); // add rtentry to cache - m_ipv4RouteCache.insert(Ipv4RouteMap_t::value_type(header.GetDestination (), rtentry)); + m_ipv4RouteCache.insert (Ipv4RouteMap_t::value_type (header.GetDestination (), rtentry)); } - NS_LOG_LOGIC ("At Node " << m_node->GetId() << ", Extracting " << numberOfBits << + NS_LOG_LOGIC ("At Node " << m_node->GetId () << ", Extracting " << numberOfBits << " bits from Nix-vector: " << nixVector << " : " << *nixVector); // call the unicast callback @@ -660,10 +660,10 @@ Ipv4NixVectorRouting::RouteInput (Ptr p, const Ipv4Header &header, } void -Ipv4NixVectorRouting::PrintRoutingTable(Ptr stream) const +Ipv4NixVectorRouting::PrintRoutingTable (Ptr stream) const { - std::ostream* os = stream->GetStream(); + std::ostream* os = stream->GetStream (); *os << "NixCache:" << std::endl; if (m_nixCache.size () > 0) { @@ -672,7 +672,7 @@ Ipv4NixVectorRouting::PrintRoutingTable(Ptr stream) const { std::ostringstream dest; dest << it->first; - *os << std::setiosflags (std::ios::left) << std::setw (16) << dest.str(); + *os << std::setiosflags (std::ios::left) << std::setw (16) << dest.str (); *os << *(it->second) << std::endl; } } @@ -684,11 +684,11 @@ Ipv4NixVectorRouting::PrintRoutingTable(Ptr stream) const { std::ostringstream dest, gw, src; dest << it->second->GetDestination (); - *os << std::setiosflags (std::ios::left) << std::setw (16) << dest.str(); + *os << std::setiosflags (std::ios::left) << std::setw (16) << dest.str (); gw << it->second->GetGateway (); - *os << std::setiosflags (std::ios::left) << std::setw (16) << gw.str(); + *os << std::setiosflags (std::ios::left) << std::setw (16) << gw.str (); src << it->second->GetSource (); - *os << std::setiosflags (std::ios::left) << std::setw (16) << src.str(); + *os << std::setiosflags (std::ios::left) << std::setw (16) << src.str (); *os << " "; if (Names::FindName (it->second->GetOutputDevice ()) != "") { @@ -732,7 +732,7 @@ Ipv4NixVectorRouting::BFS (uint32_t numberOfNodes, Ptr source, { NS_LOG_FUNCTION_NOARGS (); - NS_LOG_LOGIC ("Going from Node " << source->GetId() << " to Node " << dest->GetId()); + NS_LOG_LOGIC ("Going from Node " << source->GetId () << " to Node " << dest->GetId ()); std::queue< Ptr > greyNodeList; // discovered nodes with unexplored children // reset the parent vector @@ -742,7 +742,7 @@ Ipv4NixVectorRouting::BFS (uint32_t numberOfNodes, Ptr source, // Add the source node to the queue, set its parent to itself greyNodeList.push (source); - parentVector.at (source->GetId()) = source; + parentVector.at (source->GetId ()) = source; // BFS loop while (greyNodeList.size () != 0) @@ -752,7 +752,7 @@ Ipv4NixVectorRouting::BFS (uint32_t numberOfNodes, Ptr source, if (currNode == dest) { - NS_LOG_LOGIC ("Made it to Node " << currNode->GetId()); + NS_LOG_LOGIC ("Made it to Node " << currNode->GetId ()); return true; } @@ -764,7 +764,7 @@ Ipv4NixVectorRouting::BFS (uint32_t numberOfNodes, Ptr source, // make sure that we can go this way if (ipv4) { - uint32_t interfaceIndex = (ipv4)->GetInterfaceForDevice(oif); + uint32_t interfaceIndex = (ipv4)->GetInterfaceForDevice (oif); if (!(ipv4->IsUp (interfaceIndex))) { NS_LOG_LOGIC ("Ipv4Interface is down"); @@ -820,7 +820,7 @@ Ipv4NixVectorRouting::BFS (uint32_t numberOfNodes, Ptr source, // make sure that we can go this way if (ipv4) { - uint32_t interfaceIndex = (ipv4)->GetInterfaceForDevice(currNode->GetDevice(i)); + uint32_t interfaceIndex = (ipv4)->GetInterfaceForDevice (currNode->GetDevice (i)); if (!(ipv4->IsUp (interfaceIndex))) { NS_LOG_LOGIC ("Ipv4Interface is down"); diff --git a/src/olsr/examples/olsr-hna.cc b/src/olsr/examples/olsr-hna.cc index fd567765d..d1e2a543f 100644 --- a/src/olsr/examples/olsr-hna.cc +++ b/src/olsr/examples/olsr-hna.cc @@ -149,14 +149,14 @@ int main (int argc, char *argv[]) wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel"); // The below FixedRssLossModel will cause the rss to be fixed regardless // of the distance between the two stations, and the transmit power - wifiChannel.AddPropagationLoss ("ns3::FixedRssLossModel","Rss",DoubleValue(rss)); + wifiChannel.AddPropagationLoss ("ns3::FixedRssLossModel","Rss",DoubleValue (rss)); wifiPhy.SetChannel (wifiChannel.Create ()); // Add a non-QoS upper mac, and disable rate control NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", - "DataMode",StringValue(phyMode), - "ControlMode",StringValue(phyMode)); + "DataMode",StringValue (phyMode), + "ControlMode",StringValue (phyMode)); // Set it to adhoc mode wifiMac.SetType ("ns3::AdhocWifiMac"); NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, olsrNodes); @@ -164,7 +164,7 @@ int main (int argc, char *argv[]) CsmaHelper csma; csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000))); csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); - NetDeviceContainer csmaDevices = csma.Install (NodeContainer (csmaNodes.Get(0), olsrNodes.Get(1))); + NetDeviceContainer csmaDevices = csma.Install (NodeContainer (csmaNodes.Get (0), olsrNodes.Get (1))); // Note that with FixedRssLossModel, the positions below are not // used for received signal strength. @@ -203,7 +203,7 @@ int main (int argc, char *argv[]) ipv4.Assign (csmaDevices); TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory"); - Ptr recvSink = Socket::CreateSocket (csmaNodes.Get(0), tid); + Ptr recvSink = Socket::CreateSocket (csmaNodes.Get (0), tid); InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), 80); recvSink->Bind (local); recvSink->SetRecvCallback (MakeCallback (&ReceivePacket)); @@ -239,7 +239,7 @@ int main (int argc, char *argv[]) // Add the required routes into the Ipv4StaticRouting Protocol instance // and have the node generate HNA messages for all these routes // which are associated with non-OLSR interfaces specified above. - hnaEntries->AddNetworkRouteTo (Ipv4Address ("172.16.1.0"), Ipv4Mask ("255.255.255.0"), uint32_t(2), uint32_t(1)); + hnaEntries->AddNetworkRouteTo (Ipv4Address ("172.16.1.0"), Ipv4Mask ("255.255.255.0"), uint32_t (2), uint32_t (1)); olsrrp_Gw->SetRoutingTableAssociation (hnaEntries); } diff --git a/src/olsr/examples/simple-point-to-point-olsr.cc b/src/olsr/examples/simple-point-to-point-olsr.cc index 272b36bd3..b512ba14f 100644 --- a/src/olsr/examples/simple-point-to-point-olsr.cc +++ b/src/olsr/examples/simple-point-to-point-olsr.cc @@ -79,9 +79,9 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Create nodes."); NodeContainer c; c.Create (5); - NodeContainer n02 = NodeContainer (c.Get(0), c.Get (2)); - NodeContainer n12 = NodeContainer (c.Get(1), c.Get (2)); - NodeContainer n32 = NodeContainer (c.Get(3), c.Get (2)); + NodeContainer n02 = NodeContainer (c.Get (0), c.Get (2)); + NodeContainer n12 = NodeContainer (c.Get (1), c.Get (2)); + NodeContainer n32 = NodeContainer (c.Get (3), c.Get (2)); NodeContainer n34 = NodeContainer (c.Get (3), c.Get (4)); // Enable OLSR diff --git a/src/olsr/model/olsr-header.cc b/src/olsr/model/olsr-header.cc index 42a18a3dd..ca159ad58 100644 --- a/src/olsr/model/olsr-header.cc +++ b/src/olsr/model/olsr-header.cc @@ -31,7 +31,7 @@ namespace ns3 { namespace olsr { -NS_LOG_COMPONENT_DEFINE("OlsrHeader"); +NS_LOG_COMPONENT_DEFINE ("OlsrHeader"); /// Scaling factor used in RFC 3626. #define OLSR_C 0.0625 @@ -310,7 +310,7 @@ MessageHeader::Mid::Deserialize (Buffer::Iterator start, uint32_t messageSize) NS_ASSERT (messageSize % IPV4_ADDRESS_SIZE == 0); int numAddresses = messageSize / IPV4_ADDRESS_SIZE; - this->interfaceAddresses.erase (this->interfaceAddresses.begin(), + this->interfaceAddresses.erase (this->interfaceAddresses.begin (), this->interfaceAddresses.end ()); for (int n = 0; n < numAddresses; ++n) this->interfaceAddresses.push_back (Ipv4Address (i.ReadNtohU32 ())); diff --git a/src/olsr/model/olsr-routing-protocol.cc b/src/olsr/model/olsr-routing-protocol.cc index b81fc842d..f0d1eba84 100644 --- a/src/olsr/model/olsr-routing-protocol.cc +++ b/src/olsr/model/olsr-routing-protocol.cc @@ -126,7 +126,7 @@ /// Maximum allowed sequence number. #define OLSR_MAX_SEQ_NUM 65535 /// Random number between [0-OLSR_MAXJITTER] used to jitter OLSR packet transmission. -#define JITTER (Seconds (UniformVariable().GetValue (0, OLSR_MAXJITTER))) +#define JITTER (Seconds (UniformVariable ().GetValue (0, OLSR_MAXJITTER))) #define OLSR_PORT_NUMBER 698 @@ -320,7 +320,7 @@ void RoutingProtocol::DoStart () // Create a socket to listen only on this interface Ptr socket = Socket::CreateSocket (GetObject (), - UdpSocketFactory::GetTypeId()); + UdpSocketFactory::GetTypeId ()); socket->SetAllowBroadcast (true); InetSocketAddress inetAddr (m_ipv4->GetAddress (i, 0).GetLocal (), OLSR_PORT_NUMBER); socket->SetRecvCallback (MakeCallback (&RoutingProtocol::RecvOlsr, this)); @@ -478,7 +478,7 @@ RoutingProtocol::RecvOlsr (Ptr socket) // If the message has been considered for forwarding, it should // not be retransmitted again for (std::vector::const_iterator it = duplicated->ifaceList.begin (); - it != duplicated->ifaceList.end(); it++) + it != duplicated->ifaceList.end (); it++) { if (*it == receiverIfaceAddr) { @@ -566,7 +566,7 @@ CoverTwoHopNeighbors (Ipv4Address neighborMainAddr, TwoHopNeighborSet & N2) /// \brief Computates MPR set of a node following RFC 3626 hints. /// void -RoutingProtocol::MprComputation() +RoutingProtocol::MprComputation () { NS_LOG_FUNCTION (this); @@ -578,7 +578,7 @@ RoutingProtocol::MprComputation() // N is the subset of neighbors of the node, which are // neighbor "of the interface I" NeighborSet N; - for (NeighborSet::const_iterator neighbor = m_state.GetNeighbors ().begin(); + for (NeighborSet::const_iterator neighbor = m_state.GetNeighbors ().begin (); neighbor != m_state.GetNeighbors ().end (); neighbor++) { if (neighbor->status == NeighborTuple::STATUS_SYM) // I think that we need this check @@ -765,7 +765,7 @@ RoutingProtocol::MprComputation() // through this 1-hop neighbor std::map > reachability; std::set rs; - for (NeighborSet::iterator it = N.begin(); it != N.end(); it++) + for (NeighborSet::iterator it = N.begin (); it != N.end (); it++) { NeighborTuple const &nb_tuple = *it; int r = 0; @@ -887,7 +887,7 @@ RoutingProtocol::RoutingTableComputation () // symmetric neighbors (h=1) as the destination nodes. const NeighborSet &neighborSet = m_state.GetNeighbors (); for (NeighborSet::const_iterator it = neighborSet.begin (); - it != neighborSet.end(); it++) + it != neighborSet.end (); it++) { NeighborTuple const &nb_tuple = *it; NS_LOG_DEBUG ("Looking at neighbor tuple: " << nb_tuple); @@ -896,8 +896,8 @@ RoutingProtocol::RoutingTableComputation () bool nb_main_addr = false; const LinkTuple *lt = NULL; const LinkSet &linkSet = m_state.GetLinks (); - for (LinkSet::const_iterator it2 = linkSet.begin(); - it2 != linkSet.end(); it2++) + for (LinkSet::const_iterator it2 = linkSet.begin (); + it2 != linkSet.end (); it2++) { LinkTuple const &link_tuple = *it2; NS_LOG_DEBUG ("Looking at link tuple: " << link_tuple @@ -939,10 +939,10 @@ RoutingProtocol::RoutingTableComputation () { NS_LOG_LOGIC ("no R_dest_addr is equal to the main address of the neighbor " "=> adding additional routing entry"); - AddEntry(nb_tuple.neighborMainAddr, - lt->neighborIfaceAddr, - lt->localIfaceAddr, - 1); + AddEntry (nb_tuple.neighborMainAddr, + lt->neighborIfaceAddr, + lt->localIfaceAddr, + 1); } } } @@ -978,7 +978,7 @@ RoutingProtocol::RoutingTableComputation () // neighbor node with willingness different of WILL_NEVER... bool nb2hopOk = false; for (NeighborSet::const_iterator neighbor = neighborSet.begin (); - neighbor != neighborSet.end(); neighbor++) + neighbor != neighborSet.end (); neighbor++) { if (neighbor->neighborMainAddr == nb2hop_tuple.neighborMainAddr && neighbor->willingness != OLSR_WILL_NEVER) @@ -1162,7 +1162,7 @@ RoutingProtocol::RoutingTableComputation () } else if(gatewayEntryExists && m_hnaRoutingTable->GetMetric (routeIndex) > gatewayEntry.distance) { - m_hnaRoutingTable->RemoveRoute(routeIndex); + m_hnaRoutingTable->RemoveRoute (routeIndex); addRoute = true; } @@ -1210,7 +1210,7 @@ RoutingProtocol::ProcessHello (const olsr::MessageHeader &msg, << "s ** BEGIN dump Link Set for OLSR Node " << m_mainAddress); for (LinkSet::const_iterator link = links.begin (); link != links.end (); link++) { - NS_LOG_DEBUG(*link); + NS_LOG_DEBUG (*link); } NS_LOG_DEBUG ("** END dump Link Set for OLSR Node " << m_mainAddress); @@ -1219,7 +1219,7 @@ RoutingProtocol::ProcessHello (const olsr::MessageHeader &msg, << "s ** BEGIN dump Neighbor Set for OLSR Node " << m_mainAddress); for (NeighborSet::const_iterator neighbor = neighbors.begin (); neighbor != neighbors.end (); neighbor++) { - NS_LOG_DEBUG(*neighbor); + NS_LOG_DEBUG (*neighbor); } NS_LOG_DEBUG ("** END dump Neighbor Set for OLSR Node " << m_mainAddress); } @@ -1236,7 +1236,7 @@ RoutingProtocol::ProcessHello (const olsr::MessageHeader &msg, for (TwoHopNeighborSet::const_iterator tuple = twoHopNeighbors.begin (); tuple != twoHopNeighbors.end (); tuple++) { - NS_LOG_DEBUG(*tuple); + NS_LOG_DEBUG (*tuple); } NS_LOG_DEBUG ("** END dump TwoHopNeighbor Set for OLSR Node " << m_mainAddress); } @@ -1376,8 +1376,8 @@ RoutingProtocol::ProcessMid (const olsr::MessageHeader &msg, { bool updated = false; IfaceAssocSet &ifaceAssoc = m_state.GetIfaceAssocSetMutable (); - for (IfaceAssocSet::iterator tuple = ifaceAssoc.begin(); - tuple != ifaceAssoc.end(); tuple++) + for (IfaceAssocSet::iterator tuple = ifaceAssoc.begin (); + tuple != ifaceAssoc.end (); tuple++) { if (tuple->ifaceAddr == *i && tuple->mainAddr == msg.GetOriginatorAddress ()) @@ -1405,14 +1405,14 @@ RoutingProtocol::ProcessMid (const olsr::MessageHeader &msg, // TwoHopNeighborTuples, update the neighbor addresses taking into account // the new MID information. NeighborSet &neighbors = m_state.GetNeighbors (); - for (NeighborSet::iterator neighbor = neighbors.begin (); neighbor != neighbors.end(); neighbor++) + for (NeighborSet::iterator neighbor = neighbors.begin (); neighbor != neighbors.end (); neighbor++) { neighbor->neighborMainAddr = GetMainAddress (neighbor->neighborMainAddr); } TwoHopNeighborSet &twoHopNeighbors = m_state.GetTwoHopNeighbors (); for (TwoHopNeighborSet::iterator twoHopNeighbor = twoHopNeighbors.begin (); - twoHopNeighbor != twoHopNeighbors.end(); twoHopNeighbor++) + twoHopNeighbor != twoHopNeighbors.end (); twoHopNeighbor++) { twoHopNeighbor->neighborMainAddr = GetMainAddress (twoHopNeighbor->neighborMainAddr); twoHopNeighbor->twoHopNeighborAddr = GetMainAddress (twoHopNeighbor->twoHopNeighborAddr); @@ -1446,10 +1446,10 @@ RoutingProtocol::ProcessHna (const olsr::MessageHeader &msg, // 2. Otherwise, for each (network address, netmask) pair in the // message: - for (std::vector::const_iterator it = hna.associations.begin(); - it != hna.associations.end(); it++) + for (std::vector::const_iterator it = hna.associations.begin (); + it != hna.associations.end (); it++) { - AssociationTuple *tuple = m_state.FindAssociationTuple(msg.GetOriginatorAddress(),it->address,it->mask); + AssociationTuple *tuple = m_state.FindAssociationTuple (msg.GetOriginatorAddress (),it->address,it->mask); // 2.1 if an entry in the association set already exists, where: // A_gateway_addr == originator address @@ -1470,7 +1470,7 @@ RoutingProtocol::ProcessHna (const olsr::MessageHeader &msg, else { AssociationTuple assocTuple = { - msg.GetOriginatorAddress(), + msg.GetOriginatorAddress (), it->address, it->mask, now + msg.GetVTime () @@ -1780,8 +1780,8 @@ RoutingProtocol::SendTc () olsr::MessageHeader::Tc &tc = msg.GetTc (); tc.ansn = m_ansn; - for (MprSelectorSet::const_iterator mprsel_tuple = m_state.GetMprSelectors ().begin(); - mprsel_tuple != m_state.GetMprSelectors ().end(); mprsel_tuple++) + for (MprSelectorSet::const_iterator mprsel_tuple = m_state.GetMprSelectors ().begin (); + mprsel_tuple != m_state.GetMprSelectors ().end (); mprsel_tuple++) { tc.neighborAddresses.push_back (mprsel_tuple->mainAddr); } @@ -2091,7 +2091,7 @@ RoutingProtocol::LinkSensing (const olsr::MessageHeader &msg, } NS_LOG_DEBUG ("Link tuple updated: " << int (updated)); } - link_tuple->time = std::max(link_tuple->time, link_tuple->asymTime); + link_tuple->time = std::max (link_tuple->time, link_tuple->asymTime); if (updated) { @@ -2305,28 +2305,28 @@ RoutingProtocol::PopulateMprSelectorSet (const olsr::MessageHeader &msg, /// \param p the packet which couldn't be delivered by the MAC layer. /// void -OLSR::mac_failed(Ptr p) { +OLSR::mac_failed (Ptr p) { double now = Simulator::Now (); - struct hdr_ip* ih = HDR_IP(p); - struct hdr_cmn* ch = HDR_CMN(p); + struct hdr_ip* ih = HDR_IP (p); + struct hdr_cmn* ch = HDR_CMN (p); - debug("%f: Node %d MAC Layer detects a breakage on link to %d\n", - now, - OLSR::node_id(ra_addr()), - OLSR::node_id(ch->next_hop())); + debug ("%f: Node %d MAC Layer detects a breakage on link to %d\n", + now, + OLSR::node_id (ra_addr ()), + OLSR::node_id (ch->next_hop ())); - if ((u_int32_t)ih->daddr() == IP_BROADCAST) { - drop(p, DROP_RTR_MAC_CALLBACK); + if ((u_int32_t)ih->daddr () == IP_BROADCAST) { + drop (p, DROP_RTR_MAC_CALLBACK); return; } - OLSR_link_tuple* link_tuple = state_.find_link_tuple(ch->next_hop()); + OLSR_link_tuple* link_tuple = state_.find_link_tuple (ch->next_hop ()); if (link_tuple != NULL) { - link_tuple->lost_time() = now + OLSR_NEIGHB_HOLD_TIME; - link_tuple->time() = now + OLSR_NEIGHB_HOLD_TIME; - nb_loss(link_tuple); + link_tuple->lost_time () = now + OLSR_NEIGHB_HOLD_TIME; + link_tuple->time () = now + OLSR_NEIGHB_HOLD_TIME; + nb_loss (link_tuple); } - drop(p, DROP_RTR_MAC_CALLBACK); + drop (p, DROP_RTR_MAC_CALLBACK); } #endif @@ -2456,8 +2456,8 @@ RoutingProtocol::LinkTupleUpdated (const LinkTuple &tuple, uint8_t willingness) bool hasSymmetricLink = false; const LinkSet &linkSet = m_state.GetLinks (); - for (LinkSet::const_iterator it = linkSet.begin(); - it != linkSet.end(); it++) + for (LinkSet::const_iterator it = linkSet.begin (); + it != linkSet.end (); it++) { const LinkTuple &link_tuple = *it; if (GetMainAddress (link_tuple.neighborIfaceAddr) == nb_tuple->neighborMainAddr @@ -2616,7 +2616,7 @@ RoutingProtocol::AddTopologyTuple (const TopologyTuple &tuple) // OLSR::node_id(tuple->last_addr()), // tuple->seq()); - m_state.InsertTopologyTuple(tuple); + m_state.InsertTopologyTuple (tuple); } /// @@ -3031,7 +3031,7 @@ RoutingProtocol::FindSendEntry (RoutingTableEntry const &entry, outEntry = entry; while (outEntry.destAddr != outEntry.nextAddr) { - if (not Lookup(outEntry.nextAddr, outEntry)) + if (not Lookup (outEntry.nextAddr, outEntry)) return false; } return true; @@ -3040,7 +3040,7 @@ RoutingProtocol::FindSendEntry (RoutingTableEntry const &entry, Ptr RoutingProtocol::RouteOutput (Ptr p, const Ipv4Header &header, Ptr oif, Socket::SocketErrno &sockerr) { - NS_LOG_FUNCTION (this << " " << m_ipv4->GetObject ()->GetId() << " " << header.GetDestination () << " " << oif); + NS_LOG_FUNCTION (this << " " << m_ipv4->GetObject ()->GetId () << " " << header.GetDestination () << " " << oif); Ptr rtentry; RoutingTableEntry entry1, entry2; bool found = false; @@ -3088,7 +3088,7 @@ RoutingProtocol::RouteOutput (Ptr p, const Ipv4Header &header, Ptr nextHop=" << entry2.nextAddr << " interface=" << entry2.interface); - NS_LOG_DEBUG ("Found route to " << rtentry->GetDestination () << " via nh " << rtentry->GetGateway () << " with source addr " << rtentry->GetSource () << " and output dev " << rtentry->GetOutputDevice()); + NS_LOG_DEBUG ("Found route to " << rtentry->GetDestination () << " via nh " << rtentry->GetGateway () << " with source addr " << rtentry->GetSource () << " and output dev " << rtentry->GetOutputDevice ()); found = true; } else @@ -3098,7 +3098,7 @@ RoutingProtocol::RouteOutput (Ptr p, const Ipv4Header &header, PtrGetDestination () << " via nh " << rtentry->GetGateway () << " with source addr " << rtentry->GetSource () << " and output dev " << rtentry->GetOutputDevice()); + NS_LOG_DEBUG ("Found route to " << rtentry->GetDestination () << " via nh " << rtentry->GetGateway () << " with source addr " << rtentry->GetSource () << " and output dev " << rtentry->GetOutputDevice ()); } } @@ -3117,7 +3117,7 @@ bool RoutingProtocol::RouteInput (Ptr p, UnicastForwardCallback ucb, MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb) { - NS_LOG_FUNCTION (this << " " << m_ipv4->GetObject ()->GetId() << " " << header.GetDestination ()); + NS_LOG_FUNCTION (this << " " << m_ipv4->GetObject ()->GetId () << " " << header.GetDestination ()); Ipv4Address dst = header.GetDestination (); Ipv4Address origin = header.GetSource (); diff --git a/src/olsr/model/olsr-state.cc b/src/olsr/model/olsr-state.cc index 4b4f405d8..188866e47 100644 --- a/src/olsr/model/olsr-state.cc +++ b/src/olsr/model/olsr-state.cc @@ -210,7 +210,7 @@ OlsrState::EraseTwoHopNeighborTuple (const TwoHopNeighborTuple &tuple) { if (*it == tuple) { - m_twoHopNeighborSet.erase(it); + m_twoHopNeighborSet.erase (it); break; } } @@ -284,7 +284,7 @@ DuplicateTuple* OlsrState::FindDuplicateTuple (Ipv4Address const &addr, uint16_t sequenceNumber) { for (DuplicateSet::iterator it = m_duplicateSet.begin (); - it != m_duplicateSet.end(); it++) + it != m_duplicateSet.end (); it++) { if (it->address == addr && it->sequenceNumber == sequenceNumber) return &(*it); @@ -392,7 +392,7 @@ OlsrState::FindNewerTopologyTuple (Ipv4Address const & lastAddr, uint16_t ansn) } void -OlsrState::EraseTopologyTuple(const TopologyTuple &tuple) +OlsrState::EraseTopologyTuple (const TopologyTuple &tuple) { for (TopologySet::iterator it = m_topologySet.begin (); it != m_topologySet.end (); it++) @@ -408,8 +408,8 @@ OlsrState::EraseTopologyTuple(const TopologyTuple &tuple) void OlsrState::EraseOlderTopologyTuples (const Ipv4Address &lastAddr, uint16_t ansn) { - for (TopologySet::iterator it = m_topologySet.begin(); - it != m_topologySet.end();) + for (TopologySet::iterator it = m_topologySet.begin (); + it != m_topologySet.end ();) { if (it->lastAddr == lastAddr && it->sequenceNumber < ansn) { @@ -540,7 +540,7 @@ OlsrState::EraseAssociation (const Association &tuple) void OlsrState::InsertAssociation (const Association &tuple) { - m_associations.push_back(tuple); + m_associations.push_back (tuple); } } // namespace ns3 diff --git a/src/olsr/test/bug780-test.cc b/src/olsr/test/bug780-test.cc index d0a908de0..11e016627 100644 --- a/src/olsr/test/bug780-test.cc +++ b/src/olsr/test/bug780-test.cc @@ -77,7 +77,7 @@ Bug780Test::~Bug780Test() void Bug780Test::DoRun () { - SeedManager::SetSeed(123); + SeedManager::SetSeed (123); CreateNodes (); Simulator::Stop (m_time); @@ -116,8 +116,8 @@ Bug780Test::CreateNodes (void) NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); wifi.SetStandard (WIFI_PHY_STANDARD_80211b); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", - "DataMode",StringValue(phyMode), - "ControlMode",StringValue(phyMode)); + "DataMode",StringValue (phyMode), + "ControlMode",StringValue (phyMode)); //set the tx range to 300 wifiPhy.Set ("TxPowerStart",DoubleValue (-0.1615)); @@ -143,24 +143,24 @@ Bug780Test::CreateNodes (void) Ptr positionAlloc_Adhoc = CreateObject(); double distance = 0.0; - for (uint32_t i = 0; i <= adhocNodes.GetN(); i++) + for (uint32_t i = 0; i <= adhocNodes.GetN (); i++) { - positionAlloc_Adhoc->Add(Vector(distance,0.0,0.0)); + positionAlloc_Adhoc->Add (Vector (distance,0.0,0.0)); distance += 250.0; } mobilityAdhoc.SetMobilityModel ("ns3::ConstantVelocityMobilityModel"); - mobilityAdhoc.SetPositionAllocator(positionAlloc_Adhoc); + mobilityAdhoc.SetPositionAllocator (positionAlloc_Adhoc); mobilityAdhoc.Install (adhocNodes); //At 50 sec node 3 moves towards node 2 - Simulator::Schedule (Seconds (50.0), &SetVelocity, adhocNodes.Get(2),Vector(-5.0,0.0,0.0)); + Simulator::Schedule (Seconds (50.0), &SetVelocity, adhocNodes.Get (2),Vector (-5.0,0.0,0.0)); //AT 100 sec set node 3 with zero velocity - Simulator::Schedule (Seconds (100.0), &SetVelocity, adhocNodes.Get(2),Vector(0.0,0.0,0.0)); + Simulator::Schedule (Seconds (100.0), &SetVelocity, adhocNodes.Get (2),Vector (0.0,0.0,0.0)); //Move node2 away from node 3 - Simulator::Schedule (Seconds (100.0), &SetVelocity, adhocNodes.Get(1),Vector(5.0,0.0,0.0)); + Simulator::Schedule (Seconds (100.0), &SetVelocity, adhocNodes.Get (1),Vector (5.0,0.0,0.0)); //AT 150 sec set node 2 with zero velocity - Simulator::Schedule (Seconds (150.0), &SetVelocity, adhocNodes.Get(1), Vector(0.0,0.0,0.0)); + Simulator::Schedule (Seconds (150.0), &SetVelocity, adhocNodes.Get (1), Vector (0.0,0.0,0.0)); // Ping 10.1.1.1 -> 10.1.1.2 @@ -169,7 +169,7 @@ Bug780Test::CreateNodes (void) ApplicationContainer p = ping.Install (adhocNodes.Get (0)); p.Start (Seconds (50)); - p.Stop (Seconds (SimTime) - Seconds(0.001)); + p.Stop (Seconds (SimTime) - Seconds (0.001)); // pcap std::string prefix = (WRITE_VECTORS ? NS_TEST_SOURCEDIR : GetTempDir ()) + PREFIX; @@ -186,9 +186,9 @@ Bug780Test::CheckResults () os1 << NS_TEST_SOURCEDIR << PREFIX << "-" << i << "-0.pcap"; os2 << GetTempDir () << PREFIX << "-" << i << "-0.pcap"; - uint32_t sec(0), usec(0); - bool diff = PcapFile::Diff (os1.str(), os2.str(), sec, usec); - NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str() + uint32_t sec (0), usec (0); + bool diff = PcapFile::Diff (os1.str (), os2.str (), sec, usec); + NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str () << " and " << os2.str () << " differ starting from " << sec << " s " << usec << " us"); } } diff --git a/src/olsr/test/hello-regression-test.cc b/src/olsr/test/hello-regression-test.cc index e2c352b5d..672ab9852 100644 --- a/src/olsr/test/hello-regression-test.cc +++ b/src/olsr/test/hello-regression-test.cc @@ -54,7 +54,7 @@ HelloRegressionTest::~HelloRegressionTest() void HelloRegressionTest::DoRun () { - SeedManager::SetSeed(12345); + SeedManager::SetSeed (12345); CreateNodes (); Simulator::Stop (m_time); @@ -99,9 +99,9 @@ HelloRegressionTest::CheckResults () os1 << NS_TEST_SOURCEDIR << PREFIX << "-" << i << "-1.pcap"; os2 << GetTempDir () << PREFIX << "-" << i << "-1.pcap"; - uint32_t sec(0), usec(0); - bool diff = PcapFile::Diff (os1.str(), os2.str(), sec, usec); - NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str() + uint32_t sec (0), usec (0); + bool diff = PcapFile::Diff (os1.str (), os2.str (), sec, usec); + NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str () << " and " << os2.str () << " differ starting from " << sec << " s " << usec << " us"); } } diff --git a/src/olsr/test/olsr-header-test-suite.cc b/src/olsr/test/olsr-header-test-suite.cc index 4a1608bf8..9c0cac138 100644 --- a/src/olsr/test/olsr-header-test-suite.cc +++ b/src/olsr/test/olsr-header-test-suite.cc @@ -41,8 +41,8 @@ OlsrEmfTestCase::DoRun (void) { uint8_t emf = olsr::SecondsToEmf (time); double seconds = olsr::EmfToSeconds (emf); - NS_TEST_ASSERT_MSG_EQ((seconds < 0 || fabs (seconds - time) > 0.1), false, - "XXX"); + NS_TEST_ASSERT_MSG_EQ ((seconds < 0 || fabs (seconds - time) > 0.1), false, + "XXX"); } } @@ -128,7 +128,7 @@ OlsrMidTestCase::DoRun (void) NS_TEST_ASSERT_MSG_EQ (*mid1.interfaceAddresses.begin (), Ipv4Address ("1.2.3.4"), "XXX"); sizeLeft -= msg1.GetSerializedSize (); - NS_TEST_ASSERT_MSG_EQ((sizeLeft > 0), true, "XXX"); + NS_TEST_ASSERT_MSG_EQ ((sizeLeft > 0), true, "XXX"); } { // now read the second message @@ -303,13 +303,13 @@ public: } g_olsrTestSuite; OlsrTestSuite::OlsrTestSuite() - : TestSuite("routing-olsr-header", UNIT) + : TestSuite ("routing-olsr-header", UNIT) { - AddTestCase(new OlsrHnaTestCase()); - AddTestCase(new OlsrTcTestCase()); - AddTestCase(new OlsrHelloTestCase()); - AddTestCase(new OlsrMidTestCase()); - AddTestCase(new OlsrEmfTestCase()); + AddTestCase (new OlsrHnaTestCase ()); + AddTestCase (new OlsrTcTestCase ()); + AddTestCase (new OlsrHelloTestCase ()); + AddTestCase (new OlsrMidTestCase ()); + AddTestCase (new OlsrEmfTestCase ()); } } // namespace ns3 diff --git a/src/olsr/test/olsr-routing-protocol-test-suite.cc b/src/olsr/test/olsr-routing-protocol-test-suite.cc index 7fdea2474..c07a4d4d1 100644 --- a/src/olsr/test/olsr-routing-protocol-test-suite.cc +++ b/src/olsr/test/olsr-routing-protocol-test-suite.cc @@ -174,7 +174,7 @@ public: } g_olsrProtocolTestSuite; OlsrProtocolTestSuite::OlsrProtocolTestSuite() - : TestSuite("routing-olsr", UNIT) + : TestSuite ("routing-olsr", UNIT) { AddTestCase (new OlsrMprTestCase ()); } diff --git a/src/olsr/test/tc-regression-test.cc b/src/olsr/test/tc-regression-test.cc index 442bdece3..f3f7f6a1d 100644 --- a/src/olsr/test/tc-regression-test.cc +++ b/src/olsr/test/tc-regression-test.cc @@ -59,7 +59,7 @@ TcRegressionTest::~TcRegressionTest() void TcRegressionTest::DoRun () { - SeedManager::SetSeed(12345); + SeedManager::SetSeed (12345); CreateNodes (); Simulator::Stop (m_time); @@ -127,9 +127,9 @@ TcRegressionTest::CheckResults () os1 << NS_TEST_SOURCEDIR << PREFIX << "-" << i << "-1.pcap"; os2 << GetTempDir () << PREFIX << "-" << i << "-1.pcap"; - uint32_t sec(0), usec(0); - bool diff = PcapFile::Diff (os1.str(), os2.str(), sec, usec); - NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str() << " and " << os2.str() + uint32_t sec (0), usec (0); + bool diff = PcapFile::Diff (os1.str (), os2.str (), sec, usec); + NS_TEST_EXPECT_MSG_EQ (diff, false, "PCAP traces " << os1.str () << " and " << os2.str () << " differ starting from " << sec << " s " << usec << " us"); } } diff --git a/src/openflow/examples/openflow-switch.cc b/src/openflow/examples/openflow-switch.cc index 3d2fb5bc6..72d83c407 100644 --- a/src/openflow/examples/openflow-switch.cc +++ b/src/openflow/examples/openflow-switch.cc @@ -89,8 +89,8 @@ main (int argc, char *argv[]) cmd.AddValue ("verbose", "Verbose (turns on logging).", MakeCallback (&SetVerbose)); cmd.AddValue ("d", "Use Drop Controller (Learning if not specified).", MakeCallback (&SetDrop)); cmd.AddValue ("drop", "Use Drop Controller (Learning if not specified).", MakeCallback (&SetDrop)); - cmd.AddValue ("t", "Learning Controller Timeout (has no effect if drop controller is specified).", MakeCallback( &SetTimeout)); - cmd.AddValue ("timeout", "Learning Controller Timeout (has no effect if drop controller is specified).", MakeCallback( &SetTimeout)); + cmd.AddValue ("t", "Learning Controller Timeout (has no effect if drop controller is specified).", MakeCallback ( &SetTimeout)); + cmd.AddValue ("timeout", "Learning Controller Timeout (has no effect if drop controller is specified).", MakeCallback ( &SetTimeout)); cmd.Parse (argc, argv); diff --git a/src/openflow/model/openflow-interface.cc b/src/openflow/model/openflow-interface.cc index 1ef9601c4..1becf76bd 100644 --- a/src/openflow/model/openflow-interface.cc +++ b/src/openflow/model/openflow-interface.cc @@ -746,7 +746,7 @@ DropController::ReceiveFromSwitch (Ptr swtch, ofpbuf* b } // We have received any packet at this point, so we pull the header to figure out what type of packet we're handling. - uint8_t type = GetPacketType(buffer); + uint8_t type = GetPacketType (buffer); if (type == OFPT_PACKET_IN) // The switch didn't understand the packet it received, so it forwarded it to the controller. { @@ -766,7 +766,7 @@ DropController::ReceiveFromSwitch (Ptr swtch, ofpbuf* b TypeId LearningController::GetTypeId (void) { static TypeId tid = TypeId ("ns3::ofi::LearningController") - .SetParent (Controller::GetTypeId()) + .SetParent (Controller::GetTypeId ()) .AddConstructor () .AddAttribute ("ExpirationTime", "Time it takes for learned MAC state entry/created flow to expire.", @@ -787,7 +787,7 @@ LearningController::ReceiveFromSwitch (Ptr swtch, ofpbu } // We have received any packet at this point, so we pull the header to figure out what type of packet we're handling. - uint8_t type = GetPacketType(buffer); + uint8_t type = GetPacketType (buffer); if (type == OFPT_PACKET_IN) // The switch didn't understand the packet it received, so it forwarded it to the controller. { diff --git a/src/openflow/model/openflow-switch-net-device.cc b/src/openflow/model/openflow-switch-net-device.cc index 04b2e7625..d2d178161 100644 --- a/src/openflow/model/openflow-switch-net-device.cc +++ b/src/openflow/model/openflow-switch-net-device.cc @@ -647,7 +647,7 @@ OpenFlowSwitchNetDevice::ReceiveFromDevice (Ptr netdev, Ptr= Seconds (m_lastExecute.GetSeconds () + 1)) // If a second or more has passed from the simulation time, execute. { // If port status is modified in any way, notify the controller. diff --git a/src/point-to-point-layout/model/point-to-point-dumbbell.cc b/src/point-to-point-layout/model/point-to-point-dumbbell.cc index f19407067..7af216b46 100644 --- a/src/point-to-point-layout/model/point-to-point-dumbbell.cc +++ b/src/point-to-point-layout/model/point-to-point-dumbbell.cc @@ -30,7 +30,7 @@ #include "ns3/point-to-point-net-device.h" #include "ns3/vector.h" -NS_LOG_COMPONENT_DEFINE("PointToPointDumbbellHelper"); +NS_LOG_COMPONENT_DEFINE ("PointToPointDumbbellHelper"); namespace ns3 { @@ -54,7 +54,7 @@ PointToPointDumbbellHelper::PointToPointDumbbellHelper (uint32_t nLeftLeaf, NetDeviceContainer c = leftHelper.Install (m_routers.Get (0), m_leftLeaf.Get (i)); m_leftRouterDevices.Add (c.Get (0)); - m_leftLeafDevices.Add (c.Get(1)); + m_leftLeafDevices.Add (c.Get (1)); } // Add the right side links for (uint32_t i = 0; i < nRightLeaf; ++i) @@ -129,7 +129,7 @@ void PointToPointDumbbellHelper::AssignIpv4Addresses (Ipv4AddressHelper leftIp, NetDeviceContainer ndc; ndc.Add (m_leftLeafDevices.Get (i)); ndc.Add (m_leftRouterDevices.Get (i)); - Ipv4InterfaceContainer ifc = leftIp.Assign(ndc); + Ipv4InterfaceContainer ifc = leftIp.Assign (ndc); m_leftLeafInterfaces.Add (ifc.Get (0)); m_leftRouterInterfaces.Add (ifc.Get (1)); leftIp.NewNetwork (); diff --git a/src/point-to-point-layout/model/point-to-point-grid.cc b/src/point-to-point-layout/model/point-to-point-grid.cc index 321bd54c2..681a127ec 100644 --- a/src/point-to-point-layout/model/point-to-point-grid.cc +++ b/src/point-to-point-layout/model/point-to-point-grid.cc @@ -25,7 +25,7 @@ #include "ns3/vector.h" #include "ns3/log.h" -NS_LOG_COMPONENT_DEFINE("PointToPointGridHelper"); +NS_LOG_COMPONENT_DEFINE ("PointToPointGridHelper"); namespace ns3 { @@ -62,8 +62,8 @@ PointToPointGridHelper::PointToPointGridHelper (uint32_t nRows, // install vertical p2p links if (y > 0) { - colDevices.Add(pointToPoint. - Install ((m_nodes.at (y-1)).Get (x), rowNodes.Get (x))); + colDevices.Add (pointToPoint. + Install ((m_nodes.at (y-1)).Get (x), rowNodes.Get (x))); } } diff --git a/src/point-to-point-layout/model/point-to-point-star.cc b/src/point-to-point-layout/model/point-to-point-star.cc index 5d42f7103..0c2f1ade5 100644 --- a/src/point-to-point-layout/model/point-to-point-star.cc +++ b/src/point-to-point-layout/model/point-to-point-star.cc @@ -26,7 +26,7 @@ #include "ns3/point-to-point-net-device.h" #include "ns3/vector.h" -NS_LOG_COMPONENT_DEFINE("PointToPointStarHelper"); +NS_LOG_COMPONENT_DEFINE ("PointToPointStarHelper"); namespace ns3 { diff --git a/src/point-to-point/examples/main-attribute-value.cc b/src/point-to-point/examples/main-attribute-value.cc index 2fb0311ac..4d53fedab 100644 --- a/src/point-to-point/examples/main-attribute-value.cc +++ b/src/point-to-point/examples/main-attribute-value.cc @@ -68,7 +68,7 @@ main (int argc, char *argv[]) n0->AddDevice (net0); Ptr q = CreateObject (); - net0->SetQueue(q); + net0->SetQueue (q); // At this point, we have created a single node (Node 0) and a // single PointToPointNetDevice (NetDevice 0) and added a @@ -114,7 +114,7 @@ main (int argc, char *argv[]) NS_LOG_INFO ("2. txQueue limit: " << limit.Get () << " packets"); // Now, let's set it to another value (60 packets) - txQueue->SetAttribute("MaxPackets", UintegerValue (60)); + txQueue->SetAttribute ("MaxPackets", UintegerValue (60)); txQueue->GetAttribute ("MaxPackets", limit); NS_LOG_INFO ("3. txQueue limit changed: " << limit.Get () << " packets"); diff --git a/src/point-to-point/helper/point-to-point-helper.cc b/src/point-to-point/helper/point-to-point-helper.cc index 450648752..a4e1ac564 100644 --- a/src/point-to-point/helper/point-to-point-helper.cc +++ b/src/point-to-point/helper/point-to-point-helper.cc @@ -241,7 +241,7 @@ PointToPointHelper::Install (Ptr a, Ptr b) //use a normal p2p channel, otherwise use a remote channel bool useNormalChannel = true; Ptr channel = 0; - if (MpiInterface::IsEnabled()) + if (MpiInterface::IsEnabled ()) { uint32_t n1SystemId = a->GetSystemId (); uint32_t n2SystemId = b->GetSystemId (); diff --git a/src/point-to-point/model/point-to-point-channel.cc b/src/point-to-point/model/point-to-point-channel.cc index 38b6b62d4..d6a69386a 100644 --- a/src/point-to-point/model/point-to-point-channel.cc +++ b/src/point-to-point/model/point-to-point-channel.cc @@ -59,11 +59,11 @@ PointToPointChannel::PointToPointChannel() } void -PointToPointChannel::Attach(Ptr device) +PointToPointChannel::Attach (Ptr device) { NS_LOG_FUNCTION (this << device); - NS_ASSERT_MSG(m_nDevices < N_DEVICES, "Only two devices permitted"); - NS_ASSERT(device != 0); + NS_ASSERT_MSG (m_nDevices < N_DEVICES, "Only two devices permitted"); + NS_ASSERT (device != 0); m_link[m_nDevices++].m_src = device; // @@ -80,7 +80,7 @@ PointToPointChannel::Attach(Ptr device) } bool -PointToPointChannel::TransmitStart( +PointToPointChannel::TransmitStart ( Ptr p, Ptr src, Time txTime) @@ -88,8 +88,8 @@ PointToPointChannel::TransmitStart( NS_LOG_FUNCTION (this << p << src); NS_LOG_LOGIC ("UID is " << p->GetUid () << ")"); - NS_ASSERT(m_link[0].m_state != INITIALIZING); - NS_ASSERT(m_link[1].m_state != INITIALIZING); + NS_ASSERT (m_link[0].m_state != INITIALIZING); + NS_ASSERT (m_link[1].m_state != INITIALIZING); uint32_t wire = src == m_link[0].m_src ? 0 : 1; @@ -113,7 +113,7 @@ Ptr PointToPointChannel::GetPointToPointDevice (uint32_t i) const { NS_LOG_FUNCTION_NOARGS (); - NS_ASSERT(i < 2); + NS_ASSERT (i < 2); return m_link[i].m_src; } diff --git a/src/point-to-point/model/point-to-point-net-device.cc b/src/point-to-point/model/point-to-point-net-device.cc index 85719b5ec..ca81c53de 100644 --- a/src/point-to-point/model/point-to-point-net-device.cc +++ b/src/point-to-point/model/point-to-point-net-device.cc @@ -160,26 +160,26 @@ PointToPointNetDevice::~PointToPointNetDevice () } void -PointToPointNetDevice::AddHeader(Ptr p, uint16_t protocolNumber) +PointToPointNetDevice::AddHeader (Ptr p, uint16_t protocolNumber) { NS_LOG_FUNCTION_NOARGS (); PppHeader ppp; - ppp.SetProtocol(EtherToPpp(protocolNumber)); + ppp.SetProtocol (EtherToPpp (protocolNumber)); p->AddHeader (ppp); } bool -PointToPointNetDevice::ProcessHeader(Ptr p, uint16_t& param) +PointToPointNetDevice::ProcessHeader (Ptr p, uint16_t& param) { NS_LOG_FUNCTION_NOARGS (); PppHeader ppp; p->RemoveHeader (ppp); - param = PppToEther(ppp.GetProtocol()); + param = PppToEther (ppp.GetProtocol ()); return true; } void -PointToPointNetDevice::DoDispose() +PointToPointNetDevice::DoDispose () { NS_LOG_FUNCTION_NOARGS (); m_node = 0; @@ -190,14 +190,14 @@ PointToPointNetDevice::DoDispose() } void -PointToPointNetDevice::SetDataRate(DataRate bps) +PointToPointNetDevice::SetDataRate (DataRate bps) { NS_LOG_FUNCTION_NOARGS (); m_bps = bps; } void -PointToPointNetDevice::SetInterframeGap(Time t) +PointToPointNetDevice::SetInterframeGap (Time t) { NS_LOG_FUNCTION_NOARGS (); m_tInterframeGap = t; @@ -214,18 +214,18 @@ PointToPointNetDevice::TransmitStart (Ptr p) // We need to tell the channel that we've started wiggling the wire and // schedule an event that will be executed when the transmission is complete. // - NS_ASSERT_MSG(m_txMachineState == READY, "Must be READY to transmit"); + NS_ASSERT_MSG (m_txMachineState == READY, "Must be READY to transmit"); m_txMachineState = BUSY; m_currentPkt = p; m_phyTxBeginTrace (m_currentPkt); - Time txTime = Seconds (m_bps.CalculateTxTime(p->GetSize())); + Time txTime = Seconds (m_bps.CalculateTxTime (p->GetSize ())); Time txCompleteTime = txTime + m_tInterframeGap; NS_LOG_LOGIC ("Schedule TransmitCompleteEvent in " << txCompleteTime.GetSeconds () << "sec"); Simulator::Schedule (txCompleteTime, &PointToPointNetDevice::TransmitComplete, this); - bool result = m_channel->TransmitStart(p, this, txTime); + bool result = m_channel->TransmitStart (p, this, txTime); if (result == false) { m_phyTxDropTrace (p); @@ -244,7 +244,7 @@ PointToPointNetDevice::TransmitComplete (void) // is empty, we are done, otherwise we need to start transmitting the // next packet. // - NS_ASSERT_MSG(m_txMachineState == BUSY, "Must be BUSY if transmitting"); + NS_ASSERT_MSG (m_txMachineState == BUSY, "Must be BUSY if transmitting"); m_txMachineState = READY; NS_ASSERT_MSG (m_currentPkt != 0, "PointToPointNetDevice::TransmitComplete(): m_currentPkt zero"); @@ -266,7 +266,7 @@ PointToPointNetDevice::TransmitComplete (void) // m_snifferTrace (p); m_promiscSnifferTrace (p); - TransmitStart(p); + TransmitStart (p); } bool @@ -276,7 +276,7 @@ PointToPointNetDevice::Attach (Ptr ch) m_channel = ch; - m_channel->Attach(this); + m_channel->Attach (this); // // This device is up whenever it is attached to a channel. A better plan @@ -332,7 +332,7 @@ PointToPointNetDevice::Receive (Ptr packet) // there is no difference in what the promisc callback sees and what the // normal receive callback sees. // - ProcessHeader(packet, protocol); + ProcessHeader (packet, protocol); if (!m_promiscCallback.IsNull ()) { @@ -346,7 +346,7 @@ PointToPointNetDevice::Receive (Ptr packet) } Ptr -PointToPointNetDevice::GetQueue(void) const +PointToPointNetDevice::GetQueue (void) const { NS_LOG_FUNCTION_NOARGS (); return m_queue; @@ -360,13 +360,13 @@ PointToPointNetDevice::NotifyLinkUp (void) } void -PointToPointNetDevice::SetIfIndex(const uint32_t index) +PointToPointNetDevice::SetIfIndex (const uint32_t index) { m_ifIndex = index; } uint32_t -PointToPointNetDevice::GetIfIndex(void) const +PointToPointNetDevice::GetIfIndex (void) const { return m_ifIndex; } @@ -443,7 +443,7 @@ PointToPointNetDevice::GetMulticast (Ipv4Address multicastGroup) const Address PointToPointNetDevice::GetMulticast (Ipv6Address addr) const { - NS_LOG_FUNCTION(this << addr); + NS_LOG_FUNCTION (this << addr); return Mac48Address ("33:33:00:00:00:00"); } @@ -460,7 +460,7 @@ PointToPointNetDevice::IsBridge (void) const } bool -PointToPointNetDevice::Send( +PointToPointNetDevice::Send ( Ptr packet, const Address &dest, uint16_t protocolNumber) @@ -483,7 +483,7 @@ PointToPointNetDevice::Send( // Stick a point to point protocol header on the packet in preparation for // shoving it out the door. // - AddHeader(packet, protocolNumber); + AddHeader (packet, protocolNumber); m_macTxTrace (packet); @@ -513,7 +513,7 @@ PointToPointNetDevice::Send( } else { - return m_queue->Enqueue(packet); + return m_queue->Enqueue (packet); } } @@ -601,25 +601,25 @@ PointToPointNetDevice::GetMtu (void) const } uint16_t -PointToPointNetDevice::PppToEther(uint16_t proto) +PointToPointNetDevice::PppToEther (uint16_t proto) { switch(proto) { case 0x0021: return 0x0800; //IPv4 case 0x0057: return 0x86DD; //IPv6 - default: NS_ASSERT_MSG(false, "PPP Protocol number not defined!"); + default: NS_ASSERT_MSG (false, "PPP Protocol number not defined!"); } return 0; } uint16_t -PointToPointNetDevice::EtherToPpp(uint16_t proto) +PointToPointNetDevice::EtherToPpp (uint16_t proto) { switch(proto) { case 0x0800: return 0x0021; //IPv4 case 0x86DD: return 0x0057; //IPv6 - default: NS_ASSERT_MSG(false, "PPP Protocol number not defined!"); + default: NS_ASSERT_MSG (false, "PPP Protocol number not defined!"); } return 0; } diff --git a/src/point-to-point/model/point-to-point-net-device.h b/src/point-to-point/model/point-to-point-net-device.h index 669b7bc67..38f984c58 100644 --- a/src/point-to-point/model/point-to-point-net-device.h +++ b/src/point-to-point/model/point-to-point-net-device.h @@ -112,7 +112,7 @@ public: * * @returns Ptr to the queue. */ - Ptr GetQueue(void) const; + Ptr GetQueue (void) const; /** * Attach a receive ErrorModel to the PointToPointNetDevice. @@ -123,7 +123,7 @@ public: * @see ErrorModel * @param em Ptr to the ErrorModel. */ - void SetReceiveErrorModel(Ptr em); + void SetReceiveErrorModel (Ptr em); /** * Receive a packet from a connected PointToPointChannel. @@ -140,8 +140,8 @@ public: // The remaining methods are documented in ns3::NetDevice* - virtual void SetIfIndex(const uint32_t index); - virtual uint32_t GetIfIndex(void) const; + virtual void SetIfIndex (const uint32_t index); + virtual uint32_t GetIfIndex (void) const; virtual Ptr GetChannel (void) const; @@ -164,8 +164,8 @@ public: virtual bool IsPointToPoint (void) const; virtual bool IsBridge (void) const; - virtual bool Send(Ptr packet, const Address &dest, uint16_t protocolNumber); - virtual bool SendFrom(Ptr packet, const Address& source, const Address& dest, uint16_t protocolNumber); + virtual bool Send (Ptr packet, const Address &dest, uint16_t protocolNumber); + virtual bool SendFrom (Ptr packet, const Address& source, const Address& dest, uint16_t protocolNumber); virtual Ptr GetNode (void) const; virtual void SetNode (Ptr node); @@ -203,7 +203,7 @@ private: * \param p packet * \param protocolNumber protocol number */ - void AddHeader(Ptr p, uint16_t protocolNumber); + void AddHeader (Ptr p, uint16_t protocolNumber); /** * Removes, from a packet of data, all headers and trailers that @@ -213,7 +213,7 @@ private: * \return Returns true if the packet should be forwarded up the * protocol stack. */ - bool ProcessHeader(Ptr p, uint16_t& param); + bool ProcessHeader (Ptr p, uint16_t& param); /** * Start Sending a Packet Down the Wire. @@ -238,7 +238,7 @@ private: * The TransmitComplete method is used internally to finish the process * of sending a packet out on the channel. */ - void TransmitComplete(void); + void TransmitComplete (void); void NotifyLinkUp (void); @@ -450,14 +450,14 @@ private: * \param protocol A PPP protocol number * \return The corresponding Ethernet protocol number */ - static uint16_t PppToEther(uint16_t protocol); + static uint16_t PppToEther (uint16_t protocol); /** * \brief Ethernet to PPP protocol number mapping * \param protocol An Ethernet protocol number * \return The corresponding PPP protocol number */ - static uint16_t EtherToPpp(uint16_t protocol); + static uint16_t EtherToPpp (uint16_t protocol); }; } // namespace ns3 diff --git a/src/point-to-point/model/ppp-header.cc b/src/point-to-point/model/ppp-header.cc index c34abdacd..d1b506ccd 100644 --- a/src/point-to-point/model/ppp-header.cc +++ b/src/point-to-point/model/ppp-header.cc @@ -67,7 +67,7 @@ PppHeader::Print (std::ostream &os) const proto = "IPv6 (0x0057)"; break; default: - NS_ASSERT_MSG(false, "PPP Protocol number not defined!"); + NS_ASSERT_MSG (false, "PPP Protocol number not defined!"); } os << "Point-to-Point Protocol: " << proto; } @@ -88,7 +88,7 @@ uint32_t PppHeader::Deserialize (Buffer::Iterator start) { m_protocol = start.ReadNtohU16 (); - return GetSerializedSize(); + return GetSerializedSize (); } void diff --git a/src/point-to-point/model/ppp-header.h b/src/point-to-point/model/ppp-header.h index 1224b0fca..228518468 100644 --- a/src/point-to-point/model/ppp-header.h +++ b/src/point-to-point/model/ppp-header.h @@ -72,7 +72,7 @@ public: * * \param protocol the protocol type being carried */ - void SetProtocol(uint16_t protocol); + void SetProtocol (uint16_t protocol); /** * \brief Get the protocol type carried by this PPP packet @@ -81,7 +81,7 @@ public: * * \return the protocol type being carried */ - uint16_t GetProtocol(void); + uint16_t GetProtocol (void); private: diff --git a/src/propagation/examples/main-propagation-loss.cc b/src/propagation/examples/main-propagation-loss.cc index 05130978e..e7cac50d8 100644 --- a/src/propagation/examples/main-propagation-loss.cc +++ b/src/propagation/examples/main-propagation-loss.cc @@ -35,16 +35,16 @@ using namespace ns3; /// Round a double number to the given precision. e.g. dround(0.234, 0.1) = 0.2 /// and dround(0.257, 0.1) = 0.3 -static double dround(double number, double precision) +static double dround (double number, double precision) { number /= precision; if (number >= 0) { - number = floor(number + 0.5); + number = floor (number + 0.5); } else { - number = ceil(number - 0.5); + number = ceil (number - 0.5); } number *= precision; return number; @@ -58,15 +58,15 @@ TestDeterministic (Ptr model) Gnuplot plot; - plot.AppendExtra("set xlabel 'Distance'"); - plot.AppendExtra("set ylabel 'rxPower (dBm)'"); - plot.AppendExtra("set key top right"); + plot.AppendExtra ("set xlabel 'Distance'"); + plot.AppendExtra ("set ylabel 'rxPower (dBm)'"); + plot.AppendExtra ("set key top right"); double txPowerDbm = +20; // dBm Gnuplot2dDataset dataset; - dataset.SetStyle(Gnuplot2dDataset::LINES); + dataset.SetStyle (Gnuplot2dDataset::LINES); { a->SetPosition (Vector (0.0, 0.0, 0.0)); @@ -78,7 +78,7 @@ TestDeterministic (Ptr model) // CalcRxPower() returns dBm. double rxPowerDbm = model->CalcRxPower (txPowerDbm, a, b); - dataset.Add(distance, rxPowerDbm); + dataset.Add (distance, rxPowerDbm); Simulator::Stop (Seconds (1.0)); Simulator::Run (); @@ -87,11 +87,11 @@ TestDeterministic (Ptr model) std::ostringstream os; os << "txPower " << txPowerDbm << "dBm"; - dataset.SetTitle(os.str()); + dataset.SetTitle (os.str ()); - plot.AddDataset(dataset); + plot.AddDataset (dataset); - plot.AddDataset( Gnuplot2dFunction("-94 dBm CSThreshold", "-94.0") ); + plot.AddDataset ( Gnuplot2dFunction ("-94 dBm CSThreshold", "-94.0") ); return plot; } @@ -104,23 +104,23 @@ TestProbabilistic (Ptr model, unsigned int samples = 10000 Gnuplot plot; - plot.AppendExtra("set xlabel 'Distance'"); - plot.AppendExtra("set ylabel 'rxPower (dBm)'"); - plot.AppendExtra("set zlabel 'Probability' offset 0,+10"); - plot.AppendExtra("set view 50, 120, 1.0, 1.0"); - plot.AppendExtra("set key top right"); + plot.AppendExtra ("set xlabel 'Distance'"); + plot.AppendExtra ("set ylabel 'rxPower (dBm)'"); + plot.AppendExtra ("set zlabel 'Probability' offset 0,+10"); + plot.AppendExtra ("set view 50, 120, 1.0, 1.0"); + plot.AppendExtra ("set key top right"); - plot.AppendExtra("set ticslevel 0"); - plot.AppendExtra("set xtics offset -0.5,0"); - plot.AppendExtra("set ytics offset 0,-0.5"); - plot.AppendExtra("set xrange [100:]"); + plot.AppendExtra ("set ticslevel 0"); + plot.AppendExtra ("set xtics offset -0.5,0"); + plot.AppendExtra ("set ytics offset 0,-0.5"); + plot.AppendExtra ("set xrange [100:]"); double txPowerDbm = +20; // dBm Gnuplot3dDataset dataset; - dataset.SetStyle("with linespoints"); - dataset.SetExtra("pointtype 3 pointsize 0.5"); + dataset.SetStyle ("with linespoints"); + dataset.SetExtra ("pointtype 3 pointsize 0.5"); typedef std::map rxPowerMapType; @@ -139,7 +139,7 @@ TestProbabilistic (Ptr model, unsigned int samples = 10000 { // CalcRxPower() returns dBm. double rxPowerDbm = model->CalcRxPower (txPowerDbm, a, b); - rxPowerDbm = dround(rxPowerDbm, 1.0); + rxPowerDbm = dround (rxPowerDbm, 1.0); rxPowerMap[ rxPowerDbm ]++; @@ -147,28 +147,28 @@ TestProbabilistic (Ptr model, unsigned int samples = 10000 Simulator::Run (); } - for (rxPowerMapType::const_iterator i = rxPowerMap.begin(); - i != rxPowerMap.end(); ++i) + for (rxPowerMapType::const_iterator i = rxPowerMap.begin (); + i != rxPowerMap.end (); ++i) { - dataset.Add(distance, i->first, (double)i->second / (double)samples); + dataset.Add (distance, i->first, (double)i->second / (double)samples); } - dataset.AddEmptyLine(); + dataset.AddEmptyLine (); } } std::ostringstream os; os << "txPower " << txPowerDbm << "dBm"; - dataset.SetTitle(os.str()); + dataset.SetTitle (os.str ()); - plot.AddDataset(dataset); + plot.AddDataset (dataset); return plot; } static Gnuplot TestDeterministicByTime (Ptr model, - Time timeStep = Seconds(0.001), - Time timeTotal = Seconds(1.0), + Time timeStep = Seconds (0.001), + Time timeTotal = Seconds (1.0), double distance = 100.0) { Ptr a = CreateObject (); @@ -176,28 +176,28 @@ TestDeterministicByTime (Ptr model, Gnuplot plot; - plot.AppendExtra("set xlabel 'Time (s)'"); - plot.AppendExtra("set ylabel 'rxPower (dBm)'"); - plot.AppendExtra("set key center right"); + plot.AppendExtra ("set xlabel 'Time (s)'"); + plot.AppendExtra ("set ylabel 'rxPower (dBm)'"); + plot.AppendExtra ("set key center right"); double txPowerDbm = +20; // dBm Gnuplot2dDataset dataset; - dataset.SetStyle(Gnuplot2dDataset::LINES); + dataset.SetStyle (Gnuplot2dDataset::LINES); { a->SetPosition (Vector (0.0, 0.0, 0.0)); b->SetPosition (Vector (distance, 0.0, 0.0)); - Time start = Simulator::Now(); - while( Simulator::Now() < start + timeTotal ) + Time start = Simulator::Now (); + while( Simulator::Now () < start + timeTotal ) { // CalcRxPower() returns dBm. double rxPowerDbm = model->CalcRxPower (txPowerDbm, a, b); - Time elapsed = Simulator::Now() - start; - dataset.Add(elapsed.GetSeconds(), rxPowerDbm); + Time elapsed = Simulator::Now () - start; + dataset.Add (elapsed.GetSeconds (), rxPowerDbm); Simulator::Stop (timeStep); Simulator::Run (); @@ -206,107 +206,107 @@ TestDeterministicByTime (Ptr model, std::ostringstream os; os << "txPower " << txPowerDbm << "dBm"; - dataset.SetTitle(os.str()); + dataset.SetTitle (os.str ()); - plot.AddDataset(dataset); + plot.AddDataset (dataset); - plot.AddDataset( Gnuplot2dFunction("-94 dBm CSThreshold", "-94.0") ); + plot.AddDataset ( Gnuplot2dFunction ("-94 dBm CSThreshold", "-94.0") ); return plot; } int main (int argc, char *argv[]) { - GnuplotCollection gnuplots("main-propagation-loss.pdf"); + GnuplotCollection gnuplots ("main-propagation-loss.pdf"); { Ptr friis = CreateObject (); - Gnuplot plot = TestDeterministic(friis); - plot.SetTitle("ns3::FriisPropagationLossModel (Default Parameters)"); - gnuplots.AddPlot(plot); + Gnuplot plot = TestDeterministic (friis); + plot.SetTitle ("ns3::FriisPropagationLossModel (Default Parameters)"); + gnuplots.AddPlot (plot); } { Ptr log = CreateObject (); - log->SetAttribute("Exponent", DoubleValue (2.5)); + log->SetAttribute ("Exponent", DoubleValue (2.5)); - Gnuplot plot = TestDeterministic(log); - plot.SetTitle("ns3::LogDistancePropagationLossModel (Exponent = 2.5)"); - gnuplots.AddPlot(plot); + Gnuplot plot = TestDeterministic (log); + plot.SetTitle ("ns3::LogDistancePropagationLossModel (Exponent = 2.5)"); + gnuplots.AddPlot (plot); } { Ptr random = CreateObject (); - random->SetAttribute("Variable", RandomVariableValue(ExponentialVariable(50.0))); + random->SetAttribute ("Variable", RandomVariableValue (ExponentialVariable (50.0))); - Gnuplot plot = TestDeterministic(random); - plot.SetTitle("ns3::RandomPropagationLossModel with Exponential Distribution"); - gnuplots.AddPlot(plot); + Gnuplot plot = TestDeterministic (random); + plot.SetTitle ("ns3::RandomPropagationLossModel with Exponential Distribution"); + gnuplots.AddPlot (plot); } { Ptr jakes = CreateObject (); // doppler frequency shift for 5.15 GHz at 100 km/h - jakes->SetAttribute("DopplerFreq", DoubleValue(477.9)); + jakes->SetAttribute ("DopplerFreq", DoubleValue (477.9)); - Gnuplot plot = TestDeterministicByTime (jakes, Seconds(0.001), Seconds(1.0)); - plot.SetTitle("ns3::JakesPropagationLossModel (with 477.9 Hz shift and 1 millisec resolution)"); - gnuplots.AddPlot(plot); + Gnuplot plot = TestDeterministicByTime (jakes, Seconds (0.001), Seconds (1.0)); + plot.SetTitle ("ns3::JakesPropagationLossModel (with 477.9 Hz shift and 1 millisec resolution)"); + gnuplots.AddPlot (plot); } { Ptr jakes = CreateObject (); // doppler frequency shift for 5.15 GHz at 100 km/h - jakes->SetAttribute("DopplerFreq", DoubleValue(477.9)); + jakes->SetAttribute ("DopplerFreq", DoubleValue (477.9)); - Gnuplot plot = TestDeterministicByTime (jakes, Seconds(0.0001), Seconds(0.1)); - plot.SetTitle("ns3::JakesPropagationLossModel (with 477.9 Hz shift and 0.1 millisec resolution)"); - gnuplots.AddPlot(plot); + Gnuplot plot = TestDeterministicByTime (jakes, Seconds (0.0001), Seconds (0.1)); + plot.SetTitle ("ns3::JakesPropagationLossModel (with 477.9 Hz shift and 0.1 millisec resolution)"); + gnuplots.AddPlot (plot); } { Ptr log3 = CreateObject (); - Gnuplot plot = TestDeterministic(log3); - plot.SetTitle("ns3::ThreeLogDistancePropagationLossModel (Defaults)"); - gnuplots.AddPlot(plot); + Gnuplot plot = TestDeterministic (log3); + plot.SetTitle ("ns3::ThreeLogDistancePropagationLossModel (Defaults)"); + gnuplots.AddPlot (plot); } { Ptr log3 = CreateObject (); // more prominent example values: - log3->SetAttribute("Exponent0", DoubleValue(1.0)); - log3->SetAttribute("Exponent1", DoubleValue(3.0)); - log3->SetAttribute("Exponent2", DoubleValue(10.0)); + log3->SetAttribute ("Exponent0", DoubleValue (1.0)); + log3->SetAttribute ("Exponent1", DoubleValue (3.0)); + log3->SetAttribute ("Exponent2", DoubleValue (10.0)); - Gnuplot plot = TestDeterministic(log3); - plot.SetTitle("ns3::ThreeLogDistancePropagationLossModel (Exponents 1.0, 3.0 and 10.0)"); - gnuplots.AddPlot(plot); + Gnuplot plot = TestDeterministic (log3); + plot.SetTitle ("ns3::ThreeLogDistancePropagationLossModel (Exponents 1.0, 3.0 and 10.0)"); + gnuplots.AddPlot (plot); } { Ptr nak = CreateObject (); - Gnuplot plot = TestProbabilistic(nak); - plot.SetTitle("ns3::NakagamiPropagationLossModel (Default Parameters)"); - gnuplots.AddPlot(plot); + Gnuplot plot = TestProbabilistic (nak); + plot.SetTitle ("ns3::NakagamiPropagationLossModel (Default Parameters)"); + gnuplots.AddPlot (plot); } { Ptr log3 = CreateObject (); Ptr nak = CreateObject (); - log3->SetNext(nak); + log3->SetNext (nak); - Gnuplot plot = TestProbabilistic(log3); - plot.SetTitle("ns3::ThreeLogDistancePropagationLossModel and ns3::NakagamiPropagationLossModel (Default Parameters)"); - gnuplots.AddPlot(plot); + Gnuplot plot = TestProbabilistic (log3); + plot.SetTitle ("ns3::ThreeLogDistancePropagationLossModel and ns3::NakagamiPropagationLossModel (Default Parameters)"); + gnuplots.AddPlot (plot); } - gnuplots.GenerateOutput(std::cout); + gnuplots.GenerateOutput (std::cout); // produce clean valgrind Simulator::Destroy (); diff --git a/src/propagation/model/jakes-propagation-loss-model.cc b/src/propagation/model/jakes-propagation-loss-model.cc index 863df503e..881bb5764 100644 --- a/src/propagation/model/jakes-propagation-loss-model.cc +++ b/src/propagation/model/jakes-propagation-loss-model.cc @@ -114,7 +114,7 @@ JakesPropagationLossModel::PathCoefficients::GetLoss (Ptrm_amp[j].real * cos (m_phases[i][j]); fading.imag += jakes->m_amp[j].imag * cos (m_phases[i][j]); - norm += sqrt(pow (jakes->m_amp[j].real, 2) + pow(jakes->m_amp[j].imag, 2)); + norm += sqrt (pow (jakes->m_amp[j].real, 2) + pow (jakes->m_amp[j].imag, 2)); } coef.real += fading.real; coef.imag += fading.imag; @@ -198,13 +198,13 @@ JakesPropagationLossModel::SetNOscillators (uint8_t nOscillators) delete [] m_amp; uint16_t N = 4 * m_nOscillators + 2; m_amp = new ComplexNumber[m_nOscillators + 1]; - m_amp[0].real = 2.0 * sqrt(2.0 / N) * cos (PI / 4.0); - m_amp[0].imag = 2.0 * sqrt(2.0 / N) * sin (PI / 4.0); + m_amp[0].real = 2.0 * sqrt (2.0 / N) * cos (PI / 4.0); + m_amp[0].imag = 2.0 * sqrt (2.0 / N) * sin (PI / 4.0); for (uint8_t i = 1; i <= m_nOscillators; i++) { double beta = PI * (double)i / m_nOscillators; - m_amp[i].real = 4.0 * cos (beta) / sqrt(N); - m_amp[i].imag = 4.0 * sin (beta) / sqrt(N); + m_amp[i].real = 4.0 * cos (beta) / sqrt (N); + m_amp[i].imag = 4.0 * sin (beta) / sqrt (N); } } diff --git a/src/propagation/model/propagation-loss-model.cc b/src/propagation/model/propagation-loss-model.cc index 06f90b229..11e57797f 100644 --- a/src/propagation/model/propagation-loss-model.cc +++ b/src/propagation/model/propagation-loss-model.cc @@ -182,7 +182,7 @@ FriisPropagationLossModel::GetLambda (void) const double FriisPropagationLossModel::DbmToW (double dbm) const { - double mw = pow(10.0,dbm/10.0); + double mw = pow (10.0,dbm/10.0); return mw / 1000.0; } @@ -551,7 +551,7 @@ ThreeLogDistancePropagationLossModel::DoCalcRxPower (double txPowerDbm, Ptr b) const { double distance = a->GetDistanceFrom (b); - NS_ASSERT(distance >= 0); + NS_ASSERT (distance >= 0); // See doxygen comments for the formula and explanation @@ -564,20 +564,20 @@ ThreeLogDistancePropagationLossModel::DoCalcRxPower (double txPowerDbm, else if (distance < m_distance1) { pathLossDb = m_referenceLoss - + 10 * m_exponent0 * log10(distance / m_distance0); + + 10 * m_exponent0 * log10 (distance / m_distance0); } else if (distance < m_distance2) { pathLossDb = m_referenceLoss - + 10 * m_exponent0 * log10(m_distance1 / m_distance0) - + 10 * m_exponent1 * log10(distance / m_distance1); + + 10 * m_exponent0 * log10 (m_distance1 / m_distance0) + + 10 * m_exponent1 * log10 (distance / m_distance1); } else { pathLossDb = m_referenceLoss - + 10 * m_exponent0 * log10(m_distance1 / m_distance0) - + 10 * m_exponent1 * log10(m_distance2 / m_distance1) - + 10 * m_exponent2 * log10(distance / m_distance2); + + 10 * m_exponent0 * log10 (m_distance1 / m_distance0) + + 10 * m_exponent1 * log10 (m_distance2 / m_distance1) + + 10 * m_exponent2 * log10 (distance / m_distance2); } NS_LOG_DEBUG ("ThreeLogDistance distance=" << distance << "m, " << @@ -638,7 +638,7 @@ NakagamiPropagationLossModel::DoCalcRxPower (double txPowerDbm, // select m parameter double distance = a->GetDistanceFrom (b); - NS_ASSERT(distance >= 0); + NS_ASSERT (distance >= 0); double m; if (distance < m_distance1) @@ -656,24 +656,24 @@ NakagamiPropagationLossModel::DoCalcRxPower (double txPowerDbm, // the current power unit is dBm, but Watt is put into the Nakagami / // Rayleigh distribution. - double powerW = pow(10, (txPowerDbm - 30) / 10); + double powerW = pow (10, (txPowerDbm - 30) / 10); double resultPowerW; // switch between Erlang- and Gamma distributions: this is only for // speed. (Gamma is equal to Erlang for any positive integer m.) - unsigned int int_m = static_cast(floor(m)); + unsigned int int_m = static_cast(floor (m)); if (int_m == m) { - resultPowerW = m_erlangRandomVariable.GetValue(int_m, powerW / m); + resultPowerW = m_erlangRandomVariable.GetValue (int_m, powerW / m); } else { - resultPowerW = m_gammaRandomVariable.GetValue(m, powerW / m); + resultPowerW = m_gammaRandomVariable.GetValue (m, powerW / m); } - double resultPowerDbm = 10 * log10(resultPowerW) + 30; + double resultPowerDbm = 10 * log10 (resultPowerW) + 30; NS_LOG_DEBUG ("Nakagami distance=" << distance << "m, " << "power=" << powerW <<"W, " << @@ -760,7 +760,7 @@ MatrixPropagationLossModel::SetLoss (Ptr ma, Ptr m { NS_ASSERT (ma != 0 && mb != 0); - MobilityPair p = std::make_pair(ma, mb); + MobilityPair p = std::make_pair (ma, mb); std::map::iterator i = m_loss.find (p); if (i == m_loss.end ()) diff --git a/src/stats/model/basic-data-calculators.h b/src/stats/model/basic-data-calculators.h index 665557114..bf41da56d 100644 --- a/src/stats/model/basic-data-calculators.h +++ b/src/stats/model/basic-data-calculators.h @@ -40,21 +40,21 @@ public: MinMaxAvgTotalCalculator(); virtual ~MinMaxAvgTotalCalculator(); - void Update(const T i); + void Update (const T i); - virtual void Output(DataOutputCallback &callback) const; + virtual void Output (DataOutputCallback &callback) const; - long getCount() const { return m_count; } - double getSum() const { return m_total; } - double getMin() const { return m_min; } - double getMax() const { return m_max; } - double getMean() const { return m_total / (double)m_count; } - double getStddev() const { return NaN; } // unsupported - double getVariance() const { return NaN; } // unsupported - double getSqrSum() const { return NaN; } // unsupported + long getCount () const { return m_count; } + double getSum () const { return m_total; } + double getMin () const { return m_min; } + double getMax () const { return m_max; } + double getMean () const { return m_total / (double)m_count; } + double getStddev () const { return NaN; } // unsupported + double getVariance () const { return NaN; } // unsupported + double getSqrSum () const { return NaN; } // unsupported protected: - virtual void DoDispose(void); + virtual void DoDispose (void); uint32_t m_count; T m_total, m_min, m_max; @@ -78,15 +78,15 @@ MinMaxAvgTotalCalculator::~MinMaxAvgTotalCalculator() } template void -MinMaxAvgTotalCalculator::DoDispose(void) +MinMaxAvgTotalCalculator::DoDispose (void) { - DataCalculator::DoDispose(); + DataCalculator::DoDispose (); // MinMaxAvgTotalCalculator::DoDispose } template void -MinMaxAvgTotalCalculator::Update(const T i) +MinMaxAvgTotalCalculator::Update (const T i) { if (m_enabled) { m_total += i; @@ -104,9 +104,9 @@ MinMaxAvgTotalCalculator::Update(const T i) template void -MinMaxAvgTotalCalculator::Output(DataOutputCallback &callback) const +MinMaxAvgTotalCalculator::Output (DataOutputCallback &callback) const { - callback.OutputStatistic(m_context, m_key, this); + callback.OutputStatistic (m_context, m_key, this); } @@ -122,15 +122,15 @@ public: CounterCalculator(); virtual ~CounterCalculator(); - void Update(); - void Update(const T i); + void Update (); + void Update (const T i); - T GetCount() const; + T GetCount () const; - virtual void Output(DataOutputCallback &callback) const; + virtual void Output (DataOutputCallback &callback) const; protected: - virtual void DoDispose(void); + virtual void DoDispose (void); T m_count; @@ -141,7 +141,7 @@ protected: //-------------------------------------------- template CounterCalculator::CounterCalculator() : - m_count(0) + m_count (0) { } @@ -151,15 +151,15 @@ CounterCalculator::~CounterCalculator() } template void -CounterCalculator::DoDispose(void) +CounterCalculator::DoDispose (void) { - DataCalculator::DoDispose(); + DataCalculator::DoDispose (); // CounterCalculator::DoDispose } template void -CounterCalculator::Update() +CounterCalculator::Update () { if (m_enabled) { m_count++; @@ -169,7 +169,7 @@ CounterCalculator::Update() template void -CounterCalculator::Update(const T i) +CounterCalculator::Update (const T i) { if (m_enabled) { m_count += i; @@ -179,7 +179,7 @@ CounterCalculator::Update(const T i) template T -CounterCalculator::GetCount() const +CounterCalculator::GetCount () const { return m_count; // end CounterCalculator::GetCount @@ -187,9 +187,9 @@ CounterCalculator::GetCount() const template void -CounterCalculator::Output(DataOutputCallback &callback) const +CounterCalculator::Output (DataOutputCallback &callback) const { - callback.OutputSingleton(m_context, m_key, m_count); + callback.OutputSingleton (m_context, m_key, m_count); // end CounterCalculator::Output } diff --git a/src/stats/model/data-calculator.cc b/src/stats/model/data-calculator.cc index d473f92b9..cd8ceee8d 100644 --- a/src/stats/model/data-calculator.cc +++ b/src/stats/model/data-calculator.cc @@ -25,7 +25,7 @@ using namespace ns3; -NS_LOG_COMPONENT_DEFINE("DataCalculator"); +NS_LOG_COMPONENT_DEFINE ("DataCalculator"); static double zero = 0; const double ns3::NaN = zero / zero; @@ -33,38 +33,38 @@ const double ns3::NaN = zero / zero; //-------------------------------------------------------------- //---------------------------------------------- DataCalculator::DataCalculator() : - m_enabled(true) + m_enabled (true) { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); } DataCalculator::~DataCalculator() { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); } void -DataCalculator::DoDispose(void) +DataCalculator::DoDispose (void) { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); - Simulator::Cancel(m_startEvent); - Simulator::Cancel(m_stopEvent); + Simulator::Cancel (m_startEvent); + Simulator::Cancel (m_stopEvent); - Object::DoDispose(); + Object::DoDispose (); // DataCalculator::DoDispose } //---------------------------------------------- void -DataCalculator::SetKey(const std::string key) +DataCalculator::SetKey (const std::string key) { m_key = key; // end DataCalculator::SetKey } std::string -DataCalculator::GetKey() const +DataCalculator::GetKey () const { return m_key; // end DataCalculator::GetKey @@ -72,35 +72,35 @@ DataCalculator::GetKey() const //---------------------------------------------- void -DataCalculator::SetContext(const std::string context) +DataCalculator::SetContext (const std::string context) { m_context = context; // end DataCalculator::SetContext } std::string -DataCalculator::GetContext() const +DataCalculator::GetContext () const { return m_context; // end DataCalculator::GetContext } //---------------------------------------------- void -DataCalculator::Enable() +DataCalculator::Enable () { m_enabled = true; // end DataCalculator::Enable } void -DataCalculator::Disable() +DataCalculator::Disable () { m_enabled = false; // end DataCalculator::Disable } bool -DataCalculator::GetEnabled() const +DataCalculator::GetEnabled () const { return m_enabled; // end DataCalculator::GetEnabled @@ -108,19 +108,19 @@ DataCalculator::GetEnabled() const //---------------------------------------------- void -DataCalculator::Start(const Time& startTime) +DataCalculator::Start (const Time& startTime) { - m_startEvent = Simulator::Schedule(startTime, - &DataCalculator::Enable, this); + m_startEvent = Simulator::Schedule (startTime, + &DataCalculator::Enable, this); // end DataCalculator::Start } void -DataCalculator::Stop(const Time& stopTime) +DataCalculator::Stop (const Time& stopTime) { - m_stopEvent = Simulator::Schedule(stopTime, - &DataCalculator::Disable, this); + m_stopEvent = Simulator::Schedule (stopTime, + &DataCalculator::Disable, this); // end DataCalculator::Stop } diff --git a/src/stats/model/data-calculator.h b/src/stats/model/data-calculator.h index d064ee095..155d390cf 100644 --- a/src/stats/model/data-calculator.h +++ b/src/stats/model/data-calculator.h @@ -27,7 +27,7 @@ namespace ns3 { extern const double NaN; -inline bool isNaN(double x) { return x != x; } +inline bool isNaN (double x) { return x != x; } class DataOutputCallback; @@ -42,44 +42,44 @@ public: /** * Returns the number of the observations. */ - virtual long getCount() const = 0; + virtual long getCount () const = 0; /** * Returns the sum of the values. * @see getWeightedSum() */ - virtual double getSum() const = 0; + virtual double getSum () const = 0; /** * Returns the sum of the squared values. * @see getWeightedSqrSum() */ - virtual double getSqrSum() const = 0; + virtual double getSqrSum () const = 0; /** * Returns the minimum of the values. */ - virtual double getMin() const = 0; + virtual double getMin () const = 0; /** * Returns the maximum of the values. */ - virtual double getMax() const = 0; + virtual double getMax () const = 0; /** * Returns the mean of the (weighted) observations. */ - virtual double getMean() const = 0; + virtual double getMean () const = 0; /** * Returns the standard deviation of the (weighted) observations. */ - virtual double getStddev() const = 0; + virtual double getStddev () const = 0; /** * Returns the variance of the (weighted) observations. */ - virtual double getVariance() const = 0; + virtual double getVariance () const = 0; }; //------------------------------------------------------------ @@ -89,20 +89,20 @@ public: DataCalculator(); virtual ~DataCalculator(); - bool GetEnabled() const; - void Enable(); - void Disable(); + bool GetEnabled () const; + void Enable (); + void Disable (); - void SetKey(const std::string key); - std::string GetKey() const; + void SetKey (const std::string key); + std::string GetKey () const; - void SetContext(const std::string context); - std::string GetContext() const; + void SetContext (const std::string context); + std::string GetContext () const; - virtual void Start(const Time& startTime); - virtual void Stop(const Time& stopTime); + virtual void Start (const Time& startTime); + virtual void Stop (const Time& stopTime); - virtual void Output(DataOutputCallback &callback) const = 0; + virtual void Output (DataOutputCallback &callback) const = 0; protected: bool m_enabled; // Descendant classes *must* check & respect m_enabled! @@ -110,7 +110,7 @@ protected: std::string m_key; std::string m_context; - virtual void DoDispose(void); + virtual void DoDispose (void); private: EventId m_startEvent; diff --git a/src/stats/model/data-collector.cc b/src/stats/model/data-collector.cc index 7dd635db5..1825240b0 100644 --- a/src/stats/model/data-collector.cc +++ b/src/stats/model/data-collector.cc @@ -26,36 +26,36 @@ using namespace ns3; -NS_LOG_COMPONENT_DEFINE("DataCollector"); +NS_LOG_COMPONENT_DEFINE ("DataCollector"); //-------------------------------------------------------------- //---------------------------------------------- DataCollector::DataCollector() { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); // end DataCollector::DataCollector } DataCollector::~DataCollector() { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); // end DataCollector::~DataCollector } -void DataCollector::DoDispose() { - NS_LOG_FUNCTION_NOARGS(); +void DataCollector::DoDispose () { + NS_LOG_FUNCTION_NOARGS (); - m_calcList.clear(); - m_metadata.clear(); + m_calcList.clear (); + m_metadata.clear (); - Object::DoDispose(); + Object::DoDispose (); // end DataCollector::DoDispose } void -DataCollector::DescribeRun(std::string experiment, - std::string strategy, - std::string input, - std::string runID, - std::string description) +DataCollector::DescribeRun (std::string experiment, + std::string strategy, + std::string input, + std::string runID, + std::string description) { m_experimentLabel = experiment; @@ -68,64 +68,64 @@ DataCollector::DescribeRun(std::string experiment, } void -DataCollector::AddDataCalculator(Ptr datac) +DataCollector::AddDataCalculator (Ptr datac) { - m_calcList.push_back(datac); + m_calcList.push_back (datac); // end DataCollector::AddDataCalculator } DataCalculatorList::iterator -DataCollector::DataCalculatorBegin() +DataCollector::DataCalculatorBegin () { - return m_calcList.begin(); + return m_calcList.begin (); // end DataCollector::DataCalculatorBegin } DataCalculatorList::iterator -DataCollector::DataCalculatorEnd() +DataCollector::DataCalculatorEnd () { - return m_calcList.end(); + return m_calcList.end (); // end DataCollector::DataCalculatorEnd } void -DataCollector::AddMetadata(std::string key, std::string value) +DataCollector::AddMetadata (std::string key, std::string value) { - std::pair blob(key, value); - m_metadata.push_back(blob); + std::pair blob (key, value); + m_metadata.push_back (blob); // end DataCollector::AddMetadata } void -DataCollector::AddMetadata(std::string key, uint32_t value) +DataCollector::AddMetadata (std::string key, uint32_t value) { std::stringstream st; st << value; - std::pair blob(key, st.str()); - m_metadata.push_back(blob); + std::pair blob (key, st.str ()); + m_metadata.push_back (blob); // end DataCollector::AddMetadata } void -DataCollector::AddMetadata(std::string key, double value) +DataCollector::AddMetadata (std::string key, double value) { std::stringstream st; st << value; - std::pair blob(key, st.str()); - m_metadata.push_back(blob); + std::pair blob (key, st.str ()); + m_metadata.push_back (blob); // end DataCollector::AddMetadata } MetadataList::iterator -DataCollector::MetadataBegin() +DataCollector::MetadataBegin () { - return m_metadata.begin(); + return m_metadata.begin (); // end DataCollector::MetadataBegin } MetadataList::iterator -DataCollector::MetadataEnd() +DataCollector::MetadataEnd () { - return m_metadata.end(); + return m_metadata.end (); // end DataCollector::MetadataEnd } diff --git a/src/stats/model/data-collector.h b/src/stats/model/data-collector.h index 58640e28a..f53124300 100644 --- a/src/stats/model/data-collector.h +++ b/src/stats/model/data-collector.h @@ -48,30 +48,30 @@ public: DataCollector(); virtual ~DataCollector(); - void DescribeRun(std::string experiment, - std::string strategy, - std::string input, - std::string runID, - std::string description = ""); + void DescribeRun (std::string experiment, + std::string strategy, + std::string input, + std::string runID, + std::string description = ""); - std::string GetExperimentLabel() const { return m_experimentLabel; } - std::string GetStrategyLabel() const { return m_strategyLabel; } - std::string GetInputLabel() const { return m_inputLabel; } - std::string GetRunLabel() const { return m_runLabel; } - std::string GetDescription() const { return m_description; } + std::string GetExperimentLabel () const { return m_experimentLabel; } + std::string GetStrategyLabel () const { return m_strategyLabel; } + std::string GetInputLabel () const { return m_inputLabel; } + std::string GetRunLabel () const { return m_runLabel; } + std::string GetDescription () const { return m_description; } - void AddMetadata(std::string key, std::string value); - void AddMetadata(std::string key, double value); - void AddMetadata(std::string key, uint32_t value); - MetadataList::iterator MetadataBegin(); - MetadataList::iterator MetadataEnd(); + void AddMetadata (std::string key, std::string value); + void AddMetadata (std::string key, double value); + void AddMetadata (std::string key, uint32_t value); + MetadataList::iterator MetadataBegin (); + MetadataList::iterator MetadataEnd (); - void AddDataCalculator(Ptr datac); - DataCalculatorList::iterator DataCalculatorBegin(); - DataCalculatorList::iterator DataCalculatorEnd(); + void AddDataCalculator (Ptr datac); + DataCalculatorList::iterator DataCalculatorBegin (); + DataCalculatorList::iterator DataCalculatorEnd (); protected: - virtual void DoDispose(); + virtual void DoDispose (); private: std::string m_experimentLabel; diff --git a/src/stats/model/data-output-interface.cc b/src/stats/model/data-output-interface.cc index dd89ff55b..99f0b0451 100644 --- a/src/stats/model/data-output-interface.cc +++ b/src/stats/model/data-output-interface.cc @@ -24,36 +24,36 @@ using namespace ns3; -NS_LOG_COMPONENT_DEFINE("DataOutputInterface"); +NS_LOG_COMPONENT_DEFINE ("DataOutputInterface"); //-------------------------------------------------------------- //---------------------------------------------- DataOutputInterface::DataOutputInterface() { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); } DataOutputInterface::~DataOutputInterface() { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); } void -DataOutputInterface::DoDispose() +DataOutputInterface::DoDispose () { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); - Object::DoDispose(); + Object::DoDispose (); // end DataOutputInterface::DoDispose } void -DataOutputInterface::SetFilePrefix(const std::string prefix) +DataOutputInterface::SetFilePrefix (const std::string prefix) { m_filePrefix = prefix; } std::string -DataOutputInterface::GetFilePrefix() const +DataOutputInterface::GetFilePrefix () const { return m_filePrefix; } diff --git a/src/stats/model/data-output-interface.h b/src/stats/model/data-output-interface.h index 109e5c996..256fe6188 100644 --- a/src/stats/model/data-output-interface.h +++ b/src/stats/model/data-output-interface.h @@ -40,13 +40,13 @@ public: DataOutputInterface(); virtual ~DataOutputInterface(); - virtual void Output(DataCollector &dc) = 0; + virtual void Output (DataCollector &dc) = 0; - void SetFilePrefix(const std::string prefix); - std::string GetFilePrefix() const; + void SetFilePrefix (const std::string prefix); + std::string GetFilePrefix () const; protected: - virtual void DoDispose(); + virtual void DoDispose (); std::string m_filePrefix; @@ -61,29 +61,29 @@ class DataOutputCallback { public: virtual ~DataOutputCallback() {} - virtual void OutputStatistic(std::string key, - std::string variable, - const StatisticalSummary *statSum) = 0; + virtual void OutputStatistic (std::string key, + std::string variable, + const StatisticalSummary *statSum) = 0; - virtual void OutputSingleton(std::string key, - std::string variable, - int val) = 0; + virtual void OutputSingleton (std::string key, + std::string variable, + int val) = 0; - virtual void OutputSingleton(std::string key, - std::string variable, - uint32_t val) = 0; + virtual void OutputSingleton (std::string key, + std::string variable, + uint32_t val) = 0; - virtual void OutputSingleton(std::string key, - std::string variable, - double val) = 0; + virtual void OutputSingleton (std::string key, + std::string variable, + double val) = 0; - virtual void OutputSingleton(std::string key, - std::string variable, - std::string val) = 0; + virtual void OutputSingleton (std::string key, + std::string variable, + std::string val) = 0; - virtual void OutputSingleton(std::string key, - std::string variable, - Time val) = 0; + virtual void OutputSingleton (std::string key, + std::string variable, + Time val) = 0; // end class DataOutputCallback }; diff --git a/src/stats/model/omnet-data-output.cc b/src/stats/model/omnet-data-output.cc index 2a74d9e1a..e686624e7 100644 --- a/src/stats/model/omnet-data-output.cc +++ b/src/stats/model/omnet-data-output.cc @@ -30,7 +30,7 @@ using namespace ns3; -NS_LOG_COMPONENT_DEFINE("OmnetDataOutput"); +NS_LOG_COMPONENT_DEFINE ("OmnetDataOutput"); //-------------------------------------------------------------- @@ -39,24 +39,24 @@ OmnetDataOutput::OmnetDataOutput() { m_filePrefix = "data"; - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); } OmnetDataOutput::~OmnetDataOutput() { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); } void -OmnetDataOutput::DoDispose() +OmnetDataOutput::DoDispose () { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); - DataOutputInterface::DoDispose(); + DataOutputInterface::DoDispose (); // end OmnetDataOutput::DoDispose } //---------------------------------------------- -inline bool isNumeric(const std::string& s) { +inline bool isNumeric (const std::string& s) { bool decimalPtSeen = false; bool exponentSeen = false; char last = '\0'; @@ -83,53 +83,53 @@ inline bool isNumeric(const std::string& s) { } void -OmnetDataOutput::Output(DataCollector &dc) +OmnetDataOutput::Output (DataCollector &dc) { std::ofstream scalarFile; - std::string fn = m_filePrefix +"-"+dc.GetRunLabel()+ ".sca"; - scalarFile.open(fn.c_str(), std::ios_base::out); + std::string fn = m_filePrefix +"-"+dc.GetRunLabel ()+ ".sca"; + scalarFile.open (fn.c_str (), std::ios_base::out); // TODO add timestamp to the runlevel - scalarFile << "run " << dc.GetRunLabel() << std::endl; - scalarFile << "attr experiment \"" << dc.GetExperimentLabel() + scalarFile << "run " << dc.GetRunLabel () << std::endl; + scalarFile << "attr experiment \"" << dc.GetExperimentLabel () << "\"" << std::endl; - scalarFile << "attr strategy \"" << dc.GetStrategyLabel() + scalarFile << "attr strategy \"" << dc.GetStrategyLabel () << "\"" << std::endl; - scalarFile << "attr measurement \"" << dc.GetInputLabel() + scalarFile << "attr measurement \"" << dc.GetInputLabel () << "\"" << std::endl; - scalarFile << "attr description \"" << dc.GetDescription() + scalarFile << "attr description \"" << dc.GetDescription () << "\"" << std::endl; - for (MetadataList::iterator i = dc.MetadataBegin(); - i != dc.MetadataEnd(); i++) { + for (MetadataList::iterator i = dc.MetadataBegin (); + i != dc.MetadataEnd (); i++) { std::pair blob = (*i); scalarFile << "attr \"" << blob.first << "\" \"" << blob.second << "\"" << std::endl; } scalarFile << std::endl; - if (isNumeric(dc.GetInputLabel())) { - scalarFile << "scalar . measurement \"" << dc.GetInputLabel() + if (isNumeric (dc.GetInputLabel ())) { + scalarFile << "scalar . measurement \"" << dc.GetInputLabel () << "\"" << std::endl; } - for (MetadataList::iterator i = dc.MetadataBegin(); - i != dc.MetadataEnd(); i++) { + for (MetadataList::iterator i = dc.MetadataBegin (); + i != dc.MetadataEnd (); i++) { std::pair blob = (*i); - if (isNumeric(blob.second)) { + if (isNumeric (blob.second)) { scalarFile << "scalar . \"" << blob.first << "\" \"" << blob.second << "\"" << std::endl; } } - OmnetOutputCallback callback(&scalarFile); + OmnetOutputCallback callback (&scalarFile); - for (DataCalculatorList::iterator i = dc.DataCalculatorBegin(); - i != dc.DataCalculatorEnd(); i++) { - (*i)->Output(callback); + for (DataCalculatorList::iterator i = dc.DataCalculatorBegin (); + i != dc.DataCalculatorEnd (); i++) { + (*i)->Output (callback); } scalarFile << std::endl << std::endl; - scalarFile.close(); + scalarFile.close (); // end OmnetDataOutput::Output } @@ -137,40 +137,40 @@ OmnetDataOutput::Output(DataCollector &dc) OmnetDataOutput::OmnetOutputCallback::OmnetOutputCallback (std::ostream *scalar) : - m_scalar(scalar) + m_scalar (scalar) { } void -OmnetDataOutput::OmnetOutputCallback::OutputStatistic(std::string context, - std::string name, - const StatisticalSummary *statSum) +OmnetDataOutput::OmnetOutputCallback::OutputStatistic (std::string context, + std::string name, + const StatisticalSummary *statSum) { if (context == "") context = "."; if (name == "") name = "\"\""; (*m_scalar) << "statistic " << context << " " << name << std::endl; - if (!isNaN(statSum->getCount())) - (*m_scalar) << "field count " << statSum->getCount() << std::endl; - if (!isNaN(statSum->getSum())) - (*m_scalar) << "field sum " << statSum->getSum() << std::endl; - if (!isNaN(statSum->getMean())) - (*m_scalar) << "field mean " << statSum->getMean() << std::endl; - if (!isNaN(statSum->getMin())) - (*m_scalar) << "field min " << statSum->getMin() << std::endl; - if (!isNaN(statSum->getMax())) - (*m_scalar) << "field max " << statSum->getMax() << std::endl; - if (!isNaN(statSum->getSqrSum())) - (*m_scalar) << "field sqrsum " << statSum->getSqrSum() << std::endl; - if (!isNaN(statSum->getStddev())) - (*m_scalar) << "field stddev " << statSum->getStddev() << std::endl; + if (!isNaN (statSum->getCount ())) + (*m_scalar) << "field count " << statSum->getCount () << std::endl; + if (!isNaN (statSum->getSum ())) + (*m_scalar) << "field sum " << statSum->getSum () << std::endl; + if (!isNaN (statSum->getMean ())) + (*m_scalar) << "field mean " << statSum->getMean () << std::endl; + if (!isNaN (statSum->getMin ())) + (*m_scalar) << "field min " << statSum->getMin () << std::endl; + if (!isNaN (statSum->getMax ())) + (*m_scalar) << "field max " << statSum->getMax () << std::endl; + if (!isNaN (statSum->getSqrSum ())) + (*m_scalar) << "field sqrsum " << statSum->getSqrSum () << std::endl; + if (!isNaN (statSum->getStddev ())) + (*m_scalar) << "field stddev " << statSum->getStddev () << std::endl; } void -OmnetDataOutput::OmnetOutputCallback::OutputSingleton(std::string context, - std::string name, - int val) +OmnetDataOutput::OmnetOutputCallback::OutputSingleton (std::string context, + std::string name, + int val) { if (context == "") context = "."; @@ -181,9 +181,9 @@ OmnetDataOutput::OmnetOutputCallback::OutputSingleton(std::string context, } void -OmnetDataOutput::OmnetOutputCallback::OutputSingleton(std::string context, - std::string name, - uint32_t val) +OmnetDataOutput::OmnetOutputCallback::OutputSingleton (std::string context, + std::string name, + uint32_t val) { if (context == "") context = "."; @@ -194,9 +194,9 @@ OmnetDataOutput::OmnetOutputCallback::OutputSingleton(std::string context, } void -OmnetDataOutput::OmnetOutputCallback::OutputSingleton(std::string context, - std::string name, - double val) +OmnetDataOutput::OmnetOutputCallback::OutputSingleton (std::string context, + std::string name, + double val) { if (context == "") context = "."; @@ -207,9 +207,9 @@ OmnetDataOutput::OmnetOutputCallback::OutputSingleton(std::string context, } void -OmnetDataOutput::OmnetOutputCallback::OutputSingleton(std::string context, - std::string name, - std::string val) +OmnetDataOutput::OmnetOutputCallback::OutputSingleton (std::string context, + std::string name, + std::string val) { if (context == "") context = "."; @@ -220,14 +220,14 @@ OmnetDataOutput::OmnetOutputCallback::OutputSingleton(std::string context, } void -OmnetDataOutput::OmnetOutputCallback::OutputSingleton(std::string context, - std::string name, - Time val) +OmnetDataOutput::OmnetOutputCallback::OutputSingleton (std::string context, + std::string name, + Time val) { if (context == "") context = "."; if (name == "") name = "\"\""; - (*m_scalar) << "scalar " << context << " " << name << " " << val.GetTimeStep() << std::endl; + (*m_scalar) << "scalar " << context << " " << name << " " << val.GetTimeStep () << std::endl; // end OmnetDataOutput::OmnetOutputCallback::OutputSingleton } diff --git a/src/stats/model/omnet-data-output.h b/src/stats/model/omnet-data-output.h index d3f058b96..4cf2b4d8c 100644 --- a/src/stats/model/omnet-data-output.h +++ b/src/stats/model/omnet-data-output.h @@ -39,39 +39,39 @@ public: OmnetDataOutput(); virtual ~OmnetDataOutput(); - virtual void Output(DataCollector &dc); + virtual void Output (DataCollector &dc); protected: - virtual void DoDispose(); + virtual void DoDispose (); private: class OmnetOutputCallback : public DataOutputCallback { public: OmnetOutputCallback(std::ostream *scalar); - void OutputStatistic(std::string context, - std::string name, - const StatisticalSummary *statSum); + void OutputStatistic (std::string context, + std::string name, + const StatisticalSummary *statSum); - void OutputSingleton(std::string context, - std::string name, - int val); + void OutputSingleton (std::string context, + std::string name, + int val); - void OutputSingleton(std::string context, - std::string name, - uint32_t val); + void OutputSingleton (std::string context, + std::string name, + uint32_t val); - void OutputSingleton(std::string context, - std::string name, - double val); + void OutputSingleton (std::string context, + std::string name, + double val); - void OutputSingleton(std::string context, - std::string name, - std::string val); + void OutputSingleton (std::string context, + std::string name, + std::string val); - void OutputSingleton(std::string context, - std::string name, - Time val); + void OutputSingleton (std::string context, + std::string name, + Time val); private: std::ostream *m_scalar; diff --git a/src/stats/model/packet-data-calculators.cc b/src/stats/model/packet-data-calculators.cc index a13985e85..d30dbca52 100644 --- a/src/stats/model/packet-data-calculators.cc +++ b/src/stats/model/packet-data-calculators.cc @@ -27,47 +27,47 @@ using namespace ns3; -NS_LOG_COMPONENT_DEFINE("PacketDataCalculators"); +NS_LOG_COMPONENT_DEFINE ("PacketDataCalculators"); //-------------------------------------------------------------- //---------------------------------------------- PacketCounterCalculator::PacketCounterCalculator() { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); } PacketCounterCalculator::~PacketCounterCalculator() { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); } void -PacketCounterCalculator::DoDispose(void) +PacketCounterCalculator::DoDispose (void) { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); - CounterCalculator::DoDispose(); + CounterCalculator::DoDispose (); // PacketCounterCalculator::DoDispose } void -PacketCounterCalculator::PacketUpdate(std::string path, - Ptr packet) +PacketCounterCalculator::PacketUpdate (std::string path, + Ptr packet) { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); - CounterCalculator::Update(); + CounterCalculator::Update (); // PacketCounterCalculator::Update } void -PacketCounterCalculator::FrameUpdate(std::string path, - Ptr packet, - Mac48Address realto) +PacketCounterCalculator::FrameUpdate (std::string path, + Ptr packet, + Mac48Address realto) { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); - CounterCalculator::Update(); + CounterCalculator::Update (); // PacketCounterCalculator::Update } @@ -79,40 +79,40 @@ PacketCounterCalculator::FrameUpdate(std::string path, //---------------------------------------------- PacketSizeMinMaxAvgTotalCalculator::PacketSizeMinMaxAvgTotalCalculator() { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); } PacketSizeMinMaxAvgTotalCalculator::~PacketSizeMinMaxAvgTotalCalculator() { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); } void -PacketSizeMinMaxAvgTotalCalculator::DoDispose(void) +PacketSizeMinMaxAvgTotalCalculator::DoDispose (void) { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); - MinMaxAvgTotalCalculator::DoDispose(); + MinMaxAvgTotalCalculator::DoDispose (); // end PacketSizeMinMaxAvgTotalCalculator::DoDispose } void -PacketSizeMinMaxAvgTotalCalculator::PacketUpdate(std::string path, - Ptr packet) +PacketSizeMinMaxAvgTotalCalculator::PacketUpdate (std::string path, + Ptr packet) { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); - MinMaxAvgTotalCalculator::Update(packet->GetSize()); + MinMaxAvgTotalCalculator::Update (packet->GetSize ()); // end PacketSizeMinMaxAvgTotalCalculator::Update } void -PacketSizeMinMaxAvgTotalCalculator::FrameUpdate(std::string path, - Ptr packet, - Mac48Address realto) +PacketSizeMinMaxAvgTotalCalculator::FrameUpdate (std::string path, + Ptr packet, + Mac48Address realto) { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); - MinMaxAvgTotalCalculator::Update(packet->GetSize()); + MinMaxAvgTotalCalculator::Update (packet->GetSize ()); // end PacketSizeMinMaxAvgTotalCalculator::Update } diff --git a/src/stats/model/packet-data-calculators.h b/src/stats/model/packet-data-calculators.h index b877440b6..9874f0b6a 100644 --- a/src/stats/model/packet-data-calculators.h +++ b/src/stats/model/packet-data-calculators.h @@ -37,12 +37,12 @@ public: PacketCounterCalculator(); virtual ~PacketCounterCalculator(); - void PacketUpdate(std::string path, Ptr packet); - void FrameUpdate(std::string path, Ptr packet, - Mac48Address realto); + void PacketUpdate (std::string path, Ptr packet); + void FrameUpdate (std::string path, Ptr packet, + Mac48Address realto); protected: - virtual void DoDispose(void); + virtual void DoDispose (void); // end class PacketCounterCalculator }; @@ -58,12 +58,12 @@ public: PacketSizeMinMaxAvgTotalCalculator(); virtual ~PacketSizeMinMaxAvgTotalCalculator(); - void PacketUpdate(std::string path, Ptr packet); - void FrameUpdate(std::string path, Ptr packet, - Mac48Address realto); + void PacketUpdate (std::string path, Ptr packet); + void FrameUpdate (std::string path, Ptr packet, + Mac48Address realto); protected: - virtual void DoDispose(void); + virtual void DoDispose (void); // end class PacketSizeMinMaxAvgTotalCalculator }; diff --git a/src/stats/model/sqlite-data-output.cc b/src/stats/model/sqlite-data-output.cc index 26294dd52..b456319f5 100644 --- a/src/stats/model/sqlite-data-output.cc +++ b/src/stats/model/sqlite-data-output.cc @@ -31,44 +31,44 @@ using namespace ns3; -NS_LOG_COMPONENT_DEFINE("SqliteDataOutput"); +NS_LOG_COMPONENT_DEFINE ("SqliteDataOutput"); //-------------------------------------------------------------- //---------------------------------------------- SqliteDataOutput::SqliteDataOutput() { m_filePrefix = "data"; - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); } SqliteDataOutput::~SqliteDataOutput() { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); } void -SqliteDataOutput::DoDispose() +SqliteDataOutput::DoDispose () { - NS_LOG_FUNCTION_NOARGS(); + NS_LOG_FUNCTION_NOARGS (); - DataOutputInterface::DoDispose(); + DataOutputInterface::DoDispose (); // end SqliteDataOutput::DoDispose } int -SqliteDataOutput::Exec(std::string exe) { +SqliteDataOutput::Exec (std::string exe) { int res; char **result; int nrows, ncols; char *errMsg = 0; - NS_LOG_INFO("executing '" << exe << "'"); + NS_LOG_INFO ("executing '" << exe << "'"); - res = sqlite3_get_table(m_db, - exe.c_str(), - &result, &nrows, &ncols, - &errMsg); + res = sqlite3_get_table (m_db, + exe.c_str (), + &result, &nrows, &ncols, + &errMsg); if (res != SQLITE_OK) { - NS_LOG_ERROR("sqlite3 error: \"" << errMsg << "\""); + NS_LOG_ERROR ("sqlite3 error: \"" << errMsg << "\""); /* } else { // std::cout << "nrows " << nrows << " ncols " << ncols << std::endl; @@ -90,7 +90,7 @@ SqliteDataOutput::Exec(std::string exe) { */ } - sqlite3_free_table(result); + sqlite3_free_table (result); return res; // end SqliteDataOutput::Exec @@ -98,86 +98,86 @@ SqliteDataOutput::Exec(std::string exe) { //---------------------------------------------- void -SqliteDataOutput::Output(DataCollector &dc) +SqliteDataOutput::Output (DataCollector &dc) { std::string m_dbFile = m_filePrefix + ".db"; - if (sqlite3_open(m_dbFile.c_str(), &m_db)) { - NS_LOG_ERROR("Could not open sqlite3 database \"" << m_dbFile << "\""); - NS_LOG_ERROR("sqlite3 error \"" << sqlite3_errmsg(m_db) << "\""); - sqlite3_close(m_db); + if (sqlite3_open (m_dbFile.c_str (), &m_db)) { + NS_LOG_ERROR ("Could not open sqlite3 database \"" << m_dbFile << "\""); + NS_LOG_ERROR ("sqlite3 error \"" << sqlite3_errmsg (m_db) << "\""); + sqlite3_close (m_db); // TODO: Better error reporting, management! return; } - std::string run = dc.GetRunLabel(); + std::string run = dc.GetRunLabel (); - Exec("create table if not exists Experiments (run, experiment, strategy, input, description text)"); - Exec("insert into Experiments (run,experiment,strategy,input,description) values ('" + - run + "', '" + - dc.GetExperimentLabel() + "', '" + - dc.GetStrategyLabel() + "', '" + - dc.GetInputLabel() + "', '" + - dc.GetDescription() + "')"); + Exec ("create table if not exists Experiments (run, experiment, strategy, input, description text)"); + Exec ("insert into Experiments (run,experiment,strategy,input,description) values ('" + + run + "', '" + + dc.GetExperimentLabel () + "', '" + + dc.GetStrategyLabel () + "', '" + + dc.GetInputLabel () + "', '" + + dc.GetDescription () + "')"); - Exec("create table if not exists Metadata ( run text, key text, value)"); + Exec ("create table if not exists Metadata ( run text, key text, value)"); - for (MetadataList::iterator i = dc.MetadataBegin(); - i != dc.MetadataEnd(); i++) { + for (MetadataList::iterator i = dc.MetadataBegin (); + i != dc.MetadataEnd (); i++) { std::pair blob = (*i); - Exec("insert into Metadata (run,key,value) values ('" + - run + "', '" + - blob.first + "', '" + - blob.second + "')"); + Exec ("insert into Metadata (run,key,value) values ('" + + run + "', '" + + blob.first + "', '" + + blob.second + "')"); } - Exec("BEGIN"); - SqliteOutputCallback callback(this, run); - for (DataCalculatorList::iterator i = dc.DataCalculatorBegin(); - i != dc.DataCalculatorEnd(); i++) { - (*i)->Output(callback); + Exec ("BEGIN"); + SqliteOutputCallback callback (this, run); + for (DataCalculatorList::iterator i = dc.DataCalculatorBegin (); + i != dc.DataCalculatorEnd (); i++) { + (*i)->Output (callback); } - Exec("COMMIT"); + Exec ("COMMIT"); - sqlite3_close(m_db); + sqlite3_close (m_db); // end SqliteDataOutput::Output } SqliteDataOutput::SqliteOutputCallback::SqliteOutputCallback (Ptr owner, std::string run) : - m_owner(owner), - m_runLabel(run) + m_owner (owner), + m_runLabel (run) { - m_owner->Exec("create table if not exists Singletons ( run text, name text, variable text, value )"); + m_owner->Exec ("create table if not exists Singletons ( run text, name text, variable text, value )"); // end SqliteDataOutput::SqliteOutputCallback::SqliteOutputCallback } void -SqliteDataOutput::SqliteOutputCallback::OutputStatistic(std::string key, - std::string variable, - const StatisticalSummary *statSum) +SqliteDataOutput::SqliteOutputCallback::OutputStatistic (std::string key, + std::string variable, + const StatisticalSummary *statSum) { - OutputSingleton(key,variable+"-count", (double)statSum->getCount()); - if (!isNaN(statSum->getSum())) - OutputSingleton(key,variable+"-total", statSum->getSum()); - if (!isNaN(statSum->getMax())) - OutputSingleton(key,variable+"-max", statSum->getMax()); - if (!isNaN(statSum->getMin())) - OutputSingleton(key,variable+"-min", statSum->getMin()); - if (!isNaN(statSum->getSqrSum())) - OutputSingleton(key,variable+"-sqrsum", statSum->getSqrSum()); - if (!isNaN(statSum->getStddev())) - OutputSingleton(key,variable+"-stddev", statSum->getStddev()); + OutputSingleton (key,variable+"-count", (double)statSum->getCount ()); + if (!isNaN (statSum->getSum ())) + OutputSingleton (key,variable+"-total", statSum->getSum ()); + if (!isNaN (statSum->getMax ())) + OutputSingleton (key,variable+"-max", statSum->getMax ()); + if (!isNaN (statSum->getMin ())) + OutputSingleton (key,variable+"-min", statSum->getMin ()); + if (!isNaN (statSum->getSqrSum ())) + OutputSingleton (key,variable+"-sqrsum", statSum->getSqrSum ()); + if (!isNaN (statSum->getStddev ())) + OutputSingleton (key,variable+"-stddev", statSum->getStddev ()); } void -SqliteDataOutput::SqliteOutputCallback::OutputSingleton(std::string key, - std::string variable, - int val) +SqliteDataOutput::SqliteOutputCallback::OutputSingleton (std::string key, + std::string variable, + int val) { std::stringstream sstr; @@ -186,14 +186,14 @@ SqliteDataOutput::SqliteOutputCallback::OutputSingleton(std::string key, key << "', '" << variable << "', " << val << ")"; - m_owner->Exec(sstr.str()); + m_owner->Exec (sstr.str ()); // end SqliteDataOutput::SqliteOutputCallback::OutputSingleton } void -SqliteDataOutput::SqliteOutputCallback::OutputSingleton(std::string key, - std::string variable, - uint32_t val) +SqliteDataOutput::SqliteOutputCallback::OutputSingleton (std::string key, + std::string variable, + uint32_t val) { std::stringstream sstr; sstr << "insert into Singletons (run,name,variable,value) values ('" << @@ -201,13 +201,13 @@ SqliteDataOutput::SqliteOutputCallback::OutputSingleton(std::string key, key << "', '" << variable << "', " << val << ")"; - m_owner->Exec(sstr.str()); + m_owner->Exec (sstr.str ()); // end SqliteDataOutput::SqliteOutputCallback::OutputSingleton } void -SqliteDataOutput::SqliteOutputCallback::OutputSingleton(std::string key, - std::string variable, - double val) +SqliteDataOutput::SqliteOutputCallback::OutputSingleton (std::string key, + std::string variable, + double val) { std::stringstream sstr; sstr << "insert into Singletons (run,name,variable,value) values ('" << @@ -215,13 +215,13 @@ SqliteDataOutput::SqliteOutputCallback::OutputSingleton(std::string key, key << "', '" << variable << "', " << val << ")"; - m_owner->Exec(sstr.str()); + m_owner->Exec (sstr.str ()); // end SqliteDataOutput::SqliteOutputCallback::OutputSingleton } void -SqliteDataOutput::SqliteOutputCallback::OutputSingleton(std::string key, - std::string variable, - std::string val) +SqliteDataOutput::SqliteOutputCallback::OutputSingleton (std::string key, + std::string variable, + std::string val) { std::stringstream sstr; sstr << "insert into Singletons (run,name,variable,value) values ('" << @@ -229,20 +229,20 @@ SqliteDataOutput::SqliteOutputCallback::OutputSingleton(std::string key, key << "', '" << variable << "', '" << val << "')"; - m_owner->Exec(sstr.str()); + m_owner->Exec (sstr.str ()); // end SqliteDataOutput::SqliteOutputCallback::OutputSingleton } void -SqliteDataOutput::SqliteOutputCallback::OutputSingleton(std::string key, - std::string variable, - Time val) +SqliteDataOutput::SqliteOutputCallback::OutputSingleton (std::string key, + std::string variable, + Time val) { std::stringstream sstr; sstr << "insert into Singletons (run,name,variable,value) values ('" << m_runLabel << "', '" << key << "', '" << variable << "', " << - val.GetTimeStep() << ")"; - m_owner->Exec(sstr.str()); + val.GetTimeStep () << ")"; + m_owner->Exec (sstr.str ()); // end SqliteDataOutput::SqliteOutputCallback::OutputSingleton } diff --git a/src/stats/model/sqlite-data-output.h b/src/stats/model/sqlite-data-output.h index fb3274170..8aa106af3 100644 --- a/src/stats/model/sqlite-data-output.h +++ b/src/stats/model/sqlite-data-output.h @@ -42,39 +42,39 @@ public: SqliteDataOutput(); virtual ~SqliteDataOutput(); - virtual void Output(DataCollector &dc); + virtual void Output (DataCollector &dc); protected: - virtual void DoDispose(); + virtual void DoDispose (); private: class SqliteOutputCallback : public DataOutputCallback { public: SqliteOutputCallback(Ptr owner, std::string run); - void OutputStatistic(std::string key, - std::string variable, - const StatisticalSummary *statSum); + void OutputStatistic (std::string key, + std::string variable, + const StatisticalSummary *statSum); - void OutputSingleton(std::string key, - std::string variable, - int val); + void OutputSingleton (std::string key, + std::string variable, + int val); - void OutputSingleton(std::string key, - std::string variable, - uint32_t val); + void OutputSingleton (std::string key, + std::string variable, + uint32_t val); - void OutputSingleton(std::string key, - std::string variable, - double val); + void OutputSingleton (std::string key, + std::string variable, + double val); - void OutputSingleton(std::string key, - std::string variable, - std::string val); + void OutputSingleton (std::string key, + std::string variable, + std::string val); - void OutputSingleton(std::string key, - std::string variable, - Time val); + void OutputSingleton (std::string key, + std::string variable, + Time val); private: Ptr m_owner; @@ -85,7 +85,7 @@ private: sqlite3 *m_db; - int Exec(std::string exe); + int Exec (std::string exe); // end class SqliteDataOutput }; diff --git a/src/stats/model/time-data-calculators.cc b/src/stats/model/time-data-calculators.cc index eb09d175f..f0dcd4c0a 100644 --- a/src/stats/model/time-data-calculators.cc +++ b/src/stats/model/time-data-calculators.cc @@ -25,7 +25,7 @@ using namespace ns3; -NS_LOG_COMPONENT_DEFINE("TimeDataCalculators"); +NS_LOG_COMPONENT_DEFINE ("TimeDataCalculators"); //-------------------------------------------------------------- @@ -38,14 +38,14 @@ TimeMinMaxAvgTotalCalculator::~TimeMinMaxAvgTotalCalculator() { } void -TimeMinMaxAvgTotalCalculator::DoDispose(void) +TimeMinMaxAvgTotalCalculator::DoDispose (void) { - DataCalculator::DoDispose(); + DataCalculator::DoDispose (); // TimeMinMaxAvgTotalCalculator::DoDispose } void -TimeMinMaxAvgTotalCalculator::Update(const Time i) +TimeMinMaxAvgTotalCalculator::Update (const Time i) { if (m_enabled) { if (m_count) { @@ -68,14 +68,14 @@ TimeMinMaxAvgTotalCalculator::Update(const Time i) // end TimeMinMaxAvgTotalCalculator::Update } void -TimeMinMaxAvgTotalCalculator::Output(DataOutputCallback &callback) const +TimeMinMaxAvgTotalCalculator::Output (DataOutputCallback &callback) const { - callback.OutputSingleton(m_context, m_key + "-count", m_count); + callback.OutputSingleton (m_context, m_key + "-count", m_count); if (m_count > 0) { - callback.OutputSingleton(m_context, m_key + "-total", m_total); - callback.OutputSingleton(m_context, m_key + "-average", Time (m_total / m_count)); - callback.OutputSingleton(m_context, m_key + "-max", m_max); - callback.OutputSingleton(m_context, m_key + "-min", m_min); + callback.OutputSingleton (m_context, m_key + "-total", m_total); + callback.OutputSingleton (m_context, m_key + "-average", Time (m_total / m_count)); + callback.OutputSingleton (m_context, m_key + "-max", m_max); + callback.OutputSingleton (m_context, m_key + "-min", m_min); } // end TimeMinMaxAvgTotalCalculator::Output } diff --git a/src/stats/model/time-data-calculators.h b/src/stats/model/time-data-calculators.h index ddccf9d00..74f6de236 100644 --- a/src/stats/model/time-data-calculators.h +++ b/src/stats/model/time-data-calculators.h @@ -44,12 +44,12 @@ public: TimeMinMaxAvgTotalCalculator(); virtual ~TimeMinMaxAvgTotalCalculator(); - void Update(const Time i); + void Update (const Time i); - virtual void Output(DataOutputCallback &callback) const; + virtual void Output (DataOutputCallback &callback) const; protected: - virtual void DoDispose(void); + virtual void DoDispose (void); uint32_t m_count; Time m_total, m_min, m_max; diff --git a/src/tap-bridge/examples/tap-csma.cc b/src/tap-bridge/examples/tap-csma.cc index 111a137de..81b2fb14a 100644 --- a/src/tap-bridge/examples/tap-csma.cc +++ b/src/tap-bridge/examples/tap-csma.cc @@ -76,8 +76,8 @@ main (int argc, char *argv[]) std::string tapName = "thetap"; CommandLine cmd; - cmd.AddValue("mode", "Mode setting of TapBridge", mode); - cmd.AddValue("tapName", "Name of the OS tap device", tapName); + cmd.AddValue ("mode", "Mode setting of TapBridge", mode); + cmd.AddValue ("tapName", "Name of the OS tap device", tapName); cmd.Parse (argc, argv); GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl")); diff --git a/src/tap-bridge/examples/tap-wifi-dumbbell.cc b/src/tap-bridge/examples/tap-wifi-dumbbell.cc index 712e896e9..cda61c9b2 100644 --- a/src/tap-bridge/examples/tap-wifi-dumbbell.cc +++ b/src/tap-bridge/examples/tap-wifi-dumbbell.cc @@ -121,8 +121,8 @@ main (int argc, char *argv[]) std::string tapName = "thetap"; CommandLine cmd; - cmd.AddValue("mode", "Mode setting of TapBridge", mode); - cmd.AddValue("tapName", "Name of the OS tap device", tapName); + cmd.AddValue ("mode", "Mode setting of TapBridge", mode); + cmd.AddValue ("tapName", "Name of the OS tap device", tapName); cmd.Parse (argc, argv); GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl")); @@ -195,7 +195,7 @@ main (int argc, char *argv[]) p2p.SetDeviceAttribute ("DataRate", StringValue ("512kbps")); p2p.SetChannelAttribute ("Delay", StringValue ("10ms")); - NodeContainer nodes = NodeContainer (nodesLeft.Get(3), nodesRight.Get (0)); + NodeContainer nodes = NodeContainer (nodesLeft.Get (3), nodesRight.Get (0)); NetDeviceContainer devices = p2p.Install (nodes); Ipv4AddressHelper ipv4; diff --git a/src/tap-bridge/helper/tap-bridge-helper.cc b/src/tap-bridge/helper/tap-bridge-helper.cc index 9f2330768..3e27dde77 100644 --- a/src/tap-bridge/helper/tap-bridge-helper.cc +++ b/src/tap-bridge/helper/tap-bridge-helper.cc @@ -38,7 +38,7 @@ TapBridgeHelper::TapBridgeHelper (Ipv4Address gateway) NS_LOG_FUNCTION_NOARGS (); m_deviceFactory.SetTypeId ("ns3::TapBridge"); SetAttribute ("Gateway", Ipv4AddressValue (gateway)); - SetAttribute ("Mode", EnumValue(TapBridge::CONFIGURE_LOCAL)); + SetAttribute ("Mode", EnumValue (TapBridge::CONFIGURE_LOCAL)); } void diff --git a/src/tap-bridge/model/tap-bridge.cc b/src/tap-bridge/model/tap-bridge.cc index 041643ee4..4a0ea6326 100644 --- a/src/tap-bridge/model/tap-bridge.cc +++ b/src/tap-bridge/model/tap-bridge.cc @@ -366,7 +366,7 @@ TapBridge::CreateTap (void) // // Now encode that socket name (family and path) as a string of hex digits // - std::string path = TapBufferToString((uint8_t *)&un, len); + std::string path = TapBufferToString ((uint8_t *)&un, len); NS_LOG_INFO ("Encoded Unix socket as \"" << path << "\""); // @@ -599,7 +599,7 @@ TapBridge::CreateTap (void) // so we call it "control." // size_t msg_size = sizeof(int); - char control[CMSG_SPACE(msg_size)]; + char control[CMSG_SPACE (msg_size)]; // // There is a msghdr that is used to minimize the number of parameters @@ -633,7 +633,7 @@ TapBridge::CreateTap (void) // one we're interested in. // struct cmsghdr *cmsg; - for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) + for (cmsg = CMSG_FIRSTHDR (&msg); cmsg != NULL; cmsg = CMSG_NXTHDR (&msg, cmsg)) { if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) @@ -996,14 +996,14 @@ TapBridge::ReceiveFromBridgedDevice ( } void -TapBridge::SetIfIndex(const uint32_t index) +TapBridge::SetIfIndex (const uint32_t index) { NS_LOG_FUNCTION_NOARGS (); m_ifIndex = index; } uint32_t -TapBridge::GetIfIndex(void) const +TapBridge::GetIfIndex (void) const { NS_LOG_FUNCTION_NOARGS (); return m_ifIndex; diff --git a/src/tap-bridge/model/tap-bridge.h b/src/tap-bridge/model/tap-bridge.h index 1b8d227a5..2bfdc0198 100644 --- a/src/tap-bridge/model/tap-bridge.h +++ b/src/tap-bridge/model/tap-bridge.h @@ -184,8 +184,8 @@ public: // The following methods are inherited from NetDevice base class and are // documented there. // - virtual void SetIfIndex(const uint32_t index); - virtual uint32_t GetIfIndex(void) const; + virtual void SetIfIndex (const uint32_t index); + virtual uint32_t GetIfIndex (void) const; virtual Ptr GetChannel (void) const; virtual void SetAddress (Address address); virtual Address GetAddress (void) const; diff --git a/src/tap-bridge/model/tap-creator.cc b/src/tap-bridge/model/tap-creator.cc index 124326b93..fd5abe13c 100644 --- a/src/tap-bridge/model/tap-creator.cc +++ b/src/tap-bridge/model/tap-creator.cc @@ -58,7 +58,7 @@ static int gVerbose = 0; // Set to true to turn on logging messages. #define ABORT_IF(cond, msg, printErrno) \ if (cond) \ { \ - ABORT(msg, printErrno); \ + ABORT (msg, printErrno); \ } // @@ -213,7 +213,7 @@ SendSocket (const char *path, int fd) // so we call it "control." // size_t msg_size = sizeof(int); - char control[CMSG_SPACE(msg_size)]; + char control[CMSG_SPACE (msg_size)]; // // There is a msghdr that is used to minimize the number of parameters @@ -247,10 +247,10 @@ SendSocket (const char *path, int fd) // the whole package we're sending. // struct cmsghdr *cmsg; - cmsg = CMSG_FIRSTHDR(&msg); + cmsg = CMSG_FIRSTHDR (&msg); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; - cmsg->cmsg_len = CMSG_LEN(msg_size); + cmsg->cmsg_len = CMSG_LEN (msg_size); // // We also have to update the controllen in case other stuff is actually // in there we may not be aware of (due to macros). @@ -261,13 +261,13 @@ SendSocket (const char *path, int fd) // Finally, we get a pointer to the start of the ancillary data array and // put our file descriptor in. // - int *fdptr = (int*)(CMSG_DATA(cmsg)); + int *fdptr = (int*)(CMSG_DATA (cmsg)); *fdptr = fd; // // // Actually send the file descriptor back to the tap bridge. // - ssize_t len = sendmsg(sock, &msg, 0); + ssize_t len = sendmsg (sock, &msg, 0); ABORT_IF (len == -1, "Could not send socket back to tap bridge", 1); LOG ("sendmsg complete"); diff --git a/src/tap-bridge/model/tap-encode-decode.cc b/src/tap-bridge/model/tap-encode-decode.cc index 0f2529451..c5ff84f29 100644 --- a/src/tap-bridge/model/tap-encode-decode.cc +++ b/src/tap-bridge/model/tap-encode-decode.cc @@ -41,7 +41,7 @@ TapBufferToString (uint8_t *buffer, uint32_t len) // Tell the stream to make hex characters, zero-filled // oss.setf (std::ios::hex, std::ios::basefield); - oss.fill('0'); + oss.fill ('0'); // // Loop through the buffer, separating the two-digit-wide hex bytes diff --git a/src/template/test/sample-test-suite.cc b/src/template/test/sample-test-suite.cc index c10f2bf3f..45e1be737 100644 --- a/src/template/test/sample-test-suite.cc +++ b/src/template/test/sample-test-suite.cc @@ -7,7 +7,7 @@ // to use the using directive to access the ns3 namespace directly using namespace ns3; -// This is an example TestCase. +// This is an example TestCase. class SampleTestCase1 : public TestCase { public: diff --git a/src/test/csma-system-test-suite.cc b/src/test/csma-system-test-suite.cc index 450dc2567..11af617d4 100644 --- a/src/test/csma-system-test-suite.cc +++ b/src/test/csma-system-test-suite.cc @@ -223,8 +223,8 @@ CsmaBroadcastTestCase::DoRun (void) NodeContainer c1 = NodeContainer (c.Get (0), c.Get (2)); CsmaHelper csma; - csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate(5000000))); - csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds(2))); + csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000))); + csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); NetDeviceContainer n0 = csma.Install (c0); NetDeviceContainer n1 = csma.Install (c1); @@ -391,7 +391,7 @@ CsmaMulticastTestCase::DoRun (void) // 2) Set up a default multicast route on the sender n0 Ptr sender = c.Get (0); - Ptr senderIf = nd0.Get(0); + Ptr senderIf = nd0.Get (0); multicast.SetDefaultMulticastRoute (sender, senderIf); // @@ -416,12 +416,12 @@ CsmaMulticastTestCase::DoRun (void) // // Tell the application when to start and stop. // - srcC.Start(Seconds(1.)); - srcC.Stop (Seconds(10.)); + srcC.Start (Seconds (1.)); + srcC.Stop (Seconds (10.)); // Create an optional packet sink to receive these packets PacketSinkHelper sink ("ns3::UdpSocketFactory", - InetSocketAddress (Ipv4Address::GetAny(), multicastPort)); + InetSocketAddress (Ipv4Address::GetAny (), multicastPort)); ApplicationContainer sinkC = sink.Install (c1.Get (2)); // Node n4 // Start the sink @@ -550,7 +550,7 @@ CsmaOneSubnetTestCase::DoRun (void) onoff.SetAttribute ("Remote", AddressValue (InetSocketAddress (interfaces.GetAddress (0), port))); app = onoff.Install (nodes.Get (3)); - app.Start(Seconds (1.1)); + app.Start (Seconds (1.1)); app.Stop (Seconds (10.0)); app = sink.Install (nodes.Get (0)); @@ -630,8 +630,8 @@ CsmaPacketSocketTestCase::DoRun (void) // create the shared medium used by all csma devices. Ptr channel = CreateObjectWithAttributes ( - "DataRate", DataRateValue (DataRate(5000000)), - "Delay", TimeValue (MilliSeconds(2))); + "DataRate", DataRateValue (DataRate (5000000)), + "Delay", TimeValue (MilliSeconds (2))); // use a helper function to connect our nodes to the shared channel. CsmaHelper csma; @@ -643,7 +643,7 @@ CsmaPacketSocketTestCase::DoRun (void) // Make packets be sent about every DefaultPacketSize / DataRate = // 4096 bits / (5000 bits/second) = 0.82 second. PacketSocketAddress socket; - socket.SetSingleDevice(devs.Get (0)->GetIfIndex ()); + socket.SetSingleDevice (devs.Get (0)->GetIfIndex ()); socket.SetPhysicalAddress (devs.Get (1)->GetAddress ()); socket.SetProtocol (2); OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket)); diff --git a/src/test/error-model-test-suite.cc b/src/test/error-model-test-suite.cc index adeae95b9..e18921521 100644 --- a/src/test/error-model-test-suite.cc +++ b/src/test/error-model-test-suite.cc @@ -101,7 +101,7 @@ ErrorModelSimple::DoRun (void) output->TraceConnectWithoutContext ("PhyRxDrop", MakeCallback (&ErrorModelSimple::DropEvent, this)); // Send 10000 packets - Simulator::Schedule (Seconds (0), &SendPacket, 10000, input, output->GetAddress()); + Simulator::Schedule (Seconds (0), &SendPacket, 10000, input, output->GetAddress ()); Simulator::Run (); Simulator::Destroy (); diff --git a/src/test/global-routing-test-suite.cc b/src/test/global-routing-test-suite.cc index d7950cff1..f5c3ab742 100644 --- a/src/test/global-routing-test-suite.cc +++ b/src/test/global-routing-test-suite.cc @@ -95,7 +95,7 @@ DynamicGlobalRoutingTestCase::HandleRead (Ptr socket) Address from; while (packet = socket->RecvFrom (from)) { - if (packet->GetSize() == 0) + if (packet->GetSize () == 0) { //EOF break; } @@ -230,7 +230,7 @@ DynamicGlobalRoutingTestCase::DoRun (void) sink2->ShutdownSend (); sink2->SetRecvPktInfo (true); - sink2->SetRecvCallback (MakeCallback(&DynamicGlobalRoutingTestCase::HandleRead, this)); + sink2->SetRecvCallback (MakeCallback (&DynamicGlobalRoutingTestCase::HandleRead, this)); Ptr n1 = c.Get (1); Ptr ipv41 = n1->GetObject (); @@ -368,7 +368,7 @@ GlobalRoutingSlash32TestCase::DoRun (void) // 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))); diff --git a/src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc b/src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc index cbef76136..07f4dd6b9 100644 --- a/src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc +++ b/src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc @@ -254,7 +254,7 @@ Ns3TcpCwndTestCase1::DoRun (void) // implementation that we consider a known good TCP. // std::string nscStack = "liblinux2.6.26.so"; - stack.SetTcp ("ns3::NscTcpL4Protocol", "Library", StringValue("liblinux2.6.26.so")); + stack.SetTcp ("ns3::NscTcpL4Protocol", "Library", StringValue ("liblinux2.6.26.so")); stack.Install (nodes.Get (1)); // @@ -271,7 +271,7 @@ Ns3TcpCwndTestCase1::DoRun (void) // just create a sink. // uint16_t sinkPort = 8080; - Address sinkAddress (InetSocketAddress(interfaces.GetAddress (1), sinkPort)); + Address sinkAddress (InetSocketAddress (interfaces.GetAddress (1), sinkPort)); PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), sinkPort)); ApplicationContainer sinkApps = packetSinkHelper.Install (nodes.Get (1)); sinkApps.Start (Seconds (0.)); @@ -326,7 +326,7 @@ Ns3TcpCwndTestCase1::DoRun (void) pointToPoint.EnablePcapAll ("tcp-cwnd"); } - Simulator::Stop (Seconds(2)); + Simulator::Stop (Seconds (2)); Simulator::Run (); Simulator::Destroy (); @@ -436,11 +436,11 @@ Ns3TcpCwndTestCase2::DoRun (void) n2n3.Create (1); PointToPointHelper p2p1; - p2p1.SetDeviceAttribute ("DataRate", DataRateValue (DataRate(1000000))); - p2p1.SetChannelAttribute ("Delay", TimeValue (MilliSeconds(10))); + p2p1.SetDeviceAttribute ("DataRate", DataRateValue (DataRate (1000000))); + p2p1.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (10))); PointToPointHelper p2p2; - p2p2.SetDeviceAttribute ("DataRate", DataRateValue (DataRate(100000))); - p2p2.SetChannelAttribute ("Delay", TimeValue (MilliSeconds(10))); + p2p2.SetDeviceAttribute ("DataRate", DataRateValue (DataRate (100000))); + p2p2.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (10))); // And then install devices and channels connecting our topology. NetDeviceContainer dev0 = p2p1.Install (n0n1); @@ -475,7 +475,7 @@ Ns3TcpCwndTestCase2::DoRun (void) apps.Stop (Seconds (5.4)); // Create the socket for n0 - Address sinkAddress (InetSocketAddress(ipInterfs.GetAddress (1), servPort)); + Address sinkAddress (InetSocketAddress (ipInterfs.GetAddress (1), servPort)); Ptr ns3TcpSocket = Socket::CreateSocket (n0n1.Get (0), TcpSocketFactory::GetTypeId ()); ns3TcpSocket->TraceConnectWithoutContext ("CongestionWindow", MakeCallback (&Ns3TcpCwndTestCase2::CwndChange, this)); @@ -494,7 +494,7 @@ Ns3TcpCwndTestCase2::DoRun (void) } // Finally, set up the simulator to run. - Simulator::Stop (Seconds(5.4)); + Simulator::Stop (Seconds (5.4)); Simulator::Run (); Simulator::Destroy (); diff --git a/src/test/ns3tcp/ns3tcp-interop-test-suite.cc b/src/test/ns3tcp/ns3tcp-interop-test-suite.cc index 3d1c55232..a31516e8f 100644 --- a/src/test/ns3tcp/ns3tcp-interop-test-suite.cc +++ b/src/test/ns3tcp/ns3tcp-interop-test-suite.cc @@ -95,7 +95,7 @@ private: }; Ns3TcpInteroperabilityTestCase::Ns3TcpInteroperabilityTestCase () - : TestCase ("Check to see that the ns-3 TCP can work with liblinux2.6.26.so"), m_writeVectors(WRITE_VECTORS) + : TestCase ("Check to see that the ns-3 TCP can work with liblinux2.6.26.so"), m_writeVectors (WRITE_VECTORS) { } @@ -115,7 +115,7 @@ Ns3TcpInteroperabilityTestCase::DoSetup (void) if (m_writeVectors) { m_pcapFile.Open (m_pcapFilename, std::ios::out|std::ios::binary); - m_pcapFile.Init(PCAP_LINK_TYPE, PCAP_SNAPLEN); + m_pcapFile.Init (PCAP_LINK_TYPE, PCAP_SNAPLEN); } else { @@ -177,7 +177,7 @@ Ns3TcpInteroperabilityTestCase::Ipv4L3Tx (std::string context, Ptr uint8_t *actual = new uint8_t[readLen]; p->CopyData (actual, readLen); - uint32_t result = memcmp(actual, expected, readLen); + uint32_t result = memcmp (actual, expected, readLen); delete [] actual; @@ -230,7 +230,7 @@ Ns3TcpInteroperabilityTestCase::DoRun (void) // implementation that we consider a known good TCP. // std::string nscStack = "liblinux2.6.26.so"; - stack.SetTcp ("ns3::NscTcpL4Protocol", "Library", StringValue("liblinux2.6.26.so")); + stack.SetTcp ("ns3::NscTcpL4Protocol", "Library", StringValue ("liblinux2.6.26.so")); stack.Install (nodes.Get (1)); // @@ -246,7 +246,7 @@ Ns3TcpInteroperabilityTestCase::DoRun (void) // test, so just create a sink on node zero. // uint16_t sinkPort = 8080; - Address sinkAddress (InetSocketAddress(interfaces.GetAddress (0), sinkPort)); + Address sinkAddress (InetSocketAddress (interfaces.GetAddress (0), sinkPort)); PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), sinkPort)); ApplicationContainer sinkApps = packetSinkHelper.Install (nodes.Get (0)); sinkApps.Start (Seconds (0.)); @@ -259,7 +259,7 @@ Ns3TcpInteroperabilityTestCase::DoRun (void) // OnOffHelper onOffHelper ("ns3::TcpSocketFactory", sinkAddress); onOffHelper.SetAttribute ("MaxBytes", UintegerValue (100000)); - ApplicationContainer sourceApps = onOffHelper.Install(nodes.Get(1)); + ApplicationContainer sourceApps = onOffHelper.Install (nodes.Get (1)); sourceApps.Start (Seconds (1.)); sourceApps.Stop (Seconds (10.)); @@ -294,7 +294,7 @@ Ns3TcpInteroperabilityTestCase::DoRun (void) pointToPoint.EnablePcapAll ("tcp-interop"); } - Simulator::Stop (Seconds(20)); + Simulator::Stop (Seconds (20)); Simulator::Run (); Simulator::Destroy (); } diff --git a/src/test/ns3tcp/ns3tcp-loss-test-suite.cc b/src/test/ns3tcp/ns3tcp-loss-test-suite.cc index c2cf43741..d4a8ac6c7 100644 --- a/src/test/ns3tcp/ns3tcp-loss-test-suite.cc +++ b/src/test/ns3tcp/ns3tcp-loss-test-suite.cc @@ -126,7 +126,7 @@ Ns3TcpLossTestCase::DoSetup (void) if (m_writeVectors) { m_pcapFile.Open (m_pcapFilename, std::ios::out|std::ios::binary); - m_pcapFile.Init(PCAP_LINK_TYPE, PCAP_SNAPLEN); + m_pcapFile.Init (PCAP_LINK_TYPE, PCAP_SNAPLEN); } else { @@ -188,7 +188,7 @@ Ns3TcpLossTestCase::Ipv4L3Tx (std::string context, Ptr packet, Ptr uint8_t *actual = new uint8_t[readLen]; p->CopyData (actual, readLen); - uint32_t result = memcmp(actual, expected, readLen); + uint32_t result = memcmp (actual, expected, readLen); delete [] actual; diff --git a/src/test/ns3tcp/ns3tcp-socket-test-suite.cc b/src/test/ns3tcp/ns3tcp-socket-test-suite.cc index d983cb8e6..36d12f26a 100644 --- a/src/test/ns3tcp/ns3tcp-socket-test-suite.cc +++ b/src/test/ns3tcp/ns3tcp-socket-test-suite.cc @@ -118,18 +118,18 @@ Ns3TcpSocketTestCase1::DoRun (void) Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::PacketSink/Rx", MakeCallback (&Ns3TcpSocketTestCase1::SinkRx, this)); - Simulator::Schedule(Seconds (2), &SocketWriter::Connect, socketWriter); + Simulator::Schedule (Seconds (2), &SocketWriter::Connect, socketWriter); // Send 1, 10, 100, 1000 bytes - Simulator::Schedule(Seconds (10), &SocketWriter::Write, socketWriter, 1); + Simulator::Schedule (Seconds (10), &SocketWriter::Write, socketWriter, 1); m_inputs.Add (1); - Simulator::Schedule(Seconds (12), &SocketWriter::Write, socketWriter, 10); + Simulator::Schedule (Seconds (12), &SocketWriter::Write, socketWriter, 10); m_inputs.Add (10); - Simulator::Schedule(Seconds (14), &SocketWriter::Write, socketWriter, 100); + Simulator::Schedule (Seconds (14), &SocketWriter::Write, socketWriter, 100); m_inputs.Add (100); - Simulator::Schedule(Seconds (16), &SocketWriter::Write, socketWriter, 1000); + Simulator::Schedule (Seconds (16), &SocketWriter::Write, socketWriter, 1000); m_inputs.Add (536); m_inputs.Add (464); // ns-3 TCP default segment size of 536 - Simulator::Schedule(writerStopTimeObj, &SocketWriter::Close, socketWriter); + Simulator::Schedule (writerStopTimeObj, &SocketWriter::Close, socketWriter); if (m_writeResults) { @@ -227,22 +227,22 @@ Ns3TcpSocketTestCase2::DoRun (void) Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::PacketSink/Rx", MakeCallback (&Ns3TcpSocketTestCase2::SinkRx, this)); - Simulator::Schedule(Seconds (2), &SocketWriter::Connect, socketWriter); + Simulator::Schedule (Seconds (2), &SocketWriter::Connect, socketWriter); // Send 1, 10, 100, 1000 bytes // PointToPoint default MTU is 576 bytes, which leaves 536 bytes for TCP - Simulator::Schedule(Seconds (10), &SocketWriter::Write, socketWriter, 1); + Simulator::Schedule (Seconds (10), &SocketWriter::Write, socketWriter, 1); m_inputs.Add (1); - Simulator::Schedule(Seconds (12), &SocketWriter::Write, socketWriter, 10); + Simulator::Schedule (Seconds (12), &SocketWriter::Write, socketWriter, 10); m_inputs.Add (10); - Simulator::Schedule(Seconds (14), &SocketWriter::Write, socketWriter, 100); + Simulator::Schedule (Seconds (14), &SocketWriter::Write, socketWriter, 100); m_inputs.Add (100); - Simulator::Schedule(Seconds (16), &SocketWriter::Write, socketWriter, 1000); + Simulator::Schedule (Seconds (16), &SocketWriter::Write, socketWriter, 1000); m_inputs.Add (1000); // Next packet will fragment - Simulator::Schedule(Seconds (16), &SocketWriter::Write, socketWriter, 1001); + Simulator::Schedule (Seconds (16), &SocketWriter::Write, socketWriter, 1001); m_inputs.Add (1000); m_inputs.Add (1); - Simulator::Schedule(writerStopTimeObj, &SocketWriter::Close, socketWriter); + Simulator::Schedule (writerStopTimeObj, &SocketWriter::Close, socketWriter); if (m_writeResults) { diff --git a/src/test/ns3tcp/ns3tcp-state-test-suite.cc b/src/test/ns3tcp/ns3tcp-state-test-suite.cc index be3e8c200..5fd3d1bee 100644 --- a/src/test/ns3tcp/ns3tcp-state-test-suite.cc +++ b/src/test/ns3tcp/ns3tcp-state-test-suite.cc @@ -121,7 +121,7 @@ Ns3TcpStateTestCase::DoSetup (void) if (m_writeVectors) { m_pcapFile.Open (m_pcapFilename, std::ios::out|std::ios::binary); - m_pcapFile.Init(PCAP_LINK_TYPE, PCAP_SNAPLEN); + m_pcapFile.Init (PCAP_LINK_TYPE, PCAP_SNAPLEN); } else { @@ -183,7 +183,7 @@ Ns3TcpStateTestCase::Ipv4L3Tx (std::string context, Ptr packet, Pt uint8_t *actual = new uint8_t[readLen]; p->CopyData (actual, readLen); - uint32_t result = memcmp(actual, expected, readLen); + uint32_t result = memcmp (actual, expected, readLen); delete [] actual; @@ -378,7 +378,7 @@ Ns3TcpStateTestCase::DoRun (void) caseDescription = "Immediate FIN upon SYN_RCVD"; m_needToClose = false; dropListN0.push_back (1); // Hide the ACK in 3WHS - Simulator::Schedule (Seconds(0.002), &Socket::Close, localSocket); + Simulator::Schedule (Seconds (0.002), &Socket::Close, localSocket); break; case 6: m_totalTxBytes = 5000; @@ -390,7 +390,7 @@ Ns3TcpStateTestCase::DoRun (void) caseDescription = "FIN check 1: Loss of initiator's FIN. Wait until app close"; m_needToClose = false; dropListN0.push_back (7); // Hide the FIN from n0 - Simulator::Schedule (Seconds(0.04), &Socket::Close, localSocket); + Simulator::Schedule (Seconds (0.04), &Socket::Close, localSocket); break; case 8: m_totalTxBytes = 5000; diff --git a/src/test/ns3tcp/nsctcp-loss-test-suite.cc b/src/test/ns3tcp/nsctcp-loss-test-suite.cc index ed126e4f1..7b97f7c8c 100644 --- a/src/test/ns3tcp/nsctcp-loss-test-suite.cc +++ b/src/test/ns3tcp/nsctcp-loss-test-suite.cc @@ -97,7 +97,7 @@ NscTcpLossTestCase1::DoRun (void) devices = pointToPoint.Install (n0, n1); InternetStackHelper internet; - internet.SetTcp ("ns3::NscTcpL4Protocol", "Library", StringValue("liblinux2.6.26.so")); + internet.SetTcp ("ns3::NscTcpL4Protocol", "Library", StringValue ("liblinux2.6.26.so")); internet.InstallAll (); Ipv4AddressHelper address; @@ -121,10 +121,10 @@ NscTcpLossTestCase1::DoRun (void) Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::PacketSink/Rx", MakeCallback (&NscTcpLossTestCase1::SinkRx, this)); - Simulator::Schedule(Seconds (2), &SocketWriter::Connect, socketWriter); - Simulator::Schedule(Seconds (10), &SocketWriter::Write, socketWriter, 500); + Simulator::Schedule (Seconds (2), &SocketWriter::Connect, socketWriter); + Simulator::Schedule (Seconds (10), &SocketWriter::Write, socketWriter, 500); m_inputs.Add (500); - Simulator::Schedule(writerStopTimeObj, &SocketWriter::Close, socketWriter); + Simulator::Schedule (writerStopTimeObj, &SocketWriter::Close, socketWriter); std::list sampleList; // Lose first two SYNs @@ -205,7 +205,7 @@ NscTcpLossTestCase2::DoRun (void) devices = pointToPoint.Install (n0, n1); InternetStackHelper internet; - internet.SetTcp ("ns3::NscTcpL4Protocol", "Library", StringValue("liblinux2.6.26.so")); + internet.SetTcp ("ns3::NscTcpL4Protocol", "Library", StringValue ("liblinux2.6.26.so")); internet.InstallAll (); Ipv4AddressHelper address; @@ -229,10 +229,10 @@ NscTcpLossTestCase2::DoRun (void) Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::PacketSink/Rx", MakeCallback (&NscTcpLossTestCase2::SinkRx, this)); - Simulator::Schedule(Seconds (2), &SocketWriter::Connect, socketWriter); - Simulator::Schedule(Seconds (10), &SocketWriter::Write, socketWriter, 500); + Simulator::Schedule (Seconds (2), &SocketWriter::Connect, socketWriter); + Simulator::Schedule (Seconds (10), &SocketWriter::Write, socketWriter, 500); m_inputs.Add (500); - Simulator::Schedule(writerStopTimeObj, &SocketWriter::Close, socketWriter); + Simulator::Schedule (writerStopTimeObj, &SocketWriter::Close, socketWriter); std::list sampleList; // Lose first data segment diff --git a/src/test/ns3wifi/wifi-interference-test-suite.cc b/src/test/ns3wifi/wifi-interference-test-suite.cc index a2f3fd654..33de052a0 100644 --- a/src/test/ns3wifi/wifi-interference-test-suite.cc +++ b/src/test/ns3wifi/wifi-interference-test-suite.cc @@ -163,8 +163,8 @@ WifiInterferenceTestCase::WifiSimpleInterference (std::string phyMode,double Prs // Add a non-QoS upper mac, and disable rate control NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", - "DataMode",StringValue(phyMode), - "ControlMode",StringValue(phyMode)); + "DataMode",StringValue (phyMode), + "ControlMode",StringValue (phyMode)); // Set it to adhoc mode wifiMac.SetType ("ns3::AdhocWifiMac"); NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c.Get (0)); @@ -197,7 +197,7 @@ WifiInterferenceTestCase::WifiSimpleInterference (std::string phyMode,double Prs TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory"); Ptr recvSink = Socket::CreateSocket (c.Get (0), tid); - InetSocketAddress local = InetSocketAddress (Ipv4Address("10.1.1.1"), 80); + InetSocketAddress local = InetSocketAddress (Ipv4Address ("10.1.1.1"), 80); recvSink->Bind (local); recvSink->SetRecvCallback (MakeCallback (&WifiInterferenceTestCase::ReceivePacket, this)); diff --git a/src/test/ns3wifi/wifi-msdu-aggregator-test-suite.cc b/src/test/ns3wifi/wifi-msdu-aggregator-test-suite.cc index 705bda6c5..0f1002693 100644 --- a/src/test/ns3wifi/wifi-msdu-aggregator-test-suite.cc +++ b/src/test/ns3wifi/wifi-msdu-aggregator-test-suite.cc @@ -134,8 +134,8 @@ WifiMsduAggregatorThroughputTest::DoRun (void) // and then off at 9 seconds, so we turn the sink off at 9 seconds // too in order to measure throughput in a fixed window. PacketSinkHelper packetSink ("ns3::UdpSocketFactory", - InetSocketAddress(Ipv4Address::GetAny(), - udpPort)); + InetSocketAddress (Ipv4Address::GetAny (), + udpPort)); ApplicationContainer sinkApp = packetSink.Install (sta.Get (0)); sinkApp.Start (Seconds (0)); sinkApp.Stop (Seconds (9.0)); @@ -149,8 +149,8 @@ WifiMsduAggregatorThroughputTest::DoRun (void) OnOffHelper onoff ("ns3::UdpSocketFactory", InetSocketAddress (staNodeInterface.GetAddress (0), udpPort)); - onoff.SetAttribute ("DataRate", DataRateValue(DataRate("1Mbps"))); - onoff.SetAttribute ("PacketSize", UintegerValue(100)); + onoff.SetAttribute ("DataRate", DataRateValue (DataRate ("1Mbps"))); + onoff.SetAttribute ("PacketSize", UintegerValue (100)); onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); ApplicationContainer sourceApp = onoff.Install (ap.Get (0)); @@ -185,9 +185,9 @@ WifiMsduAggregatorThroughputTest::DoRun (void) // // If aggregation is turned off, then we get about 350 kilobytes in // the same test, so we'll definitely catch the major failures. - NS_TEST_ASSERT_MSG_GT(totalOctetsThrough, 600000, - "A-MSDU test fails for low throughput of " - << totalOctetsThrough << " octets"); + NS_TEST_ASSERT_MSG_GT (totalOctetsThrough, 600000, + "A-MSDU test fails for low throughput of " + << totalOctetsThrough << " octets"); } diff --git a/src/tools/model/average.h b/src/tools/model/average.h index 6b617ab47..4c20a5f21 100644 --- a/src/tools/model/average.h +++ b/src/tools/model/average.h @@ -82,7 +82,7 @@ public: /// Estimate of mean, alias to Avg double Mean () const { return Avg (); } /// Unbiased estimate of variance - double Var () const { return Count() / (double)(Count() - 1) * (m_avg2 - m_avg*m_avg); } + double Var () const { return Count () / (double)(Count () - 1) * (m_avg2 - m_avg*m_avg); } /// Standard deviation double Stddev () const { return sqrt (Var ()); } //\} @@ -97,11 +97,11 @@ public: */ //\{ /// Margin of error of the mean for 90% confidence level - double Error90() const { return 1.645 * sqrt (Var () / Count ()); } + double Error90 () const { return 1.645 * sqrt (Var () / Count ()); } /// Margin of error of the mean for 95% confidence level - double Error95() const { return 1.960 * sqrt (Var () / Count ()); } + double Error95 () const { return 1.960 * sqrt (Var () / Count ()); } /// Margin of error of the mean for 99% confidence level - double Error99() const { return 2.576 * sqrt (Var () / Count ()); } + double Error99 () const { return 2.576 * sqrt (Var () / Count ()); } //\} private: diff --git a/src/tools/model/gnuplot.cc b/src/tools/model/gnuplot.cc index 4c7c9880b..b0b8c50fa 100644 --- a/src/tools/model/gnuplot.cc +++ b/src/tools/model/gnuplot.cc @@ -47,26 +47,26 @@ struct GnuplotDataset::Data /** * Returns "plot" or "splot". */ - virtual std::string GetCommand() const = 0; + virtual std::string GetCommand () const = 0; /** * Prints the plot description used as argument to (s)plot. Either the * function expression or a datafile description. Should include m_title and * m_extra in the output. */ - virtual void PrintExpression(std::ostream &os) const = 0; + virtual void PrintExpression (std::ostream &os) const = 0; /** * Print the inline data file contents trailing the plot command. Empty for * functions. */ - virtual void PrintDatafile(std::ostream &os) const = 0; + virtual void PrintDatafile (std::ostream &os) const = 0; }; GnuplotDataset::Data::Data(const std::string& title) - : m_references(1), - m_title(title), - m_extra(m_defaultExtra) + : m_references (1), + m_title (title), + m_extra (m_defaultExtra) { } @@ -79,12 +79,12 @@ GnuplotDataset::Data::~Data() std::string GnuplotDataset::m_defaultExtra = ""; GnuplotDataset::GnuplotDataset (struct Data* data) - : m_data(data) + : m_data (data) { } GnuplotDataset::GnuplotDataset (const GnuplotDataset& original) - : m_data(original.m_data) + : m_data (original.m_data) { ++m_data->m_references; } @@ -141,30 +141,30 @@ struct Gnuplot2dDataset::Data2d : public GnuplotDataset::Data */ Data2d(const std::string& title); - virtual std::string GetCommand() const; - virtual void PrintExpression(std::ostream &os) const; - virtual void PrintDatafile(std::ostream &os) const; + virtual std::string GetCommand () const; + virtual void PrintExpression (std::ostream &os) const; + virtual void PrintDatafile (std::ostream &os) const; }; Gnuplot2dDataset::Data2d::Data2d(const std::string& title) - : Data(title), - m_style(m_defaultStyle), - m_errorBars(m_defaultErrorBars) + : Data (title), + m_style (m_defaultStyle), + m_errorBars (m_defaultErrorBars) { } std::string -Gnuplot2dDataset::Data2d::GetCommand() const +Gnuplot2dDataset::Data2d::GetCommand () const { return "plot"; } void -Gnuplot2dDataset::Data2d::PrintExpression(std::ostream &os) const +Gnuplot2dDataset::Data2d::PrintExpression (std::ostream &os) const { os << "'-' "; - if (m_title.size()) + if (m_title.size ()) os << " title '" << m_title << "'"; switch (m_style) { @@ -222,12 +222,12 @@ Gnuplot2dDataset::Data2d::PrintExpression(std::ostream &os) const break; } - if (m_extra.size()) + if (m_extra.size ()) os << " " << m_extra; } void -Gnuplot2dDataset::Data2d::PrintDatafile(std::ostream &os) const +Gnuplot2dDataset::Data2d::PrintDatafile (std::ostream &os) const { for (PointSet::const_iterator i = m_pointset.begin (); i != m_pointset.end (); ++i) @@ -261,7 +261,7 @@ enum Gnuplot2dDataset::Style Gnuplot2dDataset::m_defaultStyle = LINES; enum Gnuplot2dDataset::ErrorBars Gnuplot2dDataset::m_defaultErrorBars = NONE; Gnuplot2dDataset::Gnuplot2dDataset (const std::string& title) - : GnuplotDataset( new Data2d(title) ) + : GnuplotDataset ( new Data2d (title) ) { } @@ -332,7 +332,7 @@ Gnuplot2dDataset::Add (double x, double y, double minY, double maxY) } void -Gnuplot2dDataset::AddEmptyLine() +Gnuplot2dDataset::AddEmptyLine () { struct Point data; data.empty = true; @@ -352,44 +352,44 @@ struct Gnuplot2dFunction::Function2d : public GnuplotDataset::Data */ Function2d(const std::string& title, const std::string& function); - virtual std::string GetCommand() const; - virtual void PrintExpression(std::ostream &os) const; - virtual void PrintDatafile(std::ostream &os) const; + virtual std::string GetCommand () const; + virtual void PrintExpression (std::ostream &os) const; + virtual void PrintDatafile (std::ostream &os) const; }; Gnuplot2dFunction::Function2d::Function2d(const std::string& title, const std::string& function) - : Data(title), - m_function(function) + : Data (title), + m_function (function) { } std::string -Gnuplot2dFunction::Function2d::GetCommand() const +Gnuplot2dFunction::Function2d::GetCommand () const { return "plot"; } void -Gnuplot2dFunction::Function2d::PrintExpression(std::ostream &os) const +Gnuplot2dFunction::Function2d::PrintExpression (std::ostream &os) const { os << m_function; - if (m_title.size()) + if (m_title.size ()) os << " title '" << m_title << "'"; - if (m_extra.size()) + if (m_extra.size ()) os << " " << m_extra; } void -Gnuplot2dFunction::Function2d::PrintDatafile(std::ostream &os) const +Gnuplot2dFunction::Function2d::PrintDatafile (std::ostream &os) const { } // --- Gnuplot2dFunction --------------------------------------------------- // Gnuplot2dFunction::Gnuplot2dFunction (const std::string& title, const std::string& function) - : GnuplotDataset( new Function2d(title, function) ) + : GnuplotDataset ( new Function2d (title, function) ) { } @@ -414,40 +414,40 @@ struct Gnuplot3dDataset::Data3d : public GnuplotDataset::Data */ Data3d(const std::string& title); - virtual std::string GetCommand() const; - virtual void PrintExpression(std::ostream &os) const; - virtual void PrintDatafile(std::ostream &os) const; + virtual std::string GetCommand () const; + virtual void PrintExpression (std::ostream &os) const; + virtual void PrintDatafile (std::ostream &os) const; }; Gnuplot3dDataset::Data3d::Data3d(const std::string& title) - : Data(title), - m_style(m_defaultStyle) + : Data (title), + m_style (m_defaultStyle) { } std::string -Gnuplot3dDataset::Data3d::GetCommand() const +Gnuplot3dDataset::Data3d::GetCommand () const { return "splot"; } void -Gnuplot3dDataset::Data3d::PrintExpression(std::ostream &os) const +Gnuplot3dDataset::Data3d::PrintExpression (std::ostream &os) const { os << "'-' "; - if (m_style.size()) + if (m_style.size ()) os << " " << m_style; - if (m_title.size()) + if (m_title.size ()) os << " title '" << m_title << "'"; - if (m_extra.size()) + if (m_extra.size ()) os << " " << m_extra; } void -Gnuplot3dDataset::Data3d::PrintDatafile(std::ostream &os) const +Gnuplot3dDataset::Data3d::PrintDatafile (std::ostream &os) const { for (PointSet::const_iterator i = m_pointset.begin (); i != m_pointset.end (); ++i) @@ -467,7 +467,7 @@ Gnuplot3dDataset::Data3d::PrintDatafile(std::ostream &os) const std::string Gnuplot3dDataset::m_defaultStyle = ""; Gnuplot3dDataset::Gnuplot3dDataset (const std::string& title) - : GnuplotDataset( new Data3d(title) ) + : GnuplotDataset ( new Data3d (title) ) { } @@ -494,7 +494,7 @@ Gnuplot3dDataset::Add (double x, double y, double z) } void -Gnuplot3dDataset::AddEmptyLine() +Gnuplot3dDataset::AddEmptyLine () { struct Point data; data.empty = true; @@ -514,44 +514,44 @@ struct Gnuplot3dFunction::Function3d : public GnuplotDataset::Data */ Function3d(const std::string& title, const std::string& function); - virtual std::string GetCommand() const; - virtual void PrintExpression(std::ostream &os) const; - virtual void PrintDatafile(std::ostream &os) const; + virtual std::string GetCommand () const; + virtual void PrintExpression (std::ostream &os) const; + virtual void PrintDatafile (std::ostream &os) const; }; Gnuplot3dFunction::Function3d::Function3d(const std::string& title, const std::string& function) - : Data(title), - m_function(function) + : Data (title), + m_function (function) { } std::string -Gnuplot3dFunction::Function3d::GetCommand() const +Gnuplot3dFunction::Function3d::GetCommand () const { return "splot"; } void -Gnuplot3dFunction::Function3d::PrintExpression(std::ostream &os) const +Gnuplot3dFunction::Function3d::PrintExpression (std::ostream &os) const { os << m_function; - if (m_title.size()) + if (m_title.size ()) os << " title '" << m_title << "'"; - if (m_extra.size()) + if (m_extra.size ()) os << " " << m_extra; } void -Gnuplot3dFunction::Function3d::PrintDatafile(std::ostream &os) const +Gnuplot3dFunction::Function3d::PrintDatafile (std::ostream &os) const { } // --- Gnuplot3dFunction --------------------------------------------------- // Gnuplot3dFunction::Gnuplot3dFunction (const std::string& title, const std::string& function) - : GnuplotDataset( new Function3d(title, function) ) + : GnuplotDataset ( new Function3d (title, function) ) { } @@ -564,21 +564,21 @@ Gnuplot3dFunction::SetFunction (const std::string& function) // ------------------------------------------------------------------------- // Gnuplot::Gnuplot (const std::string& outputFilename, const std::string& title) - : m_outputFilename(outputFilename), - m_terminal( DetectTerminal(outputFilename) ), - m_title(title) + : m_outputFilename (outputFilename), + m_terminal ( DetectTerminal (outputFilename) ), + m_title (title) { } std::string Gnuplot::DetectTerminal (const std::string& filename) { - std::string::size_type dotpos = filename.rfind('.'); + std::string::size_type dotpos = filename.rfind ('.'); if (dotpos == std::string::npos) return ""; - if (filename.substr(dotpos) == ".png") { + if (filename.substr (dotpos) == ".png") { return "png"; } - else if (filename.substr(dotpos) == ".pdf") { + else if (filename.substr (dotpos) == ".pdf") { return "pdf"; } @@ -626,37 +626,37 @@ Gnuplot::AddDataset (const GnuplotDataset& dataset) void Gnuplot::GenerateOutput (std::ostream &os) const { - if (m_terminal.size()) + if (m_terminal.size ()) os << "set terminal " << m_terminal << std::endl; - if (m_outputFilename.size()) + if (m_outputFilename.size ()) os << "set output '" << m_outputFilename << "'" << std::endl; - if (m_title.size()) + if (m_title.size ()) os << "set title '" << m_title << "'" << std::endl; - if (m_xLegend.size()) + if (m_xLegend.size ()) os << "set xlabel '" << m_xLegend << "'" << std::endl; - if (m_yLegend.size()) + if (m_yLegend.size ()) os << "set ylabel '" << m_yLegend << "'" << std::endl; - if (m_extra.size()) + if (m_extra.size ()) os << m_extra << std::endl; - if (m_datasets.empty()) + if (m_datasets.empty ()) return; // Determine the GetCommand() values of all datasets included. Check that all // are equal and print the command. - std::string command = m_datasets.begin()->m_data->GetCommand(); + std::string command = m_datasets.begin ()->m_data->GetCommand (); for (Datasets::const_iterator i = m_datasets.begin () + 1; i != m_datasets.end (); ++i) { - NS_ASSERT_MSG(command == i->m_data->GetCommand(), - "Cannot mix 'plot' and 'splot' GnuplotDatasets."); + NS_ASSERT_MSG (command == i->m_data->GetCommand (), + "Cannot mix 'plot' and 'splot' GnuplotDatasets."); } os << command << " "; @@ -665,7 +665,7 @@ Gnuplot::GenerateOutput (std::ostream &os) const for (Datasets::const_iterator i = m_datasets.begin (); i != m_datasets.end ();) { - i->m_data->PrintExpression(os); + i->m_data->PrintExpression (os); i++; @@ -680,15 +680,15 @@ Gnuplot::GenerateOutput (std::ostream &os) const for (Datasets::const_iterator i = m_datasets.begin (); i != m_datasets.end (); i++) { - i->m_data->PrintDatafile(os); + i->m_data->PrintDatafile (os); } } // ------------------------------------------------------------------------- // GnuplotCollection::GnuplotCollection (const std::string& outputFilename) - : m_outputFilename(outputFilename), - m_terminal( Gnuplot::DetectTerminal(outputFilename) ) + : m_outputFilename (outputFilename), + m_terminal ( Gnuplot::DetectTerminal (outputFilename) ) { } @@ -705,10 +705,10 @@ GnuplotCollection::AddPlot (const Gnuplot& plot) } Gnuplot& -GnuplotCollection::GetPlot(unsigned int id) +GnuplotCollection::GetPlot (unsigned int id) { - if (id >= m_plots.size()) - throw(std::range_error("Gnuplot id is out of range")); + if (id >= m_plots.size ()) + throw(std::range_error ("Gnuplot id is out of range")); else return m_plots[id]; } @@ -716,10 +716,10 @@ GnuplotCollection::GetPlot(unsigned int id) void GnuplotCollection::GenerateOutput (std::ostream &os) const { - if (m_terminal.size()) + if (m_terminal.size ()) os << "set terminal " << m_terminal << std::endl; - if (m_outputFilename.size()) + if (m_outputFilename.size ()) os << "set output '" << m_outputFilename << "'" << std::endl; for (Plots::const_iterator i = m_plots.begin (); i != m_plots.end (); ++i) diff --git a/src/tools/model/gnuplot.h b/src/tools/model/gnuplot.h index 9328f3ac7..0e1ac1d5f 100644 --- a/src/tools/model/gnuplot.h +++ b/src/tools/model/gnuplot.h @@ -197,7 +197,7 @@ public: * Add an empty line in the data output sequence. Empty lines in the plot * data break continuous lines and do other things in the output. */ - void AddEmptyLine(); + void AddEmptyLine (); private: @@ -286,7 +286,7 @@ public: * Add an empty line in the data output sequence. Empty lines in the plot * data break continuous lines and do other things in the output. */ - void AddEmptyLine(); + void AddEmptyLine (); private: @@ -356,7 +356,7 @@ public: * the filename's extension. * \param filename output file name */ - static std::string DetectTerminal(const std::string& filename); + static std::string DetectTerminal (const std::string& filename); /** * \param terminal terminal setting string for output. The default terminal @@ -440,7 +440,7 @@ public: * \param id index of plot to return * \return reference to plot, throws std::range_error if it does not exist. */ - Gnuplot& GetPlot(unsigned int id); + Gnuplot& GetPlot (unsigned int id); /** * \param os the output stream on which the relevant gnuplot commands should diff --git a/src/uan/examples/uan-cw-example.cc b/src/uan/examples/uan-cw-example.cc index 165ddf9e2..f0ee508e5 100644 --- a/src/uan/examples/uan-cw-example.cc +++ b/src/uan/examples/uan-cw-example.cc @@ -47,7 +47,7 @@ using namespace ns3; -NS_LOG_COMPONENT_DEFINE("UanCwExample"); +NS_LOG_COMPONENT_DEFINE ("UanCwExample"); Experiment::Experiment () : m_numNodes (15), @@ -115,7 +115,7 @@ Experiment::ReceivePacket (Ptr socket) { Ptr packet; - while (packet = socket->Recv()) + while (packet = socket->Recv ()) { m_bytesTotal += packet->GetSize (); } @@ -178,8 +178,8 @@ Experiment::Run (UanHelper &uan) mobility.Install (nc); PacketSocketAddress socket; - socket.SetSingleDevice (sinkdev.Get(0)->GetIfIndex ()); - socket.SetPhysicalAddress (sinkdev.Get(0)->GetAddress ()); + socket.SetSingleDevice (sinkdev.Get (0)->GetIfIndex ()); + socket.SetPhysicalAddress (sinkdev.Get (0)->GetAddress ()); socket.SetProtocol (0); OnOffHelper app ("ns3::PacketSocketFactory", Address (socket)); diff --git a/src/uan/examples/uan-rc-example.cc b/src/uan/examples/uan-rc-example.cc index 4a98d5672..80a6a78c5 100644 --- a/src/uan/examples/uan-rc-example.cc +++ b/src/uan/examples/uan-rc-example.cc @@ -123,7 +123,7 @@ Experiment::CreateMode (uint32_t kass, fcmode, bw, 2, - buf.str()); + buf.str ()); return mode; } @@ -164,7 +164,7 @@ Experiment::Run (uint32_t param) nNodes = m_numNodes; a = param; } - Time pDelay = Seconds((double) m_maxRange / 1500.0); + Time pDelay = Seconds ((double) m_maxRange / 1500.0); uan.SetPhy ("ns3::UanPhyDual", "SupportedModesPhy1", UanModesListValue (m_dataModes), @@ -174,20 +174,20 @@ Experiment::Run (uint32_t param) "NumberOfRates", UintegerValue (m_numRates), "NumberOfNodes", UintegerValue (nNodes), "MaxReservations", UintegerValue (a), - "RetryRate", DoubleValue(1/30.0), + "RetryRate", DoubleValue (1/30.0), "SIFS", TimeValue (m_sifs), "MaxPropDelay", TimeValue (pDelay), "FrameSize", UintegerValue (m_pktSize)); Ptr chan = CreateObject(); NodeContainer sink; - sink.Create(1); - NetDeviceContainer sinkDev = uan.Install(sink, chan); + sink.Create (1); + NetDeviceContainer sinkDev = uan.Install (sink, chan); uan.SetMac ("ns3::UanMacRc", "NumberOfRates", UintegerValue (m_numRates), "MaxPropDelay", TimeValue (pDelay), - "RetryRate", DoubleValue(1.0/100.0)); + "RetryRate", DoubleValue (1.0/100.0)); NodeContainer nodes; nodes.Create (nNodes); NetDeviceContainer devices = uan.Install (nodes, chan); @@ -222,8 +222,8 @@ Experiment::Run (uint32_t param) pktskth.Install (sink); PacketSocketAddress socket; - socket.SetSingleDevice (sinkDev.Get(0)->GetIfIndex ()); - socket.SetPhysicalAddress (sinkDev.Get(0)->GetAddress ()); + socket.SetSingleDevice (sinkDev.Get (0)->GetIfIndex ()); + socket.SetPhysicalAddress (sinkDev.Get (0)->GetAddress ()); socket.SetProtocol (0); OnOffHelper app ("ns3::PacketSocketFactory", Address (socket)); @@ -235,23 +235,23 @@ Experiment::Run (uint32_t param) ApplicationContainer apps = app.Install (nodes); apps.Start (Seconds (0.5)); - apps.Stop (m_simTime + Seconds(0.5)); + apps.Stop (m_simTime + Seconds (0.5)); Ptr sinkNode = sink.Get (0); TypeId psfid = TypeId::LookupByName ("ns3::PacketSocketFactory"); - Ptr sinkSocket = Socket::CreateSocket(sinkNode, psfid); - sinkSocket->Bind(socket); + Ptr sinkSocket = Socket::CreateSocket (sinkNode, psfid); + sinkSocket->Bind (socket); sinkSocket->SetRecvCallback (MakeCallback (&Experiment::ReceivePacket, this)); - Simulator::Stop (m_simTime + Seconds(0.6)); + Simulator::Stop (m_simTime + Seconds (0.6)); Simulator::Run (); Simulator::Destroy (); return m_bytesTotal; } int -main(int argc, char *argv[]) +main (int argc, char *argv[]) { LogComponentEnable ("UanRcExample", LOG_LEVEL_ALL); diff --git a/src/virtual-net-device/examples/virtual-net-device.cc b/src/virtual-net-device/examples/virtual-net-device.cc index 460b9d44a..73456d3d6 100644 --- a/src/virtual-net-device/examples/virtual-net-device.cc +++ b/src/virtual-net-device/examples/virtual-net-device.cc @@ -218,9 +218,9 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Create nodes."); NodeContainer c; c.Create (4); - NodeContainer n0n2 = NodeContainer (c.Get(0), c.Get (2)); - NodeContainer n1n2 = NodeContainer (c.Get(1), c.Get (2)); - NodeContainer n3n2 = NodeContainer (c.Get(3), c.Get (2)); + NodeContainer n0n2 = NodeContainer (c.Get (0), c.Get (2)); + NodeContainer n1n2 = NodeContainer (c.Get (1), c.Get (2)); + NodeContainer n3n2 = NodeContainer (c.Get (3), c.Get (2)); InternetStackHelper internet; internet.Install (c); diff --git a/src/virtual-net-device/model/virtual-net-device.cc b/src/virtual-net-device/model/virtual-net-device.cc index c6f96a555..bbbc35515 100644 --- a/src/virtual-net-device/model/virtual-net-device.cc +++ b/src/virtual-net-device/model/virtual-net-device.cc @@ -117,7 +117,7 @@ VirtualNetDevice::~VirtualNetDevice() } -void VirtualNetDevice::DoDispose() +void VirtualNetDevice::DoDispose () { NS_LOG_FUNCTION_NOARGS (); m_node = 0; diff --git a/src/virtual-net-device/model/virtual-net-device.h b/src/virtual-net-device/model/virtual-net-device.h index 89c0e3145..e9a7a6439 100644 --- a/src/virtual-net-device/model/virtual-net-device.h +++ b/src/virtual-net-device/model/virtual-net-device.h @@ -122,8 +122,8 @@ public: // inherited from NetDevice base class. - virtual void SetIfIndex(const uint32_t index); - virtual uint32_t GetIfIndex(void) const; + virtual void SetIfIndex (const uint32_t index); + virtual uint32_t GetIfIndex (void) const; virtual Ptr GetChannel (void) const; virtual void SetAddress (Address address); virtual Address GetAddress (void) const; diff --git a/src/visualizer/model/pyviz.cc b/src/visualizer/model/pyviz.cc index 394236614..f0acb0f58 100644 --- a/src/visualizer/model/pyviz.cc +++ b/src/visualizer/model/pyviz.cc @@ -43,17 +43,17 @@ PathSplit (std::string str) { std::vector results; size_t cutAt; - while ((cutAt = str.find_first_of('/')) != str.npos) + while ((cutAt = str.find_first_of ('/')) != str.npos) { if(cutAt > 0) { - results.push_back(str.substr(0,cutAt)); + results.push_back (str.substr (0,cutAt)); } - str = str.substr(cutAt+1); + str = str.substr (cutAt+1); } - if (str.length() > 0) + if (str.length () > 0) { - results.push_back(str); + results.push_back (str); } return results; } @@ -699,18 +699,18 @@ PyViz::TraceNetDevRxCommon (std::string const &context, Ptr packet TransmissionSampleKey key = { record.srcNode, node, channel }; #ifdef NS3_LOG_ENABLE - NS_LOG_DEBUG("m_transmissionSamples begin:"); + NS_LOG_DEBUG ("m_transmissionSamples begin:"); if (g_log.IsEnabled (ns3::LOG_DEBUG)) { for (std::map::const_iterator iter = m_transmissionSamples.begin (); iter != m_transmissionSamples.end (); iter++) { - NS_LOG_DEBUG(iter->first.transmitter<<"/"<first.transmitter->GetId () << ", " - << iter->first.receiver<<"/"<first.receiver->GetId () - << ", " << iter->first.channel << " => " << iter->second.bytes << " (@ " << &iter->second << ")"); + NS_LOG_DEBUG (iter->first.transmitter<<"/"<first.transmitter->GetId () << ", " + << iter->first.receiver<<"/"<first.receiver->GetId () + << ", " << iter->first.channel << " => " << iter->second.bytes << " (@ " << &iter->second << ")"); } } - NS_LOG_DEBUG("m_transmissionSamples end."); + NS_LOG_DEBUG ("m_transmissionSamples end."); #endif std::map::iterator @@ -719,8 +719,8 @@ PyViz::TraceNetDevRxCommon (std::string const &context, Ptr packet if (iter == m_transmissionSamples.end ()) { TransmissionSampleValue sample = { packet->GetSize () }; - NS_LOG_DEBUG ("RX: from " << key.transmitter<<"/"<GetId() << " to " - << key.receiver<<"/"<GetId() + NS_LOG_DEBUG ("RX: from " << key.transmitter<<"/"<GetId () << " to " + << key.receiver<<"/"<GetId () << " channel " << channel << ": " << packet->GetSize () << " bytes more. => new sample with " << packet->GetSize () << " bytes."); m_transmissionSamples[key] = sample; @@ -728,8 +728,8 @@ PyViz::TraceNetDevRxCommon (std::string const &context, Ptr packet else { TransmissionSampleValue &sample = iter->second; - NS_LOG_DEBUG ("RX: from " << key.transmitter<<"/"<GetId() << " to " - << key.receiver<<"/"<GetId() + NS_LOG_DEBUG ("RX: from " << key.transmitter<<"/"<GetId () << " to " + << key.receiver<<"/"<GetId () << " channel " << channel << ": " << packet->GetSize () << " bytes more. => sample " << &sample << " with bytes " << sample.bytes); @@ -838,7 +838,7 @@ PyViz::GetTransmissionSamples () const sample.receiver = iter->first.receiver; sample.channel = iter->first.channel; sample.bytes = iter->second.bytes; - NS_LOG_DEBUG ("from " << sample.transmitter->GetId() << " to " << sample.receiver->GetId() + NS_LOG_DEBUG ("from " << sample.transmitter->GetId () << " to " << sample.receiver->GetId () << ": " << sample.bytes << " bytes."); list.push_back (sample); } @@ -859,7 +859,7 @@ PyViz::GetPacketDropSamples () const PacketDropSample sample; sample.transmitter = iter->first; sample.bytes = iter->second; - NS_LOG_DEBUG ("in " << sample.transmitter->GetId() + NS_LOG_DEBUG ("in " << sample.transmitter->GetId () << ": " << sample.bytes << " bytes dropped."); list.push_back (sample); } @@ -893,7 +893,7 @@ PyViz::GetLastPackets (uint32_t nodeId) const NS_LOG_DEBUG ("GetLastPackets: " << nodeId); std::map::const_iterator - iter = m_lastPackets.find(nodeId); + iter = m_lastPackets.find (nodeId); if (iter != m_lastPackets.end ()) { return iter->second; diff --git a/src/visualizer/model/visual-simulator-impl.cc b/src/visualizer/model/visual-simulator-impl.cc index 9a43d8fc3..3c2291a18 100644 --- a/src/visualizer/model/visual-simulator-impl.cc +++ b/src/visualizer/model/visual-simulator-impl.cc @@ -121,10 +121,10 @@ VisualSimulatorImpl::Run (void) if (!Py_IsInitialized ()) { const char *argv[] = { "python", NULL}; - Py_Initialize(); - PySys_SetArgv(1, (char**) argv); + Py_Initialize (); + PySys_SetArgv (1, (char**) argv); } - PyRun_SimpleString( + PyRun_SimpleString ( "import visualizer\n" "visualizer.start();\n" ); diff --git a/src/wimax/model/bs-net-device.cc b/src/wimax/model/bs-net-device.cc index 354d439ef..6e98ee68c 100644 --- a/src/wimax/model/bs-net-device.cc +++ b/src/wimax/model/bs-net-device.cc @@ -524,8 +524,8 @@ BaseStationNetDevice::StartFrame (void) { //setting DL/UL subframe allocation for this frame uint32_t symbolsPerFrame = GetPhy ()->GetSymbolsPerFrame (); - SetNrDlSymbols ((symbolsPerFrame / 2) - static_cast (ceil(GetTtg()*m_psDuration.GetSeconds ()/m_symbolDuration.GetSeconds ()))); - SetNrUlSymbols ((symbolsPerFrame / 2) - static_cast (ceil(GetRtg()*m_psDuration.GetSeconds ()/m_symbolDuration.GetSeconds ()))); + SetNrDlSymbols ((symbolsPerFrame / 2) - static_cast (ceil (GetTtg ()*m_psDuration.GetSeconds ()/m_symbolDuration.GetSeconds ()))); + SetNrUlSymbols ((symbolsPerFrame / 2) - static_cast (ceil (GetRtg ()*m_psDuration.GetSeconds ()/m_symbolDuration.GetSeconds ()))); m_frameStartTime = Simulator::Now (); diff --git a/src/wimax/model/bs-uplink-scheduler-mbqos.cc b/src/wimax/model/bs-uplink-scheduler-mbqos.cc index efb8b4c25..72b44dbc1 100644 --- a/src/wimax/model/bs-uplink-scheduler-mbqos.cc +++ b/src/wimax/model/bs-uplink-scheduler-mbqos.cc @@ -688,7 +688,7 @@ UplinkSchedulerMBQoS::CheckDeadline (uint32_t &availableSymbols) continue; } - uint32_t symbolsToAllocate = GetBs ()->GetPhy ()->GetNrSymbols(allocationSize, job->GetSsRecord ()->GetModulationType ()); + uint32_t symbolsToAllocate = GetBs ()->GetPhy ()->GetNrSymbols (allocationSize, job->GetSsRecord ()->GetModulationType ()); if (symbolsToAllocate > availableSymbols) { symbolsToAllocate = availableSymbols; diff --git a/src/wimax/model/simple-ofdm-send-param.h b/src/wimax/model/simple-ofdm-send-param.h index 942234b77..eda59a00c 100644 --- a/src/wimax/model/simple-ofdm-send-param.h +++ b/src/wimax/model/simple-ofdm-send-param.h @@ -103,7 +103,7 @@ public: /** * \return the received burst */ - Ptr GetBurst(void); + Ptr GetBurst (void); private: bvec m_fecBlock; diff --git a/src/wimax/model/simple-ofdm-wimax-channel.cc b/src/wimax/model/simple-ofdm-wimax-channel.cc index 76a40d413..1fb98795a 100644 --- a/src/wimax/model/simple-ofdm-wimax-channel.cc +++ b/src/wimax/model/simple-ofdm-wimax-channel.cc @@ -150,7 +150,7 @@ SimpleOfdmWimaxChannel::Send (Time BlockTime, simpleOfdmSendParam * param; for (std::list >::iterator iter = m_phyList.begin (); iter != m_phyList.end (); ++iter) { - Time delay = Seconds(0); + Time delay = Seconds (0); if (phy != *iter) { double distance = 0; @@ -158,7 +158,7 @@ SimpleOfdmWimaxChannel::Send (Time BlockTime, if (receiverMobility != 0 && senderMobility != 0 && m_loss != 0) { distance = senderMobility->GetDistanceFrom (receiverMobility); - delay = Seconds(distance/300000000.0); + delay = Seconds (distance/300000000.0); rxPowerDbm = m_loss->CalcRxPower (txPowerDbm, senderMobility, receiverMobility); } @@ -199,7 +199,7 @@ SimpleOfdmWimaxChannel::EndSendDummyBlock (Ptr rxphy, simple param->GetModulationType (), param->GetDirection (), param->GetRxPowerDbm (), - param->GetBurst()); + param->GetBurst ()); delete param; } } diff --git a/src/wimax/model/simple-ofdm-wimax-phy.cc b/src/wimax/model/simple-ofdm-wimax-phy.cc index f98136e7e..dc54987e9 100644 --- a/src/wimax/model/simple-ofdm-wimax-phy.cc +++ b/src/wimax/model/simple-ofdm-wimax-phy.cc @@ -263,7 +263,7 @@ SimpleOfdmWimaxPhy::Send (Ptr burst, m_nrFecBlocksSent = 0; m_currentBurst = burst; SetBlockParameters (burst->GetSize (), modulationType); - NotifyTxBegin(m_currentBurst); + NotifyTxBegin (m_currentBurst); StartSendDummyFecBlock (true, modulationType, direction); m_traceTx (burst); } @@ -318,11 +318,11 @@ SimpleOfdmWimaxPhy::EndSendFecBlock (WimaxPhy::ModulationType modulationType, { // this is the last FEC block of the burst NS_ASSERT_MSG (m_nrRemainingBlocksToSend == 0, "Error while sending a burst"); - NotifyTxEnd(m_currentBurst); + NotifyTxEnd (m_currentBurst); } else { - StartSendDummyFecBlock(false,modulationType,direction); + StartSendDummyFecBlock (false,modulationType,direction); } } @@ -393,7 +393,7 @@ SimpleOfdmWimaxPhy::StartReceive (uint32_t burstSize, { if (isFirstBlock) { - NotifyRxBegin(burst); + NotifyRxBegin (burst); m_receivedFecBlocks->clear (); m_nrRecivedFecBlocks=0; SetBlockParameters (burstSize, modulationType); diff --git a/src/wimax/model/ul-job.cc b/src/wimax/model/ul-job.cc index 776a7f53b..db0b9105d 100644 --- a/src/wimax/model/ul-job.cc +++ b/src/wimax/model/ul-job.cc @@ -24,7 +24,7 @@ namespace ns3 { -UlJob::UlJob (void) : m_deadline(Seconds (0)), m_size (0) +UlJob::UlJob (void) : m_deadline (Seconds (0)), m_size (0) { } diff --git a/src/wimax/test/phy-test.cc b/src/wimax/test/phy-test.cc index 1872355a5..59c54a03b 100644 --- a/src/wimax/test/phy-test.cc +++ b/src/wimax/test/phy-test.cc @@ -39,7 +39,7 @@ using namespace ns3; -NS_LOG_COMPONENT_DEFINE("WimaxPhyTest"); +NS_LOG_COMPONENT_DEFINE ("WimaxPhyTest"); /* * Configure a network with 3 SS and 1 BS