Compare commits
30
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26c785f7f4 | ||
|
|
c36547fb62 | ||
|
|
a7ec40805a | ||
|
|
f8ba98843a | ||
|
|
c5037d1594 | ||
|
|
613a332306 | ||
|
|
e474e93667 | ||
|
|
6ea2a97ca0 | ||
|
|
fe9a8cca8e | ||
|
|
b1ec1fde9a | ||
|
|
b26d351756 | ||
|
|
8a0c45ea89 | ||
|
|
10c2679ebf | ||
|
|
9615e4936d | ||
|
|
14b5c3bb39 | ||
|
|
bfa8e6db50 | ||
|
|
b81d969ba3 | ||
|
|
7b321fba3e | ||
|
|
19a649bbe2 | ||
|
|
27e2cbc0d9 | ||
|
|
c8d890d17c | ||
|
|
b7874cc528 | ||
|
|
c26183766b | ||
|
|
8fd5b780c3 | ||
|
|
9cb65dfc01 | ||
|
|
0d6945be98 | ||
|
|
b28ffde9d5 | ||
|
|
d824a1339b | ||
|
|
8cca1f7e34 | ||
|
|
cb0af6394c |
No files matched your search
+2
-1
@@ -45,4 +45,5 @@ massif.*
|
||||
\#[^\#/]+\#$
|
||||
.lock-wscript
|
||||
.lock-wafbuild
|
||||
|
||||
*~
|
||||
\#*\#
|
||||
@@ -61,4 +61,3 @@ e48ed3aabca6ad71c8c49e4604c0f83345eda6a8 ns-3.11-RC3
|
||||
19c9e2b33b4a53f200be80cd49810bdfecf76770 ns-3.12-RC1
|
||||
167fc2274f53d4d89fdd769e4a7683ad7b6b7157 ns-3.12
|
||||
9007193fbb8d18b69a1feb6aec16501dcf138b6f ns-3.13
|
||||
ae540de68a2534213342c5e0b12afb47d7518a90 ns-3.14
|
||||
@@ -1,4 +1,4 @@
|
||||
Alexander Afanasyev (alexander.afanasyev@ucla.edu)
|
||||
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
Rohit Agarwal (mindprince@gmail.com)
|
||||
Kirill Andreev (andreev@iitp.ru)
|
||||
Dean Armstrong (deanarm@gmail.com)
|
||||
@@ -8,7 +8,7 @@ Ramon Bauza (monbauza@gmail.com)
|
||||
Mehdi Benamor (mehdi.benamor@telecom-bretagne.eu)
|
||||
Raj Bhattacharjea (raj.b@gatech.edu)
|
||||
Timo Bingmann (timo.bingmann@student.kit.edu)
|
||||
Julien Boite (juboite@gmail.com)
|
||||
Julien Boite <juboite@gmail.com>
|
||||
Elena Borovkova (borokovaes@iitp.ru)
|
||||
Pavel Boyko (boyko@iitp.ru)
|
||||
Dan Broyles (muxman@sbcglobal.net)
|
||||
@@ -26,19 +26,18 @@ Craig Dowell (craigdo@ee.washington.edu)
|
||||
Denis Fakhriev (fakhriev@iitp.ru)
|
||||
Jahanzeb Farooq (Jahanzeb.Farooq@inria.fr, Jahanzeb.Farooq@gmail.com)
|
||||
Juliana Freitag Borin (juliana.freitag@gmail.com)
|
||||
Thomas Geithner (thomas.geithner@dai-labor.de)
|
||||
Martin Giachino (martin.giachino@gmail.com,giachino@fing.edu.uy)
|
||||
Charline Taibi Guguen (charline.guguen@gmail.com)
|
||||
Tom Goff (tgoff@tgoff.net)
|
||||
David Gross (gdavid.devel@gmail.com)
|
||||
Charline Taibi Guguen (charline.guguen@gmail.com)
|
||||
Daniel Halperin (daniel@halper.in)
|
||||
Bruno Haick (bghaick@hotmail.com)
|
||||
Frank Helbert (frank@ime.usp.br)
|
||||
Tom Henderson (tomhend@u.washington.edu)
|
||||
Blake Hurd (naimorai@gmail.com)
|
||||
ishan (ishan.chhabra@gmail.com)
|
||||
ishan <ishan.chhabra@gmail.com>
|
||||
Mohamed Amine Ismail (amine.ismail@inria.fr, iamine@udcast.com)
|
||||
Atishay Jain (atishayjain25@gmail.com)
|
||||
Atishay Jain <atishayjain25@gmail.com>
|
||||
Sascha Alexander Jopen (jopen@informatik.uni-bonn.de)
|
||||
Sam Jansen (sam.jansen@gmail.com)
|
||||
Liu Jian (liujatp@gmail.com)
|
||||
@@ -67,11 +66,11 @@ Duy Nguyen (duy@soe.ucsc.edu)
|
||||
Tommaso Pecorella (tommaso.pecorella@unifi.it)
|
||||
Vikas Pushkar (vikaskupushkar@gmail.com)
|
||||
Josh Pelkey (jpelkey@gatech.edu)
|
||||
Colin Perkins (csp@csperkins.org)
|
||||
Colin Perkins <csp@csperkins.org>
|
||||
Giuseppe Piro (g.piro@poliba.it)
|
||||
Yana Podkosova (yanapdk@rambler.ru)
|
||||
Guangyu Pei (guangyu.pei@boeing.com)
|
||||
Andrea Ranieri (andreran@uno.it)
|
||||
Andrea Ranieri <andreran@uno.it>
|
||||
Bruno Ranieri (Yrrsinn@googlemail.com)
|
||||
Ken Renard (kenneth.renard@arl.army.mil)
|
||||
Manuel Requena (mrequena@cttc.es)
|
||||
@@ -84,11 +83,11 @@ Florian Schmidt (Florian.Schmidt@cs.rwth-aachen.de)
|
||||
Guillaume Seguin (guillaume.seguin@inria.fr)
|
||||
Kulin Shah (m.kulin@gmail.com)
|
||||
Phillip Sitbon (phillip.sitbon@gmail.com)
|
||||
Anirudh Sivaraman (sk.anirudh@gmail.com)
|
||||
Anirudh Sivaraman <sk.anirudh@gmail.com>
|
||||
Ewgenij Starostin (estar@cs.tu-berlin.de)
|
||||
YunQiang Su (wzssyqa@gmail.com)
|
||||
YunQiang Su <wzssyqa@gmail.com>
|
||||
Lalith Suresh (suresh.lalith@gmail.com)
|
||||
Marcos Talau (talau@users.sourceforge.net)
|
||||
Marcos Talau <talau@users.sourceforge.net>
|
||||
Adrian S. W. Tam (adrian.sw.tam@gmail.com)
|
||||
Hajime Tazaki (tazaki@sfc.wide.ad.jp)
|
||||
Wilson Thong (wilsonwk@ee.cityu.edu.hk)
|
||||
|
||||
+1
-40
@@ -44,46 +44,7 @@ to this file based on your experience, please contribute a patch or drop
|
||||
us a note on ns-developers mailing list.</p>
|
||||
|
||||
<hr>
|
||||
<h1>Changes from ns-3.14 to ns-3.15</h1>
|
||||
|
||||
<h2>New API:</h2>
|
||||
<ul>
|
||||
<li>A RandomVariableStreamHelper has been introduced to assist with
|
||||
using the Config subsystem path names to assign fixed stream numbers
|
||||
to RandomVariableStream objects.</li>
|
||||
</ul>
|
||||
|
||||
<h2>Changes to existing API:</h2>
|
||||
<ul>
|
||||
<li>Derived classes of RandomVariable (i.e. the random variable
|
||||
implementations) have been ported to a new RandomVariableStream base class.
|
||||
<li>For a given distribution DistributionVariable (such as UniformVariable),
|
||||
the new class name is DistributionRandomVariable (such as
|
||||
UniformRandomVariable). </li>
|
||||
<li>The new implementations are also derived from class ns3::Object and
|
||||
are handled using the ns-3 smart pointer (Ptr) class. </li>
|
||||
<li>The new variable classes also have a new attributed called "Stream"
|
||||
which allows them to be assigned to a fix stream index when assigned
|
||||
to the underlying pseudo-random stream of numbers.</li>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2>Changes to build system:</h2>
|
||||
<ul>
|
||||
<li></li>
|
||||
</ul>
|
||||
|
||||
<h2>Changed behavior:</h2>
|
||||
<ul>
|
||||
<li>Programs using random variables or models that include random variables
|
||||
may exhibit changed output for a given run number or seed, due to a possible
|
||||
change in the order in which random variables are assigned to underlying
|
||||
pseudo-random sequences. Consult the manual for more information regarding
|
||||
this.</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
<h1>Changes from ns-3.13 to ns-3.14</h1>
|
||||
<h1>Changes from ns-3.13 to ns-3-dev</h1>
|
||||
|
||||
<h2>New API:</h2>
|
||||
<ul>
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
Note:
|
||||
|
||||
This is a custom and unsupported fork of NS-3 simulator (http://www.nsnam.org/).
|
||||
|
||||
**The code in this repository is frequently rebased on top of the latest ns-3-dev branch**
|
||||
|
||||
|
||||
The Network Simulator, Version 3
|
||||
--------------------------------
|
||||
|
||||
+11
-60
@@ -9,83 +9,36 @@ http://www.nsnam.org including tutorials: http://www.nsnam.org/tutorials.html
|
||||
Consult the file CHANGES.html for more detailed information about changed
|
||||
API and behavior across ns-3 releases.
|
||||
|
||||
Release 3-dev
|
||||
============
|
||||
|
||||
Availability
|
||||
------------
|
||||
This release is not yet available.
|
||||
|
||||
Supported platforms
|
||||
-------------------
|
||||
|
||||
New user-visible features
|
||||
-------------------------
|
||||
- A new random variable base class called 'RandomVariableStream', has been
|
||||
introduced. This base class derives from ns3::Object, unlike the current
|
||||
'RandomVariable' class which is a special type of object in the ns-3
|
||||
system to date. By making this class derive from ns3::Object, it can be
|
||||
handled with the Ptr class, can carry attributes, and can have its parameters
|
||||
and initial state saved in the config-store subsystem. A new attribute
|
||||
called "Stream" has been introduced for this class, to allow users to
|
||||
better control the assignment of underlying pseudo-random sequences to
|
||||
the RandomVariableStream objects (bug 101).
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
- bug 101 - random variable initialization
|
||||
|
||||
Known issues
|
||||
------------
|
||||
In general, known issues are tracked on the project tracker available
|
||||
at http://www.nsnam.org/bugzilla/
|
||||
|
||||
Release 3.14.1
|
||||
==============
|
||||
|
||||
Availability
|
||||
------------
|
||||
This release is available from:
|
||||
http://www.nsnam.org/release/ns-allinone-3.14.1.tar.bz2
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
This hotfix release contains a fix for the PyViz visualizer and makes it
|
||||
easier to add PyViz support to examples; otherwise it is the same as the
|
||||
ns-3.14 release.
|
||||
|
||||
Release 3.14
|
||||
============
|
||||
|
||||
Availability
|
||||
------------
|
||||
This release is available from:
|
||||
http://www.nsnam.org/release/ns-allinone-3.14.tar.bz2
|
||||
This release not yet available.
|
||||
|
||||
Supported platforms
|
||||
-------------------
|
||||
ns-3.14 has been tested on the following platforms. Not all features are
|
||||
available on all platforms; check the Installation page on the project wiki.
|
||||
|
||||
- Ubuntu 12.04 (32/64 bit) with g++-4.6.3
|
||||
- Ubuntu 10.04.4 LTS (64 bit) with g++-4.4.3
|
||||
- Fedora Core 17 (32/64 bit) with g++-4.7.0
|
||||
- Fedora Core 16 (32/64 bit) with g++-4.6.3
|
||||
- Fedora Core 15 (64 bit) with g++-4.6.3
|
||||
- Ubuntu 12.04 (32/64 bit) with g++-4.6.3
|
||||
- Ubuntu 11.10 (32 bit) with g++-4.6.1
|
||||
- Ubuntu 10.04.4 LTS (64 bit) with g++-4.4.3
|
||||
- OS X Lion 10.7.4 with g++-4.2.1
|
||||
- OS X Snow Leopard 10.6.8 with g++-4.2.1
|
||||
- OS X Lion with g++-4.2.1
|
||||
- OS X Snow Leopard with g++-4.2.1
|
||||
- FreeBSD 8.2 (32 bit) with g++-4.2.1
|
||||
- Cygwin 1.7.9-1 with g++-4.5.3
|
||||
|
||||
New user-visible features
|
||||
-------------------------
|
||||
- Transport protocol implementations (TCP, UDP) have been refactored to
|
||||
support also IPv6 connections. Dual-stacked IPv6 sockets are implemented.
|
||||
An IPv6 socket can accept an IPv4 connection, returning the sender's
|
||||
An IPv6 socket can accept an IPv4 connection, returning the senders
|
||||
address as an IPv4-mapped address (IPV6_V6ONLY socket option is not
|
||||
implemented).
|
||||
- The LTE code from the LENA project has been merged, bringing in a
|
||||
- The LTE code from the LENA project has been merged, bringin in a
|
||||
significant redesign of the LTE module as well as many new features.
|
||||
- An antenna module is now included, which includes different
|
||||
radiation pattern models. See the corresponding new section of the
|
||||
@@ -97,7 +50,7 @@ New user-visible features
|
||||
- The Dynamic Source Routing (DSR) MANET routing protocol for IPv4 was added.
|
||||
- A Random Early Detection (RED) queue model has been added.
|
||||
- Ipv6RoutingHelper is now in-line with Ipv4RoutingHelper concerning the RT
|
||||
print functions. Various minor changes were made in Ipv6RoutingProtocol and
|
||||
print functions. Various minor changes made in Ipv6RoutingProtocol and
|
||||
derived classes to make this possible.
|
||||
- New "SendIcmpv6Redirect" attribute (and getter/setter functions) to
|
||||
Ipv6L3Protocol. The behavior is similar to Linux's conf "send_redirects",
|
||||
@@ -105,12 +58,12 @@ New user-visible features
|
||||
- Longer and more descriptive names are used for error units in RateErrorModel
|
||||
class and queue mode in Queue class. Attributes in those classes are also
|
||||
changed for consistency. See API documentation for details.
|
||||
- The netanim animator is now bundled with the release.
|
||||
- The netanim animator is now included with the release.
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
- bug 603 - Simulator::Next is useless
|
||||
- bug 631 - RealtimeSimulatorImpl does not handle Ctrl-C with python bindings
|
||||
- bug 603 - Simulator::Next is useless
|
||||
- bug 962 - list of paths to reach objects contains bogus entries
|
||||
- bug 1000 - Make RealtimeSimulatorImpl last until stop
|
||||
- bug 1053 - Need better error diagnostics in ns2-mobility-trace example
|
||||
@@ -150,12 +103,10 @@ Bugs fixed
|
||||
- bug 1393 - IPv6 Routing Helper RT Print functions
|
||||
- bug 1395 - AODV DeferredRouteOutputTag missing constructor
|
||||
- bug 1396 - ARP with hardware addresses longer than 6 bytes
|
||||
- bug 1399 - TCP not backing off retransmissions properly
|
||||
- bug 1404 - Bound user input in tutorial third.cc program
|
||||
- bug 1406 - waf exits with maximum recursion depth exceeded
|
||||
- bug 1415 - examples-to-run.py doesn't work with command line arguments
|
||||
- bug 1420 - no python bindings for csma-layout
|
||||
- bug 1441 - IPv4 header length handling
|
||||
- bug 1420 - bug 1420: no python bindings for csma-layout
|
||||
|
||||
Known issues
|
||||
------------
|
||||
|
||||
@@ -11,11 +11,10 @@ be asked to contribute test code. Models that you contribute will be
|
||||
used for many years by other people, who probably have no idea upon
|
||||
first glance whether the model is correct. The test code that you
|
||||
write for your model will help to avoid future regressions in
|
||||
the output and will aid future users in understanding the verification
|
||||
the output and will aid future users in understanding the validity
|
||||
and bounds of applicability of your models.
|
||||
|
||||
There are many ways to verify the correctness of a model's implementation.
|
||||
In this section,
|
||||
There are many ways to test that a model is valid. In this chapter,
|
||||
we hope to cover some common cases that can be used as a guide to
|
||||
writing new tests.
|
||||
|
||||
@@ -32,63 +31,15 @@ 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.
|
||||
|
||||
A program called ``src/create-module.py`` is a good starting point.
|
||||
This program can be invoked such as ``create-module.py router`` for
|
||||
a hypothetical new module called ``router``. Once you do this, you
|
||||
will see a ``router`` directory, and a ``test/router-test-suite.cc``
|
||||
test suite. This file can be a starting point for your initial test.
|
||||
This is a working test suite, although the actual tests performed are
|
||||
trivial. Copy it over to your module's test directory, and do a global
|
||||
substitution of "Router" in that file for something pertaining to
|
||||
the model that you want to test. You can also edit things such as a
|
||||
more descriptive test case name.
|
||||
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.
|
||||
|
||||
You also need to add a block into your wscript to get this test to
|
||||
compile:
|
||||
|
||||
::
|
||||
|
||||
module_test.source = [
|
||||
'test/router-test-suite.cc',
|
||||
]
|
||||
|
||||
Before you actually start making this do useful things, it may help
|
||||
to try to run the skeleton. Make sure that ns-3 has been configured with
|
||||
the "--enable-tests" option. Let's assume that your new test suite
|
||||
is called "router" such as here:
|
||||
|
||||
::
|
||||
|
||||
RouterTestSuite::RouterTestSuite ()
|
||||
: TestSuite ("router", UNIT)
|
||||
|
||||
Try this command:
|
||||
|
||||
::
|
||||
|
||||
./test.py -s router
|
||||
|
||||
Output such as below should be produced:
|
||||
|
||||
::
|
||||
|
||||
PASS: TestSuite router
|
||||
1 of 1 tests passed (1 passed, 0 skipped, 0 failed, 0 crashed, 0 valgrind errors)
|
||||
|
||||
/* see src/lte/test/test-lte-antenna.cc for a worked example */
|
||||
*The rest of this chapter remains to be written*
|
||||
|
||||
How to add an example program to the test suite
|
||||
***********************************************
|
||||
|
||||
One can "smoke test" that examples compile and run successfully
|
||||
to completion (without memory leaks) using the ``examples-to-run.py``
|
||||
script located in your module's test directory. Briefly, by including
|
||||
an instance of this file in your test directory, you can cause the
|
||||
test runner to execute the examples listed. It is usually best to make
|
||||
sure that you select examples that have reasonably short run times so as
|
||||
to not bog down the tests. See the example in ``src/lte/test/``
|
||||
directory.
|
||||
|
||||
Testing for boolean outcomes
|
||||
****************************
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ Quick Overview
|
||||
**************
|
||||
|
||||
|ns3| random numbers are provided via instances of
|
||||
:cpp:class:`ns3::RandomVariableStream`.
|
||||
:cpp:class:`ns3::RandomVariable`.
|
||||
|
||||
* by default, |ns3| simulations use a fixed seed; if there is any randomness in
|
||||
the simulation, each run of the program will yield identical results unless
|
||||
@@ -21,18 +21,13 @@ Quick Overview
|
||||
* in *ns-3.3* and earlier, |ns3| simulations used a random seed by default; this
|
||||
marks a change in policy starting with *ns-3.4*.
|
||||
|
||||
* in *ns-3.14* and earlier, |ns3| simulations used a different wrapper class
|
||||
called :cpp:class:`ns3::RandomVariable`. As of *ns-3.15*, this class has been
|
||||
replaced by :cpp:class:`ns3::RandomVariableStream`; the underlying pseudo-random
|
||||
number generator has not changed.
|
||||
|
||||
* to obtain randomness across multiple simulation runs, you must either set the
|
||||
seed differently or set the run number differently. To set a seed, call
|
||||
:cpp:func:`ns3::SeedManager::SetSeed` at the beginning of the program; to set
|
||||
a run number with the same seed, call :cpp:func:`ns3::SeedManager::SetRun` at
|
||||
the beginning of the program; see :ref:`seeding-and-independent-replications`.
|
||||
|
||||
* each RandomVariableStream used in |ns3| has a virtual random number generator
|
||||
* each RandomVariable used in |ns3| has a virtual random number generator
|
||||
associated with it; all random variables use either a fixed or random seed
|
||||
based on the use of the global seed (previous bullet);
|
||||
|
||||
@@ -87,14 +82,14 @@ period (*i.e.*, the number of random numbers before overlap) of
|
||||
:math:`7.6x10^{22}`. The period of the entire generator is :math:`3.1x10^{57}`.
|
||||
|
||||
|
||||
Class :cpp:class:`ns3::RandomVariableStream` is the public interface to this
|
||||
underlying random number generator. When users create new random variables
|
||||
(such as :cpp:class:`ns3::UniformRandomVariable`,
|
||||
:cpp:class:`ns3::ExponentialRandomVariable`, etc.), they create an object that uses
|
||||
Class :cpp:class:`ns3::RandomVariable` is the public interface to this
|
||||
underlying random number generator. When users create new ``RandomVariables``
|
||||
(such as :cpp:class:`ns3::UniformVariable`,
|
||||
:cpp:class:`ns3::ExponentialVariable`, etc.), they create an object that uses
|
||||
one of the distinct, independent streams of the random number generator.
|
||||
Therefore, each object of type :cpp:class:`ns3::RandomVariableStream` has,
|
||||
Therefore, each object of type :cpp:class:`ns3::RandomVariable` has,
|
||||
conceptually, its own "virtual" RNG. Furthermore, each
|
||||
:cpp:class:`ns3::RandomVariableStream` can be configured to use one of the set of
|
||||
:cpp:class:`ns3::RandomVariable` can be configured to use one of the set of
|
||||
substreams drawn from the main stream.
|
||||
|
||||
An alternate implementation would be to allow each RandomVariable to have its
|
||||
@@ -127,8 +122,8 @@ before any random variables are created; e.g::
|
||||
SeedManager::SetSeed (3); // Changes seed from default of 1 to 3
|
||||
SeedManager::SetRun (7); // Changes run number from default of 1 to 7
|
||||
// Now, create random variables
|
||||
Ptr<UniformRandomVariable> x = CreateObject<UniformRandomVariable> ();
|
||||
Ptr<ExponentialRandomVariable> y = CreateObject<ExponentialRandomVarlable> ();
|
||||
UniformVariable x(0,10);
|
||||
ExponentialVariable y(2902);
|
||||
...
|
||||
|
||||
Which is better, setting a new seed or advancing the substream state? There is
|
||||
@@ -159,16 +154,16 @@ or, if you are running programs directly outside of waf::
|
||||
The above command-line variants make it easy to run lots of different
|
||||
runs from a shell script by just passing a different RngRun index.
|
||||
|
||||
Class RandomVariableStream
|
||||
**************************
|
||||
Class RandomVariable
|
||||
********************
|
||||
|
||||
All random variables should derive from class :cpp:class:`RandomVariable`. This
|
||||
base class provides a few methods for globally configuring the behavior
|
||||
base class provides a few static methods for globally configuring the behavior
|
||||
of the random number generator. Derived classes provide API for drawing random
|
||||
variates from the particular distribution being supported.
|
||||
|
||||
Each RandomVariableStream created in the simulation is given a generator that is a
|
||||
new RNGStream from the underlying PRNG. Used in this manner, the L'Ecuyer
|
||||
Each RandomVariable created in the simulation is given a generator that is a new
|
||||
RNGStream from the underlying PRNG. Used in this manner, the L'Ecuyer
|
||||
implementation allows for a maximum of :math:`1.8x10^19` random variables. Each
|
||||
random variable in a single replication can produce up to :math:`7.6x10^22`
|
||||
random numbers before overlapping.
|
||||
@@ -176,7 +171,7 @@ random numbers before overlapping.
|
||||
Base class public API
|
||||
*********************
|
||||
|
||||
Below are excerpted a few public methods of class :cpp:class:`RandomVariableStream`
|
||||
Below are excerpted a few public methods of class :cpp:class:`RandomVariable`
|
||||
that access the next value in the substream.::
|
||||
|
||||
/**
|
||||
@@ -186,7 +181,7 @@ that access the next value in the substream.::
|
||||
double GetValue (void) const;
|
||||
|
||||
/**
|
||||
* \brief Returns a random integer from the underlying distribution
|
||||
* \brief Returns a random integer integer from the underlying distribution
|
||||
* \return Integer cast of ::GetValue()
|
||||
*/
|
||||
uint32_t GetInteger (void) const;
|
||||
@@ -198,33 +193,36 @@ Types of RandomVariables
|
||||
************************
|
||||
|
||||
The following types of random variables are provided, and are documented in the
|
||||
|ns3| Doxygen or by reading ``src/core/model/random-variable-stream.h``. Users
|
||||
can also create their own custom random variables by deriving from class
|
||||
:cpp:class:`RandomVariableStream`.
|
||||
|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`.
|
||||
|
||||
* class :cpp:class:`UniformRandomVariable`
|
||||
* class :cpp:class:`ConstantRandomVariable`
|
||||
* class :cpp:class:`SequentialRandomVariable`
|
||||
* class :cpp:class:`ExponentialRandomVariable`
|
||||
* class :cpp:class:`ParetoRandomVariable`
|
||||
* class :cpp:class:`WeibullRandomVariable`
|
||||
* class :cpp:class:`NormalRandomVariable`
|
||||
* class :cpp:class:`LogNormalRandomVariable`
|
||||
* class :cpp:class:`GammaRandomVariable`
|
||||
* class :cpp:class:`ErlangRandomVariable`
|
||||
* class :cpp:class:`TriangularRandomVariable`
|
||||
* class :cpp:class:`ZipfRandomVariable`
|
||||
* class :cpp:class:`ZetaRandomVariable`
|
||||
* class :cpp:class:`DeterministicRandomVariable`
|
||||
* class :cpp:class:`EmpiricalRandomVariable`
|
||||
* class :cpp:class:`UniformVariable`
|
||||
* class :cpp:class:`ConstantVariable`
|
||||
* class :cpp:class:`SequentialVariable`
|
||||
* class :cpp:class:`ExponentialVariable`
|
||||
* class :cpp:class:`ParetoVariable`
|
||||
* class :cpp:class:`WeibullVariable`
|
||||
* class :cpp:class:`NormalVariable`
|
||||
* class :cpp:class:`EmpiricalVariable`
|
||||
* class :cpp:class:`IntEmpiricalVariable`
|
||||
* class :cpp:class:`DeterministicVariable`
|
||||
* class :cpp:class:`LogNormalVariable`
|
||||
* class :cpp:class:`TriangularVariable`
|
||||
* class :cpp:class:`GammaVariable`
|
||||
* class :cpp:class:`ErlangVariable`
|
||||
* class :cpp:class:`ZipfVariable`
|
||||
|
||||
Semantics of RandomVariableStream objects
|
||||
*****************************************
|
||||
Semantics of RandomVariable objects
|
||||
***********************************
|
||||
|
||||
RandomVariableStream objects derive from :cpp:class:`ns3::Object` and are
|
||||
handled by smart pointers.
|
||||
RandomVariable objects have value semantics. This means that they can be passed
|
||||
by value to functions. The can also be passed by reference to const.
|
||||
RandomVariables do not derive from :cpp:class:`ns3::Object` and we do not use
|
||||
smart pointers to manage them; they are either allocated on the stack or else
|
||||
users explicitly manage any heap-allocated RandomVariables.
|
||||
|
||||
RandomVariableStream instances can also be used in |ns3| attributes, which means
|
||||
RandomVariable objects can also be used in |ns3| attributes, which means
|
||||
that values can be set for them through the |ns3| attribute system.
|
||||
An example is in the propagation models for WifiNetDevice:::
|
||||
|
||||
@@ -236,15 +234,15 @@ An example is in the propagation models for WifiNetDevice:::
|
||||
.AddConstructor<RandomPropagationDelayModel> ()
|
||||
.AddAttribute ("Variable",
|
||||
"The random variable which generates random delays (s).",
|
||||
StringValue ("ns3::UniformRandomVariable"),
|
||||
MakePointerAccessor (&RandomPropagationDelayModel::m_variable),
|
||||
MakePointerChecker<RandomVariableStream> ())
|
||||
RandomVariableValue (UniformVariable (0.0, 1.0)),
|
||||
MakeRandomVariableAccessor (&RandomPropagationDelayModel::m_variable),
|
||||
MakeRandomVariableChecker ())
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
Here, the |ns3| user can change the default random variable for this
|
||||
delay model (which is a UniformRandomVariable ranging from 0 to 1) through
|
||||
delay model (which is a UniformVariable ranging from 0 to 1) through
|
||||
the attribute system.
|
||||
|
||||
Using other PRNG
|
||||
@@ -254,56 +252,10 @@ There is presently no support for substituting a different underlying
|
||||
random number generator (e.g., the GNU Scientific Library or the Akaroa
|
||||
package). Patches are welcome.
|
||||
|
||||
Setting the stream number
|
||||
*************************
|
||||
More advanced usage
|
||||
*******************
|
||||
|
||||
The underlying MRG32k3a generator provides 2^64 independent streams.
|
||||
In ns-3, these are assigned sequentially starting from the first stream as
|
||||
new RandomVariableStream instances make their first call to GetValue().
|
||||
|
||||
As a result of how these RandomVariableStream objects are assigned to
|
||||
underlying streams, the assignment is sensitive to perturbations of
|
||||
the simulation configuration. The consequence is that if any aspect of the
|
||||
simulation configuration is changed, the mapping of RandomVariables to
|
||||
streams may (or may not) change.
|
||||
|
||||
As a concrete example, a user running a comparative study between routing
|
||||
protocols may find that the act of changing one routing protocol for another
|
||||
will notice that the underlying mobility pattern also changed.
|
||||
|
||||
Starting with ns-3.15, some control has been provided to users to allow
|
||||
users to optionally fix the assignment of selected RandomVariableStream
|
||||
objects to underlying streams. This is the ``Stream`` attribute, part
|
||||
of the base class RandomVariableStream.
|
||||
|
||||
By partitioning the existing sequence of streams from before:
|
||||
|
||||
::
|
||||
|
||||
<-------------------------------------------------------------------------->
|
||||
stream 0 stream (2^64 - 1)
|
||||
|
||||
into two equal-sized sets:
|
||||
|
||||
::
|
||||
|
||||
<--------------------------------------------------------------------------->
|
||||
^ ^^ ^
|
||||
| || |
|
||||
stream 0 stream (2^63 - 1) stream 2^63 stream (2^64 - 1)
|
||||
<- automatically assigned -----><-------- assigned by user----------->
|
||||
|
||||
The first 2^63 streams continue to be automatically assigned, while
|
||||
the last 2^63 are given stream indices starting with zero up to
|
||||
2^63-1.
|
||||
|
||||
The assignment of streams to a fixed stream number is optional; instances
|
||||
of RandomVariableStream that do not have a stream value assigned will
|
||||
be assigned the next one from the pool of automatic streams.
|
||||
|
||||
To fix a RandomVariableStream to a particular underlying stream, assign
|
||||
its ``Stream`` attribute to a non-negative integer (the default value
|
||||
of -1 means that a value will be automatically allocated).
|
||||
*To be completed.*
|
||||
|
||||
Publishing your results
|
||||
***********************
|
||||
|
||||
@@ -49,7 +49,6 @@ SOURCES = \
|
||||
$(SRC)/network/doc/packets.rst \
|
||||
$(SRC)/network/doc/sockets-api.rst \
|
||||
$(SRC)/network/doc/simple.rst \
|
||||
$(SRC)/network/doc/queue.rst \
|
||||
$(SRC)/internet/doc/internet-stack.rst \
|
||||
$(SRC)/internet/doc/ipv4.rst \
|
||||
$(SRC)/internet/doc/ipv6.rst \
|
||||
|
||||
@@ -40,6 +40,7 @@ This document is written in `reStructuredText <http://docutils.sourceforge.net/r
|
||||
openflow-switch
|
||||
point-to-point
|
||||
propagation
|
||||
simple
|
||||
statistics
|
||||
topology
|
||||
uan
|
||||
|
||||
@@ -7,4 +7,3 @@ Network Module
|
||||
network-overview
|
||||
sockets-api
|
||||
simple
|
||||
queue
|
||||
+76
-92
@@ -1,89 +1,93 @@
|
||||
Steps in doing an ns-3 release
|
||||
|
||||
We typically post release candidates for testing at the following URL:
|
||||
https://www.nsnam.org/release/ns-allinone-3.X.rcX.tar.bz2
|
||||
ns-3-dev preparation
|
||||
--------------------
|
||||
|
||||
This overview covers the following release stages:
|
||||
1) new feature additions and bug fixing
|
||||
2) preparing release candidates for testing
|
||||
3) making the actual release
|
||||
4) maintaining the release
|
||||
|
||||
1) new feature additions and bug fixing
|
||||
---------------------------------------
|
||||
|
||||
During the software development phase, it is important for the release
|
||||
manager to try to maintain the following files with updated information:
|
||||
- AUTHORS
|
||||
- RELEASE_NOTES
|
||||
- CHANGES.html
|
||||
|
||||
otherwise, this becomes painful to edit (and things are forgotten)
|
||||
when the release is imminent.
|
||||
|
||||
2) preparing release candidates for testing
|
||||
-------------------------------------------
|
||||
|
||||
This step presumes that you have a reasonably solid ns-3-dev that you
|
||||
and/or the buildbots have been testing
|
||||
- building static, optimized, and debug versions
|
||||
- try Python visualizer (not tested by buildbots)
|
||||
-- ./waf --pyrun src/flow-monitor/examples/wifi-olsr-flowmon.py --vis
|
||||
- ensure that tests pass (./test.py -g) and make sure that the buildbots
|
||||
are reporting blue based on the tip of the repository
|
||||
- revise and check in AUTHORS, RELEASE_NOTES, and CHANGES>html
|
||||
- required versions for related libraries (nsc, netanim, pybindgen)
|
||||
are correct
|
||||
- make latexpdf in the doc/manual, doc/models, and doc/tutorial directories
|
||||
- confirm that Doxygen builds cleanly (./waf doxygen),
|
||||
|
||||
Check out a clean ns-3-dev somewhere using ns-3-allinone
|
||||
1. check out a clean ns-3-dev somewhere using ns-3-allinone (you will need it)
|
||||
- hg clone http://code.nsnam.org/ns-3-allinone
|
||||
- ./download.py
|
||||
- ./build.py --enable-examples --enable-tests
|
||||
- try building static, optimized, and debug versions
|
||||
- try Python visualizer (not tested by buildbots)
|
||||
-- ./waf --pyrun src/flow-monitor/examples/wifi-olsr-flowmon.py --vis
|
||||
- cd ns-3-dev
|
||||
- edit VERSION such as "ns-3.14.rc1" (DO NOT commit this change to ns-3-dev)
|
||||
- cd ..
|
||||
- ./dist.py
|
||||
- ensure that tests pass (./test.py -g) and make sure that the buildbots
|
||||
are reporting greens based on the tip of the repository
|
||||
|
||||
This should yield a compressed tarfile, such as: ns-allinone-3.14.rc1.tar.bz2
|
||||
Test this, and when satisfied, upload it to
|
||||
www.nsnam.org:/var/www/html/releases/ (with apache:apache file ownership)
|
||||
2. prepare the source files
|
||||
- revise and check in AUTHORS, if needed
|
||||
- revise and check in RELEASE_NOTES. Make sure to edit the Availability
|
||||
section if this is a final release.
|
||||
- DO NOT change VERSION at this time
|
||||
- confirm that Doxygen builds cleanly (./waf doxygen),
|
||||
and check in any necessary changes. Currently, doxygen does not build
|
||||
cleanly, we need to fix this over time.
|
||||
|
||||
Announce it to ns-developers as:
|
||||
https://www.nsnam.org/release/ns-allinone-3.14.rc3.tar.bz2
|
||||
At this point, the ns-3-dev should be ready, except for changing the
|
||||
name of this repo from "3-dev" to the numbered release. That will come
|
||||
in subsequent steps.
|
||||
|
||||
Iterate the above as needed during the release testing phase.
|
||||
ns-allinone-3.X.tar.bz2 dry run
|
||||
-------------------------------
|
||||
|
||||
Note, in the past we have added mercurial tags to ns-3-dev to denote
|
||||
release candidates, but lately we have not been bothering with this.
|
||||
If you would like to tag a release candidate, follow these steps
|
||||
-- hg tag "ns-3.X.rcX" (for the appropriate version numbers)
|
||||
-- hg push ssh://code@code.nsnam.org/repos/ns-3-dev
|
||||
This phase is optional to dry-run a tarball before tagging. You may skip
|
||||
to the next phase if you are ready to just make the release or release
|
||||
candidate.
|
||||
|
||||
3) making the release
|
||||
---------------------
|
||||
1. check out a clean ns-3-allinone again
|
||||
- change into the allinone directory
|
||||
- ./download.py
|
||||
- cd ns-3-dev
|
||||
- change VERSION to the appropriate string, either "3.X" (for a release) or
|
||||
"3.X.RC1" Do not commit this VERSION change to ns-3-dev. It is used
|
||||
by dist.py script to name the directory properly.
|
||||
- cd into allinone directory and type "./dist.py"; you should see something
|
||||
like this:
|
||||
|
||||
Follow similar steps for creating the release candidate tarballs, except
|
||||
we will work off of a release repository.
|
||||
NS-3 version: '3.12'
|
||||
Adding ns-3-dev as ns-allinone-3.12/ns-3.12
|
||||
Adding pybindgen as ns-allinone-3.12/pybindgen-0.15.0.795
|
||||
Adding nsc as ns-allinone-3.12/nsc-0.5.2
|
||||
Adding the build script files
|
||||
|
||||
This will create an ns-allinone-3.X.tar.bz2 tarball
|
||||
|
||||
2. test tarball on release platforms
|
||||
- optimized, debug, and static builds
|
||||
- ./test.py -g
|
||||
- make latexpdf in the doc/manual, doc/models, and doc/tutorial directories
|
||||
- ./waf --doxygen
|
||||
|
||||
At this point, you are ready for final packaging and repository/site work
|
||||
|
||||
tagging ns-3-dev and creating ns-3.X repositories
|
||||
-------------------------------------------------
|
||||
|
||||
We'll refer to the release number as "X" or "x" below. The steps here
|
||||
involve tagging ns-3-dev, copying over ns-3-dev to ns-3.X on code.nsnam.org,
|
||||
cloning it locally, making changes from "3-dev" to "3.X" in various places,
|
||||
and checking in those changes to the new ns-3.X repository.
|
||||
The steps here involve tagging ns-3-dev, copying over ns-3-dev to ns-3.X
|
||||
on code.nsnam.org, cloning it locally, making changes from "3-dev" to "3.X"
|
||||
in various places, and checking in those changes to the new ns-3.X repository.
|
||||
|
||||
1. once you are happy with the most recent release candidate tarball and
|
||||
do not plan to further touch ns-3-dev, tag ns-3-dev
|
||||
1. once you are happy with the tarball, tag ns-3-dev
|
||||
- cd into ns-3-dev
|
||||
- if release candidate
|
||||
-- hg tag "ns-3.x-RCy"
|
||||
-- hg push ssh://code@code.nsnam.org//home/code/repos/ns-3-dev
|
||||
- else if final release
|
||||
-- hg tag "ns-3.x"
|
||||
-- hg push ssh://code@code.nsnam.org//home/code/repos/ns-3-dev
|
||||
|
||||
2. copy the tagged ns-3-dev and place it on the repository
|
||||
- ssh code.nsnam.org; sudo bash; su code;
|
||||
- if release candidate
|
||||
-- cp -r /home/code/repos/ns-3-dev /home/code/repos/ns-3.x-RCy
|
||||
-- cd /home/code/repos/ns-3.x-RCy/.hg and edit the hgrc appropriately:
|
||||
[paths]
|
||||
default = /home/code/repos/ns-3.x-RCy
|
||||
[web]
|
||||
description = ns-3.x-RCy release
|
||||
name = ns-3.x-RCy
|
||||
contact = <ns-developers@isi.edu>
|
||||
- else if final release
|
||||
-- cp -r /home/code/repos/ns-3-dev /home/code/repos/ns-3.x
|
||||
-- cd /home/code/repos/ns-3.x/.hg and edit the hgrc appropriately:
|
||||
[paths]
|
||||
@@ -93,20 +97,21 @@ do not plan to further touch ns-3-dev, tag ns-3-dev
|
||||
name = ns-3.x
|
||||
contact = <ns-developers@isi.edu>
|
||||
|
||||
3. check out a clean version of the new release (ns-3.x)
|
||||
to a scratch directory on your local machine
|
||||
- hg clone http://code.nsnam.org/ns-3.x
|
||||
3. If this is a final release (not RC)
|
||||
- move (mv) ns-3.x RCs in /home/code/archived-repos
|
||||
|
||||
5. Update the VERSION for this new release, in the ns-3.x directory (i.e.
|
||||
NOT in ns-3-dev)
|
||||
4. check out a clean version of the new release (ns-3.x) or (ns-3.x-RCy)
|
||||
to your local machine
|
||||
- hg clone http://code.nsnam.org/ns-3.x or (-RCy)
|
||||
|
||||
5. Update the VERSION for this new release
|
||||
- change the string 3-dev in the VERSION file to the real version
|
||||
(e.g. 3.14) This must agree with the version name you chose in the clone.
|
||||
(e.g. 3.7 or 3.7-RC1) This must agree with the version name you chose in the clone.
|
||||
- change the version and release string for the documentation in
|
||||
doc/manual/source, doc/tutorial/source, doc/tutorial-pt/source,
|
||||
and doc/models/source conf.py files
|
||||
doc/manual/source, doc/tutorial/source, and doc/models/source conf.py files
|
||||
This should hopefully be updated in the future to simply pull from the
|
||||
VERSION file.
|
||||
- hg commit -m "update VERSION to ns-3.x"
|
||||
- hg commit -m "update VERSION to ns-3.x" or (-RCy), you get the point
|
||||
- hg push ssh://code@code.nsnam.org//home/code/repos/ns-3.x
|
||||
|
||||
creating the distribution tarball
|
||||
@@ -166,7 +171,7 @@ Documentation)
|
||||
4. The main page http://www.nsnam.org should point to
|
||||
ns-3.x in the "Download" and "Documentation" boxes
|
||||
|
||||
5. Create a blog entry to announce release
|
||||
5. Create blog entry to announce release
|
||||
|
||||
ns-3 wiki edits
|
||||
---------------
|
||||
@@ -193,24 +198,3 @@ Announcing
|
||||
|
||||
2. announce to ns-developers and ns-3-users, with summary of release notes
|
||||
|
||||
|
||||
4) maintaining the release
|
||||
--------------------------
|
||||
|
||||
First, create skeletal sections in CHANGES.html and RELEASE_NOTES to
|
||||
start collecting inputs for the ns-3.(x+1) release.
|
||||
|
||||
The project may decide to make incremental, bug-fix releases from
|
||||
time to time, with a minor version number (e.g. ns-3.7.1). To do
|
||||
this, changesets may be cherry-picked from ns-3-dev and added to
|
||||
ns-3.x repository. Do not move over changesets that pertain to
|
||||
adding new features, but documentation fixes and bug fixes are good
|
||||
changesets to make available in a minor release. The same steps
|
||||
above for making a release are generally followed, although one
|
||||
does not need to create a separate repository, but instead just tags
|
||||
the existing ns-3-dev and ns-3.x repositories with a "ns-3.x.1" type
|
||||
of tag.
|
||||
|
||||
Also, on the main website, make sure that "latest release" points to
|
||||
the right page. See how it was handled for ns-3.12 (which made
|
||||
a minor release): https://www.nsnam.org/ns-3.12/
|
||||
@@ -24,7 +24,7 @@ who want to learn more are encouraged to read the following additional
|
||||
documentation:
|
||||
|
||||
* The |ns3| manual
|
||||
* The |ns3| model library documentation
|
||||
* The |ns3| model library documentatio
|
||||
* The |ns3| Doxygen (API documentation)
|
||||
* The |ns3| wiki
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ Downloading ns-3
|
||||
|
||||
The |ns3| system as a whole is a fairly complex system and has a
|
||||
number of dependencies on other components. Along with the systems you will
|
||||
most likely deal with every day (the GNU toolchain, Mercurial, a text
|
||||
most likely deal with every day (the GNU toolchain, Mercurial, you programmer
|
||||
editor) you will need to ensure that a number of additional libraries are
|
||||
present on your system before proceeding. |ns3| provides a wiki
|
||||
for your reading pleasure that includes pages with many useful hints and tips.
|
||||
|
||||
@@ -122,24 +122,22 @@ RoutingExperiment::RoutingExperiment ()
|
||||
std::string
|
||||
PrintReceivedPacket (Ptr<Socket> socket, Ptr<Packet> packet)
|
||||
{
|
||||
SocketAddressTag tag;
|
||||
bool found;
|
||||
found = packet->PeekPacketTag (tag);
|
||||
Ptr<const SocketAddressTag> tag = packet->PeekPacketTag<SocketAddressTag> ();
|
||||
std::ostringstream oss;
|
||||
|
||||
oss << Simulator::Now ().GetSeconds () << " " << socket->GetNode ()->GetId ();
|
||||
|
||||
if (found)
|
||||
{
|
||||
InetSocketAddress addr = InetSocketAddress::ConvertFrom (tag.GetAddress ());
|
||||
if (tag != 0)
|
||||
{
|
||||
InetSocketAddress addr = InetSocketAddress::ConvertFrom (tag->GetAddress ());
|
||||
oss << " received one packet from " << addr.GetIpv4 ();
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
oss << " received one packet!";
|
||||
}
|
||||
}
|
||||
return oss.str ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RoutingExperiment::ReceivePacket (Ptr<Socket> socket)
|
||||
@@ -150,7 +148,7 @@ RoutingExperiment::ReceivePacket (Ptr<Socket> socket)
|
||||
bytesTotal += packet->GetSize ();
|
||||
packetsReceived += 1;
|
||||
NS_LOG_UNCOND (PrintReceivedPacket (socket, packet));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
def build(bld):
|
||||
obj = bld.create_ns3_program('tcp-large-transfer',
|
||||
['point-to-point', 'applications', 'internet'])
|
||||
['visualizer', 'point-to-point', 'applications', 'internet'])
|
||||
obj.source = 'tcp-large-transfer.cc'
|
||||
|
||||
obj = bld.create_ns3_program('tcp-nsc-lfn',
|
||||
|
||||
@@ -8,16 +8,16 @@ def build(bld):
|
||||
bld.register_ns3_script('mixed-wireless.py', ['core', 'mobility', 'wifi', 'applications', 'point-to-point',
|
||||
'internet', 'csma', 'olsr'])
|
||||
|
||||
obj = bld.create_ns3_program('wifi-adhoc', ['core', 'mobility', 'wifi', 'applications', 'tools'])
|
||||
obj = bld.create_ns3_program('wifi-adhoc', ['core', 'mobility', 'wifi', 'applications', 'tools', 'visualizer'])
|
||||
obj.source = 'wifi-adhoc.cc'
|
||||
|
||||
obj = bld.create_ns3_program('wifi-clear-channel-cmu', ['internet', 'mobility', 'wifi', 'tools'])
|
||||
obj.source = 'wifi-clear-channel-cmu.cc'
|
||||
|
||||
obj = bld.create_ns3_program('wifi-ap', ['core', 'mobility', 'wifi', 'applications', 'config-store', 'tools'])
|
||||
obj = bld.create_ns3_program('wifi-ap', ['core', 'mobility', 'wifi', 'applications', 'config-store', 'tools', 'visualizer'])
|
||||
obj.source = 'wifi-ap.cc'
|
||||
|
||||
bld.register_ns3_script('wifi-ap.py', ['core', 'mobility', 'wifi', 'applications', 'config-store', 'tools'])
|
||||
bld.register_ns3_script('wifi-ap.py', ['core', 'mobility', 'wifi', 'applications', 'config-store', 'tools', 'visualizer'])
|
||||
|
||||
obj = bld.create_ns3_program('wifi-wired-bridging', ['internet', 'mobility', 'wifi', 'csma', 'bridge', 'applications'])
|
||||
obj.source = 'wifi-wired-bridging.cc'
|
||||
@@ -28,16 +28,16 @@ def build(bld):
|
||||
obj = bld.create_ns3_program('multirate', ['internet', 'mobility', 'wifi', 'tools', 'flow-monitor', 'olsr', 'applications', 'point-to-point'])
|
||||
obj.source = 'multirate.cc'
|
||||
|
||||
obj = bld.create_ns3_program('wifi-simple-adhoc', ['internet', 'mobility', 'wifi', 'config-store', 'tools'])
|
||||
obj = bld.create_ns3_program('wifi-simple-adhoc', ['internet', 'mobility', 'wifi', 'config-store', 'tools', 'visualizer'])
|
||||
obj.source = 'wifi-simple-adhoc.cc'
|
||||
|
||||
obj = bld.create_ns3_program('wifi-simple-adhoc-grid', ['internet', 'mobility', 'wifi', 'olsr', 'config-store', 'tools', 'point-to-point'])
|
||||
obj = bld.create_ns3_program('wifi-simple-adhoc-grid', ['internet', 'mobility', 'wifi', 'olsr', 'config-store', 'tools', 'point-to-point', 'visualizer'])
|
||||
obj.source = 'wifi-simple-adhoc-grid.cc'
|
||||
|
||||
obj = bld.create_ns3_program('wifi-simple-infra', ['internet', 'mobility', 'wifi','config-store'])
|
||||
obj = bld.create_ns3_program('wifi-simple-infra', ['internet', 'mobility', 'wifi','config-store', 'visualizer'])
|
||||
obj.source = 'wifi-simple-infra.cc'
|
||||
|
||||
obj = bld.create_ns3_program('wifi-simple-interference', ['internet', 'mobility', 'wifi', 'config-store', 'tools'])
|
||||
obj = bld.create_ns3_program('wifi-simple-interference', ['internet', 'mobility', 'wifi', 'config-store', 'tools', 'visualizer'])
|
||||
obj.source = 'wifi-simple-interference.cc'
|
||||
|
||||
obj = bld.create_ns3_program('wifi-blockack', ['internet', 'mobility', 'wifi', 'applications'])
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
/**
|
||||
* this method is expected to be re-implemented by each antenna model
|
||||
*
|
||||
* \param a the spherical angles at which the radiation pattern should
|
||||
* \param the spherical angles at which the radiation pattern should
|
||||
* be evaluated
|
||||
*
|
||||
* \return the power gain in dBi of the antenna radiation pattern at
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace aodv
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (TypeHeader);
|
||||
|
||||
TypeHeader::TypeHeader (MessageType t/* = AODVTYPE_RREQ*/) :
|
||||
TypeHeader::TypeHeader (MessageType t = AODVTYPE_RREQ) :
|
||||
m_type (t), m_valid (true)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class TypeHeader : public Header
|
||||
{
|
||||
public:
|
||||
/// c-tor
|
||||
TypeHeader (MessageType t = AODVTYPE_RREQ);
|
||||
TypeHeader (MessageType t);
|
||||
|
||||
///\name Header serialization/deserialization
|
||||
//\{
|
||||
|
||||
@@ -352,9 +352,9 @@ RoutingProtocol::RouteOutput (Ptr<Packet> p, const Ipv4Header &header,
|
||||
// Actual route request will be deferred until packet will be fully formed,
|
||||
// routed to loopback, received from loopback and passed to RouteInput (see below)
|
||||
uint32_t iif = (oif ? m_ipv4->GetInterfaceForDevice (oif) : -1);
|
||||
DeferredRouteOutputTag tag (iif);
|
||||
if (!p->PeekPacketTag (tag))
|
||||
if (p->PeekPacketTag<DeferredRouteOutputTag> () == 0)
|
||||
{
|
||||
Ptr<DeferredRouteOutputTag> tag = CreateObject<DeferredRouteOutputTag> (iif);
|
||||
p->AddPacketTag (tag);
|
||||
}
|
||||
return LoopbackRoute (header, oif);
|
||||
@@ -405,8 +405,7 @@ RoutingProtocol::RouteInput (Ptr<const Packet> p, const Ipv4Header &header,
|
||||
// Deferred route request
|
||||
if (idev == m_lo)
|
||||
{
|
||||
DeferredRouteOutputTag tag;
|
||||
if (p->PeekPacketTag (tag))
|
||||
if (p->PeekPacketTag<DeferredRouteOutputTag> () != 0)
|
||||
{
|
||||
DeferredRouteOutput (p, header, ucb, ecb);
|
||||
return true;
|
||||
@@ -1594,11 +1593,11 @@ RoutingProtocol::SendPacketFromQueue (Ipv4Address dst, Ptr<Ipv4Route> route)
|
||||
QueueEntry queueEntry;
|
||||
while (m_queue.Dequeue (dst, queueEntry))
|
||||
{
|
||||
DeferredRouteOutputTag tag;
|
||||
Ptr<Packet> p = ConstCast<Packet> (queueEntry.GetPacket ());
|
||||
if (p->RemovePacketTag (tag) &&
|
||||
tag.GetInterface() != -1 &&
|
||||
tag.GetInterface() != m_ipv4->GetInterfaceForDevice (route->GetOutputDevice ()))
|
||||
Ptr<const DeferredRouteOutputTag> tag = p->RemovePacketTag<DeferredRouteOutputTag> ();
|
||||
if (tag != 0 &&
|
||||
tag->GetInterface() != -1 &&
|
||||
tag->GetInterface() != m_ipv4->GetInterfaceForDevice (route->GetOutputDevice ()))
|
||||
{
|
||||
NS_LOG_DEBUG ("Output device doesn't match. Dropped.");
|
||||
return;
|
||||
|
||||
@@ -211,8 +211,8 @@ void Radvd::Send (Ptr<RadvdInterface> config, Ipv6Address dst, bool reschedule)
|
||||
/* Router advertisements MUST always have a ttl of 255
|
||||
* The ttl value should be set as a socket option, but this is not yet implemented
|
||||
*/
|
||||
SocketIpTtlTag ttl;
|
||||
ttl.SetTtl (255);
|
||||
Ptr<SocketIpTtlTag> ttl = CreateObject<SocketIpTtlTag> ();
|
||||
ttl->SetTtl (255);
|
||||
p->AddPacketTag (ttl);
|
||||
|
||||
/* send RA */
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "attribute-default-iterator.h"
|
||||
#include "ns3/attribute.h"
|
||||
#include "ns3/pointer.h"
|
||||
#include "ns3/callback.h"
|
||||
#include "ns3/global-value.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/object-ptr-container.h"
|
||||
@@ -83,13 +82,7 @@ AttributeDefaultIterator::Iterate (void)
|
||||
//pointer value, won't take it
|
||||
continue;
|
||||
}
|
||||
Ptr<const CallbackValue> callback = DynamicCast<const CallbackValue> (info.initialValue);
|
||||
if (callback != 0)
|
||||
{
|
||||
//callback value, won't take it
|
||||
continue;
|
||||
}
|
||||
//We take only values, no pointers or vectors or callbacks
|
||||
//We take only values, no pointers or vectors
|
||||
if (!calledStart)
|
||||
{
|
||||
StartVisitTypeId (tid.GetName ());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
callback_classes = [
|
||||
['void', 'unsigned char*', 'int', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
|
||||
['void', 'unsigned char*', 'long', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
|
||||
['void', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
|
||||
['bool', 'std::string', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
|
||||
]
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,532 +0,0 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2008 Timo Bingmann
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Timo Bingmann <timo.bingmann@student.kit.edu>
|
||||
*/
|
||||
#include "ns3/random-variable-stream.h"
|
||||
#include "ns3/ptr.h"
|
||||
#include "ns3/double.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/integer.h"
|
||||
#include "ns3/gnuplot.h"
|
||||
#include <map>
|
||||
#include <cmath>
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
/// Round a double number to the given precision. e.g. dround(0.234, 0.1) = 0.2
|
||||
/// and dround(0.257, 0.1) = 0.3
|
||||
double dround (double number, double precision)
|
||||
{
|
||||
number /= precision;
|
||||
if (number >= 0)
|
||||
number = std::floor (number + 0.5);
|
||||
else
|
||||
number = std::ceil (number - 0.5);
|
||||
number *= precision;
|
||||
return number;
|
||||
}
|
||||
|
||||
static GnuplotDataset
|
||||
Histogramm (Ptr<RandomVariableStream> rndvar, unsigned int probes, double precision, const std::string& title, bool notcontinous = false)
|
||||
{
|
||||
typedef std::map<double, unsigned int> histogramm_maptype;
|
||||
histogramm_maptype histogramm;
|
||||
|
||||
for(unsigned int i = 0; i < probes; ++i)
|
||||
{
|
||||
double val = dround ( rndvar->GetValue (), precision );
|
||||
|
||||
++histogramm[val];
|
||||
}
|
||||
|
||||
Gnuplot2dDataset data;
|
||||
data.SetTitle (title);
|
||||
|
||||
if (notcontinous)
|
||||
{
|
||||
data.SetStyle (Gnuplot2dDataset::IMPULSES);
|
||||
}
|
||||
|
||||
for(histogramm_maptype::const_iterator hi = histogramm.begin ();
|
||||
hi != histogramm.end (); ++hi)
|
||||
{
|
||||
data.Add (hi->first, (double)hi->second / (double)probes / precision);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
unsigned int probes = 1000000;
|
||||
double precision = 0.01;
|
||||
|
||||
GnuplotCollection gnuplots ("main-random-variables.pdf");
|
||||
gnuplots.SetTerminal ("pdf enhanced");
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("UniformRandomVariable");
|
||||
plot.AppendExtra ("set yrange [0:]");
|
||||
|
||||
Ptr<UniformRandomVariable> x = CreateObject<UniformRandomVariable> ();
|
||||
x->SetAttribute ("Min", DoubleValue (0.0));
|
||||
x->SetAttribute ("Max", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x, probes, precision,
|
||||
"UniformRandomVariable [0.0 .. 1.0)") );
|
||||
plot.AddDataset ( Gnuplot2dFunction ("1.0",
|
||||
"0 <= x && x <= 1 ? 1.0 : 0") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("ExponentialRandomVariable");
|
||||
plot.AppendExtra ("set xrange [0:8]");
|
||||
plot.AppendExtra ("ExpDist(x,l) = 1/l * exp(-1/l * x)");
|
||||
|
||||
Ptr<ExponentialRandomVariable> x1 = CreateObject<ExponentialRandomVariable> ();
|
||||
x1->SetAttribute ("Mean", DoubleValue (0.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"ExponentialRandomVariable m=0.5") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("ExponentialDistribution mean 0.5",
|
||||
"ExpDist(x, 0.5)") );
|
||||
|
||||
Ptr<ExponentialRandomVariable> x2 = CreateObject<ExponentialRandomVariable> ();
|
||||
x2->SetAttribute ("Mean", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"ExponentialRandomVariable m=1") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("ExponentialDistribution mean 1.0",
|
||||
"ExpDist(x, 1.0)") );
|
||||
|
||||
Ptr<ExponentialRandomVariable> x3 = CreateObject<ExponentialRandomVariable> ();
|
||||
x3->SetAttribute ("Mean", DoubleValue (1.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"ExponentialRandomVariable m=1.5") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("ExponentialDistribution mean 1.5",
|
||||
"ExpDist(x, 1.5)") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("ParetoRandomVariable");
|
||||
plot.AppendExtra ("set xrange [0:2]");
|
||||
|
||||
Ptr<ParetoRandomVariable> x1 = CreateObject<ParetoRandomVariable> ();
|
||||
x1->SetAttribute ("Mean", DoubleValue (1.0));
|
||||
x1->SetAttribute ("Shape", DoubleValue (1.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"ParetoRandomVariable m=1.0 s=1.5") );
|
||||
|
||||
Ptr<ParetoRandomVariable> x2 = CreateObject<ParetoRandomVariable> ();
|
||||
x2->SetAttribute ("Mean", DoubleValue (1.0));
|
||||
x2->SetAttribute ("Shape", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"ParetoRandomVariable m=1.0 s=2.0") );
|
||||
|
||||
Ptr<ParetoRandomVariable> x3 = CreateObject<ParetoRandomVariable> ();
|
||||
x3->SetAttribute ("Mean", DoubleValue (1.0));
|
||||
x3->SetAttribute ("Shape", DoubleValue (2.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"ParetoRandomVariable m=1.0 s=2.5") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("WeibullRandomVariable");
|
||||
plot.AppendExtra ("set xrange [0:3]");
|
||||
|
||||
Ptr<WeibullRandomVariable> x1 = CreateObject<WeibullRandomVariable> ();
|
||||
x1->SetAttribute ("Scale", DoubleValue (1.0));
|
||||
x1->SetAttribute ("Shape", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"WeibullRandomVariable m=1.0 s=1.0") );
|
||||
|
||||
Ptr<WeibullRandomVariable> x2 = CreateObject<WeibullRandomVariable> ();
|
||||
x2->SetAttribute ("Scale", DoubleValue (1.0));
|
||||
x2->SetAttribute ("Shape", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"WeibullRandomVariable m=1.0 s=2.0") );
|
||||
|
||||
Ptr<WeibullRandomVariable> x3 = CreateObject<WeibullRandomVariable> ();
|
||||
x3->SetAttribute ("Scale", DoubleValue (1.0));
|
||||
x3->SetAttribute ("Shape", DoubleValue (3.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"WeibullRandomVariable m=1.0 s=3.0") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("NormalRandomVariable");
|
||||
plot.AppendExtra ("set xrange [-3:3]");
|
||||
plot.AppendExtra ("NormalDist(x,m,s) = 1 / (s * sqrt(2*pi)) * exp(-1.0 / 2.0 * ((x-m) / s)**2)");
|
||||
|
||||
Ptr<NormalRandomVariable> x1 = CreateObject<NormalRandomVariable> ();
|
||||
x1->SetAttribute ("Mean", DoubleValue (0.0));
|
||||
x1->SetAttribute ("Variance", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"NormalRandomVariable m=0.0 v=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("NormalDist {/Symbol m}=0.0 {/Symbol s}=1.0",
|
||||
"NormalDist(x,0.0,1.0)") );
|
||||
|
||||
Ptr<NormalRandomVariable> x2 = CreateObject<NormalRandomVariable> ();
|
||||
x2->SetAttribute ("Mean", DoubleValue (0.0));
|
||||
x2->SetAttribute ("Variance", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"NormalRandomVariable m=0.0 v=2.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("NormalDist {/Symbol m}=0.0 {/Symbol s}=sqrt(2.0)",
|
||||
"NormalDist(x,0.0,sqrt(2.0))") );
|
||||
|
||||
Ptr<NormalRandomVariable> x3 = CreateObject<NormalRandomVariable> ();
|
||||
x3->SetAttribute ("Mean", DoubleValue (0.0));
|
||||
x3->SetAttribute ("Variance", DoubleValue (3.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"NormalRandomVariable m=0.0 v=3.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("NormalDist {/Symbol m}=0.0 {/Symbol s}=sqrt(3.0)",
|
||||
"NormalDist(x,0.0,sqrt(3.0))") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
// XXX Turn this plot back on once its distribution has been finished.
|
||||
/*
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("EmpiricalRandomVariable");
|
||||
plot.AppendExtra ("set xrange [*:*]");
|
||||
|
||||
EmpiricalRandomVariable emp1;
|
||||
emp1.CDF (0.0, 0.0 / 15.0);
|
||||
emp1.CDF (0.2, 1.0 / 15.0);
|
||||
emp1.CDF (0.4, 3.0 / 15.0);
|
||||
emp1.CDF (0.6, 6.0 / 15.0);
|
||||
emp1.CDF (0.8, 10.0 / 15.0);
|
||||
emp1.CDF (1.0, 15.0 / 15.0);
|
||||
|
||||
plot.AddDataset ( Histogramm (emp1, probes, precision,
|
||||
"EmpiricalRandomVariable (Stairs)") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
// XXX Turn the above plot back on once its distribution has been finished.
|
||||
*/
|
||||
|
||||
// XXX Turn this plot back on once its distribution has been finished.
|
||||
/*
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("DeterministicRandomVariable");
|
||||
plot.AppendExtra ("set xrange [*:*]");
|
||||
|
||||
double values[] = { 0.0, 0.2, 0.2, 0.4, 0.2, 0.6, 0.8, 0.8, 1.0 };
|
||||
DeterministicRandomVariable det1 (values, sizeof(values) / sizeof(values[0]));
|
||||
|
||||
plot.AddDataset ( Histogramm (det1, probes, precision,
|
||||
"DeterministicRandomVariable", true) );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
// XXX Turn the above plot back on once its distribution has been finished.
|
||||
*/
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("LogNormalRandomVariable");
|
||||
plot.AppendExtra ("set xrange [0:3]");
|
||||
|
||||
plot.AppendExtra ("LogNormalDist(x,m,s) = 1.0/x * NormalDist(log(x), m, s)");
|
||||
|
||||
Ptr<LogNormalRandomVariable> x1 = CreateObject<LogNormalRandomVariable> ();
|
||||
x1->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x1->SetAttribute ("Sigma", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("LogNormalDist(x, 0.0, 1.0)",
|
||||
"LogNormalDist(x, 0.0, 1.0)") );
|
||||
|
||||
Ptr<LogNormalRandomVariable> x2 = CreateObject<LogNormalRandomVariable> ();
|
||||
x2->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x2->SetAttribute ("Sigma", DoubleValue (0.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=0.5") );
|
||||
|
||||
Ptr<LogNormalRandomVariable> x3 = CreateObject<LogNormalRandomVariable> ();
|
||||
x3->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x3->SetAttribute ("Sigma", DoubleValue (0.25));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=0.25") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("LogNormalDist(x, 0.0, 0.25)",
|
||||
"LogNormalDist(x, 0.0, 0.25)") );
|
||||
|
||||
Ptr<LogNormalRandomVariable> x4 = CreateObject<LogNormalRandomVariable> ();
|
||||
x4->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x4->SetAttribute ("Sigma", DoubleValue (0.125));
|
||||
|
||||
plot.AddDataset ( Histogramm (x4, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=0.125") );
|
||||
|
||||
Ptr<LogNormalRandomVariable> x5 = CreateObject<LogNormalRandomVariable> ();
|
||||
x5->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x5->SetAttribute ("Sigma", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x5, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=2.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("LogNormalDist(x, 0.0, 2.0)",
|
||||
"LogNormalDist(x, 0.0, 2.0)") );
|
||||
|
||||
Ptr<LogNormalRandomVariable> x6 = CreateObject<LogNormalRandomVariable> ();
|
||||
x6->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x6->SetAttribute ("Sigma", DoubleValue (2.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x6, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=2.5") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("TriangularRandomVariable");
|
||||
plot.AppendExtra ("set xrange [*:*]");
|
||||
|
||||
Ptr<TriangularRandomVariable> x1 = CreateObject<TriangularRandomVariable> ();
|
||||
x1->SetAttribute ("Min", DoubleValue (0.0));
|
||||
x1->SetAttribute ("Max", DoubleValue (1.0));
|
||||
x1->SetAttribute ("Mean", DoubleValue (0.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"TriangularRandomVariable [0.0 .. 1.0) m=0.5") );
|
||||
|
||||
Ptr<TriangularRandomVariable> x2 = CreateObject<TriangularRandomVariable> ();
|
||||
x2->SetAttribute ("Min", DoubleValue (0.0));
|
||||
x2->SetAttribute ("Max", DoubleValue (1.0));
|
||||
x2->SetAttribute ("Mean", DoubleValue (0.4));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"TriangularRandomVariable [0.0 .. 1.0) m=0.4") );
|
||||
|
||||
Ptr<TriangularRandomVariable> x3 = CreateObject<TriangularRandomVariable> ();
|
||||
x3->SetAttribute ("Min", DoubleValue (0.0));
|
||||
x3->SetAttribute ("Max", DoubleValue (1.0));
|
||||
x3->SetAttribute ("Mean", DoubleValue (0.65));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"TriangularRandomVariable [0.0 .. 1.0) m=0.65") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("GammaRandomVariable");
|
||||
plot.AppendExtra ("set xrange [0:10]");
|
||||
plot.AppendExtra ("set yrange [0:1]");
|
||||
plot.AppendExtra ("GammaDist(x,a,b) = x**(a-1) * 1/b**a * exp(-x/b) / gamma(a)");
|
||||
|
||||
plot.AppendExtra ("set label 1 '{/Symbol g}(x,{/Symbol a},{/Symbol b}) = x^{/Symbol a-1} e^{-x {/Symbol b}^{-1}} ( {/Symbol b}^{/Symbol a} {/Symbol G}({/Symbol a}) )^{-1}' at 0.7, 0.9");
|
||||
|
||||
Ptr<GammaRandomVariable> x1 = CreateObject<GammaRandomVariable> ();
|
||||
x1->SetAttribute ("Alpha", DoubleValue (1.0));
|
||||
x1->SetAttribute ("Beta", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"GammaRandomVariable a=1.0 b=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 1.0, 1.0)",
|
||||
"GammaDist(x, 1.0, 1.0)") );
|
||||
|
||||
Ptr<GammaRandomVariable> x2 = CreateObject<GammaRandomVariable> ();
|
||||
x2->SetAttribute ("Alpha", DoubleValue (1.5));
|
||||
x2->SetAttribute ("Beta", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"GammaRandomVariable a=1.5 b=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 1.5, 1.0)",
|
||||
"GammaDist(x, 1.5, 1.0)") );
|
||||
|
||||
Ptr<GammaRandomVariable> x3 = CreateObject<GammaRandomVariable> ();
|
||||
x3->SetAttribute ("Alpha", DoubleValue (2.0));
|
||||
x3->SetAttribute ("Beta", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"GammaRandomVariable a=2.0 b=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.0, 1.0)",
|
||||
"GammaDist(x, 2.0, 1.0)") );
|
||||
|
||||
Ptr<GammaRandomVariable> x4 = CreateObject<GammaRandomVariable> ();
|
||||
x4->SetAttribute ("Alpha", DoubleValue (4.0));
|
||||
x4->SetAttribute ("Beta", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x4, probes, precision,
|
||||
"GammaRandomVariable a=4.0 b=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 4.0, 1.0)",
|
||||
"GammaDist(x, 4.0, 1.0)") );
|
||||
|
||||
Ptr<GammaRandomVariable> x5 = CreateObject<GammaRandomVariable> ();
|
||||
x5->SetAttribute ("Alpha", DoubleValue (2.0));
|
||||
x5->SetAttribute ("Beta", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x5, probes, precision,
|
||||
"GammaRandomVariable a=2.0 b=2.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.0, 2.0)",
|
||||
"GammaDist(x, 2.0, 2.0)") );
|
||||
|
||||
Ptr<GammaRandomVariable> x6 = CreateObject<GammaRandomVariable> ();
|
||||
x6->SetAttribute ("Alpha", DoubleValue (2.5));
|
||||
x6->SetAttribute ("Beta", DoubleValue (3.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x6, probes, precision,
|
||||
"GammaRandomVariable a=2.5 b=3.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.5, 3.0)",
|
||||
"GammaDist(x, 2.5, 3.0)") );
|
||||
|
||||
Ptr<GammaRandomVariable> x7 = CreateObject<GammaRandomVariable> ();
|
||||
x7->SetAttribute ("Alpha", DoubleValue (2.5));
|
||||
x7->SetAttribute ("Beta", DoubleValue (4.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x7, probes, precision,
|
||||
"GammaRandomVariable a=2.5 b=4.5") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.5, 4.5)",
|
||||
"GammaDist(x, 2.5, 4.5)") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("ErlangRandomVariable");
|
||||
plot.AppendExtra ("set xrange [0:10]");
|
||||
plot.AppendExtra ("ErlangDist(x,k,l) = x**(k-1) * 1/l**k * exp(-x/l) / (k-1)!");
|
||||
|
||||
plot.AppendExtra ("set label 1 'Erlang(x,k,{/Symbol l}) = x^{k-1} e^{-x {/Symbol l}^{-1}} ( {/Symbol l}^k (k-1)! )^{-1}' at 0.7, 0.9");
|
||||
|
||||
Ptr<ErlangRandomVariable> x1 = CreateObject<ErlangRandomVariable> ();
|
||||
x1->SetAttribute ("K", IntegerValue (1));
|
||||
x1->SetAttribute ("Lambda", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"ErlangRandomVariable k=1 {/Symbol l}=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 1, 1.0)",
|
||||
"ErlangDist(x, 1, 1.0)") );
|
||||
|
||||
Ptr<ErlangRandomVariable> x2 = CreateObject<ErlangRandomVariable> ();
|
||||
x2->SetAttribute ("K", IntegerValue (2));
|
||||
x2->SetAttribute ("Lambda", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"ErlangRandomVariable k=2 {/Symbol l}=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 1.0)",
|
||||
"ErlangDist(x, 2, 1.0)") );
|
||||
|
||||
Ptr<ErlangRandomVariable> x3 = CreateObject<ErlangRandomVariable> ();
|
||||
x3->SetAttribute ("K", IntegerValue (3));
|
||||
x3->SetAttribute ("Lambda", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"ErlangRandomVariable k=3 {/Symbol l}=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 3, 1.0)",
|
||||
"ErlangDist(x, 3, 1.0)") );
|
||||
|
||||
Ptr<ErlangRandomVariable> x4 = CreateObject<ErlangRandomVariable> ();
|
||||
x4->SetAttribute ("K", IntegerValue (5));
|
||||
x4->SetAttribute ("Lambda", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x4, probes, precision,
|
||||
"ErlangRandomVariable k=5 {/Symbol l}=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 5, 1.0)",
|
||||
"ErlangDist(x, 5, 1.0)") );
|
||||
|
||||
Ptr<ErlangRandomVariable> x5 = CreateObject<ErlangRandomVariable> ();
|
||||
x5->SetAttribute ("K", IntegerValue (2));
|
||||
x5->SetAttribute ("Lambda", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x5, probes, precision,
|
||||
"ErlangRandomVariable k=2 {/Symbol l}=2.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 2.0)",
|
||||
"ErlangDist(x, 2, 2.0)") );
|
||||
|
||||
Ptr<ErlangRandomVariable> x6 = CreateObject<ErlangRandomVariable> ();
|
||||
x6->SetAttribute ("K", IntegerValue (2));
|
||||
x6->SetAttribute ("Lambda", DoubleValue (3.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x6, probes, precision,
|
||||
"ErlangRandomVariable k=2 {/Symbol l}=3.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 3.0)",
|
||||
"ErlangDist(x, 2, 3.0)") );
|
||||
|
||||
Ptr<ErlangRandomVariable> x7 = CreateObject<ErlangRandomVariable> ();
|
||||
x7->SetAttribute ("K", IntegerValue (2));
|
||||
x7->SetAttribute ("Lambda", DoubleValue (5.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x7, probes, precision,
|
||||
"ErlangRandomVariable k=2 {/Symbol l}=5.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 5.0)",
|
||||
"ErlangDist(x, 2, 5.0)") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
gnuplots.GenerateOutput (std::cout);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -17,11 +17,7 @@
|
||||
*
|
||||
* Author: Timo Bingmann <timo.bingmann@student.kit.edu>
|
||||
*/
|
||||
#include "ns3/random-variable-stream.h"
|
||||
#include "ns3/ptr.h"
|
||||
#include "ns3/double.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/integer.h"
|
||||
#include "ns3/random-variable.h"
|
||||
#include "ns3/gnuplot.h"
|
||||
#include <map>
|
||||
#include <cmath>
|
||||
@@ -42,14 +38,14 @@ double dround (double number, double precision)
|
||||
}
|
||||
|
||||
static GnuplotDataset
|
||||
Histogramm (Ptr<RandomVariableStream> rndvar, unsigned int probes, double precision, const std::string& title, bool notcontinous = false)
|
||||
Histogramm (RandomVariable rndvar, unsigned int probes, double precision, const std::string& title, bool notcontinous = false)
|
||||
{
|
||||
typedef std::map<double, unsigned int> histogramm_maptype;
|
||||
histogramm_maptype histogramm;
|
||||
|
||||
for(unsigned int i = 0; i < probes; ++i)
|
||||
{
|
||||
double val = dround ( rndvar->GetValue (), precision );
|
||||
double val = dround ( rndvar.GetValue (), precision );
|
||||
|
||||
++histogramm[val];
|
||||
}
|
||||
@@ -81,16 +77,13 @@ int main (int argc, char *argv[])
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("UniformRandomVariable");
|
||||
plot.SetTitle ("UniformVariable");
|
||||
plot.AppendExtra ("set yrange [0:]");
|
||||
|
||||
Ptr<UniformRandomVariable> x = CreateObject<UniformRandomVariable> ();
|
||||
x->SetAttribute ("Min", DoubleValue (0.0));
|
||||
x->SetAttribute ("Max", DoubleValue (1.0));
|
||||
plot.AddDataset ( Histogramm (UniformVariable (0.0, 1.0), probes, precision,
|
||||
"UniformVariable [0.0 .. 1.0)") );
|
||||
|
||||
plot.AddDataset ( Histogramm (x, probes, precision,
|
||||
"UniformRandomVariable [0.0 .. 1.0)") );
|
||||
plot.AddDataset ( Gnuplot2dFunction ("1.0",
|
||||
plot.AddDataset ( Gnuplot2dFunction ("0.1",
|
||||
"0 <= x && x <= 1 ? 1.0 : 0") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
@@ -98,33 +91,24 @@ int main (int argc, char *argv[])
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("ExponentialRandomVariable");
|
||||
plot.SetTitle ("ExponentialVariable");
|
||||
plot.AppendExtra ("set xrange [0:8]");
|
||||
plot.AppendExtra ("ExpDist(x,l) = 1/l * exp(-1/l * x)");
|
||||
|
||||
Ptr<ExponentialRandomVariable> x1 = CreateObject<ExponentialRandomVariable> ();
|
||||
x1->SetAttribute ("Mean", DoubleValue (0.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"ExponentialRandomVariable m=0.5") );
|
||||
plot.AddDataset ( Histogramm (ExponentialVariable (0.5), probes, precision,
|
||||
"ExponentialVariable m=0.5") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("ExponentialDistribution mean 0.5",
|
||||
"ExpDist(x, 0.5)") );
|
||||
|
||||
Ptr<ExponentialRandomVariable> x2 = CreateObject<ExponentialRandomVariable> ();
|
||||
x2->SetAttribute ("Mean", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"ExponentialRandomVariable m=1") );
|
||||
plot.AddDataset ( Histogramm (ExponentialVariable (1.0), probes, precision,
|
||||
"ExponentialVariable m=1") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("ExponentialDistribution mean 1.0",
|
||||
"ExpDist(x, 1.0)") );
|
||||
|
||||
Ptr<ExponentialRandomVariable> x3 = CreateObject<ExponentialRandomVariable> ();
|
||||
x3->SetAttribute ("Mean", DoubleValue (1.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"ExponentialRandomVariable m=1.5") );
|
||||
plot.AddDataset ( Histogramm (ExponentialVariable (1.5), probes, precision,
|
||||
"ExponentialVariable m=1.5") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("ExponentialDistribution mean 1.5",
|
||||
"ExpDist(x, 1.5)") );
|
||||
@@ -134,94 +118,58 @@ int main (int argc, char *argv[])
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("ParetoRandomVariable");
|
||||
plot.SetTitle ("ParetoVariable");
|
||||
plot.AppendExtra ("set xrange [0:2]");
|
||||
|
||||
Ptr<ParetoRandomVariable> x1 = CreateObject<ParetoRandomVariable> ();
|
||||
x1->SetAttribute ("Mean", DoubleValue (1.0));
|
||||
x1->SetAttribute ("Shape", DoubleValue (1.5));
|
||||
plot.AddDataset ( Histogramm (ParetoVariable (1.0, 1.5), probes, precision,
|
||||
"ParetoVariable m=1.0 s=1.5") );
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"ParetoRandomVariable m=1.0 s=1.5") );
|
||||
plot.AddDataset ( Histogramm (ParetoVariable (1.0, 2.0), probes, precision,
|
||||
"ParetoVariable m=1.0 s=2.0") );
|
||||
|
||||
Ptr<ParetoRandomVariable> x2 = CreateObject<ParetoRandomVariable> ();
|
||||
x2->SetAttribute ("Mean", DoubleValue (1.0));
|
||||
x2->SetAttribute ("Shape", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"ParetoRandomVariable m=1.0 s=2.0") );
|
||||
|
||||
Ptr<ParetoRandomVariable> x3 = CreateObject<ParetoRandomVariable> ();
|
||||
x3->SetAttribute ("Mean", DoubleValue (1.0));
|
||||
x3->SetAttribute ("Shape", DoubleValue (2.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"ParetoRandomVariable m=1.0 s=2.5") );
|
||||
plot.AddDataset ( Histogramm (ParetoVariable (1.0, 2.5), probes, precision,
|
||||
"ParetoVariable m=1.0 s=2.5") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("WeibullRandomVariable");
|
||||
plot.SetTitle ("WeibullVariable");
|
||||
plot.AppendExtra ("set xrange [0:3]");
|
||||
|
||||
Ptr<WeibullRandomVariable> x1 = CreateObject<WeibullRandomVariable> ();
|
||||
x1->SetAttribute ("Scale", DoubleValue (1.0));
|
||||
x1->SetAttribute ("Shape", DoubleValue (1.0));
|
||||
plot.AddDataset ( Histogramm (WeibullVariable (1.0, 1.0), probes, precision,
|
||||
"WeibullVariable m=1.0 s=1.0") );
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"WeibullRandomVariable m=1.0 s=1.0") );
|
||||
plot.AddDataset ( Histogramm (WeibullVariable (1.0, 2.0), probes, precision,
|
||||
"WeibullVariable m=1.0 s=2.0") );
|
||||
|
||||
Ptr<WeibullRandomVariable> x2 = CreateObject<WeibullRandomVariable> ();
|
||||
x2->SetAttribute ("Scale", DoubleValue (1.0));
|
||||
x2->SetAttribute ("Shape", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"WeibullRandomVariable m=1.0 s=2.0") );
|
||||
|
||||
Ptr<WeibullRandomVariable> x3 = CreateObject<WeibullRandomVariable> ();
|
||||
x3->SetAttribute ("Scale", DoubleValue (1.0));
|
||||
x3->SetAttribute ("Shape", DoubleValue (3.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"WeibullRandomVariable m=1.0 s=3.0") );
|
||||
plot.AddDataset ( Histogramm (WeibullVariable (1.0, 3.0), probes, precision,
|
||||
"WeibullVariable m=1.0 s=3.0") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("NormalRandomVariable");
|
||||
plot.SetTitle ("NormalVariable");
|
||||
plot.AppendExtra ("set xrange [-3:3]");
|
||||
plot.AppendExtra ("NormalDist(x,m,s) = 1 / (s * sqrt(2*pi)) * exp(-1.0 / 2.0 * ((x-m) / s)**2)");
|
||||
|
||||
Ptr<NormalRandomVariable> x1 = CreateObject<NormalRandomVariable> ();
|
||||
x1->SetAttribute ("Mean", DoubleValue (0.0));
|
||||
x1->SetAttribute ("Variance", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"NormalRandomVariable m=0.0 v=1.0") );
|
||||
plot.AddDataset ( Histogramm (NormalVariable (0.0, 1.0), probes, precision,
|
||||
"NormalVariable m=0.0 v=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("NormalDist {/Symbol m}=0.0 {/Symbol s}=1.0",
|
||||
"NormalDist(x,0.0,1.0)") );
|
||||
|
||||
Ptr<NormalRandomVariable> x2 = CreateObject<NormalRandomVariable> ();
|
||||
x2->SetAttribute ("Mean", DoubleValue (0.0));
|
||||
x2->SetAttribute ("Variance", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"NormalRandomVariable m=0.0 v=2.0") );
|
||||
plot.AddDataset ( Histogramm (NormalVariable (0.0, 2.0), probes, precision,
|
||||
"NormalVariable m=0.0 v=2.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("NormalDist {/Symbol m}=0.0 {/Symbol s}=sqrt(2.0)",
|
||||
"NormalDist(x,0.0,sqrt(2.0))") );
|
||||
|
||||
Ptr<NormalRandomVariable> x3 = CreateObject<NormalRandomVariable> ();
|
||||
x3->SetAttribute ("Mean", DoubleValue (0.0));
|
||||
x3->SetAttribute ("Variance", DoubleValue (3.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"NormalRandomVariable m=0.0 v=3.0") );
|
||||
plot.AddDataset ( Histogramm (NormalVariable (0.0, 3.0), probes, precision,
|
||||
"NormalVariable m=0.0 v=3.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("NormalDist {/Symbol m}=0.0 {/Symbol s}=sqrt(3.0)",
|
||||
"NormalDist(x,0.0,sqrt(3.0))") );
|
||||
@@ -231,207 +179,138 @@ int main (int argc, char *argv[])
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("EmpiricalRandomVariable");
|
||||
plot.SetTitle ("EmpiricalVariable");
|
||||
plot.AppendExtra ("set xrange [*:*]");
|
||||
|
||||
Ptr<EmpiricalRandomVariable> emp1 = CreateObject<EmpiricalRandomVariable> ();
|
||||
emp1->CDF (0.0, 0.0 / 15.0);
|
||||
emp1->CDF (0.2, 1.0 / 15.0);
|
||||
emp1->CDF (0.4, 3.0 / 15.0);
|
||||
emp1->CDF (0.6, 6.0 / 15.0);
|
||||
emp1->CDF (0.8, 10.0 / 15.0);
|
||||
emp1->CDF (1.0, 15.0 / 15.0);
|
||||
EmpiricalVariable emp1;
|
||||
emp1.CDF (0.0, 0.0 / 15.0);
|
||||
emp1.CDF (0.2, 1.0 / 15.0);
|
||||
emp1.CDF (0.4, 3.0 / 15.0);
|
||||
emp1.CDF (0.6, 6.0 / 15.0);
|
||||
emp1.CDF (0.8, 10.0 / 15.0);
|
||||
emp1.CDF (1.0, 15.0 / 15.0);
|
||||
|
||||
plot.AddDataset ( Histogramm (emp1, probes, precision,
|
||||
"EmpiricalRandomVariable (Stairs)") );
|
||||
"EmpiricalVariable (Stairs)") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("DeterministicRandomVariable");
|
||||
plot.SetTitle ("DeterministicVariable");
|
||||
plot.AppendExtra ("set xrange [*:*]");
|
||||
|
||||
double values[] = { 0.0, 0.2, 0.2, 0.4, 0.2, 0.6, 0.8, 0.8, 1.0 };
|
||||
|
||||
Ptr<DeterministicRandomVariable> det1 = CreateObject<DeterministicRandomVariable> ();
|
||||
det1->SetValueArray (values, sizeof(values) / sizeof(values[0]));
|
||||
DeterministicVariable det1 (values, sizeof(values) / sizeof(values[0]));
|
||||
|
||||
plot.AddDataset ( Histogramm (det1, probes, precision,
|
||||
"DeterministicRandomVariable", true) );
|
||||
"DeterministicVariable", true) );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("LogNormalRandomVariable");
|
||||
plot.SetTitle ("LogNormalVariable");
|
||||
plot.AppendExtra ("set xrange [0:3]");
|
||||
|
||||
plot.AppendExtra ("LogNormalDist(x,m,s) = 1.0/x * NormalDist(log(x), m, s)");
|
||||
|
||||
Ptr<LogNormalRandomVariable> x1 = CreateObject<LogNormalRandomVariable> ();
|
||||
x1->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x1->SetAttribute ("Sigma", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=1.0") );
|
||||
plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 1.0), probes, precision,
|
||||
"LogNormalVariable m=0.0 s=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("LogNormalDist(x, 0.0, 1.0)",
|
||||
"LogNormalDist(x, 0.0, 1.0)") );
|
||||
|
||||
Ptr<LogNormalRandomVariable> x2 = CreateObject<LogNormalRandomVariable> ();
|
||||
x2->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x2->SetAttribute ("Sigma", DoubleValue (0.5));
|
||||
plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 0.5), probes, precision,
|
||||
"LogNormalVariable m=0.0 s=0.5") );
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=0.5") );
|
||||
|
||||
Ptr<LogNormalRandomVariable> x3 = CreateObject<LogNormalRandomVariable> ();
|
||||
x3->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x3->SetAttribute ("Sigma", DoubleValue (0.25));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=0.25") );
|
||||
plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 0.25), probes, precision,
|
||||
"LogNormalVariable m=0.0 s=0.25") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("LogNormalDist(x, 0.0, 0.25)",
|
||||
"LogNormalDist(x, 0.0, 0.25)") );
|
||||
|
||||
Ptr<LogNormalRandomVariable> x4 = CreateObject<LogNormalRandomVariable> ();
|
||||
x4->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x4->SetAttribute ("Sigma", DoubleValue (0.125));
|
||||
plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 0.125), probes, precision,
|
||||
"LogNormalVariable m=0.0 s=0.125") );
|
||||
|
||||
plot.AddDataset ( Histogramm (x4, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=0.125") );
|
||||
|
||||
Ptr<LogNormalRandomVariable> x5 = CreateObject<LogNormalRandomVariable> ();
|
||||
x5->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x5->SetAttribute ("Sigma", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x5, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=2.0") );
|
||||
plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 2.0), probes, precision,
|
||||
"LogNormalVariable m=0.0 s=2.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("LogNormalDist(x, 0.0, 2.0)",
|
||||
"LogNormalDist(x, 0.0, 2.0)") );
|
||||
|
||||
Ptr<LogNormalRandomVariable> x6 = CreateObject<LogNormalRandomVariable> ();
|
||||
x6->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x6->SetAttribute ("Sigma", DoubleValue (2.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x6, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=2.5") );
|
||||
plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 2.5), probes, precision,
|
||||
"LogNormalVariable m=0.0 s=2.5") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("TriangularRandomVariable");
|
||||
plot.SetTitle ("TriangularVariable");
|
||||
plot.AppendExtra ("set xrange [*:*]");
|
||||
|
||||
Ptr<TriangularRandomVariable> x1 = CreateObject<TriangularRandomVariable> ();
|
||||
x1->SetAttribute ("Min", DoubleValue (0.0));
|
||||
x1->SetAttribute ("Max", DoubleValue (1.0));
|
||||
x1->SetAttribute ("Mean", DoubleValue (0.5));
|
||||
plot.AddDataset ( Histogramm (TriangularVariable (0.0, 1.0, 0.5), probes, precision,
|
||||
"TriangularVariable [0.0 .. 1.0) m=0.5") );
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"TriangularRandomVariable [0.0 .. 1.0) m=0.5") );
|
||||
plot.AddDataset ( Histogramm (TriangularVariable (0.0, 1.0, 0.4), probes, precision,
|
||||
"TriangularVariable [0.0 .. 1.0) m=0.4") );
|
||||
|
||||
Ptr<TriangularRandomVariable> x2 = CreateObject<TriangularRandomVariable> ();
|
||||
x2->SetAttribute ("Min", DoubleValue (0.0));
|
||||
x2->SetAttribute ("Max", DoubleValue (1.0));
|
||||
x2->SetAttribute ("Mean", DoubleValue (0.4));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"TriangularRandomVariable [0.0 .. 1.0) m=0.4") );
|
||||
|
||||
Ptr<TriangularRandomVariable> x3 = CreateObject<TriangularRandomVariable> ();
|
||||
x3->SetAttribute ("Min", DoubleValue (0.0));
|
||||
x3->SetAttribute ("Max", DoubleValue (1.0));
|
||||
x3->SetAttribute ("Mean", DoubleValue (0.65));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"TriangularRandomVariable [0.0 .. 1.0) m=0.65") );
|
||||
plot.AddDataset ( Histogramm (TriangularVariable (0.0, 1.0, 0.65), probes, precision,
|
||||
"TriangularVariable [0.0 .. 1.0) m=0.65") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("GammaRandomVariable");
|
||||
plot.SetTitle ("GammaVariable");
|
||||
plot.AppendExtra ("set xrange [0:10]");
|
||||
plot.AppendExtra ("set yrange [0:1]");
|
||||
plot.AppendExtra ("GammaDist(x,a,b) = x**(a-1) * 1/b**a * exp(-x/b) / gamma(a)");
|
||||
|
||||
plot.AppendExtra ("set label 1 '{/Symbol g}(x,{/Symbol a},{/Symbol b}) = x^{/Symbol a-1} e^{-x {/Symbol b}^{-1}} ( {/Symbol b}^{/Symbol a} {/Symbol G}({/Symbol a}) )^{-1}' at 0.7, 0.9");
|
||||
|
||||
Ptr<GammaRandomVariable> x1 = CreateObject<GammaRandomVariable> ();
|
||||
x1->SetAttribute ("Alpha", DoubleValue (1.0));
|
||||
x1->SetAttribute ("Beta", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"GammaRandomVariable a=1.0 b=1.0") );
|
||||
plot.AddDataset ( Histogramm (GammaVariable (1.0, 1.0), probes, precision,
|
||||
"GammaVariable a=1.0 b=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 1.0, 1.0)",
|
||||
"GammaDist(x, 1.0, 1.0)") );
|
||||
|
||||
Ptr<GammaRandomVariable> x2 = CreateObject<GammaRandomVariable> ();
|
||||
x2->SetAttribute ("Alpha", DoubleValue (1.5));
|
||||
x2->SetAttribute ("Beta", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"GammaRandomVariable a=1.5 b=1.0") );
|
||||
plot.AddDataset ( Histogramm (GammaVariable (1.5, 1.0), probes, precision,
|
||||
"GammaVariable a=1.5 b=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 1.5, 1.0)",
|
||||
"GammaDist(x, 1.5, 1.0)") );
|
||||
|
||||
Ptr<GammaRandomVariable> x3 = CreateObject<GammaRandomVariable> ();
|
||||
x3->SetAttribute ("Alpha", DoubleValue (2.0));
|
||||
x3->SetAttribute ("Beta", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"GammaRandomVariable a=2.0 b=1.0") );
|
||||
plot.AddDataset ( Histogramm (GammaVariable (2.0, 1.0), probes, precision,
|
||||
"GammaVariable a=2.0 b=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.0, 1.0)",
|
||||
"GammaDist(x, 2.0, 1.0)") );
|
||||
|
||||
Ptr<GammaRandomVariable> x4 = CreateObject<GammaRandomVariable> ();
|
||||
x4->SetAttribute ("Alpha", DoubleValue (4.0));
|
||||
x4->SetAttribute ("Beta", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x4, probes, precision,
|
||||
"GammaRandomVariable a=4.0 b=1.0") );
|
||||
plot.AddDataset ( Histogramm (GammaVariable (4.0, 1.0), probes, precision,
|
||||
"GammaVariable a=4.0 b=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 4.0, 1.0)",
|
||||
"GammaDist(x, 4.0, 1.0)") );
|
||||
|
||||
Ptr<GammaRandomVariable> x5 = CreateObject<GammaRandomVariable> ();
|
||||
x5->SetAttribute ("Alpha", DoubleValue (2.0));
|
||||
x5->SetAttribute ("Beta", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x5, probes, precision,
|
||||
"GammaRandomVariable a=2.0 b=2.0") );
|
||||
plot.AddDataset ( Histogramm (GammaVariable (2.0, 2.0), probes, precision,
|
||||
"GammaVariable a=2.0 b=2.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.0, 2.0)",
|
||||
"GammaDist(x, 2.0, 2.0)") );
|
||||
|
||||
Ptr<GammaRandomVariable> x6 = CreateObject<GammaRandomVariable> ();
|
||||
x6->SetAttribute ("Alpha", DoubleValue (2.5));
|
||||
x6->SetAttribute ("Beta", DoubleValue (3.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x6, probes, precision,
|
||||
"GammaRandomVariable a=2.5 b=3.0") );
|
||||
plot.AddDataset ( Histogramm (GammaVariable (2.5, 3.0), probes, precision,
|
||||
"GammaVariable a=2.5 b=3.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.5, 3.0)",
|
||||
"GammaDist(x, 2.5, 3.0)") );
|
||||
|
||||
Ptr<GammaRandomVariable> x7 = CreateObject<GammaRandomVariable> ();
|
||||
x7->SetAttribute ("Alpha", DoubleValue (2.5));
|
||||
x7->SetAttribute ("Beta", DoubleValue (4.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x7, probes, precision,
|
||||
"GammaRandomVariable a=2.5 b=4.5") );
|
||||
plot.AddDataset ( Histogramm (GammaVariable (2.5, 4.5), probes, precision,
|
||||
"GammaVariable a=2.5 b=4.5") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.5, 4.5)",
|
||||
"GammaDist(x, 2.5, 4.5)") );
|
||||
@@ -441,78 +320,50 @@ int main (int argc, char *argv[])
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("ErlangRandomVariable");
|
||||
plot.SetTitle ("ErlangVariable");
|
||||
plot.AppendExtra ("set xrange [0:10]");
|
||||
plot.AppendExtra ("ErlangDist(x,k,l) = x**(k-1) * 1/l**k * exp(-x/l) / (k-1)!");
|
||||
|
||||
plot.AppendExtra ("set label 1 'Erlang(x,k,{/Symbol l}) = x^{k-1} e^{-x {/Symbol l}^{-1}} ( {/Symbol l}^k (k-1)! )^{-1}' at 0.7, 0.9");
|
||||
|
||||
Ptr<ErlangRandomVariable> x1 = CreateObject<ErlangRandomVariable> ();
|
||||
x1->SetAttribute ("K", IntegerValue (1));
|
||||
x1->SetAttribute ("Lambda", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"ErlangRandomVariable k=1 {/Symbol l}=1.0") );
|
||||
plot.AddDataset ( Histogramm (ErlangVariable (1, 1.0), probes, precision,
|
||||
"ErlangVariable k=1 {/Symbol l}=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 1, 1.0)",
|
||||
"ErlangDist(x, 1, 1.0)") );
|
||||
|
||||
Ptr<ErlangRandomVariable> x2 = CreateObject<ErlangRandomVariable> ();
|
||||
x2->SetAttribute ("K", IntegerValue (2));
|
||||
x2->SetAttribute ("Lambda", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"ErlangRandomVariable k=2 {/Symbol l}=1.0") );
|
||||
plot.AddDataset ( Histogramm (ErlangVariable (2, 1.0), probes, precision,
|
||||
"ErlangVariable k=2 {/Symbol l}=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 1.0)",
|
||||
"ErlangDist(x, 2, 1.0)") );
|
||||
|
||||
Ptr<ErlangRandomVariable> x3 = CreateObject<ErlangRandomVariable> ();
|
||||
x3->SetAttribute ("K", IntegerValue (3));
|
||||
x3->SetAttribute ("Lambda", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"ErlangRandomVariable k=3 {/Symbol l}=1.0") );
|
||||
plot.AddDataset ( Histogramm (ErlangVariable (3, 1.0), probes, precision,
|
||||
"ErlangVariable k=3 {/Symbol l}=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 3, 1.0)",
|
||||
"ErlangDist(x, 3, 1.0)") );
|
||||
|
||||
Ptr<ErlangRandomVariable> x4 = CreateObject<ErlangRandomVariable> ();
|
||||
x4->SetAttribute ("K", IntegerValue (5));
|
||||
x4->SetAttribute ("Lambda", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x4, probes, precision,
|
||||
"ErlangRandomVariable k=5 {/Symbol l}=1.0") );
|
||||
plot.AddDataset ( Histogramm (ErlangVariable (5, 1.0), probes, precision,
|
||||
"ErlangVariable k=5 {/Symbol l}=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 5, 1.0)",
|
||||
"ErlangDist(x, 5, 1.0)") );
|
||||
|
||||
Ptr<ErlangRandomVariable> x5 = CreateObject<ErlangRandomVariable> ();
|
||||
x5->SetAttribute ("K", IntegerValue (2));
|
||||
x5->SetAttribute ("Lambda", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x5, probes, precision,
|
||||
"ErlangRandomVariable k=2 {/Symbol l}=2.0") );
|
||||
plot.AddDataset ( Histogramm (ErlangVariable (2, 2.0), probes, precision,
|
||||
"ErlangVariable k=2 {/Symbol l}=2.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 2.0)",
|
||||
"ErlangDist(x, 2, 2.0)") );
|
||||
|
||||
Ptr<ErlangRandomVariable> x6 = CreateObject<ErlangRandomVariable> ();
|
||||
x6->SetAttribute ("K", IntegerValue (2));
|
||||
x6->SetAttribute ("Lambda", DoubleValue (3.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x6, probes, precision,
|
||||
"ErlangRandomVariable k=2 {/Symbol l}=3.0") );
|
||||
plot.AddDataset ( Histogramm (ErlangVariable (2, 3.0), probes, precision,
|
||||
"ErlangVariable k=2 {/Symbol l}=3.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 3.0)",
|
||||
"ErlangDist(x, 2, 3.0)") );
|
||||
|
||||
Ptr<ErlangRandomVariable> x7 = CreateObject<ErlangRandomVariable> ();
|
||||
x7->SetAttribute ("K", IntegerValue (2));
|
||||
x7->SetAttribute ("Lambda", DoubleValue (5.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x7, probes, precision,
|
||||
"ErlangRandomVariable k=2 {/Symbol l}=5.0") );
|
||||
plot.AddDataset ( Histogramm (ErlangVariable (2, 5.0), probes, precision,
|
||||
"ErlangVariable k=2 {/Symbol l}=5.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 5.0)",
|
||||
"ErlangDist(x, 2, 5.0)") );
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of Washington
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/command-line.h"
|
||||
#include "ns3/random-variable-stream.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace ns3;
|
||||
using namespace std;
|
||||
|
||||
/*
|
||||
* This program can be run from waf such as "./waf --run sample-random-variable-stream"
|
||||
*
|
||||
* This program is about as simple as possible to display the use of ns-3
|
||||
* to generate random numbers. By default, the uniform random variate that
|
||||
* will be outputted is 0.816532. Because ns-3 uses a fixed seed for the
|
||||
* pseudo-random number generator, this program should always output the
|
||||
* same number. Likewise, ns-3 simulations using random variables will
|
||||
* behave deterministically unless the user changes the RunNumber or the
|
||||
* Seed.
|
||||
*
|
||||
* There are three primary mechanisms to change the seed or run numbers
|
||||
* from their default integer value of 1
|
||||
* 1) Through explicit call of SeedManager::SetSeed () and
|
||||
* SeedManager::SetRun () (commented out below)
|
||||
* 2) Through the passing of command line arguments such as:
|
||||
* "./waf --command-template="%s --RngRun=<value>" --run program-name"
|
||||
* 3) Through the use of the NS_GLOBAL_VALUE environment variable, such as:
|
||||
* "NS_GLOBAL_VALUE="RngRun=<value>" ./waf --run program-name"
|
||||
*
|
||||
* For instance, setting the run number to 3 will change the program output to
|
||||
* 0.775417
|
||||
*
|
||||
* Consult the ns-3 manual for more information about the use of the
|
||||
* random number generator
|
||||
*/
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
CommandLine cmd;
|
||||
cmd.Parse (argc, argv);
|
||||
|
||||
// SeedManager::SetRun (3);
|
||||
|
||||
Ptr<UniformRandomVariable> uv = CreateObject<UniformRandomVariable> ();
|
||||
|
||||
cout << uv->GetValue () << endl;
|
||||
|
||||
}
|
||||
@@ -18,17 +18,10 @@ def build(bld):
|
||||
obj = bld.create_ns3_program('main-random-variable', ['core', 'config-store', 'tools'])
|
||||
obj.source = 'main-random-variable.cc'
|
||||
|
||||
obj = bld.create_ns3_program('main-random-variable-stream', ['core', 'config-store', 'tools'])
|
||||
obj.source = 'main-random-variable-stream.cc'
|
||||
|
||||
obj = bld.create_ns3_program('sample-random-variable',
|
||||
['core'])
|
||||
obj.source = 'sample-random-variable.cc'
|
||||
|
||||
obj = bld.create_ns3_program('sample-random-variable-stream',
|
||||
['core'])
|
||||
obj.source = 'sample-random-variable-stream.cc'
|
||||
|
||||
if bld.env['ENABLE_THREADING'] and bld.env["ENABLE_REAL_TIME"]:
|
||||
obj = bld.create_ns3_program('main-test-sync', ['network'])
|
||||
obj.source = 'main-test-sync.cc'
|
||||
|
||||
+39
-49
@@ -376,62 +376,52 @@ Resolver::DoResolve (std::string path, Ptr<Object> root)
|
||||
else
|
||||
{
|
||||
// this is a normal attribute.
|
||||
TypeId tid;
|
||||
TypeId nextTid = root->GetInstanceTypeId ();
|
||||
TypeId tid = root->GetInstanceTypeId ();
|
||||
bool foundMatch = false;
|
||||
|
||||
do
|
||||
for (uint32_t i = 0; i < tid.GetAttributeN(); i++)
|
||||
{
|
||||
tid = nextTid;
|
||||
|
||||
for (uint32_t i = 0; i < tid.GetAttributeN(); i++)
|
||||
struct TypeId::AttributeInformation info;
|
||||
info = tid.GetAttribute(i);
|
||||
if (info.name != item && item != "*")
|
||||
{
|
||||
struct TypeId::AttributeInformation info;
|
||||
info = tid.GetAttribute(i);
|
||||
if (info.name != item && item != "*")
|
||||
continue;
|
||||
}
|
||||
// attempt to cast to a pointer checker.
|
||||
const PointerChecker *ptr = dynamic_cast<const PointerChecker *> (PeekPointer (info.checker));
|
||||
if (ptr != 0)
|
||||
{
|
||||
NS_LOG_DEBUG ("GetAttribute(ptr)="<<info.name<<" on path="<<GetResolvedPath ());
|
||||
PointerValue ptr;
|
||||
root->GetAttribute (info.name, ptr);
|
||||
Ptr<Object> object = ptr.Get<Object> ();
|
||||
if (object == 0)
|
||||
{
|
||||
NS_LOG_ERROR ("Requested object name=\""<<item<<
|
||||
"\" exists on path=\""<<GetResolvedPath ()<<"\""
|
||||
" but is null.");
|
||||
continue;
|
||||
}
|
||||
// attempt to cast to a pointer checker.
|
||||
const PointerChecker *ptr = dynamic_cast<const PointerChecker *> (PeekPointer (info.checker));
|
||||
if (ptr != 0)
|
||||
{
|
||||
NS_LOG_DEBUG ("GetAttribute(ptr)="<<info.name<<" on path="<<GetResolvedPath ());
|
||||
PointerValue ptr;
|
||||
root->GetAttribute (info.name, ptr);
|
||||
Ptr<Object> object = ptr.Get<Object> ();
|
||||
if (object == 0)
|
||||
{
|
||||
NS_LOG_ERROR ("Requested object name=\""<<item<<
|
||||
"\" exists on path=\""<<GetResolvedPath ()<<"\""
|
||||
" but is null.");
|
||||
continue;
|
||||
}
|
||||
foundMatch = true;
|
||||
m_workStack.push_back (info.name);
|
||||
DoResolve (pathLeft, object);
|
||||
m_workStack.pop_back ();
|
||||
}
|
||||
// attempt to cast to an object vector.
|
||||
const ObjectPtrContainerChecker *vectorChecker =
|
||||
dynamic_cast<const ObjectPtrContainerChecker *> (PeekPointer (info.checker));
|
||||
if (vectorChecker != 0)
|
||||
{
|
||||
NS_LOG_DEBUG ("GetAttribute(vector)="<<info.name<<" on path="<<GetResolvedPath () << pathLeft);
|
||||
foundMatch = true;
|
||||
ObjectPtrContainerValue vector;
|
||||
root->GetAttribute (info.name, vector);
|
||||
m_workStack.push_back (info.name);
|
||||
DoArrayResolve (pathLeft, vector);
|
||||
m_workStack.pop_back ();
|
||||
}
|
||||
// this could be anything else and we don't know what to do with it.
|
||||
// So, we just ignore it.
|
||||
foundMatch = true;
|
||||
m_workStack.push_back (info.name);
|
||||
DoResolve (pathLeft, object);
|
||||
m_workStack.pop_back ();
|
||||
}
|
||||
|
||||
nextTid = tid.GetParent ();
|
||||
} while (nextTid != tid);
|
||||
|
||||
// attempt to cast to an object vector.
|
||||
const ObjectPtrContainerChecker *vectorChecker =
|
||||
dynamic_cast<const ObjectPtrContainerChecker *> (PeekPointer (info.checker));
|
||||
if (vectorChecker != 0)
|
||||
{
|
||||
NS_LOG_DEBUG ("GetAttribute(vector)="<<info.name<<" on path="<<GetResolvedPath () << pathLeft);
|
||||
foundMatch = true;
|
||||
ObjectPtrContainerValue vector;
|
||||
root->GetAttribute (info.name, vector);
|
||||
m_workStack.push_back (info.name);
|
||||
DoArrayResolve (pathLeft, vector);
|
||||
m_workStack.pop_back ();
|
||||
}
|
||||
// this could be anything else and we don't know what to do with it.
|
||||
// So, we just ignore it.
|
||||
}
|
||||
if (!foundMatch)
|
||||
{
|
||||
NS_LOG_DEBUG ("Requested item="<<item<<" does not exist on path="<<GetResolvedPath ());
|
||||
|
||||
@@ -62,9 +62,7 @@ EventImpl * MakeEvent (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5
|
||||
namespace ns3 {
|
||||
|
||||
template <typename T>
|
||||
struct EventMemberImplObjTraits
|
||||
{
|
||||
};
|
||||
struct EventMemberImplObjTraits;
|
||||
|
||||
template <typename T>
|
||||
struct EventMemberImplObjTraits<T *>
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of Washington
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "random-variable-stream.h"
|
||||
#include "random-variable-stream-helper.h"
|
||||
#include "config.h"
|
||||
#include "pointer.h"
|
||||
#include "log.h"
|
||||
#include "assert.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("RandomVariableStreamHelper");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
int64_t RandomVariableStreamHelper::AssignStreams (std::string path, int64_t stream)
|
||||
{
|
||||
NS_ASSERT (stream >= 0);
|
||||
Config::MatchContainer mc = Config::LookupMatches (path);
|
||||
int64_t i = 0;
|
||||
for (Config::MatchContainer::Iterator mci = mc.Begin (); mci != mc.End (); ++mci, ++i)
|
||||
{
|
||||
PointerValue ptr = mc.Get (i);
|
||||
Ptr<RandomVariableStream> rvs = ptr.Get<RandomVariableStream> ();
|
||||
NS_LOG_DEBUG ("RandomVariableStream found: " << rvs << "; setting stream to " << (stream + i));
|
||||
rvs->SetStream (stream + i);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
@@ -1,65 +0,0 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of Washington
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef RANDOM_VARIABLE_STREAM_HELPER_H
|
||||
#define RANDOM_VARIABLE_STREAM_HELPER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \brief Helper class for static methods involving RandomVariableStream
|
||||
*/
|
||||
class RandomVariableStreamHelper
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* This helper method can be used to configure the stream number for
|
||||
* one or more RNG streams. The path passed in should correspond to
|
||||
* an attribute path in the configuration system. It may contain wildcards
|
||||
* and may ultimately match zero, one, or more than one objects.
|
||||
*
|
||||
* The objects to match are of type PointerValue where the underlying
|
||||
* type is of type Ptr<RandomVariableStream>.
|
||||
*
|
||||
* \code
|
||||
* .AddAttribute ("Speed",
|
||||
* "A random variable used to pick the speed of a random waypoint model.",
|
||||
* StringValue("ns3::UniformRandomVariable[Min=0.3|Max=0.7]"),
|
||||
* MakePointerAccessor (&RandomWaypointMobilityModel::m_speed),
|
||||
* MakePointerChecker<RandomVariableStream> ())
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* Usage would look (for node 3) like this:
|
||||
* \code
|
||||
* std::string path ("/$ns3::NodeListPriv/NodeList/3/$ns3::Node/$ns3::RandomWaypointMobilityModel/Speed/$ns3::UniformRandomVariable");
|
||||
* int64_t retVal = RandomVariableStreamHelper::AssignStreams (path, 0);
|
||||
* \endcode
|
||||
*
|
||||
* \return The number of streams set
|
||||
* \param path (possibly wildcarded) path to a RandomVariableStream PointerValue
|
||||
* \param stream stream number to set; must be non-negative
|
||||
*/
|
||||
static int64_t AssignStreams (std::string path, int64_t stream);
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* RANDOM_VARIABLE_STREAM_HELPER_H */
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -33,8 +33,9 @@
|
||||
#include <vector>
|
||||
|
||||
#include "assert.h"
|
||||
#include "config.h"
|
||||
#include "integer.h"
|
||||
#include "random-variable.h"
|
||||
#include "rng-seed-manager.h"
|
||||
#include "rng-stream.h"
|
||||
#include "fatal-error.h"
|
||||
|
||||
@@ -42,6 +43,44 @@ using namespace std;
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Seed Manager
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
uint32_t SeedManager::GetSeed ()
|
||||
{
|
||||
uint32_t s[6];
|
||||
RngStream::GetPackageSeed (s);
|
||||
NS_ASSERT (
|
||||
s[0] == s[1]
|
||||
&& s[0] == s[2]
|
||||
&& s[0] == s[3]
|
||||
&& s[0] == s[4]
|
||||
&& s[0] == s[5]
|
||||
);
|
||||
return s[0];
|
||||
}
|
||||
|
||||
void SeedManager::SetSeed (uint32_t seed)
|
||||
{
|
||||
Config::SetGlobal ("RngSeed", IntegerValue (seed));
|
||||
}
|
||||
|
||||
void SeedManager::SetRun (uint32_t run)
|
||||
{
|
||||
Config::SetGlobal ("RngRun", IntegerValue (run));
|
||||
}
|
||||
|
||||
uint32_t SeedManager::GetRun ()
|
||||
{
|
||||
return RngStream::GetPackageRun ();
|
||||
}
|
||||
|
||||
bool SeedManager::CheckSeed (uint32_t seed)
|
||||
{
|
||||
return RngStream::CheckSeed (seed);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
// RandomVariableBase methods
|
||||
@@ -56,24 +95,22 @@ public:
|
||||
virtual double GetValue () = 0;
|
||||
virtual uint32_t GetInteger ();
|
||||
virtual RandomVariableBase* Copy (void) const = 0;
|
||||
RngStream *GetStream(void);
|
||||
private:
|
||||
|
||||
protected:
|
||||
RngStream* m_generator; // underlying generator being wrapped
|
||||
};
|
||||
|
||||
RandomVariableBase::RandomVariableBase ()
|
||||
: m_generator (0)
|
||||
: m_generator (NULL)
|
||||
{
|
||||
}
|
||||
|
||||
RandomVariableBase::RandomVariableBase (const RandomVariableBase& r)
|
||||
: m_generator (0)
|
||||
{
|
||||
if (r.m_generator != 0)
|
||||
if (r.m_generator)
|
||||
{
|
||||
m_generator = new RngStream (RngSeedManager::GetSeed (),
|
||||
RngSeedManager::GetNextStreamIndex (),
|
||||
RngSeedManager::GetRun ());
|
||||
m_generator = new RngStream (*r.m_generator);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,18 +124,6 @@ uint32_t RandomVariableBase::GetInteger ()
|
||||
return (uint32_t)GetValue ();
|
||||
}
|
||||
|
||||
RngStream *
|
||||
RandomVariableBase::GetStream (void)
|
||||
{
|
||||
if (m_generator == 0)
|
||||
{
|
||||
m_generator = new RngStream (RngSeedManager::GetSeed (),
|
||||
RngSeedManager::GetNextStreamIndex (),
|
||||
RngSeedManager::GetRun ());
|
||||
}
|
||||
return m_generator;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
|
||||
RandomVariable::RandomVariable ()
|
||||
@@ -225,14 +250,20 @@ UniformVariableImpl::GetMax (void) const
|
||||
|
||||
double UniformVariableImpl::GetValue ()
|
||||
{
|
||||
RngStream *generator = GetStream ();
|
||||
return m_min + generator->RandU01 () * (m_max - m_min);
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
return m_min + m_generator->RandU01 () * (m_max - m_min);
|
||||
}
|
||||
|
||||
double UniformVariableImpl::GetValue (double s, double l)
|
||||
{
|
||||
RngStream *generator = GetStream ();
|
||||
return s + generator->RandU01 () * (l - s);
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
return s + m_generator->RandU01 () * (l - s);
|
||||
}
|
||||
|
||||
RandomVariableBase* UniformVariableImpl::Copy () const
|
||||
@@ -542,10 +573,13 @@ ExponentialVariableImpl::ExponentialVariableImpl (const ExponentialVariableImpl&
|
||||
|
||||
double ExponentialVariableImpl::GetValue ()
|
||||
{
|
||||
RngStream *generator = GetStream ();
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
while (1)
|
||||
{
|
||||
double r = -m_mean*log (generator->RandU01 ());
|
||||
double r = -m_mean*log (m_generator->RandU01 ());
|
||||
if (m_bound == 0 || r <= m_bound)
|
||||
{
|
||||
return r;
|
||||
@@ -703,10 +737,13 @@ ParetoVariableImpl::ParetoVariableImpl (const ParetoVariableImpl& c)
|
||||
|
||||
double ParetoVariableImpl::GetValue ()
|
||||
{
|
||||
RngStream *generator = GetStream ();
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
while (1)
|
||||
{
|
||||
double r = (m_scale * ( 1.0 / pow (generator->RandU01 (), 1.0 / m_shape)));
|
||||
double r = (m_scale * ( 1.0 / pow (m_generator->RandU01 (), 1.0 / m_shape)));
|
||||
if (m_bound == 0 || r <= m_bound)
|
||||
{
|
||||
return r;
|
||||
@@ -834,11 +871,14 @@ WeibullVariableImpl::WeibullVariableImpl (const WeibullVariableImpl& c)
|
||||
|
||||
double WeibullVariableImpl::GetValue ()
|
||||
{
|
||||
RngStream *generator = GetStream ();
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
double exponent = 1.0 / m_alpha;
|
||||
while (1)
|
||||
{
|
||||
double r = m_mean * pow ( -log (generator->RandU01 ()), exponent);
|
||||
double r = m_mean * pow ( -log (m_generator->RandU01 ()), exponent);
|
||||
if (m_bound == 0 || r <= m_bound)
|
||||
{
|
||||
return r;
|
||||
@@ -941,7 +981,10 @@ NormalVariableImpl::NormalVariableImpl (const NormalVariableImpl& c)
|
||||
|
||||
double NormalVariableImpl::GetValue ()
|
||||
{
|
||||
RngStream *generator = GetStream ();
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
if (m_nextValid)
|
||||
{ // use previously generated
|
||||
m_nextValid = false;
|
||||
@@ -951,8 +994,8 @@ double NormalVariableImpl::GetValue ()
|
||||
{ // See Simulation Modeling and Analysis p. 466 (Averill Law)
|
||||
// for algorithm; basically a Box-Muller transform:
|
||||
// http://en.wikipedia.org/wiki/Box-Muller_transform
|
||||
double u1 = generator->RandU01 ();
|
||||
double u2 = generator->RandU01 ();
|
||||
double u1 = m_generator->RandU01 ();
|
||||
double u2 = m_generator->RandU01 ();
|
||||
double v1 = 2 * u1 - 1;
|
||||
double v2 = 2 * u2 - 1;
|
||||
double w = v1 * v1 + v2 * v2;
|
||||
@@ -1095,7 +1138,10 @@ EmpiricalVariableImpl::~EmpiricalVariableImpl ()
|
||||
double EmpiricalVariableImpl::GetValue ()
|
||||
{ // Return a value from the empirical distribution
|
||||
// This code based (loosely) on code by Bruce Mah (Thanks Bruce!)
|
||||
RngStream *generator = GetStream ();
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
if (emp.size () == 0)
|
||||
{
|
||||
return 0.0; // HuH? No empirical data
|
||||
@@ -1104,7 +1150,7 @@ double EmpiricalVariableImpl::GetValue ()
|
||||
{
|
||||
Validate (); // Insure in non-decreasing
|
||||
}
|
||||
double r = generator->RandU01 ();
|
||||
double r = m_generator->RandU01 ();
|
||||
if (r <= emp.front ().cdf)
|
||||
{
|
||||
return emp.front ().value; // Less than first
|
||||
@@ -1360,15 +1406,18 @@ LogNormalVariableImpl::LogNormalVariableImpl (double mu, double sigma)
|
||||
double
|
||||
LogNormalVariableImpl::GetValue ()
|
||||
{
|
||||
RngStream *generator = GetStream ();
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
double u, v, r2, normal, z;
|
||||
|
||||
do
|
||||
{
|
||||
/* choose x,y in uniform square (-1,-1) to (+1,+1) */
|
||||
|
||||
u = -1 + 2 * generator->RandU01 ();
|
||||
v = -1 + 2 * generator->RandU01 ();
|
||||
u = -1 + 2 * m_generator->RandU01 ();
|
||||
v = -1 + 2 * m_generator->RandU01 ();
|
||||
|
||||
/* see if it is in the unit circle */
|
||||
r2 = u * u + v * v;
|
||||
@@ -1455,11 +1504,14 @@ GammaVariableImpl::GetValue ()
|
||||
double
|
||||
GammaVariableImpl::GetValue (double alpha, double beta)
|
||||
{
|
||||
RngStream *generator = GetStream ();
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
|
||||
if (alpha < 1)
|
||||
{
|
||||
double u = generator->RandU01 ();
|
||||
double u = m_generator->RandU01 ();
|
||||
return GetValue (1.0 + alpha, beta) * pow (u, 1.0 / alpha);
|
||||
}
|
||||
|
||||
@@ -1477,7 +1529,7 @@ GammaVariableImpl::GetValue (double alpha, double beta)
|
||||
while (v <= 0);
|
||||
|
||||
v = v * v * v;
|
||||
u = generator->RandU01 ();
|
||||
u = m_generator->RandU01 ();
|
||||
if (u < 1 - 0.0331 * x * x * x * x)
|
||||
{
|
||||
break;
|
||||
@@ -1575,8 +1627,11 @@ ErlangVariableImpl::GetValue ()
|
||||
double
|
||||
ErlangVariableImpl::GetValue (unsigned int k, double lambda)
|
||||
{
|
||||
// XXX: Fixme: do not create a new
|
||||
// RNG stream every time the function is called !
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
|
||||
ExponentialVariable exponential (lambda);
|
||||
|
||||
double result = 0;
|
||||
@@ -1668,8 +1723,11 @@ TriangularVariableImpl::TriangularVariableImpl (const TriangularVariableImpl& c)
|
||||
|
||||
double TriangularVariableImpl::GetValue ()
|
||||
{
|
||||
RngStream *generator = GetStream ();
|
||||
double u = generator->RandU01 ();
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
double u = m_generator->RandU01 ();
|
||||
if (u <= (m_mode - m_min) / (m_max - m_min) )
|
||||
{
|
||||
return m_min + sqrt (u * (m_max - m_min) * (m_mode - m_min) );
|
||||
@@ -1753,9 +1811,12 @@ ZipfVariableImpl::ZipfVariableImpl (long n, double alpha)
|
||||
double
|
||||
ZipfVariableImpl::GetValue ()
|
||||
{
|
||||
RngStream *generator = GetStream ();
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
|
||||
double u = generator->RandU01 ();
|
||||
double u = m_generator->RandU01 ();
|
||||
double sum_prob = 0,zipf_value = 0;
|
||||
for (int i = 1; i <= m_n; i++)
|
||||
{
|
||||
@@ -1834,7 +1895,10 @@ ZetaVariableImpl::ZetaVariableImpl (double alpha)
|
||||
double
|
||||
ZetaVariableImpl::GetValue ()
|
||||
{
|
||||
RngStream *generator = GetStream ();
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
|
||||
double u, v;
|
||||
double X, T;
|
||||
@@ -1842,8 +1906,8 @@ ZetaVariableImpl::GetValue ()
|
||||
|
||||
do
|
||||
{
|
||||
u = generator->RandU01 ();
|
||||
v = generator->RandU01 ();
|
||||
u = m_generator->RandU01 ();
|
||||
v = m_generator->RandU01 ();
|
||||
X = floor (pow (u, -1.0 / (m_alpha - 1.0)));
|
||||
T = pow (1.0 + 1.0 / X, m_alpha - 1.0);
|
||||
test = v * X * (T - 1.0) / (m_b - 1.0);
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <ostream>
|
||||
#include "attribute.h"
|
||||
#include "attribute-helper.h"
|
||||
#include "rng-seed-manager.h"
|
||||
|
||||
/**
|
||||
* \ingroup core
|
||||
@@ -41,6 +40,69 @@ namespace ns3 {
|
||||
|
||||
class RandomVariableBase;
|
||||
|
||||
class SeedManager
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief set the seed
|
||||
* it will duplicate the seed value 6 times
|
||||
* \code
|
||||
* SeedManger::SetSeed(15);
|
||||
* UniformVariable x(2,3); //these will give the same output everytime
|
||||
* ExponentialVariable y(120); //as long as the seed stays the same
|
||||
* \endcode
|
||||
* \param seed
|
||||
*
|
||||
* Note, while the underlying RNG takes six integer values as a seed;
|
||||
* it is sufficient to set these all to the same integer, so we provide
|
||||
* a simpler interface here that just takes one integer.
|
||||
*/
|
||||
static void SetSeed (uint32_t seed);
|
||||
|
||||
/**
|
||||
* \brief Get the seed value
|
||||
* \return the seed value
|
||||
*
|
||||
* Note: returns the first of the six seed values used in the underlying RNG
|
||||
*/
|
||||
static uint32_t GetSeed ();
|
||||
|
||||
/**
|
||||
* \brief Set the run number of simulation
|
||||
*
|
||||
* \code
|
||||
* SeedManager::SetSeed(12);
|
||||
* int N = atol(argv[1]); //read in run number from command line
|
||||
* SeedManager::SetRun(N);
|
||||
* UniformVariable x(0,10);
|
||||
* ExponentialVariable y(2902);
|
||||
* \endcode
|
||||
* In this example, N could successivly be equal to 1,2,3, etc. and the user
|
||||
* would continue to get independent runs out of the single simulation. For
|
||||
* this simple example, the following might work:
|
||||
* \code
|
||||
* ./simulation 0
|
||||
* ...Results for run 0:...
|
||||
*
|
||||
* ./simulation 1
|
||||
* ...Results for run 1:...
|
||||
* \endcode
|
||||
*/
|
||||
static void SetRun (uint32_t run);
|
||||
/**
|
||||
* \returns the current run number
|
||||
* @sa SetRun
|
||||
*/
|
||||
static uint32_t GetRun (void);
|
||||
|
||||
/**
|
||||
* \brief Check if seed value is valid if wanted to be used as seed
|
||||
* \return true if valid and false if invalid
|
||||
*/
|
||||
static bool CheckSeed (uint32_t seed);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief The basic RNG for NS-3.
|
||||
* \ingroup randomvariable
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
#include "rng-seed-manager.h"
|
||||
#include "global-value.h"
|
||||
#include "attribute-helper.h"
|
||||
#include "integer.h"
|
||||
#include "config.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
static uint64_t g_nextStreamIndex = 0;
|
||||
static ns3::GlobalValue g_rngSeed ("RngSeed",
|
||||
"The global seed of all rng streams",
|
||||
ns3::IntegerValue(1),
|
||||
ns3::MakeIntegerChecker<uint32_t> ());
|
||||
static ns3::GlobalValue g_rngRun ("RngRun",
|
||||
"The run number used to modify the global seed",
|
||||
ns3::IntegerValue (1),
|
||||
ns3::MakeIntegerChecker<int64_t> ());
|
||||
|
||||
|
||||
uint32_t RngSeedManager::GetSeed (void)
|
||||
{
|
||||
IntegerValue seedValue;
|
||||
g_rngSeed.GetValue (seedValue);
|
||||
return seedValue.Get ();
|
||||
}
|
||||
void
|
||||
RngSeedManager::SetSeed (uint32_t seed)
|
||||
{
|
||||
Config::SetGlobal ("RngSeed", IntegerValue(seed));
|
||||
}
|
||||
|
||||
void RngSeedManager::SetRun (uint64_t run)
|
||||
{
|
||||
Config::SetGlobal ("RngRun", IntegerValue (run));
|
||||
}
|
||||
|
||||
uint64_t RngSeedManager::GetRun ()
|
||||
{
|
||||
IntegerValue value;
|
||||
g_rngRun.GetValue (value);
|
||||
int run = value.Get();
|
||||
return run;
|
||||
}
|
||||
|
||||
uint64_t RngSeedManager::GetNextStreamIndex (void)
|
||||
{
|
||||
uint64_t next = g_nextStreamIndex;
|
||||
g_nextStreamIndex++;
|
||||
return next;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
@@ -1,73 +0,0 @@
|
||||
#ifndef RNG_SEED_MANAGER_H
|
||||
#define RNG_SEED_MANAGER_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class RngSeedManager
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief set the seed
|
||||
* it will duplicate the seed value 6 times
|
||||
* \code
|
||||
* SeedManger::SetSeed(15);
|
||||
* UniformVariable x(2,3); //these will give the same output everytime
|
||||
* ExponentialVariable y(120); //as long as the seed stays the same
|
||||
* \endcode
|
||||
* \param seed
|
||||
*
|
||||
* Note, while the underlying RNG takes six integer values as a seed;
|
||||
* it is sufficient to set these all to the same integer, so we provide
|
||||
* a simpler interface here that just takes one integer.
|
||||
*/
|
||||
static void SetSeed (uint32_t seed);
|
||||
|
||||
/**
|
||||
* \brief Get the seed value
|
||||
* \return the seed value
|
||||
*
|
||||
* Note: returns the first of the six seed values used in the underlying RNG
|
||||
*/
|
||||
static uint32_t GetSeed (void);
|
||||
|
||||
/**
|
||||
* \brief Set the run number of simulation
|
||||
*
|
||||
* \code
|
||||
* SeedManager::SetSeed(12);
|
||||
* int N = atol(argv[1]); //read in run number from command line
|
||||
* SeedManager::SetRun(N);
|
||||
* UniformVariable x(0,10);
|
||||
* ExponentialVariable y(2902);
|
||||
* \endcode
|
||||
* In this example, N could successivly be equal to 1,2,3, etc. and the user
|
||||
* would continue to get independent runs out of the single simulation. For
|
||||
* this simple example, the following might work:
|
||||
* \code
|
||||
* ./simulation 0
|
||||
* ...Results for run 0:...
|
||||
*
|
||||
* ./simulation 1
|
||||
* ...Results for run 1:...
|
||||
* \endcode
|
||||
*/
|
||||
static void SetRun (uint64_t run);
|
||||
/**
|
||||
* \returns the current run number
|
||||
* @sa SetRun
|
||||
*/
|
||||
static uint64_t GetRun (void);
|
||||
|
||||
static uint64_t GetNextStreamIndex(void);
|
||||
|
||||
};
|
||||
|
||||
// for compatibility
|
||||
typedef RngSeedManager SeedManager;
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
|
||||
#endif /* RNG_SEED_MANAGER_H */
|
||||
+387
-144
@@ -15,20 +15,18 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// Modified for ns-3 by:
|
||||
// - Rajib Bhattacharjea<raj.b@gatech.edu>
|
||||
// - Mathieu Lacage <mathieu.lacage@gmail.com>
|
||||
// Modified for ns-3 by: Rajib Bhattacharjea<raj.b@gatech.edu>
|
||||
//
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include "rng-stream.h"
|
||||
#include "fatal-error.h"
|
||||
#include "global-value.h"
|
||||
#include "integer.h"
|
||||
using namespace std;
|
||||
|
||||
namespace
|
||||
{
|
||||
typedef double Matrix[3][3];
|
||||
|
||||
const double m1 = 4294967087.0;
|
||||
const double m2 = 4294944443.0;
|
||||
const double norm = 1.0 / (m1 + 1.0);
|
||||
@@ -40,30 +38,58 @@ const double two17 = 131072.0;
|
||||
const double two53 = 9007199254740992.0;
|
||||
const double fact = 5.9604644775390625e-8; /* 1 / 2^24 */
|
||||
|
||||
const Matrix InvA1 = { // Inverse of A1p0
|
||||
// The following are the transition matrices of the two MRG components
|
||||
// (in matrix form), raised to the powers -1, 1, 2^76, and 2^127, resp.
|
||||
|
||||
const double InvA1[3][3] = { // Inverse of A1p0
|
||||
{ 184888585.0, 0.0, 1945170933.0 },
|
||||
{ 1.0, 0.0, 0.0 },
|
||||
{ 0.0, 1.0, 0.0 }
|
||||
};
|
||||
|
||||
const Matrix InvA2 = { // Inverse of A2p0
|
||||
const double InvA2[3][3] = { // Inverse of A2p0
|
||||
{ 0.0, 360363334.0, 4225571728.0 },
|
||||
{ 1.0, 0.0, 0.0 },
|
||||
{ 0.0, 1.0, 0.0 }
|
||||
};
|
||||
|
||||
const Matrix A1p0 = {
|
||||
const double A1p0[3][3] = {
|
||||
{ 0.0, 1.0, 0.0 },
|
||||
{ 0.0, 0.0, 1.0 },
|
||||
{ -810728.0, 1403580.0, 0.0 }
|
||||
};
|
||||
|
||||
const Matrix A2p0 = {
|
||||
const double A2p0[3][3] = {
|
||||
{ 0.0, 1.0, 0.0 },
|
||||
{ 0.0, 0.0, 1.0 },
|
||||
{ -1370589.0, 0.0, 527612.0 }
|
||||
};
|
||||
|
||||
const double A1p76[3][3] = {
|
||||
{ 82758667.0, 1871391091.0, 4127413238.0 },
|
||||
{ 3672831523.0, 69195019.0, 1871391091.0 },
|
||||
{ 3672091415.0, 3528743235.0, 69195019.0 }
|
||||
};
|
||||
|
||||
const double A2p76[3][3] = {
|
||||
{ 1511326704.0, 3759209742.0, 1610795712.0 },
|
||||
{ 4292754251.0, 1511326704.0, 3889917532.0 },
|
||||
{ 3859662829.0, 4292754251.0, 3708466080.0 }
|
||||
};
|
||||
|
||||
const double A1p127[3][3] = {
|
||||
{ 2427906178.0, 3580155704.0, 949770784.0 },
|
||||
{ 226153695.0, 1230515664.0, 3580155704.0 },
|
||||
{ 1988835001.0, 986791581.0, 1230515664.0 }
|
||||
};
|
||||
|
||||
const double A2p127[3][3] = {
|
||||
{ 1464411153.0, 277697599.0, 1610723613.0 },
|
||||
{ 32183930.0, 1464411153.0, 1022607788.0 },
|
||||
{ 2824425944.0, 32183930.0, 2093834863.0 }
|
||||
};
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Return (a*s + c) MOD m; a, s, c and m must be < 2^35
|
||||
@@ -75,26 +101,16 @@ double MultModM (double a, double s, double c, double m)
|
||||
|
||||
v = a * s + c;
|
||||
|
||||
if (v >= two53 || v <= -two53)
|
||||
{
|
||||
a1 = static_cast<int32_t> (a / two17);
|
||||
a -= a1 * two17;
|
||||
if (v >= two53 || v <= -two53) {
|
||||
a1 = static_cast<int32_t> (a / two17); a -= a1 * two17;
|
||||
v = a1 * s;
|
||||
a1 = static_cast<int32_t> (v / m);
|
||||
v -= a1 * m;
|
||||
a1 = static_cast<int32_t> (v / m); v -= a1 * m;
|
||||
v = v * two17 + a * s + c;
|
||||
}
|
||||
|
||||
a1 = static_cast<int32_t> (v / m);
|
||||
/* in case v < 0)*/
|
||||
if ((v -= a1 * m) < 0.0)
|
||||
{
|
||||
return v += m;
|
||||
}
|
||||
else
|
||||
{
|
||||
return v;
|
||||
}
|
||||
if ((v -= a1 * m) < 0.0) return v += m; else return v;
|
||||
}
|
||||
|
||||
|
||||
@@ -102,22 +118,19 @@ double MultModM (double a, double s, double c, double m)
|
||||
// Compute the vector v = A*s MOD m. Assume that -m < s[i] < m.
|
||||
// Works also when v = s.
|
||||
//
|
||||
void MatVecModM (const Matrix A, const double s[3], double v[3],
|
||||
void MatVecModM (const double A[3][3], const double s[3], double v[3],
|
||||
double m)
|
||||
{
|
||||
int i;
|
||||
double x[3]; // Necessary if v = s
|
||||
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
for (i = 0; i < 3; ++i) {
|
||||
x[i] = MultModM (A[i][0], s[0], 0.0, m);
|
||||
x[i] = MultModM (A[i][1], s[1], x[i], m);
|
||||
x[i] = MultModM (A[i][2], s[2], x[i], m);
|
||||
}
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
v[i] = x[i];
|
||||
}
|
||||
v[i] = x[i];
|
||||
}
|
||||
|
||||
|
||||
@@ -125,55 +138,41 @@ void MatVecModM (const Matrix A, const double s[3], double v[3],
|
||||
// Compute the matrix C = A*B MOD m. Assume that -m < s[i] < m.
|
||||
// Note: works also if A = C or B = C or A = B = C.
|
||||
//
|
||||
void MatMatModM (const Matrix A, const Matrix B,
|
||||
Matrix C, double m)
|
||||
void MatMatModM (const double A[3][3], const double B[3][3],
|
||||
double C[3][3], double m)
|
||||
{
|
||||
int i, j;
|
||||
double V[3];
|
||||
Matrix W;
|
||||
double V[3], W[3][3];
|
||||
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
for (i = 0; i < 3; ++i) {
|
||||
for (j = 0; j < 3; ++j)
|
||||
{
|
||||
V[j] = B[j][i];
|
||||
}
|
||||
V[j] = B[j][i];
|
||||
MatVecModM (A, V, V, m);
|
||||
for (j = 0; j < 3; ++j)
|
||||
{
|
||||
W[j][i] = V[j];
|
||||
}
|
||||
W[j][i] = V[j];
|
||||
}
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
for (j = 0; j < 3; ++j)
|
||||
{
|
||||
C[i][j] = W[i][j];
|
||||
}
|
||||
}
|
||||
for (j = 0; j < 3; ++j)
|
||||
C[i][j] = W[i][j];
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Compute the matrix B = (A^(2^e) Mod m); works also if A = B.
|
||||
//
|
||||
void MatTwoPowModM (const Matrix src, Matrix dst, double m, int32_t e)
|
||||
void MatTwoPowModM (const double A[3][3], double B[3][3], double m, int32_t e)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
/* initialize: dst = src */
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
for (j = 0; j < 3; ++j)
|
||||
{
|
||||
dst[i][j] = src[i][j];
|
||||
}
|
||||
/* initialize: B = A */
|
||||
if (A != B) {
|
||||
for (i = 0; i < 3; ++i)
|
||||
for (j = 0; j < 3; ++j)
|
||||
B[i][j] = A[i][j];
|
||||
}
|
||||
/* Compute dst = src^(2^e) mod m */
|
||||
/* Compute B = A^(2^e) mod m */
|
||||
for (i = 0; i < e; i++)
|
||||
{
|
||||
MatMatModM (dst, dst, dst, m);
|
||||
}
|
||||
MatMatModM (B, B, B, m);
|
||||
}
|
||||
|
||||
|
||||
@@ -187,60 +186,30 @@ void MatPowModM (const double A[3][3], double B[3][3], double m, int32_t n)
|
||||
|
||||
/* initialize: W = A; B = I */
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
for (j = 0; j < 3; ++j)
|
||||
{
|
||||
W[i][j] = A[i][j];
|
||||
B[i][j] = 0.0;
|
||||
}
|
||||
}
|
||||
for (j = 0; j < 3; ++j) {
|
||||
W[i][j] = A[i][j];
|
||||
B[i][j] = 0.0;
|
||||
}
|
||||
for (j = 0; j < 3; ++j)
|
||||
{
|
||||
B[j][j] = 1.0;
|
||||
}
|
||||
B[j][j] = 1.0;
|
||||
|
||||
/* Compute B = A^n mod m using the binary decomposition of n */
|
||||
while (n > 0)
|
||||
{
|
||||
if (n % 2)
|
||||
{
|
||||
MatMatModM (W, B, B, m);
|
||||
}
|
||||
while (n > 0) {
|
||||
if (n % 2) MatMatModM (W, B, B, m);
|
||||
MatMatModM (W, W, W, m);
|
||||
n /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
// The following are the transition matrices of the two MRG components
|
||||
// (in matrix form), raised to all powers of 2 from 1 to 191
|
||||
struct Precalculated
|
||||
{
|
||||
Matrix a1[190];
|
||||
Matrix a2[190];
|
||||
};
|
||||
struct Precalculated PowerOfTwoConstants (void)
|
||||
{
|
||||
struct Precalculated precalculated;
|
||||
for (int i = 0; i < 190; i++)
|
||||
{
|
||||
int power = i + 1;
|
||||
MatTwoPowModM (A1p0, precalculated.a1[i], m1, power);
|
||||
MatTwoPowModM (A2p0, precalculated.a2[i], m2, power);
|
||||
}
|
||||
return precalculated;
|
||||
}
|
||||
void PowerOfTwoMatrix (int n, Matrix a1p, Matrix a2p)
|
||||
{
|
||||
static struct Precalculated constants = PowerOfTwoConstants ();
|
||||
for (int i = 0; i < 3; i ++)
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
a1p[i][j] = constants.a1[n-1][i][j];
|
||||
a2p[i][j] = constants.a2[n-1][i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static ns3::GlobalValue g_rngSeed ("RngSeed",
|
||||
"The global seed of all rng streams",
|
||||
ns3::IntegerValue (1),
|
||||
ns3::MakeIntegerChecker<uint32_t> ());
|
||||
static ns3::GlobalValue g_rngRun ("RngRun",
|
||||
"The run number used to modify the global seed",
|
||||
ns3::IntegerValue (1),
|
||||
ns3::MakeIntegerChecker<uint32_t> ());
|
||||
|
||||
} // end of anonymous namespace
|
||||
|
||||
@@ -249,74 +218,348 @@ namespace ns3 {
|
||||
//-------------------------------------------------------------------------
|
||||
// Generate the next random number.
|
||||
//
|
||||
double RngStream::RandU01 ()
|
||||
double RngStream::U01 ()
|
||||
{
|
||||
int32_t k;
|
||||
double p1, p2, u;
|
||||
|
||||
/* Component 1 */
|
||||
p1 = a12 * m_currentState[1] - a13n * m_currentState[0];
|
||||
p1 = a12 * Cg[1] - a13n * Cg[0];
|
||||
k = static_cast<int32_t> (p1 / m1);
|
||||
p1 -= k * m1;
|
||||
if (p1 < 0.0)
|
||||
{
|
||||
p1 += m1;
|
||||
}
|
||||
m_currentState[0] = m_currentState[1]; m_currentState[1] = m_currentState[2]; m_currentState[2] = p1;
|
||||
if (p1 < 0.0) p1 += m1;
|
||||
Cg[0] = Cg[1]; Cg[1] = Cg[2]; Cg[2] = p1;
|
||||
|
||||
/* Component 2 */
|
||||
p2 = a21 * m_currentState[5] - a23n * m_currentState[3];
|
||||
p2 = a21 * Cg[5] - a23n * Cg[3];
|
||||
k = static_cast<int32_t> (p2 / m2);
|
||||
p2 -= k * m2;
|
||||
if (p2 < 0.0)
|
||||
{
|
||||
p2 += m2;
|
||||
}
|
||||
m_currentState[3] = m_currentState[4]; m_currentState[4] = m_currentState[5]; m_currentState[5] = p2;
|
||||
if (p2 < 0.0) p2 += m2;
|
||||
Cg[3] = Cg[4]; Cg[4] = Cg[5]; Cg[5] = p2;
|
||||
|
||||
/* Combination */
|
||||
u = ((p1 > p2) ? (p1 - p2) * norm : (p1 - p2 + m1) * norm);
|
||||
|
||||
return u;
|
||||
return (anti == false) ? u : (1 - u);
|
||||
}
|
||||
|
||||
RngStream::RngStream (uint32_t seedNumber, uint64_t stream, uint64_t substream)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Generate the next random number with extended (53 bits) precision.
|
||||
//
|
||||
double RngStream::U01d ()
|
||||
{
|
||||
if (seedNumber >= m1 || seedNumber >= m2 || seedNumber == 0)
|
||||
{
|
||||
NS_FATAL_ERROR ("invalid Seed " << seedNumber);
|
||||
double u;
|
||||
u = U01 ();
|
||||
if (anti) {
|
||||
// Don't forget that U01() returns 1 - u in the antithetic case
|
||||
u += (U01 () - 1.0) * fact;
|
||||
return (u < 0.0) ? u + 1.0 : u;
|
||||
} else {
|
||||
u += U01 () * fact;
|
||||
return (u < 1.0) ? u : (u - 1.0);
|
||||
}
|
||||
for (int i = 0; i < 6; ++i)
|
||||
{
|
||||
m_currentState[i] = seedNumber;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Check that the seeds are legitimate values. Returns true if legal seeds,
|
||||
// false otherwise.
|
||||
//
|
||||
bool RngStream::CheckSeed (const uint32_t seed[6])
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
if (seed[i] >= m1) {
|
||||
cerr << "****************************************\n\n"
|
||||
<< "ERROR: Seed[" << i << "] >= 4294967087, Seed is not set."
|
||||
<< "\n\n****************************************\n\n";
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
AdvanceNthBy (stream, 127, m_currentState);
|
||||
AdvanceNthBy (substream, 76, m_currentState);
|
||||
for (i = 3; i < 6; ++i) {
|
||||
if (seed[i] >= m2) {
|
||||
cerr << "Seed[" << i << "] = " << seed[i] << endl;
|
||||
cerr << "*****************************************\n\n"
|
||||
<< "ERROR: Seed[" << i << "] >= 4294944443, Seed is not set."
|
||||
<< "\n\n*****************************************\n\n";
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
if (seed[0] == 0 && seed[1] == 0 && seed[2] == 0) {
|
||||
cerr << "****************************\n\n"
|
||||
<< "ERROR: First 3 seeds = 0.\n\n"
|
||||
<< "****************************\n\n";
|
||||
return (false);
|
||||
}
|
||||
if (seed[3] == 0 && seed[4] == 0 && seed[5] == 0) {
|
||||
cerr << "****************************\n\n"
|
||||
<< "ERROR: Last 3 seeds = 0.\n\n"
|
||||
<< "****************************\n\n";
|
||||
return (false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
RngStream::EnsureGlobalInitialized (void)
|
||||
{
|
||||
static bool initialized = false;
|
||||
static uint32_t run = 0;
|
||||
if (!initialized)
|
||||
{
|
||||
initialized = true;
|
||||
uint32_t seed;
|
||||
IntegerValue value;
|
||||
g_rngSeed.GetValue (value);
|
||||
seed = value.Get ();
|
||||
g_rngRun.GetValue (value);
|
||||
run = value.Get ();
|
||||
SetPackageSeed (seed);
|
||||
}
|
||||
return run;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// Public members of the class start here
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// The default seed of the package; at run time, this will be overwritten
|
||||
// by the g_rngSeed value the first time RngStream::RngStream is visited;
|
||||
// so the value 12345 is for debugging
|
||||
//
|
||||
double RngStream::nextSeed[6] =
|
||||
{
|
||||
12345.0, 12345.0, 12345.0, 12345.0, 12345.0, 12345.0
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// constructor
|
||||
//
|
||||
RngStream::RngStream ()
|
||||
{
|
||||
uint32_t run = EnsureGlobalInitialized ();
|
||||
|
||||
anti = false;
|
||||
incPrec = false;
|
||||
// Stream initialization moved to separate method.
|
||||
InitializeStream ();
|
||||
//move the state of this stream up
|
||||
ResetNthSubstream (run);
|
||||
}
|
||||
|
||||
RngStream::RngStream(const RngStream& r)
|
||||
{
|
||||
for (int i = 0; i < 6; ++i)
|
||||
{
|
||||
m_currentState[i] = r.m_currentState[i];
|
||||
anti = r.anti;
|
||||
incPrec = r.incPrec;
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
Cg[i] = r.Cg[i];
|
||||
Bg[i] = r.Bg[i];
|
||||
Ig[i] = r.Ig[i];
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RngStream::AdvanceNthBy (uint64_t nth, int by, double state[6])
|
||||
|
||||
void RngStream::InitializeStream ()
|
||||
{ // Moved from the RngStream constructor above to allow seeding
|
||||
// AFTER the global package seed has been set in the Random
|
||||
// object constructor.
|
||||
/* Information on a stream. The arrays {Cg, Bg, Ig} contain the current
|
||||
state of the stream, the starting state of the current SubStream, and the
|
||||
starting state of the stream. This stream generates antithetic variates
|
||||
if anti = true. It also generates numbers with extended precision (53
|
||||
bits if machine follows IEEE 754 standard) if incPrec = true. nextSeed
|
||||
will be the seed of the next declared RngStream. */
|
||||
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
Bg[i] = Cg[i] = Ig[i] = nextSeed[i];
|
||||
}
|
||||
|
||||
MatVecModM (A1p127, nextSeed, nextSeed, m1);
|
||||
MatVecModM (A2p127, &nextSeed[3], &nextSeed[3], m2);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Reset Stream to beginning of Stream.
|
||||
//
|
||||
void RngStream::ResetStartStream ()
|
||||
{
|
||||
Matrix matrix1,matrix2;
|
||||
for (int i = 0; i < 64; i++)
|
||||
for (int i = 0; i < 6; ++i)
|
||||
Cg[i] = Bg[i] = Ig[i];
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Reset Stream to beginning of SubStream.
|
||||
//
|
||||
void RngStream::ResetStartSubstream ()
|
||||
{
|
||||
for (int i = 0; i < 6; ++i)
|
||||
Cg[i] = Bg[i];
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Reset Stream to NextSubStream.
|
||||
//
|
||||
void RngStream::ResetNextSubstream ()
|
||||
{
|
||||
MatVecModM (A1p76, Bg, Bg, m1);
|
||||
MatVecModM (A2p76, &Bg[3], &Bg[3], m2);
|
||||
for (int i = 0; i < 6; ++i)
|
||||
Cg[i] = Bg[i];
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Reset Stream to Nth SubStream.
|
||||
//
|
||||
void RngStream::ResetNthSubstream (uint32_t N)
|
||||
{
|
||||
if(N==0) return;
|
||||
for(uint32_t i=0; i<N; ++i) {
|
||||
MatVecModM (A1p76, Bg, Bg, m1);
|
||||
MatVecModM (A2p76, &Bg[3], &Bg[3], m2);
|
||||
}
|
||||
for (int i = 0; i < 6; ++i)
|
||||
Cg[i] = Bg[i];
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
bool RngStream::SetPackageSeed (const uint32_t seed[6])
|
||||
{
|
||||
if (!CheckSeed (seed))
|
||||
{
|
||||
int nbit = 63 - i;
|
||||
int bit = (nth >> nbit) & 0x1;
|
||||
if (bit)
|
||||
{
|
||||
PowerOfTwoMatrix(by + nbit, matrix1, matrix2);
|
||||
MatVecModM (matrix1, state, state, m1);
|
||||
MatVecModM (matrix2, &state[3], &state[3], m2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < 6; ++i)
|
||||
nextSeed[i] = seed[i];
|
||||
return true;
|
||||
}
|
||||
bool
|
||||
RngStream::SetPackageSeed (uint32_t seed)
|
||||
{
|
||||
uint32_t seeds[6] = { seed, seed, seed, seed, seed, seed};
|
||||
return SetPackageSeed (seeds);
|
||||
}
|
||||
void
|
||||
RngStream::GetPackageSeed (uint32_t seed[6])
|
||||
{
|
||||
IntegerValue value;
|
||||
g_rngSeed.GetValue (value);
|
||||
uint32_t theSeed = value.Get ();
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
seed[i] = static_cast<uint32_t> (theSeed);
|
||||
}
|
||||
}
|
||||
void
|
||||
RngStream::SetPackageRun (uint32_t run)
|
||||
{
|
||||
g_rngRun.SetValue (IntegerValue (run));
|
||||
}
|
||||
uint32_t
|
||||
RngStream::GetPackageRun (void)
|
||||
{
|
||||
IntegerValue run;
|
||||
g_rngRun.GetValue (run);
|
||||
return run.Get ();
|
||||
}
|
||||
bool
|
||||
RngStream::CheckSeed (uint32_t seed)
|
||||
{
|
||||
uint32_t seeds[6] = { seed, seed, seed, seed, seed, seed};
|
||||
return CheckSeed (seeds);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
bool RngStream::SetSeeds (const uint32_t seed[6])
|
||||
{
|
||||
if (!CheckSeed (seed)) return false;
|
||||
for (int i = 0; i < 6; ++i)
|
||||
Cg[i] = Bg[i] = Ig[i] = seed[i];
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// if e > 0, let n = 2^e + c;
|
||||
// if e < 0, let n = -2^(-e) + c;
|
||||
// if e = 0, let n = c.
|
||||
// Jump n steps forward if n > 0, backwards if n < 0.
|
||||
//
|
||||
void RngStream::AdvanceState (int32_t e, int32_t c)
|
||||
{
|
||||
double B1[3][3], C1[3][3], B2[3][3], C2[3][3];
|
||||
|
||||
if (e > 0) {
|
||||
MatTwoPowModM (A1p0, B1, m1, e);
|
||||
MatTwoPowModM (A2p0, B2, m2, e);
|
||||
} else if (e < 0) {
|
||||
MatTwoPowModM (InvA1, B1, m1, -e);
|
||||
MatTwoPowModM (InvA2, B2, m2, -e);
|
||||
}
|
||||
|
||||
if (c >= 0) {
|
||||
MatPowModM (A1p0, C1, m1, c);
|
||||
MatPowModM (A2p0, C2, m2, c);
|
||||
} else {
|
||||
MatPowModM (InvA1, C1, m1, -c);
|
||||
MatPowModM (InvA2, C2, m2, -c);
|
||||
}
|
||||
|
||||
if (e) {
|
||||
MatMatModM (B1, C1, C1, m1);
|
||||
MatMatModM (B2, C2, C2, m2);
|
||||
}
|
||||
|
||||
MatVecModM (C1, Cg, Cg, m1);
|
||||
MatVecModM (C2, &Cg[3], &Cg[3], m2);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
void RngStream::GetState (uint32_t seed[6]) const
|
||||
{
|
||||
for (int i = 0; i < 6; ++i)
|
||||
seed[i] = static_cast<uint32_t> (Cg[i]);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
void RngStream::IncreasedPrecis (bool incp)
|
||||
{
|
||||
incPrec = incp;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
void RngStream::SetAntithetic (bool a)
|
||||
{
|
||||
anti = a;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Generate the next random number.
|
||||
//
|
||||
double RngStream::RandU01 ()
|
||||
{
|
||||
if (incPrec)
|
||||
return U01d ();
|
||||
else
|
||||
return U01 ();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Generate the next random integer.
|
||||
//
|
||||
int32_t RngStream::RandInt (int32_t low, int32_t high)
|
||||
{
|
||||
return low + static_cast<int32_t> ((high - low + 1) * RandU01 ());
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
+31
-14
@@ -36,21 +36,38 @@ namespace ns3 {
|
||||
* class are explained in:
|
||||
* http://www.iro.umontreal.ca/~lecuyer/myftp/papers/streams00.pdf
|
||||
*/
|
||||
class RngStream
|
||||
{
|
||||
public:
|
||||
RngStream (uint32_t seed, uint64_t stream, uint64_t substream);
|
||||
class RngStream {
|
||||
public: //public api
|
||||
RngStream ();
|
||||
RngStream (const RngStream&);
|
||||
/**
|
||||
* Generate the next random number for this stream.
|
||||
* Uniformly distributed between 0 and 1.
|
||||
*/
|
||||
double RandU01 (void);
|
||||
|
||||
private:
|
||||
void AdvanceNthBy (uint64_t nth, int by, double state[6]);
|
||||
|
||||
double m_currentState[6];
|
||||
void InitializeStream (); // Separate initialization
|
||||
void ResetStartStream ();
|
||||
void ResetStartSubstream ();
|
||||
void ResetNextSubstream ();
|
||||
void ResetNthSubstream (uint32_t N);
|
||||
void SetAntithetic (bool a);
|
||||
void IncreasedPrecis (bool incp);
|
||||
bool SetSeeds (const uint32_t seed[6]);
|
||||
void AdvanceState (int32_t e, int32_t c);
|
||||
void GetState (uint32_t seed[6]) const;
|
||||
double RandU01 ();
|
||||
int32_t RandInt (int32_t i, int32_t j);
|
||||
public: //public static api
|
||||
static bool SetPackageSeed (uint32_t seed);
|
||||
static bool SetPackageSeed (const uint32_t seed[6]);
|
||||
static void GetPackageSeed (uint32_t seed[6]);
|
||||
static void SetPackageRun (uint32_t run);
|
||||
static uint32_t GetPackageRun (void);
|
||||
static bool CheckSeed (const uint32_t seed[6]);
|
||||
static bool CheckSeed (uint32_t seed);
|
||||
private: //members
|
||||
double Cg[6], Bg[6], Ig[6];
|
||||
bool anti, incPrec;
|
||||
double U01 ();
|
||||
double U01d ();
|
||||
static uint32_t EnsureGlobalInitialized (void);
|
||||
private: //static data
|
||||
static double nextSeed[6];
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -149,7 +149,8 @@ IidManager::AddConstructor (uint16_t uid, ns3::Callback<ns3::ObjectBase *> callb
|
||||
struct IidInformation *information = LookupInformation (uid);
|
||||
if (information->hasConstructor)
|
||||
{
|
||||
NS_FATAL_ERROR (information->name<<" already has a constructor.");
|
||||
return;
|
||||
// NS_FATAL_ERROR (information->name<<" already has a constructor.");
|
||||
}
|
||||
information->hasConstructor = true;
|
||||
information->constructor = callback;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -124,8 +124,6 @@ def build(bld):
|
||||
'model/object.cc',
|
||||
'model/test.cc',
|
||||
'model/random-variable.cc',
|
||||
'model/random-variable-stream.cc',
|
||||
'model/rng-seed-manager.cc',
|
||||
'model/rng-stream.cc',
|
||||
'model/command-line.cc',
|
||||
'model/type-name.cc',
|
||||
@@ -208,8 +206,6 @@ def build(bld):
|
||||
'model/fatal-error.h',
|
||||
'model/test.h',
|
||||
'model/random-variable.h',
|
||||
'model/random-variable-stream.h',
|
||||
'model/rng-seed-manager.h',
|
||||
'model/rng-stream.h',
|
||||
'model/command-line.h',
|
||||
'model/type-name.h',
|
||||
|
||||
+6
-26
@@ -230,13 +230,11 @@ Model Description
|
||||
|
||||
The source code for the new module lives in the directory ``src/%(MODULE)s``.
|
||||
|
||||
Add here a basic description of what is being modeled.
|
||||
|
||||
Design
|
||||
======
|
||||
|
||||
Briefly describe the software design of the model and how it fits into
|
||||
the existing ns-3 architecture.
|
||||
Add here an overall description of the software design and how it fits
|
||||
into the existing ns-3 architecture.
|
||||
|
||||
Scope and Limitations
|
||||
=====================
|
||||
@@ -254,30 +252,17 @@ Usage
|
||||
*****
|
||||
|
||||
This section is principally concerned with the usage of your model, using
|
||||
the public API. Focus first on most common usage patterns, then go
|
||||
into more advanced topics.
|
||||
the public API.
|
||||
|
||||
Building New Module
|
||||
===================
|
||||
|
||||
Include this subsection only if there are special build instructions or
|
||||
platform limitations.
|
||||
Include this section if there are special build instructions.
|
||||
|
||||
Helpers
|
||||
=======
|
||||
|
||||
What helper API will users typically use? Describe it here.
|
||||
|
||||
Attributes
|
||||
==========
|
||||
|
||||
What classes hold attributes, and what are the key ones worth mentioning?
|
||||
|
||||
Output
|
||||
Helper
|
||||
======
|
||||
|
||||
What kind of data does the model generate? What are the key trace
|
||||
sources? What kind of logging output can be enabled?
|
||||
What helper API will users typically use? Describe it here.
|
||||
|
||||
Advanced Usage
|
||||
==============
|
||||
@@ -290,11 +275,6 @@ Examples
|
||||
|
||||
What examples using this new code are available? Describe them here.
|
||||
|
||||
Troubleshooting
|
||||
===============
|
||||
|
||||
Add any tips for avoiding pitfalls, etc.
|
||||
|
||||
Validation
|
||||
**********
|
||||
|
||||
|
||||
@@ -222,7 +222,6 @@ private:
|
||||
* \param stream The output stream object to use when logging ascii traces.
|
||||
* \param prefix Filename prefix to use for ascii trace files.
|
||||
* \param nd Net device for which you want to enable tracing.
|
||||
* \param explicitFilename Treat the prefix as an explicit filename if true
|
||||
*/
|
||||
virtual void EnableAsciiInternal (Ptr<OutputStreamWrapper> stream,
|
||||
std::string prefix,
|
||||
|
||||
@@ -155,7 +155,7 @@ DsdvManetExample::ReceivePacket (Ptr <Socket> socket)
|
||||
{
|
||||
NS_LOG_UNCOND (Simulator::Now ().GetSeconds () << " Received one packet!");
|
||||
Ptr <Packet> packet;
|
||||
while ((packet = socket->Recv ()))
|
||||
while (packet = socket->Recv ())
|
||||
{
|
||||
bytesTotal += packet->GetSize ();
|
||||
packetsReceived += 1;
|
||||
|
||||
@@ -317,10 +317,9 @@ RoutingProtocol::RouteOutput (Ptr<Packet> p,
|
||||
if (EnableBuffering)
|
||||
{
|
||||
uint32_t iif = (oif ? m_ipv4->GetInterfaceForDevice (oif) : -1);
|
||||
DeferredRouteOutputTag tag (iif);
|
||||
if (!p->PeekPacketTag (tag))
|
||||
if (p->PeekPacketTag<DeferredRouteOutputTag> () == 0)
|
||||
{
|
||||
p->AddPacketTag (tag);
|
||||
p->AddPacketTag (CreateObject<DeferredRouteOutputTag> (iif));
|
||||
}
|
||||
}
|
||||
return LoopbackRoute (header,oif);
|
||||
@@ -377,8 +376,7 @@ RoutingProtocol::RouteInput (Ptr<const Packet> p,
|
||||
// Deferred route request
|
||||
if (EnableBuffering == true && idev == m_lo)
|
||||
{
|
||||
DeferredRouteOutputTag tag;
|
||||
if (p->PeekPacketTag (tag))
|
||||
if (p->PeekPacketTag<DeferredRouteOutputTag> () != 0)
|
||||
{
|
||||
DeferredRouteOutput (p,header,ucb,ecb);
|
||||
return true;
|
||||
@@ -1121,11 +1119,11 @@ RoutingProtocol::SendPacketFromQueue (Ipv4Address dst,
|
||||
QueueEntry queueEntry;
|
||||
if (m_queue.Dequeue (dst,queueEntry))
|
||||
{
|
||||
DeferredRouteOutputTag tag;
|
||||
Ptr<Packet> p = ConstCast<Packet> (queueEntry.GetPacket ());
|
||||
if (p->RemovePacketTag (tag))
|
||||
Ptr<const DeferredRouteOutputTag> tag = p->RemovePacketTag<DeferredRouteOutputTag> ();
|
||||
if (tag != 0)
|
||||
{
|
||||
if (tag.oif != -1 && tag.oif != m_ipv4->GetInterfaceForDevice (route->GetOutputDevice ()))
|
||||
if (tag->oif != -1 && tag->oif != m_ipv4->GetInterfaceForDevice (route->GetOutputDevice ()))
|
||||
{
|
||||
NS_LOG_DEBUG ("Output device doesn't match. Dropped.");
|
||||
return;
|
||||
|
||||
+70
-78
@@ -3,8 +3,8 @@
|
||||
DSR Routing
|
||||
-----------
|
||||
|
||||
Dynamic Source Routing (DSR) protocol is a reactive routing protocol designed
|
||||
specifically for use in multi-hop wireless ad hoc networks of mobile nodes.
|
||||
Dynamic Source Routing (DSR) protocol is a reactive routing protocol designed specifically for use in multi-hop
|
||||
wireless ad hoc networks of mobile nodes.
|
||||
|
||||
This model was developed by
|
||||
`the ResiliNets research group <http://www.ittc.ku.edu/resilinets>`_
|
||||
@@ -13,87 +13,83 @@ at the University of Kansas.
|
||||
DSR Routing Overview
|
||||
********************
|
||||
|
||||
This model implements the base specification of the Dynamic Source Routing
|
||||
(DSR) protocol. Implementation is based on RFC4728.
|
||||
This model implements the base specification of the Dynamic Source Routing (DSR)
|
||||
protocol. Implementation is based on RFC4728.
|
||||
|
||||
* ``Class dsr::DsrRouting`` implements all functionality of service packet exchange and inherits IpL4Protocol.
|
||||
* ``Class dsr::DsrOptions`` implements functionality of packet processing and talks to DsrRouting to send/receive packets
|
||||
* ``Class dsr::DsrFsHeader`` defines the fixed-size header and identifies the up-layer protocol
|
||||
* ``Class dsr::DsrOptionHeader`` takes care of different dsr options and processes different header according to the specification from the RFC
|
||||
* ``Class dsr::DsrSendBuffer`` is a buffer to save data packets and route error packets when there is no route to forward the packets
|
||||
* ``Class dsr::DsrMaintainBuffer`` is a buffer to save data packets for next-hop notification when the data packet has already been sent out of send buffer
|
||||
* ``Class dsr::RouteCache`` is the essential part to save routes found for data packets. DSR responds to several routes for a single destination
|
||||
* ``Class dsr::RreqTable`` implements the functions to avoid duplicate route requests and control route request rate for a single destination
|
||||
|
||||
Protocol operation depends on many adjustable parameters. We support parameters, with their default values, from RFC and parameters that enable/disable
|
||||
protocol features or tune for specific simulation scenarios, such as the max
|
||||
size of the send buffer and its timeout value. The full parameter list is
|
||||
found in the dsr-routing.cc file.
|
||||
Class dsr::DsrRouting implements all functionality of service packet exchange and inherits IpL4Protocol.
|
||||
|
||||
DSR discovers routes on-demand. Therefore, our DSR model buffers all packets,
|
||||
while a route request packet (RREQ) is disseminated. We implement a packet
|
||||
buffer in dsr-rsendbuff.cc. The packet queue implements garbage collection
|
||||
of old packets and a queue size limit. When the packet is sent out from the
|
||||
send buffer, it will be queued in maintenance buffer for next hop
|
||||
acknowledgment.
|
||||
Class dsr::DsrOptions implements functionality of packet processing and talk to DsrRouting to send/receive packets
|
||||
|
||||
The Route Cache implementation support garbage collection of old entries
|
||||
and state machine, as defined in the standard. It implements as a STL
|
||||
map container. The key is the destination IP address.
|
||||
Class dsr::DsrFsHeader defines the fixed-size header and identify the up-layer protocol
|
||||
|
||||
Protocol operation strongly depends on broken link detection mechanism.
|
||||
We implement the three heuristics recommended.
|
||||
|
||||
First, we use layer 2 feedback when possible. A link is considered to be
|
||||
broken if frame transmission results in a transmission failure for all
|
||||
retries. This mechanism is meant for active links and works much faster than
|
||||
in its absence. Layer 2 feedback implementation relies on TxErrHeader trace
|
||||
source, currently it is supported in AdhocWifiMac only.
|
||||
Class dsr::DsrOptionHeader takes care of different dsr options and process different header according to specification from rfc
|
||||
|
||||
Second, passive acknowledgment should be used whenever possible. The node
|
||||
turns on "promiscuous" receive mode, in which it can receive packets not
|
||||
destined for itself, and when the node assures the delivery of that data
|
||||
packet to its destination, it cancels the passive acknowledgment timer.
|
||||
Class dsr::DsrSendBuffer is a buffer to save data packet as well as route error packet when there is no route to forward the packet
|
||||
|
||||
Last, we use a network layer acknowledge scheme to notify the receipt of
|
||||
a packet. Route request packet will not be acknowledged or retransmitted.
|
||||
Class dsr::DsrMaintainBuffer is a buffer to save data packet for next-hop notification when the data packet has already sent out of send buffer
|
||||
|
||||
The following optional protocol optimizations aren't implemented:
|
||||
Class dsr::RouteCache is the essential part to save routes found for data packet, dsr responds to several routes for a single destination
|
||||
|
||||
* Flow state
|
||||
* First Hop External (F), Last Hop External (L) flags
|
||||
* Handling unknown DSR options
|
||||
* Two types of error headers:
|
||||
Class dsr::RreqTable implements the functionalities to avoid duplicate route requests and control route request rate for a single destination
|
||||
|
||||
Protocol operation depends on the many adjustable parameters. We support parameters, with their default values, from
|
||||
RFC and parameters that enable/disable protocol features or tune for specific simulation scenarios, such as the max size
|
||||
of send buffer and its timeout value. The full parameter list is in DsrRouting.cc file.
|
||||
|
||||
DSR discovers routes totally on demand. Therefore, our DSR model buffers all packets, while a route request packet (RREQ)
|
||||
is disseminated. We implement a packet buffer in dsr-rsendbuff.cc. The packet queue implements garbage collection of old
|
||||
packets and a queue size limit. When the packet is sent out from the send buffer, it will be queued in maintenance buffer for
|
||||
next hop acknowledgment
|
||||
|
||||
Route Cache implementation support garbage collection of old entries and state machine, defined in standard.
|
||||
It implements as a STL map container. The key is the destination IP address.
|
||||
|
||||
Protocol operation strongly depends on broken link detection mechanism. We implement all the three heuristics.
|
||||
First, we use layer 2 feedback when possible. Link considered to be broken, if frame transmission results in a transmission
|
||||
failure for all retries. This mechanism meant for active links and work much more faster, than first method.
|
||||
Layer 2 feedback implementation relies on TxErrHeader trace source, currently it is supported in AdhocWifiMac only.
|
||||
|
||||
Second, passive acknowledgment should be used whenever possible. The node turns on "promiscuous" receive mode, in which it can receive
|
||||
packet not destined for itself, and when the node assures the delivery of that data packet to its destination, it cancels the passive
|
||||
acknowledgment timer.
|
||||
|
||||
Last, we use network layer acknowledge scheme to notify the receipt of a packet. Route request packet will not
|
||||
be acknowledge or retransmitted.
|
||||
|
||||
Following optional protocol optimizations aren't implemented:
|
||||
- Flow state
|
||||
- First Hop External (F), Last Hop External (L) flags
|
||||
- Handling unknown DSR options
|
||||
- Two types of error headers:
|
||||
1. flow state not supported option
|
||||
2. unsupported option (not going to happen in simulation)
|
||||
|
||||
DSR operates with direct access to IP header, and operates between
|
||||
network and transport layer.
|
||||
DSR operates with direct access to IP header, and operates between network and transport layer.
|
||||
|
||||
Implementation changes
|
||||
======================
|
||||
Implementation changes
|
||||
- The DsrFsHeader has added 3 fields: message type, source id, destination id, and these changes only for post-processing
|
||||
- message type is used to identify the data packet from control packet
|
||||
- source id is used to identify the real source of the data packet since we have to deliver the packet hop-by-hop and the ipv4header
|
||||
is not carrying the real source and destination ip address as needed
|
||||
- destination id is for same reason of above
|
||||
|
||||
* The DsrFsHeader has added 3 fields: message type, source id, destination id,
|
||||
and these changes only for post-processing
|
||||
** message type is used to identify the data packet from control packet
|
||||
** source id is used to identify the real source of the data packet since we have to deliver the packet hop-by-hop and the ipv4header is not carrying the real source and destination ip address as needed
|
||||
** destination id is for same reason of above
|
||||
* Route Reply header is not word-aligned in DSR rfc, change it to word-aligned in implementation
|
||||
* DSR works as a shim header between transport and network protocol, it needs its own forwarding mechanism, we are changing the packet transmission to hop-by-hop delivery, so we added two fields in dsr fixed header to notify packet delivery
|
||||
Changes:
|
||||
- Route Reply header is not word-aligned in DSR rfc, change it to word-aligned in implementation
|
||||
- DSR works as a shim header between transport and network protocol, it needs its own forwarding mechanism,
|
||||
we are changing the packet transmission to hop-by-hop delivery, so we added two fields in dsr fixed header
|
||||
to notify packet delivery
|
||||
1. message type to notify the type of this packet: data packet or control one
|
||||
2. source id to identify the real source address of this packet
|
||||
3. destination id to identify the real destination
|
||||
|
||||
Current Route Cache implementation
|
||||
==================================
|
||||
|
||||
This implementation used "path cache", which is simple to implement and ensures loop-free paths:
|
||||
|
||||
* the path cache has automatic expire policy
|
||||
* the cache saves multiple route entries for a certain destination and sort the entries based on hop counts
|
||||
* the MaxEntriesEachDst can be tuned to change the maximum entries saved for a single destination
|
||||
* when adding mulitiple routes for one destination, the route is compared based on hop-count and expire time, the one with less hop count or relatively new route is favored
|
||||
* Future implementation may include "link cache" as another possibility
|
||||
Current Route Cache implementation:
|
||||
- This implementation used "path cache", which is simple to implement and ensures loop-free
|
||||
- the path cache has automatic expire policy
|
||||
- the cache saves multiple route entries for a certain destination and sort the entries based on hop counts
|
||||
- the MaxEntriesEachDst can be tuned to change the maximum entries saved for a single destination
|
||||
- when adding mulitiple routes for one destination, the route is compared based on hop-count and expire time, the one with less hop count
|
||||
or relatively new route is favored
|
||||
- Future implementation may include "link cache" as another possibility
|
||||
|
||||
DSR Instructions
|
||||
****************
|
||||
@@ -107,15 +103,14 @@ The following should be kept in mind when running DSR as routing protocol:
|
||||
Helper
|
||||
******
|
||||
|
||||
To have a node run DSR, the easiest way would be to use the DsrHelper
|
||||
and DsrMainHelpers in your simulation script. For instance::
|
||||
To have a node run DSR, the easiest way would be to use the ClickInternetStackHelper
|
||||
class in your simulation script. For instance::
|
||||
|
||||
DsrHelper dsr;
|
||||
DsrMainHelper dsrMain;
|
||||
dsrMain.Install (dsr, adhocNodes);
|
||||
|
||||
The example scripts inside ``src/dsr/examples/`` demonstrate the use of
|
||||
DSR based nodes
|
||||
The example scripts inside ``src/dsr/examples/`` demonstrate the use of DSR based nodes
|
||||
in different scenarios. The helper source can be found inside ``src/dsr/helper/dsr-main-helper.{h,cc}``
|
||||
and ``src/dsr/helper/dsr-helper.{h,cc}``
|
||||
|
||||
@@ -125,9 +120,10 @@ Examples
|
||||
The example can be found in ``src/dsr/examples/``:
|
||||
|
||||
* dsr.cc use DSR as routing protocol within a traditional MANETs environment[3].
|
||||
|
||||
DSR is also built in the routing comparison case in ``examples/routing/``:
|
||||
|
||||
* ``manet-routing-compare.cc`` is a comparison case with built in MANET routing protocols and can generate its own results.
|
||||
* manet-routing-compare.cc is a comparison case with built in MANET routing protocols and can generate its own results.
|
||||
|
||||
Validation
|
||||
**********
|
||||
@@ -137,14 +133,10 @@ This model has been tested as follows:
|
||||
* Unit tests have been written to verify the internals of DSR. This can be found in ``src/dsr/test/dsr-test-suite.cc``. These tests verify whether the methods inside DSR module which deal with packet buffer, headers work correctly.
|
||||
* Simulation cases similar to [3] have been tested and have comparable results.
|
||||
* manet-routing-compare.cc has been used to compare DSR with three of other routing protocols.
|
||||
|
||||
A paper was presented on these results at the Workshop on ns-3 in 2011.
|
||||
|
||||
References
|
||||
**********
|
||||
|
||||
[1] Link for the `original paper: <http://www.monarch.cs.rice.edu/monarch-papers/dsr-chapter00.pdf>`_
|
||||
|
||||
[2] Link for `RFC 4728: <http://www6.ietf.org/rfc/rfc4728.txt>`_
|
||||
|
||||
[3] Link for the `Broch's comparison paper: <http://www.monarch.cs.rice.edu/monarch-papers/mobicom98.ps>`_
|
||||
[1] Link for the original paper: www.monarch.cs.rice.edu/monarch-papers/dsr-chapter00.pdf
|
||||
[2] Link for RFC 4728: http://www6.ietf.org/rfc/rfc4728.txt
|
||||
[3] Link for the broch's comparison paper: http://www.monarch.cs.rice.edu/monarch-papers/mobicom98.ps
|
||||
@@ -50,15 +50,14 @@ main (int argc, char *argv[])
|
||||
//
|
||||
#if 0
|
||||
LogComponentEnable ("Ipv4L3Protocol", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("Ipv4L4Protocol", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("UdpL4Protocol", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("UdpSocketImpl", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("NetDevice", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("Ipv4EndPointDemux", LOG_LEVEL_ALL);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
LogComponentEnable ("DsrOptions", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("DsrHelper", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("DsrRouting", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("DsrOptionHeader", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("DsrFsHeader", LOG_LEVEL_ALL);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
||||
|
||||
def build(bld):
|
||||
obj = bld.create_ns3_program('dsr', ['core', 'network', 'internet', 'applications', 'mobility', 'config-store', 'wifi', 'dsr'])
|
||||
obj = bld.create_ns3_program('dsr', ['core', 'simulator', 'node', 'internet-stack'])
|
||||
obj.source = 'dsr.cc'
|
||||
|
||||
@@ -103,7 +103,6 @@ public:
|
||||
m_src (s),
|
||||
m_dst (dst),
|
||||
m_ackId (ackId),
|
||||
m_id (0),
|
||||
m_segsLeft (segs),
|
||||
m_expire (exp + Simulator::Now ())
|
||||
{
|
||||
@@ -159,14 +158,6 @@ public:
|
||||
{
|
||||
m_ackId = ackId;
|
||||
}
|
||||
uint16_t GetId () const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
void SetId (uint16_t id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
uint8_t GetSegsLeft () const
|
||||
{
|
||||
return m_segsLeft;
|
||||
|
||||
@@ -138,7 +138,6 @@ private:
|
||||
* \param stream The output stream object to use when logging ascii traces.
|
||||
* \param prefix Filename prefix to use for ascii trace files.
|
||||
* \param nd Net device for which you want to enable tracing.
|
||||
* \param explicitFilename Treat the prefix as an explicit filename if true
|
||||
*/
|
||||
virtual void EnableAsciiInternal (Ptr<OutputStreamWrapper> stream,
|
||||
std::string prefix,
|
||||
|
||||
@@ -66,7 +66,6 @@ public:
|
||||
private:
|
||||
/**
|
||||
* \param device Pointer to the NetDevice to install DeviceEnergyModel.
|
||||
* \param source Pointer to EnergySource to install.
|
||||
*
|
||||
* Implements DeviceEnergyModel::Install.
|
||||
*/
|
||||
|
||||
@@ -229,7 +229,7 @@ private:
|
||||
virtual double DoGetCurrentA (void) const;
|
||||
|
||||
/**
|
||||
* \param state New state the radio device is currently in.
|
||||
* \param currentState New state the radio device is currently in.
|
||||
*
|
||||
* Sets current state. This function is private so that only the energy model
|
||||
* can change its own state.
|
||||
|
||||
@@ -76,7 +76,7 @@ private:
|
||||
/**
|
||||
* \param loads Load profile.
|
||||
* \param timeStamps Time stamps.
|
||||
* \param expLifetime Expected lifetime.
|
||||
* \param expLifeTime Expected lifetime.
|
||||
* \returns False if no error occurs.
|
||||
*
|
||||
* Runs simulation with variable load and checks the battery lifetime with
|
||||
|
||||
@@ -97,7 +97,7 @@ Histogram::Histogram (double binWidth)
|
||||
|
||||
Histogram::Histogram ()
|
||||
{
|
||||
m_binWidth = DEFAULT_BIN_WIDTH;
|
||||
Histogram (DEFAULT_BIN_WIDTH);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -204,8 +204,8 @@ Ipv4FlowProbe::SendOutgoingLogger (const Ipv4Header &ipHeader, Ptr<const Packet>
|
||||
|
||||
// tag the packet with the flow id and packet id, so that the packet can be identified even
|
||||
// when Ipv4Header is not accessible at some non-IPv4 protocol layer
|
||||
Ipv4FlowProbeTag fTag (flowId, packetId, size);
|
||||
ipPayload->AddPacketTag (fTag);
|
||||
Ptr<Ipv4FlowProbeTag> fTag = CreateObject<Ipv4FlowProbeTag> (flowId, packetId, size);
|
||||
ConstCast<Packet> (ipPayload)->AddPacketTag (fTag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,10 +233,9 @@ Ipv4FlowProbe::ForwardUpLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ip
|
||||
if (m_classifier->Classify (ipHeader, ipPayload, &flowId, &packetId))
|
||||
{
|
||||
// remove the tags that are added by Ipv4FlowProbe::SendOutgoingLogger ()
|
||||
Ipv4FlowProbeTag fTag;
|
||||
|
||||
// ConstCast: see http://www.nsnam.org/bugzilla/show_bug.cgi?id=904
|
||||
ConstCast<Packet> (ipPayload)->RemovePacketTag (fTag);
|
||||
ConstCast<Packet> (ipPayload)->RemovePacketTag<Ipv4FlowProbeTag> ();
|
||||
|
||||
uint32_t size = (ipPayload->GetSize () + ipHeader.GetSerializedSize ());
|
||||
NS_LOG_DEBUG ("ReportLastRx ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<");");
|
||||
@@ -272,10 +271,9 @@ Ipv4FlowProbe::DropLogger (const Ipv4Header &ipHeader, Ptr<const Packet> ipPaylo
|
||||
if (m_classifier->Classify (ipHeader, ipPayload, &flowId, &packetId))
|
||||
{
|
||||
// remove the tags that are added by Ipv4FlowProbe::SendOutgoingLogger ()
|
||||
Ipv4FlowProbeTag fTag;
|
||||
|
||||
// ConstCast: see http://www.nsnam.org/bugzilla/show_bug.cgi?id=904
|
||||
ConstCast<Packet> (ipPayload)->RemovePacketTag (fTag);
|
||||
ConstCast<Packet> (ipPayload)->RemovePacketTag<Ipv4FlowProbeTag> ();
|
||||
|
||||
uint32_t size = (ipPayload->GetSize () + ipHeader.GetSerializedSize ());
|
||||
NS_LOG_DEBUG ("Drop ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<", " << reason
|
||||
@@ -325,19 +323,18 @@ void
|
||||
Ipv4FlowProbe::QueueDropLogger (Ptr<const Packet> ipPayload)
|
||||
{
|
||||
// remove the tags that are added by Ipv4FlowProbe::SendOutgoingLogger ()
|
||||
Ipv4FlowProbeTag fTag;
|
||||
|
||||
// ConstCast: see http://www.nsnam.org/bugzilla/show_bug.cgi?id=904
|
||||
bool tagFound;
|
||||
tagFound = ConstCast<Packet> (ipPayload)->RemovePacketTag (fTag);
|
||||
if (!tagFound)
|
||||
|
||||
Ptr<const Ipv4FlowProbeTag> fTag = ConstCast<Packet> (ipPayload)->RemovePacketTag<Ipv4FlowProbeTag> ();
|
||||
if (!fTag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FlowId flowId = fTag.GetFlowId ();
|
||||
FlowPacketId packetId = fTag.GetPacketId ();
|
||||
uint32_t size = fTag.GetPacketSize ();
|
||||
FlowId flowId = fTag->GetFlowId ();
|
||||
FlowPacketId packetId = fTag->GetPacketId ();
|
||||
uint32_t size = fTag->GetPacketSize ();
|
||||
|
||||
NS_LOG_DEBUG ("Drop ("<<this<<", "<<flowId<<", "<<packetId<<", "<<size<<", " << DROP_QUEUE
|
||||
<< "); ");
|
||||
|
||||
@@ -110,6 +110,10 @@ def register_types(module):
|
||||
module.add_class('Ipv4AddressGenerator')
|
||||
## ipv4-address-helper.h (module 'internet'): ns3::Ipv4AddressHelper [class]
|
||||
module.add_class('Ipv4AddressHelper')
|
||||
## trie.h (module 'network'): ns3::Ipv4AddressTrieEAccessTraits [class]
|
||||
module.add_class('Ipv4AddressTrieEAccessTraits', import_from_module='ns.network')
|
||||
## trie.h (module 'network'): ns3::Ipv4AddressTrieEAccessTraits [enumeration]
|
||||
module.add_enum('', ['min_e_val', 'max_e_val', 'max_size'], outer_class=root_module['ns3::Ipv4AddressTrieEAccessTraits'], import_from_module='ns.network')
|
||||
## ipv4-end-point.h (module 'internet'): ns3::Ipv4EndPoint [class]
|
||||
module.add_class('Ipv4EndPoint')
|
||||
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress [class]
|
||||
@@ -200,8 +204,6 @@ def register_types(module):
|
||||
module.add_class('PcapHelperForIpv6', allow_subclassing=True)
|
||||
## random-variable.h (module 'core'): ns3::RandomVariable [class]
|
||||
module.add_class('RandomVariable', import_from_module='ns.core')
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory [class]
|
||||
module.add_class('RttHistory')
|
||||
## global-route-manager-impl.h (module 'internet'): ns3::SPFVertex [class]
|
||||
module.add_class('SPFVertex')
|
||||
## global-route-manager-impl.h (module 'internet'): ns3::SPFVertex::VertexType [enumeration]
|
||||
@@ -324,6 +326,8 @@ def register_types(module):
|
||||
module.add_class('InternetStackHelper', parent=[root_module['ns3::PcapHelperForIpv4'], root_module['ns3::PcapHelperForIpv6'], root_module['ns3::AsciiTraceHelperForIpv4'], root_module['ns3::AsciiTraceHelperForIpv6']])
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper [class]
|
||||
module.add_class('Ipv4GlobalRoutingHelper', parent=root_module['ns3::Ipv4RoutingHelper'])
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper::GlobalRoutingType [enumeration]
|
||||
module.add_enum('GlobalRoutingType', ['ONE_NEXT_HOP', 'ORDERED_NEXT_HOPS', 'UNORDERED_NEXT_HOPS'], outer_class=root_module['ns3::Ipv4GlobalRoutingHelper'])
|
||||
## ipv4-header.h (module 'internet'): ns3::Ipv4Header [class]
|
||||
module.add_class('Ipv4Header', parent=root_module['ns3::Header'])
|
||||
## ipv4-header.h (module 'internet'): ns3::Ipv4Header::DscpType [enumeration]
|
||||
@@ -372,10 +376,6 @@ def register_types(module):
|
||||
module.add_class('ParetoVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable'])
|
||||
## pcap-file-wrapper.h (module 'network'): ns3::PcapFileWrapper [class]
|
||||
module.add_class('PcapFileWrapper', import_from_module='ns.network', parent=root_module['ns3::Object'])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttEstimator [class]
|
||||
module.add_class('RttEstimator', parent=root_module['ns3::Object'])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttMeanDeviation [class]
|
||||
module.add_class('RttMeanDeviation', parent=root_module['ns3::RttEstimator'])
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class]
|
||||
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class]
|
||||
@@ -596,6 +596,8 @@ def register_types(module):
|
||||
module.add_class('Icmpv6L4Protocol', parent=root_module['ns3::IpL4Protocol'])
|
||||
## ipv4-global-routing.h (module 'internet'): ns3::Ipv4GlobalRouting [class]
|
||||
module.add_class('Ipv4GlobalRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ipv4GlobalRoutingOneNexthop [class]
|
||||
module.add_class('Ipv4GlobalRoutingOneNexthop', parent=root_module['ns3::Ipv4GlobalRouting'])
|
||||
## ipv4-list-routing.h (module 'internet'): ns3::Ipv4ListRouting [class]
|
||||
module.add_class('Ipv4ListRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
|
||||
## ipv6-list-routing.h (module 'internet'): ns3::Ipv6ListRouting [class]
|
||||
@@ -613,9 +615,6 @@ def register_types(module):
|
||||
typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >', 'ns3::SequenceNumber32')
|
||||
typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >*', 'ns3::SequenceNumber32*')
|
||||
typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >&', 'ns3::SequenceNumber32&')
|
||||
typehandlers.add_type_alias('std::deque< ns3::RttHistory, std::allocator< ns3::RttHistory > >', 'ns3::RttHistory_t')
|
||||
typehandlers.add_type_alias('std::deque< ns3::RttHistory, std::allocator< ns3::RttHistory > >*', 'ns3::RttHistory_t*')
|
||||
typehandlers.add_type_alias('std::deque< ns3::RttHistory, std::allocator< ns3::RttHistory > >&', 'ns3::RttHistory_t&')
|
||||
|
||||
## Register a nested module for the namespace FatalImpl
|
||||
|
||||
@@ -660,6 +659,7 @@ def register_methods(root_module):
|
||||
register_Ns3Ipv4Address_methods(root_module, root_module['ns3::Ipv4Address'])
|
||||
register_Ns3Ipv4AddressGenerator_methods(root_module, root_module['ns3::Ipv4AddressGenerator'])
|
||||
register_Ns3Ipv4AddressHelper_methods(root_module, root_module['ns3::Ipv4AddressHelper'])
|
||||
register_Ns3Ipv4AddressTrieEAccessTraits_methods(root_module, root_module['ns3::Ipv4AddressTrieEAccessTraits'])
|
||||
register_Ns3Ipv4EndPoint_methods(root_module, root_module['ns3::Ipv4EndPoint'])
|
||||
register_Ns3Ipv4InterfaceAddress_methods(root_module, root_module['ns3::Ipv4InterfaceAddress'])
|
||||
register_Ns3Ipv4InterfaceContainer_methods(root_module, root_module['ns3::Ipv4InterfaceContainer'])
|
||||
@@ -698,7 +698,6 @@ def register_methods(root_module):
|
||||
register_Ns3PcapHelperForIpv4_methods(root_module, root_module['ns3::PcapHelperForIpv4'])
|
||||
register_Ns3PcapHelperForIpv6_methods(root_module, root_module['ns3::PcapHelperForIpv6'])
|
||||
register_Ns3RandomVariable_methods(root_module, root_module['ns3::RandomVariable'])
|
||||
register_Ns3RttHistory_methods(root_module, root_module['ns3::RttHistory'])
|
||||
register_Ns3SPFVertex_methods(root_module, root_module['ns3::SPFVertex'])
|
||||
register_Ns3SeedManager_methods(root_module, root_module['ns3::SeedManager'])
|
||||
register_Ns3SequenceNumber32_methods(root_module, root_module['ns3::SequenceNumber32'])
|
||||
@@ -769,8 +768,6 @@ def register_methods(root_module):
|
||||
register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator'])
|
||||
register_Ns3ParetoVariable_methods(root_module, root_module['ns3::ParetoVariable'])
|
||||
register_Ns3PcapFileWrapper_methods(root_module, root_module['ns3::PcapFileWrapper'])
|
||||
register_Ns3RttEstimator_methods(root_module, root_module['ns3::RttEstimator'])
|
||||
register_Ns3RttMeanDeviation_methods(root_module, root_module['ns3::RttMeanDeviation'])
|
||||
register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >'])
|
||||
register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
|
||||
register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
|
||||
@@ -871,6 +868,7 @@ def register_methods(root_module):
|
||||
register_Ns3Icmpv4L4Protocol_methods(root_module, root_module['ns3::Icmpv4L4Protocol'])
|
||||
register_Ns3Icmpv6L4Protocol_methods(root_module, root_module['ns3::Icmpv6L4Protocol'])
|
||||
register_Ns3Ipv4GlobalRouting_methods(root_module, root_module['ns3::Ipv4GlobalRouting'])
|
||||
register_Ns3Ipv4GlobalRoutingOneNexthop_methods(root_module, root_module['ns3::Ipv4GlobalRoutingOneNexthop'])
|
||||
register_Ns3Ipv4ListRouting_methods(root_module, root_module['ns3::Ipv4ListRouting'])
|
||||
register_Ns3Ipv6ListRouting_methods(root_module, root_module['ns3::Ipv6ListRouting'])
|
||||
register_Ns3LoopbackNetDevice_methods(root_module, root_module['ns3::LoopbackNetDevice'])
|
||||
@@ -1360,10 +1358,6 @@ def register_Ns3BufferIterator_methods(root_module, cls):
|
||||
cls.add_method('Next',
|
||||
'void',
|
||||
[param('uint32_t', 'delta')])
|
||||
## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::PeekU8() [member function]
|
||||
cls.add_method('PeekU8',
|
||||
'uint8_t',
|
||||
[])
|
||||
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev() [member function]
|
||||
cls.add_method('Prev',
|
||||
'void',
|
||||
@@ -1376,10 +1370,6 @@ def register_Ns3BufferIterator_methods(root_module, cls):
|
||||
cls.add_method('Read',
|
||||
'void',
|
||||
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')])
|
||||
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(ns3::Buffer::Iterator start, uint32_t size) [member function]
|
||||
cls.add_method('Read',
|
||||
'void',
|
||||
[param('ns3::Buffer::Iterator', 'start'), param('uint32_t', 'size')])
|
||||
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadLsbtohU16() [member function]
|
||||
cls.add_method('ReadLsbtohU16',
|
||||
'uint16_t',
|
||||
@@ -1699,6 +1689,11 @@ def register_Ns3GlobalRouteManager_methods(root_module, cls):
|
||||
'void',
|
||||
[],
|
||||
is_static=True)
|
||||
## global-route-manager.h (module 'internet'): static void ns3::GlobalRouteManager::ClearLSDB() [member function]
|
||||
cls.add_method('ClearLSDB',
|
||||
'void',
|
||||
[],
|
||||
is_static=True)
|
||||
## global-route-manager.h (module 'internet'): static void ns3::GlobalRouteManager::BuildGlobalRoutingDatabase() [member function]
|
||||
cls.add_method('BuildGlobalRoutingDatabase',
|
||||
'void',
|
||||
@@ -1719,6 +1714,11 @@ def register_Ns3GlobalRouteManagerImpl_methods(root_module, cls):
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## global-route-manager-impl.h (module 'internet'): void ns3::GlobalRouteManagerImpl::ClearLSDB() [member function]
|
||||
cls.add_method('ClearLSDB',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## global-route-manager-impl.h (module 'internet'): void ns3::GlobalRouteManagerImpl::BuildGlobalRoutingDatabase() [member function]
|
||||
cls.add_method('BuildGlobalRoutingDatabase',
|
||||
'void',
|
||||
@@ -2004,9 +2004,9 @@ def register_Ns3Ipv4Address_methods(root_module, cls):
|
||||
'ns3::Ipv4Address',
|
||||
[param('uint8_t const *', 'buf')],
|
||||
is_static=True)
|
||||
## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Address::Get() const [member function]
|
||||
## ipv4-address.h (module 'network'): uint32_t const & ns3::Ipv4Address::Get() const [member function]
|
||||
cls.add_method('Get',
|
||||
'uint32_t',
|
||||
'uint32_t const &',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetAny() [member function]
|
||||
@@ -2161,6 +2161,28 @@ def register_Ns3Ipv4AddressHelper_methods(root_module, cls):
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'mask'), param('ns3::Ipv4Address', 'base', default_value='"0.0.0.1"')])
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4AddressTrieEAccessTraits_methods(root_module, cls):
|
||||
## trie.h (module 'network'): ns3::Ipv4AddressTrieEAccessTraits::Ipv4AddressTrieEAccessTraits() [constructor]
|
||||
cls.add_constructor([])
|
||||
## trie.h (module 'network'): ns3::Ipv4AddressTrieEAccessTraits::Ipv4AddressTrieEAccessTraits(ns3::Ipv4AddressTrieEAccessTraits const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4AddressTrieEAccessTraits const &', 'arg0')])
|
||||
## trie.h (module 'network'): static uint8_t const * ns3::Ipv4AddressTrieEAccessTraits::begin(ns3::Ipv4Address const & r_key) [member function]
|
||||
cls.add_method('begin',
|
||||
'uint8_t const *',
|
||||
[param('ns3::Ipv4Address const &', 'r_key')],
|
||||
is_static=True)
|
||||
## trie.h (module 'network'): static size_t ns3::Ipv4AddressTrieEAccessTraits::e_pos(uint8_t e) [member function]
|
||||
cls.add_method('e_pos',
|
||||
'size_t',
|
||||
[param('uint8_t', 'e')],
|
||||
is_static=True)
|
||||
## trie.h (module 'network'): static uint8_t const * ns3::Ipv4AddressTrieEAccessTraits::end(ns3::Ipv4Address const & r_key) [member function]
|
||||
cls.add_method('end',
|
||||
'uint8_t const *',
|
||||
[param('ns3::Ipv4Address const &', 'r_key')],
|
||||
is_static=True)
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4EndPoint_methods(root_module, cls):
|
||||
## ipv4-end-point.h (module 'internet'): ns3::Ipv4EndPoint::Ipv4EndPoint(ns3::Ipv4EndPoint const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4EndPoint const &', 'arg0')])
|
||||
@@ -2486,30 +2508,30 @@ def register_Ns3Ipv4RoutingTableEntry_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::Ipv4RoutingTableEntry const &', 'route')])
|
||||
## ipv4-routing-table-entry.h (module 'internet'): ns3::Ipv4RoutingTableEntry::Ipv4RoutingTableEntry(ns3::Ipv4RoutingTableEntry const * route) [constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4RoutingTableEntry const *', 'route')])
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('CreateDefaultRoute',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_static=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('CreateHostRouteTo',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_static=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('CreateHostRouteTo',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_static=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('CreateNetworkRouteTo',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_static=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('CreateNetworkRouteTo',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_static=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4RoutingTableEntry::GetDest() const [member function]
|
||||
cls.add_method('GetDest',
|
||||
@@ -2536,6 +2558,11 @@ def register_Ns3Ipv4RoutingTableEntry_methods(root_module, cls):
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): uint32_t ns3::Ipv4RoutingTableEntry::GetMetric() const [member function]
|
||||
cls.add_method('GetMetric',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): bool ns3::Ipv4RoutingTableEntry::IsDefault() const [member function]
|
||||
cls.add_method('IsDefault',
|
||||
'bool',
|
||||
@@ -2556,6 +2583,10 @@ def register_Ns3Ipv4RoutingTableEntry_methods(root_module, cls):
|
||||
'bool',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): void ns3::Ipv4RoutingTableEntry::SetMetric(uint32_t metric) [member function]
|
||||
cls.add_method('SetMetric',
|
||||
'void',
|
||||
[param('uint32_t', 'metric')])
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4StaticRoutingHelper_methods(root_module, cls):
|
||||
@@ -4001,21 +4032,6 @@ def register_Ns3RandomVariable_methods(root_module, cls):
|
||||
is_const=True)
|
||||
return
|
||||
|
||||
def register_Ns3RttHistory_methods(root_module, cls):
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::RttHistory(ns3::SequenceNumber32 s, uint32_t c, ns3::Time t) [constructor]
|
||||
cls.add_constructor([param('ns3::SequenceNumber32', 's'), param('uint32_t', 'c'), param('ns3::Time', 't')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::RttHistory(ns3::RttHistory const & h) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RttHistory const &', 'h')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::count [variable]
|
||||
cls.add_instance_attribute('count', 'uint32_t', is_const=False)
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::retx [variable]
|
||||
cls.add_instance_attribute('retx', 'bool', is_const=False)
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::seq [variable]
|
||||
cls.add_instance_attribute('seq', 'ns3::SequenceNumber32', is_const=False)
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::time [variable]
|
||||
cls.add_instance_attribute('time', 'ns3::Time', is_const=False)
|
||||
return
|
||||
|
||||
def register_Ns3SPFVertex_methods(root_module, cls):
|
||||
## global-route-manager-impl.h (module 'internet'): ns3::SPFVertex::SPFVertex() [constructor]
|
||||
cls.add_constructor([])
|
||||
@@ -4712,6 +4728,7 @@ def register_Ns3Empty_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right'))
|
||||
@@ -4764,7 +4781,6 @@ def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('<')
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_output_stream_operator()
|
||||
@@ -6165,8 +6181,8 @@ def register_Ns3InternetStackHelper_methods(root_module, cls):
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4GlobalRoutingHelper_methods(root_module, cls):
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper() [constructor]
|
||||
cls.add_constructor([])
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper(std::string const & type="ns3::Ipv4GlobalRoutingOneNexthop") [constructor]
|
||||
cls.add_constructor([param('std::string const &', 'type', default_value='"ns3::Ipv4GlobalRoutingOneNexthop"')])
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper(ns3::Ipv4GlobalRoutingHelper const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4GlobalRoutingHelper const &', 'arg0')])
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper * ns3::Ipv4GlobalRoutingHelper::Copy() const [member function]
|
||||
@@ -6184,6 +6200,11 @@ def register_Ns3Ipv4GlobalRoutingHelper_methods(root_module, cls):
|
||||
'void',
|
||||
[],
|
||||
is_static=True)
|
||||
## ipv4-global-routing-helper.h (module 'internet'): static void ns3::Ipv4GlobalRoutingHelper::PopulateAllPossibleRoutingTables() [member function]
|
||||
cls.add_method('PopulateAllPossibleRoutingTables',
|
||||
'void',
|
||||
[],
|
||||
is_static=True)
|
||||
## ipv4-global-routing-helper.h (module 'internet'): static void ns3::Ipv4GlobalRoutingHelper::RecomputeRoutingTables() [member function]
|
||||
cls.add_method('RecomputeRoutingTables',
|
||||
'void',
|
||||
@@ -7222,126 +7243,6 @@ def register_Ns3PcapFileWrapper_methods(root_module, cls):
|
||||
[])
|
||||
return
|
||||
|
||||
def register_Ns3RttEstimator_methods(root_module, cls):
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttEstimator::RttEstimator() [constructor]
|
||||
cls.add_constructor([])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttEstimator::RttEstimator(ns3::RttEstimator const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RttEstimator const &', 'arg0')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::AckSeq(ns3::SequenceNumber32 ackSeq) [member function]
|
||||
cls.add_method('AckSeq',
|
||||
'ns3::Time',
|
||||
[param('ns3::SequenceNumber32', 'ackSeq')],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::ClearSent() [member function]
|
||||
cls.add_method('ClearSent',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Ptr<ns3::RttEstimator> ns3::RttEstimator::Copy() const [member function]
|
||||
cls.add_method('Copy',
|
||||
'ns3::Ptr< ns3::RttEstimator >',
|
||||
[],
|
||||
is_pure_virtual=True, is_const=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetCurrentEstimate() const [member function]
|
||||
cls.add_method('GetCurrentEstimate',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetMaxRto() const [member function]
|
||||
cls.add_method('GetMaxRto',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetMinRto() const [member function]
|
||||
cls.add_method('GetMinRto',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## rtt-estimator.h (module 'internet'): static ns3::TypeId ns3::RttEstimator::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::IncreaseMultiplier() [member function]
|
||||
cls.add_method('IncreaseMultiplier',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::Measurement(ns3::Time t) [member function]
|
||||
cls.add_method('Measurement',
|
||||
'void',
|
||||
[param('ns3::Time', 't')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::Reset() [member function]
|
||||
cls.add_method('Reset',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::ResetMultiplier() [member function]
|
||||
cls.add_method('ResetMultiplier',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::RetransmitTimeout() [member function]
|
||||
cls.add_method('RetransmitTimeout',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SentSeq(ns3::SequenceNumber32 seq, uint32_t size) [member function]
|
||||
cls.add_method('SentSeq',
|
||||
'void',
|
||||
[param('ns3::SequenceNumber32', 'seq'), param('uint32_t', 'size')],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetCurrentEstimate(ns3::Time estimate) [member function]
|
||||
cls.add_method('SetCurrentEstimate',
|
||||
'void',
|
||||
[param('ns3::Time', 'estimate')])
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetMaxRto(ns3::Time maxRto) [member function]
|
||||
cls.add_method('SetMaxRto',
|
||||
'void',
|
||||
[param('ns3::Time', 'maxRto')])
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetMinRto(ns3::Time minRto) [member function]
|
||||
cls.add_method('SetMinRto',
|
||||
'void',
|
||||
[param('ns3::Time', 'minRto')])
|
||||
return
|
||||
|
||||
def register_Ns3RttMeanDeviation_methods(root_module, cls):
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttMeanDeviation::RttMeanDeviation() [constructor]
|
||||
cls.add_constructor([])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttMeanDeviation::RttMeanDeviation(ns3::RttMeanDeviation const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RttMeanDeviation const &', 'arg0')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::Ptr<ns3::RttEstimator> ns3::RttMeanDeviation::Copy() const [member function]
|
||||
cls.add_method('Copy',
|
||||
'ns3::Ptr< ns3::RttEstimator >',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttMeanDeviation::Gain(double g) [member function]
|
||||
cls.add_method('Gain',
|
||||
'void',
|
||||
[param('double', 'g')])
|
||||
## rtt-estimator.h (module 'internet'): static ns3::TypeId ns3::RttMeanDeviation::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttMeanDeviation::Measurement(ns3::Time measure) [member function]
|
||||
cls.add_method('Measurement',
|
||||
'void',
|
||||
[param('ns3::Time', 'measure')],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttMeanDeviation::Reset() [member function]
|
||||
cls.add_method('Reset',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttMeanDeviation::RetransmitTimeout() [member function]
|
||||
cls.add_method('RetransmitTimeout',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, cls):
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount() [constructor]
|
||||
cls.add_constructor([])
|
||||
@@ -8162,11 +8063,11 @@ def register_Ns3TcpSocketFactory_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Time_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_comparison_operator('<')
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', 'right'))
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_comparison_operator('<=')
|
||||
@@ -9031,14 +8932,6 @@ def register_Ns3GlobalRouter_methods(root_module, cls):
|
||||
is_static=True)
|
||||
## global-router-interface.h (module 'internet'): ns3::GlobalRouter::GlobalRouter() [constructor]
|
||||
cls.add_constructor([])
|
||||
## global-router-interface.h (module 'internet'): void ns3::GlobalRouter::SetRoutingProtocol(ns3::Ptr<ns3::Ipv4GlobalRouting> routing) [member function]
|
||||
cls.add_method('SetRoutingProtocol',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Ipv4GlobalRouting >', 'routing')])
|
||||
## global-router-interface.h (module 'internet'): ns3::Ptr<ns3::Ipv4GlobalRouting> ns3::GlobalRouter::GetRoutingProtocol() [member function]
|
||||
cls.add_method('GetRoutingProtocol',
|
||||
'ns3::Ptr< ns3::Ipv4GlobalRouting >',
|
||||
[])
|
||||
## global-router-interface.h (module 'internet'): ns3::Ipv4Address ns3::GlobalRouter::GetRouterId() const [member function]
|
||||
cls.add_method('GetRouterId',
|
||||
'ns3::Ipv4Address',
|
||||
@@ -9058,22 +8951,10 @@ def register_Ns3GlobalRouter_methods(root_module, cls):
|
||||
'bool',
|
||||
[param('uint32_t', 'n'), param('ns3::GlobalRoutingLSA &', 'lsa')],
|
||||
is_const=True)
|
||||
## global-router-interface.h (module 'internet'): void ns3::GlobalRouter::InjectRoute(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask) [member function]
|
||||
## global-router-interface.h (module 'internet'): void ns3::GlobalRouter::InjectRoute(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t metric=1) [member function]
|
||||
cls.add_method('InjectRoute',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask')])
|
||||
## global-router-interface.h (module 'internet'): uint32_t ns3::GlobalRouter::GetNInjectedRoutes() [member function]
|
||||
cls.add_method('GetNInjectedRoutes',
|
||||
'uint32_t',
|
||||
[])
|
||||
## global-router-interface.h (module 'internet'): ns3::Ipv4RoutingTableEntry * ns3::GlobalRouter::GetInjectedRoute(uint32_t i) [member function]
|
||||
cls.add_method('GetInjectedRoute',
|
||||
retval('ns3::Ipv4RoutingTableEntry *', caller_owns_return=False),
|
||||
[param('uint32_t', 'i')])
|
||||
## global-router-interface.h (module 'internet'): void ns3::GlobalRouter::RemoveInjectedRoute(uint32_t i) [member function]
|
||||
cls.add_method('RemoveInjectedRoute',
|
||||
'void',
|
||||
[param('uint32_t', 'i')])
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'metric', default_value='1')])
|
||||
## global-router-interface.h (module 'internet'): bool ns3::GlobalRouter::WithdrawRoute(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask) [member function]
|
||||
cls.add_method('WithdrawRoute',
|
||||
'bool',
|
||||
@@ -12954,36 +12835,16 @@ def register_Ns3Ipv4GlobalRouting_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::Ipv4GlobalRouting const &', 'arg0')])
|
||||
## ipv4-global-routing.h (module 'internet'): ns3::Ipv4GlobalRouting::Ipv4GlobalRouting() [constructor]
|
||||
cls.add_constructor([])
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddASExternalRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
cls.add_method('AddASExternalRouteTo',
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Mask destMask, ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('AddRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
cls.add_method('AddHostRouteTo',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Mask', 'destMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::DeleteRoutes() [member function]
|
||||
cls.add_method('DeleteRoutes',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
|
||||
cls.add_method('AddHostRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
cls.add_method('AddNetworkRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
|
||||
cls.add_method('AddNetworkRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h (module 'internet'): uint32_t ns3::Ipv4GlobalRouting::GetNRoutes() const [member function]
|
||||
cls.add_method('GetNRoutes',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-global-routing.h (module 'internet'): ns3::Ipv4RoutingTableEntry * ns3::Ipv4GlobalRouting::GetRoute(uint32_t i) const [member function]
|
||||
cls.add_method('GetRoute',
|
||||
retval('ns3::Ipv4RoutingTableEntry *', caller_owns_return=False),
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): static ns3::TypeId ns3::Ipv4GlobalRouting::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
@@ -13009,34 +12870,62 @@ def register_Ns3Ipv4GlobalRouting_methods(root_module, cls):
|
||||
'void',
|
||||
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
|
||||
cls.add_method('PrintRoutingTable',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
|
||||
is_const=True, is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::RemoveRoute(uint32_t i) [member function]
|
||||
cls.add_method('RemoveRoute',
|
||||
'void',
|
||||
[param('uint32_t', 'i')])
|
||||
## ipv4-global-routing.h (module 'internet'): bool ns3::Ipv4GlobalRouting::RouteInput(ns3::Ptr<const ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<const ns3::NetDevice> idev, ns3::Callback<void,ns3::Ptr<ns3::Ipv4Route>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback<void,ns3::Ptr<ns3::Ipv4MulticastRoute>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,unsigned int,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> lcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::Socket::SocketErrno,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
|
||||
cls.add_method('RouteInput',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::Packet const >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice const >', 'idev'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4Route >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ucb'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4MulticastRoute >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'mcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'lcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4GlobalRouting::RouteOutput(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<ns3::NetDevice> oif, ns3::Socket::SocketErrno & sockerr) [member function]
|
||||
cls.add_method('RouteOutput',
|
||||
'ns3::Ptr< ns3::Ipv4Route >',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice >', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::SetIpv4(ns3::Ptr<ns3::Ipv4> ipv4) [member function]
|
||||
cls.add_method('SetIpv4',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Ipv4 >', 'ipv4')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4GlobalRoutingOneNexthop_methods(root_module, cls):
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ipv4GlobalRoutingOneNexthop::Ipv4GlobalRoutingOneNexthop() [constructor]
|
||||
cls.add_constructor([])
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ipv4GlobalRoutingOneNexthop::Ipv4GlobalRoutingOneNexthop(ns3::Ipv4GlobalRoutingOneNexthop const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4GlobalRoutingOneNexthop const &', 'arg0')])
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): void ns3::Ipv4GlobalRoutingOneNexthop::AddRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Mask destMask, ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('AddRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Mask', 'destMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): void ns3::Ipv4GlobalRoutingOneNexthop::DeleteRoutes() [member function]
|
||||
cls.add_method('DeleteRoutes',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): uint32_t ns3::Ipv4GlobalRoutingOneNexthop::GetNRoutes() const [member function]
|
||||
cls.add_method('GetNRoutes',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ipv4RoutingTableEntry ns3::Ipv4GlobalRoutingOneNexthop::GetRoute(uint32_t i) const [member function]
|
||||
cls.add_method('GetRoute',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): static ns3::TypeId ns3::Ipv4GlobalRoutingOneNexthop::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): void ns3::Ipv4GlobalRoutingOneNexthop::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
|
||||
cls.add_method('PrintRoutingTable',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
|
||||
is_const=True, is_virtual=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): bool ns3::Ipv4GlobalRoutingOneNexthop::RouteInput(ns3::Ptr<const ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<const ns3::NetDevice> idev, ns3::Callback<void,ns3::Ptr<ns3::Ipv4Route>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback<void,ns3::Ptr<ns3::Ipv4MulticastRoute>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,unsigned int,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> lcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::Socket::SocketErrno,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
|
||||
cls.add_method('RouteInput',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::Packet const >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice const >', 'idev'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4Route >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ucb'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4MulticastRoute >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'mcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'lcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4GlobalRoutingOneNexthop::RouteOutput(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<ns3::NetDevice> oif, ns3::Socket::SocketErrno & sockerr) [member function]
|
||||
cls.add_method('RouteOutput',
|
||||
'ns3::Ptr< ns3::Ipv4Route >',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice >', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4GlobalRoutingOneNexthop::LookupGlobal(ns3::Ipv4Address dest, ns3::Ptr<ns3::NetDevice> oif=0) [member function]
|
||||
cls.add_method('LookupGlobal',
|
||||
'ns3::Ptr< ns3::Ipv4Route >',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ptr< ns3::NetDevice >', 'oif', default_value='0')],
|
||||
visibility='protected', is_virtual=True)
|
||||
return
|
||||
|
||||
|
||||
@@ -110,6 +110,10 @@ def register_types(module):
|
||||
module.add_class('Ipv4AddressGenerator')
|
||||
## ipv4-address-helper.h (module 'internet'): ns3::Ipv4AddressHelper [class]
|
||||
module.add_class('Ipv4AddressHelper')
|
||||
## trie.h (module 'network'): ns3::Ipv4AddressTrieEAccessTraits [class]
|
||||
module.add_class('Ipv4AddressTrieEAccessTraits', import_from_module='ns.network')
|
||||
## trie.h (module 'network'): ns3::Ipv4AddressTrieEAccessTraits [enumeration]
|
||||
module.add_enum('', ['min_e_val', 'max_e_val', 'max_size'], outer_class=root_module['ns3::Ipv4AddressTrieEAccessTraits'], import_from_module='ns.network')
|
||||
## ipv4-end-point.h (module 'internet'): ns3::Ipv4EndPoint [class]
|
||||
module.add_class('Ipv4EndPoint')
|
||||
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress [class]
|
||||
@@ -200,8 +204,6 @@ def register_types(module):
|
||||
module.add_class('PcapHelperForIpv6', allow_subclassing=True)
|
||||
## random-variable.h (module 'core'): ns3::RandomVariable [class]
|
||||
module.add_class('RandomVariable', import_from_module='ns.core')
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory [class]
|
||||
module.add_class('RttHistory')
|
||||
## global-route-manager-impl.h (module 'internet'): ns3::SPFVertex [class]
|
||||
module.add_class('SPFVertex')
|
||||
## global-route-manager-impl.h (module 'internet'): ns3::SPFVertex::VertexType [enumeration]
|
||||
@@ -324,6 +326,8 @@ def register_types(module):
|
||||
module.add_class('InternetStackHelper', parent=[root_module['ns3::PcapHelperForIpv4'], root_module['ns3::PcapHelperForIpv6'], root_module['ns3::AsciiTraceHelperForIpv4'], root_module['ns3::AsciiTraceHelperForIpv6']])
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper [class]
|
||||
module.add_class('Ipv4GlobalRoutingHelper', parent=root_module['ns3::Ipv4RoutingHelper'])
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper::GlobalRoutingType [enumeration]
|
||||
module.add_enum('GlobalRoutingType', ['ONE_NEXT_HOP', 'ORDERED_NEXT_HOPS', 'UNORDERED_NEXT_HOPS'], outer_class=root_module['ns3::Ipv4GlobalRoutingHelper'])
|
||||
## ipv4-header.h (module 'internet'): ns3::Ipv4Header [class]
|
||||
module.add_class('Ipv4Header', parent=root_module['ns3::Header'])
|
||||
## ipv4-header.h (module 'internet'): ns3::Ipv4Header::DscpType [enumeration]
|
||||
@@ -372,10 +376,6 @@ def register_types(module):
|
||||
module.add_class('ParetoVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable'])
|
||||
## pcap-file-wrapper.h (module 'network'): ns3::PcapFileWrapper [class]
|
||||
module.add_class('PcapFileWrapper', import_from_module='ns.network', parent=root_module['ns3::Object'])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttEstimator [class]
|
||||
module.add_class('RttEstimator', parent=root_module['ns3::Object'])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttMeanDeviation [class]
|
||||
module.add_class('RttMeanDeviation', parent=root_module['ns3::RttEstimator'])
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class]
|
||||
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class]
|
||||
@@ -596,6 +596,8 @@ def register_types(module):
|
||||
module.add_class('Icmpv6L4Protocol', parent=root_module['ns3::IpL4Protocol'])
|
||||
## ipv4-global-routing.h (module 'internet'): ns3::Ipv4GlobalRouting [class]
|
||||
module.add_class('Ipv4GlobalRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ipv4GlobalRoutingOneNexthop [class]
|
||||
module.add_class('Ipv4GlobalRoutingOneNexthop', parent=root_module['ns3::Ipv4GlobalRouting'])
|
||||
## ipv4-list-routing.h (module 'internet'): ns3::Ipv4ListRouting [class]
|
||||
module.add_class('Ipv4ListRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
|
||||
## ipv6-list-routing.h (module 'internet'): ns3::Ipv6ListRouting [class]
|
||||
@@ -613,9 +615,6 @@ def register_types(module):
|
||||
typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >', 'ns3::SequenceNumber32')
|
||||
typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >*', 'ns3::SequenceNumber32*')
|
||||
typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >&', 'ns3::SequenceNumber32&')
|
||||
typehandlers.add_type_alias('std::deque< ns3::RttHistory, std::allocator< ns3::RttHistory > >', 'ns3::RttHistory_t')
|
||||
typehandlers.add_type_alias('std::deque< ns3::RttHistory, std::allocator< ns3::RttHistory > >*', 'ns3::RttHistory_t*')
|
||||
typehandlers.add_type_alias('std::deque< ns3::RttHistory, std::allocator< ns3::RttHistory > >&', 'ns3::RttHistory_t&')
|
||||
|
||||
## Register a nested module for the namespace FatalImpl
|
||||
|
||||
@@ -660,6 +659,7 @@ def register_methods(root_module):
|
||||
register_Ns3Ipv4Address_methods(root_module, root_module['ns3::Ipv4Address'])
|
||||
register_Ns3Ipv4AddressGenerator_methods(root_module, root_module['ns3::Ipv4AddressGenerator'])
|
||||
register_Ns3Ipv4AddressHelper_methods(root_module, root_module['ns3::Ipv4AddressHelper'])
|
||||
register_Ns3Ipv4AddressTrieEAccessTraits_methods(root_module, root_module['ns3::Ipv4AddressTrieEAccessTraits'])
|
||||
register_Ns3Ipv4EndPoint_methods(root_module, root_module['ns3::Ipv4EndPoint'])
|
||||
register_Ns3Ipv4InterfaceAddress_methods(root_module, root_module['ns3::Ipv4InterfaceAddress'])
|
||||
register_Ns3Ipv4InterfaceContainer_methods(root_module, root_module['ns3::Ipv4InterfaceContainer'])
|
||||
@@ -698,7 +698,6 @@ def register_methods(root_module):
|
||||
register_Ns3PcapHelperForIpv4_methods(root_module, root_module['ns3::PcapHelperForIpv4'])
|
||||
register_Ns3PcapHelperForIpv6_methods(root_module, root_module['ns3::PcapHelperForIpv6'])
|
||||
register_Ns3RandomVariable_methods(root_module, root_module['ns3::RandomVariable'])
|
||||
register_Ns3RttHistory_methods(root_module, root_module['ns3::RttHistory'])
|
||||
register_Ns3SPFVertex_methods(root_module, root_module['ns3::SPFVertex'])
|
||||
register_Ns3SeedManager_methods(root_module, root_module['ns3::SeedManager'])
|
||||
register_Ns3SequenceNumber32_methods(root_module, root_module['ns3::SequenceNumber32'])
|
||||
@@ -769,8 +768,6 @@ def register_methods(root_module):
|
||||
register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator'])
|
||||
register_Ns3ParetoVariable_methods(root_module, root_module['ns3::ParetoVariable'])
|
||||
register_Ns3PcapFileWrapper_methods(root_module, root_module['ns3::PcapFileWrapper'])
|
||||
register_Ns3RttEstimator_methods(root_module, root_module['ns3::RttEstimator'])
|
||||
register_Ns3RttMeanDeviation_methods(root_module, root_module['ns3::RttMeanDeviation'])
|
||||
register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >'])
|
||||
register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
|
||||
register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
|
||||
@@ -871,6 +868,7 @@ def register_methods(root_module):
|
||||
register_Ns3Icmpv4L4Protocol_methods(root_module, root_module['ns3::Icmpv4L4Protocol'])
|
||||
register_Ns3Icmpv6L4Protocol_methods(root_module, root_module['ns3::Icmpv6L4Protocol'])
|
||||
register_Ns3Ipv4GlobalRouting_methods(root_module, root_module['ns3::Ipv4GlobalRouting'])
|
||||
register_Ns3Ipv4GlobalRoutingOneNexthop_methods(root_module, root_module['ns3::Ipv4GlobalRoutingOneNexthop'])
|
||||
register_Ns3Ipv4ListRouting_methods(root_module, root_module['ns3::Ipv4ListRouting'])
|
||||
register_Ns3Ipv6ListRouting_methods(root_module, root_module['ns3::Ipv6ListRouting'])
|
||||
register_Ns3LoopbackNetDevice_methods(root_module, root_module['ns3::LoopbackNetDevice'])
|
||||
@@ -1360,10 +1358,6 @@ def register_Ns3BufferIterator_methods(root_module, cls):
|
||||
cls.add_method('Next',
|
||||
'void',
|
||||
[param('uint32_t', 'delta')])
|
||||
## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::PeekU8() [member function]
|
||||
cls.add_method('PeekU8',
|
||||
'uint8_t',
|
||||
[])
|
||||
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev() [member function]
|
||||
cls.add_method('Prev',
|
||||
'void',
|
||||
@@ -1376,10 +1370,6 @@ def register_Ns3BufferIterator_methods(root_module, cls):
|
||||
cls.add_method('Read',
|
||||
'void',
|
||||
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')])
|
||||
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(ns3::Buffer::Iterator start, uint32_t size) [member function]
|
||||
cls.add_method('Read',
|
||||
'void',
|
||||
[param('ns3::Buffer::Iterator', 'start'), param('uint32_t', 'size')])
|
||||
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadLsbtohU16() [member function]
|
||||
cls.add_method('ReadLsbtohU16',
|
||||
'uint16_t',
|
||||
@@ -1699,6 +1689,11 @@ def register_Ns3GlobalRouteManager_methods(root_module, cls):
|
||||
'void',
|
||||
[],
|
||||
is_static=True)
|
||||
## global-route-manager.h (module 'internet'): static void ns3::GlobalRouteManager::ClearLSDB() [member function]
|
||||
cls.add_method('ClearLSDB',
|
||||
'void',
|
||||
[],
|
||||
is_static=True)
|
||||
## global-route-manager.h (module 'internet'): static void ns3::GlobalRouteManager::BuildGlobalRoutingDatabase() [member function]
|
||||
cls.add_method('BuildGlobalRoutingDatabase',
|
||||
'void',
|
||||
@@ -1719,6 +1714,11 @@ def register_Ns3GlobalRouteManagerImpl_methods(root_module, cls):
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## global-route-manager-impl.h (module 'internet'): void ns3::GlobalRouteManagerImpl::ClearLSDB() [member function]
|
||||
cls.add_method('ClearLSDB',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## global-route-manager-impl.h (module 'internet'): void ns3::GlobalRouteManagerImpl::BuildGlobalRoutingDatabase() [member function]
|
||||
cls.add_method('BuildGlobalRoutingDatabase',
|
||||
'void',
|
||||
@@ -2004,9 +2004,9 @@ def register_Ns3Ipv4Address_methods(root_module, cls):
|
||||
'ns3::Ipv4Address',
|
||||
[param('uint8_t const *', 'buf')],
|
||||
is_static=True)
|
||||
## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Address::Get() const [member function]
|
||||
## ipv4-address.h (module 'network'): uint32_t const & ns3::Ipv4Address::Get() const [member function]
|
||||
cls.add_method('Get',
|
||||
'uint32_t',
|
||||
'uint32_t const &',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetAny() [member function]
|
||||
@@ -2161,6 +2161,28 @@ def register_Ns3Ipv4AddressHelper_methods(root_module, cls):
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'mask'), param('ns3::Ipv4Address', 'base', default_value='"0.0.0.1"')])
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4AddressTrieEAccessTraits_methods(root_module, cls):
|
||||
## trie.h (module 'network'): ns3::Ipv4AddressTrieEAccessTraits::Ipv4AddressTrieEAccessTraits() [constructor]
|
||||
cls.add_constructor([])
|
||||
## trie.h (module 'network'): ns3::Ipv4AddressTrieEAccessTraits::Ipv4AddressTrieEAccessTraits(ns3::Ipv4AddressTrieEAccessTraits const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4AddressTrieEAccessTraits const &', 'arg0')])
|
||||
## trie.h (module 'network'): static uint8_t const * ns3::Ipv4AddressTrieEAccessTraits::begin(ns3::Ipv4Address const & r_key) [member function]
|
||||
cls.add_method('begin',
|
||||
'uint8_t const *',
|
||||
[param('ns3::Ipv4Address const &', 'r_key')],
|
||||
is_static=True)
|
||||
## trie.h (module 'network'): static size_t ns3::Ipv4AddressTrieEAccessTraits::e_pos(uint8_t e) [member function]
|
||||
cls.add_method('e_pos',
|
||||
'size_t',
|
||||
[param('uint8_t', 'e')],
|
||||
is_static=True)
|
||||
## trie.h (module 'network'): static uint8_t const * ns3::Ipv4AddressTrieEAccessTraits::end(ns3::Ipv4Address const & r_key) [member function]
|
||||
cls.add_method('end',
|
||||
'uint8_t const *',
|
||||
[param('ns3::Ipv4Address const &', 'r_key')],
|
||||
is_static=True)
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4EndPoint_methods(root_module, cls):
|
||||
## ipv4-end-point.h (module 'internet'): ns3::Ipv4EndPoint::Ipv4EndPoint(ns3::Ipv4EndPoint const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4EndPoint const &', 'arg0')])
|
||||
@@ -2486,30 +2508,30 @@ def register_Ns3Ipv4RoutingTableEntry_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::Ipv4RoutingTableEntry const &', 'route')])
|
||||
## ipv4-routing-table-entry.h (module 'internet'): ns3::Ipv4RoutingTableEntry::Ipv4RoutingTableEntry(ns3::Ipv4RoutingTableEntry const * route) [constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4RoutingTableEntry const *', 'route')])
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('CreateDefaultRoute',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_static=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('CreateHostRouteTo',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_static=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('CreateHostRouteTo',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_static=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('CreateNetworkRouteTo',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_static=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
|
||||
## ipv4-routing-table-entry.h (module 'internet'): static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('CreateNetworkRouteTo',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')],
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_static=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4RoutingTableEntry::GetDest() const [member function]
|
||||
cls.add_method('GetDest',
|
||||
@@ -2536,6 +2558,11 @@ def register_Ns3Ipv4RoutingTableEntry_methods(root_module, cls):
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): uint32_t ns3::Ipv4RoutingTableEntry::GetMetric() const [member function]
|
||||
cls.add_method('GetMetric',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): bool ns3::Ipv4RoutingTableEntry::IsDefault() const [member function]
|
||||
cls.add_method('IsDefault',
|
||||
'bool',
|
||||
@@ -2556,6 +2583,10 @@ def register_Ns3Ipv4RoutingTableEntry_methods(root_module, cls):
|
||||
'bool',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-routing-table-entry.h (module 'internet'): void ns3::Ipv4RoutingTableEntry::SetMetric(uint32_t metric) [member function]
|
||||
cls.add_method('SetMetric',
|
||||
'void',
|
||||
[param('uint32_t', 'metric')])
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4StaticRoutingHelper_methods(root_module, cls):
|
||||
@@ -4001,21 +4032,6 @@ def register_Ns3RandomVariable_methods(root_module, cls):
|
||||
is_const=True)
|
||||
return
|
||||
|
||||
def register_Ns3RttHistory_methods(root_module, cls):
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::RttHistory(ns3::SequenceNumber32 s, uint32_t c, ns3::Time t) [constructor]
|
||||
cls.add_constructor([param('ns3::SequenceNumber32', 's'), param('uint32_t', 'c'), param('ns3::Time', 't')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::RttHistory(ns3::RttHistory const & h) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RttHistory const &', 'h')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::count [variable]
|
||||
cls.add_instance_attribute('count', 'uint32_t', is_const=False)
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::retx [variable]
|
||||
cls.add_instance_attribute('retx', 'bool', is_const=False)
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::seq [variable]
|
||||
cls.add_instance_attribute('seq', 'ns3::SequenceNumber32', is_const=False)
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::time [variable]
|
||||
cls.add_instance_attribute('time', 'ns3::Time', is_const=False)
|
||||
return
|
||||
|
||||
def register_Ns3SPFVertex_methods(root_module, cls):
|
||||
## global-route-manager-impl.h (module 'internet'): ns3::SPFVertex::SPFVertex() [constructor]
|
||||
cls.add_constructor([])
|
||||
@@ -4712,6 +4728,7 @@ def register_Ns3Empty_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right'))
|
||||
@@ -4764,7 +4781,6 @@ def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('<')
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_output_stream_operator()
|
||||
@@ -6165,8 +6181,8 @@ def register_Ns3InternetStackHelper_methods(root_module, cls):
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4GlobalRoutingHelper_methods(root_module, cls):
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper() [constructor]
|
||||
cls.add_constructor([])
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper(std::string const & type="ns3::Ipv4GlobalRoutingOneNexthop") [constructor]
|
||||
cls.add_constructor([param('std::string const &', 'type', default_value='"ns3::Ipv4GlobalRoutingOneNexthop"')])
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper(ns3::Ipv4GlobalRoutingHelper const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4GlobalRoutingHelper const &', 'arg0')])
|
||||
## ipv4-global-routing-helper.h (module 'internet'): ns3::Ipv4GlobalRoutingHelper * ns3::Ipv4GlobalRoutingHelper::Copy() const [member function]
|
||||
@@ -6184,6 +6200,11 @@ def register_Ns3Ipv4GlobalRoutingHelper_methods(root_module, cls):
|
||||
'void',
|
||||
[],
|
||||
is_static=True)
|
||||
## ipv4-global-routing-helper.h (module 'internet'): static void ns3::Ipv4GlobalRoutingHelper::PopulateAllPossibleRoutingTables() [member function]
|
||||
cls.add_method('PopulateAllPossibleRoutingTables',
|
||||
'void',
|
||||
[],
|
||||
is_static=True)
|
||||
## ipv4-global-routing-helper.h (module 'internet'): static void ns3::Ipv4GlobalRoutingHelper::RecomputeRoutingTables() [member function]
|
||||
cls.add_method('RecomputeRoutingTables',
|
||||
'void',
|
||||
@@ -7222,126 +7243,6 @@ def register_Ns3PcapFileWrapper_methods(root_module, cls):
|
||||
[])
|
||||
return
|
||||
|
||||
def register_Ns3RttEstimator_methods(root_module, cls):
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttEstimator::RttEstimator() [constructor]
|
||||
cls.add_constructor([])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttEstimator::RttEstimator(ns3::RttEstimator const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RttEstimator const &', 'arg0')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::AckSeq(ns3::SequenceNumber32 ackSeq) [member function]
|
||||
cls.add_method('AckSeq',
|
||||
'ns3::Time',
|
||||
[param('ns3::SequenceNumber32', 'ackSeq')],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::ClearSent() [member function]
|
||||
cls.add_method('ClearSent',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Ptr<ns3::RttEstimator> ns3::RttEstimator::Copy() const [member function]
|
||||
cls.add_method('Copy',
|
||||
'ns3::Ptr< ns3::RttEstimator >',
|
||||
[],
|
||||
is_pure_virtual=True, is_const=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetCurrentEstimate() const [member function]
|
||||
cls.add_method('GetCurrentEstimate',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetMaxRto() const [member function]
|
||||
cls.add_method('GetMaxRto',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetMinRto() const [member function]
|
||||
cls.add_method('GetMinRto',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## rtt-estimator.h (module 'internet'): static ns3::TypeId ns3::RttEstimator::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::IncreaseMultiplier() [member function]
|
||||
cls.add_method('IncreaseMultiplier',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::Measurement(ns3::Time t) [member function]
|
||||
cls.add_method('Measurement',
|
||||
'void',
|
||||
[param('ns3::Time', 't')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::Reset() [member function]
|
||||
cls.add_method('Reset',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::ResetMultiplier() [member function]
|
||||
cls.add_method('ResetMultiplier',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::RetransmitTimeout() [member function]
|
||||
cls.add_method('RetransmitTimeout',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SentSeq(ns3::SequenceNumber32 seq, uint32_t size) [member function]
|
||||
cls.add_method('SentSeq',
|
||||
'void',
|
||||
[param('ns3::SequenceNumber32', 'seq'), param('uint32_t', 'size')],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetCurrentEstimate(ns3::Time estimate) [member function]
|
||||
cls.add_method('SetCurrentEstimate',
|
||||
'void',
|
||||
[param('ns3::Time', 'estimate')])
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetMaxRto(ns3::Time maxRto) [member function]
|
||||
cls.add_method('SetMaxRto',
|
||||
'void',
|
||||
[param('ns3::Time', 'maxRto')])
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetMinRto(ns3::Time minRto) [member function]
|
||||
cls.add_method('SetMinRto',
|
||||
'void',
|
||||
[param('ns3::Time', 'minRto')])
|
||||
return
|
||||
|
||||
def register_Ns3RttMeanDeviation_methods(root_module, cls):
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttMeanDeviation::RttMeanDeviation() [constructor]
|
||||
cls.add_constructor([])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttMeanDeviation::RttMeanDeviation(ns3::RttMeanDeviation const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RttMeanDeviation const &', 'arg0')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::Ptr<ns3::RttEstimator> ns3::RttMeanDeviation::Copy() const [member function]
|
||||
cls.add_method('Copy',
|
||||
'ns3::Ptr< ns3::RttEstimator >',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttMeanDeviation::Gain(double g) [member function]
|
||||
cls.add_method('Gain',
|
||||
'void',
|
||||
[param('double', 'g')])
|
||||
## rtt-estimator.h (module 'internet'): static ns3::TypeId ns3::RttMeanDeviation::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttMeanDeviation::Measurement(ns3::Time measure) [member function]
|
||||
cls.add_method('Measurement',
|
||||
'void',
|
||||
[param('ns3::Time', 'measure')],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttMeanDeviation::Reset() [member function]
|
||||
cls.add_method('Reset',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttMeanDeviation::RetransmitTimeout() [member function]
|
||||
cls.add_method('RetransmitTimeout',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, cls):
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount() [constructor]
|
||||
cls.add_constructor([])
|
||||
@@ -8162,11 +8063,11 @@ def register_Ns3TcpSocketFactory_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Time_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_comparison_operator('<')
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', 'right'))
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_comparison_operator('<=')
|
||||
@@ -9031,14 +8932,6 @@ def register_Ns3GlobalRouter_methods(root_module, cls):
|
||||
is_static=True)
|
||||
## global-router-interface.h (module 'internet'): ns3::GlobalRouter::GlobalRouter() [constructor]
|
||||
cls.add_constructor([])
|
||||
## global-router-interface.h (module 'internet'): void ns3::GlobalRouter::SetRoutingProtocol(ns3::Ptr<ns3::Ipv4GlobalRouting> routing) [member function]
|
||||
cls.add_method('SetRoutingProtocol',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Ipv4GlobalRouting >', 'routing')])
|
||||
## global-router-interface.h (module 'internet'): ns3::Ptr<ns3::Ipv4GlobalRouting> ns3::GlobalRouter::GetRoutingProtocol() [member function]
|
||||
cls.add_method('GetRoutingProtocol',
|
||||
'ns3::Ptr< ns3::Ipv4GlobalRouting >',
|
||||
[])
|
||||
## global-router-interface.h (module 'internet'): ns3::Ipv4Address ns3::GlobalRouter::GetRouterId() const [member function]
|
||||
cls.add_method('GetRouterId',
|
||||
'ns3::Ipv4Address',
|
||||
@@ -9058,22 +8951,10 @@ def register_Ns3GlobalRouter_methods(root_module, cls):
|
||||
'bool',
|
||||
[param('uint32_t', 'n'), param('ns3::GlobalRoutingLSA &', 'lsa')],
|
||||
is_const=True)
|
||||
## global-router-interface.h (module 'internet'): void ns3::GlobalRouter::InjectRoute(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask) [member function]
|
||||
## global-router-interface.h (module 'internet'): void ns3::GlobalRouter::InjectRoute(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t metric=1) [member function]
|
||||
cls.add_method('InjectRoute',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask')])
|
||||
## global-router-interface.h (module 'internet'): uint32_t ns3::GlobalRouter::GetNInjectedRoutes() [member function]
|
||||
cls.add_method('GetNInjectedRoutes',
|
||||
'uint32_t',
|
||||
[])
|
||||
## global-router-interface.h (module 'internet'): ns3::Ipv4RoutingTableEntry * ns3::GlobalRouter::GetInjectedRoute(uint32_t i) [member function]
|
||||
cls.add_method('GetInjectedRoute',
|
||||
retval('ns3::Ipv4RoutingTableEntry *', caller_owns_return=False),
|
||||
[param('uint32_t', 'i')])
|
||||
## global-router-interface.h (module 'internet'): void ns3::GlobalRouter::RemoveInjectedRoute(uint32_t i) [member function]
|
||||
cls.add_method('RemoveInjectedRoute',
|
||||
'void',
|
||||
[param('uint32_t', 'i')])
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'metric', default_value='1')])
|
||||
## global-router-interface.h (module 'internet'): bool ns3::GlobalRouter::WithdrawRoute(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask) [member function]
|
||||
cls.add_method('WithdrawRoute',
|
||||
'bool',
|
||||
@@ -12954,36 +12835,16 @@ def register_Ns3Ipv4GlobalRouting_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::Ipv4GlobalRouting const &', 'arg0')])
|
||||
## ipv4-global-routing.h (module 'internet'): ns3::Ipv4GlobalRouting::Ipv4GlobalRouting() [constructor]
|
||||
cls.add_constructor([])
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddASExternalRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
cls.add_method('AddASExternalRouteTo',
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Mask destMask, ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('AddRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
cls.add_method('AddHostRouteTo',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Mask', 'destMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::DeleteRoutes() [member function]
|
||||
cls.add_method('DeleteRoutes',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
|
||||
cls.add_method('AddHostRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
cls.add_method('AddNetworkRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
|
||||
cls.add_method('AddNetworkRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')])
|
||||
## ipv4-global-routing.h (module 'internet'): uint32_t ns3::Ipv4GlobalRouting::GetNRoutes() const [member function]
|
||||
cls.add_method('GetNRoutes',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-global-routing.h (module 'internet'): ns3::Ipv4RoutingTableEntry * ns3::Ipv4GlobalRouting::GetRoute(uint32_t i) const [member function]
|
||||
cls.add_method('GetRoute',
|
||||
retval('ns3::Ipv4RoutingTableEntry *', caller_owns_return=False),
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): static ns3::TypeId ns3::Ipv4GlobalRouting::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
@@ -13009,34 +12870,62 @@ def register_Ns3Ipv4GlobalRouting_methods(root_module, cls):
|
||||
'void',
|
||||
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
|
||||
cls.add_method('PrintRoutingTable',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
|
||||
is_const=True, is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::RemoveRoute(uint32_t i) [member function]
|
||||
cls.add_method('RemoveRoute',
|
||||
'void',
|
||||
[param('uint32_t', 'i')])
|
||||
## ipv4-global-routing.h (module 'internet'): bool ns3::Ipv4GlobalRouting::RouteInput(ns3::Ptr<const ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<const ns3::NetDevice> idev, ns3::Callback<void,ns3::Ptr<ns3::Ipv4Route>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback<void,ns3::Ptr<ns3::Ipv4MulticastRoute>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,unsigned int,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> lcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::Socket::SocketErrno,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
|
||||
cls.add_method('RouteInput',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::Packet const >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice const >', 'idev'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4Route >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ucb'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4MulticastRoute >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'mcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'lcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4GlobalRouting::RouteOutput(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<ns3::NetDevice> oif, ns3::Socket::SocketErrno & sockerr) [member function]
|
||||
cls.add_method('RouteOutput',
|
||||
'ns3::Ptr< ns3::Ipv4Route >',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice >', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::SetIpv4(ns3::Ptr<ns3::Ipv4> ipv4) [member function]
|
||||
cls.add_method('SetIpv4',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Ipv4 >', 'ipv4')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing.h (module 'internet'): void ns3::Ipv4GlobalRouting::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4GlobalRoutingOneNexthop_methods(root_module, cls):
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ipv4GlobalRoutingOneNexthop::Ipv4GlobalRoutingOneNexthop() [constructor]
|
||||
cls.add_constructor([])
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ipv4GlobalRoutingOneNexthop::Ipv4GlobalRoutingOneNexthop(ns3::Ipv4GlobalRoutingOneNexthop const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4GlobalRoutingOneNexthop const &', 'arg0')])
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): void ns3::Ipv4GlobalRoutingOneNexthop::AddRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Mask destMask, ns3::Ipv4Address nextHop, uint32_t interface, uint32_t metric=0) [member function]
|
||||
cls.add_method('AddRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Mask', 'destMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface'), param('uint32_t', 'metric', default_value='0')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): void ns3::Ipv4GlobalRoutingOneNexthop::DeleteRoutes() [member function]
|
||||
cls.add_method('DeleteRoutes',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): uint32_t ns3::Ipv4GlobalRoutingOneNexthop::GetNRoutes() const [member function]
|
||||
cls.add_method('GetNRoutes',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ipv4RoutingTableEntry ns3::Ipv4GlobalRoutingOneNexthop::GetRoute(uint32_t i) const [member function]
|
||||
cls.add_method('GetRoute',
|
||||
'ns3::Ipv4RoutingTableEntry',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): static ns3::TypeId ns3::Ipv4GlobalRoutingOneNexthop::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): void ns3::Ipv4GlobalRoutingOneNexthop::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
|
||||
cls.add_method('PrintRoutingTable',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
|
||||
is_const=True, is_virtual=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): bool ns3::Ipv4GlobalRoutingOneNexthop::RouteInput(ns3::Ptr<const ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<const ns3::NetDevice> idev, ns3::Callback<void,ns3::Ptr<ns3::Ipv4Route>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback<void,ns3::Ptr<ns3::Ipv4MulticastRoute>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,unsigned int,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> lcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::Socket::SocketErrno,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
|
||||
cls.add_method('RouteInput',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::Packet const >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice const >', 'idev'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4Route >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ucb'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4MulticastRoute >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'mcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'lcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4GlobalRoutingOneNexthop::RouteOutput(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<ns3::NetDevice> oif, ns3::Socket::SocketErrno & sockerr) [member function]
|
||||
cls.add_method('RouteOutput',
|
||||
'ns3::Ptr< ns3::Ipv4Route >',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice >', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')],
|
||||
is_virtual=True)
|
||||
## ipv4-global-routing-one-nexthop.h (module 'internet'): ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4GlobalRoutingOneNexthop::LookupGlobal(ns3::Ipv4Address dest, ns3::Ptr<ns3::NetDevice> oif=0) [member function]
|
||||
cls.add_method('LookupGlobal',
|
||||
'ns3::Ptr< ns3::Ipv4Route >',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ptr< ns3::NetDevice >', 'oif', default_value='0')],
|
||||
visibility='protected', is_virtual=True)
|
||||
return
|
||||
|
||||
|
||||
@@ -186,7 +186,6 @@ private:
|
||||
* @param prefix Filename prefix to use for pcap files.
|
||||
* @param ipv4 Ptr to the Ipv4 interface on which you want to enable tracing.
|
||||
* @param interface Interface ID on the Ipv4 on which you want to enable tracing.
|
||||
* @param explicitFilename Treat the prefix as an explicit filename if true
|
||||
*/
|
||||
virtual void EnablePcapIpv4Internal (std::string prefix,
|
||||
Ptr<Ipv4> ipv4,
|
||||
@@ -202,7 +201,6 @@ private:
|
||||
* @param prefix Filename prefix to use for ascii trace files.
|
||||
* @param ipv4 Ptr to the Ipv4 interface on which you want to enable tracing.
|
||||
* @param interface Interface ID on the Ipv4 on which you want to enable tracing.
|
||||
* @param explicitFilename Treat the prefix as an explicit filename if true
|
||||
*/
|
||||
virtual void EnableAsciiIpv4Internal (Ptr<OutputStreamWrapper> stream,
|
||||
std::string prefix,
|
||||
@@ -217,7 +215,6 @@ private:
|
||||
* @param prefix Filename prefix to use for pcap files.
|
||||
* @param ipv6 Ptr to the Ipv6 interface on which you want to enable tracing.
|
||||
* @param interface Interface ID on the Ipv6 on which you want to enable tracing.
|
||||
* @param explicitFilename Treat the prefix as an explicit filename if true
|
||||
*/
|
||||
virtual void EnablePcapIpv6Internal (std::string prefix,
|
||||
Ptr<Ipv6> ipv6,
|
||||
@@ -233,7 +230,6 @@ private:
|
||||
* @param prefix Filename prefix to use for ascii trace files.
|
||||
* @param ipv6 Ptr to the Ipv6 interface on which you want to enable tracing.
|
||||
* @param interface Interface ID on the Ipv6 on which you want to enable tracing.
|
||||
* @param explicitFilename Treat the prefix as an explicit filename if true
|
||||
*/
|
||||
virtual void EnableAsciiIpv6Internal (Ptr<OutputStreamWrapper> stream,
|
||||
std::string prefix,
|
||||
|
||||
@@ -20,18 +20,24 @@
|
||||
#include "ipv4-global-routing-helper.h"
|
||||
#include "ns3/global-router-interface.h"
|
||||
#include "ns3/ipv4-global-routing.h"
|
||||
#include "ns3/ipv4-global-routing-one-nexthop.h"
|
||||
#include "ns3/ipv4-list-routing.h"
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/node-list.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("GlobalRoutingHelper");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper ()
|
||||
UniformVariable Ipv4GlobalRoutingHelper::m_rand;
|
||||
|
||||
Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper (const std::string &type/* = "ns3::Ipv4GlobalRoutingOneNexthop"*/)
|
||||
: m_type (type)
|
||||
{
|
||||
}
|
||||
|
||||
Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper (const Ipv4GlobalRoutingHelper &o)
|
||||
: m_type (o.m_type)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -51,8 +57,10 @@ Ipv4GlobalRoutingHelper::Create (Ptr<Node> node) const
|
||||
node->AggregateObject (globalRouter);
|
||||
|
||||
NS_LOG_LOGIC ("Adding GlobalRouting Protocol to node " << node->GetId ());
|
||||
Ptr<Ipv4GlobalRouting> globalRouting = CreateObject<Ipv4GlobalRouting> ();
|
||||
globalRouter->SetRoutingProtocol (globalRouting);
|
||||
|
||||
ObjectFactory factory;
|
||||
factory.SetTypeId (m_type);
|
||||
Ptr<Ipv4GlobalRouting> globalRouting = DynamicCast<Ipv4GlobalRouting> (factory.Create<Object> ());
|
||||
|
||||
return globalRouting;
|
||||
}
|
||||
@@ -63,6 +71,101 @@ Ipv4GlobalRoutingHelper::PopulateRoutingTables (void)
|
||||
GlobalRouteManager::BuildGlobalRoutingDatabase ();
|
||||
GlobalRouteManager::InitializeRoutes ();
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4GlobalRoutingHelper::PopulateAllPossibleRoutingTables (void)
|
||||
{
|
||||
NodeList::Iterator listEnd = NodeList::End ();
|
||||
for (NodeList::Iterator node = NodeList::Begin (); node != listEnd; node++)
|
||||
{
|
||||
// if ((*node)->GetId ()!=3) continue;
|
||||
|
||||
Ptr<Ipv4> ipv4 = (*node)->GetObject<Ipv4> ();
|
||||
NS_ASSERT (ipv4 != 0);
|
||||
|
||||
// remember interface statuses
|
||||
std::vector<uint16_t> originalMetric (ipv4->GetNInterfaces ());
|
||||
for (uint32_t iface = 1; iface < ipv4->GetNInterfaces (); iface++)
|
||||
{
|
||||
originalMetric[iface] = ipv4->GetMetric (iface);
|
||||
}
|
||||
|
||||
// enable interfaces one by one and calculate routes
|
||||
for (uint32_t enabledInterface = 1; enabledInterface < ipv4->GetNInterfaces (); enabledInterface++)
|
||||
{
|
||||
NS_LOG_ERROR ("Enabled interface: " << enabledInterface);
|
||||
|
||||
for (uint32_t iface = 1; iface < ipv4->GetNInterfaces (); iface++)
|
||||
{
|
||||
ipv4->SetMetric (iface, UINT16_MAX);
|
||||
}
|
||||
ipv4->SetMetric (enabledInterface, originalMetric[enabledInterface]);
|
||||
|
||||
GlobalRouteManager::ClearLSDB ();
|
||||
GlobalRouteManager::BuildGlobalRoutingDatabase ();
|
||||
GlobalRouteManager::InitializeRoutes ();
|
||||
}
|
||||
|
||||
// restore original interface statuses
|
||||
for (uint32_t iface = 1; iface < ipv4->GetNInterfaces (); iface++)
|
||||
{
|
||||
ipv4->SetMetric (iface, originalMetric[iface]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// void
|
||||
// Ipv4GlobalRoutingHelper::PopulateAllPossibleRoutingTables (void)
|
||||
// {
|
||||
// for (int xx = 0; xx < 100; xx++)
|
||||
// {
|
||||
// for (NodeList::Iterator node = NodeList::Begin (); node != NodeList::End (); node++)
|
||||
// {
|
||||
// Ptr<Ipv4> ipv4 = (*node)->GetObject<Ipv4> ();
|
||||
// NS_ASSERT (ipv4 != 0);
|
||||
|
||||
// // // remember interface statuses
|
||||
// // std::vector<uint16_t> originalMetric (ipv4->GetNInterfaces ());
|
||||
// // for (uint32_t iface = 1; iface < ipv4->GetNInterfaces (); iface++)
|
||||
// // {
|
||||
// // originalMetric[iface] = ipv4->GetMetric (iface);
|
||||
// // }
|
||||
|
||||
// // enable interfaces one by one and calculate routes
|
||||
// // for (uint32_t enabledInterface = 1; enabledInterface < ipv4->GetNInterfaces (); enabledInterface++)
|
||||
// // {
|
||||
// // NS_LOG_ERROR ("Enabled interface: " << enabledInterface);
|
||||
|
||||
// for (uint32_t iface = 1; iface < ipv4->GetNInterfaces (); iface++)
|
||||
// {
|
||||
// ipv4->SetMetric (iface, m_rand.GetInteger (1, 500));
|
||||
// }
|
||||
// // ipv4->SetMetric (enabledInterface, originalMetric[enabledInterface]);
|
||||
|
||||
// // }
|
||||
|
||||
// // // restore original interface statuses
|
||||
// // for (uint32_t iface = 1; iface < ipv4->GetNInterfaces (); iface++)
|
||||
// // {
|
||||
// // ipv4->SetMetric (iface, originalMetric[iface]);
|
||||
// // }
|
||||
// }
|
||||
// GlobalRouteManager::ClearLSDB ();
|
||||
// GlobalRouteManager::BuildGlobalRoutingDatabase ();
|
||||
// GlobalRouteManager::InitializeRoutes ();
|
||||
|
||||
// // Ptr<GlobalRouter> rtr =
|
||||
// // (*node)->GetObject<GlobalRouter> ();
|
||||
|
||||
// // if (rtr && rtr->GetNumLSAs () )
|
||||
// // {
|
||||
// // SimulationSingleton<GlobalRouteManagerImpl>::Get ()->
|
||||
// // SPFCalculate (rtr->GetRouterId ());
|
||||
// // }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
void
|
||||
Ipv4GlobalRoutingHelper::RecomputeRoutingTables (void)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "ns3/node-container.h"
|
||||
#include "ns3/ipv4-routing-helper.h"
|
||||
#include "ns3/random-variable.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -31,11 +32,18 @@ namespace ns3 {
|
||||
class Ipv4GlobalRoutingHelper : public Ipv4RoutingHelper
|
||||
{
|
||||
public:
|
||||
enum GlobalRoutingType
|
||||
{ ONE_NEXT_HOP = 0,
|
||||
ORDERED_NEXT_HOPS = 1,
|
||||
UNORDERED_NEXT_HOPS = 2};
|
||||
|
||||
/**
|
||||
* \brief Construct a GlobalRoutingHelper to make life easier for managing
|
||||
* global routing tasks.
|
||||
*
|
||||
* param type Type of the global routing
|
||||
*/
|
||||
Ipv4GlobalRoutingHelper ();
|
||||
Ipv4GlobalRoutingHelper (const std::string &type = "ns3::Ipv4GlobalRoutingOneNexthop");
|
||||
|
||||
/**
|
||||
* \brief Construct a GlobalRoutingHelper from another previously initialized
|
||||
@@ -70,6 +78,8 @@ public:
|
||||
*
|
||||
*/
|
||||
static void PopulateRoutingTables (void);
|
||||
|
||||
static void PopulateAllPossibleRoutingTables ();
|
||||
/**
|
||||
* \brief Remove all routes that were previously installed in a prior call
|
||||
* to either PopulateRoutingTables() or RecomputeRoutingTables(), and
|
||||
@@ -90,6 +100,10 @@ private:
|
||||
* assignment and prevent the compiler from happily inserting its own.
|
||||
*/
|
||||
Ipv4GlobalRoutingHelper &operator = (const Ipv4GlobalRoutingHelper &o);
|
||||
|
||||
std::string m_type;
|
||||
|
||||
static UniformVariable m_rand;
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
* \returns a newly-created routing protocol
|
||||
*/
|
||||
virtual Ptr<Ipv4RoutingProtocol> Create (Ptr<Node> node) const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* \brief prints the routing tables of all nodes at a particular time.
|
||||
* \param printTime the time at which the routing table is supposed to be printed.
|
||||
@@ -135,12 +135,12 @@ Ptr<T> Ipv4RoutingHelper::GetRouting (Ptr<Ipv4RoutingProtocol> protocol)
|
||||
// trying to check if protocol is a list routing
|
||||
Ptr<Ipv4ListRouting> lrp = DynamicCast<Ipv4ListRouting> (protocol);
|
||||
if (lrp != 0)
|
||||
{
|
||||
for (uint32_t i = 0; i < lrp->GetNRoutingProtocols (); i++)
|
||||
{
|
||||
for (uint32_t i = 0; i < lrp->GetNRoutingProtocols (); i++)
|
||||
{
|
||||
int16_t priority;
|
||||
int16_t priority;
|
||||
ret = GetRouting<T> (lrp->GetRoutingProtocol (i, priority)); // potential recursion, if inside ListRouting is ListRouting
|
||||
if (ret != 0)
|
||||
if (ret != 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "ns3/ipv4-routing-protocol.h"
|
||||
#include "ns3/ipv4-list-routing.h"
|
||||
#include "ns3/mpi-interface.h"
|
||||
#include "ns3/ipv4-routing-helper.h"
|
||||
#include "global-router-interface.h"
|
||||
#include "global-route-manager-impl.h"
|
||||
#include "candidate-queue.h"
|
||||
@@ -566,19 +567,15 @@ GlobalRouteManagerImpl::DeleteGlobalRoutes ()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Ptr<Ipv4GlobalRouting> gr = router->GetRoutingProtocol ();
|
||||
uint32_t j = 0;
|
||||
uint32_t nRoutes = gr->GetNRoutes ();
|
||||
NS_LOG_LOGIC ("Deleting " << gr->GetNRoutes ()<< " routes from node " << node->GetId ());
|
||||
// Each time we delete route 0, the route index shifts downward
|
||||
// We can delete all routes if we delete the route numbered 0
|
||||
// nRoutes times
|
||||
for (j = 0; j < nRoutes; j++)
|
||||
{
|
||||
NS_LOG_LOGIC ("Deleting global route " << j << " from node " << node->GetId ());
|
||||
gr->RemoveRoute (0);
|
||||
}
|
||||
NS_LOG_LOGIC ("Deleted " << j << " global routes from node "<< node->GetId ());
|
||||
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
|
||||
NS_ASSERT_MSG (ipv4 != 0, "GlobalRouteManagerImpl requires IPv4 stack to be installed on the node");
|
||||
|
||||
Ptr<Ipv4GlobalRouting> gr = Ipv4RoutingHelper::
|
||||
GetRouting<Ipv4GlobalRouting> (ipv4->GetRoutingProtocol ());
|
||||
|
||||
NS_ASSERT_MSG (gr != 0, "GlobalRouteManagerImpl needs an instance of Ipv4GlobalRouting to be installed on the node");
|
||||
|
||||
gr->DeleteRoutes ();
|
||||
}
|
||||
if (m_lsdb)
|
||||
{
|
||||
@@ -588,6 +585,14 @@ GlobalRouteManagerImpl::DeleteGlobalRoutes ()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GlobalRouteManagerImpl::ClearLSDB ()
|
||||
{
|
||||
NS_LOG_LOGIC ("Deleting LSDB, creating new one");
|
||||
delete m_lsdb;
|
||||
m_lsdb = new GlobalRouteManagerLSDB ();
|
||||
}
|
||||
|
||||
//
|
||||
// In order to build the routing database, we need to walk the list of nodes
|
||||
// in the system and look for those that support the GlobalRouter interface.
|
||||
@@ -626,7 +631,14 @@ GlobalRouteManagerImpl::BuildGlobalRoutingDatabase ()
|
||||
// DiscoverLSAs () will get zero as the number since no routes have been
|
||||
// found.
|
||||
//
|
||||
Ptr<Ipv4GlobalRouting> grouting = rtr->GetRoutingProtocol ();
|
||||
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
|
||||
NS_ASSERT_MSG (ipv4 != 0, "GlobalRouteManagerImpl requires IPv4 stack to be installed on the node");
|
||||
|
||||
Ptr<Ipv4GlobalRouting> grouting = Ipv4RoutingHelper::
|
||||
GetRouting<Ipv4GlobalRouting> (ipv4->GetRoutingProtocol ());
|
||||
|
||||
NS_ASSERT_MSG (grouting != 0, "GlobalRouteManagerImpl needs an instance of Ipv4GlobalRouting to be installed on the node");
|
||||
|
||||
uint32_t numLSAs = rtr->DiscoverLSAs ();
|
||||
NS_LOG_LOGIC ("Found " << numLSAs << " LSAs");
|
||||
|
||||
@@ -692,6 +704,7 @@ GlobalRouteManagerImpl::InitializeRoutes ()
|
||||
for (NodeList::Iterator i = NodeList::Begin (); i != listEnd; i++)
|
||||
{
|
||||
Ptr<Node> node = *i;
|
||||
|
||||
//
|
||||
// Look for the GlobalRouter interface that indicates that the node is
|
||||
// participating in routing.
|
||||
@@ -876,7 +889,7 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate)
|
||||
else if (w_lsa->GetStatus () == GlobalRoutingLSA::LSA_SPF_CANDIDATE)
|
||||
{
|
||||
//
|
||||
// We have already considered the link represented by <w>. What wse have to
|
||||
// We have already considered the link represented by <w>. What we have to
|
||||
// do now is to decide if this new router represents a route with a shorter
|
||||
// distance metric.
|
||||
//
|
||||
@@ -1305,12 +1318,15 @@ GlobalRouteManagerImpl::CheckForStubNode (Ipv4Address root)
|
||||
if (lr->GetLinkId () == myRouterId)
|
||||
{
|
||||
// Next hop is stored in the LinkID field of lr
|
||||
Ptr<GlobalRouter> router = rlsa->GetNode ()->GetObject<GlobalRouter> ();
|
||||
NS_ASSERT (router);
|
||||
Ptr<Ipv4GlobalRouting> gr = router->GetRoutingProtocol ();
|
||||
NS_ASSERT (gr);
|
||||
gr->AddNetworkRouteTo (Ipv4Address ("0.0.0.0"), Ipv4Mask ("0.0.0.0"), lr->GetLinkData (),
|
||||
FindOutgoingInterfaceId (transitLink->GetLinkData ()));
|
||||
Ptr<Ipv4> ipv4 = rlsa->GetNode ()->GetObject<Ipv4> ();
|
||||
NS_ASSERT_MSG (ipv4 != 0, "GlobalRouteManagerImpl requires IPv4 stack to be installed on the node");
|
||||
|
||||
Ptr<Ipv4GlobalRouting> gr = Ipv4RoutingHelper::
|
||||
GetRouting<Ipv4GlobalRouting> (ipv4->GetRoutingProtocol ());
|
||||
|
||||
NS_ASSERT_MSG (gr != 0, "GlobalRouteManagerImpl needs an instance of Ipv4GlobalRouting to be installed on the node");
|
||||
gr->AddRouteTo (Ipv4Address ("0.0.0.0"), Ipv4Mask ("0.0.0.0"), lr->GetLinkData (),
|
||||
FindOutgoingInterfaceId (transitLink->GetLinkData ()));
|
||||
NS_LOG_LOGIC ("Inserting default route for node " << myRouterId << " to next hop " <<
|
||||
lr->GetLinkData () << " via interface " <<
|
||||
FindOutgoingInterfaceId (transitLink->GetLinkData ()));
|
||||
@@ -1329,11 +1345,8 @@ GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root)
|
||||
NS_LOG_FUNCTION (this << root);
|
||||
|
||||
SPFVertex *v;
|
||||
//
|
||||
// Initialize the Link State Database.
|
||||
//
|
||||
m_lsdb->Initialize ();
|
||||
//
|
||||
|
||||
//
|
||||
// The candidate queue is a priority queue of SPFVertex objects, with the top
|
||||
// of the queue being the closest vertex in terms of distance from the root
|
||||
// of the tree. Initially, this queue is empty.
|
||||
@@ -1351,105 +1364,115 @@ GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root)
|
||||
// We also mark this vertex as being in the SPF tree.
|
||||
//
|
||||
m_spfroot= v;
|
||||
|
||||
NS_ASSERT_MSG (m_spfroot->GetVertexType () == SPFVertex::VertexRouter,
|
||||
"Root node has to be router");
|
||||
|
||||
|
||||
//
|
||||
// Initialize the Link State Database.
|
||||
//
|
||||
m_lsdb->Initialize ();
|
||||
|
||||
v->SetDistanceFromRoot (0);
|
||||
v->GetLSA ()->SetStatus (GlobalRoutingLSA::LSA_SPF_IN_SPFTREE);
|
||||
NS_LOG_LOGIC ("Starting SPFCalculate for node " << root);
|
||||
|
||||
//
|
||||
// Optimize SPF calculation, for ns-3.
|
||||
// We do not need to calculate SPF for every node in the network if this
|
||||
// node has only one interface through which another router can be
|
||||
// reached. Instead, short-circuit this computation and just install
|
||||
// a default route in the CheckForStubNode() method.
|
||||
//
|
||||
if (NodeList::GetNNodes () > 0 && CheckForStubNode (root))
|
||||
{
|
||||
NS_LOG_LOGIC ("SPFCalculate truncated for stub node " << root);
|
||||
delete m_spfroot;
|
||||
return;
|
||||
}
|
||||
//
|
||||
// Optimize SPF calculation, for ns-3.
|
||||
// We do not need to calculate SPF for every node in the network if this
|
||||
// node has only one interface through which another router can be
|
||||
// reached. Instead, short-circuit this computation and just install
|
||||
// a default route in the CheckForStubNode() method.
|
||||
//
|
||||
// if (NodeList::GetNNodes () > 0 && CheckForStubNode (root))
|
||||
// {
|
||||
// NS_LOG_LOGIC ("SPFCalculate truncated for stub node " << root);
|
||||
// delete m_spfroot;
|
||||
// return;
|
||||
// }
|
||||
|
||||
for (;;)
|
||||
{
|
||||
//
|
||||
// The operations we need to do are given in the OSPF RFC which we reference
|
||||
// as we go along.
|
||||
//
|
||||
// RFC2328 16.1. (2).
|
||||
//
|
||||
// We examine the Global Router Link Records in the Link State
|
||||
// Advertisements of the current vertex. If there are any point-to-point
|
||||
// links to unexplored adjacent vertices we add them to the tree and update
|
||||
// the distance and next hop information on how to get there. We also add
|
||||
// the new vertices to the candidate queue (the priority queue ordered by
|
||||
// shortest path). If the new vertices represent shorter paths, we use them
|
||||
// and update the path cost.
|
||||
//
|
||||
//
|
||||
// The operations we need to do are given in the OSPF RFC which we reference
|
||||
// as we go along.
|
||||
//
|
||||
// RFC2328 16.1. (2).
|
||||
//
|
||||
// We examine the Global Router Link Records in the Link State
|
||||
// Advertisements of the current vertex. If there are any point-to-point
|
||||
// links to unexplored adjacent vertices we add them to the tree and update
|
||||
// the distance and next hop information on how to get there. We also add
|
||||
// the new vertices to the candidate queue (the priority queue ordered by
|
||||
// shortest path). If the new vertices represent shorter paths, we use them
|
||||
// and update the path cost.
|
||||
//
|
||||
SPFNext (v, candidate);
|
||||
//
|
||||
// RFC2328 16.1. (3).
|
||||
//
|
||||
// If at this step the candidate list is empty, the shortest-path tree (of
|
||||
// transit vertices) has been completely built and this stage of the
|
||||
// procedure terminates.
|
||||
//
|
||||
//
|
||||
// RFC2328 16.1. (3).
|
||||
//
|
||||
// If at this step the candidate list is empty, the shortest-path tree (of
|
||||
// transit vertices) has been completely built and this stage of the
|
||||
// procedure terminates.
|
||||
//
|
||||
if (candidate.Size () == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
//
|
||||
// Choose the vertex belonging to the candidate list that is closest to the
|
||||
// root, and add it to the shortest-path tree (removing it from the candidate
|
||||
// list in the process).
|
||||
//
|
||||
// Recall that in the previous step, we created SPFVertex structures for each
|
||||
// of the routers found in the Global Router Link Records and added tehm to
|
||||
// the candidate list.
|
||||
//
|
||||
//
|
||||
// Choose the vertex belonging to the candidate list that is closest to the
|
||||
// root, and add it to the shortest-path tree (removing it from the candidate
|
||||
// list in the process).
|
||||
//
|
||||
// Recall that in the previous step, we created SPFVertex structures for each
|
||||
// of the routers found in the Global Router Link Records and added tehm to
|
||||
// the candidate list.
|
||||
//
|
||||
NS_LOG_LOGIC (candidate);
|
||||
v = candidate.Pop ();
|
||||
NS_LOG_LOGIC ("Popped vertex " << v->GetVertexId ());
|
||||
//
|
||||
// Update the status field of the vertex to indicate that it is in the SPF
|
||||
// tree.
|
||||
//
|
||||
//
|
||||
// Update the status field of the vertex to indicate that it is in the SPF
|
||||
// tree.
|
||||
//
|
||||
v->GetLSA ()->SetStatus (GlobalRoutingLSA::LSA_SPF_IN_SPFTREE);
|
||||
//
|
||||
// The current vertex has a parent pointer. By calling this rather oddly
|
||||
// named method (blame quagga) we add the current vertex to the list of
|
||||
// children of that parent vertex. In the next hop calculation called during
|
||||
// SPFNext, the parent pointer was set but the vertex has been orphaned up
|
||||
// to now.
|
||||
//
|
||||
//
|
||||
// The current vertex has a parent pointer. By calling this rather oddly
|
||||
// named method (blame quagga) we add the current vertex to the list of
|
||||
// children of that parent vertex. In the next hop calculation called during
|
||||
// SPFNext, the parent pointer was set but the vertex has been orphaned up
|
||||
// to now.
|
||||
//
|
||||
SPFVertexAddParent (v);
|
||||
//
|
||||
// Note that when there is a choice of vertices closest to the root, network
|
||||
// vertices must be chosen before router vertices in order to necessarily
|
||||
// find all equal-cost paths.
|
||||
//
|
||||
// RFC2328 16.1. (4).
|
||||
//
|
||||
// This is the method that actually adds the routes. It'll walk the list
|
||||
// of nodes in the system, looking for the node corresponding to the router
|
||||
// ID of the root of the tree -- that is the router we're building the routes
|
||||
// for. It looks for the Ipv4 interface of that node and remembers it. So
|
||||
// we are only actually adding routes to that one node at the root of the SPF
|
||||
// tree.
|
||||
//
|
||||
// We're going to pop of a pointer to every vertex in the tree except the
|
||||
// root in order of distance from the root. For each of the vertices, we call
|
||||
// SPFIntraAddRouter (). Down in SPFIntraAddRouter, we look at all of the
|
||||
// point-to-point Global Router Link Records (the links to nodes adjacent to
|
||||
// the node represented by the vertex). We add a route to the IP address
|
||||
// specified by the m_linkData field of each of those link records. This will
|
||||
// be the *local* IP address associated with the interface attached to the
|
||||
// link. We use the outbound interface and next hop information present in
|
||||
// the vertex <v> which have possibly been inherited from the root.
|
||||
//
|
||||
// To summarize, we're going to look at the node represented by <v> and loop
|
||||
// through its point-to-point links, adding a *host* route to the local IP
|
||||
// address (at the <v> side) for each of those links.
|
||||
//
|
||||
//
|
||||
// Note that when there is a choice of vertices closest to the root, network
|
||||
// vertices must be chosen before router vertices in order to necessarily
|
||||
// find all equal-cost paths.
|
||||
//
|
||||
// RFC2328 16.1. (4).
|
||||
//
|
||||
// This is the method that actually adds the routes. It'll walk the list
|
||||
// of nodes in the system, looking for the node corresponding to the router
|
||||
// ID of the root of the tree -- that is the router we're building the routes
|
||||
// for. It looks for the Ipv4 interface of that node and remembers it. So
|
||||
// we are only actually adding routes to that one node at the root of the SPF
|
||||
// tree.
|
||||
//
|
||||
// We're going to pop of a pointer to every vertex in the tree except the
|
||||
// root in order of distance from the root. For each of the vertices, we call
|
||||
// SPFIntraAddRouter (). Down in SPFIntraAddRouter, we look at all of the
|
||||
// point-to-point Global Router Link Records (the links to nodes adjacent to
|
||||
// the node represented by the vertex). We add a route to the IP address
|
||||
// specified by the m_linkData field of each of those link records. This will
|
||||
// be the *local* IP address associated with the interface attached to the
|
||||
// link. We use the outbound interface and next hop information present in
|
||||
// the vertex <v> which have possibly been inherited from the root.
|
||||
//
|
||||
// To summarize, we're going to look at the node represented by <v> and loop
|
||||
// through its point-to-point links, adding a *host* route to the local IP
|
||||
// address (at the <v> side) for each of those links.
|
||||
//
|
||||
if (v->GetVertexType () == SPFVertex::VertexRouter)
|
||||
{
|
||||
SPFIntraAddRouter (v);
|
||||
@@ -1462,15 +1485,15 @@ GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root)
|
||||
{
|
||||
NS_ASSERT_MSG (0, "illegal SPFVertex type");
|
||||
}
|
||||
//
|
||||
// RFC2328 16.1. (5).
|
||||
//
|
||||
// Iterate the algorithm by returning to Step 2 until there are no more
|
||||
// candidate vertices.
|
||||
//
|
||||
// RFC2328 16.1. (5).
|
||||
//
|
||||
// Iterate the algorithm by returning to Step 2 until there are no more
|
||||
// candidate vertices.
|
||||
|
||||
} // end for loop
|
||||
|
||||
// Second stage of SPF calculation procedure
|
||||
// Second stage of SPF calculation procedure
|
||||
SPFProcessStubs (m_spfroot);
|
||||
for (uint32_t i = 0; i < m_lsdb->GetNumExtLSAs (); i++)
|
||||
{
|
||||
@@ -1479,7 +1502,6 @@ GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root)
|
||||
NS_LOG_LOGIC ("Processing External LSA with id " << extlsa->GetLinkStateId ());
|
||||
ProcessASExternals (m_spfroot, extlsa);
|
||||
}
|
||||
|
||||
//
|
||||
// We're all done setting the routing information for the node at the root of
|
||||
// the SPF tree. Delete all of the vertices and corresponding resources. Go
|
||||
@@ -1616,8 +1638,10 @@ GlobalRouteManagerImpl::SPFAddASExternal (GlobalRoutingLSA *extlsa, SPFVertex *v
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Ptr<Ipv4GlobalRouting> gr = router->GetRoutingProtocol ();
|
||||
NS_ASSERT (gr);
|
||||
Ptr<Ipv4GlobalRouting> gr = Ipv4RoutingHelper::
|
||||
GetRouting<Ipv4GlobalRouting> (ipv4->GetRoutingProtocol ());
|
||||
|
||||
NS_ASSERT_MSG (gr != 0, "GlobalRouteManagerImpl needs an instance of Ipv4GlobalRouting to be installed on the node");
|
||||
// walk through all next-hop-IPs and out-going-interfaces for reaching
|
||||
// the stub network gateway 'v' from the root node
|
||||
for (uint32_t i = 0; i < v->GetNRootExitDirections (); i++)
|
||||
@@ -1627,7 +1651,7 @@ GlobalRouteManagerImpl::SPFAddASExternal (GlobalRoutingLSA *extlsa, SPFVertex *v
|
||||
int32_t outIf = exit.second;
|
||||
if (outIf >= 0)
|
||||
{
|
||||
gr->AddASExternalRouteTo (tempip, tempmask, nextHop, outIf);
|
||||
gr->AddRouteTo (tempip, tempmask, nextHop, outIf, v->GetDistanceFromRoot ());
|
||||
NS_LOG_LOGIC ("(Route " << i << ") Node " << node->GetId () <<
|
||||
" add external network route to " << tempip <<
|
||||
" using next hop " << nextHop <<
|
||||
@@ -1702,7 +1726,7 @@ GlobalRouteManagerImpl::SPFIntraAddStub (GlobalRoutingLinkRecord *l, SPFVertex*
|
||||
NS_LOG_LOGIC ("Stub is on local host: " << v->GetVertexId () << "; returning");
|
||||
return;
|
||||
}
|
||||
NS_LOG_LOGIC ("Stub is on remote host: " << v->GetVertexId () << "; installing");
|
||||
NS_LOG_LOGIC ("Stub is on remote host: " << v->GetVertexId () << "; installing (" << v->GetDistanceFromRoot () << ")");
|
||||
//
|
||||
// The root of the Shortest Path First tree is the router to which we are
|
||||
// going to write the actual routing table entries. The vertex corresponding
|
||||
@@ -1787,8 +1811,10 @@ GlobalRouteManagerImpl::SPFIntraAddStub (GlobalRoutingLinkRecord *l, SPFVertex*
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Ptr<Ipv4GlobalRouting> gr = router->GetRoutingProtocol ();
|
||||
NS_ASSERT (gr);
|
||||
Ptr<Ipv4GlobalRouting> gr = Ipv4RoutingHelper::
|
||||
GetRouting<Ipv4GlobalRouting> (ipv4->GetRoutingProtocol ());
|
||||
|
||||
NS_ASSERT_MSG (gr != 0, "GlobalRouteManagerImpl needs an instance of Ipv4GlobalRouting to be installed on the node");
|
||||
// walk through all next-hop-IPs and out-going-interfaces for reaching
|
||||
// the stub network gateway 'v' from the root node
|
||||
for (uint32_t i = 0; i < v->GetNRootExitDirections (); i++)
|
||||
@@ -1798,11 +1824,12 @@ GlobalRouteManagerImpl::SPFIntraAddStub (GlobalRoutingLinkRecord *l, SPFVertex*
|
||||
int32_t outIf = exit.second;
|
||||
if (outIf >= 0)
|
||||
{
|
||||
gr->AddNetworkRouteTo (tempip, tempmask, nextHop, outIf);
|
||||
gr->AddRouteTo (tempip, tempmask, nextHop, outIf, v->GetDistanceFromRoot ());
|
||||
NS_LOG_LOGIC ("(Route " << i << ") Node " << node->GetId () <<
|
||||
" add network route to " << tempip <<
|
||||
" using next hop " << nextHop <<
|
||||
" via interface " << outIf);
|
||||
" via interface " << outIf <<
|
||||
" metric " << v->GetDistanceFromRoot () );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2021,33 +2048,36 @@ GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Ptr<Ipv4GlobalRouting> gr = router->GetRoutingProtocol ();
|
||||
NS_ASSERT (gr);
|
||||
// walk through all available exit directions due to ECMP,
|
||||
// and add host route for each of the exit direction toward
|
||||
// the vertex 'v'
|
||||
for (uint32_t i = 0; i < v->GetNRootExitDirections (); i++)
|
||||
{
|
||||
SPFVertex::NodeExit_t exit = v->GetRootExitDirection (i);
|
||||
Ipv4Address nextHop = exit.first;
|
||||
int32_t outIf = exit.second;
|
||||
if (outIf >= 0)
|
||||
{
|
||||
gr->AddHostRouteTo (lr->GetLinkData (), nextHop,
|
||||
outIf);
|
||||
NS_LOG_LOGIC ("(Route " << i << ") Node " << node->GetId () <<
|
||||
" adding host route to " << lr->GetLinkData () <<
|
||||
" using next hop " << nextHop <<
|
||||
" and outgoing interface " << outIf);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC ("(Route " << i << ") Node " << node->GetId () <<
|
||||
" NOT able to add host route to " << lr->GetLinkData () <<
|
||||
" using next hop " << nextHop <<
|
||||
" since outgoing interface id is negative " << outIf);
|
||||
}
|
||||
} // for all routes from the root the vertex 'v'
|
||||
|
||||
// Ptr<Ipv4GlobalRouting> gr = Ipv4RoutingHelper::
|
||||
// GetRouting<Ipv4GlobalRouting> (ipv4->GetRoutingProtocol ());
|
||||
|
||||
// NS_ASSERT_MSG (gr != 0, "GlobalRouteManagerImpl needs an instance of Ipv4GlobalRouting to be installed on the node");
|
||||
// // walk through all available exit directions due to ECMP,
|
||||
// // and add host route for each of the exit direction toward
|
||||
// // the vertex 'v'
|
||||
// for (uint32_t i = 0; i < v->GetNRootExitDirections (); i++)
|
||||
// {
|
||||
// SPFVertex::NodeExit_t exit = v->GetRootExitDirection (i);
|
||||
// Ipv4Address nextHop = exit.first;
|
||||
// int32_t outIf = exit.second;
|
||||
// if (outIf >= 0)
|
||||
// {
|
||||
// gr->AddRouteTo (lr->GetLinkData (), Ipv4Mask::GetOnes (), nextHop,
|
||||
// outIf, v->GetDistanceFromRoot ());
|
||||
// NS_LOG_LOGIC ("(Route " << i << ") Node " << node->GetId () <<
|
||||
// " adding host route to " << lr->GetLinkData () <<
|
||||
// " using next hop " << nextHop <<
|
||||
// " and outgoing interface " << outIf);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// NS_LOG_LOGIC ("(Route " << i << ") Node " << node->GetId () <<
|
||||
// " NOT able to add host route to " << lr->GetLinkData () <<
|
||||
// " using next hop " << nextHop <<
|
||||
// " since outgoing interface id is negative " << outIf);
|
||||
// }
|
||||
// } // for all routes from the root the vertex 'v'
|
||||
}
|
||||
//
|
||||
// Done adding the routes for the selected node.
|
||||
@@ -2134,8 +2164,11 @@ GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Ptr<Ipv4GlobalRouting> gr = router->GetRoutingProtocol ();
|
||||
NS_ASSERT (gr);
|
||||
|
||||
Ptr<Ipv4GlobalRouting> gr = Ipv4RoutingHelper::
|
||||
GetRouting<Ipv4GlobalRouting> (ipv4->GetRoutingProtocol ());
|
||||
|
||||
NS_ASSERT_MSG (gr != 0, "GlobalRouteManagerImpl needs an instance of Ipv4GlobalRouting to be installed on the node");
|
||||
// walk through all available exit directions due to ECMP,
|
||||
// and add host route for each of the exit direction toward
|
||||
// the vertex 'v'
|
||||
@@ -2147,7 +2180,7 @@ GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v)
|
||||
|
||||
if (outIf >= 0)
|
||||
{
|
||||
gr->AddNetworkRouteTo (tempip, tempmask, nextHop, outIf);
|
||||
gr->AddRouteTo (tempip, tempmask, nextHop, outIf, v->GetDistanceFromRoot ());
|
||||
NS_LOG_LOGIC ("(Route " << i << ") Node " << node->GetId () <<
|
||||
" add network route to " << tempip <<
|
||||
" using next hop " << nextHop <<
|
||||
|
||||
@@ -336,6 +336,8 @@ public:
|
||||
* @see GlobalRouter
|
||||
* @see GlobalRoutingLSA
|
||||
* @see GlobalRoutingLinkRecord
|
||||
* @param nextHop The IP address to use when forwarding packets to the host
|
||||
* or network represented by "this" SPFVertex.
|
||||
* @param exit The pair of next-hop-IP and outgoing-interface-index to use when
|
||||
* forwarding packets to the host or network represented by "this" SPFVertex.
|
||||
*/
|
||||
@@ -713,6 +715,11 @@ public:
|
||||
*/
|
||||
virtual void DeleteGlobalRoutes ();
|
||||
|
||||
/**
|
||||
* @brief Reset LSDB without clearing routing entries
|
||||
*/
|
||||
virtual void ClearLSDB ();
|
||||
|
||||
/**
|
||||
* @brief Build the routing database by gathering Link State Advertisements
|
||||
* from each node exporting a GlobalRouter interface.
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "global-route-manager.h"
|
||||
#include "global-route-manager-impl.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("GlobalRouteManager1");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -35,13 +37,24 @@ namespace ns3 {
|
||||
void
|
||||
GlobalRouteManager::DeleteGlobalRoutes ()
|
||||
{
|
||||
NS_LOG_FUNCTION (0);
|
||||
SimulationSingleton<GlobalRouteManagerImpl>::Get ()->
|
||||
DeleteGlobalRoutes ();
|
||||
DeleteGlobalRoutes ();
|
||||
}
|
||||
|
||||
void
|
||||
GlobalRouteManager::ClearLSDB ()
|
||||
{
|
||||
NS_LOG_FUNCTION (0);
|
||||
SimulationSingleton<GlobalRouteManagerImpl>::Get ()->
|
||||
ClearLSDB ();
|
||||
}
|
||||
|
||||
void
|
||||
GlobalRouteManager::BuildGlobalRoutingDatabase (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (0);
|
||||
|
||||
SimulationSingleton<GlobalRouteManagerImpl>::Get ()->
|
||||
BuildGlobalRoutingDatabase ();
|
||||
}
|
||||
@@ -49,6 +62,8 @@ GlobalRouteManager::BuildGlobalRoutingDatabase (void)
|
||||
void
|
||||
GlobalRouteManager::InitializeRoutes (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (0);
|
||||
|
||||
SimulationSingleton<GlobalRouteManagerImpl>::Get ()->
|
||||
InitializeRoutes ();
|
||||
}
|
||||
@@ -56,6 +71,8 @@ GlobalRouteManager::InitializeRoutes (void)
|
||||
uint32_t
|
||||
GlobalRouteManager::AllocateRouterId (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (0);
|
||||
|
||||
static uint32_t routerId = 0;
|
||||
return routerId++;
|
||||
}
|
||||
|
||||
@@ -52,6 +52,11 @@ public:
|
||||
*/
|
||||
static void DeleteGlobalRoutes ();
|
||||
|
||||
/**
|
||||
* @breif Clear LSA database without removing any entry in global routing table
|
||||
*/
|
||||
static void ClearLSDB ();
|
||||
|
||||
/**
|
||||
* @brief Build the routing database by gathering Link State Advertisements
|
||||
* from each node exporting a GlobalRouter interface.
|
||||
|
||||
@@ -28,9 +28,11 @@
|
||||
#include "ns3/ipv4.h"
|
||||
#include "ns3/bridge-net-device.h"
|
||||
#include "ipv4-global-routing.h"
|
||||
#include "ns3/loopback-net-device.h"
|
||||
#include "global-router-interface.h"
|
||||
#include <vector>
|
||||
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("GlobalRouter");
|
||||
|
||||
namespace ns3 {
|
||||
@@ -526,28 +528,28 @@ GlobalRouter::~GlobalRouter ()
|
||||
ClearLSAs ();
|
||||
}
|
||||
|
||||
void
|
||||
GlobalRouter::SetRoutingProtocol (Ptr<Ipv4GlobalRouting> routing)
|
||||
{
|
||||
m_routingProtocol = routing;
|
||||
}
|
||||
Ptr<Ipv4GlobalRouting>
|
||||
GlobalRouter::GetRoutingProtocol (void)
|
||||
{
|
||||
return m_routingProtocol;
|
||||
}
|
||||
// void
|
||||
// GlobalRouter::SetRoutingProtocol (Ptr<Ipv4GlobalRouting> routing)
|
||||
// {
|
||||
// m_routingProtocol = routing;
|
||||
// }
|
||||
// Ptr<Ipv4GlobalRouting>
|
||||
// GlobalRouter::GetRoutingProtocol (void)
|
||||
// {
|
||||
// return m_routingProtocol;
|
||||
// }
|
||||
|
||||
void
|
||||
GlobalRouter::DoDispose ()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
m_routingProtocol = 0;
|
||||
for (InjectedRoutesI k = m_injectedRoutes.begin ();
|
||||
k != m_injectedRoutes.end ();
|
||||
k = m_injectedRoutes.erase (k))
|
||||
{
|
||||
delete (*k);
|
||||
}
|
||||
// m_routingProtocol = 0;
|
||||
// for (InjectedRoutesI k = m_injectedRoutes.begin ();
|
||||
// k != m_injectedRoutes.end ();
|
||||
// k = m_injectedRoutes.erase (k))
|
||||
// {
|
||||
// delete (*k);
|
||||
// }
|
||||
Object::DoDispose ();
|
||||
}
|
||||
|
||||
@@ -717,17 +719,17 @@ GlobalRouter::DiscoverLSAs ()
|
||||
// Build injected route LSAs as external routes
|
||||
// RFC 2328, section 12.4.4
|
||||
//
|
||||
for (InjectedRoutesCI i = m_injectedRoutes.begin ();
|
||||
for (RouteList::const_iterator i = m_injectedRoutes.begin ();
|
||||
i != m_injectedRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
GlobalRoutingLSA *pLSA = new GlobalRoutingLSA;
|
||||
pLSA->SetLSType (GlobalRoutingLSA::ASExternalLSAs);
|
||||
pLSA->SetLinkStateId ((*i)->GetDestNetwork ());
|
||||
pLSA->SetLinkStateId (i->GetDestNetwork ());
|
||||
pLSA->SetAdvertisingRouter (m_routerId);
|
||||
pLSA->SetNetworkLSANetworkMask ((*i)->GetDestNetworkMask ());
|
||||
pLSA->SetNetworkLSANetworkMask (i->GetDestNetworkMask ());
|
||||
pLSA->SetStatus (GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED);
|
||||
m_LSAs.push_back (pLSA);
|
||||
m_LSAs.push_back (pLSA);
|
||||
}
|
||||
return m_LSAs.size ();
|
||||
}
|
||||
@@ -752,6 +754,8 @@ GlobalRouter::ProcessSingleBroadcastLink (Ptr<NetDevice> nd, GlobalRoutingLSA *p
|
||||
{
|
||||
NS_LOG_FUNCTION (nd << pLSA << &c);
|
||||
|
||||
if (DynamicCast<LoopbackNetDevice> (nd)) return; //don't announce loopback addresses
|
||||
|
||||
GlobalRoutingLinkRecord *plr = new GlobalRoutingLinkRecord;
|
||||
NS_ABORT_MSG_IF (plr == 0, "GlobalRouter::ProcessSingleBroadcastLink(): Can't alloc link record");
|
||||
|
||||
@@ -1503,77 +1507,74 @@ GlobalRouter::GetLSA (uint32_t n, GlobalRoutingLSA &lsa) const
|
||||
}
|
||||
|
||||
void
|
||||
GlobalRouter::InjectRoute (Ipv4Address network, Ipv4Mask networkMask)
|
||||
GlobalRouter::InjectRoute (Ipv4Address network, Ipv4Mask networkMask, uint32_t metric/*=1*/)
|
||||
{
|
||||
NS_LOG_FUNCTION (network << networkMask);
|
||||
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
|
||||
//
|
||||
// Interface number does not matter here, using 1.
|
||||
//
|
||||
*route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
|
||||
networkMask,
|
||||
1);
|
||||
m_injectedRoutes.push_back (route);
|
||||
NS_LOG_FUNCTION (network << networkMask << metric);
|
||||
|
||||
WithdrawRoute (network, networkMask); //slight inefficiency to prevent duplicate routes
|
||||
m_injectedRoutes.push_back (Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
|
||||
networkMask,
|
||||
metric));
|
||||
}
|
||||
|
||||
Ipv4RoutingTableEntry *
|
||||
GlobalRouter::GetInjectedRoute (uint32_t index)
|
||||
{
|
||||
NS_LOG_FUNCTION (index);
|
||||
if (index < m_injectedRoutes.size ())
|
||||
{
|
||||
uint32_t tmp = 0;
|
||||
for (InjectedRoutesCI i = m_injectedRoutes.begin ();
|
||||
i != m_injectedRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
return *i;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
NS_ASSERT (false);
|
||||
// quiet compiler.
|
||||
return 0;
|
||||
}
|
||||
// Ipv4RoutingTableEntry *
|
||||
// GlobalRouter::GetInjectedRoute (uint32_t index)
|
||||
// {
|
||||
// NS_LOG_FUNCTION (index);
|
||||
// if (index < m_injectedRoutes.size ())
|
||||
// {
|
||||
// uint32_t tmp = 0;
|
||||
// for (InjectedRoutesCI i = m_injectedRoutes.begin ();
|
||||
// i != m_injectedRoutes.end ();
|
||||
// i++)
|
||||
// {
|
||||
// if (tmp == index)
|
||||
// {
|
||||
// return *i;
|
||||
// }
|
||||
// tmp++;
|
||||
// }
|
||||
// }
|
||||
// NS_ASSERT (false);
|
||||
// // quiet compiler.
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
uint32_t
|
||||
GlobalRouter::GetNInjectedRoutes ()
|
||||
{
|
||||
return m_injectedRoutes.size ();
|
||||
}
|
||||
// uint32_t
|
||||
// GlobalRouter::GetNInjectedRoutes ()
|
||||
// {
|
||||
// return m_injectedRoutes.size ();
|
||||
// }
|
||||
|
||||
void
|
||||
GlobalRouter::RemoveInjectedRoute (uint32_t index)
|
||||
{
|
||||
NS_LOG_FUNCTION (index);
|
||||
NS_ASSERT (index < m_injectedRoutes.size ());
|
||||
uint32_t tmp = 0;
|
||||
for (InjectedRoutesI i = m_injectedRoutes.begin (); i != m_injectedRoutes.end (); i++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_injectedRoutes.size ());
|
||||
delete *i;
|
||||
m_injectedRoutes.erase (i);
|
||||
return;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
// void
|
||||
// GlobalRouter::RemoveInjectedRoute (uint32_t index)
|
||||
// {
|
||||
// NS_LOG_FUNCTION (index);
|
||||
// NS_ASSERT (index < m_injectedRoutes.size ());
|
||||
// uint32_t tmp = 0;
|
||||
// for (InjectedRoutesI i = m_injectedRoutes.begin (); i != m_injectedRoutes.end (); i++)
|
||||
// {
|
||||
// if (tmp == index)
|
||||
// {
|
||||
// NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_injectedRoutes.size ());
|
||||
// delete *i;
|
||||
// m_injectedRoutes.erase (i);
|
||||
// return;
|
||||
// }
|
||||
// tmp++;
|
||||
// }
|
||||
// }
|
||||
|
||||
bool
|
||||
GlobalRouter::WithdrawRoute (Ipv4Address network, Ipv4Mask networkMask)
|
||||
{
|
||||
NS_LOG_FUNCTION (network << networkMask);
|
||||
for (InjectedRoutesI i = m_injectedRoutes.begin (); i != m_injectedRoutes.end (); i++)
|
||||
|
||||
for (RouteList::iterator i = m_injectedRoutes.begin (); i != m_injectedRoutes.end (); i++)
|
||||
{
|
||||
if ((*i)->GetDestNetwork () == network && (*i)->GetDestNetworkMask () == networkMask)
|
||||
if (i->GetDestNetwork () == network && i->GetDestNetworkMask () == networkMask)
|
||||
{
|
||||
NS_LOG_LOGIC ("Withdrawing route to network/mask " << network << "/" << networkMask);
|
||||
delete *i;
|
||||
m_injectedRoutes.erase (i);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
namespace ns3 {
|
||||
|
||||
class GlobalRouter;
|
||||
class Ipv4GlobalRouting;
|
||||
|
||||
/**
|
||||
* @brief A single link record for a link state advertisement.
|
||||
@@ -588,10 +587,6 @@ public:
|
||||
*/
|
||||
GlobalRouter ();
|
||||
|
||||
|
||||
void SetRoutingProtocol (Ptr<Ipv4GlobalRouting> routing);
|
||||
Ptr<Ipv4GlobalRouting> GetRoutingProtocol (void);
|
||||
|
||||
/**
|
||||
* @brief Get the Router ID associated with this Global Router.
|
||||
*
|
||||
@@ -666,35 +661,35 @@ public:
|
||||
* @param network The Network to inject
|
||||
* @param networkMask The Network Mask to inject
|
||||
*/
|
||||
void InjectRoute (Ipv4Address network, Ipv4Mask networkMask);
|
||||
void InjectRoute (Ipv4Address network, Ipv4Mask networkMask, uint32_t metric=1);
|
||||
|
||||
/**
|
||||
* @brief Get the number of injected routes that have been added
|
||||
* to the routing table.
|
||||
* @return number of injected routes
|
||||
*/
|
||||
uint32_t GetNInjectedRoutes (void);
|
||||
// /**
|
||||
// * @brief Get the number of injected routes that have been added
|
||||
// * to the routing table.
|
||||
// * @return number of injected routes
|
||||
// */
|
||||
// uint32_t GetNInjectedRoutes (void) const;
|
||||
|
||||
/**
|
||||
* @brief Return the injected route indexed by i
|
||||
* @param i the index of the route
|
||||
* @return a pointer to that Ipv4RoutingTableEntry is returned
|
||||
*
|
||||
*/
|
||||
Ipv4RoutingTableEntry *GetInjectedRoute (uint32_t i);
|
||||
// /**
|
||||
// * @brief Return the injected route indexed by i
|
||||
// * @param i the index of the route
|
||||
// * @return a pointer to that Ipv4RoutingTableEntry is returned
|
||||
// *
|
||||
// */
|
||||
// const Ipv4RoutingTableEntry& GetInjectedRoute (uint32_t i) const;
|
||||
|
||||
/**
|
||||
* @brief Withdraw a route from the global unicast routing table.
|
||||
*
|
||||
* Calling this function will cause all indexed routes numbered above
|
||||
* index i to have their index decremented. For instance, it is possible to
|
||||
* remove N injected routes by calling RemoveInjectedRoute (0) N times.
|
||||
*
|
||||
* @param i The index (into the injected routing list) of the route to remove.
|
||||
*
|
||||
* @see GlobalRouter::WithdrawRoute ()
|
||||
*/
|
||||
void RemoveInjectedRoute (uint32_t i);
|
||||
// /**
|
||||
// * @brief Withdraw a route from the global unicast routing table.
|
||||
// *
|
||||
// * Calling this function will cause all indexed routes numbered above
|
||||
// * index i to have their index decremented. For instance, it is possible to
|
||||
// * remove N injected routes by calling RemoveInjectedRoute (0) N times.
|
||||
// *
|
||||
// * @param i The index (into the injected routing list) of the route to remove.
|
||||
// *
|
||||
// * @see GlobalRouter::WithdrawRoute ()
|
||||
// */
|
||||
// void RemoveInjectedRoute (uint32_t i);
|
||||
|
||||
/**
|
||||
* @brief Withdraw a route from the global unicast routing table.
|
||||
@@ -728,12 +723,10 @@ private:
|
||||
ListOfLSAs_t m_LSAs;
|
||||
|
||||
Ipv4Address m_routerId;
|
||||
Ptr<Ipv4GlobalRouting> m_routingProtocol;
|
||||
// Ptr<Ipv4GlobalRouting> m_routingProtocol;
|
||||
|
||||
typedef std::list<Ipv4RoutingTableEntry *> InjectedRoutes;
|
||||
typedef std::list<Ipv4RoutingTableEntry *>::const_iterator InjectedRoutesCI;
|
||||
typedef std::list<Ipv4RoutingTableEntry *>::iterator InjectedRoutesI;
|
||||
InjectedRoutes m_injectedRoutes; // Routes we are exporting
|
||||
typedef std::list<Ipv4RoutingTableEntry> RouteList;
|
||||
RouteList m_injectedRoutes; // Routes we are exporting
|
||||
|
||||
// inherited from Object
|
||||
virtual void DoDispose (void);
|
||||
|
||||
@@ -57,7 +57,7 @@ Icmpv4L4Protocol::NotifyNewAggregate ()
|
||||
if (node != 0)
|
||||
{
|
||||
Ptr<Ipv4L3Protocol> ipv4 = this->GetObject<Ipv4L3Protocol> ();
|
||||
if (ipv4 != 0 && m_downTarget.IsNull ())
|
||||
if (ipv4 != 0)
|
||||
{
|
||||
this->SetNode (node);
|
||||
ipv4->Insert (this);
|
||||
|
||||
@@ -112,7 +112,7 @@ void Icmpv6L4Protocol::NotifyNewAggregate ()
|
||||
if (node != 0)
|
||||
{
|
||||
Ptr<Ipv6L3Protocol> ipv6 = this->GetObject<Ipv6L3Protocol> ();
|
||||
if (ipv6 != 0 && m_downTarget.IsNull ())
|
||||
if (ipv6 != 0)
|
||||
{
|
||||
SetNode (node);
|
||||
ipv6->Insert (this);
|
||||
@@ -846,10 +846,10 @@ void Icmpv6L4Protocol::SendMessage (Ptr<Packet> packet, Ipv6Address src, Ipv6Add
|
||||
{
|
||||
NS_LOG_FUNCTION (this << packet << src << dst << (uint32_t)ttl);
|
||||
Ptr<Ipv6L3Protocol> ipv6 = m_node->GetObject<Ipv6L3Protocol> ();
|
||||
SocketIpTtlTag tag;
|
||||
NS_ASSERT (ipv6 != 0);
|
||||
|
||||
tag.SetTtl (ttl);
|
||||
Ptr<SocketIpTtlTag> tag = CreateObject<SocketIpTtlTag> ();
|
||||
tag->SetTtl (ttl);
|
||||
packet->AddPacketTag (tag);
|
||||
m_downTarget (packet, src, dst, PROT_NUMBER, 0);
|
||||
}
|
||||
@@ -860,7 +860,6 @@ void Icmpv6L4Protocol::SendMessage (Ptr<Packet> packet, Ipv6Address dst, Icmpv6H
|
||||
Ptr<Ipv6L3Protocol> ipv6 = m_node->GetObject<Ipv6L3Protocol> ();
|
||||
NS_ASSERT (ipv6 != 0 && ipv6->GetRoutingProtocol () != 0);
|
||||
Ipv6Header header;
|
||||
SocketIpTtlTag tag;
|
||||
Socket::SocketErrno err;
|
||||
Ptr<Ipv6Route> route;
|
||||
Ptr<NetDevice> oif (0); //specify non-zero if bound to a source address
|
||||
@@ -871,7 +870,8 @@ void Icmpv6L4Protocol::SendMessage (Ptr<Packet> packet, Ipv6Address dst, Icmpv6H
|
||||
if (route != 0)
|
||||
{
|
||||
NS_LOG_LOGIC ("Route exists");
|
||||
tag.SetTtl (ttl);
|
||||
Ptr<SocketIpTtlTag> tag = CreateObject<SocketIpTtlTag> ();
|
||||
tag->SetTtl (ttl);
|
||||
packet->AddPacketTag (tag);
|
||||
Ipv6Address src = route->GetSource ();
|
||||
|
||||
|
||||
@@ -0,0 +1,317 @@
|
||||
// -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*-
|
||||
//
|
||||
// Copyright (c) 2008 University of Washington
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
// published by the Free Software Foundation;
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
|
||||
#include "ns3/names.h"
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/object.h"
|
||||
#include "ns3/packet.h"
|
||||
#include "ns3/net-device.h"
|
||||
#include "ns3/ipv4-route.h"
|
||||
#include "ipv4-global-routing-one-nexthop.h"
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("Ipv4GlobalRoutingOneNexthop");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (Ipv4GlobalRoutingOneNexthop);
|
||||
|
||||
TypeId
|
||||
Ipv4GlobalRoutingOneNexthop::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::Ipv4GlobalRoutingOneNexthop")
|
||||
.SetParent<Ipv4GlobalRouting> ()
|
||||
.AddConstructor<Ipv4GlobalRoutingOneNexthop> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
Ipv4GlobalRoutingOneNexthop::Ipv4GlobalRoutingOneNexthop ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4GlobalRoutingOneNexthop::AddRouteTo (Ipv4Address dest,
|
||||
Ipv4Mask destMask,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface,
|
||||
uint32_t metric/*=0*/)
|
||||
{
|
||||
NS_LOG_FUNCTION (dest << nextHop << interface);
|
||||
|
||||
// First, make sure we don't try to add route to ourselves
|
||||
int32_t iface = m_ipv4->GetInterfaceForPrefix (dest, destMask);
|
||||
NS_LOG_LOGIC ("Iface " << iface << " for " << dest);
|
||||
if (iface >= 0)
|
||||
{
|
||||
NS_LOG_LOGIC ("Do not add route to ourselves");
|
||||
return;
|
||||
}
|
||||
|
||||
// Second, there is no reason to add p2p route that equals to the next hop
|
||||
if (destMask == Ipv4Mask::GetOnes () && dest == nextHop)
|
||||
{
|
||||
NS_LOG_LOGIC ("Ignore route to nexthop via nexhop");
|
||||
return;
|
||||
}
|
||||
|
||||
Ipv4AddressTrie<Ipv4RoutingTableEntry>::iterator route =
|
||||
m_routes.find (dest.CombineMask (destMask));
|
||||
if (route == m_routes.end ())
|
||||
{
|
||||
NS_LOG_LOGIC ("Adding new route");
|
||||
m_routes[dest.CombineMask (destMask)] =
|
||||
Ipv4RoutingTableEntry::CreateNetworkRouteTo (dest, destMask, nextHop, interface, metric);
|
||||
}
|
||||
else
|
||||
if (route->second.GetMetric () > metric)
|
||||
{
|
||||
NS_LOG_LOGIC ("Replacing larger-metric route");
|
||||
m_routes[dest.CombineMask (destMask)] =
|
||||
Ipv4RoutingTableEntry::CreateNetworkRouteTo (dest, destMask, nextHop, interface, metric);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC ("Don't update lower-metric route");
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<Ipv4Route>
|
||||
Ipv4GlobalRoutingOneNexthop::LookupGlobal (Ipv4Address dest, Ptr<NetDevice> oif)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
NS_LOG_LOGIC ("Looking for route for destination " << dest);
|
||||
|
||||
// Cheating with lookups. Need to redesign Trie
|
||||
Ipv4AddressTrieMap::const_iterator longest_prefix_map;
|
||||
Ipv4Mask mask ("255.255.255.255");
|
||||
do {
|
||||
NS_LOG_DEBUG ("Try mask " << mask);
|
||||
longest_prefix_map = m_routes.longest_prefix_match (dest.CombineMask (mask));
|
||||
mask = Ipv4Mask (mask.Get () << 8);
|
||||
} while (longest_prefix_map == m_routes.end () && !mask.IsEqual (Ipv4Mask::GetZero ()));
|
||||
|
||||
if (longest_prefix_map == m_routes.end ())
|
||||
{
|
||||
NS_LOG_LOGIC ("Route not found...");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (oif != 0 && oif == m_ipv4->GetNetDevice (longest_prefix_map->second.GetInterface ()))
|
||||
{
|
||||
NS_LOG_LOGIC ("Route points to the incoming interface. Return empty route");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// create a Ipv4Route object from the selected routing table entry
|
||||
Ptr<Ipv4Route> rtentry = Create<Ipv4Route> ();
|
||||
rtentry->SetDestination (longest_prefix_map->second.GetDest ());
|
||||
rtentry->SetSource (m_ipv4->GetAddress (longest_prefix_map->second.GetInterface (), 0).GetLocal ());
|
||||
rtentry->SetGateway (longest_prefix_map->second.GetGateway ());
|
||||
rtentry->SetOutputDevice (m_ipv4->GetNetDevice (longest_prefix_map->second.GetInterface ()));
|
||||
return rtentry;
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4GlobalRoutingOneNexthop::DeleteRoutes ()
|
||||
{
|
||||
m_routes.clear ();
|
||||
}
|
||||
|
||||
// Formatted like output of "route -n" command
|
||||
void
|
||||
Ipv4GlobalRoutingOneNexthop::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
|
||||
{
|
||||
std::ostream* os = stream->GetStream ();
|
||||
if (m_routes.size () > 0)
|
||||
{
|
||||
*os << "Destination Gateway Genmask Flags Metric Ref Use Iface" << std::endl;
|
||||
for (Ipv4AddressTrieMap::const_iterator i=m_routes.begin (); i != m_routes.end (); i++)
|
||||
{
|
||||
std::ostringstream dest, gw, mask, flags;
|
||||
const Ipv4RoutingTableEntry &route = i->second;
|
||||
dest << route.GetDest ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (16) << dest.str ();
|
||||
gw << route.GetGateway ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (16) << gw.str ();
|
||||
mask << route.GetDestNetworkMask ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (16) << mask.str ();
|
||||
flags << "U";
|
||||
if (route.IsHost ())
|
||||
{
|
||||
flags << "H";
|
||||
}
|
||||
else if (route.IsGateway ())
|
||||
{
|
||||
flags << "G";
|
||||
}
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (6) << flags.str ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (6) << route.GetMetric ();
|
||||
// Ref ct not implemented
|
||||
*os << "-" << " ";
|
||||
// Use not implemented
|
||||
*os << "-" << " ";
|
||||
if (Names::FindName (m_ipv4->GetNetDevice (route.GetInterface ())) != "")
|
||||
{
|
||||
*os << Names::FindName (m_ipv4->GetNetDevice (route.GetInterface ()));
|
||||
}
|
||||
else
|
||||
{
|
||||
*os << route.GetInterface ();
|
||||
}
|
||||
*os << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<Ipv4Route>
|
||||
Ipv4GlobalRoutingOneNexthop::RouteOutput (Ptr<Packet> p, const Ipv4Header &header,
|
||||
Ptr<NetDevice> oif, Socket::SocketErrno &sockerr)
|
||||
{
|
||||
//
|
||||
// First, see if this is a multicast packet we have a route for. If we
|
||||
// have a route, then send the packet down each of the specified interfaces.
|
||||
//
|
||||
if (header.GetDestination ().IsMulticast ())
|
||||
{
|
||||
NS_LOG_LOGIC ("Multicast destination-- returning false");
|
||||
return 0; // Let other routing protocols try to handle this
|
||||
}
|
||||
//
|
||||
// See if this is a unicast packet we have a route for.
|
||||
//
|
||||
NS_LOG_LOGIC ("Unicast destination- looking up");
|
||||
Ptr<Ipv4Route> rtentry = LookupGlobal (header.GetDestination (), oif);
|
||||
if (rtentry)
|
||||
{
|
||||
sockerr = Socket::ERROR_NOTERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
sockerr = Socket::ERROR_NOROUTETOHOST;
|
||||
}
|
||||
return rtentry;
|
||||
}
|
||||
|
||||
bool
|
||||
Ipv4GlobalRoutingOneNexthop::RouteInput (Ptr<const Packet> p, const Ipv4Header &header,
|
||||
Ptr<const NetDevice> idev,
|
||||
UnicastForwardCallback ucb, MulticastForwardCallback mcb,
|
||||
LocalDeliverCallback lcb, ErrorCallback ecb)
|
||||
{
|
||||
|
||||
NS_LOG_FUNCTION (this << p << header << header.GetSource () << header.GetDestination () << idev);
|
||||
// Check if input device supports IP
|
||||
NS_ASSERT (m_ipv4->GetInterfaceForDevice (idev) >= 0);
|
||||
uint32_t iif = m_ipv4->GetInterfaceForDevice (idev);
|
||||
|
||||
if (header.GetDestination ().IsMulticast ())
|
||||
{
|
||||
NS_LOG_LOGIC ("Multicast destination-- returning false");
|
||||
return false; // Let other routing protocols try to handle this
|
||||
}
|
||||
|
||||
if (header.GetDestination ().IsBroadcast ())
|
||||
{
|
||||
NS_LOG_LOGIC ("For me (Ipv4Addr broadcast address)");
|
||||
// TODO: Local Deliver for broadcast
|
||||
// TODO: Forward broadcast
|
||||
}
|
||||
|
||||
// TODO: Configurable option to enable RFC 1222 Strong End System Model
|
||||
// Right now, we will be permissive and allow a source to send us
|
||||
// a packet to one of our other interface addresses; that is, the
|
||||
// destination unicast address does not match one of the iif addresses,
|
||||
// but we check our other interfaces. This could be an option
|
||||
// (to remove the outer loop immediately below and just check iif).
|
||||
for (uint32_t j = 0; j < m_ipv4->GetNInterfaces (); j++)
|
||||
{
|
||||
for (uint32_t i = 0; i < m_ipv4->GetNAddresses (j); i++)
|
||||
{
|
||||
Ipv4InterfaceAddress iaddr = m_ipv4->GetAddress (j, i);
|
||||
Ipv4Address addr = iaddr.GetLocal ();
|
||||
if (addr.IsEqual (header.GetDestination ()))
|
||||
{
|
||||
if (j == iif)
|
||||
{
|
||||
NS_LOG_LOGIC ("For me (destination " << addr << " match)");
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC ("For me (destination " << addr << " match) on another interface " << header.GetDestination ());
|
||||
}
|
||||
lcb (p, header, iif);
|
||||
return true;
|
||||
}
|
||||
if (header.GetDestination ().IsEqual (iaddr.GetBroadcast ()))
|
||||
{
|
||||
NS_LOG_LOGIC ("For me (interface broadcast address)");
|
||||
lcb (p, header, iif);
|
||||
return true;
|
||||
}
|
||||
NS_LOG_LOGIC ("Address "<< addr << " not a match");
|
||||
}
|
||||
}
|
||||
// Check if input device supports IP forwarding
|
||||
if (m_ipv4->IsForwarding (iif) == false)
|
||||
{
|
||||
NS_LOG_LOGIC ("Forwarding disabled for this interface");
|
||||
ecb (p, header, Socket::ERROR_NOROUTETOHOST);
|
||||
return false;
|
||||
}
|
||||
// Next, try to find a route
|
||||
NS_LOG_LOGIC ("Unicast destination- looking up global route");
|
||||
Ptr<Ipv4Route> rtentry = LookupGlobal (header.GetDestination ());
|
||||
if (rtentry != 0)
|
||||
{
|
||||
NS_LOG_LOGIC ("Found unicast destination- calling unicast callback");
|
||||
ucb (rtentry, p, header);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC ("Did not find unicast destination- returning false");
|
||||
return false; // Let other routing protocols try to handle this
|
||||
// route request.
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Ipv4GlobalRoutingOneNexthop::GetNRoutes () const
|
||||
{
|
||||
return m_routes.size ();
|
||||
}
|
||||
|
||||
Ipv4RoutingTableEntry
|
||||
Ipv4GlobalRoutingOneNexthop::GetRoute (uint32_t i) const
|
||||
{
|
||||
uint32_t index = 0;
|
||||
for (Ipv4AddressTrieMap::const_iterator it = m_routes.begin ();
|
||||
index <= i && it != m_routes.end ();
|
||||
it++, index++)
|
||||
{
|
||||
if (index == i) return it->second;
|
||||
}
|
||||
NS_ASSERT (false);
|
||||
return Ipv4RoutingTableEntry ();
|
||||
}
|
||||
|
||||
|
||||
} // namespace ns3
|
||||
@@ -0,0 +1,83 @@
|
||||
// -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*-
|
||||
//
|
||||
// Copyright (c) 2008 University of Washington
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
// published by the Free Software Foundation;
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef IPV4_GLOBAL_ROUTING_ONE_NEXTHOP_H
|
||||
#define IPV4_GLOBAL_ROUTING_ONE_NEXTHOP_H
|
||||
|
||||
#include "ns3/ipv4-global-routing.h"
|
||||
#include "ns3/trie.h"
|
||||
#include "ns3/ipv4-routing-table-entry.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \brief Global routing protocol for IP version 4 stacks.
|
||||
*
|
||||
* Each prefix entry stores a list of ordered by metric next-hops
|
||||
*
|
||||
* This class deals with Ipv4 unicast routes only.
|
||||
*
|
||||
* \see Ipv4GlobalRouting
|
||||
* \see Ipv4RoutingProtocol
|
||||
* \see GlobalRouteManager
|
||||
*/
|
||||
class Ipv4GlobalRoutingOneNexthop : public Ipv4GlobalRouting
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
Ipv4GlobalRoutingOneNexthop ();
|
||||
|
||||
// These methods inherited from base class
|
||||
// from Ipv4RoutingProtocol
|
||||
virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header,
|
||||
Ptr<NetDevice> oif, Socket::SocketErrno &sockerr);
|
||||
|
||||
virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
|
||||
UnicastForwardCallback ucb, MulticastForwardCallback mcb,
|
||||
LocalDeliverCallback lcb, ErrorCallback ecb);
|
||||
|
||||
virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
|
||||
|
||||
// from Ipv4GlobalRouting
|
||||
virtual void AddRouteTo (Ipv4Address dest,
|
||||
Ipv4Mask destMask,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface,
|
||||
uint32_t metric=0);
|
||||
|
||||
virtual void DeleteRoutes ();
|
||||
|
||||
uint32_t
|
||||
GetNRoutes () const;
|
||||
|
||||
Ipv4RoutingTableEntry
|
||||
GetRoute (uint32_t i) const;
|
||||
|
||||
protected:
|
||||
virtual Ptr<Ipv4Route> LookupGlobal (Ipv4Address dest, Ptr<NetDevice> oif = 0);
|
||||
|
||||
private:
|
||||
typedef Ipv4AddressTrie<Ipv4RoutingTableEntry> Ipv4AddressTrieMap;
|
||||
Ipv4AddressTrieMap m_routes;
|
||||
};
|
||||
|
||||
} // Namespace ns3
|
||||
|
||||
#endif /* IPV4_GLOBAL_ROUTING_ONE_NEXTHOP_H */
|
||||
@@ -16,19 +16,13 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
|
||||
#include <vector>
|
||||
#include <iomanip>
|
||||
#include "ns3/names.h"
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/object.h"
|
||||
#include "ns3/packet.h"
|
||||
#include "ns3/net-device.h"
|
||||
#include "ns3/ipv4-route.h"
|
||||
#include "ns3/ipv4-routing-table-entry.h"
|
||||
#include "ns3/global-route-manager.h"
|
||||
#include "ns3/boolean.h"
|
||||
#include "ipv4-global-routing.h"
|
||||
#include "global-route-manager.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("Ipv4GlobalRouting");
|
||||
|
||||
@@ -40,14 +34,10 @@ TypeId
|
||||
Ipv4GlobalRouting::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::Ipv4GlobalRouting")
|
||||
.SetParent<Object> ()
|
||||
.AddAttribute ("RandomEcmpRouting",
|
||||
"Set to true if packets are randomly routed among ECMP; set to false for using only one route consistently",
|
||||
BooleanValue (false),
|
||||
MakeBooleanAccessor (&Ipv4GlobalRouting::m_randomEcmpRouting),
|
||||
MakeBooleanChecker ())
|
||||
.SetParent<Ipv4RoutingProtocol> ()
|
||||
.AddAttribute ("RespondToInterfaceEvents",
|
||||
"Set to true if you want to dynamically recompute the global routes upon Interface notification events (up/down, or add/remove address)",
|
||||
"Set to true if you want to dynamically recompute the global routes "
|
||||
"upon Interface notification events (up/down, or add/remove address)",
|
||||
BooleanValue (false),
|
||||
MakeBooleanAccessor (&Ipv4GlobalRouting::m_respondToInterfaceEvents),
|
||||
MakeBooleanChecker ())
|
||||
@@ -55,491 +45,11 @@ Ipv4GlobalRouting::GetTypeId (void)
|
||||
return tid;
|
||||
}
|
||||
|
||||
Ipv4GlobalRouting::Ipv4GlobalRouting ()
|
||||
: m_randomEcmpRouting (false),
|
||||
m_respondToInterfaceEvents (false)
|
||||
Ipv4GlobalRouting::Ipv4GlobalRouting ()
|
||||
: m_respondToInterfaceEvents (false)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
}
|
||||
|
||||
Ipv4GlobalRouting::~Ipv4GlobalRouting ()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4GlobalRouting::AddHostRouteTo (Ipv4Address dest,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface)
|
||||
{
|
||||
NS_LOG_FUNCTION (dest << nextHop << interface);
|
||||
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
|
||||
*route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, nextHop, interface);
|
||||
m_hostRoutes.push_back (route);
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4GlobalRouting::AddHostRouteTo (Ipv4Address dest,
|
||||
uint32_t interface)
|
||||
{
|
||||
NS_LOG_FUNCTION (dest << interface);
|
||||
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
|
||||
*route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, interface);
|
||||
m_hostRoutes.push_back (route);
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4GlobalRouting::AddNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface)
|
||||
{
|
||||
NS_LOG_FUNCTION (network << networkMask << nextHop << interface);
|
||||
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
|
||||
*route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
|
||||
networkMask,
|
||||
nextHop,
|
||||
interface);
|
||||
m_networkRoutes.push_back (route);
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4GlobalRouting::AddNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
uint32_t interface)
|
||||
{
|
||||
NS_LOG_FUNCTION (network << networkMask << interface);
|
||||
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
|
||||
*route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
|
||||
networkMask,
|
||||
interface);
|
||||
m_networkRoutes.push_back (route);
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4GlobalRouting::AddASExternalRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface)
|
||||
{
|
||||
NS_LOG_FUNCTION (network << networkMask << nextHop);
|
||||
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
|
||||
*route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
|
||||
networkMask,
|
||||
nextHop,
|
||||
interface);
|
||||
m_ASexternalRoutes.push_back (route);
|
||||
}
|
||||
|
||||
|
||||
Ptr<Ipv4Route>
|
||||
Ipv4GlobalRouting::LookupGlobal (Ipv4Address dest, Ptr<NetDevice> oif)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
NS_LOG_LOGIC ("Looking for route for destination " << dest);
|
||||
Ptr<Ipv4Route> rtentry = 0;
|
||||
// store all available routes that bring packets to their destination
|
||||
typedef std::vector<Ipv4RoutingTableEntry*> RouteVec_t;
|
||||
RouteVec_t allRoutes;
|
||||
|
||||
NS_LOG_LOGIC ("Number of m_hostRoutes = " << m_hostRoutes.size ());
|
||||
for (HostRoutesCI i = m_hostRoutes.begin ();
|
||||
i != m_hostRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
NS_ASSERT ((*i)->IsHost ());
|
||||
if ((*i)->GetDest ().IsEqual (dest))
|
||||
{
|
||||
if (oif != 0)
|
||||
{
|
||||
if (oif != m_ipv4->GetNetDevice ((*i)->GetInterface ()))
|
||||
{
|
||||
NS_LOG_LOGIC ("Not on requested interface, skipping");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
allRoutes.push_back (*i);
|
||||
NS_LOG_LOGIC (allRoutes.size () << "Found global host route" << *i);
|
||||
}
|
||||
}
|
||||
if (allRoutes.size () == 0) // if no host route is found
|
||||
{
|
||||
NS_LOG_LOGIC ("Number of m_networkRoutes" << m_networkRoutes.size ());
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j++)
|
||||
{
|
||||
Ipv4Mask mask = (*j)->GetDestNetworkMask ();
|
||||
Ipv4Address entry = (*j)->GetDestNetwork ();
|
||||
if (mask.IsMatch (dest, entry))
|
||||
{
|
||||
if (oif != 0)
|
||||
{
|
||||
if (oif != m_ipv4->GetNetDevice ((*j)->GetInterface ()))
|
||||
{
|
||||
NS_LOG_LOGIC ("Not on requested interface, skipping");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
allRoutes.push_back (*j);
|
||||
NS_LOG_LOGIC (allRoutes.size () << "Found global network route" << *j);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (allRoutes.size () == 0) // consider external if no host/network found
|
||||
{
|
||||
for (ASExternalRoutesI k = m_ASexternalRoutes.begin ();
|
||||
k != m_ASexternalRoutes.end ();
|
||||
k++)
|
||||
{
|
||||
Ipv4Mask mask = (*k)->GetDestNetworkMask ();
|
||||
Ipv4Address entry = (*k)->GetDestNetwork ();
|
||||
if (mask.IsMatch (dest, entry))
|
||||
{
|
||||
NS_LOG_LOGIC ("Found external route" << *k);
|
||||
if (oif != 0)
|
||||
{
|
||||
if (oif != m_ipv4->GetNetDevice ((*k)->GetInterface ()))
|
||||
{
|
||||
NS_LOG_LOGIC ("Not on requested interface, skipping");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
allRoutes.push_back (*k);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (allRoutes.size () > 0 ) // if route(s) is found
|
||||
{
|
||||
// pick up one of the routes uniformly at random if random
|
||||
// ECMP routing is enabled, or always select the first route
|
||||
// consistently if random ECMP routing is disabled
|
||||
uint32_t selectIndex;
|
||||
if (m_randomEcmpRouting)
|
||||
{
|
||||
selectIndex = m_rand.GetInteger (0, allRoutes.size ()-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
selectIndex = 0;
|
||||
}
|
||||
Ipv4RoutingTableEntry* route = allRoutes.at (selectIndex);
|
||||
// create a Ipv4Route object from the selected routing table entry
|
||||
rtentry = Create<Ipv4Route> ();
|
||||
rtentry->SetDestination (route->GetDest ());
|
||||
// XXX handle multi-address case
|
||||
rtentry->SetSource (m_ipv4->GetAddress (route->GetInterface (), 0).GetLocal ());
|
||||
rtentry->SetGateway (route->GetGateway ());
|
||||
uint32_t interfaceIdx = route->GetInterface ();
|
||||
rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx));
|
||||
return rtentry;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Ipv4GlobalRouting::GetNRoutes (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
uint32_t n = 0;
|
||||
n += m_hostRoutes.size ();
|
||||
n += m_networkRoutes.size ();
|
||||
n += m_ASexternalRoutes.size ();
|
||||
return n;
|
||||
}
|
||||
|
||||
Ipv4RoutingTableEntry *
|
||||
Ipv4GlobalRouting::GetRoute (uint32_t index) const
|
||||
{
|
||||
NS_LOG_FUNCTION (index);
|
||||
if (index < m_hostRoutes.size ())
|
||||
{
|
||||
uint32_t tmp = 0;
|
||||
for (HostRoutesCI i = m_hostRoutes.begin ();
|
||||
i != m_hostRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
return *i;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
index -= m_hostRoutes.size ();
|
||||
uint32_t tmp = 0;
|
||||
if (index < m_networkRoutes.size ())
|
||||
{
|
||||
for (NetworkRoutesCI j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
return *j;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
index -= m_networkRoutes.size ();
|
||||
tmp = 0;
|
||||
for (ASExternalRoutesCI k = m_ASexternalRoutes.begin ();
|
||||
k != m_ASexternalRoutes.end ();
|
||||
k++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
return *k;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
NS_ASSERT (false);
|
||||
// quiet compiler.
|
||||
return 0;
|
||||
}
|
||||
void
|
||||
Ipv4GlobalRouting::RemoveRoute (uint32_t index)
|
||||
{
|
||||
NS_LOG_FUNCTION (index);
|
||||
if (index < m_hostRoutes.size ())
|
||||
{
|
||||
uint32_t tmp = 0;
|
||||
for (HostRoutesI i = m_hostRoutes.begin ();
|
||||
i != m_hostRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_hostRoutes.size ());
|
||||
delete *i;
|
||||
m_hostRoutes.erase (i);
|
||||
NS_LOG_LOGIC ("Done removing host route " << index << "; host route remaining size = " << m_hostRoutes.size ());
|
||||
return;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
index -= m_hostRoutes.size ();
|
||||
uint32_t tmp = 0;
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_networkRoutes.size ());
|
||||
delete *j;
|
||||
m_networkRoutes.erase (j);
|
||||
NS_LOG_LOGIC ("Done removing network route " << index << "; network route remaining size = " << m_networkRoutes.size ());
|
||||
return;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
index -= m_networkRoutes.size ();
|
||||
tmp = 0;
|
||||
for (ASExternalRoutesI k = m_ASexternalRoutes.begin ();
|
||||
k != m_ASexternalRoutes.end ();
|
||||
k++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_ASexternalRoutes.size ());
|
||||
delete *k;
|
||||
m_ASexternalRoutes.erase (k);
|
||||
NS_LOG_LOGIC ("Done removing network route " << index << "; network route remaining size = " << m_networkRoutes.size ());
|
||||
return;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
NS_ASSERT (false);
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4GlobalRouting::DoDispose (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
for (HostRoutesI i = m_hostRoutes.begin ();
|
||||
i != m_hostRoutes.end ();
|
||||
i = m_hostRoutes.erase (i))
|
||||
{
|
||||
delete (*i);
|
||||
}
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j = m_networkRoutes.erase (j))
|
||||
{
|
||||
delete (*j);
|
||||
}
|
||||
for (ASExternalRoutesI l = m_ASexternalRoutes.begin ();
|
||||
l != m_ASexternalRoutes.end ();
|
||||
l = m_ASexternalRoutes.erase (l))
|
||||
{
|
||||
delete (*l);
|
||||
}
|
||||
|
||||
Ipv4RoutingProtocol::DoDispose ();
|
||||
}
|
||||
|
||||
// Formatted like output of "route -n" command
|
||||
void
|
||||
Ipv4GlobalRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
|
||||
{
|
||||
std::ostream* os = stream->GetStream ();
|
||||
if (GetNRoutes () > 0)
|
||||
{
|
||||
*os << "Destination Gateway Genmask Flags Metric Ref Use Iface" << std::endl;
|
||||
for (uint32_t j = 0; j < GetNRoutes (); j++)
|
||||
{
|
||||
std::ostringstream dest, gw, mask, flags;
|
||||
Ipv4RoutingTableEntry route = GetRoute (j);
|
||||
dest << route.GetDest ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (16) << dest.str ();
|
||||
gw << route.GetGateway ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (16) << gw.str ();
|
||||
mask << route.GetDestNetworkMask ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (16) << mask.str ();
|
||||
flags << "U";
|
||||
if (route.IsHost ())
|
||||
{
|
||||
flags << "H";
|
||||
}
|
||||
else if (route.IsGateway ())
|
||||
{
|
||||
flags << "G";
|
||||
}
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (6) << flags.str ();
|
||||
// Metric not implemented
|
||||
*os << "-" << " ";
|
||||
// Ref ct not implemented
|
||||
*os << "-" << " ";
|
||||
// Use not implemented
|
||||
*os << "-" << " ";
|
||||
if (Names::FindName (m_ipv4->GetNetDevice (route.GetInterface ())) != "")
|
||||
{
|
||||
*os << Names::FindName (m_ipv4->GetNetDevice (route.GetInterface ()));
|
||||
}
|
||||
else
|
||||
{
|
||||
*os << route.GetInterface ();
|
||||
}
|
||||
*os << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<Ipv4Route>
|
||||
Ipv4GlobalRouting::RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr)
|
||||
{
|
||||
|
||||
//
|
||||
// First, see if this is a multicast packet we have a route for. If we
|
||||
// have a route, then send the packet down each of the specified interfaces.
|
||||
//
|
||||
if (header.GetDestination ().IsMulticast ())
|
||||
{
|
||||
NS_LOG_LOGIC ("Multicast destination-- returning false");
|
||||
return 0; // Let other routing protocols try to handle this
|
||||
}
|
||||
//
|
||||
// See if this is a unicast packet we have a route for.
|
||||
//
|
||||
NS_LOG_LOGIC ("Unicast destination- looking up");
|
||||
Ptr<Ipv4Route> rtentry = LookupGlobal (header.GetDestination (), oif);
|
||||
if (rtentry)
|
||||
{
|
||||
sockerr = Socket::ERROR_NOTERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
sockerr = Socket::ERROR_NOROUTETOHOST;
|
||||
}
|
||||
return rtentry;
|
||||
}
|
||||
|
||||
bool
|
||||
Ipv4GlobalRouting::RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb,
|
||||
LocalDeliverCallback lcb, ErrorCallback ecb)
|
||||
{
|
||||
|
||||
NS_LOG_FUNCTION (this << p << header << header.GetSource () << header.GetDestination () << idev);
|
||||
// Check if input device supports IP
|
||||
NS_ASSERT (m_ipv4->GetInterfaceForDevice (idev) >= 0);
|
||||
uint32_t iif = m_ipv4->GetInterfaceForDevice (idev);
|
||||
|
||||
if (header.GetDestination ().IsMulticast ())
|
||||
{
|
||||
NS_LOG_LOGIC ("Multicast destination-- returning false");
|
||||
return false; // Let other routing protocols try to handle this
|
||||
}
|
||||
|
||||
if (header.GetDestination ().IsBroadcast ())
|
||||
{
|
||||
NS_LOG_LOGIC ("For me (Ipv4Addr broadcast address)");
|
||||
// TODO: Local Deliver for broadcast
|
||||
// TODO: Forward broadcast
|
||||
}
|
||||
|
||||
// TODO: Configurable option to enable RFC 1222 Strong End System Model
|
||||
// Right now, we will be permissive and allow a source to send us
|
||||
// a packet to one of our other interface addresses; that is, the
|
||||
// destination unicast address does not match one of the iif addresses,
|
||||
// but we check our other interfaces. This could be an option
|
||||
// (to remove the outer loop immediately below and just check iif).
|
||||
for (uint32_t j = 0; j < m_ipv4->GetNInterfaces (); j++)
|
||||
{
|
||||
for (uint32_t i = 0; i < m_ipv4->GetNAddresses (j); i++)
|
||||
{
|
||||
Ipv4InterfaceAddress iaddr = m_ipv4->GetAddress (j, i);
|
||||
Ipv4Address addr = iaddr.GetLocal ();
|
||||
if (addr.IsEqual (header.GetDestination ()))
|
||||
{
|
||||
if (j == iif)
|
||||
{
|
||||
NS_LOG_LOGIC ("For me (destination " << addr << " match)");
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC ("For me (destination " << addr << " match) on another interface " << header.GetDestination ());
|
||||
}
|
||||
lcb (p, header, iif);
|
||||
return true;
|
||||
}
|
||||
if (header.GetDestination ().IsEqual (iaddr.GetBroadcast ()))
|
||||
{
|
||||
NS_LOG_LOGIC ("For me (interface broadcast address)");
|
||||
lcb (p, header, iif);
|
||||
return true;
|
||||
}
|
||||
NS_LOG_LOGIC ("Address "<< addr << " not a match");
|
||||
}
|
||||
}
|
||||
// Check if input device supports IP forwarding
|
||||
if (m_ipv4->IsForwarding (iif) == false)
|
||||
{
|
||||
NS_LOG_LOGIC ("Forwarding disabled for this interface");
|
||||
ecb (p, header, Socket::ERROR_NOROUTETOHOST);
|
||||
return false;
|
||||
}
|
||||
// Next, try to find a route
|
||||
NS_LOG_LOGIC ("Unicast destination- looking up global route");
|
||||
Ptr<Ipv4Route> rtentry = LookupGlobal (header.GetDestination ());
|
||||
if (rtentry != 0)
|
||||
{
|
||||
NS_LOG_LOGIC ("Found unicast destination- calling unicast callback");
|
||||
ucb (rtentry, p, header);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC ("Did not find unicast destination- returning false");
|
||||
return false; // Let other routing protocols try to handle this
|
||||
// route request.
|
||||
}
|
||||
}
|
||||
void
|
||||
Ipv4GlobalRouting::NotifyInterfaceUp (uint32_t i)
|
||||
{
|
||||
|
||||
@@ -20,26 +20,16 @@
|
||||
#ifndef IPV4_GLOBAL_ROUTING_H
|
||||
#define IPV4_GLOBAL_ROUTING_H
|
||||
|
||||
#include <list>
|
||||
#include <stdint.h>
|
||||
#include "ns3/ipv4-address.h"
|
||||
#include "ns3/ipv4-header.h"
|
||||
#include "ns3/ptr.h"
|
||||
#include "ns3/ipv4.h"
|
||||
#include "ns3/ipv4-routing-protocol.h"
|
||||
#include "ns3/random-variable.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class Packet;
|
||||
class NetDevice;
|
||||
class Ipv4Interface;
|
||||
class Ipv4Address;
|
||||
class Ipv4Header;
|
||||
class Ipv4RoutingTableEntry;
|
||||
class Ipv4MulticastRoutingTableEntry;
|
||||
class Node;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Global routing protocol for IP version 4 stacks.
|
||||
@@ -70,175 +60,45 @@ class Ipv4GlobalRouting : public Ipv4RoutingProtocol
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
/**
|
||||
* \brief Construct an empty Ipv4GlobalRouting routing protocol,
|
||||
*
|
||||
* The Ipv4GlobalRouting class supports host and network unicast routes.
|
||||
* This method initializes the lists containing these routes to empty.
|
||||
*
|
||||
* \see Ipv4GlobalRouting
|
||||
*/
|
||||
|
||||
Ipv4GlobalRouting ();
|
||||
virtual ~Ipv4GlobalRouting ();
|
||||
|
||||
// These methods inherited from base class
|
||||
virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr);
|
||||
|
||||
virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
|
||||
UnicastForwardCallback ucb, MulticastForwardCallback mcb,
|
||||
LocalDeliverCallback lcb, ErrorCallback ecb);
|
||||
virtual void NotifyInterfaceUp (uint32_t interface);
|
||||
virtual void NotifyInterfaceDown (uint32_t interface);
|
||||
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
|
||||
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
|
||||
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
|
||||
virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
|
||||
|
||||
/**
|
||||
* \brief Add a host route to the global routing table.
|
||||
* \brief Add a route to the global routing table.
|
||||
*
|
||||
* \param dest The Ipv4Address destination for this route.
|
||||
* \param destMask The Ipv4Mask to extract the network.
|
||||
* \param nextHop The Ipv4Address of the next hop in the route.
|
||||
* \param interface The network interface index used to send packets to the
|
||||
* destination.
|
||||
*
|
||||
* \see Ipv4Address
|
||||
*/
|
||||
void AddHostRouteTo (Ipv4Address dest,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface);
|
||||
/**
|
||||
* \brief Add a host route to the global routing table.
|
||||
*
|
||||
* \param dest The Ipv4Address destination for this route.
|
||||
* \param interface The network interface index used to send packets to the
|
||||
* destination.
|
||||
*
|
||||
* \see Ipv4Address
|
||||
*/
|
||||
void AddHostRouteTo (Ipv4Address dest,
|
||||
uint32_t interface);
|
||||
virtual void AddRouteTo (Ipv4Address dest,
|
||||
Ipv4Mask destMask,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface,
|
||||
uint32_t metric=0) = 0;
|
||||
|
||||
/**
|
||||
* \brief Add a network route to the global routing table.
|
||||
*
|
||||
* \param network The Ipv4Address network for this route.
|
||||
* \param networkMask The Ipv4Mask to extract the network.
|
||||
* \param nextHop The next hop in the route to the destination network.
|
||||
* \param interface The network interface index used to send packets to the
|
||||
* destination.
|
||||
*
|
||||
* \see Ipv4Address
|
||||
*/
|
||||
void AddNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface);
|
||||
|
||||
/**
|
||||
* \brief Add a network route to the global routing table.
|
||||
*
|
||||
* \param network The Ipv4Address network for this route.
|
||||
* \param networkMask The Ipv4Mask to extract the network.
|
||||
* \param interface The network interface index used to send packets to the
|
||||
* destination.
|
||||
*
|
||||
* \see Ipv4Address
|
||||
*/
|
||||
void AddNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
uint32_t interface);
|
||||
|
||||
/**
|
||||
* \brief Add an external route to the global routing table.
|
||||
*
|
||||
* \param network The Ipv4Address network for this route.
|
||||
* \param networkMask The Ipv4Mask to extract the network.
|
||||
* \param nextHop The next hop Ipv4Address
|
||||
* \param interface The network interface index used to send packets to the
|
||||
* destination.
|
||||
*/
|
||||
void AddASExternalRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface);
|
||||
|
||||
/**
|
||||
* \brief Get the number of individual unicast routes that have been added
|
||||
* to the routing table.
|
||||
*
|
||||
* \warning The default route counts as one of the routes.
|
||||
*/
|
||||
uint32_t GetNRoutes (void) const;
|
||||
|
||||
/**
|
||||
* \brief Get a route from the global unicast routing table.
|
||||
*
|
||||
* Externally, the unicast global routing table appears simply as a table with
|
||||
* n entries. The one subtlety of note is that if a default route has been set
|
||||
* it will appear as the zeroth entry in the table. This means that if you
|
||||
* add only a default route, the table will have one entry that can be accessed
|
||||
* either by explicitly calling GetDefaultRoute () or by calling GetRoute (0).
|
||||
*
|
||||
* Similarly, if the default route has been set, calling RemoveRoute (0) will
|
||||
* remove the default route.
|
||||
*
|
||||
* \param i The index (into the routing table) of the route to retrieve. If
|
||||
* the default route has been set, it will occupy index zero.
|
||||
* \return If route is set, a pointer to that Ipv4RoutingTableEntry is returned, otherwise
|
||||
* a zero pointer is returned.
|
||||
*
|
||||
* \see Ipv4RoutingTableEntry
|
||||
* \see Ipv4GlobalRouting::RemoveRoute
|
||||
*/
|
||||
Ipv4RoutingTableEntry *GetRoute (uint32_t i) const;
|
||||
|
||||
/**
|
||||
* \brief Remove a route from the global unicast routing table.
|
||||
*
|
||||
* Externally, the unicast global routing table appears simply as a table with
|
||||
* n entries. The one subtlety of note is that if a default route has been set
|
||||
* it will appear as the zeroth entry in the table. This means that if the
|
||||
* default route has been set, calling RemoveRoute (0) will remove the
|
||||
* default route.
|
||||
*
|
||||
* \param i The index (into the routing table) of the route to remove. If
|
||||
* the default route has been set, it will occupy index zero.
|
||||
*
|
||||
* \see Ipv4RoutingTableEntry
|
||||
* \see Ipv4GlobalRouting::GetRoute
|
||||
* \see Ipv4GlobalRouting::AddRoute
|
||||
*/
|
||||
void RemoveRoute (uint32_t i);
|
||||
/**
|
||||
* \brief Function to remove all routes
|
||||
*/
|
||||
virtual void DeleteRoutes () = 0;
|
||||
|
||||
protected:
|
||||
void DoDispose (void);
|
||||
// virtual Ptr<Ipv4Route> LookupGlobal (Ipv4Address dest, Ptr<NetDevice> oif = 0) = 0;
|
||||
|
||||
Ptr<Ipv4> m_ipv4;
|
||||
|
||||
private:
|
||||
/// Set to true if packets are randomly routed among ECMP; set to false for using only one route consistently
|
||||
bool m_randomEcmpRouting;
|
||||
/// Set to true if this interface should respond to interface events by globallly recomputing routes
|
||||
bool m_respondToInterfaceEvents;
|
||||
/// A uniform random number generator for randomly routing packets among ECMP
|
||||
UniformVariable m_rand;
|
||||
|
||||
typedef std::list<Ipv4RoutingTableEntry *> HostRoutes;
|
||||
typedef std::list<Ipv4RoutingTableEntry *>::const_iterator HostRoutesCI;
|
||||
typedef std::list<Ipv4RoutingTableEntry *>::iterator HostRoutesI;
|
||||
typedef std::list<Ipv4RoutingTableEntry *> NetworkRoutes;
|
||||
typedef std::list<Ipv4RoutingTableEntry *>::const_iterator NetworkRoutesCI;
|
||||
typedef std::list<Ipv4RoutingTableEntry *>::iterator NetworkRoutesI;
|
||||
typedef std::list<Ipv4RoutingTableEntry *> ASExternalRoutes;
|
||||
typedef std::list<Ipv4RoutingTableEntry *>::const_iterator ASExternalRoutesCI;
|
||||
typedef std::list<Ipv4RoutingTableEntry *>::iterator ASExternalRoutesI;
|
||||
|
||||
Ptr<Ipv4Route> LookupGlobal (Ipv4Address dest, Ptr<NetDevice> oif = 0);
|
||||
|
||||
HostRoutes m_hostRoutes;
|
||||
NetworkRoutes m_networkRoutes;
|
||||
ASExternalRoutes m_ASexternalRoutes; // External routes imported
|
||||
|
||||
Ptr<Ipv4> m_ipv4;
|
||||
};
|
||||
|
||||
} // Namespace ns3
|
||||
|
||||
@@ -547,11 +547,10 @@ Ipv4L3Protocol::Send (Ptr<Packet> packet,
|
||||
Ipv4Header ipHeader;
|
||||
bool mayFragment = true;
|
||||
uint8_t ttl = m_defaultTtl;
|
||||
SocketIpTtlTag tag;
|
||||
bool found = packet->RemovePacketTag (tag);
|
||||
if (found)
|
||||
Ptr<const SocketIpTtlTag> tag = packet->RemovePacketTag<SocketIpTtlTag> ();
|
||||
if (tag != 0)
|
||||
{
|
||||
ttl = tag.GetTtl ();
|
||||
ttl = tag->GetTtl ();
|
||||
}
|
||||
|
||||
// Handle a few cases:
|
||||
@@ -1285,7 +1284,7 @@ Ipv4L3Protocol::Fragments::AddFragment (Ptr<Packet> fragment, uint16_t fragmentO
|
||||
m_moreFragment = moreFragment;
|
||||
}
|
||||
|
||||
m_fragments.insert (it, std::make_pair (fragment, fragmentOffset));
|
||||
m_fragments.insert (it, std::make_pair<Ptr<Packet>, uint16_t> (fragment, fragmentOffset));
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -320,9 +320,10 @@ Ipv4RawSocketImpl::ForwardUp (Ptr<const Packet> p, Ipv4Header ipHeader, Ptr<Ipv4
|
||||
// Should check via getsockopt ()..
|
||||
if (IsRecvPktInfo ())
|
||||
{
|
||||
Ipv4PacketInfoTag tag;
|
||||
copy->RemovePacketTag (tag);
|
||||
tag.SetRecvIf (incomingInterface->GetDevice ()->GetIfIndex ());
|
||||
Ptr<const Ipv4PacketInfoTag> origTag = copy->RemovePacketTag<Ipv4PacketInfoTag> ();
|
||||
NS_ASSERT (origTag != 0);
|
||||
Ptr<Ipv4PacketInfoTag> tag = CreateObject<Ipv4PacketInfoTag> (*origTag);
|
||||
tag->SetRecvIf (incomingInterface->GetDevice ()->GetIfIndex ());
|
||||
copy->AddPacketTag (tag);
|
||||
}
|
||||
if (m_protocol == 1)
|
||||
|
||||
@@ -35,7 +35,8 @@ Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4RoutingTableEntry const &route
|
||||
: m_dest (route.m_dest),
|
||||
m_destNetworkMask (route.m_destNetworkMask),
|
||||
m_gateway (route.m_gateway),
|
||||
m_interface (route.m_interface)
|
||||
m_interface (route.m_interface),
|
||||
m_metric (route.m_metric)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -43,44 +44,53 @@ Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4RoutingTableEntry const *route
|
||||
: m_dest (route->m_dest),
|
||||
m_destNetworkMask (route->m_destNetworkMask),
|
||||
m_gateway (route->m_gateway),
|
||||
m_interface (route->m_interface)
|
||||
m_interface (route->m_interface),
|
||||
m_metric (route->m_metric)
|
||||
{
|
||||
}
|
||||
|
||||
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address dest,
|
||||
Ipv4Address gateway,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric/*=0*/)
|
||||
: m_dest (dest),
|
||||
m_destNetworkMask (Ipv4Mask::GetOnes ()),
|
||||
m_gateway (gateway),
|
||||
m_interface (interface)
|
||||
m_interface (interface),
|
||||
m_metric (metric)
|
||||
{
|
||||
}
|
||||
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address dest,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric/*=0*/)
|
||||
: m_dest (dest),
|
||||
m_destNetworkMask (Ipv4Mask::GetOnes ()),
|
||||
m_gateway (Ipv4Address::GetZero ()),
|
||||
m_interface (interface)
|
||||
m_interface (interface),
|
||||
m_metric (metric)
|
||||
{
|
||||
}
|
||||
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
Ipv4Address gateway,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric/*=0*/)
|
||||
: m_dest (network),
|
||||
m_destNetworkMask (networkMask),
|
||||
m_gateway (gateway),
|
||||
m_interface (interface)
|
||||
m_interface (interface),
|
||||
m_metric (metric)
|
||||
{
|
||||
}
|
||||
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric/*=0*/)
|
||||
: m_dest (network),
|
||||
m_destNetworkMask (networkMask),
|
||||
m_gateway (Ipv4Address::GetZero ()),
|
||||
m_interface (interface)
|
||||
m_interface (interface),
|
||||
m_metric (metric)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -151,41 +161,58 @@ Ipv4RoutingTableEntry::GetInterface (void) const
|
||||
return m_interface;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Ipv4RoutingTableEntry::GetMetric () const
|
||||
{
|
||||
return m_metric;
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4RoutingTableEntry::SetMetric (uint32_t metric)
|
||||
{
|
||||
m_metric = metric;
|
||||
}
|
||||
|
||||
Ipv4RoutingTableEntry
|
||||
Ipv4RoutingTableEntry::CreateHostRouteTo (Ipv4Address dest,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric/*=0*/)
|
||||
{
|
||||
return Ipv4RoutingTableEntry (dest, nextHop, interface);
|
||||
return Ipv4RoutingTableEntry (dest, nextHop, interface, metric);
|
||||
}
|
||||
Ipv4RoutingTableEntry
|
||||
Ipv4RoutingTableEntry::CreateHostRouteTo (Ipv4Address dest,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric/*=0*/)
|
||||
{
|
||||
return Ipv4RoutingTableEntry (dest, interface);
|
||||
return Ipv4RoutingTableEntry (dest, interface, metric);
|
||||
}
|
||||
Ipv4RoutingTableEntry
|
||||
Ipv4RoutingTableEntry::CreateNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric/*=0*/)
|
||||
{
|
||||
return Ipv4RoutingTableEntry (network, networkMask,
|
||||
nextHop, interface);
|
||||
nextHop, interface, metric);
|
||||
}
|
||||
Ipv4RoutingTableEntry
|
||||
Ipv4RoutingTableEntry::CreateNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric/*=0*/)
|
||||
{
|
||||
return Ipv4RoutingTableEntry (network, networkMask,
|
||||
interface);
|
||||
interface, metric);
|
||||
}
|
||||
Ipv4RoutingTableEntry
|
||||
Ipv4RoutingTableEntry::CreateDefaultRoute (Ipv4Address nextHop,
|
||||
uint32_t interface)
|
||||
uint32_t interface,
|
||||
uint32_t metric/*=0*/)
|
||||
{
|
||||
return Ipv4RoutingTableEntry (Ipv4Address::GetZero (), nextHop, interface);
|
||||
return Ipv4RoutingTableEntry (Ipv4Address::GetZero (), nextHop, interface, metric);
|
||||
}
|
||||
|
||||
|
||||
@@ -216,20 +243,21 @@ std::ostream& operator<< (std::ostream& os, Ipv4RoutingTableEntry const& route)
|
||||
{
|
||||
os << "network=" << route.GetDestNetwork () <<
|
||||
", mask=" << route.GetDestNetworkMask () <<
|
||||
",out=" << route.GetInterface () <<
|
||||
", out=" << route.GetInterface () <<
|
||||
", next hop=" << route.GetGateway ();
|
||||
}
|
||||
else
|
||||
{
|
||||
os << "network=" << route.GetDestNetwork () <<
|
||||
", mask=" << route.GetDestNetworkMask () <<
|
||||
",out=" << route.GetInterface ();
|
||||
", out=" << route.GetInterface ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_ASSERT (false);
|
||||
}
|
||||
os << ", metric=" << route.GetMetric ();
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,15 @@ public:
|
||||
* \return The Ipv4 interface number used for sending outgoing packets
|
||||
*/
|
||||
uint32_t GetInterface (void) const;
|
||||
/**
|
||||
* \return Routing metric
|
||||
*/
|
||||
uint32_t GetMetric () const;
|
||||
/**
|
||||
* Set/Updates metric of the routing table entry
|
||||
*/
|
||||
void SetMetric (uint32_t metric);
|
||||
|
||||
/**
|
||||
* \return An Ipv4RoutingTableEntry object corresponding to the input parameters.
|
||||
* \param dest Ipv4Address of the destination
|
||||
@@ -96,14 +105,16 @@ public:
|
||||
*/
|
||||
static Ipv4RoutingTableEntry CreateHostRouteTo (Ipv4Address dest,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric=0);
|
||||
/**
|
||||
* \return An Ipv4RoutingTableEntry object corresponding to the input parameters.
|
||||
* \param dest Ipv4Address of the destination
|
||||
* \param interface Outgoing interface
|
||||
*/
|
||||
static Ipv4RoutingTableEntry CreateHostRouteTo (Ipv4Address dest,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric=0);
|
||||
/**
|
||||
* \return An Ipv4RoutingTableEntry object corresponding to the input parameters.
|
||||
* \param network Ipv4Address of the destination network
|
||||
@@ -114,7 +125,8 @@ public:
|
||||
static Ipv4RoutingTableEntry CreateNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
Ipv4Address nextHop,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric=0);
|
||||
/**
|
||||
* \return An Ipv4RoutingTableEntry object corresponding to the input parameters.
|
||||
* \param network Ipv4Address of the destination network
|
||||
@@ -123,7 +135,8 @@ public:
|
||||
*/
|
||||
static Ipv4RoutingTableEntry CreateNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4Mask networkMask,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric=0);
|
||||
/**
|
||||
* \return An Ipv4RoutingTableEntry object corresponding to the input
|
||||
* parameters. This route is distinguished; it will match any
|
||||
@@ -132,26 +145,32 @@ public:
|
||||
* \param interface Outgoing interface
|
||||
*/
|
||||
static Ipv4RoutingTableEntry CreateDefaultRoute (Ipv4Address nextHop,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric=0);
|
||||
|
||||
private:
|
||||
Ipv4RoutingTableEntry (Ipv4Address network,
|
||||
Ipv4Mask mask,
|
||||
Ipv4Address gateway,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric=0);
|
||||
Ipv4RoutingTableEntry (Ipv4Address dest,
|
||||
Ipv4Mask mask,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric=0);
|
||||
Ipv4RoutingTableEntry (Ipv4Address dest,
|
||||
Ipv4Address gateway,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric=0);
|
||||
Ipv4RoutingTableEntry (Ipv4Address dest,
|
||||
uint32_t interface);
|
||||
uint32_t interface,
|
||||
uint32_t metric=0);
|
||||
|
||||
Ipv4Address m_dest;
|
||||
Ipv4Mask m_destNetworkMask;
|
||||
Ipv4Address m_gateway;
|
||||
uint32_t m_interface;
|
||||
uint32_t m_metric;
|
||||
};
|
||||
|
||||
std::ostream& operator<< (std::ostream& os, Ipv4RoutingTableEntry const& route);
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("Ipv4StaticRouting");
|
||||
|
||||
using std::make_pair;
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (Ipv4StaticRouting);
|
||||
@@ -70,8 +68,9 @@ Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network,
|
||||
*route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
|
||||
networkMask,
|
||||
nextHop,
|
||||
interface);
|
||||
m_networkRoutes.push_back (make_pair (route,metric));
|
||||
interface,
|
||||
metric);
|
||||
m_networkRoutes.push_back (route);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -84,8 +83,9 @@ Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network,
|
||||
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
|
||||
*route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
|
||||
networkMask,
|
||||
interface);
|
||||
m_networkRoutes.push_back (make_pair (route,metric));
|
||||
interface,
|
||||
metric);
|
||||
m_networkRoutes.push_back (route);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -142,7 +142,7 @@ Ipv4StaticRouting::SetDefaultMulticastRoute (uint32_t outputInterface)
|
||||
*route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
|
||||
networkMask,
|
||||
outputInterface);
|
||||
m_networkRoutes.push_back (make_pair (route,0));
|
||||
m_networkRoutes.push_back (route);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
@@ -162,7 +162,7 @@ Ipv4StaticRouting::GetMulticastRoute (uint32_t index) const
|
||||
if (index < m_multicastRoutes.size ())
|
||||
{
|
||||
uint32_t tmp = 0;
|
||||
for (MulticastRoutesCI i = m_multicastRoutes.begin ();
|
||||
for (MulticastRoutes::const_iterator i = m_multicastRoutes.begin ();
|
||||
i != m_multicastRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
@@ -182,7 +182,7 @@ Ipv4StaticRouting::RemoveMulticastRoute (Ipv4Address origin,
|
||||
uint32_t inputInterface)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << origin << " " << group << " " << inputInterface);
|
||||
for (MulticastRoutesI i = m_multicastRoutes.begin ();
|
||||
for (MulticastRoutes::iterator i = m_multicastRoutes.begin ();
|
||||
i != m_multicastRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
@@ -204,7 +204,7 @@ Ipv4StaticRouting::RemoveMulticastRoute (uint32_t index)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << index);
|
||||
uint32_t tmp = 0;
|
||||
for (MulticastRoutesI i = m_multicastRoutes.begin ();
|
||||
for (MulticastRoutes::iterator i = m_multicastRoutes.begin ();
|
||||
i != m_multicastRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
@@ -239,12 +239,12 @@ Ipv4StaticRouting::LookupStatic (Ipv4Address dest, Ptr<NetDevice> oif)
|
||||
}
|
||||
|
||||
|
||||
for (NetworkRoutesI i = m_networkRoutes.begin ();
|
||||
for (NetworkRoutes::iterator i = m_networkRoutes.begin ();
|
||||
i != m_networkRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
Ipv4RoutingTableEntry *j=i->first;
|
||||
uint32_t metric =i->second;
|
||||
Ipv4RoutingTableEntry *j=*i;
|
||||
uint32_t metric =j->GetMetric ();
|
||||
Ipv4Mask mask = (j)->GetDestNetworkMask ();
|
||||
uint16_t masklen = mask.GetPrefixLength ();
|
||||
Ipv4Address entry = (j)->GetDestNetwork ();
|
||||
@@ -305,7 +305,7 @@ Ipv4StaticRouting::LookupStatic (
|
||||
NS_LOG_FUNCTION (this << origin << " " << group << " " << interface);
|
||||
Ptr<Ipv4MulticastRoute> mrtentry = 0;
|
||||
|
||||
for (MulticastRoutesI i = m_multicastRoutes.begin ();
|
||||
for (MulticastRoutes::iterator i = m_multicastRoutes.begin ();
|
||||
i != m_multicastRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
@@ -363,13 +363,13 @@ Ipv4StaticRouting::GetDefaultRoute ()
|
||||
Ipv4Address dest ("0.0.0.0");
|
||||
uint32_t shortest_metric = 0xffffffff;
|
||||
Ipv4RoutingTableEntry *result = 0;
|
||||
for (NetworkRoutesI i = m_networkRoutes.begin ();
|
||||
for (NetworkRoutes::iterator i = m_networkRoutes.begin ();
|
||||
i != m_networkRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
Ipv4RoutingTableEntry *j = i->first;
|
||||
uint32_t metric = i->second;
|
||||
Ipv4Mask mask = (j)->GetDestNetworkMask ();
|
||||
Ipv4RoutingTableEntry *j = *i;
|
||||
uint32_t metric = j->GetMetric ();
|
||||
Ipv4Mask mask = j->GetDestNetworkMask ();
|
||||
uint16_t masklen = mask.GetPrefixLength ();
|
||||
if (masklen != 0)
|
||||
{
|
||||
@@ -397,13 +397,13 @@ Ipv4StaticRouting::GetRoute (uint32_t index) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << index);
|
||||
uint32_t tmp = 0;
|
||||
for (NetworkRoutesCI j = m_networkRoutes.begin ();
|
||||
for (NetworkRoutes::const_iterator j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
return j->first;
|
||||
return *j;
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
@@ -417,13 +417,13 @@ Ipv4StaticRouting::GetMetric (uint32_t index) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << index);
|
||||
uint32_t tmp = 0;
|
||||
for (NetworkRoutesCI j = m_networkRoutes.begin ();
|
||||
for (NetworkRoutes::const_iterator j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
return j->second;
|
||||
return (*j)->GetMetric ();
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
@@ -436,13 +436,13 @@ Ipv4StaticRouting::RemoveRoute (uint32_t index)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << index);
|
||||
uint32_t tmp = 0;
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin ();
|
||||
for (NetworkRoutes::iterator j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j++)
|
||||
{
|
||||
if (tmp == index)
|
||||
{
|
||||
delete j->first;
|
||||
delete *j;
|
||||
m_networkRoutes.erase (j);
|
||||
return;
|
||||
}
|
||||
@@ -584,13 +584,13 @@ Ipv4StaticRouting::~Ipv4StaticRouting ()
|
||||
void
|
||||
Ipv4StaticRouting::DoDispose (void)
|
||||
{
|
||||
for (NetworkRoutesI j = m_networkRoutes.begin ();
|
||||
for (NetworkRoutes::iterator j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j = m_networkRoutes.erase (j))
|
||||
{
|
||||
delete (j->first);
|
||||
delete *j;
|
||||
}
|
||||
for (MulticastRoutesI i = m_multicastRoutes.begin ();
|
||||
for (MulticastRoutes::iterator i = m_multicastRoutes.begin ();
|
||||
i != m_multicastRoutes.end ();
|
||||
i = m_multicastRoutes.erase (i))
|
||||
{
|
||||
@@ -708,15 +708,18 @@ Ipv4StaticRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
|
||||
if (GetNRoutes () > 0)
|
||||
{
|
||||
*os << "Destination Gateway Genmask Flags Metric Ref Use Iface" << std::endl;
|
||||
for (uint32_t j = 0; j < GetNRoutes (); j++)
|
||||
for (NetworkRoutes::const_iterator j = m_networkRoutes.begin ();
|
||||
j != m_networkRoutes.end ();
|
||||
j++)
|
||||
{
|
||||
std::ostringstream dest, gw, mask, flags;
|
||||
Ipv4RoutingTableEntry route = GetRoute (j);
|
||||
dest << route.GetDest ();
|
||||
Ipv4RoutingTableEntry &route = *(*j);
|
||||
|
||||
dest << route.GetDest ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (16) << dest.str ();
|
||||
gw << route.GetGateway ();
|
||||
gw << route.GetGateway ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (16) << gw.str ();
|
||||
mask << route.GetDestNetworkMask ();
|
||||
mask << route.GetDestNetworkMask ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (16) << mask.str ();
|
||||
flags << "U";
|
||||
if (route.IsHost ())
|
||||
@@ -728,7 +731,7 @@ Ipv4StaticRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
|
||||
flags << "GS";
|
||||
}
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (6) << flags.str ();
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (7) << GetMetric (j);
|
||||
*os << std::setiosflags (std::ios::left) << std::setw (6) << route.GetMetric ();
|
||||
// Ref ct not implemented
|
||||
*os << "-" << " ";
|
||||
// Use not implemented
|
||||
|
||||
@@ -375,13 +375,13 @@ protected:
|
||||
virtual void DoDispose (void);
|
||||
|
||||
private:
|
||||
typedef std::list<std::pair <Ipv4RoutingTableEntry *, uint32_t> > NetworkRoutes;
|
||||
typedef std::list<std::pair <Ipv4RoutingTableEntry *, uint32_t> >::const_iterator NetworkRoutesCI;
|
||||
typedef std::list<std::pair <Ipv4RoutingTableEntry *, uint32_t> >::iterator NetworkRoutesI;
|
||||
typedef std::list<Ipv4RoutingTableEntry *> NetworkRoutes;
|
||||
// typedef std::list<Ipv4RoutingTableEntry *>::const_iterator NetworkRoutesCI;
|
||||
// typedef std::list<Ipv4RoutingTableEntry *>::iterator NetworkRoutesI;
|
||||
|
||||
typedef std::list<Ipv4MulticastRoutingTableEntry *> MulticastRoutes;
|
||||
typedef std::list<Ipv4MulticastRoutingTableEntry *>::const_iterator MulticastRoutesCI;
|
||||
typedef std::list<Ipv4MulticastRoutingTableEntry *>::iterator MulticastRoutesI;
|
||||
// typedef std::list<Ipv4MulticastRoutingTableEntry *>::const_iterator MulticastRoutesCI;
|
||||
// typedef std::list<Ipv4MulticastRoutingTableEntry *>::iterator MulticastRoutesI;
|
||||
|
||||
Ptr<Ipv4Route> LookupStatic (Ipv4Address dest, Ptr<NetDevice> oif = 0);
|
||||
Ptr<Ipv4MulticastRoute> LookupStatic (Ipv4Address origin, Ipv4Address group,
|
||||
|
||||
@@ -334,7 +334,7 @@ uint8_t Ipv6ExtensionFragment::Process (Ptr<Packet>& packet, uint8_t offset, Ipv
|
||||
uint32_t identification = fragmentHeader.GetIdentification ();
|
||||
Ipv6Address src = ipv6Header.GetSourceAddress ();
|
||||
|
||||
std::pair<Ipv6Address, uint32_t> fragmentsId = std::make_pair (src, identification);
|
||||
std::pair<Ipv6Address, uint32_t> fragmentsId = std::make_pair<Ipv6Address, uint32_t> (src, identification);
|
||||
Ptr<Fragments> fragments;
|
||||
|
||||
Ipv6Header ipHeader = ipv6Header;
|
||||
@@ -599,7 +599,7 @@ void Ipv6ExtensionFragment::Fragments::AddFragment (Ptr<Packet> fragment, uint16
|
||||
m_moreFragment = moreFragment;
|
||||
}
|
||||
|
||||
m_packetFragments.insert (it, std::make_pair (fragment, fragmentOffset));
|
||||
m_packetFragments.insert (it, std::make_pair<Ptr<Packet>, uint16_t> (fragment, fragmentOffset));
|
||||
}
|
||||
|
||||
void Ipv6ExtensionFragment::Fragments::SetUnfragmentablePart (Ptr<Packet> unfragmentablePart)
|
||||
|
||||
@@ -610,12 +610,11 @@ void Ipv6L3Protocol::Send (Ptr<Packet> packet, Ipv6Address source, Ipv6Address d
|
||||
NS_LOG_FUNCTION (this << packet << source << destination << (uint32_t)protocol << route);
|
||||
Ipv6Header hdr;
|
||||
uint8_t ttl = m_defaultTtl;
|
||||
SocketIpTtlTag tag;
|
||||
bool found = packet->RemovePacketTag (tag);
|
||||
Ptr<const SocketIpTtlTag> tag = packet->RemovePacketTag<SocketIpTtlTag> ();
|
||||
|
||||
if (found)
|
||||
if (tag != 0)
|
||||
{
|
||||
ttl = tag.GetTtl ();
|
||||
ttl = tag->GetTtl ();
|
||||
}
|
||||
|
||||
/* Handle 3 cases:
|
||||
|
||||
@@ -340,9 +340,9 @@ bool Ipv6RawSocketImpl::ForwardUp (Ptr<const Packet> p, Ipv6Header hdr, Ptr<NetD
|
||||
// Should check via getsockopt ()..
|
||||
if (IsRecvPktInfo ())
|
||||
{
|
||||
Ipv6PacketInfoTag tag;
|
||||
copy->RemovePacketTag (tag);
|
||||
tag.SetRecvIf (device->GetIfIndex ());
|
||||
Ptr<const Ipv6PacketInfoTag> origTag = copy->RemovePacketTag<Ipv6PacketInfoTag> ();
|
||||
Ptr<Ipv6PacketInfoTag> tag = CreateObject<Ipv6PacketInfoTag> (*origTag);
|
||||
tag->SetRecvIf (device->GetIfIndex ());
|
||||
copy->AddPacketTag (tag);
|
||||
}
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ NscTcpL4Protocol::NotifyNewAggregate ()
|
||||
if (node != 0)
|
||||
{
|
||||
Ptr<Ipv4L3Protocol> ipv4 = this->GetObject<Ipv4L3Protocol> ();
|
||||
if (ipv4 != 0 && m_downTarget.IsNull ())
|
||||
if (ipv4 != 0)
|
||||
{
|
||||
this->SetNode (node);
|
||||
ipv4->Insert (this);
|
||||
|
||||
@@ -308,8 +308,8 @@ Time RttMeanDeviation::RetransmitTimeout ()
|
||||
//if (nSamples < 2) return est * 2;
|
||||
|
||||
double retval = std::min (m_maxRto.ToDouble (Time::S),
|
||||
std::max (m_multiplier*m_minRto.ToDouble (Time::S),
|
||||
m_multiplier*(m_currentEstimatedRtt.ToDouble (Time::S) + 4 * m_variance.ToDouble (Time::S))));
|
||||
std::max (m_minRto.ToDouble (Time::S),
|
||||
m_currentEstimatedRtt.ToDouble (Time::S) + 4 * m_variance.ToDouble (Time::S)));
|
||||
|
||||
// NS_LOG_DEBUG ("RetransmitTimeout: var " << var << " est " << m_currentEstimatedRtt.ToDouble (Time::S) << " multiplier " << m_multiplier);
|
||||
// if (var < (m_currentEstimatedRtt.ToDouble (Time::S) / 4.0) )
|
||||
|
||||
@@ -132,12 +132,12 @@ TcpL4Protocol::NotifyNewAggregate ()
|
||||
// need to keep track of whether we are connected to an IPv4 or
|
||||
// IPv6 lower layer and call the appropriate one.
|
||||
|
||||
if (ipv4 != 0 && m_downTarget.IsNull ())
|
||||
if (ipv4 != 0)
|
||||
{
|
||||
ipv4->Insert(this);
|
||||
this->SetDownTarget(MakeCallback(&Ipv4::Send, ipv4));
|
||||
}
|
||||
if (ipv6 != 0 && m_downTarget6.IsNull ())
|
||||
if (ipv6 != 0)
|
||||
{
|
||||
ipv6->Insert(this);
|
||||
this->SetDownTarget6(MakeCallback(&Ipv6L3Protocol::Send, ipv6));
|
||||
|
||||
@@ -269,7 +269,7 @@ TcpSocketBase::Bind6 (void)
|
||||
{
|
||||
m_errno = ERROR_ADDRNOTAVAIL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
m_tcp->m_sockets.push_back (this);
|
||||
return SetupCallback ();
|
||||
}
|
||||
@@ -281,30 +281,30 @@ TcpSocketBase::Bind (const Address &address)
|
||||
NS_LOG_FUNCTION (this << address);
|
||||
if (InetSocketAddress::IsMatchingType (address))
|
||||
{
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
Ipv4Address ipv4 = transport.GetIpv4 ();
|
||||
uint16_t port = transport.GetPort ();
|
||||
if (ipv4 == Ipv4Address::GetAny () && port == 0)
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate ();
|
||||
}
|
||||
else if (ipv4 == Ipv4Address::GetAny () && port != 0)
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate (port);
|
||||
}
|
||||
else if (ipv4 != Ipv4Address::GetAny () && port == 0)
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate (ipv4);
|
||||
}
|
||||
else if (ipv4 != Ipv4Address::GetAny () && port != 0)
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate (ipv4, port);
|
||||
}
|
||||
if (0 == m_endPoint)
|
||||
{
|
||||
m_errno = port ? ERROR_ADDRINUSE : ERROR_ADDRNOTAVAIL;
|
||||
return -1;
|
||||
}
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
Ipv4Address ipv4 = transport.GetIpv4 ();
|
||||
uint16_t port = transport.GetPort ();
|
||||
if (ipv4 == Ipv4Address::GetAny () && port == 0)
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate ();
|
||||
}
|
||||
else if (ipv4 == Ipv4Address::GetAny () && port != 0)
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate (port);
|
||||
}
|
||||
else if (ipv4 != Ipv4Address::GetAny () && port == 0)
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate (ipv4);
|
||||
}
|
||||
else if (ipv4 != Ipv4Address::GetAny () && port != 0)
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate (ipv4, port);
|
||||
}
|
||||
if (0 == m_endPoint)
|
||||
{
|
||||
m_errno = port ? ERROR_ADDRINUSE : ERROR_ADDRNOTAVAIL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (Inet6SocketAddress::IsMatchingType (address))
|
||||
{
|
||||
@@ -353,24 +353,24 @@ TcpSocketBase::Connect (const Address & address)
|
||||
// If haven't do so, Bind() this socket first
|
||||
if (InetSocketAddress::IsMatchingType (address) && m_endPoint6 == 0)
|
||||
{
|
||||
if (m_endPoint == 0)
|
||||
if (m_endPoint == 0)
|
||||
{
|
||||
if (Bind () == -1)
|
||||
{
|
||||
if (Bind () == -1)
|
||||
{
|
||||
NS_ASSERT (m_endPoint == 0);
|
||||
return -1; // Bind() failed
|
||||
}
|
||||
NS_ASSERT (m_endPoint != 0);
|
||||
NS_ASSERT (m_endPoint == 0);
|
||||
return -1; // Bind() failed
|
||||
}
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
m_endPoint->SetPeer (transport.GetIpv4 (), transport.GetPort ());
|
||||
NS_ASSERT (m_endPoint != 0);
|
||||
}
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
m_endPoint->SetPeer (transport.GetIpv4 (), transport.GetPort ());
|
||||
m_endPoint6 = 0;
|
||||
|
||||
// Get the appropriate local address and port number from the routing protocol and set up endpoint
|
||||
if (SetupEndpoint () != 0)
|
||||
{ // Route to destination does not exist
|
||||
return -1;
|
||||
}
|
||||
// Get the appropriate local address and port number from the routing protocol and set up endpoint
|
||||
if (SetupEndpoint () != 0)
|
||||
{ // Route to destination does not exist
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (Inet6SocketAddress::IsMatchingType (address) && m_endPoint == 0)
|
||||
{
|
||||
@@ -381,7 +381,7 @@ TcpSocketBase::Connect (const Address & address)
|
||||
if (v6Addr.IsIpv4MappedAddress () == true)
|
||||
{
|
||||
Ipv4Address v4Addr = v6Addr.GetIpv4MappedAddress ();
|
||||
return Connect (InetSocketAddress (v4Addr, transport.GetPort ()));
|
||||
return Connect(InetSocketAddress(v4Addr, transport.GetPort ()));
|
||||
}
|
||||
|
||||
if (m_endPoint6 == 0)
|
||||
@@ -526,15 +526,16 @@ TcpSocketBase::Recv (uint32_t maxSize, uint32_t flags)
|
||||
Ptr<Packet> outPacket = m_rxBuffer.Extract (maxSize);
|
||||
if (outPacket != 0 && outPacket->GetSize () != 0)
|
||||
{
|
||||
SocketAddressTag tag;
|
||||
Ptr<SocketAddressTag> tag = CreateObject<SocketAddressTag> ();
|
||||
if (m_endPoint != 0)
|
||||
{
|
||||
tag.SetAddress (InetSocketAddress (m_endPoint->GetPeerAddress (), m_endPoint->GetPeerPort ()));
|
||||
tag->SetAddress (InetSocketAddress (m_endPoint->GetPeerAddress (), m_endPoint->GetPeerPort ()));
|
||||
}
|
||||
else if (m_endPoint6 != 0)
|
||||
{
|
||||
tag.SetAddress (Inet6SocketAddress (m_endPoint6->GetPeerAddress (), m_endPoint6->GetPeerPort ()));
|
||||
tag->SetAddress (Inet6SocketAddress (m_endPoint6->GetPeerAddress (), m_endPoint6->GetPeerPort ()));
|
||||
}
|
||||
|
||||
outPacket->AddPacketTag (tag);
|
||||
}
|
||||
return outPacket;
|
||||
@@ -621,7 +622,7 @@ TcpSocketBase::BindToNetDevice (Ptr<NetDevice> netdevice)
|
||||
|
||||
if (m_endPoint != 0)
|
||||
{
|
||||
m_endPoint->BindToNetDevice (netdevice);
|
||||
m_endPoint->BindToNetDevice (netdevice);
|
||||
}
|
||||
// No BindToNetDevice() for Ipv6EndPoint
|
||||
return;
|
||||
@@ -639,8 +640,8 @@ TcpSocketBase::SetupCallback (void)
|
||||
}
|
||||
if (m_endPoint != 0)
|
||||
{
|
||||
m_endPoint->SetRxCallback (MakeCallback (&TcpSocketBase::ForwardUp, Ptr<TcpSocketBase> (this)));
|
||||
m_endPoint->SetDestroyCallback (MakeCallback (&TcpSocketBase::Destroy, Ptr<TcpSocketBase> (this)));
|
||||
m_endPoint->SetRxCallback (MakeCallback (&TcpSocketBase::ForwardUp, Ptr<TcpSocketBase> (this)));
|
||||
m_endPoint->SetDestroyCallback (MakeCallback (&TcpSocketBase::Destroy, Ptr<TcpSocketBase> (this)));
|
||||
}
|
||||
if (m_endPoint6 != 0)
|
||||
{
|
||||
@@ -791,7 +792,7 @@ TcpSocketBase::DoForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port
|
||||
TcpHeader tcpHeader;
|
||||
packet->RemoveHeader (tcpHeader);
|
||||
if (tcpHeader.GetFlags () & TcpHeader::ACK)
|
||||
{
|
||||
{
|
||||
EstimateRtt (tcpHeader);
|
||||
}
|
||||
ReadOptions (tcpHeader);
|
||||
@@ -810,7 +811,7 @@ TcpSocketBase::DoForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port
|
||||
{
|
||||
NS_LOG_LOGIC ("At state " << TcpStateName[m_state] <<
|
||||
" received packet of seq [" << tcpHeader.GetSequenceNumber () <<
|
||||
":" << tcpHeader.GetSequenceNumber () + packet->GetSize () <<
|
||||
":" << tcpHeader.GetSequenceNumber () + packet->GetSize() <<
|
||||
") out of range [" << m_rxBuffer.NextRxSequence () << ":" <<
|
||||
m_rxBuffer.MaxRxSequence () << ")");
|
||||
// Acknowledgement should be sent for all unacceptable packets (RFC793, p.69)
|
||||
@@ -905,7 +906,7 @@ TcpSocketBase::DoForwardUp (Ptr<Packet> packet, Ipv6Address saddr, Ipv6Address d
|
||||
{
|
||||
NS_LOG_LOGIC ("At state " << TcpStateName[m_state] <<
|
||||
" received packet of seq [" << tcpHeader.GetSequenceNumber () <<
|
||||
":" << tcpHeader.GetSequenceNumber () + packet->GetSize () <<
|
||||
":" << tcpHeader.GetSequenceNumber () + packet->GetSize() <<
|
||||
") out of range [" << m_rxBuffer.NextRxSequence () << ":" <<
|
||||
m_rxBuffer.MaxRxSequence () << ")");
|
||||
// Acknowledgement should be sent for all unacceptable packets (RFC793, p.69)
|
||||
@@ -1130,7 +1131,7 @@ TcpSocketBase::ProcessSynSent (Ptr<Packet> packet, const TcpHeader& tcpHeader)
|
||||
{ // Other in-sequence input
|
||||
if (tcpflags != TcpHeader::RST)
|
||||
{ // When (1) rx of FIN+ACK; (2) rx of FIN; (3) rx of bad flags
|
||||
NS_LOG_LOGIC ("Illegal flag " << std::hex << static_cast<uint32_t> (tcpflags) << std::dec << " received. Reset packet is sent.");
|
||||
NS_LOG_LOGIC ("Illegal flag " << std::hex << static_cast<uint32_t>(tcpflags) << std::dec << " received. Reset packet is sent.");
|
||||
SendRST ();
|
||||
}
|
||||
CloseAndNotify ();
|
||||
@@ -1149,7 +1150,7 @@ TcpSocketBase::ProcessSynRcvd (Ptr<Packet> packet, const TcpHeader& tcpHeader,
|
||||
|
||||
if (tcpflags == 0
|
||||
|| (tcpflags == TcpHeader::ACK
|
||||
&& m_nextTxSequence + SequenceNumber32 (1) == tcpHeader.GetAckNumber ()))
|
||||
&& m_nextTxSequence + SequenceNumber32 (1) == tcpHeader.GetAckNumber ()))
|
||||
{ // If it is bare data, accept it and move to ESTABLISHED state. This is
|
||||
// possibly due to ACK lost in 3WHS. If in-sequence ACK is received, the
|
||||
// handshake is completed nicely.
|
||||
@@ -1161,8 +1162,8 @@ TcpSocketBase::ProcessSynRcvd (Ptr<Packet> packet, const TcpHeader& tcpHeader,
|
||||
m_txBuffer.SetHeadSequence (m_nextTxSequence);
|
||||
if (m_endPoint)
|
||||
{
|
||||
m_endPoint->SetPeer (InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (),
|
||||
InetSocketAddress::ConvertFrom (fromAddress).GetPort ());
|
||||
m_endPoint->SetPeer (InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (),
|
||||
InetSocketAddress::ConvertFrom (fromAddress).GetPort ());
|
||||
}
|
||||
else if (m_endPoint6)
|
||||
{
|
||||
@@ -1195,8 +1196,8 @@ TcpSocketBase::ProcessSynRcvd (Ptr<Packet> packet, const TcpHeader& tcpHeader,
|
||||
m_txBuffer.SetHeadSequence (m_nextTxSequence);
|
||||
if (m_endPoint)
|
||||
{
|
||||
m_endPoint->SetPeer (InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (),
|
||||
InetSocketAddress::ConvertFrom (fromAddress).GetPort ());
|
||||
m_endPoint->SetPeer (InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (),
|
||||
InetSocketAddress::ConvertFrom (fromAddress).GetPort ());
|
||||
}
|
||||
else if (m_endPoint6)
|
||||
{
|
||||
@@ -1213,8 +1214,8 @@ TcpSocketBase::ProcessSynRcvd (Ptr<Packet> packet, const TcpHeader& tcpHeader,
|
||||
NS_LOG_LOGIC ("Illegal flag " << tcpflags << " received. Reset packet is sent.");
|
||||
if (m_endPoint)
|
||||
{
|
||||
m_endPoint->SetPeer (InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (),
|
||||
InetSocketAddress::ConvertFrom (fromAddress).GetPort ());
|
||||
m_endPoint->SetPeer (InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (),
|
||||
InetSocketAddress::ConvertFrom (fromAddress).GetPort ());
|
||||
}
|
||||
else if (m_endPoint6)
|
||||
{
|
||||
@@ -1294,9 +1295,9 @@ TcpSocketBase::ProcessWait (Ptr<Packet> packet, const TcpHeader& tcpHeader)
|
||||
if (!m_shutdownRecv)
|
||||
{
|
||||
NotifyDataRecv ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Received a packet upon CLOSING */
|
||||
void
|
||||
@@ -1450,12 +1451,12 @@ TcpSocketBase::Destroy (void)
|
||||
m_endPoint = 0;
|
||||
if (m_tcp != 0)
|
||||
{
|
||||
std::vector<Ptr<TcpSocketBase> >::iterator it
|
||||
= std::find (m_tcp->m_sockets.begin (), m_tcp->m_sockets.end (), this);
|
||||
if (it != m_tcp->m_sockets.end ())
|
||||
{
|
||||
m_tcp->m_sockets.erase (it);
|
||||
}
|
||||
std::vector<Ptr<TcpSocketBase> >::iterator it
|
||||
= std::find (m_tcp->m_sockets.begin (), m_tcp->m_sockets.end (), this);
|
||||
if (it != m_tcp->m_sockets.end ())
|
||||
{
|
||||
m_tcp->m_sockets.erase (it);
|
||||
}
|
||||
}
|
||||
NS_LOG_LOGIC (this << " Cancelled ReTxTimeout event which was set to expire at " <<
|
||||
(Simulator::Now () + Simulator::GetDelayLeft (m_retxEvent)).GetSeconds ());
|
||||
@@ -1511,8 +1512,8 @@ TcpSocketBase::SendEmptyPacket (uint8_t flags)
|
||||
header.SetAckNumber (m_rxBuffer.NextRxSequence ());
|
||||
if (m_endPoint != 0)
|
||||
{
|
||||
header.SetSourcePort (m_endPoint->GetLocalPort ());
|
||||
header.SetDestinationPort (m_endPoint->GetPeerPort ());
|
||||
header.SetSourcePort (m_endPoint->GetLocalPort ());
|
||||
header.SetDestinationPort (m_endPoint->GetPeerPort ());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1601,7 +1602,7 @@ TcpSocketBase::DeallocateEndPoint (void)
|
||||
if (it != m_tcp->m_sockets.end ())
|
||||
{
|
||||
m_tcp->m_sockets.erase (it);
|
||||
}
|
||||
}
|
||||
CancelAllTimers ();
|
||||
}
|
||||
}
|
||||
@@ -1677,10 +1678,10 @@ TcpSocketBase::CompleteFork (Ptr<Packet> p, const TcpHeader& h,
|
||||
// Get port and address from peer (connecting host)
|
||||
if (InetSocketAddress::IsMatchingType (toAddress))
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate (InetSocketAddress::ConvertFrom (toAddress).GetIpv4 (),
|
||||
InetSocketAddress::ConvertFrom (toAddress).GetPort (),
|
||||
InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (),
|
||||
InetSocketAddress::ConvertFrom (fromAddress).GetPort ());
|
||||
m_endPoint = m_tcp->Allocate (InetSocketAddress::ConvertFrom (toAddress).GetIpv4 (),
|
||||
InetSocketAddress::ConvertFrom (toAddress).GetPort (),
|
||||
InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (),
|
||||
InetSocketAddress::ConvertFrom (fromAddress).GetPort ());
|
||||
m_endPoint6 = 0;
|
||||
}
|
||||
else if (Inet6SocketAddress::IsMatchingType (toAddress))
|
||||
@@ -1748,8 +1749,8 @@ TcpSocketBase::SendDataPacket (SequenceNumber32 seq, uint32_t maxSize, bool with
|
||||
header.SetAckNumber (m_rxBuffer.NextRxSequence ());
|
||||
if (m_endPoint)
|
||||
{
|
||||
header.SetSourcePort (m_endPoint->GetLocalPort ());
|
||||
header.SetDestinationPort (m_endPoint->GetPeerPort ());
|
||||
header.SetSourcePort (m_endPoint->GetLocalPort ());
|
||||
header.SetDestinationPort (m_endPoint->GetPeerPort ());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1769,8 +1770,8 @@ TcpSocketBase::SendDataPacket (SequenceNumber32 seq, uint32_t maxSize, bool with
|
||||
NS_LOG_LOGIC ("Send packet via TcpL4Protocol with flags 0x" << std::hex << static_cast<uint32_t> (flags) << std::dec);
|
||||
if (m_endPoint)
|
||||
{
|
||||
m_tcp->SendPacket (p, header, m_endPoint->GetLocalAddress (),
|
||||
m_endPoint->GetPeerAddress (), m_boundnetdevice);
|
||||
m_tcp->SendPacket (p, header, m_endPoint->GetLocalAddress (),
|
||||
m_endPoint->GetPeerAddress (), m_boundnetdevice);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2061,8 +2062,8 @@ TcpSocketBase::PersistTimeout ()
|
||||
tcpHeader.SetWindowSize (AdvertisedWindowSize ());
|
||||
if (m_endPoint != 0)
|
||||
{
|
||||
tcpHeader.SetSourcePort (m_endPoint->GetLocalPort ());
|
||||
tcpHeader.SetDestinationPort (m_endPoint->GetPeerPort ());
|
||||
tcpHeader.SetSourcePort (m_endPoint->GetLocalPort ());
|
||||
tcpHeader.SetDestinationPort (m_endPoint->GetPeerPort ());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2073,8 +2074,8 @@ TcpSocketBase::PersistTimeout ()
|
||||
|
||||
if (m_endPoint != 0)
|
||||
{
|
||||
m_tcp->SendPacket (p, tcpHeader, m_endPoint->GetLocalAddress (),
|
||||
m_endPoint->GetPeerAddress (), m_boundnetdevice);
|
||||
m_tcp->SendPacket (p, tcpHeader, m_endPoint->GetLocalAddress (),
|
||||
m_endPoint->GetPeerAddress (), m_boundnetdevice);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2149,7 +2150,7 @@ TcpSocketBase::TimeWait ()
|
||||
CancelAllTimers ();
|
||||
// Move from TIME_WAIT to CLOSED after 2*MSL. Max segment lifetime is 2 min
|
||||
// according to RFC793, p.28
|
||||
m_timewaitEvent = Simulator::Schedule (Seconds (2 * m_msl),
|
||||
m_timewaitEvent = Simulator::Schedule (Seconds (2*m_msl),
|
||||
&TcpSocketBase::CloseAndNotify, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,6 @@ UdpL4Protocol::SetNode (Ptr<Node> node)
|
||||
void
|
||||
UdpL4Protocol::NotifyNewAggregate ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
Ptr<Node> node = this->GetObject<Node> ();
|
||||
Ptr<Ipv4> ipv4 = this->GetObject<Ipv4> ();
|
||||
Ptr<Ipv6L3Protocol> ipv6 = node->GetObject<Ipv6L3Protocol> ();
|
||||
@@ -109,12 +108,12 @@ UdpL4Protocol::NotifyNewAggregate ()
|
||||
// need to keep track of whether we are connected to an IPv4 or
|
||||
// IPv6 lower layer and call the appropriate one.
|
||||
|
||||
if (ipv4 != 0 && m_downTarget.IsNull())
|
||||
if (ipv4 != 0)
|
||||
{
|
||||
ipv4->Insert (this);
|
||||
this->SetDownTarget (MakeCallback (&Ipv4::Send, ipv4));
|
||||
}
|
||||
if (ipv6 != 0 && m_downTarget6.IsNull())
|
||||
if (ipv6 != 0)
|
||||
{
|
||||
ipv6->Insert (this);
|
||||
this->SetDownTarget6 (MakeCallback (&Ipv6L3Protocol::Send, ipv6));
|
||||
@@ -500,7 +499,6 @@ UdpL4Protocol::Send (Ptr<Packet> packet,
|
||||
void
|
||||
UdpL4Protocol::SetDownTarget (IpL4Protocol::DownTargetCallback callback)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_downTarget = callback;
|
||||
}
|
||||
|
||||
@@ -513,7 +511,6 @@ UdpL4Protocol::GetDownTarget (void) const
|
||||
void
|
||||
UdpL4Protocol::SetDownTarget6 (IpL4Protocol::DownTargetCallback6 callback)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_downTarget6 = callback;
|
||||
}
|
||||
|
||||
|
||||
@@ -182,9 +182,9 @@ UdpSocketImpl::FinishBind (void)
|
||||
bool done = false;
|
||||
if (m_endPoint != 0)
|
||||
{
|
||||
m_endPoint->SetRxCallback (MakeCallback (&UdpSocketImpl::ForwardUp, Ptr<UdpSocketImpl> (this)));
|
||||
m_endPoint->SetIcmpCallback (MakeCallback (&UdpSocketImpl::ForwardIcmp, Ptr<UdpSocketImpl> (this)));
|
||||
m_endPoint->SetDestroyCallback (MakeCallback (&UdpSocketImpl::Destroy, Ptr<UdpSocketImpl> (this)));
|
||||
m_endPoint->SetRxCallback (MakeCallback (&UdpSocketImpl::ForwardUp, Ptr<UdpSocketImpl> (this)));
|
||||
m_endPoint->SetIcmpCallback (MakeCallback (&UdpSocketImpl::ForwardIcmp, Ptr<UdpSocketImpl> (this)));
|
||||
m_endPoint->SetDestroyCallback (MakeCallback (&UdpSocketImpl::Destroy, Ptr<UdpSocketImpl> (this)));
|
||||
done = true;
|
||||
}
|
||||
if (m_endPoint6 != 0)
|
||||
@@ -196,8 +196,8 @@ UdpSocketImpl::FinishBind (void)
|
||||
}
|
||||
if (done)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ UdpSocketImpl::Bind (void)
|
||||
return FinishBind ();
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
UdpSocketImpl::Bind6 (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
@@ -224,25 +224,25 @@ UdpSocketImpl::Bind (const Address &address)
|
||||
|
||||
if (InetSocketAddress::IsMatchingType (address))
|
||||
{
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
Ipv4Address ipv4 = transport.GetIpv4 ();
|
||||
uint16_t port = transport.GetPort ();
|
||||
if (ipv4 == Ipv4Address::GetAny () && port == 0)
|
||||
{
|
||||
m_endPoint = m_udp->Allocate ();
|
||||
}
|
||||
else if (ipv4 == Ipv4Address::GetAny () && port != 0)
|
||||
{
|
||||
m_endPoint = m_udp->Allocate (port);
|
||||
}
|
||||
else if (ipv4 != Ipv4Address::GetAny () && port == 0)
|
||||
{
|
||||
m_endPoint = m_udp->Allocate (ipv4);
|
||||
}
|
||||
else if (ipv4 != Ipv4Address::GetAny () && port != 0)
|
||||
{
|
||||
m_endPoint = m_udp->Allocate (ipv4, port);
|
||||
}
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
Ipv4Address ipv4 = transport.GetIpv4 ();
|
||||
uint16_t port = transport.GetPort ();
|
||||
if (ipv4 == Ipv4Address::GetAny () && port == 0)
|
||||
{
|
||||
m_endPoint = m_udp->Allocate ();
|
||||
}
|
||||
else if (ipv4 == Ipv4Address::GetAny () && port != 0)
|
||||
{
|
||||
m_endPoint = m_udp->Allocate (port);
|
||||
}
|
||||
else if (ipv4 != Ipv4Address::GetAny () && port == 0)
|
||||
{
|
||||
m_endPoint = m_udp->Allocate (ipv4);
|
||||
}
|
||||
else if (ipv4 != Ipv4Address::GetAny () && port != 0)
|
||||
{
|
||||
m_endPoint = m_udp->Allocate (ipv4, port);
|
||||
}
|
||||
}
|
||||
else if (Inet6SocketAddress::IsMatchingType (address))
|
||||
{
|
||||
@@ -312,11 +312,11 @@ UdpSocketImpl::Connect (const Address & address)
|
||||
NS_LOG_FUNCTION (this << address);
|
||||
if (InetSocketAddress::IsMatchingType(address) == true)
|
||||
{
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
m_defaultAddress = Address(transport.GetIpv4 ());
|
||||
m_defaultPort = transport.GetPort ();
|
||||
m_connected = true;
|
||||
NotifyConnectionSucceeded ();
|
||||
m_defaultPort = transport.GetPort ();
|
||||
m_connected = true;
|
||||
NotifyConnectionSucceeded ();
|
||||
}
|
||||
else if (Inet6SocketAddress::IsMatchingType(address) == true)
|
||||
{
|
||||
@@ -395,11 +395,11 @@ UdpSocketImpl::DoSendTo (Ptr<Packet> p, const Address &address)
|
||||
NS_LOG_LOGIC ("Not connected");
|
||||
if (InetSocketAddress::IsMatchingType(address) == true)
|
||||
{
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
Ipv4Address ipv4 = transport.GetIpv4 ();
|
||||
uint16_t port = transport.GetPort ();
|
||||
return DoSendTo (p, ipv4, port);
|
||||
}
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
Ipv4Address ipv4 = transport.GetIpv4 ();
|
||||
uint16_t port = transport.GetPort ();
|
||||
return DoSendTo (p, ipv4, port);
|
||||
}
|
||||
else if (Inet6SocketAddress::IsMatchingType(address) == true)
|
||||
{
|
||||
Inet6SocketAddress transport = Inet6SocketAddress::ConvertFrom (address);
|
||||
@@ -407,8 +407,8 @@ UdpSocketImpl::DoSendTo (Ptr<Packet> p, const Address &address)
|
||||
uint16_t port = transport.GetPort ();
|
||||
return DoSendTo (p, ipv6, port);
|
||||
}
|
||||
else
|
||||
{
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -419,11 +419,11 @@ UdpSocketImpl::DoSendTo (Ptr<Packet> p, const Address &address)
|
||||
if (Ipv4Address::IsMatchingType(m_defaultAddress))
|
||||
{
|
||||
return DoSendTo (p, Ipv4Address::ConvertFrom(m_defaultAddress), m_defaultPort);
|
||||
}
|
||||
}
|
||||
else if (Ipv6Address::IsMatchingType(m_defaultAddress))
|
||||
{
|
||||
return DoSendTo (p, Ipv6Address::ConvertFrom(m_defaultAddress), m_defaultPort);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_errno = ERROR_AFNOSUPPORT;
|
||||
return(-1);
|
||||
@@ -470,28 +470,29 @@ UdpSocketImpl::DoSendTo (Ptr<Packet> p, Ipv4Address dest, uint16_t port)
|
||||
// the same as a unicast, but it will be fixed further down the stack
|
||||
if (m_ipMulticastTtl != 0 && dest.IsMulticast ())
|
||||
{
|
||||
SocketIpTtlTag tag;
|
||||
tag.SetTtl (m_ipMulticastTtl);
|
||||
Ptr<SocketIpTtlTag> tag = CreateObject<SocketIpTtlTag> ();
|
||||
tag->SetTtl (m_ipMulticastTtl);
|
||||
p->AddPacketTag (tag);
|
||||
}
|
||||
else if (m_ipTtl != 0 && !dest.IsMulticast () && !dest.IsBroadcast ())
|
||||
{
|
||||
SocketIpTtlTag tag;
|
||||
tag.SetTtl (m_ipTtl);
|
||||
Ptr<SocketIpTtlTag> tag = CreateObject<SocketIpTtlTag> ();
|
||||
tag->SetTtl (m_ipTtl);
|
||||
p->AddPacketTag (tag);
|
||||
}
|
||||
{
|
||||
SocketSetDontFragmentTag tag;
|
||||
bool found = p->RemovePacketTag (tag);
|
||||
if (!found)
|
||||
|
||||
// !!! Previously, header was removed, checked, but never added back. Guess, this was wrong
|
||||
if (p->PeekPacketTag<SocketSetDontFragmentTag> () == 0)
|
||||
{
|
||||
Ptr<SocketSetDontFragmentTag> tag = CreateObject<SocketSetDontFragmentTag> ();
|
||||
if (m_mtuDiscover)
|
||||
{
|
||||
tag.Enable ();
|
||||
tag->Enable ();
|
||||
}
|
||||
else
|
||||
{
|
||||
tag.Disable ();
|
||||
tag->Disable ();
|
||||
}
|
||||
p->AddPacketTag (tag);
|
||||
}
|
||||
@@ -658,14 +659,14 @@ UdpSocketImpl::DoSendTo (Ptr<Packet> p, Ipv6Address dest, uint16_t port)
|
||||
// the same as a unicast, but it will be fixed further down the stack
|
||||
if (m_ipMulticastTtl != 0 && dest.IsMulticast ())
|
||||
{
|
||||
SocketIpTtlTag tag;
|
||||
tag.SetTtl (m_ipMulticastTtl);
|
||||
Ptr<SocketIpTtlTag> tag = CreateObject<SocketIpTtlTag> ();
|
||||
tag->SetTtl (m_ipMulticastTtl);
|
||||
p->AddPacketTag (tag);
|
||||
}
|
||||
else if (m_ipTtl != 0 && !dest.IsMulticast ())
|
||||
{
|
||||
SocketIpTtlTag tag;
|
||||
tag.SetTtl (m_ipTtl);
|
||||
Ptr<SocketIpTtlTag> tag = CreateObject<SocketIpTtlTag> ();
|
||||
tag->SetTtl (m_ipTtl);
|
||||
p->AddPacketTag (tag);
|
||||
}
|
||||
// There is no analgous to an IPv4 broadcast address in IPv6.
|
||||
@@ -736,11 +737,11 @@ UdpSocketImpl::SendTo (Ptr<Packet> p, uint32_t flags, const Address &address)
|
||||
NS_LOG_FUNCTION (this << p << flags << address);
|
||||
if (InetSocketAddress::IsMatchingType (address))
|
||||
{
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
Ipv4Address ipv4 = transport.GetIpv4 ();
|
||||
uint16_t port = transport.GetPort ();
|
||||
return DoSendTo (p, ipv4, port);
|
||||
}
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
Ipv4Address ipv4 = transport.GetIpv4 ();
|
||||
uint16_t port = transport.GetPort ();
|
||||
return DoSendTo (p, ipv4, port);
|
||||
}
|
||||
else if (Inet6SocketAddress::IsMatchingType (address))
|
||||
{
|
||||
Inet6SocketAddress transport = Inet6SocketAddress::ConvertFrom (address);
|
||||
@@ -790,11 +791,9 @@ UdpSocketImpl::RecvFrom (uint32_t maxSize, uint32_t flags,
|
||||
Ptr<Packet> packet = Recv (maxSize, flags);
|
||||
if (packet != 0)
|
||||
{
|
||||
SocketAddressTag tag;
|
||||
bool found;
|
||||
found = packet->PeekPacketTag (tag);
|
||||
NS_ASSERT (found);
|
||||
fromAddress = tag.GetAddress ();
|
||||
Ptr<const SocketAddressTag> tag = packet->PeekPacketTag<SocketAddressTag> ();
|
||||
NS_ASSERT (tag != 0);
|
||||
fromAddress = tag->GetAddress ();
|
||||
}
|
||||
return packet;
|
||||
}
|
||||
@@ -876,17 +875,17 @@ UdpSocketImpl::ForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port,
|
||||
// Should check via getsockopt ()..
|
||||
if (IsRecvPktInfo ())
|
||||
{
|
||||
Ipv4PacketInfoTag tag;
|
||||
packet->RemovePacketTag (tag);
|
||||
tag.SetRecvIf (incomingInterface->GetDevice ()->GetIfIndex ());
|
||||
Ptr<const Ipv4PacketInfoTag> origTag = packet->RemovePacketTag<Ipv4PacketInfoTag> ();
|
||||
Ptr<Ipv4PacketInfoTag> tag = CreateObject<Ipv4PacketInfoTag> (*origTag);
|
||||
tag->SetRecvIf (incomingInterface->GetDevice ()->GetIfIndex ());
|
||||
packet->AddPacketTag (tag);
|
||||
}
|
||||
|
||||
if ((m_rxAvailable + packet->GetSize ()) <= m_rcvBufSize)
|
||||
{
|
||||
Address address = InetSocketAddress (header.GetSource (), port);
|
||||
SocketAddressTag tag;
|
||||
tag.SetAddress (address);
|
||||
Ptr<SocketAddressTag> tag = CreateObject<SocketAddressTag> ();
|
||||
tag->SetAddress (address);
|
||||
packet->AddPacketTag (tag);
|
||||
m_deliveryQueue.push (packet);
|
||||
m_rxAvailable += packet->GetSize ();
|
||||
@@ -904,7 +903,7 @@ UdpSocketImpl::ForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
UdpSocketImpl::ForwardUp6 (Ptr<Packet> packet, Ipv6Address saddr, Ipv6Address daddr, uint16_t port)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << packet << saddr << port);
|
||||
@@ -917,8 +916,8 @@ UdpSocketImpl::ForwardUp6 (Ptr<Packet> packet, Ipv6Address saddr, Ipv6Address da
|
||||
if ((m_rxAvailable + packet->GetSize ()) <= m_rcvBufSize)
|
||||
{
|
||||
Address address = Inet6SocketAddress (saddr, port);
|
||||
SocketAddressTag tag;
|
||||
tag.SetAddress (address);
|
||||
Ptr<SocketAddressTag> tag = CreateObject<SocketAddressTag> ();
|
||||
tag->SetAddress (address);
|
||||
packet->AddPacketTag (tag);
|
||||
m_deliveryQueue.push (packet);
|
||||
m_rxAvailable += packet->GetSize ();
|
||||
|
||||
@@ -97,10 +97,8 @@ Ipv4PacketInfoTagTest::RxCb (Ptr<Socket> socket)
|
||||
m_receivedPacket = socket->Recv (std::numeric_limits<uint32_t>::max (), 0);
|
||||
NS_TEST_ASSERT_MSG_EQ (availableData, m_receivedPacket->GetSize (), "Did not read expected data");
|
||||
|
||||
Ipv4PacketInfoTag tag;
|
||||
bool found;
|
||||
found = m_receivedPacket->RemovePacketTag (tag);
|
||||
NS_TEST_ASSERT_MSG_EQ (found, true, "Could not find tag");
|
||||
Ptr<const Ipv4PacketInfoTag> tag = m_receivedPacket->RemovePacketTag<Ipv4PacketInfoTag> ();
|
||||
NS_TEST_ASSERT_MSG_NE (tag, 0, "Could not find tag");
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -93,10 +93,8 @@ Ipv6PacketInfoTagTest::RxCb (Ptr<Socket> socket)
|
||||
m_receivedPacket = socket->Recv (std::numeric_limits<uint32_t>::max (), 0);
|
||||
NS_TEST_ASSERT_MSG_EQ (availableData, m_receivedPacket->GetSize (), "Did not read expected data");
|
||||
|
||||
Ipv6PacketInfoTag tag;
|
||||
bool found;
|
||||
found = m_receivedPacket->RemovePacketTag (tag);
|
||||
NS_TEST_ASSERT_MSG_EQ (found, true, "Could not find tag");
|
||||
Ptr<const Ipv6PacketInfoTag> tag = m_receivedPacket->RemovePacketTag<Ipv6PacketInfoTag> ();
|
||||
NS_TEST_ASSERT_MSG_NE (tag, 0, "Could not find tag");
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -93,6 +93,7 @@ def configure(conf):
|
||||
def build(bld):
|
||||
# bridge and mpi dependencies are due to global routing
|
||||
obj = bld.create_ns3_module('internet', ['bridge', 'mpi', 'network', 'core'])
|
||||
|
||||
obj.source = [
|
||||
'model/ip-l4-protocol.cc',
|
||||
'model/udp-header.cc',
|
||||
@@ -173,6 +174,7 @@ def build(bld):
|
||||
'model/global-route-manager-impl.cc',
|
||||
'model/candidate-queue.cc',
|
||||
'model/ipv4-global-routing.cc',
|
||||
'model/ipv4-global-routing-one-nexthop.cc',
|
||||
'helper/ipv4-global-routing-helper.cc',
|
||||
'helper/internet-stack-helper.cc',
|
||||
'helper/internet-trace-helper.cc',
|
||||
@@ -270,6 +272,7 @@ def build(bld):
|
||||
'model/global-route-manager-impl.h',
|
||||
'model/candidate-queue.h',
|
||||
'model/ipv4-global-routing.h',
|
||||
'model/ipv4-global-routing-one-nexthop.h',
|
||||
'helper/ipv4-global-routing-helper.h',
|
||||
'helper/internet-stack-helper.h',
|
||||
'helper/internet-trace-helper.h',
|
||||
|
||||
@@ -276,8 +276,8 @@ def register_types(module):
|
||||
module.add_class('TagData', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagList'])
|
||||
## random-variable.h (module 'core'): ns3::RandomVariable [class]
|
||||
module.add_class('RandomVariable', import_from_module='ns.core')
|
||||
## rng-seed-manager.h (module 'core'): ns3::RngSeedManager [class]
|
||||
module.add_class('RngSeedManager', import_from_module='ns.core')
|
||||
## random-variable.h (module 'core'): ns3::SeedManager [class]
|
||||
module.add_class('SeedManager', import_from_module='ns.core')
|
||||
## lte-rlc-sequence-number.h (module 'lte'): ns3::SequenceNumber10 [class]
|
||||
module.add_class('SequenceNumber10')
|
||||
## random-variable.h (module 'core'): ns3::SequentialVariable [class]
|
||||
@@ -737,10 +737,6 @@ def register_types(module):
|
||||
module.add_container('std::map< unsigned short, ns3::Ptr< ns3::UeInfo > >', ('short unsigned int', 'ns3::Ptr< ns3::UeInfo >'), container_type='map')
|
||||
module.add_container('std::list< ns3::Ptr< ns3::IdealControlMessage > >', 'ns3::Ptr< ns3::IdealControlMessage >', container_type='list')
|
||||
module.add_container('std::list< ns3::UlDciIdealControlMessage >', 'ns3::UlDciIdealControlMessage', container_type='list')
|
||||
typehandlers.add_type_alias('ns3::RngSeedManager', 'ns3::SeedManager')
|
||||
typehandlers.add_type_alias('ns3::RngSeedManager*', 'ns3::SeedManager*')
|
||||
typehandlers.add_type_alias('ns3::RngSeedManager&', 'ns3::SeedManager&')
|
||||
module.add_typedef(root_module['ns3::RngSeedManager'], 'SeedManager')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned long long, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned long long > > >', 'ns3::Uint64Map')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned long long, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned long long > > >*', 'ns3::Uint64Map*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned long long, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned long long > > >&', 'ns3::Uint64Map&')
|
||||
@@ -762,9 +758,6 @@ def register_types(module):
|
||||
typehandlers.add_type_alias('std::vector< ns3::BandInfo, std::allocator< ns3::BandInfo > >', 'ns3::Bands')
|
||||
typehandlers.add_type_alias('std::vector< ns3::BandInfo, std::allocator< ns3::BandInfo > >*', 'ns3::Bands*')
|
||||
typehandlers.add_type_alias('std::vector< ns3::BandInfo, std::allocator< ns3::BandInfo > >&', 'ns3::Bands&')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >', 'ns3::expectedTbs_t')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >*', 'ns3::expectedTbs_t*')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >&', 'ns3::expectedTbs_t&')
|
||||
typehandlers.add_type_alias('ns3::Vector3D', 'ns3::Vector')
|
||||
typehandlers.add_type_alias('ns3::Vector3D*', 'ns3::Vector*')
|
||||
typehandlers.add_type_alias('ns3::Vector3D&', 'ns3::Vector&')
|
||||
@@ -776,12 +769,15 @@ def register_types(module):
|
||||
typehandlers.add_type_alias('uint32_t', 'ns3::SpectrumModelUid_t')
|
||||
typehandlers.add_type_alias('uint32_t*', 'ns3::SpectrumModelUid_t*')
|
||||
typehandlers.add_type_alias('uint32_t&', 'ns3::SpectrumModelUid_t&')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, double, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, double > > >', 'ns3::DoubleMap')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, double, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, double > > >*', 'ns3::DoubleMap*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, double, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, double > > >&', 'ns3::DoubleMap&')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned int, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned int > > >', 'ns3::Uint32Map')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned int, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned int > > >*', 'ns3::Uint32Map*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned int, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned int > > >&', 'ns3::Uint32Map&')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, double, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, double > > >', 'ns3::DoubleMap')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, double, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, double > > >*', 'ns3::DoubleMap*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, double, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, double > > >&', 'ns3::DoubleMap&')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >', 'ns3::expectedTbs_t')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >*', 'ns3::expectedTbs_t*')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >&', 'ns3::expectedTbs_t&')
|
||||
typehandlers.add_type_alias('ns3::Vector3DChecker', 'ns3::VectorChecker')
|
||||
typehandlers.add_type_alias('ns3::Vector3DChecker*', 'ns3::VectorChecker*')
|
||||
typehandlers.add_type_alias('ns3::Vector3DChecker&', 'ns3::VectorChecker&')
|
||||
@@ -938,7 +934,7 @@ def register_methods(root_module):
|
||||
register_Ns3PacketTagList_methods(root_module, root_module['ns3::PacketTagList'])
|
||||
register_Ns3PacketTagListTagData_methods(root_module, root_module['ns3::PacketTagList::TagData'])
|
||||
register_Ns3RandomVariable_methods(root_module, root_module['ns3::RandomVariable'])
|
||||
register_Ns3RngSeedManager_methods(root_module, root_module['ns3::RngSeedManager'])
|
||||
register_Ns3SeedManager_methods(root_module, root_module['ns3::SeedManager'])
|
||||
register_Ns3SequenceNumber10_methods(root_module, root_module['ns3::SequenceNumber10'])
|
||||
register_Ns3SequentialVariable_methods(root_module, root_module['ns3::SequentialVariable'])
|
||||
register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
|
||||
@@ -1401,10 +1397,6 @@ def register_Ns3BufferIterator_methods(root_module, cls):
|
||||
cls.add_method('Next',
|
||||
'void',
|
||||
[param('uint32_t', 'delta')])
|
||||
## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::PeekU8() [member function]
|
||||
cls.add_method('PeekU8',
|
||||
'uint8_t',
|
||||
[])
|
||||
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev() [member function]
|
||||
cls.add_method('Prev',
|
||||
'void',
|
||||
@@ -1417,10 +1409,6 @@ def register_Ns3BufferIterator_methods(root_module, cls):
|
||||
cls.add_method('Read',
|
||||
'void',
|
||||
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')])
|
||||
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(ns3::Buffer::Iterator start, uint32_t size) [member function]
|
||||
cls.add_method('Read',
|
||||
'void',
|
||||
[param('ns3::Buffer::Iterator', 'start'), param('uint32_t', 'size')])
|
||||
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadLsbtohU16() [member function]
|
||||
cls.add_method('ReadLsbtohU16',
|
||||
'uint16_t',
|
||||
@@ -4157,32 +4145,32 @@ def register_Ns3RandomVariable_methods(root_module, cls):
|
||||
is_const=True)
|
||||
return
|
||||
|
||||
def register_Ns3RngSeedManager_methods(root_module, cls):
|
||||
## rng-seed-manager.h (module 'core'): ns3::RngSeedManager::RngSeedManager() [constructor]
|
||||
def register_Ns3SeedManager_methods(root_module, cls):
|
||||
## random-variable.h (module 'core'): ns3::SeedManager::SeedManager() [constructor]
|
||||
cls.add_constructor([])
|
||||
## rng-seed-manager.h (module 'core'): ns3::RngSeedManager::RngSeedManager(ns3::RngSeedManager const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RngSeedManager const &', 'arg0')])
|
||||
## rng-seed-manager.h (module 'core'): static uint64_t ns3::RngSeedManager::GetNextStreamIndex() [member function]
|
||||
cls.add_method('GetNextStreamIndex',
|
||||
'uint64_t',
|
||||
[],
|
||||
## random-variable.h (module 'core'): ns3::SeedManager::SeedManager(ns3::SeedManager const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::SeedManager const &', 'arg0')])
|
||||
## random-variable.h (module 'core'): static bool ns3::SeedManager::CheckSeed(uint32_t seed) [member function]
|
||||
cls.add_method('CheckSeed',
|
||||
'bool',
|
||||
[param('uint32_t', 'seed')],
|
||||
is_static=True)
|
||||
## rng-seed-manager.h (module 'core'): static uint64_t ns3::RngSeedManager::GetRun() [member function]
|
||||
## random-variable.h (module 'core'): static uint32_t ns3::SeedManager::GetRun() [member function]
|
||||
cls.add_method('GetRun',
|
||||
'uint64_t',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_static=True)
|
||||
## rng-seed-manager.h (module 'core'): static uint32_t ns3::RngSeedManager::GetSeed() [member function]
|
||||
## random-variable.h (module 'core'): static uint32_t ns3::SeedManager::GetSeed() [member function]
|
||||
cls.add_method('GetSeed',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_static=True)
|
||||
## rng-seed-manager.h (module 'core'): static void ns3::RngSeedManager::SetRun(uint64_t run) [member function]
|
||||
## random-variable.h (module 'core'): static void ns3::SeedManager::SetRun(uint32_t run) [member function]
|
||||
cls.add_method('SetRun',
|
||||
'void',
|
||||
[param('uint64_t', 'run')],
|
||||
[param('uint32_t', 'run')],
|
||||
is_static=True)
|
||||
## rng-seed-manager.h (module 'core'): static void ns3::RngSeedManager::SetSeed(uint32_t seed) [member function]
|
||||
## random-variable.h (module 'core'): static void ns3::SeedManager::SetSeed(uint32_t seed) [member function]
|
||||
cls.add_method('SetSeed',
|
||||
'void',
|
||||
[param('uint32_t', 'seed')],
|
||||
@@ -4781,25 +4769,12 @@ def register_Ns3UniformVariable_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Vector2D_methods(root_module, cls):
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('double', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('/', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('double', 'right'))
|
||||
## vector.h (module 'core'): ns3::Vector2D::Vector2D(ns3::Vector2D const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Vector2D const &', 'arg0')])
|
||||
## vector.h (module 'core'): ns3::Vector2D::Vector2D(double _x, double _y) [constructor]
|
||||
cls.add_constructor([param('double', '_x'), param('double', '_y')])
|
||||
## vector.h (module 'core'): ns3::Vector2D::Vector2D() [constructor]
|
||||
cls.add_constructor([])
|
||||
## vector.h (module 'core'): double ns3::Vector2D::GetLength() const [member function]
|
||||
cls.add_method('GetLength',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## vector.h (module 'core'): ns3::Vector2D::x [variable]
|
||||
cls.add_instance_attribute('x', 'double', is_const=False)
|
||||
## vector.h (module 'core'): ns3::Vector2D::y [variable]
|
||||
@@ -4808,25 +4783,12 @@ def register_Ns3Vector2D_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Vector3D_methods(root_module, cls):
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('double', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('/', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('double', 'right'))
|
||||
## vector.h (module 'core'): ns3::Vector3D::Vector3D(ns3::Vector3D const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Vector3D const &', 'arg0')])
|
||||
## vector.h (module 'core'): ns3::Vector3D::Vector3D(double _x, double _y, double _z) [constructor]
|
||||
cls.add_constructor([param('double', '_x'), param('double', '_y'), param('double', '_z')])
|
||||
## vector.h (module 'core'): ns3::Vector3D::Vector3D() [constructor]
|
||||
cls.add_constructor([])
|
||||
## vector.h (module 'core'): double ns3::Vector3D::GetLength() const [member function]
|
||||
cls.add_method('GetLength',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## vector.h (module 'core'): ns3::Vector3D::x [variable]
|
||||
cls.add_instance_attribute('x', 'double', is_const=False)
|
||||
## vector.h (module 'core'): ns3::Vector3D::y [variable]
|
||||
@@ -4875,6 +4837,7 @@ def register_Ns3Empty_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right'))
|
||||
@@ -4927,7 +4890,6 @@ def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('<')
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_output_stream_operator()
|
||||
@@ -6945,11 +6907,11 @@ def register_Ns3SpectrumValue_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Time_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_comparison_operator('<')
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', 'right'))
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_comparison_operator('<=')
|
||||
@@ -7104,11 +7066,10 @@ def register_Ns3TraceFadingLossModel_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::TraceFadingLossModel const &', 'arg0')])
|
||||
## trace-fading-loss-model.h (module 'lte'): ns3::TraceFadingLossModel::TraceFadingLossModel() [constructor]
|
||||
cls.add_constructor([])
|
||||
## trace-fading-loss-model.h (module 'lte'): void ns3::TraceFadingLossModel::DoStart() [member function]
|
||||
cls.add_method('DoStart',
|
||||
## trace-fading-loss-model.h (module 'lte'): void ns3::TraceFadingLossModel::CreateFadingChannelRealization(ns3::Ptr<const ns3::MobilityModel> enbMobility, ns3::Ptr<const ns3::MobilityModel> ueMobility) [member function]
|
||||
cls.add_method('CreateFadingChannelRealization',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
[param('ns3::Ptr< ns3::MobilityModel const >', 'enbMobility'), param('ns3::Ptr< ns3::MobilityModel const >', 'ueMobility')])
|
||||
## trace-fading-loss-model.h (module 'lte'): static ns3::TypeId ns3::TraceFadingLossModel::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
|
||||
@@ -276,8 +276,8 @@ def register_types(module):
|
||||
module.add_class('TagData', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagList'])
|
||||
## random-variable.h (module 'core'): ns3::RandomVariable [class]
|
||||
module.add_class('RandomVariable', import_from_module='ns.core')
|
||||
## rng-seed-manager.h (module 'core'): ns3::RngSeedManager [class]
|
||||
module.add_class('RngSeedManager', import_from_module='ns.core')
|
||||
## random-variable.h (module 'core'): ns3::SeedManager [class]
|
||||
module.add_class('SeedManager', import_from_module='ns.core')
|
||||
## lte-rlc-sequence-number.h (module 'lte'): ns3::SequenceNumber10 [class]
|
||||
module.add_class('SequenceNumber10')
|
||||
## random-variable.h (module 'core'): ns3::SequentialVariable [class]
|
||||
@@ -737,13 +737,9 @@ def register_types(module):
|
||||
module.add_container('std::map< unsigned short, ns3::Ptr< ns3::UeInfo > >', ('short unsigned int', 'ns3::Ptr< ns3::UeInfo >'), container_type='map')
|
||||
module.add_container('std::list< ns3::Ptr< ns3::IdealControlMessage > >', 'ns3::Ptr< ns3::IdealControlMessage >', container_type='list')
|
||||
module.add_container('std::list< ns3::UlDciIdealControlMessage >', 'ns3::UlDciIdealControlMessage', container_type='list')
|
||||
typehandlers.add_type_alias('ns3::RngSeedManager', 'ns3::SeedManager')
|
||||
typehandlers.add_type_alias('ns3::RngSeedManager*', 'ns3::SeedManager*')
|
||||
typehandlers.add_type_alias('ns3::RngSeedManager&', 'ns3::SeedManager&')
|
||||
module.add_typedef(root_module['ns3::RngSeedManager'], 'SeedManager')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned long long, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned long long > > >', 'ns3::Uint64Map')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned long long, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned long long > > >*', 'ns3::Uint64Map*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned long long, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned long long > > >&', 'ns3::Uint64Map&')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned long, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned long > > >', 'ns3::Uint64Map')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned long, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned long > > >*', 'ns3::Uint64Map*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned long, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned long > > >&', 'ns3::Uint64Map&')
|
||||
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ns3::GenericPhyTxEndCallback')
|
||||
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', 'ns3::GenericPhyTxEndCallback*')
|
||||
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', 'ns3::GenericPhyTxEndCallback&')
|
||||
@@ -762,9 +758,6 @@ def register_types(module):
|
||||
typehandlers.add_type_alias('std::vector< ns3::BandInfo, std::allocator< ns3::BandInfo > >', 'ns3::Bands')
|
||||
typehandlers.add_type_alias('std::vector< ns3::BandInfo, std::allocator< ns3::BandInfo > >*', 'ns3::Bands*')
|
||||
typehandlers.add_type_alias('std::vector< ns3::BandInfo, std::allocator< ns3::BandInfo > >&', 'ns3::Bands&')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >', 'ns3::expectedTbs_t')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >*', 'ns3::expectedTbs_t*')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >&', 'ns3::expectedTbs_t&')
|
||||
typehandlers.add_type_alias('ns3::Vector3D', 'ns3::Vector')
|
||||
typehandlers.add_type_alias('ns3::Vector3D*', 'ns3::Vector*')
|
||||
typehandlers.add_type_alias('ns3::Vector3D&', 'ns3::Vector&')
|
||||
@@ -776,12 +769,15 @@ def register_types(module):
|
||||
typehandlers.add_type_alias('uint32_t', 'ns3::SpectrumModelUid_t')
|
||||
typehandlers.add_type_alias('uint32_t*', 'ns3::SpectrumModelUid_t*')
|
||||
typehandlers.add_type_alias('uint32_t&', 'ns3::SpectrumModelUid_t&')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, double, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, double > > >', 'ns3::DoubleMap')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, double, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, double > > >*', 'ns3::DoubleMap*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, double, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, double > > >&', 'ns3::DoubleMap&')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned int, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned int > > >', 'ns3::Uint32Map')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned int, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned int > > >*', 'ns3::Uint32Map*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned int, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned int > > >&', 'ns3::Uint32Map&')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, double, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, double > > >', 'ns3::DoubleMap')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, double, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, double > > >*', 'ns3::DoubleMap*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, double, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, double > > >&', 'ns3::DoubleMap&')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >', 'ns3::expectedTbs_t')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >*', 'ns3::expectedTbs_t*')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >&', 'ns3::expectedTbs_t&')
|
||||
typehandlers.add_type_alias('ns3::Vector3DChecker', 'ns3::VectorChecker')
|
||||
typehandlers.add_type_alias('ns3::Vector3DChecker*', 'ns3::VectorChecker*')
|
||||
typehandlers.add_type_alias('ns3::Vector3DChecker&', 'ns3::VectorChecker&')
|
||||
@@ -795,9 +791,9 @@ def register_types(module):
|
||||
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ns3::GenericPhyRxEndOkCallback')
|
||||
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', 'ns3::GenericPhyRxEndOkCallback*')
|
||||
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', 'ns3::GenericPhyRxEndOkCallback&')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long long > >, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long long > > > > >', 'ns3::Uint64StatsMap')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long long > >, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long long > > > > >*', 'ns3::Uint64StatsMap*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long long > >, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long long > > > > >&', 'ns3::Uint64StatsMap&')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long > >, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long > > > > >', 'ns3::Uint64StatsMap')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long > >, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long > > > > >*', 'ns3::Uint64StatsMap*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long > >, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long > > > > >&', 'ns3::Uint64StatsMap&')
|
||||
|
||||
## Register a nested module for the namespace Config
|
||||
|
||||
@@ -938,7 +934,7 @@ def register_methods(root_module):
|
||||
register_Ns3PacketTagList_methods(root_module, root_module['ns3::PacketTagList'])
|
||||
register_Ns3PacketTagListTagData_methods(root_module, root_module['ns3::PacketTagList::TagData'])
|
||||
register_Ns3RandomVariable_methods(root_module, root_module['ns3::RandomVariable'])
|
||||
register_Ns3RngSeedManager_methods(root_module, root_module['ns3::RngSeedManager'])
|
||||
register_Ns3SeedManager_methods(root_module, root_module['ns3::SeedManager'])
|
||||
register_Ns3SequenceNumber10_methods(root_module, root_module['ns3::SequenceNumber10'])
|
||||
register_Ns3SequentialVariable_methods(root_module, root_module['ns3::SequentialVariable'])
|
||||
register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
|
||||
@@ -1401,10 +1397,6 @@ def register_Ns3BufferIterator_methods(root_module, cls):
|
||||
cls.add_method('Next',
|
||||
'void',
|
||||
[param('uint32_t', 'delta')])
|
||||
## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::PeekU8() [member function]
|
||||
cls.add_method('PeekU8',
|
||||
'uint8_t',
|
||||
[])
|
||||
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev() [member function]
|
||||
cls.add_method('Prev',
|
||||
'void',
|
||||
@@ -1417,10 +1409,6 @@ def register_Ns3BufferIterator_methods(root_module, cls):
|
||||
cls.add_method('Read',
|
||||
'void',
|
||||
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')])
|
||||
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(ns3::Buffer::Iterator start, uint32_t size) [member function]
|
||||
cls.add_method('Read',
|
||||
'void',
|
||||
[param('ns3::Buffer::Iterator', 'start'), param('uint32_t', 'size')])
|
||||
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadLsbtohU16() [member function]
|
||||
cls.add_method('ReadLsbtohU16',
|
||||
'uint16_t',
|
||||
@@ -4157,32 +4145,32 @@ def register_Ns3RandomVariable_methods(root_module, cls):
|
||||
is_const=True)
|
||||
return
|
||||
|
||||
def register_Ns3RngSeedManager_methods(root_module, cls):
|
||||
## rng-seed-manager.h (module 'core'): ns3::RngSeedManager::RngSeedManager() [constructor]
|
||||
def register_Ns3SeedManager_methods(root_module, cls):
|
||||
## random-variable.h (module 'core'): ns3::SeedManager::SeedManager() [constructor]
|
||||
cls.add_constructor([])
|
||||
## rng-seed-manager.h (module 'core'): ns3::RngSeedManager::RngSeedManager(ns3::RngSeedManager const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RngSeedManager const &', 'arg0')])
|
||||
## rng-seed-manager.h (module 'core'): static uint64_t ns3::RngSeedManager::GetNextStreamIndex() [member function]
|
||||
cls.add_method('GetNextStreamIndex',
|
||||
'uint64_t',
|
||||
[],
|
||||
## random-variable.h (module 'core'): ns3::SeedManager::SeedManager(ns3::SeedManager const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::SeedManager const &', 'arg0')])
|
||||
## random-variable.h (module 'core'): static bool ns3::SeedManager::CheckSeed(uint32_t seed) [member function]
|
||||
cls.add_method('CheckSeed',
|
||||
'bool',
|
||||
[param('uint32_t', 'seed')],
|
||||
is_static=True)
|
||||
## rng-seed-manager.h (module 'core'): static uint64_t ns3::RngSeedManager::GetRun() [member function]
|
||||
## random-variable.h (module 'core'): static uint32_t ns3::SeedManager::GetRun() [member function]
|
||||
cls.add_method('GetRun',
|
||||
'uint64_t',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_static=True)
|
||||
## rng-seed-manager.h (module 'core'): static uint32_t ns3::RngSeedManager::GetSeed() [member function]
|
||||
## random-variable.h (module 'core'): static uint32_t ns3::SeedManager::GetSeed() [member function]
|
||||
cls.add_method('GetSeed',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_static=True)
|
||||
## rng-seed-manager.h (module 'core'): static void ns3::RngSeedManager::SetRun(uint64_t run) [member function]
|
||||
## random-variable.h (module 'core'): static void ns3::SeedManager::SetRun(uint32_t run) [member function]
|
||||
cls.add_method('SetRun',
|
||||
'void',
|
||||
[param('uint64_t', 'run')],
|
||||
[param('uint32_t', 'run')],
|
||||
is_static=True)
|
||||
## rng-seed-manager.h (module 'core'): static void ns3::RngSeedManager::SetSeed(uint32_t seed) [member function]
|
||||
## random-variable.h (module 'core'): static void ns3::SeedManager::SetSeed(uint32_t seed) [member function]
|
||||
cls.add_method('SetSeed',
|
||||
'void',
|
||||
[param('uint32_t', 'seed')],
|
||||
@@ -4781,25 +4769,12 @@ def register_Ns3UniformVariable_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Vector2D_methods(root_module, cls):
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('double', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('/', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('double', 'right'))
|
||||
## vector.h (module 'core'): ns3::Vector2D::Vector2D(ns3::Vector2D const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Vector2D const &', 'arg0')])
|
||||
## vector.h (module 'core'): ns3::Vector2D::Vector2D(double _x, double _y) [constructor]
|
||||
cls.add_constructor([param('double', '_x'), param('double', '_y')])
|
||||
## vector.h (module 'core'): ns3::Vector2D::Vector2D() [constructor]
|
||||
cls.add_constructor([])
|
||||
## vector.h (module 'core'): double ns3::Vector2D::GetLength() const [member function]
|
||||
cls.add_method('GetLength',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## vector.h (module 'core'): ns3::Vector2D::x [variable]
|
||||
cls.add_instance_attribute('x', 'double', is_const=False)
|
||||
## vector.h (module 'core'): ns3::Vector2D::y [variable]
|
||||
@@ -4808,25 +4783,12 @@ def register_Ns3Vector2D_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Vector3D_methods(root_module, cls):
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('double', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('/', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('double', 'right'))
|
||||
## vector.h (module 'core'): ns3::Vector3D::Vector3D(ns3::Vector3D const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Vector3D const &', 'arg0')])
|
||||
## vector.h (module 'core'): ns3::Vector3D::Vector3D(double _x, double _y, double _z) [constructor]
|
||||
cls.add_constructor([param('double', '_x'), param('double', '_y'), param('double', '_z')])
|
||||
## vector.h (module 'core'): ns3::Vector3D::Vector3D() [constructor]
|
||||
cls.add_constructor([])
|
||||
## vector.h (module 'core'): double ns3::Vector3D::GetLength() const [member function]
|
||||
cls.add_method('GetLength',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## vector.h (module 'core'): ns3::Vector3D::x [variable]
|
||||
cls.add_instance_attribute('x', 'double', is_const=False)
|
||||
## vector.h (module 'core'): ns3::Vector3D::y [variable]
|
||||
@@ -4875,6 +4837,7 @@ def register_Ns3Empty_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right'))
|
||||
@@ -4927,7 +4890,6 @@ def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('<')
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_output_stream_operator()
|
||||
@@ -6945,11 +6907,11 @@ def register_Ns3SpectrumValue_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Time_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_comparison_operator('<')
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', 'right'))
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_comparison_operator('<=')
|
||||
@@ -7104,11 +7066,10 @@ def register_Ns3TraceFadingLossModel_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::TraceFadingLossModel const &', 'arg0')])
|
||||
## trace-fading-loss-model.h (module 'lte'): ns3::TraceFadingLossModel::TraceFadingLossModel() [constructor]
|
||||
cls.add_constructor([])
|
||||
## trace-fading-loss-model.h (module 'lte'): void ns3::TraceFadingLossModel::DoStart() [member function]
|
||||
cls.add_method('DoStart',
|
||||
## trace-fading-loss-model.h (module 'lte'): void ns3::TraceFadingLossModel::CreateFadingChannelRealization(ns3::Ptr<const ns3::MobilityModel> enbMobility, ns3::Ptr<const ns3::MobilityModel> ueMobility) [member function]
|
||||
cls.add_method('CreateFadingChannelRealization',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
[param('ns3::Ptr< ns3::MobilityModel const >', 'enbMobility'), param('ns3::Ptr< ns3::MobilityModel const >', 'ueMobility')])
|
||||
## trace-fading-loss-model.h (module 'lte'): static ns3::TypeId ns3::TraceFadingLossModel::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
|
||||
@@ -596,15 +596,15 @@ usable by user :math:`i` on resource block :math:`k` according to what reported
|
||||
model (see `Adaptive Modulation and Coding`_); finally, let :math:`S(M, B)` be the TB
|
||||
size in bits as defined in [TS36213]_ for the case where a number :math:`B` of
|
||||
resource blocks is used. The achievable rate :math:`R_{i}(k,t)` in bit/s for user :math:`i`
|
||||
on resource block group :math:`k` at subframe :math:`t` is defined as
|
||||
on resource block :math:`k` at subframe :math:`t` is defined as
|
||||
|
||||
.. math::
|
||||
|
||||
R_{i}(k,t) = \frac{S\left( M_{i,k}(t), 1\right)}{\tau}
|
||||
|
||||
where :math:`\tau` is the TTI duration.
|
||||
At the start of each subframe :math:`t`, each RBG is assigned to a certain user.
|
||||
In detail, the index :math:`\widehat{i}_{k}(t)` to which RBG :math:`k` is assigned at time
|
||||
At the start of each subframe :math:`t`, each RB is assigned to a certain user.
|
||||
In detail, the index :math:`\widehat{i}_{k}(t)` to which RB :math:`k` is assigned at time
|
||||
:math:`t` is determined as
|
||||
|
||||
.. math::
|
||||
@@ -637,7 +637,7 @@ determine the MCS :math:`\widehat{M}_j(t)` actually used by user
|
||||
|
||||
\widehat{M}_j(t) = \min_{k: \widehat{i}_{k}(t) = j}{M_{j,k}(t)}
|
||||
|
||||
then we determine the total number :math:`\widehat{B}_j(t)` of RBGs allocated to user
|
||||
then we determine the total number :math:`\widehat{B}_j(t)` of RBs allocated to user
|
||||
:math:`j`:
|
||||
|
||||
.. math::
|
||||
|
||||
@@ -21,10 +21,6 @@
|
||||
|
||||
.. [R1-081483] 3GPP R1-081483 `Conveying MCS and TB size via PDCCH <http://www.3gpp.org/ftp/tsg_ran/WG1_RL1/TSGR1_52b/Docs/R1-081483.zip>`_
|
||||
|
||||
.. [R4-092042] 3GPP R4-092042 "Simulation assumptions and parameters for FDD HeNB RF requirements"
|
||||
|
||||
.. [TR36814] 3GPP TR 36.814 "E-UTRA Further advancements for E-UTRA physical layer aspects"
|
||||
|
||||
.. [FFAPI] `FemtoForum LTE MAC Scheduler Interface Specification v1.11 <http://www.femtoforum.org/femto/technical.php>`_
|
||||
|
||||
.. [ns3tutorial] `The ns-3 Tutorial <http://www.nsnam.org/docs/tutorial/singlehtml/index.html>`_
|
||||
|
||||
@@ -368,7 +368,7 @@ Physical Error Model
|
||||
--------------------
|
||||
|
||||
|
||||
The test suite ``lte-test-phy-error-model`` generates nine test cases with single eNB and a various number of UEs, all having the same Radio Bearer specification. Each test is designed for evaluating the error rate perceived by a specific TB size in order to verify that it corresponds to the expected values according to the BLER generated for CB size analog to the TB size. This means that, for instance, the test will check that the performance of a TB of :math:`N` bits is analogous to the one of a a CB size of :math:`N` bits by collecting the performance of a user which has been forced the generation of a such TB size according to the distance to eNB. In order to significantly test the BER at MAC level, we modified the Adaptive Modulation and Coding (AMC) module, the ``LteAmc`` class, for making it less robust to channel conditions by adding a configurable BER parameter (called ``Ber`` in the ns3 attribute system) which enable the selection of the desired BER at MAC level when choosing the MCS to be used. In detail, the AMC module has been forced to select the AMC considering a BER of 0.01 (instead of the standard value equal to 0.00005). We note that, these values do not reflect actual BER since they come from an analytical bound which do not consider all the transmission chain aspects; therefore the resulted BER might be different.
|
||||
The test suite ``lte-phy-error-model`` generates nine test cases with single eNB and a various number of UEs, all having the same Radio Bearer specification. Each test is designed for evaluating the error rate perceived by a specific TB size in order to verify that it corresponds to the expected values according to the BLER generated for CB size analog to the TB size. This means that, for instance, the test will check that the performance of a TB of :math:`N` bits is analogous to the one of a a CB size of :math:`N` bits by collecting the performance of a user which has been forced the generation of a such TB size according to the distance to eNB. In order to significantly test the BER at MAC level, we modified the Adaptive Modulation and Coding (AMC) module, the ``LteAmc`` class, for making it less robust to channel conditions by adding a configurable BER parameter (called ``Ber`` in the ns3 attribute system) which enable the selection of the desired BER at MAC level when choosing the MCS to be used. In detail, the AMC module has been forced to select the AMC considering a BER of 0.01 (instead of the standard value equal to 0.00005). We note that, these values do not reflect actual BER since they come from an analytical bound which do not consider all the transmission chain aspects; therefore the resulted BER might be different.
|
||||
|
||||
The parameters of the nine test cases are reported in the following:
|
||||
|
||||
@@ -403,7 +403,7 @@ The parameters of the nine test cases are reported in the following:
|
||||
BLER for test 6.
|
||||
|
||||
|
||||
The test verifies that in each case the obtained number of packets received correctly falls within the 99.9% confidence interval (CI) of a Binomial distribution where the parameter :math:`p` is equal to :math:`1-BER`, the parameter :math:`n` is the total number of packets sent and the parameter :math:`k` is the number of packets correctly received. The value of the CI has been chosen for guaranteeing a sufficient margin on the errors due to the quantization of the MI values in the tables.
|
||||
The test verifies that in each case the expected number of packets received correct corresponds to a Bernoulli distribution with a confidence interval of 95%, where the probability of success in each trail is :math:`1-BER` and :math:`n` is the total number of packet sent.
|
||||
|
||||
|
||||
MIMO Model
|
||||
|
||||
Loaded 100 of 197 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user