diff --git a/.hgignore b/.hgignore
index 6558f24eb..ba9effb2d 100644
--- a/.hgignore
+++ b/.hgignore
@@ -17,6 +17,8 @@
^doc/manual/build
^doc/tutorial/build
^doc/testing/build
+^doc/models/build
+^doc/models/source-temp
^doc/manual/figures/.*eps
^doc/manual/figures/.*pdf
^doc/manual/figures/.*png
diff --git a/.hgtags b/.hgtags
index 1829d3e0f..f72791391 100644
--- a/.hgtags
+++ b/.hgtags
@@ -54,3 +54,5 @@ fb5ad9c7755aa6ea871e76d322fd4c43a5b1047d ns-3.9-RC1
def4153e27cd744f117acf8c509979617850da83 ns-3.9-RC3
8ddf25211f8995cde73baa8b8a419711ed451b85 ns-3.9
63a8a4ed4054f1e1cd1756045abba657f6fd884c ns-3.10
+440bbee145f096193abcdd67fe6c16de62935d89 ns-3.11-RC1
+0a7a16b599e86ca7884e5b5772bf7c5cfe146603 ns-3.11-RC2
diff --git a/CHANGES.html b/CHANGES.html
index cec78f518..de2073243 100644
--- a/CHANGES.html
+++ b/CHANGES.html
@@ -83,6 +83,16 @@ objects. The implementation of int64x64_t is based on the previously-exis
Changes to existing API:
+Wifi TX duration calculation moved from InterferenceHelper to WifiPhy
+The following static methods have been moved from the InterferenceHelper class to the WifiPhy class:
+
+static Time CalculateTxDuration (uint32_t size, WifiMode payloadMode, enum WifiPreamble preamble);
+static WifiMode GetPlcpHeaderMode (WifiMode payloadMode, WifiPreamble preamble);
+static uint32_t GetPlcpHeaderDurationMicroSeconds (WifiMode payloadMode, WifiPreamble preamble);
+static uint32_t GetPlcpPreambleDurationMicroSeconds (WifiMode payloadMode, WifiPreamble preamble);
+static uint32_t GetPayloadDurationMicroSeconds (uint32_t size, WifiMode payloadMode);
+
+
Test cases no longer return a boolean value
Unit test case DoRun() functions no longer return a bool value. Now, they don't return a value at all. The motivation for this change was to disallow users from merely returning "true" from a test case to force an error to be recorded. Instead, test case macros should be used.
@@ -104,6 +114,13 @@ Time result = Time (tmp * 5);
+Multicast GetOutputTtl() commands
+ As part of bug 1047 rework to enable multicast routes on nodes with
+more than 16 interfaces, the methods Ipv4MulticastRoute::GetOutputTtl ()
+and Ipv6MulticastRoute::GetOutputTtl () have been modified to return
+a std::map of interface IDs and TTLs for the route.
+
+
Changed behavior:
diff --git a/RELEASE_NOTES b/RELEASE_NOTES
index 12e3e0ce6..1507d1fef 100644
--- a/RELEASE_NOTES
+++ b/RELEASE_NOTES
@@ -25,53 +25,79 @@ New user-visible features
- int64x64_t is a new type which allows portable and easy to write arithmetic
calculations that require a high degree of fractional precision.
+ - interface to the Click Modular Router and an Ipv4ClickRouting
+ class to allow a node to use Click for external routing
+
+ - interface to an OpenFlow software implementation distribution to allow the
+ simulation of OpenFlow switches in ns-3
+
Bugs fixed
----------
The following lists many of the bugs fixed or small feature additions
since ns-3.10, in many cases referencing the Bugzilla bug number.
- - Bug 1019: common --> node --> common circular dependency
- - Fixed UanPhyGen::IsStateBusy method bug
- - bugfix: CsmaNetDevice ErrorModel not discarding packet (reported by
- - Bug 1048: MatrixPropagationLossModel API changed from Ptr to
- - Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
- - Bug 1052 - olsr::RoutingProtocol::LinkTupleUpdated incorrect
- - bug 1062: fix portability issue with rescale-pdf.sh
- - Bug 1064: Correct Friis propagation loss equation
+ - bugfix: CsmaNetDevice ErrorModel not discarding packet
- bugfix: do not call RouteOutput() twice
- Workaround gccxml bug scanning Seconds(0) as default value
- Copy a bug fix from ns3modulescan.py into ns3modulescan-modular.py
- - Bug 1070: csma/ipv6 examples duplicate NS_LOG_COMPONENT_DEFINE
- Modular Python bindings work (many bug fixes, more modules tested)
- - bug 1072: crash upon call to Packet::AddAtEnd of fragmented packets
- - Bug 1040 - Olsr and multiple interfaces
- - Bug 1075 - Python examples fail when static built is enabled
- - Bug 1076 - Waf gives an error if you enable only a single module
- Modular bindings: bug fixes, more verbose scanning
- - bug 1078: PacketTagList::Add performs NS_ASSERT counting one byte
- ./waf --apiscan: fix bug in detection of whether the per-module
- - Bug 1081 - wutils.py refers to the old directory for visualizer
- - Bug 1083 - scratch doesn't work when only some modules are enabled
- Remove the 'Modules to build' debug print
- - updated doxygen for Object::Dispose (bug 1086)
- - fixed ActiveProbing for StaWifiMac (bug 1060)
- - bug 1094: Object::GetObject upon dlopen
- - fixed Bug 1066 - Set Radiotap modulation type flags correctly
- - fixed Bug 1090 - WifiMacQueue is not accessible through the
- - fix Bug 1069 - ApWifiMac unduly calls RegularWifiMac::Receive and
- - revised fix for bug 1069
- - bug 1046: Check AODV LocalDeliver callback before using it
- - fix small bugs
- - work around pybindgen bug
- - bugs fixed
- - Bug 1088 - Code in scratch directory assumes all modules are enabled
- - testcase for bug 1072
- - bug 1072: crash upon call to Packet::AddAtEnd of fragmented packets
- - Bug 1106: Remove CanvasLocation dependencies
- CsmaNetDevice ReceiveErrorModel was not dropping the packet
- - bug 1038 - Time::Get*Seconds () return signed integer while actually returning unsigned
+
- bug 445 - Is the class name Scalar in nstime.h appropriate?
+ - bug 699 - TestCase::DoRun probably should not return a bool
+ - bug 957 - Issue with test.py
+ - bug 1017 - node --> internet-stack --> node
+ - bug 1018 - mobility --> helper --> mobility circular dependency
+ - bug 1019 - common --> node --> common circular dependency
+ - bug 1038 - Time::Get*Seconds () return signed integer while actually returning unsigned.
+ - bug 1040 - Olsr and multiple interfaces
+ - bug 1042 - AODV RERR implosion (missing RERR_RATELIMIT)
- bug 1044 - Seconds (1e-9) creates Time that is not IsPositive ()
+ - bug 1047 - Multicast routes on nodes with >16 interfaces
+ - bug 1048 - suggested MatrixPropagationLossModel::SetLoss() API change
+ - bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
+ - bug 1052 - olsr::RoutingProtocol::LinkTupleUpdated incorrect detection of asymetric link with multiple interface nodes
+ - bug 1054 - ipv6 InternetStackHelper EnablePcapIpv6All() broken
+ - bug 1056 - CSMA: padding not handled correctly for LLC encapsulation
+ - bug 1058 - InternetStackHelper pitfall: calling Install before adding routing protocols
+ - bug 1060 - Setting NqStaWifiMac Active Probing true, crashes simulation
+ - bug 1061 - Title level inconsistent in click.rst
+ - bug 1062 - rescale-pdf not working
+ - bug 1064 - Correct Friis propagation loss equation in spectrum module
+ - bug 1066 - Set Radiotap modulation type flags correctly
+ - bug 1069 - ApWifiMac unduly calls RegularWifiMac::Receive and crashes
+ - bug 1070 - csma/ipv6 examples duplicate NS_LOG_COMPONENT_DEFINE
+ - bug 1072 - crash upon call to Packet::AddAtEnd of fragmented packets
+ - bug 1075 - Python examples fail when static built is enabled
+ - bug 1076 - Waf gives an error if you enable only a single module
+ - bug 1078 - PacketTagList::Add performs NS_ASSERT counting one byte too few
+ - bug 1079 - MPI code doesn't compile
+ - bug 1081 - wutils.py refers to the old directory for visualizer module
+ - bug 1083 - scratch doesn't work when only some modules are enabled
+ - bug 1085 - Build failed: list index out of range
+ - bug 1086 - sanity check for not calling Object::Dispose () twice
+ - bug 1087 - Call MPI_Finalize to exit MPI environment
+ - bug 1088 - Code in scratch directory assumes all modules are enabled
+ - bug 1089 - lwip build issue
+ - bug 1090 - WifiMacQueue is not accessible through the attribute path
+ - bug 1092 - Problem building FreeBSD stack with g++ 4.5.2 (Ubuntu)
+ - bug 1094 - Object::GetObject upon dlopen
+ - bug 1097 - AODV routing entry set to be VALID mistakenly.
+ - bug 1098 - when to show users which modules are enabled?
+ - bug 1103 - Useless assignment in omnet-data-output.cc
+ - bug 1105 - Move topology helpers into separate per-device modules
+ - bug 1106 - Remove "CanvasLocation" dependencies in p2p helpers
+ - bug 1108 - test.py -e option needs repair
+ - bug 1110 - Sort alphabetically and display "Modules built" in columns
+ - bug 1117 - bindings failures on selected platforms
+ - bug 1122 - spectrum-value test should check tolerance on a per-value basis
+ - bug 1125 - ./waf --enable-modules fails
+ - bug 1131 - Bug in Ipv4L3Protocol::RemoveAddress()
+ - bug 1133 - DSDV: Possible bug in settling time calc
+ - bug 1142 - Wrong 802.11p Slot time
Known issues
------------
diff --git a/doc/WifiArchitecture.png b/doc/WifiArchitecture.png
deleted file mode 100644
index c30ab6124..000000000
Binary files a/doc/WifiArchitecture.png and /dev/null differ
diff --git a/doc/WimaxArchitecture.png b/doc/WimaxArchitecture.png
deleted file mode 100644
index 9600639f4..000000000
Binary files a/doc/WimaxArchitecture.png and /dev/null differ
diff --git a/doc/build.txt b/doc/build.txt
index 2db77ebe0..15b398b44 100644
--- a/doc/build.txt
+++ b/doc/build.txt
@@ -76,7 +76,7 @@ with --enable-gcov)
=== Extending ns-3 ===
To add new modules:
- 1. Create the module directory under src (or src/devices, or whatever);
+ 1. Create the module directory under src;
2. Add the source files to it;
3. Add a 'wscript' describing it;
4. Add the module subdirectory name to the all_modules list in src/wscript.
diff --git a/doc/doxygen.conf b/doc/doxygen.conf
index b5a2e58d1..2e971f095 100644
--- a/doc/doxygen.conf
+++ b/doc/doxygen.conf
@@ -603,13 +603,13 @@ RECURSIVE = YES
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
-EXCLUDE = src/routing/olsr/olsr-state.h \
- src/routing/olsr/olsr-repositories.h \
- src/simulator/high-precision.h \
- src/simulator/high-precision-128.h \
- src/simulator/high-precision-double.h \
- src/tools/visualizer/model/visual-simulator-impl.h \
- src/tools/visualizer/model/pyviz.h
+EXCLUDE = src/olsr/model/olsr-state.h \
+ src/olsr/model/olsr-repositories.h \
+ src/core/model/high-precision.h \
+ src/core/model/high-precision-128.h \
+ src/core/model/high-precision-double.h \
+ src/visualizer/model/visual-simulator-impl.h \
+ src/visualizer/model/pyviz.h
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
# directories that are symbolic links (a Unix filesystem feature) are excluded
diff --git a/doc/main.h b/doc/main.h
index 7616ea517..eeb6e4331 100644
--- a/doc/main.h
+++ b/doc/main.h
@@ -34,24 +34,46 @@
*
* \section module-sec Module overview
*
- * The ns-3 library is split across multiple modules:
- * - core: located in src/core and contains a number of facilities which
- * do not depend on any other module. Some of these facilities are
- * OS-dependent.
- * - simulator: located in src/simulator and contains event scheduling
- * facilities.
- * - common: located in src/common and contains facilities specific
- * to network simulations but shared by pretty much every model
- * of a network component.
- * - node: located in src/node. Defines the abstract interfaces which
- * must be implemented by every node and more specifically, by
- * IPv4 and IPv6 nodes.
- * - devices: located in src/devices. Contains a set of MAC-level models
- * - InternetStack: located in src/internet-stack. Contains TCP/IP models.
- * - Applications: located in src/applications
- * - Routing: located in src/routing; routing protocols.
- * - Mobility: located in src/mobility; Mobility models for nodes
- * - Helper: located in src/helper; Helper API for the simulator
+ * The ns-3 library is split across many modules:
+ * - aodv
+ * - applications
+ * - bridge
+ * - click
+ * - config-store
+ * - core
+ * - csma
+ * - csma-layout
+ * - dsdv
+ * - emu
+ * - energy
+ * - flow-monitor
+ * - internet
+ * - lte
+ * - mesh
+ * - mobility
+ * - mpi
+ * - netanim
+ * - network
+ * - nix-vector-routing
+ * - ns3tcp
+ * - ns3wifi
+ * - olsr
+ * - openflow
+ * - point-to-point
+ * - point-to-point-layout
+ * - propagation
+ * - spectrum
+ * - stats
+ * - tap-bridge
+ * - template
+ * - test
+ * - tools
+ * - topology-read
+ * - uan
+ * - virtual-net-device
+ * - visualizer
+ * - wifi
+ * - wimax
*
* More detail can be found in the Modules
* tab.
diff --git a/doc/manual/Makefile b/doc/manual/Makefile
index da91ff3ac..c4b063e25 100644
--- a/doc/manual/Makefile
+++ b/doc/manual/Makefile
@@ -6,45 +6,10 @@ FIGURES = figures
VPATH = $(FIGURES)
IMAGES_EPS = \
- $(FIGURES)/internet-node-send.eps \
- $(FIGURES)/internet-node-recv.eps \
- $(FIGURES)/packet.eps \
- $(FIGURES)/node.eps \
- $(FIGURES)/buffer.eps \
- $(FIGURES)/sockets-overview.eps \
$(FIGURES)/software-organization.eps \
- $(FIGURES)/routing.eps \
- $(FIGURES)/routing-specialization.eps \
- $(FIGURES)/testbed.eps \
- $(FIGURES)/emulated-channel.eps \
- $(FIGURES)/snir.eps \
- $(FIGURES)/WifiArchitecture.eps \
- $(FIGURES)/WimaxArchitecture.eps \
- $(FIGURES)/auvmobility-classes.eps \
- $(FIGURES)/ff-mac-saps.eps \
- $(FIGURES)/ff-example.eps \
- $(FIGURES)/lte-enb-architecture.eps \
- $(FIGURES)/lte-ue-architecture.eps \
-# missing figure
-# $(FIGURES)/lte-transmission.eps
-$(FIGURES)/node.pdf_width = 5in
-$(FIGURES)/testbed.pdf_width = 5in
-$(FIGURES)/emulated-channel.pdf_width = 6in
-$(FIGURES)/internet-node-send.pdf_width = 5in
-$(FIGURES)/internet-node-recv.pdf_width = 5in
$(FIGURES)/software-organization.pdf_width = 5in
-$(FIGURES)/packet.pdf_width = 4in
-$(FIGURES)/buffer.pdf_width = 15cm
-$(FIGURES)/routing.pdf_width = 6in
-$(FIGURES)/routing-specialization.pdf_width = 5in
-$(FIGURES)/sockets-overview.pdf_width = 10cm
-$(FIGURES)/snir.pdf_width = 3in
-$(FIGURES)/lte-transmission.pdf_width = 3in
-$(FIGURES)/auvmobility-classes.pdf_width = 10cm
-$(FIGURES)/lte-enb-architecture.pdf_width = 10cm
-
IMAGES_PNG = ${IMAGES_EPS:.eps=.png}
IMAGES_PDF = ${IMAGES_EPS:.eps=.pdf}
@@ -88,7 +53,7 @@ help:
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
- -rm -rf $(BUILDDIR)/*
+ -rm -rf $(BUILDDIR)
-rm -rf $(IMAGES)
frag: pickle
diff --git a/doc/manual/figures/WifiArchitecture.dia b/doc/manual/figures/WifiArchitecture.dia
deleted file mode 100644
index 71deb6830..000000000
Binary files a/doc/manual/figures/WifiArchitecture.dia and /dev/null differ
diff --git a/doc/manual/figures/WimaxArchitecture.dia b/doc/manual/figures/WimaxArchitecture.dia
deleted file mode 100644
index d68d960fe..000000000
Binary files a/doc/manual/figures/WimaxArchitecture.dia and /dev/null differ
diff --git a/doc/manual/source/attributes.rst b/doc/manual/source/attributes.rst
index eafea19ba..3ce1c11ad 100644
--- a/doc/manual/source/attributes.rst
+++ b/doc/manual/source/attributes.rst
@@ -575,7 +575,7 @@ From the perspective of the user who writes a new class in the system and wants
to hook it in to the attribute system, there is mainly the matter of writing the
conversions to/from strings and attribute values. Most of this can be
copy/pasted with macro-ized code. For instance, consider class declaration for
-Rectangle in the ``src/mobility/`` directory:
+Rectangle in the ``src/mobility/model`` directory:
Header file
+++++++++++
@@ -641,14 +641,14 @@ ConfigStore
***********
**Feedback requested:** This is an experimental feature of |ns3|. It is found
-in ``src/contrib`` and not in the main tree. If you like this feature and
+in ``src/config-store``. If you like this feature and
would like to provide feedback on it, please email us.
-Values for |ns3| attributes can be stored in an ASCII or XML text file and
-loaded into a future simulation. This feature is known as the |ns3|
-ConfigStore. The ConfigStore code is in ``src/contrib/``. It is not yet
-main-tree code, because we are seeking some user feedback and experience with
-this.
+Values for |ns3| attributes can be stored in an ASCII or XML text file
+and loaded into a future simulation. This feature is known as the
+|ns3| ConfigStore. The ConfigStore code is in ``src/config-store/model``.
+It is still considered as unstable code, because we are seeking some
+user feedback and experience with this.
We can explore this system by using an example. Copy the ``csma-bridge.cc``
file to the scratch directory:::
diff --git a/doc/manual/source/conf.py b/doc/manual/source/conf.py
index 874cbec1f..00d857170 100644
--- a/doc/manual/source/conf.py
+++ b/doc/manual/source/conf.py
@@ -178,7 +178,7 @@ htmlhelp_basename = 'ns-3doc'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
- ('index', 'ns-3.tex', u'ns-3 Manual',
+ ('index', 'ns-3-manual.tex', u'ns-3 Manual',
u'ns-3 project', 'manual'),
]
@@ -211,6 +211,6 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
- ('index', 'ns-3', u'ns-3 Documentation',
+ ('index', 'ns-3-manual', u'ns-3 Manual',
[u'ns-3 project'], 1)
]
diff --git a/doc/manual/source/core.rst b/doc/manual/source/core.rst
deleted file mode 100644
index 94127b8d7..000000000
--- a/doc/manual/source/core.rst
+++ /dev/null
@@ -1,17 +0,0 @@
-Core
-----
-
-.. toctree::
-
- random-variables
- callbacks
- object-model
- attributes
- object-names
- logging
- tracing
- realtime
- distributed
- packets
- helpers
- python
diff --git a/doc/manual/source/emulation.rst b/doc/manual/source/emulation.rst
deleted file mode 100644
index 2187b4295..000000000
--- a/doc/manual/source/emulation.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-Emulation
----------
-
-.. toctree::
-
- emulation-overview
- emu
- tap
diff --git a/doc/manual/source/enable-modules.rst b/doc/manual/source/enable-modules.rst
new file mode 100644
index 000000000..5e63438a8
--- /dev/null
+++ b/doc/manual/source/enable-modules.rst
@@ -0,0 +1,137 @@
+.. include:: replace.txt
+
+Enabling Subsets of |ns3| Modules
+---------------------------------
+
+As with most software projects, |ns3| is ever growing larger in terms of number of modules, lines of code, and memory footprint. Users, however, may only use a few of those modules at a time. For this reason, users may want to explicitly enable only the subset of the possible |ns3| modules that they actually need for their research.
+
+This chapter discusses how to enable only the |ns3| modules that you are intersted in using.
+
+How to enable a subset of |ns3|'s modules
+*****************************************
+
+If shared libraries are being built, then enabling a module will cause at least one library to be built: ::
+
+ libns3-modulename.so.
+
+If the module has a test library and test libraries are being built, then ::
+
+ libns3-modulename-test.so
+
+will be built, too. Other modules that the module depends on and their test libraries will also be built.
+
+By default, all modules are built in |ns3|. There are two ways to enable a subset of these modules:
+
+#. Using waf's --enable-modules option
+#. Using the |ns3| configuration file
+
+Enable modules using waf's --enable-modules option
+++++++++++++++++++++++++++++++++++++++++++++++++++
+
+To enable only the core module with example and tests, for example,
+try these commands: ::
+
+ ./waf clean
+ ./waf configure --enable-examples --enable-tests --enable-modules=core
+ ./waf build
+ cd build/debug/
+ ls
+
+and the following libraries should be present: ::
+
+ bindings libns3-core.so ns3 scratch utils
+ examples libns3-core-test.so samples src
+
+Note the ``./waf clean`` step is done here only to make it more obvious which module libraries were built. You don't have to do ``./waf clean`` in order to enable subsets of modules.
+
+Running test.py will cause only those tests that depend on module core to be run: ::
+
+ 24 of 24 tests passed (24 passed, 0 skipped, 0 failed, 0 crashed, 0 valgrind errors)
+
+Repeat the above steps for the "network" module instead of the "core" module, and the following will be built, since network depends on core: ::
+
+ bindings libns3-core.so libns3-network.so ns3 scratch utils
+ examples libns3-core-test.so libns3-network-test.so samples src
+
+Running test.py will cause those tests that depend on only the core and network modules to be run: ::
+
+ 31 of 31 tests passed (31 passed, 0 skipped, 0 failed, 0 crashed, 0 valgrind errors)
+
+Enable modules using the |ns3| configuration file
++++++++++++++++++++++++++++++++++++++++++++++++++
+
+A configuration file, .ns3rc, has been added to |ns3| that allows users to specify which modules are to be included in the build.
+
+When enabling a subset of |ns3| modules, the precedence rules are as follows:
+
+#. the --enable-modules configure string overrides any .ns3rc file
+#. the .ns3rc file in the top level |ns3| directory is next consulted, if present
+#. the system searches for ~/.ns3rc if the above two are unspecified
+
+If none of the above limits the modules to be built, all modules that waf knows about will be built.
+
+The maintained version of the .ns3rc file in the |ns3| source code repository resides in the ``utils`` directory. The reason for this is if it were in the top-level directory of the repository, it would be prone to accidental checkins from maintainers that enable the modules they want to use. Therefore, users need to manually copy the .ns3rc from the ``utils`` directory to their preferred place (top level directory or their home directory) to enable persistent modular build configuration.
+
+Assuming that you are in the top level |ns3| directory, you can get a copy of the .ns3rc file that is in the ``utils`` directory as follows: ::
+
+ cp utils/.ns3rc .
+
+The .ns3rc file should now be in your top level |ns3| directory, and it contains the following: ::
+
+ #! /usr/bin/env python
+
+ # A list of the modules that will be enabled when ns-3 is run.
+ # Modules that depend on the listed modules will be enabled also.
+ #
+ # All modules can be enabled by choosing 'all_modules'.
+ modules_enabled = ['all_modules']
+
+ # Set this equal to true if you want examples to be run.
+ examples_enabled = False
+
+ # Set this equal to true if you want tests to be run.
+ tests_enabled = False
+
+Use your favorite editor to modify the .ns3rc file to only enable the core module with examples and tests like this: ::
+
+ #! /usr/bin/env python
+
+ # A list of the modules that will be enabled when ns-3 is run.
+ # Modules that depend on the listed modules will be enabled also.
+ #
+ # All modules can be enabled by choosing 'all_modules'.
+ modules_enabled = ['core']
+
+ # Set this equal to true if you want examples to be run.
+ examples_enabled = True
+
+ # Set this equal to true if you want tests to be run.
+ tests_enabled = True
+
+Only the core module will be enabled now if you try these commands: ::
+
+ ./waf clean
+ ./waf configure
+ ./waf build
+ cd build/debug/
+ ls
+
+and the following libraries should be present: ::
+
+ bindings libns3-core.so ns3 scratch utils
+ examples libns3-core-test.so samples src
+
+Note the ``./waf clean`` step is done here only to make it more obvious which module libraries were built. You don't have to do ``./waf clean`` in order to enable subsets of modules.
+
+Running test.py will cause only those tests that depend on module core to be run: ::
+
+ 24 of 24 tests passed (24 passed, 0 skipped, 0 failed, 0 crashed, 0 valgrind errors)
+
+Repeat the above steps for the "network" module instead of the "core" module, and the following will be built, since network depends on core: ::
+
+ bindings libns3-core.so libns3-network.so ns3 scratch utils
+ examples libns3-core-test.so libns3-network-test.so samples src
+
+Running test.py will cause those tests that depend on only the core and network modules to be run: ::
+
+ 31 of 31 tests passed (31 passed, 0 skipped, 0 failed, 0 crashed, 0 valgrind errors)
diff --git a/doc/manual/source/enable-tests.rst b/doc/manual/source/enable-tests.rst
new file mode 100644
index 000000000..ba44dde55
--- /dev/null
+++ b/doc/manual/source/enable-tests.rst
@@ -0,0 +1,141 @@
+.. include:: replace.txt
+
+Enabling/disabling |ns3| Tests and Examples
+-------------------------------------------
+
+The |ns3| distribution includes many examples and tests that are used to validate the |ns3| system. Users, however, may not always want these examples and tests to be run for their installation of |ns3|.
+
+This chapter discusses how to build |ns3| with or without its examples and tests.
+
+How to enable/disable examples and tests in |ns3|
+*************************************************
+
+There are 3 ways to enable/disable examples and tests in |ns3|:
+
+#. Using build.py when |ns3| is built for the first time
+#. Using waf once |ns3| has been built
+#. Using the |ns3| configuration file once |ns3| has been built
+
+Enable/disable examples and tests using build.py
+++++++++++++++++++++++++++++++++++++++++++++++++
+
+You can use build.py to enable/disable examples and tests when |ns3| is built for the first time.
+
+By default, examples and tests are not built in |ns3|.
+
+From the ns-3-allinone directory, you can build |ns3| without any
+examples or tests simply by doing: ::
+
+ ./build.py
+
+Running test.py in the top level |ns3| directory now will cause no examples or tests to be run: ::
+
+ 0 of 0 tests passed (0 passed, 0 skipped, 0 failed, 0 crashed, 0 valgrind errors)
+
+If you would like build |ns3| with examples and tests, then do the following from the ns-3-allinone directory: ::
+
+ ./build.py --enable-examples --enable-tests
+
+Running test.py in the top level |ns3| directory will cause all of the examples and tests to be run: ::
+
+ 170 of 170 tests passed (170 passed, 0 skipped, 0 failed, 0 crashed, 0 valgrind errors)
+
+Enable/disable examples and tests using waf
++++++++++++++++++++++++++++++++++++++++++++
+
+You can use waf to enable/disable examples and tests once |ns3| has been built.
+
+By default, examples and tests are not built in |ns3|.
+
+From the top level |ns3| directory, you can build |ns3| without any
+examples or tests simply by doing: ::
+
+ ./waf configure
+ ./waf build
+
+Running test.py now will cause no examples or tests to be run: ::
+
+ 0 of 0 tests passed (0 passed, 0 skipped, 0 failed, 0 crashed, 0 valgrind errors)
+
+If you would like build |ns3| with examples and tests, then do the following from the top level |ns3| directory: ::
+
+ ./waf configure --enable-examples --enable-tests
+ ./waf build
+
+Running test.py will cause all of the examples and tests to be run: ::
+
+ 170 of 170 tests passed (170 passed, 0 skipped, 0 failed, 0 crashed, 0 valgrind errors)
+
+Enable/disable examples and tests using the |ns3| configuration file
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+A configuration file, .ns3rc, has been added to |ns3| that allows users to specify whether examples and tests should be built or not. You can use this file to enable/disable examples and tests once |ns3| has been built.
+
+When enabling disabling examples and tests, the precedence rules are as follows:
+
+#. the --enable-examples/--disable-examples configure strings override any .ns3rc file
+#. the --enable-tests/--disable-tests configure strings override any .ns3rc file
+#. the .ns3rc file in the top level |ns3| directory is next consulted, if present
+#. the system searches for ~/.ns3rc if the .ns3rc file was not found in the previous step
+
+If none of the above exists, then examples and tests will not be built.
+
+The maintained version of the .ns3rc file in the |ns3| source code repository resides in the ``utils`` directory. The reason for this is if it were in the top-level directory of the repository, it would be prone to accidental checkins from maintainers that enable the modules they want to use. Therefore, users need to manually copy the .ns3rc from the ``utils`` directory to their preferred place (top level directory or their home directory) to enable persistent enabling of examples and tests.
+
+Assuming that you are in the top level |ns3| directory, you can get a copy of the .ns3rc file that is in the ``utils`` directory as follows: ::
+
+ cp utils/.ns3rc .
+
+The .ns3rc file should now be in your top level |ns3| directory, and it contains the following: ::
+
+ #! /usr/bin/env python
+
+ # A list of the modules that will be enabled when ns-3 is run.
+ # Modules that depend on the listed modules will be enabled also.
+ #
+ # All modules can be enabled by choosing 'all_modules'.
+ modules_enabled = ['all_modules']
+
+ # Set this equal to true if you want examples to be run.
+ examples_enabled = False
+
+ # Set this equal to true if you want tests to be run.
+ tests_enabled = False
+
+From the top level |ns3| directory, you can build |ns3| without any
+examples or tests simply by doing: ::
+
+ ./waf configure
+ ./waf build
+
+Running test.py now will cause no examples or tests to be run: ::
+
+ 0 of 0 tests passed (0 passed, 0 skipped, 0 failed, 0 crashed, 0 valgrind errors)
+
+If you would like build |ns3| with examples and tests, use your
+favorite editor to change the values in the .ns3rc file for
+examples_enabled and tests_enabled file to be True: ::
+
+ #! /usr/bin/env python
+
+ # A list of the modules that will be enabled when ns-3 is run.
+ # Modules that depend on the listed modules will be enabled also.
+ #
+ # All modules can be enabled by choosing 'all_modules'.
+ modules_enabled = ['all_modules']
+
+ # Set this equal to true if you want examples to be run.
+ examples_enabled = True
+
+ # Set this equal to true if you want tests to be run.
+ tests_enabled = True
+
+From the top level |ns3| directory, you can build |ns3| with examples
+and tests simply by doing: ::
+
+ ./waf configure
+ ./waf build
+
+Running test.py will cause all of the examples and tests to be run: ::
+
+ 170 of 170 tests passed (170 passed, 0 skipped, 0 failed, 0 crashed, 0 valgrind errors)
diff --git a/doc/manual/source/flow-monitor.rst b/doc/manual/source/flow-monitor.rst
deleted file mode 100644
index a3832ee9d..000000000
--- a/doc/manual/source/flow-monitor.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-Flow Monitor
-------------
-
-*Placeholder chapter*
-
-This feature was added as contributed code (``src/contrib``) in *ns-3.6* and to
-the main distribution for *ns-3.7*. A paper on this feature is published in the
-proceedings of NSTools: ``_.
diff --git a/doc/testing/source/how-to-write-tests.rst b/doc/manual/source/how-to-write-tests.rst
similarity index 96%
rename from doc/testing/source/how-to-write-tests.rst
rename to doc/manual/source/how-to-write-tests.rst
index 9280a5371..3920c4fce 100644
--- a/doc/testing/source/how-to-write-tests.rst
+++ b/doc/manual/source/how-to-write-tests.rst
@@ -31,7 +31,7 @@ TestSuite), these things need to be decided up front:
separately in src/test/ directory). You will have to edit the wscript
file in that directory to compile your new code, if it is a new file.
-See the file ``src/test/sample-test-suite.cc`` and corresponding
+See the file ``src/template/test/sample-test-suite.cc`` and corresponding
wscript file in that directory for a simple example, and see the directories
under ``src/test`` for more complicated examples.
diff --git a/doc/manual/source/index.rst b/doc/manual/source/index.rst
index 92dc3354e..aa235cfb4 100644
--- a/doc/manual/source/index.rst
+++ b/doc/manual/source/index.rst
@@ -1,15 +1,16 @@
.. only:: html or latex
-Welcome to ns-3's manual!
-=========================
+ns-3 Manual
+===========
-This is the *ns-3 manual*. Primary documentation for the ns-3 project is
-available in four forms:
+This is the *ns-3 Manual*. Primary documentation for the ns-3 project is
+available in five forms:
* `ns-3 Doxygen `_: Documentation of the public APIs of the simulator
* `Tutorial `_
-* `Reference Manual `_: *(this document)*
-* `ns-3 wiki `_
+* `Manual `_: *(this document)*
+* `Model Library `_
+* `ns-3 wiki `_
This document is written in `reStructuredText `_ for `Sphinx `_ and is maintained in the
``doc/manual`` directory of ns-3's source code.
@@ -18,9 +19,15 @@ This document is written in `reStructuredText /build/debug/utils/test-runner --basedir=`pwd`
[Thread debugging using libthread_db enabled]
- assert failed. file=../src/core/type-id.cc, line=138, cond="uid <= m_information.size () && uid != 0"
+ assert failed. file=../src/core/model/type-id.cc, line=138, cond="uid <= m_information.size () && uid != 0"
...
Here is another example of how to use valgrind to debug a memory problem
diff --git a/doc/testing/source/overview.rst b/doc/manual/source/test-overview.rst
similarity index 100%
rename from doc/testing/source/overview.rst
rename to doc/manual/source/test-overview.rst
diff --git a/doc/manual/source/tests.rst b/doc/manual/source/tests.rst
new file mode 100644
index 000000000..43f502cc4
--- /dev/null
+++ b/doc/manual/source/tests.rst
@@ -0,0 +1,9 @@
+Tests
+-----
+
+.. toctree::
+
+ test-overview
+ test-background
+ test-framework
+ how-to-write-tests
diff --git a/doc/manual/source/tracing.rst b/doc/manual/source/tracing.rst
index d1f4ef6c5..9f138bfb2 100644
--- a/doc/manual/source/tracing.rst
+++ b/doc/manual/source/tracing.rst
@@ -365,7 +365,7 @@ Pcap Tracing Device Helpers
The goal of these helpers is to make it easy to add a consistent pcap trace
facility to an |ns3| device. We want all of the various flavors of pcap tracing
to work the same across all devices, so the methods of these helpers are
-inherited by device helpers. Take a look at ``src/helper/trace-helper.h`` if you
+inherited by device helpers. Take a look at ``src/network/helper/trace-helper.h`` if you
want to follow the discussion while looking at real code.
The class ``PcapHelperForDevice`` is a ``mixin`` provides the high level
@@ -515,7 +515,7 @@ Ascii Tracing Device Helpers
++++++++++++++++++++++++++++
The behavior of the ascii trace helper ``mixin`` is substantially similar to
-the pcap version. Take a look at ``src/helper/trace-helper.h`` if you want to
+the pcap version. Take a look at ``src/network/helper/trace-helper.h`` if you want to
follow the discussion while looking at real code.
The class ``AsciiTraceHelperForDevice`` adds the high level functionality for
@@ -721,7 +721,7 @@ Pcap Tracing Protocol Helpers
The goal of these ``mixins`` is to make it easy to add a consistent pcap trace
facility to protocols. We want all of the various flavors of pcap tracing to
work the same across all protocols, so the methods of these helpers are
-inherited by stack helpers. Take a look at ``src/helper/trace-helper.h`` if you
+inherited by stack helpers. Take a look at ``src/network/helper/trace-helper.h`` if you
want to follow the discussion while looking at real code.
In this section we will be illustrating the methods as applied to the protocol
@@ -858,7 +858,7 @@ Ascii Tracing Protocol Helpers
++++++++++++++++++++++++++++++
The behavior of the ascii trace helpers is substantially similar to the pcap
-case. Take a look at ``src/helper/trace-helper.h`` if you want to follow the
+case. Take a look at ``src/network/helper/trace-helper.h`` if you want to follow the
discussion while looking at real code.
In this section we will be illustrating the methods as applied to the protocol
diff --git a/doc/testing/Makefile b/doc/models/Makefile
similarity index 53%
rename from doc/testing/Makefile
rename to doc/models/Makefile
index 215b27606..3354b136f 100644
--- a/doc/testing/Makefile
+++ b/doc/models/Makefile
@@ -2,10 +2,115 @@ EPSTOPDF = epstopdf
DIA = dia
CONVERT = convert
-FIGURES = figures
-VPATH = $(FIGURES)
+SRC = ../../src
+# Temporary source directory, for build
+SOURCETEMP = source-temp
+FIGURES = $(SOURCETEMP)/figures
+# list all model library .rst files that need to be copied to $SOURCETEMP
+SOURCES = \
+ source/conf.py \
+ source/_static \
+ source/index.rst \
+ source/replace.txt \
+ source/organization.rst \
+ source/internet-models.rst \
+ source/network.rst \
+ source/devices.rst \
+ source/routing.rst \
+ source/emulation-overview.rst \
+ source/support.rst \
+ $(SRC)/applications/doc/applications.rst \
+ $(SRC)/bridge/doc/bridge.rst \
+ $(SRC)/click/doc/click.rst \
+ $(SRC)/csma/doc/csma.rst \
+ $(SRC)/mpi/doc/distributed.rst \
+ $(SRC)/energy/doc/energy.rst \
+ $(SRC)/emu/doc/emu.rst \
+ $(SRC)/tap-bridge/doc/tap.rst \
+ $(SRC)/mesh/doc/mesh.rst \
+ $(SRC)/lte/doc/lte.rst \
+ $(SRC)/lte/doc/lte-user.rst \
+ $(SRC)/lte/doc/lte-design.rst \
+ $(SRC)/lte/doc/lte-testing.rst \
+ $(SRC)/propagation/doc/propagation.rst \
+ $(SRC)/network/doc/network-overview.rst \
+ $(SRC)/network/doc/packets.rst \
+ $(SRC)/network/doc/sockets-api.rst \
+ $(SRC)/network/doc/simple.rst \
+ $(SRC)/internet/doc/internet-stack.rst \
+ $(SRC)/internet/doc/ipv4.rst \
+ $(SRC)/internet/doc/ipv6.rst \
+ $(SRC)/internet/doc/routing-overview.rst \
+ $(SRC)/internet/doc/tcp.rst \
+ $(SRC)/openflow/doc/openflow-switch.rst \
+ $(SRC)/point-to-point/doc/point-to-point.rst \
+ $(SRC)/wifi/doc/wifi.rst \
+ $(SRC)/wimax/doc/wimax.rst \
+ $(SRC)/uan/doc/uan.rst \
+ $(SRC)/stats/doc/statistics.rst \
+ $(SRC)/netanim/doc/animation.rst \
+ $(SRC)/flow-monitor/doc/flow-monitor.rst \
+
+# list all model library figure files that need to be copied to
+# $SOURCETEMP/figures. Either a .dia or both a .pdf and .png
+SOURCEFIGS = \
+ figures/testbed.dia \
+ figures/emulated-channel.dia \
+ $(SRC)/network/doc/packet.dia \
+ $(SRC)/network/doc/node.dia \
+ $(SRC)/network/doc/buffer.dia \
+ $(SRC)/network/doc/sockets-overview.dia \
+ $(SRC)/internet/doc/internet-node-send.dia \
+ $(SRC)/internet/doc/internet-node-recv.dia \
+ $(SRC)/internet/doc/routing.dia \
+ $(SRC)/internet/doc/routing-specialization.dia \
+ $(SRC)/wifi/doc/WifiArchitecture.dia \
+ $(SRC)/wifi/doc/snir.dia \
+ $(SRC)/wimax/doc/WimaxArchitecture.dia \
+ $(SRC)/lte/doc/ff-mac-saps.dia \
+ $(SRC)/lte/doc/ff-example.dia \
+ $(SRC)/lte/doc/lte-enb-architecture.dia \
+ $(SRC)/lte/doc/lte-ue-architecture.dia \
+ $(SRC)/uan/doc/auvmobility-classes.dia \
+ $(SRC)/netanim/doc/animation-dumbbell.png \
+ $(SRC)/netanim/doc/animation-dumbbell.pdf \
+
+# specify figures for build process (all dia figures)
IMAGES_EPS = \
+ $(FIGURES)/testbed.eps \
+ $(FIGURES)/emulated-channel.eps \
+ $(FIGURES)/packet.eps \
+ $(FIGURES)/node.eps \
+ $(FIGURES)/buffer.eps \
+ $(FIGURES)/sockets-overview.eps \
+ $(FIGURES)/internet-node-send.eps \
+ $(FIGURES)/internet-node-recv.eps \
+ $(FIGURES)/routing.eps \
+ $(FIGURES)/routing-specialization.eps \
+ $(FIGURES)/WifiArchitecture.eps \
+ $(FIGURES)/snir.eps \
+ $(FIGURES)/WimaxArchitecture.eps \
+ $(FIGURES)/ff-mac-saps.eps \
+ $(FIGURES)/ff-example.eps \
+ $(FIGURES)/lte-enb-architecture.eps \
+ $(FIGURES)/lte-ue-architecture.eps \
+ $(FIGURES)/auvmobility-classes.eps \
+
+# rescale figures as necessary
+$(FIGURES)/testbed.pdf_width = 5in
+$(FIGURES)/emulated-channel.pdf_width = 6in
+$(FIGURES)/node.pdf_width = 5in
+$(FIGURES)/packet.pdf_width = 4in
+$(FIGURES)/buffer.pdf_width = 15cm
+$(FIGURES)/sockets-overview.pdf_width = 10cm
+$(FIGURES)/internet-node-send.pdf_width = 5in
+$(FIGURES)/internet-node-recv.pdf_width = 5in
+$(FIGURES)/routing.pdf_width = 6in
+$(FIGURES)/routing-specialization.pdf_width = 5in
+$(FIGURES)/snir.pdf_width = 3in
+$(FIGURES)/lte-transmission.pdf_width = 3in
+$(FIGURES)/auvmobility-classes.pdf_width = 10cm
IMAGES_PNG = ${IMAGES_EPS:.eps=.png}
IMAGES_PDF = ${IMAGES_EPS:.eps=.pdf}
@@ -16,7 +121,6 @@ IMAGES = $(IMAGES_EPS) $(IMAGES_PNG) $(IMAGES_PDF)
%.png : %.dia; $(DIA) -t png $< -e $@
%.pdf : %.eps; $(EPSTOPDF) $< -o=$@; if test x$($@_width) != x; then TMPFILE=`mktemp`; ./rescale-pdf.sh $($@_width) $@ $${TMPFILE} && mv $${TMPFILE} $@; fi
-
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
@@ -26,7 +130,7 @@ BUILDDIR = build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
-ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SOURCETEMP)
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
@@ -49,47 +153,54 @@ help:
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
+copy-sources: $(SOURCES)
+ @rm -rf $(SOURCETEMP)
+ @mkdir -p $(SOURCETEMP)
+ @mkdir -p $(FIGURES)
+ @cp -r $(SOURCES) $(SOURCETEMP)
+ @cp -r $(SOURCEFIGS) $(FIGURES)
+
clean:
-rm -rf $(BUILDDIR)/*
- -rm -rf $(IMAGES)
+ -rm -rf $(SOURCETEMP)
frag: pickle
@if test ! -d $(BUILDDIR)/frag; then mkdir $(BUILDDIR)/frag; fi
pushd $(BUILDDIR)/frag && ../../pickle-to-xml.py ../pickle/index.fpickle > navigation.xml && popd
cp -r $(BUILDDIR)/pickle/_images $(BUILDDIR)/frag
-html: $(IMAGES)
+html: copy-sources $(IMAGES)
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
-dirhtml: $(IMAGES)
+dirhtml: copy-sources $(IMAGES)
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
-singlehtml: $(IMAGES)
+singlehtml: copy-sources $(IMAGES)
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
-pickle: $(IMAGES)
+pickle: copy-sources $(IMAGES)
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
-json: $(IMAGES)
+json: copy-sources $(IMAGES)
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
-htmlhelp: $(IMAGES)
+htmlhelp: copy-sources $(IMAGES)
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
-qthelp: $(IMAGES)
+qthelp: copy-sources $(IMAGES)
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
@@ -98,7 +209,7 @@ qthelp: $(IMAGES)
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/ns-3.qhc"
-devhelp: $(IMAGES)
+devhelp: copy-sources $(IMAGES)
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@@ -107,46 +218,46 @@ devhelp: $(IMAGES)
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/ns-3"
@echo "# devhelp"
-epub: $(IMAGES)
+epub: copy-sources $(IMAGES)
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
-latex: $(IMAGES)
+latex: copy-sources $(IMAGES)
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
-latexpdf: $(IMAGES)
+latexpdf: copy-sources $(IMAGES)
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
make -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
-text: $(IMAGES)
+text: copy-sources $(IMAGES)
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
-man: $(IMAGES)
+man: copy-sources $(IMAGES)
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
-changes: $(IMAGES)
+changes: copy-sources $(IMAGES)
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
-linkcheck: $(IMAGEs)
+linkcheck: copy-sources $(IMAGEs)
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
-doctest: $(IMAGES)
+doctest: copy-sources $(IMAGES)
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
diff --git a/doc/manual/figures/emulated-channel.dia b/doc/models/figures/emulated-channel.dia
similarity index 100%
rename from doc/manual/figures/emulated-channel.dia
rename to doc/models/figures/emulated-channel.dia
diff --git a/doc/manual/figures/testbed.dia b/doc/models/figures/testbed.dia
similarity index 100%
rename from doc/manual/figures/testbed.dia
rename to doc/models/figures/testbed.dia
diff --git a/doc/models/rescale-pdf.sh b/doc/models/rescale-pdf.sh
new file mode 100755
index 000000000..748d998ab
--- /dev/null
+++ b/doc/models/rescale-pdf.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+TMPFILE=`mktemp`
+
+echo "\documentclass{book}
+\usepackage{pdfpages}
+\begin{document}
+\includepdf[width=${1},fitpaper]{${2}}
+\end{document}" >${TMPFILE}.tex
+pdflatex -output-directory /tmp ${TMPFILE}.tex >/dev/null 2>/dev/null
+cp ${TMPFILE}.pdf ${3}
+
diff --git a/doc/models/source/README b/doc/models/source/README
new file mode 100644
index 000000000..a19caf16e
--- /dev/null
+++ b/doc/models/source/README
@@ -0,0 +1,2 @@
+This directory stores .rst files that are used to build the model library
+documentation but that are not stored with a particular module.
diff --git a/doc/testing/source/_static/.hidden b/doc/models/source/_static/.hidden
similarity index 100%
rename from doc/testing/source/_static/.hidden
rename to doc/models/source/_static/.hidden
diff --git a/doc/testing/source/conf.py b/doc/models/source/conf.py
similarity index 97%
rename from doc/testing/source/conf.py
rename to doc/models/source/conf.py
index 0521b3ce5..23a7278ce 100644
--- a/doc/testing/source/conf.py
+++ b/doc/models/source/conf.py
@@ -41,16 +41,16 @@ master_doc = 'index'
# General information about the project.
project = u'ns-3'
-copyright = u'2010, ns-3 project'
+copyright = u'2011, ns-3 project'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
-version = 'ns-3.10'
+version = 'ns-3.11'
# The full version, including alpha/beta/rc tags.
-release = 'ns-3.10'
+release = 'ns-3.11'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -178,7 +178,7 @@ htmlhelp_basename = 'ns-3doc'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
- ('index', 'ns-3.tex', u'ns-3 Testing and Validation',
+ ('index', 'ns-3-model-library.tex', u'ns-3 Model Library',
u'ns-3 project', 'manual'),
]
@@ -211,6 +211,6 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
- ('index', 'ns-3', u'ns-3 Documentation',
+ ('index', 'ns-3-model-library', u'ns-3 Model Library',
[u'ns-3 project'], 1)
]
diff --git a/doc/models/source/devices.rst b/doc/models/source/devices.rst
new file mode 100644
index 000000000..249603c2e
--- /dev/null
+++ b/doc/models/source/devices.rst
@@ -0,0 +1,14 @@
+Devices and Channels
+--------------------
+
+.. toctree::
+
+ bridge
+ csma
+ lte
+ point-to-point
+ mesh
+ wifi
+ wimax
+ simple
+ uan
diff --git a/doc/manual/source/emulation-overview.rst b/doc/models/source/emulation-overview.rst
similarity index 99%
rename from doc/manual/source/emulation-overview.rst
rename to doc/models/source/emulation-overview.rst
index 3effd4a4c..f418abda3 100644
--- a/doc/manual/source/emulation-overview.rst
+++ b/doc/models/source/emulation-overview.rst
@@ -69,3 +69,8 @@ channel.
We expect the typical use case for this environment will be to analyze the
behavior of native applications and protocol suites in the presence of large
simulated |ns3| networks.
+
+.. toctree::
+
+ emu
+ tap
diff --git a/doc/models/source/index.rst b/doc/models/source/index.rst
new file mode 100644
index 000000000..36b28e678
--- /dev/null
+++ b/doc/models/source/index.rst
@@ -0,0 +1,31 @@
+.. only:: html or latex
+
+ns-3 Model Library
+==================
+
+This is the *ns-3 Model Library* documentation. Primary documentation for the ns-3 project is
+available in five forms:
+
+* `ns-3 Doxygen `_: Documentation of the public APIs of the simulator
+* `Tutorial `_
+* `Manual `_
+* `Model Library `_: *(this document)*
+* `ns-3 wiki `_
+
+This document is written in `reStructuredText `_ for `Sphinx `_ and is maintained in the
+``doc/models`` directory of ns-3's source code.
+
+.. toctree::
+ :maxdepth: 2
+
+ organization
+ network
+ devices
+ propagation
+ energy
+ internet-models
+ routing
+ distributed
+ emulation-overview
+ applications
+ support
diff --git a/doc/manual/source/internet-models.rst b/doc/models/source/internet-models.rst
similarity index 71%
rename from doc/manual/source/internet-models.rst
rename to doc/models/source/internet-models.rst
index cca4c0317..4a68131b6 100644
--- a/doc/manual/source/internet-models.rst
+++ b/doc/models/source/internet-models.rst
@@ -3,10 +3,8 @@ Internet Models
.. toctree::
- sockets-api
internet-stack
ipv4
ipv6
- routing
- click
+ routing-overview
tcp
diff --git a/doc/models/source/network.rst b/doc/models/source/network.rst
new file mode 100644
index 000000000..6f3373a97
--- /dev/null
+++ b/doc/models/source/network.rst
@@ -0,0 +1,9 @@
+Network Module
+--------------
+
+.. toctree::
+
+ packets
+ network-overview
+ sockets-api
+ simple
diff --git a/doc/models/source/organization.rst b/doc/models/source/organization.rst
new file mode 100644
index 000000000..c6cfddf5a
--- /dev/null
+++ b/doc/models/source/organization.rst
@@ -0,0 +1,52 @@
+.. include:: replace.txt
+
+Organization
+------------
+
+This manual compiles documentation for |ns3| models and supporting
+software that enable users to construct network simulations.
+It is important to distinguish between **modules** and **models**:
+
+* |ns3| software is organized into separate *modules* that are each
+ built as a separate software library. Individual ns-3 programs can link
+ the modules (libraries) they need to conduct their simulation.
+
+* |ns3| *models* are abstract representations of real-world objects,
+ protocols, devices, etc.
+
+An |ns3| module may consist of more than one model (for instance, the
+:mod:`internet` model contains models for both TCP and UDP). In general,
+ns-3 models do not span multiple software modules, however.
+
+This manual provides documentation about the models of |ns3|. It
+complements two other sources of documentation concerning models:
+
+* the model APIs are documented, from a programming perspective, using
+ `Doxygen `_. Doxygen for ns-3 models is available
+ `on the project web server `_.
+
+* the |ns3| core is documented in the developer's manual. |ns3| models make
+ use of the facilities of the core, such as attributes, default values,
+ random numbers, test frameworks, etc. Consult the
+ `main web site `_ to find copies of the manual.
+
+Finally, additional documentation about various aspects of |ns3| may
+exist on the `project wiki `_).
+
+We organize this model library documentation loosely as follows.
+We start with the models found in the ``src/network`` module, as this
+module contains some fundamental models for the simulator.
+The packet model, models for different address formats, and abstract
+base classes for objects such as nodes, net devices, channels, sockets, and
+applications are discussed here.
+
+We next group documentation under the following major headings:
+
+* Devices and Channels
+* Emulation
+* Internet Models
+* Applications
+* Support
+
+A sample outline of how to write model library documentation can be
+found in :mod:`src/template/doc`.
diff --git a/doc/testing/source/replace.txt b/doc/models/source/replace.txt
similarity index 100%
rename from doc/testing/source/replace.txt
rename to doc/models/source/replace.txt
diff --git a/doc/models/source/routing.rst b/doc/models/source/routing.rst
new file mode 100644
index 000000000..b9eb41d0f
--- /dev/null
+++ b/doc/models/source/routing.rst
@@ -0,0 +1,7 @@
+Routing and Switching
+---------------------
+
+.. toctree::
+
+ click
+ openflow-switch
diff --git a/doc/models/source/support.rst b/doc/models/source/support.rst
new file mode 100644
index 000000000..367c193b3
--- /dev/null
+++ b/doc/models/source/support.rst
@@ -0,0 +1,8 @@
+Support
+-------
+
+.. toctree::
+
+ flow-monitor
+ animation
+ statistics
diff --git a/doc/modules b/doc/modules
index c3c419094..f58e8f671 100644
--- a/doc/modules
+++ b/doc/modules
@@ -1,15 +1,22 @@
/**
* @anchor modules_anchor
*
- * @defgroup simulator Simulator
- * The "simulator" module contains:
+ * @defgroup constructs C++ Constructs Used by All Modules
+ * \brief These are C++ constructs defined by the modules.
+ *
+ * @defgroup constants Constants
+ * @brief Constants you can change
+ *
+ * @defgroup utils Utils
+ * @brief The utils directory is for various programs and scripts related
+ * to code coverage, test suites, style checking, and benchmarking.
+ *
+ * @defgroup core Core
+ * \brief The "core" module contains:
* - a time management class to hold a time and convert between various time units: ns3::Time
* - a scheduler base class used to implement new simulation event schedulers:
* ns3::Scheduler and ns3::SchedulerFactory
* - a simulator class used to create, schedule and cancel events: ns3::Simulator
- *
- * @defgroup core Core
- * \brief The "core" module contains:
* - a Functor class: ns3::Callback
* - an os-independent interface to get access to the elapsed wall clock time: ns3::SystemWallClockMs
* - a class to register regression tests with the test manager: ns3::Test and ns3::TestManager
@@ -23,15 +30,12 @@
* - a configuration class used to set and control all attributes and trace sources
* in a simulation: ns3::Config.
*
- * @defgroup common Common
- * The "common" module contains:
+ * @defgroup network Network
+ * The "network" module contains:
* - a packet class to create and manipulate simulation packets:
* ns3::Packet, ns3::Header, and ns3::Trailer. This packet class
* also supports per-packet ns3::Tag which are globs of data
* which can be attached to any packet.
- *
- * @defgroup node Node
- * The "node" module contains:
* - a ns3::Node base class which should be subclassed by any new type of
* network Node.
* - models which abstract the MAC-layer from the IP layer protocols:
@@ -39,31 +43,15 @@
* - models which abstract the application-layer API: ns3::Application,
* ns3::Socket, ns3::SocketFactory, and, ns3::Udp
*
- *
- * @defgroup devices Devices
- *
- * @defgroup internetStack InternetStack
+ * @defgroup internet Internet
*
- * The "internet-stack" module contains:
+ * The "internet" module contains:
* - an Ipv4 stack
* - an Ipv6 stack
* - an ARP module
* - a UDP and a TCP implementation
*
- * @defgroup routing Routing
- *
- * @defgroup helper Helpers
- *
* @defgroup applications Applications
*
* @defgroup mobility Mobility
- *
- * @defgroup constants Constants
- * @brief Constants you can change
- *
- * @defgroup utils Utils
- * @brief The utils directory is for various programs and scripts related
- * to code coverage, test suites, style checking, and benchmarking.
- *
- * @defgroup contrib Contrib
*/
diff --git a/doc/testing/pickle-to-xml.py b/doc/testing/pickle-to-xml.py
deleted file mode 100755
index be3126cf6..000000000
--- a/doc/testing/pickle-to-xml.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/python
-
-
-# output xml format:
-#
-# zzz lll file.frag
-# ...
-#
-
-import pickle
-import os
-import codecs
-
-def dump_pickles(out, dirname, filename, path):
- f = open(os.path.join(dirname, filename), 'r')
- data = pickle.load(f)
- fragment_file = codecs.open(data['current_page_name'] + '.frag', mode='w', encoding='utf-8')
- fragment_file.write(data['body'])
- fragment_file.close()
- out.write(' \n' % path)
- out.write(' %s.frag \n' % data['current_page_name'])
- if data['prev'] is not None:
- out.write(' %s \n' %
- (os.path.normpath(os.path.join(path, data['prev']['link'])),
- data['prev']['title']))
- if data['next'] is not None:
- out.write(' %s \n' %
- (os.path.normpath(os.path.join(path, data['next']['link'])),
- data['next']['title']))
- out.write(' \n')
- f.close()
- if data['next'] is not None:
- next_path = os.path.normpath(os.path.join(path, data['next']['link']))
- next_filename = os.path.basename(next_path) + '.fpickle'
- dump_pickles(out, dirname, next_filename, next_path)
- return
-
-import sys
-
-sys.stdout.write('\n')
-dump_pickles(sys.stdout, os.path.dirname(sys.argv[1]), os.path.basename(sys.argv[1]), '/')
-sys.stdout.write(' ')
diff --git a/doc/testing/source/index.rst b/doc/testing/source/index.rst
deleted file mode 100644
index 2a9c64011..000000000
--- a/doc/testing/source/index.rst
+++ /dev/null
@@ -1,23 +0,0 @@
-.. only:: html or latex
-
-Welcome to ns-3's testing and validation documentation!
-=======================================================
-
-This is the *ns-3 testing manual*. Primary documentation for the ns-3 project is
-available in four forms:
-
-* `ns-3 Doxygen `_: Documentation of the public APIs of the simulator
-* `Tutorial `_
-* `Reference Manual `_
-* `ns-3 wiki `_
-
-This document is written in `reStructuredText `_ for `Sphinx `_ and is maintained in the
-``doc/testing`` directory of ns-3's source code.
-
-.. toctree::
- :maxdepth: 2
-
- overview
- background
- testing-framework
- how-to-write-tests
diff --git a/doc/tutorial/source/building-topologies.rst b/doc/tutorial/source/building-topologies.rst
index 71b8d4275..3c4666f99 100644
--- a/doc/tutorial/source/building-topologies.rst
+++ b/doc/tutorial/source/building-topologies.rst
@@ -38,9 +38,12 @@ The actual code begins by loading module include files just as was done in the
::
#include "ns3/core-module.h"
- #include "ns3/simulator-module.h"
- #include "ns3/node-module.h"
- #include "ns3/helper-module.h"
+ #include "ns3/network-module.h"
+ #include "ns3/csma-module.h"
+ #include "ns3/internet-module.h"
+ #include "ns3/point-to-point-module.h"
+ #include "ns3/applications-module.h"
+ #include "ns3/ipv4-global-routing-helper.h"
One thing that can be surprisingly useful is a small bit of ASCII art that
shows a cartoon of the network topology constructed in the example. You will
@@ -805,11 +808,12 @@ to the Wifi module and the mobility module which we will discuss below.
::
#include "ns3/core-module.h"
-#include "ns3/simulator-module.h"
-#include "ns3/node-module.h"
-#include "ns3/helper-module.h"
-#include "ns3/wifi-module.h"
-#include "ns3/mobility-module.h"
+#include "ns3/network-module.h"
+#include "ns3/csma-module.h"
+#include "ns3/internet-module.h"
+#include "ns3/point-to-point-module.h"
+#include "ns3/applications-module.h"
+#include "ns3/ipv4-global-routing-helper.h"
The network topology illustration follows:
diff --git a/doc/tutorial/source/conceptual-overview.rst b/doc/tutorial/source/conceptual-overview.rst
index a1cb165c6..06ee0f4a3 100644
--- a/doc/tutorial/source/conceptual-overview.rst
+++ b/doc/tutorial/source/conceptual-overview.rst
@@ -220,9 +220,10 @@ The code proper starts with a number of include statements.
::
#include "ns3/core-module.h"
- #include "ns3/simulator-module.h"
- #include "ns3/node-module.h"
- #include "ns3/helper-module.h"
+ #include "ns3/network-module.h"
+ #include "ns3/internet-module.h"
+ #include "ns3/point-to-point-module.h"
+ #include "ns3/applications-module.h"
To help our high-level script users deal with the large number of include
files present in the system, we group includes according to relatively large
@@ -835,5 +836,5 @@ you will find (as of this writing) is ``abort.h``. If you click on the
contains useful macros for exiting scripts if abnormal conditions are detected.
The source code for the helpers we have used in this chapter can be found in the
-``src/helper`` directory. Feel free to poke around in the directory tree to
+``src/applications/helper`` directory. Feel free to poke around in the directory tree to
get a feel for what is there and the style of |ns3| programs.
diff --git a/doc/tutorial/source/conf.py b/doc/tutorial/source/conf.py
index 41c66bd6e..7c0a9a952 100644
--- a/doc/tutorial/source/conf.py
+++ b/doc/tutorial/source/conf.py
@@ -178,7 +178,7 @@ htmlhelp_basename = 'ns-3doc'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
- ('index', 'ns-3.tex', u'ns-3 Tutorial',
+ ('index', 'ns-3-tutorial.tex', u'ns-3 Tutorial',
u'ns-3 project', 'manual'),
]
@@ -211,6 +211,6 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
- ('index', 'ns-3', u'ns-3 Tutorial',
+ ('index', 'ns-3-tutorial', u'ns-3 Tutorial',
[u'ns-3 project'], 1)
]
diff --git a/doc/tutorial/source/introduction.rst b/doc/tutorial/source/introduction.rst
index 1b489a01a..2094ffef4 100644
--- a/doc/tutorial/source/introduction.rst
+++ b/doc/tutorial/source/introduction.rst
@@ -96,7 +96,6 @@ contribute to |ns3| like they have for ns-2:
`_ page, similar to ns-2's popular Contributed Code
`page
`_;
-* ``src/contrib`` directory (we will host your contributed code);
* Open `bug tracker
`_;
* |ns3| developers will gladly help potential contributors to get
diff --git a/doc/tutorial/source/tracing.rst b/doc/tutorial/source/tracing.rst
index fa1d52400..92e3e43db 100644
--- a/doc/tutorial/source/tracing.rst
+++ b/doc/tutorial/source/tracing.rst
@@ -556,7 +556,7 @@ are familiar with ``GetObject``, we have asked the system to do the following:
We are now at the last Object in the path, so we turn our attention to the
Attributes of that Object. The ``MobilityModel`` class defines an Attribute
called "CourseChange". You can see this by looking at the source code in
-``src/mobility/mobility-model.cc`` and searching for "CourseChange" in your
+``src/mobility/model/mobility-model.cc`` and searching for "CourseChange" in your
favorite editor. You should find,
::
@@ -931,7 +931,7 @@ by looking at the includes in ``mobility-model.h`` and noticing the
include of ``traced-callback.h`` and inferring that this must be the file
you want.
-In either case, the next step is to take a look at ``src/core/traced-callback.h``
+In either case, the next step is to take a look at ``src/core/model/traced-callback.h``
in your favorite editor to see what is happening.
You will see a comment at the top of the file that should be comforting:
@@ -1091,7 +1091,7 @@ Earlier in this section, we presented a simple piece of code that used a
``TracedValue`` to demonstrate the basics of the tracing code.
We just glossed over the way to find the return type and formal arguments
for the ``TracedValue``. Rather than go through the whole exercise, we
-will just point you at the correct file, ``src/core/traced-value.h`` and
+will just point you at the correct file, ``src/core/model/traced-value.h`` and
to the important piece of code:
::
@@ -1178,8 +1178,8 @@ through the list, you will eventually find:
CongestionWindow: The TCP connection's congestion window
It turns out that the |ns3| TCP implementation lives (mostly) in the
-file ``src/internet-stack/tcp-socket-base.cc`` while congestion control
-variants are in files such as ``src/internet-stack/tcp-newreno.cc``.
+file ``src/internet/model/tcp-socket-base.cc`` while congestion control
+variants are in files such as ``src/internet/model/tcp-newreno.cc``.
If you don't know this a priori, you can use the recursive grep trick:
::
@@ -1188,7 +1188,7 @@ If you don't know this a priori, you can use the recursive grep trick:
You will find page after page of instances of tcp pointing you to that file.
-If you open ``src/internet-stack/tcp-newreno.cc`` in your favorite
+If you open ``src/internet/model/tcp-newreno.cc`` in your favorite
editor, you will see right up at the top of the file, the following declarations:
::
@@ -1207,7 +1207,7 @@ editor, you will see right up at the top of the file, the following declarations
}
This should tell you to look for the declaration of ``m_cWnd`` in the header
-file ``src/internet-stack/tcp-newreno.h``. If you open this file in your
+file ``src/internet/model/tcp-newreno.h``. If you open this file in your
favorite editor, you will find:
::
@@ -1339,10 +1339,10 @@ favorite editor. You should see some familiar looking code:
#include
#include "ns3/core-module.h"
- #include "ns3/common-module.h"
- #include "ns3/simulator-module.h"
- #include "ns3/node-module.h"
- #include "ns3/helper-module.h"
+ #include "ns3/network-module.h"
+ #include "ns3/internet-module.h"
+ #include "ns3/point-to-point-module.h"
+ #include "ns3/applications-module.h"
using namespace ns3;
@@ -1424,7 +1424,7 @@ we put together to allow the ``Socket`` to be created at configuration time.
};
You can see that this class inherits from the |ns3| ``Application``
-class. Take a look at ``src/node/application.h`` if you are interested in
+class. Take a look at ``src/network/model/application.h`` if you are interested in
what is inherited. The ``MyApp`` class is obligated to override the
``StartApplication`` and ``StopApplication`` methods. These methods are
automatically called when ``MyApp`` is required to start and stop sending
@@ -1451,7 +1451,7 @@ This is done as the result of the following (hopefully) familar lines of an
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
-The application container code (see ``src/helper/application-container.h`` if
+The application container code (see ``src/network/helper/application-container.h`` if
you are interested) loops through its contained applications and calls,
::
@@ -1482,7 +1482,7 @@ ignore the implementation details of how your ``Application`` is
"automagically" called by the simulator at the correct time. But since
we have already ventured deep into |ns3| already, let's go for it.
-If you look at ``src/node/application.cc`` you will find that the
+If you look at ``src/network/model/application.cc`` you will find that the
``SetStartTime`` method of an ``Application`` just sets the member
variable ``m_startTime`` and the ``SetStopTime`` method just sets
``m_stopTime``. From there, without some hints, the trail will probably
@@ -1492,7 +1492,7 @@ The key to picking up the trail again is to know that there is a global
list of all of the nodes in the system. Whenever you create a node in
a simulation, a pointer to that node is added to the global ``NodeList``.
-Take a look at ``src/node/node-list.cc`` and search for
+Take a look at ``src/network/model/node-list.cc`` and search for
``NodeList::Add``. The public static implementation calls into a private
implementation called ``NodeListPriv::Add``. This is a relatively common
idom in |ns3|. So, take a look at ``NodeListPriv::Add``. There
@@ -1512,13 +1512,13 @@ to start doing something.
So, ``NodeList::Add`` indirectly schedules a call to ``Node::Start``
at time zero to advise a new node that the simulation has started. If you
-look in ``src/node/node.h`` you will, however, not find a method called
+look in ``src/network/model/node.h`` you will, however, not find a method called
``Node::Start``. It turns out that the ``Start`` method is inherited
from class ``Object``. All objects in the system can be notified when
the simulation starts, and objects of class ``Node`` are just one kind
of those objects.
-Take a look at ``src/core/object.cc`` next and search for ``Object::Start``.
+Take a look at ``src/core/model/object.cc`` next and search for ``Object::Start``.
This code is not as straightforward as you might have expected since
|ns3| ``Objects`` support aggregation. The code in
``Object::Start`` then loops through all of the objects that have been
@@ -1530,7 +1530,7 @@ something like ``MethodName`` for the public API and ``DoMethodName`` for
the private API.
This tells us that we should look for a ``Node::DoStart`` method in
-``src/node/node.cc`` for the method that will continue our trail. If you
+``src/network/model/node.cc`` for the method that will continue our trail. If you
locate the code, you will find a method that loops through all of the devices
in the node and then all of the applications in the node calling
``device->Start`` and ``application->Start`` respectively.
@@ -1538,7 +1538,7 @@ in the node and then all of the applications in the node calling
You may already know that classes ``Device`` and ``Application`` both
inherit from class ``Object`` and so the next step will be to look at
what happens when ``Application::DoStart`` is called. Take a look at
-``src/node/application.cc`` and you will find:
+``src/network/model/application.cc`` and you will find:
::
@@ -1766,9 +1766,9 @@ add an error model to this code also, so we wanted to demonstrate this working.
This trace sink will be connected to the "PhyRxDrop" trace source of the
point-to-point NetDevice. This trace source fires when a packet is dropped
by the physical layer of a ``NetDevice``. If you take a small detour to the
-source (``src/devices/point-to-point/point-to-point-net-device.cc``) you will
+source (``src/point-to-point/model/point-to-point-net-device.cc``) you will
see that this trace source refers to ``PointToPointNetDevice::m_phyRxDropTrace``.
-If you then look in ``src/devices/point-to-point/point-to-point-net-device.h``
+If you then look in ``src/point-to-point/model/point-to-point-net-device.h``
for this member variable, you will find that it is declared as a
``TracedCallback >``. This should tell you that the
callback target should be a function that returns void and takes a single
@@ -2138,7 +2138,7 @@ is going to contain packets prefixed with point to point headers. This is true
since the packets are coming from our point-to-point device driver. Other
common data link types are DLT_EN10MB (10 MB Ethernet) appropriate for csma
devices and DLT_IEEE802_11 (IEEE 802.11) appropriate for wifi devices. These
-are defined in ``src/helper/trace-helper.h"`` if you are interested in seeing
+are defined in ``src/network/helper/trace-helper.h"`` if you are interested in seeing
the list. The entries in the list match those in ``bpf.h`` but we duplicate
them to avoid a pcap source dependence.
@@ -2161,7 +2161,7 @@ pointer to a reference counted object that is a very lightweight thing.
Remember to always look at the object you are referencing before making any
assumptions about the "powers" that object may have.
-For example, take a look at ``src/common/pcap-file-object.h`` in the
+For example, take a look at ``src/network/model/pcap-file-object.h`` in the
distribution and notice,
::
@@ -2169,7 +2169,7 @@ distribution and notice,
class PcapFileWrapper : public Object
that class ``PcapFileWrapper`` is an |ns3| Object by virtue of
-its inheritance. Then look at ``src/common/output-stream-wrapper.h`` and
+its inheritance. Then look at ``src/network/model/output-stream-wrapper.h`` and
notice,
::
@@ -2327,7 +2327,7 @@ The goal of these helpers is to make it easy to add a consistent pcap trace
facility to an |ns3| device. We want all of the various flavors of
pcap tracing to work the same across all devices, so the methods of these
helpers are inherited by device helpers. Take a look at
-``src/helper/trace-helper.h`` if you want to follow the discussion while
+``src/network/helper/trace-helper.h`` if you want to follow the discussion while
looking at real code.
The class ``PcapHelperForDevice`` is a ``mixin`` provides the high level
@@ -2500,7 +2500,7 @@ Ascii Tracing Device Helpers
++++++++++++++++++++++++++++
The behavior of the ascii trace helper ``mixin`` is substantially similar to
-the pcap version. Take a look at ``src/helper/trace-helper.h`` if you want to
+the pcap version. Take a look at ``src/network/helper/trace-helper.h`` if you want to
follow the discussion while looking at real code.
The class ``AsciiTraceHelperForDevice`` adds the high level functionality for
@@ -2743,7 +2743,7 @@ Pcap Tracing Protocol Helpers
The goal of these ``mixins`` is to make it easy to add a consistent pcap trace
facility to protocols. We want all of the various flavors of pcap tracing to
work the same across all protocols, so the methods of these helpers are
-inherited by stack helpers. Take a look at ``src/helper/trace-helper.h``
+inherited by stack helpers. Take a look at ``src/network/helper/trace-helper.h``
if you want to follow the discussion while looking at real code.
In this section we will be illustrating the methods as applied to the protocol
@@ -2909,7 +2909,7 @@ Ascii Tracing Protocol Helpers
++++++++++++++++++++++++++++++
The behavior of the ascii trace helpers is substantially similar to the pcap
-case. Take a look at ``src/helper/trace-helper.h`` if you want to
+case. Take a look at ``src/network/helper/trace-helper.h`` if you want to
follow the discussion while looking at real code.
In this section we will be illustrating the methods as applied to the protocol
diff --git a/doc/tutorial/source/tweaking.rst b/doc/tutorial/source/tweaking.rst
index 499636895..bccb884b2 100644
--- a/doc/tutorial/source/tweaking.rst
+++ b/doc/tutorial/source/tweaking.rst
@@ -408,7 +408,7 @@ in the following code,
::
- int
+ int
main (int argc, char *argv[])
{
...
diff --git a/examples/energy/energy-model-example.cc b/examples/energy/energy-model-example.cc
index bb262c765..5730b0726 100644
--- a/examples/energy/energy-model-example.cc
+++ b/examples/energy/energy-model-example.cc
@@ -51,8 +51,11 @@ ReceivePacket (Ptr socket)
{
InetSocketAddress iaddr = InetSocketAddress::ConvertFrom (from);
NS_LOG_UNCOND ("--\nReceived one packet! Socket: "<< iaddr.GetIpv4 ()
- << " port: " << iaddr.GetPort () << " at time = " <<
+ << " port: " << iaddr.GetPort () << " at time = " <<
Simulator::Now ().GetSeconds () << "\n--");
+ //cast iaddr to void, to suppress 'iaddr' set but not used compiler warning
+ //in optimized builds
+ (void) iaddr;
}
}
}
@@ -68,13 +71,13 @@ ReceivePacket (Ptr socket)
*/
static void
GenerateTraffic (Ptr socket, uint32_t pktSize, Ptr n,
- uint32_t pktCount, Time pktInterval)
+ uint32_t pktCount, Time pktInterval)
{
if (pktCount > 0)
{
socket->Send (Create (pktSize));
Simulator::Schedule (pktInterval, &GenerateTraffic, socket, pktSize, n,
- pktCount - 1, pktInterval);
+ pktCount - 1, pktInterval);
}
else
{
diff --git a/examples/error-model/simple-error-model.cc b/examples/error-model/simple-error-model.cc
index 4ba61d96e..3f5afaf3b 100644
--- a/examples/error-model/simple-error-model.cc
+++ b/examples/error-model/simple-error-model.cc
@@ -59,7 +59,7 @@ main (int argc, char *argv[])
// Set a few attributes
Config::SetDefault ("ns3::RateErrorModel::ErrorRate", DoubleValue (0.01));
Config::SetDefault ("ns3::RateErrorModel::ErrorUnit", StringValue ("EU_PKT"));
-
+
Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (210));
Config::SetDefault ("ns3::OnOffApplication::DataRate", DataRateValue (DataRate ("448kb/s")));
@@ -93,13 +93,13 @@ main (int argc, char *argv[])
p2p.SetDeviceAttribute ("DataRate", DataRateValue (DataRate (1500000)));
p2p.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (10)));
NetDeviceContainer d3d2 = p2p.Install (n3n2);
-
- // Later, we add IP addresses.
+
+ // Later, we add IP addresses.
NS_LOG_INFO ("Assign IP Addresses.");
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
ipv4.Assign (d0d2);
-
+
ipv4.SetBase ("10.1.2.0", "255.255.255.0");
Ipv4InterfaceContainer i1i2 = ipv4.Assign (d1d2);
@@ -115,7 +115,7 @@ main (int argc, char *argv[])
uint16_t port = 9; // Discard port (RFC 863)
OnOffHelper onoff ("ns3::UdpSocketFactory",
- Address (InetSocketAddress (i3i2.GetAddress (1), port)));
+ Address (InetSocketAddress (i3i2.GetAddress (1), port)));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable(1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable(0)));
@@ -125,7 +125,7 @@ main (int argc, char *argv[])
// Create an optional packet sink to receive these packets
PacketSinkHelper sink ("ns3::UdpSocketFactory",
- Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
+ Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
apps = sink.Install (c.Get (2));
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
@@ -150,7 +150,7 @@ main (int argc, char *argv[])
// Create an ErrorModel based on the implementation (constructor)
// specified by the default classId
Ptr em = CreateObjectWithAttributes ("RanVar", RandomVariableValue (UniformVariable (0.0, 1.0)),
- "ErrorRate", DoubleValue (0.001));
+ "ErrorRate", DoubleValue (0.001));
d3d2.Get (0)->SetAttribute ("ReceiveErrorModel", PointerValue (em));
// Now, let's use the ListErrorModel and explicitly force a loss
@@ -168,7 +168,7 @@ main (int argc, char *argv[])
p2p.EnablePcapAll ("simple-error-model");
NS_LOG_INFO ("Run Simulation.");
- Simulator::Run ();
+ Simulator::Run ();
Simulator::Destroy ();
NS_LOG_INFO ("Done.");
}
diff --git a/examples/ipv6/fragmentation-ipv6.cc b/examples/ipv6/fragmentation-ipv6.cc
index ad448efee..b80fc449e 100644
--- a/examples/ipv6/fragmentation-ipv6.cc
+++ b/examples/ipv6/fragmentation-ipv6.cc
@@ -82,10 +82,10 @@ public:
{
route = routing->GetRoute (i);
std::cout << route.GetDest () << "\t"
- << route.GetGateway () << "\t"
- << route.GetInterface () << "\t"
- << route.GetPrefixToUse () << "\t"
- << std::endl;
+ << route.GetGateway () << "\t"
+ << route.GetInterface () << "\t"
+ << route.GetPrefixToUse () << "\t"
+ << std::endl;
}
}
};
diff --git a/examples/ipv6/icmpv6-redirect.cc b/examples/ipv6/icmpv6-redirect.cc
index b8ea39190..7d9aaf4f5 100644
--- a/examples/ipv6/icmpv6-redirect.cc
+++ b/examples/ipv6/icmpv6-redirect.cc
@@ -82,10 +82,10 @@ public:
{
route = routing->GetRoute (i);
std::cout << route.GetDest () << "\t"
- << route.GetGateway () << "\t"
- << route.GetInterface () << "\t"
- << route.GetPrefixToUse () << "\t"
- << std::endl;
+ << route.GetGateway () << "\t"
+ << route.GetInterface () << "\t"
+ << route.GetPrefixToUse () << "\t"
+ << std::endl;
}
}
diff --git a/examples/ipv6/loose-routing-ipv6.cc b/examples/ipv6/loose-routing-ipv6.cc
index 9b636fdaa..0e1c79cf6 100644
--- a/examples/ipv6/loose-routing-ipv6.cc
+++ b/examples/ipv6/loose-routing-ipv6.cc
@@ -33,8 +33,8 @@
// // +------------+ | | |
// // | Host 1 |--| | +------------+ |
// // [------------] |---| Router 3 |---|
-// // [------------]
-// //
+// // [------------]
+// //
// //
// // - Tracing of queues and packet receptions to file "loose-routing-ipv6.tr"
diff --git a/examples/ipv6/ping6.cc b/examples/ipv6/ping6.cc
index 91c967772..7e3425b17 100644
--- a/examples/ipv6/ping6.cc
+++ b/examples/ipv6/ping6.cc
@@ -20,7 +20,7 @@
// Network topology
//
-// n0 n1
+// n0 n1
// | |
// =================
// LAN
diff --git a/examples/ipv6/radvd-two-prefix.cc b/examples/ipv6/radvd-two-prefix.cc
index 42bf13ce8..669c37835 100644
--- a/examples/ipv6/radvd-two-prefix.cc
+++ b/examples/ipv6/radvd-two-prefix.cc
@@ -89,10 +89,10 @@ public:
{
route = routing->GetRoute (i);
std::cout << route.GetDest () << "\t"
- << route.GetGateway () << "\t"
- << route.GetInterface () << "\t"
- << route.GetPrefixToUse () << "\t"
- << std::endl;
+ << route.GetGateway () << "\t"
+ << route.GetInterface () << "\t"
+ << route.GetPrefixToUse () << "\t"
+ << std::endl;
}
}
};
diff --git a/examples/matrix-topology/matrix-topology.cc b/examples/matrix-topology/matrix-topology.cc
index d61b03c2d..d82a2bf31 100644
--- a/examples/matrix-topology/matrix-topology.cc
+++ b/examples/matrix-topology/matrix-topology.cc
@@ -278,7 +278,7 @@ int main (int argc, char *argv[])
bool animEnabled = false;
AnimationInterface anim;
if (anim.SetServerPort (9) && anim.SetOutputFile (anim_name.c_str ()))
- {
+ {
NS_LOG_INFO ("Animation Interface Enabled.");
animEnabled = true;
anim.StartAnimation ();
diff --git a/examples/realtime/realtime-udp-echo.cc b/examples/realtime/realtime-udp-echo.cc
index d47aeab91..08ac9be61 100644
--- a/examples/realtime/realtime-udp-echo.cc
+++ b/examples/realtime/realtime-udp-echo.cc
@@ -50,7 +50,7 @@ main (int argc, char *argv[])
// that.
//
GlobalValue::Bind ("SimulatorImplementationType",
- StringValue ("ns3::RealtimeSimulatorImpl"));
+ StringValue ("ns3::RealtimeSimulatorImpl"));
//
// Explicitly create the nodes required by the topology (shown above).
diff --git a/examples/routing/dynamic-global-routing.cc b/examples/routing/dynamic-global-routing.cc
index 23fbea7ba..84d560ec7 100644
--- a/examples/routing/dynamic-global-routing.cc
+++ b/examples/routing/dynamic-global-routing.cc
@@ -50,7 +50,7 @@
// keeps the point-to-point link "up" from n1's perspective). Traffic will
// flow through the path n1-n2-n5-n6
// At time 8s, bring the interface back up. Path n1-n6 is restored
-// At time 10s, stop the first flow.
+// At time 10s, stop the first flow.
// At time 11s, start a new flow, but to n6's other IP address (the one
// on the n1/n6 p2p link)
// At time 12s, bring the n1 interface down between n1 and n6. Packets
@@ -58,7 +58,7 @@
// At time 14s, re-enable the n1/n6 interface to up. This will change
// routing back to n1-n6 since the interface up notification will cause
// a new local interface route, at higher priority than global routing
-// At time 16s, stop the second flow.
+// At time 16s, stop the second flow.
// - Tracing of queues and packet receptions to file "dynamic-global-routing.tr"
@@ -122,8 +122,8 @@ main (int argc, char *argv[])
csma.SetChannelAttribute ("DataRate", StringValue ("5Mbps"));
csma.SetChannelAttribute ("Delay", StringValue ("2ms"));
NetDeviceContainer d2345 = csma.Install (n2345);
-
- // Later, we add IP addresses.
+
+ // Later, we add IP addresses.
NS_LOG_INFO ("Assign IP Addresses.");
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
@@ -163,7 +163,7 @@ main (int argc, char *argv[])
// Create a second OnOff application to send UDP datagrams of size
// 210 bytes at a rate of 448 Kb/s
OnOffHelper onoff2 ("ns3::UdpSocketFactory",
- InetSocketAddress (i1i6.GetAddress (1), port));
+ InetSocketAddress (i1i6.GetAddress (1), port));
onoff2.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff2.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff2.SetAttribute ("DataRate", StringValue ("2kbps"));
@@ -175,13 +175,13 @@ main (int argc, char *argv[])
// Create an optional packet sink to receive these packets
PacketSinkHelper sink ("ns3::UdpSocketFactory",
- Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
+ Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
apps = sink.Install (c.Get (6));
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
PacketSinkHelper sink2 ("ns3::UdpSocketFactory",
- Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
+ Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
apps2 = sink2.Install (c.Get (6));
apps2.Start (Seconds (11.0));
apps2.Stop (Seconds (16.0));
diff --git a/examples/routing/global-injection-slash32.cc b/examples/routing/global-injection-slash32.cc
index 3f0764065..87e8e0174 100644
--- a/examples/routing/global-injection-slash32.cc
+++ b/examples/routing/global-injection-slash32.cc
@@ -69,7 +69,7 @@ main (int argc, char *argv[])
Ipv4ListRoutingHelper staticonly;
Ipv4ListRoutingHelper staticRouting;
staticonly.Add(staticRouting, 0);
- internet.SetRoutingHelper(staticonly);
+ internet.SetRoutingHelper(staticonly); // has effect on the next Install ()
internet.Install(NodeContainer(nC));
// We create the channels first without any IP addressing information
@@ -79,7 +79,7 @@ main (int argc, char *argv[])
NetDeviceContainer dAdB = p2p.Install (nAnB);
NetDeviceContainer dBdC = p2p.Install (nBnC);;
-
+
Ptr deviceA = CreateObject ();
deviceA->SetAddress (Mac48Address::Allocate ());
nA->AddDevice (deviceA);
@@ -88,7 +88,7 @@ main (int argc, char *argv[])
deviceC->SetAddress (Mac48Address::Allocate ());
nC->AddDevice (deviceC);
- // Later, we add IP addresses.
+ // Later, we add IP addresses.
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.252");
Ipv4InterfaceContainer iAiB = ipv4.Assign (dAdB);
@@ -99,10 +99,10 @@ main (int argc, char *argv[])
Ptr ipv4A = nA->GetObject ();
Ptr ipv4B = nB->GetObject ();
Ptr ipv4C = nC->GetObject ();
-
+
int32_t ifIndexA = ipv4A->AddInterface (deviceA);
int32_t ifIndexC = ipv4C->AddInterface (deviceC);
-
+
Ipv4InterfaceAddress ifInAddrA = Ipv4InterfaceAddress (Ipv4Address ("172.16.1.1"), Ipv4Mask ("255.255.255.255"));
ipv4A->AddAddress (ifIndexA, ifInAddrA);
ipv4A->SetMetric (ifIndexA, 1);
@@ -115,7 +115,7 @@ main (int argc, char *argv[])
// Create router nodes, initialize routing database and set up the routing
// tables in the nodes.
-
+
// Populate routing tables for nodes nA and nB
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
// Inject global routes from Node B, including transit network...
@@ -123,19 +123,19 @@ main (int argc, char *argv[])
globalRouterB->InjectRoute ("10.1.1.4", "255.255.255.252");
// ...and the host in network "C"
globalRouterB->InjectRoute ("192.168.1.1", "255.255.255.255");
-
+
Ipv4GlobalRoutingHelper::RecomputeRoutingTables();
// In addition, nB needs a static route to nC so it knows what to do with stuff
// going to 192.168.1.1
Ipv4StaticRoutingHelper ipv4RoutingHelper;
Ptr staticRoutingB = ipv4RoutingHelper.GetStaticRouting(ipv4B);
staticRoutingB->AddHostRouteTo (Ipv4Address ("192.168.1.1"), Ipv4Address ("10.1.1.6"),2);
-
+
// Create the OnOff application to send UDP datagrams of size
// 210 bytes at a rate of 448 Kb/s
uint16_t port = 9; // Discard port (RFC 863)
OnOffHelper onoff ("ns3::UdpSocketFactory",
- Address (InetSocketAddress (ifInAddrC.GetLocal(), port)));
+ Address (InetSocketAddress (ifInAddrC.GetLocal(), port)));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000)));
@@ -145,7 +145,7 @@ main (int argc, char *argv[])
// Create a packet sink to receive these packets
PacketSinkHelper sink ("ns3::UdpSocketFactory",
- Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
+ Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
apps = sink.Install (nC);
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
diff --git a/examples/routing/global-routing-slash32.cc b/examples/routing/global-routing-slash32.cc
index 7b7b90cea..c237dfe4f 100644
--- a/examples/routing/global-routing-slash32.cc
+++ b/examples/routing/global-routing-slash32.cc
@@ -65,7 +65,7 @@ main (int argc, char *argv[])
NetDeviceContainer dAdB = p2p.Install (nAnB);
NetDeviceContainer dBdC = p2p.Install (nBnC);;
-
+
Ptr deviceA = CreateObject ();
deviceA->SetAddress (Mac48Address::Allocate ());
nA->AddDevice (deviceA);
@@ -74,7 +74,7 @@ main (int argc, char *argv[])
deviceC->SetAddress (Mac48Address::Allocate ());
nC->AddDevice (deviceC);
- // Later, we add IP addresses.
+ // Later, we add IP addresses.
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.252");
Ipv4InterfaceContainer iAiB = ipv4.Assign (dAdB);
@@ -84,10 +84,10 @@ main (int argc, char *argv[])
Ptr ipv4A = nA->GetObject ();
Ptr ipv4C = nC->GetObject ();
-
+
int32_t ifIndexA = ipv4A->AddInterface (deviceA);
int32_t ifIndexC = ipv4C->AddInterface (deviceC);
-
+
Ipv4InterfaceAddress ifInAddrA = Ipv4InterfaceAddress (Ipv4Address ("172.16.1.1"), Ipv4Mask ("255.255.255.255"));
ipv4A->AddAddress (ifIndexA, ifInAddrA);
ipv4A->SetMetric (ifIndexA, 1);
@@ -106,7 +106,7 @@ main (int argc, char *argv[])
// 210 bytes at a rate of 448 Kb/s
uint16_t port = 9; // Discard port (RFC 863)
OnOffHelper onoff ("ns3::UdpSocketFactory",
- Address (InetSocketAddress (ifInAddrC.GetLocal(), port)));
+ Address (InetSocketAddress (ifInAddrC.GetLocal(), port)));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000)));
@@ -116,7 +116,7 @@ main (int argc, char *argv[])
// Create a packet sink to receive these packets
PacketSinkHelper sink ("ns3::UdpSocketFactory",
- Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
+ Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
apps = sink.Install (nC);
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
diff --git a/examples/routing/mixed-global-routing.cc b/examples/routing/mixed-global-routing.cc
index 02f7bb50f..99cf8e35a 100644
--- a/examples/routing/mixed-global-routing.cc
+++ b/examples/routing/mixed-global-routing.cc
@@ -87,8 +87,8 @@ main (int argc, char *argv[])
csma.SetChannelAttribute ("DataRate", StringValue ("5Mbps"));
csma.SetChannelAttribute ("Delay", StringValue ("2ms"));
NetDeviceContainer d2345 = csma.Install (n2345);
-
- // Later, we add IP addresses.
+
+ // Later, we add IP addresses.
NS_LOG_INFO ("Assign IP Addresses.");
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
diff --git a/examples/routing/simple-alternate-routing.cc b/examples/routing/simple-alternate-routing.cc
index 19b68add8..2c0b185e3 100644
--- a/examples/routing/simple-alternate-routing.cc
+++ b/examples/routing/simple-alternate-routing.cc
@@ -109,17 +109,17 @@ main (int argc, char *argv[])
InternetStackHelper internet;
internet.Install (c);
-
+
// Later, we add IP addresses. The middle two octets correspond to
- // the channel number.
+ // the channel number.
NS_LOG_INFO ("Assign IP Addresses.");
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.0.0.0", "255.255.255.0");
ipv4.Assign (d0d2);
-
+
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer i1i2 = ipv4.Assign (d1d2);
-
+
ipv4.SetBase ("10.2.2.0", "255.255.255.0");
ipv4.Assign (d3d2);
@@ -139,7 +139,7 @@ main (int argc, char *argv[])
// Create a flow from n3 to n1, starting at time 1.1 seconds
OnOffHelper onoff ("ns3::UdpSocketFactory",
- Address (InetSocketAddress (i1i2.GetAddress (0), port)));
+ Address (InetSocketAddress (i1i2.GetAddress (0), port)));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
@@ -149,7 +149,7 @@ main (int argc, char *argv[])
// Create a packet sink to receive these packets
PacketSinkHelper sink ("ns3::UdpSocketFactory",
- Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
+ Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
apps = sink.Install (c.Get (1));
apps.Start (Seconds (1.1));
apps.Stop (Seconds (10.0));
diff --git a/examples/routing/simple-global-routing.cc b/examples/routing/simple-global-routing.cc
index 664f1400c..915e60f30 100644
--- a/examples/routing/simple-global-routing.cc
+++ b/examples/routing/simple-global-routing.cc
@@ -64,7 +64,7 @@ main (int argc, char *argv[])
Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (210));
Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue ("448kb/s"));
- //DefaultValue::Bind ("DropTailQueue::m_maxPackets", 30);
+ //DefaultValue::Bind ("DropTailQueue::m_maxPackets", 30);
// Allow the user to override any of the defaults and the above
// DefaultValue::Bind ()s at run-time, via command-line arguments
@@ -93,12 +93,12 @@ main (int argc, char *argv[])
NetDeviceContainer d0d2 = p2p.Install (n0n2);
NetDeviceContainer d1d2 = p2p.Install (n1n2);
-
+
p2p.SetDeviceAttribute ("DataRate", StringValue ("1500kbps"));
p2p.SetChannelAttribute ("Delay", StringValue ("10ms"));
NetDeviceContainer d3d2 = p2p.Install (n3n2);
-
- // Later, we add IP addresses.
+
+ // Later, we add IP addresses.
NS_LOG_INFO ("Assign IP Addresses.");
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
@@ -106,7 +106,7 @@ main (int argc, char *argv[])
ipv4.SetBase ("10.1.2.0", "255.255.255.0");
Ipv4InterfaceContainer i1i2 = ipv4.Assign (d1d2);
-
+
ipv4.SetBase ("10.1.3.0", "255.255.255.0");
Ipv4InterfaceContainer i3i2 = ipv4.Assign (d3d2);
@@ -119,7 +119,7 @@ main (int argc, char *argv[])
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
OnOffHelper onoff ("ns3::UdpSocketFactory",
- Address (InetSocketAddress (i3i2.GetAddress (0), port)));
+ Address (InetSocketAddress (i3i2.GetAddress (0), port)));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
ApplicationContainer apps = onoff.Install (c.Get (0));
@@ -128,14 +128,14 @@ main (int argc, char *argv[])
// Create a packet sink to receive these packets
PacketSinkHelper sink ("ns3::UdpSocketFactory",
- Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
+ Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
apps = sink.Install (c.Get (3));
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
onoff.SetAttribute ("Remote",
- AddressValue (InetSocketAddress (i1i2.GetAddress (0), port)));
+ AddressValue (InetSocketAddress (i1i2.GetAddress (0), port)));
apps = onoff.Install (c.Get (3));
apps.Start (Seconds (1.1));
apps.Stop (Seconds (10.0));
@@ -155,7 +155,7 @@ main (int argc, char *argv[])
{
FlowMonitorHelper flowmonHelper;
flowmon = flowmonHelper.InstallAll ();
- }
+ }
NS_LOG_INFO ("Run Simulation.");
Simulator::Stop (Seconds (11));
diff --git a/examples/routing/simple-routing-ping6.cc b/examples/routing/simple-routing-ping6.cc
index ed338253b..0a707fe1c 100644
--- a/examples/routing/simple-routing-ping6.cc
+++ b/examples/routing/simple-routing-ping6.cc
@@ -83,10 +83,10 @@ public:
{
route = routing->GetRoute (i);
std::cout << route.GetDest () << "\t"
- << route.GetGateway () << "\t"
- << route.GetInterface () << "\t"
- << route.GetPrefixToUse () << "\t"
- << std::endl;
+ << route.GetGateway () << "\t"
+ << route.GetInterface () << "\t"
+ << route.GetPrefixToUse () << "\t"
+ << std::endl;
}
}
};
diff --git a/examples/routing/static-routing-slash32.cc b/examples/routing/static-routing-slash32.cc
index 13455432f..d78d2ddf4 100644
--- a/examples/routing/static-routing-slash32.cc
+++ b/examples/routing/static-routing-slash32.cc
@@ -65,7 +65,7 @@ main (int argc, char *argv[])
NetDeviceContainer dAdB = p2p.Install (nAnB);
NetDeviceContainer dBdC = p2p.Install (nBnC);;
-
+
Ptr deviceA = CreateObject ();
deviceA->SetAddress (Mac48Address::Allocate ());
nA->AddDevice (deviceA);
@@ -74,7 +74,7 @@ main (int argc, char *argv[])
deviceC->SetAddress (Mac48Address::Allocate ());
nC->AddDevice (deviceC);
- // Later, we add IP addresses.
+ // Later, we add IP addresses.
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.252");
Ipv4InterfaceContainer iAiB = ipv4.Assign (dAdB);
@@ -85,10 +85,10 @@ main (int argc, char *argv[])
Ptr ipv4A = nA->GetObject ();
Ptr ipv4B = nB->GetObject ();
Ptr ipv4C = nC->GetObject ();
-
+
int32_t ifIndexA = ipv4A->AddInterface (deviceA);
int32_t ifIndexC = ipv4C->AddInterface (deviceC);
-
+
Ipv4InterfaceAddress ifInAddrA = Ipv4InterfaceAddress (Ipv4Address ("172.16.1.1"), Ipv4Mask ("/32"));
ipv4A->AddAddress (ifIndexA, ifInAddrA);
ipv4A->SetMetric (ifIndexA, 1);
@@ -111,7 +111,7 @@ main (int argc, char *argv[])
// 210 bytes at a rate of 448 Kb/s
uint16_t port = 9; // Discard port (RFC 863)
OnOffHelper onoff ("ns3::UdpSocketFactory",
- Address (InetSocketAddress (ifInAddrC.GetLocal (), port)));
+ Address (InetSocketAddress (ifInAddrC.GetLocal (), port)));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000)));
@@ -121,7 +121,7 @@ main (int argc, char *argv[])
// Create a packet sink to receive these packets
PacketSinkHelper sink ("ns3::UdpSocketFactory",
- Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
+ Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
apps = sink.Install (nC);
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
diff --git a/examples/socket/socket-bound-static-routing.cc b/examples/socket/socket-bound-static-routing.cc
index 037a38e02..9226402c8 100644
--- a/examples/socket/socket-bound-static-routing.cc
+++ b/examples/socket/socket-bound-static-routing.cc
@@ -22,7 +22,7 @@
| 10.20.1.0/24
DSTRTR
10.10.1.0/24 / \ 10.10.2.0/24
- / \
+ / \
Rtr1 Rtr2
10.1.1.0/24 | | 10.1.2.0/24
| /
@@ -65,7 +65,7 @@ main (int argc, char *argv[])
Ptr nRtr1 = CreateObject ();
Ptr nRtr2 = CreateObject ();
Ptr nDstRtr = CreateObject ();
-
+
NodeContainer c = NodeContainer (nSrc, nDst, nRtr1, nRtr2, nDstRtr);
InternetStackHelper internet;
@@ -77,7 +77,7 @@ main (int argc, char *argv[])
NodeContainer nRtr1nDstRtr = NodeContainer (nRtr1, nDstRtr);
NodeContainer nRtr2nDstRtr = NodeContainer (nRtr2, nDstRtr);
NodeContainer nDstRtrnDst = NodeContainer (nDstRtr, nDst);
-
+
// We create the channels first without any IP addressing information
PointToPointHelper p2p;
p2p.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
@@ -87,11 +87,11 @@ main (int argc, char *argv[])
NetDeviceContainer dRtr1dDstRtr = p2p.Install (nRtr1nDstRtr);
NetDeviceContainer dRtr2dDstRtr = p2p.Install (nRtr2nDstRtr);
NetDeviceContainer dDstRtrdDst = p2p.Install (nDstRtrnDst);
-
+
Ptr SrcToRtr1=dSrcdRtr1.Get (0);
Ptr SrcToRtr2=dSrcdRtr2.Get (0);
-
- // Later, we add IP addresses.
+
+ // Later, we add IP addresses.
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer iSrciRtr1 = ipv4.Assign (dSrcdRtr1);
@@ -109,7 +109,7 @@ main (int argc, char *argv[])
Ptr ipv4Rtr2 = nRtr2->GetObject ();
Ptr ipv4DstRtr = nDstRtr->GetObject ();
Ptr ipv4Dst = nDst->GetObject ();
-
+
Ipv4StaticRoutingHelper ipv4RoutingHelper;
Ptr staticRoutingSrc = ipv4RoutingHelper.GetStaticRouting (ipv4Src);
Ptr staticRoutingRtr1 = ipv4RoutingHelper.GetStaticRouting (ipv4Rtr1);
@@ -120,33 +120,31 @@ main (int argc, char *argv[])
// Create static routes from Src to Dst
staticRoutingRtr1->AddHostRouteTo (Ipv4Address ("10.20.1.2"), Ipv4Address ("10.10.1.2"), 2);
staticRoutingRtr2->AddHostRouteTo (Ipv4Address ("10.20.1.2"), Ipv4Address ("10.10.2.2"), 2);
-
+
// Two routes to same destination - setting separate metrics.
// You can switch these to see how traffic gets diverted via different routes
staticRoutingSrc->AddHostRouteTo (Ipv4Address ("10.20.1.2"), Ipv4Address ("10.1.1.2"), 1,5);
staticRoutingSrc->AddHostRouteTo (Ipv4Address ("10.20.1.2"), Ipv4Address ("10.1.2.2"), 2,10);
-
+
// Creating static routes from DST to Source pointing to Rtr1 VIA Rtr2(!)
staticRoutingDst->AddHostRouteTo (Ipv4Address ("10.1.1.1"), Ipv4Address ("10.20.1.1"), 1);
staticRoutingDstRtr->AddHostRouteTo (Ipv4Address ("10.1.1.1"), Ipv4Address ("10.10.2.1"), 2);
staticRoutingRtr2->AddHostRouteTo (Ipv4Address ("10.1.1.1"), Ipv4Address ("10.1.2.1"), 1);
-
- Ipv4InterfaceAddress ifInAddrSrc=ipv4Src->GetAddress (1,0);
-
+
// There are no apps that can utilize the Socket Option so doing the work directly..
// Taken from tcp-large-transfer example
Ptr srcSocket = Socket::CreateSocket (nSrc, TypeId::LookupByName ("ns3::UdpSocketFactory"));
srcSocket->Bind ();
srcSocket->SetRecvCallback (MakeCallback (&srcSocketRecv));
-
+
Ptr dstSocket = Socket::CreateSocket (nDst, TypeId::LookupByName ("ns3::UdpSocketFactory"));
uint16_t dstport = 12345;
Ipv4Address dstaddr ("10.20.1.2");
InetSocketAddress dst = InetSocketAddress (dstaddr, dstport);
dstSocket->Bind (dst);
dstSocket->SetRecvCallback (MakeCallback (&dstSocketRecv));
-
+
AsciiTraceHelper ascii;
p2p.EnableAsciiAll (ascii.CreateFileStream ("socket-bound-static-routing.tr"));
p2p.EnablePcapAll ("socket-bound-static-routing");
@@ -195,13 +193,12 @@ srcSocketRecv (Ptr socket)
Ptr packet = socket->RecvFrom (from);
packet->RemoveAllPacketTags ();
packet->RemoveAllByteTags ();
- InetSocketAddress address = InetSocketAddress::ConvertFrom (from);
- NS_LOG_INFO ("Source Received " << packet->GetSize () << " bytes from " << address.GetIpv4());
+ NS_LOG_INFO ("Source Received " << packet->GetSize () << " bytes from " << InetSocketAddress::ConvertFrom (from).GetIpv4());
if (socket->GetBoundNetDevice ())
{
NS_LOG_INFO ("Socket was bound");
}
- else
+ else
{
NS_LOG_INFO ("Socket was not bound");
}
diff --git a/examples/socket/socket-bound-tcp-static-routing.cc b/examples/socket/socket-bound-tcp-static-routing.cc
index 2d588314b..95baaaa11 100644
--- a/examples/socket/socket-bound-tcp-static-routing.cc
+++ b/examples/socket/socket-bound-tcp-static-routing.cc
@@ -22,7 +22,7 @@
| 10.20.1.0/24
DSTRTR
10.10.1.0/24 / \ 10.10.2.0/24
- / \
+ / \
Rtr1 Rtr2
10.1.1.0/24 | | 10.1.2.0/24
| /
@@ -75,7 +75,7 @@ main (int argc, char *argv[])
Ptr nRtr1 = CreateObject ();
Ptr nRtr2 = CreateObject ();
Ptr nDstRtr = CreateObject ();
-
+
NodeContainer c = NodeContainer (nSrc, nDst, nRtr1, nRtr2, nDstRtr);
InternetStackHelper internet;
@@ -87,7 +87,7 @@ main (int argc, char *argv[])
NodeContainer nRtr1nDstRtr = NodeContainer (nRtr1, nDstRtr);
NodeContainer nRtr2nDstRtr = NodeContainer (nRtr2, nDstRtr);
NodeContainer nDstRtrnDst = NodeContainer (nDstRtr, nDst);
-
+
// We create the channels first without any IP addressing information
PointToPointHelper p2p;
p2p.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
@@ -97,11 +97,11 @@ main (int argc, char *argv[])
NetDeviceContainer dRtr1dDstRtr = p2p.Install (nRtr1nDstRtr);
NetDeviceContainer dRtr2dDstRtr = p2p.Install (nRtr2nDstRtr);
NetDeviceContainer dDstRtrdDst = p2p.Install (nDstRtrnDst);
-
+
Ptr SrcToRtr1=dSrcdRtr1.Get (0);
Ptr SrcToRtr2=dSrcdRtr2.Get (0);
-
- // Later, we add IP addresses.
+
+ // Later, we add IP addresses.
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer iSrciRtr1 = ipv4.Assign (dSrcdRtr1);
@@ -119,7 +119,7 @@ main (int argc, char *argv[])
Ptr ipv4Rtr2 = nRtr2->GetObject ();
Ptr ipv4DstRtr = nDstRtr->GetObject ();
Ptr ipv4Dst = nDst->GetObject ();
-
+
Ipv4StaticRoutingHelper ipv4RoutingHelper;
Ptr staticRoutingSrc = ipv4RoutingHelper.GetStaticRouting (ipv4Src);
Ptr staticRoutingRtr1 = ipv4RoutingHelper.GetStaticRouting (ipv4Rtr1);
@@ -130,23 +130,21 @@ main (int argc, char *argv[])
// Create static routes from Src to Dst
staticRoutingRtr1->AddHostRouteTo (Ipv4Address ("10.20.1.2"), Ipv4Address ("10.10.1.2"), 2);
staticRoutingRtr2->AddHostRouteTo (Ipv4Address ("10.20.1.2"), Ipv4Address ("10.10.2.2"), 2);
-
+
// Two routes to same destination - setting separate metrics.
// You can switch these to see how traffic gets diverted via different routes
staticRoutingSrc->AddHostRouteTo (Ipv4Address ("10.20.1.2"), Ipv4Address ("10.1.1.2"), 1,5);
staticRoutingSrc->AddHostRouteTo (Ipv4Address ("10.20.1.2"), Ipv4Address ("10.1.2.2"), 2,10);
-
+
// Creating static routes from DST to Source pointing to Rtr1 VIA Rtr2(!)
staticRoutingDst->AddHostRouteTo (Ipv4Address ("10.1.1.1"), Ipv4Address ("10.20.1.1"), 1);
staticRoutingDstRtr->AddHostRouteTo (Ipv4Address ("10.1.1.1"), Ipv4Address ("10.10.2.1"), 2);
staticRoutingRtr2->AddHostRouteTo (Ipv4Address ("10.1.1.1"), Ipv4Address ("10.1.2.1"), 1);
-
+
staticRoutingDst->AddHostRouteTo (Ipv4Address ("10.1.2.1"), Ipv4Address ("10.20.1.1"), 1);
staticRoutingDstRtr->AddHostRouteTo (Ipv4Address ("10.1.2.1"), Ipv4Address ("10.10.2.1"), 2);
staticRoutingRtr2->AddHostRouteTo (Ipv4Address ("10.1.2.1"), Ipv4Address ("10.1.2.1"), 1);
- Ipv4InterfaceAddress ifInAddrSrc=ipv4Src->GetAddress (1,0);
-
// There are no apps that can utilize the Socket Option so doing the work directly..
// Taken from tcp-large-transfer example
@@ -155,15 +153,15 @@ main (int argc, char *argv[])
Ptr srcSocket3 = Socket::CreateSocket (nSrc, TypeId::LookupByName ("ns3::TcpSocketFactory"));
Ptr srcSocket4 = Socket::CreateSocket (nSrc, TypeId::LookupByName ("ns3::TcpSocketFactory"));
-
+
uint16_t dstport = 12345;
Ipv4Address dstaddr ("10.20.1.2");
-
+
PacketSinkHelper sink ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny(), dstport));
ApplicationContainer apps = sink.Install (nDst);
apps.Start (Seconds (0.0));
apps.Stop (Seconds (10.0));
-
+
AsciiTraceHelper ascii;
p2p.EnableAsciiAll (ascii.CreateFileStream ("socket-bound-tcp-static-routing.tr"));
p2p.EnablePcapAll ("socket-bound-tcp-static-routing");
@@ -204,7 +202,7 @@ void StartFlow(Ptr localSocket,
NS_LOG_INFO ("Starting flow at time " << Simulator::Now ().GetSeconds ());
currentTxBytes = 0;
localSocket->Bind ();
- localSocket->Connect (InetSocketAddress (servAddress, servPort));//connect
+ localSocket->Connect (InetSocketAddress (servAddress, servPort)); //connect
// tell the tcp implementation to call WriteUntilBufferFull again
// if we blocked and new tx buffer space becomes available
diff --git a/examples/stats/wifi-example-apps.cc b/examples/stats/wifi-example-apps.cc
index c52830824..98f284ca9 100644
--- a/examples/stats/wifi-example-apps.cc
+++ b/examples/stats/wifi-example-apps.cc
@@ -67,7 +67,7 @@ Sender::GetTypeId(void)
MakeRandomVariableChecker())
.AddTraceSource ("Tx", "A new packet is created and is sent",
MakeTraceSourceAccessor (&Sender::m_txTrace))
- ;
+ ;
return tid;
}
@@ -99,10 +99,10 @@ void Sender::StartApplication()
if (m_socket == 0) {
Ptr socketFactory = GetNode()->GetObject
- (UdpSocketFactory::GetTypeId());
+ (UdpSocketFactory::GetTypeId());
m_socket = socketFactory->CreateSocket ();
m_socket->Bind ();
- }
+ }
m_count = 0;
@@ -118,7 +118,7 @@ void Sender::StopApplication()
Simulator::Cancel(m_sendEvent);
// end Sender::StopApplication
}
-
+
void Sender::SendPacket()
{
// NS_LOG_FUNCTION_NOARGS ();
@@ -139,9 +139,9 @@ void Sender::SendPacket()
m_txTrace(packet);
if (++m_count < m_numPkts) {
- m_sendEvent = Simulator::Schedule(Seconds(m_interval.GetValue()),
- &Sender::SendPacket, this);
- }
+ m_sendEvent = Simulator::Schedule(Seconds(m_interval.GetValue()),
+ &Sender::SendPacket, this);
+ }
// end Sender::SendPacket
}
@@ -162,7 +162,7 @@ Receiver::GetTypeId(void)
UintegerValue(1603),
MakeUintegerAccessor(&Receiver::m_port),
MakeUintegerChecker())
- ;
+ ;
return tid;
}
@@ -196,12 +196,12 @@ Receiver::StartApplication()
if (m_socket == 0) {
Ptr socketFactory = GetNode()->GetObject
- (UdpSocketFactory::GetTypeId());
+ (UdpSocketFactory::GetTypeId());
m_socket = socketFactory->CreateSocket();
InetSocketAddress local =
InetSocketAddress(Ipv4Address::GetAny(), m_port);
m_socket->Bind(local);
- }
+ }
m_socket->SetRecvCallback(MakeCallback(&Receiver::Receive, this));
@@ -215,7 +215,7 @@ Receiver::StopApplication()
if (m_socket != 0) {
m_socket->SetRecvCallback(MakeNullCallback > ());
- }
+ }
// end Receiver::StopApplication
}
@@ -241,30 +241,29 @@ Receiver::Receive(Ptr socket)
Ptr packet;
Address from;
while (packet = socket->RecvFrom(from)) {
- if (InetSocketAddress::IsMatchingType (from)) {
- InetSocketAddress address = InetSocketAddress::ConvertFrom (from);
- NS_LOG_INFO ("Received " << packet->GetSize() << " bytes from " <<
- address.GetIpv4());
+ if (InetSocketAddress::IsMatchingType (from)) {
+ 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 (m_delay != 0) {
+ m_delay->Update(Simulator::Now() - tx);
+ }
+ }
+
+ if (m_calc != 0) {
+ m_calc->Update();
+ }
+
+ // end receiving packets
}
- TimestampTag timestamp;
- // Should never not be found since the sender is adding it, but
- // you never know.
- if (packet->FindFirstMatchingByteTag(timestamp)) {
- Time tx = timestamp.GetTimestamp();
-
- if (m_delay != 0) {
- m_delay->Update(Simulator::Now() - tx);
- }
- }
-
- if (m_calc != 0) {
- m_calc->Update();
- }
-
- // end receiving packets
- }
-
// end Receiver::Receive
}
@@ -285,7 +284,7 @@ TimestampTag::GetTypeId(void)
EmptyAttributeValue(),
MakeTimeAccessor(&TimestampTag::GetTimestamp),
MakeTimeChecker())
- ;
+ ;
return tid;
}
TypeId
diff --git a/examples/stats/wifi-example-apps.h b/examples/stats/wifi-example-apps.h
index 8dc70c600..564a952a8 100644
--- a/examples/stats/wifi-example-apps.h
+++ b/examples/stats/wifi-example-apps.h
@@ -37,7 +37,7 @@ using namespace ns3;
//----------------------------------------------------------------------
//------------------------------------------------------
-class Sender: public Application {
+class Sender : public Application {
public:
static TypeId GetTypeId(void);
Sender();
@@ -72,7 +72,7 @@ private:
//------------------------------------------------------
-class Receiver: public Application {
+class Receiver : public Application {
public:
static TypeId GetTypeId(void);
Receiver();
@@ -112,7 +112,7 @@ public:
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (TagBuffer i) const;
virtual void Deserialize (TagBuffer i);
-
+
// these are our accessors to our tag structure
void SetTimestamp(Time time);
Time GetTimestamp(void) const;
diff --git a/examples/stats/wifi-example-sim.cc b/examples/stats/wifi-example-sim.cc
index 48f0f7239..aad5709d2 100644
--- a/examples/stats/wifi-example-sim.cc
+++ b/examples/stats/wifi-example-sim.cc
@@ -99,21 +99,21 @@ int main(int argc, char *argv[]) {
cmd.Parse (argc, argv);
if (format != "omnet" && format != "db") {
- NS_LOG_ERROR("Unknown output format '" << format << "'");
- return -1;
- }
+ NS_LOG_ERROR("Unknown output format '" << format << "'");
+ return -1;
+ }
#ifndef STATS_HAS_SQLITE3
if (format == "db") {
NS_LOG_ERROR("sqlite support not compiled in.");
return -1;
- }
+ }
#endif
{
- stringstream sstr("");
- sstr << distance;
- input = sstr.str();
+ stringstream sstr("");
+ sstr << distance;
+ input = sstr.str();
}
@@ -163,12 +163,12 @@ int main(int argc, char *argv[]) {
//-- Create a custom traffic source and sink
//--------------------------------------------
NS_LOG_INFO ("Create traffic source & sink.");
- Ptr appSource = NodeList::GetNode(0);
+ Ptr appSource = NodeList::GetNode(0);
Ptr sender = CreateObject();
appSource->AddApplication(sender);
sender->SetStartTime(Seconds(1));
- Ptr appSink = NodeList::GetNode(1);
+ Ptr appSink = NodeList::GetNode(1);
Ptr receiver = CreateObject();
appSink->AddApplication(receiver);
receiver->SetStartTime(Seconds(0));
@@ -231,7 +231,7 @@ int main(int argc, char *argv[]) {
appTx->SetContext("node[0]");
Config::Connect("/NodeList/0/ApplicationList/*/$Sender/Tx",
MakeCallback(&PacketCounterCalculator::PacketUpdate,
- appTx));
+ appTx));
data.AddDataCalculator(appTx);
// Here a counter for received packets is directly manipulated by
@@ -271,8 +271,8 @@ int main(int argc, char *argv[]) {
appTxPkts->SetContext("node[0]");
Config::Connect("/NodeList/0/ApplicationList/*/$Sender/Tx",
MakeCallback
- (&PacketSizeMinMaxAvgTotalCalculator::PacketUpdate,
- appTxPkts));
+ (&PacketSizeMinMaxAvgTotalCalculator::PacketUpdate,
+ appTxPkts));
data.AddDataCalculator(appTxPkts);
@@ -294,7 +294,7 @@ int main(int argc, char *argv[]) {
//-- Run the simulation
//--------------------------------------------
NS_LOG_INFO("Run Simulation.");
- Simulator::Run();
+ Simulator::Run();
Simulator::Destroy();
@@ -307,16 +307,16 @@ int main(int argc, char *argv[]) {
// Pick an output writer based in the requested format.
Ptr output = 0;
if (format == "omnet") {
- NS_LOG_INFO("Creating omnet formatted data output.");
- output = CreateObject();
- } else if (format == "db") {
+ NS_LOG_INFO("Creating omnet formatted data output.");
+ output = CreateObject();
+ } else if (format == "db") {
#ifdef STATS_HAS_SQLITE3
NS_LOG_INFO("Creating sqlite formatted data output.");
output = CreateObject();
#endif
- } else {
- NS_LOG_ERROR("Unknown output format " << format);
- }
+ } else {
+ NS_LOG_ERROR("Unknown output format " << format);
+ }
// Finally, have that writer interrogate the DataCollector and save
// the results.
diff --git a/examples/tcp/star.cc b/examples/tcp/star.cc
index a167e0de3..b85bb15a5 100644
--- a/examples/tcp/star.cc
+++ b/examples/tcp/star.cc
@@ -75,7 +75,7 @@ main (int argc, char *argv[])
NS_LOG_INFO ("Create applications.");
//
- // Create a packet sink on the star "hub" to receive packets.
+ // Create a packet sink on the star "hub" to receive packets.
//
uint16_t port = 50000;
Address hubLocalAddress (InetSocketAddress (Ipv4Address::GetAny (), port));
@@ -98,7 +98,7 @@ main (int argc, char *argv[])
AddressValue remoteAddress (InetSocketAddress (star.GetHubIpv4Address (i), port));
onOffHelper.SetAttribute ("Remote", remoteAddress);
spokeApps.Add (onOffHelper.Install (star.GetSpokeNode (i)));
- }
+ }
spokeApps.Start (Seconds (1.0));
spokeApps.Stop (Seconds (10.0));
diff --git a/examples/tcp/tcp-large-transfer.cc b/examples/tcp/tcp-large-transfer.cc
index ff5e76a2f..37e7030dc 100644
--- a/examples/tcp/tcp-large-transfer.cc
+++ b/examples/tcp/tcp-large-transfer.cc
@@ -152,7 +152,7 @@ int main (int argc, char *argv[])
// Create and bind the socket...
Ptr localSocket =
- Socket::CreateSocket (n0n1.Get (0), TcpSocketFactory::GetTypeId ());
+ Socket::CreateSocket (n0n1.Get (0), TcpSocketFactory::GetTypeId ());
localSocket->Bind ();
// Trace changes to the congestion window
@@ -191,7 +191,7 @@ void StartFlow(Ptr localSocket,
uint16_t servPort)
{
NS_LOG_LOGIC("Starting flow at time " << Simulator::Now ().GetSeconds ());
- localSocket->Connect (InetSocketAddress (servAddress, servPort));//connect
+ localSocket->Connect (InetSocketAddress (servAddress, servPort)); //connect
// tell the tcp implementation to call WriteUntilBufferFull again
// if we blocked and new tx buffer space becomes available
diff --git a/examples/tcp/tcp-nsc-lfn.cc b/examples/tcp/tcp-nsc-lfn.cc
index 54d54ecc4..453994c62 100644
--- a/examples/tcp/tcp-nsc-lfn.cc
+++ b/examples/tcp/tcp-nsc-lfn.cc
@@ -103,9 +103,9 @@ int main (int argc, char *argv[])
DoubleValue rate(errRate);
RandomVariableValue u01(UniformVariable (0.0, 1.0));
Ptr em1 =
- CreateObjectWithAttributes ("RanVar", u01, "ErrorRate", rate);
+ CreateObjectWithAttributes ("RanVar", u01, "ErrorRate", rate);
Ptr em2 =
- CreateObjectWithAttributes ("RanVar", u01, "ErrorRate", rate);
+ CreateObjectWithAttributes ("RanVar", u01, "ErrorRate", rate);
// This enables the specified errRate on both link endpoints.
p2pInterfaces.Get(0)->SetAttribute("ReceiveErrorModel", PointerValue (em1));
@@ -122,7 +122,7 @@ int main (int argc, char *argv[])
// This sets up two TCP flows, one from A -> B, one from B -> A.
for (int i = 0, j = 1; i < 2; j--, i++)
- {
+ {
Address remoteAddress(InetSocketAddress(ipv4Interfaces.GetAddress (i), servPort));
OnOffHelper clientHelper ("ns3::TcpSocketFactory", remoteAddress);
clientHelper.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
diff --git a/examples/tcp/tcp-nsc-zoo.cc b/examples/tcp/tcp-nsc-zoo.cc
index b9d4cb35a..2fef085a3 100644
--- a/examples/tcp/tcp-nsc-zoo.cc
+++ b/examples/tcp/tcp-nsc-zoo.cc
@@ -57,8 +57,8 @@ int main(int argc, char *argv[])
if (MaxNodes < 2)
{
- std::cerr << "--nodes: must be >= 2" << std::endl;
- return 1;
+ std::cerr << "--nodes: must be >= 2" << std::endl;
+ return 1;
}
csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate(100 * 1000 * 1000)));
csma.SetChannelAttribute ("Delay", TimeValue (MicroSeconds (200)));
@@ -86,13 +86,13 @@ int main(int argc, char *argv[])
{
// 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.18.so"));
- // this switches node 3 to NSCs Linux 2.6.18 stack.
+ 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));
// 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"));
- Config::Set ("/NodeList/3/$ns3::Ns3NscStack/net.ipv4.tcp_window_scaling", StringValue ("0"));
+ Config::Set ("/NodeList/3/$ns3::Ns3NscStack/net.ipv4.tcp_sack", StringValue ("0"));
+ Config::Set ("/NodeList/3/$ns3::Ns3NscStack/net.ipv4.tcp_timestamps", StringValue ("0"));
+ Config::Set ("/NodeList/3/$ns3::Ns3NscStack/net.ipv4.tcp_window_scaling", StringValue ("0"));
}
// the freebsd stack is not yet built by default, so its commented out for now.
// internetStack.SetNscStack ("libfreebsd5.so");
@@ -115,24 +115,24 @@ int main(int argc, char *argv[])
sinkApp.Stop (Seconds (30.0));
// This tells every node on the network to start a flow to all other nodes on the network ...
- for (unsigned int i = 0 ; i < MaxNodes;i++)
+ for (unsigned int i = 0 ; i < MaxNodes; i++)
{
- for (unsigned int j = 0 ; j < MaxNodes;j++)
+ for (unsigned int j = 0 ; j < MaxNodes; j++)
{
if (i == j)
{ // ...but we don't want a node to talk to itself.
- continue;
+ continue;
}
Address remoteAddress(InetSocketAddress(ipv4Interfaces.GetAddress (j), servPort));
OnOffHelper clientHelper ("ns3::TcpSocketFactory", remoteAddress);
clientHelper.SetAttribute
- ("OnTime", RandomVariableValue (ConstantVariable (1)));
+ ("OnTime", RandomVariableValue (ConstantVariable (1)));
clientHelper.SetAttribute
- ("OffTime", RandomVariableValue (ConstantVariable (0)));
+ ("OffTime", RandomVariableValue (ConstantVariable (0)));
ApplicationContainer clientApp = clientHelper.Install(n.Get(i));
clientApp.Start (Seconds (j)); /* delay startup depending on node number */
clientApp.Stop (Seconds (j + runtime));
- }
+ }
}
csma.EnablePcapAll ("tcp-nsc-zoo", false);
diff --git a/examples/tcp/tcp-star-server.cc b/examples/tcp/tcp-star-server.cc
index 8ffff68d6..879d28da1 100644
--- a/examples/tcp/tcp-star-server.cc
+++ b/examples/tcp/tcp-star-server.cc
@@ -22,7 +22,7 @@
\ | /
\|/
n1---n0---n5
- /|\
+ /| \
/ | \
n8 n7 n6
*/
@@ -96,9 +96,9 @@ main (int argc, char *argv[])
//Collect an adjacency list of nodes for the p2p topology
std::vector nodeAdjacencyList(N-1);
for(uint32_t i=0; i deviceAdjacencyList(N-1);
for(uint32_t i=0; i interfaceAdjacencyList(N-1);
for(uint32_t i=0; i socket, Address address, uint32_t packetSize, uint32_t nPackets, DataRate dataRate);
private:
- virtual void StartApplication (void);
+ virtual void StartApplication (void);
virtual void StopApplication (void);
void ScheduleTx (void);
@@ -186,8 +186,8 @@ main (int argc, char *argv[])
devices = pointToPoint.Install (nodes);
Ptr em = CreateObjectWithAttributes (
- "RanVar", RandomVariableValue (UniformVariable (0., 1.)),
- "ErrorRate", DoubleValue (0.00001));
+ "RanVar", RandomVariableValue (UniformVariable (0., 1.)),
+ "ErrorRate", DoubleValue (0.00001));
devices.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (em));
InternetStackHelper stack;
diff --git a/examples/tutorial/first.cc b/examples/tutorial/first.cc
index 8e8479c54..cb1481028 100644
--- a/examples/tutorial/first.cc
+++ b/examples/tutorial/first.cc
@@ -24,7 +24,7 @@ using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("FirstScriptExample");
- int
+int
main (int argc, char *argv[])
{
LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO);
diff --git a/examples/tutorial/fourth.cc b/examples/tutorial/fourth.cc
index 800ae9e48..f1284ce6f 100644
--- a/examples/tutorial/fourth.cc
+++ b/examples/tutorial/fourth.cc
@@ -20,7 +20,7 @@
#include "ns3/trace-source-accessor.h"
#include
-
+
using namespace ns3;
class MyObject : public Object
@@ -34,10 +34,10 @@ public:
.AddTraceSource ("MyInteger",
"An integer value to trace.",
MakeTraceSourceAccessor (&MyObject::m_myInt))
- ;
+ ;
return tid;
}
-
+
MyObject () {}
TracedValue m_myInt;
};
diff --git a/examples/tutorial/hello-simulator.cc b/examples/tutorial/hello-simulator.cc
index 37f99ccd5..70a43a62f 100644
--- a/examples/tutorial/hello-simulator.cc
+++ b/examples/tutorial/hello-simulator.cc
@@ -20,7 +20,7 @@ NS_LOG_COMPONENT_DEFINE ("HelloSimulator");
using namespace ns3;
- int
+int
main (int argc, char *argv[])
{
NS_LOG_UNCOND ("Hello Simulator");
diff --git a/examples/tutorial/sixth.cc b/examples/tutorial/sixth.cc
index 70c00a4b0..c0822b83d 100644
--- a/examples/tutorial/sixth.cc
+++ b/examples/tutorial/sixth.cc
@@ -69,7 +69,7 @@ public:
void Setup (Ptr socket, Address address, uint32_t packetSize, uint32_t nPackets, DataRate dataRate);
private:
- virtual void StartApplication (void);
+ virtual void StartApplication (void);
virtual void StopApplication (void);
void ScheduleTx (void);
@@ -188,8 +188,8 @@ main (int argc, char *argv[])
devices = pointToPoint.Install (nodes);
Ptr em = CreateObjectWithAttributes (
- "RanVar", RandomVariableValue (UniformVariable (0., 1.)),
- "ErrorRate", DoubleValue (0.00001));
+ "RanVar", RandomVariableValue (UniformVariable (0., 1.)),
+ "ErrorRate", DoubleValue (0.00001));
devices.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (em));
InternetStackHelper stack;
diff --git a/examples/udp/udp-echo.cc b/examples/udp/udp-echo.cc
index fd6b07837..8e0c071f7 100644
--- a/examples/udp/udp-echo.cc
+++ b/examples/udp/udp-echo.cc
@@ -115,7 +115,7 @@ main (int argc, char *argv[])
client.SetFill(apps.Get (0), 0xa5, 1024);
- uint8_t fill[] = {0, 1, 2, 3, 4, 5, 6};
+ uint8_t fill[] = { 0, 1, 2, 3, 4, 5, 6};
client.SetFill(apps.Get (0), fill, sizeof(fill), 1024);
#endif
diff --git a/examples/wireless/mixed-wireless.cc b/examples/wireless/mixed-wireless.cc
index 87b417503..1c7acdc20 100644
--- a/examples/wireless/mixed-wireless.cc
+++ b/examples/wireless/mixed-wireless.cc
@@ -162,7 +162,7 @@ main (int argc, char *argv[])
// Add the IPv4 protocol stack to the nodes in our container
//
InternetStackHelper internet;
- internet.SetRoutingHelper (olsr);
+ internet.SetRoutingHelper (olsr); // has effect on the next Install ()
internet.Install (backbone);
// re-initialize for non-olsr routing.
diff --git a/examples/wireless/mixed-wireless.py b/examples/wireless/mixed-wireless.py
index d5bf3db12..0e889b08f 100644
--- a/examples/wireless/mixed-wireless.py
+++ b/examples/wireless/mixed-wireless.py
@@ -135,7 +135,7 @@ def main(argv):
print "Enabling OLSR routing on all backbone nodes"
internet = ns.internet.InternetStackHelper()
olsr = ns.olsr.OlsrHelper()
- internet.SetRoutingHelper(olsr);
+ internet.SetRoutingHelper(olsr); # has effect on the next Install ()
internet.Install(backbone);
# re-initialize for non-olsr routing.
internet.Reset()
diff --git a/examples/wireless/multirate.cc b/examples/wireless/multirate.cc
index 58b0c4534..e2a4e2020 100644
--- a/examples/wireless/multirate.cc
+++ b/examples/wireless/multirate.cc
@@ -334,6 +334,11 @@ Experiment::ApplicationSetup (Ptr client, Ptr server, double start,
<< " 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
+ (void) serverPos;
+ (void) clientPos;
+ (void) ipv4AddrClient;
// Equipping the source node with OnOff Application used for sending
OnOffHelper onoff ("ns3::UdpSocketFactory", Address(InetSocketAddress(Ipv4Address("10.0.0.1"), port)));
@@ -383,7 +388,7 @@ Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy,
if (enableRouting)
{
- internet.SetRoutingHelper(list);
+ internet.SetRoutingHelper(list); // has effect on the next Install ()
}
internet.Install (c);
diff --git a/examples/wireless/ofdm-validation.cc b/examples/wireless/ofdm-validation.cc
index 87959faa4..9cc417ddb 100644
--- a/examples/wireless/ofdm-validation.cc
+++ b/examples/wireless/ofdm-validation.cc
@@ -84,7 +84,7 @@ set style line 5 linewidth 5\n\
set style line 6 linewidth 5\n\
set style line 7 linewidth 5\n\
set style line 8 linewidth 5\n\
-set style increment user");
+set style increment user" );
yansplot.GenerateOutput (yansfile);
yansfile.close ();
@@ -100,7 +100,7 @@ set style line 5 linewidth 5\n\
set style line 6 linewidth 5\n\
set style line 7 linewidth 5\n\
set style line 8 linewidth 5\n\
-set style increment user");
+set style increment user" );
nistplot.GenerateOutput (nistfile);
nistfile.close ();
diff --git a/examples/wireless/wifi-adhoc.cc b/examples/wireless/wifi-adhoc.cc
index 22be0208c..1caf2d906 100644
--- a/examples/wireless/wifi-adhoc.cc
+++ b/examples/wireless/wifi-adhoc.cc
@@ -50,7 +50,8 @@ private:
};
Experiment::Experiment ()
-{}
+{
+}
Experiment::Experiment (std::string name)
: m_output (name)
diff --git a/examples/wireless/wifi-clear-channel-cmu.cc b/examples/wireless/wifi-clear-channel-cmu.cc
index 8cf20b26e..881572bdc 100644
--- a/examples/wireless/wifi-clear-channel-cmu.cc
+++ b/examples/wireless/wifi-clear-channel-cmu.cc
@@ -47,14 +47,15 @@ private:
Vector GetPosition (Ptr node);
Ptr SetupPacketReceive (Ptr node);
void GenerateTraffic (Ptr socket, uint32_t pktSize,
- uint32_t pktCount, Time pktInterval );
+ uint32_t pktCount, Time pktInterval );
uint32_t m_pktsTotal;
Gnuplot2dDataset m_output;
};
Experiment::Experiment ()
-{}
+{
+}
Experiment::Experiment (std::string name)
: m_output (name)
@@ -82,7 +83,7 @@ Experiment::ReceivePacket (Ptr socket)
Ptr packet;
while (packet = socket->Recv ())
{
- m_pktsTotal ++;
+ m_pktsTotal++;
}
}
@@ -179,46 +180,46 @@ int main (int argc, char *argv[])
cmd.Parse (argc, argv);
Gnuplot gnuplot = Gnuplot ("clear-channel.eps");
-
+
for (uint32_t i = 0; i < modes.size(); i++)
- {
- std::cout << modes[i] << std::endl;
- Gnuplot2dDataset dataset (modes[i]);
+ {
+ std::cout << modes[i] << std::endl;
+ Gnuplot2dDataset dataset (modes[i]);
- for (double rss = -102.0; rss <= -80.0; rss += 0.5)
- {
- Experiment experiment;
- dataset.SetStyle (Gnuplot2dDataset::LINES);
+ for (double rss = -102.0; rss <= -80.0; rss += 0.5)
+ {
+ Experiment experiment;
+ dataset.SetStyle (Gnuplot2dDataset::LINES);
- WifiHelper wifi;
- wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
- NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
- Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode",
- StringValue (modes[i]));
- wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
- "DataMode",StringValue(modes[i]),
- "ControlMode",StringValue(modes[i]));
- wifiMac.SetType ("ns3::AdhocWifiMac");
+ WifiHelper wifi;
+ wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
+ NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
+ Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode",
+ StringValue (modes[i]));
+ wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
+ "DataMode",StringValue(modes[i]),
+ "ControlMode",StringValue(modes[i]));
+ wifiMac.SetType ("ns3::AdhocWifiMac");
- YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
- YansWifiChannelHelper wifiChannel ;
- wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
- wifiChannel.AddPropagationLoss ("ns3::FixedRssLossModel","Rss",DoubleValue(rss));
+ YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
+ YansWifiChannelHelper wifiChannel ;
+ wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
+ wifiChannel.AddPropagationLoss ("ns3::FixedRssLossModel","Rss",DoubleValue(rss));
- NS_LOG_DEBUG (modes[i]);
- experiment = Experiment (modes[i]);
- wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (-110.0) );
- wifiPhy.Set ("CcaMode1Threshold", DoubleValue (-110.0) );
- wifiPhy.Set ("TxPowerStart", DoubleValue (15.0) );
- wifiPhy.Set ("RxGain", DoubleValue (0) );
- wifiPhy.Set ("RxNoiseFigure", DoubleValue (7) );
- uint32_t pktsRecvd = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
- dataset.Add (rss, pktsRecvd);
- }
+ NS_LOG_DEBUG (modes[i]);
+ experiment = Experiment (modes[i]);
+ wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (-110.0) );
+ wifiPhy.Set ("CcaMode1Threshold", DoubleValue (-110.0) );
+ wifiPhy.Set ("TxPowerStart", DoubleValue (15.0) );
+ wifiPhy.Set ("RxGain", DoubleValue (0) );
+ wifiPhy.Set ("RxNoiseFigure", DoubleValue (7) );
+ uint32_t pktsRecvd = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
+ dataset.Add (rss, pktsRecvd);
+ }
- gnuplot.AddDataset (dataset);
- }
+ gnuplot.AddDataset (dataset);
+ }
gnuplot.SetTerminal ("postscript eps color enh \"Times-BoldItalic\"");
gnuplot.SetLegend ("RSS(dBm)", "Number of packets received");
gnuplot.SetExtra ("set xrange [-102:-83]");
diff --git a/examples/wireless/wifi-hidden-terminal.cc b/examples/wireless/wifi-hidden-terminal.cc
index 6de5f68f5..56d6ee490 100644
--- a/examples/wireless/wifi-hidden-terminal.cc
+++ b/examples/wireless/wifi-hidden-terminal.cc
@@ -46,17 +46,17 @@ void experiment (bool enableCtsRts)
// 0. Enable or disable CTS/RTS
UintegerValue ctsThr = (enableCtsRts ? UintegerValue (100) : UintegerValue (2200));
Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", ctsThr);
-
+
// 1. Create 3 nodes
NodeContainer nodes;
nodes.Create (3);
-
+
// 2. Place nodes somehow, this is required by every wireless simulation
for (size_t i = 0; i < 3; ++i)
{
nodes.Get(i)->AggregateObject (CreateObject ());
}
-
+
// 3. Create propagation loss matrix
Ptr lossModel = CreateObject ();
lossModel->SetDefaultLoss (200); // set default loss to 200 dB (no link)
@@ -67,7 +67,7 @@ void experiment (bool enableCtsRts)
Ptr wifiChannel = CreateObject ();
wifiChannel->SetPropagationLossModel (lossModel);
wifiChannel->SetPropagationDelayModel (CreateObject ());
-
+
// 5. Install wireless devices
WifiHelper wifi;
wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
@@ -94,7 +94,7 @@ void experiment (bool enableCtsRts)
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.0.0.0", "255.0.0.0");
ipv4.Assign (devices);
-
+
// 7. Install applications: two CBR streams each saturating the channel
ApplicationContainer cbrApps;
uint16_t cbrPort = 12345;
@@ -120,7 +120,7 @@ void experiment (bool enableCtsRts)
// we also use separate UDP applications that will send a single
// packet before the CBR flows start.
// This is a workround for the lack of perfect ARP, see Bug 187
- // http://www.nsnam.org/bugzilla/show_bug.cgi?id=187
+ // http://www.nsnam.org/bugzilla/show_bug.cgi?id=187
uint16_t echoPort = 9;
UdpEchoClientHelper echoClientHelper (Ipv4Address ("10.0.0.2"), echoPort);
@@ -128,24 +128,24 @@ void experiment (bool enableCtsRts)
echoClientHelper.SetAttribute ("Interval", TimeValue (Seconds (0.1)));
echoClientHelper.SetAttribute ("PacketSize", UintegerValue (10));
ApplicationContainer pingApps;
-
+
// again using different start times to workaround Bug 388 and Bug 912
echoClientHelper.SetAttribute ("StartTime", TimeValue (Seconds (0.001)));
pingApps.Add (echoClientHelper.Install (nodes.Get (0)));
echoClientHelper.SetAttribute ("StartTime", TimeValue (Seconds (0.006)));
- pingApps.Add (echoClientHelper.Install (nodes.Get (2)));
+ pingApps.Add (echoClientHelper.Install (nodes.Get (2)));
+
-
// 8. Install FlowMonitor on all nodes
FlowMonitorHelper flowmon;
Ptr monitor = flowmon.InstallAll();
-
+
// 9. Run simulation for 10 seconds
Simulator::Stop (Seconds (10));
Simulator::Run ();
-
+
// 10. Print per flow statistics
monitor->CheckForLostPackets ();
Ptr classifier = DynamicCast (flowmon.GetClassifier ());
@@ -161,7 +161,7 @@ void experiment (bool enableCtsRts)
std::cout << " Throughput: " << i->second.rxBytes * 8.0 / 10.0 / 1024 / 1024 << " Mbps\n";
}
}
-
+
// 11. Cleanup
Simulator::Destroy ();
}
@@ -173,6 +173,6 @@ int main (int argc, char **argv)
std::cout << "------------------------------------------------\n";
std::cout << "Hidden station experiment with RTS/CTS enabled:\n";
experiment (true);
-
+
return 0;
}
diff --git a/examples/wireless/wifi-simple-adhoc-grid.cc b/examples/wireless/wifi-simple-adhoc-grid.cc
index 7b13aae8c..4357a2051 100644
--- a/examples/wireless/wifi-simple-adhoc-grid.cc
+++ b/examples/wireless/wifi-simple-adhoc-grid.cc
@@ -21,7 +21,7 @@
// This program configures a grid (default 5x5) of nodes on an
// 802.11b physical layer, with
// 802.11b NICs in adhoc mode, and by default, sends one packet of 1000
-// (application) bytes to node 1.
+// (application) bytes to node 1.
//
// The default layout is like this, on a 2-D grid.
//
@@ -134,7 +134,7 @@ int main (int argc, char *argv[])
cmd.AddValue ("numNodes", "number of nodes", numNodes);
cmd.AddValue ("sinkNode", "Receiver node number", sinkNode);
cmd.AddValue ("sourceNode", "Sender node number", sourceNode);
-
+
cmd.Parse (argc, argv);
// Convert to time object
Time interPacketInterval = Seconds (interval);
@@ -173,19 +173,19 @@ int main (int argc, char *argv[])
wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode",StringValue(phyMode),
- "ControlMode",StringValue(phyMode));
+ "ControlMode",StringValue(phyMode));
// Set it to adhoc mode
wifiMac.SetType ("ns3::AdhocWifiMac");
NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c);
MobilityHelper mobility;
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
- "MinX", DoubleValue (0.0),
- "MinY", DoubleValue (0.0),
- "DeltaX", DoubleValue (distance),
- "DeltaY", DoubleValue (distance),
- "GridWidth", UintegerValue (5),
- "LayoutType", StringValue ("RowFirst"));
+ "MinX", DoubleValue (0.0),
+ "MinY", DoubleValue (0.0),
+ "DeltaX", DoubleValue (distance),
+ "DeltaY", DoubleValue (distance),
+ "GridWidth", UintegerValue (5),
+ "LayoutType", StringValue ("RowFirst"));
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (c);
@@ -198,7 +198,7 @@ int main (int argc, char *argv[])
list.Add (olsr, 10);
InternetStackHelper internet;
- internet.SetRoutingHelper (list);
+ internet.SetRoutingHelper (list); // has effect on the next Install ()
internet.Install (c);
Ipv4AddressHelper ipv4;
@@ -227,7 +227,7 @@ int main (int argc, char *argv[])
// To do-- enable an IP-level trace that shows forwarding events only
}
-
+
// Give OLSR time to converge-- 30 seconds perhaps
Simulator::Schedule (Seconds (30.0), &GenerateTraffic,
source, packetSize, numPackets, interPacketInterval);
diff --git a/examples/wireless/wifi-simple-adhoc.cc b/examples/wireless/wifi-simple-adhoc.cc
index e61ada48f..fb124351b 100644
--- a/examples/wireless/wifi-simple-adhoc.cc
+++ b/examples/wireless/wifi-simple-adhoc.cc
@@ -79,7 +79,7 @@ static void GenerateTraffic (Ptr socket, uint32_t pktSize,
{
socket->Send (Create (pktSize));
Simulator::Schedule (pktInterval, &GenerateTraffic,
- socket, pktSize,pktCount-1, pktInterval);
+ socket, pktSize,pktCount-1, pktInterval);
}
else
{
@@ -105,7 +105,7 @@ int main (int argc, char *argv[])
cmd.AddValue ("numPackets", "number of packets generated", numPackets);
cmd.AddValue ("interval", "interval (seconds) between packets", interval);
cmd.AddValue ("verbose", "turn on all WifiNetDevice log components", verbose);
-
+
cmd.Parse (argc, argv);
// Convert to time object
Time interPacketInterval = Seconds (interval);
@@ -147,7 +147,7 @@ int main (int argc, char *argv[])
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode",StringValue(phyMode),
- "ControlMode",StringValue(phyMode));
+ "ControlMode",StringValue(phyMode));
// Set it to adhoc mode
wifiMac.SetType ("ns3::AdhocWifiMac");
NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c);
diff --git a/examples/wireless/wifi-simple-interference.cc b/examples/wireless/wifi-simple-interference.cc
index cc949b94b..acdc55f31 100644
--- a/examples/wireless/wifi-simple-interference.cc
+++ b/examples/wireless/wifi-simple-interference.cc
@@ -102,6 +102,9 @@ void ReceivePacket (Ptr socket)
socket->GetSockName (addr);
InetSocketAddress iaddr = InetSocketAddress::ConvertFrom (addr);
NS_LOG_UNCOND ("Received one packet! Socket: " << iaddr.GetIpv4 () << " port: " << iaddr.GetPort ());
+ //cast iaddr to void, to suppress iaddr set but not used compiler warning
+ //in optimized builds
+ (void) iaddr;
}
static void GenerateTraffic (Ptr socket, uint32_t pktSize,
@@ -149,7 +152,7 @@ int main (int argc, char *argv[])
cmd.AddValue ("PpacketSize", "size of application packet sent", PpacketSize);
cmd.AddValue ("IpacketSize", "size of interfering packet sent", IpacketSize);
cmd.AddValue ("verbose", "turn on all WifiNetDevice log components", verbose);
-
+
cmd.Parse (argc, argv);
// Convert to time object
Time interPacketInterval = Seconds (interval);
@@ -190,7 +193,7 @@ int main (int argc, char *argv[])
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode",StringValue(phyMode),
- "ControlMode",StringValue(phyMode));
+ "ControlMode",StringValue(phyMode));
// Set it to adhoc mode
wifiMac.SetType ("ns3::AdhocWifiMac");
NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c.Get (0));
@@ -241,7 +244,7 @@ int main (int argc, char *argv[])
// Tracing
wifiPhy.EnablePcap ("wifi-simple-interference", devices.Get (0));
-
+
// Output what we are doing
NS_LOG_UNCOND ("Primary packet RSS=" << Prss << " dBm and interferer RSS=" << Irss << " dBm at time offset=" << delta << " ms");
diff --git a/examples/wireless/wscript b/examples/wireless/wscript
index 773b253bb..80c476077 100644
--- a/examples/wireless/wscript
+++ b/examples/wireless/wscript
@@ -34,7 +34,7 @@ def build(bld):
obj = bld.create_ns3_program('wifi-simple-adhoc-grid', ['internet', 'mobility', 'wifi', 'olsr', 'config-store', 'tools', 'point-to-point'])
obj.source = 'wifi-simple-adhoc-grid.cc'
- obj = bld.create_ns3_program('wifi-simple-infra', ['internet', 'mobility', 'wifi'])
+ obj = bld.create_ns3_program('wifi-simple-infra', ['internet', 'mobility', 'wifi','config-store'])
obj.source = 'wifi-simple-infra.cc'
obj = bld.create_ns3_program('wifi-simple-interference', ['internet', 'mobility', 'wifi', 'config-store', 'tools'])
diff --git a/src/aodv/doc/aodv.h b/src/aodv/doc/aodv.h
index 58095d4c8..37853a9ca 100644
--- a/src/aodv/doc/aodv.h
+++ b/src/aodv/doc/aodv.h
@@ -30,8 +30,7 @@
#define AODV_H
/**
- * \ingroup routing
- * \defgroup aodv AODV
+ * \defgroup aodv AODV Routing
*
* This model implements the base specification of the Ad hoc on demand distance vector (AODV)
* protocol. Implementation is based on RFC3561.
diff --git a/src/aodv/examples/aodv.cc b/src/aodv/examples/aodv.cc
index b41e6d98e..0fcd5ec63 100644
--- a/src/aodv/examples/aodv.cc
+++ b/src/aodv/examples/aodv.cc
@@ -52,7 +52,7 @@ public:
void Run ();
/// Report results
void Report (std::ostream & os);
-
+
private:
///\name parameters
//\{
@@ -67,14 +67,14 @@ private:
/// Print routes if true
bool printRoutes;
//\}
-
+
///\name network
//\{
NodeContainer nodes;
NetDeviceContainer devices;
Ipv4InterfaceContainer interfaces;
//\}
-
+
private:
void CreateNodes ();
void CreateDevices ();
@@ -85,9 +85,9 @@ 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 ();
test.Report (std::cout);
return 0;
@@ -108,16 +108,16 @@ AodvExample::Configure (int argc, char **argv)
{
// Enable AODV logs by default. Comment this if too noisy
// LogComponentEnable("AodvRoutingProtocol", LOG_LEVEL_ALL);
-
+
SeedManager::SetSeed(12345);
CommandLine cmd;
-
+
cmd.AddValue ("pcap", "Write PCAP traces.", pcap);
cmd.AddValue ("printRoutes", "Print routing table dumps.", printRoutes);
cmd.AddValue ("size", "Number of nodes.", size);
cmd.AddValue ("time", "Simulation time, s.", totalTime);
cmd.AddValue ("step", "Grid step, m", step);
-
+
cmd.Parse (argc, argv);
return true;
}
@@ -130,9 +130,9 @@ AodvExample::Run ()
CreateDevices ();
InstallInternetStack ();
InstallApplications ();
-
+
std::cout << "Starting simulation for " << totalTime << " s ...\n";
-
+
Simulator::Stop (Seconds (totalTime));
Simulator::Run ();
Simulator::Destroy ();
@@ -150,20 +150,20 @@ AodvExample::CreateNodes ()
nodes.Create (size);
// Name nodes
for (uint32_t i = 0; i < size; ++i)
- {
- std::ostringstream os;
- os << "node-" << i;
- Names::Add (os.str (), nodes.Get (i));
- }
+ {
+ std::ostringstream os;
+ os << "node-" << i;
+ Names::Add (os.str (), nodes.Get (i));
+ }
// Create static grid
MobilityHelper mobility;
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
- "MinX", DoubleValue (0.0),
- "MinY", DoubleValue (0.0),
- "DeltaX", DoubleValue (step),
- "DeltaY", DoubleValue (0),
- "GridWidth", UintegerValue (size),
- "LayoutType", StringValue ("RowFirst"));
+ "MinX", DoubleValue (0.0),
+ "MinY", DoubleValue (0.0),
+ "DeltaX", DoubleValue (step),
+ "DeltaY", DoubleValue (0),
+ "GridWidth", UintegerValue (size),
+ "LayoutType", StringValue ("RowFirst"));
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (nodes);
}
@@ -179,7 +179,7 @@ AodvExample::CreateDevices ()
WifiHelper wifi = WifiHelper::Default ();
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("OfdmRate6Mbps"), "RtsCtsThreshold", UintegerValue (0));
devices = wifi.Install (wifiPhy, wifiMac, nodes);
-
+
if (pcap)
{
wifiPhy.EnablePcapAll (std::string ("aodv"));
@@ -192,7 +192,7 @@ AodvExample::InstallInternetStack ()
AodvHelper aodv;
// you can configure AODV attributes here using aodv.Set(name, value)
InternetStackHelper stack;
- stack.SetRoutingHelper (aodv);
+ stack.SetRoutingHelper (aodv); // has effect on the next Install ()
stack.Install (nodes);
Ipv4AddressHelper address;
address.SetBase ("10.0.0.0", "255.0.0.0");
@@ -210,11 +210,11 @@ AodvExample::InstallApplications ()
{
V4PingHelper ping (interfaces.GetAddress (size - 1));
ping.SetAttribute ("Verbose", BooleanValue (true));
-
+
ApplicationContainer p = ping.Install (nodes.Get (0));
p.Start (Seconds (0));
p.Stop (Seconds (totalTime) - Seconds(0.001));
-
+
// move node away
Ptr node = nodes.Get (size/2);
Ptr mob = node->GetObject ();
diff --git a/src/aodv/helper/aodv-helper.h b/src/aodv/helper/aodv-helper.h
index 3a9e663b0..c5cf9d16d 100644
--- a/src/aodv/helper/aodv-helper.h
+++ b/src/aodv/helper/aodv-helper.h
@@ -61,7 +61,7 @@ public:
* This method controls the attributes of ns3::aodv::RoutingProtocol
*/
void Set (std::string name, const AttributeValue &value);
-
+
private:
ObjectFactory m_agentFactory;
};
diff --git a/src/aodv/model/aodv-id-cache.cc b/src/aodv/model/aodv-id-cache.cc
index 8924e84b6..fae34e976 100644
--- a/src/aodv/model/aodv-id-cache.cc
+++ b/src/aodv/model/aodv-id-cache.cc
@@ -37,19 +37,19 @@ IdCache::IsDuplicate (Ipv4Address addr, uint32_t id)
{
Purge ();
for (std::vector::const_iterator i = m_idCache.begin ();
- i != m_idCache.end (); ++i)
+ i != m_idCache.end (); ++i)
if (i->m_context == addr && i->m_id == id)
return true;
struct UniqueId uniqueId =
- { addr, id, m_lifetime + Simulator::Now () };
- m_idCache.push_back (uniqueId);
+ { addr, id, m_lifetime + Simulator::Now () };
+ m_idCache.push_back (uniqueId);
return false;
}
void
IdCache::Purge ()
{
m_idCache.erase (remove_if (m_idCache.begin (), m_idCache.end (),
- IsExpired ()), m_idCache.end ());
+ IsExpired ()), m_idCache.end ());
}
uint32_t
@@ -59,4 +59,5 @@ IdCache::GetSize ()
return m_idCache.size ();
}
-}}
+}
+}
diff --git a/src/aodv/model/aodv-id-cache.h b/src/aodv/model/aodv-id-cache.h
index 5330af007..0471d7dfe 100644
--- a/src/aodv/model/aodv-id-cache.h
+++ b/src/aodv/model/aodv-id-cache.h
@@ -46,7 +46,7 @@ class IdCache
{
public:
/// c-tor
- IdCache (Time lifetime): m_lifetime (lifetime) {}
+ IdCache (Time lifetime) : m_lifetime (lifetime) {}
/// Check that entry (addr, id) exists in cache. Add entry, if it doesn't exist.
bool IsDuplicate (Ipv4Address addr, uint32_t id);
/// Remove all expired entries
diff --git a/src/aodv/model/aodv-neighbor.cc b/src/aodv/model/aodv-neighbor.cc
index 0816bb82b..a9320b907 100644
--- a/src/aodv/model/aodv-neighbor.cc
+++ b/src/aodv/model/aodv-neighbor.cc
@@ -41,7 +41,7 @@ Neighbors::Neighbors (Time delay) :
{
m_ntimer.SetDelay(delay);
m_ntimer.SetFunction(&Neighbors::Purge, this);
- m_txErrorCallback = MakeCallback (& Neighbors::ProcessTxError, this);
+ m_txErrorCallback = MakeCallback (&Neighbors::ProcessTxError, this);
}
bool
@@ -49,7 +49,7 @@ Neighbors::IsNeighbor (Ipv4Address addr)
{
Purge ();
for (std::vector::const_iterator i = m_nb.begin ();
- i != m_nb.end (); ++i)
+ i != m_nb.end (); ++i)
{
if (i->m_neighborAddress == addr)
return true;
@@ -62,7 +62,7 @@ Neighbors::GetExpireTime (Ipv4Address addr)
{
Purge ();
for (std::vector::const_iterator i = m_nb.begin (); i
- != m_nb.end (); ++i)
+ != m_nb.end (); ++i)
{
if (i->m_neighborAddress == addr)
return (i->m_expireTime - Simulator::Now ());
@@ -77,7 +77,7 @@ Neighbors::Update (Ipv4Address addr, Time expire)
if (i->m_neighborAddress == addr)
{
i->m_expireTime
- = std::max (expire + Simulator::Now (), i->m_expireTime);
+ = std::max (expire + Simulator::Now (), i->m_expireTime);
if (i->m_hardwareAddress == Mac48Address ())
i->m_hardwareAddress = LookupMacAddress (i->m_neighborAddress);
return;
@@ -144,7 +144,7 @@ Neighbors::LookupMacAddress (Ipv4Address addr)
{
Mac48Address hwaddr;
for (std::vector >::const_iterator i = m_arp.begin ();
- i != m_arp.end (); ++i)
+ i != m_arp.end (); ++i)
{
ArpCache::Entry * entry = (*i)->Lookup (addr);
if (entry != 0 && entry->IsAlive () && !entry->IsExpired ())
diff --git a/src/aodv/model/aodv-neighbor.h b/src/aodv/model/aodv-neighbor.h
index 7709ffc68..28748cc6a 100644
--- a/src/aodv/model/aodv-neighbor.h
+++ b/src/aodv/model/aodv-neighbor.h
@@ -58,7 +58,7 @@ public:
Mac48Address m_hardwareAddress;
Time m_expireTime;
bool close;
-
+
Neighbor (Ipv4Address ip, Mac48Address mac, Time t) :
m_neighborAddress (ip), m_hardwareAddress (mac), m_expireTime (t),
close (false)
@@ -77,7 +77,7 @@ public:
void ScheduleTimer ();
/// Remove all entries
void Clear () { m_nb.clear (); }
-
+
/// Add ARP cache to be used to allow layer 2 notifications processing
void AddArpCache (Ptr);
/// Don't use given ARP cache any more (interface is down)
@@ -101,7 +101,7 @@ private:
std::vector m_nb;
/// list of ARP cached to be used for layer 2 notifications processing
std::vector > m_arp;
-
+
/// Find MAC address by IP using list of ARP caches
Mac48Address LookupMacAddress (Ipv4Address);
/// Process layer 2 TX error notification
diff --git a/src/aodv/model/aodv-packet.cc b/src/aodv/model/aodv-packet.cc
index d67cff599..d752d3b1f 100644
--- a/src/aodv/model/aodv-packet.cc
+++ b/src/aodv/model/aodv-packet.cc
@@ -45,9 +45,9 @@ TypeId
TypeHeader::GetTypeId ()
{
static TypeId tid = TypeId ("ns3::aodv::TypeHeader")
- .SetParent ()
- .AddConstructor ()
- ;
+ .SetParent ()
+ .AddConstructor ()
+ ;
return tid;
}
@@ -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)
{
}
@@ -152,9 +152,9 @@ TypeId
RreqHeader::GetTypeId ()
{
static TypeId tid = TypeId ("ns3::aodv::RreqHeader")
- .SetParent ()
- .AddConstructor ()
- ;
+ .SetParent ()
+ .AddConstructor ()
+ ;
return tid;
}
@@ -205,11 +205,11 @@ void
RreqHeader::Print (std::ostream &os) const
{
os << "RREQ ID " << m_requestID << " destination: ipv4 " << m_dst
- << " sequence number " << m_dstSeqNo << " source: ipv4 "
- << m_origin << " sequence number " << m_originSeqNo
- << " flags:" << " Gratuitous RREP " << (*this).GetGratiousRrep ()
- << " Destination only " << (*this).GetDestinationOnly ()
- << " Unknown sequence number " << (*this).GetUnknownSeqno ();
+ << " sequence number " << m_dstSeqNo << " source: ipv4 "
+ << m_origin << " sequence number " << m_originSeqNo
+ << " flags:" << " Gratuitous RREP " << (*this).GetGratiousRrep ()
+ << " Destination only " << (*this).GetDestinationOnly ()
+ << " Unknown sequence number " << (*this).GetUnknownSeqno ();
}
std::ostream &
@@ -279,8 +279,8 @@ RreqHeader::operator== (RreqHeader const & o) const
RrepHeader::RrepHeader (uint8_t prefixSize, uint8_t hopCount, Ipv4Address dst,
uint32_t dstSeqNo, Ipv4Address origin, Time lifeTime) :
- m_flags (0), m_prefixSize (prefixSize), m_hopCount (hopCount),
- m_dst (dst), m_dstSeqNo (dstSeqNo), m_origin (origin)
+ m_flags (0), m_prefixSize (prefixSize), m_hopCount (hopCount),
+ m_dst (dst), m_dstSeqNo (dstSeqNo), m_origin (origin)
{
m_lifeTime = uint32_t (lifeTime.GetMilliSeconds ());
}
@@ -291,9 +291,9 @@ TypeId
RrepHeader::GetTypeId ()
{
static TypeId tid = TypeId ("ns3::aodv::RrepHeader")
- .SetParent ()
- .AddConstructor ()
- ;
+ .SetParent ()
+ .AddConstructor ()
+ ;
return tid;
}
@@ -348,7 +348,7 @@ RrepHeader::Print (std::ostream &os) const
os << " prefix size " << m_prefixSize;
}
os << " source ipv4 " << m_origin << " lifetime " << m_lifeTime
- << " acknowledgment required flag " << (*this).GetAckRequired ();
+ << " acknowledgment required flag " << (*this).GetAckRequired ();
}
void
@@ -432,9 +432,9 @@ TypeId
RrepAckHeader::GetTypeId ()
{
static TypeId tid = TypeId ("ns3::aodv::RrepAckHeader")
- .SetParent ()
- .AddConstructor ()
- ;
+ .SetParent ()
+ .AddConstructor ()
+ ;
return tid;
}
@@ -498,9 +498,9 @@ TypeId
RerrHeader::GetTypeId ()
{
static TypeId tid = TypeId ("ns3::aodv::RerrHeader")
- .SetParent ()
- .AddConstructor ()
- ;
+ .SetParent ()
+ .AddConstructor ()
+ ;
return tid;
}
diff --git a/src/aodv/model/aodv-packet.h b/src/aodv/model/aodv-packet.h
index 73ef4fa9c..5cc181a6a 100644
--- a/src/aodv/model/aodv-packet.h
+++ b/src/aodv/model/aodv-packet.h
@@ -104,9 +104,9 @@ class RreqHeader : public Header
public:
/// c-tor
RreqHeader (uint8_t flags = 0, uint8_t reserved = 0, uint8_t hopCount = 0,
- uint32_t requestID = 0, Ipv4Address dst = Ipv4Address (),
- uint32_t dstSeqNo = 0, Ipv4Address origin = Ipv4Address (),
- uint32_t originSeqNo = 0);
+ uint32_t requestID = 0, Ipv4Address dst = Ipv4Address (),
+ uint32_t dstSeqNo = 0, Ipv4Address origin = Ipv4Address (),
+ uint32_t originSeqNo = 0);
///\name Header serialization/deserialization
//\{
@@ -182,8 +182,8 @@ class RrepHeader : public Header
public:
/// c-tor
RrepHeader (uint8_t prefixSize = 0, uint8_t hopCount = 0, Ipv4Address dst =
- Ipv4Address (), uint32_t dstSeqNo = 0, Ipv4Address origin =
- Ipv4Address (), Time lifetime = MilliSeconds (0));
+ Ipv4Address (), uint32_t dstSeqNo = 0, Ipv4Address origin =
+ Ipv4Address (), Time lifetime = MilliSeconds (0));
///\name Header serialization/deserialization
//\{
static TypeId GetTypeId ();
@@ -221,12 +221,12 @@ public:
bool operator== (RrepHeader const & o) const;
private:
- uint8_t m_flags; ///< A - acknowledgment required flag
- uint8_t m_prefixSize; ///< Prefix Size
- uint8_t m_hopCount; ///< Hop Count
+ uint8_t m_flags; ///< A - acknowledgment required flag
+ uint8_t m_prefixSize; ///< Prefix Size
+ uint8_t m_hopCount; ///< Hop Count
Ipv4Address m_dst; ///< Destination IP Address
uint32_t m_dstSeqNo; ///< Destination Sequence Number
- Ipv4Address m_origin; ///< Source IP Address
+ Ipv4Address m_origin; ///< Source IP Address
uint32_t m_lifeTime; ///< Lifetime (in milliseconds)
};
diff --git a/src/aodv/model/aodv-routing-protocol.cc b/src/aodv/model/aodv-routing-protocol.cc
index 106f81205..87b6500aa 100644
--- a/src/aodv/model/aodv-routing-protocol.cc
+++ b/src/aodv/model/aodv-routing-protocol.cc
@@ -57,7 +57,7 @@ struct DeferredRouteOutputTag : public Tag
{
/// Positive if output device is fixed in RouteOutput
int32_t oif;
-
+
DeferredRouteOutputTag (int32_t o = -1) : Tag(), oif (o) {}
static TypeId GetTypeId ()
@@ -65,27 +65,27 @@ struct DeferredRouteOutputTag : public Tag
static TypeId tid = TypeId ("ns3::aodv::DeferredRouteOutputTag").SetParent ();
return tid;
}
-
+
TypeId GetInstanceTypeId () const
{
return GetTypeId ();
}
-
+
uint32_t GetSerializedSize () const
{
return sizeof(int32_t);
}
-
+
void Serialize (TagBuffer i) const
{
i.WriteU32 (oif);
}
-
+
void Deserialize (TagBuffer i)
{
oif = i.ReadU32 ();
}
-
+
void Print (std::ostream &os) const
{
os << "DeferredRouteOutputTag: output interface = " << oif;
@@ -96,6 +96,7 @@ struct DeferredRouteOutputTag : public Tag
RoutingProtocol::RoutingProtocol () :
RreqRetries (2),
RreqRateLimit (10),
+ RerrRateLimit (10),
ActiveRouteTimeout (Seconds (3)),
NetDiameter (35),
NodeTraversalTime (MilliSeconds (40)),
@@ -121,8 +122,10 @@ RoutingProtocol::RoutingProtocol () :
m_dpd (PathDiscoveryTime),
m_nb(HelloInterval),
m_rreqCount (0),
+ m_rerrCount (0),
m_htimer (Timer::CANCEL_ON_DESTROY),
- m_rreqRateLimitTimer (Timer::CANCEL_ON_DESTROY)
+ m_rreqRateLimitTimer (Timer::CANCEL_ON_DESTROY),
+ m_rerrRateLimitTimer (Timer::CANCEL_ON_DESTROY)
{
if (EnableHello)
{
@@ -134,98 +137,102 @@ TypeId
RoutingProtocol::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::aodv::RoutingProtocol")
- .SetParent ()
- .AddConstructor ()
- .AddAttribute ("HelloInterval", "HELLO messages emission interval.",
- TimeValue (Seconds (1)),
- MakeTimeAccessor (&RoutingProtocol::HelloInterval),
- MakeTimeChecker ())
- .AddAttribute ("RreqRetries", "Maximum number of retransmissions of RREQ to discover a route",
- UintegerValue (2),
- MakeUintegerAccessor (&RoutingProtocol::RreqRetries),
- MakeUintegerChecker ())
- .AddAttribute ("RreqRateLimit", "Maximum number of RREQ per second.",
- UintegerValue (10),
- MakeUintegerAccessor (&RoutingProtocol::RreqRateLimit),
- MakeUintegerChecker ())
- .AddAttribute ("NodeTraversalTime", "Conservative estimate of the average one hop traversal time for packets and should include "
- "queuing delays, interrupt processing times and transfer times.",
- TimeValue (MilliSeconds (40)),
- MakeTimeAccessor (&RoutingProtocol::NodeTraversalTime),
- MakeTimeChecker ())
- .AddAttribute ("NextHopWait", "Period of our waiting for the neighbour's RREP_ACK = 10 ms + NodeTraversalTime",
- TimeValue (MilliSeconds (50)),
- MakeTimeAccessor (&RoutingProtocol::NextHopWait),
- MakeTimeChecker ())
- .AddAttribute ("ActiveRouteTimeout", "Period of time during which the route is considered to be valid",
- TimeValue (Seconds (3)),
- MakeTimeAccessor (&RoutingProtocol::ActiveRouteTimeout),
- MakeTimeChecker ())
- .AddAttribute ("MyRouteTimeout", "Value of lifetime field in RREP generating by this node = 2 * max(ActiveRouteTimeout, PathDiscoveryTime)",
- TimeValue (Seconds (11.2)),
- MakeTimeAccessor (&RoutingProtocol::MyRouteTimeout),
- MakeTimeChecker ())
- .AddAttribute ("BlackListTimeout", "Time for which the node is put into the blacklist = RreqRetries * NetTraversalTime",
- TimeValue (Seconds (5.6)),
- MakeTimeAccessor (&RoutingProtocol::BlackListTimeout),
- MakeTimeChecker ())
- .AddAttribute ("DeletePeriod", "DeletePeriod is intended to provide an upper bound on the time for which an upstream node A "
- "can have a neighbor B as an active next hop for destination D, while B has invalidated the route to D."
- " = 5 * max (HelloInterval, ActiveRouteTimeout)",
- TimeValue (Seconds (15)),
- MakeTimeAccessor (&RoutingProtocol::DeletePeriod),
- MakeTimeChecker ())
- .AddAttribute ("TimeoutBuffer", "Its purpose is to provide a buffer for the timeout so that if the RREP is delayed"
- " due to congestion, a timeout is less likely to occur while the RREP is still en route back to the source.",
- UintegerValue (2),
- MakeUintegerAccessor (&RoutingProtocol::TimeoutBuffer),
- MakeUintegerChecker ())
- .AddAttribute ("NetDiameter", "Net diameter measures the maximum possible number of hops between two nodes in the network",
- UintegerValue (35),
- MakeUintegerAccessor (&RoutingProtocol::NetDiameter),
- MakeUintegerChecker ())
- .AddAttribute ("NetTraversalTime", "Estimate of the average net traversal time = 2 * NodeTraversalTime * NetDiameter",
- TimeValue (Seconds (2.8)),
- MakeTimeAccessor (&RoutingProtocol::NetTraversalTime),
- MakeTimeChecker ())
- .AddAttribute ("PathDiscoveryTime", "Estimate of maximum time needed to find route in network = 2 * NetTraversalTime",
- TimeValue (Seconds (5.6)),
- MakeTimeAccessor (&RoutingProtocol::PathDiscoveryTime),
- MakeTimeChecker ())
- .AddAttribute ("MaxQueueLen", "Maximum number of packets that we allow a routing protocol to buffer.",
- UintegerValue (64),
- MakeUintegerAccessor (&RoutingProtocol::SetMaxQueueLen,
- &RoutingProtocol::GetMaxQueueLen),
- MakeUintegerChecker ())
- .AddAttribute ("MaxQueueTime", "Maximum time packets can be queued (in seconds)",
- TimeValue (Seconds (30)),
- MakeTimeAccessor (&RoutingProtocol::SetMaxQueueTime,
- &RoutingProtocol::GetMaxQueueTime),
- MakeTimeChecker ())
- .AddAttribute ("AllowedHelloLoss", "Number of hello messages which may be loss for valid link.",
- UintegerValue (2),
- MakeUintegerAccessor (&RoutingProtocol::AllowedHelloLoss),
- MakeUintegerChecker ())
- .AddAttribute ("GratuitousReply", "Indicates whether a gratuitous RREP should be unicast to the node originated route discovery.",
- BooleanValue (true),
- MakeBooleanAccessor (&RoutingProtocol::SetGratuitousReplyFlag,
- &RoutingProtocol::GetGratuitousReplyFlag),
- MakeBooleanChecker ())
- .AddAttribute ("DestinationOnly", "Indicates only the destination may respond to this RREQ.",
- BooleanValue (false),
- MakeBooleanAccessor (&RoutingProtocol::SetDesinationOnlyFlag,
- &RoutingProtocol::GetDesinationOnlyFlag),
- MakeBooleanChecker ())
- .AddAttribute ("EnableHello", "Indicates whether a hello messages enable.",
- BooleanValue (true),
- MakeBooleanAccessor (&RoutingProtocol::SetHelloEnable,
- &RoutingProtocol::GetHelloEnable),
- MakeBooleanChecker ())
- .AddAttribute ("EnableBroadcast", "Indicates whether a broadcast data packets forwarding enable.",
- BooleanValue (true),
- MakeBooleanAccessor (&RoutingProtocol::SetBroadcastEnable,
- &RoutingProtocol::GetBroadcastEnable),
- MakeBooleanChecker ())
+ .SetParent ()
+ .AddConstructor ()
+ .AddAttribute ("HelloInterval", "HELLO messages emission interval.",
+ TimeValue (Seconds (1)),
+ MakeTimeAccessor (&RoutingProtocol::HelloInterval),
+ MakeTimeChecker ())
+ .AddAttribute ("RreqRetries", "Maximum number of retransmissions of RREQ to discover a route",
+ UintegerValue (2),
+ MakeUintegerAccessor (&RoutingProtocol::RreqRetries),
+ MakeUintegerChecker ())
+ .AddAttribute ("RreqRateLimit", "Maximum number of RREQ per second.",
+ UintegerValue (10),
+ MakeUintegerAccessor (&RoutingProtocol::RreqRateLimit),
+ MakeUintegerChecker ())
+ .AddAttribute ("RerrRateLimit", "Maximum number of RERR per second.",
+ UintegerValue (10),
+ MakeUintegerAccessor (&RoutingProtocol::RerrRateLimit),
+ MakeUintegerChecker ())
+ .AddAttribute ("NodeTraversalTime", "Conservative estimate of the average one hop traversal time for packets and should include "
+ "queuing delays, interrupt processing times and transfer times.",
+ TimeValue (MilliSeconds (40)),
+ MakeTimeAccessor (&RoutingProtocol::NodeTraversalTime),
+ MakeTimeChecker ())
+ .AddAttribute ("NextHopWait", "Period of our waiting for the neighbour's RREP_ACK = 10 ms + NodeTraversalTime",
+ TimeValue (MilliSeconds (50)),
+ MakeTimeAccessor (&RoutingProtocol::NextHopWait),
+ MakeTimeChecker ())
+ .AddAttribute ("ActiveRouteTimeout", "Period of time during which the route is considered to be valid",
+ TimeValue (Seconds (3)),
+ MakeTimeAccessor (&RoutingProtocol::ActiveRouteTimeout),
+ MakeTimeChecker ())
+ .AddAttribute ("MyRouteTimeout", "Value of lifetime field in RREP generating by this node = 2 * max(ActiveRouteTimeout, PathDiscoveryTime)",
+ TimeValue (Seconds (11.2)),
+ MakeTimeAccessor (&RoutingProtocol::MyRouteTimeout),
+ MakeTimeChecker ())
+ .AddAttribute ("BlackListTimeout", "Time for which the node is put into the blacklist = RreqRetries * NetTraversalTime",
+ TimeValue (Seconds (5.6)),
+ MakeTimeAccessor (&RoutingProtocol::BlackListTimeout),
+ MakeTimeChecker ())
+ .AddAttribute ("DeletePeriod", "DeletePeriod is intended to provide an upper bound on the time for which an upstream node A "
+ "can have a neighbor B as an active next hop for destination D, while B has invalidated the route to D."
+ " = 5 * max (HelloInterval, ActiveRouteTimeout)",
+ TimeValue (Seconds (15)),
+ MakeTimeAccessor (&RoutingProtocol::DeletePeriod),
+ MakeTimeChecker ())
+ .AddAttribute ("TimeoutBuffer", "Its purpose is to provide a buffer for the timeout so that if the RREP is delayed"
+ " due to congestion, a timeout is less likely to occur while the RREP is still en route back to the source.",
+ UintegerValue (2),
+ MakeUintegerAccessor (&RoutingProtocol::TimeoutBuffer),
+ MakeUintegerChecker ())
+ .AddAttribute ("NetDiameter", "Net diameter measures the maximum possible number of hops between two nodes in the network",
+ UintegerValue (35),
+ MakeUintegerAccessor (&RoutingProtocol::NetDiameter),
+ MakeUintegerChecker ())
+ .AddAttribute ("NetTraversalTime", "Estimate of the average net traversal time = 2 * NodeTraversalTime * NetDiameter",
+ TimeValue (Seconds (2.8)),
+ MakeTimeAccessor (&RoutingProtocol::NetTraversalTime),
+ MakeTimeChecker ())
+ .AddAttribute ("PathDiscoveryTime", "Estimate of maximum time needed to find route in network = 2 * NetTraversalTime",
+ TimeValue (Seconds (5.6)),
+ MakeTimeAccessor (&RoutingProtocol::PathDiscoveryTime),
+ MakeTimeChecker ())
+ .AddAttribute ("MaxQueueLen", "Maximum number of packets that we allow a routing protocol to buffer.",
+ UintegerValue (64),
+ MakeUintegerAccessor (&RoutingProtocol::SetMaxQueueLen,
+ &RoutingProtocol::GetMaxQueueLen),
+ MakeUintegerChecker ())
+ .AddAttribute ("MaxQueueTime", "Maximum time packets can be queued (in seconds)",
+ TimeValue (Seconds (30)),
+ MakeTimeAccessor (&RoutingProtocol::SetMaxQueueTime,
+ &RoutingProtocol::GetMaxQueueTime),
+ MakeTimeChecker ())
+ .AddAttribute ("AllowedHelloLoss", "Number of hello messages which may be loss for valid link.",
+ UintegerValue (2),
+ MakeUintegerAccessor (&RoutingProtocol::AllowedHelloLoss),
+ MakeUintegerChecker ())
+ .AddAttribute ("GratuitousReply", "Indicates whether a gratuitous RREP should be unicast to the node originated route discovery.",
+ BooleanValue (true),
+ MakeBooleanAccessor (&RoutingProtocol::SetGratuitousReplyFlag,
+ &RoutingProtocol::GetGratuitousReplyFlag),
+ MakeBooleanChecker ())
+ .AddAttribute ("DestinationOnly", "Indicates only the destination may respond to this RREQ.",
+ BooleanValue (false),
+ MakeBooleanAccessor (&RoutingProtocol::SetDesinationOnlyFlag,
+ &RoutingProtocol::GetDesinationOnlyFlag),
+ MakeBooleanChecker ())
+ .AddAttribute ("EnableHello", "Indicates whether a hello messages enable.",
+ BooleanValue (true),
+ MakeBooleanAccessor (&RoutingProtocol::SetHelloEnable,
+ &RoutingProtocol::GetHelloEnable),
+ MakeBooleanChecker ())
+ .AddAttribute ("EnableBroadcast", "Indicates whether a broadcast data packets forwarding enable.",
+ BooleanValue (true),
+ MakeBooleanAccessor (&RoutingProtocol::SetBroadcastEnable,
+ &RoutingProtocol::GetBroadcastEnable),
+ MakeBooleanChecker ())
;
return tid;
}
@@ -233,8 +240,8 @@ RoutingProtocol::GetTypeId (void)
void
RoutingProtocol::SetMaxQueueLen (uint32_t len)
{
- MaxQueueLen = len;
- m_queue.SetMaxQueueLen (len);
+ MaxQueueLen = len;
+ m_queue.SetMaxQueueLen (len);
}
void
RoutingProtocol::SetMaxQueueTime (Time t)
@@ -251,8 +258,8 @@ void
RoutingProtocol::DoDispose ()
{
m_ipv4 = 0;
- for (std::map , Ipv4InterfaceAddress>::iterator iter =
- m_socketAddresses.begin (); iter != m_socketAddresses.end (); iter++)
+ for (std::map, Ipv4InterfaceAddress>::iterator iter =
+ m_socketAddresses.begin (); iter != m_socketAddresses.end (); iter++)
{
iter->first->Close ();
}
@@ -276,16 +283,21 @@ RoutingProtocol::Start ()
m_nb.ScheduleTimer ();
}
m_rreqRateLimitTimer.SetFunction (&RoutingProtocol::RreqRateLimitTimerExpire,
- this);
+ this);
m_rreqRateLimitTimer.Schedule (Seconds (1));
+
+ m_rerrRateLimitTimer.SetFunction (&RoutingProtocol::RerrRateLimitTimerExpire,
+ this);
+ m_rerrRateLimitTimer.Schedule (Seconds (1));
+
}
Ptr
RoutingProtocol::RouteOutput (Ptr p, const Ipv4Header &header,
- Ptr oif, Socket::SocketErrno &sockerr)
+ Ptr oif, Socket::SocketErrno &sockerr)
{
- NS_LOG_FUNCTION (this << header << (oif? oif->GetIfIndex () : 0));
- if (! p)
+ NS_LOG_FUNCTION (this << header << (oif ? oif->GetIfIndex () : 0));
+ if (!p)
{
return LoopbackRoute (header, oif); // later
}
@@ -321,7 +333,7 @@ RoutingProtocol::RouteOutput (Ptr p, const Ipv4Header &header,
// routed to loopback, received from loopback and passed to RouteInput (see below)
uint32_t iif = (oif ? m_ipv4->GetInterfaceForDevice (oif) : -1);
DeferredRouteOutputTag tag (iif);
- if (! p->PeekPacketTag (tag))
+ if (!p->PeekPacketTag (tag))
{
p->AddPacketTag (tag);
}
@@ -330,7 +342,7 @@ RoutingProtocol::RouteOutput (Ptr p, const Ipv4Header &header,
void
RoutingProtocol::DeferredRouteOutput (Ptr p, const Ipv4Header & header,
- UnicastForwardCallback ucb, ErrorCallback ecb)
+ UnicastForwardCallback ucb, ErrorCallback ecb)
{
NS_LOG_FUNCTION (this << p << header);
NS_ASSERT (p != 0 && p != Ptr ());
@@ -352,8 +364,8 @@ RoutingProtocol::DeferredRouteOutput (Ptr p, const Ipv4Header & he
bool
RoutingProtocol::RouteInput (Ptr p, const Ipv4Header &header,
- Ptr idev, UnicastForwardCallback ucb,
- MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb)
+ Ptr idev, UnicastForwardCallback ucb,
+ MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb)
{
NS_LOG_FUNCTION (this << p->GetUid() << header.GetDestination() << idev->GetAddress());
if (m_socketAddresses.empty ())
@@ -369,7 +381,7 @@ RoutingProtocol::RouteInput (Ptr p, const Ipv4Header &header,
Ipv4Address dst = header.GetDestination ();
Ipv4Address origin = header.GetSource ();
-
+
// Deferred route request
if (idev == m_lo)
{
@@ -380,7 +392,7 @@ RoutingProtocol::RouteInput (Ptr p, const Ipv4Header &header,
return true;
}
}
-
+
// Duplicate of own packet
if (IsMyOwnAddress (origin))
return true;
@@ -392,8 +404,8 @@ RoutingProtocol::RouteInput (Ptr p, const Ipv4Header &header,
}
// Broadcast local delivery/forwarding
- for (std::map , Ipv4InterfaceAddress>::const_iterator j =
- m_socketAddresses.begin (); j != m_socketAddresses.end (); ++j)
+ for (std::map, Ipv4InterfaceAddress>::const_iterator j =
+ m_socketAddresses.begin (); j != m_socketAddresses.end (); ++j)
{
Ipv4InterfaceAddress iface = j->second;
if (m_ipv4->GetInterfaceForAddress (iface.GetLocal ()) == iif)
@@ -442,7 +454,7 @@ RoutingProtocol::RouteInput (Ptr p, const Ipv4Header &header,
return true;
}
}
-
+
// Unicast local delivery
if (m_ipv4->IsDestinationAddress (dst, iif))
{
@@ -472,7 +484,7 @@ RoutingProtocol::RouteInput (Ptr p, const Ipv4Header &header,
bool
RoutingProtocol::Forwarding (Ptr p, const Ipv4Header & header,
- UnicastForwardCallback ucb, ErrorCallback ecb)
+ UnicastForwardCallback ucb, ErrorCallback ecb)
{
NS_LOG_FUNCTION (this);
Ipv4Address dst = header.GetDestination ();
@@ -531,7 +543,7 @@ RoutingProtocol::SetIpv4 (Ptr ipv4)
{
NS_ASSERT (ipv4 != 0);
NS_ASSERT (m_ipv4 == 0);
-
+
if (EnableHello)
{
m_htimer.SetFunction (&RoutingProtocol::HelloTimerExpire, this);
@@ -539,18 +551,18 @@ RoutingProtocol::SetIpv4 (Ptr ipv4)
}
m_ipv4 = ipv4;
-
+
// Create lo route. It is asserted that the only one interface up for now is loopback
NS_ASSERT (m_ipv4->GetNInterfaces () == 1 && m_ipv4->GetAddress (0, 0).GetLocal () == Ipv4Address ("127.0.0.1"));
m_lo = m_ipv4->GetNetDevice (0);
NS_ASSERT (m_lo != 0);
// Remember lo route
- RoutingTableEntry rt (/*device=*/m_lo, /*dst=*/Ipv4Address::GetLoopback (), /*know seqno=*/true, /*seqno=*/0,
- /*iface=*/Ipv4InterfaceAddress (Ipv4Address::GetLoopback (), Ipv4Mask ("255.0.0.0")),
- /*hops=*/1, /*next hop=*/Ipv4Address::GetLoopback (),
- /*lifetime=*/Simulator::GetMaximumSimulationTime ());
+ RoutingTableEntry rt (/*device=*/ m_lo, /*dst=*/ Ipv4Address::GetLoopback (), /*know seqno=*/ true, /*seqno=*/ 0,
+ /*iface=*/ Ipv4InterfaceAddress (Ipv4Address::GetLoopback (), Ipv4Mask ("255.0.0.0")),
+ /*hops=*/ 1, /*next hop=*/ Ipv4Address::GetLoopback (),
+ /*lifetime=*/ Simulator::GetMaximumSimulationTime ());
m_routingTable.AddRoute (rt);
-
+
Simulator::ScheduleNow (&RoutingProtocol::Start, this);
}
@@ -569,7 +581,7 @@ RoutingProtocol::NotifyInterfaceUp (uint32_t i)
// Create a socket to listen only on this interface
Ptr socket = Socket::CreateSocket (GetObject (),
- UdpSocketFactory::GetTypeId ());
+ UdpSocketFactory::GetTypeId ());
NS_ASSERT (socket != 0);
socket->SetRecvCallback (MakeCallback (&RoutingProtocol::RecvAodv, this));
socket->BindToNetDevice (l3->GetNetDevice (i));
@@ -580,10 +592,10 @@ RoutingProtocol::NotifyInterfaceUp (uint32_t i)
// Add local broadcast record to the routing table
Ptr dev = m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (iface.GetLocal ()));
- RoutingTableEntry rt (/*device=*/dev, /*dst=*/iface.GetBroadcast (), /*know seqno=*/true, /*seqno=*/0, /*iface=*/iface,
- /*hops=*/1, /*next hop=*/iface.GetBroadcast (), /*lifetime=*/Simulator::GetMaximumSimulationTime ());
+ RoutingTableEntry rt (/*device=*/ dev, /*dst=*/ iface.GetBroadcast (), /*know seqno=*/ true, /*seqno=*/ 0, /*iface=*/ iface,
+ /*hops=*/ 1, /*next hop=*/ iface.GetBroadcast (), /*lifetime=*/ Simulator::GetMaximumSimulationTime ());
m_routingTable.AddRoute (rt);
-
+
// Allow neighbor manager use this interface for layer 2 feedback if possible
Ptr wifi = dev->GetObject ();
if (wifi == 0)
@@ -591,7 +603,7 @@ RoutingProtocol::NotifyInterfaceUp (uint32_t i)
Ptr mac = wifi->GetMac ();
if (mac == 0)
return;
-
+
mac->TraceConnectWithoutContext ("TxErrHeader", m_nb.GetTxErrorCallback ());
m_nb.AddArpCache (l3->GetInterface (i)->GetArpCache ());
}
@@ -611,11 +623,11 @@ RoutingProtocol::NotifyInterfaceDown (uint32_t i)
if (mac != 0)
{
mac->TraceDisconnectWithoutContext ("TxErrHeader",
- m_nb.GetTxErrorCallback ());
+ m_nb.GetTxErrorCallback ());
m_nb.DelArpCache (l3->GetInterface (i)->GetArpCache ());
}
}
-
+
// Close socket
Ptr socket = FindSocketWithInterfaceAddress (m_ipv4->GetAddress (i, 0));
NS_ASSERT (socket);
@@ -649,7 +661,7 @@ RoutingProtocol::NotifyAddAddress (uint32_t i, Ipv4InterfaceAddress address)
return;
// Create a socket to listen only on this interface
Ptr socket = Socket::CreateSocket (GetObject (),
- UdpSocketFactory::GetTypeId ());
+ UdpSocketFactory::GetTypeId ());
NS_ASSERT (socket != 0);
socket->SetRecvCallback (MakeCallback (&RoutingProtocol::RecvAodv,this));
socket->BindToNetDevice (l3->GetNetDevice (i));
@@ -661,9 +673,9 @@ RoutingProtocol::NotifyAddAddress (uint32_t i, Ipv4InterfaceAddress address)
// Add local broadcast record to the routing table
Ptr dev = m_ipv4->GetNetDevice (
m_ipv4->GetInterfaceForAddress (iface.GetLocal ()));
- RoutingTableEntry rt (/*device=*/dev, /*dst=*/iface.GetBroadcast (), /*know seqno=*/true,
- /*seqno=*/0, /*iface=*/iface, /*hops=*/1,
- /*next hop=*/iface.GetBroadcast (), /*lifetime=*/Simulator::GetMaximumSimulationTime ());
+ RoutingTableEntry rt (/*device=*/ dev, /*dst=*/ iface.GetBroadcast (), /*know seqno=*/ true,
+ /*seqno=*/ 0, /*iface=*/ iface, /*hops=*/ 1,
+ /*next hop=*/ iface.GetBroadcast (), /*lifetime=*/ Simulator::GetMaximumSimulationTime ());
m_routingTable.AddRoute (rt);
}
}
@@ -688,7 +700,7 @@ RoutingProtocol::NotifyRemoveAddress (uint32_t i, Ipv4InterfaceAddress address)
Ipv4InterfaceAddress iface = l3->GetAddress (i, 0);
// Create a socket to listen only on this interface
Ptr socket = Socket::CreateSocket (GetObject (),
- UdpSocketFactory::GetTypeId ());
+ UdpSocketFactory::GetTypeId ());
NS_ASSERT (socket != 0);
socket->SetRecvCallback (MakeCallback (&RoutingProtocol::RecvAodv, this));
// Bind to any IP address so that broadcasts can be received
@@ -698,8 +710,8 @@ RoutingProtocol::NotifyRemoveAddress (uint32_t i, Ipv4InterfaceAddress address)
// Add local broadcast record to the routing table
Ptr dev = m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (iface.GetLocal ()));
- RoutingTableEntry rt (/*device=*/dev, /*dst=*/iface.GetBroadcast (), /*know seqno=*/true, /*seqno=*/0, /*iface=*/iface,
- /*hops=*/1, /*next hop=*/iface.GetBroadcast (), /*lifetime=*/Simulator::GetMaximumSimulationTime ());
+ RoutingTableEntry rt (/*device=*/ dev, /*dst=*/ iface.GetBroadcast (), /*know seqno=*/ true, /*seqno=*/ 0, /*iface=*/ iface,
+ /*hops=*/ 1, /*next hop=*/ iface.GetBroadcast (), /*lifetime=*/ Simulator::GetMaximumSimulationTime ());
m_routingTable.AddRoute (rt);
}
if (m_socketAddresses.empty ())
@@ -721,8 +733,8 @@ bool
RoutingProtocol::IsMyOwnAddress (Ipv4Address src)
{
NS_LOG_FUNCTION (this << src);
- for (std::map , Ipv4InterfaceAddress>::const_iterator j =
- m_socketAddresses.begin (); j != m_socketAddresses.end (); ++j)
+ for (std::map