merge
This commit is contained in:
@@ -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
|
||||
|
||||
2
.hgtags
2
.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
|
||||
|
||||
17
CHANGES.html
17
CHANGES.html
@@ -83,6 +83,16 @@ objects. The implementation of <b>int64x64_t</b> is based on the previously-exis
|
||||
|
||||
<h2>Changes to existing API:</h2>
|
||||
<ul>
|
||||
<li><b>Wifi TX duration calculation moved from InterferenceHelper to WifiPhy</b>
|
||||
<p>The following static methods have been moved from the InterferenceHelper class to the WifiPhy class:
|
||||
<pre>
|
||||
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);
|
||||
</pre>
|
||||
</p></li>
|
||||
<li><b>Test cases no longer return a boolean value</b>
|
||||
<p>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.
|
||||
</p></li>
|
||||
@@ -104,6 +114,13 @@ Time result = Time (tmp * 5);
|
||||
</pre>
|
||||
</p>
|
||||
</li>
|
||||
<li><b>Multicast GetOutputTtl() commands</b>
|
||||
<p> 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.
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2>Changed behavior:</h2>
|
||||
|
||||
@@ -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<Object> 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
|
||||
------------
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 53 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 118 KiB |
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
58
doc/main.h
58
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 <b><a href="modules.html">Modules</a></b>
|
||||
* tab.
|
||||
|
||||
@@ -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
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -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:::
|
||||
|
||||
@@ -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)
|
||||
]
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
Core
|
||||
----
|
||||
|
||||
.. toctree::
|
||||
|
||||
random-variables
|
||||
callbacks
|
||||
object-model
|
||||
attributes
|
||||
object-names
|
||||
logging
|
||||
tracing
|
||||
realtime
|
||||
distributed
|
||||
packets
|
||||
helpers
|
||||
python
|
||||
@@ -1,8 +0,0 @@
|
||||
Emulation
|
||||
---------
|
||||
|
||||
.. toctree::
|
||||
|
||||
emulation-overview
|
||||
emu
|
||||
tap
|
||||
137
doc/manual/source/enable-modules.rst
Normal file
137
doc/manual/source/enable-modules.rst
Normal file
@@ -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)
|
||||
141
doc/manual/source/enable-tests.rst
Normal file
141
doc/manual/source/enable-tests.rst
Normal file
@@ -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)
|
||||
@@ -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: `<http://www.nstools.org/techprog.shtml>`_.
|
||||
@@ -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.
|
||||
|
||||
@@ -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 <http://www.nsnam.org/doxygen/index.html>`_: Documentation of the public APIs of the simulator
|
||||
* `Tutorial <http://www.nsnam.org/tutorials.html>`_
|
||||
* `Reference Manual <http://www.nsnam.org/tutorials.html>`_: *(this document)*
|
||||
* `ns-3 wiki <http://www.nsnam.org/wiki/index.php/Main_Page>`_
|
||||
* `Manual <http://www.nsnam.org/tutorials.html>`_: *(this document)*
|
||||
* `Model Library <http://www.nsnam.org/tutorials.html>`_
|
||||
* `ns-3 wiki <http://www.nsnam.org/wiki/index.php/Main_Page>`_
|
||||
|
||||
This document is written in `reStructuredText <http://docutils.sourceforge.net/rst.html>`_ for `Sphinx <http://sphinx.pocoo.org/>`_ and is maintained in the
|
||||
``doc/manual`` directory of ns-3's source code.
|
||||
@@ -18,9 +19,15 @@ This document is written in `reStructuredText <http://docutils.sourceforge.net/r
|
||||
:maxdepth: 2
|
||||
|
||||
organization
|
||||
core
|
||||
nodes-and-devices
|
||||
emulation
|
||||
internet-models
|
||||
applications
|
||||
random-variables
|
||||
callbacks
|
||||
object-model
|
||||
attributes
|
||||
object-names
|
||||
logging
|
||||
tracing
|
||||
realtime
|
||||
helpers
|
||||
python
|
||||
tests
|
||||
support
|
||||
|
||||
@@ -174,7 +174,7 @@ sort, it makes sense to put it into the ``src/`` directory somewhere,
|
||||
particularly for ease of integrating with the build system.
|
||||
|
||||
In the case of the error model, it is very related to the packet class, so it
|
||||
makes sense to implement this in the ``src/common/`` directory where |ns3|
|
||||
makes sense to implement this in the ``src/network/model`` directory where |ns3|
|
||||
packets are implemented.
|
||||
|
||||
waf and wscript
|
||||
@@ -186,7 +186,7 @@ want to integrate your new source files into this system. This requires that you
|
||||
add your files to the ``wscript`` file found in each directory.
|
||||
|
||||
Let's start with empty files error-model.h and error-model.cc, and add this to
|
||||
``src/common/wscript``. It is really just a matter of adding the .cc file to the
|
||||
``src/network/wscript``. It is really just a matter of adding the .cc file to the
|
||||
rest of the source files, and the .h file to the list of the header files.
|
||||
|
||||
Now, pop up to the top level directory and type "./waf --check". You
|
||||
@@ -304,8 +304,8 @@ from class Object.::
|
||||
A few things to note here. We need to include ``object.h``. The convention in
|
||||
|ns3| is that if the header file is co-located in the same directory, it may be
|
||||
included without any path prefix. Therefore, if we were implementing ErrorModel
|
||||
in ``src/core`` directory, we could have just said "``#include "object.h"``".
|
||||
But we are in ``src/common``, so we must include it as "``#include
|
||||
in ``src/core/model`` directory, we could have just said "``#include "object.h"``".
|
||||
But we are in ``src/network/model``, so we must include it as "``#include
|
||||
"ns3/object.h"``". Note also that this goes outside the namespace declaration.
|
||||
|
||||
Second, each class must implement a static public member function called
|
||||
|
||||
331
doc/manual/source/new-modules.rst
Normal file
331
doc/manual/source/new-modules.rst
Normal file
@@ -0,0 +1,331 @@
|
||||
.. include:: replace.txt
|
||||
|
||||
Adding a New Module to |ns3|
|
||||
----------------------------
|
||||
|
||||
When you have created a group of related classes, examples, and tests,
|
||||
they can be combined together into an |ns3| module so that they can be
|
||||
used with existing |ns3| modules and by other researchers.
|
||||
|
||||
This chapter walks you through the steps necessary to add a new module
|
||||
to |ns3|.
|
||||
|
||||
Step 1 - Familiarize yourself with the module layout
|
||||
****************************************************
|
||||
|
||||
All modules can be found in the ``src`` directory. Each module can be
|
||||
found in a directory that has the same name as the module. For
|
||||
example, the spectrum module can be found here: ::
|
||||
|
||||
src/spectrum
|
||||
|
||||
A prototypical module has the following directory structure and
|
||||
required files: ::
|
||||
|
||||
src/
|
||||
module-name/
|
||||
bindings/
|
||||
doc/
|
||||
examples/
|
||||
wscript
|
||||
helper/
|
||||
model/
|
||||
test/
|
||||
examples-to-run.py
|
||||
wscript
|
||||
|
||||
Not all directories will be present in each module.
|
||||
|
||||
Step 2 - Create your new module based on the template module
|
||||
************************************************************
|
||||
|
||||
The template module ::
|
||||
|
||||
src/template
|
||||
|
||||
is a skeleton module that shows how modules should be created.
|
||||
|
||||
For the purposes of this discussion we will assume that your new module is called "new-module". From the top level |ns3| directory, do the following to copy the template module to a new directory with the same name as your new module: ::
|
||||
|
||||
cp -r src/template src/new-module
|
||||
|
||||
Now you will need to open the following file in your favorite text editor: ::
|
||||
|
||||
src/new-module/wscript
|
||||
|
||||
and replace all of the occurrences of "template" in this wscript file with the name of your new module, i.e. "new-module" for our assumed module name.
|
||||
|
||||
You will also need to specify the |ns3| modules your new module will
|
||||
depend on. Let's assume that "new-module" depends on the internet,
|
||||
mobility, and aodv modules. Then the call to the function that will
|
||||
create this module should look like this when you are done with this
|
||||
step: ::
|
||||
|
||||
module = bld.create_ns3_module('new-module', ['internet', 'mobility', 'aodv'])
|
||||
|
||||
As an example, the dependencies for the spectrum module are specified
|
||||
in ::
|
||||
|
||||
src/spectrum/wscript
|
||||
|
||||
with the following function call: ::
|
||||
|
||||
module = bld.create_ns3_module('spectrum', ['internet', 'propagation',
|
||||
'applications'])
|
||||
|
||||
If your module will have model source files, then create the following directory where they will go: ::
|
||||
|
||||
mkdir src/new-module/model
|
||||
|
||||
Copy all of your module's model source files to the above directory.
|
||||
|
||||
If your module will have helper source files, then create the following directory where they will go: ::
|
||||
|
||||
mkdir src/new-module/helper
|
||||
|
||||
Copy all of your module's helper source files to the above directory.
|
||||
|
||||
If your module will have tests, then copy all of your module's test files to the following directory: ::
|
||||
|
||||
mkdir src/new-module/test
|
||||
|
||||
|
||||
Step 3 - Specify your module's source files
|
||||
*******************************************
|
||||
|
||||
If your new module has model and/or helper source files, then they
|
||||
must be specified in your ::
|
||||
|
||||
src/new-module/wscript
|
||||
|
||||
file by modifying it with your text editor.
|
||||
|
||||
As an example, the source files for the spectrum module are specified
|
||||
in ::
|
||||
|
||||
src/spectrum/wscript
|
||||
|
||||
with the following list of source files: ::
|
||||
|
||||
module.source = [
|
||||
'model/spectrum-model.cc',
|
||||
'model/spectrum-value.cc',
|
||||
.
|
||||
.
|
||||
.
|
||||
'model/microwave-oven-spectrum-value-helper.cc',
|
||||
'helper/spectrum-helper.cc',
|
||||
'helper/adhoc-aloha-noack-ideal-phy-helper.cc',
|
||||
'helper/waveform-generator-helper.cc',
|
||||
'helper/spectrum-analyzer-helper.cc',
|
||||
]
|
||||
|
||||
Step 4 - Specify your module's header files
|
||||
*******************************************
|
||||
|
||||
If your new module has model and/or helper header files, then they
|
||||
must be specified in your ::
|
||||
|
||||
src/new-module/wscript
|
||||
|
||||
file by modifying it with your text editor.
|
||||
|
||||
As an example, the header files for the spectrum module are specified
|
||||
in ::
|
||||
|
||||
src/spectrum/wscript
|
||||
|
||||
with the following function call, module name, and list of header
|
||||
files. Note that the argument for the function new_task_gen() tells
|
||||
waf to install this module's headers with the other |ns3| headers: ::
|
||||
|
||||
headers = bld.new_task_gen('ns3header')
|
||||
|
||||
headers.module = 'spectrum'
|
||||
|
||||
headers.source = [
|
||||
'model/spectrum-model.h',
|
||||
'model/spectrum-value.h',
|
||||
.
|
||||
.
|
||||
.
|
||||
'model/microwave-oven-spectrum-value-helper.h',
|
||||
'helper/spectrum-helper.h',
|
||||
'helper/adhoc-aloha-noack-ideal-phy-helper.h',
|
||||
'helper/waveform-generator-helper.h',
|
||||
'helper/spectrum-analyzer-helper.h',
|
||||
]
|
||||
|
||||
Step 5 - Specify your module's tests
|
||||
************************************
|
||||
|
||||
If your new module has tests, then they must be specified in your ::
|
||||
|
||||
src/new-module/wscript
|
||||
|
||||
file by modifying it with your text editor.
|
||||
|
||||
As an example, the tests for the spectrum module are specified in ::
|
||||
|
||||
src/spectrum/wscript
|
||||
|
||||
with the following function call and list of test suites: ::
|
||||
|
||||
module_test = bld.create_ns3_module_test_library('spectrum')
|
||||
|
||||
module_test.source = [
|
||||
'test/spectrum-interference-test.cc',
|
||||
'test/spectrum-value-test.cc',
|
||||
]
|
||||
|
||||
|
||||
Step 6 - Specify your module's examples
|
||||
***************************************
|
||||
|
||||
If your new module has examples, then they must be specified in your ::
|
||||
|
||||
src/new-module/examples/wscript
|
||||
|
||||
file by modifying it with your text editor.
|
||||
|
||||
As an example, the examples for the core module are specified in ::
|
||||
|
||||
src/core/examples/wscript
|
||||
|
||||
The core module's C++ examples are specified using the following
|
||||
function calls and source file names. Note that the second argument
|
||||
for the function create_ns3_program() is the list of modules that the
|
||||
program being created depends on: ::
|
||||
|
||||
obj = bld.create_ns3_program('main-callback', ['core'])
|
||||
obj.source = 'main-callback.cc'
|
||||
|
||||
obj = bld.create_ns3_program('sample-simulator', ['core'])
|
||||
obj.source = 'sample-simulator.cc'
|
||||
|
||||
The core module's Python examples are specified using the following
|
||||
function call. Note that the second argument for the function
|
||||
register_ns3_script() is the list of modules that the Python example
|
||||
depends on: ::
|
||||
|
||||
bld.register_ns3_script('sample-simulator.py', ['core'])
|
||||
|
||||
Step 7 - Specify which of your module's examples should be run
|
||||
**************************************************************
|
||||
|
||||
If your new module has examples, then you must specify which of them
|
||||
should be run in your ::
|
||||
|
||||
src/new-module/tests/examples-to-run.py
|
||||
|
||||
file by modifying it with your text editor. These examples are run by
|
||||
test.py.
|
||||
|
||||
As an example, the examples that are run by test.py for the core module are specified in ::
|
||||
|
||||
src/core/tests/examples-to-run
|
||||
|
||||
using the following two lists of C++ and Python examples: ::
|
||||
|
||||
# A list of C++ examples to run in order to ensure that they remain
|
||||
# buildable and runnable over time. Each tuple in the list contains
|
||||
#
|
||||
# (example_name, do_run, do_valgrind_run).
|
||||
#
|
||||
# See test.py for more information.
|
||||
cpp_examples = [
|
||||
("main-attribute-value", "True", "True"),
|
||||
("main-callback", "True", "True"),
|
||||
("sample-simulator", "True", "True"),
|
||||
("main-ptr", "True", "True"),
|
||||
("main-random-variable", "True", "True"),
|
||||
("sample-random-variable", "True", "True"),
|
||||
]
|
||||
|
||||
# A list of Python examples to run in order to ensure that they remain
|
||||
# runnable over time. Each tuple in the list contains
|
||||
#
|
||||
# (example_name, do_run).
|
||||
#
|
||||
# See test.py for more information.
|
||||
python_examples = [
|
||||
("sample-simulator.py", "True"),
|
||||
]
|
||||
|
||||
Each tuple in the C++ list of examples to run contains ::
|
||||
|
||||
(example_name, do_run, do_valgrind_run)
|
||||
|
||||
where example_name is the executable to be run, do_run is a
|
||||
condition under which to run the example, and do_valgrind_run is
|
||||
a condition under which to run the example under valgrind. This
|
||||
is needed because NSC causes illegal instruction crashes with
|
||||
some tests when they are run under valgrind.
|
||||
|
||||
Note that the two conditions are Python statements that
|
||||
can depend on waf configuration variables. For example, ::
|
||||
|
||||
("tcp-nsc-lfn", "NSC_ENABLED == True", "NSC_ENABLED == False"),
|
||||
|
||||
Each tuple in the Python list of examples to run contains ::
|
||||
|
||||
(example_name, do_run)
|
||||
|
||||
where example_name is the Python script to be run and
|
||||
do_run is a condition under which to run the example.
|
||||
|
||||
Note that the condition is a Python statement that can
|
||||
depend on waf configuration variables. For example, ::
|
||||
|
||||
("realtime-udp-echo.py", "ENABLE_REAL_TIME == False"),
|
||||
|
||||
|
||||
Step 8 - Add your module to the list on |ns3| modules
|
||||
*****************************************************
|
||||
|
||||
Your new module must be added to the current list of |ns3| modules by modifying the following wscript file with your text editor: ::
|
||||
|
||||
src/wscript
|
||||
|
||||
In that file, you will find the following list of modules ::
|
||||
|
||||
all_modules = (
|
||||
'core',
|
||||
'network',
|
||||
'config-store',
|
||||
'internet',
|
||||
.
|
||||
.
|
||||
.
|
||||
'point-to-point-layout',
|
||||
'csma-layout',
|
||||
'template',
|
||||
)
|
||||
|
||||
Add your new module's name to the list like this ::
|
||||
|
||||
all_modules = (
|
||||
'core',
|
||||
'network',
|
||||
'config-store',
|
||||
'internet',
|
||||
.
|
||||
.
|
||||
.
|
||||
'point-to-point-layout',
|
||||
'csma-layout',
|
||||
'template',
|
||||
'new-module',
|
||||
)
|
||||
|
||||
|
||||
Step 9 - Build and test your new module
|
||||
***************************************
|
||||
|
||||
You can now build and test your module as normal: ::
|
||||
|
||||
./waf configure --enable-examples --enable-tests
|
||||
./waf build
|
||||
./test.py
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
Node and NetDevices
|
||||
-------------------
|
||||
|
||||
.. toctree::
|
||||
|
||||
nodes-and-devices-overview
|
||||
simple
|
||||
point-to-point
|
||||
csma
|
||||
wifi
|
||||
mesh
|
||||
bridge
|
||||
wimax
|
||||
lte
|
||||
ff-api
|
||||
uan
|
||||
energy
|
||||
openflow-switch
|
||||
@@ -27,10 +27,9 @@ on modules beneath them in the figure.
|
||||
|
||||
We first describe the core of the simulator; those components that are
|
||||
common across all protocol, hardware, and environmental models.
|
||||
The simulation core is implemented
|
||||
in ``src/core``, and the core is used to build the simulation engine
|
||||
``src/simulator``. Packets are fundamental objects in a network simulator
|
||||
and are implemented in ``src/common``. These three simulation modules by
|
||||
The simulation core is implemented in ``src/core``. Packets are
|
||||
fundamental objects in a network simulator
|
||||
and are implemented in ``src/network``. These two simulation modules by
|
||||
themselves are intended to comprise a generic simulation core that can be
|
||||
used by different kinds of networks, not just Internet-based networks. The
|
||||
above modules of |ns3| are independent of specific network and device
|
||||
|
||||
@@ -193,7 +193,7 @@ Types of RandomVariables
|
||||
************************
|
||||
|
||||
The following types of random variables are provided, and are documented in the
|
||||
|ns3| Doxygen or by reading ``src/core/random-variable.h``. Users can also
|
||||
|ns3| Doxygen or by reading ``src/core/model/random-variable.h``. Users can also
|
||||
create their own custom random variables by deriving from class
|
||||
:cpp:class:`RandomVariable`.
|
||||
|
||||
|
||||
@@ -60,8 +60,8 @@ perspective. Users just need to set the attribute
|
||||
GlobalValue::Bind ("SimulatorImplementationType",
|
||||
StringValue ("ns3::RealtimeSimulatorImpl"));
|
||||
|
||||
There is a script in ``examples/realtime-udp-echo.cc`` that has an example of
|
||||
how to configure the realtime behavior. Try: ::
|
||||
There is a script in ``examples/realtime/realtime-udp-echo.cc`` that
|
||||
has an example of how to configure the realtime behavior. Try: ::
|
||||
|
||||
./waf --run realtime-udp-echo
|
||||
|
||||
@@ -73,8 +73,8 @@ Implementation
|
||||
|
||||
The implementation is contained in the following files:
|
||||
|
||||
* ``src/simulator/realtime-simulator-impl.{cc,h}``
|
||||
* ``src/simulator/wall-clock-synchronizer.{cc,h}``
|
||||
* ``src/core/model/realtime-simulator-impl.{cc,h}``
|
||||
* ``src/core/model/wall-clock-synchronizer.{cc,h}``
|
||||
|
||||
In order to create a realtime scheduler, to a first approximation you just want
|
||||
to cause simulation time jumps to consume real time. We propose doing this using
|
||||
|
||||
@@ -3,8 +3,8 @@ Support
|
||||
|
||||
.. toctree::
|
||||
|
||||
flow-monitor
|
||||
animation
|
||||
statistics
|
||||
new-models
|
||||
new-modules
|
||||
enable-modules
|
||||
enable-tests
|
||||
troubleshoot
|
||||
|
||||
@@ -421,10 +421,10 @@ size as the object name service code itself. Unit tests are tests that
|
||||
check a single bit of functionality that are not built into the ns-3 code,
|
||||
but live in the same directory as the code it tests. It is possible that
|
||||
these tests check integration of multiple implementation files in a module
|
||||
as well. The file src/core/names-test-suite.cc is an example of this kind
|
||||
of test. The file src/common/pcap-file-test-suite.cc is another example
|
||||
as well. The file src/core/test/names-test-suite.cc is an example of this kind
|
||||
of test. The file src/network/test/pcap-file-test-suite.cc is another example
|
||||
that uses a known good pcap file as a test vector file. This file is stored
|
||||
locally in the src/common directory.
|
||||
locally in the src/network directory.
|
||||
|
||||
System Tests
|
||||
++++++++++++
|
||||
@@ -742,7 +742,7 @@ arguments as needed, but basedir is the minimum needed)::
|
||||
(gdb) r --basedir=`pwd`
|
||||
Starting program: <..>/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
|
||||
9
doc/manual/source/tests.rst
Normal file
9
doc/manual/source/tests.rst
Normal file
@@ -0,0 +1,9 @@
|
||||
Tests
|
||||
-----
|
||||
|
||||
.. toctree::
|
||||
|
||||
test-overview
|
||||
test-background
|
||||
test-framework
|
||||
how-to-write-tests
|
||||
@@ -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
|
||||
|
||||
@@ -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."
|
||||
12
doc/models/rescale-pdf.sh
Executable file
12
doc/models/rescale-pdf.sh
Executable file
@@ -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}
|
||||
|
||||
2
doc/models/source/README
Normal file
2
doc/models/source/README
Normal file
@@ -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.
|
||||
@@ -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)
|
||||
]
|
||||
14
doc/models/source/devices.rst
Normal file
14
doc/models/source/devices.rst
Normal file
@@ -0,0 +1,14 @@
|
||||
Devices and Channels
|
||||
--------------------
|
||||
|
||||
.. toctree::
|
||||
|
||||
bridge
|
||||
csma
|
||||
lte
|
||||
point-to-point
|
||||
mesh
|
||||
wifi
|
||||
wimax
|
||||
simple
|
||||
uan
|
||||
@@ -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
|
||||
31
doc/models/source/index.rst
Normal file
31
doc/models/source/index.rst
Normal file
@@ -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 <http://www.nsnam.org/doxygen/index.html>`_: Documentation of the public APIs of the simulator
|
||||
* `Tutorial <http://www.nsnam.org/tutorials.html>`_
|
||||
* `Manual <http://www.nsnam.org/tutorials.html>`_
|
||||
* `Model Library <http://www.nsnam.org/tutorials.html>`_: *(this document)*
|
||||
* `ns-3 wiki <http://www.nsnam.org/wiki/index.php/Main_Page>`_
|
||||
|
||||
This document is written in `reStructuredText <http://docutils.sourceforge.net/rst.html>`_ for `Sphinx <http://sphinx.pocoo.org/>`_ 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
|
||||
@@ -3,10 +3,8 @@ Internet Models
|
||||
|
||||
.. toctree::
|
||||
|
||||
sockets-api
|
||||
internet-stack
|
||||
ipv4
|
||||
ipv6
|
||||
routing
|
||||
click
|
||||
routing-overview
|
||||
tcp
|
||||
9
doc/models/source/network.rst
Normal file
9
doc/models/source/network.rst
Normal file
@@ -0,0 +1,9 @@
|
||||
Network Module
|
||||
--------------
|
||||
|
||||
.. toctree::
|
||||
|
||||
packets
|
||||
network-overview
|
||||
sockets-api
|
||||
simple
|
||||
52
doc/models/source/organization.rst
Normal file
52
doc/models/source/organization.rst
Normal file
@@ -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 <http://www.doxygen.org>`_. Doxygen for ns-3 models is available
|
||||
`on the project web server <http://www.nsnam.org/docs/doxygen/index.html>`_.
|
||||
|
||||
* 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 <http://www.nsnam.org>`_ to find copies of the manual.
|
||||
|
||||
Finally, additional documentation about various aspects of |ns3| may
|
||||
exist on the `project wiki <http://www.nsnam.org/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`.
|
||||
7
doc/models/source/routing.rst
Normal file
7
doc/models/source/routing.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
Routing and Switching
|
||||
---------------------
|
||||
|
||||
.. toctree::
|
||||
|
||||
click
|
||||
openflow-switch
|
||||
8
doc/models/source/support.rst
Normal file
8
doc/models/source/support.rst
Normal file
@@ -0,0 +1,8 @@
|
||||
Support
|
||||
-------
|
||||
|
||||
.. toctree::
|
||||
|
||||
flow-monitor
|
||||
animation
|
||||
statistics
|
||||
44
doc/modules
44
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
|
||||
*/
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
|
||||
# output xml format:
|
||||
# <pages>
|
||||
# <page url="xx"><prev url="yyy">zzz</prev><next url="hhh">lll</next><fragment>file.frag</fragment></page>
|
||||
# ...
|
||||
# </pages>
|
||||
|
||||
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(' <page url="%s">\n' % path)
|
||||
out.write(' <fragment>%s.frag</fragment>\n' % data['current_page_name'])
|
||||
if data['prev'] is not None:
|
||||
out.write(' <prev url="%s">%s</prev>\n' %
|
||||
(os.path.normpath(os.path.join(path, data['prev']['link'])),
|
||||
data['prev']['title']))
|
||||
if data['next'] is not None:
|
||||
out.write(' <next url="%s">%s</next>\n' %
|
||||
(os.path.normpath(os.path.join(path, data['next']['link'])),
|
||||
data['next']['title']))
|
||||
out.write(' </page>\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('<pages>\n')
|
||||
dump_pickles(sys.stdout, os.path.dirname(sys.argv[1]), os.path.basename(sys.argv[1]), '/')
|
||||
sys.stdout.write('</pages>')
|
||||
@@ -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 <http://www.nsnam.org/doxygen/index.html>`_: Documentation of the public APIs of the simulator
|
||||
* `Tutorial <http://www.nsnam.org/tutorials.html>`_
|
||||
* `Reference Manual <http://www.nsnam.org/tutorials.html>`_
|
||||
* `ns-3 wiki <http://www.nsnam.org/wiki/index.php/Main_Page>`_
|
||||
|
||||
This document is written in `reStructuredText <http://docutils.sourceforge.net/rst.html>`_ for `Sphinx <http://sphinx.pocoo.org/>`_ 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
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
]
|
||||
|
||||
@@ -96,7 +96,6 @@ contribute to |ns3| like they have for ns-2:
|
||||
<http://www.nsnam.org/wiki/index.php/Contributed_Code>`_ page, similar to ns-2's popular Contributed Code
|
||||
`page
|
||||
<http://nsnam.isi.edu/nsnam/index.php/Contributed_Code>`_;
|
||||
* ``src/contrib`` directory (we will host your contributed code);
|
||||
* Open `bug tracker
|
||||
<http://www.nsnam.org/bugzilla>`_;
|
||||
* |ns3| developers will gladly help potential contributors to get
|
||||
|
||||
@@ -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<int32_t>`` 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 <fstream>
|
||||
#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<Ptr<const Packet> >``. 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
|
||||
|
||||
@@ -408,7 +408,7 @@ in the following code,
|
||||
|
||||
::
|
||||
|
||||
int
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
...
|
||||
|
||||
@@ -51,8 +51,11 @@ ReceivePacket (Ptr<Socket> 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> socket)
|
||||
*/
|
||||
static void
|
||||
GenerateTraffic (Ptr<Socket> socket, uint32_t pktSize, Ptr<Node> n,
|
||||
uint32_t pktCount, Time pktInterval)
|
||||
uint32_t pktCount, Time pktInterval)
|
||||
{
|
||||
if (pktCount > 0)
|
||||
{
|
||||
socket->Send (Create<Packet> (pktSize));
|
||||
Simulator::Schedule (pktInterval, &GenerateTraffic, socket, pktSize, n,
|
||||
pktCount - 1, pktInterval);
|
||||
pktCount - 1, pktInterval);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -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<RateErrorModel> em = CreateObjectWithAttributes<RateErrorModel> ("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.");
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
// // +------------+ | | |
|
||||
// // | Host 1 |--| | +------------+ |
|
||||
// // [------------] |---| Router 3 |---|
|
||||
// // [------------]
|
||||
// //
|
||||
// // [------------]
|
||||
// //
|
||||
// //
|
||||
// // - Tracing of queues and packet receptions to file "loose-routing-ipv6.tr"
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
// Network topology
|
||||
//
|
||||
// n0 n1
|
||||
// n0 n1
|
||||
// | |
|
||||
// =================
|
||||
// LAN
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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 ();
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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<CsmaNetDevice> deviceA = CreateObject<CsmaNetDevice> ();
|
||||
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<Ipv4> ipv4A = nA->GetObject<Ipv4> ();
|
||||
Ptr<Ipv4> ipv4B = nB->GetObject<Ipv4> ();
|
||||
Ptr<Ipv4> ipv4C = nC->GetObject<Ipv4> ();
|
||||
|
||||
|
||||
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<Ipv4StaticRouting> 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));
|
||||
|
||||
@@ -65,7 +65,7 @@ main (int argc, char *argv[])
|
||||
NetDeviceContainer dAdB = p2p.Install (nAnB);
|
||||
|
||||
NetDeviceContainer dBdC = p2p.Install (nBnC);;
|
||||
|
||||
|
||||
Ptr<CsmaNetDevice> deviceA = CreateObject<CsmaNetDevice> ();
|
||||
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<Ipv4> ipv4A = nA->GetObject<Ipv4> ();
|
||||
Ptr<Ipv4> ipv4C = nC->GetObject<Ipv4> ();
|
||||
|
||||
|
||||
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));
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -65,7 +65,7 @@ main (int argc, char *argv[])
|
||||
NetDeviceContainer dAdB = p2p.Install (nAnB);
|
||||
|
||||
NetDeviceContainer dBdC = p2p.Install (nBnC);;
|
||||
|
||||
|
||||
Ptr<CsmaNetDevice> deviceA = CreateObject<CsmaNetDevice> ();
|
||||
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<Ipv4> ipv4A = nA->GetObject<Ipv4> ();
|
||||
Ptr<Ipv4> ipv4B = nB->GetObject<Ipv4> ();
|
||||
Ptr<Ipv4> ipv4C = nC->GetObject<Ipv4> ();
|
||||
|
||||
|
||||
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));
|
||||
|
||||
@@ -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<Node> nRtr1 = CreateObject<Node> ();
|
||||
Ptr<Node> nRtr2 = CreateObject<Node> ();
|
||||
Ptr<Node> nDstRtr = CreateObject<Node> ();
|
||||
|
||||
|
||||
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<NetDevice> SrcToRtr1=dSrcdRtr1.Get (0);
|
||||
Ptr<NetDevice> 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<Ipv4> ipv4Rtr2 = nRtr2->GetObject<Ipv4> ();
|
||||
Ptr<Ipv4> ipv4DstRtr = nDstRtr->GetObject<Ipv4> ();
|
||||
Ptr<Ipv4> ipv4Dst = nDst->GetObject<Ipv4> ();
|
||||
|
||||
|
||||
Ipv4StaticRoutingHelper ipv4RoutingHelper;
|
||||
Ptr<Ipv4StaticRouting> staticRoutingSrc = ipv4RoutingHelper.GetStaticRouting (ipv4Src);
|
||||
Ptr<Ipv4StaticRouting> 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<Socket> srcSocket = Socket::CreateSocket (nSrc, TypeId::LookupByName ("ns3::UdpSocketFactory"));
|
||||
srcSocket->Bind ();
|
||||
srcSocket->SetRecvCallback (MakeCallback (&srcSocketRecv));
|
||||
|
||||
|
||||
Ptr<Socket> 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> socket)
|
||||
Ptr<Packet> 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");
|
||||
}
|
||||
|
||||
@@ -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<Node> nRtr1 = CreateObject<Node> ();
|
||||
Ptr<Node> nRtr2 = CreateObject<Node> ();
|
||||
Ptr<Node> nDstRtr = CreateObject<Node> ();
|
||||
|
||||
|
||||
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<NetDevice> SrcToRtr1=dSrcdRtr1.Get (0);
|
||||
Ptr<NetDevice> 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<Ipv4> ipv4Rtr2 = nRtr2->GetObject<Ipv4> ();
|
||||
Ptr<Ipv4> ipv4DstRtr = nDstRtr->GetObject<Ipv4> ();
|
||||
Ptr<Ipv4> ipv4Dst = nDst->GetObject<Ipv4> ();
|
||||
|
||||
|
||||
Ipv4StaticRoutingHelper ipv4RoutingHelper;
|
||||
Ptr<Ipv4StaticRouting> staticRoutingSrc = ipv4RoutingHelper.GetStaticRouting (ipv4Src);
|
||||
Ptr<Ipv4StaticRouting> 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<Socket> srcSocket3 = Socket::CreateSocket (nSrc, TypeId::LookupByName ("ns3::TcpSocketFactory"));
|
||||
Ptr<Socket> 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<Socket> 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
|
||||
|
||||
@@ -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> socketFactory = GetNode()->GetObject<SocketFactory>
|
||||
(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<uint32_t>())
|
||||
;
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
@@ -196,12 +196,12 @@ Receiver::StartApplication()
|
||||
|
||||
if (m_socket == 0) {
|
||||
Ptr<SocketFactory> socketFactory = GetNode()->GetObject<SocketFactory>
|
||||
(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<void, Ptr<Socket> > ());
|
||||
}
|
||||
}
|
||||
|
||||
// end Receiver::StopApplication
|
||||
}
|
||||
@@ -241,30 +241,29 @@ Receiver::Receive(Ptr<Socket> socket)
|
||||
Ptr<Packet> 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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<Node> appSource = NodeList::GetNode(0);
|
||||
Ptr<Node> appSource = NodeList::GetNode(0);
|
||||
Ptr<Sender> sender = CreateObject<Sender>();
|
||||
appSource->AddApplication(sender);
|
||||
sender->SetStartTime(Seconds(1));
|
||||
|
||||
Ptr<Node> appSink = NodeList::GetNode(1);
|
||||
Ptr<Node> appSink = NodeList::GetNode(1);
|
||||
Ptr<Receiver> receiver = CreateObject<Receiver>();
|
||||
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<DataOutputInterface> output = 0;
|
||||
if (format == "omnet") {
|
||||
NS_LOG_INFO("Creating omnet formatted data output.");
|
||||
output = CreateObject<OmnetDataOutput>();
|
||||
} else if (format == "db") {
|
||||
NS_LOG_INFO("Creating omnet formatted data output.");
|
||||
output = CreateObject<OmnetDataOutput>();
|
||||
} else if (format == "db") {
|
||||
#ifdef STATS_HAS_SQLITE3
|
||||
NS_LOG_INFO("Creating sqlite formatted data output.");
|
||||
output = CreateObject<SqliteDataOutput>();
|
||||
#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.
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ int main (int argc, char *argv[])
|
||||
|
||||
// Create and bind the socket...
|
||||
Ptr<Socket> 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<Socket> 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
|
||||
|
||||
@@ -103,9 +103,9 @@ int main (int argc, char *argv[])
|
||||
DoubleValue rate(errRate);
|
||||
RandomVariableValue u01(UniformVariable (0.0, 1.0));
|
||||
Ptr<RateErrorModel> em1 =
|
||||
CreateObjectWithAttributes<RateErrorModel> ("RanVar", u01, "ErrorRate", rate);
|
||||
CreateObjectWithAttributes<RateErrorModel> ("RanVar", u01, "ErrorRate", rate);
|
||||
Ptr<RateErrorModel> em2 =
|
||||
CreateObjectWithAttributes<RateErrorModel> ("RanVar", u01, "ErrorRate", rate);
|
||||
CreateObjectWithAttributes<RateErrorModel> ("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)));
|
||||
|
||||
@@ -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<linux2.6.18>/net.ipv4.tcp_sack", StringValue ("0"));
|
||||
Config::Set ("/NodeList/3/$ns3::Ns3NscStack<linux2.6.18>/net.ipv4.tcp_timestamps", StringValue ("0"));
|
||||
Config::Set ("/NodeList/3/$ns3::Ns3NscStack<linux2.6.18>/net.ipv4.tcp_window_scaling", StringValue ("0"));
|
||||
Config::Set ("/NodeList/3/$ns3::Ns3NscStack<linux2.6.26>/net.ipv4.tcp_sack", StringValue ("0"));
|
||||
Config::Set ("/NodeList/3/$ns3::Ns3NscStack<linux2.6.26>/net.ipv4.tcp_timestamps", StringValue ("0"));
|
||||
Config::Set ("/NodeList/3/$ns3::Ns3NscStack<linux2.6.26>/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);
|
||||
|
||||
@@ -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<NodeContainer> nodeAdjacencyList(N-1);
|
||||
for(uint32_t i=0; i<nodeAdjacencyList.size(); ++i)
|
||||
{
|
||||
nodeAdjacencyList[i] = NodeContainer (serverNode, clientNodes.Get (i));
|
||||
}
|
||||
{
|
||||
nodeAdjacencyList[i] = NodeContainer (serverNode, clientNodes.Get (i));
|
||||
}
|
||||
|
||||
// We create the channels first without any IP addressing information
|
||||
NS_LOG_INFO ("Create channels.");
|
||||
@@ -107,21 +107,21 @@ main (int argc, char *argv[])
|
||||
p2p.SetChannelAttribute ("Delay", StringValue ("2ms"));
|
||||
std::vector<NetDeviceContainer> deviceAdjacencyList(N-1);
|
||||
for(uint32_t i=0; i<deviceAdjacencyList.size(); ++i)
|
||||
{
|
||||
deviceAdjacencyList[i] = p2p.Install (nodeAdjacencyList[i]);
|
||||
}
|
||||
{
|
||||
deviceAdjacencyList[i] = p2p.Install (nodeAdjacencyList[i]);
|
||||
}
|
||||
|
||||
// Later, we add IP addresses.
|
||||
// Later, we add IP addresses.
|
||||
NS_LOG_INFO ("Assign IP Addresses.");
|
||||
Ipv4AddressHelper ipv4;
|
||||
std::vector<Ipv4InterfaceContainer> interfaceAdjacencyList(N-1);
|
||||
for(uint32_t i=0; i<interfaceAdjacencyList.size(); ++i)
|
||||
{
|
||||
std::ostringstream subnet;
|
||||
subnet<<"10.1."<<i+1<<".0";
|
||||
ipv4.SetBase (subnet.str().c_str(), "255.255.255.0");
|
||||
interfaceAdjacencyList[i] = ipv4.Assign (deviceAdjacencyList[i]);
|
||||
}
|
||||
{
|
||||
std::ostringstream subnet;
|
||||
subnet<<"10.1."<<i+1<<".0";
|
||||
ipv4.SetBase (subnet.str().c_str(), "255.255.255.0");
|
||||
interfaceAdjacencyList[i] = ipv4.Assign (deviceAdjacencyList[i]);
|
||||
}
|
||||
|
||||
//Turn on global static routing
|
||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
|
||||
@@ -137,19 +137,19 @@ main (int argc, char *argv[])
|
||||
// Create the OnOff applications to send TCP to the server
|
||||
OnOffHelper clientHelper ("ns3::TcpSocketFactory", Address ());
|
||||
clientHelper.SetAttribute
|
||||
("OnTime", RandomVariableValue (ConstantVariable (1)));
|
||||
("OnTime", RandomVariableValue (ConstantVariable (1)));
|
||||
clientHelper.SetAttribute
|
||||
("OffTime", RandomVariableValue (ConstantVariable (0)));
|
||||
("OffTime", RandomVariableValue (ConstantVariable (0)));
|
||||
//normally wouldn't need a loop here but the server IP address is different
|
||||
//on each p2p subnet
|
||||
ApplicationContainer clientApps;
|
||||
for(uint32_t i=0; i<clientNodes.GetN(); ++i)
|
||||
{
|
||||
AddressValue remoteAddress
|
||||
(InetSocketAddress (interfaceAdjacencyList[i].GetAddress (0), port));
|
||||
clientHelper.SetAttribute ("Remote", remoteAddress);
|
||||
clientApps.Add(clientHelper.Install (clientNodes.Get(i)));
|
||||
}
|
||||
{
|
||||
AddressValue remoteAddress
|
||||
(InetSocketAddress (interfaceAdjacencyList[i].GetAddress (0), port));
|
||||
clientHelper.SetAttribute ("Remote", remoteAddress);
|
||||
clientApps.Add(clientHelper.Install (clientNodes.Get(i)));
|
||||
}
|
||||
clientApps.Start (Seconds (1.0));
|
||||
clientApps.Stop (Seconds (10.0));
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ def build(bld):
|
||||
obj.source = 'tcp-nsc-lfn.cc'
|
||||
|
||||
obj = bld.create_ns3_program('tcp-nsc-zoo',
|
||||
['csma', 'internet'])
|
||||
['csma', 'internet', 'applications'])
|
||||
obj.source = 'tcp-nsc-zoo.cc'
|
||||
|
||||
obj = bld.create_ns3_program('tcp-star-server',
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
void Setup (Ptr<Socket> 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<RateErrorModel> em = CreateObjectWithAttributes<RateErrorModel> (
|
||||
"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;
|
||||
|
||||
@@ -24,7 +24,7 @@ using namespace ns3;
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("FirstScriptExample");
|
||||
|
||||
int
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "ns3/trace-source-accessor.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
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<int32_t> m_myInt;
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@ NS_LOG_COMPONENT_DEFINE ("HelloSimulator");
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
int
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
NS_LOG_UNCOND ("Hello Simulator");
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
void Setup (Ptr<Socket> 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<RateErrorModel> em = CreateObjectWithAttributes<RateErrorModel> (
|
||||
"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;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -334,6 +334,11 @@ Experiment::ApplicationSetup (Ptr<Node> client, Ptr<Node> 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);
|
||||
|
||||
|
||||
@@ -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 ();
|
||||
|
||||
@@ -50,7 +50,8 @@ private:
|
||||
};
|
||||
|
||||
Experiment::Experiment ()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
Experiment::Experiment (std::string name)
|
||||
: m_output (name)
|
||||
|
||||
@@ -47,14 +47,15 @@ private:
|
||||
Vector GetPosition (Ptr<Node> node);
|
||||
Ptr<Socket> SetupPacketReceive (Ptr<Node> node);
|
||||
void GenerateTraffic (Ptr<Socket> 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> socket)
|
||||
Ptr<Packet> 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]");
|
||||
|
||||
@@ -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<ConstantPositionMobilityModel> ());
|
||||
}
|
||||
|
||||
|
||||
// 3. Create propagation loss matrix
|
||||
Ptr<MatrixPropagationLossModel> lossModel = CreateObject<MatrixPropagationLossModel> ();
|
||||
lossModel->SetDefaultLoss (200); // set default loss to 200 dB (no link)
|
||||
@@ -67,7 +67,7 @@ void experiment (bool enableCtsRts)
|
||||
Ptr<YansWifiChannel> wifiChannel = CreateObject <YansWifiChannel> ();
|
||||
wifiChannel->SetPropagationLossModel (lossModel);
|
||||
wifiChannel->SetPropagationDelayModel (CreateObject <ConstantSpeedPropagationDelayModel> ());
|
||||
|
||||
|
||||
// 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<FlowMonitor> monitor = flowmon.InstallAll();
|
||||
|
||||
|
||||
// 9. Run simulation for 10 seconds
|
||||
Simulator::Stop (Seconds (10));
|
||||
Simulator::Run ();
|
||||
|
||||
|
||||
// 10. Print per flow statistics
|
||||
monitor->CheckForLostPackets ();
|
||||
Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier> (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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user